@hiai-gg/docsmint 1.0.3 → 2.0.3

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 (142) hide show
  1. package/README.md +19 -4
  2. package/dist/backend/index.js +14297 -12972
  3. package/dist/frontend/{CategoryDialog-B1yQFy54.js → CategoryDialog-CJeAYxcd.js} +7 -7
  4. package/dist/frontend/{ConfirmDialog-9N3dJGHt.js → ConfirmDialog-B1MjKlVQ.js} +5 -5
  5. package/dist/frontend/{CreateSnapshotDialog-CR5BHpsb.js → CreateSnapshotDialog-BTMoPFdj.js} +4 -4
  6. package/dist/frontend/{DatePicker-B7p5pH4-.js → DatePicker-Bmjko3X7.js} +12 -12
  7. package/dist/frontend/{DeleteDialog-BqR7AQrP.js → DeleteDialog-BkfIeKXO.js} +3 -3
  8. package/dist/frontend/{FolderNode-BQcEuZe3.js → FolderNode-Do8pIfyA.js} +4 -4
  9. package/dist/frontend/{FolderTreeSelector-DqO-f0nt.js → FolderTreeSelector-FyxhcHjr.js} +3 -3
  10. package/dist/frontend/{HiAiEditor-BFpfeft6.js → HiAiEditor-DDpfdQEg.js} +38 -38
  11. package/dist/frontend/{Icon-y7xxAIC6.js → Icon-3EYzvNyk.js} +1 -1
  12. package/dist/frontend/{SettingsDialog-eyTOtZcw.js → SettingsDialog-DzlYW50I.js} +18 -18
  13. package/dist/frontend/{ShareDialog-gCbk5Rrv.js → ShareDialog-Ddvl7xvb.js} +1 -1
  14. package/dist/frontend/{Sidebar-3ridIx_X.js → Sidebar-rFiVen96.js} +29 -29
  15. package/dist/frontend/{TagCreateDialog-B0M1gqk6.js → TagCreateDialog-DQmMJe_E.js} +5 -5
  16. package/dist/frontend/api/categories.js +1 -1
  17. package/dist/frontend/api/settings.js +1 -1
  18. package/dist/frontend/api/tags.js +1 -1
  19. package/dist/frontend/app-shell.js +6 -6
  20. package/dist/frontend/{auth-client-DuY45VqK.js → auth-client-CXR-7mIO.js} +11 -11
  21. package/dist/frontend/{camera-BI-BtnIm.js → camera-DtgHzfVI.js} +2 -2
  22. package/dist/frontend/{categories-Bjcc41We.js → categories-C8AAkhCR.js} +1 -1
  23. package/dist/frontend/{check-sdTlLwi9.js → check-DVx65aSv.js} +2 -2
  24. package/dist/frontend/{chevron-down-DlBnIE7Y.js → chevron-down-C2tbZ8Ol.js} +2 -2
  25. package/dist/frontend/{circle-check-hWC-HeKu.js → circle-check-BAN-D7yg.js} +2 -2
  26. package/dist/frontend/{clock-C4FHq-9q.js → clock-ByiB0SwQ.js} +2 -2
  27. package/dist/frontend/components/category-dialog.js +1 -1
  28. package/dist/frontend/components/create-snapshot-dialog.js +1 -1
  29. package/dist/frontend/components/delete-dialog.js +1 -1
  30. package/dist/frontend/components/editor/compact-editor.js +1 -1
  31. package/dist/frontend/components/editor/document-editor.js +1 -1
  32. package/dist/frontend/components/editor/markdown-toggle.js +2 -2
  33. package/dist/frontend/components/folder-node.js +1 -1
  34. package/dist/frontend/components/folder-tree-selector.js +1 -1
  35. package/dist/frontend/components/save-as-dialog.js +7 -7
  36. package/dist/frontend/components/settings.js +1 -1
  37. package/dist/frontend/components/share-dialog.js +1 -1
  38. package/dist/frontend/components/sidebar.js +1 -1
  39. package/dist/frontend/components/tag-create-dialog.js +1 -1
  40. package/dist/frontend/components/version-history.js +10 -10
  41. package/dist/frontend/{copy-4H99lwAQ.js → copy-CRzvfZGb.js} +2 -2
  42. package/dist/frontend/dashboard.js +48 -48
  43. package/dist/frontend/{db-rWMRdDfv.js → db-Dya0HRhS.js} +1 -1
  44. package/dist/frontend/{dialog-dq74xSum.js → dialog-a_ZcpEC5.js} +9 -9
  45. package/dist/frontend/{dist-BUuz1oVW.js → dist-CcHOStsA.js} +1 -1
  46. package/dist/frontend/dist-DcHl92QO.js +316 -0
  47. package/dist/frontend/{dndzone-BrakBHwm.js → dndzone-CDhrbpTg.js} +1 -1
  48. package/dist/frontend/{dropdown-menu-ChtRLf5S.js → dropdown-menu-DrHYReIC.js} +12 -12
  49. package/dist/frontend/{ellipsis-vertical-CObXWXZW.js → ellipsis-vertical-qxNgoXu-.js} +2 -2
  50. package/dist/frontend/{folder-BAX6qBYy.js → folder-D74E-Kdp.js} +3 -3
  51. package/dist/frontend/frontend.css +1 -1
  52. package/dist/frontend/{identity-BCcv0x22.js → identity-BOA7Jejv.js} +1 -1
  53. package/dist/frontend/{input-DTrIztSF.js → input-Q_7qCfnU.js} +2 -2
  54. package/dist/frontend/{label-BidWF619.js → label-Dj8FDEhf.js} +2 -2
  55. package/dist/frontend/{loader-circle-DnyUzAmN.js → loader-circle-D3t5NkvC.js} +2 -2
  56. package/dist/frontend/offline/identity.js +1 -1
  57. package/dist/frontend/{popper-layer-force-mount-DeBbICF4.js → popper-layer-force-mount-CNtiLgbV.js} +63 -63
  58. package/dist/frontend/{rotate-ccw-DtZDfSK3.js → rotate-ccw-B1ybQ8oQ.js} +2 -2
  59. package/dist/frontend/schemas-1Na35n71.js +3988 -0
  60. package/dist/frontend/search.js +13 -13
  61. package/dist/frontend/{select-value-BlBmN1Vp.js → select-value-BkI1W1bn.js} +19 -19
  62. package/dist/frontend/{settings-BsuxLoxv.js → settings-BRcYFQa_.js} +1 -1
  63. package/dist/frontend/{share-context-CX9pmtDz.js → share-context-BJ4GF4yT.js} +8 -8
  64. package/dist/frontend/{tag-ChpMfbfa.js → tag-qbTBLj-g.js} +3 -3
  65. package/dist/frontend/{tags-CzPNUoFw.js → tags-CF_cqzSV.js} +1 -1
  66. package/dist/frontend/{textarea-704DccHJ.js → textarea-BNK0LFUK.js} +2 -2
  67. package/dist/frontend/theme.js +1 -1
  68. package/dist/frontend/{theme.svelte-B6hsI5me.js → theme.svelte-BRdxXd-B.js} +3 -3
  69. package/dist/frontend/utils/dndzone.js +1 -1
  70. package/dist/frontend/{utils-j7qLkF4C.js → utils-BlHvR6OL.js} +1 -1
  71. package/dist/frontend/{x-B2ifxSH7.js → x-CvSSnrjl.js} +2 -2
  72. package/dist/frontend-ssr/api/settings.js +1 -1
  73. package/dist/frontend-ssr/app-shell.js +6 -6
  74. package/dist/frontend-ssr/assets/{CategoryDialog-Ch4RlhLg.js → CategoryDialog-DuZLLlt7.js} +7 -7
  75. package/dist/frontend-ssr/assets/{ConfirmDialog-B9sc7xt5.js → ConfirmDialog-0WVu9BCE.js} +8 -8
  76. package/dist/frontend-ssr/assets/{CreateSnapshotDialog-XLsNLzRf.js → CreateSnapshotDialog-3vhDTFNu.js} +4 -4
  77. package/dist/frontend-ssr/assets/{DatePicker-BwLyP3b_.js → DatePicker-t12leL2Y.js} +7 -7
  78. package/dist/frontend-ssr/assets/{DeleteDialog-C0a-RBKC.js → DeleteDialog-B0AU1fJR.js} +3 -3
  79. package/dist/frontend-ssr/assets/{FolderNode-imYW-MNe.js → FolderNode-C-B-s8x1.js} +5 -5
  80. package/dist/frontend-ssr/assets/{FolderTreeSelector-DnrKCYtl.js → FolderTreeSelector-DdQuEcj0.js} +4 -4
  81. package/dist/frontend-ssr/assets/{HiAiEditor-CXq29oHf.js → HiAiEditor-Bj6tiE97.js} +30 -30
  82. package/dist/frontend-ssr/assets/{Icon-Clqe8D8X.js → Icon-DE_3EnuF.js} +4 -4
  83. package/dist/frontend-ssr/assets/{SettingsDialog-CH5B9IOK.js → SettingsDialog-h4SFwpUa.js} +16 -16
  84. package/dist/frontend-ssr/assets/{ShareDialog-CcKZFHo8.js → ShareDialog-CpE9zd_f.js} +1 -1
  85. package/dist/frontend-ssr/assets/{Sidebar-DQcwbR0y.js → Sidebar-BFBpsd3L.js} +26 -26
  86. package/dist/frontend-ssr/assets/{TagCreateDialog-DCz6I-FH.js → TagCreateDialog-DBHO1DPU.js} +4 -4
  87. package/dist/frontend-ssr/assets/{auth-client-CokKgEB-.js → auth-client-BC4hSFKF.js} +13 -13
  88. package/dist/frontend-ssr/assets/{camera-Dwwtgvfn.js → camera-B6ldo_Js.js} +2 -2
  89. package/dist/frontend-ssr/assets/{chevron-down-C6BTPJFz.js → chevron-down-DQcr6JUc.js} +2 -2
  90. package/dist/frontend-ssr/assets/{chevron-right-CseGE1qd.js → chevron-right-9szrliZx.js} +2 -2
  91. package/dist/frontend-ssr/assets/{circle-check-BRhWPZo1.js → circle-check-BgP9MRRv.js} +2 -2
  92. package/dist/frontend-ssr/assets/{clock-DpP_Y7WP.js → clock-roNtGlT6.js} +2 -2
  93. package/dist/frontend-ssr/assets/{copy-DRMKiRZ0.js → copy-BYqYnBIQ.js} +2 -2
  94. package/dist/frontend-ssr/assets/{db-BxaCyM9B.js → db-C3rFdTZa.js} +1 -1
  95. package/dist/frontend-ssr/assets/{dialog-Bjm7PhCc.js → dialog-SqCnTT43.js} +9 -9
  96. package/dist/frontend-ssr/assets/{dist-71eunluk.js → dist-CaZQ1FhA.js} +10 -10
  97. package/dist/frontend-ssr/assets/{dist-CshZmNmp.js → dist-CqxHwOlp.js} +3 -3
  98. package/dist/frontend-ssr/assets/{dndzone-WtNaDxoQ.js → dndzone-CnTCMhPd.js} +1 -1
  99. package/dist/frontend-ssr/assets/{dropdown-menu-dg8hpDGz.js → dropdown-menu-CE6U0f1b.js} +12 -12
  100. package/dist/frontend-ssr/assets/{ellipsis-vertical-BErUuhWg.js → ellipsis-vertical-Cg1MrZsl.js} +2 -2
  101. package/dist/frontend-ssr/assets/{folder-DszunwKc.js → folder-DHB-CEcQ.js} +2 -2
  102. package/dist/frontend-ssr/assets/{identity-BHNrcgU5.js → identity-DNIo1bgc.js} +1 -1
  103. package/dist/frontend-ssr/assets/{input-BzlpgSwc.js → input-DVrBVPgs.js} +2 -2
  104. package/dist/frontend-ssr/assets/{label-uycYYCYF.js → label-vtCK3pTp.js} +2 -2
  105. package/dist/frontend-ssr/assets/{loader-circle-BpRVrMZg.js → loader-circle-D3NWhCif.js} +2 -2
  106. package/dist/frontend-ssr/assets/{popper-layer-force-mount-X3deg3KH.js → popper-layer-force-mount-C4dMMt-f.js} +71 -71
  107. package/dist/frontend-ssr/assets/{rotate-ccw-1GOD_yt_.js → rotate-ccw-DNf3nwMD.js} +2 -2
  108. package/dist/frontend-ssr/assets/{select-value-BRQxTiFP.js → select-value-Ce5c_fuA.js} +18 -18
  109. package/dist/frontend-ssr/assets/{settings-Dy4eZk45.js → settings-DWCpfCPj.js} +1 -1
  110. package/dist/frontend-ssr/assets/{share-context-dIAQ413Z.js → share-context-B4UpvTSw.js} +9 -9
  111. package/dist/frontend-ssr/assets/{tag-DFh6nF9R.js → tag-Cqv0fWVG.js} +3 -3
  112. package/dist/frontend-ssr/assets/{textarea-CEUFQIma.js → textarea-BdjOJJVb.js} +2 -2
  113. package/dist/frontend-ssr/assets/{theme.svelte-dM8TietK.js → theme.svelte-D6bbaJ9m.js} +3 -3
  114. package/dist/frontend-ssr/assets/{utils-0rlYZMNr.js → utils-D3X7I8nz.js} +1 -1
  115. package/dist/frontend-ssr/components/category-dialog.js +1 -1
  116. package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -1
  117. package/dist/frontend-ssr/components/delete-dialog.js +1 -1
  118. package/dist/frontend-ssr/components/editor/compact-editor.js +1 -1
  119. package/dist/frontend-ssr/components/editor/document-editor.js +1 -1
  120. package/dist/frontend-ssr/components/editor/markdown-toggle.js +1 -1
  121. package/dist/frontend-ssr/components/folder-node.js +1 -1
  122. package/dist/frontend-ssr/components/folder-tree-selector.js +1 -1
  123. package/dist/frontend-ssr/components/save-as-dialog.js +6 -6
  124. package/dist/frontend-ssr/components/settings.js +1 -1
  125. package/dist/frontend-ssr/components/share-dialog.js +1 -1
  126. package/dist/frontend-ssr/components/sidebar.js +1 -1
  127. package/dist/frontend-ssr/components/tag-create-dialog.js +1 -1
  128. package/dist/frontend-ssr/components/version-history.js +10 -10
  129. package/dist/frontend-ssr/dashboard.js +40 -40
  130. package/dist/frontend-ssr/offline/identity.js +1 -1
  131. package/dist/frontend-ssr/search.js +8 -8
  132. package/dist/frontend-ssr/theme.js +1 -1
  133. package/dist/frontend-ssr/utils/dndzone.js +1 -1
  134. package/dist/lifecycle-runtime.js +7129 -1986
  135. package/dist/mcp-cli.js +133 -72
  136. package/dist/mcp-server.d.ts +15 -0
  137. package/dist/mcp-server.js +137 -72
  138. package/package.json +15 -6
  139. package/packages/cli/src/index.ts +1 -1
  140. package/server.json +2 -2
  141. package/dist/frontend/dist-COPpfjrc.js +0 -316
  142. package/dist/frontend/schemas-CdPhcuru.js +0 -3001
@@ -570,9 +570,6 @@ var RESOURCE_PERMISSIONS = new Set([
570
570
  "edit",
571
571
  "write"
572
572
  ]);
573
- // ../mcp-server/src/compact.ts
574
- import { z as z3 } from "zod";
575
-
576
573
  // ../mcp-server/src/output-schemas.ts
577
574
  import { z } from "zod";
578
575
  var tagSchema = z.looseObject({
@@ -801,7 +798,7 @@ var operationOutputSchemas = {
801
798
  permanently_delete_document: deleteAcknowledgmentSchema
802
799
  };
803
800
  var variant = (operation, result) => z.object({ operation: z.literal(operation), result });
804
- var toolOutputSchemas = {
801
+ var singleToolOutputSchemas = {
805
802
  delete_document: operationOutputSchemas.delete_document,
806
803
  delete_folder: operationOutputSchemas.delete_folder,
807
804
  delete_category: operationOutputSchemas.delete_category,
@@ -827,6 +824,7 @@ var toolOutputSchemas = {
827
824
  variant("update", operationOutputSchemas.update_document)
828
825
  ]),
829
826
  list_workspace_structure: z.union([
827
+ variant("workspaces", z.array(z.object({ id: z.string().uuid(), name: z.string(), slug: z.string(), entireWorkspace: z.boolean(), categoryIds: z.array(z.string().uuid()) }))),
830
828
  variant("folders", operationOutputSchemas.list_folders),
831
829
  variant("categories", operationOutputSchemas.list_categories),
832
830
  variant("tags", operationOutputSchemas.list_tags)
@@ -869,9 +867,30 @@ var toolOutputSchemas = {
869
867
  variant("tag", tagSchema)
870
868
  ])
871
869
  };
870
+ var workspaceSchema = z.object({ id: z.string().uuid(), name: z.string(), slug: z.string() });
871
+ var scoped = (data) => z.object({
872
+ operation: z.string(),
873
+ scopedResults: z.array(z.object({ workspace: workspaceSchema, categoryId: z.string().uuid().nullable(), data }))
874
+ });
875
+ var scopedSchemas = {
876
+ find_documents: scoped(singleToolOutputSchemas.find_documents),
877
+ list_workspace_structure: scoped(singleToolOutputSchemas.list_workspace_structure),
878
+ list_trash: scoped(singleToolOutputSchemas.list_trash)
879
+ };
880
+ var toolOutputSchemas = {
881
+ ...singleToolOutputSchemas,
882
+ find_documents: z.union([...singleToolOutputSchemas.find_documents.options, scopedSchemas.find_documents]),
883
+ list_workspace_structure: z.union([...singleToolOutputSchemas.list_workspace_structure.options, scopedSchemas.list_workspace_structure]),
884
+ list_trash: z.union([singleToolOutputSchemas.list_trash, scopedSchemas.list_trash])
885
+ };
886
+ function createMcpScopedResult(toolName, input) {
887
+ return scopedSchemas[toolName].parse(input);
888
+ }
889
+ // ../mcp-server/src/compact.ts
890
+ import { z as z4 } from "zod";
872
891
 
873
892
  // ../mcp-server/src/batch-workspace.ts
874
- import { z as z2 } from "zod";
893
+ import { z as z3 } from "zod";
875
894
 
876
895
  // ../mcp-server/src/client.ts
877
896
  var DEFAULT_BASE_URL = "http://localhost:50700";
@@ -966,6 +985,7 @@ var client = new Proxy({}, {
966
985
  });
967
986
 
968
987
  // ../mcp-server/src/client-routing-schema.ts
988
+ import { z as z2 } from "zod";
969
989
  function hoistObjectUnionClosure(schema) {
970
990
  const variants = schema.oneOf;
971
991
  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))
@@ -1001,29 +1021,55 @@ function hoistObjectUnionClosure(schema) {
1001
1021
  }
1002
1022
  function withClientRoutingSchema(schema) {
1003
1023
  const standard = schema["~standard"];
1024
+ const selector = z2.string().uuid().optional().describe("Workspace UUID from list_workspace_structure(kind=workspaces). Required for ambiguous creates and structure changes; omit to search all granted scopes.");
1004
1025
  return {
1005
1026
  "~standard": {
1006
1027
  ...standard,
1028
+ validate: async (value, options) => {
1029
+ if (!value || typeof value !== "object" || Array.isArray(value))
1030
+ return standard.validate(value, options);
1031
+ const { workspaceId, ...args } = value;
1032
+ const selected = selector.safeParse(workspaceId);
1033
+ if (!selected.success)
1034
+ return { issues: selected.error.issues };
1035
+ const validated = await standard.validate(args, options);
1036
+ if (validated.issues)
1037
+ return validated;
1038
+ return { value: { ...validated.value, ...selected.data ? { workspaceId: selected.data } : {} } };
1039
+ },
1007
1040
  jsonSchema: {
1008
1041
  ...standard.jsonSchema,
1009
- input: (options) => hoistObjectUnionClosure(standard.jsonSchema.input(options))
1042
+ input: (options) => (() => {
1043
+ const published = hoistObjectUnionClosure(standard.jsonSchema.input(options));
1044
+ const routingProperty = z2.toJSONSchema(selector);
1045
+ return {
1046
+ ...published,
1047
+ properties: { ...published.properties, workspaceId: routingProperty },
1048
+ ...Array.isArray(published.oneOf) ? {
1049
+ oneOf: published.oneOf.map((branch) => ({
1050
+ ...branch,
1051
+ properties: { ...branch.properties, workspaceId: routingProperty }
1052
+ }))
1053
+ } : {}
1054
+ };
1055
+ })()
1010
1056
  }
1011
1057
  }
1012
1058
  };
1013
1059
  }
1014
1060
 
1015
1061
  // ../mcp-server/src/batch-workspace.ts
1016
- var uuid = z2.string().uuid().describe("UUID of an item visible to the active API key.");
1017
- var documentIds = z2.array(uuid).min(1).max(25).refine((ids) => new Set(ids).size === ids.length, "Document IDs must be unique.").describe("One to 25 distinct document UUIDs, explicitly selected by the user; no search expansion.");
1062
+ var uuid = z3.string().uuid().describe("UUID of an item visible to the active API key.");
1063
+ var documentIds = z3.array(uuid).min(1).max(25).refine((ids) => new Set(ids).size === ids.length, "Document IDs must be unique.").describe("One to 25 distinct document UUIDs, explicitly selected by the user; no search expansion.");
1018
1064
  var base = { documentIds };
1019
- var batchInput = z2.discriminatedUnion("action", [
1020
- z2.strictObject({ ...base, action: z2.literal("move").describe("Move each document to the same folder."), folderId: uuid.nullable().describe("Destination folder UUID, or null for no folder.") }),
1021
- z2.strictObject({ ...base, action: z2.literal("set_category").describe("Set one explicit category on every document."), categoryId: uuid.nullable().describe("Category UUID, or null to clear explicit category.") }),
1022
- z2.strictObject({ ...base, action: z2.literal("add_tag").describe("Assign one existing tag to every document."), tagId: uuid.describe("Existing tag UUID to assign to each document.") }),
1023
- z2.strictObject({ ...base, action: z2.literal("remove_tag").describe("Remove one tag assignment from every document."), tagId: uuid.describe("Existing tag UUID to unassign from each document.") }),
1024
- z2.strictObject({ ...base, action: z2.literal("trash").describe("Move every document to trash without permanent deletion.") }),
1025
- z2.strictObject({ ...base, action: z2.literal("restore").describe("Restore every selected document from trash.") }),
1026
- z2.strictObject({ ...base, action: z2.literal("refresh_index").describe("Request explicit indexing retry for every document.") })
1065
+ var batchInput = z3.discriminatedUnion("action", [
1066
+ z3.strictObject({ ...base, action: z3.literal("move").describe("Move each document to the same folder."), folderId: uuid.nullable().describe("Destination folder UUID, or null for no folder.") }),
1067
+ z3.strictObject({ ...base, action: z3.literal("set_category").describe("Set one explicit category on every document."), categoryId: uuid.nullable().describe("Category UUID, or null to clear explicit category.") }),
1068
+ z3.strictObject({ ...base, action: z3.literal("add_tag").describe("Assign one existing tag to every document."), tagId: uuid.describe("Existing tag UUID to assign to each document.") }),
1069
+ z3.strictObject({ ...base, action: z3.literal("remove_tag").describe("Remove one tag assignment from every document."), tagId: uuid.describe("Existing tag UUID to unassign from each document.") }),
1070
+ z3.strictObject({ ...base, action: z3.literal("trash").describe("Move every document to trash without permanent deletion.") }),
1071
+ z3.strictObject({ ...base, action: z3.literal("restore").describe("Restore every selected document from trash.") }),
1072
+ z3.strictObject({ ...base, action: z3.literal("refresh_index").describe("Request explicit indexing retry for every document.") })
1027
1073
  ]);
1028
1074
  function required(method, name) {
1029
1075
  if (!method)
@@ -1084,7 +1130,7 @@ function registerBatchAndWorkspaceCapabilities(server, client2, wrap) {
1084
1130
  }, wrap("batch_documents", batch, toolOutputSchemas.batch_documents));
1085
1131
  server.registerTool("get_workspace_item", {
1086
1132
  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.",
1087
- inputSchema: z2.strictObject({ kind: z2.enum(["folder", "category", "tag"]).describe("The workspace resource type to read by ID."), id: uuid }),
1133
+ inputSchema: withClientRoutingSchema(z3.strictObject({ kind: z3.enum(["folder", "category", "tag"]).describe("The workspace resource type to read by ID."), id: uuid })),
1088
1134
  outputSchema: toolOutputSchemas.get_workspace_item,
1089
1135
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }
1090
1136
  }, wrap("get_workspace_item", async ({ kind, id }) => {
@@ -1099,10 +1145,10 @@ function registerBatchAndWorkspaceCapabilities(server, client2, wrap) {
1099
1145
  }
1100
1146
 
1101
1147
  // ../mcp-server/src/compact.ts
1102
- var uuid2 = z3.string().uuid().describe("UUID returned by the corresponding list or read operation.");
1103
- var text = z3.string().min(1).describe("Non-empty human-readable name or title.");
1104
- var title = z3.string().min(1).max(500).describe("Document title, from 1 to 500 characters.");
1105
- var content = z3.string().describe("Markdown document content; an empty string clears the content on update.");
1148
+ var uuid2 = z4.string().uuid().describe("UUID returned by the corresponding list or read operation.");
1149
+ var text = z4.string().min(1).describe("Non-empty human-readable name or title.");
1150
+ var title = z4.string().min(1).max(500).describe("Document title, from 1 to 500 characters.");
1151
+ var content = z4.string().describe("Markdown document content; an empty string clears the content on update.");
1106
1152
  var read = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
1107
1153
  var write = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
1108
1154
  var destructive = { ...write, destructiveHint: true };
@@ -1115,14 +1161,14 @@ function registerCompactCapabilities(server, client2, wrap) {
1115
1161
  function register(name, description, inputSchema, annotations, handler) {
1116
1162
  server.registerTool(name, { description, inputSchema: withClientRoutingSchema(inputSchema), outputSchema: toolOutputSchemas[name], annotations }, wrap(name, handler, toolOutputSchemas[name]));
1117
1163
  }
1118
- 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.", z3.discriminatedUnion("mode", [
1119
- z3.strictObject({ mode: z3.literal("list").describe("Select the list operation explicitly."), folderId: uuid2.optional(), tag: uuid2.optional(), page: z3.number().int().min(1).optional().describe("One-based page number; defaults to the API first page."), limit: z3.number().int().min(1).max(1000).optional().describe("Maximum documents per page, up to 1000.") }),
1120
- z3.strictObject({ mode: z3.literal("search").describe("Select the search operation explicitly."), query: text.describe("Text to search in the original language."), folder: z3.string().optional().describe("Optional folder UUID filter for search."), tags: z3.array(z3.string()).optional().describe("Optional tag names; all supplied names must match."), limit: z3.number().int().min(1).max(100).optional().describe("Maximum results to return, up to 100.") })
1164
+ 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", [
1165
+ 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.") }),
1166
+ 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.") })
1121
1167
  ]), read, async (input) => input.mode === "list" ? { operation: "list", result: await client2.listDocuments(input) } : { operation: "search", result: await client2.search(input) });
1122
- 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.", z3.discriminatedUnion("view", [
1123
- z3.strictObject({ view: z3.literal("detail").describe("Select the detail operation explicitly."), id: uuid2 }),
1124
- z3.strictObject({ view: z3.literal("markdown").describe("Select the markdown operation explicitly."), id: uuid2 }),
1125
- z3.strictObject({ view: z3.literal("versions").describe("Select the versions operation explicitly."), id: uuid2, onlySnapshots: z3.boolean().optional().describe("When true, return only named snapshots.") })
1168
+ 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", [
1169
+ z4.strictObject({ view: z4.literal("detail").describe("Select the detail operation explicitly."), id: uuid2 }),
1170
+ z4.strictObject({ view: z4.literal("markdown").describe("Select the markdown operation explicitly."), id: uuid2 }),
1171
+ 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.") })
1126
1172
  ]), read, async (input) => {
1127
1173
  if (input.view === "detail")
1128
1174
  return { operation: "detail", result: await client2.getDocument(input.id) };
@@ -1130,9 +1176,9 @@ function registerCompactCapabilities(server, client2, wrap) {
1130
1176
  return { operation: "markdown", result: await client2.exportDocument(input.id) };
1131
1177
  return { operation: "versions", result: await client2.getVersionHistory(input.id, input.onlySnapshots) };
1132
1178
  });
1133
- 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.", z3.discriminatedUnion("action", [
1134
- z3.strictObject({ action: z3.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.") }),
1135
- z3.strictObject({ action: z3.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)
1179
+ 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", [
1180
+ 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.") }),
1181
+ 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)
1136
1182
  ]), destructive, async (input) => {
1137
1183
  if (input.action === "create") {
1138
1184
  const { action: _action2, ...data2 } = input;
@@ -1141,24 +1187,27 @@ function registerCompactCapabilities(server, client2, wrap) {
1141
1187
  const { action: _action, id, ...data } = input;
1142
1188
  return { operation: "update", result: await client2.updateDocument(id, data) };
1143
1189
  });
1144
- 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.", z3.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
1190
+ 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 }) => {
1145
1191
  await required2(client2.deleteDocument, "delete_document")(id);
1146
1192
  return { id, deleted: true };
1147
1193
  });
