@directive-run/ai 1.13.0 → 1.14.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.
Files changed (122) hide show
  1. package/dist/anthropic.d.cts +1 -1
  2. package/dist/anthropic.d.ts +1 -1
  3. package/dist/{chunk-XV2QSBBE.cjs → chunk-2TD4ZSGZ.cjs} +7 -7
  4. package/dist/{chunk-XV2QSBBE.cjs.map → chunk-2TD4ZSGZ.cjs.map} +1 -1
  5. package/dist/chunk-5JQ2A3JK.js +2 -0
  6. package/dist/chunk-5JQ2A3JK.js.map +1 -0
  7. package/dist/chunk-A22KLB23.cjs +67 -0
  8. package/dist/chunk-A22KLB23.cjs.map +1 -0
  9. package/dist/chunk-A5K77UDX.cjs +4 -0
  10. package/dist/chunk-A5K77UDX.cjs.map +1 -0
  11. package/dist/chunk-DN5NAJM6.js +6 -0
  12. package/dist/chunk-DN5NAJM6.js.map +1 -0
  13. package/dist/chunk-FABDFT74.cjs +6 -0
  14. package/dist/chunk-FABDFT74.cjs.map +1 -0
  15. package/dist/chunk-FBT73WFY.js +2 -0
  16. package/dist/chunk-FBT73WFY.js.map +1 -0
  17. package/dist/chunk-FFRWQNK7.cjs +7 -0
  18. package/dist/chunk-FFRWQNK7.cjs.map +1 -0
  19. package/dist/chunk-IR3IHBVQ.cjs +2 -0
  20. package/dist/chunk-IR3IHBVQ.cjs.map +1 -0
  21. package/dist/chunk-IUGSMTBE.js +16 -0
  22. package/dist/{chunk-Q3PQLWBR.js.map → chunk-IUGSMTBE.js.map} +1 -1
  23. package/dist/chunk-J2Q5KKPN.js +37 -0
  24. package/dist/chunk-J2Q5KKPN.js.map +1 -0
  25. package/dist/chunk-K64WKZ22.cjs +2 -0
  26. package/dist/chunk-K64WKZ22.cjs.map +1 -0
  27. package/dist/chunk-LKY4K5TV.cjs +11 -0
  28. package/dist/chunk-LKY4K5TV.cjs.map +1 -0
  29. package/dist/chunk-LXUMJKGJ.js +67 -0
  30. package/dist/chunk-LXUMJKGJ.js.map +1 -0
  31. package/dist/chunk-NNAQ4ZH2.js +11 -0
  32. package/dist/chunk-NNAQ4ZH2.js.map +1 -0
  33. package/dist/chunk-PD772MSE.cjs +30 -0
  34. package/dist/chunk-PD772MSE.cjs.map +1 -0
  35. package/dist/chunk-POBEEJR6.js +30 -0
  36. package/dist/chunk-POBEEJR6.js.map +1 -0
  37. package/dist/chunk-QRXWLD6H.js +4 -0
  38. package/dist/chunk-QRXWLD6H.js.map +1 -0
  39. package/dist/chunk-UR4ZGO7V.js +7 -0
  40. package/dist/chunk-UR4ZGO7V.js.map +1 -0
  41. package/dist/chunk-UR5BMWEN.js +2 -0
  42. package/dist/chunk-UR5BMWEN.js.map +1 -0
  43. package/dist/chunk-WOFIBIPW.cjs +2 -0
  44. package/dist/chunk-WOFIBIPW.cjs.map +1 -0
  45. package/dist/chunk-XN5LUOVS.cjs +37 -0
  46. package/dist/chunk-XN5LUOVS.cjs.map +1 -0
  47. package/dist/debug-timeline-DpnRMnLU.d.cts +87 -0
  48. package/dist/debug-timeline-L13P-U2I.d.ts +87 -0
  49. package/dist/devtools.cjs +2 -0
  50. package/dist/devtools.cjs.map +1 -0
  51. package/dist/devtools.d.cts +354 -0
  52. package/dist/devtools.d.ts +354 -0
  53. package/dist/devtools.js +2 -0
  54. package/dist/devtools.js.map +1 -0
  55. package/dist/evals.cjs +2 -0
  56. package/dist/evals.cjs.map +1 -0
  57. package/dist/evals.d.cts +361 -0
  58. package/dist/evals.d.ts +361 -0
  59. package/dist/evals.js +2 -0
  60. package/dist/evals.js.map +1 -0
  61. package/dist/gemini.d.cts +1 -1
  62. package/dist/gemini.d.ts +1 -1
  63. package/dist/guardrails.cjs +2 -0
  64. package/dist/guardrails.cjs.map +1 -0
  65. package/dist/guardrails.d.cts +618 -0
  66. package/dist/guardrails.d.ts +618 -0
  67. package/dist/guardrails.js +2 -0
  68. package/dist/guardrails.js.map +1 -0
  69. package/dist/health-monitor-C6xoXrQz.d.cts +55 -0
  70. package/dist/health-monitor-qL9RNMH3.d.ts +55 -0
  71. package/dist/index.cjs +21 -99
  72. package/dist/index.cjs.map +1 -1
  73. package/dist/index.d.cts +1197 -4735
  74. package/dist/index.d.ts +1197 -4735
  75. package/dist/index.js +21 -99
  76. package/dist/index.js.map +1 -1
  77. package/dist/mcp.cjs +2 -0
  78. package/dist/mcp.cjs.map +1 -0
  79. package/dist/mcp.d.cts +450 -0
  80. package/dist/mcp.d.ts +450 -0
  81. package/dist/mcp.js +2 -0
  82. package/dist/mcp.js.map +1 -0
  83. package/dist/multi-agent-orchestrator-QWWQKKGX.js +2 -0
  84. package/dist/{multi-agent-orchestrator-4PXNYRHB.js.map → multi-agent-orchestrator-QWWQKKGX.js.map} +1 -1
  85. package/dist/multi-agent-orchestrator-Y5U4JCFO.cjs +2 -0
  86. package/dist/{multi-agent-orchestrator-KFGTEGE5.cjs.map → multi-agent-orchestrator-Y5U4JCFO.cjs.map} +1 -1
  87. package/dist/multi-agent.cjs +2 -0
  88. package/dist/multi-agent.cjs.map +1 -0
  89. package/dist/multi-agent.d.cts +1429 -0
  90. package/dist/multi-agent.d.ts +1429 -0
  91. package/dist/multi-agent.js +2 -0
  92. package/dist/multi-agent.js.map +1 -0
  93. package/dist/ollama.d.cts +1 -1
  94. package/dist/ollama.d.ts +1 -1
  95. package/dist/openai.d.cts +2 -2
  96. package/dist/openai.d.ts +2 -2
  97. package/dist/{orchestrator-types-CTfIKk0W.d.ts → orchestrator-types-DGBhL6mc.d.ts} +5 -138
  98. package/dist/{orchestrator-types-Bh8r3_Sq.d.cts → orchestrator-types-DeIMRLR7.d.cts} +5 -138
  99. package/dist/predicate.cjs +2 -0
  100. package/dist/predicate.cjs.map +1 -0
  101. package/dist/predicate.d.cts +371 -0
  102. package/dist/predicate.d.ts +371 -0
  103. package/dist/predicate.js +2 -0
  104. package/dist/predicate.js.map +1 -0
  105. package/dist/{semantic-cache-nBpQqILc.d.cts → semantic-cache-DM7ev7NQ.d.cts} +1 -1
  106. package/dist/{semantic-cache-nBpQqILc.d.ts → semantic-cache-DM7ev7NQ.d.ts} +1 -1
  107. package/dist/testing.cjs +1 -1
  108. package/dist/testing.cjs.map +1 -1
  109. package/dist/testing.d.cts +4 -2
  110. package/dist/testing.d.ts +4 -2
  111. package/dist/testing.js +1 -1
  112. package/dist/testing.js.map +1 -1
  113. package/dist/{types-CRmwFnVk.d.cts → types-DJ09LjZX.d.cts} +1 -1
  114. package/dist/{types-CRmwFnVk.d.ts → types-DJ09LjZX.d.ts} +1 -1
  115. package/package.json +32 -2
  116. package/dist/chunk-Q3PQLWBR.js +0 -16
  117. package/dist/chunk-RW4R3O5P.js +0 -72
  118. package/dist/chunk-RW4R3O5P.js.map +0 -1
  119. package/dist/chunk-X3VQ5F7D.cjs +0 -72
  120. package/dist/chunk-X3VQ5F7D.cjs.map +0 -1
  121. package/dist/multi-agent-orchestrator-4PXNYRHB.js +0 -2
  122. package/dist/multi-agent-orchestrator-KFGTEGE5.cjs +0 -2
