Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: recognize wrapped OpenCode startup update dialogs

[._.]/ Adam Eivya98fc485843b
diff --git a/server/lib/tuiHandshake.js b/server/lib/tuiHandshake.js
index c88d100033..332832a74a 100644
--- a/server/lib/tuiHandshake.js
+++ b/server/lib/tuiHandshake.js
@@ -463,7 +463,9 @@ export const AGY_INPUT_READY_PATTERN = /\?forshortcuts/i;
export const OPENCODE_INPUT_READY_PATTERN = /askanything/i;
// The update offer overlays the composer and defaults to Confirm. Escape
// closes it without installing software or changing the operator's settings.
-const OPENCODE_UPDATE_PROMPT_PATTERN = /updateavailable.*anewreleasev[\d.]+isavailable\.wouldyouliketoupdatenow\?/i;
+// Match the heading and release announcement: the following question wraps
+// across screen rows with composer-border glyphs interleaved in the PTY stream.
+const OPENCODE_UPDATE_PROMPT_PATTERN = /updateavailable.*anewreleasev[\d.]+isavailable\./i;
// Handshake markers are matched against a rolling window of whitespace-stripped
// output rather than a single chunk, so a marker split across two PTY reads
diff --git a/server/services/agentTuiSpawning.test.js b/server/services/agentTuiSpawning.test.js
index 14e317fe24..4758e7461c 100644
--- a/server/services/agentTuiSpawning.test.js
+++ b/server/services/agentTuiSpawning.test.js
@@ -1510,7 +1510,9 @@ describe('spawnTuiAgent runtime', () => {
await vi.advanceTimersByTimeAsync(600);
expect(pasteCount()).toBe(0);
await capturedOnData(Buffer.from('Update\x1b[8;29H Available esc\nA new release v9.9.9 is avail'));
- await capturedOnData(Buffer.from('able. Would you like to update now?\nSkip Confirm\n'));
+ // The composer border is painted between the two wrapped message rows.
+ await capturedOnData(Buffer.from('able. Would you like to\x1b[12;4H┃\n'));
+ await capturedOnData(Buffer.from(' update now?\n┃ Ask\n┃ Buil Skip Confirm\n'));
await vi.advanceTimersByTimeAsync(400);
expect(vi.mocked(shellService.writeToSession).mock.calls.map(([, data]) => data)).toEqual(['\x1b']);
expect(pasteCount()).toBe(0);
diff --git a/server/services/tuiPromptRunner.test.js b/server/services/tuiPromptRunner.test.js
index 7b84c2fbe0..45508258ca 100644
--- a/server/services/tuiPromptRunner.test.js
+++ b/server/services/tuiPromptRunner.test.js
@@ -874,7 +874,8 @@ describe('executeTuiRun', () => {
await vi.advanceTimersByTimeAsync(15000);
expect(pty.write).not.toHaveBeenCalled();
pty.emitData('\x1b[?2004hAsk anything…\nUpdate Available esc\n'
- + 'A new release v9.9.9 is available. Would you like to update now?\nSkip Confirm\n');
+ + 'A new release v9.9.9 is available. Would you like to\x1b[12;4H┃\n'
+ + ' update now?\n┃ Ask\n┃ Buil Skip Confirm\n');
await vi.advanceTimersByTimeAsync(400);
expect(pty.write.mock.calls.map(([data]) => data)).toEqual(['\x1b']);
await vi.advanceTimersByTimeAsync(2000);