agentfootprint 6.44.0 → 7.0.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 +4 -0
- package/CLAUDE.md +4 -0
- package/README.md +141 -167
- package/ai-instructions/claude-code/SKILL.md +11 -0
- package/ai-instructions/setup.sh +0 -0
- package/dist/adapters/llm/BrowserOpenAIProvider.js +1 -1
- package/dist/adapters/llm/MockProvider.js +2 -1
- package/dist/adapters/llm/MockProvider.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/debug/finders.js +29 -0
- package/dist/debug/finders.js.map +1 -0
- package/dist/debug.js +134 -0
- package/dist/debug.js.map +1 -0
- 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/BrowserOpenAIProvider.js +1 -1
- package/dist/esm/adapters/llm/MockProvider.d.ts +154 -0
- package/dist/esm/adapters/llm/MockProvider.js +2 -1
- package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
- 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/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/debug/finders.d.ts +12 -0
- package/dist/esm/debug/finders.js +13 -0
- package/dist/esm/debug/finders.js.map +1 -0
- package/dist/esm/debug.d.ts +25 -0
- package/dist/esm/debug.js +54 -0
- package/dist/esm/debug.js.map +1 -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/events.d.ts +18 -0
- package/dist/esm/events.js +22 -0
- package/dist/esm/events.js.map +1 -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 +44 -0
- package/dist/esm/index.js +7 -52
- 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 +2 -1
- 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 +290 -0
- package/dist/esm/lib/injection-engine/skillGraph.js +38 -43
- 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/defineRAG.js +3 -3
- package/dist/esm/lib/rag/index.d.ts +7 -0
- package/dist/esm/lib/rag/indexDocuments.d.ts +106 -0
- package/dist/esm/lib/rag/indexDocuments.js +2 -1
- package/dist/esm/lib/rag/indexDocuments.js.map +1 -1
- 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 +141 -0
- package/dist/esm/locales/index.js +7 -0
- package/dist/esm/locales/index.js.map +1 -1
- 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 +134 -0
- package/dist/esm/memory/causal/types.js.map +1 -1
- 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 +278 -0
- package/dist/esm/memory/define.types.js +6 -4
- package/dist/esm/memory/define.types.js.map +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 +57 -0
- package/dist/esm/observe.js +7 -36
- 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/providers.js +1 -1
- package/dist/esm/providers.js.map +1 -1
- 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/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/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/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 +54 -0
- package/dist/esm/status.js +13 -4
- package/dist/esm/status.js.map +1 -1
- 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/events.js +42 -0
- package/dist/events.js.map +1 -0
- package/dist/index.js +7 -117
- 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 +6 -2
- package/dist/lib/injection-engine/index.js.map +1 -1
- package/dist/lib/injection-engine/skillGraph.js +40 -45
- package/dist/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/lib/injection-engine/types.js.map +1 -1
- package/dist/lib/rag/defineRAG.js +3 -3
- package/dist/lib/rag/indexDocuments.js +2 -1
- package/dist/lib/rag/indexDocuments.js.map +1 -1
- package/dist/locales/index.js +2 -1
- package/dist/locales/index.js.map +1 -1
- package/dist/memory/causal/types.js.map +1 -1
- package/dist/memory/define.types.js +6 -4
- package/dist/memory/define.types.js.map +1 -1
- package/dist/observe.js +22 -115
- package/dist/observe.js.map +1 -1
- package/dist/providers.js +3 -1
- package/dist/providers.js.map +1 -1
- package/dist/status.js +13 -5
- package/dist/status.js.map +1 -1
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts +1 -1
- package/dist/types/adapters/llm/MockProvider.d.ts +2 -1
- package/dist/types/adapters/llm/MockProvider.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/debug/finders.d.ts +13 -0
- package/dist/types/debug/finders.d.ts.map +1 -0
- package/dist/types/debug.d.ts +26 -0
- package/dist/types/debug.d.ts.map +1 -0
- package/dist/types/events.d.ts +19 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -24
- 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 +2 -1
- package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillGraph.d.ts +24 -26
- 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/lib/rag/defineRAG.d.ts +3 -3
- package/dist/types/lib/rag/indexDocuments.d.ts +2 -1
- package/dist/types/lib/rag/indexDocuments.d.ts.map +1 -1
- package/dist/types/locales/index.d.ts +9 -0
- package/dist/types/locales/index.d.ts.map +1 -1
- package/dist/types/memory/causal/types.d.ts +13 -9
- package/dist/types/memory/causal/types.d.ts.map +1 -1
- package/dist/types/memory/define.types.d.ts +6 -4
- package/dist/types/memory/define.types.d.ts.map +1 -1
- package/dist/types/observe.d.ts +1 -6
- package/dist/types/observe.d.ts.map +1 -1
- package/dist/types/providers.d.ts +2 -2
- package/dist/types/providers.d.ts.map +1 -1
- package/dist/types/status.d.ts +10 -4
- package/dist/types/status.d.ts.map +1 -1
- package/dist/types/tool-providers/index.d.ts +1 -1
- package/dist/types/tool-providers/index.d.ts.map +1 -1
- package/package.json +261 -57
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agentfootprint — public barrel.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: Facade (GoF) over the typed sublayers.
|
|
5
|
+
* Role: Single entry point consumers import from.
|
|
6
|
+
* Emits: N/A.
|
|
7
|
+
*/
|
|
8
|
+
import './cache/strategies/AnthropicCacheStrategy.js';
|
|
9
|
+
import './cache/strategies/OpenAICacheStrategy.js';
|
|
10
|
+
import './cache/strategies/BedrockCacheStrategy.js';
|
|
11
|
+
export type { CombinedRecorder, ScopeRecorder, FlowRecorder, EmitRecorder, WriteEvent, ReadEvent, CommitEvent, StageEvent, ErrorEvent, FlowStageEvent, FlowNextEvent, FlowDecisionEvent, FlowForkEvent, FlowSelectedEvent, FlowSubflowEvent, FlowSubflowRegisteredEvent, FlowLoopEvent, FlowBreakEvent, FlowErrorEvent, TraversalContext, EmitEvent, RedactionPolicy, RedactionReport, } from 'footprintjs';
|
|
12
|
+
export * from './adapters/types.js';
|
|
13
|
+
export { INJECTION_KEYS, injectionKeyForSlot, isInjectionKey, type InjectionKey, stageRole, type StageRole, milestoneFor, type Milestone, type MilestoneKind, } from './conventions.js';
|
|
14
|
+
export { COMPOSITION_KEYS, type BudgetPressureRecord, type CompositionKey, type EvictionRecord, type InjectionRecord, type SlotComposition, } from './recorders/core/types.js';
|
|
15
|
+
export { type RunContext, } from './bridge/eventMeta.js';
|
|
16
|
+
export { contextEngineering, isEngineeredSource, isBaselineSource, ENGINEERED_SOURCES, BASELINE_SOURCES, type ContextEngineeringHandle, type ContextEngineeringUnsubscribe, type ContextInjectedEvent, type ContextInjectedListener, } from './recorders/core/contextEngineering.js';
|
|
17
|
+
export type { EmittedEvent, EnableNamespace, Runner } from './core/runner.js';
|
|
18
|
+
export { RunnerBase, makeRunId } from './core/RunnerBase.js';
|
|
19
|
+
export type { GroupKind, GroupMember, GroupMetadata, GroupTranslator } from './core/translator.js';
|
|
20
|
+
export { pauseHere, askHuman, isPauseRequest, isPaused, type RunnerPauseOutcome, } from './core/pause.js';
|
|
21
|
+
export type { FlowchartHandle, FlowchartOptions, } from './recorders/observability/FlowchartRecorder.js';
|
|
22
|
+
export { defaultCommentaryTemplates, extractAgentName, extractCommentaryVars, renderCommentary, selectCommentaryKey, type CommentaryContext, type CommentaryTemplates, } from './recorders/observability/commentary/commentaryTemplates.js';
|
|
23
|
+
export { LLMCall, LLMCallBuilder, type LLMCallInput, type LLMCallOptions, type LLMCallOutput, } from './core/LLMCall.js';
|
|
24
|
+
export { type MessageApiChartDeps, } from './core/agent/buildMessageApiChart.js';
|
|
25
|
+
export { buildAgentMessageApiChart, type AgentMessageApiChartDeps, } from './core/agent/buildAgentMessageApiChart.js';
|
|
26
|
+
export { Agent, AgentBuilder, type AgentInput, type AgentOptions, type AgentOutput, type ObserverDeliveryOptions, } from './core/Agent.js';
|
|
27
|
+
export type { SelfExplainOptions } from './lib/trace-toolpack/selfExplain.js';
|
|
28
|
+
export type { ObserverDrainResult, ObserverStats } from 'footprintjs';
|
|
29
|
+
export type { ToolArgValidationMode } from './core/agent/toolArgsValidation.js';
|
|
30
|
+
export type { ReadSummaryMarker, ReadTrackingMode } from 'footprintjs';
|
|
31
|
+
export { OutputSchemaError, applyOutputSchema, type OutputSchemaParser, type OutputSchemaOptions, } from './core/outputSchema.js';
|
|
32
|
+
export { type OutputFallbackOptions, type OutputFallbackFn } from './core/outputFallback.js';
|
|
33
|
+
export { RunCheckpointError, type AgentRunCheckpoint } from './core/runCheckpoint.js';
|
|
34
|
+
export { flowchartAsTool, type FlowchartAsToolOptions, type FlowchartResultMapper, type FlowchartToolSnapshot, } from './core/flowchartAsTool.js';
|
|
35
|
+
export type { Tool, ToolExecutionContext, ToolRegistryEntry, DefineToolOptions, } from './core/tools.js';
|
|
36
|
+
export { defineTool, assertValidToolName, warnIfInvalidToolName } from './core/tools.js';
|
|
37
|
+
export { toolContractCheckup, formatToolContractCheckup, type ToolContractCheckup, type ToolContractProblem, type ToolContractCode, type ServerToolEntry, } from './core/toolContract.js';
|
|
38
|
+
export { Sequence, SequenceBuilder, type SequenceInput, type SequenceOptions, type SequenceOutput, } from './core-flow/Sequence.js';
|
|
39
|
+
export { Parallel, ParallelBuilder, type BranchOutcome, type MergeFn, type MergeOutcomesFn, type MergeWithLLMOptions, type ParallelBranchOptions, type ParallelInput, type ParallelOptions, type ParallelOutput, } from './core-flow/Parallel.js';
|
|
40
|
+
export { Conditional, ConditionalBuilder, type ConditionalInput, type ConditionalOptions, type ConditionalOutput, type Predicate, } from './core-flow/Conditional.js';
|
|
41
|
+
export { Loop, LoopBuilder, type LoopInput, type LoopOptions, type LoopOutput, type UntilGuard, } from './core-flow/Loop.js';
|
|
42
|
+
export { providerFromEnv, type ProviderKind, type CreateProviderOptions, type ProviderFromEnv, } from './adapters/llm/createProvider.js';
|
|
43
|
+
export * from './patterns/index.js';
|
|
44
|
+
export { defineRAG, type DefineRAGOptions, indexDocuments, type IndexDocumentsOptions, type RagDocument, } from './lib/rag/index.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
import './cache/strategies/AnthropicCacheStrategy.js';
|
|
15
15
|
import './cache/strategies/OpenAICacheStrategy.js';
|
|
16
16
|
import './cache/strategies/BedrockCacheStrategy.js';
|
|
17
|
-
// Events — registry, types, payloads
|
|
18
|
-
export * from './events/types.js';
|
|
19
|
-
export { EVENT_NAMES, ALL_EVENT_TYPES, } from './events/registry.js';
|
|
20
|
-
// Dispatcher
|
|
21
|
-
export { EventDispatcher, } from './events/dispatcher.js';
|
|
22
17
|
// Adapter interfaces (ports)
|
|
23
18
|
export * from './adapters/types.js';
|
|
24
19
|
// Injection keys + recorder authoring helpers — needed by anyone writing
|
|
@@ -40,8 +35,6 @@ milestoneFor, } from './conventions.js';
|
|
|
40
35
|
// API. Library code reaches them via the relative `./conventions.js`
|
|
41
36
|
// import; downstream code should never need them.
|
|
42
37
|
export { COMPOSITION_KEYS, } from './recorders/core/types.js';
|
|
43
|
-
// Bridge helper
|
|
44
|
-
export { buildEventMeta, parseSubflowPath } from './bridge/eventMeta.js';
|
|
45
38
|
// Context-engineering + emit primitives.
|
|
46
39
|
//
|
|
47
40
|
// The observability recorder FACTORIES (ContextRecorder, streamRecorder,
|
|
@@ -52,8 +45,6 @@ export { buildEventMeta, parseSubflowPath } from './bridge/eventMeta.js';
|
|
|
52
45
|
// ONLY under `agentfootprint/observe` — the dedicated observability subpath —
|
|
53
46
|
// so the main barrel stays focused on the core agent API.
|
|
54
47
|
export { contextEngineering, isEngineeredSource, isBaselineSource, ENGINEERED_SOURCES, BASELINE_SOURCES, } from './recorders/core/contextEngineering.js';
|
|
55
|
-
export { EmitBridge } from './recorders/core/EmitBridge.js';
|
|
56
|
-
export { typedEmit } from './recorders/core/typedEmit.js';
|
|
57
48
|
export { RunnerBase, makeRunId } from './core/RunnerBase.js';
|
|
58
49
|
// Pause/Resume primitives — consumer API for human-in-the-loop tools.
|
|
59
50
|
// `PauseRequest` (the throwable signal class) stays internal; consumers
|
|
@@ -64,7 +55,11 @@ export { pauseHere, askHuman, isPauseRequest, isPaused, } from './core/pause.js'
|
|
|
64
55
|
// Commentary — bundled prose templates + engine for narrating a run.
|
|
65
56
|
// Consumers ship their own JSON locale / brand voice via the same
|
|
66
57
|
// shape; viewers (Lens, CLI tail, log file) consume this surface.
|
|
67
|
-
export { defaultCommentaryTemplates,
|
|
58
|
+
export { defaultCommentaryTemplates,
|
|
59
|
+
// Commentary engine helpers — advanced surface consumed by viewer
|
|
60
|
+
// libraries (agentfootprint-lens) to render run narration. Not the
|
|
61
|
+
// everyday API, but de-facto public: keep exported.
|
|
62
|
+
extractAgentName, extractCommentaryVars, renderCommentary, selectCommentaryKey, } from './recorders/observability/commentary/commentaryTemplates.js';
|
|
68
63
|
// Status — chat-bubble surface (separate audience: the end user
|
|
69
64
|
// chatting; renamed from "thinking" in 5.0.0 to disambiguate from the
|
|
70
65
|
// MODEL's extended-thinking reasoning). State machine:
|
|
@@ -73,20 +68,15 @@ export { defaultCommentaryTemplates, extractAgentName, extractCommentaryVars, re
|
|
|
73
68
|
// supported, missing keys ignored) but a different vocabulary —
|
|
74
69
|
// first-person status, mid-call only. Per-tool keys (`tool.<toolName>`)
|
|
75
70
|
// win over the generic `tool` key.
|
|
76
|
-
export { defaultStatusTemplates, selectStatus, renderStatusLine, } from './recorders/observability/status/statusTemplates.js';
|
|
77
71
|
// Primitives (core/)
|
|
78
72
|
export { LLMCall, LLMCallBuilder, } from './core/LLMCall.js';
|
|
79
|
-
// messageAPI merge-tree proof chart (LLM-only) — Context-selector → slot
|
|
80
|
-
// subflows → messageAPI assembly stage → Call-LLM. The locked shape that
|
|
81
|
-
// will later serve both Static and Dynamic agents. See buildMessageApiChart.
|
|
82
|
-
export { buildMessageApiChart, } from './core/agent/buildMessageApiChart.js';
|
|
83
73
|
// Agent (ReAct) form of the merge-tree — Context root selector → two-stage
|
|
84
74
|
// convergence: [sf-message-api (system-prompt+messages → messageAPI), sf-tools]
|
|
85
75
|
// → Call-LLM → route → [tool-exec → loop] / final. tools + the loop are the
|
|
86
76
|
// only additions over buildMessageApiChart. See buildAgentMessageApiChart.
|
|
87
77
|
export { buildAgentMessageApiChart, } from './core/agent/buildAgentMessageApiChart.js';
|
|
88
78
|
export { Agent, AgentBuilder, } from './core/Agent.js';
|
|
89
|
-
export { OutputSchemaError, applyOutputSchema,
|
|
79
|
+
export { OutputSchemaError, applyOutputSchema, } from './core/outputSchema.js';
|
|
90
80
|
export { RunCheckpointError } from './core/runCheckpoint.js';
|
|
91
81
|
export { flowchartAsTool, } from './core/flowchartAsTool.js';
|
|
92
82
|
export { defineTool, assertValidToolName, warnIfInvalidToolName } from './core/tools.js';
|
|
@@ -119,25 +109,10 @@ export { Loop, LoopBuilder, } from './core-flow/Loop.js';
|
|
|
119
109
|
//
|
|
120
110
|
// import { AnthropicProvider } from 'agentfootprint'; // ❌ not exported
|
|
121
111
|
// import { AnthropicProvider } from 'agentfootprint/llm-providers'; // ✓ canonical
|
|
122
|
-
export {
|
|
123
|
-
export { browserAnthropic, BrowserAnthropicProvider, } from './adapters/llm/BrowserAnthropicProvider.js';
|
|
124
|
-
export { browserOpenai, BrowserOpenAIProvider, browserAzureOpenai, BrowserAzureOpenAIProvider, } from './adapters/llm/BrowserOpenAIProvider.js';
|
|
125
|
-
export { createProvider, providerFromEnv, } from './adapters/llm/createProvider.js';
|
|
112
|
+
export { providerFromEnv, } from './adapters/llm/createProvider.js';
|
|
126
113
|
// Streaming helpers — agent events → SSE for browser delivery.
|
|
127
|
-
export { toSSE, SSEFormatter, encodeSSE } from './stream.js';
|
|
128
114
|
// Injection Engine — the unifying primitive of context engineering.
|
|
129
115
|
// One Injection type, four sugar factories, one engine subflow.
|
|
130
|
-
export {
|
|
131
|
-
// Engine
|
|
132
|
-
evaluateInjections, buildInjectionEngineSubflow, projectActiveInjection,
|
|
133
|
-
// Sugar factories — one per injection flavor
|
|
134
|
-
defineInstruction, defineRelevanceHint, defineSkill, resolveSurfaceMode, SkillRegistry, buildListSkillsTool, buildReadSkillTool, defineSteering, defineFact,
|
|
135
|
-
// Unified factory (type-discriminant over the four named factories above)
|
|
136
|
-
defineInjection,
|
|
137
|
-
// Declarative skill graph (proposal 002)
|
|
138
|
-
skillGraph, decide, SKILL_GRAPH_METADATA_KEY,
|
|
139
|
-
// Proposal 009 Tier 1 — skill-body ↔ tool-contract consistency check
|
|
140
|
-
checkSkillContract, checkSkillContracts, skillToolNames, } from './lib/injection-engine/index.js';
|
|
141
116
|
// Patterns — factory functions composing primitives + core-flow into
|
|
142
117
|
// well-known agent patterns from the research literature.
|
|
143
118
|
export * from './patterns/index.js';
|
|
@@ -146,22 +121,6 @@ export * from './patterns/index.js';
|
|
|
146
121
|
// the most-used factories; the full subsystem (including types that
|
|
147
122
|
// would collide with adapter types like MemoryStore) is reachable via
|
|
148
123
|
// the `agentfootprint/memory` subpath import.
|
|
149
|
-
export {
|
|
150
|
-
// Pipelines
|
|
151
|
-
defaultPipeline, ephemeralPipeline, factPipeline, narrativePipeline, semanticPipeline, autoPipeline, } from './memory/pipeline/index.js';
|
|
152
|
-
export {
|
|
153
|
-
// Beat extractors
|
|
154
|
-
heuristicExtractor, llmExtractor, } from './memory/beats/index.js';
|
|
155
|
-
export {
|
|
156
|
-
// Fact extractors
|
|
157
|
-
patternFactExtractor, llmFactExtractor, } from './memory/facts/index.js';
|
|
158
|
-
export {
|
|
159
|
-
// Layered memory API — consumer-facing factory + const-objects
|
|
160
|
-
defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, MEMORY_TIMING, SNAPSHOT_PROJECTIONS,
|
|
161
|
-
// Reference implementations + helpers consumers reach for daily.
|
|
162
|
-
// Real-backend adapters (Redis, Postgres, Pinecone, ...) ship as
|
|
163
|
-
// separate subpath exports.
|
|
164
|
-
InMemoryStore, mockEmbedder, identityNamespace, } from './memory/index.js';
|
|
165
124
|
// RAG — retrieval-augmented generation as a context-engineering flavor.
|
|
166
125
|
// Thin sugar over `defineMemory({ type: SEMANTIC, strategy: TOP_K })`
|
|
167
126
|
// plus the `indexDocuments` helper for seeding the corpus at startup.
|
|
@@ -170,19 +129,15 @@ export { defineRAG, indexDocuments, } from './lib/rag/index.js';
|
|
|
170
129
|
// expose their tools as agentfootprint Tool[] for `agent.tools(...)`.
|
|
171
130
|
// `@modelcontextprotocol/sdk` is a lazy-required peer-dep (no runtime
|
|
172
131
|
// cost when MCP isn't used).
|
|
173
|
-
export { mcpClient, mockMcpClient, } from './lib/mcp/index.js';
|
|
174
132
|
// Tool dispatch primitives (v2.5+). New `agentfootprint/tool-providers`
|
|
175
133
|
// subpath bundles tool sources (mcpClient / mockMcpClient) with tool
|
|
176
134
|
// dispatch primitives (staticTools / gatedTools) so consumers find
|
|
177
135
|
// "everything tool-related" in one place. Top-level barrel re-exports
|
|
178
136
|
// the dispatch primitives too — `mcpClient` already re-exports above.
|
|
179
|
-
export { staticTools, gatedTools, skillScopedTools, } from './tool-providers/index.js';
|
|
180
137
|
// Cross-cutting authorization (v2.5+). `agentfootprint/security` is the
|
|
181
138
|
// dedicated subpath; the root barrel also re-exports `PermissionPolicy`
|
|
182
139
|
// so existing v2.4 consumers find it at the top level.
|
|
183
|
-
export { PermissionPolicy, PolicyHaltError, } from './security/index.js';
|
|
184
140
|
// Message Catalog Pattern (v2.5+). `agentfootprint/locales` is the
|
|
185
141
|
// dedicated subpath; the root barrel also re-exports the helpers so
|
|
186
142
|
// existing v2.4 consumers find them at the top level.
|
|
187
|
-
export { defaultCommentaryMessages, defaultThinkingMessages, composeMessages, validateMessages, } from './locales/index.js';
|
|
188
143
|
//# sourceMappingURL=index.js.map
|
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,sEAAsE;AACtE,sDAAsD;AACtD,OAAO,8CAA8C,CAAC;AACtD,OAAO,2CAA2C,CAAC;AACnD,OAAO,4CAA4C,CAAC;AAsCpD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -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"}
|