agent.libx.js 0.94.22 → 0.94.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -7429,8 +7429,61 @@ function applyBidi(buf, cursor) {
7429
7429
  return { text: out.join("\n"), cursor: visCursor };
7430
7430
  }
7431
7431
 
7432
+ // cli/stdinSource.ts
7433
+ import { PassThrough } from "stream";
7434
+ var cancelPump;
7435
+ var keyInput = (() => {
7436
+ const bun = globalThis.Bun;
7437
+ if (!bun || !process.stdin.isTTY) return process.stdin;
7438
+ const pt = new PassThrough();
7439
+ pt.isTTY = true;
7440
+ pt.setRawMode = (mode) => {
7441
+ process.stdin.setRawMode(mode);
7442
+ return pt;
7443
+ };
7444
+ Object.defineProperty(pt, "isRaw", { get: () => process.stdin.isRaw });
7445
+ let pump = () => {
7446
+ pump = void 0;
7447
+ const reader = bun.stdin.stream().getReader();
7448
+ let stopped = false;
7449
+ cancelPump = () => {
7450
+ stopped = true;
7451
+ void reader.cancel().catch(() => {
7452
+ });
7453
+ };
7454
+ void (async () => {
7455
+ try {
7456
+ while (!stopped) {
7457
+ const { value, done } = await reader.read();
7458
+ if (done) break;
7459
+ if (value?.length) pt.write(Buffer.from(value));
7460
+ }
7461
+ } catch {
7462
+ }
7463
+ pt.end();
7464
+ })();
7465
+ };
7466
+ const ptResume = pt.resume.bind(pt);
7467
+ pt.resume = () => {
7468
+ pump?.();
7469
+ return ptResume();
7470
+ };
7471
+ return pt;
7472
+ })();
7473
+ function releaseKeyInput() {
7474
+ cancelPump?.();
7475
+ }
7476
+
7432
7477
  // cli/lineEditor.ts