1148
- register("list_workspace_structure", "List visible folders, categories, or tags in the active workspace or category scope. Set kind=folders to inspect root folders or children of parentId.", z3.discriminatedUnion("kind", [
1149
- z3.strictObject({ kind: z3.literal("folders").describe("Select the folders operation explicitly."), parentId: uuid2.optional() }),
1150
- z3.strictObject({ kind: z3.literal("categories").describe("Select the categories operation explicitly.") }),
1151
- z3.strictObject({ kind: z3.literal("tags").describe("Select the tags operation explicitly.") })
1194
+ 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", [
1195
+ z4.strictObject({ kind: z4.literal("workspaces").describe("Discover every workspace granted to this connection, including empty ones.") }),
1196
+ z4.strictObject({ kind: z4.literal("folders").describe("Select the folders operation explicitly."), parentId: uuid2.optional() }),
1197
+ z4.strictObject({ kind: z4.literal("categories").describe("Select the categories operation explicitly.") }),
1198
+ z4.strictObject({ kind: z4.literal("tags").describe("Select the tags operation explicitly.") })
1152
1199
  ]), read, async (input) => {
1200
+ if (input.kind === "workspaces")
1201
+ throw new Error("Workspace routing is not configured");
1153
1202
  if (input.kind === "folders")
1154
1203
  return { operation: "folders", result: await client2.listFolders({ parentId: input.parentId }) };
1155
1204
  if (input.kind === "categories")
1156
1205
  return { operation: "categories", result: await client2.listCategories() };
1157
1206
  return { operation: "tags", result: await client2.listTags() };
1158
1207
  });
