opencode-ralph-loop
Advanced tools
+1
-1
| { | ||
| "name": "opencode-ralph-loop", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "description": "Minimal Ralph Loop plugin for opencode - auto-continues until task completion", | ||
@@ -5,0 +5,0 @@ "main": "src/index.ts", |
+16
-3
@@ -179,2 +179,3 @@ import { existsSync, readFileSync, writeFileSync, mkdirSync, unlinkSync, readdirSync, cpSync } from "fs"; | ||
| const directory = ctx.directory || process.cwd(); | ||
| const client = ctx.client; | ||
@@ -274,2 +275,3 @@ // Auto-setup skills and commands on first run | ||
| if (!state.active) return; | ||
| if (!sessionId) return; | ||
| if (state.sessionId && state.sessionId !== sessionId) return; | ||
@@ -292,5 +294,16 @@ | ||
| return { | ||
| inject: `Continue from where you left off. (Iteration ${newState.iteration}/${newState.maxIterations})\n\nWhen the task is fully complete, output: <promise>DONE</promise>` | ||
| }; | ||
| // Inject continuation prompt using client.session.prompt() | ||
| const continuationPrompt = `Continue from where you left off. (Iteration ${newState.iteration}/${newState.maxIterations})\n\nWhen the task is fully complete, output: <promise>DONE</promise>`; | ||
| try { | ||
| await client.session.prompt({ | ||
| path: { id: sessionId }, | ||
| body: { | ||
| parts: [{ type: "text", text: continuationPrompt }] | ||
| } | ||
| }); | ||
| console.log(`[ralph-loop] Injected continuation (iteration ${newState.iteration})`); | ||
| } catch (e) { | ||
| console.error("[ralph-loop] Failed to inject continuation:", e); | ||
| } | ||
| } | ||
@@ -297,0 +310,0 @@ |
21727
2.49%267
4.71%