agentfootprint 9.41.0 → 9.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +30 -1
- package/CLAUDE.md +3 -1
- package/ai-instructions/claude-code/SKILL.md +31 -1
- package/dist/adapters/hosting/agentcore.js +163 -23
- package/dist/adapters/hosting/agentcore.js.map +1 -1
- package/dist/adapters/hosting/firestoreSessions.js +184 -14
- package/dist/adapters/hosting/firestoreSessions.js.map +1 -1
- package/dist/adapters/hosting/googleAgentEngine.js +29 -0
- package/dist/adapters/hosting/googleAgentEngine.js.map +1 -1
- package/dist/artifacts/conformance/cases.js +20 -0
- package/dist/artifacts/conformance/cases.js.map +1 -1
- package/dist/artifacts/scopePath.js +41 -1
- package/dist/artifacts/scopePath.js.map +1 -1
- package/dist/core/Agent.js +17 -1
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +56 -1
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +5 -1
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +5 -1
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/coverage/absent.js +163 -0
- package/dist/core/agent/coverage/absent.js.map +1 -0
- package/dist/core/agent/coverage/answer.js +90 -0
- package/dist/core/agent/coverage/answer.js.map +1 -0
- package/dist/core/agent/coverage/evidence.js +90 -0
- package/dist/core/agent/coverage/evidence.js.map +1 -0
- package/dist/core/agent/coverage/index.js +37 -0
- package/dist/core/agent/coverage/index.js.map +1 -0
- package/dist/core/agent/coverage/items.js +91 -0
- package/dist/core/agent/coverage/items.js.map +1 -0
- package/dist/core/agent/coverage/ledger.js +131 -0
- package/dist/core/agent/coverage/ledger.js.map +1 -0
- package/dist/core/agent/coverage/read.js +56 -0
- package/dist/core/agent/coverage/read.js.map +1 -0
- package/dist/core/agent/coverage/types.js +15 -0
- package/dist/core/agent/coverage/types.js.map +1 -0
- package/dist/core/agent/evidence/evidenceIndex.js +18 -1
- package/dist/core/agent/evidence/evidenceIndex.js.map +1 -1
- package/dist/core/agent/stages/prepareFinal.js +44 -3
- package/dist/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +109 -3
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/agent/toolEffects.js +1 -1
- package/dist/core/outputFallback.js.map +1 -1
- package/dist/debug.js +49 -25
- package/dist/debug.js.map +1 -1
- package/dist/esm/adapters/hosting/agentcore.d.ts +8 -0
- package/dist/esm/adapters/hosting/agentcore.js +163 -23
- package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
- package/dist/esm/adapters/hosting/firestoreSessions.d.ts +162 -14
- package/dist/esm/adapters/hosting/firestoreSessions.js +182 -13
- package/dist/esm/adapters/hosting/firestoreSessions.js.map +1 -1
- package/dist/esm/adapters/hosting/googleAgentEngine.d.ts +16 -1
- package/dist/esm/adapters/hosting/googleAgentEngine.js +29 -0
- package/dist/esm/adapters/hosting/googleAgentEngine.js.map +1 -1
- package/dist/esm/artifacts/conformance/cases.js +20 -0
- package/dist/esm/artifacts/conformance/cases.js.map +1 -1
- package/dist/esm/artifacts/scopePath.d.ts +31 -0
- package/dist/esm/artifacts/scopePath.js +41 -1
- package/dist/esm/artifacts/scopePath.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +8 -1
- package/dist/esm/core/Agent.js +18 -2
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +43 -0
- package/dist/esm/core/agent/AgentBuilder.js +56 -1
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.d.ts +9 -0
- package/dist/esm/core/agent/buildAgentChart.js +6 -2
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +6 -2
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/coverage/absent.d.ts +104 -0
- package/dist/esm/core/agent/coverage/absent.js +157 -0
- package/dist/esm/core/agent/coverage/absent.js.map +1 -0
- package/dist/esm/core/agent/coverage/answer.d.ts +46 -0
- package/dist/esm/core/agent/coverage/answer.js +86 -0
- package/dist/esm/core/agent/coverage/answer.js.map +1 -0
- package/dist/esm/core/agent/coverage/evidence.d.ts +68 -0
- package/dist/esm/core/agent/coverage/evidence.js +86 -0
- package/dist/esm/core/agent/coverage/evidence.js.map +1 -0
- package/dist/esm/core/agent/coverage/index.d.ts +17 -0
- package/dist/esm/core/agent/coverage/index.js +17 -0
- package/dist/esm/core/agent/coverage/index.js.map +1 -0
- package/dist/esm/core/agent/coverage/items.d.ts +35 -0
- package/dist/esm/core/agent/coverage/items.js +85 -0
- package/dist/esm/core/agent/coverage/items.js.map +1 -0
- package/dist/esm/core/agent/coverage/ledger.d.ts +80 -0
- package/dist/esm/core/agent/coverage/ledger.js +125 -0
- package/dist/esm/core/agent/coverage/ledger.js.map +1 -0
- package/dist/esm/core/agent/coverage/read.d.ts +51 -0
- package/dist/esm/core/agent/coverage/read.js +52 -0
- package/dist/esm/core/agent/coverage/read.js.map +1 -0
- package/dist/esm/core/agent/coverage/types.d.ts +142 -0
- package/dist/esm/core/agent/coverage/types.js +14 -0
- package/dist/esm/core/agent/coverage/types.js.map +1 -0
- package/dist/esm/core/agent/evidence/evidenceIndex.d.ts +7 -0
- package/dist/esm/core/agent/evidence/evidenceIndex.js +18 -1
- package/dist/esm/core/agent/evidence/evidenceIndex.js.map +1 -1
- package/dist/esm/core/agent/stages/prepareFinal.d.ts +18 -0
- package/dist/esm/core/agent/stages/prepareFinal.js +42 -2
- package/dist/esm/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.js +109 -3
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/toolEffects.d.ts +2 -2
- package/dist/esm/core/agent/toolEffects.js +1 -1
- package/dist/esm/core/agent/types.d.ts +14 -0
- package/dist/esm/core/outputFallback.d.ts +15 -1
- package/dist/esm/core/outputFallback.js.map +1 -1
- package/dist/esm/debug.d.ts +1 -0
- package/dist/esm/debug.js +7 -0
- package/dist/esm/debug.js.map +1 -1
- package/dist/esm/events/dispatcher.d.ts +1 -1
- package/dist/esm/events/dispatcher.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +82 -0
- package/dist/esm/events/registry.d.ts +11 -1
- package/dist/esm/events/registry.js +10 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/hosting/conformance/cases.d.ts +2 -1
- package/dist/esm/hosting/conformance/cases.js +229 -22
- package/dist/esm/hosting/conformance/cases.js.map +1 -1
- package/dist/esm/hosting/conformance/types.d.ts +7 -7
- package/dist/esm/hosting/errors.d.ts +28 -0
- package/dist/esm/hosting/errors.js +40 -0
- package/dist/esm/hosting/errors.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +11 -3
- package/dist/esm/hosting/index.js +15 -2
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/memorySessions.js +39 -0
- package/dist/esm/hosting/memorySessions.js.map +1 -1
- package/dist/esm/hosting/sessionRetention.d.ts +56 -0
- package/dist/esm/hosting/sessionRetention.js +69 -0
- package/dist/esm/hosting/sessionRetention.js.map +1 -0
- package/dist/esm/hosting/sqliteSessions.d.ts +11 -1
- package/dist/esm/hosting/sqliteSessions.js +51 -0
- package/dist/esm/hosting/sqliteSessions.js.map +1 -1
- package/dist/esm/hosting/types.d.ts +184 -0
- package/dist/esm/hosting/types.js +9 -0
- package/dist/esm/hosting/types.js.map +1 -1
- package/dist/esm/hosting-providers.d.ts +15 -11
- package/dist/esm/hosting-providers.js +21 -11
- package/dist/esm/hosting-providers.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/context-bisect/arms/apply.d.ts +54 -0
- package/dist/esm/lib/context-bisect/arms/apply.js +41 -0
- package/dist/esm/lib/context-bisect/arms/apply.js.map +1 -0
- package/dist/esm/lib/context-bisect/arms/compare.d.ts +27 -0
- package/dist/esm/lib/context-bisect/arms/compare.js +112 -0
- package/dist/esm/lib/context-bisect/arms/compare.js.map +1 -0
- package/dist/esm/lib/context-bisect/arms/index.d.ts +16 -0
- package/dist/esm/lib/context-bisect/arms/index.js +16 -0
- package/dist/esm/lib/context-bisect/arms/index.js.map +1 -0
- package/dist/esm/lib/context-bisect/arms/manifest.d.ts +79 -0
- package/dist/esm/lib/context-bisect/arms/manifest.js +199 -0
- package/dist/esm/lib/context-bisect/arms/manifest.js.map +1 -0
- package/dist/esm/lib/context-bisect/arms/probe.d.ts +54 -0
- package/dist/esm/lib/context-bisect/arms/probe.js +125 -0
- package/dist/esm/lib/context-bisect/arms/probe.js.map +1 -0
- package/dist/esm/lib/context-bisect/arms/types.d.ts +319 -0
- package/dist/esm/lib/context-bisect/arms/types.js +67 -0
- package/dist/esm/lib/context-bisect/arms/types.js.map +1 -0
- package/dist/esm/lib/context-bisect/arms/validate.d.ts +26 -0
- package/dist/esm/lib/context-bisect/arms/validate.js +122 -0
- package/dist/esm/lib/context-bisect/arms/validate.js.map +1 -0
- package/dist/esm/lib/context-bisect/arms/verdict.d.ts +53 -0
- package/dist/esm/lib/context-bisect/arms/verdict.js +103 -0
- package/dist/esm/lib/context-bisect/arms/verdict.js.map +1 -0
- package/dist/esm/lib/context-bisect/index.d.ts +1 -0
- package/dist/esm/lib/context-bisect/index.js +5 -0
- package/dist/esm/lib/context-bisect/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/index.d.ts +1 -1
- package/dist/esm/lib/injection-engine/index.js +3 -1
- package/dist/esm/lib/injection-engine/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillExamples.d.ts +16 -13
- package/dist/esm/lib/injection-engine/skillExamples.js +16 -60
- package/dist/esm/lib/injection-engine/skillExamples.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillGraph.d.ts +50 -0
- package/dist/esm/lib/injection-engine/skillGraph.js +52 -1
- package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillGraphCheckup.d.ts +6 -5
- package/dist/esm/lib/injection-engine/skillGraphCheckup.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillNeverRoutes.d.ts +131 -0
- package/dist/esm/lib/injection-engine/skillNeverRoutes.js +228 -0
- package/dist/esm/lib/injection-engine/skillNeverRoutes.js.map +1 -0
- package/dist/esm/lib/injection-engine/skillPartition.d.ts +69 -0
- package/dist/esm/lib/injection-engine/skillPartition.js +273 -0
- package/dist/esm/lib/injection-engine/skillPartition.js.map +1 -0
- package/dist/esm/lib/injection-engine/skillsFromDir.d.ts +83 -3
- package/dist/esm/lib/injection-engine/skillsFromDir.js +118 -7
- package/dist/esm/lib/injection-engine/skillsFromDir.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillsFromDirRoutes.d.ts +105 -0
- package/dist/esm/lib/injection-engine/skillsFromDirRoutes.js +169 -0
- package/dist/esm/lib/injection-engine/skillsFromDirRoutes.js.map +1 -0
- package/dist/esm/lib/injection-engine/startRuleClaim.d.ts +91 -0
- package/dist/esm/lib/injection-engine/startRuleClaim.js +78 -0
- package/dist/esm/lib/injection-engine/startRuleClaim.js.map +1 -0
- package/dist/esm/lib/injection-engine/toolOutcome.d.ts +12 -3
- package/dist/esm/lib/injection-engine/toolOutcome.js +2 -1
- package/dist/esm/lib/injection-engine/toolOutcome.js.map +1 -1
- package/dist/events/dispatcher.js.map +1 -1
- package/dist/events/registry.js +10 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/hosting/conformance/cases.js +229 -22
- package/dist/hosting/conformance/cases.js.map +1 -1
- package/dist/hosting/errors.js +42 -1
- package/dist/hosting/errors.js.map +1 -1
- package/dist/hosting/index.js +18 -2
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/memorySessions.js +39 -0
- package/dist/hosting/memorySessions.js.map +1 -1
- package/dist/hosting/sessionRetention.js +73 -0
- package/dist/hosting/sessionRetention.js.map +1 -0
- package/dist/hosting/sqliteSessions.js +51 -0
- package/dist/hosting/sqliteSessions.js.map +1 -1
- package/dist/hosting/types.js +10 -1
- package/dist/hosting/types.js.map +1 -1
- package/dist/hosting-providers.js +21 -11
- package/dist/hosting-providers.js.map +1 -1
- package/dist/index.js +72 -43
- package/dist/index.js.map +1 -1
- package/dist/lib/context-bisect/arms/apply.js +45 -0
- package/dist/lib/context-bisect/arms/apply.js.map +1 -0
- package/dist/lib/context-bisect/arms/compare.js +116 -0
- package/dist/lib/context-bisect/arms/compare.js.map +1 -0
- package/dist/lib/context-bisect/arms/index.js +35 -0
- package/dist/lib/context-bisect/arms/index.js.map +1 -0
- package/dist/lib/context-bisect/arms/manifest.js +207 -0
- package/dist/lib/context-bisect/arms/manifest.js.map +1 -0
- package/dist/lib/context-bisect/arms/probe.js +132 -0
- package/dist/lib/context-bisect/arms/probe.js.map +1 -0
- package/dist/lib/context-bisect/arms/types.js +68 -0
- package/dist/lib/context-bisect/arms/types.js.map +1 -0
- package/dist/lib/context-bisect/arms/validate.js +128 -0
- package/dist/lib/context-bisect/arms/validate.js.map +1 -0
- package/dist/lib/context-bisect/arms/verdict.js +107 -0
- package/dist/lib/context-bisect/arms/verdict.js.map +1 -0
- package/dist/lib/context-bisect/index.js +23 -1
- package/dist/lib/context-bisect/index.js.map +1 -1
- package/dist/lib/injection-engine/index.js +4 -1
- package/dist/lib/injection-engine/index.js.map +1 -1
- package/dist/lib/injection-engine/skillExamples.js +24 -68
- package/dist/lib/injection-engine/skillExamples.js.map +1 -1
- package/dist/lib/injection-engine/skillGraph.js +52 -1
- package/dist/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/lib/injection-engine/skillGraphCheckup.js.map +1 -1
- package/dist/lib/injection-engine/skillNeverRoutes.js +234 -0
- package/dist/lib/injection-engine/skillNeverRoutes.js.map +1 -0
- package/dist/lib/injection-engine/skillPartition.js +277 -0
- package/dist/lib/injection-engine/skillPartition.js.map +1 -0
- package/dist/lib/injection-engine/skillsFromDir.js +121 -9
- package/dist/lib/injection-engine/skillsFromDir.js.map +1 -1
- package/dist/lib/injection-engine/skillsFromDirRoutes.js +174 -0
- package/dist/lib/injection-engine/skillsFromDirRoutes.js.map +1 -0
- package/dist/lib/injection-engine/startRuleClaim.js +85 -0
- package/dist/lib/injection-engine/startRuleClaim.js.map +1 -0
- package/dist/lib/injection-engine/toolOutcome.js +2 -1
- package/dist/lib/injection-engine/toolOutcome.js.map +1 -1
- package/dist/types/adapters/hosting/agentcore.d.ts +8 -0
- package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/hosting/firestoreSessions.d.ts +162 -14
- package/dist/types/adapters/hosting/firestoreSessions.d.ts.map +1 -1
- package/dist/types/adapters/hosting/googleAgentEngine.d.ts +16 -1
- package/dist/types/adapters/hosting/googleAgentEngine.d.ts.map +1 -1
- package/dist/types/artifacts/conformance/cases.d.ts.map +1 -1
- package/dist/types/artifacts/scopePath.d.ts +31 -0
- package/dist/types/artifacts/scopePath.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +8 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +43 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +9 -0
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/absent.d.ts +105 -0
- package/dist/types/core/agent/coverage/absent.d.ts.map +1 -0
- package/dist/types/core/agent/coverage/answer.d.ts +47 -0
- package/dist/types/core/agent/coverage/answer.d.ts.map +1 -0
- package/dist/types/core/agent/coverage/evidence.d.ts +69 -0
- package/dist/types/core/agent/coverage/evidence.d.ts.map +1 -0
- package/dist/types/core/agent/coverage/index.d.ts +18 -0
- package/dist/types/core/agent/coverage/index.d.ts.map +1 -0
- package/dist/types/core/agent/coverage/items.d.ts +36 -0
- package/dist/types/core/agent/coverage/items.d.ts.map +1 -0
- package/dist/types/core/agent/coverage/ledger.d.ts +81 -0
- package/dist/types/core/agent/coverage/ledger.d.ts.map +1 -0
- package/dist/types/core/agent/coverage/read.d.ts +52 -0
- package/dist/types/core/agent/coverage/read.d.ts.map +1 -0
- package/dist/types/core/agent/coverage/types.d.ts +143 -0
- package/dist/types/core/agent/coverage/types.d.ts.map +1 -0
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts +7 -0
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts.map +1 -1
- package/dist/types/core/agent/stages/prepareFinal.d.ts +18 -0
- package/dist/types/core/agent/stages/prepareFinal.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/toolEffects.d.ts +2 -2
- package/dist/types/core/agent/types.d.ts +14 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/outputFallback.d.ts +15 -1
- package/dist/types/core/outputFallback.d.ts.map +1 -1
- package/dist/types/debug.d.ts +1 -0
- package/dist/types/debug.d.ts.map +1 -1
- package/dist/types/events/dispatcher.d.ts +1 -1
- package/dist/types/events/dispatcher.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +82 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +11 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/hosting/conformance/cases.d.ts +2 -1
- package/dist/types/hosting/conformance/cases.d.ts.map +1 -1
- package/dist/types/hosting/conformance/types.d.ts +7 -7
- package/dist/types/hosting/conformance/types.d.ts.map +1 -1
- package/dist/types/hosting/errors.d.ts +28 -0
- package/dist/types/hosting/errors.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +11 -3
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/memorySessions.d.ts.map +1 -1
- package/dist/types/hosting/sessionRetention.d.ts +57 -0
- package/dist/types/hosting/sessionRetention.d.ts.map +1 -0
- package/dist/types/hosting/sqliteSessions.d.ts +11 -1
- package/dist/types/hosting/sqliteSessions.d.ts.map +1 -1
- package/dist/types/hosting/types.d.ts +184 -0
- package/dist/types/hosting/types.d.ts.map +1 -1
- package/dist/types/hosting-providers.d.ts +15 -11
- package/dist/types/hosting-providers.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/context-bisect/arms/apply.d.ts +55 -0
- package/dist/types/lib/context-bisect/arms/apply.d.ts.map +1 -0
- package/dist/types/lib/context-bisect/arms/compare.d.ts +28 -0
- package/dist/types/lib/context-bisect/arms/compare.d.ts.map +1 -0
- package/dist/types/lib/context-bisect/arms/index.d.ts +17 -0
- package/dist/types/lib/context-bisect/arms/index.d.ts.map +1 -0
- package/dist/types/lib/context-bisect/arms/manifest.d.ts +80 -0
- package/dist/types/lib/context-bisect/arms/manifest.d.ts.map +1 -0
- package/dist/types/lib/context-bisect/arms/probe.d.ts +55 -0
- package/dist/types/lib/context-bisect/arms/probe.d.ts.map +1 -0
- package/dist/types/lib/context-bisect/arms/types.d.ts +320 -0
- package/dist/types/lib/context-bisect/arms/types.d.ts.map +1 -0
- package/dist/types/lib/context-bisect/arms/validate.d.ts +27 -0
- package/dist/types/lib/context-bisect/arms/validate.d.ts.map +1 -0
- package/dist/types/lib/context-bisect/arms/verdict.d.ts +54 -0
- package/dist/types/lib/context-bisect/arms/verdict.d.ts.map +1 -0
- package/dist/types/lib/context-bisect/index.d.ts +1 -0
- package/dist/types/lib/context-bisect/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/index.d.ts +1 -1
- package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillExamples.d.ts +16 -13
- package/dist/types/lib/injection-engine/skillExamples.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillGraph.d.ts +50 -0
- package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillGraphCheckup.d.ts +6 -5
- package/dist/types/lib/injection-engine/skillGraphCheckup.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillNeverRoutes.d.ts +132 -0
- package/dist/types/lib/injection-engine/skillNeverRoutes.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/skillPartition.d.ts +70 -0
- package/dist/types/lib/injection-engine/skillPartition.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/skillsFromDir.d.ts +83 -3
- package/dist/types/lib/injection-engine/skillsFromDir.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillsFromDirRoutes.d.ts +106 -0
- package/dist/types/lib/injection-engine/skillsFromDirRoutes.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/startRuleClaim.d.ts +92 -0
- package/dist/types/lib/injection-engine/startRuleClaim.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/toolOutcome.d.ts +12 -3
- package/dist/types/lib/injection-engine/toolOutcome.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* evidence — what an absence is allowed to GROUND.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: one projection, one consumer (`evidence/evidenceIndex.ts`). The
|
|
5
|
+
* `evidence/frames.ts` argument applied to the other side of the
|
|
6
|
+
* conversation: there, text the library wrote into a `role: 'user'`
|
|
7
|
+
* turn must not become user-supplied evidence; here, text the MODEL
|
|
8
|
+
* supplied that a tool echoed back must not become tool evidence.
|
|
9
|
+
* Role: core/ layer, pure.
|
|
10
|
+
* Emits: N/A.
|
|
11
|
+
*
|
|
12
|
+
* ## The bug this file exists to prevent
|
|
13
|
+
*
|
|
14
|
+
* The evidence gate's corpus is every `role: 'tool'` result: a value the
|
|
15
|
+
* model read from a tool is grounded. An absence is a tool result — and its
|
|
16
|
+
* whole job is to say what was looked for, which in practice means quoting
|
|
17
|
+
* the arguments the model passed ("no FLOGI entries on fc1/3", where `fc1/3`
|
|
18
|
+
* came from the model, not from the fabric).
|
|
19
|
+
*
|
|
20
|
+
* Index that whole frame and an invented identifier becomes grounded by the
|
|
21
|
+
* one route that proves nothing about it: handing it to a tool that found
|
|
22
|
+
* nothing. The model could then assert "fc1/3 has no FLOGI entries" about a
|
|
23
|
+
* port it invented, and the gate would agree, because it saw the string in a
|
|
24
|
+
* tool result. **A failed lookup is the cheapest possible laundering
|
|
25
|
+
* machine**, and adding a primitive whose purpose is to make failed lookups
|
|
26
|
+
* informative would have made it cheaper still.
|
|
27
|
+
*
|
|
28
|
+
* So an absence grounds its COVERAGE and nothing else. `checked`,
|
|
29
|
+
* `not_checked` and `cannot_cover` are the tool's own words about the world —
|
|
30
|
+
* a fabric name, a collector, a window — and they are exactly what an answer
|
|
31
|
+
* built on an absence should be allowed to cite. `looked_for`, `try_instead`,
|
|
32
|
+
* the note and the marker are not.
|
|
33
|
+
*
|
|
34
|
+
* The consequence is deliberate and worth stating: if the USER named the
|
|
35
|
+
* thing, it is exempt anyway (their message is the exempt corpus), so a real
|
|
36
|
+
* question about a real port is unaffected. Only a value that appears *for
|
|
37
|
+
* the first time* in an absence loses its grounding — which is the only case
|
|
38
|
+
* where it was never evidence to begin with.
|
|
39
|
+
*
|
|
40
|
+
* ## What this does NOT close, said plainly
|
|
41
|
+
*
|
|
42
|
+
* The whitelist rests on "coverage is the tool's own words about the world".
|
|
43
|
+
* An author who interpolates an unvalidated argument into a coverage entry —
|
|
44
|
+
* a `checked` line built by string-interpolating the `switch` argument the
|
|
45
|
+
* model passed — puts a model-supplied token back into the corpus through the
|
|
46
|
+
* one list this file admits. That is narrower than the hole it closes (the
|
|
47
|
+
* author chose to echo, rather than the primitive echoing by design), and it
|
|
48
|
+
* is not detectable from here: this library cannot tell which characters of a
|
|
49
|
+
* sentence a tool composed and which it copied. The guidance is on the door
|
|
50
|
+
* itself — interpolate identifiers you RESOLVED, not identifiers you were
|
|
51
|
+
* handed. It is also the general limit of the evidence corpus, not a new one:
|
|
52
|
+
* any tool that echoes its arguments into its result has always grounded
|
|
53
|
+
* them.
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Project a parsed tool result down to what it may ground, or `undefined`
|
|
57
|
+
* when it carries no absence frame — the ordinary case, which the caller
|
|
58
|
+
* indexes exactly as it always did.
|
|
59
|
+
*
|
|
60
|
+
* Two shapes carry one: a bare absence, and an absence bounded by a coverage
|
|
61
|
+
* ledger (`coverage(absent(…), …)`). A ledger's own lists are all tool
|
|
62
|
+
* prose, so they are indexed whole; only the absence inside it is narrowed.
|
|
63
|
+
* An absence buried deeper than that — inside a tool's own domain object —
|
|
64
|
+
* is NOT found, and is left indexed as ordinary data: this projection
|
|
65
|
+
* recognizes the shapes this library mints, and does not go hunting through
|
|
66
|
+
* values it did not write.
|
|
67
|
+
*/
|
|
68
|
+
export declare function absenceEvidenceProjection(parsed: unknown): unknown | undefined;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* evidence — what an absence is allowed to GROUND.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: one projection, one consumer (`evidence/evidenceIndex.ts`). The
|
|
5
|
+
* `evidence/frames.ts` argument applied to the other side of the
|
|
6
|
+
* conversation: there, text the library wrote into a `role: 'user'`
|
|
7
|
+
* turn must not become user-supplied evidence; here, text the MODEL
|
|
8
|
+
* supplied that a tool echoed back must not become tool evidence.
|
|
9
|
+
* Role: core/ layer, pure.
|
|
10
|
+
* Emits: N/A.
|
|
11
|
+
*
|
|
12
|
+
* ## The bug this file exists to prevent
|
|
13
|
+
*
|
|
14
|
+
* The evidence gate's corpus is every `role: 'tool'` result: a value the
|
|
15
|
+
* model read from a tool is grounded. An absence is a tool result — and its
|
|
16
|
+
* whole job is to say what was looked for, which in practice means quoting
|
|
17
|
+
* the arguments the model passed ("no FLOGI entries on fc1/3", where `fc1/3`
|
|
18
|
+
* came from the model, not from the fabric).
|
|
19
|
+
*
|
|
20
|
+
* Index that whole frame and an invented identifier becomes grounded by the
|
|
21
|
+
* one route that proves nothing about it: handing it to a tool that found
|
|
22
|
+
* nothing. The model could then assert "fc1/3 has no FLOGI entries" about a
|
|
23
|
+
* port it invented, and the gate would agree, because it saw the string in a
|
|
24
|
+
* tool result. **A failed lookup is the cheapest possible laundering
|
|
25
|
+
* machine**, and adding a primitive whose purpose is to make failed lookups
|
|
26
|
+
* informative would have made it cheaper still.
|
|
27
|
+
*
|
|
28
|
+
* So an absence grounds its COVERAGE and nothing else. `checked`,
|
|
29
|
+
* `not_checked` and `cannot_cover` are the tool's own words about the world —
|
|
30
|
+
* a fabric name, a collector, a window — and they are exactly what an answer
|
|
31
|
+
* built on an absence should be allowed to cite. `looked_for`, `try_instead`,
|
|
32
|
+
* the note and the marker are not.
|
|
33
|
+
*
|
|
34
|
+
* The consequence is deliberate and worth stating: if the USER named the
|
|
35
|
+
* thing, it is exempt anyway (their message is the exempt corpus), so a real
|
|
36
|
+
* question about a real port is unaffected. Only a value that appears *for
|
|
37
|
+
* the first time* in an absence loses its grounding — which is the only case
|
|
38
|
+
* where it was never evidence to begin with.
|
|
39
|
+
*
|
|
40
|
+
* ## What this does NOT close, said plainly
|
|
41
|
+
*
|
|
42
|
+
* The whitelist rests on "coverage is the tool's own words about the world".
|
|
43
|
+
* An author who interpolates an unvalidated argument into a coverage entry —
|
|
44
|
+
* a `checked` line built by string-interpolating the `switch` argument the
|
|
45
|
+
* model passed — puts a model-supplied token back into the corpus through the
|
|
46
|
+
* one list this file admits. That is narrower than the hole it closes (the
|
|
47
|
+
* author chose to echo, rather than the primitive echoing by design), and it
|
|
48
|
+
* is not detectable from here: this library cannot tell which characters of a
|
|
49
|
+
* sentence a tool composed and which it copied. The guidance is on the door
|
|
50
|
+
* itself — interpolate identifiers you RESOLVED, not identifiers you were
|
|
51
|
+
* handed. It is also the general limit of the evidence corpus, not a new one:
|
|
52
|
+
* any tool that echoes its arguments into its result has always grounded
|
|
53
|
+
* them.
|
|
54
|
+
*/
|
|
55
|
+
import { readAbsence } from './absent.js';
|
|
56
|
+
import { readCoverageLedger } from './ledger.js';
|
|
57
|
+
/** The coverage lists of one absence, as the only thing it grounds. */
|
|
58
|
+
function coverageOnly(absence) {
|
|
59
|
+
return [absence.checked ?? [], absence.not_checked ?? [], absence.cannot_cover ?? []];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Project a parsed tool result down to what it may ground, or `undefined`
|
|
63
|
+
* when it carries no absence frame — the ordinary case, which the caller
|
|
64
|
+
* indexes exactly as it always did.
|
|
65
|
+
*
|
|
66
|
+
* Two shapes carry one: a bare absence, and an absence bounded by a coverage
|
|
67
|
+
* ledger (`coverage(absent(…), …)`). A ledger's own lists are all tool
|
|
68
|
+
* prose, so they are indexed whole; only the absence inside it is narrowed.
|
|
69
|
+
* An absence buried deeper than that — inside a tool's own domain object —
|
|
70
|
+
* is NOT found, and is left indexed as ordinary data: this projection
|
|
71
|
+
* recognizes the shapes this library mints, and does not go hunting through
|
|
72
|
+
* values it did not write.
|
|
73
|
+
*/
|
|
74
|
+
export function absenceEvidenceProjection(parsed) {
|
|
75
|
+
const absence = readAbsence(parsed);
|
|
76
|
+
if (absence !== undefined)
|
|
77
|
+
return coverageOnly(absence);
|
|
78
|
+
const covered = readCoverageLedger(parsed);
|
|
79
|
+
if (covered === undefined)
|
|
80
|
+
return undefined;
|
|
81
|
+
const inner = readAbsence(covered.result);
|
|
82
|
+
if (inner === undefined)
|
|
83
|
+
return undefined;
|
|
84
|
+
return [covered.af_coverage, ...coverageOnly(inner)];
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../../../../src/core/agent/coverage/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,uEAAuE;AACvE,SAAS,YAAY,CAAC,OAAoB;IACxC,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;AACxF,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAe;IACvD,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two coverage primitives — `absent()` and `coverage()`.
|
|
3
|
+
*
|
|
4
|
+
* The door: what the main barrel publishes, and the one import path the
|
|
5
|
+
* dispatch loop, the evidence index and the final-answer stage use. Both
|
|
6
|
+
* primitives came from FIELD USE — a production triage agent that had
|
|
7
|
+
* invented them because the library had no answer for either. See README.md
|
|
8
|
+
* for the arguments; nothing here is new machinery, it is a smaller version
|
|
9
|
+
* of what already worked.
|
|
10
|
+
*/
|
|
11
|
+
export { ABSENCE_MARKER, ABSENCE_NOTE, absent, coverageOfAbsence, readAbsence } from './absent.js';
|
|
12
|
+
export { composeAnswerWithCoverage, COVERAGE_BLOCK_HEADING } from './answer.js';
|
|
13
|
+
export { absenceEvidenceProjection } from './evidence.js';
|
|
14
|
+
export { mergeItems, normalizeCoverageList, sameItem } from './items.js';
|
|
15
|
+
export { coverage, COVERAGE_MARKER, COVERAGE_NOTE, coverageOfLedger, readCoverageLedger, } from './ledger.js';
|
|
16
|
+
export { readCoverageResult, type CoverageFacts, type CoverageReading } from './read.js';
|
|
17
|
+
export type { AbsenceDeclaration, Coverage, CoverageDeclaration, CoverageInput, CoverageItem, CoveredResult, DeclaredCoverage, ToolAbsence, } from './types.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two coverage primitives — `absent()` and `coverage()`.
|
|
3
|
+
*
|
|
4
|
+
* The door: what the main barrel publishes, and the one import path the
|
|
5
|
+
* dispatch loop, the evidence index and the final-answer stage use. Both
|
|
6
|
+
* primitives came from FIELD USE — a production triage agent that had
|
|
7
|
+
* invented them because the library had no answer for either. See README.md
|
|
8
|
+
* for the arguments; nothing here is new machinery, it is a smaller version
|
|
9
|
+
* of what already worked.
|
|
10
|
+
*/
|
|
11
|
+
export { ABSENCE_MARKER, ABSENCE_NOTE, absent, coverageOfAbsence, readAbsence } from './absent.js';
|
|
12
|
+
export { composeAnswerWithCoverage, COVERAGE_BLOCK_HEADING } from './answer.js';
|
|
13
|
+
export { absenceEvidenceProjection } from './evidence.js';
|
|
14
|
+
export { mergeItems, normalizeCoverageList, sameItem } from './items.js';
|
|
15
|
+
export { coverage, COVERAGE_MARKER, COVERAGE_NOTE, coverageOfLedger, readCoverageLedger, } from './ledger.js';
|
|
16
|
+
export { readCoverageResult } from './read.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/agent/coverage/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EACL,QAAQ,EACR,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAA4C,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* coverage/items — normalizing and refusing coverage lists.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: one validator, two doors (`absent()` and `coverage()`), so the two
|
|
5
|
+
* primitives cannot disagree about what a well-formed piece of
|
|
6
|
+
* ground looks like.
|
|
7
|
+
* Role: core/ layer, pure. Throws at the CALL SITE (the
|
|
8
|
+
* `resolveEvidenceGate` precedent): a malformed declaration is a
|
|
9
|
+
* mistake in the line the author just wrote, and the stack should
|
|
10
|
+
* say so — not fail on the first absence of the first incident.
|
|
11
|
+
* Emits: N/A.
|
|
12
|
+
*/
|
|
13
|
+
import type { CoverageInput, CoverageItem } from './types.js';
|
|
14
|
+
/** Section names, as the author spells them — used verbatim in refusals. */
|
|
15
|
+
export type CoverageSection = 'checked' | 'notChecked' | 'cannotCover';
|
|
16
|
+
/**
|
|
17
|
+
* Normalize one author list into {@link CoverageItem}s, refusing anything a
|
|
18
|
+
* reader could not act on.
|
|
19
|
+
*
|
|
20
|
+
* `requireWhy` is true only for `cannotCover`. The asymmetry is deliberate:
|
|
21
|
+
* "we checked the fcns database" and "we did not check the archive" are
|
|
22
|
+
* complete statements on their own, but "this tool can never see host-side
|
|
23
|
+
* multipathing" is a claim about capability — and a permanent blind spot with
|
|
24
|
+
* no reason attached cannot be acted on, escalated, or disproved. It is also
|
|
25
|
+
* the one an operator is most likely to want to fix, so the reason is the
|
|
26
|
+
* useful half.
|
|
27
|
+
*/
|
|
28
|
+
export declare function normalizeCoverageList(fn: string, section: CoverageSection, list: readonly CoverageInput[] | undefined, requireWhy: boolean): readonly CoverageItem[];
|
|
29
|
+
/** Two entries are the same ground when they say the same two things. Used to
|
|
30
|
+
* fold the run's declarations into ONE answer-level block: five tools that
|
|
31
|
+
* all name the same missing collector should say it once. */
|
|
32
|
+
export declare function sameItem(a: CoverageItem, b: CoverageItem): boolean;
|
|
33
|
+
/** Merge lists in declaration order, dropping repeats. Order is the run's own
|
|
34
|
+
* order on purpose — it is the only ordering that means anything here. */
|
|
35
|
+
export declare function mergeItems(lists: ReadonlyArray<readonly CoverageItem[]>): readonly CoverageItem[];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* coverage/items — normalizing and refusing coverage lists.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: one validator, two doors (`absent()` and `coverage()`), so the two
|
|
5
|
+
* primitives cannot disagree about what a well-formed piece of
|
|
6
|
+
* ground looks like.
|
|
7
|
+
* Role: core/ layer, pure. Throws at the CALL SITE (the
|
|
8
|
+
* `resolveEvidenceGate` precedent): a malformed declaration is a
|
|
9
|
+
* mistake in the line the author just wrote, and the stack should
|
|
10
|
+
* say so — not fail on the first absence of the first incident.
|
|
11
|
+
* Emits: N/A.
|
|
12
|
+
*/
|
|
13
|
+
const isPlainString = (v) => typeof v === 'string' && v.trim().length > 0;
|
|
14
|
+
/**
|
|
15
|
+
* Normalize one author list into {@link CoverageItem}s, refusing anything a
|
|
16
|
+
* reader could not act on.
|
|
17
|
+
*
|
|
18
|
+
* `requireWhy` is true only for `cannotCover`. The asymmetry is deliberate:
|
|
19
|
+
* "we checked the fcns database" and "we did not check the archive" are
|
|
20
|
+
* complete statements on their own, but "this tool can never see host-side
|
|
21
|
+
* multipathing" is a claim about capability — and a permanent blind spot with
|
|
22
|
+
* no reason attached cannot be acted on, escalated, or disproved. It is also
|
|
23
|
+
* the one an operator is most likely to want to fix, so the reason is the
|
|
24
|
+
* useful half.
|
|
25
|
+
*/
|
|
26
|
+
export function normalizeCoverageList(fn, section, list, requireWhy) {
|
|
27
|
+
if (list === undefined)
|
|
28
|
+
return [];
|
|
29
|
+
if (!Array.isArray(list)) {
|
|
30
|
+
throw new Error(`${fn}: \`${section}\` must be an array of strings or { what, why } entries — to say ` +
|
|
31
|
+
`nothing about it, omit the field (absent means "not declared", never "nothing there").`);
|
|
32
|
+
}
|
|
33
|
+
const items = [];
|
|
34
|
+
list.forEach((raw, i) => {
|
|
35
|
+
const at = `${section}[${i}]`;
|
|
36
|
+
if (isPlainString(raw)) {
|
|
37
|
+
if (requireWhy) {
|
|
38
|
+
throw new Error(`${fn}: ${at} is '${raw.trim()}' with no reason. Every \`cannotCover\` entry needs a ` +
|
|
39
|
+
`\`why\` — a blind spot this tool can NEVER see is a claim about what it is, and a ` +
|
|
40
|
+
`reader cannot act on, escalate or disprove a claim with no reason. Write ` +
|
|
41
|
+
`{ what: '${raw.trim()}', why: '…' }, or move it to \`notChecked\` if a wider ` +
|
|
42
|
+
`call could reach it.`);
|
|
43
|
+
}
|
|
44
|
+
items.push({ what: raw.trim() });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (typeof raw !== 'object' || raw === null || !isPlainString(raw.what)) {
|
|
48
|
+
throw new Error(`${fn}: ${at} names no ground. Each entry is either a non-empty string or ` +
|
|
49
|
+
`{ what, why } — what a reader has to know is WHICH source, window or population ` +
|
|
50
|
+
`this is about.`);
|
|
51
|
+
}
|
|
52
|
+
const item = raw;
|
|
53
|
+
const why = item.why;
|
|
54
|
+
if (why !== undefined && !isPlainString(why)) {
|
|
55
|
+
throw new Error(`${fn}: ${at} ('${item.what.trim()}') has a \`why\` that says nothing. Give it a ` +
|
|
56
|
+
`reason or omit the field.`);
|
|
57
|
+
}
|
|
58
|
+
if (requireWhy && why === undefined) {
|
|
59
|
+
throw new Error(`${fn}: ${at} ('${item.what.trim()}') has no \`why\`. Every \`cannotCover\` entry ` +
|
|
60
|
+
`needs one — see the entry above this line in the docs for why a permanent blind ` +
|
|
61
|
+
`spot must say what makes it permanent.`);
|
|
62
|
+
}
|
|
63
|
+
items.push({ what: item.what.trim(), ...(why !== undefined && { why: why.trim() }) });
|
|
64
|
+
});
|
|
65
|
+
return items;
|
|
66
|
+
}
|
|
67
|
+
/** Two entries are the same ground when they say the same two things. Used to
|
|
68
|
+
* fold the run's declarations into ONE answer-level block: five tools that
|
|
69
|
+
* all name the same missing collector should say it once. */
|
|
70
|
+
export function sameItem(a, b) {
|
|
71
|
+
return a.what === b.what && (a.why ?? '') === (b.why ?? '');
|
|
72
|
+
}
|
|
73
|
+
/** Merge lists in declaration order, dropping repeats. Order is the run's own
|
|
74
|
+
* order on purpose — it is the only ordering that means anything here. */
|
|
75
|
+
export function mergeItems(lists) {
|
|
76
|
+
const out = [];
|
|
77
|
+
for (const list of lists) {
|
|
78
|
+
for (const item of list) {
|
|
79
|
+
if (!out.some((seen) => sameItem(seen, item)))
|
|
80
|
+
out.push(item);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=items.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"items.js","sourceRoot":"","sources":["../../../../../src/core/agent/coverage/items.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,MAAM,aAAa,GAAG,CAAC,CAAU,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AAEhG;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qBAAqB,CACnC,EAAU,EACV,OAAwB,EACxB,IAA0C,EAC1C,UAAmB;IAEnB,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAClC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,GAAG,EAAE,OAAO,OAAO,mEAAmE;YACpF,wFAAwF,CAC3F,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACtB,MAAM,EAAE,GAAG,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC;QAC9B,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CACb,GAAG,EAAE,KAAK,EAAE,QAAQ,GAAG,CAAC,IAAI,EAAE,wDAAwD;oBACpF,oFAAoF;oBACpF,2EAA2E;oBAC3E,YAAY,GAAG,CAAC,IAAI,EAAE,yDAAyD;oBAC/E,sBAAsB,CACzB,CAAC;YACJ,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACjC,OAAO;QACT,CAAC;QACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,aAAa,CAAE,GAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1F,MAAM,IAAI,KAAK,CACb,GAAG,EAAE,KAAK,EAAE,+DAA+D;gBACzE,kFAAkF;gBAClF,gBAAgB,CACnB,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,GAAmB,CAAC;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,IAAI,GAAG,KAAK,SAAS,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CACb,GAAG,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,gDAAgD;gBAChF,2BAA2B,CAC9B,CAAC;QACJ,CAAC;QACD,IAAI,UAAU,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,GAAG,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,iDAAiD;gBACjF,kFAAkF;gBAClF,wCAAwC,CAC3C,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IACxF,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;8DAE8D;AAC9D,MAAM,UAAU,QAAQ,CAAC,CAAe,EAAE,CAAe;IACvD,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED;2EAC2E;AAC3E,MAAM,UAAU,UAAU,CAAC,KAA6C;IACtE,MAAM,GAAG,GAAmB,EAAE,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ledger — what a clean result does NOT rule out.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: a wrapper the framework recognizes, minted by a helper (the
|
|
5
|
+
* `absent()` shape one level up: same vocabulary, different claim).
|
|
6
|
+
* Role: core/ layer, pure. `coverage()` is what a tool author writes;
|
|
7
|
+
* `readCoverageLedger` is what the dispatch loop calls.
|
|
8
|
+
* Emits: N/A (the caller emits `agentfootprint.tools.coverage_declared`).
|
|
9
|
+
*
|
|
10
|
+
* ## The problem, stated as narrowly as it deserves
|
|
11
|
+
*
|
|
12
|
+
* An agent answers confidently from partial coverage. "Everything looks fine"
|
|
13
|
+
* is produced from four checks that passed, and arrives with no way to tell
|
|
14
|
+
* whether *fine* means **verified** or **unexamined** — whether the fifth
|
|
15
|
+
* thing was healthy or was never looked at. The evidence gate (9.35.0) is the
|
|
16
|
+
* sibling of this: the gate catches invented VALUES, this catches unstated
|
|
17
|
+
* LIMITS. Both are ways an answer can be false while every token in it is
|
|
18
|
+
* real.
|
|
19
|
+
*
|
|
20
|
+
* A ledger is not a caveat and not a disclaimer. It is three lists the TOOL
|
|
21
|
+
* knows and the model does not: what it checked, what it did not check, and
|
|
22
|
+
* what it can never cover. Only the tool knows the third one, which is why
|
|
23
|
+
* this cannot be prompt engineering.
|
|
24
|
+
*
|
|
25
|
+
* ## Why the wrapper, and not a field on the result
|
|
26
|
+
*
|
|
27
|
+
* The alternative — teaching the framework to read a `coverage` key off any
|
|
28
|
+
* returned object — would make every domain object that happens to have one
|
|
29
|
+
* change behavior. The wrapper is opt-in by construction: `coverage(x, …)`
|
|
30
|
+
* produces a shape that did not exist before, so nothing that ever ran can
|
|
31
|
+
* become a ledger by accident. Same argument as the effects envelope's strict
|
|
32
|
+
* recognizer, same guarantee.
|
|
33
|
+
*/
|
|
34
|
+
import type { Coverage, CoverageDeclaration, CoveredResult } from './types.js';
|
|
35
|
+
/** The reserved key that makes a ledger recognizable. */
|
|
36
|
+
export declare const COVERAGE_MARKER = "af_coverage";
|
|
37
|
+
/**
|
|
38
|
+
* The static sentence every ledger carries. The last clause is the OFFER half
|
|
39
|
+
* of survival — the model is told to carry the limits into its answer. The
|
|
40
|
+
* ENFORCEMENT half (`.limitsTravelWithTheAnswer()`) does not depend on the
|
|
41
|
+
* model obeying it; see `answer.ts` for why both exist.
|
|
42
|
+
*/
|
|
43
|
+
export declare const COVERAGE_NOTE: string;
|
|
44
|
+
/**
|
|
45
|
+
* Return a verdict with its own boundary attached.
|
|
46
|
+
*
|
|
47
|
+
* The model reads `{ af_coverage: {…}, result: <your value> }` — boundary
|
|
48
|
+
* first, deliberately: a limit placed after a long result is a limit that gets
|
|
49
|
+
* skimmed past. The framework records the ledger and, with
|
|
50
|
+
* `.limitsTravelWithTheAnswer()` configured, appends it to the run's final
|
|
51
|
+
* answer where the model cannot drop it.
|
|
52
|
+
*
|
|
53
|
+
* @example the highest-stakes tool in a triage agent
|
|
54
|
+
* defineTool({
|
|
55
|
+
* name: 'replication_health',
|
|
56
|
+
* description: 'Replication health across the estate',
|
|
57
|
+
* inputSchema: { type: 'object', properties: {} },
|
|
58
|
+
* execute: async () => {
|
|
59
|
+
* const { verdict, ndmTimedOut } = await checkReplication();
|
|
60
|
+
* return coverage(verdict, {
|
|
61
|
+
* checked: ['SRDF pair state on all 4 arrays (live query)'],
|
|
62
|
+
* notChecked: ndmTimedOut
|
|
63
|
+
* ? [{ what: 'NDM migration sessions', why: 'the API timed out — ask again' }]
|
|
64
|
+
* : [],
|
|
65
|
+
* cannotCover: [
|
|
66
|
+
* { what: 'host-side multipathing', why: 'no collector runs on the ESX hosts' },
|
|
67
|
+
* ],
|
|
68
|
+
* });
|
|
69
|
+
* },
|
|
70
|
+
* });
|
|
71
|
+
*/
|
|
72
|
+
export declare function coverage<T>(content: T, decl: CoverageDeclaration): CoveredResult<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Recognize (or decline to recognize) a value as a covered result. STRICT for
|
|
75
|
+
* the same reason `readAbsence` is: only a plain object carrying a plain
|
|
76
|
+
* `af_coverage` object AND a `result` key qualifies.
|
|
77
|
+
*/
|
|
78
|
+
export declare function readCoverageLedger(value: unknown): CoveredResult | undefined;
|
|
79
|
+
/** The ledger's coverage, in the normalized three-list shape. */
|
|
80
|
+
export declare function coverageOfLedger(covered: CoveredResult): Coverage;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ledger — what a clean result does NOT rule out.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: a wrapper the framework recognizes, minted by a helper (the
|
|
5
|
+
* `absent()` shape one level up: same vocabulary, different claim).
|
|
6
|
+
* Role: core/ layer, pure. `coverage()` is what a tool author writes;
|
|
7
|
+
* `readCoverageLedger` is what the dispatch loop calls.
|
|
8
|
+
* Emits: N/A (the caller emits `agentfootprint.tools.coverage_declared`).
|
|
9
|
+
*
|
|
10
|
+
* ## The problem, stated as narrowly as it deserves
|
|
11
|
+
*
|
|
12
|
+
* An agent answers confidently from partial coverage. "Everything looks fine"
|
|
13
|
+
* is produced from four checks that passed, and arrives with no way to tell
|
|
14
|
+
* whether *fine* means **verified** or **unexamined** — whether the fifth
|
|
15
|
+
* thing was healthy or was never looked at. The evidence gate (9.35.0) is the
|
|
16
|
+
* sibling of this: the gate catches invented VALUES, this catches unstated
|
|
17
|
+
* LIMITS. Both are ways an answer can be false while every token in it is
|
|
18
|
+
* real.
|
|
19
|
+
*
|
|
20
|
+
* A ledger is not a caveat and not a disclaimer. It is three lists the TOOL
|
|
21
|
+
* knows and the model does not: what it checked, what it did not check, and
|
|
22
|
+
* what it can never cover. Only the tool knows the third one, which is why
|
|
23
|
+
* this cannot be prompt engineering.
|
|
24
|
+
*
|
|
25
|
+
* ## Why the wrapper, and not a field on the result
|
|
26
|
+
*
|
|
27
|
+
* The alternative — teaching the framework to read a `coverage` key off any
|
|
28
|
+
* returned object — would make every domain object that happens to have one
|
|
29
|
+
* change behavior. The wrapper is opt-in by construction: `coverage(x, …)`
|
|
30
|
+
* produces a shape that did not exist before, so nothing that ever ran can
|
|
31
|
+
* become a ledger by accident. Same argument as the effects envelope's strict
|
|
32
|
+
* recognizer, same guarantee.
|
|
33
|
+
*/
|
|
34
|
+
import { normalizeCoverageList } from './items.js';
|
|
35
|
+
/** The reserved key that makes a ledger recognizable. */
|
|
36
|
+
export const COVERAGE_MARKER = 'af_coverage';
|
|
37
|
+
/**
|
|
38
|
+
* The static sentence every ledger carries. The last clause is the OFFER half
|
|
39
|
+
* of survival — the model is told to carry the limits into its answer. The
|
|
40
|
+
* ENFORCEMENT half (`.limitsTravelWithTheAnswer()`) does not depend on the
|
|
41
|
+
* model obeying it; see `answer.ts` for why both exist.
|
|
42
|
+
*/
|
|
43
|
+
export const COVERAGE_NOTE = 'This result covers only what `checked` lists. `not_checked` is ground this call did not ' +
|
|
44
|
+
'look at, and `cannot_cover` is ground this tool can never see — a clean result here is ' +
|
|
45
|
+
'NOT evidence about either, and no retry changes `cannot_cover`. Carry these limits into ' +
|
|
46
|
+
'any answer you build on this result.';
|
|
47
|
+
/**
|
|
48
|
+
* Return a verdict with its own boundary attached.
|
|
49
|
+
*
|
|
50
|
+
* The model reads `{ af_coverage: {…}, result: <your value> }` — boundary
|
|
51
|
+
* first, deliberately: a limit placed after a long result is a limit that gets
|
|
52
|
+
* skimmed past. The framework records the ledger and, with
|
|
53
|
+
* `.limitsTravelWithTheAnswer()` configured, appends it to the run's final
|
|
54
|
+
* answer where the model cannot drop it.
|
|
55
|
+
*
|
|
56
|
+
* @example the highest-stakes tool in a triage agent
|
|
57
|
+
* defineTool({
|
|
58
|
+
* name: 'replication_health',
|
|
59
|
+
* description: 'Replication health across the estate',
|
|
60
|
+
* inputSchema: { type: 'object', properties: {} },
|
|
61
|
+
* execute: async () => {
|
|
62
|
+
* const { verdict, ndmTimedOut } = await checkReplication();
|
|
63
|
+
* return coverage(verdict, {
|
|
64
|
+
* checked: ['SRDF pair state on all 4 arrays (live query)'],
|
|
65
|
+
* notChecked: ndmTimedOut
|
|
66
|
+
* ? [{ what: 'NDM migration sessions', why: 'the API timed out — ask again' }]
|
|
67
|
+
* : [],
|
|
68
|
+
* cannotCover: [
|
|
69
|
+
* { what: 'host-side multipathing', why: 'no collector runs on the ESX hosts' },
|
|
70
|
+
* ],
|
|
71
|
+
* });
|
|
72
|
+
* },
|
|
73
|
+
* });
|
|
74
|
+
*/
|
|
75
|
+
export function coverage(content, decl) {
|
|
76
|
+
const fn = 'coverage';
|
|
77
|
+
if (typeof decl !== 'object' || decl === null) {
|
|
78
|
+
throw new Error(`${fn}: takes the result and its boundary — coverage(result, { checked?, notChecked?, ` +
|
|
79
|
+
`cannotCover? }). To return a result with no declared boundary, return it bare.`);
|
|
80
|
+
}
|
|
81
|
+
const checked = normalizeCoverageList(fn, 'checked', decl.checked, false);
|
|
82
|
+
const notChecked = normalizeCoverageList(fn, 'notChecked', decl.notChecked, false);
|
|
83
|
+
const cannotCover = normalizeCoverageList(fn, 'cannotCover', decl.cannotCover, true);
|
|
84
|
+
if (checked.length === 0 && notChecked.length === 0 && cannotCover.length === 0) {
|
|
85
|
+
throw new Error(`${fn}: all three lists are empty, so this ledger declares no boundary at all — it ` +
|
|
86
|
+
`would tell a reader nothing while looking like it did, which is worse than saying ` +
|
|
87
|
+
`nothing. Name what you checked, what you skipped, or what you can never see; or ` +
|
|
88
|
+
`return the result bare.`);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
af_coverage: {
|
|
92
|
+
...(checked.length > 0 && { checked }),
|
|
93
|
+
...(notChecked.length > 0 && { not_checked: notChecked }),
|
|
94
|
+
...(cannotCover.length > 0 && { cannot_cover: cannotCover }),
|
|
95
|
+
note: COVERAGE_NOTE,
|
|
96
|
+
},
|
|
97
|
+
result: content,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Recognize (or decline to recognize) a value as a covered result. STRICT for
|
|
102
|
+
* the same reason `readAbsence` is: only a plain object carrying a plain
|
|
103
|
+
* `af_coverage` object AND a `result` key qualifies.
|
|
104
|
+
*/
|
|
105
|
+
export function readCoverageLedger(value) {
|
|
106
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
107
|
+
return undefined;
|
|
108
|
+
const rec = value;
|
|
109
|
+
const marker = rec[COVERAGE_MARKER];
|
|
110
|
+
if (typeof marker !== 'object' || marker === null || Array.isArray(marker))
|
|
111
|
+
return undefined;
|
|
112
|
+
if (!('result' in rec))
|
|
113
|
+
return undefined;
|
|
114
|
+
return value;
|
|
115
|
+
}
|
|
116
|
+
/** The ledger's coverage, in the normalized three-list shape. */
|
|
117
|
+
export function coverageOfLedger(covered) {
|
|
118
|
+
const m = covered.af_coverage;
|
|
119
|
+
return {
|
|
120
|
+
checked: m.checked ?? [],
|
|
121
|
+
notChecked: m.not_checked ?? [],
|
|
122
|
+
cannotCover: m.cannot_cover ?? [],
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../../../src/core/agent/coverage/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGnD,yDAAyD;AACzD,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GACxB,0FAA0F;IAC1F,yFAAyF;IACzF,0FAA0F;IAC1F,sCAAsC,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,QAAQ,CAAI,OAAU,EAAE,IAAyB;IAC/D,MAAM,EAAE,GAAG,UAAU,CAAC;IACtB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,GAAG,EAAE,kFAAkF;YACrF,gFAAgF,CACnF,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,qBAAqB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACnF,MAAM,WAAW,GAAG,qBAAqB,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACrF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChF,MAAM,IAAI,KAAK,CACb,GAAG,EAAE,+EAA+E;YAClF,oFAAoF;YACpF,kFAAkF;YAClF,yBAAyB,CAC5B,CAAC;IACJ,CAAC;IACD,OAAO;QACL,WAAW,EAAE;YACX,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;YACtC,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;YACzD,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;YAC5D,IAAI,EAAE,aAAa;SACpB;QACD,MAAM,EAAE,OAAO;KAChB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1F,MAAM,GAAG,GAAG,KAAgC,CAAC;IAC7C,MAAM,MAAM,GAAG,GAAG,CAAC,eAAe,CAAC,CAAC;IACpC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC7F,IAAI,CAAC,CAAC,QAAQ,IAAI,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IACzC,OAAO,KAAsB,CAAC;AAChC,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,gBAAgB,CAAC,OAAsB;IACrD,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IAC9B,OAAO;QACL,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE;QACxB,UAAU,EAAE,CAAC,CAAC,WAAW,IAAI,EAAE;QAC/B,WAAW,EAAE,CAAC,CAAC,YAAY,IAAI,EAAE;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* read — the ONE recognizer the tool-dispatch loop calls.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: one reader, every dispatch door (the `applyResultCeiling`
|
|
5
|
+
* precedent). The batch loop and the credential/resume execute
|
|
6
|
+
* boundary both call this at the moment a handler's return lands, so
|
|
7
|
+
* a resumed call declares its coverage exactly as an inline one.
|
|
8
|
+
* Role: core/ layer, pure. Recognition and normalization only — the caller
|
|
9
|
+
* owns the events, the scope write and the delivered status.
|
|
10
|
+
* Emits: N/A.
|
|
11
|
+
*
|
|
12
|
+
* Zero-cost when unused: two `typeof` checks and a key lookup for every
|
|
13
|
+
* result that is neither shape, and `undefined` back. Nothing is emitted,
|
|
14
|
+
* nothing is written, and the value the model reads is the value the tool
|
|
15
|
+
* returned — byte for byte.
|
|
16
|
+
*/
|
|
17
|
+
import type { ToolResultStatus } from '../../../lib/injection-engine/toolOutcome.js';
|
|
18
|
+
import type { Coverage } from './types.js';
|
|
19
|
+
/** One coverage statement found in a result, before the caller stamps it with
|
|
20
|
+
* the call it came from. */
|
|
21
|
+
export interface CoverageFacts {
|
|
22
|
+
readonly kind: 'absence' | 'ledger';
|
|
23
|
+
readonly coverage: Coverage;
|
|
24
|
+
/** Present for `'absence'` — what the search was for. */
|
|
25
|
+
readonly lookedFor?: string;
|
|
26
|
+
}
|
|
27
|
+
/** What one recognized result declares. `undefined` from
|
|
28
|
+
* {@link readCoverageResult} means "neither shape": untouched path. */
|
|
29
|
+
export interface CoverageReading {
|
|
30
|
+
/**
|
|
31
|
+
* The status the framework DELIVERS for this call. `'absent'` when an
|
|
32
|
+
* absence is in play — never `'failure'`, and that is the point: a status
|
|
33
|
+
* of `'failure'` would route an honest empty answer down the same edge as
|
|
34
|
+
* a broken collector, which is the exact confusion the primitive removes.
|
|
35
|
+
* Undefined for a bare ledger — a ledger says nothing about the outcome,
|
|
36
|
+
* only about its boundary.
|
|
37
|
+
*/
|
|
38
|
+
readonly status?: ToolResultStatus;
|
|
39
|
+
/** In declaration order: the outer ledger first, then the absence it
|
|
40
|
+
* wraps. Usually one entry; two only when an author bounded an absence. */
|
|
41
|
+
readonly declared: readonly CoverageFacts[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Read one finalized tool result for coverage declarations.
|
|
45
|
+
*
|
|
46
|
+
* The two shapes compose: `coverage(absent({…}), {…})` is a search that found
|
|
47
|
+
* nothing AND a boundary around the search, so both are declared and the
|
|
48
|
+
* delivered status is still `'absent'` — the ledger bounds the answer, it
|
|
49
|
+
* does not change what the answer was.
|
|
50
|
+
*/
|
|
51
|
+
export declare function readCoverageResult(value: unknown): CoverageReading | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* read — the ONE recognizer the tool-dispatch loop calls.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: one reader, every dispatch door (the `applyResultCeiling`
|
|
5
|
+
* precedent). The batch loop and the credential/resume execute
|
|
6
|
+
* boundary both call this at the moment a handler's return lands, so
|
|
7
|
+
* a resumed call declares its coverage exactly as an inline one.
|
|
8
|
+
* Role: core/ layer, pure. Recognition and normalization only — the caller
|
|
9
|
+
* owns the events, the scope write and the delivered status.
|
|
10
|
+
* Emits: N/A.
|
|
11
|
+
*
|
|
12
|
+
* Zero-cost when unused: two `typeof` checks and a key lookup for every
|
|
13
|
+
* result that is neither shape, and `undefined` back. Nothing is emitted,
|
|
14
|
+
* nothing is written, and the value the model reads is the value the tool
|
|
15
|
+
* returned — byte for byte.
|
|
16
|
+
*/
|
|
17
|
+
import { coverageOfAbsence, readAbsence } from './absent.js';
|
|
18
|
+
import { coverageOfLedger, readCoverageLedger } from './ledger.js';
|
|
19
|
+
const ABSENT_STATUS = 'absent';
|
|
20
|
+
/**
|
|
21
|
+
* Read one finalized tool result for coverage declarations.
|
|
22
|
+
*
|
|
23
|
+
* The two shapes compose: `coverage(absent({…}), {…})` is a search that found
|
|
24
|
+
* nothing AND a boundary around the search, so both are declared and the
|
|
25
|
+
* delivered status is still `'absent'` — the ledger bounds the answer, it
|
|
26
|
+
* does not change what the answer was.
|
|
27
|
+
*/
|
|
28
|
+
export function readCoverageResult(value) {
|
|
29
|
+
const absence = readAbsence(value);
|
|
30
|
+
if (absence !== undefined) {
|
|
31
|
+
return {
|
|
32
|
+
status: ABSENT_STATUS,
|
|
33
|
+
declared: [
|
|
34
|
+
{ kind: 'absence', coverage: coverageOfAbsence(absence), lookedFor: absence.looked_for },
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const covered = readCoverageLedger(value);
|
|
39
|
+
if (covered === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
const declared = [{ kind: 'ledger', coverage: coverageOfLedger(covered) }];
|
|
42
|
+
const inner = readAbsence(covered.result);
|
|
43
|
+
if (inner === undefined)
|
|
44
|
+
return { declared };
|
|
45
|
+
declared.push({
|
|
46
|
+
kind: 'absence',
|
|
47
|
+
coverage: coverageOfAbsence(inner),
|
|
48
|
+
lookedFor: inner.looked_for,
|
|
49
|
+
});
|
|
50
|
+
return { status: ABSENT_STATUS, declared };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../../src/core/agent/coverage/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA6BnE,MAAM,aAAa,GAAqB,QAAQ,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO;YACL,MAAM,EAAE,aAAa;YACrB,QAAQ,EAAE;gBACR,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,UAAU,EAAE;aACzF;SACF,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,QAAQ,GAAoB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5F,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAC7C,QAAQ,CAAC,IAAI,CAAC;QACZ,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAClC,SAAS,EAAE,KAAK,CAAC,UAAU;KAC5B,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;AAC7C,CAAC"}
|