@warlock.js/ai 4.4.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (648) hide show
  1. package/CHANGELOG.md +63 -52
  2. package/cjs/index.cjs +240 -14147
  3. package/cjs/src-Bmajk4Qg.cjs +30 -0
  4. package/cjs/src-OZyDYHxm.cjs +25089 -0
  5. package/cjs/src-OZyDYHxm.cjs.map +1 -0
  6. package/esm/agent/agent-config.type.d.mts +119 -1
  7. package/esm/agent/agent-config.type.d.mts.map +1 -1
  8. package/esm/agent/agent-input-builder.mjs +27 -6
  9. package/esm/agent/agent-input-builder.mjs.map +1 -1
  10. package/esm/agent/agent.d.mts +40 -1
  11. package/esm/agent/agent.d.mts.map +1 -1
  12. package/esm/agent/agent.mjs +328 -36
  13. package/esm/agent/agent.mjs.map +1 -1
  14. package/esm/agent/index.d.mts +2 -1
  15. package/esm/agent/index.mjs +1 -0
  16. package/esm/agent/judge-config.type.d.mts +33 -0
  17. package/esm/agent/judge-config.type.d.mts.map +1 -0
  18. package/esm/agent/judge-config.type.mjs +13 -0
  19. package/esm/agent/judge-config.type.mjs.map +1 -0
  20. package/esm/agent/signature.mjs +57 -0
  21. package/esm/agent/signature.mjs.map +1 -0
  22. package/esm/agent/snapshot.mjs +101 -0
  23. package/esm/agent/snapshot.mjs.map +1 -0
  24. package/esm/ai-openai/src/embedder.mjs +4 -0
  25. package/esm/ai-openai/src/image.mjs +5 -0
  26. package/esm/ai-openai/src/index.mjs +7 -0
  27. package/esm/ai-openai/src/model.mjs +5 -0
  28. package/esm/ai-openai/src/sdk.mjs +9 -0
  29. package/esm/ai-openai/src/speech.mjs +5 -0
  30. package/esm/ai-openai/src/transcription.mjs +6 -0
  31. package/esm/ai-openai/src/utils/index.mjs +5 -0
  32. package/esm/ai-openai/src/utils/to-openai-messages.mjs +3 -0
  33. package/esm/ai-openai/src/utils/to-openai-tools.mjs +3 -0
  34. package/esm/ai-openai/src/utils/wrap-openai-error.mjs +4 -0
  35. package/esm/ai.d.mts +164 -53
  36. package/esm/ai.d.mts.map +1 -1
  37. package/esm/ai.mjs +79 -8
  38. package/esm/ai.mjs.map +1 -1
  39. package/esm/batch/batch.d.mts.map +1 -1
  40. package/esm/batch/batch.mjs +21 -1
  41. package/esm/batch/batch.mjs.map +1 -1
  42. package/esm/batch/batch.type.d.mts +11 -4
  43. package/esm/batch/batch.type.d.mts.map +1 -1
  44. package/esm/config.d.mts +39 -3
  45. package/esm/config.d.mts.map +1 -1
  46. package/esm/config.mjs +26 -2
  47. package/esm/config.mjs.map +1 -1
  48. package/esm/contracts/agent/agent-options.type.d.mts +33 -5
  49. package/esm/contracts/agent/agent-options.type.d.mts.map +1 -1
  50. package/esm/contracts/agent/agent-snapshot.type.d.mts +90 -0
  51. package/esm/contracts/agent/agent-snapshot.type.d.mts.map +1 -0
  52. package/esm/contracts/agent/agent.contract.d.mts +29 -1
  53. package/esm/contracts/agent/agent.contract.d.mts.map +1 -1
  54. package/esm/contracts/agent/eval.type.d.mts +43 -2
  55. package/esm/contracts/agent/eval.type.d.mts.map +1 -1
  56. package/esm/contracts/agent/index.d.mts +2 -1
  57. package/esm/contracts/attachment-policy.type.d.mts +51 -0
  58. package/esm/contracts/attachment-policy.type.d.mts.map +1 -0
  59. package/esm/contracts/attachment.type.d.mts +16 -7
  60. package/esm/contracts/attachment.type.d.mts.map +1 -1
  61. package/esm/contracts/content-part.type.d.mts +14 -5
  62. package/esm/contracts/content-part.type.d.mts.map +1 -1
  63. package/esm/contracts/events/supervisor-events.type.d.mts.map +1 -1
  64. package/esm/contracts/image-model.contract.d.mts +156 -0
  65. package/esm/contracts/image-model.contract.d.mts.map +1 -0
  66. package/esm/contracts/index.d.mts +13 -6
  67. package/esm/contracts/model.contract.d.mts +11 -8
  68. package/esm/contracts/model.contract.d.mts.map +1 -1
  69. package/esm/contracts/orchestrator/index.d.mts +1 -0
  70. package/esm/contracts/orchestrator/orchestrator-config.type.d.mts +31 -2
  71. package/esm/contracts/orchestrator/orchestrator-config.type.d.mts.map +1 -1
  72. package/esm/contracts/orchestrator/session-lock.contract.d.mts +47 -0
  73. package/esm/contracts/orchestrator/session-lock.contract.d.mts.map +1 -0
  74. package/esm/contracts/planner/index.d.mts +3 -2
  75. package/esm/contracts/planner/planner-config.type.d.mts +61 -0
  76. package/esm/contracts/planner/planner-config.type.d.mts.map +1 -1
  77. package/esm/contracts/planner/planner-execute-options.type.d.mts +60 -1
  78. package/esm/contracts/planner/planner-execute-options.type.d.mts.map +1 -1
  79. package/esm/contracts/planner/planner-result.type.d.mts +8 -0
  80. package/esm/contracts/planner/planner-result.type.d.mts.map +1 -1
  81. package/esm/contracts/planner/planner-snapshot.type.d.mts +77 -0
  82. package/esm/contracts/planner/planner-snapshot.type.d.mts.map +1 -0
  83. package/esm/contracts/planner/planner.contract.d.mts +21 -1
  84. package/esm/contracts/planner/planner.contract.d.mts.map +1 -1
  85. package/esm/contracts/result/agent-result.type.d.mts +6 -4
  86. package/esm/contracts/result/agent-result.type.d.mts.map +1 -1
  87. package/esm/contracts/result/base-report.type.d.mts +21 -3
  88. package/esm/contracts/result/base-report.type.d.mts.map +1 -1
  89. package/esm/contracts/result/base-report.type.mjs.map +1 -1
  90. package/esm/contracts/result/execution-report.type.d.mts +53 -1
  91. package/esm/contracts/result/execution-report.type.d.mts.map +1 -1
  92. package/esm/contracts/result/supervisor-result.type.d.mts +14 -2
  93. package/esm/contracts/result/supervisor-result.type.d.mts.map +1 -1
  94. package/esm/contracts/result/workflow-result.type.d.mts +2 -1
  95. package/esm/contracts/result/workflow-result.type.d.mts.map +1 -1
  96. package/esm/contracts/sdk-adapter.contract.d.mts +37 -0
  97. package/esm/contracts/sdk-adapter.contract.d.mts.map +1 -1
  98. package/esm/contracts/speech-model.contract.d.mts +97 -0
  99. package/esm/contracts/speech-model.contract.d.mts.map +1 -0
  100. package/esm/contracts/supervisor/supervisor-config.type.d.mts +29 -0
  101. package/esm/contracts/supervisor/supervisor-config.type.d.mts.map +1 -1
  102. package/esm/contracts/system-prompt.contract.d.mts +103 -1
  103. package/esm/contracts/system-prompt.contract.d.mts.map +1 -1
  104. package/esm/contracts/team/index.d.mts +1 -0
  105. package/esm/contracts/team/team-config.type.d.mts +127 -0
  106. package/esm/contracts/team/team-config.type.d.mts.map +1 -0
  107. package/esm/contracts/tool.contract.d.mts +4 -2
  108. package/esm/contracts/tool.contract.d.mts.map +1 -1
  109. package/esm/contracts/transcription-model.contract.d.mts +101 -0
  110. package/esm/contracts/transcription-model.contract.d.mts.map +1 -0
  111. package/esm/contracts/workflow/step.contract.d.mts +30 -5
  112. package/esm/contracts/workflow/step.contract.d.mts.map +1 -1
  113. package/esm/contracts/workflow/workflow.contract.d.mts +16 -0
  114. package/esm/contracts/workflow/workflow.contract.d.mts.map +1 -1
  115. package/esm/errors/agent-drift-error.d.mts +32 -0
  116. package/esm/errors/agent-drift-error.d.mts.map +1 -0
  117. package/esm/errors/agent-drift-error.mjs +31 -0
  118. package/esm/errors/agent-drift-error.mjs.map +1 -0
  119. package/esm/errors/error-code.type.d.mts +1 -1
  120. package/esm/errors/index.d.mts +3 -0
  121. package/esm/errors/index.mjs +3 -0
  122. package/esm/errors/outbound-policy-error.d.mts +27 -0
  123. package/esm/errors/outbound-policy-error.d.mts.map +1 -0
  124. package/esm/errors/outbound-policy-error.mjs +32 -0
  125. package/esm/errors/outbound-policy-error.mjs.map +1 -0
  126. package/esm/errors/planner-drift-error.d.mts +34 -0
  127. package/esm/errors/planner-drift-error.d.mts.map +1 -0
  128. package/esm/errors/planner-drift-error.mjs +33 -0
  129. package/esm/errors/planner-drift-error.mjs.map +1 -0
  130. package/esm/eval/dataset.d.mts +28 -0
  131. package/esm/eval/dataset.d.mts.map +1 -0
  132. package/esm/eval/dataset.mjs +112 -0
  133. package/esm/eval/dataset.mjs.map +1 -0
  134. package/esm/eval/dataset.type.d.mts +53 -0
  135. package/esm/eval/dataset.type.d.mts.map +1 -0
  136. package/esm/eval/eval-runner.d.mts.map +1 -1
  137. package/esm/eval/eval-runner.mjs +16 -2
  138. package/esm/eval/eval-runner.mjs.map +1 -1
  139. package/esm/eval/index.d.mts +20 -1
  140. package/esm/eval/index.d.mts.map +1 -1
  141. package/esm/eval/index.mjs +20 -2
  142. package/esm/eval/index.mjs.map +1 -1
  143. package/esm/eval/regression.d.mts +30 -0
  144. package/esm/eval/regression.d.mts.map +1 -0
  145. package/esm/eval/regression.mjs +51 -0
  146. package/esm/eval/regression.mjs.map +1 -0
  147. package/esm/eval/report-json.d.mts +30 -0
  148. package/esm/eval/report-json.d.mts.map +1 -0
  149. package/esm/eval/report-json.mjs +33 -0
  150. package/esm/eval/report-json.mjs.map +1 -0
  151. package/esm/eval/report-junit.d.mts +22 -0
  152. package/esm/eval/report-junit.d.mts.map +1 -0
  153. package/esm/eval/report-junit.mjs +60 -0
  154. package/esm/eval/report-junit.mjs.map +1 -0
  155. package/esm/guard/contracts/guard-options.type.d.mts +165 -0
  156. package/esm/guard/contracts/guard-options.type.d.mts.map +1 -0
  157. package/esm/guard/contracts/guardrail.contract.d.mts +78 -0
  158. package/esm/guard/contracts/guardrail.contract.d.mts.map +1 -0
  159. package/esm/guard/contracts/index.d.mts +4 -0
  160. package/esm/guard/contracts/openai-client.contract.d.mts +51 -0
  161. package/esm/guard/contracts/openai-client.contract.d.mts.map +1 -0
  162. package/esm/guard/contracts/verdict.type.d.mts +76 -0
  163. package/esm/guard/contracts/verdict.type.d.mts.map +1 -0
  164. package/esm/guard/detectors/index.d.mts +4 -0
  165. package/esm/guard/detectors/index.mjs +6 -0
  166. package/esm/guard/detectors/injection.d.mts +34 -0
  167. package/esm/guard/detectors/injection.d.mts.map +1 -0
  168. package/esm/guard/detectors/injection.mjs +254 -0
  169. package/esm/guard/detectors/injection.mjs.map +1 -0
  170. package/esm/guard/detectors/moderation.d.mts +32 -0
  171. package/esm/guard/detectors/moderation.d.mts.map +1 -0
  172. package/esm/guard/detectors/moderation.mjs +134 -0
  173. package/esm/guard/detectors/moderation.mjs.map +1 -0
  174. package/esm/guard/detectors/pii.d.mts +41 -0
  175. package/esm/guard/detectors/pii.d.mts.map +1 -0
  176. package/esm/guard/detectors/pii.mjs +199 -0
  177. package/esm/guard/detectors/pii.mjs.map +1 -0
  178. package/esm/guard/detectors/topic.d.mts +29 -0
  179. package/esm/guard/detectors/topic.d.mts.map +1 -0
  180. package/esm/guard/detectors/topic.mjs +99 -0
  181. package/esm/guard/detectors/topic.mjs.map +1 -0
  182. package/esm/guard/errors.d.mts +12 -0
  183. package/esm/guard/errors.d.mts.map +1 -0
  184. package/esm/guard/errors.mjs +18 -0
  185. package/esm/guard/errors.mjs.map +1 -0
  186. package/esm/guard/guard.d.mts +67 -0
  187. package/esm/guard/guard.d.mts.map +1 -0
  188. package/esm/guard/guard.mjs +209 -0
  189. package/esm/guard/guard.mjs.map +1 -0
  190. package/esm/guard/guardrail.d.mts +39 -0
  191. package/esm/guard/guardrail.d.mts.map +1 -0
  192. package/esm/guard/guardrail.mjs +22 -0
  193. package/esm/guard/guardrail.mjs.map +1 -0
  194. package/esm/human/contracts/approval.type.d.mts +154 -0
  195. package/esm/human/contracts/approval.type.d.mts.map +1 -0
  196. package/esm/human/contracts/human-approval.type.d.mts +38 -0
  197. package/esm/human/contracts/human-approval.type.d.mts.map +1 -0
  198. package/esm/human/contracts/index.d.mts +4 -0
  199. package/esm/human/contracts/interrupt-store.contract.d.mts +112 -0
  200. package/esm/human/contracts/interrupt-store.contract.d.mts.map +1 -0
  201. package/esm/human/contracts/resume.type.d.mts +77 -0
  202. package/esm/human/contracts/resume.type.d.mts.map +1 -0
  203. package/esm/human/errors.d.mts +84 -0
  204. package/esm/human/errors.d.mts.map +1 -0
  205. package/esm/human/errors.mjs +60 -0
  206. package/esm/human/errors.mjs.map +1 -0
  207. package/esm/human/human-approval.d.mts +57 -0
  208. package/esm/human/human-approval.d.mts.map +1 -0
  209. package/esm/human/human-approval.mjs +170 -0
  210. package/esm/human/human-approval.mjs.map +1 -0
  211. package/esm/human/policy.d.mts +55 -0
  212. package/esm/human/policy.d.mts.map +1 -0
  213. package/esm/human/policy.mjs +67 -0
  214. package/esm/human/policy.mjs.map +1 -0
  215. package/esm/human/register.mjs +37 -0
  216. package/esm/human/register.mjs.map +1 -0
  217. package/esm/human/resume-seed.mjs +53 -0
  218. package/esm/human/resume-seed.mjs.map +1 -0
  219. package/esm/human/resume.d.mts +54 -0
  220. package/esm/human/resume.d.mts.map +1 -0
  221. package/esm/human/resume.mjs +121 -0
  222. package/esm/human/resume.mjs.map +1 -0
  223. package/esm/human/stores/index.mjs +5 -0
  224. package/esm/human/stores/memory.d.mts +30 -0
  225. package/esm/human/stores/memory.d.mts.map +1 -0
  226. package/esm/human/stores/memory.mjs +91 -0
  227. package/esm/human/stores/memory.mjs.map +1 -0
  228. package/esm/human/stores/pg.d.mts +59 -0
  229. package/esm/human/stores/pg.d.mts.map +1 -0
  230. package/esm/human/stores/pg.mjs +220 -0
  231. package/esm/human/stores/pg.mjs.map +1 -0
  232. package/esm/human/stores/redis.d.mts +56 -0
  233. package/esm/human/stores/redis.d.mts.map +1 -0
  234. package/esm/human/stores/redis.mjs +201 -0
  235. package/esm/human/stores/redis.mjs.map +1 -0
  236. package/esm/image/image-cost.d.mts +32 -0
  237. package/esm/image/image-cost.d.mts.map +1 -0
  238. package/esm/image/image-cost.mjs +55 -0
  239. package/esm/image/image-cost.mjs.map +1 -0
  240. package/esm/image/image.d.mts +92 -0
  241. package/esm/image/image.d.mts.map +1 -0
  242. package/esm/image/image.mjs +113 -0
  243. package/esm/image/image.mjs.map +1 -0
  244. package/esm/image/index.mjs +4 -0
  245. package/esm/index.d.mts +137 -24
  246. package/esm/index.mjs +101 -11
  247. package/esm/middleware/builtins/budget.mjs +6 -2
  248. package/esm/middleware/builtins/budget.mjs.map +1 -1
  249. package/esm/middleware/utils/extract-user-text.d.mts +8 -1
  250. package/esm/middleware/utils/extract-user-text.d.mts.map +1 -1
  251. package/esm/middleware/utils/extract-user-text.mjs +8 -1
  252. package/esm/middleware/utils/extract-user-text.mjs.map +1 -1
  253. package/esm/mock/index.d.mts +3 -0
  254. package/esm/mock/index.mjs +3 -0
  255. package/esm/mock/mock-config.type.d.mts +22 -0
  256. package/esm/mock/mock-config.type.d.mts.map +1 -1
  257. package/esm/mock/mock-image-model.d.mts +41 -0
  258. package/esm/mock/mock-image-model.d.mts.map +1 -0
  259. package/esm/mock/mock-image-model.mjs +52 -0
  260. package/esm/mock/mock-image-model.mjs.map +1 -0
  261. package/esm/mock/mock-sdk.d.mts +7 -1
  262. package/esm/mock/mock-sdk.d.mts.map +1 -1
  263. package/esm/mock/mock-sdk.mjs +27 -0
  264. package/esm/mock/mock-sdk.mjs.map +1 -1
  265. package/esm/mock/mock-speech-model.d.mts +31 -0
  266. package/esm/mock/mock-speech-model.d.mts.map +1 -0
  267. package/esm/mock/mock-speech-model.mjs +39 -0
  268. package/esm/mock/mock-speech-model.mjs.map +1 -0
  269. package/esm/mock/mock-transcription-model.d.mts +32 -0
  270. package/esm/mock/mock-transcription-model.d.mts.map +1 -0
  271. package/esm/mock/mock-transcription-model.mjs +36 -0
  272. package/esm/mock/mock-transcription-model.mjs.map +1 -0
  273. package/esm/object-stream/index.d.mts +2 -0
  274. package/esm/object-stream/index.mjs +4 -0
  275. package/esm/object-stream/parse-partial-json.d.mts +22 -0
  276. package/esm/object-stream/parse-partial-json.d.mts.map +1 -0
  277. package/esm/object-stream/parse-partial-json.mjs +78 -0
  278. package/esm/object-stream/parse-partial-json.mjs.map +1 -0
  279. package/esm/object-stream/stream-object.d.mts +68 -0
  280. package/esm/object-stream/stream-object.d.mts.map +1 -0
  281. package/esm/object-stream/stream-object.mjs +104 -0
  282. package/esm/object-stream/stream-object.mjs.map +1 -0
  283. package/esm/observe/index.mjs +4 -0
  284. package/esm/observe/observer-registry.d.mts +30 -0
  285. package/esm/observe/observer-registry.d.mts.map +1 -0
  286. package/esm/observe/observer-registry.mjs +51 -0
  287. package/esm/observe/observer-registry.mjs.map +1 -0
  288. package/esm/observe/observer.contract.d.mts +40 -0
  289. package/esm/observe/observer.contract.d.mts.map +1 -0
  290. package/esm/observe/resolve-observers.d.mts +40 -0
  291. package/esm/observe/resolve-observers.d.mts.map +1 -0
  292. package/esm/observe/resolve-observers.mjs +73 -0
  293. package/esm/observe/resolve-observers.mjs.map +1 -0
  294. package/esm/orchestrator/execution.d.mts.map +1 -1
  295. package/esm/orchestrator/execution.mjs +5 -2
  296. package/esm/orchestrator/execution.mjs.map +1 -1
  297. package/esm/orchestrator/index.d.mts +1 -0
  298. package/esm/orchestrator/index.mjs +1 -0
  299. package/esm/orchestrator/orchestrator.d.mts.map +1 -1
  300. package/esm/orchestrator/orchestrator.mjs +39 -6
  301. package/esm/orchestrator/orchestrator.mjs.map +1 -1
  302. package/esm/orchestrator/session-lock.d.mts +25 -0
  303. package/esm/orchestrator/session-lock.d.mts.map +1 -0
  304. package/esm/orchestrator/session-lock.mjs +83 -0
  305. package/esm/orchestrator/session-lock.mjs.map +1 -0
  306. package/esm/planner/dag-scheduler.mjs +97 -0
  307. package/esm/planner/dag-scheduler.mjs.map +1 -0
  308. package/esm/planner/plan-prompt.d.mts +1 -1
  309. package/esm/planner/plan-prompt.d.mts.map +1 -1
  310. package/esm/planner/plan-prompt.mjs +2 -1
  311. package/esm/planner/plan-prompt.mjs.map +1 -1
  312. package/esm/planner/planner-run.d.mts +8 -0
  313. package/esm/planner/planner-run.d.mts.map +1 -1
  314. package/esm/planner/planner-run.mjs +457 -31
  315. package/esm/planner/planner-run.mjs.map +1 -1
  316. package/esm/planner/planner.d.mts.map +1 -1
  317. package/esm/planner/planner.mjs +26 -2
  318. package/esm/planner/planner.mjs.map +1 -1
  319. package/esm/planner/snapshot.mjs +95 -0
  320. package/esm/planner/snapshot.mjs.map +1 -0
  321. package/esm/prompt/errors.d.mts +57 -0
  322. package/esm/prompt/errors.d.mts.map +1 -0
  323. package/esm/prompt/errors.mjs +73 -0
  324. package/esm/prompt/errors.mjs.map +1 -0
  325. package/esm/prompt/index.d.mts +3 -0
  326. package/esm/prompt/index.mjs +4 -0
  327. package/esm/prompt/prompt-langfuse-sync.mjs +104 -0
  328. package/esm/prompt/prompt-langfuse-sync.mjs.map +1 -0
  329. package/esm/prompt/prompt-langfuse-sync.type.d.mts +32 -0
  330. package/esm/prompt/prompt-langfuse-sync.type.d.mts.map +1 -0
  331. package/esm/prompt/prompt-validate.mjs +170 -0
  332. package/esm/prompt/prompt-validate.mjs.map +1 -0
  333. package/esm/prompt/prompt.d.mts +54 -0
  334. package/esm/prompt/prompt.d.mts.map +1 -0
  335. package/esm/prompt/prompt.mjs +218 -0
  336. package/esm/prompt/prompt.mjs.map +1 -0
  337. package/esm/prompt/prompt.type.d.mts +174 -0
  338. package/esm/prompt/prompt.type.d.mts.map +1 -0
  339. package/esm/prompts/index.d.mts +3 -0
  340. package/esm/prompts/index.mjs +3 -0
  341. package/esm/prompts/prompts-manager.contract.d.mts +154 -0
  342. package/esm/prompts/prompts-manager.contract.d.mts.map +1 -0
  343. package/esm/prompts/prompts-manager.d.mts +38 -0
  344. package/esm/prompts/prompts-manager.d.mts.map +1 -0
  345. package/esm/prompts/prompts-manager.mjs +410 -0
  346. package/esm/prompts/prompts-manager.mjs.map +1 -0
  347. package/esm/prompts/prompts-manager.type.d.mts +172 -0
  348. package/esm/prompts/prompts-manager.type.d.mts.map +1 -0
  349. package/esm/prompts/prompts-validate.mjs +200 -0
  350. package/esm/prompts/prompts-validate.mjs.map +1 -0
  351. package/esm/rag/as-tool.mjs +48 -0
  352. package/esm/rag/as-tool.mjs.map +1 -0
  353. package/esm/rag/chunk/chunk.d.mts +24 -0
  354. package/esm/rag/chunk/chunk.d.mts.map +1 -0
  355. package/esm/rag/chunk/chunk.mjs +44 -0
  356. package/esm/rag/chunk/chunk.mjs.map +1 -0
  357. package/esm/rag/chunk/fixed.mjs +32 -0
  358. package/esm/rag/chunk/fixed.mjs.map +1 -0
  359. package/esm/rag/chunk/markdown.mjs +75 -0
  360. package/esm/rag/chunk/markdown.mjs.map +1 -0
  361. package/esm/rag/chunk/recursive.mjs +132 -0
  362. package/esm/rag/chunk/recursive.mjs.map +1 -0
  363. package/esm/rag/chunk/sentence.mjs +73 -0
  364. package/esm/rag/chunk/sentence.mjs.map +1 -0
  365. package/esm/rag/contracts/chunk-options.type.d.mts +35 -0
  366. package/esm/rag/contracts/chunk-options.type.d.mts.map +1 -0
  367. package/esm/rag/contracts/citation.type.d.mts +35 -0
  368. package/esm/rag/contracts/citation.type.d.mts.map +1 -0
  369. package/esm/rag/contracts/index.d.mts +4 -0
  370. package/esm/rag/contracts/rag-config.type.d.mts +68 -0
  371. package/esm/rag/contracts/rag-config.type.d.mts.map +1 -0
  372. package/esm/rag/contracts/rag-document.type.d.mts +21 -0
  373. package/esm/rag/contracts/rag-document.type.d.mts.map +1 -0
  374. package/esm/rag/hybrid/bm25.d.mts +23 -0
  375. package/esm/rag/hybrid/bm25.d.mts.map +1 -0
  376. package/esm/rag/hybrid/bm25.mjs +51 -0
  377. package/esm/rag/hybrid/bm25.mjs.map +1 -0
  378. package/esm/rag/hybrid/hybrid-rank.d.mts +33 -0
  379. package/esm/rag/hybrid/hybrid-rank.d.mts.map +1 -0
  380. package/esm/rag/hybrid/hybrid-rank.mjs +29 -0
  381. package/esm/rag/hybrid/hybrid-rank.mjs.map +1 -0
  382. package/esm/rag/hybrid/rrf.d.mts +25 -0
  383. package/esm/rag/hybrid/rrf.d.mts.map +1 -0
  384. package/esm/rag/hybrid/rrf.mjs +30 -0
  385. package/esm/rag/hybrid/rrf.mjs.map +1 -0
  386. package/esm/rag/index.d.mts +22 -0
  387. package/esm/rag/index.mjs +18 -0
  388. package/esm/rag/loaders/errors.d.mts +19 -0
  389. package/esm/rag/loaders/errors.d.mts.map +1 -0
  390. package/esm/rag/loaders/errors.mjs +25 -0
  391. package/esm/rag/loaders/errors.mjs.map +1 -0
  392. package/esm/rag/loaders/index.mjs +7 -0
  393. package/esm/rag/loaders/load-html.d.mts +26 -0
  394. package/esm/rag/loaders/load-html.d.mts.map +1 -0
  395. package/esm/rag/loaders/load-html.mjs +138 -0
  396. package/esm/rag/loaders/load-html.mjs.map +1 -0
  397. package/esm/rag/loaders/load-pdf.d.mts +38 -0
  398. package/esm/rag/loaders/load-pdf.d.mts.map +1 -0
  399. package/esm/rag/loaders/load-pdf.mjs +150 -0
  400. package/esm/rag/loaders/load-pdf.mjs.map +1 -0
  401. package/esm/rag/loaders/load-text.d.mts +47 -0
  402. package/esm/rag/loaders/load-text.d.mts.map +1 -0
  403. package/esm/rag/loaders/load-text.mjs +60 -0
  404. package/esm/rag/loaders/load-text.mjs.map +1 -0
  405. package/esm/rag/loaders/load-web.d.mts +42 -0
  406. package/esm/rag/loaders/load-web.d.mts.map +1 -0
  407. package/esm/rag/loaders/load-web.mjs +89 -0
  408. package/esm/rag/loaders/load-web.mjs.map +1 -0
  409. package/esm/rag/loaders/loader.type.d.mts +89 -0
  410. package/esm/rag/loaders/loader.type.d.mts.map +1 -0
  411. package/esm/rag/rag.d.mts +38 -0
  412. package/esm/rag/rag.d.mts.map +1 -0
  413. package/esm/rag/rag.mjs +126 -0
  414. package/esm/rag/rag.mjs.map +1 -0
  415. package/esm/rag/rerank/keyword-reranker.d.mts +32 -0
  416. package/esm/rag/rerank/keyword-reranker.d.mts.map +1 -0
  417. package/esm/rag/rerank/keyword-reranker.mjs +58 -0
  418. package/esm/rag/rerank/keyword-reranker.mjs.map +1 -0
  419. package/esm/rag/rerank/llm-reranker.d.mts +36 -0
  420. package/esm/rag/rerank/llm-reranker.d.mts.map +1 -0
  421. package/esm/rag/rerank/llm-reranker.mjs +85 -0
  422. package/esm/rag/rerank/llm-reranker.mjs.map +1 -0
  423. package/esm/rag/rerank/reranker.contract.d.mts +28 -0
  424. package/esm/rag/rerank/reranker.contract.d.mts.map +1 -0
  425. package/esm/rag/retrieve.mjs +68 -0
  426. package/esm/rag/retrieve.mjs.map +1 -0
  427. package/esm/rag/store/cache-vector-store.d.mts +27 -0
  428. package/esm/rag/store/cache-vector-store.d.mts.map +1 -0
  429. package/esm/rag/store/cache-vector-store.mjs +48 -0
  430. package/esm/rag/store/cache-vector-store.mjs.map +1 -0
  431. package/esm/rag/store/pg-vector-store.d.mts +139 -0
  432. package/esm/rag/store/pg-vector-store.d.mts.map +1 -0
  433. package/esm/rag/store/pg-vector-store.mjs +328 -0
  434. package/esm/rag/store/pg-vector-store.mjs.map +1 -0
  435. package/esm/rag/store/vector-store.contract.d.mts +38 -0
  436. package/esm/rag/store/vector-store.contract.d.mts.map +1 -0
  437. package/esm/rag/transforms/multi-query.d.mts +27 -0
  438. package/esm/rag/transforms/multi-query.d.mts.map +1 -0
  439. package/esm/rag/transforms/multi-query.mjs +41 -0
  440. package/esm/rag/transforms/multi-query.mjs.map +1 -0
  441. package/esm/security/index.mjs +5 -0
  442. package/esm/security/outbound-policy.d.mts +46 -0
  443. package/esm/security/outbound-policy.d.mts.map +1 -0
  444. package/esm/security/outbound-policy.mjs +187 -0
  445. package/esm/security/outbound-policy.mjs.map +1 -0
  446. package/esm/security/outbound-policy.type.d.mts +74 -0
  447. package/esm/security/outbound-policy.type.d.mts.map +1 -0
  448. package/esm/security/private-ip.d.mts +15 -0
  449. package/esm/security/private-ip.d.mts.map +1 -0
  450. package/esm/security/private-ip.mjs +48 -0
  451. package/esm/security/private-ip.mjs.map +1 -0
  452. package/esm/security/redact.d.mts +59 -0
  453. package/esm/security/redact.d.mts.map +1 -0
  454. package/esm/security/redact.mjs +122 -0
  455. package/esm/security/redact.mjs.map +1 -0
  456. package/esm/serve/serve.d.mts +50 -0
  457. package/esm/serve/serve.d.mts.map +1 -0
  458. package/esm/serve/serve.mjs +90 -0
  459. package/esm/serve/serve.mjs.map +1 -0
  460. package/esm/serve/sse.d.mts +20 -0
  461. package/esm/serve/sse.d.mts.map +1 -0
  462. package/esm/serve/sse.mjs +25 -0
  463. package/esm/serve/sse.mjs.map +1 -0
  464. package/esm/serve/stream-to-sse.d.mts +29 -0
  465. package/esm/serve/stream-to-sse.d.mts.map +1 -0
  466. package/esm/serve/stream-to-sse.mjs +37 -0
  467. package/esm/serve/stream-to-sse.mjs.map +1 -0
  468. package/esm/skills/catalog.d.mts +49 -0
  469. package/esm/skills/catalog.d.mts.map +1 -0
  470. package/esm/skills/catalog.mjs +140 -0
  471. package/esm/skills/catalog.mjs.map +1 -0
  472. package/esm/skills/contracts/skill-record.type.d.mts +37 -0
  473. package/esm/skills/contracts/skill-record.type.d.mts.map +1 -0
  474. package/esm/skills/contracts/skills-config.type.d.mts +108 -0
  475. package/esm/skills/contracts/skills-config.type.d.mts.map +1 -0
  476. package/esm/skills/contracts/skills-store.contract.d.mts +28 -0
  477. package/esm/skills/contracts/skills-store.contract.d.mts.map +1 -0
  478. package/esm/skills/contracts/skills.contract.d.mts +43 -0
  479. package/esm/skills/contracts/skills.contract.d.mts.map +1 -0
  480. package/esm/skills/index.d.mts +16 -0
  481. package/esm/skills/index.mjs +14 -0
  482. package/esm/skills/load-skill-tool.d.mts +38 -0
  483. package/esm/skills/load-skill-tool.d.mts.map +1 -0
  484. package/esm/skills/load-skill-tool.mjs +65 -0
  485. package/esm/skills/load-skill-tool.mjs.map +1 -0
  486. package/esm/skills/review-gate.d.mts +33 -0
  487. package/esm/skills/review-gate.d.mts.map +1 -0
  488. package/esm/skills/review-gate.mjs +60 -0
  489. package/esm/skills/review-gate.mjs.map +1 -0
  490. package/esm/skills/save-skill-tool.d.mts +39 -0
  491. package/esm/skills/save-skill-tool.d.mts.map +1 -0
  492. package/esm/skills/save-skill-tool.mjs +65 -0
  493. package/esm/skills/save-skill-tool.mjs.map +1 -0
  494. package/esm/skills/skills.d.mts +33 -0
  495. package/esm/skills/skills.d.mts.map +1 -0
  496. package/esm/skills/skills.mjs +109 -0
  497. package/esm/skills/skills.mjs.map +1 -0
  498. package/esm/skills/sources/directory-source.d.mts +19 -0
  499. package/esm/skills/sources/directory-source.d.mts.map +1 -0
  500. package/esm/skills/sources/directory-source.mjs +108 -0
  501. package/esm/skills/sources/directory-source.mjs.map +1 -0
  502. package/esm/skills/sources/index.d.mts +18 -0
  503. package/esm/skills/sources/index.d.mts.map +1 -0
  504. package/esm/skills/sources/index.mjs +27 -0
  505. package/esm/skills/sources/index.mjs.map +1 -0
  506. package/esm/skills/sources/parse-frontmatter.d.mts +27 -0
  507. package/esm/skills/sources/parse-frontmatter.d.mts.map +1 -0
  508. package/esm/skills/sources/parse-frontmatter.mjs +46 -0
  509. package/esm/skills/sources/parse-frontmatter.mjs.map +1 -0
  510. package/esm/skills/sources/store-source.d.mts +14 -0
  511. package/esm/skills/sources/store-source.d.mts.map +1 -0
  512. package/esm/skills/sources/store-source.mjs +15 -0
  513. package/esm/skills/sources/store-source.mjs.map +1 -0
  514. package/esm/skills/sources/url-source.d.mts +29 -0
  515. package/esm/skills/sources/url-source.d.mts.map +1 -0
  516. package/esm/skills/sources/url-source.mjs +117 -0
  517. package/esm/skills/sources/url-source.mjs.map +1 -0
  518. package/esm/skills/store/mock-skills-store.d.mts +57 -0
  519. package/esm/skills/store/mock-skills-store.d.mts.map +1 -0
  520. package/esm/skills/store/mock-skills-store.mjs +100 -0
  521. package/esm/skills/store/mock-skills-store.mjs.map +1 -0
  522. package/esm/skills/store/procedural-skill-store.d.mts +30 -0
  523. package/esm/skills/store/procedural-skill-store.d.mts.map +1 -0
  524. package/esm/skills/store/procedural-skill-store.mjs +125 -0
  525. package/esm/skills/store/procedural-skill-store.mjs.map +1 -0
  526. package/esm/speech/index.mjs +3 -0
  527. package/esm/speech/speech.d.mts +65 -0
  528. package/esm/speech/speech.d.mts.map +1 -0
  529. package/esm/speech/speech.mjs +123 -0
  530. package/esm/speech/speech.mjs.map +1 -0
  531. package/esm/supervisor/as-tool.mjs +2 -2
  532. package/esm/supervisor/as-tool.mjs.map +1 -1
  533. package/esm/supervisor/entries.mjs +2 -2
  534. package/esm/supervisor/entries.mjs.map +1 -1
  535. package/esm/supervisor/execution.d.mts.map +1 -1
  536. package/esm/supervisor/execution.mjs +31 -28
  537. package/esm/supervisor/execution.mjs.map +1 -1
  538. package/esm/supervisor/supervisor.d.mts.map +1 -1
  539. package/esm/supervisor/supervisor.mjs +8 -3
  540. package/esm/supervisor/supervisor.mjs.map +1 -1
  541. package/esm/system-prompt/index.d.mts +4 -0
  542. package/esm/system-prompt/system-prompt.d.mts +68 -4
  543. package/esm/system-prompt/system-prompt.d.mts.map +1 -1
  544. package/esm/system-prompt/system-prompt.mjs +89 -5
  545. package/esm/system-prompt/system-prompt.mjs.map +1 -1
  546. package/esm/team/gates.mjs +48 -0
  547. package/esm/team/gates.mjs.map +1 -0
  548. package/esm/team/index.d.mts +1 -0
  549. package/esm/team/index.mjs +3 -0
  550. package/esm/team/team.d.mts +42 -0
  551. package/esm/team/team.d.mts.map +1 -0
  552. package/esm/team/team.mjs +94 -0
  553. package/esm/team/team.mjs.map +1 -0
  554. package/esm/tool/executable-as-tool.d.mts.map +1 -1
  555. package/esm/tool/executable-as-tool.mjs +2 -2
  556. package/esm/tool/executable-as-tool.mjs.map +1 -1
  557. package/esm/tool/tool.d.mts.map +1 -1
  558. package/esm/tool/tool.mjs +2 -2
  559. package/esm/tool/tool.mjs.map +1 -1
  560. package/esm/transcribe/audio-input.d.mts +47 -0
  561. package/esm/transcribe/audio-input.d.mts.map +1 -0
  562. package/esm/transcribe/audio-input.mjs +84 -0
  563. package/esm/transcribe/audio-input.mjs.map +1 -0
  564. package/esm/transcribe/index.mjs +4 -0
  565. package/esm/transcribe/transcribe.d.mts +64 -0
  566. package/esm/transcribe/transcribe.d.mts.map +1 -0
  567. package/esm/transcribe/transcribe.mjs +128 -0
  568. package/esm/transcribe/transcribe.mjs.map +1 -0
  569. package/esm/utils/compute-cost.d.mts +17 -1
  570. package/esm/utils/compute-cost.d.mts.map +1 -1
  571. package/esm/utils/compute-cost.mjs +26 -1
  572. package/esm/utils/compute-cost.mjs.map +1 -1
  573. package/esm/utils/extract-json-lenient.d.mts +42 -0
  574. package/esm/utils/extract-json-lenient.d.mts.map +1 -0
  575. package/esm/utils/extract-json-lenient.mjs +97 -0
  576. package/esm/utils/extract-json-lenient.mjs.map +1 -0
  577. package/esm/utils/index.d.mts +4 -2
  578. package/esm/utils/index.mjs +3 -1
  579. package/esm/utils/json-schema.d.mts +1 -1
  580. package/esm/utils/prepare-attachment-part.d.mts +10 -1
  581. package/esm/utils/prepare-attachment-part.d.mts.map +1 -1
  582. package/esm/utils/prepare-attachment-part.mjs +103 -11
  583. package/esm/utils/prepare-attachment-part.mjs.map +1 -1
  584. package/esm/utils/resolve-attachment.d.mts +4 -3
  585. package/esm/utils/resolve-attachment.d.mts.map +1 -1
  586. package/esm/utils/resolve-attachment.mjs +4 -3
  587. package/esm/utils/resolve-attachment.mjs.map +1 -1
  588. package/esm/utils/run-context.d.mts +94 -0
  589. package/esm/utils/run-context.d.mts.map +1 -0
  590. package/esm/utils/run-context.mjs +98 -0
  591. package/esm/utils/run-context.mjs.map +1 -0
  592. package/esm/vcr/cassette-io.mjs +57 -0
  593. package/esm/vcr/cassette-io.mjs.map +1 -0
  594. package/esm/vcr/errors.d.mts +42 -0
  595. package/esm/vcr/errors.d.mts.map +1 -0
  596. package/esm/vcr/errors.mjs +37 -0
  597. package/esm/vcr/errors.mjs.map +1 -0
  598. package/esm/vcr/hash-request.d.mts +28 -0
  599. package/esm/vcr/hash-request.d.mts.map +1 -0
  600. package/esm/vcr/hash-request.mjs +118 -0
  601. package/esm/vcr/hash-request.mjs.map +1 -0
  602. package/esm/vcr/index.d.mts +4 -0
  603. package/esm/vcr/index.mjs +5 -0
  604. package/esm/vcr/vcr.d.mts +32 -0
  605. package/esm/vcr/vcr.d.mts.map +1 -0
  606. package/esm/vcr/vcr.mjs +248 -0
  607. package/esm/vcr/vcr.mjs.map +1 -0
  608. package/esm/vcr/vcr.type.d.mts +118 -0
  609. package/esm/vcr/vcr.type.d.mts.map +1 -0
  610. package/esm/workflow/as-tool.mjs +2 -2
  611. package/esm/workflow/as-tool.mjs.map +1 -1
  612. package/esm/workflow/engine.mjs +1 -0
  613. package/esm/workflow/engine.mjs.map +1 -1
  614. package/esm/workflow/step-runner.mjs +19 -20
  615. package/esm/workflow/step-runner.mjs.map +1 -1
  616. package/esm/workflow/workflow.d.mts.map +1 -1
  617. package/esm/workflow/workflow.mjs +8 -3
  618. package/esm/workflow/workflow.mjs.map +1 -1
  619. package/llms-full.txt +2572 -204
  620. package/llms.txt +21 -4
  621. package/package.json +7 -3
  622. package/skills/README.md +44 -4
  623. package/skills/ai-dx-helpers/SKILL.md +2 -2
  624. package/skills/approve-tool-calls/SKILL.md +134 -0
  625. package/skills/attach-ai-middleware/SKILL.md +1 -1
  626. package/skills/detect-and-redact-pii/SKILL.md +104 -0
  627. package/skills/durable-agent-runs/SKILL.md +135 -0
  628. package/skills/durable-resume/SKILL.md +128 -0
  629. package/skills/escalate-block-to-human/SKILL.md +85 -0
  630. package/skills/eval-datasets-and-ci/SKILL.md +117 -0
  631. package/skills/generate-images/SKILL.md +138 -0
  632. package/skills/generate-speech/SKILL.md +139 -0
  633. package/skills/guard-input-output/SKILL.md +117 -0
  634. package/skills/manage-prompts/SKILL.md +186 -0
  635. package/skills/observe-ai-flows/SKILL.md +94 -0
  636. package/skills/rag-loaders-and-stores/SKILL.md +164 -0
  637. package/skills/record-replay-llm/SKILL.md +92 -0
  638. package/skills/run-ai-agent/SKILL.md +26 -1
  639. package/skills/run-ai-rag/SKILL.md +139 -0
  640. package/skills/run-ai-team/SKILL.md +107 -0
  641. package/skills/run-orchestrator/SKILL.md +2 -0
  642. package/skills/run-planner/SKILL.md +73 -8
  643. package/skills/run-supervisor/SKILL.md +20 -1
  644. package/skills/transcribe-audio/SKILL.md +157 -0
  645. package/skills/use-runtime-skills/SKILL.md +106 -0
  646. package/skills/write-system-prompt/SKILL.md +30 -1
  647. package/cjs/index.cjs.map +0 -1
  648. package/esm/contracts/result/index.d.mts +0 -15
