blecsd 0.3.0 → 0.6.0

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.
Files changed (147) hide show
  1. package/README.md +146 -147
  2. package/dist/{border-Jb7TrMob.d.ts → border-Br-Jc027.d.ts} +2 -2
  3. package/dist/{cell-DwIu2ryP.d.ts → cell-5Ty_3yMs.d.ts} +1 -1
  4. package/dist/cellRenderer-D0-DJXWl.d.ts +374 -0
  5. package/dist/chunk-4N7IFBRQ.js +4 -0
  6. package/dist/{chunk-DNRXW56C.js → chunk-4XCFTNGN.js} +1 -1
  7. package/dist/chunk-5YWRP2KG.js +3 -0
  8. package/dist/chunk-6PX5R326.js +1 -0
  9. package/dist/chunk-73Y45MLV.js +12 -0
  10. package/dist/chunk-7ZFQO3OQ.js +1 -0
  11. package/dist/chunk-A3GSH6MV.js +1 -0
  12. package/dist/chunk-A5B2BGUM.js +1 -0
  13. package/dist/chunk-AM6IDSXI.js +1 -0
  14. package/dist/chunk-EHYOVHRL.js +2 -0
  15. package/dist/chunk-EMZA6G2M.js +4 -0
  16. package/dist/chunk-EOFT3PNU.js +1 -0
  17. package/dist/chunk-ETFDYZVJ.js +1 -0
  18. package/dist/chunk-FUW7OD3H.js +1 -0
  19. package/dist/chunk-GRMSEMU7.js +1 -0
  20. package/dist/chunk-I7AUKTXE.js +1 -0
  21. package/dist/chunk-IANAVH2A.js +1 -0
  22. package/dist/chunk-JN2OGNK3.js +1 -0
  23. package/dist/chunk-JVMNMAHX.js +1 -0
  24. package/dist/chunk-K2QWNDXV.js +1 -0
  25. package/dist/chunk-KYNS3GBJ.js +2 -0
  26. package/dist/chunk-LI3ZYXUT.js +1 -0
  27. package/dist/chunk-LNEISTXM.js +1 -0
  28. package/dist/chunk-QABNK7IA.js +1 -0
  29. package/dist/chunk-QS5QXZNJ.js +1 -0
  30. package/dist/chunk-QTDRFJG2.js +1 -0
  31. package/dist/chunk-RJULLVTH.js +1 -0
  32. package/dist/chunk-SVHITP3F.js +2 -0
  33. package/dist/chunk-UKVY43V3.js +1 -0
  34. package/dist/chunk-VIT4KE6Q.js +1 -0
  35. package/dist/chunk-XG5PVDOP.js +1 -0
  36. package/dist/chunk-XH5GTWCV.js +1 -0
  37. package/dist/chunk-XYMPBCYW.js +1 -0
  38. package/dist/chunk-YRSSCEAS.js +1 -0
  39. package/dist/chunk-ZL46COQF.js +1 -0
  40. package/dist/cli/init.js +1 -1
  41. package/dist/{componentStorage-CJTh-TPO.d.ts → componentStorage-CXJvx4Lt.d.ts} +2 -2
  42. package/dist/components/index.d.ts +7209 -6691
  43. package/dist/components/index.js +5 -1
  44. package/dist/core/index.d.ts +2501 -1262
  45. package/dist/core/index.js +1 -1
  46. package/dist/debug/index.d.ts +310 -84
  47. package/dist/debug/index.js +8 -1
  48. package/dist/{dirtyTracking-C4v8MmM9.d.ts → dirtyTracking-kCS9-NVF.d.ts} +2 -2
  49. package/dist/{doubleBuffer-CKQFmlPN.d.ts → doubleBuffer-CWASihKh.d.ts} +1 -1
  50. package/dist/errors/index.js +1 -1
  51. package/dist/{inputActions-CRsUtTHM.d.ts → factories-vW7bn_He.d.ts} +21 -786
  52. package/dist/{gameLoop-C-Ez_i54.d.ts → gameLoop-C1AyRWyP.d.ts} +3 -3
  53. package/dist/index.d.ts +25 -500
  54. package/dist/index.js +1 -3
  55. package/dist/input/index.d.ts +1 -1
  56. package/dist/input/index.js +1 -1
  57. package/dist/inputStream-COARA4CP.d.ts +1182 -0
  58. package/dist/interactiveSystem-h92W9W4n.d.ts +1977 -0
  59. package/dist/{keyParser-BnHbg2iD.d.ts → keyParser-DReXe2j-.d.ts} +41 -41
  60. package/dist/{events-9ForpTfM.d.ts → mouseParser-CCqSEUVN.d.ts} +177 -2
  61. package/dist/{packedStore-BgvnEdE7.d.ts → packedStore-480t2X74.d.ts} +1 -1
  62. package/dist/panelMovement-DGzIQ8Ll.d.ts +1908 -0
  63. package/dist/{parser-iMHmQuUh.d.ts → parser-Q1YLXYpF.d.ts} +1 -1
  64. package/dist/positioning-DiUivJXa.d.ts +917 -0
  65. package/dist/{renderable-CwqGwrEV.d.ts → renderable-IbSJao5y.d.ts} +2 -2
  66. package/dist/{scheduler-CMcYew9Z.d.ts → scheduler-NbHT3-D2.d.ts} +3 -1
  67. package/dist/schemas/index.d.ts +6 -6
  68. package/dist/schemas/index.js +1 -1
  69. package/dist/systems/index.d.ts +1057 -1807
  70. package/dist/systems/index.js +1 -1
  71. package/dist/terminal/index.d.ts +7207 -2709
  72. package/dist/terminal/index.js +1 -1
  73. package/dist/terminalBuffer-BbUz27qM.d.ts +691 -0
  74. package/dist/{terminus-14-bold-HWSPRLJD.js → terminus-14-bold-ZS4IH465.js} +1 -1
  75. package/dist/{terminus-14-normal-T3SWMH4D.js → terminus-14-normal-HD5N7F5W.js} +1 -1
  76. package/dist/text/index.d.ts +263 -0
  77. package/dist/text/index.js +3 -0
  78. package/dist/textWrap-Ct2J8gO6.d.ts +761 -0
  79. package/dist/{tilemap-BirMJdbu.d.ts → tilemap-ByvTsepD.d.ts} +5 -5
  80. package/dist/{types-CPB4CpbH.d.ts → types-B8LmNkzG.d.ts} +1 -1
  81. package/dist/utils/index.d.ts +827 -780
  82. package/dist/utils/index.js +32 -1
  83. package/dist/{virtualScrollback-D9uLFe8l.d.ts → virtualScrollback-CiooIebp.d.ts} +4 -4
  84. package/dist/virtualViewport-fIlbIGPt.d.ts +657 -0
  85. package/dist/{virtualizedLineStore-DwPEvPkk.d.ts → virtualizedLineStore-DfyhojPZ.d.ts} +1 -1
  86. package/dist/widgets/bigText.d.ts +13 -13
  87. package/dist/widgets/bigText.js +1 -1
  88. package/dist/widgets/fonts/index.d.ts +1 -1
  89. package/dist/widgets/fonts/index.js +1 -1
  90. package/dist/widgets/index.d.ts +2933 -1102
  91. package/dist/widgets/index.js +24 -1
  92. package/package.json +9 -22
  93. package/dist/3d/index.d.ts +0 -5
  94. package/dist/3d/index.js +0 -1
  95. package/dist/audio/index.d.ts +0 -177
  96. package/dist/audio/index.js +0 -1
  97. package/dist/chunk-2IEMMRUO.js +0 -1
  98. package/dist/chunk-35LCBY6P.js +0 -1
  99. package/dist/chunk-3AV52GY5.js +0 -1
  100. package/dist/chunk-3LHLSY3Y.js +0 -1
  101. package/dist/chunk-3O4TQHGK.js +0 -4
  102. package/dist/chunk-3UJWZ5ZN.js +0 -1
  103. package/dist/chunk-5PELJRUQ.js +0 -1
  104. package/dist/chunk-6M2J5QUA.js +0 -1
  105. package/dist/chunk-7IQEUVGF.js +0 -1
  106. package/dist/chunk-A6M6TFBL.js +0 -1
  107. package/dist/chunk-CIK4AMUA.js +0 -1
  108. package/dist/chunk-CUEUJAHK.js +0 -3
  109. package/dist/chunk-D42Q2KKR.js +0 -1
  110. package/dist/chunk-DYEXOFUU.js +0 -2
  111. package/dist/chunk-DYU72XLL.js +0 -1
  112. package/dist/chunk-E4CJRSND.js +0 -1
  113. package/dist/chunk-EAY7B5GL.js +0 -1
  114. package/dist/chunk-FCMTWFSE.js +0 -1
  115. package/dist/chunk-FGHEFXLK.js +0 -1
  116. package/dist/chunk-FL56THSI.js +0 -25
  117. package/dist/chunk-G437VE43.js +0 -1
  118. package/dist/chunk-G7GIWWLE.js +0 -1
  119. package/dist/chunk-GGXNWT36.js +0 -8
  120. package/dist/chunk-HLFORKXS.js +0 -1
  121. package/dist/chunk-J7MBKEBY.js +0 -1
  122. package/dist/chunk-K3SX2LY5.js +0 -1
  123. package/dist/chunk-LDAFEXN5.js +0 -1
  124. package/dist/chunk-LYSK5S63.js +0 -1
  125. package/dist/chunk-MKMFUXLB.js +0 -33
  126. package/dist/chunk-MQWPHPUM.js +0 -1
  127. package/dist/chunk-MTI376CU.js +0 -5
  128. package/dist/chunk-MTV2RJZD.js +0 -1
  129. package/dist/chunk-NZ55KBM6.js +0 -1
  130. package/dist/chunk-OB66FB4F.js +0 -1
  131. package/dist/chunk-OMMJ7B5P.js +0 -1
  132. package/dist/chunk-OR3BZY7C.js +0 -1
  133. package/dist/chunk-PXXGH3BV.js +0 -1
  134. package/dist/chunk-R7AICVRN.js +0 -2
  135. package/dist/chunk-RZ7FGVI6.js +0 -1
  136. package/dist/chunk-SHUC6JWA.js +0 -1
  137. package/dist/chunk-TWSWTBYL.js +0 -1
  138. package/dist/chunk-UMGTXSQB.js +0 -11
  139. package/dist/chunk-X3Q3T2SS.js +0 -4
  140. package/dist/chunk-XZJRWFOS.js +0 -1
  141. package/dist/chunk-ZAHG7Y3X.js +0 -1
  142. package/dist/game/index.d.ts +0 -486
  143. package/dist/game/index.js +0 -1
  144. package/dist/index-DBS5Uefn.d.ts +0 -3156
  145. package/dist/mouseParser-Cfrbn3AX.d.ts +0 -177
  146. package/dist/viewport3d-xI33-_wq.d.ts +0 -182
  147. package/dist/virtualViewport-Bpv6jlKt.d.ts +0 -1856