7433
- var visibleWidth = (s) => s.replace(/\x1b\[[0-9;]*m/g, "").length;
7478
+ var cpWidth = (cp) => {
7479
+ if (cp === 8205 || cp === 65039 || cp >= 768 && cp <= 879) return 0;
7480
+ return cp >= 4352 && (cp <= 4447 || cp === 9001 || cp === 9002 || cp >= 11904 && cp <= 42191 && cp !== 12351 || cp >= 44032 && cp <= 55203 || cp >= 63744 && cp <= 64255 || cp >= 65072 && cp <= 65103 || cp >= 65280 && cp <= 65376 || cp >= 65504 && cp <= 65510 || cp >= 126976 && cp <= 129791 || cp >= 131072 && cp <= 262141) ? 2 : 1;
7481
+ };
7482
+ var visibleWidth = (s) => {
7483
+ let w = 0;
7484
+ for (const ch of s.replace(/\x1b\[[0-9;]*m/g, "")) w += cpWidth(ch.codePointAt(0));
7485
+ return w;
7486
+ };
7434
7487
  var isPrintable = (str) => !!str && !/[\x00-\x1f\x7f]/.test(str);
7435
7488
  var EditorState = class _EditorState {
7436
7489
  // pending operator awaiting a motion (dd/dw/cc)
@@ -7564,6 +7617,17 @@ var EditorState = class _EditorState {
7564
7617
  this.histIdx = -1;
7565
7618
  this.refresh();
7566
7619
  }
7620
+ // Code-point boundaries: cursor/delete ops must never split a surrogate pair (emoji = 2 code units;
7621
+ // a half-pair in the buffer reaches the model as mojibake). Steps are by code POINT (lean — ZWJ
7622
+ // families delete component-wise, which even many terminals do).
7623
+ prevCp(i) {
7624
+ if (i >= 2 && /[\uDC00-\uDFFF]/.test(this.buf[i - 1]) && /[\uD800-\uDBFF]/.test(this.buf[i - 2])) return i - 2;
7625
+ return Math.max(0, i - 1);
7626
+ }
7627
+ nextCp(i) {
7628
+ if (i <= this.buf.length - 2 && /[\uD800-\uDBFF]/.test(this.buf[i]) && /[\uDC00-\uDFFF]/.test(this.buf[i + 1])) return i + 2;
7629
+ return Math.min(this.buf.length, i + 1);
7630
+ }
7567
7631
  insert(s) {
7568
7632
  this.snapshot();
7569
7633
  this.buf = this.buf.slice(0, this.cursor) + s + this.buf.slice(this.cursor);
@@ -7574,22 +7638,23 @@ var EditorState = class _EditorState {
7574
7638
  backspace() {
7575
7639
  if (this.cursor === 0) return;
7576
7640
  this.snapshot();
7577
- this.buf = this.buf.slice(0, this.cursor - 1) + this.buf.slice(this.cursor);
7578
- this.cursor--;
7641
+ const start = this.prevCp(this.cursor);
7642
+ this.buf = this.buf.slice(0, start) + this.buf.slice(this.cursor);
7643
+ this.cursor = start;
7579
7644
  this.histIdx = -1;
7580
7645
  this.refresh();
7581
7646
  }
7582
7647
  del() {
7583
7648
  if (this.cursor >= this.buf.length) return;
7584
7649
  this.snapshot();
7585
- this.buf = this.buf.slice(0, this.cursor) + this.buf.slice(this.cursor + 1);
7650
+ this.buf = this.buf.slice(0, this.cursor) + this.buf.slice(this.nextCp(this.cursor));
7586
7651
  this.refresh();
7587
7652
  }
7588
7653
  left() {
7589
- if (this.cursor > 0) this.cursor--;
7654
+ if (this.cursor > 0) this.cursor = this.prevCp(this.cursor);
7590
7655
  }
7591
7656
  right() {
7592
- if (this.cursor < this.buf.length) this.cursor++;
7657
+ if (this.cursor < this.buf.length) this.cursor = this.nextCp(this.cursor);
7593
7658
  }
7594
7659
  home() {
7595
7660
  this.cursor = 0;
@@ -8080,9 +8145,9 @@ function createLineEditor(out) {
8080
8145
  curRow = 0;
8081
8146
  if (opts.initial) s.insert(opts.initial);
8082
8147
  s.refresh();
8083
- emitKeypressEvents(process.stdin);
8084
- process.stdin.setRawMode(true);
8085
- process.stdin.resume();
8148
+ emitKeypressEvents(keyInput);
8149
+ keyInput.setRawMode(true);
8150
+ keyInput.resume();
8086
8151
  out.write("\x1B[?2004h");
8087
8152
  const promptOf = () => typeof opts.prompt === "function" ? opts.prompt() : opts.prompt;
8088
8153
  render(s, promptOf(), maxVisible, opts.status);
@@ -8152,9 +8217,9 @@ function createLineEditor(out) {
8152
8217
  return;
8153
8218
  }
8154
8219
  if (key?.meta && key.name === "p" && opts.onPickModel) {
8155
- process.stdin.off("keypress", onKey);
8220
+ keyInput.off("keypress", onKey);
8156
8221
  void opts.onPickModel().finally(() => {
8157
- process.stdin.on("keypress", onKey);
8222
+ keyInput.on("keypress", onKey);
8158
8223
  curRow = 0;
8159
8224
  redraw();
8160
8225
  });
@@ -8163,6 +8228,7 @@ function createLineEditor(out) {
8163
8228
  const action = applyKey(s, key ?? {}, str);
8164
8229
  if (action === "submit") {
8165
8230
  finish();
8231
+ opts.onSubmit?.();
8166
8232
  return resolve4(s.expand());
8167
8233
  }
8168
8234
  if (action === "eof") {
@@ -8190,15 +8256,14 @@ function createLineEditor(out) {
8190
8256
  activeRedraw = void 0;
8191
8257
  activeAbort = void 0;
8192
8258
  if (ticker) clearInterval(ticker);
8193
- process.stdin.off("keypress", onKey);
8259
+ keyInput.off("keypress", onKey);
8194
8260
  process.removeListener("SIGWINCH", onResize);
8195
- out.write("\x1B[?2004l");
8196
8261
  s.closeMenu();
8197
8262
  s.end();
8198
8263
  render(s, promptOf(), maxVisible);
8199
8264
  out.write("\r\n");
8200
8265
  };
8201
- process.stdin.on("keypress", onKey);
8266
+ keyInput.on("keypress", onKey);
8202
8267
  });
8203
8268
  }
8204
8269
  return {
@@ -8220,6 +8285,8 @@ function createLineEditor(out) {
8220
8285
  abort: () => activeAbort?.()
8221
8286
  };
8222
8287
  }
8288
+ var menusOpen = 0;
8289
+ var isMenuActive = () => menusOpen > 0;
8223
8290
  function selectMenu(out, opts) {
8224
8291
  if (!out.isTTY || !process.stdin.isTTY || !opts.items.length) return Promise.resolve(null);
8225
8292
  const maxVisible = opts.maxVisible ?? 10;
@@ -8278,18 +8345,20 @@ function selectMenu(out, opts) {
8278
8345
  prevLines++;
8279
8346
  };
8280
8347
  return new Promise((resolve4) => {
8281
- const wasRaw = !!process.stdin.isRaw;
8282
- emitKeypressEvents(process.stdin);
8283
- process.stdin.setRawMode(true);
8284
- process.stdin.resume();
8348
+ const wasRaw = !!keyInput.isRaw;
8349
+ menusOpen++;
8350
+ emitKeypressEvents(keyInput);
8351
+ keyInput.setRawMode(true);
8352
+ keyInput.resume();
8285
8353
  draw();
8286
8354
  const finish = (val) => {
8287
- process.stdin.off("keypress", onKey);
8355
+ menusOpen--;
8356
+ keyInput.off("keypress", onKey);
8288
8357
  if (prevLines > 1) out.write(`\x1B[${prevLines - 1}A`);
8289
8358
  out.write("\r\x1B[J");
8290
8359
  if (!wasRaw) {
8291
8360
  try {
8292
- process.stdin.setRawMode(false);
8361
+ keyInput.setRawMode(false);
8293
8362
  } catch {
8294
8363
  }
8295
8364
  }
@@ -8352,7 +8421,7 @@ function selectMenu(out, opts) {
8352
8421
  draw();
8353
8422
  }
8354
8423
  };
8355
- process.stdin.on("keypress", onKey);
8424
+ keyInput.on("keypress", onKey);
8356
8425
  });
8357
8426
  }
8358
8427
  var INPUT_MODES = [
@@ -8372,26 +8441,35 @@ function wrapLayout(promptW, buf, cursor, cols) {
8372
8441
  rows.push(line);
8373
8442
  line = "";
8374
8443
  };
8375
- for (let i = 0; i <= buf.length; i++) {
8444
+ for (let i = 0; i <= buf.length; ) {
8445
+ const cp = i < buf.length ? buf.codePointAt(i) : -1;
8446
+ const ch = cp >= 0 ? String.fromCodePoint(cp) : "";
8447
+ const w = ch && ch !== "\n" ? cpWidth(cp) : 0;
8448
+ if (w === 2 && col + w > width && col > 0) {
8449
+ pushRow();
8450
+ r++;
8451
+ col = 0;
8452
+ }
8376
8453
  if (i === cursor) {
8377
8454
  cursorRow = r;
8378
8455
  cursorCol = col;
8379
8456
  }
8380
8457
  if (i === buf.length) break;
8381
- const ch = buf[i];
8382
8458
  if (ch === "\n") {
8383
8459
  pushRow();
8384
8460
  r++;
8385
8461
  col = 0;
8462
+ i++;
8386
8463
  continue;
8387
8464
  }
8388
8465
  line += ch;
8389
- col++;
8466
+ col += w;
8390
8467
  if (col >= width) {
8391
8468
  pushRow();
8392
8469
  r++;
8393
8470
  col = 0;
8394
8471
  }
8472
+ i += ch.length;
8395
8473
  }
8396
8474
  pushRow();
8397
8475
  return { rows, cursorRow, cursorCol };
@@ -8639,12 +8717,19 @@ var spinner = /* @__PURE__ */ (() => {
8639
8717
  return {
8640
8718
  /** Anchor for the elapsed counter; runTurn sets it once per turn so tool-call stop/start cycles don't reset it. */
8641
8719
  turnStart: 0,
8720
+ /** Mid-turn type-ahead, rendered as the frame's tail — the spinner repaints its row every 90ms,
8721
+ * so the typed text must live INSIDE the frame or it gets erased on the next tick. */
8722
+ tail: void 0,
8723
+ get active() {
8724
+ return !!timer;
8725
+ },
8642
8726
  start(label = "thinking\u2026") {
8643
8727
  if (!tty || timer) return;
8644
8728
  t0 = this.turnStart || Date.now();
8645
8729
  timer = setInterval(() => {
8646
8730
  const secs = Math.round((Date.now() - t0) / 1e3);
8647
- err("\r\x1B[2K" + dim(` ${frames[i = (i + 1) % frames.length]} ${label} ${secs ? `${secs}s \xB7 ` : ""}esc to interrupt`));
8731
+ const tail = this.tail?.();
8732
+ err("\r\x1B[2K" + dim(` ${frames[i = (i + 1) % frames.length]} ${label} ${secs ? `${secs}s \xB7 ` : ""}esc to interrupt`) + (tail ? " " + tail : ""));
8648
8733
  }, 90);
8649
8734
  },
8650
8735
  stop() {
@@ -8662,7 +8747,9 @@ var setTermTitle = (t) => {
8662
8747
  var activeTurn = null;
8663
8748
  var exitRequested = false;
8664
8749
  var inputStash = [];
8665
- var stashBuf = "";
8750
+ var stashEd = null;
8751
+ var stashText = () => stashEd?.buf ?? "";
8752
+ var dispatchPending = false;
8666
8753
  var latestTodos = [];
8667
8754
  function numFlag(raw, flag) {
8668
8755
  const n = Number(raw);
@@ -8919,7 +9006,7 @@ function makeHost(format = "text", opts) {
8919
9006
  async confirm(prompt) {
8920
9007
  const v = await selectMenu(process.stderr, { title: `? ${prompt}`, items: [{ label: "Yes", value: "y" }, { label: "No", value: "n" }], current: "n" });
8921
9008
  if (v !== null) return v === "y";
8922
- const io = createInterface({ input: process.stdin, output: process.stderr });
9009
+ const io = createInterface({ input: keyInput, output: process.stderr });
8923
9010
  try {
8924
9011
  return /^y(es)?$/i.test((await io.question(yellow(` ? ${prompt} [y/N] `))).trim());
8925
9012
  } finally {
@@ -8930,7 +9017,7 @@ function makeHost(format = "text", opts) {
8930
9017
  const title = `? ${q2.header ? "[" + q2.header + "] " : ""}${q2.question}`;
8931
9018
  const v = await selectMenu(process.stderr, { title, items: q2.options.map((o) => ({ label: o.label, value: o.label, desc: o.description })) });
8932
9019
  if (v !== null) return v;
8933
- const io = createInterface({ input: process.stdin, output: process.stderr });
9020
+ const io = createInterface({ input: keyInput, output: process.stderr });
8934
9021
  try {
8935
9022
  const lines = [yellow(" " + title)];
8936
9023
  q2.options.forEach((o, i) => lines.push(` ${i + 1}) ${o.label}${o.description ? dim(" \u2014 " + o.description) : ""}`));
@@ -9247,7 +9334,7 @@ function makeAskResolver(cwd) {
9247
9334
  current: "allow"
9248
9335
  });
9249
9336
  if (v === null) {
9250
- const io = createInterface({ input: process.stdin, output: process.stderr });
9337
+ const io = createInterface({ input: keyInput, output: process.stderr });
9251
9338
  try {
9252
9339
  return { decision: /^y(es)?$/i.test((await io.question(yellow(` ? Allow ${call.name}${tgt}? [y/N] `))).trim()) ? "allow" : "deny" };
9253
9340
  } finally {
@@ -9732,7 +9819,7 @@ async function repl(args, ai, cfg, cwd) {
9732
9819
  editorRef?.suspend();
9733
9820
  voiceEcho(e.message);
9734
9821
  return;
9735
- } else if (e.kind === "text_delta" && stashBuf) {
9822
+ } else if (e.kind === "text_delta" && stashText()) {
9736
9823
  process.stdout.write("\r\x1B[K");
9737
9824
  base.notify(e);
9738
9825
  repaintStash();
@@ -10764,7 +10851,7 @@ ${extra}` : body);
10764
10851
  if (a[0] === "new") {
10765
10852
  let name = a[1];
10766
10853
  if (!name) {
10767
- const io = createInterface({ input: process.stdin, output: process.stderr });
10854
+ const io = createInterface({ input: keyInput, output: process.stderr });
10768
10855
  try {
10769
10856
  name = (await io.question(yellow(" agent name: "))).trim();
10770
10857
  } finally {
@@ -11004,7 +11091,7 @@ ${extra}` : body);
11004
11091
  }
11005
11092
  a = [picked];
11006
11093
  if (picked === "add") {
11007
- const io = createInterface({ input: process.stdin, output: process.stderr });
11094
+ const io = createInterface({ input: keyInput, output: process.stderr });
11008
11095
  try {
11009
11096
  const name = (await io.question(yellow(" name: "))).trim();
11010
11097
  const target = (await io.question(yellow(" command or url: "))).trim();
@@ -11141,30 +11228,36 @@ ${extra}` : body);
11141
11228
  editorRef = editor;
11142
11229
  let aborting = false;
11143
11230
  let pendingRewind = false;
11231
+ const classifyPaste = pastePathClassifier(cwd);
11144
11232
  if (process.stdin.isTTY) {
11145
- const renderStashBuf = () => {
11146
- if (!stashBuf) return;
11233
+ const sEd = new EditorState(() => ({ hits: [], token: "" }), [], classifyPaste, grabClipboardAttachment);
11234
+ stashEd = sEd;
11235
+ const inverse = (x) => `\x1B[7m${x}\x1B[0m`;
11236
+ const stashView = () => {
11237
+ const v = sEd.buf.replace(/\n/g, "\u23CE");
11238
+ const c = Math.min(sEd.cursor, v.length);
11239
+ const at = c < v.length ? String.fromCodePoint(v.codePointAt(c)) : " ";
11147
11240
  const q2 = inputStash.length ? dim(` [${inputStash.length} queued]`) : "";
11148
- err(`\r\x1B[K${dim(" stash \u203A ")}${stashBuf}${q2}`);
11241
+ return `${dim("\u203A ")}${v.slice(0, c)}${inverse(at)}${v.slice(c + at.length)}${q2}`;
11242
+ };
11243
+ spinner.tail = () => sEd.buf ? stashView() : "";
11244
+ const renderStashBuf = () => {
11245
+ if (spinner.active) return;
11246
+ err(`\r\x1B[K${sEd.buf ? " " + stashView() : ""}`);
11149
11247
  };
11150
11248
  repaintStash = renderStashBuf;
11151
- process.stdin.on("keypress", (_s, key) => {
11152
- if (!activeTurn) return;
11249
+ keyInput.on("keypress", (_s, key) => {
11250
+ if (isMenuActive()) return;
11251
+ if (!activeTurn && !dispatchPending) return;
11153
11252
  if (key?.ctrl && key?.name === "o") {
11154
11253
  toggleVerbose();
11155
11254
  return;
11156
11255
  }
11157
11256
  const k = key?.name;
11158
- const cancel = k === "escape" || key?.ctrl && k === "c";
11159
- if (cancel) {
11160
- if (stashBuf) {
11161
- stashBuf = "";
11162
- err("\r\x1B[K");
11163
- return;
11164
- }
11257
+ if (!sEd.pasting && (k === "escape" || key?.ctrl && k === "c")) {
11165
11258
  if (!aborting) {
11166
11259
  aborting = true;
11167
- activeTurn.abort();
11260
+ activeTurn?.abort();
11168
11261
  voiceIO?.interrupt();
11169
11262
  err(yellow("\n \u238B cancelling\u2026") + dim(" (Ctrl-C again to force-quit)\n"));
11170
11263
  setTimeout(() => {
@@ -11179,35 +11272,29 @@ ${extra}` : body);
11179
11272
  }
11180
11273
  return;
11181
11274
  }
11182
- if (k === "return" || k === "enter") {
11183
- if (stashBuf.trim()) {
11184
- inputStash.push(stashBuf.trim());
11185
- err(`\r\x1B[K${green(" \u2713 stashed")} ${dim(`#${inputStash.length}: ${stashBuf.trim().slice(0, 50)}${stashBuf.trim().length > 50 ? "\u2026" : ""}`)}
11275
+ const action = applyKey(sEd, key ?? {}, _s);
11276
+ if (action === "submit") {
11277
+ const text = sEd.expand().trim();
11278
+ sEd.reset();
11279
+ if (text) {
11280
+ inputStash.push(text);
11281
+ const view = text.replace(/\n+/g, " \u23CE ");
11282
+ err(`\r\x1B[K${green(" \u2713 stashed")} ${dim(`#${inputStash.length}: ${view.slice(0, 50)}${view.length > 50 ? "\u2026" : ""}`)}
11186
11283
  `);
11187
11284
  }
11188
- stashBuf = "";
11189
- return;
11190
- }
11191
- if (k === "backspace") {
11192
- if (stashBuf.length) {
11193
- stashBuf = stashBuf.slice(0, -1);
11194
- if (stashBuf) renderStashBuf();
11195
- else err("\r\x1B[K");
11196
- }
11197
- return;
11198
- }
11199
- if (!key?.ctrl && !key?.meta && isPrintable(_s)) {
11200
- stashBuf += _s;
11201
- renderStashBuf();
11202
11285
  return;
11203
11286
  }
11287
+ if (sEd.pasting) return;
11288
+ if (action === "eof" || action === "rewind") return;
11289
+ renderStashBuf();
11204
11290
  });
11205
11291
  }
11206
11292
  const promptStr = bold(cyan("agentx \u203A "));
11207
11293
  const contPrompt = dim(" \u2026 \u203A ");
11208
- const classifyPaste = pastePathClassifier(cwd);
11209
11294
  const releaseStdin = () => {
11295
+ releaseKeyInput();
11210
11296
  if (process.stdin.isTTY) {
11297
+ err("\x1B[?2004l");
11211
11298
  try {
11212
11299
  process.stdin.setRawMode(false);
11213
11300
  } catch {
@@ -11218,6 +11305,7 @@ ${extra}` : body);
11218
11305
  let prefill;
11219
11306
  let tick = 0;
11220
11307
  const dispatchLine = async (line) => {
11308
+ if (/^[!#/]/.test(line)) dispatchPending = false;
11221
11309
  history.unshift(line.replace(/\n+/g, " \u23CE "));
11222
11310
  remember(line.replace(/\n+/g, " \u23CE "));
11223
11311
  if (line.startsWith("!")) {
@@ -11372,8 +11460,8 @@ ${extra}` : body);
11372
11460
  if (t !== void 0) prefill = t;
11373
11461
  }
11374
11462
  aborting = false;
11375
- const carry = stashBuf;
11376
- stashBuf = "";
11463
+ const carry = stashText() ? stashEd.expand() : "";
11464
+ stashEd?.reset();
11377
11465
  err("\n");
11378
11466
  const initial = prefill ?? (carry || void 0);
11379
11467
  prefill = void 0;
@@ -11428,6 +11516,10 @@ ${extra}` : body);
11428
11516
  history,
11429
11517
  classifyPaste,
11430
11518
  onEmptyPaste: grabClipboardAttachment,
11519
+ onSubmit: () => {
11520
+ dispatchPending = true;
11521
+ },
11522
+ // claim keys buffered behind the Enter (turn isn't active yet)
11431
11523
  initial: cont ? void 0 : initial,
11432
11524
  status: computeFooter,
11433
11525
  vimMode: cfg.editorMode === "vim",
@@ -11478,7 +11570,8 @@ ${extra}` : body);
11478
11570
  let quit = await dispatchLine(line) === "quit";
11479
11571
  while (!quit && inputStash.length) {
11480
11572
  const next = inputStash.shift();
11481
- err(dim(` \u23CE stashed \u203A ${next.slice(0, 60)}${next.length > 60 ? "\u2026" : ""}
11573
+ const nview = next.replace(/\n+/g, " \u23CE ");
11574
+ err(dim(` \u23CE stashed \u203A ${nview.slice(0, 60)}${nview.length > 60 ? "\u2026" : ""}
11482
11575
  `));
11483
11576
  quit = await dispatchLine(next) === "quit";
11484
11577
  }
@@ -11488,6 +11581,7 @@ ${extra}` : body);
11488
11581
  `));
11489
11582
  await turn(prompt);
11490
11583
  }
11584
+ dispatchPending = false;
11491
11585
  session.meta.scheduledJobs = scheduler.snapshot();
11492
11586
  try {
11493
11587
  store.save(session);
@@ -11524,11 +11618,11 @@ ${extra}` : body);
11524
11618
  `));
11525
11619
  onCtrlC();
11526
11620
  };
11527
- process.stdin.on("data", onByte);
11621
+ keyInput.on("data", onByte);
11528
11622
  await Promise.race([dx.idle(), new Promise((res) => {
11529
11623
  onCtrlC = res;
11530
11624
  })]);
11531
- process.stdin.off("data", onByte);
11625
+ keyInput.off("data", onByte);
11532
11626
  if (forced) {
11533
11627
  voiceIO?.stop();
11534
11628
  releaseStdin();