nolo-cli 0.8.0-alpha.2 → 0.8.0-alpha.5
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/index.js +105 -77
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -93814,7 +93814,7 @@ function formatCompactToolLine(event, pending, colorEnabled) {
|
|
|
93814
93814
|
const label = rawArgs ? `${rawLabel} ${rawArgs}` : rawLabel;
|
|
93815
93815
|
if (event.type === "tool-error") {
|
|
93816
93816
|
const message = clip5(event.message ?? t("toolFailed"), 96);
|
|
93817
|
-
return formatToolTraceLine(
|
|
93817
|
+
return formatToolTraceLine(`\u25B8 ${label} \u2717 ${message}`, colorEnabled, "error");
|
|
93818
93818
|
}
|
|
93819
93819
|
if (event.type === "tool-result" && (event.toolName === "ui_ask_choice" || event.metadata?.uiAskChoice)) {
|
|
93820
93820
|
const block = formatUiAskChoiceBlock(event, colorEnabled);
|
|
@@ -93826,7 +93826,7 @@ function formatCompactToolLine(event, pending, colorEnabled) {
|
|
|
93826
93826
|
const marker = failed ? "\u2717" : isNeedsActionToolResult(event) ? "!" : "\u2713";
|
|
93827
93827
|
let mainLine;
|
|
93828
93828
|
if (!colorEnabled) {
|
|
93829
|
-
mainLine =
|
|
93829
|
+
mainLine = `\u25B8 ${label} ${marker}${suffix}
|
|
93830
93830
|
`;
|
|
93831
93831
|
} else {
|
|
93832
93832
|
const chromePointer = themeText("\u25B8", "chrome", true);
|
|
@@ -93834,7 +93834,7 @@ function formatCompactToolLine(event, pending, colorEnabled) {
|
|
|
93834
93834
|
const argsPart = rawArgs ? ` ${dimCliText(rawArgs, true)}` : "";
|
|
93835
93835
|
const statusToken = failed ? themeText("\u2717", "danger", true) : isNeedsActionToolResult(event) ? themeText("!", "warning", true) : themeText("\u2713", "success", true);
|
|
93836
93836
|
const suffixPart = hint.inline ? ` ${dimCliText(hint.inline, true)}` : "";
|
|
93837
|
-
mainLine =
|
|
93837
|
+
mainLine = `${chromePointer} ${mutedLabel}${argsPart} ${statusToken}${suffixPart}
|
|
93838
93838
|
`;
|
|
93839
93839
|
}
|
|
93840
93840
|
if (!hint.detail) return mainLine;
|
|
@@ -93844,28 +93844,28 @@ function formatCompactToolLine(event, pending, colorEnabled) {
|
|
|
93844
93844
|
function formatEditDetailLine(line, colorEnabled) {
|
|
93845
93845
|
const marker = line.slice(0, 2);
|
|
93846
93846
|
const rest = line.slice(2);
|
|
93847
|
-
if (!colorEnabled) return `
|
|
93847
|
+
if (!colorEnabled) return ` ${line}
|
|
93848
93848
|
`;
|
|
93849
93849
|
const diff = diffLineSequences();
|
|
93850
93850
|
if (!diff) {
|
|
93851
93851
|
const color = marker === "- " ? "red" : marker === "+ " ? "green" : void 0;
|
|
93852
93852
|
if (color) {
|
|
93853
|
-
return `
|
|
93853
|
+
return ` ${styleCliText(marker, color, true)}${dimCliText(rest, true)}
|
|
93854
93854
|
`;
|
|
93855
93855
|
}
|
|
93856
|
-
return `
|
|
93856
|
+
return ` ${dimCliText(line, true)}
|
|
93857
93857
|
`;
|
|
93858
93858
|
}
|
|
93859
93859
|
const RESET2 = "\x1B[0m";
|
|
93860
93860
|
if (marker === "- ") {
|
|
93861
|
-
return `
|
|
93861
|
+
return ` ${diff.removed.bg}${diff.removed.fg}- ${rest}${RESET2}
|
|
93862
93862
|
`;
|
|
93863
93863
|
}
|
|
93864
93864
|
if (marker === "+ ") {
|
|
93865
|
-
return `
|
|
93865
|
+
return ` ${diff.added.bg}${diff.added.fg}+ ${rest}${RESET2}
|
|
93866
93866
|
`;
|
|
93867
93867
|
}
|
|
93868
|
-
return `
|
|
93868
|
+
return ` ${dimCliText(line, true)}
|
|
93869
93869
|
`;
|
|
93870
93870
|
}
|
|
93871
93871
|
function createToolEventFormatter(mode, colorEnabled = resolveCliColorEnabled()) {
|
|
@@ -107039,6 +107039,64 @@ var init_dialogFrame = __esm({
|
|
|
107039
107039
|
}
|
|
107040
107040
|
});
|
|
107041
107041
|
|
|
107042
|
+
// packages/cli/tui/tuiScrollbar.ts
|
|
107043
|
+
function parseScrollAction(sequence) {
|
|
107044
|
+
const mouse = SGR_MOUSE_REGEX.exec(sequence);
|
|
107045
|
+
if (mouse) {
|
|
107046
|
+
const button = Number(mouse[1]);
|
|
107047
|
+
if ((button & 64) === 0) return null;
|
|
107048
|
+
if ((button & 2) !== 0) return null;
|
|
107049
|
+
return (button & 1) !== 0 ? "wheel-down" : "wheel-up";
|
|
107050
|
+
}
|
|
107051
|
+
switch (sequence) {
|
|
107052
|
+
case "\x1B[5~":
|
|
107053
|
+
return "page-up";
|
|
107054
|
+
case "\x1B[6~":
|
|
107055
|
+
return "page-down";
|
|
107056
|
+
case "\x1B[5;2~":
|
|
107057
|
+
case "\x1B[5;5~":
|
|
107058
|
+
return "half-page-up";
|
|
107059
|
+
case "\x1B[6;2~":
|
|
107060
|
+
case "\x1B[6;5~":
|
|
107061
|
+
return "half-page-down";
|
|
107062
|
+
case "\x1B[H":
|
|
107063
|
+
case "\x1B[1~":
|
|
107064
|
+
case "\x1B[7~":
|
|
107065
|
+
return "top";
|
|
107066
|
+
case "\x1B[F":
|
|
107067
|
+
case "\x1B[4~":
|
|
107068
|
+
case "\x1B[8~":
|
|
107069
|
+
return "bottom";
|
|
107070
|
+
default:
|
|
107071
|
+
return null;
|
|
107072
|
+
}
|
|
107073
|
+
}
|
|
107074
|
+
function renderScrollbarRow(rowIndex, visibleHeight, totalLines, scrollTop) {
|
|
107075
|
+
if (totalLines <= visibleHeight) return " ";
|
|
107076
|
+
const trackHeight = visibleHeight;
|
|
107077
|
+
const thumbSize = Math.max(
|
|
107078
|
+
1,
|
|
107079
|
+
Math.floor(visibleHeight * visibleHeight / totalLines)
|
|
107080
|
+
);
|
|
107081
|
+
const maxScrollTop = totalLines - visibleHeight;
|
|
107082
|
+
const thumbTop = Math.floor(
|
|
107083
|
+
scrollTop / maxScrollTop * (trackHeight - thumbSize)
|
|
107084
|
+
);
|
|
107085
|
+
const thumbBottom = thumbTop + thumbSize;
|
|
107086
|
+
if (rowIndex >= thumbTop && rowIndex < thumbBottom) {
|
|
107087
|
+
return "\u2588";
|
|
107088
|
+
}
|
|
107089
|
+
return "\u2502";
|
|
107090
|
+
}
|
|
107091
|
+
var SGR_MOUSE_REGEX, WHEEL_SCROLL_LINES;
|
|
107092
|
+
var init_tuiScrollbar = __esm({
|
|
107093
|
+
"packages/cli/tui/tuiScrollbar.ts"() {
|
|
107094
|
+
"use strict";
|
|
107095
|
+
SGR_MOUSE_REGEX = /^\x1b\[<(\d+);\d+;\d+[Mm]$/;
|
|
107096
|
+
WHEEL_SCROLL_LINES = 3;
|
|
107097
|
+
}
|
|
107098
|
+
});
|
|
107099
|
+
|
|
107042
107100
|
// packages/cli/tui/selectDialog.ts
|
|
107043
107101
|
function computeVisibleWindow(args2) {
|
|
107044
107102
|
const maxVisible = Math.max(1, args2.maxVisible ?? DEFAULT_MAX_VISIBLE);
|
|
@@ -107184,6 +107242,7 @@ async function runSelectDialog(args2) {
|
|
|
107184
107242
|
const output2 = args2.output ?? process.stdout;
|
|
107185
107243
|
const input2 = args2.input ?? process.stdin;
|
|
107186
107244
|
const readKey = args2.readKey ?? createRawKeyReader(input2);
|
|
107245
|
+
output2.write("\x1B[?1006h\x1B[?1000h");
|
|
107187
107246
|
const wasRaw = Boolean(input2.isTTY && input2.isRaw);
|
|
107188
107247
|
let renderedLineCount = 0;
|
|
107189
107248
|
const bottomAnchored = Boolean(args2.bottomAnchored && args2.bottomRow);
|
|
@@ -107247,6 +107306,18 @@ async function runSelectDialog(args2) {
|
|
|
107247
107306
|
if (sequence == null) {
|
|
107248
107307
|
return { kind: "cancelled" };
|
|
107249
107308
|
}
|
|
107309
|
+
const scrollAction = parseScrollAction(sequence);
|
|
107310
|
+
if (scrollAction === "wheel-up" || scrollAction === "wheel-down") {
|
|
107311
|
+
selectedIndex = Math.min(
|
|
107312
|
+
Math.max(
|
|
107313
|
+
selectedIndex + (scrollAction === "wheel-up" ? -1 : 1),
|
|
107314
|
+
0
|
|
107315
|
+
),
|
|
107316
|
+
items.length - 1
|
|
107317
|
+
);
|
|
107318
|
+
paint();
|
|
107319
|
+
continue;
|
|
107320
|
+
}
|
|
107250
107321
|
if (isCancel(sequence)) {
|
|
107251
107322
|
return { kind: "cancelled" };
|
|
107252
107323
|
}
|
|
@@ -107265,6 +107336,7 @@ async function runSelectDialog(args2) {
|
|
|
107265
107336
|
}
|
|
107266
107337
|
}
|
|
107267
107338
|
} finally {
|
|
107339
|
+
output2.write("\x1B[?1000l\x1B[?1006l");
|
|
107268
107340
|
resizeTarget.off?.("resize", onOutputResize);
|
|
107269
107341
|
readKey.dispose?.();
|
|
107270
107342
|
if (input2.isTTY) {
|
|
@@ -107289,6 +107361,7 @@ var init_selectDialog = __esm({
|
|
|
107289
107361
|
"use strict";
|
|
107290
107362
|
init_dialogFrame();
|
|
107291
107363
|
init_i18n2();
|
|
107364
|
+
init_tuiScrollbar();
|
|
107292
107365
|
CSI_ARROW_UP = "\x1B[A";
|
|
107293
107366
|
CSI_ARROW_DOWN = "\x1B[B";
|
|
107294
107367
|
CSI_ARROW_UP_APP = "\x1BOA";
|
|
@@ -107513,15 +107586,16 @@ function askChoiceReducer(state4, action3) {
|
|
|
107513
107586
|
phase: "submitted"
|
|
107514
107587
|
};
|
|
107515
107588
|
}
|
|
107589
|
+
const nextState = { ...state4, questionStates: newQs };
|
|
107590
|
+
const isLastTab = state4.activeIndex >= state4.questions.length - 1;
|
|
107591
|
+
if (isLastTab && canSubmit(nextState)) {
|
|
107592
|
+
return { ...nextState, phase: "submitted" };
|
|
107593
|
+
}
|
|
107516
107594
|
const nextTab = Math.min(
|
|
107517
107595
|
state4.activeIndex + 1,
|
|
107518
107596
|
state4.questions.length - 1
|
|
107519
107597
|
);
|
|
107520
|
-
return {
|
|
107521
|
-
...state4,
|
|
107522
|
-
questionStates: newQs,
|
|
107523
|
-
activeIndex: nextTab
|
|
107524
|
-
};
|
|
107598
|
+
return { ...nextState, activeIndex: nextTab };
|
|
107525
107599
|
}
|
|
107526
107600
|
case "FOCUS_OTHER": {
|
|
107527
107601
|
const qs = state4.questionStates[state4.activeIndex];
|
|
@@ -107604,7 +107678,7 @@ function renderTabBar(questions, activeIndex, colorEnabled) {
|
|
|
107604
107678
|
return tabs.join(" ") + " " + (colorEnabled ? themeText(submitLabel, "chrome", colorEnabled) : submitLabel);
|
|
107605
107679
|
}
|
|
107606
107680
|
function renderFooter(colorEnabled) {
|
|
107607
|
-
const hints = "
|
|
107681
|
+
const hints = "\u21B5 pick/submit \xB7 space toggle \xB7 tab switch \xB7 esc cancel";
|
|
107608
107682
|
return colorEnabled ? themeText(` ${hints}`, "chrome", colorEnabled) : ` ${hints}`;
|
|
107609
107683
|
}
|
|
107610
107684
|
function renderAskChoiceFrame(state4) {
|
|
@@ -107695,6 +107769,7 @@ async function runAskChoiceDialog(args2) {
|
|
|
107695
107769
|
const output2 = args2.output ?? process.stdout;
|
|
107696
107770
|
const input2 = args2.input ?? process.stdin;
|
|
107697
107771
|
const readKey = args2.readKey ?? createRawKeyReader(input2);
|
|
107772
|
+
output2.write("\x1B[?1006h\x1B[?1000h");
|
|
107698
107773
|
const wasRaw = Boolean(input2.isTTY && input2.isRaw);
|
|
107699
107774
|
let renderedLineCount = 0;
|
|
107700
107775
|
const bottomAnchored = Boolean(args2.bottomAnchored && args2.bottomRow);
|
|
@@ -107755,6 +107830,15 @@ async function runAskChoiceDialog(args2) {
|
|
|
107755
107830
|
state4 = askChoiceReducer(state4, { type: "CANCEL" });
|
|
107756
107831
|
break;
|
|
107757
107832
|
}
|
|
107833
|
+
const scrollAction = parseScrollAction(sequence);
|
|
107834
|
+
if (scrollAction === "wheel-up" || scrollAction === "wheel-down") {
|
|
107835
|
+
state4 = askChoiceReducer(state4, {
|
|
107836
|
+
type: "MOVE_CURSOR",
|
|
107837
|
+
delta: scrollAction === "wheel-up" ? -1 : 1
|
|
107838
|
+
});
|
|
107839
|
+
paint();
|
|
107840
|
+
continue;
|
|
107841
|
+
}
|
|
107758
107842
|
let action3 = null;
|
|
107759
107843
|
if (isCancel(sequence)) {
|
|
107760
107844
|
action3 = { type: "CANCEL" };
|
|
@@ -107768,8 +107852,6 @@ async function runAskChoiceDialog(args2) {
|
|
|
107768
107852
|
action3 = { type: "MOVE_CURSOR", delta: 1 };
|
|
107769
107853
|
} else if (sequence === CSI_SPACE) {
|
|
107770
107854
|
action3 = { type: "TOGGLE_AT_CURSOR" };
|
|
107771
|
-
} else if (sequence === "s" && !state4.questionStates[state4.activeIndex].otherFocused && canSubmit(state4)) {
|
|
107772
|
-
action3 = { type: "SUBMIT" };
|
|
107773
107855
|
} else if (isSubmit(sequence)) {
|
|
107774
107856
|
const qs = state4.questionStates[state4.activeIndex];
|
|
107775
107857
|
const q = state4.questions[state4.activeIndex];
|
|
@@ -107778,6 +107860,8 @@ async function runAskChoiceDialog(args2) {
|
|
|
107778
107860
|
action3 = { type: "BLUR_OTHER" };
|
|
107779
107861
|
} else if (isOtherRow && !qs.otherFocused) {
|
|
107780
107862
|
action3 = { type: "FOCUS_OTHER" };
|
|
107863
|
+
} else if (q.multiSelect) {
|
|
107864
|
+
action3 = { type: "SUBMIT" };
|
|
107781
107865
|
} else {
|
|
107782
107866
|
action3 = { type: "SELECT_AT_CURSOR" };
|
|
107783
107867
|
}
|
|
@@ -107802,7 +107886,7 @@ async function runAskChoiceDialog(args2) {
|
|
|
107802
107886
|
const prev = state4;
|
|
107803
107887
|
state4 = askChoiceReducer(state4, action3);
|
|
107804
107888
|
if (state4.phase !== "active") break;
|
|
107805
|
-
if (action3.type === "BLUR_OTHER" && state4.questions.length
|
|
107889
|
+
if (action3.type === "BLUR_OTHER" && state4.activeIndex >= state4.questions.length - 1 && canSubmit(state4)) {
|
|
107806
107890
|
state4 = askChoiceReducer(state4, { type: "SUBMIT" });
|
|
107807
107891
|
break;
|
|
107808
107892
|
}
|
|
@@ -107810,6 +107894,7 @@ async function runAskChoiceDialog(args2) {
|
|
|
107810
107894
|
}
|
|
107811
107895
|
}
|
|
107812
107896
|
} finally {
|
|
107897
|
+
output2.write("\x1B[?1000l\x1B[?1006l");
|
|
107813
107898
|
resizeTarget.off?.("resize", onOutputResize);
|
|
107814
107899
|
readKey.dispose?.();
|
|
107815
107900
|
if (input2.isTTY) {
|
|
@@ -107859,6 +107944,7 @@ var init_askChoiceDialog = __esm({
|
|
|
107859
107944
|
init_selectDialog();
|
|
107860
107945
|
init_terminalStyles();
|
|
107861
107946
|
init_theme();
|
|
107947
|
+
init_tuiScrollbar();
|
|
107862
107948
|
CSI_TAB = " ";
|
|
107863
107949
|
CSI_SHIFT_TAB = "\x1B[Z";
|
|
107864
107950
|
CSI_BACKSPACE = "\x7F";
|
|
@@ -109048,7 +109134,7 @@ function renderStatusLine(state4) {
|
|
|
109048
109134
|
const sep3 = themeText(" \xB7 ", "chrome", colorEnabled);
|
|
109049
109135
|
const autoRouteActive = state4.agentKey === DEFAULT_TUI_AGENT_KEY && (typeof process === "undefined" || process.env?.NOLO_AUTO_ROUTE !== "0");
|
|
109050
109136
|
const agentDisplayName = autoRouteActive ? "auto" : state4.agentName;
|
|
109051
|
-
const modeSuffix = state4.modeLabel &&
|
|
109137
|
+
const modeSuffix = state4.modeLabel && state4.modeLabel !== "auto" ? ` \xB7 ${state4.modeLabel}` : "";
|
|
109052
109138
|
const agentLabel = `\u{1F3D4} ${agentDisplayName}${modeSuffix}`;
|
|
109053
109139
|
const agentSegment = themeText(agentLabel, "accent", colorEnabled);
|
|
109054
109140
|
const cwdSegment = themeText(`\u{1F4C1} ${formatCwd(state4.cwd)}`, "info", colorEnabled);
|
|
@@ -110391,64 +110477,6 @@ var init_chatQueueTuiBinding = __esm({
|
|
|
110391
110477
|
}
|
|
110392
110478
|
});
|
|
110393
110479
|
|
|
110394
|
-
// packages/cli/tui/tuiScrollbar.ts
|
|
110395
|
-
function parseScrollAction(sequence) {
|
|
110396
|
-
const mouse = SGR_MOUSE_REGEX.exec(sequence);
|
|
110397
|
-
if (mouse) {
|
|
110398
|
-
const button = Number(mouse[1]);
|
|
110399
|
-
if ((button & 64) === 0) return null;
|
|
110400
|
-
if ((button & 2) !== 0) return null;
|
|
110401
|
-
return (button & 1) !== 0 ? "wheel-down" : "wheel-up";
|
|
110402
|
-
}
|
|
110403
|
-
switch (sequence) {
|
|
110404
|
-
case "\x1B[5~":
|
|
110405
|
-
return "page-up";
|
|
110406
|
-
case "\x1B[6~":
|
|
110407
|
-
return "page-down";
|
|
110408
|
-
case "\x1B[5;2~":
|
|
110409
|
-
case "\x1B[5;5~":
|
|
110410
|
-
return "half-page-up";
|
|
110411
|
-
case "\x1B[6;2~":
|
|
110412
|
-
case "\x1B[6;5~":
|
|
110413
|
-
return "half-page-down";
|
|
110414
|
-
case "\x1B[H":
|
|
110415
|
-
case "\x1B[1~":
|
|
110416
|
-
case "\x1B[7~":
|
|
110417
|
-
return "top";
|
|
110418
|
-
case "\x1B[F":
|
|
110419
|
-
case "\x1B[4~":
|
|
110420
|
-
case "\x1B[8~":
|
|
110421
|
-
return "bottom";
|
|
110422
|
-
default:
|
|
110423
|
-
return null;
|
|
110424
|
-
}
|
|
110425
|
-
}
|
|
110426
|
-
function renderScrollbarRow(rowIndex, visibleHeight, totalLines, scrollTop) {
|
|
110427
|
-
if (totalLines <= visibleHeight) return " ";
|
|
110428
|
-
const trackHeight = visibleHeight;
|
|
110429
|
-
const thumbSize = Math.max(
|
|
110430
|
-
1,
|
|
110431
|
-
Math.floor(visibleHeight * visibleHeight / totalLines)
|
|
110432
|
-
);
|
|
110433
|
-
const maxScrollTop = totalLines - visibleHeight;
|
|
110434
|
-
const thumbTop = Math.floor(
|
|
110435
|
-
scrollTop / maxScrollTop * (trackHeight - thumbSize)
|
|
110436
|
-
);
|
|
110437
|
-
const thumbBottom = thumbTop + thumbSize;
|
|
110438
|
-
if (rowIndex >= thumbTop && rowIndex < thumbBottom) {
|
|
110439
|
-
return "\u2588";
|
|
110440
|
-
}
|
|
110441
|
-
return "\u2502";
|
|
110442
|
-
}
|
|
110443
|
-
var SGR_MOUSE_REGEX, WHEEL_SCROLL_LINES;
|
|
110444
|
-
var init_tuiScrollbar = __esm({
|
|
110445
|
-
"packages/cli/tui/tuiScrollbar.ts"() {
|
|
110446
|
-
"use strict";
|
|
110447
|
-
SGR_MOUSE_REGEX = /^\x1b\[<(\d+);\d+;\d+[Mm]$/;
|
|
110448
|
-
WHEEL_SCROLL_LINES = 3;
|
|
110449
|
-
}
|
|
110450
|
-
});
|
|
110451
|
-
|
|
110452
110480
|
// packages/cli/tui/tuiHistory.ts
|
|
110453
110481
|
function createTurnHistory() {
|
|
110454
110482
|
return {
|