@@ -0,0 +1,1182 @@
1
+ import { z } from 'zod';
2
+ import { K as KeyEvent } from './keyParser-DReXe2j-.js';
3
+ import { M as MouseEvent, F as FocusEvent } from './mouseParser-CCqSEUVN.js';
4
+
5
+ /**
6
+ * ANSI cursor control functions.
7
+ *
8
+ * Provides functions for cursor movement, positioning, visibility,
9
+ * shape, and color control. All functions return ANSI escape sequences
10
+ * as strings with no side effects.
11
+ *
12
+ * @module terminal/ansi/cursor
13
+ * @internal This module is internal and not exported from the main package.
14
+ */
15
+ /**
16
+ * Cursor control functions.
17
+ * All functions return ANSI escape sequences as strings.
18
+ */
19
+ declare const cursor: {
20
+ /**
21
+ * Move cursor to absolute position (1-indexed).
22
+ *
23
+ * @param x - Column (1-indexed)
24
+ * @param y - Row (1-indexed)
25
+ * @returns ANSI escape sequence
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * cursor.move(10, 5) // Move to column 10, row 5
30
+ * // Returns: '\x1b[5;10H'
31
+ * ```
32
+ */
33
+ readonly move: (x: number, y: number) => string;
34
+ /**
35
+ * Move cursor to column (1-indexed) on current row.
36
+ *
37
+ * @param x - Column (1-indexed)
38
+ * @returns ANSI escape sequence
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * cursor.column(1) // Move to column 1
43
+ * // Returns: '\x1b[1G'
44
+ * ```
45
+ */
46
+ readonly column: (x: number) => string;
47
+ /**
48
+ * Move cursor up n rows.
49
+ *
50
+ * @param n - Number of rows (default: 1)
51
+ * @returns ANSI escape sequence
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * cursor.up(3) // Move up 3 rows
56
+ * // Returns: '\x1b[3A'
57
+ * ```
58
+ */
59
+ readonly up: (n?: number) => string;
60
+ /**
61
+ * Move cursor down n rows.
62
+ *
63
+ * @param n - Number of rows (default: 1)
64
+ * @returns ANSI escape sequence
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * cursor.down(2) // Move down 2 rows
69
+ * // Returns: '\x1b[2B'
70
+ * ```
71
+ */
72
+ readonly down: (n?: number) => string;
73
+ /**
74
+ * Move cursor forward (right) n columns.
75
+ *
76
+ * @param n - Number of columns (default: 1)
77
+ * @returns ANSI escape sequence
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * cursor.forward(5) // Move right 5 columns
82
+ * // Returns: '\x1b[5C'
83
+ * ```
84
+ */
85
+ readonly forward: (n?: number) => string;
86
+ /**
87
+ * Move cursor back (left) n columns.
88
+ *
89
+ * @param n - Number of columns (default: 1)
90
+ * @returns ANSI escape sequence
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * cursor.back(3) // Move left 3 columns
95
+ * // Returns: '\x1b[3D'
96
+ * ```
97
+ */
98
+ readonly back: (n?: number) => string;
99
+ /**
100
+ * Move cursor to beginning of line n lines down.
101
+ *
102
+ * @param n - Number of lines (default: 1)
103
+ * @returns ANSI escape sequence
104
+ */
105
+ readonly nextLine: (n?: number) => string;
106
+ /**
107
+ * Move cursor to beginning of line n lines up.
108
+ *
109
+ * @param n - Number of lines (default: 1)
110
+ * @returns ANSI escape sequence
111
+ */
112
+ readonly prevLine: (n?: number) => string;
113
+ /**
114
+ * Save cursor position (DEC private mode).
115
+ *
116
+ * @returns ANSI escape sequence
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * cursor.save() // Save current position
121
+ * // Returns: '\x1b[s'
122
+ * ```
123
+ */
124
+ readonly save: () => string;
125
+ /**
126
+ * Restore cursor position (DEC private mode).
127
+ *
128
+ * @returns ANSI escape sequence
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * cursor.restore() // Restore saved position
133
+ * // Returns: '\x1b[u'
134
+ * ```
135
+ */
136
+ readonly restore: () => string;
137
+ /**
138
+ * Show cursor (make visible).
139
+ *
140
+ * @returns ANSI escape sequence
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * cursor.show() // Make cursor visible
145
+ * // Returns: '\x1b[?25h'
146
+ * ```
147
+ */
148
+ readonly show: () => string;
149
+ /**
150
+ * Hide cursor (make invisible).
151
+ *
152
+ * @returns ANSI escape sequence
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * cursor.hide() // Make cursor invisible
157
+ * // Returns: '\x1b[?25l'
158
+ * ```
159
+ */
160
+ readonly hide: () => string;
161
+ /**
162
+ * Request cursor position report.
163
+ * Terminal responds with CSI row ; col R
164
+ *
165
+ * @returns ANSI escape sequence
166
+ */
167
+ readonly requestPosition: () => string;
168
+ /**
169
+ * Move cursor to home position (1,1).
170
+ *
171
+ * @returns ANSI escape sequence
172
+ */
173
+ readonly home: () => string;
174
+ /**
175
+ * Set cursor shape.
176
+ *
177
+ * Shapes:
178
+ * - 0: Default (usually block)
179
+ * - 1: Blinking block
180
+ * - 2: Steady block
181
+ * - 3: Blinking underline
182
+ * - 4: Steady underline
183
+ * - 5: Blinking bar (xterm)
184
+ * - 6: Steady bar (xterm)
185
+ *
186
+ * @param shape - Cursor shape (0-6)
187
+ * @returns ANSI escape sequence
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * cursor.setShape(CursorShape.STEADY_BAR) // Steady bar cursor
192
+ * // Returns: '\x1b[6 q'
193
+ * ```
194
+ */
195
+ readonly setShape: (shape: number) => string;
196
+ /**
197
+ * Set cursor to blinking block.
198
+ *
199
+ * @returns ANSI escape sequence
200
+ */
201
+ readonly blinkingBlock: () => string;
202
+ /**
203
+ * Set cursor to steady (non-blinking) block.
204
+ *
205
+ * @returns ANSI escape sequence
206
+ */
207
+ readonly steadyBlock: () => string;
208
+ /**
209
+ * Set cursor to blinking underline.
210
+ *
211
+ * @returns ANSI escape sequence
212
+ */
213
+ readonly blinkingUnderline: () => string;
214
+ /**
215
+ * Set cursor to steady (non-blinking) underline.
216
+ *
217
+ * @returns ANSI escape sequence
218
+ */
219
+ readonly steadyUnderline: () => string;
220
+ /**
221
+ * Set cursor to blinking bar (I-beam).
222
+ *
223
+ * @returns ANSI escape sequence
224
+ */
225
+ readonly blinkingBar: () => string;
226
+ /**
227
+ * Set cursor to steady (non-blinking) bar (I-beam).
228
+ *
229
+ * @returns ANSI escape sequence
230
+ */
231
+ readonly steadyBar: () => string;
232
+ /**
233
+ * Reset cursor shape to default.
234
+ *
235
+ * @returns ANSI escape sequence
236
+ */
237
+ readonly resetShape: () => string;
238
+ /**
239
+ * Set cursor color (xterm extension).
240
+ * Uses OSC 12 to set cursor foreground color.
241
+ *
242
+ * @param color - Color as hex string (#RRGGBB) or color name
243
+ * @returns ANSI escape sequence
244
+ *
245
+ * @example
246
+ * ```typescript
247
+ * cursor.setColor('#ff0000') // Red cursor
248
+ * cursor.setColor('green') // Green cursor
249
+ * ```
250
+ */
251
+ readonly setColor: (color: string) => string;
252
+ /**
253
+ * Reset cursor color to default.
254
+ *
255
+ * @returns ANSI escape sequence
256
+ */
257
+ readonly resetColor: () => string;
258
+ /**
259
+ * Save cursor style (DECSCUSR save - not widely supported).
260
+ * Use cursor.save() for position, this saves shape/blink state.
261
+ *
262
+ * @returns ANSI escape sequence
263
+ */
264
+ readonly saveStyle: () => string;
265
+ /**
266
+ * Restore cursor style (DECSCUSR restore - not widely supported).
267
+ *
268
+ * @returns ANSI escape sequence
269
+ */
270
+ readonly restoreStyle: () => string;
271
+ };
272
+ /**
273
+ * Cursor shape constants for use with cursor.setShape()
274
+ */
275
+ declare const CursorShape: {
276
+ /** Default cursor (terminal-dependent) */
277
+ readonly DEFAULT: 0;
278
+ /** Blinking block cursor */
279
+ readonly BLINKING_BLOCK: 1;
280
+ /** Steady (non-blinking) block cursor */
281
+ readonly STEADY_BLOCK: 2;
282
+ /** Blinking underline cursor */
283
+ readonly BLINKING_UNDERLINE: 3;
284
+ /** Steady (non-blinking) underline cursor */
285
+ readonly STEADY_UNDERLINE: 4;
286
+ /** Blinking bar (I-beam) cursor */
287
+ readonly BLINKING_BAR: 5;
288
+ /** Steady (non-blinking) bar (I-beam) cursor */
289
+ readonly STEADY_BAR: 6;
290
+ };
291
+ type CursorShapeType = (typeof CursorShape)[keyof typeof CursorShape];
292
+
293
+ /**
294
+ * Terminal Response Parser
295
+ *
296
+ * Parses responses from terminal queries (DA, DSR, window manipulation, etc.).
297
+ * Used internally by the Program class to handle terminal communication.
298
+ *
299
+ * @module terminal/responseParser
300
+ * @internal This module is internal and not exported from the main package.
301
+ */
302
+
303
+ /**
304
+ * Response type identifiers.
305
+ */
306
+ declare const ResponseType: {
307
+ /** Primary Device Attributes (DA1) - ESC [ ? ... c */
308
+ readonly PRIMARY_DA: "primary_da";
309
+ /** Secondary Device Attributes (DA2) - ESC [ > ... c */
310
+ readonly SECONDARY_DA: "secondary_da";
311
+ /** Tertiary Device Attributes (DA3) - ESC P ! | ... ESC \ */
312
+ readonly TERTIARY_DA: "tertiary_da";
313
+ /** Cursor Position Report (CPR) - ESC [ Pr ; Pc R */
314
+ readonly CURSOR_POSITION: "cursor_position";
315
+ /** Device Status Report (DSR) - ESC [ Pn n */
316
+ readonly DEVICE_STATUS: "device_status";
317
+ /** Operating Status Report - ESC [ Pn n */
318
+ readonly OPERATING_STATUS: "operating_status";
319
+ /** Window Title - OSC L title ST */
320
+ readonly WINDOW_TITLE: "window_title";
321
+ /** Icon Label - OSC l label ST */
322
+ readonly ICON_LABEL: "icon_label";
323
+ /** Window State (iconified, normal, maximized) */
324
+ readonly WINDOW_STATE: "window_state";
325
+ /** Window Position (x, y in pixels) */
326
+ readonly WINDOW_POSITION: "window_position";
327
+ /** Window Size (width, height in pixels) */
328
+ readonly WINDOW_SIZE_PIXELS: "window_size_pixels";
329
+ /** Text Area Size (width, height in characters) */
330
+ readonly TEXT_AREA_SIZE: "text_area_size";
331
+ /** Screen Size (width, height in characters) */
332
+ readonly SCREEN_SIZE: "screen_size";
333
+ /** Character Cell Size (width, height in pixels) */
334
+ readonly CHAR_CELL_SIZE: "char_cell_size";
335
+ /** Locator Position */
336
+ readonly LOCATOR_POSITION: "locator_position";
337
+ /** Unknown/unrecognized response */
338
+ readonly UNKNOWN: "unknown";
339
+ };
340
+ type ResponseTypeValue = (typeof ResponseType)[keyof typeof ResponseType];
341
+ /**
342
+ * Base interface for parsed terminal responses.
343
+ */
344
+ interface ParsedResponse {
345
+ type: ResponseTypeValue;
346
+ raw: string;
347
+ }
348
+ /**
349
+ * Primary Device Attributes response.
350
+ */
351
+ interface PrimaryDAResponse extends ParsedResponse {
352
+ type: typeof ResponseType.PRIMARY_DA;
353
+ /** Device class (typically 1 for VT100, 62 for VT220, etc.) */
354
+ deviceClass: number;
355
+ /** List of supported attribute codes */
356
+ attributes: number[];
357
+ }
358
+ /**
359
+ * Secondary Device Attributes response.
360
+ */
361
+ interface SecondaryDAResponse extends ParsedResponse {
362
+ type: typeof ResponseType.SECONDARY_DA;
363
+ /** Terminal type ID */
364
+ terminalType: number;
365
+ /** Firmware version number */
366
+ firmwareVersion: number;
367
+ /** ROM cartridge registration number (often 0) */
368
+ romCartridge: number;
369
+ }
370
+ /**
371
+ * Cursor Position Report response.
372
+ */
373
+ interface CursorPositionResponse extends ParsedResponse {
374
+ type: typeof ResponseType.CURSOR_POSITION;
375
+ /** Row (1-based) */
376
+ row: number;
377
+ /** Column (1-based) */
378
+ column: number;
379
+ }
380
+ /**
381
+ * Device Status Report response.
382
+ */
383
+ interface DeviceStatusResponse extends ParsedResponse {
384
+ type: typeof ResponseType.DEVICE_STATUS;
385
+ /** Status code (0 = OK, 3 = Error) */
386
+ status: number;
387
+ /** Whether the terminal reports OK status */
388
+ ok: boolean;
389
+ }
390
+ /**
391
+ * Window Title response.
392
+ */
393
+ interface WindowTitleResponse extends ParsedResponse {
394
+ type: typeof ResponseType.WINDOW_TITLE;
395
+ /** The window title text */
396
+ title: string;
397
+ }
398
+ /**
399
+ * Icon Label response.
400
+ */
401
+ interface IconLabelResponse extends ParsedResponse {
402
+ type: typeof ResponseType.ICON_LABEL;
403
+ /** The icon label text */
404
+ label: string;
405
+ }
406
+ /**
407
+ * Window State response.
408
+ */
409
+ interface WindowStateResponse extends ParsedResponse {
410
+ type: typeof ResponseType.WINDOW_STATE;
411
+ /** Window state: 1=open, 2=iconified */
412
+ state: number;
413
+ /** Whether window is iconified/minimized */
414
+ iconified: boolean;
415
+ }
416
+ /**
417
+ * Window Position response.
418
+ */
419
+ interface WindowPositionResponse extends ParsedResponse {
420
+ type: typeof ResponseType.WINDOW_POSITION;
421
+ /** X position in pixels */
422
+ x: number;
423
+ /** Y position in pixels */
424
+ y: number;
425
+ }
426
+ /**
427
+ * Window Size in Pixels response.
428
+ */
429
+ interface WindowSizePixelsResponse extends ParsedResponse {
430
+ type: typeof ResponseType.WINDOW_SIZE_PIXELS;
431
+ /** Width in pixels */
432
+ width: number;
433
+ /** Height in pixels */
434
+ height: number;
435
+ }
436
+ /**
437
+ * Text Area Size response.
438
+ */
439
+ interface TextAreaSizeResponse extends ParsedResponse {
440
+ type: typeof ResponseType.TEXT_AREA_SIZE;
441
+ /** Columns (characters) */
442
+ columns: number;
443
+ /** Rows (characters) */
444
+ rows: number;
445
+ }
446
+ /**
447
+ * Screen Size response.
448
+ */
449
+ interface ScreenSizeResponse extends ParsedResponse {
450
+ type: typeof ResponseType.SCREEN_SIZE;
451
+ /** Columns (characters) */
452
+ columns: number;
453
+ /** Rows (characters) */
454
+ rows: number;
455
+ }
456
+ /**
457
+ * Character Cell Size response.
458
+ */
459
+ interface CharCellSizeResponse extends ParsedResponse {
460
+ type: typeof ResponseType.CHAR_CELL_SIZE;
461
+ /** Width in pixels */
462
+ width: number;
463
+ /** Height in pixels */
464
+ height: number;
465
+ }
466
+ /**
467
+ * Locator Position response.
468
+ */
469
+ interface LocatorPositionResponse extends ParsedResponse {
470
+ type: typeof ResponseType.LOCATOR_POSITION;
471
+ /** Status code */
472
+ status: number;
473
+ /** Button state */
474
+ button: number;
475
+ /** Row */
476
+ row: number;
477
+ /** Column */
478
+ column: number;
479
+ /** Page number */
480
+ page: number;
481
+ }
482
+ /**
483
+ * Unknown/unrecognized response.
484
+ */
485
+ interface UnknownResponse extends ParsedResponse {
486
+ type: typeof ResponseType.UNKNOWN;
487
+ }
488
+ /**
489
+ * Union type of all parsed response types.
490
+ */
491
+ type TerminalResponse = PrimaryDAResponse | SecondaryDAResponse | CursorPositionResponse | DeviceStatusResponse | WindowTitleResponse | IconLabelResponse | WindowStateResponse | WindowPositionResponse | WindowSizePixelsResponse | TextAreaSizeResponse | ScreenSizeResponse | CharCellSizeResponse | LocatorPositionResponse | UnknownResponse;
492
+ /**
493
+ * Zod schema for validating cursor position response.
494
+ */
495
+ declare const CursorPositionSchema: z.ZodObject<{
496
+ type: z.ZodLiteral<"cursor_position">;
497
+ raw: z.ZodString;
498
+ row: z.ZodNumber;
499
+ column: z.ZodNumber;
500
+ }, z.core.$strip>;
501
+ /**
502
+ * Parse a terminal response string.
503
+ *
504
+ * @param response - Raw response string from terminal
505
+ * @returns Parsed response object, or UnknownResponse if unrecognized
506
+ *
507
+ * @example
508
+ * ```typescript
509
+ * import { parseResponse, ResponseType } from 'blecsd/terminal/responseParser';
510
+ *
511
+ * const response = '\x1b[10;20R';
512
+ * const parsed = parseResponse(response);
513
+ *
514
+ * if (parsed.type === ResponseType.CURSOR_POSITION) {
515
+ * console.log(`Cursor at row ${parsed.row}, column ${parsed.column}`);
516
+ * }
517
+ * ```
518
+ */
519
+ declare function parseResponse(response: string): TerminalResponse;
520
+ /**
521
+ * Check if response is a Primary DA response.
522
+ */
523
+ declare function isPrimaryDA(response: TerminalResponse): response is PrimaryDAResponse;
524
+ /**
525
+ * Check if response is a Secondary DA response.
526
+ */
527
+ declare function isSecondaryDA(response: TerminalResponse): response is SecondaryDAResponse;
528
+ /**
529
+ * Check if response is a Cursor Position response.
530
+ *
531
+ * @param response - Parsed terminal response
532
+ * @returns true if response is a CursorPositionResponse
533
+ *
534
+ * @example
535
+ * ```typescript
536
+ * const parsed = parseResponse('\x1b[10;20R');
537
+ * if (isCursorPosition(parsed)) {
538
+ * console.log(`Row: ${parsed.row}, Column: ${parsed.column}`);
539
+ * }
540
+ * ```
541
+ */
542
+ declare function isCursorPosition(response: TerminalResponse): response is CursorPositionResponse;
543
+ /**
544
+ * Check if response is a Device Status response.
545
+ *
546
+ * @param response - Parsed terminal response
547
+ * @returns true if response is a DeviceStatusResponse
548
+ *
549
+ * @example
550
+ * ```typescript
551
+ * const parsed = parseResponse('\x1b[0n');
552
+ * if (isDeviceStatus(parsed)) {
553
+ * console.log(`Status OK: ${parsed.ok}`);
554
+ * }
555
+ * ```
556
+ */
557
+ declare function isDeviceStatus(response: TerminalResponse): response is DeviceStatusResponse;
558
+ /**
559
+ * Check if response is a Window Title response.
560
+ *
561
+ * @param response - Parsed terminal response
562
+ * @returns true if response is a WindowTitleResponse
563
+ */
564
+ declare function isWindowTitle(response: TerminalResponse): response is WindowTitleResponse;
565
+ /**
566
+ * Check if response is an Icon Label response.
567
+ *
568
+ * @param response - Parsed terminal response
569
+ * @returns true if response is an IconLabelResponse
570
+ */
571
+ declare function isIconLabel(response: TerminalResponse): response is IconLabelResponse;
572
+ /**
573
+ * Check if response is a Window State response.
574
+ *
575
+ * @param response - Parsed terminal response
576
+ * @returns true if response is a WindowStateResponse
577
+ */
578
+ declare function isWindowState(response: TerminalResponse): response is WindowStateResponse;
579
+ /**
580
+ * Check if response is a Window Position response.
581
+ *
582
+ * @param response - Parsed terminal response
583
+ * @returns true if response is a WindowPositionResponse
584
+ */
585
+ declare function isWindowPosition(response: TerminalResponse): response is WindowPositionResponse;
586
+ /**
587
+ * Check if response is a Window Size (pixels) response.
588
+ *
589
+ * @param response - Parsed terminal response
590
+ * @returns true if response is a WindowSizePixelsResponse
591
+ */
592
+ declare function isWindowSizePixels(response: TerminalResponse): response is WindowSizePixelsResponse;
593
+ /**
594
+ * Check if response is a Text Area Size response.
595
+ *
596
+ * @param response - Parsed terminal response
597
+ * @returns true if response is a TextAreaSizeResponse
598
+ */
599
+ declare function isTextAreaSize(response: TerminalResponse): response is TextAreaSizeResponse;
600
+ /**
601
+ * Check if response is a Screen Size response.
602
+ *
603
+ * @param response - Parsed terminal response
604
+ * @returns true if response is a ScreenSizeResponse
605
+ */
606
+ declare function isScreenSize(response: TerminalResponse): response is ScreenSizeResponse;
607
+ /**
608
+ * Check if response is a Character Cell Size response.
609
+ *
610
+ * @param response - Parsed terminal response
611
+ * @returns true if response is a CharCellSizeResponse
612
+ */
613
+ declare function isCharCellSize(response: TerminalResponse): response is CharCellSizeResponse;
614
+ /**
615
+ * Check if response is a Locator Position response.
616
+ *
617
+ * @param response - Parsed terminal response
618
+ * @returns true if response is a LocatorPositionResponse
619
+ */
620
+ declare function isLocatorPosition(response: TerminalResponse): response is LocatorPositionResponse;
621
+ /**
622
+ * Check if response is an unknown/unrecognized response.
623
+ *
624
+ * @param response - Parsed terminal response
625
+ * @returns true if response is an UnknownResponse
626
+ */
627
+ declare function isUnknown(response: TerminalResponse): response is UnknownResponse;
628
+ /**
629
+ * Query generators for terminal queries.
630
+ *
631
+ * These functions generate the escape sequences to send to the terminal
632
+ * to request information. The terminal will respond with data that can
633
+ * be parsed using parseResponse().
634
+ *
635
+ * @example
636
+ * ```typescript
637
+ * import { query, parseResponse, isCursorPosition } from 'blecsd/terminal';
638
+ *
639
+ * // Send cursor position query
640
+ * process.stdout.write(query.cursorPosition());
641
+ *
642
+ * // Read response from stdin and parse it
643
+ * // (In practice, you'd use async input handling)
644
+ * const response = await readTerminalResponse();
645
+ * const parsed = parseResponse(response);
646
+ *
647
+ * if (isCursorPosition(parsed)) {
648
+ * console.log(`Cursor at row ${parsed.row}, column ${parsed.column}`);
649
+ * }
650
+ * ```
651
+ */
652
+ declare const query: {
653
+ /**
654
+ * Request Primary Device Attributes (DA1).
655
+ * Response format: ESC [ ? Pn ; ... c
656
+ *
657
+ * @returns Query sequence
658
+ *
659
+ * @example
660
+ * ```typescript
661
+ * process.stdout.write(query.primaryDA());
662
+ * // Terminal responds with something like: \x1b[?62;1;2;6;7;8;9c
663
+ * ```
664
+ */
665
+ readonly primaryDA: () => string;
666
+ /**
667
+ * Request Secondary Device Attributes (DA2).
668
+ * Response format: ESC [ > Pn ; Pn ; Pn c
669
+ *
670
+ * @returns Query sequence
671
+ *
672
+ * @example
673
+ * ```typescript
674
+ * process.stdout.write(query.secondaryDA());
675
+ * // Terminal responds with: \x1b[>41;354;0c (xterm example)
676
+ * ```
677
+ */
678
+ readonly secondaryDA: () => string;
679
+ /**
680
+ * Request Tertiary Device Attributes (DA3).
681
+ * Response format: DCS ! | <hex> ST
682
+ *
683
+ * @returns Query sequence
684
+ */
685
+ readonly tertiaryDA: () => string;
686
+ /**
687
+ * Request Cursor Position Report (CPR).
688
+ * Response format: ESC [ Pr ; Pc R
689
+ *
690
+ * @returns Query sequence
691
+ *
692
+ * @example
693
+ * ```typescript
694
+ * process.stdout.write(query.cursorPosition());
695
+ * // Terminal responds with: \x1b[10;20R (row 10, column 20)
696
+ * ```
697
+ */
698
+ readonly cursorPosition: () => string;
699
+ /**
700
+ * Request Device Status Report (DSR).
701
+ * Response format: ESC [ 0 n (OK) or ESC [ 3 n (error)
702
+ *
703
+ * @returns Query sequence
704
+ *
705
+ * @example
706
+ * ```typescript
707
+ * process.stdout.write(query.deviceStatus());
708
+ * // Terminal responds with: \x1b[0n (OK)
709
+ * ```
710
+ */
711
+ readonly deviceStatus: () => string;
712
+ /**
713
+ * Request Window State (iconified or normal).
714
+ * Response format: ESC [ 1 t (open) or ESC [ 2 t (iconified)
715
+ *
716
+ * @returns Query sequence
717
+ */
718
+ readonly windowState: () => string;
719
+ /**
720
+ * Request Window Position.
721
+ * Response format: ESC [ 3 ; x ; y t
722
+ *
723
+ * @returns Query sequence
724
+ */
725
+ readonly windowPosition: () => string;
726
+ /**
727
+ * Request Window Size in pixels.
728
+ * Response format: ESC [ 4 ; height ; width t
729
+ *
730
+ * @returns Query sequence
731
+ */
732
+ readonly windowSizePixels: () => string;
733
+ /**
734
+ * Request Text Area Size in characters.
735
+ * Response format: ESC [ 8 ; rows ; columns t
736
+ *
737
+ * @returns Query sequence
738
+ */
739
+ readonly textAreaSize: () => string;
740
+ /**
741
+ * Request Screen Size in characters.
742
+ * Response format: ESC [ 9 ; rows ; columns t
743
+ *
744
+ * @returns Query sequence
745
+ */
746
+ readonly screenSize: () => string;
747
+ /**
748
+ * Request Character Cell Size in pixels.
749
+ * Response format: ESC [ 6 ; height ; width t
750
+ *
751
+ * @returns Query sequence
752
+ */
753
+ readonly charCellSize: () => string;
754
+ /**
755
+ * Request Window Title.
756
+ * Response format: OSC L ; title ST
757
+ *
758
+ * @returns Query sequence
759
+ */
760
+ readonly windowTitle: () => string;
761
+ /**
762
+ * Request Icon Label.
763
+ * Response format: OSC l ; label ST
764
+ *
765
+ * @returns Query sequence
766
+ */
767
+ readonly iconLabel: () => string;
768
+ /**
769
+ * Enable DEC Locator reporting.
770
+ *
771
+ * @param mode - 0=disabled, 1=one-shot, 2=continuous
772
+ * @returns Query sequence
773
+ */
774
+ readonly enableLocator: (mode?: 0 | 1 | 2) => string;
775
+ /**
776
+ * Request DEC Locator Position.
777
+ * Response format: ESC [ Pe ; Pb ; Pr ; Pc ; Pp & w
778
+ *
779
+ * @returns Query sequence
780
+ */
781
+ readonly locatorPosition: () => string;
782
+ };
783
+
784
+ /**
785
+ * Dynamic Terminal Capability Negotiation
786
+ *
787
+ * Queries terminal for modern features at startup. This module enables
788
+ * detection of advanced terminal capabilities like truecolor, Kitty keyboard
789
+ * protocol, graphics protocols, and synchronized output.
790
+ *
791
+ * @module terminal/capabilities/negotiation
792
+ */
793
+
794
+ /**
795
+ * Default timeout for terminal queries (milliseconds).
796
+ */
797
+ declare const DEFAULT_QUERY_TIMEOUT = 100;
798
+ /**
799
+ * Minimum timeout allowed (milliseconds).
800
+ */
801
+ declare const MIN_QUERY_TIMEOUT = 10;
802
+ /**
803
+ * Maximum timeout allowed (milliseconds).
804
+ */
805
+ declare const MAX_QUERY_TIMEOUT = 5000;
806
+ /**
807
+ * Kitty keyboard protocol enhancement levels.
808
+ * Each level adds more capabilities on top of the previous.
809
+ */
810
+ declare const KittyKeyboardLevel: {
811
+ /** Level 0: Disabled (legacy mode) */
812
+ readonly DISABLED: 0;
813
+ /** Level 1: Disambiguate escape codes */
814
+ readonly DISAMBIGUATE: 1;
815
+ /** Level 2: Report event types (press, repeat, release) */
816
+ readonly REPORT_EVENTS: 2;
817
+ /** Level 3: Report alternate keys */
818
+ readonly REPORT_ALTERNATES: 4;
819
+ /** Level 4: Report all keys as escape codes */
820
+ readonly REPORT_ALL: 8;
821
+ /** Level 5: Report associated text */
822
+ readonly REPORT_TEXT: 16;
823
+ };
824
+ type KittyKeyboardLevelValue = (typeof KittyKeyboardLevel)[keyof typeof KittyKeyboardLevel];
825
+ /**
826
+ * Graphics protocol types.
827
+ */
828
+ declare const GraphicsProtocol: {
829
+ /** No graphics support */
830
+ readonly NONE: "none";
831
+ /** Kitty graphics protocol */
832
+ readonly KITTY: "kitty";
833
+ /** iTerm2 inline images protocol */
834
+ readonly ITERM2: "iterm2";
835
+ /** Sixel graphics */
836
+ readonly SIXEL: "sixel";
837
+ };
838
+ type GraphicsProtocolValue = (typeof GraphicsProtocol)[keyof typeof GraphicsProtocol];
839
+ /**
840
+ * Negotiation timing strategy.
841
+ */
842
+ declare const NegotiationTiming: {
843
+ /** Query immediately on creation */
844
+ readonly EAGER: "eager";
845
+ /** Query on first capability access */
846
+ readonly LAZY: "lazy";
847
+ /** Skip negotiation, use environment detection only */
848
+ readonly SKIP: "skip";
849
+ };
850
+ type NegotiationTimingValue = (typeof NegotiationTiming)[keyof typeof NegotiationTiming];
851
+ /**
852
+ * Terminal capabilities interface.
853
+ * Represents the detected capabilities of the terminal.
854
+ */
855
+ interface TerminalCapabilities {
856
+ /** True if terminal supports 24-bit RGB colors */
857
+ readonly truecolor: boolean;
858
+ /** Kitty keyboard protocol level, or false if not supported */
859
+ readonly kittyKeyboard: KittyKeyboardLevelValue | false;
860
+ /** Graphics protocol supported, or false if none */
861
+ readonly graphics: GraphicsProtocolValue | false;
862
+ /** True if terminal supports focus events */
863
+ readonly focusEvents: boolean;
864
+ /** True if terminal supports bracketed paste mode */
865
+ readonly bracketedPaste: boolean;
866
+ /** True if terminal supports synchronized output */
867
+ readonly synchronizedOutput: boolean;
868
+ /** True if terminal supports OSC 8 hyperlinks */
869
+ readonly hyperlinks: boolean;
870
+ /** True if terminal supports styled underlines */
871
+ readonly styledUnderlines: boolean;
872
+ /** Primary DA response if available */
873
+ readonly primaryDA: PrimaryDAResponse | null;
874
+ /** Secondary DA response if available */
875
+ readonly secondaryDA: SecondaryDAResponse | null;
876
+ /** Terminal type identifier from DA2 */
877
+ readonly terminalType: number | null;
878
+ /** Firmware version from DA2 */
879
+ readonly firmwareVersion: number | null;
880
+ }
881
+ /**
882
+ * Capability negotiator configuration.
883
+ */
884
+ interface NegotiatorConfig {
885
+ /** Query timeout in milliseconds (default: 100) */
886
+ readonly timeout?: number;
887
+ /** Negotiation timing strategy (default: eager) */
888
+ readonly timing?: NegotiationTimingValue;
889
+ /** Custom input stream (default: process.stdin) */
890
+ readonly input?: NodeJS.ReadStream;
891
+ /** Custom output stream (default: process.stdout) */
892
+ readonly output?: NodeJS.WriteStream;
893
+ /** Force specific capabilities (for testing) */
894
+ readonly forceCapabilities?: Partial<TerminalCapabilities>;
895
+ }
896
+ /**
897
+ * Zod schema for negotiator configuration.
898
+ */
899
+ declare const NegotiatorConfigSchema: z.ZodObject<{
900
+ timeout: z.ZodOptional<z.ZodNumber>;
901
+ timing: z.ZodOptional<z.ZodEnum<{
902
+ lazy: "lazy";
903
+ eager: "eager";
904
+ skip: "skip";
905
+ }>>;
906
+ forceCapabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
907
+ }, z.core.$strip>;
908
+ /**
909
+ * Capability negotiator interface.
910
+ */
911
+ interface CapabilityNegotiator {
912
+ /**
913
+ * Gets the negotiated terminal capabilities.
914
+ * If timing is 'lazy' and negotiation hasn't run, triggers it.
915
+ *
916
+ * @returns Promise resolving to capabilities
917
+ */
918
+ getCapabilities(): Promise<TerminalCapabilities>;
919
+ /**
920
+ * Gets cached capabilities without triggering negotiation.
921
+ * Returns null if not yet negotiated.
922
+ */
923
+ getCachedCapabilities(): TerminalCapabilities | null;
924
+ /**
925
+ * Forces re-negotiation of capabilities.
926
+ * Useful after SIGWINCH or terminal reconnection.
927
+ *
928
+ * @returns Promise resolving to new capabilities
929
+ */
930
+ renegotiate(): Promise<TerminalCapabilities>;
931
+ /**
932
+ * Checks if capabilities have been negotiated.
933
+ */
934
+ isNegotiated(): boolean;
935
+ /**
936
+ * Gets the query timeout.
937
+ */
938
+ getTimeout(): number;
939
+ /**
940
+ * Sets the query timeout.
941
+ *
942
+ * @param timeout - New timeout in milliseconds
943
+ */
944
+ setTimeout(timeout: number): void;
945
+ /**
946
+ * Cleans up resources.
947
+ */
948
+ destroy(): void;
949
+ }
950
+ /**
951
+ * Generates the XTVERSION query sequence.
952
+ * Response format: DCS > | version ST
953
+ */
954
+ declare function queryXTVersion(): string;
955
+ /**
956
+ * Generates Kitty keyboard protocol query.
957
+ * Response format: CSI ? flags u
958
+ */
959
+ declare function queryKittyKeyboard(): string;
960
+ /**
961
+ * Creates a capability negotiator.
962
+ *
963
+ * The negotiator queries the terminal for capabilities and caches the results.
964
+ * It supports three timing strategies:
965
+ * - `eager`: Query immediately on creation
966
+ * - `lazy`: Query on first capability access
967
+ * - `skip`: Use environment detection only, no queries
968
+ *
969
+ * @param config - Negotiator configuration
970
+ * @returns CapabilityNegotiator instance
971
+ *
972
+ * @example
973
+ * ```typescript
974
+ * import { createCapabilityNegotiator } from 'blecsd';
975
+ *
976
+ * // Create with eager negotiation (default)
977
+ * const negotiator = createCapabilityNegotiator();
978
+ *
979
+ * // Wait for capabilities
980
+ * const caps = await negotiator.getCapabilities();
981
+ *
982
+ * if (caps.truecolor) {
983
+ * console.log('Truecolor supported!');
984
+ * }
985
+ *
986
+ * if (caps.kittyKeyboard) {
987
+ * console.log(`Kitty keyboard level: ${caps.kittyKeyboard}`);
988
+ * }
989
+ *
990
+ * // Clean up
991
+ * negotiator.destroy();
992
+ * ```
993
+ *
994
+ * @example
995
+ * ```typescript
996
+ * // Create with lazy negotiation
997
+ * const negotiator = createCapabilityNegotiator({
998
+ * timing: 'lazy',
999
+ * timeout: 200,
1000
+ * });
1001
+ *
1002
+ * // Capabilities are negotiated on first access
1003
+ * const caps = await negotiator.getCapabilities();
1004
+ * ```
1005
+ *
1006
+ * @example
1007
+ * ```typescript
1008
+ * // Skip negotiation, use environment detection only
1009
+ * const negotiator = createCapabilityNegotiator({
1010
+ * timing: 'skip',
1011
+ * });
1012
+ *
1013
+ * // Returns immediately with environment-detected capabilities
1014
+ * const caps = await negotiator.getCapabilities();
1015
+ * ```
1016
+ */
1017
+ declare function createCapabilityNegotiator(config?: NegotiatorConfig): CapabilityNegotiator;
1018
+ /**
1019
+ * Gets the default capability negotiator.
1020
+ * Creates one with eager timing on first call.
1021
+ *
1022
+ * @returns Default CapabilityNegotiator instance
1023
+ *
1024
+ * @example
1025
+ * ```typescript
1026
+ * import { getDefaultNegotiator } from 'blecsd';
1027
+ *
1028
+ * const caps = await getDefaultNegotiator().getCapabilities();
1029
+ * ```
1030
+ */
1031
+ declare function getDefaultNegotiator(): CapabilityNegotiator;
1032
+ /**
1033
+ * Resets the default negotiator.
1034
+ * For testing purposes.
1035
+ */
1036
+ declare function resetDefaultNegotiator(): void;
1037
+ /**
1038
+ * Gets terminal capabilities using the default negotiator.
1039
+ *
1040
+ * @returns Promise resolving to terminal capabilities
1041
+ *
1042
+ * @example
1043
+ * ```typescript
1044
+ * import { getTerminalCapabilities } from 'blecsd';
1045
+ *
1046
+ * const caps = await getTerminalCapabilities();
1047
+ * console.log(`Truecolor: ${caps.truecolor}`);
1048
+ * console.log(`Graphics: ${caps.graphics}`);
1049
+ * ```
1050
+ */
1051
+ declare function getTerminalCapabilities(): Promise<TerminalCapabilities>;
1052
+ /**
1053
+ * Checks if a specific capability is supported.
1054
+ *
1055
+ * @param capability - Capability name to check
1056
+ * @returns Promise resolving to true if supported
1057
+ *
1058
+ * @example
1059
+ * ```typescript
1060
+ * import { hasCapability } from 'blecsd';
1061
+ *
1062
+ * if (await hasCapability('truecolor')) {
1063
+ * // Use 24-bit colors
1064
+ * }
1065
+ * ```
1066
+ */
1067
+ declare function hasCapability(capability: keyof TerminalCapabilities): Promise<boolean>;
1068
+ /**
1069
+ * Query generators for capability detection.
1070
+ * Use these to manually query the terminal.
1071
+ */
1072
+ declare const capabilityQuery: {
1073
+ /**
1074
+ * Primary Device Attributes query.
1075
+ */
1076
+ readonly primaryDA: () => string;
1077
+ /**
1078
+ * Secondary Device Attributes query.
1079
+ */
1080
+ readonly secondaryDA: () => string;
1081
+ /**
1082
+ * XTVERSION query.
1083
+ */
1084
+ readonly xtversion: typeof queryXTVersion;
1085
+ /**
1086
+ * Kitty keyboard protocol query.
1087
+ */
1088
+ readonly kittyKeyboard: typeof queryKittyKeyboard;
1089
+ };
1090
+
1091
+ /**
1092
+ * Input stream handler for keyboard and mouse events.
1093
+ * Wraps a NodeJS readable stream and emits typed events.
1094
+ * @module terminal/inputStream
1095
+ */
1096
+
1097
+ /**
1098
+ * Handler for keyboard events.
1099
+ */
1100
+ type KeyHandler = (event: KeyEvent) => void;
1101
+ /**
1102
+ * Handler for mouse events.
1103
+ */
1104
+ type MouseHandler = (event: MouseEvent) => void;
1105
+ /**
1106
+ * Handler for focus events.
1107
+ */
1108
+ type FocusHandler = (event: FocusEvent) => void;
1109
+ /**
1110
+ * Unsubscribe function returned by event handlers.
1111
+ */
1112
+ type Unsubscribe = () => void;
1113
+ /**
1114
+ * Configuration for the input handler.
1115
+ */
1116
+ interface InputHandlerConfig {
1117
+ /** Maximum buffer size in bytes before forcing a flush (default: 4096) */
1118
+ maxBufferSize?: number;
1119
+ /** Timeout in ms to wait for escape sequences to complete (default: 100) */
1120
+ escapeTimeout?: number;
1121
+ }
1122
+ /**
1123
+ * Zod schema for InputHandlerConfig validation.
1124
+ *
1125
+ * @example
1126
+ * ```typescript
1127
+ * import { InputHandlerConfigSchema } from 'blecsd';
1128
+ *
1129
+ * const result = InputHandlerConfigSchema.safeParse({ maxBufferSize: 8192 });
1130
+ * if (result.success) {
1131
+ * console.log('Valid config');
1132
+ * }
1133
+ * ```
1134
+ */
1135
+ declare const InputHandlerConfigSchema: z.ZodObject<{
1136
+ maxBufferSize: z.ZodOptional<z.ZodNumber>;
1137
+ escapeTimeout: z.ZodOptional<z.ZodNumber>;
1138
+ }, z.core.$strip>;
1139
+ /**
1140
+ * InputHandler interface for type-safe access.
1141
+ */
1142
+ interface InputHandler {
1143
+ start(): void;
1144
+ stop(): void;
1145
+ onKey(handler: KeyHandler): Unsubscribe;
1146
+ onMouse(handler: MouseHandler): Unsubscribe;
1147
+ onFocus(handler: FocusHandler): Unsubscribe;
1148
+ isRunning(): boolean;
1149
+ getBufferSize(): number;
1150
+ }
1151
+ /**
1152
+ * Creates a new input handler instance.
1153
+ *
1154
+ * Processes raw terminal input and emits typed keyboard and mouse events.
1155
+ *
1156
+ * @param stream - The readable stream to process (typically process.stdin)
1157
+ * @param config - Optional configuration
1158
+ * @returns A new InputHandler instance
1159
+ *
1160
+ * @example
1161
+ * ```typescript
1162
+ * import { createInputHandler } from 'blecsd';
1163
+ *
1164
+ * const handler = createInputHandler(process.stdin);
1165
+ *
1166
+ * handler.onKey((event) => {
1167
+ * console.log(`Key: ${event.name}, ctrl: ${event.ctrl}`);
1168
+ * if (event.name === 'q' && event.ctrl) {
1169
+ * handler.stop();
1170
+ * }
1171
+ * });
1172
+ *
1173
+ * handler.onMouse((event) => {
1174
+ * console.log(`Mouse: ${event.action} at ${event.x}, ${event.y}`);
1175
+ * });
1176
+ *
1177
+ * handler.start();
1178
+ * ```
1179
+ */
1180
+ declare function createInputHandler(stream: NodeJS.ReadableStream, config?: InputHandlerConfig): InputHandler;
1181
+
1182
+ export { type SecondaryDAResponse as $, type DeviceStatusResponse as A, type GraphicsProtocolValue as B, CursorShape as C, DEFAULT_QUERY_TIMEOUT as D, type IconLabelResponse as E, type FocusHandler as F, GraphicsProtocol as G, type InputHandlerConfig as H, type InputHandler as I, InputHandlerConfigSchema as J, type KeyHandler as K, KittyKeyboardLevel as L, type MouseHandler as M, type KittyKeyboardLevelValue as N, type LocatorPositionResponse as O, MAX_QUERY_TIMEOUT as P, MIN_QUERY_TIMEOUT as Q, NegotiationTiming as R, type NegotiationTimingValue as S, type TerminalCapabilities as T, type NegotiatorConfig as U, NegotiatorConfigSchema as V, type ParsedResponse as W, type PrimaryDAResponse as X, ResponseType as Y, type ResponseTypeValue as Z, type ScreenSizeResponse as _, getTerminalCapabilities as a, type TerminalResponse as a0, type TextAreaSizeResponse as a1, type UnknownResponse as a2, type Unsubscribe as a3, type WindowPositionResponse as a4, type WindowSizePixelsResponse as a5, type WindowStateResponse as a6, type WindowTitleResponse as a7, capabilityQuery as a8, cursor as a9, query as aa, createInputHandler as b, createCapabilityNegotiator as c, isCursorPosition as d, isDeviceStatus as e, isIconLabel as f, getDefaultNegotiator as g, hasCapability as h, isCharCellSize as i, isLocatorPosition as j, isPrimaryDA as k, isScreenSize as l, isSecondaryDA as m, isTextAreaSize as n, isUnknown as o, isWindowPosition as p, isWindowSizePixels as q, resetDefaultNegotiator as r, isWindowState as s, isWindowTitle as t, parseResponse as u, type CapabilityNegotiator as v, type CharCellSizeResponse as w, type CursorPositionResponse as x, CursorPositionSchema as y, type CursorShapeType as z };