feat: input parser probe-response recognition → CapabilityEvent - #132
Open
natemoo-re wants to merge 2 commits into
Open
natemoo-re wants to merge 2 commits into
natemoo-re wants to merge 2 commits into
Conversation
natemoo-re
added this pull request to stack #134
September 19, 2026 04:29
Changeset suggestionThis PR changes published packages but has no changeset. View the proposed changeset---
---
Adds `CapabilityEvent` to `InputEvent` and the `detection` option to `createInput()`.
`scan()` now recognises terminal probe responses — OSC 10/11/12 theme colors, OSC 21/22 Kitty color and pointer-shape reports, XTGETTCAP (`DCS +r`) truecolor replies, DECRPM synchronized-output status, Kitty keyboard flags, and Kitty graphics APC replies — and surfaces them as typed `CapabilityEvent` objects with keys `foreground-color`, `background-color`, `cursor-color`, `colordepth`, `sync-output`, `kitty-keyboard`, `kitty-graphics`, and `pointer-shape`.
Passing a `Detection` from `detectTerminal()` to `createInput({ detection })` seeds the key-sequence trie from the terminfo entry and primes the color-depth baseline used when emitting denial events.
The `terminfo` option on `InputOptions` is replaced by `detection`. The exported constant `MAX_TERMINFO` is removed.
#### Migration
```diff
-import { createInput } from "…/input.ts";
+import { createInput } from "…/input.ts";
+import { detectTerminal } from "…/terminfo.ts";
-const input = await createInput({ terminfo: myTerminfoBinary });
+const detection = await detectTerminal({ env: process.env });
+const input = await createInput({ detection });
```
If you referenced `MAX_TERMINFO` to validate a buffer, remove that check — the limit is now enforced internally.If this draft is correct, react with 🚀 and Cooper will commit it to this branch. |
commit: |
|
Size Increased — +15.2 KB 118.0 KB unpacked |
This was referenced Sep 19, 2026
Contributor
Merging this PR will degrade performance by 24.37%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
natemoo-re
force-pushed
the
feat/input-probe-events
branch
from
September 30, 2026 01:50
ff3f7c4 to
299df82
Compare
natemoo-re
force-pushed
the
feat/input-probe-events
branch
2 times, most recently
from
September 30, 2026 02:03
74c6281 to
4b430b6
Compare
natemoo-re
force-pushed
the
feat/input-probe-events
branch
from
September 30, 2026 15:11
4b430b6 to
fb273f9
Compare
natemoo-re
marked this pull request as ready for review
September 30, 2026 15:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 terminfokeystable 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 asCapabilityEventvalues interleaved with key and mouse events, ready to route toterm.update().test/input.test.ts(+test/caps.tshelpers): response recognition per input-spec §6.Breaking change
InputOptions.terminfo(raw compiled bytes) is replaced byInputOptions.detection, per terminfo-spec §2. Covered by the changeset on the final PR of the stack.