@@ -0,0 +1,2 @@
1
+ export{c as createAgentNetwork,e as createDelegator,b as createMessageBus,f as createPubSub,d as createResponder,j as explainGoal,g as getDependencyGraph,a as patternToMermaid,i as planGoal,h as validateGoal}from'./chunk-DN5NAJM6.js';export{y as InMemoryCheckpointStore,s as MAX_BREAKPOINT_HISTORY,K as ReflectionExhaustedError,N as Semaphore,ia as aggregateTokens,_ as allReadyStrategy,la as capabilityRoute,ha as collectOutputs,ja as composePatterns,fa as concatResults,aa as costEfficientStrategy,t as createBreakpointId,w as createCheckpointId,v as createInitialBreakpointState,ra as createMultiAgentOrchestrator,W as dag,na as debate,pa as derivedConstraint,Q as diffCheckpoints,ka as findAgentsByCapability,R as forkFromCheckpoint,P as getCheckpointProgress,O as getPatternStep,Z as goal,$ as highestImpactStrategy,u as matchBreakpoint,T as parallel,ca as patternFromJSON,ba as patternToJSON,ga as pickBestResult,Y as race,X as reflect,ea as runAgentRequirement,oa as runDebate,da as selectAgent,U as sequential,ma as spawnOnCondition,qa as spawnPool,V as supervisor,x as validateCheckpoint,L as withReflection}from'./chunk-LXUMJKGJ.js';import'./chunk-UR5BMWEN.js';import'./chunk-FBT73WFY.js';import'./chunk-UR4ZGO7V.js';//# sourceMappingURL=multi-agent.js.map
2
+ //# sourceMappingURL=multi-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"multi-agent.js"}
package/dist/ollama.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as AdapterHooks, b as AgentRunner, aX as StreamingCallbackRunner } from './types-CRmwFnVk.cjs';
1
+ import { o as AdapterHooks, c as AgentRunner, p as StreamingCallbackRunner } from './types-DJ09LjZX.cjs';
2
2
  import '@directive-run/core';
3
3
 
