Skip to main content

Plane

Struct Plane 

Source
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

Source

pub fn open_ask( dir: &Path, model: &ModelConfig, provider: Arc<dyn ModelProvider>, wiring: AskWiring, ) -> Result<Self, PlaneError>

Opens (or creates) the Ask journal at dir/journal.redb.

§Errors

Another turn holds the journal, or it cannot be opened.

Source

pub async fn ask_start( &self, id: &str, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>

Starts conversation id: the run waits for its first message.

§Errors

The run cannot be admitted.

Source

pub async fn ask_deliver( &self, id: &str, message_id: &str, payload: Value, ) -> Result<bool, PlaneError>

Delivers a person’s message to conversation id; its run answers and waits again before this returns. false: no run waits (it ended or went idle).

§Errors

The message cannot be stored, or the run cannot resume.

Source

pub async fn ask_stop(&self, run: &str, by: &str) -> Result<(), PlaneError>

Stops conversation run run at its next step boundary, on the record (by): the turn in flight ends and the run with it.

§Errors

run is not a run id, or the stop cannot be recorded.

Source§

impl Plane

Source

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.

Source

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.

Source

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.

Source

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).

Source

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).

Source

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.

Source

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.

Source

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.

Source

pub async fn task(&self, id: TaskId) -> Result<Option<Task>, PlaneError>

One task row.

Source

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.

Source

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.

Source

pub async fn open_tasks(&self) -> Result<Vec<Task>, PlaneError>

Every task waiting for a person, oldest first.

Source

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.

Source

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.

Source

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).

Source

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.

Source

pub async fn converge( &self, feature: &str, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>

Runs speccoder.feature.converge, correlated to the feature.

Source

pub async fn shape( &self, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>

Runs speccoder.shape: a person’s words made into the field’s kind of text.

Source

pub async fn skill( &self, name: &str, input: Tainted<Value>, ) -> Result<RunOutcome, PlaneError>

Runs speccoder.skill.run for an installed skill.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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