@loom-node/tools 0.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.
- package/LICENSE +21 -0
- package/dist/__tests__/tool-registry.test.d.ts +2 -0
- package/dist/__tests__/tool-registry.test.d.ts.map +1 -0
- package/dist/__tests__/tool-registry.test.js +36 -0
- package/dist/__tests__/tool-registry.test.js.map +1 -0
- package/dist/define-tool.d.ts +9 -0
- package/dist/define-tool.d.ts.map +1 -0
- package/dist/define-tool.js +9 -0
- package/dist/define-tool.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-client.d.ts +28 -0
- package/dist/mcp-client.d.ts.map +1 -0
- package/dist/mcp-client.js +106 -0
- package/dist/mcp-client.js.map +1 -0
- package/dist/system/index.d.ts +5 -0
- package/dist/system/index.d.ts.map +1 -0
- package/dist/system/index.js +5 -0
- package/dist/system/index.js.map +1 -0
- package/dist/system/list-dir.d.ts +17 -0
- package/dist/system/list-dir.d.ts.map +1 -0
- package/dist/system/list-dir.js +34 -0
- package/dist/system/list-dir.js.map +1 -0
- package/dist/system/read-file.d.ts +9 -0
- package/dist/system/read-file.d.ts.map +1 -0
- package/dist/system/read-file.js +16 -0
- package/dist/system/read-file.js.map +1 -0
- package/dist/system/schema-helper.d.ts +4 -0
- package/dist/system/schema-helper.d.ts.map +1 -0
- package/dist/system/schema-helper.js +8 -0
- package/dist/system/schema-helper.js.map +1 -0
- package/dist/system/shell.d.ts +8 -0
- package/dist/system/shell.d.ts.map +1 -0
- package/dist/system/shell.js +31 -0
- package/dist/system/shell.js.map +1 -0
- package/dist/system/write-file.d.ts +11 -0
- package/dist/system/write-file.d.ts.map +1 -0
- package/dist/system/write-file.js +21 -0
- package/dist/system/write-file.js.map +1 -0
- package/dist/tool-registry.d.ts +9 -0
- package/dist/tool-registry.d.ts.map +1 -0
- package/dist/tool-registry.js +23 -0
- package/dist/tool-registry.js.map +1 -0
- package/dist/zod-adapter.d.ts +4 -0
- package/dist/zod-adapter.d.ts.map +1 -0
- package/dist/zod-adapter.js +51 -0
- package/dist/zod-adapter.js.map +1 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Loom Node Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/tool-registry.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { ToolRegistry } from '../tool-registry.js';
|
|
3
|
+
function fakeTool(name) {
|
|
4
|
+
return {
|
|
5
|
+
name,
|
|
6
|
+
description: `desc-${name}`,
|
|
7
|
+
parameters: { parse: (i) => i, toJsonSchema: () => ({ type: 'object', properties: {} }) },
|
|
8
|
+
execute: async () => 'ok',
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
describe('ToolRegistry', () => {
|
|
12
|
+
it('registers and retrieves tools', () => {
|
|
13
|
+
const reg = new ToolRegistry();
|
|
14
|
+
reg.register(fakeTool('a'));
|
|
15
|
+
expect(reg.get('a')?.name).toBe('a');
|
|
16
|
+
});
|
|
17
|
+
it('throws on duplicate registration', () => {
|
|
18
|
+
const reg = new ToolRegistry();
|
|
19
|
+
reg.register(fakeTool('a'));
|
|
20
|
+
expect(() => reg.register(fakeTool('a'))).toThrow('already registered');
|
|
21
|
+
});
|
|
22
|
+
it('returns all tools', () => {
|
|
23
|
+
const reg = new ToolRegistry();
|
|
24
|
+
reg.register(fakeTool('a'));
|
|
25
|
+
reg.register(fakeTool('b'));
|
|
26
|
+
expect(reg.all()).toHaveLength(2);
|
|
27
|
+
});
|
|
28
|
+
it('converts to JSON definitions', () => {
|
|
29
|
+
const reg = new ToolRegistry();
|
|
30
|
+
reg.register(fakeTool('x'));
|
|
31
|
+
const json = reg.toJsonDefinitions();
|
|
32
|
+
expect(json[0].name).toBe('x');
|
|
33
|
+
expect(json[0].parameters).toEqual({ type: 'object', properties: {} });
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=tool-registry.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.test.js","sourceRoot":"","sources":["../../src/__tests__/tool-registry.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,M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QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,MAAM,IAAI,GAAG,GAAG,CAAC,iBAAiB,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolDefinition, ToolSchema, ToolContext } from '@loom-node/core';
|
|
2
|
+
export interface DefineToolOptions<TInput, TOutput> {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
parameters: ToolSchema<TInput>;
|
|
6
|
+
execute: (input: TInput, ctx: ToolContext) => Promise<TOutput>;
|
|
7
|
+
}
|
|
8
|
+
export declare function defineTool<TInput, TOutput>(opts: DefineToolOptions<TInput, TOutput>): ToolDefinition<TInput, TOutput>;
|
|
9
|
+
//# sourceMappingURL=define-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-tool.d.ts","sourceRoot":"","sources":["../src/define-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE/E,MAAM,WAAW,iBAAiB,CAAC,MAAM,EAAE,OAAO;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAChE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,EACxC,IAAI,EAAE,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAOjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-tool.js","sourceRoot":"","sources":["../src/define-tool.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,UAAU,CACxB,IAAwC;IAExC,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { defineTool } from './define-tool.js';
|
|
2
|
+
export type { DefineToolOptions } from './define-tool.js';
|
|
3
|
+
export { ToolRegistry } from './tool-registry.js';
|
|
4
|
+
export { zodSchema } from './zod-adapter.js';
|
|
5
|
+
export { McpClient, mcpToolsToDefinitions } from './mcp-client.js';
|
|
6
|
+
export type { McpServerConfig, McpToolInfo } from './mcp-client.js';
|
|
7
|
+
export { shellTool, readFileTool, writeFileTool, listDirTool } from './system/index.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACnE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { defineTool } from './define-tool.js';
|
|
2
|
+
export { ToolRegistry } from './tool-registry.js';
|
|
3
|
+
export { zodSchema } from './zod-adapter.js';
|
|
4
|
+
export { McpClient, mcpToolsToDefinitions } from './mcp-client.js';
|
|
5
|
+
// System tools
|
|
6
|
+
export { shellTool, readFileTool, writeFileTool, listDirTool } from './system/index.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGnE,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ToolDefinition, JsonSchema } from '@loom-node/core';
|
|
2
|
+
export interface McpServerConfig {
|
|
3
|
+
command: string;
|
|
4
|
+
args?: string[];
|
|
5
|
+
env?: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
export declare class McpClient {
|
|
8
|
+
private config;
|
|
9
|
+
private proc;
|
|
10
|
+
private pending;
|
|
11
|
+
private buffer;
|
|
12
|
+
private ready;
|
|
13
|
+
private emitter;
|
|
14
|
+
constructor(config: McpServerConfig);
|
|
15
|
+
connect(): Promise<void>;
|
|
16
|
+
listTools(): Promise<McpToolInfo[]>;
|
|
17
|
+
callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
18
|
+
disconnect(): Promise<void>;
|
|
19
|
+
private rpc;
|
|
20
|
+
private processBuffer;
|
|
21
|
+
}
|
|
22
|
+
export interface McpToolInfo {
|
|
23
|
+
name: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
inputSchema?: JsonSchema;
|
|
26
|
+
}
|
|
27
|
+
export declare function mcpToolsToDefinitions(client: McpClient, tools: McpToolInfo[]): ToolDefinition[];
|
|
28
|
+
//# sourceMappingURL=mcp-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../src/mcp-client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAA2B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE3F,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,qBAAa,SAAS;IAOR,OAAO,CAAC,MAAM;IAN1B,OAAO,CAAC,IAAI,CAAyC;IACrD,OAAO,CAAC,OAAO,CAAoF;IACnG,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,OAAO,CAAsB;gBAEjB,MAAM,EAAE,eAAe;IAErC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBxB,SAAS,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAKnC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAMvE,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAOnB,GAAG;IAmBjB,OAAO,CAAC,aAAa;CAgBtB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,UAAU,CAAC;CAC1B;AAcD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,cAAc,EAAE,CAO/F"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { EventEmitter } from 'node:events';
|
|
4
|
+
export class McpClient {
|
|
5
|
+
config;
|
|
6
|
+
proc = null;
|
|
7
|
+
pending = new Map();
|
|
8
|
+
buffer = '';
|
|
9
|
+
ready = false;
|
|
10
|
+
emitter = new EventEmitter();
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.config = config;
|
|
13
|
+
}
|
|
14
|
+
async connect() {
|
|
15
|
+
this.proc = spawn(this.config.command, this.config.args ?? [], {
|
|
16
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
17
|
+
env: { ...process.env, ...this.config.env },
|
|
18
|
+
});
|
|
19
|
+
this.proc.stdout.on('data', (chunk) => {
|
|
20
|
+
this.buffer += chunk.toString();
|
|
21
|
+
this.processBuffer();
|
|
22
|
+
});
|
|
23
|
+
this.proc.on('error', (err) => {
|
|
24
|
+
for (const p of this.pending.values())
|
|
25
|
+
p.reject(err);
|
|
26
|
+
this.pending.clear();
|
|
27
|
+
});
|
|
28
|
+
await this.rpc('initialize', {
|
|
29
|
+
protocolVersion: '2024-11-05',
|
|
30
|
+
capabilities: {},
|
|
31
|
+
clientInfo: { name: 'loom-node', version: '0.1.0' },
|
|
32
|
+
});
|
|
33
|
+
await this.rpc('notifications/initialized', undefined);
|
|
34
|
+
this.ready = true;
|
|
35
|
+
}
|
|
36
|
+
async listTools() {
|
|
37
|
+
const res = await this.rpc('tools/list', {});
|
|
38
|
+
return res.tools;
|
|
39
|
+
}
|
|
40
|
+
async callTool(name, args) {
|
|
41
|
+
const res = await this.rpc('tools/call', { name, arguments: args });
|
|
42
|
+
if (res.isError)
|
|
43
|
+
throw new Error(res.content?.[0]?.text ?? 'MCP tool error');
|
|
44
|
+
return res.content?.map((c) => c.text ?? '').join('') ?? '';
|
|
45
|
+
}
|
|
46
|
+
async disconnect() {
|
|
47
|
+
if (!this.proc)
|
|
48
|
+
return;
|
|
49
|
+
this.proc.kill();
|
|
50
|
+
this.proc = null;
|
|
51
|
+
this.ready = false;
|
|
52
|
+
}
|
|
53
|
+
async rpc(method, params) {
|
|
54
|
+
if (!this.proc)
|
|
55
|
+
throw new Error('MCP client not connected');
|
|
56
|
+
const id = randomUUID();
|
|
57
|
+
const msg = JSON.stringify({ jsonrpc: '2.0', id, method, params }) + '\n';
|
|
58
|
+
this.proc.stdin.write(msg);
|
|
59
|
+
if (method.startsWith('notifications/'))
|
|
60
|
+
return;
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
this.pending.set(id, { resolve, reject });
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
if (this.pending.has(id)) {
|
|
65
|
+
this.pending.delete(id);
|
|
66
|
+
reject(new Error(`MCP RPC timeout: ${method}`));
|
|
67
|
+
}
|
|
68
|
+
}, 30_000);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
processBuffer() {
|
|
72
|
+
const lines = this.buffer.split('\n');
|
|
73
|
+
this.buffer = lines.pop();
|
|
74
|
+
for (const line of lines) {
|
|
75
|
+
if (!line.trim())
|
|
76
|
+
continue;
|
|
77
|
+
try {
|
|
78
|
+
const msg = JSON.parse(line);
|
|
79
|
+
if (msg.id && this.pending.has(msg.id)) {
|
|
80
|
+
const p = this.pending.get(msg.id);
|
|
81
|
+
this.pending.delete(msg.id);
|
|
82
|
+
if (msg.error)
|
|
83
|
+
p.reject(new Error(msg.error.message));
|
|
84
|
+
else
|
|
85
|
+
p.resolve(msg.result);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch { /* skip malformed */ }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function mcpSchema(schema) {
|
|
93
|
+
return {
|
|
94
|
+
parse: (input) => input,
|
|
95
|
+
toJsonSchema: () => schema ?? { type: 'object', properties: {} },
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function mcpToolsToDefinitions(client, tools) {
|
|
99
|
+
return tools.map(t => ({
|
|
100
|
+
name: t.name,
|
|
101
|
+
description: t.description ?? '',
|
|
102
|
+
parameters: mcpSchema(t.inputSchema),
|
|
103
|
+
execute: async (input, _ctx) => client.callTool(t.name, input),
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=mcp-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-client.js","sourceRoot":"","sources":["../src/mcp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAQ,YAAY,EAAE,MAAM,aAAa,CAAC;AASjD,MAAM,OAAO,SAAS;IAOA;IANZ,IAAI,GAAoC,IAAI,CAAC;IAC7C,OAAO,GAAG,IAAI,GAAG,EAAyE,CAAC;IAC3F,MAAM,GAAG,EAAE,CAAC;IACZ,KAAK,GAAG,KAAK,CAAC;IACd,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC;IAErC,Y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,OAAO,CAAC,CAAC,CAAC;;wBACjD,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;YAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF;AAaD,SAAS,SAAS,CAAC,MAAmB;IACpC,OAAO;QACL,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAgC;QAC3D,YAAY,EAAE,GAAG,EAAE,CAAC,MAAM,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KACjE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,KAAoB;IAC3E,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,EAAE;QAChC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;QACpC,OAAO,EAAE,KAAK,EAAE,KAAc,EAAE,IAAiB,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,KAAgC,CAAC;KAChH,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ListDirInput {
|
|
2
|
+
path: string;
|
|
3
|
+
recursive?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const listDirTool: import("@loom-node/core").ToolDefinition<ListDirInput, {
|
|
6
|
+
entries: {
|
|
7
|
+
name: string;
|
|
8
|
+
type: "directory" | "file";
|
|
9
|
+
}[];
|
|
10
|
+
} | {
|
|
11
|
+
entries: {
|
|
12
|
+
path: string;
|
|
13
|
+
type: string;
|
|
14
|
+
}[];
|
|
15
|
+
}>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=list-dir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-dir.d.ts","sourceRoot":"","sources":["../../src/system/list-dir.ts"],"names":[],"mappings":"AAKA,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,WAAW;;;;;;;cAmBE,MAAM;cAAQ,MAAM;;EAY5C,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { readdir } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { defineTool } from '../define-tool.js';
|
|
4
|
+
import { objectSchema } from './schema-helper.js';
|
|
5
|
+
export const listDirTool = defineTool({
|
|
6
|
+
name: 'list_directory',
|
|
7
|
+
description: 'List files and directories at a given path',
|
|
8
|
+
parameters: objectSchema({
|
|
9
|
+
path: { type: 'string', description: 'Directory path' },
|
|
10
|
+
recursive: { type: 'boolean', description: 'List recursively (default false)' },
|
|
11
|
+
}, ['path'], (input) => input),
|
|
12
|
+
execute: async (input) => {
|
|
13
|
+
const entries = await readdir(input.path, { withFileTypes: true });
|
|
14
|
+
const items = entries.map(e => ({
|
|
15
|
+
name: e.name,
|
|
16
|
+
type: e.isDirectory() ? 'directory' : 'file',
|
|
17
|
+
}));
|
|
18
|
+
if (!input.recursive)
|
|
19
|
+
return { entries: items };
|
|
20
|
+
const result = [];
|
|
21
|
+
const walk = async (dir) => {
|
|
22
|
+
const ents = await readdir(dir, { withFileTypes: true });
|
|
23
|
+
for (const e of ents) {
|
|
24
|
+
const full = join(dir, e.name);
|
|
25
|
+
result.push({ path: full, type: e.isDirectory() ? 'directory' : 'file' });
|
|
26
|
+
if (e.isDirectory())
|
|
27
|
+
await walk(full);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
await walk(input.path);
|
|
31
|
+
return { entries: result };
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=list-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-dir.js","sourceRoot":"","sources":["../../src/system/list-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOlD,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;IACpC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,4CAA4C;IACzD,UAAU,EAAE,YAAY,CACtB;QACE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE;QACvD,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,kCAAkC,EAAE;KAChF,EACD,CAAC,MAAM,CAAC,EACR,CAAC,K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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../src/system/read-file.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,YAAY;;EAevB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { defineTool } from '../define-tool.js';
|
|
3
|
+
import { objectSchema } from './schema-helper.js';
|
|
4
|
+
export const readFileTool = defineTool({
|
|
5
|
+
name: 'read_file',
|
|
6
|
+
description: 'Read the contents of a file',
|
|
7
|
+
parameters: objectSchema({
|
|
8
|
+
path: { type: 'string', description: 'Absolute or relative file path' },
|
|
9
|
+
encoding: { type: 'string', description: 'File encoding (default utf-8)' },
|
|
10
|
+
}, ['path'], (input) => input),
|
|
11
|
+
execute: async (input) => {
|
|
12
|
+
const content = await readFile(input.path, { encoding: (input.encoding ?? 'utf-8') });
|
|
13
|
+
return { content };
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=read-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../src/system/read-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOlD,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;IACrC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,6BAA6B;IAC1C,UAAU,EAAE,YAAY,CACtB;QACE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gCAAgC,EAAE;QACvE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA+B,EAAE;KAC3E,EACD,CAAC,MAAM,CAAC,EACR,CAAC,KAAK,EAAE,EAAE,CAAC,KAAsB,CAClC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACvB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,IAAI,OAAO,CAAmB,EAAE,CAAC,CAAC;QACxG,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ToolSchema, JsonSchema } from '@loom-node/core';
|
|
2
|
+
/** Lightweight inline schema — no zod needed for system tools */
|
|
3
|
+
export declare function objectSchema<T>(properties: Record<string, JsonSchema>, required: string[], parse: (input: unknown) => T): ToolSchema<T>;
|
|
4
|
+
//# sourceMappingURL=schema-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-helper.d.ts","sourceRoot":"","sources":["../../src/system/schema-helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE9D,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,CAAC,EAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACtC,QAAQ,EAAE,MAAM,EAAE,EAClB,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,GAC3B,UAAU,CAAC,CAAC,CAAC,CAKf"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Lightweight inline schema — no zod needed for system tools */
|
|
2
|
+
export function objectSchema(properties, required, parse) {
|
|
3
|
+
return {
|
|
4
|
+
parse,
|
|
5
|
+
toJsonSchema: () => ({ type: 'object', properties, required }),
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=schema-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-helper.js","sourceRoot":"","sources":["../../src/system/schema-helper.ts"],"names":[],"mappings":"AAEA,iEAAiE;AACjE,MAAM,UAAU,YAAY,CAC1B,UAAsC,EACtC,QAAkB,EAClB,KAA4B;IAE5B,OAAO;QACL,KAAK;QACL,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;KAC/D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/system/shell.ts"],"names":[],"mappings":"AAIA,UAAU,UAAU;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,SAAS,+DA6BpB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { exec } from 'node:child_process';
|
|
2
|
+
import { defineTool } from '../define-tool.js';
|
|
3
|
+
import { objectSchema } from './schema-helper.js';
|
|
4
|
+
export const shellTool = defineTool({
|
|
5
|
+
name: 'shell',
|
|
6
|
+
description: 'Execute a shell command and return stdout/stderr',
|
|
7
|
+
parameters: objectSchema({
|
|
8
|
+
command: { type: 'string', description: 'Shell command to execute' },
|
|
9
|
+
cwd: { type: 'string', description: 'Working directory' },
|
|
10
|
+
timeout: { type: 'number', description: 'Timeout in ms (default 30000)' },
|
|
11
|
+
}, ['command'], (input) => input),
|
|
12
|
+
execute: async (input, ctx) => {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
const child = exec(input.command, {
|
|
15
|
+
cwd: input.cwd,
|
|
16
|
+
timeout: input.timeout ?? 30_000,
|
|
17
|
+
maxBuffer: 1024 * 1024,
|
|
18
|
+
signal: ctx.signal,
|
|
19
|
+
}, (err, stdout, stderr) => {
|
|
20
|
+
if (err && !stdout && !stderr)
|
|
21
|
+
return reject(err);
|
|
22
|
+
resolve({
|
|
23
|
+
exitCode: child.exitCode ?? (err ? 1 : 0),
|
|
24
|
+
stdout: stdout.toString(),
|
|
25
|
+
stderr: stderr.toString(),
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/system/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQlD,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;IAClC,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,kDAAkD;IAC/D,UAAU,EAAE,YAAY,CACtB;QACE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;QACpE,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE;QACzD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA+B,EAAE;KAC1E,EACD,CAAC,SAAS,CAAC,EACX,CAAC,KAAK,EAAE,EAAE,CAAC,KAAmB,CAC/B;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;gBAChC,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,MAAM;gBAChC,SAAS,EAAE,IAAI,GAAG,IAAI;gBACtB,MAAM,EAAE,GAAG,CAAC,MAAM;aACnB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;gBACzB,IAAI,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM;oBAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;gBAClD,OAAO,CAAC;oBACN,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACzC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;oBACzB,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;iBAC1B,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface WriteFileInput {
|
|
2
|
+
path: string;
|
|
3
|
+
content: string;
|
|
4
|
+
mkdirp?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const writeFileTool: import("@loom-node/core").ToolDefinition<WriteFileInput, {
|
|
7
|
+
path: string;
|
|
8
|
+
bytes: number;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=write-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-file.d.ts","sourceRoot":"","sources":["../../src/system/write-file.ts"],"names":[],"mappings":"AAKA,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,aAAa;;;EAmBxB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { writeFile, mkdir } from 'node:fs/promises';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
import { defineTool } from '../define-tool.js';
|
|
4
|
+
import { objectSchema } from './schema-helper.js';
|
|
5
|
+
export const writeFileTool = defineTool({
|
|
6
|
+
name: 'write_file',
|
|
7
|
+
description: 'Write content to a file, creating it if it does not exist',
|
|
8
|
+
parameters: objectSchema({
|
|
9
|
+
path: { type: 'string', description: 'File path to write' },
|
|
10
|
+
content: { type: 'string', description: 'Content to write' },
|
|
11
|
+
mkdirp: { type: 'boolean', description: 'Create parent dirs if missing (default true)' },
|
|
12
|
+
}, ['path', 'content'], (input) => input),
|
|
13
|
+
execute: async (input) => {
|
|
14
|
+
if (input.mkdirp !== false) {
|
|
15
|
+
await mkdir(dirname(input.path), { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
await writeFile(input.path, input.content, 'utf-8');
|
|
18
|
+
return { path: input.path, bytes: Buffer.byteLength(input.content) };
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=write-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-file.js","sourceRoot":"","sources":["../../src/system/write-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQlD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,2DAA2D;IACxE,UAAU,EAAE,YAAY,CACtB;QACE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;QAC3D,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE;QAC5D,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,8CAA8C,EAAE;KACzF,EACD,CAAC,MAAM,EAAE,SAAS,CAAC,EACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAuB,CACnC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACvB,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YAC3B,MAAM,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,MAAM,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;IACvE,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolDefinition, JsonToolDefinition } from '@loom-node/core';
|
|
2
|
+
export declare class ToolRegistry {
|
|
3
|
+
private tools;
|
|
4
|
+
register(tool: ToolDefinition): void;
|
|
5
|
+
get(name: string): ToolDefinition | undefined;
|
|
6
|
+
all(): ToolDefinition[];
|
|
7
|
+
toJsonDefinitions(): JsonToolDefinition[];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=tool-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../src/tool-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAqC;IAElD,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAOpC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI7C,GAAG,IAAI,cAAc,EAAE;IAIvB,iBAAiB,IAAI,kBAAkB,EAAE;CAO1C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class ToolRegistry {
|
|
2
|
+
tools = new Map();
|
|
3
|
+
register(tool) {
|
|
4
|
+
if (this.tools.has(tool.name)) {
|
|
5
|
+
throw new Error(`Tool "${tool.name}" already registered`);
|
|
6
|
+
}
|
|
7
|
+
this.tools.set(tool.name, tool);
|
|
8
|
+
}
|
|
9
|
+
get(name) {
|
|
10
|
+
return this.tools.get(name);
|
|
11
|
+
}
|
|
12
|
+
all() {
|
|
13
|
+
return [...this.tools.values()];
|
|
14
|
+
}
|
|
15
|
+
toJsonDefinitions() {
|
|
16
|
+
return this.all().map((t) => ({
|
|
17
|
+
name: t.name,
|
|
18
|
+
description: t.description,
|
|
19
|
+
parameters: t.parameters.toJsonSchema(),
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../src/tool-registry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IACf,KAAK,GAAG,IAAI,GAAG,EAA0B,CAAC;IAElD,QAAQ,CAAC,IAAoB;QAC3B,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,sBAAsB,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,GAAG;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5B,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,YAAY,EAAE;SACxC,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-adapter.d.ts","sourceRoot":"","sources":["../src/zod-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAE/C,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAKnF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export function zodSchema(schema) {
|
|
2
|
+
return {
|
|
3
|
+
parse: (input) => schema.parse(input),
|
|
4
|
+
toJsonSchema: () => zodToJsonSchema(schema),
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
function zodToJsonSchema(schema) {
|
|
8
|
+
const def = schema._def;
|
|
9
|
+
const typeName = def?.typeName ?? '';
|
|
10
|
+
switch (typeName) {
|
|
11
|
+
case 'ZodString':
|
|
12
|
+
return { type: 'string', ...(def.description ? { description: def.description } : {}) };
|
|
13
|
+
case 'ZodNumber':
|
|
14
|
+
return { type: 'number' };
|
|
15
|
+
case 'ZodBoolean':
|
|
16
|
+
return { type: 'boolean' };
|
|
17
|
+
case 'ZodArray':
|
|
18
|
+
return { type: 'array', items: zodToJsonSchema(def.type) };
|
|
19
|
+
case 'ZodEnum':
|
|
20
|
+
return { type: 'string', enum: def.values };
|
|
21
|
+
case 'ZodOptional':
|
|
22
|
+
case 'ZodNullable':
|
|
23
|
+
return zodToJsonSchema(def.innerType);
|
|
24
|
+
case 'ZodDefault':
|
|
25
|
+
return { ...zodToJsonSchema(def.innerType), default: def.defaultValue() };
|
|
26
|
+
case 'ZodObject': {
|
|
27
|
+
const shape = def.shape();
|
|
28
|
+
const properties = {};
|
|
29
|
+
const required = [];
|
|
30
|
+
for (const [key, val] of Object.entries(shape)) {
|
|
31
|
+
properties[key] = zodToJsonSchema(val);
|
|
32
|
+
if (!isOptional(val))
|
|
33
|
+
required.push(key);
|
|
34
|
+
}
|
|
35
|
+
return { type: 'object', properties, ...(required.length ? { required } : {}) };
|
|
36
|
+
}
|
|
37
|
+
case 'ZodEffects':
|
|
38
|
+
return zodToJsonSchema(def.schema);
|
|
39
|
+
default:
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function isOptional(schema) {
|
|
44
|
+
const name = schema._def?.typeName ?? '';
|
|
45
|
+
if (name === 'ZodOptional')
|
|
46
|
+
return true;
|
|
47
|
+
if (name === 'ZodDefault')
|
|
48
|
+
return true;
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=zod-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-adapter.js","sourceRoot":"","sources":["../src/zod-adapter.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,SAAS,CAAI,MAAuC;IAClE,OAAO;QACL,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAC9C,YAAY,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,MAA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AG,eAAe,CAAC,GAAc,CAAC,CAAC;gBAClD,IAAI,CAAC,UAAU,CAAC,GAAc,CAAC;oBAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACtD,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAClF,CAAC;QACD,KAAK,YAAY;YACf,OAAO,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrC;YACE,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,MAAe;IACjC,MAAM,IAAI,GAAY,MAAc,CAAC,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC;IAC1D,IAAI,IAAI,KAAK,aAAa;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,IAAI,KAAK,YAAY;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@loom-node/tools",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Tool framework for Loom-Node - defineTool, Zod schema, MCP integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@loom-node/core": "0.1.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"zod": "^3.22.0"
|
|
26
|
+
},
|
|
27
|
+
"peerDependenciesMeta": {
|
|
28
|
+
"zod": {
|
|
29
|
+
"optional": true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"typescript": "^5.5.0",
|
|
34
|
+
"zod": "^3.22.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -b",
|
|
38
|
+
"clean": "rm -rf dist .tsbuildinfo"
|
|
39
|
+
}
|
|
40
|
+
}
|