4
4
  /**
package/dist/ollama.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as AdapterHooks, b as AgentRunner, aX as StreamingCallbackRunner } from './types-CRmwFnVk.js';
1
+ import { o as AdapterHooks, c as AgentRunner, p as StreamingCallbackRunner } from './types-DJ09LjZX.js';
2
2
  import '@directive-run/core';
3
3
 
4
4
  /**
package/dist/openai.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as EmbedderFn } from './semantic-cache-nBpQqILc.cjs';
2
- import { a as AdapterHooks, b as AgentRunner, aX as StreamingCallbackRunner } from './types-CRmwFnVk.cjs';
1
+ import { E as EmbedderFn } from './semantic-cache-DM7ev7NQ.cjs';
2
+ import { o as AdapterHooks, c as AgentRunner, p as StreamingCallbackRunner } from './types-DJ09LjZX.cjs';
3
3
  import '@directive-run/core';
4
4
 
5
5
  /**
package/dist/openai.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as EmbedderFn } from './semantic-cache-nBpQqILc.js';
2
- import { a as AdapterHooks, b as AgentRunner, aX as StreamingCallbackRunner } from './types-CRmwFnVk.js';
1
+ import { E as EmbedderFn } from './semantic-cache-DM7ev7NQ.js';
2
+ import { o as AdapterHooks, c as AgentRunner, p as StreamingCallbackRunner } from './types-DJ09LjZX.js';
3
3
  import '@directive-run/core';
4
4
 
5
5
  /**
@@ -1,6 +1,8 @@
1
- import { M as Message$1, n as RunResult, A as AgentLike, G as GuardrailFn, O as OutputGuardrailData, aX as StreamingCallbackRunner, q as DebugEvent, a8 as DebugEventType, b as AgentRunner, az as OrchestratorState, au as NamedGuardrail, I as InputGuardrailData, W as Checkpoint, L as BreakpointModifications, N as BreakpointRequest, o as OrchestratorConstraint, ax as OrchestratorResolver, aj as GuardrailsConfig, z as ApprovalRequest, av as OrchestratorDebugConfig, w as AgentRetryConfig, aw as OrchestratorLifecycleHooks, aU as SelfHealingConfig, e as CheckpointStore, H as BreakpointConfig, am as HealthMonitorConfig, p as RunOptions, T as ToolCallGuardrailData, l as PatternCheckpointConfig, i as DagPattern, m as GoalPattern, j as GoalNode, g as AgentSelectionStrategy, R as RelaxationTier, r as GoalResult, ab as GoalCheckpointState, aV as SequentialCheckpointState, aY as SupervisorCheckpointState, aG as ReflectCheckpointState, a5 as DebateCheckpointState, a2 as DagCheckpointState, aS as Scratchpad, as as MultiAgentLifecycleHooks, at as MultiAgentSelfHealingConfig, aq as MultiAgentBreakpointType, a0 as CrossAgentDerivationFn } from './types-CRmwFnVk.js';
2
- import { Plugin, System, Requirement } from '@directive-run/core';
1
+ import { M as Message$1, q as RunResult, b as AgentLike, m as GuardrailFn, O as OutputGuardrailData, p as StreamingCallbackRunner, c as AgentRunner, r as OrchestratorState, N as NamedGuardrail, I as InputGuardrailData, C as Checkpoint, B as BreakpointModifications, d as BreakpointRequest, s as OrchestratorConstraint, t as OrchestratorResolver, u as GuardrailsConfig, A as ApprovalRequest, v as OrchestratorDebugConfig, w as AgentRetryConfig, x as OrchestratorLifecycleHooks, y as SelfHealingConfig, h as CheckpointStore, z as BreakpointConfig, R as RunOptions, T as ToolCallGuardrailData, P as PatternCheckpointConfig, k as DagPattern, E as GoalPattern, F as GoalNode, J as AgentSelectionStrategy, K as RelaxationTier, L as GoalResult, Q as GoalCheckpointState, U as SequentialCheckpointState, V as SupervisorCheckpointState, W as ReflectCheckpointState, X as DebateCheckpointState, Y as DagCheckpointState, S as Scratchpad, Z as MultiAgentLifecycleHooks, _ as MultiAgentSelfHealingConfig, $ as MultiAgentBreakpointType, a0 as CrossAgentDerivationFn } from './types-DJ09LjZX.js';
2
+ import { System, Requirement, Plugin } from '@directive-run/core';
3
3
  import { CircuitBreaker } from '@directive-run/core/plugins';
4
+ import { D as DebugTimeline } from './debug-timeline-L13P-U2I.js';
5
+ import { H as HealthMonitor } from './health-monitor-qL9RNMH3.js';
4
6
 
5
7
  /**
6
8
  * Agent Memory System
@@ -600,89 +602,6 @@ interface MergedTaggedStreamResult {
600
602
  */
601
603
  declare function mergeTaggedStreams(sources: TaggedSource[]): MergedTaggedStreamResult;
602
604
 
