Skip to main content

Crate halter_runtime

Crate halter_runtime 

Source
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§

CompactionEffects
State mutation produced by compaction.
CompactionOutcome
Result of a compaction pass before it is applied to session state.
ContextSettings
Token thresholds used by context planning.
DefaultContextManager
Default context manager using heuristic token estimates and signal pruning.
DefaultPromptAssembler
Default prompt assembler used by the runtime.
EventBus
Broadcast bus for committed session events.
ExecutedHookDispatch
Completed hook dispatch, including preview and final run summaries.
HookInvocationContext
Shared context included in hook payloads for one invocation.
ParentStreamRegistry
Tracks live parent turn streams so subagent events can be forwarded.
ResourceHandle
Atomically replaceable resource snapshot and hook registry.
RuntimeServices
Shared dependencies used by session handles and spawned turn tasks.
SessionInit
Options used when creating a new session.
SessionRuntime
Runtime handle used to create, resume, list, and shut down sessions.
ShutdownReport
Summary returned by runtime shutdown.
TraceRecorder
Writes a per-root-session JSONL trace into a configured directory. Each root session gets one <session_id>.txt file containing a header line followed by interleaved pending_event lines (each event as it is generated, before commit) and committed SessionEvent lines (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 the session_id carried on each line. The format is dual-purpose: pending_event lines give live, in-turn visibility for human debugging, while the committed lines carry the sequence numbers a future halter replay feature needs to reconstruct the full session tree.
TurnRegistry
Runtime-wide registry of in-flight turn tasks. Each entry pairs a JoinHandle with the CancellationToken that controls the turn so shutdown can both signal cooperative cancellation and reclaim the handle for JoinHandle::abort if the drain deadline expires.

Enums§

SubagentEventForwarding
Controls whether child subagent events are forwarded into the parent stream.
TurnRegistryError
Error returned when a turn cannot be registered.

Traits§

ContextManager
Builds context plans and performs compaction.
PromptAssembler
Turns a ContextPlan into provider-ready prompt material.

Functions§

resolve_response_chain
Determines whether a request should reuse the provider’s previous_response_id chain, and if so, from which message in the pruned transcript window the “new since the provider last saw us” slice begins.
run_notification
Run Notification hooks.
run_post_compact
Run PostCompact hooks after compaction.
run_post_tool_use
Run PostToolUse hooks after a successful tool call.
run_post_tool_use_failure
Run PostToolUseFailure hooks after a failed tool call.
run_pre_compact
Run PreCompact hooks before a compaction attempt.
run_pre_tool_use
Run PreToolUse hooks for a tool call.
run_session_end
Run SessionEnd hooks.
run_session_start
Run SessionStart hooks.
run_stop
Run Stop hooks at the end of assistant generation.
run_subagent_start
Run SubagentStart hooks.
run_subagent_stop
Run SubagentStop hooks.
run_user_prompt_submit
Run UserPromptSubmit hooks.
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§

HalterSession
Backwards-compatible alias for the public session type. Prefer SessionHandle in new code.