@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,6 +1,7 @@
1
1
  import { ExecutableContract } from "../executable.contract.mjs";
2
2
  import { WorkflowResult } from "../result/workflow-result.type.mjs";
3
3
  import { ToolContract } from "../../tool/tool.mjs";
4
+ import { FlowObserveOption } from "../../observe/resolve-observers.mjs";
4
5
  import { SnapshotStore } from "../orchestrator/snapshot-store.contract.mjs";
5
6
  import { NextStepResult } from "./next-step-result.type.mjs";
6
7
  import { RetryConfig } from "./retry-config.type.mjs";
@@ -99,6 +100,21 @@ type WorkflowDefinition<TInput = unknown, TOutput = unknown, TState = Record<str
99
100
  nextStep?: (stepName: string, ctx: WorkflowContext<TInput, TState, TContext>) => NextStepResult | Promise<NextStepResult>;
100
101
  output?: StepOutputSpec<TOutput, TInput, TState, TContext>;
101
102
  on?: WorkflowEventHandlers;
103
+ /**
104
+ * Observability for this workflow. Additive and gated — when omitted,
105
+ * the workflow follows the global observe-all flag (off unless an
106
+ * observability tool turned it on), so behavior is unchanged by
107
+ * default.
108
+ *
109
+ * - `true` → route this run's completed report to the globally
110
+ * registered observers, even when observe-all is off.
111
+ * - `false` → opt this workflow out entirely, even when observe-all is on.
112
+ * - an `Observer` object → a flow-local collector receiving only this
113
+ * workflow's report. Typed as the structural `Observer` so core stays
114
+ * panoptic-agnostic; a panoptic flow-local collector can be passed
115
+ * directly. Observer errors are swallowed — they never break the run.
116
+ */
117
+ observe?: FlowObserveOption;
102
118
  };