603
- /**
604
- * Debug Timeline — AI-specific event log with snapshot correlation.
605
- *
606
- * Records agent lifecycle events (start, complete, error, guardrail checks,
607
- * approvals, handoffs, patterns) and correlates them with core time-travel
608
- * snapshots for visual timeline UIs and fork-and-replay debugging.
609
- *
610
- * Zero-cost when debug=false — the timeline is simply `null`.
611
- *
612
- * @module
613
- */
614
-
615
- /** Callback fired when a new event is recorded */
616
- type DebugTimelineListener = (event: DebugEvent) => void;
617
- /** Debug timeline instance */
618
- interface DebugTimeline {
619
- /** Record a new event (id is auto-assigned) */
620
- record(event: Omit<DebugEvent, "id"> & Record<string, unknown>): DebugEvent;
621
- /** Get all events in order */
622
- getEvents(): DebugEvent[];
623
- /** Get events for a specific agent */
624
- getEventsForAgent(agentId: string): DebugEvent[];
625
- /** Get events by type with type narrowing */
626
- getEventsByType<T extends DebugEventType>(type: T): Extract<DebugEvent, {
627
- type: T;
628
- }>[];
629
- /** Get events at a specific snapshot */
630
- getEventsAtSnapshot(snapshotId: number): DebugEvent[];
631
- /** Get events in a time range */
632
- getEventsInRange(startMs: number, endMs: number): DebugEvent[];
633
- /** Fork from a snapshot — truncates events after it and calls goTo */
634
- forkFrom(snapshotId: number): void;
635
- /** Export timeline as JSON */
636
- export(): string;
637
- /** Import timeline from JSON */
638
- import(json: string): void;
639
- /** Clear all events */
640
- clear(): void;
641
- /** Subscribe to new events. Returns unsubscribe function. */
642
- subscribe(listener: DebugTimelineListener): () => void;
643
- /** Current number of events */
644
- readonly length: number;
645
- }
646
- /** Options for creating a debug timeline */
647
- interface DebugTimelineOptions {
648
- /** Maximum events before eviction. @default 2000 */
649
- maxEvents?: number;
650
- /** Callback to get current snapshot ID from the system */
651
- getSnapshotId?: () => number | null;
652
- /** Callback to navigate to a snapshot (for forkFrom) */
653
- goToSnapshot?: (snapshotId: number) => void;
654
- }
655
- /**
656
- * Create a debug timeline for recording and correlating AI events.
657
- *
658
- * @example
659
- * ```typescript
660
- * const timeline = createDebugTimeline({ maxEvents: 1000 });
661
- *
662
- * timeline.record({
663
- * type: "agent_start",
664
- * timestamp: Date.now(),
665
- * agentId: "researcher",
666
- * snapshotId: null,
667
- * inputLength: 42,
668
- * });
669
- *
670
- * const agentEvents = timeline.getEventsForAgent("researcher");
671
- * ```
672
- */
673
- declare function createDebugTimeline(options?: DebugTimelineOptions): DebugTimeline;
674
- /**
675
- * Create a Directive plugin that bridges core constraint/resolver events
676
- * to the debug timeline.
677
- *
678
- * @example
679
- * ```typescript
680
- * const timeline = createDebugTimeline();
681
- * const plugin = createDebugTimelinePlugin(timeline, () => system.history?.currentIndex ?? null);
682
- * ```
683
- */
684
- declare function createDebugTimelinePlugin(timeline: DebugTimeline, getSnapshotId: () => number | null): Plugin;
685
-
686
605
  /**
687
606
  * P6: Structured Outputs — Schema validation with auto-retry for LLM responses.
688
607
  *
@@ -1063,58 +982,6 @@ interface AgentOrchestrator<F extends Record<string, unknown>> {
1063
982
  */
1064
983
  declare function createAgentOrchestrator<F extends Record<string, unknown> = Record<string, never>>(options: OrchestratorOptions<F>): AgentOrchestrator<F>;
1065
984
 