1159
- 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.", z3.discriminatedUnion("action", [
1160
- z3.strictObject({ action: z3.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.") }),
1161
- z3.strictObject({ action: z3.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: z3.number().int().nonnegative().optional().describe("New non-negative display order.") }).refine((value) => value.name !== undefined || value.parentId !== undefined || value.categoryId !== undefined || value.order !== undefined)
1208
+ 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", [
1209
+ 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.") }),
1210
+ 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)
1162
1211
  ]), destructive, async (input) => {
1163
1212
  if (input.action === "create") {
1164
1213
  const { action: _action2, ...data2 } = input;
@@ -1167,37 +1216,37 @@ function registerCompactCapabilities(server, client2, wrap) {
1167
1216
  const { action: _action, id, ...data } = input;
1168
1217
  return { operation: "update", result: await required2(client2.updateFolder, "update_folder")(id, data) };
1169
1218
  });
1170
- register("delete_folder", "Delete a folder while preserving its documents; child folders and documents are detached under the API rules. Requires write access.", z3.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
1219
+ 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 }) => {
1171
1220
  await required2(client2.deleteFolder, "delete_folder")(id);
1172
1221
  return { id, deleted: true };
1173
1222
  });
1174
- register("save_category", "Create or update a workspace category. Full workspace write access is required; category-scoped credentials cannot manage categories.", z3.discriminatedUnion("action", [
1175
- z3.strictObject({ action: z3.literal("create").describe("Select the create operation explicitly."), name: text.max(255) }),
1176
- z3.strictObject({ action: z3.literal("update").describe("Select the update operation explicitly."), id: uuid2, name: text.max(255).optional(), order: z3.number().int().nonnegative().optional().describe("New non-negative display order.") }).refine((value) => value.name !== undefined || value.order !== undefined)
1223
+ register("save_category", "Create or update a workspace category. Full workspace write access is required; category-scoped credentials cannot manage categories.", z4.discriminatedUnion("action", [
1224
+ z4.strictObject({ action: z4.literal("create").describe("Select the create operation explicitly."), name: text.max(255) }),
1225
+ 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)
1177
1226
  ]), destructive, async (input) => {
1178
1227
  if (input.action === "create")
1179
1228
  return { operation: "create", result: await client2.createCategory({ name: input.name }) };
1180
1229
  const { action: _action, id, ...data } = input;
1181
1230
  return { operation: "update", result: await required2(client2.updateCategory, "update_category")(id, data) };
1182
1231
  });
1183
- register("delete_category", "Delete a workspace category and detach its documents without deleting them. Requires full workspace write access; category-scoped credentials are denied.", z3.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
1232
+ 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 }) => {
1184
1233
  await required2(client2.deleteCategory, "delete_category")(id);
1185
1234
  return { id, deleted: true };
1186
1235
  });
