Add /ulw-loop command for ultrawork mode loop (#867)
* feat(ralph-loop): add ultrawork field to RalphLoopState * feat(ralph-loop): persist ultrawork field in storage * feat(ralph-loop): accept ultrawork option in startLoop Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * feat(ralph-loop): prepend ultrawork keyword when mode active Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * feat(ralph-loop): custom toast for ultrawork mode * feat(ralph-loop): add /ulw-loop command for ultrawork mode * fix(ralph-loop): add non-null assertion for type safety * fix(ralph-loop): mirror argument parsing in ulw-loop handler - Parse quoted prompts and strip flags from task text - Support --max-iterations and --completion-promise options - Add default prompt for empty input - Fixes behavior inconsistency with /ralph-loop --------- Co-authored-by: justsisyphus <sisyphus-dev-ai@users.noreply.github.com> Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
+24
-3
@@ -525,9 +525,30 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
: undefined,
|
||||
completionPromise: promiseMatch?.[1],
|
||||
});
|
||||
} else if (command === "cancel-ralph" && sessionID) {
|
||||
ralphLoop.cancelLoop(sessionID);
|
||||
}
|
||||
} else if (command === "cancel-ralph" && sessionID) {
|
||||
ralphLoop.cancelLoop(sessionID);
|
||||
} else if (command === "ulw-loop" && sessionID) {
|
||||
const rawArgs =
|
||||
args?.command?.replace(/^\/?(ulw-loop)\s*/i, "") || "";
|
||||
const taskMatch = rawArgs.match(/^["'](.+?)["']/);
|
||||
const prompt =
|
||||
taskMatch?.[1] ||
|
||||
rawArgs.split(/\s+--/)[0]?.trim() ||
|
||||
"Complete the task as instructed";
|
||||
|
||||
const maxIterMatch = rawArgs.match(/--max-iterations=(\d+)/i);
|
||||
const promiseMatch = rawArgs.match(
|
||||
/--completion-promise=["']?([^"'\s]+)["']?/i
|
||||
);
|
||||
|
||||
ralphLoop.startLoop(sessionID, prompt, {
|
||||
ultrawork: true,
|
||||
maxIterations: maxIterMatch
|
||||
? parseInt(maxIterMatch[1], 10)
|
||||
: undefined,
|
||||
completionPromise: promiseMatch?.[1],
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user