@warlock.js/ai 4.3.0 → 4.5.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 (541) hide show
  1. package/CHANGELOG.md +52 -48
  2. package/cjs/index.cjs +221 -14144
  3. package/cjs/src-C02yzsLs.cjs +22991 -0
  4. package/cjs/src-C02yzsLs.cjs.map +1 -0
  5. package/cjs/src-DFibP2FQ.cjs +30 -0
  6. package/esm/agent/agent-config.type.d.mts +90 -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 +203 -30
  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/ai-openai/src/embedder.mjs +4 -0
  21. package/esm/ai-openai/src/index.mjs +4 -0
  22. package/esm/ai-openai/src/model.mjs +5 -0
  23. package/esm/ai-openai/src/sdk.mjs +6 -0
  24. package/esm/ai-openai/src/utils/index.mjs +4 -0
  25. package/esm/ai-openai/src/utils/to-openai-tools.mjs +3 -0
  26. package/esm/ai-openai/src/utils/wrap-openai-error.mjs +4 -0
  27. package/esm/ai.d.mts +119 -53
  28. package/esm/ai.d.mts.map +1 -1
  29. package/esm/ai.mjs +43 -8
  30. package/esm/ai.mjs.map +1 -1
  31. package/esm/batch/batch.d.mts.map +1 -1
  32. package/esm/batch/batch.mjs +21 -1
  33. package/esm/batch/batch.mjs.map +1 -1
  34. package/esm/batch/batch.type.d.mts +11 -4
  35. package/esm/batch/batch.type.d.mts.map +1 -1
  36. package/esm/config.d.mts +39 -3
  37. package/esm/config.d.mts.map +1 -1
  38. package/esm/config.mjs +26 -2
  39. package/esm/config.mjs.map +1 -1
  40. package/esm/contracts/agent/agent-options.type.d.mts +11 -3
  41. package/esm/contracts/agent/agent-options.type.d.mts.map +1 -1
  42. package/esm/contracts/agent/eval.type.d.mts +43 -2
  43. package/esm/contracts/agent/eval.type.d.mts.map +1 -1
  44. package/esm/contracts/attachment-policy.type.d.mts +51 -0
  45. package/esm/contracts/attachment-policy.type.d.mts.map +1 -0
  46. package/esm/contracts/attachment.type.d.mts +16 -7
  47. package/esm/contracts/attachment.type.d.mts.map +1 -1
  48. package/esm/contracts/content-part.type.d.mts +14 -5
  49. package/esm/contracts/content-part.type.d.mts.map +1 -1
  50. package/esm/contracts/events/supervisor-events.type.d.mts.map +1 -1
  51. package/esm/contracts/index.d.mts +6 -4
  52. package/esm/contracts/model.contract.d.mts +11 -8
  53. package/esm/contracts/model.contract.d.mts.map +1 -1
  54. package/esm/contracts/orchestrator/index.d.mts +1 -0
  55. package/esm/contracts/orchestrator/orchestrator-config.type.d.mts +31 -2
  56. package/esm/contracts/orchestrator/orchestrator-config.type.d.mts.map +1 -1
  57. package/esm/contracts/orchestrator/session-lock.contract.d.mts +47 -0
  58. package/esm/contracts/orchestrator/session-lock.contract.d.mts.map +1 -0
  59. package/esm/contracts/planner/index.d.mts +1 -1
  60. package/esm/contracts/planner/planner-config.type.d.mts +31 -0
  61. package/esm/contracts/planner/planner-config.type.d.mts.map +1 -1
  62. package/esm/contracts/planner/planner-execute-options.type.d.mts +48 -1
  63. package/esm/contracts/planner/planner-execute-options.type.d.mts.map +1 -1
  64. package/esm/contracts/planner/planner-result.type.d.mts +19 -5
  65. package/esm/contracts/planner/planner-result.type.d.mts.map +1 -1
  66. package/esm/contracts/planner/planner.contract.d.mts +1 -1
  67. package/esm/contracts/result/agent-result.type.d.mts +6 -4
  68. package/esm/contracts/result/agent-result.type.d.mts.map +1 -1
  69. package/esm/contracts/result/base-report.type.d.mts +21 -3
  70. package/esm/contracts/result/base-report.type.d.mts.map +1 -1
  71. package/esm/contracts/result/base-report.type.mjs.map +1 -1
  72. package/esm/contracts/result/execution-report.type.d.mts +53 -1
  73. package/esm/contracts/result/execution-report.type.d.mts.map +1 -1
  74. package/esm/contracts/result/orchestrator-result.type.d.mts +15 -11
  75. package/esm/contracts/result/orchestrator-result.type.d.mts.map +1 -1
  76. package/esm/contracts/result/supervisor-result.type.d.mts +13 -1
  77. package/esm/contracts/result/supervisor-result.type.d.mts.map +1 -1
  78. package/esm/contracts/result/tool-call.type.d.mts +2 -2
  79. package/esm/contracts/result/tool-call.type.d.mts.map +1 -1
  80. package/esm/contracts/result/workflow-result.type.d.mts +1 -0
  81. package/esm/contracts/result/workflow-result.type.d.mts.map +1 -1
  82. package/esm/contracts/supervisor/supervisor-config.type.d.mts +29 -0
  83. package/esm/contracts/supervisor/supervisor-config.type.d.mts.map +1 -1
  84. package/esm/contracts/system-prompt.contract.d.mts +103 -1
  85. package/esm/contracts/system-prompt.contract.d.mts.map +1 -1
  86. package/esm/contracts/team/index.d.mts +1 -0
  87. package/esm/contracts/team/team-config.type.d.mts +127 -0
  88. package/esm/contracts/team/team-config.type.d.mts.map +1 -0
  89. package/esm/contracts/tool.contract.d.mts +4 -2
  90. package/esm/contracts/tool.contract.d.mts.map +1 -1
  91. package/esm/contracts/workflow/step.contract.d.mts +30 -5
  92. package/esm/contracts/workflow/step.contract.d.mts.map +1 -1
  93. package/esm/contracts/workflow/workflow.contract.d.mts +16 -0
  94. package/esm/contracts/workflow/workflow.contract.d.mts.map +1 -1
  95. package/esm/errors/error-code.type.d.mts +1 -1
  96. package/esm/errors/index.d.mts +1 -0
  97. package/esm/errors/index.mjs +1 -0
  98. package/esm/errors/outbound-policy-error.d.mts +27 -0
  99. package/esm/errors/outbound-policy-error.d.mts.map +1 -0
  100. package/esm/errors/outbound-policy-error.mjs +32 -0
  101. package/esm/errors/outbound-policy-error.mjs.map +1 -0
  102. package/esm/eval/dataset.d.mts +28 -0
  103. package/esm/eval/dataset.d.mts.map +1 -0
  104. package/esm/eval/dataset.mjs +112 -0
  105. package/esm/eval/dataset.mjs.map +1 -0
  106. package/esm/eval/dataset.type.d.mts +53 -0
  107. package/esm/eval/dataset.type.d.mts.map +1 -0
  108. package/esm/eval/eval-runner.d.mts.map +1 -1
  109. package/esm/eval/eval-runner.mjs +16 -2
  110. package/esm/eval/eval-runner.mjs.map +1 -1
  111. package/esm/eval/index.d.mts +20 -1
  112. package/esm/eval/index.d.mts.map +1 -1
  113. package/esm/eval/index.mjs +20 -2
  114. package/esm/eval/index.mjs.map +1 -1
  115. package/esm/eval/regression.d.mts +30 -0
  116. package/esm/eval/regression.d.mts.map +1 -0
  117. package/esm/eval/regression.mjs +51 -0
  118. package/esm/eval/regression.mjs.map +1 -0
  119. package/esm/eval/report-json.d.mts +30 -0
  120. package/esm/eval/report-json.d.mts.map +1 -0
  121. package/esm/eval/report-json.mjs +33 -0
  122. package/esm/eval/report-json.mjs.map +1 -0
  123. package/esm/eval/report-junit.d.mts +22 -0
  124. package/esm/eval/report-junit.d.mts.map +1 -0
  125. package/esm/eval/report-junit.mjs +60 -0
  126. package/esm/eval/report-junit.mjs.map +1 -0
  127. package/esm/guard/contracts/guard-options.type.d.mts +165 -0
  128. package/esm/guard/contracts/guard-options.type.d.mts.map +1 -0
  129. package/esm/guard/contracts/guardrail.contract.d.mts +78 -0
  130. package/esm/guard/contracts/guardrail.contract.d.mts.map +1 -0
  131. package/esm/guard/contracts/index.d.mts +4 -0
  132. package/esm/guard/contracts/openai-client.contract.d.mts +51 -0
  133. package/esm/guard/contracts/openai-client.contract.d.mts.map +1 -0
  134. package/esm/guard/contracts/verdict.type.d.mts +76 -0
  135. package/esm/guard/contracts/verdict.type.d.mts.map +1 -0
  136. package/esm/guard/detectors/index.d.mts +4 -0
  137. package/esm/guard/detectors/index.mjs +6 -0
  138. package/esm/guard/detectors/injection.d.mts +34 -0
  139. package/esm/guard/detectors/injection.d.mts.map +1 -0
  140. package/esm/guard/detectors/injection.mjs +254 -0
  141. package/esm/guard/detectors/injection.mjs.map +1 -0
  142. package/esm/guard/detectors/moderation.d.mts +32 -0
  143. package/esm/guard/detectors/moderation.d.mts.map +1 -0
  144. package/esm/guard/detectors/moderation.mjs +134 -0
  145. package/esm/guard/detectors/moderation.mjs.map +1 -0
  146. package/esm/guard/detectors/pii.d.mts +41 -0
  147. package/esm/guard/detectors/pii.d.mts.map +1 -0
  148. package/esm/guard/detectors/pii.mjs +199 -0
  149. package/esm/guard/detectors/pii.mjs.map +1 -0
  150. package/esm/guard/detectors/topic.d.mts +29 -0
  151. package/esm/guard/detectors/topic.d.mts.map +1 -0
  152. package/esm/guard/detectors/topic.mjs +99 -0
  153. package/esm/guard/detectors/topic.mjs.map +1 -0
  154. package/esm/guard/errors.d.mts +12 -0
  155. package/esm/guard/errors.d.mts.map +1 -0
  156. package/esm/guard/errors.mjs +18 -0
  157. package/esm/guard/errors.mjs.map +1 -0
  158. package/esm/guard/guard.d.mts +67 -0
  159. package/esm/guard/guard.d.mts.map +1 -0
  160. package/esm/guard/guard.mjs +209 -0
  161. package/esm/guard/guard.mjs.map +1 -0
  162. package/esm/guard/guardrail.d.mts +39 -0
  163. package/esm/guard/guardrail.d.mts.map +1 -0
  164. package/esm/guard/guardrail.mjs +22 -0
  165. package/esm/guard/guardrail.mjs.map +1 -0
  166. package/esm/human/contracts/approval.type.d.mts +154 -0
  167. package/esm/human/contracts/approval.type.d.mts.map +1 -0
  168. package/esm/human/contracts/human-approval.type.d.mts +38 -0
  169. package/esm/human/contracts/human-approval.type.d.mts.map +1 -0
  170. package/esm/human/contracts/index.d.mts +4 -0
  171. package/esm/human/contracts/interrupt-store.contract.d.mts +112 -0
  172. package/esm/human/contracts/interrupt-store.contract.d.mts.map +1 -0
  173. package/esm/human/contracts/resume.type.d.mts +77 -0
  174. package/esm/human/contracts/resume.type.d.mts.map +1 -0
  175. package/esm/human/errors.d.mts +84 -0
  176. package/esm/human/errors.d.mts.map +1 -0
  177. package/esm/human/errors.mjs +60 -0
  178. package/esm/human/errors.mjs.map +1 -0
  179. package/esm/human/human-approval.d.mts +57 -0
  180. package/esm/human/human-approval.d.mts.map +1 -0
  181. package/esm/human/human-approval.mjs +170 -0
  182. package/esm/human/human-approval.mjs.map +1 -0
  183. package/esm/human/policy.d.mts +55 -0
  184. package/esm/human/policy.d.mts.map +1 -0
  185. package/esm/human/policy.mjs +67 -0
  186. package/esm/human/policy.mjs.map +1 -0
  187. package/esm/human/register.mjs +37 -0
  188. package/esm/human/register.mjs.map +1 -0
  189. package/esm/human/resume-seed.mjs +53 -0
  190. package/esm/human/resume-seed.mjs.map +1 -0
  191. package/esm/human/resume.d.mts +54 -0
  192. package/esm/human/resume.d.mts.map +1 -0
  193. package/esm/human/resume.mjs +121 -0
  194. package/esm/human/resume.mjs.map +1 -0
  195. package/esm/human/stores/index.mjs +5 -0
  196. package/esm/human/stores/memory.d.mts +30 -0
  197. package/esm/human/stores/memory.d.mts.map +1 -0
  198. package/esm/human/stores/memory.mjs +91 -0
  199. package/esm/human/stores/memory.mjs.map +1 -0
  200. package/esm/human/stores/pg.d.mts +59 -0
  201. package/esm/human/stores/pg.d.mts.map +1 -0
  202. package/esm/human/stores/pg.mjs +220 -0
  203. package/esm/human/stores/pg.mjs.map +1 -0
  204. package/esm/human/stores/redis.d.mts +56 -0
  205. package/esm/human/stores/redis.d.mts.map +1 -0
  206. package/esm/human/stores/redis.mjs +201 -0
  207. package/esm/human/stores/redis.mjs.map +1 -0
  208. package/esm/index.d.mts +113 -22
  209. package/esm/index.mjs +82 -11
  210. package/esm/middleware/builtins/budget.mjs +6 -2
  211. package/esm/middleware/builtins/budget.mjs.map +1 -1
  212. package/esm/middleware/utils/extract-user-text.d.mts +8 -1
  213. package/esm/middleware/utils/extract-user-text.d.mts.map +1 -1
  214. package/esm/middleware/utils/extract-user-text.mjs +8 -1
  215. package/esm/middleware/utils/extract-user-text.mjs.map +1 -1
  216. package/esm/object-stream/index.d.mts +2 -0
  217. package/esm/object-stream/index.mjs +4 -0
  218. package/esm/object-stream/parse-partial-json.d.mts +22 -0
  219. package/esm/object-stream/parse-partial-json.d.mts.map +1 -0
  220. package/esm/object-stream/parse-partial-json.mjs +78 -0
  221. package/esm/object-stream/parse-partial-json.mjs.map +1 -0
  222. package/esm/object-stream/stream-object.d.mts +68 -0
  223. package/esm/object-stream/stream-object.d.mts.map +1 -0
  224. package/esm/object-stream/stream-object.mjs +104 -0
  225. package/esm/object-stream/stream-object.mjs.map +1 -0
  226. package/esm/observe/index.mjs +4 -0
  227. package/esm/observe/observer-registry.d.mts +30 -0
  228. package/esm/observe/observer-registry.d.mts.map +1 -0
  229. package/esm/observe/observer-registry.mjs +51 -0
  230. package/esm/observe/observer-registry.mjs.map +1 -0
  231. package/esm/observe/observer.contract.d.mts +40 -0
  232. package/esm/observe/observer.contract.d.mts.map +1 -0
  233. package/esm/observe/resolve-observers.d.mts +40 -0
  234. package/esm/observe/resolve-observers.d.mts.map +1 -0
  235. package/esm/observe/resolve-observers.mjs +73 -0
  236. package/esm/observe/resolve-observers.mjs.map +1 -0
  237. package/esm/orchestrator/execution.d.mts.map +1 -1
  238. package/esm/orchestrator/execution.mjs +5 -2
  239. package/esm/orchestrator/execution.mjs.map +1 -1
  240. package/esm/orchestrator/index.d.mts +1 -0
  241. package/esm/orchestrator/index.mjs +1 -0
  242. package/esm/orchestrator/orchestrator.d.mts.map +1 -1
  243. package/esm/orchestrator/orchestrator.mjs +39 -6
  244. package/esm/orchestrator/orchestrator.mjs.map +1 -1
  245. package/esm/orchestrator/session-lock.d.mts +25 -0
  246. package/esm/orchestrator/session-lock.d.mts.map +1 -0
  247. package/esm/orchestrator/session-lock.mjs +83 -0
  248. package/esm/orchestrator/session-lock.mjs.map +1 -0
  249. package/esm/planner/dag-scheduler.mjs +97 -0
  250. package/esm/planner/dag-scheduler.mjs.map +1 -0
  251. package/esm/planner/plan-prompt.d.mts +1 -1
  252. package/esm/planner/plan-prompt.d.mts.map +1 -1
  253. package/esm/planner/plan-prompt.mjs +2 -1
  254. package/esm/planner/plan-prompt.mjs.map +1 -1
  255. package/esm/planner/plan-schema.mjs +17 -14
  256. package/esm/planner/plan-schema.mjs.map +1 -1
  257. package/esm/planner/planner-run.d.mts.map +1 -1
  258. package/esm/planner/planner-run.mjs +300 -29
  259. package/esm/planner/planner-run.mjs.map +1 -1
  260. package/esm/planner/planner.mjs +1 -1
  261. package/esm/planner/planner.mjs.map +1 -1
  262. package/esm/prompt/errors.d.mts +57 -0
  263. package/esm/prompt/errors.d.mts.map +1 -0
  264. package/esm/prompt/errors.mjs +73 -0
  265. package/esm/prompt/errors.mjs.map +1 -0
  266. package/esm/prompt/index.d.mts +3 -0
  267. package/esm/prompt/index.mjs +4 -0
  268. package/esm/prompt/prompt-langfuse-sync.mjs +104 -0
  269. package/esm/prompt/prompt-langfuse-sync.mjs.map +1 -0
  270. package/esm/prompt/prompt-langfuse-sync.type.d.mts +32 -0
  271. package/esm/prompt/prompt-langfuse-sync.type.d.mts.map +1 -0
  272. package/esm/prompt/prompt-validate.mjs +170 -0
  273. package/esm/prompt/prompt-validate.mjs.map +1 -0
  274. package/esm/prompt/prompt.d.mts +54 -0
  275. package/esm/prompt/prompt.d.mts.map +1 -0
  276. package/esm/prompt/prompt.mjs +218 -0
  277. package/esm/prompt/prompt.mjs.map +1 -0
  278. package/esm/prompt/prompt.type.d.mts +174 -0
  279. package/esm/prompt/prompt.type.d.mts.map +1 -0
  280. package/esm/prompts/index.d.mts +3 -0
  281. package/esm/prompts/index.mjs +3 -0
  282. package/esm/prompts/prompts-manager.contract.d.mts +154 -0
  283. package/esm/prompts/prompts-manager.contract.d.mts.map +1 -0
  284. package/esm/prompts/prompts-manager.d.mts +38 -0
  285. package/esm/prompts/prompts-manager.d.mts.map +1 -0
  286. package/esm/prompts/prompts-manager.mjs +410 -0
  287. package/esm/prompts/prompts-manager.mjs.map +1 -0
  288. package/esm/prompts/prompts-manager.type.d.mts +172 -0
  289. package/esm/prompts/prompts-manager.type.d.mts.map +1 -0
  290. package/esm/prompts/prompts-validate.mjs +200 -0
  291. package/esm/prompts/prompts-validate.mjs.map +1 -0
  292. package/esm/rag/as-tool.mjs +48 -0
  293. package/esm/rag/as-tool.mjs.map +1 -0
  294. package/esm/rag/chunk/chunk.d.mts +24 -0
  295. package/esm/rag/chunk/chunk.d.mts.map +1 -0
  296. package/esm/rag/chunk/chunk.mjs +44 -0
  297. package/esm/rag/chunk/chunk.mjs.map +1 -0
  298. package/esm/rag/chunk/fixed.mjs +32 -0
  299. package/esm/rag/chunk/fixed.mjs.map +1 -0
  300. package/esm/rag/chunk/markdown.mjs +75 -0
  301. package/esm/rag/chunk/markdown.mjs.map +1 -0
  302. package/esm/rag/chunk/recursive.mjs +132 -0
  303. package/esm/rag/chunk/recursive.mjs.map +1 -0
  304. package/esm/rag/chunk/sentence.mjs +73 -0
  305. package/esm/rag/chunk/sentence.mjs.map +1 -0
  306. package/esm/rag/contracts/chunk-options.type.d.mts +35 -0
  307. package/esm/rag/contracts/chunk-options.type.d.mts.map +1 -0
  308. package/esm/rag/contracts/citation.type.d.mts +35 -0
  309. package/esm/rag/contracts/citation.type.d.mts.map +1 -0
  310. package/esm/rag/contracts/index.d.mts +4 -0
  311. package/esm/rag/contracts/rag-config.type.d.mts +68 -0
  312. package/esm/rag/contracts/rag-config.type.d.mts.map +1 -0
  313. package/esm/rag/contracts/rag-document.type.d.mts +21 -0
  314. package/esm/rag/contracts/rag-document.type.d.mts.map +1 -0
  315. package/esm/rag/hybrid/bm25.d.mts +23 -0
  316. package/esm/rag/hybrid/bm25.d.mts.map +1 -0
  317. package/esm/rag/hybrid/bm25.mjs +51 -0
  318. package/esm/rag/hybrid/bm25.mjs.map +1 -0
  319. package/esm/rag/hybrid/hybrid-rank.d.mts +33 -0
  320. package/esm/rag/hybrid/hybrid-rank.d.mts.map +1 -0
  321. package/esm/rag/hybrid/hybrid-rank.mjs +29 -0
  322. package/esm/rag/hybrid/hybrid-rank.mjs.map +1 -0
  323. package/esm/rag/hybrid/rrf.d.mts +25 -0
  324. package/esm/rag/hybrid/rrf.d.mts.map +1 -0
  325. package/esm/rag/hybrid/rrf.mjs +30 -0
  326. package/esm/rag/hybrid/rrf.mjs.map +1 -0
  327. package/esm/rag/index.d.mts +15 -0
  328. package/esm/rag/index.mjs +11 -0
  329. package/esm/rag/rag.d.mts +38 -0
  330. package/esm/rag/rag.d.mts.map +1 -0
  331. package/esm/rag/rag.mjs +126 -0
  332. package/esm/rag/rag.mjs.map +1 -0
  333. package/esm/rag/rerank/keyword-reranker.d.mts +32 -0
  334. package/esm/rag/rerank/keyword-reranker.d.mts.map +1 -0
  335. package/esm/rag/rerank/keyword-reranker.mjs +58 -0
  336. package/esm/rag/rerank/keyword-reranker.mjs.map +1 -0
  337. package/esm/rag/rerank/llm-reranker.d.mts +36 -0
  338. package/esm/rag/rerank/llm-reranker.d.mts.map +1 -0
  339. package/esm/rag/rerank/llm-reranker.mjs +85 -0
  340. package/esm/rag/rerank/llm-reranker.mjs.map +1 -0
  341. package/esm/rag/rerank/reranker.contract.d.mts +28 -0
  342. package/esm/rag/rerank/reranker.contract.d.mts.map +1 -0
  343. package/esm/rag/retrieve.mjs +68 -0
  344. package/esm/rag/retrieve.mjs.map +1 -0
  345. package/esm/rag/store/cache-vector-store.d.mts +27 -0
  346. package/esm/rag/store/cache-vector-store.d.mts.map +1 -0
  347. package/esm/rag/store/cache-vector-store.mjs +48 -0
  348. package/esm/rag/store/cache-vector-store.mjs.map +1 -0
  349. package/esm/rag/store/vector-store.contract.d.mts +38 -0
  350. package/esm/rag/store/vector-store.contract.d.mts.map +1 -0
  351. package/esm/rag/transforms/multi-query.d.mts +27 -0
  352. package/esm/rag/transforms/multi-query.d.mts.map +1 -0
  353. package/esm/rag/transforms/multi-query.mjs +41 -0
  354. package/esm/rag/transforms/multi-query.mjs.map +1 -0
  355. package/esm/security/index.mjs +5 -0
  356. package/esm/security/outbound-policy.d.mts +46 -0
  357. package/esm/security/outbound-policy.d.mts.map +1 -0
  358. package/esm/security/outbound-policy.mjs +187 -0
  359. package/esm/security/outbound-policy.mjs.map +1 -0
  360. package/esm/security/outbound-policy.type.d.mts +74 -0
  361. package/esm/security/outbound-policy.type.d.mts.map +1 -0
  362. package/esm/security/private-ip.d.mts +15 -0
  363. package/esm/security/private-ip.d.mts.map +1 -0
  364. package/esm/security/private-ip.mjs +48 -0
  365. package/esm/security/private-ip.mjs.map +1 -0
  366. package/esm/security/redact.d.mts +59 -0
  367. package/esm/security/redact.d.mts.map +1 -0
  368. package/esm/security/redact.mjs +122 -0
  369. package/esm/security/redact.mjs.map +1 -0
  370. package/esm/serve/serve.d.mts +50 -0
  371. package/esm/serve/serve.d.mts.map +1 -0
  372. package/esm/serve/serve.mjs +90 -0
  373. package/esm/serve/serve.mjs.map +1 -0
  374. package/esm/serve/sse.d.mts +20 -0
  375. package/esm/serve/sse.d.mts.map +1 -0
  376. package/esm/serve/sse.mjs +25 -0
  377. package/esm/serve/sse.mjs.map +1 -0
  378. package/esm/serve/stream-to-sse.d.mts +29 -0
  379. package/esm/serve/stream-to-sse.d.mts.map +1 -0
  380. package/esm/serve/stream-to-sse.mjs +37 -0
  381. package/esm/serve/stream-to-sse.mjs.map +1 -0
  382. package/esm/skills/catalog.d.mts +49 -0
  383. package/esm/skills/catalog.d.mts.map +1 -0
  384. package/esm/skills/catalog.mjs +140 -0
  385. package/esm/skills/catalog.mjs.map +1 -0
  386. package/esm/skills/contracts/skill-record.type.d.mts +37 -0
  387. package/esm/skills/contracts/skill-record.type.d.mts.map +1 -0
  388. package/esm/skills/contracts/skills-config.type.d.mts +108 -0
  389. package/esm/skills/contracts/skills-config.type.d.mts.map +1 -0
  390. package/esm/skills/contracts/skills-store.contract.d.mts +28 -0
  391. package/esm/skills/contracts/skills-store.contract.d.mts.map +1 -0
  392. package/esm/skills/contracts/skills.contract.d.mts +43 -0
  393. package/esm/skills/contracts/skills.contract.d.mts.map +1 -0
  394. package/esm/skills/index.d.mts +16 -0
  395. package/esm/skills/index.mjs +14 -0
  396. package/esm/skills/load-skill-tool.d.mts +38 -0
  397. package/esm/skills/load-skill-tool.d.mts.map +1 -0
  398. package/esm/skills/load-skill-tool.mjs +65 -0
  399. package/esm/skills/load-skill-tool.mjs.map +1 -0
  400. package/esm/skills/review-gate.d.mts +33 -0
  401. package/esm/skills/review-gate.d.mts.map +1 -0
  402. package/esm/skills/review-gate.mjs +60 -0
  403. package/esm/skills/review-gate.mjs.map +1 -0
  404. package/esm/skills/save-skill-tool.d.mts +39 -0
  405. package/esm/skills/save-skill-tool.d.mts.map +1 -0
  406. package/esm/skills/save-skill-tool.mjs +65 -0
  407. package/esm/skills/save-skill-tool.mjs.map +1 -0
  408. package/esm/skills/skills.d.mts +33 -0
  409. package/esm/skills/skills.d.mts.map +1 -0
  410. package/esm/skills/skills.mjs +109 -0
  411. package/esm/skills/skills.mjs.map +1 -0
  412. package/esm/skills/sources/directory-source.d.mts +19 -0
  413. package/esm/skills/sources/directory-source.d.mts.map +1 -0
  414. package/esm/skills/sources/directory-source.mjs +108 -0
  415. package/esm/skills/sources/directory-source.mjs.map +1 -0
  416. package/esm/skills/sources/index.d.mts +18 -0
  417. package/esm/skills/sources/index.d.mts.map +1 -0
  418. package/esm/skills/sources/index.mjs +27 -0
  419. package/esm/skills/sources/index.mjs.map +1 -0
  420. package/esm/skills/sources/parse-frontmatter.d.mts +27 -0
  421. package/esm/skills/sources/parse-frontmatter.d.mts.map +1 -0
  422. package/esm/skills/sources/parse-frontmatter.mjs +46 -0
  423. package/esm/skills/sources/parse-frontmatter.mjs.map +1 -0
  424. package/esm/skills/sources/store-source.d.mts +14 -0
  425. package/esm/skills/sources/store-source.d.mts.map +1 -0
  426. package/esm/skills/sources/store-source.mjs +15 -0
  427. package/esm/skills/sources/store-source.mjs.map +1 -0
  428. package/esm/skills/sources/url-source.d.mts +29 -0
  429. package/esm/skills/sources/url-source.d.mts.map +1 -0
  430. package/esm/skills/sources/url-source.mjs +117 -0
  431. package/esm/skills/sources/url-source.mjs.map +1 -0
  432. package/esm/skills/store/mock-skills-store.d.mts +57 -0
  433. package/esm/skills/store/mock-skills-store.d.mts.map +1 -0
  434. package/esm/skills/store/mock-skills-store.mjs +100 -0
  435. package/esm/skills/store/mock-skills-store.mjs.map +1 -0
  436. package/esm/skills/store/procedural-skill-store.d.mts +30 -0
  437. package/esm/skills/store/procedural-skill-store.d.mts.map +1 -0
  438. package/esm/skills/store/procedural-skill-store.mjs +125 -0
  439. package/esm/skills/store/procedural-skill-store.mjs.map +1 -0
  440. package/esm/supervisor/as-tool.mjs +2 -2
  441. package/esm/supervisor/as-tool.mjs.map +1 -1
  442. package/esm/supervisor/execution.d.mts.map +1 -1
  443. package/esm/supervisor/execution.mjs +31 -28
  444. package/esm/supervisor/execution.mjs.map +1 -1
  445. package/esm/supervisor/supervisor.d.mts.map +1 -1
  446. package/esm/supervisor/supervisor.mjs +8 -3
  447. package/esm/supervisor/supervisor.mjs.map +1 -1
  448. package/esm/system-prompt/index.d.mts +4 -0
  449. package/esm/system-prompt/system-prompt.d.mts +68 -4
  450. package/esm/system-prompt/system-prompt.d.mts.map +1 -1
  451. package/esm/system-prompt/system-prompt.mjs +89 -5
  452. package/esm/system-prompt/system-prompt.mjs.map +1 -1
  453. package/esm/team/gates.mjs +48 -0
  454. package/esm/team/gates.mjs.map +1 -0
  455. package/esm/team/index.d.mts +1 -0
  456. package/esm/team/index.mjs +3 -0
  457. package/esm/team/team.d.mts +42 -0
  458. package/esm/team/team.d.mts.map +1 -0
  459. package/esm/team/team.mjs +94 -0
  460. package/esm/team/team.mjs.map +1 -0
  461. package/esm/tool/executable-as-tool.d.mts.map +1 -1
  462. package/esm/tool/executable-as-tool.mjs +2 -2
  463. package/esm/tool/executable-as-tool.mjs.map +1 -1
  464. package/esm/tool/tool.d.mts.map +1 -1
  465. package/esm/tool/tool.mjs +2 -2
  466. package/esm/tool/tool.mjs.map +1 -1
  467. package/esm/utils/compute-cost.d.mts +17 -1
  468. package/esm/utils/compute-cost.d.mts.map +1 -1
  469. package/esm/utils/compute-cost.mjs +26 -1
  470. package/esm/utils/compute-cost.mjs.map +1 -1
  471. package/esm/utils/extract-json-lenient.d.mts +42 -0
  472. package/esm/utils/extract-json-lenient.d.mts.map +1 -0
  473. package/esm/utils/extract-json-lenient.mjs +97 -0
  474. package/esm/utils/extract-json-lenient.mjs.map +1 -0
  475. package/esm/utils/index.d.mts +4 -2
  476. package/esm/utils/index.mjs +3 -1
  477. package/esm/utils/json-schema.d.mts +1 -1
  478. package/esm/utils/prepare-attachment-part.d.mts +10 -1
  479. package/esm/utils/prepare-attachment-part.d.mts.map +1 -1
  480. package/esm/utils/prepare-attachment-part.mjs +103 -11
  481. package/esm/utils/prepare-attachment-part.mjs.map +1 -1
  482. package/esm/utils/resolve-attachment.d.mts +4 -3
  483. package/esm/utils/resolve-attachment.d.mts.map +1 -1
  484. package/esm/utils/resolve-attachment.mjs +4 -3
  485. package/esm/utils/resolve-attachment.mjs.map +1 -1
  486. package/esm/utils/run-context.d.mts +94 -0
  487. package/esm/utils/run-context.d.mts.map +1 -0
  488. package/esm/utils/run-context.mjs +98 -0
  489. package/esm/utils/run-context.mjs.map +1 -0
  490. package/esm/vcr/cassette-io.mjs +57 -0
  491. package/esm/vcr/cassette-io.mjs.map +1 -0
  492. package/esm/vcr/errors.d.mts +42 -0
  493. package/esm/vcr/errors.d.mts.map +1 -0
  494. package/esm/vcr/errors.mjs +37 -0
  495. package/esm/vcr/errors.mjs.map +1 -0
  496. package/esm/vcr/hash-request.d.mts +28 -0
  497. package/esm/vcr/hash-request.d.mts.map +1 -0
  498. package/esm/vcr/hash-request.mjs +118 -0
  499. package/esm/vcr/hash-request.mjs.map +1 -0
  500. package/esm/vcr/index.d.mts +4 -0
  501. package/esm/vcr/index.mjs +5 -0
  502. package/esm/vcr/vcr.d.mts +32 -0
  503. package/esm/vcr/vcr.d.mts.map +1 -0
  504. package/esm/vcr/vcr.mjs +248 -0
  505. package/esm/vcr/vcr.mjs.map +1 -0
  506. package/esm/vcr/vcr.type.d.mts +118 -0
  507. package/esm/vcr/vcr.type.d.mts.map +1 -0
  508. package/esm/workflow/as-tool.mjs +2 -2
  509. package/esm/workflow/as-tool.mjs.map +1 -1
  510. package/esm/workflow/engine.mjs +1 -0
  511. package/esm/workflow/engine.mjs.map +1 -1
  512. package/esm/workflow/step-runner.mjs +19 -20
  513. package/esm/workflow/step-runner.mjs.map +1 -1
  514. package/esm/workflow/workflow.d.mts.map +1 -1
  515. package/esm/workflow/workflow.mjs +8 -3
  516. package/esm/workflow/workflow.mjs.map +1 -1
  517. package/llms-full.txt +1683 -68
  518. package/llms.txt +16 -4
  519. package/package.json +7 -3
  520. package/skills/README.md +40 -4
  521. package/skills/ai-dx-helpers/SKILL.md +2 -2
  522. package/skills/approve-tool-calls/SKILL.md +134 -0
  523. package/skills/attach-ai-middleware/SKILL.md +1 -1
  524. package/skills/detect-and-redact-pii/SKILL.md +104 -0
  525. package/skills/durable-resume/SKILL.md +128 -0
  526. package/skills/escalate-block-to-human/SKILL.md +85 -0
  527. package/skills/eval-datasets-and-ci/SKILL.md +117 -0
  528. package/skills/guard-input-output/SKILL.md +117 -0
  529. package/skills/manage-prompts/SKILL.md +186 -0
  530. package/skills/observe-ai-flows/SKILL.md +94 -0
  531. package/skills/record-replay-llm/SKILL.md +92 -0
  532. package/skills/run-ai-agent/SKILL.md +26 -1
  533. package/skills/run-ai-rag/SKILL.md +139 -0
  534. package/skills/run-ai-team/SKILL.md +107 -0
  535. package/skills/run-orchestrator/SKILL.md +2 -0
  536. package/skills/run-planner/SKILL.md +73 -8
  537. package/skills/run-supervisor/SKILL.md +20 -1
  538. package/skills/use-runtime-skills/SKILL.md +106 -0
  539. package/skills/write-system-prompt/SKILL.md +30 -1
  540. package/cjs/index.cjs.map +0 -1
  541. package/esm/contracts/result/index.d.mts +0 -15
@@ -1,4 +1,5 @@
1
1
  import { Placeholders } from "./placeholders.type.mjs";
2
+ import { PromptValidationResult, PromptsValidateOptions } from "../prompts/prompts-manager.type.mjs";
2
3
 
3
4
  //#region ../@warlock.js/ai/src/contracts/system-prompt.contract.d.ts
4
5
  /**
@@ -53,6 +54,53 @@ interface PersonaContract extends SystemPromptBlockContract {
53
54
  interface InstructionContract extends SystemPromptBlockContract {
54
55
  readonly type: "instruction";
55
56
  }
57
+ /**
58
+ * Identity + provenance metadata attached to a `SystemPromptContract`.
59
+ *
60
+ * A prompt that carries a `name` becomes addressable in the `ai.prompts`
61
+ * registry (keyed by `name@version`); anonymous prompts (no `name`) are never
62
+ * registered and exist only for inline composition / display.
63
+ *
64
+ * `composedFrom` records the deterministic source labels a prompt was merged
65
+ * from (e.g. `["base@2", "global-instructions@1"]`) — provenance with no
66
+ * random suffixes, so the same merge always yields the same labels.
67
+ *
68
+ * @example
69
+ * const base = ai.systemPrompt("You are support.", {
70
+ * name: "support",
71
+ * version: "1",
72
+ * description: "Tier-1 support persona.",
73
+ * });
74
+ */
75
+ interface SystemPromptMeta {
76
+ /** Registry name. When present the prompt auto-registers in `ai.prompts`. */
77
+ readonly name?: string;
78
+ /** Registry version label. Defaults to the next integer when omitted. */
79
+ readonly version?: string;
80
+ /** Human-readable description of the prompt's purpose. */
81
+ readonly description?: string;
82
+ /** Deterministic source labels this prompt was composed from (e.g. `["base@2"]`). */
83
+ readonly composedFrom?: readonly string[];
84
+ /** Placeholder keys callers must supply when resolving this prompt. */
85
+ readonly required?: readonly string[];
86
+ }
87
+ /**
88
+ * Options for the registry-aware overload of {@link SystemPromptContract.merge}
89
+ * that folds in a named prompt resolved from `ai.prompts`.
90
+ */
91
+ interface SystemPromptMergeOptions {
92
+ /**
93
+ * Which registered version to fold in when merging by name. Defaults to the
94
+ * latest registered version. Ignored when merging a contract instance.
95
+ */
96
+ readonly fromVersion?: string;
97
+ }
98
+ /**
99
+ * A source that {@link SystemPromptContract.merge} can fold in: a pre-built
100
+ * block, another prompt contract (its blocks are folded — persona replaces,
101
+ * instructions append), or a registered prompt name resolved from `ai.prompts`.
102
+ */
103
+ type SystemPromptMergeSource = SystemPromptBlockContract | SystemPromptContract | string;
56
104
  /**
57
105
  * Immutable builder for composing a layered system prompt out of persona and
58
106
  * instruction blocks. Every mutating method returns a fresh builder — the
@@ -92,6 +140,29 @@ interface InstructionContract extends SystemPromptBlockContract {
92
140
  interface SystemPromptContract {
93
141
  /** All blocks in render order. Read-only snapshot — use `persona()` / `instruction()` to derive a new builder. */
94
142
  readonly blocks: readonly SystemPromptBlockContract[];
143
+ /**
144
+ * Identity + provenance metadata. Read it via the no-argument
145
+ * {@link SystemPromptContract.meta} accessor (`prompt.meta()`); it is
146
+ * present when the prompt was given a name (via `systemPrompt(input, meta)`
147
+ * or `.meta({ name })`) or acquired `composedFrom` provenance through a
148
+ * `merge`, and `undefined` for a bare anonymous prompt.
149
+ *
150
+ * Exposed as a method (not a bare field) because the same `meta` identifier
151
+ * also serves as the immutable updater — see the call signatures below.
152
+ */
153
+ /**
154
+ * No-argument form: read the current metadata snapshot (or `undefined` when
155
+ * the prompt is anonymous and carries no provenance).
156
+ */
157
+ meta(): SystemPromptMeta | undefined;
158
+ /**
159
+ * Updater form: return a new builder with `meta` merged onto the current
160
+ * metadata (shallow). Immutable — the original is untouched. Giving the
161
+ * result a `name` registers it in `ai.prompts` under `name@version`
162
+ * (version defaults to the next integer); renaming a forked prompt creates
163
+ * a new registry key while the original entry stays put.
164
+ */
165
+ meta(meta: SystemPromptMeta): SystemPromptContract;
95
166
  /**
96
167
  * Set (or replace) the persona block. Returns a new builder. If a persona
97
168
  * already exists it's replaced in place (preserving its position);
@@ -103,6 +174,30 @@ interface SystemPromptContract {
103
174
  * accumulate — instructions render in the order they were added.
104
175
  */
