@nhtio/adk 0.1.0-master-e6c58205 → 0.1.0-master-89b47bec

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 (290) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/__vite-browser-external-CU7uua8b.mjs +9 -0
  3. package/__vite-browser-external-CU7uua8b.mjs.map +1 -0
  4. package/__vite-browser-external-DAHxjh-D.js +13 -0
  5. package/__vite-browser-external-DAHxjh-D.js.map +1 -0
  6. package/batteries/embeddings/openai/adapter.cjs +1 -1
  7. package/batteries/embeddings/openai/adapter.mjs +1 -1
  8. package/batteries/embeddings/webllm/adapter.cjs +1 -1
  9. package/batteries/embeddings/webllm/adapter.mjs +1 -1
  10. package/batteries/llm/ollama/adapter.cjs +5 -5
  11. package/batteries/llm/ollama/adapter.mjs +5 -5
  12. package/batteries/llm/ollama/helpers.cjs +2 -2
  13. package/batteries/llm/ollama/helpers.mjs +2 -2
  14. package/batteries/llm/ollama/validation.cjs +1 -1
  15. package/batteries/llm/ollama/validation.mjs +1 -1
  16. package/batteries/llm/openai_chat_completions/adapter.cjs +5 -5
  17. package/batteries/llm/openai_chat_completions/adapter.mjs +5 -5
  18. package/batteries/llm/openai_chat_completions/helpers.cjs +2 -2
  19. package/batteries/llm/openai_chat_completions/helpers.mjs +2 -2
  20. package/batteries/llm/openai_chat_completions/validation.cjs +1 -1
  21. package/batteries/llm/openai_chat_completions/validation.mjs +1 -1
  22. package/batteries/llm/webllm_chat_completions/adapter.cjs +5 -5
  23. package/batteries/llm/webllm_chat_completions/adapter.mjs +5 -5
  24. package/batteries/llm/webllm_chat_completions/validation.cjs +1 -1
  25. package/batteries/llm/webllm_chat_completions/validation.mjs +1 -1
  26. package/batteries/media/contracts.cjs +38 -8
  27. package/batteries/media/contracts.cjs.map +1 -1
  28. package/batteries/media/contracts.d.ts +86 -6
  29. package/batteries/media/contracts.mjs +37 -9
  30. package/batteries/media/contracts.mjs.map +1 -1
  31. package/batteries/media/engines/audio_decode.cjs +46 -6
  32. package/batteries/media/engines/audio_decode.cjs.map +1 -1
  33. package/batteries/media/engines/audio_decode.d.ts +9 -5
  34. package/batteries/media/engines/audio_decode.mjs +47 -7
  35. package/batteries/media/engines/audio_decode.mjs.map +1 -1
  36. package/batteries/media/engines/data.cjs +159 -0
  37. package/batteries/media/engines/data.cjs.map +1 -0
  38. package/batteries/media/engines/data.d.ts +36 -0
  39. package/batteries/media/engines/data.mjs +157 -0
  40. package/batteries/media/engines/data.mjs.map +1 -0
  41. package/batteries/media/engines/exceljs.cjs +290 -0
  42. package/batteries/media/engines/exceljs.cjs.map +1 -0
  43. package/batteries/media/engines/exceljs.d.ts +41 -0
  44. package/batteries/media/engines/exceljs.mjs +288 -0
  45. package/batteries/media/engines/exceljs.mjs.map +1 -0
  46. package/batteries/media/engines/execa_executor.cjs +1 -1
  47. package/batteries/media/engines/execa_executor.mjs +1 -1
  48. package/batteries/media/engines/fs_workspace.cjs +1 -1
  49. package/batteries/media/engines/fs_workspace.mjs +1 -1
  50. package/batteries/media/engines/jimp.cjs +24 -2
  51. package/batteries/media/engines/jimp.cjs.map +1 -1
  52. package/batteries/media/engines/jimp.d.ts +3 -1
  53. package/batteries/media/engines/jimp.mjs +24 -2
  54. package/batteries/media/engines/jimp.mjs.map +1 -1
  55. package/batteries/media/engines/sharp.cjs +37 -4
  56. package/batteries/media/engines/sharp.cjs.map +1 -1
  57. package/batteries/media/engines/sharp.d.ts +5 -3
  58. package/batteries/media/engines/sharp.mjs +37 -4
  59. package/batteries/media/engines/sharp.mjs.map +1 -1
  60. package/batteries/media/engines/sheetjs.cjs +438 -0
  61. package/batteries/media/engines/sheetjs.cjs.map +1 -0
  62. package/batteries/media/engines/sheetjs.d.ts +51 -0
  63. package/batteries/media/engines/sheetjs.mjs +436 -0
  64. package/batteries/media/engines/sheetjs.mjs.map +1 -0
  65. package/batteries/media/engines/soffice.cjs +37 -3
  66. package/batteries/media/engines/soffice.cjs.map +1 -1
  67. package/batteries/media/engines/soffice.mjs +38 -4
  68. package/batteries/media/engines/soffice.mjs.map +1 -1
  69. package/batteries/media/engines/tesseract_js.cjs +1 -1
  70. package/batteries/media/engines/tesseract_js.mjs +1 -1
  71. package/batteries/media/engines/transformers_asr.cjs +1 -1
  72. package/batteries/media/engines/transformers_asr.mjs +1 -1
  73. package/batteries/media/forge.cjs +89 -20
  74. package/batteries/media/forge.cjs.map +1 -1
  75. package/batteries/media/forge.mjs +89 -20
  76. package/batteries/media/forge.mjs.map +1 -1
  77. package/batteries/media/formats.d.ts +9 -0
  78. package/batteries/media/index.d.ts +8 -6
  79. package/batteries/media/lint.cjs +270 -58
  80. package/batteries/media/lint.cjs.map +1 -1
  81. package/batteries/media/lint.d.ts +45 -0
  82. package/batteries/media/lint.mjs +267 -58
  83. package/batteries/media/lint.mjs.map +1 -1
  84. package/batteries/media/registry.d.ts +11 -2
  85. package/batteries/media/steps/data.d.ts +26 -0
  86. package/batteries/media/steps/doc.d.ts +17 -7
  87. package/batteries/media/steps/patch.d.ts +90 -0
  88. package/batteries/media/steps/sheet.d.ts +10 -6
  89. package/batteries/media/steps/text.d.ts +4 -1
  90. package/batteries/media/validate.d.ts +5 -0
  91. package/batteries/media/verbs.d.ts +12 -1
  92. package/batteries/media.cjs +869 -448
  93. package/batteries/media.cjs.map +1 -1
  94. package/batteries/media.mjs +829 -409
  95. package/batteries/media.mjs.map +1 -1
  96. package/batteries/storage/flydrive.cjs +3 -6
  97. package/batteries/storage/flydrive.cjs.map +1 -1
  98. package/batteries/storage/flydrive.mjs +3 -6
  99. package/batteries/storage/flydrive.mjs.map +1 -1
  100. package/batteries/storage/in_memory.cjs +1 -1
  101. package/batteries/storage/in_memory.mjs +1 -1
  102. package/batteries/storage/opfs.cjs +1 -1
  103. package/batteries/storage/opfs.mjs +1 -1
  104. package/batteries/tools/_shared.cjs +2 -2
  105. package/batteries/tools/_shared.mjs +2 -2
  106. package/batteries/tools/color.cjs +2 -2
  107. package/batteries/tools/color.mjs +2 -2
  108. package/batteries/tools/comparison.cjs +3 -3
  109. package/batteries/tools/comparison.mjs +3 -3
  110. package/batteries/tools/data_structure.cjs +3 -3
  111. package/batteries/tools/data_structure.mjs +3 -3
  112. package/batteries/tools/datetime_extended.cjs +3 -3
  113. package/batteries/tools/datetime_extended.mjs +3 -3
  114. package/batteries/tools/datetime_math.cjs +3 -3
  115. package/batteries/tools/datetime_math.mjs +3 -3
  116. package/batteries/tools/encoding.cjs +3 -3
  117. package/batteries/tools/encoding.mjs +3 -3
  118. package/batteries/tools/formatting.cjs +3 -3
  119. package/batteries/tools/formatting.mjs +3 -3
  120. package/batteries/tools/geo_basics.cjs +2 -2
  121. package/batteries/tools/geo_basics.mjs +2 -2
  122. package/batteries/tools/math.cjs +3 -3
  123. package/batteries/tools/math.mjs +3 -3
  124. package/batteries/tools/memory.cjs +6 -6
  125. package/batteries/tools/memory.mjs +6 -6
  126. package/batteries/tools/parsing.cjs +4 -4
  127. package/batteries/tools/parsing.mjs +4 -4
  128. package/batteries/tools/retrievables.cjs +5 -5
  129. package/batteries/tools/retrievables.mjs +5 -5
  130. package/batteries/tools/scrapper.cjs +1 -1
  131. package/batteries/tools/scrapper.mjs +1 -1
  132. package/batteries/tools/searxng.cjs +1 -1
  133. package/batteries/tools/searxng.mjs +1 -1
  134. package/batteries/tools/standing_instructions.cjs +4 -4
  135. package/batteries/tools/standing_instructions.mjs +4 -4
  136. package/batteries/tools/statistics.cjs +4 -4
  137. package/batteries/tools/statistics.mjs +4 -4
  138. package/batteries/tools/string_processing.cjs +3 -3
  139. package/batteries/tools/string_processing.mjs +3 -3
  140. package/batteries/tools/structured_data.cjs +3 -3
  141. package/batteries/tools/structured_data.mjs +3 -3
  142. package/batteries/tools/text_analysis.cjs +3 -3
  143. package/batteries/tools/text_analysis.mjs +3 -3
  144. package/batteries/tools/text_comparison.cjs +2 -2
  145. package/batteries/tools/text_comparison.mjs +2 -2
  146. package/batteries/tools/time.cjs +3 -3
  147. package/batteries/tools/time.mjs +3 -3
  148. package/batteries/tools/unit_conversion.cjs +2 -2
  149. package/batteries/tools/unit_conversion.mjs +2 -2
  150. package/batteries/tools/web_retrieval.cjs +1 -1
  151. package/batteries/tools/web_retrieval.mjs +1 -1
  152. package/batteries/tools.cjs +2 -2
  153. package/batteries/tools.mjs +2 -2
  154. package/batteries/vector/arangodb.cjs +1 -1
  155. package/batteries/vector/arangodb.mjs +1 -1
  156. package/batteries/vector/clickhouse.cjs +1 -1
  157. package/batteries/vector/clickhouse.mjs +1 -1
  158. package/batteries/vector/cloudflare.cjs +1 -1
  159. package/batteries/vector/cloudflare.mjs +1 -1
  160. package/batteries/vector/couchbase.cjs +1 -1
  161. package/batteries/vector/couchbase.mjs +1 -1
  162. package/batteries/vector/duckdb.cjs +1 -1
  163. package/batteries/vector/duckdb.mjs +1 -1
  164. package/batteries/vector/elasticsearch.cjs +1 -1
  165. package/batteries/vector/elasticsearch.mjs +1 -1
  166. package/batteries/vector/filters.cjs +1 -1
  167. package/batteries/vector/filters.mjs +1 -1
  168. package/batteries/vector/hnswlib.cjs +1 -1
  169. package/batteries/vector/hnswlib.mjs +1 -1
  170. package/batteries/vector/lancedb.cjs +1 -1
  171. package/batteries/vector/lancedb.mjs +1 -1
  172. package/batteries/vector/mariadb.cjs +1 -1
  173. package/batteries/vector/mariadb.mjs +1 -1
  174. package/batteries/vector/meilisearch.cjs +1 -1
  175. package/batteries/vector/meilisearch.mjs +1 -1
  176. package/batteries/vector/migrate.cjs +1 -1
  177. package/batteries/vector/migrate.mjs +1 -1
  178. package/batteries/vector/mongodb.cjs +1 -1
  179. package/batteries/vector/mongodb.mjs +1 -1
  180. package/batteries/vector/neo4j.cjs +1 -1
  181. package/batteries/vector/neo4j.mjs +1 -1
  182. package/batteries/vector/opensearch.cjs +1 -1
  183. package/batteries/vector/opensearch.mjs +1 -1
  184. package/batteries/vector/oracle23ai.cjs +1 -1
  185. package/batteries/vector/oracle23ai.mjs +1 -1
  186. package/batteries/vector/pinecone.cjs +1 -1
  187. package/batteries/vector/pinecone.mjs +1 -1
  188. package/batteries/vector/redis.cjs +1 -1
  189. package/batteries/vector/redis.mjs +1 -1
  190. package/batteries/vector/retrievable.cjs +1 -1
  191. package/batteries/vector/retrievable.mjs +1 -1
  192. package/batteries/vector/s3vectors.cjs +1 -1
  193. package/batteries/vector/s3vectors.mjs +1 -1
  194. package/batteries/vector/solr.cjs +1 -1
  195. package/batteries/vector/solr.mjs +1 -1
  196. package/batteries/vector/surrealdb.cjs +1 -1
  197. package/batteries/vector/surrealdb.mjs +1 -1
  198. package/batteries/vector/typesense.cjs +1 -1
  199. package/batteries/vector/typesense.mjs +1 -1
  200. package/batteries/vector/vespa.cjs +1 -1
  201. package/batteries/vector/vespa.mjs +1 -1
  202. package/batteries/vector/weaviate.cjs +1 -1
  203. package/batteries/vector/weaviate.mjs +1 -1
  204. package/batteries.cjs +2 -2
  205. package/batteries.mjs +2 -2
  206. package/bundled_xlsx.d.ts +1075 -0
  207. package/{common-BxoznqbX.mjs → common-BQoFv108.mjs} +7 -7
  208. package/{common-BxoznqbX.mjs.map → common-BQoFv108.mjs.map} +1 -1
  209. package/{common-BBK2e5ro.js → common-DmDn4Gfl.js} +7 -7
  210. package/{common-BBK2e5ro.js.map → common-DmDn4Gfl.js.map} +1 -1
  211. package/common.cjs +7 -7
  212. package/common.mjs +7 -7
  213. package/{dispatch_runner-Hn5idJYx.js → dispatch_runner-BwplbCPr.js} +3 -3
  214. package/{dispatch_runner-Hn5idJYx.js.map → dispatch_runner-BwplbCPr.js.map} +1 -1
  215. package/{dispatch_runner-DUrpj0xR.mjs → dispatch_runner-C1ar_D7W.mjs} +3 -3
  216. package/{dispatch_runner-DUrpj0xR.mjs.map → dispatch_runner-C1ar_D7W.mjs.map} +1 -1
  217. package/dispatch_runner.cjs +1 -1
  218. package/dispatch_runner.mjs +1 -1
  219. package/eslint.cjs +1 -1
  220. package/eslint.mjs +1 -1
  221. package/forge.cjs +4 -4
  222. package/forge.mjs +4 -4
  223. package/formats-CCylUHZw.mjs +161 -0
  224. package/formats-CCylUHZw.mjs.map +1 -0
  225. package/formats-DZVuqZUN.js +196 -0
  226. package/formats-DZVuqZUN.js.map +1 -0
  227. package/guards.cjs +8 -8
  228. package/guards.mjs +8 -8
  229. package/index.cjs +11 -11
  230. package/index.mjs +11 -11
  231. package/mcp/adk-docs-corpus.json +1 -1
  232. package/package.json +198 -182
  233. package/{scrapper-DLj_KkxK.mjs → scrapper-Dn2wXu0Y.mjs} +5 -5
  234. package/{scrapper-DLj_KkxK.mjs.map → scrapper-Dn2wXu0Y.mjs.map} +1 -1
  235. package/{scrapper-Cmf1CSA-.js → scrapper-mBZ0Odq7.js} +5 -5
  236. package/{scrapper-Cmf1CSA-.js.map → scrapper-mBZ0Odq7.js.map} +1 -1
  237. package/{searxng-BKs5s8Su.js → searxng-Dj-iP_Vz.js} +5 -5
  238. package/{searxng-BKs5s8Su.js.map → searxng-Dj-iP_Vz.js.map} +1 -1
  239. package/{searxng-BJ-aZcMz.mjs → searxng-DjFxtFf6.mjs} +5 -5
  240. package/{searxng-BJ-aZcMz.mjs.map → searxng-DjFxtFf6.mjs.map} +1 -1
  241. package/server.json +21 -0
  242. package/skills/adk-assembly/SKILL.md +2 -2
  243. package/{spooled_artifact-BR0IhU9y.js → spooled_artifact-BCmPrxZS.js} +3 -3
  244. package/{spooled_artifact-BR0IhU9y.js.map → spooled_artifact-BCmPrxZS.js.map} +1 -1
  245. package/{spooled_artifact-nTE6ujM8.mjs → spooled_artifact-DL36jnqA.mjs} +3 -3
  246. package/{spooled_artifact-nTE6ujM8.mjs.map → spooled_artifact-DL36jnqA.mjs.map} +1 -1
  247. package/spooled_artifact.cjs +2 -2
  248. package/spooled_artifact.mjs +2 -2
  249. package/{spooled_markdown_artifact-Dj3fNowz.js → spooled_markdown_artifact-CD4PrrpV.js} +3 -3
  250. package/{spooled_markdown_artifact-Dj3fNowz.js.map → spooled_markdown_artifact-CD4PrrpV.js.map} +1 -1
  251. package/{spooled_markdown_artifact-DIYzbQv8.mjs → spooled_markdown_artifact-Da-Xnebh.mjs} +3 -3
  252. package/{spooled_markdown_artifact-DIYzbQv8.mjs.map → spooled_markdown_artifact-Da-Xnebh.mjs.map} +1 -1
  253. package/{thought-Cde2Y_GK.mjs → thought-CtOoZUSE.mjs} +3 -3
  254. package/{thought-Cde2Y_GK.mjs.map → thought-CtOoZUSE.mjs.map} +1 -1
  255. package/{thought-BFtsnUTU.js → thought-eka4iUHa.js} +3 -3
  256. package/{thought-BFtsnUTU.js.map → thought-eka4iUHa.js.map} +1 -1
  257. package/{tool-CcxYxA5X.mjs → tool-CITF20yJ.mjs} +3 -3
  258. package/{tool-CcxYxA5X.mjs.map → tool-CITF20yJ.mjs.map} +1 -1
  259. package/{tool-B2nnkwNU.js → tool-Dhjca7rC.js} +3 -3
  260. package/{tool-B2nnkwNU.js.map → tool-Dhjca7rC.js.map} +1 -1
  261. package/{tool_call-BxL3eU1k.js → tool_call-Cyi0hUUc.js} +4 -4
  262. package/{tool_call-BxL3eU1k.js.map → tool_call-Cyi0hUUc.js.map} +1 -1
  263. package/{tool_call-B3MOog2R.mjs → tool_call-D_k36aI4.mjs} +4 -4
  264. package/{tool_call-B3MOog2R.mjs.map → tool_call-D_k36aI4.mjs.map} +1 -1
  265. package/{tool_registry-BaLUIzWz.mjs → tool_registry-CZ55mIti.mjs} +152 -143
  266. package/tool_registry-CZ55mIti.mjs.map +1 -0
  267. package/{tool_registry-BdKlPuHS.js → tool_registry-DwZ6pzN4.js} +151 -142
  268. package/tool_registry-DwZ6pzN4.js.map +1 -0
  269. package/{turn_runner-M2I8G2ok.js → turn_runner-CCZcsoDU.js} +5 -5
  270. package/{turn_runner-M2I8G2ok.js.map → turn_runner-CCZcsoDU.js.map} +1 -1
  271. package/{turn_runner-BV4BaZK9.mjs → turn_runner-DRPpVvsd.mjs} +5 -5
  272. package/{turn_runner-BV4BaZK9.mjs.map → turn_runner-DRPpVvsd.mjs.map} +1 -1
  273. package/turn_runner.cjs +1 -1
  274. package/turn_runner.mjs +1 -1
  275. package/{validate-JOHfh-BB.mjs → validate-C_hTnDBE.mjs} +95 -8
  276. package/validate-C_hTnDBE.mjs.map +1 -0
  277. package/{validate-DgDZkUKs.js → validate-gaSa9bsk.js} +95 -8
  278. package/validate-gaSa9bsk.js.map +1 -0
  279. package/xlsx-B0sTpEC2.js +30615 -0
  280. package/xlsx-B0sTpEC2.js.map +1 -0
  281. package/xlsx-DiMpn_Xv.mjs +30596 -0
  282. package/xlsx-DiMpn_Xv.mjs.map +1 -0
  283. package/xlsx.zahl-D2_Q-Xs4.mjs +6 -0
  284. package/xlsx.zahl-D2_Q-Xs4.mjs.map +1 -0
  285. package/xlsx.zahl-ZIcUQVv8.js +7 -0
  286. package/xlsx.zahl-ZIcUQVv8.js.map +1 -0
  287. package/tool_registry-BaLUIzWz.mjs.map +0 -1
  288. package/tool_registry-BdKlPuHS.js.map +0 -1
  289. package/validate-DgDZkUKs.js.map +0 -1
  290. package/validate-JOHfh-BB.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { c as isObject, o as isError } from "./tool_registry-BaLUIzWz.mjs";
