@directive-run/ai 1.17.2 → 1.19.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/dist/ann-index-27QV9tPC.d.ts +616 -0
- package/dist/ann-index-HoZFIUA-.d.cts +616 -0
- package/dist/anthropic.d.cts +1 -1
- package/dist/anthropic.d.ts +1 -1
- package/dist/chunk-2PG26JZU.cjs +16 -0
- package/dist/chunk-2PG26JZU.cjs.map +1 -0
- package/dist/{chunk-7DPTXZZI.cjs → chunk-7EJN6TYX.cjs} +4 -4
- package/dist/chunk-7EJN6TYX.cjs.map +1 -0
- package/dist/{chunk-FN4GUZAI.js → chunk-G7CRWJT7.js} +4 -4
- package/dist/chunk-G7CRWJT7.js.map +1 -0
- package/dist/chunk-MIHH5GPT.js +16 -0
- package/dist/chunk-MIHH5GPT.js.map +1 -0
- package/dist/{chunk-56LYSE63.js → chunk-RHJAMXLS.js} +3 -3
- package/dist/{chunk-56LYSE63.js.map → chunk-RHJAMXLS.js.map} +1 -1
- package/dist/{chunk-PB276BX2.cjs → chunk-XGHNOSXT.cjs} +4 -4
- package/dist/{chunk-PB276BX2.cjs.map → chunk-XGHNOSXT.cjs.map} +1 -1
- package/dist/{debug-timeline-L13P-U2I.d.ts → debug-timeline-BGcPa0JO.d.ts} +1 -1
- package/dist/{debug-timeline-DpnRMnLU.d.cts → debug-timeline-Dn1lC_gK.d.cts} +1 -1
- package/dist/devtools.d.cts +5 -5
- package/dist/devtools.d.ts +5 -5
- package/dist/evals.d.cts +2 -2
- package/dist/evals.d.ts +2 -2
- package/dist/gemini.d.cts +1 -1
- package/dist/gemini.d.ts +1 -1
- package/dist/guardrails.cjs +1 -1
- package/dist/guardrails.cjs.map +1 -1
- package/dist/guardrails.d.cts +164 -592
- package/dist/guardrails.d.ts +164 -592
- package/dist/guardrails.js +1 -1
- package/dist/guardrails.js.map +1 -1
- package/dist/{health-monitor-C6xoXrQz.d.cts → health-monitor-Cq5sDvid.d.cts} +1 -1
- package/dist/{health-monitor-qL9RNMH3.d.ts → health-monitor-DtwmIJkb.d.ts} +1 -1
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -11
- package/dist/index.d.ts +94 -11
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/multi-agent-orchestrator-OX2TKD5Y.cjs +2 -0
- package/dist/{multi-agent-orchestrator-KFYIDKTF.cjs.map → multi-agent-orchestrator-OX2TKD5Y.cjs.map} +1 -1
- package/dist/{multi-agent-orchestrator-ZHSMWIKP.js → multi-agent-orchestrator-RMTLPKB4.js} +2 -2
- package/dist/{multi-agent-orchestrator-ZHSMWIKP.js.map → multi-agent-orchestrator-RMTLPKB4.js.map} +1 -1
- package/dist/multi-agent.cjs +1 -1
- package/dist/multi-agent.d.cts +6 -6
- package/dist/multi-agent.d.ts +6 -6
- package/dist/multi-agent.js +1 -1
- package/dist/ollama.d.cts +1 -1
- package/dist/ollama.d.ts +1 -1
- package/dist/openai.d.cts +2 -2
- package/dist/openai.d.ts +2 -2
- package/dist/{orchestrator-types-ZK9lv5Sm.d.ts → orchestrator-types-C5D5JZUj.d.ts} +103 -3
- package/dist/{orchestrator-types-CbNE7Rjp.d.cts → orchestrator-types-s0766dDB.d.cts} +103 -3
- package/dist/predicate.d.cts +1 -1
- package/dist/predicate.d.ts +1 -1
- package/dist/{semantic-cache-DM7ev7NQ.d.cts → semantic-cache-Ba0-jEwb.d.cts} +1 -1
- package/dist/{semantic-cache-DM7ev7NQ.d.ts → semantic-cache-Ba0-jEwb.d.ts} +1 -1
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +4 -4
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +1 -1
- package/dist/{types-DJ09LjZX.d.cts → types-CUp1N0uU.d.cts} +1 -1
- package/dist/{types-DJ09LjZX.d.ts → types-CUp1N0uU.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-7DPTXZZI.cjs.map +0 -1
- package/dist/chunk-D5APTMCT.cjs +0 -16
- package/dist/chunk-D5APTMCT.cjs.map +0 -1
- package/dist/chunk-FN4GUZAI.js.map +0 -1
- package/dist/chunk-YT4QN3KO.js +0 -16
- package/dist/chunk-YT4QN3KO.js.map +0 -1
- package/dist/multi-agent-orchestrator-KFYIDKTF.cjs +0 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { b as AgentLike, M as Message, o as AdapterHooks, c as AgentRunner,
|
|
2
|
-
export {
|
|
3
|
-
export { c as AgentMemory, d as AgentMemoryConfig, A as AgentOrchestrator, e as AgentRegistration, f as AgentRegistry, B as BackpressureStrategy, D as DebatePattern, g as DebateResult, h as DoneChunk, E as ErrorChunk, i as ExecutionPattern, G as GuardrailTriggeredChunk, H as HandoffRequest, j as HandoffResult, k as MemoryManageResult, l as MemoryState, m as MemoryStrategy, n as MemoryStrategyConfig, o as MemoryStrategyResult, p as MergedTaggedStreamResult, q as MessageChunk, r as MessageSummarizer, M as MultiAgentOrchestrator, a as MultiAgentOrchestratorOptions, s as MultiAgentRunCallOptions, t as MultiAgentState, b as MultiplexedStreamChunk, u as MultiplexedStreamResult, O as OrchestratorOptions, v as OrchestratorStreamChunk, w as OrchestratorStreamResult, P as ParallelPattern, x as ProgressChunk, y as RacePattern, z as RaceResult, C as RaceSuccessEntry, F as ReflectIterationRecord, I as ReflectPattern, J as ReflectionConfig, K as ReflectionContext, L as ReflectionEvaluation, R as ReflectionEvaluator, N as ReflectionExhaustedError, Q as RunAgentRequirement, S as RunCallOptions, U as SafeParseResult, V as SafeParseable, W as SequentialPattern, X as StreamChunk, Y as StreamRunOptions, Z as StreamRunner, _ as StreamingGuardrail, $ as StreamingGuardrailResult, a0 as StreamingRunResult, a1 as StructuredOutputConfig, a2 as StructuredOutputError, a3 as SupervisorPattern, a4 as TaskContext, T as TaskRegistration, a5 as TokenChunk, a6 as ToolEndChunk, a7 as ToolStartChunk, a8 as adaptOutputGuardrail, a9 as collectTokens, aa as combineStreamingGuardrails, ab as createAgentMemory, ac as createAgentOrchestrator, ad as createHybridStrategy, ae as createKeyPointsSummarizer, af as createLLMSummarizer, ag as createLengthStreamingGuardrail, ah as createPatternStreamingGuardrail, ai as createSlidingWindowStrategy, aj as createStreamingRunner, ak as createTokenBasedStrategy, al as createToxicityStreamingGuardrail, am as createTruncationSummarizer, an as extractJsonFromOutput, ao as filterStream, ap as mapStream, aq as mergeTaggedStreams, ar as tapStream, as as withReflection, at as withStructuredOutput } from './orchestrator-types-
|
|
4
|
-
import { PIIType, RedactionStyle } from './
|
|
5
|
-
export { ANNIndex, ANNSearchResult, DEFAULT_INJECTION_PATTERNS, DetectedPII, EnhancedPIIGuardrailOptions, InjectionDetectionResult, PIIDetectionResult, PIIDetector, PromptInjectionGuardrailOptions, RateLimitGuardrail, STRICT_INJECTION_PATTERNS, VPTreeIndexConfig, createBruteForceIndex, createContentFilterGuardrail, createEnhancedPIIGuardrail, createLengthGuardrail, createModerationGuardrail, createOutputPIIGuardrail, createOutputSchemaGuardrail, createOutputTypeGuardrail, createPIIGuardrail, createPromptInjectionGuardrail, createRateLimitGuardrail, createToolGuardrail, createUntrustedContentGuardrail, createVPTreeIndex, detectAndRedactPII, detectPII, detectPromptInjection, markUntrustedContent, redactPII, sanitizeInjection } from './
|
|
1
|
+
import { b as AgentLike, M as Message, o as AdapterHooks, c as AgentRunner, a2 as ApprovalState, a3 as AgentState, m as GuardrailFn, I as InputGuardrailData, R as RunOptions, r as RunResult } from './types-CUp1N0uU.cjs';
|
|
2
|
+
export { a4 as AgentCircuitBreakerConfig, a5 as AgentCompleteEvent, a6 as AgentErrorEvent, a7 as AgentHealthState, x as AgentRetryConfig, a8 as AgentRetryEvent, K as AgentSelectionStrategy, a9 as AgentStartEvent, A as ApprovalRequest, aa as ApprovalRequestEvent, ab as ApprovalResponseEvent, E as BreakpointConfig, ac as BreakpointContext, ad as BreakpointHitEvent, B as BreakpointModifications, d as BreakpointRequest, ae as BreakpointResumedEvent, af as BreakpointState, ag as BreakpointType, C as Checkpoint, ah as CheckpointContext, ai as CheckpointDiff, aj as CheckpointLocalState, ak as CheckpointProgress, al as CheckpointRestoreEvent, am as CheckpointSaveEvent, h as CheckpointStore, an as ConstraintEvaluateEvent, a1 as CrossAgentDerivationFn, ao as CrossAgentSnapshot, Z as DagCheckpointState, D as DagExecutionContext, j as DagNode, e as DagNodeStatus, ap as DagNodeUpdateEvent, k as DagPattern, Y as DebateCheckpointState, aq as DebateRoundEvent, l as DebugEvent, ar as DebugEventBase, g as DebugEventType, as as DerivationUpdateEvent, at as GoalCheckpointConfig, U as GoalCheckpointState, au as GoalMetrics, J as GoalNode, F as GoalPattern, Q as GoalResult, av as GoalStepMetrics, aw as GuardrailCheckEvent, n as GuardrailContext, ax as GuardrailError, ay as GuardrailErrorCode, G as GuardrailResult, az as GuardrailRetryConfig, v as GuardrailsConfig, aA as HandoffCompleteEvent, aB as HandoffStartEvent, H as HealthMonitorConfig, i as InMemoryCheckpointStore, aC as InMemoryCheckpointStoreOptions, aD as MAX_BREAKPOINT_HISTORY, a0 as MultiAgentBreakpointType, aE as MultiAgentCheckpointLocalState, _ as MultiAgentLifecycleHooks, $ as MultiAgentSelfHealingConfig, N as NamedGuardrail, t as OrchestratorConstraint, w as OrchestratorDebugConfig, y as OrchestratorLifecycleHooks, u as OrchestratorResolver, aF as OrchestratorResolverContext, s as OrchestratorState, O as OutputGuardrailData, aG as PatternCheckpointBase, P as PatternCheckpointConfig, aH as PatternCheckpointState, aI as PatternCompleteEvent, aJ as PatternStartEvent, aK as RaceCancelledEvent, aL as RaceStartEvent, aM as RaceWinnerEvent, X as ReflectCheckpointState, aN as ReflectionIterationEvent, aO as RejectedRequest, aP as RelaxationContext, aQ as RelaxationRecord, aR as RelaxationStrategy, L as RelaxationTier, aS as RerouteDebugEvent, f as RerouteEvent, aT as ResolverCompleteEvent, aU as ResolverErrorEvent, aV as ResolverStartEvent, aW as SchemaValidationResult, q as SchemaValidator, S as Scratchpad, aX as ScratchpadUpdateEvent, z as SelfHealingConfig, V as SequentialCheckpointState, aY as SingleAgentCheckpointLocalState, p as StreamingCallbackRunner, W as SupervisorCheckpointState, aZ as TaskCompleteEvent, a_ as TaskErrorEvent, a$ as TaskProgressEvent, b0 as TaskStartEvent, b1 as TokenUsage, a as ToolCall, T as ToolCallGuardrailData, b2 as createBreakpointId, b3 as createCheckpointId, b4 as createInitialBreakpointState, b5 as isGuardrailError, b6 as matchBreakpoint, b7 as validateCheckpoint } from './types-CUp1N0uU.cjs';
|
|
3
|
+
export { c as AgentMemory, d as AgentMemoryConfig, A as AgentOrchestrator, e as AgentRegistration, f as AgentRegistry, B as BackpressureStrategy, D as DebatePattern, g as DebateResult, h as DoneChunk, E as ErrorChunk, i as ExecutionPattern, G as GuardrailTriggeredChunk, H as HandoffRequest, j as HandoffResult, k as MemoryManageResult, l as MemoryState, m as MemoryStrategy, n as MemoryStrategyConfig, o as MemoryStrategyResult, p as MergedTaggedStreamResult, q as MessageChunk, r as MessageSummarizer, M as MultiAgentOrchestrator, a as MultiAgentOrchestratorOptions, s as MultiAgentRunCallOptions, t as MultiAgentState, b as MultiplexedStreamChunk, u as MultiplexedStreamResult, O as OrchestratorOptions, v as OrchestratorStreamChunk, w as OrchestratorStreamResult, P as ParallelPattern, x as ProgressChunk, y as RacePattern, z as RaceResult, C as RaceSuccessEntry, F as ReflectIterationRecord, I as ReflectPattern, J as ReflectionConfig, K as ReflectionContext, L as ReflectionEvaluation, R as ReflectionEvaluator, N as ReflectionExhaustedError, Q as RunAgentRequirement, S as RunCallOptions, U as SafeParseResult, V as SafeParseable, W as SequentialPattern, X as StreamChunk, Y as StreamRunOptions, Z as StreamRunner, _ as StreamingGuardrail, $ as StreamingGuardrailResult, a0 as StreamingRunResult, a1 as StructuredOutputConfig, a2 as StructuredOutputError, a3 as SupervisorPattern, a4 as TaskContext, T as TaskRegistration, a5 as TokenChunk, a6 as ToolEndChunk, a7 as ToolStartChunk, a8 as adaptOutputGuardrail, a9 as collectTokens, aa as combineStreamingGuardrails, ab as createAgentMemory, ac as createAgentOrchestrator, ad as createHybridStrategy, ae as createKeyPointsSummarizer, af as createLLMSummarizer, ag as createLengthStreamingGuardrail, ah as createPatternStreamingGuardrail, ai as createSlidingWindowStrategy, aj as createStreamingRunner, ak as createTokenBasedStrategy, al as createToxicityStreamingGuardrail, am as createTruncationSummarizer, an as extractJsonFromOutput, ao as filterStream, ap as mapStream, aq as mergeTaggedStreams, ar as tapStream, as as withReflection, at as withStructuredOutput } from './orchestrator-types-s0766dDB.cjs';
|
|
4
|
+
import { d as PIIType, f as RedactionStyle } from './ann-index-HoZFIUA-.cjs';
|
|
5
|
+
export { A as ANNIndex, a as ANNSearchResult, D as DEFAULT_INJECTION_PATTERNS, b as DetectedPII, E as EnhancedPIIGuardrailOptions, I as InjectionDetectionResult, P as PIIDetectionResult, c as PIIDetector, e as PromptInjectionGuardrailOptions, R as RateLimitGuardrail, S as STRICT_INJECTION_PATTERNS, V as VPTreeIndexConfig, g as createBruteForceIndex, h as createContentFilterGuardrail, i as createEnhancedPIIGuardrail, j as createLengthGuardrail, k as createModerationGuardrail, l as createOutputPIIGuardrail, m as createOutputSchemaGuardrail, n as createOutputTypeGuardrail, o as createPIIGuardrail, p as createPromptInjectionGuardrail, q as createRateLimitGuardrail, r as createToolGuardrail, s as createUntrustedContentGuardrail, t as createVPTreeIndex, u as detectAndRedactPII, v as detectPII, w as detectPromptInjection, x as markUntrustedContent, y as redactPII, z as sanitizeInjection } from './ann-index-HoZFIUA-.cjs';
|
|
6
6
|
export { AgentInfo, AgentMessage, AgentMessageType, AgentNetwork, AgentNetworkConfig, DebateConfig, DelegationMessage, DelegationResultMessage, GoalAgentDeclaration, GoalDependencyEdge, GoalDependencyGraph, GoalExecutionPlan, GoalExplanation, GoalExplanationStep, GoalPlanStep, GoalValidationResult, InformMessage, MermaidDirection, MermaidNodeShapes, MermaidOptions, MessageBus, MessageBusConfig, MessageFilter, MessageHandler, QueryMessage, RequestMessage, ResponseMessage, Semaphore, SerializedDagNode, SerializedGoalNode, SerializedPattern, SpawnOnConditionOptions, SpawnPoolConfig, Subscription, TypedAgentMessage, UpdateMessage, aggregateTokens, allReadyStrategy, capabilityRoute, collectOutputs, composePatterns, concatResults, costEfficientStrategy, createAgentNetwork, createDelegator, createMessageBus, createMultiAgentOrchestrator, createPubSub, createResponder, dag, debate, derivedConstraint, diffCheckpoints, explainGoal, findAgentsByCapability, forkFromCheckpoint, getCheckpointProgress, getDependencyGraph, getPatternStep, goal, highestImpactStrategy, parallel, patternFromJSON, patternToJSON, patternToMermaid, pickBestResult, planGoal, race, reflect, runAgentRequirement, runDebate, selectAgent, sequential, spawnOnCondition, spawnPool, supervisor, validateGoal } from './multi-agent.cjs';
|
|
7
7
|
export { AggregatedMetric, AlertConfig, AlertEvent, CircuitBreaker, CircuitBreakerConfig, CircuitBreakerOpenError, CircuitBreakerStats, CircuitState, DashboardData, MetricDataPoint, MetricType, OTLPExporter, OTLPExporterConfig, ObservabilityConfig, ObservabilityInstance, TraceSpan, createCircuitBreaker, createOTLPExporter } from '@directive-run/core/plugins';
|
|
8
8
|
import { ModuleSchema, Plugin, SystemInspection } from '@directive-run/core';
|
|
9
|
-
import {
|
|
10
|
-
export { B as BatchedEmbedder, C as CacheEntry,
|
|
9
|
+
import { c as Embedding, E as EmbedderFn } from './semantic-cache-Ba0-jEwb.cjs';
|
|
10
|
+
export { B as BatchedEmbedder, C as CacheEntry, a as CacheLookupResult, b as CacheStats, S as SemanticCache, d as SemanticCacheConfig, e as SemanticCacheStorage, f as createBatchedEmbedder, g as createInMemoryStorage, h as createSemanticCache, i as createSemanticCacheGuardrail, j as createTestEmbedder } from './semantic-cache-Ba0-jEwb.cjs';
|
|
11
11
|
export { PredicateFromIntentDiagnostics, PredicateFromIntentError, PredicateFromIntentOptions, PredicateFromIntentProvenance, PredicateFromIntentWithProvenanceResult, PredicateToolSpec, PredicateToolSpecAnthropic, PredicateToolSpecOpenAI, PredicateToolSpecOptions, predicateFromIntent, predicateFromIntentRaw, predicateFromIntentWithProvenance, predicateToolSpec, predicateToolSpecAnthropic, predicateToolSpecOpenAI } from './predicate.cjs';
|
|
12
|
-
import { D as DebugTimeline } from './debug-timeline-
|
|
13
|
-
export { a as DebugTimelineListener, b as DebugTimelineOptions, c as createDebugTimeline, d as createDebugTimelinePlugin } from './debug-timeline-
|
|
14
|
-
export { A as AgentHealthMetrics, a as HealthCircuitState, H as HealthMonitor, c as createHealthMonitor } from './health-monitor-
|
|
12
|
+
import { D as DebugTimeline } from './debug-timeline-Dn1lC_gK.cjs';
|
|
13
|
+
export { a as DebugTimelineListener, b as DebugTimelineOptions, c as createDebugTimeline, d as createDebugTimelinePlugin } from './debug-timeline-Dn1lC_gK.cjs';
|
|
14
|
+
export { A as AgentHealthMetrics, a as HealthCircuitState, H as HealthMonitor, c as createHealthMonitor } from './health-monitor-Cq5sDvid.cjs';
|
|
15
15
|
export { ConnectDevToolsOptions, DevToolsClient, DevToolsClientMessage, DevToolsCompatibleOrchestrator, DevToolsServer, DevToolsServerConfig, DevToolsServerMessage, DevToolsSnapshot, DevToolsTransport, WsTransportConfig, connectDevTools, createDevToolsServer, createWsTransport } from './devtools.cjs';
|
|
16
16
|
export { MCPAdapter, MCPAdapterConfig, MCPApprovalRequest, MCPCallToolRequirement, MCPGetPromptRequirement, MCPReadResourceRequirement, MCPRequirement, MCPResource, MCPServerConfig, MCPSyncResourcesRequirement, MCPTool, MCPToolConstraint, MCPToolResult, convertToolsForLLM, createMCPAdapter, mcpCallTool, mcpGetPrompt, mcpReadResource, mcpSyncResources } from './mcp.cjs';
|
|
17
17
|
export { EvalAgentSummary, EvalAssertOptions, EvalCase, EvalCaseResult, EvalContext, EvalCostOptions, EvalCriterion, EvalCriterionFn, EvalJudgeOptions, EvalLatencyOptions, EvalMatchOptions, EvalOutputLengthOptions, EvalResults, EvalSafetyOptions, EvalScore, EvalSemanticOptions, EvalStructureOptions, EvalSuite, EvalSuiteConfig, createEvalSuite, evalAssert, evalCoherence, evalCost, evalFaithfulness, evalJudge, evalLatency, evalMatch, evalOutputLength, evalRelevance, evalSafety, evalStructure } from './evals.cjs';
|
|
@@ -1806,4 +1806,87 @@ interface OtelPlugin {
|
|
|
1806
1806
|
*/
|
|
1807
1807
|
declare function createOtelPlugin(config: OtelPluginConfig): OtelPlugin;
|
|
1808
1808
|
|
|
1809
|
-
|
|
1809
|
+
/**
|
|
1810
|
+
* OTel × Sources — emit source-lifecycle spans from `system.observe()`
|
|
1811
|
+
*
|
|
1812
|
+
* The R5 observability reviewer found `@directive-run/ai/otel.ts`
|
|
1813
|
+
* subscribes only to the AI `DebugTimeline` event stream — so the four
|
|
1814
|
+
* `ObservationEvent.source.*` variants (`source.attach`,
|
|
1815
|
+
* `source.publish`, `source.detach`, `source.error`) shipped by the
|
|
1816
|
+
* source primitive never reach the OTel exporter. SREs running with
|
|
1817
|
+
* `createOtelPlugin` see agent spans but cannot answer "which source
|
|
1818
|
+
* is publishing?" or "did source `mcp` error attach?" from their
|
|
1819
|
+
* tracing backend.
|
|
1820
|
+
*
|
|
1821
|
+
* This module closes the gap as a focused helper (NOT a second OTel
|
|
1822
|
+
* plugin) so a single `OtelTracer` can carry both AI and core source
|
|
1823
|
+
* spans. Wire it once at `createSystem` time:
|
|
1824
|
+
*
|
|
1825
|
+
* @example Wire source events into the same OTel tracer as the AI plugin
|
|
1826
|
+
* ```ts
|
|
1827
|
+
* import { trace } from "@opentelemetry/api";
|
|
1828
|
+
* import { createSystem } from "@directive-run/core";
|
|
1829
|
+
* import { createOtelPlugin, attachSourcesToOtel } from "@directive-run/ai";
|
|
1830
|
+
*
|
|
1831
|
+
* const tracer = trace.getTracer("directive-app");
|
|
1832
|
+
* const otel = createOtelPlugin({ serviceName: "my-app", tracer });
|
|
1833
|
+
*
|
|
1834
|
+
* const system = createSystem({ module });
|
|
1835
|
+
* otel.attach(orchestrator.timeline); // existing AI wiring
|
|
1836
|
+
* const unsub = attachSourcesToOtel(system, { // NEW — source.* spans
|
|
1837
|
+
* tracer,
|
|
1838
|
+
* serviceName: "my-app",
|
|
1839
|
+
* });
|
|
1840
|
+
*
|
|
1841
|
+
* system.start();
|
|
1842
|
+
*
|
|
1843
|
+
* // Later
|
|
1844
|
+
* unsub();
|
|
1845
|
+
* ```
|
|
1846
|
+
*
|
|
1847
|
+
* Spans emitted:
|
|
1848
|
+
*
|
|
1849
|
+
* - `directive.source.attach` — short-duration (start → end same tick)
|
|
1850
|
+
* span with attributes `source.id`, `source.module_id`, plus
|
|
1851
|
+
* `attached_at` timestamp.
|
|
1852
|
+
* - `directive.source.publish` — short-duration counter span (NOT a
|
|
1853
|
+
* per-publish full span; events of this kind are emitted as
|
|
1854
|
+
* span EVENTS on a long-lived per-source "active" span so cardinality
|
|
1855
|
+
* stays bounded).
|
|
1856
|
+
* - `directive.source.detach` — short-duration span, ends the matching
|
|
1857
|
+
* "active" parent.
|
|
1858
|
+
* - `directive.source.error` — error-status span carrying the phase
|
|
1859
|
+
* (`attach`/`cleanup`/`runtime` per RFC 0008) and the truncated
|
|
1860
|
+
* message from R6/R7.
|
|
1861
|
+
*
|
|
1862
|
+
* Cardinality budget: ONE active span per (sourceId, moduleId) at a
|
|
1863
|
+
* time. Publishes attach as span events (cheap), not as new spans. At
|
|
1864
|
+
* 10 sources × 100 publishes/sec the exporter sees 1000 events/sec on
|
|
1865
|
+
* 10 long-lived spans — well within typical OTel collector budgets.
|
|
1866
|
+
*/
|
|
1867
|
+
|
|
1868
|
+
interface SourcesOtelOptions {
|
|
1869
|
+
/** Tracer to emit spans through. */
|
|
1870
|
+
tracer: OtelTracer;
|
|
1871
|
+
/** Service name attribute for every span. */
|
|
1872
|
+
serviceName: string;
|
|
1873
|
+
/** Span name prefix. Default: `"directive.source"`. */
|
|
1874
|
+
spanPrefix?: string;
|
|
1875
|
+
/**
|
|
1876
|
+
* Optional sampling for publish events. Sources at very high publish
|
|
1877
|
+
* rate (price ticks, cursor moves) may want to drop most publish
|
|
1878
|
+
* events from the trace. Default: `1.0` (every publish recorded as
|
|
1879
|
+
* an event on the active span).
|
|
1880
|
+
*/
|
|
1881
|
+
publishSampleRate?: number;
|
|
1882
|
+
}
|
|
1883
|
+
/**
|
|
1884
|
+
* Subscribe to a system's source-lifecycle events and emit OTel spans
|
|
1885
|
+
* for each. Returns an unsubscribe to detach.
|
|
1886
|
+
*
|
|
1887
|
+
* @returns a function that detaches the OTel wiring without affecting
|
|
1888
|
+
* other observers.
|
|
1889
|
+
*/
|
|
1890
|
+
declare function attachSourcesToOtel(system: unknown, options: SourcesOtelOptions): () => void;
|
|
1891
|
+
|
|
1892
|
+
export { AdapterHooks, AgentLike, AgentRunner, AgentState, AllProvidersFailedError, ApprovalState, type AuditEventType, type AuditInstance, type AuditPluginConfig, type BatchQueue, type BatchQueueConfig, type BidirectionalStream, type BudgetConfig, type BudgetExceededDetails, BudgetExceededError, type BudgetRunner, type BudgetWindow, type ComplianceConfig, type ComplianceInstance, type ComplianceStorage, type ConstraintRouterConfig, type ConstraintRouterRunner, type CreateRunnerOptions, DebugTimeline, EmbedderFn, Embedding, type FallbackConfig, GuardrailFn, InputGuardrailData, type JSONFileStoreOptions, Message, type ModelRule, type ModelSelectionConfig, type OtelPlugin, type OtelPluginConfig, type OtelSpan, OtelStatusCode, type OtelTracer, PIIType, type ParsedResponse, type ProviderStats, type RAGChunk, type RAGEnrichOptions, type RAGEnricher, type RAGEnricherConfig, type RAGStorage, RedactionStyle, type RetryConfig, RetryExhaustedError, type RoutingConstraint, type RoutingFacts, type RoutingProvider, RunOptions, RunResult, type RunnerMiddleware, type SSEEvent, type SSETransport, type SSETransportConfig, type SourcesOtelOptions, type SpanData, type StreamChannel, type StreamChannelConfig, type StreamChannelState, type TokenPricing, attachSourcesToOtel, byAgentName, byInputLength, byPattern, createAgentAuditHandlers, createAuditTrail, createBatchQueue, createBidirectionalStream, createCompliance, createConstraintRouter, createInMemoryComplianceStorage, createJSONFileStore, createOtelPlugin, createRAGEnricher, createRunner, createSSETransport, createStreamChannel, estimateCost, formatSystemMeta, hasPendingApprovals, isAgentRunning, mergeStreams, parseHttpStatus, parseRetryAfter, pipe, pipeThrough, toAIContext, validateBaseURL, withBudget, withFallback, withModelSelection, withRetry };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { b as AgentLike, M as Message, o as AdapterHooks, c as AgentRunner,
|
|
2
|
-
export {
|
|
3
|
-
export { c as AgentMemory, d as AgentMemoryConfig, A as AgentOrchestrator, e as AgentRegistration, f as AgentRegistry, B as BackpressureStrategy, D as DebatePattern, g as DebateResult, h as DoneChunk, E as ErrorChunk, i as ExecutionPattern, G as GuardrailTriggeredChunk, H as HandoffRequest, j as HandoffResult, k as MemoryManageResult, l as MemoryState, m as MemoryStrategy, n as MemoryStrategyConfig, o as MemoryStrategyResult, p as MergedTaggedStreamResult, q as MessageChunk, r as MessageSummarizer, M as MultiAgentOrchestrator, a as MultiAgentOrchestratorOptions, s as MultiAgentRunCallOptions, t as MultiAgentState, b as MultiplexedStreamChunk, u as MultiplexedStreamResult, O as OrchestratorOptions, v as OrchestratorStreamChunk, w as OrchestratorStreamResult, P as ParallelPattern, x as ProgressChunk, y as RacePattern, z as RaceResult, C as RaceSuccessEntry, F as ReflectIterationRecord, I as ReflectPattern, J as ReflectionConfig, K as ReflectionContext, L as ReflectionEvaluation, R as ReflectionEvaluator, N as ReflectionExhaustedError, Q as RunAgentRequirement, S as RunCallOptions, U as SafeParseResult, V as SafeParseable, W as SequentialPattern, X as StreamChunk, Y as StreamRunOptions, Z as StreamRunner, _ as StreamingGuardrail, $ as StreamingGuardrailResult, a0 as StreamingRunResult, a1 as StructuredOutputConfig, a2 as StructuredOutputError, a3 as SupervisorPattern, a4 as TaskContext, T as TaskRegistration, a5 as TokenChunk, a6 as ToolEndChunk, a7 as ToolStartChunk, a8 as adaptOutputGuardrail, a9 as collectTokens, aa as combineStreamingGuardrails, ab as createAgentMemory, ac as createAgentOrchestrator, ad as createHybridStrategy, ae as createKeyPointsSummarizer, af as createLLMSummarizer, ag as createLengthStreamingGuardrail, ah as createPatternStreamingGuardrail, ai as createSlidingWindowStrategy, aj as createStreamingRunner, ak as createTokenBasedStrategy, al as createToxicityStreamingGuardrail, am as createTruncationSummarizer, an as extractJsonFromOutput, ao as filterStream, ap as mapStream, aq as mergeTaggedStreams, ar as tapStream, as as withReflection, at as withStructuredOutput } from './orchestrator-types-
|
|
4
|
-
import { PIIType, RedactionStyle } from './
|
|
5
|
-
export { ANNIndex, ANNSearchResult, DEFAULT_INJECTION_PATTERNS, DetectedPII, EnhancedPIIGuardrailOptions, InjectionDetectionResult, PIIDetectionResult, PIIDetector, PromptInjectionGuardrailOptions, RateLimitGuardrail, STRICT_INJECTION_PATTERNS, VPTreeIndexConfig, createBruteForceIndex, createContentFilterGuardrail, createEnhancedPIIGuardrail, createLengthGuardrail, createModerationGuardrail, createOutputPIIGuardrail, createOutputSchemaGuardrail, createOutputTypeGuardrail, createPIIGuardrail, createPromptInjectionGuardrail, createRateLimitGuardrail, createToolGuardrail, createUntrustedContentGuardrail, createVPTreeIndex, detectAndRedactPII, detectPII, detectPromptInjection, markUntrustedContent, redactPII, sanitizeInjection } from './
|
|
1
|
+
import { b as AgentLike, M as Message, o as AdapterHooks, c as AgentRunner, a2 as ApprovalState, a3 as AgentState, m as GuardrailFn, I as InputGuardrailData, R as RunOptions, r as RunResult } from './types-CUp1N0uU.js';
|
|
2
|
+
export { a4 as AgentCircuitBreakerConfig, a5 as AgentCompleteEvent, a6 as AgentErrorEvent, a7 as AgentHealthState, x as AgentRetryConfig, a8 as AgentRetryEvent, K as AgentSelectionStrategy, a9 as AgentStartEvent, A as ApprovalRequest, aa as ApprovalRequestEvent, ab as ApprovalResponseEvent, E as BreakpointConfig, ac as BreakpointContext, ad as BreakpointHitEvent, B as BreakpointModifications, d as BreakpointRequest, ae as BreakpointResumedEvent, af as BreakpointState, ag as BreakpointType, C as Checkpoint, ah as CheckpointContext, ai as CheckpointDiff, aj as CheckpointLocalState, ak as CheckpointProgress, al as CheckpointRestoreEvent, am as CheckpointSaveEvent, h as CheckpointStore, an as ConstraintEvaluateEvent, a1 as CrossAgentDerivationFn, ao as CrossAgentSnapshot, Z as DagCheckpointState, D as DagExecutionContext, j as DagNode, e as DagNodeStatus, ap as DagNodeUpdateEvent, k as DagPattern, Y as DebateCheckpointState, aq as DebateRoundEvent, l as DebugEvent, ar as DebugEventBase, g as DebugEventType, as as DerivationUpdateEvent, at as GoalCheckpointConfig, U as GoalCheckpointState, au as GoalMetrics, J as GoalNode, F as GoalPattern, Q as GoalResult, av as GoalStepMetrics, aw as GuardrailCheckEvent, n as GuardrailContext, ax as GuardrailError, ay as GuardrailErrorCode, G as GuardrailResult, az as GuardrailRetryConfig, v as GuardrailsConfig, aA as HandoffCompleteEvent, aB as HandoffStartEvent, H as HealthMonitorConfig, i as InMemoryCheckpointStore, aC as InMemoryCheckpointStoreOptions, aD as MAX_BREAKPOINT_HISTORY, a0 as MultiAgentBreakpointType, aE as MultiAgentCheckpointLocalState, _ as MultiAgentLifecycleHooks, $ as MultiAgentSelfHealingConfig, N as NamedGuardrail, t as OrchestratorConstraint, w as OrchestratorDebugConfig, y as OrchestratorLifecycleHooks, u as OrchestratorResolver, aF as OrchestratorResolverContext, s as OrchestratorState, O as OutputGuardrailData, aG as PatternCheckpointBase, P as PatternCheckpointConfig, aH as PatternCheckpointState, aI as PatternCompleteEvent, aJ as PatternStartEvent, aK as RaceCancelledEvent, aL as RaceStartEvent, aM as RaceWinnerEvent, X as ReflectCheckpointState, aN as ReflectionIterationEvent, aO as RejectedRequest, aP as RelaxationContext, aQ as RelaxationRecord, aR as RelaxationStrategy, L as RelaxationTier, aS as RerouteDebugEvent, f as RerouteEvent, aT as ResolverCompleteEvent, aU as ResolverErrorEvent, aV as ResolverStartEvent, aW as SchemaValidationResult, q as SchemaValidator, S as Scratchpad, aX as ScratchpadUpdateEvent, z as SelfHealingConfig, V as SequentialCheckpointState, aY as SingleAgentCheckpointLocalState, p as StreamingCallbackRunner, W as SupervisorCheckpointState, aZ as TaskCompleteEvent, a_ as TaskErrorEvent, a$ as TaskProgressEvent, b0 as TaskStartEvent, b1 as TokenUsage, a as ToolCall, T as ToolCallGuardrailData, b2 as createBreakpointId, b3 as createCheckpointId, b4 as createInitialBreakpointState, b5 as isGuardrailError, b6 as matchBreakpoint, b7 as validateCheckpoint } from './types-CUp1N0uU.js';
|
|
3
|
+
export { c as AgentMemory, d as AgentMemoryConfig, A as AgentOrchestrator, e as AgentRegistration, f as AgentRegistry, B as BackpressureStrategy, D as DebatePattern, g as DebateResult, h as DoneChunk, E as ErrorChunk, i as ExecutionPattern, G as GuardrailTriggeredChunk, H as HandoffRequest, j as HandoffResult, k as MemoryManageResult, l as MemoryState, m as MemoryStrategy, n as MemoryStrategyConfig, o as MemoryStrategyResult, p as MergedTaggedStreamResult, q as MessageChunk, r as MessageSummarizer, M as MultiAgentOrchestrator, a as MultiAgentOrchestratorOptions, s as MultiAgentRunCallOptions, t as MultiAgentState, b as MultiplexedStreamChunk, u as MultiplexedStreamResult, O as OrchestratorOptions, v as OrchestratorStreamChunk, w as OrchestratorStreamResult, P as ParallelPattern, x as ProgressChunk, y as RacePattern, z as RaceResult, C as RaceSuccessEntry, F as ReflectIterationRecord, I as ReflectPattern, J as ReflectionConfig, K as ReflectionContext, L as ReflectionEvaluation, R as ReflectionEvaluator, N as ReflectionExhaustedError, Q as RunAgentRequirement, S as RunCallOptions, U as SafeParseResult, V as SafeParseable, W as SequentialPattern, X as StreamChunk, Y as StreamRunOptions, Z as StreamRunner, _ as StreamingGuardrail, $ as StreamingGuardrailResult, a0 as StreamingRunResult, a1 as StructuredOutputConfig, a2 as StructuredOutputError, a3 as SupervisorPattern, a4 as TaskContext, T as TaskRegistration, a5 as TokenChunk, a6 as ToolEndChunk, a7 as ToolStartChunk, a8 as adaptOutputGuardrail, a9 as collectTokens, aa as combineStreamingGuardrails, ab as createAgentMemory, ac as createAgentOrchestrator, ad as createHybridStrategy, ae as createKeyPointsSummarizer, af as createLLMSummarizer, ag as createLengthStreamingGuardrail, ah as createPatternStreamingGuardrail, ai as createSlidingWindowStrategy, aj as createStreamingRunner, ak as createTokenBasedStrategy, al as createToxicityStreamingGuardrail, am as createTruncationSummarizer, an as extractJsonFromOutput, ao as filterStream, ap as mapStream, aq as mergeTaggedStreams, ar as tapStream, as as withReflection, at as withStructuredOutput } from './orchestrator-types-C5D5JZUj.js';
|
|
4
|
+
import { d as PIIType, f as RedactionStyle } from './ann-index-27QV9tPC.js';
|
|
5
|
+
export { A as ANNIndex, a as ANNSearchResult, D as DEFAULT_INJECTION_PATTERNS, b as DetectedPII, E as EnhancedPIIGuardrailOptions, I as InjectionDetectionResult, P as PIIDetectionResult, c as PIIDetector, e as PromptInjectionGuardrailOptions, R as RateLimitGuardrail, S as STRICT_INJECTION_PATTERNS, V as VPTreeIndexConfig, g as createBruteForceIndex, h as createContentFilterGuardrail, i as createEnhancedPIIGuardrail, j as createLengthGuardrail, k as createModerationGuardrail, l as createOutputPIIGuardrail, m as createOutputSchemaGuardrail, n as createOutputTypeGuardrail, o as createPIIGuardrail, p as createPromptInjectionGuardrail, q as createRateLimitGuardrail, r as createToolGuardrail, s as createUntrustedContentGuardrail, t as createVPTreeIndex, u as detectAndRedactPII, v as detectPII, w as detectPromptInjection, x as markUntrustedContent, y as redactPII, z as sanitizeInjection } from './ann-index-27QV9tPC.js';
|
|
6
6
|
export { AgentInfo, AgentMessage, AgentMessageType, AgentNetwork, AgentNetworkConfig, DebateConfig, DelegationMessage, DelegationResultMessage, GoalAgentDeclaration, GoalDependencyEdge, GoalDependencyGraph, GoalExecutionPlan, GoalExplanation, GoalExplanationStep, GoalPlanStep, GoalValidationResult, InformMessage, MermaidDirection, MermaidNodeShapes, MermaidOptions, MessageBus, MessageBusConfig, MessageFilter, MessageHandler, QueryMessage, RequestMessage, ResponseMessage, Semaphore, SerializedDagNode, SerializedGoalNode, SerializedPattern, SpawnOnConditionOptions, SpawnPoolConfig, Subscription, TypedAgentMessage, UpdateMessage, aggregateTokens, allReadyStrategy, capabilityRoute, collectOutputs, composePatterns, concatResults, costEfficientStrategy, createAgentNetwork, createDelegator, createMessageBus, createMultiAgentOrchestrator, createPubSub, createResponder, dag, debate, derivedConstraint, diffCheckpoints, explainGoal, findAgentsByCapability, forkFromCheckpoint, getCheckpointProgress, getDependencyGraph, getPatternStep, goal, highestImpactStrategy, parallel, patternFromJSON, patternToJSON, patternToMermaid, pickBestResult, planGoal, race, reflect, runAgentRequirement, runDebate, selectAgent, sequential, spawnOnCondition, spawnPool, supervisor, validateGoal } from './multi-agent.js';
|
|
7
7
|
export { AggregatedMetric, AlertConfig, AlertEvent, CircuitBreaker, CircuitBreakerConfig, CircuitBreakerOpenError, CircuitBreakerStats, CircuitState, DashboardData, MetricDataPoint, MetricType, OTLPExporter, OTLPExporterConfig, ObservabilityConfig, ObservabilityInstance, TraceSpan, createCircuitBreaker, createOTLPExporter } from '@directive-run/core/plugins';
|
|
8
8
|
import { ModuleSchema, Plugin, SystemInspection } from '@directive-run/core';
|
|
9
|
-
import {
|
|
10
|
-
export { B as BatchedEmbedder, C as CacheEntry,
|
|
9
|
+
import { c as Embedding, E as EmbedderFn } from './semantic-cache-Ba0-jEwb.js';
|
|
10
|
+
export { B as BatchedEmbedder, C as CacheEntry, a as CacheLookupResult, b as CacheStats, S as SemanticCache, d as SemanticCacheConfig, e as SemanticCacheStorage, f as createBatchedEmbedder, g as createInMemoryStorage, h as createSemanticCache, i as createSemanticCacheGuardrail, j as createTestEmbedder } from './semantic-cache-Ba0-jEwb.js';
|
|
11
11
|
export { PredicateFromIntentDiagnostics, PredicateFromIntentError, PredicateFromIntentOptions, PredicateFromIntentProvenance, PredicateFromIntentWithProvenanceResult, PredicateToolSpec, PredicateToolSpecAnthropic, PredicateToolSpecOpenAI, PredicateToolSpecOptions, predicateFromIntent, predicateFromIntentRaw, predicateFromIntentWithProvenance, predicateToolSpec, predicateToolSpecAnthropic, predicateToolSpecOpenAI } from './predicate.js';
|
|
12
|
-
import { D as DebugTimeline } from './debug-timeline-
|
|
13
|
-
export { a as DebugTimelineListener, b as DebugTimelineOptions, c as createDebugTimeline, d as createDebugTimelinePlugin } from './debug-timeline-
|
|
14
|
-
export { A as AgentHealthMetrics, a as HealthCircuitState, H as HealthMonitor, c as createHealthMonitor } from './health-monitor-
|
|
12
|
+
import { D as DebugTimeline } from './debug-timeline-BGcPa0JO.js';
|
|
13
|
+
export { a as DebugTimelineListener, b as DebugTimelineOptions, c as createDebugTimeline, d as createDebugTimelinePlugin } from './debug-timeline-BGcPa0JO.js';
|
|
14
|
+
export { A as AgentHealthMetrics, a as HealthCircuitState, H as HealthMonitor, c as createHealthMonitor } from './health-monitor-DtwmIJkb.js';
|
|
15
15
|
export { ConnectDevToolsOptions, DevToolsClient, DevToolsClientMessage, DevToolsCompatibleOrchestrator, DevToolsServer, DevToolsServerConfig, DevToolsServerMessage, DevToolsSnapshot, DevToolsTransport, WsTransportConfig, connectDevTools, createDevToolsServer, createWsTransport } from './devtools.js';
|
|
16
16
|
export { MCPAdapter, MCPAdapterConfig, MCPApprovalRequest, MCPCallToolRequirement, MCPGetPromptRequirement, MCPReadResourceRequirement, MCPRequirement, MCPResource, MCPServerConfig, MCPSyncResourcesRequirement, MCPTool, MCPToolConstraint, MCPToolResult, convertToolsForLLM, createMCPAdapter, mcpCallTool, mcpGetPrompt, mcpReadResource, mcpSyncResources } from './mcp.js';
|
|
17
17
|
export { EvalAgentSummary, EvalAssertOptions, EvalCase, EvalCaseResult, EvalContext, EvalCostOptions, EvalCriterion, EvalCriterionFn, EvalJudgeOptions, EvalLatencyOptions, EvalMatchOptions, EvalOutputLengthOptions, EvalResults, EvalSafetyOptions, EvalScore, EvalSemanticOptions, EvalStructureOptions, EvalSuite, EvalSuiteConfig, createEvalSuite, evalAssert, evalCoherence, evalCost, evalFaithfulness, evalJudge, evalLatency, evalMatch, evalOutputLength, evalRelevance, evalSafety, evalStructure } from './evals.js';
|
|
@@ -1806,4 +1806,87 @@ interface OtelPlugin {
|
|
|
1806
1806
|
*/
|
|
1807
1807
|
declare function createOtelPlugin(config: OtelPluginConfig): OtelPlugin;
|
|
1808
1808
|
|
|
1809
|
-
|
|
1809
|
+
/**
|
|
1810
|
+
* OTel × Sources — emit source-lifecycle spans from `system.observe()`
|
|
1811
|
+
*
|
|
1812
|
+
* The R5 observability reviewer found `@directive-run/ai/otel.ts`
|
|
1813
|
+
* subscribes only to the AI `DebugTimeline` event stream — so the four
|
|
1814
|
+
* `ObservationEvent.source.*` variants (`source.attach`,
|
|
1815
|
+
* `source.publish`, `source.detach`, `source.error`) shipped by the
|
|
1816
|
+
* source primitive never reach the OTel exporter. SREs running with
|
|
1817
|
+
* `createOtelPlugin` see agent spans but cannot answer "which source
|
|
1818
|
+
* is publishing?" or "did source `mcp` error attach?" from their
|
|
1819
|
+
* tracing backend.
|
|
1820
|
+
*
|
|
1821
|
+
* This module closes the gap as a focused helper (NOT a second OTel
|
|
1822
|
+
* plugin) so a single `OtelTracer` can carry both AI and core source
|
|
1823
|
+
* spans. Wire it once at `createSystem` time:
|
|
1824
|
+
*
|
|
1825
|
+
* @example Wire source events into the same OTel tracer as the AI plugin
|
|
1826
|
+
* ```ts
|
|
1827
|
+
* import { trace } from "@opentelemetry/api";
|
|
1828
|
+
* import { createSystem } from "@directive-run/core";
|
|
1829
|
+
* import { createOtelPlugin, attachSourcesToOtel } from "@directive-run/ai";
|
|
1830
|
+
*
|
|
1831
|
+
* const tracer = trace.getTracer("directive-app");
|
|
1832
|
+
* const otel = createOtelPlugin({ serviceName: "my-app", tracer });
|
|
1833
|
+
*
|
|
1834
|
+
* const system = createSystem({ module });
|
|
1835
|
+
* otel.attach(orchestrator.timeline); // existing AI wiring
|
|
1836
|
+
* const unsub = attachSourcesToOtel(system, { // NEW — source.* spans
|
|
1837
|
+
* tracer,
|
|
1838
|
+
* serviceName: "my-app",
|
|
1839
|
+
* });
|
|
1840
|
+
*
|
|
1841
|
+
* system.start();
|
|
1842
|
+
*
|
|
1843
|
+
* // Later
|
|
1844
|
+
* unsub();
|
|
1845
|
+
* ```
|
|
1846
|
+
*
|
|
1847
|
+
* Spans emitted:
|
|
1848
|
+
*
|
|
1849
|
+
* - `directive.source.attach` — short-duration (start → end same tick)
|
|
1850
|
+
* span with attributes `source.id`, `source.module_id`, plus
|
|
1851
|
+
* `attached_at` timestamp.
|
|
1852
|
+
* - `directive.source.publish` — short-duration counter span (NOT a
|
|
1853
|
+
* per-publish full span; events of this kind are emitted as
|
|
1854
|
+
* span EVENTS on a long-lived per-source "active" span so cardinality
|
|
1855
|
+
* stays bounded).
|
|
1856
|
+
* - `directive.source.detach` — short-duration span, ends the matching
|
|
1857
|
+
* "active" parent.
|
|
1858
|
+
* - `directive.source.error` — error-status span carrying the phase
|
|
1859
|
+
* (`attach`/`cleanup`/`runtime` per RFC 0008) and the truncated
|
|
1860
|
+
* message from R6/R7.
|
|
1861
|
+
*
|
|
1862
|
+
* Cardinality budget: ONE active span per (sourceId, moduleId) at a
|
|
1863
|
+
* time. Publishes attach as span events (cheap), not as new spans. At
|
|
1864
|
+
* 10 sources × 100 publishes/sec the exporter sees 1000 events/sec on
|
|
1865
|
+
* 10 long-lived spans — well within typical OTel collector budgets.
|
|
1866
|
+
*/
|
|
1867
|
+
|
|
1868
|
+
interface SourcesOtelOptions {
|
|
1869
|
+
/** Tracer to emit spans through. */
|
|
1870
|
+
tracer: OtelTracer;
|
|
1871
|
+
/** Service name attribute for every span. */
|
|
1872
|
+
serviceName: string;
|
|
1873
|
+
/** Span name prefix. Default: `"directive.source"`. */
|
|
1874
|
+
spanPrefix?: string;
|
|
1875
|
+
/**
|
|
1876
|
+
* Optional sampling for publish events. Sources at very high publish
|
|
1877
|
+
* rate (price ticks, cursor moves) may want to drop most publish
|
|
1878
|
+
* events from the trace. Default: `1.0` (every publish recorded as
|
|
1879
|
+
* an event on the active span).
|
|
1880
|
+
*/
|
|
1881
|
+
publishSampleRate?: number;
|
|
1882
|
+
}
|
|
1883
|
+
/**
|
|
1884
|
+
* Subscribe to a system's source-lifecycle events and emit OTel spans
|
|
1885
|
+
* for each. Returns an unsubscribe to detach.
|
|
1886
|
+
*
|
|
1887
|
+
* @returns a function that detaches the OTel wiring without affecting
|
|
1888
|
+
* other observers.
|
|
1889
|
+
*/
|
|
1890
|
+
declare function attachSourcesToOtel(system: unknown, options: SourcesOtelOptions): () => void;
|
|
1891
|
+
|
|
1892
|
+
export { AdapterHooks, AgentLike, AgentRunner, AgentState, AllProvidersFailedError, ApprovalState, type AuditEventType, type AuditInstance, type AuditPluginConfig, type BatchQueue, type BatchQueueConfig, type BidirectionalStream, type BudgetConfig, type BudgetExceededDetails, BudgetExceededError, type BudgetRunner, type BudgetWindow, type ComplianceConfig, type ComplianceInstance, type ComplianceStorage, type ConstraintRouterConfig, type ConstraintRouterRunner, type CreateRunnerOptions, DebugTimeline, EmbedderFn, Embedding, type FallbackConfig, GuardrailFn, InputGuardrailData, type JSONFileStoreOptions, Message, type ModelRule, type ModelSelectionConfig, type OtelPlugin, type OtelPluginConfig, type OtelSpan, OtelStatusCode, type OtelTracer, PIIType, type ParsedResponse, type ProviderStats, type RAGChunk, type RAGEnrichOptions, type RAGEnricher, type RAGEnricherConfig, type RAGStorage, RedactionStyle, type RetryConfig, RetryExhaustedError, type RoutingConstraint, type RoutingFacts, type RoutingProvider, RunOptions, RunResult, type RunnerMiddleware, type SSEEvent, type SSETransport, type SSETransportConfig, type SourcesOtelOptions, type SpanData, type StreamChannel, type StreamChannelConfig, type StreamChannelState, type TokenPricing, attachSourcesToOtel, byAgentName, byInputLength, byPattern, createAgentAuditHandlers, createAuditTrail, createBatchQueue, createBidirectionalStream, createCompliance, createConstraintRouter, createInMemoryComplianceStorage, createJSONFileStore, createOtelPlugin, createRAGEnricher, createRunner, createSSETransport, createStreamChannel, estimateCost, formatSystemMeta, hasPendingApprovals, isAgentRunning, mergeStreams, parseHttpStatus, parseRetryAfter, pipe, pipeThrough, toAIContext, validateBaseURL, withBudget, withFallback, withModelSelection, withRetry };
|