@hiai-gg/docsmint 0.6.8 → 0.7.0

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 (129) hide show
  1. package/README.md +20 -4
  2. package/backend/src/lib/api-keys.ts +14 -6
  3. package/backend/src/lib/lifecycle-service.ts +397 -73
  4. package/dist/backend/index.js +13038 -10864
  5. package/dist/backend-account-runtime-cleanup.js +152 -42
  6. package/dist/backend-api-key-facade.js +207 -61
  7. package/dist/backend-pipeline-cancellation.js +144 -42
  8. package/dist/client.d.ts +12 -2
  9. package/dist/client.js +83 -30
  10. package/dist/frontend/{CategoryDialog-CbXBMBZB.js → CategoryDialog-C67_TXf0.js} +4 -4
  11. package/dist/frontend/{ConfirmDialog-DgMTQBq4.js → ConfirmDialog-_LlrA--f.js} +3 -3
  12. package/dist/frontend/{CreateSnapshotDialog-FUq-ZfBH.js → CreateSnapshotDialog-BmCRpOMv.js} +3 -3
  13. package/dist/frontend/{DatePicker-D6E-EEtZ.js → DatePicker-DsoepNdb.js} +8 -8
  14. package/dist/frontend/{DeleteDialog-8k6JYWCx.js → DeleteDialog-L1A3FhMM.js} +1 -1
  15. package/dist/frontend/{FolderNode-DAAn_T8_.js → FolderNode-CNwi0ySr.js} +1 -1
  16. package/dist/frontend/{HiAiEditor-DSVG3GNd.js → HiAiEditor-B1EDGsnA.js} +6 -6
  17. package/dist/frontend/{SettingsDialog-BDNgf5rv.js → SettingsDialog-AP42xOGg.js} +12 -12
  18. package/dist/frontend/ShareDialog-wGTXuXFE.js +281 -0
  19. package/dist/frontend/{Sidebar-DX08utdV.js → Sidebar-lKQT3dEf.js} +17 -16
  20. package/dist/frontend/{TagCreateDialog-Bb0-Vtzh.js → TagCreateDialog-su8BhLzS.js} +3 -3
  21. package/dist/frontend/api/attachments.js +1 -1
  22. package/dist/frontend/api/settings.js +1 -1
  23. package/dist/frontend/app-shell.js +2 -2
  24. package/dist/frontend/{attachments-B8AuDjno.js → attachments-B2aH3hXF.js} +10 -9
  25. package/dist/frontend/{auth-client-Cygmp1I2.js → auth-client-CnDZwPfp.js} +11 -11
  26. package/dist/frontend/components/category-dialog.js +1 -1
  27. package/dist/frontend/components/create-snapshot-dialog.js +1 -1
  28. package/dist/frontend/components/delete-dialog.js +1 -1
  29. package/dist/frontend/components/editor/compact-editor.js +1 -1
  30. package/dist/frontend/components/editor/document-editor.js +1 -1
  31. package/dist/frontend/components/folder-node.js +1 -1
  32. package/dist/frontend/components/save-as-dialog.js +3 -3
  33. package/dist/frontend/components/settings.js +1 -1
  34. package/dist/frontend/components/share-dialog.d.ts +2 -1
  35. package/dist/frontend/components/share-dialog.js +1 -1
  36. package/dist/frontend/components/sidebar.js +1 -1
  37. package/dist/frontend/components/tag-create-dialog.js +1 -1
  38. package/dist/frontend/components/version-history.js +2 -2
  39. package/dist/frontend/{confirm-dialog-CzmoZw3a.js → confirm-dialog-BG8y2Pum.js} +4 -4
  40. package/dist/frontend/dashboard.js +1008 -998
  41. package/dist/frontend/{db-ByrlYfaI.js → db-Bo1t_76T.js} +1 -1
  42. package/dist/frontend/{dialog-Ce79C9fd.js → dialog-C2iKObEu.js} +7 -7
  43. package/dist/frontend/{dropdown-menu-CJ_7V3N0.js → dropdown-menu-BXIl2E26.js} +12 -12
  44. package/dist/frontend/{floating-layer-anchor-S5RSefGN.js → floating-layer-anchor-BGIndLY-.js} +63 -63
  45. package/dist/frontend/{identity-DyWeNzu_.js → identity-Ynrglr5i.js} +1 -1
  46. package/dist/frontend/{input-BWlOML_m.js → input-eHFb2qiL.js} +2 -2
  47. package/dist/frontend/{label-C2HfJNQ2.js → label-_I1iiaNU.js} +2 -2
  48. package/dist/frontend/offline/identity.js +1 -1
  49. package/dist/frontend/search.js +2 -2
  50. package/dist/frontend/{select-value-JCAp2PmU.js → select-value-CtMyrvDJ.js} +18 -18
  51. package/dist/frontend/{settings-DSrUl4hW.js → settings-BR48ihB4.js} +6 -23
  52. package/dist/frontend/{textarea-DOAE-h42.js → textarea-2eslfANY.js} +2 -2
  53. package/dist/frontend/{utils-BPDRytUU.js → utils-CDBqTgoV.js} +1 -1
  54. package/dist/frontend-ssr/api/attachments.js +1 -1
  55. package/dist/frontend-ssr/api/settings.js +1 -1
  56. package/dist/frontend-ssr/app-shell.js +2 -2
  57. package/dist/frontend-ssr/assets/{CategoryDialog-QHEv_9N4.js → CategoryDialog-BGuHTb3K.js} +4 -4
  58. package/dist/frontend-ssr/assets/{ConfirmDialog-BhAelejz.js → ConfirmDialog-D1BDXXll.js} +3 -3
  59. package/dist/frontend-ssr/assets/{CreateSnapshotDialog-CI8vXXcN.js → CreateSnapshotDialog-BZ45odvJ.js} +3 -3
  60. package/dist/frontend-ssr/assets/{DatePicker-D84cJ-Eq.js → DatePicker-CPtl6W5E.js} +3 -3
  61. package/dist/frontend-ssr/assets/{DeleteDialog-DG9Lm38J.js → DeleteDialog-oHT_p_vG.js} +1 -1
  62. package/dist/frontend-ssr/assets/{FolderNode-kmilhDjO.js → FolderNode-D9kgJG9d.js} +1 -1
  63. package/dist/frontend-ssr/assets/{HiAiEditor-CUOJmKzT.js → HiAiEditor-DOd2MXjD.js} +5 -5
  64. package/dist/frontend-ssr/assets/{SettingsDialog-BjJIiVLc.js → SettingsDialog-CIVbMKmf.js} +12 -12
  65. package/dist/frontend-ssr/assets/{ShareDialog-C9C-XTm4.js → ShareDialog-D2UNUbF7.js} +19 -6
  66. package/dist/frontend-ssr/assets/{Sidebar-C2sUfGNk.js → Sidebar-Bb-k2R-Z.js} +13 -12
  67. package/dist/frontend-ssr/assets/{TagCreateDialog-DUPMitlL.js → TagCreateDialog-6Gk7L3D-.js} +3 -3
  68. package/dist/frontend-ssr/assets/{attachments-Cj3fQyUp.js → attachments-BdkOp8ha.js} +5 -4
  69. package/dist/frontend-ssr/assets/{auth-client-x26kqY8Z.js → auth-client-CojKIzqy.js} +13 -13
  70. package/dist/frontend-ssr/assets/{confirm-dialog-XuyaL8sr.js → confirm-dialog-B9MVS_bF.js} +4 -4
  71. package/dist/frontend-ssr/assets/{db-CnxeO66n.js → db-BhwJPEkn.js} +1 -1
  72. package/dist/frontend-ssr/assets/{dialog-BOV1u6zP.js → dialog-1SB5neow.js} +8 -8
  73. package/dist/frontend-ssr/assets/{dropdown-menu-Dn_vQq9b.js → dropdown-menu-DqoOkdqB.js} +12 -12
  74. package/dist/frontend-ssr/assets/{floating-layer-anchor-BIAu-252.js → floating-layer-anchor-BoiiIEiK.js} +71 -71
  75. package/dist/frontend-ssr/assets/{identity-B3uHoDtf.js → identity-DcMMBKWg.js} +1 -1
  76. package/dist/frontend-ssr/assets/{input-DezGsU3y.js → input-Df-QP3Km.js} +2 -2
  77. package/dist/frontend-ssr/assets/{label-Bj8-TfFN.js → label-CbUOUz6L.js} +2 -2
  78. package/dist/frontend-ssr/assets/{select-value-DBhbkNcc.js → select-value-CXEDWrZg.js} +18 -18
  79. package/dist/frontend-ssr/assets/{settings-Bk5Hk9Vq.js → settings-Mp8EuFSn.js} +3 -21
  80. package/dist/frontend-ssr/assets/{textarea-Dev-qSEc.js → textarea-CHh8NuSS.js} +2 -2
  81. package/dist/frontend-ssr/assets/{utils-DtlPPXpJ.js → utils-DtX0ta7y.js} +1 -1
  82. package/dist/frontend-ssr/components/category-dialog.js +1 -1
  83. package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -1
  84. package/dist/frontend-ssr/components/delete-dialog.js +1 -1
  85. package/dist/frontend-ssr/components/editor/compact-editor.js +1 -1
  86. package/dist/frontend-ssr/components/editor/document-editor.js +1 -1
  87. package/dist/frontend-ssr/components/folder-node.js +1 -1
  88. package/dist/frontend-ssr/components/save-as-dialog.js +3 -3
  89. package/dist/frontend-ssr/components/settings.js +1 -1
  90. package/dist/frontend-ssr/components/share-dialog.js +1 -1
  91. package/dist/frontend-ssr/components/sidebar.js +1 -1
  92. package/dist/frontend-ssr/components/tag-create-dialog.js +1 -1
  93. package/dist/frontend-ssr/components/version-history.js +2 -2
  94. package/dist/frontend-ssr/dashboard.js +31 -29
  95. package/dist/frontend-ssr/offline/identity.js +1 -1
  96. package/dist/frontend-ssr/search.js +2 -2
  97. package/dist/index.d.ts +5 -5
  98. package/dist/index.js +2 -2
  99. package/dist/lifecycle-persistent.d.ts +1 -1
  100. package/dist/lifecycle-runtime.js +52659 -338
  101. package/dist/mcp-cli.js +1056 -0
  102. package/dist/mcp-server.d.ts +39 -0
  103. package/dist/mcp-server.js +1053 -0
  104. package/dist/storage-quota.d.ts +5 -1
  105. package/dist/types.d.ts +7 -0
  106. package/dist/workspace.d.ts +11 -2
  107. package/dist/workspace.js +82 -10
  108. package/package.json +7 -13
  109. package/packages/cli/src/index.ts +1 -1
  110. package/packages/db/src/client.ts +56 -5
  111. package/packages/db/src/schema.ts +192 -1
  112. package/packages/db/src/with-tenant.ts +20 -2
  113. package/server.json +2 -2
  114. package/dist/frontend/ShareDialog-2Mty7hm4.js +0 -258
  115. package/packages/mcp-server/src/capabilities.ts +0 -189
  116. package/packages/mcp-server/src/client.ts +0 -225
  117. package/packages/mcp-server/src/index.ts +0 -8
  118. package/packages/mcp-server/src/server.ts +0 -87
  119. package/packages/mcp-server/src/tools/create-document.ts +0 -34
  120. package/packages/mcp-server/src/tools/create-folder.ts +0 -31
  121. package/packages/mcp-server/src/tools/create-snapshot.ts +0 -27
  122. package/packages/mcp-server/src/tools/export-document.ts +0 -22
  123. package/packages/mcp-server/src/tools/get-document.ts +0 -22
  124. package/packages/mcp-server/src/tools/list-documents.ts +0 -34
  125. package/packages/mcp-server/src/tools/list-folders.ts +0 -26
  126. package/packages/mcp-server/src/tools/search.ts +0 -39
  127. package/packages/mcp-server/src/tools/update-document.ts +0 -38
  128. package/packages/mcp-server/src/tools/version-history.ts +0 -27
  129. package/packages/mcp-server/src/types.ts +0 -126
