@warlock.js/ai 4.4.0 → 4.6.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 (648) hide show
  1. package/CHANGELOG.md +63 -52
  2. package/cjs/index.cjs +240 -14147
  3. package/cjs/src-Bmajk4Qg.cjs +30 -0
  4. package/cjs/src-OZyDYHxm.cjs +25089 -0
  5. package/cjs/src-OZyDYHxm.cjs.map +1 -0
  6. package/esm/agent/agent-config.type.d.mts +119 -1
  7. package/esm/agent/agent-config.type.d.mts.map +1 -1
  8. package/esm/agent/agent-input-builder.mjs +27 -6
  9. package/esm/agent/agent-input-builder.mjs.map +1 -1
  10. package/esm/agent/agent.d.mts +40 -1
  11. package/esm/agent/agent.d.mts.map +1 -1
  12. package/esm/agent/agent.mjs +328 -36
  13. package/esm/agent/agent.mjs.map +1 -1
  14. package/esm/agent/index.d.mts +2 -1
  15. package/esm/agent/index.mjs +1 -0
  16. package/esm/agent/judge-config.type.d.mts +33 -0
  17. package/esm/agent/judge-config.type.d.mts.map +1 -0
  18. package/esm/agent/judge-config.type.mjs +13 -0
  19. package/esm/agent/judge-config.type.mjs.map +1 -0
  20. package/esm/agent/signature.mjs +57 -0
  21. package/esm/agent/signature.mjs.map +1 -0
  22. package/esm/agent/snapshot.mjs +101 -0
  23. package/esm/agent/snapshot.mjs.map +1 -0
  24. package/esm/ai-openai/src/embedder.mjs +4 -0
  25. package/esm/ai-openai/src/image.mjs +5 -0
  26. package/esm/ai-openai/src/index.mjs +7 -0
  27. package/esm/ai-openai/src/model.mjs +5 -0
  28. package/esm/ai-openai/src/sdk.mjs +9 -0
  29. package/esm/ai-openai/src/speech.mjs +5 -0
  30. package/esm/ai-openai/src/transcription.mjs +6 -0
  31. package/esm/ai-openai/src/utils/index.mjs +5 -0
  32. package/esm/ai-openai/src/utils/to-openai-messages.mjs +3 -0
  33. package/esm/ai-openai/src/utils/to-openai-tools.mjs +3 -0
  34. package/esm/ai-openai/src/utils/wrap-openai-error.mjs +4 -0
  35. package/esm/ai.d.mts +164 -53
  36. package/esm/ai.d.mts.map +1 -1
  37. package/esm/ai.mjs +79 -8
  38. package/esm/ai.mjs.map +1 -1
  39. package/esm/batch/batch.d.mts.map +1 -1
  40. package/esm/batch/batch.mjs +21 -1
  41. package/esm/batch/batch.mjs.map +1 -1
  42. package/esm/batch/batch.type.d.mts +11 -4
  43. package/esm/batch/batch.type.d.mts.map +1 -1
  44. package/esm/config.d.mts +39 -3
  45. package/esm/config.d.mts.map +1 -1
  46. package/esm/config.mjs +26 -2
  47. package/esm/config.mjs.map +1 -1
  48. package/esm/contracts/agent/agent-options.type.d.mts +33 -5
  49. package/esm/contracts/agent/agent-options.type.d.mts.map +1 -1
  50. package/esm/contracts/agent/agent-snapshot.type.d.mts +90 -0
  51. package/esm/contracts/agent/agent-snapshot.type.d.mts.map +1 -0
  52. package/esm/contracts/agent/agent.contract.d.mts +29 -1
  53. package/esm/contracts/agent/agent.contract.d.mts.map +1 -1
  54. package/esm/contracts/agent/eval.type.d.mts +43 -2
  55. package/esm/contracts/agent/eval.type.d.mts.map +1 -1
  56. package/esm/contracts/agent/index.d.mts +2 -1
  57. package/esm/contracts/attachment-policy.type.d.mts +51 -0
  58. package/esm/contracts/attachment-policy.type.d.mts.map +1 -0
  59. package/esm/contracts/attachment.type.d.mts +16 -7
  60. package/esm/contracts/attachment.type.d.mts.map +1 -1
  61. package/esm/contracts/content-part.type.d.mts +14 -5
  62. package/esm/contracts/content-part.type.d.mts.map +1 -1
  63. package/esm/contracts/events/supervisor-events.type.d.mts.map +1 -1
  64. package/esm/contracts/image-model.contract.d.mts +156 -0
  65. package/esm/contracts/image-model.contract.d.mts.map +1 -0
  66. package/esm/contracts/index.d.mts +13 -6
  67. package/esm/contracts/model.contract.d.mts +11 -8
  68. package/esm/contracts/model.contract.d.mts.map +1 -1
  69. package/esm/contracts/orchestrator/index.d.mts +1 -0
  70. package/esm/contracts/orchestrator/orchestrator-config.type.d.mts +31 -2
  71. package/esm/contracts/orchestrator/orchestrator-config.type.d.mts.map +1 -1
  72. package/esm/contracts/orchestrator/session-lock.contract.d.mts +47 -0
  73. package/esm/contracts/orchestrator/session-lock.contract.d.mts.map +1 -0
  74. package/esm/contracts/planner/index.d.mts +3 -2
  75. package/esm/contracts/planner/planner-config.type.d.mts +61 -0
  76. package/esm/contracts/planner/planner-config.type.d.mts.map +1 -1
  77. package/esm/contracts/planner/planner-execute-options.type.d.mts +60 -1
  78. package/esm/contracts/planner/planner-execute-options.type.d.mts.map +1 -1
  79. package/esm/contracts/planner/planner-result.type.d.mts +8 -0
  80. package/esm/contracts/planner/planner-result.type.d.mts.map +1 -1
  81. package/esm/contracts/planner/planner-snapshot.type.d.mts +77 -0
  82. package/esm/contracts/planner/planner-snapshot.type.d.mts.map +1 -0
  83. package/esm/contracts/planner/planner.contract.d.mts +21 -1
  84. package/esm/contracts/planner/planner.contract.d.mts.map +1 -1
  85. package/esm/contracts/result/agent-result.type.d.mts +6 -4
  86. package/esm/contracts/result/agent-result.type.d.mts.map +1 -1
  87. package/esm/contracts/result/base-report.type.d.mts +21 -3
  88. package/esm/contracts/result/base-report.type.d.mts.map +1 -1
  89. package/esm/contracts/result/base-report.type.mjs.map +1 -1
  90. package/esm/contracts/result/execution-report.type.d.mts +53 -1
  91. package/esm/contracts/result/execution-report.type.d.mts.map +1 -1
  92. package/esm/contracts/result/supervisor-result.type.d.mts +14 -2
  93. package/esm/contracts/result/supervisor-result.type.d.mts.map +1 -1
  94. package/esm/contracts/result/workflow-result.type.d.mts +2 -1
  95. package/esm/contracts/result/workflow-result.type.d.mts.map +1 -1
  96. package/esm/contracts/sdk-adapter.contract.d.mts +37 -0
  97. package/esm/contracts/sdk-adapter.contract.d.mts.map +1 -1
  98. package/esm/contracts/speech-model.contract.d.mts +97 -0
  99. package/esm/contracts/speech-model.contract.d.mts.map +1 -0
  100. package/esm/contracts/supervisor/supervisor-config.type.d.mts +29 -0
  101. package/esm/contracts/supervisor/supervisor-config.type.d.mts.map +1 -1
  102. package/esm/contracts/system-prompt.contract.d.mts +103 -1
  103. package/esm/contracts/system-prompt.contract.d.mts.map +1 -1
  104. package/esm/contracts/team/index.d.mts +1 -0
  105. package/esm/contracts/team/team-config.type.d.mts +127 -0
  106. package/esm/contracts/team/team-config.type.d.mts.map +1 -0
  107. package/esm/contracts/tool.contract.d.mts +4 -2
  108. package/esm/contracts/tool.contract.d.mts.map +1 -1
  109. package/esm/contracts/transcription-model.contract.d.mts +101 -0
  110. package/esm/contracts/transcription-model.contract.d.mts.map +1 -0
  111. package/esm/contracts/workflow/step.contract.d.mts +30 -5
  112. package/esm/contracts/workflow/step.contract.d.mts.map +1 -1
  113. package/esm/contracts/workflow/workflow.contract.d.mts +16 -0
  114. package/esm/contracts/workflow/workflow.contract.d.mts.map +1 -1
  115. package/esm/errors/agent-drift-error.d.mts +32 -0
  116. package/esm/errors/agent-drift-error.d.mts.map +1 -0
  117. package/esm/errors/agent-drift-error.mjs +31 -0
  118. package/esm/errors/agent-drift-error.mjs.map +1 -0
  119. package/esm/errors/error-code.type.d.mts +1 -1
  120. package/esm/errors/index.d.mts +3 -0
  121. package/esm/errors/index.mjs +3 -0
  122. package/esm/errors/outbound-policy-error.d.mts +27 -0
  123. package/esm/errors/outbound-policy-error.d.mts.map +1 -0
  124. package/esm/errors/outbound-policy-error.mjs +32 -0
  125. package/esm/errors/outbound-policy-error.mjs.map +1 -0
  126. package/esm/errors/planner-drift-error.d.mts +34 -0
  127. package/esm/errors/planner-drift-error.d.mts.map +1 -0
  128. package/esm/errors/planner-drift-error.mjs +33 -0
  129. package/esm/errors/planner-drift-error.mjs.map +1 -0
  130. package/esm/eval/dataset.d.mts +28 -0
  131. package/esm/eval/dataset.d.mts.map +1 -0
  132. package/esm/eval/dataset.mjs +112 -0
  133. package/esm/eval/dataset.mjs.map +1 -0
  134. package/esm/eval/dataset.type.d.mts +53 -0
  135. package/esm/eval/dataset.type.d.mts.map +1 -0
  136. package/esm/eval/eval-runner.d.mts.map +1 -1
  137. package/esm/eval/eval-runner.mjs +16 -2
  138. package/esm/eval/eval-runner.mjs.map +1 -1
  139. package/esm/eval/index.d.mts +20 -1
  140. package/esm/eval/index.d.mts.map +1 -1
  141. package/esm/eval/index.mjs +20 -2
  142. package/esm/eval/index.mjs.map +1 -1
  143. package/esm/eval/regression.d.mts +30 -0
  144. package/esm/eval/regression.d.mts.map +1 -0
  145. package/esm/eval/regression.mjs +51 -0
  146. package/esm/eval/regression.mjs.map +1 -0
  147. package/esm/eval/report-json.d.mts +30 -0
  148. package/esm/eval/report-json.d.mts.map +1 -0
  149. package/esm/eval/report-json.mjs +33 -0
  150. package/esm/eval/report-json.mjs.map +1 -0
  151. package/esm/eval/report-junit.d.mts +22 -0
  152. package/esm/eval/report-junit.d.mts.map +1 -0
  153. package/esm/eval/report-junit.mjs +60 -0
  154. package/esm/eval/report-junit.mjs.map +1 -0
  155. package/esm/guard/contracts/guard-options.type.d.mts +165 -0
  156. package/esm/guard/contracts/guard-options.type.d.mts.map +1 -0
  157. package/esm/guard/contracts/guardrail.contract.d.mts +78 -0
  158. package/esm/guard/contracts/guardrail.contract.d.mts.map +1 -0
  159. package/esm/guard/contracts/index.d.mts +4 -0
  160. package/esm/guard/contracts/openai-client.contract.d.mts +51 -0
  161. package/esm/guard/contracts/openai-client.contract.d.mts.map +1 -0
  162. package/esm/guard/contracts/verdict.type.d.mts +76 -0
  163. package/esm/guard/contracts/verdict.type.d.mts.map +1 -0
  164. package/esm/guard/detectors/index.d.mts +4 -0
  165. package/esm/guard/detectors/index.mjs +6 -0
  166. package/esm/guard/detectors/injection.d.mts +34 -0
  167. package/esm/guard/detectors/injection.d.mts.map +1 -0
  168. package/esm/guard/detectors/injection.mjs +254 -0
  169. package/esm/guard/detectors/injection.mjs.map +1 -0
  170. package/esm/guard/detectors/moderation.d.mts +32 -0
  171. package/esm/guard/detectors/moderation.d.mts.map +1 -0
  172. package/esm/guard/detectors/moderation.mjs +134 -0
  173. package/esm/guard/detectors/moderation.mjs.map +1 -0
  174. package/esm/guard/detectors/pii.d.mts +41 -0
  175. package/esm/guard/detectors/pii.d.mts.map +1 -0
  176. package/esm/guard/detectors/pii.mjs +199 -0
  177. package/esm/guard/detectors/pii.mjs.map +1 -0
  178. package/esm/guard/detectors/topic.d.mts +29 -0
  179. package/esm/guard/detectors/topic.d.mts.map +1 -0
  180. package/esm/guard/detectors/topic.mjs +99 -0
  181. package/esm/guard/detectors/topic.mjs.map +1 -0
  182. package/esm/guard/errors.d.mts +12 -0
  183. package/esm/guard/errors.d.mts.map +1 -0
  184. package/esm/guard/errors.mjs +18 -0
  185. package/esm/guard/errors.mjs.map +1 -0
  186. package/esm/guard/guard.d.mts +67 -0
  187. package/esm/guard/guard.d.mts.map +1 -0
  188. package/esm/guard/guard.mjs +209 -0
  189. package/esm/guard/guard.mjs.map +1 -0
  190. package/esm/guard/guardrail.d.mts +39 -0
  191. package/esm/guard/guardrail.d.mts.map +1 -0
  192. package/esm/guard/guardrail.mjs +22 -0
  193. package/esm/guard/guardrail.mjs.map +1 -0
  194. package/esm/human/contracts/approval.type.d.mts +154 -0
  195. package/esm/human/contracts/approval.type.d.mts.map +1 -0
  196. package/esm/human/contracts/human-approval.type.d.mts +38 -0
  197. package/esm/human/contracts/human-approval.type.d.mts.map +1 -0
  198. package/esm/human/contracts/index.d.mts +4 -0
  199. package/esm/human/contracts/interrupt-store.contract.d.mts +112 -0
  200. package/esm/human/contracts/interrupt-store.contract.d.mts.map +1 -0
  201. package/esm/human/contracts/resume.type.d.mts +77 -0
  202. package/esm/human/contracts/resume.type.d.mts.map +1 -0
  203. package/esm/human/errors.d.mts +84 -0
  204. package/esm/human/errors.d.mts.map +1 -0
  205. package/esm/human/errors.mjs +60 -0
  206. package/esm/human/errors.mjs.map +1 -0
  207. package/esm/human/human-approval.d.mts +57 -0
  208. package/esm/human/human-approval.d.mts.map +1 -0
  209. package/esm/human/human-approval.mjs +170 -0
  210. package/esm/human/human-approval.mjs.map +1 -0
  211. package/esm/human/policy.d.mts +55 -0
  212. package/esm/human/policy.d.mts.map +1 -0
  213. package/esm/human/policy.mjs +67 -0
  214. package/esm/human/policy.mjs.map +1 -0
  215. package/esm/human/register.mjs +37 -0
  216. package/esm/human/register.mjs.map +1 -0
  217. package/esm/human/resume-seed.mjs +53 -0
  218. package/esm/human/resume-seed.mjs.map +1 -0
  219. package/esm/human/resume.d.mts +54 -0
  220. package/esm/human/resume.d.mts.map +1 -0
  221. package/esm/human/resume.mjs +121 -0
  222. package/esm/human/resume.mjs.map +1 -0
  223. package/esm/human/stores/index.mjs +5 -0
  224. package/esm/human/stores/memory.d.mts +30 -0
  225. package/esm/human/stores/memory.d.mts.map +1 -0
  226. package/esm/human/stores/memory.mjs +91 -0
  227. package/esm/human/stores/memory.mjs.map +1 -0
  228. package/esm/human/stores/pg.d.mts +59 -0
  229. package/esm/human/stores/pg.d.mts.map +1 -0
  230. package/esm/human/stores/pg.mjs +220 -0
  231. package/esm/human/stores/pg.mjs.map +1 -0
  232. package/esm/human/stores/redis.d.mts +56 -0
  233. package/esm/human/stores/redis.d.mts.map +1 -0
  234. package/esm/human/stores/redis.mjs +201 -0
  235. package/esm/human/stores/redis.mjs.map +1 -0
  236. package/esm/image/image-cost.d.mts +32 -0
  237. package/esm/image/image-cost.d.mts.map +1 -0
  238. package/esm/image/image-cost.mjs +55 -0
  239. package/esm/image/image-cost.mjs.map +1 -0
  240. package/esm/image/image.d.mts +92 -0
  241. package/esm/image/image.d.mts.map +1 -0
  242. package/esm/image/image.mjs +113 -0
  243. package/esm/image/image.mjs.map +1 -0
  244. package/esm/image/index.mjs +4 -0
  245. package/esm/index.d.mts +137 -24
  246. package/esm/index.mjs +101 -11
  247. package/esm/middleware/builtins/budget.mjs +6 -2
  248. package/esm/middleware/builtins/budget.mjs.map +1 -1
  249. package/esm/middleware/utils/extract-user-text.d.mts +8 -1
  250. package/esm/middleware/utils/extract-user-text.d.mts.map +1 -1
  251. package/esm/middleware/utils/extract-user-text.mjs +8 -1
  252. package/esm/middleware/utils/extract-user-text.mjs.map +1 -1
  253. package/esm/mock/index.d.mts +3 -0
  254. package/esm/mock/index.mjs +3 -0
  255. package/esm/mock/mock-config.type.d.mts +22 -0
  256. package/esm/mock/mock-config.type.d.mts.map +1 -1
  257. package/esm/mock/mock-image-model.d.mts +41 -0
  258. package/esm/mock/mock-image-model.d.mts.map +1 -0
  259. package/esm/mock/mock-image-model.mjs +52 -0
  260. package/esm/mock/mock-image-model.mjs.map +1 -0
  261. package/esm/mock/mock-sdk.d.mts +7 -1
  262. package/esm/mock/mock-sdk.d.mts.map +1 -1
  263. package/esm/mock/mock-sdk.mjs +27 -0
  264. package/esm/mock/mock-sdk.mjs.map +1 -1
  265. package/esm/mock/mock-speech-model.d.mts +31 -0
  266. package/esm/mock/mock-speech-model.d.mts.map +1 -0
  267. package/esm/mock/mock-speech-model.mjs +39 -0
  268. package/esm/mock/mock-speech-model.mjs.map +1 -0
  269. package/esm/mock/mock-transcription-model.d.mts +32 -0
  270. package/esm/mock/mock-transcription-model.d.mts.map +1 -0
  271. package/esm/mock/mock-transcription-model.mjs +36 -0
  272. package/esm/mock/mock-transcription-model.mjs.map +1 -0
  273. package/esm/object-stream/index.d.mts +2 -0
  274. package/esm/object-stream/index.mjs +4 -0
  275. package/esm/object-stream/parse-partial-json.d.mts +22 -0
  276. package/esm/object-stream/parse-partial-json.d.mts.map +1 -0
  277. package/esm/object-stream/parse-partial-json.mjs +78 -0
  278. package/esm/object-stream/parse-partial-json.mjs.map +1 -0
  279. package/esm/object-stream/stream-object.d.mts +68 -0
  280. package/esm/object-stream/stream-object.d.mts.map +1 -0
  281. package/esm/object-stream/stream-object.mjs +104 -0
  282. package/esm/object-stream/stream-object.mjs.map +1 -0
  283. package/esm/observe/index.mjs +4 -0
  284. package/esm/observe/observer-registry.d.mts +30 -0
  285. package/esm/observe/observer-registry.d.mts.map +1 -0
  286. package/esm/observe/observer-registry.mjs +51 -0
  287. package/esm/observe/observer-registry.mjs.map +1 -0
  288. package/esm/observe/observer.contract.d.mts +40 -0
  289. package/esm/observe/observer.contract.d.mts.map +1 -0
  290. package/esm/observe/resolve-observers.d.mts +40 -0
  291. package/esm/observe/resolve-observers.d.mts.map +1 -0
  292. package/esm/observe/resolve-observers.mjs +73 -0
  293. package/esm/observe/resolve-observers.mjs.map +1 -0
  294. package/esm/orchestrator/execution.d.mts.map +1 -1
  295. package/esm/orchestrator/execution.mjs +5 -2
  296. package/esm/orchestrator/execution.mjs.map +1 -1
  297. package/esm/orchestrator/index.d.mts +1 -0
  298. package/esm/orchestrator/index.mjs +1 -0
  299. package/esm/orchestrator/orchestrator.d.mts.map +1 -1
  300. package/esm/orchestrator/orchestrator.mjs +39 -6
  301. package/esm/orchestrator/orchestrator.mjs.map +1 -1
  302. package/esm/orchestrator/session-lock.d.mts +25 -0
  303. package/esm/orchestrator/session-lock.d.mts.map +1 -0
  304. package/esm/orchestrator/session-lock.mjs +83 -0
  305. package/esm/orchestrator/session-lock.mjs.map +1 -0
  306. package/esm/planner/dag-scheduler.mjs +97 -0
  307. package/esm/planner/dag-scheduler.mjs.map +1 -0
  308. package/esm/planner/plan-prompt.d.mts +1 -1
  309. package/esm/planner/plan-prompt.d.mts.map +1 -1
  310. package/esm/planner/plan-prompt.mjs +2 -1
  311. package/esm/planner/plan-prompt.mjs.map +1 -1
  312. package/esm/planner/planner-run.d.mts +8 -0
  313. package/esm/planner/planner-run.d.mts.map +1 -1
  314. package/esm/planner/planner-run.mjs +457 -31
  315. package/esm/planner/planner-run.mjs.map +1 -1
  316. package/esm/planner/planner.d.mts.map +1 -1
  317. package/esm/planner/planner.mjs +26 -2
  318. package/esm/planner/planner.mjs.map +1 -1
  319. package/esm/planner/snapshot.mjs +95 -0
  320. package/esm/planner/snapshot.mjs.map +1 -0
  321. package/esm/prompt/errors.d.mts +57 -0
  322. package/esm/prompt/errors.d.mts.map +1 -0
  323. package/esm/prompt/errors.mjs +73 -0
  324. package/esm/prompt/errors.mjs.map +1 -0
  325. package/esm/prompt/index.d.mts +3 -0
  326. package/esm/prompt/index.mjs +4 -0
  327. package/esm/prompt/prompt-langfuse-sync.mjs +104 -0
  328. package/esm/prompt/prompt-langfuse-sync.mjs.map +1 -0
  329. package/esm/prompt/prompt-langfuse-sync.type.d.mts +32 -0
  330. package/esm/prompt/prompt-langfuse-sync.type.d.mts.map +1 -0
  331. package/esm/prompt/prompt-validate.mjs +170 -0
  332. package/esm/prompt/prompt-validate.mjs.map +1 -0
  333. package/esm/prompt/prompt.d.mts +54 -0
  334. package/esm/prompt/prompt.d.mts.map +1 -0
  335. package/esm/prompt/prompt.mjs +218 -0
  336. package/esm/prompt/prompt.mjs.map +1 -0
  337. package/esm/prompt/prompt.type.d.mts +174 -0
  338. package/esm/prompt/prompt.type.d.mts.map +1 -0
  339. package/esm/prompts/index.d.mts +3 -0
  340. package/esm/prompts/index.mjs +3 -0
  341. package/esm/prompts/prompts-manager.contract.d.mts +154 -0
  342. package/esm/prompts/prompts-manager.contract.d.mts.map +1 -0
  343. package/esm/prompts/prompts-manager.d.mts +38 -0
  344. package/esm/prompts/prompts-manager.d.mts.map +1 -0
  345. package/esm/prompts/prompts-manager.mjs +410 -0
  346. package/esm/prompts/prompts-manager.mjs.map +1 -0
  347. package/esm/prompts/prompts-manager.type.d.mts +172 -0
  348. package/esm/prompts/prompts-manager.type.d.mts.map +1 -0
  349. package/esm/prompts/prompts-validate.mjs +200 -0
  350. package/esm/prompts/prompts-validate.mjs.map +1 -0
  351. package/esm/rag/as-tool.mjs +48 -0
  352. package/esm/rag/as-tool.mjs.map +1 -0
  353. package/esm/rag/chunk/chunk.d.mts +24 -0
  354. package/esm/rag/chunk/chunk.d.mts.map +1 -0
  355. package/esm/rag/chunk/chunk.mjs +44 -0
  356. package/esm/rag/chunk/chunk.mjs.map +1 -0
  357. package/esm/rag/chunk/fixed.mjs +32 -0
  358. package/esm/rag/chunk/fixed.mjs.map +1 -0
  359. package/esm/rag/chunk/markdown.mjs +75 -0
  360. package/esm/rag/chunk/markdown.mjs.map +1 -0
  361. package/esm/rag/chunk/recursive.mjs +132 -0
  362. package/esm/rag/chunk/recursive.mjs.map +1 -0
  363. package/esm/rag/chunk/sentence.mjs +73 -0
  364. package/esm/rag/chunk/sentence.mjs.map +1 -0
  365. package/esm/rag/contracts/chunk-options.type.d.mts +35 -0
  366. package/esm/rag/contracts/chunk-options.type.d.mts.map +1 -0
  367. package/esm/rag/contracts/citation.type.d.mts +35 -0
  368. package/esm/rag/contracts/citation.type.d.mts.map +1 -0
  369. package/esm/rag/contracts/index.d.mts +4 -0
  370. package/esm/rag/contracts/rag-config.type.d.mts +68 -0
  371. package/esm/rag/contracts/rag-config.type.d.mts.map +1 -0
  372. package/esm/rag/contracts/rag-document.type.d.mts +21 -0
  373. package/esm/rag/contracts/rag-document.type.d.mts.map +1 -0
  374. package/esm/rag/hybrid/bm25.d.mts +23 -0
  375. package/esm/rag/hybrid/bm25.d.mts.map +1 -0
  376. package/esm/rag/hybrid/bm25.mjs +51 -0
  377. package/esm/rag/hybrid/bm25.mjs.map +1 -0
  378. package/esm/rag/hybrid/hybrid-rank.d.mts +33 -0
  379. package/esm/rag/hybrid/hybrid-rank.d.mts.map +1 -0
  380. package/esm/rag/hybrid/hybrid-rank.mjs +29 -0
  381. package/esm/rag/hybrid/hybrid-rank.mjs.map +1 -0
  382. package/esm/rag/hybrid/rrf.d.mts +25 -0
  383. package/esm/rag/hybrid/rrf.d.mts.map +1 -0
  384. package/esm/rag/hybrid/rrf.mjs +30 -0
  385. package/esm/rag/hybrid/rrf.mjs.map +1 -0
  386. package/esm/rag/index.d.mts +22 -0
  387. package/esm/rag/index.mjs +18 -0
  388. package/esm/rag/loaders/errors.d.mts +19 -0
  389. package/esm/rag/loaders/errors.d.mts.map +1 -0
  390. package/esm/rag/loaders/errors.mjs +25 -0
  391. package/esm/rag/loaders/errors.mjs.map +1 -0
  392. package/esm/rag/loaders/index.mjs +7 -0
  393. package/esm/rag/loaders/load-html.d.mts +26 -0
  394. package/esm/rag/loaders/load-html.d.mts.map +1 -0
  395. package/esm/rag/loaders/load-html.mjs +138 -0
  396. package/esm/rag/loaders/load-html.mjs.map +1 -0
  397. package/esm/rag/loaders/load-pdf.d.mts +38 -0
  398. package/esm/rag/loaders/load-pdf.d.mts.map +1 -0
  399. package/esm/rag/loaders/load-pdf.mjs +150 -0
  400. package/esm/rag/loaders/load-pdf.mjs.map +1 -0
  401. package/esm/rag/loaders/load-text.d.mts +47 -0
  402. package/esm/rag/loaders/load-text.d.mts.map +1 -0
  403. package/esm/rag/loaders/load-text.mjs +60 -0
  404. package/esm/rag/loaders/load-text.mjs.map +1 -0
  405. package/esm/rag/loaders/load-web.d.mts +42 -0
  406. package/esm/rag/loaders/load-web.d.mts.map +1 -0
  407. package/esm/rag/loaders/load-web.mjs +89 -0
  408. package/esm/rag/loaders/load-web.mjs.map +1 -0
  409. package/esm/rag/loaders/loader.type.d.mts +89 -0
  410. package/esm/rag/loaders/loader.type.d.mts.map +1 -0
  411. package/esm/rag/rag.d.mts +38 -0
  412. package/esm/rag/rag.d.mts.map +1 -0
  413. package/esm/rag/rag.mjs +126 -0
  414. package/esm/rag/rag.mjs.map +1 -0
  415. package/esm/rag/rerank/keyword-reranker.d.mts +32 -0
  416. package/esm/rag/rerank/keyword-reranker.d.mts.map +1 -0
  417. package/esm/rag/rerank/keyword-reranker.mjs +58 -0
  418. package/esm/rag/rerank/keyword-reranker.mjs.map +1 -0
  419. package/esm/rag/rerank/llm-reranker.d.mts +36 -0
  420. package/esm/rag/rerank/llm-reranker.d.mts.map +1 -0
  421. package/esm/rag/rerank/llm-reranker.mjs +85 -0
  422. package/esm/rag/rerank/llm-reranker.mjs.map +1 -0
  423. package/esm/rag/rerank/reranker.contract.d.mts +28 -0
  424. package/esm/rag/rerank/reranker.contract.d.mts.map +1 -0
  425. package/esm/rag/retrieve.mjs +68 -0
  426. package/esm/rag/retrieve.mjs.map +1 -0
  427. package/esm/rag/store/cache-vector-store.d.mts +27 -0
  428. package/esm/rag/store/cache-vector-store.d.mts.map +1 -0
  429. package/esm/rag/store/cache-vector-store.mjs +48 -0
  430. package/esm/rag/store/cache-vector-store.mjs.map +1 -0
  431. package/esm/rag/store/pg-vector-store.d.mts +139 -0
  432. package/esm/rag/store/pg-vector-store.d.mts.map +1 -0
  433. package/esm/rag/store/pg-vector-store.mjs +328 -0
  434. package/esm/rag/store/pg-vector-store.mjs.map +1 -0
  435. package/esm/rag/store/vector-store.contract.d.mts +38 -0
  436. package/esm/rag/store/vector-store.contract.d.mts.map +1 -0
  437. package/esm/rag/transforms/multi-query.d.mts +27 -0
  438. package/esm/rag/transforms/multi-query.d.mts.map +1 -0
  439. package/esm/rag/transforms/multi-query.mjs +41 -0
  440. package/esm/rag/transforms/multi-query.mjs.map +1 -0
  441. package/esm/security/index.mjs +5 -0
  442. package/esm/security/outbound-policy.d.mts +46 -0
  443. package/esm/security/outbound-policy.d.mts.map +1 -0
  444. package/esm/security/outbound-policy.mjs +187 -0
  445. package/esm/security/outbound-policy.mjs.map +1 -0
  446. package/esm/security/outbound-policy.type.d.mts +74 -0
  447. package/esm/security/outbound-policy.type.d.mts.map +1 -0
  448. package/esm/security/private-ip.d.mts +15 -0
  449. package/esm/security/private-ip.d.mts.map +1 -0
  450. package/esm/security/private-ip.mjs +48 -0
  451. package/esm/security/private-ip.mjs.map +1 -0
  452. package/esm/security/redact.d.mts +59 -0
  453. package/esm/security/redact.d.mts.map +1 -0
  454. package/esm/security/redact.mjs +122 -0
  455. package/esm/security/redact.mjs.map +1 -0
  456. package/esm/serve/serve.d.mts +50 -0
  457. package/esm/serve/serve.d.mts.map +1 -0
  458. package/esm/serve/serve.mjs +90 -0
  459. package/esm/serve/serve.mjs.map +1 -0
  460. package/esm/serve/sse.d.mts +20 -0
  461. package/esm/serve/sse.d.mts.map +1 -0
  462. package/esm/serve/sse.mjs +25 -0
  463. package/esm/serve/sse.mjs.map +1 -0
  464. package/esm/serve/stream-to-sse.d.mts +29 -0
  465. package/esm/serve/stream-to-sse.d.mts.map +1 -0
  466. package/esm/serve/stream-to-sse.mjs +37 -0
  467. package/esm/serve/stream-to-sse.mjs.map +1 -0
  468. package/esm/skills/catalog.d.mts +49 -0
  469. package/esm/skills/catalog.d.mts.map +1 -0
  470. package/esm/skills/catalog.mjs +140 -0
  471. package/esm/skills/catalog.mjs.map +1 -0
  472. package/esm/skills/contracts/skill-record.type.d.mts +37 -0
  473. package/esm/skills/contracts/skill-record.type.d.mts.map +1 -0
  474. package/esm/skills/contracts/skills-config.type.d.mts +108 -0
  475. package/esm/skills/contracts/skills-config.type.d.mts.map +1 -0
  476. package/esm/skills/contracts/skills-store.contract.d.mts +28 -0
  477. package/esm/skills/contracts/skills-store.contract.d.mts.map +1 -0
  478. package/esm/skills/contracts/skills.contract.d.mts +43 -0
  479. package/esm/skills/contracts/skills.contract.d.mts.map +1 -0
  480. package/esm/skills/index.d.mts +16 -0
  481. package/esm/skills/index.mjs +14 -0
  482. package/esm/skills/load-skill-tool.d.mts +38 -0
  483. package/esm/skills/load-skill-tool.d.mts.map +1 -0
  484. package/esm/skills/load-skill-tool.mjs +65 -0
  485. package/esm/skills/load-skill-tool.mjs.map +1 -0
  486. package/esm/skills/review-gate.d.mts +33 -0
  487. package/esm/skills/review-gate.d.mts.map +1 -0
  488. package/esm/skills/review-gate.mjs +60 -0
  489. package/esm/skills/review-gate.mjs.map +1 -0
  490. package/esm/skills/save-skill-tool.d.mts +39 -0
  491. package/esm/skills/save-skill-tool.d.mts.map +1 -0
  492. package/esm/skills/save-skill-tool.mjs +65 -0
  493. package/esm/skills/save-skill-tool.mjs.map +1 -0
  494. package/esm/skills/skills.d.mts +33 -0
  495. package/esm/skills/skills.d.mts.map +1 -0
  496. package/esm/skills/skills.mjs +109 -0
  497. package/esm/skills/skills.mjs.map +1 -0
  498. package/esm/skills/sources/directory-source.d.mts +19 -0
  499. package/esm/skills/sources/directory-source.d.mts.map +1 -0
  500. package/esm/skills/sources/directory-source.mjs +108 -0
  501. package/esm/skills/sources/directory-source.mjs.map +1 -0
  502. package/esm/skills/sources/index.d.mts +18 -0
  503. package/esm/skills/sources/index.d.mts.map +1 -0
  504. package/esm/skills/sources/index.mjs +27 -0
  505. package/esm/skills/sources/index.mjs.map +1 -0
  506. package/esm/skills/sources/parse-frontmatter.d.mts +27 -0
  507. package/esm/skills/sources/parse-frontmatter.d.mts.map +1 -0
  508. package/esm/skills/sources/parse-frontmatter.mjs +46 -0
  509. package/esm/skills/sources/parse-frontmatter.mjs.map +1 -0
  510. package/esm/skills/sources/store-source.d.mts +14 -0
  511. package/esm/skills/sources/store-source.d.mts.map +1 -0
  512. package/esm/skills/sources/store-source.mjs +15 -0
  513. package/esm/skills/sources/store-source.mjs.map +1 -0
  514. package/esm/skills/sources/url-source.d.mts +29 -0
  515. package/esm/skills/sources/url-source.d.mts.map +1 -0
  516. package/esm/skills/sources/url-source.mjs +117 -0
  517. package/esm/skills/sources/url-source.mjs.map +1 -0
  518. package/esm/skills/store/mock-skills-store.d.mts +57 -0
  519. package/esm/skills/store/mock-skills-store.d.mts.map +1 -0
  520. package/esm/skills/store/mock-skills-store.mjs +100 -0
  521. package/esm/skills/store/mock-skills-store.mjs.map +1 -0
  522. package/esm/skills/store/procedural-skill-store.d.mts +30 -0
  523. package/esm/skills/store/procedural-skill-store.d.mts.map +1 -0
  524. package/esm/skills/store/procedural-skill-store.mjs +125 -0
  525. package/esm/skills/store/procedural-skill-store.mjs.map +1 -0
  526. package/esm/speech/index.mjs +3 -0
  527. package/esm/speech/speech.d.mts +65 -0
  528. package/esm/speech/speech.d.mts.map +1 -0
  529. package/esm/speech/speech.mjs +123 -0
  530. package/esm/speech/speech.mjs.map +1 -0
  531. package/esm/supervisor/as-tool.mjs +2 -2
  532. package/esm/supervisor/as-tool.mjs.map +1 -1
  533. package/esm/supervisor/entries.mjs +2 -2
  534. package/esm/supervisor/entries.mjs.map +1 -1
  535. package/esm/supervisor/execution.d.mts.map +1 -1
  536. package/esm/supervisor/execution.mjs +31 -28
  537. package/esm/supervisor/execution.mjs.map +1 -1
  538. package/esm/supervisor/supervisor.d.mts.map +1 -1
  539. package/esm/supervisor/supervisor.mjs +8 -3
  540. package/esm/supervisor/supervisor.mjs.map +1 -1
  541. package/esm/system-prompt/index.d.mts +4 -0
  542. package/esm/system-prompt/system-prompt.d.mts +68 -4
  543. package/esm/system-prompt/system-prompt.d.mts.map +1 -1
  544. package/esm/system-prompt/system-prompt.mjs +89 -5
  545. package/esm/system-prompt/system-prompt.mjs.map +1 -1
  546. package/esm/team/gates.mjs +48 -0
  547. package/esm/team/gates.mjs.map +1 -0
  548. package/esm/team/index.d.mts +1 -0
  549. package/esm/team/index.mjs +3 -0
  550. package/esm/team/team.d.mts +42 -0
  551. package/esm/team/team.d.mts.map +1 -0
  552. package/esm/team/team.mjs +94 -0
  553. package/esm/team/team.mjs.map +1 -0
  554. package/esm/tool/executable-as-tool.d.mts.map +1 -1
  555. package/esm/tool/executable-as-tool.mjs +2 -2
  556. package/esm/tool/executable-as-tool.mjs.map +1 -1
  557. package/esm/tool/tool.d.mts.map +1 -1
  558. package/esm/tool/tool.mjs +2 -2
  559. package/esm/tool/tool.mjs.map +1 -1
  560. package/esm/transcribe/audio-input.d.mts +47 -0
  561. package/esm/transcribe/audio-input.d.mts.map +1 -0
  562. package/esm/transcribe/audio-input.mjs +84 -0
  563. package/esm/transcribe/audio-input.mjs.map +1 -0
  564. package/esm/transcribe/index.mjs +4 -0
  565. package/esm/transcribe/transcribe.d.mts +64 -0
  566. package/esm/transcribe/transcribe.d.mts.map +1 -0
  567. package/esm/transcribe/transcribe.mjs +128 -0
  568. package/esm/transcribe/transcribe.mjs.map +1 -0
  569. package/esm/utils/compute-cost.d.mts +17 -1
  570. package/esm/utils/compute-cost.d.mts.map +1 -1
  571. package/esm/utils/compute-cost.mjs +26 -1
  572. package/esm/utils/compute-cost.mjs.map +1 -1
  573. package/esm/utils/extract-json-lenient.d.mts +42 -0
  574. package/esm/utils/extract-json-lenient.d.mts.map +1 -0
  575. package/esm/utils/extract-json-lenient.mjs +97 -0
  576. package/esm/utils/extract-json-lenient.mjs.map +1 -0
  577. package/esm/utils/index.d.mts +4 -2
  578. package/esm/utils/index.mjs +3 -1
  579. package/esm/utils/json-schema.d.mts +1 -1
  580. package/esm/utils/prepare-attachment-part.d.mts +10 -1
  581. package/esm/utils/prepare-attachment-part.d.mts.map +1 -1
  582. package/esm/utils/prepare-attachment-part.mjs +103 -11
  583. package/esm/utils/prepare-attachment-part.mjs.map +1 -1
  584. package/esm/utils/resolve-attachment.d.mts +4 -3
  585. package/esm/utils/resolve-attachment.d.mts.map +1 -1
  586. package/esm/utils/resolve-attachment.mjs +4 -3
  587. package/esm/utils/resolve-attachment.mjs.map +1 -1
  588. package/esm/utils/run-context.d.mts +94 -0
  589. package/esm/utils/run-context.d.mts.map +1 -0
  590. package/esm/utils/run-context.mjs +98 -0
  591. package/esm/utils/run-context.mjs.map +1 -0
  592. package/esm/vcr/cassette-io.mjs +57 -0
  593. package/esm/vcr/cassette-io.mjs.map +1 -0
  594. package/esm/vcr/errors.d.mts +42 -0
  595. package/esm/vcr/errors.d.mts.map +1 -0
  596. package/esm/vcr/errors.mjs +37 -0
  597. package/esm/vcr/errors.mjs.map +1 -0
  598. package/esm/vcr/hash-request.d.mts +28 -0
  599. package/esm/vcr/hash-request.d.mts.map +1 -0
  600. package/esm/vcr/hash-request.mjs +118 -0
  601. package/esm/vcr/hash-request.mjs.map +1 -0
  602. package/esm/vcr/index.d.mts +4 -0
  603. package/esm/vcr/index.mjs +5 -0
  604. package/esm/vcr/vcr.d.mts +32 -0
  605. package/esm/vcr/vcr.d.mts.map +1 -0
  606. package/esm/vcr/vcr.mjs +248 -0
  607. package/esm/vcr/vcr.mjs.map +1 -0
  608. package/esm/vcr/vcr.type.d.mts +118 -0
  609. package/esm/vcr/vcr.type.d.mts.map +1 -0
  610. package/esm/workflow/as-tool.mjs +2 -2
  611. package/esm/workflow/as-tool.mjs.map +1 -1
  612. package/esm/workflow/engine.mjs +1 -0
  613. package/esm/workflow/engine.mjs.map +1 -1
  614. package/esm/workflow/step-runner.mjs +19 -20
  615. package/esm/workflow/step-runner.mjs.map +1 -1
  616. package/esm/workflow/workflow.d.mts.map +1 -1
  617. package/esm/workflow/workflow.mjs +8 -3
  618. package/esm/workflow/workflow.mjs.map +1 -1
  619. package/llms-full.txt +2572 -204
  620. package/llms.txt +21 -4
  621. package/package.json +7 -3
  622. package/skills/README.md +44 -4
  623. package/skills/ai-dx-helpers/SKILL.md +2 -2
  624. package/skills/approve-tool-calls/SKILL.md +134 -0
  625. package/skills/attach-ai-middleware/SKILL.md +1 -1
  626. package/skills/detect-and-redact-pii/SKILL.md +104 -0
  627. package/skills/durable-agent-runs/SKILL.md +135 -0
  628. package/skills/durable-resume/SKILL.md +128 -0
  629. package/skills/escalate-block-to-human/SKILL.md +85 -0
  630. package/skills/eval-datasets-and-ci/SKILL.md +117 -0
  631. package/skills/generate-images/SKILL.md +138 -0
  632. package/skills/generate-speech/SKILL.md +139 -0
  633. package/skills/guard-input-output/SKILL.md +117 -0
  634. package/skills/manage-prompts/SKILL.md +186 -0
  635. package/skills/observe-ai-flows/SKILL.md +94 -0
  636. package/skills/rag-loaders-and-stores/SKILL.md +164 -0
  637. package/skills/record-replay-llm/SKILL.md +92 -0
  638. package/skills/run-ai-agent/SKILL.md +26 -1
  639. package/skills/run-ai-rag/SKILL.md +139 -0
  640. package/skills/run-ai-team/SKILL.md +107 -0
  641. package/skills/run-orchestrator/SKILL.md +2 -0
  642. package/skills/run-planner/SKILL.md +73 -8
  643. package/skills/run-supervisor/SKILL.md +20 -1
  644. package/skills/transcribe-audio/SKILL.md +157 -0
  645. package/skills/use-runtime-skills/SKILL.md +106 -0
  646. package/skills/write-system-prompt/SKILL.md +30 -1
  647. package/cjs/index.cjs.map +0 -1
  648. package/esm/contracts/result/index.d.mts +0 -15
