Skip to main content

WorkspaceServices

Struct WorkspaceServices 

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

The host-provided workspace capability bundle used by tool execution.

Implementations§

Source§

impl WorkspaceServices

Source

pub fn with_remote_git( self: Arc<Self>, config: RemoteGitBackendConfig, ) -> Result<Arc<Self>>

Attach a remote git provider to an existing super::WorkspaceServices.

Returns a new Arc<WorkspaceServices> with git and git_stash wired to the remote backend. The original WorkspaceServices is not mutated. git_worktree is intentionally reset to None — worktrees are a local-filesystem concept that does not map cleanly onto a remote service (see RFC §8). All other fields — including local_root, the command runner, the search provider, the optional file_system_ext (S3 CAS), and operation_timeout — are preserved verbatim via the internal with_git_provider constructor.

Source§

impl WorkspaceServices

Source

pub fn builder( workspace_ref: WorkspaceRef, file_system: Arc<dyn WorkspaceFileSystem>, ) -> WorkspaceServicesBuilder

Source

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

Source

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

Local workspace services backed by an in-memory file manifest for search. read/write/ls/bash/git preserve local backend behavior; glob and grep use the manifest once the initial scan has completed and fall back to filesystem search before that.

Source

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

Build local manifest services with an asynchronous ephemeral catalog.

Source

pub async fn local_with_code_intelligence( root: impl Into<PathBuf>, isolation_scope: impl Into<String>, ) -> Result<Arc<Self>>

Build local manifest-backed services with native Code Intelligence.

The provider subscribes to the manifest’s existing change stream and therefore does not create a second filesystem watcher or file index.

Source

pub async fn local_with_retrieval_and_code_intelligence( root: impl Into<PathBuf>, isolation_scope: impl Into<String>, ) -> Result<Arc<Self>>

Build one local session with retrieval and Code Intelligence sharing the same manifest scanner and filesystem change stream.

Source

pub async fn local_with_code_intelligence_backend( backend: Arc<ManifestWorkspaceBackend>, isolation_scope: impl Into<String>, ) -> Result<Arc<Self>>

Attach native Code Intelligence to one shared manifest backend.

Source

pub async fn local_with_retrieval_and_code_intelligence_backend( backend: Arc<ManifestWorkspaceBackend>, isolation_scope: impl Into<String>, ) -> Result<Arc<Self>>

Attach retrieval and Code Intelligence to one shared manifest backend.

Source

pub fn local_with_manifest_backend( backend: Arc<ManifestWorkspaceBackend>, ) -> Arc<Self>

Build local workspace services from a shared manifest backend. Hosts can keep the same manifest for UI file pickers and agent tools.

Source

pub fn local_with_retrieval_backend( backend: Arc<ManifestWorkspaceBackend>, ) -> Arc<Self>

Enable retrieval on a shared manifest backend.

Source

pub fn workspace_ref(&self) -> &WorkspaceRef

Source

pub fn capabilities(&self) -> WorkspaceCapabilities

Source

pub fn normalize_path(&self, input: &str) -> Result<WorkspacePath>

Source

pub fn fs(&self) -> Arc<dyn WorkspaceFileSystem>

Source

pub fn fs_ext(&self) -> Option<Arc<dyn WorkspaceFileSystemExt>>

Optional compare-and-swap file system extensions.

Returns Some when the backend supports version-aware writes (e.g. S3 via ETag). Tools that perform read-modify-write cycles should route through Self::read_for_edit and Self::write_for_edit rather than touching this directly.

Source

pub fn text_reader(&self) -> Option<Arc<dyn WorkspaceTextReader>>

Source

pub fn command_runner(&self) -> Option<Arc<dyn WorkspaceCommandRunner>>

Source

pub fn search(&self) -> Option<Arc<dyn WorkspaceSearch>>

Source

pub fn code_intelligence(&self) -> Option<Arc<dyn WorkspaceCodeIntelligence>>

Optional workspace-scoped semantic code query provider.

Source

pub fn chunk_catalog(&self) -> Option<Arc<WorkspaceChunkCatalog>>

Optional session-local catalog shared by lexical and semantic retrieval.

Source

pub fn workspace_retrieval(&self) -> Option<Arc<WorkspaceRetrievalRuntime>>

Optional semantic retrieval runtime bound to this workspace session.

Search the session-owned semantic index and verify every returned source chunk against the workspace backend before exposing its text.

Run exact, lexical, structural, and semantic retrieval against one catalog revision, fuse channel ranks, and verify returned source text.

Source

pub fn with_code_intelligence( &self, provider: Arc<dyn WorkspaceCodeIntelligence>, ) -> Arc<Self>

Attach a semantic code query provider while preserving every existing workspace capability and backend.

Source

pub fn git(&self) -> Option<Arc<dyn WorkspaceGit>>

Source

pub fn git_stash(&self) -> Option<Arc<dyn WorkspaceGitStashProvider>>

Source

pub fn git_worktree(&self) -> Option<Arc<dyn WorkspaceGitWorktreeProvider>>

Source

pub fn operation_timeout(&self) -> Option<Duration>

Default timeout applied to non-bash workspace operations.

None means no enforced timeout. Backends that may stall (remote, browser, DFS) should set this so tools using Self::run_with_timeout surface a timeout error instead of letting the agent loop hang.

Source

pub async fn run_with_timeout<F, T, E>( &self, op: &'static str, fut: F, ) -> Result<T, E>
where F: Future<Output = Result<T, E>>, E: From<Error>,

Run a workspace future under the configured operation timeout.

Tools that route through file system / search / git providers should wrap their calls with this helper so non-local backends never stall the agent loop indefinitely.

Polymorphic in the error type so the helper works equally well for futures returning anyhow::Result<T> (the legacy callers — search, git, etc.) and for futures returning WorkspaceResult<T> (the migrated WorkspaceFileSystem callers). The E: From<anyhow::Error> bound is satisfied by both anyhow::Error (trivially) and WorkspaceError (via its #[from] Backend variant); a timeout surfaces as that From conversion of an anyhow!(...) message.

Source

pub async fn read_for_edit( &self, path: &WorkspacePath, ) -> WorkspaceResult<(String, Option<String>)>

Read a file for a subsequent modify-write cycle, requesting a version token when the backend supports compare-and-swap writes.

Returns (content, Some(version)) when Self::fs_ext is available (e.g. on S3, where the version is the object ETag); (content, None) otherwise. Pair with Self::write_for_edit.

Source

pub async fn write_for_edit( &self, path: &WorkspacePath, content: &str, expected_version: Option<&str>, ) -> WorkspaceResult<WorkspaceWriteOutcome>

Companion to Self::read_for_edit. Performs a compare-and-swap write when both Self::fs_ext is available and a version token was returned by the prior read; falls back to a plain write otherwise. On version mismatch the returned error is the typed WorkspaceError::VersionConflict variant; callers can also still downcast anyhow::Error::downcast_ref::<WorkspaceVersionConflict>() when the value has been lifted into an anyhow::Result.

Source

pub fn local_root(&self) -> Option<&Path>

Source

pub fn display_path(&self, path: &WorkspacePath) -> String

Trait Implementations§

Source§

impl Debug for WorkspaceServices

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> ParallelSend for T

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