Skip to main content

Crate chat_engine

Crate chat_engine 

Source
Expand description

Chat Engine module — public crate surface.

The wire-level types live in cf-chat-engine-sdk; this crate consumes the SDK and exposes:

  • ChatEngineModule — the #[toolkit::module]-annotated entrypoint used by cyberware-example-server via the inventory-based registrator.
  • The re-exported SDK types every downstream test / consumer needs so a single use chat_engine::*; import suffices.

Internal modules (api, config, domain, infra) are marked #[doc(hidden)] so they do not pollute the public docs surface; they remain pub because the integration tests in tests/ reach into them.

Re-exports§

pub use module::ChatEngineModule;

Modules§

module
ChatEngineModule — Phase 15 integration entrypoint.

Structs§

Capability
Schema declaration of a capability supported by a backend plugin.
CapabilityValue
A concrete capability value chosen by the client for a specific call.
Message
A message node in the immutable conversation tree.
MessagePluginCtx
Context passed to message-handling plugin methods.
PluginCallContext
Shared context attached to every plugin invocation.
Session
A chat session: the top-level container that groups a conversation’s messages, tenant/user ownership, backend plugin binding, and lifecycle.
SessionPluginCtx
SessionType
A registered session type — pairs a human-readable name with the backend plugin instance that will process its sessions’ messages.
StreamingChunkEvent
A single text fragment appended to the assistant message in flight.
StreamingCompleteEvent
Signals the assistant message is fully persisted and the stream is closing.
StreamingErrorEvent
Signals a mid-stream failure; the assistant message may be incomplete.
StreamingStartEvent
Opens a stream for a given assistant message.
TenantId
Tenant identifier. Opaque string from the auth token, used to scope all queries. Newtype distinguishes it from UserId at compile time so call sites cannot accidentally swap tenant and user arguments.
UserId
End-user identifier (opaque string from the auth token). Newtype distinguishes it from TenantId at compile time.
VariantInfo
Summary of one variant at a given tree position — returned when listing variants for a message so clients can render navigation UI.

Enums§

HealthStatus
Plugin health status returned by ChatEngineBackendPlugin::health_check.
LifecycleState
Lifecycle state of a session.
MemoryStrategy
Per-session memory strategy controlling how much conversation history is sent to the backend plugin on each call.
MessageRole
Message author role.
PluginError
Errors returned by ChatEngineBackendPlugin methods.
RetentionPolicy
Message retention policy — when messages in a session should be cleaned up.
StreamingEvent
NDJSON streaming event emitted by a plugin during response generation.

Traits§

ChatEngineBackendPlugin

Functions§

empty_stream
Helper to build an empty plugin stream (default no-op responses).
stream_from_events
Helper to build a plugin stream from a pre-collected vector of events.

Type Aliases§

PluginStream
A boxed async stream of streaming events from a plugin.