@@ -1 +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,CAAS,OAAA,KAEhB;EAAA,OAAA,GAAU,UAAA,CAAW,OAAA,KAAA;EAErB,KAAA,GAAQ,SAAA;EAAA;;;;EAKR,aAAA;EAOa;;;;;;EAAb,SAAA,IAAa,UAAA,EAAY,cAAA,CAAe,OAAA,aAAoB,OAAA,QAUlD;EARV,cAAA,GAAiB,mBAAA,CAAoB,OAAA;AAAA;;;;;;KAQ3B,cAAA;EAMO,0CAJjB,IAAA,EAAM,QAAA,CAAS,OAAA,GAAf;EAEA,MAAA,EAAQ,WAAA,CAAY,OAAA,GAFL;EAIf,MAAA,EAAQ,SAAA,IAFA;EAIR,KAAA,UAFA;EAIA,MAAA,WAFA;EAIA,QAAA;AAAA;;AAAQ;AAQV;;;KAAY,UAAA;EAAW,0CAErB,SAAA,UAEA;EAAA,KAAA,UAIA;EAFA,WAAA,UAMA;EAJA,WAAA,UAQA;EANA,QAAA,UAMsB;EAJtB,SAAA,UAMQ;EAJR,MAAA;EAEA,KAAA,EAAO,cAAc,CAAC,OAAA;EAEtB,QAAA;AAAA"}
1
+ {"version":3,"file":"eval.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/agent/eval.type.ts"],"mappings":";;;;;;;;AAYA;;;;;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;EA8BW;;;;;EAxBrB,KAAA,EAAO,QAAA,CAAS,OAAA,MAAa,eAAA,CAAgB,OAAA,GAAhB;EAE7B,OAAA,GAAU,UAAA,CAAW,OAAA,KAArB;EAEA,KAAA,GAAQ,SAAA;EAFa;;;;EAOrB,aAAA;EAOyB;;;;;;EAAzB,SAAA,IAAa,UAAA,EAAY,cAAA,CAAe,OAAA,aAAoB,OAAA,QAQ5D;EANA,cAAA,GAAiB,mBAAA,CAAoB,OAAA;EAMf;;;AAMb;AAOX;EAbE,QAAA,GAAW,UAAA,CAAW,OAAA;;;;;;EAMtB,SAAA;AAAA;;;;;KAOU,cAAA;EAmBA;;;;EAdV,SAAA,EAAW,KAAK;IAAG,IAAA;IAAc,MAAA;IAAgB,KAAA;EAAA,IAoBhC;EAlBjB,OAAA,YAcA;EAZA,KAAA,YAYe;EAVf,MAAA;AAAA;;;;;;KAQU,cAAA;EAYF,0CAVR,IAAA,EAAM,QAAA,CAAS,OAAA,GAkBL;EAhBV,MAAA,EAAQ,WAAA,CAAY,OAAA,GAgBA;EAdpB,MAAA,EAAQ,SAAA,IA8BD;EA5BP,KAAA,UAmC2B;EAjC3B,MAAA,WAUqB;EARrB,QAAA;AAAA;;;;;;KAQU,UAAA;EAgBH,0CAdP,SAAA,UAgBA;EAdA,KAAA,UAmBa;EAjBb,WAAA,UAiB2B;EAf3B,WAAA;EAEA,QAAA;EAEA,SAAA;EAEA,MAAA;EAEA,KAAA,EAAO,cAAA,CAAe,OAAA;EAEtB,QAAA;;;;;EAKA,UAAA,GAAa,cAAA;AAAA"}
@@ -1,3 +1,4 @@
1
1
  import { EvalCase, EvalCaseResult, EvalJudge, EvalOptions, EvalReport, EvalScore, EvalScorer, EvalScorerContext } from "./eval.type.mjs";
