Skip to main content

Module plugins

Module plugins 

Source
Expand description

Plugin traits, registration context, and the extension contracts (tower::Service<R> for every plugin surface — see ADR-006). Strongly-typed Request / Response types per domain (request, lifecycle, auth, token, oauth, queue, mcp) live in submodules. Plugin traits and registration context.

Defines Plugin, RegistrationContext, VectorHook, AiHook, ComputedFieldHook, FieldMapping, ModelInfo, VectorBatcher, EmbeddedFile. (The former ServiceContext was unified into yeti_types::resource::Context .)

§Errors

Result-returning methods on the traits in this file (VectorHook, AiHook, Plugin, ComputedFieldHook) carry implementation-defined error semantics — the trait declares the shape (Result<T, String> for hot-path hook traits, Result<T, YetiError> for Plugin lifecycle), but the actual conditions that produce Err belong to each implementor.

  • VectorHook / AiHook impls in yeti-ai surface model-load, tokenizer, and inference failures as String. Hook implementors should document their own error contracts.
  • Plugin::resources / on_ready / install_event_subscriber propagate YetiError from plugin setup (table registration, route conflicts, bootstrap failures).

Per-method # Errors sections at the trait level would just say “implementation-defined”, so the lint is suppressed at the module level. Each impl crate documents its own error conditions.

Re-exports§

pub use trust::PluginTrustTier;
pub use lifecycle::LifecycleEvent;
pub use lifecycle::TelemetryEvent;
pub use lifecycle::TelemetryService;
pub use mcp::CallToolRequest;
pub use mcp::CallToolResponse;
pub use mcp::CallToolService;
pub use mcp::ListToolsRequest;
pub use mcp::ListToolsResponse;
pub use mcp::ListToolsService;
pub use mcp::ToolAnnotations;
pub use mcp::ToolDefinition;
pub use oauth::OAuthRequest;
pub use oauth::OAuthResponse;
pub use oauth::OAuthService;
pub use request::ContextService;
pub use request::RequestPipeline;
pub use request::YetiRequest;
pub use request::YetiResponse;
pub use token::TokenRequest;
pub use token::TokenResponse;
pub use token::TokenService;

Modules§

auth
Identity → access resolution.
lifecycle
Fire-and-forget lifecycle and telemetry taps.
mcp
MCP tool registry hooks.
oauth
OAuth callback claim mutation.
queue
Durable / async job execution.
request
HTTP-shaped per-request work and the in-pipeline Context service contract.
token
JWT mint extension.
trust
Plugin trust tier — ADR-014 §4.

Structs§

BoxCloneService
A Clone + Send boxed Service.
BoxCloneSyncService
A Clone + Send + Sync boxed Service.
BoxService
A boxed Service + Send trait object.
EmbeddedFile
A file embedded in the binary at compile time for static web serving.
FieldMapping
Mapping from a source field to a target vector field via an embedding model.
ModelInfo
Metadata about an available AI model.
RegistrationContext
Write context passed to Plugin::register().
ServiceBuilder
Declaratively construct Service values.
ServiceFn
A Service implemented by a closure.
StartupContext
Read-only context passed to Plugin::is_required().
VectorBatcher
Server-side micro-batcher for vector embeddings.
VectorContext
Per-app vector capabilities. Set once at startup, never changes per-request.

Traits§

AiHook
Hook for local LLM inference.
ComputedFieldHook
Hook for computing virtual field values at read time.
Layer
Decorates a Service, transforming either the request or the response.
Plugin
Contract between the yeti binary and service crates.
Service
An asynchronous function from a Request to a Response.
ServiceExt
An extension trait for Services that provides a variety of convenient adapters
TableSubscriber
Subscribe to row changes on a named table from a wasm application.
VectorHook
Hook for automatic vector embedding generation.

Functions§

service_fn
Returns a new ServiceFn with the given closure.

Type Aliases§

PluginRegistry
Ordered list of service instances.
PubSubLookupFn
Closure type for looking up PubSub managers by table name.