@hiai-gg/docsmint 2.0.4 → 2.1.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 (309) hide show
  1. package/README.md +74 -5
  2. package/dist/backend/index.js +94475 -92073
  3. package/dist/backend-account-runtime-cleanup.js +293 -292
  4. package/dist/backend-api-key-facade.js +6 -5
  5. package/dist/backend-pipeline-cancellation.js +287 -286
  6. package/dist/client.d.ts +33 -7
  7. package/dist/client.js +55 -1
  8. package/dist/frontend/CategoryDialog-CVJi5PJu.js +602 -0
  9. package/dist/frontend/{ConfirmDialog-B1MjKlVQ.js → ConfirmDialog-0JwB8mKN.js} +5 -8
  10. package/dist/frontend/{CreateSnapshotDialog-BTMoPFdj.js → CreateSnapshotDialog-BLrtuYs5.js} +63 -68
  11. package/dist/frontend/{DatePicker-Bmjko3X7.js → DatePicker-BwSb8TRv.js} +17 -29
  12. package/dist/frontend/{DeleteDialog-BkfIeKXO.js → DeleteDialog-s7Dr6bXg.js} +51 -56
  13. package/dist/frontend/{FolderNode-Do8pIfyA.js → FolderNode-Y7cV9xeX.js} +105 -106
  14. package/dist/frontend/{FolderTreeSelector-FyxhcHjr.js → FolderTreeSelector-BR3lYmPU.js} +18 -20
  15. package/dist/frontend/HiAiEditor-BQERr-cd.js +3077 -0
  16. package/dist/frontend/{HiaiDocsExtensionProvider-Cc3yzW5I.js → HiaiDocsExtensionProvider-A2nGddUR.js} +2 -3
  17. package/dist/frontend/{Icon-3EYzvNyk.js → Icon-CiHcxcpv.js} +1 -2
  18. package/dist/frontend/SettingsDialog-BvS74JZu.js +978 -0
  19. package/dist/frontend/{ShareDialog-Ddvl7xvb.js → ShareDialog-Bo50h_Oe.js} +23 -25
  20. package/dist/frontend/Sidebar-i0kbanpg.js +2123 -0
  21. package/dist/frontend/{TagCreateDialog-DQmMJe_E.js → TagCreateDialog-DhKfsfv3.js} +78 -86
  22. package/dist/frontend/action_cancel-BdsWzQKU.js +4 -0
  23. package/dist/frontend/action_close-CVhfLPRQ.js +4 -0
  24. package/dist/frontend/action_create-ByaroO1_.js +4 -0
  25. package/dist/frontend/action_delete-SRloglWY.js +4 -0
  26. package/dist/frontend/action_go_to-DO1bicF-.js +4 -0
  27. package/dist/frontend/action_loading-iQ0KsN6i.js +4 -0
  28. package/dist/frontend/action_save-DeqrZQwV.js +4 -0
  29. package/dist/frontend/api/attachments.js +1 -2
  30. package/dist/frontend/api/categories.js +1 -2
  31. package/dist/frontend/api/documents.js +1 -2
  32. package/dist/frontend/api/folders.js +1 -2
  33. package/dist/frontend/api/settings.js +1 -2
  34. package/dist/frontend/api/share.js +1 -2
  35. package/dist/frontend/api/tags.js +1 -2
  36. package/dist/frontend/{api-keys-DIwAdYkg.js → api-keys-B63imiLr.js} +2 -3
  37. package/dist/frontend/app-shell.js +55 -79
  38. package/dist/frontend/{attachments-C225gTA7.js → attachments-Bfly-sam.js} +2 -3
  39. package/dist/frontend/{auth-client-CXR-7mIO.js → auth-client-Dx7d9Tzo.js} +409 -343
  40. package/dist/frontend/{bundle-mjs-CZ3g1Uzr.js → bundle-mjs-clTO1WW-.js} +5 -23
  41. package/dist/frontend/{camera-DtgHzfVI.js → camera-DsdOPOcD.js} +2 -3
  42. package/dist/frontend/{categories-C8AAkhCR.js → categories-CusvHb5Y.js} +3 -4
  43. package/dist/frontend/{categories_update_error-4aSI8PTr.js → categories_update_error-Cn8DBBHv.js} +2 -3
  44. package/dist/frontend/{check-DVx65aSv.js → check-DiMZRkKS.js} +2 -3
  45. package/dist/frontend/{chevron-down-C2tbZ8Ol.js → chevron-down-CxFrMFDJ.js} +2 -3
  46. package/dist/frontend/{circle-check-BAN-D7yg.js → circle-check-B4F_qgPx.js} +2 -3
  47. package/dist/frontend/{client-GbtOH90i.js → client-BDdDd84W.js} +1 -2
  48. package/dist/frontend/{clipboard-Cgzxc0_R.js → clipboard-Dt1oW6nm.js} +1 -2
  49. package/dist/frontend/{clock-ByiB0SwQ.js → clock-dcpueRk-.js} +2 -3
  50. package/dist/frontend/collaboration.js +6 -12
  51. package/dist/frontend/components/category-dialog.js +1 -2
  52. package/dist/frontend/components/create-snapshot-dialog.js +1 -2
  53. package/dist/frontend/components/delete-dialog.js +1 -2
  54. package/dist/frontend/components/editor/compact-editor.js +2 -3
  55. package/dist/frontend/components/editor/document-editor.js +1 -2
  56. package/dist/frontend/components/editor/document-title.js +3 -4
  57. package/dist/frontend/components/editor/docx-serializer.js +123 -167
  58. package/dist/frontend/components/editor/extensions.js +1 -2
  59. package/dist/frontend/components/editor/markdown-toggle.js +5 -6
  60. package/dist/frontend/components/editor/markdown.js +1 -2
  61. package/dist/frontend/components/folder-node.js +1 -2
  62. package/dist/frontend/components/folder-tree-selector.js +1 -2
  63. package/dist/frontend/components/save-as-dialog.js +86 -90
  64. package/dist/frontend/components/settings.js +1 -2
  65. package/dist/frontend/components/share-dialog.js +1 -2
  66. package/dist/frontend/components/sidebar.js +1 -2
  67. package/dist/frontend/components/tag-create-dialog.js +1 -2
  68. package/dist/frontend/components/version-history.js +177 -180
  69. package/dist/frontend/{context-D0zPFXZ4.js → context-BguSRnCt.js} +1 -2
  70. package/dist/frontend/{copy-CRzvfZGb.js → copy-Bag46YaR.js} +2 -3
  71. package/dist/frontend/dashboard.js +666 -690
  72. package/dist/frontend/{db-Dya0HRhS.js → db-B1ZV452J.js} +22 -39
  73. package/dist/frontend/{dialog-a_ZcpEC5.js → dialog-C0Bpok1d.js} +10 -18
  74. package/dist/frontend/{dist-CcHOStsA.js → dist-BlcV_BOY.js} +2 -3
  75. package/dist/frontend/{dist-qd_OnyUC.js → dist-DjId3RKL.js} +8 -21
  76. package/dist/frontend/dist-Dl9qg10h.js +301 -0
  77. package/dist/frontend/{dndzone-CDhrbpTg.js → dndzone-C62yjeG3.js} +38 -53
  78. package/dist/frontend/doc-tabs.js +1 -2
  79. package/dist/frontend/doc_title_label-BOuZzvqv.js +4 -0
  80. package/dist/frontend/doc_title_placeholder-ZxpdWWEn.js +4 -0
  81. package/dist/frontend/{document-drop-coordinator-Da7HcXgv.js → document-drop-coordinator-C_o93kKW.js} +3 -4
  82. package/dist/frontend/document-drop-coordinator.js +1 -2
  83. package/dist/frontend/{documents-CwCs1rA7.js → documents-CDJb8dv-.js} +4 -8
  84. package/dist/frontend/{dropdown-menu-DrHYReIC.js → dropdown-menu-B3nk2aM-.js} +13 -24
  85. package/dist/frontend/{editor-content-sanitizer-CWjqiz0T.js → editor-content-sanitizer-5MjSVPVn.js} +1 -2
  86. package/dist/frontend/editor-preferences.js +1 -2
  87. package/dist/frontend/{editor-preferences.svelte-Bt_A9k7n.js → editor-preferences.svelte-BpTE4mbz.js} +3 -5
  88. package/dist/frontend/{editorExtensions-DPR-CjMu.js → editorExtensions-DbiFj4tn.js} +3 -4
  89. package/dist/frontend/{editor_markdown_placeholder-BIWDUF1E.js → editor_markdown_placeholder-BztIY9Ci.js} +2 -3
  90. package/dist/frontend/{ellipsis-vertical-qxNgoXu-.js → ellipsis-vertical-Oymsv1R4.js} +2 -3
  91. package/dist/frontend/{error_dismiss-Dx_JbRjs.js → error_dismiss-C651ZdWI.js} +2 -3
  92. package/dist/frontend/error_generic-BlWqOE-a.js +4 -0
  93. package/dist/frontend/extension.js +1 -2
  94. package/dist/frontend/{folder-D74E-Kdp.js → folder-BpmB_sAy.js} +3 -5
  95. package/dist/frontend/folder-refresh.js +1 -2
  96. package/dist/frontend/{folders-CC0UWkZH.js → folders-DgKSovXa.js} +2 -3
  97. package/dist/frontend/{folders_rename-BJo4Gipq.js → folders_rename-Cxbg5GIw.js} +2 -3
  98. package/dist/frontend/frontend.css +1 -1
  99. package/dist/frontend/i18n.js +144 -145
  100. package/dist/frontend/{identity-BOA7Jejv.js → identity-B7HeOzDJ.js} +4 -5
  101. package/dist/frontend/{input-Q_7qCfnU.js → input-CbeB9220.js} +2 -3
  102. package/dist/frontend/keyboard.js +1 -2
  103. package/dist/frontend/{keyboard.svelte-CApmX0vl.js → keyboard.svelte-BBUdhTsM.js} +2 -3
  104. package/dist/frontend/{label-Dj8FDEhf.js → label-CfBWf3gI.js} +2 -3
  105. package/dist/frontend/{lib-aUbBbIW2.js → lib-CITdCbKa.js} +176 -365
  106. package/dist/frontend/{loader-circle-D3t5NkvC.js → loader-circle-skKwfRCB.js} +2 -3
  107. package/dist/frontend/markdown-6E9TWC6V.js +11 -0
  108. package/dist/frontend/offline/identity.js +1 -2
  109. package/dist/frontend/{popper-layer-force-mount-CNtiLgbV.js → popper-layer-force-mount-BG0eyrCk.js} +112 -284
  110. package/dist/frontend/{resolve-BG4HgzpN.js → resolve-DbT-KhGZ.js} +2 -3
  111. package/dist/frontend/{rolldown-runtime-DArdT4gl.js → rolldown-runtime-CwxnZyOB.js} +2 -3
  112. package/dist/frontend/{rotate-ccw-B1ybQ8oQ.js → rotate-ccw-DAUX7np7.js} +2 -3
  113. package/dist/frontend/{route-context-DYQlUfzL.js → route-context-6OHiGtfb.js} +2 -4
  114. package/dist/frontend/{runtime-CwWSo6c9.js → runtime-CGUiMzK6.js} +1 -2
  115. package/dist/frontend/{schemas-1Na35n71.js → schemas-YXxhj5o8.js} +850 -880
  116. package/dist/frontend/scroll_to_top_aria-lJc2RSx_.js +4 -0
  117. package/dist/frontend/{search-preferences-B1GdbdUc.js → search-preferences-DuLDczRu.js} +1 -2
  118. package/dist/frontend/search.js +277 -292
  119. package/dist/frontend/{search_title-DOC0cPlQ.js → search_title-BETwQYJq.js} +2 -3
  120. package/dist/frontend/{select-value-BkI1W1bn.js → select-value-BY5Hw6Rl.js} +28 -65
  121. package/dist/frontend/{settings-BRcYFQa_.js → settings-DyePuqjp.js} +3 -4
  122. package/dist/frontend/{share-D5yo0JOh.js → share-3gWTTYvH.js} +2 -3
  123. package/dist/frontend/{share-context-BJ4GF4yT.js → share-context-C2xyVP9M.js} +29 -37
  124. package/dist/frontend/{share_copied-DPxVzfWh.js → share_copied-BuAnmpbz.js} +2 -3
  125. package/dist/frontend/{share_toggle_password-DdxfIjj1.js → share_toggle_password-LEYUeHWr.js} +2 -3
  126. package/dist/frontend/shared-document.js +27 -36
  127. package/dist/frontend/{sidebar_uncategorized-qJ2_Aonf.js → sidebar_uncategorized-C5PGOflV.js} +2 -3
  128. package/dist/frontend/{sort_relevance-DwYX5MO9.js → sort_relevance-DpCVLby_.js} +2 -3
  129. package/dist/frontend/{subfolders-refresh-store.svelte-DxP21a1c.js → subfolders-refresh-store.svelte-CeyqvNpu.js} +1 -2
  130. package/dist/frontend/{tag-qbTBLj-g.js → tag-Wdfe0rKU.js} +3 -5
  131. package/dist/frontend/{tag-store.svelte-ogVCMCbv.js → tag-store.svelte-C9VYWqLQ.js} +2 -3
  132. package/dist/frontend/{tags-CF_cqzSV.js → tags-DlDVothf.js} +3 -4
  133. package/dist/frontend/{tags_load_error-BKjA1pI0.js → tags_load_error-BINNpPPV.js} +2 -3
  134. package/dist/frontend/{tags_new-BiNAJ9Bx.js → tags_new-Dw0Uy43-.js} +2 -3
  135. package/dist/frontend/{textarea-BNK0LFUK.js → textarea-D6emvAwM.js} +2 -3
  136. package/dist/frontend/theme.js +2 -3
  137. package/dist/frontend/{theme.svelte-BRdxXd-B.js → theme.svelte-BiXvrqwh.js} +7 -23
  138. package/dist/frontend/{theme_system-BBNUhYKh.js → theme_system-YIfa_2Xt.js} +2 -3
  139. package/dist/frontend/utils/clipboard.js +1 -2
  140. package/dist/frontend/utils/dndzone.js +1 -2
  141. package/dist/frontend/{utils-BovMJHdA.js → utils-CnAmIMwr.js} +2 -3
  142. package/dist/frontend/utils-DH0uqK40.js +6 -0
  143. package/dist/frontend/utils.js +1 -2
  144. package/dist/frontend/version_create_snapshot-D8xjbuCq.js +4 -0
  145. package/dist/frontend/{version_restored_from-dVRN3Zdk.js → version_restored_from-DYFFSuQj.js} +2 -3
  146. package/dist/frontend/{version_snapshot_label_placeholder-DrMikux0.js → version_snapshot_label_placeholder-BhKq1NQ7.js} +2 -3
  147. package/dist/frontend/{weekday_we-C5H_M-df.js → weekday_we-BxbzNVWR.js} +2 -3
  148. package/dist/frontend/{x-CvSSnrjl.js → x-CBUgPygC.js} +2 -3
  149. package/dist/frontend/{yjs-VUcKqaKW.js → yjs-BbwnvxgY.js} +9 -23
  150. package/dist/frontend-ssr/api/attachments.js +2 -3
  151. package/dist/frontend-ssr/api/categories.js +1 -2
  152. package/dist/frontend-ssr/api/documents.js +1 -2
  153. package/dist/frontend-ssr/api/folders.js +1 -2
  154. package/dist/frontend-ssr/api/settings.js +1 -2
  155. package/dist/frontend-ssr/api/share.js +2 -3
  156. package/dist/frontend-ssr/api/tags.js +1 -2
  157. package/dist/frontend-ssr/app-shell.js +19 -28
  158. package/dist/frontend-ssr/assets/{CategoryDialog-DuZLLlt7.js → CategoryDialog-2CCX508O.js} +17 -20
  159. package/dist/frontend-ssr/assets/{ConfirmDialog-0WVu9BCE.js → ConfirmDialog-Cc6lcY1N.js} +8 -14
  160. package/dist/frontend-ssr/assets/{CreateSnapshotDialog-3vhDTFNu.js → CreateSnapshotDialog-BB8fXF9W.js} +9 -10
  161. package/dist/frontend-ssr/assets/{DatePicker-t12leL2Y.js → DatePicker-CfzKzipR.js} +9 -15
  162. package/dist/frontend-ssr/assets/{DeleteDialog-B0AU1fJR.js → DeleteDialog-DRU4UgOW.js} +4 -5
  163. package/dist/frontend-ssr/assets/{FolderNode-C-B-s8x1.js → FolderNode-Dg_5-orQ.js} +11 -12
  164. package/dist/frontend-ssr/assets/{FolderTreeSelector-DdQuEcj0.js → FolderTreeSelector-D0reTdFS.js} +5 -7
  165. package/dist/frontend-ssr/assets/{HiAiEditor-Bj6tiE97.js → HiAiEditor-DeHWAIj-.js} +44 -69
  166. package/dist/frontend-ssr/assets/{HiaiDocsExtensionProvider-BRKWmcDd.js → HiaiDocsExtensionProvider-D6cGL-9s.js} +2 -3
  167. package/dist/frontend-ssr/assets/{Icon-DE_3EnuF.js → Icon-CrIRbT5O.js} +4 -8
  168. package/dist/frontend-ssr/assets/{SettingsDialog-h4SFwpUa.js → SettingsDialog-BpHY3IMb.js} +29 -40
  169. package/dist/frontend-ssr/assets/{ShareDialog-CpE9zd_f.js → ShareDialog-CY40nWZJ.js} +7 -9
  170. package/dist/frontend-ssr/assets/{Sidebar-BFBpsd3L.js → Sidebar-fpYk5MGO.js} +55 -63
  171. package/dist/frontend-ssr/assets/{TagCreateDialog-DBHO1DPU.js → TagCreateDialog-C2tpdEuj.js} +13 -14
  172. package/dist/frontend-ssr/assets/{action_cancel-OVgQDP5Q.js → action_cancel-CsBbxW0m.js} +2 -3
  173. package/dist/frontend-ssr/assets/{action_close-DagDyMXk.js → action_close-lFKBqBwg.js} +2 -3
  174. package/dist/frontend-ssr/assets/{action_create-hqJWjyqh.js → action_create-BV4ZOcQW.js} +2 -3
  175. package/dist/frontend-ssr/assets/{action_delete-B1-16jSo.js → action_delete-CNmRhKQP.js} +2 -3
  176. package/dist/frontend-ssr/assets/{action_go_to-DQScgw7P.js → action_go_to-tN5I26xM.js} +2 -3
  177. package/dist/frontend-ssr/assets/{action_save-Bx7vlLZI.js → action_save-YCfMiKb4.js} +2 -3
  178. package/dist/frontend-ssr/assets/{api-keys-CHOrbU-Q.js → api-keys-G6oimJIv.js} +2 -3
  179. package/dist/frontend-ssr/assets/{auth-client-BC4hSFKF.js → auth-client-BnnnJDAb.js} +368 -256
  180. package/dist/frontend-ssr/assets/{camera-B6ldo_Js.js → camera-OYNSMvMd.js} +2 -3
  181. package/dist/frontend-ssr/assets/{categories-C_dxFoHi.js → categories-bBPviKjl.js} +2 -3
  182. package/dist/frontend-ssr/assets/{categories_update_error-DkKgsqdD.js → categories_update_error-Bfx5vtvt.js} +11 -21
  183. package/dist/frontend-ssr/assets/{chevron-down-DQcr6JUc.js → chevron-down-DB6YsSbQ.js} +2 -3
  184. package/dist/frontend-ssr/assets/{chevron-right-9szrliZx.js → chevron-right-DOt2uY6b.js} +2 -3
  185. package/dist/frontend-ssr/assets/{circle-check-BgP9MRRv.js → circle-check-DQhTm9YR.js} +2 -3
  186. package/dist/frontend-ssr/assets/{client-rfwQYYHY.js → client-B2AniXwV.js} +1 -2
  187. package/dist/frontend-ssr/assets/{clipboard-CXOaoz2W.js → clipboard-CXKnyYba.js} +1 -2
  188. package/dist/frontend-ssr/assets/{clock-roNtGlT6.js → clock-B08dVWtf.js} +2 -3
  189. package/dist/frontend-ssr/assets/{context-Bi_mO-NS.js → context-C_xxvxnR.js} +1 -2
  190. package/dist/frontend-ssr/assets/{copy-BYqYnBIQ.js → copy-2jsznHar.js} +2 -3
  191. package/dist/frontend-ssr/assets/{db-C3rFdTZa.js → db-BEKLU5Fc.js} +2 -3
  192. package/dist/frontend-ssr/assets/{dialog-SqCnTT43.js → dialog-C6U-DqLr.js} +9 -17
  193. package/dist/frontend-ssr/assets/{dist-CaZQ1FhA.js → dist-DqXTz_zE.js} +9 -12
  194. package/dist/frontend-ssr/assets/{dist-CqxHwOlp.js → dist-ip9bPdma.js} +3 -6
  195. package/dist/frontend-ssr/assets/{dndzone-CnTCMhPd.js → dndzone-Dx3jt_e4.js} +4 -6
  196. package/dist/frontend-ssr/assets/{doc_title_label-Ev_ltlh3.js → doc_title_label-CE_l-Gum.js} +2 -3
  197. package/dist/frontend-ssr/assets/{doc_title_placeholder-DSHpUb7w.js → doc_title_placeholder-7_i7PtG6.js} +2 -3
  198. package/dist/frontend-ssr/assets/{document-drop-coordinator-CEaYACsC.js → document-drop-coordinator-BVytYy2K.js} +1 -2
  199. package/dist/frontend-ssr/assets/{documents-CEuA1V6N.js → documents-B_wpQFTh.js} +2 -3
  200. package/dist/frontend-ssr/assets/{dropdown-menu-CE6U0f1b.js → dropdown-menu-BS5fcN9l.js} +12 -23
  201. package/dist/frontend-ssr/assets/{editor-content-sanitizer-Gjm93iR-.js → editor-content-sanitizer-CIdFjBSC.js} +1 -2
  202. package/dist/frontend-ssr/assets/{editor-preferences.svelte-iI5jJM1x.js → editor-preferences.svelte-CdAXTd-I.js} +2 -4
  203. package/dist/frontend-ssr/assets/{editorExtensions-rhletNji.js → editorExtensions-2O7O2Nhv.js} +2 -3
  204. package/dist/frontend-ssr/assets/{editor_markdown_placeholder-BpezdkOr.js → editor_markdown_placeholder-CAeLJjFT.js} +3 -5
  205. package/dist/frontend-ssr/assets/{editor_toolbar_undo-CKJAOqv2.js → editor_toolbar_undo-CVCfQIS1.js} +29 -57
  206. package/dist/frontend-ssr/assets/{ellipsis-vertical-Cg1MrZsl.js → ellipsis-vertical-IFHt2NM1.js} +2 -3
  207. package/dist/frontend-ssr/assets/{error_generic-DTK0kwxT.js → error_generic-BB80i0Vk.js} +3 -5
  208. package/dist/frontend-ssr/assets/{folder-DHB-CEcQ.js → folder-CXa1_bm5.js} +2 -3
  209. package/dist/frontend-ssr/assets/{folders-BOXeb9hz.js → folders-CTLqWbMm.js} +2 -3
  210. package/dist/frontend-ssr/assets/{folders_rename-DvciOb6K.js → folders_rename-ydbfwQlj.js} +7 -13
  211. package/dist/frontend-ssr/assets/{identity-DNIo1bgc.js → identity-DTz1SQwC.js} +2 -3
  212. package/dist/frontend-ssr/assets/{input-DVrBVPgs.js → input-Bxw9sFF0.js} +2 -3
  213. package/dist/frontend-ssr/assets/{keyboard.svelte-BgF47N3L.js → keyboard.svelte-njehUCm3.js} +1 -2
  214. package/dist/frontend-ssr/assets/{label-vtCK3pTp.js → label-CMWedjs6.js} +2 -3
  215. package/dist/frontend-ssr/assets/{loader-circle-D3NWhCif.js → loader-circle-zbKj9Qb-.js} +2 -3
  216. package/dist/frontend-ssr/assets/{markdown-Co31-Tl2.js → markdown-BmIhDQp7.js} +2 -3
  217. package/dist/frontend-ssr/assets/{popper-layer-force-mount-C4dMMt-f.js → popper-layer-force-mount-CSHZsG2E.js} +78 -156
  218. package/dist/frontend-ssr/assets/{resolve-BqHozBXl.js → resolve-Wqdff4CL.js} +1 -2
  219. package/dist/frontend-ssr/assets/{rotate-ccw-DNf3nwMD.js → rotate-ccw-B7SaTFWf.js} +2 -3
  220. package/dist/frontend-ssr/assets/{route-context-BPRerEtZ.js → route-context-BsqLFt5Y.js} +2 -4
  221. package/dist/frontend-ssr/assets/{runtime-O78RzRqx.js → runtime-BX6-jTn_.js} +1 -2
  222. package/dist/frontend-ssr/assets/{scroll_to_top_aria-BN4ZfOnM.js → scroll_to_top_aria-CAYSiGHO.js} +2 -3
  223. package/dist/frontend-ssr/assets/{search_title-CKUsQDT0.js → search_title-C7NVXXq3.js} +2 -3
  224. package/dist/frontend-ssr/assets/{search_toggle_filters-hS9rvQhC.js → search_toggle_filters-Bq_YVD8s.js} +15 -29
  225. package/dist/frontend-ssr/assets/{select-value-Ce5c_fuA.js → select-value-TgslfiUB.js} +18 -34
  226. package/dist/frontend-ssr/assets/{settings-DWCpfCPj.js → settings-B1MA_FjO.js} +3 -4
  227. package/dist/frontend-ssr/assets/{share-context-B4UpvTSw.js → share-context-RVh8AExX.js} +17 -22
  228. package/dist/frontend-ssr/assets/{share_copied-BxU9rjXG.js → share_copied-CrwEwkb3.js} +31 -61
  229. package/dist/frontend-ssr/assets/{share_toggle_password-C6OmroqR.js → share_toggle_password-Co56z0Ha.js} +11 -21
  230. package/dist/frontend-ssr/assets/{sidebar_uncategorized-Dx-LTd5w.js → sidebar_uncategorized-COWdmZ3d.js} +6 -11
  231. package/dist/frontend-ssr/assets/{subfolders-refresh-store.svelte-CXHxQWKh.js → subfolders-refresh-store.svelte-LxG18U0n.js} +1 -2
  232. package/dist/frontend-ssr/assets/{tag-Cqv0fWVG.js → tag-BGhtDKpP.js} +3 -5
  233. package/dist/frontend-ssr/assets/{tag-store.svelte-QRysvGKe.js → tag-store.svelte-CUUgAaDD.js} +2 -3
  234. package/dist/frontend-ssr/assets/{tags-BBCoFYro.js → tags-C7u-LBsl.js} +2 -3
  235. package/dist/frontend-ssr/assets/{tags_load_error-CPrc6Gzs.js → tags_load_error-DW4FbHvr.js} +19 -37
  236. package/dist/frontend-ssr/assets/{tags_new-VmMr9v2V.js → tags_new-Dr3ByMPZ.js} +4 -7
  237. package/dist/frontend-ssr/assets/{textarea-BdjOJJVb.js → textarea-Bz5Tz4rw.js} +2 -3
  238. package/dist/frontend-ssr/assets/{theme.svelte-D6bbaJ9m.js → theme.svelte-CdHah46l.js} +3 -5
  239. package/dist/frontend-ssr/assets/{theme_system-BucaNntV.js → theme_system-E97FASeq.js} +19 -37
  240. package/dist/frontend-ssr/assets/{utils-DvZnctjz.js → utils-085zSPe5.js} +1 -2
  241. package/dist/frontend-ssr/assets/{utils-D3X7I8nz.js → utils-DF6CmRDX.js} +1 -2
  242. package/dist/frontend-ssr/assets/{version_create_snapshot-COHzwjle.js → version_create_snapshot-DeeYB7bb.js} +2 -3
  243. package/dist/frontend-ssr/assets/{version_restored_from-CertjFDl.js → version_restored_from-CTt2LM4A.js} +13 -25
  244. package/dist/frontend-ssr/assets/{version_snapshot_label_placeholder-Cy_rMCij.js → version_snapshot_label_placeholder-BbGD9YuN.js} +12 -23
  245. package/dist/frontend-ssr/assets/{weekday_we-DrI3U230.js → weekday_we-BzGQ-iFc.js} +22 -43
  246. package/dist/frontend-ssr/collaboration.js +2 -4
  247. package/dist/frontend-ssr/components/category-dialog.js +1 -2
  248. package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -2
  249. package/dist/frontend-ssr/components/delete-dialog.js +1 -2
  250. package/dist/frontend-ssr/components/editor/compact-editor.js +2 -3
  251. package/dist/frontend-ssr/components/editor/document-editor.js +1 -2
  252. package/dist/frontend-ssr/components/editor/document-title.js +3 -4
  253. package/dist/frontend-ssr/components/editor/docx-serializer.js +1 -2
  254. package/dist/frontend-ssr/components/editor/extensions.js +1 -2
  255. package/dist/frontend-ssr/components/editor/markdown-toggle.js +4 -5
  256. package/dist/frontend-ssr/components/editor/markdown.js +1 -2
  257. package/dist/frontend-ssr/components/folder-node.js +1 -2
  258. package/dist/frontend-ssr/components/folder-tree-selector.js +1 -2
  259. package/dist/frontend-ssr/components/save-as-dialog.js +12 -13
  260. package/dist/frontend-ssr/components/settings.js +1 -2
  261. package/dist/frontend-ssr/components/share-dialog.js +1 -2
  262. package/dist/frontend-ssr/components/sidebar.js +1 -2
  263. package/dist/frontend-ssr/components/tag-create-dialog.js +1 -2
  264. package/dist/frontend-ssr/components/version-history.js +18 -21
  265. package/dist/frontend-ssr/dashboard.js +64 -88
  266. package/dist/frontend-ssr/doc-tabs.js +1 -2
  267. package/dist/frontend-ssr/document-drop-coordinator.js +1 -2
  268. package/dist/frontend-ssr/editor-preferences.js +1 -2
  269. package/dist/frontend-ssr/extension.js +1 -2
  270. package/dist/frontend-ssr/folder-refresh.js +1 -2
  271. package/dist/frontend-ssr/i18n.js +315 -603
  272. package/dist/frontend-ssr/keyboard.js +1 -2
  273. package/dist/frontend-ssr/offline/identity.js +1 -2
  274. package/dist/frontend-ssr/search.js +17 -20
  275. package/dist/frontend-ssr/shared-document.js +5 -8
  276. package/dist/frontend-ssr/theme.js +2 -3
  277. package/dist/frontend-ssr/utils/clipboard.js +1 -2
  278. package/dist/frontend-ssr/utils/dndzone.js +1 -2
  279. package/dist/frontend-ssr/utils.js +1 -2
  280. package/dist/index.d.ts +1 -1
  281. package/dist/index.js +1 -1
  282. package/dist/lifecycle-runtime.js +3998 -17872
  283. package/dist/mcp-cli.js +357 -78
  284. package/dist/mcp-server.d.ts +92 -23
  285. package/dist/mcp-server.js +525 -78
  286. package/dist/types.d.ts +68 -1
  287. package/package.json +5 -5
  288. package/packages/cli/src/index.ts +1 -1
  289. package/packages/db/src/schema.ts +3 -1
  290. package/server.json +2 -2
  291. package/dist/frontend/CategoryDialog-CJeAYxcd.js +0 -630
  292. package/dist/frontend/HiAiEditor-DDpfdQEg.js +0 -3129
  293. package/dist/frontend/SettingsDialog-DzlYW50I.js +0 -991
  294. package/dist/frontend/Sidebar-rFiVen96.js +0 -2149
  295. package/dist/frontend/action_cancel-Cuxsznzz.js +0 -5
  296. package/dist/frontend/action_close-BJm_52wm.js +0 -5
  297. package/dist/frontend/action_create-CtBQrRuj.js +0 -5
  298. package/dist/frontend/action_delete-BXBIzvn0.js +0 -5
  299. package/dist/frontend/action_go_to-VmK5jmEk.js +0 -5
  300. package/dist/frontend/action_loading-BLCGJVA9.js +0 -5
  301. package/dist/frontend/action_save-BRN2Z_GP.js +0 -5
  302. package/dist/frontend/dist-DcHl92QO.js +0 -316
  303. package/dist/frontend/doc_title_label-DS9jSIh2.js +0 -5
  304. package/dist/frontend/doc_title_placeholder-DBQpM1aH.js +0 -5
  305. package/dist/frontend/error_generic-CzNtmBT4.js +0 -5
  306. package/dist/frontend/markdown-O9YJA70S.js +0 -12
  307. package/dist/frontend/scroll_to_top_aria-CvkNF_Hu.js +0 -5
  308. package/dist/frontend/utils-BlHvR6OL.js +0 -7
  309. package/dist/frontend/version_create_snapshot-3bu-0qzH.js +0 -5
