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 fn open_for_reading(dir: &Path) -> Result<Option<Self>, PlaneError>
pub fn open_for_reading(dir: &Path) -> Result<Option<Self>, PlaneError>
The journal read beside its writer, with no skills and no model:
the waiting calls and recorded calls as they stand. None when the
project has no journal. Nothing is written — not even an expired
call’s denial, which the next writer records.
§Errors
The journal cannot be read (open_reader).
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 tool_calls(
&self,
server: &str,
tool: &str,
) -> Result<RecordedCalls, PlaneError>
pub async fn tool_calls( &self, server: &str, tool: &str, ) -> Result<RecordedCalls, PlaneError>
Every call of server/tool the journal records as dispatched, in
every run, with the time its run last wrote and whether it was
decided on an object (a person’s decision or grant) — and what could
not be read: a run unreadable is reported, never skipped silently.
Sourcepub async fn holds_a_pre_054_decision(&self, run: RunId) -> bool
pub async fn holds_a_pre_054_decision(&self, run: RunId) -> bool
Whether run read a person’s decision recorded by speccoder 0.2.0
(agentplane 0.53 and earlier): a decision with approved, which
agentplane 0.54 replaced by a verdict, so the run cannot read it
and fails on it. Told from the record’s shape, never a message.
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_at(
&self,
task: TaskId,
decision: &Decision,
expected: Option<Digest>,
) -> Result<Delivery, PlaneError>
pub async fn decide_at( &self, task: TaskId, decision: &Decision, expected: Option<Digest>, ) -> Result<Delivery, PlaneError>
Plane::decide, refused (nothing recorded) unless the task row
is still the one whose justification digest is expected.
Sourcepub async fn decide_inline(
&self,
outcome: RunOutcome,
approver: Option<&dyn Approver>,
context: &PresentContext,
) -> Result<Inline, PlaneError>
pub async fn decide_inline( &self, outcome: RunOutcome, approver: Option<&dyn Approver>, context: &PresentContext, ) -> Result<Inline, 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, the call still waiting, if
the person answered “later”, nobody is there or the call waits in
its run’s batch, and the calls answered Always Allow (approved once
here; their argv is added to the allow list by
actions::perform(AllowAlways), which the caller runs).
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.
Auto Trait Implementations§
impl !RefUnwindSafe for Plane
impl !UnwindSafe for Plane
impl Freeze for Plane
impl Send for Plane
impl Sync for Plane
impl Unpin for Plane
impl UnsafeUnpin for Plane
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more