@orkestrel/terminal 0.0.7 → 0.0.9

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.
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _src_core = require("../core/index.cjs");
3
+ let _orkestrel_form = require("@orkestrel/form");
3
4
  let _orkestrel_console = require("@orkestrel/console");
4
5
  let node_readline = require("node:readline");
5
6
  let node_process = require("node:process");
@@ -10,8 +11,8 @@ var ESCAPE = String.fromCharCode(27);
10
11
  var CSI = `[`;
11
12
  /**
12
13
  * The cursor-UP sequence TEMPLATE (`ESC[{count}A`) — {@link import('./helpers.js').moveUp}
13
- * interpolates `{count}` with the number of lines to climb (the `{count}` placeholder idiom the core
14
- * terminals' `RULE_MESSAGES` uses). Kept as a template so the count stays out of the constant.
14
+ * interpolates the `{count}` placeholder with the number of lines to climb. Kept as a template so
15
+ * the count stays out of the constant.
15
16
  */
16
17
  var CSI_UP = `${CSI}{count}A`;
17
18
  /**
@@ -32,13 +33,47 @@ var CARRIAGE_RETURN = String.fromCharCode(13);
32
33
  /** A line feed (`\n`, U+000A) — the line terminator the driver writes after the final committed prompt view. */
33
34
  var LINE_FEED = String.fromCharCode(10);
34
35
  /**
35
- * The numbered-list prompt the non-TTY {@link import('./Terminal.js').Terminal} `select` / `checkbox`
36
- * fallback appends — a piped (non-terminal) stream cannot navigate with arrow keys, so the choices are
37
- * printed numbered and the user types the number(s) on a single readline line.
36
+ * The numbered-list prompt the non-TTY {@link import('./Terminal.js').Terminal} `select` fallback
37
+ * appends — a piped (non-terminal) stream cannot navigate with arrow keys, so the choices are
38
+ * printed numbered and the user types one number on a single readline line.
38
39
  */
39
40
  var FALLBACK_SELECT_HINT = "Enter a number";
40
41
  /** The comma-separated multi-select hint the non-TTY `checkbox` fallback shows (the user types one or more numbers). */
41
42
  var FALLBACK_CHECKBOX_HINT = "Enter numbers separated by commas";
43
+ /** The hint the non-TTY `editor` fallback shows — a piped stream has no ctrl-d, so end of input finishes the block. */
44
+ var FALLBACK_EDITOR_HINT = "(end of input finishes)";
45
+ /** The hint the non-TTY `confirm` fallback shows — a piped stream sends a whole line, so the answer is typed rather than pressed. */
46
+ var FALLBACK_CONFIRM_HINT = "(y/n)";
47
+ /**
48
+ * The format cue appended to a field's label for each control the walk reads as a line of text —
49
+ * the terminal has no date picker, no color well, and no file chooser, so the accepted shape is
50
+ * stated instead. A control with no entry needs none: `text` and `editor` accept any line,
51
+ * `password` masks one, and `confirm`, `select`, and `checkbox` are answered by key rather than by
52
+ * format. The form's own rules still decide whether the typed value is acceptable.
53
+ */
54
+ var CONTROL_HINTS = Object.freeze({
55
+ number: "(number)",
56
+ date: "(YYYY-MM-DD)",
57
+ time: "(HH:MM)",
58
+ datetime: "(YYYY-MM-DDTHH:MM)",
59
+ color: "(#rrggbb)",
60
+ file: "(path)"
61
+ });
62
+ /** The instruction a `file` field with `multiple` shows before its entries — one path per line, and a blank line ends the list. */
63
+ var FILE_HINT = "One path per line, blank to finish";
64
+ /** The lead on the line listing an open `select`'s offered values, which a typed answer may ignore. */
65
+ var SUGGESTION_LEAD = "Suggestions";
66
+ /** The lead on the line listing the choices a `select` or `checkbox` shows but refuses, so a reader sees why one is missing from the list below. */
67
+ var UNAVAILABLE_LEAD = "Unavailable";
68
+ /** The mark on a locked field's line — the walk renders its value and moves on, because the form refuses an edit there. */
69
+ var LOCKED_MARK = "(locked)";
70
+ /**
71
+ * What a field is told when the walk read an answer the control cannot hold — a word typed into a
72
+ * `number`, an off-list value typed into an open `select` whose choice is refused. The value binds
73
+ * as absence and this message is invalidated onto the field, so the walk re-asks it with the reason
74
+ * on screen.
75
+ */
76
+ var REFUSAL_MESSAGE = "Enter a value this field accepts";
42
77
  //#endregion
43
78
  //#region src/server/helpers.ts
