@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
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Message } from "../conversation-message.type.mjs";
|
|
2
|
+
import { OrchestratorEventHandlers } from "./orchestrator-event.type.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../@warlock.js/ai/src/contracts/orchestrator/orchestrator-execute-options.type.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Per-call options for `orchestrator.execute(input, options)` (design
|
|
7
|
+
* §15.4).
|
|
8
|
+
*
|
|
9
|
+
* `sessionId` names the session this turn acts on (no implicit "current
|
|
10
|
+
* session" — §18.1). `history` is required in v1: the framework never
|
|
11
|
+
* persists messages itself (Path 2 only, §7), so the dev passes the
|
|
12
|
+
* prior turns each call. `state` is a partial seed/patch shallow-merged
|
|
13
|
+
* into the loaded session state. `context` is the request-scoped bag,
|
|
14
|
+
* frozen at intake.
|
|
15
|
+
*
|
|
16
|
+
* `TState` defaults to `Record<string, unknown>` so callers that don't
|
|
17
|
+
* parameterize still get a usable `Partial<TState>` patch type.
|
|
18
|
+
*/
|
|
19
|
+
type OrchestratorExecuteOptions<TState = Record<string, unknown>> = {
|
|
20
|
+
/** Required — names the session this turn acts on. */sessionId: string; /** Required — prior conversation turns (Path 2; framework never persists). */
|
|
21
|
+
history: Message[]; /** Partial seed/patch shallow-merged into the loaded session state. */
|
|
22
|
+
state?: Partial<TState>; /** Request-scoped bag — frozen + shallow-copied at intake. */
|
|
23
|
+
context?: Record<string, unknown>;
|
|
24
|
+
signal?: AbortSignal; /** Per-call event handlers — tier 3 of the 3-tier model. */
|
|
25
|
+
on?: OrchestratorEventHandlers; /** Bypass the drift check for this call. */
|
|
26
|
+
force?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Options for `orchestrator.resume(sessionId, options)` (design §15.4).
|
|
30
|
+
*
|
|
31
|
+
* Resume re-supplies request-scoped `context` (NOT persisted — §9.1)
|
|
32
|
+
* and rehydrates state from the checkpoint. No `history` field: a
|
|
33
|
+
* resume continues an interrupted turn from its persisted snapshot
|
|
34
|
+
* rather than opening a fresh turn.
|
|
35
|
+
*/
|
|
36
|
+
type OrchestratorResumeOptions = {
|
|
37
|
+
/** Request-scoped bag re-supplied for the resumed turn. */context?: Record<string, unknown>;
|
|
38
|
+
signal?: AbortSignal;
|
|
39
|
+
on?: OrchestratorEventHandlers; /** Bypass the drift check on resume. */
|
|
40
|
+
force?: boolean;
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { OrchestratorExecuteOptions, OrchestratorResumeOptions };
|
|
44
|
+
//# sourceMappingURL=orchestrator-execute-options.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-execute-options.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/orchestrator/orchestrator-execute-options.type.ts"],"mappings":";;;;;;AAiBA;;;;;;;;;;;;KAAY,0BAAA,UAAoC,MAAA;EAAA,sDAE9C,SAAA,UAEA;EAAA,OAAA,EAAS,OAAA,IAET;EAAA,KAAA,GAAQ,OAAA,CAAQ,MAAA,GAAA;EAEhB,OAAA,GAAU,MAAA;EACV,MAAA,GAAS,WAAA,EAAT;EAEA,EAAA,GAAK,yBAAA,EAAL;EAEA,KAAA;AAAA;;AAAK;AAWP;;;;;;KAAY,yBAAA;EAIoB,2DAF9B,OAAA,GAAU,MAAA;EACV,MAAA,GAAS,WAAA;EACT,EAAA,GAAK,yBAAA,EADI;EAGT,KAAA;AAAA"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { StreamContract } from "../stream/stream.contract.mjs";
|
|
2
|
+
import { ToolContract } from "../../tool/tool.mjs";
|
|
3
|
+
import { SupervisorInput } from "../supervisor/supervisor-input.type.mjs";
|
|
4
|
+
import { OrchestratorResult } from "../result/orchestrator-result.type.mjs";
|
|
5
|
+
import { OrchestratorCommands } from "./orchestrator-commands.type.mjs";
|
|
6
|
+
import { OrchestratorEvent, OrchestratorEventHandler, OrchestratorEventName } from "./orchestrator-event.type.mjs";
|
|
7
|
+
import { OrchestratorExecuteOptions, OrchestratorResumeOptions } from "./orchestrator-execute-options.type.mjs";
|
|
8
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
9
|
+
|
|
10
|
+
//#region ../@warlock.js/ai/src/contracts/orchestrator/orchestrator.contract.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* How a wrapped orchestrator scopes its session when invoked as a tool
|
|
13
|
+
* (design §13.1).
|
|
14
|
+
*
|
|
15
|
+
* - `"fresh"` (default) — every tool invocation gets a brand-new
|
|
16
|
+
* `sessionId`; no continuity across calls. Safe default.
|
|
17
|
+
* - `"shared"` — the wrapped orchestrator participates in the parent's
|
|
18
|
+
* session; the `sessionId` is supplied via the tool's `inputSchema`
|
|
19
|
+
* payload. Expert escape hatch for nested-conversation use cases.
|
|
20
|
+
*/
|
|
21
|
+
type OrchestratorSessionScope = "fresh" | "shared";
|
|
22
|
+
/**
|
|
23
|
+
* Context overrides for a specific session.
|
|
24
|
+
*
|
|
25
|
+
* @deprecated Obsolete v2 forward-declaration. The locked v1
|
|
26
|
+
* orchestrator has no stateful session object and no `session()`
|
|
27
|
+
* method — sessions are owned via a `sessionId` string passed per call
|
|
28
|
+
* (`OrchestratorExecuteOptions.sessionId`, §18.1). Request-scoped
|
|
29
|
+
* overrides are now `OrchestratorExecuteOptions.context`. Retained
|
|
30
|
+
* unchanged for one minor for non-breaking compatibility; do not use in
|
|
31
|
+
* new code.
|
|
32
|
+
*/
|
|
33
|
+
type SessionContextOverrides = {
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Options accepted by `orchestrator.asTool()` (design §13). Mirrors
|
|
38
|
+
* `SupervisorAsToolOptions` and adds `sessionScope` so the parent can
|
|
39
|
+
* choose whether each tool call opens a fresh session or shares one.
|
|
40
|
+
*
|
|
41
|
+
* `inputSchema` types the tool's `input` payload — the orchestrator
|
|
42
|
+
* receives the coerced payload as its `execute(input)` argument.
|
|
43
|
+
*/
|
|
44
|
+
type OrchestratorAsToolOptions<TToolInput = string> = {
|
|
45
|
+
name?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
inputSchema: StandardSchemaV1<TToolInput>; /** Session continuity for tool calls. Default `"fresh"`. */
|
|
48
|
+
sessionScope?: OrchestratorSessionScope;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Runtime handle returned by `ai.orchestrator(config)` (design §15.3) —
|
|
52
|
+
* a session-state manager wrapped around a supervisor. The v1 capstone
|
|
53
|
+
* of the 4-primitive ladder (agent → workflow → supervisor →
|
|
54
|
+
* orchestrator).
|
|
55
|
+
*
|
|
56
|
+
* The session is owned via `sessionId` passed per call (§18.1) — there
|
|
57
|
+
* is no stateful session object and no implicit "current session".
|
|
58
|
+
* Every method names the session it acts on. `execute` and `stream`
|
|
59
|
+
* run one turn; `resume` continues an interrupted turn from its
|
|
60
|
+
* persisted checkpoint; `command` invokes a typed built-in (e.g.
|
|
61
|
+
* `compact`); `asTool` exposes the orchestrator to an outer agent.
|
|
62
|
+
*
|
|
63
|
+
* Implements the 3-tier event subscription model (definition →
|
|
64
|
+
* instance → per-call). Child `supervisor.*` / `agent.*` events bubble
|
|
65
|
+
* up unmodified under their own identity (§14.2).
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* const supportBot = ai.orchestrator<SessionState>({
|
|
69
|
+
* name: "refund-support",
|
|
70
|
+
* intents: { classify, lookup, process, compose },
|
|
71
|
+
* route: (ctx) => (ctx.iteration === 0 ? "classify" : END),
|
|
72
|
+
* });
|
|
73
|
+
*
|
|
74
|
+
* const result = await supportBot.execute(message, { sessionId, history });
|
|
75
|
+
* if (result.report.status === "awaiting-input") {
|
|
76
|
+
* // session continues — wait for the next user turn
|
|
77
|
+
* }
|
|
78
|
+
*/
|
|
79
|
+
interface OrchestratorContract<TOutput = unknown, TState = TOutput> {
|
|
80
|
+
/** Stable identifier — mirrors the config's `name`. */
|
|
81
|
+
readonly name: string;
|
|
82
|
+
/** Structural fingerprint of the orchestrator definition (§10.1). */
|
|
83
|
+
readonly signature: string;
|
|
84
|
+
/** Dev-curated version string, or `undefined` when none was declared. */
|
|
85
|
+
readonly version: string | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Run one turn end-to-end against the named session. Returns the
|
|
88
|
+
* per-turn `OrchestratorResult`. Never throws on runtime failure —
|
|
89
|
+
* errors surface via `result.error`; drift / config misuse throw.
|
|
90
|
+
*/
|
|
91
|
+
execute(input: SupervisorInput, options: OrchestratorExecuteOptions<TState>): Promise<OrchestratorResult<TOutput>>;
|
|
92
|
+
/**
|
|
93
|
+
* Stream the turn's lifecycle events in real time. `result` resolves
|
|
94
|
+
* to the same value `execute()` would produce; child agent/supervisor
|
|
95
|
+
* streaming bubbles up under its own namespace.
|
|
96
|
+
*/
|
|
97
|
+
stream(input: SupervisorInput, options: OrchestratorExecuteOptions<TState>): StreamContract<OrchestratorResult<TOutput>, OrchestratorEvent>;
|
|
98
|
+
/**
|
|
99
|
+
* Resume an interrupted turn from its persisted checkpoint. Returns
|
|
100
|
+
* `null` when there is nothing to resume for the session. Throws
|
|
101
|
+
* `OrchestratorDriftError` on signature drift unless `{ force: true }`.
|
|
102
|
+
*/
|
|
103
|
+
resume(sessionId: string, options?: OrchestratorResumeOptions): Promise<OrchestratorResult<TOutput> | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Invoke a typed built-in command (design §11). v1 ships `compact`;
|
|
106
|
+
* user commands attach via module augmentation of
|
|
107
|
+
* `OrchestratorCommands`.
|
|
108
|
+
*/
|
|
109
|
+
command<K extends keyof OrchestratorCommands>(name: K, args: OrchestratorCommands[K]["args"]): Promise<OrchestratorCommands[K]["result"]>;
|
|
110
|
+
/**
|
|
111
|
+
* Wrap this orchestrator as a `ToolContract` so an outer agent can
|
|
112
|
+
* invoke it inside its tool-call loop. `sessionScope` controls
|
|
113
|
+
* session continuity across calls (§13.1).
|
|
114
|
+
*/
|
|
115
|
+
asTool<TToolInput = string>(options: OrchestratorAsToolOptions<TToolInput>): ToolContract<TToolInput, TOutput>;
|
|
116
|
+
/**
|
|
117
|
+
* Subscribe an instance-level handler — tier 2 of the 3-tier model.
|
|
118
|
+
* Returns an unsubscribe function equivalent to `off(event, handler)`.
|
|
119
|
+
*/
|
|
120
|
+
on<K extends OrchestratorEventName>(event: K, handler: OrchestratorEventHandler<K>): () => void;
|
|
121
|
+
/**
|
|
122
|
+
* Remove a previously-subscribed instance-level handler. No-op when
|
|
123
|
+
* the handler was never registered or already removed.
|
|
124
|
+
*/
|
|
125
|
+
off<K extends OrchestratorEventName>(event: K, handler: OrchestratorEventHandler<K>): void;
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
export { OrchestratorAsToolOptions, OrchestratorContract, OrchestratorSessionScope, SessionContextOverrides };
|
|
129
|
+
//# sourceMappingURL=orchestrator.contract.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/orchestrator/orchestrator.contract.ts"],"mappings":";;;;;;;;;;;;AA0BA;;;;AAAoC;AAapC;;;KAbY,wBAAA;AAcE;AAWd;;;;;;;;;;AAXc,KADF,uBAAA;EAAA,CACT,GAAW;AAAA;;;;;AAgB2B;AAgCzC;;;KArCY,yBAAA;EACV,IAAA;EACA,WAAA;EACA,WAAA,EAAa,gBAAA,CAAiB,UAAA,GAkDA;EAhD9B,YAAA,GAAe,wBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAgCA,oBAAA,6BAAiD,OAAA;EAwErD;EAAA,SAtEF,IAAA;EAsE0B;EAAA,SApE1B,SAAA;EAJ8C;EAAA,SAM9C,OAAA;EAJA;;;;;EAWT,OAAA,CACE,KAAA,EAAO,eAAA,EACP,OAAA,EAAS,0BAAA,CAA2B,MAAA,IACnC,OAAA,CAAQ,kBAAA,CAAmB,OAAA;EADnB;;;;;EAQX,MAAA,CACE,KAAA,EAAO,eAAA,EACP,OAAA,EAAS,0BAAA,CAA2B,MAAA,IACnC,cAAA,CAAe,kBAAA,CAAmB,OAAA,GAAU,iBAAA;EAH/C;;;;;EAUA,MAAA,CACE,SAAA,UACA,OAAA,GAAU,yBAAA,GACT,OAAA,CAAQ,kBAAA,CAAmB,OAAA;EAV3B;;;;;EAiBH,OAAA,iBAAwB,oBAAA,EACtB,IAAA,EAAM,CAAA,EACN,IAAA,EAAM,oBAAA,CAAqB,CAAA,YAC1B,OAAA,CAAQ,oBAAA,CAAqB,CAAA;EAXpB;;;;;EAkBZ,MAAA,sBACE,OAAA,EAAS,yBAAA,CAA0B,UAAA,IAClC,YAAA,CAAa,UAAA,EAAY,OAAA;EAZpB;;;;EAkBR,EAAA,WAAa,qBAAA,EACX,KAAA,EAAO,CAAA,EACP,OAAA,EAAS,wBAAA,CAAyB,CAAA;EAlBP;;;;EAyB7B,GAAA,WAAc,qBAAA,EACZ,KAAA,EAAO,CAAA,EACP,OAAA,EAAS,wBAAA,CAAyB,CAAA;AAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SessionSendResult } from "../result/session-send-result.type.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../@warlock.js/ai/src/contracts/orchestrator/session.contract.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A stateful session that routes messages through agents, workflows, or
|
|
6
|
+
* supervisors.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Obsolete v2 forward-declaration. The locked v1
|
|
9
|
+
* orchestrator (design §15) has NO stateful session object and no
|
|
10
|
+
* `send()` method. A turn is run via
|
|
11
|
+
* `orchestrator.execute(input, { sessionId, history })`, which returns
|
|
12
|
+
* an {@link OrchestratorResult} — see
|
|
13
|
+
* `../result/orchestrator-result.type`. Retained unchanged for one
|
|
14
|
+
* minor for non-breaking compatibility; do not use in new code.
|
|
15
|
+
*/
|
|
16
|
+
interface SessionContract {
|
|
17
|
+
/**
|
|
18
|
+
* Send a message to the session and receive a result.
|
|
19
|
+
*
|
|
20
|
+
* @deprecated Use `orchestrator.execute(input, options)` instead.
|
|
21
|
+
*/
|
|
22
|
+
send(message: string): Promise<SessionSendResult>;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { SessionContract };
|
|
26
|
+
//# sourceMappingURL=session.contract.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/orchestrator/session.contract.ts"],"mappings":";;;;;AAcA;;;;;;;;;AAMkD;UANjC,eAAA;;;;;;EAMf,IAAA,CAAK,OAAA,WAAkB,OAAO,CAAC,iBAAA;AAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { SupervisorSnapshot } from "../supervisor/supervisor-snapshot.type.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../@warlock.js/ai/src/contracts/orchestrator/snapshot-store.contract.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Minimal `pg`-compatible client surface the pg snapshot/checkpoint
|
|
6
|
+
* stores depend on (orchestrator.md §8.4). Both `pg.Pool` and
|
|
7
|
+
* `pg.Client` satisfy it — the stores only ever call `query`.
|
|
8
|
+
*
|
|
9
|
+
* `@warlock.js/ai` takes NO peer dep on `pg`; the dev installs it and
|
|
10
|
+
* passes the client in. Mirrors `@warlock.js/cache`'s `PgClientLike`
|
|
11
|
+
* so a single pool can back both the cache and the orchestrator
|
|
12
|
+
* stores. Declared here for the deferred Phase-2 pg drivers.
|
|
13
|
+
*/
|
|
14
|
+
type PgClientLike = {
|
|
15
|
+
query(text: string, params?: unknown[]): Promise<{
|
|
16
|
+
rows: unknown[];
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Minimal `redis`-compatible client surface the redis snapshot/
|
|
21
|
+
* checkpoint stores depend on (orchestrator.md §8.4).
|
|
22
|
+
*
|
|
23
|
+
* `@warlock.js/ai` takes NO peer dep on `redis`; the dev installs it
|
|
24
|
+
* and passes the client in. Declared here for the deferred Phase-2
|
|
25
|
+
* redis drivers.
|
|
26
|
+
*/
|
|
27
|
+
type RedisClientLike = {
|
|
28
|
+
get(key: string): Promise<string | null>;
|
|
29
|
+
set(key: string, value: string, ...args: unknown[]): Promise<unknown>;
|
|
30
|
+
del(key: string): Promise<number>;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Durable store for the internal supervisor run state of an
|
|
34
|
+
* `iterate: true` orchestrator turn (orchestrator.md §8.2).
|
|
35
|
+
*
|
|
36
|
+
* Its payload is the existing {@link SupervisorSnapshot} envelope
|
|
37
|
+
* (§8.1 — "same shape as supervisor's existing snapshot envelope"):
|
|
38
|
+
* the store is keyed by the supervisor `runId` and round-trips the
|
|
39
|
+
* whole snapshot, so a crashed mid-turn iteration can resume.
|
|
40
|
+
* **Promoted** from the historical `CacheDriver` path for naming
|
|
41
|
+
* consistency — the `CacheDriver` overload stays for one deprecated
|
|
42
|
+
* minor (§8.1).
|
|
43
|
+
*
|
|
44
|
+
* Distinct from
|
|
45
|
+
* {@link import("./checkpoint-store.contract").CheckpointStore}, which
|
|
46
|
+
* persists cross-turn session state. Implementations:
|
|
47
|
+
* `ai.snapshot.{memory,pg,redis}()`. The memory impl ships in v1;
|
|
48
|
+
* pg/redis follow. Schema is never auto-migrated — {@link
|
|
49
|
+
* SnapshotStore.schema} returns a DDL string the dev runs themselves
|
|
50
|
+
* (§8.5).
|
|
51
|
+
*
|
|
52
|
+
* Generic over the persisted snapshot shape. Defaults to
|
|
53
|
+
* {@link SupervisorSnapshot} so every existing reference resolves
|
|
54
|
+
* exactly as before; the workflow engine parameterizes it with
|
|
55
|
+
* `WorkflowSnapshot`. The only structural requirement is a `runId`
|
|
56
|
+
* string — the store derives its key from it.
|
|
57
|
+
*/
|
|
58
|
+
interface SnapshotStore<TSnapshot extends {
|
|
59
|
+
runId: string;
|
|
60
|
+
} = SupervisorSnapshot> {
|
|
61
|
+
/**
|
|
62
|
+
* Load the snapshot for a `runId`, or `undefined` when no in-flight
|
|
63
|
+
* run is recorded.
|
|
64
|
+
*/
|
|
65
|
+
load(runId: string): Promise<TSnapshot | undefined>;
|
|
66
|
+
/**
|
|
67
|
+
* Persist a snapshot. The key is derived from `snapshot.runId` — the
|
|
68
|
+
* store owns its own keying/prefix.
|
|
69
|
+
*/
|
|
70
|
+
save(snapshot: TSnapshot): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Delete the snapshot for a `runId`.
|
|
73
|
+
*/
|
|
74
|
+
delete(runId: string): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* List the run ids the store knows, optionally filtered by a prefix.
|
|
77
|
+
* Optional — stores that can't enumerate omit it.
|
|
78
|
+
*/
|
|
79
|
+
list?(prefix?: string): Promise<string[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Return the DDL string for this store's backing table. The dev runs
|
|
82
|
+
* it through their migration tool; the framework never auto-migrates
|
|
83
|
+
* (§8.5).
|
|
84
|
+
*/
|
|
85
|
+
schema(): string;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { PgClientLike, RedisClientLike, SnapshotStore };
|
|
89
|
+
//# sourceMappingURL=snapshot-store.contract.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot-store.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/orchestrator/snapshot-store.contract.ts"],"mappings":";;;;;AAYA;;;;;;;;KAAY,YAAA;EACV,KAAA,CAAM,IAAA,UAAc,MAAA,eAAqB,OAAO;IAAG,IAAA;EAAA;AAAA;;;;;;;;;KAWzC,eAAA;EACV,GAAA,CAAI,GAAA,WAAc,OAAA;EAClB,GAAA,CAAI,GAAA,UAAa,KAAA,aAAkB,IAAA,cAAkB,OAAA;EACrD,GAAA,CAAI,GAAA,WAAc,OAAA;AAAA;;;;;;AAAO;AA6B3B;;;;;;;;;;;;;;;;;;;;UAAiB,aAAA;EAAkC,KAAA;AAAA,IAAkB,kBAAA;EAgBnE;;;;EAXA,IAAA,CAAK,KAAA,WAAgB,OAAA,CAAQ,SAAA;EAiBL;;;AAOlB;EAlBN,IAAA,CAAK,QAAA,EAAU,SAAA,GAAY,OAAA;;;;EAK3B,MAAA,CAAO,KAAA,WAAgB,OAAA;;;;;EAMvB,IAAA,EAAM,MAAA,YAAkB,OAAA;;;;;;EAOxB,MAAA;AAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PlannerCapability } from "./planner-capability.type.mjs";
|
|
2
|
+
import { PlannerConfig } from "./planner-config.type.mjs";
|
|
3
|
+
import { PlannerExecuteOptions } from "./planner-execute-options.type.mjs";
|
|
4
|
+
import { PlannerPlan, PlannerStep } from "./planner-plan.type.mjs";
|
|
5
|
+
import { PlannerReport, PlannerReportType, PlannerResult, PlannerStepSnapshot } from "./planner-result.type.mjs";
|
|
6
|
+
import { PlannerContract } from "./planner.contract.mjs";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BaseResult } from "../result/base-result.type.mjs";
|
|
2
|
+
import { ExecutableContract } from "../executable.contract.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../@warlock.js/ai/src/contracts/planner/planner-capability.type.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A single capability the planner may reference in a generated plan.
|
|
7
|
+
*
|
|
8
|
+
* **Role.** Adapts an arbitrary executable primitive (an
|
|
9
|
+
* `AgentContract`, `WorkflowInstance`, `SupervisorContract`,
|
|
10
|
+
* `ToolContract`, or anything satisfying {@link ExecutableContract})
|
|
11
|
+
* into a uniform unit the planner can describe to the LLM and dispatch
|
|
12
|
+
* during plan execution. The `name` is the stable handle the LLM
|
|
13
|
+
* references in each plan step; the `description` is what the LLM reads
|
|
14
|
+
* to decide WHEN to use it.
|
|
15
|
+
*
|
|
16
|
+
* **Why a wrapper and not the bare executable?** Two reasons. The LLM
|
|
17
|
+
* needs a `name` + `description` pair regardless of whether the
|
|
18
|
+
* underlying primitive carries one, and the planner needs a single
|
|
19
|
+
* `execute(input)` entry point with a `string` input contract so plan
|
|
20
|
+
* steps stay uniform across heterogeneous capabilities.
|
|
21
|
+
*/
|
|
22
|
+
type PlannerCapability = {
|
|
23
|
+
/** Stable handle the LLM references in each plan step. Unique per planner. */name: string;
|
|
24
|
+
/**
|
|
25
|
+
* What this capability does — the "when would the planner pick this?"
|
|
26
|
+
* line. Injected verbatim into the plan-generation prompt so the LLM
|
|
27
|
+
* can select capabilities sensibly.
|
|
28
|
+
*/
|
|
29
|
+
description: string;
|
|
30
|
+
/**
|
|
31
|
+
* The underlying executable. Dispatched with the step's resolved
|
|
32
|
+
* `string` input during plan execution; its `usage` and `report`
|
|
33
|
+
* roll up into the planner's unified result.
|
|
34
|
+
*/
|
|
35
|
+
executable: ExecutableContract<string, unknown, BaseResult>;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { PlannerCapability };
|
|
39
|
+
//# sourceMappingURL=planner-capability.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-capability.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner-capability.type.ts"],"mappings":";;;;;;AAoBA;;;;;;;;;;AAc4D;;;;;KAdhD,iBAAA;gFAEV,IAAA;;;;;;EAMA,WAAA;;;;;;EAMA,UAAA,EAAY,kBAAkB,kBAAkB,UAAA;AAAA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AgentContract } from "../agent/agent.contract.mjs";
|
|
2
|
+
import { ModelContract } from "../model.contract.mjs";
|
|
3
|
+
import { SystemPromptContract } from "../system-prompt.contract.mjs";
|
|
4
|
+
import { PlannerCapability } from "./planner-capability.type.mjs";
|
|
5
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
|
+
|
|
7
|
+
//#region ../@warlock.js/ai/src/contracts/planner/planner-config.type.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Factory config for `ai.planner(config)`.
|
|
10
|
+
*
|
|
11
|
+
* The planner asks an LLM to GENERATE an ordered plan over the
|
|
12
|
+
* registered `capabilities`, then executes that plan step-by-step
|
|
13
|
+
* through each capability's own `execute()`. It is itself an
|
|
14
|
+
* executable — composes into agents, supervisors, and orchestrators
|
|
15
|
+
* through the same `ExecutableContract` surface.
|
|
16
|
+
*
|
|
17
|
+
* Exactly one of `model` or `planner` must be supplied as the
|
|
18
|
+
* plan-generation brain: `model` builds an internal planning agent
|
|
19
|
+
* automatically; `planner` lets the dev bring a fully-configured agent
|
|
20
|
+
* (custom system prompt, middleware, output guard) to do the planning.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const research = ai.planner({
|
|
24
|
+
* name: "research-assistant",
|
|
25
|
+
* model: ai.openai.model({ name: "gpt-4o" }),
|
|
26
|
+
* capabilities: [
|
|
27
|
+
* { name: "search", description: "Search the web", executable: searchAgent },
|
|
28
|
+
* { name: "summarize", description: "Summarize text", executable: summarizer },
|
|
29
|
+
* ],
|
|
30
|
+
* maxSteps: 6,
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* const { data, report } = await research.execute("Compare React vs Vue in 2026");
|
|
34
|
+
*/
|
|
35
|
+
type PlannerConfig<TOutput = unknown> = {
|
|
36
|
+
/** Stable identifier — used in logs, events, signature, report `name`. */name: string; /** Dev-curated version string. Metadata only — never parsed. */
|
|
37
|
+
version?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Model used to build the internal planning agent that GENERATES the
|
|
40
|
+
* plan. Mutually exclusive with `planner`.
|
|
41
|
+
*/
|
|
42
|
+
model?: ModelContract;
|
|
43
|
+
/**
|
|
44
|
+
* Bring-your-own planning agent. Its `execute()` is asked for the
|
|
45
|
+
* structured plan (the planner supplies the plan schema as the
|
|
46
|
+
* agent's `output`). Mutually exclusive with `model`.
|
|
47
|
+
*/
|
|
48
|
+
planner?: AgentContract<unknown>;
|
|
49
|
+
/**
|
|
50
|
+
* Extra instruction prepended to the plan-generation prompt
|
|
51
|
+
* (`model` mode only — ignored when `planner` is supplied, since the
|
|
52
|
+
* dev's agent owns its own prompt).
|
|
53
|
+
*/
|
|
54
|
+
systemPrompt?: SystemPromptContract | string;
|
|
55
|
+
/**
|
|
56
|
+
* The capabilities the plan may reference. The planner injects each
|
|
57
|
+
* one's `name` + `description` into the plan-generation prompt and
|
|
58
|
+
* dispatches the chosen capability per step.
|
|
59
|
+
*/
|
|
60
|
+
capabilities: PlannerCapability[];
|
|
61
|
+
/**
|
|
62
|
+
* Hard cap on the number of plan steps the planner will execute. A
|
|
63
|
+
* generated plan longer than this is truncated to the cap (the
|
|
64
|
+
* dropped tail is recorded as `skipped` on the report). Defaults to
|
|
65
|
+
* 10. Must be >= 1.
|
|
66
|
+
*/
|
|
67
|
+
maxSteps?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Final-output schema. When set, the planner validates the last
|
|
70
|
+
* completed step's output against it before populating
|
|
71
|
+
* `result.data`. Omit to pass the final step's raw output through
|
|
72
|
+
* untyped.
|
|
73
|
+
*/
|
|
74
|
+
output?: StandardSchemaV1<TOutput>;
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
export { PlannerConfig };
|
|
78
|
+
//# sourceMappingURL=planner-config.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-config.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner-config.type.ts"],"mappings":";;;;;;;;;AAiCA;;;;;;;;;;;;;;;;;;;;;;;;;KAAY,aAAA;EAyCuB,0EAvCjC,IAAA;EAEA,OAAA;;;;;EAKA,KAAA,GAAQ,aAAA;;;;;;EAMR,OAAA,GAAU,aAAA;;;;;;EAMV,YAAA,GAAe,oBAAA;;;;;;EAMf,YAAA,EAAc,iBAAA;;;;;;;EAOd,QAAA;;;;;;;EAOA,MAAA,GAAS,gBAAA,CAAiB,OAAA;AAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Placeholders } from "../placeholders.type.mjs";
|
|
2
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
|
+
|
|
4
|
+
//#region ../@warlock.js/ai/src/contracts/planner/planner-execute-options.type.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Options accepted by `planner.execute(goal, options?)`.
|
|
7
|
+
*
|
|
8
|
+
* Every field is optional — `planner.execute(goal)` runs end-to-end
|
|
9
|
+
* with the planner's configured defaults.
|
|
10
|
+
*/
|
|
11
|
+
type PlannerExecuteOptions<TOutput = unknown> = {
|
|
12
|
+
/** Stable run-id for this execution. Generated when absent. */runId?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Placeholder values injected into the plan-generation prompt's
|
|
15
|
+
* `{{mustache}}` slots (`model` mode only).
|
|
16
|
+
*/
|
|
17
|
+
placeholders?: Placeholders;
|
|
18
|
+
/**
|
|
19
|
+
* Per-call override of the configured `output` schema. When set, the
|
|
20
|
+
* planner validates the final step output against this instead of
|
|
21
|
+
* the factory-level `output`.
|
|
22
|
+
*/
|
|
23
|
+
output?: StandardSchemaV1<TOutput>;
|
|
24
|
+
/**
|
|
25
|
+
* Cancellation handle. When `signal.aborted` becomes true the planner
|
|
26
|
+
* short-circuits at the next step boundary and returns with
|
|
27
|
+
* `report.status === "cancelled"` and `result.error` set to a
|
|
28
|
+
* `PlannerCancelledError`. The signal is also threaded into every
|
|
29
|
+
* in-flight capability dispatch — mid-step abort is best-effort and
|
|
30
|
+
* depends on the child primitive honoring it.
|
|
31
|
+
*/
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
/**
|
|
34
|
+
* Caller-supplied identifier that groups multiple `execute()` calls
|
|
35
|
+
* into one conceptual session. Mirrored onto every report node this
|
|
36
|
+
* run produces (and every nested executable it dispatches) so flat
|
|
37
|
+
* trace queries don't need to walk the tree.
|
|
38
|
+
*/
|
|
39
|
+
sessionId?: string;
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { PlannerExecuteOptions };
|
|
43
|
+
//# sourceMappingURL=planner-execute-options.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-execute-options.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner-execute-options.type.ts"],"mappings":";;;;;;AASA;;;;KAAY,qBAAA;EAaD,+DAXT,KAAA;EAoBoB;;;;EAfpB,YAAA,GAAe,YAAA;EAAA;;;;;EAMf,MAAA,GAAS,gBAAA,CAAiB,OAAA;EAgB1B;;AAAS;;;;;;EAPT,MAAA,GAAS,WAAA;;;;;;;EAOT,SAAA;AAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region ../@warlock.js/ai/src/contracts/planner/planner-plan.type.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* One step of an LLM-generated execution plan.
|
|
4
|
+
*
|
|
5
|
+
* **Role.** The unit the planner executes in order. Each step names a
|
|
6
|
+
* registered {@link PlannerCapability} (`capability`) and carries the
|
|
7
|
+
* concrete `input` the LLM resolved for that capability. The optional
|
|
8
|
+
* `id` / `dependsOn` fields let the LLM express a simple dependency
|
|
9
|
+
* note for human readability; the bounded-v1 planner executes steps
|
|
10
|
+
* strictly in array order and does NOT yet schedule on `dependsOn`
|
|
11
|
+
* (see {@link PlannerPlan} remarks).
|
|
12
|
+
*/
|
|
13
|
+
type PlannerStep = {
|
|
14
|
+
/**
|
|
15
|
+
* Stable id for this step within the plan — referenced by other
|
|
16
|
+
* steps' `dependsOn`. Optional; the planner falls back to the array
|
|
17
|
+
* index when absent.
|
|
18
|
+
*/
|
|
19
|
+
id?: string; /** Name of the {@link PlannerCapability} this step dispatches. */
|
|
20
|
+
capability: string; /** Concrete input the LLM resolved for the capability's `execute()`. */
|
|
21
|
+
input: string; /** Free-form rationale the LLM produced for why this step exists. */
|
|
22
|
+
reason?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Ids of steps this step conceptually depends on. Advisory only in
|
|
25
|
+
* bounded-v1 — recorded on the snapshot for forensics but not used
|
|
26
|
+
* to reorder or parallelize execution.
|
|
27
|
+
*/
|
|
28
|
+
dependsOn?: string[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The full ordered execution plan the planner's LLM produces before any
|
|
32
|
+
* capability runs.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* **Bounded v1.** Steps execute strictly in array order, one at a time.
|
|
36
|
+
* `dependsOn` is advisory metadata only — no DAG scheduling, no
|
|
37
|
+
* parallel fan-out, no mid-plan re-planning. Those are deferred (see
|
|
38
|
+
* the planner skill). The earlier steps' outputs are threaded into the
|
|
39
|
+
* later steps' prompt context so a downstream capability can build on
|
|
40
|
+
* what ran before it.
|
|
41
|
+
*/
|
|
42
|
+
type PlannerPlan = {
|
|
43
|
+
/** The ordered steps to execute. At least one. */steps: PlannerStep[]; /** Optional one-line LLM summary of the overall strategy. */
|
|
44
|
+
summary?: string;
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { PlannerPlan, PlannerStep };
|
|
48
|
+
//# sourceMappingURL=planner-plan.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-plan.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner-plan.type.ts"],"mappings":";;AAWA;;;;;;;;;;KAAY,WAAA;EAiCA;;;;;EA3BV,EAAA,WA+BA;EA7BA,UAAA,UA6BO;EA3BP,KAAA;EAEA,MAAA;;;;;;EAMA,SAAA;AAAA;;;;;;;;;;;;;KAeU,WAAA;oDAEV,KAAA,EAAO,WAAW;EAElB,OAAA;AAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { AIError } from "../../errors/ai-error.mjs";
|
|
2
|
+
import { Usage } from "../result/usage.type.mjs";
|
|
3
|
+
import { BaseReport } from "../result/base-report.type.mjs";
|
|
4
|
+
import { ExecuteResult } from "../result/execute-result.type.mjs";
|
|
5
|
+
import { PlannerPlan, PlannerStep } from "./planner-plan.type.mjs";
|
|
6
|
+
|
|
7
|
+
//#region ../@warlock.js/ai/src/contracts/planner/planner-result.type.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Discriminator literal the planner stamps onto its report's `type`
|
|
10
|
+
* field. A member of the shared
|
|
11
|
+
* {@link import("../result/base-report.type").ReportType} closed union.
|
|
12
|
+
*
|
|
13
|
+
* {@link PlannerReport} re-declares `type` as this literal by *overriding*
|
|
14
|
+
* it (`Omit<BaseReport, "type"> & { type: PlannerReportType }`) rather than
|
|
15
|
+
* intersecting (`BaseReport & { type: "planner" }`). Intersecting a single
|
|
16
|
+
* literal against `BaseReport.type` (the whole `ReportType` union) lets a
|
|
17
|
+
* strict TypeScript collapse the entire report to `never` ("property `type`
|
|
18
|
+
* has conflicting types in some constituents"); the `Omit` override sidesteps
|
|
19
|
+
* that while still producing the same `type: "planner"` for consumers.
|
|
20
|
+
*/
|
|
21
|
+
type PlannerReportType = "planner";
|
|
22
|
+
/**
|
|
23
|
+
* Forensic record of a single executed plan step on
|
|
24
|
+
* {@link PlannerReport.executedSteps}.
|
|
25
|
+
*
|
|
26
|
+
* Mirrors the supervisor/orchestrator snapshot shape so a step reads
|
|
27
|
+
* uniformly. Frozen-friendly plain data — the dispatched capability's
|
|
28
|
+
* full report tree lives on `childReport` AND under
|
|
29
|
+
* {@link BaseReport.children}, matching the universal rollup invariant.
|
|
30
|
+
*/
|
|
31
|
+
type PlannerStepSnapshot = {
|
|
32
|
+
/** 0-based position of this step in the executed plan. */index: number; /** The plan step that drove this dispatch. */
|
|
33
|
+
step: PlannerStep; /** Terminal status of this step's capability dispatch. */
|
|
34
|
+
status: "completed" | "failed" | "skipped"; /** The capability's typed output when it completed, if any. */
|
|
35
|
+
output?: unknown; /** Typed failure cause when the step failed; undefined on success. */
|
|
36
|
+
error?: AIError;
|
|
37
|
+
startedAt: string;
|
|
38
|
+
endedAt: string;
|
|
39
|
+
duration: number;
|
|
40
|
+
usage: Usage; /** The dispatched capability's full report tree. */
|
|
41
|
+
childReport?: BaseReport;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Planner-specific execution report — {@link BaseReport} plus the
|
|
45
|
+
* generated plan, the per-step execution snapshots, and the planner's
|
|
46
|
+
* structural signature.
|
|
47
|
+
*
|
|
48
|
+
* `children[]` carries every capability dispatched during plan
|
|
49
|
+
* execution, in execution order — the cross-cutting tree view shared
|
|
50
|
+
* with every other primitive. `executedSteps` is the authoritative
|
|
51
|
+
* per-step record (one entry per step the planner attempted), and
|
|
52
|
+
* `plan` is the verbatim LLM output before any step ran.
|
|
53
|
+
*/
|
|
54
|
+
type PlannerReport = Omit<BaseReport, "type"> & {
|
|
55
|
+
type: PlannerReportType; /** Structural fingerprint — same value exposed on the planner instance. */
|
|
56
|
+
signature: string; /** The full plan the planner's LLM generated before execution began. */
|
|
57
|
+
plan?: PlannerPlan; /** Per-step forensic records, in execution order. */
|
|
58
|
+
executedSteps: PlannerStepSnapshot[]; /** ISO-8601 timestamp when cancellation was observed, if any. */
|
|
59
|
+
cancelledAt?: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Result returned by `planner.execute()`. Satisfies the unified
|
|
63
|
+
* {@link ExecuteResult} envelope — `usage` and `report` are the
|
|
64
|
+
* rolled-up totals across the plan-generation trip plus every executed
|
|
65
|
+
* step — and adds the planner discriminant.
|
|
66
|
+
*
|
|
67
|
+
* `data` holds the final step's typed output (or the planner's
|
|
68
|
+
* structured `output` when an `output` schema was configured). On
|
|
69
|
+
* failure or cancellation it is `undefined`; `error` carries the typed
|
|
70
|
+
* cause and `report.status` narrows further.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* const { data, report, usage, error } = await planner.execute(goal);
|
|
74
|
+
*
|
|
75
|
+
* if (error) {
|
|
76
|
+
* logger.error(error.code, { steps: report.executedSteps.length });
|
|
77
|
+
* return;
|
|
78
|
+
* }
|
|
79
|
+
*
|
|
80
|
+
* console.log(report.plan?.summary, usage.total);
|
|
81
|
+
*/
|
|
82
|
+
type PlannerResult<TOutput = unknown> = Omit<ExecuteResult<TOutput>, "report"> & {
|
|
83
|
+
/** Discriminant for narrowing a heterogeneous result union. */type: "planner";
|
|
84
|
+
report: PlannerReport;
|
|
85
|
+
};
|
|
86
|
+
//#endregion
|
|
87
|
+
export { PlannerReport, PlannerReportType, PlannerResult, PlannerStepSnapshot };
|
|
88
|
+
//# sourceMappingURL=planner-result.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-result.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner-result.type.ts"],"mappings":";;;;;;;;;AAmBA;;;;AAA6B;AAW7B;;;;;;KAXY,iBAAA;;;;;;;;;;KAWA,mBAAA;EAYV,0DAVA,KAAA,UAYA;EAVA,IAAA,EAAM,WAAA,EAYN;EAVA,MAAA,sCAUwB;EARxB,MAAA,YAsBU;EApBV,KAAA,GAAQ,OAAA;EACR,SAAA;EACA,OAAA;EACA,QAAA;EACA,KAAA,EAAO,KAAA,EAqBA;EAnBP,WAAA,GAAc,UAAA;AAAA;;;;;;;;;;;;KAcJ,aAAA,GAAgB,IAAA,CAAK,UAAA;EAC/B,IAAA,EAAM,iBAAA,EAgCI;EA9BV,SAAA,UA8BuB;EA5BvB,IAAA,GAAO,WAAA,EA4B2C;EA1BlD,aAAA,EAAe,mBAAA,IA6BP;EA3BR,WAAA;AAAA;;;;;;;;;AA2BqB;;;;;;;;;;;;;KAHX,aAAA,sBAAmC,IAAA,CAAK,aAAA,CAAc,OAAA;iEAEhE,IAAA;EACA,MAAA,EAAQ,aAAA;AAAA"}
|