@warlock.js/ai 4.8.2 → 4.9.1

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 (1169) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/cjs/index.cjs +263 -241
  3. package/cjs/index.cjs.map +1 -1
  4. package/cjs/{magic-string.es-BtxW4VqG.cjs → magic-string.es-BoSa5xIt.cjs} +3 -3
  5. package/cjs/magic-string.es-BoSa5xIt.cjs.map +1 -0
  6. package/cjs/{matcher-logic-SBnzYohQ.cjs → matcher-logic-07fFOz7r.cjs} +3 -3
  7. package/cjs/matcher-logic-07fFOz7r.cjs.map +1 -0
  8. package/cjs/{matchers-BBh3gyB-.cjs → matchers-DnV47KR_.cjs} +24 -24
  9. package/cjs/matchers-DnV47KR_.cjs.map +1 -0
  10. package/esm/agent/agent-config.type.d.mts +1 -1
  11. package/esm/agent/agent-config.type.d.mts.map +1 -1
  12. package/esm/agent/agent-input-builder.mjs +1 -1
  13. package/esm/agent/agent-input-builder.mjs.map +1 -1
  14. package/esm/agent/agent-log-event.mjs +1 -1
  15. package/esm/agent/agent-log-event.mjs.map +1 -1
  16. package/esm/agent/agent-stream.d.mts +1 -1
  17. package/esm/agent/agent-stream.d.mts.map +1 -1
  18. package/esm/agent/agent-stream.mjs +1 -1
  19. package/esm/agent/agent-stream.mjs.map +1 -1
  20. package/esm/agent/agent-to-stream-event.mjs +1 -1
  21. package/esm/agent/agent-to-stream-event.mjs.map +1 -1
  22. package/esm/agent/agent.d.mts +1 -1
  23. package/esm/agent/agent.d.mts.map +1 -1
  24. package/esm/agent/agent.mjs +1 -1
  25. package/esm/agent/agent.mjs.map +1 -1
  26. package/esm/agent/json-stream-guard.mjs +1 -1
  27. package/esm/agent/json-stream-guard.mjs.map +1 -1
  28. package/esm/agent/judge-config.type.d.mts +1 -1
  29. package/esm/agent/judge-config.type.d.mts.map +1 -1
  30. package/esm/agent/judge-config.type.mjs +1 -1
  31. package/esm/agent/judge-config.type.mjs.map +1 -1
  32. package/esm/agent/signature.mjs +1 -1
  33. package/esm/agent/signature.mjs.map +1 -1
  34. package/esm/agent/snapshot.mjs +1 -1
  35. package/esm/agent/snapshot.mjs.map +1 -1
  36. package/esm/agent/spawn-sub-agent.d.mts +1 -1
  37. package/esm/agent/spawn-sub-agent.d.mts.map +1 -1
  38. package/esm/agent/spawn-sub-agent.mjs +1 -1
  39. package/esm/agent/spawn-sub-agent.mjs.map +1 -1
  40. package/esm/ai.d.mts +1 -1
  41. package/esm/ai.d.mts.map +1 -1
  42. package/esm/ai.mjs +1 -1
  43. package/esm/ai.mjs.map +1 -1
  44. package/esm/batch/batch.d.mts +1 -1
  45. package/esm/batch/batch.d.mts.map +1 -1
  46. package/esm/batch/batch.mjs +1 -1
  47. package/esm/batch/batch.mjs.map +1 -1
  48. package/esm/batch/batch.type.d.mts +1 -1
  49. package/esm/batch/batch.type.d.mts.map +1 -1
  50. package/esm/batch/run-batch-item.mjs +1 -1
  51. package/esm/batch/run-batch-item.mjs.map +1 -1
  52. package/esm/batch/run-with-concurrency.mjs +1 -1
  53. package/esm/batch/run-with-concurrency.mjs.map +1 -1
  54. package/esm/checkpoint/memory.d.mts +1 -1
  55. package/esm/checkpoint/memory.d.mts.map +1 -1
  56. package/esm/checkpoint/memory.mjs +0 -0
  57. package/esm/checkpoint/memory.mjs.map +1 -1
  58. package/esm/checkpoint/pg.d.mts +1 -1
  59. package/esm/checkpoint/pg.d.mts.map +1 -1
  60. package/esm/checkpoint/pg.mjs +1 -1
  61. package/esm/checkpoint/pg.mjs.map +1 -1
  62. package/esm/checkpoint/redis.d.mts +1 -1
  63. package/esm/checkpoint/redis.d.mts.map +1 -1
  64. package/esm/checkpoint/redis.mjs +1 -1
  65. package/esm/checkpoint/redis.mjs.map +1 -1
  66. package/esm/config.d.mts +1 -1
  67. package/esm/config.d.mts.map +1 -1
  68. package/esm/config.mjs +1 -1
  69. package/esm/config.mjs.map +1 -1
  70. package/esm/contracts/agent/agent-options.type.d.mts +1 -1
  71. package/esm/contracts/agent/agent-options.type.d.mts.map +1 -1
  72. package/esm/contracts/agent/agent-snapshot.type.d.mts +1 -1
  73. package/esm/contracts/agent/agent-snapshot.type.d.mts.map +1 -1
  74. package/esm/contracts/agent/agent.contract.d.mts +1 -1
  75. package/esm/contracts/agent/agent.contract.d.mts.map +1 -1
  76. package/esm/contracts/agent/eval.type.d.mts +1 -1
  77. package/esm/contracts/agent/eval.type.d.mts.map +1 -1
  78. package/esm/contracts/attachment-policy.type.d.mts +1 -1
  79. package/esm/contracts/attachment-policy.type.d.mts.map +1 -1
  80. package/esm/contracts/attachment.type.d.mts +1 -1
  81. package/esm/contracts/attachment.type.d.mts.map +1 -1
  82. package/esm/contracts/content-part.type.d.mts +1 -1
  83. package/esm/contracts/content-part.type.d.mts.map +1 -1
  84. package/esm/contracts/conversation-message.type.d.mts +1 -1
  85. package/esm/contracts/conversation-message.type.d.mts.map +1 -1
  86. package/esm/contracts/embedder.contract.d.mts +1 -1
  87. package/esm/contracts/embedder.contract.d.mts.map +1 -1
  88. package/esm/contracts/end.type.d.mts +1 -1
  89. package/esm/contracts/end.type.d.mts.map +1 -1
  90. package/esm/contracts/end.type.mjs +1 -1
  91. package/esm/contracts/end.type.mjs.map +1 -1
  92. package/esm/contracts/events/agent-events.type.d.mts +1 -1
  93. package/esm/contracts/events/agent-events.type.d.mts.map +1 -1
  94. package/esm/contracts/events/complete-event.type.d.mts +1 -1
  95. package/esm/contracts/events/complete-event.type.d.mts.map +1 -1
  96. package/esm/contracts/events/event-identity.type.d.mts +1 -1
  97. package/esm/contracts/events/event-identity.type.d.mts.map +1 -1
  98. package/esm/contracts/events/event-map.type.d.mts +1 -1
  99. package/esm/contracts/events/event-map.type.d.mts.map +1 -1
  100. package/esm/contracts/events/supervisor-events.type.d.mts +1 -1
  101. package/esm/contracts/events/supervisor-events.type.d.mts.map +1 -1
  102. package/esm/contracts/events/usage-event.type.d.mts +1 -1
  103. package/esm/contracts/events/usage-event.type.d.mts.map +1 -1
  104. package/esm/contracts/events/workflow-events.type.d.mts +1 -1
  105. package/esm/contracts/events/workflow-events.type.d.mts.map +1 -1
  106. package/esm/contracts/executable.contract.d.mts +1 -1
  107. package/esm/contracts/executable.contract.d.mts.map +1 -1
  108. package/esm/contracts/fallback-model.contract.d.mts +1 -1
  109. package/esm/contracts/fallback-model.contract.d.mts.map +1 -1
  110. package/esm/contracts/finish-reason.type.d.mts +1 -1
  111. package/esm/contracts/finish-reason.type.d.mts.map +1 -1
  112. package/esm/contracts/image-model.contract.d.mts +1 -1
  113. package/esm/contracts/image-model.contract.d.mts.map +1 -1
  114. package/esm/contracts/memory/memory-config.type.d.mts +1 -1
  115. package/esm/contracts/memory/memory-config.type.d.mts.map +1 -1
  116. package/esm/contracts/memory/memory-item.type.d.mts +1 -1
  117. package/esm/contracts/memory/memory-item.type.d.mts.map +1 -1
  118. package/esm/contracts/memory/memory.contract.d.mts +1 -1
  119. package/esm/contracts/memory/memory.contract.d.mts.map +1 -1
  120. package/esm/contracts/memory/recall-options.type.d.mts +1 -1
  121. package/esm/contracts/memory/recall-options.type.d.mts.map +1 -1
  122. package/esm/contracts/middleware/middleware-context.type.d.mts +1 -1
  123. package/esm/contracts/middleware/middleware-context.type.d.mts.map +1 -1
  124. package/esm/contracts/middleware/middleware-state.type.d.mts +1 -1
  125. package/esm/contracts/middleware/middleware-state.type.d.mts.map +1 -1
  126. package/esm/contracts/middleware/middleware.contract.d.mts +1 -1
  127. package/esm/contracts/middleware/middleware.contract.d.mts.map +1 -1
  128. package/esm/contracts/model-tool-call-request.type.d.mts +1 -1
  129. package/esm/contracts/model-tool-call-request.type.d.mts.map +1 -1
  130. package/esm/contracts/model.contract.d.mts +9 -1
  131. package/esm/contracts/model.contract.d.mts.map +1 -1
  132. package/esm/contracts/orchestrator/checkpoint-store.contract.d.mts +1 -1
  133. package/esm/contracts/orchestrator/checkpoint-store.contract.d.mts.map +1 -1
  134. package/esm/contracts/orchestrator/orchestrator-commands.type.d.mts +1 -1
  135. package/esm/contracts/orchestrator/orchestrator-commands.type.d.mts.map +1 -1
  136. package/esm/contracts/orchestrator/orchestrator-config.type.d.mts +1 -1
  137. package/esm/contracts/orchestrator/orchestrator-config.type.d.mts.map +1 -1
  138. package/esm/contracts/orchestrator/orchestrator-event.type.d.mts +1 -1
  139. package/esm/contracts/orchestrator/orchestrator-event.type.d.mts.map +1 -1
  140. package/esm/contracts/orchestrator/orchestrator-execute-options.type.d.mts +1 -1
  141. package/esm/contracts/orchestrator/orchestrator-execute-options.type.d.mts.map +1 -1
  142. package/esm/contracts/orchestrator/orchestrator.contract.d.mts +1 -1
  143. package/esm/contracts/orchestrator/orchestrator.contract.d.mts.map +1 -1
  144. package/esm/contracts/orchestrator/session-lock.contract.d.mts +1 -1
  145. package/esm/contracts/orchestrator/session-lock.contract.d.mts.map +1 -1
  146. package/esm/contracts/orchestrator/session.contract.d.mts +1 -1
  147. package/esm/contracts/orchestrator/session.contract.d.mts.map +1 -1
  148. package/esm/contracts/orchestrator/snapshot-store.contract.d.mts +1 -1
  149. package/esm/contracts/orchestrator/snapshot-store.contract.d.mts.map +1 -1
  150. package/esm/contracts/placeholders.type.d.mts +1 -1
  151. package/esm/contracts/placeholders.type.d.mts.map +1 -1
  152. package/esm/contracts/planner/planner-capability.type.d.mts +1 -1
  153. package/esm/contracts/planner/planner-capability.type.d.mts.map +1 -1
  154. package/esm/contracts/planner/planner-config.type.d.mts +1 -1
  155. package/esm/contracts/planner/planner-config.type.d.mts.map +1 -1
  156. package/esm/contracts/planner/planner-execute-options.type.d.mts +1 -1
  157. package/esm/contracts/planner/planner-execute-options.type.d.mts.map +1 -1
  158. package/esm/contracts/planner/planner-plan.type.d.mts +1 -1
  159. package/esm/contracts/planner/planner-plan.type.d.mts.map +1 -1
  160. package/esm/contracts/planner/planner-result.type.d.mts +1 -1
  161. package/esm/contracts/planner/planner-result.type.d.mts.map +1 -1
  162. package/esm/contracts/planner/planner-snapshot.type.d.mts +1 -1
  163. package/esm/contracts/planner/planner-snapshot.type.d.mts.map +1 -1
  164. package/esm/contracts/planner/planner.contract.d.mts +1 -1
  165. package/esm/contracts/planner/planner.contract.d.mts.map +1 -1
  166. package/esm/contracts/result/agent-result.type.d.mts +1 -1
  167. package/esm/contracts/result/agent-result.type.d.mts.map +1 -1
  168. package/esm/contracts/result/attempt-entry.type.d.mts +1 -1
  169. package/esm/contracts/result/attempt-entry.type.d.mts.map +1 -1
  170. package/esm/contracts/result/base-report.type.d.mts +1 -1
  171. package/esm/contracts/result/base-report.type.d.mts.map +1 -1
  172. package/esm/contracts/result/base-report.type.mjs +1 -1
  173. package/esm/contracts/result/base-report.type.mjs.map +1 -1
  174. package/esm/contracts/result/base-result.type.d.mts +1 -1
  175. package/esm/contracts/result/base-result.type.d.mts.map +1 -1
  176. package/esm/contracts/result/execute-result.type.d.mts +1 -1
  177. package/esm/contracts/result/execute-result.type.d.mts.map +1 -1
  178. package/esm/contracts/result/execution-report.type.d.mts +1 -1
  179. package/esm/contracts/result/execution-report.type.d.mts.map +1 -1
  180. package/esm/contracts/result/llm-trip.type.d.mts +1 -1
  181. package/esm/contracts/result/llm-trip.type.d.mts.map +1 -1
  182. package/esm/contracts/result/model-pricing.type.d.mts +1 -1
  183. package/esm/contracts/result/model-pricing.type.d.mts.map +1 -1
  184. package/esm/contracts/result/orchestrator-result.type.d.mts +1 -1
  185. package/esm/contracts/result/orchestrator-result.type.d.mts.map +1 -1
  186. package/esm/contracts/result/session-send-result.type.d.mts +1 -1
  187. package/esm/contracts/result/session-send-result.type.d.mts.map +1 -1
  188. package/esm/contracts/result/step-result.type.d.mts +12 -2
  189. package/esm/contracts/result/step-result.type.d.mts.map +1 -1
  190. package/esm/contracts/result/supervisor-result.type.d.mts +1 -1
  191. package/esm/contracts/result/supervisor-result.type.d.mts.map +1 -1
  192. package/esm/contracts/result/tool-call.type.d.mts +1 -1
  193. package/esm/contracts/result/tool-call.type.d.mts.map +1 -1
  194. package/esm/contracts/result/usage.type.d.mts +1 -1
  195. package/esm/contracts/result/usage.type.d.mts.map +1 -1
  196. package/esm/contracts/result/workflow-result.type.d.mts +1 -1
  197. package/esm/contracts/result/workflow-result.type.d.mts.map +1 -1
  198. package/esm/contracts/sdk-adapter.contract.d.mts +1 -1
  199. package/esm/contracts/sdk-adapter.contract.d.mts.map +1 -1
  200. package/esm/contracts/speech-model.contract.d.mts +1 -1
  201. package/esm/contracts/speech-model.contract.d.mts.map +1 -1
  202. package/esm/contracts/stream/stream-event.type.d.mts +1 -1
  203. package/esm/contracts/stream/stream-event.type.d.mts.map +1 -1
  204. package/esm/contracts/stream/stream.contract.d.mts +1 -1
  205. package/esm/contracts/stream/stream.contract.d.mts.map +1 -1
  206. package/esm/contracts/streaming-tool-guard-config.type.d.mts +1 -1
  207. package/esm/contracts/streaming-tool-guard-config.type.d.mts.map +1 -1
  208. package/esm/contracts/supervisor/ack-entry.type.d.mts +1 -1
  209. package/esm/contracts/supervisor/ack-entry.type.d.mts.map +1 -1
  210. package/esm/contracts/supervisor/classifier-context.type.d.mts +1 -1
  211. package/esm/contracts/supervisor/classifier-context.type.d.mts.map +1 -1
  212. package/esm/contracts/supervisor/dispatch-context.type.d.mts +1 -1
  213. package/esm/contracts/supervisor/dispatch-context.type.d.mts.map +1 -1
  214. package/esm/contracts/supervisor/evaluate-context.type.d.mts +1 -1
  215. package/esm/contracts/supervisor/evaluate-context.type.d.mts.map +1 -1
  216. package/esm/contracts/supervisor/intent-entry.type.d.mts +1 -1
  217. package/esm/contracts/supervisor/intent-entry.type.d.mts.map +1 -1
  218. package/esm/contracts/supervisor/iteration-snapshot.type.d.mts +1 -1
  219. package/esm/contracts/supervisor/iteration-snapshot.type.d.mts.map +1 -1
  220. package/esm/contracts/supervisor/next.type.d.mts +1 -1
  221. package/esm/contracts/supervisor/next.type.d.mts.map +1 -1
  222. package/esm/contracts/supervisor/route-context.type.d.mts +1 -1
  223. package/esm/contracts/supervisor/route-context.type.d.mts.map +1 -1
  224. package/esm/contracts/supervisor/router-entry.type.d.mts +1 -1
  225. package/esm/contracts/supervisor/router-entry.type.d.mts.map +1 -1
  226. package/esm/contracts/supervisor/supervisor-config.type.d.mts +1 -1
  227. package/esm/contracts/supervisor/supervisor-config.type.d.mts.map +1 -1
  228. package/esm/contracts/supervisor/supervisor-execute-options.type.d.mts +1 -1
  229. package/esm/contracts/supervisor/supervisor-execute-options.type.d.mts.map +1 -1
  230. package/esm/contracts/supervisor/supervisor-input.type.d.mts +1 -1
  231. package/esm/contracts/supervisor/supervisor-input.type.d.mts.map +1 -1
  232. package/esm/contracts/supervisor/supervisor-snapshot.type.d.mts +1 -1
  233. package/esm/contracts/supervisor/supervisor-snapshot.type.d.mts.map +1 -1
  234. package/esm/contracts/supervisor/supervisor-stream-event.type.d.mts +1 -1
  235. package/esm/contracts/supervisor/supervisor-stream-event.type.d.mts.map +1 -1
  236. package/esm/contracts/supervisor/supervisor.contract.d.mts +1 -1
  237. package/esm/contracts/supervisor/supervisor.contract.d.mts.map +1 -1
  238. package/esm/contracts/system-prompt.contract.d.mts +1 -1
  239. package/esm/contracts/system-prompt.contract.d.mts.map +1 -1
  240. package/esm/contracts/team/team-config.type.d.mts +1 -1
  241. package/esm/contracts/team/team-config.type.d.mts.map +1 -1
  242. package/esm/contracts/tool.contract.d.mts +1 -1
  243. package/esm/contracts/tool.contract.d.mts.map +1 -1
  244. package/esm/contracts/transcription-model.contract.d.mts +1 -1
  245. package/esm/contracts/transcription-model.contract.d.mts.map +1 -1
  246. package/esm/contracts/workflow/next-step-result.type.d.mts +1 -1
  247. package/esm/contracts/workflow/next-step-result.type.d.mts.map +1 -1
  248. package/esm/contracts/workflow/retry-config.type.d.mts +1 -1
  249. package/esm/contracts/workflow/retry-config.type.d.mts.map +1 -1
  250. package/esm/contracts/workflow/step.contract.d.mts +1 -1
  251. package/esm/contracts/workflow/step.contract.d.mts.map +1 -1
  252. package/esm/contracts/workflow/workflow-context.type.d.mts +1 -1
  253. package/esm/contracts/workflow/workflow-context.type.d.mts.map +1 -1
  254. package/esm/contracts/workflow/workflow-snapshot.type.d.mts +1 -1
  255. package/esm/contracts/workflow/workflow-snapshot.type.d.mts.map +1 -1
  256. package/esm/contracts/workflow/workflow.contract.d.mts +1 -1
  257. package/esm/contracts/workflow/workflow.contract.d.mts.map +1 -1
  258. package/esm/errors/agent-cancelled-error.d.mts +1 -1
  259. package/esm/errors/agent-cancelled-error.d.mts.map +1 -1
  260. package/esm/errors/agent-cancelled-error.mjs +1 -1
  261. package/esm/errors/agent-cancelled-error.mjs.map +1 -1
  262. package/esm/errors/agent-drift-error.d.mts +1 -1
  263. package/esm/errors/agent-drift-error.d.mts.map +1 -1
  264. package/esm/errors/agent-drift-error.mjs +1 -1
  265. package/esm/errors/agent-drift-error.mjs.map +1 -1
  266. package/esm/errors/agent-execution-error.d.mts +1 -1
  267. package/esm/errors/agent-execution-error.d.mts.map +1 -1
  268. package/esm/errors/agent-execution-error.mjs +1 -1
  269. package/esm/errors/agent-execution-error.mjs.map +1 -1
  270. package/esm/errors/agent-max-trips-error.d.mts +1 -1
  271. package/esm/errors/agent-max-trips-error.d.mts.map +1 -1
  272. package/esm/errors/agent-max-trips-error.mjs +1 -1
  273. package/esm/errors/agent-max-trips-error.mjs.map +1 -1
  274. package/esm/errors/ai-error.d.mts +1 -1
  275. package/esm/errors/ai-error.d.mts.map +1 -1
  276. package/esm/errors/ai-error.mjs +1 -1
  277. package/esm/errors/ai-error.mjs.map +1 -1
  278. package/esm/errors/budget-exceeded-error.d.mts +1 -1
  279. package/esm/errors/budget-exceeded-error.d.mts.map +1 -1
  280. package/esm/errors/budget-exceeded-error.mjs +1 -1
  281. package/esm/errors/budget-exceeded-error.mjs.map +1 -1
  282. package/esm/errors/content-filter-error.d.mts +1 -1
  283. package/esm/errors/content-filter-error.d.mts.map +1 -1
  284. package/esm/errors/content-filter-error.mjs +1 -1
  285. package/esm/errors/content-filter-error.mjs.map +1 -1
  286. package/esm/errors/context-length-exceeded-error.d.mts +1 -1
  287. package/esm/errors/context-length-exceeded-error.d.mts.map +1 -1
  288. package/esm/errors/context-length-exceeded-error.mjs +1 -1
  289. package/esm/errors/context-length-exceeded-error.mjs.map +1 -1
  290. package/esm/errors/error-category.type.d.mts +1 -1
  291. package/esm/errors/error-category.type.d.mts.map +1 -1
  292. package/esm/errors/error-code.type.d.mts +1 -1
  293. package/esm/errors/error-code.type.d.mts.map +1 -1
  294. package/esm/errors/guardrail-violation-error.d.mts +1 -1
  295. package/esm/errors/guardrail-violation-error.d.mts.map +1 -1
  296. package/esm/errors/guardrail-violation-error.mjs +1 -1
  297. package/esm/errors/guardrail-violation-error.mjs.map +1 -1
  298. package/esm/errors/invalid-request-error.d.mts +1 -1
  299. package/esm/errors/invalid-request-error.d.mts.map +1 -1
  300. package/esm/errors/invalid-request-error.mjs +1 -1
  301. package/esm/errors/invalid-request-error.mjs.map +1 -1
  302. package/esm/errors/max-iterations-error.d.mts +1 -1
  303. package/esm/errors/max-iterations-error.d.mts.map +1 -1
  304. package/esm/errors/max-iterations-error.mjs +1 -1
  305. package/esm/errors/max-iterations-error.mjs.map +1 -1
  306. package/esm/errors/max-steps-exceeded-error.d.mts +1 -1
  307. package/esm/errors/max-steps-exceeded-error.d.mts.map +1 -1
  308. package/esm/errors/max-steps-exceeded-error.mjs +1 -1
  309. package/esm/errors/max-steps-exceeded-error.mjs.map +1 -1
  310. package/esm/errors/orchestrator-cancelled-error.d.mts +1 -1
  311. package/esm/errors/orchestrator-cancelled-error.d.mts.map +1 -1
  312. package/esm/errors/orchestrator-cancelled-error.mjs +1 -1
  313. package/esm/errors/orchestrator-cancelled-error.mjs.map +1 -1
  314. package/esm/errors/orchestrator-config-error.d.mts +1 -1
  315. package/esm/errors/orchestrator-config-error.d.mts.map +1 -1
  316. package/esm/errors/orchestrator-config-error.mjs +1 -1
  317. package/esm/errors/orchestrator-config-error.mjs.map +1 -1
  318. package/esm/errors/orchestrator-drift-error.d.mts +1 -1
  319. package/esm/errors/orchestrator-drift-error.d.mts.map +1 -1
  320. package/esm/errors/orchestrator-drift-error.mjs +1 -1
  321. package/esm/errors/orchestrator-drift-error.mjs.map +1 -1
  322. package/esm/errors/orchestrator-failed-error.d.mts +1 -1
  323. package/esm/errors/orchestrator-failed-error.d.mts.map +1 -1
  324. package/esm/errors/orchestrator-failed-error.mjs +1 -1
  325. package/esm/errors/orchestrator-failed-error.mjs.map +1 -1
  326. package/esm/errors/outbound-policy-error.d.mts +1 -1
  327. package/esm/errors/outbound-policy-error.d.mts.map +1 -1
  328. package/esm/errors/outbound-policy-error.mjs +1 -1
  329. package/esm/errors/outbound-policy-error.mjs.map +1 -1
  330. package/esm/errors/planner-cancelled-error.d.mts +1 -1
  331. package/esm/errors/planner-cancelled-error.d.mts.map +1 -1
  332. package/esm/errors/planner-cancelled-error.mjs +1 -1
  333. package/esm/errors/planner-cancelled-error.mjs.map +1 -1
  334. package/esm/errors/planner-drift-error.d.mts +1 -1
  335. package/esm/errors/planner-drift-error.d.mts.map +1 -1
  336. package/esm/errors/planner-drift-error.mjs +1 -1
  337. package/esm/errors/planner-drift-error.mjs.map +1 -1
  338. package/esm/errors/planner-failed-error.d.mts +1 -1
  339. package/esm/errors/planner-failed-error.d.mts.map +1 -1
  340. package/esm/errors/planner-failed-error.mjs +1 -1
  341. package/esm/errors/planner-failed-error.mjs.map +1 -1
  342. package/esm/errors/planner-plan-invalid-error.d.mts +1 -1
  343. package/esm/errors/planner-plan-invalid-error.d.mts.map +1 -1
  344. package/esm/errors/planner-plan-invalid-error.mjs +1 -1
  345. package/esm/errors/planner-plan-invalid-error.mjs.map +1 -1
  346. package/esm/errors/prompt-refinement-error.d.mts +1 -1
  347. package/esm/errors/prompt-refinement-error.d.mts.map +1 -1
  348. package/esm/errors/prompt-refinement-error.mjs +1 -1
  349. package/esm/errors/prompt-refinement-error.mjs.map +1 -1
  350. package/esm/errors/provider-auth-error.d.mts +1 -1
  351. package/esm/errors/provider-auth-error.d.mts.map +1 -1
  352. package/esm/errors/provider-auth-error.mjs +1 -1
  353. package/esm/errors/provider-auth-error.mjs.map +1 -1
  354. package/esm/errors/provider-error.d.mts +1 -1
  355. package/esm/errors/provider-error.d.mts.map +1 -1
  356. package/esm/errors/provider-error.mjs +1 -1
  357. package/esm/errors/provider-error.mjs.map +1 -1
  358. package/esm/errors/provider-rate-limit-error.d.mts +1 -1
  359. package/esm/errors/provider-rate-limit-error.d.mts.map +1 -1
  360. package/esm/errors/provider-rate-limit-error.mjs +1 -1
  361. package/esm/errors/provider-rate-limit-error.mjs.map +1 -1
  362. package/esm/errors/provider-timeout-error.d.mts +1 -1
  363. package/esm/errors/provider-timeout-error.d.mts.map +1 -1
  364. package/esm/errors/provider-timeout-error.mjs +1 -1
  365. package/esm/errors/provider-timeout-error.mjs.map +1 -1
  366. package/esm/errors/quota-exceeded-error.d.mts +1 -1
  367. package/esm/errors/quota-exceeded-error.d.mts.map +1 -1
  368. package/esm/errors/quota-exceeded-error.mjs +1 -1
  369. package/esm/errors/quota-exceeded-error.mjs.map +1 -1
  370. package/esm/errors/routing-error.d.mts +1 -1
  371. package/esm/errors/routing-error.d.mts.map +1 -1
  372. package/esm/errors/routing-error.mjs +1 -1
  373. package/esm/errors/routing-error.mjs.map +1 -1
  374. package/esm/errors/schema-validation-error.d.mts +1 -1
  375. package/esm/errors/schema-validation-error.d.mts.map +1 -1
  376. package/esm/errors/schema-validation-error.mjs +1 -1
  377. package/esm/errors/schema-validation-error.mjs.map +1 -1
  378. package/esm/errors/step-failed-error.d.mts +1 -1
  379. package/esm/errors/step-failed-error.d.mts.map +1 -1
  380. package/esm/errors/step-failed-error.mjs +1 -1
  381. package/esm/errors/step-failed-error.mjs.map +1 -1
  382. package/esm/errors/supervisor-cancelled-error.d.mts +1 -1
  383. package/esm/errors/supervisor-cancelled-error.d.mts.map +1 -1
  384. package/esm/errors/supervisor-cancelled-error.mjs +1 -1
  385. package/esm/errors/supervisor-cancelled-error.mjs.map +1 -1
  386. package/esm/errors/supervisor-drift-error.d.mts +1 -1
  387. package/esm/errors/supervisor-drift-error.d.mts.map +1 -1
  388. package/esm/errors/supervisor-drift-error.mjs +1 -1
  389. package/esm/errors/supervisor-drift-error.mjs.map +1 -1
  390. package/esm/errors/supervisor-failed-error.d.mts +1 -1
  391. package/esm/errors/supervisor-failed-error.d.mts.map +1 -1
  392. package/esm/errors/supervisor-failed-error.mjs +1 -1
  393. package/esm/errors/supervisor-failed-error.mjs.map +1 -1
  394. package/esm/errors/supervisor-routing-error.d.mts +1 -1
  395. package/esm/errors/supervisor-routing-error.d.mts.map +1 -1
  396. package/esm/errors/supervisor-routing-error.mjs +1 -1
  397. package/esm/errors/supervisor-routing-error.mjs.map +1 -1
  398. package/esm/errors/tool-execution-error.d.mts +1 -1
  399. package/esm/errors/tool-execution-error.d.mts.map +1 -1
  400. package/esm/errors/tool-execution-error.mjs +1 -1
  401. package/esm/errors/tool-execution-error.mjs.map +1 -1
  402. package/esm/errors/workflow-cancelled-error.d.mts +1 -1
  403. package/esm/errors/workflow-cancelled-error.d.mts.map +1 -1
  404. package/esm/errors/workflow-cancelled-error.mjs +1 -1
  405. package/esm/errors/workflow-cancelled-error.mjs.map +1 -1
  406. package/esm/errors/workflow-drift-error.d.mts +1 -1
  407. package/esm/errors/workflow-drift-error.d.mts.map +1 -1
  408. package/esm/errors/workflow-drift-error.mjs +1 -1
  409. package/esm/errors/workflow-drift-error.mjs.map +1 -1
  410. package/esm/errors/workflow-error.d.mts +1 -1
  411. package/esm/errors/workflow-error.d.mts.map +1 -1
  412. package/esm/errors/workflow-error.mjs +1 -1
  413. package/esm/errors/workflow-error.mjs.map +1 -1
  414. package/esm/eval/dataset.d.mts +1 -1
  415. package/esm/eval/dataset.d.mts.map +1 -1
  416. package/esm/eval/dataset.mjs +1 -1
  417. package/esm/eval/dataset.mjs.map +1 -1
  418. package/esm/eval/dataset.type.d.mts +1 -1
  419. package/esm/eval/dataset.type.d.mts.map +1 -1
  420. package/esm/eval/eval-runner.d.mts +1 -1
  421. package/esm/eval/eval-runner.d.mts.map +1 -1
  422. package/esm/eval/eval-runner.mjs +1 -1
  423. package/esm/eval/eval-runner.mjs.map +1 -1
  424. package/esm/eval/index.d.mts +1 -1
  425. package/esm/eval/index.d.mts.map +1 -1
  426. package/esm/eval/index.mjs +1 -1
  427. package/esm/eval/index.mjs.map +1 -1
  428. package/esm/eval/judge-scorer.d.mts +1 -1
  429. package/esm/eval/judge-scorer.d.mts.map +1 -1
  430. package/esm/eval/judge-scorer.mjs +1 -1
  431. package/esm/eval/judge-scorer.mjs.map +1 -1
  432. package/esm/eval/regression.d.mts +1 -1
  433. package/esm/eval/regression.d.mts.map +1 -1
  434. package/esm/eval/regression.mjs +1 -1
  435. package/esm/eval/regression.mjs.map +1 -1
  436. package/esm/eval/report-json.d.mts +1 -1
  437. package/esm/eval/report-json.d.mts.map +1 -1
  438. package/esm/eval/report-json.mjs +1 -1
  439. package/esm/eval/report-json.mjs.map +1 -1
  440. package/esm/eval/report-junit.d.mts +1 -1
  441. package/esm/eval/report-junit.d.mts.map +1 -1
  442. package/esm/eval/report-junit.mjs +1 -1
  443. package/esm/eval/report-junit.mjs.map +1 -1
  444. package/esm/eval/scorers.d.mts +1 -1
  445. package/esm/eval/scorers.d.mts.map +1 -1
  446. package/esm/eval/scorers.mjs +1 -1
  447. package/esm/eval/scorers.mjs.map +1 -1
  448. package/esm/guard/contracts/guard-options.type.d.mts +1 -1
  449. package/esm/guard/contracts/guard-options.type.d.mts.map +1 -1
  450. package/esm/guard/contracts/guardrail.contract.d.mts +1 -1
  451. package/esm/guard/contracts/guardrail.contract.d.mts.map +1 -1
  452. package/esm/guard/contracts/openai-client.contract.d.mts +1 -1
  453. package/esm/guard/contracts/openai-client.contract.d.mts.map +1 -1
  454. package/esm/guard/contracts/verdict.type.d.mts +1 -1
  455. package/esm/guard/contracts/verdict.type.d.mts.map +1 -1
  456. package/esm/guard/detectors/injection.d.mts +1 -1
  457. package/esm/guard/detectors/injection.d.mts.map +1 -1
  458. package/esm/guard/detectors/injection.mjs +1 -1
  459. package/esm/guard/detectors/injection.mjs.map +1 -1
  460. package/esm/guard/detectors/moderation.d.mts +1 -1
  461. package/esm/guard/detectors/moderation.d.mts.map +1 -1
  462. package/esm/guard/detectors/moderation.mjs +1 -1
  463. package/esm/guard/detectors/moderation.mjs.map +1 -1
  464. package/esm/guard/detectors/pii.d.mts +1 -1
  465. package/esm/guard/detectors/pii.d.mts.map +1 -1
  466. package/esm/guard/detectors/pii.mjs +1 -1
  467. package/esm/guard/detectors/pii.mjs.map +1 -1
  468. package/esm/guard/detectors/topic.d.mts +1 -1
  469. package/esm/guard/detectors/topic.d.mts.map +1 -1
  470. package/esm/guard/detectors/topic.mjs +1 -1
  471. package/esm/guard/detectors/topic.mjs.map +1 -1
  472. package/esm/guard/errors.d.mts +1 -1
  473. package/esm/guard/errors.d.mts.map +1 -1
  474. package/esm/guard/errors.mjs +1 -1
  475. package/esm/guard/errors.mjs.map +1 -1
  476. package/esm/guard/guard.d.mts +1 -1
  477. package/esm/guard/guard.d.mts.map +1 -1
  478. package/esm/guard/guard.mjs +1 -1
  479. package/esm/guard/guard.mjs.map +1 -1
  480. package/esm/guard/guardrail.d.mts +1 -1
  481. package/esm/guard/guardrail.d.mts.map +1 -1
  482. package/esm/guard/guardrail.mjs +1 -1
  483. package/esm/guard/guardrail.mjs.map +1 -1
  484. package/esm/human/contracts/approval.type.d.mts +1 -1
  485. package/esm/human/contracts/approval.type.d.mts.map +1 -1
  486. package/esm/human/contracts/human-approval.type.d.mts +1 -1
  487. package/esm/human/contracts/human-approval.type.d.mts.map +1 -1
  488. package/esm/human/contracts/interrupt-store.contract.d.mts +1 -1
  489. package/esm/human/contracts/interrupt-store.contract.d.mts.map +1 -1
  490. package/esm/human/contracts/resume.type.d.mts +1 -1
  491. package/esm/human/contracts/resume.type.d.mts.map +1 -1
  492. package/esm/human/errors.d.mts +1 -1
  493. package/esm/human/errors.d.mts.map +1 -1
  494. package/esm/human/errors.mjs +1 -1
  495. package/esm/human/errors.mjs.map +1 -1
  496. package/esm/human/human-approval.d.mts +1 -1
  497. package/esm/human/human-approval.d.mts.map +1 -1
  498. package/esm/human/human-approval.mjs +1 -1
  499. package/esm/human/human-approval.mjs.map +1 -1
  500. package/esm/human/policy.d.mts +1 -1
  501. package/esm/human/policy.d.mts.map +1 -1
  502. package/esm/human/policy.mjs +1 -1
  503. package/esm/human/policy.mjs.map +1 -1
  504. package/esm/human/register.mjs +1 -1
  505. package/esm/human/register.mjs.map +1 -1
  506. package/esm/human/resume-seed.mjs +1 -1
  507. package/esm/human/resume-seed.mjs.map +1 -1
  508. package/esm/human/resume.d.mts +1 -1
  509. package/esm/human/resume.d.mts.map +1 -1
  510. package/esm/human/resume.mjs +1 -1
  511. package/esm/human/resume.mjs.map +1 -1
  512. package/esm/human/stores/memory.d.mts +1 -1
  513. package/esm/human/stores/memory.d.mts.map +1 -1
  514. package/esm/human/stores/memory.mjs +1 -1
  515. package/esm/human/stores/memory.mjs.map +1 -1
  516. package/esm/human/stores/pg.d.mts +1 -1
  517. package/esm/human/stores/pg.d.mts.map +1 -1
  518. package/esm/human/stores/pg.mjs +1 -1
  519. package/esm/human/stores/pg.mjs.map +1 -1
  520. package/esm/human/stores/redis.d.mts +1 -1
  521. package/esm/human/stores/redis.d.mts.map +1 -1
  522. package/esm/human/stores/redis.mjs +1 -1
  523. package/esm/human/stores/redis.mjs.map +1 -1
  524. package/esm/image/image-cost.d.mts +1 -1
  525. package/esm/image/image-cost.d.mts.map +1 -1
  526. package/esm/image/image-cost.mjs +1 -1
  527. package/esm/image/image-cost.mjs.map +1 -1
  528. package/esm/image/image.d.mts +1 -1
  529. package/esm/image/image.d.mts.map +1 -1
  530. package/esm/image/image.mjs +1 -1
  531. package/esm/image/image.mjs.map +1 -1
  532. package/esm/memory/derive-id.mjs +1 -1
  533. package/esm/memory/derive-id.mjs.map +1 -1
  534. package/esm/memory/episodic-memory.mjs +1 -1
  535. package/esm/memory/episodic-memory.mjs.map +1 -1
  536. package/esm/memory/memory.d.mts +1 -1
  537. package/esm/memory/memory.d.mts.map +1 -1
  538. package/esm/memory/memory.mjs +1 -1
  539. package/esm/memory/memory.mjs.map +1 -1
  540. package/esm/memory/procedural-memory.mjs +1 -1
  541. package/esm/memory/procedural-memory.mjs.map +1 -1
  542. package/esm/memory/semantic-memory.mjs +1 -1
  543. package/esm/memory/semantic-memory.mjs.map +1 -1
  544. package/esm/memory/working-memory.mjs +1 -1
  545. package/esm/memory/working-memory.mjs.map +1 -1
  546. package/esm/middleware/builtins/budget-contract.type.d.mts +1 -1
  547. package/esm/middleware/builtins/budget-contract.type.d.mts.map +1 -1
  548. package/esm/middleware/builtins/budget.d.mts +1 -1
  549. package/esm/middleware/builtins/budget.d.mts.map +1 -1
  550. package/esm/middleware/builtins/budget.mjs +1 -1
  551. package/esm/middleware/builtins/budget.mjs.map +1 -1
  552. package/esm/middleware/builtins/guardrail.d.mts +1 -1
  553. package/esm/middleware/builtins/guardrail.d.mts.map +1 -1
  554. package/esm/middleware/builtins/guardrail.mjs +1 -1
  555. package/esm/middleware/builtins/guardrail.mjs.map +1 -1
  556. package/esm/middleware/builtins/semantic-cache.d.mts +1 -1
  557. package/esm/middleware/builtins/semantic-cache.d.mts.map +1 -1
  558. package/esm/middleware/builtins/semantic-cache.mjs +1 -1
  559. package/esm/middleware/builtins/semantic-cache.mjs.map +1 -1
  560. package/esm/middleware/helpers/compose.d.mts +1 -1
  561. package/esm/middleware/helpers/compose.d.mts.map +1 -1
  562. package/esm/middleware/helpers/compose.mjs +1 -1
  563. package/esm/middleware/helpers/compose.mjs.map +1 -1
  564. package/esm/middleware/helpers/for-tool.d.mts +1 -1
  565. package/esm/middleware/helpers/for-tool.d.mts.map +1 -1
  566. package/esm/middleware/helpers/for-tool.mjs +1 -1
  567. package/esm/middleware/helpers/for-tool.mjs.map +1 -1
  568. package/esm/middleware/pipeline.d.mts +1 -1
  569. package/esm/middleware/pipeline.d.mts.map +1 -1
  570. package/esm/middleware/pipeline.mjs +1 -1
  571. package/esm/middleware/pipeline.mjs.map +1 -1
  572. package/esm/middleware/utils/extract-user-text.d.mts +1 -1
  573. package/esm/middleware/utils/extract-user-text.d.mts.map +1 -1
  574. package/esm/middleware/utils/extract-user-text.mjs +1 -1
  575. package/esm/middleware/utils/extract-user-text.mjs.map +1 -1
  576. package/esm/middleware/utils/namespaced-state.d.mts +1 -1
  577. package/esm/middleware/utils/namespaced-state.d.mts.map +1 -1
  578. package/esm/middleware/utils/namespaced-state.mjs +1 -1
  579. package/esm/middleware/utils/namespaced-state.mjs.map +1 -1
  580. package/esm/mock/mock-agent.d.mts +1 -1
  581. package/esm/mock/mock-agent.d.mts.map +1 -1
  582. package/esm/mock/mock-agent.mjs +1 -1
  583. package/esm/mock/mock-agent.mjs.map +1 -1
  584. package/esm/mock/mock-config.type.d.mts +1 -1
  585. package/esm/mock/mock-config.type.d.mts.map +1 -1
  586. package/esm/mock/mock-image-model.d.mts +1 -1
  587. package/esm/mock/mock-image-model.d.mts.map +1 -1
  588. package/esm/mock/mock-image-model.mjs +1 -1
  589. package/esm/mock/mock-image-model.mjs.map +1 -1
  590. package/esm/mock/mock-model.d.mts +1 -1
  591. package/esm/mock/mock-model.d.mts.map +1 -1
  592. package/esm/mock/mock-model.mjs +1 -1
  593. package/esm/mock/mock-model.mjs.map +1 -1
  594. package/esm/mock/mock-router.d.mts +1 -1
  595. package/esm/mock/mock-router.d.mts.map +1 -1
  596. package/esm/mock/mock-router.mjs +1 -1
  597. package/esm/mock/mock-router.mjs.map +1 -1
  598. package/esm/mock/mock-sdk.d.mts +1 -1
  599. package/esm/mock/mock-sdk.d.mts.map +1 -1
  600. package/esm/mock/mock-sdk.mjs +1 -1
  601. package/esm/mock/mock-sdk.mjs.map +1 -1
  602. package/esm/mock/mock-speech-model.d.mts +1 -1
  603. package/esm/mock/mock-speech-model.d.mts.map +1 -1
  604. package/esm/mock/mock-speech-model.mjs +1 -1
  605. package/esm/mock/mock-speech-model.mjs.map +1 -1
  606. package/esm/mock/mock-transcription-model.d.mts +1 -1
  607. package/esm/mock/mock-transcription-model.d.mts.map +1 -1
  608. package/esm/mock/mock-transcription-model.mjs +1 -1
  609. package/esm/mock/mock-transcription-model.mjs.map +1 -1
  610. package/esm/model/fallback-model.d.mts +1 -1
  611. package/esm/model/fallback-model.d.mts.map +1 -1
  612. package/esm/model/fallback-model.mjs +1 -1
  613. package/esm/model/fallback-model.mjs.map +1 -1
  614. package/esm/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +1 -1
  615. package/esm/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +1 -1
  616. package/esm/node_modules/@vitest/expect/dist/index.mjs +1 -1
  617. package/esm/node_modules/@vitest/expect/dist/index.mjs.map +1 -1
  618. package/esm/node_modules/@vitest/pretty-format/dist/index.mjs +1 -1
  619. package/esm/node_modules/@vitest/pretty-format/dist/index.mjs.map +1 -1
  620. package/esm/node_modules/@vitest/runner/dist/chunk-artifact.mjs +1 -1
  621. package/esm/node_modules/@vitest/runner/dist/chunk-artifact.mjs.map +1 -1
  622. package/esm/node_modules/@vitest/snapshot/dist/index.mjs +1 -1
  623. package/esm/node_modules/@vitest/snapshot/dist/index.mjs.map +1 -1
  624. package/esm/node_modules/@vitest/spy/dist/index.mjs +1 -1
  625. package/esm/node_modules/@vitest/spy/dist/index.mjs.map +1 -1
  626. package/esm/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs +1 -1
  627. package/esm/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs.map +1 -1
  628. package/esm/node_modules/@vitest/utils/dist/diff.mjs +1 -1
  629. package/esm/node_modules/@vitest/utils/dist/diff.mjs.map +1 -1
  630. package/esm/node_modules/@vitest/utils/dist/display.mjs +1 -1
  631. package/esm/node_modules/@vitest/utils/dist/display.mjs.map +1 -1
  632. package/esm/node_modules/@vitest/utils/dist/error.mjs +1 -1
  633. package/esm/node_modules/@vitest/utils/dist/error.mjs.map +1 -1
  634. package/esm/node_modules/@vitest/utils/dist/helpers.mjs +1 -1
  635. package/esm/node_modules/@vitest/utils/dist/helpers.mjs.map +1 -1
  636. package/esm/node_modules/@vitest/utils/dist/offset.mjs +1 -1
  637. package/esm/node_modules/@vitest/utils/dist/offset.mjs.map +1 -1
  638. package/esm/node_modules/@vitest/utils/dist/serialize.mjs +1 -1
  639. package/esm/node_modules/@vitest/utils/dist/serialize.mjs.map +1 -1
  640. package/esm/node_modules/@vitest/utils/dist/source-map.mjs +1 -1
  641. package/esm/node_modules/@vitest/utils/dist/source-map.mjs.map +1 -1
  642. package/esm/node_modules/@vitest/utils/dist/timers.mjs +1 -1
  643. package/esm/node_modules/@vitest/utils/dist/timers.mjs.map +1 -1
  644. package/esm/node_modules/chai/index.mjs +1 -1
  645. package/esm/node_modules/chai/index.mjs.map +1 -1
  646. package/esm/node_modules/magic-string/dist/magic-string.es.mjs +1 -1
  647. package/esm/node_modules/magic-string/dist/magic-string.es.mjs.map +1 -1
  648. package/esm/node_modules/tinyrainbow/dist/index.mjs +1 -1
  649. package/esm/node_modules/tinyrainbow/dist/index.mjs.map +1 -1
  650. package/esm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs +1 -1
  651. package/esm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs.map +1 -1
  652. package/esm/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs +1 -1
  653. package/esm/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs.map +1 -1
  654. package/esm/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs +1 -1
  655. package/esm/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs.map +1 -1
  656. package/esm/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs +1 -1
  657. package/esm/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs.map +1 -1
  658. package/esm/object-stream/parse-partial-json.d.mts +1 -1
  659. package/esm/object-stream/parse-partial-json.d.mts.map +1 -1
  660. package/esm/object-stream/parse-partial-json.mjs +1 -1
  661. package/esm/object-stream/parse-partial-json.mjs.map +1 -1
  662. package/esm/object-stream/stream-object.d.mts +1 -1
  663. package/esm/object-stream/stream-object.d.mts.map +1 -1
  664. package/esm/object-stream/stream-object.mjs +1 -1
  665. package/esm/object-stream/stream-object.mjs.map +1 -1
  666. package/esm/observe/observer-registry.d.mts +1 -1
  667. package/esm/observe/observer-registry.d.mts.map +1 -1
  668. package/esm/observe/observer-registry.mjs +1 -1
  669. package/esm/observe/observer-registry.mjs.map +1 -1
  670. package/esm/observe/observer.contract.d.mts +1 -1
  671. package/esm/observe/observer.contract.d.mts.map +1 -1
  672. package/esm/observe/resolve-observers.d.mts +1 -1
  673. package/esm/observe/resolve-observers.d.mts.map +1 -1
  674. package/esm/observe/resolve-observers.mjs +1 -1
  675. package/esm/observe/resolve-observers.mjs.map +1 -1
  676. package/esm/orchestrator/as-tool.d.mts +1 -1
  677. package/esm/orchestrator/as-tool.d.mts.map +1 -1
  678. package/esm/orchestrator/as-tool.mjs +1 -1
  679. package/esm/orchestrator/as-tool.mjs.map +1 -1
  680. package/esm/orchestrator/checkpoint.mjs +1 -1
  681. package/esm/orchestrator/checkpoint.mjs.map +1 -1
  682. package/esm/orchestrator/commands.d.mts +1 -1
  683. package/esm/orchestrator/commands.d.mts.map +1 -1
  684. package/esm/orchestrator/commands.mjs +1 -1
  685. package/esm/orchestrator/commands.mjs.map +1 -1
  686. package/esm/orchestrator/compaction.mjs +1 -1
  687. package/esm/orchestrator/compaction.mjs.map +1 -1
  688. package/esm/orchestrator/dispatch.mjs +1 -1
  689. package/esm/orchestrator/dispatch.mjs.map +1 -1
  690. package/esm/orchestrator/emitter-port.type.d.mts +1 -1
  691. package/esm/orchestrator/emitter-port.type.d.mts.map +1 -1
  692. package/esm/orchestrator/emitter.d.mts +1 -1
  693. package/esm/orchestrator/emitter.d.mts.map +1 -1
  694. package/esm/orchestrator/emitter.mjs +1 -1
  695. package/esm/orchestrator/emitter.mjs.map +1 -1
  696. package/esm/orchestrator/engine-context.type.d.mts +1 -1
  697. package/esm/orchestrator/engine-context.type.d.mts.map +1 -1
  698. package/esm/orchestrator/execution.d.mts +1 -1
  699. package/esm/orchestrator/execution.d.mts.map +1 -1
  700. package/esm/orchestrator/execution.mjs +1 -1
  701. package/esm/orchestrator/execution.mjs.map +1 -1
  702. package/esm/orchestrator/load.mjs +1 -1
  703. package/esm/orchestrator/load.mjs.map +1 -1
  704. package/esm/orchestrator/lock.mjs +1 -1
  705. package/esm/orchestrator/lock.mjs.map +1 -1
  706. package/esm/orchestrator/memory.d.mts +1 -1
  707. package/esm/orchestrator/memory.d.mts.map +1 -1
  708. package/esm/orchestrator/memory.mjs +1 -1
  709. package/esm/orchestrator/memory.mjs.map +1 -1
  710. package/esm/orchestrator/orchestrator-stream.d.mts +1 -1
  711. package/esm/orchestrator/orchestrator-stream.d.mts.map +1 -1
  712. package/esm/orchestrator/orchestrator-stream.mjs +1 -1
  713. package/esm/orchestrator/orchestrator-stream.mjs.map +1 -1
  714. package/esm/orchestrator/orchestrator.d.mts +1 -1
  715. package/esm/orchestrator/orchestrator.d.mts.map +1 -1
  716. package/esm/orchestrator/orchestrator.mjs +1 -1
  717. package/esm/orchestrator/orchestrator.mjs.map +1 -1
  718. package/esm/orchestrator/resume.mjs +1 -1
  719. package/esm/orchestrator/resume.mjs.map +1 -1
  720. package/esm/orchestrator/session-lock.d.mts +1 -1
  721. package/esm/orchestrator/session-lock.d.mts.map +1 -1
  722. package/esm/orchestrator/session-lock.mjs +1 -1
  723. package/esm/orchestrator/session-lock.mjs.map +1 -1
  724. package/esm/orchestrator/signature.d.mts +1 -1
  725. package/esm/orchestrator/signature.d.mts.map +1 -1
  726. package/esm/orchestrator/signature.mjs +1 -1
  727. package/esm/orchestrator/signature.mjs.map +1 -1
  728. package/esm/orchestrator/window.mjs +1 -1
  729. package/esm/orchestrator/window.mjs.map +1 -1
  730. package/esm/planner/dag-scheduler.mjs +1 -1
  731. package/esm/planner/dag-scheduler.mjs.map +1 -1
  732. package/esm/planner/plan-prompt.d.mts +1 -1
  733. package/esm/planner/plan-prompt.d.mts.map +1 -1
  734. package/esm/planner/plan-prompt.mjs +1 -1
  735. package/esm/planner/plan-prompt.mjs.map +1 -1
  736. package/esm/planner/plan-schema.d.mts +1 -1
  737. package/esm/planner/plan-schema.d.mts.map +1 -1
  738. package/esm/planner/plan-schema.mjs +1 -1
  739. package/esm/planner/plan-schema.mjs.map +1 -1
  740. package/esm/planner/planner-run.d.mts +1 -1
  741. package/esm/planner/planner-run.d.mts.map +1 -1
  742. package/esm/planner/planner-run.mjs +1 -1
  743. package/esm/planner/planner-run.mjs.map +1 -1
  744. package/esm/planner/planner.d.mts +1 -1
  745. package/esm/planner/planner.d.mts.map +1 -1
  746. package/esm/planner/planner.mjs +1 -1
  747. package/esm/planner/planner.mjs.map +1 -1
  748. package/esm/planner/signature.d.mts +1 -1
  749. package/esm/planner/signature.d.mts.map +1 -1
  750. package/esm/planner/signature.mjs +1 -1
  751. package/esm/planner/signature.mjs.map +1 -1
  752. package/esm/planner/snapshot.mjs +1 -1
  753. package/esm/planner/snapshot.mjs.map +1 -1
  754. package/esm/prompt/errors.d.mts +1 -1
  755. package/esm/prompt/errors.d.mts.map +1 -1
  756. package/esm/prompt/errors.mjs +1 -1
  757. package/esm/prompt/errors.mjs.map +1 -1
  758. package/esm/prompt/prompt-langfuse-sync.mjs +1 -1
  759. package/esm/prompt/prompt-langfuse-sync.mjs.map +1 -1
  760. package/esm/prompt/prompt-langfuse-sync.type.d.mts +1 -1
  761. package/esm/prompt/prompt-langfuse-sync.type.d.mts.map +1 -1
  762. package/esm/prompt/prompt-validate.mjs +1 -1
  763. package/esm/prompt/prompt-validate.mjs.map +1 -1
  764. package/esm/prompt/prompt.d.mts +1 -1
  765. package/esm/prompt/prompt.d.mts.map +1 -1
  766. package/esm/prompt/prompt.mjs +1 -1
  767. package/esm/prompt/prompt.mjs.map +1 -1
  768. package/esm/prompt/prompt.type.d.mts +1 -1
  769. package/esm/prompt/prompt.type.d.mts.map +1 -1
  770. package/esm/prompts/prompts-manager.contract.d.mts +1 -1
  771. package/esm/prompts/prompts-manager.contract.d.mts.map +1 -1
  772. package/esm/prompts/prompts-manager.d.mts +1 -1
  773. package/esm/prompts/prompts-manager.d.mts.map +1 -1
  774. package/esm/prompts/prompts-manager.mjs +1 -1
  775. package/esm/prompts/prompts-manager.mjs.map +1 -1
  776. package/esm/prompts/prompts-manager.type.d.mts +1 -1
  777. package/esm/prompts/prompts-manager.type.d.mts.map +1 -1
  778. package/esm/prompts/prompts-validate.d.mts +1 -1
  779. package/esm/prompts/prompts-validate.d.mts.map +1 -1
  780. package/esm/prompts/prompts-validate.mjs +0 -0
  781. package/esm/prompts/prompts-validate.mjs.map +1 -1
  782. package/esm/rag/as-tool.mjs +1 -1
  783. package/esm/rag/as-tool.mjs.map +1 -1
  784. package/esm/rag/chunk/chunk.d.mts +1 -1
  785. package/esm/rag/chunk/chunk.d.mts.map +1 -1
  786. package/esm/rag/chunk/chunk.mjs +1 -1
  787. package/esm/rag/chunk/chunk.mjs.map +1 -1
  788. package/esm/rag/chunk/fixed.mjs +1 -1
  789. package/esm/rag/chunk/fixed.mjs.map +1 -1
  790. package/esm/rag/chunk/markdown.mjs +1 -1
  791. package/esm/rag/chunk/markdown.mjs.map +1 -1
  792. package/esm/rag/chunk/recursive.mjs +1 -1
  793. package/esm/rag/chunk/recursive.mjs.map +1 -1
  794. package/esm/rag/chunk/sentence.mjs +1 -1
  795. package/esm/rag/chunk/sentence.mjs.map +1 -1
  796. package/esm/rag/contracts/chunk-options.type.d.mts +1 -1
  797. package/esm/rag/contracts/chunk-options.type.d.mts.map +1 -1
  798. package/esm/rag/contracts/citation.type.d.mts +1 -1
  799. package/esm/rag/contracts/citation.type.d.mts.map +1 -1
  800. package/esm/rag/contracts/rag-config.type.d.mts +1 -1
  801. package/esm/rag/contracts/rag-config.type.d.mts.map +1 -1
  802. package/esm/rag/contracts/rag-document.type.d.mts +1 -1
  803. package/esm/rag/contracts/rag-document.type.d.mts.map +1 -1
  804. package/esm/rag/hybrid/bm25.d.mts +1 -1
  805. package/esm/rag/hybrid/bm25.d.mts.map +1 -1
  806. package/esm/rag/hybrid/bm25.mjs +1 -1
  807. package/esm/rag/hybrid/bm25.mjs.map +1 -1
  808. package/esm/rag/hybrid/hybrid-rank.d.mts +1 -1
  809. package/esm/rag/hybrid/hybrid-rank.d.mts.map +1 -1
  810. package/esm/rag/hybrid/hybrid-rank.mjs +1 -1
  811. package/esm/rag/hybrid/hybrid-rank.mjs.map +1 -1
  812. package/esm/rag/hybrid/rrf.d.mts +1 -1
  813. package/esm/rag/hybrid/rrf.d.mts.map +1 -1
  814. package/esm/rag/hybrid/rrf.mjs +1 -1
  815. package/esm/rag/hybrid/rrf.mjs.map +1 -1
  816. package/esm/rag/loaders/errors.d.mts +1 -1
  817. package/esm/rag/loaders/errors.d.mts.map +1 -1
  818. package/esm/rag/loaders/errors.mjs +1 -1
  819. package/esm/rag/loaders/errors.mjs.map +1 -1
  820. package/esm/rag/loaders/load-html.d.mts +1 -1
  821. package/esm/rag/loaders/load-html.d.mts.map +1 -1
  822. package/esm/rag/loaders/load-html.mjs +1 -1
  823. package/esm/rag/loaders/load-html.mjs.map +1 -1
  824. package/esm/rag/loaders/load-pdf.d.mts +1 -1
  825. package/esm/rag/loaders/load-pdf.d.mts.map +1 -1
  826. package/esm/rag/loaders/load-pdf.mjs +1 -1
  827. package/esm/rag/loaders/load-pdf.mjs.map +1 -1
  828. package/esm/rag/loaders/load-text.d.mts +1 -1
  829. package/esm/rag/loaders/load-text.d.mts.map +1 -1
  830. package/esm/rag/loaders/load-text.mjs +1 -1
  831. package/esm/rag/loaders/load-text.mjs.map +1 -1
  832. package/esm/rag/loaders/load-web.d.mts +1 -1
  833. package/esm/rag/loaders/load-web.d.mts.map +1 -1
  834. package/esm/rag/loaders/load-web.mjs +1 -1
  835. package/esm/rag/loaders/load-web.mjs.map +1 -1
  836. package/esm/rag/loaders/loader.type.d.mts +1 -1
  837. package/esm/rag/loaders/loader.type.d.mts.map +1 -1
  838. package/esm/rag/rag.d.mts +1 -1
  839. package/esm/rag/rag.d.mts.map +1 -1
  840. package/esm/rag/rag.mjs +1 -1
  841. package/esm/rag/rag.mjs.map +1 -1
  842. package/esm/rag/rerank/keyword-reranker.d.mts +1 -1
  843. package/esm/rag/rerank/keyword-reranker.d.mts.map +1 -1
  844. package/esm/rag/rerank/keyword-reranker.mjs +1 -1
  845. package/esm/rag/rerank/keyword-reranker.mjs.map +1 -1
  846. package/esm/rag/rerank/llm-reranker.d.mts +1 -1
  847. package/esm/rag/rerank/llm-reranker.d.mts.map +1 -1
  848. package/esm/rag/rerank/llm-reranker.mjs +1 -1
  849. package/esm/rag/rerank/llm-reranker.mjs.map +1 -1
  850. package/esm/rag/rerank/reranker.contract.d.mts +1 -1
  851. package/esm/rag/rerank/reranker.contract.d.mts.map +1 -1
  852. package/esm/rag/retrieve.mjs +1 -1
  853. package/esm/rag/retrieve.mjs.map +1 -1
  854. package/esm/rag/store/cache-vector-store.d.mts +1 -1
  855. package/esm/rag/store/cache-vector-store.d.mts.map +1 -1
  856. package/esm/rag/store/cache-vector-store.mjs +1 -1
  857. package/esm/rag/store/cache-vector-store.mjs.map +1 -1
  858. package/esm/rag/store/pg-vector-store.d.mts +1 -1
  859. package/esm/rag/store/pg-vector-store.d.mts.map +1 -1
  860. package/esm/rag/store/pg-vector-store.mjs +1 -1
  861. package/esm/rag/store/pg-vector-store.mjs.map +1 -1
  862. package/esm/rag/store/vector-store.contract.d.mts +1 -1
  863. package/esm/rag/store/vector-store.contract.d.mts.map +1 -1
  864. package/esm/rag/transforms/multi-query.d.mts +1 -1
  865. package/esm/rag/transforms/multi-query.d.mts.map +1 -1
  866. package/esm/rag/transforms/multi-query.mjs +1 -1
  867. package/esm/rag/transforms/multi-query.mjs.map +1 -1
  868. package/esm/security/outbound-policy.d.mts +1 -1
  869. package/esm/security/outbound-policy.d.mts.map +1 -1
  870. package/esm/security/outbound-policy.mjs +1 -1
  871. package/esm/security/outbound-policy.mjs.map +1 -1
  872. package/esm/security/outbound-policy.type.d.mts +1 -1
  873. package/esm/security/outbound-policy.type.d.mts.map +1 -1
  874. package/esm/security/private-ip.d.mts +1 -1
  875. package/esm/security/private-ip.d.mts.map +1 -1
  876. package/esm/security/private-ip.mjs +1 -1
  877. package/esm/security/private-ip.mjs.map +1 -1
  878. package/esm/security/redact.d.mts +1 -1
  879. package/esm/security/redact.d.mts.map +1 -1
  880. package/esm/security/redact.mjs +1 -1
  881. package/esm/security/redact.mjs.map +1 -1
  882. package/esm/serve/serve.d.mts +1 -1
  883. package/esm/serve/serve.d.mts.map +1 -1
  884. package/esm/serve/serve.mjs +1 -1
  885. package/esm/serve/serve.mjs.map +1 -1
  886. package/esm/serve/sse.d.mts +1 -1
  887. package/esm/serve/sse.d.mts.map +1 -1
  888. package/esm/serve/sse.mjs +1 -1
  889. package/esm/serve/sse.mjs.map +1 -1
  890. package/esm/serve/stream-to-sse.d.mts +1 -1
  891. package/esm/serve/stream-to-sse.d.mts.map +1 -1
  892. package/esm/serve/stream-to-sse.mjs +1 -1
  893. package/esm/serve/stream-to-sse.mjs.map +1 -1
  894. package/esm/skills/catalog.d.mts +1 -1
  895. package/esm/skills/catalog.d.mts.map +1 -1
  896. package/esm/skills/catalog.mjs +1 -1
  897. package/esm/skills/catalog.mjs.map +1 -1
  898. package/esm/skills/contracts/skill-record.type.d.mts +1 -1
  899. package/esm/skills/contracts/skill-record.type.d.mts.map +1 -1
  900. package/esm/skills/contracts/skills-config.type.d.mts +1 -1
  901. package/esm/skills/contracts/skills-config.type.d.mts.map +1 -1
  902. package/esm/skills/contracts/skills-store.contract.d.mts +1 -1
  903. package/esm/skills/contracts/skills-store.contract.d.mts.map +1 -1
  904. package/esm/skills/contracts/skills.contract.d.mts +1 -1
  905. package/esm/skills/contracts/skills.contract.d.mts.map +1 -1
  906. package/esm/skills/load-skill-tool.d.mts +1 -1
  907. package/esm/skills/load-skill-tool.d.mts.map +1 -1
  908. package/esm/skills/load-skill-tool.mjs +1 -1
  909. package/esm/skills/load-skill-tool.mjs.map +1 -1
  910. package/esm/skills/review-gate.d.mts +1 -1
  911. package/esm/skills/review-gate.d.mts.map +1 -1
  912. package/esm/skills/review-gate.mjs +1 -1
  913. package/esm/skills/review-gate.mjs.map +1 -1
  914. package/esm/skills/save-skill-tool.d.mts +1 -1
  915. package/esm/skills/save-skill-tool.d.mts.map +1 -1
  916. package/esm/skills/save-skill-tool.mjs +1 -1
  917. package/esm/skills/save-skill-tool.mjs.map +1 -1
  918. package/esm/skills/skills.d.mts +1 -1
  919. package/esm/skills/skills.d.mts.map +1 -1
  920. package/esm/skills/skills.mjs +1 -1
  921. package/esm/skills/skills.mjs.map +1 -1
  922. package/esm/skills/sources/directory-source.d.mts +1 -1
  923. package/esm/skills/sources/directory-source.d.mts.map +1 -1
  924. package/esm/skills/sources/directory-source.mjs +1 -1
  925. package/esm/skills/sources/directory-source.mjs.map +1 -1
  926. package/esm/skills/sources/index.d.mts +1 -1
  927. package/esm/skills/sources/index.d.mts.map +1 -1
  928. package/esm/skills/sources/index.mjs +1 -1
  929. package/esm/skills/sources/index.mjs.map +1 -1
  930. package/esm/skills/sources/parse-frontmatter.d.mts +1 -1
  931. package/esm/skills/sources/parse-frontmatter.d.mts.map +1 -1
  932. package/esm/skills/sources/parse-frontmatter.mjs +1 -1
  933. package/esm/skills/sources/parse-frontmatter.mjs.map +1 -1
  934. package/esm/skills/sources/store-source.d.mts +1 -1
  935. package/esm/skills/sources/store-source.d.mts.map +1 -1
  936. package/esm/skills/sources/store-source.mjs +1 -1
  937. package/esm/skills/sources/store-source.mjs.map +1 -1
  938. package/esm/skills/sources/url-source.d.mts +1 -1
  939. package/esm/skills/sources/url-source.d.mts.map +1 -1
  940. package/esm/skills/sources/url-source.mjs +1 -1
  941. package/esm/skills/sources/url-source.mjs.map +1 -1
  942. package/esm/skills/store/mock-skills-store.d.mts +1 -1
  943. package/esm/skills/store/mock-skills-store.d.mts.map +1 -1
  944. package/esm/skills/store/mock-skills-store.mjs +1 -1
  945. package/esm/skills/store/mock-skills-store.mjs.map +1 -1
  946. package/esm/skills/store/procedural-skill-store.d.mts +1 -1
  947. package/esm/skills/store/procedural-skill-store.d.mts.map +1 -1
  948. package/esm/skills/store/procedural-skill-store.mjs +1 -1
  949. package/esm/skills/store/procedural-skill-store.mjs.map +1 -1
  950. package/esm/snapshot/memory.d.mts +1 -1
  951. package/esm/snapshot/memory.d.mts.map +1 -1
  952. package/esm/snapshot/memory.mjs +1 -1
  953. package/esm/snapshot/memory.mjs.map +1 -1
  954. package/esm/snapshot/pg.d.mts +1 -1
  955. package/esm/snapshot/pg.d.mts.map +1 -1
  956. package/esm/snapshot/pg.mjs +1 -1
  957. package/esm/snapshot/pg.mjs.map +1 -1
  958. package/esm/snapshot/redis.d.mts +1 -1
  959. package/esm/snapshot/redis.d.mts.map +1 -1
  960. package/esm/snapshot/redis.mjs +1 -1
  961. package/esm/snapshot/redis.mjs.map +1 -1
  962. package/esm/speech/speech.d.mts +1 -1
  963. package/esm/speech/speech.d.mts.map +1 -1
  964. package/esm/speech/speech.mjs +1 -1
  965. package/esm/speech/speech.mjs.map +1 -1
  966. package/esm/supervisor/as-tool.d.mts +1 -1
  967. package/esm/supervisor/as-tool.d.mts.map +1 -1
  968. package/esm/supervisor/as-tool.mjs +1 -1
  969. package/esm/supervisor/as-tool.mjs.map +1 -1
  970. package/esm/supervisor/cancellation.d.mts +1 -1
  971. package/esm/supervisor/cancellation.d.mts.map +1 -1
  972. package/esm/supervisor/cancellation.mjs +1 -1
  973. package/esm/supervisor/cancellation.mjs.map +1 -1
  974. package/esm/supervisor/decide.mjs +1 -1
  975. package/esm/supervisor/decide.mjs.map +1 -1
  976. package/esm/supervisor/emitter.d.mts +1 -1
  977. package/esm/supervisor/emitter.d.mts.map +1 -1
  978. package/esm/supervisor/emitter.mjs +1 -1
  979. package/esm/supervisor/emitter.mjs.map +1 -1
  980. package/esm/supervisor/entries.d.mts +1 -1
  981. package/esm/supervisor/entries.d.mts.map +1 -1
  982. package/esm/supervisor/entries.mjs +1 -1
  983. package/esm/supervisor/entries.mjs.map +1 -1
  984. package/esm/supervisor/execution.d.mts +1 -1
  985. package/esm/supervisor/execution.d.mts.map +1 -1
  986. package/esm/supervisor/execution.mjs +1 -1
  987. package/esm/supervisor/execution.mjs.map +1 -1
  988. package/esm/supervisor/fan-out.d.mts +1 -1
  989. package/esm/supervisor/fan-out.d.mts.map +1 -1
  990. package/esm/supervisor/fan-out.mjs +1 -1
  991. package/esm/supervisor/fan-out.mjs.map +1 -1
  992. package/esm/supervisor/router-factory.d.mts +1 -1
  993. package/esm/supervisor/router-factory.d.mts.map +1 -1
  994. package/esm/supervisor/router-factory.mjs +1 -1
  995. package/esm/supervisor/router-factory.mjs.map +1 -1
  996. package/esm/supervisor/router-prompt.d.mts +1 -1
  997. package/esm/supervisor/router-prompt.d.mts.map +1 -1
  998. package/esm/supervisor/router-prompt.mjs +1 -1
  999. package/esm/supervisor/router-prompt.mjs.map +1 -1
  1000. package/esm/supervisor/signature.d.mts +1 -1
  1001. package/esm/supervisor/signature.d.mts.map +1 -1
  1002. package/esm/supervisor/signature.mjs +1 -1
  1003. package/esm/supervisor/signature.mjs.map +1 -1
  1004. package/esm/supervisor/snapshot.d.mts +1 -1
  1005. package/esm/supervisor/snapshot.d.mts.map +1 -1
  1006. package/esm/supervisor/snapshot.mjs +1 -1
  1007. package/esm/supervisor/snapshot.mjs.map +1 -1
  1008. package/esm/supervisor/supervisor-stream.d.mts +1 -1
  1009. package/esm/supervisor/supervisor-stream.d.mts.map +1 -1
  1010. package/esm/supervisor/supervisor-stream.mjs +1 -1
  1011. package/esm/supervisor/supervisor-stream.mjs.map +1 -1
  1012. package/esm/supervisor/supervisor.d.mts +1 -1
  1013. package/esm/supervisor/supervisor.d.mts.map +1 -1
  1014. package/esm/supervisor/supervisor.mjs +1 -1
  1015. package/esm/supervisor/supervisor.mjs.map +1 -1
  1016. package/esm/system-prompt/instruction.d.mts +1 -1
  1017. package/esm/system-prompt/instruction.d.mts.map +1 -1
  1018. package/esm/system-prompt/instruction.mjs +1 -1
  1019. package/esm/system-prompt/instruction.mjs.map +1 -1
  1020. package/esm/system-prompt/persona.d.mts +1 -1
  1021. package/esm/system-prompt/persona.d.mts.map +1 -1
  1022. package/esm/system-prompt/persona.mjs +1 -1
  1023. package/esm/system-prompt/persona.mjs.map +1 -1
  1024. package/esm/system-prompt/refined-system-prompt.d.mts +1 -1
  1025. package/esm/system-prompt/refined-system-prompt.d.mts.map +1 -1
  1026. package/esm/system-prompt/refined-system-prompt.mjs +1 -1
  1027. package/esm/system-prompt/refined-system-prompt.mjs.map +1 -1
  1028. package/esm/system-prompt/render-placeholders.d.mts +1 -1
  1029. package/esm/system-prompt/render-placeholders.d.mts.map +1 -1
  1030. package/esm/system-prompt/render-placeholders.mjs +1 -1
  1031. package/esm/system-prompt/render-placeholders.mjs.map +1 -1
  1032. package/esm/system-prompt/system-prompt.d.mts +1 -1
  1033. package/esm/system-prompt/system-prompt.d.mts.map +1 -1
  1034. package/esm/system-prompt/system-prompt.mjs +1 -1
  1035. package/esm/system-prompt/system-prompt.mjs.map +1 -1
  1036. package/esm/team/gates.mjs +1 -1
  1037. package/esm/team/gates.mjs.map +1 -1
  1038. package/esm/team/team.d.mts +1 -1
  1039. package/esm/team/team.d.mts.map +1 -1
  1040. package/esm/team/team.mjs +1 -1
  1041. package/esm/team/team.mjs.map +1 -1
  1042. package/esm/testing/matcher-logic.d.mts +1 -1
  1043. package/esm/testing/matcher-logic.d.mts.map +1 -1
  1044. package/esm/testing/matcher-logic.mjs +1 -1
  1045. package/esm/testing/matcher-logic.mjs.map +1 -1
  1046. package/esm/testing/matchers.d.mts +1 -1
  1047. package/esm/testing/matchers.d.mts.map +1 -1
  1048. package/esm/testing/matchers.mjs +1 -1
  1049. package/esm/testing/matchers.mjs.map +1 -1
  1050. package/esm/testing/register-lazy.d.mts +1 -1
  1051. package/esm/testing/register-lazy.d.mts.map +1 -1
  1052. package/esm/testing/register-lazy.mjs +1 -1
  1053. package/esm/testing/register-lazy.mjs.map +1 -1
  1054. package/esm/tool/executable-as-tool.d.mts +1 -1
  1055. package/esm/tool/executable-as-tool.d.mts.map +1 -1
  1056. package/esm/tool/executable-as-tool.mjs +1 -1
  1057. package/esm/tool/executable-as-tool.mjs.map +1 -1
  1058. package/esm/tool/tool.d.mts +1 -1
  1059. package/esm/tool/tool.d.mts.map +1 -1
  1060. package/esm/tool/tool.mjs +1 -1
  1061. package/esm/tool/tool.mjs.map +1 -1
  1062. package/esm/transcribe/audio-input.d.mts +1 -1
  1063. package/esm/transcribe/audio-input.d.mts.map +1 -1
  1064. package/esm/transcribe/audio-input.mjs +1 -1
  1065. package/esm/transcribe/audio-input.mjs.map +1 -1
  1066. package/esm/transcribe/transcribe.d.mts +1 -1
  1067. package/esm/transcribe/transcribe.d.mts.map +1 -1
  1068. package/esm/transcribe/transcribe.mjs +1 -1
  1069. package/esm/transcribe/transcribe.mjs.map +1 -1
  1070. package/esm/utils/compute-cost.d.mts +1 -1
  1071. package/esm/utils/compute-cost.d.mts.map +1 -1
  1072. package/esm/utils/compute-cost.mjs +1 -1
  1073. package/esm/utils/compute-cost.mjs.map +1 -1
  1074. package/esm/utils/extract-json-lenient.d.mts +1 -1
  1075. package/esm/utils/extract-json-lenient.d.mts.map +1 -1
  1076. package/esm/utils/extract-json-lenient.mjs +1 -1
  1077. package/esm/utils/extract-json-lenient.mjs.map +1 -1
  1078. package/esm/utils/extract-json-payload.d.mts +1 -1
  1079. package/esm/utils/extract-json-payload.d.mts.map +1 -1
  1080. package/esm/utils/extract-json-payload.mjs +1 -1
  1081. package/esm/utils/extract-json-payload.mjs.map +1 -1
  1082. package/esm/utils/generate-run-id.d.mts +1 -1
  1083. package/esm/utils/generate-run-id.d.mts.map +1 -1
  1084. package/esm/utils/generate-run-id.mjs +1 -1
  1085. package/esm/utils/generate-run-id.mjs.map +1 -1
  1086. package/esm/utils/json-schema.d.mts +1 -1
  1087. package/esm/utils/json-schema.d.mts.map +1 -1
  1088. package/esm/utils/json-schema.mjs +1 -1
  1089. package/esm/utils/json-schema.mjs.map +1 -1
  1090. package/esm/utils/prepare-attachment-part.d.mts +1 -1
  1091. package/esm/utils/prepare-attachment-part.d.mts.map +1 -1
  1092. package/esm/utils/prepare-attachment-part.mjs +1 -1
  1093. package/esm/utils/prepare-attachment-part.mjs.map +1 -1
  1094. package/esm/utils/resolve-attachment.d.mts +1 -1
  1095. package/esm/utils/resolve-attachment.d.mts.map +1 -1
  1096. package/esm/utils/resolve-attachment.mjs +1 -1
  1097. package/esm/utils/resolve-attachment.mjs.map +1 -1
  1098. package/esm/utils/run-context.d.mts +1 -1
  1099. package/esm/utils/run-context.d.mts.map +1 -1
  1100. package/esm/utils/run-context.mjs +1 -1
  1101. package/esm/utils/run-context.mjs.map +1 -1
  1102. package/esm/utils/safe-json-parse.d.mts +1 -1
  1103. package/esm/utils/safe-json-parse.d.mts.map +1 -1
  1104. package/esm/utils/safe-json-parse.mjs +1 -1
  1105. package/esm/utils/safe-json-parse.mjs.map +1 -1
  1106. package/esm/utils/stamp-report-lineage.d.mts +1 -1
  1107. package/esm/utils/stamp-report-lineage.d.mts.map +1 -1
  1108. package/esm/utils/stamp-report-lineage.mjs +1 -1
  1109. package/esm/utils/stamp-report-lineage.mjs.map +1 -1
  1110. package/esm/utils/token-count.d.mts +1 -1
  1111. package/esm/utils/token-count.d.mts.map +1 -1
  1112. package/esm/utils/token-count.mjs +1 -1
  1113. package/esm/utils/token-count.mjs.map +1 -1
  1114. package/esm/vcr/cassette-io.mjs +1 -1
  1115. package/esm/vcr/cassette-io.mjs.map +1 -1
  1116. package/esm/vcr/errors.d.mts +1 -1
  1117. package/esm/vcr/errors.d.mts.map +1 -1
  1118. package/esm/vcr/errors.mjs +1 -1
  1119. package/esm/vcr/errors.mjs.map +1 -1
  1120. package/esm/vcr/hash-request.d.mts +1 -1
  1121. package/esm/vcr/hash-request.d.mts.map +1 -1
  1122. package/esm/vcr/hash-request.mjs +1 -1
  1123. package/esm/vcr/hash-request.mjs.map +1 -1
  1124. package/esm/vcr/vcr.d.mts +1 -1
  1125. package/esm/vcr/vcr.d.mts.map +1 -1
  1126. package/esm/vcr/vcr.mjs +1 -1
  1127. package/esm/vcr/vcr.mjs.map +1 -1
  1128. package/esm/vcr/vcr.type.d.mts +1 -1
  1129. package/esm/vcr/vcr.type.d.mts.map +1 -1
  1130. package/esm/workflow/as-tool.mjs +1 -1
  1131. package/esm/workflow/as-tool.mjs.map +1 -1
  1132. package/esm/workflow/cancellation.mjs +1 -1
  1133. package/esm/workflow/cancellation.mjs.map +1 -1
  1134. package/esm/workflow/emitter.mjs +1 -1
  1135. package/esm/workflow/emitter.mjs.map +1 -1
  1136. package/esm/workflow/engine.mjs +5 -2
  1137. package/esm/workflow/engine.mjs.map +1 -1
  1138. package/esm/workflow/retry.mjs +1 -1
  1139. package/esm/workflow/retry.mjs.map +1 -1
  1140. package/esm/workflow/router.mjs +1 -1
  1141. package/esm/workflow/router.mjs.map +1 -1
  1142. package/esm/workflow/run-scoped-emitter.mjs +1 -1
  1143. package/esm/workflow/run-scoped-emitter.mjs.map +1 -1
  1144. package/esm/workflow/signature.d.mts +1 -1
  1145. package/esm/workflow/signature.d.mts.map +1 -1
  1146. package/esm/workflow/signature.mjs +1 -1
  1147. package/esm/workflow/signature.mjs.map +1 -1
  1148. package/esm/workflow/snapshot.mjs +1 -1
  1149. package/esm/workflow/snapshot.mjs.map +1 -1
  1150. package/esm/workflow/state.mjs +1 -1
  1151. package/esm/workflow/state.mjs.map +1 -1
  1152. package/esm/workflow/step-runner.mjs +25 -6
  1153. package/esm/workflow/step-runner.mjs.map +1 -1
  1154. package/esm/workflow/step.d.mts +1 -1
  1155. package/esm/workflow/step.d.mts.map +1 -1
  1156. package/esm/workflow/step.mjs +1 -1
  1157. package/esm/workflow/step.mjs.map +1 -1
  1158. package/esm/workflow/workflow.d.mts +1 -1
  1159. package/esm/workflow/workflow.d.mts.map +1 -1
  1160. package/esm/workflow/workflow.mjs +1 -1
  1161. package/esm/workflow/workflow.mjs.map +1 -1
  1162. package/llms-full.txt +23 -2
  1163. package/package.json +4 -4
  1164. package/skills/observe-ai-flows/SKILL.md +2 -2
  1165. package/skills/run-ai-workflow/SKILL.md +19 -0
  1166. package/skills/run-supervisor/SKILL.md +2 -0
  1167. package/cjs/magic-string.es-BtxW4VqG.cjs.map +0 -1
  1168. package/cjs/matcher-logic-SBnzYohQ.cjs.map +0 -1
  1169. package/cjs/matchers-BBh3gyB-.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- //#region ../@warlock.js/ai/src/testing/register-lazy.ts
