@powerhousedao/reactor-mcp 6.2.2-dev.8 → 6.2.2-dev.81

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.
package/dist/cli.mjs CHANGED
@@ -1,9 +1,10 @@
1
- import { t as createServer$1, v as logger } from "./server-BFnC84s0.mjs";
1
+ import { n as logger, t as createServer$1 } from "./server-Bm3pkKqd.mjs";
2
2
  import { childLogger, documentModelDocumentModelModule } from "document-model";
3
3
  import { ReactorBuilder, ReactorClientBuilder } from "@powerhousedao/reactor";
4
+ import { driveDocumentModelModule } from "@powerhousedao/shared/document-drive";
4
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
6
  import { reactorDriveDocumentModelModule } from "@powerhousedao/reactor-drive";
6
- import { driveDocumentModelModule } from "@powerhousedao/shared/document-drive";
7
+ import { ReactorGroupV1 } from "@powerhousedao/reactor-group";
7
8
  import { EnvVarProvider } from "@openfeature/env-var-provider";
8
9
  import { OpenFeature } from "@openfeature/server-sdk";
9
10
  import { access } from "node:fs/promises";
@@ -91,7 +92,8 @@ var VitePackageLoader = class {
91
92
  const baseDocumentModels = [
92
93
  documentModelDocumentModelModule,
93
94
  driveDocumentModelModule,
94
- reactorDriveDocumentModelModule
95
+ reactorDriveDocumentModelModule,
96
+ ReactorGroupV1
95
97
  ];
96
98
  async function createReactorClient(documentModels) {
97
99
  const reactorBuilder = new ReactorBuilder().withDocumentModelSources(baseDocumentModels.concat(documentModels));
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["createServer"],"sources":["../src/feature-flags.ts","../src/stdio/loader.ts","../src/stdio/index.ts","../src/cli.ts"],"sourcesContent":["import { EnvVarProvider } from \"@openfeature/env-var-provider\";\nimport { OpenFeature } from \"@openfeature/server-sdk\";\n\nexport async function initFeatureFlags() {\n // for now, we're only using env vars for feature flags\n const provider = new EnvVarProvider();\n\n await OpenFeature.setProviderAndWait(provider);\n\n return OpenFeature.getClient();\n}\n","import type { DocumentModelModule } from \"@powerhousedao/shared/document-model\";\nimport { childLogger } from \"document-model\";\nimport { access } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { ViteDevServer } from \"vite\";\nimport { createServer } from \"vite\";\n\ninterface IPackageLoader {\n load(): Promise<DocumentModelModule[]>;\n onDocumentModelsChange(\n callback: (models: DocumentModelModule[]) => void,\n ): Promise<() => void>;\n}\n\nfunction debounce<T extends (...args: any[]) => void>(\n func: T,\n delay = 100,\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout>;\n return (...args: Parameters<T>): void => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => func(...args), delay);\n };\n}\n\nfunction isSubpath(parent: string, dir: string) {\n const relative = path.relative(parent, dir);\n return relative && !relative.startsWith(\"..\") && !path.isAbsolute(relative);\n}\n\nexport class VitePackageLoader implements IPackageLoader {\n private readonly logger = childLogger([\"reactor-mcp\", \"vite-loader\"]);\n\n private readonly root: string;\n private readonly documentModelsDir: string;\n\n private vite: ViteDevServer | undefined;\n\n readonly name = \"VitePackageLoader\";\n\n constructor(root: string, documentModelsDir: string) {\n this.root = root;\n this.documentModelsDir = documentModelsDir;\n }\n\n private get fullPath(): string {\n return path.join(this.root, this.documentModelsDir);\n }\n\n private async initVite() {\n if (this.vite) {\n return this.vite;\n }\n\n this.vite = await createServer({\n root: this.root,\n logLevel: \"info\",\n server: {\n hmr: false,\n middlewareMode: true,\n warmup: {\n ssrFiles: [this.fullPath],\n },\n fs: {\n allow: [this.fullPath],\n },\n },\n optimizeDeps: {\n // It's recommended to disable deps optimization\n noDiscovery: true,\n include: [],\n },\n });\n\n return this.vite;\n }\n\n async load(): Promise<DocumentModelModule[]> {\n const vite = await this.initVite();\n\n await access(this.fullPath);\n this.logger.verbose(\"Loading document models from @path\", this.fullPath);\n\n try {\n const localDMs = (await vite.ssrLoadModule(this.fullPath)) as Record<\n string,\n DocumentModelModule\n >;\n\n const exports = Object.values(localDMs);\n\n // duck type\n const documentModels: DocumentModelModule[] = [];\n for (const dm of exports) {\n if (dm.documentModel) {\n documentModels.push(dm);\n }\n }\n\n this.logger.verbose(\n ` ➜ Loaded ${documentModels.length} Document Models from: ${this.fullPath}`,\n );\n\n return documentModels;\n } catch (e) {\n this.logger.verbose(\n ` ➜ No Document Models found for: ${this.fullPath}${e ? `\\n${JSON.stringify(e)}` : \"\"}`,\n );\n }\n\n return [];\n }\n\n async onDocumentModelsChange(\n callback: (models: DocumentModelModule[]) => void,\n ) {\n const vite = await this.initVite();\n const listener = debounce(async (changedPath: string) => {\n if (isSubpath(this.fullPath, changedPath)) {\n const documentModels = await this.load();\n callback(documentModels);\n }\n }, 100);\n vite.watcher.on(\"change\", listener);\n\n return () => {\n vite.watcher.off(\"change\", listener);\n };\n }\n}\n","import { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { ReactorBuilder, ReactorClientBuilder } from \"@powerhousedao/reactor\";\nimport { reactorDriveDocumentModelModule } from \"@powerhousedao/reactor-drive\";\nimport { driveDocumentModelModule } from \"@powerhousedao/shared/document-drive\";\nimport type { DocumentModelModule } from \"@powerhousedao/shared/document-model\";\nimport { documentModelDocumentModelModule } from \"document-model\";\nimport { initFeatureFlags } from \"../feature-flags.js\";\nimport { logger } from \"../logger.js\";\nimport { createServer } from \"../server.js\";\nimport { VitePackageLoader } from \"./loader.js\";\n\nexport interface IMcpOptions {\n remoteDrive?: string;\n root?: string;\n documentModelsDir?: string;\n}\n\nconst baseDocumentModels: DocumentModelModule<any>[] = [\n documentModelDocumentModelModule,\n driveDocumentModelModule,\n reactorDriveDocumentModelModule,\n];\n\nasync function createReactorClient(documentModels: DocumentModelModule[]) {\n const reactorBuilder = new ReactorBuilder().withDocumentModelSources(\n baseDocumentModels.concat(documentModels),\n );\n\n const module = await new ReactorClientBuilder()\n .withReactorBuilder(reactorBuilder)\n .buildModule();\n\n return module;\n}\n\nexport async function initStdioMcpServer(options?: IMcpOptions) {\n const {\n remoteDrive,\n root,\n documentModelsDir = \"./document-models\",\n } = options ?? {};\n\n // initialize feature flags\n await initFeatureFlags();\n\n // if root of project is passed then loads local document models\n let documentModelsLoader: VitePackageLoader | undefined;\n const documentModels: DocumentModelModule[] = [];\n\n if (root) {\n documentModelsLoader = new VitePackageLoader(root, documentModelsDir);\n try {\n const loadedModels = await documentModelsLoader.load();\n documentModels.push(...loadedModels);\n logger.info(\n \"Loaded document models: @models\",\n loadedModels.map((m) => m.documentModel.global.name).join(\", \"),\n );\n } catch (e) {\n logger.error(\"@error\", e);\n }\n }\n\n // initializes reactor client with loaded document models\n const reactorModule = await createReactorClient(documentModels);\n const { client, reactor, reactorModule: rModule } = reactorModule;\n\n // listens for changes in the local document models to update the reactor\n if (documentModelsLoader && rModule?.documentModelRegistry) {\n const unsubscribe = await documentModelsLoader.onDocumentModelsChange(\n (models) => {\n const results = rModule.documentModelRegistry.registerModules(\n ...baseDocumentModels.concat(models),\n );\n for (const result of results) {\n if (result.status === \"error\") {\n logger.error(\n \"Failed to register document model: @error\",\n result.error,\n );\n }\n }\n },\n );\n\n process.on(\"exit\", () => {\n unsubscribe();\n reactor.kill();\n });\n }\n\n // if a remote drive is passed, log a warning since remote drives\n // are now handled at a different level (SyncManager)\n if (remoteDrive) {\n logger.warn(\n \"Remote drive configuration via MCP is not supported in the new reactor. \" +\n \"Remote drives should be configured at the server level.\",\n );\n }\n\n // starts the server\n // Note: syncManager is not available in stdio mode currently\n const server = await createServer({ client });\n\n // starts Stdio transport\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n","import { logger } from \"./logger.js\";\nimport { initStdioMcpServer } from \"./stdio/index.js\";\n\ninitStdioMcpServer({\n remoteDrive: process.argv.at(2),\n root: process.cwd(),\n}).catch((error: unknown) => {\n logger.error(\"@error\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;AAGA,eAAsB,mBAAmB;CAEvC,MAAM,WAAW,IAAI,gBAAgB;AAErC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c,MAAM,qBAAqB,wBAC5C,WAAW;GACV,MAAM,UAAU,QAAQ,sBAAsB,gBAC5C,GAAG,mBAAmB,OAAO,OAAO,CACrC;AACD,QAAK,MAAM,UAAU,QACnB,KAAI,OAAO,WAAW,QACpB,QAAO,MACL,6CACA,OAAO,MACR;IAIR;AAED,UAAQ,GAAG,cAAc;AACvB,gBAAa;AACb,WAAQ,MAAM;IACd;;AAKJ,KAAI,YACF,QAAO,KACL,kIAED;CAKH,MAAM,SAAS,MAAMA,eAAa,EAAE,QAAQ,CAAC;CAG7C,MAAM,YAAY,IAAI,sBAAsB;AAC5C,OAAM,OAAO,QAAQ,UAAU;;;;ACvGjC,mBAAmB;CACjB,aAAa,QAAQ,KAAK,GAAG,EAAE;CAC/B,MAAM,QAAQ,KAAK;CACpB,CAAC,CAAC,OAAO,UAAmB;AAC3B,QAAO,MAAM,UAAU,MAAM;AAC7B,SAAQ,KAAK,EAAE;EACf"}
1
+ {"version":3,"file":"cli.mjs","names":["createServer"],"sources":["../src/feature-flags.ts","../src/stdio/loader.ts","../src/stdio/index.ts","../src/cli.ts"],"sourcesContent":["import { EnvVarProvider } from \"@openfeature/env-var-provider\";\nimport { OpenFeature } from \"@openfeature/server-sdk\";\n\nexport async function initFeatureFlags() {\n // for now, we're only using env vars for feature flags\n const provider = new EnvVarProvider();\n\n await OpenFeature.setProviderAndWait(provider);\n\n return OpenFeature.getClient();\n}\n","import type { DocumentModelModule } from \"@powerhousedao/shared/document-model\";\nimport { childLogger } from \"document-model\";\nimport { access } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { ViteDevServer } from \"vite\";\nimport { createServer } from \"vite\";\n\ninterface IPackageLoader {\n load(): Promise<DocumentModelModule[]>;\n onDocumentModelsChange(\n callback: (models: DocumentModelModule[]) => void,\n ): Promise<() => void>;\n}\n\nfunction debounce<T extends (...args: any[]) => void>(\n func: T,\n delay = 100,\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout>;\n return (...args: Parameters<T>): void => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => func(...args), delay);\n };\n}\n\nfunction isSubpath(parent: string, dir: string) {\n const relative = path.relative(parent, dir);\n return relative && !relative.startsWith(\"..\") && !path.isAbsolute(relative);\n}\n\nexport class VitePackageLoader implements IPackageLoader {\n private readonly logger = childLogger([\"reactor-mcp\", \"vite-loader\"]);\n\n private readonly root: string;\n private readonly documentModelsDir: string;\n\n private vite: ViteDevServer | undefined;\n\n readonly name = \"VitePackageLoader\";\n\n constructor(root: string, documentModelsDir: string) {\n this.root = root;\n this.documentModelsDir = documentModelsDir;\n }\n\n private get fullPath(): string {\n return path.join(this.root, this.documentModelsDir);\n }\n\n private async initVite() {\n if (this.vite) {\n return this.vite;\n }\n\n this.vite = await createServer({\n root: this.root,\n logLevel: \"info\",\n server: {\n hmr: false,\n middlewareMode: true,\n warmup: {\n ssrFiles: [this.fullPath],\n },\n fs: {\n allow: [this.fullPath],\n },\n },\n optimizeDeps: {\n // It's recommended to disable deps optimization\n noDiscovery: true,\n include: [],\n },\n });\n\n return this.vite;\n }\n\n async load(): Promise<DocumentModelModule[]> {\n const vite = await this.initVite();\n\n await access(this.fullPath);\n this.logger.verbose(\"Loading document models from @path\", this.fullPath);\n\n try {\n const localDMs = (await vite.ssrLoadModule(this.fullPath)) as Record<\n string,\n DocumentModelModule\n >;\n\n const exports = Object.values(localDMs);\n\n // duck type\n const documentModels: DocumentModelModule[] = [];\n for (const dm of exports) {\n if (dm.documentModel) {\n documentModels.push(dm);\n }\n }\n\n this.logger.verbose(\n ` ➜ Loaded ${documentModels.length} Document Models from: ${this.fullPath}`,\n );\n\n return documentModels;\n } catch (e) {\n this.logger.verbose(\n ` ➜ No Document Models found for: ${this.fullPath}${e ? `\\n${JSON.stringify(e)}` : \"\"}`,\n );\n }\n\n return [];\n }\n\n async onDocumentModelsChange(\n callback: (models: DocumentModelModule[]) => void,\n ) {\n const vite = await this.initVite();\n const listener = debounce(async (changedPath: string) => {\n if (isSubpath(this.fullPath, changedPath)) {\n const documentModels = await this.load();\n callback(documentModels);\n }\n }, 100);\n vite.watcher.on(\"change\", listener);\n\n return () => {\n vite.watcher.off(\"change\", listener);\n };\n }\n}\n","import { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { ReactorBuilder, ReactorClientBuilder } from \"@powerhousedao/reactor\";\nimport { reactorDriveDocumentModelModule } from \"@powerhousedao/reactor-drive\";\nimport { ReactorGroupV1 } from \"@powerhousedao/reactor-group\";\nimport { driveDocumentModelModule } from \"@powerhousedao/shared/document-drive\";\nimport type { DocumentModelModule } from \"@powerhousedao/shared/document-model\";\nimport { documentModelDocumentModelModule } from \"document-model\";\nimport { initFeatureFlags } from \"../feature-flags.js\";\nimport { logger } from \"../logger.js\";\nimport { createServer } from \"../server.js\";\nimport { VitePackageLoader } from \"./loader.js\";\n\nexport interface IMcpOptions {\n remoteDrive?: string;\n root?: string;\n documentModelsDir?: string;\n}\n\nconst baseDocumentModels: DocumentModelModule<any>[] = [\n documentModelDocumentModelModule,\n driveDocumentModelModule,\n reactorDriveDocumentModelModule,\n ReactorGroupV1 as unknown as DocumentModelModule<any>,\n];\n\nasync function createReactorClient(documentModels: DocumentModelModule[]) {\n const reactorBuilder = new ReactorBuilder().withDocumentModelSources(\n baseDocumentModels.concat(documentModels),\n );\n\n const module = await new ReactorClientBuilder()\n .withReactorBuilder(reactorBuilder)\n .buildModule();\n\n return module;\n}\n\nexport async function initStdioMcpServer(options?: IMcpOptions) {\n const {\n remoteDrive,\n root,\n documentModelsDir = \"./document-models\",\n } = options ?? {};\n\n // initialize feature flags\n await initFeatureFlags();\n\n // if root of project is passed then loads local document models\n let documentModelsLoader: VitePackageLoader | undefined;\n const documentModels: DocumentModelModule[] = [];\n\n if (root) {\n documentModelsLoader = new VitePackageLoader(root, documentModelsDir);\n try {\n const loadedModels = await documentModelsLoader.load();\n documentModels.push(...loadedModels);\n logger.info(\n \"Loaded document models: @models\",\n loadedModels.map((m) => m.documentModel.global.name).join(\", \"),\n );\n } catch (e) {\n logger.error(\"@error\", e);\n }\n }\n\n // initializes reactor client with loaded document models\n const reactorModule = await createReactorClient(documentModels);\n const { client, reactor, reactorModule: rModule } = reactorModule;\n\n // listens for changes in the local document models to update the reactor\n if (documentModelsLoader && rModule?.documentModelRegistry) {\n const unsubscribe = await documentModelsLoader.onDocumentModelsChange(\n (models) => {\n const results = rModule.documentModelRegistry.registerModules(\n ...baseDocumentModels.concat(models),\n );\n for (const result of results) {\n if (result.status === \"error\") {\n logger.error(\n \"Failed to register document model: @error\",\n result.error,\n );\n }\n }\n },\n );\n\n process.on(\"exit\", () => {\n unsubscribe();\n reactor.kill();\n });\n }\n\n // if a remote drive is passed, log a warning since remote drives\n // are now handled at a different level (SyncManager)\n if (remoteDrive) {\n logger.warn(\n \"Remote drive configuration via MCP is not supported in the new reactor. \" +\n \"Remote drives should be configured at the server level.\",\n );\n }\n\n // starts the server\n // Note: syncManager is not available in stdio mode currently\n const server = await createServer({ client });\n\n // starts Stdio transport\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n","import { logger } from \"./logger.js\";\nimport { initStdioMcpServer } from \"./stdio/index.js\";\n\ninitStdioMcpServer({\n remoteDrive: process.argv.at(2),\n root: process.cwd(),\n}).catch((error: unknown) => {\n logger.error(\"@error\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;AAGA,eAAsB,mBAAmB;CAEvC,MAAM,WAAW,IAAI,gBAAgB;AAErC,OAAM,YAAY,mBAAmB,SAAS;AAE9C,QAAO,YAAY,WAAW;;;;ACKhC,SAAS,SACP,MACA,QAAQ,KAC0B;CAClC,IAAI;AACJ,SAAQ,GAAG,SAA8B;AACvC,eAAa,UAAU;AACvB,cAAY,iBAAiB,KAAK,GAAG,KAAK,EAAE,MAAM;;;AAItD,SAAS,UAAU,QAAgB,KAAa;CAC9C,MAAM,WAAW,KAAK,SAAS,QAAQ,IAAI;AAC3C,QAAO,YAAY,CAAC,SA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AS,MAAMA,eAAa,EAAE,QAAQ,CAAC;CAG7C,MAAM,YAAY,IAAI,sBAAsB;AAC5C,OAAM,OAAO,QAAQ,UAAU;;;;ACzGjC,mBAAmB;CACjB,aAAa,QAAQ,KAAK,GAAG,EAAE;CAC/B,MAAM,QAAQ,KAAK;CACpB,CAAC,CAAC,OAAO,UAAmB;AAC3B,QAAO,MAAM,UAAU,MAAM;AAC7B,SAAQ,KAAK,EAAE;EACf"}
@@ -0,0 +1,605 @@
1
+ import { ToolCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { IReactorClient, ISyncManager } from "@powerhousedao/reactor";
3
+ import { Action, DocumentModelModule } from "@powerhousedao/shared/document-model";
4
+ import { ZodRawShape, z } from "zod";
5
+ import * as _modelcontextprotocol_sdk_types0 from "@modelcontextprotocol/sdk/types";
6
+ import { CallToolResult, Prompt, Resource, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
7
+
8
+ //#region src/tools/types.d.ts
9
+ type ExtractCallbackFromTool<T extends ToolSchema> = T extends {
10
+ inputSchema: infer S;
11
+ } ? ToolCallback<S extends ZodRawShape ? S : undefined> : ToolCallback;
12
+ type ToolWithCallback<T extends ToolSchema = ToolSchema> = T & {
13
+ callback: ExtractCallbackFromTool<T>;
14
+ };
15
+ type ToolSchema<InputArgs extends ZodRawShape = ZodRawShape, OutputArgs extends ZodRawShape = ZodRawShape> = {
16
+ name: string;
17
+ title?: string;
18
+ description?: string;
19
+ inputSchema?: InputArgs;
20
+ outputSchema?: OutputArgs;
21
+ annotations?: ToolAnnotations;
22
+ };
23
+ type ResolveZodSchema<T> = T extends z.ZodRawShape ? z.infer<z.ZodObject<T>> : T;
24
+ interface IMcpProvider<T extends ToolWithCallback = ToolWithCallback, R extends Resource = Resource, P extends Prompt = Prompt> {
25
+ tools: Record<T["name"], ToolWithCallback<T>>;
26
+ resources: Record<R["name"], R>;
27
+ prompts: Record<P["name"], P>;
28
+ }
29
+ //#endregion
30
+ //#region src/tools/reactor.d.ts
31
+ type ReactorMcpProviderOptions = {
32
+ client: IReactorClient;
33
+ syncManager?: ISyncManager;
34
+ };
35
+ declare const createDocumentTool: {
36
+ readonly name: "createDocument";
37
+ readonly description: "Create a new document.\n Unless the user specifies otherwise, and a drive named \"vetra\" is available, add the document to that drive by providing the drive's ID in the \"driveId\" parameter.\n When \"driveId\" is provided, the document is created and added to the drive atomically — no separate \"addActions\" call with \"ADD_FILE\" is needed.";
38
+ readonly inputSchema: {
39
+ readonly documentType: z.ZodString;
40
+ readonly name: z.ZodOptional<z.ZodString>;
41
+ readonly driveId: z.ZodOptional<z.ZodString>;
42
+ readonly parentFolder: z.ZodOptional<z.ZodString>;
43
+ };
44
+ readonly outputSchema: {
45
+ readonly documentId: z.ZodString;
46
+ };
47
+ };
48
+ declare const getDocumentTool: {
49
+ readonly name: "getDocument";
50
+ readonly description: "Retrieve a document by its ID";
51
+ readonly inputSchema: {
52
+ readonly id: z.ZodString;
53
+ };
54
+ readonly outputSchema: {
55
+ readonly document: z.ZodUnknown;
56
+ };
57
+ };
58
+ declare const getDocumentsTool: {
59
+ readonly name: "getDocuments";
60
+ readonly description: "List documents in a drive";
61
+ readonly inputSchema: {
62
+ readonly parentId: z.ZodString;
63
+ };
64
+ readonly outputSchema: {
65
+ readonly documentIds: z.ZodArray<z.ZodString>;
66
+ };
67
+ };
68
+ declare const deleteDocumentTool: {
69
+ readonly name: "deleteDocument";
70
+ readonly description: "Delete a document";
71
+ readonly inputSchema: {
72
+ readonly documentId: z.ZodString;
73
+ };
74
+ readonly outputSchema: {
75
+ readonly success: z.ZodBoolean;
76
+ };
77
+ };
78
+ declare const addActionsTool: {
79
+ readonly name: "addActions";
80
+ readonly description: "Adds actions to a document. Prefer adding multiples actions at once to reduce the number of steps.";
81
+ readonly inputSchema: {
82
+ readonly documentId: z.ZodString;
83
+ readonly actions: z.ZodArray<z.ZodObject<{
84
+ type: z.ZodString;
85
+ input: z.ZodUnknown;
86
+ scope: z.ZodString;
87
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
88
+ }, z.core.$strict>>;
89
+ };
90
+ readonly outputSchema: {
91
+ readonly success: z.ZodBoolean;
92
+ };
93
+ };
94
+ declare const getDrivesTool: {
95
+ readonly name: "getDrives";
96
+ readonly description: "List all drives";
97
+ readonly inputSchema: {};
98
+ readonly outputSchema: {
99
+ readonly driveIds: z.ZodArray<z.ZodString>;
100
+ };
101
+ };
102
+ declare const addDriveTool: {
103
+ readonly name: "addDrive";
104
+ readonly description: "Create a new drive";
105
+ readonly inputSchema: {
106
+ readonly driveInput: z.ZodObject<{
107
+ global: z.ZodObject<{
108
+ name: z.ZodString;
109
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
110
+ }, z.core.$strip>;
111
+ preferredEditor: z.ZodOptional<z.ZodString>;
112
+ local: z.ZodOptional<z.ZodObject<{
113
+ availableOffline: z.ZodOptional<z.ZodBoolean>;
114
+ sharingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
115
+ }, z.core.$strip>>;
116
+ }, z.core.$strip>;
117
+ };
118
+ readonly outputSchema: {
119
+ readonly driveId: z.ZodString;
120
+ };
121
+ };
122
+ declare const getDriveTool: {
123
+ readonly name: "getDrive";
124
+ readonly description: "Get a specific drive";
125
+ readonly inputSchema: {
126
+ readonly driveId: z.ZodString;
127
+ readonly options: z.ZodOptional<z.ZodObject<{
128
+ revisions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
129
+ checkHashes: z.ZodOptional<z.ZodBoolean>;
130
+ }, z.core.$strip>>;
131
+ };
132
+ readonly outputSchema: {
133
+ readonly drive: z.ZodUnknown;
134
+ };
135
+ };
136
+ declare const deleteDriveTool: {
137
+ readonly name: "deleteDrive";
138
+ readonly description: "Delete a drive";
139
+ readonly inputSchema: {
140
+ readonly driveId: z.ZodString;
141
+ };
142
+ readonly outputSchema: {
143
+ readonly success: z.ZodBoolean;
144
+ };
145
+ };
146
+ declare const addRemoteDriveTool: {
147
+ readonly name: "addRemoteDrive";
148
+ readonly description: "Connect to a remote drive";
149
+ readonly inputSchema: {
150
+ readonly url: z.ZodString;
151
+ readonly options: z.ZodObject<{
152
+ availableOffline: z.ZodBoolean;
153
+ sharingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
154
+ pullFilter: z.ZodOptional<z.ZodObject<{
155
+ branch: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
156
+ documentId: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
157
+ documentType: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
158
+ scope: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
159
+ }, z.core.$strip>>;
160
+ pullInterval: z.ZodOptional<z.ZodNumber>;
161
+ }, z.core.$strip>;
162
+ };
163
+ readonly outputSchema: {
164
+ readonly driveId: z.ZodString;
165
+ };
166
+ };
167
+ declare const getDocumentModelSchemaTool: {
168
+ readonly name: "getDocumentModelSchema";
169
+ readonly description: "Get the schema of a document model";
170
+ readonly inputSchema: {
171
+ readonly type: z.ZodString;
172
+ };
173
+ readonly outputSchema: {
174
+ readonly schema: z.ZodUnknown;
175
+ };
176
+ };
177
+ declare const getDocumentModelsTool: {
178
+ readonly name: "getDocumentModels";
179
+ readonly description: "Get the list of document models";
180
+ readonly inputSchema: {};
181
+ readonly outputSchema: {
182
+ readonly documentModels: z.ZodArray<z.ZodObject<{
183
+ name: z.ZodString;
184
+ type: z.ZodString;
185
+ description: z.ZodString;
186
+ extension: z.ZodString;
187
+ authorName: z.ZodString;
188
+ authorWebsite: z.ZodString;
189
+ }, z.core.$strip>>;
190
+ };
191
+ };
192
+ type ToolRecord<T extends readonly ToolSchema[]> = { [K in T[number]["name"]]: ToolWithCallback<Extract<T[number], {
193
+ name: K;
194
+ }>> };
195
+ declare const _allTools: readonly [{
196
+ readonly name: "getDocument";
197
+ readonly description: "Retrieve a document by its ID";
198
+ readonly inputSchema: {
199
+ readonly id: z.ZodString;
200
+ };
201
+ readonly outputSchema: {
202
+ readonly document: z.ZodUnknown;
203
+ };
204
+ }, {
205
+ readonly name: "createDocument";
206
+ readonly description: "Create a new document.\n Unless the user specifies otherwise, and a drive named \"vetra\" is available, add the document to that drive by providing the drive's ID in the \"driveId\" parameter.\n When \"driveId\" is provided, the document is created and added to the drive atomically — no separate \"addActions\" call with \"ADD_FILE\" is needed.";
207
+ readonly inputSchema: {
208
+ readonly documentType: z.ZodString;
209
+ readonly name: z.ZodOptional<z.ZodString>;
210
+ readonly driveId: z.ZodOptional<z.ZodString>;
211
+ readonly parentFolder: z.ZodOptional<z.ZodString>;
212
+ };
213
+ readonly outputSchema: {
214
+ readonly documentId: z.ZodString;
215
+ };
216
+ }, {
217
+ readonly name: "getDocuments";
218
+ readonly description: "List documents in a drive";
219
+ readonly inputSchema: {
220
+ readonly parentId: z.ZodString;
221
+ };
222
+ readonly outputSchema: {
223
+ readonly documentIds: z.ZodArray<z.ZodString>;
224
+ };
225
+ }, {
226
+ readonly name: "deleteDocument";
227
+ readonly description: "Delete a document";
228
+ readonly inputSchema: {
229
+ readonly documentId: z.ZodString;
230
+ };
231
+ readonly outputSchema: {
232
+ readonly success: z.ZodBoolean;
233
+ };
234
+ }, {
235
+ readonly name: "addActions";
236
+ readonly description: "Adds actions to a document. Prefer adding multiples actions at once to reduce the number of steps.";
237
+ readonly inputSchema: {
238
+ readonly documentId: z.ZodString;
239
+ readonly actions: z.ZodArray<z.ZodObject<{
240
+ type: z.ZodString;
241
+ input: z.ZodUnknown;
242
+ scope: z.ZodString;
243
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
244
+ }, z.core.$strict>>;
245
+ };
246
+ readonly outputSchema: {
247
+ readonly success: z.ZodBoolean;
248
+ };
249
+ }, {
250
+ readonly name: "getDrives";
251
+ readonly description: "List all drives";
252
+ readonly inputSchema: {};
253
+ readonly outputSchema: {
254
+ readonly driveIds: z.ZodArray<z.ZodString>;
255
+ };
256
+ }, {
257
+ readonly name: "addDrive";
258
+ readonly description: "Create a new drive";
259
+ readonly inputSchema: {
260
+ readonly driveInput: z.ZodObject<{
261
+ global: z.ZodObject<{
262
+ name: z.ZodString;
263
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
264
+ }, z.core.$strip>;
265
+ preferredEditor: z.ZodOptional<z.ZodString>;
266
+ local: z.ZodOptional<z.ZodObject<{
267
+ availableOffline: z.ZodOptional<z.ZodBoolean>;
268
+ sharingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
+ }, z.core.$strip>>;
270
+ }, z.core.$strip>;
271
+ };
272
+ readonly outputSchema: {
273
+ readonly driveId: z.ZodString;
274
+ };
275
+ }, {
276
+ readonly name: "getDrive";
277
+ readonly description: "Get a specific drive";
278
+ readonly inputSchema: {
279
+ readonly driveId: z.ZodString;
280
+ readonly options: z.ZodOptional<z.ZodObject<{
281
+ revisions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
282
+ checkHashes: z.ZodOptional<z.ZodBoolean>;
283
+ }, z.core.$strip>>;
284
+ };
285
+ readonly outputSchema: {
286
+ readonly drive: z.ZodUnknown;
287
+ };
288
+ }, {
289
+ readonly name: "deleteDrive";
290
+ readonly description: "Delete a drive";
291
+ readonly inputSchema: {
292
+ readonly driveId: z.ZodString;
293
+ };
294
+ readonly outputSchema: {
295
+ readonly success: z.ZodBoolean;
296
+ };
297
+ }, {
298
+ readonly name: "addRemoteDrive";
299
+ readonly description: "Connect to a remote drive";
300
+ readonly inputSchema: {
301
+ readonly url: z.ZodString;
302
+ readonly options: z.ZodObject<{
303
+ availableOffline: z.ZodBoolean;
304
+ sharingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
305
+ pullFilter: z.ZodOptional<z.ZodObject<{
306
+ branch: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
307
+ documentId: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
308
+ documentType: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
309
+ scope: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
310
+ }, z.core.$strip>>;
311
+ pullInterval: z.ZodOptional<z.ZodNumber>;
312
+ }, z.core.$strip>;
313
+ };
314
+ readonly outputSchema: {
315
+ readonly driveId: z.ZodString;
316
+ };
317
+ }, {
318
+ readonly name: "getDocumentModelSchema";
319
+ readonly description: "Get the schema of a document model";
320
+ readonly inputSchema: {
321
+ readonly type: z.ZodString;
322
+ };
323
+ readonly outputSchema: {
324
+ readonly schema: z.ZodUnknown;
325
+ };
326
+ }, {
327
+ readonly name: "getDocumentModels";
328
+ readonly description: "Get the list of document models";
329
+ readonly inputSchema: {};
330
+ readonly outputSchema: {
331
+ readonly documentModels: z.ZodArray<z.ZodObject<{
332
+ name: z.ZodString;
333
+ type: z.ZodString;
334
+ description: z.ZodString;
335
+ extension: z.ZodString;
336
+ authorName: z.ZodString;
337
+ authorWebsite: z.ZodString;
338
+ }, z.core.$strip>>;
339
+ };
340
+ }];
341
+ type ReactorMcpTools = ToolRecord<typeof _allTools>;
342
+ declare function createReactorMcpProvider(options: ReactorMcpProviderOptions): Promise<{
343
+ readonly tools: {
344
+ readonly getDocument: {
345
+ readonly name: "getDocument";
346
+ readonly description: "Retrieve a document by its ID";
347
+ readonly inputSchema: {
348
+ readonly id: z.ZodString;
349
+ };
350
+ readonly outputSchema: {
351
+ readonly document: z.ZodUnknown;
352
+ };
353
+ } & {
354
+ callback: (args: {
355
+ id: string;
356
+ }) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
357
+ };
358
+ readonly createDocument: {
359
+ readonly name: "createDocument";
360
+ readonly description: "Create a new document.\n Unless the user specifies otherwise, and a drive named \"vetra\" is available, add the document to that drive by providing the drive's ID in the \"driveId\" parameter.\n When \"driveId\" is provided, the document is created and added to the drive atomically — no separate \"addActions\" call with \"ADD_FILE\" is needed.";
361
+ readonly inputSchema: {
362
+ readonly documentType: z.ZodString;
363
+ readonly name: z.ZodOptional<z.ZodString>;
364
+ readonly driveId: z.ZodOptional<z.ZodString>;
365
+ readonly parentFolder: z.ZodOptional<z.ZodString>;
366
+ };
367
+ readonly outputSchema: {
368
+ readonly documentId: z.ZodString;
369
+ };
370
+ } & {
371
+ callback: (args: {
372
+ documentType: string;
373
+ name?: string | undefined;
374
+ driveId?: string | undefined;
375
+ parentFolder?: string | undefined;
376
+ }) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
377
+ };
378
+ readonly getDocuments: {
379
+ readonly name: "getDocuments";
380
+ readonly description: "List documents in a drive";
381
+ readonly inputSchema: {
382
+ readonly parentId: z.ZodString;
383
+ };
384
+ readonly outputSchema: {
385
+ readonly documentIds: z.ZodArray<z.ZodString>;
386
+ };
387
+ } & {
388
+ callback: (args: {
389
+ parentId: string;
390
+ }) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
391
+ };
392
+ readonly deleteDocument: {
393
+ readonly name: "deleteDocument";
394
+ readonly description: "Delete a document";
395
+ readonly inputSchema: {
396
+ readonly documentId: z.ZodString;
397
+ };
398
+ readonly outputSchema: {
399
+ readonly success: z.ZodBoolean;
400
+ };
401
+ } & {
402
+ callback: (args: {
403
+ documentId: string;
404
+ }) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
405
+ };
406
+ readonly addActions: {
407
+ readonly name: "addActions";
408
+ readonly description: "Adds actions to a document. Prefer adding multiples actions at once to reduce the number of steps.";
409
+ readonly inputSchema: {
410
+ readonly documentId: z.ZodString;
411
+ readonly actions: z.ZodArray<z.ZodObject<{
412
+ type: z.ZodString;
413
+ input: z.ZodUnknown;
414
+ scope: z.ZodString;
415
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
416
+ }, z.core.$strict>>;
417
+ };
418
+ readonly outputSchema: {
419
+ readonly success: z.ZodBoolean;
420
+ };
421
+ } & {
422
+ callback: (args: {
423
+ documentId: string;
424
+ actions: {
425
+ type: string;
426
+ input: unknown;
427
+ scope: string;
428
+ context?: Record<string, unknown> | undefined;
429
+ }[];
430
+ }) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
431
+ };
432
+ readonly getDrives: {
433
+ readonly name: "getDrives";
434
+ readonly description: "List all drives";
435
+ readonly inputSchema: {};
436
+ readonly outputSchema: {
437
+ readonly driveIds: z.ZodArray<z.ZodString>;
438
+ };
439
+ } & {
440
+ callback: (args: Record<string, never>) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
441
+ };
442
+ readonly addDrive: {
443
+ readonly name: "addDrive";
444
+ readonly description: "Create a new drive";
445
+ readonly inputSchema: {
446
+ readonly driveInput: z.ZodObject<{
447
+ global: z.ZodObject<{
448
+ name: z.ZodString;
449
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
450
+ }, z.core.$strip>;
451
+ preferredEditor: z.ZodOptional<z.ZodString>;
452
+ local: z.ZodOptional<z.ZodObject<{
453
+ availableOffline: z.ZodOptional<z.ZodBoolean>;
454
+ sharingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
455
+ }, z.core.$strip>>;
456
+ }, z.core.$strip>;
457
+ };
458
+ readonly outputSchema: {
459
+ readonly driveId: z.ZodString;
460
+ };
461
+ } & {
462
+ callback: (args: {
463
+ driveInput: {
464
+ global: {
465
+ name: string;
466
+ icon?: string | null | undefined;
467
+ };
468
+ preferredEditor?: string | undefined;
469
+ local?: {
470
+ availableOffline?: boolean | undefined;
471
+ sharingType?: string | null | undefined;
472
+ } | undefined;
473
+ };
474
+ }) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
475
+ };
476
+ readonly getDrive: {
477
+ readonly name: "getDrive";
478
+ readonly description: "Get a specific drive";
479
+ readonly inputSchema: {
480
+ readonly driveId: z.ZodString;
481
+ readonly options: z.ZodOptional<z.ZodObject<{
482
+ revisions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
483
+ checkHashes: z.ZodOptional<z.ZodBoolean>;
484
+ }, z.core.$strip>>;
485
+ };
486
+ readonly outputSchema: {
487
+ readonly drive: z.ZodUnknown;
488
+ };
489
+ } & {
490
+ callback: (args: {
491
+ driveId: string;
492
+ options?: {
493
+ revisions?: Record<string, number> | undefined;
494
+ checkHashes?: boolean | undefined;
495
+ } | undefined;
496
+ }) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
497
+ };
498
+ readonly deleteDrive: {
499
+ readonly name: "deleteDrive";
500
+ readonly description: "Delete a drive";
501
+ readonly inputSchema: {
502
+ readonly driveId: z.ZodString;
503
+ };
504
+ readonly outputSchema: {
505
+ readonly success: z.ZodBoolean;
506
+ };
507
+ } & {
508
+ callback: (args: {
509
+ driveId: string;
510
+ }) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
511
+ };
512
+ readonly addRemoteDrive: {
513
+ readonly name: "addRemoteDrive";
514
+ readonly description: "Connect to a remote drive";
515
+ readonly inputSchema: {
516
+ readonly url: z.ZodString;
517
+ readonly options: z.ZodObject<{
518
+ availableOffline: z.ZodBoolean;
519
+ sharingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
520
+ pullFilter: z.ZodOptional<z.ZodObject<{
521
+ branch: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
522
+ documentId: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
523
+ documentType: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
524
+ scope: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
525
+ }, z.core.$strip>>;
526
+ pullInterval: z.ZodOptional<z.ZodNumber>;
527
+ }, z.core.$strip>;
528
+ };
529
+ readonly outputSchema: {
530
+ readonly driveId: z.ZodString;
531
+ };
532
+ } & {
533
+ callback: (args: {
534
+ url: string;
535
+ options: {
536
+ availableOffline: boolean;
537
+ sharingType?: string | null | undefined;
538
+ pullFilter?: {
539
+ branch?: string[] | null | undefined;
540
+ documentId?: string[] | null | undefined;
541
+ documentType?: string[] | null | undefined;
542
+ scope?: string[] | null | undefined;
543
+ } | undefined;
544
+ pullInterval?: number | undefined;
545
+ };
546
+ }) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
547
+ };
548
+ readonly getDocumentModels: {
549
+ readonly name: "getDocumentModels";
550
+ readonly description: "Get the list of document models";
551
+ readonly inputSchema: {};
552
+ readonly outputSchema: {
553
+ readonly documentModels: z.ZodArray<z.ZodObject<{
554
+ name: z.ZodString;
555
+ type: z.ZodString;
556
+ description: z.ZodString;
557
+ extension: z.ZodString;
558
+ authorName: z.ZodString;
559
+ authorWebsite: z.ZodString;
560
+ }, z.core.$strip>>;
561
+ };
562
+ } & {
563
+ callback: (args: Record<string, never>) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
564
+ };
565
+ readonly getDocumentModelSchema: {
566
+ readonly name: "getDocumentModelSchema";
567
+ readonly description: "Get the schema of a document model";
568
+ readonly inputSchema: {
569
+ readonly type: z.ZodString;
570
+ };
571
+ readonly outputSchema: {
572
+ readonly schema: z.ZodUnknown;
573
+ };
574
+ } & {
575
+ callback: (args: {
576
+ type: string;
577
+ }) => Promise<_modelcontextprotocol_sdk_types0.CallToolResult>;
578
+ };
579
+ };
580
+ readonly resources: {};
581
+ readonly prompts: {};
582
+ }>;
583
+ //#endregion
584
+ //#region src/tools/utils.d.ts
585
+ declare class InvalidToolOutputError extends Error {
586
+ constructor(zodError: z.ZodError);
587
+ }
588
+ /**
589
+ * Creates a tool with a callback function that handles the tool execution,
590
+ * ensuring the output is valid and errors are handled and returned correctly.
591
+ * @param tool The tool schema to wrap.
592
+ * @param toolCallback The callback function to execute when the tool is called.
593
+ * @returns A CallToolResult with structuredContent if OutputSchema is defined or content if undefined. If the
594
+ * callback throws an error, the result will have isError set to true and the error message in the content.
595
+ */
596
+ declare function toolWithCallback<T extends ToolSchema>(tool: T, toolCallback: (args: ResolveZodSchema<T["inputSchema"]>) => ResolveZodSchema<T["outputSchema"]> | Promise<ResolveZodSchema<T["outputSchema"]>>): T & {
597
+ callback: (args: ResolveZodSchema<T["inputSchema"]>) => Promise<CallToolResult>;
598
+ };
599
+ declare function validateDocumentModelAction(documentModelModule: DocumentModelModule, action: Action): {
600
+ isValid: boolean;
601
+ errors: string[];
602
+ };
603
+ //#endregion
604
+ export { ToolWithCallback as C, ToolSchema as S, getDriveTool as _, ReactorMcpTools as a, IMcpProvider as b, addRemoteDriveTool as c, deleteDocumentTool as d, deleteDriveTool as f, getDocumentsTool as g, getDocumentTool as h, ReactorMcpProviderOptions as i, createDocumentTool as l, getDocumentModelsTool as m, toolWithCallback as n, addActionsTool as o, getDocumentModelSchemaTool as p, validateDocumentModelAction as r, addDriveTool as s, InvalidToolOutputError as t, createReactorMcpProvider as u, getDrivesTool as v, ResolveZodSchema as x, ExtractCallbackFromTool as y };
605
+ //# sourceMappingURL=index-DXl2_PJH.d.mts.map