Refactor WordPress prompt system and add completion signal

This commit is contained in:
cto-new[bot]
2026-02-07 22:12:43 +00:00
parent 5827df5ac1
commit 23d4c8d0e6
6 changed files with 16814 additions and 91 deletions

View File

@@ -8723,6 +8723,20 @@ async function sendToOpencode({ session, model, content, message, cli, streamCal
// Use accumulated text output (partialOutput) since we're using --format json
const finalOutput = filterOpencodeStatusMessages(partialOutput || '');
// Check for completion signal and process it
const completionMatch = finalOutput.match(/\s*[COMPLETE]\s*$/i);
let processedOutput = finalOutput;
if (completionMatch) {
// Remove the completion signal from the output
processedOutput = finalOutput.slice(0, completionMatch.index).trim();
log('OpenCode completion signal detected', {
messageId: messageKey,
hadCompletionSignal: true,
originalLength: finalOutput.length,
processedLength: processedOutput.length
});
}
// Mark message as done to prevent false "stalled" detection
if (message) {
message.status = 'done';
@@ -8733,7 +8747,7 @@ async function sendToOpencode({ session, model, content, message, cli, streamCal
}
// The reply is the final accumulated output
let reply = finalOutput;
let reply = processedOutput;
if (message) {
message.partialOutput = finalOutput;