1
+ //#region ../ai/src/testing/register-lazy.ts
2
2
  /**
3
3
  * Register the `@warlock.js/ai` custom Vitest matchers
4
4
  * (`toRouteTo` / `toConverge` / `toPassStep` / `toOutputShape`) on the
@@ -1 +1 @@
1
- {"version":3,"file":"register-lazy.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/testing/register-lazy.ts"],"sourcesContent":["// Lazy bridge for the vitest-coupled matcher registration.\n//\n// WHY: `@warlock.js/ai`'s root barrel (`src/index.ts`) is the package's\n// only public entry, and it is loaded by every production consumer.\n// `./matchers` statically imports `vitest` (a devDependency) at module\n// top to call `expect.extend`, so pulling it into the eager barrel would\n// force `vitest` to resolve in production — where it is not installed —\n// and crash the import. This wrapper defers that import to call time via\n// a dynamic `import()`, mirroring the package's optional-peer discipline,\n// so `registerAiMatchers` can ship on the root barrel while staying inert\n// (and `vitest`-free) until a test actually invokes it.\n\n/**\n * Register the `@warlock.js/ai` custom Vitest matchers\n * (`toRouteTo` / `toConverge` / `toPassStep` / `toOutputShape`) on the\n * global `expect`. Call once from test code before using them. The\n * underlying `vitest`-coupled implementation is imported lazily on the\n * first call, so importing `@warlock.js/ai` in production never pulls in\n * `vitest`. Idempotent — the underlying registration is itself a no-op on\n * repeat calls.\n *\n * @example\n * import { registerAiMatchers } from \"@warlock.js/ai\";\n * await registerAiMatchers();\n *\n * expect(await supervisor.execute(input)).toRouteTo(\"critic\");\n */\nexport async function registerAiMatchers(): Promise<void> {\n const { registerAiMatchers: register } = await import(\"./matchers\");\n\n register();\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,eAAsB,qBAAoC;CACxD,MAAM,EAAE,oBAAoB,aAAa,MAAM,OAAO;CAEtD,SAAS;AACX"}
1
+ {"version":3,"file":"register-lazy.mjs","names":[],"sources":["../../../../../../../ai/src/testing/register-lazy.ts"],"sourcesContent":["// Lazy bridge for the vitest-coupled matcher registration.\n//\n// WHY: `@warlock.js/ai`'s root barrel (`src/index.ts`) is the package's\n// only public entry, and it is loaded by every production consumer.\n// `./matchers` statically imports `vitest` (a devDependency) at module\n// top to call `expect.extend`, so pulling it into the eager barrel would\n// force `vitest` to resolve in production — where it is not installed —\n// and crash the import. This wrapper defers that import to call time via\n// a dynamic `import()`, mirroring the package's optional-peer discipline,\n// so `registerAiMatchers` can ship on the root barrel while staying inert\n// (and `vitest`-free) until a test actually invokes it.\n\n/**\n * Register the `@warlock.js/ai` custom Vitest matchers\n * (`toRouteTo` / `toConverge` / `toPassStep` / `toOutputShape`) on the\n * global `expect`. Call once from test code before using them. The\n * underlying `vitest`-coupled implementation is imported lazily on the\n * first call, so importing `@warlock.js/ai` in production never pulls in\n * `vitest`. Idempotent — the underlying registration is itself a no-op on\n * repeat calls.\n *\n * @example\n * import { registerAiMatchers } from \"@warlock.js/ai\";\n * await registerAiMatchers();\n *\n * expect(await supervisor.execute(input)).toRouteTo(\"critic\");\n */\nexport async function registerAiMatchers(): Promise<void> {\n const { registerAiMatchers: register } = await import(\"./matchers\");\n\n register();\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,eAAsB,qBAAoC;CACxD,MAAM,EAAE,oBAAoB,aAAa,MAAM,OAAO;CAEtD,SAAS;AACX"}
@@ -4,7 +4,7 @@ import { BaseReport } from "../contracts/result/base-report.type.mjs";
4
4
  import { ToolContract } from "./tool.mjs";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
6
 
7
- //#region ../@warlock.js/ai/src/tool/executable-as-tool.d.ts
7
+ //#region ../ai/src/tool/executable-as-tool.d.ts
8
8
  /**
9
9
  * Envelope every executable's `execute()` resolves to. Agent, workflow,
10
10
  * and supervisor results all satisfy this shape — `data` / `error`
@@ -1 +1 @@
1
- {"version":3,"file":"executable-as-tool.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/tool/executable-as-tool.ts"],"mappings":";;;;;;;;;;AAK4D;;;;KASvD,kBAAA,YAA8B,UAAA;EACjC,IAAA,GAAO,OAAA;EACP,KAAA,GAAQ,OAAA;EACR,MAAA,EAAQ,UAAA;AAAA;;;;;;;;;;AAAU;AAsBpB;;;;;;;;;KAAY,cAAA;EAAA,SACD,IAAA;EAAA,SACA,WAAA;EAAA,SACA,WAAA,GAAc,gBAAA,CAAiB,MAAA;EACxC,OAAA,CAAQ,KAAA,EAAO,MAAA,EAAQ,OAAA,aAAoB,OAAA,CAAQ,kBAAA,CAAmB,OAAA;EACtE,MAAA;AAAA;;;;;;;KASU,cAAA,wCACR,YAAA,CAAa,MAAA,EAAQ,OAAA,IACrB,cAAA,CAAe,MAAA,EAAQ,OAAA;;;;;AAXnB;AASR;;iBA4BgB,gBAAA,CAAiB,KAAA,YAAiB,KAAA,IAAS,cAAc;;;;;;;;;;;;;;iBAuBzD,gBAAA,kBACd,UAAA,EAAY,cAAA,CAAe,MAAA,EAAQ,OAAA,IAClC,YAAA,CAAa,MAAA,EAAQ,OAAA;;;;AAnDU;AA0BlC;;;;;iBA0EgB,mBAAA,CACd,KAAA,EAAO,aAAA,CAAc,cAAA,gBACpB,YAAA"}
1
+ {"version":3,"file":"executable-as-tool.d.mts","names":[],"sources":["../../../../../../../ai/src/tool/executable-as-tool.ts"],"mappings":";;;;;;;;;;AAK4D;;;;KASvD,kBAAA,YAA8B,UAAA;EACjC,IAAA,GAAO,OAAA;EACP,KAAA,GAAQ,OAAA;EACR,MAAA,EAAQ,UAAA;AAAA;;;;;;;;;;AAAU;AAsBpB;;;;;;;;;KAAY,cAAA;EAAA,SACD,IAAA;EAAA,SACA,WAAA;EAAA,SACA,WAAA,GAAc,gBAAA,CAAiB,MAAA;EACxC,OAAA,CAAQ,KAAA,EAAO,MAAA,EAAQ,OAAA,aAAoB,OAAA,CAAQ,kBAAA,CAAmB,OAAA;EACtE,MAAA;AAAA;;;;;;;KASU,cAAA,wCACR,YAAA,CAAa,MAAA,EAAQ,OAAA,IACrB,cAAA,CAAe,MAAA,EAAQ,OAAA;;;;;AAXnB;AASR;;iBA4BgB,gBAAA,CAAiB,KAAA,YAAiB,KAAA,IAAS,cAAc;;;;;;;;;;;;;;iBAuBzD,gBAAA,kBACd,UAAA,EAAY,cAAA,CAAe,MAAA,EAAQ,OAAA,IAClC,YAAA,CAAa,MAAA,EAAQ,OAAA;;;;AAnDU;AA0BlC;;;;;iBA0EgB,mBAAA,CACd,KAAA,EAAO,aAAA,CAAc,cAAA,gBACpB,YAAA"}
@@ -2,7 +2,7 @@ import { AgentExecutionError } from "../errors/agent-execution-error.mjs";
2
2
  import "../errors/index.mjs";
3
3
  import { compositeAsTool } from "./tool.mjs";
4
4
 
5
- //#region ../@warlock.js/ai/src/tool/executable-as-tool.ts
5
+ //#region ../ai/src/tool/executable-as-tool.ts
6
6
  /**
7
7
  * Identity passthrough schema used when an executable is registered as
8
8
  * a tool without declaring an `inputSchema`. The model's raw arguments
@@ -1 +1 @@
1
- {"version":3,"file":"executable-as-tool.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/tool/executable-as-tool.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { BaseReport } from \"../contracts/result/base-report.type\";\nimport type { BaseResult } from \"../contracts/result/base-result.type\";\nimport type { Usage } from \"../contracts/result/usage.type\";\nimport { AgentExecutionError, type AIError } from \"../errors\";\nimport { compositeAsTool, type ToolContract } from \"./tool\";\n\n/**\n * Envelope every executable's `execute()` resolves to. Agent, workflow,\n * and supervisor results all satisfy this shape — `data` / `error`\n * carry the outcome while `usage` and `report` are always present —\n * which is exactly what {@link compositeAsTool} needs to nest the inner\n * run under the outer tool-call node.\n */\ntype ExecutableEnvelope<TOutput> = BaseResult & {\n data?: TOutput;\n error?: AIError;\n report: BaseReport;\n};\n\n/**\n * Structural view of an executable primitive (agent / workflow /\n * supervisor) when it is dropped straight into an agent's `tools: []`\n * array WITHOUT being wrapped via `.asTool()` first.\n *\n * Only the fields the auto-adapt path reads are declared:\n * - `name` — becomes the LLM tool name (required; anonymous executables\n * are rejected at author time, mirroring `.asTool()`).\n * - `description` — the \"when would the model pick this?\" line.\n * - `inputSchema` — opt-in Standard Schema typing the tool's arguments.\n * Surfaced on `WorkflowInstance` / `SupervisorContract` from the new\n * optional `inputSchema` config field. Absent for agents (which take\n * a plain string prompt).\n * - `execute` — the dispatch entry every `ExecutableContract` exposes.\n *\n * `invoke` is declared `never` so a `ToolContract` (which HAS `invoke`)\n * can never be mistaken for an executable by the {@link isExecutableTool}\n * guard.\n */\nexport type ExecutableTool<TInput = unknown, TOutput = unknown> = {\n readonly name: string;\n readonly description?: string;\n readonly inputSchema?: StandardSchemaV1<TInput>;\n execute(input: TInput, options?: unknown): Promise<ExecutableEnvelope<TOutput>>;\n invoke?: never;\n};\n\n/**\n * Entry accepted in an agent's `tools: []` array — either an already-\n * built `ToolContract` (the `.asTool()` / `ai.tool()` path) or a raw\n * executable primitive the framework auto-adapts on the caller's\n * behalf.\n */\nexport type AgentToolEntry<TInput = unknown, TOutput = unknown> =\n | ToolContract<TInput, TOutput>\n | ExecutableTool<TInput, TOutput>;\n\n/**\n * Identity passthrough schema used when an executable is registered as\n * a tool without declaring an `inputSchema`. The model's raw arguments\n * flow straight to `execute()` unchanged — the executable validates\n * internally (workflows via their steps, supervisors/agents via their\n * own input handling).\n */\nfunction passthroughSchema<TInput>(): StandardSchemaV1<TInput> {\n return {\n \"~standard\": {\n version: 1,\n vendor: \"warlock-ai\",\n validate: (value: unknown) => ({ value: value as TInput }),\n },\n };\n}\n\n/**\n * Type guard distinguishing a raw executable primitive from a built\n * `ToolContract`. An executable exposes `execute()` and no `invoke()`;\n * a `ToolContract` exposes `invoke()`. The `invoke` check is the\n * load-bearing discriminator — `.asTool()`-wrapped composites keep\n * their own `execute` too, so checking `execute` alone is insufficient.\n */\nexport function isExecutableTool(entry: unknown): entry is ExecutableTool {\n if (!entry || typeof entry !== \"object\") {\n return false;\n }\n\n const candidate = entry as { execute?: unknown; invoke?: unknown };\n\n return typeof candidate.execute === \"function\" && typeof candidate.invoke !== \"function\";\n}\n\n/**\n * Adapt a raw executable primitive (agent / workflow / supervisor) into\n * a `ToolContract` so an agent can dispatch it inside its tool-call\n * loop WITHOUT the caller writing `.asTool()`. Derives the LLM tool\n * manifest from the executable's own `name` + `description` +\n * (optional) `inputSchema`, then dispatches through the executable's\n * `execute()` — the inner report nests under the outer tool-call node\n * exactly like an explicit `.asTool()` wrapper.\n *\n * Throws `AgentExecutionError` at author time when the executable lacks\n * a usable `name` — the agent's tool surface needs a stable id, the\n * same constraint `.asTool()` enforces.\n */\nexport function executableToTool<TInput, TOutput>(\n executable: ExecutableTool<TInput, TOutput>,\n): ToolContract<TInput, TOutput> {\n if (!executable.name || typeof executable.name !== \"string\") {\n throw new AgentExecutionError(\n \"tools[]: an executable (agent/workflow/supervisor) used as a tool must have a `name`\",\n { context: { authoring: true } },\n );\n }\n\n return compositeAsTool<TInput, TOutput>({\n name: executable.name,\n description: executable.description ?? `Invoke \"${executable.name}\" as a tool.`,\n input: executable.inputSchema ?? passthroughSchema<TInput>(),\n execute: async (input, ctx) => {\n // Relay the outer run's cancellation signal so a cancelled parent\n // aborts this nested agent/workflow/supervisor (C2). Omit the\n // options object entirely when there's no signal so primitives that\n // treat any second arg as meaningful stay byte-identical.\n const result = await executable.execute(\n input,\n ctx?.signal ? { signal: ctx.signal } : undefined,\n );\n\n if (result.error) {\n // Surface the inner typed error so the surrounding\n // `compositeAsTool` wrapper produces a `ToolExecutionError`\n // with `cause` pointing back at the original subclass — the\n // agent's tool-call loop sees one uniform error class\n // regardless of which primitive failed.\n throw result.error;\n }\n\n return {\n data: result.data as TOutput,\n usage: result.usage as Usage,\n report: result.report,\n };\n },\n });\n}\n\n/**\n * Normalize an agent's `tools: []` array into a uniform\n * `ToolContract[]` for the runtime. Already-built `ToolContract`s\n * (`.asTool()` / `ai.tool()`) pass through untouched; raw executable\n * primitives are auto-adapted via {@link executableToTool}.\n *\n * Returns `undefined` when no tools were supplied so the agent's\n * existing `config.tools ?? []` fallbacks stay byte-identical.\n */\nexport function normalizeAgentTools(\n tools: ReadonlyArray<AgentToolEntry> | undefined,\n): ToolContract<unknown, unknown>[] | undefined {\n if (!tools) {\n return undefined;\n }\n\n return tools.map((entry) => {\n if (isExecutableTool(entry)) {\n return executableToTool(entry) as ToolContract<unknown, unknown>;\n }\n\n return entry as ToolContract<unknown, unknown>;\n });\n}\n"],"mappings":";;;;;;;;;;;;AAgEA,SAAS,oBAAsD;CAC7D,OAAO,EACL,aAAa;EACX,SAAS;EACT,QAAQ;EACR,WAAW,WAAoB,EAAS,MAAgB;CAC1D,EACF;AACF;;;;;;;;AASA,SAAgB,iBAAiB,OAAyC;CACxE,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO;CAGT,MAAM,YAAY;CAElB,OAAO,OAAO,UAAU,YAAY,cAAc,OAAO,UAAU,WAAW;AAChF;;;;;;;;;;;;;;AAeA,SAAgB,iBACd,YAC+B;CAC/B,IAAI,CAAC,WAAW,QAAQ,OAAO,WAAW,SAAS,UACjD,MAAM,IAAI,oBACR,wFACA,EAAE,SAAS,EAAE,WAAW,KAAK,EAAE,CACjC;CAGF,OAAO,gBAAiC;EACtC,MAAM,WAAW;EACjB,aAAa,WAAW,eAAe,WAAW,WAAW,KAAK;EAClE,OAAO,WAAW,eAAe,kBAA0B;EAC3D,SAAS,OAAO,OAAO,QAAQ;GAK7B,MAAM,SAAS,MAAM,WAAW,QAC9B,OACA,KAAK,SAAS,EAAE,QAAQ,IAAI,OAAO,IAAI,MACzC;GAEA,IAAI,OAAO,OAMT,MAAM,OAAO;GAGf,OAAO;IACL,MAAM,OAAO;IACb,OAAO,OAAO;IACd,QAAQ,OAAO;GACjB;EACF;CACF,CAAC;AACH;;;;;;;;;;AAWA,SAAgB,oBACd,OAC8C;CAC9C,IAAI,CAAC,OACH;CAGF,OAAO,MAAM,KAAK,UAAU;EAC1B,IAAI,iBAAiB,KAAK,GACxB,OAAO,iBAAiB,KAAK;EAG/B,OAAO;CACT,CAAC;AACH"}
1
+ {"version":3,"file":"executable-as-tool.mjs","names":[],"sources":["../../../../../../../ai/src/tool/executable-as-tool.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { BaseReport } from \"../contracts/result/base-report.type\";\nimport type { BaseResult } from \"../contracts/result/base-result.type\";\nimport type { Usage } from \"../contracts/result/usage.type\";\nimport { AgentExecutionError, type AIError } from \"../errors\";\nimport { compositeAsTool, type ToolContract } from \"./tool\";\n\n/**\n * Envelope every executable's `execute()` resolves to. Agent, workflow,\n * and supervisor results all satisfy this shape — `data` / `error`\n * carry the outcome while `usage` and `report` are always present —\n * which is exactly what {@link compositeAsTool} needs to nest the inner\n * run under the outer tool-call node.\n */\ntype ExecutableEnvelope<TOutput> = BaseResult & {\n data?: TOutput;\n error?: AIError;\n report: BaseReport;\n};\n\n/**\n * Structural view of an executable primitive (agent / workflow /\n * supervisor) when it is dropped straight into an agent's `tools: []`\n * array WITHOUT being wrapped via `.asTool()` first.\n *\n * Only the fields the auto-adapt path reads are declared:\n * - `name` — becomes the LLM tool name (required; anonymous executables\n * are rejected at author time, mirroring `.asTool()`).\n * - `description` — the \"when would the model pick this?\" line.\n * - `inputSchema` — opt-in Standard Schema typing the tool's arguments.\n * Surfaced on `WorkflowInstance` / `SupervisorContract` from the new\n * optional `inputSchema` config field. Absent for agents (which take\n * a plain string prompt).\n * - `execute` — the dispatch entry every `ExecutableContract` exposes.\n *\n * `invoke` is declared `never` so a `ToolContract` (which HAS `invoke`)\n * can never be mistaken for an executable by the {@link isExecutableTool}\n * guard.\n */\nexport type ExecutableTool<TInput = unknown, TOutput = unknown> = {\n readonly name: string;\n readonly description?: string;\n readonly inputSchema?: StandardSchemaV1<TInput>;\n execute(input: TInput, options?: unknown): Promise<ExecutableEnvelope<TOutput>>;\n invoke?: never;\n};\n\n/**\n * Entry accepted in an agent's `tools: []` array — either an already-\n * built `ToolContract` (the `.asTool()` / `ai.tool()` path) or a raw\n * executable primitive the framework auto-adapts on the caller's\n * behalf.\n */\nexport type AgentToolEntry<TInput = unknown, TOutput = unknown> =\n | ToolContract<TInput, TOutput>\n | ExecutableTool<TInput, TOutput>;\n\n/**\n * Identity passthrough schema used when an executable is registered as\n * a tool without declaring an `inputSchema`. The model's raw arguments\n * flow straight to `execute()` unchanged — the executable validates\n * internally (workflows via their steps, supervisors/agents via their\n * own input handling).\n */\nfunction passthroughSchema<TInput>(): StandardSchemaV1<TInput> {\n return {\n \"~standard\": {\n version: 1,\n vendor: \"warlock-ai\",\n validate: (value: unknown) => ({ value: value as TInput }),\n },\n };\n}\n\n/**\n * Type guard distinguishing a raw executable primitive from a built\n * `ToolContract`. An executable exposes `execute()` and no `invoke()`;\n * a `ToolContract` exposes `invoke()`. The `invoke` check is the\n * load-bearing discriminator — `.asTool()`-wrapped composites keep\n * their own `execute` too, so checking `execute` alone is insufficient.\n */\nexport function isExecutableTool(entry: unknown): entry is ExecutableTool {\n if (!entry || typeof entry !== \"object\") {\n return false;\n }\n\n const candidate = entry as { execute?: unknown; invoke?: unknown };\n\n return typeof candidate.execute === \"function\" && typeof candidate.invoke !== \"function\";\n}\n\n/**\n * Adapt a raw executable primitive (agent / workflow / supervisor) into\n * a `ToolContract` so an agent can dispatch it inside its tool-call\n * loop WITHOUT the caller writing `.asTool()`. Derives the LLM tool\n * manifest from the executable's own `name` + `description` +\n * (optional) `inputSchema`, then dispatches through the executable's\n * `execute()` — the inner report nests under the outer tool-call node\n * exactly like an explicit `.asTool()` wrapper.\n *\n * Throws `AgentExecutionError` at author time when the executable lacks\n * a usable `name` — the agent's tool surface needs a stable id, the\n * same constraint `.asTool()` enforces.\n */\nexport function executableToTool<TInput, TOutput>(\n executable: ExecutableTool<TInput, TOutput>,\n): ToolContract<TInput, TOutput> {\n if (!executable.name || typeof executable.name !== \"string\") {\n throw new AgentExecutionError(\n \"tools[]: an executable (agent/workflow/supervisor) used as a tool must have a `name`\",\n { context: { authoring: true } },\n );\n }\n\n return compositeAsTool<TInput, TOutput>({\n name: executable.name,\n description: executable.description ?? `Invoke \"${executable.name}\" as a tool.`,\n input: executable.inputSchema ?? passthroughSchema<TInput>(),\n execute: async (input, ctx) => {\n // Relay the outer run's cancellation signal so a cancelled parent\n // aborts this nested agent/workflow/supervisor (C2). Omit the\n // options object entirely when there's no signal so primitives that\n // treat any second arg as meaningful stay byte-identical.\n const result = await executable.execute(\n input,\n ctx?.signal ? { signal: ctx.signal } : undefined,\n );\n\n if (result.error) {\n // Surface the inner typed error so the surrounding\n // `compositeAsTool` wrapper produces a `ToolExecutionError`\n // with `cause` pointing back at the original subclass — the\n // agent's tool-call loop sees one uniform error class\n // regardless of which primitive failed.\n throw result.error;\n }\n\n return {\n data: result.data as TOutput,\n usage: result.usage as Usage,\n report: result.report,\n };\n },\n });\n}\n\n/**\n * Normalize an agent's `tools: []` array into a uniform\n * `ToolContract[]` for the runtime. Already-built `ToolContract`s\n * (`.asTool()` / `ai.tool()`) pass through untouched; raw executable\n * primitives are auto-adapted via {@link executableToTool}.\n *\n * Returns `undefined` when no tools were supplied so the agent's\n * existing `config.tools ?? []` fallbacks stay byte-identical.\n */\nexport function normalizeAgentTools(\n tools: ReadonlyArray<AgentToolEntry> | undefined,\n): ToolContract<unknown, unknown>[] | undefined {\n if (!tools) {\n return undefined;\n }\n\n return tools.map((entry) => {\n if (isExecutableTool(entry)) {\n return executableToTool(entry) as ToolContract<unknown, unknown>;\n }\n\n return entry as ToolContract<unknown, unknown>;\n });\n}\n"],"mappings":";;;;;;;;;;;;AAgEA,SAAS,oBAAsD;CAC7D,OAAO,EACL,aAAa;EACX,SAAS;EACT,QAAQ;EACR,WAAW,WAAoB,EAAS,MAAgB;CAC1D,EACF;AACF;;;;;;;;AASA,SAAgB,iBAAiB,OAAyC;CACxE,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO;CAGT,MAAM,YAAY;CAElB,OAAO,OAAO,UAAU,YAAY,cAAc,OAAO,UAAU,WAAW;AAChF;;;;;;;;;;;;;;AAeA,SAAgB,iBACd,YAC+B;CAC/B,IAAI,CAAC,WAAW,QAAQ,OAAO,WAAW,SAAS,UACjD,MAAM,IAAI,oBACR,wFACA,EAAE,SAAS,EAAE,WAAW,KAAK,EAAE,CACjC;CAGF,OAAO,gBAAiC;EACtC,MAAM,WAAW;EACjB,aAAa,WAAW,eAAe,WAAW,WAAW,KAAK;EAClE,OAAO,WAAW,eAAe,kBAA0B;EAC3D,SAAS,OAAO,OAAO,QAAQ;GAK7B,MAAM,SAAS,MAAM,WAAW,QAC9B,OACA,KAAK,SAAS,EAAE,QAAQ,IAAI,OAAO,IAAI,MACzC;GAEA,IAAI,OAAO,OAMT,MAAM,OAAO;GAGf,OAAO;IACL,MAAM,OAAO;IACb,OAAO,OAAO;IACd,QAAQ,OAAO;GACjB;EACF;CACF,CAAC;AACH;;;;;;;;;;AAWA,SAAgB,oBACd,OAC8C;CAC9C,IAAI,CAAC,OACH;CAGF,OAAO,MAAM,KAAK,UAAU;EAC1B,IAAI,iBAAiB,KAAK,GACxB,OAAO,iBAAiB,KAAK;EAG/B,OAAO;CACT,CAAC;AACH"}
@@ -4,7 +4,7 @@ import { BaseReport } from "../contracts/result/base-report.type.mjs";
4
4
  import { ToolConfig, ToolContext } from "../contracts/tool.contract.mjs";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
6
 
7
- //#region ../@warlock.js/ai/src/tool/tool.d.ts
7
+ //#region ../ai/src/tool/tool.d.ts
8
8
  /**
9
9
  * Result returned by `ToolContract.invoke()`.
10
10
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tool.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/tool/tool.ts"],"mappings":";;;;;;;;;;AAwCA;;;;;;;;;;;;;;;;;KAAY,gBAAA;EAQQ,iFANlB,IAAA,GAAO,OAAA,EAgBQ;EAdf,KAAA,GAAQ,OAAA,EAcmB;EAZ3B,KAAA,EAAO,KAAA,EAcP;EAZA,MAAA,EAAQ,UAAA;AAAA;;;;;;;;UAUO,YAAA,8CAA0D,UAAA,CACzE,MAAA,EACA,OAAA;EADA;;;;;;;;;;AAoB8E;AA6JhF;;;;;;EA7JE,MAAA,CAAO,QAAA,WAAmB,GAAA,GAAM,WAAA,GAAc,OAAA,CAAQ,gBAAA,CAAiB,OAAA;AAAA;AAAA,iBA6JzD,IAAA,kBACd,QAAA,EAAU,UAAA,CAAW,MAAA,EAAQ,OAAA,IAC5B,YAAA,CAAa,MAAA,EAAQ,OAAA"}
1
+ {"version":3,"file":"tool.d.mts","names":[],"sources":["../../../../../../../ai/src/tool/tool.ts"],"mappings":";;;;;;;;;;AAwCA;;;;;;;;;;;;;;;;;KAAY,gBAAA;EAQQ,iFANlB,IAAA,GAAO,OAAA,EAgBQ;EAdf,KAAA,GAAQ,OAAA,EAcmB;EAZ3B,KAAA,EAAO,KAAA,EAcP;EAZA,MAAA,EAAQ,UAAA;AAAA;;;;;;;;UAUO,YAAA,8CAA0D,UAAA,CACzE,MAAA,EACA,OAAA;EADA;;;;;;;;;;AAoB8E;AA6JhF;;;;;;EA7JE,MAAA,CAAO,QAAA,WAAmB,GAAA,GAAM,WAAA,GAAc,OAAA,CAAQ,gBAAA,CAAiB,OAAA;AAAA;AAAA,iBA6JzD,IAAA,kBACd,QAAA,EAAU,UAAA,CAAW,MAAA,EAAQ,OAAA,IAC5B,YAAA,CAAa,MAAA,EAAQ,OAAA"}
package/esm/tool/tool.mjs CHANGED
@@ -3,7 +3,7 @@ import { ToolExecutionError } from "../errors/tool-execution-error.mjs";
3
3
  import "../errors/index.mjs";
4
4
  import { generateRunId } from "../utils/generate-run-id.mjs";
5
5
 
6
- //#region ../@warlock.js/ai/src/tool/tool.ts
6
+ //#region ../ai/src/tool/tool.ts
7
7
  /**
8
8
  * Degraded `ToolContext` supplied when no caller threads one through
9
9
  * (`tool.invoke(input)` standalone, batch scripts, tests). Per
@@ -1 +1 @@
1
- {"version":3,"file":"tool.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/tool/tool.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { BaseReport } from \"../contracts/result/base-report.type\";\nimport type { Usage } from \"../contracts/result/usage.type\";\nimport type { ToolConfig, ToolContext } from \"../contracts/tool.contract\";\nimport { AIError, SchemaValidationError, ToolExecutionError } from \"../errors\";\nimport { generateRunId } from \"../utils/generate-run-id\";\n\n/**\n * Degraded `ToolContext` supplied when no caller threads one through\n * (`tool.invoke(input)` standalone, batch scripts, tests). Per\n * decisions §35 — mutations on the empty bag are harmless no-ops;\n * production paths under a supervisor receive a real ctx with the\n * iteration's shared bag.\n */\nfunction defaultToolContext(): ToolContext {\n return { artifacts: {} };\n}\n\nconst EMPTY_USAGE: Usage = Object.freeze({ input: 0, output: 0, total: 0 });\n\n/**\n * Result returned by `ToolContract.invoke()`.\n *\n * **Canonical destructure:** `const { data, usage, report, error }` —\n * matches every other executable (`AgentResult`, `WorkflowResult`,\n * `SupervisorResult`) so parent agents can treat every tool dispatch\n * uniformly.\n *\n * **Shape.** `data` / `error` carry the outcome; `usage` and `report`\n * are always present. For leaf tools, `usage` is zero and `report`\n * is a framework-synthesized {@link BaseReport} (`type: \"tool\"`,\n * `children: []`, real timing) so parents never have to nil-check.\n * For composites wrapped via `asTool()`, `usage` and `report` mirror\n * the inner primitive's — the nested tree lives in `report.children`.\n *\n * @example\n * const result = await myTool.invoke({ city: \"Cairo\" });\n * if (result.error) console.error(result.error.message);\n * else console.log(result.data, result.report.duration);\n */\nexport type ToolInvokeResult<TOutput> = {\n /** Successfully-returned output. Undefined if execution or validation failed. */\n data?: TOutput;\n /** Typed AI error produced by validation or execute(), if any. */\n error?: AIError;\n /** Rolled-up usage (zero for leaf tools, populated for composites). */\n usage: Usage;\n /** Recursive execution report — `report.children` carries nested executables. */\n report: BaseReport;\n};\n\n/**\n * A `ToolConfig` augmented with a safe `invoke()` entry point for the agent runtime.\n *\n * @example\n * const wrapped: ToolContract<{ city: string }, { temp: number }> = tool(contract);\n * const result = await wrapped.invoke({ city: \"Cairo\" });\n */\nexport interface ToolContract<TInput = unknown, TOutput = unknown> extends ToolConfig<\n TInput,\n TOutput\n> {\n /**\n * Agent-runtime entry point. Validates raw input against the tool's schema,\n * calls execute(), catches errors, and reports duration.\n * Never throws — errors surface in the returned `error` field as\n * typed `AIError` subclasses.\n *\n * The optional second argument is a `ToolContext` (Phase 5 /\n * decisions §35) — when supplied, threaded into `execute(input, ctx)`\n * so tools can write system-only side data into `ctx.artifacts`.\n * Standalone callers may omit it; the framework supplies a\n * degraded `{ artifacts: {} }` so single-arg legacy handlers keep\n * working unchanged.\n *\n * @example\n * const result = await myTool.invoke(rawLLMArgs);\n * if (result.error) handleError(result.error);\n */\n invoke(rawInput: unknown, ctx?: ToolContext): Promise<ToolInvokeResult<TOutput>>;\n}\n\n/**\n * Wraps a raw `ToolConfig` and adds a safe `invoke()` method for the agent runtime.\n * The returned object preserves all original contract fields unchanged.\n *\n * Error categorization:\n * - Input schema rejects model args → `SchemaValidationError` (issues preserved).\n * - Schema's `validate()` itself throws → `SchemaValidationError` wrapping the cause.\n * - `execute()` throws → `ToolExecutionError` wrapping the cause.\n *\n * @example\n * const weatherTool = tool({\n * name: \"getWeather\",\n * description: \"Fetch current weather for a city\",\n * input: z.object({ city: z.string() }),\n * execute: async ({ city }) => ({ temp: 72 }),\n * });\n *\n * const result = await weatherTool.invoke({ city: \"Cairo\" });\n */\n/**\n * Internal factory for `asTool()` wrappers on composite primitives\n * (agent / workflow / supervisor). Unlike the public `tool()` factory\n * (which synthesizes a leaf `BaseReport` every time), this variant\n * lets the composite's own `ExecuteResult` flow through: the inner\n * primitive's `report` becomes the sole child of the outer tool-call\n * node, and the inner `usage` is surfaced so parents can roll it up.\n *\n * The caller supplies `execute()` returning `{ data, usage, report }`\n * from the composite's own `execute()` method. Validation failures\n * and thrown errors still produce a synthesized failed leaf report —\n * the inner-report propagation is strictly a success-path concern.\n *\n * Not exported from the package barrel — used by `agent.asTool()`,\n * `workflow.asTool()`, `supervisor.asTool()` only.\n */\nexport function compositeAsTool<TInput, TOutput>(contract: {\n name: string;\n description?: string;\n version?: string;\n meta?: ToolConfig[\"meta\"];\n input: StandardSchemaV1<TInput>;\n /**\n * Runs the underlying composite and returns its full envelope. The\n * optional `ctx` relays the outer run's cancellation `signal` so a\n * cancelled parent aborts the nested primitive instead of letting it\n * outlive the cancellation (C2).\n */\n execute: (input: TInput, ctx?: ToolContext) => Promise<{\n data?: TOutput;\n error?: AIError;\n usage: Usage;\n report: BaseReport;\n }>;\n}): ToolContract<TInput, TOutput> {\n // The underlying `ToolConfig<TInput, TOutput>.execute` is typed as\n // `(input) => Promise<TOutput>`, but composite wrappers return an\n // envelope object instead. Surface a contract-shaped view that\n // extracts `.data` on demand for any code that still treats this\n // like a plain tool.\n const publicExecute = async (input: TInput): Promise<TOutput> => {\n const envelope = await contract.execute(input);\n if (envelope.error) throw envelope.error;\n return envelope.data as TOutput;\n };\n\n return {\n name: contract.name,\n description: contract.description ?? `Composite tool \"${contract.name}\".`,\n meta: contract.meta,\n input: contract.input,\n execute: publicExecute,\n\n async invoke(rawInput: unknown, ctx?: ToolContext): Promise<ToolInvokeResult<TOutput>> {\n // Composite tools (asTool-wrapped agent/workflow/supervisor) run in\n // their own state/scope — the ctx's `artifacts` bag is NOT shared\n // into the inner primitive (an inner supervisor gets a fresh bag).\n // The cancellation `signal`, however, IS relayed (below, into\n // `contract.execute`) so a cancelled outer run aborts the nested\n // primitive instead of letting it outlive the cancellation (C2).\n const startedAtDate = new Date();\n const start = performance.now();\n const runId = generateRunId(\"tool\");\n\n const failLeaf = (error: AIError): ToolInvokeResult<TOutput> => {\n const endedAt = new Date().toISOString();\n const duration = performance.now() - start;\n return {\n error,\n usage: EMPTY_USAGE,\n report: {\n runId,\n rootRunId: runId,\n name: contract.name,\n version: contract.version,\n type: \"tool\",\n status: \"failed\",\n startedAt: startedAtDate.toISOString(),\n endedAt,\n duration,\n usage: EMPTY_USAGE,\n children: [],\n },\n };\n };\n\n let validationResult: StandardSchemaV1.Result<TInput>;\n try {\n const schema = contract.input as StandardSchemaV1<TInput>;\n validationResult = await schema[\"~standard\"].validate(rawInput);\n } catch (thrown) {\n const message = thrown instanceof Error ? thrown.message : String(thrown);\n return failLeaf(\n new SchemaValidationError(\n `Schema validation threw for tool \"${contract.name}\": ${message}`,\n { cause: thrown, context: { toolName: contract.name } },\n ),\n );\n }\n\n if (validationResult.issues) {\n const summary = validationResult.issues.map((issue) => issue.message).join(\"; \");\n return failLeaf(\n new SchemaValidationError(`Validation failed: ${summary}`, {\n issues: validationResult.issues,\n context: { toolName: contract.name },\n }),\n );\n }\n\n try {\n const composite = await contract.execute(validationResult.value, ctx);\n // Surface the inner primitive's full envelope. The outer\n // ToolInvokeResult carries the composite's usage and report\n // verbatim; the agent runtime nests the report as a child of\n // the tool-dispatch node it records.\n return {\n data: composite.data,\n error: composite.error,\n usage: composite.usage,\n report: composite.report,\n };\n } catch (thrown) {\n const message = thrown instanceof Error ? thrown.message : String(thrown);\n return failLeaf(\n new ToolExecutionError(message, {\n cause: thrown,\n toolName: contract.name,\n }),\n );\n }\n },\n };\n}\n\nexport function tool<TInput, TOutput>(\n contract: ToolConfig<TInput, TOutput>,\n): ToolContract<TInput, TOutput> {\n return {\n ...contract,\n\n async invoke(rawInput: unknown, ctx?: ToolContext): Promise<ToolInvokeResult<TOutput>> {\n const startedAtDate = new Date();\n const start = performance.now();\n const runId = generateRunId(\"tool\");\n const handlerCtx = ctx ?? defaultToolContext();\n\n const finish = (partial: { data?: TOutput; error?: AIError }): ToolInvokeResult<TOutput> => {\n const endedAt = new Date().toISOString();\n const duration = performance.now() - start;\n const status: BaseReport[\"status\"] = partial.error ? \"failed\" : \"completed\";\n const report: BaseReport = {\n runId,\n rootRunId: runId,\n name: contract.name,\n version: contract.version,\n type: \"tool\",\n status,\n startedAt: startedAtDate.toISOString(),\n endedAt,\n duration,\n usage: EMPTY_USAGE,\n children: [],\n };\n\n return {\n ...partial,\n usage: EMPTY_USAGE,\n report,\n };\n };\n\n let validationResult: StandardSchemaV1.Result<TInput>;\n if (contract.input) {\n try {\n validationResult = await contract.input[\"~standard\"].validate(rawInput);\n } catch (thrown) {\n const message = thrown instanceof Error ? thrown.message : String(thrown);\n\n return finish({\n error: new SchemaValidationError(\n `Schema validation threw for tool \"${contract.name}\": ${message}`,\n { cause: thrown, context: { toolName: contract.name } },\n ),\n });\n }\n } else {\n // `input` is optional on ToolConfig — this is a no-argument tool\n // (e.g. view_cart, checkout). With no schema there is nothing to\n // validate, so pass the raw model args straight to execute()\n // instead of dereferencing a missing schema's `~standard`.\n validationResult = { value: rawInput as TInput };\n }\n\n if (validationResult.issues) {\n const summary = validationResult.issues.map((issue) => issue.message).join(\"; \");\n\n return finish({\n error: new SchemaValidationError(`Validation failed: ${summary}`, {\n issues: validationResult.issues,\n context: { toolName: contract.name },\n }),\n });\n }\n\n try {\n const output = await contract.execute(validationResult.value, handlerCtx);\n return finish({ data: output });\n } catch (thrown) {\n const message = thrown instanceof Error ? thrown.message : String(thrown);\n\n return finish({\n error: new ToolExecutionError(message, {\n cause: thrown,\n toolName: contract.name,\n }),\n });\n }\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAS,qBAAkC;CACzC,OAAO,EAAE,WAAW,CAAC,EAAE;AACzB;AAEA,MAAM,cAAqB,OAAO,OAAO;CAAE,OAAO;CAAG,QAAQ;CAAG,OAAO;AAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmG1E,SAAgB,gBAAiC,UAkBf;CAMhC,MAAM,gBAAgB,OAAO,UAAoC;EAC/D,MAAM,WAAW,MAAM,SAAS,QAAQ,KAAK;EAC7C,IAAI,SAAS,OAAO,MAAM,SAAS;EACnC,OAAO,SAAS;CAClB;CAEA,OAAO;EACL,MAAM,SAAS;EACf,aAAa,SAAS,eAAe,mBAAmB,SAAS,KAAK;EACtE,MAAM,SAAS;EACf,OAAO,SAAS;EAChB,SAAS;EAET,MAAM,OAAO,UAAmB,KAAuD;GAOrF,MAAM,gCAAgB,IAAI,KAAK;GAC/B,MAAM,QAAQ,YAAY,IAAI;GAC9B,MAAM,QAAQ,cAAc,MAAM;GAElC,MAAM,YAAY,UAA8C;IAC9D,MAAM,2BAAU,IAAI,KAAK,EAAC,CAAC,YAAY;IACvC,MAAM,WAAW,YAAY,IAAI,IAAI;IACrC,OAAO;KACL;KACA,OAAO;KACP,QAAQ;MACN;MACA,WAAW;MACX,MAAM,SAAS;MACf,SAAS,SAAS;MAClB,MAAM;MACN,QAAQ;MACR,WAAW,cAAc,YAAY;MACrC;MACA;MACA,OAAO;MACP,UAAU,CAAC;KACb;IACF;GACF;GAEA,IAAI;GACJ,IAAI;IAEF,mBAAmB,MADJ,SAAS,MACQ,YAAY,CAAC,SAAS,QAAQ;GAChE,SAAS,QAAQ;IACf,MAAM,UAAU,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM;IACxE,OAAO,SACL,IAAI,sBACF,qCAAqC,SAAS,KAAK,KAAK,WACxD;KAAE,OAAO;KAAQ,SAAS,EAAE,UAAU,SAAS,KAAK;IAAE,CACxD,CACF;GACF;GAEA,IAAI,iBAAiB,QAEnB,OAAO,SACL,IAAI,sBAAsB,sBAFZ,iBAAiB,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAEnB,KAAK;IACzD,QAAQ,iBAAiB;IACzB,SAAS,EAAE,UAAU,SAAS,KAAK;GACrC,CAAC,CACH;GAGF,IAAI;IACF,MAAM,YAAY,MAAM,SAAS,QAAQ,iBAAiB,OAAO,GAAG;IAKpE,OAAO;KACL,MAAM,UAAU;KAChB,OAAO,UAAU;KACjB,OAAO,UAAU;KACjB,QAAQ,UAAU;IACpB;GACF,SAAS,QAAQ;IAEf,OAAO,SACL,IAAI,mBAFU,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM,GAEtC;KAC9B,OAAO;KACP,UAAU,SAAS;IACrB,CAAC,CACH;GACF;EACF;CACF;AACF;AAEA,SAAgB,KACd,UAC+B;CAC/B,OAAO;EACL,GAAG;EAEH,MAAM,OAAO,UAAmB,KAAuD;GACrF,MAAM,gCAAgB,IAAI,KAAK;GAC/B,MAAM,QAAQ,YAAY,IAAI;GAC9B,MAAM,QAAQ,cAAc,MAAM;GAClC,MAAM,aAAa,OAAO,mBAAmB;GAE7C,MAAM,UAAU,YAA4E;IAC1F,MAAM,2BAAU,IAAI,KAAK,EAAC,CAAC,YAAY;IACvC,MAAM,WAAW,YAAY,IAAI,IAAI;IACrC,MAAM,SAA+B,QAAQ,QAAQ,WAAW;IAChE,MAAM,SAAqB;KACzB;KACA,WAAW;KACX,MAAM,SAAS;KACf,SAAS,SAAS;KAClB,MAAM;KACN;KACA,WAAW,cAAc,YAAY;KACrC;KACA;KACA,OAAO;KACP,UAAU,CAAC;IACb;IAEA,OAAO;KACL,GAAG;KACH,OAAO;KACP;IACF;GACF;GAEA,IAAI;GACJ,IAAI,SAAS,OACX,IAAI;IACF,mBAAmB,MAAM,SAAS,MAAM,YAAY,CAAC,SAAS,QAAQ;GACxE,SAAS,QAAQ;IACf,MAAM,UAAU,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM;IAExE,OAAO,OAAO,EACZ,OAAO,IAAI,sBACT,qCAAqC,SAAS,KAAK,KAAK,WACxD;KAAE,OAAO;KAAQ,SAAS,EAAE,UAAU,SAAS,KAAK;IAAE,CACxD,EACF,CAAC;GACH;QAMA,mBAAmB,EAAE,OAAO,SAAmB;GAGjD,IAAI,iBAAiB,QAGnB,OAAO,OAAO,EACZ,OAAO,IAAI,sBAAsB,sBAHnB,iBAAiB,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAGZ,KAAK;IAChE,QAAQ,iBAAiB;IACzB,SAAS,EAAE,UAAU,SAAS,KAAK;GACrC,CAAC,EACH,CAAC;GAGH,IAAI;IAEF,OAAO,OAAO,EAAE,MAAM,MADD,SAAS,QAAQ,iBAAiB,OAAO,UAAU,EAC3C,CAAC;GAChC,SAAS,QAAQ;IAGf,OAAO,OAAO,EACZ,OAAO,IAAI,mBAHG,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM,GAG/B;KACrC,OAAO;KACP,UAAU,SAAS;IACrB,CAAC,EACH,CAAC;GACH;EACF;CACF;AACF"}
1
+ {"version":3,"file":"tool.mjs","names":[],"sources":["../../../../../../../ai/src/tool/tool.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { BaseReport } from \"../contracts/result/base-report.type\";\nimport type { Usage } from \"../contracts/result/usage.type\";\nimport type { ToolConfig, ToolContext } from \"../contracts/tool.contract\";\nimport { AIError, SchemaValidationError, ToolExecutionError } from \"../errors\";\nimport { generateRunId } from \"../utils/generate-run-id\";\n\n/**\n * Degraded `ToolContext` supplied when no caller threads one through\n * (`tool.invoke(input)` standalone, batch scripts, tests). Per\n * decisions §35 — mutations on the empty bag are harmless no-ops;\n * production paths under a supervisor receive a real ctx with the\n * iteration's shared bag.\n */\nfunction defaultToolContext(): ToolContext {\n return { artifacts: {} };\n}\n\nconst EMPTY_USAGE: Usage = Object.freeze({ input: 0, output: 0, total: 0 });\n\n/**\n * Result returned by `ToolContract.invoke()`.\n *\n * **Canonical destructure:** `const { data, usage, report, error }` —\n * matches every other executable (`AgentResult`, `WorkflowResult`,\n * `SupervisorResult`) so parent agents can treat every tool dispatch\n * uniformly.\n *\n * **Shape.** `data` / `error` carry the outcome; `usage` and `report`\n * are always present. For leaf tools, `usage` is zero and `report`\n * is a framework-synthesized {@link BaseReport} (`type: \"tool\"`,\n * `children: []`, real timing) so parents never have to nil-check.\n * For composites wrapped via `asTool()`, `usage` and `report` mirror\n * the inner primitive's — the nested tree lives in `report.children`.\n *\n * @example\n * const result = await myTool.invoke({ city: \"Cairo\" });\n * if (result.error) console.error(result.error.message);\n * else console.log(result.data, result.report.duration);\n */\nexport type ToolInvokeResult<TOutput> = {\n /** Successfully-returned output. Undefined if execution or validation failed. */\n data?: TOutput;\n /** Typed AI error produced by validation or execute(), if any. */\n error?: AIError;\n /** Rolled-up usage (zero for leaf tools, populated for composites). */\n usage: Usage;\n /** Recursive execution report — `report.children` carries nested executables. */\n report: BaseReport;\n};\n\n/**\n * A `ToolConfig` augmented with a safe `invoke()` entry point for the agent runtime.\n *\n * @example\n * const wrapped: ToolContract<{ city: string }, { temp: number }> = tool(contract);\n * const result = await wrapped.invoke({ city: \"Cairo\" });\n */\nexport interface ToolContract<TInput = unknown, TOutput = unknown> extends ToolConfig<\n TInput,\n TOutput\n> {\n /**\n * Agent-runtime entry point. Validates raw input against the tool's schema,\n * calls execute(), catches errors, and reports duration.\n * Never throws — errors surface in the returned `error` field as\n * typed `AIError` subclasses.\n *\n * The optional second argument is a `ToolContext` (Phase 5 /\n * decisions §35) — when supplied, threaded into `execute(input, ctx)`\n * so tools can write system-only side data into `ctx.artifacts`.\n * Standalone callers may omit it; the framework supplies a\n * degraded `{ artifacts: {} }` so single-arg legacy handlers keep\n * working unchanged.\n *\n * @example\n * const result = await myTool.invoke(rawLLMArgs);\n * if (result.error) handleError(result.error);\n */\n invoke(rawInput: unknown, ctx?: ToolContext): Promise<ToolInvokeResult<TOutput>>;\n}\n\n/**\n * Wraps a raw `ToolConfig` and adds a safe `invoke()` method for the agent runtime.\n * The returned object preserves all original contract fields unchanged.\n *\n * Error categorization:\n * - Input schema rejects model args → `SchemaValidationError` (issues preserved).\n * - Schema's `validate()` itself throws → `SchemaValidationError` wrapping the cause.\n * - `execute()` throws → `ToolExecutionError` wrapping the cause.\n *\n * @example\n * const weatherTool = tool({\n * name: \"getWeather\",\n * description: \"Fetch current weather for a city\",\n * input: z.object({ city: z.string() }),\n * execute: async ({ city }) => ({ temp: 72 }),\n * });\n *\n * const result = await weatherTool.invoke({ city: \"Cairo\" });\n */\n/**\n * Internal factory for `asTool()` wrappers on composite primitives\n * (agent / workflow / supervisor). Unlike the public `tool()` factory\n * (which synthesizes a leaf `BaseReport` every time), this variant\n * lets the composite's own `ExecuteResult` flow through: the inner\n * primitive's `report` becomes the sole child of the outer tool-call\n * node, and the inner `usage` is surfaced so parents can roll it up.\n *\n * The caller supplies `execute()` returning `{ data, usage, report }`\n * from the composite's own `execute()` method. Validation failures\n * and thrown errors still produce a synthesized failed leaf report —\n * the inner-report propagation is strictly a success-path concern.\n *\n * Not exported from the package barrel — used by `agent.asTool()`,\n * `workflow.asTool()`, `supervisor.asTool()` only.\n */\nexport function compositeAsTool<TInput, TOutput>(contract: {\n name: string;\n description?: string;\n version?: string;\n meta?: ToolConfig[\"meta\"];\n input: StandardSchemaV1<TInput>;\n /**\n * Runs the underlying composite and returns its full envelope. The\n * optional `ctx` relays the outer run's cancellation `signal` so a\n * cancelled parent aborts the nested primitive instead of letting it\n * outlive the cancellation (C2).\n */\n execute: (input: TInput, ctx?: ToolContext) => Promise<{\n data?: TOutput;\n error?: AIError;\n usage: Usage;\n report: BaseReport;\n }>;\n}): ToolContract<TInput, TOutput> {\n // The underlying `ToolConfig<TInput, TOutput>.execute` is typed as\n // `(input) => Promise<TOutput>`, but composite wrappers return an\n // envelope object instead. Surface a contract-shaped view that\n // extracts `.data` on demand for any code that still treats this\n // like a plain tool.\n const publicExecute = async (input: TInput): Promise<TOutput> => {\n const envelope = await contract.execute(input);\n if (envelope.error) throw envelope.error;\n return envelope.data as TOutput;\n };\n\n return {\n name: contract.name,\n description: contract.description ?? `Composite tool \"${contract.name}\".`,\n meta: contract.meta,\n input: contract.input,\n execute: publicExecute,\n\n async invoke(rawInput: unknown, ctx?: ToolContext): Promise<ToolInvokeResult<TOutput>> {\n // Composite tools (asTool-wrapped agent/workflow/supervisor) run in\n // their own state/scope — the ctx's `artifacts` bag is NOT shared\n // into the inner primitive (an inner supervisor gets a fresh bag).\n // The cancellation `signal`, however, IS relayed (below, into\n // `contract.execute`) so a cancelled outer run aborts the nested\n // primitive instead of letting it outlive the cancellation (C2).\n const startedAtDate = new Date();\n const start = performance.now();\n const runId = generateRunId(\"tool\");\n\n const failLeaf = (error: AIError): ToolInvokeResult<TOutput> => {\n const endedAt = new Date().toISOString();\n const duration = performance.now() - start;\n return {\n error,\n usage: EMPTY_USAGE,\n report: {\n runId,\n rootRunId: runId,\n name: contract.name,\n version: contract.version,\n type: \"tool\",\n status: \"failed\",\n startedAt: startedAtDate.toISOString(),\n endedAt,\n duration,\n usage: EMPTY_USAGE,\n children: [],\n },\n };\n };\n\n let validationResult: StandardSchemaV1.Result<TInput>;\n try {\n const schema = contract.input as StandardSchemaV1<TInput>;\n validationResult = await schema[\"~standard\"].validate(rawInput);\n } catch (thrown) {\n const message = thrown instanceof Error ? thrown.message : String(thrown);\n return failLeaf(\n new SchemaValidationError(\n `Schema validation threw for tool \"${contract.name}\": ${message}`,\n { cause: thrown, context: { toolName: contract.name } },\n ),\n );\n }\n\n if (validationResult.issues) {\n const summary = validationResult.issues.map((issue) => issue.message).join(\"; \");\n return failLeaf(\n new SchemaValidationError(`Validation failed: ${summary}`, {\n issues: validationResult.issues,\n context: { toolName: contract.name },\n }),\n );\n }\n\n try {\n const composite = await contract.execute(validationResult.value, ctx);\n // Surface the inner primitive's full envelope. The outer\n // ToolInvokeResult carries the composite's usage and report\n // verbatim; the agent runtime nests the report as a child of\n // the tool-dispatch node it records.\n return {\n data: composite.data,\n error: composite.error,\n usage: composite.usage,\n report: composite.report,\n };\n } catch (thrown) {\n const message = thrown instanceof Error ? thrown.message : String(thrown);\n return failLeaf(\n new ToolExecutionError(message, {\n cause: thrown,\n toolName: contract.name,\n }),\n );\n }\n },\n };\n}\n\nexport function tool<TInput, TOutput>(\n contract: ToolConfig<TInput, TOutput>,\n): ToolContract<TInput, TOutput> {\n return {\n ...contract,\n\n async invoke(rawInput: unknown, ctx?: ToolContext): Promise<ToolInvokeResult<TOutput>> {\n const startedAtDate = new Date();\n const start = performance.now();\n const runId = generateRunId(\"tool\");\n const handlerCtx = ctx ?? defaultToolContext();\n\n const finish = (partial: { data?: TOutput; error?: AIError }): ToolInvokeResult<TOutput> => {\n const endedAt = new Date().toISOString();\n const duration = performance.now() - start;\n const status: BaseReport[\"status\"] = partial.error ? \"failed\" : \"completed\";\n const report: BaseReport = {\n runId,\n rootRunId: runId,\n name: contract.name,\n version: contract.version,\n type: \"tool\",\n status,\n startedAt: startedAtDate.toISOString(),\n endedAt,\n duration,\n usage: EMPTY_USAGE,\n children: [],\n };\n\n return {\n ...partial,\n usage: EMPTY_USAGE,\n report,\n };\n };\n\n let validationResult: StandardSchemaV1.Result<TInput>;\n if (contract.input) {\n try {\n validationResult = await contract.input[\"~standard\"].validate(rawInput);\n } catch (thrown) {\n const message = thrown instanceof Error ? thrown.message : String(thrown);\n\n return finish({\n error: new SchemaValidationError(\n `Schema validation threw for tool \"${contract.name}\": ${message}`,\n { cause: thrown, context: { toolName: contract.name } },\n ),\n });\n }\n } else {\n // `input` is optional on ToolConfig — this is a no-argument tool\n // (e.g. view_cart, checkout). With no schema there is nothing to\n // validate, so pass the raw model args straight to execute()\n // instead of dereferencing a missing schema's `~standard`.\n validationResult = { value: rawInput as TInput };\n }\n\n if (validationResult.issues) {\n const summary = validationResult.issues.map((issue) => issue.message).join(\"; \");\n\n return finish({\n error: new SchemaValidationError(`Validation failed: ${summary}`, {\n issues: validationResult.issues,\n context: { toolName: contract.name },\n }),\n });\n }\n\n try {\n const output = await contract.execute(validationResult.value, handlerCtx);\n return finish({ data: output });\n } catch (thrown) {\n const message = thrown instanceof Error ? thrown.message : String(thrown);\n\n return finish({\n error: new ToolExecutionError(message, {\n cause: thrown,\n toolName: contract.name,\n }),\n });\n }\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAS,qBAAkC;CACzC,OAAO,EAAE,WAAW,CAAC,EAAE;AACzB;AAEA,MAAM,cAAqB,OAAO,OAAO;CAAE,OAAO;CAAG,QAAQ;CAAG,OAAO;AAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmG1E,SAAgB,gBAAiC,UAkBf;CAMhC,MAAM,gBAAgB,OAAO,UAAoC;EAC/D,MAAM,WAAW,MAAM,SAAS,QAAQ,KAAK;EAC7C,IAAI,SAAS,OAAO,MAAM,SAAS;EACnC,OAAO,SAAS;CAClB;CAEA,OAAO;EACL,MAAM,SAAS;EACf,aAAa,SAAS,eAAe,mBAAmB,SAAS,KAAK;EACtE,MAAM,SAAS;EACf,OAAO,SAAS;EAChB,SAAS;EAET,MAAM,OAAO,UAAmB,KAAuD;GAOrF,MAAM,gCAAgB,IAAI,KAAK;GAC/B,MAAM,QAAQ,YAAY,IAAI;GAC9B,MAAM,QAAQ,cAAc,MAAM;GAElC,MAAM,YAAY,UAA8C;IAC9D,MAAM,2BAAU,IAAI,KAAK,EAAC,CAAC,YAAY;IACvC,MAAM,WAAW,YAAY,IAAI,IAAI;IACrC,OAAO;KACL;KACA,OAAO;KACP,QAAQ;MACN;MACA,WAAW;MACX,MAAM,SAAS;MACf,SAAS,SAAS;MAClB,MAAM;MACN,QAAQ;MACR,WAAW,cAAc,YAAY;MACrC;MACA;MACA,OAAO;MACP,UAAU,CAAC;KACb;IACF;GACF;GAEA,IAAI;GACJ,IAAI;IAEF,mBAAmB,MADJ,SAAS,MACQ,YAAY,CAAC,SAAS,QAAQ;GAChE,SAAS,QAAQ;IACf,MAAM,UAAU,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM;IACxE,OAAO,SACL,IAAI,sBACF,qCAAqC,SAAS,KAAK,KAAK,WACxD;KAAE,OAAO;KAAQ,SAAS,EAAE,UAAU,SAAS,KAAK;IAAE,CACxD,CACF;GACF;GAEA,IAAI,iBAAiB,QAEnB,OAAO,SACL,IAAI,sBAAsB,sBAFZ,iBAAiB,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAEnB,KAAK;IACzD,QAAQ,iBAAiB;IACzB,SAAS,EAAE,UAAU,SAAS,KAAK;GACrC,CAAC,CACH;GAGF,IAAI;IACF,MAAM,YAAY,MAAM,SAAS,QAAQ,iBAAiB,OAAO,GAAG;IAKpE,OAAO;KACL,MAAM,UAAU;KAChB,OAAO,UAAU;KACjB,OAAO,UAAU;KACjB,QAAQ,UAAU;IACpB;GACF,SAAS,QAAQ;IAEf,OAAO,SACL,IAAI,mBAFU,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM,GAEtC;KAC9B,OAAO;KACP,UAAU,SAAS;IACrB,CAAC,CACH;GACF;EACF;CACF;AACF;AAEA,SAAgB,KACd,UAC+B;CAC/B,OAAO;EACL,GAAG;EAEH,MAAM,OAAO,UAAmB,KAAuD;GACrF,MAAM,gCAAgB,IAAI,KAAK;GAC/B,MAAM,QAAQ,YAAY,IAAI;GAC9B,MAAM,QAAQ,cAAc,MAAM;GAClC,MAAM,aAAa,OAAO,mBAAmB;GAE7C,MAAM,UAAU,YAA4E;IAC1F,MAAM,2BAAU,IAAI,KAAK,EAAC,CAAC,YAAY;IACvC,MAAM,WAAW,YAAY,IAAI,IAAI;IACrC,MAAM,SAA+B,QAAQ,QAAQ,WAAW;IAChE,MAAM,SAAqB;KACzB;KACA,WAAW;KACX,MAAM,SAAS;KACf,SAAS,SAAS;KAClB,MAAM;KACN;KACA,WAAW,cAAc,YAAY;KACrC;KACA;KACA,OAAO;KACP,UAAU,CAAC;IACb;IAEA,OAAO;KACL,GAAG;KACH,OAAO;KACP;IACF;GACF;GAEA,IAAI;GACJ,IAAI,SAAS,OACX,IAAI;IACF,mBAAmB,MAAM,SAAS,MAAM,YAAY,CAAC,SAAS,QAAQ;GACxE,SAAS,QAAQ;IACf,MAAM,UAAU,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM;IAExE,OAAO,OAAO,EACZ,OAAO,IAAI,sBACT,qCAAqC,SAAS,KAAK,KAAK,WACxD;KAAE,OAAO;KAAQ,SAAS,EAAE,UAAU,SAAS,KAAK;IAAE,CACxD,EACF,CAAC;GACH;QAMA,mBAAmB,EAAE,OAAO,SAAmB;GAGjD,IAAI,iBAAiB,QAGnB,OAAO,OAAO,EACZ,OAAO,IAAI,sBAAsB,sBAHnB,iBAAiB,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAGZ,KAAK;IAChE,QAAQ,iBAAiB;IACzB,SAAS,EAAE,UAAU,SAAS,KAAK;GACrC,CAAC,EACH,CAAC;GAGH,IAAI;IAEF,OAAO,OAAO,EAAE,MAAM,MADD,SAAS,QAAQ,iBAAiB,OAAO,UAAU,EAC3C,CAAC;GAChC,SAAS,QAAQ;IAGf,OAAO,OAAO,EACZ,OAAO,IAAI,mBAHG,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM,GAG/B;KACrC,OAAO;KACP,UAAU,SAAS;IACrB,CAAC,EACH,CAAC;GACH;EACF;CACF;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { AudioInput } from "../contracts/transcription-model.contract.mjs";
2
2
 
3
- //#region ../@warlock.js/ai/src/transcribe/audio-input.d.ts
3
+ //#region ../ai/src/transcribe/audio-input.d.ts
4
4
  /**
5
5
  * Resolve the audio media type from a filename's extension, or
6
6
  * `undefined` when the extension is unknown. Case-insensitive.
@@ -1 +1 @@
1
- {"version":3,"file":"audio-input.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/transcribe/audio-input.ts"],"mappings":";;;;;AAgCA;;;;AAA0D;iBAA1C,yBAAA,CAA0B,QAAgB;;;;;;;;;;iBAa1C,eAAA,CACd,IAAA,EAAM,UAAA,EACN,SAAA,UACA,QAAA,YACC,UAAU;AA4Bb;;;;;;;;;;AAGqB;;;;;;;;;;AAHrB,iBAAsB,aAAA,CACpB,QAAA,UACA,OAAA;EAAY,SAAA;AAAA,IACX,OAAO,CAAC,UAAA"}
1
+ {"version":3,"file":"audio-input.d.mts","names":[],"sources":["../../../../../../../ai/src/transcribe/audio-input.ts"],"mappings":";;;;;AAgCA;;;;AAA0D;iBAA1C,yBAAA,CAA0B,QAAgB;;;;;;;;;;iBAa1C,eAAA,CACd,IAAA,EAAM,UAAA,EACN,SAAA,UACA,QAAA,YACC,UAAU;AA4Bb;;;;;;;;;;AAGqB;;;;;;;;;;AAHrB,iBAAsB,aAAA,CACpB,QAAA,UACA,OAAA;EAAY,SAAA;AAAA,IACX,OAAO,CAAC,UAAA"}
@@ -1,7 +1,7 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { basename, extname } from "node:path";
3
3
 
4
- //#region ../@warlock.js/ai/src/transcribe/audio-input.ts
4
+ //#region ../ai/src/transcribe/audio-input.ts
5
5
  /**
6
6
  * File-extension → IANA audio media type map covering the formats the
7
7
  * common STT providers accept — including the **WhatsApp voice-note**
@@ -1 +1 @@
1
- {"version":3,"file":"audio-input.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/transcribe/audio-input.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { basename, extname } from \"node:path\";\nimport type { AudioInput } from \"../contracts/transcription-model.contract\";\n\n/**\n * File-extension → IANA audio media type map covering the formats the\n * common STT providers accept — including the **WhatsApp voice-note**\n * formats (`.ogg` / `.opus`, Opus-in-Ogg on Android; `.m4a` on iOS).\n */\nconst AUDIO_MEDIA_TYPES: Record<string, string> = {\n \".mp3\": \"audio/mpeg\",\n \".mpeg\": \"audio/mpeg\",\n \".mpga\": \"audio/mpeg\",\n \".m4a\": \"audio/mp4\",\n \".mp4\": \"audio/mp4\",\n \".wav\": \"audio/wav\",\n \".webm\": \"audio/webm\",\n \".weba\": \"audio/webm\",\n \".ogg\": \"audio/ogg\",\n \".oga\": \"audio/ogg\",\n \".opus\": \"audio/ogg\",\n \".flac\": \"audio/flac\",\n \".aac\": \"audio/aac\",\n};\n\n/**\n * Resolve the audio media type from a filename's extension, or\n * `undefined` when the extension is unknown. Case-insensitive.\n *\n * @example\n * audioMediaTypeForFilename(\"voice-note.opus\"); // \"audio/ogg\"\n */\nexport function audioMediaTypeForFilename(filename: string): string | undefined {\n return AUDIO_MEDIA_TYPES[extname(filename).toLowerCase()];\n}\n\n/**\n * Package raw audio bytes as an {@link AudioInput} for `ai.transcribe()`.\n * Pure plumbing — no AI, no I/O. Use when you already hold the bytes\n * (an upload buffer, a downloaded blob).\n *\n * @example\n * const audio = audioFromBuffer(uploadBuffer, \"audio/ogg\", \"note.ogg\");\n * const { data } = await ai.transcribe({ model: openai.transcribe({ name: \"whisper-1\" }), audio });\n */\nexport function audioFromBuffer(\n data: Uint8Array,\n mediaType: string,\n filename?: string,\n): AudioInput {\n return {\n base64: Buffer.from(data).toString(\"base64\"),\n mediaType,\n ...(filename ? { filename } : {}),\n };\n}\n\n/**\n * Read an audio file from disk and package it as an {@link AudioInput}\n * for `ai.transcribe()` — the one-line bridge from a file on disk\n * (WhatsApp `.ogg`/`.opus`, a meeting `.m4a`, a `.wav`) to the\n * transcription verb. **Pure utility — no AI here**; the actual text\n * extraction is the AI step (`ai.transcribe`).\n *\n * The media type is inferred from the file extension (override via\n * `options.mediaType` for extensionless or mislabeled files).\n *\n * @example\n * // WhatsApp voice note → text, end to end:\n * const audio = await audioFromFile(\"./voice-note.ogg\");\n * const { data, error } = await ai.transcribe({\n * model: openai.transcribe({ name: \"whisper-1\" }),\n * audio,\n * language: \"en\",\n * });\n * if (!error) console.log(data.text);\n */\nexport async function audioFromFile(\n filePath: string,\n options?: { mediaType?: string },\n): Promise<AudioInput> {\n const buffer = await readFile(filePath);\n const filename = basename(filePath);\n const mediaType = options?.mediaType ?? audioMediaTypeForFilename(filename) ?? \"audio/mpeg\";\n\n return { base64: buffer.toString(\"base64\"), mediaType, filename };\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,oBAA4C;CAChD,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;AACV;;;;;;;;AASA,SAAgB,0BAA0B,UAAsC;CAC9E,OAAO,kBAAkB,QAAQ,QAAQ,CAAC,CAAC,YAAY;AACzD;;;;;;;;;;AAWA,SAAgB,gBACd,MACA,WACA,UACY;CACZ,OAAO;EACL,QAAQ,OAAO,KAAK,IAAI,CAAC,CAAC,SAAS,QAAQ;EAC3C;EACA,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;CACjC;AACF;;;;;;;;;;;;;;;;;;;;;AAsBA,eAAsB,cACpB,UACA,SACqB;CACrB,MAAM,SAAS,MAAM,SAAS,QAAQ;CACtC,MAAM,WAAW,SAAS,QAAQ;CAClC,MAAM,YAAY,SAAS,aAAa,0BAA0B,QAAQ,KAAK;CAE/E,OAAO;EAAE,QAAQ,OAAO,SAAS,QAAQ;EAAG;EAAW;CAAS;AAClE"}
1
+ {"version":3,"file":"audio-input.mjs","names":[],"sources":["../../../../../../../ai/src/transcribe/audio-input.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { basename, extname } from \"node:path\";\nimport type { AudioInput } from \"../contracts/transcription-model.contract\";\n\n/**\n * File-extension → IANA audio media type map covering the formats the\n * common STT providers accept — including the **WhatsApp voice-note**\n * formats (`.ogg` / `.opus`, Opus-in-Ogg on Android; `.m4a` on iOS).\n */\nconst AUDIO_MEDIA_TYPES: Record<string, string> = {\n \".mp3\": \"audio/mpeg\",\n \".mpeg\": \"audio/mpeg\",\n \".mpga\": \"audio/mpeg\",\n \".m4a\": \"audio/mp4\",\n \".mp4\": \"audio/mp4\",\n \".wav\": \"audio/wav\",\n \".webm\": \"audio/webm\",\n \".weba\": \"audio/webm\",\n \".ogg\": \"audio/ogg\",\n \".oga\": \"audio/ogg\",\n \".opus\": \"audio/ogg\",\n \".flac\": \"audio/flac\",\n \".aac\": \"audio/aac\",\n};\n\n/**\n * Resolve the audio media type from a filename's extension, or\n * `undefined` when the extension is unknown. Case-insensitive.\n *\n * @example\n * audioMediaTypeForFilename(\"voice-note.opus\"); // \"audio/ogg\"\n */\nexport function audioMediaTypeForFilename(filename: string): string | undefined {\n return AUDIO_MEDIA_TYPES[extname(filename).toLowerCase()];\n}\n\n/**\n * Package raw audio bytes as an {@link AudioInput} for `ai.transcribe()`.\n * Pure plumbing — no AI, no I/O. Use when you already hold the bytes\n * (an upload buffer, a downloaded blob).\n *\n * @example\n * const audio = audioFromBuffer(uploadBuffer, \"audio/ogg\", \"note.ogg\");\n * const { data } = await ai.transcribe({ model: openai.transcribe({ name: \"whisper-1\" }), audio });\n */\nexport function audioFromBuffer(\n data: Uint8Array,\n mediaType: string,\n filename?: string,\n): AudioInput {\n return {\n base64: Buffer.from(data).toString(\"base64\"),\n mediaType,\n ...(filename ? { filename } : {}),\n };\n}\n\n/**\n * Read an audio file from disk and package it as an {@link AudioInput}\n * for `ai.transcribe()` — the one-line bridge from a file on disk\n * (WhatsApp `.ogg`/`.opus`, a meeting `.m4a`, a `.wav`) to the\n * transcription verb. **Pure utility — no AI here**; the actual text\n * extraction is the AI step (`ai.transcribe`).\n *\n * The media type is inferred from the file extension (override via\n * `options.mediaType` for extensionless or mislabeled files).\n *\n * @example\n * // WhatsApp voice note → text, end to end:\n * const audio = await audioFromFile(\"./voice-note.ogg\");\n * const { data, error } = await ai.transcribe({\n * model: openai.transcribe({ name: \"whisper-1\" }),\n * audio,\n * language: \"en\",\n * });\n * if (!error) console.log(data.text);\n */\nexport async function audioFromFile(\n filePath: string,\n options?: { mediaType?: string },\n): Promise<AudioInput> {\n const buffer = await readFile(filePath);\n const filename = basename(filePath);\n const mediaType = options?.mediaType ?? audioMediaTypeForFilename(filename) ?? \"audio/mpeg\";\n\n return { base64: buffer.toString(\"base64\"), mediaType, filename };\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,oBAA4C;CAChD,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;AACV;;;;;;;;AASA,SAAgB,0BAA0B,UAAsC;CAC9E,OAAO,kBAAkB,QAAQ,QAAQ,CAAC,CAAC,YAAY;AACzD;;;;;;;;;;AAWA,SAAgB,gBACd,MACA,WACA,UACY;CACZ,OAAO;EACL,QAAQ,OAAO,KAAK,IAAI,CAAC,CAAC,SAAS,QAAQ;EAC3C;EACA,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;CACjC;AACF;;;;;;;;;;;;;;;;;;;;;AAsBA,eAAsB,cACpB,UACA,SACqB;CACrB,MAAM,SAAS,MAAM,SAAS,QAAQ;CACtC,MAAM,WAAW,SAAS,QAAQ;CAClC,MAAM,YAAY,SAAS,aAAa,0BAA0B,QAAQ,KAAK;CAE/E,OAAO;EAAE,QAAQ,OAAO,SAAS,QAAQ;EAAG;EAAW;CAAS;AAClE"}
@@ -3,7 +3,7 @@ import { ExecuteResult } from "../contracts/result/execute-result.type.mjs";
3
3
  import { FlowObserveOption } from "../observe/resolve-observers.mjs";
4
4
  import { AudioInput, TranscriptionModelContract, TranscriptionSegment } from "../contracts/transcription-model.contract.mjs";
5
5
 
6
- //#region ../@warlock.js/ai/src/transcribe/transcribe.d.ts
6
+ //#region ../ai/src/transcribe/transcribe.d.ts
7
7
  /** Parameters for {@link transcribe}. `model` comes from `sdk.transcribe({ name })`. */
8
8
  type TranscribeParams = {
9
9
  /** The STT model to transcribe with. */model: TranscriptionModelContract; /** The audio to transcribe (inlined base64 bytes + media type). */
@@ -1 +1 @@
1
- {"version":3,"file":"transcribe.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/transcribe/transcribe.ts"],"mappings":";;;;;;;KAoBY,gBAAA;EAAA,wCAEV,KAAA,EAAO,0BAAA;EAEP,KAAA,EAAO,UAAA,EAAA;EAEP,QAAA,WAQU;EANV,MAAA,WAYgB;EAVhB,MAAA,WARA;EAUA,MAAA,GAAS,WAAA,EART;EAUA,OAAA,GAAU,iBAAA,EARV;EAUA,SAAA,WANA;EAQA,IAAA,WANS;EAQT,OAAA,GAAU,MAAA;AAAA;;KAIA,iBAAA;EAJV,gCAMA,IAAA,UANgB;EAQhB,QAAA,GAAW,oBAAoB;AAAA;;KAIrB,mBAAA,GAAsB,UAAU;EAC1C,IAAA,mBAPA;EASA,KAAA;IAAS,IAAA;IAAc,QAAA;EAAA,GAHb;EAKV,eAAA;AAAA;;KAIU,mBAAA,GAAsB,aAAA,CAAc,iBAAA;EAC9C,IAAA;EACA,MAAA,EAAQ,mBAAA;AAAA;;;;AANO;AAIjB;;;;;;;;;;;;;;AAE6B;AAyB7B;;;iBAAsB,UAAA,CAAW,MAAA,EAAQ,gBAAA,GAAmB,OAAA,CAAQ,mBAAA"}
1
+ {"version":3,"file":"transcribe.d.mts","names":[],"sources":["../../../../../../../ai/src/transcribe/transcribe.ts"],"mappings":";;;;;;;KAoBY,gBAAA;EAAA,wCAEV,KAAA,EAAO,0BAAA;EAEP,KAAA,EAAO,UAAA,EAAA;EAEP,QAAA,WAQU;EANV,MAAA,WAYgB;EAVhB,MAAA,WARA;EAUA,MAAA,GAAS,WAAA,EART;EAUA,OAAA,GAAU,iBAAA,EARV;EAUA,SAAA,WANA;EAQA,IAAA,WANS;EAQT,OAAA,GAAU,MAAA;AAAA;;KAIA,iBAAA;EAJV,gCAMA,IAAA,UANgB;EAQhB,QAAA,GAAW,oBAAoB;AAAA;;KAIrB,mBAAA,GAAsB,UAAU;EAC1C,IAAA,mBAPA;EASA,KAAA;IAAS,IAAA;IAAc,QAAA;EAAA,GAHb;EAKV,eAAA;AAAA;;KAIU,mBAAA,GAAsB,aAAA,CAAc,iBAAA;EAC9C,IAAA;EACA,MAAA,EAAQ,mBAAA;AAAA;;;;AANO;AAIjB;;;;;;;;;;;;;;AAE6B;AAyB7B;;;iBAAsB,UAAA,CAAW,MAAA,EAAQ,gBAAA,GAAmB,OAAA,CAAQ,mBAAA"}
@@ -6,7 +6,7 @@ import { REPORT_SCHEMA_VERSION } from "../contracts/result/base-report.type.mjs"
6
6
  import { stampReportLineage } from "../utils/stamp-report-lineage.mjs";
7
7
  import { notifyObservers } from "../observe/resolve-observers.mjs";
8
8
 
9
- //#region ../@warlock.js/ai/src/transcribe/transcribe.ts
9
+ //#region ../ai/src/transcribe/transcribe.ts
10
10
  /**
11
11
  * Transcribe audio to text — the speech-to-text verb of the
12
12
  * output-modality track (Theme I), inverse of `ai.speech()`. Wraps a
@@ -1 +1 @@
1
- {"version":3,"file":"transcribe.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/transcribe/transcribe.ts"],"sourcesContent":["import type { BaseReport } from \"../contracts/result/base-report.type\";\nimport { REPORT_SCHEMA_VERSION } from \"../contracts/result/base-report.type\";\nimport type { ExecuteResult } from \"../contracts/result/execute-result.type\";\nimport type { ModelPricing } from \"../contracts/result/model-pricing.type\";\nimport type { Usage } from \"../contracts/result/usage.type\";\nimport type {\n AudioInput,\n TranscriptionModelContract,\n TranscriptionModelPricing,\n TranscriptionSegment,\n} from \"../contracts/transcription-model.contract\";\nimport { AIError } from \"../errors/ai-error\";\nimport { ProviderError } from \"../errors/provider-error\";\nimport type { FlowObserveOption } from \"../observe/resolve-observers\";\nimport { notifyObservers } from \"../observe/resolve-observers\";\nimport { computeCost } from \"../utils/compute-cost\";\nimport { generateRunId } from \"../utils/generate-run-id\";\nimport { stampReportLineage } from \"../utils/stamp-report-lineage\";\n\n/** Parameters for {@link transcribe}. `model` comes from `sdk.transcribe({ name })`. */\nexport type TranscribeParams = {\n /** The STT model to transcribe with. */\n model: TranscriptionModelContract;\n /** The audio to transcribe (inlined base64 bytes + media type). */\n audio: AudioInput;\n /** BCP-47 language hint. */\n language?: string;\n /** Optional priming prompt (spelling/style hints). */\n prompt?: string;\n /** Provider response-format override (e.g. `\"verbose_json\"`). */\n format?: string;\n /** Cancellation handle. */\n signal?: AbortSignal;\n /** Observability routing — same `observe` seam as agents. */\n observe?: FlowObserveOption;\n /** Groups this call into a session for flat cost/trace queries. */\n sessionId?: string;\n /** Report node name (defaults to `\"transcription\"`). */\n name?: string;\n /** Provider-specific options forwarded verbatim to the adapter. */\n options?: Record<string, unknown>;\n};\n\n/** Success payload of a {@link transcribe} run. */\nexport type TranscriptionData = {\n /** The full transcript text. */\n text: string;\n /** Timestamped segments when the provider returned them. */\n segments?: TranscriptionSegment[];\n};\n\n/** The report node a {@link transcribe} run produces (`type: \"transcription\"`). */\nexport type TranscriptionReport = BaseReport & {\n type: \"transcription\";\n /** Identity of the STT model this run used. */\n model: { name: string; provider: string };\n /** Input audio duration in seconds, when the provider reported it. */\n durationSeconds?: number;\n};\n\n/** Result envelope of {@link transcribe} — the uniform `{ data, error, usage, report }`. */\nexport type TranscriptionResult = ExecuteResult<TranscriptionData> & {\n type: \"transcription\";\n report: TranscriptionReport;\n};\n\n/**\n * Transcribe audio to text — the speech-to-text verb of the\n * output-modality track (Theme I), inverse of `ai.speech()`. Wraps a\n * {@link TranscriptionModelContract} (from `openai.transcribe(...)`) in\n * the uniform result contract:\n *\n * - **Never throws.** Provider failures surface as a typed `AIError` on\n * `result.error`.\n * - **Cost-truth.** `result.usage.cost` is filled per-minute\n * (`whisper-1`) or per-token (`gpt-4o-transcribe`).\n * - **Observable.** The completed {@link TranscriptionReport} routes to\n * any registered `Observer` via the `observe` seam.\n *\n * @example\n * const openai = new OpenAISDK({ apiKey });\n * const { data, error } = await ai.transcribe({\n * model: openai.transcribe({ name: \"whisper-1\" }),\n * audio: { base64, mediaType: \"audio/mpeg\", filename: \"voicemail.mp3\" },\n * language: \"en\",\n * });\n * if (!error) console.log(data.text);\n */\nexport async function transcribe(params: TranscribeParams): Promise<TranscriptionResult> {\n const { model, audio } = params;\n\n const runId = generateRunId(\"transcription\");\n const startedAt = new Date().toISOString();\n const startPerf = performance.now();\n\n const usage: Usage = { input: 0, output: 0, total: 0 };\n let data: TranscriptionData | undefined;\n let error: AIError | undefined;\n let status: TranscriptionReport[\"status\"] = \"completed\";\n let durationSeconds: number | undefined;\n\n try {\n const response = await model.transcribe(audio, {\n language: params.language,\n prompt: params.prompt,\n format: params.format,\n signal: params.signal,\n ...params.options,\n });\n\n Object.assign(usage, response.usage);\n durationSeconds = response.durationSeconds;\n\n if (usage.cost === undefined) {\n const cost = computeTranscriptionCost(usage, durationSeconds, model.pricing);\n if (cost !== undefined) {\n usage.cost = cost;\n }\n }\n\n data = { text: response.text, ...(response.segments ? { segments: response.segments } : {}) };\n } catch (thrown) {\n error =\n thrown instanceof AIError ? thrown : new ProviderError(toMessage(thrown), { cause: thrown });\n status = params.signal?.aborted ? \"cancelled\" : \"failed\";\n }\n\n const report: TranscriptionReport = {\n runId,\n rootRunId: runId,\n name: params.name ?? \"transcription\",\n type: \"transcription\",\n status,\n error,\n startedAt,\n endedAt: new Date().toISOString(),\n duration: performance.now() - startPerf,\n usage,\n children: [],\n model: { name: model.name, provider: model.provider },\n ...(durationSeconds !== undefined ? { durationSeconds } : {}),\n reportSchemaVersion: REPORT_SCHEMA_VERSION,\n };\n\n stampReportLineage(report, { rootRunId: runId, sessionId: params.sessionId });\n\n await notifyObservers(params.observe, report);\n\n return { type: \"transcription\", data, error, usage, report };\n}\n\n/**\n * Price an STT run: `perMinute × (durationSeconds / 60)` (per-minute\n * metering, attributed to `cost.input`) wins when configured, otherwise\n * the standard token math. Returns `undefined` when no usable pricing\n * is present (e.g. per-minute pricing but the provider didn't report a\n * duration).\n */\nfunction computeTranscriptionCost(\n usage: Usage,\n durationSeconds: number | undefined,\n pricing: TranscriptionModelPricing | undefined,\n): ModelPricing | undefined {\n if (!pricing) {\n return undefined;\n }\n\n if (pricing.perMinute !== undefined) {\n if (durationSeconds === undefined) {\n return undefined;\n }\n return { input: (durationSeconds / 60) * pricing.perMinute, output: 0 };\n }\n\n if (pricing.input !== undefined && pricing.output !== undefined) {\n return computeCost(usage, { input: pricing.input, output: pricing.output });\n }\n\n return undefined;\n}\n\n/** Best-effort message for a non-`AIError` thrown value. */\nfunction toMessage(thrown: unknown): string {\n return thrown instanceof Error ? thrown.message : String(thrown);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,eAAsB,WAAW,QAAwD;CACvF,MAAM,EAAE,OAAO,UAAU;CAEzB,MAAM,QAAQ,cAAc,eAAe;CAC3C,MAAM,6BAAY,IAAI,KAAK,EAAC,CAAC,YAAY;CACzC,MAAM,YAAY,YAAY,IAAI;CAElC,MAAM,QAAe;EAAE,OAAO;EAAG,QAAQ;EAAG,OAAO;CAAE;CACrD,IAAI;CACJ,IAAI;CACJ,IAAI,SAAwC;CAC5C,IAAI;CAEJ,IAAI;EACF,MAAM,WAAW,MAAM,MAAM,WAAW,OAAO;GAC7C,UAAU,OAAO;GACjB,QAAQ,OAAO;GACf,QAAQ,OAAO;GACf,QAAQ,OAAO;GACf,GAAG,OAAO;EACZ,CAAC;EAED,OAAO,OAAO,OAAO,SAAS,KAAK;EACnC,kBAAkB,SAAS;EAE3B,IAAI,MAAM,SAAS,QAAW;GAC5B,MAAM,OAAO,yBAAyB,OAAO,iBAAiB,MAAM,OAAO;GAC3E,IAAI,SAAS,QACX,MAAM,OAAO;EAEjB;EAEA,OAAO;GAAE,MAAM,SAAS;GAAM,GAAI,SAAS,WAAW,EAAE,UAAU,SAAS,SAAS,IAAI,CAAC;EAAG;CAC9F,SAAS,QAAQ;EACf,QACE,kBAAkB,UAAU,SAAS,IAAI,cAAc,UAAU,MAAM,GAAG,EAAE,OAAO,OAAO,CAAC;EAC7F,SAAS,OAAO,QAAQ,UAAU,cAAc;CAClD;CAEA,MAAM,SAA8B;EAClC;EACA,WAAW;EACX,MAAM,OAAO,QAAQ;EACrB,MAAM;EACN;EACA;EACA;EACA,0BAAS,IAAI,KAAK,EAAC,CAAC,YAAY;EAChC,UAAU,YAAY,IAAI,IAAI;EAC9B;EACA,UAAU,CAAC;EACX,OAAO;GAAE,MAAM,MAAM;GAAM,UAAU,MAAM;EAAS;EACpD,GAAI,oBAAoB,SAAY,EAAE,gBAAgB,IAAI,CAAC;EAC3D;CACF;CAEA,mBAAmB,QAAQ;EAAE,WAAW;EAAO,WAAW,OAAO;CAAU,CAAC;CAE5E,MAAM,gBAAgB,OAAO,SAAS,MAAM;CAE5C,OAAO;EAAE,MAAM;EAAiB;EAAM;EAAO;EAAO;CAAO;AAC7D;;;;;;;;AASA,SAAS,yBACP,OACA,iBACA,SAC0B;CAC1B,IAAI,CAAC,SACH;CAGF,IAAI,QAAQ,cAAc,QAAW;EACnC,IAAI,oBAAoB,QACtB;EAEF,OAAO;GAAE,OAAQ,kBAAkB,KAAM,QAAQ;GAAW,QAAQ;EAAE;CACxE;CAEA,IAAI,QAAQ,UAAU,UAAa,QAAQ,WAAW,QACpD,OAAO,YAAY,OAAO;EAAE,OAAO,QAAQ;EAAO,QAAQ,QAAQ;CAAO,CAAC;AAI9E;;AAGA,SAAS,UAAU,QAAyB;CAC1C,OAAO,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM;AACjE"}
1
+ {"version":3,"file":"transcribe.mjs","names":[],"sources":["../../../../../../../ai/src/transcribe/transcribe.ts"],"sourcesContent":["import type { BaseReport } from \"../contracts/result/base-report.type\";\nimport { REPORT_SCHEMA_VERSION } from \"../contracts/result/base-report.type\";\nimport type { ExecuteResult } from \"../contracts/result/execute-result.type\";\nimport type { ModelPricing } from \"../contracts/result/model-pricing.type\";\nimport type { Usage } from \"../contracts/result/usage.type\";\nimport type {\n AudioInput,\n TranscriptionModelContract,\n TranscriptionModelPricing,\n TranscriptionSegment,\n} from \"../contracts/transcription-model.contract\";\nimport { AIError } from \"../errors/ai-error\";\nimport { ProviderError } from \"../errors/provider-error\";\nimport type { FlowObserveOption } from \"../observe/resolve-observers\";\nimport { notifyObservers } from \"../observe/resolve-observers\";\nimport { computeCost } from \"../utils/compute-cost\";\nimport { generateRunId } from \"../utils/generate-run-id\";\nimport { stampReportLineage } from \"../utils/stamp-report-lineage\";\n\n/** Parameters for {@link transcribe}. `model` comes from `sdk.transcribe({ name })`. */\nexport type TranscribeParams = {\n /** The STT model to transcribe with. */\n model: TranscriptionModelContract;\n /** The audio to transcribe (inlined base64 bytes + media type). */\n audio: AudioInput;\n /** BCP-47 language hint. */\n language?: string;\n /** Optional priming prompt (spelling/style hints). */\n prompt?: string;\n /** Provider response-format override (e.g. `\"verbose_json\"`). */\n format?: string;\n /** Cancellation handle. */\n signal?: AbortSignal;\n /** Observability routing — same `observe` seam as agents. */\n observe?: FlowObserveOption;\n /** Groups this call into a session for flat cost/trace queries. */\n sessionId?: string;\n /** Report node name (defaults to `\"transcription\"`). */\n name?: string;\n /** Provider-specific options forwarded verbatim to the adapter. */\n options?: Record<string, unknown>;\n};\n\n/** Success payload of a {@link transcribe} run. */\nexport type TranscriptionData = {\n /** The full transcript text. */\n text: string;\n /** Timestamped segments when the provider returned them. */\n segments?: TranscriptionSegment[];\n};\n\n/** The report node a {@link transcribe} run produces (`type: \"transcription\"`). */\nexport type TranscriptionReport = BaseReport & {\n type: \"transcription\";\n /** Identity of the STT model this run used. */\n model: { name: string; provider: string };\n /** Input audio duration in seconds, when the provider reported it. */\n durationSeconds?: number;\n};\n\n/** Result envelope of {@link transcribe} — the uniform `{ data, error, usage, report }`. */\nexport type TranscriptionResult = ExecuteResult<TranscriptionData> & {\n type: \"transcription\";\n report: TranscriptionReport;\n};\n\n/**\n * Transcribe audio to text — the speech-to-text verb of the\n * output-modality track (Theme I), inverse of `ai.speech()`. Wraps a\n * {@link TranscriptionModelContract} (from `openai.transcribe(...)`) in\n * the uniform result contract:\n *\n * - **Never throws.** Provider failures surface as a typed `AIError` on\n * `result.error`.\n * - **Cost-truth.** `result.usage.cost` is filled per-minute\n * (`whisper-1`) or per-token (`gpt-4o-transcribe`).\n * - **Observable.** The completed {@link TranscriptionReport} routes to\n * any registered `Observer` via the `observe` seam.\n *\n * @example\n * const openai = new OpenAISDK({ apiKey });\n * const { data, error } = await ai.transcribe({\n * model: openai.transcribe({ name: \"whisper-1\" }),\n * audio: { base64, mediaType: \"audio/mpeg\", filename: \"voicemail.mp3\" },\n * language: \"en\",\n * });\n * if (!error) console.log(data.text);\n */\nexport async function transcribe(params: TranscribeParams): Promise<TranscriptionResult> {\n const { model, audio } = params;\n\n const runId = generateRunId(\"transcription\");\n const startedAt = new Date().toISOString();\n const startPerf = performance.now();\n\n const usage: Usage = { input: 0, output: 0, total: 0 };\n let data: TranscriptionData | undefined;\n let error: AIError | undefined;\n let status: TranscriptionReport[\"status\"] = \"completed\";\n let durationSeconds: number | undefined;\n\n try {\n const response = await model.transcribe(audio, {\n language: params.language,\n prompt: params.prompt,\n format: params.format,\n signal: params.signal,\n ...params.options,\n });\n\n Object.assign(usage, response.usage);\n durationSeconds = response.durationSeconds;\n\n if (usage.cost === undefined) {\n const cost = computeTranscriptionCost(usage, durationSeconds, model.pricing);\n if (cost !== undefined) {\n usage.cost = cost;\n }\n }\n\n data = { text: response.text, ...(response.segments ? { segments: response.segments } : {}) };\n } catch (thrown) {\n error =\n thrown instanceof AIError ? thrown : new ProviderError(toMessage(thrown), { cause: thrown });\n status = params.signal?.aborted ? \"cancelled\" : \"failed\";\n }\n\n const report: TranscriptionReport = {\n runId,\n rootRunId: runId,\n name: params.name ?? \"transcription\",\n type: \"transcription\",\n status,\n error,\n startedAt,\n endedAt: new Date().toISOString(),\n duration: performance.now() - startPerf,\n usage,\n children: [],\n model: { name: model.name, provider: model.provider },\n ...(durationSeconds !== undefined ? { durationSeconds } : {}),\n reportSchemaVersion: REPORT_SCHEMA_VERSION,\n };\n\n stampReportLineage(report, { rootRunId: runId, sessionId: params.sessionId });\n\n await notifyObservers(params.observe, report);\n\n return { type: \"transcription\", data, error, usage, report };\n}\n\n/**\n * Price an STT run: `perMinute × (durationSeconds / 60)` (per-minute\n * metering, attributed to `cost.input`) wins when configured, otherwise\n * the standard token math. Returns `undefined` when no usable pricing\n * is present (e.g. per-minute pricing but the provider didn't report a\n * duration).\n */\nfunction computeTranscriptionCost(\n usage: Usage,\n durationSeconds: number | undefined,\n pricing: TranscriptionModelPricing | undefined,\n): ModelPricing | undefined {\n if (!pricing) {\n return undefined;\n }\n\n if (pricing.perMinute !== undefined) {\n if (durationSeconds === undefined) {\n return undefined;\n }\n return { input: (durationSeconds / 60) * pricing.perMinute, output: 0 };\n }\n\n if (pricing.input !== undefined && pricing.output !== undefined) {\n return computeCost(usage, { input: pricing.input, output: pricing.output });\n }\n\n return undefined;\n}\n\n/** Best-effort message for a non-`AIError` thrown value. */\nfunction toMessage(thrown: unknown): string {\n return thrown instanceof Error ? thrown.message : String(thrown);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,eAAsB,WAAW,QAAwD;CACvF,MAAM,EAAE,OAAO,UAAU;CAEzB,MAAM,QAAQ,cAAc,eAAe;CAC3C,MAAM,6BAAY,IAAI,KAAK,EAAC,CAAC,YAAY;CACzC,MAAM,YAAY,YAAY,IAAI;CAElC,MAAM,QAAe;EAAE,OAAO;EAAG,QAAQ;EAAG,OAAO;CAAE;CACrD,IAAI;CACJ,IAAI;CACJ,IAAI,SAAwC;CAC5C,IAAI;CAEJ,IAAI;EACF,MAAM,WAAW,MAAM,MAAM,WAAW,OAAO;GAC7C,UAAU,OAAO;GACjB,QAAQ,OAAO;GACf,QAAQ,OAAO;GACf,QAAQ,OAAO;GACf,GAAG,OAAO;EACZ,CAAC;EAED,OAAO,OAAO,OAAO,SAAS,KAAK;EACnC,kBAAkB,SAAS;EAE3B,IAAI,MAAM,SAAS,QAAW;GAC5B,MAAM,OAAO,yBAAyB,OAAO,iBAAiB,MAAM,OAAO;GAC3E,IAAI,SAAS,QACX,MAAM,OAAO;EAEjB;EAEA,OAAO;GAAE,MAAM,SAAS;GAAM,GAAI,SAAS,WAAW,EAAE,UAAU,SAAS,SAAS,IAAI,CAAC;EAAG;CAC9F,SAAS,QAAQ;EACf,QACE,kBAAkB,UAAU,SAAS,IAAI,cAAc,UAAU,MAAM,GAAG,EAAE,OAAO,OAAO,CAAC;EAC7F,SAAS,OAAO,QAAQ,UAAU,cAAc;CAClD;CAEA,MAAM,SAA8B;EAClC;EACA,WAAW;EACX,MAAM,OAAO,QAAQ;EACrB,MAAM;EACN;EACA;EACA;EACA,0BAAS,IAAI,KAAK,EAAC,CAAC,YAAY;EAChC,UAAU,YAAY,IAAI,IAAI;EAC9B;EACA,UAAU,CAAC;EACX,OAAO;GAAE,MAAM,MAAM;GAAM,UAAU,MAAM;EAAS;EACpD,GAAI,oBAAoB,SAAY,EAAE,gBAAgB,IAAI,CAAC;EAC3D;CACF;CAEA,mBAAmB,QAAQ;EAAE,WAAW;EAAO,WAAW,OAAO;CAAU,CAAC;CAE5E,MAAM,gBAAgB,OAAO,SAAS,MAAM;CAE5C,OAAO;EAAE,MAAM;EAAiB;EAAM;EAAO;EAAO;CAAO;AAC7D;;;;;;;;AASA,SAAS,yBACP,OACA,iBACA,SAC0B;CAC1B,IAAI,CAAC,SACH;CAGF,IAAI,QAAQ,cAAc,QAAW;EACnC,IAAI,oBAAoB,QACtB;EAEF,OAAO;GAAE,OAAQ,kBAAkB,KAAM,QAAQ;GAAW,QAAQ;EAAE;CACxE;CAEA,IAAI,QAAQ,UAAU,UAAa,QAAQ,WAAW,QACpD,OAAO,YAAY,OAAO;EAAE,OAAO,QAAQ;EAAO,QAAQ,QAAQ;CAAO,CAAC;AAI9E;;AAGA,SAAS,UAAU,QAAyB;CAC1C,OAAO,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM;AACjE"}
@@ -1,7 +1,7 @@
1
1
  import { ModelPricing } from "../contracts/result/model-pricing.type.mjs";
2
2
  import { Usage } from "../contracts/result/usage.type.mjs";
3
3
 
4
- //#region ../@warlock.js/ai/src/utils/compute-cost.d.ts
4
+ //#region ../ai/src/utils/compute-cost.d.ts
5
5
  /**
6
6
  * Compute a per-channel USD cost breakdown for a single `Usage` against
7
7
  * a model's pricing table. Returns `undefined` when no pricing is
@@ -1 +1 @@
1
- {"version":3,"file":"compute-cost.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/compute-cost.ts"],"mappings":";;;;;;AAuCA;;;;;;;;;;;;;;AAA0F;AAkC1F;;;;;;;;;;;;;;AAGe;AAwDf;;;;iBA7FgB,WAAA,CAAY,KAAA,EAAO,KAAA,EAAO,OAAA,EAAS,YAAA,eAA2B,YAAA;;;;;AA6FxB;;;;;;;;;iBA3DtC,cAAA,CACd,MAAA,EAAQ,YAAA,cACR,KAAA,EAAO,YAAA,eACN,YAAA;;;;;;;;;;;;;;;;iBAwDa,UAAA,CAAW,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,KAAK"}
1
+ {"version":3,"file":"compute-cost.d.mts","names":[],"sources":["../../../../../../../ai/src/utils/compute-cost.ts"],"mappings":";;;;;;AAuCA;;;;;;;;;;;;;;AAA0F;AAkC1F;;;;;;;;;;;;;;AAGe;AAwDf;;;;iBA7FgB,WAAA,CAAY,KAAA,EAAO,KAAA,EAAO,OAAA,EAAS,YAAA,eAA2B,YAAA;;;;;AA6FxB;;;;;;;;;iBA3DtC,cAAA,CACd,MAAA,EAAQ,YAAA,cACR,KAAA,EAAO,YAAA,eACN,YAAA;;;;;;;;;;;;;;;;iBAwDa,UAAA,CAAW,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,KAAK"}
@@ -1,4 +1,4 @@
1
- //#region ../@warlock.js/ai/src/utils/compute-cost.ts
1
+ //#region ../ai/src/utils/compute-cost.ts
2
2
  /**
3
3
  * Compute a per-channel USD cost breakdown for a single `Usage` against
4
4
  * a model's pricing table. Returns `undefined` when no pricing is
@@ -1 +1 @@
1
- {"version":3,"file":"compute-cost.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/compute-cost.ts"],"sourcesContent":["import type { ModelPricing } from \"../contracts/result/model-pricing.type\";\nimport type { Usage } from \"../contracts/result/usage.type\";\n\n/**\n * Compute a per-channel USD cost breakdown for a single `Usage` against\n * a model's pricing table. Returns `undefined` when no pricing is\n * configured — the framework treats unpriced runs as \"cost unknown,\"\n * not \"cost zero,\" so dashboards can distinguish free-tier from\n * un-instrumented.\n *\n * **Shape mirrors `ModelPricing`** — `input`, `output`, optional\n * `cachedInput` / `cachedOutput`. Consumers needing a scalar total\n * sum the populated fields. The breakdown is the value-add: it tells\n * downstream tooling HOW the total was reached (input-vs-output\n * share, cache savings) without re-deriving against pricing tables\n * that may have shifted since the report was written.\n *\n * **Cache-aware.** `usage.cachedTokens` is the subset of `usage.input`\n * served from the provider's prompt cache and bills at\n * `pricing.cachedInput` (falls back to full `pricing.input` when the\n * provider doesn't publish a cache rate). The remaining `input -\n * cachedTokens` bills at full rate and shows up in `cost.input`. The\n * `cachedOutput` channel is reserved for Anthropic-style cache writes;\n * until an adapter populates `usage.cacheWriteTokens`, the framework\n * leaves it undefined.\n *\n * Pricing values are USD-per-million-tokens. The function divides\n * once at the end to avoid floating-point accumulation error on\n * per-token math.\n *\n * @example\n * const usage: Usage = { input: 150_000, output: 30_000, total: 180_000, cachedTokens: 90_000 };\n * const cost = computeCost(usage, { input: 0.15, output: 0.6, cachedInput: 0.075 });\n * // cost = {\n * // input: (60_000 * 0.15) / 1e6 = 0.009,\n * // output: (30_000 * 0.6) / 1e6 = 0.018,\n * // cachedInput: (90_000 * 0.075) / 1e6 = 0.00675,\n * // }\n */\nexport function computeCost(usage: Usage, pricing: ModelPricing | undefined): ModelPricing | undefined {\n if (!pricing) {\n return undefined;\n }\n\n const cachedInput = usage.cachedTokens ?? 0;\n const uncachedInput = Math.max(0, usage.input - cachedInput);\n\n const cost: ModelPricing = {\n input: (uncachedInput * pricing.input) / 1_000_000,\n output: (usage.output * pricing.output) / 1_000_000,\n };\n\n if (cachedInput > 0) {\n const cachedInputRate = pricing.cachedInput ?? pricing.input;\n cost.cachedInput = (cachedInput * cachedInputRate) / 1_000_000;\n }\n\n return cost;\n}\n\n/**\n * Merge a child's cost breakdown into a running parent total. Each\n * channel (`input`, `output`, `cachedInput`, `cachedOutput`) sums\n * independently — an undefined channel on either side is treated as\n * zero contribution rather than dropping the other side's value. A\n * single unpriced child should never erase the cost of its priced\n * siblings.\n *\n * Returns the new parent breakdown, or `undefined` when neither parent\n * nor child carried any cost data (preserves the \"no priced\n * contributor has appeared yet\" signal that distinguishes \"missing\n * pricing\" from \"genuinely zero\").\n */\nexport function accumulateCost(\n parent: ModelPricing | undefined,\n child: ModelPricing | undefined,\n): ModelPricing | undefined {\n if (!child) {\n return parent;\n }\n\n if (!parent) {\n return { ...child };\n }\n\n const merged: ModelPricing = {\n input: parent.input + child.input,\n output: parent.output + child.output,\n };\n\n const cachedInput = sumOptional(parent.cachedInput, child.cachedInput);\n if (cachedInput !== undefined) {\n merged.cachedInput = cachedInput;\n }\n\n const cachedOutput = sumOptional(parent.cachedOutput, child.cachedOutput);\n if (cachedOutput !== undefined) {\n merged.cachedOutput = cachedOutput;\n }\n\n return merged;\n}\n\n/**\n * Add two optional numbers, treating either side's `undefined` as\n * zero — but return `undefined` when both are absent. Keeps \"this\n * channel was never reported anywhere\" distinguishable from \"this\n * channel was reported as 0.\"\n */\nfunction sumOptional(parent: number | undefined, child: number | undefined): number | undefined {\n if (parent === undefined && child === undefined) {\n return undefined;\n }\n\n return (parent ?? 0) + (child ?? 0);\n}\n\n/**\n * Accumulate a child {@link Usage} into a running parent total, mutating\n * `target` in place. Scalar token channels (`input` / `output` / `total`)\n * sum directly; the optional sub-channels (`cachedTokens`,\n * `reasoningTokens`, `cacheWriteTokens`) accumulate only when some\n * contributor reported them (preserving the \"never reported anywhere\"\n * signal); and the cost breakdown merges via {@link accumulateCost} so a\n * single unpriced child can never erase a priced sibling's cost.\n *\n * This is the ONE canonical usage rollup — every aggregator (agent,\n * workflow, supervisor, team, planner, batch) routes through it so cost +\n * cache/reasoning telemetry propagates identically to the top-level\n * `result.usage`. Re-implementing a bare `input/output/total` sum at a\n * call site silently drops those optional channels.\n */\nexport function mergeUsage(target: Usage, child: Usage): void {\n target.input += child.input;\n target.output += child.output;\n target.total += child.total;\n\n if (child.cachedTokens !== undefined) {\n target.cachedTokens = (target.cachedTokens ?? 0) + child.cachedTokens;\n }\n\n if (child.reasoningTokens !== undefined) {\n target.reasoningTokens = (target.reasoningTokens ?? 0) + child.reasoningTokens;\n }\n\n if (child.cacheWriteTokens !== undefined) {\n target.cacheWriteTokens = (target.cacheWriteTokens ?? 0) + child.cacheWriteTokens;\n }\n\n const mergedCost = accumulateCost(target.cost, child.cost);\n if (mergedCost !== undefined) {\n target.cost = mergedCost;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,YAAY,OAAc,SAA6D;CACrG,IAAI,CAAC,SACH;CAGF,MAAM,cAAc,MAAM,gBAAgB;CAG1C,MAAM,OAAqB;EACzB,OAHoB,KAAK,IAAI,GAAG,MAAM,QAAQ,WAG1B,IAAI,QAAQ,QAAS;EACzC,QAAS,MAAM,SAAS,QAAQ,SAAU;CAC5C;CAEA,IAAI,cAAc,GAEhB,KAAK,cAAe,eADI,QAAQ,eAAe,QAAQ,SACF;CAGvD,OAAO;AACT;;;;;;;;;;;;;;AAeA,SAAgB,eACd,QACA,OAC0B;CAC1B,IAAI,CAAC,OACH,OAAO;CAGT,IAAI,CAAC,QACH,OAAO,EAAE,GAAG,MAAM;CAGpB,MAAM,SAAuB;EAC3B,OAAO,OAAO,QAAQ,MAAM;EAC5B,QAAQ,OAAO,SAAS,MAAM;CAChC;CAEA,MAAM,cAAc,YAAY,OAAO,aAAa,MAAM,WAAW;CACrE,IAAI,gBAAgB,QAClB,OAAO,cAAc;CAGvB,MAAM,eAAe,YAAY,OAAO,cAAc,MAAM,YAAY;CACxE,IAAI,iBAAiB,QACnB,OAAO,eAAe;CAGxB,OAAO;AACT;;;;;;;AAQA,SAAS,YAAY,QAA4B,OAA+C;CAC9F,IAAI,WAAW,UAAa,UAAU,QACpC;CAGF,QAAQ,UAAU,MAAM,SAAS;AACnC;;;;;;;;;;;;;;;;AAiBA,SAAgB,WAAW,QAAe,OAAoB;CAC5D,OAAO,SAAS,MAAM;CACtB,OAAO,UAAU,MAAM;CACvB,OAAO,SAAS,MAAM;CAEtB,IAAI,MAAM,iBAAiB,QACzB,OAAO,gBAAgB,OAAO,gBAAgB,KAAK,MAAM;CAG3D,IAAI,MAAM,oBAAoB,QAC5B,OAAO,mBAAmB,OAAO,mBAAmB,KAAK,MAAM;CAGjE,IAAI,MAAM,qBAAqB,QAC7B,OAAO,oBAAoB,OAAO,oBAAoB,KAAK,MAAM;CAGnE,MAAM,aAAa,eAAe,OAAO,MAAM,MAAM,IAAI;CACzD,IAAI,eAAe,QACjB,OAAO,OAAO;AAElB"}
1
+ {"version":3,"file":"compute-cost.mjs","names":[],"sources":["../../../../../../../ai/src/utils/compute-cost.ts"],"sourcesContent":["import type { ModelPricing } from \"../contracts/result/model-pricing.type\";\nimport type { Usage } from \"../contracts/result/usage.type\";\n\n/**\n * Compute a per-channel USD cost breakdown for a single `Usage` against\n * a model's pricing table. Returns `undefined` when no pricing is\n * configured — the framework treats unpriced runs as \"cost unknown,\"\n * not \"cost zero,\" so dashboards can distinguish free-tier from\n * un-instrumented.\n *\n * **Shape mirrors `ModelPricing`** — `input`, `output`, optional\n * `cachedInput` / `cachedOutput`. Consumers needing a scalar total\n * sum the populated fields. The breakdown is the value-add: it tells\n * downstream tooling HOW the total was reached (input-vs-output\n * share, cache savings) without re-deriving against pricing tables\n * that may have shifted since the report was written.\n *\n * **Cache-aware.** `usage.cachedTokens` is the subset of `usage.input`\n * served from the provider's prompt cache and bills at\n * `pricing.cachedInput` (falls back to full `pricing.input` when the\n * provider doesn't publish a cache rate). The remaining `input -\n * cachedTokens` bills at full rate and shows up in `cost.input`. The\n * `cachedOutput` channel is reserved for Anthropic-style cache writes;\n * until an adapter populates `usage.cacheWriteTokens`, the framework\n * leaves it undefined.\n *\n * Pricing values are USD-per-million-tokens. The function divides\n * once at the end to avoid floating-point accumulation error on\n * per-token math.\n *\n * @example\n * const usage: Usage = { input: 150_000, output: 30_000, total: 180_000, cachedTokens: 90_000 };\n * const cost = computeCost(usage, { input: 0.15, output: 0.6, cachedInput: 0.075 });\n * // cost = {\n * // input: (60_000 * 0.15) / 1e6 = 0.009,\n * // output: (30_000 * 0.6) / 1e6 = 0.018,\n * // cachedInput: (90_000 * 0.075) / 1e6 = 0.00675,\n * // }\n */\nexport function computeCost(usage: Usage, pricing: ModelPricing | undefined): ModelPricing | undefined {\n if (!pricing) {\n return undefined;\n }\n\n const cachedInput = usage.cachedTokens ?? 0;\n const uncachedInput = Math.max(0, usage.input - cachedInput);\n\n const cost: ModelPricing = {\n input: (uncachedInput * pricing.input) / 1_000_000,\n output: (usage.output * pricing.output) / 1_000_000,\n };\n\n if (cachedInput > 0) {\n const cachedInputRate = pricing.cachedInput ?? pricing.input;\n cost.cachedInput = (cachedInput * cachedInputRate) / 1_000_000;\n }\n\n return cost;\n}\n\n/**\n * Merge a child's cost breakdown into a running parent total. Each\n * channel (`input`, `output`, `cachedInput`, `cachedOutput`) sums\n * independently — an undefined channel on either side is treated as\n * zero contribution rather than dropping the other side's value. A\n * single unpriced child should never erase the cost of its priced\n * siblings.\n *\n * Returns the new parent breakdown, or `undefined` when neither parent\n * nor child carried any cost data (preserves the \"no priced\n * contributor has appeared yet\" signal that distinguishes \"missing\n * pricing\" from \"genuinely zero\").\n */\nexport function accumulateCost(\n parent: ModelPricing | undefined,\n child: ModelPricing | undefined,\n): ModelPricing | undefined {\n if (!child) {\n return parent;\n }\n\n if (!parent) {\n return { ...child };\n }\n\n const merged: ModelPricing = {\n input: parent.input + child.input,\n output: parent.output + child.output,\n };\n\n const cachedInput = sumOptional(parent.cachedInput, child.cachedInput);\n if (cachedInput !== undefined) {\n merged.cachedInput = cachedInput;\n }\n\n const cachedOutput = sumOptional(parent.cachedOutput, child.cachedOutput);\n if (cachedOutput !== undefined) {\n merged.cachedOutput = cachedOutput;\n }\n\n return merged;\n}\n\n/**\n * Add two optional numbers, treating either side's `undefined` as\n * zero — but return `undefined` when both are absent. Keeps \"this\n * channel was never reported anywhere\" distinguishable from \"this\n * channel was reported as 0.\"\n */\nfunction sumOptional(parent: number | undefined, child: number | undefined): number | undefined {\n if (parent === undefined && child === undefined) {\n return undefined;\n }\n\n return (parent ?? 0) + (child ?? 0);\n}\n\n/**\n * Accumulate a child {@link Usage} into a running parent total, mutating\n * `target` in place. Scalar token channels (`input` / `output` / `total`)\n * sum directly; the optional sub-channels (`cachedTokens`,\n * `reasoningTokens`, `cacheWriteTokens`) accumulate only when some\n * contributor reported them (preserving the \"never reported anywhere\"\n * signal); and the cost breakdown merges via {@link accumulateCost} so a\n * single unpriced child can never erase a priced sibling's cost.\n *\n * This is the ONE canonical usage rollup — every aggregator (agent,\n * workflow, supervisor, team, planner, batch) routes through it so cost +\n * cache/reasoning telemetry propagates identically to the top-level\n * `result.usage`. Re-implementing a bare `input/output/total` sum at a\n * call site silently drops those optional channels.\n */\nexport function mergeUsage(target: Usage, child: Usage): void {\n target.input += child.input;\n target.output += child.output;\n target.total += child.total;\n\n if (child.cachedTokens !== undefined) {\n target.cachedTokens = (target.cachedTokens ?? 0) + child.cachedTokens;\n }\n\n if (child.reasoningTokens !== undefined) {\n target.reasoningTokens = (target.reasoningTokens ?? 0) + child.reasoningTokens;\n }\n\n if (child.cacheWriteTokens !== undefined) {\n target.cacheWriteTokens = (target.cacheWriteTokens ?? 0) + child.cacheWriteTokens;\n }\n\n const mergedCost = accumulateCost(target.cost, child.cost);\n if (mergedCost !== undefined) {\n target.cost = mergedCost;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,YAAY,OAAc,SAA6D;CACrG,IAAI,CAAC,SACH;CAGF,MAAM,cAAc,MAAM,gBAAgB;CAG1C,MAAM,OAAqB;EACzB,OAHoB,KAAK,IAAI,GAAG,MAAM,QAAQ,WAG1B,IAAI,QAAQ,QAAS;EACzC,QAAS,MAAM,SAAS,QAAQ,SAAU;CAC5C;CAEA,IAAI,cAAc,GAEhB,KAAK,cAAe,eADI,QAAQ,eAAe,QAAQ,SACF;CAGvD,OAAO;AACT;;;;;;;;;;;;;;AAeA,SAAgB,eACd,QACA,OAC0B;CAC1B,IAAI,CAAC,OACH,OAAO;CAGT,IAAI,CAAC,QACH,OAAO,EAAE,GAAG,MAAM;CAGpB,MAAM,SAAuB;EAC3B,OAAO,OAAO,QAAQ,MAAM;EAC5B,QAAQ,OAAO,SAAS,MAAM;CAChC;CAEA,MAAM,cAAc,YAAY,OAAO,aAAa,MAAM,WAAW;CACrE,IAAI,gBAAgB,QAClB,OAAO,cAAc;CAGvB,MAAM,eAAe,YAAY,OAAO,cAAc,MAAM,YAAY;CACxE,IAAI,iBAAiB,QACnB,OAAO,eAAe;CAGxB,OAAO;AACT;;;;;;;AAQA,SAAS,YAAY,QAA4B,OAA+C;CAC9F,IAAI,WAAW,UAAa,UAAU,QACpC;CAGF,QAAQ,UAAU,MAAM,SAAS;AACnC;;;;;;;;;;;;;;;;AAiBA,SAAgB,WAAW,QAAe,OAAoB;CAC5D,OAAO,SAAS,MAAM;CACtB,OAAO,UAAU,MAAM;CACvB,OAAO,SAAS,MAAM;CAEtB,IAAI,MAAM,iBAAiB,QACzB,OAAO,gBAAgB,OAAO,gBAAgB,KAAK,MAAM;CAG3D,IAAI,MAAM,oBAAoB,QAC5B,OAAO,mBAAmB,OAAO,mBAAmB,KAAK,MAAM;CAGjE,IAAI,MAAM,qBAAqB,QAC7B,OAAO,oBAAoB,OAAO,oBAAoB,KAAK,MAAM;CAGnE,MAAM,aAAa,eAAe,OAAO,MAAM,MAAM,IAAI;CACzD,IAAI,eAAe,QACjB,OAAO,OAAO;AAElB"}
@@ -1,4 +1,4 @@
1
- //#region ../@warlock.js/ai/src/utils/extract-json-lenient.d.ts
1
+ //#region ../ai/src/utils/extract-json-lenient.d.ts
2
2
  /**
3
3
  * Lenient counterpart to {@link extractJsonPayload}, tuned for the
4
4
  * structured-output judges that emit *corrupted* JSON — notably the
@@ -1 +1 @@
1
- {"version":3,"file":"extract-json-lenient.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/extract-json-lenient.ts"],"mappings":";;AAuCA;;;;AAA+C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA/B,kBAAA,CAAmB,IAAY"}
1
+ {"version":3,"file":"extract-json-lenient.d.mts","names":[],"sources":["../../../../../../../ai/src/utils/extract-json-lenient.ts"],"mappings":";;AAuCA;;;;AAA+C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA/B,kBAAA,CAAmB,IAAY"}
@@ -1,6 +1,6 @@
1
1
  import { extractJsonPayload } from "./extract-json-payload.mjs";
2
2
 
3
- //#region ../@warlock.js/ai/src/utils/extract-json-lenient.ts
3
+ //#region ../ai/src/utils/extract-json-lenient.ts
4
4
  /**
5
5
  * Lenient counterpart to {@link extractJsonPayload}, tuned for the
6
6
  * structured-output judges that emit *corrupted* JSON — notably the
@@ -1 +1 @@
1
- {"version":3,"file":"extract-json-lenient.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/extract-json-lenient.ts"],"sourcesContent":["import { extractJsonPayload } from \"./extract-json-payload\";\n\n/**\n * Lenient counterpart to {@link extractJsonPayload}, tuned for the\n * structured-output judges that emit *corrupted* JSON — notably the\n * Amazon Nova family, which routinely wraps its verdict in fenced\n * ` ```json ` blocks, prepends an explanation paragraph, or trails the\n * object with commentary.\n *\n * Where `extractJsonPayload` deliberately refuses the \"first `{` … last\n * `}`\" heuristic (it would corrupt strict callers when prose contains\n * stray braces), this helper *opts into* that resilience: after fence\n * stripping it scans for the first balanced JSON object (`{…}`) or array\n * (`[…]`) and returns just that slice. Brace/bracket counting is\n * string-aware (it ignores braces inside JSON string literals and honors\n * `\\\"` escapes), so prose-embedded braces inside the JSON's own strings\n * don't throw off the balance.\n *\n * Returns the fence-stripped, trimmed text unchanged when no balanced\n * structure is found, so the caller's `JSON.parse` still fails loudly on\n * genuine garbage rather than this helper inventing a value.\n *\n * **Trade-off:** resilience over strictness. Use it only where a tolerant\n * parse is wanted (the judge preset) — for normal structured output keep\n * `extractJsonPayload`, which fails fast on malformed responses so real\n * prompt/model defects surface instead of being silently papered over.\n *\n * @example\n * extractJsonLenient('Here is my verdict:\\n```json\\n{\"score\":0.9}\\n``` — done.');\n * // => '{\"score\":0.9}'\n *\n * @example\n * extractJsonLenient('The answer is {\"verdict\":\"pass\"} for sure.');\n * // => '{\"verdict\":\"pass\"}'\n *\n * @example\n * extractJsonLenient('{\"valid\":true}');\n * // => '{\"valid\":true}' (clean JSON passes through)\n */\nexport function extractJsonLenient(text: string): string {\n // First reuse the strict fence stripper. When the model produced a\n // clean fenced block this already yields the exact payload, so the\n // balanced scan below becomes a no-op pass-through.\n const stripped = extractJsonPayload(text);\n\n const sliced = sliceFirstBalanced(stripped);\n\n return sliced ?? stripped;\n}\n\n/**\n * Scan for the first balanced JSON object or array and return its raw\n * slice. Returns `undefined` when no opening `{`/`[` is found or the\n * structure never closes (truncated / partial output) — the caller then\n * falls back to the fence-stripped text so the failure stays visible.\n *\n * String-literal aware: braces and brackets appearing *inside* a JSON\n * string are not counted toward the balance, and a backslash escapes the\n * next character so an escaped quote (`\\\"`) doesn't prematurely end the\n * string scan.\n */\nfunction sliceFirstBalanced(text: string): string | undefined {\n const start = firstOpenerIndex(text);\n\n if (start === -1) {\n return undefined;\n }\n\n const opener = text[start];\n const closer = opener === \"{\" ? \"}\" : \"]\";\n\n let depth = 0;\n let inString = false;\n let escaped = false;\n\n for (let index = start; index < text.length; index++) {\n const char = text[index];\n\n if (inString) {\n if (escaped) {\n escaped = false;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else if (char === '\"') {\n inString = false;\n }\n\n continue;\n }\n\n if (char === '\"') {\n inString = true;\n continue;\n }\n\n if (char === opener) {\n depth++;\n } else if (char === closer) {\n depth--;\n\n if (depth === 0) {\n return text.slice(start, index + 1);\n }\n }\n }\n\n // Opener with no matching close — truncated / partial output. Leave it\n // to the caller's fallback (and its loud parse failure).\n return undefined;\n}\n\n/**\n * Index of the first JSON structure opener (`{` or `[`), whichever\n * appears earliest, or `-1` when neither is present.\n */\nfunction firstOpenerIndex(text: string): number {\n const brace = text.indexOf(\"{\");\n const bracket = text.indexOf(\"[\");\n\n if (brace === -1) {\n return bracket;\n }\n\n if (bracket === -1) {\n return brace;\n }\n\n return Math.min(brace, bracket);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,mBAAmB,MAAsB;CAIvD,MAAM,WAAW,mBAAmB,IAAI;CAIxC,OAFe,mBAAmB,QAEtB,KAAK;AACnB;;;;;;;;;;;;AAaA,SAAS,mBAAmB,MAAkC;CAC5D,MAAM,QAAQ,iBAAiB,IAAI;CAEnC,IAAI,UAAU,IACZ;CAGF,MAAM,SAAS,KAAK;CACpB,MAAM,SAAS,WAAW,MAAM,MAAM;CAEtC,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,UAAU;CAEd,KAAK,IAAI,QAAQ,OAAO,QAAQ,KAAK,QAAQ,SAAS;EACpD,MAAM,OAAO,KAAK;EAElB,IAAI,UAAU;GACZ,IAAI,SACF,UAAU;QACL,IAAI,SAAS,MAClB,UAAU;QACL,IAAI,SAAS,MAClB,WAAW;GAGb;EACF;EAEA,IAAI,SAAS,MAAK;GAChB,WAAW;GACX;EACF;EAEA,IAAI,SAAS,QACX;OACK,IAAI,SAAS,QAAQ;GAC1B;GAEA,IAAI,UAAU,GACZ,OAAO,KAAK,MAAM,OAAO,QAAQ,CAAC;EAEtC;CACF;AAKF;;;;;AAMA,SAAS,iBAAiB,MAAsB;CAC9C,MAAM,QAAQ,KAAK,QAAQ,GAAG;CAC9B,MAAM,UAAU,KAAK,QAAQ,GAAG;CAEhC,IAAI,UAAU,IACZ,OAAO;CAGT,IAAI,YAAY,IACd,OAAO;CAGT,OAAO,KAAK,IAAI,OAAO,OAAO;AAChC"}
1
+ {"version":3,"file":"extract-json-lenient.mjs","names":[],"sources":["../../../../../../../ai/src/utils/extract-json-lenient.ts"],"sourcesContent":["import { extractJsonPayload } from \"./extract-json-payload\";\n\n/**\n * Lenient counterpart to {@link extractJsonPayload}, tuned for the\n * structured-output judges that emit *corrupted* JSON — notably the\n * Amazon Nova family, which routinely wraps its verdict in fenced\n * ` ```json ` blocks, prepends an explanation paragraph, or trails the\n * object with commentary.\n *\n * Where `extractJsonPayload` deliberately refuses the \"first `{` … last\n * `}`\" heuristic (it would corrupt strict callers when prose contains\n * stray braces), this helper *opts into* that resilience: after fence\n * stripping it scans for the first balanced JSON object (`{…}`) or array\n * (`[…]`) and returns just that slice. Brace/bracket counting is\n * string-aware (it ignores braces inside JSON string literals and honors\n * `\\\"` escapes), so prose-embedded braces inside the JSON's own strings\n * don't throw off the balance.\n *\n * Returns the fence-stripped, trimmed text unchanged when no balanced\n * structure is found, so the caller's `JSON.parse` still fails loudly on\n * genuine garbage rather than this helper inventing a value.\n *\n * **Trade-off:** resilience over strictness. Use it only where a tolerant\n * parse is wanted (the judge preset) — for normal structured output keep\n * `extractJsonPayload`, which fails fast on malformed responses so real\n * prompt/model defects surface instead of being silently papered over.\n *\n * @example\n * extractJsonLenient('Here is my verdict:\\n```json\\n{\"score\":0.9}\\n``` — done.');\n * // => '{\"score\":0.9}'\n *\n * @example\n * extractJsonLenient('The answer is {\"verdict\":\"pass\"} for sure.');\n * // => '{\"verdict\":\"pass\"}'\n *\n * @example\n * extractJsonLenient('{\"valid\":true}');\n * // => '{\"valid\":true}' (clean JSON passes through)\n */\nexport function extractJsonLenient(text: string): string {\n // First reuse the strict fence stripper. When the model produced a\n // clean fenced block this already yields the exact payload, so the\n // balanced scan below becomes a no-op pass-through.\n const stripped = extractJsonPayload(text);\n\n const sliced = sliceFirstBalanced(stripped);\n\n return sliced ?? stripped;\n}\n\n/**\n * Scan for the first balanced JSON object or array and return its raw\n * slice. Returns `undefined` when no opening `{`/`[` is found or the\n * structure never closes (truncated / partial output) — the caller then\n * falls back to the fence-stripped text so the failure stays visible.\n *\n * String-literal aware: braces and brackets appearing *inside* a JSON\n * string are not counted toward the balance, and a backslash escapes the\n * next character so an escaped quote (`\\\"`) doesn't prematurely end the\n * string scan.\n */\nfunction sliceFirstBalanced(text: string): string | undefined {\n const start = firstOpenerIndex(text);\n\n if (start === -1) {\n return undefined;\n }\n\n const opener = text[start];\n const closer = opener === \"{\" ? \"}\" : \"]\";\n\n let depth = 0;\n let inString = false;\n let escaped = false;\n\n for (let index = start; index < text.length; index++) {\n const char = text[index];\n\n if (inString) {\n if (escaped) {\n escaped = false;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else if (char === '\"') {\n inString = false;\n }\n\n continue;\n }\n\n if (char === '\"') {\n inString = true;\n continue;\n }\n\n if (char === opener) {\n depth++;\n } else if (char === closer) {\n depth--;\n\n if (depth === 0) {\n return text.slice(start, index + 1);\n }\n }\n }\n\n // Opener with no matching close — truncated / partial output. Leave it\n // to the caller's fallback (and its loud parse failure).\n return undefined;\n}\n\n/**\n * Index of the first JSON structure opener (`{` or `[`), whichever\n * appears earliest, or `-1` when neither is present.\n */\nfunction firstOpenerIndex(text: string): number {\n const brace = text.indexOf(\"{\");\n const bracket = text.indexOf(\"[\");\n\n if (brace === -1) {\n return bracket;\n }\n\n if (bracket === -1) {\n return brace;\n }\n\n return Math.min(brace, bracket);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,mBAAmB,MAAsB;CAIvD,MAAM,WAAW,mBAAmB,IAAI;CAIxC,OAFe,mBAAmB,QAEtB,KAAK;AACnB;;;;;;;;;;;;AAaA,SAAS,mBAAmB,MAAkC;CAC5D,MAAM,QAAQ,iBAAiB,IAAI;CAEnC,IAAI,UAAU,IACZ;CAGF,MAAM,SAAS,KAAK;CACpB,MAAM,SAAS,WAAW,MAAM,MAAM;CAEtC,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,UAAU;CAEd,KAAK,IAAI,QAAQ,OAAO,QAAQ,KAAK,QAAQ,SAAS;EACpD,MAAM,OAAO,KAAK;EAElB,IAAI,UAAU;GACZ,IAAI,SACF,UAAU;QACL,IAAI,SAAS,MAClB,UAAU;QACL,IAAI,SAAS,MAClB,WAAW;GAGb;EACF;EAEA,IAAI,SAAS,MAAK;GAChB,WAAW;GACX;EACF;EAEA,IAAI,SAAS,QACX;OACK,IAAI,SAAS,QAAQ;GAC1B;GAEA,IAAI,UAAU,GACZ,OAAO,KAAK,MAAM,OAAO,QAAQ,CAAC;EAEtC;CACF;AAKF;;;;;AAMA,SAAS,iBAAiB,MAAsB;CAC9C,MAAM,QAAQ,KAAK,QAAQ,GAAG;CAC9B,MAAM,UAAU,KAAK,QAAQ,GAAG;CAEhC,IAAI,UAAU,IACZ,OAAO;CAGT,IAAI,YAAY,IACd,OAAO;CAGT,OAAO,KAAK,IAAI,OAAO,OAAO;AAChC"}
@@ -1,4 +1,4 @@
1
- //#region ../@warlock.js/ai/src/utils/extract-json-payload.d.ts
1
+ //#region ../ai/src/utils/extract-json-payload.d.ts
2
2
  /**
3
3
  * Strip markdown code fences from an LLM response before JSON parsing.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"extract-json-payload.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/extract-json-payload.ts"],"mappings":";;AA4BA;;;;AAA+C;;;;;;;;;;;;;;;;;;;;;;;iBAA/B,kBAAA,CAAmB,IAAY"}
1
+ {"version":3,"file":"extract-json-payload.d.mts","names":[],"sources":["../../../../../../../ai/src/utils/extract-json-payload.ts"],"mappings":";;AA4BA;;;;AAA+C;;;;;;;;;;;;;;;;;;;;;;;iBAA/B,kBAAA,CAAmB,IAAY"}
@@ -1,4 +1,4 @@
1
- //#region ../@warlock.js/ai/src/utils/extract-json-payload.ts
1
+ //#region ../ai/src/utils/extract-json-payload.ts
2
2
  /**
3
3
  * Strip markdown code fences from an LLM response before JSON parsing.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"extract-json-payload.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/extract-json-payload.ts"],"sourcesContent":["/**\n * Strip markdown code fences from an LLM response before JSON parsing.\n *\n * Models — especially Claude, smaller models, and local models — routinely\n * wrap JSON output in fenced code blocks (` ```json\\n{...}\\n``` `) even when\n * instructed otherwise. Sometimes they also precede the fence with prose\n * (\"Here you go:\\n```json\\n...\\n```\"). This helper finds the first fenced\n * block regardless of language tag and returns its trimmed contents.\n *\n * Returns the trimmed original text unchanged when no fence is present, so\n * clean JSON passes through as a no-op.\n *\n * Deliberately does NOT fall back to \"find first `{` and last `}` and slice\n * between them\" — that heuristic silently corrupts data when prose contains\n * stray braces. Failing loudly at `JSON.parse` is safer.\n *\n * @example\n * extractJsonPayload('```json\\n{\"a\":1}\\n```');\n * // => '{\"a\":1}'\n *\n * @example\n * extractJsonPayload('Here you go:\\n```\\n{\"a\":1}\\n```\\nHope this helps.');\n * // => '{\"a\":1}'\n *\n * @example\n * extractJsonPayload('{\"a\":1}');\n * // => '{\"a\":1}' (no fence → unchanged)\n */\nexport function extractJsonPayload(text: string): string {\n const trimmed = text.trim();\n\n const fenceMatch = trimmed.match(/```(?:json)?\\s*\\n?([\\s\\S]*?)\\n?```/);\n\n if (fenceMatch) {\n return fenceMatch[1].trim();\n }\n\n return trimmed;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,mBAAmB,MAAsB;CACvD,MAAM,UAAU,KAAK,KAAK;CAE1B,MAAM,aAAa,QAAQ,MAAM,oCAAoC;CAErE,IAAI,YACF,OAAO,WAAW,EAAE,CAAC,KAAK;CAG5B,OAAO;AACT"}
1
+ {"version":3,"file":"extract-json-payload.mjs","names":[],"sources":["../../../../../../../ai/src/utils/extract-json-payload.ts"],"sourcesContent":["/**\n * Strip markdown code fences from an LLM response before JSON parsing.\n *\n * Models — especially Claude, smaller models, and local models — routinely\n * wrap JSON output in fenced code blocks (` ```json\\n{...}\\n``` `) even when\n * instructed otherwise. Sometimes they also precede the fence with prose\n * (\"Here you go:\\n```json\\n...\\n```\"). This helper finds the first fenced\n * block regardless of language tag and returns its trimmed contents.\n *\n * Returns the trimmed original text unchanged when no fence is present, so\n * clean JSON passes through as a no-op.\n *\n * Deliberately does NOT fall back to \"find first `{` and last `}` and slice\n * between them\" — that heuristic silently corrupts data when prose contains\n * stray braces. Failing loudly at `JSON.parse` is safer.\n *\n * @example\n * extractJsonPayload('```json\\n{\"a\":1}\\n```');\n * // => '{\"a\":1}'\n *\n * @example\n * extractJsonPayload('Here you go:\\n```\\n{\"a\":1}\\n```\\nHope this helps.');\n * // => '{\"a\":1}'\n *\n * @example\n * extractJsonPayload('{\"a\":1}');\n * // => '{\"a\":1}' (no fence → unchanged)\n */\nexport function extractJsonPayload(text: string): string {\n const trimmed = text.trim();\n\n const fenceMatch = trimmed.match(/```(?:json)?\\s*\\n?([\\s\\S]*?)\\n?```/);\n\n if (fenceMatch) {\n return fenceMatch[1].trim();\n }\n\n return trimmed;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,mBAAmB,MAAsB;CACvD,MAAM,UAAU,KAAK,KAAK;CAE1B,MAAM,aAAa,QAAQ,MAAM,oCAAoC;CAErE,IAAI,YACF,OAAO,WAAW,EAAE,CAAC,KAAK;CAG5B,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- //#region ../@warlock.js/ai/src/utils/generate-run-id.d.ts
1
+ //#region ../ai/src/utils/generate-run-id.d.ts
2
2
  /**
3
3
  * Generates a stable, human-readable run id for any execution node
4
4
  * (tool invocation, agent run, workflow run, supervisor run). Format:
@@ -1 +1 @@
1
- {"version":3,"file":"generate-run-id.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/generate-run-id.ts"],"mappings":";;AAeA;;;;AAA4C;;;;;;;;;;iBAA5B,aAAA,CAAc,MAAc"}
1
+ {"version":3,"file":"generate-run-id.d.mts","names":[],"sources":["../../../../../../../ai/src/utils/generate-run-id.ts"],"mappings":";;AAeA;;;;AAA4C;;;;;;;;;;iBAA5B,aAAA,CAAc,MAAc"}
@@ -1,4 +1,4 @@
1
- //#region ../@warlock.js/ai/src/utils/generate-run-id.ts
1
+ //#region ../ai/src/utils/generate-run-id.ts
2
2
  /**
3
3
  * Generates a stable, human-readable run id for any execution node
4
4
  * (tool invocation, agent run, workflow run, supervisor run). Format:
@@ -1 +1 @@
1
- {"version":3,"file":"generate-run-id.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/generate-run-id.ts"],"sourcesContent":["/**\n * Generates a stable, human-readable run id for any execution node\n * (tool invocation, agent run, workflow run, supervisor run). Format:\n * `${prefix}_${timestamp36}_${random36}` — compact, sortable by\n * prefix, collision-resistant within a run.\n *\n * Shared helper so every primitive emits the same id shape. The\n * prefix is conventionally the primitive kind (`\"tool\"`, `\"agent\"`,\n * `\"workflow\"`, `\"sup\"`) but callers can pass anything; the id is\n * purely for correlation, never parsed.\n *\n * @example\n * const runId = generateRunId(\"tool\");\n * // → \"tool_ld8x3m_7fq2j1kp\"\n */\nexport function generateRunId(prefix: string): string {\n return `${prefix}_${Date.now().toString(36)}_${Math.random()\n .toString(36)\n .slice(2, 10)}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAgB,cAAc,QAAwB;CACpD,OAAO,GAAG,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,GAAG,KAAK,OAAO,CAAC,CACzD,SAAS,EAAE,CAAC,CACZ,MAAM,GAAG,EAAE;AAChB"}
1
+ {"version":3,"file":"generate-run-id.mjs","names":[],"sources":["../../../../../../../ai/src/utils/generate-run-id.ts"],"sourcesContent":["/**\n * Generates a stable, human-readable run id for any execution node\n * (tool invocation, agent run, workflow run, supervisor run). Format:\n * `${prefix}_${timestamp36}_${random36}` — compact, sortable by\n * prefix, collision-resistant within a run.\n *\n * Shared helper so every primitive emits the same id shape. The\n * prefix is conventionally the primitive kind (`\"tool\"`, `\"agent\"`,\n * `\"workflow\"`, `\"sup\"`) but callers can pass anything; the id is\n * purely for correlation, never parsed.\n *\n * @example\n * const runId = generateRunId(\"tool\");\n * // → \"tool_ld8x3m_7fq2j1kp\"\n */\nexport function generateRunId(prefix: string): string {\n return `${prefix}_${Date.now().toString(36)}_${Math.random()\n .toString(36)\n .slice(2, 10)}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAgB,cAAc,QAAwB;CACpD,OAAO,GAAG,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,GAAG,KAAK,OAAO,CAAC,CACzD,SAAS,EAAE,CAAC,CACZ,MAAM,GAAG,EAAE;AAChB"}
@@ -1,6 +1,6 @@
1
1
  import { StandardSchemaV1 } from "@standard-schema/spec";
2
2
 
3
- //#region ../@warlock.js/ai/src/utils/json-schema.d.ts
3
+ //#region ../ai/src/utils/json-schema.d.ts
4
4
  /**
5
5
  * Supported JSON Schema output targets per the Standard JSON Schema V1
6
6
  * spec. `openai-strict` is the richest for OpenAI structured outputs —
@@ -1 +1 @@
1
- {"version":3,"file":"json-schema.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/json-schema.ts"],"mappings":";;;;;AASA;;;;AAA4B;KAAhB,gBAAA;;;;AASe;AAoC3B;;KArCY,wBAAA;EACV,MAAA,GAAS,gBAAgB;AAAA;;;;;;;;;;AAuClB;;;;;;;;;;;;;;;;;;;;;;;;iBAHO,iBAAA,CACd,MAAA,EAAQ,gBAAA,uBACR,OAAA,GAAS,wBAAA,GACR,MAAA"}
1
+ {"version":3,"file":"json-schema.d.mts","names":[],"sources":["../../../../../../../ai/src/utils/json-schema.ts"],"mappings":";;;;;AASA;;;;AAA4B;KAAhB,gBAAA;;;;AASe;AAoC3B;;KArCY,wBAAA;EACV,MAAA,GAAS,gBAAgB;AAAA;;;;;;;;;;AAuClB;;;;;;;;;;;;;;;;;;;;;;;;iBAHO,iBAAA,CACd,MAAA,EAAQ,gBAAA,uBACR,OAAA,GAAS,wBAAA,GACR,MAAA"}
@@ -1,4 +1,4 @@
1
- //#region ../@warlock.js/ai/src/utils/json-schema.ts
1
+ //#region ../ai/src/utils/json-schema.ts
2
2
  /**
3
3
  * Best-effort JSON Schema extraction from a Standard Schema instance.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"json-schema.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/json-schema.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n/**\n * Supported JSON Schema output targets per the Standard JSON Schema V1\n * spec. `openai-strict` is the richest for OpenAI structured outputs —\n * every property listed in `required`, optionals expressed as\n * `[\"T\", \"null\"]`, `additionalProperties: false` everywhere. Other\n * targets produce standards-compliant but looser output.\n */\nexport type JsonSchemaTarget = \"draft-2020-12\" | \"draft-07\" | \"openapi-3.0\" | \"openai-strict\";\n\n/**\n * Options for `extractJsonSchema`. `target` is forwarded to libraries that\n * implement the Standard JSON Schema V1 spec (Seal, and any future lib\n * that follows the spec). Libraries using their own top-level `.jsonSchema`\n * / `._jsonSchema` property ignore the target.\n */\nexport type ExtractJsonSchemaOptions = {\n target?: JsonSchemaTarget | (string & {});\n};\n\n/**\n * Best-effort JSON Schema extraction from a Standard Schema instance.\n *\n * Different libraries expose their JSON representation through different\n * paths:\n * - **Seal / Standard JSON Schema V1**: `[\"~standard\"].jsonSchema.input({ target })`\n * — nested under the spec object, takes a target switch. Default target\n * is `\"openai-strict\"` since the primary consumer is OpenAI's native\n * structured-output mechanism; pass `options.target` to override.\n * - **Zod / similar**: top-level `.jsonSchema` property. Zod v4 actually\n * ships `toJSONSchema` as a module function, not a method, so it does\n * NOT hit this probe — Zod users pass their converted schema via the\n * `AgentExecuteOptions.responseSchema` escape hatch.\n *\n * Deliberately does NOT probe `toJSON` — that's a generic JavaScript\n * serialization hook (Seal's schemas have one that dumps internal rule\n * state) and matching it would return garbage disguised as a JSON Schema.\n *\n * Returns `undefined` when no path matches. The caller then either skips\n * native structured-output wiring or falls back to a schema-less\n * instruction.\n *\n * Shared across every SDK adapter package (OpenAI, Anthropic, Bedrock…)\n * so each provider converts schemas identically.\n *\n * @example\n * const schema = extractJsonSchema(mySealSchema);\n * // { type: \"object\", properties: { ... }, required: [ ... ], additionalProperties: false }\n *\n * @example\n * // Ask for a different target explicitly\n * const draft = extractJsonSchema(mySealSchema, { target: \"draft-2020-12\" });\n */\nexport function extractJsonSchema(\n schema: StandardSchemaV1<unknown> | undefined,\n options: ExtractJsonSchemaOptions = {},\n): Record<string, unknown> | undefined {\n if (!schema) return undefined;\n\n const target = options.target ?? \"openai-strict\";\n\n // 1. Seal / Standard JSON Schema V1 pattern: [\"~standard\"].jsonSchema.input({ target })\n const sealJsonSchema = extractFromSealPath(schema, target);\n\n if (sealJsonSchema) {\n return sealJsonSchema;\n }\n\n // 2. Top-level jsonSchema / _jsonSchema (Zod-like, property or method form)\n const topLevel = extractFromCandidateKeys(schema as unknown as Record<string, unknown>);\n\n if (topLevel) {\n return topLevel;\n }\n\n return undefined;\n}\n\n/**\n * Probe the Standard JSON Schema V1 extension path on `schema[\"~standard\"]`.\n * The spec defines `jsonSchema.input({ target, libraryOptions? })` as a\n * function returning a JSON Schema tailored to the requested target. We\n * pass the caller's target (default `\"openai-strict\"`) so the library\n * produces output ready for OpenAI's native structured-output mode\n * without additional post-processing.\n *\n * Calling `.input()` without a target would throw (or return garbage) per\n * the spec — a failure here returns `undefined` so the fallback probe\n * runs.\n */\nfunction extractFromSealPath(\n schema: StandardSchemaV1<unknown>,\n target: string,\n): Record<string, unknown> | undefined {\n const standardSlot = (schema as unknown as Record<string, unknown>)[\"~standard\"];\n\n if (!standardSlot || typeof standardSlot !== \"object\") {\n return undefined;\n }\n\n const jsonSchemaSlot = (standardSlot as Record<string, unknown>)[\"jsonSchema\"];\n\n if (!jsonSchemaSlot || typeof jsonSchemaSlot !== \"object\") {\n return undefined;\n }\n\n const inputFn = (jsonSchemaSlot as Record<string, unknown>)[\"input\"];\n\n if (typeof inputFn !== \"function\") {\n return undefined;\n }\n\n try {\n const result = (inputFn as (options: { target: string }) => unknown).call(jsonSchemaSlot, {\n target,\n });\n\n if (result && typeof result === \"object\") {\n return result as Record<string, unknown>;\n }\n } catch {\n // fall through — library didn't support the target or threw otherwise\n }\n\n return undefined;\n}\n\n/**\n * Probe well-known top-level keys libraries use to expose their JSON\n * Schema. Supports both method form (rare) and property form (common).\n * Deliberately narrow — `toJSON` is NOT probed here because it's a\n * generic serialization hook that returns library-internal state for\n * many validators (Seal included), not a JSON Schema.\n */\nfunction extractFromCandidateKeys(\n schemaRecord: Record<string, unknown>,\n): Record<string, unknown> | undefined {\n const candidateKeys = [\"jsonSchema\", \"_jsonSchema\"] as const;\n\n for (const key of candidateKeys) {\n const value = schemaRecord[key];\n\n if (typeof value === \"function\") {\n try {\n const result = (value as () => unknown).call(schemaRecord);\n\n if (result && typeof result === \"object\") {\n return result as Record<string, unknown>;\n }\n } catch {\n // try next candidate\n }\n\n continue;\n }\n\n if (value && typeof value === \"object\") {\n return value as Record<string, unknown>;\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,kBACd,QACA,UAAoC,CAAC,GACA;CACrC,IAAI,CAAC,QAAQ,OAAO;CAKpB,MAAM,iBAAiB,oBAAoB,QAH5B,QAAQ,UAAU,eAGwB;CAEzD,IAAI,gBACF,OAAO;CAIT,MAAM,WAAW,yBAAyB,MAA4C;CAEtF,IAAI,UACF,OAAO;AAIX;;;;;;;;;;;;;AAcA,SAAS,oBACP,QACA,QACqC;CACrC,MAAM,eAAgB,OAA8C;CAEpE,IAAI,CAAC,gBAAgB,OAAO,iBAAiB,UAC3C;CAGF,MAAM,iBAAkB,aAAyC;CAEjE,IAAI,CAAC,kBAAkB,OAAO,mBAAmB,UAC/C;CAGF,MAAM,UAAW,eAA2C;CAE5D,IAAI,OAAO,YAAY,YACrB;CAGF,IAAI;EACF,MAAM,SAAU,QAAqD,KAAK,gBAAgB,EACxF,OACF,CAAC;EAED,IAAI,UAAU,OAAO,WAAW,UAC9B,OAAO;CAEX,QAAQ,CAER;AAGF;;;;;;;;AASA,SAAS,yBACP,cACqC;CAGrC,KAAK,MAAM,OAAO,CAFK,cAAc,aAEP,GAAG;EAC/B,MAAM,QAAQ,aAAa;EAE3B,IAAI,OAAO,UAAU,YAAY;GAC/B,IAAI;IACF,MAAM,SAAU,MAAwB,KAAK,YAAY;IAEzD,IAAI,UAAU,OAAO,WAAW,UAC9B,OAAO;GAEX,QAAQ,CAER;GAEA;EACF;EAEA,IAAI,SAAS,OAAO,UAAU,UAC5B,OAAO;CAEX;AAGF"}
1
+ {"version":3,"file":"json-schema.mjs","names":[],"sources":["../../../../../../../ai/src/utils/json-schema.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n/**\n * Supported JSON Schema output targets per the Standard JSON Schema V1\n * spec. `openai-strict` is the richest for OpenAI structured outputs —\n * every property listed in `required`, optionals expressed as\n * `[\"T\", \"null\"]`, `additionalProperties: false` everywhere. Other\n * targets produce standards-compliant but looser output.\n */\nexport type JsonSchemaTarget = \"draft-2020-12\" | \"draft-07\" | \"openapi-3.0\" | \"openai-strict\";\n\n/**\n * Options for `extractJsonSchema`. `target` is forwarded to libraries that\n * implement the Standard JSON Schema V1 spec (Seal, and any future lib\n * that follows the spec). Libraries using their own top-level `.jsonSchema`\n * / `._jsonSchema` property ignore the target.\n */\nexport type ExtractJsonSchemaOptions = {\n target?: JsonSchemaTarget | (string & {});\n};\n\n/**\n * Best-effort JSON Schema extraction from a Standard Schema instance.\n *\n * Different libraries expose their JSON representation through different\n * paths:\n * - **Seal / Standard JSON Schema V1**: `[\"~standard\"].jsonSchema.input({ target })`\n * — nested under the spec object, takes a target switch. Default target\n * is `\"openai-strict\"` since the primary consumer is OpenAI's native\n * structured-output mechanism; pass `options.target` to override.\n * - **Zod / similar**: top-level `.jsonSchema` property. Zod v4 actually\n * ships `toJSONSchema` as a module function, not a method, so it does\n * NOT hit this probe — Zod users pass their converted schema via the\n * `AgentExecuteOptions.responseSchema` escape hatch.\n *\n * Deliberately does NOT probe `toJSON` — that's a generic JavaScript\n * serialization hook (Seal's schemas have one that dumps internal rule\n * state) and matching it would return garbage disguised as a JSON Schema.\n *\n * Returns `undefined` when no path matches. The caller then either skips\n * native structured-output wiring or falls back to a schema-less\n * instruction.\n *\n * Shared across every SDK adapter package (OpenAI, Anthropic, Bedrock…)\n * so each provider converts schemas identically.\n *\n * @example\n * const schema = extractJsonSchema(mySealSchema);\n * // { type: \"object\", properties: { ... }, required: [ ... ], additionalProperties: false }\n *\n * @example\n * // Ask for a different target explicitly\n * const draft = extractJsonSchema(mySealSchema, { target: \"draft-2020-12\" });\n */\nexport function extractJsonSchema(\n schema: StandardSchemaV1<unknown> | undefined,\n options: ExtractJsonSchemaOptions = {},\n): Record<string, unknown> | undefined {\n if (!schema) return undefined;\n\n const target = options.target ?? \"openai-strict\";\n\n // 1. Seal / Standard JSON Schema V1 pattern: [\"~standard\"].jsonSchema.input({ target })\n const sealJsonSchema = extractFromSealPath(schema, target);\n\n if (sealJsonSchema) {\n return sealJsonSchema;\n }\n\n // 2. Top-level jsonSchema / _jsonSchema (Zod-like, property or method form)\n const topLevel = extractFromCandidateKeys(schema as unknown as Record<string, unknown>);\n\n if (topLevel) {\n return topLevel;\n }\n\n return undefined;\n}\n\n/**\n * Probe the Standard JSON Schema V1 extension path on `schema[\"~standard\"]`.\n * The spec defines `jsonSchema.input({ target, libraryOptions? })` as a\n * function returning a JSON Schema tailored to the requested target. We\n * pass the caller's target (default `\"openai-strict\"`) so the library\n * produces output ready for OpenAI's native structured-output mode\n * without additional post-processing.\n *\n * Calling `.input()` without a target would throw (or return garbage) per\n * the spec — a failure here returns `undefined` so the fallback probe\n * runs.\n */\nfunction extractFromSealPath(\n schema: StandardSchemaV1<unknown>,\n target: string,\n): Record<string, unknown> | undefined {\n const standardSlot = (schema as unknown as Record<string, unknown>)[\"~standard\"];\n\n if (!standardSlot || typeof standardSlot !== \"object\") {\n return undefined;\n }\n\n const jsonSchemaSlot = (standardSlot as Record<string, unknown>)[\"jsonSchema\"];\n\n if (!jsonSchemaSlot || typeof jsonSchemaSlot !== \"object\") {\n return undefined;\n }\n\n const inputFn = (jsonSchemaSlot as Record<string, unknown>)[\"input\"];\n\n if (typeof inputFn !== \"function\") {\n return undefined;\n }\n\n try {\n const result = (inputFn as (options: { target: string }) => unknown).call(jsonSchemaSlot, {\n target,\n });\n\n if (result && typeof result === \"object\") {\n return result as Record<string, unknown>;\n }\n } catch {\n // fall through — library didn't support the target or threw otherwise\n }\n\n return undefined;\n}\n\n/**\n * Probe well-known top-level keys libraries use to expose their JSON\n * Schema. Supports both method form (rare) and property form (common).\n * Deliberately narrow — `toJSON` is NOT probed here because it's a\n * generic serialization hook that returns library-internal state for\n * many validators (Seal included), not a JSON Schema.\n */\nfunction extractFromCandidateKeys(\n schemaRecord: Record<string, unknown>,\n): Record<string, unknown> | undefined {\n const candidateKeys = [\"jsonSchema\", \"_jsonSchema\"] as const;\n\n for (const key of candidateKeys) {\n const value = schemaRecord[key];\n\n if (typeof value === \"function\") {\n try {\n const result = (value as () => unknown).call(schemaRecord);\n\n if (result && typeof result === \"object\") {\n return result as Record<string, unknown>;\n }\n } catch {\n // try next candidate\n }\n\n continue;\n }\n\n if (value && typeof value === \"object\") {\n return value as Record<string, unknown>;\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,kBACd,QACA,UAAoC,CAAC,GACA;CACrC,IAAI,CAAC,QAAQ,OAAO;CAKpB,MAAM,iBAAiB,oBAAoB,QAH5B,QAAQ,UAAU,eAGwB;CAEzD,IAAI,gBACF,OAAO;CAIT,MAAM,WAAW,yBAAyB,MAA4C;CAEtF,IAAI,UACF,OAAO;AAIX;;;;;;;;;;;;;AAcA,SAAS,oBACP,QACA,QACqC;CACrC,MAAM,eAAgB,OAA8C;CAEpE,IAAI,CAAC,gBAAgB,OAAO,iBAAiB,UAC3C;CAGF,MAAM,iBAAkB,aAAyC;CAEjE,IAAI,CAAC,kBAAkB,OAAO,mBAAmB,UAC/C;CAGF,MAAM,UAAW,eAA2C;CAE5D,IAAI,OAAO,YAAY,YACrB;CAGF,IAAI;EACF,MAAM,SAAU,QAAqD,KAAK,gBAAgB,EACxF,OACF,CAAC;EAED,IAAI,UAAU,OAAO,WAAW,UAC9B,OAAO;CAEX,QAAQ,CAER;AAGF;;;;;;;;AASA,SAAS,yBACP,cACqC;CAGrC,KAAK,MAAM,OAAO,CAFK,cAAc,aAEP,GAAG;EAC/B,MAAM,QAAQ,aAAa;EAE3B,IAAI,OAAO,UAAU,YAAY;GAC/B,IAAI;IACF,MAAM,SAAU,MAAwB,KAAK,YAAY;IAEzD,IAAI,UAAU,OAAO,WAAW,UAC9B,OAAO;GAEX,QAAQ,CAER;GAEA;EACF;EAEA,IAAI,SAAS,OAAO,UAAU,UAC5B,OAAO;CAEX;AAGF"}
@@ -2,7 +2,7 @@ import { AttachmentPolicy } from "../contracts/attachment-policy.type.mjs";
2
2
  import { Attachment } from "../contracts/attachment.type.mjs";
3
3
  import { ContentPart } from "../contracts/content-part.type.mjs";
4
4
 
5
- //#region ../@warlock.js/ai/src/utils/prepare-attachment-part.d.ts
5
+ //#region ../ai/src/utils/prepare-attachment-part.d.ts
6
6
  /**
7
7
  * Convert a user-supplied `Attachment` into a provider-ready
8
8
  * `ContentPart` the model adapter can consume without doing any I/O of
@@ -1 +1 @@
1
- {"version":3,"file":"prepare-attachment-part.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/utils/prepare-attachment-part.ts"],"mappings":";;;;;;;AAmEA;;;;;;;;;;;;;;;;AAGsB;;;;;;;;;;;;;;;;;;iBAHA,qBAAA,CACpB,UAAA,EAAY,UAAA,EACZ,MAAA,GAAS,gBAAA,GACR,OAAA,CAAQ,WAAA"}
1
+ {"version":3,"file":"prepare-attachment-part.d.mts","names":[],"sources":["../../../../../../../ai/src/utils/prepare-attachment-part.ts"],"mappings":";;;;;;;AAmEA;;;;;;;;;;;;;;;;AAGsB;;;;;;;;;;;;;;;;;;iBAHA,qBAAA,CACpB,UAAA,EAAY,UAAA,EACZ,MAAA,GAAS,gBAAA,GACR,OAAA,CAAQ,WAAA"}
@@ -6,7 +6,7 @@ import { resolveAttachment } from "./resolve-attachment.mjs";
6
6
  import { readFile } from "node:fs/promises";
7
7
  import { extname, isAbsolute, relative, resolve } from "node:path";
8
8
 
9
- //#region ../@warlock.js/ai/src/utils/prepare-attachment-part.ts
9
+ //#region ../ai/src/utils/prepare-attachment-part.ts
10
10
  const IMAGE_EXTENSIONS_TO_MEDIA_TYPE = {
11
11
  ".png": "image/png",
12
12
  ".jpg": "image/jpeg",