44
79
  /**
@@ -86,18 +121,6 @@ function isReadable(value) {
86
121
  return typeof value === "object" && value !== null && "read" in value && typeof value.read === "function" && "pipe" in value && typeof value.pipe === "function";
87
122
  }
88
123
  /**
89
- * Whether `value` is a Node {@link NodeJS.WritableStream} — a total structural guard (AGENTS §14)
90
- * checking for the callable `write` / `end` that `node:readline`'s `createInterface` accepts as its
91
- * `output`. Paired with {@link isReadable} so the non-TTY fallback narrows BOTH streams to the
92
- * readline boundary without an `as`. Never throws.
93
- *
94
- * @param value - The resolved output stream (or any value crossing the boundary)
95
- * @returns `true` when `value` has the writable methods readline needs
96
- */
97
- function isWritable(value) {
98
- return typeof value === "object" && value !== null && "write" in value && typeof value.write === "function" && "end" in value && typeof value.end === "function";
99
- }
100
- /**
101
124
  * Whether an input stream can be driven in RAW mode — it both reports `isTTY === true` AND exposes a
102
125
  * callable `setRawMode`. The {@link import('./Terminal.js').Terminal} probes this to choose its path:
103
126
  * `true` ⇒ the interactive raw-mode prompts (arrow-key navigation, live re-render); `false` ⇒ the
@@ -157,81 +180,389 @@ function moveUp(count) {
157
180
  function redrawPrefix(previousLines) {
158
181
  return `${moveUp(previousLines - 1)}\r${CLEAR_DOWN}`;
159
182
  }
183
+ /**
184
+ * Project any field the walk reads as a LINE OF TEXT into the {@link TextField} the text reducer
185
+ * takes — `text` itself, and the six controls a terminal has no widget for: `number`, `date`,
186
+ * `time`, `datetime`, `color`, and one `file` entry. The label carries that control's format cue
187
+ * from {@link CONTROL_HINTS}, and a declared `default` becomes the line a bare return submits. The
188
+ * projection carries no rule, because the AUTHORITATIVE form still evaluates the answer this line
189
+ * binds; it exists only so one reducer can render seven controls.
190
+ *
191
+ * @param field - The field being read
192
+ * @returns The text field the reducer renders for it
193
+ *
194
+ * @example
195
+ * ```ts
196
+ * fieldToText({ control: 'date', name: 'born', label: 'Birthday' })
197
+ * // { control: 'text', name: 'born', label: 'Birthday (YYYY-MM-DD)' }
198
+ * ```
199
+ */
200
+ function fieldToText(field) {
201
+ const label = field.label ?? field.name;
202
+ const hint = CONTROL_HINTS[field.control];
203
+ const seed = "default" in field ? field.default : void 0;
204
+ const text = typeof seed === "number" ? String(seed) : seed;
205
+ return {
206
+ control: "text",
207
+ name: field.name,
208
+ label: hint === void 0 ? label : `${label} ${hint}`,
209
+ ...typeof text === "string" ? { default: text } : {}
210
+ };
211
+ }
212
+ /**
213
+ * Project one held answer into the text a read-only line shows — a scalar as itself, a boolean as
214
+ * `yes` / `no` (the word the confirm reducer commits), and a list joined by commas. Absence renders
215
+ * as nothing, because a locked field nobody has answered has nothing to show.
216
+ *
217
+ * @param value - The answer the form holds for a field, or absence
218
+ * @returns The text to render for it
219
+ */
220
+ function valueToText(value) {
221
+ if (value === void 0) return "";
222
+ if (typeof value === "string") return value;
223
+ if (typeof value === "number") return String(value);
224
+ if (typeof value === "boolean") return value ? "yes" : "no";
225
+ return value.join(", ");
226
+ }
227
+ /**
228
+ * The choices a `select` or `checkbox` field actually OFFERS — the form refuses a disabled choice's
229
+ * value at every door, including a fill, so the walk never puts one in front of the cursor. Pair
230
+ * with {@link disabledChoices} to tell the reader what was withheld.
231
+ *
232
+ * @param choices - The field's declared choices
233
+ * @returns The choices the walk offers, in declared order
234
+ */
235
+ function enabledChoices(choices) {
236
+ return choices.filter((choice) => choice.disabled !== true);
237
+ }
238
+ /**
239
+ * The choices a `select` or `checkbox` field SHOWS but refuses — the complement of
240
+ * {@link enabledChoices}, rendered by {@link unavailableLine} above the list so a reader sees why a
241
+ * declared choice is missing from it.
242
+ *
243
+ * @param choices - The field's declared choices
244
+ * @returns The refused choices, in declared order
245
+ */
246
+ function disabledChoices(choices) {
247
+ return choices.filter((choice) => choice.disabled === true);
248
+ }
249
+ /** The section header the walk writes when it enters a new field group, painted by the `message` role. */
250
+ function groupHeader(styler, theme, label) {
251
+ return styler.render(theme.roles.message, label);
252
+ }
253
+ /**
254
+ * The read-only line a LOCKED field renders — its label, the {@link LOCKED_MARK}, and the answer the
255
+ * form already holds. The walk writes this instead of a prompt, because the field is still
256
+ * validated and still submitted but must not be edited here.
257
+ *
258
+ * @param styler - The console styler that renders each role
259
+ * @param theme - The resolved prompt theme
260
+ * @param label - The field's label
261
+ * @param value - The held answer, from {@link valueToText}
262
+ * @returns The rendered line, with no trailing space when there is nothing to show
263
+ */
264
+ function lockedLine(styler, theme, label, value) {
265
+ const head = `${styler.render(theme.roles.muted, theme.icons.dot)} ${styler.render(theme.roles.message, label)} ${styler.render(theme.roles.hint, LOCKED_MARK)}`;
266
+ return value.length === 0 ? head : `${head} ${styler.render(theme.roles.content, value)}`;
267
+ }
268
+ /** The line listing an OPEN select's offered values above its text prompt — a suggestion list, because an open select admits an answer the list does not offer. */
269
+ function suggestionLine(styler, theme, choices) {
270
+ const values = choices.map((choice) => choice.value).join(", ");
271
+ return styler.render(theme.roles.hint, `${SUGGESTION_LEAD}: ${values}`);
272
+ }
273
+ /** The line naming the choices a field shows but refuses, written above the list the walk drives. */
274
+ function unavailableLine(styler, theme, choices) {
275
+ const labels = choices.map((choice) => choice.label).join(", ");
276
+ return styler.render(theme.roles.muted, `${UNAVAILABLE_LEAD}: ${labels}`);
277
+ }
278
+ /**
279
+ * The numbered choice list the non-TTY fallback prints — a piped stream cannot navigate with arrow
280
+ * keys, so each offered choice is printed with the number the reader types back. One line per
281
+ * choice, with no trailing newline.
282
+ *
283
+ * @param styler - The console styler that renders each role
284
+ * @param theme - The resolved prompt theme
285
+ * @param choices - The choices the walk offers, from {@link enabledChoices}
286
+ * @returns The rendered list
287
+ */
288
+ function numberedList(styler, theme, choices) {
289
+ return choices.map((choice, index) => ` ${styler.render(theme.roles.muted, `${String(index + 1)})`)} ${styler.render(theme.roles.content, choice.label)}`).join("\n");
290
+ }
160
291
  //#endregion
161
292
  //#region src/server/Terminal.ts
