@wrongstack/tui 0.89.3 → 0.107.2
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/index.js +188 -30
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -2065,9 +2065,8 @@ function computeWidths(allRows, cols, maxWidth, sepWidths) {
|
|
|
2065
2065
|
for (let c = 0; c < cols; c++) {
|
|
2066
2066
|
const cell = row[c] ?? "";
|
|
2067
2067
|
const stripped = stripInlineMarkers(cell);
|
|
2068
|
-
const w = longestWord(stripped);
|
|
2069
2068
|
const total = strWidth(stripped);
|
|
2070
|
-
natural[c] = Math.max(expectDefined$1(natural[c]),
|
|
2069
|
+
natural[c] = Math.max(expectDefined$1(natural[c]), total);
|
|
2071
2070
|
}
|
|
2072
2071
|
}
|
|
2073
2072
|
if (sepWidths) {
|
|
@@ -2200,19 +2199,16 @@ function strWidth(s2) {
|
|
|
2200
2199
|
i += cpLen;
|
|
2201
2200
|
continue;
|
|
2202
2201
|
}
|
|
2202
|
+
if (code >= 9472 && code <= 9599) {
|
|
2203
|
+
width += 1;
|
|
2204
|
+
i += cpLen;
|
|
2205
|
+
continue;
|
|
2206
|
+
}
|
|
2203
2207
|
width += 1;
|
|
2204
2208
|
i += cpLen;
|
|
2205
2209
|
}
|
|
2206
2210
|
return width;
|
|
2207
2211
|
}
|
|
2208
|
-
function longestWord(s2) {
|
|
2209
|
-
let max = 0;
|
|
2210
|
-
for (const w of s2.split(/\s+/)) {
|
|
2211
|
-
const visualWidth = strWidth(w);
|
|
2212
|
-
if (visualWidth > max) max = visualWidth;
|
|
2213
|
-
}
|
|
2214
|
-
return max;
|
|
2215
|
-
}
|
|
2216
2212
|
function border(left, mid, right, widths) {
|
|
2217
2213
|
return left + widths.map((w) => "\u2500".repeat(w + 2)).join(mid) + right;
|
|
2218
2214
|
}
|
|
@@ -2220,13 +2216,12 @@ function stripInlineMarkers(text) {
|
|
|
2220
2216
|
return text.replace(/\*\*(.+?)\*\*/g, "$1").replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g, "$1").replace(/`(.+?)`/g, "$1").replace(/~~(.+?)~~/g, "$1");
|
|
2221
2217
|
}
|
|
2222
2218
|
var ANSI_BOLD = "\x1B[1m";
|
|
2223
|
-
var ANSI_RESET = "\x1B[22m";
|
|
2224
2219
|
var ANSI_DIM = "\x1B[2m";
|
|
2225
2220
|
var ANSI_CYAN = "\x1B[36m";
|
|
2226
2221
|
var ANSI_STRIKE = "\x1B[9m";
|
|
2227
2222
|
var ANSI_RESET_ALL = "\x1B[0m";
|
|
2228
2223
|
function applyInlineAnsi(text) {
|
|
2229
|
-
return text.replace(/\*\*(.+?)\*\*/g, `${ANSI_BOLD}$1${
|
|
2224
|
+
return text.replace(/\*\*(.+?)\*\*/g, `${ANSI_BOLD}$1${ANSI_RESET_ALL}`).replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g, `${ANSI_DIM}$1${ANSI_RESET_ALL}`).replace(/`(.+?)`/g, `${ANSI_CYAN}$1${ANSI_RESET_ALL}`).replace(/~~(.+?)~~/g, `${ANSI_STRIKE}$1${ANSI_RESET_ALL}`);
|
|
2230
2225
|
}
|
|
2231
2226
|
function renderRow(cells, widths, aligns) {
|
|
2232
2227
|
const styled = cells.map((c) => applyInlineAnsi(c));
|
|
@@ -2239,7 +2234,7 @@ function renderRow(cells, widths, aligns) {
|
|
|
2239
2234
|
for (let c = 0; c < widths.length; c++) {
|
|
2240
2235
|
const w = widths[c] ?? MIN_COL_WIDTH;
|
|
2241
2236
|
const text = wrapped[c]?.[line] ?? "";
|
|
2242
|
-
parts.push(padCell(text, w, aligns[c] ?? "left"));
|
|
2237
|
+
parts.push(padCell(text, w, aligns[c] ?? "left") + ANSI_RESET_ALL);
|
|
2243
2238
|
}
|
|
2244
2239
|
out.push("\u2502 " + parts.join(" \u2502 ") + " \u2502");
|
|
2245
2240
|
}
|
|
@@ -3224,6 +3219,10 @@ function extractDiffPreview(toolName, output) {
|
|
|
3224
3219
|
return parseUnifiedDiff(diff, DIFF_MAX_LINES);
|
|
3225
3220
|
}
|
|
3226
3221
|
var MESSAGE_PANEL_CHROME_WIDTH = 2;
|
|
3222
|
+
var MESSAGE_PANEL_MARGIN = 2;
|
|
3223
|
+
function assistantContentWidth(termWidth) {
|
|
3224
|
+
return Math.max(20, termWidth - MESSAGE_PANEL_CHROME_WIDTH - MESSAGE_PANEL_MARGIN * 2);
|
|
3225
|
+
}
|
|
3227
3226
|
function splitFencedBlocks(text) {
|
|
3228
3227
|
const lines = text.split("\n");
|
|
3229
3228
|
const segs = [];
|
|
@@ -3377,9 +3376,6 @@ function brainRiskColor(risk) {
|
|
|
3377
3376
|
return "red";
|
|
3378
3377
|
}
|
|
3379
3378
|
}
|
|
3380
|
-
function assistantContentWidth(termWidth) {
|
|
3381
|
-
return Math.max(20, termWidth - MESSAGE_PANEL_CHROME_WIDTH);
|
|
3382
|
-
}
|
|
3383
3379
|
var Entry = React6.memo(function Entry2({
|
|
3384
3380
|
entry,
|
|
3385
3381
|
termWidth
|
|
@@ -3389,6 +3385,7 @@ var Entry = React6.memo(function Entry2({
|
|
|
3389
3385
|
return /* @__PURE__ */ jsx(
|
|
3390
3386
|
Box,
|
|
3391
3387
|
{
|
|
3388
|
+
marginX: MESSAGE_PANEL_MARGIN,
|
|
3392
3389
|
borderStyle: "single",
|
|
3393
3390
|
borderTop: false,
|
|
3394
3391
|
borderRight: false,
|
|
@@ -3415,6 +3412,7 @@ var Entry = React6.memo(function Entry2({
|
|
|
3415
3412
|
Box,
|
|
3416
3413
|
{
|
|
3417
3414
|
flexDirection: "column",
|
|
3415
|
+
marginX: MESSAGE_PANEL_MARGIN,
|
|
3418
3416
|
marginY: 1,
|
|
3419
3417
|
borderStyle: "single",
|
|
3420
3418
|
borderTop: false,
|
|
@@ -3488,6 +3486,7 @@ var Entry = React6.memo(function Entry2({
|
|
|
3488
3486
|
return /* @__PURE__ */ jsx(
|
|
3489
3487
|
Box,
|
|
3490
3488
|
{
|
|
3489
|
+
marginX: MESSAGE_PANEL_MARGIN,
|
|
3491
3490
|
borderStyle: "single",
|
|
3492
3491
|
borderTop: false,
|
|
3493
3492
|
borderRight: false,
|
|
@@ -3501,6 +3500,7 @@ var Entry = React6.memo(function Entry2({
|
|
|
3501
3500
|
return /* @__PURE__ */ jsx(
|
|
3502
3501
|
Box,
|
|
3503
3502
|
{
|
|
3503
|
+
marginX: MESSAGE_PANEL_MARGIN,
|
|
3504
3504
|
borderStyle: "single",
|
|
3505
3505
|
borderTop: false,
|
|
3506
3506
|
borderRight: false,
|
|
@@ -3519,6 +3519,7 @@ var Entry = React6.memo(function Entry2({
|
|
|
3519
3519
|
Box,
|
|
3520
3520
|
{
|
|
3521
3521
|
flexDirection: "column",
|
|
3522
|
+
marginX: MESSAGE_PANEL_MARGIN,
|
|
3522
3523
|
marginY: 1,
|
|
3523
3524
|
borderStyle: "single",
|
|
3524
3525
|
borderTop: false,
|
|
@@ -3922,8 +3923,8 @@ var LiveActivityStrip = React6.memo(function LiveActivityStrip2({
|
|
|
3922
3923
|
}) {
|
|
3923
3924
|
const { stdout } = useStdout();
|
|
3924
3925
|
const width = Math.max(10, (stdout?.columns ?? 80) - 2);
|
|
3925
|
-
|
|
3926
|
-
const rows = activityStripRows(entries, Date.now(), maxRows, width);
|
|
3926
|
+
const hasEntries = Object.keys(entries).length > 0;
|
|
3927
|
+
const rows = hasEntries ? activityStripRows(entries, Date.now(), maxRows, width) : new Array(maxRows).fill("");
|
|
3927
3928
|
return /* @__PURE__ */ jsx(Box, { flexDirection: "column", paddingX: 1, children: rows.map((text, slot) => (
|
|
3928
3929
|
// biome-ignore lint/suspicious/noArrayIndexKey: fixed-height slots, index IS the identity
|
|
3929
3930
|
/* @__PURE__ */ jsx(Box, { height: 1, children: text === "" ? /* @__PURE__ */ jsx(Text, { children: " " }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -4324,6 +4325,106 @@ function ProcessListMonitor() {
|
|
|
4324
4325
|
] })
|
|
4325
4326
|
] });
|
|
4326
4327
|
}
|
|
4328
|
+
function GoalPanel({ goal }) {
|
|
4329
|
+
if (!goal) {
|
|
4330
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", padding: 1, children: [
|
|
4331
|
+
/* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsx(Text, { bold: true, color: theme.accent, children: "\u{1F3AF} Goal" }) }),
|
|
4332
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
4333
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "No goal set. Use " }),
|
|
4334
|
+
/* @__PURE__ */ jsxs(Text, { color: theme.accent, children: [
|
|
4335
|
+
"/goal set ",
|
|
4336
|
+
"<mission>"
|
|
4337
|
+
] }),
|
|
4338
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: " to create one." })
|
|
4339
|
+
] }),
|
|
4340
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Press F9 or Esc to close." }) })
|
|
4341
|
+
] });
|
|
4342
|
+
}
|
|
4343
|
+
const displayGoal = goal.refinedGoal || goal.goal;
|
|
4344
|
+
const stateIcon = goal.goalState === "active" ? "\u{1F504}" : goal.goalState === "paused" ? "\u23F8" : goal.goalState === "completed" ? "\u2705" : "\u23F9";
|
|
4345
|
+
const stateColor = goal.goalState === "active" ? "green" : goal.goalState === "paused" ? "yellow" : goal.goalState === "completed" ? "green" : "red";
|
|
4346
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", padding: 1, children: [
|
|
4347
|
+
/* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsxs(Text, { bold: true, color: theme.accent, children: [
|
|
4348
|
+
"\u{1F3AF} Goal \u2014 ",
|
|
4349
|
+
goal.goalState
|
|
4350
|
+
] }) }),
|
|
4351
|
+
/* @__PURE__ */ jsxs(Box, { marginBottom: 1, children: [
|
|
4352
|
+
/* @__PURE__ */ jsxs(Text, { children: [
|
|
4353
|
+
stateIcon,
|
|
4354
|
+
" "
|
|
4355
|
+
] }),
|
|
4356
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: displayGoal })
|
|
4357
|
+
] }),
|
|
4358
|
+
goal.refinedGoal && goal.refinedGoal !== goal.goal && /* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
4359
|
+
" (original: ",
|
|
4360
|
+
goal.goal.length > 60 ? goal.goal.slice(0, 57) + "\u2026" : goal.goal,
|
|
4361
|
+
")"
|
|
4362
|
+
] }) }),
|
|
4363
|
+
typeof goal.progress === "number" && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
4364
|
+
/* @__PURE__ */ jsx(Box, { children: renderProgressBar(goal.progress, goal.progressTrend) }),
|
|
4365
|
+
goal.progressNote && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
4366
|
+
" ",
|
|
4367
|
+
goal.progressNote
|
|
4368
|
+
] }) })
|
|
4369
|
+
] }),
|
|
4370
|
+
goal.deliverables && goal.deliverables.length > 0 && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
4371
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { bold: true, children: [
|
|
4372
|
+
"Deliverables (",
|
|
4373
|
+
goal.deliverables.length,
|
|
4374
|
+
"):"
|
|
4375
|
+
] }) }),
|
|
4376
|
+
goal.deliverables.map((d, i) => {
|
|
4377
|
+
const done = /^\[[x✓]\]|✅|\(done\)/i.test(d);
|
|
4378
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { color: done ? "green" : void 0, dimColor: !done, children: [
|
|
4379
|
+
" ",
|
|
4380
|
+
done ? "\u2713" : "\u25CB",
|
|
4381
|
+
" ",
|
|
4382
|
+
d
|
|
4383
|
+
] }) }, i);
|
|
4384
|
+
})
|
|
4385
|
+
] }),
|
|
4386
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
4387
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
4388
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "Iterations: " }),
|
|
4389
|
+
/* @__PURE__ */ jsx(Text, { children: goal.iterations })
|
|
4390
|
+
] }),
|
|
4391
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
4392
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "State: " }),
|
|
4393
|
+
/* @__PURE__ */ jsxs(Text, { color: stateColor, children: [
|
|
4394
|
+
stateIcon,
|
|
4395
|
+
" ",
|
|
4396
|
+
goal.goalState
|
|
4397
|
+
] })
|
|
4398
|
+
] }),
|
|
4399
|
+
goal.lastTask && /* @__PURE__ */ jsxs(Box, { children: [
|
|
4400
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "Last task: " }),
|
|
4401
|
+
/* @__PURE__ */ jsx(Text, { children: goal.lastTask.length > 50 ? goal.lastTask.slice(0, 47) + "\u2026" : goal.lastTask })
|
|
4402
|
+
] }),
|
|
4403
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Press F9 or Esc to close." }) })
|
|
4404
|
+
] })
|
|
4405
|
+
] });
|
|
4406
|
+
}
|
|
4407
|
+
function renderProgressBar(progress, trend) {
|
|
4408
|
+
const pct = Math.min(100, Math.max(0, Math.round(progress)));
|
|
4409
|
+
const filled = Math.round(pct / 5);
|
|
4410
|
+
const empty = 20 - filled;
|
|
4411
|
+
const trendIcon = trend === "accelerating" ? " \u{1F680}" : trend === "stalling" ? " \u26A0\uFE0F" : trend === "steady" ? " \u27A1\uFE0F" : "";
|
|
4412
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
4413
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: "Progress: " }),
|
|
4414
|
+
/* @__PURE__ */ jsx(Text, { color: "green", children: "\u2588".repeat(filled) }),
|
|
4415
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2591".repeat(empty) }),
|
|
4416
|
+
/* @__PURE__ */ jsxs(Text, { bold: true, children: [
|
|
4417
|
+
" ",
|
|
4418
|
+
pct,
|
|
4419
|
+
"%"
|
|
4420
|
+
] }),
|
|
4421
|
+
trend && /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
4422
|
+
trendIcon,
|
|
4423
|
+
" ",
|
|
4424
|
+
trend
|
|
4425
|
+
] })
|
|
4426
|
+
] });
|
|
4427
|
+
}
|
|
4327
4428
|
var DELAY_PRESETS_MS = [0, 15e3, 3e4, 45e3, 6e4, 12e4];
|
|
4328
4429
|
var SETTINGS_MODES = ["off", "suggest", "auto"];
|
|
4329
4430
|
var LOG_LEVELS = ["error", "warn", "info", "debug", "trace"];
|
|
@@ -6834,6 +6935,9 @@ function reducer(state, action) {
|
|
|
6834
6935
|
case "toggleProcessList": {
|
|
6835
6936
|
return { ...state, processListOpen: !state.processListOpen };
|
|
6836
6937
|
}
|
|
6938
|
+
case "toggleGoalPanel": {
|
|
6939
|
+
return { ...state, goalPanelOpen: !state.goalPanelOpen };
|
|
6940
|
+
}
|
|
6837
6941
|
case "checkpointReceived": {
|
|
6838
6942
|
const existing = state.checkpoints.find((c) => c.promptIndex === action.cp.promptIndex);
|
|
6839
6943
|
if (existing) return state;
|
|
@@ -7207,6 +7311,7 @@ function App({
|
|
|
7207
7311
|
getModeLabel
|
|
7208
7312
|
}) {
|
|
7209
7313
|
const { exit } = useApp();
|
|
7314
|
+
const { stdout } = useStdout();
|
|
7210
7315
|
const [liveModel, setLiveModel] = useState(model);
|
|
7211
7316
|
const [liveProvider, setLiveProvider] = useState(provider ?? "agent");
|
|
7212
7317
|
const [activeMaxContext, setActiveMaxContext] = useState(effectiveMaxContext);
|
|
@@ -7237,8 +7342,13 @@ function App({
|
|
|
7237
7342
|
type: "goalSummary",
|
|
7238
7343
|
summary: {
|
|
7239
7344
|
goal: goal.goal,
|
|
7345
|
+
refinedGoal: goal.refinedGoal,
|
|
7240
7346
|
goalState: goal.goalState ?? "active",
|
|
7241
7347
|
iterations: goal.iterations,
|
|
7348
|
+
progress: goal.progress,
|
|
7349
|
+
progressNote: goal.progressNote,
|
|
7350
|
+
progressTrend: goal.progressTrend,
|
|
7351
|
+
deliverables: goal.deliverables,
|
|
7242
7352
|
lastTask: lastEntry?.task,
|
|
7243
7353
|
lastStatus: lastEntry?.status
|
|
7244
7354
|
}
|
|
@@ -7331,6 +7441,7 @@ function App({
|
|
|
7331
7441
|
todosMonitorOpen: false,
|
|
7332
7442
|
queuePanelOpen: false,
|
|
7333
7443
|
processListOpen: false,
|
|
7444
|
+
goalPanelOpen: false,
|
|
7334
7445
|
collabSession: null,
|
|
7335
7446
|
checkpoints: [],
|
|
7336
7447
|
rewindOverlay: null,
|
|
@@ -8807,6 +8918,23 @@ function App({
|
|
|
8807
8918
|
}
|
|
8808
8919
|
return;
|
|
8809
8920
|
}
|
|
8921
|
+
if (key.fn === 9) {
|
|
8922
|
+
if (state.goalPanelOpen) {
|
|
8923
|
+
dispatch({ type: "toggleGoalPanel" });
|
|
8924
|
+
} else {
|
|
8925
|
+
if (state.agentsMonitorOpen) dispatch({ type: "toggleAgentsMonitor" });
|
|
8926
|
+
if (state.monitorOpen) dispatch({ type: "toggleMonitor" });
|
|
8927
|
+
if (state.worktreeMonitorOpen) dispatch({ type: "worktreeMonitorToggle" });
|
|
8928
|
+
if (state.todosMonitorOpen) dispatch({ type: "toggleTodosMonitor" });
|
|
8929
|
+
if (state.autoPhase?.monitorOpen) dispatch({ type: "autoPhaseMonitorToggle" });
|
|
8930
|
+
if (state.settingsPicker.open) dispatch({ type: "settingsClose" });
|
|
8931
|
+
if (state.queuePanelOpen) dispatch({ type: "toggleQueuePanel" });
|
|
8932
|
+
if (state.processListOpen) dispatch({ type: "toggleProcessList" });
|
|
8933
|
+
if (state.helpOpen) dispatch({ type: "toggleHelp" });
|
|
8934
|
+
dispatch({ type: "toggleGoalPanel" });
|
|
8935
|
+
}
|
|
8936
|
+
return;
|
|
8937
|
+
}
|
|
8810
8938
|
if (key.ctrl && input === "s") {
|
|
8811
8939
|
if (state.settingsPicker.open) {
|
|
8812
8940
|
dispatch({ type: "settingsClose" });
|
|
@@ -8877,6 +9005,10 @@ function App({
|
|
|
8877
9005
|
dispatch({ type: "toggleProcessList" });
|
|
8878
9006
|
return;
|
|
8879
9007
|
}
|
|
9008
|
+
if (state.goalPanelOpen) {
|
|
9009
|
+
dispatch({ type: "toggleGoalPanel" });
|
|
9010
|
+
return;
|
|
9011
|
+
}
|
|
8880
9012
|
}
|
|
8881
9013
|
if (input === "?" && !key.ctrl && !key.meta && draftRef.current.buffer === "" && !state.slashPicker.open && !state.picker.open && !state.modelPicker.open && !state.autonomyPicker.open && !state.settingsPicker.open && !state.rewindOverlay && !state.monitorOpen && !state.agentsMonitorOpen && !state.worktreeMonitorOpen && !state.todosMonitorOpen && !state.autoPhase?.monitorOpen) {
|
|
8882
9014
|
dispatch({ type: "toggleHelp" });
|
|
@@ -8963,7 +9095,7 @@ function App({
|
|
|
8963
9095
|
setDraft(buffer, buffer.length);
|
|
8964
9096
|
return;
|
|
8965
9097
|
}
|
|
8966
|
-
const overlayOpen = state.monitorOpen || state.agentsMonitorOpen || state.worktreeMonitorOpen || state.todosMonitorOpen || state.queuePanelOpen || state.processListOpen || state.helpOpen || (state.autoPhase?.monitorOpen ?? false) || state.rewindOverlay !== null;
|
|
9098
|
+
const overlayOpen = state.monitorOpen || state.agentsMonitorOpen || state.worktreeMonitorOpen || state.todosMonitorOpen || state.queuePanelOpen || state.processListOpen || state.goalPanelOpen || state.helpOpen || (state.autoPhase?.monitorOpen ?? false) || state.rewindOverlay !== null;
|
|
8967
9099
|
if (key.upArrow) {
|
|
8968
9100
|
if (!overlayOpen && state.inputHistory.length > 0) {
|
|
8969
9101
|
dispatch({ type: "historyUp" });
|
|
@@ -9320,8 +9452,21 @@ function App({
|
|
|
9320
9452
|
if (!builder) return;
|
|
9321
9453
|
const steering = state.steeringPending;
|
|
9322
9454
|
let effectiveText = trimmed;
|
|
9323
|
-
const
|
|
9324
|
-
|
|
9455
|
+
const chips = [];
|
|
9456
|
+
let cleanText = trimmed;
|
|
9457
|
+
const chipRe = new RegExp(INLINE_TOKEN_SRC, "g");
|
|
9458
|
+
let chipMatch;
|
|
9459
|
+
while ((chipMatch = chipRe.exec(trimmed)) !== null) {
|
|
9460
|
+
chips.push(chipMatch[0]);
|
|
9461
|
+
}
|
|
9462
|
+
if (chips.length > 0) {
|
|
9463
|
+
cleanText = trimmed.replace(chipRe, "").replace(/\s{2,}/g, " ").trim();
|
|
9464
|
+
if (!cleanText) {
|
|
9465
|
+
cleanText = trimmed;
|
|
9466
|
+
chips.length = 0;
|
|
9467
|
+
}
|
|
9468
|
+
}
|
|
9469
|
+
if (enhanceEnabledRef.current && state.status === "idle" && !steering && shouldEnhance(cleanText)) {
|
|
9325
9470
|
dispatch({ type: "enhanceBusy", on: true });
|
|
9326
9471
|
const ac = new AbortController();
|
|
9327
9472
|
enhanceAbortRef.current = ac;
|
|
@@ -9331,7 +9476,7 @@ function App({
|
|
|
9331
9476
|
result = await enhanceUserPrompt({
|
|
9332
9477
|
provider: agent.ctx.provider,
|
|
9333
9478
|
model: agent.ctx.model,
|
|
9334
|
-
text:
|
|
9479
|
+
text: cleanText,
|
|
9335
9480
|
signal: ac.signal,
|
|
9336
9481
|
onError: (reason) => {
|
|
9337
9482
|
enhanceErr = reason;
|
|
@@ -9353,27 +9498,30 @@ function App({
|
|
|
9353
9498
|
}
|
|
9354
9499
|
});
|
|
9355
9500
|
}
|
|
9356
|
-
if (result && !normalizedEqual(result.refined,
|
|
9501
|
+
if (result && !normalizedEqual(result.refined, cleanText)) {
|
|
9502
|
+
const chipSuffix = chips.length > 0 ? ` ${chips.join(" ")}` : "";
|
|
9503
|
+
const refinedWithChips = result.refined + chipSuffix;
|
|
9504
|
+
const englishWithChips = result.english + chipSuffix;
|
|
9357
9505
|
const decision = await new Promise((resolve) => {
|
|
9358
9506
|
dispatch({
|
|
9359
9507
|
type: "enhanceOpen",
|
|
9360
9508
|
info: {
|
|
9361
9509
|
original: trimmed,
|
|
9362
|
-
refined:
|
|
9363
|
-
english:
|
|
9510
|
+
refined: refinedWithChips,
|
|
9511
|
+
english: englishWithChips,
|
|
9364
9512
|
resolve
|
|
9365
9513
|
}
|
|
9366
9514
|
});
|
|
9367
9515
|
});
|
|
9368
9516
|
dispatch({ type: "enhanceClose" });
|
|
9369
9517
|
if (decision === "edit") {
|
|
9370
|
-
setDraft(
|
|
9518
|
+
setDraft(refinedWithChips, refinedWithChips.length);
|
|
9371
9519
|
return;
|
|
9372
9520
|
}
|
|
9373
9521
|
if (decision === "english") {
|
|
9374
|
-
effectiveText =
|
|
9522
|
+
effectiveText = englishWithChips;
|
|
9375
9523
|
} else {
|
|
9376
|
-
effectiveText = decision === "refined" ?
|
|
9524
|
+
effectiveText = decision === "refined" ? refinedWithChips : trimmed;
|
|
9377
9525
|
}
|
|
9378
9526
|
}
|
|
9379
9527
|
}
|
|
@@ -9455,6 +9603,15 @@ User message:
|
|
|
9455
9603
|
return "";
|
|
9456
9604
|
}, [state.buffer, state.status, state.picker.open]);
|
|
9457
9605
|
const enhanceActive = state.enhanceBusy || state.enhance != null;
|
|
9606
|
+
const inputCellRows = layoutInputRows(
|
|
9607
|
+
INPUT_PROMPT,
|
|
9608
|
+
state.buffer,
|
|
9609
|
+
state.cursor,
|
|
9610
|
+
stdout?.columns ?? 80
|
|
9611
|
+
);
|
|
9612
|
+
const inputHeight = Math.max(1, inputCellRows.length);
|
|
9613
|
+
const monitorOpen = state.monitorOpen || state.agentsMonitorOpen || state.worktreeMonitorOpen || state.todosMonitorOpen || state.queuePanelOpen || state.processListOpen || state.goalPanelOpen || state.helpOpen;
|
|
9614
|
+
const hideInput = enhanceActive || monitorOpen;
|
|
9458
9615
|
return /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: /* @__PURE__ */ jsxs(Box, { flexDirection: "column", flexGrow: 1, flexShrink: 0, children: [
|
|
9459
9616
|
/* @__PURE__ */ jsx(
|
|
9460
9617
|
History,
|
|
@@ -9466,7 +9623,7 @@ User message:
|
|
|
9466
9623
|
),
|
|
9467
9624
|
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", flexShrink: 0, children: [
|
|
9468
9625
|
/* @__PURE__ */ jsx(LiveActivityStrip, { entries: state.fleet, nowTick }),
|
|
9469
|
-
|
|
9626
|
+
hideInput ? /* @__PURE__ */ jsx(Box, { height: inputHeight }) : /* @__PURE__ */ jsx(
|
|
9470
9627
|
Input,
|
|
9471
9628
|
{
|
|
9472
9629
|
prompt: INPUT_PROMPT,
|
|
@@ -9734,7 +9891,8 @@ User message:
|
|
|
9734
9891
|
) : null,
|
|
9735
9892
|
Object.keys(state.worktrees).length > 0 && !state.worktreeMonitorOpen && !state.monitorOpen ? /* @__PURE__ */ jsx(WorktreePanel, { worktrees: state.worktrees, nowTick }) : null,
|
|
9736
9893
|
state.queuePanelOpen ? /* @__PURE__ */ jsx(QueuePanel, { items: state.queue }) : null,
|
|
9737
|
-
state.processListOpen ? /* @__PURE__ */ jsx(ProcessListMonitor, {}) : null
|
|
9894
|
+
state.processListOpen ? /* @__PURE__ */ jsx(ProcessListMonitor, {}) : null,
|
|
9895
|
+
state.goalPanelOpen ? /* @__PURE__ */ jsx(GoalPanel, { goal: state.goalSummary }) : null
|
|
9738
9896
|
] })
|
|
9739
9897
|
] }) });
|
|
9740
9898
|
}
|