103
119
  /**
104
120
  * Runtime handle returned by `ai.workflow(def)`. Implements the
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/workflow/workflow.contract.ts"],"mappings":";;;;;;;;;;;;;KAYY,oBAAA,iBAAqC,gBAAA,KAC/C,OAAA,EAAS,gBAAA,CAAiB,CAAA;AAAA,KAGhB,qBAAA,GAAwB,OAAA,eACtB,gBAAA,GAAmB,oBAAA,CAAqB,CAAA;;;;;KAO1C,kBAAA;EAXiB,sEAa3B,KAAA,WAd+C;EAgB/C,MAAA,GAAS,WAAA,EAfiB;EAiB1B,EAAA,GAAK,qBAAA;EAjBuB;AAAA;AAG9B;;;;;EAsBE,OAAA,GAAU,QAAA;EAtBwB;;;;;;;EA8BlC,SAAA;AAAA;AA7BqD;AAOvD;;;;AAPuD,KAqC3C,sBAAA,yCAGR,kBAAA,CAAmB,QAAA;EACrB,KAAA,EAAO,MAAA;AAAA;AAAA,KAGG,qBAAA,uBACV,kBAAkB,CAAC,QAAA;EAtCU;;EAyC3B,KAAA;AAAA;AAAA,KAGQ,kBAAA,+CAGD,MAAA;EAGT,IAAA;EApCA;;;;AAQS;EAkCT,WAAA;EA1BgC;;;;;;;;;;EAqChC,WAAA,GAAc,gBAAA,CAAiB,MAAA;EAC/B,OAAA;EACA,KAAA,EAAO,cAAA,CAAe,MAAA,EAAQ,MAAA,EAAQ,QAAA;EAnCzB;AAAA;AAGf;;;;;;;;;EA4CE,aAAA,GAAgB,aAAA,CAAc,gBAAA;EArCpB;;;;;;;;;EA+CV,YAAA,GAAe,WAAA;EACf,QAAA;EACA,aAAA;EACA,QAAA,IACE,QAAA,UACA,GAAA,EAAK,eAAA,CAAgB,MAAA,EAAQ,MAAA,EAAQ,QAAA,MAClC,cAAA,GAAiB,OAAA,CAAQ,cAAA;EAC9B,MAAA,GAAS,cAAA,CAAe,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,QAAA;EACjD,EAAA,GAAK,qBAAA;AAAA;;;;;;;UASU,gBAAA,+CAGN,MAAA,+CAED,kBAAA,CACR,MAAA,EACA,kBAAA,CAAmB,QAAA,GACnB,cAAA,CAAe,OAAA;EAAA,SAEN,IAAA;EAAA,SACA,WAAA;EApBJ;;;;;;EAAA,SA2BI,WAAA,GAAc,gBAAA,CAAiB,MAAA;EAAA,SAC/B,SAAA;EAAA,SACA,OAAA;EAxET;;;;;;;;;;;;;;EAwFA,OAAA,CACE,KAAA,EAAO,MAAA,EACP,OAAA,GAAU,kBAAA,CAAmB,QAAA,IAC5B,OAAA,CAAQ,cAAA,CAAe,OAAA;EAC1B,OAAA,CACE,OAAA,EAAS,sBAAA,CAAuB,MAAA,EAAQ,QAAA,IACvC,OAAA,CAAQ,cAAA,CAAe,OAAA;EAE1B,MAAA,CACE,KAAA,UACA,OAAA,GAAU,qBAAA,CAAsB,QAAA,IAC/B,OAAA,CAAQ,cAAA,CAAe,OAAA;EAE1B,EAAA,iBAAmB,gBAAA,EAAkB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,oBAAA,CAAqB,CAAA;EAC7E,GAAA,iBAAoB,gBAAA,EAAkB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,oBAAA,CAAqB,CAAA;EA9DvE;;;;;;;;;;;;;;;;EAgFP,MAAA,cAAoB,MAAA,EAAQ,OAAA;IAC1B,WAAA;IACA,WAAA,EAAa,gBAAA,CAAiB,UAAA;EAAA,IAC5B,YAAA,CAAa,UAAA,EAAY,OAAA;AAAA"}
1
+ {"version":3,"file":"workflow.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/workflow/workflow.contract.ts"],"mappings":";;;;;;;;;;;;;;KAaY,oBAAA,iBAAqC,gBAAA,KAC/C,OAAA,EAAS,gBAAA,CAAiB,CAAA;AAAA,KAGhB,qBAAA,GAAwB,OAAA,eACtB,gBAAA,GAAmB,oBAAA,CAAqB,CAAA;;;;;KAO1C,kBAAA;EAXiB,sEAa3B,KAAA,WAd+C;EAgB/C,MAAA,GAAS,WAAA,EAfiB;EAiB1B,EAAA,GAAK,qBAAA;EAjBuB;AAAA;AAG9B;;;;;EAsBE,OAAA,GAAU,QAAA;EAtBwB;;;;;;;EA8BlC,SAAA;AAAA;AA7BqD;AAOvD;;;;AAPuD,KAqC3C,sBAAA,yCAGR,kBAAA,CAAmB,QAAA;EACrB,KAAA,EAAO,MAAA;AAAA;AAAA,KAGG,qBAAA,uBACV,kBAAkB,CAAC,QAAA;EAtCU;;EAyC3B,KAAA;AAAA;AAAA,KAGQ,kBAAA,+CAGD,MAAA;EAGT,IAAA;EApCA;;;;AAQS;EAkCT,WAAA;EA1BgC;;;;;;;;;;EAqChC,WAAA,GAAc,gBAAA,CAAiB,MAAA;EAC/B,OAAA;EACA,KAAA,EAAO,cAAA,CAAe,MAAA,EAAQ,MAAA,EAAQ,QAAA;EAnCzB;AAAA;AAGf;;;;;;;;;EA4CE,aAAA,GAAgB,aAAA,CAAc,gBAAA;EArCpB;;;;;;;;;EA+CV,YAAA,GAAe,WAAA;EACf,QAAA;EACA,aAAA;EACA,QAAA,IACE,QAAA,UACA,GAAA,EAAK,eAAA,CAAgB,MAAA,EAAQ,MAAA,EAAQ,QAAA,MAClC,cAAA,GAAiB,OAAA,CAAQ,cAAA;EAC9B,MAAA,GAAS,cAAA,CAAe,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,QAAA;EACjD,EAAA,GAAK,qBAAA;EAHkC;;;;;;;;;;;;;;EAkBvC,OAAA,GAAU,iBAAA;AAAA;;;;;;;UASK,gBAAA,+CAGN,MAAA,+CAED,kBAAA,CACR,MAAA,EACA,kBAAA,CAAmB,QAAA,GACnB,cAAA,CAAe,OAAA;EAAA,SAEN,IAAA;EAAA,SACA,WAAA;EAjET;;;;;;EAAA,SAwES,WAAA,GAAc,gBAAA,CAAiB,MAAA;EAAA,SAC/B,SAAA;EAAA,SACA,OAAA;EApDM;;;;;;;;;;;;;;EAoEf,OAAA,CACE,KAAA,EAAO,MAAA,EACP,OAAA,GAAU,kBAAA,CAAmB,QAAA,IAC5B,OAAA,CAAQ,cAAA,CAAe,OAAA;EAC1B,OAAA,CACE,OAAA,EAAS,sBAAA,CAAuB,MAAA,EAAQ,QAAA,IACvC,OAAA,CAAQ,cAAA,CAAe,OAAA;EAE1B,MAAA,CACE,KAAA,UACA,OAAA,GAAU,qBAAA,CAAsB,QAAA,IAC/B,OAAA,CAAQ,cAAA,CAAe,OAAA;EAE1B,EAAA,iBAAmB,gBAAA,EAAkB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,oBAAA,CAAqB,CAAA;EAC7E,GAAA,iBAAoB,gBAAA,EAAkB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,oBAAA,CAAqB,CAAA;EA1E9E;;;;;AAe2B;AAS7B;;;;;;;;;;EAoEE,MAAA,cAAoB,MAAA,EAAQ,OAAA;IAC1B,WAAA;IACA,WAAA,EAAa,gBAAA,CAAiB,UAAA;EAAA,IAC5B,YAAA,CAAa,UAAA,EAAY,OAAA;AAAA"}
@@ -0,0 +1,32 @@
1
+ import { ErrorCategory } from "./error-category.type.mjs";
2
+ import { AIErrorOptions } from "./ai-error.mjs";
3
+ import { AgentExecutionError } from "./agent-execution-error.mjs";
4
+
5
+ //#region ../@warlock.js/ai/src/errors/agent-drift-error.d.ts
6
+ type AgentDriftErrorOptions = AIErrorOptions & {
7
+ /** Signature recorded on the snapshot being resumed. */savedSignature: string; /** Signature computed from the current agent definition. */
8
+ currentSignature: string;
9
+ runId: string;
10
+ };
11
+ /**
12
+ * `agent.resume(runId)` loaded a durable snapshot whose structural
13
+ * fingerprint does not match the current agent definition (model +
14
+ * provider + sorted tool names + maxTrips + output presence + version).
15
+ * The resume is refused — no trip runs — and the user decides how to
16
+ * recover: discard the snapshot, migrate manually, or call
17
+ * `resume(runId, { force: true })` to bypass the check.
18
+ *
19
+ * Mirrors `SupervisorDriftError` / `WorkflowDriftError` — same rationale,
20
+ * different primitive. Thrown (not returned on `result.error`) because a
21
+ * drifted resume never produces a valid run.
22
+ */
23
+ declare class AgentDriftError extends AgentExecutionError {
24
+ static readonly defaultCategory: ErrorCategory;
25
+ readonly savedSignature: string;
26
+ readonly currentSignature: string;
27
+ readonly runId: string;
28
+ constructor(message: string, options: AgentDriftErrorOptions);
29
+ }
30
+ //#endregion
31
+ export { AgentDriftError, AgentDriftErrorOptions };
32
+ //# sourceMappingURL=agent-drift-error.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-drift-error.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/agent-drift-error.ts"],"mappings":";;;;;KAIY,sBAAA,GAAyB,cAAc;0DAEjD,cAAA,UAFgC;EAIhC,gBAAA;EACA,KAAA;AAAA;;;;;AAAK;AAeP;;;;;;;cAAa,eAAA,SAAwB,mBAAA;EAAA,gBACZ,eAAA,EAAiB,aAAA;EAAA,SAExB,cAAA;EAAA,SACA,gBAAA;EAAA,SACA,KAAA;cAEG,OAAA,UAAiB,OAAA,EAAS,sBAAA;AAAA"}
@@ -0,0 +1,31 @@
1
+ import { AgentExecutionError } from "./agent-execution-error.mjs";
2
+
3
+ //#region ../@warlock.js/ai/src/errors/agent-drift-error.ts
4
+ /**
5
+ * `agent.resume(runId)` loaded a durable snapshot whose structural
6
+ * fingerprint does not match the current agent definition (model +
7
+ * provider + sorted tool names + maxTrips + output presence + version).
8
+ * The resume is refused — no trip runs — and the user decides how to
9
+ * recover: discard the snapshot, migrate manually, or call
10
+ * `resume(runId, { force: true })` to bypass the check.
11
+ *
12
+ * Mirrors `SupervisorDriftError` / `WorkflowDriftError` — same rationale,
13
+ * different primitive. Thrown (not returned on `result.error`) because a
14
+ * drifted resume never produces a valid run.
15
+ */
16
+ var AgentDriftError = class extends AgentExecutionError {
17
+ static {
18
+ this.defaultCategory = "drift";
19
+ }
20
+ constructor(message, options) {
21
+ super(message, options, "AGENT_DRIFT");
22
+ this.name = "AgentDriftError";
23
+ this.savedSignature = options.savedSignature;
24
+ this.currentSignature = options.currentSignature;
25
+ this.runId = options.runId;
26
+ }
27
+ };
28
+
29
+ //#endregion
30
+ export { AgentDriftError };
31
+ //# sourceMappingURL=agent-drift-error.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-drift-error.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/agent-drift-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport { AgentExecutionError } from \"./agent-execution-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\n\nexport type AgentDriftErrorOptions = AIErrorOptions & {\n /** Signature recorded on the snapshot being resumed. */\n savedSignature: string;\n /** Signature computed from the current agent definition. */\n currentSignature: string;\n runId: string;\n};\n\n/**\n * `agent.resume(runId)` loaded a durable snapshot whose structural\n * fingerprint does not match the current agent definition (model +\n * provider + sorted tool names + maxTrips + output presence + version).\n * The resume is refused — no trip runs — and the user decides how to\n * recover: discard the snapshot, migrate manually, or call\n * `resume(runId, { force: true })` to bypass the check.\n *\n * Mirrors `SupervisorDriftError` / `WorkflowDriftError` — same rationale,\n * different primitive. Thrown (not returned on `result.error`) because a\n * drifted resume never produces a valid run.\n */\nexport class AgentDriftError extends AgentExecutionError {\n public static readonly defaultCategory: ErrorCategory = \"drift\";\n\n public readonly savedSignature: string;\n public readonly currentSignature: string;\n public readonly runId: string;\n\n public constructor(message: string, options: AgentDriftErrorOptions) {\n super(message, options, \"AGENT_DRIFT\");\n this.name = \"AgentDriftError\";\n this.savedSignature = options.savedSignature;\n this.currentSignature = options.currentSignature;\n this.runId = options.runId;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAa,kBAAb,cAAqC,oBAAoB;;yBACC;;CAMxD,AAAO,YAAY,SAAiB,SAAiC;EACnE,MAAM,SAAS,SAAS,aAAa;EACrC,KAAK,OAAO;EACZ,KAAK,iBAAiB,QAAQ;EAC9B,KAAK,mBAAmB,QAAQ;EAChC,KAAK,QAAQ,QAAQ;CACvB;AACF"}
@@ -13,7 +13,7 @@
13
13
  * return agent.execute(input);
14
14
  * }
15
15
  */
16
- type AIErrorCode = "AGENT_EXEC_FAILED" | "AGENT_CANCELLED" | "AGENT_MAX_TRIPS" | "SCHEMA_VALIDATION_FAILED" | "TOOL_EXEC_FAILED" | "PROVIDER_ERROR" | "PROVIDER_RATE_LIMIT" | "PROVIDER_QUOTA_EXCEEDED" | "PROVIDER_TIMEOUT" | "CONTEXT_LENGTH_EXCEEDED" | "CONTENT_FILTER" | "PROVIDER_INVALID_REQUEST" | "PROVIDER_AUTH" | "BUDGET_EXCEEDED" | "GUARDRAIL_VIOLATION" | "WORKFLOW_ERROR" | "STEP_FAILED" | "WORKFLOW_DRIFT" | "WORKFLOW_CANCELLED" | "WORKFLOW_MAX_STEPS" | "WORKFLOW_INVALID_GOTO" | "SUPERVISOR_FAILED" | "SUPERVISOR_MAX_ITERATIONS" | "SUPERVISOR_INVALID_ROUTE" | "SUPERVISOR_CANCELLED" | "SUPERVISOR_DRIFT" | "SUPERVISOR_INTENT_DESCRIPTION_REQUIRED" | "SUPERVISOR_INTENT_MIXED_DISPATCH" | "SUPERVISOR_INTENT_STREAM_AND_OUTPUT" | "SUPERVISOR_INTENT_STREAM_TO_REQUIRED" | "SUPERVISOR_INTENT_STREAM_ON_WORKFLOW" | "SUPERVISOR_DISPATCH_CYCLE" | "ORCHESTRATOR_FAILED" | "ORCHESTRATOR_DRIFT" | "ORCHESTRATOR_CONFIG" | "ORCHESTRATOR_CANCELLED" | "PLANNER_FAILED" | "PLANNER_PLAN_INVALID" | "PLANNER_CANCELLED";
16
+ type AIErrorCode = "AGENT_EXEC_FAILED" | "AGENT_CANCELLED" | "AGENT_MAX_TRIPS" | "AGENT_DRIFT" | "SCHEMA_VALIDATION_FAILED" | "TOOL_EXEC_FAILED" | "PROVIDER_ERROR" | "PROVIDER_RATE_LIMIT" | "PROVIDER_QUOTA_EXCEEDED" | "PROVIDER_TIMEOUT" | "CONTEXT_LENGTH_EXCEEDED" | "CONTENT_FILTER" | "PROVIDER_INVALID_REQUEST" | "PROVIDER_AUTH" | "BUDGET_EXCEEDED" | "GUARDRAIL_VIOLATION" | "WORKFLOW_ERROR" | "STEP_FAILED" | "WORKFLOW_DRIFT" | "WORKFLOW_CANCELLED" | "WORKFLOW_MAX_STEPS" | "WORKFLOW_INVALID_GOTO" | "SUPERVISOR_FAILED" | "SUPERVISOR_MAX_ITERATIONS" | "SUPERVISOR_INVALID_ROUTE" | "SUPERVISOR_CANCELLED" | "SUPERVISOR_DRIFT" | "SUPERVISOR_INTENT_DESCRIPTION_REQUIRED" | "SUPERVISOR_INTENT_MIXED_DISPATCH" | "SUPERVISOR_INTENT_STREAM_AND_OUTPUT" | "SUPERVISOR_INTENT_STREAM_TO_REQUIRED" | "SUPERVISOR_INTENT_STREAM_ON_WORKFLOW" | "SUPERVISOR_DISPATCH_CYCLE" | "ORCHESTRATOR_FAILED" | "ORCHESTRATOR_DRIFT" | "ORCHESTRATOR_CONFIG" | "ORCHESTRATOR_CANCELLED" | "PLANNER_FAILED" | "PLANNER_PLAN_INVALID" | "PLANNER_CANCELLED" | "PLANNER_DRIFT" | "VCR_CASSETTE_MISS" | "OUTBOUND_POLICY_BLOCKED";
17
17
  //#endregion
18
18
  export { AIErrorCode };
19
19
  //# sourceMappingURL=error-code.type.d.mts.map
@@ -3,6 +3,7 @@ import { AIErrorCode } from "./error-code.type.mjs";
3
3
  import { AIError, AIErrorOptions } from "./ai-error.mjs";
4
4
  import { AgentExecutionError } from "./agent-execution-error.mjs";
5
5
  import { AgentCancelledError, AgentCancelledErrorOptions } from "./agent-cancelled-error.mjs";
6
+ import { AgentDriftError, AgentDriftErrorOptions } from "./agent-drift-error.mjs";
6
7
  import { AgentMaxTripsError, AgentMaxTripsErrorOptions } from "./agent-max-trips-error.mjs";
7
8
  import { BudgetExceededError, BudgetExceededErrorOptions, BudgetUnit } from "./budget-exceeded-error.mjs";
8
9
  import { ProviderError } from "./provider-error.mjs";
