@warlock.js/ai 4.4.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 (535) hide show
  1. package/CHANGELOG.md +52 -55
  2. package/cjs/index.cjs +221 -14147
  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 +8 -0
  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/supervisor-result.type.d.mts +14 -2
  75. package/esm/contracts/result/supervisor-result.type.d.mts.map +1 -1
  76. package/esm/contracts/result/workflow-result.type.d.mts +2 -1
  77. package/esm/contracts/result/workflow-result.type.d.mts.map +1 -1
  78. package/esm/contracts/supervisor/supervisor-config.type.d.mts +29 -0
  79. package/esm/contracts/supervisor/supervisor-config.type.d.mts.map +1 -1
  80. package/esm/contracts/system-prompt.contract.d.mts +103 -1
  81. package/esm/contracts/system-prompt.contract.d.mts.map +1 -1
  82. package/esm/contracts/team/index.d.mts +1 -0
  83. package/esm/contracts/team/team-config.type.d.mts +127 -0
  84. package/esm/contracts/team/team-config.type.d.mts.map +1 -0
  85. package/esm/contracts/tool.contract.d.mts +4 -2
  86. package/esm/contracts/tool.contract.d.mts.map +1 -1
  87. package/esm/contracts/workflow/step.contract.d.mts +30 -5
  88. package/esm/contracts/workflow/step.contract.d.mts.map +1 -1
  89. package/esm/contracts/workflow/workflow.contract.d.mts +16 -0
  90. package/esm/contracts/workflow/workflow.contract.d.mts.map +1 -1
  91. package/esm/errors/error-code.type.d.mts +1 -1
  92. package/esm/errors/index.d.mts +1 -0
  93. package/esm/errors/index.mjs +1 -0
  94. package/esm/errors/outbound-policy-error.d.mts +27 -0
  95. package/esm/errors/outbound-policy-error.d.mts.map +1 -0
  96. package/esm/errors/outbound-policy-error.mjs +32 -0
  97. package/esm/errors/outbound-policy-error.mjs.map +1 -0
  98. package/esm/eval/dataset.d.mts +28 -0
  99. package/esm/eval/dataset.d.mts.map +1 -0
  100. package/esm/eval/dataset.mjs +112 -0
  101. package/esm/eval/dataset.mjs.map +1 -0
  102. package/esm/eval/dataset.type.d.mts +53 -0
  103. package/esm/eval/dataset.type.d.mts.map +1 -0
  104. package/esm/eval/eval-runner.d.mts.map +1 -1
  105. package/esm/eval/eval-runner.mjs +16 -2
  106. package/esm/eval/eval-runner.mjs.map +1 -1
  107. package/esm/eval/index.d.mts +20 -1
  108. package/esm/eval/index.d.mts.map +1 -1
  109. package/esm/eval/index.mjs +20 -2
  110. package/esm/eval/index.mjs.map +1 -1
  111. package/esm/eval/regression.d.mts +30 -0
  112. package/esm/eval/regression.d.mts.map +1 -0
  113. package/esm/eval/regression.mjs +51 -0
  114. package/esm/eval/regression.mjs.map +1 -0
  115. package/esm/eval/report-json.d.mts +30 -0
  116. package/esm/eval/report-json.d.mts.map +1 -0
  117. package/esm/eval/report-json.mjs +33 -0
  118. package/esm/eval/report-json.mjs.map +1 -0
  119. package/esm/eval/report-junit.d.mts +22 -0
  120. package/esm/eval/report-junit.d.mts.map +1 -0
  121. package/esm/eval/report-junit.mjs +60 -0
  122. package/esm/eval/report-junit.mjs.map +1 -0
  123. package/esm/guard/contracts/guard-options.type.d.mts +165 -0
  124. package/esm/guard/contracts/guard-options.type.d.mts.map +1 -0
  125. package/esm/guard/contracts/guardrail.contract.d.mts +78 -0
  126. package/esm/guard/contracts/guardrail.contract.d.mts.map +1 -0
  127. package/esm/guard/contracts/index.d.mts +4 -0
  128. package/esm/guard/contracts/openai-client.contract.d.mts +51 -0
  129. package/esm/guard/contracts/openai-client.contract.d.mts.map +1 -0
  130. package/esm/guard/contracts/verdict.type.d.mts +76 -0
  131. package/esm/guard/contracts/verdict.type.d.mts.map +1 -0
  132. package/esm/guard/detectors/index.d.mts +4 -0
  133. package/esm/guard/detectors/index.mjs +6 -0
  134. package/esm/guard/detectors/injection.d.mts +34 -0
  135. package/esm/guard/detectors/injection.d.mts.map +1 -0
  136. package/esm/guard/detectors/injection.mjs +254 -0
  137. package/esm/guard/detectors/injection.mjs.map +1 -0
  138. package/esm/guard/detectors/moderation.d.mts +32 -0
  139. package/esm/guard/detectors/moderation.d.mts.map +1 -0
  140. package/esm/guard/detectors/moderation.mjs +134 -0
  141. package/esm/guard/detectors/moderation.mjs.map +1 -0
  142. package/esm/guard/detectors/pii.d.mts +41 -0
  143. package/esm/guard/detectors/pii.d.mts.map +1 -0
  144. package/esm/guard/detectors/pii.mjs +199 -0
  145. package/esm/guard/detectors/pii.mjs.map +1 -0
  146. package/esm/guard/detectors/topic.d.mts +29 -0
  147. package/esm/guard/detectors/topic.d.mts.map +1 -0
  148. package/esm/guard/detectors/topic.mjs +99 -0
  149. package/esm/guard/detectors/topic.mjs.map +1 -0
  150. package/esm/guard/errors.d.mts +12 -0
  151. package/esm/guard/errors.d.mts.map +1 -0
  152. package/esm/guard/errors.mjs +18 -0
  153. package/esm/guard/errors.mjs.map +1 -0
  154. package/esm/guard/guard.d.mts +67 -0
  155. package/esm/guard/guard.d.mts.map +1 -0
  156. package/esm/guard/guard.mjs +209 -0
  157. package/esm/guard/guard.mjs.map +1 -0
  158. package/esm/guard/guardrail.d.mts +39 -0
  159. package/esm/guard/guardrail.d.mts.map +1 -0
  160. package/esm/guard/guardrail.mjs +22 -0
  161. package/esm/guard/guardrail.mjs.map +1 -0
  162. package/esm/human/contracts/approval.type.d.mts +154 -0
  163. package/esm/human/contracts/approval.type.d.mts.map +1 -0
  164. package/esm/human/contracts/human-approval.type.d.mts +38 -0
  165. package/esm/human/contracts/human-approval.type.d.mts.map +1 -0
  166. package/esm/human/contracts/index.d.mts +4 -0
  167. package/esm/human/contracts/interrupt-store.contract.d.mts +112 -0
  168. package/esm/human/contracts/interrupt-store.contract.d.mts.map +1 -0
  169. package/esm/human/contracts/resume.type.d.mts +77 -0
  170. package/esm/human/contracts/resume.type.d.mts.map +1 -0
  171. package/esm/human/errors.d.mts +84 -0
  172. package/esm/human/errors.d.mts.map +1 -0
  173. package/esm/human/errors.mjs +60 -0
  174. package/esm/human/errors.mjs.map +1 -0
  175. package/esm/human/human-approval.d.mts +57 -0
  176. package/esm/human/human-approval.d.mts.map +1 -0
  177. package/esm/human/human-approval.mjs +170 -0
  178. package/esm/human/human-approval.mjs.map +1 -0
  179. package/esm/human/policy.d.mts +55 -0
  180. package/esm/human/policy.d.mts.map +1 -0
  181. package/esm/human/policy.mjs +67 -0
  182. package/esm/human/policy.mjs.map +1 -0
  183. package/esm/human/register.mjs +37 -0
  184. package/esm/human/register.mjs.map +1 -0
  185. package/esm/human/resume-seed.mjs +53 -0
  186. package/esm/human/resume-seed.mjs.map +1 -0
  187. package/esm/human/resume.d.mts +54 -0
  188. package/esm/human/resume.d.mts.map +1 -0
  189. package/esm/human/resume.mjs +121 -0
  190. package/esm/human/resume.mjs.map +1 -0
  191. package/esm/human/stores/index.mjs +5 -0
  192. package/esm/human/stores/memory.d.mts +30 -0
  193. package/esm/human/stores/memory.d.mts.map +1 -0
  194. package/esm/human/stores/memory.mjs +91 -0
  195. package/esm/human/stores/memory.mjs.map +1 -0
  196. package/esm/human/stores/pg.d.mts +59 -0
  197. package/esm/human/stores/pg.d.mts.map +1 -0
  198. package/esm/human/stores/pg.mjs +220 -0
  199. package/esm/human/stores/pg.mjs.map +1 -0
  200. package/esm/human/stores/redis.d.mts +56 -0
  201. package/esm/human/stores/redis.d.mts.map +1 -0
  202. package/esm/human/stores/redis.mjs +201 -0
  203. package/esm/human/stores/redis.mjs.map +1 -0
  204. package/esm/index.d.mts +113 -22
  205. package/esm/index.mjs +82 -11
  206. package/esm/middleware/builtins/budget.mjs +6 -2
  207. package/esm/middleware/builtins/budget.mjs.map +1 -1
  208. package/esm/middleware/utils/extract-user-text.d.mts +8 -1
  209. package/esm/middleware/utils/extract-user-text.d.mts.map +1 -1
  210. package/esm/middleware/utils/extract-user-text.mjs +8 -1
  211. package/esm/middleware/utils/extract-user-text.mjs.map +1 -1
  212. package/esm/object-stream/index.d.mts +2 -0
  213. package/esm/object-stream/index.mjs +4 -0
  214. package/esm/object-stream/parse-partial-json.d.mts +22 -0
  215. package/esm/object-stream/parse-partial-json.d.mts.map +1 -0
  216. package/esm/object-stream/parse-partial-json.mjs +78 -0
  217. package/esm/object-stream/parse-partial-json.mjs.map +1 -0
  218. package/esm/object-stream/stream-object.d.mts +68 -0
  219. package/esm/object-stream/stream-object.d.mts.map +1 -0
  220. package/esm/object-stream/stream-object.mjs +104 -0
  221. package/esm/object-stream/stream-object.mjs.map +1 -0
  222. package/esm/observe/index.mjs +4 -0
  223. package/esm/observe/observer-registry.d.mts +30 -0
  224. package/esm/observe/observer-registry.d.mts.map +1 -0
  225. package/esm/observe/observer-registry.mjs +51 -0
  226. package/esm/observe/observer-registry.mjs.map +1 -0
  227. package/esm/observe/observer.contract.d.mts +40 -0
  228. package/esm/observe/observer.contract.d.mts.map +1 -0
  229. package/esm/observe/resolve-observers.d.mts +40 -0
  230. package/esm/observe/resolve-observers.d.mts.map +1 -0
  231. package/esm/observe/resolve-observers.mjs +73 -0
  232. package/esm/observe/resolve-observers.mjs.map +1 -0
  233. package/esm/orchestrator/execution.d.mts.map +1 -1
  234. package/esm/orchestrator/execution.mjs +5 -2
  235. package/esm/orchestrator/execution.mjs.map +1 -1
  236. package/esm/orchestrator/index.d.mts +1 -0
  237. package/esm/orchestrator/index.mjs +1 -0
  238. package/esm/orchestrator/orchestrator.d.mts.map +1 -1
  239. package/esm/orchestrator/orchestrator.mjs +39 -6
  240. package/esm/orchestrator/orchestrator.mjs.map +1 -1
  241. package/esm/orchestrator/session-lock.d.mts +25 -0
  242. package/esm/orchestrator/session-lock.d.mts.map +1 -0
  243. package/esm/orchestrator/session-lock.mjs +83 -0
  244. package/esm/orchestrator/session-lock.mjs.map +1 -0
  245. package/esm/planner/dag-scheduler.mjs +97 -0
  246. package/esm/planner/dag-scheduler.mjs.map +1 -0
  247. package/esm/planner/plan-prompt.d.mts +1 -1
  248. package/esm/planner/plan-prompt.d.mts.map +1 -1
  249. package/esm/planner/plan-prompt.mjs +2 -1
  250. package/esm/planner/plan-prompt.mjs.map +1 -1
  251. package/esm/planner/planner-run.d.mts.map +1 -1
  252. package/esm/planner/planner-run.mjs +300 -29
  253. package/esm/planner/planner-run.mjs.map +1 -1
  254. package/esm/planner/planner.mjs +1 -1
  255. package/esm/planner/planner.mjs.map +1 -1
  256. package/esm/prompt/errors.d.mts +57 -0
  257. package/esm/prompt/errors.d.mts.map +1 -0
  258. package/esm/prompt/errors.mjs +73 -0
  259. package/esm/prompt/errors.mjs.map +1 -0
  260. package/esm/prompt/index.d.mts +3 -0
  261. package/esm/prompt/index.mjs +4 -0
  262. package/esm/prompt/prompt-langfuse-sync.mjs +104 -0
  263. package/esm/prompt/prompt-langfuse-sync.mjs.map +1 -0
  264. package/esm/prompt/prompt-langfuse-sync.type.d.mts +32 -0
  265. package/esm/prompt/prompt-langfuse-sync.type.d.mts.map +1 -0
  266. package/esm/prompt/prompt-validate.mjs +170 -0
  267. package/esm/prompt/prompt-validate.mjs.map +1 -0
  268. package/esm/prompt/prompt.d.mts +54 -0
  269. package/esm/prompt/prompt.d.mts.map +1 -0
  270. package/esm/prompt/prompt.mjs +218 -0
  271. package/esm/prompt/prompt.mjs.map +1 -0
  272. package/esm/prompt/prompt.type.d.mts +174 -0
  273. package/esm/prompt/prompt.type.d.mts.map +1 -0
  274. package/esm/prompts/index.d.mts +3 -0
  275. package/esm/prompts/index.mjs +3 -0
  276. package/esm/prompts/prompts-manager.contract.d.mts +154 -0
  277. package/esm/prompts/prompts-manager.contract.d.mts.map +1 -0
  278. package/esm/prompts/prompts-manager.d.mts +38 -0
  279. package/esm/prompts/prompts-manager.d.mts.map +1 -0
  280. package/esm/prompts/prompts-manager.mjs +410 -0
  281. package/esm/prompts/prompts-manager.mjs.map +1 -0
  282. package/esm/prompts/prompts-manager.type.d.mts +172 -0
  283. package/esm/prompts/prompts-manager.type.d.mts.map +1 -0
  284. package/esm/prompts/prompts-validate.mjs +200 -0
  285. package/esm/prompts/prompts-validate.mjs.map +1 -0
  286. package/esm/rag/as-tool.mjs +48 -0
  287. package/esm/rag/as-tool.mjs.map +1 -0
  288. package/esm/rag/chunk/chunk.d.mts +24 -0
  289. package/esm/rag/chunk/chunk.d.mts.map +1 -0
  290. package/esm/rag/chunk/chunk.mjs +44 -0
  291. package/esm/rag/chunk/chunk.mjs.map +1 -0
  292. package/esm/rag/chunk/fixed.mjs +32 -0
  293. package/esm/rag/chunk/fixed.mjs.map +1 -0
  294. package/esm/rag/chunk/markdown.mjs +75 -0
  295. package/esm/rag/chunk/markdown.mjs.map +1 -0
  296. package/esm/rag/chunk/recursive.mjs +132 -0
  297. package/esm/rag/chunk/recursive.mjs.map +1 -0
  298. package/esm/rag/chunk/sentence.mjs +73 -0
  299. package/esm/rag/chunk/sentence.mjs.map +1 -0
  300. package/esm/rag/contracts/chunk-options.type.d.mts +35 -0
  301. package/esm/rag/contracts/chunk-options.type.d.mts.map +1 -0
  302. package/esm/rag/contracts/citation.type.d.mts +35 -0
  303. package/esm/rag/contracts/citation.type.d.mts.map +1 -0
  304. package/esm/rag/contracts/index.d.mts +4 -0
  305. package/esm/rag/contracts/rag-config.type.d.mts +68 -0
  306. package/esm/rag/contracts/rag-config.type.d.mts.map +1 -0
  307. package/esm/rag/contracts/rag-document.type.d.mts +21 -0
  308. package/esm/rag/contracts/rag-document.type.d.mts.map +1 -0
  309. package/esm/rag/hybrid/bm25.d.mts +23 -0
  310. package/esm/rag/hybrid/bm25.d.mts.map +1 -0
  311. package/esm/rag/hybrid/bm25.mjs +51 -0
  312. package/esm/rag/hybrid/bm25.mjs.map +1 -0
  313. package/esm/rag/hybrid/hybrid-rank.d.mts +33 -0
  314. package/esm/rag/hybrid/hybrid-rank.d.mts.map +1 -0
  315. package/esm/rag/hybrid/hybrid-rank.mjs +29 -0
  316. package/esm/rag/hybrid/hybrid-rank.mjs.map +1 -0
  317. package/esm/rag/hybrid/rrf.d.mts +25 -0
  318. package/esm/rag/hybrid/rrf.d.mts.map +1 -0
  319. package/esm/rag/hybrid/rrf.mjs +30 -0
  320. package/esm/rag/hybrid/rrf.mjs.map +1 -0
  321. package/esm/rag/index.d.mts +15 -0
  322. package/esm/rag/index.mjs +11 -0
  323. package/esm/rag/rag.d.mts +38 -0
  324. package/esm/rag/rag.d.mts.map +1 -0
  325. package/esm/rag/rag.mjs +126 -0
  326. package/esm/rag/rag.mjs.map +1 -0
  327. package/esm/rag/rerank/keyword-reranker.d.mts +32 -0
  328. package/esm/rag/rerank/keyword-reranker.d.mts.map +1 -0
  329. package/esm/rag/rerank/keyword-reranker.mjs +58 -0
  330. package/esm/rag/rerank/keyword-reranker.mjs.map +1 -0
  331. package/esm/rag/rerank/llm-reranker.d.mts +36 -0
  332. package/esm/rag/rerank/llm-reranker.d.mts.map +1 -0
  333. package/esm/rag/rerank/llm-reranker.mjs +85 -0
  334. package/esm/rag/rerank/llm-reranker.mjs.map +1 -0
  335. package/esm/rag/rerank/reranker.contract.d.mts +28 -0
  336. package/esm/rag/rerank/reranker.contract.d.mts.map +1 -0
  337. package/esm/rag/retrieve.mjs +68 -0
  338. package/esm/rag/retrieve.mjs.map +1 -0
  339. package/esm/rag/store/cache-vector-store.d.mts +27 -0
  340. package/esm/rag/store/cache-vector-store.d.mts.map +1 -0
  341. package/esm/rag/store/cache-vector-store.mjs +48 -0
  342. package/esm/rag/store/cache-vector-store.mjs.map +1 -0
  343. package/esm/rag/store/vector-store.contract.d.mts +38 -0
  344. package/esm/rag/store/vector-store.contract.d.mts.map +1 -0
  345. package/esm/rag/transforms/multi-query.d.mts +27 -0
  346. package/esm/rag/transforms/multi-query.d.mts.map +1 -0
  347. package/esm/rag/transforms/multi-query.mjs +41 -0
  348. package/esm/rag/transforms/multi-query.mjs.map +1 -0
  349. package/esm/security/index.mjs +5 -0
  350. package/esm/security/outbound-policy.d.mts +46 -0
  351. package/esm/security/outbound-policy.d.mts.map +1 -0
  352. package/esm/security/outbound-policy.mjs +187 -0
  353. package/esm/security/outbound-policy.mjs.map +1 -0
  354. package/esm/security/outbound-policy.type.d.mts +74 -0
  355. package/esm/security/outbound-policy.type.d.mts.map +1 -0
  356. package/esm/security/private-ip.d.mts +15 -0
  357. package/esm/security/private-ip.d.mts.map +1 -0
  358. package/esm/security/private-ip.mjs +48 -0
  359. package/esm/security/private-ip.mjs.map +1 -0
  360. package/esm/security/redact.d.mts +59 -0
  361. package/esm/security/redact.d.mts.map +1 -0
  362. package/esm/security/redact.mjs +122 -0
  363. package/esm/security/redact.mjs.map +1 -0
  364. package/esm/serve/serve.d.mts +50 -0
  365. package/esm/serve/serve.d.mts.map +1 -0
  366. package/esm/serve/serve.mjs +90 -0
  367. package/esm/serve/serve.mjs.map +1 -0
  368. package/esm/serve/sse.d.mts +20 -0
  369. package/esm/serve/sse.d.mts.map +1 -0
  370. package/esm/serve/sse.mjs +25 -0
  371. package/esm/serve/sse.mjs.map +1 -0
  372. package/esm/serve/stream-to-sse.d.mts +29 -0
  373. package/esm/serve/stream-to-sse.d.mts.map +1 -0
  374. package/esm/serve/stream-to-sse.mjs +37 -0
  375. package/esm/serve/stream-to-sse.mjs.map +1 -0
  376. package/esm/skills/catalog.d.mts +49 -0
  377. package/esm/skills/catalog.d.mts.map +1 -0
  378. package/esm/skills/catalog.mjs +140 -0
  379. package/esm/skills/catalog.mjs.map +1 -0
  380. package/esm/skills/contracts/skill-record.type.d.mts +37 -0
  381. package/esm/skills/contracts/skill-record.type.d.mts.map +1 -0
  382. package/esm/skills/contracts/skills-config.type.d.mts +108 -0
  383. package/esm/skills/contracts/skills-config.type.d.mts.map +1 -0
  384. package/esm/skills/contracts/skills-store.contract.d.mts +28 -0
  385. package/esm/skills/contracts/skills-store.contract.d.mts.map +1 -0
  386. package/esm/skills/contracts/skills.contract.d.mts +43 -0
  387. package/esm/skills/contracts/skills.contract.d.mts.map +1 -0
  388. package/esm/skills/index.d.mts +16 -0
  389. package/esm/skills/index.mjs +14 -0
  390. package/esm/skills/load-skill-tool.d.mts +38 -0
  391. package/esm/skills/load-skill-tool.d.mts.map +1 -0
  392. package/esm/skills/load-skill-tool.mjs +65 -0
  393. package/esm/skills/load-skill-tool.mjs.map +1 -0
  394. package/esm/skills/review-gate.d.mts +33 -0
  395. package/esm/skills/review-gate.d.mts.map +1 -0
  396. package/esm/skills/review-gate.mjs +60 -0
  397. package/esm/skills/review-gate.mjs.map +1 -0
  398. package/esm/skills/save-skill-tool.d.mts +39 -0
  399. package/esm/skills/save-skill-tool.d.mts.map +1 -0
  400. package/esm/skills/save-skill-tool.mjs +65 -0
  401. package/esm/skills/save-skill-tool.mjs.map +1 -0
  402. package/esm/skills/skills.d.mts +33 -0
  403. package/esm/skills/skills.d.mts.map +1 -0
  404. package/esm/skills/skills.mjs +109 -0
  405. package/esm/skills/skills.mjs.map +1 -0
  406. package/esm/skills/sources/directory-source.d.mts +19 -0
  407. package/esm/skills/sources/directory-source.d.mts.map +1 -0
  408. package/esm/skills/sources/directory-source.mjs +108 -0
  409. package/esm/skills/sources/directory-source.mjs.map +1 -0
  410. package/esm/skills/sources/index.d.mts +18 -0
  411. package/esm/skills/sources/index.d.mts.map +1 -0
  412. package/esm/skills/sources/index.mjs +27 -0
  413. package/esm/skills/sources/index.mjs.map +1 -0
  414. package/esm/skills/sources/parse-frontmatter.d.mts +27 -0
  415. package/esm/skills/sources/parse-frontmatter.d.mts.map +1 -0
  416. package/esm/skills/sources/parse-frontmatter.mjs +46 -0
  417. package/esm/skills/sources/parse-frontmatter.mjs.map +1 -0
  418. package/esm/skills/sources/store-source.d.mts +14 -0
  419. package/esm/skills/sources/store-source.d.mts.map +1 -0
  420. package/esm/skills/sources/store-source.mjs +15 -0
  421. package/esm/skills/sources/store-source.mjs.map +1 -0
  422. package/esm/skills/sources/url-source.d.mts +29 -0
  423. package/esm/skills/sources/url-source.d.mts.map +1 -0
  424. package/esm/skills/sources/url-source.mjs +117 -0
  425. package/esm/skills/sources/url-source.mjs.map +1 -0
  426. package/esm/skills/store/mock-skills-store.d.mts +57 -0
  427. package/esm/skills/store/mock-skills-store.d.mts.map +1 -0
  428. package/esm/skills/store/mock-skills-store.mjs +100 -0
  429. package/esm/skills/store/mock-skills-store.mjs.map +1 -0
  430. package/esm/skills/store/procedural-skill-store.d.mts +30 -0
  431. package/esm/skills/store/procedural-skill-store.d.mts.map +1 -0
  432. package/esm/skills/store/procedural-skill-store.mjs +125 -0
  433. package/esm/skills/store/procedural-skill-store.mjs.map +1 -0
  434. package/esm/supervisor/as-tool.mjs +2 -2
  435. package/esm/supervisor/as-tool.mjs.map +1 -1
  436. package/esm/supervisor/execution.d.mts.map +1 -1
  437. package/esm/supervisor/execution.mjs +31 -28
  438. package/esm/supervisor/execution.mjs.map +1 -1
  439. package/esm/supervisor/supervisor.d.mts.map +1 -1
  440. package/esm/supervisor/supervisor.mjs +8 -3
  441. package/esm/supervisor/supervisor.mjs.map +1 -1
  442. package/esm/system-prompt/index.d.mts +4 -0
  443. package/esm/system-prompt/system-prompt.d.mts +68 -4
  444. package/esm/system-prompt/system-prompt.d.mts.map +1 -1
  445. package/esm/system-prompt/system-prompt.mjs +89 -5
  446. package/esm/system-prompt/system-prompt.mjs.map +1 -1
  447. package/esm/team/gates.mjs +48 -0
  448. package/esm/team/gates.mjs.map +1 -0
  449. package/esm/team/index.d.mts +1 -0
  450. package/esm/team/index.mjs +3 -0
  451. package/esm/team/team.d.mts +42 -0
  452. package/esm/team/team.d.mts.map +1 -0
  453. package/esm/team/team.mjs +94 -0
  454. package/esm/team/team.mjs.map +1 -0
  455. package/esm/tool/executable-as-tool.d.mts.map +1 -1
  456. package/esm/tool/executable-as-tool.mjs +2 -2
  457. package/esm/tool/executable-as-tool.mjs.map +1 -1
  458. package/esm/tool/tool.d.mts.map +1 -1
  459. package/esm/tool/tool.mjs +2 -2
  460. package/esm/tool/tool.mjs.map +1 -1
  461. package/esm/utils/compute-cost.d.mts +17 -1
  462. package/esm/utils/compute-cost.d.mts.map +1 -1
  463. package/esm/utils/compute-cost.mjs +26 -1
  464. package/esm/utils/compute-cost.mjs.map +1 -1
  465. package/esm/utils/extract-json-lenient.d.mts +42 -0
  466. package/esm/utils/extract-json-lenient.d.mts.map +1 -0
  467. package/esm/utils/extract-json-lenient.mjs +97 -0
  468. package/esm/utils/extract-json-lenient.mjs.map +1 -0
  469. package/esm/utils/index.d.mts +4 -2
  470. package/esm/utils/index.mjs +3 -1
  471. package/esm/utils/json-schema.d.mts +1 -1
  472. package/esm/utils/prepare-attachment-part.d.mts +10 -1
  473. package/esm/utils/prepare-attachment-part.d.mts.map +1 -1
  474. package/esm/utils/prepare-attachment-part.mjs +103 -11
  475. package/esm/utils/prepare-attachment-part.mjs.map +1 -1
  476. package/esm/utils/resolve-attachment.d.mts +4 -3
  477. package/esm/utils/resolve-attachment.d.mts.map +1 -1
  478. package/esm/utils/resolve-attachment.mjs +4 -3
  479. package/esm/utils/resolve-attachment.mjs.map +1 -1
  480. package/esm/utils/run-context.d.mts +94 -0
  481. package/esm/utils/run-context.d.mts.map +1 -0
  482. package/esm/utils/run-context.mjs +98 -0
  483. package/esm/utils/run-context.mjs.map +1 -0
  484. package/esm/vcr/cassette-io.mjs +57 -0
  485. package/esm/vcr/cassette-io.mjs.map +1 -0
  486. package/esm/vcr/errors.d.mts +42 -0
  487. package/esm/vcr/errors.d.mts.map +1 -0
  488. package/esm/vcr/errors.mjs +37 -0
  489. package/esm/vcr/errors.mjs.map +1 -0
  490. package/esm/vcr/hash-request.d.mts +28 -0
  491. package/esm/vcr/hash-request.d.mts.map +1 -0
  492. package/esm/vcr/hash-request.mjs +118 -0
  493. package/esm/vcr/hash-request.mjs.map +1 -0
  494. package/esm/vcr/index.d.mts +4 -0
  495. package/esm/vcr/index.mjs +5 -0
  496. package/esm/vcr/vcr.d.mts +32 -0
  497. package/esm/vcr/vcr.d.mts.map +1 -0
  498. package/esm/vcr/vcr.mjs +248 -0
  499. package/esm/vcr/vcr.mjs.map +1 -0
  500. package/esm/vcr/vcr.type.d.mts +118 -0
  501. package/esm/vcr/vcr.type.d.mts.map +1 -0
  502. package/esm/workflow/as-tool.mjs +2 -2
  503. package/esm/workflow/as-tool.mjs.map +1 -1
  504. package/esm/workflow/engine.mjs +1 -0
  505. package/esm/workflow/engine.mjs.map +1 -1
  506. package/esm/workflow/step-runner.mjs +19 -20
  507. package/esm/workflow/step-runner.mjs.map +1 -1
  508. package/esm/workflow/workflow.d.mts.map +1 -1
  509. package/esm/workflow/workflow.mjs +8 -3
  510. package/esm/workflow/workflow.mjs.map +1 -1
  511. package/llms-full.txt +1683 -68
  512. package/llms.txt +16 -4
  513. package/package.json +7 -3
  514. package/skills/README.md +40 -4
  515. package/skills/ai-dx-helpers/SKILL.md +2 -2
  516. package/skills/approve-tool-calls/SKILL.md +134 -0
  517. package/skills/attach-ai-middleware/SKILL.md +1 -1
  518. package/skills/detect-and-redact-pii/SKILL.md +104 -0
  519. package/skills/durable-resume/SKILL.md +128 -0
  520. package/skills/escalate-block-to-human/SKILL.md +85 -0
  521. package/skills/eval-datasets-and-ci/SKILL.md +117 -0
  522. package/skills/guard-input-output/SKILL.md +117 -0
  523. package/skills/manage-prompts/SKILL.md +186 -0
  524. package/skills/observe-ai-flows/SKILL.md +94 -0
  525. package/skills/record-replay-llm/SKILL.md +92 -0
  526. package/skills/run-ai-agent/SKILL.md +26 -1
  527. package/skills/run-ai-rag/SKILL.md +139 -0
  528. package/skills/run-ai-team/SKILL.md +107 -0
  529. package/skills/run-orchestrator/SKILL.md +2 -0
  530. package/skills/run-planner/SKILL.md +73 -8
  531. package/skills/run-supervisor/SKILL.md +20 -1
  532. package/skills/use-runtime-skills/SKILL.md +106 -0
  533. package/skills/write-system-prompt/SKILL.md +30 -1
  534. package/cjs/index.cjs.map +0 -1
  535. package/esm/contracts/result/index.d.mts +0 -15
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../../../../../../@warlock.js/ai/src/config.ts"],"sourcesContent":["import type { CacheDriver } from \"@warlock.js/cache\";\nimport type { CheckpointStore } from \"./contracts/orchestrator/checkpoint-store.contract\";\nimport type { SnapshotStore } from \"./contracts/orchestrator/snapshot-store.contract\";\n\n/**\n * Process-wide `@warlock.js/ai` configuration. **Intentionally tiny.**\n * Lives here only for genuinely cross-cutting defaults that would\n * otherwise force users to wire the same value into every consumer.\n *\n * **What lives here.** A field earns a slot only when it satisfies\n * all three:\n * 1. Multiple unrelated consumers need the same value.\n * 2. The value is infrastructure (drivers, clients, pools), not\n * behavior (kill-switches, mode flags).\n * 3. Per-call override doesn't make sense for the use case.\n *\n * **What does NOT live here.** Logger config (use\n * `@warlock.js/logger` directly). Per-primitive feature flags\n * (live on the relevant config type). Anything that's really one\n * consumer's concern (lives on that consumer).\n *\n * Phase 3.2 deliberately removed the previous `configureAI()` bag\n * because it was growing unbounded. Treat new fields here with the\n * same suspicion.\n */\nexport type AIConfig = {\n /**\n * Default `@warlock.js/cache` driver for cache-backed consumers that\n * didn't supply their own `store` — currently the `semanticCache`\n * middleware's vector store. Declaring it once here removes the\n * repetition across middleware declarations.\n *\n * NOT the snapshot-persistence fallback anymore. Supervisor /\n * workflow / orchestrator resume snapshots resolve through\n * {@link AIConfig.defaultSnapshotStore} (a {@link SnapshotStore}),\n * never this driver.\n *\n * Per-declaration overrides (`semanticCache({ store })`) win when\n * supplied. Set this once at app boot, *after* you've constructed\n * your driver.\n *\n * @example\n * import { cache } from \"@warlock.js/cache\";\n * import { ai } from \"@warlock.js/ai\";\n *\n * ai.config({\n * defaultStore: cache.driver(\"redis\", { client: redisClient }),\n * });\n */\n defaultStore?: CacheDriver<any, any>;\n\n /**\n * Default {@link CheckpointStore} for every orchestrator that didn't\n * supply its own `checkpointStore` (orchestrator.md §15.2). Holds\n * durable session state — `state`, `turn_index`, drift `signature`,\n * compaction locks. Per-orchestrator `checkpointStore` wins when\n * supplied. Set once at app boot.\n *\n * @example\n * import { ai } from \"@warlock.js/ai\";\n *\n * ai.config({ defaultCheckpointStore: ai.checkpoint.memory() });\n */\n defaultCheckpointStore?: CheckpointStore;\n\n /**\n * Default {@link SnapshotStore} for every orchestrator that didn't\n * supply its own `snapshotStore` (orchestrator.md §15.2). Holds the\n * internal supervisor run state used to resume an interrupted\n * `iterate: true` turn. Per-orchestrator `snapshotStore` wins when\n * supplied. Set once at app boot.\n *\n * @example\n * import { ai } from \"@warlock.js/ai\";\n *\n * ai.config({ defaultSnapshotStore: ai.snapshot.memory() });\n */\n defaultSnapshotStore?: SnapshotStore;\n};\n\nconst aiConfig: AIConfig = {};\n\n/**\n * Set or extend process-wide AI configuration. Merges over existing\n * values — fields not present in `partial` keep whatever was set\n * before (or stay unset). Call once at app boot, before constructing\n * any agent / supervisor / middleware that should pick up the\n * defaults.\n *\n * Returns the merged config so callers can verify what landed.\n *\n * @example\n * import { cache } from \"@warlock.js/cache\";\n * import { ai } from \"@warlock.js/ai\";\n *\n * ai.config({ defaultStore: cache.driver(\"redis\", { client }) });\n */\nexport function setAIConfig(partial: Partial<AIConfig>): AIConfig {\n Object.assign(aiConfig, partial);\n return { ...aiConfig };\n}\n\n/**\n * Read the current AI config snapshot. Returns a shallow copy so\n * callers can't accidentally mutate the source of truth. Used\n * internally by consumers to resolve their `defaultStore` fallback.\n */\nexport function getAIConfig(): AIConfig {\n return { ...aiConfig };\n}\n\n/**\n * Resolve the effective `@warlock.js/cache` driver for a cache-backed\n * consumer that didn't receive an explicit one. Returns the global\n * `defaultStore` if set, otherwise `undefined`. The semantic-cache\n * middleware treats `undefined` as fatal and throws. Snapshot\n * persistence no longer consults this — it resolves through\n * {@link resolveDefaultSnapshotStore}.\n */\nexport function resolveDefaultStore(): CacheDriver<any, any> | undefined {\n return aiConfig.defaultStore;\n}\n\n/**\n * Resolve the global default {@link CheckpointStore} for an\n * orchestrator that didn't receive an explicit `checkpointStore`.\n * Returns `undefined` when none is configured — the orchestrator\n * factory decides whether that's fatal.\n */\nexport function resolveDefaultCheckpointStore(): CheckpointStore | undefined {\n return aiConfig.defaultCheckpointStore;\n}\n\n/**\n * Resolve the global default {@link SnapshotStore} for an orchestrator\n * that didn't receive an explicit `snapshotStore`. Returns `undefined`\n * when none is configured — the orchestrator factory decides whether\n * that's fatal (it is, when `iterate: true`).\n */\nexport function resolveDefaultSnapshotStore(): SnapshotStore | undefined {\n return aiConfig.defaultSnapshotStore;\n}\n"],"mappings":";AAgFA,MAAM,WAAqB,CAAC;;;;;;;;;;;;;;;;AAiB5B,SAAgB,YAAY,SAAsC;CAChE,OAAO,OAAO,UAAU,OAAO;CAC/B,OAAO,EAAE,GAAG,SAAS;AACvB;;;;;;AAOA,SAAgB,cAAwB;CACtC,OAAO,EAAE,GAAG,SAAS;AACvB;;;;;;;;;AAUA,SAAgB,sBAAyD;CACvE,OAAO,SAAS;AAClB;;;;;;;AAQA,SAAgB,gCAA6D;CAC3E,OAAO,SAAS;AAClB;;;;;;;AAQA,SAAgB,8BAAyD;CACvE,OAAO,SAAS;AAClB"}
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../../../../../../@warlock.js/ai/src/config.ts"],"sourcesContent":["import type { CacheDriver } from \"@warlock.js/cache\";\nimport type { CheckpointStore } from \"./contracts/orchestrator/checkpoint-store.contract\";\nimport type { SnapshotStore } from \"./contracts/orchestrator/snapshot-store.contract\";\n\n/**\n * Process-wide `@warlock.js/ai` configuration. **Intentionally tiny.**\n * Lives here only for genuinely cross-cutting defaults that would\n * otherwise force users to wire the same value into every consumer.\n *\n * **What lives here.** A field earns a slot only when it satisfies\n * all three:\n * 1. Multiple unrelated consumers need the same value.\n * 2. The value is infrastructure (drivers, clients, pools), not\n * behavior (kill-switches, mode flags).\n * 3. Per-call override doesn't make sense for the use case.\n *\n * **What does NOT live here.** Logger config (use\n * `@warlock.js/logger` directly). Per-primitive feature flags\n * (live on the relevant config type). Anything that's really one\n * consumer's concern (lives on that consumer).\n *\n * Phase 3.2 deliberately removed the previous `configureAI()` bag\n * because it was growing unbounded. Treat new fields here with the\n * same suspicion.\n *\n * **Augmentable.** Declared as an `interface` (not a `type` alias) so\n * observability/tooling packages can attach their own opaque config slot\n * via declaration merging WITHOUT core importing them — keeping core\n * dependency-free. For example `@warlock.js/ai-panoptic` adds a\n * `panoptic?` field:\n *\n * ```ts\n * declare module \"@warlock.js/ai\" {\n * interface AIConfig {\n * panoptic?: PanopticConfig;\n * }\n * }\n * ```\n *\n * `setAIConfig` stores the whole object via `Object.assign`, so any\n * augmented field is preserved even though core never reads it.\n */\nexport interface AIConfig {\n /**\n * Default `@warlock.js/cache` driver for cache-backed consumers that\n * didn't supply their own `store` — currently the `semanticCache`\n * middleware's vector store. Declaring it once here removes the\n * repetition across middleware declarations.\n *\n * NOT the snapshot-persistence fallback anymore. Supervisor /\n * workflow / orchestrator resume snapshots resolve through\n * {@link AIConfig.defaultSnapshotStore} (a {@link SnapshotStore}),\n * never this driver.\n *\n * Per-declaration overrides (`semanticCache({ store })`) win when\n * supplied. Set this once at app boot, *after* you've constructed\n * your driver.\n *\n * @example\n * import { cache } from \"@warlock.js/cache\";\n * import { ai } from \"@warlock.js/ai\";\n *\n * ai.config({\n * defaultStore: cache.driver(\"redis\", { client: redisClient }),\n * });\n */\n defaultStore?: CacheDriver<any, any>;\n\n /**\n * Default {@link CheckpointStore} for every orchestrator that didn't\n * supply its own `checkpointStore` (orchestrator.md §15.2). Holds\n * durable session state — `state`, `turn_index`, drift `signature`,\n * compaction locks. Per-orchestrator `checkpointStore` wins when\n * supplied. Set once at app boot.\n *\n * @example\n * import { ai } from \"@warlock.js/ai\";\n *\n * ai.config({ defaultCheckpointStore: ai.checkpoint.memory() });\n */\n defaultCheckpointStore?: CheckpointStore;\n\n /**\n * Default {@link SnapshotStore} for every orchestrator that didn't\n * supply its own `snapshotStore` (orchestrator.md §15.2). Holds the\n * internal supervisor run state used to resume an interrupted\n * `iterate: true` turn. Per-orchestrator `snapshotStore` wins when\n * supplied. Set once at app boot.\n *\n * @example\n * import { ai } from \"@warlock.js/ai\";\n *\n * ai.config({ defaultSnapshotStore: ai.snapshot.memory() });\n */\n defaultSnapshotStore?: SnapshotStore;\n};\n\nconst aiConfig: AIConfig = {};\n\n/** A listener notified after every `setAIConfig` merge. */\ntype ConfigListener = (config: AIConfig) => void;\n\nconst configListeners: ConfigListener[] = [];\n\n/**\n * Subscribe to config changes. The listener fires after every\n * {@link setAIConfig} merge with a fresh snapshot of the full config —\n * the seam observability/tooling packages use to react when their\n * augmented slot (e.g. `panoptic`) is set, WITHOUT core importing them.\n *\n * Mirrors the dependency-inversion of the `Observer` registry: core\n * exposes the structural hook; the tool subscribes on its side-effect\n * import. To also catch config that was applied *before* the subscription,\n * read {@link getAIConfig} once right after subscribing.\n *\n * @example\n * import { onConfigApplied, getAIConfig } from \"@warlock.js/ai\";\n * onConfigApplied((config) => applyPanopticConfig(config.panoptic));\n * applyPanopticConfig(getAIConfig().panoptic); // catch pre-set config\n */\nexport function onConfigApplied(listener: ConfigListener): void {\n configListeners.push(listener);\n}\n\n/**\n * Set or extend process-wide AI configuration. Merges over existing\n * values — fields not present in `partial` keep whatever was set\n * before (or stay unset). Call once at app boot, before constructing\n * any agent / supervisor / middleware that should pick up the\n * defaults.\n *\n * Returns the merged config so callers can verify what landed.\n *\n * @example\n * import { cache } from \"@warlock.js/cache\";\n * import { ai } from \"@warlock.js/ai\";\n *\n * ai.config({ defaultStore: cache.driver(\"redis\", { client }) });\n */\nexport function setAIConfig(partial: Partial<AIConfig>): AIConfig {\n Object.assign(aiConfig, partial);\n const snapshot = { ...aiConfig };\n\n // Notify subscribers (e.g. panoptic) after the merge. Errors are\n // swallowed so a misbehaving listener never breaks config application,\n // mirroring the observer / onUsage swallow-on-throw discipline.\n for (const listener of configListeners) {\n try {\n listener(snapshot);\n } catch {\n // intentionally ignored\n }\n }\n\n return snapshot;\n}\n\n/**\n * Read the current AI config snapshot. Returns a shallow copy so\n * callers can't accidentally mutate the source of truth. Used\n * internally by consumers to resolve their `defaultStore` fallback.\n */\nexport function getAIConfig(): AIConfig {\n return { ...aiConfig };\n}\n\n/**\n * Resolve the effective `@warlock.js/cache` driver for a cache-backed\n * consumer that didn't receive an explicit one. Returns the global\n * `defaultStore` if set, otherwise `undefined`. The semantic-cache\n * middleware treats `undefined` as fatal and throws. Snapshot\n * persistence no longer consults this — it resolves through\n * {@link resolveDefaultSnapshotStore}.\n */\nexport function resolveDefaultStore(): CacheDriver<any, any> | undefined {\n return aiConfig.defaultStore;\n}\n\n/**\n * Resolve the global default {@link CheckpointStore} for an\n * orchestrator that didn't receive an explicit `checkpointStore`.\n * Returns `undefined` when none is configured — the orchestrator\n * factory decides whether that's fatal.\n */\nexport function resolveDefaultCheckpointStore(): CheckpointStore | undefined {\n return aiConfig.defaultCheckpointStore;\n}\n\n/**\n * Resolve the global default {@link SnapshotStore} for an orchestrator\n * that didn't receive an explicit `snapshotStore`. Returns `undefined`\n * when none is configured — the orchestrator factory decides whether\n * that's fatal (it is, when `iterate: true`).\n */\nexport function resolveDefaultSnapshotStore(): SnapshotStore | undefined {\n return aiConfig.defaultSnapshotStore;\n}\n"],"mappings":";AAiGA,MAAM,WAAqB,CAAC;AAK5B,MAAM,kBAAoC,CAAC;;;;;;;;;;;;;;;;;AAkB3C,SAAgB,gBAAgB,UAAgC;CAC9D,gBAAgB,KAAK,QAAQ;AAC/B;;;;;;;;;;;;;;;;AAiBA,SAAgB,YAAY,SAAsC;CAChE,OAAO,OAAO,UAAU,OAAO;CAC/B,MAAM,WAAW,EAAE,GAAG,SAAS;CAK/B,KAAK,MAAM,YAAY,iBACrB,IAAI;EACF,SAAS,QAAQ;CACnB,QAAQ,CAER;CAGF,OAAO;AACT;;;;;;AAOA,SAAgB,cAAwB;CACtC,OAAO,EAAE,GAAG,SAAS;AACvB;;;;;;;;;AAUA,SAAgB,sBAAyD;CACvE,OAAO,SAAS;AAClB;;;;;;;AAQA,SAAgB,gCAA6D;CAC3E,OAAO,SAAS;AAClB;;;;;;;AAQA,SAAgB,8BAAyD;CACvE,OAAO,SAAS;AAClB"}
@@ -1,3 +1,4 @@
1
+ import { AttachmentPolicy } from "../attachment-policy.type.mjs";
1
2
  import { Attachment } from "../attachment.type.mjs";