@@ -1,7 +1,10 @@
1
1
  import { AgentContract } from "../agent/agent.contract.mjs";
2
+ import { FlowObserveOption } from "../../observe/resolve-observers.mjs";
3
+ import { SnapshotStore } from "../orchestrator/snapshot-store.contract.mjs";
2
4
  import { ModelContract } from "../model.contract.mjs";
3
5
  import { SystemPromptContract } from "../system-prompt.contract.mjs";
4
6
  import { PlannerCapability } from "./planner-capability.type.mjs";
7
+ import { PlannerSnapshot } from "./planner-snapshot.type.mjs";
5
8
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
9
 
7
10
  //#region ../@warlock.js/ai/src/contracts/planner/planner-config.type.d.ts
@@ -35,6 +38,14 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
35
38
  type PlannerConfig<TOutput = unknown> = {
36
39
  /** Stable identifier — used in logs, events, signature, report `name`. */name: string; /** Dev-curated version string. Metadata only — never parsed. */
37
40
  version?: string;
41
+ /**
42
+ * Per-flow observability routing. `true` routes this planner's report to
43
+ * the globally-registered observers (even with observe-all off); `false`
44
+ * opts out; an `Observer` is a flow-local collector; omitted follows the
45
+ * global observe-all flag. Brings the planner to parity with
46
+ * agent/workflow/supervisor instead of only ever routing under observe-all.
47
+ */
48
+ observe?: FlowObserveOption;
38
49
  /**
39
50
  * Model used to build the internal planning agent that GENERATES the
40
51
  * plan. Mutually exclusive with `planner`.
@@ -72,6 +83,56 @@ type PlannerConfig<TOutput = unknown> = {
72
83
  * untyped.
73
84
  */
74
85
  output?: StandardSchemaV1<TOutput>;
86
+ /**
87
+ * Schedule independent steps in parallel off `dependsOn`. When true the
88
+ * planner builds a DAG from step `id` / `dependsOn`, runs each ready
89
+ * level concurrently, and feeds each step ONLY its dependencies'
90
+ * outputs. A cycle or a `dependsOn` that names an unknown step raises a
91
+ * typed {@link import("../../errors/planner-plan-invalid-error").PlannerPlanInvalidError}
92
+ * before any step runs. Default `false` ⇒ today's strict array-order
93
+ * loop, byte-for-byte unchanged.
94
+ */
95
+ dag?: boolean; /** Max concurrent steps when `dag` is true. Default 4. */
96
+ maxConcurrency?: number;
97
+ /**
98
+ * Adaptive re-planning. When set, a failed step (or a `replan` verdict
99
+ * from the `onStep` execute-option) revises the REMAINING plan instead
100
+ * of aborting — re-asking the planning agent for a fresh plan seeded
101
+ * with the executed-step digest plus the feedback. Bounded by
102
+ * `maxReplans`; on exhaustion the run ends with the last failure.
103
+ * Default off ⇒ a failure aborts exactly as today.
104
+ */
105
+ replan?: {
106
+ maxReplans: number;
107
+ };
108
+ /**
109
+ * Opt-in durable mid-run crash-resume. When set, the planner
110
+ * checkpoints its state to a {@link SnapshotStore} after every settled
111
+ * plan node, so a `planner.resume(runId)` after a crash re-hydrates the
112
+ * frozen plan + executed-node ledger + usage + child reports and
113
+ * continues scheduling only the unfinished frontier — never re-calling
114
+ * the planning LLM and never re-dispatching a completed node's
115
+ * capability.
116
+ *
117
+ * Absent ⇒ no persistence, zero behavior change: the planner runs
118
+ * byte-for-byte as today.
119
+ *
120
+ * - `store` — the snapshot store to persist to. Optional; falls back to
121
+ * `ai.config({ defaultSnapshotStore })`. When neither is set, snapshot
122
+ * writes silently skip and `resume()` throws.
123
+ * - `deleteOnComplete` — drop the snapshot once the run terminates
124
+ * successfully. Default `false` (keep it for the completed-run
125
+ * short-circuit + audit).
126
+ *
127
+ * **Idempotency caveat.** A crash mid-node re-runs that node's
128
+ * capability on resume; side-effectful capabilities must be idempotent —
129
+ * the same caller-responsibility boundary the supervisor and workflow
130
+ * primitives already document.
131
+ */
132
+ durable?: {
133
+ /** Snapshot store to persist to. Falls back to the global default. */store?: SnapshotStore<PlannerSnapshot>; /** Drop the snapshot on successful completion. Default `false`. */
134
+ deleteOnComplete?: boolean;
135
+ };
75
136
  };
76
137
  //#endregion
77
138
  export { PlannerConfig };
@@ -1 +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"}
1
+ {"version":3,"file":"planner-config.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner-config.type.ts"],"mappings":";;;;;;;;;;;;AAoCA;;;;;;;;;;;;;;;;;;;;;;;;;KAAY,aAAA;EAmCI,0EAjCd,IAAA,UA+CA;EA7CA,OAAA;EA6C0B;;;;;;;EArC1B,OAAA,GAAU,iBAAA;EAqFc;;;AAEN;EAlFlB,KAAA,GAAQ,aAAA;;;;;;EAMR,OAAA,GAAU,aAAA;;;;;;EAMV,YAAA,GAAe,oBAAA;;;;;;EAMf,YAAA,EAAc,iBAAA;;;;;;;EAOd,QAAA;;;;;;;EAOA,MAAA,GAAS,gBAAA,CAAiB,OAAA;;;;;;;;;;EAU1B,GAAA;EAEA,cAAA;;;;;;;;;EASA,MAAA;IAAW,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;EAyBX,OAAA;0EAEE,KAAA,GAAQ,aAAA,CAAc,eAAA;IAEtB,gBAAA;EAAA;AAAA"}
@@ -1,7 +1,29 @@
1
1
  import { Placeholders } from "../placeholders.type.mjs";