@@ -1,87 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/server';
2
- import { z, type ZodRawShape } from 'zod';
3
-
4
- import { registerExtendedCapabilities } from './capabilities.js';
5
- import { client as defaultClient, HiaiDocsError, type HiaiDocsClient } from './client.js';
6
- import * as createDocument from './tools/create-document.js';
7
- import * as createFolder from './tools/create-folder.js';
8
- import * as createSnapshot from './tools/create-snapshot.js';
9
- import * as exportDocument from './tools/export-document.js';
10
- import * as getDocument from './tools/get-document.js';
11
- import * as listDocuments from './tools/list-documents.js';
12
- import * as listFolders from './tools/list-folders.js';
13
- import * as search from './tools/search.js';
14
- import * as updateDocument from './tools/update-document.js';
15
- import * as versionHistory from './tools/version-history.js';
16
-
17
- type ToolHandler = (args: Record<string, unknown>) => Promise<unknown>;
18
- interface McpToolResult {
19
- content: Array<{ type: 'text'; text: string }>;
20
- isError?: boolean;
21
- }
22
-
23
- function wrapHandler(
24
- name: string,
25
- handler: ToolHandler
26
- ): (args: Record<string, unknown>) => Promise<McpToolResult> {
27
- return async (args) => {
28
- try {
29
- return {
30
- content: [{ type: 'text', text: JSON.stringify(await handler(args), null, 2) }],
31
- };
32
- } catch (error) {
33
- const message =
34
- error instanceof HiaiDocsError
35
- ? `DocsMint API error (${error.status}): ${error.message}`
36
- : `Tool '${name}' failed: ${error instanceof Error ? error.message : String(error)}`;
37
- return { isError: true, content: [{ type: 'text', text: message }] };
38
- }
39
- };
40
- }
41
-
42
- export function registerDocsmintMcpCapabilities(server: McpServer, client: HiaiDocsClient): void {
43
- const register = <Args>(
44
- name: string,
45
- description: string,
46
- inputSchema: ZodRawShape,
47
- handler: (args: Args) => Promise<unknown>
48
- ): void => {
49
- server.registerTool(
50
- name,
51
- { description, inputSchema: z.object(inputSchema) },
52
- wrapHandler(name, handler as ToolHandler) as never
53
- );
54
- };
55
-
56
- const tools = [
57
- search,
58
- getDocument,
59
- createDocument,
60
- updateDocument,
61
- listDocuments,
62
- listFolders,
63
- createFolder,
64
- createSnapshot,
65
- versionHistory,
66
- exportDocument,
67
- ] as const;
68
- for (const tool of tools) {
69
- register(
70
- tool.definition.name,
71
- tool.definition.description,
72
- tool.definition.inputSchema as ZodRawShape,
73
- tool.createHandler(client) as ToolHandler
74
- );
75
- }
76
- registerExtendedCapabilities(server, client);
77
- }
78
-
79
- export interface CreateDocsmintMcpServerOptions {
80
- client?: HiaiDocsClient;
81
- }
82
-
83
- export function createDocsmintMcpServer(options: CreateDocsmintMcpServerOptions = {}): McpServer {
84
- const server = new McpServer({ name: 'docsmint', version: '0.6.8' });
85
- registerDocsmintMcpCapabilities(server, options.client ?? defaultClient);
86
- return server;
87
- }
@@ -1,34 +0,0 @@
1
- import { z } from 'zod';
2
- import { client, type HiaiDocsClient } from '../client.js';
3
- import type { DocumentDetail } from '../types.js';
4
-
5
- export const definition = {
6
- name: 'create_document',
7
- description:
8
- 'Create a new document. Optionally provide initial markdown content and a folder ID.',
9
- inputSchema: {
10
- title: z.string().describe('Document title.'),
11
- content: z.string().optional().describe('Initial markdown content for the document.'),
12
- folderId: z.string().optional().describe('Optional folder ID to place the document in.'),
13
- categoryId: z
14
- .string()
15
- .optional()
16
- .describe(
17
- 'Optional category ID. Category keys are always rebound to their configured category.'
18
- ),
19
- },
20
- } as const;
21
-
22
- export interface CreateDocumentArgs {
23
- title: string;
24
- content?: string;
25
- folderId?: string;
26
- categoryId?: string;
27
- }
28
-
29
- export const createHandler = (api: HiaiDocsClient) =>
30
- async function createDocument(args: CreateDocumentArgs): Promise<DocumentDetail> {
31
- return (await api.createDocument(args)) as DocumentDetail;
32
- };
33
-
34
- export const handler = createHandler(client);
@@ -1,31 +0,0 @@
1
- import { z } from 'zod';
2
- import { client, type HiaiDocsClient } from '../client.js';
3
- import type { Folder } from '../types.js';
4
-
5
- export const definition = {
6
- name: 'create_folder',
7
- description: 'Create a new folder, optionally nested under a parent folder.',
8
- inputSchema: {
9
- name: z.string().describe('Folder name.'),
10
- parentId: z.string().optional().describe('Optional parent folder ID for nesting.'),
11
- categoryId: z
12
- .string()
13
- .optional()
14
- .describe(
15
- 'Optional category ID. Category keys are always rebound to their configured category.'
16
- ),
17
- },
18
- } as const;
19
-
20
- export interface CreateFolderArgs {
21
- name: string;
22
- parentId?: string;
23
- categoryId?: string;
24
- }
25
-
26
- export const createHandler = (api: HiaiDocsClient) =>
27
- async function createFolder(args: CreateFolderArgs): Promise<Folder> {
28
- return (await api.createFolder(args)) as Folder;
29
- };
30
-
31
- export const handler = createHandler(client);
@@ -1,27 +0,0 @@
1
- import { z } from 'zod';
2
- import { client, type HiaiDocsClient } from '../client.js';
3
- import type { Version } from '../types.js';
4
-
5
- export const definition = {
6
- name: 'create_snapshot',
7
- description: 'Create a named snapshot (labelled version) of a document from its current content.',
8
- inputSchema: {
9
- documentId: z.string().describe('Document ID to snapshot.'),
10
- label: z.string().describe("Short label for the snapshot (e.g. 'v1.0-release')."),
11
- description: z.string().optional().describe('Optional longer description of the snapshot.'),
12
- },
13
- } as const;
14
-
15
- export interface CreateSnapshotArgs {
16
- documentId: string;
17
- label: string;
18
- description?: string;
19
- }
20
-
21
- export const createHandler = (api: HiaiDocsClient) =>
22
- async function createSnapshot(args: CreateSnapshotArgs): Promise<Version> {
23
- const { documentId, ...input } = args;
24
- return (await api.createSnapshot(documentId, input)) as Version;
25
- };
26
-
27
- export const handler = createHandler(client);
@@ -1,22 +0,0 @@
1
- import { z } from 'zod';
2
- import { client, type HiaiDocsClient } from '../client.js';
3
- import type { ExportResponse } from '../types.js';
4
-
5
- export const definition = {
6
- name: 'export_document',
7
- description: 'Export a document as markdown. Returns the rendered markdown content.',
8
- inputSchema: {
9
- id: z.string().describe('Document ID to export.'),
10
- },
11
- } as const;
12
-
13
- export interface ExportDocumentArgs {
14
- id: string;
15
- }
16
-
17
- export const createHandler = (api: HiaiDocsClient) =>
18
- async function exportDocument(args: ExportDocumentArgs): Promise<ExportResponse> {
19
- return (await api.exportDocument(args.id)) as ExportResponse;
20
- };
21
-
22
- export const handler = createHandler(client);
@@ -1,22 +0,0 @@
1
- import { z } from 'zod';
2
- import { client, type HiaiDocsClient } from '../client.js';
3
- import type { DocumentDetail } from '../types.js';
4
-
5
- export const definition = {
6
- name: 'get_document',
7
- description: 'Fetch a single document by ID. Returns full content, metadata, and tags.',
8
- inputSchema: {
9
- id: z.string().describe('Document ID.'),
10
- },
11
- } as const;
12
-
13
- export interface GetDocumentArgs {
14
- id: string;
15
- }
16
-
17
- export const createHandler = (api: HiaiDocsClient) =>
18
- async function getDocument(args: GetDocumentArgs): Promise<DocumentDetail> {
19
- return (await api.getDocument(args.id)) as DocumentDetail;
20
- };
21
-
22
- export const handler = createHandler(client);
@@ -1,34 +0,0 @@
1
- import { z } from 'zod';
2
- import { client, type HiaiDocsClient } from '../client.js';
3
- import type { ListDocumentsResponse } from '../types.js';
4
-
5
- export const definition = {
6
- name: 'list_documents',
7
- description: 'List documents with pagination, optionally filtered by folder or tag.',
8
- inputSchema: {
9
- folderId: z.string().optional().describe('Optional folder ID to filter by.'),
10
- tag: z.string().optional().describe('Optional tag ID to filter by.'),
11
- page: z.number().int().positive().optional().describe('Page number (1-indexed, default 1).'),
12
- limit: z
13
- .number()
14
- .int()
15
- .positive()
16
- .max(100)
17
- .optional()
18
- .describe('Items per page (default 20, max 100).'),
19
- },
20
- } as const;
21
-
22
- export interface ListDocumentsArgs {
23
- folderId?: string;
24
- tag?: string;
25
- page?: number;
26
- limit?: number;
27
- }
28
-
29
- export const createHandler = (api: HiaiDocsClient) =>
30
- async function listDocuments(args: ListDocumentsArgs): Promise<ListDocumentsResponse> {
31
- return (await api.listDocuments(args)) as ListDocumentsResponse;
32
- };
33
-
34
- export const handler = createHandler(client);
@@ -1,26 +0,0 @@
1
- import { z } from 'zod';
2
- import { client, type HiaiDocsClient } from '../client.js';
3
- import type { Folder } from '../types.js';
4
-
5
- export const definition = {
6
- name: 'list_folders',
7
- description:
8
- 'List folders, optionally scoped to a parent folder. Returns a flat list of immediate children.',
9
- inputSchema: {
10
- parentId: z
11
- .string()
12
- .optional()
13
- .describe('Optional parent folder ID. Omit to list top-level (root) folders.'),
14
- },
15
- } as const;
16
-
17
- export interface ListFoldersArgs {
18
- parentId?: string;
19
- }
20
-
21
- export const createHandler = (api: HiaiDocsClient) =>
22
- async function listFolders(args: ListFoldersArgs): Promise<Folder[]> {
23
- return (await api.listFolders(args)) as Folder[];
24
- };
25
-
26
- export const handler = createHandler(client);
@@ -1,39 +0,0 @@
1
- import { z } from 'zod';
2
- import { client, type HiaiDocsClient } from '../client.js';
3
- import type { SearchResponse } from '../types.js';
4
-
5
- export const definition = {
6
- name: 'search_documents',
7
- description:
8
- 'Hybrid search across documents (full-text + semantic). Supports filtering by folder and tags.',
9
- inputSchema: {
10
- query: z.string().describe('Search query string.'),
11
- folder: z.string().optional().describe('Optional folder ID to scope the search to.'),
12
- tags: z.array(z.string()).optional().describe('Optional tag IDs to filter by.'),
13
- limit: z
14
- .number()
15
- .int()
16
- .positive()
17
- .optional()
18
- .describe('Maximum number of results to return (default 20).'),
19
- },
20
- } as const;
21
-
22
- export type SearchArgs = {
23
- query: string;
24
- folder?: string;
25
- tags?: string[];
26
- limit?: number;
27
- };
28
-
29
- export const createHandler = (api: HiaiDocsClient) =>
30
- async function searchDocuments(args: SearchArgs): Promise<SearchResponse> {
31
- return (await api.search({
32
- query: args.query,
33
- folder: args.folder,
34
- tags: args.tags,
35
- limit: args.limit,
36
- })) as SearchResponse;
37
- };
38
-
39
- export const handler = createHandler(client);
@@ -1,38 +0,0 @@
1
- import { z } from 'zod';
2
- import { client, type HiaiDocsClient } from '../client.js';
3
- import type { DocumentDetail } from '../types.js';
4
-
5
- export const definition = {
6
- name: 'update_document',
7
- description:
8
- "Update an existing document's title and/or content. The server creates a new version on each update.",
9
- inputSchema: {
10
- id: z.string().describe('Document ID to update.'),
11
- title: z.string().optional().describe('New title for the document.'),
12
- content: z.string().optional().describe('New markdown content for the document.'),
13
- folderId: z.string().nullable().optional().describe('Move the document to a folder.'),
14
- categoryId: z
15
- .string()
16
- .nullable()
17
- .optional()
18
- .describe(
19
- 'Move the document to a category. Category keys cannot escape their configured category.'
20
- ),
21
- },
22
- } as const;
23
-
24
- export interface UpdateDocumentArgs {
25
- id: string;
26
- title?: string;
27
- content?: string;
28
- folderId?: string | null;
29
- categoryId?: string | null;
30
- }
31
-
32
- export const createHandler = (api: HiaiDocsClient) =>
33
- async function updateDocument(args: UpdateDocumentArgs): Promise<DocumentDetail> {
34
- const { id, ...patch } = args;
35
- return (await api.updateDocument(id, patch)) as DocumentDetail;
36
- };
37
-
38
- export const handler = createHandler(client);
@@ -1,27 +0,0 @@
1
- import { z } from 'zod';
2
- import { client, type HiaiDocsClient } from '../client.js';
3
- import type { Version } from '../types.js';
4
-
5
- export const definition = {
6
- name: 'get_version_history',
7
- description: 'List the version history for a document. Optionally restrict to named snapshots.',
8
- inputSchema: {
9
- documentId: z.string().describe('Document ID whose versions should be listed.'),
10
- onlySnapshots: z
11
- .boolean()
12
- .optional()
13
- .describe('When true, only return named snapshots (skip auto-saved revisions).'),
14
- },
15
- } as const;
16
-
17
- export interface VersionHistoryArgs {
18
- documentId: string;
19
- onlySnapshots?: boolean;
20
- }
21
-
22
- export const createHandler = (api: HiaiDocsClient) =>
23
- async function getVersionHistory(args: VersionHistoryArgs): Promise<Version[]> {
24
- return (await api.getVersionHistory(args.documentId, args.onlySnapshots)) as Version[];
25
- };
26
-
27
- export const handler = createHandler(client);
@@ -1,126 +0,0 @@
1
- /**
2
- * Shared TypeScript types for hiai-docs REST API responses.
3
- * Keep these minimal — only the fields consumed by MCP tools.
4
- */
5
-
6
- export interface Tag {
7
- id: string;
8
- name: string;
9
- color: string | null;
10
- }
11
-
12
- export interface DocumentSummary {
13
- id: string;
14
- title: string;
15
- content?: string;
16
- folderId: string | null;
17
- createdAt: string;
18
- updatedAt: string;
19
- tags?: Tag[];
20
- }
21
-
22
- export interface DocumentDetail {
23
- id: string;
24
- ownerId: string;
25
- folderId: string | null;
26
- folderName?: string | null;
27
- title: string;
28
- content: string;
29
- contentJson?: unknown;
30
- createdAt: string;
31
- updatedAt: string;
32
- tags?: Tag[];
33
- }
34
-
35
- export interface SearchResultItem {
36
- id: string;
37
- title: string;
38
- snippet: string;
39
- score: number;
40
- folder_id: string | null;
41
- folder_name: string | null;
42
- created_at: string;
43
- updated_at: string;
44
- tags?: Tag[];
45
- }
46
-
47
- export interface SearchResponse {
48
- items: SearchResultItem[];
49
- total: number;
50
- page: number;
51
- limit: number;
52
- }
53
-
54
- export interface ListDocumentsResponse {
55
- items: DocumentSummary[];
56
- total: number;
57
- page: number;
58
- limit: number;
59
- }
60
-
61
- export interface Folder {
62
- id: string;
63
- name: string;
64
- parentId: string | null;
65
- ownerId: string;
66
- createdAt: string;
67
- updatedAt: string;
68
- }
69
-
70
- export interface Version {
71
- id: string;
72
- documentId: string;
73
- content: string;
74
- contentJson?: unknown;
75
- createdBy: string;
76
- createdAt: string;
77
- }
78
-
79
- export interface ExportResponse {
80
- markdown: string;
81
- filename?: string;
82
- }
83
-
84
- export interface CreateDocumentInput {
85
- title: string;
86
- content?: string;
87
- folderId?: string;
88
- }
89
-
90
- export interface UpdateDocumentInput {
91
- title?: string;
92
- content?: string;
93
- }
94
-
95
- export interface CreateSnapshotInput {
96
- label: string;
97
- description?: string;
98
- }
99
-
100
- export interface CreateFolderInput {
101
- name: string;
102
- parentId?: string;
103
- }
104
-
105
- export interface SearchInput {
106
- query: string;
107
- folder?: string;
108
- tags?: string[];
109
- limit?: number;
110
- }
111
-
112
- export interface ListDocumentsInput {
113
- folderId?: string;
114
- tag?: string;
115
- page?: number;
116
- limit?: number;
117
- }
118
-
119
- export interface ListFoldersInput {
120
- parentId?: string;
121
- }
122
-
123
- export interface VersionHistoryInput {
124
- documentId: string;
125
- onlySnapshots?: boolean;
126
- }