1
+ import { c as isObject, o as isError } from "./tool_registry-CZ55mIti.mjs";
2
2
  import "./guards.mjs";
3
3
  import { PCM_MIME } from "./batteries/media/contracts.mjs";
4
4
  import { a as E_MEDIA_NOT_PIPE_EXPRESSIBLE, i as E_MEDIA_MISSING_ARG, l as E_MEDIA_UNKNOWN_ARG, n as E_MEDIA_BAD_ARG, r as E_MEDIA_ENGINE_REQUIRED, u as E_MEDIA_UNKNOWN_VERB } from "./exceptions-BLTn4Ofs.mjs";
@@ -170,7 +170,7 @@ var fromOps = (ops) => ({ steps: ops.map((op) => ({
170
170
  * indices are 1-based everywhere; arg names follow one-meaning-one-name (`to`, `with`, `match`,
171
171
  * `replace`, `order`, `pages`, `at`).
172
172
  */
173
- /** Conversion targets supported by `convert` (matches the server's enum exactly). */
173
+ /** Conversion targets supported by `convert` (the server's enum plus the SheetJS/data matrix). */
174
174
  var CONVERT_TARGETS = [
175
175
  "pdf",
176
176
  "html",
@@ -178,6 +178,7 @@ var CONVERT_TARGETS = [
178
178
  "md",
179
179
  "csv",
180
180
  "json",
181
+ "yaml",
181
182
  "docx",
182
183
  "doc",
183
184
  "rtf",
@@ -185,6 +186,13 @@ var CONVERT_TARGETS = [
185
186
  "xlsx",
186
187
  "xls",
187
188
  "ods",
189
+ "xlsm",
190
+ "xlsb",
191
+ "fods",
192
+ "sylk",
193
+ "dif",
194
+ "dbf",
195
+ "numbers",
188
196
  "pptx",
189
197
  "ppt",
190
198
  "odp"
@@ -271,7 +279,7 @@ var VERBS = [
271
279
  },
272
280
  {
273
281
  id: "redact",
274
- description: "Redact matching text. Prefer literal strings; /regex/ is supported.",
282
+ description: "Redact matching text. Prefer literal strings; /regex/ is supported. PDF redaction is VISUAL (draw-over + metadata strip; content streams keep the text) — for content-level PDF redaction, extract text first.",
275
283
  args: {
276
284
  match: {
277
285
  type: "regex-or-string-list",
@@ -332,7 +340,7 @@ var VERBS = [
332
340
  },
333
341
  {
334
342
  id: "diff",
335
- description: "Compare this media against another; returns a structured diff.",
343
+ description: "Compare this media against another; returns a structured diff whose patch text feeds apply_patch directly.",
336
344
  args: { with: {
337
345
  type: "media-ref",
338
346
  required: true,
@@ -347,12 +355,12 @@ var VERBS = [
347
355
  },
348
356
  {
349
357
  id: "apply_patch",
350
- description: "Apply a unified-diff patch to the media text.",
358
+ description: "Apply a patch to the media text: a unified diff (as produced by the diff verb — that output feeds this verb directly), or a structured \"*** Begin Patch\" envelope (Add/Delete/Update File) for multi-file changes. In the structured envelope, add-file content lines must start with \"+\" (the unified-diff convention).",
351
359
  args: {
352
360
  patch: {
353
361
  type: "string",
354
362
  required: true,
355
- description: "The unified diff content."
363
+ description: "The patch content: unified diff, or a structured envelope starting with \"*** Begin Patch\". Add-file content lines must start with \"+\"."
356
364
  },
357
365
  with: {
358
366
  type: "media-ref-list",
@@ -362,6 +370,70 @@ var VERBS = [
362
370
  appliesTo: ["document"],
363
371
  output: "media"
364
372
  },
373
+ {
374
+ id: "append",
375
+ description: "Append text to text-family media (txt/md/csv/yaml).",
376
+ args: {
377
+ text: {
378
+ type: "string",
379
+ required: true,
380
+ description: "The text to append."
381
+ },
382
+ newline: {
383
+ type: "boolean",
384
+ description: "Terminate with a newline (and separate from existing content). Default true."
385
+ }
386
+ },
387
+ appliesTo: ["document", "spreadsheet"],
388
+ output: "media"
389
+ },
390
+ {
391
+ id: "data.set",
392
+ description: "Set a value at a path in JSON/YAML media (creates missing containers).",
393
+ args: {
394
+ path: {
395
+ type: "string",
396
+ required: true,
397
+ description: "Dot/bracket path, e.g. a.b[2].c"
398
+ },
399
+ value: {
400
+ type: "string",
401
+ required: true,
402
+ description: "JSON-encoded value: '42', '\"text\"', '{\"k\":1}'. Bare strings accepted."
403
+ }
404
+ },
405
+ appliesTo: ["document"],
406
+ output: "media"
407
+ },
408
+ {
409
+ id: "data.merge",
410
+ description: "Merge a JSON object fragment into JSON/YAML media.",
411
+ args: {
412
+ fragment: {
413
+ type: "string",
414
+ required: true,
415
+ description: "The JSON object to merge, e.g. '{\"a\":{\"b\":1}}'."
416
+ },
417
+ strategy: {
418
+ type: "enum",
419
+ values: ["deep", "shallow"],
420
+ description: "Merge strategy. Default deep."
421
+ }
422
+ },
423
+ appliesTo: ["document"],
424
+ output: "media"
425
+ },
426
+ {
427
+ id: "data.delete",
428
+ description: "Delete a key or array element at a path in JSON/YAML media.",
429
+ args: { path: {
430
+ type: "string",
431
+ required: true,
432
+ description: "Dot/bracket path of the key/element to remove."
433
+ } },
434
+ appliesTo: ["document"],
435
+ output: "media"
436
+ },
365
437
  {
366
438
  id: "extract.text",
367
439
  description: "Extract text from any supported media (document, spreadsheet, image). To limit pages: select pages=… | extract text.",
@@ -488,6 +560,7 @@ var VERBS = [
488
560
  description: "Insert after this 1-based row."
489
561
  }
490
562
  },
563
+ requires: { capability: "edit" },
491
564
  appliesTo: ["spreadsheet"],
492
565
  output: "media"
493
566
  },
@@ -518,6 +591,7 @@ var VERBS = [
518
591
  description: "Insert after this 1-based column."
519
592
  }
520
593
  },
594
+ requires: { capability: "edit" },
521
595
  appliesTo: ["spreadsheet"],
522
596
  output: "media"
523
597
  },
@@ -535,6 +609,7 @@ var VERBS = [
535
609
  description: "JSON array of updates: '[{\"address\":\"B2\",\"value\":42}]' or '[{\"row\":2,\"col\":3,\"value\":\"x\"}]'."
536
610
  }
537
611
  },
612
+ requires: { capability: "edit" },
538
613
  appliesTo: ["spreadsheet"],
539
614
  output: "media"
540
615
  },
@@ -553,6 +628,7 @@ var VERBS = [
553
628
  description: "1-based row indices to delete."
554
629
  }
555
630
  },
631
+ requires: { capability: "edit" },
556
632
  appliesTo: ["spreadsheet"],
557
633
  output: "media"
558
634
  },
@@ -571,6 +647,7 @@ var VERBS = [
571
647
  description: "1-based column indices to delete."
572
648
  }
573
649
  },
650
+ requires: { capability: "edit" },
574
651
  appliesTo: ["spreadsheet"],
575
652
  output: "media"
576
653
  },
@@ -589,6 +666,7 @@ var VERBS = [
589
666
  description: "New sheet name."
590
667
  }
591
668
  },
669
+ requires: { capability: "edit" },
592
670
  appliesTo: ["spreadsheet"],
593
671
  output: "media"
594
672
  },
@@ -607,6 +685,7 @@ var VERBS = [
607
685
  description: "Insert at this 1-based position."
608
686
  }
609
687
  },
688
+ requires: { capability: "edit" },
610
689
  appliesTo: ["spreadsheet"],
611
690
  output: "media"
612
691
  },
@@ -618,6 +697,7 @@ var VERBS = [
618
697
  required: true,
619
698
  description: "Sheet name to remove (names only; quote it)."
620
699
  } },
700
+ requires: { capability: "edit" },
621
701
  appliesTo: ["spreadsheet"],
622
702
  output: "media"
623
703
  },
@@ -629,6 +709,7 @@ var VERBS = [
629
709
  required: true,
630
710
  description: "JSON array of sheet names and/or 1-based indices in the new order: '[\"Summary\",2,3]'."
631
711
  } },
712
+ requires: { capability: "edit" },
632
713
  appliesTo: ["spreadsheet"],
633
714
  output: "media"
634
715
  },