package/dist/mcp-cli.js CHANGED
@@ -4,8 +4,190 @@
4
4
  // ../mcp-server/src/index.ts
5
5
  import { serveStdio } from "@modelcontextprotocol/server/stdio";
6
6
 
7
- // ../mcp-server/src/server.ts
8
- import { McpServer } from "@modelcontextprotocol/server";
7
+ // ../mcp-server/src/argument-diagnostics.ts
8
+ import {
9
+ McpServer
10
+ } from "@modelcontextprotocol/server";
11
+ var contracts = new WeakMap;
12
+ function object(value) {
13
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
14
+ }
15
+ function captureMcpInputSchema(server, name, schema) {
16
+ let registered = contracts.get(server);
17
+ if (!registered) {
18
+ registered = new Map;
19
+ contracts.set(server, registered);
20
+ }
21
+ registered.set(name, {
22
+ validate: (value) => schema["~standard"].validate(value, undefined),
23
+ jsonSchema: () => schema["~standard"].jsonSchema.input({ target: "draft-2020-12" })
24
+ });
25
+ return schema;
26
+ }
27
+ var codes = new Set([
28
+ "invalid_type",
29
+ "too_big",
30
+ "too_small",
31
+ "invalid_format",
32
+ "not_multiple_of",
33
+ "unrecognized_keys",
34
+ "invalid_union",
35
+ "invalid_key",
36
+ "invalid_element",
37
+ "invalid_value",
38
+ "custom"
39
+ ]);
40
+ function diagnostics(tool, input, schemaValue, issues) {
41
+ const schema = object(schemaValue) ?? {};
42
+ const branches = Array.isArray(schema.oneOf) ? schema.oneOf.map((item) => object(item) ?? {}) : [schema];
43
+ const knownFields = new Set;
44
+ function fields(value) {
45
+ const item = object(value);
46
+ if (!item)
47
+ return;
48
+ for (const [name, child] of Object.entries(object(item.properties) ?? {})) {
49
+ knownFields.add(name);
50
+ fields(child);
51
+ }
52
+ if (item.items)
53
+ fields(item.items);
54
+ for (const key of ["oneOf", "anyOf", "allOf"])
55
+ if (Array.isArray(item[key]))
56
+ for (const child of item[key])
57
+ fields(child);
58
+ }
59
+ fields(schema);
60
+ const args = object(input) ?? {};
61
+ const selector = ["mode", "action", "view", "kind"].find((key) => branches.some((branch) => {
62
+ const property = object(object(branch.properties)?.[key]);
63
+ return property && (typeof property.const === "string" || Array.isArray(property.enum));
64
+ }));
65
+ const variants = branches.map((branch) => {
66
+ const property = selector ? object(object(branch.properties)?.[selector]) : undefined;
67
+ const values = property && typeof property.const === "string" ? [property.const] : Array.isArray(property?.enum) ? property.enum.filter((value) => typeof value === "string") : [];
68
+ return {
69
+ values,
70
+ required: Array.isArray(branch.required) ? branch.required.filter((value) => typeof value === "string" && knownFields.has(value)) : []
71
+ };
72
+ });
73
+ const selected = selector ? args[selector] : undefined;
74
+ const branch = typeof selected === "string" && variants.some((variant) => variant.values.includes(selected)) ? selected : null;
75
+ return {
76
+ tool,
77
+ branch,
78
+ expectedArgs: variants.map((variant) => ({
79
+ branches: variant.values,
80
+ required: variant.required
81
+ })),
82
+ issues: issues.slice(0, 32).map((value) => {
83
+ const issue = object(value) ?? {};
84
+ const path = Array.isArray(issue.path) ? issue.path.map((part) => object(part)?.key ?? part).filter((part) => typeof part === "string" ? knownFields.has(part) : typeof part === "number" && Number.isInteger(part) && part >= 0 && part < 1e4) : [];
85
+ return {
86
+ path,
87
+ code: typeof issue.code === "string" && codes.has(issue.code) ? issue.code : "invalid_argument"
88
+ };
89
+ })
90
+ };
91
+ }
92
+ function decorateMcpArgumentTransport(transport, server) {
93
+ const pending = new Map;
94
+ let closed = false;
95
+ let overflowed = false;
96
+ function remember(message) {
97
+ if (closed || overflowed)
98
+ return;
99
+ if (!("method" in message) || !("id" in message) || typeof message.id !== "string" && typeof message.id !== "number")
100
+ return;
101
+ const previous = pending.get(message.id);
102
+ if (previous) {
103
+ previous.count++;
104
+ previous.ambiguous = true;
105
+ previous.candidate = undefined;
106
+ return;
107
+ }
108
+ if (pending.size >= 1024) {
109
+ overflowed = true;
110
+ pending.clear();
111
+ return;
112
+ }
113
+ const params = "params" in message ? object(message.params) : undefined;
114
+ const name = params?.name;
115
+ const contract = message.method === "tools/call" && typeof name === "string" ? contracts.get(server)?.get(name) : undefined;
116
+ pending.set(message.id, {
117
+ count: 1,
118
+ ambiguous: false,
119
+ ...contract && typeof name === "string" ? { candidate: { tool: name, args: params?.arguments ?? {}, contract } } : {}
120
+ });
121
+ }
122
+ async function send(message, options) {
123
+ const id = "id" in message && (typeof message.id === "string" || typeof message.id === "number") && !("method" in message) ? message.id : undefined;
124
+ const entry = id === undefined ? undefined : pending.get(id);
125
+ let outgoing = message;
126
+ try {
127
+ const candidate = entry && !entry.ambiguous ? entry.candidate : undefined;
128
+ const result = "result" in message ? object(message.result) : undefined;
129
+ const block = result && Array.isArray(result.content) && result.content.length === 1 ? object(result.content[0]) : undefined;
130
+ if (id !== undefined && candidate && result?.isError === true && Object.keys(result).length === 2 && block?.type === "text" && Object.keys(block).length === 2 && typeof block.text === "string" && block.text.startsWith(`Input validation error: Invalid arguments for tool ${candidate.tool}:`)) {
131
+ try {
132
+ const validation = object(await candidate.contract.validate(candidate.args));
133
+ if (Array.isArray(validation?.issues) && validation.issues.length && !entry?.ambiguous && pending.get(id) === entry) {
134
+ const data = diagnostics(candidate.tool, candidate.args, candidate.contract.jsonSchema(), validation.issues);
135
+ outgoing = {
136
+ jsonrpc: "2.0",
137
+ id,
138
+ error: { code: -32602, message: "Invalid tool arguments", data }
139
+ };
140
+ }
141
+ } catch {}
142
+ }
143
+ await transport.send(outgoing, options);
144
+ } finally {
145
+ if (id !== undefined && entry && pending.get(id) === entry && --entry.count === 0)
146
+ pending.delete(id);
147
+ }
148
+ }
149
+ return new Proxy(transport, {
150
+ get(target, property) {
151
+ if (property === "send")
152
+ return send;
153
+ if (property === "close")
154
+ return async () => {
155
+ closed = true;
156
+ pending.clear();
157
+ await target.close();
158
+ };
159
+ const value = Reflect.get(target, property, target);
160
+ return typeof value === "function" ? value.bind(target) : value;
161
+ },
162
+ set(target, property, value) {
163
+ if (property === "onmessage")
164
+ return Reflect.set(target, property, (message, extra) => {
165
+ try {
166
+ remember(message);
167
+ } catch {
168
+ overflowed = true;
169
+ pending.clear();
170
+ }
171
+ if (typeof value === "function")
172
+ value(message, extra);
173
+ }, target);
174
+ if (property === "onclose")
175
+ return Reflect.set(target, property, () => {
176
+ closed = true;
177
+ pending.clear();
178
+ if (typeof value === "function")
179
+ value();
180
+ }, target);
181
+ return Reflect.set(target, property, value, target);
182
+ }
183
+ });
184
+ }
185
+
186
+ class DocsMintMcpServer extends McpServer {
187
+ connect(transport) {
188
+ return super.connect(decorateMcpArgumentTransport(transport, this));
189
+ }
190
+ }
9
191
 
