@avcodes/mi
Advanced tools
+4
-4
| #!/usr/bin/env node | ||
| import { createInterface } from 'readline'; import { execSync } from 'child_process'; import { readFileSync, writeFileSync } from 'fs'; | ||
| import { createInterface } from 'readline'; import { spawn } from 'child_process'; import { readFileSync, writeFileSync } from 'fs'; | ||
| const tools = { | ||
| bash: ({cmd}) => { try { return execSync(cmd,{encoding:'utf8',stdio:'pipe'}) } catch(e) { return e.stderr||e.message } }, | ||
| bash: ({command})=>new Promise(r=>{const c=spawn('bash',['-c',command],{stdio:['ignore','pipe','pipe'],detached:true});let o='';c.stdout.on('data',d=>o+=d);c.stderr.on('data',d=>o+=d);const h=()=>{try{process.kill(-c.pid)}catch(e){}};process.on('SIGINT',h);c.on('exit',()=>{process.off('SIGINT',h);r(o)})}), | ||
| read: ({path}) => readFileSync(path,'utf8'), | ||
@@ -9,3 +9,3 @@ write: ({path,content}) => (writeFileSync(path,content),'ok'), | ||
| const mkp = (...keys) => ({type:'object',properties:Object.fromEntries(keys.map(k=>[k,{type:'string'}])),required:keys}); | ||
| const defs = [{name:'bash',description:'run bash cmd',parameters:mkp('cmd')},{name:'read',description:'read a file',parameters:mkp('path')}, | ||
| const defs = [{name:'bash',description:'run bash cmd',parameters:mkp('command')},{name:'read',description:'read a file',parameters:mkp('path')}, | ||
| {name:'write',description:'write a file',parameters:mkp('path','content')}].map(f=>({type:'function',function:f})); | ||
@@ -22,3 +22,3 @@ async function run(msgs) { while (true) { | ||
| console.log(dim(`⟡ ${name}(${JSON.stringify(args)})`)); | ||
| const out=String(tools[name](args)); console.log(dim(out.length>200?out.slice(0,200)+'…':out)); | ||
| const out=String(await tools[name](args)); console.log(dim(out.length>200?out.slice(0,200)+'…':out)); | ||
| msgs.push({role:'tool',tool_call_id:t.id,content:out}); | ||
@@ -25,0 +25,0 @@ } |
+1
-1
| { | ||
| "name": "@avcodes/mi", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "description": "agentic coding in 30 loc. a loop, three tools, and an llm.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
AI-detected potential malware
Supply chain riskAI has identified this package as malware. This is a strong signal that the package may be malicious.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
4245
4.51%32
3.23%1
Infinity%