Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@avcodes/mi

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@avcodes/mi - npm Package Compare versions

Comparing version
1.10.1
to
1.11.0
+1
-1
index.mjs

@@ -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}`).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; }
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(({ default: d, ...n }) => d || { ...n, handler: n.handler || n.execute }); 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.';

{
"name": "@avcodes/mi",
"version": "1.10.1",
"version": "1.11.0",
"description": "agentic coding in 30 loc. a loop, two tools, and an llm.",

@@ -5,0 +5,0 @@ "type": "module",