agentfootprint 6.43.0 → 6.45.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/ai-instructions/setup.sh +0 -0
- package/dist/core/RunnerBase.js +7 -0
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +2 -1
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +3 -1
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/stages/pickEntry.js +3 -1
- package/dist/core/agent/stages/pickEntry.js.map +1 -1
- package/dist/esm/adapters/identity/agentcore.d.ts +100 -0
- package/dist/esm/adapters/llm/AnthropicProvider.d.ts +130 -0
- package/dist/esm/adapters/llm/BedrockProvider.d.ts +100 -0
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.d.ts +41 -0
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.d.ts +95 -0
- package/dist/esm/adapters/llm/MockProvider.d.ts +153 -0
- package/dist/esm/adapters/llm/OpenAIProvider.d.ts +220 -0
- package/dist/esm/adapters/llm/createProvider.d.ts +85 -0
- package/dist/esm/adapters/memory/agentcore.d.ts +146 -0
- package/dist/esm/adapters/memory/bedrockAgentMemory.d.ts +95 -0
- package/dist/esm/adapters/memory/redis.d.ts +127 -0
- package/dist/esm/adapters/observability/agentcore.d.ts +67 -0
- package/dist/esm/adapters/observability/audit.d.ts +254 -0
- package/dist/esm/adapters/observability/cloudwatch.d.ts +96 -0
- package/dist/esm/adapters/observability/otel.d.ts +237 -0
- package/dist/esm/adapters/observability/xray.d.ts +88 -0
- package/dist/esm/adapters/types.d.ts +378 -0
- package/dist/esm/bridge/eventMeta.d.ts +59 -0
- package/dist/esm/cache/CacheDecisionSubflow.d.ts +85 -0
- package/dist/esm/cache/CacheGateDecider.d.ts +127 -0
- package/dist/esm/cache/applyCachePolicy.d.ts +37 -0
- package/dist/esm/cache/cacheRecorder.d.ts +85 -0
- package/dist/esm/cache/index.d.ts +33 -0
- package/dist/esm/cache/strategies/AnthropicCacheStrategy.d.ts +38 -0
- package/dist/esm/cache/strategies/BedrockCacheStrategy.d.ts +33 -0
- package/dist/esm/cache/strategies/NoOpCacheStrategy.d.ts +29 -0
- package/dist/esm/cache/strategies/OpenAICacheStrategy.d.ts +36 -0
- package/dist/esm/cache/strategyRegistry.d.ts +45 -0
- package/dist/esm/cache/types.d.ts +243 -0
- package/dist/esm/conventions.d.ts +203 -0
- package/dist/esm/core/Agent.d.ts +355 -0
- package/dist/esm/core/LLMCall.d.ts +139 -0
- package/dist/esm/core/RunnerBase.d.ts +267 -0
- package/dist/esm/core/RunnerBase.js +7 -0
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +565 -0
- package/dist/esm/core/agent/buildAgentChart.d.ts +109 -0
- package/dist/esm/core/agent/buildAgentChart.js +2 -1
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildAgentMessageApiChart.d.ts +40 -0
- package/dist/esm/core/agent/buildCacheSubflow.d.ts +35 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.d.ts +56 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.js +3 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildMessageApiChart.d.ts +47 -0
- package/dist/esm/core/agent/buildToolRegistry.d.ts +61 -0
- package/dist/esm/core/agent/memoryRecallInjections.d.ts +8 -0
- package/dist/esm/core/agent/stages/breakFinal.d.ts +22 -0
- package/dist/esm/core/agent/stages/callLLM.d.ts +74 -0
- package/dist/esm/core/agent/stages/pickEntry.d.ts +19 -0
- package/dist/esm/core/agent/stages/pickEntry.js +3 -1
- package/dist/esm/core/agent/stages/pickEntry.js.map +1 -1
- package/dist/esm/core/agent/stages/prepareFinal.d.ts +19 -0
- package/dist/esm/core/agent/stages/reliabilityExecution.d.ts +135 -0
- package/dist/esm/core/agent/stages/route.d.ts +18 -0
- package/dist/esm/core/agent/stages/seed.d.ts +53 -0
- package/dist/esm/core/agent/stages/toolCalls.d.ts +76 -0
- package/dist/esm/core/agent/toolArgsValidation.d.ts +62 -0
- package/dist/esm/core/agent/types.d.ts +382 -0
- package/dist/esm/core/agent/validators.d.ts +52 -0
- package/dist/esm/core/cost.d.ts +38 -0
- package/dist/esm/core/flowchartAsTool.d.ts +200 -0
- package/dist/esm/core/humanizeLLMError.d.ts +23 -0
- package/dist/esm/core/outputFallback.d.ts +139 -0
- package/dist/esm/core/outputSchema.d.ts +127 -0
- package/dist/esm/core/pause.d.ts +74 -0
- package/dist/esm/core/runCheckpoint.d.ts +179 -0
- package/dist/esm/core/runner.d.ts +203 -0
- package/dist/esm/core/slots/buildMessagesSlot.d.ts +40 -0
- package/dist/esm/core/slots/buildSystemPromptSlot.d.ts +41 -0
- package/dist/esm/core/slots/buildThinkingSubflow.d.ts +40 -0
- package/dist/esm/core/slots/buildToolsSlot.d.ts +60 -0
- package/dist/esm/core/slots/helpers.d.ts +27 -0
- package/dist/esm/core/toolContract.d.ts +43 -0
- package/dist/esm/core/tools.d.ts +90 -0
- package/dist/esm/core/translator.d.ts +94 -0
- package/dist/esm/core-flow/Conditional.d.ts +119 -0
- package/dist/esm/core-flow/Loop.d.ts +160 -0
- package/dist/esm/core-flow/Parallel.d.ts +360 -0
- package/dist/esm/core-flow/Sequence.d.ts +133 -0
- package/dist/esm/events/dispatcher.d.ts +134 -0
- package/dist/esm/events/payloads.d.ts +761 -0
- package/dist/esm/events/registry.d.ts +198 -0
- package/dist/esm/events/types.d.ts +70 -0
- package/dist/esm/identity/kinds.d.ts +36 -0
- package/dist/esm/identity/staticTokens.d.ts +28 -0
- package/dist/esm/identity/types.d.ts +113 -0
- package/dist/esm/identity/withCredentialRetry.d.ts +64 -0
- package/dist/esm/identity.d.ts +31 -0
- package/dist/esm/index.d.ts +64 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/injection-engine.d.ts +4 -0
- package/dist/esm/lib/canonicalJson.d.ts +56 -0
- package/dist/esm/lib/context-bisect/ablation.d.ts +109 -0
- package/dist/esm/lib/context-bisect/bisect.d.ts +75 -0
- package/dist/esm/lib/context-bisect/cost.d.ts +37 -0
- package/dist/esm/lib/context-bisect/index.d.ts +31 -0
- package/dist/esm/lib/context-bisect/index.js +3 -0
- package/dist/esm/lib/context-bisect/index.js.map +1 -1
- package/dist/esm/lib/context-bisect/llmEdgeWeigher.d.ts +124 -0
- package/dist/esm/lib/context-bisect/localize.d.ts +152 -0
- package/dist/esm/lib/context-bisect/localize.js +2 -0
- package/dist/esm/lib/context-bisect/localize.js.map +1 -1
- package/dist/esm/lib/context-bisect/loop-recall.d.ts +97 -0
- package/dist/esm/lib/context-bisect/missingContext.d.ts +71 -0
- package/dist/esm/lib/context-bisect/restoration.d.ts +39 -0
- package/dist/esm/lib/context-bisect/toBacktrackTrace.d.ts +138 -0
- package/dist/esm/lib/context-bisect/trajectory.d.ts +168 -0
- package/dist/esm/lib/context-bisect/types.d.ts +448 -0
- package/dist/esm/lib/context-bisect/walk-to-root.d.ts +103 -0
- package/dist/esm/lib/influence-core/attributability.d.ts +72 -0
- package/dist/esm/lib/influence-core/cache.d.ts +94 -0
- package/dist/esm/lib/influence-core/contrastive.d.ts +26 -0
- package/dist/esm/lib/influence-core/index.d.ts +34 -0
- package/dist/esm/lib/influence-core/margin.d.ts +33 -0
- package/dist/esm/lib/influence-core/signals.d.ts +128 -0
- package/dist/esm/lib/influence-core/similarity.d.ts +25 -0
- package/dist/esm/lib/influence-core/types.d.ts +252 -0
- package/dist/esm/lib/injection-engine/SkillRegistry.d.ts +147 -0
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.d.ts +110 -0
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js +1 -0
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
- package/dist/esm/lib/injection-engine/entryScorer.d.ts +93 -0
- package/dist/esm/lib/injection-engine/entryScorer.js +172 -0
- package/dist/esm/lib/injection-engine/entryScorer.js.map +1 -0
- package/dist/esm/lib/injection-engine/evaluator.d.ts +24 -0
- package/dist/esm/lib/injection-engine/factories/defineFact.d.ts +60 -0
- package/dist/esm/lib/injection-engine/factories/defineInjection.d.ts +41 -0
- package/dist/esm/lib/injection-engine/factories/defineInstruction.d.ts +78 -0
- package/dist/esm/lib/injection-engine/factories/defineRelevanceHint.d.ts +26 -0
- package/dist/esm/lib/injection-engine/factories/defineSkill.d.ts +160 -0
- package/dist/esm/lib/injection-engine/factories/defineSteering.d.ts +39 -0
- package/dist/esm/lib/injection-engine/index.d.ts +22 -0
- package/dist/esm/lib/injection-engine/index.js +1 -0
- package/dist/esm/lib/injection-engine/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillContract.d.ts +29 -0
- package/dist/esm/lib/injection-engine/skillGraph.d.ts +289 -0
- package/dist/esm/lib/injection-engine/skillGraph.js +35 -41
- package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillGraphCheckup.d.ts +49 -0
- package/dist/esm/lib/injection-engine/skillTools.d.ts +72 -0
- package/dist/esm/lib/injection-engine/softmax.d.ts +11 -0
- package/dist/esm/lib/injection-engine/types.d.ts +229 -0
- package/dist/esm/lib/injection-engine/types.js.map +1 -1
- package/dist/esm/lib/lazyRequire.d.ts +29 -0
- package/dist/esm/lib/mcp/index.d.ts +9 -0
- package/dist/esm/lib/mcp/mcpClient.d.ts +46 -0
- package/dist/esm/lib/mcp/mockMcpClient.d.ts +65 -0
- package/dist/esm/lib/mcp/types.d.ts +133 -0
- package/dist/esm/lib/rag/defineRAG.d.ts +139 -0
- package/dist/esm/lib/rag/index.d.ts +7 -0
- package/dist/esm/lib/rag/indexDocuments.d.ts +105 -0
- package/dist/esm/lib/tool-lint/analyze.d.ts +83 -0
- package/dist/esm/lib/tool-lint/cli.d.ts +43 -0
- package/dist/esm/lib/tool-lint/format.d.ts +18 -0
- package/dist/esm/lib/tool-lint/index.d.ts +23 -0
- package/dist/esm/lib/tool-lint/rules.d.ts +85 -0
- package/dist/esm/lib/tool-lint/types.d.ts +155 -0
- package/dist/esm/lib/trace-toolpack/bounded.d.ts +47 -0
- package/dist/esm/lib/trace-toolpack/debugPrompt.d.ts +19 -0
- package/dist/esm/lib/trace-toolpack/index.d.ts +20 -0
- package/dist/esm/lib/trace-toolpack/lazyToolpack.d.ts +35 -0
- package/dist/esm/lib/trace-toolpack/selfExplain.d.ts +100 -0
- package/dist/esm/lib/trace-toolpack/traceDebugAgent.d.ts +42 -0
- package/dist/esm/lib/trace-toolpack/traceToolpack.d.ts +69 -0
- package/dist/esm/lib/trace-toolpack/types.d.ts +59 -0
- package/dist/esm/llm-providers.d.ts +26 -0
- package/dist/esm/locales/index.d.ts +132 -0
- package/dist/esm/memory/beats/extractBeats.d.ts +61 -0
- package/dist/esm/memory/beats/extractor.d.ts +47 -0
- package/dist/esm/memory/beats/formatAsNarrative.d.ts +62 -0
- package/dist/esm/memory/beats/heuristicExtractor.d.ts +37 -0
- package/dist/esm/memory/beats/index.d.ts +12 -0
- package/dist/esm/memory/beats/llmExtractor.d.ts +56 -0
- package/dist/esm/memory/beats/types.d.ts +60 -0
- package/dist/esm/memory/beats/writeBeats.d.ts +22 -0
- package/dist/esm/memory/causal/evidenceRecorder.d.ts +66 -0
- package/dist/esm/memory/causal/index.d.ts +6 -0
- package/dist/esm/memory/causal/loadSnapshot.d.ts +51 -0
- package/dist/esm/memory/causal/snapshotPipeline.d.ts +35 -0
- package/dist/esm/memory/causal/types.d.ts +130 -0
- package/dist/esm/memory/causal/writeSnapshot.d.ts +73 -0
- package/dist/esm/memory/define.d.ts +63 -0
- package/dist/esm/memory/define.types.d.ts +276 -0
- package/dist/esm/memory/define.types.js +1 -1
- package/dist/esm/memory/embedding/cosine.d.ts +18 -0
- package/dist/esm/memory/embedding/embedMessages.d.ts +58 -0
- package/dist/esm/memory/embedding/index.d.ts +8 -0
- package/dist/esm/memory/embedding/loadRelevant.d.ts +51 -0
- package/dist/esm/memory/embedding/mockEmbedder.d.ts +22 -0
- package/dist/esm/memory/embedding/types.d.ts +46 -0
- package/dist/esm/memory/entry/decay.d.ts +36 -0
- package/dist/esm/memory/entry/index.d.ts +2 -0
- package/dist/esm/memory/entry/types.d.ts +140 -0
- package/dist/esm/memory/facts/extractFacts.d.ts +50 -0
- package/dist/esm/memory/facts/extractor.d.ts +33 -0
- package/dist/esm/memory/facts/formatFacts.d.ts +60 -0
- package/dist/esm/memory/facts/index.d.ts +14 -0
- package/dist/esm/memory/facts/llmFactExtractor.d.ts +64 -0
- package/dist/esm/memory/facts/loadFacts.d.ts +43 -0
- package/dist/esm/memory/facts/patternFactExtractor.d.ts +2 -0
- package/dist/esm/memory/facts/types.d.ts +68 -0
- package/dist/esm/memory/facts/writeFacts.d.ts +19 -0
- package/dist/esm/memory/identity/index.d.ts +2 -0
- package/dist/esm/memory/identity/types.d.ts +49 -0
- package/dist/esm/memory/index.d.ts +19 -0
- package/dist/esm/memory/pipeline/auto.d.ts +59 -0
- package/dist/esm/memory/pipeline/default.d.ts +49 -0
- package/dist/esm/memory/pipeline/ephemeral.d.ts +28 -0
- package/dist/esm/memory/pipeline/fact.d.ts +26 -0
- package/dist/esm/memory/pipeline/index.d.ts +13 -0
- package/dist/esm/memory/pipeline/narrative.d.ts +35 -0
- package/dist/esm/memory/pipeline/semantic.d.ts +37 -0
- package/dist/esm/memory/pipeline/types.d.ts +31 -0
- package/dist/esm/memory/stages/formatDefault.d.ts +64 -0
- package/dist/esm/memory/stages/index.d.ts +13 -0
- package/dist/esm/memory/stages/loadRecent.d.ts +49 -0
- package/dist/esm/memory/stages/pickByBudget.d.ts +63 -0
- package/dist/esm/memory/stages/summarize.d.ts +87 -0
- package/dist/esm/memory/stages/tokenize.d.ts +43 -0
- package/dist/esm/memory/stages/types.d.ts +75 -0
- package/dist/esm/memory/stages/writeMessages.d.ts +71 -0
- package/dist/esm/memory/store/InMemoryStore.d.ts +62 -0
- package/dist/esm/memory/store/index.d.ts +2 -0
- package/dist/esm/memory/store/types.d.ts +223 -0
- package/dist/esm/memory/wire/index.d.ts +2 -0
- package/dist/esm/memory/wire/mountMemoryPipeline.d.ts +108 -0
- package/dist/esm/memory-providers.d.ts +37 -0
- package/dist/esm/observability/contextError/finders/compareFinders.d.ts +19 -0
- package/dist/esm/observability/contextError/finders/index.d.ts +22 -0
- package/dist/esm/observability/contextError/finders/rankSuspects.d.ts +2 -0
- package/dist/esm/observability/contextError/finders/removeAndRetry.d.ts +11 -0
- package/dist/esm/observability/contextError/finders/shrinkToCause.d.ts +11 -0
- package/dist/esm/observability/contextError/finders/testManyCombos.d.ts +11 -0
- package/dist/esm/observability/contextError/finders/traceSteps.d.ts +2 -0
- package/dist/esm/observability/contextError/finders/types.d.ts +88 -0
- package/dist/esm/observability-providers.d.ts +46 -0
- package/dist/esm/observe.d.ts +62 -0
- package/dist/esm/observe.js +7 -1
- package/dist/esm/observe.js.map +1 -1
- package/dist/esm/patterns/Debate.d.ts +39 -0
- package/dist/esm/patterns/MapReduce.d.ts +66 -0
- package/dist/esm/patterns/Reflection.d.ts +51 -0
- package/dist/esm/patterns/SelfConsistency.d.ts +43 -0
- package/dist/esm/patterns/Swarm.d.ts +60 -0
- package/dist/esm/patterns/ToT.d.ts +53 -0
- package/dist/esm/patterns/index.d.ts +22 -0
- package/dist/esm/providers.d.ts +33 -0
- package/dist/esm/recorders/core/AgentRecorder.d.ts +15 -0
- package/dist/esm/recorders/core/CompositionRecorder.d.ts +17 -0
- package/dist/esm/recorders/core/ContextEvaluatedRecorder.d.ts +23 -0
- package/dist/esm/recorders/core/ContextRecorder.d.ts +47 -0
- package/dist/esm/recorders/core/CostRecorder.d.ts +14 -0
- package/dist/esm/recorders/core/EmitBridge.d.ts +30 -0
- package/dist/esm/recorders/core/ErrorBridge.d.ts +38 -0
- package/dist/esm/recorders/core/EvalRecorder.d.ts +16 -0
- package/dist/esm/recorders/core/MemoryRecorder.d.ts +17 -0
- package/dist/esm/recorders/core/PermissionRecorder.d.ts +16 -0
- package/dist/esm/recorders/core/ReliabilityRecorder.d.ts +24 -0
- package/dist/esm/recorders/core/SkillRecorder.d.ts +14 -0
- package/dist/esm/recorders/core/StreamRecorder.d.ts +15 -0
- package/dist/esm/recorders/core/ToolsRecorder.d.ts +18 -0
- package/dist/esm/recorders/core/ValidationRecorder.d.ts +16 -0
- package/dist/esm/recorders/core/contextEngineering.d.ts +136 -0
- package/dist/esm/recorders/core/typedEmit.d.ts +34 -0
- package/dist/esm/recorders/core/types.d.ts +97 -0
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.d.ts +117 -0
- package/dist/esm/recorders/observability/BoundaryRecorder.d.ts +546 -0
- package/dist/esm/recorders/observability/FlowchartRecorder.d.ts +220 -0
- package/dist/esm/recorders/observability/FlowchartRecorder.js +10 -2
- package/dist/esm/recorders/observability/FlowchartRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/LiveStateRecorder.d.ts +250 -0
- package/dist/esm/recorders/observability/LoggingRecorder.d.ts +91 -0
- package/dist/esm/recorders/observability/RouteRecorder.d.ts +83 -0
- package/dist/esm/recorders/observability/RunStepRecorder.d.ts +231 -0
- package/dist/esm/recorders/observability/StatusRecorder.d.ts +36 -0
- package/dist/esm/recorders/observability/ToolChoiceRecorder.d.ts +164 -0
- package/dist/esm/recorders/observability/ToolLineageRecorder.d.ts +71 -0
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.d.ts +105 -0
- package/dist/esm/recorders/observability/internal/ActorArrowClassifier.d.ts +25 -0
- package/dist/esm/recorders/observability/internal/CandidateAnswerBuffer.d.ts +28 -0
- package/dist/esm/recorders/observability/internal/ForkTracker.d.ts +60 -0
- package/dist/esm/recorders/observability/internal/RootInferrer.d.ts +51 -0
- package/dist/esm/recorders/observability/internal/SequenceSiblingTracker.d.ts +24 -0
- package/dist/esm/recorders/observability/localObservability.d.ts +48 -0
- package/dist/esm/recorders/observability/localObservability.js +54 -0
- package/dist/esm/recorders/observability/localObservability.js.map +1 -0
- package/dist/esm/recorders/observability/observeRunId.d.ts +36 -0
- package/dist/esm/recorders/observability/status/statusTemplates.d.ts +106 -0
- package/dist/esm/recorders/observability/trace.d.ts +119 -0
- package/dist/esm/recorders/observability/trace.js +99 -0
- package/dist/esm/recorders/observability/trace.js.map +1 -0
- package/dist/esm/reliability/CircuitBreaker.d.ts +75 -0
- package/dist/esm/reliability/buildReliabilityGateChart.d.ts +53 -0
- package/dist/esm/reliability/classifyError.d.ts +28 -0
- package/dist/esm/reliability/index.d.ts +35 -0
- package/dist/esm/reliability/types.d.ts +327 -0
- package/dist/esm/resilience/fallbackProvider.d.ts +33 -0
- package/dist/esm/resilience/index.d.ts +21 -0
- package/dist/esm/resilience/withCircuitBreaker.d.ts +129 -0
- package/dist/esm/resilience/withFallback.d.ts +45 -0
- package/dist/esm/resilience/withRetry.d.ts +71 -0
- package/dist/esm/security/PermissionPolicy.d.ts +124 -0
- package/dist/esm/security/PolicyHaltError.d.ts +72 -0
- package/dist/esm/security/extractSequence.d.ts +46 -0
- package/dist/esm/security/index.d.ts +44 -0
- package/dist/esm/security/thinkingRedaction.d.ts +50 -0
- package/dist/esm/status.d.ts +48 -0
- package/dist/esm/strategies/attach.d.ts +47 -0
- package/dist/esm/strategies/compose.d.ts +48 -0
- package/dist/esm/strategies/defaults/chatBubbleLiveStatus.d.ts +36 -0
- package/dist/esm/strategies/defaults/consoleObservability.d.ts +42 -0
- package/dist/esm/strategies/defaults/inMemorySinkCost.d.ts +50 -0
- package/dist/esm/strategies/defaults/index.d.ts +30 -0
- package/dist/esm/strategies/defaults/noopLens.d.ts +28 -0
- package/dist/esm/strategies/index.d.ts +36 -0
- package/dist/esm/strategies/registry.d.ts +70 -0
- package/dist/esm/strategies/types.d.ts +303 -0
- package/dist/esm/stream.d.ts +82 -0
- package/dist/esm/thinking/AnthropicThinkingHandler.d.ts +42 -0
- package/dist/esm/thinking/MockThinkingHandler.d.ts +50 -0
- package/dist/esm/thinking/OpenAIThinkingHandler.d.ts +37 -0
- package/dist/esm/thinking/index.d.ts +51 -0
- package/dist/esm/thinking/registry.d.ts +33 -0
- package/dist/esm/thinking/types.d.ts +162 -0
- package/dist/esm/tool-providers/gatedTools.d.ts +36 -0
- package/dist/esm/tool-providers/index.d.ts +41 -0
- package/dist/esm/tool-providers/skillScopedTools.d.ts +45 -0
- package/dist/esm/tool-providers/staticTools.d.ts +21 -0
- package/dist/esm/tool-providers/types.d.ts +138 -0
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/context-bisect/index.js +3 -0
- package/dist/lib/context-bisect/index.js.map +1 -1
- package/dist/lib/context-bisect/localize.js +2 -0
- package/dist/lib/context-bisect/localize.js.map +1 -1
- package/dist/lib/injection-engine/buildInjectionEngineSubflow.js +1 -0
- package/dist/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
- package/dist/lib/injection-engine/entryScorer.js +178 -0
- package/dist/lib/injection-engine/entryScorer.js.map +1 -0
- package/dist/lib/injection-engine/index.js +5 -1
- package/dist/lib/injection-engine/index.js.map +1 -1
- package/dist/lib/injection-engine/skillGraph.js +35 -41
- package/dist/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/lib/injection-engine/types.js.map +1 -1
- package/dist/memory/define.types.js +1 -1
- package/dist/observe.js +14 -3
- package/dist/observe.js.map +1 -1
- package/dist/recorders/observability/FlowchartRecorder.js +12 -3
- package/dist/recorders/observability/FlowchartRecorder.js.map +1 -1
- package/dist/recorders/observability/localObservability.js +58 -0
- package/dist/recorders/observability/localObservability.js.map +1 -0
- package/dist/recorders/observability/trace.js +105 -0
- package/dist/recorders/observability/trace.js.map +1 -0
- package/dist/types/core/RunnerBase.d.ts.map +1 -1
- 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/stages/pickEntry.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +8 -4
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/runner.d.ts +12 -0
- package/dist/types/core/runner.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/context-bisect/index.d.ts +3 -0
- package/dist/types/lib/context-bisect/index.d.ts.map +1 -1
- package/dist/types/lib/context-bisect/localize.d.ts +2 -0
- package/dist/types/lib/context-bisect/localize.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/entryScorer.d.ts +94 -0
- package/dist/types/lib/injection-engine/entryScorer.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/index.d.ts +1 -0
- package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillGraph.d.ts +21 -24
- package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/types.d.ts +9 -4
- package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
- package/dist/types/memory/define.types.d.ts +1 -1
- package/dist/types/observe.d.ts +3 -1
- package/dist/types/observe.d.ts.map +1 -1
- package/dist/types/recorders/observability/FlowchartRecorder.d.ts +8 -1
- package/dist/types/recorders/observability/FlowchartRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/localObservability.d.ts +49 -0
- package/dist/types/recorders/observability/localObservability.d.ts.map +1 -0
- package/dist/types/recorders/observability/trace.d.ts +120 -0
- package/dist/types/recorders/observability/trace.d.ts.map +1 -0
- package/package.json +203 -56
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,oEAAoE;AACpE,8DAA8D;AAC9D,uEAAuE;AACvE,kEAAkE;AAClE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AAO,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,GAIjB,MAAM,2BAA2B,CAAC;AAEnC,wEAAwE;AACxE,wEAAwE;AACxE,uDAAuD;AACvD,OAAO,EACL,gBAAgB,EAChB,eAAe,GAIhB,MAAM,qBAAqB,CAAC;AAE7B,mEAAmE;AACnE,oEAAoE;AACpE,sDAAsD;AACtD,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* canonicalJson — deterministic JSON serialization (`afp-cjson/1`).
|
|
3
|
+
*
|
|
4
|
+
* Pattern: Canonicalization function (RFC 8785 JCS-inspired, JS-native).
|
|
5
|
+
* Role: The byte contract under the tamper-evident audit chain
|
|
6
|
+
* (backlog #20). `AuditRecord.hash` = SHA-256 over the
|
|
7
|
+
* canonical serialization of the record — two parties that
|
|
8
|
+
* serialize the same VALUE must produce the same BYTES, or
|
|
9
|
+
* verification breaks. These rules ARE the contract; bump the
|
|
10
|
+
* identifier (`afp-cjson/2`) for ANY behavioral change.
|
|
11
|
+
*
|
|
12
|
+
* ## Canonicalization rules (`afp-cjson/1`)
|
|
13
|
+
*
|
|
14
|
+
* 1. **Objects** — own enumerable string-keyed properties only, keys
|
|
15
|
+
* sorted lexicographically by UTF-16 code unit (JavaScript's
|
|
16
|
+
* default `Array.prototype.sort()` comparison), serialized
|
|
17
|
+
* `{"k":v,...}` with no whitespace. Symbol keys are ignored.
|
|
18
|
+
* 2. **Arrays** — element order preserved, `[v,...]` no whitespace.
|
|
19
|
+
* 3. **Strings** — `JSON.stringify` escaping (deterministic per the
|
|
20
|
+
* ECMAScript spec: minimal escapes, lowercase `\uXXXX` hex).
|
|
21
|
+
* 4. **Numbers** — finite numbers via `JSON.stringify` (ECMAScript
|
|
22
|
+
* shortest round-trip formatting). `NaN` / `±Infinity` → `null`
|
|
23
|
+
* (JSON.stringify parity). `-0` serializes as `0`.
|
|
24
|
+
* 5. **`null`** → `null`. **`undefined`** — omitted as an object
|
|
25
|
+
* property, `null` as an array element or top-level value
|
|
26
|
+
* (JSON.stringify parity).
|
|
27
|
+
* 6. **Functions / symbols** — omitted as object properties, `null`
|
|
28
|
+
* in arrays (JSON.stringify parity).
|
|
29
|
+
* 7. **`toJSON`** — honored before serialization (so `Date` →
|
|
30
|
+
* ISO-8601 string, exactly like `JSON.stringify`).
|
|
31
|
+
* 8. **`bigint`** → `TypeError` (JSON.stringify parity). Sanitize
|
|
32
|
+
* upstream (the audit bounding layer converts bigint to string).
|
|
33
|
+
* 9. **Cycles** → `TypeError`. Canonicalization is defined over
|
|
34
|
+
* JSON-safe trees; the audit bounding layer breaks cycles first.
|
|
35
|
+
*
|
|
36
|
+
* The domain is "anything `JSON.parse` can produce" (the audit bundle
|
|
37
|
+
* is JSON); for other inputs the behavior mirrors `JSON.stringify`
|
|
38
|
+
* except that object keys are SORTED. Verification re-canonicalizes
|
|
39
|
+
* records that came through `JSON.parse(JSON.stringify(bundle))`, so
|
|
40
|
+
* round-tripping a bundle never changes its hashes.
|
|
41
|
+
*
|
|
42
|
+
* Browser-safe: no Node imports — pure computation.
|
|
43
|
+
*/
|
|
44
|
+
/** Identifier of the canonicalization rules implemented by
|
|
45
|
+
* {@link canonicalJson}. Carried on `AuditBundleHeader.canonicalization`
|
|
46
|
+
* so offline verifiers can reject bundles produced under different
|
|
47
|
+
* rules instead of mis-verifying them. */
|
|
48
|
+
export declare const CANONICAL_JSON_VERSION = "afp-cjson/1";
|
|
49
|
+
/**
|
|
50
|
+
* Serialize `value` to canonical JSON (see module docs for the exact
|
|
51
|
+
* `afp-cjson/1` rules). Deterministic: equal values (after key
|
|
52
|
+
* reordering) always produce identical strings.
|
|
53
|
+
*
|
|
54
|
+
* @throws TypeError on circular references or bigint values.
|
|
55
|
+
*/
|
|
56
|
+
export declare function canonicalJson(value: unknown): string;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ablation — the counterfactual seam (RFC-003 Part B, D8 stage 4 + the
|
|
3
|
+
* D9 stats engine).
|
|
4
|
+
*
|
|
5
|
+
* Three pieces:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Adapters** — `ablationForSuspect` maps a classified suspect to
|
|
8
|
+
* the spec that removes it (tool → drop from catalog; injection /
|
|
9
|
+
* fact / skill → exclude the `Injection.id`; memory → filter the
|
|
10
|
+
* `MemoryEntry.id`; arg → consumer-override note).
|
|
11
|
+
*
|
|
12
|
+
* 2. **The seam** — `applyAblations` filters the inputs an agent is
|
|
13
|
+
* BUILT from. Documented here because the seam did not previously
|
|
14
|
+
* exist: `AgentOptions` has no `ignoredTools` runtime kill-switch, so
|
|
15
|
+
* tool ablation happens at construction (the consumer's
|
|
16
|
+
* `AblationRunner` rebuilds the agent from filtered inputs). Same for
|
|
17
|
+
* injections and memory entries.
|
|
18
|
+
*
|
|
19
|
+
* 3. **The probe engine** — `runAblationProbe` calls the consumer's
|
|
20
|
+
* runner N seeded times, measures embedding similarity to the
|
|
21
|
+
* original output, counts outcome flips, and returns variance —
|
|
22
|
+
* never a single-run verdict (D9 discipline).
|
|
23
|
+
*
|
|
24
|
+
* §B2: only `runAblationProbe`-derived verdicts are causal claims; every
|
|
25
|
+
* score elsewhere is a correlational proxy.
|
|
26
|
+
*/
|
|
27
|
+
import type { Embedder } from '../influence-core/index.js';
|
|
28
|
+
import type { AblationRerun, AblationRunStats, AblationSpec, AblationVerdict, CostStats, OutcomeComparator, SimilarityStats, Suspect } from './types.js';
|
|
29
|
+
/**
|
|
30
|
+
* The spec that removes one suspect — or `undefined` for kind `'stage'`
|
|
31
|
+
* (plain pipeline stages have no removable input; re-rank or refactor).
|
|
32
|
+
*/
|
|
33
|
+
export declare function ablationForSuspect(suspect: Suspect): AblationSpec | undefined;
|
|
34
|
+
/** Anything with a stable id — `Injection` and `MemoryEntry` both fit. */
|
|
35
|
+
interface Identified {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
}
|
|
38
|
+
/** Anything with a named schema — the library's `Tool` fits. */
|
|
39
|
+
interface NamedTool {
|
|
40
|
+
readonly schema: {
|
|
41
|
+
readonly name: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface AblationTargets<TTool extends NamedTool = NamedTool, TInjection extends Identified = Identified, TMemoryEntry extends Identified = Identified> {
|
|
45
|
+
readonly tools?: readonly TTool[];
|
|
46
|
+
readonly injections?: readonly TInjection[];
|
|
47
|
+
readonly memoryEntries?: readonly TMemoryEntry[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Apply ablation specs to the inputs an agent is constructed from —
|
|
51
|
+
* THE documented seam (see module docs). Generic over the concrete tool /
|
|
52
|
+
* injection / memory-entry types so it filters without importing them.
|
|
53
|
+
*
|
|
54
|
+
* `'arg'` specs are deliberately NOT handled here: run input belongs to
|
|
55
|
+
* the consumer's runner (`spec.note` says so).
|
|
56
|
+
*
|
|
57
|
+
* @example inside an AblationRunner
|
|
58
|
+
* ```ts
|
|
59
|
+
* const { tools, injections } = applyAblations(specs, {
|
|
60
|
+
* tools: ALL_TOOLS, injections: ALL_FACTS,
|
|
61
|
+
* });
|
|
62
|
+
* const agent = Agent.create({ provider: freshProvider(), model })
|
|
63
|
+
* .tools([...tools]);
|
|
64
|
+
* for (const inj of injections) agent.fact(inj);
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function applyAblations<TTool extends NamedTool, TInjection extends Identified, TMemoryEntry extends Identified>(specs: readonly AblationSpec[], targets: AblationTargets<TTool, TInjection, TMemoryEntry>): {
|
|
68
|
+
tools: readonly TTool[];
|
|
69
|
+
injections: readonly TInjection[];
|
|
70
|
+
memoryEntries: readonly TMemoryEntry[];
|
|
71
|
+
};
|
|
72
|
+
/** Resolve the seeded-rerun count: default on non-finite, floor, clamp to >= 2
|
|
73
|
+
* (no single-run verdicts — D9). Shared by the ablation + restoration probes. */
|
|
74
|
+
export declare function resolveSamples(samples: number | undefined): number;
|
|
75
|
+
/** Median of a numeric sample (mean of the two middles for even length). */
|
|
76
|
+
export declare function median(values: readonly number[]): number;
|
|
77
|
+
/** Build a probe's CostStats from per-seed loop/token samples — undefined when
|
|
78
|
+
* the runner reported no cost (keeps quality-only behavior byte-identical). */
|
|
79
|
+
export declare function costStatsFrom(samples: number, loops: readonly number[], tokens: readonly number[]): CostStats | undefined;
|
|
80
|
+
export declare function similarityStats(values: readonly number[]): SimilarityStats;
|
|
81
|
+
/** The default comparator: embedding similarity below the threshold. */
|
|
82
|
+
export declare function defaultOutcomeComparator(embedder: Embedder, flipThreshold: number): OutcomeComparator;
|
|
83
|
+
/** Resolved probe configuration shared by D8 and D9. */
|
|
84
|
+
export interface ProbeConfig {
|
|
85
|
+
readonly rerun: AblationRerun;
|
|
86
|
+
readonly embedder: Embedder;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Run ONE probe: call the consumer's runner with `specs` once per seed
|
|
90
|
+
* (0..samples-1), measure each output's embedding similarity to the
|
|
91
|
+
* original, and count outcome flips. Variance is always reported.
|
|
92
|
+
*
|
|
93
|
+
* `samples` is clamped to ≥ 2 — D9: never single-run verdicts.
|
|
94
|
+
*/
|
|
95
|
+
export declare function runAblationProbe(config: ProbeConfig, specs: readonly AblationSpec[]): Promise<AblationRunStats>;
|
|
96
|
+
/** Majority-flip rule shared by D8 verdicts and D9 probes. */
|
|
97
|
+
export declare function probeFlipped(stats: AblationRunStats): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Translate probe evidence into the verdict — the ONLY causal claim tier
|
|
100
|
+
* (§B2). `baselineStable=false` (the un-ablated scenario itself flipped)
|
|
101
|
+
* forces `'inconclusive'`: no ablation verdict is trustworthy on an
|
|
102
|
+
* unstable baseline.
|
|
103
|
+
*/
|
|
104
|
+
export declare function verdictFor(label: string, stats: AblationRunStats, baselineStable: boolean,
|
|
105
|
+
/** The counterfactual intervention. `'ablating'` (default) for present
|
|
106
|
+
* suspects; `'restoring'` for missing-context candidates (interface #3).
|
|
107
|
+
* Default keeps every claim string byte-identical to before. */
|
|
108
|
+
action?: 'ablating' | 'restoring'): AblationVerdict;
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bisectCulprits — multi-culprit bisection over the ranked suspect set
|
|
3
|
+
* (RFC-003 Part B, block D9). The "git bisect" of the localizer.
|
|
4
|
+
*
|
|
5
|
+
* When single-suspect ablations don't flip the outcome — redundant causes
|
|
6
|
+
* (two facts that EACH justify the wrong answer), or interacting ones —
|
|
7
|
+
* the culprit is a SET. This harness finds a minimal culprit set by
|
|
8
|
+
* recursive halving over the ranked suspects (delta-debugging style,
|
|
9
|
+
* Zeller's ddmin specialized to two-way splits), then keeps searching the
|
|
10
|
+
* remainder for INDEPENDENT culprits until the remainder stops flipping.
|
|
11
|
+
*
|
|
12
|
+
* Probe semantics (the D9 discipline):
|
|
13
|
+
* - every probe = N seeded reruns of the consumer's `AblationRunner`
|
|
14
|
+
* with the probe's combined specs; "flipped" = MAJORITY of runs
|
|
15
|
+
* changed outcome; similarity mean ± spread is always reported —
|
|
16
|
+
* never single-run verdicts;
|
|
17
|
+
* - probe 0 is the BASELINE (no ablation): if it flips, the scenario
|
|
18
|
+
* itself is unstable and the result is honestly `'inconclusive'`;
|
|
19
|
+
* - probes are cached by spec-set, and budgeted (`maxProbes`) — running
|
|
20
|
+
* out of budget yields `'inconclusive'`, never a partial claim
|
|
21
|
+
* dressed up as a finding.
|
|
22
|
+
*
|
|
23
|
+
* §B2: the returned `verdict`/`culprits` are CAUSAL claims — they rest
|
|
24
|
+
* exclusively on counterfactual reruns. The input ranking only chooses
|
|
25
|
+
* the SEARCH ORDER (better ranking = fewer probes), it never decides the
|
|
26
|
+
* outcome.
|
|
27
|
+
*/
|
|
28
|
+
import type { AblationRerun, AblationRunStats, Embedder, Suspect } from './types.js';
|
|
29
|
+
/** One executed probe — full variance evidence, kept for the report. */
|
|
30
|
+
export interface BisectionProbe {
|
|
31
|
+
/** Labels of the suspects ablated together ([] = the baseline probe). */
|
|
32
|
+
readonly ablated: readonly string[];
|
|
33
|
+
readonly stats: AblationRunStats;
|
|
34
|
+
/** Majority-of-N outcome flip. */
|
|
35
|
+
readonly flipped: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface BisectionResult {
|
|
38
|
+
/**
|
|
39
|
+
* `'confirmed'` — a minimal culprit set was found and verified by
|
|
40
|
+
* counterfactual reruns. `'not-reproducible'` — ablating EVERY ranked
|
|
41
|
+
* suspect together does not flip the outcome: the bug's cause is not
|
|
42
|
+
* in the ranked set (look at the report's honesty flags — the slice
|
|
43
|
+
* may be incomplete). `'inconclusive'` — unstable baseline or probe
|
|
44
|
+
* budget exhausted.
|
|
45
|
+
*/
|
|
46
|
+
readonly verdict: 'confirmed' | 'not-reproducible' | 'inconclusive';
|
|
47
|
+
/**
|
|
48
|
+
* Minimal culprit set(s): each inner array is one minimal set whose
|
|
49
|
+
* JOINT ablation flips the outcome. Independent culprits appear as
|
|
50
|
+
* separate sets; redundant/interacting causes appear together in one.
|
|
51
|
+
*/
|
|
52
|
+
readonly culprits: readonly (readonly Suspect[])[];
|
|
53
|
+
/** Every probe executed, in order (baseline first). */
|
|
54
|
+
readonly probes: readonly BisectionProbe[];
|
|
55
|
+
/** Total consumer-runner invocations (probes × samples). */
|
|
56
|
+
readonly runsUsed: number;
|
|
57
|
+
}
|
|
58
|
+
export interface BisectCulpritsOptions {
|
|
59
|
+
/** Ranked suspects — only those carrying an applicable ablation spec
|
|
60
|
+
* participate ('arg' and 'stage' suspects are skipped: nothing the
|
|
61
|
+
* harness can remove for the consumer). */
|
|
62
|
+
readonly suspects: readonly Suspect[];
|
|
63
|
+
readonly rerun: AblationRerun;
|
|
64
|
+
/** Embedder for similarity stats (and the default flip comparator). */
|
|
65
|
+
readonly embedder: Embedder;
|
|
66
|
+
/** Probe budget. Default 24. Exhaustion → 'inconclusive'. */
|
|
67
|
+
readonly maxProbes?: number;
|
|
68
|
+
/** Max independent culprit sets to search for. Default 4. */
|
|
69
|
+
readonly maxCulprits?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Find minimal culprit set(s) by seeded counterfactual bisection. See
|
|
73
|
+
* module docs for semantics and the §B2 claim tier.
|
|
74
|
+
*/
|
|
75
|
+
export declare function bisectCulprits(options: BisectCulpritsOptions): Promise<BisectionResult>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cost — the SECOND score of two-score localization (proposal 004).
|
|
3
|
+
*
|
|
4
|
+
* A context bug costs you twice: a wrong ANSWER (the flip `verdict`, the strong
|
|
5
|
+
* causal tier) OR extra COST — loops/tokens — even when a capable model recovers
|
|
6
|
+
* and answers correctly. This module reads the cost score from the SAME ablation
|
|
7
|
+
* reruns (`AblationRunStats.cost`, captured in `runAblationProbe`) and attaches a
|
|
8
|
+
* `CostVerdict` to each suspect, then classifies each on the 2×2.
|
|
9
|
+
*
|
|
10
|
+
* HONEST TIER (the two-lens review): the cost score is a WEAKER, gated tier than
|
|
11
|
+
* the flip. Removing a piece reducing cost shows **necessity for the cost, NOT
|
|
12
|
+
* that the work was "wasted"** (the piece could be load-bearing scaffolding). So:
|
|
13
|
+
* - PLACEBO control — a cost cause must beat the loops-saved of pieces whose
|
|
14
|
+
* removal did NOT flip the answer (benign path variance), leave-one-out;
|
|
15
|
+
* (v1 limitation: the placebo population is the non-flipping suspects, which
|
|
16
|
+
* may themselves include real cost causes — so the band's MAX is CONSERVATIVE
|
|
17
|
+
* and UNDER-detects when several pieces reduce cost by similar amounts. Safe
|
|
18
|
+
* direction for a causal-ish claim. A dedicated neutral-filler placebo is v2.)
|
|
19
|
+
* - STABILITY — every ablated rerun used no MORE loops than baseline
|
|
20
|
+
* (consistent reduction; an integer ±1 delta is brittle — determinism ≠
|
|
21
|
+
* robustness), AND a placebo band existed to clear.
|
|
22
|
+
*/
|
|
23
|
+
import type { AblationRunStats, Suspect, SuspectClass } from './types.js';
|
|
24
|
+
/** Minimum loops saved (over the placebo band) to call a piece a cost cause. */
|
|
25
|
+
export declare const MIN_LOOPS_SAVED = 1;
|
|
26
|
+
/**
|
|
27
|
+
* Attach a `CostVerdict` to each suspect from the ablation reruns + a
|
|
28
|
+
* leave-one-out placebo control. Suspects without cost data are returned
|
|
29
|
+
* unchanged (quality-only). See the module honesty note.
|
|
30
|
+
*/
|
|
31
|
+
export declare function assignCostVerdicts(suspects: readonly Suspect[], baseline: AblationRunStats): Suspect[];
|
|
32
|
+
/**
|
|
33
|
+
* Derive the 2×2 class from the flip verdict (quality) and the cost verdict.
|
|
34
|
+
* The no-bug cell is `'no-detected-effect'` — never "innocent" (a piece can
|
|
35
|
+
* matter in ways neither axis sees: overdetermination, same-loops-different-path).
|
|
36
|
+
*/
|
|
37
|
+
export declare function classifySuspect(suspect: Suspect): SuspectClass;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* context-bisect — RFC-003 Part B: the contextual-bug LOCALIZER,
|
|
3
|
+
* "git bisect for context".
|
|
4
|
+
*
|
|
5
|
+
* Assembly over shipped pieces: footprintjs 9.8.0's complete causal DAG
|
|
6
|
+
* (control edges, honesty markers, `EdgeWeigher` hook) × influence-core
|
|
7
|
+
* scoring (D6) × consumer-run counterfactual ablation.
|
|
8
|
+
*
|
|
9
|
+
* D7 — `llmEdgeWeigher` influence-weighted LLM-call slice edges
|
|
10
|
+
* D8 — `localizeContextBug` trigger → slice → ranked suspects → ablation
|
|
11
|
+
* D9 — `bisectCulprits` seeded multi-culprit bisection + variance
|
|
12
|
+
*
|
|
13
|
+
* §B2 claim tiers (spelled out on every type): weights/scores are
|
|
14
|
+
* embedding-geometry PROXIES; ablation verdicts are the ONLY causal
|
|
15
|
+
* claims; slice completeness is bounded by tracking — and says so.
|
|
16
|
+
*
|
|
17
|
+
* @beta Beta feature (RFC-003 Part B). The API works and is tested, but
|
|
18
|
+
* may change before GA.
|
|
19
|
+
*/
|
|
20
|
+
export { llmEdgeWeigher, stepOutputText, type LlmEdgeWeigherHandle, type LlmEdgeWeigherOptions, type RankedParentEdge, } from './llmEdgeWeigher.js';
|
|
21
|
+
export { findDroppedContext, type ContextUnit, type DroppedUnit, type MissingContextResult, } from './missingContext.js';
|
|
22
|
+
export { runRestorationProbe, type RestorationProbeConfig, type RestorationRerun, type RestorationRunner, } from './restoration.js';
|
|
23
|
+
export { defaultSuspectClassifier, formatContextBugReport, llmCallIdsFromEvents, localizeContextBug, suspectLabel, type ClassifyContext, type LocalizeContextBugOptions, type SuspectClassifier, type SuspectSeed, } from './localize.js';
|
|
24
|
+
export { toBacktrackTrace, type BacktrackCustodyHop, type BacktrackHop, type BacktrackSuspectCard, type BacktrackTrace, type BacktrackTrail, type ToBacktrackTraceOptions, } from './toBacktrackTrace.js';
|
|
25
|
+
export { ablationForSuspect, applyAblations, costStatsFrom, defaultOutcomeComparator, median, probeFlipped, runAblationProbe, verdictFor, type AblationTargets, type ProbeConfig, } from './ablation.js';
|
|
26
|
+
export { assignCostVerdicts, classifySuspect, MIN_LOOPS_SAVED } from './cost.js';
|
|
27
|
+
export { shortlistEarlyCulprits, DEFAULT_RECENCY_DECAY, type LoopCandidate, type LoopRecallShortlist, type ShortlistEarlyCulpritsOptions, } from './loop-recall.js';
|
|
28
|
+
export { walkToRoot, walkTrajectory, buildWriterFrameIndex, type RootCauseHop, type RootCauseNote, type RootCausePath, type WalkToRootOptions, } from './walk-to-root.js';
|
|
29
|
+
export { assembleTrajectory, bucketByAnchors, findLoopHeads, type AnchorBucket, type AssembleTrajectoryOptions, type ContextSource, type LoopFrame, type SyntheticQuestionNode, type Trajectory, } from './trajectory.js';
|
|
30
|
+
export { bisectCulprits, type BisectCulpritsOptions, type BisectionProbe, type BisectionResult, } from './bisect.js';
|
|
31
|
+
export { CONTEXT_BISECT_DEFAULTS, type AblationRerun, type AblationRunner, type AblationRunStats, type AblationSpec, type AblationVerdict, type AblationVerdictKind, type CapturedEventLike, type ContextBugArtifacts, type ContextBugReport, type CostRange, type CostStats, type CostVerdict, type EdgePathStep, type HonestyFlag, type HonestyFlagKind, type OutcomeComparator, type QualityTriggerLookup, type RestoredCandidate, type RunCost, type SimilarityStats, type SliceStats, type Suspect, type SuspectClass, type SuspectDetail, type SuspectKind, } from './types.js';
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
* §B2 claim tiers (spelled out on every type): weights/scores are
|
|
14
14
|
* embedding-geometry PROXIES; ablation verdicts are the ONLY causal
|
|
15
15
|
* claims; slice completeness is bounded by tracking — and says so.
|
|
16
|
+
*
|
|
17
|
+
* @beta Beta feature (RFC-003 Part B). The API works and is tested, but
|
|
18
|
+
* may change before GA.
|
|
16
19
|
*/
|
|
17
20
|
export { llmEdgeWeigher, stepOutputText, } from './llmEdgeWeigher.js';
|
|
18
21
|
// Interface #3 — missing-context finder (available − sent; confirm by restoration).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/context-bisect/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/context-bisect/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,cAAc,EACd,cAAc,GAIf,MAAM,qBAAqB,CAAC;AAE7B,oFAAoF;AACpF,OAAO,EACL,kBAAkB,GAInB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,GAIpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,GAKb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,gBAAgB,GAOjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,wBAAwB,EACxB,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,UAAU,GAGX,MAAM,eAAe,CAAC;AAEvB,8EAA8E;AAC9E,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjF,gGAAgG;AAChG,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GAItB,MAAM,kBAAkB,CAAC;AAE1B,qGAAqG;AACrG,OAAO,EACL,UAAU,EACV,cAAc,EACd,qBAAqB,GAKtB,MAAM,mBAAmB,CAAC;AAE3B,4EAA4E;AAC5E,6CAA6C;AAC7C,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,GAOd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,cAAc,GAIf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,uBAAuB,GA0BxB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* llmEdgeWeigher — influence-scored `EdgeWeigher` for LLM-call slice edges
|
|
3
|
+
* (RFC-003 Part B, block D7).
|
|
4
|
+
*
|
|
5
|
+
* The gap this fills: footprintjs's causal slice treats every parent of an
|
|
6
|
+
* LLM call equally — a 12-parent hairball (system prompt, history, tool
|
|
7
|
+
* results, cache markers, counters …) gives a debugger 12 equally-plausible
|
|
8
|
+
* leads. D7 turns the hairball into a RANKED shortlist by weighing each
|
|
9
|
+
* parent edge with influence-core's composite (D6): the parent's WRITTEN
|
|
10
|
+
* content vs the LLM call's OUTPUT.
|
|
11
|
+
*
|
|
12
|
+
* Pattern: two-pass adapter over footprintjs's synchronous `EdgeWeigher`
|
|
13
|
+
* hook (A3). Embedding is async, the hook is sync — so the handle
|
|
14
|
+
* PRIMES first (walk an unweighted slice, embed every needed text
|
|
15
|
+
* in deduplicated batches, memoize composites), and `weigh` then
|
|
16
|
+
* answers synchronously from the primed map. `localizeContextBug`
|
|
17
|
+
* drives the two passes; standalone consumers call
|
|
18
|
+
* `prime(dag)` themselves and re-run `causalChain({ weigh })`.
|
|
19
|
+
* Role: `src/lib/context-bisect/` leaf. The engine stays zero-dep — the
|
|
20
|
+
* weigher is consumer-injected exactly as A3 intended.
|
|
21
|
+
*
|
|
22
|
+
* ## Honest claim (§B2)
|
|
23
|
+
*
|
|
24
|
+
* Weights are CORRELATIONAL proxies: deterministic embedding geometry
|
|
25
|
+
* between texts the run already committed — never model internals, never
|
|
26
|
+
* causal attribution (ablation is the causal tier). A weight of 0.93 means
|
|
27
|
+
* "this parent's content is semantically close to what the LLM produced",
|
|
28
|
+
* not "the LLM used it".
|
|
29
|
+
*
|
|
30
|
+
* ## Determinism
|
|
31
|
+
*
|
|
32
|
+
* Same artifacts + same (deterministic) embedder → same weights and same
|
|
33
|
+
* ranking, run after run: texts are built from the commit log in commit
|
|
34
|
+
* order, embedded via influence-core's deduplicated batch, and ties in
|
|
35
|
+
* `rankedParents` keep first-seen (slice BFS) order. Wrap the embedder in
|
|
36
|
+
* `embeddingCache(...)` to also make repeat localizations embed nothing.
|
|
37
|
+
*
|
|
38
|
+
* ## What is weighed
|
|
39
|
+
*
|
|
40
|
+
* DATA edges whose CHILD is an LLM call (`llmCallIds`). Everything else —
|
|
41
|
+
* non-LLM children, control edges (a routing decision's influence is not a
|
|
42
|
+
* semantic-content question) — returns `undefined`, which footprintjs
|
|
43
|
+
* stamps as the default 1.0.
|
|
44
|
+
*
|
|
45
|
+
* ## Redaction posture
|
|
46
|
+
*
|
|
47
|
+
* Texts come exclusively from the COMMIT LOG, which footprintjs scrubs at
|
|
48
|
+
* commit time — a redacted key's committed value IS the placeholder, so
|
|
49
|
+
* the embedder never sees the raw secret.
|
|
50
|
+
*/
|
|
51
|
+
import type { CommitBundle } from 'footprintjs/advanced';
|
|
52
|
+
import type { CausalNode, EdgeWeigher } from 'footprintjs/trace';
|
|
53
|
+
import { type Embedder, type InfluenceWeights } from '../influence-core/index.js';
|
|
54
|
+
export interface LlmEdgeWeigherOptions {
|
|
55
|
+
/**
|
|
56
|
+
* Injected embedder (D6 contract). Wrap in `embeddingCache(...)` so the
|
|
57
|
+
* weigher, the suspect refinement, and any margin/lint consumer share
|
|
58
|
+
* one embedding spend.
|
|
59
|
+
*/
|
|
60
|
+
readonly embedder: Embedder;
|
|
61
|
+
/**
|
|
62
|
+
* runtimeStageIds of LLM-call executions — the children whose parent
|
|
63
|
+
* edges get weighed. Provide explicitly, or extract from captured
|
|
64
|
+
* events with `llmCallIdsFromEvents` (the `stream.llm_start` ids).
|
|
65
|
+
*/
|
|
66
|
+
readonly llmCallIds: Iterable<string>;
|
|
67
|
+
/** The run's commit log — where edge texts are read from. */
|
|
68
|
+
readonly commitLog: readonly CommitBundle[];
|
|
69
|
+
/** Char cap per embedded text. Default 2000. */
|
|
70
|
+
readonly maxTextChars?: number;
|
|
71
|
+
/** Composite weights forwarded to influence-core. Default: paper priors. */
|
|
72
|
+
readonly weights?: InfluenceWeights;
|
|
73
|
+
/**
|
|
74
|
+
* Override the CHILD text (the LLM call's output). Default: the values
|
|
75
|
+
* the child committed, serialized `key=value` in trace order, capped.
|
|
76
|
+
*/
|
|
77
|
+
readonly childTextOf?: (runtimeStageId: string) => string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Override the PARENT text for one edge. Default: the value the parent
|
|
80
|
+
* committed for the edge's key, serialized + capped.
|
|
81
|
+
*/
|
|
82
|
+
readonly parentTextOf?: (runtimeStageId: string, key: string) => string | undefined;
|
|
83
|
+
}
|
|
84
|
+
/** One ranked parent edge of an LLM call (descending weight). */
|
|
85
|
+
export interface RankedParentEdge {
|
|
86
|
+
readonly parentId: string;
|
|
87
|
+
readonly stageName: string;
|
|
88
|
+
readonly key: string;
|
|
89
|
+
/** Influence composite clamped to [0, 1] — a correlational proxy (§B2). */
|
|
90
|
+
readonly weight: number;
|
|
91
|
+
}
|
|
92
|
+
export interface LlmEdgeWeigherHandle {
|
|
93
|
+
/**
|
|
94
|
+
* Pass 1 — walk an (unweighted) causal DAG, embed every LLM-edge text in
|
|
95
|
+
* one deduplicated batch, and memoize composite weights. Idempotent;
|
|
96
|
+
* call again with a different DAG to extend the map.
|
|
97
|
+
*/
|
|
98
|
+
prime(root: CausalNode): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Pass 2 — the synchronous footprintjs `EdgeWeigher`. Returns the primed
|
|
101
|
+
* weight for (LLM child, parent, data key); `undefined` (→ engine
|
|
102
|
+
* default 1.0) for control edges, non-LLM children, and unprimed pairs.
|
|
103
|
+
*/
|
|
104
|
+
readonly weigh: EdgeWeigher;
|
|
105
|
+
/**
|
|
106
|
+
* The D7 acceptance view: an LLM call's parents ranked by weight,
|
|
107
|
+
* descending; ties keep first-seen (slice BFS) order. Empty until
|
|
108
|
+
* `prime` ran over a DAG containing the call.
|
|
109
|
+
*/
|
|
110
|
+
rankedParents(llmCallId: string): readonly RankedParentEdge[];
|
|
111
|
+
/** Texts the embedder was given — exposed for security audits/tests. */
|
|
112
|
+
embeddedTexts(): readonly string[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Default child text: everything the step committed, `key=value` in trace
|
|
116
|
+
* order. For an agent's LLM call this carries the assistant content +
|
|
117
|
+
* tool-call intents — the step's observable OUTPUT.
|
|
118
|
+
*/
|
|
119
|
+
export declare function stepOutputText(commitLog: readonly CommitBundle[], lastIdxOf: Map<string, number>, runtimeStageId: string, maxChars: number): string | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Build the D7 weigher. See module docs for the two-pass contract, the
|
|
122
|
+
* determinism guarantee, and the §B2 honest claim (weights = proxies).
|
|
123
|
+
*/
|
|
124
|
+
export declare function llmEdgeWeigher(options: LlmEdgeWeigherOptions): LlmEdgeWeigherHandle;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* localizeContextBug — the contextual-bug LOCALIZER, "git bisect for
|
|
3
|
+
* context" (RFC-003 Part B, block D8).
|
|
4
|
+
*
|
|
5
|
+
* The five-stage pipeline (each stage is a shipped piece — this file only
|
|
6
|
+
* ASSEMBLES):
|
|
7
|
+
*
|
|
8
|
+
* 1. TRIGGER — an explicit `atStep`, a custom trigger strategy, or
|
|
9
|
+
* the QualityRecorder's lowest-scoring step.
|
|
10
|
+
* 2. SLICE — footprintjs `causalChain` over the commit log, WITH
|
|
11
|
+
* control-dependence edges (D3) and honesty markers
|
|
12
|
+
* (A2/A4) when the artifacts carry them.
|
|
13
|
+
* 3. WEIGH — D7's `llmEdgeWeigher` stamps influence weights on
|
|
14
|
+
* every LLM-call parent edge (two-pass: prime, re-slice).
|
|
15
|
+
* 4. RANK — suspects = slice nodes classified into ablatable
|
|
16
|
+
* context sources (tool / injection / memory / arg),
|
|
17
|
+
* scored by max-product path weight × per-item semantic
|
|
18
|
+
* refinement. CORRELATIONAL tier — and marked so.
|
|
19
|
+
* 5. ABLATE — optional: the consumer's `AblationRunner` re-runs the
|
|
20
|
+
* scenario without each top suspect, N seeded times.
|
|
21
|
+
* Verdicts (the ONLY causal claims, §B2) + variance.
|
|
22
|
+
*
|
|
23
|
+
* Without a runner the report stops at stage 4 with
|
|
24
|
+
* `mode: 'correlational'` — explicitly a ranking of proxies, no causal
|
|
25
|
+
* claim anywhere.
|
|
26
|
+
*
|
|
27
|
+
* Every `source` / `step` id in the report is a plain runtimeStageId —
|
|
28
|
+
* drill any of them with the trace-toolpack tools (`trace_node`,
|
|
29
|
+
* `trace_slice`, `get_value`) over the same artifacts bag.
|
|
30
|
+
*/
|
|
31
|
+
import type { CausalNode } from 'footprintjs/trace';
|
|
32
|
+
import { type Embedder, type InfluenceScorer } from '../influence-core/index.js';
|
|
33
|
+
import type { LoopRecallShortlist } from './loop-recall.js';
|
|
34
|
+
import { type ContextUnit } from './missingContext.js';
|
|
35
|
+
import { type RestorationRerun } from './restoration.js';
|
|
36
|
+
import type { AblationRerun, ContextBugArtifacts, ContextBugReport, Suspect, SuspectDetail, SuspectKind } from './types.js';
|
|
37
|
+
/**
|
|
38
|
+
* Extract LLM-call step ids from captured typed events: the
|
|
39
|
+
* `meta.runtimeStageId` of every `agentfootprint.stream.llm_start`
|
|
40
|
+
* envelope, deduplicated in event order. Collect events with
|
|
41
|
+
* `agent.on('*', (e) => events.push(e))`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function llmCallIdsFromEvents(events: readonly {
|
|
44
|
+
readonly type: string;
|
|
45
|
+
readonly meta: {
|
|
46
|
+
readonly runtimeStageId: string;
|
|
47
|
+
};
|
|
48
|
+
}[]): string[];
|
|
49
|
+
/** A classified-but-unscored suspect produced by a classifier. */
|
|
50
|
+
export interface SuspectSeed {
|
|
51
|
+
readonly kind: SuspectKind;
|
|
52
|
+
readonly detail?: SuspectDetail;
|
|
53
|
+
}
|
|
54
|
+
/** What a classifier sees for one slice node. */
|
|
55
|
+
export interface ClassifyContext {
|
|
56
|
+
readonly node: CausalNode;
|
|
57
|
+
/** Keys this node committed. */
|
|
58
|
+
readonly keysWritten: readonly string[];
|
|
59
|
+
/** Verb-aware value of a key as of this node's last commit. */
|
|
60
|
+
readonly valueOf: (key: string) => unknown;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Pluggable classifier: map one slice node to its ablatable context
|
|
64
|
+
* sources. Return `undefined` to fall through to the default (which
|
|
65
|
+
* understands the agent chart's committed shapes); return `[]` to
|
|
66
|
+
* suppress the node entirely.
|
|
67
|
+
*/
|
|
68
|
+
export type SuspectClassifier = (ctx: ClassifyContext) => readonly SuspectSeed[] | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* The default classifier — reads the node's COMMITTED values (already
|
|
71
|
+
* redaction-scrubbed) and recognizes the agent chart's shapes:
|
|
72
|
+
*
|
|
73
|
+
* - `systemPromptInjections` / `messagesInjections` / `toolsInjections`
|
|
74
|
+
* records with an engineered source → one suspect per `Injection.id`
|
|
75
|
+
* (kind `'memory'` for source `'memory'`, else `'injection'`).
|
|
76
|
+
* - `lastToolResult` → a `'tool'` suspect for the tool that ran.
|
|
77
|
+
* - footprintjs A2 honesty marker `args` → an `'arg'` suspect (the
|
|
78
|
+
* consumer's runner must override the input — nothing to filter).
|
|
79
|
+
* - anything else → the honest `'stage'` fallback (no ablation spec).
|
|
80
|
+
*/
|
|
81
|
+
export declare function defaultSuspectClassifier(ctx: ClassifyContext): readonly SuspectSeed[];
|
|
82
|
+
export interface LocalizeContextBugOptions {
|
|
83
|
+
readonly artifacts: ContextBugArtifacts;
|
|
84
|
+
/** Injected embedder (D6) — wrap in `embeddingCache(...)`. */
|
|
85
|
+
readonly embedder: Embedder;
|
|
86
|
+
/** Explicit trigger step (runtimeStageId). Wins over everything. */
|
|
87
|
+
readonly atStep?: string;
|
|
88
|
+
/** Custom trigger strategy — consulted when `atStep` is absent. */
|
|
89
|
+
readonly trigger?: (artifacts: ContextBugArtifacts) => string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* The counterfactual tier: supply a runner (+ the original output) and
|
|
92
|
+
* top suspects get ablation verdicts. Absent → the report stops at the
|
|
93
|
+
* ranking, marked `mode: 'correlational'`.
|
|
94
|
+
*/
|
|
95
|
+
readonly rerun?: AblationRerun;
|
|
96
|
+
/**
|
|
97
|
+
* Interface #3 — the MISSING-context tier. Supply what was `available` for
|
|
98
|
+
* the turn and what was `sent` to the model; the report's `dropped` lists the
|
|
99
|
+
* units that never reached the model (`available − sent`). Add a `rerun` and
|
|
100
|
+
* each dropped candidate gets a RESTORATION verdict (the mirror of ablation:
|
|
101
|
+
* restoring it flips the outcome → causal). Absent → no `dropped` section.
|
|
102
|
+
*/
|
|
103
|
+
readonly missingContext?: {
|
|
104
|
+
readonly available: readonly ContextUnit[];
|
|
105
|
+
readonly sent: readonly ContextUnit[];
|
|
106
|
+
readonly rerun?: RestorationRerun;
|
|
107
|
+
};
|
|
108
|
+
/** Slice depth budget. Default 12. */
|
|
109
|
+
readonly maxDepth?: number;
|
|
110
|
+
/** Slice node budget. Default 80. */
|
|
111
|
+
readonly maxNodes?: number;
|
|
112
|
+
/** Ranked suspects kept on the report. Default 12. */
|
|
113
|
+
readonly maxSuspects?: number;
|
|
114
|
+
/** Override / extend the suspect classifier. */
|
|
115
|
+
readonly classify?: SuspectClassifier;
|
|
116
|
+
/**
|
|
117
|
+
* The RANK stage's pluggable influence scorer (the suspect-ordering
|
|
118
|
+
* extension point). Default `scoreInfluence` — the FDL four-signal
|
|
119
|
+
* composite. Bring your own `InfluenceScorer` — e.g.
|
|
120
|
+
* `scoreContrastiveInfluence` wrapped with a `referenceText`, or a
|
|
121
|
+
* scorer of your own — to change the ranking ORDER, never causality:
|
|
122
|
+
* a scorer only changes how FAST §B2 ablation confirms a culprit;
|
|
123
|
+
* ablation alone makes the causal claim.
|
|
124
|
+
*/
|
|
125
|
+
readonly scorer?: InfluenceScorer;
|
|
126
|
+
/**
|
|
127
|
+
* L3 narrowing (proposal 006): a per-loop recall shortlist from `shortlistEarlyCulprits`.
|
|
128
|
+
* When supplied, suspects are REORDERED (never filtered) so high-recall candidates float to the
|
|
129
|
+
* top and survive the `maxSuspects` slice → ablation targets them first. Joined on the suspect
|
|
130
|
+
* identity (`detail.injectionId`/`detail.toolName`). Default off (back-compat).
|
|
131
|
+
*/
|
|
132
|
+
readonly shortlist?: LoopRecallShortlist;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Localize a contextual bug: trigger → causal slice → influence-weighted
|
|
136
|
+
* ranking → (optional) counterfactual ablation. See module docs for the
|
|
137
|
+
* pipeline and the §B2 claim tiers.
|
|
138
|
+
*
|
|
139
|
+
* @beta Beta feature — the API may change before GA.
|
|
140
|
+
*
|
|
141
|
+
* @throws when no trigger can be resolved (no `atStep`, no custom
|
|
142
|
+
* strategy hit, no `artifacts.quality`), or when the trigger step
|
|
143
|
+
* is not in the commit log.
|
|
144
|
+
*/
|
|
145
|
+
export declare function localizeContextBug(options: LocalizeContextBugOptions): Promise<ContextBugReport>;
|
|
146
|
+
export declare function suspectLabel(suspect: Suspect): string;
|
|
147
|
+
/**
|
|
148
|
+
* Human-readable report. The claim tiers are spelled out in the output
|
|
149
|
+
* itself (§B2): scores are proxies; verdict lines are the only causal
|
|
150
|
+
* claims; every ⚠ honesty flag prints.
|
|
151
|
+
*/
|
|
152
|
+
export declare function formatContextBugReport(report: ContextBugReport): string;
|
|
@@ -231,6 +231,8 @@ function reorderByShortlist(suspects, shortlist) {
|
|
|
231
231
|
* ranking → (optional) counterfactual ablation. See module docs for the
|
|
232
232
|
* pipeline and the §B2 claim tiers.
|
|
233
233
|
*
|
|
234
|
+
* @beta Beta feature — the API may change before GA.
|
|
235
|
+
*
|
|
234
236
|
* @throws when no trigger can be resolved (no `atStep`, no custom
|
|
235
237
|
* strategy hit, no `artifacts.quality`), or when the trigger step
|
|
236
238
|
* is not in the commit log.
|