pub struct Plane {
pub replaced_journal: Option<PathBuf>,
/* private fields */
}Expand description
An open plane.
Fields§
§replaced_journal: Option<PathBuf>Where an unreadable journal was moved before a fresh one was opened.
Implementations§
Source§impl Plane
impl Plane
Sourcepub fn open(
dir: &Path,
model: &ModelConfig,
provider: Arc<dyn ModelProvider>,
) -> Result<Self, PlaneError>
pub fn open( dir: &Path, model: &ModelConfig, provider: Arc<dyn ModelProvider>, ) -> Result<Self, PlaneError>
Opens (or creates) the journal at dir/journal.redb with provider
registered under the configured provider name.
Sourcepub fn open_with_tools(
dir: &Path,
model: &ModelConfig,
provider: Arc<dyn ModelProvider>,
tools: Option<Arc<WorkspaceTools>>,
) -> Result<Self, PlaneError>
pub fn open_with_tools( dir: &Path, model: &ModelConfig, provider: Arc<dyn ModelProvider>, tools: Option<Arc<WorkspaceTools>>, ) -> Result<Self, PlaneError>
Plane::open with speccoder’s tools bound to a worktree.
Sourcepub fn open_with(
dir: &Path,
model: &ModelConfig,
provider: Arc<dyn ModelProvider>,
tools: Option<Arc<WorkspaceTools>>,
hooks: Hooks,
) -> Result<Self, PlaneError>
pub fn open_with( dir: &Path, model: &ModelConfig, provider: Arc<dyn ModelProvider>, tools: Option<Arc<WorkspaceTools>>, hooks: Hooks, ) -> Result<Self, PlaneError>
Plane::open_with_tools with someone to ask inline.
Sourcepub fn open_for_decisions(dir: &Path) -> Result<Self, PlaneError>
pub fn open_for_decisions(dir: &Path) -> Result<Self, PlaneError>
The journal with no skills and no model: enough to record a person’s
decision on a waiting call (speccoder task approve), which the attempt’s
own run picks up when it resumes (agentplane’s Delivery::Buffered).
Sourcepub async fn expire_due(&self, now: Timestamp) -> Result<(), PlaneError>
pub async fn expire_due(&self, now: Timestamp) -> Result<(), PlaneError>
Settles every waiting call whose deadline has passed at now: the
call is denied as expired, nobody’s decision. Only on a plane without
skills (Plane::open_for_decisions) — the attempt resumes in its own
run, with its own worktree, the next time it runs.
Sourcepub async fn withdraw(
&self,
task: &Task,
by: &Operator,
reason: &str,
) -> Result<(), PlaneError>
pub async fn withdraw( &self, task: &Task, by: &Operator, reason: &str, ) -> Result<(), PlaneError>
Withdraws a waiting call whose attempt was set aside: its run is cancelled on the record (who, why) and the call leaves the queue.
Sourcepub async fn waiting_on(
&self,
outcome: &RunOutcome,
) -> Result<Option<Task>, PlaneError>
pub async fn waiting_on( &self, outcome: &RunOutcome, ) -> Result<Option<Task>, PlaneError>
The person’s task a suspended run waits on, if it waits on one.
Sourcepub async fn open_tasks(&self) -> Result<Vec<Task>, PlaneError>
pub async fn open_tasks(&self) -> Result<Vec<Task>, PlaneError>
Every task waiting for a person, oldest first.
Sourcepub async fn decide(
&self,
task: TaskId,
decision: &Decision,
) -> Result<Delivery, PlaneError>
pub async fn decide( &self, task: TaskId, decision: &Decision, ) -> Result<Delivery, PlaneError>
Records a person’s decision on task: the run continues at once
when this plane holds its skill, else when it next resumes.
Sourcepub async fn decide_inline(
&self,
outcome: RunOutcome,
approver: Option<&dyn Approver>,
context: &PresentContext,
) -> Result<(RunOutcome, Option<Task>), PlaneError>
pub async fn decide_inline( &self, outcome: RunOutcome, approver: Option<&dyn Approver>, context: &PresentContext, ) -> Result<(RunOutcome, Option<Task>), PlaneError>
Asks approver about each call the run waits on, records the
decision and lets the run continue, until it no longer waits on a
person. Returns the run as it rests and the call still waiting, if
the person answered “later” or nobody is there.
Sourcepub async fn outcome(
&self,
run: RunId,
) -> Result<Option<RunOutcome>, PlaneError>
pub async fn outcome( &self, run: RunId, ) -> Result<Option<RunOutcome>, PlaneError>
The run as it rests now, its output included: the journal records what happened, not a step’s value, so the value is re-derived by strict replay, which performs nothing.
Sourcepub async fn converge(
&self,
feature: &str,
input: Tainted<Value>,
) -> Result<RunOutcome, PlaneError>
pub async fn converge( &self, feature: &str, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>
Runs speccoder.feature.converge, correlated to the feature.
Sourcepub async fn skill(
&self,
name: &str,
input: Tainted<Value>,
) -> Result<RunOutcome, PlaneError>
pub async fn skill( &self, name: &str, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>
Runs speccoder.skill.run for an installed skill.
Sourcepub async fn monitor(
&self,
feature: &str,
task: &str,
input: Tainted<Value>,
) -> Result<RunOutcome, PlaneError>
pub async fn monitor( &self, feature: &str, task: &str, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>
Runs speccoder.task.monitor, correlated to the task, admitted once
per input: judging the same change again reads the recorded answer
back instead of asking again.
Sourcepub async fn near_miss(
&self,
feature: &str,
task: &str,
input: Tainted<Value>,
) -> Result<RunOutcome, PlaneError>
pub async fn near_miss( &self, feature: &str, task: &str, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>
Runs speccoder.task.near_miss, admitted once per input like
monitor: a held attempt judged again after a
person’s ruling meets the same variants, not new ones.
Sourcepub async fn acceptance(
&self,
feature: &str,
task: &str,
input: Tainted<Value>,
) -> Result<RunOutcome, PlaneError>
pub async fn acceptance( &self, feature: &str, task: &str, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>
Runs speccoder.task.acceptance: acceptance tests derived from the spec.
Sourcepub async fn attempt(
&self,
feature: &str,
task: &str,
input: Tainted<Value>,
) -> Result<RunOutcome, PlaneError>
pub async fn attempt( &self, feature: &str, task: &str, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>
Runs one speccoder.task.attempt for a bundle, correlated to the task.
Sourcepub async fn attempt_keyed(
&self,
feature: &str,
task: &str,
input: Tainted<Value>,
key: &str,
) -> Result<(RunOutcome, bool), PlaneError>
pub async fn attempt_keyed( &self, feature: &str, task: &str, input: Tainted<Value>, key: &str, ) -> Result<(RunOutcome, bool), PlaneError>
attempt admitted under key: the first time it
runs; after a crash the same key finds the interrupted run — a run
that had rested is re-derived by strict replay, which performs
nothing, and one still in flight is resumed from its journal (a dead
process’s lease is freed when the store opens), so finished model and
tool calls are read back, not repeated. The bool says whether this
was such a resume: what the run’s notice may claim.
Sourcepub async fn propose(
&self,
feature: &str,
task: &str,
input: Tainted<Value>,
) -> Result<RunOutcome, PlaneError>
pub async fn propose( &self, feature: &str, task: &str, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>
Runs speccoder.task.propose for a bundle, correlated to the task.