1066
- /**
1067
- * Health Monitor — tracks per-agent health metrics for self-healing networks.
1068
- *
1069
- * Pure computation module with zero Directive dependency.
1070
- * Maintains a rolling window of success/failure events and computes a health
1071
- * score from 0-100 based on configurable weights.
1072
- *
1073
- * @module
1074
- */
1075
-
1076
- /** Circuit state values */
1077
- type HealthCircuitState = "CLOSED" | "OPEN" | "HALF_OPEN";
1078
- /** Per-agent health metrics */
1079
- interface AgentHealthMetrics {
1080
- agentId: string;
1081
- circuitState: HealthCircuitState;
1082
- successRate: number;
1083
- avgLatencyMs: number;
1084
- recentFailures: number;
1085
- recentSuccesses: number;
1086
- healthScore: number;
1087
- /** Last N error messages (most recent last) */
1088
- lastErrors: string[];
1089
- }
1090
- /** Health monitor instance */
1091
- interface HealthMonitor {
1092
- recordSuccess(agentId: string, latencyMs: number): void;
1093
- recordFailure(agentId: string, latencyMs: number, error?: Error): void;
1094
- getMetrics(agentId: string): AgentHealthMetrics;
1095
- getAllMetrics(): Record<string, AgentHealthMetrics>;
1096
- /** Returns a 0-100 health score. Returns 50 (neutral) when no data is available for the agent. */
1097
- getHealthScore(agentId: string): number;
1098
- updateCircuitState(agentId: string, state: HealthCircuitState): void;
1099
- /** Reset all metrics. Useful for testing. */
1100
- reset(): void;
1101
- }
1102
- /**
1103
- * Create a health monitor that tracks per-agent metrics.
1104
- *
1105
- * @example
1106
- * ```typescript
1107
- * const monitor = createHealthMonitor({ windowMs: 30000 });
1108
- *
1109
- * monitor.recordSuccess("agent-a", 120);
1110
- * monitor.recordFailure("agent-a", 5000, new Error("timeout"));
1111
- *
1112
- * const score = monitor.getHealthScore("agent-a");
1113
- * console.log(score); // 0-100
1114
- * ```
1115
- */
1116
- declare function createHealthMonitor(config?: HealthMonitorConfig): HealthMonitor;
1117
-
1118
985
  /**
1119
986
  * Agent Reflection / Self-Improvement
1120
987
  *
@@ -1781,4 +1648,4 @@ interface MultiAgentOrchestrator {
1781
1648
  destroy(): void;
1782
1649
  }
1783
1650
 
1784
- export { type SafeParseResult as $, type AgentRegistry as A, type BackpressureStrategy as B, type MessageChunk as C, type DebatePattern as D, type ExecutionPattern as E, type MessageSummarizer as F, type GuardrailTriggeredChunk as G, type HealthMonitor as H, type MultiAgentRunCallOptions as I, type MultiAgentState as J, type MultiplexedStreamChunk as K, type MultiplexedStreamResult as L, type MultiAgentOrchestratorOptions as M, type OrchestratorStreamChunk as N, type OrchestratorOptions as O, type ParallelPattern as P, type OrchestratorStreamResult as Q, type RacePattern as R, type SequentialPattern as S, type ProgressChunk as T, type RaceResult as U, type RaceSuccessEntry as V, type ReflectionConfig as W, type ReflectionContext as X, type ReflectionEvaluator as Y, ReflectionExhaustedError as Z, type RunCallOptions as _, type MultiAgentOrchestrator as a, type SafeParseable as a0, type StreamChunk as a1, type StreamRunOptions as a2, type StreamRunner as a3, type StreamingGuardrail as a4, type StreamingGuardrailResult as a5, type StreamingRunResult as a6, type StructuredOutputConfig as a7, StructuredOutputError as a8, type TaskContext as a9, tapStream as aA, withReflection as aB, withStructuredOutput as aC, type TaskRegistration as aa, type TokenChunk as ab, type ToolEndChunk as ac, type ToolStartChunk as ad, adaptOutputGuardrail as ae, collectTokens as af, combineStreamingGuardrails as ag, createAgentMemory as ah, createAgentOrchestrator as ai, createDebugTimeline as aj, createDebugTimelinePlugin as ak, createHealthMonitor as al, createHybridStrategy as am, createKeyPointsSummarizer as an, createLLMSummarizer as ao, createLengthStreamingGuardrail as ap, createPatternStreamingGuardrail as aq, createSlidingWindowStrategy as ar, createStreamingRunner as as, createTokenBasedStrategy as at, createToxicityStreamingGuardrail as au, createTruncationSummarizer as av, extractJsonFromOutput as aw, filterStream as ax, mapStream as ay, mergeTaggedStreams as az, type ReflectionEvaluation as b, type ReflectIterationRecord as c, type ReflectPattern as d, type SupervisorPattern as e, type RunAgentRequirement as f, type DebateResult as g, type AgentHealthMetrics as h, type DebugTimeline as i, type AgentMemory as j, type AgentMemoryConfig as k, type AgentOrchestrator as l, type AgentRegistration as m, type DebugTimelineListener as n, type DebugTimelineOptions as o, type DoneChunk as p, type ErrorChunk as q, type HandoffRequest as r, type HandoffResult as s, type HealthCircuitState as t, type MemoryManageResult as u, type MemoryState as v, type MemoryStrategy as w, type MemoryStrategyConfig as x, type MemoryStrategyResult as y, type MergedTaggedStreamResult as z };
1651
+ export { type StreamingGuardrailResult as $, type AgentOrchestrator as A, type BackpressureStrategy as B, type RaceSuccessEntry as C, type DebatePattern as D, type ErrorChunk as E, type ReflectIterationRecord as F, type GuardrailTriggeredChunk as G, type HandoffRequest as H, type ReflectPattern as I, type ReflectionConfig as J, type ReflectionContext as K, type ReflectionEvaluation as L, type MultiAgentOrchestrator as M, ReflectionExhaustedError as N, type OrchestratorOptions as O, type ParallelPattern as P, type RunAgentRequirement as Q, type ReflectionEvaluator as R, type RunCallOptions as S, type TaskRegistration as T, type SafeParseResult as U, type SafeParseable as V, type SequentialPattern as W, type StreamChunk as X, type StreamRunOptions as Y, type StreamRunner as Z, type StreamingGuardrail as _, type MultiAgentOrchestratorOptions as a, type StreamingRunResult as a0, type StructuredOutputConfig as a1, StructuredOutputError as a2, type SupervisorPattern as a3, type TaskContext as a4, type TokenChunk as a5, type ToolEndChunk as a6, type ToolStartChunk as a7, adaptOutputGuardrail as a8, collectTokens as a9, combineStreamingGuardrails as aa, createAgentMemory as ab, createAgentOrchestrator as ac, createHybridStrategy as ad, createKeyPointsSummarizer as ae, createLLMSummarizer as af, createLengthStreamingGuardrail as ag, createPatternStreamingGuardrail as ah, createSlidingWindowStrategy as ai, createStreamingRunner as aj, createTokenBasedStrategy as ak, createToxicityStreamingGuardrail as al, createTruncationSummarizer as am, extractJsonFromOutput as an, filterStream as ao, mapStream as ap, mergeTaggedStreams as aq, tapStream as ar, withReflection as as, withStructuredOutput as at, type MultiplexedStreamChunk as b, type AgentMemory as c, type AgentMemoryConfig as d, type AgentRegistration as e, type AgentRegistry as f, type DebateResult as g, type DoneChunk as h, type ExecutionPattern as i, type HandoffResult as j, type MemoryManageResult as k, type MemoryState as l, type MemoryStrategy as m, type MemoryStrategyConfig as n, type MemoryStrategyResult as o, type MergedTaggedStreamResult as p, type MessageChunk as q, type MessageSummarizer as r, type MultiAgentRunCallOptions as s, type MultiAgentState as t, type MultiplexedStreamResult as u, type OrchestratorStreamChunk as v, type OrchestratorStreamResult as w, type ProgressChunk as x, type RacePattern as y, type RaceResult as z };
@@ -1,6 +1,8 @@
1
- import { M as Message$1, n as RunResult, A as AgentLike, G as GuardrailFn, O as OutputGuardrailData, aX as StreamingCallbackRunner, q as DebugEvent, a8 as DebugEventType, b as AgentRunner, az as OrchestratorState, au as NamedGuardrail, I as InputGuardrailData, W as Checkpoint, L as BreakpointModifications, N as BreakpointRequest, o as OrchestratorConstraint, ax as OrchestratorResolver, aj as GuardrailsConfig, z as ApprovalRequest, av as OrchestratorDebugConfig, w as AgentRetryConfig, aw as OrchestratorLifecycleHooks, aU as SelfHealingConfig, e as CheckpointStore, H as BreakpointConfig, am as HealthMonitorConfig, p as RunOptions, T as ToolCallGuardrailData, l as PatternCheckpointConfig, i as DagPattern, m as GoalPattern, j as GoalNode, g as AgentSelectionStrategy, R as RelaxationTier, r as GoalResult, ab as GoalCheckpointState, aV as SequentialCheckpointState, aY as SupervisorCheckpointState, aG as ReflectCheckpointState, a5 as DebateCheckpointState, a2 as DagCheckpointState, aS as Scratchpad, as as MultiAgentLifecycleHooks, at as MultiAgentSelfHealingConfig, aq as MultiAgentBreakpointType, a0 as CrossAgentDerivationFn } from './types-CRmwFnVk.cjs';
2
- import { Plugin, System, Requirement } from '@directive-run/core';
1
+ import { M as Message$1, q as RunResult, b as AgentLike, m as GuardrailFn, O as OutputGuardrailData, p as StreamingCallbackRunner, c as AgentRunner, r as OrchestratorState, N as NamedGuardrail, I as InputGuardrailData, C as Checkpoint, B as BreakpointModifications, d as BreakpointRequest, s as OrchestratorConstraint, t as OrchestratorResolver, u as GuardrailsConfig, A as ApprovalRequest, v as OrchestratorDebugConfig, w as AgentRetryConfig, x as OrchestratorLifecycleHooks, y as SelfHealingConfig, h as CheckpointStore, z as BreakpointConfig, R as RunOptions, T as ToolCallGuardrailData, P as PatternCheckpointConfig, k as DagPattern, E as GoalPattern, F as GoalNode, J as AgentSelectionStrategy, K as RelaxationTier, L as GoalResult, Q as GoalCheckpointState, U as SequentialCheckpointState, V as SupervisorCheckpointState, W as ReflectCheckpointState, X as DebateCheckpointState, Y as DagCheckpointState, S as Scratchpad, Z as MultiAgentLifecycleHooks, _ as MultiAgentSelfHealingConfig, $ as MultiAgentBreakpointType, a0 as CrossAgentDerivationFn } from './types-DJ09LjZX.cjs';
2
+ import { System, Requirement, Plugin } from '@directive-run/core';
3
3
  import { CircuitBreaker } from '@directive-run/core/plugins';
4
+ import { D as DebugTimeline } from './debug-timeline-DpnRMnLU.cjs';
5
+ import { H as HealthMonitor } from './health-monitor-C6xoXrQz.cjs';
4
6
 
5
7
  /**
6
8
  * Agent Memory System
@@ -600,89 +602,6 @@ interface MergedTaggedStreamResult {
600
602
  */
