builder: adapt OpenCode integration for Docker deployment; disable repo verification, remove JSON flag usage, parse text models, fix redo flow and session listing

This commit is contained in:
southseact-3d
2026-02-10 18:58:14 +00:00
parent 1af1f7b266
commit bc45e3f964

View File

@@ -15957,7 +15957,7 @@ async function handleNewMessage(req, res, sessionId, userId) {
}
const cli = normalizeCli(body.cli || session.cli);
const now = new Date().toISOString();
const message = { id: randomUUID(), role: 'user', content, displayContent, model, cli, status: 'queued', createdAt: now, updatedAt: now, opencodeTokensUsed: null };
const message = { id: randomUUID(), role: 'user', content, originalContent: content, displayContent, model, cli, status: 'queued', createdAt: now, updatedAt: now, opencodeTokensUsed: null };
if (body.isProceedWithBuild) message.isProceedWithBuild = true;
if (body.externalTestingEnabled !== undefined) {
message.externalTestingEnabled = body.externalTestingEnabled === true;
@@ -16454,16 +16454,20 @@ async function handleRedoMessage(req, res, sessionId, messageId, userId) {
}
try {
log('Sending redo command to opencode', { sessionId, messageId, opencodeSessionId: session.opencodeSessionId });
const cliCommand = resolveCliCommand('opencode');
const args = ['run', '--session', session.opencodeSessionId, '/redo'];
await runCommand(cliCommand, args, {
cwd: session.workspaceDir || REPO_ROOT,
timeout: 30000
});
log('Redoing message', { sessionId, messageId, opencodeSessionId: session.opencodeSessionId });
// Clear the message state to trigger reprocessing
// Clear content/response
message.content = message.originalContent || message.content;
message.response = null;
message.error = null;
message.status = 'queued';
message.completedAt = null;
message.toolCalls = null;
message.toolResults = null;
message.streamBuffer = '';
message.fullResponse = null;
// Clear todos from the message when redone (they will be regenerated during the new execution)
if (message.todos) {
const todoCount = message.todos.length;
@@ -16471,10 +16475,18 @@ async function handleRedoMessage(req, res, sessionId, messageId, userId) {
log('Cleared todos from redone message', { sessionId, messageId, clearedCount: todoCount });
}
log('Redo command completed', { sessionId, messageId });
sendJson(res, 200, { ok: true, message: 'Redo command sent successfully' });
// Persist the state change
await persistState();
// Trigger message processing (non-blocking)
processMessage(sessionId, message).catch(err => {
log('Redo message processing failed', { sessionId, messageId, error: String(err) });
});
log('Redo initiated successfully', { sessionId, messageId });
sendJson(res, 200, { ok: true, message: 'Redo initiated successfully' });
} catch (error) {
log('Redo command failed', { sessionId, messageId, error: String(error) });
log('Redo failed', { sessionId, messageId, error: String(error) });
sendJson(res, 500, { error: `Redo failed: ${error.message}` });
}
}