@uluops/core 0.5.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/README.md +543 -0
- package/definitions/starter/code-validator.agent.yaml +134 -0
- package/definitions/starter/docs-validator.agent.yaml +142 -0
- package/definitions/starter/public-interface-validator.agent.yaml +138 -0
- package/definitions/starter/security-analyst.agent.yaml +144 -0
- package/definitions/starter/test-architect.agent.yaml +137 -0
- package/dist/ai/AIProvider.d.ts +198 -0
- package/dist/ai/AIProvider.d.ts.map +1 -0
- package/dist/ai/AIProvider.js +557 -0
- package/dist/ai/AIProvider.js.map +1 -0
- package/dist/ai/ModelCatalog.d.ts +78 -0
- package/dist/ai/ModelCatalog.d.ts.map +1 -0
- package/dist/ai/ModelCatalog.js +193 -0
- package/dist/ai/ModelCatalog.js.map +1 -0
- package/dist/ai/ShellExecutor.d.ts +42 -0
- package/dist/ai/ShellExecutor.d.ts.map +1 -0
- package/dist/ai/ShellExecutor.js +62 -0
- package/dist/ai/ShellExecutor.js.map +1 -0
- package/dist/ai/TokenBudgetTracker.d.ts +49 -0
- package/dist/ai/TokenBudgetTracker.d.ts.map +1 -0
- package/dist/ai/TokenBudgetTracker.js +61 -0
- package/dist/ai/TokenBudgetTracker.js.map +1 -0
- package/dist/ai/ToolAdapter.d.ts +25 -0
- package/dist/ai/ToolAdapter.d.ts.map +1 -0
- package/dist/ai/ToolAdapter.js +135 -0
- package/dist/ai/ToolAdapter.js.map +1 -0
- package/dist/ai/index.d.ts +6 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +4 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/client/UluOpsClient.d.ts +111 -0
- package/dist/client/UluOpsClient.d.ts.map +1 -0
- package/dist/client/UluOpsClient.js +329 -0
- package/dist/client/UluOpsClient.js.map +1 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +9 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors/UluOpsError.d.ts +10 -0
- package/dist/errors/UluOpsError.d.ts.map +1 -0
- package/dist/errors/UluOpsError.js +13 -0
- package/dist/errors/UluOpsError.js.map +1 -0
- package/dist/errors/index.d.ts +64 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +93 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/executor/AgentExecutor.d.ts +57 -0
- package/dist/executor/AgentExecutor.d.ts.map +1 -0
- package/dist/executor/AgentExecutor.js +331 -0
- package/dist/executor/AgentExecutor.js.map +1 -0
- package/dist/executor/CommandExecutor.d.ts +33 -0
- package/dist/executor/CommandExecutor.d.ts.map +1 -0
- package/dist/executor/CommandExecutor.js +183 -0
- package/dist/executor/CommandExecutor.js.map +1 -0
- package/dist/executor/PipelineExecutor.d.ts +55 -0
- package/dist/executor/PipelineExecutor.d.ts.map +1 -0
- package/dist/executor/PipelineExecutor.js +273 -0
- package/dist/executor/PipelineExecutor.js.map +1 -0
- package/dist/executor/ToolHandler.d.ts +47 -0
- package/dist/executor/ToolHandler.d.ts.map +1 -0
- package/dist/executor/ToolHandler.js +615 -0
- package/dist/executor/ToolHandler.js.map +1 -0
- package/dist/executor/WorkflowExecutor.d.ts +55 -0
- package/dist/executor/WorkflowExecutor.d.ts.map +1 -0
- package/dist/executor/WorkflowExecutor.js +368 -0
- package/dist/executor/WorkflowExecutor.js.map +1 -0
- package/dist/executor/preflight.d.ts +8 -0
- package/dist/executor/preflight.d.ts.map +1 -0
- package/dist/executor/preflight.js +102 -0
- package/dist/executor/preflight.js.map +1 -0
- package/dist/executor/symbols.d.ts +13 -0
- package/dist/executor/symbols.d.ts.map +1 -0
- package/dist/executor/symbols.js +102 -0
- package/dist/executor/symbols.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/OutputExtractor.d.ts +52 -0
- package/dist/parser/OutputExtractor.d.ts.map +1 -0
- package/dist/parser/OutputExtractor.js +818 -0
- package/dist/parser/OutputExtractor.js.map +1 -0
- package/dist/parser/outputSchemas.d.ts +223 -0
- package/dist/parser/outputSchemas.d.ts.map +1 -0
- package/dist/parser/outputSchemas.js +73 -0
- package/dist/parser/outputSchemas.js.map +1 -0
- package/dist/registry/RegistryClient.d.ts +75 -0
- package/dist/registry/RegistryClient.d.ts.map +1 -0
- package/dist/registry/RegistryClient.js +419 -0
- package/dist/registry/RegistryClient.js.map +1 -0
- package/dist/registry/index.d.ts +2 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +2 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/types/agent.d.ts +406 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +2 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/ai.d.ts +14 -0
- package/dist/types/ai.d.ts.map +1 -0
- package/dist/types/ai.js +2 -0
- package/dist/types/ai.js.map +1 -0
- package/dist/types/command.d.ts +153 -0
- package/dist/types/command.d.ts.map +1 -0
- package/dist/types/command.js +2 -0
- package/dist/types/command.js.map +1 -0
- package/dist/types/config.d.ts +136 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/execution.d.ts +172 -0
- package/dist/types/execution.d.ts.map +1 -0
- package/dist/types/execution.js +2 -0
- package/dist/types/execution.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/parser.d.ts +75 -0
- package/dist/types/parser.d.ts.map +1 -0
- package/dist/types/parser.js +2 -0
- package/dist/types/parser.js.map +1 -0
- package/dist/types/pipeline.d.ts +155 -0
- package/dist/types/pipeline.d.ts.map +1 -0
- package/dist/types/pipeline.js +2 -0
- package/dist/types/pipeline.js.map +1 -0
- package/dist/types/registry.d.ts +232 -0
- package/dist/types/registry.d.ts.map +1 -0
- package/dist/types/registry.js +2 -0
- package/dist/types/registry.js.map +1 -0
- package/dist/types/tools.d.ts +29 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +2 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/validation.d.ts +237 -0
- package/dist/types/validation.d.ts.map +1 -0
- package/dist/types/validation.js +2 -0
- package/dist/types/validation.js.map +1 -0
- package/dist/types/workflow.d.ts +131 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/types/workflow.js +2 -0
- package/dist/types/workflow.js.map +1 -0
- package/dist/utils/formatError.d.ts +6 -0
- package/dist/utils/formatError.d.ts.map +1 -0
- package/dist/utils/formatError.js +10 -0
- package/dist/utils/formatError.js.map +1 -0
- package/dist/utils/parseRef.d.ts +11 -0
- package/dist/utils/parseRef.d.ts.map +1 -0
- package/dist/utils/parseRef.js +16 -0
- package/dist/utils/parseRef.js.map +1 -0
- package/dist/utils/sumTokenMetrics.d.ts +9 -0
- package/dist/utils/sumTokenMetrics.d.ts.map +1 -0
- package/dist/utils/sumTokenMetrics.js +20 -0
- package/dist/utils/sumTokenMetrics.js.map +1 -0
- package/dist/utils/topoSort.d.ts +24 -0
- package/dist/utils/topoSort.d.ts.map +1 -0
- package/dist/utils/topoSort.js +60 -0
- package/dist/utils/topoSort.js.map +1 -0
- package/dist/validation/ValidationClient.d.ts +51 -0
- package/dist/validation/ValidationClient.d.ts.map +1 -0
- package/dist/validation/ValidationClient.js +179 -0
- package/dist/validation/ValidationClient.js.map +1 -0
- package/dist/validation/index.d.ts +2 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +2 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { glob } from 'glob';
|
|
4
|
+
import { formatErrorMessage } from '../utils/formatError.js';
|
|
5
|
+
import { extractSymbols } from './symbols.js';
|
|
6
|
+
/** No-op logger for when none is provided */
|
|
7
|
+
const noopLogger = { debug() { }, info() { }, warn() { }, error() { } };
|
|
8
|
+
/** Max file size to read (1 MB). Matches Claude Code's file read limit; keeps tool results within token budget. */
|
|
9
|
+
const MAX_FILE_SIZE = 1_048_576;
|
|
10
|
+
/** Max file size for line counting (100 KB). Lower than MAX_FILE_SIZE because line splitting is memory-intensive. */
|
|
11
|
+
const MAX_LINE_COUNT_SIZE = 102_400;
|
|
12
|
+
/** Timeout for glob operations (30s). Prevents hangs on large or network-mounted filesystems. */
|
|
13
|
+
const GLOB_TIMEOUT_MS = 30_000;
|
|
14
|
+
/** Default max results for list_files. Balances completeness vs token cost in a single tool response. */
|
|
15
|
+
const DEFAULT_LIST_MAX_RESULTS = 200;
|
|
16
|
+
/** Max directory entries per level in get_directory_tree. Prevents enormous trees from flooding the context window. */
|
|
17
|
+
const MAX_DIR_ENTRIES = 50;
|
|
18
|
+
/**
|
|
19
|
+
* Handles filesystem tool calls, fulfilling them against the local target directory.
|
|
20
|
+
* All paths are sandboxed to the base path to prevent directory traversal.
|
|
21
|
+
*/
|
|
22
|
+
export class ToolHandler {
|
|
23
|
+
basePath;
|
|
24
|
+
logger;
|
|
25
|
+
constructor(basePath, logger) {
|
|
26
|
+
this.basePath = path.resolve(basePath);
|
|
27
|
+
this.logger = logger ?? noopLogger;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get tool definitions for LLM API.
|
|
31
|
+
*/
|
|
32
|
+
getTools() {
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
name: 'read_file',
|
|
36
|
+
description: 'Read the contents of a file. Use start_line/end_line for large files to avoid reading the entire file.',
|
|
37
|
+
input_schema: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
path: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'File path relative to target directory',
|
|
43
|
+
},
|
|
44
|
+
start_line: {
|
|
45
|
+
type: 'integer',
|
|
46
|
+
description: 'First line to read (1-based). Default: 1',
|
|
47
|
+
},
|
|
48
|
+
end_line: {
|
|
49
|
+
type: 'integer',
|
|
50
|
+
description: 'Last line to read (1-based). Default: end of file',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
required: ['path'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'list_files',
|
|
58
|
+
description: 'List files in a directory with size/line metadata. Supports glob patterns. Results are capped at max_results.',
|
|
59
|
+
input_schema: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
path: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
description: 'Directory path relative to target',
|
|
65
|
+
},
|
|
66
|
+
pattern: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
description: 'Glob pattern (e.g., "**/*.ts"). Defaults to "*"',
|
|
69
|
+
},
|
|
70
|
+
max_results: {
|
|
71
|
+
type: 'integer',
|
|
72
|
+
description: `Maximum files to return. Default: ${DEFAULT_LIST_MAX_RESULTS}`,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
required: ['path'],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'search_content',
|
|
80
|
+
description: 'Search for a pattern across files. Supports regex. Use mode to control output verbosity.',
|
|
81
|
+
input_schema: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
pattern: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
description: 'Search pattern (supports regex)',
|
|
87
|
+
},
|
|
88
|
+
file_pattern: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
description: 'Glob pattern for files to search (e.g., "**/*.ts")',
|
|
91
|
+
},
|
|
92
|
+
max_results: {
|
|
93
|
+
type: 'integer',
|
|
94
|
+
description: 'Maximum matches to return. Default: 50',
|
|
95
|
+
},
|
|
96
|
+
mode: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
description: 'Output mode: "matches" (default, matching lines), "files" (file paths only), "count" (per-file match counts)',
|
|
99
|
+
},
|
|
100
|
+
context_lines: {
|
|
101
|
+
type: 'integer',
|
|
102
|
+
description: 'Lines of context before/after each match (0-5). Default: 0',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
required: ['pattern'],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'get_file_info',
|
|
110
|
+
description: 'Get file metadata (size, line count, language) without reading content. Use before read_file to decide what to read.',
|
|
111
|
+
input_schema: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
properties: {
|
|
114
|
+
path: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
description: 'File path relative to target directory',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
required: ['path'],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'get_directory_tree',
|
|
124
|
+
description: 'Get a hierarchical view of a directory with file counts and sizes. More structured than list_files.',
|
|
125
|
+
input_schema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
path: {
|
|
129
|
+
type: 'string',
|
|
130
|
+
description: 'Directory path relative to target',
|
|
131
|
+
},
|
|
132
|
+
max_depth: {
|
|
133
|
+
type: 'integer',
|
|
134
|
+
description: 'Maximum depth to traverse. Default: 3',
|
|
135
|
+
},
|
|
136
|
+
include_sizes: {
|
|
137
|
+
type: 'boolean',
|
|
138
|
+
description: 'Include file sizes. Default: true',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
required: ['path'],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'get_symbols',
|
|
146
|
+
description: 'Extract exported symbols (functions, classes, interfaces, types, constants) from a source file with line numbers.',
|
|
147
|
+
input_schema: {
|
|
148
|
+
type: 'object',
|
|
149
|
+
properties: {
|
|
150
|
+
path: {
|
|
151
|
+
type: 'string',
|
|
152
|
+
description: 'File path relative to target directory',
|
|
153
|
+
},
|
|
154
|
+
include_private: {
|
|
155
|
+
type: 'boolean',
|
|
156
|
+
description: 'Include non-exported symbols. Default: false',
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
required: ['path'],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Fulfill a tool call from the LLM.
|
|
166
|
+
* Dispatches to read_file, list_files, or search_content handlers.
|
|
167
|
+
* All paths are sandboxed to the base path.
|
|
168
|
+
*
|
|
169
|
+
* @param toolUse - Tool use block from the LLM response
|
|
170
|
+
* @returns Tool result with content or error
|
|
171
|
+
*/
|
|
172
|
+
async fulfill(toolUse) {
|
|
173
|
+
this.logger.debug(`Tool: ${toolUse.name}(${JSON.stringify(toolUse.input).substring(0, 200)})`);
|
|
174
|
+
try {
|
|
175
|
+
const relativePath = String(toolUse.input['path'] || '.');
|
|
176
|
+
const fullPath = path.resolve(this.basePath, relativePath);
|
|
177
|
+
if (!(await this.isPathSafe(fullPath))) {
|
|
178
|
+
return {
|
|
179
|
+
tool_use_id: toolUse.id,
|
|
180
|
+
content: `Error: Path "${relativePath}" is outside the target directory`,
|
|
181
|
+
is_error: true,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
const input = toolUse.input;
|
|
185
|
+
switch (toolUse.name) {
|
|
186
|
+
case 'read_file':
|
|
187
|
+
return await this.readFile(toolUse.id, fullPath, {
|
|
188
|
+
startLine: toNumber(input['start_line']),
|
|
189
|
+
endLine: toNumber(input['end_line']),
|
|
190
|
+
});
|
|
191
|
+
case 'list_files':
|
|
192
|
+
return await this.listFiles(toolUse.id, fullPath, {
|
|
193
|
+
pattern: toString(input['pattern']),
|
|
194
|
+
maxResults: toNumber(input['max_results']) ?? DEFAULT_LIST_MAX_RESULTS,
|
|
195
|
+
});
|
|
196
|
+
case 'search_content': {
|
|
197
|
+
const modeRaw = toString(input['mode']);
|
|
198
|
+
const mode = modeRaw === 'files' || modeRaw === 'count' ? modeRaw : 'matches';
|
|
199
|
+
return await this.searchContent(toolUse.id, {
|
|
200
|
+
pattern: toString(input['pattern']) ?? '',
|
|
201
|
+
filePattern: toString(input['file_pattern']),
|
|
202
|
+
maxResults: toNumber(input['max_results']) ?? 50,
|
|
203
|
+
mode,
|
|
204
|
+
contextLines: Math.min(toNumber(input['context_lines']) ?? 0, 5),
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
case 'get_file_info':
|
|
208
|
+
return await this.getFileInfo(toolUse.id, fullPath, relativePath);
|
|
209
|
+
case 'get_directory_tree':
|
|
210
|
+
return await this.getDirectoryTree(toolUse.id, fullPath, {
|
|
211
|
+
maxDepth: toNumber(input['max_depth']) ?? 3,
|
|
212
|
+
includeSizes: input['include_sizes'] !== false,
|
|
213
|
+
});
|
|
214
|
+
case 'get_symbols':
|
|
215
|
+
return await this.getSymbols(toolUse.id, fullPath, {
|
|
216
|
+
includePrivate: input['include_private'] === true,
|
|
217
|
+
});
|
|
218
|
+
default:
|
|
219
|
+
return {
|
|
220
|
+
tool_use_id: toolUse.id,
|
|
221
|
+
content: `Unknown tool: ${toolUse.name}`,
|
|
222
|
+
is_error: true,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
return {
|
|
228
|
+
tool_use_id: toolUse.id,
|
|
229
|
+
content: `Error: ${formatErrorMessage(error)}`,
|
|
230
|
+
is_error: true,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Check if resolved path is within base path (security).
|
|
236
|
+
* Uses fs.realpath() to follow symlinks and detect escape attempts.
|
|
237
|
+
*/
|
|
238
|
+
async isPathSafe(fullPath) {
|
|
239
|
+
// First check: logical path must be within base (catches ../.. traversal)
|
|
240
|
+
const logicalPath = path.resolve(fullPath);
|
|
241
|
+
if (!logicalPath.startsWith(this.basePath))
|
|
242
|
+
return false;
|
|
243
|
+
// Second check: resolve symlinks to detect escape via symlink
|
|
244
|
+
try {
|
|
245
|
+
const realPath = await fs.realpath(fullPath);
|
|
246
|
+
return realPath.startsWith(this.basePath);
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
// Path doesn't exist — logical check above is sufficient
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
async readFile(id, filePath, opts) {
|
|
254
|
+
const stat = await fs.stat(filePath);
|
|
255
|
+
const relativePath = path.relative(this.basePath, filePath);
|
|
256
|
+
// Line-range mode: read specific lines
|
|
257
|
+
if (opts.startLine !== undefined || opts.endLine !== undefined) {
|
|
258
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
259
|
+
const allLines = content.split('\n');
|
|
260
|
+
const totalLines = allLines.length;
|
|
261
|
+
const start = Math.max(1, opts.startLine ?? 1);
|
|
262
|
+
const end = Math.min(totalLines, opts.endLine ?? totalLines);
|
|
263
|
+
const slice = allLines.slice(start - 1, end);
|
|
264
|
+
const numbered = slice.map((line, i) => `${start + i}\t${line}`).join('\n');
|
|
265
|
+
const header = `[Lines ${start}-${end} of ${totalLines}] ${relativePath}\n`;
|
|
266
|
+
this.logger.debug(`read_file: ${relativePath} lines ${start}-${end} of ${totalLines}`);
|
|
267
|
+
return { tool_use_id: id, content: header + numbered };
|
|
268
|
+
}
|
|
269
|
+
// Full-file mode (original behavior)
|
|
270
|
+
const truncated = stat.size > MAX_FILE_SIZE;
|
|
271
|
+
const buffer = Buffer.alloc(Math.min(stat.size, MAX_FILE_SIZE));
|
|
272
|
+
const fh = await fs.open(filePath, 'r');
|
|
273
|
+
try {
|
|
274
|
+
await fh.read(buffer, 0, buffer.length, 0);
|
|
275
|
+
}
|
|
276
|
+
finally {
|
|
277
|
+
await fh.close();
|
|
278
|
+
}
|
|
279
|
+
let content = buffer.toString('utf-8');
|
|
280
|
+
if (truncated) {
|
|
281
|
+
content += `\n\n[Truncated: file is ${stat.size} bytes, showing first ${MAX_FILE_SIZE} bytes]`;
|
|
282
|
+
}
|
|
283
|
+
this.logger.debug(`read_file: ${relativePath} (${stat.size} bytes${truncated ? ', truncated' : ''})`);
|
|
284
|
+
return { tool_use_id: id, content };
|
|
285
|
+
}
|
|
286
|
+
async listFiles(id, dirPath, opts) {
|
|
287
|
+
const files = await glob(opts.pattern ?? '*', {
|
|
288
|
+
cwd: dirPath,
|
|
289
|
+
nodir: true,
|
|
290
|
+
ignore: ['**/node_modules/**', '**/.git/**', '**/dist/**', '**/build/**'],
|
|
291
|
+
signal: AbortSignal.timeout(GLOB_TIMEOUT_MS),
|
|
292
|
+
});
|
|
293
|
+
const totalFiles = files.length;
|
|
294
|
+
const capped = files.slice(0, opts.maxResults);
|
|
295
|
+
const lines = [];
|
|
296
|
+
for (const file of capped) {
|
|
297
|
+
const filePath = path.join(dirPath, file);
|
|
298
|
+
try {
|
|
299
|
+
const stat = await fs.stat(filePath);
|
|
300
|
+
const sizeStr = formatFileSize(stat.size);
|
|
301
|
+
const lineCount = await countLines(filePath, stat.size);
|
|
302
|
+
lines.push(lineCount
|
|
303
|
+
? `${file} (${sizeStr}, ${lineCount} lines)`
|
|
304
|
+
: `${file} (${sizeStr})`);
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
lines.push(file);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (totalFiles > opts.maxResults) {
|
|
311
|
+
lines.push(`\n... and ${totalFiles - opts.maxResults} more files`);
|
|
312
|
+
}
|
|
313
|
+
this.logger.debug(`list_files: ${totalFiles} files in ${path.relative(this.basePath, dirPath) || '.'} (showing ${capped.length})`);
|
|
314
|
+
return { tool_use_id: id, content: lines.join('\n') };
|
|
315
|
+
}
|
|
316
|
+
async searchContent(id, opts) {
|
|
317
|
+
const files = await glob(opts.filePattern ?? '**/*', {
|
|
318
|
+
cwd: this.basePath,
|
|
319
|
+
nodir: true,
|
|
320
|
+
ignore: ['**/node_modules/**', '**/.git/**'],
|
|
321
|
+
signal: AbortSignal.timeout(GLOB_TIMEOUT_MS),
|
|
322
|
+
});
|
|
323
|
+
let regex;
|
|
324
|
+
try {
|
|
325
|
+
regex = new RegExp(opts.pattern, 'gi');
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
return { tool_use_id: id, content: `Error: invalid regex pattern: ${opts.pattern}` };
|
|
329
|
+
}
|
|
330
|
+
switch (opts.mode) {
|
|
331
|
+
case 'files': {
|
|
332
|
+
const matching = await this.searchFileMode(files, regex, opts.maxResults);
|
|
333
|
+
this.logger.debug(`search_content(files): ${matching.length} files match "${opts.pattern}"`);
|
|
334
|
+
return { tool_use_id: id, content: matching.join('\n') };
|
|
335
|
+
}
|
|
336
|
+
case 'count': {
|
|
337
|
+
const counts = await this.searchCountMode(files, regex, opts.maxResults);
|
|
338
|
+
this.logger.debug(`search_content(count): ${counts.length} files match "${opts.pattern}"`);
|
|
339
|
+
return { tool_use_id: id, content: JSON.stringify(counts, null, 2) };
|
|
340
|
+
}
|
|
341
|
+
default: {
|
|
342
|
+
const results = await this.searchMatchesMode(files, regex, opts.maxResults, opts.contextLines);
|
|
343
|
+
this.logger.debug(`search_content: ${results.length} matches for "${opts.pattern}"`);
|
|
344
|
+
return { tool_use_id: id, content: JSON.stringify(results, null, 2) };
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
async searchFileMode(files, regex, maxResults) {
|
|
349
|
+
const matching = [];
|
|
350
|
+
for (const file of files) {
|
|
351
|
+
if (matching.length >= maxResults)
|
|
352
|
+
break;
|
|
353
|
+
try {
|
|
354
|
+
const filePath = path.join(this.basePath, file);
|
|
355
|
+
const stat = await fs.stat(filePath);
|
|
356
|
+
if (stat.size > MAX_FILE_SIZE)
|
|
357
|
+
continue;
|
|
358
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
359
|
+
if (regex.test(content))
|
|
360
|
+
matching.push(file);
|
|
361
|
+
regex.lastIndex = 0;
|
|
362
|
+
}
|
|
363
|
+
catch (error) {
|
|
364
|
+
this.logger.debug(`Skipped unreadable file: ${file} (${error instanceof Error ? error.message : 'unknown'})`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return matching;
|
|
368
|
+
}
|
|
369
|
+
async searchCountMode(files, regex, maxResults) {
|
|
370
|
+
const counts = [];
|
|
371
|
+
for (const file of files) {
|
|
372
|
+
if (counts.length >= maxResults)
|
|
373
|
+
break;
|
|
374
|
+
try {
|
|
375
|
+
const filePath = path.join(this.basePath, file);
|
|
376
|
+
const stat = await fs.stat(filePath);
|
|
377
|
+
if (stat.size > MAX_FILE_SIZE)
|
|
378
|
+
continue;
|
|
379
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
380
|
+
regex.lastIndex = 0; // Reset stateful 'g' flag
|
|
381
|
+
const matches = content.match(regex);
|
|
382
|
+
if (matches && matches.length > 0) {
|
|
383
|
+
counts.push({ file, count: matches.length });
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
catch (error) {
|
|
387
|
+
this.logger.debug(`Skipped unreadable file: ${file} (${error instanceof Error ? error.message : 'unknown'})`);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return counts;
|
|
391
|
+
}
|
|
392
|
+
async searchMatchesMode(files, regex, maxResults, contextLines) {
|
|
393
|
+
const results = [];
|
|
394
|
+
for (const file of files) {
|
|
395
|
+
if (results.length >= maxResults)
|
|
396
|
+
break;
|
|
397
|
+
try {
|
|
398
|
+
const filePath = path.join(this.basePath, file);
|
|
399
|
+
const stat = await fs.stat(filePath);
|
|
400
|
+
if (stat.size > MAX_FILE_SIZE) {
|
|
401
|
+
this.logger.debug(`Skipped oversized file: ${file} (${stat.size} bytes)`);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
405
|
+
const lines = content.split('\n');
|
|
406
|
+
for (let i = 0; i < lines.length; i++) {
|
|
407
|
+
const lineContent = lines[i];
|
|
408
|
+
if (lineContent !== undefined && regex.test(lineContent)) {
|
|
409
|
+
let matchContent = lineContent.trim();
|
|
410
|
+
if (contextLines > 0) {
|
|
411
|
+
const ctxStart = Math.max(0, i - contextLines);
|
|
412
|
+
const ctxEnd = Math.min(lines.length - 1, i + contextLines);
|
|
413
|
+
const ctxLines = lines.slice(ctxStart, ctxEnd + 1).map((l, idx) => `${ctxStart + idx + 1}\t${l}`);
|
|
414
|
+
matchContent = ctxLines.join('\n');
|
|
415
|
+
}
|
|
416
|
+
results.push({ file, line: i + 1, content: matchContent });
|
|
417
|
+
if (results.length >= maxResults)
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
regex.lastIndex = 0;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
catch (error) {
|
|
424
|
+
this.logger.debug(`Skipped unreadable file: ${file} (${error instanceof Error ? error.message : 'unknown'})`);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return results;
|
|
428
|
+
}
|
|
429
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
430
|
+
// Phase 2: Reconnaissance Tools
|
|
431
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
432
|
+
async getFileInfo(id, filePath, relativePath) {
|
|
433
|
+
const stat = await fs.stat(filePath);
|
|
434
|
+
const ext = path.extname(filePath);
|
|
435
|
+
const language = extToLanguage(ext);
|
|
436
|
+
const info = {
|
|
437
|
+
path: relativePath,
|
|
438
|
+
size: stat.size,
|
|
439
|
+
sizeFormatted: formatFileSize(stat.size),
|
|
440
|
+
language,
|
|
441
|
+
modified: stat.mtime.toISOString(),
|
|
442
|
+
};
|
|
443
|
+
const lineCount = await countLines(filePath, stat.size);
|
|
444
|
+
if (lineCount !== undefined)
|
|
445
|
+
info.lines = lineCount;
|
|
446
|
+
this.logger.debug(`get_file_info: ${relativePath} (${info.sizeFormatted})`);
|
|
447
|
+
return { tool_use_id: id, content: JSON.stringify(info, null, 2) };
|
|
448
|
+
}
|
|
449
|
+
async getDirectoryTree(id, dirPath, opts) {
|
|
450
|
+
const { lines } = await this.buildTree(dirPath, '', 0, opts.maxDepth, opts.includeSizes);
|
|
451
|
+
const relativePath = path.relative(this.basePath, dirPath) || '.';
|
|
452
|
+
this.logger.debug(`get_directory_tree: ${relativePath} (${lines.length} entries)`);
|
|
453
|
+
return { tool_use_id: id, content: lines.join('\n') };
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Recursively build directory tree, returning lines and accumulated stats.
|
|
457
|
+
* Stats bubble up so parent directories can display file count + total size
|
|
458
|
+
* without a redundant recursive glob + stat pass.
|
|
459
|
+
*/
|
|
460
|
+
async buildTree(dirPath, indent, depth, maxDepth, includeSizes) {
|
|
461
|
+
const lines = [];
|
|
462
|
+
let fileCount = 0;
|
|
463
|
+
let totalSize = 0;
|
|
464
|
+
let entries;
|
|
465
|
+
try {
|
|
466
|
+
entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
467
|
+
}
|
|
468
|
+
catch {
|
|
469
|
+
return { lines, fileCount, totalSize };
|
|
470
|
+
}
|
|
471
|
+
// Filter out hidden/ignored directories
|
|
472
|
+
const filtered = entries.filter((e) => !String(e.name).startsWith('.') && String(e.name) !== 'node_modules' && String(e.name) !== 'dist' && String(e.name) !== 'build');
|
|
473
|
+
// Separate dirs and files, sort alphabetically
|
|
474
|
+
const dirs = filtered.filter((e) => e.isDirectory()).sort((a, b) => String(a.name).localeCompare(String(b.name)));
|
|
475
|
+
const files = filtered.filter((e) => e.isFile()).sort((a, b) => String(a.name).localeCompare(String(b.name)));
|
|
476
|
+
// Directories first
|
|
477
|
+
for (const dir of dirs) {
|
|
478
|
+
const dirName = String(dir.name);
|
|
479
|
+
const fullDirPath = path.join(dirPath, dirName);
|
|
480
|
+
if (depth < maxDepth) {
|
|
481
|
+
// Recurse first to get accumulated stats
|
|
482
|
+
const sub = await this.buildTree(fullDirPath, indent + ' ', depth + 1, maxDepth, includeSizes);
|
|
483
|
+
// Build directory header from accumulated stats (no redundant glob)
|
|
484
|
+
let suffix = `${sub.fileCount} files`;
|
|
485
|
+
if (includeSizes)
|
|
486
|
+
suffix += `, ${formatFileSize(sub.totalSize)}`;
|
|
487
|
+
lines.push(`${indent}${dirName}/ (${suffix})`);
|
|
488
|
+
lines.push(...sub.lines);
|
|
489
|
+
// Bubble up stats
|
|
490
|
+
fileCount += sub.fileCount;
|
|
491
|
+
totalSize += sub.totalSize;
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
lines.push(`${indent}${dirName}/`);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
// Files (capped)
|
|
498
|
+
const shownFiles = files.slice(0, MAX_DIR_ENTRIES);
|
|
499
|
+
for (const file of shownFiles) {
|
|
500
|
+
const { line, size } = await this.formatFileEntry(dirPath, String(file.name), indent, includeSizes);
|
|
501
|
+
lines.push(line);
|
|
502
|
+
fileCount++;
|
|
503
|
+
totalSize += size;
|
|
504
|
+
}
|
|
505
|
+
// Count files beyond the display cap (still accumulate stats)
|
|
506
|
+
if (files.length > MAX_DIR_ENTRIES) {
|
|
507
|
+
lines.push(`${indent}... and ${files.length - MAX_DIR_ENTRIES} more files`);
|
|
508
|
+
// Stat the remaining files for accurate parent totals
|
|
509
|
+
for (const file of files.slice(MAX_DIR_ENTRIES)) {
|
|
510
|
+
fileCount++;
|
|
511
|
+
if (includeSizes) {
|
|
512
|
+
try {
|
|
513
|
+
const stat = await fs.stat(path.join(dirPath, String(file.name)));
|
|
514
|
+
totalSize += stat.size;
|
|
515
|
+
}
|
|
516
|
+
catch {
|
|
517
|
+
// skip
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
return { lines, fileCount, totalSize };
|
|
523
|
+
}
|
|
524
|
+
async formatFileEntry(dirPath, fileName, indent, includeSizes) {
|
|
525
|
+
if (!includeSizes)
|
|
526
|
+
return { line: `${indent}${fileName}`, size: 0 };
|
|
527
|
+
try {
|
|
528
|
+
const filePath = path.join(dirPath, fileName);
|
|
529
|
+
const stat = await fs.stat(filePath);
|
|
530
|
+
const sizeStr = formatFileSize(stat.size);
|
|
531
|
+
const lc = await countLines(filePath, stat.size);
|
|
532
|
+
return lc
|
|
533
|
+
? { line: `${indent}${fileName} (${lc} lines, ${sizeStr})`, size: stat.size }
|
|
534
|
+
: { line: `${indent}${fileName} (${sizeStr})`, size: stat.size };
|
|
535
|
+
}
|
|
536
|
+
catch {
|
|
537
|
+
return { line: `${indent}${fileName}`, size: 0 };
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
541
|
+
// Phase 3: Symbol Extraction
|
|
542
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
543
|
+
async getSymbols(id, filePath, opts) {
|
|
544
|
+
const stat = await fs.stat(filePath);
|
|
545
|
+
if (stat.size > MAX_FILE_SIZE) {
|
|
546
|
+
return { tool_use_id: id, content: 'Error: File too large for symbol extraction', is_error: true };
|
|
547
|
+
}
|
|
548
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
549
|
+
const lines = content.split('\n');
|
|
550
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
551
|
+
const symbols = extractSymbols(lines, ext, opts.includePrivate);
|
|
552
|
+
const relativePath = path.relative(this.basePath, filePath);
|
|
553
|
+
this.logger.debug(`get_symbols: ${relativePath} (${symbols.length} symbols)`);
|
|
554
|
+
return { tool_use_id: id, content: JSON.stringify(symbols, null, 2) };
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
558
|
+
// Utility Functions
|
|
559
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
560
|
+
function formatFileSize(bytes) {
|
|
561
|
+
if (bytes < 1024)
|
|
562
|
+
return `${bytes} B`;
|
|
563
|
+
if (bytes < 1024 * 1024)
|
|
564
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
565
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
566
|
+
}
|
|
567
|
+
const LANG_MAP = {
|
|
568
|
+
'.ts': 'TypeScript',
|
|
569
|
+
'.tsx': 'TypeScript/React',
|
|
570
|
+
'.js': 'JavaScript',
|
|
571
|
+
'.jsx': 'JavaScript/React',
|
|
572
|
+
'.mjs': 'JavaScript',
|
|
573
|
+
'.cjs': 'JavaScript',
|
|
574
|
+
'.py': 'Python',
|
|
575
|
+
'.go': 'Go',
|
|
576
|
+
'.rs': 'Rust',
|
|
577
|
+
'.java': 'Java',
|
|
578
|
+
'.rb': 'Ruby',
|
|
579
|
+
'.php': 'PHP',
|
|
580
|
+
'.cs': 'C#',
|
|
581
|
+
'.cpp': 'C++',
|
|
582
|
+
'.c': 'C',
|
|
583
|
+
'.swift': 'Swift',
|
|
584
|
+
'.kt': 'Kotlin',
|
|
585
|
+
'.json': 'JSON',
|
|
586
|
+
'.yaml': 'YAML',
|
|
587
|
+
'.yml': 'YAML',
|
|
588
|
+
'.md': 'Markdown',
|
|
589
|
+
'.css': 'CSS',
|
|
590
|
+
'.scss': 'SCSS',
|
|
591
|
+
'.html': 'HTML',
|
|
592
|
+
'.sql': 'SQL',
|
|
593
|
+
'.sh': 'Shell',
|
|
594
|
+
'.bash': 'Shell',
|
|
595
|
+
};
|
|
596
|
+
/** Narrow unknown to number (runtime typeof check instead of `as` cast). */
|
|
597
|
+
function toNumber(v) {
|
|
598
|
+
return typeof v === 'number' ? v : undefined;
|
|
599
|
+
}
|
|
600
|
+
/** Narrow unknown to string (runtime typeof check instead of `as` cast). */
|
|
601
|
+
function toString(v) {
|
|
602
|
+
return typeof v === 'string' ? v : undefined;
|
|
603
|
+
}
|
|
604
|
+
export function extToLanguage(ext) {
|
|
605
|
+
return LANG_MAP[ext.toLowerCase()] ?? 'Unknown';
|
|
606
|
+
}
|
|
607
|
+
/** Count lines in a file if under MAX_LINE_COUNT_SIZE, otherwise return undefined. */
|
|
608
|
+
async function countLines(filePath, size) {
|
|
609
|
+
if (size > MAX_LINE_COUNT_SIZE)
|
|
610
|
+
return undefined;
|
|
611
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
612
|
+
return content.split('\n').length;
|
|
613
|
+
}
|
|
614
|
+
// Symbol extraction moved to ./symbols.ts
|
|
615
|
+
//# sourceMappingURL=ToolHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolHandler.js","sourceRoot":"","sources":["../../src/executor/ToolHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,6CAA6C;AAC7C,MAAM,UAAU,GAAW,EAAE,KAAK,KAAI,CAAC,EAAE,IAAI,KAAI,CAAC,EAAE,IAAI,KAAI,CAAC,EAAE,KAAK,KAAI,CAAC,EAAE,CAAC;AAE5E,mHAAmH;AACnH,MAAM,aAAa,GAAG,SAAS,CAAC;AAEhC,qHAAqH;AACrH,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAEpC,iGAAiG;AACjG,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,yGAAyG;AACzG,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAErC,uHAAuH;AACvH,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B;;;GAGG;AACH,MAAM,OAAO,WAAW;IACd,QAAQ,CAAS;IACjB,MAAM,CAAS;IAEvB,YAAY,QAAgB,EAAE,MAAe;QAC3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,UAAU,CAAC;IACrC,CAAC;IAED;;OAEG;IACH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