The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(dashboard): retain composition after unrelated input
Denis H434f1e954c98
diff --git a/web/src/lib/pty-composition.test.ts b/web/src/lib/pty-composition.test.tsindex 0a0189320c6..5b533112c6a 100644--- a/web/src/lib/pty-composition.test.ts+++ b/web/src/lib/pty-composition.test.ts@@ -28,6 +28,18 @@ describe("createPtyCompositionForwarder", () => {expect(send).not.toHaveBeenCalled();});+ it("forwards a pending composition after unrelated terminal data", () => {+ vi.useFakeTimers();+ const send = vi.fn();+ const forwarder = createPtyCompositionForwarder(send);++ forwarder.onCompositionEnd("ä");+ forwarder.noteTerminalData("x");+ vi.runAllTimers();++ expect(send).toHaveBeenCalledExactlyOnceWith("ä");+ });+it("forwards a second composition after the first fallback completes", () => {vi.useFakeTimers();const send = vi.fn();diff --git a/web/src/lib/pty-composition.ts b/web/src/lib/pty-composition.tsindex 0fd7367c98f..f5074826ed5 100644--- a/web/src/lib/pty-composition.ts+++ b/web/src/lib/pty-composition.ts@@ -31,9 +31,8 @@ export function createPtyCompositionForwarder(send: (data: string) => void) {}, 16);},noteTerminalData(data: string) {- // A non-protocol xterm input in the short grace window is its own- // composition delivery (possibly chunked or normalization-different).- if (pending && !data.startsWith("\x1b")) clearPending();+ // xterm delivers the committed text before any following terminal input.+ if (pending && !data.startsWith("\x1b") && data.startsWith(pending)) clearPending();},dispose: clearPending,};