Enhance output logging in CLI and ModelDialog by integrating chalk for better readability. Update output handling to include detailed reasoning and token information. Refactor message management in ModelDialog to improve response processing and add support for function call arguments. Adjust chroot paths in various tools for consistency.

This commit is contained in:
sebseb7
2025-08-14 09:41:17 +00:00
parent df85e5e603
commit 657b6af993
9 changed files with 112 additions and 49 deletions

View File

@@ -120,7 +120,7 @@ export async function run(args) {
const inputPath = args?.path || "";
const depth = Number.isInteger(args?.depth) ? args.depth : 1;
const includeHidden = args?.includeHidden ?? false;
const chrootPath = '/workspaces/aiTools';
const chrootPath = '/workspaces/aiTools/root';
if (!chrootPath) {
return { err: "Chroot path is required" };

View File

@@ -808,7 +808,7 @@ export async function run(args) {
open_file,
write_file,
remove_file,
'/workspaces/aiTools'
'/workspaces/aiTools/root'
);
return result;
} catch (error) {

View File

@@ -3,7 +3,7 @@ import { createInterface } from "node:readline";
import path from "node:path";
const virtual_chroot = '/workspaces/aiTools';
const virtual_chroot = '/workspaces/aiTools/root';
// Ensures reads are confined to `virtual_chroot`.
@@ -13,7 +13,7 @@ export default {
type: "object", required: ["path","linesToSkip","linesToRead"], additionalProperties: false, properties: {
path: { type: "string", description: "The path to the file to read.", },
linesToSkip: { type: "integer", description: "The number of lines to skip. Use 0 to read from the beginning.", minimum: 0 },
linesToRead: { type: "integer", description: "1-400 The number of lines to read. Use 0 or more than 400 to read 400 lines.", minimum: 0 }
linesToRead: { type: "integer", description: "1-400 The number of lines to read.", minimum: 1, maximum: 400 }
}
}
};
@@ -29,6 +29,8 @@ export async function run(args) {
// Normalize linesToRead (1-400, with 0 or >400 meaning 400)
const maxLines = (linesToRead <= 0 || linesToRead > 400) ? 400 : linesToRead;
// return 'FILE DOES NOT EXIST'
try {

View File

@@ -1,6 +1,6 @@
import { spawnSync } from "node:child_process";
const virtual_chroot = '/workspaces/aiTools';
const virtual_chroot = '/workspaces/aiTools/root';
export default {
type: "function", name: "ripgrep", strict: true,

View File

@@ -7,7 +7,10 @@ export async function run(args){
const buffer = await res.buffer();
const filename = new Date().getTime() + '.' + url.split('.').pop();
const content = buffer.slice(0, 500).toString('utf8');
return { filename, content };
// save the file to the chroot
const filePath = `/workspaces/aiTools/root/${filename}`;
fs.writeFileSync(filePath, content);
return { 'Downloaded to:': filename };
};
// metadata for the tool runner