105
176
  instruction(instruction: InstructionContract | string): SystemPromptContract;
177
+ /**
178
+ * Merge N predefined blocks into the prompt in one call. Each block is
179
+ * folded in order through the same per-type rules as `persona()` /
180
+ * `instruction()`: a `persona` block sets/replaces the single, leading
181
+ * persona; every other block is appended in order. Accepts pre-built
182
+ * `ai.persona()` / `ai.instruction()` blocks (or any `SystemPromptBlockContract`)
183
+ * for reuse across prompts. Returns a new builder; the original is untouched.
184
+ */
185
+ merge(...blocks: readonly SystemPromptBlockContract[]): SystemPromptContract;
186
+ /**
187
+ * Fold in another prompt's blocks. A persona block replaces this prompt's
188
+ * persona; instruction (and any other) blocks append in order. The result's
189
+ * `meta.composedFrom` records the deterministic source labels of both this
190
+ * prompt and the folded one (e.g. `["base@2", "global-instructions@1"]`).
191
+ * Returns a new builder; the original is untouched.
192
+ */
193
+ merge(source: SystemPromptContract): SystemPromptContract;
194
+ /**
195
+ * Fold in a prompt resolved from the `ai.prompts` registry by name. Uses the
196
+ * latest registered version unless `options.fromVersion` selects another.
197
+ * Throws `InvalidRequestError` when the name (or requested version) is not
198
+ * registered. Provenance is recorded in `meta.composedFrom`.
199
+ */
200
+ merge(name: string, options?: SystemPromptMergeOptions): SystemPromptContract;
106
201
  /**
107
202
  * Resolve all placeholders across every block, producing the final system
108
203
  * prompt string. Blocks render in insertion order, separated by a blank line.
@@ -112,7 +207,14 @@ interface SystemPromptContract {
112
207
  * @param placeholders - Values to inject into `{{mustache}}` slots.
113
208
  */