@@ -18,8 +19,10 @@ import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
18
19
  import { OrchestratorCancelledError, OrchestratorCancelledErrorOptions } from "./orchestrator-cancelled-error.mjs";
19
20
  import { OrchestratorConfigError } from "./orchestrator-config-error.mjs";
20
21
  import { OrchestratorDriftError, OrchestratorDriftErrorOptions } from "./orchestrator-drift-error.mjs";
22
+ import { OutboundPolicyError } from "./outbound-policy-error.mjs";
21
23
  import { PlannerFailedError } from "./planner-failed-error.mjs";
22
24
  import { PlannerCancelledError, PlannerCancelledErrorOptions } from "./planner-cancelled-error.mjs";
25
+ import { PlannerDriftError, PlannerDriftErrorOptions } from "./planner-drift-error.mjs";
23
26
  import { PlannerPlanInvalidError } from "./planner-plan-invalid-error.mjs";
24
27
  import { ProviderAuthError } from "./provider-auth-error.mjs";
25
28
  import { ProviderRateLimitError, ProviderRateLimitErrorOptions } from "./provider-rate-limit-error.mjs";
@@ -1,6 +1,7 @@
1
1
  import { AIError } from "./ai-error.mjs";
2
2
  import { AgentExecutionError } from "./agent-execution-error.mjs";
3
3
  import { AgentCancelledError } from "./agent-cancelled-error.mjs";
4
+ import { AgentDriftError } from "./agent-drift-error.mjs";
4
5
  import { AgentMaxTripsError } from "./agent-max-trips-error.mjs";
5
6
  import { BudgetExceededError } from "./budget-exceeded-error.mjs";
6
7
  import { ProviderError } from "./provider-error.mjs";
@@ -16,8 +17,10 @@ import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
16
17
  import { OrchestratorCancelledError } from "./orchestrator-cancelled-error.mjs";
17
18
  import { OrchestratorConfigError } from "./orchestrator-config-error.mjs";
18
19
  import { OrchestratorDriftError } from "./orchestrator-drift-error.mjs";
20
+ import { OutboundPolicyError } from "./outbound-policy-error.mjs";
19
21
  import { PlannerFailedError } from "./planner-failed-error.mjs";
20
22
  import { PlannerCancelledError } from "./planner-cancelled-error.mjs";
23
+ import { PlannerDriftError } from "./planner-drift-error.mjs";
21
24
  import { PlannerPlanInvalidError } from "./planner-plan-invalid-error.mjs";
22
25
  import { ProviderAuthError } from "./provider-auth-error.mjs";
23
26
  import { ProviderRateLimitError } from "./provider-rate-limit-error.mjs";
