@avcodes/mi
Advanced tools
+1
-1
@@ -17,3 +17,3 @@ #!/usr/bin/env node | ||
| const gray = s => `\x1b[90m${s}\x1b[0m`, red = s => `\x1b[31m${s}\x1b[0m`, orange = s => `\x1b[38;5;208m${s}\x1b[0m`; let tools, toolSchemas, listSkills, loadId = 0; | ||
| async function loadTools() { const dirs = [`${DIR}tools`, `${MI_HOME}/tools`].filter(d => existsSync(d)), toolMods = await Promise.all(dirs.flatMap(dir => readdirSync(dir).filter(f => f.endsWith('.mjs')).map(f => import(`${dir}/${f}?v=${++loadId}`)))), defs = toolMods.map(mod => mod.default); tools = Object.fromEntries(defs.map(def => [def.name, def.handler])); toolSchemas = [...new Map(defs.map(def => [def.name, { type: 'function', function: { name: def.name, description: def.description, parameters: def.parameters } }])).values()]; listSkills = toolMods.find(mod => mod.listSkills)?.listSkills; } | ||
| async function loadTools() { const dirs = [`${DIR}tools`, `${MI_HOME}/tools`].filter(d => existsSync(d)), toolMods = await Promise.all(dirs.flatMap(dir => readdirSync(dir).filter(f => f.endsWith('.mjs')).map(f => import(`${dir}/${f}?v=${++loadId}`).catch(e => { console.error(red(`✗ ${f}: ${e.message}`)); return { default: { name: f.replace('.mjs', ''), description: `[broken] ${e.message}`, parameters: { type: 'object', properties: {} }, handler: () => `Error: tool failed to load — ${e.message}` } }; })))), defs = toolMods.map(mod => mod.default); tools = Object.fromEntries(defs.map(def => [def.name, def.handler])); toolSchemas = [...new Map(defs.map(def => [def.name, { type: 'function', function: { name: def.name, description: def.description, parameters: def.parameters } }])).values()]; listSkills = toolMods.find(mod => mod.listSkills)?.listSkills; } | ||
| await loadTools(); const fetchRetry = async (url, opts, n = 3) => { for (let i = 0;; i++) { try { const r = await fetch(url, opts); if ((r.status === 429 || r.status >= 500) && i < n) { await new Promise(w => setTimeout(w, 500 << i)); continue; } return r; } catch (e) { if (i >= n) throw e; await new Promise(w => setTimeout(w, 500 << i)); } } }; | ||
@@ -20,0 +20,0 @@ const isCtx = e => /^(context_length_exceeded|exceed_context_size_error)$/.test(e.code||e.error?.code||'') || /maximum context|context (length|window|size|limit)|prompt is too long|input is too long|too many (input )?tokens|exceeds the (context window|maximum.*tokens)/i.test(e.message||''), COMPACT_PROMPT = 'Summarize this conversation. Output sections: GOAL (user task), DONE (completed work), STATE (current state, files touched), NEXT (next steps), CONSTRAINTS (user preferences). Detailed but concise.'; |
+1
-1
| { | ||
| "name": "@avcodes/mi", | ||
| "version": "1.10.0", | ||
| "version": "1.10.1", | ||
| "description": "agentic coding in 30 loc. a loop, two tools, and an llm.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
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 14 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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 14 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
76918
0.34%195
0.52%