10
192
  // dist/client.js
11
193
  var docsApiErrorBrand = Symbol.for("io.github.hiai-gg.docsmint.DocsApiError");
@@ -58,11 +240,15 @@ class DocsTimeoutError extends DocsNetworkError {
58
240
  class DocsClient {
59
241
  config;
60
242
  constructor(config) {
243
+ if (config.apiPrefix !== undefined && config.apiPrefix !== "/api" && config.apiPrefix !== "/api/v1") {
244
+ throw new Error("DocsClient: apiPrefix must be /api or /api/v1");
245
+ }
61
246
  if (!config.baseUrl) {
62
247
  throw new Error("DocsClient: `baseUrl` is required");
63
248
  }
64
249
  this.config = {
65
250
  baseUrl: config.baseUrl.replace(/\/+$/, ""),
251
+ apiPrefix: config.apiPrefix ?? "/api",
66
252
  apiKey: config.apiKey,
67
253
  requestContext: this.snapshotContext(config.requestContext),
68
254
  fetch: config.fetch ?? fetch,
@@ -102,6 +288,16 @@ class DocsClient {
102
288
  return this.request("GET", "/api/documents", {
103
289
  query: this.cleanQuery({
104
290
  folderId: options?.folderId,
291
+ categoryId: options?.categoryId,
292
+ visibility: options?.visibility,
293
+ rootOnly: options?.rootOnly,
294
+ tagIds: options?.tagIds?.join(","),
295
+ tagMatch: options?.tagMatch,
296
+ q: options?.q,
297
+ updatedFrom: options?.updatedFrom,
298
+ updatedTo: options?.updatedTo,
299
+ sortBy: options?.sortBy,
300
+ sortOrder: options?.sortOrder,
105
301
  tag: options?.tag,
106
302
  page: options?.page,
107
303
  limit: options?.limit
@@ -112,6 +308,15 @@ class DocsClient {
112
308
  return this.request("GET", "/api/documents/cursor", {
113
309
  query: this.cleanQuery({
114
310
  categoryId: options.categoryId,
311
+ folderId: options.folderId,
312
+ rootOnly: options.rootOnly,
313
+ tag: options.tag,
314
+ tagIds: options.tagIds?.join(","),
315
+ tagMatch: options.tagMatch,
316
+ visibility: options.visibility,
317
+ q: options.q,
318
+ updatedFrom: options.updatedFrom,
319
+ updatedTo: options.updatedTo,
115
320
  cursor: options.cursor,
116
321
  limit: options.limit,
117
322
  sortBy: options.sortBy,
@@ -143,6 +348,14 @@ class DocsClient {
143
348
  async unpublishDoc(id, context) {
144
349
  return this.request("POST", `/api/documents/${encodeURIComponent(id)}/unpublish`, undefined, context);
145
350
  }
351
+ async exportDocWithMetadata(id, context) {
352
+ const response = await this.fetchRaw("GET", `/api/documents/${encodeURIComponent(id)}/export`, { query: { format: "json" } }, context);
353
+ if (!response.ok)
354
+ throw await this.toApiError(response);
355
+ if (response.headers.get("content-type")?.includes("json"))
356
+ return response.json();
357
+ return { markdown: await response.text() };
358
+ }
146
359
  async exportDoc(id, context) {
147
360
  return this.getDocMarkdown(id, context);
148
361
  }
@@ -226,6 +439,12 @@ class DocsClient {
226
439
  async revokeApiKey(id, context) {
227
440
  return this.request("DELETE", `/api/keys/${encodeURIComponent(id)}`, undefined, context);
228
441
  }
442
+ async whoami(context) {
443
+ return this.request("GET", "/api/whoami", undefined, context);
444
+ }
445
+ async listWorkspaces(context) {
446
+ return this.request("GET", "/api/workspaces", undefined, context);
447
+ }
229
448
  async search(query, options, context) {
230
449
  return this.request("GET", "/api/search", {
231
450
  query: this.cleanQuery({
@@ -241,7 +460,8 @@ class DocsClient {
241
460
  graph: options?.graph,
242
461
  graphHops: options?.graphHops,
243
462
  graphBoost: options?.graphBoost,
244
- includeChunks: options?.includeChunks
463
+ includeChunks: options?.includeChunks,
464
+ includeDiagnostics: options?.includeDiagnostics
245
465
  })
246
466
  }, context);
247
467
  }
@@ -431,7 +651,8 @@ class DocsClient {
431
651
  throw this.wrapNetworkError(lastError, requestContext?.requestId);
432
652
  }
433
653
  buildUrl(path, query) {
434
- let url = `${this.config.baseUrl}${path}`;
654
+ const resolvedPath = path.startsWith("/api/") ? `${this.config.apiPrefix}${path.slice(4)}` : path;
655
+ let url = `${this.config.baseUrl}${resolvedPath}`;
435
656
  if (query && Object.keys(query).length > 0) {
436
657
  const params = new URLSearchParams;
437
658
  for (const [key, value] of Object.entries(query)) {
@@ -725,6 +946,12 @@ var folderSchema = z.looseObject({
725
946
  documents: z.array(documentListItemSchema).optional()
726
947
  });
727
948
  var exportedDocumentSchema = z.looseObject({
949
+ id: z.string().optional(),
950
+ title: z.string().optional(),
951
+ updatedAt: z.string().optional(),
952
+ workspaceId: z.string().nullable().optional(),
953
+ workspaceSlug: z.string().nullable().optional(),
954
+ url: z.string().nullable().optional(),
728
955
  markdown: z.string(),
729
956
  filename: z.string().optional()
730
957
  });
@@ -950,7 +1177,9 @@ function createMcpDocsClient(docsClient, requestContext) {
950
1177
  search: (params) => docsClient.search(params.query, {
951
1178
  folder: params.folder,
952
1179
  tags: params.tags?.join(","),
953
- limit: params.limit
1180
+ limit: params.limit,
1181
+ includeChunks: params.includeChunks,
1182
+ includeDiagnostics: params.includeDiagnostics
954
1183
  }, context),
955
1184
  getDocument: (id) => docsClient.getDoc(id, context),
956
1185
  createDocument: (input) => docsClient.createDoc({
@@ -971,7 +1200,7 @@ function createMcpDocsClient(docsClient, requestContext) {
971
1200
  refreshDocumentIndex: (documentId) => docsClient.refreshDocumentIndex(documentId, context),
972
1201
  createSnapshot: (documentId, input) => docsClient.createSnapshot(documentId, input, context),
973
1202
  getVersionHistory: (documentId, onlySnapshots) => docsClient.listVersions(documentId, { onlySnapshots }, context),
974
- exportDocument: async (id) => ({ markdown: await docsClient.exportDoc(id, context) })
1203
+ exportDocument: (id) => docsClient.exportDocWithMetadata(id, context)
975
1204
  };
976
1205
  }
977
1206
  function createDefaultDocsClient() {
@@ -988,13 +1217,38 @@ var client = new Proxy({}, {
988
1217
 
989
1218
  // ../mcp-server/src/client-routing-schema.ts
990
1219
  import { z as z2 } from "zod";
1220
+ function canonical(value) {
1221
+ if (Array.isArray(value))
1222
+ return `[${value.map(canonical).join(",")}]`;
1223
+ if (value && typeof value === "object")
1224
+ return `{${Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`).join(",")}}`;
1225
+ return JSON.stringify(value) ?? "null";
1226
+ }
1227
+ function mergePropertyVariants(values) {
1228
+ const unique = [
1229
+ ...new Map(values.map((value) => [canonical(value), value])).values()
1230
+ ];
1231
+ if (unique.length === 1)
1232
+ return unique[0];
1233
+ const literalObjects = unique.filter((value) => value && typeof value === "object" && ("const" in value));
1234
+ if (literalObjects.length === unique.length) {
1235
+ const withoutConst = literalObjects.map(({ const: _literal, ...rest }) => rest);
1236
+ if (withoutConst.every((value) => canonical(value) === canonical(withoutConst[0]))) {
1237
+ return {
1238
+ ...withoutConst[0],
1239
+ enum: literalObjects.map((value) => value.const)
1240
+ };
1241
+ }
1242
+ }
1243
+ return { anyOf: unique };
1244
+ }
991
1245
  function hoistObjectUnionClosure(schema) {
992
1246
  const variants = schema.oneOf;
993
- if (!Array.isArray(variants) || !variants.every((variant2) => typeof variant2 === "object" && variant2 !== null && variant2.type === "object" && variant2.additionalProperties === false && typeof variant2.properties === "object" && variant2.properties !== null))
1247
+ if (!Array.isArray(variants) || !variants.every((variant) => typeof variant === "object" && variant !== null && variant.type === "object" && variant.additionalProperties === false && typeof variant.properties === "object" && variant.properties !== null))
994
1248
  return schema;
995
1249
  const propertyVariants = new Map;
996
- for (const variant2 of variants) {
997
- for (const [key, property] of Object.entries(variant2.properties)) {
1250
+ for (const variant of variants) {
1251
+ for (const [key, property] of Object.entries(variant.properties)) {
998
1252
  const values = propertyVariants.get(key) ?? [];
999
1253
  values.push(property);
1000
1254
  propertyVariants.set(key, values);
@@ -1005,12 +1259,12 @@ function hoistObjectUnionClosure(schema) {
1005
1259
  type: "object",
1006
1260
  properties: Object.fromEntries([...propertyVariants].map(([key, values]) => [
1007
1261
  key,
1008
- values.length === 1 ? values[0] : { anyOf: values }
1262
+ mergePropertyVariants(values)
1009
1263
  ])),
1010
1264
  additionalProperties: false,
1011
- oneOf: variants.map((variant2) => {
1012
- const { additionalProperties: _closure, ...branch } = variant2;
1013
- const excluded = [...propertyVariants.keys()].filter((key) => !(key in variant2.properties));
1265
+ oneOf: variants.map((variant) => {
1266
+ const { additionalProperties: _closure, ...branch } = variant;
1267
+ const excluded = [...propertyVariants.keys()].filter((key) => !(key in variant.properties));
1014
1268
  return excluded.length === 0 ? branch : {
1015
1269
  ...branch,
1016
1270
  allOf: [
@@ -1033,11 +1287,21 @@ function withClientRoutingSchema(schema) {
1033
1287
  const { workspaceId, ...args } = value;
1034
1288
  const selected = selector.safeParse(workspaceId);
1035
1289
  if (!selected.success)
1036
- return { issues: selected.error.issues };
1290
+ return {
1291
+ issues: selected.error.issues.map((issue) => ({
1292
+ ...issue,
1293
+ path: ["workspaceId", ...issue.path]
1294
+ }))
1295
+ };
1037
1296
  const validated = await standard.validate(args, options);
1038
1297
  if (validated.issues)
1039
1298
  return validated;
1040
- return { value: { ...validated.value, ...selected.data ? { workspaceId: selected.data } : {} } };
1299
+ return {
1300
+ value: {
1301
+ ...validated.value,
1302
+ ...selected.data ? { workspaceId: selected.data } : {}
1303
+ }
1304
+ };
1041
1305
  },
1042
1306
  jsonSchema: {
1043
1307
  ...standard.jsonSchema,
@@ -1046,11 +1310,17 @@ function withClientRoutingSchema(schema) {
1046
1310
  const routingProperty = z2.toJSONSchema(selector);
1047
1311
  return {
1048
1312
  ...published,
1049
- properties: { ...published.properties, workspaceId: routingProperty },
1313
+ properties: {
1314
+ ...published.properties,
1315
+ workspaceId: routingProperty
1316
+ },
1050
1317
  ...Array.isArray(published.oneOf) ? {
1051
1318
  oneOf: published.oneOf.map((branch) => ({
1052
1319
  ...branch,
1053
- properties: { ...branch.properties, workspaceId: routingProperty }
1320
+ properties: {
1321
+ ...branch.properties,
1322
+ workspaceId: routingProperty
1323
+ }
1054
1324
  }))
1055
1325
  } : {}
1056
1326
  };
@@ -1078,7 +1348,7 @@ function required(method, name) {
1078
1348
  throw new Error(`The injected legacy MCP client does not support ${name}; use a public DocsClient.`);
1079
1349
  return method;
1080
1350
  }
1081
- function registerBatchAndWorkspaceCapabilities(server, client2, wrap) {
1351
+ function registerBatchAndWorkspaceCapabilities(server, client, wrap) {
1082
1352
  async function batch(input) {
1083
1353
  const results = [];
1084
1354
  let aborted = false;
@@ -1090,25 +1360,25 @@ function registerBatchAndWorkspaceCapabilities(server, client2, wrap) {
1090
1360
  try {
1091
1361
  switch (input.action) {
1092
1362
  case "move":
1093
- await client2.updateDocument(id, { folderId: input.folderId });
1363
+ await client.updateDocument(id, { folderId: input.folderId });
1094
1364
  break;
1095
1365
  case "set_category":
1096
- await client2.updateDocument(id, { categoryId: input.categoryId });
1366
+ await client.updateDocument(id, { categoryId: input.categoryId });
1097
1367
  break;
1098
1368
  case "add_tag":
1099
- await required(client2.addTagToDocument, "add_tag")(id, input.tagId);
1369
+ await required(client.addTagToDocument, "add_tag")(id, input.tagId);
1100
1370
  break;
1101
1371
  case "remove_tag":
1102
- await required(client2.removeTagFromDocument, "remove_tag")(id, input.tagId);
1372
+ await required(client.removeTagFromDocument, "remove_tag")(id, input.tagId);
1103
1373
  break;
1104
1374
  case "trash":
1105
- await required(client2.deleteDocument, "trash")(id);
1375
+ await required(client.deleteDocument, "trash")(id);
1106
1376
  break;
1107
1377
  case "restore":
1108
- await required(client2.restoreTrashedDocument, "restore")(id);
1378
+ await required(client.restoreTrashedDocument, "restore")(id);
1109
1379
  break;
1110
1380
  case "refresh_index":
1111
- await client2.refreshDocumentIndex(id);
1381
+ await client.refreshDocumentIndex(id);
1112
1382
  break;
1113
1383
  }
1114
1384
  results.push({ id, status: "ok" });
@@ -1126,19 +1396,19 @@ function registerBatchAndWorkspaceCapabilities(server, client2, wrap) {
1126
1396
  }
1127
1397
  server.registerTool("batch_documents", {
1128
1398
  description: "Use for multiple explicitly selected documents that need the same action; for one document prefer the matching single-document tool. Accepts 1\u201325 IDs for automation compatibility. Supports move, set_category, add_tag, remove_tag, trash, restore, or refresh_index. Processes sequentially through the existing API with a permission check per document and a per-ID result; partial success is possible. Stops after authentication or rate-limit failure. Never expands a search result or permanently purges documents; version restore is separate.",
1129
- inputSchema: withClientRoutingSchema(batchInput),
1399
+ inputSchema: captureMcpInputSchema(server, "batch_documents", withClientRoutingSchema(batchInput)),
1130
1400
  outputSchema: toolOutputSchemas.batch_documents,
1131
1401
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false }
1132
1402
  }, wrap("batch_documents", batch, toolOutputSchemas.batch_documents));
1133
1403
  server.registerTool("get_workspace_item", {
1134
1404
  description: "Read one visible folder, category, or tag by UUID. Folder uses its direct API getter; category and tag lookup uses the complete permission-filtered lists. An absent or out-of-scope ID is reported as not found. Use list_workspace_structure to discover IDs first.",
1135
- inputSchema: withClientRoutingSchema(z3.strictObject({ kind: z3.enum(["folder", "category", "tag"]).describe("The workspace resource type to read by ID."), id: uuid })),
1405
+ inputSchema: captureMcpInputSchema(server, "get_workspace_item", withClientRoutingSchema(z3.strictObject({ kind: z3.enum(["folder", "category", "tag"]).describe("The workspace resource type to read by ID."), id: uuid }))),
1136
1406
  outputSchema: toolOutputSchemas.get_workspace_item,
1137
1407
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }
1138
1408
  }, wrap("get_workspace_item", async ({ kind, id }) => {
1139
1409
  if (kind === "folder")
1140
- return { operation: kind, result: await required(client2.getFolder, "get_workspace_item(folder)")(id) };
1141
- const listed = kind === "category" ? await client2.listCategories() : await client2.listTags();
1410
+ return { operation: kind, result: await required(client.getFolder, "get_workspace_item(folder)")(id) };
1411
+ const listed = kind === "category" ? await client.listCategories() : await client.listTags();
1142
1412
  const result = Array.isArray(listed) ? listed.find((item) => item.id === id) : undefined;
1143
1413
  if (!result)
1144
1414
  throw new HiaiDocsError(`${kind} not found`, 404, null, "NOT_FOUND");
@@ -1159,38 +1429,38 @@ function required2(value, name) {
1159
1429
  throw new Error(`The injected legacy MCP client does not support ${name}; use a public DocsClient.`);
1160
1430
  return value;
1161
1431
  }
1162
- function registerCompactCapabilities(server, client2, wrap) {
1432
+ function registerCompactCapabilities(server, client, wrap) {
1163
1433
  function register(name, description, inputSchema, annotations, handler) {
1164
- server.registerTool(name, { description, inputSchema: withClientRoutingSchema(inputSchema), outputSchema: toolOutputSchemas[name], annotations }, wrap(name, handler, toolOutputSchemas[name]));
1434
+ server.registerTool(name, { description, inputSchema: captureMcpInputSchema(server, name, withClientRoutingSchema(inputSchema)), outputSchema: toolOutputSchemas[name], annotations }, wrap(name, handler, toolOutputSchemas[name]));
1165
1435
  }
1166
1436
  register("find_documents", "Find readable documents in the active scope. Use mode=list for paginated browsing by folder or tag UUID; use mode=search for hybrid text and semantic retrieval with tag names.", z4.discriminatedUnion("mode", [
1167
- z4.strictObject({ mode: z4.literal("list").describe("Select the list operation explicitly."), folderId: uuid2.optional(), tag: uuid2.optional(), page: z4.number().int().min(1).optional().describe("One-based page number; defaults to the API first page."), limit: z4.number().int().min(1).max(1000).optional().describe("Maximum documents per page, up to 1000.") }),
1168
- z4.strictObject({ mode: z4.literal("search").describe("Select the search operation explicitly."), query: text.describe("Text to search in the original language."), folder: z4.string().optional().describe("Optional folder UUID filter for search."), tags: z4.array(z4.string()).optional().describe("Optional tag names; all supplied names must match."), limit: z4.number().int().min(1).max(100).optional().describe("Maximum results to return, up to 100.") })
1169
- ]), read, async (input) => input.mode === "list" ? { operation: "list", result: await client2.listDocuments(input) } : { operation: "search", result: await client2.search(input) });
1437
+ z4.strictObject({ mode: z4.literal("list").describe("Select the list operation explicitly."), folderId: uuid2.optional(), categoryId: uuid2.optional().describe("Filter by effective category UUID, including inherited folder placement."), visibility: z4.enum(["private", "shared", "public"]).optional().describe("Optional document visibility filter; never expands access."), rootOnly: z4.boolean().optional().describe("Return only documents without a folder; cannot combine with folderId."), tag: uuid2.optional(), tagIds: z4.array(uuid2).min(1).optional().describe("Filter by tag UUIDs; cannot combine with the legacy tag field."), tagMatch: z4.enum(["all", "any"]).optional().describe("Require all supplied tags by default, or any supplied tag."), q: z4.string().optional().describe("Literal case-insensitive title/content filter; does not invoke semantic search."), updatedFrom: z4.iso.datetime({ offset: true }).optional().describe("Inclusive updated timestamp lower bound, with timezone."), updatedTo: z4.iso.datetime({ offset: true }).optional().describe("Exclusive updated timestamp upper bound, with timezone."), sortBy: z4.enum(["updatedAt", "createdAt", "title"]).optional().describe("Stable server-side sort field; defaults to updatedAt."), sortOrder: z4.enum(["asc", "desc"]).optional().describe("Sort direction, descending by default with an ID tie-breaker."), page: z4.number().int().min(1).optional().describe("One-based page number; defaults to the API first page."), limit: z4.number().int().min(1).max(1000).optional().describe("Maximum documents per page, up to 1000.") }),
1438
+ z4.strictObject({ mode: z4.literal("search").describe("Select the search operation explicitly."), query: text.describe("Text to search in the original language."), includeDiagnostics: z4.boolean().optional().describe("Include redacted diagnostic details; omitted by default."), includeChunks: z4.boolean().optional().describe("Include matching text chunks only when requested."), folder: z4.string().optional().describe("Optional folder UUID filter for search."), tags: z4.array(z4.string()).optional().describe("Optional tag names; all supplied names must match."), limit: z4.number().int().min(1).max(100).optional().describe("Maximum results to return, up to 100.") })
1439
+ ]), read, async (input) => input.mode === "list" ? { operation: "list", result: await client.listDocuments(input) } : { operation: "search", result: await client.search(input) });
1170
1440
  register("read_document", "Read one document by UUID. Choose detail for content and metadata, markdown for portable export, or versions for saved revisions and snapshots. All views are read-only.", z4.discriminatedUnion("view", [
1171
1441
  z4.strictObject({ view: z4.literal("detail").describe("Select the detail operation explicitly."), id: uuid2 }),
1172
1442
  z4.strictObject({ view: z4.literal("markdown").describe("Select the markdown operation explicitly."), id: uuid2 }),
1173
1443
  z4.strictObject({ view: z4.literal("versions").describe("Select the versions operation explicitly."), id: uuid2, onlySnapshots: z4.boolean().optional().describe("When true, return only named snapshots.") })
1174
1444
  ]), read, async (input) => {
1175
1445
  if (input.view === "detail")
1176
- return { operation: "detail", result: await client2.getDocument(input.id) };
1446
+ return { operation: "detail", result: await client.getDocument(input.id) };
1177
1447
  if (input.view === "markdown")
1178
- return { operation: "markdown", result: await client2.exportDocument(input.id) };
1179
- return { operation: "versions", result: await client2.getVersionHistory(input.id, input.onlySnapshots) };
1448
+ return { operation: "markdown", result: await client.exportDocument(input.id) };
1449
+ return { operation: "versions", result: await client.getVersionHistory(input.id, input.onlySnapshots) };
1180
1450
  });
1181
1451
  register("save_document", "Create or update one document. Use action=create for a new document or action=update for an existing one; batch_documents handles the same placement change across multiple existing documents. Creation requires write access; content edits require edit access, and placement changes may require write access. Content or placement changes queue normal indexing.", z4.discriminatedUnion("action", [
1182
1452
  z4.strictObject({ action: z4.literal("create").describe("Select the create operation explicitly."), title: title.optional(), content: content.optional(), folderId: uuid2.optional(), categoryId: uuid2.nullable().optional().describe("Optional category UUID; null clears the explicit category.") }),
1183
1453
  z4.strictObject({ action: z4.literal("update").describe("Select the update operation explicitly."), id: uuid2, title: title.optional(), content: content.optional(), folderId: uuid2.nullable().optional().describe("Optional folder UUID; null clears the placement on update."), categoryId: uuid2.nullable().optional().describe("Optional category UUID; null clears the explicit category.") }).refine((value) => value.title !== undefined || value.content !== undefined || value.folderId !== undefined || value.categoryId !== undefined)
1184
1454
  ]), destructive, async (input) => {
1185
1455
  if (input.action === "create") {
1186
- const { action: _action2, ...data2 } = input;
1187
- return { operation: "create", result: await client2.createDocument(data2) };
1456
+ const { action: _action, ...data } = input;
1457
+ return { operation: "create", result: await client.createDocument(data) };
1188
1458
  }
1189
1459
  const { action: _action, id, ...data } = input;
1190
- return { operation: "update", result: await client2.updateDocument(id, data) };
1460
+ return { operation: "update", result: await client.updateDocument(id, data) };
1191
1461
  });
1192
1462
  register("delete_document", "Move one document to trash without purging content or versions. Use batch_documents(action=trash) for multiple explicit IDs. Requires write access and an explicit delete request; permanently_delete_document is a separate irreversible action.", z4.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
1193
- await required2(client2.deleteDocument, "delete_document")(id);
1463
+ await required2(client.deleteDocument, "delete_document")(id);
1194
1464
  return { id, deleted: true };
1195
1465
  });
1196
1466
  register("list_workspace_structure", "Discover permitted spaces with kind=workspaces, including empty spaces; use returned workspaceId for scoped operations. List folders, categories, or tags; set kind=folders for root folders or children of parentId. Unselected reads cover all granted scopes when supported by the host.", z4.discriminatedUnion("kind", [
@@ -1202,24 +1472,24 @@ function registerCompactCapabilities(server, client2, wrap) {
1202
1472
  if (input.kind === "workspaces")
1203
1473
  throw new Error("Workspace routing is not configured");
1204
1474
  if (input.kind === "folders")
1205
- return { operation: "folders", result: await client2.listFolders({ parentId: input.parentId }) };
1475
+ return { operation: "folders", result: await client.listFolders({ parentId: input.parentId }) };
1206
1476
  if (input.kind === "categories")
1207
- return { operation: "categories", result: await client2.listCategories() };
1208
- return { operation: "tags", result: await client2.listTags() };
1477
+ return { operation: "categories", result: await client.listCategories() };
1478
+ return { operation: "tags", result: await client.listTags() };
1209
1479
  });
1210
1480
  register("save_folder", "Create or update a folder. action=update can rename or move an existing folder; the API enforces category boundaries and queues affected documents for reindexing.", z4.discriminatedUnion("action", [
1211
1481
  z4.strictObject({ action: z4.literal("create").describe("Select the create operation explicitly."), name: text.max(255), parentId: uuid2.nullable().optional().describe("Optional parent folder UUID; null selects the root."), categoryId: uuid2.nullable().optional().describe("Optional category UUID; null clears the explicit category.") }),
1212
1482
  z4.strictObject({ action: z4.literal("update").describe("Select the update operation explicitly."), id: uuid2, name: text.max(255).optional(), parentId: uuid2.nullable().optional().describe("Optional parent folder UUID; null selects the root."), categoryId: uuid2.nullable().optional().describe("Optional category UUID; null clears the explicit category."), order: z4.number().int().nonnegative().optional().describe("New non-negative display order.") }).refine((value) => value.name !== undefined || value.parentId !== undefined || value.categoryId !== undefined || value.order !== undefined)
1213
1483
  ]), destructive, async (input) => {
1214
1484
  if (input.action === "create") {
1215
- const { action: _action2, ...data2 } = input;
1216
- return { operation: "create", result: await client2.createFolder(data2) };
1485
+ const { action: _action, ...data } = input;
1486
+ return { operation: "create", result: await client.createFolder(data) };
1217
1487
  }
1218
1488
  const { action: _action, id, ...data } = input;
1219
- return { operation: "update", result: await required2(client2.updateFolder, "update_folder")(id, data) };
1489
+ return { operation: "update", result: await required2(client.updateFolder, "update_folder")(id, data) };
1220
1490
  });
1221
1491
  register("delete_folder", "Delete a folder while preserving its documents; child folders and documents are detached under the API rules. Requires write access.", z4.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
1222
- await required2(client2.deleteFolder, "delete_folder")(id);
1492
+ await required2(client.deleteFolder, "delete_folder")(id);
1223
1493
  return { id, deleted: true };
1224
1494
  });
1225
1495
  register("save_category", "Create or update a workspace category. Full workspace write access is required; category-scoped credentials cannot manage categories.", z4.discriminatedUnion("action", [
@@ -1227,12 +1497,12 @@ function registerCompactCapabilities(server, client2, wrap) {
1227
1497
  z4.strictObject({ action: z4.literal("update").describe("Select the update operation explicitly."), id: uuid2, name: text.max(255).optional(), order: z4.number().int().nonnegative().optional().describe("New non-negative display order.") }).refine((value) => value.name !== undefined || value.order !== undefined)
1228
1498
  ]), destructive, async (input) => {
1229
1499
  if (input.action === "create")
1230
- return { operation: "create", result: await client2.createCategory({ name: input.name }) };
1500
+ return { operation: "create", result: await client.createCategory({ name: input.name }) };
1231
1501
  const { action: _action, id, ...data } = input;
1232
- return { operation: "update", result: await required2(client2.updateCategory, "update_category")(id, data) };
1502
+ return { operation: "update", result: await required2(client.updateCategory, "update_category")(id, data) };
1233
1503
  });
1234
1504
  register("delete_category", "Delete a workspace category and detach its documents without deleting them. Requires full workspace write access; category-scoped credentials are denied.", z4.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
1235
- await required2(client2.deleteCategory, "delete_category")(id);
1505
+ await required2(client.deleteCategory, "delete_category")(id);
1236
1506
  return { id, deleted: true };
1237
1507
  });
1238
1508
  register("save_tag", "Create or update a workspace tag. Full workspace write access is required; renaming or recoloring a tag causes affected documents to be reindexed.", z4.discriminatedUnion("action", [
@@ -1240,42 +1510,42 @@ function registerCompactCapabilities(server, client2, wrap) {
1240
1510
  z4.strictObject({ action: z4.literal("update").describe("Select the update operation explicitly."), id: uuid2, name: text.max(100).optional(), color: z4.string().max(20).optional().describe("Optional tag color, at most 20 characters.") }).refine((value) => value.name !== undefined || value.color !== undefined)
1241
1511
  ]), destructive, async (input) => {
1242
1512
  if (input.action === "create")
1243
- return { operation: "create", result: await required2(client2.createTag, "create_tag")({ name: input.name, color: input.color }) };
1513
+ return { operation: "create", result: await required2(client.createTag, "create_tag")({ name: input.name, color: input.color }) };
1244
1514
  const { action: _action, id, ...data } = input;
1245
- return { operation: "update", result: await required2(client2.updateTag, "update_tag")(id, data) };
1515
+ return { operation: "update", result: await required2(client.updateTag, "update_tag")(id, data) };
1246
1516
  });
1247
1517
  register("delete_tag", "Delete a workspace tag and remove its document assignments. Full workspace write access is required; documents themselves remain.", z4.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
1248
- await required2(client2.deleteTag, "delete_tag")(id);
1518
+ await required2(client.deleteTag, "delete_tag")(id);
1249
1519
  return { id, deleted: true };
1250
1520
  });
1251
1521
  register("set_document_tag", "Add or remove an existing tag assignment on one document. Use batch_documents for the same tag action across multiple explicit IDs. Requires edit access to each document; action=remove preserves the tag itself.", z4.strictObject({ action: z4.enum(["add", "remove"]).describe("Add or remove exactly one tag assignment."), documentId: uuid2, tagId: uuid2 }), destructive, async ({ action, documentId, tagId }) => {
1252
1522
  if (action === "add") {
1253
- await required2(client2.addTagToDocument, "add_tag_to_document")(documentId, tagId);
1523
+ await required2(client.addTagToDocument, "add_tag_to_document")(documentId, tagId);
1254
1524
  return { operation: "add", result: { documentId, tagId, assigned: true } };
1255
1525
  }
1256
- await required2(client2.removeTagFromDocument, "remove_tag_from_document")(documentId, tagId);
1526
+ await required2(client.removeTagFromDocument, "remove_tag_from_document")(documentId, tagId);
1257
1527
  return { operation: "remove", result: { documentId, tagId, removed: true } };
1258
1528
  });
1259
- register("create_snapshot", "Save a named snapshot of an existing document before a planned change. The snapshot can later be restored with restore_document_version.", z4.strictObject({ documentId: uuid2, label: text.max(200).describe("Snapshot label, from 1 to 200 characters."), description: z4.string().max(1000).optional().describe("Optional snapshot note, at most 1000 characters.") }), write, async ({ documentId, label, description }) => client2.createSnapshot(documentId, { label, description }));
1260
- register("restore_document_version", "Restore content from a version or snapshot listed by read_document(view=versions). This changes current content and queues indexing; it does not restore a trashed document.", z4.strictObject({ documentId: uuid2, versionId: uuid2 }), destructive, async ({ documentId, versionId }) => required2(client2.restoreDocumentVersion, "restore_document_version")(documentId, versionId));
1529
+ register("create_snapshot", "Save a named snapshot of an existing document before a planned change. The snapshot can later be restored with restore_document_version.", z4.strictObject({ documentId: uuid2, label: text.max(200).describe("Snapshot label, from 1 to 200 characters."), description: z4.string().max(1000).optional().describe("Optional snapshot note, at most 1000 characters.") }), write, async ({ documentId, label, description }) => client.createSnapshot(documentId, { label, description }));
1530
+ register("restore_document_version", "Restore content from a version or snapshot listed by read_document(view=versions). This changes current content and queues indexing; it does not restore a trashed document.", z4.strictObject({ documentId: uuid2, versionId: uuid2 }), destructive, async ({ documentId, versionId }) => required2(client.restoreDocumentVersion, "restore_document_version")(documentId, versionId));
1261
1531
  register("explore_graph", "Explore graph relations from readable seed documents. mode=neighbors traverses one document without a query; mode=search ranks relations from one or more seed IDs with optional query text.", z4.discriminatedUnion("mode", [
1262
1532
  z4.strictObject({ mode: z4.literal("neighbors").describe("Select the neighbors operation explicitly."), documentId: uuid2, limit: z4.number().int().min(1).max(100).optional().describe("Maximum results to return, up to 100.") }),
1263
1533
  z4.strictObject({ mode: z4.literal("search").describe("Select the search operation explicitly."), docIds: z4.array(uuid2).min(1).max(50).describe("One to 50 authorized seed document UUIDs."), query: z4.string().max(2000).optional().describe("Optional graph relevance query, at most 2000 characters."), limit: z4.number().int().min(1).max(100).optional().describe("Maximum results to return, up to 100.") })
1264
- ]), read, async (input) => input.mode === "neighbors" ? { operation: "neighbors", result: await client2.getRelatedDocuments(input.documentId, input.limit) } : { operation: "search", result: await client2.searchGraph(input) });
1265
- register("get_document_index_status", "Read current indexing and pipeline status for one document without starting work. Use refresh_document_index only when an explicit retry is intended.", z4.strictObject({ documentId: uuid2 }), read, async ({ documentId }) => client2.getDocumentIndexStatus(documentId));
1266
- register("refresh_document_index", "Queue an explicit asynchronous reindex for one document; use batch_documents(action=refresh_index) for multiple explicit IDs. Routine content and placement changes already schedule indexing; check get_document_index_status first.", z4.strictObject({ documentId: uuid2 }), write, async ({ documentId }) => client2.refreshDocumentIndex(documentId));
1267
- register("list_trash", "List soft-deleted documents visible to the active workspace or category scope. Requires read access and does not restore or purge anything.", z4.strictObject({}), read, async () => required2(client2.listTrash, "list_trash")());
1268
- register("restore_trashed_document", "Return one document from trash to the active library; use batch_documents(action=restore) for multiple explicit IDs. This restores the document itself, unlike restore_document_version which changes content.", z4.strictObject({ id: uuid2 }), write, async ({ id }) => required2(client2.restoreTrashedDocument, "restore_trashed_document")(id));
1534
+ ]), read, async (input) => input.mode === "neighbors" ? { operation: "neighbors", result: await client.getRelatedDocuments(input.documentId, input.limit) } : { operation: "search", result: await client.searchGraph(input) });
1535
+ register("get_document_index_status", "Read current indexing and pipeline status for one document without starting work. Use refresh_document_index only when an explicit retry is intended.", z4.strictObject({ documentId: uuid2 }), read, async ({ documentId }) => client.getDocumentIndexStatus(documentId));
1536
+ register("refresh_document_index", "Queue an explicit asynchronous reindex for one document; use batch_documents(action=refresh_index) for multiple explicit IDs. Routine content and placement changes already schedule indexing; check get_document_index_status first.", z4.strictObject({ documentId: uuid2 }), write, async ({ documentId }) => client.refreshDocumentIndex(documentId));
1537
+ register("list_trash", "List soft-deleted documents visible to the active workspace or category scope. Requires read access and does not restore or purge anything.", z4.strictObject({}), read, async () => required2(client.listTrash, "list_trash")());
1538
+ register("restore_trashed_document", "Return one document from trash to the active library; use batch_documents(action=restore) for multiple explicit IDs. This restores the document itself, unlike restore_document_version which changes content.", z4.strictObject({ id: uuid2 }), write, async ({ id }) => required2(client.restoreTrashedDocument, "restore_trashed_document")(id));
1269
1539
  register("permanently_delete_document", "Irreversibly purge a document already in trash, including its version history. Use only on an explicit user request after checking list_trash.", z4.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
1270
- await required2(client2.permanentlyDeleteDocument, "permanently_delete_document")(id);
1540
+ await required2(client.permanentlyDeleteDocument, "permanently_delete_document")(id);
1271
1541
  return { id, deleted: true };
1272
1542
  });
1273
- registerBatchAndWorkspaceCapabilities(server, client2, wrap);
1543
+ registerBatchAndWorkspaceCapabilities(server, client, wrap);
1274
1544
  }
1275
1545
 
1276
1546
  // ../mcp-server/src/prompts-resources.ts
1277
1547
  import { z as z5 } from "zod";
1278
- function registerPromptsAndResources(server, client2) {
1548
+ function registerPromptsAndResources(server, client) {
1279
1549
  server.registerPrompt("organize_workspace", {
1280
1550
  description: "Plan safe document organization using DocsMint categories and folders.",
1281
1551
  argsSchema: z5.object({
@@ -1334,9 +1604,9 @@ Use find_documents(mode=search) for normal retrieval. Use explore_graph only wit
1334
1604
  }));
1335
1605
  server.registerResource("workspace-catalog", "docsmint://workspace/catalog", {}, async (uri) => {
1336
1606
  const [categories, folders, tags] = await Promise.all([
1337
- client2.listCategories(),
1338
- client2.listFolders({}),
1339
- client2.listTags()
1607
+ client.listCategories(),
1608
+ client.listFolders({}),
1609
+ client.listTags()
1340
1610
  ]);
1341
1611
  return {
1342
1612
  contents: [
@@ -1349,9 +1619,15 @@ Use find_documents(mode=search) for normal retrieval. Use explore_graph only wit
1349
1619
  };
1350
1620
  });
1351
1621
  }
1622
+ // ../mcp-server/src/catalog.ts
1623
+ import {
1624
+ InMemoryTransport
1625
+ } from "@modelcontextprotocol/server";
1626
+ // ../mcp-server/src/http.ts
1627
+ import { createMcpHandler } from "@modelcontextprotocol/server";
1352
1628
 
1353
1629
  // ../mcp-server/src/server.ts
1354
- function wrapHandler(name, handler, outputSchema, workspaceRouting) {
1630
+ function wrapHandler(name, handler, outputSchema, workspaceRouting, decorateResult) {
1355
1631
  return async (args) => {
1356
1632
  try {
1357
1633
  const { workspaceId, ...data } = args;
@@ -1369,12 +1645,15 @@ function wrapHandler(name, handler, outputSchema, workspaceRouting) {
1369
1645
  } else {
1370
1646
  output = await handler(data);
1371
1647
  }
1648
+ if (decorateResult)
1649
+ output = await decorateResult(name, output);
1372
1650
  const parsedOutput = outputSchema ? await outputSchema.safeParseAsync(output) : undefined;
1373
1651
  if (parsedOutput && !parsedOutput.success) {
1374
1652
  throw new Error(`Tool '${name}' returned a result outside its published output schema`);
1375
1653
  }
1654
+ const result = parsedOutput?.success ? parsedOutput.data : output;
1376
1655
  return {
1377
- content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
1656
+ content: [{ type: "text", text: JSON.stringify(result) }],
1378
1657
  ...parsedOutput?.success ? { structuredContent: parsedOutput.data } : {}
1379
1658
  };
1380
1659
  } catch (error) {
@@ -1402,15 +1681,15 @@ function wrapHandler(name, handler, outputSchema, workspaceRouting) {
1402
1681
  }
1403
1682
  };
1404
1683
  }
1405
- function registerDocsmintMcpCapabilities(server, client2, workspaceRouting) {
1406
- const wrap = (name, handler, outputSchema) => wrapHandler(name, handler, outputSchema, workspaceRouting);
1407
- registerCompactCapabilities(server, client2, wrap);
1408
- registerPromptsAndResources(server, client2);
1684
+ function registerDocsmintMcpCapabilities(server, client, workspaceRouting, decorateResult) {
1685
+ const wrap = (name, handler, outputSchema) => wrapHandler(name, handler, outputSchema, workspaceRouting, decorateResult);
1686
+ registerCompactCapabilities(server, client, wrap);
1687
+ registerPromptsAndResources(server, client);
1409
1688
  }
1410
1689
  function createDocsmintMcpServer(options = {}) {
1411
- const server = new McpServer({ name: "docsmint", version: "2.0.4" });
1412
- const client2 = options.docsClient ? createMcpDocsClient(options.docsClient, options.requestContext) : options.client ?? createMcpDocsClient(createDefaultDocsClient(), options.requestContext);
1413
- registerDocsmintMcpCapabilities(server, client2, options.workspaceRouting);
1690
+ const server = new DocsMintMcpServer({ name: "docsmint", version: "2.1.1" });
1691
+ const client = options.docsClient ? createMcpDocsClient(options.docsClient, options.requestContext) : options.client ?? createMcpDocsClient(createDefaultDocsClient(), options.requestContext);
1692
+ registerDocsmintMcpCapabilities(server, client, options.workspaceRouting, options.decorateResult);
1414
1693
  return server;
1415
1694
  }
1416
1695