@yadsh/dsh-qa-surface 0.6.1 → 0.7.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 (287) hide show
  1. package/README.md +163 -7
  2. package/capability-policy.json +1 -1
  3. package/lib/access/capability-catalog.js +144 -0
  4. package/lib/access/capability-catalog.js.map +1 -0
  5. package/lib/access/model.js +379 -0
  6. package/lib/access/model.js.map +1 -0
  7. package/lib/access/role-repository.js +195 -0
  8. package/lib/access/role-repository.js.map +1 -0
  9. package/lib/access/service.js +380 -0
  10. package/lib/access/service.js.map +1 -0
  11. package/lib/access/skill-metadata.js +234 -0
  12. package/lib/access/skill-metadata.js.map +1 -0
  13. package/lib/account-remotes.js +20 -10
  14. package/lib/account-remotes.js.map +1 -1
  15. package/lib/accounts/errors.js.map +1 -1
  16. package/lib/accounts/file.js.map +1 -1
  17. package/lib/accounts/store.js +202 -3
  18. package/lib/accounts/store.js.map +1 -1
  19. package/lib/admin/conversation-log.js +256 -0
  20. package/lib/admin/conversation-log.js.map +1 -0
  21. package/lib/admin/index.js +17 -0
  22. package/lib/admin/index.js.map +1 -0
  23. package/lib/admin/metrics.js +103 -0
  24. package/lib/admin/metrics.js.map +1 -0
  25. package/lib/admin/paging.js +23 -0
  26. package/lib/admin/paging.js.map +1 -0
  27. package/lib/admin/permissions.js +50 -0
  28. package/lib/admin/permissions.js.map +1 -0
  29. package/lib/admin/quality-store.js +485 -0
  30. package/lib/admin/quality-store.js.map +1 -0
  31. package/lib/admin/queue.js +107 -0
  32. package/lib/admin/queue.js.map +1 -0
  33. package/lib/admin/redaction.js +45 -0
  34. package/lib/admin/redaction.js.map +1 -0
  35. package/lib/admin/service.js +897 -0
  36. package/lib/admin/service.js.map +1 -0
  37. package/lib/admin/session-log.js +142 -0
  38. package/lib/admin/session-log.js.map +1 -0
  39. package/lib/cli.js +9 -6
  40. package/lib/cli.js.map +1 -1
  41. package/lib/client/QaSessionController.js +28 -2
  42. package/lib/client/QaSessionController.js.map +1 -1
  43. package/lib/client/QaSurface.js +143 -5
  44. package/lib/client/QaSurface.js.map +1 -1
  45. package/lib/client/QaTranscriptAdapter.js +1 -0
  46. package/lib/client/QaTranscriptAdapter.js.map +1 -1
  47. package/lib/client/admin/QaAdmin.js +458 -0
  48. package/lib/client/admin/QaAdmin.js.map +1 -0
  49. package/lib/client/admin/format.js +177 -0
  50. package/lib/client/admin/format.js.map +1 -0
  51. package/lib/client/admin/pages/Conversations.js +114 -0
  52. package/lib/client/admin/pages/Conversations.js.map +1 -0
  53. package/lib/client/admin/pages/Overview.js +24 -0
  54. package/lib/client/admin/pages/Overview.js.map +1 -0
  55. package/lib/client/admin/pages/Quality.js +71 -0
  56. package/lib/client/admin/pages/Quality.js.map +1 -0
  57. package/lib/client/admin/pages/Review.js +93 -0
  58. package/lib/client/admin/pages/Review.js.map +1 -0
  59. package/lib/client/admin/pages/Users.js +95 -0
  60. package/lib/client/admin/pages/Users.js.map +1 -0
  61. package/lib/client/admin/routes.js +143 -0
  62. package/lib/client/admin/routes.js.map +1 -0
  63. package/lib/client/admin/shared.js +91 -0
  64. package/lib/client/admin/shared.js.map +1 -0
  65. package/lib/client/admin/styles.js +111 -0
  66. package/lib/client/admin/styles.js.map +1 -0
  67. package/lib/client/components/QaChangelog.js +53 -0
  68. package/lib/client/components/QaChangelog.js.map +1 -1
  69. package/lib/client/components/QaHeader.js +3 -3
  70. package/lib/client/components/QaHeader.js.map +1 -1
  71. package/lib/client/components/QaMessage.js +61 -2
  72. package/lib/client/components/QaMessage.js.map +1 -1
  73. package/lib/client/create-session.js +1 -1
  74. package/lib/client/create-session.js.map +1 -1
  75. package/lib/client/index.js +48 -1
  76. package/lib/client/index.js.map +1 -1
  77. package/lib/client/role/RoleSelector.js +31 -0
  78. package/lib/client/role/RoleSelector.js.map +1 -0
  79. package/lib/client/session-sources.js +37 -1
  80. package/lib/client/session-sources.js.map +1 -1
  81. package/lib/client/settings/card.js +2 -2
  82. package/lib/client/settings/card.js.map +1 -1
  83. package/lib/client/settings/sections.js +0 -1
  84. package/lib/client/settings/sections.js.map +1 -1
  85. package/lib/client/settings-extensions/index.js +1 -0
  86. package/lib/client/settings-extensions/index.js.map +1 -1
  87. package/lib/client/settings-extensions/user-session.js +62 -0
  88. package/lib/client/settings-extensions/user-session.js.map +1 -0
  89. package/lib/client/styles.js +31 -0
  90. package/lib/client/styles.js.map +1 -1
  91. package/lib/client/types.js.map +1 -1
  92. package/lib/client.js +9993 -4848
  93. package/lib/client.js.map +1 -1
  94. package/lib/config-resolvers/defaults.js +0 -2
  95. package/lib/config-resolvers/defaults.js.map +1 -1
  96. package/lib/config.js +0 -249
  97. package/lib/config.js.map +1 -1
  98. package/lib/enforcement/skill-policy.js +172 -0
  99. package/lib/enforcement/skill-policy.js.map +1 -0
  100. package/lib/enforcement/tool-grants.js +151 -0
  101. package/lib/enforcement/tool-grants.js.map +1 -0
  102. package/lib/index.js +224 -42
  103. package/lib/index.js.map +1 -1
  104. package/lib/personal-skills/service.js +10 -3
  105. package/lib/personal-skills/service.js.map +1 -1
  106. package/lib/qa-tools/index.js +4 -0
  107. package/lib/qa-tools/index.js.map +1 -1
  108. package/lib/resolve-config.js +0 -2
  109. package/lib/resolve-config.js.map +1 -1
  110. package/lib/secure-session.js +71 -17
  111. package/lib/secure-session.js.map +1 -1
  112. package/lib/typert.host.js +2237 -202
  113. package/lib/typert.remote-client.d.ts +49 -3
  114. package/lib/typert.remote-client.js +1863 -183
  115. package/lib/types/access/capability-catalog.d.ts +37 -0
  116. package/lib/types/access/model.d.ts +60 -0
  117. package/lib/types/access/role-repository.d.ts +32 -0
  118. package/lib/types/access/service.d.ts +57 -0
  119. package/lib/types/access/skill-metadata.d.ts +53 -0
  120. package/lib/types/account-remotes.d.ts +6 -0
  121. package/lib/types/accounts/errors.d.ts +1 -1
  122. package/lib/types/accounts/file.d.ts +16 -5
  123. package/lib/types/accounts/store.d.ts +83 -3
  124. package/lib/types/admin/conversation-log.d.ts +39 -0
  125. package/lib/types/admin/index.d.ts +24 -0
  126. package/lib/types/admin/metrics.d.ts +29 -0
  127. package/lib/types/admin/paging.d.ts +33 -0
  128. package/lib/types/admin/permissions.d.ts +10 -0
  129. package/lib/types/admin/quality-store.d.ts +82 -0
  130. package/lib/types/admin/queue.d.ts +21 -0
  131. package/lib/types/admin/redaction.d.ts +29 -0
  132. package/lib/types/admin/service.d.ts +105 -0
  133. package/lib/types/admin/session-log.d.ts +53 -0
  134. package/lib/types/client/QaSessionController.d.ts +12 -1
  135. package/lib/types/client/QaSurface.d.ts +7 -1
  136. package/lib/types/client/admin/QaAdmin.d.ts +17 -0
  137. package/lib/types/client/admin/format.d.ts +43 -0
  138. package/lib/types/client/admin/pages/Conversations.d.ts +21 -0
  139. package/lib/types/client/admin/pages/Overview.d.ts +13 -0
  140. package/lib/types/client/admin/pages/Quality.d.ts +18 -0
  141. package/lib/types/client/admin/pages/Review.d.ts +15 -0
  142. package/lib/types/client/admin/pages/Users.d.ts +22 -0
  143. package/lib/types/client/admin/routes.d.ts +60 -0
  144. package/lib/types/client/admin/shared.d.ts +53 -0
  145. package/lib/types/client/admin/styles.d.ts +11 -0
  146. package/lib/types/client/components/QaHeader.d.ts +5 -1
  147. package/lib/types/client/components/QaMessage.d.ts +14 -1
  148. package/lib/types/client/create-session.d.ts +2 -0
  149. package/lib/types/client/role/RoleSelector.d.ts +14 -0
  150. package/lib/types/client/session-sources.d.ts +9 -0
  151. package/lib/types/client/settings/sections.d.ts +0 -1
  152. package/lib/types/client/settings-extensions/index.d.ts +2 -0
  153. package/lib/types/client/settings-extensions/user-session.d.ts +59 -0
  154. package/lib/types/client/types.d.ts +39 -2
  155. package/lib/types/enforcement/skill-policy.d.ts +29 -0
  156. package/lib/types/enforcement/tool-grants.d.ts +84 -0
  157. package/lib/types/index.d.ts +62 -14
  158. package/lib/types/qa-tools/index.d.ts +2 -0
  159. package/lib/types/secure-session.d.ts +10 -1
  160. package/lib/types/types.d.ts +568 -5
  161. package/package.json +2 -2
  162. package/lib/client/settings/sections/documents.js +0 -88
  163. package/lib/client/settings/sections/documents.js.map +0 -1
  164. package/lib/documents/artifacts/ids.js +0 -43
  165. package/lib/documents/artifacts/ids.js.map +0 -1
  166. package/lib/documents/artifacts/manifest.js +0 -66
  167. package/lib/documents/artifacts/manifest.js.map +0 -1
  168. package/lib/documents/artifacts/store.js +0 -169
  169. package/lib/documents/artifacts/store.js.map +0 -1
  170. package/lib/documents/capabilities.js +0 -93
  171. package/lib/documents/capabilities.js.map +0 -1
  172. package/lib/documents/config.js +0 -302
  173. package/lib/documents/config.js.map +0 -1
  174. package/lib/documents/defaults.js +0 -78
  175. package/lib/documents/defaults.js.map +0 -1
  176. package/lib/documents/errors.js +0 -101
  177. package/lib/documents/errors.js.map +0 -1
  178. package/lib/documents/index.js +0 -80
  179. package/lib/documents/index.js.map +0 -1
  180. package/lib/documents/inspect/facts.js +0 -161
  181. package/lib/documents/inspect/facts.js.map +0 -1
  182. package/lib/documents/inspect/zip.js +0 -108
  183. package/lib/documents/inspect/zip.js.map +0 -1
  184. package/lib/documents/markdown/directives.js +0 -135
  185. package/lib/documents/markdown/directives.js.map +0 -1
  186. package/lib/documents/markdown/frontmatter.js +0 -35
  187. package/lib/documents/markdown/frontmatter.js.map +0 -1
  188. package/lib/documents/markdown/normalize.js +0 -113
  189. package/lib/documents/markdown/normalize.js.map +0 -1
  190. package/lib/documents/orchestrator/assets.js +0 -243
  191. package/lib/documents/orchestrator/assets.js.map +0 -1
  192. package/lib/documents/orchestrator/convert-document.js +0 -186
  193. package/lib/documents/orchestrator/convert-document.js.map +0 -1
  194. package/lib/documents/orchestrator/create-document.js +0 -292
  195. package/lib/documents/orchestrator/create-document.js.map +0 -1
  196. package/lib/documents/orchestrator/extract-document.js +0 -162
  197. package/lib/documents/orchestrator/extract-document.js.map +0 -1
  198. package/lib/documents/orchestrator/inspect-document.js +0 -89
  199. package/lib/documents/orchestrator/inspect-document.js.map +0 -1
  200. package/lib/documents/orchestrator/runtime-deps.js +0 -59
  201. package/lib/documents/orchestrator/runtime-deps.js.map +0 -1
  202. package/lib/documents/orchestrator/scope.js +0 -132
  203. package/lib/documents/orchestrator/scope.js.map +0 -1
  204. package/lib/documents/providers/docling.js +0 -247
  205. package/lib/documents/providers/docling.js.map +0 -1
  206. package/lib/documents/providers/libreoffice.js +0 -130
  207. package/lib/documents/providers/libreoffice.js.map +0 -1
  208. package/lib/documents/providers/markitdown.js +0 -89
  209. package/lib/documents/providers/markitdown.js.map +0 -1
  210. package/lib/documents/providers/pandoc.js +0 -161
  211. package/lib/documents/providers/pandoc.js.map +0 -1
  212. package/lib/documents/providers/process.js +0 -164
  213. package/lib/documents/providers/process.js.map +0 -1
  214. package/lib/documents/providers/registry.js +0 -152
  215. package/lib/documents/providers/registry.js.map +0 -1
  216. package/lib/documents/providers/shared.js +0 -75
  217. package/lib/documents/providers/shared.js.map +0 -1
  218. package/lib/documents/runtime.js +0 -114
  219. package/lib/documents/runtime.js.map +0 -1
  220. package/lib/documents/security/file-types.js +0 -188
  221. package/lib/documents/security/file-types.js.map +0 -1
  222. package/lib/documents/security/limits.js +0 -78
  223. package/lib/documents/security/limits.js.map +0 -1
  224. package/lib/documents/security/mime.js +0 -43
  225. package/lib/documents/security/mime.js.map +0 -1
  226. package/lib/documents/security/paths.js +0 -133
  227. package/lib/documents/security/paths.js.map +0 -1
  228. package/lib/documents/templates/registry.js +0 -147
  229. package/lib/documents/templates/registry.js.map +0 -1
  230. package/lib/documents/templates/resolver.js +0 -59
  231. package/lib/documents/templates/resolver.js.map +0 -1
  232. package/lib/documents/tools/convert.js +0 -125
  233. package/lib/documents/tools/convert.js.map +0 -1
  234. package/lib/documents/tools/create.js +0 -187
  235. package/lib/documents/tools/create.js.map +0 -1
  236. package/lib/documents/tools/index.js +0 -41
  237. package/lib/documents/tools/index.js.map +0 -1
  238. package/lib/documents/tools/inspect.js +0 -135
  239. package/lib/documents/tools/inspect.js.map +0 -1
  240. package/lib/documents/tools/shared.js +0 -88
  241. package/lib/documents/tools/shared.js.map +0 -1
  242. package/lib/documents/tools/to-markdown.js +0 -125
  243. package/lib/documents/tools/to-markdown.js.map +0 -1
  244. package/lib/documents/types.js +0 -12
  245. package/lib/documents/types.js.map +0 -1
  246. package/lib/types/client/settings/sections/documents.d.ts +0 -13
  247. package/lib/types/documents/artifacts/ids.d.ts +0 -14
  248. package/lib/types/documents/artifacts/manifest.d.ts +0 -32
  249. package/lib/types/documents/artifacts/store.d.ts +0 -67
  250. package/lib/types/documents/capabilities.d.ts +0 -32
  251. package/lib/types/documents/config.d.ts +0 -27
  252. package/lib/types/documents/defaults.d.ts +0 -161
  253. package/lib/types/documents/errors.d.ts +0 -42
  254. package/lib/types/documents/index.d.ts +0 -63
  255. package/lib/types/documents/inspect/facts.d.ts +0 -43
  256. package/lib/types/documents/inspect/zip.d.ts +0 -28
  257. package/lib/types/documents/markdown/directives.d.ts +0 -39
  258. package/lib/types/documents/markdown/frontmatter.d.ts +0 -15
  259. package/lib/types/documents/markdown/normalize.d.ts +0 -30
  260. package/lib/types/documents/orchestrator/assets.d.ts +0 -55
  261. package/lib/types/documents/orchestrator/convert-document.d.ts +0 -25
  262. package/lib/types/documents/orchestrator/create-document.d.ts +0 -18
  263. package/lib/types/documents/orchestrator/extract-document.d.ts +0 -24
  264. package/lib/types/documents/orchestrator/inspect-document.d.ts +0 -12
  265. package/lib/types/documents/orchestrator/runtime-deps.d.ts +0 -43
  266. package/lib/types/documents/orchestrator/scope.d.ts +0 -52
  267. package/lib/types/documents/providers/docling.d.ts +0 -54
  268. package/lib/types/documents/providers/libreoffice.d.ts +0 -40
  269. package/lib/types/documents/providers/markitdown.d.ts +0 -28
  270. package/lib/types/documents/providers/pandoc.d.ts +0 -42
  271. package/lib/types/documents/providers/process.d.ts +0 -54
  272. package/lib/types/documents/providers/registry.d.ts +0 -68
  273. package/lib/types/documents/providers/shared.d.ts +0 -27
  274. package/lib/types/documents/runtime.d.ts +0 -59
  275. package/lib/types/documents/security/file-types.d.ts +0 -39
  276. package/lib/types/documents/security/limits.d.ts +0 -24
  277. package/lib/types/documents/security/mime.d.ts +0 -13
  278. package/lib/types/documents/security/paths.d.ts +0 -38
  279. package/lib/types/documents/templates/registry.d.ts +0 -50
  280. package/lib/types/documents/templates/resolver.d.ts +0 -30
  281. package/lib/types/documents/tools/convert.d.ts +0 -9
  282. package/lib/types/documents/tools/create.d.ts +0 -14
  283. package/lib/types/documents/tools/index.d.ts +0 -33
  284. package/lib/types/documents/tools/inspect.d.ts +0 -9
  285. package/lib/types/documents/tools/shared.d.ts +0 -77
  286. package/lib/types/documents/tools/to-markdown.d.ts +0 -12
  287. package/lib/types/documents/types.d.ts +0 -294
