@hiai-gg/docsmint 2.0.4 → 2.1.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 (46) hide show
  1. package/README.md +67 -2
  2. package/dist/backend/index.js +22540 -2807
  3. package/dist/backend-account-runtime-cleanup.js +2 -1
  4. package/dist/backend-api-key-facade.js +2 -1
  5. package/dist/backend-pipeline-cancellation.js +2 -1
  6. package/dist/client.d.ts +33 -7
  7. package/dist/client.js +55 -1
  8. package/dist/frontend/{HiAiEditor-DDpfdQEg.js → HiAiEditor-D6ad_auS.js} +2 -2
  9. package/dist/frontend/{SettingsDialog-DzlYW50I.js → SettingsDialog-B8Oswuqb.js} +4 -4
  10. package/dist/frontend/{Sidebar-rFiVen96.js → Sidebar-BV0IDqTS.js} +1 -1
  11. package/dist/frontend/api/settings.js +1 -1
  12. package/dist/frontend/app-shell.js +2 -2
  13. package/dist/frontend/{auth-client-CXR-7mIO.js → auth-client-C5EyWdAF.js} +416 -349
  14. package/dist/frontend/components/editor/compact-editor.js +1 -1
  15. package/dist/frontend/components/editor/document-editor.js +1 -1
  16. package/dist/frontend/components/settings.js +1 -1
  17. package/dist/frontend/components/sidebar.js +1 -1
  18. package/dist/frontend/{db-Dya0HRhS.js → db-CgTtukT4.js} +1 -1
  19. package/dist/frontend/{identity-BOA7Jejv.js → identity-CNhtuCJV.js} +1 -1
  20. package/dist/frontend/offline/identity.js +1 -1
  21. package/dist/frontend/{settings-BRcYFQa_.js → settings-CHx4wBwb.js} +1 -1
  22. package/dist/frontend-ssr/api/settings.js +1 -1
  23. package/dist/frontend-ssr/app-shell.js +2 -2
  24. package/dist/frontend-ssr/assets/{HiAiEditor-Bj6tiE97.js → HiAiEditor-Cj3B2Dt6.js} +2 -2
  25. package/dist/frontend-ssr/assets/{SettingsDialog-h4SFwpUa.js → SettingsDialog-DAT-Zxu0.js} +4 -4
  26. package/dist/frontend-ssr/assets/{Sidebar-BFBpsd3L.js → Sidebar-B_Ey6QNL.js} +1 -1
  27. package/dist/frontend-ssr/assets/{auth-client-BC4hSFKF.js → auth-client-CITU3xkE.js} +308 -227
  28. package/dist/frontend-ssr/assets/{db-C3rFdTZa.js → db-DxRzq-kx.js} +1 -1
  29. package/dist/frontend-ssr/assets/{identity-DNIo1bgc.js → identity-B7ngLQzZ.js} +1 -1
  30. package/dist/frontend-ssr/assets/{settings-DWCpfCPj.js → settings-BRxvn30Y.js} +1 -1
  31. package/dist/frontend-ssr/components/editor/compact-editor.js +1 -1
  32. package/dist/frontend-ssr/components/editor/document-editor.js +1 -1
  33. package/dist/frontend-ssr/components/settings.js +1 -1
  34. package/dist/frontend-ssr/components/sidebar.js +1 -1
  35. package/dist/frontend-ssr/offline/identity.js +1 -1
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/lifecycle-runtime.js +4 -1
  39. package/dist/mcp-cli.js +301 -22
  40. package/dist/mcp-server.d.ts +92 -23
  41. package/dist/mcp-server.js +469 -22
  42. package/dist/types.d.ts +68 -1
  43. package/package.json +2 -2
  44. package/packages/cli/src/index.ts +1 -1
  45. package/packages/db/src/schema.ts +3 -1
  46. package/server.json +2 -2
@@ -1,6 +1,11 @@
1
- import type { McpServer } from "@modelcontextprotocol/server";
1
+ import type {
2
+ McpServer,
3
+ Tool,
4
+ Prompt,
5
+ Resource,
6
+ } from "@modelcontextprotocol/server";
2
7
 
3
- import type { DocsClient, DocsRequestContext } from "./index.js";
8
+ import type { DocsClient, DocsRequestContext, DocsListOptions, DocsDocumentExport } from "./index.js";
4
9
 
