Expand description
SessionToolSet — per-session core + exact activated tools (Task 15,
spec §7.1, §4.2).
This is bookkeeping only, not yet an execution gate: it records which configured core tools and which exactly-activated deferred tools belong to one session, pinned to the catalog generation and schema digests they were granted against. It never issues model-facing activations, exposes schemas, initializes implementations, or enforces execution.
Isolation invariants:
- a new session’s set starts with zero activations and inherits nothing from any other set;
- activation requires an exact
SessionActivationGrantfor this session, tool, current catalog generation, and current schema digest; - every rejection is typed and leaves the set unchanged (no partial mutation);
- catalog drift is represented (
is_stale), never silently absorbed.
Structs§
- Activated
Tool - One exact activation held by a session: the validated grant plus lease placeholder metadata. The grant carries the pinned catalog generation and schema digest.
- Authorized
Tool Call - A fully authorized tool call: exact resolved identity plus the acquired
implementation. The implementation field is private and the ONLY
constructor is
ExecutionGate::authorize, which acquires it strictly after every check passes — the safe path cannot reach an implementation without passing the gate. - Execution
Gate - The spec §7.1 execution gate: a pure, reusable authorization component evaluated immediately before tool implementation lookup/execution.
- Resolved
Tool Call - Typed resolution of an incoming API/wire tool name to the exact live
runtime tool identity: the wire name as received (bounded), the runtime
name it deterministically maps to (via the registry’s sanitized-name
reverse mapping), and the exact catalog
ToolIdderived from the live tool instance itself — never from the alias. Aliases and collision suffixes therefore cannot select a different identity than the tool they deterministically resolve to. - Session
Id - Typed, validated session identity (Task 15). Freely accepted unbounded
strings must not name sessions; parse at the boundary instead. The same
limits back
SessionActivationGrantsession validation, so a grant’s session id and aSessionIdcan never diverge in what they accept. - Session
Tool Set - The small configured core set plus exact activated deferred tools for one session, pinned to the catalog generation it was built against. Core tools are pinned with the schema digest of their catalog record at build time, so later drift is detectable per tool, not just per generation.
Enums§
- Activation
Authority - Host-supplied activation authority for MODEL-INITIATED activation.
- Activation
Basis - Activation
Error - Typed failure for activating a tool in a
SessionToolSet. Every variant fails closed without mutating the set. - Bulk
Activation Error - Typed failure for deterministic bulk activation (
SessionToolSet::activate_many). Every variant fails the WHOLE batch with zero partial mutation. - Exact
Revocation Error - Typed failure for
SessionToolSet::revoke_exact. - Grant
Issuance Error - Typed failure for host grant issuance. Issuance validates the exact
known
ToolId, the current catalog generation/digest (pinned into the grant), and source trust — before any grant exists. - Host
Activation Error - Typed failure for the host activation entry points.
- Runtime
Lease - Runtime-lease placeholder metadata (spec §7.4 territory). Real lease acquisition/expiry arrives with MCP/extension activation work; until then every activation records that no runtime has been acquired.
- Session
IdError - Typed failure for boundary parsing of
SessionId. - Session
Tool SetError - Typed failure for constructing a
SessionToolSet. - Tool
Authorization Error - Typed execution-gate denial. Every variant is static, bounded, and metadata-only: no tool input, no schema bytes, no provider body content — only bounded identities and generation counters.
Constants§
- WIRE_
NAME_ MAX_ BYTES - Byte budget for wire/tool names echoed inside typed denials. Denials are static, bounded, metadata-only strings: hostile oversize wire names must never be reflected verbatim.
Functions§
- activate_
exact_ for_ user - Explicit USER-REQUESTED exact activation (spec §7.3 / PR #63 ergonomics): the host may authorize one exact known local identity without a redundant confirmation prompt. This is a host Rust API — it is never reachable from model-authored JSON and takes no confirmation boolean. Grants are session-scoped and never persisted.
- activate_
model_ initiated - MODEL-INITIATED exact activation: requires host-supplied
ActivationAuthority::ModelConfirmed. Without it, the request is denied before any grant issuance, set mutation, or schema-generation advance. All requested ids are validated and issued first; the batch applies atomically in stableToolIdorder with exactly one session schema-generation advance. Grants are session-scoped, never persisted. - issue_
exact_ grant - Issue one exact session-scoped activation grant against the CURRENT catalog state. Validates: the id is a known exact cataloged capability and its source trust/provenance is consistent and verified. The grant pins the current catalog generation and schema digest. Pure: no factory invocation, no process start, no network, no set mutation.
- route_
session_ set - Resolve the session tool set for the extension-provider route (Task 17,
closing the Task 16 policy divergence): when the runtime threads its
RETAINED per-stream set, the route consumes THAT set’s current state —
including exact activations — at its pinned generation. A stale retained
set is DENIED typed (
StaleSessionSet); the route must never silently mint a fresh default-core set for the same round. Only callers with no retained handle at all (internal/sync helpers) fall back to a fresh default-core set with zero activations under a locally minted session.
Type Aliases§
- Shared
Session Tool Set - One retained per-stream-session handle:
activate_toolsmutates the SAME set theExecutionGateand the next provider round consume. Interior critical sections are short and never held across.await.