agentfootprint 6.44.0 → 6.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai-instructions/setup.sh +0 -0
- package/dist/core/agent/buildAgentChart.js +2 -1
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +3 -1
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/stages/pickEntry.js +3 -1
- package/dist/core/agent/stages/pickEntry.js.map +1 -1
- package/dist/esm/adapters/identity/agentcore.d.ts +100 -0
- package/dist/esm/adapters/llm/AnthropicProvider.d.ts +130 -0
- package/dist/esm/adapters/llm/BedrockProvider.d.ts +100 -0
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.d.ts +41 -0
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.d.ts +95 -0
- package/dist/esm/adapters/llm/MockProvider.d.ts +153 -0
- package/dist/esm/adapters/llm/OpenAIProvider.d.ts +220 -0
- package/dist/esm/adapters/llm/createProvider.d.ts +85 -0
- package/dist/esm/adapters/memory/agentcore.d.ts +146 -0
- package/dist/esm/adapters/memory/bedrockAgentMemory.d.ts +95 -0
- package/dist/esm/adapters/memory/redis.d.ts +127 -0
- package/dist/esm/adapters/observability/agentcore.d.ts +67 -0
- package/dist/esm/adapters/observability/audit.d.ts +254 -0
- package/dist/esm/adapters/observability/cloudwatch.d.ts +96 -0
- package/dist/esm/adapters/observability/otel.d.ts +237 -0
- package/dist/esm/adapters/observability/xray.d.ts +88 -0
- package/dist/esm/adapters/types.d.ts +378 -0
- package/dist/esm/bridge/eventMeta.d.ts +59 -0
- package/dist/esm/cache/CacheDecisionSubflow.d.ts +85 -0
- package/dist/esm/cache/CacheGateDecider.d.ts +127 -0
- package/dist/esm/cache/applyCachePolicy.d.ts +37 -0
- package/dist/esm/cache/cacheRecorder.d.ts +85 -0
- package/dist/esm/cache/index.d.ts +33 -0
- package/dist/esm/cache/strategies/AnthropicCacheStrategy.d.ts +38 -0
- package/dist/esm/cache/strategies/BedrockCacheStrategy.d.ts +33 -0
- package/dist/esm/cache/strategies/NoOpCacheStrategy.d.ts +29 -0
- package/dist/esm/cache/strategies/OpenAICacheStrategy.d.ts +36 -0
- package/dist/esm/cache/strategyRegistry.d.ts +45 -0
- package/dist/esm/cache/types.d.ts +243 -0
- package/dist/esm/conventions.d.ts +203 -0
- package/dist/esm/core/Agent.d.ts +355 -0
- package/dist/esm/core/LLMCall.d.ts +139 -0
- package/dist/esm/core/RunnerBase.d.ts +267 -0
- package/dist/esm/core/agent/AgentBuilder.d.ts +565 -0
- package/dist/esm/core/agent/buildAgentChart.d.ts +109 -0
- package/dist/esm/core/agent/buildAgentChart.js +2 -1
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildAgentMessageApiChart.d.ts +40 -0
- package/dist/esm/core/agent/buildCacheSubflow.d.ts +35 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.d.ts +56 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.js +3 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildMessageApiChart.d.ts +47 -0
- package/dist/esm/core/agent/buildToolRegistry.d.ts +61 -0
- package/dist/esm/core/agent/memoryRecallInjections.d.ts +8 -0
- package/dist/esm/core/agent/stages/breakFinal.d.ts +22 -0
- package/dist/esm/core/agent/stages/callLLM.d.ts +74 -0
- package/dist/esm/core/agent/stages/pickEntry.d.ts +19 -0
- package/dist/esm/core/agent/stages/pickEntry.js +3 -1
- package/dist/esm/core/agent/stages/pickEntry.js.map +1 -1
- package/dist/esm/core/agent/stages/prepareFinal.d.ts +19 -0
- package/dist/esm/core/agent/stages/reliabilityExecution.d.ts +135 -0
- package/dist/esm/core/agent/stages/route.d.ts +18 -0
- package/dist/esm/core/agent/stages/seed.d.ts +53 -0
- package/dist/esm/core/agent/stages/toolCalls.d.ts +76 -0
- package/dist/esm/core/agent/toolArgsValidation.d.ts +62 -0
- package/dist/esm/core/agent/types.d.ts +382 -0
- package/dist/esm/core/agent/validators.d.ts +52 -0
- package/dist/esm/core/cost.d.ts +38 -0
- package/dist/esm/core/flowchartAsTool.d.ts +200 -0
- package/dist/esm/core/humanizeLLMError.d.ts +23 -0
- package/dist/esm/core/outputFallback.d.ts +139 -0
- package/dist/esm/core/outputSchema.d.ts +127 -0
- package/dist/esm/core/pause.d.ts +74 -0
- package/dist/esm/core/runCheckpoint.d.ts +179 -0
- package/dist/esm/core/runner.d.ts +203 -0
- package/dist/esm/core/slots/buildMessagesSlot.d.ts +40 -0
- package/dist/esm/core/slots/buildSystemPromptSlot.d.ts +41 -0
- package/dist/esm/core/slots/buildThinkingSubflow.d.ts +40 -0
- package/dist/esm/core/slots/buildToolsSlot.d.ts +60 -0
- package/dist/esm/core/slots/helpers.d.ts +27 -0
- package/dist/esm/core/toolContract.d.ts +43 -0
- package/dist/esm/core/tools.d.ts +90 -0
- package/dist/esm/core/translator.d.ts +94 -0
- package/dist/esm/core-flow/Conditional.d.ts +119 -0
- package/dist/esm/core-flow/Loop.d.ts +160 -0
- package/dist/esm/core-flow/Parallel.d.ts +360 -0
- package/dist/esm/core-flow/Sequence.d.ts +133 -0
- package/dist/esm/events/dispatcher.d.ts +134 -0
- package/dist/esm/events/payloads.d.ts +761 -0
- package/dist/esm/events/registry.d.ts +198 -0
- package/dist/esm/events/types.d.ts +70 -0
- package/dist/esm/identity/kinds.d.ts +36 -0
- package/dist/esm/identity/staticTokens.d.ts +28 -0
- package/dist/esm/identity/types.d.ts +113 -0
- package/dist/esm/identity/withCredentialRetry.d.ts +64 -0
- package/dist/esm/identity.d.ts +31 -0
- package/dist/esm/index.d.ts +64 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/injection-engine.d.ts +4 -0
- package/dist/esm/lib/canonicalJson.d.ts +56 -0
- package/dist/esm/lib/context-bisect/ablation.d.ts +109 -0
- package/dist/esm/lib/context-bisect/bisect.d.ts +75 -0
- package/dist/esm/lib/context-bisect/cost.d.ts +37 -0
- package/dist/esm/lib/context-bisect/index.d.ts +31 -0
- package/dist/esm/lib/context-bisect/index.js +3 -0
- package/dist/esm/lib/context-bisect/index.js.map +1 -1
- package/dist/esm/lib/context-bisect/llmEdgeWeigher.d.ts +124 -0
- package/dist/esm/lib/context-bisect/localize.d.ts +152 -0
- package/dist/esm/lib/context-bisect/localize.js +2 -0
- package/dist/esm/lib/context-bisect/localize.js.map +1 -1
- package/dist/esm/lib/context-bisect/loop-recall.d.ts +97 -0
- package/dist/esm/lib/context-bisect/missingContext.d.ts +71 -0
- package/dist/esm/lib/context-bisect/restoration.d.ts +39 -0
- package/dist/esm/lib/context-bisect/toBacktrackTrace.d.ts +138 -0
- package/dist/esm/lib/context-bisect/trajectory.d.ts +168 -0
- package/dist/esm/lib/context-bisect/types.d.ts +448 -0
- package/dist/esm/lib/context-bisect/walk-to-root.d.ts +103 -0
- package/dist/esm/lib/influence-core/attributability.d.ts +72 -0
- package/dist/esm/lib/influence-core/cache.d.ts +94 -0
- package/dist/esm/lib/influence-core/contrastive.d.ts +26 -0
- package/dist/esm/lib/influence-core/index.d.ts +34 -0
- package/dist/esm/lib/influence-core/margin.d.ts +33 -0
- package/dist/esm/lib/influence-core/signals.d.ts +128 -0
- package/dist/esm/lib/influence-core/similarity.d.ts +25 -0
- package/dist/esm/lib/influence-core/types.d.ts +252 -0
- package/dist/esm/lib/injection-engine/SkillRegistry.d.ts +147 -0
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.d.ts +110 -0
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js +1 -0
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
- package/dist/esm/lib/injection-engine/entryScorer.d.ts +93 -0
- package/dist/esm/lib/injection-engine/entryScorer.js +172 -0
- package/dist/esm/lib/injection-engine/entryScorer.js.map +1 -0
- package/dist/esm/lib/injection-engine/evaluator.d.ts +24 -0
- package/dist/esm/lib/injection-engine/factories/defineFact.d.ts +60 -0
- package/dist/esm/lib/injection-engine/factories/defineInjection.d.ts +41 -0
- package/dist/esm/lib/injection-engine/factories/defineInstruction.d.ts +78 -0
- package/dist/esm/lib/injection-engine/factories/defineRelevanceHint.d.ts +26 -0
- package/dist/esm/lib/injection-engine/factories/defineSkill.d.ts +160 -0
- package/dist/esm/lib/injection-engine/factories/defineSteering.d.ts +39 -0
- package/dist/esm/lib/injection-engine/index.d.ts +22 -0
- package/dist/esm/lib/injection-engine/index.js +1 -0
- package/dist/esm/lib/injection-engine/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillContract.d.ts +29 -0
- package/dist/esm/lib/injection-engine/skillGraph.d.ts +289 -0
- package/dist/esm/lib/injection-engine/skillGraph.js +35 -41
- package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillGraphCheckup.d.ts +49 -0
- package/dist/esm/lib/injection-engine/skillTools.d.ts +72 -0
- package/dist/esm/lib/injection-engine/softmax.d.ts +11 -0
- package/dist/esm/lib/injection-engine/types.d.ts +229 -0
- package/dist/esm/lib/injection-engine/types.js.map +1 -1
- package/dist/esm/lib/lazyRequire.d.ts +29 -0
- package/dist/esm/lib/mcp/index.d.ts +9 -0
- package/dist/esm/lib/mcp/mcpClient.d.ts +46 -0
- package/dist/esm/lib/mcp/mockMcpClient.d.ts +65 -0
- package/dist/esm/lib/mcp/types.d.ts +133 -0
- package/dist/esm/lib/rag/defineRAG.d.ts +139 -0
- package/dist/esm/lib/rag/index.d.ts +7 -0
- package/dist/esm/lib/rag/indexDocuments.d.ts +105 -0
- package/dist/esm/lib/tool-lint/analyze.d.ts +83 -0
- package/dist/esm/lib/tool-lint/cli.d.ts +43 -0
- package/dist/esm/lib/tool-lint/format.d.ts +18 -0
- package/dist/esm/lib/tool-lint/index.d.ts +23 -0
- package/dist/esm/lib/tool-lint/rules.d.ts +85 -0
- package/dist/esm/lib/tool-lint/types.d.ts +155 -0
- package/dist/esm/lib/trace-toolpack/bounded.d.ts +47 -0
- package/dist/esm/lib/trace-toolpack/debugPrompt.d.ts +19 -0
- package/dist/esm/lib/trace-toolpack/index.d.ts +20 -0
- package/dist/esm/lib/trace-toolpack/lazyToolpack.d.ts +35 -0
- package/dist/esm/lib/trace-toolpack/selfExplain.d.ts +100 -0
- package/dist/esm/lib/trace-toolpack/traceDebugAgent.d.ts +42 -0
- package/dist/esm/lib/trace-toolpack/traceToolpack.d.ts +69 -0
- package/dist/esm/lib/trace-toolpack/types.d.ts +59 -0
- package/dist/esm/llm-providers.d.ts +26 -0
- package/dist/esm/locales/index.d.ts +132 -0
- package/dist/esm/memory/beats/extractBeats.d.ts +61 -0
- package/dist/esm/memory/beats/extractor.d.ts +47 -0
- package/dist/esm/memory/beats/formatAsNarrative.d.ts +62 -0
- package/dist/esm/memory/beats/heuristicExtractor.d.ts +37 -0
- package/dist/esm/memory/beats/index.d.ts +12 -0
- package/dist/esm/memory/beats/llmExtractor.d.ts +56 -0
- package/dist/esm/memory/beats/types.d.ts +60 -0
- package/dist/esm/memory/beats/writeBeats.d.ts +22 -0
- package/dist/esm/memory/causal/evidenceRecorder.d.ts +66 -0
- package/dist/esm/memory/causal/index.d.ts +6 -0
- package/dist/esm/memory/causal/loadSnapshot.d.ts +51 -0
- package/dist/esm/memory/causal/snapshotPipeline.d.ts +35 -0
- package/dist/esm/memory/causal/types.d.ts +130 -0
- package/dist/esm/memory/causal/writeSnapshot.d.ts +73 -0
- package/dist/esm/memory/define.d.ts +63 -0
- package/dist/esm/memory/define.types.d.ts +276 -0
- package/dist/esm/memory/define.types.js +1 -1
- package/dist/esm/memory/embedding/cosine.d.ts +18 -0
- package/dist/esm/memory/embedding/embedMessages.d.ts +58 -0
- package/dist/esm/memory/embedding/index.d.ts +8 -0
- package/dist/esm/memory/embedding/loadRelevant.d.ts +51 -0
- package/dist/esm/memory/embedding/mockEmbedder.d.ts +22 -0
- package/dist/esm/memory/embedding/types.d.ts +46 -0
- package/dist/esm/memory/entry/decay.d.ts +36 -0
- package/dist/esm/memory/entry/index.d.ts +2 -0
- package/dist/esm/memory/entry/types.d.ts +140 -0
- package/dist/esm/memory/facts/extractFacts.d.ts +50 -0
- package/dist/esm/memory/facts/extractor.d.ts +33 -0
- package/dist/esm/memory/facts/formatFacts.d.ts +60 -0
- package/dist/esm/memory/facts/index.d.ts +14 -0
- package/dist/esm/memory/facts/llmFactExtractor.d.ts +64 -0
- package/dist/esm/memory/facts/loadFacts.d.ts +43 -0
- package/dist/esm/memory/facts/patternFactExtractor.d.ts +2 -0
- package/dist/esm/memory/facts/types.d.ts +68 -0
- package/dist/esm/memory/facts/writeFacts.d.ts +19 -0
- package/dist/esm/memory/identity/index.d.ts +2 -0
- package/dist/esm/memory/identity/types.d.ts +49 -0
- package/dist/esm/memory/index.d.ts +19 -0
- package/dist/esm/memory/pipeline/auto.d.ts +59 -0
- package/dist/esm/memory/pipeline/default.d.ts +49 -0
- package/dist/esm/memory/pipeline/ephemeral.d.ts +28 -0
- package/dist/esm/memory/pipeline/fact.d.ts +26 -0
- package/dist/esm/memory/pipeline/index.d.ts +13 -0
- package/dist/esm/memory/pipeline/narrative.d.ts +35 -0
- package/dist/esm/memory/pipeline/semantic.d.ts +37 -0
- package/dist/esm/memory/pipeline/types.d.ts +31 -0
- package/dist/esm/memory/stages/formatDefault.d.ts +64 -0
- package/dist/esm/memory/stages/index.d.ts +13 -0
- package/dist/esm/memory/stages/loadRecent.d.ts +49 -0
- package/dist/esm/memory/stages/pickByBudget.d.ts +63 -0
- package/dist/esm/memory/stages/summarize.d.ts +87 -0
- package/dist/esm/memory/stages/tokenize.d.ts +43 -0
- package/dist/esm/memory/stages/types.d.ts +75 -0
- package/dist/esm/memory/stages/writeMessages.d.ts +71 -0
- package/dist/esm/memory/store/InMemoryStore.d.ts +62 -0
- package/dist/esm/memory/store/index.d.ts +2 -0
- package/dist/esm/memory/store/types.d.ts +223 -0
- package/dist/esm/memory/wire/index.d.ts +2 -0
- package/dist/esm/memory/wire/mountMemoryPipeline.d.ts +108 -0
- package/dist/esm/memory-providers.d.ts +37 -0
- package/dist/esm/observability/contextError/finders/compareFinders.d.ts +19 -0
- package/dist/esm/observability/contextError/finders/index.d.ts +22 -0
- package/dist/esm/observability/contextError/finders/rankSuspects.d.ts +2 -0
- package/dist/esm/observability/contextError/finders/removeAndRetry.d.ts +11 -0
- package/dist/esm/observability/contextError/finders/shrinkToCause.d.ts +11 -0
- package/dist/esm/observability/contextError/finders/testManyCombos.d.ts +11 -0
- package/dist/esm/observability/contextError/finders/traceSteps.d.ts +2 -0
- package/dist/esm/observability/contextError/finders/types.d.ts +88 -0
- package/dist/esm/observability-providers.d.ts +46 -0
- package/dist/esm/observe.d.ts +62 -0
- package/dist/esm/patterns/Debate.d.ts +39 -0
- package/dist/esm/patterns/MapReduce.d.ts +66 -0
- package/dist/esm/patterns/Reflection.d.ts +51 -0
- package/dist/esm/patterns/SelfConsistency.d.ts +43 -0
- package/dist/esm/patterns/Swarm.d.ts +60 -0
- package/dist/esm/patterns/ToT.d.ts +53 -0
- package/dist/esm/patterns/index.d.ts +22 -0
- package/dist/esm/providers.d.ts +33 -0
- package/dist/esm/recorders/core/AgentRecorder.d.ts +15 -0
- package/dist/esm/recorders/core/CompositionRecorder.d.ts +17 -0
- package/dist/esm/recorders/core/ContextEvaluatedRecorder.d.ts +23 -0
- package/dist/esm/recorders/core/ContextRecorder.d.ts +47 -0
- package/dist/esm/recorders/core/CostRecorder.d.ts +14 -0
- package/dist/esm/recorders/core/EmitBridge.d.ts +30 -0
- package/dist/esm/recorders/core/ErrorBridge.d.ts +38 -0
- package/dist/esm/recorders/core/EvalRecorder.d.ts +16 -0
- package/dist/esm/recorders/core/MemoryRecorder.d.ts +17 -0
- package/dist/esm/recorders/core/PermissionRecorder.d.ts +16 -0
- package/dist/esm/recorders/core/ReliabilityRecorder.d.ts +24 -0
- package/dist/esm/recorders/core/SkillRecorder.d.ts +14 -0
- package/dist/esm/recorders/core/StreamRecorder.d.ts +15 -0
- package/dist/esm/recorders/core/ToolsRecorder.d.ts +18 -0
- package/dist/esm/recorders/core/ValidationRecorder.d.ts +16 -0
- package/dist/esm/recorders/core/contextEngineering.d.ts +136 -0
- package/dist/esm/recorders/core/typedEmit.d.ts +34 -0
- package/dist/esm/recorders/core/types.d.ts +97 -0
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.d.ts +117 -0
- package/dist/esm/recorders/observability/BoundaryRecorder.d.ts +546 -0
- package/dist/esm/recorders/observability/FlowchartRecorder.d.ts +220 -0
- package/dist/esm/recorders/observability/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 +48 -0
- package/dist/esm/strategies/attach.d.ts +47 -0
- package/dist/esm/strategies/compose.d.ts +48 -0
- package/dist/esm/strategies/defaults/chatBubbleLiveStatus.d.ts +36 -0
- package/dist/esm/strategies/defaults/consoleObservability.d.ts +42 -0
- package/dist/esm/strategies/defaults/inMemorySinkCost.d.ts +50 -0
- package/dist/esm/strategies/defaults/index.d.ts +30 -0
- package/dist/esm/strategies/defaults/noopLens.d.ts +28 -0
- package/dist/esm/strategies/index.d.ts +36 -0
- package/dist/esm/strategies/registry.d.ts +70 -0
- package/dist/esm/strategies/types.d.ts +303 -0
- package/dist/esm/stream.d.ts +82 -0
- package/dist/esm/thinking/AnthropicThinkingHandler.d.ts +42 -0
- package/dist/esm/thinking/MockThinkingHandler.d.ts +50 -0
- package/dist/esm/thinking/OpenAIThinkingHandler.d.ts +37 -0
- package/dist/esm/thinking/index.d.ts +51 -0
- package/dist/esm/thinking/registry.d.ts +33 -0
- package/dist/esm/thinking/types.d.ts +162 -0
- package/dist/esm/tool-providers/gatedTools.d.ts +36 -0
- package/dist/esm/tool-providers/index.d.ts +41 -0
- package/dist/esm/tool-providers/skillScopedTools.d.ts +45 -0
- package/dist/esm/tool-providers/staticTools.d.ts +21 -0
- package/dist/esm/tool-providers/types.d.ts +138 -0
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/context-bisect/index.js +3 -0
- package/dist/lib/context-bisect/index.js.map +1 -1
- package/dist/lib/context-bisect/localize.js +2 -0
- package/dist/lib/context-bisect/localize.js.map +1 -1
- package/dist/lib/injection-engine/buildInjectionEngineSubflow.js +1 -0
- package/dist/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
- package/dist/lib/injection-engine/entryScorer.js +178 -0
- package/dist/lib/injection-engine/entryScorer.js.map +1 -0
- package/dist/lib/injection-engine/index.js +5 -1
- package/dist/lib/injection-engine/index.js.map +1 -1
- package/dist/lib/injection-engine/skillGraph.js +35 -41
- package/dist/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/lib/injection-engine/types.js.map +1 -1
- package/dist/memory/define.types.js +1 -1
- package/dist/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/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/context-bisect/index.d.ts +3 -0
- package/dist/types/lib/context-bisect/index.d.ts.map +1 -1
- package/dist/types/lib/context-bisect/localize.d.ts +2 -0
- package/dist/types/lib/context-bisect/localize.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/entryScorer.d.ts +94 -0
- package/dist/types/lib/injection-engine/entryScorer.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/index.d.ts +1 -0
- package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillGraph.d.ts +21 -24
- package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/types.d.ts +9 -4
- package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
- package/dist/types/memory/define.types.d.ts +1 -1
- package/package.json +203 -56
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `noopLens()` — default LensStrategy.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: Strategy. Wildcard fallback. Same role as `NoOpCacheStrategy`.
|
|
5
|
+
* Role: Drops every update. Used when no Lens vendor strategy is
|
|
6
|
+
* configured AND the consumer hasn't supplied a callback.
|
|
7
|
+
* Keeps `enable.lens()` callable without args without
|
|
8
|
+
* throwing — important for the zero-arg HelloWorld pattern.
|
|
9
|
+
*
|
|
10
|
+
* Use when:
|
|
11
|
+
* - You want the agent to run without a Lens UI (production
|
|
12
|
+
* server-side, headless eval, batch jobs)
|
|
13
|
+
* - Tier-1 of compose chains where you want the chain to compile
|
|
14
|
+
* even if the real Lens strategy is conditional
|
|
15
|
+
*
|
|
16
|
+
* Don't use when: you actually want to see the StepGraph. Use
|
|
17
|
+
* `lens-browser`, `lens-cli`, or `lens-jsonExport` from the
|
|
18
|
+
* vendor-strategy subpaths once they ship in v2.12+.
|
|
19
|
+
*/
|
|
20
|
+
import type { LensStrategy, LensUpdate } from '../types.js';
|
|
21
|
+
export interface NoopLensOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Optional callback called per update — useful for tests that want
|
|
24
|
+
* to verify the strategy was wired without actually rendering.
|
|
25
|
+
*/
|
|
26
|
+
readonly onUpdate?: (update: LensUpdate) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function noopLens(opts?: NoopLensOptions): LensStrategy;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agentfootprint/strategies` — typed strategy interfaces + default
|
|
3
|
+
* sinks for the v2.8 grouped-enabler architecture.
|
|
4
|
+
*
|
|
5
|
+
* See:
|
|
6
|
+
* - `docs/inspiration/strategy-everywhere.md` — design memo + AWS-first roadmap
|
|
7
|
+
* - `types.ts` — typed interfaces (Observability, Cost, LiveStatus, Lens)
|
|
8
|
+
* - `defaults/` — the 4 in-core default strategies
|
|
9
|
+
*
|
|
10
|
+
* Vendor strategies ship under three GROUPED subpaths (matching the
|
|
11
|
+
* parallel-providers pattern v2.5 established for `llm-providers` /
|
|
12
|
+
* `tool-providers` / `memory-providers`). Each subpath holds N
|
|
13
|
+
* vendor-named factories — adding a vendor never adds a new subpath:
|
|
14
|
+
*
|
|
15
|
+
* - `agentfootprint/observability-providers`
|
|
16
|
+
* agentcoreObservability (v2.8.1)
|
|
17
|
+
* cloudwatchObservability (v2.8.2)
|
|
18
|
+
* xrayObservability (v2.8.3)
|
|
19
|
+
* otelObservability (v2.9.x)
|
|
20
|
+
* datadogObservability (v2.9.x)
|
|
21
|
+
*
|
|
22
|
+
* - `agentfootprint/cost-providers`
|
|
23
|
+
* stripeCost (v2.10.x)
|
|
24
|
+
*
|
|
25
|
+
* - `agentfootprint/lens-providers`
|
|
26
|
+
* browserLens / cliLens (v2.12.x)
|
|
27
|
+
*
|
|
28
|
+
* Each adapter lazy-imports its vendor SDK via `lib/lazyRequire.ts`,
|
|
29
|
+
* so consumers who never call a particular factory don't have to
|
|
30
|
+
* install that SDK. Peer-deps are declared in package.json with
|
|
31
|
+
* `peerDependenciesMeta.{name}.optional = true`.
|
|
32
|
+
*/
|
|
33
|
+
export * from './types.js';
|
|
34
|
+
export * from './defaults/index.js';
|
|
35
|
+
export { composeObservability, composeCost, composeLiveStatus, composeLens } from './compose.js';
|
|
36
|
+
export { attachObservabilityStrategy, attachCostStrategy, attachLiveStatusStrategy, type ObservabilityEnableOptions, type CostEnableOptions, type LiveStatusEnableOptions, } from './attach.js';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy registry — name → factory for each of the 4 groups.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `src/cache/strategyRegistry.ts` exactly: maps a string name
|
|
5
|
+
* to a factory function that takes vendor-specific config and returns
|
|
6
|
+
* a typed strategy instance. Vendor adapter subpaths self-register on
|
|
7
|
+
* import via side-effect.
|
|
8
|
+
*
|
|
9
|
+
* Two ways consumers wire a strategy:
|
|
10
|
+
*
|
|
11
|
+
* 1. By NAME (registry lookup) — the recommended path for vendor
|
|
12
|
+
* adapters:
|
|
13
|
+
* ```ts
|
|
14
|
+
* import 'agentfootprint/observability-datadog'; // self-registers 'datadog'
|
|
15
|
+
* agent.enable.observability({ vendor: 'datadog', config: { apiKey } });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* 2. By INSTANCE (explicit pass) — for custom in-house strategies
|
|
19
|
+
* or test mocks:
|
|
20
|
+
* ```ts
|
|
21
|
+
* agent.enable.observability({ strategy: myCustomStrategy });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* The two paths are mutually exclusive in `EnableOptions` — the type
|
|
25
|
+
* union enforces that consumers pick one.
|
|
26
|
+
*
|
|
27
|
+
* Lookup is exact-match by name (case-insensitive fallback). Unknown
|
|
28
|
+
* names return `undefined`; the consumer's `enable.X` then no-ops
|
|
29
|
+
* (per "do nothing if not configured" rule).
|
|
30
|
+
*/
|
|
31
|
+
import type { ObservabilityStrategy, CostStrategy, LiveStatusStrategy, LensStrategy } from './types.js';
|
|
32
|
+
/** Vendor adapter subpaths register a factory keyed by their vendor
|
|
33
|
+
* name. Config shape is vendor-specific — type-erased at the registry
|
|
34
|
+
* boundary; consumer's responsibility to pass the right shape. */
|
|
35
|
+
export type ObservabilityFactory = (config?: unknown) => ObservabilityStrategy;
|
|
36
|
+
export type CostFactory = (config?: unknown) => CostStrategy;
|
|
37
|
+
export type LiveStatusFactory = (config?: unknown) => LiveStatusStrategy;
|
|
38
|
+
export type LensFactory = (config?: unknown) => LensStrategy;
|
|
39
|
+
/**
|
|
40
|
+
* Register a vendor observability strategy by name. Called from the
|
|
41
|
+
* vendor's subpath at module load (side-effect import):
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* // agentfootprint/observability-datadog/index.ts
|
|
45
|
+
* import { registerObservabilityStrategy } from 'agentfootprint/strategies';
|
|
46
|
+
* registerObservabilityStrategy('datadog', (config) => datadogObservability(config));
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* Replacing an existing registration is allowed — most-recent wins.
|
|
50
|
+
* Useful for test mocks.
|
|
51
|
+
*/
|
|
52
|
+
export declare function registerObservabilityStrategy(name: string, factory: ObservabilityFactory): void;
|
|
53
|
+
/** Look up an observability factory by vendor name. Case-insensitive
|
|
54
|
+
* fallback. Returns `undefined` when the name is unknown — caller
|
|
55
|
+
* decides to noop or throw. */
|
|
56
|
+
export declare function getObservabilityStrategy(name: string): ObservabilityFactory | undefined;
|
|
57
|
+
/** Diagnostic — list all registered vendor names. */
|
|
58
|
+
export declare function listObservabilityStrategies(): readonly string[];
|
|
59
|
+
export declare function registerCostStrategy(name: string, factory: CostFactory): void;
|
|
60
|
+
export declare function getCostStrategy(name: string): CostFactory | undefined;
|
|
61
|
+
export declare function listCostStrategies(): readonly string[];
|
|
62
|
+
export declare function registerLiveStatusStrategy(name: string, factory: LiveStatusFactory): void;
|
|
63
|
+
export declare function getLiveStatusStrategy(name: string): LiveStatusFactory | undefined;
|
|
64
|
+
export declare function listLiveStatusStrategies(): readonly string[];
|
|
65
|
+
export declare function registerLensStrategy(name: string, factory: LensFactory): void;
|
|
66
|
+
export declare function getLensStrategy(name: string): LensFactory | undefined;
|
|
67
|
+
export declare function listLensStrategies(): readonly string[];
|
|
68
|
+
/** Reset every registry to empty. Tests only — not in the public
|
|
69
|
+
* barrel. */
|
|
70
|
+
export declare function _resetRegistriesForTests(): void;
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy interface types for the v2.8 grouped-enabler architecture.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: Strategy + Bridge + Hexagonal port. See the design memo
|
|
5
|
+
* `docs/inspiration/strategy-everywhere.md`.
|
|
6
|
+
*
|
|
7
|
+
* Four groups, four typed strategy interfaces. Each follows the same
|
|
8
|
+
* shape (one canonical contract, locked at the type level):
|
|
9
|
+
*
|
|
10
|
+
* 1. `name: string` — registry key for auto-registration
|
|
11
|
+
* 2. `capabilities: {...}` — what this strategy supports
|
|
12
|
+
* 3. `onEvent(...)` — hot path; sync, side-effect-only
|
|
13
|
+
* 4. `flush?(): Promise<void>` — optional batch flushing
|
|
14
|
+
* 5. `stop?(): void` — optional teardown
|
|
15
|
+
*
|
|
16
|
+
* Design constraints (from the panel review):
|
|
17
|
+
* - **PASSIVE / non-blocking by construction.** Strategies are
|
|
18
|
+
* observers — they NEVER block the agent loop. Async work
|
|
19
|
+
* (HTTP shipment, disk I/O, batching) is the STRATEGY's internal
|
|
20
|
+
* concern: buffer in `onEvent` (sync), drain in `flush()` (async
|
|
21
|
+
* OK). The dispatcher never awaits a strategy's `onEvent`.
|
|
22
|
+
* - `onEvent` MUST be sync `void`. MUST NOT throw. Errors caught +
|
|
23
|
+
* routed to `_onError` at the dispatch layer; one bad strategy
|
|
24
|
+
* never breaks the agent loop.
|
|
25
|
+
* - Idempotent registration — registering the same `name` twice
|
|
26
|
+
* replaces, doesn't double-fire.
|
|
27
|
+
* - `stop()` is idempotent — halts everything that strategy enabled,
|
|
28
|
+
* nothing else, calling twice is a no-op.
|
|
29
|
+
* - `flush()` is optional, may be sync OR async — strategies that
|
|
30
|
+
* don't batch can omit it. Consumer's `agent.run()` lifecycle
|
|
31
|
+
* calls flush at boundary points (turn end, run end) so batched
|
|
32
|
+
* strategies don't lose tail events. Flush is the ONLY async
|
|
33
|
+
* path; the hot path is always sync.
|
|
34
|
+
*/
|
|
35
|
+
import type { AgentfootprintEvent, AgentfootprintEventType } from '../events/registry.js';
|
|
36
|
+
import type { StepGraph } from '../recorders/observability/FlowchartRecorder.js';
|
|
37
|
+
import type { StatusState } from '../recorders/observability/status/statusTemplates.js';
|
|
38
|
+
/**
|
|
39
|
+
* Common base every strategy carries. Per-group strategies extend this
|
|
40
|
+
* with their typed `onEvent` signature + capability shape.
|
|
41
|
+
*/
|
|
42
|
+
export interface BaseStrategy {
|
|
43
|
+
/** Registry key. Conventionally lowercase-kebab: `'datadog'`,
|
|
44
|
+
* `'agentcore'`, `'cloudwatch'`. Used to look up the strategy from
|
|
45
|
+
* config + de-dupe registrations. */
|
|
46
|
+
readonly name: string;
|
|
47
|
+
/** Optional batch flush. Returns `void` for sync sinks (Pino-style)
|
|
48
|
+
* OR `Promise<void>` for async sinks (Datadog HTTP batch, OTel
|
|
49
|
+
* BatchSpanProcessor). Called before `agent.run()` resolves so
|
|
50
|
+
* batched exporters don't lose tail events. */
|
|
51
|
+
flush?(): void | Promise<void>;
|
|
52
|
+
/** Optional teardown. Called on `stop()` returned by `enable.X`.
|
|
53
|
+
* Idempotent — calling twice is a no-op. Strategies that open no
|
|
54
|
+
* external resources can omit this. */
|
|
55
|
+
stop?(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Optional event-type filter. When set, the dispatcher only forwards
|
|
58
|
+
* events whose `type` is in this set — saves the strategy from
|
|
59
|
+
* filtering itself + reduces hot-path allocations.
|
|
60
|
+
*
|
|
61
|
+
* Per AWS CloudWatch panel review: storage cost scales with size,
|
|
62
|
+
* strategies need to declare what they consume so the framework
|
|
63
|
+
* doesn't force them to inspect everything.
|
|
64
|
+
*/
|
|
65
|
+
readonly relevantEventTypes?: readonly AgentfootprintEventType[];
|
|
66
|
+
/**
|
|
67
|
+
* Optional config validator. Called ONCE at registration time —
|
|
68
|
+
* throws if the strategy's options are invalid (wrong API key shape,
|
|
69
|
+
* missing peer dep, unreachable endpoint). Saves customer-support
|
|
70
|
+
* "why is my dashboard empty?" tickets.
|
|
71
|
+
*
|
|
72
|
+
* Per New Relic panel review.
|
|
73
|
+
*/
|
|
74
|
+
validate?(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Optional error sink. Called when this strategy itself errors —
|
|
77
|
+
* e.g., HTTP 401 from Datadog, malformed config in pino. Default
|
|
78
|
+
* dispatcher behavior is to swallow + log to console (so one bad
|
|
79
|
+
* exporter doesn't kill the agent loop). Consumers wire this when
|
|
80
|
+
* they want to surface vendor errors in their own tooling.
|
|
81
|
+
*
|
|
82
|
+
* Per New Relic panel review.
|
|
83
|
+
*/
|
|
84
|
+
_onError?(error: Error, event?: AgentfootprintEvent): void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Capabilities a strategy declares — matches OTel's 4-signal model
|
|
88
|
+
* (events / logs / traces / metrics). A strategy can opt into any
|
|
89
|
+
* subset. `compose([...])` ORs the children's capabilities.
|
|
90
|
+
*
|
|
91
|
+
* - `events: true` → wide structured events (Honeycomb / OTel
|
|
92
|
+
* events / Datadog wide events). agentfootprint
|
|
93
|
+
* events are this shape natively — most
|
|
94
|
+
* strategies should default to `events: true`.
|
|
95
|
+
* - `logs: true` → flat log records (pino, console, CloudWatch
|
|
96
|
+
* Logs). The strategy reduces a wide event to
|
|
97
|
+
* a single log line.
|
|
98
|
+
* - `traces: true` → strategy maps events to spans (parent/child
|
|
99
|
+
* via `runtimeStageId`).
|
|
100
|
+
* - `metrics: true` → strategy aggregates counters / gauges
|
|
101
|
+
* (CloudWatch metrics, Mimir, Prometheus).
|
|
102
|
+
*/
|
|
103
|
+
export interface ObservabilityCapabilities {
|
|
104
|
+
readonly events?: boolean;
|
|
105
|
+
readonly logs?: boolean;
|
|
106
|
+
readonly traces?: boolean;
|
|
107
|
+
readonly metrics?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The single hot-path entry every observability strategy implements.
|
|
111
|
+
* Receives every typed agent event. MUST be sync + side-effect-only +
|
|
112
|
+
* non-throwing.
|
|
113
|
+
*
|
|
114
|
+
* Strategies that batch should buffer in `onEvent` and drain in
|
|
115
|
+
* `flush()`.
|
|
116
|
+
*/
|
|
117
|
+
export interface ObservabilityStrategy extends BaseStrategy {
|
|
118
|
+
readonly capabilities: ObservabilityCapabilities;
|
|
119
|
+
/**
|
|
120
|
+
* Translate the typed agentfootprint event into the vendor's wire
|
|
121
|
+
* format and ship it to the destination (Datadog API, OTel exporter,
|
|
122
|
+
* pino stream, CloudWatch PutLogEvents, etc.).
|
|
123
|
+
*
|
|
124
|
+
* MUST be sync `void`. Buffer internally; drain in `flush()`.
|
|
125
|
+
*/
|
|
126
|
+
exportEvent(event: AgentfootprintEvent): void;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* What a cost strategy receives every time the cost recorder fires.
|
|
130
|
+
* Carries enough info for the strategy to decide whether to ship to
|
|
131
|
+
* billing, log a warning, trigger a circuit breaker, etc.
|
|
132
|
+
*/
|
|
133
|
+
export interface CostTick {
|
|
134
|
+
readonly cumulativeInputTokens: number;
|
|
135
|
+
readonly cumulativeOutputTokens: number;
|
|
136
|
+
readonly cumulativeCostUsd: number;
|
|
137
|
+
readonly recentInputTokens: number;
|
|
138
|
+
readonly recentOutputTokens: number;
|
|
139
|
+
readonly recentCostUsd: number;
|
|
140
|
+
readonly model: string;
|
|
141
|
+
readonly iteration?: number;
|
|
142
|
+
readonly runtimeStageId?: string;
|
|
143
|
+
}
|
|
144
|
+
export interface CostCapabilities {
|
|
145
|
+
/** Strategy supports per-tick streaming. `false` for batch-only sinks. */
|
|
146
|
+
readonly streaming?: boolean;
|
|
147
|
+
/** Strategy supports budget enforcement (will throw / break the loop
|
|
148
|
+
* when budget exceeded). Most strategies are observe-only. */
|
|
149
|
+
readonly enforcement?: boolean;
|
|
150
|
+
}
|
|
151
|
+
export interface CostStrategy extends BaseStrategy {
|
|
152
|
+
readonly capabilities: CostCapabilities;
|
|
153
|
+
/**
|
|
154
|
+
* Translate the cost tick into the vendor's wire format and ship it
|
|
155
|
+
* (Stripe billing API, accounting webhook, internal metrics sink).
|
|
156
|
+
*
|
|
157
|
+
* MUST be sync `void`. Buffer internally; drain in `flush()`.
|
|
158
|
+
*/
|
|
159
|
+
recordCost(tick: CostTick): void;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* What a status strategy receives every time `selectStatus`
|
|
163
|
+
* returns a new state. The renderer has already resolved templates to
|
|
164
|
+
* a final string; strategies decide where to send it.
|
|
165
|
+
*/
|
|
166
|
+
export interface StatusUpdate {
|
|
167
|
+
/** Rendered status line (already template-resolved). */
|
|
168
|
+
readonly line: string;
|
|
169
|
+
/** Underlying state for strategies that want to format their own
|
|
170
|
+
* view (e.g., emit different colors per state in a TUI). */
|
|
171
|
+
readonly state: StatusState;
|
|
172
|
+
}
|
|
173
|
+
export interface LiveStatusCapabilities {
|
|
174
|
+
/** Strategy supports streaming partial tokens (vs only state
|
|
175
|
+
* transitions). */
|
|
176
|
+
readonly streaming?: boolean;
|
|
177
|
+
}
|
|
178
|
+
export interface LiveStatusStrategy extends BaseStrategy {
|
|
179
|
+
readonly capabilities: LiveStatusCapabilities;
|
|
180
|
+
/**
|
|
181
|
+
* Render the rendered status line to the strategy's destination
|
|
182
|
+
* (chat bubble callback, stdout, webhook).
|
|
183
|
+
*
|
|
184
|
+
* MUST be sync `void`.
|
|
185
|
+
*/
|
|
186
|
+
renderStatus(update: StatusUpdate): void;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* What a Lens strategy receives — the live StepGraph each time the
|
|
190
|
+
* boundary recorder fires an event that changes the visible structure.
|
|
191
|
+
* Strategies decide how to render: DOM (browser), TUI (CLI), JSON
|
|
192
|
+
* (capture for replay).
|
|
193
|
+
*/
|
|
194
|
+
export interface LensUpdate {
|
|
195
|
+
readonly graph: StepGraph;
|
|
196
|
+
/** Whether this is the FINAL update (run finished). Strategies that
|
|
197
|
+
* buffer for animation can flush here. */
|
|
198
|
+
readonly final: boolean;
|
|
199
|
+
}
|
|
200
|
+
export interface LensCapabilities {
|
|
201
|
+
/** Strategy renders to a UI (browser DOM, TUI). */
|
|
202
|
+
readonly interactive?: boolean;
|
|
203
|
+
/** Strategy serializes for replay / export. */
|
|
204
|
+
readonly serializable?: boolean;
|
|
205
|
+
}
|
|
206
|
+
export interface LensStrategy extends BaseStrategy {
|
|
207
|
+
readonly capabilities: LensCapabilities;
|
|
208
|
+
/**
|
|
209
|
+
* Render the live StepGraph to the strategy's destination (DOM,
|
|
210
|
+
* TUI, JSON serializer).
|
|
211
|
+
*
|
|
212
|
+
* MUST be sync `void`.
|
|
213
|
+
*/
|
|
214
|
+
renderGraph(update: LensUpdate): void;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Discriminated union for the `compose([...])` combinator and the
|
|
218
|
+
* registry. Lets the registry hold one Map<name, AnyStrategy> while
|
|
219
|
+
* preserving type narrowing per-group via the `kind` discriminator.
|
|
220
|
+
*/
|
|
221
|
+
export type AnyStrategy = ({
|
|
222
|
+
readonly kind: 'observability';
|
|
223
|
+
} & ObservabilityStrategy) | ({
|
|
224
|
+
readonly kind: 'cost';
|
|
225
|
+
} & CostStrategy) | ({
|
|
226
|
+
readonly kind: 'liveStatus';
|
|
227
|
+
} & LiveStatusStrategy) | ({
|
|
228
|
+
readonly kind: 'lens';
|
|
229
|
+
} & LensStrategy);
|
|
230
|
+
export type StrategyKind = AnyStrategy['kind'];
|
|
231
|
+
/**
|
|
232
|
+
* Cost-of-on knob (per Datadog panel review). Each tier is a soft
|
|
233
|
+
* suggestion — strategies decide what to do per tier (e.g., a
|
|
234
|
+
* `pino` strategy might gzip on `firehose`, an OTel strategy might
|
|
235
|
+
* raise its `BatchSpanProcessor` interval).
|
|
236
|
+
*/
|
|
237
|
+
export type ObservabilityTier = 'minimal' | 'standard' | 'firehose';
|
|
238
|
+
/**
|
|
239
|
+
* Detach mode — controls whether the strategy's hot-path call
|
|
240
|
+
* (e.g. `exportEvent`) runs sync inside the agent loop or is deferred
|
|
241
|
+
* onto a `footprintjs/detach` driver so the loop never blocks.
|
|
242
|
+
*
|
|
243
|
+
* Three semantics:
|
|
244
|
+
*
|
|
245
|
+
* - `'forget'` — `detachAndForget`. Discard the handle. Pure
|
|
246
|
+
* fire-and-forget telemetry. Errors land on the
|
|
247
|
+
* (discarded) handle and go silent unless the
|
|
248
|
+
* strategy's own `_onError` surfaces them. Use for
|
|
249
|
+
* high-volume exports where dropping a single event
|
|
250
|
+
* is acceptable.
|
|
251
|
+
*
|
|
252
|
+
* - `'join-later'` — `detachAndJoinLater`. The driver returns a
|
|
253
|
+
* `DetachHandle`; we deliver it to your
|
|
254
|
+
* `onHandle` callback so you can `await` later
|
|
255
|
+
* (graceful shutdown, tests, backpressure).
|
|
256
|
+
*
|
|
257
|
+
* - omitted (default sync) — strategy hot-path runs inline, same as
|
|
258
|
+
* every release before v2.8.
|
|
259
|
+
*
|
|
260
|
+
* For graceful shutdown — call `flushAllDetached()` (from
|
|
261
|
+
* `'footprintjs/detach'`) in your SIGTERM handler. Drains every
|
|
262
|
+
* in-flight detached handle process-wide.
|
|
263
|
+
*/
|
|
264
|
+
export interface DetachOptions {
|
|
265
|
+
/** The driver to schedule on. Required — there is no library
|
|
266
|
+
* default. Pick by environment: `microtaskBatchDriver` (cross-
|
|
267
|
+
* runtime, default for in-process), `setImmediateDriver` (Node),
|
|
268
|
+
* `setTimeoutDriver` (cross-runtime, configurable delay),
|
|
269
|
+
* `sendBeaconDriver` (browser, survives page-unload), etc. */
|
|
270
|
+
readonly driver: import('footprintjs/detach').DetachDriver;
|
|
271
|
+
/** `'forget'` discards the handle (pure telemetry). `'join-later'`
|
|
272
|
+
* delivers the handle to `onHandle` for later awaiting. Default
|
|
273
|
+
* `'forget'`. */
|
|
274
|
+
readonly mode?: 'forget' | 'join-later';
|
|
275
|
+
/** Required when `mode === 'join-later'`. Receives every minted
|
|
276
|
+
* handle. Push to a closure-local array if you want
|
|
277
|
+
* `Promise.all(handles.map(h => h.wait()))` later, or keep a
|
|
278
|
+
* rolling window for backpressure. */
|
|
279
|
+
readonly onHandle?: (handle: import('footprintjs/detach').DetachHandle) => void;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Common options every group accepts. Per-group enablers extend with
|
|
283
|
+
* their own keys (e.g., `templates` for liveStatus, `budget` for cost).
|
|
284
|
+
*/
|
|
285
|
+
export interface CommonStrategyOptions {
|
|
286
|
+
/**
|
|
287
|
+
* Strategy implementation. Defaults differ per group:
|
|
288
|
+
* - observability → `console()`
|
|
289
|
+
* - cost → `inMemorySink()`
|
|
290
|
+
* - liveStatus → consumer-provided callback
|
|
291
|
+
* - lens → `browser()` (when in DOM) / `noop()` (else)
|
|
292
|
+
*/
|
|
293
|
+
readonly strategy?: BaseStrategy;
|
|
294
|
+
/** 0..1 — fraction of events to forward. 1.0 = all, 0 = none.
|
|
295
|
+
* Per-Datadog panel review: every observability enabler accepts
|
|
296
|
+
* this. */
|
|
297
|
+
readonly sampleRate?: number;
|
|
298
|
+
/** Opt-in detach. When set, the strategy's hot-path call (e.g.
|
|
299
|
+
* `exportEvent`) is scheduled on the given driver instead of
|
|
300
|
+
* running inline — agent loop never blocks on slow exporters.
|
|
301
|
+
* See `DetachOptions` for the three semantics. */
|
|
302
|
+
readonly detach?: DetachOptions;
|
|
303
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agentfootprint/stream — agent events → Server-Sent Events helpers.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: Adapter (event stream → SSE wire format).
|
|
5
|
+
* Role: Outer ring. Subscribes to a `Runner`'s `EventDispatcher`
|
|
6
|
+
* and yields SSE-formatted strings. Drop into any HTTP
|
|
7
|
+
* framework that accepts an async iterable response body
|
|
8
|
+
* (Fetch Response, Express res.write, Hono streaming, etc.).
|
|
9
|
+
* Emits: N/A — observes only.
|
|
10
|
+
*/
|
|
11
|
+
import type { AgentfootprintEvent } from './events/registry.js';
|
|
12
|
+
import type { RunnerBase } from './core/RunnerBase.js';
|
|
13
|
+
/**
|
|
14
|
+
* Hand the runner this iterable's caller before calling `runner.run()`.
|
|
15
|
+
* Yields SSE-formatted strings until the run finishes (success, error,
|
|
16
|
+
* or pause). Each event becomes:
|
|
17
|
+
*
|
|
18
|
+
* event: <event name>
|
|
19
|
+
* data: <JSON payload>
|
|
20
|
+
* <blank line>
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Express
|
|
24
|
+
* app.post('/agent', async (req, res) => {
|
|
25
|
+
* res.setHeader('content-type', 'text/event-stream');
|
|
26
|
+
* for await (const chunk of toSSE(agent)) {
|
|
27
|
+
* res.write(chunk);
|
|
28
|
+
* }
|
|
29
|
+
* res.end();
|
|
30
|
+
* // (in parallel: await agent.run(req.body))
|
|
31
|
+
* });
|
|
32
|
+
*/
|
|
33
|
+
export interface ToSSEOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Filter predicate — return false to skip an event. Default: all events.
|
|
36
|
+
* Common: `event => event.type.startsWith('agentfootprint.stream.')`
|
|
37
|
+
* for a token-only feed.
|
|
38
|
+
*/
|
|
39
|
+
readonly filter?: (event: AgentfootprintEvent) => boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Output shape:
|
|
42
|
+
* - 'full' (default) — each event is JSON-serialized verbatim.
|
|
43
|
+
* - 'text' — only `agentfootprint.stream.token.content` is yielded,
|
|
44
|
+
* in plain text form (no event/data prefix). Useful for piping
|
|
45
|
+
* directly into a chat UI.
|
|
46
|
+
*/
|
|
47
|
+
readonly format?: 'full' | 'text';
|
|
48
|
+
/**
|
|
49
|
+
* Custom event name extractor. By default `event.type` is used.
|
|
50
|
+
* Useful for SSE consumers that want their own naming.
|
|
51
|
+
*/
|
|
52
|
+
readonly eventName?: (event: AgentfootprintEvent) => string;
|
|
53
|
+
/**
|
|
54
|
+
* Heartbeat interval in ms. SSE connections through proxies/load
|
|
55
|
+
* balancers often die after ~30s of silence; emit `: ping` comments
|
|
56
|
+
* at this interval. Default 0 (disabled).
|
|
57
|
+
*/
|
|
58
|
+
readonly heartbeatMs?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Subscribe to a runner's `EventDispatcher` and yield SSE-formatted
|
|
62
|
+
* strings until the run completes.
|
|
63
|
+
*/
|
|
64
|
+
export declare function toSSE<TIn, TOut>(runner: RunnerBase<TIn, TOut>, options?: ToSSEOptions): AsyncIterable<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Class form for consumers who prefer `new SSEFormatter(runner).stream()`.
|
|
67
|
+
* Identical behavior to `toSSE(runner)` — pick by preference.
|
|
68
|
+
*/
|
|
69
|
+
export declare class SSEFormatter<TIn = unknown, TOut = unknown> {
|
|
70
|
+
private readonly runner;
|
|
71
|
+
private readonly options;
|
|
72
|
+
constructor(runner: RunnerBase<TIn, TOut>, options?: ToSSEOptions);
|
|
73
|
+
/** Async iterable of SSE chunks. Consume with `for await`. */
|
|
74
|
+
stream(): AsyncIterable<string>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Format any JSON-able payload as a single SSE event chunk.
|
|
78
|
+
*
|
|
79
|
+
* Useful for app-level events outside the runner's typed registry
|
|
80
|
+
* (auth/error frames, app-state echoes). Most consumers won't need this.
|
|
81
|
+
*/
|
|
82
|
+
export declare function encodeSSE(eventName: string, payload: unknown): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnthropicThinkingHandler — normalizes Anthropic's extended-thinking
|
|
3
|
+
* response shape into the framework's `ThinkingBlock[]` contract.
|
|
4
|
+
*
|
|
5
|
+
* Anthropic emits thinking via blocks in `response.content`:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* { type: 'thinking', thinking: 'reasoning text', signature: 'opaque-base64' }
|
|
9
|
+
* { type: 'redacted_thinking', signature: 'opaque-base64' }
|
|
10
|
+
* { type: 'text', text: 'visible content' }
|
|
11
|
+
* { type: 'tool_use', id, name, input }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The handler filters for `'thinking'` + `'redacted_thinking'` blocks,
|
|
15
|
+
* preserves the `signature` field BYTE-EXACT (Anthropic validates
|
|
16
|
+
* signatures server-side on the next turn — any modification = HTTP 400),
|
|
17
|
+
* and ignores other block types (visible text + tool calls flow through
|
|
18
|
+
* the existing `LLMResponse.content` / `LLMResponse.toolCalls` paths).
|
|
19
|
+
*
|
|
20
|
+
* **Critical invariant:** signature pass-through is byte-exact. The
|
|
21
|
+
* handler MUST NOT trim, normalize encoding, JSON-roundtrip, or
|
|
22
|
+
* otherwise touch the signature string. Tests verify this explicitly.
|
|
23
|
+
*
|
|
24
|
+
* **Three input shapes** Anthropic produces (per Phase 4a panel review):
|
|
25
|
+
* 1. Non-streaming response: full `response.content` array
|
|
26
|
+
* 2. Streaming aggregated: AnthropicProvider accumulates chunks +
|
|
27
|
+
* calls handler with the same array shape
|
|
28
|
+
* 3. Bedrock-via-Anthropic: deferred to Phase 5+ (separate handler
|
|
29
|
+
* or extension of this one)
|
|
30
|
+
*
|
|
31
|
+
* Streaming + non-streaming converge on shape #1 because the provider
|
|
32
|
+
* handles the distinction — handler only sees the assembled content
|
|
33
|
+
* array.
|
|
34
|
+
*
|
|
35
|
+
* **`parseChunk` is OPTIONAL** — Phase 3's framework path populates
|
|
36
|
+
* `LLMChunk.thinkingDelta` from inside AnthropicProvider's `stream()`
|
|
37
|
+
* directly, bypassing handler.parseChunk. We still implement it for
|
|
38
|
+
* consumer integrations that want to use the handler on raw Anthropic
|
|
39
|
+
* chunks directly (e.g., custom transports).
|
|
40
|
+
*/
|
|
41
|
+
import type { ThinkingHandler } from './types.js';
|
|
42
|
+
export declare const anthropicThinkingHandler: ThinkingHandler;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MockThinkingHandler — canonical example for the v2.14 ThinkingHandler
|
|
3
|
+
* contract. Used by:
|
|
4
|
+
*
|
|
5
|
+
* 1. Tests — drives the shared contract test (every shipped handler
|
|
6
|
+
* MUST satisfy the same invariants this mock demonstrates).
|
|
7
|
+
* 2. Future provider authors — reference implementation showing how
|
|
8
|
+
* to handle BOTH Anthropic-shape inputs (signed blocks, possibly
|
|
9
|
+
* redacted) and OpenAI-shape inputs (multi-block summary). The
|
|
10
|
+
* pattern of "discriminate by shape, normalize each branch" is
|
|
11
|
+
* reusable across providers.
|
|
12
|
+
* 3. The MockProvider for end-to-end tests of the framework wiring
|
|
13
|
+
* without depending on a real LLM SDK.
|
|
14
|
+
*
|
|
15
|
+
* Defaults are deliberately sensitive-data-free — no fake PII, no
|
|
16
|
+
* fake-signature material that could be confused for real cryptography,
|
|
17
|
+
* no internal-looking IDs. Sets the example for consumer-authored
|
|
18
|
+
* handlers.
|
|
19
|
+
*/
|
|
20
|
+
import type { ThinkingHandler } from './types.js';
|
|
21
|
+
/** Shape the mock recognizes for Anthropic-style raw inputs. */
|
|
22
|
+
interface MockAnthropicRaw {
|
|
23
|
+
readonly kind: 'anthropic';
|
|
24
|
+
readonly blocks: ReadonlyArray<{
|
|
25
|
+
readonly type: 'thinking' | 'redacted_thinking';
|
|
26
|
+
readonly thinking?: string;
|
|
27
|
+
readonly signature?: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
/** Shape the mock recognizes for OpenAI-style raw inputs. */
|
|
31
|
+
interface MockOpenAIRaw {
|
|
32
|
+
readonly kind: 'openai';
|
|
33
|
+
readonly summarySteps: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Build an Anthropic-style raw input for tests. Signature is a marker
|
|
37
|
+
* string — real Anthropic signatures are opaque base64.
|
|
38
|
+
*/
|
|
39
|
+
export declare function mockAnthropicRaw(blocks: readonly {
|
|
40
|
+
content: string;
|
|
41
|
+
signature?: string;
|
|
42
|
+
redacted?: boolean;
|
|
43
|
+
}[]): MockAnthropicRaw;
|
|
44
|
+
/**
|
|
45
|
+
* Build an OpenAI-style raw input for tests — one summary step per
|
|
46
|
+
* string. Each step becomes a separate ThinkingBlock with `summary: true`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function mockOpenAIRaw(summarySteps: readonly string[]): MockOpenAIRaw;
|
|
49
|
+
export declare const mockThinkingHandler: ThinkingHandler;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAIThinkingHandler — normalizes OpenAI's o1/o3 reasoning_summary
|
|
3
|
+
* structured output into the framework's `ThinkingBlock[]` contract.
|
|
4
|
+
*
|
|
5
|
+
* OpenAI's reasoning_summary shape varies by model + API version:
|
|
6
|
+
*
|
|
7
|
+
* 1. Older o1 format — simple string:
|
|
8
|
+
* "I worked through the problem by first..."
|
|
9
|
+
*
|
|
10
|
+
* 2. Newer o3+ structured — array of summary items:
|
|
11
|
+
* [
|
|
12
|
+
* { type: 'summary_text', text: 'Identify the user request' },
|
|
13
|
+
* { type: 'summary_text', text: 'Choose appropriate tool' },
|
|
14
|
+
* ]
|
|
15
|
+
*
|
|
16
|
+
* 3. Missing entirely — most calls (gpt-4o, or o1/o3 without
|
|
17
|
+
* reasoning_summary param requested) → undefined raw input
|
|
18
|
+
*
|
|
19
|
+
* Handler dispatches on shape; output is `ThinkingBlock[]` with
|
|
20
|
+
* `summary: true` per Phase 1 contract — distinguishes structured-
|
|
21
|
+
* summary blocks from raw thinking content (Anthropic's shape).
|
|
22
|
+
*
|
|
23
|
+
* **No signature** — OpenAI doesn't sign reasoning. The output's
|
|
24
|
+
* `signature` field stays undefined. No round-trip integrity invariant
|
|
25
|
+
* (unlike Anthropic).
|
|
26
|
+
*
|
|
27
|
+
* **No `parseChunk`** — OpenAI doesn't stream reasoning content as of
|
|
28
|
+
* early 2026. Reasoning arrives only on the terminal response. Per
|
|
29
|
+
* Phase 1 design, `parseChunk` is optional; we omit entirely.
|
|
30
|
+
*
|
|
31
|
+
* **No `usage.thinking` computation** — reasoning_tokens lives on
|
|
32
|
+
* `response.usage.completion_tokens_details.reasoning_tokens` and is
|
|
33
|
+
* the OpenAIProvider's job to surface (deferred). Handler doesn't
|
|
34
|
+
* compute token counts.
|
|
35
|
+
*/
|
|
36
|
+
import type { ThinkingHandler } from './types.js';
|
|
37
|
+
export declare const openAIThinkingHandler: ThinkingHandler;
|