1187
- 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.", z3.discriminatedUnion("action", [
1188
- z3.strictObject({ action: z3.literal("create").describe("Select the create operation explicitly."), name: text.max(100), color: z3.string().max(20).optional().describe("Optional tag color, at most 20 characters.") }),
1189
- z3.strictObject({ action: z3.literal("update").describe("Select the update operation explicitly."), id: uuid2, name: text.max(100).optional(), color: z3.string().max(20).optional().describe("Optional tag color, at most 20 characters.") }).refine((value) => value.name !== undefined || value.color !== undefined)
1236
+ 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", [
1237
+ z4.strictObject({ action: z4.literal("create").describe("Select the create operation explicitly."), name: text.max(100), color: z4.string().max(20).optional().describe("Optional tag color, at most 20 characters.") }),
1238
+ 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)
1190
1239
  ]), destructive, async (input) => {
1191
1240
  if (input.action === "create")
1192
1241
  return { operation: "create", result: await required2(client2.createTag, "create_tag")({ name: input.name, color: input.color }) };
1193
1242
  const { action: _action, id, ...data } = input;
1194
1243
  return { operation: "update", result: await required2(client2.updateTag, "update_tag")(id, data) };
1195
1244
  });
1196
- register("delete_tag", "Delete a workspace tag and remove its document assignments. Full workspace write access is required; documents themselves remain.", z3.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
1245
+ 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 }) => {
1197
1246
  await required2(client2.deleteTag, "delete_tag")(id);
1198
1247
  return { id, deleted: true };
1199
1248
  });
