Skip to main content

Chat

Struct Chat 

Source
pub struct Chat { /* private fields */ }

Implementations§

Source§

impl Chat

Source

pub fn new(state: PathBuf, executable: PathBuf) -> Self

Source

pub fn discover(state: PathBuf) -> Self

Desktop discovers the packaged CLI when a session needs it, not at app startup.

Source

pub fn close(&self) -> impl Future<Output = ()> + use<>

Stop accepting work, commit durable Stop in SQLite before cancelling owned turns, wait for their saved outcomes and ownership release, and drain all warm ACP children. Verify Runs already admitted remain independent of Chat.

Source

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.

Source

pub async fn default_target( &self, worktree: &Path, ) -> Result<Option<ChatTarget>, String>

The starting target for a new session: the worktree’s last available choice, or the first ready ACP Chat agent, or the first available direct HTTP provider model.

Source

pub async fn default_target_for( &self, worktree: &Path, branch: Option<&Place>, ) -> Result<Option<ChatTarget>, String>

Source

pub async fn create( &self, worktree: &Path, selection: Option<ChatTarget>, ) -> Result<Session, String>

Persist an empty session, with no target unless one is explicitly selected.

Source

pub async fn create_for_branch( &self, workspace: &Path, branch: Option<&Place>, selection: Option<ChatTarget>, ) -> Result<Session, String>

Create only on the checkout the person selected, not a branch switched in meanwhile.

Source

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.

Source

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. Evicts any warm ACP child owned by this process for the moved session.

Source

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.

Source

pub async fn latest_for_unavailable_checkout( &self, workspace: &Path, ) -> Result<Option<Session>, String>

Find a conversation by its former checkout, including a workspace within the worktree.

Source

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.

Source

pub async fn latest_for_navigation( &self, branch: &Place, ) -> Result<Option<Session>, String>

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn watermark( &self, id: &SessionId, ) -> Result<Option<ChatWatermark>, String>

Lightweight SQLite watermark across (chat_sessions, chat_active_turns, chat_pending_permissions) tracked by Desktop watch.rs alongside transcript_size.

Source

pub async fn evict_warm_if_stale(&self, id: &SessionId)

Evict any local warm ACP child whose committed acp_binding.generation has advanced (called on Change::SessionInvalidated so another process’s move/switch terminates stale local children promptly).

Source

pub async fn open(&self, id: &SessionId) -> Result<View, String>

The model/agent’s streamed text, rich ACP blocks, live permissions, and Run cards.

Source

pub async fn set_target( &self, id: &SessionId, selection: ChatTarget, ) -> Result<Session, String>

Save a Chat target for the next turn without adding a message. An accepted turn keeps the target it started with, even if the user changes the picker while it streams.

Source

pub async fn respond_permission( &self, id: &SessionId, permission_id: &str, option_id: &str, ) -> Result<bool, String>

Respond to a pending ACP permission card (PENDING -> SELECTED in one IMMEDIATE SQLite transaction) and wake any local owning turn immediately.

Source

pub async fn trust_workspace( &self, worktree: &Path, agent_id: &AgentId, ) -> Result<TrustRecord, String>

Record explicit machine-local Workspace Trust for an ACP agent on a worktree/repo scope.

Source

pub fn list_trust(&self) -> Result<Vec<TrustRecord>, String>

List all saved machine-local ACP Workspace Trust records.

Source

pub async fn revoke_trust( &self, agent_id: &AgentId, scope: &TrustScope, ) -> Result<bool, String>

Revoke a saved Workspace Trust record and terminate any matching warm ACP children.

Source

pub async fn send( &self, id: &SessionId, text: String, selection: Option<ChatTarget>, ) -> 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, permissions and Run references arrive.

Source

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. Always commits the SQLite Stop transaction (stop_requested = true + permission cancellation) BEFORE firing the in-memory CancellationToken.

Source

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.

Trait Implementations§

Source§

impl Clone for Chat

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl Forget for Chat

§

impl Freeze for Chat

§

impl Move for Chat

§

impl RefUnwindSafe for Chat

§

impl Send for Chat

§

impl Sync for Chat

§

impl Unpin for Chat

§

impl UnsafeUnpin for Chat

§

impl UnwindSafe for Chat

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more