Skip to content

Add option to suppress terminal responses#165

Open
assimelha wants to merge 1 commit into
coder:mainfrom
codingagentsystem:codex/emit-terminal-responses-option
Open

Add option to suppress terminal responses#165
assimelha wants to merge 1 commit into
coder:mainfrom
codingagentsystem:codex/emit-terminal-responses-option

Conversation

@assimelha
Copy link
Copy Markdown

Summary

Adds an emitTerminalResponses terminal option that defaults to the current behavior. When enabled, terminal-generated query replies continue to flow through onData. When disabled, writes are still parsed and rendered, but parser-generated replies such as DSR responses are not emitted through the same onData stream as user keyboard input.

Why

Some embedders terminate terminal queries at the PTY boundary or server-side mux layer. In those integrations, renderer-generated replies can race with or duplicate server-side replies, and because they are emitted through onData, they are indistinguishable from user input to the PTY. This option lets those embedders keep onData user-input-only while preserving the existing default behavior for browser-managed PTY integrations.

Validation

  • bun run typecheck
  • bun run fmt
  • bun run lint
  • bun run build:wasm
  • bun test lib/terminal.test.ts
  • git diff --check

@assimelha assimelha marked this pull request as ready for review May 18, 2026 19:01
diegosouzapw added a commit to diegosouzapw/ghostty-web that referenced this pull request May 23, 2026
…eplies

Some embedders answer terminal queries (DSR cursor position, device
attributes, etc.) at the PTY boundary or server-side mux layer. In those
integrations, renderer-generated replies race with or duplicate the
server-side replies and — because they are emitted through onData — are
indistinguishable from real user input to the PTY.

This commit adds an opt-in option:

- emitTerminalResponses?: boolean on ITerminalOptions (default: true).
  Preserves the current behaviour — parser-generated replies flow
  through onData as before.
- When false, the terminal still parses and renders queries normally,
  but processTerminalResponses() is skipped on each write so onData
  carries only user-keyboard input.

Includes two regression tests covering both option values via \\x1b[5n
(DSR "are you there?").

Co-authored-by: assim <hello@assim.me>
Inspired-by: coder#165
diegosouzapw added a commit to diegosouzapw/ghostty-web that referenced this pull request May 23, 2026
…eplies (#7)

Some embedders answer terminal queries (DSR cursor position, device
attributes, etc.) at the PTY boundary or server-side mux layer. In those
integrations, renderer-generated replies race with or duplicate the
server-side replies and — because they are emitted through onData — are
indistinguishable from real user input to the PTY.

This commit adds an opt-in option:

- emitTerminalResponses?: boolean on ITerminalOptions (default: true).
  Preserves the current behaviour — parser-generated replies flow
  through onData as before.
- When false, the terminal still parses and renders queries normally,
  but processTerminalResponses() is skipped on each write so onData
  carries only user-keyboard input.

Includes two regression tests covering both option values via \\x1b[5n
(DSR "are you there?").


Inspired-by: coder#165

Co-authored-by: assim <hello@assim.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant