@wonderwhy-er/desktop-commander 0.2.37 → 0.2.39

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 (383) hide show
  1. package/README.md +290 -100
  2. package/dist/command-manager.js +6 -3
  3. package/dist/config-field-definitions.d.ts +41 -0
  4. package/dist/config-field-definitions.js +37 -0
  5. package/dist/config-manager.d.ts +2 -0
  6. package/dist/config-manager.js +22 -2
  7. package/dist/handlers/filesystem-handlers.d.ts +5 -0
  8. package/dist/handlers/filesystem-handlers.js +19 -12
  9. package/dist/remote-device/desktop-commander-integration.js +1 -1
  10. package/dist/remote-device/remote-channel.js +1 -1
  11. package/dist/search-manager.js +31 -38
  12. package/dist/server.js +11 -4
  13. package/dist/terminal-manager.js +4 -2
  14. package/dist/tools/config.d.ts +71 -0
  15. package/dist/tools/config.js +117 -2
  16. package/dist/tools/edit.js +34 -1
  17. package/dist/tools/filesystem.js +91 -3
  18. package/dist/tools/improved-process-tools.js +2 -1
  19. package/dist/tools/schemas.d.ts +3 -0
  20. package/dist/tools/schemas.js +1 -0
  21. package/dist/types.d.ts +0 -1
  22. package/dist/ui/config-editor/app.d.ts +43 -0
  23. package/dist/ui/config-editor/app.js +840 -0
  24. package/dist/ui/config-editor/array-modal.d.ts +19 -0
  25. package/dist/ui/config-editor/array-modal.js +185 -0
  26. package/dist/ui/config-editor/config-editor-runtime.js +150 -0
  27. package/dist/ui/config-editor/index.html +13 -0
  28. package/dist/ui/config-editor/main.js +2 -0
  29. package/dist/ui/config-editor/src/App.d.ts +43 -0
  30. package/dist/ui/config-editor/src/App.js +840 -0
  31. package/dist/ui/config-editor/src/array-modal.d.ts +19 -0
  32. package/dist/ui/config-editor/src/array-modal.js +185 -0
  33. package/dist/ui/config-editor/src/components/layout.d.ts +4 -0
  34. package/dist/ui/config-editor/src/components/layout.js +83 -0
  35. package/dist/ui/config-editor/src/components/toolbar.d.ts +1 -0
  36. package/dist/ui/config-editor/src/components/toolbar.js +21 -0
  37. package/dist/ui/config-editor/src/config-values.d.ts +6 -0
  38. package/dist/ui/config-editor/src/config-values.js +61 -0
  39. package/dist/ui/config-editor/src/contracts.d.ts +14 -0
  40. package/dist/ui/config-editor/src/contracts.js +3 -0
  41. package/dist/ui/config-editor/src/directory-browser.d.ts +6 -0
  42. package/dist/ui/config-editor/src/directory-browser.js +71 -0
  43. package/dist/ui/config-editor/src/layout.d.ts +5 -0
  44. package/dist/ui/config-editor/src/layout.js +90 -0
  45. package/dist/ui/config-editor/src/main.js +2 -0
  46. package/dist/ui/config-editor/src/parsing.d.ts +5 -0
  47. package/dist/ui/config-editor/src/parsing.js +50 -0
  48. package/dist/ui/config-editor/src/toolbar.d.ts +1 -0
  49. package/dist/ui/config-editor/src/toolbar.js +18 -0
  50. package/dist/ui/config-editor/src/types.d.ts +17 -0
  51. package/dist/ui/config-editor/src/types.js +3 -0
  52. package/dist/ui/config-editor/src/utils/config-values.d.ts +9 -0
  53. package/dist/ui/config-editor/src/utils/config-values.js +61 -0
  54. package/dist/ui/config-editor/src/utils/directory-browser.d.ts +31 -0
  55. package/dist/ui/config-editor/src/utils/directory-browser.js +201 -0
  56. package/dist/ui/config-editor/src/utils/parsing.d.ts +8 -0
  57. package/dist/ui/config-editor/src/utils/parsing.js +50 -0
  58. package/dist/ui/config-editor/styles.css +587 -0
  59. package/dist/ui/file-preview/app.d.ts +8 -0
  60. package/dist/ui/file-preview/app.js +2020 -0
  61. package/dist/ui/file-preview/components/code-viewer.d.ts +6 -0
  62. package/dist/ui/file-preview/components/code-viewer.js +73 -0
  63. package/dist/ui/file-preview/components/highlighting.d.ts +2 -0
  64. package/dist/ui/file-preview/components/highlighting.js +54 -0
  65. package/dist/ui/file-preview/components/html-renderer.d.ts +5 -0
  66. package/dist/ui/file-preview/components/html-renderer.js +47 -0
  67. package/dist/ui/file-preview/components/markdown-renderer.d.ts +1 -0
  68. package/dist/ui/file-preview/components/markdown-renderer.js +67 -0
  69. package/dist/ui/file-preview/components/toolbar.d.ts +6 -0
  70. package/dist/ui/file-preview/components/toolbar.js +75 -0
  71. package/dist/ui/file-preview/image-preview.d.ts +3 -0
  72. package/dist/ui/file-preview/image-preview.js +21 -0
  73. package/dist/ui/file-preview/main.js +5 -0
  74. package/dist/ui/file-preview/markdown/editor.d.ts +36 -0
  75. package/dist/ui/file-preview/markdown/editor.js +643 -0
  76. package/dist/ui/file-preview/markdown/linking.d.ts +9 -0
  77. package/dist/ui/file-preview/markdown/linking.js +210 -0
  78. package/dist/ui/file-preview/markdown/outline.d.ts +7 -0
  79. package/dist/ui/file-preview/markdown/outline.js +40 -0
  80. package/dist/ui/file-preview/markdown/preview.d.ts +8 -0
  81. package/dist/ui/file-preview/markdown/preview.js +33 -0
  82. package/dist/ui/file-preview/markdown/slugify.d.ts +3 -0
  83. package/dist/ui/file-preview/markdown/slugify.js +31 -0
  84. package/dist/ui/file-preview/markdown/toc.d.ts +11 -0
  85. package/dist/ui/file-preview/markdown/toc.js +75 -0
  86. package/dist/ui/file-preview/markdown/utils.d.ts +1 -0
  87. package/dist/ui/file-preview/markdown/utils.js +15 -0
  88. package/dist/ui/file-preview/markdown/workspace-controller.d.ts +25 -0
  89. package/dist/ui/file-preview/markdown/workspace-controller.js +40 -0
  90. package/dist/ui/file-preview/preview-runtime.js +399 -13969
  91. package/dist/ui/file-preview/shared/preview-file-types.d.ts +1 -1
  92. package/dist/ui/file-preview/shared/preview-file-types.js +3 -1
  93. package/dist/ui/file-preview/src/App.d.ts +4 -0
  94. package/dist/ui/file-preview/src/App.js +564 -0
  95. package/dist/ui/file-preview/src/components/CodeViewer.d.ts +6 -0
  96. package/dist/ui/file-preview/src/components/CodeViewer.js +60 -0
  97. package/dist/ui/file-preview/src/components/HtmlRenderer.d.ts +8 -0
  98. package/dist/ui/file-preview/src/components/HtmlRenderer.js +45 -0
  99. package/dist/ui/file-preview/src/components/MarkdownRenderer.d.ts +1 -0
  100. package/dist/ui/file-preview/src/components/MarkdownRenderer.js +15 -0
  101. package/dist/ui/file-preview/src/components/editor-toolbar.d.ts +15 -0
  102. package/dist/ui/file-preview/src/components/editor-toolbar.js +384 -0
  103. package/dist/ui/file-preview/src/components/html-renderer.d.ts +1 -5
  104. package/dist/ui/file-preview/src/components/html-renderer.js +11 -27
  105. package/dist/ui/file-preview/src/components/markdown-editor.d.ts +29 -0
  106. package/dist/ui/file-preview/src/components/markdown-editor.js +535 -0
  107. package/dist/ui/file-preview/src/components/markdown-renderer.js +47 -9
  108. package/dist/ui/file-preview/src/directory-controller.d.ts +8 -0
  109. package/dist/ui/file-preview/src/directory-controller.js +233 -0
  110. package/dist/ui/file-preview/src/document-layout.d.ts +20 -0
  111. package/dist/ui/file-preview/src/document-layout.js +109 -0
  112. package/dist/ui/file-preview/src/document-outline.d.ts +17 -0
  113. package/dist/ui/file-preview/src/document-outline.js +97 -0
  114. package/dist/ui/file-preview/src/document-workspace.d.ts +19 -0
  115. package/dist/ui/file-preview/src/document-workspace.js +33 -0
  116. package/dist/ui/file-preview/src/file-type-handlers.d.ts +10 -0
  117. package/dist/ui/file-preview/src/file-type-handlers.js +98 -0
  118. package/dist/ui/file-preview/src/host/external-actions.d.ts +19 -0
  119. package/dist/ui/file-preview/src/host/external-actions.js +94 -0
  120. package/dist/ui/file-preview/src/host/selection-context.d.ts +9 -0
  121. package/dist/ui/file-preview/src/host/selection-context.js +106 -0
  122. package/dist/ui/file-preview/src/markdown/block-merge.d.ts +25 -0
  123. package/dist/ui/file-preview/src/markdown/block-merge.js +86 -0
  124. package/dist/ui/file-preview/src/markdown/conflict-dialog.d.ts +40 -0
  125. package/dist/ui/file-preview/src/markdown/conflict-dialog.js +163 -0
  126. package/dist/ui/file-preview/src/markdown/controller.d.ts +38 -0
  127. package/dist/ui/file-preview/src/markdown/controller.js +921 -0
  128. package/dist/ui/file-preview/src/markdown/editor.d.ts +35 -0
  129. package/dist/ui/file-preview/src/markdown/editor.js +691 -0
  130. package/dist/ui/file-preview/src/markdown/link-modal.d.ts +13 -0
  131. package/dist/ui/file-preview/src/markdown/link-modal.js +213 -0
  132. package/dist/ui/file-preview/src/markdown/linking.d.ts +16 -0
  133. package/dist/ui/file-preview/src/markdown/linking.js +228 -0
  134. package/dist/ui/file-preview/src/markdown/outline.d.ts +2 -0
  135. package/dist/ui/file-preview/src/markdown/outline.js +16 -0
  136. package/dist/ui/file-preview/src/markdown/parser.d.ts +30 -0
  137. package/dist/ui/file-preview/src/markdown/parser.js +38 -0
  138. package/dist/ui/file-preview/src/markdown/preview.d.ts +1 -0
  139. package/dist/ui/file-preview/src/markdown/preview.js +20 -0
  140. package/dist/ui/file-preview/src/markdown/raw-editor.d.ts +8 -0
  141. package/dist/ui/file-preview/src/markdown/raw-editor.js +61 -0
  142. package/dist/ui/file-preview/src/markdown/selection-toolbar.d.ts +14 -0
  143. package/dist/ui/file-preview/src/markdown/selection-toolbar.js +128 -0
  144. package/dist/ui/file-preview/src/markdown/slugify.d.ts +3 -0
  145. package/dist/ui/file-preview/src/markdown/slugify.js +31 -0
  146. package/dist/ui/file-preview/src/markdown/toc.d.ts +11 -0
  147. package/dist/ui/file-preview/src/markdown/toc.js +75 -0
  148. package/dist/ui/file-preview/src/markdown/utils.d.ts +1 -0
  149. package/dist/ui/file-preview/src/markdown/utils.js +15 -0
  150. package/dist/ui/file-preview/src/markdown-workspace/editor.d.ts +36 -0
  151. package/dist/ui/file-preview/src/markdown-workspace/editor.js +643 -0
  152. package/dist/ui/file-preview/src/markdown-workspace/linking.d.ts +9 -0
  153. package/dist/ui/file-preview/src/markdown-workspace/linking.js +210 -0
  154. package/dist/ui/file-preview/src/markdown-workspace/outline.d.ts +7 -0
  155. package/dist/ui/file-preview/src/markdown-workspace/outline.js +40 -0
  156. package/dist/ui/file-preview/src/markdown-workspace/preview.d.ts +8 -0
  157. package/dist/ui/file-preview/src/markdown-workspace/preview.js +33 -0
  158. package/dist/ui/file-preview/src/markdown-workspace/slugify.d.ts +3 -0
  159. package/dist/ui/file-preview/src/markdown-workspace/slugify.js +31 -0
  160. package/dist/ui/file-preview/src/markdown-workspace/toc.d.ts +11 -0
  161. package/dist/ui/file-preview/src/markdown-workspace/toc.js +75 -0
  162. package/dist/ui/file-preview/src/markdown-workspace/utils.d.ts +1 -0
  163. package/dist/ui/file-preview/src/markdown-workspace/utils.js +15 -0
  164. package/dist/ui/file-preview/src/markdown-workspace/workspace-controller.d.ts +25 -0
  165. package/dist/ui/file-preview/src/markdown-workspace/workspace-controller.js +40 -0
  166. package/dist/ui/file-preview/src/model.d.ts +34 -0
  167. package/dist/ui/file-preview/src/panel-actions.d.ts +17 -0
  168. package/dist/ui/file-preview/src/panel-actions.js +182 -0
  169. package/dist/ui/file-preview/src/path-utils.d.ts +6 -0
  170. package/dist/ui/file-preview/src/path-utils.js +64 -0
  171. package/dist/ui/file-preview/src/payload-utils.d.ts +11 -0
  172. package/dist/ui/file-preview/src/payload-utils.js +94 -0
  173. package/dist/ui/file-preview/styles.css +1144 -277
  174. package/dist/ui/file-preview/types.d.ts +1 -0
  175. package/dist/ui/file-preview/types.js +1 -0
  176. package/dist/ui/resources.d.ts +7 -0
  177. package/dist/ui/resources.js +16 -2
  178. package/dist/ui/server-integration.d.ts +13 -0
  179. package/dist/ui/server-integration.js +31 -0
  180. package/dist/ui/shared/ToolHeader.d.ts +9 -0
  181. package/dist/ui/shared/ToolHeader.js +29 -0
  182. package/dist/ui/shared/app-bootstrap.d.ts +9 -0
  183. package/dist/ui/shared/app-bootstrap.js +15 -0
  184. package/dist/ui/shared/compact-row.d.ts +11 -0
  185. package/dist/ui/shared/compact-row.js +18 -0
  186. package/dist/ui/shared/guards.d.ts +1 -0
  187. package/dist/ui/shared/guards.js +3 -0
  188. package/dist/ui/shared/host-context.d.ts +15 -0
  189. package/dist/ui/shared/host-context.js +51 -0
  190. package/dist/ui/shared/host-lifecycle.d.ts +1 -0
  191. package/dist/ui/shared/host-lifecycle.js +8 -2
  192. package/dist/ui/shared/tool-bridge.d.ts +30 -0
  193. package/dist/ui/shared/tool-bridge.js +137 -0
  194. package/dist/ui/shared/tool-shell.d.ts +9 -0
  195. package/dist/ui/shared/tool-shell.js +46 -4
  196. package/dist/ui/shared/ui-event-tracker.d.ts +9 -0
  197. package/dist/ui/shared/ui-event-tracker.js +27 -0
  198. package/dist/ui/shared/widget-state.d.ts +6 -1
  199. package/dist/ui/shared/widget-state.js +102 -4
  200. package/dist/utils/capture.js +3 -3
  201. package/dist/utils/files/base.d.ts +2 -0
  202. package/dist/utils/open-browser.js +1 -1
  203. package/dist/utils/ui-call-context.d.ts +8 -0
  204. package/dist/utils/ui-call-context.js +72 -0
  205. package/dist/version.d.ts +1 -1
  206. package/dist/version.js +1 -1
  207. package/package.json +13 -4
  208. package/dist/data/spec-kit-prompts.json +0 -123
  209. package/dist/handlers/node-handlers.d.ts +0 -6
  210. package/dist/handlers/node-handlers.js +0 -73
  211. package/dist/handlers/test-crash-handler.d.ts +0 -11
  212. package/dist/handlers/test-crash-handler.js +0 -26
  213. package/dist/http-index.d.ts +0 -45
  214. package/dist/http-index.js +0 -51
  215. package/dist/http-server-auto-tunnel.js +0 -667
  216. package/dist/http-server-named-tunnel.d.ts +0 -2
  217. package/dist/http-server-named-tunnel.js +0 -167
  218. package/dist/http-server-tunnel.d.ts +0 -2
  219. package/dist/http-server-tunnel.js +0 -111
  220. package/dist/http-server.d.ts +0 -2
  221. package/dist/http-server.js +0 -270
  222. package/dist/index-oauth.d.ts +0 -2
  223. package/dist/index-oauth.js +0 -201
  224. package/dist/oauth/auth-middleware.d.ts +0 -20
  225. package/dist/oauth/auth-middleware.js +0 -62
  226. package/dist/oauth/index.d.ts +0 -3
  227. package/dist/oauth/index.js +0 -3
  228. package/dist/oauth/oauth-manager.d.ts +0 -80
  229. package/dist/oauth/oauth-manager.js +0 -179
  230. package/dist/oauth/oauth-routes.d.ts +0 -3
  231. package/dist/oauth/oauth-routes.js +0 -377
  232. package/dist/oauth/provider.d.ts +0 -22
  233. package/dist/oauth/provider.js +0 -124
  234. package/dist/oauth/server.d.ts +0 -18
  235. package/dist/oauth/server.js +0 -160
  236. package/dist/oauth/types.d.ts +0 -54
  237. package/dist/oauth/types.js +0 -2
  238. package/dist/remote-device/templates/auth-success.d.ts +0 -1
  239. package/dist/remote-device/templates/auth-success.js +0 -30
  240. package/dist/setup.log +0 -275
  241. package/dist/test-setup.js +0 -14
  242. package/dist/tools/docx/builders/html-builder.d.ts +0 -17
  243. package/dist/tools/docx/builders/html-builder.js +0 -92
  244. package/dist/tools/docx/builders/image.d.ts +0 -14
  245. package/dist/tools/docx/builders/image.js +0 -84
  246. package/dist/tools/docx/builders/index.d.ts +0 -11
  247. package/dist/tools/docx/builders/index.js +0 -11
  248. package/dist/tools/docx/builders/markdown-builder.d.ts +0 -2
  249. package/dist/tools/docx/builders/markdown-builder.js +0 -260
  250. package/dist/tools/docx/builders/paragraph.d.ts +0 -12
  251. package/dist/tools/docx/builders/paragraph.js +0 -29
  252. package/dist/tools/docx/builders/table.d.ts +0 -10
  253. package/dist/tools/docx/builders/table.js +0 -138
  254. package/dist/tools/docx/builders/utils.d.ts +0 -5
  255. package/dist/tools/docx/builders/utils.js +0 -18
  256. package/dist/tools/docx/constants.d.ts +0 -32
  257. package/dist/tools/docx/constants.js +0 -61
  258. package/dist/tools/docx/converters/markdown-to-html.d.ts +0 -17
  259. package/dist/tools/docx/converters/markdown-to-html.js +0 -111
  260. package/dist/tools/docx/create.d.ts +0 -21
  261. package/dist/tools/docx/create.js +0 -386
  262. package/dist/tools/docx/dom.d.ts +0 -139
  263. package/dist/tools/docx/dom.js +0 -448
  264. package/dist/tools/docx/errors.d.ts +0 -28
  265. package/dist/tools/docx/errors.js +0 -48
  266. package/dist/tools/docx/extractors/images.d.ts +0 -14
  267. package/dist/tools/docx/extractors/images.js +0 -40
  268. package/dist/tools/docx/extractors/metadata.d.ts +0 -14
  269. package/dist/tools/docx/extractors/metadata.js +0 -64
  270. package/dist/tools/docx/extractors/sections.d.ts +0 -14
  271. package/dist/tools/docx/extractors/sections.js +0 -61
  272. package/dist/tools/docx/html.d.ts +0 -17
  273. package/dist/tools/docx/html.js +0 -111
  274. package/dist/tools/docx/index.d.ts +0 -10
  275. package/dist/tools/docx/index.js +0 -10
  276. package/dist/tools/docx/markdown.d.ts +0 -84
  277. package/dist/tools/docx/markdown.js +0 -507
  278. package/dist/tools/docx/modify.d.ts +0 -28
  279. package/dist/tools/docx/modify.js +0 -271
  280. package/dist/tools/docx/operations/handlers/index.d.ts +0 -39
  281. package/dist/tools/docx/operations/handlers/index.js +0 -152
  282. package/dist/tools/docx/operations/html-manipulator.d.ts +0 -24
  283. package/dist/tools/docx/operations/html-manipulator.js +0 -352
  284. package/dist/tools/docx/operations/index.d.ts +0 -14
  285. package/dist/tools/docx/operations/index.js +0 -61
  286. package/dist/tools/docx/operations/operation-handlers.d.ts +0 -3
  287. package/dist/tools/docx/operations/operation-handlers.js +0 -67
  288. package/dist/tools/docx/operations/preprocessor.d.ts +0 -14
  289. package/dist/tools/docx/operations/preprocessor.js +0 -44
  290. package/dist/tools/docx/operations/xml-replacer.d.ts +0 -9
  291. package/dist/tools/docx/operations/xml-replacer.js +0 -35
  292. package/dist/tools/docx/operations.d.ts +0 -13
  293. package/dist/tools/docx/operations.js +0 -13
  294. package/dist/tools/docx/ops/delete-paragraph-at-body-index.d.ts +0 -11
  295. package/dist/tools/docx/ops/delete-paragraph-at-body-index.js +0 -23
  296. package/dist/tools/docx/ops/header-replace-text-exact.d.ts +0 -13
  297. package/dist/tools/docx/ops/header-replace-text-exact.js +0 -55
  298. package/dist/tools/docx/ops/index.d.ts +0 -17
  299. package/dist/tools/docx/ops/index.js +0 -70
  300. package/dist/tools/docx/ops/insert-image-after-text.d.ts +0 -24
  301. package/dist/tools/docx/ops/insert-image-after-text.js +0 -128
  302. package/dist/tools/docx/ops/insert-paragraph-after-text.d.ts +0 -12
  303. package/dist/tools/docx/ops/insert-paragraph-after-text.js +0 -74
  304. package/dist/tools/docx/ops/insert-table-after-text.d.ts +0 -19
  305. package/dist/tools/docx/ops/insert-table-after-text.js +0 -57
  306. package/dist/tools/docx/ops/replace-hyperlink-url.d.ts +0 -12
  307. package/dist/tools/docx/ops/replace-hyperlink-url.js +0 -37
  308. package/dist/tools/docx/ops/replace-paragraph-at-body-index.d.ts +0 -9
  309. package/dist/tools/docx/ops/replace-paragraph-at-body-index.js +0 -25
  310. package/dist/tools/docx/ops/replace-paragraph-text-exact.d.ts +0 -21
  311. package/dist/tools/docx/ops/replace-paragraph-text-exact.js +0 -36
  312. package/dist/tools/docx/ops/replace-table-cell-text.d.ts +0 -25
  313. package/dist/tools/docx/ops/replace-table-cell-text.js +0 -85
  314. package/dist/tools/docx/ops/set-color-for-paragraph-exact.d.ts +0 -9
  315. package/dist/tools/docx/ops/set-color-for-paragraph-exact.js +0 -24
  316. package/dist/tools/docx/ops/set-color-for-style.d.ts +0 -13
  317. package/dist/tools/docx/ops/set-color-for-style.js +0 -31
  318. package/dist/tools/docx/ops/set-paragraph-style-at-body-index.d.ts +0 -8
  319. package/dist/tools/docx/ops/set-paragraph-style-at-body-index.js +0 -57
  320. package/dist/tools/docx/ops/table-set-cell-text.d.ts +0 -9
  321. package/dist/tools/docx/ops/table-set-cell-text.js +0 -40
  322. package/dist/tools/docx/parsers/image-extractor.d.ts +0 -18
  323. package/dist/tools/docx/parsers/image-extractor.js +0 -61
  324. package/dist/tools/docx/parsers/index.d.ts +0 -9
  325. package/dist/tools/docx/parsers/index.js +0 -9
  326. package/dist/tools/docx/parsers/paragraph-parser.d.ts +0 -2
  327. package/dist/tools/docx/parsers/paragraph-parser.js +0 -88
  328. package/dist/tools/docx/parsers/table-parser.d.ts +0 -9
  329. package/dist/tools/docx/parsers/table-parser.js +0 -72
  330. package/dist/tools/docx/parsers/xml-parser.d.ts +0 -25
  331. package/dist/tools/docx/parsers/xml-parser.js +0 -71
  332. package/dist/tools/docx/parsers/zip-reader.d.ts +0 -23
  333. package/dist/tools/docx/parsers/zip-reader.js +0 -52
  334. package/dist/tools/docx/read.d.ts +0 -27
  335. package/dist/tools/docx/read.js +0 -308
  336. package/dist/tools/docx/relationships.d.ts +0 -22
  337. package/dist/tools/docx/relationships.js +0 -76
  338. package/dist/tools/docx/structure.d.ts +0 -25
  339. package/dist/tools/docx/structure.js +0 -102
  340. package/dist/tools/docx/styled-html-parser.d.ts +0 -23
  341. package/dist/tools/docx/styled-html-parser.js +0 -1262
  342. package/dist/tools/docx/types.d.ts +0 -213
  343. package/dist/tools/docx/types.js +0 -5
  344. package/dist/tools/docx/utils/escaping.d.ts +0 -13
  345. package/dist/tools/docx/utils/escaping.js +0 -26
  346. package/dist/tools/docx/utils/images.d.ts +0 -9
  347. package/dist/tools/docx/utils/images.js +0 -26
  348. package/dist/tools/docx/utils/index.d.ts +0 -12
  349. package/dist/tools/docx/utils/index.js +0 -17
  350. package/dist/tools/docx/utils/markdown.d.ts +0 -13
  351. package/dist/tools/docx/utils/markdown.js +0 -32
  352. package/dist/tools/docx/utils/paths.d.ts +0 -15
  353. package/dist/tools/docx/utils/paths.js +0 -27
  354. package/dist/tools/docx/utils/versioning.d.ts +0 -25
  355. package/dist/tools/docx/utils/versioning.js +0 -55
  356. package/dist/tools/docx/utils.d.ts +0 -101
  357. package/dist/tools/docx/utils.js +0 -299
  358. package/dist/tools/docx/validate.d.ts +0 -33
  359. package/dist/tools/docx/validate.js +0 -49
  360. package/dist/tools/docx/validators.d.ts +0 -13
  361. package/dist/tools/docx/validators.js +0 -40
  362. package/dist/tools/docx/write.d.ts +0 -17
  363. package/dist/tools/docx/write.js +0 -88
  364. package/dist/tools/docx/xml-view-test.js +0 -63
  365. package/dist/tools/docx/xml-view.d.ts +0 -56
  366. package/dist/tools/docx/xml-view.js +0 -169
  367. package/dist/tools/docx/zip.d.ts +0 -21
  368. package/dist/tools/docx/zip.js +0 -35
  369. package/dist/tools/pdf-processor.js +0 -3
  370. package/dist/tools/search.d.ts +0 -32
  371. package/dist/tools/search.js +0 -202
  372. package/dist/ui/file-preview/src/app.d.ts +0 -4
  373. package/dist/ui/file-preview/src/app.js +0 -800
  374. package/dist/utils/crash-logger.d.ts +0 -18
  375. package/dist/utils/crash-logger.js +0 -44
  376. package/dist/utils/dedent.d.ts +0 -8
  377. package/dist/utils/dedent.js +0 -38
  378. /package/dist/{http-server-auto-tunnel.d.ts → ui/config-editor/main.d.ts} +0 -0
  379. /package/dist/{test-docx.d.ts → ui/config-editor/src/main.d.ts} +0 -0
  380. /package/dist/{tools/docx/xml-view-test.d.ts → ui/file-preview/main.d.ts} +0 -0
  381. /package/dist/ui/file-preview/src/components/{toolbar.d.ts → Toolbar.d.ts} +0 -0
  382. /package/dist/ui/file-preview/src/components/{toolbar.js → Toolbar.js} +0 -0
  383. /package/dist/{tools/pdf-processor.d.ts → ui/file-preview/src/model.js} +0 -0
