@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,52 @@
1
+ /**
2
+ * Job scope: where an operation reads from and writes to.
3
+ *
4
+ * Artifacts live in the session workspace by default
5
+ * (`<cwd>/.qa/artifacts/documents/<artifact-id>`), which is what makes a QA
6
+ * deployment's per-user workspaces isolate document bundles for free (§40).
7
+ * A deployment may pin `documents.storage.root` to a shared volume instead, in
8
+ * which case the session workspace stays the only place inputs are read from.
9
+ * Inputs may additionally come from explicitly configured roots (§26.2).
10
+ */
11
+ import { ArtifactStore } from "../artifacts/store.js";
12
+ import type { ResolvedQaDocumentsConfig } from "../config.js";
13
+ import { type TemplateRegistry } from "../templates/registry.js";
14
+ /** What the caller (a tool) knows about the session. */
15
+ export interface DocumentScope {
16
+ readonly workspaceRoot: string;
17
+ readonly sessionId?: string;
18
+ readonly signal?: AbortSignal;
19
+ }
20
+ export interface ResolvedDocumentScope {
21
+ readonly workspaceRoot: string;
22
+ readonly artifactRoot: string;
23
+ readonly sessionId?: string;
24
+ readonly signal?: AbortSignal;
25
+ readonly store: ArtifactStore;
26
+ readonly templates: TemplateRegistry;
27
+ }
28
+ /** Artifact root of one workspace: configured root, else the workspace itself. */
29
+ export declare function defaultArtifactRoot(config: ResolvedQaDocumentsConfig, workspaceRoot: string): string;
30
+ /**
31
+ * Template roots to probe, in order. An explicitly configured root is
32
+ * authoritative; a deployment that configures none gets the two conventional
33
+ * workspace directories.
34
+ */
35
+ export declare function templateCandidateRoots(config: ResolvedQaDocumentsConfig, workspaceRoot: string): string[];
36
+ /** Load the first candidate root that carries a registry manifest. */
37
+ export declare function loadScopeTemplates(config: ResolvedQaDocumentsConfig, workspaceRoot: string): Promise<TemplateRegistry>;
38
+ export declare function resolveDocumentScope(config: ResolvedQaDocumentsConfig, scope: DocumentScope): Promise<ResolvedDocumentScope>;
39
+ /** Roots an input file may be read from, most specific first. */
40
+ export declare function allowedInputRoots(config: ResolvedQaDocumentsConfig, scope: ResolvedDocumentScope): string[];
41
+ /**
42
+ * Resolve a caller-supplied input path. The file must exist inside one of the
43
+ * allowed roots — traversal, symlinks out of the root and absolute paths to
44
+ * unrelated directories are all refused (§26.2).
45
+ */
46
+ export declare function resolveInputPath(config: ResolvedQaDocumentsConfig, scope: ResolvedDocumentScope, requested: string, label: string): Promise<string>;
47
+ /** Read an input file under a byte budget. */
48
+ export declare function readInputBytes(filePath: string, config: ResolvedQaDocumentsConfig, label: string): Promise<Buffer>;
49
+ /** Ensure the artifact root exists and is writable, failing with a clear code. */
50
+ export declare function ensureArtifactRoot(scope: ResolvedDocumentScope): Promise<void>;
51
+ export declare function assertInsideArtifactRoot(scope: ResolvedDocumentScope, target: string, label: string): string;
52
+ //# sourceMappingURL=scope.d.ts.map
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Docling provider — the default DOCX/PDF → Markdown extractor (§6.1, §15).
3
+ *
4
+ * Docling runs as a separate HTTP service (`docling-serve`) rather than inside
5
+ * the host process: it is the heaviest dependency of the pipeline, it is where
6
+ * OCR happens, and keeping it across a network boundary is what lets the QA
7
+ * image stay small (§21, §39).
8
+ *
9
+ * Two behaviours are deliberate:
10
+ *
11
+ * - images come back inline as base64 data URIs (the only representation that
12
+ * survives an HTTP boundary without a second fetch), and the extractor writes
13
+ * them out as real files under `assets/`, rewriting references to relative
14
+ * paths (§17.2);
15
+ * - nothing about the response shape is assumed beyond "there is Markdown
16
+ * somewhere in it": a deployment upgrades docling-serve independently of
17
+ * this plugin, so both the wrapped (`document.md_content`) and flat
18
+ * (`md_content`) spellings are read.
19
+ */
20
+ import type { BackendStatus, DocumentExtractor, DocumentFormat, ExtractInput, ExtractedDocument } from "../types.js";
21
+ export interface DoclingProviderOptions {
22
+ /** Base URL of docling-serve, e.g. `http://docling:5001`. */
23
+ readonly baseUrl: string;
24
+ readonly timeoutMs: number;
25
+ /** Cap on the response body the extractor will read. */
26
+ readonly maxResponseBytes: number;
27
+ readonly maxImages: number;
28
+ /** Test seam and proxy hook; defaults to the global `fetch`. */
29
+ readonly fetchImpl?: typeof fetch;
30
+ }
31
+ export declare class DoclingExtractor implements DocumentExtractor {
32
+ private readonly options;
33
+ readonly name = "docling";
34
+ constructor(options: DoclingProviderOptions);
35
+ supports(_format: DocumentFormat): boolean;
36
+ private get fetchImpl();
37
+ health(): Promise<BackendStatus>;
38
+ extract(input: ExtractInput): Promise<ExtractedDocument>;
39
+ /**
40
+ * Write inline images out as files and rewrite the Markdown to reference
41
+ * them relatively. Images beyond the configured cap are dropped with a
42
+ * warning rather than silently inflating the artifact (§25).
43
+ */
44
+ private materializeAssets;
45
+ }
46
+ interface DoclingPayload {
47
+ readonly markdown: string;
48
+ readonly pages?: number;
49
+ readonly serviceVersion?: string;
50
+ }
51
+ /** Read the Markdown out of a docling-serve response, in either spelling. */
52
+ export declare function readDoclingPayload(payload: unknown, backend: string): DoclingPayload;
53
+ export {};
54
+ //# sourceMappingURL=docling.d.ts.map
@@ -0,0 +1,40 @@
1
+ /**
2
+ * LibreOffice provider — DOCX → PDF (§6.1, §14.1, §46).
3
+ *
4
+ * Two details matter beyond "call the converter":
5
+ *
6
+ * - every invocation gets its own `-env:UserInstallation` profile, because
7
+ * concurrent headless LibreOffice processes sharing one profile corrupt each
8
+ * other's state; the temp profile is removed afterwards on success and on
9
+ * failure alike;
10
+ * - a conversion that produced no file, timed out, or died is reported as a
11
+ * failure of this step only. The orchestrator keeps whatever earlier steps
12
+ * already produced (§45).
13
+ */
14
+ import type { ConvertPdfInput, ConvertedDocument, DocumentConverter } from "../types.js";
15
+ export interface LibreOfficeProviderOptions {
16
+ readonly executable: string;
17
+ readonly timeoutMs: number;
18
+ /** Directory the per-job profiles are created under (default: os temp). */
19
+ readonly profileRoot?: string;
20
+ /** Test seam: arguments placed before the provider's own argv. */
21
+ readonly programPrefixArgs?: readonly string[];
22
+ readonly versionProbe?: () => Promise<string | undefined>;
23
+ }
24
+ export declare class LibreOfficePdfConverter implements DocumentConverter {
25
+ private readonly options;
26
+ readonly name = "libreoffice";
27
+ private cachedVersion;
28
+ constructor(options: LibreOfficeProviderOptions);
29
+ supports(source: string, target: string): boolean;
30
+ version(): Promise<string | undefined>;
31
+ private probeVersion;
32
+ convert(input: ConvertPdfInput): Promise<ConvertedDocument>;
33
+ /**
34
+ * LibreOffice derives the output name from the input, so the expected path
35
+ * is a prediction. When it is absent exactly one PDF in the output directory
36
+ * is accepted; anything else is a failure rather than a guess.
37
+ */
38
+ private locateOutput;
39
+ }
40
+ //# sourceMappingURL=libreoffice.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * MarkItDown provider — the optional fast extractor (§6.2, §9).
3
+ *
4
+ * Kept behind `documents.markitdown.enabled` (off by default): it is a
5
+ * convenient fallback when Docling is unreachable and high-fidelity parsing is
6
+ * not needed, but it is not the extractor a QA report should be built on.
7
+ */
8
+ import type { BackendStatus, DocumentExtractor, DocumentFormat, ExtractInput, ExtractedDocument } from "../types.js";
9
+ export interface MarkItDownProviderOptions {
10
+ readonly executable: string;
11
+ readonly timeoutMs: number;
12
+ readonly maxStdoutBytes: number;
13
+ /** Test seam: arguments placed before the provider's own argv. */
14
+ readonly programPrefixArgs?: readonly string[];
15
+ readonly versionProbe?: () => Promise<string | undefined>;
16
+ }
17
+ export declare class MarkItDownExtractor implements DocumentExtractor {
18
+ private readonly options;
19
+ readonly name = "markitdown";
20
+ private cachedVersion;
21
+ constructor(options: MarkItDownProviderOptions);
22
+ supports(format: DocumentFormat): boolean;
23
+ version(): Promise<string | undefined>;
24
+ private probeVersion;
25
+ health(): Promise<BackendStatus>;
26
+ extract(input: ExtractInput): Promise<ExtractedDocument>;
27
+ }
28
+ //# sourceMappingURL=markitdown.d.ts.map
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Pandoc provider (§6.1, §13, §14.2).
3
+ *
4
+ * The command line is assembled here and nowhere else: the agent supplies
5
+ * content, a template *name* and a handful of enumerated options, and this
6
+ * module turns them into argv. There is no path through the pipeline by which
7
+ * a caller can add `--lua-filter`, an arbitrary `--resource-path`, or a
8
+ * `--pdf-engine-opt` (§26.1).
9
+ */
10
+ import type { DocxRenderer, PdfRenderer, RenderDocxInput, RenderPdfInput, RenderedArtifact } from "../types.js";
11
+ export interface PandocProviderOptions {
12
+ /** Executable name or absolute path (`pandoc`, `pandoc.exe`). */
13
+ readonly executable: string;
14
+ readonly timeoutMs: number;
15
+ /** Test seam: arguments placed before the provider's own argv. */
16
+ readonly programPrefixArgs?: readonly string[];
17
+ /** Test seam: replacement for `--version` probing. */
18
+ readonly versionProbe?: () => Promise<string | undefined>;
19
+ }
20
+ /** Pandoc renders Markdown into DOCX, optionally through a reference document. */
21
+ export declare class PandocDocxRenderer implements DocxRenderer {
22
+ private readonly options;
23
+ readonly name = "pandoc";
24
+ private cachedVersion;
25
+ constructor(options: PandocProviderOptions);
26
+ version(): Promise<string | undefined>;
27
+ render(input: RenderDocxInput): Promise<RenderedArtifact>;
28
+ }
29
+ /**
30
+ * Pandoc-driven PDF renderer. The only engine this pipeline enables is Typst,
31
+ * so the provider exists for `pdfMode: "typst"` alone (§14.2); the office route
32
+ * renders DOCX first and converts it with LibreOffice.
33
+ */
34
+ export declare class PandocTypstPdfRenderer implements PdfRenderer {
35
+ private readonly options;
36
+ readonly name = "typst";
37
+ private cachedVersion;
38
+ constructor(options: PandocProviderOptions);
39
+ version(): Promise<string | undefined>;
40
+ render(input: RenderPdfInput): Promise<RenderedArtifact>;
41
+ }
42
+ //# sourceMappingURL=pandoc.d.ts.map
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Hardened child-process runner for document backends (§26.1, §28, §47).
3
+ *
4
+ * Every backend invocation goes through here. The contract mirrors the one the
5
+ * git tools use, because the threat is the same shape — a document is
6
+ * untrusted input and the backend is a powerful external program:
7
+ *
8
+ * - argv array only, built by the provider, never by the model, no shell;
9
+ * - an explicit environment allow-list, so ambient secrets and proxies do not
10
+ * reach the backend;
11
+ * - output is byte-capped and the process is killed when the cap or the
12
+ * timeout hits; a killed run is reported as `timedOut`/`truncated` rather
13
+ * than being confused with a backend that failed on its own;
14
+ * - the caller's abort signal terminates the child and its descendants.
15
+ */
16
+ export interface ProcessOptions {
17
+ readonly cwd?: string;
18
+ readonly timeoutMs: number;
19
+ /** Maximum stdout bytes retained; the process is killed beyond this. */
20
+ readonly maxStdoutBytes: number;
21
+ /** Maximum stderr bytes retained (collection stops, the process continues). */
22
+ readonly maxStderrBytes?: number;
23
+ readonly signal?: AbortSignal;
24
+ /** Extra environment entries layered over the allow-listed base. */
25
+ readonly env?: Readonly<Record<string, string>>;
26
+ /** Test seam: arguments between the program and the provider's own argv. */
27
+ readonly programPrefixArgs?: readonly string[];
28
+ /** Backend name for error reporting. */
29
+ readonly backend: string;
30
+ /** What the invocation is doing, for error messages. */
31
+ readonly context: string;
32
+ }
33
+ export interface ProcessResult {
34
+ readonly stdout: string;
35
+ readonly stderr: string;
36
+ readonly exitCode: number | null;
37
+ readonly truncated: boolean;
38
+ readonly timedOut: boolean;
39
+ }
40
+ /**
41
+ * Ambient variables a document backend legitimately needs. Everything else —
42
+ * API keys, proxy settings, cloud credentials — is withheld: a converter
43
+ * parsing a hostile document should not be able to read the deployment's
44
+ * secrets out of its own environment (§26.5).
45
+ */
46
+ export declare function buildProcessEnv(extra?: Readonly<Record<string, string>>, source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
47
+ export declare function runProcess(program: string, argv: readonly string[], options: ProcessOptions): Promise<ProcessResult>;
48
+ /** Map a finished run that the provider expected to succeed onto an error. */
49
+ export declare function expectProcessOk(result: ProcessResult, options: {
50
+ backend: string;
51
+ context: string;
52
+ fallbackCode: "RENDER_FAILED" | "CONVERSION_FAILED" | "EXTRACTION_FAILED" | "OCR_FAILED";
53
+ }): void;
54
+ //# sourceMappingURL=process.d.ts.map
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Backend registry and selection (§22, §23, §14.3, §45).
3
+ *
4
+ * Tools never import a concrete provider: they ask the registry for the
5
+ * renderer, extractor or converter that fits the request, and the registry
6
+ * decides — from configuration and from what is actually available — which
7
+ * implementation that is. Swapping Docling for another extractor, or Typst for
8
+ * another PDF engine, is a change here and nowhere else.
9
+ */
10
+ import type { ResolvedQaDocumentsConfig } from "../config.js";
11
+ import type { BackendStatus, DocumentConverter, DocumentExtractor, DocumentFormat, ExtractedDocument, ExtractInput, DocxRenderer, PdfMode, PdfRenderer, ExtractionMode } from "../types.js";
12
+ export interface ProviderSeams {
13
+ /** Substituted for the global `fetch` when talking to docling-serve. */
14
+ readonly fetchImpl?: typeof fetch;
15
+ readonly pandoc?: {
16
+ readonly programPrefixArgs?: readonly string[];
17
+ readonly versionProbe?: () => Promise<string | undefined>;
18
+ };
19
+ readonly libreoffice?: {
20
+ readonly programPrefixArgs?: readonly string[];
21
+ readonly versionProbe?: () => Promise<string | undefined>;
22
+ };
23
+ readonly markitdown?: {
24
+ readonly programPrefixArgs?: readonly string[];
25
+ readonly versionProbe?: () => Promise<string | undefined>;
26
+ };
27
+ }
28
+ export interface ProviderSet {
29
+ readonly docx: DocxRenderer;
30
+ readonly typstPdf: PdfRenderer | undefined;
31
+ readonly converter: DocumentConverter;
32
+ readonly docling: DocumentExtractor | undefined;
33
+ readonly doclingHealth: (() => Promise<BackendStatus>) | undefined;
34
+ readonly markitdown: DocumentExtractor | undefined;
35
+ readonly markitdownHealth: (() => Promise<BackendStatus>) | undefined;
36
+ }
37
+ export declare function createProviders(config: ResolvedQaDocumentsConfig, seams?: ProviderSeams): ProviderSet;
38
+ /**
39
+ * The PDF route (§14.3):
40
+ *
41
+ * ```text
42
+ * DOCX + PDF requested → office
43
+ * PDF only, template has Typst → typst
44
+ * otherwise → office
45
+ * ```
46
+ *
47
+ * A deployment that asked for `typst` without enabling the engine is answered
48
+ * with `BACKEND_UNAVAILABLE` instead of silently rendering an office PDF in
49
+ * the wrong layout.
50
+ */
51
+ export declare function selectPdfMode(options: {
52
+ readonly requested: PdfMode;
53
+ readonly formats: readonly ("docx" | "pdf")[];
54
+ readonly templateHasTypst: boolean;
55
+ readonly typstEnabled: boolean;
56
+ }): "office" | "typst";
57
+ export interface ExtractorSelection {
58
+ readonly extractor: DocumentExtractor;
59
+ /** Extractors to try, in order, when the first one is unreachable. */
60
+ readonly fallbacks: readonly DocumentExtractor[];
61
+ }
62
+ export declare function selectExtractor(providers: ProviderSet, config: ResolvedQaDocumentsConfig, mode: ExtractionMode, format: DocumentFormat): ExtractorSelection;
63
+ /** Run the selected extractor, falling back only when it is unreachable. */
64
+ export declare function extractWithFallback(selection: ExtractorSelection, input: ExtractInput): Promise<{
65
+ document: ExtractedDocument;
66
+ fellBackFrom?: string;
67
+ }>;
68
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Shared plumbing of the document providers.
3
+ *
4
+ * Providers report what they wrote through {@link verifyOutput}: a backend
5
+ * that exits 0 but leaves no file behind is a failure, and one that leaves an
6
+ * empty file is a failure too — the caller must never be handed a path that
7
+ * looks like an artifact and is not.
8
+ */
9
+ import type { BackendInfo, DocumentWarning } from "../types.js";
10
+ export type ProviderFailureCode = "RENDER_FAILED" | "CONVERSION_FAILED" | "EXTRACTION_FAILED";
11
+ export interface VerifiedOutput {
12
+ readonly path: string;
13
+ readonly size: number;
14
+ }
15
+ export declare function verifyOutput(outputPath: string, backend: string, code: ProviderFailureCode): Promise<VerifiedOutput>;
16
+ /** `--metadata=key=value` pairs, sanitized of control characters. */
17
+ export declare function metadataArguments(metadata: Readonly<Record<string, string>> | undefined): string[];
18
+ /** First line of a `--version` run, reduced to the version token. */
19
+ export declare function parseVersionOutput(stdout: string, program: string): string | undefined;
20
+ export declare function backendInfo(provider: string, version?: string): BackendInfo;
21
+ /** Read a text output produced by a backend, with a bounded size. */
22
+ export declare function readTextOutput(filePath: string, backend: string, maxBytes: number): Promise<{
23
+ text: string;
24
+ truncated: boolean;
25
+ }>;
26
+ export declare function truncationWarning(backend: string, contentType: string): DocumentWarning;
27
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The runtime facade the tools talk to.
3
+ *
4
+ * One instance lives in the plugin and survives across calls, so the backend
5
+ * registry, the concurrency semaphores and the version caches are shared
6
+ * instead of rebuilt per request. The four operations are the whole surface:
7
+ * everything else in this subsystem is an implementation detail behind them.
8
+ */
9
+ import { type QaDocumentsConfig, type ResolvedQaDocumentsConfig } from "./config.js";
10
+ import { type ProviderSeams, type ProviderSet } from "./providers/registry.js";
11
+ import { type DocumentLogger } from "./orchestrator/runtime-deps.js";
12
+ import { resolveDocumentScope, type DocumentScope } from "./orchestrator/scope.js";
13
+ import type { DocumentCapabilities, DocumentConvertInput, DocumentConvertResult, DocumentCreateInput, DocumentCreateResult, DocumentHealth, DocumentInspectInput, DocumentInspectResult, DocumentToMarkdownInput, DocumentToMarkdownResult } from "./types.js";
14
+ export interface DocumentRuntimeOptions {
15
+ readonly config: ResolvedQaDocumentsConfig;
16
+ readonly logger?: DocumentLogger;
17
+ readonly seams?: ProviderSeams;
18
+ /** Pre-built registry; tests substitute stub backends here. */
19
+ readonly providers?: ProviderSet;
20
+ readonly now?: () => Date;
21
+ }
22
+ export declare class DocumentRuntime {
23
+ readonly config: ResolvedQaDocumentsConfig;
24
+ readonly providers: ProviderSet;
25
+ private readonly deps;
26
+ private readonly seams;
27
+ constructor(options: DocumentRuntimeOptions);
28
+ create(input: DocumentCreateInput, scope: DocumentScope): Promise<DocumentCreateResult>;
29
+ toMarkdown(input: DocumentToMarkdownInput, scope: DocumentScope): Promise<DocumentToMarkdownResult>;
30
+ convert(input: DocumentConvertInput, scope: DocumentScope): Promise<DocumentConvertResult>;
31
+ inspect(input: DocumentInspectInput, scope: DocumentScope): Promise<DocumentInspectResult>;
32
+ health(options?: {
33
+ readonly probeProcessBackends?: boolean;
34
+ }): Promise<DocumentHealth>;
35
+ capabilities(scope?: DocumentScope): Promise<DocumentCapabilities>;
36
+ /** Routes this runtime advertises, in documentation order. */
37
+ routes(): readonly (readonly [string, string])[];
38
+ /**
39
+ * Retention sweep (§41). Meaningful only for a pinned storage root: with the
40
+ * default per-workspace layout the plugin cannot enumerate workspaces, and a
41
+ * sweep that guessed would delete other projects' artifacts.
42
+ */
43
+ cleanup(options?: {
44
+ readonly now?: Date;
45
+ }): Promise<{
46
+ removed: string[];
47
+ } | undefined>;
48
+ }
49
+ /** Build a runtime from raw (schema-parsed) configuration. */
50
+ export declare function createDocumentRuntime(options: {
51
+ readonly config: QaDocumentsConfig;
52
+ readonly env?: NodeJS.ProcessEnv;
53
+ readonly logger?: DocumentLogger;
54
+ readonly seams?: ProviderSeams;
55
+ readonly providers?: ProviderSet;
56
+ readonly now?: () => Date;
57
+ }): DocumentRuntime;
58
+ export { resolveDocumentScope };
59
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * File-type identification and asset MIME policy (§26.3, §26.6, §17.1).
3
+ *
4
+ * The extension is a hint, never the authority: PDF is recognized by its
5
+ * header (after a bounded scan, because a PDF may carry leading junk), OOXML
6
+ * by its ZIP container plus the parts it holds, and macro-enabled documents by
7
+ * the presence of a VBA project. Legacy OLE documents (`.doc`, `.xls`, `.ppt`)
8
+ * are recognized only to be refused with a precise message.
9
+ */
10
+ import type { DetectedFormat, DocumentFormat } from "../types.js";
11
+ export declare const DOCUMENT_MEDIA_TYPES: Readonly<Record<DocumentFormat, string>>;
12
+ export declare function mediaTypeFor(format: DocumentFormat): string;
13
+ export declare function extensionFor(format: DocumentFormat): string;
14
+ export interface SniffedDocument {
15
+ readonly format: DetectedFormat;
16
+ readonly mediaType: string;
17
+ /** The file is a ZIP container holding a Word processing document. */
18
+ readonly wordprocessing?: boolean;
19
+ /** `word/vbaProject.bin` or a macro-enabled content type is present. */
20
+ readonly macroEnabled?: boolean;
21
+ /** Container recognized as OOXML but not a supported document flavour. */
22
+ readonly unsupportedOffice?: boolean;
23
+ }
24
+ export declare function detectFormatByExtension(filename: string): DocumentFormat | undefined;
25
+ /**
26
+ * Identify a document from its bytes, falling back to the extension only where
27
+ * bytes are inconclusive (plain text and Markdown are both just text).
28
+ */
29
+ export declare function sniffDocument(buffer: Buffer, filename?: string): SniffedDocument;
30
+ /** The supported source format behind a sniff result, or `undefined`. */
31
+ export declare function supportedFormatOf(sniffed: SniffedDocument): DocumentFormat | undefined;
32
+ /** Human-facing explanation of a sniff result the pipeline refuses. */
33
+ export declare function describeUnsupported(sniffed: SniffedDocument, filename: string): string;
34
+ export { DEFAULT_ASSET_MIME_TYPES, isAllowedAssetMimeType, mimeTypeForFilename, } from "./mime.js";
35
+ /** Magic-byte MIME detection for the asset types the pipeline accepts. */
36
+ export declare function mimeTypeOfBytes(buffer: Buffer): string | undefined;
37
+ /** A short, sanitized description of the first bytes, for error messages. */
38
+ export declare function describeBytes(buffer: Buffer): string;
39
+ //# sourceMappingURL=file-types.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Resource limits and concurrency control (§26.4, §27).
3
+ *
4
+ * Every expensive stage (render, extraction, OCR) runs behind a semaphore so a
5
+ * burst of documents cannot exhaust the host, and every size/count budget is
6
+ * checked before the work starts rather than after a backend has already spent
7
+ * minutes on it.
8
+ */
9
+ export declare function assertBytesWithinBudget(bytes: number, maxBytes: number, label: string): void;
10
+ export declare function assertCharsWithinBudget(chars: number, maxChars: number, label: string): void;
11
+ export declare function assertCountWithinBudget(count: number, maxCount: number, label: string): void;
12
+ export interface Semaphore {
13
+ /** Resolve with the release function once a slot is free. */
14
+ acquire(signal?: AbortSignal): Promise<() => void>;
15
+ readonly limit: number;
16
+ /** Slots in use right now (tests and health output). */
17
+ readonly inUse: number;
18
+ }
19
+ /**
20
+ * Counting semaphore with FIFO fairness. An aborted waiter leaves the queue
21
+ * without consuming a slot, so a stopped turn never leaks capacity.
22
+ */
23
+ export declare function createSemaphore(limit: number): Semaphore;
24
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * MIME policy for document assets (§17.1).
3
+ *
4
+ * Kept free of Node builtins on purpose: the QA settings schema reaches this
5
+ * module from the browser bundle, so anything imported here also has to run in
6
+ * a page. The byte sniffing stays with the pipeline's file-type module, which
7
+ * may import whatever it needs.
8
+ */
9
+ /** Asset MIME types accepted by default. */
10
+ export declare const DEFAULT_ASSET_MIME_TYPES: readonly string[];
11
+ export declare function mimeTypeForFilename(filename: string): string | undefined;
12
+ export declare function isAllowedAssetMimeType(mimeType: string, allowed: readonly string[]): boolean;
13
+ //# sourceMappingURL=mime.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Path containment and filename hygiene (§26.2, §32).
3
+ *
4
+ * Two rules hold everywhere in the pipeline:
5
+ *
6
+ * - every path the pipeline touches is resolved against an allowed root and
7
+ * the resolution must stay inside it — traversal, absolute escapes and
8
+ * `file://` references are refused before anything is opened;
9
+ * - a caller-supplied filename is a label, never a path: directories are
10
+ * dropped, separators and reserved characters collapse to `-`, and the
11
+ * extension is the one the operation itself chose.
12
+ */
13
+ /** Whether `target` is `root` or a descendant of it (no symlink resolution). */
14
+ export declare function isInsideRoot(root: string, target: string): boolean;
15
+ export declare function assertInsideRoot(root: string, target: string, label: string): string;
16
+ /**
17
+ * Canonicalize a path for containment checks: the existing prefix is resolved
18
+ * through symlinks, the non-existent remainder is appended unresolved. A
19
+ * symlink pointing outside the root therefore canonicalizes outside it.
20
+ */
21
+ export declare function canonicalizeForContainment(input: string): Promise<string>;
22
+ /** Resolve a caller-supplied path against `root`, refusing any escape. */
23
+ export declare function resolveInsideRoot(root: string, requested: string, label: string): Promise<string>;
24
+ /**
25
+ * Turn a caller-supplied filename into a safe file name (§32).
26
+ * `../../foo report?.docx` becomes `foo-report.docx`.
27
+ */
28
+ export declare function sanitizeFilename(requested: string | undefined, fallbackStem: string, extension: string): string;
29
+ /** `file:///...` form required by `-env:UserInstallation` and friends. */
30
+ export declare function toFileUri(target: string): string;
31
+ /**
32
+ * Assert an asset reference inside Markdown targets the assets directory and
33
+ * nothing else: no absolute paths, no URLs, no traversal (§17.1).
34
+ */
35
+ export declare function assertRelativeAssetReference(reference: string): string;
36
+ /** Recursively-size snapshot helper used by the limits guard. */
37
+ export declare function assertNotBlank(value: string, label: string): string;
38
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Template registry (§12.2).
3
+ *
4
+ * A deployment describes its templates in a `manifest.yml` beside the
5
+ * template files:
6
+ *
7
+ * ```yaml
8
+ * templates:
9
+ * default:
10
+ * docx: ./docx/default.docx
11
+ * qa-report:
12
+ * docx: ./docx/qa-report.docx
13
+ * typst: ./typst/qa-report
14
+ * ```
15
+ *
16
+ * Every declared path is resolved against the template root and must stay
17
+ * inside it: a registry file is operator input, but it is read from the
18
+ * workspace, so it gets the same containment treatment as everything else
19
+ * (§26.2).
20
+ */
21
+ import type { DocumentWarning } from "../types.js";
22
+ export declare const TEMPLATE_MANIFEST_FILE = "manifest.yml";
23
+ export interface DocumentTemplate {
24
+ readonly name: string;
25
+ /** Absolute path of the reference DOCX, when the template declares one. */
26
+ readonly docx?: string;
27
+ /** Absolute path of the Typst template directory, when it declares one. */
28
+ readonly typst?: string;
29
+ }
30
+ export interface TemplateRegistry {
31
+ /** Absolute template root, when the workspace provides one. */
32
+ readonly root?: string;
33
+ readonly templates: ReadonlyMap<string, DocumentTemplate>;
34
+ readonly warnings: readonly DocumentWarning[];
35
+ }
36
+ /** The template name that always resolves, with or without a registry. */
37
+ export declare const BUILTIN_TEMPLATE_NAME = "default";
38
+ /** Located registry file inside a candidate root. */
39
+ export declare function findTemplateManifest(root: string): Promise<string | undefined>;
40
+ /**
41
+ * Load a registry from a template root. A missing root, a missing manifest or
42
+ * an unreadable document all leave the builtin default in place and report a
43
+ * warning — a broken template directory must not stop the agent from writing a
44
+ * plain document, but it must not be silent either.
45
+ */
46
+ export declare function loadTemplateRegistry(root: string | undefined): Promise<TemplateRegistry>;
47
+ export declare function templateNames(registry: TemplateRegistry): string[];
48
+ /** Load a registry from a candidate root, defaulting to a file-system probe. */
49
+ export declare function loadTemplateRegistryFrom(roots: readonly (string | undefined)[], probe: (candidate: string) => Promise<boolean>): Promise<TemplateRegistry>;
50
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Template resolution (§12.3).
3
+ *
4
+ * ```text
5
+ * requested template
6
+ * ↓ (absent)
7
+ * project default
8
+ * ↓ (absent)
9
+ * builtin default
10
+ * ```
11
+ *
12
+ * A requested template that does not exist is an error, never a silent
13
+ * fallback: a report rendered in the wrong corporate layout is worse than a
14
+ * failed call the operator can read. The builtin `default` name resolves
15
+ * without a registry entry — it means "the document backend's own defaults".
16
+ */
17
+ import type { DocumentWarning } from "../types.js";
18
+ import { type DocumentTemplate, type TemplateRegistry } from "./registry.js";
19
+ export interface ResolvedTemplate {
20
+ readonly name: string;
21
+ readonly template?: DocumentTemplate;
22
+ /** How the effective name was chosen. */
23
+ readonly source: "requested" | "project-default" | "builtin";
24
+ }
25
+ export interface TemplateResolution {
26
+ readonly resolved: ResolvedTemplate;
27
+ readonly warnings: readonly DocumentWarning[];
28
+ }
29
+ export declare function resolveTemplate(registry: TemplateRegistry, requested: string | undefined, projectDefault: string): TemplateResolution;
30
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `document_convert` — one supported format to another (§10, §34).
3
+ */
4
+ import type { DocumentRuntime } from "../runtime.js";
5
+ export declare const DOCUMENT_CONVERT_TOOL = "document_convert";
6
+ export declare function createDocumentConvertTool(options: {
7
+ readonly runtime: DocumentRuntime;
8
+ }): import("@deepseek-ai/dsh-tools").ToolDefinition;
9
+ //# sourceMappingURL=convert.d.ts.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `document_create` — Markdown to DOCX and/or PDF (§8, §34).
3
+ *
4
+ * This is the tool the agent reaches for instead of driving pandoc and
5
+ * LibreOffice itself, which is the whole point of the pipeline: the intent is
6
+ * "give me this report as a Word file and a PDF", and the service decides how
7
+ * that happens.
8
+ */
9
+ import type { DocumentRuntime } from "../runtime.js";
10
+ export declare const DOCUMENT_CREATE_TOOL = "document_create";
11
+ export declare function createDocumentCreateTool(options: {
12
+ readonly runtime: DocumentRuntime;
13
+ }): import("@deepseek-ai/dsh-tools").ToolDefinition;
14
+ //# sourceMappingURL=create.d.ts.map