@@ -1,135 +0,0 @@
1
- /**
2
- * `document_inspect` — what a document is, without converting it (§11, §34).
3
- */
4
- import { defineTool } from "@deepseek-ai/dsh-tools";
5
- import { fileParameter, formatBytes, renderWarning, requireDocumentScope, toolWarnings, warningsSchema, } from "./shared.js";
6
- export const DOCUMENT_INSPECT_TOOL = "document_inspect";
7
- const DESCRIPTION = [
8
- "Inspect document type, metadata and basic structure without converting it.",
9
- "Reports the detected format, size, hash, document properties, page/heading/table/image counts and whether the file is encrypted or macro-enabled.",
10
- ].join(" ");
11
- function structureLines(value) {
12
- const structure = value.structure;
13
- if (structure === undefined)
14
- return [];
15
- return Object.entries(structure)
16
- .filter(([, count]) => typeof count === "number")
17
- .map(([name, count]) => `${name}: ${String(count)}`);
18
- }
19
- export function createDocumentInspectTool(options) {
20
- return defineTool({
21
- name: DOCUMENT_INSPECT_TOOL,
22
- description: DESCRIPTION,
23
- parameters: { file: fileParameter() },
24
- output: {
25
- schema: {
26
- type: "object",
27
- additionalProperties: false,
28
- properties: {
29
- filename: { type: "string", required: true },
30
- format: { type: "string", required: true },
31
- mediaType: { type: "string", required: true },
32
- size: { type: "number", required: true },
33
- sha256: { type: "string", required: true },
34
- metadata: {
35
- type: "object",
36
- additionalProperties: false,
37
- properties: {
38
- title: { type: "string" },
39
- author: { type: "string" },
40
- createdAt: { type: "string" },
41
- modifiedAt: { type: "string" },
42
- },
43
- },
44
- structure: {
45
- type: "object",
46
- additionalProperties: false,
47
- properties: {
48
- pages: { type: "number" },
49
- headings: { type: "number" },
50
- tables: { type: "number" },
51
- images: { type: "number" },
52
- },
53
- },
54
- encrypted: { type: "boolean" },
55
- macroEnabled: { type: "boolean" },
56
- warnings: warningsSchema,
57
- },
58
- },
59
- render: (_args, value) => {
60
- const result = value;
61
- return [
62
- {
63
- type: "text",
64
- text: [
65
- `${result.filename}: ${result.format} (${result.mediaType})`,
66
- `size: ${formatBytes(result.size)}, sha256: ${result.sha256}`,
67
- ...(result.encrypted === true ? ["encrypted: yes"] : []),
68
- ...(result.macroEnabled === true ? ["macro-enabled: yes"] : []),
69
- ...(result.metadata === undefined
70
- ? []
71
- : Object.entries(result.metadata).map(([key, entry]) => `${key}: ${entry}`)),
72
- ...structureLines(result),
73
- ...result.warnings.map(renderWarning),
74
- ].join("\n"),
75
- },
76
- ];
77
- },
78
- },
79
- timeoutMs: 30_000,
80
- async execute(args, exec) {
81
- const result = await options.runtime.inspect(args, requireDocumentScope(exec));
82
- return {
83
- filename: result.filename,
84
- format: result.format,
85
- mediaType: result.mediaType,
86
- size: result.size,
87
- sha256: result.sha256,
88
- ...(result.metadata === undefined
89
- ? {}
90
- : {
91
- metadata: {
92
- ...(result.metadata.title === undefined
93
- ? {}
94
- : { title: result.metadata.title }),
95
- ...(result.metadata.author === undefined
96
- ? {}
97
- : { author: result.metadata.author }),
98
- ...(result.metadata.createdAt === undefined
99
- ? {}
100
- : { createdAt: result.metadata.createdAt }),
101
- ...(result.metadata.modifiedAt === undefined
102
- ? {}
103
- : { modifiedAt: result.metadata.modifiedAt }),
104
- },
105
- }),
106
- ...(result.structure === undefined
107
- ? {}
108
- : {
109
- structure: {
110
- ...(result.structure.pages === undefined
111
- ? {}
112
- : { pages: result.structure.pages }),
113
- ...(result.structure.headings === undefined
114
- ? {}
115
- : { headings: result.structure.headings }),
116
- ...(result.structure.tables === undefined
117
- ? {}
118
- : { tables: result.structure.tables }),
119
- ...(result.structure.images === undefined
120
- ? {}
121
- : { images: result.structure.images }),
122
- },
123
- }),
124
- ...(result.encrypted === undefined
125
- ? {}
126
- : { encrypted: result.encrypted }),
127
- ...(result.macroEnabled === undefined
128
- ? {}
129
- : { macroEnabled: result.macroEnabled }),
130
- warnings: toolWarnings(result.warnings),
131
- };
132
- },
133
- });
134
- }
135
- //# sourceMappingURL=inspect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../../src/documents/tools/inspect.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD,OAAO,EACL,aAAa,EACb,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,YAAY,EAEZ,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAExD,MAAM,WAAW,GAAG;IAClB,4EAA4E;IAC5E,mJAAmJ;CACpJ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,SAAS,cAAc,CAAC,KAA4B;IAClD,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IAClC,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACvC,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;SAC7B,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;SAChD,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,OAEzC;IACC,OAAO,UAAU,CAAC;QAChB,IA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AK,KAAK,SAAS;gCACtC,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;4BACtC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,KAAK,SAAS;gCACzC,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;4BAC5C,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,KAAK,SAAS;gCACvC,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;4BACxC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,KAAK,SAAS;gCACvC,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;yBACzC;qBACF,CAAC;gBACN,GAAG,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS;oBAChC,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;gBACpC,GAAG,CAAC,MAAM,CAAC,YAAY,KAAK,SAAS;oBACnC,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;gBAC1C,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;aACxC,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,88 +0,0 @@
1
- /**
2
- * What the four document tools share: the calling session's scope, the output
3
- * shapes they render, and the warning formatter.
4
- *
5
- * A tool is a thin adapter. It reads the session's working directory (the
6
- * artifact root and the allowed input roots both derive from it), hands intent
7
- * to the runtime, and renders the structured result for the model. No tool
8
- * knows a backend name beyond the one the result reports.
9
- */
10
- import { DocumentError } from "../errors.js";
11
- export function toolWarnings(warnings) {
12
- return warnings.map((warning) => ({
13
- code: warning.code,
14
- message: warning.message,
15
- ...(warning.backend === undefined ? {} : { backend: warning.backend }),
16
- }));
17
- }
18
- /** Shared output-schema fragment for the `warnings` array of every tool. */
19
- export const warningsSchema = {
20
- type: "array",
21
- items: {
22
- type: "object",
23
- additionalProperties: false,
24
- properties: {
25
- code: { type: "string", required: true },
26
- message: { type: "string", required: true },
27
- backend: { type: "string" },
28
- },
29
- },
30
- };
31
- /** Mutable projection of a produced file for the tool result. */
32
- export function toolFiles(files) {
33
- return files.map((file) => ({
34
- format: file.format,
35
- path: file.path,
36
- mediaType: file.mediaType,
37
- size: file.size,
38
- sha256: file.sha256,
39
- status: file.status,
40
- ...(file.error === undefined ? {} : { error: file.error }),
41
- }));
42
- }
43
- /**
44
- * Resolve the session scope, failing closed: a session without a working
45
- * directory gets no document access rather than the host process's cwd.
46
- */ export function requireDocumentScope(exec) {
47
- const header = exec.agent?.session.header;
48
- const cwd = header?.cwd;
49
- if (typeof cwd !== "string" || cwd.trim() === "") {
50
- throw new DocumentError("INVALID_INPUT", "this tool requires a calling session with a working directory");
51
- }
52
- const sessionId = header?.id === undefined ? undefined : String(header.id);
53
- return {
54
- workspaceRoot: cwd,
55
- ...(sessionId === undefined ? {} : { sessionId }),
56
- ...(exec.signal === undefined ? {} : { signal: exec.signal }),
57
- };
58
- }
59
- export function fileParameter() {
60
- return {
61
- type: "string",
62
- required: true,
63
- description: "Path to the document. Relative paths start at the session working directory and must " +
64
- "stay inside it or a configured document root.",
65
- };
66
- }
67
- export function formatBytes(bytes) {
68
- if (bytes < 1024)
69
- return `${bytes} B`;
70
- if (bytes < 1024 * 1024)
71
- return `${(bytes / 1024).toFixed(1)} KiB`;
72
- return `${(bytes / (1024 * 1024)).toFixed(1)} MiB`;
73
- }
74
- export function renderWarning(warning) {
75
- const backend = warning.backend === undefined ? "" : ` [${warning.backend}]`;
76
- return `warning ${warning.code}${backend}: ${warning.message}`;
77
- }
78
- /** One line per produced file, plus failed formats explicitly named. */
79
- export function renderFiles(files) {
80
- return files.map((file) => {
81
- if (file.status === "failed") {
82
- return `${file.format}: failed (${file.error ?? "unknown error"})`;
83
- }
84
- return `${file.format}: ${file.path} (${formatBytes(file.size)}, sha256 ${file.sha256.slice(0, 16)}…)`;
85
- });
86
- }
87
- export const ARTIFACT_NOTE = "The artifact directory keeps the source, the assets and manifest.json beside the outputs.";
88
- //# sourceMappingURL=shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/documents/tools/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAe7C,MAAM,UAAU,YAAY,CAC1B,QAAoC;IAEpC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAChC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;KACvE,CAAC,CAAC,CAAC;AACN,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YACxC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC3C,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC5B;KACF;CACwB,CAAC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C,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;IACzG,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GACxB,2FAA2F,CAAC"}
@@ -1,125 +0,0 @@
1
- /**
2
- * `document_to_markdown` — DOCX/PDF to Markdown (§9, §34).
3
- *
4
- * The model gets the extracted text and a path to the full copy; the artifact
5
- * bundle keeps the input, the extracted Markdown and any extracted images.
6
- */
7
- import { defineTool } from "@deepseek-ai/dsh-tools";
8
- import { fileParameter, renderWarning, requireDocumentScope, toolWarnings, warningsSchema, } from "./shared.js";
9
- export const DOCUMENT_TO_MARKDOWN_TOOL = "document_to_markdown";
10
- const DESCRIPTION = [
11
- "Extract a DOCX or PDF into Markdown.",
12
- "Supports structured extraction, tables and images, and applies OCR when the document has no text layer.",
13
- "Returns the Markdown plus the path of the extracted file inside its artifact bundle.",
14
- ].join(" ");
15
- export function createDocumentToMarkdownTool(options) {
16
- return defineTool({
17
- name: DOCUMENT_TO_MARKDOWN_TOOL,
18
- description: DESCRIPTION,
19
- parameters: {
20
- file: fileParameter(),
21
- mode: {
22
- type: "string",
23
- enum: ["auto", "fast", "accurate"],
24
- description: "Extraction route. `accurate` (default) uses the layout-aware extractor; `fast` prefers the light extractor when the deployment enables one.",
25
- },
26
- ocr: {
27
- type: "string",
28
- enum: ["auto", "off", "force"],
29
- description: "OCR policy: `auto` lets the extractor decide per page, `off` never runs OCR, `force` always runs it.",
30
- },
31
- ocrLanguages: {
32
- type: "array",
33
- items: { type: "string" },
34
- description: 'OCR languages, e.g. ["rus", "eng"].',
35
- },
36
- extractImages: {
37
- type: "boolean",
38
- description: "Write extracted images into the bundle's assets directory.",
39
- },
40
- extractTables: {
41
- type: "boolean",
42
- description: "Use the accurate table extraction mode.",
43
- },
44
- preservePageMarkers: {
45
- type: "boolean",
46
- description: "Keep page boundaries in the extracted Markdown where the extractor reports them.",
47
- },
48
- outputFilename: {
49
- type: "string",
50
- description: "Name of the extracted Markdown file inside the artifact bundle.",
51
- },
52
- },
53
- output: {
54
- schema: {
55
- type: "object",
56
- additionalProperties: false,
57
- properties: {
58
- artifactId: { type: "string", required: true },
59
- markdown: { type: "string", required: true },
60
- markdownPath: { type: "string", required: true },
61
- assets: {
62
- type: "array",
63
- items: {
64
- type: "object",
65
- additionalProperties: false,
66
- properties: {
67
- path: { type: "string", required: true },
68
- mediaType: { type: "string", required: true },
69
- },
70
- },
71
- },
72
- pages: { type: "number" },
73
- backend: { type: "string", required: true },
74
- warnings: warningsSchema,
75
- manifestPath: { type: "string", required: true },
76
- },
77
- },
78
- render: (_args, value) => {
79
- const result = value;
80
- return [
81
- {
82
- type: "text",
83
- text: [
84
- `artifact: ${result.artifactId} (extracted by ${result.backend})`,
85
- ...(result.pages === undefined ? [] : [`pages: ${result.pages}`]),
86
- `markdown: ${result.markdownPath}`,
87
- ...(result.assets === undefined
88
- ? []
89
- : [
90
- `assets: ${result.assets.map((asset) => asset.path).join(", ")}`,
91
- ]),
92
- ...result.warnings.map(renderWarning),
93
- "---",
94
- result.markdown,
95
- ].join("\n"),
96
- },
97
- ];
98
- },
99
- },
100
- timeoutMs: options.runtime.config.docling.timeoutMs +
101
- options.runtime.config.markitdown.timeoutMs +
102
- 30_000,
103
- async execute(args, exec) {
104
- const result = await options.runtime.toMarkdown(args, requireDocumentScope(exec));
105
- return {
106
- artifactId: result.artifactId,
107
- markdown: result.markdown,
108
- markdownPath: result.markdownPath,
109
- ...(result.assets === undefined
110
- ? {}
111
- : {
112
- assets: result.assets.map((asset) => ({
113
- path: asset.path,
114
- mediaType: asset.mediaType,
115
- })),
116
- }),
117
- ...(result.pages === undefined ? {} : { pages: result.pages }),
118
- backend: result.backend,
119
- warnings: toolWarnings(result.warnings),
120
- manifestPath: result.manifestPath,
121
- };
122
- },
123
- });
124
- }
125
- //# sourceMappingURL=to-markdown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"to-markdown.js","sourceRoot":"","sources":["../../../src/documents/t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C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;gBAC9D,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACvC,YAAY,EAAE,MAAM,CAAC,YAAY;aAClC,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Public types of the QA Surface document pipeline.
3
- *
4
- * The shapes here are the contract the agent sees (tool inputs and results),
5
- * the contract the artifact store persists (manifest), and the contract the
6
- * providers implement. They are deliberately free of any backend vocabulary:
7
- * a tool result never names pandoc, LibreOffice or Docling, so a provider can
8
- * be replaced without touching a prompt, a skill or a workflow
9
- * (docs/specs/document-pipeline.md §4.1, §22).
10
- */
11
- export {};
12
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/documents/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Documents: the document pipeline's deployment knobs.
3
- *
4
- * Everything here is optional — the defaults are usable as they are — but two
5
- * of them decide whether the four document tools work at all in a given
6
- * deployment: the Docling endpoint and the executables the renderer needs.
7
- * The section therefore shows the effective values the Host resolved, not only
8
- * what this browser has written.
9
- */
10
- import { type ConfigProps } from "./common.js";
11
- /** Document creation, conversion and extraction. */
12
- export declare function DocumentsSection(props: ConfigProps): import("react/jsx-runtime").JSX.Element;
13
- //# sourceMappingURL=documents.d.ts.map
@@ -1,14 +0,0 @@
1
- /**
2
- * ULID generation for artifact ids (§18).
3
- *
4
- * `doc_<ULID>` — 48 bits of time followed by 80 bits of randomness, encoded in
5
- * Crockford base32. The time prefix keeps a directory listing chronological,
6
- * and the randomness keeps ids unguessable without a UUID dependency.
7
- */
8
- /** A fresh ULID for the current millisecond. */
9
- export declare function createUlid(now?: number): string;
10
- /** A fresh artifact id: `doc_<ULID>`. */
11
- export declare function createArtifactId(now?: number): string;
12
- /** Whether a string is an artifact id this pipeline could have issued. */
13
- export declare function isArtifactId(value: string): boolean;
14
- //# sourceMappingURL=ids.d.ts.map
@@ -1,32 +0,0 @@
1
- /**
2
- * Manifest construction and persistence (§19).
3
- *
4
- * The manifest is the source of truth about an artifact: which operation,
5
- * which backends and versions, which template (and its hash), which files came
6
- * out, which warnings were raised, and which session/workspace the bundle
7
- * belongs to. Logical reproducibility rests on it, because byte-level
8
- * reproducibility of DOCX/PDF cannot be promised (§31).
9
- */
10
- import type { BackendInfo, DocumentFileResult, DocumentFormat, DocumentManifest, DocumentWarning } from "../types.js";
11
- import type { ArtifactStore } from "./store.js";
12
- export declare const MANIFEST_FILE = "manifest.json";
13
- export declare const MANIFEST_SCHEMA_VERSION: 1;
14
- export interface BuildManifestInput {
15
- readonly artifactId: string;
16
- readonly operation: DocumentManifest["operation"];
17
- readonly createdAt: string;
18
- readonly input: DocumentManifest["input"];
19
- readonly outputs: DocumentManifest["outputs"];
20
- readonly template?: string;
21
- readonly templateSha256?: string;
22
- readonly backends: Readonly<Record<string, BackendInfo>>;
23
- readonly warnings: readonly DocumentWarning[];
24
- readonly scope: DocumentManifest["scope"];
25
- }
26
- export declare function buildManifest(input: BuildManifestInput): DocumentManifest;
27
- export declare function writeManifest(store: ArtifactStore, artifactId: string, manifest: DocumentManifest): Promise<string>;
28
- export declare function readManifest(store: ArtifactStore, artifactId: string): Promise<DocumentManifest>;
29
- /** Project a tool-level file result onto the manifest's output record. */
30
- export declare function outputRecord(file: DocumentFileResult): DocumentManifest["outputs"][number];
31
- export declare function formatOfOperation(operation: DocumentManifest["operation"]): DocumentFormat | "unknown";
32
- //# sourceMappingURL=manifest.d.ts.map
@@ -1,67 +0,0 @@
1
- /**
2
- * Artifact bundle storage (§18, §47).
3
- *
4
- * One directory per operation:
5
- *
6
- * ```text
7
- * <root>/<artifact-id>/
8
- * manifest.json
9
- * source.md
10
- * input/original.pdf
11
- * assets/
12
- * output.docx
13
- * extracted.md
14
- * ```
15
- *
16
- * Everything the store writes goes through a root-relative path that is
17
- * validated first, and every file lands atomically (temp file + rename) so a
18
- * crashed host never leaves a half-written artifact that a later read would
19
- * trust. Job temp directories live under `<root>/.tmp` and are removed on both
20
- * success and failure (§47).
21
- */
22
- export interface FileFingerprint {
23
- readonly path: string;
24
- readonly size: number;
25
- readonly sha256: string;
26
- }
27
- export declare function sha256Hex(data: string | Buffer): string;
28
- export declare function sha256OfFile(filePath: string): Promise<string>;
29
- export interface ArtifactStoreOptions {
30
- /** Directory the bundles live in; created on demand. */
31
- readonly root: string;
32
- }
33
- export declare class ArtifactStore {
34
- readonly root: string;
35
- constructor(options: ArtifactStoreOptions);
36
- /** Absolute path of a root-relative artifact member, containment checked. */
37
- path(relativePath: string): string;
38
- artifactDir(artifactId: string): string;
39
- /** Prepare a fresh bundle directory and return its id. */
40
- create(now?: number): Promise<{
41
- artifactId: string;
42
- dir: string;
43
- }>;
44
- ensureDir(relativePath: string): Promise<string>;
45
- /** Atomically write a root-relative member. */
46
- write(relativePath: string, data: string | Buffer): Promise<FileFingerprint>;
47
- read(relativePath: string): Promise<Buffer>;
48
- fingerprint(relativePath: string): Promise<FileFingerprint>;
49
- exists(relativePath: string): Promise<boolean>;
50
- /** Job-scoped temp directory: never an artifact, always removed (§47). */
51
- createWorkDir(jobId: string): Promise<string>;
52
- removeWorkDir(dir: string): Promise<void>;
53
- /** Bundle directories, newest first, with their modification time. */
54
- list(): Promise<{
55
- artifactId: string;
56
- dir: string;
57
- modifiedAt: Date;
58
- }[]>;
59
- /** Retention sweep (§41): drop bundles older than `maxAgeDays`. */
60
- cleanup(options: {
61
- readonly maxAgeDays: number;
62
- readonly now?: Date;
63
- }): Promise<{
64
- removed: string[];
65
- }>;
66
- }
67
- //# sourceMappingURL=store.d.ts.map
@@ -1,32 +0,0 @@
1
- /**
2
- * Capability discovery (§43) and backend health (§42).
3
- *
4
- * Health separates required from optional backends on purpose: a deployment
5
- * without Docling cannot extract PDFs, but it still creates documents, so the
6
- * subsystem reports `degraded` and names what is missing instead of declaring
7
- * itself down. An optional backend that was never enabled reports `disabled`,
8
- * which is not a fault.
9
- */
10
- import type { ResolvedQaDocumentsConfig } from "./config.js";
11
- import { type ProviderSeams, type ProviderSet } from "./providers/registry.js";
12
- import type { DocumentCapabilities, DocumentHealth } from "./types.js";
13
- import { type TemplateRegistry } from "./templates/registry.js";
14
- export interface HealthOptions {
15
- readonly config: ResolvedQaDocumentsConfig;
16
- readonly providers: ProviderSet;
17
- /** Probe the two process-based backends; `false` answers from configuration. */
18
- readonly probeProcessBackends?: boolean;
19
- }
20
- export declare function documentHealth(options: HealthOptions): Promise<DocumentHealth>;
21
- export declare function documentCapabilities(options: {
22
- readonly config: ResolvedQaDocumentsConfig;
23
- readonly providers: ProviderSet;
24
- readonly templates: TemplateRegistry;
25
- }): DocumentCapabilities;
26
- /** Load the template registry of a workspace for capability reporting. */
27
- export declare function capabilitiesForRoot(options: {
28
- readonly config: ResolvedQaDocumentsConfig;
29
- readonly templateRoot: string | undefined;
30
- readonly seams?: ProviderSeams;
31
- }): Promise<DocumentCapabilities>;
32
- //# sourceMappingURL=capabilities.d.ts.map
@@ -1,27 +0,0 @@
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