@@ -0,0 +1,27 @@
1
+ import { ErrorCategory } from "./error-category.type.mjs";
2
+ import { AIError, AIErrorOptions } from "./ai-error.mjs";
3
+
4
+ //#region ../@warlock.js/ai/src/errors/outbound-policy-error.d.ts
5
+ /**
6
+ * A server-side outbound request (attachment fetch, URL skill manifest,
7
+ * RAG loader, …) was blocked by the shared `OutboundPolicy` before it
8
+ * left the process — a disallowed scheme, a host outside the allowlist, a
9
+ * private / loopback / link-local / cloud-metadata address resolved after
10
+ * DNS, an oversized body, or a timeout.
11
+ *
12
+ * This is the framework's SSRF / resource-exhaustion guard surfacing: the
13
+ * request was refused on purpose, not a provider failure. `context`
14
+ * carries the offending `url` / `host` / `reason` for logs.
15
+ *
16
+ * @example
17
+ * if (error instanceof OutboundPolicyError) {
18
+ * logger.warn("blocked outbound fetch", { context: error.context });
19
+ * }
20
+ */
21
+ declare class OutboundPolicyError extends AIError {
22
+ static readonly defaultCategory: ErrorCategory;
23
+ constructor(message: string, options?: AIErrorOptions);
24
+ }
25
+ //#endregion
26
+ export { OutboundPolicyError };
27
+ //# sourceMappingURL=outbound-policy-error.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbound-policy-error.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/outbound-policy-error.ts"],"mappings":";;;;;;AAmBA;;;;;;;;;;;;;;cAAa,mBAAA,SAA4B,OAAA;EAAA,gBAChB,eAAA,EAAiB,aAAA;cAErB,OAAA,UAAiB,OAAA,GAAU,cAAA;AAAA"}
@@ -0,0 +1,32 @@
1
+ import { AIError } from "./ai-error.mjs";
2
+
3
+ //#region ../@warlock.js/ai/src/errors/outbound-policy-error.ts
4
+ /**
5
+ * A server-side outbound request (attachment fetch, URL skill manifest,
6
+ * RAG loader, …) was blocked by the shared `OutboundPolicy` before it
7
+ * left the process — a disallowed scheme, a host outside the allowlist, a
8
+ * private / loopback / link-local / cloud-metadata address resolved after
9
+ * DNS, an oversized body, or a timeout.
10
+ *
11
+ * This is the framework's SSRF / resource-exhaustion guard surfacing: the
12
+ * request was refused on purpose, not a provider failure. `context`
13
+ * carries the offending `url` / `host` / `reason` for logs.
14
+ *
15
+ * @example
16
+ * if (error instanceof OutboundPolicyError) {
17
+ * logger.warn("blocked outbound fetch", { context: error.context });
18
+ * }
19
+ */
20
+ var OutboundPolicyError = class extends AIError {
21
+ static {
22
+ this.defaultCategory = "validation";
23
+ }
24
+ constructor(message, options) {
25
+ super("OUTBOUND_POLICY_BLOCKED", message, options);
26
+ this.name = "OutboundPolicyError";
27
+ }
28
+ };
29
+
30
+ //#endregion
31
+ export { OutboundPolicyError };
32
+ //# sourceMappingURL=outbound-policy-error.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbound-policy-error.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/outbound-policy-error.ts"],"sourcesContent":["import { AIError, type AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\n\n/**\n * A server-side outbound request (attachment fetch, URL skill manifest,\n * RAG loader, …) was blocked by the shared `OutboundPolicy` before it\n * left the process — a disallowed scheme, a host outside the allowlist, a\n * private / loopback / link-local / cloud-metadata address resolved after\n * DNS, an oversized body, or a timeout.\n *\n * This is the framework's SSRF / resource-exhaustion guard surfacing: the\n * request was refused on purpose, not a provider failure. `context`\n * carries the offending `url` / `host` / `reason` for logs.\n *\n * @example\n * if (error instanceof OutboundPolicyError) {\n * logger.warn(\"blocked outbound fetch\", { context: error.context });\n * }\n */\nexport class OutboundPolicyError extends AIError {\n public static readonly defaultCategory: ErrorCategory = \"validation\";\n\n public constructor(message: string, options?: AIErrorOptions) {\n super(\"OUTBOUND_POLICY_BLOCKED\", message, options);\n this.name = \"OutboundPolicyError\";\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAa,sBAAb,cAAyC,QAAQ;;yBACS;;CAExD,AAAO,YAAY,SAAiB,SAA0B;EAC5D,MAAM,2BAA2B,SAAS,OAAO;EACjD,KAAK,OAAO;CACd;AACF"}
@@ -0,0 +1,34 @@
1
+ import { ErrorCategory } from "./error-category.type.mjs";
2
+ import { AIErrorOptions } from "./ai-error.mjs";
3
+ import { PlannerFailedError } from "./planner-failed-error.mjs";
4
+
5
+ //#region ../@warlock.js/ai/src/errors/planner-drift-error.d.ts
6
+ type PlannerDriftErrorOptions = AIErrorOptions & {
7
+ /** Signature recorded on the snapshot being resumed. */savedSignature: string; /** Signature computed from the current planner definition. */
8
+ currentSignature: string;
9
+ runId: string;
10
+ };
11
+ /**
12
+ * `planner.resume(runId)` loaded a durable snapshot whose structural
13
+ * fingerprint does not match the current planner definition (name +
14
+ * ordered capability names). The resume is refused — no node runs — and
15
+ * the user decides how to recover: discard the snapshot, migrate
16
+ * manually, or call `resume(runId, { force: true })` to bypass the check.
17
+ *
18
+ * A mid-run re-plan is NOT drift — the plan changed, not the definition;
19
+ * the persisted `replanCount` honors the replan budget across a resume.
20
+ *
21
+ * Mirrors `SupervisorDriftError` / `WorkflowDriftError` — same rationale,
22
+ * different primitive. Thrown (not returned on `result.error`) because a
23
+ * drifted resume never produces a valid run.
24
+ */
25
+ declare class PlannerDriftError extends PlannerFailedError {
26
+ static readonly defaultCategory: ErrorCategory;
27
+ readonly savedSignature: string;
28
+ readonly currentSignature: string;
29
+ readonly runId: string;
30
+ constructor(message: string, options: PlannerDriftErrorOptions);
31
+ }
32
+ //#endregion
33
+ export { PlannerDriftError, PlannerDriftErrorOptions };
34
+ //# sourceMappingURL=planner-drift-error.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-drift-error.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/planner-drift-error.ts"],"mappings":";;;;;KAIY,wBAAA,GAA2B,cAAc;0DAEnD,cAAA,UAFkC;EAIlC,gBAAA;EACA,KAAA;AAAA;;;;;AAAK;AAiBP;;;;;;;;;cAAa,iBAAA,SAA0B,kBAAA;EAAA,gBACd,eAAA,EAAiB,aAAA;EAAA,SAExB,cAAA;EAAA,SACA,gBAAA;EAAA,SACA,KAAA;cAEG,OAAA,UAAiB,OAAA,EAAS,wBAAA;AAAA"}
@@ -0,0 +1,33 @@
1
+ import { PlannerFailedError } from "./planner-failed-error.mjs";
2
+
3
+ //#region ../@warlock.js/ai/src/errors/planner-drift-error.ts
4
+ /**
5
+ * `planner.resume(runId)` loaded a durable snapshot whose structural
6
+ * fingerprint does not match the current planner definition (name +
7
+ * ordered capability names). The resume is refused — no node runs — and
8
+ * the user decides how to recover: discard the snapshot, migrate
9
+ * manually, or call `resume(runId, { force: true })` to bypass the check.
10
+ *
11
+ * A mid-run re-plan is NOT drift — the plan changed, not the definition;
12
+ * the persisted `replanCount` honors the replan budget across a resume.
13
+ *
14
+ * Mirrors `SupervisorDriftError` / `WorkflowDriftError` — same rationale,
15
+ * different primitive. Thrown (not returned on `result.error`) because a
16
+ * drifted resume never produces a valid run.
17
+ */
18
+ var PlannerDriftError = class extends PlannerFailedError {
19
+ static {
20
+ this.defaultCategory = "drift";
21
+ }
22
+ constructor(message, options) {
23
+ super(message, options, "PLANNER_DRIFT");
24
+ this.name = "PlannerDriftError";
25
+ this.savedSignature = options.savedSignature;
26
+ this.currentSignature = options.currentSignature;
27
+ this.runId = options.runId;
28
+ }
29
+ };
30
+
31
+ //#endregion
32
+ export { PlannerDriftError };
33
+ //# sourceMappingURL=planner-drift-error.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-drift-error.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/errors/planner-drift-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { PlannerFailedError } from \"./planner-failed-error\";\n\nexport type PlannerDriftErrorOptions = AIErrorOptions & {\n /** Signature recorded on the snapshot being resumed. */\n savedSignature: string;\n /** Signature computed from the current planner definition. */\n currentSignature: string;\n runId: string;\n};\n\n/**\n * `planner.resume(runId)` loaded a durable snapshot whose structural\n * fingerprint does not match the current planner definition (name +\n * ordered capability names). The resume is refused — no node runs — and\n * the user decides how to recover: discard the snapshot, migrate\n * manually, or call `resume(runId, { force: true })` to bypass the check.\n *\n * A mid-run re-plan is NOT drift — the plan changed, not the definition;\n * the persisted `replanCount` honors the replan budget across a resume.\n *\n * Mirrors `SupervisorDriftError` / `WorkflowDriftError` — same rationale,\n * different primitive. Thrown (not returned on `result.error`) because a\n * drifted resume never produces a valid run.\n */\nexport class PlannerDriftError extends PlannerFailedError {\n public static readonly defaultCategory: ErrorCategory = \"drift\";\n\n public readonly savedSignature: string;\n public readonly currentSignature: string;\n public readonly runId: string;\n\n public constructor(message: string, options: PlannerDriftErrorOptions) {\n super(message, options, \"PLANNER_DRIFT\");\n this.name = \"PlannerDriftError\";\n this.savedSignature = options.savedSignature;\n this.currentSignature = options.currentSignature;\n this.runId = options.runId;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,IAAa,oBAAb,cAAuC,mBAAmB;;yBACA;;CAMxD,AAAO,YAAY,SAAiB,SAAmC;EACrE,MAAM,SAAS,SAAS,eAAe;EACvC,KAAK,OAAO;EACZ,KAAK,iBAAiB,QAAQ;EAC9B,KAAK,mBAAmB,QAAQ;EAChC,KAAK,QAAQ,QAAQ;CACvB;AACF"}
@@ -0,0 +1,28 @@
1
+ import { DatasetContract, DatasetOptions } from "./dataset.type.mjs";
2
+
3
+ //#region ../@warlock.js/ai/src/eval/dataset.d.ts
4
+ /**
5
+ * Create an immutable evaluation dataset that feeds `agent.eval({ cases })`
6
+ * directly.
7
+ *
8
+ * **Role.** A taggable, filterable, shardable wrapper around a list of
9
+ * {@link DatasetEntry} rows. `agent.eval` accepts a `DatasetContract` in
10
+ * place of a raw `EvalCase[]`, reading `.cases` off it.
11
+ *
12
+ * Sources (combinable — file entries append after inline `cases`):
13
+ * - `cases` → inline entries.
14
+ * - `fromFile` → a JSONL file read once, synchronously, at construction
15
+ * (one JSON object per line). A malformed line throws an
16
+ * `InvalidRequestError` naming the 1-based line number.
17
+ *
18
+ * @example
19
+ * const ds = dataset({ name: "support", fromFile: "./eval/support.jsonl" });
20
+ * const smoke = ds.filter((entry) => entry.tags?.includes("smoke"));
21
+ * const shard = ds.shard(0, 4); // first of four parallel CI shards
22
+ *
23
+ * const report = await agent.eval({ cases: ds, scorers: [contains()] });
24
+ */
25
+ declare function dataset<TOutput = unknown>(options: DatasetOptions<TOutput>): DatasetContract<TOutput>;
26
+ //#endregion
27
+ export { dataset };
28
+ //# sourceMappingURL=dataset.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/eval/dataset.ts"],"mappings":";;;;;AAkIA;;;;;;;;;;;;;;;;AAE0B;;;iBAFV,OAAA,oBACd,OAAA,EAAS,cAAA,CAAe,OAAA,IACvB,eAAA,CAAgB,OAAA"}
@@ -0,0 +1,112 @@
1
+ import { InvalidRequestError } from "../errors/invalid-request-error.mjs";
2
+ import "../errors/index.mjs";
3
+ import { readFileSync } from "node:fs";
4
+
5
+ //#region ../@warlock.js/ai/src/eval/dataset.ts
6
+ /**
7
+ * Parse a JSONL file's contents into {@link DatasetEntry} rows. Blank
8
+ * lines (and trailing whitespace-only lines) are skipped; every other
9
+ * line must be a JSON object. A malformed line throws an
10
+ * `InvalidRequestError` naming the 1-based line number — failing loud at
11
+ * construction, like `SystemPrompt.fromFile`.
12
+ */
13
+ function parseJsonl(path, contents) {
14
+ const entries = [];
15
+ const lines = contents.split(/\r?\n/);
16
+ for (let index = 0; index < lines.length; index++) {
17
+ const line = lines[index].trim();
18
+ if (line === "") continue;
19
+ let parsed;
20
+ try {
21
+ parsed = JSON.parse(line);
22
+ } catch (error) {
23
+ throw new InvalidRequestError(`Failed to parse dataset file "${path}" — line ${index + 1} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`, {
24
+ context: {
25
+ path,
26
+ line: index + 1
27
+ },
28
+ cause: error
29
+ });
30
+ }
31
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new InvalidRequestError(`Failed to parse dataset file "${path}" — line ${index + 1} is not a JSON object`, { context: {
32
+ path,
33
+ line: index + 1
34
+ } });
35
+ entries.push(parsed);
36
+ }
37
+ return entries;
38
+ }
39
+ /**
40
+ * Read a JSONL dataset file once, synchronously, at construction.
41
+ * Mirrors `SystemPrompt.fromFile`: a read failure (missing path,
42
+ * permission denied) throws an `InvalidRequestError` surfacing the
43
+ * underlying cause.
44
+ */
45
+ function readDatasetFile(path) {
46
+ let contents;
47
+ try {
48
+ contents = readFileSync(path, "utf8");
49
+ } catch (error) {
50
+ throw new InvalidRequestError(`Failed to read dataset file "${path}" — ${error instanceof Error ? error.message : String(error)}`, {
51
+ context: { path },
52
+ cause: error
53
+ });
54
+ }
55
+ return parseJsonl(path, contents);
56
+ }
57
+ /**
58
+ * Build an immutable {@link DatasetContract} over the given entries.
59
+ * Shared by the {@link dataset} factory and by `filter` / `shard`, which
60
+ * each return a fresh dataset built from a derived case list.
61
+ */
62
+ function makeDataset(name, cases) {
63
+ return {
64
+ name,
65
+ cases,
66
+ filter(predicate) {
67
+ return makeDataset(name, cases.filter(predicate));
68
+ },
69
+ shard(index, total) {
70
+ if (!Number.isInteger(total) || total <= 0) throw new InvalidRequestError(`dataset.shard: "total" must be a positive integer, received ${total}`, { context: {
71
+ name,
72
+ total
73
+ } });
74
+ if (!Number.isInteger(index) || index < 0 || index >= total) throw new InvalidRequestError(`dataset.shard: "index" must be an integer in [0, ${total}), received ${index}`, { context: {
75
+ name,
76
+ index,
77
+ total
78
+ } });
79
+ return makeDataset(name, cases.filter((_, position) => position % total === index));
80
+ }
81
+ };
82
+ }
83
+ /**
84
+ * Create an immutable evaluation dataset that feeds `agent.eval({ cases })`
85
+ * directly.
86
+ *
87
+ * **Role.** A taggable, filterable, shardable wrapper around a list of
88
+ * {@link DatasetEntry} rows. `agent.eval` accepts a `DatasetContract` in
89
+ * place of a raw `EvalCase[]`, reading `.cases` off it.
90
+ *
91
+ * Sources (combinable — file entries append after inline `cases`):
92
+ * - `cases` → inline entries.
93
+ * - `fromFile` → a JSONL file read once, synchronously, at construction
94
+ * (one JSON object per line). A malformed line throws an
95
+ * `InvalidRequestError` naming the 1-based line number.
96
+ *
97
+ * @example
98
+ * const ds = dataset({ name: "support", fromFile: "./eval/support.jsonl" });
99
+ * const smoke = ds.filter((entry) => entry.tags?.includes("smoke"));
100
+ * const shard = ds.shard(0, 4); // first of four parallel CI shards
101
+ *
102
+ * const report = await agent.eval({ cases: ds, scorers: [contains()] });
103
+ */
104
+ function dataset(options) {
105
+ const cases = [...options.cases ?? []];
106
+ if (options.fromFile !== void 0) cases.push(...readDatasetFile(options.fromFile));
107
+ return makeDataset(options.name, cases);
108
+ }
109
+
110
+ //#endregion
111
+ export { dataset };
112
+ //# sourceMappingURL=dataset.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/eval/dataset.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport type { DatasetContract, DatasetEntry, DatasetOptions } from \"./dataset.type\";\nimport { InvalidRequestError } from \"../errors\";\n\n/**\n * Parse a JSONL file's contents into {@link DatasetEntry} rows. Blank\n * lines (and trailing whitespace-only lines) are skipped; every other\n * line must be a JSON object. A malformed line throws an\n * `InvalidRequestError` naming the 1-based line number — failing loud at\n * construction, like `SystemPrompt.fromFile`.\n */\nfunction parseJsonl<TOutput>(path: string, contents: string): DatasetEntry<TOutput>[] {\n const entries: DatasetEntry<TOutput>[] = [];\n const lines = contents.split(/\\r?\\n/);\n\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index].trim();\n\n if (line === \"\") {\n continue;\n }\n\n let parsed: unknown;\n\n try {\n parsed = JSON.parse(line);\n } catch (error) {\n throw new InvalidRequestError(\n `Failed to parse dataset file \"${path}\" — line ${index + 1} is not valid JSON: ${\n error instanceof Error ? error.message : String(error)\n }`,\n { context: { path, line: index + 1 }, cause: error },\n );\n }\n\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n throw new InvalidRequestError(\n `Failed to parse dataset file \"${path}\" — line ${index + 1} is not a JSON object`,\n { context: { path, line: index + 1 } },\n );\n }\n\n entries.push(parsed as DatasetEntry<TOutput>);\n }\n\n return entries;\n}\n\n/**\n * Read a JSONL dataset file once, synchronously, at construction.\n * Mirrors `SystemPrompt.fromFile`: a read failure (missing path,\n * permission denied) throws an `InvalidRequestError` surfacing the\n * underlying cause.\n */\nfunction readDatasetFile<TOutput>(path: string): DatasetEntry<TOutput>[] {\n let contents: string;\n\n try {\n contents = readFileSync(path, \"utf8\");\n } catch (error) {\n throw new InvalidRequestError(\n `Failed to read dataset file \"${path}\" — ${\n error instanceof Error ? error.message : String(error)\n }`,\n { context: { path }, cause: error },\n );\n }\n\n return parseJsonl<TOutput>(path, contents);\n}\n\n/**\n * Build an immutable {@link DatasetContract} over the given entries.\n * Shared by the {@link dataset} factory and by `filter` / `shard`, which\n * each return a fresh dataset built from a derived case list.\n */\nfunction makeDataset<TOutput>(\n name: string,\n cases: DatasetEntry<TOutput>[],\n): DatasetContract<TOutput> {\n return {\n name,\n cases,\n filter(predicate) {\n return makeDataset(name, cases.filter(predicate));\n },\n shard(index, total) {\n if (!Number.isInteger(total) || total <= 0) {\n throw new InvalidRequestError(\n `dataset.shard: \"total\" must be a positive integer, received ${total}`,\n { context: { name, total } },\n );\n }\n\n if (!Number.isInteger(index) || index < 0 || index >= total) {\n throw new InvalidRequestError(\n `dataset.shard: \"index\" must be an integer in [0, ${total}), received ${index}`,\n { context: { name, index, total } },\n );\n }\n\n return makeDataset(\n name,\n cases.filter((_, position) => position % total === index),\n );\n },\n };\n}\n\n/**\n * Create an immutable evaluation dataset that feeds `agent.eval({ cases })`\n * directly.\n *\n * **Role.** A taggable, filterable, shardable wrapper around a list of\n * {@link DatasetEntry} rows. `agent.eval` accepts a `DatasetContract` in\n * place of a raw `EvalCase[]`, reading `.cases` off it.\n *\n * Sources (combinable — file entries append after inline `cases`):\n * - `cases` → inline entries.\n * - `fromFile` → a JSONL file read once, synchronously, at construction\n * (one JSON object per line). A malformed line throws an\n * `InvalidRequestError` naming the 1-based line number.\n *\n * @example\n * const ds = dataset({ name: \"support\", fromFile: \"./eval/support.jsonl\" });\n * const smoke = ds.filter((entry) => entry.tags?.includes(\"smoke\"));\n * const shard = ds.shard(0, 4); // first of four parallel CI shards\n *\n * const report = await agent.eval({ cases: ds, scorers: [contains()] });\n */\nexport function dataset<TOutput = unknown>(\n options: DatasetOptions<TOutput>,\n): DatasetContract<TOutput> {\n const cases: DatasetEntry<TOutput>[] = [...(options.cases ?? [])];\n\n if (options.fromFile !== undefined) {\n cases.push(...readDatasetFile<TOutput>(options.fromFile));\n }\n\n return makeDataset(options.name, cases);\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAS,WAAoB,MAAc,UAA2C;CACpF,MAAM,UAAmC,CAAC;CAC1C,MAAM,QAAQ,SAAS,MAAM,OAAO;CAEpC,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;EACjD,MAAM,OAAO,MAAM,MAAM,CAAC,KAAK;EAE/B,IAAI,SAAS,IACX;EAGF,IAAI;EAEJ,IAAI;GACF,SAAS,KAAK,MAAM,IAAI;EAC1B,SAAS,OAAO;GACd,MAAM,IAAI,oBACR,iCAAiC,KAAK,WAAW,QAAQ,EAAE,sBACzD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,KAEvD;IAAE,SAAS;KAAE;KAAM,MAAM,QAAQ;IAAE;IAAG,OAAO;GAAM,CACrD;EACF;EAEA,IAAI,WAAW,QAAQ,OAAO,WAAW,YAAY,MAAM,QAAQ,MAAM,GACvE,MAAM,IAAI,oBACR,iCAAiC,KAAK,WAAW,QAAQ,EAAE,wBAC3D,EAAE,SAAS;GAAE;GAAM,MAAM,QAAQ;EAAE,EAAE,CACvC;EAGF,QAAQ,KAAK,MAA+B;CAC9C;CAEA,OAAO;AACT;;;;;;;AAQA,SAAS,gBAAyB,MAAuC;CACvE,IAAI;CAEJ,IAAI;EACF,WAAW,aAAa,MAAM,MAAM;CACtC,SAAS,OAAO;EACd,MAAM,IAAI,oBACR,gCAAgC,KAAK,MACnC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,KAEvD;GAAE,SAAS,EAAE,KAAK;GAAG,OAAO;EAAM,CACpC;CACF;CAEA,OAAO,WAAoB,MAAM,QAAQ;AAC3C;;;;;;AAOA,SAAS,YACP,MACA,OAC0B;CAC1B,OAAO;EACL;EACA;EACA,OAAO,WAAW;GAChB,OAAO,YAAY,MAAM,MAAM,OAAO,SAAS,CAAC;EAClD;EACA,MAAM,OAAO,OAAO;GAClB,IAAI,CAAC,OAAO,UAAU,KAAK,KAAK,SAAS,GACvC,MAAM,IAAI,oBACR,+DAA+D,SAC/D,EAAE,SAAS;IAAE;IAAM;GAAM,EAAE,CAC7B;GAGF,IAAI,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,KAAK,SAAS,OACpD,MAAM,IAAI,oBACR,oDAAoD,MAAM,cAAc,SACxE,EAAE,SAAS;IAAE;IAAM;IAAO;GAAM,EAAE,CACpC;GAGF,OAAO,YACL,MACA,MAAM,QAAQ,GAAG,aAAa,WAAW,UAAU,KAAK,CAC1D;EACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,QACd,SAC0B;CAC1B,MAAM,QAAiC,CAAC,GAAI,QAAQ,SAAS,CAAC,CAAE;CAEhE,IAAI,QAAQ,aAAa,QACvB,MAAM,KAAK,GAAG,gBAAyB,QAAQ,QAAQ,CAAC;CAG1D,OAAO,YAAY,QAAQ,MAAM,KAAK;AACxC"}
@@ -0,0 +1,53 @@
1
+ import { EvalCase } from "../contracts/agent/eval.type.mjs";
2
+
3
+ //#region ../@warlock.js/ai/src/eval/dataset.type.d.ts
4
+ /**
5
+ * A single dataset row. A superset of {@link EvalCase} — every dataset
6
+ * entry is a valid eval case, plus optional `tags` for filtering and
7
+ * sharding a large suite.
8
+ */
9
+ type DatasetEntry<TOutput = unknown> = EvalCase<TOutput> & {
10
+ /** Optional tags for filtering / sharding a large dataset. */tags?: string[];
11
+ };
12
+ /**
13
+ * An immutable, filterable, shardable collection of {@link DatasetEntry}
14
+ * rows that feeds `agent.eval({ cases })` directly. Built via the
15
+ * {@link dataset} factory — never `new`.
16
+ */
17
+ type DatasetContract<TOutput = unknown> = {
18
+ /** Stable identifier for the dataset — surfaced for logging / artifacts. */readonly name: string; /** All entries (after any filter / shard applied at construction). */
19
+ readonly cases: DatasetEntry<TOutput>[];
20
+ /**
21
+ * Narrow by an arbitrary predicate (typically a tag check) — returns a
22
+ * new dataset sharing nothing mutable with this one.
23
+ */
24
+ filter(predicate: (entry: DatasetEntry<TOutput>) => boolean): DatasetContract<TOutput>;
25
+ /**
26
+ * Deterministic shard `index`-of-`total` for parallel CI jobs. Every
27
+ * entry lands in exactly one shard (round-robin by position), so the
28
+ * union of all `total` shards reproduces the full case list with no
29
+ * gaps or overlaps.
30
+ */
31
+ shard(index: number, total: number): DatasetContract<TOutput>;
32
+ };
33
+ /**
34
+ * Options for the {@link dataset} factory. Supply `cases` inline, or
35
+ * `fromFile` to load a JSONL file (one JSON-encoded {@link DatasetEntry}
36
+ * per line) synchronously at construction — mirroring
37
+ * `SystemPrompt.fromFile`'s one-shot sync read. Both may be combined;
38
+ * file entries are appended after inline `cases`.
39
+ */
40
+ type DatasetOptions<TOutput = unknown> = {
41
+ /** Stable identifier for the dataset. */name: string; /** Inline entries. */
42
+ cases?: DatasetEntry<TOutput>[];
43
+ /**
44
+ * Path to a JSONL file read once, synchronously, at construction. Each
45
+ * non-blank line must be a JSON object matching {@link DatasetEntry}; a
46
+ * malformed line throws an `InvalidRequestError` naming the 1-based line
47
+ * number.
48
+ */
49
+ fromFile?: string;
50
+ };
51
+ //#endregion
52
+ export { DatasetContract, DatasetEntry, DatasetOptions };
53
+ //# sourceMappingURL=dataset.type.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/eval/dataset.type.ts"],"mappings":";;;;;AAOA;;;KAAY,YAAA,sBAAkC,QAAQ,CAAC,OAAA;EAA9B,8DAEvB,IAAA;AAAA;;;AAAI;AAQN;;KAAY,eAAA;EAImB,qFAFpB,IAAA,UAQyB;EAAA,SANzB,KAAA,EAAO,YAAA,CAAa,OAAA;EAOV;;;;EAFnB,MAAA,CACE,SAAA,GAAY,KAAA,EAAO,YAAA,CAAa,OAAA,gBAC/B,eAAA,CAAgB,OAAA;EAOiC;;;;;;EAApD,KAAA,CAAM,KAAA,UAAe,KAAA,WAAgB,eAAA,CAAgB,OAAA;AAAA;;;;;;;;KAU3C,cAAA;EAV2B,yCAYrC,IAAA,UAZ4D;EAc5D,KAAA,GAAQ,YAAY,CAAC,OAAA;EAJX;;;;;;EAWV,QAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"eval-runner.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/eval/eval-runner.ts"],"mappings":";;;;;;AAmIA;;;;;;;iBAAsB,OAAA,UACpB,KAAA,EAAO,aAAA,CAAc,OAAA,GACrB,OAAA,EAAS,WAAA,CAAY,OAAA,IACpB,OAAA,CAAQ,UAAA,CAAW,OAAA"}
1
+ {"version":3,"file":"eval-runner.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/eval/eval-runner.ts"],"mappings":";;;;;;AAqJA;;;;;;;iBAAsB,OAAA,UACpB,KAAA,EAAO,aAAA,CAAc,OAAA,GACrB,OAAA,EAAS,WAAA,CAAY,OAAA,IACpB,OAAA,CAAQ,UAAA,CAAW,OAAA"}
@@ -1,9 +1,20 @@
1
1
  import { AgentExecutionError } from "../errors/agent-execution-error.mjs";
