@codeany/open-agent-sdk 0.2.0 → 0.2.1
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/agent.d.ts +113 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +446 -0
- package/dist/agent.js.map +1 -0
- package/dist/engine.d.ts +62 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +494 -0
- package/dist/engine.js.map +1 -0
- package/dist/hooks.d.ts +111 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +179 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +133 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/client.d.ts +19 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +126 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/providers/anthropic.d.ts +17 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +47 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/index.d.ts +20 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +26 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/openai.d.ts +26 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +212 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/types.d.ts +84 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +11 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/sdk-mcp-server.d.ts +52 -0
- package/dist/sdk-mcp-server.d.ts.map +1 -0
- package/dist/sdk-mcp-server.js +57 -0
- package/dist/sdk-mcp-server.js.map +1 -0
- package/dist/session.d.ts +73 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +159 -0
- package/dist/session.js.map +1 -0
- package/dist/skills/bundled/commit.d.ts +7 -0
- package/dist/skills/bundled/commit.d.ts.map +1 -0
- package/dist/skills/bundled/commit.js +35 -0
- package/dist/skills/bundled/commit.js.map +1 -0
- package/dist/skills/bundled/debug.d.ts +7 -0
- package/dist/skills/bundled/debug.d.ts.map +1 -0
- package/dist/skills/bundled/debug.js +46 -0
- package/dist/skills/bundled/debug.js.map +1 -0
- package/dist/skills/bundled/index.d.ts +11 -0
- package/dist/skills/bundled/index.d.ts.map +1 -0
- package/dist/skills/bundled/index.js +26 -0
- package/dist/skills/bundled/index.js.map +1 -0
- package/dist/skills/bundled/review.d.ts +7 -0
- package/dist/skills/bundled/review.d.ts.map +1 -0
- package/dist/skills/bundled/review.js +38 -0
- package/dist/skills/bundled/review.js.map +1 -0
- package/dist/skills/bundled/simplify.d.ts +8 -0
- package/dist/skills/bundled/simplify.d.ts.map +1 -0
- package/dist/skills/bundled/simplify.js +48 -0
- package/dist/skills/bundled/simplify.js.map +1 -0
- package/dist/skills/bundled/test.d.ts +7 -0
- package/dist/skills/bundled/test.d.ts.map +1 -0
- package/dist/skills/bundled/test.js +40 -0
- package/dist/skills/bundled/test.js.map +1 -0
- package/dist/skills/index.d.ts +7 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +8 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/registry.d.ts +43 -0
- package/dist/skills/registry.d.ts.map +1 -0
- package/dist/skills/registry.js +111 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/skills/types.d.ts +83 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +8 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/tool-helper.d.ts +73 -0
- package/dist/tool-helper.d.ts.map +1 -0
- package/dist/tool-helper.js +86 -0
- package/dist/tool-helper.js.map +1 -0
- package/dist/tools/agent-tool.d.ts +17 -0
- package/dist/tools/agent-tool.d.ts.map +1 -0
- package/dist/tools/agent-tool.js +146 -0
- package/dist/tools/agent-tool.js.map +1 -0
- package/dist/tools/ask-user.d.ts +18 -0
- package/dist/tools/ask-user.d.ts.map +1 -0
- package/dist/tools/ask-user.js +72 -0
- package/dist/tools/ask-user.js.map +1 -0
- package/dist/tools/bash.d.ts +5 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/bash.js +67 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/config-tool.d.ts +20 -0
- package/dist/tools/config-tool.d.ts.map +1 -0
- package/dist/tools/config-tool.js +83 -0
- package/dist/tools/config-tool.js.map +1 -0
- package/dist/tools/cron-tools.d.ts +33 -0
- package/dist/tools/cron-tools.d.ts.map +1 -0
- package/dist/tools/cron-tools.js +128 -0
- package/dist/tools/cron-tools.js.map +1 -0
- package/dist/tools/edit.d.ts +5 -0
- package/dist/tools/edit.d.ts.map +1 -0
- package/dist/tools/edit.js +70 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/glob.d.ts +5 -0
- package/dist/tools/glob.d.ts.map +1 -0
- package/dist/tools/glob.js +75 -0
- package/dist/tools/glob.js.map +1 -0
- package/dist/tools/grep.d.ts +5 -0
- package/dist/tools/grep.d.ts.map +1 -0
- package/dist/tools/grep.js +168 -0
- package/dist/tools/grep.js.map +1 -0
- package/dist/tools/index.d.ts +45 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +162 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/lsp-tool.d.ts +9 -0
- package/dist/tools/lsp-tool.d.ts.map +1 -0
- package/dist/tools/lsp-tool.js +137 -0
- package/dist/tools/lsp-tool.js.map +1 -0
- package/dist/tools/mcp-resource-tools.d.ts +14 -0
- package/dist/tools/mcp-resource-tools.d.ts.map +1 -0
- package/dist/tools/mcp-resource-tools.js +117 -0
- package/dist/tools/mcp-resource-tools.js.map +1 -0
- package/dist/tools/notebook-edit.d.ts +5 -0
- package/dist/tools/notebook-edit.d.ts.map +1 -0
- package/dist/tools/notebook-edit.js +85 -0
- package/dist/tools/notebook-edit.js.map +1 -0
- package/dist/tools/plan-tools.d.ts +12 -0
- package/dist/tools/plan-tools.d.ts.map +1 -0
- package/dist/tools/plan-tools.js +77 -0
- package/dist/tools/plan-tools.js.map +1 -0
- package/dist/tools/read.d.ts +5 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/read.js +66 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/send-message.d.ts +31 -0
- package/dist/tools/send-message.d.ts.map +1 -0
- package/dist/tools/send-message.js +77 -0
- package/dist/tools/send-message.js.map +1 -0
- package/dist/tools/skill-tool.d.ts +9 -0
- package/dist/tools/skill-tool.d.ts.map +1 -0
- package/dist/tools/skill-tool.js +115 -0
- package/dist/tools/skill-tool.js.map +1 -0
- package/dist/tools/task-tools.d.ts +48 -0
- package/dist/tools/task-tools.d.ts.map +1 -0
- package/dist/tools/task-tools.js +242 -0
- package/dist/tools/task-tools.js.map +1 -0
- package/dist/tools/team-tools.d.ts +34 -0
- package/dist/tools/team-tools.d.ts.map +1 -0
- package/dist/tools/team-tools.js +103 -0
- package/dist/tools/team-tools.js.map +1 -0
- package/dist/tools/todo-tool.d.ts +22 -0
- package/dist/tools/todo-tool.d.ts.map +1 -0
- package/dist/tools/todo-tool.js +93 -0
- package/dist/tools/todo-tool.js.map +1 -0
- package/dist/tools/tool-search.d.ts +13 -0
- package/dist/tools/tool-search.d.ts.map +1 -0
- package/dist/tools/tool-search.js +76 -0
- package/dist/tools/tool-search.js.map +1 -0
- package/dist/tools/types.d.ts +29 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +52 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/web-fetch.d.ts +5 -0
- package/dist/tools/web-fetch.d.ts.map +1 -0
- package/dist/tools/web-fetch.js +60 -0
- package/dist/tools/web-fetch.js.map +1 -0
- package/dist/tools/web-search.d.ts +5 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +77 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tools/worktree-tools.d.ts +10 -0
- package/dist/tools/worktree-tools.d.ts.map +1 -0
- package/dist/tools/worktree-tools.js +130 -0
- package/dist/tools/worktree-tools.js.map +1 -0
- package/dist/tools/write.d.ts +5 -0
- package/dist/tools/write.d.ts.map +1 -0
- package/dist/tools/write.js +40 -0
- package/dist/tools/write.js.map +1 -0
- package/dist/types.d.ts +423 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/compact.d.ts +44 -0
- package/dist/utils/compact.d.ts.map +1 -0
- package/dist/utils/compact.js +162 -0
- package/dist/utils/compact.js.map +1 -0
- package/dist/utils/context.d.ts +35 -0
- package/dist/utils/context.d.ts.map +1 -0
- package/dist/utils/context.js +174 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/fileCache.d.ts +64 -0
- package/dist/utils/fileCache.d.ts.map +1 -0
- package/dist/utils/fileCache.js +117 -0
- package/dist/utils/fileCache.js.map +1 -0
- package/dist/utils/messages.d.ts +57 -0
- package/dist/utils/messages.d.ts.map +1 -0
- package/dist/utils/messages.js +152 -0
- package/dist/utils/messages.js.map +1 -0
- package/dist/utils/retry.d.ts +48 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +111 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/tokens.d.ts +57 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tokens.js +134 -0
- package/dist/utils/tokens.js.map +1 -0
- package/package.json +7 -1
- package/.env.example +0 -8
- package/examples/01-simple-query.ts +0 -43
- package/examples/02-multi-tool.ts +0 -44
- package/examples/03-multi-turn.ts +0 -39
- package/examples/04-prompt-api.ts +0 -29
- package/examples/05-custom-system-prompt.ts +0 -26
- package/examples/06-mcp-server.ts +0 -49
- package/examples/07-custom-tools.ts +0 -87
- package/examples/08-official-api-compat.ts +0 -38
- package/examples/09-subagents.ts +0 -48
- package/examples/10-permissions.ts +0 -40
- package/examples/11-custom-mcp-tools.ts +0 -101
- package/examples/12-skills.ts +0 -88
- package/examples/13-hooks.ts +0 -88
- package/examples/14-openai-compat.ts +0 -71
- package/examples/web/index.html +0 -365
- package/examples/web/server.ts +0 -157
- package/tsconfig.json +0 -19
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GrepTool - Search file contents using regex
|
|
3
|
+
*/
|
|
4
|
+
import { spawn } from 'child_process';
|
|
5
|
+
import { resolve } from 'path';
|
|
6
|
+
import { defineTool } from './types.js';
|
|
7
|
+
export const GrepTool = defineTool({
|
|
8
|
+
name: 'Grep',
|
|
9
|
+
description: 'Search file contents using regex patterns. Uses ripgrep (rg) if available, falls back to grep. Supports file type filtering and context lines.',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
pattern: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'The regex pattern to search for',
|
|
16
|
+
},
|
|
17
|
+
path: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'File or directory to search in (defaults to cwd)',
|
|
20
|
+
},
|
|
21
|
+
glob: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'Glob pattern to filter files (e.g., "*.ts", "*.{js,jsx}")',
|
|
24
|
+
},
|
|
25
|
+
type: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'File type filter (e.g., "ts", "py", "js")',
|
|
28
|
+
},
|
|
29
|
+
output_mode: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
enum: ['content', 'files_with_matches', 'count'],
|
|
32
|
+
description: 'Output mode (default: files_with_matches)',
|
|
33
|
+
},
|
|
34
|
+
'-i': {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
description: 'Case insensitive search',
|
|
37
|
+
},
|
|
38
|
+
'-n': {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
description: 'Show line numbers (default: true)',
|
|
41
|
+
},
|
|
42
|
+
'-A': { type: 'number', description: 'Lines after match' },
|
|
43
|
+
'-B': { type: 'number', description: 'Lines before match' },
|
|
44
|
+
'-C': { type: 'number', description: 'Context lines' },
|
|
45
|
+
context: { type: 'number', description: 'Context lines (alias for -C)' },
|
|
46
|
+
head_limit: { type: 'number', description: 'Limit output entries (default: 250)' },
|
|
47
|
+
},
|
|
48
|
+
required: ['pattern'],
|
|
49
|
+
},
|
|
50
|
+
isReadOnly: true,
|
|
51
|
+
isConcurrencySafe: true,
|
|
52
|
+
async call(input, context) {
|
|
53
|
+
const searchPath = input.path ? resolve(context.cwd, input.path) : context.cwd;
|
|
54
|
+
const outputMode = input.output_mode || 'files_with_matches';
|
|
55
|
+
const headLimit = input.head_limit ?? 250;
|
|
56
|
+
// Build rg command (fall back to grep if rg unavailable)
|
|
57
|
+
const args = [];
|
|
58
|
+
// Try ripgrep first
|
|
59
|
+
let cmd = 'rg';
|
|
60
|
+
if (outputMode === 'files_with_matches') {
|
|
61
|
+
args.push('--files-with-matches');
|
|
62
|
+
}
|
|
63
|
+
else if (outputMode === 'count') {
|
|
64
|
+
args.push('--count');
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// content mode
|
|
68
|
+
if (input['-n'] !== false)
|
|
69
|
+
args.push('--line-number');
|
|
70
|
+
}
|
|
71
|
+
if (input['-i'])
|
|
72
|
+
args.push('--ignore-case');
|
|
73
|
+
if (input['-A'])
|
|
74
|
+
args.push('-A', String(input['-A']));
|
|
75
|
+
if (input['-B'])
|
|
76
|
+
args.push('-B', String(input['-B']));
|
|
77
|
+
const ctx = input['-C'] ?? input.context;
|
|
78
|
+
if (ctx)
|
|
79
|
+
args.push('-C', String(ctx));
|
|
80
|
+
if (input.glob)
|
|
81
|
+
args.push('--glob', input.glob);
|
|
82
|
+
if (input.type)
|
|
83
|
+
args.push('--type', input.type);
|
|
84
|
+
args.push('--', input.pattern, searchPath);
|
|
85
|
+
return new Promise((resolvePromise) => {
|
|
86
|
+
const proc = spawn(cmd, args, {
|
|
87
|
+
cwd: context.cwd,
|
|
88
|
+
timeout: 30000,
|
|
89
|
+
});
|
|
90
|
+
const chunks = [];
|
|
91
|
+
const errChunks = [];
|
|
92
|
+
proc.stdout?.on('data', (d) => chunks.push(d));
|
|
93
|
+
proc.stderr?.on('data', (d) => errChunks.push(d));
|
|
94
|
+
proc.on('close', (code) => {
|
|
95
|
+
let result = Buffer.concat(chunks).toString('utf-8').trim();
|
|
96
|
+
if (!result && code !== 0) {
|
|
97
|
+
// Try fallback to grep
|
|
98
|
+
const grepArgs = ['-r'];
|
|
99
|
+
if (input['-i'])
|
|
100
|
+
grepArgs.push('-i');
|
|
101
|
+
if (outputMode === 'files_with_matches')
|
|
102
|
+
grepArgs.push('-l');
|
|
103
|
+
if (outputMode === 'count')
|
|
104
|
+
grepArgs.push('-c');
|
|
105
|
+
if (outputMode === 'content' && input['-n'] !== false)
|
|
106
|
+
grepArgs.push('-n');
|
|
107
|
+
if (input.glob)
|
|
108
|
+
grepArgs.push('--include', input.glob);
|
|
109
|
+
grepArgs.push('--', input.pattern, searchPath);
|
|
110
|
+
const grepProc = spawn('grep', grepArgs, {
|
|
111
|
+
cwd: context.cwd,
|
|
112
|
+
timeout: 30000,
|
|
113
|
+
});
|
|
114
|
+
const grepChunks = [];
|
|
115
|
+
grepProc.stdout?.on('data', (d) => grepChunks.push(d));
|
|
116
|
+
grepProc.on('close', () => {
|
|
117
|
+
const grepResult = Buffer.concat(grepChunks).toString('utf-8').trim();
|
|
118
|
+
if (!grepResult) {
|
|
119
|
+
resolvePromise(`No matches found for pattern "${input.pattern}"`);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
// Apply head limit
|
|
123
|
+
const lines = grepResult.split('\n');
|
|
124
|
+
if (headLimit > 0 && lines.length > headLimit) {
|
|
125
|
+
resolvePromise(lines.slice(0, headLimit).join('\n') + `\n... (${lines.length - headLimit} more)`);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
resolvePromise(grepResult);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
grepProc.on('error', () => {
|
|
133
|
+
resolvePromise(`No matches found for pattern "${input.pattern}"`);
|
|
134
|
+
});
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (!result) {
|
|
138
|
+
resolvePromise(`No matches found for pattern "${input.pattern}"`);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
// Apply head limit
|
|
142
|
+
const lines = result.split('\n');
|
|
143
|
+
if (headLimit > 0 && lines.length > headLimit) {
|
|
144
|
+
result = lines.slice(0, headLimit).join('\n') + `\n... (${lines.length - headLimit} more)`;
|
|
145
|
+
}
|
|
146
|
+
resolvePromise(result);
|
|
147
|
+
});
|
|
148
|
+
proc.on('error', () => {
|
|
149
|
+
// rg not found, try grep directly
|
|
150
|
+
const grepArgs = ['-r', '-n', '--', input.pattern, searchPath];
|
|
151
|
+
const grepProc = spawn('grep', grepArgs, {
|
|
152
|
+
cwd: context.cwd,
|
|
153
|
+
timeout: 30000,
|
|
154
|
+
});
|
|
155
|
+
const grepChunks = [];
|
|
156
|
+
grepProc.stdout?.on('data', (d) => grepChunks.push(d));
|
|
157
|
+
grepProc.on('close', () => {
|
|
158
|
+
const grepResult = Buffer.concat(grepChunks).toString('utf-8').trim();
|
|
159
|
+
resolvePromise(grepResult || `No matches found for pattern "${input.pattern}"`);
|
|
160
|
+
});
|
|
161
|
+
grepProc.on('error', () => {
|
|
162
|
+
resolvePromise(`Error: neither rg nor grep available`);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
//# sourceMappingURL=grep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grep.js","sourceRoot":"","sources":["../../src/tools/grep.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;A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E,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;gBAC9D,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE;oBACvC,GAAG,EAAE,OAAO,CAAC,GAAG;oBAChB,OAAO,EAAE,KAAK;iBACf,CAAC,CAAA;gBACF,MAAM,UAAU,GAAa,EAAE,CAAA;gBAC/B,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;gBAC9D,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;oBACxB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAA;oBACrE,cAAc,CAAC,UAAU,IAAI,iCAAiC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAA;gBACjF,CAAC,CAAC,CAAA;gBACF,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;oBACxB,cAAc,CAAC,sCAAsC,CAAC,CAAA;gBACxD,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Registry - All built-in tool definitions
|
|
3
|
+
*
|
|
4
|
+
* 30+ tools covering file I/O, execution, search, web, agents,
|
|
5
|
+
* tasks, teams, messaging, worktree, planning, scheduling, and more.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolDefinition } from '../types.js';
|
|
8
|
+
import { BashTool } from './bash.js';
|
|
9
|
+
import { FileReadTool } from './read.js';
|
|
10
|
+
import { FileWriteTool } from './write.js';
|
|
11
|
+
import { FileEditTool } from './edit.js';
|
|
12
|
+
import { GlobTool } from './glob.js';
|
|
13
|
+
import { GrepTool } from './grep.js';
|
|
14
|
+
import { NotebookEditTool } from './notebook-edit.js';
|
|
15
|
+
import { WebFetchTool } from './web-fetch.js';
|
|
16
|
+
import { WebSearchTool } from './web-search.js';
|
|
17
|
+
import { AgentTool } from './agent-tool.js';
|
|
18
|
+
import { SendMessageTool } from './send-message.js';
|
|
19
|
+
import { TeamCreateTool, TeamDeleteTool } from './team-tools.js';
|
|
20
|
+
import { TaskCreateTool, TaskListTool, TaskUpdateTool, TaskGetTool, TaskStopTool, TaskOutputTool } from './task-tools.js';
|
|
21
|
+
import { EnterWorktreeTool, ExitWorktreeTool } from './worktree-tools.js';
|
|
22
|
+
import { EnterPlanModeTool, ExitPlanModeTool } from './plan-tools.js';
|
|
23
|
+
import { AskUserQuestionTool } from './ask-user.js';
|
|
24
|
+
import { ToolSearchTool } from './tool-search.js';
|
|
25
|
+
import { ListMcpResourcesTool, ReadMcpResourceTool } from './mcp-resource-tools.js';
|
|
26
|
+
import { CronCreateTool, CronDeleteTool, CronListTool, RemoteTriggerTool } from './cron-tools.js';
|
|
27
|
+
import { LSPTool } from './lsp-tool.js';
|
|
28
|
+
import { ConfigTool } from './config-tool.js';
|
|
29
|
+
import { TodoWriteTool } from './todo-tool.js';
|
|
30
|
+
import { SkillTool } from './skill-tool.js';
|
|
31
|
+
/**
|
|
32
|
+
* Get all built-in tools.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getAllBaseTools(): ToolDefinition[];
|
|
35
|
+
/**
|
|
36
|
+
* Filter tools by allowed/disallowed lists.
|
|
37
|
+
*/
|
|
38
|
+
export declare function filterTools(tools: ToolDefinition[], allowedTools?: string[], disallowedTools?: string[]): ToolDefinition[];
|
|
39
|
+
/**
|
|
40
|
+
* Assemble tool pool: base tools + MCP tools, with deduplication.
|
|
41
|
+
*/
|
|
42
|
+
export declare function assembleToolPool(baseTools: ToolDefinition[], mcpTools?: ToolDefinition[], allowedTools?: string[], disallowedTools?: string[]): ToolDefinition[];
|
|
43
|
+
export { BashTool, FileReadTool, FileWriteTool, FileEditTool, GlobTool, GrepTool, NotebookEditTool, WebFetchTool, WebSearchTool, AgentTool, SendMessageTool, TeamCreateTool, TeamDeleteTool, TaskCreateTool, TaskListTool, TaskUpdateTool, TaskGetTool, TaskStopTool, TaskOutputTool, EnterWorktreeTool, ExitWorktreeTool, EnterPlanModeTool, ExitPlanModeTool, AskUserQuestionTool, ToolSearchTool, ListMcpResourcesTool, ReadMcpResourceTool, CronCreateTool, CronDeleteTool, CronListTool, RemoteTriggerTool, LSPTool, ConfigTool, TodoWriteTool, SkillTool, };
|
|
44
|
+
export { defineTool, toApiTool } from './types.js';
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CA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AY,EACZ,aAAa,EAEb,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,EAEd,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,cAAc,EAEd,iBAAiB,EACjB,gBAAgB,EAEhB,iBAAiB,EACjB,gBAAgB,EAEhB,mBAAmB,EAEnB,cAAc,EAEd,oBAAoB,EACpB,mBAAmB,EAEnB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,iBAAiB,EAEjB,OAAO,EAEP,UAAU,EAEV,aAAa,EAEb,SAAS,GACV,CAAA;AAGD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Registry - All built-in tool definitions
|
|
3
|
+
*
|
|
4
|
+
* 30+ tools covering file I/O, execution, search, web, agents,
|
|
5
|
+
* tasks, teams, messaging, worktree, planning, scheduling, and more.
|
|
6
|
+
*/
|
|
7
|
+
// File I/O
|
|
8
|
+
import { BashTool } from './bash.js';
|
|
9
|
+
import { FileReadTool } from './read.js';
|
|
10
|
+
import { FileWriteTool } from './write.js';
|
|
11
|
+
import { FileEditTool } from './edit.js';
|
|
12
|
+
import { GlobTool } from './glob.js';
|
|
13
|
+
import { GrepTool } from './grep.js';
|
|
14
|
+
import { NotebookEditTool } from './notebook-edit.js';
|
|
15
|
+
// Web
|
|
16
|
+
import { WebFetchTool } from './web-fetch.js';
|
|
17
|
+
import { WebSearchTool } from './web-search.js';
|
|
18
|
+
// Agent & Multi-agent
|
|
19
|
+
import { AgentTool } from './agent-tool.js';
|
|
20
|
+
import { SendMessageTool } from './send-message.js';
|
|
21
|
+
import { TeamCreateTool, TeamDeleteTool } from './team-tools.js';
|
|
22
|
+
// Tasks
|
|
23
|
+
import { TaskCreateTool, TaskListTool, TaskUpdateTool, TaskGetTool, TaskStopTool, TaskOutputTool, } from './task-tools.js';
|
|
24
|
+
// Worktree
|
|
25
|
+
import { EnterWorktreeTool, ExitWorktreeTool } from './worktree-tools.js';
|
|
26
|
+
// Planning
|
|
27
|
+
import { EnterPlanModeTool, ExitPlanModeTool } from './plan-tools.js';
|
|
28
|
+
// User interaction
|
|
29
|
+
import { AskUserQuestionTool } from './ask-user.js';
|
|
30
|
+
// Discovery
|
|
31
|
+
import { ToolSearchTool } from './tool-search.js';
|
|
32
|
+
// MCP Resources
|
|
33
|
+
import { ListMcpResourcesTool, ReadMcpResourceTool } from './mcp-resource-tools.js';
|
|
34
|
+
// Scheduling
|
|
35
|
+
import { CronCreateTool, CronDeleteTool, CronListTool, RemoteTriggerTool } from './cron-tools.js';
|
|
36
|
+
// LSP
|
|
37
|
+
import { LSPTool } from './lsp-tool.js';
|
|
38
|
+
// Config
|
|
39
|
+
import { ConfigTool } from './config-tool.js';
|
|
40
|
+
// Todo
|
|
41
|
+
import { TodoWriteTool } from './todo-tool.js';
|
|
42
|
+
// Skill
|
|
43
|
+
import { SkillTool } from './skill-tool.js';
|
|
44
|
+
/**
|
|
45
|
+
* All built-in tools (30+).
|
|
46
|
+
*/
|
|
47
|
+
const ALL_TOOLS = [
|
|
48
|
+
// Core file I/O & execution
|
|
49
|
+
BashTool,
|
|
50
|
+
FileReadTool,
|
|
51
|
+
FileWriteTool,
|
|
52
|
+
FileEditTool,
|
|
53
|
+
GlobTool,
|
|
54
|
+
GrepTool,
|
|
55
|
+
NotebookEditTool,
|
|
56
|
+
// Web
|
|
57
|
+
WebFetchTool,
|
|
58
|
+
WebSearchTool,
|
|
59
|
+
// Agent & Multi-agent
|
|
60
|
+
AgentTool,
|
|
61
|
+
SendMessageTool,
|
|
62
|
+
TeamCreateTool,
|
|
63
|
+
TeamDeleteTool,
|
|
64
|
+
// Tasks
|
|
65
|
+
TaskCreateTool,
|
|
66
|
+
TaskListTool,
|
|
67
|
+
TaskUpdateTool,
|
|
68
|
+
TaskGetTool,
|
|
69
|
+
TaskStopTool,
|
|
70
|
+
TaskOutputTool,
|
|
71
|
+
// Worktree
|
|
72
|
+
EnterWorktreeTool,
|
|
73
|
+
ExitWorktreeTool,
|
|
74
|
+
// Planning
|
|
75
|
+
EnterPlanModeTool,
|
|
76
|
+
ExitPlanModeTool,
|
|
77
|
+
// User interaction
|
|
78
|
+
AskUserQuestionTool,
|
|
79
|
+
// Discovery
|
|
80
|
+
ToolSearchTool,
|
|
81
|
+
// MCP Resources
|
|
82
|
+
ListMcpResourcesTool,
|
|
83
|
+
ReadMcpResourceTool,
|
|
84
|
+
// Scheduling
|
|
85
|
+
CronCreateTool,
|
|
86
|
+
CronDeleteTool,
|
|
87
|
+
CronListTool,
|
|
88
|
+
RemoteTriggerTool,
|
|
89
|
+
// LSP
|
|
90
|
+
LSPTool,
|
|
91
|
+
// Config
|
|
92
|
+
ConfigTool,
|
|
93
|
+
// Todo
|
|
94
|
+
TodoWriteTool,
|
|
95
|
+
// Skill
|
|
96
|
+
SkillTool,
|
|
97
|
+
];
|
|
98
|
+
/**
|
|
99
|
+
* Get all built-in tools.
|
|
100
|
+
*/
|
|
101
|
+
export function getAllBaseTools() {
|
|
102
|
+
return [...ALL_TOOLS];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Filter tools by allowed/disallowed lists.
|
|
106
|
+
*/
|
|
107
|
+
export function filterTools(tools, allowedTools, disallowedTools) {
|
|
108
|
+
let filtered = tools;
|
|
109
|
+
if (allowedTools && allowedTools.length > 0) {
|
|
110
|
+
const allowed = new Set(allowedTools);
|
|
111
|
+
filtered = filtered.filter((t) => allowed.has(t.name));
|
|
112
|
+
}
|
|
113
|
+
if (disallowedTools && disallowedTools.length > 0) {
|
|
114
|
+
const disallowed = new Set(disallowedTools);
|
|
115
|
+
filtered = filtered.filter((t) => !disallowed.has(t.name));
|
|
116
|
+
}
|
|
117
|
+
return filtered;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Assemble tool pool: base tools + MCP tools, with deduplication.
|
|
121
|
+
*/
|
|
122
|
+
export function assembleToolPool(baseTools, mcpTools = [], allowedTools, disallowedTools) {
|
|
123
|
+
const combined = [...baseTools, ...mcpTools];
|
|
124
|
+
// Deduplicate by name (later definitions override)
|
|
125
|
+
const byName = new Map();
|
|
126
|
+
for (const tool of combined) {
|
|
127
|
+
byName.set(tool.name, tool);
|
|
128
|
+
}
|
|
129
|
+
let tools = Array.from(byName.values());
|
|
130
|
+
return filterTools(tools, allowedTools, disallowedTools);
|
|
131
|
+
}
|
|
132
|
+
// Re-export individual tools
|
|
133
|
+
export {
|
|
134
|
+
// Core
|
|
135
|
+
BashTool, FileReadTool, FileWriteTool, FileEditTool, GlobTool, GrepTool, NotebookEditTool, WebFetchTool, WebSearchTool,
|
|
136
|
+
// Agent
|
|
137
|
+
AgentTool, SendMessageTool, TeamCreateTool, TeamDeleteTool,
|
|
138
|
+
// Tasks
|
|
139
|
+
TaskCreateTool, TaskListTool, TaskUpdateTool, TaskGetTool, TaskStopTool, TaskOutputTool,
|
|
140
|
+
// Worktree
|
|
141
|
+
EnterWorktreeTool, ExitWorktreeTool,
|
|
142
|
+
// Planning
|
|
143
|
+
EnterPlanModeTool, ExitPlanModeTool,
|
|
144
|
+
// User
|
|
145
|
+
AskUserQuestionTool,
|
|
146
|
+
// Discovery
|
|
147
|
+
ToolSearchTool,
|
|
148
|
+
// MCP
|
|
149
|
+
ListMcpResourcesTool, ReadMcpResourceTool,
|
|
150
|
+
// Scheduling
|
|
151
|
+
CronCreateTool, CronDeleteTool, CronListTool, RemoteTriggerTool,
|
|
152
|
+
// LSP
|
|
153
|
+
LSPTool,
|
|
154
|
+
// Config
|
|
155
|
+
ConfigTool,
|
|
156
|
+
// Todo
|
|
157
|
+
TodoWriteTool,
|
|
158
|
+
// Skill
|
|
159
|
+
SkillTool, };
|
|
160
|
+
// Re-export helpers
|
|
161
|
+
export { defineTool, toApiTool } from './types.js';
|
|
162
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js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AAQ;AACR,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc;AACd,QAAQ;AACR,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,cAAc;AACd,WAAW;AACX,iBAAiB,EACjB,gBAAgB;AAChB,WAAW;AACX,iBAAiB,EACjB,gBAAgB;AAChB,OAAO;AACP,mBAAmB;AACnB,YAAY;AACZ,cAAc;AACd,MAAM;AACN,oBAAoB,EACpB,mBAAmB;AACnB,aAAa;AACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,iBAAiB;AACjB,MAAM;AACN,OAAO;AACP,SAAS;AACT,UAAU;AACV,OAAO;AACP,aAAa;AACb,QAAQ;AACR,SAAS,GACV,CAAA;AAED,oBAAoB;AACpB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSPTool - Language Server Protocol integration
|
|
3
|
+
*
|
|
4
|
+
* Provides code intelligence: go-to-definition, find-references,
|
|
5
|
+
* hover, document symbols, workspace symbols, etc.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolDefinition } from '../types.js';
|
|
8
|
+
export declare const LSPTool: ToolDefinition;
|
|
9
|
+
//# sourceMappingURL=lsp-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-tool.d.ts","sourceRoot":"","sources":["../../src/tools/lsp-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,aAAa,CAAA;AAE7D,eAAO,MAAM,OAAO,EAAE,cAqHrB,CAAA"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSPTool - Language Server Protocol integration
|
|
3
|
+
*
|
|
4
|
+
* Provides code intelligence: go-to-definition, find-references,
|
|
5
|
+
* hover, document symbols, workspace symbols, etc.
|
|
6
|
+
*/
|
|
7
|
+
import { execSync } from 'child_process';
|
|
8
|
+
export const LSPTool = {
|
|
9
|
+
name: 'LSP',
|
|
10
|
+
description: 'Language Server Protocol operations for code intelligence. Supports go-to-definition, find-references, hover, and symbol lookup.',
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
operation: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
enum: [
|
|
17
|
+
'goToDefinition',
|
|
18
|
+
'findReferences',
|
|
19
|
+
'hover',
|
|
20
|
+
'documentSymbol',
|
|
21
|
+
'workspaceSymbol',
|
|
22
|
+
'goToImplementation',
|
|
23
|
+
'prepareCallHierarchy',
|
|
24
|
+
'incomingCalls',
|
|
25
|
+
'outgoingCalls',
|
|
26
|
+
],
|
|
27
|
+
description: 'LSP operation to perform',
|
|
28
|
+
},
|
|
29
|
+
file_path: { type: 'string', description: 'File path for the operation' },
|
|
30
|
+
line: { type: 'number', description: 'Line number (0-based)' },
|
|
31
|
+
character: { type: 'number', description: 'Character position (0-based)' },
|
|
32
|
+
query: { type: 'string', description: 'Symbol name (for workspace symbol search)' },
|
|
33
|
+
},
|
|
34
|
+
required: ['operation'],
|
|
35
|
+
},
|
|
36
|
+
isReadOnly: () => true,
|
|
37
|
+
isConcurrencySafe: () => true,
|
|
38
|
+
isEnabled: () => true,
|
|
39
|
+
async prompt() { return 'Code intelligence via Language Server Protocol.'; },
|
|
40
|
+
async call(input, context) {
|
|
41
|
+
const { operation, file_path, line, character, query } = input;
|
|
42
|
+
// LSP requires a running language server. In standalone mode,
|
|
43
|
+
// we fall back to basic grep/ripgrep-based symbol lookup.
|
|
44
|
+
try {
|
|
45
|
+
switch (operation) {
|
|
46
|
+
case 'goToDefinition':
|
|
47
|
+
case 'goToImplementation': {
|
|
48
|
+
if (!file_path || line === undefined) {
|
|
49
|
+
return { type: 'tool_result', tool_use_id: '', content: 'file_path and line required', is_error: true };
|
|
50
|
+
}
|
|
51
|
+
// Use grep to find definition
|
|
52
|
+
const symbol = await getSymbolAtPosition(file_path, line, character || 0, context.cwd);
|
|
53
|
+
if (!symbol) {
|
|
54
|
+
return { type: 'tool_result', tool_use_id: '', content: 'Could not identify symbol at position' };
|
|
55
|
+
}
|
|
56
|
+
const results = execSync(`rg -n "(?:function|class|interface|type|const|let|var|export)\\s+${symbol}" --type-add 'src:*.{ts,tsx,js,jsx,py,go,rs,java}' -t src ${context.cwd} 2>/dev/null || grep -rn "(?:function|class|interface|type|const|let|var|export)\\s*${symbol}" ${context.cwd} --include='*.ts' --include='*.js' 2>/dev/null`, { encoding: 'utf-8', timeout: 10000 }).trim();
|
|
57
|
+
return { type: 'tool_result', tool_use_id: '', content: results || `No definition found for "${symbol}"` };
|
|
58
|
+
}
|
|
59
|
+
case 'findReferences': {
|
|
60
|
+
if (!file_path || line === undefined) {
|
|
61
|
+
return { type: 'tool_result', tool_use_id: '', content: 'file_path and line required', is_error: true };
|
|
62
|
+
}
|
|
63
|
+
const sym = await getSymbolAtPosition(file_path, line, character || 0, context.cwd);
|
|
64
|
+
if (!sym) {
|
|
65
|
+
return { type: 'tool_result', tool_use_id: '', content: 'Could not identify symbol at position' };
|
|
66
|
+
}
|
|
67
|
+
const refs = execSync(`rg -n "${sym}" ${context.cwd} --type-add 'src:*.{ts,tsx,js,jsx,py,go,rs,java}' -t src 2>/dev/null | head -50`, { encoding: 'utf-8', timeout: 10000 }).trim();
|
|
68
|
+
return { type: 'tool_result', tool_use_id: '', content: refs || `No references found for "${sym}"` };
|
|
69
|
+
}
|
|
70
|
+
case 'hover': {
|
|
71
|
+
return {
|
|
72
|
+
type: 'tool_result',
|
|
73
|
+
tool_use_id: '',
|
|
74
|
+
content: 'Hover information requires a running language server. Use Read tool to examine the file content.',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
case 'documentSymbol': {
|
|
78
|
+
if (!file_path) {
|
|
79
|
+
return { type: 'tool_result', tool_use_id: '', content: 'file_path required', is_error: true };
|
|
80
|
+
}
|
|
81
|
+
const symbols = execSync(`rg -n "^\\s*(export\\s+)?(function|class|interface|type|const|let|var|enum)\\s+" ${JSON.stringify(file_path)} 2>/dev/null || grep -n "^\\s*\\(export\\s\\+\\)\\?\\(function\\|class\\|interface\\|type\\|const\\|let\\|var\\|enum\\)\\s" ${JSON.stringify(file_path)} 2>/dev/null`, { encoding: 'utf-8', cwd: context.cwd, timeout: 10000 }).trim();
|
|
82
|
+
return { type: 'tool_result', tool_use_id: '', content: symbols || 'No symbols found' };
|
|
83
|
+
}
|
|
84
|
+
case 'workspaceSymbol': {
|
|
85
|
+
if (!query) {
|
|
86
|
+
return { type: 'tool_result', tool_use_id: '', content: 'query required', is_error: true };
|
|
87
|
+
}
|
|
88
|
+
const wsSymbols = execSync(`rg -n "${query}" ${context.cwd} --type-add 'src:*.{ts,tsx,js,jsx,py,go,rs,java}' -t src 2>/dev/null | head -30`, { encoding: 'utf-8', timeout: 10000 }).trim();
|
|
89
|
+
return { type: 'tool_result', tool_use_id: '', content: wsSymbols || `No symbols found for "${query}"` };
|
|
90
|
+
}
|
|
91
|
+
default:
|
|
92
|
+
return {
|
|
93
|
+
type: 'tool_result',
|
|
94
|
+
tool_use_id: '',
|
|
95
|
+
content: `LSP operation "${operation}" requires a running language server.`,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
return {
|
|
101
|
+
type: 'tool_result',
|
|
102
|
+
tool_use_id: '',
|
|
103
|
+
content: `LSP error: ${err.message}`,
|
|
104
|
+
is_error: true,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Get the symbol at a given position in a file.
|
|
111
|
+
*/
|
|
112
|
+
async function getSymbolAtPosition(filePath, line, character, cwd) {
|
|
113
|
+
try {
|
|
114
|
+
const { readFile } = await import('fs/promises');
|
|
115
|
+
const { resolve } = await import('path');
|
|
116
|
+
const content = await readFile(resolve(cwd, filePath), 'utf-8');
|
|
117
|
+
const lines = content.split('\n');
|
|
118
|
+
if (line >= lines.length)
|
|
119
|
+
return null;
|
|
120
|
+
const lineText = lines[line];
|
|
121
|
+
if (!lineText || character >= lineText.length)
|
|
122
|
+
return null;
|
|
123
|
+
// Extract word at position
|
|
124
|
+
const wordMatch = /\b\w+\b/g;
|
|
125
|
+
let match;
|
|
126
|
+
while ((match = wordMatch.exec(lineText)) !== null) {
|
|
127
|
+
if (match.index <= character && match.index + match[0].length >= character) {
|
|
128
|
+
return match[0];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=lsp-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-tool.js","sourceRoot":"","sources":["../../src/tools/lsp-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,CAAC,MAAM,OAAO,GAAmB;IACrC,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,kIAAkI;IAC/I,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE;oBACJ,gBAAgB;oBAChB,gBAAgB;oBAChB,OAAO;oBACP,gBAAgB;oBAChB,iBAAiB;oBACjB,oBAAoB;oBACpB,sBAAsB;oBACtB,eAAe;oBACf,eAAe;iBAChB;gBACD,WAAW,EAAE,0BAA0B;aACxC;YACD,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;YACzE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE;YAC9D,SAAS,EAAE,EAAE,IAA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AC,CAAA;YACjB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resource Tools
|
|
3
|
+
*
|
|
4
|
+
* ListMcpResources / ReadMcpResource - Access resources from MCP servers.
|
|
5
|
+
*/
|
|
6
|
+
import type { ToolDefinition } from '../types.js';
|
|
7
|
+
import type { MCPConnection } from '../mcp/client.js';
|
|
8
|
+
/**
|
|
9
|
+
* Set MCP connections for resource access.
|
|
10
|
+
*/
|
|
11
|
+
export declare function setMcpConnections(connections: MCPConnection[]): void;
|
|
12
|
+
export declare const ListMcpResourcesTool: ToolDefinition;
|
|
13
|
+
export declare const ReadMcpResourceTool: ToolDefinition;
|
|
14
|
+
//# sourceMappingURL=mcp-resource-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-resource-tools.d.ts","sourceRoot":"","sources":["../../src/tools/mcp-resource-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,aAAa,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAKrD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,aAAa,EAAE,GAAG,IAAI,CAEpE;AAED,eAAO,MAAM,oBAAoB,EAAE,cAqDlC,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,cAkDjC,CAAA"}
|