2
+ import { PlannerPlan } from "./planner-plan.type.mjs";
3
+ import { PlannerStepSnapshot } from "./planner-result.type.mjs";
2
4
  import { StandardSchemaV1 } from "@standard-schema/spec";
3
5
 
4
6
  //#region ../@warlock.js/ai/src/contracts/planner/planner-execute-options.type.d.ts
7
+ /**
8
+ * Steering verdict returned by the {@link PlannerExecuteOptions.onStep}
9
+ * hook after a step settles.
10
+ *
11
+ * - `{ type: "continue" }` (or returning nothing) — proceed as normal.
12
+ * - `{ type: "abort" }` — stop the run; remaining steps are recorded
13
+ * `skipped`, exactly as a step failure aborts today.
14
+ * - `{ type: "replan"; feedback }` — re-ask the planning agent for a
15
+ * fresh plan over the REMAINING work, seeded with the executed-step
16
+ * digest plus `feedback`. Bounded by `config.replan.maxReplans`; a
17
+ * `replan` directive with no `replan` config is treated as `continue`.
18
+ */
19
+ type PlannerStepDirective = {
20
+ type: "continue";
21
+ } | {
22
+ type: "abort";
23
+ } | {
24
+ type: "replan";
25
+ feedback: string;
26
+ };
5
27
  /**
6
28
  * Options accepted by `planner.execute(goal, options?)`.
7
29
  *
@@ -37,7 +59,44 @@ type PlannerExecuteOptions<TOutput = unknown> = {
37
59
  * trace queries don't need to walk the tree.
38
60
  */
