Skip to main content

Module explain

Module explain 

Source
Expand description

explain — agent 定義 → 実行時契約の static 変換結果を可視化する explain 層。

§Architecture

This is deliberately NOT a reimplementation of crate::middleware::agent_context::AgentContextMiddleware’s merge logic, nor of crate::service::task_launch::derive_agent_ctx. Duplicating either would drift from the runtime the moment one side changes without the other — exactly the “runtime との乖離” failure mode that motivated rejecting a client-only MCP-side reimplementation of the cascade for this explain layer.

Instead, explain_agent_ctx reads the SAME three raw ingredients derive_agent_ctx reads — Blueprint.default_agent_ctx, the agent’s AgentMeta.meta_ref resolved against Blueprint.metas, and the agent’s own AgentMeta.ctx — and applies the SAME AgentInline > MetaRef > BpGlobal precedence that derive_agent_ctx (base/inline shallow merge) composed with AgentContextMiddleware::merge_ctx_tiers (global/per-agent shallow merge, agent wins) already establishes end-to-end — just resolved per-key, so each key’s winning tier is visible instead of only the final merged object. explain_agent_ctx_matches_derive_agent_ctx_semantics (below) asserts the two paths agree on every key for the same Blueprint, so a future change to the runtime merge order that this module forgets to mirror fails a test rather than silently drifting.

Structs§

CtxKeyResolution
One key’s static cascade resolution result.

Enums§

CtxTier
The 3 tiers that are resolvable statically, from a Blueprint alone — no launch-time (Run / Task) or dispatch-time (Step) input required.

Functions§

explain_agent_ctx
Resolve agent’s effective static context (the 3-tier AgentInline > MetaRef > BpGlobal subset of the full cascade — see CtxTier’s doc) into a per-key winner table.