114
209
  resolve(placeholders?: Placeholders): string;
210
+ /**
211
+ * Sugar over `ai.prompts.validate(this, options)`. Runs the deterministic
212
+ * placeholder check (missing required `{{keys}}`) and, when `options.judge`
213
+ * is a model, the Nova-safe LLM-as-judge quality pass. The result's `ok`
214
+ * reflects the deterministic verdict alone; a flaky judge never flips it.
215
+ */
216
+ validate(options?: PromptsValidateOptions): Promise<PromptValidationResult>;
115
217
  }
116
218
  //#endregion
117
- export { InstructionContract, PersonaContract, SystemPromptBlockContract, SystemPromptContract };
219
+ export { InstructionContract, PersonaContract, SystemPromptBlockContract, SystemPromptContract, SystemPromptMergeOptions, SystemPromptMergeSource, SystemPromptMeta };
118
220
  //# sourceMappingURL=system-prompt.contract.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.contract.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/system-prompt.contract.ts"],"mappings":";;;;;AAiBA;;;;;;;;;;AAQqC;AAarC;;UArBiB,yBAAA;EAqBwB;EAAA,SAnB9B,IAAA;EAoCM;EAAA,SAjCN,IAAA;;EAGT,OAAA,CAAQ,YAAA,GAAe,YAAY;AAAA;AAsErC;;;;;;;;;;AAAA,UAzDiB,eAAA,SAAwB,yBAAyB;EAAA,SACvD,IAAI;AAAA;;;;;;;;;;;;;AAiFsB;UAjEpB,mBAAA,SAA4B,yBAAyB;EAAA,SAC3D,IAAI;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAuCE,oBAAA;;WAEN,MAAA,WAAiB,yBAAA;;;;;;EAO1B,OAAA,CAAQ,OAAA,EAAS,eAAA,YAA2B,oBAAA;;;;;EAM5C,WAAA,CAAY,WAAA,EAAa,mBAAA,YAA+B,oBAAA;;;;;;;;;EAUxD,OAAA,CAAQ,YAAA,GAAe,YAAA;AAAA"}
