@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.
Files changed (70) hide show
  1. package/dist/ann-index-27QV9tPC.d.ts +616 -0
  2. package/dist/ann-index-HoZFIUA-.d.cts +616 -0
  3. package/dist/anthropic.d.cts +1 -1
  4. package/dist/anthropic.d.ts +1 -1
  5. package/dist/chunk-2PG26JZU.cjs +16 -0
  6. package/dist/chunk-2PG26JZU.cjs.map +1 -0
  7. package/dist/{chunk-7DPTXZZI.cjs → chunk-7EJN6TYX.cjs} +4 -4
  8. package/dist/chunk-7EJN6TYX.cjs.map +1 -0
  9. package/dist/{chunk-FN4GUZAI.js → chunk-G7CRWJT7.js} +4 -4
  10. package/dist/chunk-G7CRWJT7.js.map +1 -0
  11. package/dist/chunk-MIHH5GPT.js +16 -0
  12. package/dist/chunk-MIHH5GPT.js.map +1 -0
  13. package/dist/{chunk-56LYSE63.js → chunk-RHJAMXLS.js} +3 -3
  14. package/dist/{chunk-56LYSE63.js.map → chunk-RHJAMXLS.js.map} +1 -1
  15. package/dist/{chunk-PB276BX2.cjs → chunk-XGHNOSXT.cjs} +4 -4
  16. package/dist/{chunk-PB276BX2.cjs.map → chunk-XGHNOSXT.cjs.map} +1 -1
  17. package/dist/{debug-timeline-L13P-U2I.d.ts → debug-timeline-BGcPa0JO.d.ts} +1 -1
  18. package/dist/{debug-timeline-DpnRMnLU.d.cts → debug-timeline-Dn1lC_gK.d.cts} +1 -1
  19. package/dist/devtools.d.cts +5 -5
  20. package/dist/devtools.d.ts +5 -5
  21. package/dist/evals.d.cts +2 -2
  22. package/dist/evals.d.ts +2 -2
  23. package/dist/gemini.d.cts +1 -1
  24. package/dist/gemini.d.ts +1 -1
  25. package/dist/guardrails.cjs +1 -1
  26. package/dist/guardrails.cjs.map +1 -1
  27. package/dist/guardrails.d.cts +164 -592
  28. package/dist/guardrails.d.ts +164 -592
  29. package/dist/guardrails.js +1 -1
  30. package/dist/guardrails.js.map +1 -1
  31. package/dist/{health-monitor-C6xoXrQz.d.cts → health-monitor-Cq5sDvid.d.cts} +1 -1
  32. package/dist/{health-monitor-qL9RNMH3.d.ts → health-monitor-DtwmIJkb.d.ts} +1 -1
  33. package/dist/index.cjs +15 -15
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +94 -11
  36. package/dist/index.d.ts +94 -11
  37. package/dist/index.js +15 -15
  38. package/dist/index.js.map +1 -1
  39. package/dist/multi-agent-orchestrator-OX2TKD5Y.cjs +2 -0
  40. package/dist/{multi-agent-orchestrator-KFYIDKTF.cjs.map → multi-agent-orchestrator-OX2TKD5Y.cjs.map} +1 -1
  41. package/dist/{multi-agent-orchestrator-ZHSMWIKP.js → multi-agent-orchestrator-RMTLPKB4.js} +2 -2
  42. package/dist/{multi-agent-orchestrator-ZHSMWIKP.js.map → multi-agent-orchestrator-RMTLPKB4.js.map} +1 -1
  43. package/dist/multi-agent.cjs +1 -1
  44. package/dist/multi-agent.d.cts +6 -6
  45. package/dist/multi-agent.d.ts +6 -6
  46. package/dist/multi-agent.js +1 -1
  47. package/dist/ollama.d.cts +1 -1
  48. package/dist/ollama.d.ts +1 -1
  49. package/dist/openai.d.cts +2 -2
  50. package/dist/openai.d.ts +2 -2
  51. package/dist/{orchestrator-types-ZK9lv5Sm.d.ts → orchestrator-types-C5D5JZUj.d.ts} +103 -3
  52. package/dist/{orchestrator-types-CbNE7Rjp.d.cts → orchestrator-types-s0766dDB.d.cts} +103 -3
  53. package/dist/predicate.d.cts +1 -1
  54. package/dist/predicate.d.ts +1 -1
  55. package/dist/{semantic-cache-DM7ev7NQ.d.cts → semantic-cache-Ba0-jEwb.d.cts} +1 -1
  56. package/dist/{semantic-cache-DM7ev7NQ.d.ts → semantic-cache-Ba0-jEwb.d.ts} +1 -1
  57. package/dist/testing.cjs +1 -1
  58. package/dist/testing.d.cts +4 -4
  59. package/dist/testing.d.ts +4 -4
  60. package/dist/testing.js +1 -1
  61. package/dist/{types-DJ09LjZX.d.cts → types-CUp1N0uU.d.cts} +1 -1
  62. package/dist/{types-DJ09LjZX.d.ts → types-CUp1N0uU.d.ts} +1 -1
  63. package/package.json +2 -2
  64. package/dist/chunk-7DPTXZZI.cjs.map +0 -1
  65. package/dist/chunk-D5APTMCT.cjs +0 -16
  66. package/dist/chunk-D5APTMCT.cjs.map +0 -1
  67. package/dist/chunk-FN4GUZAI.js.map +0 -1
  68. package/dist/chunk-YT4QN3KO.js +0 -16
  69. package/dist/chunk-YT4QN3KO.js.map +0 -1
  70. package/dist/multi-agent-orchestrator-KFYIDKTF.cjs +0 -2
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunk7EJN6TYX_cjs=require('./chunk-7EJN6TYX.cjs');require('./chunk-K64WKZ22.cjs'),require('./chunk-WOFIBIPW.cjs'),require('./chunk-WCQK3JOR.cjs');Object.defineProperty(exports,"Semaphore",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.N}});Object.defineProperty(exports,"aggregateTokens",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ia}});Object.defineProperty(exports,"allReadyStrategy",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs._}});Object.defineProperty(exports,"capabilityRoute",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.la}});Object.defineProperty(exports,"collectOutputs",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ha}});Object.defineProperty(exports,"composePatterns",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ja}});Object.defineProperty(exports,"concatResults",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.fa}});Object.defineProperty(exports,"costEfficientStrategy",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.aa}});Object.defineProperty(exports,"createMultiAgentOrchestrator",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ra}});Object.defineProperty(exports,"dag",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.W}});Object.defineProperty(exports,"debate",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.na}});Object.defineProperty(exports,"derivedConstraint",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.pa}});Object.defineProperty(exports,"diffCheckpoints",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.Q}});Object.defineProperty(exports,"findAgentsByCapability",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ka}});Object.defineProperty(exports,"forkFromCheckpoint",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.R}});Object.defineProperty(exports,"getCheckpointProgress",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.P}});Object.defineProperty(exports,"getPatternStep",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.O}});Object.defineProperty(exports,"goal",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.Z}});Object.defineProperty(exports,"highestImpactStrategy",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.$}});Object.defineProperty(exports,"parallel",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.T}});Object.defineProperty(exports,"patternFromJSON",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ca}});Object.defineProperty(exports,"patternToJSON",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ba}});Object.defineProperty(exports,"pickBestResult",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ga}});Object.defineProperty(exports,"race",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.Y}});Object.defineProperty(exports,"reflect",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.X}});Object.defineProperty(exports,"runAgentRequirement",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ea}});Object.defineProperty(exports,"runDebate",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.oa}});Object.defineProperty(exports,"selectAgent",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.da}});Object.defineProperty(exports,"sequential",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.U}});Object.defineProperty(exports,"shallowEqual",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.M}});Object.defineProperty(exports,"spawnOnCondition",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ma}});Object.defineProperty(exports,"spawnPool",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.qa}});Object.defineProperty(exports,"supervisor",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.V}});Object.defineProperty(exports,"validateDagAcyclic",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.S}});//# sourceMappingURL=multi-agent-orchestrator-OX2TKD5Y.cjs.map
2
+ //# sourceMappingURL=multi-agent-orchestrator-OX2TKD5Y.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"multi-agent-orchestrator-KFYIDKTF.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"multi-agent-orchestrator-OX2TKD5Y.cjs"}
@@ -1,2 +1,2 @@
1
- export{N as Semaphore,ia as aggregateTokens,_ as allReadyStrategy,la as capabilityRoute,ha as collectOutputs,ja as composePatterns,fa as concatResults,aa as costEfficientStrategy,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,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,M as shallowEqual,ma as spawnOnCondition,qa as spawnPool,V as supervisor,S as validateDagAcyclic}from'./chunk-FN4GUZAI.js';import'./chunk-UR5BMWEN.js';import'./chunk-FBT73WFY.js';import'./chunk-HRR45JZX.js';//# sourceMappingURL=multi-agent-orchestrator-ZHSMWIKP.js.map
2
- //# sourceMappingURL=multi-agent-orchestrator-ZHSMWIKP.js.map
1
+ export{N as Semaphore,ia as aggregateTokens,_ as allReadyStrategy,la as capabilityRoute,ha as collectOutputs,ja as composePatterns,fa as concatResults,aa as costEfficientStrategy,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,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,M as shallowEqual,ma as spawnOnCondition,qa as spawnPool,V as supervisor,S as validateDagAcyclic}from'./chunk-G7CRWJT7.js';import'./chunk-UR5BMWEN.js';import'./chunk-FBT73WFY.js';import'./chunk-HRR45JZX.js';//# sourceMappingURL=multi-agent-orchestrator-RMTLPKB4.js.map
2
+ //# sourceMappingURL=multi-agent-orchestrator-RMTLPKB4.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"multi-agent-orchestrator-ZHSMWIKP.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"multi-agent-orchestrator-RMTLPKB4.js"}
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkPB276BX2_cjs=require('./chunk-PB276BX2.cjs'),chunk7DPTXZZI_cjs=require('./chunk-7DPTXZZI.cjs');require('./chunk-K64WKZ22.cjs'),require('./chunk-WOFIBIPW.cjs'),require('./chunk-WCQK3JOR.cjs');Object.defineProperty(exports,"createAgentNetwork",{enumerable:true,get:function(){return chunkPB276BX2_cjs.c}});Object.defineProperty(exports,"createDelegator",{enumerable:true,get:function(){return chunkPB276BX2_cjs.e}});Object.defineProperty(exports,"createMessageBus",{enumerable:true,get:function(){return chunkPB276BX2_cjs.b}});Object.defineProperty(exports,"createPubSub",{enumerable:true,get:function(){return chunkPB276BX2_cjs.f}});Object.defineProperty(exports,"createResponder",{enumerable:true,get:function(){return chunkPB276BX2_cjs.d}});Object.defineProperty(exports,"explainGoal",{enumerable:true,get:function(){return chunkPB276BX2_cjs.j}});Object.defineProperty(exports,"getDependencyGraph",{enumerable:true,get:function(){return chunkPB276BX2_cjs.g}});Object.defineProperty(exports,"patternToMermaid",{enumerable:true,get:function(){return chunkPB276BX2_cjs.a}});Object.defineProperty(exports,"planGoal",{enumerable:true,get:function(){return chunkPB276BX2_cjs.i}});Object.defineProperty(exports,"validateGoal",{enumerable:true,get:function(){return chunkPB276BX2_cjs.h}});Object.defineProperty(exports,"InMemoryCheckpointStore",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.y}});Object.defineProperty(exports,"MAX_BREAKPOINT_HISTORY",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.s}});Object.defineProperty(exports,"ReflectionExhaustedError",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.K}});Object.defineProperty(exports,"Semaphore",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.N}});Object.defineProperty(exports,"aggregateTokens",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.ia}});Object.defineProperty(exports,"allReadyStrategy",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs._}});Object.defineProperty(exports,"capabilityRoute",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.la}});Object.defineProperty(exports,"collectOutputs",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.ha}});Object.defineProperty(exports,"composePatterns",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.ja}});Object.defineProperty(exports,"concatResults",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.fa}});Object.defineProperty(exports,"costEfficientStrategy",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.aa}});Object.defineProperty(exports,"createBreakpointId",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.t}});Object.defineProperty(exports,"createCheckpointId",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.w}});Object.defineProperty(exports,"createInitialBreakpointState",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.v}});Object.defineProperty(exports,"createMultiAgentOrchestrator",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.ra}});Object.defineProperty(exports,"dag",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.W}});Object.defineProperty(exports,"debate",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.na}});Object.defineProperty(exports,"derivedConstraint",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.pa}});Object.defineProperty(exports,"diffCheckpoints",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.Q}});Object.defineProperty(exports,"findAgentsByCapability",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.ka}});Object.defineProperty(exports,"forkFromCheckpoint",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.R}});Object.defineProperty(exports,"getCheckpointProgress",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.P}});Object.defineProperty(exports,"getPatternStep",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.O}});Object.defineProperty(exports,"goal",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.Z}});Object.defineProperty(exports,"highestImpactStrategy",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.$}});Object.defineProperty(exports,"matchBreakpoint",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.u}});Object.defineProperty(exports,"parallel",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.T}});Object.defineProperty(exports,"patternFromJSON",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.ca}});Object.defineProperty(exports,"patternToJSON",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.ba}});Object.defineProperty(exports,"pickBestResult",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.ga}});Object.defineProperty(exports,"race",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.Y}});Object.defineProperty(exports,"reflect",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.X}});Object.defineProperty(exports,"runAgentRequirement",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.ea}});Object.defineProperty(exports,"runDebate",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.oa}});Object.defineProperty(exports,"selectAgent",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.da}});Object.defineProperty(exports,"sequential",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.U}});Object.defineProperty(exports,"spawnOnCondition",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.ma}});Object.defineProperty(exports,"spawnPool",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.qa}});Object.defineProperty(exports,"supervisor",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.V}});Object.defineProperty(exports,"validateCheckpoint",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.x}});Object.defineProperty(exports,"withReflection",{enumerable:true,get:function(){return chunk7DPTXZZI_cjs.L}});//# sourceMappingURL=multi-agent.cjs.map
1
+ 'use strict';var chunkXGHNOSXT_cjs=require('./chunk-XGHNOSXT.cjs'),chunk7EJN6TYX_cjs=require('./chunk-7EJN6TYX.cjs');require('./chunk-K64WKZ22.cjs'),require('./chunk-WOFIBIPW.cjs'),require('./chunk-WCQK3JOR.cjs');Object.defineProperty(exports,"createAgentNetwork",{enumerable:true,get:function(){return chunkXGHNOSXT_cjs.c}});Object.defineProperty(exports,"createDelegator",{enumerable:true,get:function(){return chunkXGHNOSXT_cjs.e}});Object.defineProperty(exports,"createMessageBus",{enumerable:true,get:function(){return chunkXGHNOSXT_cjs.b}});Object.defineProperty(exports,"createPubSub",{enumerable:true,get:function(){return chunkXGHNOSXT_cjs.f}});Object.defineProperty(exports,"createResponder",{enumerable:true,get:function(){return chunkXGHNOSXT_cjs.d}});Object.defineProperty(exports,"explainGoal",{enumerable:true,get:function(){return chunkXGHNOSXT_cjs.j}});Object.defineProperty(exports,"getDependencyGraph",{enumerable:true,get:function(){return chunkXGHNOSXT_cjs.g}});Object.defineProperty(exports,"patternToMermaid",{enumerable:true,get:function(){return chunkXGHNOSXT_cjs.a}});Object.defineProperty(exports,"planGoal",{enumerable:true,get:function(){return chunkXGHNOSXT_cjs.i}});Object.defineProperty(exports,"validateGoal",{enumerable:true,get:function(){return chunkXGHNOSXT_cjs.h}});Object.defineProperty(exports,"InMemoryCheckpointStore",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.y}});Object.defineProperty(exports,"MAX_BREAKPOINT_HISTORY",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.s}});Object.defineProperty(exports,"ReflectionExhaustedError",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.K}});Object.defineProperty(exports,"Semaphore",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.N}});Object.defineProperty(exports,"aggregateTokens",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ia}});Object.defineProperty(exports,"allReadyStrategy",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs._}});Object.defineProperty(exports,"capabilityRoute",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.la}});Object.defineProperty(exports,"collectOutputs",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ha}});Object.defineProperty(exports,"composePatterns",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ja}});Object.defineProperty(exports,"concatResults",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.fa}});Object.defineProperty(exports,"costEfficientStrategy",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.aa}});Object.defineProperty(exports,"createBreakpointId",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.t}});Object.defineProperty(exports,"createCheckpointId",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.w}});Object.defineProperty(exports,"createInitialBreakpointState",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.v}});Object.defineProperty(exports,"createMultiAgentOrchestrator",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ra}});Object.defineProperty(exports,"dag",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.W}});Object.defineProperty(exports,"debate",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.na}});Object.defineProperty(exports,"derivedConstraint",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.pa}});Object.defineProperty(exports,"diffCheckpoints",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.Q}});Object.defineProperty(exports,"findAgentsByCapability",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ka}});Object.defineProperty(exports,"forkFromCheckpoint",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.R}});Object.defineProperty(exports,"getCheckpointProgress",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.P}});Object.defineProperty(exports,"getPatternStep",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.O}});Object.defineProperty(exports,"goal",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.Z}});Object.defineProperty(exports,"highestImpactStrategy",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.$}});Object.defineProperty(exports,"matchBreakpoint",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.u}});Object.defineProperty(exports,"parallel",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.T}});Object.defineProperty(exports,"patternFromJSON",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ca}});Object.defineProperty(exports,"patternToJSON",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ba}});Object.defineProperty(exports,"pickBestResult",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ga}});Object.defineProperty(exports,"race",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.Y}});Object.defineProperty(exports,"reflect",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.X}});Object.defineProperty(exports,"runAgentRequirement",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ea}});Object.defineProperty(exports,"runDebate",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.oa}});Object.defineProperty(exports,"selectAgent",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.da}});Object.defineProperty(exports,"sequential",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.U}});Object.defineProperty(exports,"spawnOnCondition",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.ma}});Object.defineProperty(exports,"spawnPool",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.qa}});Object.defineProperty(exports,"supervisor",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.V}});Object.defineProperty(exports,"validateCheckpoint",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.x}});Object.defineProperty(exports,"withReflection",{enumerable:true,get:function(){return chunk7EJN6TYX_cjs.L}});//# sourceMappingURL=multi-agent.cjs.map
2
2
  //# sourceMappingURL=multi-agent.cjs.map