162
293
  /**
163
- * The interactive terminal prompt driver (T-c) — the third {@link TerminalInterface} surface (beside
164
- * the core headless `Prompt` broker and the SSE `PromptClient` bridge), and the ONLY impure part of
165
- * the prompt stack. It reads the TTY and DRIVES the pure core `*Reduce` reducers: it feeds raw-mode
166
- * stdin bytes through `parseKey` into the matching reducer, renders the returned `view` in place, and
167
- * resolves on a `submit` step / rejects with a {@link TerminalError} (`CANCEL`) on ctrl-c. It owns no
168
- * prompt logic of its own — state, view, validation, and the cancel signal all come from the pure
169
- * core; this class owns ONLY the cursor + raw-mode + in-place re-render mechanics.
294
+ * The interactive terminal form DRIVER — the {@link TerminalInterface} implementation for a human at
295
+ * this machine's keyboard, and the only impure part of the terminal stack. {@link ask} walks one
296
+ * form's fields in schema order, feeds raw-mode stdin bytes through `parseKey` into the matching
297
+ * pure reducer, renders each returned view in place, and binds every answer through the form's own
298
+ * `fill`. It owns no form logic: the schema, the rules, the values, and the settlement all belong to
299
+ * the form it is given, and this class owns only raw mode, the cursor, and the re-render.
170
300
  *
171
301
  * @remarks
172
- * See {@link TerminalInterface} for the behavioral contract (raw-mode leak-freedom, the in-place
173
- * re-render, the non-TTY readline fallback, event-free).
302
+ * See {@link TerminalInterface} for the driving contract. The walk itself:
303
+ *
304
+ * - **Twelve controls, seven reducers.** `text`, `number`, `date`, `time`, `datetime`, `color`, and
305
+ * each `file` entry are read as one line of text through {@link fieldToText}, which appends that
306
+ * control's format cue to the label. `password`, `confirm`, `editor`, `select`, and `checkbox`
307
+ * each drive their own reducer. An open `select` is a suggestion list plus a typed line, because
308
+ * `open` means the answer need not come from the list.
309
+ * - **The binding projects through `matchesAnswer`.** Every answer is filled as
310
+ * `fill(name, matchesAnswer(value) ? value : undefined)` after `parseValue` has coerced it to the
311
+ * control's own shape, so a bare return on a field with no default binds as ABSENCE and the
312
+ * form's `required` rule refuses it. A typed answer the control cannot hold binds as absence and
313
+ * invalidates the field, so the walk asks again with the reason on screen.
314
+ * - **Visibility is honored.** A `hidden` field and a field currently in `form.disabled` are
315
+ * skipped; a `locked` field renders read-only; entering a new group writes its label as a section
316
+ * header.
317
+ * - **Refusal re-asks.** After the walk the form is submitted. A refusal re-walks only the erroring
318
+ * fields the walk can edit and submits again. When every erroring field is one the walk cannot
319
+ * edit — hidden, locked, or disabled — the form is abandoned instead, because asking again could
320
+ * not change the answer.
321
+ * - **Raw-mode leak-free.** Raw mode is entered once per field and always cleaned up: on submit, on
322
+ * cancel, on a throw, and when the form is abandoned under an active read.
323
+ * - **Non-TTY fallback.** When `input` is not a TTY, the same walk runs over `node:readline` line
324
+ * input: `select` and `checkbox` print a numbered list, and `editor` reads to end of input.
174
325
  */