39
61
  sessionId?: string;
62
+ /**
63
+ * Approval gate. `"plan-only"` generates (and validates) the plan and
64
+ * returns WITHOUT executing — `report.status === "awaiting-approval"`
65
+ * and `result.plan` carries the generated plan. Pass that plan back via
66
+ * `approvedPlan` to execute it. Defaults to `"execute"`.
67
+ *
68
+ * **`mode: "plan-only"` with `approvedPlan` is contradictory** —
69
+ * `approvedPlan` wins (the plan is executed).
70
+ */
71
+ mode?: "execute" | "plan-only";
72
+ /**
73
+ * Execute this exact plan, skipping plan generation entirely. Pairs
74
+ * with a prior `mode: "plan-only"` call's `result.plan`. The plan is
75
+ * still validated against the live capabilities, so a stale plan
76
+ * naming a capability the planner no longer has surfaces a typed
77
+ * `PlannerPlanInvalidError`.
78
+ */
79
+ approvedPlan?: PlannerPlan;
80
+ /**
81
+ * Per-step hook fired after each step settles (both the sequential and
82
+ * the DAG path). Return a {@link PlannerStepDirective} to steer the
83
+ * run: continue (default), abort, or replan the remainder with
84
+ * feedback. May be async.
85
+ */
86
+ onStep?: (snapshot: PlannerStepSnapshot, plan: PlannerPlan) => void | PlannerStepDirective | Promise<void | PlannerStepDirective>;
87
+ };
88
+ /**
89
+ * Options accepted by `planner.resume(runId, options?)`.
90
+ *
91
+ * `force: true` bypasses the signature drift check — use only when you
92
+ * have verified the definition change is safe for the in-flight
93
+ * snapshot. `PlannerDriftError` is otherwise thrown without executing
94
+ * anything. Everything else mirrors {@link PlannerExecuteOptions} (e.g.
95
+ * re-supply a `signal` to keep the resumed run cancellable).
96
+ */
97
+ type PlannerResumeOptions<TOutput = unknown> = PlannerExecuteOptions<TOutput> & {
98
+ /** Bypass the drift check and resume against the changed definition. */force?: boolean;
40
99
  };
41
100
  //#endregion
42
- export { PlannerExecuteOptions };
101
+ export { PlannerExecuteOptions, PlannerResumeOptions, PlannerStepDirective };
43
102
  //# sourceMappingURL=planner-execute-options.type.d.mts.map
@@ -1 +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"}
1
+ {"version":3,"file":"planner-execute-options.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner-execute-options.type.ts"],"mappings":";;;;;;;;AAiBA;;;;;;;;;AAG8B;KAHlB,oBAAA;EACN,IAAA;AAAA;EACA,IAAA;AAAA;EACA,IAAA;EAAgB,QAAA;AAAA;;;;;;;KAQV,qBAAA;EAAsB,+DAEhC,KAAA;EAKA;;;;EAAA,YAAA,GAAe,YAAA;EAef;;;;;EATA,MAAA,GAAS,gBAAA,CAAiB,OAAA;EAyC1B;;;;;;;;EAhCA,MAAA,GAAS,WAAA;EAmC6D;AAYxE;;;;;EAxCE,SAAA;EAwC0E;;;AAErE;;;;;;EAhCL,IAAA;;;;;;;;EAQA,YAAA,GAAe,WAAA;;;;;;;EAOf,MAAA,IACE,QAAA,EAAU,mBAAA,EACV,IAAA,EAAM,WAAA,YACI,oBAAA,GAAuB,OAAA,QAAe,oBAAA;AAAA;;;;;;;;;;KAYxC,oBAAA,sBAA0C,qBAAqB,CAAC,OAAA;0EAE1E,KAAA;AAAA"}
@@ -82,6 +82,14 @@ type PlannerReport = Omit<BaseReport, "type"> & {
82
82
  type PlannerResult<TOutput = unknown> = Omit<ExecuteResult<TOutput>, "report"> & {
83
83
  /** Discriminant for narrowing a heterogeneous result union. */type: "planner";
84
84
  report: PlannerReport;
85
+ /**
86
+ * The generated plan, surfaced WITHOUT execution when the run was
87
+ * invoked with `mode: "plan-only"` (`report.status ===
88
+ * "awaiting-approval"`). Pass it back as `approvedPlan` on a follow-up
89
+ * `execute()` to run it. Absent on a normal execute run — the executed
90
+ * plan lives on `report.plan`.
91
+ */
92
+ plan?: PlannerPlan;
85
93
  };
86
94
  //#endregion
87
95
  export { PlannerReport, PlannerReportType, PlannerResult, PlannerStepSnapshot };
@@ -1 +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"}
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;;;;;;;;;;;;AAmCkB;;;;;;;;;;KAXR,aAAA,sBAAmC,IAAA,CAAK,aAAA,CAAc,OAAA;iEAEhE,IAAA;EACA,MAAA,EAAQ,aAAA;;;;;;;;EAQR,IAAA,GAAO,WAAA;AAAA"}
@@ -0,0 +1,77 @@
1
+ import { Usage } from "../result/usage.type.mjs";
2
+ import { BaseReport } from "../result/base-report.type.mjs";
3
+ import { PlannerPlan } from "./planner-plan.type.mjs";
4
+ import { PlannerStepSnapshot } from "./planner-result.type.mjs";
5
+
6
+ //#region ../@warlock.js/ai/src/contracts/planner/planner-snapshot.type.d.ts
7
+ /**
8
+ * Lifecycle status of a durable planner run, recorded on the persisted
9
+ * snapshot so `resume()` can decide whether a run is still in flight.
10
+ *
11
+ * - `"running"` — the execution loop is active; a resume is legitimate
12
+ * if the process crashed between node boundaries.
13
+ * - `"completed"` — the planner terminated successfully; resume is a
14
+ * no-op and re-returns the final result rebuilt from the snapshot.
15
+ * - `"cancelled"` — aborted via `AbortSignal`; resume is allowed.
16
+ * - `"failed"` — terminated with an error; resume after the fix.
17
+ */
18
+ type PlannerSnapshotStatus = "running" | "completed" | "cancelled" | "failed";
19
+ /**
20
+ * Persisted shape written to the configured {@link
21
+ * import("../orchestrator/snapshot-store.contract").SnapshotStore} after
22
+ * every plan node settles. Exists so `planner.resume(runId)` can
23
+ * re-hydrate the frozen plan + per-node ledger + rolled-up usage +
24
+ * child reports and continue scheduling the unfinished DAG / sequential
25
+ * tail.
26
+ *
27
+ * **Checkpoint granularity is per-node.** The snapshot is written at the
28
+ * end of `executeStep`, after the step's `PlannerStepSnapshot` is pushed
29
+ * and its usage + child report folded in. A completed node's capability
30
+ * dispatch is never re-invoked on resume — the sequential skip-guard /
31
+ * DAG re-seed derive the completed-node set from `executedSteps`.
32
+ *
33
+ * `signature` is the same structural fingerprint exposed on the planner
34
+ * instance (`computeSignature(name, capabilities)`). `resume()` compares
35
+ * it against the current definition; a mismatch throws `PlannerDriftError`
36
+ * (bypassable with `{ force: true }`). A mid-run re-plan is NOT drift —
37
+ * the plan changed, not the definition; `replanCount` is persisted so the
38
+ * replan budget is honored across a resume.
39
+ *
40
+ * Every field is JSON-serializable — `PlannerPlan`, `PlannerStepSnapshot`,
41
+ * `Usage`, and `BaseReport` are the same plain-data shapes already
42
+ * persisted on reports.
43
+ *
44
+ * @example
45
+ * const snapshot: PlannerSnapshot | undefined = await store.load(runId);
46
+ * if (snapshot?.status === "running") {
47
+ * await planner.resume(runId);
48
+ * }
49
+ */
50
+ type PlannerSnapshot = {
51
+ /** The store key — stable across the whole run. */runId: string; /** Planner name, for the resume error message + attribution. */
52
+ plannerName: string; /** Structural drift fingerprint — `computeSignature(name, capabilities)`. */
53
+ signature: string; /** `PlannerConfig.version` — metadata only, never compared. */
54
+ version?: string; /** The original `execute(goal)` value — needed to rebuild prompts on replan. */
55
+ goal: string;
56
+ /**
57
+ * The frozen plan generated on the first run. Resume must NOT re-call
58
+ * the planning LLM — re-asking would burn tokens and risk a different
59
+ * plan that no longer matches the executed-node ledger.
60
+ */
61
+ plan: PlannerPlan;
62
+ /**
63
+ * Per-node ledger (completed / failed / skipped). This IS the
64
+ * completed-node set — the sequential skip-guard and DAG re-seed both
65
+ * reconstruct "what ran" from it.
66
+ */
67
+ executedSteps: PlannerStepSnapshot[]; /** Rolled-up usage across executed nodes — never double-counted on resume. */
68
+ usage: Usage; /** Child reports accumulated across executed nodes. */
69
+ children: BaseReport[]; /** Replan budget consumed so far, so a resume can't exceed `maxReplans`. */
70
+ replanCount: number;
71
+ status: PlannerSnapshotStatus;
72
+ startedAt: string;
73
+ savedAt: string;
74
+ };
75
+ //#endregion
76
+ export { PlannerSnapshot, PlannerSnapshotStatus };
77
+ //# sourceMappingURL=planner-snapshot.type.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-snapshot.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner-snapshot.type.ts"],"mappings":";;;;;;;;AAgBA;;;;AAAiC;AAqCjC;;;;KArCY,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAoEH;;;;;;;KA/BG,eAAA;qDAEV,KAAA;EAEA,WAAA;EAEA,SAAA;EAEA,OAAA;EAEA,IAAA;;;;;;EAMA,IAAA,EAAM,WAAA;;;;;;EAMN,aAAA,EAAe,mBAAA;EAEf,KAAA,EAAO,KAAA;EAEP,QAAA,EAAU,UAAA;EAEV,WAAA;EACA,MAAA,EAAQ,qBAAA;EACR,SAAA;EACA,OAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  import { ExecutableContract } from "../executable.contract.mjs";
2
- import { PlannerExecuteOptions } from "./planner-execute-options.type.mjs";
3
2
  import { PlannerResult } from "./planner-result.type.mjs";
3
+ import { PlannerExecuteOptions, PlannerResumeOptions } from "./planner-execute-options.type.mjs";
4
4
 
5
5
  //#region ../@warlock.js/ai/src/contracts/planner/planner.contract.d.ts
6
6
  /**
@@ -54,6 +54,26 @@ interface PlannerContract<TOutput = unknown> extends ExecutableContract<string,
54
54
  * shape; runtime failures surface on `result.error`.
55
55
  */
56
56
  execute(goal: string, options?: PlannerExecuteOptions<TOutput>): Promise<PlannerResult<TOutput>>;
57
+ /**
58
+ * Resume a durable run after a crash. Loads the snapshot persisted
59
+ * under `runId` (requires `durable` on the config, or a global
60
+ * `defaultSnapshotStore`), re-hydrates the frozen plan + executed-node
61
+ * ledger + usage, and continues scheduling only the unfinished frontier
62
+ * — never re-calling the planning LLM and never re-dispatching a
63
+ * completed node's capability. A resume of an already-settled run
64
+ * re-returns the stored result without running anything.
65
+ *
66
+ * Refuses to continue when the current definition has structurally
67
+ * drifted from the snapshot (`PlannerDriftError`), unless
68
+ * `{ force: true }` is passed. Throws `PlannerFailedError` when no store
69
+ * is configured or no snapshot exists for `runId`.
70
+ *
71
+ * @example
72
+ * const result = await research.execute("compare A vs B", { runId: "plan-7" });
73
+ * // ...process crashes mid-run...
74
+ * const recovered = await research.resume("plan-7");
75
+ */
76
+ resume(runId: string, options?: PlannerResumeOptions<TOutput>): Promise<PlannerResult<TOutput>>;
57
77
  }
58
78
  //#endregion
59
79
  export { PlannerContract };
