Refactor WordPress prompt system and add completion signal
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user