@@ -1,11 +1,11 @@
1
- import { a as MultiAgentOrchestratorOptions, M as MultiAgentOrchestrator, P as ParallelPattern, y as RacePattern, L as ReflectionEvaluation, F as ReflectIterationRecord, I as ReflectPattern, W as SequentialPattern, a3 as SupervisorPattern, i as ExecutionPattern, D as DebatePattern, f as AgentRegistry, Q as RunAgentRequirement, g as DebateResult } from './orchestrator-types-CbNE7Rjp.cjs';
2
- export { e as AgentRegistration, H as HandoffRequest, j as HandoffResult, s as MultiAgentRunCallOptions, t as MultiAgentState, z as RaceResult, C as RaceSuccessEntry, J as ReflectionConfig, K as ReflectionContext, R as ReflectionEvaluator, N as ReflectionExhaustedError, a4 as TaskContext, T as TaskRegistration, as as withReflection } from './orchestrator-types-CbNE7Rjp.cjs';
3
- import { aG as PatternCheckpointState, ah as CheckpointDiff, h as CheckpointStore, aj as CheckpointProgress, J as AgentSelectionStrategy, j as DagNode, D as DagExecutionContext, k as DagPattern, F as GoalNode, K as RelaxationTier, at as GoalMetrics, P as PatternCheckpointConfig, E as GoalPattern, q as RunResult, s as OrchestratorConstraint, L as GoalResult } from './types-DJ09LjZX.cjs';
4
- export { z as BreakpointConfig, ab as BreakpointContext, B as BreakpointModifications, d as BreakpointRequest, ae as BreakpointState, af as BreakpointType, C as Checkpoint, ai as CheckpointLocalState, au as GoalStepMetrics, i as InMemoryCheckpointStore, aB as InMemoryCheckpointStoreOptions, aC as MAX_BREAKPOINT_HISTORY, $ as MultiAgentBreakpointType, aD as MultiAgentCheckpointLocalState, aO as RelaxationContext, aP as RelaxationRecord, aQ as RelaxationStrategy, aY as SingleAgentCheckpointLocalState, b2 as createBreakpointId, b3 as createCheckpointId, b4 as createInitialBreakpointState, b6 as matchBreakpoint, b7 as validateCheckpoint } from './types-DJ09LjZX.cjs';
1
+ import { a as MultiAgentOrchestratorOptions, M as MultiAgentOrchestrator, P as ParallelPattern, y as RacePattern, L as ReflectionEvaluation, F as ReflectIterationRecord, I as ReflectPattern, W as SequentialPattern, a3 as SupervisorPattern, i as ExecutionPattern, D as DebatePattern, f as AgentRegistry, Q as RunAgentRequirement, g as DebateResult } from './orchestrator-types-s0766dDB.cjs';
2
+ export { e as AgentRegistration, H as HandoffRequest, j as HandoffResult, s as MultiAgentRunCallOptions, t as MultiAgentState, z as RaceResult, C as RaceSuccessEntry, J as ReflectionConfig, K as ReflectionContext, R as ReflectionEvaluator, N as ReflectionExhaustedError, a4 as TaskContext, T as TaskRegistration, as as withReflection } from './orchestrator-types-s0766dDB.cjs';
3
+ import { aH as PatternCheckpointState, ai as CheckpointDiff, h as CheckpointStore, ak as CheckpointProgress, K as AgentSelectionStrategy, j as DagNode, D as DagExecutionContext, k as DagPattern, J as GoalNode, L as RelaxationTier, au as GoalMetrics, P as PatternCheckpointConfig, F as GoalPattern, r as RunResult, t as OrchestratorConstraint, Q as GoalResult } from './types-CUp1N0uU.cjs';
4
+ export { E as BreakpointConfig, ac as BreakpointContext, B as BreakpointModifications, d as BreakpointRequest, af as BreakpointState, ag as BreakpointType, C as Checkpoint, aj as CheckpointLocalState, av as GoalStepMetrics, i as InMemoryCheckpointStore, aC as InMemoryCheckpointStoreOptions, aD as MAX_BREAKPOINT_HISTORY, a0 as MultiAgentBreakpointType, aE as MultiAgentCheckpointLocalState, aP as RelaxationContext, aQ as RelaxationRecord, aR as RelaxationStrategy, aY as SingleAgentCheckpointLocalState, b2 as createBreakpointId, b3 as createCheckpointId, b4 as createInitialBreakpointState, b6 as matchBreakpoint, b7 as validateCheckpoint } from './types-CUp1N0uU.cjs';
5
5
  import '@directive-run/core';
6
6
  import '@directive-run/core/plugins';
7
- import './debug-timeline-DpnRMnLU.cjs';
8
- import './health-monitor-C6xoXrQz.cjs';
7
+ import './debug-timeline-Dn1lC_gK.cjs';
8
+ import './health-monitor-Cq5sDvid.cjs';
9
9
 