2
3
  import { Message } from "../conversation-message.type.mjs";
3
4
  import { ToolContext } from "../tool.contract.mjs";
@@ -12,9 +13,9 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
12
13
  * Options passed to AgentContract.execute() to configure a single execution run.
13
14
  *
14
15
  * @example
15
- * const result = await agent.execute("Analyze this document", {
16
+ * const result = await agent.execute("Describe this image", {
16
17
  * history: previousMessages,
17
- * attachments: ["/path/to/doc.pdf"],
18
+ * attachments: ["/path/to/screenshot.png"],
18
19
  * placeholders: { language: "English" },
19
20
  * output: z.object({ summary: z.string(), keyPoints: z.array(z.string()) }),
20
21
  * on: {
@@ -25,7 +26,14 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
25
26
  */
26
27
  type AgentExecuteOptions<TOutput = unknown> = {
27
28
  /** Prior conversation messages to prepend as context */history?: Message[]; /** Files or URLs to attach to the message */
28
- attachments?: Attachment[]; /** Values to inject into {{mustache}} placeholders in prompts */
29
+ attachments?: Attachment[];
30
+ /**
31
+ * Trust-boundary policy for {@link attachments} (S1) — overrides
32
+ * `AgentConfig.attachmentPolicy` for this call. Governs remote-text
33
+ * fetch (default-deny), the outbound `OutboundPolicy`, and the local-
34
+ * file `allowedRoots` sandbox. Omit to inherit the factory policy.
35
+ */
36
+ attachmentPolicy?: AttachmentPolicy; /** Values to inject into {{mustache}} placeholders in prompts */
29
37
  placeholders?: Placeholders;
30
38
  /**
31
39
  * Standard Schema for structured output extraction.
@@ -1 +1 @@
1
- {"version":3,"file":"agent-options.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/agent/agent-options.type.ts"],"mappings":";;;;;;;;;;;;AAwBA;;;;;;;;;;;;;KAAY,mBAAA;EA2EL,wDAzEL,OAAA,GAAU,OAAA,IA+FW;EA7FrB,WAAA,GAAc,UAAA,IA6F+B;EA3F7C,YAAA,GAAe,YAAA;EAJf;;;;EASA,MAAA,GAAS,gBAAA,CAAiB,OAAA;EALX;;;;;;;;;;;;;;;;;;;;;;;;EA8Bf,cAAA,GAAiB,MAAA;EA0ER;;;;;;;;;;;;;;;;;;;;EArDT,MAAA;8EAEE,WAAA;EAAA;EAGF,YAAA,GAAe,oBAAA;;;;;;;;;;;EAWf,MAAA,GAAS,WAAA;EAET,EAAA,GAAK,OAAA,eACS,aAAA,IAAiB,OAAA,EAAS,aAAA,CAAc,CAAA;;;;;;;;;;;;EAatD,OAAA,GAAU,WAAA;;;;;;;;EAQV,kBAAA,GAAqB,wBAAA;;;;;;;;;;;;;EAarB,SAAA;AAAA"}
1
+ {"version":3,"file":"agent-options.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/agent/agent-options.type.ts"],"mappings":";;;;;;;;;;;;;AAyBA;;;;;;;;;;;;;KAAY,mBAAA;EAmF4C,wDAjFtD,OAAA,GAAU,OAAA,IA8FA;EA5FV,WAAA,GAAc,UAAA;EAoG+B;;;;;;EA7F7C,gBAAA,GAAmB,gBAAA,EAAnB;EAEA,YAAA,GAAe,YAAA;EAAf;;;;EAKA,MAAA,GAAS,gBAAA,CAAiB,OAAA;EAyB1B;;;;;;;;;;;;;;;;;;;;;AA0ES;;;EA1ET,cAAA,GAAiB,MAAA;;;;;;;;;;;;;;;;;;;;;EAqBjB,MAAA;8EAEE,WAAA;EAAA;EAGF,YAAA,GAAe,oBAAA;;;;;;;;;;;EAWf,MAAA,GAAS,WAAA;EAET,EAAA,GAAK,OAAA,eACS,aAAA,IAAiB,OAAA,EAAS,aAAA,CAAc,CAAA;;;;;;;;;;;;EAatD,OAAA,GAAU,WAAA;;;;;;;;EAQV,kBAAA,GAAqB,wBAAA;;;;;;;;;;;;;EAarB,SAAA;AAAA"}
@@ -1,4 +1,5 @@
1
1
  import { AgentResult } from "../result/agent-result.type.mjs";
2
+ import { DatasetContract } from "../../eval/dataset.type.mjs";
2
3
  import { AgentContract } from "./agent.contract.mjs";
3
4
  import { AgentExecuteOptions } from "./agent-options.type.mjs";
4
5
 
@@ -92,7 +93,12 @@ type EvalJudge = {
92
93
  * resolvable per case or the runner throws at author time.
93
94
  */
94
95
  type EvalOptions<TOutput = unknown> = {
95
- /** The evaluation cases to run. */cases: EvalCase<TOutput>[]; /** Default scorers applied to every case without its own `scorers`. */
96
+ /**
97
+ * The evaluation cases to run. Either a raw `EvalCase[]` or a
98
+ * {@link DatasetContract} (from `ai.dataset(...)`) — the runner reads
99
+ * `.cases` off a dataset.
100
+ */
101
+ cases: EvalCase<TOutput>[] | DatasetContract<TOutput>; /** Default scorers applied to every case without its own `scorers`. */
96
102
  scorers?: EvalScorer<TOutput>[]; /** LLM-as-judge fallback for cases with no scorers. */
97
103
  judge?: EvalJudge;
98
104
  /**
@@ -108,6 +114,36 @@ type EvalOptions<TOutput = unknown> = {
108
114
  */
109
115
  onFailure?: (caseResult: EvalCaseResult<TOutput>) => void | Promise<void>; /** Execute-options applied to every case (merged under per-case `options`). */
110
116
  executeOptions?: AgentExecuteOptions<TOutput>;
117
+ /**
118
+ * A prior {@link EvalReport} to diff against. When set, the new report
119
+ * carries a `regression` block flagging cases whose score dropped more
120
+ * than `tolerance` below the baseline.
121
+ */
122
+ baseline?: EvalReport<TOutput>;
123
+ /**
124
+ * Maximum allowed per-case score drop vs baseline before it counts as a
125
+ * regression. Only consulted when `baseline` is set. Defaults to `0`
126
+ * (any drop is a regression).
127
+ */
128
+ tolerance?: number;
129
+ };
130
+ /**
131
+ * Regression verdict attached to an {@link EvalReport} when `agent.eval`
132
+ * is called with a `baseline`. Cases are joined by `name`.
133
+ */
134
+ type EvalRegression = {
135
+ /**
136
+ * Cases whose score fell more than `tolerance` below the baseline,
137
+ * carrying the before/after scores.
138
+ */
139
+ regressed: Array<{
140
+ name: string;
141
+ before: number;
142
+ after: number;
143
+ }>; /** Case names present in the baseline but absent in the new report. */
144
+ removed: string[]; /** Case names present in the new report but absent in the baseline. */
145
+ added: string[]; /** `true` when `regressed` is empty — no case regressed beyond tolerance. */
146
+ passed: boolean;
111
147
  };
112
148
  /**
113
149
  * Per-case outcome in an {@link EvalReport}. Bundles the case, the
@@ -137,7 +173,12 @@ type EvalReport<TOutput = unknown> = {
137
173
  passed: boolean; /** Per-case results in suite order. */
138
174
  cases: EvalCaseResult<TOutput>[]; /** Total wall-clock duration of the whole suite in milliseconds. */
139
175
  duration: number;
176
+ /**
177
+ * Regression diff vs a baseline. Present only when `agent.eval` was
178
+ * called with a `baseline`.
179
+ */
180
+ regression?: EvalRegression;
140
181
  };
141
182
  //#endregion
142
- export { EvalCase, EvalCaseResult, EvalJudge, EvalOptions, EvalReport, EvalScore, EvalScorer, EvalScorerContext };
183
+ export { EvalCase, EvalCaseResult, EvalJudge, EvalOptions, EvalRegression, EvalReport, EvalScore, EvalScorer, EvalScorerContext };
143
184
  //# sourceMappingURL=eval.type.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"eval.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/agent/eval.type.ts"],"mappings":";;;;;;;AAWA;;;;;KAAY,SAAA;EASV,6CAPA,KAAA;EAOM;AASR;;;EAXE,MAAA,YAaM;EAXN,MAAA;AAAA;;;;;;;KASU,iBAAA;EAIV,uCAFA,IAAA,EAAM,QAAA,CAAS,OAAA,GAEK;EAApB,MAAA,EAAQ,WAAA,CAAY,OAAA,GAEX;EAAT,MAAA,GAAS,OAAA,EAEL;EAAJ,IAAA;AAAA;;;;;;;KASU,UAAA,uBACV,OAAA,EAAS,iBAAA,CAAkB,OAAA,MACxB,SAAA,GAAY,OAAA,CAAQ,SAAA;;;;;;;KAQb,QAAA;EARK,+DAUf,IAAA,UAVgC;EAYhC,KAAA;EAJU;;;;;EAUV,QAAA,YAIU;EAFV,OAAA,GAAU,UAAA,CAAW,OAAA,KAEQ;EAA7B,OAAA,GAAU,mBAAA,CAAoB,OAAA;AAAA;;;;;;;;;;AAAO;AAevC;;KAAY,SAAA;EAEU,+DAApB,KAAA,EAAO,aAAa;EAAb;;;;AAYM;EANb,MAAA;EAiBqB;;;;;EAXrB,aAAA;AAAA;;;;;;;;;KAWU,WAAA;EAEH,mCAAP,KAAA,EAAO,QAAA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../@warlock.js/ai/src/contracts/attachment-policy.type.d.ts
4
+ /**
5
+ * Trust-boundary policy for agent attachments (S1). Attachment references
6
+ * are frequently user-controlled (chat uploads, document-ingestion
7
+ * endpoints), so the framework treats server-side fetches and local reads
8
+ * as hostile by default.
9
+ *
10
+ * Supply it on `AgentConfig.attachmentPolicy` (factory default) or
11
+ * per-call `AgentExecuteOptions.attachmentPolicy` (overrides the factory
12
+ * one). Omitting it keeps the safe defaults: remote text fetch is denied,
13
+ * and bare-string local paths warn (staged deprecation).
14
+ */
15
+ type AttachmentPolicy = {
16
+ /**
17
+ * Allow fetching a REMOTE TEXT attachment (an `http`/`https` URL given
18
+ * as a `{ type: "text" }` source). Default `false` — default-deny: such
19
+ * a fetch throws `OutboundPolicyError` unless this is enabled.
20
+ *
21
+ * URL *image* attachments are handed to the provider as a URL and are
22
+ * never fetched server-side, so they are unaffected by this flag.
23
+ */
24
+ allowRemoteFetch?: boolean;
25
+ /**
26
+ * {@link OutboundPolicy} applied to a permitted remote-text fetch
27
+ * (scheme + host allowlist, post-DNS private-IP deny, max bytes,
28
+ * timeout, injectable fetch). Defaults to the strict OutboundPolicy
29
+ * defaults (https-only, private-IP deny on, 5 MiB cap, 10s timeout).
30
+ */
31
+ outbound?: OutboundPolicy;
32
+ /**
33
+ * Sandbox roots for LOCAL file attachments. When set, a local path must
34
+ * resolve inside one of these absolute roots, else it is rejected with
35
+ * `OutboundPolicyError`. When omitted, local reads are not path-
36
+ * restricted (back-compat) — set this to confine reads to an uploads
37
+ * directory.
38
+ */
39
+ allowedRoots?: string[];
40
+ /**
41
+ * Allow bare-STRING local paths (e.g. `"./notes.txt"`, `"/etc/passwd"`).
42
+ * Staged deprecation: today bare-string local paths are allowed but warn
43
+ * once (outside tests). Set `false` to hard-deny them now — the typed
44
+ * `{ type, source: { absolutePath } }` StorageFile route stays supported
45
+ * (and is gated by {@link allowedRoots}).
46
+ */
47
+ allowBareLocalPaths?: boolean;
48
+ };
49
+ //#endregion
50
+ export { AttachmentPolicy };
51
+ //# sourceMappingURL=attachment-policy.type.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-policy.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/attachment-policy.type.ts"],"mappings":";;;;;AAaA;;;;;;;;;KAAY,gBAAA;EAgCS;;;;;;;;EAvBnB,gBAAA;;;;;;;EAOA,QAAA,GAAW,cAAc;;;;;;;;EAQzB,YAAA;;;;;;;;EAQA,mBAAA;AAAA"}
@@ -20,8 +20,9 @@ type StorageFileShape = {
20
20
  *
21
21
  * - `string` — local file path or remote URL (auto-detected via the
22
22
  * `https?://` prefix).
23
- * - `StorageFileShape` — a `@warlock.js/core` storage file; URL wins
24
- * over path when both are present.
23
+ * - `StorageFileShape` — a `@warlock.js/core` storage file; `absolutePath`
24
+ * wins over `url` when both are present (prefer the local file the app
25
+ * already has over an extra remote hop).
25
26
  * - `{ base64, mediaType }` — raw inline bytes with an explicit IANA
26
27
  * media type, useful for in-memory data that never touched disk.
27
28
  */
@@ -35,12 +36,14 @@ type AttachmentSource = string | StorageFileShape | {
35
36
  * Two forms:
36
37
  *
37
38
  * - **Tagged form** (preferred for non-image types and for explicit
38
- * intent): `{ type: "image" | "text", source }`.
39
+ * intent): `{ type: "image" | "text" | "pdf" | "audio", source }`.
39
40
  * - **Shorthand string / StorageFileShape**: the agent infers the
40
- * media kind from the file extension. Recognized image extensions:
41
- * `.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`. Recognized text
42
- * extension: `.txt`. Anything else throws silent inference for
43
- * ambiguous inputs causes silent bugs.
41
+ * media kind from the file extension. Recognized: image
42
+ * (`.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`), text (`.txt`), pdf
43
+ * (`.pdf`), audio (`.mp3`, `.wav`, `.m4a`, `.ogg`, `.weba`). Anything
44
+ * else throws — silent inference for ambiguous inputs causes silent
45
+ * bugs. The model must declare the matching capability
46
+ * (`vision` / `pdf` / `audio`) or the agent rejects the attachment.
44
47
  *
45
48
  * @example
46
49
  * // Shorthand — extension-inferred image
@@ -69,6 +72,12 @@ type Attachment = string | StorageFileShape | {
69
72
  } | {
70
73
  type: "text";
71
74
  source: AttachmentSource;
75
+ } | {
76
+ type: "pdf";
77
+ source: AttachmentSource;
78
+ } | {
79
+ type: "audio";
80
+ source: AttachmentSource;
72
81
  };
73
82
  /**
74
83
  * A normalized attachment after source resolution — a tagged value the
@@ -1 +1 @@
1
- {"version":3,"file":"attachment.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/attachment.type.ts"],"mappings":";;AAUA;;;;AAIc;AAed;;;;KAnBY,gBAAA;EAsBN,6BApBJ,GAAA,WAoB6B;EAlB7B,YAAY;AAAA;;;;;;;;;;;;;KAeF,gBAAA,YAER,gBAAgB;EACd,MAAA;EAAgB,SAAA;AAAA;AAwDtB;;;;;;;;;;;;AAG8C;;;;;;;;;;;;;;;;;;;;;;AAH9C,KApBY,UAAA,YAER,gBAAA;EACE,IAAA;EAAe,MAAA,EAAQ,gBAAA;AAAA;EACvB,IAAA;EAAc,MAAA,EAAQ,gBAAA;AAAA;;;;;;;;;;;;;;;KAgBhB,kBAAA;EACN,IAAA;EAAa,KAAA;AAAA;EACb,IAAA;EAAc,KAAA;AAAA;EACd,IAAA;EAAgB,KAAA;EAAe,SAAA;AAAA"}
1
+ {"version":3,"file":"attachment.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/attachment.type.ts"],"mappings":";;AAUA;;;;AAIc;AAgBd;;;;KApBY,gBAAA;EAuBN,6BArBJ,GAAA,WAqB6B;EAnB7B,YAAY;AAAA;;;;;;;;;;;;;;KAgBF,gBAAA,YAER,gBAAgB;EACd,MAAA;EAAgB,SAAA;AAAA;;;;;;;AA4CuB;AAgB7C;;;;;;;;;;;;AAG8C;;;;;;;;;;;;;;;;;KAzBlC,UAAA,YAER,gBAAA;EACE,IAAA;EAAe,MAAA,EAAQ,gBAAA;AAAA;EACvB,IAAA;EAAc,MAAA,EAAQ,gBAAA;AAAA;EACtB,IAAA;EAAa,MAAA,EAAQ,gBAAA;AAAA;EACrB,IAAA;EAAe,MAAA,EAAQ,gBAAA;AAAA;;;;;;;;;;;;;;;KAgBjB,kBAAA;EACN,IAAA;EAAa,KAAA;AAAA;EACb,IAAA;EAAc,KAAA;AAAA;EACd,IAAA;EAAgB,KAAA;EAAe,SAAA;AAAA"}
@@ -34,22 +34,31 @@ type ContentPart = {
34
34
  } | {
35
35
  type: "image";
36
36
  source: ImageSource;
37
+ } | {
38
+ type: "pdf";
39
+ source: BinarySource;
40
+ } | {
41
+ type: "audio";
42
+ source: BinarySource;
37
43
  };
38
44
  /**
39
- * Where an image's bytes live in a resolved `ContentPart`.
45
+ * Where binary media bytes live in a resolved `ContentPart`.
40
46
  *
41
47
  * - `{ url }` — remote URL the provider can fetch directly. Used for
42
48
  * public URLs and StorageFile entries that already expose a URL.
43
49
  * - `{ base64, mediaType }` — inlined base64 bytes with an explicit
44
- * IANA media type (e.g. `"image/png"`). Used for local file paths
45
- * and StorageFile entries with only an absolute path.
50
+ * IANA media type (e.g. `"image/png"`, `"application/pdf"`,
51
+ * `"audio/mpeg"`). Used for local file paths and StorageFile entries
52
+ * with only an absolute path.
46
53
  */
47
- type ImageSource = {
54
+ type BinarySource = {
48
55
  url: string;
49
56
  } | {
50
57
  base64: string;
51
58
  mediaType: string;
52
59
  };
60
+ /** Image bytes for an `{ type: "image" }` part. Alias of {@link BinarySource}. */
61
+ type ImageSource = BinarySource;
53
62
  //#endregion
54
- export { ContentPart, ImageSource };
63
+ export { BinarySource, ContentPart, ImageSource };
55
64
  //# sourceMappingURL=content-part.type.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"content-part.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/content-part.type.ts"],"mappings":";;AA6BA;;;;;;;;;;AAA+F;AAW/F;;;;;;;;AAAuE;;;;;;;;;KAX3D,WAAA;EAAgB,IAAA;EAAc,IAAA;AAAA;EAAmB,IAAA;EAAe,MAAA,EAAQ,WAAW;AAAA;;;;;;;;;;KAWnF,WAAA;EAAgB,GAAA;AAAA;EAAkB,MAAA;EAAgB,SAAA;AAAA"}
1
+ {"version":3,"file":"content-part.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/content-part.type.ts"],"mappings":";;AA6BA;;;;;;;;;;;;;;;;;;;;AAIyC;AAYzC;;;;;;;KAhBY,WAAA;EACN,IAAA;EAAc,IAAA;AAAA;EACd,IAAA;EAAe,MAAA,EAAQ,WAAA;AAAA;EACvB,IAAA;EAAa,MAAA,EAAQ,YAAA;AAAA;EACrB,IAAA;EAAe,MAAA,EAAQ,YAAA;AAAA;;;;;;;;;;;KAYjB,YAAA;EAAiB,GAAA;AAAA;EAAkB,MAAA;EAAgB,SAAA;AAAA;;KAGnD,WAAA,GAAc,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"supervisor-events.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/events/supervisor-events.type.ts"],"mappings":";;;;;;;;;KAWY,yBAAA;EACV,cAAA;EACA,KAAA,EAAO,eAAe;AAAA;;KAIZ,kCAAA;EAAuC,SAAS;AAAA;;KAGhD,+BAAA;EAAoC,SAAS;AAAA;;KAG7C,8BAAA;EACV,SAAA;EACA,IAAA,EAAM,IAAI;EACV,SAAA;EACA,UAAA;AAAA;AAV0D;AAAA,KAchD,8BAAA;EACV,SAAA;EACA,MAAA;EACA,KAAA;AAAA;AAXF;;;;;AAAA,KAmBY,+BAAA;EACV,SAAA;EACA,MAAA;EACA,KAAA;AAAA;AAlBU;AAAA,KAsBA,+BAAA;EACV,SAAA;EACA,MAAA;EACA,MAAA;EACA,KAAA;IAAS,KAAA;IAAe,MAAA;IAAgB,KAAA;EAAA;EACxC,QAAA;AAAA;;;;;;KAQU,4BAAA;EACV,SAAA;EACA,MAAA;EACA,KAAA,EAAO,OAAO;AAAA;;;;;;KAQJ,mCAAA;EAAwC,SAAS;AAAA;;;AAnBnD;AAQV;;;;KAoBY,oCAAA;EACV,KAAK;AAAA;;;AAlBS;AAQhB;;;KAmBY,oCAAA;EACV,MAAA;IAAU,MAAA;IAAiB,SAAA;IAAoB,UAAA;EAAA;EAC/C,MAAA;EACA,OAAA;EACA,MAAA;EACA,QAAA;EACA,KAAA,GAAQ,KAAK;AAAA;;;;;;KAQH,iCAAA;EACV,KAAA,EAAO,OAAO;AAAA;;;AATD;AAQf;;;KAUY,6BAAA;EACV,KAAK;AAAA;;;;AAAA;AAQP;KAAY,6BAAA;EACV,MAAA;EACA,KAAA,GAAQ,KAAA;EACR,QAAA;EACA,KAAA,GAAQ,OAAO;AAAA;;KAIL,gCAAA;EACV,SAAA;EACA,OAAA,EAAS,cAAc;AAAA;AAFzB;;;;AAAA,KASY,mCAAA;EACV,SAAA;EACA,QAAA,EAAU,iBAAiB;AAAA;AATJ;AAAA,KAab,0BAAA;EACV,WAAA;EACA,MAAM;AAAA;;KAII,0BAAA;EACV,MAAA,EAAQ,gBAAgB,CAAC,OAAA;AAAA;AAXE;AAI7B;;;AAJ6B,KAkBjB,sBAAA;EAA2B,KAAA,EAAO,OAAO;AAAA"}
1
+ {"version":3,"file":"supervisor-events.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/events/supervisor-events.type.ts"],"mappings":";;;;;;;;;KAWY,yBAAA;EACV,cAAA;EACA,KAAA,EAAO,eAAe;AAAA;;KAIZ,kCAAA;EAAuC,SAAS;AAAA;;KAGhD,+BAAA;EAAoC,SAAS;AAAA;;KAG7C,8BAAA;EACV,SAAA;EACA,IAAA,EAAM,IAAI;EACV,SAAA;EACA,UAAA;AAAA;AAPF;AAAA,KAWY,8BAAA;EACV,SAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;;;KAQU,+BAAA;EACV,SAAA;EACA,MAAA;EACA,KAAA;AAAA;AAdF;AAAA,KAkBY,+BAAA;EACV,SAAA;EACA,MAAA;EACA,MAAA;EACA,KAAA;IAAS,KAAA;IAAe,MAAA;IAAgB,KAAA;EAAA;EACxC,QAAA;AAAA;;;;;;KAQU,4BAAA;EACV,SAAA;EACA,MAAA;EACA,KAAA,EAAO,OAAO;AAAA;;;;;;KAQJ,mCAAA;EAAwC,SAAS;AAAA;;AAnBnD;AAQV;;;;;KAoBY,oCAAA;EACV,KAAK;AAAA;;AAlBS;AAQhB;;;;KAmBY,oCAAA;EACV,MAAA;IAAU,MAAA;IAAiB,SAAA;IAAoB,UAAA;EAAA;EAC/C,MAAA;EACA,OAAA;EACA,MAAA;EACA,QAAA;EACA,KAAA,GAAQ,KAAK;AAAA;;;;;;KAQH,iCAAA;EACV,KAAA,EAAO,OAAO;AAAA;;AATD;AAQf;;;;KAUY,6BAAA;EACV,KAAK;AAAA;;;AAAA;AAQP;;KAAY,6BAAA;EACV,MAAA;EACA,KAAA,GAAQ,KAAA;EACR,QAAA;EACA,KAAA,GAAQ,OAAO;AAAA;;KAIL,gCAAA;EACV,SAAA;EACA,OAAA,EAAS,cAAc;AAAA;;;;;KAOb,mCAAA;EACV,SAAA;EACA,QAAA,EAAU,iBAAiB;AAAA;AAF7B;AAAA,KAMY,0BAAA;EACV,WAAA;EACA,MAAM;AAAA;;KAII,0BAAA;EACV,MAAA,EAAQ,gBAAgB,CAAC,OAAA;AAAA;AAP3B;;;;AAAA,KAcY,sBAAA;EAA2B,KAAA,EAAO,OAAO;AAAA"}
@@ -1,5 +1,6 @@
1
+ import { AttachmentPolicy } from "./attachment-policy.type.mjs";
1
2
  import { Attachment, AttachmentSource, ResolvedAttachment, StorageFileShape } from "./attachment.type.mjs";
2
- import { ContentPart, ImageSource } from "./content-part.type.mjs";
3
+ import { BinarySource, ContentPart, ImageSource } from "./content-part.type.mjs";
3
4
  import { ModelToolCallRequest } from "./model-tool-call-request.type.mjs";
4
5
  import { Message } from "./conversation-message.type.mjs";
5
6
  import { ModelPricing } from "./result/model-pricing.type.mjs";
@@ -10,7 +11,7 @@ import { BaseReport, REPORT_SCHEMA_VERSION, ReportStatus, ReportType } from "./r
10
11
  import { FinishReason } from "./finish-reason.type.mjs";
11
12
  import { ToolCall } from "./result/tool-call.type.mjs";
12
13
  import { LLMTrip } from "./result/llm-trip.type.mjs";
13
- import { AgentReport, ExecutionReport, ExecutionStatus } from "./result/execution-report.type.mjs";
14
+ import { AgentReport, CapturedMessage, ExecutionReport, ExecutionStatus } from "./result/execution-report.type.mjs";
14
15
  import { AgentResult } from "./result/agent-result.type.mjs";
15
16
  import { AgentCompletedPayload, AgentErrorPayload, AgentStartingPayload, AgentStreamingPayload, AgentToolCalledPayload, AgentToolCallingFailedPayload, AgentToolCallingPayload, AgentTripCompletedPayload, AgentTripStartedPayload, ToolEventMeta } from "./events/agent-events.type.mjs";
16
17
  import { EventIdentity, WithoutIdentity } from "./events/event-identity.type.mjs";
@@ -40,7 +41,7 @@ import { MiddlewareState } from "./middleware/middleware-state.type.mjs";
40
41
  import { MiddlewareAgentRef, MiddlewareExecuteContext, MiddlewareModelRef, MiddlewareSupervisorContext, MiddlewareSupervisorRef, MiddlewareToolContext, MiddlewareTripContext } from "./middleware/middleware-context.type.mjs";
41
42
  import { AgentMiddleware, AgentMiddlewareExecuteHooks, AgentMiddlewareSupervisorHooks, AgentMiddlewareToolHooks, AgentMiddlewareTripHooks } from "./middleware/middleware.contract.mjs";
42
43
  import { Placeholders } from "./placeholders.type.mjs";
43
- import { InstructionContract, PersonaContract, SystemPromptBlockContract, SystemPromptContract } from "./system-prompt.contract.mjs";
44
+ import { InstructionContract, PersonaContract, SystemPromptBlockContract, SystemPromptContract, SystemPromptMergeOptions, SystemPromptMergeSource, SystemPromptMeta } from "./system-prompt.contract.mjs";
44
45
  import { RouteContext } from "./supervisor/route-context.type.mjs";
45
46
  import { AckCallback, AckConfig, AckEntry, AckRunEntry } from "./supervisor/ack-entry.type.mjs";
46
47
  import { DispatchRawResult, IntentCallback, IntentEntry, IntentRunEntry, SupervisorIntentValue } from "./supervisor/intent-entry.type.mjs";
@@ -66,6 +67,7 @@ import { RecallOptions } from "./memory/recall-options.type.mjs";
66
67
  import { MemoryContract } from "./memory/memory.contract.mjs";
67
68
  import { MemoryConfig, SemanticMemoryConfig } from "./memory/memory-config.type.mjs";
68
69
  import { CheckpointRecord, CheckpointStore } from "./orchestrator/checkpoint-store.contract.mjs";
70
+ import { SessionLock } from "./orchestrator/session-lock.contract.mjs";
69
71
  import { OrchestratorCommands } from "./orchestrator/orchestrator-commands.type.mjs";
70
72
  import { OrchestratorEvent, OrchestratorEventHandler, OrchestratorEventHandlers, OrchestratorEventMap, OrchestratorEventName } from "./orchestrator/orchestrator-event.type.mjs";
71
73
  import { OrchestratorExecuteOptions, OrchestratorResumeOptions } from "./orchestrator/orchestrator-execute-options.type.mjs";
@@ -74,9 +76,9 @@ import { OrchestratorConfig, OrchestratorMemoryConfig, SummarizeCallback, Summar
74
76
  import { SessionContract } from "./orchestrator/session.contract.mjs";
75
77
  import { PlannerCapability } from "./planner/planner-capability.type.mjs";
76
78
  import { PlannerConfig } from "./planner/planner-config.type.mjs";
77
- import { PlannerExecuteOptions } from "./planner/planner-execute-options.type.mjs";
78
79
  import { PlannerPlan, PlannerStep } from "./planner/planner-plan.type.mjs";
79
80
  import { PlannerReport, PlannerReportType, PlannerResult, PlannerStepSnapshot } from "./planner/planner-result.type.mjs";
81
+ import { PlannerExecuteOptions, PlannerStepDirective } from "./planner/planner-execute-options.type.mjs";
80
82
  import { PlannerContract } from "./planner/planner.contract.mjs";
81
83
  import { ModelConfig, SDKAdapterContract } from "./sdk-adapter.contract.mjs";
82
84
  import { CompleteEvent } from "./events/complete-event.type.mjs";
@@ -116,17 +116,20 @@ type ModelCapabilities = {
116
116
  */
117
117
  promptCaching?: boolean;
118
118
  /**
119
- * True when the adapter accepts audio `ContentPart` input. When
120
- * false/absent and the caller passes audio attachments, the agent
121
- * throws upfront rather than dropping them at the wire layer (mirrors
122
- * `vision`).
119
+ * True when the adapter accepts audio `ContentPart` input (A2). The
120
+ * agent gates `{ type: "audio" }` attachments on this flag — when
121
+ * false/absent it throws upfront rather than dropping them at the wire
122
+ * layer (mirrors `vision`). Wired end-to-end: audio `ContentPart` +
123
+ * attachment resolution exist; today Google (Gemini, via `inlineData`)
124
+ * declares it.
123
125
  */
124
126
  audio?: boolean;
125
127
  /**
126
- * True when the adapter accepts PDF / document `ContentPart` input.
127
- * When false/absent and the caller passes PDF attachments, the agent
128
- * throws upfront rather than dropping them at the wire layer (mirrors
129
- * `vision`).
128
+ * True when the adapter accepts PDF / document `ContentPart` input (A2).
129
+ * The agent gates `{ type: "pdf" }` attachments on this flag — when
130
+ * false/absent it throws upfront (mirrors `vision`). Wired end-to-end:
131
+ * Anthropic (`document` block), Bedrock Converse (`document` block), and
132
+ * Google (Gemini `inlineData`) map PDF parts.
130
133
  */
131
134
  pdf?: boolean;
132
135
  };
@@ -1 +1 @@
1
- {"version":3,"file":"model.contract.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/model.contract.ts"],"mappings":";;;;;;;;;;AAqBA;;;;;;;;;;;;KAAY,gBAAA;EACV,WAAA;EACA,SAAA,WAkBA;EAhBA,KAAA,GAAQ,UAAA;EA2BR;;;;;;;;EAlBA,cAAA,GAAiB,MAAA;EA6CP;;;;AAAe;AAY3B;EAlDE,MAAA,GAAS,WAAA;;;;;;;;;;AA4FN;EAjFH,SAAA;IACE,MAAA,GAAS,eAAA;IACT,SAAA;EAAA;EA+FK;;;;;;;;;;;EAlFP,YAAA;IACE,WAAA;EAAA,GA+FwB;EAAA,CA5FzB,GAAA;AAAA;;;;;;KAQS,eAAA;;;;;;;;;;;KAYA,iBAAA;EAuFgD;AAAA;AAgB5D;;;;EAhGE,gBAAA;EA2HmB;;;;;;;EAnHnB,MAAA;EAwHsE;;;;;;EAjHtE,SAAA;EAuGmB;;;;;EAjGnB,aAAA;EAsG2D;;;;;;EA/F3D,KAAA;EAoGyD;;;AAA8B;;;EA7FvF,GAAA;AAAA;;;;;;;;;;;KAaU,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EAhG3D,KAAA;EAqGuF;AAAA;;;;;;EA7FvF,GAAA;AAAA;;;;;;;;;;;KAaU,aAAA;EACV,OAAA;EACA,YAAA,EAAc,YAAA;EACd,KAAA,EAAO,KAAA;EAEP,SAAA,GAAY,oBAAA;AAAA;;;;;;;;;;KAYF,gBAAA;EACN,IAAA;EAAe,OAAA;AAAA;EAEf,IAAA;EACA,EAAA;EACA,IAAA;EACA,KAAA;;;;;;;EAOA,gBAAA,GAAmB,MAAA;AAAA;EAEnB,IAAA;EAAc,YAAA,EAAc,YAAA;EAAc,KAAA,EAAO,KAAA;AAAA;;;;;;;;;;;;;;;UAgBtC,aAAA;;WAEN,IAAA;;WAEA,QAAA;;;;;;WAMA,YAAA,GAAe,iBAAA;;;;;;;;;;;WAYf,OAAA,GAAU,YAAA;;;;EAKnB,QAAA,CAAS,QAAA,EAAU,OAAA,IAAW,OAAA,GAAU,gBAAA,GAAmB,OAAA,CAAQ,aAAA;;;;EAKnE,MAAA,CAAO,QAAA,EAAU,OAAA,IAAW,OAAA,GAAU,gBAAA,GAAmB,aAAA,CAAc,gBAAA;AAAA"}
@@ -1,5 +1,6 @@
1
1
  import { PgClientLike, RedisClientLike, SnapshotStore } from "./snapshot-store.contract.mjs";
2
2
  import { CheckpointRecord, CheckpointStore } from "./checkpoint-store.contract.mjs";
3
+ import { SessionLock } from "./session-lock.contract.mjs";
3
4
  import { OrchestratorCommands } from "./orchestrator-commands.type.mjs";
4
5
  import { OrchestratorEvent, OrchestratorEventHandler, OrchestratorEventHandlers, OrchestratorEventMap, OrchestratorEventName } from "./orchestrator-event.type.mjs";
5
6
  import { OrchestratorExecuteOptions, OrchestratorResumeOptions } from "./orchestrator-execute-options.type.mjs";
@@ -1,5 +1,6 @@
1
1
  import { Message } from "../conversation-message.type.mjs";
2
2
  import { AgentContract } from "../agent/agent.contract.mjs";
3
+ import { FlowObserveOption } from "../../observe/resolve-observers.mjs";
3
4
  import { SnapshotStore } from "./snapshot-store.contract.mjs";
4
5
  import { ModelContract } from "../model.contract.mjs";
5
6
  import { SystemPromptContract } from "../system-prompt.contract.mjs";
@@ -12,6 +13,7 @@ import { CompactionResult } from "../result/orchestrator-result.type.mjs";
12
13
  import { MemoryTier } from "../memory/memory-item.type.mjs";
13
14
  import { MemoryContract } from "../memory/memory.contract.mjs";
14
15
  import { CheckpointStore } from "./checkpoint-store.contract.mjs";
16
+ import { SessionLock } from "./session-lock.contract.mjs";
15
17
  import { OrchestratorEventHandlers } from "./orchestrator-event.type.mjs";
16
18
  import { StandardSchemaV1 } from "@standard-schema/spec";
17
19
 
@@ -124,7 +126,15 @@ type OrchestratorMemoryConfig = {
124
126
  */
125
127
  type OrchestratorConfig<TOutput, TState = TOutput, TIntents extends Record<string, SupervisorIntentValue> = Record<string, SupervisorIntentValue>> = {
126
128
  /** Stable identifier — used in logs, events, checkpoints, signature. */name: string; /** Dev-curated version string. Metadata only (§10.2) — never parsed. */
127
- version?: string; /** Prepended to the router agent's system prompt (router mode only). */
129
+ version?: string;
130
+ /**
131
+ * Per-flow observability routing. `true` routes each turn's report to the
132
+ * globally-registered observers (even with observe-all off); `false` opts
133
+ * out; an `Observer` is a flow-local collector; omitted follows the global
134
+ * observe-all flag. Parity with agent/workflow/supervisor — a durable
135
+ * session root no longer needs a manual `observe.collect()`.
136
+ */
137
+ observe?: FlowObserveOption; /** Prepended to the router agent's system prompt (router mode only). */
128
138
  systemPrompt?: SystemPromptContract | string; /** Dispatchable units keyed by intent name (supervisor surface). */
129
139
  intents: TIntents; /** Deterministic per-turn dispatch. Mutually exclusive with `router`. */
130
140
  route?: (ctx: RouteContext<TState>) => Next | Promise<Next>; /** LLM-driven dispatch. Mutually exclusive with `route`. */
@@ -151,7 +161,26 @@ type OrchestratorConfig<TOutput, TState = TOutput, TIntents extends Record<strin
151
161
  }; /** Automatic post-turn compaction policy (§12). */
152
162
  summarize?: SummarizeConfig | SummarizeCallback; /** Number of turn snapshots to retain per session. Default 100. */
153
163
  keepSnapshots?: number | "all"; /** Durable session-state store. Falls back to `ai.config({ defaultCheckpointStore })`. */
154
- checkpointStore?: CheckpointStore; /** Internal-supervisor snapshot store. Required when `iterate: true`. */
164
+ checkpointStore?: CheckpointStore;
165
+ /**
166
+ * Per-session turn serialization (C4). Each `execute` / `stream` /
167
+ * `resume` turn runs under `sessionLock.withLock(sessionId, …)` so a
168
+ * concurrent same-session turn can't race the checkpoint's read-modify-
169
+ * write and lose an update.
170
+ *
171
+ * - Omitted (default) → an in-process mutex keyed by `sessionId`. Fully
172
+ * serializes same-session turns within ONE process; for a
173
+ * horizontally-scaled deployment supply a distributed lock instead.
174
+ * - A {@link SessionLock} → your own (e.g. Redis/Postgres advisory
175
+ * locks) for cross-process serialization.
176
+ * - `false` → no locking. Only when an external mechanism (sticky
177
+ * routing, single-writer guarantee) already serializes the session.
178
+ *
179
+ * When a durable `checkpointStore` is configured but no explicit lock
180
+ * is supplied, the orchestrator warns once (outside tests) that the
181
+ * in-process default does not protect across processes.
182
+ */
183
+ sessionLock?: SessionLock | false; /** Internal-supervisor snapshot store. Required when `iterate: true`. */
155
184
  snapshotStore?: SnapshotStore;
156
185
  /**
157
186
  * Optional per-turn memory (memory core M2). When set, the
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator-config.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/orchestrator/orchestrator-config.type.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyBA;;;;;;KAAY,eAAA;EAeE,qEAbZ,UAAA,WAEA;EAAA,IAAA,WAEa;EAAb,UAAA,GAAa,aAAA;EAOC;;;;;EADd,SAAA,IACE,UAAA,EAAY,gBAAA,EACZ,GAAA;IAAO,SAAA;EAAA,MACJ,OAAA,eAEW;EAAhB,IAAA;IAAS,OAAA;EAAA;AAAA;;;;;;;KASC,iBAAA,IACV,OAAA,EAAS,OAAA,OACN,OAAA,CAAQ,gBAAA,IAAoB,gBAAA;;;;;AAAgB;AAmBjD;;;;;;;;;;;;KAAY,wBAAA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AAA;EAAA;;;;;EAOA,OAAA;EAO8C;;;;;EAD9C,aAAA;IACE,MAAA,cAAoB,QAAA,EAAU,OAAA,OAAc,OAAA;IAC5C,MAAA,cAAoB,QAAA,EAAU,OAAA,OAAc,OAAA;EAAA,GAQ9C;EALA,SAAA,GAAY,eAAA,GAAkB,iBAAA,EAwB9B;EAtBA,aAAA,mBAwBA;EArBA,eAAA,GAAkB,eAAA;EA+BlB;;;;;;AAG8B;;;;;;;;;;;;EAf9B,WAAA,GAAc,WAAA;EAEd,aAAA,GAAgB,aAAA;;;;;;;;;;EAUhB,MAAA,GAAS,cAAA,GAAiB,wBAAA;EAG1B,EAAA,GAAK,yBAAA;AAAA"}
@@ -0,0 +1,47 @@
1
+ //#region ../@warlock.js/ai/src/contracts/orchestrator/session-lock.contract.d.ts
2
+ /**
3
+ * Serializes concurrent turns for a single orchestrator session so the
4
+ * read-modify-write of the durable checkpoint can't lose an update
5
+ * (orchestrator C4). The orchestrator wraps each `execute()` / `stream()`
6
+ * / `resume()` turn in `withLock(sessionId, …)`.
7
+ *
8
+ * The framework default is an in-process mutex keyed by `sessionId`
9
+ * ({@link inProcessSessionLock}), which fully serializes same-session
10
+ * turns within ONE process. For a horizontally-scaled deployment (many
11
+ * processes / pods) supply a distributed implementation — Redis
12
+ * `SETNX` / Redlock, Postgres advisory locks, etc. — so the invariant
13
+ * holds across processes too. Set `sessionLock: false` on the config to
14
+ * opt out entirely (only when an external mechanism already serializes
15
+ * same-session turns, e.g. sticky routing).
16
+ *
17
+ * @example
18
+ * // A Redis-backed distributed lock.
19
+ * const redisLock: SessionLock = {
20
+ * async withLock(key, fn, { signal } = {}) {
21
+ * await acquireRedisLock(key, { signal });
22
+ * try {
23
+ * return await fn();
24
+ * } finally {
25
+ * await releaseRedisLock(key);
26
+ * }
27
+ * },
28
+ * };
29
+ */
30
+ interface SessionLock {
31
+ /**
32
+ * Acquire the lock for `key` (the sessionId), run `fn`, and release it
33
+ * — even if `fn` throws or rejects. Concurrent calls for the SAME key
34
+ * run one at a time, in arrival order; calls for DIFFERENT keys never
35
+ * contend.
36
+ *
37
+ * `options.signal` aborts the WAIT for the lock (never the critical
38
+ * section once acquired): a caller cancelled while queued rejects with
39
+ * the signal's reason instead of deadlocking behind a stuck holder.
40
+ */
41
+ withLock<T>(key: string, fn: () => Promise<T>, options?: {
42
+ signal?: AbortSignal;
43
+ }): Promise<T>;
44
+ }
45
+ //#endregion
46
+ export { SessionLock };
47
+ //# sourceMappingURL=session-lock.contract.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-lock.contract.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/orchestrator/session-lock.contract.ts"],"mappings":";;AA4BA;;;;;;;;;;;;;;;;;;;;;;AAec;;;;;UAfG,WAAA;;;;;;;;;;;EAWf,QAAA,IACE,GAAA,UACA,EAAA,QAAU,OAAA,CAAQ,CAAA,GAClB,OAAA;IAAY,MAAA,GAAS,WAAA;EAAA,IACpB,OAAA,CAAQ,CAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  import { PlannerCapability } from "./planner-capability.type.mjs";
2
2
  import { PlannerConfig } from "./planner-config.type.mjs";
3
- import { PlannerExecuteOptions } from "./planner-execute-options.type.mjs";
4
3
  import { PlannerPlan, PlannerStep } from "./planner-plan.type.mjs";
5
4
  import { PlannerReport, PlannerReportType, PlannerResult, PlannerStepSnapshot } from "./planner-result.type.mjs";
5
+ import { PlannerExecuteOptions, PlannerStepDirective } from "./planner-execute-options.type.mjs";
6
6
  import { PlannerContract } from "./planner.contract.mjs";
@@ -1,4 +1,5 @@
1
1
  import { AgentContract } from "../agent/agent.contract.mjs";
2
+ import { FlowObserveOption } from "../../observe/resolve-observers.mjs";
2
3
  import { ModelContract } from "../model.contract.mjs";
3
4
  import { SystemPromptContract } from "../system-prompt.contract.mjs";
4
5
  import { PlannerCapability } from "./planner-capability.type.mjs";
@@ -35,6 +36,14 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
35
36
  type PlannerConfig<TOutput = unknown> = {
36
37
  /** Stable identifier — used in logs, events, signature, report `name`. */name: string; /** Dev-curated version string. Metadata only — never parsed. */
37
38
  version?: string;
39
+ /**
40
+ * Per-flow observability routing. `true` routes this planner's report to
41
+ * the globally-registered observers (even with observe-all off); `false`
42
+ * opts out; an `Observer` is a flow-local collector; omitted follows the
43
+ * global observe-all flag. Brings the planner to parity with
44
+ * agent/workflow/supervisor instead of only ever routing under observe-all.
45
+ */
46
+ observe?: FlowObserveOption;
38
47
  /**
39
48
  * Model used to build the internal planning agent that GENERATES the
40
49
  * plan. Mutually exclusive with `planner`.
@@ -72,6 +81,28 @@ type PlannerConfig<TOutput = unknown> = {
72
81
  * untyped.
73
82
  */
74
83
  output?: StandardSchemaV1<TOutput>;
84
+ /**
85
+ * Schedule independent steps in parallel off `dependsOn`. When true the
86
+ * planner builds a DAG from step `id` / `dependsOn`, runs each ready
87
+ * level concurrently, and feeds each step ONLY its dependencies'
88
+ * outputs. A cycle or a `dependsOn` that names an unknown step raises a
89
+ * typed {@link import("../../errors/planner-plan-invalid-error").PlannerPlanInvalidError}
90
+ * before any step runs. Default `false` ⇒ today's strict array-order
91
+ * loop, byte-for-byte unchanged.
92
+ */
93
+ dag?: boolean; /** Max concurrent steps when `dag` is true. Default 4. */
94
+ maxConcurrency?: number;
95
+ /**
96
+ * Adaptive re-planning. When set, a failed step (or a `replan` verdict
97
+ * from the `onStep` execute-option) revises the REMAINING plan instead
98
+ * of aborting — re-asking the planning agent for a fresh plan seeded
99
+ * with the executed-step digest plus the feedback. Bounded by
100
+ * `maxReplans`; on exhaustion the run ends with the last failure.
101
+ * Default off ⇒ a failure aborts exactly as today.
102
+ */
103
+ replan?: {
104
+ maxReplans: number;
105
+ };
75
106
  };
76
107
  //#endregion
77
108
  export { PlannerConfig };
@@ -1 +1 @@
1
- {"version":3,"file":"planner-config.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner-config.type.ts"],"mappings":";;;;;;;;;AAiCA;;;;;;;;;;;;;;;;;;;;;;;;;KAAY,aAAA;EAyCuB,0EAvCjC,IAAA;EAEA,OAAA;;;;;EAKA,KAAA,GAAQ,aAAA;;;;;;EAMR,OAAA,GAAU,aAAA;;;;;;EAMV,YAAA,GAAe,oBAAA;;;;;;EAMf,YAAA,EAAc,iBAAA;;;;;;;EAOd,QAAA;;;;;;;EAOA,MAAA,GAAS,gBAAA,CAAiB,OAAA;AAAA"}
1
+ {"version":3,"file":"planner-config.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/planner/planner-config.type.ts"],"mappings":";;;;;;;;;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;KAAY,aAAA;EAiDV,0EA/CA,IAAA,UA+C0B;EA7C1B,OAAA;EAyDA;;;;AASqB;;;EA1DrB,OAAA,GAAU,iBAAA;;;;;EAKV,KAAA,GAAQ,aAAA;;;;;;EAMR,OAAA,GAAU,aAAA;;;;;;EAMV,YAAA,GAAe,oBAAA;;;;;;EAMf,YAAA,EAAc,iBAAA;;;;;;;EAOd,QAAA;;;;;;;EAOA,MAAA,GAAS,gBAAA,CAAiB,OAAA;;;;;;;;;;EAU1B,GAAA;EAEA,cAAA;;;;;;;;;EASA,MAAA;IAAW,UAAA;EAAA;AAAA"}