@directive-run/ai 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/anthropic.cjs.map +1 -1
- package/dist/anthropic.d.cts +1 -1
- package/dist/anthropic.d.ts +1 -1
- package/dist/anthropic.js.map +1 -1
- package/dist/gemini.cjs.map +1 -1
- package/dist/gemini.d.cts +1 -1
- package/dist/gemini.d.ts +1 -1
- package/dist/gemini.js.map +1 -1
- package/dist/index.cjs +49 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +180 -30
- package/dist/index.d.ts +180 -30
- package/dist/index.js +49 -49
- package/dist/index.js.map +1 -1
- package/dist/{multi-agent-orchestrator-CxL8ycw_.d.cts → multi-agent-orchestrator-CFOzWVNd.d.cts} +434 -171
- package/dist/{multi-agent-orchestrator-uMp8bLfV.d.ts → multi-agent-orchestrator-CH-4Fqzg.d.ts} +434 -171
- package/dist/ollama.cjs.map +1 -1
- package/dist/ollama.d.cts +1 -1
- package/dist/ollama.d.ts +1 -1
- package/dist/ollama.js.map +1 -1
- package/dist/openai.cjs.map +1 -1
- package/dist/openai.d.cts +1 -1
- package/dist/openai.d.ts +1 -1
- package/dist/openai.js.map +1 -1
- package/dist/testing.cjs +24 -24
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +38 -7
- package/dist/testing.d.ts +38 -7
- package/dist/testing.js +24 -24
- package/dist/testing.js.map +1 -1
- package/dist/{types-Co4BzMiH.d.cts → types-D5veI9su.d.cts} +96 -13
- package/dist/{types-Co4BzMiH.d.ts → types-D5veI9su.d.ts} +96 -13
- package/package.json +2 -2
package/dist/testing.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { w as MultiAgentOrchestrator, x as MultiAgentOrchestratorOptions, c as AgentOrchestrator, O as OrchestratorOptions, H as HealthMonitor, C as MultiplexedStreamChunk, D as DebugTimeline, ah as TaskRegistration, X as ReflectionEvaluator } from './multi-agent-orchestrator-CFOzWVNd.cjs';
|
|
2
|
+
import { o as ApprovalRequest, u as BreakpointModifications, I as InputGuardrailData, O as OutputGuardrailData, M as Message, T as ToolCallGuardrailData, b2 as ToolCall, ad as GuardrailResult, A as AgentLike, b as AgentRunner, R as RunOptions, v as BreakpointRequest, C as Checkpoint, V as DagExecutionContext, X as DagNodeStatus, aN as RerouteEvent, aS as Scratchpad, a1 as DebugEventType, L as CheckpointStore, aj as InMemoryCheckpointStore, W as DagNode, Z as DagPattern, D as DebugEvent, G as GuardrailFn, aa as GuardrailContext } from './types-D5veI9su.cjs';
|
|
3
3
|
import '@directive-run/core';
|
|
4
4
|
import '@directive-run/core/plugins';
|
|
5
5
|
|
|
@@ -347,6 +347,12 @@ interface TestMultiAgentOrchestratorOptions extends Omit<MultiAgentOrchestratorO
|
|
|
347
347
|
mockResponses?: Record<string, MockAgentConfig>;
|
|
348
348
|
/** Default mock response for unmatched agents */
|
|
349
349
|
defaultMockResponse?: MockAgentConfig;
|
|
350
|
+
/** Mock tasks keyed by task ID — auto-generates TaskRegistration wrappers */
|
|
351
|
+
mockTasks?: Record<string, {
|
|
352
|
+
output: unknown;
|
|
353
|
+
delay?: number;
|
|
354
|
+
shouldError?: boolean;
|
|
355
|
+
}>;
|
|
350
356
|
}
|
|
351
357
|
/** Test multi-agent orchestrator with additional testing utilities */
|
|
352
358
|
interface TestMultiAgentOrchestrator extends MultiAgentOrchestrator {
|
|
@@ -397,6 +403,7 @@ declare function createTestMultiAgentOrchestrator(options: TestMultiAgentOrchest
|
|
|
397
403
|
*/
|
|
398
404
|
declare function assertMultiAgentState(orchestrator: MultiAgentOrchestrator, expected: {
|
|
399
405
|
agentStatus?: Record<string, "idle" | "running" | "completed" | "error">;
|
|
406
|
+
taskStatus?: Record<string, string>;
|
|
400
407
|
totalTokens?: {
|
|
401
408
|
agentId?: string;
|
|
402
409
|
min?: number;
|
|
@@ -408,6 +415,24 @@ declare function assertMultiAgentState(orchestrator: MultiAgentOrchestrator, exp
|
|
|
408
415
|
};
|
|
409
416
|
pendingHandoffs?: number;
|
|
410
417
|
}): void;
|
|
418
|
+
/**
|
|
419
|
+
* Create a mock TaskRegistration for testing.
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const task = createMockTask({ result: "processed" }, { delay: 100 });
|
|
424
|
+
* const orchestrator = createTestMultiAgentOrchestrator({
|
|
425
|
+
* agents: { writer: { agent: { name: "writer" } } },
|
|
426
|
+
* tasks: { process: task },
|
|
427
|
+
* });
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
declare function createMockTask(output: unknown, options?: {
|
|
431
|
+
delay?: number;
|
|
432
|
+
shouldError?: boolean;
|
|
433
|
+
label?: string;
|
|
434
|
+
description?: string;
|
|
435
|
+
}): TaskRegistration;
|
|
411
436
|
|
|
412
437
|
/**
|
|
413
438
|
* Create a test DAG pattern from a simplified node spec.
|
|
@@ -415,13 +440,13 @@ declare function assertMultiAgentState(orchestrator: MultiAgentOrchestrator, exp
|
|
|
415
440
|
* @example
|
|
416
441
|
* ```typescript
|
|
417
442
|
* const pattern = createTestDag({
|
|
418
|
-
* A: {
|
|
419
|
-
* B: {
|
|
420
|
-
* C: {
|
|
443
|
+
* A: { handler: "researcher" },
|
|
444
|
+
* B: { handler: "writer", deps: ["A"] },
|
|
445
|
+
* C: { handler: "reviewer", deps: ["B"] },
|
|
421
446
|
* });
|
|
422
447
|
* ```
|
|
423
448
|
*/
|
|
424
|
-
declare function createTestDag<T = unknown>(nodes: Record<string, Pick<DagNode, "
|
|
449
|
+
declare function createTestDag<T = unknown>(nodes: Record<string, Pick<DagNode, "handler" | "deps" | "when" | "transform" | "timeout" | "priority">>, merge?: (context: DagExecutionContext) => T | Promise<T>, options?: {
|
|
425
450
|
timeout?: number;
|
|
426
451
|
maxConcurrent?: number;
|
|
427
452
|
onNodeError?: "fail" | "skip-downstream" | "continue";
|
|
@@ -605,6 +630,12 @@ interface BreakpointCapable {
|
|
|
605
630
|
resumeBreakpoint(id: string, modifications?: BreakpointModifications): void;
|
|
606
631
|
cancelBreakpoint(id: string, reason?: string): void;
|
|
607
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Create a breakpoint simulator that auto-resolves breakpoints for testing.
|
|
635
|
+
*
|
|
636
|
+
* @param options - Simulator options including `autoResumeDelay` and `modifications`.
|
|
637
|
+
* @returns An object with `handler`, `hits`, and `attachTo` for test assertions.
|
|
638
|
+
*/
|
|
608
639
|
declare function createBreakpointSimulator(options?: BreakpointSimulatorOptions): {
|
|
609
640
|
handler: (request: BreakpointRequest) => void;
|
|
610
641
|
hits: BreakpointRequest[];
|
|
@@ -702,4 +733,4 @@ declare function assertScratchpadState(scratchpad: Scratchpad, expected: Record<
|
|
|
702
733
|
*/
|
|
703
734
|
declare function assertDerivedValues(orchestrator: MultiAgentOrchestrator, expected: Record<string, unknown>): void;
|
|
704
735
|
|
|
705
|
-
export { type ApprovalSimulator, type ApprovalSimulatorOptions, type BreakpointCapable, type BreakpointSimulatorOptions, type ConstraintSnapshot, type GuardrailTestInput, type GuardrailTestResult, type MockAgentConfig, type MockAgentRunner, type MockAgentRunnerOptions, type RecordedCall, type TestMultiAgentOrchestrator, type TestMultiAgentOrchestratorOptions, type TestOrchestrator, type TestOrchestratorOptions, assertAgentHealth, assertBreakpointHit, assertCheckpoint, assertDagExecution, assertDerivedValues, assertMultiAgentState, assertMultiplexedStream, assertOrchestratorState, assertRerouted, assertScratchpadState, assertTimelineEvents, collectMultiplexedStream, createApprovalSimulator, createBreakpointSimulator, createConstraintRecorder, createFailingRunner, createMockAgentRunner, createMockSchema, createTestCheckpointStore, createTestDag, createTestMultiAgentOrchestrator, createTestOrchestrator, createTestReflectionEvaluator, createTestTimeline, createTimeController, testGuardrail, testGuardrailBatch };
|
|
736
|
+
export { type ApprovalSimulator, type ApprovalSimulatorOptions, type BreakpointCapable, type BreakpointSimulatorOptions, type ConstraintSnapshot, type GuardrailTestInput, type GuardrailTestResult, type MockAgentConfig, type MockAgentRunner, type MockAgentRunnerOptions, type RecordedCall, type TestMultiAgentOrchestrator, type TestMultiAgentOrchestratorOptions, type TestOrchestrator, type TestOrchestratorOptions, assertAgentHealth, assertBreakpointHit, assertCheckpoint, assertDagExecution, assertDerivedValues, assertMultiAgentState, assertMultiplexedStream, assertOrchestratorState, assertRerouted, assertScratchpadState, assertTimelineEvents, collectMultiplexedStream, createApprovalSimulator, createBreakpointSimulator, createConstraintRecorder, createFailingRunner, createMockAgentRunner, createMockSchema, createMockTask, createTestCheckpointStore, createTestDag, createTestMultiAgentOrchestrator, createTestOrchestrator, createTestReflectionEvaluator, createTestTimeline, createTimeController, testGuardrail, testGuardrailBatch };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { w as MultiAgentOrchestrator, x as MultiAgentOrchestratorOptions, c as AgentOrchestrator, O as OrchestratorOptions, H as HealthMonitor, C as MultiplexedStreamChunk, D as DebugTimeline, ah as TaskRegistration, X as ReflectionEvaluator } from './multi-agent-orchestrator-CH-4Fqzg.js';
|
|
2
|
+
import { o as ApprovalRequest, u as BreakpointModifications, I as InputGuardrailData, O as OutputGuardrailData, M as Message, T as ToolCallGuardrailData, b2 as ToolCall, ad as GuardrailResult, A as AgentLike, b as AgentRunner, R as RunOptions, v as BreakpointRequest, C as Checkpoint, V as DagExecutionContext, X as DagNodeStatus, aN as RerouteEvent, aS as Scratchpad, a1 as DebugEventType, L as CheckpointStore, aj as InMemoryCheckpointStore, W as DagNode, Z as DagPattern, D as DebugEvent, G as GuardrailFn, aa as GuardrailContext } from './types-D5veI9su.js';
|
|
3
3
|
import '@directive-run/core';
|
|
4
4
|
import '@directive-run/core/plugins';
|
|
5
5
|
|
|
@@ -347,6 +347,12 @@ interface TestMultiAgentOrchestratorOptions extends Omit<MultiAgentOrchestratorO
|
|
|
347
347
|
mockResponses?: Record<string, MockAgentConfig>;
|
|
348
348
|
/** Default mock response for unmatched agents */
|
|
349
349
|
defaultMockResponse?: MockAgentConfig;
|
|
350
|
+
/** Mock tasks keyed by task ID — auto-generates TaskRegistration wrappers */
|
|
351
|
+
mockTasks?: Record<string, {
|
|
352
|
+
output: unknown;
|
|
353
|
+
delay?: number;
|
|
354
|
+
shouldError?: boolean;
|
|
355
|
+
}>;
|
|
350
356
|
}
|
|
351
357
|
/** Test multi-agent orchestrator with additional testing utilities */
|
|
352
358
|
interface TestMultiAgentOrchestrator extends MultiAgentOrchestrator {
|
|
@@ -397,6 +403,7 @@ declare function createTestMultiAgentOrchestrator(options: TestMultiAgentOrchest
|
|
|
397
403
|
*/
|
|
398
404
|
declare function assertMultiAgentState(orchestrator: MultiAgentOrchestrator, expected: {
|
|
399
405
|
agentStatus?: Record<string, "idle" | "running" | "completed" | "error">;
|
|
406
|
+
taskStatus?: Record<string, string>;
|
|
400
407
|
totalTokens?: {
|
|
401
408
|
agentId?: string;
|
|
402
409
|
min?: number;
|
|
@@ -408,6 +415,24 @@ declare function assertMultiAgentState(orchestrator: MultiAgentOrchestrator, exp
|
|
|
408
415
|
};
|
|
409
416
|
pendingHandoffs?: number;
|
|
410
417
|
}): void;
|
|
418
|
+
/**
|
|
419
|
+
* Create a mock TaskRegistration for testing.
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const task = createMockTask({ result: "processed" }, { delay: 100 });
|
|
424
|
+
* const orchestrator = createTestMultiAgentOrchestrator({
|
|
425
|
+
* agents: { writer: { agent: { name: "writer" } } },
|
|
426
|
+
* tasks: { process: task },
|
|
427
|
+
* });
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
declare function createMockTask(output: unknown, options?: {
|
|
431
|
+
delay?: number;
|
|
432
|
+
shouldError?: boolean;
|
|
433
|
+
label?: string;
|
|
434
|
+
description?: string;
|
|
435
|
+
}): TaskRegistration;
|
|
411
436
|
|
|
412
437
|
/**
|
|
413
438
|
* Create a test DAG pattern from a simplified node spec.
|
|
@@ -415,13 +440,13 @@ declare function assertMultiAgentState(orchestrator: MultiAgentOrchestrator, exp
|
|
|
415
440
|
* @example
|
|
416
441
|
* ```typescript
|
|
417
442
|
* const pattern = createTestDag({
|
|
418
|
-
* A: {
|
|
419
|
-
* B: {
|
|
420
|
-
* C: {
|
|
443
|
+
* A: { handler: "researcher" },
|
|
444
|
+
* B: { handler: "writer", deps: ["A"] },
|
|
445
|
+
* C: { handler: "reviewer", deps: ["B"] },
|
|
421
446
|
* });
|
|
422
447
|
* ```
|
|
423
448
|
*/
|
|
424
|
-
declare function createTestDag<T = unknown>(nodes: Record<string, Pick<DagNode, "
|
|
449
|
+
declare function createTestDag<T = unknown>(nodes: Record<string, Pick<DagNode, "handler" | "deps" | "when" | "transform" | "timeout" | "priority">>, merge?: (context: DagExecutionContext) => T | Promise<T>, options?: {
|
|
425
450
|
timeout?: number;
|
|
426
451
|
maxConcurrent?: number;
|
|
427
452
|
onNodeError?: "fail" | "skip-downstream" | "continue";
|
|
@@ -605,6 +630,12 @@ interface BreakpointCapable {
|
|
|
605
630
|
resumeBreakpoint(id: string, modifications?: BreakpointModifications): void;
|
|
606
631
|
cancelBreakpoint(id: string, reason?: string): void;
|
|
607
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Create a breakpoint simulator that auto-resolves breakpoints for testing.
|
|
635
|
+
*
|
|
636
|
+
* @param options - Simulator options including `autoResumeDelay` and `modifications`.
|
|
637
|
+
* @returns An object with `handler`, `hits`, and `attachTo` for test assertions.
|
|
638
|
+
*/
|
|
608
639
|
declare function createBreakpointSimulator(options?: BreakpointSimulatorOptions): {
|
|
609
640
|
handler: (request: BreakpointRequest) => void;
|
|
610
641
|
hits: BreakpointRequest[];
|
|
@@ -702,4 +733,4 @@ declare function assertScratchpadState(scratchpad: Scratchpad, expected: Record<
|
|
|
702
733
|
*/
|
|
703
734
|
declare function assertDerivedValues(orchestrator: MultiAgentOrchestrator, expected: Record<string, unknown>): void;
|
|
704
735
|
|
|
705
|
-
export { type ApprovalSimulator, type ApprovalSimulatorOptions, type BreakpointCapable, type BreakpointSimulatorOptions, type ConstraintSnapshot, type GuardrailTestInput, type GuardrailTestResult, type MockAgentConfig, type MockAgentRunner, type MockAgentRunnerOptions, type RecordedCall, type TestMultiAgentOrchestrator, type TestMultiAgentOrchestratorOptions, type TestOrchestrator, type TestOrchestratorOptions, assertAgentHealth, assertBreakpointHit, assertCheckpoint, assertDagExecution, assertDerivedValues, assertMultiAgentState, assertMultiplexedStream, assertOrchestratorState, assertRerouted, assertScratchpadState, assertTimelineEvents, collectMultiplexedStream, createApprovalSimulator, createBreakpointSimulator, createConstraintRecorder, createFailingRunner, createMockAgentRunner, createMockSchema, createTestCheckpointStore, createTestDag, createTestMultiAgentOrchestrator, createTestOrchestrator, createTestReflectionEvaluator, createTestTimeline, createTimeController, testGuardrail, testGuardrailBatch };
|
|
736
|
+
export { type ApprovalSimulator, type ApprovalSimulatorOptions, type BreakpointCapable, type BreakpointSimulatorOptions, type ConstraintSnapshot, type GuardrailTestInput, type GuardrailTestResult, type MockAgentConfig, type MockAgentRunner, type MockAgentRunnerOptions, type RecordedCall, type TestMultiAgentOrchestrator, type TestMultiAgentOrchestratorOptions, type TestOrchestrator, type TestOrchestratorOptions, assertAgentHealth, assertBreakpointHit, assertCheckpoint, assertDagExecution, assertDerivedValues, assertMultiAgentState, assertMultiplexedStream, assertOrchestratorState, assertRerouted, assertScratchpadState, assertTimelineEvents, collectMultiplexedStream, createApprovalSimulator, createBreakpointSimulator, createConstraintRecorder, createFailingRunner, createMockAgentRunner, createMockSchema, createMockTask, createTestCheckpointStore, createTestDag, createTestMultiAgentOrchestrator, createTestOrchestrator, createTestReflectionEvaluator, createTestTimeline, createTimeController, testGuardrail, testGuardrailBatch };
|