heyio 0.1.13 → 0.1.15
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.
|
@@ -308,6 +308,13 @@ export async function initOrchestrator(copilotClient) {
|
|
|
308
308
|
catch (err) {
|
|
309
309
|
console.error("[io] Could not validate models:", err instanceof Error ? err.message : err);
|
|
310
310
|
}
|
|
311
|
+
// Log built-in tools for diagnostics
|
|
312
|
+
try {
|
|
313
|
+
const toolsList = await copilotClient.rpc.tools.list({});
|
|
314
|
+
const toolNames = toolsList.tools.map((t) => t.name);
|
|
315
|
+
console.error(`[io] Built-in tools: ${toolNames.join(", ")}`);
|
|
316
|
+
}
|
|
317
|
+
catch { /* non-fatal */ }
|
|
311
318
|
// Start health check timer
|
|
312
319
|
healthCheckTimer = setInterval(() => {
|
|
313
320
|
if (!client || client.getState() !== "connected") {
|
package/dist/copilot/tools.js
CHANGED
|
@@ -204,7 +204,66 @@ export function createTools(deps) {
|
|
|
204
204
|
}
|
|
205
205
|
},
|
|
206
206
|
});
|
|
207
|
-
|
|
207
|
+
// Override built-in bash tool so the model uses our implementation
|
|
208
|
+
const bash = defineTool("bash", {
|
|
209
|
+
description: "Run a bash command on the host machine with full root access.",
|
|
210
|
+
skipPermission: true,
|
|
211
|
+
overridesBuiltInTool: true,
|
|
212
|
+
parameters: z.object({
|
|
213
|
+
command: z.string().describe("The command to run"),
|
|
214
|
+
}),
|
|
215
|
+
handler: async ({ command }) => {
|
|
216
|
+
console.error(`[io] bash tool called: ${command}`);
|
|
217
|
+
try {
|
|
218
|
+
const result = execSync(command, {
|
|
219
|
+
encoding: "utf-8",
|
|
220
|
+
timeout: 60_000,
|
|
221
|
+
maxBuffer: 1024 * 1024,
|
|
222
|
+
});
|
|
223
|
+
const output = result.trim();
|
|
224
|
+
if (output.length > 8000) {
|
|
225
|
+
return output.slice(0, 8000) + "\n\n[…truncated]";
|
|
226
|
+
}
|
|
227
|
+
return output || "(no output)";
|
|
228
|
+
}
|
|
229
|
+
catch (err) {
|
|
230
|
+
const execErr = err;
|
|
231
|
+
const stderr = execErr.stderr?.trim() ?? "";
|
|
232
|
+
const stdout = execErr.stdout?.trim() ?? "";
|
|
233
|
+
const msg = stderr || stdout || execErr.message || "Command failed";
|
|
234
|
+
if (msg.length > 4000) {
|
|
235
|
+
return `Error:\n${msg.slice(0, 4000)}\n[…truncated]`;
|
|
236
|
+
}
|
|
237
|
+
return `Error:\n${msg}`;
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
// Override built-in read_file tool
|
|
242
|
+
const readFile = defineTool("read_file", {
|
|
243
|
+
description: "Read a file from the filesystem.",
|
|
244
|
+
skipPermission: true,
|
|
245
|
+
overridesBuiltInTool: true,
|
|
246
|
+
parameters: z.object({
|
|
247
|
+
file_path: z.string().describe("Path to the file to read"),
|
|
248
|
+
}),
|
|
249
|
+
handler: async ({ file_path }) => {
|
|
250
|
+
console.error(`[io] read_file tool called: ${file_path}`);
|
|
251
|
+
try {
|
|
252
|
+
const resolved = resolve(file_path);
|
|
253
|
+
if (!existsSync(resolved))
|
|
254
|
+
return `File not found: ${file_path}`;
|
|
255
|
+
const text = readFileSync(resolved, "utf-8");
|
|
256
|
+
if (text.length > 8000) {
|
|
257
|
+
return text.slice(0, 8000) + "\n\n[…truncated]";
|
|
258
|
+
}
|
|
259
|
+
return text;
|
|
260
|
+
}
|
|
261
|
+
catch (err) {
|
|
262
|
+
return `Error: ${err instanceof Error ? err.message : String(err)}`;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
return [wikiRead, wikiWrite, wikiSearch, squadCreate, squadRecall, squadStatus, squadLogDecision, shell, fileOps, bash, readFile];
|
|
208
267
|
}
|
|
209
268
|
function walkDirectory(dir, maxDepth = 3, depth = 0) {
|
|
210
269
|
if (depth >= maxDepth)
|