pub struct Chat { /* private fields */ }Implementations§
Source§impl Chat
impl Chat
pub fn new(state: PathBuf, executable: PathBuf) -> Self
Sourcepub fn discover(state: PathBuf) -> Self
pub fn discover(state: PathBuf) -> Self
Desktop discovers the packaged CLI when a session needs it, not at app startup.
Sourcepub fn close(&self) -> impl Future<Output = ()> + use<>
pub fn close(&self) -> impl Future<Output = ()> + use<>
Stop accepting work, cancel owned Chat turns and wait for their saved outcomes and ownership release. Verify Runs already admitted remain independent of Chat.
Sourcepub async fn reconcile_interrupted(&self) -> Result<Vec<SessionId>, String>
pub async fn reconcile_interrupted(&self) -> Result<Vec<SessionId>, String>
Reconcile exact turn ownership after a process dies without a final change hint. Returns only sessions this observer actually reconciled.
Sourcepub async fn default_model(
&self,
worktree: &Path,
) -> Result<Option<Model>, String>
pub async fn default_model( &self, worktree: &Path, ) -> Result<Option<Model>, String>
The starting model for a new session: the worktree’s last available choice, or the first listed model in Settings order after every provider has answered.
pub async fn default_model_for( &self, worktree: &Path, branch: Option<&Place>, ) -> Result<Option<Model>, String>
Sourcepub async fn create(
&self,
worktree: &Path,
selection: Option<Model>,
) -> Result<Session, String>
pub async fn create( &self, worktree: &Path, selection: Option<Model>, ) -> Result<Session, String>
Persist an empty session, with no model unless one is explicitly selected.
Sourcepub async fn create_for_branch(
&self,
workspace: &Path,
branch: Option<&Place>,
selection: Option<Model>,
) -> Result<Session, String>
pub async fn create_for_branch( &self, workspace: &Path, branch: Option<&Place>, selection: Option<Model>, ) -> Result<Session, String>
Create only on the checkout the person selected, not a branch switched in meanwhile.
Sourcepub async fn branches(
&self,
launch: Option<&Path>,
) -> Result<BranchListing, String>
pub async fn branches( &self, launch: Option<&Path>, ) -> Result<BranchListing, String>
Discover the live choices used by the Chat branch picker, independently of Verify search.
Sourcepub async fn set_worktree(
&self,
id: &SessionId,
worktree: &Path,
launch: Option<&Path>,
) -> Result<Session, MoveError>
pub async fn set_worktree( &self, id: &SessionId, worktree: &Path, launch: Option<&Path>, ) -> Result<Session, MoveError>
Rebind the saved conversation to a live choice, excluding active turns in any process.
Sourcepub async fn list(
&self,
worktree: Option<&Path>,
query: Option<&str>,
) -> Result<Vec<Session>, String>
pub async fn list( &self, worktree: Option<&Path>, query: Option<&str>, ) -> Result<Vec<Session>, String>
Keep the catalog’s activity order while matching every word across its displayed labels.
Find a conversation by its former checkout, including a workspace within the worktree.
Sourcepub async fn latest_for_branch(
&self,
branch: &Place,
) -> Result<Option<Session>, String>
pub async fn latest_for_branch( &self, branch: &Place, ) -> Result<Option<Session>, String>
The most recently active saved session on this branch, even if its checkout is gone.
Prefer the newest usable session for branch navigation. If the checkout moved and none can work on it, keep the newest saved conversation reachable with its diagnostic.
Sourcepub async fn latest_available_for_branch(
&self,
branch: &Place,
) -> Result<Option<Session>, String>
pub async fn latest_available_for_branch( &self, branch: &Place, ) -> Result<Option<Session>, String>
The latest session whose exact checkout can be worked on now.
Sourcepub async fn current_worktree(
&self,
branch: &Place,
) -> Result<Option<PathBuf>, String>
pub async fn current_worktree( &self, branch: &Place, ) -> Result<Option<PathBuf>, String>
The oldest usable checkout anchors Current when there is no Verify workspace. Activity in a newer session must not redirect scans, edits or tools.
Sourcepub async fn set_view(
&self,
id: &SessionId,
view: SessionView,
) -> Result<Session, String>
pub async fn set_view( &self, id: &SessionId, view: SessionView, ) -> Result<Session, String>
Save a view without changing the session’s activity order or requiring a live checkout.
Sourcepub async fn mark_seen(&self, id: &SessionId) -> Result<(), String>
pub async fn mark_seen(&self, id: &SessionId) -> Result<(), String>
Acknowledge the latest settled outcome without changing the session’s activity order. A turn still running will become unseen when it settles, even if this is called now.
Sourcepub fn transcript_size(&self, id: &SessionId) -> Option<u64>
pub fn transcript_size(&self, id: &SessionId) -> Option<u64>
Chat records are append-only. Readers can detect a missed hint without parsing a
transcript, with None covering a session that has not yet accepted a turn.
Sourcepub async fn open(&self, id: &SessionId) -> Result<View, String>
pub async fn open(&self, id: &SessionId) -> Result<View, String>
The model’s streamed text, tools, and current state of each referenced Run.
Sourcepub async fn set_model(
&self,
id: &SessionId,
selection: Model,
) -> Result<Session, String>
pub async fn set_model( &self, id: &SessionId, selection: Model, ) -> Result<Session, String>
Save a selection for the next turn without adding a message. An accepted turn keeps the selection it started with, even if the user changes the model while it streams.
Sourcepub async fn send(
&self,
id: &SessionId,
text: String,
selection: Option<Model>,
) -> Result<(), SendError>
pub async fn send( &self, id: &SessionId, text: String, selection: Option<Model>, ) -> Result<(), SendError>
Start a durable turn and return as soon as it has an accepted user message. The recorder
notifies SessionInvalidated(id) as text, tool outcomes and Run references arrive.
Sourcepub async fn stop(&self, id: &SessionId) -> Result<bool, String>
pub async fn stop(&self, id: &SessionId) -> Result<bool, String>
Stop the active turn, even if another app owns it. Accepted Verify Runs are independent.
Sourcepub async fn stop_running(&self) -> Result<(), StopRunningError>
pub async fn stop_running(&self) -> Result<(), StopRunningError>
The desktop’s quit prompt names every running Chat. Deliver the same Stop to those turns even when another process owns them, before the desktop window closes.