Skip to main content

Module types

Module types 

Source
Expand description

Identity, configuration, commands, events and the envelope — the entire client↔session contract (PLAN-phase2 §2.1–§2.4). Everything a client can send is serde-able from day one; SessionEventWire::Stream deliberately is not (it carries the un-serialised StreamEvent in-process).

Modules§

reasoning_level_serde
ReasoningLevel has no serde impls in agent-core; go through its canonical string form.

Structs§

Addressed
A command with its origin. from: None = host-originated (router, lifecycle, idle probe) and bypasses input ownership (B1).
AttachSnapshot
ClientCapabilities
Opt-in stream signals (see ClientMeta::capabilities). The daemon’s event enums nested under Stream (WireLlmEvent, …) have no #[serde(other)]: an older client fails the whole frame on an unknown variant — and a failed frame reads as a dead socket (the TUI drops into reconnect, whose Attached replay would carry the same variant). So every new nested variant is sent only to a client that declares it here.
ClientId
Minted by the actor per Attach.
ClientInfo
One attached client as every client sees it (AttachSnapshot.roster, ClientJoined, /clients, synaps daemon sessions).
ClientMeta
ConfirmScope
Who raised an extension tool-call Confirm and what “Allow all” would cover. Built host-side from the hook chain (HookBus::emit stamps the extension ids; an extension cannot name itself or another extension), so the dialog can show the exact scope BEFORE the user answers.
ContinueInfoWire
Serializable copy of engine::setup::ContinueInfo.
ConversationSnapshot
Serializable mirror of ConversationState (+ the actor’s auto-turn counter). Clients MUST replace, never merge, on Conversation(_).
ConversationTokens
Envelope
Per-session, gapless seq assigned at the single emit site (SessionActor::emit); ts from the host clock.
MessagesHashMemo
Memo of wire::messages_hash(api_messages) shared by every clone of one snapshot: the daemon converts a Conversation to its wire digest once per socket client, and hashing serialises the whole history — now once per event, not once per client. Keyed on the history’s length and last message identity (histories only grow), so a snapshot whose messages are replaced afterwards recomputes instead of reusing a stale hash.
OwnedConfig
Daemon-set (SessionConfig::owned): the session is owned, bound to the connection that presents token.
OwnerBind
Host-side (never wire): an owner claim plus the claiming connection’s liveness. The connection task holds a drop guard on alive for as long as it serves, so the actor learns its owner is gone when the task ends for ANY reason (EOF, error, panic, an attach that timed out after this was queued), even if no Detach ever arrives.
OwnerClaim
A connection’s claim to be an owned session’s owner: the token, plus the secrets it forwards (None = forward none).
OwnerToken
The capability that binds an owned session to its owner: minted by the daemon at create, returned only to the creating connection, presented again to re-bind after a daemon reload. Debug is redacted.
PromptRequest
ReasoningClampWire
Roster
A client-side copy of the session’s roster, kept current from the attach snapshot, ClientJoined and ClientLeft (each transport owns one).
SecretEnv
Secret env vars an OWNED session’s creator forwards (forward_secrets): exactly the vars capture_client_env strips as secrets. Held in the daemon’s memory for the session’s lifetime only, applied to its tools’ env and never to SessionConfig, the journal, the reload record or any log. Debug prints names only.
SessionConfig
Everything EngineHost::create_session needs. Serializable: it is the payload of the wire Attach::Create. Mirrors EngineOpts minus the host-level fields (profile, no_extensions), plus the per-session facts a daemon cannot inherit from its own process (cwd, env overlay).
SessionHeader
Session minus api_messages and accounting: what a client mirrors.
SessionId
Conversation session id — the Session.id string ({name}-{ts}-{pid}; see events/registry.rs sanitize rules). NOT the tools::activation::SessionId (that is the per-runtime gate identity minted at Runtime::from_parts).
SessionMeta
SessionReloadRecord
What Checkpoint{Reload} reports so daemon reload can rebuild the session as it IS (not as it was created): the actor’s config, keep-warm pin, lifecycle, the non-persisted knobs (settings_replay, incl. /system), the CURRENT model/thinking, and its tool activations.
SettingApplied
ToolEnv
What a session’s tools spawn with: the session env snapshot, plus (owned sessions with forward_secrets only) the forwarded secrets, kept apart so no Debug of the runtime, the tool capabilities or a worker’s workspace can print them. Merged into a child’s env only at spawn (ToolEnv::spawn_vars).

Enums§