@@ -658,6 +739,7 @@ var VERBS = [
658
739
  description: "JSON array of renames: '[{\"from\":\"Old\",\"to\":\"New\"}]'."
659
740
  }
660
741
  },
742
+ requires: { capability: "edit" },
661
743
  appliesTo: ["spreadsheet"],
662
744
  output: "media"
663
745
  },
@@ -1015,10 +1097,15 @@ var levenshtein = (a, b) => {
1015
1097
  * validation differs.
1016
1098
  */
1017
1099
  /** `true` when the deployment satisfies a verb's capability requirement. */
1018
- var satisfies = (capabilities, requires) => requires.capability === "mutate" ? capabilities.hasMutate() : capabilities.hasConvert(requires.from, requires.to);
1100
+ var satisfies = (capabilities, requires) => {
1101
+ if (requires.capability === "mutate") return capabilities.hasMutate();
1102
+ if (requires.capability === "edit") return capabilities.hasEdit?.(void 0, requires.op) ?? false;
1103
+ return capabilities.hasConvert(requires.from, requires.to);
1104
+ };
1019
1105
  /** A human phrase for an unmet requirement, for the do-not-retry error. */
1020
1106
  var requirementText = (requires) => {
1021
1107
  if (requires.capability === "mutate") return "an engine that can mutate this media";
1108
+ if (requires.capability === "edit") return `an engine that can edit this media${requires.op ? ` (op "${requires.op}")` : ""}`;
1022
1109
  return `an engine that can convert${requires.from ? ` from ${requires.from}` : ""}${requires.to ? ` to ${requires.to}` : ""}`;
1023
1110
  };
1024
1111
  /** The folded verb forms available under a given capability configuration. */
@@ -1212,4 +1299,4 @@ var validateOps = (ops, options) => {
1212
1299
  //#endregion
1213
1300
  export { VERBS as a, suggestVerbs as c, isMediaRef as d, isRegExpRef as f, FOLDED_VERBS as i, canonicalFlags as l, toPipe as m, validateOps as n, VERB_INDEX as o, toOps as p, validateSegments as r, foldVerb as s, availableVerbs as t, fromOps as u };
1214
1301
 
1215
- //# sourceMappingURL=validate-JOHfh-BB.mjs.map
1302
+ //# sourceMappingURL=validate-C_hTnDBE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-C_hTnDBE.mjs","names":[],"sources":["../src/batteries/media/plan.ts","../src/batteries/media/verbs.ts","../src/batteries/media/validate.ts"],"sourcesContent":["/**\n * The neutral `MediaPlan` intermediate representation and its canonical serializers.\n *\n * @remarks\n * Internal sibling of the `@nhtio/adk/batteries/media` entry. All three front-ends — the\n * chainable builder, the pipe-string parser, and the JSON ops array — compile to this one IR,\n * and the step runtime consumes only this IR. Invariants (frozen design, section 0.7):\n *\n * - **Serializable.** No live `RegExp`, `Media`, or function values — regexes are\n * `{ source, flags }`, media refs are typed handles. A plan can be logged, content-hashed,\n * and embedded in a tool result.\n * - **Round-trip is fixed-point.** `parsePipe(toPipe(plan))` produces an equal plan and\n * `toPipe` is idempotent. `toPipe(parsePipe(s)) === s` is NOT promised (e.g. `2,3,4,5`\n * renders as `2-5`).\n * - **Engine-agnostic.** Steps name verbs, never engines.\n */\n\nimport { isObject } from '@nhtio/adk/guards'\nimport { E_MEDIA_NOT_PIPE_EXPRESSIBLE } from './exceptions'\n\n/**\n * A serializable regex reference. Never a live `RegExp` in the IR.\n */\nexport interface RegExpRef {\n /** The regex source, exactly as `RegExp.prototype.source` would report it. */\n source: string\n /** Sorted flag characters (canonicalized — `gi`, never `ig`). */\n flags: string\n}\n\n/**\n * A reference to another media participating in a multi-input verb (`merge`, `diff`,\n * `apply_patch`, `slides.update_image`).\n *\n * @remarks\n * The `id` variant is the canonical model-facing form — the pipe syntax is an inline\n * `@id` token (`merge with=@018f…`) and the ops form carries the same id. The `builder`\n * variant is implementor-only (a nested chain: `mp(a).diff(mp(b).convert('txt'))`) and is\n * not expressible in a flat pipe string.\n */\nexport type MediaRef = { kind: 'id'; id: string } | { kind: 'builder'; plan: MediaPlan }\n\n/** Scalar arg values the flat pipe grammar can express directly. */\nexport type MediaArgScalar = string | number | boolean | RegExpRef | MediaRef\n\n/**\n * A structured (JSON-shaped) arg value. In the pipe surface these are written as quoted JSON\n * (`updates='[{\"address\":\"B2\",\"value\":3}]'`); in ops they are plain JSON. `null` is legal only\n * inside structured values (cell values), never as a top-level scalar.\n */\nexport type MediaArgJson =\n | string\n | number\n | boolean\n | null\n | MediaArgJson[]\n | { [key: string]: MediaArgJson }\n\n/**\n * The value space of a single verb arg in the IR.\n *\n * @remarks\n * Flat lists (`types=image,font` → `['image','font']`) are `MediaArgScalar[]`. Whether a\n * value parsed from quoted JSON or a flat token is decided by the verb's arg schema — the IR\n * stores the final shape only.\n */\nexport type MediaArgValue = MediaArgScalar | MediaArgScalar[] | MediaArgJson\n\n/** Source span carried by steps parsed from a pipe string, for error mapping. */\nexport interface SourceSpan {\n /** Zero-based character offset into the source string. */\n offset: number\n /** One-based line number. */\n line: number\n /** One-based column number. */\n col: number\n /** Length of the spanned text in characters. */\n length: number\n}\n\n/** One transform step: a canonical verb id plus its validated content args. */\nexport interface MediaStep {\n /**\n * Canonical verb id — dot-namespaced snake_case (`convert`, `select`, `extract.text`,\n * `sheet.update_cells`, `image.resize`).\n */\n verb: string\n /** Validated content args for this verb. */\n args: Record<string, MediaArgValue>\n /** Present when the step came from a pipe string; absent for builder/ops origins. */\n span?: SourceSpan\n}\n\n/** The neutral plan: an ordered, linear list of steps. No branching. */\nexport interface MediaPlan {\n /** The ordered transform steps. */\n steps: MediaStep[]\n}\n\n/** The JSON ops front-end's step shape — identical to {@link MediaStep} minus the span. */\nexport interface MediaOp {\n /** The canonical (or foldable) verb id. */\n verb: string\n /** The verb's named args. */\n args: Record<string, MediaArgValue>\n}\n\n// ── guards ───────────────────────────────────────────────────────────────────\n\n/** `true` when `value` is a {@link RegExpRef}. */\nexport const isRegExpRef = (value: unknown): value is RegExpRef => {\n if (!isObject(value)) return false\n const v = value as Record<string, unknown>\n return typeof v.source === 'string' && typeof v.flags === 'string' && Object.keys(v).length === 2\n}\n\n/** `true` when `value` is a {@link MediaRef}. */\nexport const isMediaRef = (value: unknown): value is MediaRef => {\n if (!isObject(value)) return false\n const v = value as MediaRef\n if (v.kind === 'id') return typeof (v as { id?: unknown }).id === 'string'\n if (v.kind === 'builder') return isObject((v as { plan?: unknown }).plan)\n return false\n}\n\n// ── canonical rendering helpers ──────────────────────────────────────────────\n\n/** Characters legal in an unquoted bareword value. */\nconst BAREWORD = /^[A-Za-z0-9_]+$/\n/** Strings that would lex as a non-ident token and therefore must be quoted. */\nconst LEXES_AS_OTHER = /^(?:\\d+(?:-\\d+)?|\\d+\\.\\d+|true|false|@.*)$/\n\n/**\n * The frozen quoting predicate: quote any string that is empty, would lex as a number, range,\n * boolean, or `@id` token, starts with `/`, or contains a character outside `[A-Za-z0-9_]`.\n */\nconst renderString = (s: string): string => {\n if (s.length === 0 || !BAREWORD.test(s) || LEXES_AS_OTHER.test(s) || s.startsWith('/')) {\n return `\"${s.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n')}\"`\n }\n return s\n}\n\n/** Canonicalize regex flags: validate against JS flags and sort. */\nexport const canonicalFlags = (flags: string): string => Array.from(flags).sort().join('')\n\n/** Render a {@link RegExpRef} back to a pipe regex literal, re-escaping bare slashes. */\nconst renderRegExp = (ref: RegExpRef): string => {\n const source = ref.source.length === 0 ? '(?:)' : ref.source\n // Escape bare `/` that are not already escaped and not inside a character class.\n let out = ''\n let inClass = false\n for (let i = 0; i < source.length; i++) {\n const ch = source[i]\n if (ch === '\\\\') {\n out += ch + (source[i + 1] ?? '')\n i++\n continue\n }\n if (ch === '[') inClass = true\n else if (ch === ']') inClass = false\n if (ch === '/' && !inClass) {\n out += '\\\\/'\n continue\n }\n out += ch\n }\n return `/${out}/${canonicalFlags(ref.flags)}`\n}\n\n/**\n * Compress maximal ascending consecutive runs in a number list to `a-b` range tokens.\n * Order-preserving and lossless on the array; never sorts or dedupes.\n */\nconst renderNumberList = (nums: number[]): string => {\n const parts: string[] = []\n let i = 0\n while (i < nums.length) {\n let j = i\n while (\n j + 1 < nums.length &&\n Number.isInteger(nums[j]) &&\n nums[j + 1] === (nums[j] as number) + 1\n ) {\n j++\n }\n if (j - i >= 1 && Number.isInteger(nums[i])) {\n parts.push(`${nums[i]}-${nums[j]}`)\n } else {\n parts.push(String(nums[i]))\n j = i\n }\n i = j + 1\n }\n return parts.join(',')\n}\n\nconst renderScalar = (value: MediaArgScalar): string => {\n if (typeof value === 'number') return String(value)\n if (typeof value === 'boolean') return String(value)\n if (typeof value === 'string') return renderString(value)\n if (isRegExpRef(value)) return renderRegExp(value)\n // MediaRef\n if (value.kind === 'id') return `@${value.id}`\n throw new E_MEDIA_NOT_PIPE_EXPRESSIBLE(['nested builder refs have no pipe form; use toOps()'])\n}\n\nconst isScalar = (value: MediaArgValue): value is MediaArgScalar =>\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n isRegExpRef(value) ||\n isMediaRef(value)\n\nconst renderValue = (value: MediaArgValue): string => {\n if (value === null) {\n // null is only legal inside structured JSON values\n throw new E_MEDIA_NOT_PIPE_EXPRESSIBLE(['null is not a flat pipe value; use toOps()'])\n }\n if (Array.isArray(value)) {\n const arr = value as MediaArgScalar[]\n if (arr.length > 0 && arr.every((v) => typeof v === 'number')) {\n return renderNumberList(arr as number[])\n }\n if (arr.every(isScalar)) {\n return arr.map(renderScalar).join(',')\n }\n // structured (nested) array -> quoted JSON\n return `'${JSON.stringify(value)}'`\n }\n if (isScalar(value)) return renderScalar(value)\n // structured object -> quoted JSON\n return `'${JSON.stringify(value)}'`\n}\n\n/**\n * Render a {@link MediaPlan} to its canonical pipe string.\n *\n * @remarks\n * Total for every plan except those containing builder-variant media refs, which throw\n * {@link E_MEDIA_NOT_PIPE_EXPRESSIBLE}. Structured args render as quoted JSON. The output is\n * canonical: dot-namespaced verbs render as space-separated words, number runs compress to\n * ranges, strings quote per the frozen predicate.\n *\n * @param plan - The plan to render.\n * @returns The canonical pipe expression.\n */\nexport const toPipe = (plan: MediaPlan): string =>\n plan.steps\n .map((step) => {\n const verb = step.verb.replace(/\\./g, ' ')\n const args = Object.entries(step.args)\n .map(([k, v]) => `${k}=${renderValue(v)}`)\n .join(' ')\n return args.length > 0 ? `${verb} ${args}` : verb\n })\n .join(' | ')\n\n/**\n * Render a {@link MediaPlan} to its JSON ops array. Total — every plan has an ops form.\n *\n * @param plan - The plan to render.\n * @returns The ops array (spans stripped).\n */\nexport const toOps = (plan: MediaPlan): MediaOp[] =>\n plan.steps.map((step) => ({ verb: step.verb, args: step.args }))\n\n/**\n * Build a {@link MediaPlan} from a JSON ops array. The inverse of {@link toOps}.\n *\n * @remarks\n * Performs structural normalization only (verb-id folding via the caller's verb table happens\n * in validation, not here). Steps carry no spans.\n *\n * @param ops - The ops array.\n * @returns The equivalent plan.\n */\nexport const fromOps = (ops: MediaOp[]): MediaPlan => ({\n steps: ops.map((op) => ({ verb: op.verb, args: op.args })),\n})\n","/**\n * The canonical verb table: every verb the media DSL knows, with arg schemas, engine\n * requirements, format-family applicability, and output kinds.\n *\n * @remarks\n * Internal sibling of the `@nhtio/adk/batteries/media` entry. This table is the single source\n * of truth consumed by:\n *\n * - the pipe parser's semantic validator (unknown-verb/arg detection, did-you-mean),\n * - the plan compiler (arg coercion + constraint checks),\n * - the engine-narrowing pass (which verbs a deployment advertises),\n * - the forge (generating the `media_query` tool description and few-shot examples),\n * - the builder (typed front-end methods map 1:1 onto entries here).\n *\n * Frozen design decisions (design doc section 0): canonical verb ids are dot-namespaced\n * snake_case; verb matching is separator-insensitive (space/`_`/`.` fold); args are named-only;\n * indices are 1-based everywhere; arg names follow one-meaning-one-name (`to`, `with`, `match`,\n * `replace`, `order`, `pages`, `at`).\n */\n\nimport { PCM_MIME } from './contracts'\n\n/** The value type of a single declared arg. */\nexport type VerbArgType =\n | 'string'\n | 'number'\n | 'boolean'\n | 'enum'\n | 'number-list'\n | 'string-list'\n | 'regex-or-string-list'\n | 'name-or-index'\n | 'media-ref'\n | 'media-ref-list'\n | 'json'\n\n/** Declaration of one named arg on a verb. */\nexport interface VerbArgSpec {\n /** The arg's value type. */\n type: VerbArgType\n /** Whether the statement must supply this arg. */\n required?: boolean\n /** Legal values when `type === 'enum'` (or per-element for list types). */\n values?: readonly string[]\n /** Inclusive minimum for numbers / per-element for number lists. */\n min?: number\n /** Inclusive maximum for numbers / per-element for number lists. */\n max?: number\n /** Model-facing description used in generated tool grammar text. */\n description: string\n}\n\n/**\n * A verb's capability requirement against the deployment's engine registry. Verbs with no\n * requirement are always advertised; input-conditional engine needs (e.g. `extract.text`\n * needing OCR only for images) stay runtime checks inside the step implementation.\n */\nexport type VerbRequirement =\n | { capability: 'convert'; from?: string; to?: string }\n | { capability: 'mutate' }\n | { capability: 'edit'; op?: string }\n\n/** Broad input families used for verb-applicability checks. */\nexport type FormatFamily =\n | 'document' // pdf/docx/odt/rtf/txt/md/html...\n | 'spreadsheet' // xlsx/ods/xls/csv\n | 'presentation' // pptx/odp/ppt\n | 'image'\n | 'audio'\n | 'any'\n\n/** What awaiting a chain ending in this verb resolves to. */\nexport type VerbOutput = 'media' | 'media-list' | 'text' | 'json'\n\n/** One verb table entry. */\nexport interface VerbSpec {\n /** Canonical id: dot-namespaced snake_case (`extract.text`, `sheet.update_cells`). */\n id: string\n /** Model-facing one-line description. */\n description: string\n /** Named args (named-only grammar; no positionals). */\n args: Record<string, VerbArgSpec>\n /**\n * Capability the verb always requires, if any — gates whether the verb is advertised and\n * accepted under a given engine configuration. Input-conditional needs are handled (and\n * error-messaged) by the step implementation at runtime.\n */\n requires?: VerbRequirement\n /** Input families the verb applies to. */\n appliesTo: readonly FormatFamily[]\n /** Output kind. May be refined by an `out`-style arg (documented per verb). */\n output: VerbOutput\n}\n\n/** Conversion targets supported by `convert` (the server's enum plus the SheetJS/data matrix). */\nexport const CONVERT_TARGETS = [\n 'pdf',\n 'html',\n 'txt',\n 'md',\n 'csv',\n 'json',\n 'yaml',\n 'docx',\n 'doc',\n 'rtf',\n 'odt',\n 'xlsx',\n 'xls',\n 'ods',\n 'xlsm',\n 'xlsb',\n 'fods',\n 'sylk',\n 'dif',\n 'dbf',\n 'numbers',\n 'pptx',\n 'ppt',\n 'odp',\n] as const\n\n/** Image output formats supported by `image.format`. */\nexport const IMAGE_FORMATS = ['png', 'jpg', 'jpeg', 'webp', 'tiff', 'avif'] as const\n\n/** The canonical verb table. Order is presentation order in generated grammar text. */\nexport const VERBS: readonly VerbSpec[] = [\n // ── root: document transforms ──────────────────────────────────────────────\n {\n id: 'convert',\n description: 'Convert the media to another format.',\n args: {\n to: {\n type: 'enum',\n required: true,\n values: CONVERT_TARGETS,\n description: 'Target format.',\n },\n },\n requires: { capability: 'convert' },\n appliesTo: ['document', 'spreadsheet', 'presentation'],\n output: 'media',\n },\n {\n id: 'select',\n description: 'Keep only the listed pages/slides/sections (1-based), producing one file.',\n args: {\n pages: {\n type: 'number-list',\n required: true,\n min: 1,\n description: 'Pages (or slides/sections) to keep, 1-based. Ranges allowed: 2-5,8.',\n },\n },\n appliesTo: ['document', 'presentation'],\n output: 'media',\n },\n {\n id: 'split',\n description: 'Split the media into multiple files by page or section.',\n args: {\n by: {\n type: 'enum',\n values: ['page', 'section'],\n description: 'Split unit. Default: page.',\n },\n ranges: {\n type: 'json',\n description:\n \"Explicit grouping as a JSON array of [start,end] pairs (1-based), e.g. '[[1,3],[5,7]]'.\",\n },\n },\n appliesTo: ['document', 'presentation'],\n output: 'media-list',\n },\n {\n id: 'merge',\n description: 'Merge other media into this one, in order.',\n args: {\n with: {\n type: 'media-ref-list',\n required: true,\n description: 'Other media to append, as @id refs: with=@<media id>,@<media id>.',\n },\n },\n appliesTo: ['document', 'presentation'],\n output: 'media',\n },\n {\n id: 'reorder',\n description: 'Reorder pages/slides/sections by the given 1-based index order.',\n args: {\n order: {\n type: 'number-list',\n required: true,\n min: 1,\n description: 'New order of existing 1-based indices.',\n },\n },\n appliesTo: ['document', 'presentation'],\n output: 'media',\n },\n {\n id: 'redact',\n description:\n 'Redact matching text. Prefer literal strings; /regex/ is supported. PDF redaction is VISUAL (draw-over + metadata strip; content streams keep the text) — for content-level PDF redaction, extract text first.',\n args: {\n match: {\n type: 'regex-or-string-list',\n required: true,\n description: 'Literal string(s) or a /regex/ to redact.',\n },\n replace: {\n type: 'string',\n description: 'Replacement text. Default: blackout/removal.',\n },\n },\n appliesTo: ['document', 'spreadsheet', 'presentation'],\n output: 'media',\n },\n {\n id: 'sanitize',\n description: 'Remove potentially unsafe embedded content from the media.',\n args: {},\n appliesTo: ['document', 'spreadsheet', 'presentation'],\n output: 'media',\n },\n {\n id: 'normalize',\n description: 'Normalize the media structure/encoding for downstream consistency.',\n args: {},\n appliesTo: ['document', 'spreadsheet', 'presentation'],\n output: 'media',\n },\n {\n id: 'update_text',\n description: 'Replace the first occurrence of an anchor text.',\n args: {\n anchor: {\n type: 'string',\n required: true,\n description: 'Existing text to find.',\n },\n replace: {\n type: 'string',\n required: true,\n description: 'Replacement text (empty string deletes).',\n },\n },\n appliesTo: ['document', 'presentation'],\n output: 'media',\n },\n {\n id: 'diff',\n description:\n 'Compare this media against another; returns a structured diff whose patch text feeds apply_patch directly.',\n args: {\n with: {\n type: 'media-ref',\n required: true,\n description: 'The media to compare against, as an @id ref.',\n },\n },\n appliesTo: ['document', 'spreadsheet', 'presentation'],\n output: 'json',\n },\n {\n id: 'apply_patch',\n description:\n 'Apply a patch to the media text: a unified diff (as produced by the diff verb — that output feeds this verb directly), or a structured \"*** Begin Patch\" envelope (Add/Delete/Update File) for multi-file changes. In the structured envelope, add-file content lines must start with \"+\" (the unified-diff convention).',\n args: {\n patch: {\n type: 'string',\n required: true,\n description:\n 'The patch content: unified diff, or a structured envelope starting with \"*** Begin Patch\". Add-file content lines must start with \"+\".',\n },\n with: {\n type: 'media-ref-list',\n description: 'Optional additional context media, as @id refs.',\n },\n },\n appliesTo: ['document'],\n output: 'media',\n },\n {\n id: 'append',\n description: 'Append text to text-family media (txt/md/csv/yaml).',\n args: {\n text: { type: 'string', required: true, description: 'The text to append.' },\n newline: {\n type: 'boolean',\n description: 'Terminate with a newline (and separate from existing content). Default true.',\n },\n },\n appliesTo: ['document', 'spreadsheet'],\n output: 'media',\n },\n // ── data namespace (JSON/YAML structural ops) ───────────────────────────────\n {\n id: 'data.set',\n description: 'Set a value at a path in JSON/YAML media (creates missing containers).',\n args: {\n path: {\n type: 'string',\n required: true,\n description: 'Dot/bracket path, e.g. a.b[2].c',\n },\n value: {\n type: 'string',\n required: true,\n description: \"JSON-encoded value: '42', '\\\"text\\\"', '{\\\"k\\\":1}'. Bare strings accepted.\",\n },\n },\n appliesTo: ['document'],\n output: 'media',\n },\n {\n id: 'data.merge',\n description: 'Merge a JSON object fragment into JSON/YAML media.',\n args: {\n fragment: {\n type: 'string',\n required: true,\n description: 'The JSON object to merge, e.g. \\'{\"a\":{\"b\":1}}\\'.',\n },\n strategy: {\n type: 'enum',\n values: ['deep', 'shallow'],\n description: 'Merge strategy. Default deep.',\n },\n },\n appliesTo: ['document'],\n output: 'media',\n },\n {\n id: 'data.delete',\n description: 'Delete a key or array element at a path in JSON/YAML media.',\n args: {\n path: {\n type: 'string',\n required: true,\n description: 'Dot/bracket path of the key/element to remove.',\n },\n },\n appliesTo: ['document'],\n output: 'media',\n },\n // ── root: extraction ────────────────────────────────────────────────────────\n {\n id: 'extract.text',\n description:\n 'Extract text from any supported media (document, spreadsheet, image). To limit pages: select pages=… | extract text.',\n args: {\n ocr: {\n type: 'enum',\n values: ['off', 'auto', 'force'],\n description: 'OCR behavior. Default auto (OCR only when there is no text layer).',\n },\n ocr_out: {\n type: 'enum',\n values: ['txt', 'hocr', 'json'],\n description: 'OCR output structure when OCR runs. Default txt.',\n },\n lang: {\n type: 'string-list',\n description: 'OCR language hint(s), e.g. lang=eng,deu. Quote tags with dashes.',\n },\n },\n appliesTo: ['document', 'spreadsheet', 'presentation', 'image'],\n output: 'text',\n },\n {\n id: 'extract.metadata',\n description: 'Extract document metadata (author, dates, page count) as JSON.',\n args: {},\n appliesTo: ['document', 'spreadsheet', 'presentation', 'image', 'audio'],\n output: 'json',\n },\n {\n id: 'extract.assets',\n description: 'Extract embedded assets (images, fonts, attachments) as separate media.',\n args: {\n types: {\n type: 'string-list',\n values: ['image', 'font', 'attachment', 'all'],\n description: 'Asset kinds to extract. Default all.',\n },\n format: {\n type: 'enum',\n values: IMAGE_FORMATS,\n description:\n 'Re-encode extracted images to this format. Default: native encoding as stored.',\n },\n },\n appliesTo: ['document', 'presentation', 'spreadsheet'],\n output: 'media-list',\n },\n {\n id: 'chunk',\n description: 'Split extracted text into chunks for retrieval/indexing.',\n args: {\n by: {\n type: 'enum',\n values: ['sentence', 'paragraph', 'fixed'],\n description: 'Chunking strategy. Default paragraph.',\n },\n size: {\n type: 'number',\n min: 1,\n description: 'Chunk size for fixed strategy / max size otherwise.',\n },\n overlap: {\n type: 'number',\n min: 0,\n description: 'Overlap between consecutive chunks.',\n },\n },\n appliesTo: ['document', 'any'],\n output: 'json',\n },\n // ── sheet namespace ─────────────────────────────────────────────────────────\n {\n id: 'sheet.add_rows',\n description: 'Insert rows into a worksheet.',\n args: {\n sheet: {\n type: 'name-or-index',\n description: 'Target worksheet: bare number = 1-based index, quoted string = name.',\n },\n rows: {\n type: 'json',\n required: true,\n description: 'Rows as a JSON array of arrays of cell values, e.g. \\'[[\"a\",1],[\"b\",2]]\\'.',\n },\n before: { type: 'number', min: 1, description: 'Insert before this 1-based row.' },\n after: { type: 'number', min: 1, description: 'Insert after this 1-based row.' },\n },\n requires: { capability: 'edit' },\n appliesTo: ['spreadsheet'],\n output: 'media',\n },\n {\n id: 'sheet.add_columns',\n description: 'Insert columns into a worksheet.',\n args: {\n sheet: { type: 'name-or-index', description: 'Target worksheet (index or quoted name).' },\n headers: {\n type: 'string-list',\n description: 'Header names for the new columns (values empty).',\n },\n columns: {\n type: 'json',\n description: 'Full column descriptors as JSON: \\'[{\"header\":\"X\",\"values\":[1,2]}]\\'.',\n },\n before: { type: 'number', min: 1, description: 'Insert before this 1-based column.' },\n after: { type: 'number', min: 1, description: 'Insert after this 1-based column.' },\n },\n requires: { capability: 'edit' },\n appliesTo: ['spreadsheet'],\n output: 'media',\n },\n {\n id: 'sheet.update_cells',\n description: 'Update specific cells.',\n args: {\n sheet: { type: 'name-or-index', description: 'Target worksheet (index or quoted name).' },\n updates: {\n type: 'json',\n required: true,\n description:\n 'JSON array of updates: \\'[{\"address\":\"B2\",\"value\":42}]\\' or \\'[{\"row\":2,\"col\":3,\"value\":\"x\"}]\\'.',\n },\n },\n requires: { capability: 'edit' },\n appliesTo: ['spreadsheet'],\n output: 'media',\n },\n {\n id: 'sheet.delete_rows',\n description: 'Delete rows by 1-based index.',\n args: {\n sheet: { type: 'name-or-index', description: 'Target worksheet (index or quoted name).' },\n rows: {\n type: 'number-list',\n required: true,\n min: 1,\n description: '1-based row indices to delete.',\n },\n },\n requires: { capability: 'edit' },\n appliesTo: ['spreadsheet'],\n output: 'media',\n },\n {\n id: 'sheet.delete_columns',\n description: 'Delete columns by 1-based index.',\n args: {\n sheet: { type: 'name-or-index', description: 'Target worksheet (index or quoted name).' },\n columns: {\n type: 'number-list',\n required: true,\n min: 1,\n description: '1-based column indices to delete.',\n },\n },\n requires: { capability: 'edit' },\n appliesTo: ['spreadsheet'],\n output: 'media',\n },\n {\n id: 'sheet.rename_sheet',\n description: 'Rename a worksheet. The target must be a sheet NAME (quote it).',\n args: {\n sheet: {\n type: 'string',\n required: true,\n description: 'Current sheet name (names only for rename; quote it).',\n },\n to: { type: 'string', required: true, description: 'New sheet name.' },\n },\n requires: { capability: 'edit' },\n appliesTo: ['spreadsheet'],\n output: 'media',\n },\n {\n id: 'sheet.add_sheet',\n description: 'Add a new worksheet.',\n args: {\n name: { type: 'string', required: true, description: 'Name for the new worksheet.' },\n at: { type: 'number', min: 1, description: 'Insert at this 1-based position.' },\n },\n requires: { capability: 'edit' },\n appliesTo: ['spreadsheet'],\n output: 'media',\n },\n {\n id: 'sheet.remove_sheet',\n description: 'Remove a worksheet. The target must be a sheet NAME (quote it).',\n args: {\n sheet: {\n type: 'string',\n required: true,\n description: 'Sheet name to remove (names only; quote it).',\n },\n },\n requires: { capability: 'edit' },\n appliesTo: ['spreadsheet'],\n output: 'media',\n },\n {\n id: 'sheet.reorder_sheets',\n description: 'Reorder worksheets.',\n args: {\n order: {\n type: 'json',\n required: true,\n description:\n 'JSON array of sheet names and/or 1-based indices in the new order: \\'[\"Summary\",2,3]\\'.',\n },\n },\n requires: { capability: 'edit' },\n appliesTo: ['spreadsheet'],\n output: 'media',\n },\n {\n id: 'sheet.transform_table',\n description: 'Rename/select/drop table columns by header name.',\n args: {\n sheet: { type: 'name-or-index', description: 'Target worksheet (index or quoted name).' },\n header_row: { type: 'number', min: 1, description: '1-based header row. Default 1.' },\n select: { type: 'string-list', description: 'Column headers to keep.' },\n drop: { type: 'string-list', description: 'Column headers to drop.' },\n rename: {\n type: 'json',\n description: 'JSON array of renames: \\'[{\"from\":\"Old\",\"to\":\"New\"}]\\'.',\n },\n },\n requires: { capability: 'edit' },\n appliesTo: ['spreadsheet'],\n output: 'media',\n },\n // ── slides namespace ────────────────────────────────────────────────────────\n {\n id: 'slides.add',\n description: 'Add a new slide.',\n args: {\n at: { type: 'number', min: 1, description: 'Insert at this 1-based position.' },\n title: { type: 'string', description: 'Title text for the new slide.' },\n layout: { type: 'string', description: 'Layout name (template-dependent).' },\n },\n appliesTo: ['presentation'],\n output: 'media',\n },\n {\n id: 'slides.update_text',\n description: 'Update text on a slide.',\n args: {\n slide: {\n type: 'name-or-index',\n description: 'Target slide: bare number = 1-based index, quoted string = title.',\n },\n placeholder: { type: 'string', description: 'Placeholder/shape to target.' },\n text: { type: 'string', required: true, description: 'Replacement text.' },\n },\n appliesTo: ['presentation'],\n output: 'media',\n },\n {\n id: 'slides.update_table',\n description: 'Update table cells on a slide.',\n args: {\n slide: { type: 'name-or-index', description: 'Target slide (index or quoted title).' },\n updates: {\n type: 'json',\n required: true,\n description: 'JSON array: \\'[{\"row\":1,\"col\":2,\"value\":\"x\"}]\\' (1-based).',\n },\n },\n appliesTo: ['presentation'],\n output: 'media',\n },\n {\n id: 'slides.update_image',\n description: 'Replace an image on a slide with another media.',\n args: {\n slide: { type: 'name-or-index', description: 'Target slide (index or quoted title).' },\n placeholder: { type: 'string', description: 'Placeholder/shape to target.' },\n with: {\n type: 'media-ref',\n required: true,\n description: 'The replacement image, as an @id ref.',\n },\n },\n appliesTo: ['presentation'],\n output: 'media',\n },\n {\n id: 'slides.update_chart',\n description: 'Update chart data on a slide.',\n args: {\n slide: { type: 'name-or-index', description: 'Target slide (index or quoted title).' },\n data: {\n type: 'json',\n description: 'JSON array-of-arrays of chart data: \\'[[\"Q1\",10],[\"Q2\",20]]\\'.',\n },\n },\n appliesTo: ['presentation'],\n output: 'media',\n },\n {\n id: 'slides.delete',\n description: 'Delete slides by 1-based index.',\n args: {\n slides: {\n type: 'number-list',\n required: true,\n min: 1,\n description: '1-based slide indices to delete.',\n },\n },\n appliesTo: ['presentation'],\n output: 'media',\n },\n {\n id: 'slides.reorder',\n description: 'Reorder slides.',\n args: {\n order: {\n type: 'number-list',\n required: true,\n min: 1,\n description: 'New order of existing 1-based slide indices.',\n },\n },\n appliesTo: ['presentation'],\n output: 'media',\n },\n {\n id: 'slides.duplicate',\n description: 'Duplicate a slide.',\n args: {\n slide: { type: 'number', required: true, min: 1, description: '1-based slide to copy.' },\n at: { type: 'number', min: 1, description: 'Insert the copy at this position.' },\n },\n appliesTo: ['presentation'],\n output: 'media',\n },\n // ── image namespace (split verbs; runtime fuses adjacent image.* steps) ─────\n {\n id: 'image.resize',\n description: 'Resize the image.',\n args: {\n width: { type: 'number', min: 1, max: 16384, description: 'Target width in px.' },\n height: { type: 'number', min: 1, max: 16384, description: 'Target height in px.' },\n fit: {\n type: 'enum',\n values: ['cover', 'contain', 'fill', 'inside', 'outside'],\n description: 'Resize fit mode. Default cover.',\n },\n },\n requires: { capability: 'mutate' },\n appliesTo: ['image'],\n output: 'media',\n },\n {\n id: 'image.format',\n description: 'Re-encode the image to another format.',\n args: {\n to: {\n type: 'enum',\n required: true,\n values: IMAGE_FORMATS,\n description: 'Target image format.',\n },\n quality: { type: 'number', min: 1, max: 100, description: 'Quality for lossy formats.' },\n strip_metadata: {\n type: 'boolean',\n description: 'Remove EXIF/ICC metadata from the output.',\n },\n },\n requires: { capability: 'mutate' },\n appliesTo: ['image'],\n output: 'media',\n },\n {\n id: 'image.rotate',\n description: 'Rotate the image.',\n args: {\n deg: {\n type: 'enum',\n required: true,\n values: ['90', '180', '270'],\n description: 'Rotation in degrees (clockwise).',\n },\n },\n requires: { capability: 'mutate' },\n appliesTo: ['image'],\n output: 'media',\n },\n {\n id: 'image.flip',\n description: 'Flip the image.',\n args: {\n axis: {\n type: 'enum',\n required: true,\n values: ['horizontal', 'vertical', 'both'],\n description: 'Flip axis.',\n },\n },\n requires: { capability: 'mutate' },\n appliesTo: ['image'],\n output: 'media',\n },\n {\n id: 'image.strip_metadata',\n description: 'Remove EXIF/ICC metadata from the image without other changes.',\n args: {},\n requires: { capability: 'mutate' },\n appliesTo: ['image'],\n output: 'media',\n },\n // ── audio namespace ─────────────────────────────────────────────────────────\n {\n id: 'audio.transcribe',\n description: 'Transcribe speech to text.',\n args: {\n lang: {\n type: 'string',\n description: 'Language hint, e.g. lang=en. Quote tags with dashes: lang=\"en-US\".',\n },\n out: {\n type: 'enum',\n values: ['txt', 'srt', 'vtt', 'json'],\n description: 'Output format. Default txt. srt/vtt produce subtitles.',\n },\n translate: {\n type: 'boolean',\n description: 'Translate the transcription to English.',\n },\n },\n requires: { capability: 'convert', from: PCM_MIME },\n appliesTo: ['audio'],\n output: 'text',\n },\n] as const\n\n/** Map of canonical verb id → spec, for direct lookup. */\nexport const VERB_INDEX: ReadonlyMap<string, VerbSpec> = new Map(VERBS.map((v) => [v.id, v]))\n\n/**\n * Fold a verb token sequence to canonical form: lowercase, separators (space/`_`/`.`)\n * normalized so `extract_text` ≡ `extract text` ≡ `extract.text` all match `extract.text`.\n *\n * @param words - The verb word tokens as written (1 or 2 words, possibly containing `_`/`.`).\n * @returns The canonical verb id when a fold-match exists, otherwise `undefined`.\n */\nexport const foldVerb = (words: string[]): string | undefined => {\n const flat = words\n .join(' ')\n .toLowerCase()\n .replace(/[._\\s]+/g, ' ')\n .trim()\n return FOLDED_INDEX.get(flat)\n}\n\n/** Internal: folded \"word word\" form → canonical id. */\nconst FOLDED_INDEX: ReadonlyMap<string, string> = (() => {\n const map = new Map<string, string>()\n for (const v of VERBS) {\n const folded = v.id.replace(/[._]+/g, ' ')\n if (map.has(folded)) {\n throw new Error(`verb table invariant violated: \"${folded}\" folds to multiple verbs`)\n }\n map.set(folded, v.id)\n }\n return map\n})()\n\n/**\n * All folded verb word-sequences, for the parser's longest-match verb recognition and for\n * generated grammar text.\n */\nexport const FOLDED_VERBS: readonly string[] = Array.from(FOLDED_INDEX.keys())\n\n/**\n * Suggest the nearest verbs to an unknown input, for did-you-mean errors. Matches whole folded\n * forms AND suffix words (`resize` suggests `image resize`), per the frozen error model.\n *\n * @param input - The unknown verb text as written.\n * @param candidates - The folded verb forms to search (pass the narrowed set to avoid\n * suggesting unconfigured verbs).\n * @returns Up to three suggestions, best first.\n */\nexport const suggestVerbs = (input: string, candidates: readonly string[]): string[] => {\n const folded = input\n .toLowerCase()\n .replace(/[._\\s]+/g, ' ')\n .trim()\n const scored: Array<{ name: string; score: number }> = []\n for (const cand of candidates) {\n const direct = levenshtein(folded, cand)\n const words = cand.split(' ')\n const suffix = words.length > 1 ? levenshtein(folded, words[words.length - 1]) : Infinity\n const score = Math.min(direct, suffix)\n if (score <= Math.max(2, Math.floor(folded.length / 3))) {\n scored.push({ name: cand, score })\n }\n }\n scored.sort((a, b) => a.score - b.score)\n return scored.slice(0, 3).map((s) => s.name)\n}\n\n/** Classic two-row Levenshtein distance. */\nconst levenshtein = (a: string, b: string): number => {\n if (a === b) return 0\n if (a.length === 0) return b.length\n if (b.length === 0) return a.length\n let prev = Array.from({ length: b.length + 1 }, (_, i) => i)\n let curr = new Array<number>(b.length + 1)\n for (let i = 1; i <= a.length; i++) {\n curr[0] = i\n for (let j = 1; j <= b.length; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1\n curr[j] = Math.min(prev[j] + 1, curr[j - 1] + 1, prev[j - 1] + cost)\n }\n ;[prev, curr] = [curr, prev]\n }\n return prev[b.length]\n}\n","/**\n * The semantic validator: checks raw parsed segments (or ops) against the verb table and the\n * deployment's configured engines, producing the validated {@link MediaPlan} or a\n * model-actionable error.\n *\n * @remarks\n * Internal sibling of the `@nhtio/adk/batteries/media` entry. This is the layer no parser\n * toolkit could supply — every error names what was wrong, suggests the nearest valid form,\n * and shows a corrective exemplar (frozen design 0.14). Engine narrowing happens HERE, never\n * at parse time (frozen 0.3): the same string parses identically in every deployment; only\n * validation differs.\n */\n\nimport { isMediaRef, isRegExpRef } from './plan'\nimport { isError, isObject } from '@nhtio/adk/guards'\nimport { VERB_INDEX, suggestVerbs, foldVerb } from './verbs'\nimport {\n E_MEDIA_UNKNOWN_VERB,\n E_MEDIA_UNKNOWN_ARG,\n E_MEDIA_BAD_ARG,\n E_MEDIA_MISSING_ARG,\n E_MEDIA_ENGINE_REQUIRED,\n} from './exceptions'\nimport type { RawSegment, RawArgValue } from './pipe'\nimport type { VerbSpec, VerbArgSpec, VerbRequirement } from './verbs'\nimport type { MediaPlan, MediaStep, MediaArgValue, MediaArgScalar, MediaOp } from './plan'\n\n/**\n * The minimal synchronous capability probe the validator narrows against. The pipeline's\n * engine registry implements it; tests stub it.\n */\nexport interface CapabilityProbe {\n /** `true` when some engine declares a matching convert edge (omit either side for \"any\"). */\n hasConvert(from?: string, to?: string): boolean\n /** `true` when some engine declares a mutate capability. */\n hasMutate(): boolean\n /**\n * `true` when some engine declares a matching edit capability (omit both for \"any\").\n * Optional so existing probe stubs stay valid; absent means \"no edit engines\".\n */\n hasEdit?(mime?: string, op?: string): boolean\n}\n\n/** Options for {@link validateSegments} / {@link validateOps}. */\nexport interface ValidateOptions {\n /** The deployment's capabilities. Narrows advertised verbs + error suggestions. */\n capabilities: CapabilityProbe\n}\n\n/** `true` when the deployment satisfies a verb's capability requirement. */\nconst satisfies = (capabilities: CapabilityProbe, requires: VerbRequirement): boolean => {\n if (requires.capability === 'mutate') return capabilities.hasMutate()\n if (requires.capability === 'edit') return capabilities.hasEdit?.(undefined, requires.op) ?? false\n return capabilities.hasConvert(requires.from, requires.to)\n}\n\n/** A human phrase for an unmet requirement, for the do-not-retry error. */\nconst requirementText = (requires: VerbRequirement): string => {\n if (requires.capability === 'mutate') return 'an engine that can mutate this media'\n if (requires.capability === 'edit') {\n return `an engine that can edit this media${requires.op ? ` (op \"${requires.op}\")` : ''}`\n }\n const from = requires.from ? ` from ${requires.from}` : ''\n const to = requires.to ? ` to ${requires.to}` : ''\n return `an engine that can convert${from}${to}`\n}\n\n/** The folded verb forms available under a given capability configuration. */\nexport const availableVerbs = (capabilities: CapabilityProbe): string[] => {\n const out: string[] = []\n for (const [id, spec] of VERB_INDEX) {\n if (spec.requires && !satisfies(capabilities, spec.requires)) continue\n out.push(id.replace(/[._]+/g, ' '))\n }\n return out\n}\n\nconst levSuggest = (verbText: string, capabilities: CapabilityProbe): string => {\n const suggestions = suggestVerbs(verbText, availableVerbs(capabilities))\n return suggestions.length > 0 ? ` did you mean \"${suggestions[0]}\"?` : ''\n}\n\nconst verbList = (capabilities: CapabilityProbe): string => availableVerbs(capabilities).join(', ')\n\nconst resolveVerb = (\n verbText: string,\n capabilities: CapabilityProbe,\n position: number\n): VerbSpec => {\n const canonical = foldVerb(verbText.split(' ')) ?? verbText\n const spec = VERB_INDEX.get(canonical)\n if (!spec) {\n throw new E_MEDIA_UNKNOWN_VERB([\n `unknown verb \"${verbText}\" at segment ${position}.${levSuggest(verbText, capabilities)} Available verbs: ${verbList(capabilities)}`,\n ])\n }\n if (spec.requires && !satisfies(capabilities, spec.requires)) {\n throw new E_MEDIA_ENGINE_REQUIRED([\n `verb \"${verbText}\" requires ${requirementText(spec.requires)}, and none is configured in this deployment. Do not retry this verb here. Available verbs: ${verbList(capabilities)}`,\n ])\n }\n return spec\n}\n\nconst suggestArg = (name: string, spec: VerbSpec): string => {\n const candidates = Object.keys(spec.args)\n const ranked = suggestVerbs(name, candidates)\n return ranked.length > 0 ? ` did you mean \"${ranked[0]}\"?` : ''\n}\n\nconst argList = (spec: VerbSpec): string => {\n const names = Object.keys(spec.args)\n return names.length > 0 ? names.join(', ') : '(none)'\n}\n\nconst exemplar = (spec: VerbSpec): string => {\n const verb = spec.id.replace(/\\./g, ' ')\n const parts: string[] = [verb]\n for (const [name, arg] of Object.entries(spec.args)) {\n if (!arg.required) continue\n parts.push(`${name}=${exampleValue(arg)}`)\n }\n return parts.join(' ')\n}\n\nconst exampleValue = (arg: VerbArgSpec): string => {\n switch (arg.type) {\n case 'enum':\n return arg.values?.[0] ?? 'value'\n case 'number':\n return String(arg.min ?? 1)\n case 'number-list':\n return '1-3,5'\n case 'string-list':\n return 'a,b'\n case 'boolean':\n return 'true'\n case 'regex-or-string-list':\n return '\"literal text\"'\n case 'media-ref':\n return '@<media id>'\n case 'media-ref-list':\n return '@<media id>'\n case 'json':\n return `'[…]'`\n default:\n return '\"value\"'\n }\n}\n\n/** Coerce + check one arg value against its spec. Returns the IR-final value. */\nconst checkArg = (\n verb: VerbSpec,\n name: string,\n raw: { value: MediaArgValue; quoted: boolean }\n): MediaArgValue => {\n const spec = verb.args[name]\n const verbText = verb.id.replace(/\\./g, ' ')\n const where = `arg \"${name}\" on \"${verbText}\"`\n const bad = (msg: string): never => {\n throw new E_MEDIA_BAD_ARG([`${where}: ${msg}. Write it like: ${exemplar(verb)}`])\n }\n const v = raw.value\n switch (spec.type) {\n case 'name-or-index': {\n if (typeof v === 'number') {\n if (!Number.isInteger(v) || v < 1) bad('indices are 1-based integers')\n return v\n }\n if (typeof v !== 'string') bad('expected a 1-based index or a quoted name')\n return v\n }\n case 'string': {\n if (typeof v === 'number' && !raw.quoted) return String(v)\n if (typeof v !== 'string')\n bad(`expected text${typeof v === 'object' ? ', got a structured value' : ''}`)\n return v\n }\n case 'number': {\n if (typeof v !== 'number') bad('expected a number')\n const n = v as number\n if (spec.min !== undefined && n < spec.min) bad(`must be ≥ ${spec.min} (indices are 1-based)`)\n if (spec.max !== undefined && n > spec.max) bad(`must be ≤ ${spec.max}`)\n return n\n }\n case 'boolean': {\n if (typeof v !== 'boolean') bad('expected true or false')\n return v\n }\n case 'enum': {\n const s = typeof v === 'number' ? String(v) : v\n if (typeof s !== 'string' || !spec.values?.includes(s)) {\n bad(`\"${String(v)}\" is not valid; valid values: ${spec.values?.join(', ')}`)\n }\n return s as string\n }\n case 'number-list': {\n const arr = Array.isArray(v) ? v : [v]\n if (!arr.every((x): x is number => typeof x === 'number'))\n bad('expected numbers (e.g. 1-3,5)')\n const nums = arr as number[]\n if (spec.min !== undefined && nums.some((n) => n < (spec.min as number))) {\n bad(`values must be ≥ ${spec.min} (indices are 1-based)`)\n }\n return nums\n }\n case 'string-list': {\n const arr = Array.isArray(v) ? v : [v]\n if (!arr.every((x): x is string => typeof x === 'string'))\n bad('expected names (quote values with special characters)')\n const strs = arr as string[]\n if (spec.values && !strs.every((s) => spec.values?.includes(s))) {\n bad(`valid values: ${spec.values.join(', ')}`)\n }\n return strs\n }\n case 'regex-or-string-list': {\n if (isRegExpRef(v)) return v\n const arr = Array.isArray(v) ? v : [v]\n if (arr.every((x) => typeof x === 'string' || isRegExpRef(x))) return arr as MediaArgScalar[]\n bad('expected literal text, a list of literals, or a /regex/')\n break\n }\n case 'media-ref': {\n if (isMediaRef(v)) return v\n bad('expected a media reference: with=@<media id> (get ids from list_media)')\n break\n }\n case 'media-ref-list': {\n const arr = Array.isArray(v) ? v : [v]\n if (arr.every(isMediaRef)) return arr as MediaArgScalar[]\n bad('expected media references: with=@<id>,@<id> (get ids from list_media)')\n break\n }\n case 'json': {\n // From pipe: a quoted string containing JSON. From ops: already-structured JSON.\n if (typeof v === 'string') {\n if (!raw.quoted) bad(`expected a quoted JSON value, e.g. ${name}='[…]'`)\n try {\n return JSON.parse(v) as MediaArgValue\n } catch (err) {\n const detail = isError(err) ? err.message : String(err)\n bad(`the quoted value is not valid JSON (${detail})`)\n }\n }\n if (isObject(v) || Array.isArray(v)) return v\n bad(`expected a JSON value, e.g. ${name}='[…]'`)\n break\n }\n }\n /* unreachable */\n throw new E_MEDIA_BAD_ARG([`${where}: invalid value`])\n}\n\nconst checkStep = (\n spec: VerbSpec,\n args: ReadonlyMap<string, { value: MediaArgValue; quoted: boolean }>\n): MediaStep => {\n const verbText = spec.id.replace(/\\./g, ' ')\n const finalArgs: Record<string, MediaArgValue> = {}\n for (const [name, raw] of args) {\n if (!(name in spec.args)) {\n throw new E_MEDIA_UNKNOWN_ARG([\n `verb \"${verbText}\" has no arg \"${name}\".${suggestArg(name, spec)} Args: ${argList(spec)}. Write it like: ${exemplar(spec)}`,\n ])\n }\n finalArgs[name] = checkArg(spec, name, raw)\n }\n for (const [name, argSpec] of Object.entries(spec.args)) {\n if (argSpec.required && !(name in finalArgs)) {\n throw new E_MEDIA_MISSING_ARG([\n `verb \"${verbText}\" requires arg \"${name}\" (${argSpec.description}). Write it like: ${exemplar(spec)}`,\n ])\n }\n }\n return { verb: spec.id, args: finalArgs }\n}\n\n/**\n * Validate raw pipe segments into a {@link MediaPlan}.\n *\n * @param segments - Output of `parsePipeRaw`.\n * @param options - The deployment's capability probe.\n * @returns The validated plan, spans preserved.\n */\nexport const validateSegments = (\n segments: readonly RawSegment[],\n options: ValidateOptions\n): MediaPlan => {\n const steps: MediaStep[] = []\n segments.forEach((seg, i) => {\n const spec = resolveVerb(seg.verb.replace(/\\./g, ' '), options.capabilities, i + 1)\n const step = checkStep(spec, seg.args)\n step.span = seg.span\n steps.push(step)\n })\n return { steps }\n}\n\n/**\n * Validate a JSON ops array into a {@link MediaPlan}. The same checks as the pipe path —\n * verbs fold the same way, args validate against the same specs — so the two front-ends\n * produce identical plans for equivalent statements.\n *\n * @param ops - The ops array.\n * @param options - The deployment's capability probe.\n * @returns The validated plan (no spans).\n */\nexport const validateOps = (ops: readonly MediaOp[], options: ValidateOptions): MediaPlan => {\n const steps: MediaStep[] = []\n ops.forEach((op, i) => {\n const spec = resolveVerb(op.verb.replace(/[._]+/g, ' '), options.capabilities, i + 1)\n const args = new Map<string, RawArgValue>(\n Object.entries(op.args).map(([k, v]) => [\n k,\n {\n value: v,\n quoted: typeof v === 'string',\n span: { offset: 0, line: 1, col: 1, length: 0 },\n },\n ])\n )\n steps.push(checkStep(spec, args))\n })\n return { steps }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8GA,IAAa,eAAe,UAAuC;CACjE,IAAI,CAAC,SAAS,KAAK,GAAG,OAAO;CAC7B,MAAM,IAAI;CACV,OAAO,OAAO,EAAE,WAAW,YAAY,OAAO,EAAE,UAAU,YAAY,OAAO,KAAK,CAAC,EAAE,WAAW;AAClG;;AAGA,IAAa,cAAc,UAAsC;CAC/D,IAAI,CAAC,SAAS,KAAK,GAAG,OAAO;CAC7B,MAAM,IAAI;CACV,IAAI,EAAE,SAAS,MAAM,OAAO,OAAQ,EAAuB,OAAO;CAClE,IAAI,EAAE,SAAS,WAAW,OAAO,SAAU,EAAyB,IAAI;CACxE,OAAO;AACT;;AAKA,IAAM,WAAW;;AAEjB,IAAM,iBAAiB;;;;;AAMvB,IAAM,gBAAgB,MAAsB;CAC1C,IAAI,EAAE,WAAW,KAAK,CAAC,SAAS,KAAK,CAAC,KAAK,eAAe,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,GACnF,OAAO,IAAI,EAAE,QAAQ,OAAO,MAAM,EAAE,QAAQ,MAAM,MAAK,EAAE,QAAQ,OAAO,KAAK,EAAE;CAEjF,OAAO;AACT;;AAGA,IAAa,kBAAkB,UAA0B,MAAM,KAAK,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;;AAGzF,IAAM,gBAAgB,QAA2B;CAC/C,MAAM,SAAS,IAAI,OAAO,WAAW,IAAI,SAAS,IAAI;CAEtD,IAAI,MAAM;CACV,IAAI,UAAU;CACd,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;EACtC,MAAM,KAAK,OAAO;EAClB,IAAI,OAAO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,kBAAkB,KAAK,KAAK,QAAQ,YAAY,oBAAoB,SAAS,IAAI,GACrG,CAAC;CAGL,OAAO;EAAE,MAAM,KAAK;EAAI,MAAM;CAAU;AAC1C;;;;;;;;AASA,IAAa,oBACX,UACA,YACc;CACd,MAAM,QAAqB,CAAC;CAC5B,SAAS,SAAS,KAAK,MAAM;EAE3B,MAAM,OAAO,UADA,YAAY,IAAI,KAAK,QAAQ,OAAO,GAAG,GAAG,QAAQ,cAAc,IAAI,CAC1D,GAAM,IAAI,IAAI;EACrC,KAAK,OAAO,IAAI;EAChB,MAAM,KAAK,IAAI;CACjB,CAAC;CACD,OAAO,EAAE,MAAM;AACjB;;;;;;;;;;AAWA,IAAa,eAAe,KAAyB,YAAwC;CAC3F,MAAM,QAAqB,CAAC;CAC5B,IAAI,SAAS,IAAI,MAAM;EACrB,MAAM,OAAO,YAAY,GAAG,KAAK,QAAQ,UAAU,GAAG,GAAG,QAAQ,cAAc,IAAI,CAAC;EACpF,MAAM,OAAO,IAAI,IACf,OAAO,QAAQ,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,OAAO,CACtC,GACA;GACE,OAAO;GACP,QAAQ,OAAO,MAAM;GACrB,MAAM;IAAE,QAAQ;IAAG,MAAM;IAAG,KAAK;IAAG,QAAQ;GAAE;EAChD,CACF,CAAC,CACH;EACA,MAAM,KAAK,UAAU,MAAM,IAAI,CAAC;CAClC,CAAC;CACD,OAAO,EAAE,MAAM;AACjB"}
@@ -1,4 +1,4 @@
1
- const require_tool_registry = require("./tool_registry-BdKlPuHS.js");
1
+ const require_tool_registry = require("./tool_registry-DwZ6pzN4.js");
2
2
  require("./guards.cjs");
3
3
  const require_batteries_media_contracts = require("./batteries/media/contracts.cjs");
4
4
  const require_exceptions = require("./exceptions-D79HIKeX.js");
@@ -170,7 +170,7 @@ var fromOps = (ops) => ({ steps: ops.map((op) => ({
170
170
  * indices are 1-based everywhere; arg names follow one-meaning-one-name (`to`, `with`, `match`,
171
171
  * `replace`, `order`, `pages`, `at`).
172
172
  */
173
- /** Conversion targets supported by `convert` (matches the server's enum exactly). */
173
+ /** Conversion targets supported by `convert` (the server's enum plus the SheetJS/data matrix). */
174
174
  var CONVERT_TARGETS = [
175
175
  "pdf",
176
176
  "html",
@@ -178,6 +178,7 @@ var CONVERT_TARGETS = [
178
178
  "md",
179
179
  "csv",
180
180
  "json",
181
+ "yaml",
181
182
  "docx",
182
183
  "doc",
183
184
  "rtf",
@@ -185,6 +186,13 @@ var CONVERT_TARGETS = [
185
186
  "xlsx",
186
187
  "xls",
187
188
  "ods",
189
+ "xlsm",
190
+ "xlsb",
191
+ "fods",
192
+ "sylk",
193
+ "dif",
194
+ "dbf",
195
+ "numbers",
188
196
  "pptx",
189
197
  "ppt",
190
198
  "odp"
@@ -271,7 +279,7 @@ var VERBS = [
271
279
  },
272
280
  {
273
281
  id: "redact",
274
- description: "Redact matching text. Prefer literal strings; /regex/ is supported.",
282
+ description: "Redact matching text. Prefer literal strings; /regex/ is supported. PDF redaction is VISUAL (draw-over + metadata strip; content streams keep the text) — for content-level PDF redaction, extract text first.",
275
283
  args: {
276
284
  match: {
277
285
  type: "regex-or-string-list",
@@ -332,7 +340,7 @@ var VERBS = [
332
340
  },
333
341
  {
334
342
  id: "diff",
335
- description: "Compare this media against another; returns a structured diff.",
343
+ description: "Compare this media against another; returns a structured diff whose patch text feeds apply_patch directly.",
336
344
  args: { with: {
337
345
  type: "media-ref",
338
346
  required: true,
@@ -347,12 +355,12 @@ var VERBS = [
347
355
  },
348
356
  {
349
357
  id: "apply_patch",
350
- description: "Apply a unified-diff patch to the media text.",
358
+ description: "Apply a patch to the media text: a unified diff (as produced by the diff verb — that output feeds this verb directly), or a structured \"*** Begin Patch\" envelope (Add/Delete/Update File) for multi-file changes. In the structured envelope, add-file content lines must start with \"+\" (the unified-diff convention).",
351
359
  args: {
352
360
  patch: {
353
361
  type: "string",
354
362
  required: true,
355
- description: "The unified diff content."
363
+ description: "The patch content: unified diff, or a structured envelope starting with \"*** Begin Patch\". Add-file content lines must start with \"+\"."
356
364
  },
357
365
  with: {
358
366
  type: "media-ref-list",
@@ -362,6 +370,70 @@ var VERBS = [
362
370
  appliesTo: ["document"],
363
371
  output: "media"
364
372
  },
373
+ {
374
+ id: "append",
375
+ description: "Append text to text-family media (txt/md/csv/yaml).",
376
+ args: {
377
+ text: {
378
+ type: "string",
379
+ required: true,
380
+ description: "The text to append."
381
+ },
382
+ newline: {
383
+ type: "boolean",
384
+ description: "Terminate with a newline (and separate from existing content). Default true."
385
+ }
386
+ },
387
+ appliesTo: ["document", "spreadsheet"],
388
+ output: "media"
389
+ },
390
+ {
391
+ id: "data.set",
392
+ description: "Set a value at a path in JSON/YAML media (creates missing containers).",
393
+ args: {
394
+ path: {
395
+ type: "string",
396
+ required: true,
397
+ description: "Dot/bracket path, e.g. a.b[2].c"
398
+ },
399
+ value: {
400
+ type: "string",
401
+ required: true,
402
+ description: "JSON-encoded value: '42', '\"text\"', '{\"k\":1}'. Bare strings accepted."
403
+ }
404
+ },
405
+ appliesTo: ["document"],
406
+ output: "media"
407
+ },
408
+ {
409
+ id: "data.merge",
410
+ description: "Merge a JSON object fragment into JSON/YAML media.",
411
+ args: {
412
+ fragment: {
413
+ type: "string",
414
+ required: true,
415
+ description: "The JSON object to merge, e.g. '{\"a\":{\"b\":1}}'."
416
+ },
417
+ strategy: {
418
+ type: "enum",
419
+ values: ["deep", "shallow"],
420
+ description: "Merge strategy. Default deep."
421
+ }
422
+ },
423
+ appliesTo: ["document"],
424
+ output: "media"
425
+ },
426
+ {
427
+ id: "data.delete",
428
+ description: "Delete a key or array element at a path in JSON/YAML media.",
429
+ args: { path: {
430
+ type: "string",
431
+ required: true,
432
+ description: "Dot/bracket path of the key/element to remove."
433
+ } },
434
+ appliesTo: ["document"],
435
+ output: "media"
436
+ },
365
437
  {
366
438
  id: "extract.text",
367
439
  description: "Extract text from any supported media (document, spreadsheet, image). To limit pages: select pages=… | extract text.",
@@ -488,6 +560,7 @@ var VERBS = [
488
560
  description: "Insert after this 1-based row."
489
561
  }
490
562
  },
563
+ requires: { capability: "edit" },
491
564
  appliesTo: ["spreadsheet"],
492
565
  output: "media"
493
566
  },
@@ -518,6 +591,7 @@ var VERBS = [
518
591
  description: "Insert after this 1-based column."
519
592
  }
520
593
  },
594
+ requires: { capability: "edit" },
521
595
  appliesTo: ["spreadsheet"],
522
596
  output: "media"
523
597
  },
@@ -535,6 +609,7 @@ var VERBS = [
535
609
  description: "JSON array of updates: '[{\"address\":\"B2\",\"value\":42}]' or '[{\"row\":2,\"col\":3,\"value\":\"x\"}]'."
536
610
  }
537
611
  },
612
+ requires: { capability: "edit" },
538
613
  appliesTo: ["spreadsheet"],
539
614
  output: "media"
540
615
  },
@@ -553,6 +628,7 @@ var VERBS = [
553
628
  description: "1-based row indices to delete."
554
629
  }
555
630
  },
631
+ requires: { capability: "edit" },
556
632
  appliesTo: ["spreadsheet"],
557
633
  output: "media"
558
634
  },
@@ -571,6 +647,7 @@ var VERBS = [
571
647
  description: "1-based column indices to delete."
572
648
  }
573
649
  },
650
+ requires: { capability: "edit" },
574
651
  appliesTo: ["spreadsheet"],
575
652
  output: "media"
576
653
  },
@@ -589,6 +666,7 @@ var VERBS = [
589
666
  description: "New sheet name."
590
667
  }
591
668
  },
669
+ requires: { capability: "edit" },
592
670
  appliesTo: ["spreadsheet"],
593
671
  output: "media"
594
672
  },
@@ -607,6 +685,7 @@ var VERBS = [
607
685
  description: "Insert at this 1-based position."
608
686
  }
609
687
  },
688
+ requires: { capability: "edit" },
610
689
  appliesTo: ["spreadsheet"],
611
690
  output: "media"
612
691
  },
@@ -618,6 +697,7 @@ var VERBS = [
618
697
  required: true,
619
698
  description: "Sheet name to remove (names only; quote it)."
620
699
  } },
700
+ requires: { capability: "edit" },
621
701
  appliesTo: ["spreadsheet"],
622
702
  output: "media"
623
703
  },
@@ -629,6 +709,7 @@ var VERBS = [
629
709
  required: true,
630
710
  description: "JSON array of sheet names and/or 1-based indices in the new order: '[\"Summary\",2,3]'."
631
711
  } },
712
+ requires: { capability: "edit" },
632
713
  appliesTo: ["spreadsheet"],
633
714
  output: "media"
634
715
  },
@@ -658,6 +739,7 @@ var VERBS = [
658
739
  description: "JSON array of renames: '[{\"from\":\"Old\",\"to\":\"New\"}]'."
659
740
  }
660
741
  },
742
+ requires: { capability: "edit" },
661
743
  appliesTo: ["spreadsheet"],
662
744
  output: "media"
663
745
  },