@@ -0,0 +1,19 @@
1
+ export interface ArrayModalEntry {
2
+ key: string;
3
+ label?: string;
4
+ description?: string;
5
+ value: unknown;
6
+ }
7
+ interface CreateArrayModalControllerOptions {
8
+ container: HTMLElement;
9
+ parseEntryItems: (entry: ArrayModalEntry) => string[];
10
+ formatEntryTitle: (entry: ArrayModalEntry) => string;
11
+ onSave: (entryKey: string, items: string[]) => void | Promise<void>;
12
+ }
13
+ export interface ArrayModalController {
14
+ open: (entry: ArrayModalEntry) => void;
15
+ close: () => void;
16
+ }
17
+ export declare function renderArrayModalMarkup(initialTitle: string): string;
18
+ export declare function createArrayModalController(options: CreateArrayModalControllerOptions): ArrayModalController;
19
+ export {};
@@ -0,0 +1,185 @@
1
+ import { escapeHtml } from '../../shared/escape-html.js';
2
+ export function renderArrayModalMarkup(initialTitle) {
3
+ return `
4
+ <div class="array-modal" id="array-modal" hidden>
5
+ <div class="array-modal-card">
6
+ <header>
7
+ <h3 id="array-modal-title">${escapeHtml(initialTitle)}</h3>
8
+ <div class="array-modal-actions">
9
+ <button type="button" id="array-modal-save" aria-label="Save list changes">
10
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 13l4 4L19 7"></path></svg>
11
+ </button>
12
+ <button type="button" id="array-modal-close" aria-label="Close list editor">
13
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M7 7l10 10M17 7L7 17"></path></svg>
14
+ </button>
15
+ </div>
16
+ </header>
17
+ <p class="array-modal-description" id="array-modal-description"></p>
18
+ <p class="array-modal-hint">Type an item, then press Enter (or click away) to add it. A new empty row appears automatically.</p>
19
+ <p class="array-modal-error hidden" id="array-modal-error" role="status" aria-live="polite"></p>
20
+ <div class="array-modal-list" id="array-modal-list"></div>
21
+ </div>
22
+ </div>
23
+ `;
24
+ }
25
+ export function createArrayModalController(options) {
26
+ const { container, parseEntryItems, formatEntryTitle, onSave } = options;
27
+ const modal = container.querySelector('#array-modal');
28
+ const modalList = container.querySelector('#array-modal-list');
29
+ const modalTitleElement = container.querySelector('#array-modal-title');
30
+ const modalDescriptionElement = container.querySelector('#array-modal-description');
31
+ const modalErrorElement = container.querySelector('#array-modal-error');
32
+ const modalClose = container.querySelector('#array-modal-close');
33
+ const modalSave = container.querySelector('#array-modal-save');
34
+ let modalEntryKey = null;
35
+ let modalItems = [];
36
+ const clearError = () => {
37
+ if (!modalErrorElement) {
38
+ return;
39
+ }
40
+ modalErrorElement.textContent = '';
41
+ modalErrorElement.classList.add('hidden');
42
+ };
43
+ const showError = (message) => {
44
+ if (!modalErrorElement) {
45
+ return;
46
+ }
47
+ modalErrorElement.textContent = message;
48
+ modalErrorElement.classList.remove('hidden');
49
+ };
50
+ const collectModalItemsFromDom = () => {
51
+ if (!modalList) {
52
+ return [...modalItems];
53
+ }
54
+ const existing = Array.from(modalList.querySelectorAll('.array-modal-item-input'))
55
+ .map((input) => input.value.trim())
56
+ .filter((value) => value.length > 0);
57
+ const newInput = modalList.querySelector('#array-modal-new-item');
58
+ const newValue = newInput?.value.trim() ?? '';
59
+ if (newValue.length > 0) {
60
+ return [newValue, ...existing];
61
+ }
62
+ return existing;
63
+ };
64
+ const renderModalList = () => {
65
+ if (!modalList) {
66
+ return;
67
+ }
68
+ modalList.innerHTML = `
69
+ <div class="array-modal-row array-modal-row--new">
70
+ <input id="array-modal-new-item" type="text" placeholder="Add item" aria-label="Add new item" />
71
+ </div>
72
+ ${modalItems.map((item, index) => `
73
+ <div class="array-modal-row" data-modal-index="${index}">
74
+ <input class="array-modal-item-input" type="text" value="${escapeHtml(item)}" aria-label="Item ${index + 1}" />
75
+ <button type="button" class="array-modal-item-remove" aria-label="Remove item ${index + 1}">
76
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14M10 10v7M14 10v7"></path></svg>
77
+ </button>
78
+ </div>
79
+ `).join('')}
80
+ `;
81
+ const addModalItem = (value) => {
82
+ const normalized = value.trim();
83
+ if (!normalized) {
84
+ return;
85
+ }
86
+ const exists = modalItems.some((item) => item.trim() === normalized);
87
+ if (!exists) {
88
+ modalItems.unshift(normalized);
89
+ }
90
+ renderModalList();
91
+ };
92
+ const newInput = modalList.querySelector('#array-modal-new-item');
93
+ newInput?.addEventListener('blur', () => {
94
+ const value = newInput.value.trim();
95
+ if (!value) {
96
+ return;
97
+ }
98
+ addModalItem(value);
99
+ const refreshedNewInput = modalList.querySelector('#array-modal-new-item');
100
+ refreshedNewInput?.focus();
101
+ });
102
+ newInput?.addEventListener('keydown', (event) => {
103
+ if (event.key !== 'Enter') {
104
+ return;
105
+ }
106
+ event.preventDefault();
107
+ const value = newInput.value.trim();
108
+ if (!value) {
109
+ return;
110
+ }
111
+ addModalItem(value);
112
+ const refreshedNewInput = modalList.querySelector('#array-modal-new-item');
113
+ refreshedNewInput?.focus();
114
+ });
115
+ modalList.querySelectorAll('.array-modal-row[data-modal-index]').forEach((rowElement) => {
116
+ const row = rowElement;
117
+ const index = Number(row.dataset.modalIndex);
118
+ const input = row.querySelector('.array-modal-item-input');
119
+ const removeButton = row.querySelector('.array-modal-item-remove');
120
+ input?.addEventListener('blur', () => {
121
+ modalItems[index] = input.value.trim();
122
+ modalItems = modalItems.filter((item) => item.length > 0);
123
+ renderModalList();
124
+ });
125
+ removeButton?.addEventListener('click', () => {
126
+ modalItems = modalItems.filter((_, itemIndex) => itemIndex !== index);
127
+ renderModalList();
128
+ });
129
+ });
130
+ };
131
+ const close = () => {
132
+ if (modal) {
133
+ modal.hidden = true;
134
+ }
135
+ modalEntryKey = null;
136
+ clearError();
137
+ };
138
+ const open = (entry) => {
139
+ modalEntryKey = entry.key;
140
+ modalItems = parseEntryItems(entry);
141
+ clearError();
142
+ if (modalTitleElement) {
143
+ modalTitleElement.textContent = formatEntryTitle(entry);
144
+ }
145
+ if (modalDescriptionElement) {
146
+ modalDescriptionElement.textContent = entry.description ?? '';
147
+ modalDescriptionElement.classList.toggle('hidden', !modalDescriptionElement.textContent.trim());
148
+ }
149
+ renderModalList();
150
+ if (modal) {
151
+ modal.hidden = false;
152
+ }
153
+ };
154
+ modalClose?.addEventListener('click', close);
155
+ modal?.addEventListener('click', (event) => {
156
+ if (event.target === modal) {
157
+ close();
158
+ }
159
+ });
160
+ modalSave?.addEventListener('click', async () => {
161
+ if (!modalEntryKey) {
162
+ return;
163
+ }
164
+ const changedKey = modalEntryKey;
165
+ modalItems = collectModalItemsFromDom();
166
+ clearError();
167
+ if (modalSave) {
168
+ modalSave.disabled = true;
169
+ }
170
+ try {
171
+ await onSave(changedKey, modalItems);
172
+ close();
173
+ }
174
+ catch (error) {
175
+ const message = error instanceof Error ? error.message : String(error);
176
+ showError(message.trim().length > 0 ? message : 'Failed to save list changes.');
177
+ }
178
+ finally {
179
+ if (modalSave) {
180
+ modalSave.disabled = false;
181
+ }
182
+ }
183
+ });
184
+ return { open, close };
185
+ }
@@ -0,0 +1,4 @@
1
+ import type { ConfigStructuredContent } from '../types.js';
2
+ export declare function getAllowedDirectoriesWarning(key: string): string;
3
+ export declare function renderConfigEditorLayout(payload: ConfigStructuredContent, selectedKey: string, isExpanded: boolean, callToolAvailable: boolean): string;
4
+ export declare function renderEmptyState(): string;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Pure rendering helpers for Config Editor body/layout sections. It converts structured config data into editable view fragments and keeps DOM generation isolated from app logic.
3
+ */
4
+ import { escapeHtml } from '../../../shared/escape-html.js';
5
+ import { formatValueForEditor } from '../utils/config-values.js';
6
+ import { renderConfigEditorToolbar } from './toolbar.js';
7
+ function renderKeyPreview(value) {
8
+ const rendered = formatValueForEditor(value).replace(/\s+/g, ' ').trim();
9
+ if (rendered.length <= 56) {
10
+ return rendered || '(empty)';
11
+ }
12
+ return `${rendered.slice(0, 56)}...`;
13
+ }
14
+ export function getAllowedDirectoriesWarning(key) {
15
+ if (key !== 'allowedDirectories') {
16
+ return '';
17
+ }
18
+ return 'Set allowedDirectories to [], to grant access to full filesystem.';
19
+ }
20
+ export function renderConfigEditorLayout(payload, selectedKey, isExpanded, callToolAvailable) {
21
+ const editableKeys = payload.editableKeys;
22
+ const selectedValue = formatValueForEditor(payload.config[selectedKey]);
23
+ return `
24
+ <main id="tool-shell" class="shell tool-shell ${isExpanded ? 'expanded' : 'collapsed'}">
25
+ ${renderConfigEditorToolbar(isExpanded, callToolAvailable)}
26
+ <section id="tool-panel" class="panel">
27
+ <div id="status" class="status hidden" role="status" aria-live="polite"></div>
28
+ <div class="editor-grid">
29
+ <aside class="key-pane">
30
+ <p class="pane-title">KEYS</p>
31
+ <div id="key-accordion" class="key-accordion">
32
+ ${editableKeys.map((key) => `
33
+ <button type="button" class="key-accordion-item ${key === selectedKey ? 'active' : ''}" data-key="${escapeHtml(key)}" aria-expanded="${key === selectedKey ? 'true' : 'false'}">
34
+ <span class="key-accordion-title">${escapeHtml(key)}</span>
35
+ <span class="key-accordion-preview">${escapeHtml(renderKeyPreview(payload.config[key]))}</span>
36
+ </button>
37
+ `).join('')}
38
+ </div>
39
+ </aside>
40
+ <section class="value-pane">
41
+ <p class="pane-title">VALUE</p>
42
+ <textarea id="config-value" rows="7">${escapeHtml(selectedValue)}</textarea>
43
+ <div id="allowed-directories-controls" class="warning-row hidden">
44
+ <button id="browse-directory" type="button" class="ghost icon-only" title="Browse directories" aria-label="Browse directories">
45
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M10 4l2 2h8v12H4V4z"></path></svg>
46
+ </button>
47
+ <div id="context-warning" class="warnings hidden"></div>
48
+ </div>
49
+ <section id="directory-browser" class="browser hidden">
50
+ <div class="browser-actions browser-actions--compact">
51
+ <button id="browser-up" type="button" class="ghost icon-only" title="Up" aria-label="Up one directory">
52
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M7 14l5-5 5 5z"></path></svg>
53
+ </button>
54
+ <button id="browser-refresh" type="button" class="ghost icon-only" title="Refresh" aria-label="Refresh directory list">
55
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M17.65 6.35A7.95 7.95 0 0 0 12 4V1L7 6l5 5V7a5 5 0 1 1-5 5H5a7 7 0 1 0 12.65-5.65z"></path></svg>
56
+ </button>
57
+ <button id="browser-select-current" type="button" class="icon-only" title="Add current directory" aria-label="Add current directory">
58
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z"></path></svg>
59
+ </button>
60
+ <button id="close-browser" type="button" class="ghost icon-only" title="Close picker" aria-label="Close picker">
61
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M18.3 5.71 12 12l6.3 6.29-1.41 1.42L10.59 13.4l-6.3 6.3-1.42-1.42 6.3-6.29-6.3-6.29L4.29 4.3l6.3 6.3 6.3-6.3z"></path></svg>
62
+ </button>
63
+ </div>
64
+ <p id="browser-path" class="browser-path browser-path--compact"></p>
65
+ <div id="browser-status" class="browser-status"></div>
66
+ <div id="browser-list" class="browser-list"></div>
67
+ </section>
68
+ </section>
69
+ </div>
70
+ </section>
71
+ </main>
72
+ `;
73
+ }
74
+ export function renderEmptyState() {
75
+ return `
76
+ <main class="shell">
77
+ <section class="panel">
78
+ <h1>Config Editor</h1>
79
+ <p>No structured configuration payload is available.</p>
80
+ </section>
81
+ </main>
82
+ `;
83
+ }
@@ -0,0 +1 @@
1
+ export declare function renderConfigEditorToolbar(isExpanded: boolean, callToolAvailable: boolean): string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Toolbar renderer and event wiring for Config Editor actions. It exposes top-level controls (refresh/save/open path flows) and keeps header interaction logic localized.
3
+ */
4
+ import { renderToolHeader } from '../../../shared/tool-header.js';
5
+ export function renderConfigEditorToolbar(isExpanded, callToolAvailable) {
6
+ return renderToolHeader({
7
+ pillLabel: 'CFG',
8
+ pillClassName: 'file-pill--json',
9
+ title: 'Config Editor',
10
+ subtitle: 'Inspect and update runtime config safely.',
11
+ badges: [],
12
+ actionsHtml: `
13
+ <button class="icon-button icon-button--primary hidden" id="apply-config" type="button" title="Apply changes" aria-label="Apply changes" ${callToolAvailable ? '' : 'disabled'}>
14
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"></path></svg>
15
+ </button>
16
+ <button class="icon-button" id="toggle-expand" type="button" title="${isExpanded ? 'Collapse' : 'Expand'}" aria-label="${isExpanded ? 'Collapse' : 'Expand'}">${isExpanded
17
+ ? '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M7 14l5-5 5 5z"></path></svg>'
18
+ : '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M7 10l5 5 5-5z"></path></svg>'}</button>
19
+ `
20
+ });
21
+ }
@@ -0,0 +1,6 @@
1
+ import type { ToolCallRequest } from './contracts.js';
2
+ export declare function serializeConfigValue(raw: string): unknown;
3
+ export declare function buildSetConfigRequest(key: string, value: unknown): ToolCallRequest;
4
+ export declare function shouldAppendArrayValue(key: string, value: unknown): boolean;
5
+ export declare function formatValueForEditor(value: unknown): string;
6
+ export declare function valueToComparableJson(raw: string): string;
@@ -0,0 +1,61 @@
1
+ export function serializeConfigValue(raw) {
2
+ const trimmed = raw.trim();
3
+ if (trimmed.length === 0) {
4
+ return '';
5
+ }
6
+ if (trimmed === 'true') {
7
+ return true;
8
+ }
9
+ if (trimmed === 'false') {
10
+ return false;
11
+ }
12
+ if (trimmed === 'null') {
13
+ return null;
14
+ }
15
+ if (/^-?\d+(\.\d+)?$/.test(trimmed)) {
16
+ return Number(trimmed);
17
+ }
18
+ if ((trimmed.startsWith('[') && trimmed.endsWith(']')) || (trimmed.startsWith('{') && trimmed.endsWith('}'))) {
19
+ try {
20
+ return JSON.parse(trimmed);
21
+ }
22
+ catch {
23
+ return raw;
24
+ }
25
+ }
26
+ return raw;
27
+ }
28
+ export function buildSetConfigRequest(key, value) {
29
+ return {
30
+ name: 'set_config_value',
31
+ arguments: {
32
+ key,
33
+ value
34
+ }
35
+ };
36
+ }
37
+ export function shouldAppendArrayValue(key, value) {
38
+ return (key === 'blockedCommands' || key === 'allowedDirectories') && typeof value === 'string' && value.trim().length > 0;
39
+ }
40
+ export function formatValueForEditor(value) {
41
+ if (typeof value === 'string') {
42
+ return value;
43
+ }
44
+ if (value === undefined) {
45
+ return '';
46
+ }
47
+ try {
48
+ return JSON.stringify(value, null, 2);
49
+ }
50
+ catch {
51
+ return String(value);
52
+ }
53
+ }
54
+ export function valueToComparableJson(raw) {
55
+ try {
56
+ return JSON.stringify(serializeConfigValue(raw));
57
+ }
58
+ catch {
59
+ return raw;
60
+ }
61
+ }
@@ -0,0 +1,14 @@
1
+ export interface ConfigStructuredContent {
2
+ config: Record<string, unknown>;
3
+ editableKeys: string[];
4
+ warnings?: string[];
5
+ }
6
+ export interface ToolResultShape {
7
+ structuredContent?: ConfigStructuredContent;
8
+ }
9
+ export interface ToolCallRequest {
10
+ name: string;
11
+ arguments: Record<string, unknown>;
12
+ }
13
+ export type HostCallTool = (request: ToolCallRequest) => Promise<any>;
14
+ export declare function isObject(value: unknown): value is Record<string, unknown>;
@@ -0,0 +1,3 @@
1
+ export function isObject(value) {
2
+ return typeof value === 'object' && value !== null;
3
+ }
@@ -0,0 +1,6 @@
1
+ import type { ConfigStructuredContent } from './contracts.js';
2
+ export declare function getDefaultBrowsePath(payload: ConfigStructuredContent): string;
3
+ export declare function parseDirectoryEntries(listText: string): string[];
4
+ export declare function joinPath(basePath: string, name: string): string;
5
+ export declare function getParentPath(currentPath: string): string;
6
+ export declare function addDirectoryToEditorValue(currentRaw: string, selectedPath: string): string;
@@ -0,0 +1,71 @@
1
+ import { isObject } from './contracts.js';
2
+ import { serializeConfigValue } from './config-values.js';
3
+ export function getDefaultBrowsePath(payload) {
4
+ const configured = payload.config.allowedDirectories;
5
+ if (Array.isArray(configured) && configured.length > 0 && typeof configured[0] === 'string' && configured[0].trim().length > 0) {
6
+ return configured[0];
7
+ }
8
+ const systemInfo = payload.config.systemInfo;
9
+ if (isObject(systemInfo) && isObject(systemInfo.examplePaths) && typeof systemInfo.examplePaths.home === 'string') {
10
+ return systemInfo.examplePaths.home;
11
+ }
12
+ return '/';
13
+ }
14
+ function splitDirectoryLine(line) {
15
+ const marker = '[DIR] ';
16
+ if (!line.startsWith(marker)) {
17
+ return null;
18
+ }
19
+ return line.slice(marker.length).trim();
20
+ }
21
+ export function parseDirectoryEntries(listText) {
22
+ const lines = listText.split('\n');
23
+ const entries = [];
24
+ for (const line of lines) {
25
+ const entry = splitDirectoryLine(line.trim());
26
+ if (entry && !entry.includes('/') && !entry.includes('\\')) {
27
+ entries.push(entry);
28
+ }
29
+ }
30
+ return entries;
31
+ }
32
+ export function joinPath(basePath, name) {
33
+ if (/^[A-Za-z]:\\?$/.test(basePath)) {
34
+ return `${basePath.replace(/[\\/]+$/, '')}\\${name}`;
35
+ }
36
+ if (basePath.endsWith('/')) {
37
+ return `${basePath}${name}`;
38
+ }
39
+ if (basePath.endsWith('\\')) {
40
+ return `${basePath}${name}`;
41
+ }
42
+ return `${basePath}/${name}`;
43
+ }
44
+ export function getParentPath(currentPath) {
45
+ if (!currentPath) {
46
+ return '/';
47
+ }
48
+ if (/^[A-Za-z]:\\?$/.test(currentPath)) {
49
+ return currentPath;
50
+ }
51
+ const normalized = currentPath.replace(/[\\/]+$/, '');
52
+ if (normalized === '') {
53
+ return '/';
54
+ }
55
+ const slashIndex = Math.max(normalized.lastIndexOf('/'), normalized.lastIndexOf('\\'));
56
+ if (slashIndex <= 0) {
57
+ if (normalized.includes('\\')) {
58
+ return normalized.slice(0, slashIndex + 1) || normalized;
59
+ }
60
+ return '/';
61
+ }
62
+ return normalized.slice(0, slashIndex);
63
+ }
64
+ export function addDirectoryToEditorValue(currentRaw, selectedPath) {
65
+ const parsed = serializeConfigValue(currentRaw);
66
+ const values = Array.isArray(parsed) ? [...parsed] : [];
67
+ if (!values.includes(selectedPath)) {
68
+ values.push(selectedPath);
69
+ }
70
+ return JSON.stringify(values, null, 2);
71
+ }
@@ -0,0 +1,5 @@
1
+ import type { ConfigStructuredContent } from './contracts.js';
2
+ export declare function getAllowedDirectoriesWarning(key: string): string;
3
+ export declare function renderConfigEditorLayout(payload: ConfigStructuredContent, selectedKey: string, isExpanded: boolean, callToolAvailable: boolean): string;
4
+ export declare function renderEmptyState(): string;
5
+ export declare function escapeHtmlText(value: string): string;
@@ -0,0 +1,90 @@
1
+ import { formatValueForEditor } from './config-values.js';
2
+ import { renderConfigEditorToolbar } from './toolbar.js';
3
+ function escapeHtml(value) {
4
+ return value
5
+ .split('&').join('&amp;')
6
+ .split('<').join('&lt;')
7
+ .split('>').join('&gt;')
8
+ .split('"').join('&quot;')
9
+ .split("'").join('&#39;');
10
+ }
11
+ function renderKeyPreview(value) {
12
+ const rendered = formatValueForEditor(value).replace(/\s+/g, ' ').trim();
13
+ if (rendered.length <= 56) {
14
+ return rendered || '(empty)';
15
+ }
16
+ return `${rendered.slice(0, 56)}...`;
17
+ }
18
+ export function getAllowedDirectoriesWarning(key) {
19
+ if (key !== 'allowedDirectories') {
20
+ return '';
21
+ }
22
+ return 'Set allowedDirectories to [], to grant access to full filesystem.';
23
+ }
24
+ export function renderConfigEditorLayout(payload, selectedKey, isExpanded, callToolAvailable) {
25
+ const editableKeys = payload.editableKeys;
26
+ const selectedValue = formatValueForEditor(payload.config[selectedKey]);
27
+ return `
28
+ <main id="tool-shell" class="shell tool-shell ${isExpanded ? 'expanded' : 'collapsed'}">
29
+ ${renderConfigEditorToolbar(isExpanded, callToolAvailable)}
30
+ <section id="tool-panel" class="panel">
31
+ <div id="status" class="status hidden" role="status" aria-live="polite"></div>
32
+ <div class="editor-grid">
33
+ <aside class="key-pane">
34
+ <p class="pane-title">KEYS</p>
35
+ <div id="key-accordion" class="key-accordion">
36
+ ${editableKeys.map((key) => `
37
+ <button type="button" class="key-accordion-item ${key === selectedKey ? 'active' : ''}" data-key="${escapeHtml(key)}" aria-expanded="${key === selectedKey ? 'true' : 'false'}">
38
+ <span class="key-accordion-title">${escapeHtml(key)}</span>
39
+ <span class="key-accordion-preview">${escapeHtml(renderKeyPreview(payload.config[key]))}</span>
40
+ </button>
41
+ `).join('')}
42
+ </div>
43
+ </aside>
44
+ <section class="value-pane">
45
+ <p class="pane-title">VALUE</p>
46
+ <textarea id="config-value" rows="7">${escapeHtml(selectedValue)}</textarea>
47
+ <div id="allowed-directories-controls" class="warning-row hidden">
48
+ <button id="browse-directory" type="button" class="ghost icon-only" title="Browse directories" aria-label="Browse directories">
49
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M10 4l2 2h8v12H4V4z"></path></svg>
50
+ </button>
51
+ <div id="context-warning" class="warnings hidden"></div>
52
+ </div>
53
+ <section id="directory-browser" class="browser hidden">
54
+ <div class="browser-actions browser-actions--compact">
55
+ <button id="browser-up" type="button" class="ghost icon-only" title="Up" aria-label="Up one directory">
56
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M7 14l5-5 5 5z"></path></svg>
57
+ </button>
58
+ <button id="browser-refresh" type="button" class="ghost icon-only" title="Refresh" aria-label="Refresh directory list">
59
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M17.65 6.35A7.95 7.95 0 0 0 12 4V1L7 6l5 5V7a5 5 0 1 1-5 5H5a7 7 0 1 0 12.65-5.65z"></path></svg>
60
+ </button>
61
+ <button id="browser-select-current" type="button" class="icon-only" title="Add current directory" aria-label="Add current directory">
62
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z"></path></svg>
63
+ </button>
64
+ <button id="close-browser" type="button" class="ghost icon-only" title="Close picker" aria-label="Close picker">
65
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M18.3 5.71 12 12l6.3 6.29-1.41 1.42L10.59 13.4l-6.3 6.3-1.42-1.42 6.3-6.29-6.3-6.29L4.29 4.3l6.3 6.3 6.3-6.3z"></path></svg>
66
+ </button>
67
+ </div>
68
+ <p id="browser-path" class="browser-path browser-path--compact"></p>
69
+ <div id="browser-status" class="browser-status"></div>
70
+ <div id="browser-list" class="browser-list"></div>
71
+ </section>
72
+ </section>
73
+ </div>
74
+ </section>
75
+ </main>
76
+ `;
77
+ }
78
+ export function renderEmptyState() {
79
+ return `
80
+ <main class="shell">
81
+ <section class="panel">
82
+ <h1>Config Editor</h1>
83
+ <p>No structured configuration payload is available.</p>
84
+ </section>
85
+ </main>
86
+ `;
87
+ }
88
+ export function escapeHtmlText(value) {
89
+ return escapeHtml(value);
90
+ }
@@ -0,0 +1,2 @@
1
+ import { bootstrapConfigEditorApp } from './app.js';
2
+ bootstrapConfigEditorApp();
@@ -0,0 +1,5 @@
1
+ import type { ConfigStructuredContent } from './contracts.js';
2
+ export declare function parseConfigStructuredContent(value: unknown): ConfigStructuredContent | undefined;
3
+ export declare function extractStructuredContent(value: unknown): ConfigStructuredContent | undefined;
4
+ export declare function unwrapToolResult(value: unknown): unknown;
5
+ export declare function extractToolText(value: unknown): string;
@@ -0,0 +1,50 @@
1
+ import { isObject } from './contracts.js';
2
+ function isConfigStructuredContent(value) {
3
+ if (!isObject(value)) {
4
+ return false;
5
+ }
6
+ return isObject(value.config) && Array.isArray(value.editableKeys);
7
+ }
8
+ export function parseConfigStructuredContent(value) {
9
+ if (!isObject(value)) {
10
+ return undefined;
11
+ }
12
+ const candidate = value;
13
+ if (isConfigStructuredContent(candidate.structuredContent)) {
14
+ return candidate.structuredContent;
15
+ }
16
+ if (isConfigStructuredContent(value)) {
17
+ return value;
18
+ }
19
+ return undefined;
20
+ }
21
+ export function extractStructuredContent(value) {
22
+ if (!isObject(value)) {
23
+ return undefined;
24
+ }
25
+ if (value.method === 'ui/notifications/tool-result') {
26
+ const params = value.params;
27
+ const candidate = isObject(params) && isObject(params.result) ? params.result : params;
28
+ return parseConfigStructuredContent(candidate);
29
+ }
30
+ return parseConfigStructuredContent(value);
31
+ }
32
+ export function unwrapToolResult(value) {
33
+ if (!isObject(value)) {
34
+ return value;
35
+ }
36
+ if (isObject(value.result)) {
37
+ return value.result;
38
+ }
39
+ return value;
40
+ }
41
+ export function extractToolText(value) {
42
+ if (!isObject(value) || !Array.isArray(value.content)) {
43
+ return '';
44
+ }
45
+ const first = value.content[0];
46
+ if (!isObject(first) || typeof first.text !== 'string') {
47
+ return '';
48
+ }
49
+ return first.text;
50
+ }
@@ -0,0 +1 @@
1
+ export declare function renderConfigEditorToolbar(isExpanded: boolean, callToolAvailable: boolean): string;