Expand description
Stable contracts for compiled-in TurboVault plugins.
This crate is intentionally smaller than TurboVault’s internal API. A
plugin receives a curated VaultApi facade and an advisory HookBus,
never a raw vault manager or MCP server.
Plugins are compiled into the host behind default-off Cargo features. The
host mounts each plugin under PluginDescriptor::id and namespaces all
three MCP primitives, so in the tasks plugin a local tool list is
advertised as tasks_list, a prompt review as tasks_review, and a
resource index/stats.json as tasks://index/stats.json. A plugin names
only the local half.
§Trust model
Plugins are statically linked into the TurboVault process. This API is a contract, not a sandbox. A compiled-in plugin runs with the host’s full privileges: it can open files, spawn threads, and reach the network regardless of what it declares here. The boundary exists to keep plugins decoupled from TurboVault’s internals, to make what a plugin touches reviewable, and to stop accidental over-reach — not to contain hostile code. Only compile in plugins you would accept as a dependency.
Within that model the host does enforce real invariants: capabilities are per-plugin and declared up front, writes carry mandatory preconditions, event attribution is host-stamped, and a plugin’s tool calls are bounded in time and isolated from panics.
§Compatibility
Public types are #[non_exhaustive] and built through constructors and
builder setters, so this crate can gain fields, variants, and trait methods
(always with defaults) without a breaking release. Construct types via
their new functions rather than struct literals.
Structs§
- Completion
- Suggested values for one argument.
- Completion
Request - A request to suggest values for an argument a user is part-way through.
- Event
Cursor - A consumer’s durable position in the event feed.
- HookBus
- Cloneable bounded event bus shared by a host and its plugins.
- Hook
Subscription - A single bounded subscription to
HookBus. - Note
Listing - A note’s identity and change-detection metadata, without its content.
- Note
Snapshot - A note plus the backend-native version token used for safe writes.
- Plugin
Capabilities - What a plugin declares it needs beyond the note APIs.
- Plugin
Context - Capabilities provided to a plugin when it is constructed.
- Plugin
Descriptor - Stable identity and compatibility metadata for a compiled-in plugin.
- Plugin
Error - Error type shared by the host and plugins.
- Plugin
Identity - The calling plugin’s namespace and what it declared it needs.
- Plugin
Request Context - Curated request data passed to plugin tool calls.
- Plugin
Storage - Durable, plugin-private, per-vault key/value storage.
- Prompt
- Prompt definition.
- Prompt
Result - Result from getting a prompt.
- Resource
- Resource definition.
- Resource
Result - Result from reading a resource.
- Resource
Template - Resource template definition.
- Shutdown
Signal - Cooperative shutdown signal handed to a plugin’s background work.
- Shutdown
Trigger - Host-side handle that requests shutdown.
- Tool
- Tool definition.
- Tool
Result - Result from calling a tool.
- Vault
Api - Cloneable, curated facade supplied to every plugin.
- Vault
Descriptor - Public identity of a vault the host has registered.
- Vault
Event Envelope - Sequenced event delivered to hook subscribers.
- Write
Note Request - Safe full-note write request.
- Write
Provenance - Provenance supplied by a writer for best-effort event correlation.
- Write
Receipt - Result of a successful plugin write.
Enums§
- Completion
Target - What a completion request is asking a plugin to complete.
- Event
Attribution - Best-effort event attribution.
- Hook
Event - A vault mutation observed by a hook producer.
- Hook
Lifecycle - Current event-bus lifecycle.
- Hook
Recv Error - Receive failure with explicit overflow semantics.
- Plugin
Error Code - Stable, machine-readable categories returned across the plugin boundary.
- Publish
Error - Publish failure.
- Write
Precondition - Required optimistic-concurrency condition for a plugin write.
Constants§
- MCP_
TOOL_ NAME_ MAX_ LEN - Maximum tool-name length recommended by MCP SEP-986.
Traits§
- Plugin
- Factory contract for a compiled-in plugin.
- Plugin
Provider - Object-safe MCP tool provider implemented by a plugin.
- Plugin
Store - Host implementation behind
PluginStorage. - Vault
Host - Host implementation behind
VaultApi.
Functions§
- namespaced_
prompt_ name - Build and validate the public MCP name for a plugin-local prompt.
- namespaced_
resource_ template - Build and validate the public URI template for a plugin-local resource template.
- namespaced_
resource_ uri - Build and validate the public URI for a plugin-local resource.
- namespaced_
tool_ name - Build and validate the public MCP name for a plugin-local tool.
- validate_
mcp_ tool_ name - Validate a complete tool name against MCP SEP-986.
- validate_
plugin_ id - Validate a plugin namespace.
Type Aliases§
- Plugin
Result - Result type used by plugin contracts.