AttachMode
Attach mode. Ownership (B1): Mirror owns input iff nobody does, Takeover steals it, Observe never owns it.
AttachState
Actor-side client accounting (§8): Detached never cancels a stream.
CheckpointReason
Why a Checkpoint was requested.
ClientInput
Who may drive a daemon session with several clients attached (client_input; spec multi-client-sessions.md §6). Every client is the daemon’s own user.
ClientKind
CompactionPolicyWire
Serializable mirror of runtime::compaction::CompactionPolicy.
EndReason
HistoryMode
What a client wants in Attached / Conversation: the full api_messages mirror (Full, the 741b6b60 behaviour) or only the digest + a daemon-side display tail (Digest, phase 4).
HostEvent
Host-originated events pushed into a session (C3 router, loader).
OwnerChangeReason
PromptKind
SessionCommand
The entire client→session control surface (SEAMS §5.2/§5.3).
SessionEventWire
What a session tells its clients. Stream carries the un-serialised StreamEvent in-process (LocalTransport) — that IS the byte-identical contract. The socket boundary converts to wire::WireSessionEvent.
SessionLifecycle
Where a session is in its park/unpark life (SessionHandle::lifecycle).
SessionQuery
SessionSetting
The &mut Runtime setters the TUI/rpc/server call (SEAMS §5.3).
TurnTrigger

Constants§

CLIENT_NAME_MAX
Longest client name (validate_client_name).
CONFIRM_ACTIVATION_PROMPT_TITLE
Fixed title confirm_activation_with_host uses for the activate_tools y/yes gate (tools/discovery.rs). Everything not in the confirm set is Secret (masked input).
CONFIRM_PROMPT_TITLE
Fixed title resolve_before_tool_call_result uses for Confirm prompts (runtime/mod.rs).
DEFAULT_TAIL_ITEMS
Default for ClientMeta.tail_items: matches the TUI’s resumed-display cap.
RELOADING_REFUSAL
What a session tells a client whose command a daemon reload refused.

Traits§

PinSink
Where a daemon session writes its pin (daemon::pins::PinBook). The actor calls it exactly when the pin changes, when a pinned session moves to a new journal or is renamed, and when a pinned session is ended on purpose. Implementations do their own I/O and never fail the caller.

Functions§

capture_client_env
Secret patterns (case-insensitive suffix/infix) stripped at the client. Secrets never reach the daemon — the broker owns credentials. Build a SessionEnv from the current process environment, stripping client-only prefixes and secrets. Returns (kept_env, stripped_secret_names). The stripped names are ONLY the secrets (not SYNAPS_* prefixes, those are noise). Used by thin clients before Hello.
capture_client_secrets
The secrets capture_client_env strips from this process’s env, with their values: what an owned create with forward_secrets sends.
client_name_from_env
SYNAPS_CLIENT_NAME, trimmed; None when unset or empty. Not validated here: the caller reports a bad one.
client_secret_env
The pure part of capture_client_secrets: the vars strip_client_env records as stripped secrets. Client-only SYNAPS_* knobs never go, even with a secret-looking name.
is_secret_key
Whether a key matches the secret denylist (case-insensitive). Delegates to the canonical implementation in agent_core::core::config.
resolve_client_name
The name a joining client gets in a session: its requested name, or its kind’s name if it asked for none (or an invalid one), with the lowest free -N suffix (N ≥ 2) if another client already has it. Names compare case-insensitively.
sanitize_prompt_text
Make prompt text safe to print in any client (prA I-R4-3, I-R5): drop C0/C1 control characters except \n (a \t becomes a space); the zero-width space and the LRM/RLM marks (U+200B, U+200E, U+200F); bidi embeddings/overrides/isolates (U+202A–U+202E, U+2066–U+2069) and the Arabic letter mark (U+061C); and the line/paragraph separators (U+2028, U+2029), which some terminals treat as line breaks. ZWNJ / ZWJ (U+200C, U+200D) are KEPT: emoji sequences and several scripts need them. Prevents an extension’s text from moving the cursor (\x1b[3A, \r) over the host-built header, or disguising text with direction overrides.
should_strip_env
Whether a key should be stripped from the client env snapshot.
strip_client_env
The pure part of capture_client_env: filter vars (unit-testable without touching the process environment).
tail_items_from_env
SYNAPS_ATTACH_TAIL_ITEMS (client side): display items requested in Attached.display_tail; DEFAULT_TAIL_ITEMS when unset/invalid.
validate_client_name
A client name is 1–32 ASCII letters, digits, - or _, starting with a letter or digit. The client checks before connecting; the daemon checks again and refuses the handshake.

Type Aliases§

SessionEnv
Ordered key-value snapshot of a client’s environment.