601
603
  declare function mergeTaggedStreams(sources: TaggedSource[]): MergedTaggedStreamResult;
602
604
 
603
- /**
604
- * Debug Timeline — AI-specific event log with snapshot correlation.
605
- *
606
- * Records agent lifecycle events (start, complete, error, guardrail checks,
607
- * approvals, handoffs, patterns) and correlates them with core time-travel
608
- * snapshots for visual timeline UIs and fork-and-replay debugging.
609
- *
610
- * Zero-cost when debug=false — the timeline is simply `null`.
611
- *
612
- * @module
613
- */
614
-
615
- /** Callback fired when a new event is recorded */
616
- type DebugTimelineListener = (event: DebugEvent) => void;
617
- /** Debug timeline instance */
618
- interface DebugTimeline {
619
- /** Record a new event (id is auto-assigned) */
620
- record(event: Omit<DebugEvent, "id"> & Record<string, unknown>): DebugEvent;
621
- /** Get all events in order */
622
- getEvents(): DebugEvent[];
623
- /** Get events for a specific agent */
624
- getEventsForAgent(agentId: string): DebugEvent[];
625
- /** Get events by type with type narrowing */
626
- getEventsByType<T extends DebugEventType>(type: T): Extract<DebugEvent, {
627
- type: T;
628
- }>[];
629
- /** Get events at a specific snapshot */
630
- getEventsAtSnapshot(snapshotId: number): DebugEvent[];
631
- /** Get events in a time range */
632
- getEventsInRange(startMs: number, endMs: number): DebugEvent[];
633
- /** Fork from a snapshot — truncates events after it and calls goTo */
634
- forkFrom(snapshotId: number): void;
635
- /** Export timeline as JSON */
636
- export(): string;
637
- /** Import timeline from JSON */
638
- import(json: string): void;
639
- /** Clear all events */
640
- clear(): void;
641
- /** Subscribe to new events. Returns unsubscribe function. */
642
- subscribe(listener: DebugTimelineListener): () => void;
643
- /** Current number of events */
644
- readonly length: number;
645
- }
646
- /** Options for creating a debug timeline */
647
- interface DebugTimelineOptions {
648
- /** Maximum events before eviction. @default 2000 */
649
- maxEvents?: number;
650
- /** Callback to get current snapshot ID from the system */
651
- getSnapshotId?: () => number | null;
652
- /** Callback to navigate to a snapshot (for forkFrom) */
653
- goToSnapshot?: (snapshotId: number) => void;
654
- }
655
- /**
656
- * Create a debug timeline for recording and correlating AI events.
657
- *
658
- * @example
659
- * ```typescript
660
- * const timeline = createDebugTimeline({ maxEvents: 1000 });
661
- *
662
- * timeline.record({
663
- * type: "agent_start",
664
- * timestamp: Date.now(),
665
- * agentId: "researcher",
666
- * snapshotId: null,
667
- * inputLength: 42,
668
- * });
669
- *
670
- * const agentEvents = timeline.getEventsForAgent("researcher");
671
- * ```
672
- */
673
- declare function createDebugTimeline(options?: DebugTimelineOptions): DebugTimeline;
674
- /**
675
- * Create a Directive plugin that bridges core constraint/resolver events
676
- * to the debug timeline.
677
- *
678
- * @example
679
- * ```typescript
680
- * const timeline = createDebugTimeline();
681
- * const plugin = createDebugTimelinePlugin(timeline, () => system.history?.currentIndex ?? null);
682
- * ```
683
- */
684
- declare function createDebugTimelinePlugin(timeline: DebugTimeline, getSnapshotId: () => number | null): Plugin;
685
-
686
605
  /**
687
606
  * P6: Structured Outputs — Schema validation with auto-retry for LLM responses.
688
607
  *
@@ -1063,58 +982,6 @@ interface AgentOrchestrator<F extends Record<string, unknown>> {
1063
982
  */