@@ -1 +1 @@
1
- {"version":3,"file":"planner.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner.contract.ts"],"mappings":";;;;;;;AAwCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBkC;;UAtBjB,eAAA,4BAA2C,kBAAA,SAE1D,qBAAA,CAAsB,OAAA,GACtB,aAAA,CAAc,OAAA;;WAGL,IAAA;;;;;;WAMA,SAAA;;;;;;EAOT,OAAA,CACE,IAAA,UACA,OAAA,GAAU,qBAAA,CAAsB,OAAA,IAC/B,OAAA,CAAQ,aAAA,CAAc,OAAA;AAAA"}
1
+ {"version":3,"file":"planner.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner.contract.ts"],"mappings":";;;;;;;AA2CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAAiB,eAAA,4BAA2C,kBAAA,SAE1D,qBAAA,CAAsB,OAAA,GACtB,aAAA,CAAc,OAAA;EAmBW;EAAA,SAhBhB,IAAA;EAsCP;;;;;EAAA,SAhCO,SAAA;EAkCgB;;AAAO;;;EA3BhC,OAAA,CACE,IAAA,UACA,OAAA,GAAU,qBAAA,CAAsB,OAAA,IAC/B,OAAA,CAAQ,aAAA,CAAc,OAAA;;;;;;;;;;;;;;;;;;;;EAqBzB,MAAA,CACE,KAAA,UACA,OAAA,GAAU,oBAAA,CAAqB,OAAA,IAC9B,OAAA,CAAQ,aAAA,CAAc,OAAA;AAAA"}
@@ -7,10 +7,12 @@ import { AgentReport } from "./execution-report.type.mjs";
7
7
  *
8
8
  * **Canonical destructuring:** `const { data, text, report, usage, error }`.
9
9
  *
10
- * `report.trips` / `report.toolCalls` / `report.duration` hold
11
- * everything the old top-level fields did — moving them under
12
- * `report` leaves the root clean for the four things callers reach
13
- * for constantly (`data`, `text`, `usage`, `error`).
10
+ * `report.trips` / `report.children` / `report.duration` hold
11
+ * everything the old top-level fields did — tool dispatches live as
12
+ * child nodes on `report.children` (filter `type === "tool"`), and
13
+ * moving these under `report` leaves the root clean for the four
14
+ * things callers reach for constantly (`data`, `text`, `usage`,
15
+ * `error`).
14
16
  *
15
17
  * @example
16
18
  * const { data, error, report, usage } = await agent.execute(input);
@@ -1 +1 @@
1
- {"version":3,"file":"agent-result.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/agent-result.type.ts"],"mappings":";;;;;;AAuBA;;;;;;;;;;;;;;;;;AAQqB;KART,WAAA,sBAAiC,UAAA;wEAE3C,IAAA;EAEA,IAAA,GAAO,OAAA;EAEP,IAAA;EAEA,MAAA,EAAQ,WAAA;AAAA"}
1
+ {"version":3,"file":"agent-result.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/agent-result.type.ts"],"mappings":";;;;;;AAyBA;;;;;;;;;;;;;;;;;AAQqB;;;KART,WAAA,sBAAiC,UAAA;wEAE3C,IAAA;EAEA,IAAA,GAAO,OAAA;EAEP,IAAA;EAEA,MAAA,EAAQ,WAAA;AAAA"}
@@ -1,3 +1,4 @@
1
+ import { AIError } from "../../errors/ai-error.mjs";
1
2
  import { Usage } from "./usage.type.mjs";
2
3
  import { AttemptEntry } from "./attempt-entry.type.mjs";
3
4
 
@@ -19,7 +20,7 @@ declare const REPORT_SCHEMA_VERSION = 1;
19
20
  * {@link BaseReport}. Forms a closed union so consumers can narrow on
20
21
  * the tree without string-matching on `name`.
21
22
  */
22
- type ReportType = "tool" | "callback" | "agent" | "workflow" | "supervisor" | "orchestrator" | "batch" | "planner";
23
+ type ReportType = "tool" | "callback" | "agent" | "workflow" | "supervisor" | "team" | "orchestrator" | "batch" | "planner" | "image" | "speech" | "transcription" | "video" | "realtime";
23
24
  /**
24
25
  * Terminal status every executable primitive reports. Unified across
25
26
  * tools, agents, workflows, and supervisors so dashboards and
@@ -39,8 +40,13 @@ type ReportType = "tool" | "callback" | "agent" | "workflow" | "supervisor" | "o
39
40
  * non-terminal member of this union; consumers branching on
40
41
  * `status === "completed"` must treat it as a session-continues path,
41
42
  * not a failure. Harmless on non-orchestrator reports.
43
+ * - `"awaiting-approval"` — planner-specific NON-terminal status: a
44
+ * `mode: "plan-only"` run generated and validated a plan but executed
45
+ * nothing, pending sign-off (the plan rides on `result.plan`). Mirrors
46
+ * `"awaiting-input"` at the plan boundary. Harmless on non-planner
47
+ * reports.
42
48
  */
43
- type ReportStatus = "completed" | "failed" | "cancelled" | "max-iterations" | "awaiting-input";
49
+ type ReportStatus = "completed" | "failed" | "cancelled" | "max-iterations" | "awaiting-input" | "awaiting-approval";
44
50
  /**
45
51
  * Universal execution report shared by every primitive. Per-primitive
46
52
  * report types extend this with their own domain-specific fields
@@ -108,7 +114,19 @@ type BaseReport = {
108
114
  */
109
115
  sessionId?: string; /** Discriminator for the kind of executable that produced this report. */
110
116
  type: ReportType; /** Terminal status of this execution. */
111
- status: ReportStatus; /** ISO-8601 wall-clock timestamp when execution began. */
117
+ status: ReportStatus;
118
+ /**
119
+ * Terminal error stamped on a `failed` / `cancelled` node so the typed
120
+ * cause travels WITH the report tree — not only on the result envelope.
121
+ * Essential for the observe path: an {@link import("../../observe/observer.contract").Observer}
122
+ * receives `collect(report)` with no envelope, so a failed root would
123
+ * otherwise expose `status` with no error type/message. Child tool nodes
124
+ * already carry their error this way (`ToolCall.error`); root primitives
125
+ * (agent / workflow / supervisor / orchestrator / planner) stamp it here
126
+ * too. Absent on a `completed` node. Panoptic normalizes it to a JSON-safe
127
+ * span error during projection — the raw `AIError` never has to serialize.
128
+ */
129
+ error?: AIError; /** ISO-8601 wall-clock timestamp when execution began. */
112
130
  startedAt: string; /** ISO-8601 wall-clock timestamp when execution finished. */
113
131
  endedAt: string; /** Monotonic duration in milliseconds — `performance.now()` delta. */
114
132
  duration: number; /** Rolled-up usage: own cost + sum of `children[].usage`. */
