Expand description
Session runtime, context planning, prompt assembly, hooks, and event flow.
halter-runtime is the orchestration layer between providers, tools,
hooks, session storage, and resource snapshots. Embedders usually access it
through halter::Halter, but the exported types are useful for custom SDK
assembly and tests.
Structs§
- Compaction
Effects - State mutation produced by compaction.
- Compaction
Outcome - Result of a compaction pass before it is applied to session state.
- Context
Settings - Token thresholds used by context planning.
- Default
Context Manager - Default context manager using heuristic token estimates and signal pruning.
- Default
Prompt Assembler - Default prompt assembler used by the runtime.
- Event
Bus - Broadcast bus for committed session events.
- Executed
Hook Dispatch - Completed hook dispatch, including preview and final run summaries.
- Hook
Invocation Context - Shared context included in hook payloads for one invocation.
- Parent
Stream Registry - Tracks live parent turn streams so subagent events can be forwarded.
- Resource
Handle - Atomically replaceable resource snapshot and hook registry.
- Runtime
Services - Shared dependencies used by session handles and spawned turn tasks.
- Session
Init - Options used when creating a new session.
- Session
Runtime - Runtime handle used to create, resume, list, and shut down sessions.
- Shutdown
Report - Summary returned by runtime shutdown.
- Trace
Recorder - Writes a per-root-session JSONL trace into a configured directory. Each
root session gets one
<session_id>.txtfile containing a header line followed by interleavedpending_eventlines (each event as it is generated, before commit) and committedSessionEventlines (each event after the store has assigned a monotonic sequence). Subagent sessions do not get their own file: their blueprint and events are appended to the root’s trace, distinguished by thesession_idcarried on each line. The format is dual-purpose:pending_eventlines give live, in-turn visibility for human debugging, while the committed lines carry the sequence numbers a futurehalterreplay feature needs to reconstruct the full session tree. - Turn
Registry - Runtime-wide registry of in-flight turn tasks. Each entry pairs a
JoinHandlewith theCancellationTokenthat controls the turn so shutdown can both signal cooperative cancellation and reclaim the handle forJoinHandle::abortif the drain deadline expires.
Enums§
- Subagent
Event Forwarding - Controls whether child subagent events are forwarded into the parent stream.
- Turn
Registry Error - Error returned when a turn cannot be registered.
Traits§
- Context
Manager - Builds context plans and performs compaction.
- Prompt
Assembler - Turns a
ContextPlaninto provider-ready prompt material.
Functions§
- resolve_
response_ chain - Determines whether a request should reuse the provider’s
previous_response_idchain, and if so, from which message in the pruned transcript window the “new since the provider last saw us” slice begins. - run_
notification - Run
Notificationhooks. - run_
post_ compact - Run
PostCompacthooks after compaction. - run_
post_ tool_ use - Run
PostToolUsehooks after a successful tool call. - run_
post_ tool_ use_ failure - Run
PostToolUseFailurehooks after a failed tool call. - run_
pre_ compact - Run
PreCompacthooks before a compaction attempt. - run_
pre_ tool_ use - Run
PreToolUsehooks for a tool call. - run_
session_ end - Run
SessionEndhooks. - run_
session_ start - Run
SessionStarthooks. - run_
stop - Run
Stophooks at the end of assistant generation. - run_
subagent_ start - Run
SubagentStarthooks. - run_
subagent_ stop - Run
SubagentStophooks. - run_
user_ prompt_ submit - Run
UserPromptSubmithooks. - score_
message - Score a message for context pruning.
- skill_
prompt_ segment - Build a single skill segment from a SkillDef. Skill segments live between the system prompt and the conversation, and the assembler places a cache breakpoint after the last one so subsequent turns re-hit the cache while skills remain unchanged.
Type Aliases§
- Halter
Session - Backwards-compatible alias for the public session type. Prefer
SessionHandlein new code.