Skip to main content

FileProjectionAdapter

Struct FileProjectionAdapter 

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

File-backed ProjectionAdapter: materializes the projected value under root, at the target ProjectionPlacement::target_path resolves for key, and reads it back on Self::fetch. Self::new resolves through ProjectionPlacement::default (the pre-GH-#27 hardcoded <root>/workspace/tasks/<task_id>/ctx/<step-or-_ctx>.md layout, unchanged); Self::with_placement resolves through a caller-supplied resolver instead — see crate::core::projection_placement’s module doc for the “3 path” convergence this collapses.

Implementations§

Source§

impl FileProjectionAdapter

Source

pub fn new(root: impl Into<PathBuf>) -> Self

Builds an adapter rooted at root (typically the resolved work_dir / project_root) using the byte-compat ProjectionPlacement::default resolver.

Source

pub fn with_placement( root: impl Into<PathBuf>, placement: ProjectionPlacement, ) -> Self

Builds an adapter rooted at root, resolving materialize targets through the given placement instead of the byte-compat default — the constructor every one of the “3 path” call sites (crate::core::projection_placement’s module doc) uses once they hold a Blueprint-resolved ProjectionPlacement.

Source

pub fn materialize_submission( &self, key: &ProjectionKey, value: &Value, attempt: u32, ok: bool, ) -> Result<ProjectionRef, ProjectionError>

Submit-path materialize (subtask-4 / ST2 rework — see the module doc’s “Submit-path projection” section). Unlike Self::project, value is not narrowed out of a larger ctx_data via ProjectionKey::resolve — it is the exact submitted content, so this writes it directly. Reuses Self::target_path (the same ProjectionPlacement-resolved target — byte-compat default <root>/workspace/tasks/<task_id>/ctx/<step>.md — as Self::project), so a later Self::fetch against the same key reads it back unchanged (fetch only parses the fenced ```json block, so the extra attempt / ok front-matter fields this writes are inert to it). A full replace, never append — re-submitting the same (task_id, producer_agent) overwrites (idempotent, latest wins — Subtask 4 Invariant 2 / Test 4).

key.step must be Some(producer_agent) — this is a submission slot, never “the whole ctx” (step: None still resolves to a valid path via ProjectionKey::step_slug’s "_ctx" fallback, but a caller addressing an actual submission should always name the producing agent).

Trait Implementations§

Source§

impl ProjectionAdapter for FileProjectionAdapter

Source§

fn name(&self) -> &'static str

Stable adapter name ("file" / "mcp-query"), used in log lines and diagnostics.
Source§

fn project( &self, key: &ProjectionKey, ctx_data: &Value, ) -> Result<ProjectionRef, ProjectionError>

Projects the slice of ctx_data addressed by key and returns a locator a worker can later Self::fetch. ctx_data is the policy-filtered ctx data slice this projection is drawn from — the adapter never mutates it.
Source§

fn fetch(&self, key: &ProjectionKey) -> Result<Value, ProjectionError>

Pulls the value addressed by key directly, without going through a previously returned ProjectionRef locator.
Source§

fn pointer_line(&self, r: &ProjectionRef) -> String

Renders the 1-3 line pointer this adapter’s ProjectionRef contributes to the directive header. Must never embed the projected value itself (inline full-embed is the exact problem projection exists to avoid — see the module doc).

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

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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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