Expand description
The process-scoped substrate every workspace borrows.
ADR-0018’s split. Workspace used to conflate two
lifetimes: half its configuration was process infrastructure — a privately
built mentra runtime, provider and credential resolution, the history store
policy, the host’s interceptors — and half was repository discovery. A host
opening N workspaces paid the process costs N times. This module is the
noun the first half was missing.
Runtimeowns mentra’s runtime, the provider/credential/base-URL and model policy, the history store policy, and the host’s interceptors. Build one withRuntime::builder, share it withWorkspaceBuilder::with_runtime.Workspacekeeps what the repository says — context, skills, templates, hooks,.mcp.json— and borrows the runtime through anArc. MCP connections stay workspace-owned: minted from repository config, dead with the workspace.Workspace::open(path)is unchanged sugar that builds a private default runtime bound to that path. The one-repository host never sees this module; only the N-repository host reaches for it.
use std::sync::Arc;
use basis::{Runtime, Workspace};
let runtime = Arc::new(Runtime::builder().build()?);
let one = Workspace::builder("/repo/one").with_runtime(Arc::clone(&runtime)).open().await?;
let two = Workspace::builder("/repo/two").with_runtime(runtime).open().await?;Structs§
- Runtime
- One process’s substrate: mentra’s runtime plus the resolution policy and host guards that were fixed when it was built.
- Runtime
Builder - How a runtime is built.