1200
- 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.", z3.strictObject({ action: z3.enum(["add", "remove"]).describe("Add or remove exactly one tag assignment."), documentId: uuid2, tagId: uuid2 }), destructive, async ({ action, documentId, tagId }) => {
1249
+ 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 }) => {
1201
1250
  if (action === "add") {
1202
1251
  await required2(client2.addTagToDocument, "add_tag_to_document")(documentId, tagId);
1203
1252
  return { operation: "add", result: { documentId, tagId, assigned: true } };
@@ -1205,17 +1254,17 @@ function registerCompactCapabilities(server, client2, wrap) {
1205
1254
  await required2(client2.removeTagFromDocument, "remove_tag_from_document")(documentId, tagId);
1206
1255
  return { operation: "remove", result: { documentId, tagId, removed: true } };
1207
1256
  });
1208
- 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.", z3.strictObject({ documentId: uuid2, label: text.max(200).describe("Snapshot label, from 1 to 200 characters."), description: z3.string().max(1000).optional().describe("Optional snapshot note, at most 1000 characters.") }), write, async ({ documentId, label, description }) => client2.createSnapshot(documentId, { label, description }));
1209
- 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.", z3.strictObject({ documentId: uuid2, versionId: uuid2 }), destructive, async ({ documentId, versionId }) => required2(client2.restoreDocumentVersion, "restore_document_version")(documentId, versionId));
1210
- 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.", z3.discriminatedUnion("mode", [
1211
- z3.strictObject({ mode: z3.literal("neighbors").describe("Select the neighbors operation explicitly."), documentId: uuid2, limit: z3.number().int().min(1).max(100).optional().describe("Maximum results to return, up to 100.") }),
1212
- z3.strictObject({ mode: z3.literal("search").describe("Select the search operation explicitly."), docIds: z3.array(uuid2).min(1).max(50).describe("One to 50 authorized seed document UUIDs."), query: z3.string().max(2000).optional().describe("Optional graph relevance query, at most 2000 characters."), limit: z3.number().int().min(1).max(100).optional().describe("Maximum results to return, up to 100.") })
1257
+ 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 }));
1258
+ 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));
1259
+ 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", [
1260
+ 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.") }),
1261
+ 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.") })
1213
1262
  ]), read, async (input) => input.mode === "neighbors" ? { operation: "neighbors", result: await client2.getRelatedDocuments(input.documentId, input.limit) } : { operation: "search", result: await client2.searchGraph(input) });
