Expand description
SPDX-License-Identifier: AGPL-3.0-or-later Copyright (C) Alexander R. Croft
Component 03 — The Loop.
Inner LoopRuntime (complete-unit tool reaction) plus the outer
transaction composition layer (Runtime v2 lifecycle under transaction::lifecycle).
Structs§
- AcpPrompt
Encoder - ACP session/prompt encoder for external-agent Channels.
- Admission
Error - Synchronous admission error.
- Admission
Receipt - Immediate admission receipt (no network performed).
- Async
Tool Handler - Handler that runs an async body with abortable cancellation.
- Canonical
Event Subscription - Lossless subscription owned by one Loop (never shared with Console).
- Capability
Token - 256-bit unguessable capability token (hex in URLs; redacted in diagnostics).
- Channel
Binding - One Channel’s static binding (factories realized at runtime start).
- Channel
Registry - Immutable registry of Channel bindings (built before start).
- Control
Hold Gate - Test-only gate that pauses supervisor drain of the control queue (§23).
- Default
Loop Runtime - Default runtime factory.
- Delivered
Event - One delivered event with explicit delivery sequence.
- Delivery
Limits - Validated event-queue capacities for
transaction_delivery. - Dispatch
Request - Request to dispatch one complete tool call through the linked handler path.
- Dispatcher
Limits - Capacity and payload bounds for one transaction dispatcher (D-015).
- Empty
Bytes Encoder - Encoder returning empty bytes.
- Empty
Tool Registry - Required first implementation: every request is unavailable.
- Finalizer
Hold Gate - Test-only gate that pauses the Finalizer between Seal and completion send (§22.2).
- Headless
Prompt Encoder - Headless CLI encoder: plain text prompt body for Z.ai / Claude print mode.
- Host
Tool Registry - Immutable host tool definitions available to admission.
- Host
Tool Runtime - Runtime that starts linked tools through the shared dispatcher.
- Immediate
Tool Handler - Handler that completes immediately from a synchronous function.
- Interpretation
End - Exactly one terminal report per interpretation.
- Isolated
Killable Tool Handler - Stubborn in-process worker for AbortableAtYield / legacy D-024 fixtures.
- Join
Only Spill Inject - Test-only inject: TaskSupervisor-owned JoinOnly-style work (§22.4 / Law 23 / M5.4).
- Ledger
Entry - Per-transaction ledger row.
- Lifecycle
Ledger - Source of truth from admission through completion publication.
- Linked
Tool Execution Handle - Handle returned from
ToolHandler::start. - Live
Channel - Live Channel after connector instance realization at runtime start.
- Loop
Completion - Completion handle.
- Loop
Control - Cancellation control.
- LoopEnd
- Exactly one Loop terminal report.
- Loop
Error - Loop error with safe diagnostics.
- Loop
Handle - Live loop handle.
- Loop
Health - Content-free health.
- LoopId
- Loop instance identity.
- Loop
Limits - Aggregate Loop bounds.
- Loop
Scope - Explicit Loop admission scope (no ambient expansion).
- Lost
Completion Handler - Handler whose completion is never sent (tests).
- McpGateway
- MCP gateway constructors (no ambient spawn — Law 23).
- McpGateway
Handle - Cloneable handle for install/activate/revoke without owning the listener.
- McpGateway
Limits - Bounded MCP request concurrency and duration (D-034 / Law 22).
- McpRoute
Table - Bounded in-memory capability route table.
- Monoloop
RunId - Monoloop run correlation identity.
- NoTool
Runtime - Runtime that asserts it is never started (pairs with EmptyToolRegistry).
- Open
AiChat Completions Encoder - Chat Completions v1 encoder producing
stream: trueJSON bodies. - Open
AiEncoder Options - Options controlling Chat Completions field names and capability gates.
- Orphan
Tool Permit Set - Runtime-scoped orphaned tool permits (§22.4 capacity honesty / M5.4).
- Outbound
Tool Result - Provider-neutral outbound tool result (Loop product; not dialect-encoded).
- Owned
Process Registry - ProcessIsolated children owned until OS exit is observed.
- Panic
Encoder - Encoder that panics on encode (§22.2 coordinator-panic proofs).
- Panic
OnStart Handler - Handler that panics on start (tests).
- Pending
McpBinding - Handle returned when a pending binding is created.
- Prepared
McpGateway - Listener + router prepared without spawning (TaskSupervisor / RuntimeService).
- Process
Isolated Tool Handler - Host tool that runs in a real OS child process (V2 §14.3).
- Registered
Tool - Spec + linked handler pair registered at runtime startup.
- Reject
Encoder - Encoder that rejects all encode calls.
- Reservation
Pool - Runtime-wide reservation pool installed at start.
- Resolve
Tool Request - Request to resolve a complete tool by name.
- Resolved
Tool - One tool admitted into a transaction.
- Resolved
Tool Registry - Registry backed by the transaction-resolved allowlist.
- Resolved
Tool Set - Immutable tool set resolved at admission from the host registry.
- Runtime
Bootstrap - Production bootstrap for
super::lifecycle::StartedRuntime::start. - Runtime
Config - Runtime-wide configuration validated at startup.
- Runtime
Owner - Unique owner of the executor, supervisor, ledger, connectors, and shutdown state.
- Shared
Tool Capacity - Shared process-wide concurrent tool execution limit.
- Shutdown
Report - Final shutdown report when the runtime reaches
Stopped(v2). - Shutdown
Snapshot - Point-in-time shutdown progress while still
Quiescing(v2). - Shutdown
Ticket - Opaque ticket from
super::owner::RuntimeOwner::begin_shutdown. - Start
Fail Handler - Handler that always fails at start (tests).
- Start
Hold Gate - Test-only gate that pauses supervisor drain of the start queue (D-040).
- Start
Loop - Start request for one Loop instance.
- Start
Tool Execution - Start request for a tool execution (never called with EmptyToolRegistry).
- Started
Runtime - Result of a successful production start handshake.
- Stopped
Gate - Test/prod gate that defers the supervisor’s
Stoppedtransition untilStoppedGate::release(v2 §22.5 TimedOut determinism). - Subscriber
Id - Subscriber identity (correlation only).
- Subscription
Gap - Gap details.
- Subscription
Publisher - Publisher half used by the event distributor (testkit / composition).
- TaskId
- Stable task id within one runtime owner.
- Task
Supervisor - Retains every runtime join until observed complete.
- Terminal
Decision - Immutable terminal decision selected once by the supervisor.
- Terminal
Proposal - Coordinator proposal — supervisor accepts or upgrades (Cancel→Terminated).
- Test
Text Encoder - Loop-owned smoke encoder for FakeConnector +
DialectDescriptor::test_raw. - Tool
Action Id - Tool action identity (dialect-provided or interpretation-scoped).
- Tool
Descriptor Ref - Opaque available tool reference (no concrete tool types).
- Tool
Execution Completion - One-shot completion consumer for a linked tool execution.
- Tool
Execution Control - Cancellation control for a running linked tool.
- Tool
Execution Handle - Handle for a running tool.
- Tool
Kill Handle - Force-stop + join for Abortable (Tokio) or ProcessIsolated (OS child) workers.
- Tool
Registry Error - Registry error.
- Tool
Runtime Error - Runtime error.
- Tool
Runtime Terminal - Terminal from a host/runtime execution mapped for Loop outbound emission.
- Transaction
Completion - One-shot completion mailbox payload (v2).
- Transaction
Delivery - Ports installed at admission and owned by the lifecycle ledger until publish.
- Transaction
EndEvent - Terminal event body for the v2 event stream (no self-referential delivery).
- Transaction
McpHandler - MCP handler bound to one transaction capability.
- Transaction
Receiver - Host receivers created together with
TransactionDelivery. - Transaction
Reservations - RAII permits held for one admitted transaction until cleanup releases them.
- Transaction
Runtime Handle - Cloneable admission/control handle (no executor shutdown authority).
- Transaction
Submit Request - Runtime v2 submission request — concrete mailboxes, no host traits in-core.
- Transaction
Task Spawner - Cloneable handle workers use to spawn owned tasks without holding JoinHandles.
- Transaction
Tool Capacity - Per-transaction tool capacity tracker (item queue + concurrency + per-tool).
- Transaction
Tool Dispatcher - Transaction-owned dispatcher: allowlist, validation, capacity, handler, output check.
Enums§
- AcpPrompt
Wire Shape - How ACP prompt bytes are shaped for the Connector input path.
- Admission
Error Kind - Admission error kinds.
- Boundary
Kind - Boundary kinds.
- Canonical
Unit - Closed top-level canonical unit vocabulary.
- Canonical
Unit Event - Unit lifecycle event (closed vocabulary).
- Cleanup
Failure Code - Closed cleanup failure codes (v2).
- Cleanup
Status - Status of owned cleanup after completion publication (v2).
- Completion
Publish Result - Result of a one-shot completion publication attempt.
- Delivery
Config Error - Invalid delivery-port construction.
- Dispatch
Outcome - Outcome of a dispatch attempt.
- Event
Enqueue Error - Event enqueue failure (fail closed).
- Input
Validation Failure - Why input validation failed (caller maps to rejected tool result, not txn failure).
- Interpreter
Output Event - Stream events delivered to subscribers (Interpreter output + end).
- Loop
EndKind - Loop terminal kinds.
- Loop
Error Kind - Loop error classification.
- Loop
Output Event - Closed Loop output event vocabulary (initial).
- McpBinding
State - Public lifecycle state of a capability route.
- McpInstall
Error - Errors installing or mutating MCP routes.
- Outbound
Tool Outcome - Terminal outcome of a loop-owned tool action (provider-neutral).
- Output
Validation Failure - Why output validation failed (maps to runtime failure / ToolExchangeFailed).
- Process
Tool Command - How the child process is launched for ProcessIsolated tools.
- Reservation
Pool Error - Invalid reservation-pool construction.
- Runtime
State - Lifecycle of
super::lifecycle::RuntimeOwner. - Shutdown
Wait Outcome - Wait outcome for
crateruntime owner shutdown (v2). - Spawn
Reject - Why
TransactionTaskSpawner::spawnrejected or could not confirm ownership. - Startup
Error - Failure starting the transaction runtime (no partially started runtime is exposed).
- Subscription
Status - Subscription status / gap notification.
- Supervisor
Command - Backward-compatible aggregate name for exports.
- Task
Class - Classification for every supervised spawn.
- Task
Exit - Observed task exit kind.
- Terminal
Event Delivery - Outcome of attempting to enqueue the terminal
Endedevent (v2). - Tool
Request State - Tool request assembly state.
- Tool
Resolution - Registry resolution result.
- Tool
Unavailable Reason - Why a tool was unavailable.
- Transaction
Phase - Ledger phase machine (v2 §8.2).
Traits§
- Abortable
AtYield Handler - Structural AbortableAtYield factory marker (V2 §14.2 / D-050).
- McpRequest
Owner - Runs one MCP HTTP request under TaskSupervisor as
TaskClass::McpRequest(§17). - Tool
Handler - Host-linked tool implementation.
- Tool
Registry - Abstract tool registry.
- Tool
Runtime - Abstract tool runtime.
Functions§
- adapt_
completion_ callback - Invoke a legacy completion callback after the runtime publishes once.
- adapt_
event_ sink - Forward mailbox events to a legacy sink until the sender is dropped.
- build_
completion - Build a completion mailbox payload.
- dispatch_
ready_ tool - Dispatch one ready tool directly through the transaction dispatcher.
- dispatch_
ready_ tool_ cancellable - Dispatch with an actor-owned cancel signal so mid-dispatch cancel joins the worker (D-028).
- estimate_
event_ bytes - Conservative byte estimate for queue accounting (not wire encoding).
- tool_
definitions_ from_ resolved - Project resolved tool specs into MCP
tools/listdefinitions (parity with encoders). - transaction_
delivery - Create paired delivery ports with validated capacities.
- validate_
tool_ completion - Validate a handler completion against the tool output contract.
- validate_
tool_ input - Validate raw argument JSON string against size, depth, and schema.
Type Aliases§
- Loop
RunFuture - Owned Loop run future for TaskSupervisor registration.