pub struct Workbench { /* private fields */ }Expand description
The daemon’s workbench.
Implementations§
Source§impl Workbench
impl Workbench
Sourcepub fn new(layout: &Layout, delegations: Arc<DelegationRegistry>) -> Arc<Self> ⓘ
pub fn new(layout: &Layout, delegations: Arc<DelegationRegistry>) -> Arc<Self> ⓘ
The workbench of the instance at layout, whose delegated runs
delegations records.
Sourcepub fn register_session(
self: &Arc<Self>,
id: &str,
label: &str,
workspace: &Path,
) -> SessionHandle
pub fn register_session( self: &Arc<Self>, id: &str, label: &str, workspace: &Path, ) -> SessionHandle
Register a live session; label says who it serves.
Sourcepub fn watch(&self)
pub fn watch(&self)
The owner is watching: background approval requests wait for an
answer for the next WATCH_TTL.
Sourcepub fn attended_gate(
self: &Arc<Self>,
session: &str,
unattended: Arc<dyn ApprovalGate>,
) -> Arc<dyn ApprovalGate> ⓘ
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.
Sourcepub fn approve(&self, id: &str, approved: bool) -> Result<String, String>
pub fn approve(&self, id: &str, approved: bool) -> Result<String, String>
Answer approval request id.
Sourcepub fn snapshot(&self) -> WorkbenchSnapshot
pub fn snapshot(&self) -> WorkbenchSnapshot
Everything the workbench shows now. restorable is left for the
server, which keeps session queues.
Sourcepub fn check_worktree_unused(&self, path: &Path) -> Result<(), String>
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).
Sourcepub fn worktree_users(&self, path: &Path) -> Vec<String>
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.
Sourcepub fn run_log(
&self,
handle: &str,
after: u64,
limit: usize,
) -> Result<RunLogPage, String>
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.
Sourcepub async fn send(
&self,
session: &str,
conversation: &str,
prompt: &str,
mode: SendMode,
) -> Result<Sent, String>
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.
Sourcepub async fn start(
&self,
session: &str,
arguments: Value,
) -> Result<String, String>
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>.
Sourcepub async fn resume(
&self,
host: &str,
session: &str,
job: &str,
) -> Result<String, String>
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>.
Sourcepub fn cancel(&self, session: &str, job: &str) -> Result<String, String>
pub fn cancel(&self, session: &str, job: &str) -> Result<String, String>
Stop job job of live session session.
Sourcepub fn dismiss(&self, session: &str, job: &str) -> Result<String, String>
pub fn dismiss(&self, session: &str, job: &str) -> Result<String, String>
Forget finished or interrupted job job of session.
Sourcepub fn job_record(&self, session: &str, job: &str) -> Option<JobRecord>
pub fn job_record(&self, session: &str, job: &str) -> Option<JobRecord>
The ledger record of job in session.
Sourcepub fn maintain(&self) -> Maintenance
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.