bernard-agent 0.6.2 → 0.7.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 +23 -3
- package/dist/agent.js +32 -10
- package/dist/agent.js.map +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/config.js +19 -9
- package/dist/config.js.map +1 -1
- package/dist/repl.js +123 -90
- package/dist/repl.js.map +1 -1
- package/dist/specialists.d.ts +7 -3
- package/dist/specialists.js +28 -3
- package/dist/specialists.js.map +1 -1
- package/dist/tools/file.d.ts +154 -0
- package/dist/tools/file.js +396 -0
- package/dist/tools/file.js.map +1 -0
- package/dist/tools/index.d.ts +3 -1
- package/dist/tools/index.js +5 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/shell.js +1 -1
- package/dist/tools/shell.js.map +1 -1
- package/dist/tools/specialist-run.d.ts +9 -1
- package/dist/tools/specialist-run.js +23 -2
- package/dist/tools/specialist-run.js.map +1 -1
- package/dist/tools/specialist.d.ts +10 -1
- package/dist/tools/specialist.js +57 -6
- package/dist/tools/specialist.js.map +1 -1
- package/dist/tools/subagent.d.ts +9 -1
- package/dist/tools/subagent.js +20 -2
- package/dist/tools/subagent.js.map +1 -1
- package/dist/tools/task.d.ts +52 -13
- package/dist/tools/task.js +96 -30
- package/dist/tools/task.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.hashContent = hashContent;
|
|
37
|
+
exports.isBinaryContent = isBinaryContent;
|
|
38
|
+
exports.sortEditsDescending = sortEditsDescending;
|
|
39
|
+
exports.detectConflicts = detectConflicts;
|
|
40
|
+
exports.generateDiffSummary = generateDiffSummary;
|
|
41
|
+
exports.createFileTools = createFileTools;
|
|
42
|
+
const ai_1 = require("ai");
|
|
43
|
+
const zod_1 = require("zod");
|
|
44
|
+
const fs = __importStar(require("node:fs"));
|
|
45
|
+
const path = __importStar(require("node:path"));
|
|
46
|
+
const node_crypto_1 = require("node:crypto");
|
|
47
|
+
const MAX_FILE_SIZE = 50 * 1024 * 1024; // 50MB
|
|
48
|
+
/** SHA-256 of content, first 16 hex chars. */
|
|
49
|
+
function hashContent(content) {
|
|
50
|
+
return (0, node_crypto_1.createHash)('sha256').update(content).digest('hex').slice(0, 16);
|
|
51
|
+
}
|
|
52
|
+
/** Check for null bytes in first 8KB — indicates binary file. */
|
|
53
|
+
function isBinaryContent(buffer) {
|
|
54
|
+
const len = Math.min(buffer.length, 8192);
|
|
55
|
+
for (let i = 0; i < len; i++) {
|
|
56
|
+
if (buffer[i] === 0)
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
/** Sort edits by affected line descending so high-line edits are applied first. */
|
|
62
|
+
function sortEditsDescending(edits) {
|
|
63
|
+
const normalized = edits.map((e) => {
|
|
64
|
+
let affectedLine;
|
|
65
|
+
switch (e.action) {
|
|
66
|
+
case 'replace':
|
|
67
|
+
affectedLine = e.line;
|
|
68
|
+
break;
|
|
69
|
+
case 'insert':
|
|
70
|
+
affectedLine = e.before;
|
|
71
|
+
break;
|
|
72
|
+
case 'delete':
|
|
73
|
+
affectedLine = Math.max(...(e.lines ?? [0]));
|
|
74
|
+
break;
|
|
75
|
+
case 'append':
|
|
76
|
+
affectedLine = Infinity;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
return { action: e.action, affectedLine, original: e };
|
|
80
|
+
});
|
|
81
|
+
return normalized.sort((a, b) => {
|
|
82
|
+
// Appends go last (applied after all positional edits), preserve original order among appends
|
|
83
|
+
if (a.action === 'append' && b.action === 'append')
|
|
84
|
+
return 0;
|
|
85
|
+
if (a.action === 'append' && b.action !== 'append')
|
|
86
|
+
return 1;
|
|
87
|
+
if (b.action === 'append' && a.action !== 'append')
|
|
88
|
+
return -1;
|
|
89
|
+
return b.affectedLine - a.affectedLine;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** Detect conflicting edits — same line targeted by multiple replace/delete operations. */
|
|
93
|
+
function detectConflicts(edits) {
|
|
94
|
+
const errors = [];
|
|
95
|
+
const targeted = new Map();
|
|
96
|
+
for (const e of edits) {
|
|
97
|
+
if (e.action === 'replace' && e.line !== undefined) {
|
|
98
|
+
const existing = targeted.get(e.line) ?? [];
|
|
99
|
+
existing.push('replace');
|
|
100
|
+
targeted.set(e.line, existing);
|
|
101
|
+
}
|
|
102
|
+
if (e.action === 'delete' && e.lines) {
|
|
103
|
+
for (const ln of e.lines) {
|
|
104
|
+
const existing = targeted.get(ln) ?? [];
|
|
105
|
+
existing.push('delete');
|
|
106
|
+
targeted.set(ln, existing);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
for (const [line, actions] of targeted) {
|
|
111
|
+
if (actions.length > 1) {
|
|
112
|
+
errors.push(`Line ${line} targeted by multiple operations: ${actions.join(', ')}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return errors;
|
|
116
|
+
}
|
|
117
|
+
/** Generate an LLM-friendly diff summary. */
|
|
118
|
+
function generateDiffSummary(oldLines, edits) {
|
|
119
|
+
const parts = [];
|
|
120
|
+
for (const e of edits) {
|
|
121
|
+
switch (e.action) {
|
|
122
|
+
case 'replace': {
|
|
123
|
+
const old = oldLines[e.line - 1] ?? '';
|
|
124
|
+
parts.push(`line ${e.line}: "${old}" → "${e.content}"`);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case 'insert': {
|
|
128
|
+
const count = (e.content ?? '').split('\n').length;
|
|
129
|
+
const position = e.before === 1 ? 'at beginning of file' : `after line ${e.before - 1}`;
|
|
130
|
+
parts.push(`${position}: inserted ${count} line${count === 1 ? '' : 's'}`);
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case 'delete': {
|
|
134
|
+
for (const ln of e.lines ?? []) {
|
|
135
|
+
parts.push(`line ${ln}: deleted`);
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
case 'append': {
|
|
140
|
+
const count = (e.content ?? '').split('\n').length;
|
|
141
|
+
parts.push(`appended ${count} line${count === 1 ? '' : 's'} at end`);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return parts.join('\n');
|
|
147
|
+
}
|
|
148
|
+
/** Split file content into lines, handling trailing newline and CRLF correctly. */
|
|
149
|
+
function splitLines(content) {
|
|
150
|
+
if (content === '')
|
|
151
|
+
return [];
|
|
152
|
+
// Normalize CRLF to LF before splitting so lines don't contain trailing \r
|
|
153
|
+
const normalized = content.replace(/\r\n/g, '\n');
|
|
154
|
+
const lines = normalized.split('\n');
|
|
155
|
+
// If file ends with \n, don't count the empty trailing element
|
|
156
|
+
if (lines[lines.length - 1] === '')
|
|
157
|
+
lines.pop();
|
|
158
|
+
return lines;
|
|
159
|
+
}
|
|
160
|
+
/** Detect line ending style from content. */
|
|
161
|
+
function detectLineEnding(content) {
|
|
162
|
+
return content.includes('\r\n') ? '\r\n' : '\n';
|
|
163
|
+
}
|
|
164
|
+
/** Creates file_read_lines and file_edit_lines tools. */
|
|
165
|
+
function createFileTools() {
|
|
166
|
+
return {
|
|
167
|
+
file_read_lines: (0, ai_1.tool)({
|
|
168
|
+
description: 'Read a file with line numbers. Returns structured line-numbered content for precise referencing. Use offset/limit to paginate large files.',
|
|
169
|
+
parameters: zod_1.z.object({
|
|
170
|
+
path: zod_1.z.string().describe('File path to read (relative or absolute)'),
|
|
171
|
+
offset: zod_1.z
|
|
172
|
+
.number()
|
|
173
|
+
.int()
|
|
174
|
+
.min(1)
|
|
175
|
+
.optional()
|
|
176
|
+
.describe('Start line number (1-based, default 1)'),
|
|
177
|
+
limit: zod_1.z
|
|
178
|
+
.number()
|
|
179
|
+
.int()
|
|
180
|
+
.min(1)
|
|
181
|
+
.optional()
|
|
182
|
+
.describe('Maximum lines to return (default 1000)'),
|
|
183
|
+
}),
|
|
184
|
+
execute: async ({ path: filePath, offset = 1, limit = 1000, }) => {
|
|
185
|
+
try {
|
|
186
|
+
const absPath = path.resolve(filePath);
|
|
187
|
+
// Validate file exists
|
|
188
|
+
let stat;
|
|
189
|
+
try {
|
|
190
|
+
stat = fs.statSync(absPath);
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
const code = err.code;
|
|
194
|
+
if (code === 'ENOENT')
|
|
195
|
+
return { error: `File not found: ${absPath}` };
|
|
196
|
+
return { error: `Cannot access ${absPath}: ${err.message}` };
|
|
197
|
+
}
|
|
198
|
+
if (stat.isDirectory()) {
|
|
199
|
+
return { error: `Path is a directory, not a file: ${absPath}` };
|
|
200
|
+
}
|
|
201
|
+
if (stat.size > MAX_FILE_SIZE) {
|
|
202
|
+
return {
|
|
203
|
+
error: `File too large (${stat.size} bytes, max ${MAX_FILE_SIZE}): ${absPath}`,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
// Read once — use buffer for binary check, then decode
|
|
207
|
+
const rawBuffer = fs.readFileSync(absPath);
|
|
208
|
+
if (isBinaryContent(rawBuffer)) {
|
|
209
|
+
return { error: `File appears to be binary: ${absPath}` };
|
|
210
|
+
}
|
|
211
|
+
const content = rawBuffer.toString('utf-8');
|
|
212
|
+
const allLines = splitLines(content);
|
|
213
|
+
const totalLines = allLines.length;
|
|
214
|
+
const startIdx = offset - 1;
|
|
215
|
+
const endIdx = Math.min(startIdx + limit, totalLines);
|
|
216
|
+
const sliced = startIdx < totalLines ? allLines.slice(startIdx, endIdx) : [];
|
|
217
|
+
const lines = sliced.map((line, i) => ({
|
|
218
|
+
num: startIdx + i + 1,
|
|
219
|
+
content: line,
|
|
220
|
+
}));
|
|
221
|
+
return {
|
|
222
|
+
path: absPath,
|
|
223
|
+
total_lines: totalLines,
|
|
224
|
+
offset,
|
|
225
|
+
limit,
|
|
226
|
+
lines,
|
|
227
|
+
truncated: endIdx < totalLines,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
catch (err) {
|
|
231
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
232
|
+
return { error: msg };
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
}),
|
|
236
|
+
file_edit_lines: (0, ai_1.tool)({
|
|
237
|
+
description: 'Edit a file with precise line-based operations. Supports replace, insert, delete, and append actions. Multiple edits are applied atomically (all or nothing). Always read the file first with file_read_lines to get current line numbers.',
|
|
238
|
+
parameters: zod_1.z.object({
|
|
239
|
+
path: zod_1.z.string().describe('File path to edit (relative or absolute)'),
|
|
240
|
+
edits: zod_1.z
|
|
241
|
+
.array(zod_1.z.object({
|
|
242
|
+
action: zod_1.z
|
|
243
|
+
.enum(['replace', 'insert', 'delete', 'append'])
|
|
244
|
+
.describe('replace: replace content at a line number; insert: insert before a line; delete: remove specific lines; append: add to end of file'),
|
|
245
|
+
line: zod_1.z.number().int().min(1).optional().describe('Line number for replace action'),
|
|
246
|
+
before: zod_1.z.number().int().min(1).optional().describe('Line number to insert before'),
|
|
247
|
+
lines: zod_1.z.array(zod_1.z.number().int().min(1)).optional().describe('Line numbers to delete'),
|
|
248
|
+
content: zod_1.z
|
|
249
|
+
.string()
|
|
250
|
+
.optional()
|
|
251
|
+
.describe('New content for replace/insert/append (may contain \\n for multi-line)'),
|
|
252
|
+
}))
|
|
253
|
+
.min(1)
|
|
254
|
+
.describe('Array of edit operations to apply'),
|
|
255
|
+
}),
|
|
256
|
+
execute: async ({ path: filePath, edits, }) => {
|
|
257
|
+
try {
|
|
258
|
+
const absPath = path.resolve(filePath);
|
|
259
|
+
// Validate file exists
|
|
260
|
+
let stat;
|
|
261
|
+
try {
|
|
262
|
+
stat = fs.statSync(absPath);
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
const code = err.code;
|
|
266
|
+
if (code === 'ENOENT')
|
|
267
|
+
return { error: `File not found: ${absPath}` };
|
|
268
|
+
return { error: `Cannot access ${absPath}: ${err.message}` };
|
|
269
|
+
}
|
|
270
|
+
if (stat.isDirectory()) {
|
|
271
|
+
return { error: `Path is a directory, not a file: ${absPath}` };
|
|
272
|
+
}
|
|
273
|
+
if (stat.size > MAX_FILE_SIZE) {
|
|
274
|
+
return {
|
|
275
|
+
error: `File too large (${stat.size} bytes, max ${MAX_FILE_SIZE}): ${absPath}`,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
// Read once — use buffer for binary check, then decode
|
|
279
|
+
const rawBuffer = fs.readFileSync(absPath);
|
|
280
|
+
if (isBinaryContent(rawBuffer)) {
|
|
281
|
+
return { error: `File appears to be binary: ${absPath}` };
|
|
282
|
+
}
|
|
283
|
+
const rawContent = rawBuffer.toString('utf-8');
|
|
284
|
+
const lineEnding = detectLineEnding(rawContent);
|
|
285
|
+
const hadTrailingNewline = rawContent.length > 0 && (rawContent.endsWith('\n') || rawContent.endsWith('\r\n'));
|
|
286
|
+
const oldLines = splitLines(rawContent);
|
|
287
|
+
const totalLines = oldLines.length;
|
|
288
|
+
const oldHash = hashContent(rawContent);
|
|
289
|
+
// Validate all edits upfront
|
|
290
|
+
const validationErrors = [];
|
|
291
|
+
for (let i = 0; i < edits.length; i++) {
|
|
292
|
+
const e = edits[i];
|
|
293
|
+
const prefix = `Edit ${i + 1} (${e.action})`;
|
|
294
|
+
switch (e.action) {
|
|
295
|
+
case 'replace':
|
|
296
|
+
if (e.line === undefined)
|
|
297
|
+
validationErrors.push(`${prefix}: "line" is required`);
|
|
298
|
+
else if (e.line > totalLines)
|
|
299
|
+
validationErrors.push(`${prefix}: line ${e.line} out of bounds (file has ${totalLines} lines)`);
|
|
300
|
+
if (e.content === undefined)
|
|
301
|
+
validationErrors.push(`${prefix}: "content" is required`);
|
|
302
|
+
break;
|
|
303
|
+
case 'insert':
|
|
304
|
+
if (e.before === undefined)
|
|
305
|
+
validationErrors.push(`${prefix}: "before" is required`);
|
|
306
|
+
else if (e.before > totalLines + 1)
|
|
307
|
+
validationErrors.push(`${prefix}: before ${e.before} out of bounds (file has ${totalLines} lines, max ${totalLines + 1})`);
|
|
308
|
+
if (e.content === undefined)
|
|
309
|
+
validationErrors.push(`${prefix}: "content" is required`);
|
|
310
|
+
break;
|
|
311
|
+
case 'delete':
|
|
312
|
+
if (!e.lines || e.lines.length === 0)
|
|
313
|
+
validationErrors.push(`${prefix}: "lines" array is required and must not be empty`);
|
|
314
|
+
else {
|
|
315
|
+
for (const ln of e.lines) {
|
|
316
|
+
if (ln > totalLines)
|
|
317
|
+
validationErrors.push(`${prefix}: line ${ln} out of bounds (file has ${totalLines} lines)`);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
break;
|
|
321
|
+
case 'append':
|
|
322
|
+
if (e.content === undefined)
|
|
323
|
+
validationErrors.push(`${prefix}: "content" is required`);
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// Check for conflicts
|
|
328
|
+
const conflicts = detectConflicts(edits);
|
|
329
|
+
validationErrors.push(...conflicts);
|
|
330
|
+
if (validationErrors.length > 0) {
|
|
331
|
+
return { error: validationErrors.join('; ') };
|
|
332
|
+
}
|
|
333
|
+
// Sort edits descending so high-line edits are applied first
|
|
334
|
+
const sorted = sortEditsDescending(edits);
|
|
335
|
+
// Apply edits to in-memory lines
|
|
336
|
+
const lines = [...oldLines];
|
|
337
|
+
for (const { original: e } of sorted) {
|
|
338
|
+
switch (e.action) {
|
|
339
|
+
case 'replace': {
|
|
340
|
+
const newLines = e.content.split('\n');
|
|
341
|
+
lines.splice(e.line - 1, 1, ...newLines);
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
case 'insert':
|
|
345
|
+
lines.splice(e.before - 1, 0, ...e.content.split('\n'));
|
|
346
|
+
break;
|
|
347
|
+
case 'delete': {
|
|
348
|
+
// Sort delete line numbers descending within this edit
|
|
349
|
+
const delLines = [...e.lines].sort((a, b) => b - a);
|
|
350
|
+
for (const ln of delLines) {
|
|
351
|
+
lines.splice(ln - 1, 1);
|
|
352
|
+
}
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
case 'append':
|
|
356
|
+
lines.push(...e.content.split('\n'));
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
// Write atomically: write to temp file, then rename (POSIX rename atomically replaces target)
|
|
361
|
+
const newContent = lines.length > 0 ? lines.join(lineEnding) + (hadTrailingNewline ? lineEnding : '') : '';
|
|
362
|
+
const tmpPath = `${absPath}.${process.pid}.${(0, node_crypto_1.randomBytes)(4).toString('hex')}.tmp`;
|
|
363
|
+
try {
|
|
364
|
+
fs.writeFileSync(tmpPath, newContent, 'utf-8');
|
|
365
|
+
fs.renameSync(tmpPath, absPath);
|
|
366
|
+
}
|
|
367
|
+
catch (writeErr) {
|
|
368
|
+
try {
|
|
369
|
+
fs.unlinkSync(tmpPath);
|
|
370
|
+
}
|
|
371
|
+
catch {
|
|
372
|
+
// Best-effort cleanup
|
|
373
|
+
}
|
|
374
|
+
const msg = writeErr instanceof Error ? writeErr.message : String(writeErr);
|
|
375
|
+
return { error: `Write failed: ${msg}` };
|
|
376
|
+
}
|
|
377
|
+
const newHash = hashContent(newContent);
|
|
378
|
+
const diff = generateDiffSummary(oldLines, edits);
|
|
379
|
+
return {
|
|
380
|
+
path: absPath,
|
|
381
|
+
old_hash: oldHash,
|
|
382
|
+
new_hash: newHash,
|
|
383
|
+
edits_applied: edits.length,
|
|
384
|
+
total_lines: lines.length,
|
|
385
|
+
diff,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
catch (err) {
|
|
389
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
390
|
+
return { error: msg };
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
}),
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/tools/file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,kCAEC;AAGD,0CAMC;AAeD,kDAmCC;AAGD,0CAgCC;AAGD,kDAwCC;AAmBD,0CAgSC;AAvcD,2BAA0B;AAC1B,6BAAwB;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E,OAAO;wBACjB,QAAQ,EAAE,OAAO;wBACjB,aAAa,EAAE,KAAK,CAAC,MAAM;wBAC3B,WAAW,EAAE,KAAK,CAAC,MAAM;wBACzB,IAAI;qBACL,CAAC;gBACJ,CAAC;gBAAC,OAAO,GAAY,EAAE,CAAC;oBACtB,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBAC7D,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;gBACxB,CAAC;YACH,CAAC;SACF,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { MemoryStore } from '../memory.js';
|
|
|
3
3
|
import type { RoutineStore } from '../routines.js';
|
|
4
4
|
import type { SpecialistStore } from '../specialists.js';
|
|
5
5
|
import type { CandidateStoreReader } from '../specialist-candidates.js';
|
|
6
|
+
import type { BernardConfig } from '../config.js';
|
|
6
7
|
export type { ToolOptions } from './types.js';
|
|
7
8
|
/**
|
|
8
9
|
* Assembles the complete tool registry for the agent.
|
|
@@ -10,6 +11,7 @@ export type { ToolOptions } from './types.js';
|
|
|
10
11
|
* @param options - Shell execution options (timeout, dangerous-command confirmation callback).
|
|
11
12
|
* @param memoryStore - Persistent and scratch memory backing store.
|
|
12
13
|
* @param mcpTools - Optional MCP-provided tools to merge into the registry.
|
|
14
|
+
* @param config - Optional Bernard config, passed to specialist tool for provider/model validation.
|
|
13
15
|
* @returns A flat record of all available AI SDK tools keyed by tool name.
|
|
14
16
|
*/
|
|
15
|
-
export declare function createTools(options: ToolOptions, memoryStore: MemoryStore, mcpTools?: Record<string, any>, routineStore?: RoutineStore, specialistStore?: SpecialistStore, candidateStore?: CandidateStoreReader): Record<string, any>;
|
|
17
|
+
export declare function createTools(options: ToolOptions, memoryStore: MemoryStore, mcpTools?: Record<string, any>, routineStore?: RoutineStore, specialistStore?: SpecialistStore, candidateStore?: CandidateStoreReader, config?: BernardConfig): Record<string, any>;
|
package/dist/tools/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const mcp_js_1 = require("./mcp.js");
|
|
|
11
11
|
const mcp_url_js_1 = require("./mcp-url.js");
|
|
12
12
|
const web_js_1 = require("./web.js");
|
|
13
13
|
const wait_js_1 = require("./wait.js");
|
|
14
|
+
const file_js_1 = require("./file.js");
|
|
14
15
|
const routine_js_1 = require("./routine.js");
|
|
15
16
|
const specialist_js_1 = require("./specialist.js");
|
|
16
17
|
/**
|
|
@@ -19,15 +20,16 @@ const specialist_js_1 = require("./specialist.js");
|
|
|
19
20
|
* @param options - Shell execution options (timeout, dangerous-command confirmation callback).
|
|
20
21
|
* @param memoryStore - Persistent and scratch memory backing store.
|
|
21
22
|
* @param mcpTools - Optional MCP-provided tools to merge into the registry.
|
|
23
|
+
* @param config - Optional Bernard config, passed to specialist tool for provider/model validation.
|
|
22
24
|
* @returns A flat record of all available AI SDK tools keyed by tool name.
|
|
23
25
|
*/
|
|
24
|
-
function createTools(options, memoryStore, mcpTools, routineStore, specialistStore, candidateStore) {
|
|
26
|
+
function createTools(options, memoryStore, mcpTools, routineStore, specialistStore, candidateStore, config) {
|
|
25
27
|
return {
|
|
26
28
|
shell: (0, shell_js_1.createShellTool)(options),
|
|
27
29
|
memory: (0, memory_js_1.createMemoryTool)(memoryStore),
|
|
28
30
|
scratch: (0, memory_js_1.createScratchTool)(memoryStore),
|
|
29
31
|
routine: (0, routine_js_1.createRoutineTool)(routineStore),
|
|
30
|
-
specialist: (0, specialist_js_1.createSpecialistTool)(specialistStore, candidateStore),
|
|
32
|
+
specialist: (0, specialist_js_1.createSpecialistTool)(specialistStore, candidateStore, config),
|
|
31
33
|
datetime: (0, datetime_js_1.createDateTimeTool)(),
|
|
32
34
|
...(0, cron_js_1.createCronTools)(),
|
|
33
35
|
...(0, cron_logs_js_1.createCronLogTools)(),
|
|
@@ -36,6 +38,7 @@ function createTools(options, memoryStore, mcpTools, routineStore, specialistSto
|
|
|
36
38
|
mcp_add_url: (0, mcp_url_js_1.createMCPAddUrlTool)(),
|
|
37
39
|
web_read: (0, web_js_1.createWebReadTool)(),
|
|
38
40
|
wait: (0, wait_js_1.createWaitTool)(),
|
|
41
|
+
...(0, file_js_1.createFileTools)(),
|
|
39
42
|
...mcpTools,
|
|
40
43
|
};
|
|
41
44
|
}
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;AA+BA,kCA0BC;AAzDD,yCAA6C;AAC7C,2CAAkE;AAClE,+CAAmD;AACnD,uCAA4C;AAC5C,iDAAoD;AACpD,uCAA4C;AAC5C,qCAA+C;AAC/C,6CAAmD;AACnD,qCAA6C;AAC7C,uCAA2C;AAC3C,uCAA4C;AAC5C,6CAAiD;AACjD,mDAAuD;AAUvD;;;;;;;;GAQG;AACH,SAAgB,WAAW,CACzB,OAAoB,EACpB,WAAwB,EACxB,QAA8B,EAC9B,YAA2B,EAC3B,eAAiC,EACjC,cAAqC,EACrC,MAAsB;IAEtB,OAAO;QACL,KAAK,EAAE,IAAA,0BAAe,EAAC,OAAO,CAAC;QAC/B,MAAM,EAAE,IAAA,4BAAgB,EAAC,WAAW,CAAC;QACrC,OAAO,EAAE,IAAA,6BAAiB,EAAC,WAAW,CAAC;QACvC,OAAO,EAAE,IAAA,8BAAiB,EAAC,YAAY,CAAC;QACxC,UAAU,EAAE,IAAA,oCAAoB,EAAC,eAAe,EAAE,cAAc,EAAE,MAAM,CAAC;QACzE,QAAQ,EAAE,IAAA,gCAAkB,GAAE;QAC9B,GAAG,IAAA,yBAAe,GAAE;QACpB,GAAG,IAAA,iCAAkB,GAAE;QACvB,GAAG,IAAA,yBAAe,GAAE;QACpB,UAAU,EAAE,IAAA,4BAAmB,GAAE;QACjC,WAAW,EAAE,IAAA,gCAAmB,GAAE;QAClC,QAAQ,EAAE,IAAA,0BAAiB,GAAE;QAC7B,IAAI,EAAE,IAAA,wBAAc,GAAE;QACtB,GAAG,IAAA,yBAAe,GAAE;QACpB,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC"}
|
package/dist/tools/shell.js
CHANGED
|
@@ -41,7 +41,7 @@ function isDangerous(command) {
|
|
|
41
41
|
*/
|
|
42
42
|
function createShellTool(options) {
|
|
43
43
|
return (0, ai_1.tool)({
|
|
44
|
-
description: 'Execute a shell command in the current working directory and return its output. Use this for
|
|
44
|
+
description: 'Execute a shell command in the current working directory and return its output. Use this for git commands, running scripts, and any terminal task. For reading and editing files, prefer file_read_lines and file_edit_lines.',
|
|
45
45
|
parameters: zod_1.z.object({
|
|
46
46
|
command: zod_1.z.string().describe('The shell command to execute'),
|
|
47
47
|
}),
|
package/dist/tools/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/tools/shell.ts"],"names":[],"mappings":";;AA6BA,kCAEC;AAUD,0CAiCC;AA1ED,2BAA0B;AAC1B,6BAAwB;AACxB,2DAA8C;AAG9C,MAAM,kBAAkB,GAAG;IACzB,8BAA8B,EAAE,kBAAkB;IAClD,8BAA8B,EAAE,kBAAkB;IAClD,UAAU;IACV,UAAU;IACV,SAAS;IACT,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,cAAc;IACd,qCAAqC;IACrC,eAAe;IACf,WAAW;IACX,aAAa;CACd,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,OAAe;IACzC,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,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G,IAAA,6BAAQ,EAAC,OAAO,EAAE;oBAC/B,QAAQ,EAAE,OAAO;oBACjB,OAAO,EAAE,OAAO,CAAC,YAAY;oBAC7B,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE,EAAE,OAAO;oBACpC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;iBAChC,CAAC,CAAC;gBACH,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;YAC9D,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACtB,MAAM,SAAS,GAAG,GAA6D,CAAC;gBAChF,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;gBACtC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;gBACtC,MAAM,MAAM,GACV,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,OAAO,IAAI,gBAAgB,CAAC;gBACvF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YACpC,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type ToolOptions } from './index.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type BernardConfig } from '../config.js';
|
|
4
4
|
import type { MemoryStore } from '../memory.js';
|
|
5
5
|
import type { RAGStore } from '../rag.js';
|
|
6
6
|
import type { SpecialistStore } from '../specialists.js';
|
|
@@ -22,18 +22,26 @@ export declare function createSpecialistRunTool(config: BernardConfig, options:
|
|
|
22
22
|
specialistId: z.ZodString;
|
|
23
23
|
task: z.ZodString;
|
|
24
24
|
context: z.ZodOptional<z.ZodString>;
|
|
25
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
26
|
+
model: z.ZodOptional<z.ZodString>;
|
|
25
27
|
}, "strip", z.ZodTypeAny, {
|
|
26
28
|
task: string;
|
|
27
29
|
specialistId: string;
|
|
30
|
+
provider?: string | undefined;
|
|
31
|
+
model?: string | undefined;
|
|
28
32
|
context?: string | undefined;
|
|
29
33
|
}, {
|
|
30
34
|
task: string;
|
|
31
35
|
specialistId: string;
|
|
36
|
+
provider?: string | undefined;
|
|
37
|
+
model?: string | undefined;
|
|
32
38
|
context?: string | undefined;
|
|
33
39
|
}>, string> & {
|
|
34
40
|
execute: (args: {
|
|
35
41
|
task: string;
|
|
36
42
|
specialistId: string;
|
|
43
|
+
provider?: string | undefined;
|
|
44
|
+
model?: string | undefined;
|
|
37
45
|
context?: string | undefined;
|
|
38
46
|
}, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
|
|
39
47
|
};
|
|
@@ -9,6 +9,7 @@ const output_js_1 = require("../output.js");
|
|
|
9
9
|
const logger_js_1 = require("../logger.js");
|
|
10
10
|
const memory_context_js_1 = require("../memory-context.js");
|
|
11
11
|
const agent_pool_js_1 = require("./agent-pool.js");
|
|
12
|
+
const config_js_1 = require("../config.js");
|
|
12
13
|
const SPECIALIST_EXECUTION_RULES = `
|
|
13
14
|
|
|
14
15
|
Rules:
|
|
@@ -44,12 +45,32 @@ function createSpecialistRunTool(config, options, memoryStore, specialistStore,
|
|
|
44
45
|
.string()
|
|
45
46
|
.describe('A detailed, self-contained task description. Include: (1) specific objective and expected output format, (2) exact file paths, commands, or URLs, (3) edge cases and what to do if something fails. The specialist has zero prior context beyond its own profile.'),
|
|
46
47
|
context: zod_1.z.string().optional().describe('Optional additional context to help the specialist'),
|
|
48
|
+
provider: zod_1.z
|
|
49
|
+
.string()
|
|
50
|
+
.optional()
|
|
51
|
+
.describe('Optional provider override for this invocation (e.g. "xai"). Takes priority over specialist config and global config.'),
|
|
52
|
+
model: zod_1.z
|
|
53
|
+
.string()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe('Optional model override for this invocation (e.g. "grok-code-fast-1"). Takes priority over specialist config and global config.'),
|
|
47
56
|
}),
|
|
48
|
-
execute: async ({ specialistId, task, context }, execOptions) => {
|
|
57
|
+
execute: async ({ specialistId, task, context, provider, model }, execOptions) => {
|
|
49
58
|
const specialist = specialistStore.get(specialistId);
|
|
50
59
|
if (!specialist) {
|
|
51
60
|
return `Error: No specialist found with id "${specialistId}". Use the specialist tool to list or create specialists.`;
|
|
52
61
|
}
|
|
62
|
+
// 3-tier model resolution: invocation override > specialist config > global config
|
|
63
|
+
// When the resolved provider differs from config.provider and no explicit model
|
|
64
|
+
// override exists, use the provider's default model to avoid cross-provider mismatches
|
|
65
|
+
// (e.g. xai provider with an anthropic model name).
|
|
66
|
+
const resolvedProvider = provider ?? specialist.provider ?? config.provider;
|
|
67
|
+
const explicitModel = model ?? specialist.model;
|
|
68
|
+
const resolvedModel = explicitModel ??
|
|
69
|
+
(resolvedProvider !== config.provider ? (0, config_js_1.getDefaultModel)(resolvedProvider) : config.model);
|
|
70
|
+
if (!(0, config_js_1.hasProviderKey)(config, resolvedProvider)) {
|
|
71
|
+
const envVar = config_js_1.PROVIDER_ENV_VARS[resolvedProvider] ?? `${resolvedProvider.toUpperCase()}_API_KEY`;
|
|
72
|
+
return `Error: No API key found for provider "${resolvedProvider}". Run: bernard add-key ${resolvedProvider} <your-api-key> or set ${envVar}.`;
|
|
73
|
+
}
|
|
53
74
|
const slot = (0, agent_pool_js_1.acquireSlot)();
|
|
54
75
|
if (!slot) {
|
|
55
76
|
return `Error: Maximum concurrent agents (${agent_pool_js_1.MAX_CONCURRENT_AGENTS}) reached. Wait for existing agents to finish.`;
|
|
@@ -89,7 +110,7 @@ function createSpecialistRunTool(config, options, memoryStore, specialistStore,
|
|
|
89
110
|
includeScratch: true,
|
|
90
111
|
});
|
|
91
112
|
const result = await (0, ai_1.generateText)({
|
|
92
|
-
model: (0, index_js_1.getModel)(
|
|
113
|
+
model: (0, index_js_1.getModel)(resolvedProvider, resolvedModel),
|
|
93
114
|
tools: baseTools,
|
|
94
115
|
maxSteps: 10,
|
|
95
116
|
maxTokens: config.maxTokens,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specialist-run.js","sourceRoot":"","sources":["../../src/tools/specialist-run.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"specialist-run.js","sourceRoot":"","sources":["../../src/tools/specialist-run.ts"],"names":[],"mappings":";;AAmDA,0DAkIC;AArLD,2BAAwC;AACxC,6BAAwB;AACxB,oDAAiD;AACjD,yCAA2D;AAC3D,4CAMsB;AACtB,4CAAwC;AACxC,4DAA0D;AAC1D,mDAAkF;AAClF,4CAKsB;AAKtB,MAAM,0BAA0B,GAAG;;;;;;;;;;;iOAW8L,CAAC;AAElO;;;;;;;;;;;;;GAaG;AACH,SAAgB,uBAAuB,CACrC,MAAqB,EACrB,OAAoB,EACpB,WAAwB,EACxB,eAAgC,EAChC,QAA8B,EAC9B,QAAmB;IAEnB,OAAO,IAAA,SAAI,EAAC;QACV,WAAW,EACT,iQAAiQ;QACnQ,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC;YACnB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;YAC7F,IAAI,EAAE,OAAC;iBACJ,MAAM,EAAE;iBACR,QAAQ,CACP,mQAAmQ,CACpQ;YACH,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;YAC7F,QAAQ,EAAE,OAAC;iBACR,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,uHAAuH,CACxH;YACH,KAAK,EAAE,OAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,iIAAiI,CAClI;SACJ,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,QA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