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,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toBacktrackTrace — serialize a ContextBugReport into the BacktrackTrace
|
|
3
|
+
* shape that agentThinkingUI's <BacktrackView>/<BacktrackOverlay> renders
|
|
4
|
+
* (the "why?" board: suspects → influence meters → ablation stamps →
|
|
5
|
+
* chain-of-custody rewind).
|
|
6
|
+
*
|
|
7
|
+
* Pure mapping, no UI dependency — the BacktrackTrace interfaces below
|
|
8
|
+
* MIRROR agentthinkingui's `types/index.d.ts` contract; both sides are
|
|
9
|
+
* framework-agnostic JSON. The report carries everything except two
|
|
10
|
+
* things only the caller knows:
|
|
11
|
+
*
|
|
12
|
+
* - `answer` (REQUIRED): the report localizes a decision but does not
|
|
13
|
+
* hold the decision's output text — pass what the agent said/chose.
|
|
14
|
+
* - `custody` (optional): the rewind player replays RECORDED STATE
|
|
15
|
+
* (the assembled prompt, the mutating commit). That content lives in
|
|
16
|
+
* the caller's artifacts (snapshot/events), not in the report — pass
|
|
17
|
+
* a callback to enrich confirmed suspects with evidence panes.
|
|
18
|
+
*
|
|
19
|
+
* Honesty is preserved, not added: ranks are TRUE report positions even
|
|
20
|
+
* when the cards are a subset (`rank`), path-only scores carry
|
|
21
|
+
* `upperBound` (hatched meter + starred value in the UI), honesty flags
|
|
22
|
+
* map verbatim, and the claims-discipline lines ride along. The mapper
|
|
23
|
+
* never invents a causal claim: `verdict` exists only where the report's
|
|
24
|
+
* ablation produced one ('inconclusive' maps to NO stamp, not a verdict).
|
|
25
|
+
*/
|
|
26
|
+
import type { ContextBugReport, Suspect } from './types.js';
|
|
27
|
+
export interface BacktrackCustodyHop {
|
|
28
|
+
readonly step: string;
|
|
29
|
+
readonly detail: string;
|
|
30
|
+
readonly at?: string;
|
|
31
|
+
readonly variable?: string;
|
|
32
|
+
/** recorded state at this hop — prompt text, commit payload, code, rule operands */
|
|
33
|
+
readonly content?: string;
|
|
34
|
+
/** exact substring of `content` highlighted as the culprit span */
|
|
35
|
+
readonly highlight?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface BacktrackHop {
|
|
38
|
+
readonly key: string;
|
|
39
|
+
readonly kind?: 'data' | 'control';
|
|
40
|
+
readonly via?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface BacktrackSuspectCard {
|
|
43
|
+
readonly kind: string;
|
|
44
|
+
readonly flavor?: string;
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly text?: string;
|
|
47
|
+
readonly score: number;
|
|
48
|
+
/** true position in the report's ranking (cards may be a subset) */
|
|
49
|
+
readonly rank: number;
|
|
50
|
+
/** score is a path-only upper bound — no content signal */
|
|
51
|
+
readonly upperBound?: boolean;
|
|
52
|
+
/** the hop adjacent to the suspect (what fed the decision side) */
|
|
53
|
+
readonly edge?: {
|
|
54
|
+
readonly key?: string;
|
|
55
|
+
readonly weight?: number;
|
|
56
|
+
readonly kind?: 'data' | 'control';
|
|
57
|
+
};
|
|
58
|
+
/** the full hop chain, decision → suspect (multi-hop paths only) */
|
|
59
|
+
readonly path?: readonly BacktrackHop[];
|
|
60
|
+
readonly bornAt?: {
|
|
61
|
+
readonly id: string;
|
|
62
|
+
readonly label?: string;
|
|
63
|
+
readonly via?: string;
|
|
64
|
+
};
|
|
65
|
+
readonly custody?: readonly BacktrackCustodyHop[];
|
|
66
|
+
readonly verdict?: {
|
|
67
|
+
readonly kind: 'confirmed' | 'not-confirmed';
|
|
68
|
+
readonly flips?: number;
|
|
69
|
+
readonly samples?: number;
|
|
70
|
+
readonly claim?: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface BacktrackTrail {
|
|
74
|
+
readonly title?: string;
|
|
75
|
+
readonly custody?: readonly BacktrackCustodyHop[];
|
|
76
|
+
readonly claim?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface BacktrackTrace {
|
|
79
|
+
readonly claim: string;
|
|
80
|
+
readonly mode: 'causal' | 'correlational';
|
|
81
|
+
readonly modeLabel?: string;
|
|
82
|
+
readonly agent?: string;
|
|
83
|
+
readonly model?: string;
|
|
84
|
+
readonly answer: {
|
|
85
|
+
readonly text: string;
|
|
86
|
+
readonly label?: string;
|
|
87
|
+
readonly tone?: 'error' | 'question';
|
|
88
|
+
};
|
|
89
|
+
readonly decidedAt: {
|
|
90
|
+
readonly id: string;
|
|
91
|
+
readonly label?: string;
|
|
92
|
+
readonly kind?: 'llm' | 'rule';
|
|
93
|
+
};
|
|
94
|
+
readonly suspects: readonly BacktrackSuspectCard[];
|
|
95
|
+
readonly trail?: BacktrackTrail;
|
|
96
|
+
readonly folded?: string;
|
|
97
|
+
readonly scoreNote?: string;
|
|
98
|
+
readonly baseline?: string;
|
|
99
|
+
readonly honesty?: readonly string[];
|
|
100
|
+
}
|
|
101
|
+
export interface ToBacktrackTraceOptions {
|
|
102
|
+
/** The decision's output text — the report doesn't hold it. */
|
|
103
|
+
readonly answer: {
|
|
104
|
+
readonly text: string;
|
|
105
|
+
readonly label?: string;
|
|
106
|
+
readonly tone?: 'error' | 'question';
|
|
107
|
+
};
|
|
108
|
+
/** Headline question. Default: derived from the trigger step. */
|
|
109
|
+
readonly claim?: string;
|
|
110
|
+
/** 'rule' renders the decision diamond instead of the brain. Default 'llm'. */
|
|
111
|
+
readonly decidedAtKind?: 'llm' | 'rule';
|
|
112
|
+
/** Override the mode chip (e.g. "exact chain · proxy ranking"). */
|
|
113
|
+
readonly modeLabel?: string;
|
|
114
|
+
readonly agent?: string;
|
|
115
|
+
readonly model?: string;
|
|
116
|
+
/** Max suspect cards. Default 6. The rest fold into one disclosed line. */
|
|
117
|
+
readonly maxSuspects?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Card selection when the report has more suspects than `maxSuspects`.
|
|
120
|
+
* Default TRUE: content-evidence suspects fill the cards first (they are
|
|
121
|
+
* what a human can act on), structural path-only hops fold — but every
|
|
122
|
+
* card keeps its TRUE report rank, and the folded line discloses what
|
|
123
|
+
* was left out and that it ranked where it ranked. FALSE: strictly the
|
|
124
|
+
* report's top-N.
|
|
125
|
+
*/
|
|
126
|
+
readonly preferContentEvidence?: boolean;
|
|
127
|
+
/** Enrich a suspect's chain of custody with recorded-state panes. */
|
|
128
|
+
readonly custody?: (suspect: Suspect, trueRank: number) => readonly BacktrackCustodyHop[] | undefined;
|
|
129
|
+
/** Exact recorded hops for deterministic decisions (no ablation verdict). */
|
|
130
|
+
readonly trail?: BacktrackTrail;
|
|
131
|
+
/** Override the auto score note (top-2 margin tie warning). */
|
|
132
|
+
readonly scoreNote?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Serialize a localizer report for agentThinkingUI's BacktrackView.
|
|
136
|
+
* See module doc — `answer` is required; `custody` enriches the rewind.
|
|
137
|
+
*/
|
|
138
|
+
export declare function toBacktrackTrace(report: ContextBugReport, opts: ToBacktrackTraceOptions): BacktrackTrace;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* trajectory — the per-loop trajectory assembler (proposal 005).
|
|
3
|
+
*
|
|
4
|
+
* Slices a recorded ReAct run's commit log into ordered LoopFrames — one per
|
|
5
|
+
* iteration — so the two-score localizer (L2), the recall scorer (L3), and the
|
|
6
|
+
* backtracking debugger (L4) read the same per-loop substrate instead of one
|
|
7
|
+
* flattened bag. PURE + read-only (NOT a recorder, Convention 1): the loop-level
|
|
8
|
+
* peer of `causalChain` / `commitValueAt` / `stepOutputText`.
|
|
9
|
+
*
|
|
10
|
+
* Pieces:
|
|
11
|
+
* - `bucketByAnchors` — the domain-agnostic HEAD-range partition (pure, total);
|
|
12
|
+
* - `findLoopHeads` — the flat-chart loop-head detector (one head per injection-engine entry);
|
|
13
|
+
* - `assembleTrajectory` — the agent-flavored projection (call-llm pointer + intermediate
|
|
14
|
+
* text + live contextSources via findLastWriter/commitValueAt).
|
|
15
|
+
*
|
|
16
|
+
* Handles BOTH chart shapes:
|
|
17
|
+
* - FLAT (`buildAgentChart`, default `reactMode: 'dynamic'`): `call-llm` is a parent-level
|
|
18
|
+
* stage; frames are bucketed over the RUN commit log by injection-engine loop heads.
|
|
19
|
+
* - GROUPED (`buildDynamicAgentChart`, `reactMode: 'dynamic-grouped'`): the LLM turn runs in
|
|
20
|
+
* an `sf-llm-call` subflow whose inner commits live in `subflowResults['sf-llm-call#k']`,
|
|
21
|
+
* retained PER-ITERATION by footprintjs subflow-commit-visibility (≥ d458898). Each loop is
|
|
22
|
+
* projected PER-SCOPE over its own inner commit log — no cross-scope merge, so the slice
|
|
23
|
+
* primitives run correctly over the isolated log. Such frames carry `subflowScope`.
|
|
24
|
+
*/
|
|
25
|
+
import type { CommitBundle } from 'footprintjs/advanced';
|
|
26
|
+
import type { UntrackedSource } from 'footprintjs/trace';
|
|
27
|
+
import type { EvidenceInput } from '../influence-core/index.js';
|
|
28
|
+
import { type ContextBugArtifacts, type HonestyFlag } from './types.js';
|
|
29
|
+
/** One source the loop's `call-llm` read, traced back to its live writer for THAT loop. */
|
|
30
|
+
export interface ContextSource {
|
|
31
|
+
/** The state key call-llm#k read (e.g. 'systemPromptInjections'). */
|
|
32
|
+
readonly key: string;
|
|
33
|
+
/** runtimeStageId of the live writer (findLastWriter); undefined when never committed before. */
|
|
34
|
+
readonly writerId: string | undefined;
|
|
35
|
+
/** The writer's commitLog ARRAY position — NOT the optional CommitBundle.idx. */
|
|
36
|
+
readonly writerArrayIdx: number | undefined;
|
|
37
|
+
/** Materialized live value (commitValueAt); undefined under the pre-run-initial blind spot. */
|
|
38
|
+
readonly value: unknown;
|
|
39
|
+
/** The bridge handed to scorers: { id, text, ancestorTexts }. */
|
|
40
|
+
readonly evidence: EvidenceInput;
|
|
41
|
+
}
|
|
42
|
+
/** One ReAct iteration — bounded by the loop HEAD, pointing at the call-llm inside it. */
|
|
43
|
+
export interface LoopFrame {
|
|
44
|
+
/** Anchor ordinal 0,1,2… DERIVED from the commit log (NOT TraversalContext.loopIteration). */
|
|
45
|
+
readonly loopIndex: number;
|
|
46
|
+
/** The call-llm#k runtimeStageId — the LLM-step pointer WITHIN the frame. */
|
|
47
|
+
readonly llmCallId: string | undefined;
|
|
48
|
+
/** call-llm#k's commitLog array index — the EXCLUSIVE beforeIdx for findLastWriter. */
|
|
49
|
+
readonly llmCallArrayIdx: number | undefined;
|
|
50
|
+
/** The loop-HEAD commit's array index — the body's lower bound. */
|
|
51
|
+
readonly headArrayIdx: number;
|
|
52
|
+
/** Every runtimeStageId in [head[k], head[k+1]) — the full multi-stage body of round k, in commit order. */
|
|
53
|
+
readonly bodyIds: readonly string[];
|
|
54
|
+
/** stepOutputText over the call-llm commit (assistant content + tool-call intents). */
|
|
55
|
+
readonly intermediateText: string | undefined;
|
|
56
|
+
/** One per key call-llm#k read. */
|
|
57
|
+
readonly contextSources: readonly ContextSource[];
|
|
58
|
+
/**
|
|
59
|
+
* WALK-ONLY (proposal 008): the proximate tool result for this loop — the most recent
|
|
60
|
+
* `lastToolResult` committed before this loop's call-llm, with the PRODUCING loop's tool-calls
|
|
61
|
+
* stage as its `writerId` (the cross-loop provenance edge L4's `walkToRoot` descends along). NOT
|
|
62
|
+
* in `contextSources` — L3's narrow never scores it. Absent on loop 0 / grouped frames.
|
|
63
|
+
*/
|
|
64
|
+
readonly proximateToolSource?: ProximateToolSource;
|
|
65
|
+
/**
|
|
66
|
+
* GROUPED chart only: the `sf-llm-call` mount runtimeStageId this frame was projected from.
|
|
67
|
+
* When set, ALL array indices on this frame (`headArrayIdx`, `llmCallArrayIdx`,
|
|
68
|
+
* `bodyIds`, each `contextSource.writerArrayIdx`) are relative to that subflow's OWN inner
|
|
69
|
+
* commit log (`subflowResults[subflowScope].treeContext.history`), NOT the run commit log.
|
|
70
|
+
* Absent for FLAT-chart frames (indices are run-commit-log relative).
|
|
71
|
+
*/
|
|
72
|
+
readonly subflowScope?: string;
|
|
73
|
+
/** Pass-through of the call-llm bundle's untrackedSources ('args'|'env'|'silent'). */
|
|
74
|
+
readonly incompleteSources?: ReadonlyArray<UntrackedSource>;
|
|
75
|
+
/** True when incompleteSources is non-empty — "this step read untracked; slice may be
|
|
76
|
+
* incomplete here". NOT a model-internalized claim (that is undetectable — see Trajectory). */
|
|
77
|
+
readonly untrackedReadsPresent: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** The proximate tool result a loop's decision was conditioned on — L4's cross-loop hop edge (proposal 008). */
|
|
80
|
+
export interface ProximateToolSource {
|
|
81
|
+
/** The committed `{ toolName, result }` (redaction-scrubbed, via commitValueAt). */
|
|
82
|
+
readonly value: unknown;
|
|
83
|
+
/** The producing loop's tool-calls stage runtimeStageId — resolves to an EARLIER frame. */
|
|
84
|
+
readonly writerId: string | undefined;
|
|
85
|
+
/** Honesty: the call-llm read `history`, NOT this key — an INFERRED proximate, not a direct read. */
|
|
86
|
+
readonly proximate: true;
|
|
87
|
+
}
|
|
88
|
+
/** The run input, re-injected as a synthetic node — a PROXY (args is untracked), never a recorded edge. */
|
|
89
|
+
export interface SyntheticQuestionNode {
|
|
90
|
+
readonly text: string;
|
|
91
|
+
readonly incompleteSources: readonly ['args'];
|
|
92
|
+
readonly injected: true;
|
|
93
|
+
}
|
|
94
|
+
export interface Trajectory {
|
|
95
|
+
readonly frames: readonly LoopFrame[];
|
|
96
|
+
/** Commits BEFORE the first head (seed, memory-read) — run setup, not a loop body. */
|
|
97
|
+
readonly prelude: readonly string[];
|
|
98
|
+
/** Only populated when the contrastive path is wired (proposal 005 L2 note). */
|
|
99
|
+
readonly question?: SyntheticQuestionNode;
|
|
100
|
+
/** Degrade-never-throw. STANDING caveat on EVERY trajectory: contextSources show only
|
|
101
|
+
* sources re-committed to tracked state; context the model retained internally (carried
|
|
102
|
+
* in its own reasoning, never re-committed) leaves no read→write edge and is NOT here. */
|
|
103
|
+
readonly honestyFlags: readonly HonestyFlag[];
|
|
104
|
+
/** Set only when maxFrames cut the run. */
|
|
105
|
+
readonly truncated?: {
|
|
106
|
+
readonly byFrames: boolean;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** One frame's raw partition: the head's array index + the runtimeStageIds in its half-open range. */
|
|
110
|
+
export interface AnchorBucket {
|
|
111
|
+
readonly headArrayIdx: number;
|
|
112
|
+
readonly bodyIds: readonly string[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Partition a commit log by a list of HEAD runtimeStageIds (taken as data — no agent
|
|
116
|
+
* knowledge). Each frame is the half-open range `[head[k], head[k+1])`; commits before
|
|
117
|
+
* the first head are the `prelude`. TOTAL: every commit lands in exactly one frame OR
|
|
118
|
+
* the prelude. Heads not found in the log are ignored; ordering follows the log, not the
|
|
119
|
+
* input list (an out-of-order or duplicate head list cannot reorder/duplicate commits).
|
|
120
|
+
*
|
|
121
|
+
* A head is anchored at the FIRST commit bearing its runtimeStageId — a single stage
|
|
122
|
+
* execution can flush MORE THAN ONE commit bundle under one runtimeStageId (parallel
|
|
123
|
+
* fork merges, multi-flush stages), and those repeats stay INSIDE the frame they open
|
|
124
|
+
* rather than each spawning a spurious one-commit frame.
|
|
125
|
+
*/
|
|
126
|
+
export declare function bucketByAnchors(commitLog: readonly CommitBundle[], headRuntimeStageIds: readonly string[]): {
|
|
127
|
+
frames: AnchorBucket[];
|
|
128
|
+
prelude: string[];
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* The flat-chart loop heads: the FIRST commit of each injection-engine ENTRY (one per
|
|
132
|
+
* ReAct iteration, since the loop is branch-sourced back to the injection engine). A head
|
|
133
|
+
* is a commit that is in the injection engine while the previous commit was not — so a
|
|
134
|
+
* multi-commit injection-engine body yields exactly one head per loop.
|
|
135
|
+
*
|
|
136
|
+
* Returns the runtimeStageIds to feed `bucketByAnchors`. Empty when the run never enters
|
|
137
|
+
* the injection engine (e.g. the grouped chart, where the loop lives in sf-llm-call —
|
|
138
|
+
* the caller degrades with an honesty flag).
|
|
139
|
+
*/
|
|
140
|
+
export declare function findLoopHeads(commitLog: readonly CommitBundle[]): string[];
|
|
141
|
+
export interface AssembleTrajectoryOptions {
|
|
142
|
+
/** Chars of each source value / intermediate text embedded. Default 2000. */
|
|
143
|
+
readonly maxTextChars?: number;
|
|
144
|
+
/** Keep only the first N frames (honesty-flagged via `truncated`). */
|
|
145
|
+
readonly maxFrames?: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Slice a recorded agent run into a {@link Trajectory} — one {@link LoopFrame} per ReAct
|
|
149
|
+
* iteration, each carrying its `call-llm` pointer, the call's output text, and the live
|
|
150
|
+
* {@link ContextSource}s that fed it (traced via `findLastWriter` + `commitValueAt` from the
|
|
151
|
+
* SAME commit log — zero new capture).
|
|
152
|
+
*
|
|
153
|
+
* Takes the SAME `ContextBugArtifacts` bag the localizer takes — adopter call is just
|
|
154
|
+
* `assembleTrajectory(artifacts)`.
|
|
155
|
+
*
|
|
156
|
+
* Handles BOTH chart shapes:
|
|
157
|
+
* - FLAT (`reactMode: 'dynamic'`, default): `call-llm` is a parent-level stage; frames are
|
|
158
|
+
* bucketed over the run commit log by the `sf-injection-engine` loop heads.
|
|
159
|
+
* - GROUPED (`reactMode: 'dynamic-grouped'`): the LLM turn runs in an `sf-llm-call` subflow;
|
|
160
|
+
* each loop is projected PER-SCOPE over its own inner commit log (retained per-iteration by
|
|
161
|
+
* footprintjs subflow-commit-visibility). Such frames carry `subflowScope` and their array
|
|
162
|
+
* indices are inner-log-relative.
|
|
163
|
+
*
|
|
164
|
+
* Standing caveat on every result: contextSources show only sources re-committed to tracked
|
|
165
|
+
* state; context the model retained internally (carried in its own reasoning, never
|
|
166
|
+
* re-committed) leaves no read→write edge and is NOT represented.
|
|
167
|
+
*/
|
|
168
|
+
export declare function assembleTrajectory(artifacts: ContextBugArtifacts, opts?: AssembleTrajectoryOptions): Trajectory;
|