Skip to main content

Surface

Struct Surface 

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

The catalog bound to a store, a default repo and optional providers.

Implementations§

Source§

impl Surface

Source

pub fn new( store: Store, default_repo: &str, provider: Option<Box<dyn EmbeddingProvider>>, ) -> Self

A surface over store whose default repo is default_repo (an id). Mutations derive each repo’s root from its fs source.

Source

pub fn with_profile(self, profile: Profile) -> Self

Serve profile (§4 “Profiles”): Surface::tools lists only its tools, so a host’s tools/list and its membership check follow; nothing else changes — the dispatch, the schemas and Surface::is_write_tool stay the full table’s.

Source

pub fn profile(&self) -> Profile

The profile this surface serves.

Source

pub fn with_provider_name(self, name: &str) -> Self

Name the configured embedding provider (embedding.provider) so a provider_unavailable error can say which one cannot rank.

Source

pub fn with_actor(self, actor: &str) -> Self

Record actor on every write instead of ACTOR (the CLI’s human:<user> / --actor; the MCP server keeps the default).

Source

pub fn set_actor(&mut self, actor: &str)

Change the actor of the writes that follow.

Source

pub fn with_doc_store(self, doc_store: Box<dyn DocStore>) -> Self

Route every mutation’s file writes through doc_store regardless of the repo’s sources (a runner’s in-memory store).

Source

pub fn with_clock(self, clock: impl FnMut() -> String + 'static) -> Self

Stamp commits with clock() instead of the wall clock.

Source

pub fn with_mutation_hook(self, hook: impl FnMut() + 'static) -> Self

Called after every successful write (never after a dry run).

Source

pub fn with_config(self, config: Config) -> Self

The matcher thresholds the observe tools pass through.

Source

pub fn with_build_info(self, build_info: BuildInfo) -> Self

The serving binary’s identity for the version tool (§4, 1.4): its own version, spec/cli version, build commit and time, compiler. A library embedding keeps the default (this crate’s version, nulls).

Source

pub fn store(&self) -> &Store

Source

pub fn store_mut(&mut self) -> &mut Store

Source

pub fn default_repo(&self) -> &str

Source

pub fn tools(&self) -> Vec<ToolSpec>

The catalog this surface serves: the table filtered by its Profile (the whole table under Full).

Source

pub fn is_write_tool(name: &str) -> bool

Whether name is a tool that can commit (a host serializes these under the writer lock of spec/sync §7; plan counts — it reads the working tree the writes race for).

Source

pub fn call(&mut self, name: &str, args: Json) -> ToolOutcome

Run a tool: its JSON result, or the error envelope.

Source

pub fn locate_document(&self, repo_id: &str, args: &Json) -> Result<String>

A document locator (id or path, either form) resolved to the live document’s id under the docs_update tool’s rules — the error a docs_update with that locator would raise (doc_missing with the given keys as data). The CLI’s local update <doc> resolves its target here before planning, as the reference’s requireDoc does.

Source

pub fn call_result_with_plan( &mut self, name: &str, args: &Json, ) -> Result<(Json, Option<Json>)>

Run a write tool and hand back its result with the Plan it committed (spec/cli §4, the Receipt confirmation): a sugar tool’s or apply’s plan, whose preview.results[].ids realized through the receipt’s new_ids are the ids the CLI prints; None for a tool that planned nothing (a read, execute, an error). Not a tool: the CLI’s local seam, as the reference’s library-bound verbs hold the plan from applyEffectsDetailed.

Source

pub fn preview_call(&mut self, name: &str, args: &Json) -> Result<Json>

The Plan a sugar tool would commit (spec/cli §3.6: every dry run is a plan) — the tool’s own ref resolution and pre-checks run, its effects are planned under the symbolic minter, nothing is written and no id is minted; the mutation hook stays quiet. apply previews its effects the same way. Not a tool: the catalog has no dry_run (4.0), a client previews with plan { effects }.

Source

pub fn call_result(&mut self, name: &str, args: &Json) -> Result<Json>

Run a tool, returning its result or the error — every error of the effect tools carrying its corrected call (data.fix, spec/surface §4 “Teaching”, 4.4; crate::fixes).

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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