10
10
  /**
11
11
  * Async semaphore for controlling concurrent access.
@@ -1,11 +1,11 @@
1
- import { a as MultiAgentOrchestratorOptions, M as MultiAgentOrchestrator, P as ParallelPattern, y as RacePattern, L as ReflectionEvaluation, F as ReflectIterationRecord, I as ReflectPattern, W as SequentialPattern, a3 as SupervisorPattern, i as ExecutionPattern, D as DebatePattern, f as AgentRegistry, Q as RunAgentRequirement, g as DebateResult } from './orchestrator-types-ZK9lv5Sm.js';
2
- export { e as AgentRegistration, H as HandoffRequest, j as HandoffResult, s as MultiAgentRunCallOptions, t as MultiAgentState, z as RaceResult, C as RaceSuccessEntry, J as ReflectionConfig, K as ReflectionContext, R as ReflectionEvaluator, N as ReflectionExhaustedError, a4 as TaskContext, T as TaskRegistration, as as withReflection } from './orchestrator-types-ZK9lv5Sm.js';
3
- import { aG as PatternCheckpointState, ah as CheckpointDiff, h as CheckpointStore, aj as CheckpointProgress, J as AgentSelectionStrategy, j as DagNode, D as DagExecutionContext, k as DagPattern, F as GoalNode, K as RelaxationTier, at as GoalMetrics, P as PatternCheckpointConfig, E as GoalPattern, q as RunResult, s as OrchestratorConstraint, L as GoalResult } from './types-DJ09LjZX.js';
4
- export { z as BreakpointConfig, ab as BreakpointContext, B as BreakpointModifications, d as BreakpointRequest, ae as BreakpointState, af as BreakpointType, C as Checkpoint, ai as CheckpointLocalState, au as GoalStepMetrics, i as InMemoryCheckpointStore, aB as InMemoryCheckpointStoreOptions, aC as MAX_BREAKPOINT_HISTORY, $ as MultiAgentBreakpointType, aD as MultiAgentCheckpointLocalState, aO as RelaxationContext, aP as RelaxationRecord, aQ as RelaxationStrategy, aY as SingleAgentCheckpointLocalState, b2 as createBreakpointId, b3 as createCheckpointId, b4 as createInitialBreakpointState, b6 as matchBreakpoint, b7 as validateCheckpoint } from './types-DJ09LjZX.js';
1
+ import { a as MultiAgentOrchestratorOptions, M as MultiAgentOrchestrator, P as ParallelPattern, y as RacePattern, L as ReflectionEvaluation, F as ReflectIterationRecord, I as ReflectPattern, W as SequentialPattern, a3 as SupervisorPattern, i as ExecutionPattern, D as DebatePattern, f as AgentRegistry, Q as RunAgentRequirement, g as DebateResult } from './orchestrator-types-C5D5JZUj.js';
2
+ export { e as AgentRegistration, H as HandoffRequest, j as HandoffResult, s as MultiAgentRunCallOptions, t as MultiAgentState, z as RaceResult, C as RaceSuccessEntry, J as ReflectionConfig, K as ReflectionContext, R as ReflectionEvaluator, N as ReflectionExhaustedError, a4 as TaskContext, T as TaskRegistration, as as withReflection } from './orchestrator-types-C5D5JZUj.js';
3
+ import { aH as PatternCheckpointState, ai as CheckpointDiff, h as CheckpointStore, ak as CheckpointProgress, K as AgentSelectionStrategy, j as DagNode, D as DagExecutionContext, k as DagPattern, J as GoalNode, L as RelaxationTier, au as GoalMetrics, P as PatternCheckpointConfig, F as GoalPattern, r as RunResult, t as OrchestratorConstraint, Q as GoalResult } from './types-CUp1N0uU.js';
4
+ export { E as BreakpointConfig, ac as BreakpointContext, B as BreakpointModifications, d as BreakpointRequest, af as BreakpointState, ag as BreakpointType, C as Checkpoint, aj as CheckpointLocalState, av as GoalStepMetrics, i as InMemoryCheckpointStore, aC as InMemoryCheckpointStoreOptions, aD as MAX_BREAKPOINT_HISTORY, a0 as MultiAgentBreakpointType, aE as MultiAgentCheckpointLocalState, aP as RelaxationContext, aQ as RelaxationRecord, aR as RelaxationStrategy, aY as SingleAgentCheckpointLocalState, b2 as createBreakpointId, b3 as createCheckpointId, b4 as createInitialBreakpointState, b6 as matchBreakpoint, b7 as validateCheckpoint } from './types-CUp1N0uU.js';
5
5
  import '@directive-run/core';
6
6
  import '@directive-run/core/plugins';
7
- import './debug-timeline-L13P-U2I.js';
8
- import './health-monitor-qL9RNMH3.js';
7
+ import './debug-timeline-BGcPa0JO.js';
8
+ import './health-monitor-DtwmIJkb.js';
9
9
 
10
10
  /**
11
11
  * Async semaphore for controlling concurrent access.
@@ -1,2 +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-56LYSE63.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-FN4GUZAI.js';import'./chunk-UR5BMWEN.js';import'./chunk-FBT73WFY.js';import'./chunk-HRR45JZX.js';//# sourceMappingURL=multi-agent.js.map
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-RHJAMXLS.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-G7CRWJT7.js';import'./chunk-UR5BMWEN.js';import'./chunk-FBT73WFY.js';import'./chunk-HRR45JZX.js';//# sourceMappingURL=multi-agent.js.map
2
2
  //# sourceMappingURL=multi-agent.js.map
package/dist/ollama.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as AdapterHooks, c as AgentRunner, p as StreamingCallbackRunner } from './types-DJ09LjZX.cjs';
1
+ import { o as AdapterHooks, c as AgentRunner, p as StreamingCallbackRunner } from './types-CUp1N0uU.cjs';
2
2
  import '@directive-run/core';
3
3
 
4
4
  /**
package/dist/ollama.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as AdapterHooks, c as AgentRunner, p as StreamingCallbackRunner } from './types-DJ09LjZX.js';
1
+ import { o as AdapterHooks, c as AgentRunner, p as StreamingCallbackRunner } from './types-CUp1N0uU.js';
2
2
  import '@directive-run/core';
3
3
 
4
4
  /**
package/dist/openai.d.cts CHANGED
@@ -1,5 +1,5 @@
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';
1
+ import { E as EmbedderFn } from './semantic-cache-Ba0-jEwb.cjs';
2
+ import { o as AdapterHooks, c as AgentRunner, p as StreamingCallbackRunner } from './types-CUp1N0uU.cjs';
3
3
  import '@directive-run/core';
4
4
 
5
5
  /**
package/dist/openai.d.ts CHANGED
@@ -1,5 +1,5 @@
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';
1
+ import { E as EmbedderFn } from './semantic-cache-Ba0-jEwb.js';
2
+ import { o as AdapterHooks, c as AgentRunner, p as StreamingCallbackRunner } from './types-CUp1N0uU.js';
3
3
  import '@directive-run/core';
4
4
 
5
5
  /**
@@ -1,8 +1,8 @@
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';
1
+ import { M as Message$1, r as RunResult, b as AgentLike, m as GuardrailFn, O as OutputGuardrailData, p as StreamingCallbackRunner, c as AgentRunner, s as OrchestratorState, N as NamedGuardrail, I as InputGuardrailData, C as Checkpoint, B as BreakpointModifications, d as BreakpointRequest, t as OrchestratorConstraint, u as OrchestratorResolver, v as GuardrailsConfig, A as ApprovalRequest, w as OrchestratorDebugConfig, x as AgentRetryConfig, y as OrchestratorLifecycleHooks, z as SelfHealingConfig, h as CheckpointStore, E as BreakpointConfig, R as RunOptions, T as ToolCallGuardrailData, P as PatternCheckpointConfig, k as DagPattern, F as GoalPattern, J as GoalNode, K as AgentSelectionStrategy, L as RelaxationTier, Q as GoalResult, U as GoalCheckpointState, V as SequentialCheckpointState, W as SupervisorCheckpointState, X as ReflectCheckpointState, Y as DebateCheckpointState, Z as DagCheckpointState, S as Scratchpad, _ as MultiAgentLifecycleHooks, $ as MultiAgentSelfHealingConfig, a0 as MultiAgentBreakpointType, a1 as CrossAgentDerivationFn } from './types-CUp1N0uU.js';
2
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
+ import { D as DebugTimeline } from './debug-timeline-BGcPa0JO.js';
5
+ import { H as HealthMonitor } from './health-monitor-DtwmIJkb.js';
6
6
 
7
7
  /**
8
8
  * Agent Memory System
@@ -844,6 +844,16 @@ interface OrchestratorStreamResult<T = unknown> {
844
844
  result: Promise<RunResult<T>>;
845
845
  /** Abort the stream */
846
846
  abort: () => void;
847
+ /**
848
+ * RFC 0005: cancel the in-flight generation but keep the
849
+ * `liveContext` subscription attached. Distinct from `abort()`:
850
+ * `abort` tears the AsyncIterable down AND detaches liveContext;
851
+ * `interrupt` cancels the LLM run but leaves the orchestrator's
852
+ * fact subscriptions alive so the next caller-driven prompt
853
+ * continues against fresh facts. The optional `reason` lands on
854
+ * the emitted `interrupted` chunk.
855
+ */
856
+ interrupt: (reason?: string) => void;
847
857
  }
848
858
  /** Stream chunk types for orchestrator — extends StreamChunk with approval events */
