From 53933e115c10f31159119398e8a18d8f29a30305 Mon Sep 17 00:00:00 2001 From: Gemini AI Date: Sun, 14 Dec 2025 02:50:14 +0400 Subject: [PATCH] feat: implement SOLO Mode for auto-healing command failures --- bin/opencode-ink.mjs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bin/opencode-ink.mjs b/bin/opencode-ink.mjs index 389223a..dda242a 100644 --- a/bin/opencode-ink.mjs +++ b/bin/opencode-ink.mjs @@ -3288,11 +3288,28 @@ This gives the user a chance to refine requirements before implementation. setMessages(prev => [...prev, { role: 'system', content: `✅ Output:\n${res.output}` }]); } else { setMessages(prev => [...prev, { role: 'error', content: `❌ Failed (Exit ${res.code}):\n${res.output}` }]); + results.push({ failed: true, output: res.output, code: res.code, cmd: finalCmd }); } } setDetectedCommands([]); setIsExecutingCommands(false); + + // SOLO MODE: AUTO-HEAL + // If any command failed, immediately report back to the agent + const failures = results.filter(r => r.failed); + if (soloMode && failures.length > 0) { + const errorReport = failures.map(f => + `COMMAND FAILED: \`${f.cmd}\`\nEXIT CODE: ${f.code}\nOUTPUT:\n${f.output}` + ).join('\n\n'); + + const autoPrompt = `🚨 **AUTO-HEAL REPORT** 🚨\nThe following commands failed during execution:\n\n${errorReport}\n\nPlease analyze these errors and provide the CORRECT commands to fix the issue. Do NOT ask for permission, just provide the fix.`; + + setMessages(prev => [...prev, { role: 'system', content: `🔄 **SOLO AUTO-HEAL**: Reporting failures to Agent...` }]); + + // Recursive call to AI + setTimeout(() => handleSubmit(autoPrompt), 100); + } }; // Handle project selection