2
2
  import "../errors/index.mjs";
3
3
  import { judge } from "./judge-scorer.mjs";
4
+ import { diff } from "./regression.mjs";
4
5
  import { log } from "@warlock.js/logger";
5
6
 
6
7
  //#region ../@warlock.js/ai/src/eval/eval-runner.ts
8
+ /**
9
+ * Narrow `EvalOptions.cases` to the underlying `EvalCase[]`. A
10
+ * `DatasetContract` is identified structurally by its `cases` property
11
+ * (an array carried alongside `name` / `filter` / `shard`); a raw
12
+ * `EvalCase[]` is used as-is.
13
+ */
14
+ function resolveCases(cases) {
15
+ if (Array.isArray(cases)) return cases;
16
+ return cases.cases;
17
+ }
7
18
  const LOG_MODULE = "ai.eval";
8
19
  const DEFAULT_PASS_THRESHOLD = .5;
9
20
  /**
@@ -86,8 +97,9 @@ async function runCase(agent, evalCase, options, passThreshold) {
86
97
  async function runEval(agent, options) {
87
98
  const passThreshold = options.passThreshold ?? DEFAULT_PASS_THRESHOLD;
88
99
  const start = performance.now();
100
+ const suiteCases = resolveCases(options.cases);
89
101
  const cases = [];
90
- for (const evalCase of options.cases) {
102
+ for (const evalCase of suiteCases) {
91
103
  const caseResult = await runCase(agent, evalCase, options, passThreshold);
92
104
  cases.push(caseResult);
93
105
  if (!caseResult.passed && options.onFailure) try {
@@ -103,7 +115,7 @@ async function runEval(agent, options) {
103
115
  const passedCount = cases.filter((entry) => entry.passed).length;
104
116
  const total = cases.length;
105
117
  const meanScore = total > 0 ? cases.reduce((sum, entry) => sum + entry.score, 0) / total : 0;
106
- return {
118
+ const report = {
107
119
  agentName: agent.name,
108
120
  total,
109
121
  passedCount,
@@ -114,6 +126,8 @@ async function runEval(agent, options) {
114
126
  cases,
115
127
  duration: performance.now() - start
116
128
  };
129
+ if (options.baseline) report.regression = diff(report, options.baseline, options.tolerance);
130
+ return report;
117
131
  }
118
132
 
119
133
  //#endregion