175
326
  var Terminal = class {
176
327
  #input;
177
328
  #output;
329
+ #styler;
330
+ #theme;
178
331
  #handlers = /* @__PURE__ */ new Map();
332
+ #queue = [];
333
+ #interface;
334
+ #taker;
335
+ #ended = false;
179
336
  constructor(options) {
180
337
  this.#input = isInputStream(options?.input) ? options.input : node_process.stdin;
181
338
  this.#output = isOutputStream(options?.output) ? options.output : node_process.stdout;
339
+ this.#styler = (0, _orkestrel_console.createStyler)();
340
+ this.#theme = (0, _src_core.createPromptTheme)(options?.theme);
341
+ }
342
+ async ask(form) {
343
+ try {
344
+ this.#report(form, form.errors);
345
+ await this.#walk(form, form.schema.fields);
346
+ for (;;) {
347
+ if (form.status !== "editing") return await form.answer;
348
+ const result = form.submit();
349
+ if (result.success) return await form.answer;
350
+ this.#report(form, result.error);
351
+ const again = this.#editable(form, result.error);
352
+ if (again.length === 0 || this.#ended) {
353
+ form.destroy();
354
+ return await form.answer;
355
+ }
356
+ await this.#walk(form, again);
357
+ }
358
+ } finally {
359
+ this.#close();
360
+ }
361
+ }
362
+ /**
363
+ * Ask `fields` in the order given, skipping what the walk must not touch and rendering what it
364
+ * must not edit. Returns early the moment the form stops being editable, so an abandoned form
365
+ * ends the walk between fields as well as under an active read.
366
+ */
367
+ async #walk(form, fields) {
368
+ let group;
369
+ for (const field of fields) {
370
+ if (form.status !== "editing") return;
371
+ if (field.hidden === true) continue;
372
+ if (form.disabled.has(field.name)) continue;
373
+ if (field.group !== group) {
374
+ group = field.group;
375
+ if (group !== void 0) this.#group(form, group);
376
+ }
377
+ if (field.locked === true) {
378
+ this.#locked(form, field);
379
+ continue;
380
+ }
381
+ const raw = await this.#read(form, field);
382
+ if (form.status !== "editing") return;
383
+ this.#bind(form, field, raw);
384
+ }
385
+ }
386
+ /** Write a group's label as a section header, resolving the schema's declared label and falling back to the group's own name. */
387
+ #group(form, name) {
388
+ const label = form.schema.groups?.find((group) => group.name === name)?.label ?? name;
389
+ this.#output.write(`
390
+ ${groupHeader(this.#styler, this.#theme, (0, _src_core.sanitizeDisplayText)(label))}
391
+ `);
392
+ }
393
+ /** Render a locked field read-only — its label, its mark, and the answer the form already holds. */
394
+ #locked(form, field) {
395
+ const line = lockedLine(this.#styler, this.#theme, (0, _src_core.sanitizeDisplayText)(field.label ?? field.name), (0, _src_core.sanitizeDisplayText)(valueToText(form.values[field.name])));
396
+ this.#output.write(`${line}
397
+ `);
398
+ }
399
+ /** Read one field through the reducer its control names, resolving the raw answer the binding projects. */
400
+ #read(form, field) {
401
+ if (field.control === "password") return this.#password(form, field);
402
+ if (field.control === "confirm") return this.#confirm(form, field);
403
+ if (field.control === "editor") return this.#editor(form, field);
404
+ if (field.control === "select") return this.#select(form, field);
405
+ if (field.control === "checkbox") return this.#checkbox(form, field);
406
+ if (field.control === "file") return this.#file(form, field);
407
+ return this.#text(form, field);
182
408
  }
183
- input(options) {
184
- const state = (0, _src_core.createInputState)(options);
185
- if (rawCapable(this.#input)) return this.#drive(state, _src_core.inputReduce);
186
- return this.#lineFallback(options.message, options.styler, (answer) => {
187
- const value = answer.length > 0 ? answer : options.default ?? "";
188
- return (0, _src_core.resolveValidation)(options.validate)(value) === true ? { value } : void 0;
189
- }, (answer) => answer.length > 0 ? answer : options.default ?? "");
190
- }
191
- password(options) {
192
- const state = (0, _src_core.createPasswordState)(options);
193
- if (rawCapable(this.#input)) return this.#drive(state, _src_core.passwordReduce);
194
- return this.#lineFallback(options.message, options.styler, (answer) => (0, _src_core.resolveValidation)(options.validate)(answer) === true ? { value: answer } : void 0, (answer) => answer, true);
195
- }
196
- confirm(options) {
197
- const state = (0, _src_core.createConfirmState)(options);
198
- if (rawCapable(this.#input)) return this.#drive(state, _src_core.confirmReduce);
199
- return this.#lineFallback(options.message, options.styler, (answer) => {
200
- const normalized = answer.trim().toLowerCase();
201
- if (normalized.length === 0) return { value: options.default ?? false };
202
- if (normalized === "y" || normalized === "yes") return { value: true };
203
- if (normalized === "n" || normalized === "no") return { value: false };
204
- }, () => options.default ?? false);
205
- }
206
- select(options) {
207
- const state = (0, _src_core.createSelectState)(options);
208
- if (rawCapable(this.#input)) return this.#drive(state, _src_core.selectReduce);
209
- return this.#listFallback(options.message, options.styler, state.choices, FALLBACK_SELECT_HINT, (line) => {
210
- const index = Number.parseInt(line.trim(), 10) - 1;
211
- const choice = state.choices[index];
212
- return choice === void 0 ? void 0 : { value: choice.value };
213
- }, "");
214
- }
215
- checkbox(options) {
216
- const state = (0, _src_core.createCheckboxState)(options);
217
- if (rawCapable(this.#input)) return this.#drive(state, _src_core.checkboxReduce);
218
- return this.#listFallback(options.message, options.styler, state.choices, FALLBACK_CHECKBOX_HINT, (line) => {
219
- const indices = line.split(",").map((part) => Number.parseInt(part.trim(), 10) - 1).filter((index) => index >= 0 && index < state.choices.length);
220
- if (options.min !== void 0 && indices.length < options.min) return void 0;
221
- if (options.max !== void 0 && indices.length > options.max) return void 0;
222
- return { value: indices.map((index) => state.choices[index]?.value).filter((value) => value !== void 0) };
223
- }, []);
224
- }
225
- editor(options) {
226
- const state = (0, _src_core.createEditorState)(options);
227
- if (rawCapable(this.#input)) return this.#drive(state, _src_core.editorReduce);
228
- return this.#editorFallback(options);
409
+ /**
410
+ * Bind one raw answer to the form — the single binding, and the only place this driver writes a
411
+ * value. `parseValue` coerces the raw answer to the control's own shape and `matchesAnswer`
412
+ * projects a blank one to absence, which is what keeps `required` refusing a bare return. A raw
413
+ * answer the control cannot hold binds as absence and invalidates the field, so the field comes
414
+ * back on the next pass carrying the reason rather than vanishing silently.
415
+ */
416
+ #bind(form, field, raw) {
417
+ form.touch(field.name);
418
+ const value = raw === void 0 ? void 0 : (0, _orkestrel_form.parseValue)(field, raw);
419
+ form.fill(field.name, (0, _orkestrel_form.matchesAnswer)(value) ? value : void 0);
420
+ if (value === void 0 && (0, _orkestrel_form.matchesAnswer)(raw)) form.invalidate(field.name, REFUSAL_MESSAGE);
421
+ }
422
+ /** The erroring fields the walk can ask again — every field the walk skips or renders read-only is excluded, because a second pass could not change its answer. */
423
+ #editable(form, errors) {
424
+ const fields = [];
425
+ for (const error of errors) {
426
+ const field = form.field(error.field);
427
+ if (field === void 0) continue;
428
+ if (field.hidden === true || field.locked === true) continue;
429
+ if (form.disabled.has(field.name)) continue;
430
+ if (fields.some((held) => held.name === field.name)) continue;
431
+ fields.push(field);
432
+ }
433
+ return fields;
434
+ }
435
+ /** Write every supplied failure against its field's label. */
436
+ #report(form, errors) {
437
+ for (const error of errors) {
438
+ const label = (0, _src_core.sanitizeDisplayText)(form.field(error.field)?.label ?? error.field);
439
+ const message = (0, _src_core.sanitizeDisplayText)(error.message);
440
+ const line = (0, _src_core.errorLine)(this.#styler, this.#theme, `${label}: ${message}`);
441
+ this.#output.write(`${line}
442
+ `);
443
+ }
444
+ }
445
+ /** Read a field as one line of text — `text` itself and the six controls a terminal has no widget for. */
446
+ #text(form, field) {
447
+ const state = (0, _src_core.createInputState)(fieldToText(field), this.#styler, this.#theme);
448
+ if (rawCapable(this.#input)) return this.#drive(form, state, _src_core.inputReduce);
449
+ return this.#line(form, state.message, state.default);
450
+ }
451
+ /** Read a secret — masked live in raw mode, and read without echo through readline on a stream that cannot enter it. */
452
+ #password(form, field) {
453
+ const state = (0, _src_core.createPasswordState)(field, this.#styler, this.#theme);
454
+ if (rawCapable(this.#input)) return this.#drive(form, state, _src_core.passwordReduce);
455
+ return this.#prompt(form, (0, _src_core.promptHeader)(this.#styler, this.#theme, state.message));
456
+ }
457
+ /**
458
+ * Read a yes or no. The fallback accepts `y` / `yes` / `n` / `no` in any case and takes the
459
+ * field's default for a bare line; anything else is returned as typed, so the binding refuses it
460
+ * and the walk asks again rather than silently reading it as no.
461
+ */
462
+ async #confirm(form, field) {
463
+ const state = (0, _src_core.createConfirmState)(field, this.#styler, this.#theme);
464
+ if (rawCapable(this.#input)) return this.#drive(form, state, _src_core.confirmReduce);
465
+ const header = (0, _src_core.hintedHeader)(this.#styler, this.#theme, state.message, FALLBACK_CONFIRM_HINT);
466
+ const line = await this.#prompt(form, header);
467
+ const answer = line.trim().toLowerCase();
468
+ if (answer.length === 0) return state.default;
469
+ if (answer === "y" || answer === "yes") return true;
470
+ if (answer === "n" || answer === "no") return false;
471
+ return line.trim();
472
+ }
473
+ /** Read text over many lines — ctrl-d finishes in raw mode, and end of input finishes on a piped stream. */
474
+ #editor(form, field) {
475
+ const state = (0, _src_core.createEditorState)(field, this.#styler, this.#theme);
476
+ if (rawCapable(this.#input)) return this.#drive(form, state, _src_core.editorReduce);
477
+ return this.#block(form, state.message, state.default);
478
+ }
479
+ /**
480
+ * Read one choice. A disabled choice is named above the list and never offered, because the form
481
+ * refuses its value at every door. An open select is a suggestion list plus a typed line, since
482
+ * `open` admits an answer the list does not offer; a closed select with nothing left to offer
483
+ * resolves absence and lets the form's own rules report it.
484
+ */
485
+ async #select(form, field) {
486
+ const choices = enabledChoices(field.choices);
487
+ this.#unavailable(field.choices);
488
+ if (field.open === true) {
489
+ if (choices.length > 0) {
490
+ const display = choices.map((choice) => ({
491
+ ...choice,
492
+ value: (0, _src_core.sanitizeDisplayText)(choice.value)
493
+ }));
494
+ this.#output.write(`${suggestionLine(this.#styler, this.#theme, display)}
495
+ `);
496
+ }
497
+ return this.#text(form, field);
498
+ }
499
+ if (choices.length === 0) return void 0;
500
+ const state = (0, _src_core.createSelectState)({
501
+ ...field,
502
+ choices
503
+ }, this.#styler, this.#theme);
504
+ if (rawCapable(this.#input)) return this.#drive(form, state, _src_core.selectReduce);
505
+ this.#list(state.message, choices);
506
+ const line = await this.#prompt(form, this.#hint(`${FALLBACK_SELECT_HINT}:`));
507
+ return choices[Number.parseInt(line.trim(), 10) - 1]?.value;
508
+ }
509
+ /**
510
+ * Read any number of choices. Disabled choices are named above the list and never offered, so a
511
+ * box the form would refuse can never be ticked. An empty answer is an answered "none of them",
512
+ * which is what `matchesAnswer` says an empty list means.
513
+ */
514
+ async #checkbox(form, field) {
515
+ const choices = enabledChoices(field.choices);
516
+ this.#unavailable(field.choices);
517
+ const state = (0, _src_core.createCheckboxState)({
518
+ ...field,
519
+ choices
520
+ }, this.#styler, this.#theme);
521
+ if (rawCapable(this.#input)) return this.#drive(form, state, _src_core.checkboxReduce);
522
+ this.#list(state.message, choices);
523
+ return (await this.#prompt(form, this.#hint(`${FALLBACK_CHECKBOX_HINT}:`))).split(",").map((part) => choices[Number.parseInt(part.trim(), 10) - 1]?.value).filter((value) => value !== void 0);
524
+ }
525
+ /**
526
+ * Read file paths — names only, because bytes never enter a form. A `multiple` field collects one
527
+ * path per line until a blank one, and a single field takes one. No path at all is absence rather
528
+ * than an empty list, because the reader answered a blank line.
529
+ */
530
+ async #file(form, field) {
531
+ if (field.multiple === true) this.#output.write(`${this.#hint(FILE_HINT)}
532
+ `);
533
+ const paths = [];
534
+ for (;;) {
535
+ const entry = await this.#text(form, field);
536
+ if (entry.length === 0) break;
537
+ paths.push(entry);
538
+ if (field.multiple !== true || this.#ended) break;
539
+ }
540
+ return paths.length > 0 ? paths : void 0;
541
+ }
542
+ /** Name the choices a field shows but refuses, above the list the walk drives. */
543
+ #unavailable(choices) {
544
+ const refused = disabledChoices(choices);
545
+ if (refused.length === 0) return;
546
+ this.#output.write(`${unavailableLine(this.#styler, this.#theme, refused)}
547
+ `);
548
+ }
549
+ /** Write a field's header above its numbered choice list — the non-TTY presentation of a choice field. */
550
+ #list(message, choices) {
551
+ const header = (0, _src_core.promptHeader)(this.#styler, this.#theme, message);
552
+ const list = numberedList(this.#styler, this.#theme, choices);
553
+ this.#output.write(`${header}
554
+ ${list}
555
+ `);
556
+ }
557
+ /** Paint one line of supplementary instruction through the `hint` role. */
558
+ #hint(text) {
559
+ return this.#styler.render(this.#theme.roles.hint, text);
229
560
  }
230
561
  /**
231
562
  * The irreducible Node raw-mode primitive — the ONLY place raw mode is touched. Switches the input
232
563
  * into raw mode (each keypress delivered immediately, no echo), resumes its flow, and subscribes
233
564
  * `handler` to `'data'`. The paired {@link #leaveRaw} operation unsubscribes the exact handler,
234
- * leaves raw mode, and pauses the stream on submit, cancel, or throw.
565
+ * leaves raw mode, and pauses the stream on submit, cancel, abandon, or throw.
235
566
  */
236
567
  #enterRaw(token, handler) {
237
568
  this.#handlers.set(token, handler);
@@ -248,21 +579,20 @@ var Terminal = class {
248
579
  this.#input.pause?.();
249
580
  }
250
581
  /**
251
- * Drive ONE interactive prompt over raw-mode stdin — the generic engine all six TTY prompts share.
252
- * Renders the reducer's initial `view`, enters raw mode once, and on each keypress runs `parseKey`
253
- * → `reduce` → an in-place re-render; on `submit` it cleans up + resolves the reducer's `value`, on
254
- * `cancel` (ctrl-c) it cleans up + rejects a {@link TerminalError} (`CANCEL`). Raw mode is entered
255
- * exactly once and cleaned up on every exit path (submit / cancel / a throw inside a step), so no
256
- * raw mode and no `'data'` listener ever leak. The cursor is hidden for the duration and restored
257
- * on exit.
582
+ * Drive ONE field over raw-mode stdin — the generic engine every interactive control shares.
583
+ * Renders the reducer's initial view, enters raw mode once, and on each keypress runs `parseKey` →
584
+ * `reduce` → an in-place re-render; on `submit` it cleans up and resolves the reducer's value, on
585
+ * `cancel` (ctrl-c) it cleans up and rejects a {@link TerminalError} coded `CANCEL`. Abandoning
586
+ * the form ends the read too, through the rejection of its own `answer`. Raw mode is entered
587
+ * exactly once and cleaned up on every exit path, so no raw mode and no `'data'` listener ever
588
+ * leaks. The cursor is hidden for the duration and restored on exit.
258
589
  */
259
- #drive(initial, reduce) {
590
+ #drive(form, initial, reduce) {
260
591
  return new Promise((resolve, reject) => {
261
- const state = initial;
262
592
  this.#output.write(CURSOR_HIDE);
263
593
  let firstView;
264
594
  try {
265
- firstView = reduce(state, (0, _src_core.parseKey)("")).view;
595
+ firstView = reduce(initial, (0, _src_core.parseKey)("")).view;
266
596
  this.#output.write(firstView);
267
597
  } catch (error) {
268
598
  this.#output.write(`${CURSOR_SHOW}
@@ -271,8 +601,9 @@ var Terminal = class {
271
601
  return;
272
602
  }
273
603
  const token = {};
274
- const handler = this.#createHandler(token, state, lineCount(firstView), reduce, resolve, reject);
604
+ const handler = this.#createHandler(token, initial, lineCount(firstView), reduce, resolve, reject);
275
605
  this.#enterRaw(token, handler);
606
+ form.answer.catch((error) => this.#interrupt(token, reject, error));
276
607
  });
277
608
  }
278
609
  #createHandler(token, initial, initialLines, reduce, resolve, reject) {
@@ -302,165 +633,168 @@ var Terminal = class {
302
633
  }
303
634
  };
304
635
  }
305
- /** Redraw a prompt view in place — climb over the previous view's `previousLines`, clear, and write the new view (the pure cursor-math is {@link redrawPrefix}). */
636
+ /** End an active read that the form outlived — release raw mode exactly as a submit does, then fail the read with the form's own error. */
637
+ #interrupt(token, reject, error) {
638
+ if (!this.#handlers.has(token)) return;
639
+ this.#leaveRaw(token);
640
+ this.#output.write(`${CURSOR_SHOW}
641
+ `);
642
+ reject(error);
643
+ }
644
+ /** Redraw a field view in place — climb over the previous view's `previousLines`, clear, and write the new view (the pure cursor-math is {@link redrawPrefix}). */
306
645
  #render(view, previousLines) {
307
646
  this.#output.write(`${redrawPrefix(previousLines)}${view}`);
308
647
  }
648
+ /** Read one line for a text-shaped field, taking the field's default when the line is bare. */
649
+ async #line(form, message, seed) {
650
+ const answer = await this.#prompt(form, (0, _src_core.promptHeader)(this.#styler, this.#theme, message));
651
+ return answer.length > 0 ? answer : seed;
652
+ }
309
653
  /**
310
- * Read a single line via `node:readline` and accept it through `take` — the non-TTY line-input
311
- * fallback shared by `input` / `password` / `confirm`. Re-prompts until `take` returns a value (so
312
- * validation still gates), writing the prompt header each round. A piped stream cannot enter raw
313
- * mode, so there is no masking / live edit — just a validated line read.
314
- *
315
- * @remarks
316
- * The re-prompt loop is bounded by end-of-input: once the stream reaches EOF (a piped stream that
317
- * ran out, or one with no trailing newline) it can never deliver another line, so re-prompting
318
- * would SPIN. On EOF the loop accepts the final line through `take` if it passes, else returns the
319
- * caller's `eof` fallback (the default / empty value) — the prompt always settles, never spins.
654
+ * Read a whole block for an `editor` field — a piped stream has no ctrl-d keypress, so end of
655
+ * input is the terminator. It drains every remaining line, which is why nothing after an `editor`
656
+ * field can be asked on the same stream.
320
657
  */
321
- async #lineFallback(message, styler, take, eof, masked = false) {
322
- const paint = styler ?? (0, _orkestrel_console.createStyler)();
658
+ async #block(form, message, seed) {
659
+ const header = (0, _src_core.hintedHeader)(this.#styler, this.#theme, message, FALLBACK_EDITOR_HINT);
660
+ this.#output.write(`${header}
661
+ `);
662
+ const collected = [];
323
663
  for (;;) {
324
- const { answer, ended } = await this.#question(`${paint.cyan("?")} ${paint.bold(message)} `, masked);
325
- const accepted = take(answer);
326
- if (accepted !== void 0) return accepted.value;
327
- if (ended) return eof(answer);
664
+ const line = await this.#next(form);
665
+ if (line === void 0) break;
666
+ collected.push(line);
328
667
  }
668
+ const text = collected.join("\n");
669
+ return text.length > 0 ? text : seed;
670
+ }
671
+ /** Write one field's header and read back the line the reader answers it with, or `''` once the stream has ended. */
672
+ async #prompt(form, header) {
673
+ this.#output.write(`${header} `);
674
+ return await this.#next(form) ?? "";
329
675
  }
330
676
  /**
331
- * Print a numbered choice list, then read one readline line and accept it through `take` — the
332
- * non-TTY fallback for `select` / `checkbox`. The list is rendered once; the user types the
333
- * number(s); `take` parses + gates the line, re-prompting until it returns a value.
677
+ * Take the next line the input carries — from the buffer when the reader has already read ahead,
678
+ * and otherwise by waiting for one. It resolves ABSENCE once the stream has ended, so a walk over
679
+ * an exhausted stream settles instead of waiting forever, and it rejects when the form is
680
+ * abandoned, so an unanswerable read ends with the form rather than outliving it.
334
681
  */
335
- async #listFallback(message, styler, choices, hint, take, eof) {
336
- const paint = styler ?? (0, _orkestrel_console.createStyler)();
337
- let list = `${paint.cyan("?")} ${paint.bold(message)}\n`;
338
- choices.forEach((choice, index) => {
339
- list += ` ${paint.dim(`${String(index + 1)})`)} ${choice.name}\n`;
682
+ #next(form) {
683
+ const buffered = this.#queue.shift();
684
+ if (buffered !== void 0) return Promise.resolve(buffered);
685
+ if (this.#ended) return Promise.resolve(void 0);
686
+ this.#reader();
687
+ return new Promise((resolve, reject) => {
688
+ this.#taker = resolve;
689
+ form.answer.catch((error) => {
690
+ if (this.#taker !== resolve) return;
691
+ this.#taker = void 0;
692
+ reject(error);
693
+ });
340
694
  });
341
- this.#output.write(list);
342
- for (;;) {
343
- const { answer, ended } = await this.#question(`${paint.dim(`${hint}:`)} `);
344
- const accepted = take(answer);
345
- if (accepted !== void 0) return accepted.value;
346
- if (ended) return eof;
347
- }
348
695
  }
349
696
  /**
350
- * The non-TTY `editor` fallback — read lines until EOF (the readline `close`), join them, and fall
351
- * back to the default when empty. A piped stream has no ctrl-d keypress, so end-of-input is the
352
- * natural terminator.
353
- *
354
- * @remarks
355
- * Single-pass by necessity: `#lines` drains the whole stream to EOF in one read, so there is no
356
- * second block to re-prompt for (re-reading an exhausted stream returns nothing forever). Validation
357
- * is still applied; on a validation FAILURE the best-effort block is returned rather than spinning
358
- * on the consumed stream — the EOF analogue of the raw-mode editor's re-edit, which a piped stream
359
- * cannot offer.
697
+ * Open the walk's ONE readline interface, or keep the open one. A whole form is many questions
698
+ * over one stream, and an interface reads ahead: a fresh interface per question would swallow
699
+ * every line it read past the one it was asked for, so the walk holds a single reader and buffers
700
+ * what arrives early. It is closed when the walk ends, so the process is free to exit.
360
701
  */
361
- async #editorFallback(options) {
362
- const paint = options.styler ?? (0, _orkestrel_console.createStyler)();
363
- this.#output.write(`${paint.cyan("?")} ${paint.bold(options.message)} ${paint.dim("(EOF to finish)")}\n`);
364
- const text = await this.#lines();
365
- return text.length > 0 ? text : options.default ?? "";
702
+ #reader() {
703
+ if (this.#interface !== void 0) return;
704
+ const rl = (0, node_readline.createInterface)(this.#readline());
705
+ rl.on("line", (line) => this.#accept(line));
706
+ rl.on("close", () => this.#finish());
707
+ this.#interface = rl;
366
708
  }
367
- /**
368
- * Ask one readline question on the resolved streams and resolve the typed (un-trimmed) line plus
369
- * whether the stream ENDED. EOF (the readline `close`) before `rl.question`'s callback fires
370
- * resolves instead of hanging — a piped stream commonly ends WITHOUT a trailing newline (or is
371
- * empty), and the `question` callback only fires on a NEWLINE-terminated line, so without this the
372
- * prompt would wait forever. The trailing unterminated line is still recovered: readline emits it
373
- * as a `'line'` event just before `'close'`, so the last seen line (or `''` for a truly empty
374
- * stream) is returned with `ended: true`. The `ended` flag lets the fallback loops settle rather
375
- * than re-prompt an exhausted stream (which would SPIN). Settling is one-shot (a `close` after a
376
- * delivered line is ignored, so a normal newline-terminated line reports `ended: false`).
377
- */
378
- #question(prompt, masked = false) {
379
- const rl = (0, node_readline.createInterface)(this.#readline(masked));
380
- return new Promise((resolve) => {
381
- let last = "";
382
- const settle = this.#createQuestionSettler(rl, resolve);
383
- rl.on("line", (line) => {
384
- last = line;
385
- });
386
- rl.question(prompt, (answer) => settle(answer, false));
387
- rl.on("close", () => settle(last, true));
388
- });
709
+ /** Hand a line to whoever is waiting for it, or buffer it for the next question. */
710
+ #accept(line) {
711
+ const taker = this.#taker;
712
+ if (taker === void 0) {
713
+ this.#queue.push(line);
714
+ return;
715
+ }
716
+ this.#taker = void 0;
717
+ taker(line);
389
718
  }
390
- #createQuestionSettler(rl, resolve) {
391
- let settled = false;
392
- return (answer, ended) => {
393
- if (settled) return;
394
- settled = true;
395
- rl.close();
396
- resolve({
397
- answer,
398
- ended
399
- });
400
- };
719
+ /** Record that no further line can arrive and release whoever was waiting for one. */
720
+ #finish() {
721
+ this.#ended = true;
722
+ const taker = this.#taker;
723
+ if (taker === void 0) return;
724
+ this.#taker = void 0;
725
+ taker(void 0);
401
726
  }
402
- /** Read every line from the input until EOF and resolve them joined by newlines (the editor fallback's reader). */
403
- #lines() {
404
- const rl = (0, node_readline.createInterface)(this.#readline());
405
- const collected = [];
406
- return new Promise((resolve) => {
407
- rl.on("line", (line) => collected.push(line));
408
- rl.on("close", () => resolve(collected.join("\n")));
409
- });
727
+ /** Close the walk's reader and release a waiting question — the walk is over, so the stream must stop holding the process open. */
728
+ #close() {
729
+ const taker = this.#taker;
730
+ this.#taker = void 0;
731
+ if (taker !== void 0) taker(void 0);
732
+ const rl = this.#interface;
733
+ if (rl === void 0) return;
734
+ this.#interface = void 0;
735
+ rl.removeAllListeners("close");
736
+ rl.close();
410
737
  }
411
738
  /**
412
- * Narrow the resolved streams to the `node:readline` `createInterface` boundary (§14, never an
413
- * `as`). The non-TTY fallback only runs on a real piped `process.stdin` (or a `PassThrough` a test
414
- * injects), both genuine readables; a minimal non-readable fake reaching here means the fallback
415
- * was driven with a stream it cannot use, which fails loudly rather than silently.
739
+ * Narrow the resolved input to the `node:readline` `createInterface` boundary, never an assertion.
740
+ * The fallback only runs on a real piped `process.stdin` (or a `PassThrough` a test injects), both
741
+ * genuine readables; a minimal non-readable fake reaching here means the walk was driven with a
742
+ * stream it cannot use, which fails loudly rather than silently. `terminal: false` leaves readline
743
+ * as a line decoder and nothing else: the walk writes every prompt itself, through the same output
744
+ * every other line goes to, so nothing is written twice and a secret is never echoed.
416
745
  */
417
- #readline(masked = false) {
746
+ #readline() {
418
747
  const input = this.#input;
419
- const output = this.#output;
420
748
  if (!isReadable(input)) throw new _src_core.TerminalError("DRIVER", "Terminal fallback requires a readable input stream");
421
749
  return {
422
750
  input,
423
- ...isWritable(output) ? { output } : {},
424
- ...masked ? { terminal: false } : {}
751
+ terminal: false
425
752
  };
426
753
  }
427
754
  };
428
755
  //#endregion
429
756
  //#region src/server/factories.ts
430
757
  /**
431
- * Create the interactive terminal prompt {@link TerminalInterface} (T-c) — the local-TTY arm of the
432
- * prompt tri-surface, the env-symmetric sibling of the core headless `createPrompt` broker and the
433
- * SSE `createPromptClient` bridge. A `Terminal` answers each prompt LOCALLY at this machine's
434
- * keyboard: it reads raw-mode stdin, drives the pure core `*Reduce` reducers, renders each `view` in
435
- * place, and resolves on submit / rejects with a {@link import('@src/core').TerminalError} (`CANCEL`)
436
- * on ctrl-c. It is the ONLY impure part of the prompt stack.
758
+ * Create the interactive terminal form driver — the local-keyboard arm of the terminal trio, beside
759
+ * the core headless `createPrompt` broker and the SSE `createPromptClient` bridge. Where the broker
760
+ * PARKS a live form until somebody elsewhere answers it, a `Terminal` answers one HERE: it walks the
761
+ * form's fields in schema order, drives each control's pure reducer over raw-mode stdin, binds every
762
+ * answer through the form's own `fill`, and submits. It is the only impure part of the terminal
763
+ * stack.
437
764
  *
438
765
  * @param options - See {@link TerminalOptions}
439
- * @returns A {@link TerminalInterface} — the six async prompt forms (`input` / `password` / `confirm`
440
- * / `select` / `checkbox` / `editor`) driven over the resolved streams
766
+ * @returns A {@link TerminalInterface} whose `ask` drives one whole form over the resolved streams
441
767
  *
442
768
  * @remarks
443
- * - **Drives the pure reducers.** Each prompt builds its initial state (`create*State`), enters raw
444
- * mode ONCE, and feeds each keypress through `parseKey` → the reducer → an in-place re-render; the
445
- * driver owns no prompt logic itself (state / view / validation / cancel all come from the core).
446
- * - **Raw-mode leak-free.** Raw mode is entered exactly once per prompt and ALWAYS cleaned up — on
447
- * submit, on cancel, and on a throw — leaving no raw mode and no leaked `'data'` listener.
448
- * - **Injectable + guard-narrowed.** `options.input` / `options.output` default to `process.stdin` /
449
- * `process.stdout` but accept ANY {@link import('./types.js').InputStreamInterface} /
450
- * {@link import('./types.js').OutputStreamInterface}, resolved through their §14 guards (never an
451
- * `as`), so a test drives every prompt with a fake TTY that emits scripted key chunks and records
452
- * the rendered output — and asserts the resolved value, cancel-on-ctrl-c, and no leaked raw mode.
453
- * - **Non-TTY fallback.** When `input` is not a TTY (piped), raw mode is unavailable, so the prompts
454
- * fall back to `node:readline` line input (still validating); `select` / `checkbox` present a
455
- * numbered list, and `editor` reads lines until EOF.
769
+ * - **The form is the unit.** `ask` takes the caller's live form and returns its settled values. The
770
+ * returned promise is that form's own `answer`, so a caller holding the form can await either one.
771
+ * - **Every control renders.** Seven controls are read as a line of text with their format cue,
772
+ * `password` masks, `confirm` takes a key, `editor` takes a block, `select` and `checkbox` drive a
773
+ * list, and an open `select` accepts a value its list does not offer.
774
+ * - **The form decides.** A blank answer binds as absence, the form evaluates, and a refusal
775
+ * re-walks only the fields the walk can still edit.
776
+ * - **Injectable and guard-narrowed.** `input` and `output` default to `process.stdin` and
777
+ * `process.stdout` but accept any stream of the declared minimal shape, resolved through their
778
+ * guards rather than an assertion, so a test drives a whole form with a fake TTY that emits
779
+ * scripted key chunks and records every rendered byte.
780
+ * - **Non-TTY fallback.** A piped stream cannot enter raw mode, so the same walk runs over
781
+ * `node:readline` line input.
456
782
  *
457
783
  * @example
458
784
  * ```ts
459
- * import { createTerminal } from '@src/server'
785
+ * import { createForm } from '@orkestrel/form'
786
+ * import { createTerminal } from '@orkestrel/terminal/server'
460
787
  *
461
788
  * const terminal = createTerminal()
462
- * const name = await terminal.input({ message: 'Your name' })
463
- * const proceed = await terminal.confirm({ message: 'Continue?', default: true })
789
+ * const values = await terminal.ask(
790
+ * createForm({
791
+ * label: 'Sign up',
792
+ * fields: [
793
+ * { control: 'text', name: 'email', label: 'Email', rule: { required: true, email: true } },
794
+ * { control: 'confirm', name: 'terms', label: 'I accept the terms' },
795
+ * ],
796
+ * }),
797
+ * )
464
798
  * ```
465
799
  */
466
800
  function createTerminal(options) {
@@ -469,23 +803,39 @@ function createTerminal(options) {
469
803
  //#endregion
470
804
  exports.CARRIAGE_RETURN = CARRIAGE_RETURN;
471
805
  exports.CLEAR_DOWN = CLEAR_DOWN;
806
+ exports.CONTROL_HINTS = CONTROL_HINTS;
472
807
  exports.CSI = CSI;
473
808
  exports.CSI_UP = CSI_UP;
474
809
  exports.CURSOR_HIDE = CURSOR_HIDE;
475
810
  exports.CURSOR_SHOW = CURSOR_SHOW;
476
811
  exports.ESCAPE = ESCAPE;
477
812
  exports.FALLBACK_CHECKBOX_HINT = FALLBACK_CHECKBOX_HINT;
813
+ exports.FALLBACK_CONFIRM_HINT = FALLBACK_CONFIRM_HINT;
814
+ exports.FALLBACK_EDITOR_HINT = FALLBACK_EDITOR_HINT;
478
815
  exports.FALLBACK_SELECT_HINT = FALLBACK_SELECT_HINT;
816
+ exports.FILE_HINT = FILE_HINT;
479
817
  exports.LINE_FEED = LINE_FEED;
818
+ exports.LOCKED_MARK = LOCKED_MARK;
819
+ exports.REFUSAL_MESSAGE = REFUSAL_MESSAGE;
820
+ exports.SUGGESTION_LEAD = SUGGESTION_LEAD;
480
821
  exports.Terminal = Terminal;
822
+ exports.UNAVAILABLE_LEAD = UNAVAILABLE_LEAD;
481
823
  exports.createTerminal = createTerminal;
824
+ exports.disabledChoices = disabledChoices;
825
+ exports.enabledChoices = enabledChoices;
826
+ exports.fieldToText = fieldToText;
827
+ exports.groupHeader = groupHeader;
482
828
  exports.isInputStream = isInputStream;
483
829
  exports.isOutputStream = isOutputStream;
484
830
  exports.isReadable = isReadable;
485
- exports.isWritable = isWritable;
486
831
  exports.lineCount = lineCount;
832
+ exports.lockedLine = lockedLine;
487
833
  exports.moveUp = moveUp;
834
+ exports.numberedList = numberedList;
488
835
  exports.rawCapable = rawCapable;
489
836
  exports.redrawPrefix = redrawPrefix;
837
+ exports.suggestionLine = suggestionLine;
838
+ exports.unavailableLine = unavailableLine;
839
+ exports.valueToText = valueToText;
490
840
 
491
841
  //# sourceMappingURL=index.cjs.map