mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-20 09:09:35 +02:00
fix: emit needsRefresh after OpenCode TUI stabilizes
After the 3s TUI stabilization timeout, emit needsRefresh so the client fetches the full terminal buffer. Without this, the terminal appears empty until the user manually refreshes or switches tabs. Wire needsRefresh as a proper session listener in server.ts with cleanup in both removal paths to prevent memory leaks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5ad0e7f9b4
commit
2e3a08fad2
2 files changed
+11
No files matched your search
@@ -307,6 +307,7 @@ function getOrCreateSelfSignedCert(): { key: string; cert: string } {
|
||||
interface SessionListenerRefs {
|
||||
terminal: (data: string) => void;
|
||||
clearTerminal: () => void;
|
||||
needsRefresh: () => void;
|
||||
message: (msg: ClaudeMessage) => void;
|
||||
error: (error: string) => void;
|
||||
completion: (result: string, cost: number) => void;
|
||||
@@ -4169,6 +4170,7 @@ NOW: Generate the implementation plan for the task above. Think step by step.`;
|
||||
if (listeners) {
|
||||
session.off('terminal', listeners.terminal);
|
||||
session.off('clearTerminal', listeners.clearTerminal);
|
||||
session.off('needsRefresh', listeners.needsRefresh);
|
||||
session.off('message', listeners.message);
|
||||
session.off('error', listeners.error);
|
||||
session.off('completion', listeners.completion);
|
||||
@@ -4238,6 +4240,11 @@ NOW: Generate the implementation plan for the task above. Think step by step.`;
|
||||
this.broadcast('session:clearTerminal', { id: session.id });
|
||||
},
|
||||
|
||||
needsRefresh: () => {
|
||||
// Tell clients to reload the terminal buffer (e.g., after OpenCode TUI stabilizes)
|
||||
this.broadcast('session:needsRefresh', { id: session.id });
|
||||
},
|
||||
|
||||
message: (msg: ClaudeMessage) => {
|
||||
this.broadcast('session:message', { id: session.id, message: msg });
|
||||
},
|
||||
@@ -4436,6 +4443,7 @@ NOW: Generate the implementation plan for the task above. Think step by step.`;
|
||||
// Attach all listeners to the session
|
||||
session.on('terminal', listeners.terminal);
|
||||
session.on('clearTerminal', listeners.clearTerminal);
|
||||
session.on('needsRefresh', listeners.needsRefresh);
|
||||
session.on('message', listeners.message);
|
||||
session.on('error', listeners.error);
|
||||
session.on('completion', listeners.completion);
|
||||
@@ -5611,6 +5619,7 @@ NOW: Generate the implementation plan for the task above. Think step by step.`;
|
||||
if (listeners) {
|
||||
session.off('terminal', listeners.terminal);
|
||||
session.off('clearTerminal', listeners.clearTerminal);
|
||||
session.off('needsRefresh', listeners.needsRefresh);
|
||||
session.off('message', listeners.message);
|
||||
session.off('error', listeners.error);
|
||||
session.off('completion', listeners.completion);
|
||||
|
||||
Reference in new issue
Block a user