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,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy arms — the SUBSTITUTION tier of the counterfactual engine.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: sibling spec type, shared statistics.
|
|
5
|
+
* Role: answer "scorer A versus scorer B", "topK versus a re-ranker",
|
|
6
|
+
* "sliding-window versus token-budget" with the SAME seeded-rerun
|
|
7
|
+
* discipline the ablation tier uses — and without pretending a
|
|
8
|
+
* substitution is a removal.
|
|
9
|
+
*
|
|
10
|
+
* ## Why this is NOT a fifth arm on `AblationSpec`
|
|
11
|
+
*
|
|
12
|
+
* Ablation is REMOVAL. `AblationSpec` names inputs an agent is BUILT from and
|
|
13
|
+
* `applyAblations` filters them out; the ablated agent is strictly smaller than
|
|
14
|
+
* the original. Substitution is REPLACEMENT: the agent that re-ranks instead of
|
|
15
|
+
* taking top-K is not smaller, it is different. Three concrete costs decided
|
|
16
|
+
* this, and each one is a place a shared union would have produced a
|
|
17
|
+
* confident-looking verdict for an incoherent comparison:
|
|
18
|
+
*
|
|
19
|
+
* 1. **`bisectCulprits` would accept it.** The union feeds a delta-debugging
|
|
20
|
+
* search (`bisect.ts`) whose premise is that probes are SUBSETS of removals:
|
|
21
|
+
* it halves the candidate set, probes each half, and returns a "minimal
|
|
22
|
+
* culprit set". Substitutions do not compose that way — swapping the scorer
|
|
23
|
+
* and swapping the window at once is a THIRD arm, not a bigger removal — and
|
|
24
|
+
* the answer it would print ("minimal culprit set = {scorer swap}") is the
|
|
25
|
+
* wrong tier of claim entirely: an arm is an alternative configuration, not
|
|
26
|
+
* a culprit. A type that lets an incoherent comparison reach a verdict is
|
|
27
|
+
* worse than the limitation it removes.
|
|
28
|
+
* 2. **`rerunWithoutSources` would report it under `removed`.** Its result
|
|
29
|
+
* type, its `removableSources` vocabulary and every sentence it composes say
|
|
30
|
+
* "removing X". A substitution arriving through its `ignore` escape hatch
|
|
31
|
+
* would be described, in a field NAME, as something it is not.
|
|
32
|
+
* 3. **`applyAblations` has nowhere to put it.** It returns filtered
|
|
33
|
+
* `{tools, injections, memoryEntries}`. A substitution is not a filter of
|
|
34
|
+
* those inputs; it is a construction choice made before they exist.
|
|
35
|
+
*
|
|
36
|
+
* The rejected third option — a `'strategy'` arm that genuinely ABLATES, i.e.
|
|
37
|
+
* falls back to the library default — was rejected because "no retrieval at
|
|
38
|
+
* all" and "re-rank instead of top-K" are different experiments and only the
|
|
39
|
+
* second is what a researcher means. The manifest already treats `memories: []`
|
|
40
|
+
* as an arm of its own; an arm that silently meant "the default" would answer a
|
|
41
|
+
* question nobody asked while looking like it supported the one they did.
|
|
42
|
+
*
|
|
43
|
+
* So: sibling TYPE, shared STATISTICS. `AblationRunStats`, `SimilarityStats`,
|
|
44
|
+
* `resolveSamples`, `similarityStats`, `costStatsFrom`, `probeFlipped` and
|
|
45
|
+
* `defaultOutcomeComparator` are reused verbatim; nothing in `ablation.ts`,
|
|
46
|
+
* `bisect.ts`, `rerun.ts` or `cost.ts` changed, so the four existing spec arms
|
|
47
|
+
* behave identically (pinned by test/lib/context-bisect/ablation-union-pinned).
|
|
48
|
+
*
|
|
49
|
+
* ## What the library can and cannot DO with an arm
|
|
50
|
+
*
|
|
51
|
+
* For a removal the library can perform the intervention: `applyAblations`
|
|
52
|
+
* filters the inputs. For a substitution it cannot — construction is the
|
|
53
|
+
* consumer's code, and no library can reach into it and replace a scorer. What
|
|
54
|
+
* it can do instead is DECLARE the arm and then VERIFY it took effect, because
|
|
55
|
+
* 9.41.0 made configuration self-describing: `agentfootprint.agent.run_configured`
|
|
56
|
+
* names the provider, model, react mode, window, each memory's strategy /
|
|
57
|
+
* retrieval / embedder, the graph's posture and classifier, and the evidence
|
|
58
|
+
* posture. {@link ArmFacets} is deliberately that same vocabulary, so a run's
|
|
59
|
+
* own manifest — not the experimenter's bookkeeping — says which arm it belonged
|
|
60
|
+
* to, and an arm whose runs contradict its declaration gets no verdict at all.
|
|
61
|
+
*
|
|
62
|
+
* An arm may ALSO carry `ablations`: removals ride inside an arm through the
|
|
63
|
+
* unchanged removal machinery (`applyArm` → `applyAblations`). Composition, not
|
|
64
|
+
* union — each type still means exactly one thing.
|
|
65
|
+
*/
|
|
66
|
+
import type { Embedder } from '../../influence-core/index.js';
|
|
67
|
+
import type { AblationRunStats, AblationSpec, AblationVerdict, OutcomeComparator, RunCost, SimilarityStats } from '../types.js';
|
|
68
|
+
/**
|
|
69
|
+
* One mounted memory as the run manifest describes it — structurally satisfied
|
|
70
|
+
* by `RunConfiguredMemoryPayload`.
|
|
71
|
+
*/
|
|
72
|
+
export interface ManifestMemoryLike {
|
|
73
|
+
readonly id?: string;
|
|
74
|
+
readonly type?: string;
|
|
75
|
+
readonly strategy?: string;
|
|
76
|
+
readonly retrieval?: string;
|
|
77
|
+
readonly embedderId?: string;
|
|
78
|
+
readonly flavor?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The run-configuration manifest, structurally — satisfied by
|
|
82
|
+
* `AgentRunConfiguredPayload` (the payload of
|
|
83
|
+
* `agentfootprint.agent.run_configured`, 9.41.0).
|
|
84
|
+
*
|
|
85
|
+
* Declared structurally, and every member optional, for the same reason
|
|
86
|
+
* `CapturedEventLike` and `QualityTriggerLookup` are: `context-bisect` is a
|
|
87
|
+
* LEAF. It must not import the event registry to read one payload, and a
|
|
88
|
+
* consumer replaying manifests out of a saved recording must be able to hand in
|
|
89
|
+
* any bag shaped like this.
|
|
90
|
+
*/
|
|
91
|
+
export interface RunManifestLike {
|
|
92
|
+
readonly agentId?: string;
|
|
93
|
+
readonly llm?: {
|
|
94
|
+
readonly provider?: string;
|
|
95
|
+
readonly model?: string;
|
|
96
|
+
};
|
|
97
|
+
readonly reactMode?: string;
|
|
98
|
+
readonly memories?: readonly ManifestMemoryLike[];
|
|
99
|
+
readonly window?: string;
|
|
100
|
+
readonly skillGraph?: {
|
|
101
|
+
readonly routing?: string;
|
|
102
|
+
readonly continuity?: string;
|
|
103
|
+
readonly scorer?: string;
|
|
104
|
+
};
|
|
105
|
+
readonly evidenceGate?: string;
|
|
106
|
+
}
|
|
107
|
+
/** The memory facet of an arm — matched against the manifest's memory rows. */
|
|
108
|
+
export interface ArmMemoryFacet {
|
|
109
|
+
/** Narrow the match to ONE mounted memory by `defineMemory({ id })`. Without
|
|
110
|
+
* it, ANY mounted memory satisfying the other fields counts as a match. */
|
|
111
|
+
readonly id?: string;
|
|
112
|
+
readonly type?: string;
|
|
113
|
+
/** The compiled strategy KIND (`'window'`, `'topK'`, …). */
|
|
114
|
+
readonly strategy?: string;
|
|
115
|
+
/** `RetrievalStrategy.name` — the spelled-out retrieval rule. This is the
|
|
116
|
+
* field a "topK versus re-rank" study varies. */
|
|
117
|
+
readonly retrieval?: string;
|
|
118
|
+
readonly embedderId?: string;
|
|
119
|
+
readonly flavor?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* What ONE arm holds constant, in the vocabulary the run manifest speaks.
|
|
123
|
+
*
|
|
124
|
+
* Every field here has a counterpart in `AgentRunConfiguredPayload`, and that
|
|
125
|
+
* is the whole point: a facet a consumer declares is a facet the engine can
|
|
126
|
+
* CHECK against the run that actually happened. A configuration difference the
|
|
127
|
+
* manifest cannot name (a prompt tweak, a temperature) is not expressible here
|
|
128
|
+
* on purpose — declaring it would produce an arm label nothing can verify.
|
|
129
|
+
*/
|
|
130
|
+
export interface ArmFacets {
|
|
131
|
+
/** `LLMProvider.name` of the effective provider. */
|
|
132
|
+
readonly provider?: string;
|
|
133
|
+
readonly model?: string;
|
|
134
|
+
readonly reactMode?: 'classic' | 'dynamic' | 'dynamic-grouped';
|
|
135
|
+
/** `WindowStrategy.name` — the "sliding-window versus token-budget" axis. */
|
|
136
|
+
readonly window?: string;
|
|
137
|
+
/** `IntentScorer.name` — the "scorer A versus scorer B" axis. */
|
|
138
|
+
readonly scorer?: string;
|
|
139
|
+
readonly routing?: 'assist' | 'guard' | 'rails';
|
|
140
|
+
readonly continuity?: 'turn' | 'conversation';
|
|
141
|
+
readonly evidenceGate?: 'assist' | 'guard' | 'rails';
|
|
142
|
+
readonly memory?: ArmMemoryFacet;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* One configuration under test.
|
|
146
|
+
*
|
|
147
|
+
* `facets` is what the run manifest should say about this arm; `ablations` is
|
|
148
|
+
* anything this arm additionally REMOVES, applied by the unchanged removal
|
|
149
|
+
* machinery (`applyArm`). An arm needs at least one of the two — except the
|
|
150
|
+
* baseline arm, which may declare nothing at all and mean "the configuration as
|
|
151
|
+
* it stands".
|
|
152
|
+
*/
|
|
153
|
+
export interface StrategyArm {
|
|
154
|
+
/** Stable label. Appears in every verdict sentence and keys the readout. */
|
|
155
|
+
readonly id: string;
|
|
156
|
+
readonly facets?: ArmFacets;
|
|
157
|
+
/** Removals this arm also applies — the four `AblationSpec` kinds, unchanged. */
|
|
158
|
+
readonly ablations?: readonly AblationSpec[];
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* What one seeded run of one arm reported back.
|
|
162
|
+
*
|
|
163
|
+
* `manifest` is the connection to 9.41.0: capture it with
|
|
164
|
+
* `agent.on('agentfootprint.agent.run_configured', e => …)` inside the runner
|
|
165
|
+
* (or hand the run's captured events to `manifestFromEvents`). Supplying it
|
|
166
|
+
* turns "the experimenter says this run was arm B" into a checked fact.
|
|
167
|
+
*/
|
|
168
|
+
export interface ArmRunResult {
|
|
169
|
+
readonly output: string;
|
|
170
|
+
readonly cost?: RunCost;
|
|
171
|
+
readonly manifest?: RunManifestLike;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Consumer-supplied arm runner: BUILD the agent under `arm`'s configuration,
|
|
175
|
+
* run the same scenario, return the output.
|
|
176
|
+
*
|
|
177
|
+
* The engine takes a factory, not an instance — the same shape `AblationRunner`
|
|
178
|
+
* already has, and the reason a strategy comparison fits here at all. Contract,
|
|
179
|
+
* identical in spirit to `AblationRunner`:
|
|
180
|
+
* - `run.seed` varies 0..N-1 within ONE arm. Thread it into any stochastic
|
|
181
|
+
* knob so reruns are deterministic-but-distinct.
|
|
182
|
+
* - Build a FRESH agent/provider per call (scripted mock providers are
|
|
183
|
+
* stateful).
|
|
184
|
+
* - Apply `arm.ablations` with `applyArm` at construction.
|
|
185
|
+
* - Returning a bare string is fine; the object form additionally unlocks the
|
|
186
|
+
* cost readout and the manifest check.
|
|
187
|
+
*/
|
|
188
|
+
export type ArmRunner = (arm: StrategyArm, run: {
|
|
189
|
+
readonly seed: number;
|
|
190
|
+
}) => Promise<string | ArmRunResult>;
|
|
191
|
+
/** One declared facet the run manifest contradicted. */
|
|
192
|
+
export interface ArmFacetMismatch {
|
|
193
|
+
/** Dotted facet path — `'model'`, `'memory.retrieval'`, `'skillGraph.scorer'`. */
|
|
194
|
+
readonly facet: string;
|
|
195
|
+
readonly declared: string;
|
|
196
|
+
/** What the manifest said. ABSENT means the manifest did not declare that
|
|
197
|
+
* field at all — which, per the manifest's own rule, means "not configured"
|
|
198
|
+
* and is therefore still a contradiction of a declared arm. */
|
|
199
|
+
readonly observed?: string;
|
|
200
|
+
}
|
|
201
|
+
/** Did the arm the consumer DECLARED match the runs that actually happened? */
|
|
202
|
+
export interface ArmApplication {
|
|
203
|
+
/** How many of this arm's seeded runs reported a manifest. */
|
|
204
|
+
readonly manifestsSeen: number;
|
|
205
|
+
/**
|
|
206
|
+
* The declared facets were really compared against a manifest. FALSE when the
|
|
207
|
+
* runner reported none, or when the arm declares only `ablations` (no
|
|
208
|
+
* manifest names a tool catalog). Read this BEFORE `applied`.
|
|
209
|
+
*/
|
|
210
|
+
readonly checked: boolean;
|
|
211
|
+
/** Every seen manifest agreed with every declared facet. Meaningless when
|
|
212
|
+
* `checked` is false. */
|
|
213
|
+
readonly applied: boolean;
|
|
214
|
+
readonly mismatches: readonly ArmFacetMismatch[];
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The inert-intervention control for an arm comparison.
|
|
218
|
+
*
|
|
219
|
+
* The cost tier's leave-one-out placebo does NOT transfer: it works by holding
|
|
220
|
+
* out one member of a POPULATION of peer suspects, and a comparison of two arms
|
|
221
|
+
* has no such population — leaving an arm out leaves an experiment, not a
|
|
222
|
+
* control. What does transfer is the placebo IDEA, in a stronger form: the
|
|
223
|
+
* inert intervention is RE-RUNNING THE SAME CONFIGURATION, and the engine
|
|
224
|
+
* already pays for it (the baseline arm's own seeded runs). Its similarity
|
|
225
|
+
* spread against the reference is the null distribution a challenger must fall
|
|
226
|
+
* outside of; `floor` is the strictest point of it.
|
|
227
|
+
*
|
|
228
|
+
* Two axes, two controls, and they are not interchangeable:
|
|
229
|
+
* - the COMPARATOR axis's control is the baseline arm's own flip count, which
|
|
230
|
+
* must be ZERO (the stability gate — same zero-tolerance rule `bisect.ts`
|
|
231
|
+
* and `localize.ts` use);
|
|
232
|
+
* - the SIMILARITY axis's control is this band.
|
|
233
|
+
* The band only participates in a verdict when the flip comparator IS the
|
|
234
|
+
* similarity comparator (`gates`). With a domain comparator the two axes are
|
|
235
|
+
* different instruments, and vetoing a genuine decision flip with an embedding
|
|
236
|
+
* statistic would suppress a true finding — so it is reported and not applied.
|
|
237
|
+
*/
|
|
238
|
+
export interface NullBand {
|
|
239
|
+
readonly baselineArmId: string;
|
|
240
|
+
/** The baseline arm's own similarity to the reference across its seeds. */
|
|
241
|
+
readonly similarity: SimilarityStats;
|
|
242
|
+
/** The floor a challenger's mean similarity must fall BELOW to be
|
|
243
|
+
* distinguishable from seed-to-seed noise (`similarity.min`). */
|
|
244
|
+
readonly floor: number;
|
|
245
|
+
/** The baseline reproduced EXACTLY on every seed (zero spread). The band is
|
|
246
|
+
* then a hard floor that any change clears — honest for a deterministic
|
|
247
|
+
* scenario, and only as strong as that determinism (a mock provider is
|
|
248
|
+
* reproducible in a way a real one is not). */
|
|
249
|
+
readonly degenerate: boolean;
|
|
250
|
+
/** The band participated in the verdicts (default comparator only). */
|
|
251
|
+
readonly gates: boolean;
|
|
252
|
+
/** Plain-language recap. PRESENTATION ONLY — read the fields as data. */
|
|
253
|
+
readonly note: string;
|
|
254
|
+
}
|
|
255
|
+
/** One arm's evidence. */
|
|
256
|
+
export interface ArmOutcome {
|
|
257
|
+
readonly armId: string;
|
|
258
|
+
readonly isBaseline: boolean;
|
|
259
|
+
/** The same per-probe statistics the ablation tier reports (samples, flips,
|
|
260
|
+
* similarity mean/min/max/stdev, and `cost` when the runner reported one). */
|
|
261
|
+
readonly runs: AblationRunStats;
|
|
262
|
+
/** Every seeded answer, in seed order. */
|
|
263
|
+
readonly answers: readonly string[];
|
|
264
|
+
/** Mean similarity to the reference fell below the null band's floor. Always
|
|
265
|
+
* false for the baseline arm — an arm cannot be outside its own band. */
|
|
266
|
+
readonly outsideNullBand: boolean;
|
|
267
|
+
readonly application: ArmApplication;
|
|
268
|
+
/**
|
|
269
|
+
* The CAUSAL-tier claim for this arm versus the baseline arm. Absent on the
|
|
270
|
+
* baseline arm itself (it is the reference, not a challenger).
|
|
271
|
+
*/
|
|
272
|
+
readonly verdict?: AblationVerdict;
|
|
273
|
+
}
|
|
274
|
+
/** The finished comparison. */
|
|
275
|
+
export interface StrategyComparison {
|
|
276
|
+
/**
|
|
277
|
+
* The answer every arm's similarity and flip count was measured against.
|
|
278
|
+
* `'prior-run'` — the caller's `originalAnswer`, i.e. the run that actually
|
|
279
|
+
* happened. `'baseline-arm'` — no prior answer was supplied, so the baseline
|
|
280
|
+
* arm's seed-0 answer became the reference; that seed then contributes a
|
|
281
|
+
* trivially identical comparison and stability rests on the remaining N−1.
|
|
282
|
+
*/
|
|
283
|
+
readonly reference: {
|
|
284
|
+
readonly from: 'prior-run' | 'baseline-arm';
|
|
285
|
+
readonly text: string;
|
|
286
|
+
};
|
|
287
|
+
readonly baselineArmId: string;
|
|
288
|
+
/** The baseline arm reproduced the reference on EVERY seed. False ⇒ every
|
|
289
|
+
* verdict is `'inconclusive'`; nothing is trustworthy on an unstable
|
|
290
|
+
* scenario. */
|
|
291
|
+
readonly baselineStable: boolean;
|
|
292
|
+
readonly nullBand: NullBand;
|
|
293
|
+
/** One row per arm, declaration order, baseline included. */
|
|
294
|
+
readonly arms: readonly ArmOutcome[];
|
|
295
|
+
/** Consumer-runner invocations spent (`samples × arms`). */
|
|
296
|
+
readonly runsUsed: number;
|
|
297
|
+
/** Plain-language recap. PRESENTATION ONLY — read the fields as data. */
|
|
298
|
+
readonly summary: string;
|
|
299
|
+
}
|
|
300
|
+
export interface CompareStrategyArmsOptions {
|
|
301
|
+
/** At least two, distinct, each non-baseline arm declaring something. */
|
|
302
|
+
readonly arms: readonly StrategyArm[];
|
|
303
|
+
readonly runner: ArmRunner;
|
|
304
|
+
/** Embedder for the similarity readout, the null band and the default
|
|
305
|
+
* comparator. `mockEmbedder()` is fine offline. */
|
|
306
|
+
readonly embedder: Embedder;
|
|
307
|
+
/** Which arm is the incumbent. Default: the first arm. */
|
|
308
|
+
readonly baselineArmId?: string;
|
|
309
|
+
/** The answer the run that actually happened produced. Omit for a fresh A/B
|
|
310
|
+
* — the baseline arm's seed-0 answer becomes the reference. */
|
|
311
|
+
readonly originalAnswer?: string;
|
|
312
|
+
/** Seeded runs PER ARM. Default 3; clamped to ≥ 2 (never single-run claims). */
|
|
313
|
+
readonly samples?: number;
|
|
314
|
+
/** Did the answer CHANGE? Default: embedding similarity < `flipThreshold`.
|
|
315
|
+
* Passing one turns the null band OFF as a gate (see {@link NullBand}). */
|
|
316
|
+
readonly answerChanged?: OutcomeComparator;
|
|
317
|
+
/** Similarity floor for the DEFAULT comparator. Default 0.8. */
|
|
318
|
+
readonly flipThreshold?: number;
|
|
319
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy arms — the SUBSTITUTION tier of the counterfactual engine.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: sibling spec type, shared statistics.
|
|
5
|
+
* Role: answer "scorer A versus scorer B", "topK versus a re-ranker",
|
|
6
|
+
* "sliding-window versus token-budget" with the SAME seeded-rerun
|
|
7
|
+
* discipline the ablation tier uses — and without pretending a
|
|
8
|
+
* substitution is a removal.
|
|
9
|
+
*
|
|
10
|
+
* ## Why this is NOT a fifth arm on `AblationSpec`
|
|
11
|
+
*
|
|
12
|
+
* Ablation is REMOVAL. `AblationSpec` names inputs an agent is BUILT from and
|
|
13
|
+
* `applyAblations` filters them out; the ablated agent is strictly smaller than
|
|
14
|
+
* the original. Substitution is REPLACEMENT: the agent that re-ranks instead of
|
|
15
|
+
* taking top-K is not smaller, it is different. Three concrete costs decided
|
|
16
|
+
* this, and each one is a place a shared union would have produced a
|
|
17
|
+
* confident-looking verdict for an incoherent comparison:
|
|
18
|
+
*
|
|
19
|
+
* 1. **`bisectCulprits` would accept it.** The union feeds a delta-debugging
|
|
20
|
+
* search (`bisect.ts`) whose premise is that probes are SUBSETS of removals:
|
|
21
|
+
* it halves the candidate set, probes each half, and returns a "minimal
|
|
22
|
+
* culprit set". Substitutions do not compose that way — swapping the scorer
|
|
23
|
+
* and swapping the window at once is a THIRD arm, not a bigger removal — and
|
|
24
|
+
* the answer it would print ("minimal culprit set = {scorer swap}") is the
|
|
25
|
+
* wrong tier of claim entirely: an arm is an alternative configuration, not
|
|
26
|
+
* a culprit. A type that lets an incoherent comparison reach a verdict is
|
|
27
|
+
* worse than the limitation it removes.
|
|
28
|
+
* 2. **`rerunWithoutSources` would report it under `removed`.** Its result
|
|
29
|
+
* type, its `removableSources` vocabulary and every sentence it composes say
|
|
30
|
+
* "removing X". A substitution arriving through its `ignore` escape hatch
|
|
31
|
+
* would be described, in a field NAME, as something it is not.
|
|
32
|
+
* 3. **`applyAblations` has nowhere to put it.** It returns filtered
|
|
33
|
+
* `{tools, injections, memoryEntries}`. A substitution is not a filter of
|
|
34
|
+
* those inputs; it is a construction choice made before they exist.
|
|
35
|
+
*
|
|
36
|
+
* The rejected third option — a `'strategy'` arm that genuinely ABLATES, i.e.
|
|
37
|
+
* falls back to the library default — was rejected because "no retrieval at
|
|
38
|
+
* all" and "re-rank instead of top-K" are different experiments and only the
|
|
39
|
+
* second is what a researcher means. The manifest already treats `memories: []`
|
|
40
|
+
* as an arm of its own; an arm that silently meant "the default" would answer a
|
|
41
|
+
* question nobody asked while looking like it supported the one they did.
|
|
42
|
+
*
|
|
43
|
+
* So: sibling TYPE, shared STATISTICS. `AblationRunStats`, `SimilarityStats`,
|
|
44
|
+
* `resolveSamples`, `similarityStats`, `costStatsFrom`, `probeFlipped` and
|
|
45
|
+
* `defaultOutcomeComparator` are reused verbatim; nothing in `ablation.ts`,
|
|
46
|
+
* `bisect.ts`, `rerun.ts` or `cost.ts` changed, so the four existing spec arms
|
|
47
|
+
* behave identically (pinned by test/lib/context-bisect/ablation-union-pinned).
|
|
48
|
+
*
|
|
49
|
+
* ## What the library can and cannot DO with an arm
|
|
50
|
+
*
|
|
51
|
+
* For a removal the library can perform the intervention: `applyAblations`
|
|
52
|
+
* filters the inputs. For a substitution it cannot — construction is the
|
|
53
|
+
* consumer's code, and no library can reach into it and replace a scorer. What
|
|
54
|
+
* it can do instead is DECLARE the arm and then VERIFY it took effect, because
|
|
55
|
+
* 9.41.0 made configuration self-describing: `agentfootprint.agent.run_configured`
|
|
56
|
+
* names the provider, model, react mode, window, each memory's strategy /
|
|
57
|
+
* retrieval / embedder, the graph's posture and classifier, and the evidence
|
|
58
|
+
* posture. {@link ArmFacets} is deliberately that same vocabulary, so a run's
|
|
59
|
+
* own manifest — not the experimenter's bookkeeping — says which arm it belonged
|
|
60
|
+
* to, and an arm whose runs contradict its declaration gets no verdict at all.
|
|
61
|
+
*
|
|
62
|
+
* An arm may ALSO carry `ablations`: removals ride inside an arm through the
|
|
63
|
+
* unchanged removal machinery (`applyArm` → `applyAblations`). Composition, not
|
|
64
|
+
* union — each type still means exactly one thing.
|
|
65
|
+
*/
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/lib/context-bisect/arms/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arm validation — the teaching refusals.
|
|
3
|
+
*
|
|
4
|
+
* Every refusal here fires BEFORE a single model call. That is the whole design
|
|
5
|
+
* rule: an incoherent comparison must cost nothing. The engine's other refusals
|
|
6
|
+
* (an unstable baseline, an arm that did not take effect) can only be known
|
|
7
|
+
* after the runs, and those refuse a VERDICT rather than throw — refusing after
|
|
8
|
+
* spending N model calls would be hostile. These six can be known from the
|
|
9
|
+
* declaration alone, so they throw.
|
|
10
|
+
*/
|
|
11
|
+
import type { ArmFacets, StrategyArm } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* A canonical key for one arm's CONFIGURATION (facets + removals), used only to
|
|
14
|
+
* detect two arms that are secretly the same arm. Hand-rolled rather than
|
|
15
|
+
* `JSON.stringify` because key order in an object literal is authoring
|
|
16
|
+
* accident, and two arms written `{model, scorer}` and `{scorer, model}` are
|
|
17
|
+
* the same arm.
|
|
18
|
+
*/
|
|
19
|
+
export declare function armConfigKey(arm: StrategyArm): string;
|
|
20
|
+
/** How many facet leaves an arm declares — 0 means it names no configuration. */
|
|
21
|
+
export declare function declaredFacetCount(facets: ArmFacets | undefined): number;
|
|
22
|
+
/**
|
|
23
|
+
* Refuse every comparison that cannot mean anything, and resolve which arm is
|
|
24
|
+
* the incumbent. Returns the resolved baseline arm id.
|
|
25
|
+
*/
|
|
26
|
+
export declare function validateStrategyArms(arms: readonly StrategyArm[], baselineArmId: string | undefined): string;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arm validation — the teaching refusals.
|
|
3
|
+
*
|
|
4
|
+
* Every refusal here fires BEFORE a single model call. That is the whole design
|
|
5
|
+
* rule: an incoherent comparison must cost nothing. The engine's other refusals
|
|
6
|
+
* (an unstable baseline, an arm that did not take effect) can only be known
|
|
7
|
+
* after the runs, and those refuse a VERDICT rather than throw — refusing after
|
|
8
|
+
* spending N model calls would be hostile. These six can be known from the
|
|
9
|
+
* declaration alone, so they throw.
|
|
10
|
+
*/
|
|
11
|
+
/** Message prefix — every refusal names the door the caller used. */
|
|
12
|
+
const PREFIX = 'compareStrategyArms:';
|
|
13
|
+
/**
|
|
14
|
+
* A canonical key for one arm's CONFIGURATION (facets + removals), used only to
|
|
15
|
+
* detect two arms that are secretly the same arm. Hand-rolled rather than
|
|
16
|
+
* `JSON.stringify` because key order in an object literal is authoring
|
|
17
|
+
* accident, and two arms written `{model, scorer}` and `{scorer, model}` are
|
|
18
|
+
* the same arm.
|
|
19
|
+
*/
|
|
20
|
+
export function armConfigKey(arm) {
|
|
21
|
+
const facets = canonical(arm.facets ?? {});
|
|
22
|
+
const ablations = [...(arm.ablations ?? [])].map(canonical).sort().join('|');
|
|
23
|
+
return `${facets}::${ablations}`;
|
|
24
|
+
}
|
|
25
|
+
/** Stable, sorted, depth-first rendering of a plain value. */
|
|
26
|
+
function canonical(value) {
|
|
27
|
+
if (value === undefined)
|
|
28
|
+
return 'undefined';
|
|
29
|
+
if (value === null || typeof value !== 'object')
|
|
30
|
+
return JSON.stringify(value);
|
|
31
|
+
if (Array.isArray(value)) {
|
|
32
|
+
// Spec arrays (`ignoredTools`, `excludeInjectionIds`) are SETS in meaning —
|
|
33
|
+
// two arms differing only in the order they list two tool names are one arm.
|
|
34
|
+
return `[${value.map(canonical).sort().join(',')}]`;
|
|
35
|
+
}
|
|
36
|
+
const entries = Object.entries(value)
|
|
37
|
+
.filter(([, v]) => v !== undefined)
|
|
38
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
39
|
+
.map(([k, v]) => `${k}:${canonical(v)}`);
|
|
40
|
+
return `{${entries.join(',')}}`;
|
|
41
|
+
}
|
|
42
|
+
/** How many facet leaves an arm declares — 0 means it names no configuration. */
|
|
43
|
+
export function declaredFacetCount(facets) {
|
|
44
|
+
if (facets === undefined)
|
|
45
|
+
return 0;
|
|
46
|
+
let count = 0;
|
|
47
|
+
for (const [key, value] of Object.entries(facets)) {
|
|
48
|
+
if (value === undefined)
|
|
49
|
+
continue;
|
|
50
|
+
if (key === 'memory' && typeof value === 'object') {
|
|
51
|
+
count += Object.values(value).filter((v) => v !== undefined).length;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
count += 1;
|
|
55
|
+
}
|
|
56
|
+
return count;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Refuse every comparison that cannot mean anything, and resolve which arm is
|
|
60
|
+
* the incumbent. Returns the resolved baseline arm id.
|
|
61
|
+
*/
|
|
62
|
+
export function validateStrategyArms(arms, baselineArmId) {
|
|
63
|
+
// 1. A comparison needs two sides. One arm re-run N times is a VARIANCE
|
|
64
|
+
// measurement, and the library already has a door for it.
|
|
65
|
+
if (arms.length < 2) {
|
|
66
|
+
throw new Error(`${PREFIX} a comparison needs at least two arms — got ${arms.length}. To measure one ` +
|
|
67
|
+
`configuration's own run-to-run variance, probe it with runAblationProbe(config, []) ` +
|
|
68
|
+
`instead; to remove a source from one configuration, use rerunWithoutSources.`);
|
|
69
|
+
}
|
|
70
|
+
// 2 + 3. Ids are the readout's primary key and every verdict sentence's
|
|
71
|
+
// subject. A blank or repeated one makes the result unreadable.
|
|
72
|
+
const seen = new Set();
|
|
73
|
+
for (const arm of arms) {
|
|
74
|
+
if (typeof arm.id !== 'string' || arm.id.trim() === '') {
|
|
75
|
+
throw new Error(`${PREFIX} every arm needs a non-empty id — it names the arm in each verdict and keys ` +
|
|
76
|
+
`the readout. Give each configuration a short label ('topK', 'rerank').`);
|
|
77
|
+
}
|
|
78
|
+
if (seen.has(arm.id)) {
|
|
79
|
+
throw new Error(`${PREFIX} two arms share the id '${arm.id}' — arms are reported one row per id, so the ` +
|
|
80
|
+
`second would overwrite the first. Give them distinct labels.`);
|
|
81
|
+
}
|
|
82
|
+
seen.add(arm.id);
|
|
83
|
+
}
|
|
84
|
+
// 4. The incumbent must exist: it is the reference AND the null band.
|
|
85
|
+
const resolved = baselineArmId ?? arms[0].id;
|
|
86
|
+
if (!seen.has(resolved)) {
|
|
87
|
+
throw new Error(`${PREFIX} baselineArmId '${resolved}' matches no arm — declared arms: ` +
|
|
88
|
+
`[${arms.map((a) => a.id).join(', ')}]. The baseline arm is the incumbent: the one the ` +
|
|
89
|
+
`others are compared against, and the one whose own reruns form the null band.`);
|
|
90
|
+
}
|
|
91
|
+
// 5. A challenger that names no configuration cannot be checked against the
|
|
92
|
+
// run manifest and cannot be told apart from the incumbent. The BASELINE
|
|
93
|
+
// arm may name nothing — "the configuration as it stands" is a real arm,
|
|
94
|
+
// and it is the factual one.
|
|
95
|
+
for (const arm of arms) {
|
|
96
|
+
if (arm.id === resolved)
|
|
97
|
+
continue;
|
|
98
|
+
if (declaredFacetCount(arm.facets) === 0 && (arm.ablations ?? []).length === 0) {
|
|
99
|
+
throw new Error(`${PREFIX} arm '${arm.id}' declares no configuration — no facets and no ablations. An ` +
|
|
100
|
+
`arm that names nothing cannot be checked against the run manifest and cannot be told ` +
|
|
101
|
+
`apart from the baseline arm '${resolved}'. Declare at least one facet (e.g. ` +
|
|
102
|
+
`{ memory: { retrieval: 'rerank' } }) or an ablation.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// 6. THE incoherent-spec refusal: two arms that are the same configuration.
|
|
106
|
+
// Comparing an arm with itself measures seed variance and would report it
|
|
107
|
+
// as a difference between strategies.
|
|
108
|
+
const byConfig = new Map();
|
|
109
|
+
for (const arm of arms) {
|
|
110
|
+
const key = armConfigKey(arm);
|
|
111
|
+
const twin = byConfig.get(key);
|
|
112
|
+
if (twin !== undefined) {
|
|
113
|
+
throw new Error(`${PREFIX} arms '${twin}' and '${arm.id}' declare the SAME configuration — comparing an ` +
|
|
114
|
+
`arm with itself measures seed-to-seed variance, not a difference between strategies. ` +
|
|
115
|
+
`Change one arm's facets, or raise \`samples\` on a single arm if variance is what you ` +
|
|
116
|
+
`want to see.`);
|
|
117
|
+
}
|
|
118
|
+
byConfig.set(key, arm.id);
|
|
119
|
+
}
|
|
120
|
+
return resolved;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../src/lib/context-bisect/arms/validate.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The arm verdict — the same three tiers, phrased for a substitution.
|
|
3
|
+
*
|
|
4
|
+
* ## Why not widen `verdictFor`
|
|
5
|
+
*
|
|
6
|
+
* `verdictFor` already carries an `action` word (`'ablating'` | `'restoring'`)
|
|
7
|
+
* and a third would have been one line. It ends its NOT-CONFIRMED sentence with
|
|
8
|
+
* "its ranking remains a correlational proxy only" — true of a suspect, which
|
|
9
|
+
* was RANKED before it was probed, and meaningless for an arm, which was never
|
|
10
|
+
* ranked at all. Widening the union would have forced that sentence onto the
|
|
11
|
+
* new tier or edited a string three existing tests pin byte-for-byte. So the
|
|
12
|
+
* tier LOGIC is shared (`probeFlipped`, the majority rule, the zero-tolerance
|
|
13
|
+
* baseline gate) and only the prose is new.
|
|
14
|
+
*
|
|
15
|
+
* ## The tiers, in refusal order
|
|
16
|
+
*
|
|
17
|
+
* 1. **Unstable baseline** → inconclusive. The incumbent could not reproduce
|
|
18
|
+
* the reference answer across its own seeds, so a difference measured
|
|
19
|
+
* against it is measuring the scenario, not the arm. Zero tolerance, exactly
|
|
20
|
+
* as `bisect.ts` and `localize.ts` apply it: ONE un-intervened flip is
|
|
21
|
+
* enough, because the majority rule would let a 1-in-3 flaky scenario reach
|
|
22
|
+
* a causal verdict.
|
|
23
|
+
* 2. **Arm did not take effect** → inconclusive. The run manifest contradicted
|
|
24
|
+
* what the arm declared. Any difference here is evidence about a
|
|
25
|
+
* configuration nobody meant to test.
|
|
26
|
+
* 3. **Inside the null band** → inconclusive. A majority flip whose mean
|
|
27
|
+
* similarity still sits within the baseline arm's own seed-to-seed spread is
|
|
28
|
+
* not separable from noise. Only applied when the flip comparator and the
|
|
29
|
+
* band are the same instrument (see `NullBand.gates`).
|
|
30
|
+
* 4. **Majority flip, outside the band, stable baseline** → confirmed. This is
|
|
31
|
+
* a causal claim of the same tier an ablation verdict makes: a
|
|
32
|
+
* counterfactual intervention, seeded reruns, variance reported, and a
|
|
33
|
+
* baseline that held.
|
|
34
|
+
* 5. **Minority flips** → inconclusive. 6. **No flips** → not-confirmed.
|
|
35
|
+
*
|
|
36
|
+
* Every claim is bounded by the scenario and the comparator, and says so — an
|
|
37
|
+
* arm confirmed on one question has been confirmed on one question.
|
|
38
|
+
*/
|
|
39
|
+
import type { AblationRunStats, AblationVerdict } from '../types.js';
|
|
40
|
+
import type { ArmApplication, NullBand } from './types.js';
|
|
41
|
+
/** Everything the verdict needs beyond the arm's own numbers. */
|
|
42
|
+
export interface ArmVerdictContext {
|
|
43
|
+
readonly baselineArmId: string;
|
|
44
|
+
/** The baseline arm reproduced the reference on EVERY seed. */
|
|
45
|
+
readonly baselineStable: boolean;
|
|
46
|
+
readonly baselineStats: AblationRunStats;
|
|
47
|
+
readonly band: NullBand;
|
|
48
|
+
/** Mean similarity fell below the band's floor. */
|
|
49
|
+
readonly outsideNullBand: boolean;
|
|
50
|
+
readonly application: ArmApplication;
|
|
51
|
+
}
|
|
52
|
+
/** Translate one arm's probe evidence into its verdict. See module docs. */
|
|
53
|
+
export declare function verdictForArm(armId: string, stats: AblationRunStats, context: ArmVerdictContext): AblationVerdict;
|