@warlock.js/ai 4.2.11 → 4.4.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/CHANGELOG.md +68 -1
- package/cjs/index.cjs +10155 -4626
- package/cjs/index.cjs.map +1 -1
- package/cjs/magic-string.es-BtxW4VqG.cjs +1015 -0
- package/cjs/magic-string.es-BtxW4VqG.cjs.map +1 -0
- package/cjs/matcher-logic-SBnzYohQ.cjs +217 -0
- package/cjs/matcher-logic-SBnzYohQ.cjs.map +1 -0
- package/cjs/matchers-BBh3gyB-.cjs +13739 -0
- package/cjs/matchers-BBh3gyB-.cjs.map +1 -0
- package/esm/agent/agent-config.type.d.mts +19 -6
- package/esm/agent/agent-config.type.d.mts.map +1 -1
- package/esm/agent/agent.d.mts.map +1 -1
- package/esm/agent/agent.mjs +17 -6
- package/esm/agent/agent.mjs.map +1 -1
- package/esm/agent/index.d.mts +2 -1
- package/esm/agent/index.mjs +1 -0
- package/esm/agent/spawn-sub-agent.d.mts +87 -0
- package/esm/agent/spawn-sub-agent.d.mts.map +1 -0
- package/esm/agent/spawn-sub-agent.mjs +68 -0
- package/esm/agent/spawn-sub-agent.mjs.map +1 -0
- package/esm/ai.d.mts +58 -3
- package/esm/ai.d.mts.map +1 -1
- package/esm/ai.mjs +58 -3
- package/esm/ai.mjs.map +1 -1
- package/esm/batch/batch.d.mts +43 -0
- package/esm/batch/batch.d.mts.map +1 -0
- package/esm/batch/batch.mjs +179 -0
- package/esm/batch/batch.mjs.map +1 -0
- package/esm/batch/batch.type.d.mts +144 -0
- package/esm/batch/batch.type.d.mts.map +1 -0
- package/esm/batch/index.mjs +3 -0
- package/esm/batch/run-batch-item.mjs +100 -0
- package/esm/batch/run-batch-item.mjs.map +1 -0
- package/esm/batch/run-with-concurrency.mjs +39 -0
- package/esm/batch/run-with-concurrency.mjs.map +1 -0
- package/esm/checkpoint/index.d.mts +3 -0
- package/esm/checkpoint/memory.d.mts +21 -0
- package/esm/checkpoint/memory.d.mts.map +1 -0
- package/esm/checkpoint/memory.mjs +0 -0
- package/esm/checkpoint/memory.mjs.map +1 -0
- package/esm/checkpoint/pg.d.mts +37 -0
- package/esm/checkpoint/pg.d.mts.map +1 -0
- package/esm/checkpoint/pg.mjs +265 -0
- package/esm/checkpoint/pg.mjs.map +1 -0
- package/esm/checkpoint/redis.d.mts +39 -0
- package/esm/checkpoint/redis.d.mts.map +1 -0
- package/esm/checkpoint/redis.mjs +200 -0
- package/esm/checkpoint/redis.mjs.map +1 -0
- package/esm/config.d.mts +61 -14
- package/esm/config.d.mts.map +1 -1
- package/esm/config.mjs +25 -6
- package/esm/config.mjs.map +1 -1
- package/esm/contracts/agent/agent.contract.d.mts +43 -0
- package/esm/contracts/agent/agent.contract.d.mts.map +1 -1
- package/esm/contracts/agent/eval.type.d.mts +143 -0
- package/esm/contracts/agent/eval.type.d.mts.map +1 -0
- package/esm/contracts/agent/index.d.mts +1 -0
- package/esm/contracts/events/supervisor-events.type.d.mts +3 -3
- package/esm/contracts/fallback-model.contract.d.mts +65 -0
- package/esm/contracts/fallback-model.contract.d.mts.map +1 -0
- package/esm/contracts/index.d.mts +32 -12
- package/esm/contracts/memory/index.d.mts +4 -0
- package/esm/contracts/memory/memory-config.type.d.mts +150 -0
- package/esm/contracts/memory/memory-config.type.d.mts.map +1 -0
- package/esm/contracts/memory/memory-item.type.d.mts +64 -0
- package/esm/contracts/memory/memory-item.type.d.mts.map +1 -0
- package/esm/contracts/memory/memory.contract.d.mts +87 -0
- package/esm/contracts/memory/memory.contract.d.mts.map +1 -0
- package/esm/contracts/memory/recall-options.type.d.mts +33 -0
- package/esm/contracts/memory/recall-options.type.d.mts.map +1 -0
- package/esm/contracts/middleware/index.d.mts +2 -2
- package/esm/contracts/middleware/middleware-context.type.d.mts +42 -2
- package/esm/contracts/middleware/middleware-context.type.d.mts.map +1 -1
- package/esm/contracts/middleware/middleware.contract.d.mts +46 -2
- package/esm/contracts/middleware/middleware.contract.d.mts.map +1 -1
- package/esm/contracts/model.contract.d.mts +63 -2
- package/esm/contracts/model.contract.d.mts.map +1 -1
- package/esm/contracts/orchestrator/checkpoint-store.contract.d.mts +91 -0
- package/esm/contracts/orchestrator/checkpoint-store.contract.d.mts.map +1 -0
- package/esm/contracts/orchestrator/index.d.mts +8 -0
- package/esm/contracts/orchestrator/orchestrator-commands.type.d.mts +43 -0
- package/esm/contracts/orchestrator/orchestrator-commands.type.d.mts.map +1 -0
- package/esm/contracts/orchestrator/orchestrator-config.type.d.mts +170 -0
- package/esm/contracts/orchestrator/orchestrator-config.type.d.mts.map +1 -0
- package/esm/contracts/orchestrator/orchestrator-event.type.d.mts +118 -0
- package/esm/contracts/orchestrator/orchestrator-event.type.d.mts.map +1 -0
- package/esm/contracts/orchestrator/orchestrator-execute-options.type.d.mts +44 -0
- package/esm/contracts/orchestrator/orchestrator-execute-options.type.d.mts.map +1 -0
- package/esm/contracts/orchestrator/orchestrator.contract.d.mts +129 -0
- package/esm/contracts/orchestrator/orchestrator.contract.d.mts.map +1 -0
- package/esm/contracts/orchestrator/session.contract.d.mts +26 -0
- package/esm/contracts/orchestrator/session.contract.d.mts.map +1 -0
- package/esm/contracts/orchestrator/snapshot-store.contract.d.mts +89 -0
- package/esm/contracts/orchestrator/snapshot-store.contract.d.mts.map +1 -0
- package/esm/contracts/planner/index.d.mts +6 -0
- package/esm/contracts/planner/planner-capability.type.d.mts +39 -0
- package/esm/contracts/planner/planner-capability.type.d.mts.map +1 -0
- package/esm/contracts/planner/planner-config.type.d.mts +78 -0
- package/esm/contracts/planner/planner-config.type.d.mts.map +1 -0
- package/esm/contracts/planner/planner-execute-options.type.d.mts +43 -0
- package/esm/contracts/planner/planner-execute-options.type.d.mts.map +1 -0
- package/esm/contracts/planner/planner-plan.type.d.mts +48 -0
- package/esm/contracts/planner/planner-plan.type.d.mts.map +1 -0
- package/esm/contracts/planner/planner-result.type.d.mts +88 -0
- package/esm/contracts/planner/planner-result.type.d.mts.map +1 -0
- package/esm/contracts/planner/planner.contract.d.mts +60 -0
- package/esm/contracts/planner/planner.contract.d.mts.map +1 -0
- package/esm/contracts/result/base-report.type.d.mts +7 -2
- package/esm/contracts/result/base-report.type.d.mts.map +1 -1
- package/esm/contracts/result/base-report.type.mjs.map +1 -1
- package/esm/contracts/result/index.d.mts +2 -1
- package/esm/contracts/result/model-pricing.type.d.mts +10 -0
- package/esm/contracts/result/model-pricing.type.d.mts.map +1 -1
- package/esm/contracts/result/orchestrator-result.type.d.mts +143 -0
- package/esm/contracts/result/orchestrator-result.type.d.mts.map +1 -0
- package/esm/contracts/result/session-send-result.type.d.mts +12 -3
- package/esm/contracts/result/session-send-result.type.d.mts.map +1 -1
- package/esm/contracts/result/supervisor-result.type.d.mts +2 -2
- package/esm/contracts/result/supervisor-result.type.d.mts.map +1 -1
- package/esm/contracts/result/tool-call.type.d.mts +2 -2
- package/esm/contracts/result/tool-call.type.d.mts.map +1 -1
- package/esm/contracts/result/usage.type.d.mts +24 -0
- package/esm/contracts/result/usage.type.d.mts.map +1 -1
- package/esm/contracts/result/workflow-result.type.d.mts +1 -1
- package/esm/contracts/result/workflow-result.type.d.mts.map +1 -1
- package/esm/contracts/sdk-adapter.contract.d.mts +1 -1
- package/esm/contracts/supervisor/dispatch-context.type.d.mts +3 -3
- package/esm/contracts/supervisor/evaluate-context.type.d.mts +1 -1
- package/esm/contracts/supervisor/index.d.mts +5 -5
- package/esm/contracts/supervisor/route-context.type.d.mts +2 -2
- package/esm/contracts/supervisor/supervisor-config.type.d.mts +55 -13
- package/esm/contracts/supervisor/supervisor-config.type.d.mts.map +1 -1
- package/esm/contracts/supervisor/supervisor-snapshot.type.d.mts +1 -1
- package/esm/contracts/supervisor/supervisor.contract.d.mts +9 -2
- package/esm/contracts/supervisor/supervisor.contract.d.mts.map +1 -1
- package/esm/contracts/workflow/index.d.mts +2 -2
- package/esm/contracts/workflow/workflow.contract.d.mts +28 -7
- package/esm/contracts/workflow/workflow.contract.d.mts.map +1 -1
- package/esm/errors/error-code.type.d.mts +1 -1
- package/esm/errors/index.d.mts +7 -0
- package/esm/errors/index.mjs +7 -0
- package/esm/errors/orchestrator-cancelled-error.d.mts +32 -0
- package/esm/errors/orchestrator-cancelled-error.d.mts.map +1 -0
- package/esm/errors/orchestrator-cancelled-error.mjs +31 -0
- package/esm/errors/orchestrator-cancelled-error.mjs.map +1 -0
- package/esm/errors/orchestrator-config-error.d.mts +26 -0
- package/esm/errors/orchestrator-config-error.d.mts.map +1 -0
- package/esm/errors/orchestrator-config-error.mjs +30 -0
- package/esm/errors/orchestrator-config-error.mjs.map +1 -0
- package/esm/errors/orchestrator-drift-error.d.mts +38 -0
- package/esm/errors/orchestrator-drift-error.d.mts.map +1 -0
- package/esm/errors/orchestrator-drift-error.mjs +37 -0
- package/esm/errors/orchestrator-drift-error.mjs.map +1 -0
- package/esm/errors/orchestrator-failed-error.d.mts +33 -0
- package/esm/errors/orchestrator-failed-error.d.mts.map +1 -0
- package/esm/errors/orchestrator-failed-error.mjs +36 -0
- package/esm/errors/orchestrator-failed-error.mjs.map +1 -0
- package/esm/errors/planner-cancelled-error.d.mts +33 -0
- package/esm/errors/planner-cancelled-error.d.mts.map +1 -0
- package/esm/errors/planner-cancelled-error.mjs +29 -0
- package/esm/errors/planner-cancelled-error.mjs.map +1 -0
- package/esm/errors/planner-failed-error.d.mts +40 -0
- package/esm/errors/planner-failed-error.d.mts.map +1 -0
- package/esm/errors/planner-failed-error.mjs +37 -0
- package/esm/errors/planner-failed-error.mjs.map +1 -0
- package/esm/errors/planner-plan-invalid-error.d.mts +21 -0
- package/esm/errors/planner-plan-invalid-error.d.mts.map +1 -0
- package/esm/errors/planner-plan-invalid-error.mjs +25 -0
- package/esm/errors/planner-plan-invalid-error.mjs.map +1 -0
- package/esm/eval/eval-runner.d.mts +17 -0
- package/esm/eval/eval-runner.d.mts.map +1 -0
- package/esm/eval/eval-runner.mjs +121 -0
- package/esm/eval/eval-runner.mjs.map +1 -0
- package/esm/eval/index.d.mts +29 -0
- package/esm/eval/index.d.mts.map +1 -0
- package/esm/eval/index.mjs +30 -0
- package/esm/eval/index.mjs.map +1 -0
- package/esm/eval/judge-scorer.d.mts +21 -0
- package/esm/eval/judge-scorer.d.mts.map +1 -0
- package/esm/eval/judge-scorer.mjs +87 -0
- package/esm/eval/judge-scorer.mjs.map +1 -0
- package/esm/eval/scorers.d.mts +50 -0
- package/esm/eval/scorers.d.mts.map +1 -0
- package/esm/eval/scorers.mjs +101 -0
- package/esm/eval/scorers.mjs.map +1 -0
- package/esm/index.d.mts +95 -30
- package/esm/index.mjs +66 -22
- package/esm/memory/derive-id.mjs +24 -0
- package/esm/memory/derive-id.mjs.map +1 -0
- package/esm/memory/episodic-memory.mjs +106 -0
- package/esm/memory/episodic-memory.mjs.map +1 -0
- package/esm/memory/index.d.mts +5 -0
- package/esm/memory/memory.d.mts +42 -0
- package/esm/memory/memory.d.mts.map +1 -0
- package/esm/memory/memory.mjs +166 -0
- package/esm/memory/memory.mjs.map +1 -0
- package/esm/memory/procedural-memory.mjs +103 -0
- package/esm/memory/procedural-memory.mjs.map +1 -0
- package/esm/memory/semantic-memory.mjs +80 -0
- package/esm/memory/semantic-memory.mjs.map +1 -0
- package/esm/memory/working-memory.mjs +62 -0
- package/esm/memory/working-memory.mjs.map +1 -0
- package/esm/middleware/builtins/budget-contract.type.d.mts +126 -0
- package/esm/middleware/builtins/budget-contract.type.d.mts.map +1 -0
- package/esm/middleware/builtins/budget.d.mts +71 -1
- package/esm/middleware/builtins/budget.d.mts.map +1 -1
- package/esm/middleware/builtins/budget.mjs +119 -4
- package/esm/middleware/builtins/budget.mjs.map +1 -1
- package/esm/middleware/builtins/semantic-cache.d.mts +1 -1
- package/esm/middleware/index.d.mts +2 -1
- package/esm/middleware/index.mjs +1 -1
- package/esm/middleware/pipeline.d.mts +9 -6
- package/esm/middleware/pipeline.d.mts.map +1 -1
- package/esm/middleware/pipeline.mjs.map +1 -1
- package/esm/mock/index.d.mts +1 -0
- package/esm/mock/index.mjs +1 -0
- package/esm/mock/mock-router.d.mts +63 -0
- package/esm/mock/mock-router.d.mts.map +1 -0
- package/esm/mock/mock-router.mjs +58 -0
- package/esm/mock/mock-router.mjs.map +1 -0
- package/esm/model/fallback-model.d.mts +45 -0
- package/esm/model/fallback-model.d.mts.map +1 -0
- package/esm/model/fallback-model.mjs +218 -0
- package/esm/model/fallback-model.mjs.map +1 -0
- package/esm/model/index.d.mts +2 -0
- package/esm/model/index.mjs +3 -0
- package/esm/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +78 -0
- package/esm/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +1 -0
- package/esm/node_modules/@vitest/expect/dist/index.mjs +1473 -0
- package/esm/node_modules/@vitest/expect/dist/index.mjs.map +1 -0
- package/esm/node_modules/@vitest/pretty-format/dist/index.mjs +888 -0
- package/esm/node_modules/@vitest/pretty-format/dist/index.mjs.map +1 -0
- package/esm/node_modules/@vitest/runner/dist/chunk-artifact.mjs +1533 -0
- package/esm/node_modules/@vitest/runner/dist/chunk-artifact.mjs.map +1 -0
- package/esm/node_modules/@vitest/runner/dist/index.mjs +3 -0
- package/esm/node_modules/@vitest/runner/dist/utils.mjs +3 -0
- package/esm/node_modules/@vitest/snapshot/dist/index.mjs +922 -0
- package/esm/node_modules/@vitest/snapshot/dist/index.mjs.map +1 -0
- package/esm/node_modules/@vitest/spy/dist/index.mjs +386 -0
- package/esm/node_modules/@vitest/spy/dist/index.mjs.map +1 -0
- package/esm/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs +82 -0
- package/esm/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs.map +1 -0
- package/esm/node_modules/@vitest/utils/dist/diff.mjs +1357 -0
- package/esm/node_modules/@vitest/utils/dist/diff.mjs.map +1 -0
- package/esm/node_modules/@vitest/utils/dist/display.mjs +559 -0
- package/esm/node_modules/@vitest/utils/dist/display.mjs.map +1 -0
- package/esm/node_modules/@vitest/utils/dist/error.mjs +38 -0
- package/esm/node_modules/@vitest/utils/dist/error.mjs.map +1 -0
- package/esm/node_modules/@vitest/utils/dist/helpers.mjs +181 -0
- package/esm/node_modules/@vitest/utils/dist/helpers.mjs.map +1 -0
- package/esm/node_modules/@vitest/utils/dist/offset.mjs +27 -0
- package/esm/node_modules/@vitest/utils/dist/offset.mjs.map +1 -0
- package/esm/node_modules/@vitest/utils/dist/serialize.mjs +77 -0
- package/esm/node_modules/@vitest/utils/dist/serialize.mjs.map +1 -0
- package/esm/node_modules/@vitest/utils/dist/source-map.mjs +374 -0
- package/esm/node_modules/@vitest/utils/dist/source-map.mjs.map +1 -0
- package/esm/node_modules/@vitest/utils/dist/timers.mjs +37 -0
- package/esm/node_modules/@vitest/utils/dist/timers.mjs.map +1 -0
- package/esm/node_modules/chai/index.mjs +2973 -0
- package/esm/node_modules/chai/index.mjs.map +1 -0
- package/esm/node_modules/magic-string/dist/magic-string.es.mjs +940 -0
- package/esm/node_modules/magic-string/dist/magic-string.es.mjs.map +1 -0
- package/esm/node_modules/tinyrainbow/dist/index.mjs +87 -0
- package/esm/node_modules/tinyrainbow/dist/index.mjs.map +1 -0
- package/esm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs +6 -0
- package/esm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs.map +1 -0
- package/esm/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs +52 -0
- package/esm/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs.map +1 -0
- package/esm/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs +2697 -0
- package/esm/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs.map +1 -0
- package/esm/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs +45 -0
- package/esm/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs.map +1 -0
- package/esm/orchestrator/as-tool.d.mts +42 -0
- package/esm/orchestrator/as-tool.d.mts.map +1 -0
- package/esm/orchestrator/as-tool.mjs +98 -0
- package/esm/orchestrator/as-tool.mjs.map +1 -0
- package/esm/orchestrator/checkpoint.mjs +75 -0
- package/esm/orchestrator/checkpoint.mjs.map +1 -0
- package/esm/orchestrator/commands.d.mts +38 -0
- package/esm/orchestrator/commands.d.mts.map +1 -0
- package/esm/orchestrator/commands.mjs +34 -0
- package/esm/orchestrator/commands.mjs.map +1 -0
- package/esm/orchestrator/compaction.mjs +206 -0
- package/esm/orchestrator/compaction.mjs.map +1 -0
- package/esm/orchestrator/dispatch.mjs +171 -0
- package/esm/orchestrator/dispatch.mjs.map +1 -0
- package/esm/orchestrator/emitter-port.type.d.mts +31 -0
- package/esm/orchestrator/emitter-port.type.d.mts.map +1 -0
- package/esm/orchestrator/emitter.d.mts +56 -0
- package/esm/orchestrator/emitter.d.mts.map +1 -0
- package/esm/orchestrator/emitter.mjs +85 -0
- package/esm/orchestrator/emitter.mjs.map +1 -0
- package/esm/orchestrator/engine-context.type.d.mts +56 -0
- package/esm/orchestrator/engine-context.type.d.mts.map +1 -0
- package/esm/orchestrator/execution.d.mts +116 -0
- package/esm/orchestrator/execution.d.mts.map +1 -0
- package/esm/orchestrator/execution.mjs +406 -0
- package/esm/orchestrator/execution.mjs.map +1 -0
- package/esm/orchestrator/index.d.mts +8 -0
- package/esm/orchestrator/index.mjs +10 -0
- package/esm/orchestrator/load.mjs +49 -0
- package/esm/orchestrator/load.mjs.map +1 -0
- package/esm/orchestrator/lock.mjs +75 -0
- package/esm/orchestrator/lock.mjs.map +1 -0
- package/esm/orchestrator/memory.d.mts +84 -0
- package/esm/orchestrator/memory.d.mts.map +1 -0
- package/esm/orchestrator/memory.mjs +141 -0
- package/esm/orchestrator/memory.mjs.map +1 -0
- package/esm/orchestrator/orchestrator-stream.d.mts +42 -0
- package/esm/orchestrator/orchestrator-stream.d.mts.map +1 -0
- package/esm/orchestrator/orchestrator-stream.mjs +98 -0
- package/esm/orchestrator/orchestrator-stream.mjs.map +1 -0
- package/esm/orchestrator/orchestrator.d.mts +38 -0
- package/esm/orchestrator/orchestrator.d.mts.map +1 -0
- package/esm/orchestrator/orchestrator.mjs +173 -0
- package/esm/orchestrator/orchestrator.mjs.map +1 -0
- package/esm/orchestrator/resume.mjs +74 -0
- package/esm/orchestrator/resume.mjs.map +1 -0
- package/esm/orchestrator/signature.d.mts +40 -0
- package/esm/orchestrator/signature.d.mts.map +1 -0
- package/esm/orchestrator/signature.mjs +120 -0
- package/esm/orchestrator/signature.mjs.map +1 -0
- package/esm/orchestrator/window.mjs +56 -0
- package/esm/orchestrator/window.mjs.map +1 -0
- package/esm/planner/index.d.mts +5 -0
- package/esm/planner/index.mjs +6 -0
- package/esm/planner/plan-prompt.d.mts +17 -0
- package/esm/planner/plan-prompt.d.mts.map +1 -0
- package/esm/planner/plan-prompt.mjs +30 -0
- package/esm/planner/plan-prompt.mjs.map +1 -0
- package/esm/planner/plan-schema.d.mts +27 -0
- package/esm/planner/plan-schema.d.mts.map +1 -0
- package/esm/planner/plan-schema.mjs +120 -0
- package/esm/planner/plan-schema.mjs.map +1 -0
- package/esm/planner/planner-run.d.mts +23 -0
- package/esm/planner/planner-run.d.mts.map +1 -0
- package/esm/planner/planner-run.mjs +344 -0
- package/esm/planner/planner-run.mjs.map +1 -0
- package/esm/planner/planner.d.mts +37 -0
- package/esm/planner/planner.d.mts.map +1 -0
- package/esm/planner/planner.mjs +120 -0
- package/esm/planner/planner.mjs.map +1 -0
- package/esm/planner/signature.d.mts +18 -0
- package/esm/planner/signature.d.mts.map +1 -0
- package/esm/planner/signature.mjs +27 -0
- package/esm/planner/signature.mjs.map +1 -0
- package/esm/snapshot/index.d.mts +3 -0
- package/esm/snapshot/memory.d.mts +26 -0
- package/esm/snapshot/memory.d.mts.map +1 -0
- package/esm/snapshot/memory.mjs +81 -0
- package/esm/snapshot/memory.mjs.map +1 -0
- package/esm/snapshot/pg.d.mts +41 -0
- package/esm/snapshot/pg.d.mts.map +1 -0
- package/esm/snapshot/pg.mjs +146 -0
- package/esm/snapshot/pg.mjs.map +1 -0
- package/esm/snapshot/redis.d.mts +42 -0
- package/esm/snapshot/redis.d.mts.map +1 -0
- package/esm/snapshot/redis.mjs +101 -0
- package/esm/snapshot/redis.mjs.map +1 -0
- package/esm/supervisor/as-tool.d.mts +0 -6
- package/esm/supervisor/as-tool.d.mts.map +1 -1
- package/esm/supervisor/as-tool.mjs +0 -6
- package/esm/supervisor/as-tool.mjs.map +1 -1
- package/esm/supervisor/execution.d.mts +43 -8
- package/esm/supervisor/execution.d.mts.map +1 -1
- package/esm/supervisor/execution.mjs +66 -16
- package/esm/supervisor/execution.mjs.map +1 -1
- package/esm/supervisor/fan-out.d.mts +65 -0
- package/esm/supervisor/fan-out.d.mts.map +1 -0
- package/esm/supervisor/fan-out.mjs +65 -0
- package/esm/supervisor/fan-out.mjs.map +1 -0
- package/esm/supervisor/index.d.mts +5 -3
- package/esm/supervisor/index.mjs +3 -1
- package/esm/supervisor/router-factory.d.mts +110 -0
- package/esm/supervisor/router-factory.d.mts.map +1 -0
- package/esm/supervisor/router-factory.mjs +141 -0
- package/esm/supervisor/router-factory.mjs.map +1 -0
- package/esm/supervisor/router-prompt.d.mts +1 -1
- package/esm/supervisor/snapshot.d.mts +4 -10
- package/esm/supervisor/snapshot.d.mts.map +1 -1
- package/esm/supervisor/snapshot.mjs +8 -16
- package/esm/supervisor/snapshot.mjs.map +1 -1
- package/esm/supervisor/supervisor.mjs +1 -0
- package/esm/supervisor/supervisor.mjs.map +1 -1
- package/esm/system-prompt/index.mjs +6 -0
- package/esm/system-prompt/system-prompt.d.mts +51 -3
- package/esm/system-prompt/system-prompt.d.mts.map +1 -1
- package/esm/system-prompt/system-prompt.mjs +52 -6
- package/esm/system-prompt/system-prompt.mjs.map +1 -1
- package/esm/testing/matcher-logic.d.mts +76 -0
- package/esm/testing/matcher-logic.d.mts.map +1 -0
- package/esm/testing/matcher-logic.mjs +144 -0
- package/esm/testing/matcher-logic.mjs.map +1 -0
- package/esm/testing/matchers.d.mts +48 -0
- package/esm/testing/matchers.d.mts.map +1 -0
- package/esm/testing/matchers.mjs +37 -0
- package/esm/testing/matchers.mjs.map +1 -0
- package/esm/testing/register-lazy.d.mts +20 -0
- package/esm/testing/register-lazy.d.mts.map +1 -0
- package/esm/testing/register-lazy.mjs +24 -0
- package/esm/testing/register-lazy.mjs.map +1 -0
- package/esm/tool/executable-as-tool.d.mts +87 -0
- package/esm/tool/executable-as-tool.d.mts.map +1 -0
- package/esm/tool/executable-as-tool.mjs +81 -0
- package/esm/tool/executable-as-tool.mjs.map +1 -0
- package/esm/tool/index.d.mts +2 -1
- package/esm/tool/index.mjs +1 -0
- package/esm/workflow/as-tool.mjs +0 -6
- package/esm/workflow/as-tool.mjs.map +1 -1
- package/esm/workflow/engine.mjs +2 -2
- package/esm/workflow/snapshot.mjs +13 -7
- package/esm/workflow/snapshot.mjs.map +1 -1
- package/esm/workflow/step-runner.mjs +1 -1
- package/esm/workflow/workflow.mjs +1 -0
- package/esm/workflow/workflow.mjs.map +1 -1
- package/llms-full.txt +947 -42
- package/llms.txt +13 -8
- package/package.json +3 -3
- package/skills/README.md +25 -5
- package/skills/ai-basics/SKILL.md +18 -7
- package/skills/ai-dx-helpers/SKILL.md +180 -0
- package/skills/attach-ai-middleware/SKILL.md +32 -3
- package/skills/handle-ai-errors/SKILL.md +20 -6
- package/skills/manage-ai-stores/SKILL.md +127 -0
- package/skills/persist-ai-data/SKILL.md +21 -10
- package/skills/pick-ai-provider/SKILL.md +46 -12
- package/skills/run-ai-agent/SKILL.md +51 -2
- package/skills/run-orchestrator/SKILL.md +198 -0
- package/skills/run-planner/SKILL.md +68 -0
- package/skills/run-supervisor/SKILL.md +47 -2
- package/skills/use-ai-memory/SKILL.md +124 -0
- package/skills/write-system-prompt/SKILL.md +14 -1
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { Message } from "../conversation-message.type.mjs";
|
|
2
2
|
import { AgentContract } from "../agent/agent.contract.mjs";
|
|
3
|
+
import { SupervisorInput } from "./supervisor-input.type.mjs";
|
|
4
|
+
import { SnapshotStore } from "../orchestrator/snapshot-store.contract.mjs";
|
|
5
|
+
import { AgentMiddleware } from "../middleware/middleware.contract.mjs";
|
|
3
6
|
import { SystemPromptContract } from "../system-prompt.contract.mjs";
|
|
4
|
-
import { Next } from "./next.type.mjs";
|
|
5
|
-
import { EvaluateContext, EvaluateResult } from "./evaluate-context.type.mjs";
|
|
6
7
|
import { RouteContext } from "./route-context.type.mjs";
|
|
7
8
|
import { AckConfig } from "./ack-entry.type.mjs";
|
|
8
9
|
import { SupervisorIntentValue } from "./intent-entry.type.mjs";
|
|
10
|
+
import { Next } from "./next.type.mjs";
|
|
9
11
|
import { RouterEntry } from "./router-entry.type.mjs";
|
|
10
12
|
import { ClassifierConfig } from "./classifier-context.type.mjs";
|
|
13
|
+
import { EvaluateContext, EvaluateResult } from "./evaluate-context.type.mjs";
|
|
11
14
|
import { SupervisorEventMap } from "../events/event-map.type.mjs";
|
|
12
15
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
13
|
-
import { CacheDriver } from "@warlock.js/cache";
|
|
14
16
|
|
|
15
17
|
//#region ../@warlock.js/ai/src/contracts/supervisor/supervisor-config.type.d.ts
|
|
16
18
|
/**
|
|
@@ -54,7 +56,7 @@ type SupervisorEventHandlers = Partial<{ [K in keyof SupervisorEventMap]: Superv
|
|
|
54
56
|
* ctx.state.response ? { satisfied: true } : undefined,
|
|
55
57
|
* maxIterations: 6,
|
|
56
58
|
* output: v.object({ response: v.string(), refund: v.boolean() }),
|
|
57
|
-
* snapshotStore:
|
|
59
|
+
* snapshotStore: ai.snapshot.redis({ client }),
|
|
58
60
|
* });
|
|
59
61
|
*/
|
|
60
62
|
type SupervisorConfig<TOutput = unknown, TState = TOutput, TIntents extends Record<string, SupervisorIntentValue> = Record<string, SupervisorIntentValue>, TArtifacts = Record<string, unknown>> = {
|
|
@@ -68,6 +70,18 @@ type SupervisorConfig<TOutput = unknown, TState = TOutput, TIntents extends Reco
|
|
|
68
70
|
* independent.
|
|
69
71
|
*/
|
|
70
72
|
version?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Opt-in Standard Schema describing this supervisor's input. Purely
|
|
75
|
+
* additive — when set, the supervisor can be dropped straight into an
|
|
76
|
+
* agent's `tools: []` array WITHOUT calling `.asTool()`: the runtime
|
|
77
|
+
* derives the LLM tool manifest from `name` + the resolved
|
|
78
|
+
* description + this schema and dispatches through `execute()`. Omit
|
|
79
|
+
* it and `.asTool()` (which takes its own `inputSchema`) remains the
|
|
80
|
+
* way to expose the supervisor as a tool. Not enforced by the
|
|
81
|
+
* supervisor runtime itself — `execute()` still accepts the raw
|
|
82
|
+
* `SupervisorInput` union.
|
|
83
|
+
*/
|
|
84
|
+
inputSchema?: StandardSchemaV1<SupervisorInput>;
|
|
71
85
|
/**
|
|
72
86
|
* Prepended to the router agent's own system prompt (router mode
|
|
73
87
|
* only). Does not touch child agents' system prompts — they stay
|
|
@@ -205,17 +219,18 @@ type SupervisorConfig<TOutput = unknown, TState = TOutput, TIntents extends Reco
|
|
|
205
219
|
*/
|
|
206
220
|
output?: StandardSchemaV1<TOutput>;
|
|
207
221
|
/**
|
|
208
|
-
* Optional durable
|
|
209
|
-
* Snapshots are written after every
|
|
210
|
-
* more at final completion / cancel /
|
|
211
|
-
*
|
|
212
|
-
* `
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
222
|
+
* Optional durable {@link SnapshotStore} enabling
|
|
223
|
+
* `supervisor.resume(runId)`. Snapshots are written after every
|
|
224
|
+
* iteration settles plus once more at final completion / cancel /
|
|
225
|
+
* fail. Construct with `ai.snapshot.{memory,pg,redis}()` —
|
|
226
|
+
* `ai.snapshot.memory()` for dev/tests, `ai.snapshot.redis()` /
|
|
227
|
+
* `ai.snapshot.pg()` for production.
|
|
228
|
+
*
|
|
229
|
+
* Falls back to `ai.config({ defaultSnapshotStore })` when omitted.
|
|
230
|
+
* When neither is set, `resume()` throws and snapshot writes silently
|
|
216
231
|
* skip (current behavior preserved).
|
|
217
232
|
*/
|
|
218
|
-
snapshotStore?:
|
|
233
|
+
snapshotStore?: SnapshotStore;
|
|
219
234
|
/**
|
|
220
235
|
* Definition-level event handlers — tier 1 of the 3-tier model.
|
|
221
236
|
* Fire on every run of this supervisor, before instance and
|
|
@@ -327,6 +342,33 @@ type SupervisorConfig<TOutput = unknown, TState = TOutput, TIntents extends Reco
|
|
|
327
342
|
* }),
|
|
328
343
|
*/
|
|
329
344
|
artifactsSchema?: StandardSchemaV1<TArtifacts>;
|
|
345
|
+
/**
|
|
346
|
+
* Supervisor-level middleware — fires the optional `supervisor` hook
|
|
347
|
+
* map (`before` / `after` / `onError`) of each `AgentMiddleware`
|
|
348
|
+
* once around the entire `execute()` / `stream()` / `resume()` run,
|
|
349
|
+
* the supervisor-level peer of an agent's `execute`-level middleware.
|
|
350
|
+
*
|
|
351
|
+
* Same onion semantics as the agent pipeline: `before` runs top-down
|
|
352
|
+
* (return a `SupervisorResult` to short-circuit the whole run, throw
|
|
353
|
+
* to abort it), `after` / `onError` run bottom-up (return a
|
|
354
|
+
* `SupervisorResult` to replace / recover). A middleware without a
|
|
355
|
+
* `supervisor` hook map is skipped — so the same builtin objects
|
|
356
|
+
* (budget, guardrail, …) can be registered here and on agents,
|
|
357
|
+
* declaring whichever level applies.
|
|
358
|
+
*
|
|
359
|
+
* Each middleware needs a unique `name` (the `ctx.state` namespace);
|
|
360
|
+
* the supervisor does not re-validate the array — register the same
|
|
361
|
+
* objects you validated for the agents.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* ai.supervisor({
|
|
365
|
+
* name: "support",
|
|
366
|
+
* router,
|
|
367
|
+
* intents: { ... },
|
|
368
|
+
* middleware: [auditTrail],
|
|
369
|
+
* });
|
|
370
|
+
*/
|
|
371
|
+
middleware?: AgentMiddleware[];
|
|
330
372
|
/**
|
|
331
373
|
* Per-iteration merger for the artifacts bag (Phase 5 /
|
|
332
374
|
* decisions §35). When omitted the framework auto-spreads:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor-config.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/supervisor/supervisor-config.type.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"supervisor-config.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/supervisor/supervisor-config.type.ts"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA;;KAAY,sBAAA,iBAAuC,kBAAA,KACjD,OAAA,EAAS,kBAAA,CAAmB,CAAA;AAAA,KAGlB,uBAAA,GAA0B,OAAA,eACxB,kBAAA,GAAqB,sBAAA,CAAuB,CAAA;;;;;;;;;AAJ1B;AAGhC;;;;;;;;;;;;;;;AAC2D;AAyC3D;;;;;;;;;;;;;KAAY,gBAAA,6BAED,OAAA,mBACQ,MAAA,SAAe,qBAAA,IAAyB,MAAA,SAAe,qBAAA,gBAC3D,MAAA;EAuGJ,sEApGT,IAAA;EAoGkC;;;;;;;;EA1FlC,OAAA;EAuH6C;;;;;;;;;;;EA1G7C,WAAA,GAAc,gBAAA,CAAiB,eAAA;EAoRI;;;;;EA7QnC,YAAA,GAAe,oBAAA;EAiUqD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA1RpE,IAAA,YAAgB,oBAAA;EA4DiB;;;;;;;;;;;;;;;;;;;EAvCjC,OAAA,GAAU,OAAA;EA+JG;;;;;;;;EArJb,MAAA,GAAS,aAAA,YAAyB,WAAA,CAAY,MAAA;EAmO9C;;;;EA7NA,KAAA,IAAS,GAAA,EAAK,YAAA,CAAa,MAAA,MAAY,IAAA,GAAO,OAAA,CAAQ,IAAA;EAqPP;;;;AAAqB;;;;;;EAzOpE,OAAA,EAAS,QAAA;;;;;;;;;;EAWT,QAAA,IAAY,GAAA,EAAK,eAAA,CAAgB,MAAA,MAAY,cAAA,GAAiB,OAAA,CAAQ,cAAA;;;;;;;;;;;;;;;;EAiBtE,KAAA,GAAQ,MAAA;;;;;EAMR,aAAA;;;;;EAMA,YAAA;;;;;;;;;;;EAYA,MAAA,GAAS,gBAAA,CAAiB,OAAA;;;;;;;;;;;;;EAc1B,aAAA,GAAgB,aAAA;;;;;;EAOhB,EAAA,GAAK,uBAAA;;;;;;;;;;;;;;;;;EAkBL,GAAA,GAAM,SAAA,CAAU,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwChB,UAAA,GAAa,gBAAA,CAAiB,MAAA;;;;;;;;;;;;;;;;;;;;;;EAsB9B,aAAA;IACE,MAAA;IACA,MAAA;IACA,GAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;EAyBF,eAAA,GAAkB,gBAAA,CAAiB,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BnC,UAAA,GAAa,eAAA;;;;;;;;;;;;;;;;;;;;;;;EAwBb,iBAAA,IAAqB,KAAA,EAAO,MAAA,EAAQ,SAAA,EAAW,UAAA,KAAe,MAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IterationSnapshot } from "./iteration-snapshot.type.mjs";
|
|
2
1
|
import { SupervisorInput } from "./supervisor-input.type.mjs";
|
|
2
|
+
import { IterationSnapshot } from "./iteration-snapshot.type.mjs";
|
|
3
3
|
|
|
4
4
|
//#region ../@warlock.js/ai/src/contracts/supervisor/supervisor-snapshot.type.d.ts
|
|
5
5
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ExecutableContract } from "../executable.contract.mjs";
|
|
2
2
|
import { StreamContract } from "../stream/stream.contract.mjs";
|
|
3
|
+
import { SupervisorResult } from "../result/supervisor-result.type.mjs";
|
|
3
4
|
import { ToolContract } from "../../tool/tool.mjs";
|
|
4
5
|
import { SupervisorInput } from "./supervisor-input.type.mjs";
|
|
5
|
-
import { SupervisorEventHandler } from "./supervisor-config.type.mjs";
|
|
6
6
|
import { SupervisorExecuteOptions, SupervisorResumeOptions } from "./supervisor-execute-options.type.mjs";
|
|
7
|
+
import { SupervisorEventHandler } from "./supervisor-config.type.mjs";
|
|
7
8
|
import { SupervisorStreamEvent } from "./supervisor-stream-event.type.mjs";
|
|
8
|
-
import { SupervisorResult } from "../result/supervisor-result.type.mjs";
|
|
9
9
|
import { SupervisorEventMap } from "../events/event-map.type.mjs";
|
|
10
10
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
11
11
|
|
|
@@ -68,6 +68,13 @@ type SupervisorAsToolOptions<TToolInput> = {
|
|
|
68
68
|
interface SupervisorContract<TOutput = unknown> extends ExecutableContract<SupervisorInput, SupervisorExecuteOptions, SupervisorResult<TOutput>> {
|
|
69
69
|
/** Stable identifier — mirrors the config's `name`. */
|
|
70
70
|
readonly name: string;
|
|
71
|
+
/**
|
|
72
|
+
* Mirrors {@link SupervisorConfig.inputSchema} when set — lets the
|
|
73
|
+
* agent tool-collection path auto-adapt this supervisor into a
|
|
74
|
+
* `ToolContract` (manifest derived from name + this schema) when it
|
|
75
|
+
* appears in `tools: []` without `.asTool()`.
|
|
76
|
+
*/
|
|
77
|
+
readonly inputSchema?: StandardSchemaV1<SupervisorInput>;
|
|
71
78
|
/**
|
|
72
79
|
* Structural fingerprint of the supervisor definition — agent
|
|
73
80
|
* keys + their resolved descriptions + router identity (if set) +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/supervisor/supervisor.contract.ts"],"mappings":";;;;;;;;;;;;;;AAwBA;;;;;;;;KAAY,uBAAA;EACV,IAAA;EACA,WAAA;EACA,WAAA,EAAa,gBAAgB,CAAC,UAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA2Cf,kBAAA,4BAA8C,kBAAA,CAC7D,eAAA,EACA,wBAAA,EACA,gBAAA,CAAiB,OAAA;
|
|
1
|
+
{"version":3,"file":"supervisor.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/supervisor/supervisor.contract.ts"],"mappings":";;;;;;;;;;;;;;AAwBA;;;;;;;;KAAY,uBAAA;EACV,IAAA;EACA,WAAA;EACA,WAAA,EAAa,gBAAgB,CAAC,UAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA2Cf,kBAAA,4BAA8C,kBAAA,CAC7D,eAAA,EACA,wBAAA,EACA,gBAAA,CAAiB,OAAA;EAFjB;EAAA,SAKS,IAAA;EAHT;;;;;;EAAA,SAWS,WAAA,GAAc,gBAAA,CAAiB,eAAA;EAgBxC;;;;;;EAAA,SARS,SAAA;EAWmB;;;;;;EAH5B,OAAA,CACE,KAAA,EAAO,eAAA,EACP,OAAA,GAAU,wBAAA,GACT,OAAA,CAAQ,gBAAA,CAAiB,OAAA;EAYV;;;;;;;EAHlB,MAAA,CACE,KAAA,EAAO,eAAA,EACP,OAAA,GAAU,wBAAA,GACT,cAAA,CAAe,gBAAA,CAAiB,OAAA,GAAU,qBAAA;EAWqB;;;;;;;;;EAAlE,MAAA,CAAO,KAAA,UAAe,OAAA,GAAU,uBAAA,GAA0B,OAAA,CAAQ,gBAAA,CAAiB,OAAA;EAcnF;;;;;;EANA,EAAA,iBAAmB,kBAAA,EAAoB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,sBAAA,CAAuB,CAAA;EAM/B;;;;EAAlD,GAAA,iBAAoB,kBAAA,EAAoB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,sBAAA,CAAuB,CAAA;EAUhF;;;;;AACiC;;EAFnC,MAAA,sBACE,OAAA,EAAS,uBAAA,CAAwB,UAAA,IAChC,YAAA,CAAa,UAAA,EAAY,OAAA;AAAA"}
|
|
@@ -2,5 +2,5 @@ import { NextStepResult } from "./next-step-result.type.mjs";
|
|
|
2
2
|
import { RetryBackoff, RetryConfig } from "./retry-config.type.mjs";
|
|
3
3
|
import { WorkflowContext } from "./workflow-context.type.mjs";
|
|
4
4
|
import { StepAgentInput, StepDefinition, StepLocalEvents, StepOutputSpec } from "./step.contract.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { WorkflowSnapshot } from "./workflow-snapshot.type.mjs";
|
|
6
|
+
import { WorkflowDefinition, WorkflowEventHandler, WorkflowEventHandlers, WorkflowExecuteOptions, WorkflowInstance, WorkflowResumeOptions, WorkflowRunOptions } from "./workflow.contract.mjs";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ExecutableContract } from "../executable.contract.mjs";
|
|
2
2
|
import { WorkflowResult } from "../result/workflow-result.type.mjs";
|
|
3
3
|
import { ToolContract } from "../../tool/tool.mjs";
|
|
4
|
+
import { SnapshotStore } from "../orchestrator/snapshot-store.contract.mjs";
|
|
4
5
|
import { NextStepResult } from "./next-step-result.type.mjs";
|
|
5
6
|
import { RetryConfig } from "./retry-config.type.mjs";
|
|
6
7
|
import { WorkflowContext } from "./workflow-context.type.mjs";
|
|
7
8
|
import { StepDefinition, StepOutputSpec } from "./step.contract.mjs";
|
|
9
|
+
import { WorkflowSnapshot } from "./workflow-snapshot.type.mjs";
|
|
8
10
|
import { WorkflowEventMap } from "../events/event-map.type.mjs";
|
|
9
11
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
10
|
-
import { CacheDriver } from "@warlock.js/cache";
|
|
11
12
|
|
|
12
13
|
//#region ../@warlock.js/ai/src/contracts/workflow/workflow.contract.d.ts
|
|
13
14
|
type WorkflowEventHandler<K extends keyof WorkflowEventMap> = (payload: WorkflowEventMap[K]) => void;
|
|
@@ -58,18 +59,31 @@ type WorkflowDefinition<TInput = unknown, TOutput = unknown, TState = Record<str
|
|
|
58
59
|
* the default tool description.
|
|
59
60
|
*/
|
|
60
61
|
description?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Opt-in Standard Schema describing this workflow's input. Purely
|
|
64
|
+
* additive — when set, the workflow can be dropped straight into an
|
|
65
|
+
* agent's `tools: []` array WITHOUT calling `.asTool()`: the runtime
|
|
66
|
+
* derives the LLM tool manifest from `name` + `description` + this
|
|
67
|
+
* schema and dispatches through `execute()`. Omit it and `.asTool()`
|
|
68
|
+
* (which takes its own `inputSchema`) remains the way to expose the
|
|
69
|
+
* workflow as a tool. Never validated by the workflow engine itself —
|
|
70
|
+
* step inputs are still each step's responsibility.
|
|
71
|
+
*/
|
|
72
|
+
inputSchema?: StandardSchemaV1<TInput>;
|
|
61
73
|
version?: string;
|
|
62
74
|
steps: StepDefinition<TInput, TState, TContext>[];
|
|
63
75
|
/**
|
|
64
|
-
* Optional durable
|
|
65
|
-
*
|
|
66
|
-
*
|
|
76
|
+
* Optional durable {@link SnapshotStore} enabling
|
|
77
|
+
* `workflow.resume(runId)`. Construct with
|
|
78
|
+
* `ai.snapshot.{memory,pg,redis}()` — `ai.snapshot.memory()` for
|
|
79
|
+
* dev/tests, `ai.snapshot.redis()` / `ai.snapshot.pg()` for
|
|
80
|
+
* production.
|
|
67
81
|
*
|
|
68
|
-
* Falls back to `ai.config({
|
|
69
|
-
* neither is set, `resume()` throws and snapshot writes silently
|
|
82
|
+
* Falls back to `ai.config({ defaultSnapshotStore })` when omitted.
|
|
83
|
+
* When neither is set, `resume()` throws and snapshot writes silently
|
|
70
84
|
* skip (current behavior preserved).
|
|
71
85
|
*/
|
|
72
|
-
snapshotStore?:
|
|
86
|
+
snapshotStore?: SnapshotStore<WorkflowSnapshot>;
|
|
73
87
|
/**
|
|
74
88
|
* Default retry applied to every step that doesn't supply its own
|
|
75
89
|
* `retry`. `undefined` (omitted) means "no retry" — resolves to
|
|
@@ -95,6 +109,13 @@ type WorkflowDefinition<TInput = unknown, TOutput = unknown, TState = Record<str
|
|
|
95
109
|
interface WorkflowInstance<TInput = unknown, TOutput = unknown, TState = Record<string, unknown>, TContext = unknown> extends ExecutableContract<TInput, WorkflowRunOptions<TContext>, WorkflowResult<TOutput>> {
|
|
96
110
|
readonly name: string;
|
|
97
111
|
readonly description?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Mirrors {@link WorkflowDefinition.inputSchema} when set — lets the
|
|
114
|
+
* agent tool-collection path auto-adapt this workflow into a
|
|
115
|
+
* `ToolContract` (manifest derived from name + description + this
|
|
116
|
+
* schema) when it appears in `tools: []` without `.asTool()`.
|
|
117
|
+
*/
|
|
118
|
+
readonly inputSchema?: StandardSchemaV1<TInput>;
|
|
98
119
|
readonly signature: string;
|
|
99
120
|
readonly version?: string;
|
|
100
121
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/workflow/workflow.contract.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/workflow/workflow.contract.ts"],"mappings":";;;;;;;;;;;;;KAYY,oBAAA,iBAAqC,gBAAA,KAC/C,OAAA,EAAS,gBAAA,CAAiB,CAAA;AAAA,KAGhB,qBAAA,GAAwB,OAAA,eACtB,gBAAA,GAAmB,oBAAA,CAAqB,CAAA;;;;;KAO1C,kBAAA;EAXiB,sEAa3B,KAAA,WAd+C;EAgB/C,MAAA,GAAS,WAAA,EAfiB;EAiB1B,EAAA,GAAK,qBAAA;EAjBuB;AAAA;AAG9B;;;;;EAsBE,OAAA,GAAU,QAAA;EAtBwB;;;;;;;EA8BlC,SAAA;AAAA;AA7BqD;AAOvD;;;;AAPuD,KAqC3C,sBAAA,yCAGR,kBAAA,CAAmB,QAAA;EACrB,KAAA,EAAO,MAAA;AAAA;AAAA,KAGG,qBAAA,uBACV,kBAAkB,CAAC,QAAA;EAtCU;;EAyC3B,KAAA;AAAA;AAAA,KAGQ,kBAAA,+CAGD,MAAA;EAGT,IAAA;EApCA;;;;AAQS;EAkCT,WAAA;EA1BgC;;;;;;;;;;EAqChC,WAAA,GAAc,gBAAA,CAAiB,MAAA;EAC/B,OAAA;EACA,KAAA,EAAO,cAAA,CAAe,MAAA,EAAQ,MAAA,EAAQ,QAAA;EAnCzB;AAAA;AAGf;;;;;;;;;EA4CE,aAAA,GAAgB,aAAA,CAAc,gBAAA;EArCpB;;;;;;;;;EA+CV,YAAA,GAAe,WAAA;EACf,QAAA;EACA,aAAA;EACA,QAAA,IACE,QAAA,UACA,GAAA,EAAK,eAAA,CAAgB,MAAA,EAAQ,MAAA,EAAQ,QAAA,MAClC,cAAA,GAAiB,OAAA,CAAQ,cAAA;EAC9B,MAAA,GAAS,cAAA,CAAe,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,QAAA;EACjD,EAAA,GAAK,qBAAA;AAAA;;;;;;;UASU,gBAAA,+CAGN,MAAA,+CAED,kBAAA,CACR,MAAA,EACA,kBAAA,CAAmB,QAAA,GACnB,cAAA,CAAe,OAAA;EAAA,SAEN,IAAA;EAAA,SACA,WAAA;EApBJ;;;;;;EAAA,SA2BI,WAAA,GAAc,gBAAA,CAAiB,MAAA;EAAA,SAC/B,SAAA;EAAA,SACA,OAAA;EAxET;;;;;;;;;;;;;;EAwFA,OAAA,CACE,KAAA,EAAO,MAAA,EACP,OAAA,GAAU,kBAAA,CAAmB,QAAA,IAC5B,OAAA,CAAQ,cAAA,CAAe,OAAA;EAC1B,OAAA,CACE,OAAA,EAAS,sBAAA,CAAuB,MAAA,EAAQ,QAAA,IACvC,OAAA,CAAQ,cAAA,CAAe,OAAA;EAE1B,MAAA,CACE,KAAA,UACA,OAAA,GAAU,qBAAA,CAAsB,QAAA,IAC/B,OAAA,CAAQ,cAAA,CAAe,OAAA;EAE1B,EAAA,iBAAmB,gBAAA,EAAkB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,oBAAA,CAAqB,CAAA;EAC7E,GAAA,iBAAoB,gBAAA,EAAkB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,oBAAA,CAAqB,CAAA;EA9DvE;;;;;;;;;;;;;;;;EAgFP,MAAA,cAAoB,MAAA,EAAQ,OAAA;IAC1B,WAAA;IACA,WAAA,EAAa,gBAAA,CAAiB,UAAA;EAAA,IAC5B,YAAA,CAAa,UAAA,EAAY,OAAA;AAAA"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* return agent.execute(input);
|
|
14
14
|
* }
|
|
15
15
|
*/
|
|
16
|
-
type AIErrorCode = "AGENT_EXEC_FAILED" | "AGENT_CANCELLED" | "AGENT_MAX_TRIPS" | "SCHEMA_VALIDATION_FAILED" | "TOOL_EXEC_FAILED" | "PROVIDER_ERROR" | "PROVIDER_RATE_LIMIT" | "PROVIDER_QUOTA_EXCEEDED" | "PROVIDER_TIMEOUT" | "CONTEXT_LENGTH_EXCEEDED" | "CONTENT_FILTER" | "PROVIDER_INVALID_REQUEST" | "PROVIDER_AUTH" | "BUDGET_EXCEEDED" | "GUARDRAIL_VIOLATION" | "WORKFLOW_ERROR" | "STEP_FAILED" | "WORKFLOW_DRIFT" | "WORKFLOW_CANCELLED" | "WORKFLOW_MAX_STEPS" | "WORKFLOW_INVALID_GOTO" | "SUPERVISOR_FAILED" | "SUPERVISOR_MAX_ITERATIONS" | "SUPERVISOR_INVALID_ROUTE" | "SUPERVISOR_CANCELLED" | "SUPERVISOR_DRIFT" | "SUPERVISOR_INTENT_DESCRIPTION_REQUIRED" | "SUPERVISOR_INTENT_MIXED_DISPATCH" | "SUPERVISOR_INTENT_STREAM_AND_OUTPUT" | "SUPERVISOR_INTENT_STREAM_TO_REQUIRED" | "SUPERVISOR_INTENT_STREAM_ON_WORKFLOW" | "SUPERVISOR_DISPATCH_CYCLE";
|
|
16
|
+
type AIErrorCode = "AGENT_EXEC_FAILED" | "AGENT_CANCELLED" | "AGENT_MAX_TRIPS" | "SCHEMA_VALIDATION_FAILED" | "TOOL_EXEC_FAILED" | "PROVIDER_ERROR" | "PROVIDER_RATE_LIMIT" | "PROVIDER_QUOTA_EXCEEDED" | "PROVIDER_TIMEOUT" | "CONTEXT_LENGTH_EXCEEDED" | "CONTENT_FILTER" | "PROVIDER_INVALID_REQUEST" | "PROVIDER_AUTH" | "BUDGET_EXCEEDED" | "GUARDRAIL_VIOLATION" | "WORKFLOW_ERROR" | "STEP_FAILED" | "WORKFLOW_DRIFT" | "WORKFLOW_CANCELLED" | "WORKFLOW_MAX_STEPS" | "WORKFLOW_INVALID_GOTO" | "SUPERVISOR_FAILED" | "SUPERVISOR_MAX_ITERATIONS" | "SUPERVISOR_INVALID_ROUTE" | "SUPERVISOR_CANCELLED" | "SUPERVISOR_DRIFT" | "SUPERVISOR_INTENT_DESCRIPTION_REQUIRED" | "SUPERVISOR_INTENT_MIXED_DISPATCH" | "SUPERVISOR_INTENT_STREAM_AND_OUTPUT" | "SUPERVISOR_INTENT_STREAM_TO_REQUIRED" | "SUPERVISOR_INTENT_STREAM_ON_WORKFLOW" | "SUPERVISOR_DISPATCH_CYCLE" | "ORCHESTRATOR_FAILED" | "ORCHESTRATOR_DRIFT" | "ORCHESTRATOR_CONFIG" | "ORCHESTRATOR_CANCELLED" | "PLANNER_FAILED" | "PLANNER_PLAN_INVALID" | "PLANNER_CANCELLED";
|
|
17
17
|
//#endregion
|
|
18
18
|
export { AIErrorCode };
|
|
19
19
|
//# sourceMappingURL=error-code.type.d.mts.map
|
package/esm/errors/index.d.mts
CHANGED
|
@@ -14,6 +14,13 @@ import { SupervisorFailedError } from "./supervisor-failed-error.mjs";
|
|
|
14
14
|
import { MaxIterationsError, MaxIterationsErrorOptions } from "./max-iterations-error.mjs";
|
|
15
15
|
import { WorkflowError } from "./workflow-error.mjs";
|
|
16
16
|
import { MaxStepsExceededError, MaxStepsExceededErrorOptions } from "./max-steps-exceeded-error.mjs";
|
|
17
|
+
import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
|
|
18
|
+
import { OrchestratorCancelledError, OrchestratorCancelledErrorOptions } from "./orchestrator-cancelled-error.mjs";
|
|
19
|
+
import { OrchestratorConfigError } from "./orchestrator-config-error.mjs";
|
|
20
|
+
import { OrchestratorDriftError, OrchestratorDriftErrorOptions } from "./orchestrator-drift-error.mjs";
|
|
21
|
+
import { PlannerFailedError } from "./planner-failed-error.mjs";
|
|
22
|
+
import { PlannerCancelledError, PlannerCancelledErrorOptions } from "./planner-cancelled-error.mjs";
|
|
23
|
+
import { PlannerPlanInvalidError } from "./planner-plan-invalid-error.mjs";
|
|
17
24
|
import { ProviderAuthError } from "./provider-auth-error.mjs";
|
|
18
25
|
import { ProviderRateLimitError, ProviderRateLimitErrorOptions } from "./provider-rate-limit-error.mjs";
|
|
19
26
|
import { ProviderTimeoutError } from "./provider-timeout-error.mjs";
|
package/esm/errors/index.mjs
CHANGED
|
@@ -12,6 +12,13 @@ import { SupervisorFailedError } from "./supervisor-failed-error.mjs";
|
|
|
12
12
|
import { MaxIterationsError } from "./max-iterations-error.mjs";
|
|
13
13
|
import { WorkflowError } from "./workflow-error.mjs";
|
|
14
14
|
import { MaxStepsExceededError } from "./max-steps-exceeded-error.mjs";
|
|
15
|
+
import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
|
|
16
|
+
import { OrchestratorCancelledError } from "./orchestrator-cancelled-error.mjs";
|
|
17
|
+
import { OrchestratorConfigError } from "./orchestrator-config-error.mjs";
|
|
18
|
+
import { OrchestratorDriftError } from "./orchestrator-drift-error.mjs";
|
|
19
|
+
import { PlannerFailedError } from "./planner-failed-error.mjs";
|
|
20
|
+
import { PlannerCancelledError } from "./planner-cancelled-error.mjs";
|
|
21
|
+
import { PlannerPlanInvalidError } from "./planner-plan-invalid-error.mjs";
|
|
15
22
|
import { ProviderAuthError } from "./provider-auth-error.mjs";
|
|
16
23
|
import { ProviderRateLimitError } from "./provider-rate-limit-error.mjs";
|
|
17
24
|
import { ProviderTimeoutError } from "./provider-timeout-error.mjs";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ErrorCategory } from "./error-category.type.mjs";
|
|
2
|
+
import { AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../@warlock.js/ai/src/errors/orchestrator-cancelled-error.d.ts
|
|
6
|
+
type OrchestratorCancelledErrorOptions = AIErrorOptions & {
|
|
7
|
+
/** ISO-8601 timestamp at which the abort was observed by the orchestrator. */cancelledAt: string; /** The session whose turn was cancelled. */
|
|
8
|
+
sessionId: string; /** `controller.abort(reason)` payload when the caller supplied one. */
|
|
9
|
+
reason?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A turn was cancelled via `AbortSignal` before it could settle
|
|
13
|
+
* (orchestrator.md §17 — "mid-turn cancel"). The orchestrator returns
|
|
14
|
+
* normally with `report.status: "cancelled"` and the error placed on
|
|
15
|
+
* `result.error` rather than thrown; session state reverts to the
|
|
16
|
+
* pre-turn checkpoint (the orchestrator does not persist a fresh row
|
|
17
|
+
* for a cancelled turn — Q10).
|
|
18
|
+
*
|
|
19
|
+
* Mirrors `SupervisorCancelledError`, orchestrator scope. When an
|
|
20
|
+
* `iterate: true` turn is cancelled mid-iteration, the underlying
|
|
21
|
+
* `SupervisorCancelledError` rides on `cause`.
|
|
22
|
+
*/
|
|
23
|
+
declare class OrchestratorCancelledError extends OrchestratorFailedError {
|
|
24
|
+
static readonly defaultCategory: ErrorCategory;
|
|
25
|
+
readonly cancelledAt: string;
|
|
26
|
+
readonly sessionId: string;
|
|
27
|
+
readonly reason?: string;
|
|
28
|
+
constructor(message: string, options: OrchestratorCancelledErrorOptions);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { OrchestratorCancelledError, OrchestratorCancelledErrorOptions };
|
|
32
|
+
//# sourceMappingURL=orchestrator-cancelled-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-cancelled-error.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/orchestrator-cancelled-error.ts"],"mappings":";;;;;KAIY,iCAAA,GAAoC,cAAc;gFAE5D,WAAA,UAF2C;EAI3C,SAAA,UAJ4D;EAM5D,MAAA;AAAA;;;;AAAM;AAeR;;;;;;;;cAAa,0BAAA,SAAmC,uBAAA;EAAA,gBACvB,eAAA,EAAiB,aAAA;EAAA,SAExB,WAAA;EAAA,SACA,SAAA;EAAA,SACA,MAAA;cAGd,OAAA,UACA,OAAA,EAAS,iCAAA;AAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../@warlock.js/ai/src/errors/orchestrator-cancelled-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* A turn was cancelled via `AbortSignal` before it could settle
|
|
6
|
+
* (orchestrator.md §17 — "mid-turn cancel"). The orchestrator returns
|
|
7
|
+
* normally with `report.status: "cancelled"` and the error placed on
|
|
8
|
+
* `result.error` rather than thrown; session state reverts to the
|
|
9
|
+
* pre-turn checkpoint (the orchestrator does not persist a fresh row
|
|
10
|
+
* for a cancelled turn — Q10).
|
|
11
|
+
*
|
|
12
|
+
* Mirrors `SupervisorCancelledError`, orchestrator scope. When an
|
|
13
|
+
* `iterate: true` turn is cancelled mid-iteration, the underlying
|
|
14
|
+
* `SupervisorCancelledError` rides on `cause`.
|
|
15
|
+
*/
|
|
16
|
+
var OrchestratorCancelledError = class extends OrchestratorFailedError {
|
|
17
|
+
static {
|
|
18
|
+
this.defaultCategory = "cancelled";
|
|
19
|
+
}
|
|
20
|
+
constructor(message, options) {
|
|
21
|
+
super(message, options, "ORCHESTRATOR_CANCELLED");
|
|
22
|
+
this.name = "OrchestratorCancelledError";
|
|
23
|
+
this.cancelledAt = options.cancelledAt;
|
|
24
|
+
this.sessionId = options.sessionId;
|
|
25
|
+
this.reason = options.reason;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { OrchestratorCancelledError };
|
|
31
|
+
//# sourceMappingURL=orchestrator-cancelled-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-cancelled-error.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/orchestrator-cancelled-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { OrchestratorFailedError } from \"./orchestrator-failed-error\";\n\nexport type OrchestratorCancelledErrorOptions = AIErrorOptions & {\n /** ISO-8601 timestamp at which the abort was observed by the orchestrator. */\n cancelledAt: string;\n /** The session whose turn was cancelled. */\n sessionId: string;\n /** `controller.abort(reason)` payload when the caller supplied one. */\n reason?: string;\n};\n\n/**\n * A turn was cancelled via `AbortSignal` before it could settle\n * (orchestrator.md §17 — \"mid-turn cancel\"). The orchestrator returns\n * normally with `report.status: \"cancelled\"` and the error placed on\n * `result.error` rather than thrown; session state reverts to the\n * pre-turn checkpoint (the orchestrator does not persist a fresh row\n * for a cancelled turn — Q10).\n *\n * Mirrors `SupervisorCancelledError`, orchestrator scope. When an\n * `iterate: true` turn is cancelled mid-iteration, the underlying\n * `SupervisorCancelledError` rides on `cause`.\n */\nexport class OrchestratorCancelledError extends OrchestratorFailedError {\n public static readonly defaultCategory: ErrorCategory = \"cancelled\";\n\n public readonly cancelledAt: string;\n public readonly sessionId: string;\n public readonly reason?: string;\n\n public constructor(\n message: string,\n options: OrchestratorCancelledErrorOptions,\n ) {\n super(message, options, \"ORCHESTRATOR_CANCELLED\");\n this.name = \"OrchestratorCancelledError\";\n this.cancelledAt = options.cancelledAt;\n this.sessionId = options.sessionId;\n this.reason = options.reason;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyBA,IAAa,6BAAb,cAAgD,wBAAwB;;yBACd;;CAMxD,AAAO,YACL,SACA,SACA;EACA,MAAM,SAAS,SAAS,wBAAwB;EAChD,KAAK,OAAO;EACZ,KAAK,cAAc,QAAQ;EAC3B,KAAK,YAAY,QAAQ;EACzB,KAAK,SAAS,QAAQ;CACxB;AACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ErrorCategory } from "./error-category.type.mjs";
|
|
2
|
+
import { AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../@warlock.js/ai/src/errors/orchestrator-config-error.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Authoring-time misconfiguration of `ai.orchestrator(config)`
|
|
8
|
+
* (orchestrator.md §17). Thrown synchronously at construction — never
|
|
9
|
+
* surfaced via `result.error` — so a bad definition fails fast at boot
|
|
10
|
+
* rather than on the first turn.
|
|
11
|
+
*
|
|
12
|
+
* Examples (§17): `iterate: true` with no `snapshotStore` (or
|
|
13
|
+
* `ai.config({ defaultSnapshotStore })`); no resolvable
|
|
14
|
+
* `checkpointStore`; both `route` and `router` configured;
|
|
15
|
+
* `initialAgent` that is not a key in `intents`.
|
|
16
|
+
*
|
|
17
|
+
* Mirrors the `authoring: true` context tag the supervisor factory
|
|
18
|
+
* stamps on its construction-time failures.
|
|
19
|
+
*/
|
|
20
|
+
declare class OrchestratorConfigError extends OrchestratorFailedError {
|
|
21
|
+
static readonly defaultCategory: ErrorCategory;
|
|
22
|
+
constructor(message: string, options?: AIErrorOptions);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { OrchestratorConfigError };
|
|
26
|
+
//# sourceMappingURL=orchestrator-config-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-config-error.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/orchestrator-config-error.ts"],"mappings":";;;;;;;AAkBA;;;;;;;;;;;;cAAa,uBAAA,SAAgC,uBAAA;EAAA,gBACpB,eAAA,EAAiB,aAAA;cAErB,OAAA,UAAiB,OAAA,GAAU,cAAA;AAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../@warlock.js/ai/src/errors/orchestrator-config-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* Authoring-time misconfiguration of `ai.orchestrator(config)`
|
|
6
|
+
* (orchestrator.md §17). Thrown synchronously at construction — never
|
|
7
|
+
* surfaced via `result.error` — so a bad definition fails fast at boot
|
|
8
|
+
* rather than on the first turn.
|
|
9
|
+
*
|
|
10
|
+
* Examples (§17): `iterate: true` with no `snapshotStore` (or
|
|
11
|
+
* `ai.config({ defaultSnapshotStore })`); no resolvable
|
|
12
|
+
* `checkpointStore`; both `route` and `router` configured;
|
|
13
|
+
* `initialAgent` that is not a key in `intents`.
|
|
14
|
+
*
|
|
15
|
+
* Mirrors the `authoring: true` context tag the supervisor factory
|
|
16
|
+
* stamps on its construction-time failures.
|
|
17
|
+
*/
|
|
18
|
+
var OrchestratorConfigError = class extends OrchestratorFailedError {
|
|
19
|
+
static {
|
|
20
|
+
this.defaultCategory = "validation";
|
|
21
|
+
}
|
|
22
|
+
constructor(message, options) {
|
|
23
|
+
super(message, options, "ORCHESTRATOR_CONFIG");
|
|
24
|
+
this.name = "OrchestratorConfigError";
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { OrchestratorConfigError };
|
|
30
|
+
//# sourceMappingURL=orchestrator-config-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-config-error.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/orchestrator-config-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { OrchestratorFailedError } from \"./orchestrator-failed-error\";\n\n/**\n * Authoring-time misconfiguration of `ai.orchestrator(config)`\n * (orchestrator.md §17). Thrown synchronously at construction — never\n * surfaced via `result.error` — so a bad definition fails fast at boot\n * rather than on the first turn.\n *\n * Examples (§17): `iterate: true` with no `snapshotStore` (or\n * `ai.config({ defaultSnapshotStore })`); no resolvable\n * `checkpointStore`; both `route` and `router` configured;\n * `initialAgent` that is not a key in `intents`.\n *\n * Mirrors the `authoring: true` context tag the supervisor factory\n * stamps on its construction-time failures.\n */\nexport class OrchestratorConfigError extends OrchestratorFailedError {\n public static readonly defaultCategory: ErrorCategory = \"validation\";\n\n public constructor(message: string, options?: AIErrorOptions) {\n super(message, options, \"ORCHESTRATOR_CONFIG\");\n this.name = \"OrchestratorConfigError\";\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,IAAa,0BAAb,cAA6C,wBAAwB;;yBACX;;CAExD,AAAO,YAAY,SAAiB,SAA0B;EAC5D,MAAM,SAAS,SAAS,qBAAqB;EAC7C,KAAK,OAAO;CACd;AACF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ErrorCategory } from "./error-category.type.mjs";
|
|
2
|
+
import { AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../@warlock.js/ai/src/errors/orchestrator-drift-error.d.ts
|
|
6
|
+
type OrchestratorDriftErrorOptions = AIErrorOptions & {
|
|
7
|
+
/** Signature recorded on the loaded checkpoint. */savedSignature: string; /** Signature computed from the current orchestrator definition. */
|
|
8
|
+
currentSignature: string; /** The session whose checkpoint drifted. */
|
|
9
|
+
sessionId: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Phase 2 drift guard (orchestrator.md §3 / §10). `execute()` or
|
|
13
|
+
* `resume()` loaded a checkpoint whose structural fingerprint does not
|
|
14
|
+
* match the current orchestrator definition (name + intents map +
|
|
15
|
+
* route/router presence + evaluate presence + initialAgent +
|
|
16
|
+
* maxIterations + iterate flag + historyWindow shape — §10.1).
|
|
17
|
+
*
|
|
18
|
+
* The turn is refused synchronously — nothing dispatches — and the dev
|
|
19
|
+
* decides how to recover: discard the session, migrate the persisted
|
|
20
|
+
* state, or pass `{ force: true }` to accept the new signature on the
|
|
21
|
+
* next persisted checkpoint.
|
|
22
|
+
*
|
|
23
|
+
* Mirrors `SupervisorDriftError` / `WorkflowDriftError` — same
|
|
24
|
+
* rationale, orchestrator scope. The orchestrator signature does NOT
|
|
25
|
+
* aggregate the internal supervisor's signature (§10.1); internal-
|
|
26
|
+
* supervisor drift surfaces only on `iterate: true` resume via the
|
|
27
|
+
* supervisor's own drift check.
|
|
28
|
+
*/
|
|
29
|
+
declare class OrchestratorDriftError extends OrchestratorFailedError {
|
|
30
|
+
static readonly defaultCategory: ErrorCategory;
|
|
31
|
+
readonly savedSignature: string;
|
|
32
|
+
readonly currentSignature: string;
|
|
33
|
+
readonly sessionId: string;
|
|
34
|
+
constructor(message: string, options: OrchestratorDriftErrorOptions);
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { OrchestratorDriftError, OrchestratorDriftErrorOptions };
|
|
38
|
+
//# sourceMappingURL=orchestrator-drift-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-drift-error.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/orchestrator-drift-error.ts"],"mappings":";;;;;KAIY,6BAAA,GAAgC,cAAc;qDAExD,cAAA,UAFuC;EAIvC,gBAAA,UAJwD;EAMxD,SAAA;AAAA;;;;AAAS;AAqBX;;;;;;;;;;;;;;cAAa,sBAAA,SAA+B,uBAAA;EAAA,gBACnB,eAAA,EAAiB,aAAA;EAAA,SAExB,cAAA;EAAA,SACA,gBAAA;EAAA,SACA,SAAA;cAEG,OAAA,UAAiB,OAAA,EAAS,6BAAA;AAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../@warlock.js/ai/src/errors/orchestrator-drift-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* Phase 2 drift guard (orchestrator.md §3 / §10). `execute()` or
|
|
6
|
+
* `resume()` loaded a checkpoint whose structural fingerprint does not
|
|
7
|
+
* match the current orchestrator definition (name + intents map +
|
|
8
|
+
* route/router presence + evaluate presence + initialAgent +
|
|
9
|
+
* maxIterations + iterate flag + historyWindow shape — §10.1).
|
|
10
|
+
*
|
|
11
|
+
* The turn is refused synchronously — nothing dispatches — and the dev
|
|
12
|
+
* decides how to recover: discard the session, migrate the persisted
|
|
13
|
+
* state, or pass `{ force: true }` to accept the new signature on the
|
|
14
|
+
* next persisted checkpoint.
|
|
15
|
+
*
|
|
16
|
+
* Mirrors `SupervisorDriftError` / `WorkflowDriftError` — same
|
|
17
|
+
* rationale, orchestrator scope. The orchestrator signature does NOT
|
|
18
|
+
* aggregate the internal supervisor's signature (§10.1); internal-
|
|
19
|
+
* supervisor drift surfaces only on `iterate: true` resume via the
|
|
20
|
+
* supervisor's own drift check.
|
|
21
|
+
*/
|
|
22
|
+
var OrchestratorDriftError = class extends OrchestratorFailedError {
|
|
23
|
+
static {
|
|
24
|
+
this.defaultCategory = "drift";
|
|
25
|
+
}
|
|
26
|
+
constructor(message, options) {
|
|
27
|
+
super(message, options, "ORCHESTRATOR_DRIFT");
|
|
28
|
+
this.name = "OrchestratorDriftError";
|
|
29
|
+
this.savedSignature = options.savedSignature;
|
|
30
|
+
this.currentSignature = options.currentSignature;
|
|
31
|
+
this.sessionId = options.sessionId;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { OrchestratorDriftError };
|
|
37
|
+
//# sourceMappingURL=orchestrator-drift-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-drift-error.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/orchestrator-drift-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { OrchestratorFailedError } from \"./orchestrator-failed-error\";\n\nexport type OrchestratorDriftErrorOptions = AIErrorOptions & {\n /** Signature recorded on the loaded checkpoint. */\n savedSignature: string;\n /** Signature computed from the current orchestrator definition. */\n currentSignature: string;\n /** The session whose checkpoint drifted. */\n sessionId: string;\n};\n\n/**\n * Phase 2 drift guard (orchestrator.md §3 / §10). `execute()` or\n * `resume()` loaded a checkpoint whose structural fingerprint does not\n * match the current orchestrator definition (name + intents map +\n * route/router presence + evaluate presence + initialAgent +\n * maxIterations + iterate flag + historyWindow shape — §10.1).\n *\n * The turn is refused synchronously — nothing dispatches — and the dev\n * decides how to recover: discard the session, migrate the persisted\n * state, or pass `{ force: true }` to accept the new signature on the\n * next persisted checkpoint.\n *\n * Mirrors `SupervisorDriftError` / `WorkflowDriftError` — same\n * rationale, orchestrator scope. The orchestrator signature does NOT\n * aggregate the internal supervisor's signature (§10.1); internal-\n * supervisor drift surfaces only on `iterate: true` resume via the\n * supervisor's own drift check.\n */\nexport class OrchestratorDriftError extends OrchestratorFailedError {\n public static readonly defaultCategory: ErrorCategory = \"drift\";\n\n public readonly savedSignature: string;\n public readonly currentSignature: string;\n public readonly sessionId: string;\n\n public constructor(message: string, options: OrchestratorDriftErrorOptions) {\n super(message, options, \"ORCHESTRATOR_DRIFT\");\n this.name = \"OrchestratorDriftError\";\n this.savedSignature = options.savedSignature;\n this.currentSignature = options.currentSignature;\n this.sessionId = options.sessionId;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,yBAAb,cAA4C,wBAAwB;;yBACV;;CAMxD,AAAO,YAAY,SAAiB,SAAwC;EAC1E,MAAM,SAAS,SAAS,oBAAoB;EAC5C,KAAK,OAAO;EACZ,KAAK,iBAAiB,QAAQ;EAC9B,KAAK,mBAAmB,QAAQ;EAChC,KAAK,YAAY,QAAQ;CAC3B;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AIErrorCode } from "./error-code.type.mjs";
|
|
2
|
+
import { AIError, AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../@warlock.js/ai/src/errors/orchestrator-failed-error.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Base class for every orchestrator-specific failure surfaced from
|
|
7
|
+
* `orchestrator.execute()` / `orchestrator.resume()` /
|
|
8
|
+
* `orchestrator.command()` or thrown at authoring-time by
|
|
9
|
+
* `ai.orchestrator()` validation (orchestrator.md §17).
|
|
10
|
+
*
|
|
11
|
+
* **Role.** Anchor for the `ORCHESTRATOR_*` code family. Subclasses
|
|
12
|
+
* carry precise codes (`ORCHESTRATOR_DRIFT`, `ORCHESTRATOR_CONFIG`,
|
|
13
|
+
* `ORCHESTRATOR_CANCELLED`, …); this base catches everything a turn can
|
|
14
|
+
* produce that isn't already an agent / tool / provider / supervisor
|
|
15
|
+
* error bubbling up from the dispatched child.
|
|
16
|
+
*
|
|
17
|
+
* Child-execution errors (agent, tool, provider, supervisor) flow
|
|
18
|
+
* through the orchestrator unchanged — they are captured on the turn's
|
|
19
|
+
* `childReport` and surfaced on `result.error` directly, never
|
|
20
|
+
* re-wrapped.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const result = await orchestrator.execute(message, { sessionId, history });
|
|
24
|
+
* if (result.error instanceof OrchestratorFailedError) {
|
|
25
|
+
* console.error(result.error.code, result.error.message);
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
declare class OrchestratorFailedError extends AIError {
|
|
29
|
+
constructor(message: string, options?: AIErrorOptions, code?: AIErrorCode);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { OrchestratorFailedError };
|
|
33
|
+
//# sourceMappingURL=orchestrator-failed-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-failed-error.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/orchestrator-failed-error.ts"],"mappings":";;;;;;AA0BA;;;;;;;;;;;;;;;;AAI6C;;;;;cAJhC,uBAAA,SAAgC,OAAA;cAEzC,OAAA,UACA,OAAA,GAAU,cAAA,EACV,IAAA,GAAM,WAAA;AAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AIError } from "./ai-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../@warlock.js/ai/src/errors/orchestrator-failed-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* Base class for every orchestrator-specific failure surfaced from
|
|
6
|
+
* `orchestrator.execute()` / `orchestrator.resume()` /
|
|
7
|
+
* `orchestrator.command()` or thrown at authoring-time by
|
|
8
|
+
* `ai.orchestrator()` validation (orchestrator.md §17).
|
|
9
|
+
*
|
|
10
|
+
* **Role.** Anchor for the `ORCHESTRATOR_*` code family. Subclasses
|
|
11
|
+
* carry precise codes (`ORCHESTRATOR_DRIFT`, `ORCHESTRATOR_CONFIG`,
|
|
12
|
+
* `ORCHESTRATOR_CANCELLED`, …); this base catches everything a turn can
|
|
13
|
+
* produce that isn't already an agent / tool / provider / supervisor
|
|
14
|
+
* error bubbling up from the dispatched child.
|
|
15
|
+
*
|
|
16
|
+
* Child-execution errors (agent, tool, provider, supervisor) flow
|
|
17
|
+
* through the orchestrator unchanged — they are captured on the turn's
|
|
18
|
+
* `childReport` and surfaced on `result.error` directly, never
|
|
19
|
+
* re-wrapped.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const result = await orchestrator.execute(message, { sessionId, history });
|
|
23
|
+
* if (result.error instanceof OrchestratorFailedError) {
|
|
24
|
+
* console.error(result.error.code, result.error.message);
|
|
25
|
+
* }
|
|
26
|
+
*/
|
|
27
|
+
var OrchestratorFailedError = class extends AIError {
|
|
28
|
+
constructor(message, options, code = "ORCHESTRATOR_FAILED") {
|
|
29
|
+
super(code, message, options);
|
|
30
|
+
this.name = "OrchestratorFailedError";
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { OrchestratorFailedError };
|
|
36
|
+
//# sourceMappingURL=orchestrator-failed-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-failed-error.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/orchestrator-failed-error.ts"],"sourcesContent":["import { AIError, type AIErrorOptions } from \"./ai-error\";\nimport type { AIErrorCode } from \"./error-code.type\";\n\n/**\n * Base class for every orchestrator-specific failure surfaced from\n * `orchestrator.execute()` / `orchestrator.resume()` /\n * `orchestrator.command()` or thrown at authoring-time by\n * `ai.orchestrator()` validation (orchestrator.md §17).\n *\n * **Role.** Anchor for the `ORCHESTRATOR_*` code family. Subclasses\n * carry precise codes (`ORCHESTRATOR_DRIFT`, `ORCHESTRATOR_CONFIG`,\n * `ORCHESTRATOR_CANCELLED`, …); this base catches everything a turn can\n * produce that isn't already an agent / tool / provider / supervisor\n * error bubbling up from the dispatched child.\n *\n * Child-execution errors (agent, tool, provider, supervisor) flow\n * through the orchestrator unchanged — they are captured on the turn's\n * `childReport` and surfaced on `result.error` directly, never\n * re-wrapped.\n *\n * @example\n * const result = await orchestrator.execute(message, { sessionId, history });\n * if (result.error instanceof OrchestratorFailedError) {\n * console.error(result.error.code, result.error.message);\n * }\n */\nexport class OrchestratorFailedError extends AIError {\n public constructor(\n message: string,\n options?: AIErrorOptions,\n code: AIErrorCode = \"ORCHESTRATOR_FAILED\",\n ) {\n super(code, message, options);\n this.name = \"OrchestratorFailedError\";\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAa,0BAAb,cAA6C,QAAQ;CACnD,AAAO,YACL,SACA,SACA,OAAoB,uBACpB;EACA,MAAM,MAAM,SAAS,OAAO;EAC5B,KAAK,OAAO;CACd;AACF"}
|