1
+ {"version":3,"file":"system-prompt.contract.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/system-prompt.contract.ts"],"mappings":";;;;;;AAqBA;;;;;;;;;;AAQqC;AAarC;;UArBiB,yBAAA;EAqBwB;EAAA,SAnB9B,IAAA;EAoCM;EAAA,SAjCN,IAAA;;EAGT,OAAA,CAAQ,YAAA,GAAe,YAAY;AAAA;AAoDrC;;;;;;;;;;AAAA,UAvCiB,eAAA,SAAwB,yBAAyB;EAAA,SACvD,IAAI;AAAA;;;AAgEO;AAQtB;;;;AAEwB;AAuCxB;;;;;UAjGiB,mBAAA,SAA4B,yBAAyB;EAAA,SAC3D,IAAI;AAAA;;;;;;;;;;;;;;;;;;;UAqBE,gBAAA;EAuGf;EAAA,SArGS,IAAA;EAqGJ;EAAA,SAlGI,OAAA;EAyGT;EAAA,SAtGS,WAAA;EAsGD;EAAA,SAnGC,YAAA;EAyGT;EAAA,SAtGS,QAAA;AAAA;;;;;UAOM,wBAAA;EAkHf;;;;EAAA,SA7GS,WAAW;AAAA;;;;;;KAQV,uBAAA,GACR,yBAAA,GACA,oBAAoB;;;;;;;AAgIoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAzF3D,oBAAA;;WAEN,MAAA,WAAiB,yBAAA;;;;;;;;;;;;;;;EAiB1B,IAAA,IAAQ,gBAAA;;;;;;;;EASR,IAAA,CAAK,IAAA,EAAM,gBAAA,GAAmB,oBAAA;;;;;;EAO9B,OAAA,CAAQ,OAAA,EAAS,eAAA,YAA2B,oBAAA;;;;;EAM5C,WAAA,CAAY,WAAA,EAAa,mBAAA,YAA+B,oBAAA;;;;;;;;;EAUxD,KAAA,IAAS,MAAA,WAAiB,yBAAA,KAA8B,oBAAA;;;;;;;;EASxD,KAAA,CAAM,MAAA,EAAQ,oBAAA,GAAuB,oBAAA;;;;;;;EAQrC,KAAA,CACE,IAAA,UACA,OAAA,GAAU,wBAAA,GACT,oBAAA;;;;;;;;;EAUH,OAAA,CAAQ,YAAA,GAAe,YAAA;;;;;;;EAQvB,QAAA,CAAS,OAAA,GAAU,sBAAA,GAAyB,OAAA,CAAQ,sBAAA;AAAA"}
@@ -0,0 +1 @@
1
+ import { TeamConfig, TeamGate, TeamGateFn, TeamMemberValue } from "./team-config.type.mjs";
@@ -0,0 +1,127 @@
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";
4
+ import { WorkflowInstance } from "../workflow/workflow.contract.mjs";
5
+ import { SystemPromptContract } from "../system-prompt.contract.mjs";
6
+ import { RouterEntry } from "../supervisor/router-entry.type.mjs";
7
+ import { SupervisorConfig, SupervisorEventHandlers } from "../supervisor/supervisor-config.type.mjs";
8
+ import { EvaluateContext, EvaluateResult } from "../supervisor/evaluate-context.type.mjs";
9
+ import { StandardSchemaV1 } from "@standard-schema/spec";
10
+
11
+ //#region ../@warlock.js/ai/src/contracts/team/team-config.type.d.ts
12
+ /**
13
+ * A role member — an agent or a workflow. The same shorthand the
14
+ * supervisor accepts on each `intents` value, narrowed to the two
15
+ * dispatchable unit shapes `team()` forwards verbatim. (Callback /
16
+ * full-entry intent shapes still work when forwarded — this alias is
17
+ * the documented, autocomplete-friendly subset for the common case.)
18
+ */
19
+ type TeamMemberValue = AgentContract<unknown> | WorkflowInstance<unknown, unknown>;
20
+ /**
21
+ * The built-in quality-gate strategies. Each desugars to a concrete
22
+ * {@link SupervisorConfig.evaluate} callback — no new loop or
23
+ * termination code; both lean entirely on the already-shipped
24
+ * {@link EvaluateResult} semantics (`satisfied` terminates,
25
+ * `reassignTo` re-dispatches the fixer, `feedback` threads forward).
26
+ *
27
+ * - `"quality"` — review-then-fix loop. After members settle, read the
28
+ * reviewer's verdict slice (`state.approved` by default); if not
29
+ * approved, `reassignTo` the fixer with the reviewer feedback
30
+ * (`state.notes`) threaded forward. Terminates on approval.
31
+ * - `"verify"` — test-then-fix loop. Same shape but keyed on the
32
+ * tester's pass/fail slice (`state.passed` by default) instead of a
33
+ * subjective reviewer score.
34
+ */
35
+ type TeamGate = "quality" | "verify";
36
+ /**
37
+ * Fully-custom gate — an escape hatch identical to
38
+ * {@link SupervisorConfig.evaluate}. Supplying a function instead of a
39
+ * {@link TeamGate} string opts out of the sugar entirely while keeping
40
+ * the rest of `team()`'s wiring. Forwarded straight through as
41
+ * `evaluate` with zero wrapping.
42
+ */
43
+ type TeamGateFn<TState> = (ctx: EvaluateContext<TState>) => EvaluateResult | Promise<EvaluateResult>;
44
+ /**
45
+ * Config for `ai.team(config)` — thin, transparent sugar over
46
+ * {@link SupervisorConfig}. `team()` builds a `SupervisorConfig` from
47
+ * these fields and calls `supervisor(...)`, returning the **unchanged**
48
+ * `SupervisorContract<TOutput>`. It owns no loop: the manager becomes
49
+ * `route`/`router`, the members become `intents`, and the gate becomes
50
+ * `evaluate`. Everything else passes through 1:1.
51
+ *
52
+ * @example
53
+ * const codeTeam = ai.team({
54
+ * name: "code-team",
55
+ * goal: "Ship a tested module that passes review.",
56
+ * manager: techLeadRouter,
57
+ * members: { builder, reviewer, fixer },
58
+ * gate: "quality",
59
+ * output: v.object({ code: v.string() }),
60
+ * maxIterations: 6,
61
+ * });
62
+ */
63
+ type TeamConfig<TOutput = unknown, TState = TOutput, TMembers extends Record<string, TeamMemberValue> = Record<string, TeamMemberValue>> = {
64
+ /** Stable identifier — forwarded verbatim to `SupervisorConfig.name`. */name: string; /** Optional dev-curated version string — forwarded to `SupervisorConfig.version`. */
65
+ version?: string;
66
+ /**
67
+ * The manager. Drives dispatch each iteration. Two forms:
68
+ * - an `AgentContract` / `RouterEntry` → becomes `SupervisorConfig.router`
69
+ * (LLM-driven manager).
70
+ * - `{ route }` → becomes `SupervisorConfig.route` (deterministic manager).
71
+ * Exactly one is forwarded; mutually exclusive (mirrors the
72
+ * supervisor's own `router` XOR `route` rule).
73
+ */
74
+ manager: AgentContract<unknown> | RouterEntry<TState> | {
75
+ route: NonNullable<SupervisorConfig<TOutput, TState>["route"]>;
76
+ };
77
+ /**
78
+ * Role members keyed by role name (e.g. `builder`, `reviewer`,
79
+ * `tester`, `fixer`). Forwarded verbatim as `SupervisorConfig.intents`.
80
+ * The keys are the role names the manager routes to AND the keys
81
+ * `ctx.intents.<role>` exposes (escape hatch preserved).
82
+ */
83
+ members: TMembers;
84
+ /**
85
+ * The quality gate. A {@link TeamGate} string selects a pre-built
86
+ * `evaluate` strategy; a function is forwarded straight to
87
+ * `SupervisorConfig.evaluate` (full escape hatch). Required — a team
88
+ * without a gate is just a supervisor.
89
+ */
90
+ gate: TeamGate | TeamGateFn<TState>;
91
+ /**
92
+ * Role-name mapping for the built-in string gates. Only consulted
93
+ * when `gate` is a {@link TeamGate} string. Defaults:
94
+ * `{ reviewer: "reviewer", fixer: "fixer", tester: "tester" }`.
95
+ * Override when your `members` keys differ from the canonical role
96
+ * names.
97
+ */
98
+ roles?: {
99
+ reviewer?: keyof TMembers & string;
100
+ fixer?: keyof TMembers & string;
101
+ tester?: keyof TMembers & string;
102
+ };
103
+ /**
104
+ * State key the gate reads to decide satisfaction. Defaults to
105
+ * `"approved"` for `gate: "quality"` and `"passed"` for
106
+ * `gate: "verify"`. The named member's `output` schema must write a
107
+ * boolean into this key.
108
+ */
109
+ gateKey?: string; /** Natural-language objective — forwarded verbatim to `SupervisorConfig.goal`. */
110
+ goal?: string | SystemPromptContract; /** Final-state schema — forwarded verbatim to `SupervisorConfig.output`. */
111
+ output?: StandardSchemaV1<TOutput>; /** Initial state seed — forwarded verbatim to `SupervisorConfig.state`. */
112
+ state?: TState; /** Hard iteration cap — forwarded verbatim; defaults to the supervisor's `10`. */
113
+ maxIterations?: number; /** Durable snapshot store — forwarded verbatim to `SupervisorConfig.snapshotStore`. */
114
+ snapshotStore?: SnapshotStore; /** Definition-level event handlers — forwarded verbatim to `SupervisorConfig.on`. */
115
+ on?: SupervisorEventHandlers;
116
+ /**
117
+ * Observability for this team — forwarded verbatim to
118
+ * `SupervisorConfig.observe`, so the underlying supervisor routes its
119
+ * completed report through the same generic `Observer` seam every
120
+ * other flow uses. Additive and gated; see `SupervisorConfig.observe`
121
+ * for the value semantics (`true` / `false` / a flow-local `Observer`).
122
+ */
123
+ observe?: FlowObserveOption;
124
+ };
125
+ //#endregion
126
+ export { TeamConfig, TeamGate, TeamGateFn, TeamMemberValue };
127
+ //# sourceMappingURL=team-config.type.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team-config.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/team/team-config.type.ts"],"mappings":";;;;;;;;;;;;;AAiBA;;;;AAEoB;KAFR,eAAA,GACR,aAAA,YACA,gBAAgB;;;;AAiBA;AASpB;;;;;;;;;;;KATY,QAAA;;;;;;;AAWgC;KAFhC,UAAA,YACV,GAAA,EAAK,eAAA,CAAgB,MAAA,MAClB,cAAA,GAAiB,OAAA,CAAQ,cAAA;;;;;;;;;;;;;;;;;;;;KAqBlB,UAAA,6BAED,OAAA,mBACQ,MAAA,SAAe,eAAA,IAAmB,MAAA,SAAe,eAAA;EA+CjD,yEA5CjB,IAAA,UA6D0B;EA1D1B,OAAA;EA6DQ;;;;;;;;EAnDR,OAAA,EACI,aAAA,YACA,WAAA,CAAY,MAAA;IACV,KAAA,EAAO,WAAA,CAAY,gBAAA,CAAiB,OAAA,EAAS,MAAA;EAAA;EAnBnB;;;;;;EA2BhC,OAAA,EAAS,QAAA;EATL;;;;;;EAiBJ,IAAA,EAAM,QAAA,GAAW,UAAA,CAAW,MAAA;EAR5B;;;;;;;EAiBA,KAAA;IACE,QAAA,SAAiB,QAAA;IACjB,KAAA,SAAc,QAAA;IACd,MAAA,SAAe,QAAA;EAAA;EAAA;;;;;;EASjB,OAAA,WAWA;EANA,IAAA,YAAgB,oBAAA,EAShB;EANA,MAAA,GAAS,gBAAA,CAAiB,OAAA,GASV;EANhB,KAAA,GAAQ,MAAA,EASH;EANL,aAAA,WAeU;EAZV,aAAA,GAAgB,aAAA,EAYW;EAT3B,EAAA,GAAK,uBAAA;;;;;;;;EASL,OAAA,GAAU,iBAAA;AAAA"}
@@ -121,8 +121,10 @@ interface ToolConfig<TInput = unknown, TOutput = unknown> {
121
121
  *
122
122
  * Two forms:
123
123
  * - **string** — static, used as-is.
124
- * - **function** — receives the validated input and returns a
125
- * string, so callers can include input data
124
+ * - **function** — receives the model's **raw, pre-validation**
125
+ * input (resolved at the dispatch boundary, before `execute`'s
126
+ * schema validation runs) and returns a string, so callers can
127
+ * include input data
126
128
  * (`(input) => \`Searching for "${input.query}"\``).
127
129
  *
128
130
  * Resolved at the framework boundary; consumers receive a
@@ -1 +1 @@
1
- {"version":3,"file":"tool.contract.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/tool.contract.ts"],"mappings":";;;;;AAQA;;;;KAAY,QAAA,GAAW,MAA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GAAA,GAAM,WAAA,GAAc,OAAA,CAAQ,OAAA;AAAA"}
@@ -169,13 +169,38 @@ type StepDefinition<TInput = unknown, TState = Record<string, unknown>, TContext
169
169
  */