1214
- 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.", z3.strictObject({ documentId: uuid2 }), read, async ({ documentId }) => client2.getDocumentIndexStatus(documentId));
1215
- 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.", z3.strictObject({ documentId: uuid2 }), write, async ({ documentId }) => client2.refreshDocumentIndex(documentId));
1216
- 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.", z3.strictObject({}), read, async () => required2(client2.listTrash, "list_trash")());
1217
- 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.", z3.strictObject({ id: uuid2 }), write, async ({ id }) => required2(client2.restoreTrashedDocument, "restore_trashed_document")(id));
1218
- 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.", z3.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
1263
+ 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));
1264
+ 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));
1265
+ 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")());
1266
+ 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));
1267
+ 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 }) => {
1219
1268
  await required2(client2.permanentlyDeleteDocument, "permanently_delete_document")(id);
1220
1269
  return { id, deleted: true };
1221
1270
  });
@@ -1223,13 +1272,13 @@ function registerCompactCapabilities(server, client2, wrap) {
1223
1272
  }
1224
1273
 
1225
1274
  // ../mcp-server/src/prompts-resources.ts
1226
- import { z as z4 } from "zod";
1275
+ import { z as z5 } from "zod";
1227
1276
  function registerPromptsAndResources(server, client2) {
1228
1277
  server.registerPrompt("organize_workspace", {
1229
1278
  description: "Plan safe document organization using DocsMint categories and folders.",
1230
- argsSchema: z4.object({
1231
- objective: z4.string(),
1232
- language: z4.string().optional()
1279
+ argsSchema: z5.object({
1280
+ objective: z5.string(),
1281
+ language: z5.string().optional()
1233
1282
  })
1234
1283
  }, ({ objective, language }) => ({
1235
1284
  messages: [
@@ -1244,9 +1293,9 @@ function registerPromptsAndResources(server, client2) {
1244
1293
  }));
1245
1294
  server.registerPrompt("research_workspace", {
1246
1295
  description: "Research a question with hybrid search and GraphRAG while citing DocsMint document IDs.",
1247
- argsSchema: z4.object({
1248
- question: z4.string(),
1249
- language: z4.string().optional()
1296
+ argsSchema: z5.object({
1297
+ question: z5.string(),
1298
+ language: z5.string().optional()
1250
1299
  })
1251
1300
  }, ({ question, language }) => ({
1252
1301
  messages: [
@@ -1334,10 +1383,24 @@ var capabilityCatalog = {
1334
1383
  };
1335
1384
 
1336
1385
  // ../mcp-server/src/server.ts
1337
- function wrapHandler(name, handler, outputSchema) {
1386
+ function wrapHandler(name, handler, outputSchema, workspaceRouting) {
1338
1387
  return async (args) => {
1339
1388
  try {
1340
- const output = await handler(args);
1389
+ const { workspaceId, ...data } = args;
1390
+ if (workspaceId !== undefined) {
1391
+ if (!workspaceRouting)
1392
+ throw new Error("Workspace routing is not configured");
1393
+ await workspaceRouting.assertSelection(workspaceId);
1394
+ }
1395
+ let output;
1396
+ if (name === "list_workspace_structure" && data.kind === "workspaces") {
1397
+ if (!workspaceRouting)
1398
+ throw new Error("Workspace routing is not configured");
1399
+ const workspaces = await workspaceRouting.listWorkspaces();
1400
+ output = { operation: "workspaces", result: workspaceId ? workspaces.filter((item) => item.id === workspaceId) : workspaces };
1401
+ } else {
1402
+ output = await handler(data);
1403
+ }
1341
1404
  const parsedOutput = outputSchema ? await outputSchema.safeParseAsync(output) : undefined;
1342
1405
  if (parsedOutput && !parsedOutput.success) {
1343
1406
  throw new Error(`Tool '${name}' returned a result outside its published output schema`);
@@ -1371,18 +1434,20 @@ function wrapHandler(name, handler, outputSchema) {
1371
1434
  }
1372
1435
  };
1373
1436
  }
1374
- function registerDocsmintMcpCapabilities(server, client2) {
1375
- registerCompactCapabilities(server, client2, wrapHandler);
1437
+ function registerDocsmintMcpCapabilities(server, client2, workspaceRouting) {
1438
+ const wrap = (name, handler, outputSchema) => wrapHandler(name, handler, outputSchema, workspaceRouting);
1439
+ registerCompactCapabilities(server, client2, wrap);
1376
1440
  registerPromptsAndResources(server, client2);
1377
1441
  }
1378
1442
  function createDocsmintMcpServer(options = {}) {
1379
- const server = new McpServer({ name: "docsmint", version: "1.0.3" });
1443
+ const server = new McpServer({ name: "docsmint", version: "2.0.3" });
1380
1444
  const client2 = options.docsClient ? createMcpDocsClient(options.docsClient, options.requestContext) : options.client ?? createMcpDocsClient(createDefaultDocsClient(), options.requestContext);
1381
- registerDocsmintMcpCapabilities(server, client2);
1445
+ registerDocsmintMcpCapabilities(server, client2, options.workspaceRouting);
1382
1446
  return server;
1383
1447
  }
1384
1448
  export {
1385
1449
  capabilityCatalog,
1386
1450
  createDocsmintMcpServer,
1451
+ createMcpScopedResult,
1387
1452
  registerDocsmintMcpCapabilities
1388
1453
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hiai-gg/docsmint",
3
3
  "mcpName": "io.github.HiAi-gg/docsmint",
4
- "version": "1.0.3",
4
+ "version": "2.0.3",
5
5
  "type": "module",
6
6
  "browser": {
7
7
  "./dist/backend-launcher.js": false,
@@ -363,10 +363,11 @@
363
363
  "backend/src/lib/lifecycle-service.ts",
364
364
  "server.json",
365
365
  "README.md",
366
- "LICENSE"
366
+ "LICENSE",
367
+ "packages/cli/src/index.ts"
367
368
  ],
368
369
  "engines": {
369
- "bun": ">= 1.3.14"
370
+ "bun": ">= 1.4.0"
370
371
  },
371
372
  "publishConfig": {
372
373
  "access": "public"
@@ -384,15 +385,16 @@
384
385
  "bullmq": "^6.3.2",
385
386
  "commander": "^15.0.0",
386
387
  "ioredis": "^6.0.0",
387
- "zod": "4.4.3"
388
+ "zod": "4.6.7",
389
+ "happy-dom": "21.0.4"
388
390
  },
389
391
  "peerDependencies": {
390
392
  "drizzle-orm": "^0.45.2",
391
393
  "postgres": "^3.4.9",
392
394
  "@aws-sdk/client-s3": "^3.1121.0",
393
395
  "pino": "^10.0.0",
394
- "@sveltejs/kit": "^2.70.3",
395
- "svelte": "^5.57.0"
396
+ "@sveltejs/kit": "^3.1.0",
397
+ "svelte": "^5.57.1"
396
398
  },
397
399
  "peerDependenciesMeta": {
398
400
  "drizzle-orm": {
@@ -407,5 +409,12 @@
407
409
  "pino": {
408
410
  "optional": true
409
411
  }
412
+ },
413
+ "overrides": {
414
+ "happy-dom": "21.0.4",
415
+ "@sveltejs/kit": "^3.1.0",
416
+ "svelte": "^5.57.1",
417
+ "@scalar/themes": "0.19.3",
418
+ "@scalar/types": "0.25.0"
410
419
  }
411
420
  }
@@ -25,7 +25,7 @@ import { registerSearch } from './commands/search.js';
25
25
  import { registerSnapshot } from './commands/snapshot.js';
26
26
  import { registerUpdate } from './commands/update.js';
27
27
 
28
- const VERSION = '1.0.3';
28
+ const VERSION = '2.0.3';
29
29
 
30
30
  const program = new Command();
31
31
  program.name('docsmint').description('CLI for the DocsMint knowledge workspace').version(VERSION);
package/server.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "id": "1249550690",
11
11
  "subfolder": "packages/mcp-server"
12
12
  },
13
- "version": "1.0.3",
13
+ "version": "2.0.3",
14
14
  "icons": [
15
15
  {
16
16
  "src": "https://raw.githubusercontent.com/HiAi-gg/docsmint/main/frontend/static/logo-dark.png",
@@ -34,7 +34,7 @@
34
34
  "registryType": "npm",
35
35
  "registryBaseUrl": "https://registry.npmjs.org",
36
36
  "identifier": "@hiai-gg/docsmint",
37
- "version": "1.0.3",
37
+ "version": "2.0.3",
38
38
  "runtimeHint": "npx",
39
39
  "transport": {
40
40
  "type": "stdio"