@wterm/core 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/terminal-core.d.ts +76 -1
- package/dist/terminal-core.d.ts.map +1 -1
- package/dist/transport.d.ts +30 -0
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +201 -43
- package/dist/transport.js.map +1 -1
- package/dist/wasm-bridge.d.ts +5 -3
- package/dist/wasm-bridge.d.ts.map +1 -1
- package/dist/wasm-bridge.js +33 -5
- package/dist/wasm-bridge.js.map +1 -1
- package/dist/wasm-inline.d.ts +1 -1
- package/dist/wasm-inline.d.ts.map +1 -1
- package/dist/wasm-inline.js +1 -1
- package/dist/wasm-inline.js.map +1 -1
- package/package.json +2 -2
- package/wasm/wterm.wasm +0 -0
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ npm install @wterm/core
|
|
|
22
22
|
|
|
23
23
|
## Pluggable Cores
|
|
24
24
|
|
|
25
|
-
`@wterm/core` defines a `TerminalCore` interface that any terminal emulation backend can implement. The built-in `WasmBridge` implements it using wterm's lightweight Zig WASM binary (~
|
|
25
|
+
`@wterm/core` defines a `TerminalCore` interface that any terminal emulation backend can implement. The built-in `WasmBridge` implements it using wterm's lightweight Zig WASM binary (~26 KB). For additional protocols and proper grapheme handling, use [`@wterm/ghostty`](https://www.npmjs.com/package/@wterm/ghostty), which implements the same interface using libghostty.
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
import { WTerm } from "@wterm/dom";
|
|
@@ -38,6 +38,38 @@ const term = new WTerm(el, { core });
|
|
|
38
38
|
|
|
39
39
|
## API
|
|
40
40
|
|
|
41
|
+
### Terminal row metadata
|
|
42
|
+
|
|
43
|
+
`TerminalCore` optionally exposes `getRowMetadata(row)` for zero-based live
|
|
44
|
+
rows and `getScrollbackRowMetadata(offset)` for history, where offset zero is
|
|
45
|
+
the newest retained row. Both return a caller-owned `TerminalRowMetadata`
|
|
46
|
+
object or `null` when the row is unavailable:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import type { TerminalCore } from "@wterm/core";
|
|
50
|
+
|
|
51
|
+
function continuesIntoViewport(core: TerminalCore): boolean | undefined {
|
|
52
|
+
return core.getScrollbackRowMetadata?.(0)?.wrapsToNext;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`wrapsToNext` means the following row continues the same logical line;
|
|
57
|
+
`continuesPrevious` means this row continues the preceding row. Filling the
|
|
58
|
+
rightmost cell alone does not count as wrapping. The first retained row can
|
|
59
|
+
still continue a row that has been discarded.
|
|
60
|
+
|
|
61
|
+
These are current physical-row relationships, not stable line IDs. Read them
|
|
62
|
+
again after output, resize, reset, or screen changes; do not retain row indexes
|
|
63
|
+
across those operations. Ghostty implements both methods with its native wrap
|
|
64
|
+
flags. The lightweight core does not expose them, and older Ghostty WASM
|
|
65
|
+
binaries return `null`. Missing metadata means unknown, not a hard newline.
|
|
66
|
+
|
|
67
|
+
### Tracked cell positions
|
|
68
|
+
|
|
69
|
+
`TerminalCore.trackPosition?({ row, col })` returns a `TrackedTerminalPosition` or `null`. Coordinates are zero-based cells, with row zero at the oldest retained row. Call `resolve()` for its current `{ row, col }` after scrolling or reflow, and `dispose()` when finished. Resolution returns `null` after pruning, reset, screen switching, core reinitialization, or disposal; invalidated handles never refer to newly allocated positions. Disposal is idempotent.
|
|
70
|
+
|
|
71
|
+
Tracking follows a cell location, not its immutable contents. A caller preserving selected text must also check whether it was overwritten. Ghostty supports up to 64 simultaneous handles and returns `null` for invalid coordinates, exhausted capacity, or an older WASM binary without tracking exports. The built-in core does not provide this optional method.
|
|
72
|
+
|
|
41
73
|
### `WasmBridge`
|
|
42
74
|
|
|
43
75
|
Low-level interface to the Zig/WASM terminal state machine. Implements the `TerminalCore` interface.
|
|
@@ -50,7 +82,7 @@ bridge.init(80, 24);
|
|
|
50
82
|
bridge.writeString("Hello, world!\r\n");
|
|
51
83
|
|
|
52
84
|
const cell = bridge.getCell(0, 0); // { char, chars?, fg, bg, flags, width, linkUri?, linkId?, linkKey? }
|
|
53
|
-
const cursor = bridge.getCursor(); // { row, col, visible }
|
|
85
|
+
const cursor = bridge.getCursor(); // { row, col, visible, shape, blinking }
|
|
54
86
|
```
|
|
55
87
|
|
|
56
88
|
| Method | Description |
|
|
@@ -61,11 +93,12 @@ const cursor = bridge.getCursor(); // { row, col, visible }
|
|
|
61
93
|
| `writeRaw(data, afterChunk?)` | Write raw bytes, optionally running a callback after each internal chunk |
|
|
62
94
|
| `resize(cols, rows)` | Resize the terminal grid |
|
|
63
95
|
| `getCell(row, col)` | Get cell data, including optional resolved OSC 8 metadata (`linkUri`, explicit `linkId`, and opaque `linkKey`) |
|
|
64
|
-
| `getCursor()` | Get cursor state (`{ row, col, visible }`) |
|
|
65
|
-
| `getCols()` / `getRows()` | Get
|
|
96
|
+
| `getCursor()` | Get cursor state (`{ row, col, visible, shape?, blinking? }`) |
|
|
97
|
+
| `getCols()` / `getRows()` | Get applied grid dimensions after initialization or resize. The built-in core clamps requests to 1–1024 columns and 1–512 rows. |
|
|
66
98
|
| `isDirtyRow(row)` | Check if a row needs re-rendering |
|
|
67
99
|
| `clearDirty()` | Reset all dirty-row flags |
|
|
68
100
|
| `getTitle()` | Get pending title change (or `null`) |
|
|
101
|
+
| `getBellCount()` | Read and clear the number of pending BEL controls; `0` when none |
|
|
69
102
|
| `getResponse()` | Get pending host response (or `null`) |
|
|
70
103
|
| `getResourceState()` | Get optional core resource state, including built-in hyperlink identity saturation |
|
|
71
104
|
| `getScrollbackCount()` | Number of lines in the scrollback buffer |
|
|
@@ -75,8 +108,9 @@ const cursor = bridge.getCursor(); // { row, col, visible }
|
|
|
75
108
|
| `cursorKeysApp()` | Whether cursor keys are in application mode |
|
|
76
109
|
| `bracketedPaste()` | Whether bracketed paste mode is active |
|
|
77
110
|
| `usingAltScreen()` | Whether the alternate screen buffer is active |
|
|
78
|
-
| `mouseTracking()` | Active mouse tracking mode (`0`, `1000`, or `
|
|
79
|
-
| `mouseSgr()` | Whether SGR mouse encoding is active |
|
|
111
|
+
| `mouseTracking()` | Active mouse tracking mode (`0`, `1000`, `1002`, or `1003`) |
|
|
112
|
+
| `mouseSgr()` | Whether cell-coordinate SGR mouse encoding (1006) is active |
|
|
113
|
+
| `mouseEncoding()` | Active mouse wire format (`x10`, `utf8`, `sgr`, `urxvt`, or `sgr-pixels`). The DOM layer handles all five; `sgr-pixels` reports 1-based CSS pixels. |
|
|
80
114
|
| `focusEvents()` | Whether focus reporting is active |
|
|
81
115
|
| `synchronizedOutput()` | Whether synchronized output mode (2026) is active |
|
|
82
116
|
| `synchronizedOutputGeneration()` | Monotonic generation for synchronized output blocks |
|
|
@@ -84,8 +118,48 @@ const cursor = bridge.getCursor(); // { row, col, visible }
|
|
|
84
118
|
|
|
85
119
|
OSC 8 hyperlink metadata is optional so third-party `TerminalCore` implementations remain source-compatible. Cores should expose the resolved URI and an opaque semantic key rather than a private numeric index.
|
|
86
120
|
|
|
121
|
+
Wide CJK, fullwidth, and emoji codepoints occupy a leading cell with `width: 2` and a continuation with `width: 0`. Character insertion (`ICH`) and deletion (`DCH`) shift the requested number of columns from the cursor, replacing split wide characters with background-colored spaces. With automatic wrapping disabled, a wide character that cannot fit at the right edge leaves the row unchanged. A one-column terminal consumes wide characters as spaces.
|
|
122
|
+
|
|
123
|
+
`CellData.underlineStyle` optionally selects `"none"`, `"single"`, `"double"`,
|
|
124
|
+
`"curly"`, `"dotted"`, or `"dashed"`. It takes precedence over the underline flag
|
|
125
|
+
(`0x08`); when omitted, that flag selects a single underline. `underlineRgb`
|
|
126
|
+
is an optional resolved `0xRRGGBB` color, including `0` for black. Without it,
|
|
127
|
+
the underline follows the displayed foreground, including reverse video.
|
|
128
|
+
Ghostty supplies both fields for viewport and scrollback cells. The built-in
|
|
129
|
+
core and older Ghostty binaries keep flag-based single underlines. Custom cores
|
|
130
|
+
can adopt either optional field; `UnderlineStyle` is exported by `@wterm/core`.
|
|
131
|
+
|
|
132
|
+
`CellData.spacerHead` optionally identifies an empty right-edge cell left when a wide glyph wraps to the next row. Ghostty supplies it in live rows and history. Text extraction should omit these cells and width-zero continuations while preserving real spaces; an absent flag does not identify a spacer.
|
|
133
|
+
|
|
134
|
+
The built-in core supports ASCII (`B`), British (`A`), and DEC Special Graphics (`0`) designations for G0–G3. For example, `\x1b(0lqqk\x1b(B` produces `┌──┐`. SI/SO select G0/G1; `ESC n/o` select G2/G3, and `ESC N/O` select them for one character. Cursor save/restore preserves character-set state. Mapping affects ASCII characters only, so UTF-8 text remains intact.
|
|
135
|
+
|
|
136
|
+
`TerminalCore.getColorOverrides?()` returns a caller-owned
|
|
137
|
+
`TerminalColorOverrides` snapshot with optional `foreground`, `background`,
|
|
138
|
+
and `cursor` fields, each a 24-bit `0xRRGGBB` value. Zero is black. Omit a field
|
|
139
|
+
to use the host's current CSS theme. These are application overrides, not
|
|
140
|
+
configured theme colors, and reading them does not consume them. A missing
|
|
141
|
+
method is equivalent to an empty snapshot.
|
|
142
|
+
|
|
143
|
+
Ghostty supplies OSC 10/11/12 overrides and clears each with OSC 110/111/112.
|
|
144
|
+
Its native color state survives resize, screen switches, SGR 0, and RIS;
|
|
145
|
+
reinitialization clears it. Older WASM binaries and uninitialized/disposed
|
|
146
|
+
Ghostty cores return an empty snapshot. The built-in core omits this method.
|
|
147
|
+
|
|
148
|
+
`CursorState.shape` (`"block"`, `"bar"`, or `"underline"`) and `blinking` are
|
|
149
|
+
optional for custom cores. The built-in and Ghostty cores expose both fields
|
|
150
|
+
from DECSCUSR (`CSI Ps SP q`) and cursor blink mode (`CSI ? 12 h/l`). Missing
|
|
151
|
+
fields render as a steady block unless the host sets `cursorBlink`. Style 0
|
|
152
|
+
or an omitted parameter restores the default steady block; styles 1/2, 3/4,
|
|
153
|
+
and 5/6 select blinking/steady block, underline, and bar respectively.
|
|
154
|
+
|
|
87
155
|
`TerminalCore.kittyKeyboardFlags()` is also optional. The DOM input handler uses it to encode negotiated Kitty keyboard events; cores that omit it retain the existing legacy keyboard behavior.
|
|
88
156
|
|
|
157
|
+
The built-in core answers DEC private-mode status queries (`CSI ? Ps $ p`) through `getResponse()`. It reports `1` for set, `2` for reset, and `0` for unrecognized modes, including the current state of synchronized output (`?2026`), bracketed paste (`?2004`), mouse tracking and encoding, focus reporting, cursor modes, and alternate-screen modes. For example, `\x1b[?2026$p` receives `\x1b[?2026;2$y` until mode 2026 is enabled.
|
|
158
|
+
|
|
159
|
+
Primary device-attributes queries (`CSI c` or `CSI 0 c`) receive `\x1b[?1;2c` through `getResponse()`, identifying VT100 advanced-video support. Secondary and private variants receive no reply.
|
|
160
|
+
|
|
161
|
+
An operating-status query (`CSI 5 n`) receives `\x1b[0n`, indicating the terminal is ready. A cursor-position query (`CSI 6 n`) receives `\x1b[row;colR`. These replies share the same response queue as device attributes and preserve query order. Unsupported or malformed status requests receive no reply.
|
|
162
|
+
|
|
89
163
|
The built-in core reports its fixed hyperlink identity capacity through `getResourceState()`. When `hyperlinks.saturated` is true, new distinct OSC 8 links render as plain text and `hyperlinks.rejected` counts capacity-rejected opens. Existing identities remain valid.
|
|
90
164
|
|
|
91
165
|
### Optional terminal graphics
|
|
@@ -112,6 +186,76 @@ ws.connect();
|
|
|
112
186
|
ws.send("ls\n");
|
|
113
187
|
```
|
|
114
188
|
|
|
189
|
+
Outbound buffering is bounded by default: `maxBufferedBytes` is 1 MiB across
|
|
190
|
+
the transport queue and the current open socket's `bufferedAmount`, and
|
|
191
|
+
`maxBufferedMessages` allows 1,024 messages waiting in the transport. `send()`
|
|
192
|
+
throws `RangeError` before accepting any part of a message that would exceed
|
|
193
|
+
either limit. Catch it and show that input was not accepted; do not silently
|
|
194
|
+
discard the error or automatically retry commands.
|
|
195
|
+
|
|
196
|
+
`highWaterMark` (64 KiB) pauses socket writes; draining resumes at
|
|
197
|
+
`lowWaterMark` (16 KiB). A message larger than the high-water mark is sent intact
|
|
198
|
+
only when the socket buffer is empty. Message order and boundaries are preserved,
|
|
199
|
+
strings use UTF-8, and queued byte arrays are copied. Each drain processes at
|
|
200
|
+
most 64 messages, with 16 ms polling only while an open socket has pending data.
|
|
201
|
+
Browser background throttling can delay draining.
|
|
202
|
+
|
|
203
|
+
Read `bufferedAmount`, `queuedBytes`, `queuedMessages`, and `backpressured` for
|
|
204
|
+
queue state. Use `onBackpressure(paused)` to pause/resume producers; it reports
|
|
205
|
+
transitions at the high/low byte thresholds or when the message queue is full.
|
|
206
|
+
All limits are construction options. Byte/message caps and the high-water mark
|
|
207
|
+
must be positive safe integers, with `0 <= lowWaterMark < highWaterMark <=
|
|
208
|
+
maxBufferedBytes`. If only the byte cap is reduced, the default high-water mark
|
|
209
|
+
is clamped to it and the default low-water mark is one quarter of that value.
|
|
210
|
+
|
|
211
|
+
Before the first connection, sends are queued within these limits. Unexpected
|
|
212
|
+
disconnects retain only messages not yet handed to the socket; already-sent
|
|
213
|
+
bytes have uncertain delivery and are never replayed. `close()` clears the
|
|
214
|
+
transport queue and timers and rejects further sends until `connect()` is
|
|
215
|
+
called. Connecting to a different URL also discards unsent messages. Repeated
|
|
216
|
+
`connect()` calls for the same connecting/open socket do nothing; callbacks from
|
|
217
|
+
replaced sockets are ignored. These are client-side send bounds, not server
|
|
218
|
+
acknowledgments, PTY flow control, or session recovery.
|
|
219
|
+
|
|
220
|
+
## Host theme colors
|
|
221
|
+
|
|
222
|
+
`TerminalThemeColors` describes opaque 24-bit integer `foreground`, `background`,
|
|
223
|
+
and `cursor` colors plus exactly 16 `palette` entries. The optional
|
|
224
|
+
`TerminalCore.setThemeColors(colors)` updates host defaults without parsing bytes,
|
|
225
|
+
resetting state, or replacing application overrides. Ghostty implements this hook;
|
|
226
|
+
other cores remain compatible without it. Use `WTerm.setThemeColors()` for an
|
|
227
|
+
attached browser terminal so CSS and live/retained rendering update together.
|
|
228
|
+
|
|
229
|
+
## Clipboard write requests
|
|
230
|
+
|
|
231
|
+
`TerminalCore.getClipboardWrite?()` consumes the latest application request. `null` means none and `""` requests a clear. Ghostty implements this optional effect; older/custom and built-in cores may omit it. Hosts own acceptance and browser permissions; there is no clipboard-read API or automatic clipboard access.
|
|
232
|
+
|
|
233
|
+
## Working directories
|
|
234
|
+
|
|
235
|
+
The optional `TerminalCore.getWorkingDirectory()` consumes the latest OSC 7
|
|
236
|
+
URI, returning `null` when unchanged or unsupported and `""` when reset.
|
|
237
|
+
Ghostty retains up to 2047 UTF-8 bytes, coalesces pending reports, and clears the
|
|
238
|
+
value on RIS. Treat the URI as untrusted metadata; it does not establish a local
|
|
239
|
+
directory or authenticated host. WTerm forwards it through `onWorkingDirectory`.
|
|
240
|
+
|
|
241
|
+
## Shell integration state
|
|
242
|
+
|
|
243
|
+
`ShellIntegrationState` contains `phase` (`unknown`, `prompt`, `input`, `running`,
|
|
244
|
+
or `complete`) and `exitCode` (`number | null`). The optional
|
|
245
|
+
`TerminalCore.getShellIntegrationState()` consumes the latest state change;
|
|
246
|
+
`null` means unchanged or unsupported. Ghostty implements this hook for OSC 133.
|
|
247
|
+
The last valid or absent completion code is retained across prompt redraws until
|
|
248
|
+
command start or terminal reset. This is bounded current state, not a command
|
|
249
|
+
history. Returned snapshots belong to the caller. Cores that omit the hook
|
|
250
|
+
remain compatible; WTerm forwards new snapshots through `onShellIntegration`.
|
|
251
|
+
|
|
252
|
+
The optional `findPrompt(row, direction)` returns the preceding (`-1`) or
|
|
253
|
+
following (`1`) prompt's retained row, or `null` when none is available. Row zero
|
|
254
|
+
is the oldest retained row. The origin must be in the retained buffer; forward
|
|
255
|
+
navigation skips the current prompt's continuation rows. Ghostty uses its
|
|
256
|
+
retained OSC 133 metadata, follows reflow and pruning, and returns no prompt on
|
|
257
|
+
the alternate screen. The hook neither moves the cursor nor consumes shell state.
|
|
258
|
+
|
|
115
259
|
## License
|
|
116
260
|
|
|
117
261
|
Apache-2.0
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { CellData, CursorState, GraphicsResourceState, HyperlinkResourceState, TerminalGraphicsState, TerminalImageData, TerminalImageDescriptor, TerminalImagePlacement, TerminalResourceState, UnhandledSequence, TerminalCore, } from "./terminal-core.js";
|
|
1
|
+
export type { CellData, UnderlineStyle, CursorShape, CursorState, TerminalColorOverrides, TerminalThemeColors, ShellIntegrationState, GraphicsResourceState, HyperlinkResourceState, MouseEncoding, TerminalGraphicsState, TerminalImageData, TerminalImageDescriptor, TerminalImagePlacement, TerminalResourceState, TerminalRowMetadata, TerminalPosition, TrackedTerminalPosition, UnhandledSequence, TerminalCore, } from "./terminal-core.js";
|
|
2
2
|
export { WasmBridge } from "./wasm-bridge.js";
|
|
3
3
|
export { WebSocketTransport } from "./transport.js";
|
|
4
4
|
export type { WebSocketTransportOptions } from "./transport.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,QAAQ,EACR,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,YAAY,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,YAAY,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/terminal-core.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type UnderlineStyle = "none" | "single" | "double" | "curly" | "dotted" | "dashed";
|
|
1
2
|
export interface CellData {
|
|
2
3
|
char: number;
|
|
3
4
|
/** Full grapheme cluster. Present when the cell contains more than one code point. */
|
|
@@ -7,10 +8,16 @@ export interface CellData {
|
|
|
7
8
|
flags: number;
|
|
8
9
|
/** Display width: 1 = narrow, 2 = wide leading cell, 0 = wide continuation cell. */
|
|
9
10
|
width?: number;
|
|
11
|
+
/** Empty right-edge filler left when a wide glyph wraps to the following row. */
|
|
12
|
+
spacerHead?: boolean;
|
|
10
13
|
/** Resolved 24-bit foreground color (0xRRGGBB). Present when the core provides true color. */
|
|
11
14
|
fgRgb?: number;
|
|
12
15
|
/** Resolved 24-bit background color (0xRRGGBB). Present when the core provides true color. */
|
|
13
16
|
bgRgb?: number;
|
|
17
|
+
/** Underline variant. When omitted, flags bit 0x08 selects a single underline. */
|
|
18
|
+
underlineStyle?: UnderlineStyle;
|
|
19
|
+
/** Resolved underline color (0xRRGGBB). Omitted to follow the displayed foreground. */
|
|
20
|
+
underlineRgb?: number;
|
|
14
21
|
/** Resolved OSC 8 URI for this cell. */
|
|
15
22
|
linkUri?: string;
|
|
16
23
|
/** Explicit OSC 8 `id=` parameter, when provided. */
|
|
@@ -18,10 +25,47 @@ export interface CellData {
|
|
|
18
25
|
/** Opaque semantic identity used to group cells from the same OSC 8 link. */
|
|
19
26
|
linkKey?: string;
|
|
20
27
|
}
|
|
28
|
+
export type CursorShape = "block" | "underline" | "bar";
|
|
29
|
+
/** Application overrides of host theme defaults, as 24-bit RGB (0xRRGGBB). */
|
|
30
|
+
export interface TerminalColorOverrides {
|
|
31
|
+
/** Omitted after reset or when unset, allowing the host theme to supply it. */
|
|
32
|
+
foreground?: number;
|
|
33
|
+
background?: number;
|
|
34
|
+
cursor?: number;
|
|
35
|
+
}
|
|
36
|
+
/** Latest shell-reported OSC 133 state, not a log of command executions. */
|
|
37
|
+
export interface ShellIntegrationState {
|
|
38
|
+
phase: "unknown" | "prompt" | "input" | "running" | "complete";
|
|
39
|
+
/** Last OSC 133 D status, cleared by the next C marker or terminal reset. */
|
|
40
|
+
exitCode: number | null;
|
|
41
|
+
}
|
|
42
|
+
/** Soft-wrap relationships for one physical row of the active screen. */
|
|
43
|
+
export interface TerminalRowMetadata {
|
|
44
|
+
/** The following row continues this row without an explicit newline. */
|
|
45
|
+
wrapsToNext: boolean;
|
|
46
|
+
/** This row continues the preceding row, which may have been discarded. */
|
|
47
|
+
continuesPrevious: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** Cell coordinates, with row zero at the oldest retained row. */
|
|
50
|
+
export interface TerminalPosition {
|
|
51
|
+
row: number;
|
|
52
|
+
col: number;
|
|
53
|
+
}
|
|
54
|
+
/** A cell location that follows scrolling and reflow. Release when no longer needed. */
|
|
55
|
+
export interface TrackedTerminalPosition {
|
|
56
|
+
/** Null after disposal, pruning, reset, or a screen switch. Does not track cell contents. */
|
|
57
|
+
resolve(): TerminalPosition | null;
|
|
58
|
+
dispose(): void;
|
|
59
|
+
}
|
|
60
|
+
export type MouseEncoding = "x10" | "utf8" | "sgr" | "urxvt" | "sgr-pixels";
|
|
21
61
|
export interface CursorState {
|
|
22
62
|
row: number;
|
|
23
63
|
col: number;
|
|
24
64
|
visible: boolean;
|
|
65
|
+
/** Application-requested shape. Omitted by older/custom cores; defaults to block. */
|
|
66
|
+
shape?: CursorShape;
|
|
67
|
+
/** Application-requested blinking. Omitted by older/custom cores; defaults to false. */
|
|
68
|
+
blinking?: boolean;
|
|
25
69
|
}
|
|
26
70
|
export interface UnhandledSequence {
|
|
27
71
|
final: string;
|
|
@@ -87,6 +131,13 @@ export interface TerminalResourceState {
|
|
|
87
131
|
hyperlinks?: HyperlinkResourceState;
|
|
88
132
|
graphics?: GraphicsResourceState;
|
|
89
133
|
}
|
|
134
|
+
/** Host theme defaults: opaque 24-bit RGB values and exactly 16 ANSI colors. */
|
|
135
|
+
export interface TerminalThemeColors {
|
|
136
|
+
foreground: number;
|
|
137
|
+
background: number;
|
|
138
|
+
cursor: number;
|
|
139
|
+
palette: readonly number[];
|
|
140
|
+
}
|
|
90
141
|
/**
|
|
91
142
|
* Abstract terminal emulation core. Both the built-in Zig WASM core
|
|
92
143
|
* (`WasmBridge`) and alternative backends (e.g. `@wterm/ghostty`) implement
|
|
@@ -95,24 +146,44 @@ export interface TerminalResourceState {
|
|
|
95
146
|
export interface TerminalCore {
|
|
96
147
|
init(cols: number, rows: number): void;
|
|
97
148
|
resize(cols: number, rows: number): void;
|
|
149
|
+
/** Update host defaults without parsing input or replacing application overrides. */
|
|
150
|
+
setThemeColors?(colors: TerminalThemeColors): void;
|
|
98
151
|
writeString(str: string, afterChunk?: () => void): void;
|
|
99
152
|
writeRaw(data: Uint8Array, afterChunk?: () => void): void;
|
|
100
153
|
getCell(row: number, col: number): CellData;
|
|
154
|
+
/** Zero-based live row. Null means unavailable or out of range. */
|
|
155
|
+
getRowMetadata?(row: number): TerminalRowMetadata | null;
|
|
101
156
|
isDirtyRow(row: number): boolean;
|
|
102
157
|
clearDirty(): void;
|
|
158
|
+
/** Applied grid dimensions after init() or resize(), which may differ from the request. */
|
|
103
159
|
getCols(): number;
|
|
104
160
|
getRows(): number;
|
|
161
|
+
/** Optional tracked cell location. Null for invalid positions or exhausted capacity. */
|
|
162
|
+
trackPosition?(position: TerminalPosition): TrackedTerminalPosition | null;
|
|
105
163
|
getCursor(): CursorState;
|
|
164
|
+
/** Caller-owned snapshot. Missing fields follow the host's current CSS theme. */
|
|
165
|
+
getColorOverrides?(): TerminalColorOverrides;
|
|
106
166
|
cursorKeysApp(): boolean;
|
|
107
167
|
bracketedPaste(): boolean;
|
|
108
168
|
usingAltScreen(): boolean;
|
|
109
|
-
mouseTracking?(): 0 | 1000 | 1002;
|
|
169
|
+
mouseTracking?(): 0 | 1000 | 1002 | 1003;
|
|
170
|
+
/** True only for cell-coordinate SGR mode 1006; use mouseEncoding() for pixel mode 1016. */
|
|
110
171
|
mouseSgr?(): boolean;
|
|
172
|
+
/** Active mouse wire format. Optional for cores that only expose SGR state. */
|
|
173
|
+
mouseEncoding?(): MouseEncoding | null;
|
|
111
174
|
focusEvents?(): boolean;
|
|
112
175
|
synchronizedOutput?(): boolean;
|
|
113
176
|
synchronizedOutputGeneration?(): number;
|
|
114
177
|
kittyKeyboardFlags?(): number;
|
|
115
178
|
getTitle(): string | null;
|
|
179
|
+
/** Consume the latest OSC 7 URI. Empty means reset; null means unchanged or unsupported. Treat as untrusted metadata. */
|
|
180
|
+
getWorkingDirectory?(): string | null;
|
|
181
|
+
/** Read and clear the number of pending BEL controls. Optional for custom cores. */
|
|
182
|
+
getBellCount?(): number;
|
|
183
|
+
/** Consume the latest application clipboard-write request. Empty text means clear; null means none. Hosts choose whether to accept it. */
|
|
184
|
+
getClipboardWrite?(): string | null;
|
|
185
|
+
/** Consume the latest shell-state change. Null means no change or unsupported. */
|
|
186
|
+
getShellIntegrationState?(): ShellIntegrationState | null;
|
|
116
187
|
getResponse(): string | null;
|
|
117
188
|
getResourceState?(): TerminalResourceState;
|
|
118
189
|
/** Returns a caller-owned snapshot for the active screen, or no state. */
|
|
@@ -123,6 +194,10 @@ export interface TerminalCore {
|
|
|
123
194
|
getScrollbackDiscardedCount?(): number;
|
|
124
195
|
getScrollbackCell(offset: number, col: number): CellData;
|
|
125
196
|
getScrollbackLineLen(offset: number): number;
|
|
197
|
+
/** Offset zero is the newest history row. Null means unavailable or out of range. */
|
|
198
|
+
getScrollbackRowMetadata?(offset: number): TerminalRowMetadata | null;
|
|
199
|
+
/** Find the preceding/following prompt start from a retained row. Null if unavailable. */
|
|
200
|
+
findPrompt?(row: number, direction: -1 | 1): number | null;
|
|
126
201
|
getUnhandledSequences(): UnhandledSequence[];
|
|
127
202
|
}
|
|
128
203
|
//# sourceMappingURL=terminal-core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-core.d.ts","sourceRoot":"","sources":["../src/terminal-core.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;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CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IAG3D,qBAAqB,IAAI,iBAAiB,EAAE,CAAC;CAC9C"}
|
package/dist/transport.d.ts
CHANGED
|
@@ -2,30 +2,60 @@ export interface WebSocketTransportOptions {
|
|
|
2
2
|
url?: string;
|
|
3
3
|
reconnect?: boolean;
|
|
4
4
|
maxReconnectDelay?: number;
|
|
5
|
+
/** Maximum queued bytes, including WebSocket.bufferedAmount. Default: 1 MiB. */
|
|
6
|
+
maxBufferedBytes?: number;
|
|
7
|
+
/** Maximum messages waiting in the transport queue. Default: 1,024. */
|
|
8
|
+
maxBufferedMessages?: number;
|
|
9
|
+
/** Pause feeding the socket at this byte threshold. Default: 64 KiB. */
|
|
10
|
+
highWaterMark?: number;
|
|
11
|
+
/** Resume feeding the socket at or below this threshold. Default: 16 KiB. */
|
|
12
|
+
lowWaterMark?: number;
|
|
5
13
|
onData?: (data: Uint8Array | string) => void;
|
|
6
14
|
onOpen?: () => void;
|
|
7
15
|
onClose?: () => void;
|
|
8
16
|
onError?: (event: Event) => void;
|
|
17
|
+
/** Called on pressure transitions; pause producers while true. */
|
|
18
|
+
onBackpressure?: (paused: boolean) => void;
|
|
9
19
|
}
|
|
10
20
|
export declare class WebSocketTransport {
|
|
11
21
|
url: string | null;
|
|
12
22
|
reconnect: boolean;
|
|
13
23
|
maxReconnectDelay: number;
|
|
24
|
+
readonly maxBufferedBytes: number;
|
|
25
|
+
readonly maxBufferedMessages: number;
|
|
26
|
+
readonly highWaterMark: number;
|
|
27
|
+
readonly lowWaterMark: number;
|
|
14
28
|
onData: ((data: Uint8Array | string) => void) | null;
|
|
15
29
|
onOpen: (() => void) | null;
|
|
16
30
|
onClose: (() => void) | null;
|
|
17
31
|
onError: ((event: Event) => void) | null;
|
|
32
|
+
onBackpressure: ((paused: boolean) => void) | null;
|
|
18
33
|
private _ws;
|
|
34
|
+
private _connectionUrl;
|
|
19
35
|
private _reconnectTimer;
|
|
36
|
+
private _drainTimer;
|
|
20
37
|
private _reconnectDelay;
|
|
21
38
|
private _closed;
|
|
22
39
|
private _buffer;
|
|
40
|
+
private _queuedBytes;
|
|
41
|
+
private _backpressured;
|
|
42
|
+
private _socketPaused;
|
|
23
43
|
constructor(options?: WebSocketTransportOptions);
|
|
24
44
|
connect(url?: string): void;
|
|
45
|
+
/** Accept the complete message or throw; never enqueue a partial paste. */
|
|
25
46
|
send(data: string | Uint8Array): void;
|
|
26
47
|
close(): void;
|
|
27
48
|
get connected(): boolean;
|
|
49
|
+
/** Bytes still queued here plus bytes buffered by the current open socket. */
|
|
50
|
+
get bufferedAmount(): number;
|
|
51
|
+
get queuedBytes(): number;
|
|
52
|
+
get queuedMessages(): number;
|
|
53
|
+
get backpressured(): boolean;
|
|
28
54
|
private _flushBuffer;
|
|
55
|
+
private _updatePressure;
|
|
56
|
+
private _clearBuffer;
|
|
57
|
+
private _cancelTimers;
|
|
58
|
+
private _detach;
|
|
29
59
|
private _scheduleReconnect;
|
|
30
60
|
}
|
|
31
61
|
//# sourceMappingURL=transport.d.ts.map
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,KAAK,IAAI,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"transport.d.ts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