@@ -1 +1 @@
1
- {"version":3,"file":"base-report.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/base-report.type.ts"],"mappings":";;;;;;AAcA;;;;AAAkC;AAOlC;;;;cAPa,qBAAA;AAqCb;;;;AAAwB;AAAxB,KA9BY,UAAA;;;;;;;;;;;;;;;;;;;;;KA8BA,YAAA;;;;;;;;;;AA6GS;;;;;;;;;;;;;;;KA9ET,UAAA;sFAEV,KAAA;;;;;;;;;;EAUA,WAAA;;;;;;;EAOA,SAAA;EAEA,IAAA;;;;;;;;;;;;EAYA,OAAA;;;;;;;;;;EAUA,SAAA;EAEA,IAAA,EAAM,UAAA;EAEN,MAAA,EAAQ,YAAA;EAER,SAAA;EAEA,OAAA;EAEA,QAAA;EAEA,KAAA,EAAO,KAAA;;;;;;EAMP,QAAA,EAAU,UAAA;;;;;;;;EAQV,QAAA,GAAW,YAAA;;;;;;;;;EASX,mBAAA;AAAA"}
1
+ {"version":3,"file":"base-report.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/base-report.type.ts"],"mappings":";;;;;;;AAeA;;;;AAAkC;AAOlC;;;;cAPa,qBAAA;AAgDb;;;;AAAwB;AAAxB,KAzCY,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCA,YAAA;;;;;;;;AA0HS;;;;;;;;;;;;;;;;;KA1FT,UAAA;sFAEV,KAAA;;;;;;;;;;EAUA,WAAA;;;;;;;EAOA,SAAA;EAEA,IAAA;;;;;;;;;;;;EAYA,OAAA;;;;;;;;;;EAUA,SAAA;EAEA,IAAA,EAAM,UAAA;EAEN,MAAA,EAAQ,YAAA;;;;;;;;;;;;EAYR,KAAA,GAAQ,OAAA;EAER,SAAA;EAEA,OAAA;EAEA,QAAA;EAEA,KAAA,EAAO,KAAA;;;;;;EAMP,QAAA,EAAU,UAAA;;;;;;;;EAQV,QAAA,GAAW,YAAA;;;;;;;;;EASX,mBAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"base-report.type.mjs","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/base-report.type.ts"],"sourcesContent":["import type { AttemptEntry } from \"./attempt-entry.type\";\nimport type { Usage } from \"./usage.type\";\n\n/**\n * Wire-format version stamped on every root `BaseReport`. Bumped only\n * when we make a BREAKING change to the report shape (field removed,\n * required-ness flipped, semantics changed). Additive changes (new\n * optional fields) do not bump.\n *\n * Panoptic and other downstream consumers branch on this to parse\n * old stored reports with their original-shape rules.\n *\n * Current: **1** — initial Panoptic-readiness shape.\n */\nexport const REPORT_SCHEMA_VERSION = 1;\n\n/**\n * Discriminator for the kind of executable that produced a given\n * {@link BaseReport}. Forms a closed union so consumers can narrow on\n * the tree without string-matching on `name`.\n */\nexport type ReportType =\n | \"tool\"\n | \"callback\"\n | \"agent\"\n | \"workflow\"\n | \"supervisor\"\n | \"orchestrator\"\n | \"batch\"\n | \"planner\";\n\n/**\n * Terminal status every executable primitive reports. Unified across\n * tools, agents, workflows, and supervisors so dashboards and\n * generic traversal helpers don't special-case per primitive.\n *\n * - `\"completed\"` — ran to natural end with a usable result.\n * - `\"failed\"` — aborted mid-run or finished without a usable result\n * (crash, schema failure, max-trips, etc.). The\n * accompanying `error` on the envelope carries the typed cause.\n * - `\"cancelled\"` — caller aborted before completion via `AbortSignal`.\n * - `\"max-iterations\"` — supervisor-specific termination when the\n * iteration cap was hit without an explicit `END` / `satisfied`.\n * Harmless on non-supervisor reports; keeping it on the shared\n * union lets consumers write one `switch` for every status.\n * - `\"awaiting-input\"` — orchestrator-specific NON-terminal status: the\n * session is paused waiting for the next user turn (§15.6). The only\n * non-terminal member of this union; consumers branching on\n * `status === \"completed\"` must treat it as a session-continues path,\n * not a failure. Harmless on non-orchestrator reports.\n */\nexport type ReportStatus =\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"max-iterations\"\n | \"awaiting-input\";\n\n/**\n * Universal execution report shared by every primitive. Per-primitive\n * report types extend this with their own domain-specific fields\n * (agent trips, workflow steps, supervisor iteration snapshots) while\n * keeping the root fields identical. Recursion happens through\n * {@link BaseReport.children} — any executable this node invoked\n * contributes its own full report here, producing a walkable tree of\n * the entire run.\n *\n * **Usage rollup.** `usage` at every node equals this node's own cost\n * plus the sum of each child's `usage`. Leaves (tools) contribute\n * zero own-cost; composites contribute their direct LLM spend only,\n * with children covering everything delegated.\n *\n * @example\n * function totalCost(report: BaseReport): number {\n * return report.usage.total;\n * }\n *\n * function walk(report: BaseReport, depth = 0): void {\n * console.log(`${\" \".repeat(depth)}${report.type} \"${report.name}\" — ${report.status}`);\n * for (const child of report.children) walk(child, depth + 1);\n * }\n */\nexport type BaseReport = {\n /** Stable id for this execution node. Generated per `execute()`/`invoke()` call. */\n runId: string;\n /**\n * Run-id of the immediate parent execution node, when this node was\n * invoked as part of a larger run (e.g. a tool dispatched by an\n * agent; an agent dispatched by a supervisor; an inner primitive\n * wrapped via `asTool()`). Absent on root nodes.\n *\n * Lets Panoptic and other flat-row consumers reconstruct the tree\n * without traversing `children[]` in memory.\n */\n parentRunId?: string;\n /**\n * Run-id of the top-level execution this node belongs to. Equals\n * `runId` on the root node, and is propagated downward to every\n * descendant. Used to slice flat report tables back into per-run\n * groupings.\n */\n rootRunId: string;\n /** Executable identity — the tool/agent/workflow/supervisor name. */\n name: string;\n /**\n * Dev-curated version string mirrored from the primitive's config\n * (`AgentConfig.version`, `ToolConfig.version`, etc.). Free-form —\n * the framework neither parses nor compares it. Stored verbatim on\n * every report so trip-archive queries can distinguish runs of\n * \"agent X v2.1\" from \"agent X v2.2\" even when name + signature\n * are identical.\n *\n * Stays `undefined` when the dev didn't declare one — never\n * auto-defaulted.\n */\n version?: string;\n /**\n * Caller-supplied identifier that groups multiple `.execute()` calls\n * into one conceptual user session / request. Propagated to every\n * descendant report node so flat queries (\"total spend for session\n * X today\") work without joining the tree.\n *\n * Threaded from `execute()` options on every primitive. Optional —\n * absent when the caller didn't supply one.\n */\n sessionId?: string;\n /** Discriminator for the kind of executable that produced this report. */\n type: ReportType;\n /** Terminal status of this execution. */\n status: ReportStatus;\n /** ISO-8601 wall-clock timestamp when execution began. */\n startedAt: string;\n /** ISO-8601 wall-clock timestamp when execution finished. */\n endedAt: string;\n /** Monotonic duration in milliseconds — `performance.now()` delta. */\n duration: number;\n /** Rolled-up usage: own cost + sum of `children[].usage`. */\n usage: Usage;\n /**\n * Reports of every executable invoked by this node, in invocation\n * order. Empty for leaves (pure tools) and for executables that\n * didn't delegate work.\n */\n children: BaseReport[];\n /**\n * Retry history when middleware (or, for workflow steps, the engine\n * itself) retried this node before it either succeeded or gave up.\n * Absent when zero retries happened — keeps the common-case payload\n * lean. The surviving (final) attempt is NOT duplicated here; its\n * outcome is the report's own `status` / timing.\n */\n attempts?: AttemptEntry[];\n /**\n * Wire-format version of this report shape. Only present on root\n * report nodes — implies the same version for the whole tree.\n * Panoptic / archive consumers branch on this to parse old reports\n * with their original-shape rules.\n *\n * Always equals {@link REPORT_SCHEMA_VERSION} at write time.\n */\n reportSchemaVersion?: number;\n};\n"],"mappings":";;;;;;;;;;;;AAcA,MAAa,wBAAwB"}
1
+ {"version":3,"file":"base-report.type.mjs","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/base-report.type.ts"],"sourcesContent":["import type { AIError } from \"../../errors/ai-error\";\nimport type { AttemptEntry } from \"./attempt-entry.type\";\nimport type { Usage } from \"./usage.type\";\n\n/**\n * Wire-format version stamped on every root `BaseReport`. Bumped only\n * when we make a BREAKING change to the report shape (field removed,\n * required-ness flipped, semantics changed). Additive changes (new\n * optional fields) do not bump.\n *\n * Panoptic and other downstream consumers branch on this to parse\n * old stored reports with their original-shape rules.\n *\n * Current: **1** — initial Panoptic-readiness shape.\n */\nexport const REPORT_SCHEMA_VERSION = 1;\n\n/**\n * Discriminator for the kind of executable that produced a given\n * {@link BaseReport}. Forms a closed union so consumers can narrow on\n * the tree without string-matching on `name`.\n */\nexport type ReportType =\n | \"tool\"\n | \"callback\"\n | \"agent\"\n | \"workflow\"\n | \"supervisor\"\n | \"team\"\n | \"orchestrator\"\n | \"batch\"\n | \"planner\"\n | \"image\"\n | \"speech\"\n | \"transcription\"\n | \"video\"\n | \"realtime\";\n\n/**\n * Terminal status every executable primitive reports. Unified across\n * tools, agents, workflows, and supervisors so dashboards and\n * generic traversal helpers don't special-case per primitive.\n *\n * - `\"completed\"` — ran to natural end with a usable result.\n * - `\"failed\"` — aborted mid-run or finished without a usable result\n * (crash, schema failure, max-trips, etc.). The\n * accompanying `error` on the envelope carries the typed cause.\n * - `\"cancelled\"` — caller aborted before completion via `AbortSignal`.\n * - `\"max-iterations\"` — supervisor-specific termination when the\n * iteration cap was hit without an explicit `END` / `satisfied`.\n * Harmless on non-supervisor reports; keeping it on the shared\n * union lets consumers write one `switch` for every status.\n * - `\"awaiting-input\"` — orchestrator-specific NON-terminal status: the\n * session is paused waiting for the next user turn (§15.6). The only\n * non-terminal member of this union; consumers branching on\n * `status === \"completed\"` must treat it as a session-continues path,\n * not a failure. Harmless on non-orchestrator reports.\n * - `\"awaiting-approval\"` — planner-specific NON-terminal status: a\n * `mode: \"plan-only\"` run generated and validated a plan but executed\n * nothing, pending sign-off (the plan rides on `result.plan`). Mirrors\n * `\"awaiting-input\"` at the plan boundary. Harmless on non-planner\n * reports.\n */\nexport type ReportStatus =\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"max-iterations\"\n | \"awaiting-input\"\n | \"awaiting-approval\";\n\n/**\n * Universal execution report shared by every primitive. Per-primitive\n * report types extend this with their own domain-specific fields\n * (agent trips, workflow steps, supervisor iteration snapshots) while\n * keeping the root fields identical. Recursion happens through\n * {@link BaseReport.children} — any executable this node invoked\n * contributes its own full report here, producing a walkable tree of\n * the entire run.\n *\n * **Usage rollup.** `usage` at every node equals this node's own cost\n * plus the sum of each child's `usage`. Leaves (tools) contribute\n * zero own-cost; composites contribute their direct LLM spend only,\n * with children covering everything delegated.\n *\n * @example\n * function totalCost(report: BaseReport): number {\n * return report.usage.total;\n * }\n *\n * function walk(report: BaseReport, depth = 0): void {\n * console.log(`${\" \".repeat(depth)}${report.type} \"${report.name}\" — ${report.status}`);\n * for (const child of report.children) walk(child, depth + 1);\n * }\n */\nexport type BaseReport = {\n /** Stable id for this execution node. Generated per `execute()`/`invoke()` call. */\n runId: string;\n /**\n * Run-id of the immediate parent execution node, when this node was\n * invoked as part of a larger run (e.g. a tool dispatched by an\n * agent; an agent dispatched by a supervisor; an inner primitive\n * wrapped via `asTool()`). Absent on root nodes.\n *\n * Lets Panoptic and other flat-row consumers reconstruct the tree\n * without traversing `children[]` in memory.\n */\n parentRunId?: string;\n /**\n * Run-id of the top-level execution this node belongs to. Equals\n * `runId` on the root node, and is propagated downward to every\n * descendant. Used to slice flat report tables back into per-run\n * groupings.\n */\n rootRunId: string;\n /** Executable identity — the tool/agent/workflow/supervisor name. */\n name: string;\n /**\n * Dev-curated version string mirrored from the primitive's config\n * (`AgentConfig.version`, `ToolConfig.version`, etc.). Free-form —\n * the framework neither parses nor compares it. Stored verbatim on\n * every report so trip-archive queries can distinguish runs of\n * \"agent X v2.1\" from \"agent X v2.2\" even when name + signature\n * are identical.\n *\n * Stays `undefined` when the dev didn't declare one — never\n * auto-defaulted.\n */\n version?: string;\n /**\n * Caller-supplied identifier that groups multiple `.execute()` calls\n * into one conceptual user session / request. Propagated to every\n * descendant report node so flat queries (\"total spend for session\n * X today\") work without joining the tree.\n *\n * Threaded from `execute()` options on every primitive. Optional —\n * absent when the caller didn't supply one.\n */\n sessionId?: string;\n /** Discriminator for the kind of executable that produced this report. */\n type: ReportType;\n /** Terminal status of this execution. */\n status: ReportStatus;\n /**\n * Terminal error stamped on a `failed` / `cancelled` node so the typed\n * cause travels WITH the report tree — not only on the result envelope.\n * Essential for the observe path: an {@link import(\"../../observe/observer.contract\").Observer}\n * receives `collect(report)` with no envelope, so a failed root would\n * otherwise expose `status` with no error type/message. Child tool nodes\n * already carry their error this way (`ToolCall.error`); root primitives\n * (agent / workflow / supervisor / orchestrator / planner) stamp it here\n * too. Absent on a `completed` node. Panoptic normalizes it to a JSON-safe\n * span error during projection — the raw `AIError` never has to serialize.\n */\n error?: AIError;\n /** ISO-8601 wall-clock timestamp when execution began. */\n startedAt: string;\n /** ISO-8601 wall-clock timestamp when execution finished. */\n endedAt: string;\n /** Monotonic duration in milliseconds — `performance.now()` delta. */\n duration: number;\n /** Rolled-up usage: own cost + sum of `children[].usage`. */\n usage: Usage;\n /**\n * Reports of every executable invoked by this node, in invocation\n * order. Empty for leaves (pure tools) and for executables that\n * didn't delegate work.\n */\n children: BaseReport[];\n /**\n * Retry history when middleware (or, for workflow steps, the engine\n * itself) retried this node before it either succeeded or gave up.\n * Absent when zero retries happened — keeps the common-case payload\n * lean. The surviving (final) attempt is NOT duplicated here; its\n * outcome is the report's own `status` / timing.\n */\n attempts?: AttemptEntry[];\n /**\n * Wire-format version of this report shape. Only present on root\n * report nodes — implies the same version for the whole tree.\n * Panoptic / archive consumers branch on this to parse old reports\n * with their original-shape rules.\n *\n * Always equals {@link REPORT_SCHEMA_VERSION} at write time.\n */\n reportSchemaVersion?: number;\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,wBAAwB"}
@@ -1,7 +1,25 @@
1
+ import { ModelToolCallRequest } from "../model-tool-call-request.type.mjs";
1
2
  import { BaseReport, ReportStatus } from "./base-report.type.mjs";
2
3
  import { LLMTrip } from "./llm-trip.type.mjs";
3
4
 
4
5
  //#region ../@warlock.js/ai/src/contracts/result/execution-report.type.d.ts
6
+ /**
7
+ * One normalized turn of an agent's assembled conversation, captured
8
+ * onto {@link AgentReport.messages} when `captureMessages` is enabled.
9
+ *
10
+ * A faithful, JSON-safe projection of the runtime `Message`: the `tool`
11
+ * role returns a tool's output; an `assistant` turn that requested tools
12
+ * carries `toolCalls`; a `tool` turn carries the `toolCallId` it answers.
13
+ * `content` is always a string here (the runtime stringifies tool
14
+ * results and flattens text), so the captured array survives JSON
15
+ * serialization and downstream exporters forward it verbatim.
16
+ */
17
+ type CapturedMessage = {
18
+ /** Who produced this turn. */role: "system" | "user" | "assistant" | "tool"; /** The turn's text content (tool results are stringified JSON). */
19
+ content: string; /** Tool calls the assistant requested — present only on assistant turns that triggered tools. */
20
+ toolCalls?: ModelToolCallRequest[]; /** Provider tool-call id this turn answers — present only on tool-result turns. */
21
+ toolCallId?: string;
22
+ };
5
23
  /**
6
24
  * Terminal status alias retained for backwards-compatibility with
7
25
  * existing imports. Use {@link ReportStatus} directly for new code —
@@ -44,7 +62,41 @@ type AgentReport = BaseReport & {
44
62
  provider: string;
45
63
  }; /** Every LLM round-trip that happened during execution. */
46
64
  trips: LLMTrip[];
65
+ /**
66
+ * The resolved system-prompt text sent as the `role: "system"` message
67
+ * (persona + instructions + any auto-appended structured-output
68
+ * instruction). Captured for observability; absent when the agent ran
69
+ * without a system prompt. Note `LLMTrip.input` holds only the user
70
+ * message — the system prompt is recorded here.
71
+ */
72
+ systemPrompt?: string;
73
+ /**
74
+ * Registry name of the named `SystemPromptContract` this run resolved —
75
+ * its `meta.name`, addressable in `ai.prompts`. Present ONLY when the agent
76
+ * ran against a *named* prompt; absent for a raw-string prompt, an anonymous
77
+ * contract, or no prompt at all. Together with {@link AgentReport.promptVersion}
78
+ * it links a run to the exact prompt version that produced it, so downstream
79
+ * consumers (Panoptic) can group / filter runs by `promptName@promptVersion`.
80
+ */
81
+ promptName?: string;
82
+ /**
83
+ * Registry version label of the named prompt this run resolved — its
84
+ * `meta.version` (defaulting to `"1"` when the prompt is named but carries
85
+ * no explicit version, mirroring the `ai.prompts` registry default). Present
86
+ * ONLY alongside {@link AgentReport.promptName}.
87
+ */
88
+ promptVersion?: string;
89
+ /**
90
+ * The full assembled multi-turn conversation — every role
91
+ * (system / user / assistant / tool), every trip — captured as a
92
+ * {@link CapturedMessage}[]. Present ONLY when the agent's
93
+ * `captureMessages` option was set; absent otherwise (byte-for-byte
94
+ * as before). Opt-in because messages can be large and sensitive.
95
+ * Unlike `trips[].input` (which stubs non-first trips with
96
+ * `"[tool results]"`), this preserves the real turn array.
97
+ */
98
+ messages?: CapturedMessage[];
47
99
  };
48
100
  //#endregion
