@directive-run/ai 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/anthropic.cjs +3 -2
- 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 +3 -2
- package/dist/anthropic.js.map +1 -1
- package/dist/gemini.cjs +3 -2
- 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 +3 -2
- package/dist/gemini.js.map +1 -1
- package/dist/index.cjs +40 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +655 -5
- package/dist/index.d.ts +655 -5
- package/dist/index.js +40 -40
- package/dist/index.js.map +1 -1
- package/dist/{multi-agent-orchestrator-CH-4Fqzg.d.ts → multi-agent-orchestrator-DfdbaV7w.d.cts} +2 -649
- package/dist/{multi-agent-orchestrator-CFOzWVNd.d.cts → multi-agent-orchestrator-kuAas1YW.d.ts} +2 -649
- package/dist/ollama.d.cts +1 -1
- package/dist/ollama.d.ts +1 -1
- package/dist/openai.cjs +3 -2
- 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 +3 -2
- package/dist/openai.js.map +1 -1
- package/dist/testing.cjs +15 -15
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +15 -15
- package/dist/testing.js.map +1 -1
- package/dist/{types-D5veI9su.d.cts → types-BM-6xZf_.d.cts} +1 -1
- package/dist/{types-D5veI9su.d.ts → types-BM-6xZf_.d.ts} +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { G as GuardrailFn, I as InputGuardrailData, O as OutputGuardrailData, S as SchemaValidator, T as ToolCallGuardrailData, A as AgentLike, M as Message, a as AdapterHooks, b as AgentRunner, c as ApprovalState, d as AgentState, R as
|
|
2
|
-
export {
|
|
3
|
-
import { E as ExecutionPattern,
|
|
4
|
-
export {
|
|
1
|
+
import { G as GuardrailFn, I as InputGuardrailData, O as OutputGuardrailData, S as SchemaValidator, T as ToolCallGuardrailData, A as AgentLike, M as Message, a as AdapterHooks, b as AgentRunner, c as ApprovalState, d as AgentState, e as AgentSelectionStrategy, D as DagNode, f as DagExecutionContext, g as DagPattern, h as GoalNode, R as RelaxationTier, i as GoalMetrics, P as PatternCheckpointConfig, j as GoalPattern, k as RunResult, l as OrchestratorConstraint, m as RunOptions, n as DebugEvent, B as BreakpointState, o as GoalResult } from './types-BM-6xZf_.cjs';
|
|
2
|
+
export { p as AgentCircuitBreakerConfig, q as AgentCompleteEvent, r as AgentErrorEvent, s as AgentHealthState, t as AgentRetryConfig, u as AgentRetryEvent, v as AgentStartEvent, w as ApprovalRequest, x as ApprovalRequestEvent, y as ApprovalResponseEvent, z as BreakpointConfig, C as BreakpointContext, E as BreakpointHitEvent, F as BreakpointModifications, H as BreakpointRequest, J as BreakpointResumedEvent, K as BreakpointState, L as BreakpointType, N as Checkpoint, Q as CheckpointContext, U as CheckpointDiff, V as CheckpointLocalState, W as CheckpointProgress, X as CheckpointRestoreEvent, Y as CheckpointSaveEvent, Z as CheckpointStore, _ as ConstraintEvaluateEvent, $ as CrossAgentDerivationFn, a0 as CrossAgentSnapshot, a1 as DagCheckpointState, a2 as DagNodeStatus, a3 as DagNodeUpdateEvent, a4 as DebateCheckpointState, a5 as DebateRoundEvent, a6 as DebugEventBase, a7 as DebugEventType, a8 as DerivationUpdateEvent, a9 as GoalCheckpointConfig, aa as GoalCheckpointState, ab as GoalStepMetrics, ac as GuardrailCheckEvent, ad as GuardrailContext, ae as GuardrailError, af as GuardrailErrorCode, ag as GuardrailResult, ah as GuardrailRetryConfig, ai as GuardrailsConfig, aj as HandoffCompleteEvent, ak as HandoffStartEvent, al as HealthMonitorConfig, am as InMemoryCheckpointStore, an as InMemoryCheckpointStoreOptions, ao as MAX_BREAKPOINT_HISTORY, ap as MultiAgentBreakpointType, aq as MultiAgentCheckpointLocalState, ar as MultiAgentLifecycleHooks, as as MultiAgentSelfHealingConfig, at as NamedGuardrail, au as OrchestratorDebugConfig, av as OrchestratorLifecycleHooks, aw as OrchestratorResolver, ax as OrchestratorResolverContext, ay as OrchestratorState, az as PatternCheckpointBase, aA as PatternCheckpointState, aB as PatternCompleteEvent, aC as PatternStartEvent, aD as RaceCancelledEvent, aE as RaceStartEvent, aF as RaceWinnerEvent, aG as ReflectCheckpointState, aH as ReflectionIterationEvent, aI as RejectedRequest, aJ as RelaxationContext, aK as RelaxationRecord, aL as RelaxationStrategy, aM as RerouteDebugEvent, aN as RerouteEvent, aO as ResolverCompleteEvent, aP as ResolverErrorEvent, aQ as ResolverStartEvent, aR as SchemaValidationResult, aS as Scratchpad, aT as ScratchpadUpdateEvent, aU as SelfHealingConfig, aV as SequentialCheckpointState, aW as SingleAgentCheckpointLocalState, aX as StreamingCallbackRunner, aY as SupervisorCheckpointState, aZ as TaskCompleteEvent, a_ as TaskErrorEvent, a$ as TaskProgressEvent, b0 as TaskStartEvent, b1 as TokenUsage, b2 as ToolCall, b3 as createBreakpointId, b4 as createCheckpointId, b5 as createInitialBreakpointState, b6 as isGuardrailError, b7 as matchBreakpoint, b8 as validateCheckpoint } from './types-BM-6xZf_.cjs';
|
|
3
|
+
import { P as ParallelPattern, R as RacePattern, a as ReflectionEvaluation, b as ReflectIterationRecord, c as ReflectPattern, S as SequentialPattern, d as SupervisorPattern, E as ExecutionPattern, D as DebatePattern, A as AgentRegistry, M as MultiAgentOrchestrator, e as RunAgentRequirement, f as DebateResult, g as AgentHealthMetrics, h as DebugTimeline, H as HealthMonitor } from './multi-agent-orchestrator-DfdbaV7w.cjs';
|
|
4
|
+
export { i as AgentMemory, j as AgentMemoryConfig, k as AgentOrchestrator, l as AgentRegistration, B as BackpressureStrategy, m as DebugTimelineListener, n as DebugTimelineOptions, o as DoneChunk, p as ErrorChunk, G as GuardrailTriggeredChunk, q as HandoffRequest, r as HandoffResult, s as HealthCircuitState, t as MemoryManageResult, u as MemoryState, v as MemoryStrategy, w as MemoryStrategyConfig, x as MemoryStrategyResult, y as MergedTaggedStreamResult, z as MessageChunk, C as MessageSummarizer, F as MultiAgentOrchestratorOptions, I as MultiAgentRunCallOptions, J as MultiAgentState, K as MultiplexedStreamChunk, L as MultiplexedStreamResult, O as OrchestratorOptions, N as OrchestratorStreamChunk, Q as OrchestratorStreamResult, T as ProgressChunk, U as RaceResult, V as RaceSuccessEntry, W as ReflectionConfig, X as ReflectionContext, Y as ReflectionEvaluator, Z as ReflectionExhaustedError, _ as RunCallOptions, $ as SafeParseResult, a0 as SafeParseable, a1 as Semaphore, a2 as StreamChunk, a3 as StreamRunOptions, a4 as StreamRunner, a5 as StreamingGuardrail, a6 as StreamingGuardrailResult, a7 as StreamingRunResult, a8 as StructuredOutputConfig, a9 as StructuredOutputError, aa as TaskContext, ab as TaskRegistration, ac as TokenChunk, ad as ToolEndChunk, ae as ToolStartChunk, af as adaptOutputGuardrail, ag as collectTokens, ah as combineStreamingGuardrails, ai as createAgentMemory, aj as createAgentOrchestrator, ak as createDebugTimeline, al as createDebugTimelinePlugin, am as createHealthMonitor, an as createHybridStrategy, ao as createKeyPointsSummarizer, ap as createLLMSummarizer, aq as createLengthStreamingGuardrail, ar as createMultiAgentOrchestrator, as as createPatternStreamingGuardrail, at as createSlidingWindowStrategy, au as createStreamingRunner, av as createTokenBasedStrategy, aw as createToxicityStreamingGuardrail, ax as createTruncationSummarizer, ay as diffCheckpoints, az as extractJsonFromOutput, aA as filterStream, aB as forkFromCheckpoint, aC as getCheckpointProgress, aD as getPatternStep, aE as mapStream, aF as mergeTaggedStreams, aG as tapStream, aH as withReflection, aI as withStructuredOutput } from './multi-agent-orchestrator-DfdbaV7w.cjs';
|
|
5
5
|
export { AggregatedMetric, AlertConfig, AlertEvent, CircuitBreaker, CircuitBreakerConfig, CircuitBreakerOpenError, CircuitBreakerStats, CircuitState, DashboardData, MetricDataPoint, MetricType, OTLPExporter, OTLPExporterConfig, ObservabilityConfig, ObservabilityInstance, TraceSpan, createAgentMetrics, createCircuitBreaker, createOTLPExporter, createObservability } from '@directive-run/core/plugins';
|
|
6
6
|
import { ModuleSchema, Plugin } from '@directive-run/core';
|
|
7
7
|
import { E as Embedding, a as EmbedderFn } from './semantic-cache-F0psCRuz.cjs';
|
|
@@ -367,6 +367,656 @@ type RunnerMiddleware = (runner: AgentRunner) => AgentRunner;
|
|
|
367
367
|
*/
|
|
368
368
|
declare function pipe(runner: AgentRunner, ...middlewares: RunnerMiddleware[]): AgentRunner;
|
|
369
369
|
|
|
370
|
+
/**
|
|
371
|
+
* Create a parallel execution pattern that runs handlers concurrently and merges results.
|
|
372
|
+
*
|
|
373
|
+
* @param handlers - Handler IDs (agents or tasks) to run concurrently.
|
|
374
|
+
* @param merge - Combine all handler results into a single output (array may be shorter than handlers when `minSuccess` is set).
|
|
375
|
+
* @param options - Optional `minSuccess` and `timeout` overrides.
|
|
376
|
+
* @returns A {@link ParallelPattern} configuration object.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```typescript
|
|
380
|
+
* const researchPattern = parallel(
|
|
381
|
+
* ['researcher', 'researcher', 'researcher'],
|
|
382
|
+
* (results) => results.map(r => r.output).join('\n'),
|
|
383
|
+
* );
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
declare function parallel<T>(handlers: string[], merge: (results: RunResult<unknown>[]) => T | Promise<T>, options?: {
|
|
387
|
+
minSuccess?: number;
|
|
388
|
+
timeout?: number;
|
|
389
|
+
}): ParallelPattern<T>;
|
|
390
|
+
/**
|
|
391
|
+
* Create a sequential execution pattern that pipes output from one handler to the next.
|
|
392
|
+
*
|
|
393
|
+
* @param handlers - Handler IDs (agents or tasks) to run in order, where each handler's output feeds as input to the next.
|
|
394
|
+
* @param options - Optional `transform`, `extract`, and `continueOnError` overrides.
|
|
395
|
+
* @returns A {@link SequentialPattern} configuration object.
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```typescript
|
|
399
|
+
* const writeReviewPattern = sequential(
|
|
400
|
+
* ['writer', 'reviewer'],
|
|
401
|
+
* { transform: (output) => `Review this: ${output}` },
|
|
402
|
+
* );
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
declare function sequential<T>(handlers: string[], options?: {
|
|
406
|
+
transform?: (output: unknown, handlerId: string, index: number) => string;
|
|
407
|
+
extract?: (output: unknown) => T;
|
|
408
|
+
continueOnError?: boolean;
|
|
409
|
+
}): SequentialPattern<T>;
|
|
410
|
+
/**
|
|
411
|
+
* Create a supervisor pattern where a coordinating agent delegates work to a pool of workers.
|
|
412
|
+
*
|
|
413
|
+
* The supervisor runs first, then dispatches tasks to workers based on its output.
|
|
414
|
+
* This repeats for up to `maxRounds` until the supervisor signals completion.
|
|
415
|
+
*
|
|
416
|
+
* @param supervisorAgent - Agent ID that coordinates the workers.
|
|
417
|
+
* @param workers - Agent IDs for the worker pool.
|
|
418
|
+
* @param options - Optional `maxRounds` and `extract` overrides.
|
|
419
|
+
* @returns A {@link SupervisorPattern} configuration object.
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const managedPattern = supervisor(
|
|
424
|
+
* 'manager',
|
|
425
|
+
* ['worker1', 'worker2'],
|
|
426
|
+
* { maxRounds: 3 },
|
|
427
|
+
* );
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
declare function supervisor<T>(supervisorAgent: string, workers: string[], options?: {
|
|
431
|
+
maxRounds?: number;
|
|
432
|
+
extract?: (supervisorOutput: unknown, workerResults: RunResult<unknown>[]) => T;
|
|
433
|
+
}): SupervisorPattern<T>;
|
|
434
|
+
/**
|
|
435
|
+
* Create a directed acyclic graph (DAG) execution pattern.
|
|
436
|
+
*
|
|
437
|
+
* Nodes run concurrently when their dependencies are satisfied. The runtime
|
|
438
|
+
* validates the graph is acyclic and that all dependency references are valid.
|
|
439
|
+
*
|
|
440
|
+
* @param nodes - Node definitions keyed by ID, each with a `handler` and optional `deps` array.
|
|
441
|
+
* @param merge - Combine DAG outputs into a single result (defaults to `context.outputs`).
|
|
442
|
+
* @param options - Optional `timeout`, `maxConcurrent`, and `onNodeError` strategy.
|
|
443
|
+
* @returns A {@link DagPattern} configuration object.
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```typescript
|
|
447
|
+
* const researchPipeline = dag(
|
|
448
|
+
* {
|
|
449
|
+
* fetch: { handler: 'fetcher' },
|
|
450
|
+
* analyze: { handler: 'analyzer', deps: ['fetch'] },
|
|
451
|
+
* summarize: { handler: 'summarizer', deps: ['analyze'] },
|
|
452
|
+
* },
|
|
453
|
+
* (context) => context.outputs.summarize,
|
|
454
|
+
* );
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
declare function dag<T = Record<string, unknown>>(nodes: Record<string, DagNode>, merge?: (context: DagExecutionContext) => T | Promise<T>, options?: {
|
|
458
|
+
/** Overall timeout in ms for the entire DAG. */
|
|
459
|
+
timeout?: number;
|
|
460
|
+
/** Max nodes running concurrently. Default: Infinity */
|
|
461
|
+
maxConcurrent?: number;
|
|
462
|
+
/**
|
|
463
|
+
* Error handling strategy.
|
|
464
|
+
* - `"fail"` — abort entire DAG on first node error (default)
|
|
465
|
+
* - `"skip-downstream"` — mark downstream nodes as skipped, other branches continue
|
|
466
|
+
* - `"continue"` — ignore errors, other branches continue
|
|
467
|
+
*/
|
|
468
|
+
onNodeError?: "fail" | "skip-downstream" | "continue";
|
|
469
|
+
}): DagPattern<T>;
|
|
470
|
+
/**
|
|
471
|
+
* Create a reflect pattern that iterates between a producer and evaluator until quality is met.
|
|
472
|
+
*
|
|
473
|
+
* The producer generates output, then the evaluator scores it. If the score
|
|
474
|
+
* is below the threshold, the producer retries with evaluator feedback,
|
|
475
|
+
* up to `maxIterations` times.
|
|
476
|
+
*
|
|
477
|
+
* @param handler - Producer handler ID (agent or task) that generates output.
|
|
478
|
+
* @param evaluator - Evaluator handler ID that judges quality and provides feedback.
|
|
479
|
+
* @param options - Optional iteration, parsing, signal, and threshold configuration.
|
|
480
|
+
* @returns A {@link ReflectPattern} configuration object.
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* ```typescript
|
|
484
|
+
* const reviewPattern = reflect('writer', 'reviewer', { maxIterations: 2 });
|
|
485
|
+
* ```
|
|
486
|
+
*/
|
|
487
|
+
declare function reflect<T>(handler: string, evaluator: string, options?: {
|
|
488
|
+
maxIterations?: number;
|
|
489
|
+
parseEvaluation?: (output: unknown) => ReflectionEvaluation;
|
|
490
|
+
buildRetryInput?: (input: string, feedback: string, iteration: number) => string;
|
|
491
|
+
extract?: (output: unknown) => T;
|
|
492
|
+
onExhausted?: "accept-last" | "accept-best" | "throw";
|
|
493
|
+
onIteration?: (record: ReflectIterationRecord) => void;
|
|
494
|
+
signal?: AbortSignal;
|
|
495
|
+
timeout?: number;
|
|
496
|
+
threshold?: number | ((iteration: number) => number);
|
|
497
|
+
}): ReflectPattern<T>;
|
|
498
|
+
/**
|
|
499
|
+
* Create a race pattern that runs handlers concurrently and returns the first successful result.
|
|
500
|
+
*
|
|
501
|
+
* All handlers start simultaneously. The first to complete successfully wins;
|
|
502
|
+
* remaining handlers are aborted. Use `minSuccess` to wait for N results before picking.
|
|
503
|
+
*
|
|
504
|
+
* @param handlers - Handler IDs (agents or tasks) to race concurrently.
|
|
505
|
+
* @param options - Optional `extract`, `timeout`, `minSuccess`, and `signal` overrides.
|
|
506
|
+
* @returns A {@link RacePattern} configuration object.
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* ```typescript
|
|
510
|
+
* const fastest = race(['fast-model', 'smart-model'], { timeout: 5000 });
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
declare function race<T>(handlers: string[], options?: {
|
|
514
|
+
extract?: (result: RunResult<unknown>) => T;
|
|
515
|
+
timeout?: number;
|
|
516
|
+
minSuccess?: number;
|
|
517
|
+
signal?: AbortSignal;
|
|
518
|
+
}): RacePattern<T>;
|
|
519
|
+
/**
|
|
520
|
+
* Create a goal-driven execution pattern where agents are selected and run
|
|
521
|
+
* until a goal condition is satisfied.
|
|
522
|
+
*
|
|
523
|
+
* Declare what each agent produces and requires. The runtime automatically
|
|
524
|
+
* infers the execution graph from dependency analysis and drives agents
|
|
525
|
+
* toward goal achievement, with optional satisfaction scoring and relaxation tiers.
|
|
526
|
+
*
|
|
527
|
+
* @param nodes - Goal node definitions keyed by ID, each declaring `produces`, `requires`, and a `handler`.
|
|
528
|
+
* @param when - Predicate that returns `true` when the goal is achieved.
|
|
529
|
+
* @param options - Optional `satisfaction`, `maxSteps`, `extract`, `timeout`, `selectionStrategy`, and `relaxation` config.
|
|
530
|
+
* @returns A {@link GoalPattern} configuration object.
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* ```typescript
|
|
534
|
+
* const pipeline = goal(
|
|
535
|
+
* {
|
|
536
|
+
* researcher: {
|
|
537
|
+
* handler: "researcher",
|
|
538
|
+
* produces: ["research.findings"],
|
|
539
|
+
* requires: ["research.topic"],
|
|
540
|
+
* extractOutput: (r) => ({ "research.findings": r.output }),
|
|
541
|
+
* },
|
|
542
|
+
* writer: {
|
|
543
|
+
* handler: "writer",
|
|
544
|
+
* produces: ["article.draft"],
|
|
545
|
+
* requires: ["research.findings"],
|
|
546
|
+
* extractOutput: (r) => ({ "article.draft": r.output }),
|
|
547
|
+
* },
|
|
548
|
+
* },
|
|
549
|
+
* (facts) => facts["article.draft"] != null,
|
|
550
|
+
* { maxSteps: 10, extract: (facts) => facts["article.draft"] },
|
|
551
|
+
* );
|
|
552
|
+
* ```
|
|
553
|
+
*/
|
|
554
|
+
declare function goal<T = Record<string, unknown>>(nodes: Record<string, GoalNode>, when: (facts: Record<string, unknown>) => boolean, options?: {
|
|
555
|
+
satisfaction?: (facts: Record<string, unknown>) => number;
|
|
556
|
+
maxSteps?: number;
|
|
557
|
+
extract?: (facts: Record<string, unknown>) => T;
|
|
558
|
+
timeout?: number;
|
|
559
|
+
signal?: AbortSignal;
|
|
560
|
+
selectionStrategy?: AgentSelectionStrategy;
|
|
561
|
+
relaxation?: RelaxationTier[];
|
|
562
|
+
onStep?: (step: number, facts: Record<string, unknown>, readyNodes: string[]) => void;
|
|
563
|
+
onStall?: (step: number, metrics: GoalMetrics) => void;
|
|
564
|
+
checkpoint?: PatternCheckpointConfig;
|
|
565
|
+
}): GoalPattern<T>;
|
|
566
|
+
/**
|
|
567
|
+
* Create a selection strategy that runs all ready agents concurrently.
|
|
568
|
+
*
|
|
569
|
+
* This is the default strategy for {@link goal} patterns.
|
|
570
|
+
*
|
|
571
|
+
* @returns An {@link AgentSelectionStrategy} that selects every ready agent.
|
|
572
|
+
*/
|
|
573
|
+
declare function allReadyStrategy(): AgentSelectionStrategy;
|
|
574
|
+
/**
|
|
575
|
+
* Create a selection strategy that picks agents with the highest historical impact.
|
|
576
|
+
*
|
|
577
|
+
* Sorts ready agents by average satisfaction delta (descending) and selects the top N.
|
|
578
|
+
*
|
|
579
|
+
* @param opts - Optional `topN` to limit how many agents are selected (default: 3).
|
|
580
|
+
* @returns An {@link AgentSelectionStrategy} that prioritizes high-impact agents.
|
|
581
|
+
*/
|
|
582
|
+
declare function highestImpactStrategy(opts?: {
|
|
583
|
+
topN?: number;
|
|
584
|
+
}): AgentSelectionStrategy;
|
|
585
|
+
/**
|
|
586
|
+
* Create a selection strategy that prefers agents with lower token cost per satisfaction delta.
|
|
587
|
+
*
|
|
588
|
+
* Agents without historical metrics are prioritized first (to gather data).
|
|
589
|
+
*
|
|
590
|
+
* @returns An {@link AgentSelectionStrategy} that optimizes for cost efficiency.
|
|
591
|
+
*/
|
|
592
|
+
declare function costEfficientStrategy(): AgentSelectionStrategy;
|
|
593
|
+
|
|
594
|
+
/** Serialized DAG node (functions stripped) */
|
|
595
|
+
interface SerializedDagNode {
|
|
596
|
+
handler: string;
|
|
597
|
+
agent?: string;
|
|
598
|
+
deps?: string[];
|
|
599
|
+
timeout?: number;
|
|
600
|
+
priority?: number;
|
|
601
|
+
}
|
|
602
|
+
/** JSON-safe representation of any execution pattern (all functions stripped) */
|
|
603
|
+
type SerializedPattern = {
|
|
604
|
+
type: "parallel";
|
|
605
|
+
handlers: string[];
|
|
606
|
+
minSuccess?: number;
|
|
607
|
+
timeout?: number;
|
|
608
|
+
} | {
|
|
609
|
+
type: "sequential";
|
|
610
|
+
handlers: string[];
|
|
611
|
+
continueOnError?: boolean;
|
|
612
|
+
} | {
|
|
613
|
+
type: "supervisor";
|
|
614
|
+
supervisor: string;
|
|
615
|
+
workers: string[];
|
|
616
|
+
maxRounds?: number;
|
|
617
|
+
} | {
|
|
618
|
+
type: "dag";
|
|
619
|
+
nodes: Record<string, SerializedDagNode>;
|
|
620
|
+
timeout?: number;
|
|
621
|
+
maxConcurrent?: number;
|
|
622
|
+
onNodeError?: "fail" | "skip-downstream" | "continue";
|
|
623
|
+
} | {
|
|
624
|
+
type: "reflect";
|
|
625
|
+
handler: string;
|
|
626
|
+
evaluator: string;
|
|
627
|
+
maxIterations?: number;
|
|
628
|
+
onExhausted?: "accept-last" | "accept-best" | "throw";
|
|
629
|
+
timeout?: number;
|
|
630
|
+
threshold?: number;
|
|
631
|
+
} | {
|
|
632
|
+
type: "race";
|
|
633
|
+
handlers: string[];
|
|
634
|
+
timeout?: number;
|
|
635
|
+
minSuccess?: number;
|
|
636
|
+
} | {
|
|
637
|
+
type: "debate";
|
|
638
|
+
handlers: string[];
|
|
639
|
+
evaluator: string;
|
|
640
|
+
maxRounds?: number;
|
|
641
|
+
timeout?: number;
|
|
642
|
+
} | {
|
|
643
|
+
type: "goal";
|
|
644
|
+
nodes: Record<string, SerializedGoalNode>;
|
|
645
|
+
maxSteps?: number;
|
|
646
|
+
timeout?: number;
|
|
647
|
+
};
|
|
648
|
+
/** Serialized goal node (functions stripped) */
|
|
649
|
+
interface SerializedGoalNode {
|
|
650
|
+
handler: string;
|
|
651
|
+
agent?: string;
|
|
652
|
+
produces: string[];
|
|
653
|
+
requires?: string[];
|
|
654
|
+
allowRerun?: boolean;
|
|
655
|
+
priority?: number;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Serialize an execution pattern to a JSON-safe object.
|
|
659
|
+
*
|
|
660
|
+
* @remarks
|
|
661
|
+
* Strips all function callbacks and runtime objects (AbortSignal) while
|
|
662
|
+
* preserving the topology -- which agents, in what structure, with what
|
|
663
|
+
* numeric/string/boolean options.
|
|
664
|
+
*
|
|
665
|
+
* Use this for visual editors, LLM-generated plans, persistence, or
|
|
666
|
+
* debugging. Restore with {@link patternFromJSON}.
|
|
667
|
+
*
|
|
668
|
+
* Function-form `threshold` on reflect patterns is not serializable and will be dropped.
|
|
669
|
+
* Re-supply it via `overrides` when calling {@link patternFromJSON}.
|
|
670
|
+
*
|
|
671
|
+
* @param pattern - The execution pattern to serialize.
|
|
672
|
+
* @returns A {@link SerializedPattern} safe for `JSON.stringify`.
|
|
673
|
+
*
|
|
674
|
+
* @example
|
|
675
|
+
* ```typescript
|
|
676
|
+
* const p = parallel(['a', 'b'], (r) => r);
|
|
677
|
+
* const json = patternToJSON(p);
|
|
678
|
+
* // { type: "parallel", handlers: ["a", "b"] }
|
|
679
|
+
* localStorage.setItem("plan", JSON.stringify(json));
|
|
680
|
+
* ```
|
|
681
|
+
*/
|
|
682
|
+
declare function patternToJSON(pattern: ExecutionPattern<unknown>): SerializedPattern;
|
|
683
|
+
/**
|
|
684
|
+
* Restore an execution pattern from its serialized JSON form.
|
|
685
|
+
*
|
|
686
|
+
* @remarks
|
|
687
|
+
* Returns the data structure with all function fields set to `undefined`.
|
|
688
|
+
* Supply callbacks via the optional `overrides` parameter to re-attach
|
|
689
|
+
* runtime behavior. Handles legacy field migrations (`agent` to `handler`,
|
|
690
|
+
* `agents` to `handlers`, `converge` to `goal`).
|
|
691
|
+
*
|
|
692
|
+
* @param json - The serialized pattern from {@link patternToJSON} or persisted storage.
|
|
693
|
+
* @param overrides - Optional partial pattern to re-attach function callbacks (e.g. `merge`, `extract`).
|
|
694
|
+
* @returns A fully typed {@link ExecutionPattern} ready for use with the imperative API.
|
|
695
|
+
* @throws If the pattern type is invalid or unknown.
|
|
696
|
+
*
|
|
697
|
+
* @example
|
|
698
|
+
* ```typescript
|
|
699
|
+
* const json = JSON.parse(localStorage.getItem("plan")!);
|
|
700
|
+
* const pattern = patternFromJSON<string[]>(json, {
|
|
701
|
+
* merge: (results) => results.map(r => r.output as string),
|
|
702
|
+
* });
|
|
703
|
+
* if (pattern.type === "parallel") {
|
|
704
|
+
* const result = await orchestrator.runParallel(pattern.handlers, input, pattern.merge);
|
|
705
|
+
* }
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
declare function patternFromJSON<T = unknown>(json: SerializedPattern, overrides?: Partial<ExecutionPattern<T>>): ExecutionPattern<T>;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Create a constraint that routes to a specific agent when a condition is met.
|
|
712
|
+
*
|
|
713
|
+
* @param when - Predicate that triggers the constraint (may be async).
|
|
714
|
+
* @param agent - Agent ID or function returning an agent ID to route to.
|
|
715
|
+
* @param input - Input string or function returning the input for the selected agent.
|
|
716
|
+
* @param priority - Optional constraint priority (higher = evaluated first).
|
|
717
|
+
* @returns An {@link OrchestratorConstraint} that emits a `RUN_AGENT` requirement.
|
|
718
|
+
*
|
|
719
|
+
* @example
|
|
720
|
+
* ```typescript
|
|
721
|
+
* const constraints = {
|
|
722
|
+
* routeToExpert: selectAgent(
|
|
723
|
+
* (facts) => facts.complexity > 0.8,
|
|
724
|
+
* 'expert',
|
|
725
|
+
* (facts) => facts.query,
|
|
726
|
+
* ),
|
|
727
|
+
* };
|
|
728
|
+
* ```
|
|
729
|
+
*/
|
|
730
|
+
declare function selectAgent(when: (facts: Record<string, unknown>) => boolean | Promise<boolean>, agent: string | ((facts: Record<string, unknown>) => string), input: string | ((facts: Record<string, unknown>) => string), priority?: number): OrchestratorConstraint<Record<string, unknown>>;
|
|
731
|
+
/**
|
|
732
|
+
* Create a `RUN_AGENT` requirement object for use in constraint `require()` functions.
|
|
733
|
+
*
|
|
734
|
+
* @param agent - The agent ID to run.
|
|
735
|
+
* @param input - The input string for the agent.
|
|
736
|
+
* @param context - Optional additional context passed to the agent runner.
|
|
737
|
+
* @returns A `RUN_AGENT` {@link RunAgentRequirement} object.
|
|
738
|
+
*
|
|
739
|
+
* @example
|
|
740
|
+
* ```typescript
|
|
741
|
+
* constraints: {
|
|
742
|
+
* needsResearch: {
|
|
743
|
+
* when: (facts) => facts.hasUnknowns,
|
|
744
|
+
* require: (facts) => runAgentRequirement('researcher', facts.query as string),
|
|
745
|
+
* },
|
|
746
|
+
* }
|
|
747
|
+
* ```
|
|
748
|
+
*/
|
|
749
|
+
declare function runAgentRequirement(agent: string, input: string, context?: Record<string, unknown>): RunAgentRequirement;
|
|
750
|
+
/**
|
|
751
|
+
* Merge run results by concatenating their outputs into a single string.
|
|
752
|
+
*
|
|
753
|
+
* @param results - Array of run results to concatenate.
|
|
754
|
+
* @param separator - String inserted between outputs (default: `"\n\n"`).
|
|
755
|
+
* @returns The concatenated output string.
|
|
756
|
+
*/
|
|
757
|
+
declare function concatResults(results: RunResult<unknown>[], separator?: string): string;
|
|
758
|
+
/**
|
|
759
|
+
* Pick the highest-scoring result from an array using a scoring function.
|
|
760
|
+
*
|
|
761
|
+
* @param results - Array of run results to compare.
|
|
762
|
+
* @param score - Function that assigns a numeric score to each result (higher wins).
|
|
763
|
+
* @returns The {@link RunResult} with the highest score.
|
|
764
|
+
* @throws If the results array is empty.
|
|
765
|
+
*/
|
|
766
|
+
declare function pickBestResult<T>(results: RunResult<T>[], score: (result: RunResult<T>) => number): RunResult<T>;
|
|
767
|
+
/**
|
|
768
|
+
* Extract the `output` value from each run result into an array.
|
|
769
|
+
*
|
|
770
|
+
* @param results - Array of run results to collect from.
|
|
771
|
+
* @returns An array of output values in the same order as the input results.
|
|
772
|
+
*/
|
|
773
|
+
declare function collectOutputs<T>(results: RunResult<T>[]): T[];
|
|
774
|
+
/**
|
|
775
|
+
* Sum the total token counts from an array of run results.
|
|
776
|
+
*
|
|
777
|
+
* @param results - Array of run results to aggregate.
|
|
778
|
+
* @returns The total number of tokens consumed across all results.
|
|
779
|
+
*/
|
|
780
|
+
declare function aggregateTokens(results: RunResult<unknown>[]): number;
|
|
781
|
+
/**
|
|
782
|
+
* Compose multiple execution patterns into a pipeline where each pattern's
|
|
783
|
+
* output feeds as input to the next.
|
|
784
|
+
*
|
|
785
|
+
* @remarks
|
|
786
|
+
* Between patterns, output is converted to a string input:
|
|
787
|
+
* - `string` output passes through directly
|
|
788
|
+
* - Objects are JSON-stringified
|
|
789
|
+
* - Optionally provide a `transform` to customize between steps
|
|
790
|
+
*
|
|
791
|
+
* @param patterns - One or more execution patterns to chain together.
|
|
792
|
+
* @returns An async function that runs the pipeline on a given orchestrator.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```typescript
|
|
796
|
+
* const workflow = composePatterns(
|
|
797
|
+
* parallel(['researcher', 'researcher'], concatResults),
|
|
798
|
+
* sequential(['writer', 'reviewer']),
|
|
799
|
+
* );
|
|
800
|
+
*
|
|
801
|
+
* const result = await workflow(orchestrator, 'Research topic X');
|
|
802
|
+
* ```
|
|
803
|
+
*/
|
|
804
|
+
declare function composePatterns(...patterns: ExecutionPattern[]): (orchestrator: MultiAgentOrchestrator, input: string) => Promise<unknown>;
|
|
805
|
+
/**
|
|
806
|
+
* Find agents in a registry that match all required capabilities.
|
|
807
|
+
*
|
|
808
|
+
* @param registry - The agent registry to search.
|
|
809
|
+
* @param requiredCapabilities - Capabilities that each matching agent must have.
|
|
810
|
+
* @returns An array of agent IDs whose `capabilities` include every required capability.
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* ```typescript
|
|
814
|
+
* const agents = {
|
|
815
|
+
* researcher: { agent: researchAgent, capabilities: ['search', 'summarize'] },
|
|
816
|
+
* coder: { agent: coderAgent, capabilities: ['code', 'debug'] },
|
|
817
|
+
* writer: { agent: writerAgent, capabilities: ['write', 'edit'] },
|
|
818
|
+
* };
|
|
819
|
+
*
|
|
820
|
+
* const matches = findAgentsByCapability(agents, ['search']);
|
|
821
|
+
* // Returns ['researcher']
|
|
822
|
+
* ```
|
|
823
|
+
*/
|
|
824
|
+
declare function findAgentsByCapability(registry: AgentRegistry, requiredCapabilities: string[]): string[];
|
|
825
|
+
/**
|
|
826
|
+
* Create a constraint that auto-routes to an agent based on required capabilities.
|
|
827
|
+
*
|
|
828
|
+
* When the condition fires, it finds agents matching the capabilities returned by
|
|
829
|
+
* `getCapabilities`, then emits a `RUN_AGENT` requirement for the best match.
|
|
830
|
+
*
|
|
831
|
+
* @param registry - The agent registry to search for matching capabilities.
|
|
832
|
+
* @param getCapabilities - Function that extracts required capabilities from facts.
|
|
833
|
+
* @param getInput - Function that extracts the input string from facts.
|
|
834
|
+
* @param options - Optional `priority` and custom `select` function.
|
|
835
|
+
* @returns An {@link OrchestratorConstraint} that routes to a capability-matched agent.
|
|
836
|
+
*
|
|
837
|
+
* @example
|
|
838
|
+
* ```typescript
|
|
839
|
+
* const routeByCapability = capabilityRoute(
|
|
840
|
+
* agents,
|
|
841
|
+
* (facts) => facts.requiredCapabilities as string[],
|
|
842
|
+
* (facts) => facts.query as string,
|
|
843
|
+
* );
|
|
844
|
+
* ```
|
|
845
|
+
*/
|
|
846
|
+
declare function capabilityRoute(registry: AgentRegistry, getCapabilities: (facts: Record<string, unknown>) => string[], getInput: (facts: Record<string, unknown>) => string, options?: {
|
|
847
|
+
priority?: number;
|
|
848
|
+
select?: (matches: string[], registry: AgentRegistry) => string;
|
|
849
|
+
}): OrchestratorConstraint<Record<string, unknown>>;
|
|
850
|
+
/**
|
|
851
|
+
* Options for spawnOnCondition.
|
|
852
|
+
*/
|
|
853
|
+
interface SpawnOnConditionOptions {
|
|
854
|
+
/** Priority for the constraint (higher = evaluated first) */
|
|
855
|
+
priority?: number;
|
|
856
|
+
/** Additional context passed to the agent */
|
|
857
|
+
context?: Record<string, unknown>;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Create a constraint that auto-runs a single agent when a condition is met.
|
|
861
|
+
*
|
|
862
|
+
* The orchestrator's built-in `RUN_AGENT` resolver handles execution --
|
|
863
|
+
* you only need to add this to your `constraints` config.
|
|
864
|
+
*
|
|
865
|
+
* @param config - Condition, agent ID, input builder, and optional priority/context.
|
|
866
|
+
* @returns An {@link OrchestratorConstraint} that emits a `RUN_AGENT` requirement.
|
|
867
|
+
*
|
|
868
|
+
* @example
|
|
869
|
+
* ```typescript
|
|
870
|
+
* const orchestrator = createMultiAgentOrchestrator({
|
|
871
|
+
* agents: { reviewer: { agent: reviewerAgent } },
|
|
872
|
+
* constraints: {
|
|
873
|
+
* autoReview: spawnOnCondition({
|
|
874
|
+
* when: (facts) => (facts.confidence as number) < 0.7,
|
|
875
|
+
* agent: 'reviewer',
|
|
876
|
+
* input: (facts) => `Review this: ${facts.lastOutput}`,
|
|
877
|
+
* }),
|
|
878
|
+
* },
|
|
879
|
+
* });
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
882
|
+
declare function spawnOnCondition(config: {
|
|
883
|
+
when: (facts: Record<string, unknown>) => boolean;
|
|
884
|
+
agent: string;
|
|
885
|
+
input: (facts: Record<string, unknown>) => string;
|
|
886
|
+
/** Priority for the constraint (higher = evaluated first) */
|
|
887
|
+
priority?: number;
|
|
888
|
+
/** Additional context passed to the agent */
|
|
889
|
+
context?: Record<string, unknown>;
|
|
890
|
+
options?: SpawnOnConditionOptions;
|
|
891
|
+
}): OrchestratorConstraint<Record<string, unknown>>;
|
|
892
|
+
/** Configuration for the debate() factory and runDebate() imperative API. @see DebatePattern */
|
|
893
|
+
type DebateConfig<T = unknown> = Omit<DebatePattern<T>, "type">;
|
|
894
|
+
/**
|
|
895
|
+
* Create a debate pattern where agents compete and an evaluator picks the best.
|
|
896
|
+
*
|
|
897
|
+
* @remarks
|
|
898
|
+
* Flow:
|
|
899
|
+
* 1. All agents produce proposals in parallel
|
|
900
|
+
* 2. Evaluator receives all proposals and picks a winner
|
|
901
|
+
* 3. Optionally repeat with evaluator feedback for refinement
|
|
902
|
+
*
|
|
903
|
+
* @param config - Debate configuration with `handlers`, `evaluator`, and optional settings.
|
|
904
|
+
* @returns A {@link DebatePattern} configuration object.
|
|
905
|
+
* @see {@link runDebate} for the imperative API
|
|
906
|
+
*
|
|
907
|
+
* @example
|
|
908
|
+
* ```typescript
|
|
909
|
+
* const orchestrator = createMultiAgentOrchestrator({
|
|
910
|
+
* agents: {
|
|
911
|
+
* optimist: { agent: optimistAgent },
|
|
912
|
+
* pessimist: { agent: pessimistAgent },
|
|
913
|
+
* judge: { agent: judgeAgent },
|
|
914
|
+
* },
|
|
915
|
+
* patterns: {
|
|
916
|
+
* debate: debate({
|
|
917
|
+
* handlers: ['optimist', 'pessimist'],
|
|
918
|
+
* evaluator: 'judge',
|
|
919
|
+
* maxRounds: 2,
|
|
920
|
+
* }),
|
|
921
|
+
* },
|
|
922
|
+
* });
|
|
923
|
+
*
|
|
924
|
+
* const result = await orchestrator.runPattern('debate', 'Should we invest in X?');
|
|
925
|
+
* ```
|
|
926
|
+
*/
|
|
927
|
+
declare function debate<T = unknown>(config: DebateConfig<T>): DebatePattern<T>;
|
|
928
|
+
/**
|
|
929
|
+
* Run a debate imperatively on an orchestrator without pattern registration.
|
|
930
|
+
*
|
|
931
|
+
* Delegates to `orchestrator.runDebate()` so that lifecycle hooks, debug timeline,
|
|
932
|
+
* and signal propagation all work correctly.
|
|
933
|
+
*
|
|
934
|
+
* @param orchestrator - The multi-agent orchestrator instance to run the debate on.
|
|
935
|
+
* @param config - Debate configuration with agents, evaluator, and optional settings.
|
|
936
|
+
* @param input - The initial input/prompt for the debate.
|
|
937
|
+
* @returns The winning agent's output, the winner ID, and all proposals from each round.
|
|
938
|
+
* @see {@link debate} for the declarative pattern API
|
|
939
|
+
*/
|
|
940
|
+
declare function runDebate<T>(orchestrator: MultiAgentOrchestrator, config: DebateConfig<T>, input: string): Promise<DebateResult<T>>;
|
|
941
|
+
/**
|
|
942
|
+
* Create a constraint that fires when a cross-agent derivation meets a condition.
|
|
943
|
+
*
|
|
944
|
+
* @remarks
|
|
945
|
+
* Wire this into the orchestrator's `derive` config and `constraints` config together.
|
|
946
|
+
* The constraint's `when()` reads the derivation value from the orchestrator's derived snapshot.
|
|
947
|
+
*
|
|
948
|
+
* @param derivationId - The ID of the cross-agent derivation to watch.
|
|
949
|
+
* @param condition - Predicate that receives the derivation value and returns `true` when the constraint should fire.
|
|
950
|
+
* @param action - Agent ID, input builder, and optional priority/context for the emitted requirement.
|
|
951
|
+
* @returns An {@link OrchestratorConstraint} that emits a `RUN_AGENT` requirement when the derivation condition is met.
|
|
952
|
+
*
|
|
953
|
+
* @example
|
|
954
|
+
* ```typescript
|
|
955
|
+
* const orchestrator = createMultiAgentOrchestrator({
|
|
956
|
+
* agents: { ... },
|
|
957
|
+
* derive: {
|
|
958
|
+
* totalCost: (snap) => snap.coordinator.globalTokens * 0.001,
|
|
959
|
+
* },
|
|
960
|
+
* constraints: {
|
|
961
|
+
* budgetAlert: derivedConstraint('totalCost', (cost) => cost > 5.0, {
|
|
962
|
+
* agent: 'budget-manager',
|
|
963
|
+
* input: (value) => `Budget exceeded: $${value}`,
|
|
964
|
+
* }),
|
|
965
|
+
* },
|
|
966
|
+
* });
|
|
967
|
+
* ```
|
|
968
|
+
*/
|
|
969
|
+
declare function derivedConstraint(derivationId: string, condition: (value: unknown) => boolean, action: {
|
|
970
|
+
agent: string;
|
|
971
|
+
input: (value: unknown) => string;
|
|
972
|
+
priority?: number;
|
|
973
|
+
context?: Record<string, unknown>;
|
|
974
|
+
}): OrchestratorConstraint<Record<string, unknown>>;
|
|
975
|
+
/** Configuration for spawnPool constraint-driven auto-scaling */
|
|
976
|
+
interface SpawnPoolConfig {
|
|
977
|
+
/** Agent ID to spawn (must be registered in the orchestrator) */
|
|
978
|
+
agent: string;
|
|
979
|
+
/** Build the input for each spawned agent. Receives current facts and spawn index (0-based). */
|
|
980
|
+
input: (facts: Record<string, unknown>, index: number) => string;
|
|
981
|
+
/** How many agents to spawn. Number or function of facts for dynamic scaling. */
|
|
982
|
+
count: number | ((facts: Record<string, unknown>) => number);
|
|
983
|
+
/** Priority for the constraint. @default undefined */
|
|
984
|
+
priority?: number;
|
|
985
|
+
/** Additional context passed to each spawned agent */
|
|
986
|
+
context?: Record<string, unknown>;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Create a constraint that spawns a pool of agent instances when a condition is met.
|
|
990
|
+
*
|
|
991
|
+
* @remarks
|
|
992
|
+
* Unlike {@link spawnOnCondition} (which spawns one agent), `spawnPool` can target N agents.
|
|
993
|
+
* However, only one requirement is emitted per constraint evaluation cycle -- the constraint
|
|
994
|
+
* re-fires on subsequent cycles as long as `when()` returns true, spawning one agent per cycle.
|
|
995
|
+
*
|
|
996
|
+
* @param when - Predicate that triggers the pool spawn.
|
|
997
|
+
* @param config - Pool configuration with agent ID, input builder, count, and optional priority/context.
|
|
998
|
+
* @returns An {@link OrchestratorConstraint} that emits `RUN_AGENT` requirements.
|
|
999
|
+
* @see {@link spawnOnCondition} for spawning a single agent
|
|
1000
|
+
*
|
|
1001
|
+
* @example
|
|
1002
|
+
* ```typescript
|
|
1003
|
+
* const orchestrator = createMultiAgentOrchestrator({
|
|
1004
|
+
* agents: { worker: { agent: workerAgent } },
|
|
1005
|
+
* constraints: {
|
|
1006
|
+
* scaleWorkers: spawnPool(
|
|
1007
|
+
* (facts) => (facts.pendingTasks as number) > 0,
|
|
1008
|
+
* {
|
|
1009
|
+
* agent: 'worker',
|
|
1010
|
+
* count: (facts) => Math.min(facts.pendingTasks as number, 5),
|
|
1011
|
+
* input: (facts, i) => `Process task ${i + 1}`,
|
|
1012
|
+
* },
|
|
1013
|
+
* ),
|
|
1014
|
+
* },
|
|
1015
|
+
* });
|
|
1016
|
+
* ```
|
|
1017
|
+
*/
|
|
1018
|
+
declare function spawnPool(when: (facts: Record<string, unknown>) => boolean, config: SpawnPoolConfig): OrchestratorConstraint<Record<string, unknown>>;
|
|
1019
|
+
|
|
370
1020
|
type MermaidDirection = "LR" | "TD" | "TB" | "RL" | "BT";
|
|
371
1021
|
interface MermaidNodeShapes {
|
|
372
1022
|
/** Shape for agent nodes. @default "square" */
|
|
@@ -4068,4 +4718,4 @@ interface OtelPlugin {
|
|
|
4068
4718
|
*/
|
|
4069
4719
|
declare function createOtelPlugin(config: OtelPluginConfig): OtelPlugin;
|
|
4070
4720
|
|
|
4071
|
-
export { type ANNIndex, type ANNSearchResult, AdapterHooks, AgentHealthMetrics, type AgentInfo, AgentLike, type AgentMessage, type AgentMessageType, type AgentNetwork, type AgentNetworkConfig, AgentRunner, AgentState, AllProvidersFailedError, ApprovalState, type AuditEventType, type AuditInstance, type AuditPluginConfig, type BatchQueue, type BatchQueueConfig, type BidirectionalStream, type BudgetConfig, type BudgetExceededDetails, BudgetExceededError, type BudgetRunner, type BudgetWindow, type ComplianceConfig, type ComplianceInstance, type ComplianceStorage, type ConnectDevToolsOptions, type ConstraintRouterConfig, type ConstraintRouterRunner, type CreateRunnerOptions, DEFAULT_INJECTION_PATTERNS, DebugEvent, DebugTimeline, type DelegationMessage, type DelegationResultMessage, type DevToolsClient, type DevToolsClientMessage, type DevToolsCompatibleOrchestrator, type DevToolsServer, type DevToolsServerConfig, type DevToolsServerMessage, type DevToolsSnapshot, type DevToolsTransport, EmbedderFn, Embedding, type EnhancedPIIGuardrailOptions, type EvalAgentSummary, type EvalAssertOptions, type EvalCase, type EvalCaseResult, type EvalContext, type EvalCostOptions, type EvalCriterion, type EvalCriterionFn, type EvalJudgeOptions, type EvalLatencyOptions, type EvalMatchOptions, type EvalOutputLengthOptions, type EvalResults, type EvalSafetyOptions, type EvalScore, type EvalSemanticOptions, type EvalStructureOptions, type EvalSuite, type EvalSuiteConfig, ExecutionPattern, type FallbackConfig, type GoalAgentDeclaration, type GoalDependencyEdge, type GoalDependencyGraph, type GoalExecutionPlan, type GoalExplanation, type GoalExplanationStep, type GoalPlanStep, GoalResult, type GoalValidationResult, GuardrailFn, HealthMonitor, type InformMessage, InputGuardrailData, type JSONFileStoreOptions, type MCPAdapter, type MCPAdapterConfig, type MCPApprovalRequest, type MCPCallToolRequirement, type MCPGetPromptRequirement, type MCPReadResourceRequirement, type MCPRequirement, type MCPResource, type MCPServerConfig, type MCPSyncResourcesRequirement, type MCPTool, type MCPToolConstraint, type MCPToolResult, type MermaidDirection, type MermaidNodeShapes, type MermaidOptions, Message, type MessageBus, type MessageBusConfig, type MessageFilter, type MessageHandler, type ModelRule, type ModelSelectionConfig, type OtelPlugin, type OtelPluginConfig, type OtelSpan, OtelStatusCode, type OtelTracer, OutputGuardrailData, type ParsedResponse, type PromptInjectionGuardrailOptions, type ProviderStats, type QueryMessage, type RAGChunk, type RAGEnrichOptions, type RAGEnricher, type RAGEnricherConfig, type RAGStorage, type RateLimitGuardrail, type RequestMessage, type ResponseMessage, type RetryConfig, RetryExhaustedError, type RoutingConstraint, type RoutingFacts, type RoutingProvider, RunOptions, RunResult, type RunnerMiddleware, type SSEEvent, type SSETransport, type SSETransportConfig, STRICT_INJECTION_PATTERNS, SchemaValidator, SerializedPattern, type SpanData, type StreamChannel, type StreamChannelConfig, type StreamChannelState, type Subscription, type TokenPricing, ToolCallGuardrailData, type TypedAgentMessage, type UpdateMessage, type VPTreeIndexConfig, type WsTransportConfig, byAgentName, byInputLength, byPattern, connectDevTools, convertToolsForLLM, createAgentAuditHandlers, createAgentNetwork, createAuditTrail, createBatchQueue, createBidirectionalStream, createBruteForceIndex, createCompliance, createConstraintRouter, createContentFilterGuardrail, createDelegator, createDevToolsServer, createEnhancedPIIGuardrail, createEvalSuite, createInMemoryComplianceStorage, createJSONFileStore, createLengthGuardrail, createMCPAdapter, createMessageBus, createModerationGuardrail, createOtelPlugin, createOutputPIIGuardrail, createOutputSchemaGuardrail, createOutputTypeGuardrail, createPIIGuardrail, createPromptInjectionGuardrail, createPubSub, createRAGEnricher, createRateLimitGuardrail, createResponder, createRunner, createSSETransport, createStreamChannel, createToolGuardrail, createUntrustedContentGuardrail, createVPTreeIndex, createWsTransport, detectPII, detectPromptInjection, estimateCost, evalAssert, evalCoherence, evalCost, evalFaithfulness, evalJudge, evalLatency, evalMatch, evalOutputLength, evalRelevance, evalSafety, evalStructure, explainGoal, getDependencyGraph, hasPendingApprovals, isAgentRunning, markUntrustedContent, mcpCallTool, mcpGetPrompt, mcpReadResource, mcpSyncResources, mergeStreams, parseHttpStatus, parseRetryAfter, patternToMermaid, pipe, pipeThrough, planGoal, redactPII, sanitizeInjection, validateBaseURL, validateGoal, withBudget, withFallback, withModelSelection, withRetry };
|
|
4721
|
+
export { type ANNIndex, type ANNSearchResult, AdapterHooks, AgentHealthMetrics, type AgentInfo, AgentLike, type AgentMessage, type AgentMessageType, type AgentNetwork, type AgentNetworkConfig, AgentRegistry, AgentRunner, AgentSelectionStrategy, AgentState, AllProvidersFailedError, ApprovalState, type AuditEventType, type AuditInstance, type AuditPluginConfig, type BatchQueue, type BatchQueueConfig, type BidirectionalStream, type BudgetConfig, type BudgetExceededDetails, BudgetExceededError, type BudgetRunner, type BudgetWindow, type ComplianceConfig, type ComplianceInstance, type ComplianceStorage, type ConnectDevToolsOptions, type ConstraintRouterConfig, type ConstraintRouterRunner, type CreateRunnerOptions, DEFAULT_INJECTION_PATTERNS, DagExecutionContext, DagNode, DagPattern, type DebateConfig, DebatePattern, DebateResult, DebugEvent, DebugTimeline, type DelegationMessage, type DelegationResultMessage, type DevToolsClient, type DevToolsClientMessage, type DevToolsCompatibleOrchestrator, type DevToolsServer, type DevToolsServerConfig, type DevToolsServerMessage, type DevToolsSnapshot, type DevToolsTransport, EmbedderFn, Embedding, type EnhancedPIIGuardrailOptions, type EvalAgentSummary, type EvalAssertOptions, type EvalCase, type EvalCaseResult, type EvalContext, type EvalCostOptions, type EvalCriterion, type EvalCriterionFn, type EvalJudgeOptions, type EvalLatencyOptions, type EvalMatchOptions, type EvalOutputLengthOptions, type EvalResults, type EvalSafetyOptions, type EvalScore, type EvalSemanticOptions, type EvalStructureOptions, type EvalSuite, type EvalSuiteConfig, ExecutionPattern, type FallbackConfig, type GoalAgentDeclaration, type GoalDependencyEdge, type GoalDependencyGraph, type GoalExecutionPlan, type GoalExplanation, type GoalExplanationStep, GoalMetrics, GoalNode, GoalPattern, type GoalPlanStep, GoalResult, type GoalValidationResult, GuardrailFn, HealthMonitor, type InformMessage, InputGuardrailData, type JSONFileStoreOptions, type MCPAdapter, type MCPAdapterConfig, type MCPApprovalRequest, type MCPCallToolRequirement, type MCPGetPromptRequirement, type MCPReadResourceRequirement, type MCPRequirement, type MCPResource, type MCPServerConfig, type MCPSyncResourcesRequirement, type MCPTool, type MCPToolConstraint, type MCPToolResult, type MermaidDirection, type MermaidNodeShapes, type MermaidOptions, Message, type MessageBus, type MessageBusConfig, type MessageFilter, type MessageHandler, type ModelRule, type ModelSelectionConfig, MultiAgentOrchestrator, OrchestratorConstraint, type OtelPlugin, type OtelPluginConfig, type OtelSpan, OtelStatusCode, type OtelTracer, OutputGuardrailData, ParallelPattern, type ParsedResponse, PatternCheckpointConfig, type PromptInjectionGuardrailOptions, type ProviderStats, type QueryMessage, type RAGChunk, type RAGEnrichOptions, type RAGEnricher, type RAGEnricherConfig, type RAGStorage, RacePattern, type RateLimitGuardrail, ReflectIterationRecord, ReflectPattern, ReflectionEvaluation, RelaxationTier, type RequestMessage, type ResponseMessage, type RetryConfig, RetryExhaustedError, type RoutingConstraint, type RoutingFacts, type RoutingProvider, RunAgentRequirement, RunOptions, RunResult, type RunnerMiddleware, type SSEEvent, type SSETransport, type SSETransportConfig, STRICT_INJECTION_PATTERNS, SchemaValidator, SequentialPattern, type SerializedDagNode, type SerializedGoalNode, type SerializedPattern, type SpanData, type SpawnOnConditionOptions, type SpawnPoolConfig, type StreamChannel, type StreamChannelConfig, type StreamChannelState, type Subscription, SupervisorPattern, type TokenPricing, ToolCallGuardrailData, type TypedAgentMessage, type UpdateMessage, type VPTreeIndexConfig, type WsTransportConfig, aggregateTokens, allReadyStrategy, byAgentName, byInputLength, byPattern, capabilityRoute, collectOutputs, composePatterns, concatResults, connectDevTools, convertToolsForLLM, costEfficientStrategy, createAgentAuditHandlers, createAgentNetwork, createAuditTrail, createBatchQueue, createBidirectionalStream, createBruteForceIndex, createCompliance, createConstraintRouter, createContentFilterGuardrail, createDelegator, createDevToolsServer, createEnhancedPIIGuardrail, createEvalSuite, createInMemoryComplianceStorage, createJSONFileStore, createLengthGuardrail, createMCPAdapter, createMessageBus, createModerationGuardrail, createOtelPlugin, createOutputPIIGuardrail, createOutputSchemaGuardrail, createOutputTypeGuardrail, createPIIGuardrail, createPromptInjectionGuardrail, createPubSub, createRAGEnricher, createRateLimitGuardrail, createResponder, createRunner, createSSETransport, createStreamChannel, createToolGuardrail, createUntrustedContentGuardrail, createVPTreeIndex, createWsTransport, dag, debate, derivedConstraint, detectPII, detectPromptInjection, estimateCost, evalAssert, evalCoherence, evalCost, evalFaithfulness, evalJudge, evalLatency, evalMatch, evalOutputLength, evalRelevance, evalSafety, evalStructure, explainGoal, findAgentsByCapability, getDependencyGraph, goal, hasPendingApprovals, highestImpactStrategy, isAgentRunning, markUntrustedContent, mcpCallTool, mcpGetPrompt, mcpReadResource, mcpSyncResources, mergeStreams, parallel, parseHttpStatus, parseRetryAfter, patternFromJSON, patternToJSON, patternToMermaid, pickBestResult, pipe, pipeThrough, planGoal, race, redactPII, reflect, runAgentRequirement, runDebate, sanitizeInjection, selectAgent, sequential, spawnOnCondition, spawnPool, supervisor, validateBaseURL, validateGoal, withBudget, withFallback, withModelSelection, withRetry };
|