Expand description
Per-turn memoization of turn-stable host capability reads.
Context assembly reads runtime.pipeline_input many times per agent-loop
iteration — harn#5190 measured ~20 identical round-trips per turn, a cost
that grows as hosts deliver more data through that channel. This module
front-runs the thread-local HOST_CALL_BRIDGE with a per-turn memo so those
reads collapse to one host round-trip per turn, leaving every call site
unchanged. The allowlist ([is_turn_stable]) is deliberately narrow.
The memoized value is stable only within a turn: the host re-projects
runtime.pipeline_input each turn (e.g. so a mid-session model switch is
observed on the next prompt). The memo is therefore cleared at each
agent-loop iteration boundary (iteration_start, wired in
__host_agent_emit_event) and at run/embedder boundaries via [reset].
Functions§
- lookup
- Read a turn-stable host fact from the current turn’s memo.
- lookup_
by_ name - Split a dotted
capability.operationhost-call name andlookupit. Convenience for embedderhost_callimplementations, which receive the dotted wire name rather than a split pair. - store
- Memoize a turn-stable host fact for the remainder of the current turn.
Non-allowlisted
(capability, operation)pairs are ignored, so a caller cannot widen the allowlist by calling this directly. Seelookup. - store_
by_ name - Dotted-name counterpart to
store. Seelookup_by_name.