@livx.cc/agentx 0.99.138 → 0.99.140

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
@@ -18555,16 +18555,18 @@ function createLineEditor(out, input = keyInput) {
18555
18555
  const mode = !s.searching ? inputMode(s.buf) : void 0;
18556
18556
  const vimTag = s.vim === "normal" && !s.searching && !mode ? inverse(" N ") + " " : "";
18557
18557
  const prompt = s.searching ? dim2(`(${s.searchMiss ? "failing " : ""}reverse-i-search)\`${s.searchQuery}': `) : mode ? COLOR[mode.name](`${mode.pfx} ${mode.name} \u203A `) : vimTag + promptArg;
18558
- if (curRow > 0) out.write(`\x1B[${curRow}A`);
18559
- out.write("\r\x1B[J");
18558
+ const EOL = "\x1B[K";
18559
+ let frame = "\x1B[?2026h";
18560
+ if (curRow > 0) frame += `\x1B[${curRow}A`;
18561
+ frame += "\r";
18560
18562
  const rawBuf = mode ? s.buf.slice(mode.pfx.length) : s.buf;
18561
18563
  const rawCursor = mode ? Math.max(0, s.cursor - mode.pfx.length) : s.cursor;
18562
18564
  const { text: viewBuf, cursor: viewCursor } = appBidi() ? applyBidi(rawBuf, rawCursor) : { text: rawBuf, cursor: rawCursor };
18563
18565
  const { rows, cursorRow, cursorCol } = wrapLayout(visibleWidth(prompt), viewBuf, viewCursor, cols);
18564
18566
  const ghost = !mode && !s.searching ? s.ghost() : "";
18565
18567
  const ghostFits = ghost && rows.length === 1 && visibleWidth(prompt) + viewBuf.length + ghost.length < cols;
18566
- out.write(prompt + (rows[0] ?? "") + (ghostFits ? dim2(ghost) : ""));
18567
- for (let i = 1; i < rows.length; i++) out.write("\r\n" + rows[i]);
18568
+ frame += prompt + (rows[0] ?? "") + (ghostFits ? dim2(ghost) : "") + EOL;
18569
+ for (let i = 1; i < rows.length; i++) frame += "\r\n" + rows[i] + EOL;
18568
18570
  const inputRows = rows.length - 1;
18569
18571
  let menuRows = 0;
18570
18572
  if (s.menuOpen && s.hits.length) {
@@ -18574,7 +18576,7 @@ function createLineEditor(out, input = keyInput) {
18574
18576
  const d = s.describe?.(hit);
18575
18577
  let label = ` ${hit}${d ? " " + d : ""}`;
18576
18578
  if (visibleWidth(label) > cols - 1) label = label.slice(0, cols - 2) + "\u2026";
18577
- out.write("\r\n" + (i === s.sel ? inverse(label) : dim2(label)));
18579
+ frame += "\r\n" + (i === s.sel ? inverse(label) : dim2(label)) + EOL;
18578
18580
  menuRows++;
18579
18581
  }
18580
18582
  }
@@ -18583,14 +18585,16 @@ function createLineEditor(out, input = keyInput) {
18583
18585
  if (footer) {
18584
18586
  for (const line of footer.split("\n")) {
18585
18587
  const f = visibleWidth(line) > cols - 1 ? line.slice(0, cols - 2) + "\u2026" : line;
18586
- out.write("\r\n" + dim2(f));
18588
+ frame += "\r\n" + dim2(f) + EOL;
18587
18589
  footerRows++;
18588
18590
  }
18589
18591
  }
18590
18592
  const up = inputRows + menuRows + footerRows - cursorRow;
18591
- if (up > 0) out.write(`\x1B[${up}A`);
18592
- out.write("\r");
18593
- if (cursorCol > 0) out.write(`\x1B[${cursorCol}C`);
18593
+ frame += "\x1B[J";
18594
+ if (up > 0) frame += `\x1B[${up}A`;
18595
+ frame += "\r";
18596
+ if (cursorCol > 0) frame += `\x1B[${cursorCol}C`;
18597
+ out.write(frame + "\x1B[?2026l");
18594
18598
  curRow = cursorRow;
18595
18599
  }
18596
18600
  function externalEdit(s) {
@@ -18773,6 +18777,7 @@ function createLineEditor(out, input = keyInput) {
18773
18777
  return {
18774
18778
  readLine,
18775
18779
  redrawNow: () => activeRedraw?.(),
18780
+ isReading: () => !!activeRedraw,
18776
18781
  suspend: () => {
18777
18782
  if (suspended) return;
18778
18783
  suspended = true;
@@ -22765,8 +22770,9 @@ ${task}`;
22765
22770
  keyInput.on("keypress", (_s, key) => {
22766
22771
  if (isMenuActive()) return;
22767
22772
  if (!activeTurn && !dispatchPending) return;
22773
+ const editorOwnsKeys = editor.isReading();
22768
22774
  if (key?.ctrl && key?.name === "o") {
22769
- toggleVerbose();
22775
+ if (!editorOwnsKeys) toggleVerbose();
22770
22776
  return;
22771
22777
  }
22772
22778
  const k = key?.name;
@@ -22788,6 +22794,7 @@ ${task}`;
22788
22794
  }
22789
22795
  return;
22790
22796
  }
22797
+ if (editorOwnsKeys) return;
22791
22798
  const action = applyKey2(sEd, key ?? {}, _s);
22792
22799
  if (action === "submit") {
22793
22800
  const text = sEd.expand().trim();