5
10
  export interface DocsMintMcpCapabilityCatalog {
6
11
  readonly tools: readonly string[];
@@ -14,43 +19,84 @@ export interface HiaiDocsClient {
14
19
  deleteDocument?(id: string): Promise<void>;
15
20
  deleteFolder?(id: string): Promise<void>;
16
21
  deleteCategory?(id: string): Promise<void>;
17
- restoreDocumentVersion?(documentId: string, versionId: string): Promise<unknown>;
18
- search(params: { query: string; folder?: string; tags?: string[]; limit?: number }): Promise<unknown>;
22
+ restoreDocumentVersion?(
23
+ documentId: string,
24
+ versionId: string,
25
+ ): Promise<unknown>;
26
+ search(params: {
27
+ query: string;
28
+ folder?: string;
29
+ tags?: string[];
30
+ includeChunks?: boolean;
31
+ includeDiagnostics?: boolean;
32
+ limit?: number;
33
+ }): Promise<unknown>;
19
34
  getDocument(id: string): Promise<unknown>;
20
- createDocument(input: { title?: string; content?: string; folderId?: string | null; categoryId?: string | null }): Promise<unknown>;
21
- updateDocument(id: string, input: { title?: string; content?: string; folderId?: string | null; categoryId?: string | null }): Promise<unknown>;
22
- listDocuments(params: { folderId?: string; tag?: string; page?: number; limit?: number }): Promise<unknown>;
35
+ createDocument(input: {
36
+ title?: string;
37
+ content?: string;
38
+ folderId?: string | null;
39
+ categoryId?: string | null;
40
+ }): Promise<unknown>;
41
+ updateDocument(
42
+ id: string,
43
+ input: {
44
+ title?: string;
45
+ content?: string;
46
+ folderId?: string | null;
47
+ categoryId?: string | null;
48
+ },
49
+ ): Promise<unknown>;
50
+ listDocuments(params: DocsListOptions): Promise<unknown>;
23
51
  listFolders(params: { parentId?: string }): Promise<unknown>;
24
- createFolder(input: { name: string; parentId?: string | null; categoryId?: string | null }): Promise<unknown>;
52
+ createFolder(input: {
53
+ name: string;
54
+ parentId?: string | null;
55
+ categoryId?: string | null;
56
+ }): Promise<unknown>;
25
57
  listCategories(): Promise<unknown>;
26
58
  createCategory(input: { name: string }): Promise<unknown>;
27
59
  listTags(): Promise<unknown>;
28
60
  getRelatedDocuments(documentId: string, limit?: number): Promise<unknown>;
29
- searchGraph(input: { query?: string; docIds: string[]; limit?: number }): Promise<unknown>;
61
+ searchGraph(input: {
62
+ query?: string;
63
+ docIds: string[];
64
+ limit?: number;
65
+ }): Promise<unknown>;
30
66
  getDocumentIndexStatus(documentId: string): Promise<unknown>;
31
67
  refreshDocumentIndex(documentId: string): Promise<unknown>;
32
- createSnapshot(documentId: string, input: { label: string; description?: string }): Promise<unknown>;
33
- getVersionHistory(documentId: string, onlySnapshots?: boolean): Promise<unknown>;
34
- exportDocument(id: string): Promise<{ markdown: string; filename?: string }>;
68
+ createSnapshot(
69
+ documentId: string,
70
+ input: { label: string; description?: string },
71
+ ): Promise<unknown>;
72
+ getVersionHistory(
73
+ documentId: string,
74
+ onlySnapshots?: boolean,
75
+ ): Promise<unknown>;
76
+ exportDocument(id: string): Promise<DocsDocumentExport>;
35
77
  }
36
78
 
37
79
  export interface McpWorkspaceDescriptor {
38
- id: string;
39
- name: string;
40
- slug: string;
41
- entireWorkspace: boolean;
42
- categoryIds: string[];
80
+ id: string;
81
+ name: string;
82
+ slug: string;
83
+ entireWorkspace: boolean;
84
+ categoryIds: string[];
43
85
  }
44
86
  export interface McpWorkspaceRouting {
45
- listWorkspaces(): Promise<McpWorkspaceDescriptor[]>;
46
- assertSelection(workspaceId: string): Promise<void>;
87
+ listWorkspaces(): Promise<McpWorkspaceDescriptor[]>;
88
+ assertSelection(workspaceId: string): Promise<void>;
47
89
  }
48
- export declare function createMcpScopedResult(toolName: 'find_documents' | 'list_workspace_structure' | 'list_trash', input: unknown): unknown;
90
+ export declare function createMcpScopedResult(
91
+ toolName: "find_documents" | "list_workspace_structure" | "list_trash",
92
+ input: unknown,
93
+ ): unknown;
49
94
 
50
95
  export interface CreateDocsmintMcpServerOptions {
51
- docsClient?: DocsClient;
96
+ docsClient?: Omit<DocsClient, "withRequestContext">;
97
+ decorateResult?: (tool: string, output: unknown) => unknown | Promise<unknown>;
52
98
  requestContext?: DocsRequestContext;
53
- workspaceRouting?: McpWorkspaceRouting;
99
+ workspaceRouting?: McpWorkspaceRouting;
54
100
  /** @deprecated Inject a legacy capability client only for compatibility. */
55
101
  client?: HiaiDocsClient;
56
102
  }
@@ -58,9 +104,32 @@ export interface CreateDocsmintMcpServerOptions {
58
104
  export declare function registerDocsmintMcpCapabilities(
59
105
  server: McpServer,
60
106
  client: HiaiDocsClient,
61
- workspaceRouting?: McpWorkspaceRouting,
107
+ workspaceRouting?: McpWorkspaceRouting,
108
+ decorateResult?: (tool: string, output: unknown) => unknown | Promise<unknown>,
62
109
  ): void;
63
110
 
64
111
  export declare function createDocsmintMcpServer(
65
112
  options?: CreateDocsmintMcpServerOptions,
66
113
  ): McpServer;
114
+
115
+ /** Public inventory derived from the actual MCP registration and protocol discovery. */
116
+ export interface DocsMintMcpDocumentationCatalog {
117
+ server: { name: string; version: string };
118
+ tools: Array<Tool & { examples: Record<string, unknown>[] }>;
119
+ prompts: Prompt[];
120
+ resources: Resource[];
121
+ }
122
+ export declare function generateDocsmintMcpCatalog(): Promise<DocsMintMcpDocumentationCatalog>;
123
+
124
+ export interface DocsmintMcpHttpOptions {
125
+ createServer(request: Request): Promise<McpServer | Response>;
126
+ allowedOrigins: readonly string[];
127
+ enabled?: boolean;
128
+ onerror?: (error: Error) => void;
129
+ }
130
+ export declare function createDocsmintMcpHttpHandler(
131
+ options: DocsmintMcpHttpOptions,
132
+ ): {
133
+ fetch(request: Request): Promise<Response>;
134
+ close(): Promise<void>;
135
+ };