@warlock.js/ai 4.2.10 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) hide show
  1. package/CHANGELOG.md +61 -1
  2. package/cjs/index.cjs +10151 -4625
  3. package/cjs/index.cjs.map +1 -1
  4. package/cjs/magic-string.es-BtxW4VqG.cjs +1015 -0
  5. package/cjs/magic-string.es-BtxW4VqG.cjs.map +1 -0
  6. package/cjs/matcher-logic-SBnzYohQ.cjs +217 -0
  7. package/cjs/matcher-logic-SBnzYohQ.cjs.map +1 -0
  8. package/cjs/matchers-BBh3gyB-.cjs +13739 -0
  9. package/cjs/matchers-BBh3gyB-.cjs.map +1 -0
  10. package/esm/agent/agent-config.type.d.mts +19 -6
  11. package/esm/agent/agent-config.type.d.mts.map +1 -1
  12. package/esm/agent/agent.d.mts.map +1 -1
  13. package/esm/agent/agent.mjs +17 -6
  14. package/esm/agent/agent.mjs.map +1 -1
  15. package/esm/agent/index.d.mts +2 -1
  16. package/esm/agent/index.mjs +1 -0
  17. package/esm/agent/spawn-sub-agent.d.mts +87 -0
  18. package/esm/agent/spawn-sub-agent.d.mts.map +1 -0
  19. package/esm/agent/spawn-sub-agent.mjs +68 -0
  20. package/esm/agent/spawn-sub-agent.mjs.map +1 -0
  21. package/esm/ai.d.mts +58 -3
  22. package/esm/ai.d.mts.map +1 -1
  23. package/esm/ai.mjs +58 -3
  24. package/esm/ai.mjs.map +1 -1
  25. package/esm/batch/batch.d.mts +43 -0
  26. package/esm/batch/batch.d.mts.map +1 -0
  27. package/esm/batch/batch.mjs +179 -0
  28. package/esm/batch/batch.mjs.map +1 -0
  29. package/esm/batch/batch.type.d.mts +144 -0
  30. package/esm/batch/batch.type.d.mts.map +1 -0
  31. package/esm/batch/index.mjs +3 -0
  32. package/esm/batch/run-batch-item.mjs +100 -0
  33. package/esm/batch/run-batch-item.mjs.map +1 -0
  34. package/esm/batch/run-with-concurrency.mjs +39 -0
  35. package/esm/batch/run-with-concurrency.mjs.map +1 -0
  36. package/esm/checkpoint/index.d.mts +3 -0
  37. package/esm/checkpoint/memory.d.mts +21 -0
  38. package/esm/checkpoint/memory.d.mts.map +1 -0
  39. package/esm/checkpoint/memory.mjs +0 -0
  40. package/esm/checkpoint/memory.mjs.map +1 -0
  41. package/esm/checkpoint/pg.d.mts +37 -0
  42. package/esm/checkpoint/pg.d.mts.map +1 -0
  43. package/esm/checkpoint/pg.mjs +265 -0
  44. package/esm/checkpoint/pg.mjs.map +1 -0
  45. package/esm/checkpoint/redis.d.mts +39 -0
  46. package/esm/checkpoint/redis.d.mts.map +1 -0
  47. package/esm/checkpoint/redis.mjs +200 -0
  48. package/esm/checkpoint/redis.mjs.map +1 -0
  49. package/esm/config.d.mts +61 -14
  50. package/esm/config.d.mts.map +1 -1
  51. package/esm/config.mjs +25 -6
  52. package/esm/config.mjs.map +1 -1
  53. package/esm/contracts/agent/agent.contract.d.mts +43 -0
  54. package/esm/contracts/agent/agent.contract.d.mts.map +1 -1
  55. package/esm/contracts/agent/eval.type.d.mts +143 -0
  56. package/esm/contracts/agent/eval.type.d.mts.map +1 -0
  57. package/esm/contracts/agent/index.d.mts +1 -0
  58. package/esm/contracts/events/supervisor-events.type.d.mts +3 -3
  59. package/esm/contracts/fallback-model.contract.d.mts +65 -0
  60. package/esm/contracts/fallback-model.contract.d.mts.map +1 -0
  61. package/esm/contracts/index.d.mts +32 -12
  62. package/esm/contracts/memory/index.d.mts +4 -0
  63. package/esm/contracts/memory/memory-config.type.d.mts +150 -0
  64. package/esm/contracts/memory/memory-config.type.d.mts.map +1 -0
  65. package/esm/contracts/memory/memory-item.type.d.mts +64 -0
  66. package/esm/contracts/memory/memory-item.type.d.mts.map +1 -0
  67. package/esm/contracts/memory/memory.contract.d.mts +87 -0
  68. package/esm/contracts/memory/memory.contract.d.mts.map +1 -0
  69. package/esm/contracts/memory/recall-options.type.d.mts +33 -0
  70. package/esm/contracts/memory/recall-options.type.d.mts.map +1 -0
  71. package/esm/contracts/middleware/index.d.mts +2 -2
  72. package/esm/contracts/middleware/middleware-context.type.d.mts +42 -2
  73. package/esm/contracts/middleware/middleware-context.type.d.mts.map +1 -1
  74. package/esm/contracts/middleware/middleware.contract.d.mts +46 -2
  75. package/esm/contracts/middleware/middleware.contract.d.mts.map +1 -1
  76. package/esm/contracts/model.contract.d.mts +63 -2
  77. package/esm/contracts/model.contract.d.mts.map +1 -1
  78. package/esm/contracts/orchestrator/checkpoint-store.contract.d.mts +91 -0
  79. package/esm/contracts/orchestrator/checkpoint-store.contract.d.mts.map +1 -0
  80. package/esm/contracts/orchestrator/index.d.mts +8 -0
  81. package/esm/contracts/orchestrator/orchestrator-commands.type.d.mts +43 -0
  82. package/esm/contracts/orchestrator/orchestrator-commands.type.d.mts.map +1 -0
  83. package/esm/contracts/orchestrator/orchestrator-config.type.d.mts +170 -0
  84. package/esm/contracts/orchestrator/orchestrator-config.type.d.mts.map +1 -0
  85. package/esm/contracts/orchestrator/orchestrator-event.type.d.mts +118 -0
  86. package/esm/contracts/orchestrator/orchestrator-event.type.d.mts.map +1 -0
  87. package/esm/contracts/orchestrator/orchestrator-execute-options.type.d.mts +44 -0
  88. package/esm/contracts/orchestrator/orchestrator-execute-options.type.d.mts.map +1 -0
  89. package/esm/contracts/orchestrator/orchestrator.contract.d.mts +129 -0
  90. package/esm/contracts/orchestrator/orchestrator.contract.d.mts.map +1 -0
  91. package/esm/contracts/orchestrator/session.contract.d.mts +26 -0
  92. package/esm/contracts/orchestrator/session.contract.d.mts.map +1 -0
  93. package/esm/contracts/orchestrator/snapshot-store.contract.d.mts +89 -0
  94. package/esm/contracts/orchestrator/snapshot-store.contract.d.mts.map +1 -0
  95. package/esm/contracts/planner/index.d.mts +6 -0
  96. package/esm/contracts/planner/planner-capability.type.d.mts +39 -0
  97. package/esm/contracts/planner/planner-capability.type.d.mts.map +1 -0
  98. package/esm/contracts/planner/planner-config.type.d.mts +78 -0
  99. package/esm/contracts/planner/planner-config.type.d.mts.map +1 -0
  100. package/esm/contracts/planner/planner-execute-options.type.d.mts +43 -0
  101. package/esm/contracts/planner/planner-execute-options.type.d.mts.map +1 -0
  102. package/esm/contracts/planner/planner-plan.type.d.mts +48 -0
  103. package/esm/contracts/planner/planner-plan.type.d.mts.map +1 -0
  104. package/esm/contracts/planner/planner-result.type.d.mts +82 -0
  105. package/esm/contracts/planner/planner-result.type.d.mts.map +1 -0
  106. package/esm/contracts/planner/planner.contract.d.mts +60 -0
  107. package/esm/contracts/planner/planner.contract.d.mts.map +1 -0
  108. package/esm/contracts/result/base-report.type.d.mts +7 -2
  109. package/esm/contracts/result/base-report.type.d.mts.map +1 -1
  110. package/esm/contracts/result/base-report.type.mjs.map +1 -1
  111. package/esm/contracts/result/index.d.mts +2 -1
  112. package/esm/contracts/result/model-pricing.type.d.mts +10 -0
  113. package/esm/contracts/result/model-pricing.type.d.mts.map +1 -1
  114. package/esm/contracts/result/orchestrator-result.type.d.mts +139 -0
  115. package/esm/contracts/result/orchestrator-result.type.d.mts.map +1 -0
  116. package/esm/contracts/result/session-send-result.type.d.mts +12 -3
  117. package/esm/contracts/result/session-send-result.type.d.mts.map +1 -1
  118. package/esm/contracts/result/supervisor-result.type.d.mts +1 -1
  119. package/esm/contracts/result/usage.type.d.mts +24 -0
  120. package/esm/contracts/result/usage.type.d.mts.map +1 -1
  121. package/esm/contracts/sdk-adapter.contract.d.mts +1 -1
  122. package/esm/contracts/supervisor/dispatch-context.type.d.mts +3 -3
  123. package/esm/contracts/supervisor/evaluate-context.type.d.mts +1 -1
  124. package/esm/contracts/supervisor/index.d.mts +5 -5
  125. package/esm/contracts/supervisor/route-context.type.d.mts +2 -2
  126. package/esm/contracts/supervisor/supervisor-config.type.d.mts +55 -13
  127. package/esm/contracts/supervisor/supervisor-config.type.d.mts.map +1 -1
  128. package/esm/contracts/supervisor/supervisor-snapshot.type.d.mts +1 -1
  129. package/esm/contracts/supervisor/supervisor.contract.d.mts +9 -2
  130. package/esm/contracts/supervisor/supervisor.contract.d.mts.map +1 -1
  131. package/esm/contracts/workflow/index.d.mts +2 -2
  132. package/esm/contracts/workflow/workflow.contract.d.mts +28 -7
  133. package/esm/contracts/workflow/workflow.contract.d.mts.map +1 -1
  134. package/esm/errors/error-code.type.d.mts +1 -1
  135. package/esm/errors/index.d.mts +7 -0
  136. package/esm/errors/index.mjs +7 -0
  137. package/esm/errors/orchestrator-cancelled-error.d.mts +32 -0
  138. package/esm/errors/orchestrator-cancelled-error.d.mts.map +1 -0
  139. package/esm/errors/orchestrator-cancelled-error.mjs +31 -0
  140. package/esm/errors/orchestrator-cancelled-error.mjs.map +1 -0
  141. package/esm/errors/orchestrator-config-error.d.mts +26 -0
  142. package/esm/errors/orchestrator-config-error.d.mts.map +1 -0
  143. package/esm/errors/orchestrator-config-error.mjs +30 -0
  144. package/esm/errors/orchestrator-config-error.mjs.map +1 -0
  145. package/esm/errors/orchestrator-drift-error.d.mts +38 -0
  146. package/esm/errors/orchestrator-drift-error.d.mts.map +1 -0
  147. package/esm/errors/orchestrator-drift-error.mjs +37 -0
  148. package/esm/errors/orchestrator-drift-error.mjs.map +1 -0
  149. package/esm/errors/orchestrator-failed-error.d.mts +33 -0
  150. package/esm/errors/orchestrator-failed-error.d.mts.map +1 -0
  151. package/esm/errors/orchestrator-failed-error.mjs +36 -0
  152. package/esm/errors/orchestrator-failed-error.mjs.map +1 -0
  153. package/esm/errors/planner-cancelled-error.d.mts +33 -0
  154. package/esm/errors/planner-cancelled-error.d.mts.map +1 -0
  155. package/esm/errors/planner-cancelled-error.mjs +29 -0
  156. package/esm/errors/planner-cancelled-error.mjs.map +1 -0
  157. package/esm/errors/planner-failed-error.d.mts +40 -0
  158. package/esm/errors/planner-failed-error.d.mts.map +1 -0
  159. package/esm/errors/planner-failed-error.mjs +37 -0
  160. package/esm/errors/planner-failed-error.mjs.map +1 -0
  161. package/esm/errors/planner-plan-invalid-error.d.mts +21 -0
  162. package/esm/errors/planner-plan-invalid-error.d.mts.map +1 -0
  163. package/esm/errors/planner-plan-invalid-error.mjs +25 -0
  164. package/esm/errors/planner-plan-invalid-error.mjs.map +1 -0
  165. package/esm/eval/eval-runner.d.mts +17 -0
  166. package/esm/eval/eval-runner.d.mts.map +1 -0
  167. package/esm/eval/eval-runner.mjs +121 -0
  168. package/esm/eval/eval-runner.mjs.map +1 -0
  169. package/esm/eval/index.d.mts +29 -0
  170. package/esm/eval/index.d.mts.map +1 -0
  171. package/esm/eval/index.mjs +30 -0
  172. package/esm/eval/index.mjs.map +1 -0
  173. package/esm/eval/judge-scorer.d.mts +21 -0
  174. package/esm/eval/judge-scorer.d.mts.map +1 -0
  175. package/esm/eval/judge-scorer.mjs +87 -0
  176. package/esm/eval/judge-scorer.mjs.map +1 -0
  177. package/esm/eval/scorers.d.mts +50 -0
  178. package/esm/eval/scorers.d.mts.map +1 -0
  179. package/esm/eval/scorers.mjs +101 -0
  180. package/esm/eval/scorers.mjs.map +1 -0
  181. package/esm/index.d.mts +95 -30
  182. package/esm/index.mjs +66 -22
  183. package/esm/memory/derive-id.mjs +24 -0
  184. package/esm/memory/derive-id.mjs.map +1 -0
  185. package/esm/memory/episodic-memory.mjs +106 -0
  186. package/esm/memory/episodic-memory.mjs.map +1 -0
  187. package/esm/memory/index.d.mts +5 -0
  188. package/esm/memory/memory.d.mts +42 -0
  189. package/esm/memory/memory.d.mts.map +1 -0
  190. package/esm/memory/memory.mjs +166 -0
  191. package/esm/memory/memory.mjs.map +1 -0
  192. package/esm/memory/procedural-memory.mjs +103 -0
  193. package/esm/memory/procedural-memory.mjs.map +1 -0
  194. package/esm/memory/semantic-memory.mjs +80 -0
  195. package/esm/memory/semantic-memory.mjs.map +1 -0
  196. package/esm/memory/working-memory.mjs +62 -0
  197. package/esm/memory/working-memory.mjs.map +1 -0
  198. package/esm/middleware/builtins/budget-contract.type.d.mts +126 -0
  199. package/esm/middleware/builtins/budget-contract.type.d.mts.map +1 -0
  200. package/esm/middleware/builtins/budget.d.mts +71 -1
  201. package/esm/middleware/builtins/budget.d.mts.map +1 -1
  202. package/esm/middleware/builtins/budget.mjs +119 -4
  203. package/esm/middleware/builtins/budget.mjs.map +1 -1
  204. package/esm/middleware/builtins/semantic-cache.d.mts +1 -1
  205. package/esm/middleware/index.d.mts +2 -1
  206. package/esm/middleware/index.mjs +1 -1
  207. package/esm/middleware/pipeline.d.mts +9 -6
  208. package/esm/middleware/pipeline.d.mts.map +1 -1
  209. package/esm/middleware/pipeline.mjs.map +1 -1
  210. package/esm/mock/index.d.mts +1 -0
  211. package/esm/mock/index.mjs +1 -0
  212. package/esm/mock/mock-router.d.mts +63 -0
  213. package/esm/mock/mock-router.d.mts.map +1 -0
  214. package/esm/mock/mock-router.mjs +58 -0
  215. package/esm/mock/mock-router.mjs.map +1 -0
  216. package/esm/model/fallback-model.d.mts +45 -0
  217. package/esm/model/fallback-model.d.mts.map +1 -0
  218. package/esm/model/fallback-model.mjs +218 -0
  219. package/esm/model/fallback-model.mjs.map +1 -0
  220. package/esm/model/index.d.mts +2 -0
  221. package/esm/model/index.mjs +3 -0
  222. package/esm/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +78 -0
  223. package/esm/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +1 -0
  224. package/esm/node_modules/@vitest/expect/dist/index.mjs +1473 -0
  225. package/esm/node_modules/@vitest/expect/dist/index.mjs.map +1 -0
  226. package/esm/node_modules/@vitest/pretty-format/dist/index.mjs +888 -0
  227. package/esm/node_modules/@vitest/pretty-format/dist/index.mjs.map +1 -0
  228. package/esm/node_modules/@vitest/runner/dist/chunk-artifact.mjs +1533 -0
  229. package/esm/node_modules/@vitest/runner/dist/chunk-artifact.mjs.map +1 -0
  230. package/esm/node_modules/@vitest/runner/dist/index.mjs +3 -0
  231. package/esm/node_modules/@vitest/runner/dist/utils.mjs +3 -0
  232. package/esm/node_modules/@vitest/snapshot/dist/index.mjs +922 -0
  233. package/esm/node_modules/@vitest/snapshot/dist/index.mjs.map +1 -0
  234. package/esm/node_modules/@vitest/spy/dist/index.mjs +386 -0
  235. package/esm/node_modules/@vitest/spy/dist/index.mjs.map +1 -0
  236. package/esm/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs +82 -0
  237. package/esm/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs.map +1 -0
  238. package/esm/node_modules/@vitest/utils/dist/diff.mjs +1357 -0
  239. package/esm/node_modules/@vitest/utils/dist/diff.mjs.map +1 -0
  240. package/esm/node_modules/@vitest/utils/dist/display.mjs +559 -0
  241. package/esm/node_modules/@vitest/utils/dist/display.mjs.map +1 -0
  242. package/esm/node_modules/@vitest/utils/dist/error.mjs +38 -0
  243. package/esm/node_modules/@vitest/utils/dist/error.mjs.map +1 -0
  244. package/esm/node_modules/@vitest/utils/dist/helpers.mjs +181 -0
  245. package/esm/node_modules/@vitest/utils/dist/helpers.mjs.map +1 -0
  246. package/esm/node_modules/@vitest/utils/dist/offset.mjs +27 -0
  247. package/esm/node_modules/@vitest/utils/dist/offset.mjs.map +1 -0
  248. package/esm/node_modules/@vitest/utils/dist/serialize.mjs +77 -0
  249. package/esm/node_modules/@vitest/utils/dist/serialize.mjs.map +1 -0
  250. package/esm/node_modules/@vitest/utils/dist/source-map.mjs +374 -0
  251. package/esm/node_modules/@vitest/utils/dist/source-map.mjs.map +1 -0
  252. package/esm/node_modules/@vitest/utils/dist/timers.mjs +37 -0
  253. package/esm/node_modules/@vitest/utils/dist/timers.mjs.map +1 -0
  254. package/esm/node_modules/chai/index.mjs +2973 -0
  255. package/esm/node_modules/chai/index.mjs.map +1 -0
  256. package/esm/node_modules/magic-string/dist/magic-string.es.mjs +940 -0
  257. package/esm/node_modules/magic-string/dist/magic-string.es.mjs.map +1 -0
  258. package/esm/node_modules/tinyrainbow/dist/index.mjs +87 -0
  259. package/esm/node_modules/tinyrainbow/dist/index.mjs.map +1 -0
  260. package/esm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs +6 -0
  261. package/esm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs.map +1 -0
  262. package/esm/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs +52 -0
  263. package/esm/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs.map +1 -0
  264. package/esm/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs +2697 -0
  265. package/esm/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs.map +1 -0
  266. package/esm/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs +45 -0
  267. package/esm/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs.map +1 -0
  268. package/esm/orchestrator/as-tool.d.mts +42 -0
  269. package/esm/orchestrator/as-tool.d.mts.map +1 -0
  270. package/esm/orchestrator/as-tool.mjs +98 -0
  271. package/esm/orchestrator/as-tool.mjs.map +1 -0
  272. package/esm/orchestrator/checkpoint.mjs +75 -0
  273. package/esm/orchestrator/checkpoint.mjs.map +1 -0
  274. package/esm/orchestrator/commands.d.mts +38 -0
  275. package/esm/orchestrator/commands.d.mts.map +1 -0
  276. package/esm/orchestrator/commands.mjs +34 -0
  277. package/esm/orchestrator/commands.mjs.map +1 -0
  278. package/esm/orchestrator/compaction.mjs +206 -0
  279. package/esm/orchestrator/compaction.mjs.map +1 -0
  280. package/esm/orchestrator/dispatch.mjs +171 -0
  281. package/esm/orchestrator/dispatch.mjs.map +1 -0
  282. package/esm/orchestrator/emitter-port.type.d.mts +31 -0
  283. package/esm/orchestrator/emitter-port.type.d.mts.map +1 -0
  284. package/esm/orchestrator/emitter.d.mts +56 -0
  285. package/esm/orchestrator/emitter.d.mts.map +1 -0
  286. package/esm/orchestrator/emitter.mjs +85 -0
  287. package/esm/orchestrator/emitter.mjs.map +1 -0
  288. package/esm/orchestrator/engine-context.type.d.mts +56 -0
  289. package/esm/orchestrator/engine-context.type.d.mts.map +1 -0
  290. package/esm/orchestrator/execution.d.mts +116 -0
  291. package/esm/orchestrator/execution.d.mts.map +1 -0
  292. package/esm/orchestrator/execution.mjs +406 -0
  293. package/esm/orchestrator/execution.mjs.map +1 -0
  294. package/esm/orchestrator/index.d.mts +8 -0
  295. package/esm/orchestrator/index.mjs +10 -0
  296. package/esm/orchestrator/load.mjs +49 -0
  297. package/esm/orchestrator/load.mjs.map +1 -0
  298. package/esm/orchestrator/lock.mjs +75 -0
  299. package/esm/orchestrator/lock.mjs.map +1 -0
  300. package/esm/orchestrator/memory.d.mts +84 -0
  301. package/esm/orchestrator/memory.d.mts.map +1 -0
  302. package/esm/orchestrator/memory.mjs +141 -0
  303. package/esm/orchestrator/memory.mjs.map +1 -0
  304. package/esm/orchestrator/orchestrator-stream.d.mts +42 -0
  305. package/esm/orchestrator/orchestrator-stream.d.mts.map +1 -0
  306. package/esm/orchestrator/orchestrator-stream.mjs +98 -0
  307. package/esm/orchestrator/orchestrator-stream.mjs.map +1 -0
  308. package/esm/orchestrator/orchestrator.d.mts +38 -0
  309. package/esm/orchestrator/orchestrator.d.mts.map +1 -0
  310. package/esm/orchestrator/orchestrator.mjs +173 -0
  311. package/esm/orchestrator/orchestrator.mjs.map +1 -0
  312. package/esm/orchestrator/resume.mjs +74 -0
  313. package/esm/orchestrator/resume.mjs.map +1 -0
  314. package/esm/orchestrator/signature.d.mts +40 -0
  315. package/esm/orchestrator/signature.d.mts.map +1 -0
  316. package/esm/orchestrator/signature.mjs +120 -0
  317. package/esm/orchestrator/signature.mjs.map +1 -0
  318. package/esm/orchestrator/window.mjs +56 -0
  319. package/esm/orchestrator/window.mjs.map +1 -0
  320. package/esm/planner/index.d.mts +5 -0
  321. package/esm/planner/index.mjs +6 -0
  322. package/esm/planner/plan-prompt.d.mts +17 -0
  323. package/esm/planner/plan-prompt.d.mts.map +1 -0
  324. package/esm/planner/plan-prompt.mjs +30 -0
  325. package/esm/planner/plan-prompt.mjs.map +1 -0
  326. package/esm/planner/plan-schema.d.mts +27 -0
  327. package/esm/planner/plan-schema.d.mts.map +1 -0
  328. package/esm/planner/plan-schema.mjs +117 -0
  329. package/esm/planner/plan-schema.mjs.map +1 -0
  330. package/esm/planner/planner-run.d.mts +23 -0
  331. package/esm/planner/planner-run.d.mts.map +1 -0
  332. package/esm/planner/planner-run.mjs +344 -0
  333. package/esm/planner/planner-run.mjs.map +1 -0
  334. package/esm/planner/planner.d.mts +37 -0
  335. package/esm/planner/planner.d.mts.map +1 -0
  336. package/esm/planner/planner.mjs +120 -0
  337. package/esm/planner/planner.mjs.map +1 -0
  338. package/esm/planner/signature.d.mts +18 -0
  339. package/esm/planner/signature.d.mts.map +1 -0
  340. package/esm/planner/signature.mjs +27 -0
  341. package/esm/planner/signature.mjs.map +1 -0
  342. package/esm/snapshot/index.d.mts +3 -0
  343. package/esm/snapshot/memory.d.mts +26 -0
  344. package/esm/snapshot/memory.d.mts.map +1 -0
  345. package/esm/snapshot/memory.mjs +81 -0
  346. package/esm/snapshot/memory.mjs.map +1 -0
  347. package/esm/snapshot/pg.d.mts +41 -0
  348. package/esm/snapshot/pg.d.mts.map +1 -0
  349. package/esm/snapshot/pg.mjs +146 -0
  350. package/esm/snapshot/pg.mjs.map +1 -0
  351. package/esm/snapshot/redis.d.mts +42 -0
  352. package/esm/snapshot/redis.d.mts.map +1 -0
  353. package/esm/snapshot/redis.mjs +101 -0
  354. package/esm/snapshot/redis.mjs.map +1 -0
  355. package/esm/supervisor/as-tool.d.mts +0 -6
  356. package/esm/supervisor/as-tool.d.mts.map +1 -1
  357. package/esm/supervisor/as-tool.mjs +0 -6
  358. package/esm/supervisor/as-tool.mjs.map +1 -1
  359. package/esm/supervisor/execution.d.mts +43 -8
  360. package/esm/supervisor/execution.d.mts.map +1 -1
  361. package/esm/supervisor/execution.mjs +66 -16
  362. package/esm/supervisor/execution.mjs.map +1 -1
  363. package/esm/supervisor/fan-out.d.mts +65 -0
  364. package/esm/supervisor/fan-out.d.mts.map +1 -0
  365. package/esm/supervisor/fan-out.mjs +65 -0
  366. package/esm/supervisor/fan-out.mjs.map +1 -0
  367. package/esm/supervisor/index.d.mts +5 -3
  368. package/esm/supervisor/index.mjs +3 -1
  369. package/esm/supervisor/router-factory.d.mts +110 -0
  370. package/esm/supervisor/router-factory.d.mts.map +1 -0
  371. package/esm/supervisor/router-factory.mjs +141 -0
  372. package/esm/supervisor/router-factory.mjs.map +1 -0
  373. package/esm/supervisor/router-prompt.d.mts +1 -1
  374. package/esm/supervisor/snapshot.d.mts +4 -10
  375. package/esm/supervisor/snapshot.d.mts.map +1 -1
  376. package/esm/supervisor/snapshot.mjs +8 -16
  377. package/esm/supervisor/snapshot.mjs.map +1 -1
  378. package/esm/supervisor/supervisor.mjs +1 -0
  379. package/esm/supervisor/supervisor.mjs.map +1 -1
  380. package/esm/system-prompt/index.mjs +6 -0
  381. package/esm/system-prompt/system-prompt.d.mts +51 -3
  382. package/esm/system-prompt/system-prompt.d.mts.map +1 -1
  383. package/esm/system-prompt/system-prompt.mjs +52 -6
  384. package/esm/system-prompt/system-prompt.mjs.map +1 -1
  385. package/esm/testing/matcher-logic.d.mts +76 -0
  386. package/esm/testing/matcher-logic.d.mts.map +1 -0
  387. package/esm/testing/matcher-logic.mjs +144 -0
  388. package/esm/testing/matcher-logic.mjs.map +1 -0
  389. package/esm/testing/matchers.d.mts +48 -0
  390. package/esm/testing/matchers.d.mts.map +1 -0
  391. package/esm/testing/matchers.mjs +37 -0
  392. package/esm/testing/matchers.mjs.map +1 -0
  393. package/esm/testing/register-lazy.d.mts +20 -0
  394. package/esm/testing/register-lazy.d.mts.map +1 -0
  395. package/esm/testing/register-lazy.mjs +24 -0
  396. package/esm/testing/register-lazy.mjs.map +1 -0
  397. package/esm/tool/executable-as-tool.d.mts +87 -0
  398. package/esm/tool/executable-as-tool.d.mts.map +1 -0
  399. package/esm/tool/executable-as-tool.mjs +81 -0
  400. package/esm/tool/executable-as-tool.mjs.map +1 -0
  401. package/esm/tool/index.d.mts +2 -1
  402. package/esm/tool/index.mjs +1 -0
  403. package/esm/workflow/as-tool.mjs +0 -6
  404. package/esm/workflow/as-tool.mjs.map +1 -1
  405. package/esm/workflow/engine.mjs +2 -2
  406. package/esm/workflow/snapshot.mjs +13 -7
  407. package/esm/workflow/snapshot.mjs.map +1 -1
  408. package/esm/workflow/step-runner.mjs +1 -1
  409. package/esm/workflow/workflow.mjs +1 -0
  410. package/esm/workflow/workflow.mjs.map +1 -1
  411. package/llms-full.txt +947 -42
  412. package/llms.txt +13 -8
  413. package/package.json +3 -3
  414. package/skills/README.md +25 -5
  415. package/skills/ai-basics/SKILL.md +18 -7
  416. package/skills/ai-dx-helpers/SKILL.md +180 -0
  417. package/skills/attach-ai-middleware/SKILL.md +32 -3
  418. package/skills/handle-ai-errors/SKILL.md +20 -6
  419. package/skills/manage-ai-stores/SKILL.md +127 -0
  420. package/skills/persist-ai-data/SKILL.md +21 -10
  421. package/skills/pick-ai-provider/SKILL.md +46 -12
  422. package/skills/run-ai-agent/SKILL.md +51 -2
  423. package/skills/run-orchestrator/SKILL.md +198 -0
  424. package/skills/run-planner/SKILL.md +68 -0
  425. package/skills/run-supervisor/SKILL.md +47 -2
  426. package/skills/use-ai-memory/SKILL.md +124 -0
  427. 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,82 @@
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
+ * so {@link PlannerReport} narrows `type` against the shared union
13
+ * directly rather than overriding it.
14
+ */
15
+ type PlannerReportType = "planner";
16
+ /**
17
+ * Forensic record of a single executed plan step on
18
+ * {@link PlannerReport.executedSteps}.
19
+ *
20
+ * Mirrors the supervisor/orchestrator snapshot shape so a step reads
21
+ * uniformly. Frozen-friendly plain data — the dispatched capability's
22
+ * full report tree lives on `childReport` AND under
23
+ * {@link BaseReport.children}, matching the universal rollup invariant.
24
+ */
25
+ type PlannerStepSnapshot = {
26
+ /** 0-based position of this step in the executed plan. */index: number; /** The plan step that drove this dispatch. */
27
+ step: PlannerStep; /** Terminal status of this step's capability dispatch. */
28
+ status: "completed" | "failed" | "skipped"; /** The capability's typed output when it completed, if any. */
29
+ output?: unknown; /** Typed failure cause when the step failed; undefined on success. */
30
+ error?: AIError;
31
+ startedAt: string;
32
+ endedAt: string;
33
+ duration: number;
34
+ usage: Usage; /** The dispatched capability's full report tree. */
35
+ childReport?: BaseReport;
36
+ };
37
+ /**
38
+ * Planner-specific execution report — {@link BaseReport} plus the
39
+ * generated plan, the per-step execution snapshots, and the planner's
40
+ * structural signature.
41
+ *
42
+ * `children[]` carries every capability dispatched during plan
43
+ * execution, in execution order — the cross-cutting tree view shared
44
+ * with every other primitive. `executedSteps` is the authoritative
45
+ * per-step record (one entry per step the planner attempted), and
46
+ * `plan` is the verbatim LLM output before any step ran.
47
+ */
48
+ type PlannerReport = BaseReport & {
49
+ type: PlannerReportType; /** Structural fingerprint — same value exposed on the planner instance. */
50
+ signature: string; /** The full plan the planner's LLM generated before execution began. */
51
+ plan?: PlannerPlan; /** Per-step forensic records, in execution order. */
52
+ executedSteps: PlannerStepSnapshot[]; /** ISO-8601 timestamp when cancellation was observed, if any. */
53
+ cancelledAt?: string;
54
+ };
55
+ /**
56
+ * Result returned by `planner.execute()`. Satisfies the unified
57
+ * {@link ExecuteResult} envelope — `usage` and `report` are the
58
+ * rolled-up totals across the plan-generation trip plus every executed
59
+ * step — and adds the planner discriminant.
60
+ *
61
+ * `data` holds the final step's typed output (or the planner's
62
+ * structured `output` when an `output` schema was configured). On
63
+ * failure or cancellation it is `undefined`; `error` carries the typed
64
+ * cause and `report.status` narrows further.
65
+ *
66
+ * @example
67
+ * const { data, report, usage, error } = await planner.execute(goal);
68
+ *
69
+ * if (error) {
70
+ * logger.error(error.code, { steps: report.executedSteps.length });
71
+ * return;
72
+ * }
73
+ *
74
+ * console.log(report.plan?.summary, usage.total);
75
+ */
76
+ type PlannerResult<TOutput = unknown> = ExecuteResult<TOutput> & {
77
+ /** Discriminant for narrowing a heterogeneous result union. */type: "planner";
78
+ report: PlannerReport;
79
+ };
80
+ //#endregion
81
+ export { PlannerReport, PlannerReportType, PlannerResult, PlannerStepSnapshot };
82
+ //# 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":";;;;;;;;;AAaA;;;;AAA6B;KAAjB,iBAAA;;;;;;;;;;KAWA,mBAAA;EAIJ,0DAFN,KAAA,UAMA;EAJA,IAAA,EAAM,WAAA,EAME;EAJR,MAAA,sCAMA;EAJA,MAAA,YAMA;EAJA,KAAA,GAAQ,OAAA;EACR,SAAA;EACA,OAAA;EACA,QAAA;EACA,KAAA,EAAO,KAAA,EAgBG;EAdV,WAAA,GAAc,UAAA;AAAA;;;;;;;;;;;;KAcJ,aAAA,GAAgB,UAAA;EAC1B,IAAA,EAAM,iBAAA,EAMS;EAJf,SAAA,UAMW;EAJX,IAAA,GAAO,WAAA,EA4BG;EA1BV,aAAA,EAAe,mBAAA,IA0BQ;EAxBvB,WAAA;AAAA;;;;;;;;;;;AA2BqB;;;;;;;;;;;KAHX,aAAA,sBAAmC,aAAA,CAAc,OAAA;iEAE3D,IAAA;EACA,MAAA,EAAQ,aAAA;AAAA"}