@@ -1015,10 +1097,15 @@ var levenshtein = (a, b) => {
1015
1097
  * validation differs.
1016
1098
  */
1017
1099
  /** `true` when the deployment satisfies a verb's capability requirement. */
1018
- var satisfies = (capabilities, requires) => requires.capability === "mutate" ? capabilities.hasMutate() : capabilities.hasConvert(requires.from, requires.to);
1100
+ var satisfies = (capabilities, requires) => {
1101
+ if (requires.capability === "mutate") return capabilities.hasMutate();
1102
+ if (requires.capability === "edit") return capabilities.hasEdit?.(void 0, requires.op) ?? false;
1103
+ return capabilities.hasConvert(requires.from, requires.to);
1104
+ };
1019
1105
  /** A human phrase for an unmet requirement, for the do-not-retry error. */
1020
1106
  var requirementText = (requires) => {
1021
1107
  if (requires.capability === "mutate") return "an engine that can mutate this media";
1108
+ if (requires.capability === "edit") return `an engine that can edit this media${requires.op ? ` (op "${requires.op}")` : ""}`;
1022
1109
  return `an engine that can convert${requires.from ? ` from ${requires.from}` : ""}${requires.to ? ` to ${requires.to}` : ""}`;
1023
1110
  };
1024
1111
  /** The folded verb forms available under a given capability configuration. */
@@ -1295,4 +1382,4 @@ Object.defineProperty(exports, "validateSegments", {
1295
1382
  }
1296
1383
  });
1297
1384
 
1298
- //# sourceMappingURL=validate-DgDZkUKs.js.map
1385
+ //# sourceMappingURL=validate-gaSa9bsk.js.map