170
170
  retry?: RetryConfig | false;
171
171
  /**
172
- * Parallel children — run concurrently, share `ctx.state`
173
- * (last-write-wins). Mutually exclusive with `run` and `agent`.
174
- * The parent's snapshot is atomic: written only after every child
175
- * settles. Children are addressable at both `ctx.steps.<child>` and
176
- * `ctx.steps.<parent>.steps.<child>`.
172
+ * Parallel children — run concurrently, each starting from a snapshot
173
+ * of the parent `ctx.state`. After every child settles, their
174
+ * resulting states are merged back into the parent in **declaration
175
+ * order** (the order children appear in this array), so a key written
176
+ * by more than one child deterministically resolves to the
177
+ * **last-declared** child's value — regardless of which child finished
178
+ * first. Supply {@link mergeState} to customize conflict resolution
179
+ * (e.g. sum counters, concat arrays). Mutually exclusive with `run`
180
+ * and `agent`. The parent's snapshot is atomic: written only after
181
+ * every child settles. Children are addressable at both
182
+ * `ctx.steps.<child>` and `ctx.steps.<parent>.steps.<child>`.
177
183
  */
178
184
  parallel?: StepDefinition<TInput, TState, TContext>[];
185
+ /**
186
+ * Conflict resolver for {@link parallel} children that write the same
187
+ * `ctx.state` keys. Called once per child, in **declaration order**,
188
+ * with the accumulator (the parent state being built up), that child's
189
+ * resolved state, and the child's name. Mutate `acc` in place.
190
+ *
191
+ * Omit it to keep the deterministic default (last-declared child wins
192
+ * per key — a plain `Object.assign` in declaration order). Supply it
193
+ * for advanced merges:
194
+ *
195
+ * ```ts
196
+ * mergeState: (acc, childState) => {
197
+ * acc.total = (acc.total ?? 0) + (childState.total ?? 0); // sum
198
+ * }
199
+ * ```
200
+ *
201
+ * Only consulted for parallel steps; ignored otherwise.
202
+ */
203
+ mergeState?: (acc: TState, childState: TState, childName: string) => void;
179
204
  /**
180
205
  * Per-step event handlers — fires alongside the workflow-level
181
206
  * `workflow.step.*` events. Scope is step-local (no `workflow.`
@@ -1 +1 @@
1
- {"version":3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,MAAA,EAAQ,QAAA,aAAqB,OAAA;EAtDxD;;;;;;EA8Dd,KAAA,GAAQ,WAAA;EA9D6E;;;;;;;;;;;;;EA6ErF,QAAA,GAAW,cAAA,CAAe,MAAA,EAAQ,MAAA,EAAQ,QAAA;EAlDzB;;;;;;;;;;;;;;;;;;EAsEjB,UAAA,IAAc,GAAA,EAAK,MAAA,EAAQ,UAAA,EAAY,MAAA,EAAQ,SAAA;EA3C/C;;;;;;EAmDA,EAAA,GAAK,OAAA,eACS,eAAA,IAAmB,OAAA,EAAS,eAAA,CAAgB,CAAA;AAAA"}
@@ -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;EA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f,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"}
@@ -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" | "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" | "VCR_CASSETTE_MISS" | "OUTBOUND_POLICY_BLOCKED";
17
17
  //#endregion
18
18
  export { AIErrorCode };
19
19
  //# sourceMappingURL=error-code.type.d.mts.map
@@ -18,6 +18,7 @@ import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
18
18
  import { OrchestratorCancelledError, OrchestratorCancelledErrorOptions } from "./orchestrator-cancelled-error.mjs";
19
19
  import { OrchestratorConfigError } from "./orchestrator-config-error.mjs";
20
20
  import { OrchestratorDriftError, OrchestratorDriftErrorOptions } from "./orchestrator-drift-error.mjs";
21
+ import { OutboundPolicyError } from "./outbound-policy-error.mjs";
21
22
  import { PlannerFailedError } from "./planner-failed-error.mjs";
22
23
  import { PlannerCancelledError, PlannerCancelledErrorOptions } from "./planner-cancelled-error.mjs";
23
24
  import { PlannerPlanInvalidError } from "./planner-plan-invalid-error.mjs";
@@ -16,6 +16,7 @@ import { OrchestratorFailedError } from "./orchestrator-failed-error.mjs";
16
16
  import { OrchestratorCancelledError } from "./orchestrator-cancelled-error.mjs";
17
17
  import { OrchestratorConfigError } from "./orchestrator-config-error.mjs";
18
18
  import { OrchestratorDriftError } from "./orchestrator-drift-error.mjs";
19
+ import { OutboundPolicyError } from "./outbound-policy-error.mjs";
19
20
  import { PlannerFailedError } from "./planner-failed-error.mjs";
20
21
  import { PlannerCancelledError } from "./planner-cancelled-error.mjs";
21
22
  import { PlannerPlanInvalidError } from "./planner-plan-invalid-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,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"}