849
859
  type OrchestratorStreamChunk = StreamChunk | {
@@ -854,7 +864,86 @@ type OrchestratorStreamChunk = StreamChunk | {
854
864
  type: "approval_resolved";
855
865
  requestId: string;
856
866
  approved: boolean;
867
+ }
868
+ /**
869
+ * RFC 0005: a `liveContext`-watched fact changed. Carries the keys
870
+ * whose values changed in this batch so the consumer can decide
871
+ * whether to re-render the system prompt mid-stream. Always emitted
872
+ * when `notifyOn: "all-changes"`; emitted only for keys whose
873
+ * change `interruptWhen` returned `true` for when `notifyOn:
874
+ * "interrupt-only"` (the default).
875
+ */
876
+ | {
877
+ type: "context_updated";
878
+ changedKeys: readonly string[];
879
+ }
880
+ /**
881
+ * RFC 0005: `liveContext.interruptWhen` returned `true` for at
882
+ * least one changed key. The orchestrator aborted the in-flight
883
+ * LLM run and emits this chunk with the partial output captured
884
+ * up to the abort point. The consumer is responsible for
885
+ * re-prompting via a fresh `runStream` call against the still-live
886
+ * liveContext subscription (or for fully tearing the run down via
887
+ * `result.abort()`). A follow-up RFC will add automatic re-invocation
888
+ * once the design is settled.
889
+ */
890
+ | {
891
+ type: "interrupted";
892
+ reason: string;
893
+ partialOutput: string;
894
+ changedKeys: readonly string[];
857
895
  };
896
+ /**
897
+ * RFC 0005: live-context options for `runStream`. Wires a Directive
898
+ * system's fact subscriptions into the in-flight LLM run so the
899
+ * agent's view of the world stays in sync with reality.
900
+ *
901
+ * @example Market dashboard agent reacting to price ticks
902
+ * ```ts
903
+ * const result = orchestrator.runStream(agent, "Summarize current state", {
904
+ * liveContext: {
905
+ * system: marketSystem,
906
+ * keys: ["lastPrice"],
907
+ * interruptWhen: (facts) => Math.abs(facts.lastPrice - facts.openPrice) > 5,
908
+ * },
909
+ * });
910
+ * ```
911
+ */
912
+ interface LiveContextOptions<F extends Record<string, unknown> = Record<string, unknown>> {
913
+ /** The Directive system whose facts feed the agent. */
914
+ system: System<any>;
915
+ /**
916
+ * Fact keys to watch. The orchestrator subscribes to fact-change
917
+ * notifications keyed on these names. Other facts change without
918
+ * notifying the agent — keep this list tight to bound work.
919
+ */
920
+ keys: readonly (keyof F & string)[];
921
+ /**
922
+ * Predicate run on every batch of fact changes that touches a
923
+ * watched key. Return `true` to interrupt the in-flight LLM run.
924
+ * Receives the FULL fact snapshot + the array of changed keys so
925
+ * the predicate can look at correlations (price + volume, headSha +
926
+ * prState, etc.). Optional — defaults to `() => true` (interrupt
927
+ * on every watched-key change).
928
+ */
929
+ interruptWhen?: (facts: F, changedKeys: readonly string[]) => boolean;
930
+ /**
931
+ * `"all-changes"` emits `context_updated` for every watched-key
932
+ * batch (so the consumer can render a sidebar of fact deltas).
933
+ * `"interrupt-only"` (default) emits only for changes that hit
934
+ * `interruptWhen === true`. Choose the noisier variant when
935
+ * you want a live view; choose the default when you only care
936
+ * about the interruption moments.
937
+ */
938
+ notifyOn?: "all-changes" | "interrupt-only";
939
+ /**
940
+ * Optional hook fired on every watched-key change AFTER the
941
+ * `interruptWhen` predicate runs but BEFORE the chunk emits.
942
+ * Useful for logging / instrumentation that should fire regardless
943
+ * of `notifyOn`.
944
+ */
945
+ onContextUpdate?: (changedKeys: readonly string[]) => void;
946
+ }
858
947
  /** Per-call options for run() */
859
948
  interface RunCallOptions {
860
949
  /** Override output guardrails for this call only. Set to [] to skip. */
@@ -893,6 +982,17 @@ interface AgentOrchestrator<F extends Record<string, unknown>> {
893
982
  */
894
983
  runStream<T>(agent: AgentLike, input: string, options?: {
895
984
  signal?: AbortSignal;
985
+ /**
986
+ * RFC 0005: bind the in-flight LLM run to a Directive system's
987
+ * facts. When a watched fact changes, the orchestrator emits a
988
+ * `context_updated` chunk; when `interruptWhen` returns `true`,
989
+ * the LLM run is aborted and an `interrupted` chunk lands on
990
+ * the stream. The companion `createFactPIIGuardrail` plugin
991
+ * MUST be wired on the same system when watched facts may
992
+ * carry PII — `liveContext` expands the source → fact → prompt
993
+ * bypass surface into mid-stream context updates.
994
+ */
995
+ liveContext?: LiveContextOptions<F & OrchestratorState>;
896
996
  }): OrchestratorStreamResult<T>;
897
997
  /** Approve a pending request */
898
998
  approve(requestId: string): void;
@@ -1,8 +1,8 @@
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';
1
+ import { M as Message$1, r as RunResult, b as AgentLike, m as GuardrailFn, O as OutputGuardrailData, p as StreamingCallbackRunner, c as AgentRunner, s as OrchestratorState, N as NamedGuardrail, I as InputGuardrailData, C as Checkpoint, B as BreakpointModifications, d as BreakpointRequest, t as OrchestratorConstraint, u as OrchestratorResolver, v as GuardrailsConfig, A as ApprovalRequest, w as OrchestratorDebugConfig, x as AgentRetryConfig, y as OrchestratorLifecycleHooks, z as SelfHealingConfig, h as CheckpointStore, E as BreakpointConfig, R as RunOptions, T as ToolCallGuardrailData, P as PatternCheckpointConfig, k as DagPattern, F as GoalPattern, J as GoalNode, K as AgentSelectionStrategy, L as RelaxationTier, Q as GoalResult, U as GoalCheckpointState, V as SequentialCheckpointState, W as SupervisorCheckpointState, X as ReflectCheckpointState, Y as DebateCheckpointState, Z as DagCheckpointState, S as Scratchpad, _ as MultiAgentLifecycleHooks, $ as MultiAgentSelfHealingConfig, a0 as MultiAgentBreakpointType, a1 as CrossAgentDerivationFn } from './types-CUp1N0uU.cjs';
2
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
+ import { D as DebugTimeline } from './debug-timeline-Dn1lC_gK.cjs';
5
+ import { H as HealthMonitor } from './health-monitor-Cq5sDvid.cjs';
6
6
 
7
7
  /**
8
8
  * Agent Memory System
@@ -844,6 +844,16 @@ interface OrchestratorStreamResult<T = unknown> {
844
844
  result: Promise<RunResult<T>>;
845
845
  /** Abort the stream */
846
846
  abort: () => void;
847
+ /**
848
+ * RFC 0005: cancel the in-flight generation but keep the
849
+ * `liveContext` subscription attached. Distinct from `abort()`:
850
+ * `abort` tears the AsyncIterable down AND detaches liveContext;
851
+ * `interrupt` cancels the LLM run but leaves the orchestrator's
852
+ * fact subscriptions alive so the next caller-driven prompt
853
+ * continues against fresh facts. The optional `reason` lands on
854
+ * the emitted `interrupted` chunk.
855
+ */
856
+ interrupt: (reason?: string) => void;
847
857
  }
848
858
  /** Stream chunk types for orchestrator — extends StreamChunk with approval events */
849
859
  type OrchestratorStreamChunk = StreamChunk | {
@@ -854,7 +864,86 @@ type OrchestratorStreamChunk = StreamChunk | {
854
864
  type: "approval_resolved";
855
865
  requestId: string;
856
866
  approved: boolean;
867
+ }
868
+ /**
869
+ * RFC 0005: a `liveContext`-watched fact changed. Carries the keys
870
+ * whose values changed in this batch so the consumer can decide
871
+ * whether to re-render the system prompt mid-stream. Always emitted
872
+ * when `notifyOn: "all-changes"`; emitted only for keys whose
873
+ * change `interruptWhen` returned `true` for when `notifyOn:
874
+ * "interrupt-only"` (the default).
875
+ */
876
+ | {
877
+ type: "context_updated";
878
+ changedKeys: readonly string[];
879
+ }
880
+ /**
881
+ * RFC 0005: `liveContext.interruptWhen` returned `true` for at
882
+ * least one changed key. The orchestrator aborted the in-flight
883
+ * LLM run and emits this chunk with the partial output captured
884
+ * up to the abort point. The consumer is responsible for
885
+ * re-prompting via a fresh `runStream` call against the still-live
886
+ * liveContext subscription (or for fully tearing the run down via
887
+ * `result.abort()`). A follow-up RFC will add automatic re-invocation
888
+ * once the design is settled.
889
+ */
890
+ | {
891
+ type: "interrupted";
892
+ reason: string;
893
+ partialOutput: string;
894
+ changedKeys: readonly string[];
857
895
  };
896
+ /**
897
+ * RFC 0005: live-context options for `runStream`. Wires a Directive
898
+ * system's fact subscriptions into the in-flight LLM run so the
899
+ * agent's view of the world stays in sync with reality.
900
+ *
901
+ * @example Market dashboard agent reacting to price ticks
902
+ * ```ts
903
+ * const result = orchestrator.runStream(agent, "Summarize current state", {
904
+ * liveContext: {
905
+ * system: marketSystem,
906
+ * keys: ["lastPrice"],
907
+ * interruptWhen: (facts) => Math.abs(facts.lastPrice - facts.openPrice) > 5,
908
+ * },
909
+ * });
910
+ * ```
911
+ */
912
+ interface LiveContextOptions<F extends Record<string, unknown> = Record<string, unknown>> {
913
+ /** The Directive system whose facts feed the agent. */
914
+ system: System<any>;
915
+ /**
916
+ * Fact keys to watch. The orchestrator subscribes to fact-change
917
+ * notifications keyed on these names. Other facts change without
918
+ * notifying the agent — keep this list tight to bound work.
919
+ */
920
+ keys: readonly (keyof F & string)[];
921
+ /**
922
+ * Predicate run on every batch of fact changes that touches a
923
+ * watched key. Return `true` to interrupt the in-flight LLM run.
924
+ * Receives the FULL fact snapshot + the array of changed keys so
925
+ * the predicate can look at correlations (price + volume, headSha +
926
+ * prState, etc.). Optional — defaults to `() => true` (interrupt
927
+ * on every watched-key change).
928
+ */
929
+ interruptWhen?: (facts: F, changedKeys: readonly string[]) => boolean;
930
+ /**
931
+ * `"all-changes"` emits `context_updated` for every watched-key
932
+ * batch (so the consumer can render a sidebar of fact deltas).
933
+ * `"interrupt-only"` (default) emits only for changes that hit
934
+ * `interruptWhen === true`. Choose the noisier variant when
935
+ * you want a live view; choose the default when you only care
936
+ * about the interruption moments.
937
+ */
938
+ notifyOn?: "all-changes" | "interrupt-only";
939
+ /**
940
+ * Optional hook fired on every watched-key change AFTER the
941
+ * `interruptWhen` predicate runs but BEFORE the chunk emits.
942
+ * Useful for logging / instrumentation that should fire regardless
943
+ * of `notifyOn`.
944
+ */
945
+ onContextUpdate?: (changedKeys: readonly string[]) => void;
946
+ }
858
947
  /** Per-call options for run() */
859
948
  interface RunCallOptions {
860
949
  /** Override output guardrails for this call only. Set to [] to skip. */
@@ -893,6 +982,17 @@ interface AgentOrchestrator<F extends Record<string, unknown>> {
893
982
  */
894
983
  runStream<T>(agent: AgentLike, input: string, options?: {
895
984
  signal?: AbortSignal;
985
+ /**
986
+ * RFC 0005: bind the in-flight LLM run to a Directive system's
987
+ * facts. When a watched fact changes, the orchestrator emits a
988
+ * `context_updated` chunk; when `interruptWhen` returns `true`,
989
+ * the LLM run is aborted and an `interrupted` chunk lands on
990
+ * the stream. The companion `createFactPIIGuardrail` plugin
991
+ * MUST be wired on the same system when watched facts may
992
+ * carry PII — `liveContext` expands the source → fact → prompt
993
+ * bypass surface into mid-stream context updates.
994
+ */
995
+ liveContext?: LiveContextOptions<F & OrchestratorState>;
896
996
  }): OrchestratorStreamResult<T>;
897
997
  /** Approve a pending request */
898
998
  approve(requestId: string): void;
@@ -1,5 +1,5 @@
1
1
  import { FactPredicate, SchemaValidationError } from '@directive-run/core';
2
- import { c as AgentRunner, b as AgentLike } from './types-DJ09LjZX.cjs';
2
+ import { c as AgentRunner, b as AgentLike } from './types-CUp1N0uU.cjs';
3
3
 
4
4
  /**
5
5
  * predicateFromIntent — let an LLM emit a typed FactPredicate as JSON,
@@ -1,5 +1,5 @@
1
1
  import { FactPredicate, SchemaValidationError } from '@directive-run/core';
2
- import { c as AgentRunner, b as AgentLike } from './types-DJ09LjZX.js';
2
+ import { c as AgentRunner, b as AgentLike } from './types-CUp1N0uU.js';
3
3
 
4
4
  /**
5
5
  * predicateFromIntent — let an LLM emit a typed FactPredicate as JSON,
@@ -268,4 +268,4 @@ declare function createBatchedEmbedder(config: {
268
268
  maxWaitMs?: number;
269
269
  }): BatchedEmbedder;
270
270
 
271
- export { type BatchedEmbedder as B, type CacheEntry as C, type EmbedderFn as E, type SemanticCache as S, type Embedding as a, type CacheLookupResult as b, type CacheStats as c, type SemanticCacheConfig as d, type SemanticCacheStorage as e, createBatchedEmbedder as f, createInMemoryStorage as g, createSemanticCache as h, createSemanticCacheGuardrail as i, createTestEmbedder as j };
271
+ export { type BatchedEmbedder as B, type CacheEntry as C, type EmbedderFn as E, type SemanticCache as S, type CacheLookupResult as a, type CacheStats as b, type Embedding as c, type SemanticCacheConfig as d, type SemanticCacheStorage as e, createBatchedEmbedder as f, createInMemoryStorage as g, createSemanticCache as h, createSemanticCacheGuardrail as i, createTestEmbedder as j };
@@ -268,4 +268,4 @@ declare function createBatchedEmbedder(config: {
268
268
  maxWaitMs?: number;
269
269
  }): BatchedEmbedder;
270
270
 
271
- export { type BatchedEmbedder as B, type CacheEntry as C, type EmbedderFn as E, type SemanticCache as S, type Embedding as a, type CacheLookupResult as b, type CacheStats as c, type SemanticCacheConfig as d, type SemanticCacheStorage as e, createBatchedEmbedder as f, createInMemoryStorage as g, createSemanticCache as h, createSemanticCacheGuardrail as i, createTestEmbedder as j };
271
+ export { type BatchedEmbedder as B, type CacheEntry as C, type EmbedderFn as E, type SemanticCache as S, type CacheLookupResult as a, type CacheStats as b, type Embedding as c, type SemanticCacheConfig as d, type SemanticCacheStorage as e, createBatchedEmbedder as f, createInMemoryStorage as g, createSemanticCache as h, createSemanticCacheGuardrail as i, createTestEmbedder as j };
package/dist/testing.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkD5APTMCT_cjs=require('./chunk-D5APTMCT.cjs'),chunk7DPTXZZI_cjs=require('./chunk-7DPTXZZI.cjs');require('./chunk-K64WKZ22.cjs');var chunkWOFIBIPW_cjs=require('./chunk-WOFIBIPW.cjs');require('./chunk-WCQK3JOR.cjs');function b(r={}){let{defaultResponse:e={output:"mock response",totalTokens:10},responses:t={},recordCalls:n=true,onRun:o}=r,s=[],a=new Map(Object.entries(t)),i=e;return {run:async(l,c,g)=>{o?.(l,c),n&&s.push({agent:l,input:c,options:g,timestamp:Date.now()});let d=a.get(l.name)??i;if(d.generate){let p=d.generate(c,l);d={...d,...p};}if(d.error)throw d.error;d.delay&&d.delay>0&&await new Promise(p=>setTimeout(p,d.delay));let f=d.messages??[];for(let p of f)g?.onMessage?.(p);let m=d.toolCalls??[];for(let p of m)g?.onToolCall?.(p);return {output:d.output,messages:f,toolCalls:m,totalTokens:d.totalTokens??10}},getCalls:()=>[...s],getCallsFor:l=>s.filter(c=>c.agent.name===l),clearCalls:()=>s.length=0,setResponse:(l,c)=>a.set(l,c),setDefaultResponse:l=>i=l}}async function T(r,e,t){let n={agentName:"test-agent",input:"",...e},o={agentName:e.agentName??"test-agent",input:e.input??"",facts:t?.facts??{},...t},s=Date.now(),a=await r(n,o),i=Date.now()-s;return {...a,duration:i,testedData:n,assertPassed(){if(!a.passed)throw new Error(`Expected guardrail to pass, but it failed: ${a.reason}`)},assertFailed(u){if(a.passed)throw new Error("Expected guardrail to fail, but it passed");if(u!==void 0){if(typeof u=="string"&&!a.reason?.includes(u))throw new Error(`Expected failure reason to include "${u}", got: ${a.reason}`);if(u instanceof RegExp&&!u.test(a.reason??""))throw new Error(`Expected failure reason to match ${u}, got: ${a.reason}`)}},assertTransformed(u){if(a.transformed===void 0)throw new Error("Expected guardrail to transform input, but no transformation occurred");if(u!==void 0&&a.transformed!==u)throw new Error(`Expected transformation to be ${JSON.stringify(u)}, got: ${JSON.stringify(a.transformed)}`)}}}async function x(r,e){let t=[],n=[];for(let o=0;o<e.length;o++){let s=e[o],a=await T(r,s.input,s.context);t.push(a),(a.passed?a.transformed!==void 0?"transform":"pass":"fail")!==s.expect&&n.push({index:o,expected:s.expect,actual:a});}return {results:t,allPassed:()=>n.length===0,failures:()=>n}}function R(r={}){let{autoApprove:e,autoReject:t,delay:n=0,recordRequests:o=true}=r,s=[],a=new Map,i=[];return {async handle(u){o&&s.push(u);for(let l=i.length-1;l>=0;l--){let c=i[l];c.predicate(u)&&(i.splice(l,1),c.resolve(u));}return n>0&&await new Promise(l=>setTimeout(l,n)),t&&t(u)?"rejected":e?.(u)?"approved":new Promise(l=>{a.set(u.id,{request:u,resolve:l});})},getRequests:()=>[...s],clearRequests:()=>s.length=0,approve(u){let l=a.get(u);l&&(l.resolve("approved"),a.delete(u));},reject(u,l){let c=a.get(u);if(c){c.resolve("rejected"),a.delete(u);let g=s.find(d=>d.id===u);g&&(g.rejectionReason=l);}},waitForRequest(u,l=5e3){let c=s.find(u);return c?Promise.resolve(c):new Promise((g,d)=>{let f={predicate:u,resolve:p=>{clearTimeout(m),g(p);}},m=setTimeout(()=>{let p=i.indexOf(f);p>=0&&i.splice(p,1),d(new Error("Timeout waiting for approval request"));},l);i.push(f);})}}}function C(r={}){let{mockResponses:e,defaultMockResponse:t,...n}=r,o=b({responses:e,defaultResponse:t}),s=R(),a=chunkD5APTMCT_cjs.a({...n,runner:o.run,onApprovalRequest:u=>{s.handle(u),n.onApprovalRequest?.(u);}}),i=Object.create(a);return i.mockRunner=o,i.approvalSimulator=s,i.getCalls=()=>o.getCalls(),i.getApprovalRequests=()=>s.getRequests(),i.resetAll=()=>{a.reset(),o.clearCalls(),s.clearRequests();},i}function O(){let r=[];return {plugin:{name:"constraint-recorder",onRequirementCreated(e){r.push({constraintId:e.constraintId,triggered:true,requirement:e.requirement,facts:e.facts,timestamp:Date.now()});}},getSnapshots:()=>[...r],clearSnapshots:()=>r.length=0}}function M(r,e){let t=r.facts;if(e.agentStatus!==void 0&&t.agent.status!==e.agentStatus)throw new Error(`Expected agent status to be "${e.agentStatus}", got "${t.agent.status}"`);if(e.tokenUsage!==void 0){let{min:n,max:o,exact:s}=e.tokenUsage;if(s!==void 0&&t.agent.tokenUsage!==s)throw new Error(`Expected token usage to be exactly ${s}, got ${t.agent.tokenUsage}`);if(n!==void 0&&t.agent.tokenUsage<n)throw new Error(`Expected token usage to be at least ${n}, got ${t.agent.tokenUsage}`);if(o!==void 0&&t.agent.tokenUsage>o)throw new Error(`Expected token usage to be at most ${o}, got ${t.agent.tokenUsage}`)}if(e.pendingApprovals!==void 0&&t.approval.pending.length!==e.pendingApprovals)throw new Error(`Expected ${e.pendingApprovals} pending approvals, got ${t.approval.pending.length}`);if(e.conversationLength!==void 0){let{min:n,max:o,exact:s}=e.conversationLength,a=t.conversation.length;if(s!==void 0&&a!==s)throw new Error(`Expected conversation length to be exactly ${s}, got ${a}`);if(n!==void 0&&a<n)throw new Error(`Expected conversation length to be at least ${n}, got ${a}`);if(o!==void 0&&a>o)throw new Error(`Expected conversation length to be at most ${o}, got ${a}`)}}function q(r=Date.now()){let e=r,t=r;return {now:()=>e,advance:n=>{e+=n;},set:n=>{e=n;},reset:()=>{e=t;}}}function D(r){let{mockResponses:e={},defaultMockResponse:t,mockTasks:n,...o}=r;if(n){let c=o.tasks??{};for(let[g,d]of Object.entries(n))c[g]||(c[g]=y(d.output,{delay:d.delay,shouldError:d.shouldError}));o.tasks=c;}let s={};for(let[c,g]of Object.entries(e)){let d=o.agents[c];d&&(s[d.agent.name]=g);}let a=b({responses:s,defaultResponse:t}),i=R(),u=chunk7DPTXZZI_cjs.ra({...o,runner:a.run,onApprovalRequest:c=>{i.handle(c),o.onApprovalRequest?.(c);}}),l=Object.create(u);return l.mockRunner=a,l.approvalSimulator=i,l.getCalls=()=>a.getCalls(),l.getApprovalRequests=()=>i.getRequests(),l.resetAll=()=>{u.reset(),a.clearCalls(),i.clearRequests();},l}function N(r,e){if(e.taskStatus)for(let[t,n]of Object.entries(e.taskStatus)){let o=r.getTaskState(t);if(!o)throw new Error(`Expected task "${t}" to exist, but it was not found`);if(o.status!==n)throw new Error(`Expected task "${t}" status to be "${n}", got "${o.status}"`)}if(e.agentStatus)for(let[t,n]of Object.entries(e.agentStatus)){let o=r.getAgentState(t);if(!o)throw new Error(`Expected agent "${t}" to exist, but it was not found`);if(o.status!==n)throw new Error(`Expected agent "${t}" status to be "${n}", got "${o.status}"`)}if(e.totalTokens){let{agentId:t,min:n,max:o}=e.totalTokens;if(t){let s=r.getAgentState(t);if(!s)throw new Error(`Expected agent "${t}" to exist, but it was not found`);if(n!==void 0&&s.totalTokens<n)throw new Error(`Expected agent "${t}" tokens to be at least ${n}, got ${s.totalTokens}`);if(o!==void 0&&s.totalTokens>o)throw new Error(`Expected agent "${t}" tokens to be at most ${o}, got ${s.totalTokens}`)}else {let s=r.getAllAgentStates(),a=Object.values(s).reduce((i,u)=>i+u.totalTokens,0);if(n!==void 0&&a<n)throw new Error(`Expected total tokens to be at least ${n}, got ${a}`);if(o!==void 0&&a>o)throw new Error(`Expected total tokens to be at most ${o}, got ${a}`)}}if(e.globalTokens){let{min:t,max:n}=e.globalTokens,o=r.totalTokens;if(t!==void 0&&o<t)throw new Error(`Expected global tokens to be at least ${t}, got ${o}`);if(n!==void 0&&o>n)throw new Error(`Expected global tokens to be at most ${n}, got ${o}`)}if(e.pendingHandoffs!==void 0){let t=r.getPendingHandoffs().length;if(t!==e.pendingHandoffs)throw new Error(`Expected ${e.pendingHandoffs} pending handoffs, got ${t}`)}}function y(r,e){return {run:async(t,n)=>{if(n.aborted)throw new Error("Task aborted");if(e?.delay&&e.delay>0&&await new Promise((o,s)=>{let a=setTimeout(o,e.delay);n.addEventListener("abort",()=>{clearTimeout(a),s(new Error("Task aborted"));},{once:true});}),e?.shouldError)throw new Error("Mock task error");return r},label:e?.label??"Mock Task",description:e?.description}}function P(r,e,t){return chunk7DPTXZZI_cjs.W(r,e??(o=>o.outputs),t)}function I(r,e){if(e.nodeStatuses)for(let[t,n]of Object.entries(e.nodeStatuses)){let o=r.statuses[t];if(o!==n)throw new Error(`Expected node "${t}" status to be "${n}", got "${o}"`)}if(e.completedNodes){for(let t of e.completedNodes)if(r.statuses[t]!=="completed")throw new Error(`Expected node "${t}" to be completed, got "${r.statuses[t]}"`)}if(e.skippedNodes){for(let t of e.skippedNodes)if(r.statuses[t]!=="skipped")throw new Error(`Expected node "${t}" to be skipped, got "${r.statuses[t]}"`)}if(e.errorNodes){for(let t of e.errorNodes)if(r.statuses[t]!=="error")throw new Error(`Expected node "${t}" to be error, got "${r.statuses[t]}"`)}if(e.outputContains)for(let[t,n]of Object.entries(e.outputContains)){let o=r.outputs[t];if(o!==n)throw new Error(`Expected node "${t}" output to be ${JSON.stringify(n)}, got ${JSON.stringify(o)}`)}}function B(r,e){let t=chunkWOFIBIPW_cjs.a({maxEvents:e?.maxEvents??500});if(r)for(let n of r)t.record({timestamp:Date.now(),snapshotId:null,agentId:"",...n});return t}function F(r,e){let t=r.getEvents();if(e.totalEvents!==void 0&&t.length!==e.totalEvents)throw new Error(`Expected ${e.totalEvents} timeline events, got ${t.length}`);if(e.minEvents!==void 0&&t.length<e.minEvents)throw new Error(`Expected at least ${e.minEvents} timeline events, got ${t.length}`);if(e.maxEvents!==void 0&&t.length>e.maxEvents)throw new Error(`Expected at most ${e.maxEvents} timeline events, got ${t.length}`);if(e.eventTypes){for(let n of e.eventTypes)if(!t.some(s=>s.type===n))throw new Error(`Expected timeline to contain event of type "${n}", but none found`)}if(e.agentEvents)for(let[n,o]of Object.entries(e.agentEvents)){let s=r.getEventsForAgent(n).length;if(s!==o)throw new Error(`Expected ${o} events for agent "${n}", got ${s}`)}if(e.hasType&&!t.some(o=>o.type===e.hasType))throw new Error(`Expected timeline to contain event of type "${e.hasType}"`);if(e.doesNotHaveType&&t.some(o=>o.type===e.doesNotHaveType))throw new Error(`Expected timeline NOT to contain event of type "${e.doesNotHaveType}"`)}function H(r,e){let t=0,n=e?.failAfter??0;return async(o,s,a)=>{if(t++,n>0&&t<=n)return {output:"success",messages:[],toolCalls:[],totalTokens:10};throw e?.delay&&e.delay>0&&await new Promise(i=>setTimeout(i,e.delay)),r??new Error("Runner failed")}}function L(r,e){if(r.length===0)throw new Error("Expected at least one reroute event, but none occurred");if(e.minReroutes!==void 0&&r.length<e.minReroutes)throw new Error(`Expected at least ${e.minReroutes} reroute events, got ${r.length}`);if(e.fromAgent&&!r.some(n=>n.originalAgent===e.fromAgent))throw new Error(`Expected reroute from agent "${e.fromAgent}", but no matching event found`);if(e.toAgent&&!r.some(n=>n.reroutedTo===e.toAgent))throw new Error(`Expected reroute to agent "${e.toAgent}", but no matching event found`);if(e.reason&&!r.some(n=>typeof e.reason=="string"?n.reason.includes(e.reason):e.reason.test(n.reason)))throw new Error(`Expected reroute reason matching ${e.reason}, but no matching event found`)}function J(r,e,t){let n=r.getMetrics(e);if(t.minScore!==void 0&&n.healthScore<t.minScore)throw new Error(`Expected agent "${e}" health score to be at least ${t.minScore}, got ${n.healthScore}`);if(t.maxScore!==void 0&&n.healthScore>t.maxScore)throw new Error(`Expected agent "${e}" health score to be at most ${t.maxScore}, got ${n.healthScore}`);if(t.circuitState!==void 0&&n.circuitState!==t.circuitState)throw new Error(`Expected agent "${e}" circuit state to be "${t.circuitState}", got "${n.circuitState}"`);if(t.minSuccessRate!==void 0&&n.successRate<t.minSuccessRate)throw new Error(`Expected agent "${e}" success rate to be at least ${t.minSuccessRate}, got ${n.successRate}`)}function U(r=100){let e=new chunk7DPTXZZI_cjs.y({maxCheckpoints:r}),t=[];return {inner:e,saved:t,getLatest:()=>t[t.length-1],async save(n){return t.push(n),e.save(n)},load:n=>e.load(n),list:()=>e.list(),delete:n=>e.delete(n),clear:()=>e.clear(),prune:()=>e.prune()}}function _(r,e){if(e.orchestratorType!==void 0&&r.orchestratorType!==e.orchestratorType)throw new Error(`Expected checkpoint orchestratorType "${e.orchestratorType}", got "${r.orchestratorType}"`);if(e.hasSystemExport===true&&(!r.systemExport||r.systemExport===""))throw new Error("Expected checkpoint to have non-empty systemExport, but it was empty");if(e.hasTimeline===true&&r.timelineExport===null)throw new Error("Expected checkpoint to have timeline export, but it was null");if(e.hasTimeline===false&&r.timelineExport!==null)throw new Error("Expected checkpoint to have no timeline export, but it was present");if(e.hasMemory===true&&r.memoryExport===null)throw new Error("Expected checkpoint to have memory export, but it was null");if(e.hasMemory===false&&r.memoryExport!==null)throw new Error("Expected checkpoint to have no memory export, but it was present");if(e.label!==void 0&&r.label!==e.label)throw new Error(`Expected checkpoint label "${e.label}", got "${r.label}"`)}function V(r={}){let e=[],t=null,n=false;return {handler:s=>{if(e.push(s),!n)throw new Error("[Directive] BreakpointSimulator: handler called but attachTo() was never called. Breakpoints will not be resolved. Call simulator.attachTo(orchestrator) after creation.");let a=r.autoResumeDelay??0,i=()=>{t&&(r.cancel?t.cancelBreakpoint(s.id,r.cancelReason):t.resumeBreakpoint(s.id,r.modifications));};a>0?setTimeout(i,a):queueMicrotask(i);},hits:e,attachTo:s=>{t=s,n=true;}}}function W(r,e){if(e.count!==void 0&&r.length!==e.count)throw new Error(`Expected ${e.count} breakpoint hits, got ${r.length}`);if(e.type&&!r.some(n=>n.type===e.type)){let n=r.map(o=>o.type).join(", ");throw new Error(`Expected breakpoint of type "${e.type}", found types: [${n}]`)}if(e.agentId&&!r.some(n=>n.agentId===e.agentId)){let n=r.map(o=>o.agentId).join(", ");throw new Error(`Expected breakpoint for agent "${e.agentId}", found agents: [${n}]`)}}function z(r,e){return {safeParse:t=>r(t)?{success:true,data:t}:{success:false,error:{message:"Validation failed"}},description:e}}async function K(r){let e=[];for await(let t of r)e.push(t);return e}function Q(r,e){if(e.minChunks!==void 0&&r.length<e.minChunks)throw new Error(`Expected at least ${e.minChunks} chunks, got ${r.length}`);if(e.agentIds){let t=new Set(r.map(n=>n.agentId));for(let n of e.agentIds)if(!t.has(n))throw new Error(`Expected chunks from agent "${n}", found agents: [${[...t].join(", ")}]`)}if(e.hasDone===true&&!r.some(n=>n.chunk.type==="done"))throw new Error("Expected at least one 'done' chunk, found none");if(e.hasErrors===true&&!r.some(n=>n.chunk.type==="error"))throw new Error("Expected at least one 'error' chunk, found none");if(e.hasErrors===false&&r.some(n=>n.chunk.type==="error"))throw new Error("Expected no 'error' chunks, but found some")}function X(r){let e=r?.passAfter??1,t=r?.feedback??"Needs improvement",n=r?.score,o=0;return (s,a)=>{o++;let i=o>=e;return {passed:i,feedback:i?void 0:t,score:n??(i?1:.5)}}}function Y(r,e){let t=r.getAll();for(let[n,o]of Object.entries(e)){let s=t[n];if(s!==o)throw new Error(`Expected scratchpad key "${n}" to be ${JSON.stringify(o)}, got ${JSON.stringify(s)}`)}}function Z(r,e){let t=r.derived;for(let[n,o]of Object.entries(e)){let s=t[n];if(typeof o=="object"&&o!==null){let a=i=>JSON.stringify(i,Object.keys(i).sort());if(a(s)!==a(o))throw new Error(`Expected derived value "${n}" to be ${JSON.stringify(o)}, got ${JSON.stringify(s)}`)}else if(s!==o)throw new Error(`Expected derived value "${n}" to be ${JSON.stringify(o)}, got ${JSON.stringify(s)}`)}}exports.assertAgentHealth=J;exports.assertBreakpointHit=W;exports.assertCheckpoint=_;exports.assertDagExecution=I;exports.assertDerivedValues=Z;exports.assertMultiAgentState=N;exports.assertMultiplexedStream=Q;exports.assertOrchestratorState=M;exports.assertRerouted=L;exports.assertScratchpadState=Y;exports.assertTimelineEvents=F;exports.collectMultiplexedStream=K;exports.createApprovalSimulator=R;exports.createBreakpointSimulator=V;exports.createConstraintRecorder=O;exports.createFailingRunner=H;exports.createMockAgentRunner=b;exports.createMockSchema=z;exports.createMockTask=y;exports.createTestCheckpointStore=U;exports.createTestDag=P;exports.createTestMultiAgentOrchestrator=D;exports.createTestOrchestrator=C;exports.createTestReflectionEvaluator=X;exports.createTestTimeline=B;exports.createTimeController=q;exports.testGuardrail=T;exports.testGuardrailBatch=x;//# sourceMappingURL=testing.cjs.map
1
+ 'use strict';var chunk2PG26JZU_cjs=require('./chunk-2PG26JZU.cjs'),chunk7EJN6TYX_cjs=require('./chunk-7EJN6TYX.cjs');require('./chunk-K64WKZ22.cjs');var chunkWOFIBIPW_cjs=require('./chunk-WOFIBIPW.cjs');require('./chunk-WCQK3JOR.cjs');function b(r={}){let{defaultResponse:e={output:"mock response",totalTokens:10},responses:t={},recordCalls:n=true,onRun:o}=r,s=[],a=new Map(Object.entries(t)),i=e;return {run:async(l,c,g)=>{o?.(l,c),n&&s.push({agent:l,input:c,options:g,timestamp:Date.now()});let d=a.get(l.name)??i;if(d.generate){let p=d.generate(c,l);d={...d,...p};}if(d.error)throw d.error;d.delay&&d.delay>0&&await new Promise(p=>setTimeout(p,d.delay));let f=d.messages??[];for(let p of f)g?.onMessage?.(p);let m=d.toolCalls??[];for(let p of m)g?.onToolCall?.(p);return {output:d.output,messages:f,toolCalls:m,totalTokens:d.totalTokens??10}},getCalls:()=>[...s],getCallsFor:l=>s.filter(c=>c.agent.name===l),clearCalls:()=>s.length=0,setResponse:(l,c)=>a.set(l,c),setDefaultResponse:l=>i=l}}async function T(r,e,t){let n={agentName:"test-agent",input:"",...e},o={agentName:e.agentName??"test-agent",input:e.input??"",facts:t?.facts??{},...t},s=Date.now(),a=await r(n,o),i=Date.now()-s;return {...a,duration:i,testedData:n,assertPassed(){if(!a.passed)throw new Error(`Expected guardrail to pass, but it failed: ${a.reason}`)},assertFailed(u){if(a.passed)throw new Error("Expected guardrail to fail, but it passed");if(u!==void 0){if(typeof u=="string"&&!a.reason?.includes(u))throw new Error(`Expected failure reason to include "${u}", got: ${a.reason}`);if(u instanceof RegExp&&!u.test(a.reason??""))throw new Error(`Expected failure reason to match ${u}, got: ${a.reason}`)}},assertTransformed(u){if(a.transformed===void 0)throw new Error("Expected guardrail to transform input, but no transformation occurred");if(u!==void 0&&a.transformed!==u)throw new Error(`Expected transformation to be ${JSON.stringify(u)}, got: ${JSON.stringify(a.transformed)}`)}}}async function x(r,e){let t=[],n=[];for(let o=0;o<e.length;o++){let s=e[o],a=await T(r,s.input,s.context);t.push(a),(a.passed?a.transformed!==void 0?"transform":"pass":"fail")!==s.expect&&n.push({index:o,expected:s.expect,actual:a});}return {results:t,allPassed:()=>n.length===0,failures:()=>n}}function R(r={}){let{autoApprove:e,autoReject:t,delay:n=0,recordRequests:o=true}=r,s=[],a=new Map,i=[];return {async handle(u){o&&s.push(u);for(let l=i.length-1;l>=0;l--){let c=i[l];c.predicate(u)&&(i.splice(l,1),c.resolve(u));}return n>0&&await new Promise(l=>setTimeout(l,n)),t&&t(u)?"rejected":e?.(u)?"approved":new Promise(l=>{a.set(u.id,{request:u,resolve:l});})},getRequests:()=>[...s],clearRequests:()=>s.length=0,approve(u){let l=a.get(u);l&&(l.resolve("approved"),a.delete(u));},reject(u,l){let c=a.get(u);if(c){c.resolve("rejected"),a.delete(u);let g=s.find(d=>d.id===u);g&&(g.rejectionReason=l);}},waitForRequest(u,l=5e3){let c=s.find(u);return c?Promise.resolve(c):new Promise((g,d)=>{let f={predicate:u,resolve:p=>{clearTimeout(m),g(p);}},m=setTimeout(()=>{let p=i.indexOf(f);p>=0&&i.splice(p,1),d(new Error("Timeout waiting for approval request"));},l);i.push(f);})}}}function C(r={}){let{mockResponses:e,defaultMockResponse:t,...n}=r,o=b({responses:e,defaultResponse:t}),s=R(),a=chunk2PG26JZU_cjs.a({...n,runner:o.run,onApprovalRequest:u=>{s.handle(u),n.onApprovalRequest?.(u);}}),i=Object.create(a);return i.mockRunner=o,i.approvalSimulator=s,i.getCalls=()=>o.getCalls(),i.getApprovalRequests=()=>s.getRequests(),i.resetAll=()=>{a.reset(),o.clearCalls(),s.clearRequests();},i}function O(){let r=[];return {plugin:{name:"constraint-recorder",onRequirementCreated(e){r.push({constraintId:e.constraintId,triggered:true,requirement:e.requirement,facts:e.facts,timestamp:Date.now()});}},getSnapshots:()=>[...r],clearSnapshots:()=>r.length=0}}function M(r,e){let t=r.facts;if(e.agentStatus!==void 0&&t.agent.status!==e.agentStatus)throw new Error(`Expected agent status to be "${e.agentStatus}", got "${t.agent.status}"`);if(e.tokenUsage!==void 0){let{min:n,max:o,exact:s}=e.tokenUsage;if(s!==void 0&&t.agent.tokenUsage!==s)throw new Error(`Expected token usage to be exactly ${s}, got ${t.agent.tokenUsage}`);if(n!==void 0&&t.agent.tokenUsage<n)throw new Error(`Expected token usage to be at least ${n}, got ${t.agent.tokenUsage}`);if(o!==void 0&&t.agent.tokenUsage>o)throw new Error(`Expected token usage to be at most ${o}, got ${t.agent.tokenUsage}`)}if(e.pendingApprovals!==void 0&&t.approval.pending.length!==e.pendingApprovals)throw new Error(`Expected ${e.pendingApprovals} pending approvals, got ${t.approval.pending.length}`);if(e.conversationLength!==void 0){let{min:n,max:o,exact:s}=e.conversationLength,a=t.conversation.length;if(s!==void 0&&a!==s)throw new Error(`Expected conversation length to be exactly ${s}, got ${a}`);if(n!==void 0&&a<n)throw new Error(`Expected conversation length to be at least ${n}, got ${a}`);if(o!==void 0&&a>o)throw new Error(`Expected conversation length to be at most ${o}, got ${a}`)}}function q(r=Date.now()){let e=r,t=r;return {now:()=>e,advance:n=>{e+=n;},set:n=>{e=n;},reset:()=>{e=t;}}}function D(r){let{mockResponses:e={},defaultMockResponse:t,mockTasks:n,...o}=r;if(n){let c=o.tasks??{};for(let[g,d]of Object.entries(n))c[g]||(c[g]=y(d.output,{delay:d.delay,shouldError:d.shouldError}));o.tasks=c;}let s={};for(let[c,g]of Object.entries(e)){let d=o.agents[c];d&&(s[d.agent.name]=g);}let a=b({responses:s,defaultResponse:t}),i=R(),u=chunk7EJN6TYX_cjs.ra({...o,runner:a.run,onApprovalRequest:c=>{i.handle(c),o.onApprovalRequest?.(c);}}),l=Object.create(u);return l.mockRunner=a,l.approvalSimulator=i,l.getCalls=()=>a.getCalls(),l.getApprovalRequests=()=>i.getRequests(),l.resetAll=()=>{u.reset(),a.clearCalls(),i.clearRequests();},l}function N(r,e){if(e.taskStatus)for(let[t,n]of Object.entries(e.taskStatus)){let o=r.getTaskState(t);if(!o)throw new Error(`Expected task "${t}" to exist, but it was not found`);if(o.status!==n)throw new Error(`Expected task "${t}" status to be "${n}", got "${o.status}"`)}if(e.agentStatus)for(let[t,n]of Object.entries(e.agentStatus)){let o=r.getAgentState(t);if(!o)throw new Error(`Expected agent "${t}" to exist, but it was not found`);if(o.status!==n)throw new Error(`Expected agent "${t}" status to be "${n}", got "${o.status}"`)}if(e.totalTokens){let{agentId:t,min:n,max:o}=e.totalTokens;if(t){let s=r.getAgentState(t);if(!s)throw new Error(`Expected agent "${t}" to exist, but it was not found`);if(n!==void 0&&s.totalTokens<n)throw new Error(`Expected agent "${t}" tokens to be at least ${n}, got ${s.totalTokens}`);if(o!==void 0&&s.totalTokens>o)throw new Error(`Expected agent "${t}" tokens to be at most ${o}, got ${s.totalTokens}`)}else {let s=r.getAllAgentStates(),a=Object.values(s).reduce((i,u)=>i+u.totalTokens,0);if(n!==void 0&&a<n)throw new Error(`Expected total tokens to be at least ${n}, got ${a}`);if(o!==void 0&&a>o)throw new Error(`Expected total tokens to be at most ${o}, got ${a}`)}}if(e.globalTokens){let{min:t,max:n}=e.globalTokens,o=r.totalTokens;if(t!==void 0&&o<t)throw new Error(`Expected global tokens to be at least ${t}, got ${o}`);if(n!==void 0&&o>n)throw new Error(`Expected global tokens to be at most ${n}, got ${o}`)}if(e.pendingHandoffs!==void 0){let t=r.getPendingHandoffs().length;if(t!==e.pendingHandoffs)throw new Error(`Expected ${e.pendingHandoffs} pending handoffs, got ${t}`)}}function y(r,e){return {run:async(t,n)=>{if(n.aborted)throw new Error("Task aborted");if(e?.delay&&e.delay>0&&await new Promise((o,s)=>{let a=setTimeout(o,e.delay);n.addEventListener("abort",()=>{clearTimeout(a),s(new Error("Task aborted"));},{once:true});}),e?.shouldError)throw new Error("Mock task error");return r},label:e?.label??"Mock Task",description:e?.description}}function P(r,e,t){return chunk7EJN6TYX_cjs.W(r,e??(o=>o.outputs),t)}function I(r,e){if(e.nodeStatuses)for(let[t,n]of Object.entries(e.nodeStatuses)){let o=r.statuses[t];if(o!==n)throw new Error(`Expected node "${t}" status to be "${n}", got "${o}"`)}if(e.completedNodes){for(let t of e.completedNodes)if(r.statuses[t]!=="completed")throw new Error(`Expected node "${t}" to be completed, got "${r.statuses[t]}"`)}if(e.skippedNodes){for(let t of e.skippedNodes)if(r.statuses[t]!=="skipped")throw new Error(`Expected node "${t}" to be skipped, got "${r.statuses[t]}"`)}if(e.errorNodes){for(let t of e.errorNodes)if(r.statuses[t]!=="error")throw new Error(`Expected node "${t}" to be error, got "${r.statuses[t]}"`)}if(e.outputContains)for(let[t,n]of Object.entries(e.outputContains)){let o=r.outputs[t];if(o!==n)throw new Error(`Expected node "${t}" output to be ${JSON.stringify(n)}, got ${JSON.stringify(o)}`)}}function B(r,e){let t=chunkWOFIBIPW_cjs.a({maxEvents:e?.maxEvents??500});if(r)for(let n of r)t.record({timestamp:Date.now(),snapshotId:null,agentId:"",...n});return t}function F(r,e){let t=r.getEvents();if(e.totalEvents!==void 0&&t.length!==e.totalEvents)throw new Error(`Expected ${e.totalEvents} timeline events, got ${t.length}`);if(e.minEvents!==void 0&&t.length<e.minEvents)throw new Error(`Expected at least ${e.minEvents} timeline events, got ${t.length}`);if(e.maxEvents!==void 0&&t.length>e.maxEvents)throw new Error(`Expected at most ${e.maxEvents} timeline events, got ${t.length}`);if(e.eventTypes){for(let n of e.eventTypes)if(!t.some(s=>s.type===n))throw new Error(`Expected timeline to contain event of type "${n}", but none found`)}if(e.agentEvents)for(let[n,o]of Object.entries(e.agentEvents)){let s=r.getEventsForAgent(n).length;if(s!==o)throw new Error(`Expected ${o} events for agent "${n}", got ${s}`)}if(e.hasType&&!t.some(o=>o.type===e.hasType))throw new Error(`Expected timeline to contain event of type "${e.hasType}"`);if(e.doesNotHaveType&&t.some(o=>o.type===e.doesNotHaveType))throw new Error(`Expected timeline NOT to contain event of type "${e.doesNotHaveType}"`)}function H(r,e){let t=0,n=e?.failAfter??0;return async(o,s,a)=>{if(t++,n>0&&t<=n)return {output:"success",messages:[],toolCalls:[],totalTokens:10};throw e?.delay&&e.delay>0&&await new Promise(i=>setTimeout(i,e.delay)),r??new Error("Runner failed")}}function L(r,e){if(r.length===0)throw new Error("Expected at least one reroute event, but none occurred");if(e.minReroutes!==void 0&&r.length<e.minReroutes)throw new Error(`Expected at least ${e.minReroutes} reroute events, got ${r.length}`);if(e.fromAgent&&!r.some(n=>n.originalAgent===e.fromAgent))throw new Error(`Expected reroute from agent "${e.fromAgent}", but no matching event found`);if(e.toAgent&&!r.some(n=>n.reroutedTo===e.toAgent))throw new Error(`Expected reroute to agent "${e.toAgent}", but no matching event found`);if(e.reason&&!r.some(n=>typeof e.reason=="string"?n.reason.includes(e.reason):e.reason.test(n.reason)))throw new Error(`Expected reroute reason matching ${e.reason}, but no matching event found`)}function J(r,e,t){let n=r.getMetrics(e);if(t.minScore!==void 0&&n.healthScore<t.minScore)throw new Error(`Expected agent "${e}" health score to be at least ${t.minScore}, got ${n.healthScore}`);if(t.maxScore!==void 0&&n.healthScore>t.maxScore)throw new Error(`Expected agent "${e}" health score to be at most ${t.maxScore}, got ${n.healthScore}`);if(t.circuitState!==void 0&&n.circuitState!==t.circuitState)throw new Error(`Expected agent "${e}" circuit state to be "${t.circuitState}", got "${n.circuitState}"`);if(t.minSuccessRate!==void 0&&n.successRate<t.minSuccessRate)throw new Error(`Expected agent "${e}" success rate to be at least ${t.minSuccessRate}, got ${n.successRate}`)}function U(r=100){let e=new chunk7EJN6TYX_cjs.y({maxCheckpoints:r}),t=[];return {inner:e,saved:t,getLatest:()=>t[t.length-1],async save(n){return t.push(n),e.save(n)},load:n=>e.load(n),list:()=>e.list(),delete:n=>e.delete(n),clear:()=>e.clear(),prune:()=>e.prune()}}function _(r,e){if(e.orchestratorType!==void 0&&r.orchestratorType!==e.orchestratorType)throw new Error(`Expected checkpoint orchestratorType "${e.orchestratorType}", got "${r.orchestratorType}"`);if(e.hasSystemExport===true&&(!r.systemExport||r.systemExport===""))throw new Error("Expected checkpoint to have non-empty systemExport, but it was empty");if(e.hasTimeline===true&&r.timelineExport===null)throw new Error("Expected checkpoint to have timeline export, but it was null");if(e.hasTimeline===false&&r.timelineExport!==null)throw new Error("Expected checkpoint to have no timeline export, but it was present");if(e.hasMemory===true&&r.memoryExport===null)throw new Error("Expected checkpoint to have memory export, but it was null");if(e.hasMemory===false&&r.memoryExport!==null)throw new Error("Expected checkpoint to have no memory export, but it was present");if(e.label!==void 0&&r.label!==e.label)throw new Error(`Expected checkpoint label "${e.label}", got "${r.label}"`)}function V(r={}){let e=[],t=null,n=false;return {handler:s=>{if(e.push(s),!n)throw new Error("[Directive] BreakpointSimulator: handler called but attachTo() was never called. Breakpoints will not be resolved. Call simulator.attachTo(orchestrator) after creation.");let a=r.autoResumeDelay??0,i=()=>{t&&(r.cancel?t.cancelBreakpoint(s.id,r.cancelReason):t.resumeBreakpoint(s.id,r.modifications));};a>0?setTimeout(i,a):queueMicrotask(i);},hits:e,attachTo:s=>{t=s,n=true;}}}function W(r,e){if(e.count!==void 0&&r.length!==e.count)throw new Error(`Expected ${e.count} breakpoint hits, got ${r.length}`);if(e.type&&!r.some(n=>n.type===e.type)){let n=r.map(o=>o.type).join(", ");throw new Error(`Expected breakpoint of type "${e.type}", found types: [${n}]`)}if(e.agentId&&!r.some(n=>n.agentId===e.agentId)){let n=r.map(o=>o.agentId).join(", ");throw new Error(`Expected breakpoint for agent "${e.agentId}", found agents: [${n}]`)}}function z(r,e){return {safeParse:t=>r(t)?{success:true,data:t}:{success:false,error:{message:"Validation failed"}},description:e}}async function K(r){let e=[];for await(let t of r)e.push(t);return e}function Q(r,e){if(e.minChunks!==void 0&&r.length<e.minChunks)throw new Error(`Expected at least ${e.minChunks} chunks, got ${r.length}`);if(e.agentIds){let t=new Set(r.map(n=>n.agentId));for(let n of e.agentIds)if(!t.has(n))throw new Error(`Expected chunks from agent "${n}", found agents: [${[...t].join(", ")}]`)}if(e.hasDone===true&&!r.some(n=>n.chunk.type==="done"))throw new Error("Expected at least one 'done' chunk, found none");if(e.hasErrors===true&&!r.some(n=>n.chunk.type==="error"))throw new Error("Expected at least one 'error' chunk, found none");if(e.hasErrors===false&&r.some(n=>n.chunk.type==="error"))throw new Error("Expected no 'error' chunks, but found some")}function X(r){let e=r?.passAfter??1,t=r?.feedback??"Needs improvement",n=r?.score,o=0;return (s,a)=>{o++;let i=o>=e;return {passed:i,feedback:i?void 0:t,score:n??(i?1:.5)}}}function Y(r,e){let t=r.getAll();for(let[n,o]of Object.entries(e)){let s=t[n];if(s!==o)throw new Error(`Expected scratchpad key "${n}" to be ${JSON.stringify(o)}, got ${JSON.stringify(s)}`)}}function Z(r,e){let t=r.derived;for(let[n,o]of Object.entries(e)){let s=t[n];if(typeof o=="object"&&o!==null){let a=i=>JSON.stringify(i,Object.keys(i).sort());if(a(s)!==a(o))throw new Error(`Expected derived value "${n}" to be ${JSON.stringify(o)}, got ${JSON.stringify(s)}`)}else if(s!==o)throw new Error(`Expected derived value "${n}" to be ${JSON.stringify(o)}, got ${JSON.stringify(s)}`)}}exports.assertAgentHealth=J;exports.assertBreakpointHit=W;exports.assertCheckpoint=_;exports.assertDagExecution=I;exports.assertDerivedValues=Z;exports.assertMultiAgentState=N;exports.assertMultiplexedStream=Q;exports.assertOrchestratorState=M;exports.assertRerouted=L;exports.assertScratchpadState=Y;exports.assertTimelineEvents=F;exports.collectMultiplexedStream=K;exports.createApprovalSimulator=R;exports.createBreakpointSimulator=V;exports.createConstraintRecorder=O;exports.createFailingRunner=H;exports.createMockAgentRunner=b;exports.createMockSchema=z;exports.createMockTask=y;exports.createTestCheckpointStore=U;exports.createTestDag=P;exports.createTestMultiAgentOrchestrator=D;exports.createTestOrchestrator=C;exports.createTestReflectionEvaluator=X;exports.createTestTimeline=B;exports.createTimeController=q;exports.testGuardrail=T;exports.testGuardrailBatch=x;//# sourceMappingURL=testing.cjs.map
2
2
  //# sourceMappingURL=testing.cjs.map
@@ -1,7 +1,7 @@
1
- import { M as MultiAgentOrchestrator, a as MultiAgentOrchestratorOptions, A as AgentOrchestrator, O as OrchestratorOptions, b as MultiplexedStreamChunk, T as TaskRegistration, R as ReflectionEvaluator } from './orchestrator-types-CbNE7Rjp.cjs';
2
- import { A as ApprovalRequest, B as BreakpointModifications, I as InputGuardrailData, O as OutputGuardrailData, M as Message, T as ToolCallGuardrailData, a as ToolCall, G as GuardrailResult, b as AgentLike, c as AgentRunner, R as RunOptions, d as BreakpointRequest, C as Checkpoint, D as DagExecutionContext, e as DagNodeStatus, f as RerouteEvent, S as Scratchpad, g as DebugEventType, h as CheckpointStore, i as InMemoryCheckpointStore, j as DagNode, k as DagPattern, l as DebugEvent, m as GuardrailFn, n as GuardrailContext } from './types-DJ09LjZX.cjs';
3
- import { D as DebugTimeline } from './debug-timeline-DpnRMnLU.cjs';
4
- import { H as HealthMonitor } from './health-monitor-C6xoXrQz.cjs';
1
+ import { M as MultiAgentOrchestrator, a as MultiAgentOrchestratorOptions, A as AgentOrchestrator, O as OrchestratorOptions, b as MultiplexedStreamChunk, T as TaskRegistration, R as ReflectionEvaluator } from './orchestrator-types-s0766dDB.cjs';
2
+ import { A as ApprovalRequest, B as BreakpointModifications, I as InputGuardrailData, O as OutputGuardrailData, M as Message, T as ToolCallGuardrailData, a as ToolCall, G as GuardrailResult, b as AgentLike, c as AgentRunner, R as RunOptions, d as BreakpointRequest, C as Checkpoint, D as DagExecutionContext, e as DagNodeStatus, f as RerouteEvent, S as Scratchpad, g as DebugEventType, h as CheckpointStore, i as InMemoryCheckpointStore, j as DagNode, k as DagPattern, l as DebugEvent, m as GuardrailFn, n as GuardrailContext } from './types-CUp1N0uU.cjs';
3
+ import { D as DebugTimeline } from './debug-timeline-Dn1lC_gK.cjs';
4
+ import { H as HealthMonitor } from './health-monitor-Cq5sDvid.cjs';
5
5
  import '@directive-run/core';
6
6
  import '@directive-run/core/plugins';
7
7
 
package/dist/testing.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { M as MultiAgentOrchestrator, a as MultiAgentOrchestratorOptions, A as AgentOrchestrator, O as OrchestratorOptions, b as MultiplexedStreamChunk, T as TaskRegistration, R as ReflectionEvaluator } from './orchestrator-types-ZK9lv5Sm.js';
2
- import { A as ApprovalRequest, B as BreakpointModifications, I as InputGuardrailData, O as OutputGuardrailData, M as Message, T as ToolCallGuardrailData, a as ToolCall, G as GuardrailResult, b as AgentLike, c as AgentRunner, R as RunOptions, d as BreakpointRequest, C as Checkpoint, D as DagExecutionContext, e as DagNodeStatus, f as RerouteEvent, S as Scratchpad, g as DebugEventType, h as CheckpointStore, i as InMemoryCheckpointStore, j as DagNode, k as DagPattern, l as DebugEvent, m as GuardrailFn, n as GuardrailContext } from './types-DJ09LjZX.js';
3
- import { D as DebugTimeline } from './debug-timeline-L13P-U2I.js';
4
- import { H as HealthMonitor } from './health-monitor-qL9RNMH3.js';
1
+ import { M as MultiAgentOrchestrator, a as MultiAgentOrchestratorOptions, A as AgentOrchestrator, O as OrchestratorOptions, b as MultiplexedStreamChunk, T as TaskRegistration, R as ReflectionEvaluator } from './orchestrator-types-C5D5JZUj.js';
2
+ import { A as ApprovalRequest, B as BreakpointModifications, I as InputGuardrailData, O as OutputGuardrailData, M as Message, T as ToolCallGuardrailData, a as ToolCall, G as GuardrailResult, b as AgentLike, c as AgentRunner, R as RunOptions, d as BreakpointRequest, C as Checkpoint, D as DagExecutionContext, e as DagNodeStatus, f as RerouteEvent, S as Scratchpad, g as DebugEventType, h as CheckpointStore, i as InMemoryCheckpointStore, j as DagNode, k as DagPattern, l as DebugEvent, m as GuardrailFn, n as GuardrailContext } from './types-CUp1N0uU.js';
3
+ import { D as DebugTimeline } from './debug-timeline-BGcPa0JO.js';
4
+ import { H as HealthMonitor } from './health-monitor-DtwmIJkb.js';
5
5
  import '@directive-run/core';
6
6
  import '@directive-run/core/plugins';
7
7