Compare commits

..

2 Commits
0.8.6 ... 0.8.8

Author SHA1 Message Date
06dda88dbc Removed log statements
All checks were successful
Publish Library / Build NPM Project (push) Successful in 36s
Publish Library / Tag Version (push) Successful in 10s
2026-03-02 14:00:58 -05:00
5d34652d46 Fixed CLI tool
All checks were successful
Publish Library / Build NPM Project (push) Successful in 39s
Publish Library / Tag Version (push) Successful in 10s
2026-03-01 18:11:25 -05:00
2 changed files with 8 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ztimson/ai-utils", "name": "@ztimson/ai-utils",
"version": "0.8.6", "version": "0.8.8",
"description": "AI Utility library", "description": "AI Utility library",
"author": "Zak Timson", "author": "Zak Timson",
"license": "MIT", "license": "MIT",

View File

@@ -65,14 +65,15 @@ export const ExecTool: AiTool = {
}, },
fn: async (args, stream, ai) => { fn: async (args, stream, ai) => {
try { try {
switch(args.type) { switch(args.language) {
case 'cli': case 'cli':
return await CliTool.fn({command: args.code}, stream, ai); return await CliTool.fn({command: args.code}, stream, ai);
case 'node': case 'node':
return await JSTool.fn({code: args.code}, stream, ai); return await JSTool.fn({code: args.code}, stream, ai);
case 'python': { case 'python':
return await PythonTool.fn({code: args.code}, stream, ai); return await PythonTool.fn({code: args.code}, stream, ai);
} default:
throw new Error(`Unsupported language: ${args.language}`);
} }
} catch(err: any) { } catch(err: any) {
return {error: err?.message || err.toString()}; return {error: err?.message || err.toString()};
@@ -104,9 +105,9 @@ export const JSTool: AiTool = {
code: {type: 'string', description: 'CommonJS javascript', required: true} code: {type: 'string', description: 'CommonJS javascript', required: true}
}, },
fn: async (args: {code: string}) => { fn: async (args: {code: string}) => {
const console = consoleInterceptor(null); const c = consoleInterceptor(null);
const resp = await Fn<any>({console}, args.code, true).catch((err: any) => console.output.error.push(err)); const resp = await Fn<any>({console: c}, args.code, true).catch((err: any) => c.output.error.push(err));
return {...console.output, return: resp, stdout: undefined, stderr: undefined}; return {...c.output, return: resp, stdout: undefined, stderr: undefined};
} }
} }