49
- export { AgentReport, ExecutionReport, ExecutionStatus };
101
+ export { AgentReport, CapturedMessage, ExecutionReport, ExecutionStatus };
50
102
  //# sourceMappingURL=execution-report.type.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execution-report.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/execution-report.type.ts"],"mappings":";;;;;;AAQA;;;KAAY,eAAA,GAAkB,YAAY;AAAA;AAM1C;;;AAN0C,KAM9B,eAAA,GAAkB,UAAU;AAAA;AAoBxC;;;;;;;;;;;AAUgB;;;;;;AA9BwB,KAoB5B,WAAA,GAAc,UAAA;;;;;;;;EAQxB,KAAA;IAAS,IAAA;IAAc,QAAA;EAAA;EAEvB,KAAA,EAAO,OAAO;AAAA"}
1
+ {"version":3,"file":"execution-report.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/execution-report.type.ts"],"mappings":";;;;;;;AAeA;;;;;;;;;KAAY,eAAA;EAQA,8BANV,IAAA,4CAcyB;EAZzB,OAAA,UAYwC;EAVxC,SAAA,GAAY,oBAAoB,IAgBtB;EAdV,UAAA;AAAA;;AAcsC;AAoBxC;;;KA1BY,eAAA,GAAkB,YAAY;;;;;KAM9B,eAAA,GAAkB,UAAU;;;;;;;;;;;;AAgEZ;;;;;;;KA5ChB,WAAA,GAAc,UAAA;;;;;;;;EAQxB,KAAA;IAAS,IAAA;IAAc,QAAA;EAAA;EAEvB,KAAA,EAAO,OAAA;;;;;;;;EAQP,YAAA;;;;;;;;;EASA,UAAA;;;;;;;EAOA,aAAA;;;;;;;;;;EAUA,QAAA,GAAW,eAAA;AAAA"}
@@ -24,7 +24,14 @@ type SupervisorTerminatedBy = "router" | "route" | "classifier" | "evaluate" | "
24
24
  * on {@link BaseReport.children}, which duplicates nothing: it's the
25
25
  * reports of the child agents/workflows dispatched across iterations.
26
26
  */
27
- type SupervisorReport = Omit<BaseReport, "type"> & {
27
+ type SupervisorReport = BaseReport & {
28
+ /**
29
+ * Discriminator for the supervisor engine. `"team"` when produced by
30
+ * `ai.team` (thin sugar over the same engine) so team runs are
31
+ * distinguishable on the wire — group/filter as their own type — while
32
+ * sharing this report shape; `"supervisor"` for a plain `ai.supervisor`.
33
+ */
34
+ type: "supervisor" | "team";
28
35
  supervisorName: string; /** Structural fingerprint — same value exposed on the instance. */
29
36
  signature: string;
30
37
  terminatedBy: SupervisorTerminatedBy; /** How many iterations ran (including the terminal one). */
@@ -77,7 +84,12 @@ type SupervisorReport = Omit<BaseReport, "type"> & {
77
84
  * return { answer: data, cost: usage.total, turns: report.iterations };
78
85
  */
79
86
  type SupervisorResult<TOutput = unknown> = BaseResult & {
80
- /** Discriminant for narrowing `SessionSendResult.executionResult`. */type: "supervisor";
87
+ /**
88
+ * Discriminant for narrowing `SessionSendResult.executionResult`.
89
+ * `"team"` for `ai.team` runs (sugar over the same engine), else
90
+ * `"supervisor"` — matches the report's discriminator.
91
+ */
92
+ type: "supervisor" | "team";
81
93
  data?: TOutput;
82
94
  report: SupervisorReport;
83
95
  };
@@ -1 +1 @@
1
- {"version":3,"file":"supervisor-result.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/supervisor-result.type.ts"],"mappings":";;;;;;;;AAWA;;;;KAAY,sBAAA;AAsBZ;;;;;;;;;;;;;AAAA,KAAY,gBAAA,GAAmB,IAAA,CAAK,UAAA;EAClC,cAAA,UAGA;EADA,SAAA;EACA,YAAA,EAAc,sBAAA,EAId;EAFA,UAAA,UAGW;EADX,WAAA;EACA,SAAA,EAAW,iBAAA;EAgBX;;;AAA+B;AA+BjC;;EAxCE,GAAA,GAAM,WAAA;EAwC0C;;;;;;;;EA/BhD,UAAA,GAAa,kBAAA;AAAA;;;;AAmCW;;;;;;;;;;;;;;;;;;;;;;;;;KAJd,gBAAA,sBAAsC,UAAA;wEAEhD,IAAA;EACA,IAAA,GAAO,OAAA;EACP,MAAA,EAAQ,gBAAA;AAAA"}
1
+ {"version":3,"file":"supervisor-result.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/supervisor-result.type.ts"],"mappings":";;;;;;;;AAWA;;;;KAAY,sBAAA;AAsBZ;;;;;;;;;;;;;AAAA,KAAY,gBAAA,GAAmB,UAAA;EAW7B;;;;;;EAJA,IAAA;EACA,cAAA,UAwBA;EAtBA,SAAA;EACA,YAAA,EAAc,sBAAA,EAqBiB;EAnB/B,UAAA,UAkD0B;EAhD1B,WAAA;EACA,SAAA,EAAW,iBAAA;EAsDJ;;;;;;EA/CP,GAAA,GAAM,WAAA;EA+CN;;;;;AACwB;;;EAvCxB,UAAA,GAAa,kBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BH,gBAAA,sBAAsC,UAAA;;;;;;EAMhD,IAAA;EACA,IAAA,GAAO,OAAA;EACP,MAAA,EAAQ,gBAAA;AAAA"}
@@ -14,7 +14,8 @@ import { StepSnapshot } from "./step-result.type.mjs";
14
14
  * structure — one entry per defined step — while `children` gives
15
15
  * the cross-cutting tree view shared with other primitives.
16
16
  */
17
- type WorkflowReport = Omit<BaseReport, "type"> & {
17
+ type WorkflowReport = BaseReport & {
18
+ /** Discriminator narrowed to the workflow primitive. */type: "workflow";
18
19
  workflowName: string; /** Structural fingerprint — same value exposed on the workflow instance. */
19
20
  signature: string; /** ISO-8601 timestamp when cancellation was observed, if any. */
20
21
  cancelledAt?: string; /** Per-step snapshots keyed by step name. */
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-result.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/workflow-result.type.ts"],"mappings":";;;;;;;;AAeA;;;;;;;;KAAY,cAAA,GAAiB,IAAA,CAAK,UAAA;EAChC,YAAA,UAQe;EANf,SAAA,UAHgC;EAKhC,WAAA,WAFA;EAIA,KAAA,EAAO,MAAA,SAAe,YAAA,GAAtB;EAEA,KAAA,EAAO,QAAA,CAAS,MAAA;AAAA;;;;;AAAM;AAgBxB;;;;;;;;KAAY,cAAA,sBAAoC,UAAA;EAC9C,IAAA;EACA,IAAA,GAAO,OAAA;EACP,MAAA,EAAQ,cAAA;EACR,KAAA,GAAQ,OAAA;AAAA"}
1
+ {"version":3,"file":"workflow-result.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/result/workflow-result.type.ts"],"mappings":";;;;;;;;AAeA;;;;;;;;KAAY,cAAA,GAAiB,UAAA;EAWZ,wDATf,IAAA;EACA,YAAA;EAEA,SAAA,UAEA;EAAA,WAAA,WAEO;EAAP,KAAA,EAAO,MAAA,SAAe,YAAA,GAEtB;EAAA,KAAA,EAAO,QAAA,CAAS,MAAA;AAAA;;AAAM;AAgBxB;;;;;;;;;;;KAAY,cAAA,sBAAoC,UAAA;EAC9C,IAAA;EACA,IAAA,GAAO,OAAA;EACP,MAAA,EAAQ,cAAA;EACR,KAAA,GAAQ,OAAA;AAAA"}
@@ -1,6 +1,9 @@
1
1
  import { ModelPricing } from "./result/model-pricing.type.mjs";
2
2
  import { ModelContract } from "./model.contract.mjs";
3
3
  import { EmbedderConfig, EmbedderContract } from "./embedder.contract.mjs";
4
+ import { ImageModelConfig, ImageModelContract } from "./image-model.contract.mjs";
5
+ import { SpeechModelConfig, SpeechModelContract } from "./speech-model.contract.mjs";
6
+ import { TranscriptionModelConfig, TranscriptionModelContract } from "./transcription-model.contract.mjs";
4
7
 
5
8
  //#region ../@warlock.js/ai/src/contracts/sdk-adapter.contract.d.ts
6
9
  /**
@@ -71,6 +74,40 @@ interface SDKAdapterContract {
71
74
  * const { vector } = await embedder.embed("Hello world");
72
75
  */
73
76
  embedder?(config: EmbedderConfig): EmbedderContract;
77
+ /**
78
+ * Create an image-generation model bound to this SDK's client.
79
+ * Optional — only providers with an image API expose it (OpenAI,
80
+ * Google today; Anthropic/Bedrock/Ollama do not). The structural
81
+ * absence of this method IS the capability guard: an adapter that
82
+ * can't generate images simply doesn't define it, so `ai.someSdk.image(...)`
83
+ * is a compile-time error rather than a silent runtime failure.
84
+ * Hand the returned model to `ai.image({ model, prompt })`.
85
+ *
86
+ * @example
87
+ * const model = openai.image({ name: "gpt-image-1" });
88
+ * const { data } = await ai.image({ model, prompt: "a red bicycle" });
89
+ */
90
+ image?(config: ImageModelConfig): ImageModelContract;
91
+ /**
92
+ * Create a text-to-speech model bound to this SDK's client, for use
93
+ * with `ai.speech({ model, text })`. Optional — only providers with a
94
+ * TTS API expose it. Structural absence is the capability guard.
95
+ *
96
+ * @example
97
+ * const tts = openai.speech({ name: "tts-1", voice: "alloy" });
98
+ * const { data } = await ai.speech({ model: tts, text: "Hello" });
99
+ */
100
+ speech?(config: SpeechModelConfig): SpeechModelContract;
101
+ /**
102
+ * Create a speech-to-text (transcription) model bound to this SDK's
103
+ * client, for use with `ai.transcribe({ model, audio })`. Optional —
104
+ * only providers with an STT API expose it.
105
+ *
106
+ * @example
107
+ * const stt = openai.transcribe({ name: "whisper-1" });
108
+ * const { data } = await ai.transcribe({ model: stt, audio });
109
+ */
110
+ transcribe?(config: TranscriptionModelConfig): TranscriptionModelContract;
74
111
  }
75
112
  //#endregion
76
113
  export { ModelConfig, SDKAdapterContract };
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-adapter.contract.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/sdk-adapter.contract.ts"],"mappings":";;;;;;;AAkBA;;;;;;;;;;;AAiBc;KAjBF,WAAA;EAkCuB,qEAhCjC,IAAA,UAqCc;EAnCd,WAAA,WA6CqC;EA3CrC,SAAA;EAsDmC;;;;;;;;EA7CnC,OAAA,GAAU,YAAY,EAkCF;EAAA,CAhCnB,GAAA;AAAA;;;;;AA2CkD;;;;;;;;;;UA1BpC,kBAAA;;;;;EAKf,KAAA,CAAM,MAAA,EAAQ,WAAA,GAAc,aAAA;;;;;;;;;EAU5B,KAAA,CAAM,IAAA,UAAc,KAAA,YAAiB,OAAA;;;;;;;;;;EAWrC,QAAA,EAAU,MAAA,EAAQ,cAAA,GAAiB,gBAAA;AAAA"}
1
+ {"version":3,"file":"sdk-adapter.contract.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/sdk-adapter.contract.ts"],"mappings":";;;;;;;;;;AAwBA;;;;;;;;;;;AAiBc;KAjBF,WAAA;EAkCuB,qEAhCjC,IAAA,UAqCc;EAnCd,WAAA,WA6CqC;EA3CrC,SAAA;EAsDmC;;;;;;;;EA7CnC,OAAA,GAAU,YAAY,EAwBtB;EAAA,CAtBC,GAAA;AAAA;;;;;;;;;;;;;;;UAiBc,kBAAA;EAoDP;;;;EA/CR,KAAA,CAAM,MAAA,EAAQ,WAAA,GAAc,aAAA;EA0DmB;;AAA0B;;;;;;EAhDzE,KAAA,CAAM,IAAA,UAAc,KAAA,YAAiB,OAAA;;;;;;;;;;EAWrC,QAAA,EAAU,MAAA,EAAQ,cAAA,GAAiB,gBAAA;;;;;;;;;;;;;;EAenC,KAAA,EAAO,MAAA,EAAQ,gBAAA,GAAmB,kBAAA;;;;;;;;;;EAWlC,MAAA,EAAQ,MAAA,EAAQ,iBAAA,GAAoB,mBAAA;;;;;;;;;;EAWpC,UAAA,EAAY,MAAA,EAAQ,wBAAA,GAA2B,0BAAA;AAAA"}