1064
983
  declare function createAgentOrchestrator<F extends Record<string, unknown> = Record<string, never>>(options: OrchestratorOptions<F>): AgentOrchestrator<F>;
1065
984
 
1066
- /**
1067
- * Health Monitor — tracks per-agent health metrics for self-healing networks.
1068
- *
1069
- * Pure computation module with zero Directive dependency.
1070
- * Maintains a rolling window of success/failure events and computes a health
1071
- * score from 0-100 based on configurable weights.
1072
- *
1073
- * @module
1074
- */
1075
-
1076
- /** Circuit state values */
1077
- type HealthCircuitState = "CLOSED" | "OPEN" | "HALF_OPEN";
1078
- /** Per-agent health metrics */
1079
- interface AgentHealthMetrics {
1080
- agentId: string;
1081
- circuitState: HealthCircuitState;
1082
- successRate: number;
1083
- avgLatencyMs: number;
1084
- recentFailures: number;
1085
- recentSuccesses: number;
1086
- healthScore: number;
1087
- /** Last N error messages (most recent last) */
1088
- lastErrors: string[];
1089
- }
1090
- /** Health monitor instance */
1091
- interface HealthMonitor {
1092
- recordSuccess(agentId: string, latencyMs: number): void;
1093
- recordFailure(agentId: string, latencyMs: number, error?: Error): void;
1094
- getMetrics(agentId: string): AgentHealthMetrics;
1095
- getAllMetrics(): Record<string, AgentHealthMetrics>;
1096
- /** Returns a 0-100 health score. Returns 50 (neutral) when no data is available for the agent. */
1097
- getHealthScore(agentId: string): number;
1098
- updateCircuitState(agentId: string, state: HealthCircuitState): void;
1099
- /** Reset all metrics. Useful for testing. */
1100
- reset(): void;
1101
- }
1102
- /**
1103
- * Create a health monitor that tracks per-agent metrics.
1104
- *
1105
- * @example
1106
- * ```typescript
1107
- * const monitor = createHealthMonitor({ windowMs: 30000 });
1108
- *
1109
- * monitor.recordSuccess("agent-a", 120);
1110
- * monitor.recordFailure("agent-a", 5000, new Error("timeout"));
1111
- *
1112
- * const score = monitor.getHealthScore("agent-a");
1113
- * console.log(score); // 0-100
1114
- * ```
1115
- */
1116
- declare function createHealthMonitor(config?: HealthMonitorConfig): HealthMonitor;
1117
-
1118
985
  /**
1119
986
  * Agent Reflection / Self-Improvement
1120
987
  *
@@ -1781,4 +1648,4 @@ interface MultiAgentOrchestrator {
1781
1648
  destroy(): void;
1782
1649
  }
1783
1650
 
1784
- export { type SafeParseResult as $, type AgentRegistry as A, type BackpressureStrategy as B, type MessageChunk as C, type DebatePattern as D, type ExecutionPattern as E, type MessageSummarizer as F, type GuardrailTriggeredChunk as G, type HealthMonitor as H, type MultiAgentRunCallOptions as I, type MultiAgentState as J, type MultiplexedStreamChunk as K, type MultiplexedStreamResult as L, type MultiAgentOrchestratorOptions as M, type OrchestratorStreamChunk as N, type OrchestratorOptions as O, type ParallelPattern as P, type OrchestratorStreamResult as Q, type RacePattern as R, type SequentialPattern as S, type ProgressChunk as T, type RaceResult as U, type RaceSuccessEntry as V, type ReflectionConfig as W, type ReflectionContext as X, type ReflectionEvaluator as Y, ReflectionExhaustedError as Z, type RunCallOptions as _, type MultiAgentOrchestrator as a, type SafeParseable as a0, type StreamChunk as a1, type StreamRunOptions as a2, type StreamRunner as a3, type StreamingGuardrail as a4, type StreamingGuardrailResult as a5, type StreamingRunResult as a6, type StructuredOutputConfig as a7, StructuredOutputError as a8, type TaskContext as a9, tapStream as aA, withReflection as aB, withStructuredOutput as aC, type TaskRegistration as aa, type TokenChunk as ab, type ToolEndChunk as ac, type ToolStartChunk as ad, adaptOutputGuardrail as ae, collectTokens as af, combineStreamingGuardrails as ag, createAgentMemory as ah, createAgentOrchestrator as ai, createDebugTimeline as aj, createDebugTimelinePlugin as ak, createHealthMonitor as al, createHybridStrategy as am, createKeyPointsSummarizer as an, createLLMSummarizer as ao, createLengthStreamingGuardrail as ap, createPatternStreamingGuardrail as aq, createSlidingWindowStrategy as ar, createStreamingRunner as as, createTokenBasedStrategy as at, createToxicityStreamingGuardrail as au, createTruncationSummarizer as av, extractJsonFromOutput as aw, filterStream as ax, mapStream as ay, mergeTaggedStreams as az, type ReflectionEvaluation as b, type ReflectIterationRecord as c, type ReflectPattern as d, type SupervisorPattern as e, type RunAgentRequirement as f, type DebateResult as g, type AgentHealthMetrics as h, type DebugTimeline as i, type AgentMemory as j, type AgentMemoryConfig as k, type AgentOrchestrator as l, type AgentRegistration as m, type DebugTimelineListener as n, type DebugTimelineOptions as o, type DoneChunk as p, type ErrorChunk as q, type HandoffRequest as r, type HandoffResult as s, type HealthCircuitState as t, type MemoryManageResult as u, type MemoryState as v, type MemoryStrategy as w, type MemoryStrategyConfig as x, type MemoryStrategyResult as y, type MergedTaggedStreamResult as z };
1651
+ export { type StreamingGuardrailResult as $, type AgentOrchestrator as A, type BackpressureStrategy as B, type RaceSuccessEntry as C, type DebatePattern as D, type ErrorChunk as E, type ReflectIterationRecord as F, type GuardrailTriggeredChunk as G, type HandoffRequest as H, type ReflectPattern as I, type ReflectionConfig as J, type ReflectionContext as K, type ReflectionEvaluation as L, type MultiAgentOrchestrator as M, ReflectionExhaustedError as N, type OrchestratorOptions as O, type ParallelPattern as P, type RunAgentRequirement as Q, type ReflectionEvaluator as R, type RunCallOptions as S, type TaskRegistration as T, type SafeParseResult as U, type SafeParseable as V, type SequentialPattern as W, type StreamChunk as X, type StreamRunOptions as Y, type StreamRunner as Z, type StreamingGuardrail as _, type MultiAgentOrchestratorOptions as a, type StreamingRunResult as a0, type StructuredOutputConfig as a1, StructuredOutputError as a2, type SupervisorPattern as a3, type TaskContext as a4, type TokenChunk as a5, type ToolEndChunk as a6, type ToolStartChunk as a7, adaptOutputGuardrail as a8, collectTokens as a9, combineStreamingGuardrails as aa, createAgentMemory as ab, createAgentOrchestrator as ac, createHybridStrategy as ad, createKeyPointsSummarizer as ae, createLLMSummarizer as af, createLengthStreamingGuardrail as ag, createPatternStreamingGuardrail as ah, createSlidingWindowStrategy as ai, createStreamingRunner as aj, createTokenBasedStrategy as ak, createToxicityStreamingGuardrail as al, createTruncationSummarizer as am, extractJsonFromOutput as an, filterStream as ao, mapStream as ap, mergeTaggedStreams as aq, tapStream as ar, withReflection as as, withStructuredOutput as at, type MultiplexedStreamChunk as b, type AgentMemory as c, type AgentMemoryConfig as d, type AgentRegistration as e, type AgentRegistry as f, type DebateResult as g, type DoneChunk as h, type ExecutionPattern as i, type HandoffResult as j, type MemoryManageResult as k, type MemoryState as l, type MemoryStrategy as m, type MemoryStrategyConfig as n, type MemoryStrategyResult as o, type MergedTaggedStreamResult as p, type MessageChunk as q, type MessageSummarizer as r, type MultiAgentRunCallOptions as s, type MultiAgentState as t, type MultiplexedStreamResult as u, type OrchestratorStreamChunk as v, type OrchestratorStreamResult as w, type ProgressChunk as x, type RacePattern as y, type RaceResult as z };
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkPD772MSE_cjs=require('./chunk-PD772MSE.cjs');require('./chunk-FFRWQNK7.cjs');Object.defineProperty(exports,"PredicateFromIntentError",{enumerable:true,get:function(){return chunkPD772MSE_cjs.a}});Object.defineProperty(exports,"predicateFromIntent",{enumerable:true,get:function(){return chunkPD772MSE_cjs.b}});Object.defineProperty(exports,"predicateFromIntentRaw",{enumerable:true,get:function(){return chunkPD772MSE_cjs.c}});Object.defineProperty(exports,"predicateFromIntentWithProvenance",{enumerable:true,get:function(){return chunkPD772MSE_cjs.g}});Object.defineProperty(exports,"predicateToolSpec",{enumerable:true,get:function(){return chunkPD772MSE_cjs.f}});Object.defineProperty(exports,"predicateToolSpecAnthropic",{enumerable:true,get:function(){return chunkPD772MSE_cjs.e}});Object.defineProperty(exports,"predicateToolSpecOpenAI",{enumerable:true,get:function(){return chunkPD772MSE_cjs.d}});//# sourceMappingURL=predicate.cjs.map
2
+ //# sourceMappingURL=predicate.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"predicate.cjs"}