Skip to content

Share the terminal-reply table between the server gate and the web client (codev-types) #1885

Open

Description

@waleedkadous

Problem

xterm.js sends a TUI's terminal replies (DA, CPR, DECRPM, XTWINOPS, OSC colour reports, focus reports) through onData, the same event as typed input. Three places need to tell the two apart, and each has its own copy of the patterns:

The web copies miss the rest of the server table (XTWINOPS, DSR ESC[0n, focus reports, DECRQSS, OSC colour reports). So for those replies, the IME bridge still treats a mid-typing reply as input. The failure is loud (a [Terminal IME #1883] console error), not silent, but it is avoidable.

Proposal

Move the reply table (the patterns and a pure stripTerminalReplies) into @cluesmith/codev-types. The types package carries runtime constants and is the only package both server and client may import (see the server/client isolation boundary, #1189). Then:

  • packages/codev/src/terminal/terminal-replies.ts imports it; its version-pin test stays with it.
  • apps/web/src/components/Terminal.tsx replaces its three inline regexes with the shared function, for both the initial-phase filter and the IME bridge's foreign-input skip.

Care point, from the server module's own notes: the server table treats over-stripping as the safe direction. The IME bridge is the opposite: over-stripping a real keystroke would let a later replace delete into it. The shared table must stay anchored one shape at a time (it already is) and keep its keystroke-survival tests.

Found during the integration review of PR #1884 (mobile IME replace fix).

Activity

  1. added
    area/cross-cutting
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cross-cutting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions