Skip to content

feat: input parser probe-response recognition → CapabilityEvent - #132

Draft
natemoo-re wants to merge 2 commits into
feat/terminfo-corefrom
feat/input-probe-events
Draft

natemoo-re wants to merge 2 commits into
feat/terminfo-corefrom
feat/input-probe-events

Conversation

@natemoo-re

@natemoo-re natemoo-re commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Part 3/4 of the terminfo foundation stack. Requires #131; draft until the spec (#130) is approved.

What this adds

  • src/input.{c,h}: the input parser seeds its escape-sequence trie from the terminfo keys table and recognizes probe responses — OSC 10/11/12/21/22, XTGETTCAP, DECRPM (mode 2026), kitty keyboard/graphics APC, and the DA1 completion fence — emitting typed capability records alongside key/mouse events.
  • input-native.ts / input.ts: createInput({ detection }) wires the detection in; scan() surfaces probe responses as CapabilityEvent values interleaved with key and mouse events, ready to route to term.update().
  • test/input.test.ts (+ test/caps.ts helpers): response recognition per input-spec §6.

Breaking change

InputOptions.terminfo (raw compiled bytes) is replaced by InputOptions.detection, per terminfo-spec §2. Covered by the changeset on the final PR of the stack.

@natemoo-re
natemoo-re added this pull request to stack #134 September 19, 2026 04:29
@bombshell-cooper

bombshell-cooper Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Changeset suggestion

This PR changes published packages but has no changeset.

View the proposed changeset
---
---

Adds `CapabilityEvent` to `InputEvent` and a `detection` option to `createInputOptions`.

`scan()` now parses terminal probe responses — OSC 10/11/12 (theme colors), OSC 21 (kitty color protocol), OSC 22 (pointer shape), DCS XTGETTCAP replies (color depth), APC kitty graphics replies, CSI `?…u` kitty keyboard flags, and DECRPM (`$y`) synchronized output — and surfaces them as typed `CapabilityEvent` objects with strongly-typed `key`/`value` pairs.

Pass a `Detection` from `detectTerminal()` to seed the key trie with terminal-specific sequences and calibrate color-depth denial events; omit it to keep the existing xterm-default behavior.

#### Migration

`InputOptions.terminfo` is replaced by `InputOptions.detection`:

```diff
- import { createInput } from "@bombshell/input";
+ import { createInput } from "@bombshell/input";
+ import { detectTerminal } from "@bombshell/input/terminfo";

- const input = await createInput({ terminfo: myTerminfoBinary });
+ const detection = await detectTerminal();
+ const input = await createInput({ detection });
```

If you were not passing `terminfo`, no change is needed.

Add this changeset manually

If this draft is correct, react with 🚀 and Cooper will commit it to this branch.

@pkg-pr-new

pkg-pr-new Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@bomb.sh/tty@132

commit: 4b430b6

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Size Increased — +15.2 KB

118.0 KB unpacked

@natemoo-re natemoo-re changed the title feat/input probe events feat: input parser probe-response recognition → CapabilityEvent Sep 19, 2026
@codspeed

codspeed Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 24.19%

❌ 1 regressed benchmark
✅ 9 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ createInput 273.1 ms 360.2 ms -24.19%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/input-probe-events (4b430b6) with feat/terminfo-core (c3cb6d6)1

Open in CodSpeed

Footnotes

  1. No successful run was found on feat/terminfo-core (c041c67) during the generation of this report, so 8fcb017 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@natemoo-re
natemoo-re force-pushed the feat/input-probe-events branch from ff3f7c4 to 299df82 Compare September 30, 2026 01:50
@natemoo-re
natemoo-re force-pushed the feat/input-probe-events branch from 299df82 to 74c6281 Compare September 30, 2026 02:01
@natemoo-re
natemoo-re force-pushed the feat/input-probe-events branch from 74c6281 to 4b430b6 Compare September 30, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant