diff --git a/docs/architecture-invariants.md b/docs/architecture-invariants.md index a10b1f72..011e0566 100644 --- a/docs/architecture-invariants.md +++ b/docs/architecture-invariants.md @@ -145,7 +145,7 @@ Spawn commands are pinned as literal strings in `test/cli-registry-spawn-golden. ### Input delivery and WS resilience -**Input**: `session.writeViaMux()` for programmatic/curl input — the text as one tmux bracketed paste (`paste-buffer -p`, so Codex cannot fold the Enter into a paste burst) + `send-keys Enter`. A single character is typed with `send-keys -l` instead (`submitsAsKeys()`): Claude Code's and Codex's selection dialogs ignore a pasted `3`, and the Enter then confirms the highlighted option. A multi-line prompt keeps its line breaks inside that one paste, with or without the Enter (fire-and-once). Interactive **browser** input goes through a durable **exactly-once** layer: each frame carries a stable `clientId` + monotonic per-session `seq`, persisted to localStorage until the server ACKs (`{t:'ia',seq}` over WS, or HTTP 2xx), so a dropped link/reconnect can't lose or double-deliver a prompt. A duplicate is ACKed as `{t:'ia',seq,dup:true,last}` so a client whose persisted counter rolled back below the server's watermark can lift itself out instead of typing into a silently dead terminal (`docs/reliable-input-delivery.md`). **WS resilience** (#149): the upgrade URL carries `cid = clientId + ':' + perTabNonce`, and `ws-connection-registry.ts` supersedes only same-TAB reconnects (two tabs on one session coexist; input frames keep the bare `clientId` for seq dedup); reconnects back off exponentially (attempts preserved across `_connectWs`), and the header connection chip renders from a real `_wsState` lifecycle (`connecting`/`connected`/`fallback`/`reconnecting`/`disconnected`). +**Input**: `session.writeViaMux()` for programmatic/curl input — the text as one tmux bracketed paste (`paste-buffer -p`, so Codex cannot fold the Enter into a paste burst) + `send-keys Enter`. A single character is typed with `send-keys -l` instead (`submitsAsKeys()`): Claude Code's and Codex's selection dialogs ignore a pasted `3`, and the Enter then confirms the highlighted option. A multi-line prompt keeps its line breaks inside that one paste, with or without the Enter (fire-and-once). Interactive **browser** input goes through a durable **exactly-once** layer: each frame carries a stable `clientId` + monotonic per-session `seq`, persisted to localStorage until the server ACKs (`{t:'ia',seq}` over WS, or HTTP 2xx), so a dropped link/reconnect can't lose or double-deliver a prompt. **Session FIFO** (`_enqueueInput`, app.js, #830): every browser producer (typed main-pane input, toolbar submit, accessory keys and commands, paste, Compose, voice, image upload) captures its session id when the user acts and enqueues ops (`write`, `key`, `gap`) on that session's FIFO, which drains in order into `_enqueueReliableInput`. ⚠️ A `gap` orders ENQUEUEING only: the next op is handed to the reliable layer after the delay, with no wait for the previous frame's ACK, so a delayed Enter keeps its session and its place but gains no delivery guarantee beyond the exactly-once layer. ⚠️ Ops for an id missing from `app.sessions` are dropped (a probe or deleted session never reaches the wire; tests must register their session). ⚠️ `_cleanupSessionData()` clears the session's FIFO and its pending gap timer, so a deleted session cannot type into a reused id. A duplicate is ACKed as `{t:'ia',seq,dup:true,last}` so a client whose persisted counter rolled back below the server's watermark can lift itself out instead of typing into a silently dead terminal (`docs/reliable-input-delivery.md`). **WS resilience** (#149): the upgrade URL carries `cid = clientId + ':' + perTabNonce`, and `ws-connection-registry.ts` supersedes only same-TAB reconnects (two tabs on one session coexist; input frames keep the bare `clientId` for seq dedup); reconnects back off exponentially (attempts preserved across `_connectWs`), and the header connection chip renders from a real `_wsState` lifecycle (`connecting`/`connected`/`fallback`/`reconnecting`/`disconnected`). ### Per-session env overrides: exact-key allowlist and CLAUDE_CONFIG_DIR diff --git a/docs/ios-native-input.md b/docs/ios-native-input.md index 6628b916..64e5e677 100644 --- a/docs/ios-native-input.md +++ b/docs/ios-native-input.md @@ -17,4 +17,4 @@ The browser runner also prepares the source-served vendor overlay through `prete The suite serves the real application with Chromium, an iPhone user agent, touch points and a coarse pointer. It observes `_enqueueReliableInput` without replacing `_sendInputAsync`, and reuses the phone-validated WebKit replay defaults. Assertions cover suggestion op boundaries, phrase replacement, held delete, dictation newline suppression, toolbar submission and subsequent suggestions, old-session CR ownership during the gap, trusted CDP paste, caret geometry in both echo modes, emoji deletion, tile session ownership and non-iOS recovery. -These are browser wiring tests, not a substitute for device replay. The original phone cases live in `IOS_DIAG.md` in the diagnostic case repository. +These are browser wiring tests, not a substitute for device replay. The logged iPhone event sequences they replay are in [#830](https://github.com/Ark0N/Codeman/issues/830). diff --git a/packages/xterm-zerolag-input/src/zerolag-input-addon.ts b/packages/xterm-zerolag-input/src/zerolag-input-addon.ts index 9fc0533c..4f96c77c 100644 --- a/packages/xterm-zerolag-input/src/zerolag-input-addon.ts +++ b/packages/xterm-zerolag-input/src/zerolag-input-addon.ts @@ -640,7 +640,7 @@ export class ZerolagInputAddon implements XtermAddon { } else { this._lastPromptPos = prompt; } - } else { + } else if (!this._lastPromptPos) { this._overlay.style.display = 'none'; return; } diff --git a/packages/xterm-zerolag-input/test/zerolag-input-addon.test.ts b/packages/xterm-zerolag-input/test/zerolag-input-addon.test.ts index 677d0b8c..f4f98bec 100644 --- a/packages/xterm-zerolag-input/test/zerolag-input-addon.test.ts +++ b/packages/xterm-zerolag-input/test/zerolag-input-addon.test.ts @@ -950,13 +950,15 @@ describe('input end anchor and layout subscriptions', () => { expect(addon.getInputEndAnchor()).toBeNull(); }); - it('returns null when a previously visible prompt is no longer found', () => { + it('keeps painting at the last prompt when a redraw briefly hides the prompt marker', () => { const { addon, mock } = layoutSetup(); addon.appendText('abc'); + const before = addon.getInputEndAnchor(); + expect(before).not.toBeNull(); mock.setLines(['output without a prompt']); addon.rerender(); - expect(addon.getInputEndAnchor()).toBeNull(); - expect(addon.state.visible).toBe(false); + expect(addon.state.visible).toBe(true); + expect(addon.getInputEndAnchor()).toEqual(before); }); it('publishes null on a scroll hide before repainting', () => { diff --git a/src/web/CLAUDE.md b/src/web/CLAUDE.md index cacc7b86..6c247e86 100644 --- a/src/web/CLAUDE.md +++ b/src/web/CLAUDE.md @@ -78,7 +78,7 @@ Frontend JS modules have `@fileoverview` with `@dependency`/`@loadorder` tags. L **Shell keyboard accessory bar + one-shot Ctrl** (`keyboard-accessory.js`): a shell-mode session swaps the mobile accessory bar for terminal controls; `setMode()` records `extendedKeyboardBar` as the base layout and `refreshForActiveSession()` resolves base-vs-shell. ⚠️ Ctrl is a one-shot modifier applied in `terminal.onData` (after `shouldSuppressTerminalQueryResponse`, before every send path), and must skip `isTerminalFocusOrMouseReport()` chunks. ⚠️ It must disarm on use, second tap, any other accessory key, session switch, keyboard dismissal and layout swap. ⚠️ `_handleCjkInput()` must apply it too (the CJK textarea bypasses onData). Mapping: `ctrlByteFor()`. ⚠️ mobile.css's light-skin repaint must keep excluding `.accessory-btn:not(.armed)` or the armed state is invisible. → [architecture-invariants#shell-keyboard-accessory-bar-and-one-shot-ctrl](../../docs/architecture-invariants.md#shell-keyboard-accessory-bar-and-one-shot-ctrl) -**Mobile prompt composer** (`keyboard-accessory.js`): the agent bars' Paste key is **Compose**, a native multiline dialog where only **Send** submits (the shell bar keeps plain Paste). Opening it adopts the whole terminal prompt (`_takePendingLocalEcho`), erasing the flushed prefix with backspaces counted in code points. ⚠️ Drafts are per-session and in memory only (`_composerDrafts`), never persisted (prompts carry secrets). ⚠️ Delivery is a hand-built bracketed-paste frame via `_sendInputAsync` WITHOUT `useMux`, then a separate delayed Enter WITH it; never `terminal.paste()`, and the frame must never take the mux fallback (`TmuxManager.sendInput()` strips every `\r`, the frame's line separator, so the lines weld into one inside a second pair of markers and get submitted). ⚠️ `_composerMaxLength` must stay derived from `MAX_INPUT_LENGTH` minus the markers, or an oversized frame wedges the durable queue. ⚠️ The composer overlay needs its own gutter restatement after the fold rules. The textarea carries `dir="auto"`, so a prompt written in Persian, Arabic or Hebrew lays out right to left from its first letter (#715). Test: `test/mobile-prompt-composer.test.ts`. → [architecture-invariants#mobile-prompt-composer](../../docs/architecture-invariants.md#mobile-prompt-composer) +**Mobile prompt composer** (`keyboard-accessory.js`): the agent bars' Paste key is **Compose**, a native multiline dialog where only **Send** submits (the shell bar keeps plain Paste). Opening it adopts the whole terminal prompt (`_takePendingLocalEcho`), erasing the flushed prefix with backspaces counted in code points. ⚠️ Drafts are per-session and in memory only (`_composerDrafts`), never persisted (prompts carry secrets). ⚠️ Delivery is a hand-built bracketed-paste frame enqueued on the session FIFO (`_enqueueInput`, `_sendBracketedPaste()`) WITHOUT `useMux`, then a `gap` and a separate Enter WITH it; never `terminal.paste()`, and the frame must never take the mux fallback (`TmuxManager.sendInput()` strips every `\r`, the frame's line separator, so the lines weld into one inside a second pair of markers and get submitted). ⚠️ `_composerMaxLength` must stay derived from `MAX_INPUT_LENGTH` minus the markers, or an oversized frame wedges the durable queue. ⚠️ The composer overlay needs its own gutter restatement after the fold rules. The textarea carries `dir="auto"`, so a prompt written in Persian, Arabic or Hebrew lays out right to left from its first letter (#715). Test: `test/mobile-prompt-composer.test.ts`. → [architecture-invariants#mobile-prompt-composer](../../docs/architecture-invariants.md#mobile-prompt-composer) **Terminal resilience**: a replay clear is the queued in-stream `\x1bc` in `_resetTerminalForReplay()`, never `reset()`/`clear()` (queued bytes fuse into the snapshot); the renderer watchdog `_kickRenderer()` reads xterm privates, pinned by `test/xterm-private-api.test.ts` against the resolved lockfile version; every terminal capture fetch has a deadline that covers the BODY (`_fetchTerminalCapture`). → [architecture-invariants#terminal-resilience-replay-clears-renderer-liveness-fetch-deadlines](../../docs/architecture-invariants.md#terminal-resilience-replay-clears-renderer-liveness-fetch-deadlines) diff --git a/src/web/public/keyboard-accessory.js b/src/web/public/keyboard-accessory.js index ae0d1dc8..4662d394 100644 --- a/src/web/public/keyboard-accessory.js +++ b/src/web/public/keyboard-accessory.js @@ -1345,9 +1345,10 @@ const KeyboardAccessoryBar = { }, /** Send a slash command to the active session. - * Sends text and Enter separately so Ink processes them as distinct events. */ + * Sends text and Enter separately so Ink processes them as distinct events. + * The unsent local-echo draft stays in the overlay: flushing it would submit `draft/command`. */ sendCommand(command) { - const sessionId = this._prepareInput(undefined, 'accessory-command', { flushEcho: true }); + const sessionId = this._prepareInput(undefined, 'accessory-command'); if (!sessionId) return; app._enqueueInput(sessionId, [{ write: command, useMux: true }, { gap: 120 }, { write: '\r', useMux: true }]); }, diff --git a/test/mobile/keyboard.test.ts b/test/mobile/keyboard.test.ts index 23576bc2..de29e973 100644 --- a/test/mobile/keyboard.test.ts +++ b/test/mobile/keyboard.test.ts @@ -865,7 +865,7 @@ describe('Virtual Keyboard', () => { }, suppressBufferDetection() {}, }; - app._sendInputAsync = (_sessionId: string, input: string) => { + app._enqueueReliableInput = (_sessionId: string, input: string) => { window.__sentInputs.push(input); }; const settings = app.loadAppSettingsFromStorage(); @@ -1018,7 +1018,7 @@ describe('Virtual Keyboard', () => { cliVersion: '2.1.220', status: 'running', }); - app._sendInputAsync = (_sessionId: string, input: string) => { + app._enqueueReliableInput = (_sessionId: string, input: string) => { window.__sentInputs.push(input); }; app.hideWelcome(); @@ -1074,7 +1074,7 @@ describe('Virtual Keyboard', () => { mode: 'codex', status: 'running', }); - app._sendInputAsync = (_sessionId: string, input: string) => { + app._enqueueReliableInput = (_sessionId: string, input: string) => { window.__sentInputs.push(input); }; app.hideWelcome(); @@ -1120,7 +1120,7 @@ describe('Virtual Keyboard', () => { cliVersion: '2.1.220', status: 'working', }); - app._sendInputAsync = (_sessionId: string, input: string) => { + app._enqueueReliableInput = (_sessionId: string, input: string) => { window.__sentInputs.push(input); }; app.hideWelcome(); @@ -1179,7 +1179,7 @@ describe('Virtual Keyboard', () => { cliVersion: '2.1.220', status: 'working', }); - app._sendInputAsync = (_sessionId: string, input: string) => { + app._enqueueReliableInput = (_sessionId: string, input: string) => { window.__sentInputs.push(input); }; app.hideWelcome(); @@ -1273,7 +1273,7 @@ describe('Virtual Keyboard', () => { mode: 'codex', status: 'running', }); - app._sendInputAsync = (_sessionId: string, input: string) => { + app._enqueueReliableInput = (_sessionId: string, input: string) => { window.__sentInputs.push(input); }; app.hideWelcome(); @@ -1317,7 +1317,7 @@ describe('Virtual Keyboard', () => { mode: 'claude', status: 'running', }); - app._sendInputAsync = (_sessionId: string, input: string) => { + app._enqueueReliableInput = (_sessionId: string, input: string) => { window.__sentInputs.push(input); }; app.hideWelcome(); @@ -1461,7 +1461,7 @@ describe('Virtual Keyboard', () => { status: 'running', }); app.hideWelcome(); - app._sendInputAsync = (_sessionId: string, input: string) => { + app._enqueueReliableInput = (_sessionId: string, input: string) => { window.__sentInputs.push(input); }; const settings = app.loadAppSettingsFromStorage(); @@ -1542,7 +1542,7 @@ describe('Virtual Keyboard', () => { status: 'running', }); app.hideWelcome(); - app._sendInputAsync = (_sessionId: string, input: string) => { + app._enqueueReliableInput = (_sessionId: string, input: string) => { window.__sentInputs.push(input); }; const settings = app.loadAppSettingsFromStorage(); @@ -1591,7 +1591,7 @@ describe('Virtual Keyboard', () => { // applied to the next character typed on the SYSTEM keyboard, which on a // phone reaches the app as xterm onData text, not a key event. These drive // the real xterm instance with page.keyboard.type() and assert on what would - // go out on the wire (_sendInputAsync), not on DOM state alone. + // go out on the wire (_enqueueReliableInput, behind the session FIFO), not on DOM state alone. describe('Shell keyboard bar', () => { let context: BrowserContext; @@ -1620,14 +1620,14 @@ describe('Virtual Keyboard', () => { async function typeAndCapture(text: string): Promise { await page.evaluate(`(function () { window.__sent = []; - if (!app.__origSend) app.__origSend = app._sendInputAsync; - app._sendInputAsync = function (sessionId, input) { window.__sent.push(input); }; + if (!app.__origSend) app.__origSend = app._enqueueReliableInput; + app._enqueueReliableInput = function (sessionId, input) { window.__sent.push(input); }; app.terminal.focus(); })()`); await page.keyboard.type(text); await page.waitForTimeout(200); const sent = (await page.evaluate(`window.__sent`)) as string[]; - await page.evaluate(`(function () { app._sendInputAsync = app.__origSend; })()`); + await page.evaluate(`(function () { app._enqueueReliableInput = app.__origSend; })()`); return sent; } diff --git a/test/shift-enter-keypress-swallowed.test.ts b/test/shift-enter-keypress-swallowed.test.ts new file mode 100644 index 00000000..b481413e --- /dev/null +++ b/test/shift-enter-keypress-swallowed.test.ts @@ -0,0 +1,24 @@ +// @vitest-environment node +// Regression guard: xterm runs the custom key handler for keydown AND keypress. +// It discards a keypress carrying Ctrl/Alt but not one carrying only Shift, so +// a handler that returns false for keydown alone lets Shift+Enter's keypress +// through as a bare \r (submit). The Enter gate must therefore not be keyed on +// ev.type === 'keydown'; only the send-key fetch is. The main pane may add an +// iOS clause after the modifier test (#830), which must not test ev.type either. + +import { readFileSync } from 'node:fs'; +import { join } from 'node:path'; +import { describe, expect, it } from 'vitest'; + +const PUBLIC = join(new URL('.', import.meta.url).pathname, '../src/web/public'); +const GATE = /if \(ev\.key === 'Enter' && \(ev\.shiftKey \|\| ev\.ctrlKey\)(.*)\) \{/; + +describe.each(['terminal-ui.js', 'terminal-tile.js'])('%s Shift/Ctrl+Enter handler', (file) => { + const src = readFileSync(join(PUBLIC, file), 'utf8'); + + it('swallows every event type for Shift/Ctrl+Enter', () => { + const gate = src.match(GATE); + expect(gate, 'Shift/Ctrl+Enter gate not found').not.toBeNull(); + expect(gate![0]).not.toContain('ev.type'); + }); +}); diff --git a/test/shift-enter-keypress.browser.test.ts b/test/shift-enter-keypress.browser.test.ts index bf87a603..17a501a6 100644 --- a/test/shift-enter-keypress.browser.test.ts +++ b/test/shift-enter-keypress.browser.test.ts @@ -38,6 +38,25 @@ interface Pressed { focused: boolean; } +/** The slice of the page's `app` and probe globals that pressMain() swaps and restores. */ +interface MainProbeWindow { + app: { + activeSessionId: string | null; + _localEchoEnabled: boolean; + _enqueueReliableInput: (sessionId: string, chunk: string) => void; + _pendingInput?: Map; + sessions: Map; + terminal: { focus(): void; textarea?: HTMLTextAreaElement }; + }; + __mainSaved?: { + id: string | null; + echo: boolean; + send: (sessionId: string, chunk: string) => void; + }; + __mainData: string[]; + __sendKeys: string[]; +} + describe('Shift/Ctrl+Enter through the shipped key handlers (keypress must be swallowed too)', () => { let server: WebServer; let browser: Browser; @@ -105,36 +124,49 @@ describe('Shift/Ctrl+Enter through the shipped key handlers (keypress must be sw /** * Press `key` in the main pane. `sessionId` null is the welcome screen; otherwise the app thinks - * that session is active, local echo is off (the desktop default) and its real send path, - * `_sendInputAsync`, is recorded instead of posting. + * that session is active, local echo is off (the desktop default), the probe id is registered in + * `app.sessions` (the session FIFO drops input for unknown ids), and the transport edge, + * `_enqueueReliableInput`, is recorded instead of posting. */ async function pressMain(key: string, sessionId: string | null): Promise { await page.evaluate((id) => { - const w = window as any; + const w = window as unknown as MainProbeWindow; const app = w.app; - w.__mainSaved ??= { id: app.activeSessionId, echo: app._localEchoEnabled, send: app._sendInputAsync }; - w.__mainData = [] as string[]; + w.__mainSaved ??= { id: app.activeSessionId, echo: app._localEchoEnabled, send: app._enqueueReliableInput }; + w.__mainData = []; w.__sendKeys.length = 0; app.activeSessionId = id; app._localEchoEnabled = false; - app._pendingInput = ''; - app._sendInputAsync = (_sid: string, chunk: string) => void w.__mainData.push(chunk); + if (id) { + app._pendingInput?.delete(id); + app.sessions.set(id, { id, mode: 'claude' }); + } + app._enqueueReliableInput = (_sid: string, chunk: string) => void w.__mainData.push(chunk); app.terminal.focus(); }, sessionId); - const focused = await page.evaluate(() => document.activeElement === (window as any).app.terminal.textarea); + const focused = await page.evaluate( + () => document.activeElement === (window as unknown as MainProbeWindow).app.terminal.textarea + ); await page.keyboard.press(key); - // The main pane batches onData through a short flush timer before _sendInputAsync. + // The main pane batches onData through a short flush timer before the session FIFO. await page.waitForTimeout(150); - return page.evaluate((f) => { - const w = window as any; - const app = w.app; - const out = { data: [...w.__mainData], sendKeys: [...w.__sendKeys], focused: f }; - app.activeSessionId = w.__mainSaved.id; - app._localEchoEnabled = w.__mainSaved.echo; - app._sendInputAsync = w.__mainSaved.send; - app._pendingInput = ''; - return out; - }, focused); + return page.evaluate( + ({ f, id }) => { + const w = window as unknown as MainProbeWindow; + const app = w.app; + const saved = w.__mainSaved!; + const out = { data: [...w.__mainData], sendKeys: [...w.__sendKeys], focused: f }; + app.activeSessionId = saved.id; + app._localEchoEnabled = saved.echo; + app._enqueueReliableInput = saved.send; + if (id) { + app._pendingInput?.delete(id); + app.sessions.delete(id); + } + return out; + }, + { f: focused, id: sessionId } + ); } async function pressIn(which: 'paneB' | 'old', key: string): Promise { diff --git a/test/terminal-input-fifo.test.ts b/test/terminal-input-fifo.test.ts index 641493a9..633cb337 100644 --- a/test/terminal-input-fifo.test.ts +++ b/test/terminal-input-fifo.test.ts @@ -620,7 +620,7 @@ describe('native main transactions and boundaries', () => { } ); - it.each(['upload', 'voice', 'Esc', 'command', 'paste'])( + it.each(['upload', 'voice', 'Esc', 'paste'])( '%s preserves the typed prefix before direct writes with echo on or off', async (producer) => { for (const echo of [true, false]) { @@ -668,14 +668,6 @@ describe('native main transactions and boundaries', () => { ['old', 'hel'], ['old', '\x1b'], ]); - } else if (producer === 'command') { - vm.runInContext("KeyboardAccessoryBar.sendCommand('/help')", context); - expect(wire).toEqual([ - ['old', 'hel'], - ['old', '/help'], - ]); - vi.advanceTimersByTime(120); - expect(wire.at(-1)).toEqual(['old', '\r']); } else { vm.runInContext("KeyboardAccessoryBar._sendBracketedPaste('old', 'world', 'Paste')", context); expect(wire).toEqual([ @@ -688,6 +680,20 @@ describe('native main transactions and boundaries', () => { } ); + it('sends a slash command without submitting the unsent local-echo draft', () => { + for (const echo of [true, false]) { + const { app, wire, context } = harness(); + loadProducerModules(app, context); + app._localEchoEnabled = echo; + app._handleTerminalData('hel', 'old'); + vm.runInContext("KeyboardAccessoryBar.sendCommand('/help')", context); + vi.advanceTimersByTime(120); + // Echo on: `hel` stays in the overlay. Echo off: it was already typed into the PTY. + expect(wire).toEqual([...(echo ? [] : [['old', 'hel']]), ['old', '/help'], ['old', '\r']]); + expect(app._localEchoOverlay.pendingText).toBe(echo ? 'hel' : ''); + } + }); + it('keeps the typed prefix in the overlay when a toolbar attachment appends', async () => { const { app, wire, context } = harness(); loadProducerModules(app, context); diff --git a/test/xterm-private-api.test.ts b/test/xterm-private-api.test.ts index ede5f239..4f08b3fa 100644 --- a/test/xterm-private-api.test.ts +++ b/test/xterm-private-api.test.ts @@ -51,7 +51,9 @@ describe('xterm private-API dependency guard', () => { 'CompositionHelper fields installEditSync() uses (terminal-keycode229-recovery.js: ' + '_handleAnyTextareaChanges, _coreService, _isComposing, _isSendingComposition, _dataAlreadySent) ' + 'and the mouse-encoding read _shouldForwardTouchToApp makes (terminal-ui.js: ' + - '_core.coreMouseService.activeEncoding), then update VERIFIED_XTERM_VERSION here. ' + + '_core.coreMouseService.activeEncoding) and the iOS native-input owner (terminal-ios-native-input.js: ' + + '_core._inputEvent, _core._handleTextAreaBlur, _compositionHelper._finalizeComposition, ' + + '_compositionHelper._compositionView), then update VERIFIED_XTERM_VERSION here. ' + 'The accessor is optional-chained, so a renamed field ' + 'degrades to a silent no-op and the freeze it heals comes back unnoticed.' ).toBe(VERIFIED_XTERM_VERSION); @@ -67,6 +69,9 @@ describe('xterm private-API dependency guard', () => { // only to an app that asked for SGR mouse reports; if either name changes the read is undefined // and touch quietly stops forwarding to native SGR tracking apps. Property names survive // minification, so a string check on the shipped bundle catches a rename on upgrade. + // terminal-ios-native-input.js wraps `_inputEvent`, `_handleTextAreaBlur` and `_finalizeComposition` + // and reads `_compositionView`; if any is missing its create() returns null, and iOS then gets + // neither the native-input owner nor the keyCode-229 recovery, so #830 returns without a signal. it('still ships the composition-helper and mouse-service fields terminal input depends on', () => { const bundle = readFileSync(resolve(root, 'node_modules/@xterm/xterm/lib/xterm.js'), 'utf8'); for (const name of [ @@ -78,12 +83,17 @@ describe('xterm private-API dependency guard', () => { '_dataAlreadySent', 'coreMouseService', 'activeEncoding', + '_inputEvent', + '_handleTextAreaBlur', + '_finalizeComposition', + '_compositionView', ]) { expect( bundle, `xterm no longer mentions ${name}: re-verify terminal-keycode229-recovery.js installEditSync() ` + - 'against the new CompositionHelper, and terminal-ui.js _shouldForwardTouchToApp against the ' + - 'new CoreMouseService (both in src/web/public), before bumping VERIFIED_XTERM_VERSION' + 'against the new CompositionHelper, terminal-ios-native-input.js create() against the new ' + + 'CoreBrowserTerminal and CompositionHelper, and terminal-ui.js _shouldForwardTouchToApp against the ' + + 'new CoreMouseService (all in src/web/public), before bumping VERIFIED_XTERM_VERSION' ).toContain(name); } });