Skip to main content

Workbench

Struct Workbench 

Source
pub struct Workbench { /* private fields */ }
Expand description

The daemon’s workbench.

Implementations§

Source§

impl Workbench

Source

pub fn new(layout: &Layout, delegations: Arc<DelegationRegistry>) -> Arc<Self> ⓘ

The workbench of the instance at layout, whose delegated runs delegations records.

Source

pub fn jobs_dir(&self) -> &Path

Where the job ledger is.

Source

pub fn register_session( self: &Arc<Self>, id: &str, label: &str, workspace: &Path, ) -> SessionHandle

Register a live session; label says who it serves.

Source

pub fn watch(&self)

The owner is watching: background approval requests wait for an answer for the next WATCH_TTL.

Source

pub fn attended_gate( self: &Arc<Self>, session: &str, unattended: Arc<dyn ApprovalGate>, ) -> Arc<dyn ApprovalGate> ⓘ

The approval gate for background jobs of session: unattended decides, except that a request it would deny waits up to ATTENDED_WAIT for the owner while the owner watches. It never denies what unattended allows.

Source

pub fn approve(&self, id: &str, approved: bool) -> Result<String, String>

Answer approval request id.

Source

pub fn snapshot(&self) -> WorkbenchSnapshot

Everything the workbench shows now. restorable is left for the server, which keeps session queues.

Source

pub fn check_worktree_unused(&self, path: &Path) -> Result<(), String>

Refuse to remove the worktree holding path while anything still works in it (Self::worktree_users).

Source

pub fn worktree_users(&self, path: &Path) -> Vec<String>

What still runs in the SCV worktree holding path (its top, or any directory in it): jobs not yet finished that recorded it, and delegated runs whose processes work inside it.

Source

pub fn run_log( &self, handle: &str, after: u64, limit: usize, ) -> Result<RunLogPage, String>

One page of run handle’s activity log after byte position after.

Source

pub async fn send( &self, session: &str, conversation: &str, prompt: &str, mode: SendMode, ) -> Result<Sent, String>

Give conversation conversation of live session session the owner’s prompt.

Source

pub async fn start( &self, session: &str, arguments: Value, ) -> Result<String, String>

Start the owner’s own job in live session session with the agent call arguments. Returns <session>/<job>.

Source

pub async fn resume( &self, host: &str, session: &str, job: &str, ) -> Result<String, String>

Run interrupted job job of session again as the owner’s job in live session host, which serves the job’s workspace. It continues the agent’s own conversation when the agent saved one and can resume it; otherwise it starts over, told that an earlier attempt may have left changes. A queued follow-up has no run of its own: it uses the conversation’s directory and worktree, continues that agent session only after the interrupted job the run served has been resumed (and then behind that conversation), and otherwise starts in a new worktree of the checkout that job recorded. Each job is resumed once, and not while an agent process of its run still goes. Returns <host>/<new job>.

Source

pub fn cancel(&self, session: &str, job: &str) -> Result<String, String>

Stop job job of live session session.

Source

pub fn dismiss(&self, session: &str, job: &str) -> Result<String, String>

Forget finished or interrupted job job of session.

Source

pub fn job_record(&self, session: &str, job: &str) -> Option<JobRecord>

The ledger record of job in session.

Source

pub fn maintain(&self) -> Maintenance

Settle what processes that stopped left unfinished, and remove old records: the daemon runs this at startup and every minute.

Trait Implementations§

Source§

impl Debug for Workbench

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> Same for T

Source§

type Output = T

Should always be Self
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> 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