@yadsh/dsh-qa-surface 0.5.0 → 0.6.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 (380) hide show
  1. package/README.md +206 -11
  2. package/compatibility.json +10 -1
  3. package/cordis.patch.yml +11 -1
  4. package/lib/account-remotes.js +10 -0
  5. package/lib/account-remotes.js.map +1 -1
  6. package/lib/accounts/errors.js.map +1 -1
  7. package/lib/accounts/file.js.map +1 -1
  8. package/lib/accounts/store.js +22 -0
  9. package/lib/accounts/store.js.map +1 -1
  10. package/lib/attestation.js +6 -0
  11. package/lib/attestation.js.map +1 -1
  12. package/lib/client/QaAccountsController.js +29 -0
  13. package/lib/client/QaAccountsController.js.map +1 -1
  14. package/lib/client/QaSessionController.js +205 -61
  15. package/lib/client/QaSessionController.js.map +1 -1
  16. package/lib/client/QaSurface.js +125 -56
  17. package/lib/client/QaSurface.js.map +1 -1
  18. package/lib/client/QaSurfaceGuard.js +96 -0
  19. package/lib/client/QaSurfaceGuard.js.map +1 -0
  20. package/lib/client/QaTranscriptAdapter.js +11 -5
  21. package/lib/client/QaTranscriptAdapter.js.map +1 -1
  22. package/lib/client/attestation.js +14 -2
  23. package/lib/client/attestation.js.map +1 -1
  24. package/lib/client/components/QaChangelog.js +44 -0
  25. package/lib/client/components/QaChangelog.js.map +1 -1
  26. package/lib/client/components/QaComposer.js +1 -1
  27. package/lib/client/components/QaComposer.js.map +1 -1
  28. package/lib/client/components/QaHeader.js +2 -8
  29. package/lib/client/components/QaHeader.js.map +1 -1
  30. package/lib/client/components/QaMessage.js +20 -7
  31. package/lib/client/components/QaMessage.js.map +1 -1
  32. package/lib/client/components/QaModal.js +24 -6
  33. package/lib/client/components/QaModal.js.map +1 -1
  34. package/lib/client/components/QaSidebar.js +2 -6
  35. package/lib/client/components/QaSidebar.js.map +1 -1
  36. package/lib/client/components/QaSourcesPanel.js +6 -5
  37. package/lib/client/components/QaSourcesPanel.js.map +1 -1
  38. package/lib/client/components/QaWidthHandle.js +21 -1
  39. package/lib/client/components/QaWidthHandle.js.map +1 -1
  40. package/lib/client/components/surface-utils.js +2 -0
  41. package/lib/client/components/surface-utils.js.map +1 -1
  42. package/lib/client/index.js +72 -24
  43. package/lib/client/index.js.map +1 -1
  44. package/lib/client/panels/PanelHost.js +209 -0
  45. package/lib/client/panels/PanelHost.js.map +1 -0
  46. package/lib/client/panels/PanelLauncher.js +39 -0
  47. package/lib/client/panels/PanelLauncher.js.map +1 -0
  48. package/lib/client/panels/contract.js +2 -0
  49. package/lib/client/panels/contract.js.map +1 -0
  50. package/lib/client/panels/index.js +2 -0
  51. package/lib/client/panels/index.js.map +1 -0
  52. package/lib/client/panels/registry.js +171 -0
  53. package/lib/client/panels/registry.js.map +1 -0
  54. package/lib/client/project-session-state.js +13 -5
  55. package/lib/client/project-session-state.js.map +1 -1
  56. package/lib/client/settings/card.js +2 -2
  57. package/lib/client/settings/card.js.map +1 -1
  58. package/lib/client/settings/sections/accounts.js +3 -1
  59. package/lib/client/settings/sections/accounts.js.map +1 -1
  60. package/lib/client/settings/sections/documents.js +88 -0
  61. package/lib/client/settings/sections/documents.js.map +1 -0
  62. package/lib/client/settings/sections/interface.js +2 -0
  63. package/lib/client/settings/sections/interface.js.map +1 -1
  64. package/lib/client/settings/sections.js +1 -0
  65. package/lib/client/settings/sections.js.map +1 -1
  66. package/lib/client/settings-extensions/contract.js +2 -0
  67. package/lib/client/settings-extensions/contract.js.map +1 -0
  68. package/lib/client/settings-extensions/index.js +2 -0
  69. package/lib/client/settings-extensions/index.js.map +1 -0
  70. package/lib/client/settings-extensions/registry.js +63 -0
  71. package/lib/client/settings-extensions/registry.js.map +1 -0
  72. package/lib/client/settlement.js +51 -5
  73. package/lib/client/settlement.js.map +1 -1
  74. package/lib/client/source-preview.js +24 -0
  75. package/lib/client/source-preview.js.map +1 -0
  76. package/lib/client/styles.js +158 -32
  77. package/lib/client/styles.js.map +1 -1
  78. package/lib/client/subagent-codenames.js +109 -0
  79. package/lib/client/subagent-codenames.js.map +1 -0
  80. package/lib/client/types.js +2 -0
  81. package/lib/client/types.js.map +1 -1
  82. package/lib/client/user-settings/GeneralSettingsPage.js +13 -0
  83. package/lib/client/user-settings/GeneralSettingsPage.js.map +1 -0
  84. package/lib/client/user-settings/ProfileSettingsPage.js +59 -0
  85. package/lib/client/user-settings/ProfileSettingsPage.js.map +1 -0
  86. package/lib/client/user-settings/SkillCatalog.js +23 -0
  87. package/lib/client/user-settings/SkillCatalog.js.map +1 -0
  88. package/lib/client/user-settings/SkillEditor.js +89 -0
  89. package/lib/client/user-settings/SkillEditor.js.map +1 -0
  90. package/lib/client/user-settings/SkillToolPicker.js +58 -0
  91. package/lib/client/user-settings/SkillToolPicker.js.map +1 -0
  92. package/lib/client/user-settings/SkillsSettingsPage.js +171 -0
  93. package/lib/client/user-settings/SkillsSettingsPage.js.map +1 -0
  94. package/lib/client/user-settings/StartersSettingsPage.js +78 -0
  95. package/lib/client/user-settings/StartersSettingsPage.js.map +1 -0
  96. package/lib/client/user-settings/UserSettingsDialog.js +50 -0
  97. package/lib/client/user-settings/UserSettingsDialog.js.map +1 -0
  98. package/lib/client/user-settings/copy.js +84 -0
  99. package/lib/client/user-settings/copy.js.map +1 -0
  100. package/lib/client/user-settings/draft.js +127 -0
  101. package/lib/client/user-settings/draft.js.map +1 -0
  102. package/lib/client/user-settings/fields.js +24 -0
  103. package/lib/client/user-settings/fields.js.map +1 -0
  104. package/lib/client.js +5554 -1415
  105. package/lib/client.js.map +1 -1
  106. package/lib/config-resolvers/accounts.js +30 -0
  107. package/lib/config-resolvers/accounts.js.map +1 -1
  108. package/lib/config-resolvers/defaults.js +23 -0
  109. package/lib/config-resolvers/defaults.js.map +1 -1
  110. package/lib/config-resolvers/tools.js +37 -0
  111. package/lib/config-resolvers/tools.js.map +1 -0
  112. package/lib/config-resolvers/ui.js +2 -0
  113. package/lib/config-resolvers/ui.js.map +1 -1
  114. package/lib/config.js +288 -0
  115. package/lib/config.js.map +1 -1
  116. package/lib/documents/artifacts/ids.js +43 -0
  117. package/lib/documents/artifacts/ids.js.map +1 -0
  118. package/lib/documents/artifacts/manifest.js +66 -0
  119. package/lib/documents/artifacts/manifest.js.map +1 -0
  120. package/lib/documents/artifacts/store.js +169 -0
  121. package/lib/documents/artifacts/store.js.map +1 -0
  122. package/lib/documents/capabilities.js +93 -0
  123. package/lib/documents/capabilities.js.map +1 -0
  124. package/lib/documents/config.js +302 -0
  125. package/lib/documents/config.js.map +1 -0
  126. package/lib/documents/defaults.js +78 -0
  127. package/lib/documents/defaults.js.map +1 -0
  128. package/lib/documents/errors.js +101 -0
  129. package/lib/documents/errors.js.map +1 -0
  130. package/lib/documents/index.js +80 -0
  131. package/lib/documents/index.js.map +1 -0
  132. package/lib/documents/inspect/facts.js +161 -0
  133. package/lib/documents/inspect/facts.js.map +1 -0
  134. package/lib/documents/inspect/zip.js +108 -0
  135. package/lib/documents/inspect/zip.js.map +1 -0
  136. package/lib/documents/markdown/directives.js +135 -0
  137. package/lib/documents/markdown/directives.js.map +1 -0
  138. package/lib/documents/markdown/frontmatter.js +35 -0
  139. package/lib/documents/markdown/frontmatter.js.map +1 -0
  140. package/lib/documents/markdown/normalize.js +113 -0
  141. package/lib/documents/markdown/normalize.js.map +1 -0
  142. package/lib/documents/orchestrator/assets.js +243 -0
  143. package/lib/documents/orchestrator/assets.js.map +1 -0
  144. package/lib/documents/orchestrator/convert-document.js +186 -0
  145. package/lib/documents/orchestrator/convert-document.js.map +1 -0
  146. package/lib/documents/orchestrator/create-document.js +292 -0
  147. package/lib/documents/orchestrator/create-document.js.map +1 -0
  148. package/lib/documents/orchestrator/extract-document.js +162 -0
  149. package/lib/documents/orchestrator/extract-document.js.map +1 -0
  150. package/lib/documents/orchestrator/inspect-document.js +89 -0
  151. package/lib/documents/orchestrator/inspect-document.js.map +1 -0
  152. package/lib/documents/orchestrator/runtime-deps.js +59 -0
  153. package/lib/documents/orchestrator/runtime-deps.js.map +1 -0
  154. package/lib/documents/orchestrator/scope.js +132 -0
  155. package/lib/documents/orchestrator/scope.js.map +1 -0
  156. package/lib/documents/providers/docling.js +247 -0
  157. package/lib/documents/providers/docling.js.map +1 -0
  158. package/lib/documents/providers/libreoffice.js +130 -0
  159. package/lib/documents/providers/libreoffice.js.map +1 -0
  160. package/lib/documents/providers/markitdown.js +89 -0
  161. package/lib/documents/providers/markitdown.js.map +1 -0
  162. package/lib/documents/providers/pandoc.js +161 -0
  163. package/lib/documents/providers/pandoc.js.map +1 -0
  164. package/lib/documents/providers/process.js +164 -0
  165. package/lib/documents/providers/process.js.map +1 -0
  166. package/lib/documents/providers/registry.js +152 -0
  167. package/lib/documents/providers/registry.js.map +1 -0
  168. package/lib/documents/providers/shared.js +75 -0
  169. package/lib/documents/providers/shared.js.map +1 -0
  170. package/lib/documents/runtime.js +114 -0
  171. package/lib/documents/runtime.js.map +1 -0
  172. package/lib/documents/security/file-types.js +188 -0
  173. package/lib/documents/security/file-types.js.map +1 -0
  174. package/lib/documents/security/limits.js +78 -0
  175. package/lib/documents/security/limits.js.map +1 -0
  176. package/lib/documents/security/mime.js +43 -0
  177. package/lib/documents/security/mime.js.map +1 -0
  178. package/lib/documents/security/paths.js +133 -0
  179. package/lib/documents/security/paths.js.map +1 -0
  180. package/lib/documents/templates/registry.js +147 -0
  181. package/lib/documents/templates/registry.js.map +1 -0
  182. package/lib/documents/templates/resolver.js +59 -0
  183. package/lib/documents/templates/resolver.js.map +1 -0
  184. package/lib/documents/tools/convert.js +125 -0
  185. package/lib/documents/tools/convert.js.map +1 -0
  186. package/lib/documents/tools/create.js +187 -0
  187. package/lib/documents/tools/create.js.map +1 -0
  188. package/lib/documents/tools/index.js +41 -0
  189. package/lib/documents/tools/index.js.map +1 -0
  190. package/lib/documents/tools/inspect.js +135 -0
  191. package/lib/documents/tools/inspect.js.map +1 -0
  192. package/lib/documents/tools/shared.js +88 -0
  193. package/lib/documents/tools/shared.js.map +1 -0
  194. package/lib/documents/tools/to-markdown.js +125 -0
  195. package/lib/documents/tools/to-markdown.js.map +1 -0
  196. package/lib/documents/types.js +12 -0
  197. package/lib/documents/types.js.map +1 -0
  198. package/lib/index.js +231 -22
  199. package/lib/index.js.map +1 -1
  200. package/lib/integration-principals.js +22 -0
  201. package/lib/integration-principals.js.map +1 -0
  202. package/lib/lockdown-policy.js +15 -3
  203. package/lib/lockdown-policy.js.map +1 -1
  204. package/lib/personal-skills/errors.js +9 -0
  205. package/lib/personal-skills/errors.js.map +1 -0
  206. package/lib/personal-skills/host.js +80 -0
  207. package/lib/personal-skills/host.js.map +1 -0
  208. package/lib/personal-skills/index.js +10 -0
  209. package/lib/personal-skills/index.js.map +1 -0
  210. package/lib/personal-skills/paths.js +127 -0
  211. package/lib/personal-skills/paths.js.map +1 -0
  212. package/lib/personal-skills/provider.js +109 -0
  213. package/lib/personal-skills/provider.js.map +1 -0
  214. package/lib/personal-skills/remotes.js +40 -0
  215. package/lib/personal-skills/remotes.js.map +1 -0
  216. package/lib/personal-skills/service.js +686 -0
  217. package/lib/personal-skills/service.js.map +1 -0
  218. package/lib/personal-skills/skill-file.js +278 -0
  219. package/lib/personal-skills/skill-file.js.map +1 -0
  220. package/lib/personal-skills/skill-format.js +202 -0
  221. package/lib/personal-skills/skill-format.js.map +1 -0
  222. package/lib/personal-skills/watcher.js +96 -0
  223. package/lib/personal-skills/watcher.js.map +1 -0
  224. package/lib/profile.js +6 -4
  225. package/lib/profile.js.map +1 -1
  226. package/lib/prompt-notes.js +19 -0
  227. package/lib/prompt-notes.js.map +1 -1
  228. package/lib/provenance/file-preview.js +68 -21
  229. package/lib/provenance/file-preview.js.map +1 -1
  230. package/lib/provenance/host-store.js +44 -11
  231. package/lib/provenance/host-store.js.map +1 -1
  232. package/lib/provenance/index.js +1 -0
  233. package/lib/provenance/index.js.map +1 -1
  234. package/lib/provenance/normalize.js +3 -1
  235. package/lib/provenance/normalize.js.map +1 -1
  236. package/lib/provenance/snapshot-store.js +154 -0
  237. package/lib/provenance/snapshot-store.js.map +1 -0
  238. package/lib/qa-tools/activation-detector.js +53 -0
  239. package/lib/qa-tools/activation-detector.js.map +1 -0
  240. package/lib/qa-tools/activation-manager.js +111 -0
  241. package/lib/qa-tools/activation-manager.js.map +1 -0
  242. package/lib/qa-tools/catalog.js +108 -0
  243. package/lib/qa-tools/catalog.js.map +1 -0
  244. package/lib/qa-tools/durable-marker.js +115 -0
  245. package/lib/qa-tools/durable-marker.js.map +1 -0
  246. package/lib/qa-tools/index.js +83 -0
  247. package/lib/qa-tools/index.js.map +1 -0
  248. package/lib/qa-tools/lifecycle.js +64 -0
  249. package/lib/qa-tools/lifecycle.js.map +1 -0
  250. package/lib/qa-tools/types.js +2 -0
  251. package/lib/qa-tools/types.js.map +1 -0
  252. package/lib/resolve-config.js +5 -0
  253. package/lib/resolve-config.js.map +1 -1
  254. package/lib/secure-session.js +75 -18
  255. package/lib/secure-session.js.map +1 -1
  256. package/lib/starters.js +117 -0
  257. package/lib/starters.js.map +1 -0
  258. package/lib/typert.host.js +767 -22
  259. package/lib/typert.remote-client.d.ts +17 -1
  260. package/lib/typert.remote-client.js +609 -17
  261. package/lib/types/account-remotes.d.ts +3 -1
  262. package/lib/types/accounts/errors.d.ts +1 -1
  263. package/lib/types/accounts/file.d.ts +10 -0
  264. package/lib/types/accounts/store.d.ts +7 -1
  265. package/lib/types/attestation.d.ts +2 -0
  266. package/lib/types/client/QaAccountsController.d.ts +7 -1
  267. package/lib/types/client/QaSessionController.d.ts +14 -0
  268. package/lib/types/client/QaSurface.d.ts +14 -4
  269. package/lib/types/client/QaSurfaceGuard.d.ts +27 -0
  270. package/lib/types/client/QaTranscriptAdapter.d.ts +7 -0
  271. package/lib/types/client/attestation.d.ts +8 -1
  272. package/lib/types/client/components/QaComposer.d.ts +3 -1
  273. package/lib/types/client/components/QaHeader.d.ts +3 -1
  274. package/lib/types/client/components/QaModal.d.ts +5 -4
  275. package/lib/types/client/components/QaSidebar.d.ts +8 -11
  276. package/lib/types/client/components/QaWidthHandle.d.ts +13 -0
  277. package/lib/types/client/index.d.ts +1 -0
  278. package/lib/types/client/panels/PanelHost.d.ts +18 -0
  279. package/lib/types/client/panels/PanelLauncher.d.ts +5 -0
  280. package/lib/types/client/panels/contract.d.ts +83 -0
  281. package/lib/types/client/panels/index.d.ts +3 -0
  282. package/lib/types/client/panels/registry.d.ts +40 -0
  283. package/lib/types/client/project-session-state.d.ts +7 -0
  284. package/lib/types/client/settings/sections/documents.d.ts +13 -0
  285. package/lib/types/client/settings/sections.d.ts +1 -0
  286. package/lib/types/client/settings-extensions/contract.d.ts +32 -0
  287. package/lib/types/client/settings-extensions/index.d.ts +3 -0
  288. package/lib/types/client/settings-extensions/registry.d.ts +15 -0
  289. package/lib/types/client/settlement.d.ts +41 -5
  290. package/lib/types/client/source-preview.d.ts +8 -0
  291. package/lib/types/client/styles.d.ts +2 -0
  292. package/lib/types/client/subagent-codenames.d.ts +18 -0
  293. package/lib/types/client/types.d.ts +35 -3
  294. package/lib/types/client/user-settings/GeneralSettingsPage.d.ts +14 -0
  295. package/lib/types/client/user-settings/ProfileSettingsPage.d.ts +18 -0
  296. package/lib/types/client/user-settings/SkillCatalog.d.ts +16 -0
  297. package/lib/types/client/user-settings/SkillEditor.d.ts +42 -0
  298. package/lib/types/client/user-settings/SkillToolPicker.d.ts +17 -0
  299. package/lib/types/client/user-settings/SkillsSettingsPage.d.ts +15 -0
  300. package/lib/types/client/user-settings/StartersSettingsPage.d.ts +14 -0
  301. package/lib/types/client/user-settings/UserSettingsDialog.d.ts +43 -0
  302. package/lib/types/client/user-settings/copy.d.ts +25 -0
  303. package/lib/types/client/user-settings/draft.d.ts +51 -0
  304. package/lib/types/client/user-settings/fields.d.ts +43 -0
  305. package/lib/types/config-resolvers/tools.d.ts +6 -0
  306. package/lib/types/documents/artifacts/ids.d.ts +14 -0
  307. package/lib/types/documents/artifacts/manifest.d.ts +32 -0
  308. package/lib/types/documents/artifacts/store.d.ts +67 -0
  309. package/lib/types/documents/capabilities.d.ts +32 -0
  310. package/lib/types/documents/config.d.ts +27 -0
  311. package/lib/types/documents/defaults.d.ts +161 -0
  312. package/lib/types/documents/errors.d.ts +42 -0
  313. package/lib/types/documents/index.d.ts +63 -0
  314. package/lib/types/documents/inspect/facts.d.ts +43 -0
  315. package/lib/types/documents/inspect/zip.d.ts +28 -0
  316. package/lib/types/documents/markdown/directives.d.ts +39 -0
  317. package/lib/types/documents/markdown/frontmatter.d.ts +15 -0
  318. package/lib/types/documents/markdown/normalize.d.ts +30 -0
  319. package/lib/types/documents/orchestrator/assets.d.ts +55 -0
  320. package/lib/types/documents/orchestrator/convert-document.d.ts +25 -0
  321. package/lib/types/documents/orchestrator/create-document.d.ts +18 -0
  322. package/lib/types/documents/orchestrator/extract-document.d.ts +24 -0
  323. package/lib/types/documents/orchestrator/inspect-document.d.ts +12 -0
  324. package/lib/types/documents/orchestrator/runtime-deps.d.ts +43 -0
  325. package/lib/types/documents/orchestrator/scope.d.ts +52 -0
  326. package/lib/types/documents/providers/docling.d.ts +54 -0
  327. package/lib/types/documents/providers/libreoffice.d.ts +40 -0
  328. package/lib/types/documents/providers/markitdown.d.ts +28 -0
  329. package/lib/types/documents/providers/pandoc.d.ts +42 -0
  330. package/lib/types/documents/providers/process.d.ts +54 -0
  331. package/lib/types/documents/providers/registry.d.ts +68 -0
  332. package/lib/types/documents/providers/shared.d.ts +27 -0
  333. package/lib/types/documents/runtime.d.ts +59 -0
  334. package/lib/types/documents/security/file-types.d.ts +39 -0
  335. package/lib/types/documents/security/limits.d.ts +24 -0
  336. package/lib/types/documents/security/mime.d.ts +13 -0
  337. package/lib/types/documents/security/paths.d.ts +38 -0
  338. package/lib/types/documents/templates/registry.d.ts +50 -0
  339. package/lib/types/documents/templates/resolver.d.ts +30 -0
  340. package/lib/types/documents/tools/convert.d.ts +9 -0
  341. package/lib/types/documents/tools/create.d.ts +14 -0
  342. package/lib/types/documents/tools/index.d.ts +33 -0
  343. package/lib/types/documents/tools/inspect.d.ts +9 -0
  344. package/lib/types/documents/tools/shared.d.ts +77 -0
  345. package/lib/types/documents/tools/to-markdown.d.ts +12 -0
  346. package/lib/types/documents/types.d.ts +294 -0
  347. package/lib/types/index.d.ts +75 -3
  348. package/lib/types/integration-principals.d.ts +9 -0
  349. package/lib/types/lockdown-policy.d.ts +12 -2
  350. package/lib/types/personal-skills/errors.d.ts +11 -0
  351. package/lib/types/personal-skills/host.d.ts +42 -0
  352. package/lib/types/personal-skills/index.d.ts +10 -0
  353. package/lib/types/personal-skills/paths.d.ts +39 -0
  354. package/lib/types/personal-skills/provider.d.ts +33 -0
  355. package/lib/types/personal-skills/remotes.d.ts +35 -0
  356. package/lib/types/personal-skills/service.d.ts +131 -0
  357. package/lib/types/personal-skills/skill-file.d.ts +64 -0
  358. package/lib/types/personal-skills/skill-format.d.ts +100 -0
  359. package/lib/types/personal-skills/watcher.d.ts +39 -0
  360. package/lib/types/profile.d.ts +13 -0
  361. package/lib/types/prompt-notes.d.ts +9 -0
  362. package/lib/types/provenance/file-preview.d.ts +47 -4
  363. package/lib/types/provenance/host-store.d.ts +7 -1
  364. package/lib/types/provenance/index.d.ts +1 -0
  365. package/lib/types/provenance/snapshot-store.d.ts +23 -0
  366. package/lib/types/qa-tools/activation-detector.d.ts +29 -0
  367. package/lib/types/qa-tools/activation-manager.d.ts +47 -0
  368. package/lib/types/qa-tools/catalog.d.ts +40 -0
  369. package/lib/types/qa-tools/durable-marker.d.ts +16 -0
  370. package/lib/types/qa-tools/index.d.ts +40 -0
  371. package/lib/types/qa-tools/lifecycle.d.ts +44 -0
  372. package/lib/types/qa-tools/types.d.ts +45 -0
  373. package/lib/types/secure-session.d.ts +33 -2
  374. package/lib/types/starters.d.ts +45 -0
  375. package/lib/types/types.d.ts +208 -3
  376. package/package.json +22 -9
  377. package/scripts/repair-session-events.mjs +260 -0
  378. package/lib/client/components/QaProfile.js +0 -64
  379. package/lib/client/components/QaProfile.js.map +0 -1
  380. package/lib/types/client/components/QaProfile.d.ts +0 -25
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Configuration of the document subsystem (§20).
3
+ *
4
+ * The subsystem is part of the `qa-surface` namespace, so this resolver
5
+ * follows the same shape as the other domains: it normalizes, validates and
6
+ * freezes, and the schema in `src/config.ts` takes every default from
7
+ * {@link DEFAULT_QA_DOCUMENTS_CONFIG} so an untouched deployment sends the
8
+ * resolver nothing at all.
9
+ *
10
+ * Environment overrides are applied in `applyDocumentsEnvOverrides`, on the
11
+ * way into the plugin, and only for the documented variables — a deployment
12
+ * that injects secrets into the process environment does not thereby get to
13
+ * reconfigure the pipeline.
14
+ */
15
+ import { type QaDocumentsConfig, type ResolvedQaDocumentsConfig } from "./defaults.js";
16
+ export { DEFAULT_QA_DOCUMENTS_CONFIG, type QaDocumentsCommandConfig, type QaDocumentsConfig, type QaDocumentsCreateConfig, type QaDocumentsEndpointConfig, type QaDocumentsExtractionConfig, type QaDocumentsLimitsConfig, type QaDocumentsRetentionConfig, type QaDocumentsStorageConfig, type QaDocumentsTemplatesConfig, type QaDocumentsWorkersConfig, type ResolvedQaDocumentsConfig, } from "./defaults.js";
17
+ /** Materialize and validate the document configuration. */
18
+ export declare function resolveDocumentsConfig(input?: QaDocumentsConfig): ResolvedQaDocumentsConfig;
19
+ /**
20
+ * Apply the documented environment overrides (§20). Kept out of
21
+ * {@link resolveDocumentsConfig} so the resolver stays a pure function of its
22
+ * input — configuration tests never depend on the ambient environment.
23
+ */
24
+ export declare function applyDocumentsEnvOverrides(config: QaDocumentsConfig, env: NodeJS.ProcessEnv): QaDocumentsConfig;
25
+ /** Milliseconds a retention sweep interval would wait. */
26
+ export declare function retentionIntervalMs(config: ResolvedQaDocumentsConfig): number;
27
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Canonical document defaults (§20).
3
+ *
4
+ * This module must stay free of Node builtins: it is the only part of the
5
+ * document subsystem the browser settings bundle reaches (through the QA
6
+ * surface's resolved configuration), and the page cannot load `node:*`. The
7
+ * resolver and everything that touches the filesystem live in `config.ts`,
8
+ * which imports these values.
9
+ */
10
+ import type { CreateFormat, ExtractionMode, OcrMode, PdfMode } from "./types.js";
11
+ export interface QaDocumentsStorageConfig {
12
+ /** Absolute artifact root; `null` means `<session cwd>/.qa/artifacts/documents`. */
13
+ readonly root?: string | null;
14
+ readonly retainSource?: boolean;
15
+ readonly retainInputs?: boolean;
16
+ /** Extra roots an input file may be read from, beside the session workspace. */
17
+ readonly allowedInputRoots?: readonly string[];
18
+ }
19
+ export interface QaDocumentsTemplatesConfig {
20
+ /** Absolute template root; `null` probes the session workspace. */
21
+ readonly root?: string | null;
22
+ readonly default?: string;
23
+ }
24
+ export interface QaDocumentsCreateConfig {
25
+ readonly defaultPdfMode?: PdfMode;
26
+ readonly allowFormats?: readonly CreateFormat[];
27
+ readonly allowRawMarkup?: boolean;
28
+ readonly toc?: boolean;
29
+ }
30
+ export interface QaDocumentsExtractionConfig {
31
+ readonly defaultMode?: ExtractionMode;
32
+ readonly ocr?: OcrMode;
33
+ readonly ocrLanguages?: readonly string[];
34
+ readonly extractImages?: boolean;
35
+ readonly extractTables?: boolean;
36
+ readonly preservePageMarkers?: boolean;
37
+ readonly allowFallback?: boolean;
38
+ /** Markdown returned inline to the model is capped at this many characters. */
39
+ readonly maxInlineChars?: number;
40
+ }
41
+ export interface QaDocumentsEndpointConfig {
42
+ readonly enabled?: boolean;
43
+ readonly baseUrl?: string;
44
+ }
45
+ export interface QaDocumentsCommandConfig {
46
+ readonly enabled?: boolean;
47
+ readonly executable?: string;
48
+ readonly timeoutMs?: number;
49
+ }
50
+ export interface QaDocumentsWorkersConfig {
51
+ readonly renderConcurrency?: number;
52
+ readonly extractionConcurrency?: number;
53
+ readonly ocrConcurrency?: number;
54
+ }
55
+ export interface QaDocumentsRetentionConfig {
56
+ readonly enabled?: boolean;
57
+ readonly maxAgeDays?: number;
58
+ readonly cleanupIntervalHours?: number;
59
+ }
60
+ export interface QaDocumentsLimitsConfig {
61
+ readonly maxInputBytes?: number;
62
+ readonly maxMarkdownChars?: number;
63
+ readonly maxPages?: number;
64
+ readonly maxExtractedImages?: number;
65
+ readonly maxAssetBytes?: number;
66
+ readonly maxResponseBytes?: number;
67
+ readonly maxExtractedMarkdownBytes?: number;
68
+ readonly allowedAssetMimeTypes?: readonly string[];
69
+ }
70
+ export interface QaDocumentsConfig {
71
+ readonly enabled?: boolean;
72
+ readonly storage?: QaDocumentsStorageConfig;
73
+ readonly templates?: QaDocumentsTemplatesConfig;
74
+ readonly create?: QaDocumentsCreateConfig;
75
+ readonly extraction?: QaDocumentsExtractionConfig;
76
+ readonly docling?: QaDocumentsEndpointConfig & {
77
+ readonly timeoutMs?: number;
78
+ };
79
+ readonly pandoc?: QaDocumentsCommandConfig;
80
+ readonly libreoffice?: QaDocumentsCommandConfig;
81
+ readonly typst?: QaDocumentsCommandConfig;
82
+ readonly markitdown?: QaDocumentsCommandConfig;
83
+ readonly workers?: QaDocumentsWorkersConfig;
84
+ readonly retention?: QaDocumentsRetentionConfig;
85
+ readonly limits?: QaDocumentsLimitsConfig;
86
+ }
87
+ export interface ResolvedQaDocumentsConfig {
88
+ readonly enabled: boolean;
89
+ readonly storage: {
90
+ readonly root: string | null;
91
+ readonly retainSource: boolean;
92
+ readonly retainInputs: boolean;
93
+ readonly allowedInputRoots: readonly string[];
94
+ };
95
+ readonly templates: {
96
+ readonly root: string | null;
97
+ readonly default: string;
98
+ };
99
+ readonly create: {
100
+ readonly defaultPdfMode: PdfMode;
101
+ readonly allowFormats: readonly CreateFormat[];
102
+ readonly allowRawMarkup: boolean;
103
+ readonly toc: boolean;
104
+ };
105
+ readonly extraction: {
106
+ readonly defaultMode: ExtractionMode;
107
+ readonly ocr: OcrMode;
108
+ readonly ocrLanguages: readonly string[];
109
+ readonly extractImages: boolean;
110
+ readonly extractTables: boolean;
111
+ readonly preservePageMarkers: boolean;
112
+ readonly allowFallback: boolean;
113
+ readonly maxInlineChars: number;
114
+ };
115
+ readonly docling: {
116
+ readonly enabled: boolean;
117
+ readonly baseUrl: string;
118
+ readonly timeoutMs: number;
119
+ };
120
+ readonly pandoc: {
121
+ readonly executable: string;
122
+ readonly timeoutMs: number;
123
+ };
124
+ readonly libreoffice: {
125
+ readonly executable: string;
126
+ readonly timeoutMs: number;
127
+ };
128
+ readonly typst: {
129
+ readonly enabled: boolean;
130
+ readonly executable: string;
131
+ readonly timeoutMs: number;
132
+ };
133
+ readonly markitdown: {
134
+ readonly enabled: boolean;
135
+ readonly executable: string;
136
+ readonly timeoutMs: number;
137
+ };
138
+ readonly workers: {
139
+ readonly renderConcurrency: number;
140
+ readonly extractionConcurrency: number;
141
+ readonly ocrConcurrency: number;
142
+ };
143
+ readonly retention: {
144
+ readonly enabled: boolean;
145
+ readonly maxAgeDays: number;
146
+ readonly cleanupIntervalHours: number;
147
+ };
148
+ readonly limits: {
149
+ readonly maxInputBytes: number;
150
+ readonly maxMarkdownChars: number;
151
+ readonly maxPages: number;
152
+ readonly maxExtractedImages: number;
153
+ readonly maxAssetBytes: number;
154
+ readonly maxResponseBytes: number;
155
+ readonly maxExtractedMarkdownBytes: number;
156
+ readonly allowedAssetMimeTypes: readonly string[];
157
+ };
158
+ }
159
+ /** The canonical resolved configuration; the schema and resolver both use it. */
160
+ export declare const DEFAULT_QA_DOCUMENTS_CONFIG: ResolvedQaDocumentsConfig;
161
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Typed failures of the document pipeline.
3
+ *
4
+ * Every failure the agent can observe carries a stable machine-readable code
5
+ * (§24) and the backend that produced it. Backend output is never forwarded
6
+ * verbatim: {@link sanitizeBackendOutput} strips ANSI escapes, collapses
7
+ * whitespace, replaces absolute paths with the placeholder the operator can
8
+ * recognize as "inside the sandbox" and caps the length, so a converter's
9
+ * stderr cannot leak the deployment's layout or the document's content into a
10
+ * model request.
11
+ */
12
+ export declare const DOCUMENT_ERROR_CODES: readonly ["INVALID_INPUT", "UNSUPPORTED_FORMAT", "UNSUPPORTED_CONVERSION", "INPUT_TOO_LARGE", "DOCUMENT_TOO_LARGE", "FILE_NOT_FOUND", "TEMPLATE_NOT_FOUND", "INVALID_TEMPLATE", "INVALID_ASSET", "PATH_NOT_ALLOWED", "ENCRYPTED_DOCUMENT", "MACRO_ENABLED_DOCUMENT", "OCR_FAILED", "EXTRACTION_FAILED", "RENDER_FAILED", "CONVERSION_FAILED", "BACKEND_UNAVAILABLE", "BACKEND_TIMEOUT", "BACKEND_FAILED", "ARTIFACT_WRITE_FAILED"];
13
+ export type DocumentErrorCode = (typeof DOCUMENT_ERROR_CODES)[number];
14
+ export interface DocumentErrorFields {
15
+ readonly backend?: string;
16
+ readonly details?: Readonly<Record<string, unknown>>;
17
+ readonly retryable?: boolean;
18
+ readonly cause?: unknown;
19
+ }
20
+ export declare class DocumentError extends Error {
21
+ readonly code: DocumentErrorCode;
22
+ readonly retryable: boolean;
23
+ readonly backend: string | undefined;
24
+ readonly details: Readonly<Record<string, unknown>> | undefined;
25
+ constructor(code: DocumentErrorCode, message: string, fields?: DocumentErrorFields);
26
+ /** The structured form the manifest and the logs carry (§24). */
27
+ toShape(): {
28
+ readonly code: DocumentErrorCode;
29
+ readonly message: string;
30
+ readonly retryable: boolean;
31
+ readonly backend?: string;
32
+ readonly details?: Readonly<Record<string, unknown>>;
33
+ };
34
+ }
35
+ /**
36
+ * Make a backend's diagnostic text safe to show: no escapes, no absolute
37
+ * paths, one line per statement, at most `max` characters.
38
+ */
39
+ export declare function sanitizeBackendOutput(text: string, max?: number): string;
40
+ /** Wrap any thrown value into a {@link DocumentError} without losing its code. */
41
+ export declare function asDocumentError(error: unknown, fallbackCode: DocumentErrorCode, backend?: string): DocumentError;
42
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The document subsystem of `dsh-qa-surface` (§38).
3
+ *
4
+ * Markdown is the canonical source for everything the agent creates, the
5
+ * backends that turn it into DOCX/PDF (or read it back out of them) live
6
+ * behind the provider interfaces in `providers/`, and the four semantic tools
7
+ * in `tools/` are the only surface the model ever sees. Everything else —
8
+ * artifact bundles, manifests, template resolution, path containment, limits —
9
+ * exists to make those four tools predictable.
10
+ *
11
+ * The public entry point is {@link installDocumentSubsystem}.
12
+ */
13
+ export { DOCUMENT_ERROR_CODES, DocumentError, asDocumentError, sanitizeBackendOutput, type DocumentErrorCode, type DocumentErrorFields, } from "./errors.js";
14
+ export { DEFAULT_QA_DOCUMENTS_CONFIG, applyDocumentsEnvOverrides, resolveDocumentsConfig, retentionIntervalMs, type QaDocumentsConfig, type ResolvedQaDocumentsConfig, } from "./config.js";
15
+ export type * from "./types.js";
16
+ export { createDocumentRuntime, DocumentRuntime, type DocumentRuntimeOptions, } from "./runtime.js";
17
+ export { createDocumentTools, registerDocumentTools, DOCUMENT_TOOL_NAMES, DOCUMENT_CONVERT_TOOL, DOCUMENT_CREATE_TOOL, DOCUMENT_INSPECT_TOOL, DOCUMENT_TO_MARKDOWN_TOOL, type DocumentToolRegistry, } from "./tools/index.js";
18
+ export { createProviders, type ProviderSeams, type ProviderSet, } from "./providers/registry.js";
19
+ export { documentCapabilities, documentHealth } from "./capabilities.js";
20
+ export { ArtifactStore, sha256Hex, sha256OfFile } from "./artifacts/store.js";
21
+ export { createArtifactId, createUlid, isArtifactId } from "./artifacts/ids.js";
22
+ export { MANIFEST_FILE, MANIFEST_SCHEMA_VERSION, readManifest, writeManifest, } from "./artifacts/manifest.js";
23
+ export { BUILTIN_TEMPLATE_NAME, TEMPLATE_MANIFEST_FILE, loadTemplateRegistry, templateNames, type DocumentTemplate, type TemplateRegistry, } from "./templates/registry.js";
24
+ export { resolveTemplate, type ResolvedTemplate, } from "./templates/resolver.js";
25
+ export { CONVERSION_ROUTES } from "./orchestrator/convert-document.js";
26
+ export { defaultArtifactRoot, resolveDocumentScope, type DocumentScope, type ResolvedDocumentScope, } from "./orchestrator/scope.js";
27
+ export { silentDocumentLogger, type DocumentLogger, } from "./orchestrator/runtime-deps.js";
28
+ export { assertInsideRoot, canonicalizeForContainment, isInsideRoot, resolveInsideRoot, sanitizeFilename, } from "./security/paths.js";
29
+ export { DEFAULT_ASSET_MIME_TYPES, detectFormatByExtension, describeUnsupported, sniffDocument, supportedFormatOf, type SniffedDocument, } from "./security/file-types.js";
30
+ export { applyDirectives } from "./markdown/directives.js";
31
+ export { normalizeExtractedMarkdown } from "./markdown/normalize.js";
32
+ export { parseFrontMatter } from "./markdown/frontmatter.js";
33
+ export { readPdfFacts, readDocxFacts, readDocxMetadata, } from "./inspect/facts.js";
34
+ export { readZipEntries, readZipEntry, readZipEntryByName, } from "./inspect/zip.js";
35
+ import type { Context } from "@deepseek-ai/cordis";
36
+ import { type QaDocumentsConfig } from "./config.js";
37
+ import type { DocumentLogger } from "./orchestrator/runtime-deps.js";
38
+ import type { ProviderSeams } from "./providers/registry.js";
39
+ import { DocumentRuntime } from "./runtime.js";
40
+ import { type DocumentToolRegistry } from "./tools/index.js";
41
+ export interface InstallDocumentSubsystemOptions {
42
+ readonly config: QaDocumentsConfig;
43
+ readonly logger: DocumentLogger;
44
+ /** The host tool registry (`ctx.tools`). */
45
+ readonly register: DocumentToolRegistry["register"];
46
+ readonly seams?: ProviderSeams;
47
+ /** Environment overrides are applied by the caller, which owns the process. */
48
+ readonly now?: () => Date;
49
+ }
50
+ export interface DocumentSubsystem {
51
+ readonly runtime: DocumentRuntime;
52
+ readonly toolNames: readonly string[];
53
+ dispose(): void;
54
+ }
55
+ /**
56
+ * Wire the subsystem into a host context: build the runtime, register the four
57
+ * tools, and schedule the retention sweep when a storage root is pinned.
58
+ *
59
+ * `enabled: false` is answered with `undefined` — the caller then leaves both
60
+ * the tools and the timer absent instead of registering inert definitions.
61
+ */
62
+ export declare function installDocumentSubsystem(ctx: Context, options: InstallDocumentSubsystemOptions): DocumentSubsystem | undefined;
63
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Document facts read without converting anything (§11).
3
+ *
4
+ * `document_inspect` must be cheap and safe: it reads the bytes it was given
5
+ * and answers what they claim to be. Two tiny readers cover the formats the
6
+ * pipeline supports — a PDF dictionary scan and an OOXML package scan — which
7
+ * is what makes inspect useful on a 400-page file that nobody wants to render.
8
+ */
9
+ import type { DetectedFormat } from "../types.js";
10
+ export interface PdfFacts {
11
+ readonly pages?: number;
12
+ readonly encrypted: boolean;
13
+ readonly metadata: {
14
+ readonly title?: string;
15
+ readonly author?: string;
16
+ readonly createdAt?: string;
17
+ readonly modifiedAt?: string;
18
+ };
19
+ readonly images?: number;
20
+ }
21
+ /**
22
+ * Read a PDF's page count, encryption flag and document-information entries.
23
+ * This is a scan, not a parser: it is immune to malformed cross-reference
24
+ * tables (a broken PDF still answers "how many pages does it claim"), and it
25
+ * never follows an object stream.
26
+ */
27
+ export declare function readPdfFacts(buffer: Buffer): PdfFacts;
28
+ export interface DocxFacts {
29
+ readonly headings?: number;
30
+ readonly tables?: number;
31
+ readonly images?: number;
32
+ }
33
+ /** Count document structure from the OOXML package, without rendering it. */
34
+ export declare function readDocxFacts(buffer: Buffer): DocxFacts;
35
+ /** Metadata recorded in `docProps/core.xml`. */
36
+ export declare function readDocxMetadata(buffer: Buffer): {
37
+ readonly title?: string;
38
+ readonly author?: string;
39
+ readonly createdAt?: string;
40
+ readonly modifiedAt?: string;
41
+ };
42
+ export declare function mediaTypeOfDetected(format: DetectedFormat): string;
43
+ //# sourceMappingURL=facts.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Minimal ZIP reader (central directory + per-entry inflate).
3
+ *
4
+ * The document pipeline inspects OOXML containers — `document_inspect` counts
5
+ * headings and images, `security/file-types.ts` decides DOCX vs macro-enabled
6
+ * DOCM — and neither may pull a ZIP dependency into the host plugin. Only the
7
+ * two compression methods OOXML writers actually produce are supported
8
+ * (stored and deflate); anything else is reported as unreadable instead of
9
+ * being guessed at.
10
+ */
11
+ export interface ZipEntry {
12
+ readonly name: string;
13
+ readonly compressionMethod: number;
14
+ readonly compressedSize: number;
15
+ readonly uncompressedSize: number;
16
+ readonly localHeaderOffset: number;
17
+ }
18
+ /**
19
+ * Parse the central directory. Returns `undefined` when the buffer is not a
20
+ * ZIP archive (or is truncated) — the caller decides whether that is an error.
21
+ */
22
+ export declare function readZipEntries(buffer: Buffer): ZipEntry[] | undefined;
23
+ export declare function findZipEntry(entries: readonly ZipEntry[], name: string): ZipEntry | undefined;
24
+ /** Decompress one entry, or `undefined` when it is unreadable/oversized. */
25
+ export declare function readZipEntry(buffer: Buffer, entry: ZipEntry): Buffer | undefined;
26
+ /** Convenience: read a named entry from an archive in one call. */
27
+ export declare function readZipEntryByName(buffer: Buffer, name: string): Buffer | undefined;
28
+ //# sourceMappingURL=zip.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Controlled document directives (§36).
3
+ *
4
+ * Markdown stays the canonical source, so the few structures Markdown cannot
5
+ * express — a page break, a callout — are written as fences the orchestrator
6
+ * rewrites into the target backend's own representation before the renderer
7
+ * sees the text:
8
+ *
9
+ * ```md
10
+ * :::pagebreak
11
+ * :::
12
+ *
13
+ * :::note
14
+ * Important information.
15
+ * :::
16
+ * ```
17
+ *
18
+ * Anything else is refused rather than passed through: an unknown `:::`
19
+ * directive would otherwise reach pandoc as literal text, and raw markup
20
+ * (HTML, LaTeX, Typst escapes) is only accepted when a deployment explicitly
21
+ * opts in with `documents.create.allowRawMarkup`.
22
+ */
23
+ import type { DocumentWarning } from "../types.js";
24
+ /** Backends whose directive spelling differs. */
25
+ export type DirectiveBackend = "docx" | "typst";
26
+ export interface DirectiveOptions {
27
+ readonly backend: DirectiveBackend;
28
+ readonly allowRawMarkup: boolean;
29
+ }
30
+ export interface DirectiveResult {
31
+ readonly markdown: string;
32
+ readonly warnings: readonly DocumentWarning[];
33
+ }
34
+ /**
35
+ * Rewrite directives for one backend. Line-oriented on purpose: a fence that
36
+ * appears inside a code block is content, not a directive.
37
+ */
38
+ export declare function applyDirectives(markdown: string, options: DirectiveOptions): DirectiveResult;
39
+ //# sourceMappingURL=directives.d.ts.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Front-matter handling (§35).
3
+ *
4
+ * A generated document may carry a leading `---` block with scalar metadata.
5
+ * Only scalars are read: the block feeds document properties and the manifest,
6
+ * never a nested configuration surface, so there is nothing here an author
7
+ * could use to reach a backend option.
8
+ */
9
+ export interface FrontMatter {
10
+ readonly attributes: Readonly<Record<string, string>>;
11
+ readonly body: string;
12
+ }
13
+ /** Split leading front matter from the body. Malformed lines are ignored. */
14
+ export declare function parseFrontMatter(markdown: string): FrontMatter;
15
+ //# sourceMappingURL=frontmatter.d.ts.map
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Markdown normalization for extracted documents (§16).
3
+ *
4
+ * The layer is deliberately conservative: it removes artifacts a converter
5
+ * reliably produces (platform line endings, non-breaking spaces, page-number
6
+ * lines, a running head repeated on every page) and never touches meaning.
7
+ * Guessing missing content is explicitly out of scope, and an LLM pass is not
8
+ * part of this stage at all — a document is never sent to a model to make its
9
+ * Markdown nicer.
10
+ */
11
+ import type { DocumentWarning } from "../types.js";
12
+ export interface NormalizeOptions {
13
+ /** Drop standalone page-number lines (`12`, `- 12 -`, `Page 12`). */
14
+ readonly stripPageNumbers?: boolean;
15
+ /** Drop short lines repeated on three or more pages. */
16
+ readonly stripRunningHeads?: boolean;
17
+ }
18
+ export interface NormalizeResult {
19
+ readonly markdown: string;
20
+ readonly warnings: readonly DocumentWarning[];
21
+ }
22
+ /** Normalize extracted Markdown; returns the text and what was changed. */
23
+ export declare function normalizeExtractedMarkdown(markdown: string, options?: NormalizeOptions): NormalizeResult;
24
+ /** Count Markdown structure for `document_inspect` on Markdown inputs. */
25
+ export declare function markdownStructure(markdown: string): {
26
+ headings: number;
27
+ tables: number;
28
+ images: number;
29
+ };
30
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Asset preparation and reference auditing (§17.1).
3
+ *
4
+ * Assets reach a document two ways: the caller names a file in the workspace,
5
+ * or it inlines bytes as a data URI. Both are copied into the bundle's
6
+ * `assets/` directory under a name the pipeline chooses, so the rendered
7
+ * document never depends on a path outside the artifact, and the Markdown
8
+ * references are rewritten to match.
9
+ *
10
+ * Before a renderer runs, every image reference in the source is accounted
11
+ * for: a missing local file, a reference that leaves the assets directory, or
12
+ * a remote URL (which the renderer would fetch from the network) is an error,
13
+ * not a silent drop.
14
+ */
15
+ import type { ResolvedQaDocumentsConfig } from "../config.js";
16
+ import type { DocumentAssetInput, DocumentWarning } from "../types.js";
17
+ import { type ResolvedDocumentScope } from "./scope.js";
18
+ export interface PreparedAsset {
19
+ readonly id: string;
20
+ /** Name inside the bundle's `assets/` directory. */
21
+ readonly fileName: string;
22
+ readonly mediaType: string;
23
+ readonly bytes: number;
24
+ /** How the caller referred to this asset, for reference rewriting. */
25
+ readonly references: readonly string[];
26
+ }
27
+ export interface PreparedAssets {
28
+ readonly assets: readonly PreparedAsset[];
29
+ readonly warnings: readonly DocumentWarning[];
30
+ }
31
+ export declare function prepareAssets(assets: readonly DocumentAssetInput[] | undefined, options: {
32
+ readonly config: ResolvedQaDocumentsConfig;
33
+ readonly scope: ResolvedDocumentScope;
34
+ readonly assetsDir: string;
35
+ }): Promise<PreparedAssets>;
36
+ /**
37
+ * Rewrite the image references that point at a provided asset to the bundle's
38
+ * own `assets/<name>`, keeping every other reference untouched. Matching is
39
+ * whole-reference (never a substring) and resolves relative spellings against
40
+ * the workspace, so an absolute path and a workspace-relative path to the same
41
+ * file both land on the same asset.
42
+ */
43
+ export declare function rewriteAssetReferences(markdown: string, assets: readonly PreparedAsset[], options: {
44
+ readonly roots: readonly string[];
45
+ }): string;
46
+ /**
47
+ * Verify every image reference in the Markdown before a renderer can act on
48
+ * it: local files must exist inside the assets directory, and remote URLs are
49
+ * refused because the renderer would fetch them (§26.5).
50
+ */
51
+ export declare function auditAssetReferences(markdown: string, options: {
52
+ readonly assetsDir: string;
53
+ readonly assets: readonly PreparedAsset[];
54
+ }): Promise<readonly DocumentWarning[]>;
55
+ //# sourceMappingURL=assets.d.ts.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * `document_convert` orchestration (§10).
3
+ *
4
+ * The route table is explicit and closed:
5
+ *
6
+ * ```text
7
+ * MD → DOCX, PDF
8
+ * DOCX → PDF, MD
9
+ * PDF → MD
10
+ * ```
11
+ *
12
+ * Anything else answers `UNSUPPORTED_CONVERSION` — the pipeline never falls
13
+ * back to "run some shell pipeline and hope", because a conversion the service
14
+ * does not model is a conversion it cannot bound, observe or secure.
15
+ */
16
+ import type { DocumentConvertInput, DocumentConvertResult, DocumentFormat } from "../types.js";
17
+ import { type DocumentScope } from "./scope.js";
18
+ import { type DocumentRuntimeDeps } from "./runtime-deps.js";
19
+ /** Routes this pipeline implements (source → target). */
20
+ export declare const CONVERSION_ROUTES: readonly (readonly [
21
+ DocumentFormat,
22
+ DocumentFormat
23
+ ])[];
24
+ export declare function convertDocument(deps: DocumentRuntimeDeps, input: DocumentConvertInput, scopeInput: DocumentScope): Promise<DocumentConvertResult>;
25
+ //# sourceMappingURL=convert-document.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * `document_create` orchestration (§8, §13, §14, §45).
3
+ *
4
+ * Markdown in, DOCX and/or PDF out, with the source, the assets and a manifest
5
+ * kept beside the results. The orchestration is where the pipeline's promises
6
+ * are actually kept:
7
+ *
8
+ * - the caller picks intent (formats, template name, pdf mode), never a
9
+ * command line;
10
+ * - a failure of the second format does not discard the first — partial
11
+ * success is returned with a warning (§45);
12
+ * - every produced file is fingerprinted and recorded in the manifest.
13
+ */
14
+ import type { DocumentCreateInput, DocumentCreateResult } from "../types.js";
15
+ import { type DocumentScope } from "./scope.js";
16
+ import { type DocumentRuntimeDeps } from "./runtime-deps.js";
17
+ export declare function createDocument(deps: DocumentRuntimeDeps, input: DocumentCreateInput, scopeInput: DocumentScope): Promise<DocumentCreateResult>;
18
+ //# sourceMappingURL=create-document.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `document_to_markdown` orchestration (§9, §15, §16).
3
+ *
4
+ * The tool returns the extracted Markdown, and the bundle keeps it: the model
5
+ * may only see a truncated view (a 300-page PDF is not a conversation), while
6
+ * the artifact always carries the full text with its assets and manifest.
7
+ */
8
+ import type { DocumentToMarkdownInput, DocumentToMarkdownResult, ExtractionMode, OcrMode } from "../types.js";
9
+ import { type DocumentScope } from "./scope.js";
10
+ import { type DocumentRuntimeDeps } from "./runtime-deps.js";
11
+ export type ExtractionOperation = "document_to_markdown" | "document_convert";
12
+ export interface ExtractToMarkdownParams {
13
+ readonly file: string;
14
+ readonly mode?: ExtractionMode;
15
+ readonly ocr?: OcrMode;
16
+ readonly ocrLanguages?: readonly string[];
17
+ readonly extractImages?: boolean;
18
+ readonly extractTables?: boolean;
19
+ readonly preservePageMarkers?: boolean;
20
+ readonly outputFilename?: string;
21
+ }
22
+ export declare function extractToMarkdown(deps: DocumentRuntimeDeps, params: ExtractToMarkdownParams, scopeInput: DocumentScope, operation: ExtractionOperation): Promise<DocumentToMarkdownResult>;
23
+ export declare function toMarkdown(deps: DocumentRuntimeDeps, input: DocumentToMarkdownInput, scope: DocumentScope): Promise<DocumentToMarkdownResult>;
24
+ //# sourceMappingURL=extract-document.d.ts.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `document_inspect` orchestration (§11).
3
+ *
4
+ * A read-only pass over one file: what it is, how big it is, what it says
5
+ * about itself, and what structure it holds. No artifact is created — the
6
+ * operation answers a question, it does not make a document.
7
+ */
8
+ import type { DocumentInspectInput, DocumentInspectResult } from "../types.js";
9
+ import { type DocumentScope } from "./scope.js";
10
+ import type { DocumentRuntimeDeps } from "./runtime-deps.js";
11
+ export declare function inspectDocument(deps: DocumentRuntimeDeps, input: DocumentInspectInput, scopeInput: DocumentScope): Promise<DocumentInspectResult>;
12
+ //# sourceMappingURL=inspect-document.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Runtime wiring shared by the four orchestrator operations.
3
+ *
4
+ * The runtime owns what must outlive a single call — the backend registry, the
5
+ * concurrency semaphores and the clock — and each operation reads its
6
+ * configuration and providers from here, so a test can substitute stub
7
+ * backends without touching a tool definition.
8
+ */
9
+ import type { ResolvedQaDocumentsConfig } from "../config.js";
10
+ import type { ProviderSet } from "../providers/registry.js";
11
+ import { type Semaphore } from "../security/limits.js";
12
+ /** The logging surface the subsystem uses; a structural subset of PluginLogger. */
13
+ export interface DocumentLogger {
14
+ debug(event: string, fields?: Record<string, unknown>): void;
15
+ info(event: string, fields?: Record<string, unknown>): void;
16
+ warn(event: string, fields?: Record<string, unknown>): void;
17
+ error(event: string, fields?: Record<string, unknown>): void;
18
+ }
19
+ /** A logger that drops everything; the default when none is supplied. */
20
+ export declare const silentDocumentLogger: DocumentLogger;
21
+ export interface DocumentRuntimeDeps {
22
+ readonly config: ResolvedQaDocumentsConfig;
23
+ readonly providers: ProviderSet;
24
+ readonly logger: DocumentLogger;
25
+ readonly now: () => Date;
26
+ readonly semaphores: {
27
+ readonly render: Semaphore;
28
+ readonly extraction: Semaphore;
29
+ readonly ocr: Semaphore;
30
+ };
31
+ }
32
+ export declare function createRuntimeDeps(options: {
33
+ readonly config: ResolvedQaDocumentsConfig;
34
+ readonly providers: ProviderSet;
35
+ readonly logger?: DocumentLogger;
36
+ readonly now?: () => Date;
37
+ }): DocumentRuntimeDeps;
38
+ /** Run `body` with one render slot held, releasing it on every path. */
39
+ export declare function withRenderSlot<T>(deps: DocumentRuntimeDeps, signal: AbortSignal | undefined, body: () => Promise<T>): Promise<T>;
40
+ export declare function withExtractionSlot<T>(deps: DocumentRuntimeDeps, signal: AbortSignal | undefined, body: () => Promise<T>): Promise<T>;
41
+ /** OCR runs behind its own, narrower slot (§27: `ocrConcurrency`). */
42
+ export declare function withOcrSlot<T>(deps: DocumentRuntimeDeps, signal: AbortSignal | undefined, body: () => Promise<T>): Promise<T>;
43
+ //# sourceMappingURL=runtime-deps.d.ts.map