2
2
  import { AgentContract, AgentEventHandler } from "./agent.contract.mjs";
3
- import { AgentExecuteOptions } from "./agent-options.type.mjs";
3
+ import { AgentExecuteOptions, AgentResumeOptions } from "./agent-options.type.mjs";
4
+ import { AgentSnapshot, AgentSnapshotStatus } from "./agent-snapshot.type.mjs";
@@ -0,0 +1,51 @@
1
+ import { OutboundPolicy } from "../security/outbound-policy.type.mjs";
2
+
3
+ //#region ../@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"}
@@ -0,0 +1,156 @@
1
+ import { Usage } from "./result/usage.type.mjs";
2
+
3
+ //#region ../@warlock.js/ai/src/contracts/image-model.contract.d.ts
4
+ /**
5
+ * USD pricing for an image-generation model. Image providers meter one
6
+ * of two ways, and this single shape covers both so the cost rolls up
7
+ * through the same `Usage.cost` path the text models already use — no
8
+ * second accounting path (only a different INPUT unit).
9
+ *
10
+ * - **Token-metered** (OpenAI `gpt-image-1` family): the request bills
11
+ * per input/output token exactly like a chat model. Set `input` /
12
+ * `output` (USD per 1M tokens) and the framework prices the returned
13
+ * token `Usage` with the standard {@link computeCost} math.
14
+ * - **Per-image-metered** (DALL·E, Google Imagen): the request bills a
15
+ * flat amount per generated image, with no token usage. Set `perImage`
16
+ * (USD per image), optionally overridden per requested size via
17
+ * `perImageBySize`.
18
+ *
19
+ * When BOTH families' fields are set, per-image wins (a provider is one
20
+ * or the other, never both). When nothing is set, `Usage.cost` stays
21
+ * `undefined` — honest "cost unknown", not a false zero.
22
+ *
23
+ * @example
24
+ * // gpt-image-1 — token-metered:
25
+ * const pricing: ImageModelPricing = { input: 5, output: 40 };
26
+ *
27
+ * @example
28
+ * // DALL·E 3 — per-image, size-tiered:
29
+ * const pricing: ImageModelPricing = {
30
+ * perImage: 0.04,
31
+ * perImageBySize: { "1024x1024": 0.04, "1792x1024": 0.08, "1024x1792": 0.08 },
32
+ * };
33
+ */
34
+ type ImageModelPricing = {
35
+ /** USD per 1M input (prompt) tokens — token-metered models only. */input?: number; /** USD per 1M output (image) tokens — token-metered models only. */
36
+ output?: number; /** Flat USD per generated image — per-image-metered models. */
37
+ perImage?: number;
38
+ /**
39
+ * Per-size USD-per-image overrides, keyed by the requested `size`
40
+ * label (e.g. `"1024x1024"`). When the resolved request size is a key
41
+ * here, it wins over the flat `perImage`. Lets one model price its
42
+ * size tiers (DALL·E 3 HD/large sizes cost more) without a second
43
+ * model instance.
44
+ */
45
+ perImageBySize?: Record<string, number>;
46
+ };
47
+ /**
48
+ * One generated image, normalized to a discriminated shape so callers
49
+ * never have to probe which field a provider populated.
50
+ *
51
+ * - `{ type: "url" }` — a remote URL the provider hosts (DALL·E with
52
+ * `response_format: "url"`); URLs are typically short-lived, so
53
+ * download promptly if you need to persist the bytes.
54
+ * - `{ type: "base64" }` — inlined base64 bytes with an explicit IANA
55
+ * `mediaType` (the GPT-image family and Imagen always return bytes).
56
+ *
57
+ * `revisedPrompt` carries the provider's rewritten prompt when prompt
58
+ * enhancement ran (OpenAI `revised_prompt`, Imagen `enhancedPrompt`).
59
+ */
60
+ type GeneratedImage = {
61
+ type: "url";
62
+ url: string;
63
+ mediaType?: string;
64
+ revisedPrompt?: string;
65
+ } | {
66
+ type: "base64";
67
+ base64: string;
68
+ mediaType: string;
69
+ revisedPrompt?: string;
70
+ };
71
+ /**
72
+ * Options for a single {@link ImageModelContract.generate} request.
73
+ * Every field is optional and provider-neutral; each adapter maps the
74
+ * ones its API supports and ignores the rest. Provider-specific knobs
75
+ * ride the index signature.
76
+ */
77
+ type ImageGenerationOptions = {
78
+ /** How many images to generate. Adapters clamp to the provider's max. */count?: number;
79
+ /**
80
+ * Requested pixel size as `"WxH"` (e.g. `"1024x1024"`). Forwarded to
81
+ * the provider's size param AND used to resolve `perImageBySize`
82
+ * pricing. Mutually-informative with `aspectRatio` — pass whichever
83
+ * the target provider speaks (OpenAI = size, Imagen = aspectRatio).
84
+ */
85
+ size?: string; /** Quality tier (e.g. `"standard"` / `"hd"` / `"low"` / `"high"`). */
86
+ quality?: string; /** Aspect ratio (e.g. `"1:1"`, `"16:9"`) — ratio-based providers (Imagen). */
87
+ aspectRatio?: string; /** Concepts to steer the image away from (Imagen `negativePrompt`). */
88
+ negativePrompt?: string; /** Output container hint (`"png"` / `"jpeg"` / `"webp"`). */
89
+ format?: string; /** Cancellation handle wired into the provider request where supported. */
90
+ signal?: AbortSignal; /** Provider-specific escape hatch — forwarded verbatim. */
91
+ [key: string]: unknown;
92
+ };
93
+ /**
94
+ * Raw result of an {@link ImageModelContract.generate} call. Low-level,
95
+ * like `EmbedderContract.embed` — it returns the images plus token
96
+ * `Usage` (zeroed for per-image-metered providers) and THROWS a typed
97
+ * `AIError` on failure. The never-throws `{ data, error, usage, report }`
98
+ * envelope is added one layer up by the `ai.image()` facade verb.
99
+ */
100
+ type ImageGenerationResponse = {
101
+ images: GeneratedImage[];
102
+ /**
103
+ * Token usage when the provider meters per token (gpt-image-1);
104
+ * `{ input: 0, output: 0, total: 0 }` for per-image-metered providers
105
+ * (DALL·E, Imagen), whose spend is priced from the image count via
106
+ * {@link ImageModelPricing.perImage}.
107
+ */
108
+ usage: Usage;
109
+ };
110
+ /**
111
+ * Provider-neutral contract for an image-generation model — the output
112
+ * counterpart to {@link EmbedderContract}. Produced by an adapter's
113
+ * optional `image?(config)` factory and handed to the `ai.image()`
114
+ * facade verb, which wraps `generate()` into the uniform result
115
+ * envelope, prices it, builds the report, and routes it to observers.
116
+ *
117
+ * @example
118
+ * const model = openai.image({ name: "gpt-image-1" });
119
+ * const { images, usage } = await model.generate("a red bicycle on a white background");
120
+ */
121
+ interface ImageModelContract {
122
+ /** Image model identifier (e.g. `"gpt-image-1"`, `"imagen-4.0-generate-001"`). */
123
+ readonly name: string;
124
+ /** Provider this model belongs to (e.g. `"openai"`, `"google"`). */
125
+ readonly provider: string;
126
+ /**
127
+ * Per-million-token OR per-image USD pricing. When set, `ai.image()`
128
+ * computes `Usage.cost` at emit time so image spend rolls up through
129
+ * the same report tree as text spend. Resolution mirrors the chat
130
+ * models: per-model `pricing` > SDK registry > undefined.
131
+ */
132
+ readonly pricing?: ImageModelPricing;
133
+ /**
134
+ * Generate one or more images from a text prompt. Returns the
135
+ * normalized images plus usage, or throws a typed `AIError` (auth,
136
+ * rate-limit, content-filter, invalid-request) — caught and surfaced
137
+ * on `result.error` by the `ai.image()` facade.
138
+ */
139
+ generate(prompt: string, options?: ImageGenerationOptions): Promise<ImageGenerationResponse>;
140
+ }
141
+ /**
142
+ * Configuration passed to an adapter's `image()` factory. Mirrors
143
+ * {@link EmbedderConfig}: `name` plus an optional per-model `pricing`
144
+ * override and provider-specific keys on the index signature.
145
+ *
146
+ * @example
147
+ * openai.image({ name: "dall-e-3", pricing: { perImage: 0.04 } });
148
+ */
149
+ type ImageModelConfig = {
150
+ name: string; /** Per-model USD pricing override; wins over the SDK-level registry. */
151
+ pricing?: ImageModelPricing;
152
+ [key: string]: unknown;
153
+ };
154
+ //#endregion
155
+ export { GeneratedImage, ImageGenerationOptions, ImageGenerationResponse, ImageModelConfig, ImageModelContract, ImageModelPricing };
156
+ //# sourceMappingURL=image-model.contract.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-model.contract.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/image-model.contract.ts"],"mappings":";;;;;AAgCA;;;;;;;;;;AAcyB;AAgBzB;;;;;;;;;;;;;AAEsE;AAQtE;;;KAxCY,iBAAA;EA0CV,oEAxCA,KAAA,WAiDA;EA/CA,MAAA,WAmDA;EAjDA,QAAA;EAqDA;;;;AAEY;AAUd;;EAzDE,cAAA,GAAiB,MAAM;AAAA;;;;;;AAiEX;AAcd;;;;;;;KA/DY,cAAA;EACN,IAAA;EAAa,GAAA;EAAa,SAAA;EAAoB,aAAA;AAAA;EAC9C,IAAA;EAAgB,MAAA;EAAgB,SAAA;EAAmB,aAAA;AAAA;;;AAgFoC;AAW7F;;;KAnFY,sBAAA;EAoFV,yEAlFA,KAAA;EAoFU;;;AACE;;;EA9EZ,IAAA;EAEA,OAAA;EAEA,WAAA;EAEA,cAAA;EAEA,MAAA;EAEA,MAAA,GAAS,WAAW;GAEnB,GAAA;AAAA;;;;;;;;KAUS,uBAAA;EACV,MAAA,EAAQ,cAAA;;;;;;;EAOR,KAAA,EAAO,KAAK;AAAA;;;;;;;;;;;;UAcG,kBAAA;;WAEN,IAAA;;WAEA,QAAA;;;;;;;WAOA,OAAA,GAAU,iBAAA;;;;;;;EAQnB,QAAA,CAAS,MAAA,UAAgB,OAAA,GAAU,sBAAA,GAAyB,OAAA,CAAQ,uBAAA;AAAA;;;;;;;;;KAW1D,gBAAA;EACV,IAAA;EAEA,OAAA,GAAU,iBAAiB;EAAA,CAC1B,GAAA;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";
@@ -59,13 +60,16 @@ import { SupervisorAgentCompletedPayload, SupervisorAgentFailedPayload, Supervis
59
60
  import { WorkflowCancelledPayload, WorkflowCompletedPayload, WorkflowErrorPayload, WorkflowLoopWarningPayload, WorkflowStartingPayload, WorkflowStepCompletedPayload, WorkflowStepFailedPayload, WorkflowStepRetryingPayload, WorkflowStepSkippedPayload, WorkflowStepStartingPayload, WorkflowStepStreamingPayload } from "./events/workflow-events.type.mjs";
60
61
  import { AgentEventMap, SupervisorEventMap, WorkflowEventMap } from "./events/event-map.type.mjs";
61
62
  import { StreamingToolGuardConfig } from "./streaming-tool-guard-config.type.mjs";
62
- import { AgentExecuteOptions } from "./agent/agent-options.type.mjs";
63
+ import { AgentExecuteOptions, AgentResumeOptions } from "./agent/agent-options.type.mjs";
64
+ import { AgentSnapshot, AgentSnapshotStatus } from "./agent/agent-snapshot.type.mjs";
63
65
  import { EmbedderConfig, EmbedderContract, EmbeddingBatchResult, EmbeddingResult, EmbeddingUsage } from "./embedder.contract.mjs";
66
+ import { GeneratedImage, ImageGenerationOptions, ImageGenerationResponse, ImageModelConfig, ImageModelContract, ImageModelPricing } from "./image-model.contract.mjs";
64
67
  import { MemoryItem, MemoryTier, RecalledMemory } from "./memory/memory-item.type.mjs";
65
68
  import { RecallOptions } from "./memory/recall-options.type.mjs";
66
69
  import { MemoryContract } from "./memory/memory.contract.mjs";
67
70
  import { MemoryConfig, SemanticMemoryConfig } from "./memory/memory-config.type.mjs";
68
71
  import { CheckpointRecord, CheckpointStore } from "./orchestrator/checkpoint-store.contract.mjs";
72
+ import { SessionLock } from "./orchestrator/session-lock.contract.mjs";
69
73
  import { OrchestratorCommands } from "./orchestrator/orchestrator-commands.type.mjs";
70
74
  import { OrchestratorEvent, OrchestratorEventHandler, OrchestratorEventHandlers, OrchestratorEventMap, OrchestratorEventName } from "./orchestrator/orchestrator-event.type.mjs";
71
75
  import { OrchestratorExecuteOptions, OrchestratorResumeOptions } from "./orchestrator/orchestrator-execute-options.type.mjs";
@@ -73,11 +77,14 @@ import { OrchestratorAsToolOptions, OrchestratorContract, OrchestratorSessionSco
73
77
  import { OrchestratorConfig, OrchestratorMemoryConfig, SummarizeCallback, SummarizeConfig } from "./orchestrator/orchestrator-config.type.mjs";
74
78
  import { SessionContract } from "./orchestrator/session.contract.mjs";
75
79
  import { PlannerCapability } from "./planner/planner-capability.type.mjs";
76
- import { PlannerConfig } from "./planner/planner-config.type.mjs";
77
- import { PlannerExecuteOptions } from "./planner/planner-execute-options.type.mjs";
78
80
  import { PlannerPlan, PlannerStep } from "./planner/planner-plan.type.mjs";
79
81
  import { PlannerReport, PlannerReportType, PlannerResult, PlannerStepSnapshot } from "./planner/planner-result.type.mjs";
82
+ import { PlannerSnapshot, PlannerSnapshotStatus } from "./planner/planner-snapshot.type.mjs";
83
+ import { PlannerConfig } from "./planner/planner-config.type.mjs";
84
+ import { PlannerExecuteOptions, PlannerResumeOptions, PlannerStepDirective } from "./planner/planner-execute-options.type.mjs";
80
85
  import { PlannerContract } from "./planner/planner.contract.mjs";
86
+ import { GeneratedAudio, SpeechGenerationResponse, SpeechModelConfig, SpeechModelContract, SpeechModelPricing, SpeechOptions } from "./speech-model.contract.mjs";
87
+ import { AudioInput, TranscribeOptions, TranscriptionModelConfig, TranscriptionModelContract, TranscriptionModelPricing, TranscriptionResponse, TranscriptionSegment } from "./transcription-model.contract.mjs";
81
88
  import { ModelConfig, SDKAdapterContract } from "./sdk-adapter.contract.mjs";
82
89
  import { CompleteEvent } from "./events/complete-event.type.mjs";
83
90
  import { UsageEvent } from "./events/usage-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,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
+ {"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;;;;;;;;;;AA+FN;EApFH,SAAA;IACE,MAAA,GAAS,eAAA;IACT,SAAA;EAAA;EAkGK;;;;;;;;;;;EArFP,YAAA;IACE,WAAA;EAAA,GAkGwB;EAAA,CA/FzB,GAAA;AAAA;;;;;;KAQS,eAAA;;;;;;;;;;;KAYA,iBAAA;EA0FgD;AAAA;AAgB5D;;;;EAnGE,gBAAA;EA8HmB;;;;;;;EAtHnB,MAAA;EA2HsE;;;;;;EApHtE,SAAA;EA0GmB;;;;;EApGnB,aAAA;EAyG2D;;;;;;;;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;EAYR,gFAVF,KAAA,EAAO,cAAA;EAkBP;;;;;AAYS;EAvBT,MAAA;IACE,CAAA;IACA,SAAA;IACA,IAAA,GAAO,UAAA;EAAA;EAmDQ;;;;;;EA3CjB,QAAA;EA0DuC;;;;;EApDvC,YAAA,GAAe,UAAA;EAyDQ;;;;;EAnDvB,SAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BU,kBAAA,mBAED,OAAA,mBACQ,MAAA,SAAe,qBAAA,IAAyB,MAAA,SAEvD,qBAAA;EAWF,wEAPA,IAAA,UASA;EAPA,OAAA,WAO2B;EAL3B,YAAA,GAAe,oBAAA,WAKwB;EAFvC,OAAA,EAAS,QAAA,EAE6C;EAAtD,KAAA,IAAS,GAAA,EAAK,YAAA,CAAa,MAAA,MAAY,IAAA,GAAO,OAAA,CAAQ,IAAA,GAE7C;EAAT,MAAA,GAAS,aAAA,YAAyB,WAAA,CAAY,MAAA,GAAA;EAE9C,QAAA,IACE,GAAA,EAAK,eAAA,CAAgB,MAAA,MAClB,cAAA,GAAiB,OAAA,CAAQ,cAAA,GADvB;EAGP,KAAA,GAAQ,MAAA,EAHN;EAKF,MAAA,GAAS,gBAAA,CAAiB,OAAA,GAJJ;EAMtB,YAAA,WAJA;EAMA,aAAA;EAJA;;;;;EAWA,OAAA;EAMA;;;;;EAAA,aAAA;IACE,MAAA,cAAoB,QAAA,EAAU,OAAA,OAAc,OAAA;IAC5C,MAAA,cAAoB,QAAA,EAAU,OAAA,OAAc,OAAA;EAAA,GAG9C;EAAA,SAAA,GAAY,eAAA,GAAkB,iBAAA,EAAA;EAE9B,aAAA,mBAGA;EAAA,eAAA,GAAkB,eAAA,EAElB;EAAA,aAAA,GAAgB,aAAA;EAUhB;;;;;;AAG8B;;;EAH9B,MAAA,GAAS,cAAA,GAAiB,wBAAA;EAG1B,EAAA,GAAK,yBAAA;AAAA"}
1
+ {"version":3,"file":"orchestrator-config.type.d.mts","names":[],"sources":["../../../../../../../../@warlock.js/ai/src/contracts/orchestrator/orchestrator-config.type.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2BA;;;;;;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;EAYR,gFAVF,KAAA,EAAO,cAAA;EAkBP;;;;;AAYS;EAvBT,MAAA;IACE,CAAA;IACA,SAAA;IACA,IAAA,GAAO,UAAA;EAAA;EAmDQ;;;;;;EA3CjB,QAAA;EAkEc;;;;;EA5Dd,YAAA,GAAe,UAAA;EA8DmB;;;;;EAxDlC,SAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BU,kBAAA,mBAED,OAAA,mBACQ,MAAA,SAAe,qBAAA,IAAyB,MAAA,SAEvD,qBAAA;EAcF,wEAVA,IAAA,UAYA;EAVA,OAAA;EAaA;;;;;;;EALA,OAAA,GAAU,iBAAA,EAO4C;EALtD,YAAA,GAAe,oBAAA,WAON;EAJT,OAAA,EAAS,QAAA,EAIqC;EAF9C,KAAA,IAAS,GAAA,EAAK,YAAA,CAAa,MAAA,MAAY,IAAA,GAAO,OAAA,CAAQ,IAAA,GAK/C;EAHP,MAAA,GAAS,aAAA,YAAyB,WAAA,CAAY,MAAA,GAG5C;EADF,QAAA,IACE,GAAA,EAAK,eAAA,CAAgB,MAAA,MAClB,cAAA,GAAiB,OAAA,CAAQ,cAAA,GAAR;EAEtB,KAAA,GAAQ,MAAA,EAAR;EAEA,MAAA,GAAS,gBAAA,CAAiB,OAAA,GAA1B;EAEA,YAAA,WAF0B;EAI1B,aAAA;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,7 @@
1
1
  import { PlannerCapability } from "./planner-capability.type.mjs";
2
- import { PlannerConfig } from "./planner-config.type.mjs";
3
- import { PlannerExecuteOptions } from "./planner-execute-options.type.mjs";
4
2
  import { PlannerPlan, PlannerStep } from "./planner-plan.type.mjs";
5
3
  import { PlannerReport, PlannerReportType, PlannerResult, PlannerStepSnapshot } from "./planner-result.type.mjs";
4
+ import { PlannerSnapshot, PlannerSnapshotStatus } from "./planner-snapshot.type.mjs";
5
+ import { PlannerConfig } from "./planner-config.type.mjs";
6
+ import { PlannerExecuteOptions, PlannerResumeOptions, PlannerStepDirective } from "./planner-execute-options.type.mjs";
6
7
  import { PlannerContract } from "./planner.contract.mjs";