reasonix 0.30.3 → 0.30.4
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/README.md +8 -0
- package/README.zh-CN.md +8 -0
- package/dist/cli/index.js +775 -629
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -858,6 +858,7 @@ var EN = {
|
|
|
858
858
|
statusBudget: " budget ${spent} / ${cap} ({pct}%){tag}",
|
|
859
859
|
statusSession: ' session "{name}" \xB7 {count} messages in log (resumed {resumed})',
|
|
860
860
|
statusSessionEphemeral: " session (ephemeral \u2014 no persistence)",
|
|
861
|
+
statusWorkspace: " workspace {path} \xB7 pinned at launch (relaunch with --dir <path> to switch)",
|
|
861
862
|
statusMcp: " mcp {servers} server(s), {tools} tool(s) in registry",
|
|
862
863
|
statusEdits: " edits {count} pending (/apply to commit, /discard to drop)",
|
|
863
864
|
statusPlan: " plan ON \u2014 writes gated (submit_plan + approval)",
|
|
@@ -1545,6 +1546,7 @@ var zhCN = {
|
|
|
1545
1546
|
statusBudget: " \u9884\u7B97 ${spent} / ${cap}\uFF08{pct}%\uFF09{tag}",
|
|
1546
1547
|
statusSession: ' \u4F1A\u8BDD "{name}" \xB7 \u65E5\u5FD7\u4E2D {count} \u6761\u6D88\u606F\uFF08\u6062\u590D\u4E86 {resumed} \u6761\uFF09',
|
|
1547
1548
|
statusSessionEphemeral: " \u4F1A\u8BDD \uFF08\u4E34\u65F6 \u2014 \u65E0\u6301\u4E45\u5316\uFF09",
|
|
1549
|
+
statusWorkspace: " \u5DE5\u4F5C\u533A {path} \xB7 \u542F\u52A8\u65F6\u9501\u5B9A\uFF08\u7528 --dir <path> \u91CD\u65B0\u542F\u52A8\u4EE5\u5207\u6362\uFF09",
|
|
1548
1550
|
statusMcp: " MCP {servers} \u4E2A\u670D\u52A1\u5668\uFF0C\u6CE8\u518C\u8868\u4E2D {tools} \u4E2A\u5DE5\u5177",
|
|
1549
1551
|
statusEdits: " \u7F16\u8F91 {count} \u4E2A\u5F85\u5904\u7406\uFF08/apply \u63D0\u4EA4\uFF0C/discard \u4E22\u5F03\uFF09",
|
|
1550
1552
|
statusPlan: " \u8BA1\u5212 \u5F00\u542F \u2014 \u5199\u5165\u53D7\u9650\uFF08submit_plan + \u5BA1\u6279\uFF09",
|
|
@@ -2577,7 +2579,7 @@ function encode(text) {
|
|
|
2577
2579
|
if (!text) return [];
|
|
2578
2580
|
const t3 = loadTokenizer();
|
|
2579
2581
|
const ids = [];
|
|
2580
|
-
const
|
|
2582
|
+
const process3 = (segment) => {
|
|
2581
2583
|
if (!segment) return;
|
|
2582
2584
|
let chunks = [segment];
|
|
2583
2585
|
for (const re of t3.splitRegexes) chunks = applySplit(chunks, re);
|
|
@@ -2596,14 +2598,14 @@ function encode(text) {
|
|
|
2596
2598
|
let last = 0;
|
|
2597
2599
|
for (const m of text.matchAll(t3.addedPattern)) {
|
|
2598
2600
|
const idx = m.index ?? 0;
|
|
2599
|
-
if (idx > last)
|
|
2601
|
+
if (idx > last) process3(text.slice(last, idx));
|
|
2600
2602
|
const id = t3.addedMap.get(m[0]);
|
|
2601
2603
|
if (id !== void 0) ids.push(id);
|
|
2602
2604
|
last = idx + m[0].length;
|
|
2603
2605
|
}
|
|
2604
|
-
if (last < text.length)
|
|
2606
|
+
if (last < text.length) process3(text.slice(last));
|
|
2605
2607
|
} else {
|
|
2606
|
-
|
|
2608
|
+
process3(text);
|
|
2607
2609
|
}
|
|
2608
2610
|
return ids;
|
|
2609
2611
|
}
|
|
@@ -3283,6 +3285,10 @@ var SessionStats = class {
|
|
|
3283
3285
|
_carryoverCost = 0;
|
|
3284
3286
|
/** Turn count from prior runs of a resumed session. */
|
|
3285
3287
|
_carryoverTurns = 0;
|
|
3288
|
+
_carryoverCacheHit = 0;
|
|
3289
|
+
_carryoverCacheMiss = 0;
|
|
3290
|
+
/** Last turn's promptTokens before exit — surfaced via summary() until the next live turn lands. */
|
|
3291
|
+
_carryoverLastPromptTokens = 0;
|
|
3286
3292
|
/** Seed totals from a resumed session's persisted meta — only call once at construction. */
|
|
3287
3293
|
seedCarryover(opts) {
|
|
3288
3294
|
if (typeof opts.totalCostUsd === "number" && opts.totalCostUsd > 0) {
|
|
@@ -3291,6 +3297,15 @@ var SessionStats = class {
|
|
|
3291
3297
|
if (typeof opts.turnCount === "number" && opts.turnCount > 0) {
|
|
3292
3298
|
this._carryoverTurns = opts.turnCount;
|
|
3293
3299
|
}
|
|
3300
|
+
if (typeof opts.cacheHitTokens === "number" && opts.cacheHitTokens > 0) {
|
|
3301
|
+
this._carryoverCacheHit = opts.cacheHitTokens;
|
|
3302
|
+
}
|
|
3303
|
+
if (typeof opts.cacheMissTokens === "number" && opts.cacheMissTokens > 0) {
|
|
3304
|
+
this._carryoverCacheMiss = opts.cacheMissTokens;
|
|
3305
|
+
}
|
|
3306
|
+
if (typeof opts.lastPromptTokens === "number" && opts.lastPromptTokens > 0) {
|
|
3307
|
+
this._carryoverLastPromptTokens = opts.lastPromptTokens;
|
|
3308
|
+
}
|
|
3294
3309
|
}
|
|
3295
3310
|
record(turn, model2, usage) {
|
|
3296
3311
|
const cost2 = costUsd(model2, usage);
|
|
@@ -3321,8 +3336,8 @@ var SessionStats = class {
|
|
|
3321
3336
|
return this.turns.reduce((sum, t3) => sum + outputCostUsd(t3.model, t3.usage), 0);
|
|
3322
3337
|
}
|
|
3323
3338
|
get aggregateCacheHitRatio() {
|
|
3324
|
-
let hit =
|
|
3325
|
-
let miss =
|
|
3339
|
+
let hit = this._carryoverCacheHit;
|
|
3340
|
+
let miss = this._carryoverCacheMiss;
|
|
3326
3341
|
for (const t3 of this.turns) {
|
|
3327
3342
|
hit += t3.usage.promptCacheHitTokens;
|
|
3328
3343
|
miss += t3.usage.promptCacheMissTokens;
|
|
@@ -3340,7 +3355,7 @@ var SessionStats = class {
|
|
|
3340
3355
|
claudeEquivalentUsd: round(this.totalClaudeEquivalent, 6),
|
|
3341
3356
|
savingsVsClaudePct: round(this.savingsVsClaude * 100, 2),
|
|
3342
3357
|
cacheHitRatio: round(this.aggregateCacheHitRatio, 4),
|
|
3343
|
-
lastPromptTokens: last?.usage.promptTokens ??
|
|
3358
|
+
lastPromptTokens: last?.usage.promptTokens ?? this._carryoverLastPromptTokens,
|
|
3344
3359
|
lastTurnCostUsd: round(last?.cost ?? 0, 6)
|
|
3345
3360
|
};
|
|
3346
3361
|
}
|
|
@@ -4344,7 +4359,10 @@ var CacheFirstLoop = class {
|
|
|
4344
4359
|
const meta = loadSessionMeta(this.sessionName);
|
|
4345
4360
|
this.stats.seedCarryover({
|
|
4346
4361
|
totalCostUsd: meta.totalCostUsd,
|
|
4347
|
-
turnCount: meta.turnCount
|
|
4362
|
+
turnCount: meta.turnCount,
|
|
4363
|
+
cacheHitTokens: meta.cacheHitTokens,
|
|
4364
|
+
cacheMissTokens: meta.cacheMissTokens,
|
|
4365
|
+
lastPromptTokens: meta.lastPromptTokens
|
|
4348
4366
|
});
|
|
4349
4367
|
}
|
|
4350
4368
|
if (healedCount > 0) {
|
|
@@ -5701,7 +5719,9 @@ function registerFilesystemTools(registry, opts) {
|
|
|
5701
5719
|
const normRoot = pathMod3.resolve(rootDir);
|
|
5702
5720
|
const rel = pathMod3.relative(normRoot, resolved);
|
|
5703
5721
|
if (rel.startsWith("..") || pathMod3.isAbsolute(rel)) {
|
|
5704
|
-
throw new Error(
|
|
5722
|
+
throw new Error(
|
|
5723
|
+
`path escapes sandbox root (${normRoot}): ${raw} \u2014 workspace is pinned at launch; quit and relaunch with \`reasonix code --dir <path>\` to work in a different folder`
|
|
5724
|
+
);
|
|
5705
5725
|
}
|
|
5706
5726
|
return resolved;
|
|
5707
5727
|
};
|
|
@@ -10267,7 +10287,7 @@ function formatLogSize(path6 = defaultUsageLogPath()) {
|
|
|
10267
10287
|
|
|
10268
10288
|
// src/cli/commands/chat.tsx
|
|
10269
10289
|
import { render } from "ink";
|
|
10270
|
-
import
|
|
10290
|
+
import React65, { useState as useState22 } from "react";
|
|
10271
10291
|
|
|
10272
10292
|
// src/mcp/preflight.ts
|
|
10273
10293
|
import { statSync as statSync5 } from "fs";
|
|
@@ -10310,8 +10330,8 @@ function buildMcpServerSummary(opts) {
|
|
|
10310
10330
|
}
|
|
10311
10331
|
|
|
10312
10332
|
// src/cli/ui/App.tsx
|
|
10313
|
-
import { Box as
|
|
10314
|
-
import
|
|
10333
|
+
import { Box as Box49, Text as Text53, useStdout as useStdout15 } from "ink";
|
|
10334
|
+
import React62, { useCallback as useCallback11, useEffect as useEffect12, useMemo as useMemo7, useRef as useRef9, useState as useState20 } from "react";
|
|
10315
10335
|
|
|
10316
10336
|
// src/adapters/event-sink-jsonl.ts
|
|
10317
10337
|
import { chmodSync as chmodSync3, createWriteStream as createWriteStream2, mkdirSync as mkdirSync6 } from "fs";
|
|
@@ -15346,17 +15366,23 @@ var CSI_TAIL_MAP = [
|
|
|
15346
15366
|
{ tail: "6~", ev: { input: "", pageDown: true } },
|
|
15347
15367
|
{ tail: "3~", ev: { input: "", delete: true } },
|
|
15348
15368
|
{ tail: "Z", ev: { input: "", shift: true, tab: true } },
|
|
15349
|
-
//
|
|
15350
|
-
//
|
|
15369
|
+
// Some Windows hosts (PowerShell 7.x conhost path) emit the
|
|
15370
|
+
// modifier-encoded back-tab `\x1b[1;2Z` instead of bare `\x1b[Z`.
|
|
15371
|
+
// Issue #373 — without this entry Shift+Tab is silently dropped.
|
|
15372
|
+
{ tail: "1;2Z", ev: { input: "", shift: true, tab: true } },
|
|
15373
|
+
// modifyOtherKeys (xterm CSI > 4 ; 2 m) sequences for Enter / Tab
|
|
15374
|
+
// with modifiers. Only fired when App.tsx has enabled the mode at
|
|
15351
15375
|
// startup; otherwise Shift+Enter stays indistinguishable from Enter.
|
|
15352
15376
|
// Modifier encoding: 2=shift, 3=alt, 4=alt+shift, 5=ctrl,
|
|
15353
|
-
// 6=ctrl+shift, 7=ctrl+alt, 8=ctrl+alt+shift.
|
|
15377
|
+
// 6=ctrl+shift, 7=ctrl+alt, 8=ctrl+alt+shift. Keycodes: 9=Tab, 13=Enter.
|
|
15378
|
+
{ tail: "27;2;9~", ev: { input: "", tab: true, shift: true } },
|
|
15354
15379
|
{ tail: "27;2;13~", ev: { input: "", return: true, shift: true } },
|
|
15355
15380
|
{ tail: "27;5;13~", ev: { input: "", return: true, ctrl: true } },
|
|
15356
15381
|
{ tail: "27;6;13~", ev: { input: "", return: true, ctrl: true, shift: true } },
|
|
15357
15382
|
// Kitty keyboard protocol — same idea, different envelope:
|
|
15358
15383
|
// `\x1b[<keycode>;<mod>u`. Some terminals (kitty, recent Windows
|
|
15359
15384
|
// Terminal previews) prefer this shape. Harmless to map here too.
|
|
15385
|
+
{ tail: "9;2u", ev: { input: "", tab: true, shift: true } },
|
|
15360
15386
|
{ tail: "13;2u", ev: { input: "", return: true, shift: true } },
|
|
15361
15387
|
{ tail: "13;5u", ev: { input: "", return: true, ctrl: true } },
|
|
15362
15388
|
{ tail: "13;6u", ev: { input: "", return: true, ctrl: true, shift: true } }
|
|
@@ -16984,17 +17010,108 @@ function TabPill({ label, count, active }) {
|
|
|
16984
17010
|
return /* @__PURE__ */ React12.createElement(Text9, { dimColor: true }, ` ${text} `);
|
|
16985
17011
|
}
|
|
16986
17012
|
|
|
17013
|
+
// src/cli/ui/ModelPicker.tsx
|
|
17014
|
+
import { Box as Box10, Text as Text11, useStdout as useStdout4 } from "ink";
|
|
17015
|
+
import React14, { useState as useState7 } from "react";
|
|
17016
|
+
|
|
17017
|
+
// src/cli/ui/primitives/Pill.tsx
|
|
17018
|
+
import { Text as Text10 } from "ink";
|
|
17019
|
+
import React13 from "react";
|
|
17020
|
+
function Pill({ label, bg, fg, bold = true }) {
|
|
17021
|
+
return /* @__PURE__ */ React13.createElement(Text10, { backgroundColor: bg, color: fg, bold }, ` ${label} `);
|
|
17022
|
+
}
|
|
17023
|
+
var PILL_SECTION = {
|
|
17024
|
+
reason: { bg: "#2a1f3d", fg: "#d2a8ff" },
|
|
17025
|
+
output: { bg: "#0d1d2e", fg: "#79c0ff" },
|
|
17026
|
+
tool: { bg: "#0f2230", fg: "#79c0ff" },
|
|
17027
|
+
shell: { bg: "#0f2230", fg: "#79c0ff" },
|
|
17028
|
+
task: { bg: "#0d1d2e", fg: "#79c0ff" },
|
|
17029
|
+
taskDone: { bg: "#102815", fg: "#7ee787" },
|
|
17030
|
+
taskFailed: { bg: "#2c1416", fg: "#ff8b81" },
|
|
17031
|
+
plan: { bg: "#2a1f3d", fg: "#d2a8ff" },
|
|
17032
|
+
user: { bg: "#11141a", fg: "#8b949e" }
|
|
17033
|
+
};
|
|
17034
|
+
var PILL_MODEL = {
|
|
17035
|
+
flash: { bg: "#11141a", fg: "#79c0ff" },
|
|
17036
|
+
pro: { bg: "#11141a", fg: "#d2a8ff" },
|
|
17037
|
+
r1: { bg: "#11141a", fg: "#b395f5" },
|
|
17038
|
+
unknown: { bg: "#11141a", fg: "#8b949e" }
|
|
17039
|
+
};
|
|
17040
|
+
function modelBadgeFor(model2) {
|
|
17041
|
+
if (!model2) return { label: "?", kind: "unknown" };
|
|
17042
|
+
const stripped = model2.replace(/^deepseek-/, "");
|
|
17043
|
+
if (stripped === "v4-flash" || stripped === "chat") return { label: "v4-flash", kind: "flash" };
|
|
17044
|
+
if (stripped === "v4-pro") return { label: "v4-pro", kind: "pro" };
|
|
17045
|
+
if (stripped === "r1" || stripped === "reasoner") return { label: "r1", kind: "r1" };
|
|
17046
|
+
return { label: stripped, kind: "unknown" };
|
|
17047
|
+
}
|
|
17048
|
+
|
|
17049
|
+
// src/cli/ui/ModelPicker.tsx
|
|
17050
|
+
var PAGE_MARGIN = 6;
|
|
17051
|
+
function ModelPicker({
|
|
17052
|
+
models: models2,
|
|
17053
|
+
current,
|
|
17054
|
+
onChoose,
|
|
17055
|
+
onRefresh
|
|
17056
|
+
}) {
|
|
17057
|
+
const list2 = (models2 && models2.length > 0 ? models2 : FALLBACK_MODELS).slice();
|
|
17058
|
+
if (!list2.includes(current)) list2.unshift(current);
|
|
17059
|
+
const initialIndex = Math.max(0, list2.indexOf(current));
|
|
17060
|
+
const [focus, setFocus] = useState7(initialIndex);
|
|
17061
|
+
const { stdout: stdout4 } = useStdout4();
|
|
17062
|
+
const rows = stdout4?.rows ?? 40;
|
|
17063
|
+
const visibleCount = Math.max(3, rows - PAGE_MARGIN);
|
|
17064
|
+
useKeystroke((ev) => {
|
|
17065
|
+
if (ev.escape) return onChoose({ kind: "quit" });
|
|
17066
|
+
if (ev.upArrow) return setFocus((f) => Math.max(0, f - 1));
|
|
17067
|
+
if (ev.downArrow) return setFocus((f) => Math.min(list2.length - 1, f + 1));
|
|
17068
|
+
if (ev.return) {
|
|
17069
|
+
const target = list2[focus];
|
|
17070
|
+
if (target) onChoose({ kind: "select", id: target });
|
|
17071
|
+
return;
|
|
17072
|
+
}
|
|
17073
|
+
if (!ev.input) return;
|
|
17074
|
+
if (ev.input === "q") return onChoose({ kind: "quit" });
|
|
17075
|
+
if (ev.input === "r") onRefresh?.();
|
|
17076
|
+
});
|
|
17077
|
+
const start = Math.max(
|
|
17078
|
+
0,
|
|
17079
|
+
Math.min(focus - Math.floor(visibleCount / 2), list2.length - visibleCount)
|
|
17080
|
+
);
|
|
17081
|
+
const end = Math.min(list2.length, start + visibleCount);
|
|
17082
|
+
const shown = list2.slice(start, end);
|
|
17083
|
+
const hiddenAbove = start;
|
|
17084
|
+
const hiddenBelow = list2.length - end;
|
|
17085
|
+
const loading = models2 === null;
|
|
17086
|
+
const empty = models2 !== null && models2.length === 0;
|
|
17087
|
+
return /* @__PURE__ */ React14.createElement(Box10, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React14.createElement(Box10, null, /* @__PURE__ */ React14.createElement(Text11, { bold: true, color: TONE.brand }, " \u25C8 REASONIX \xB7 pick a model "), /* @__PURE__ */ React14.createElement(Text11, { color: FG.meta }, loading ? " \xB7 loading catalog\u2026" : empty ? " \xB7 catalog empty \u2014 using known fallbacks" : ` \xB7 ${list2.length} available`)), /* @__PURE__ */ React14.createElement(Box10, { height: 1 }), hiddenAbove > 0 ? /* @__PURE__ */ React14.createElement(Box10, null, /* @__PURE__ */ React14.createElement(Text11, { color: FG.faint }, ` \u2026 ${hiddenAbove} earlier`)) : null, shown.map((id, i) => /* @__PURE__ */ React14.createElement(ModelRow, { key: id, id, focused: start + i === focus, active: id === current })), hiddenBelow > 0 ? /* @__PURE__ */ React14.createElement(Box10, null, /* @__PURE__ */ React14.createElement(Text11, { color: FG.faint }, ` \u2026 ${hiddenBelow} more`)) : null, /* @__PURE__ */ React14.createElement(Box10, { marginTop: 1 }, /* @__PURE__ */ React14.createElement(Text11, { color: FG.faint }, " \u2191\u2193 pick \xB7 \u23CE confirm \xB7 [r] refresh \xB7 esc cancel")));
|
|
17088
|
+
}
|
|
17089
|
+
function ModelRow({
|
|
17090
|
+
id,
|
|
17091
|
+
focused,
|
|
17092
|
+
active
|
|
17093
|
+
}) {
|
|
17094
|
+
const badge2 = modelBadgeFor(id);
|
|
17095
|
+
return /* @__PURE__ */ React14.createElement(Box10, null, /* @__PURE__ */ React14.createElement(Text11, { color: focused ? TONE.brand : FG.faint }, focused ? " \u25B8 " : " "), /* @__PURE__ */ React14.createElement(Text11, { bold: focused, color: focused ? FG.strong : FG.sub }, id.padEnd(24)), /* @__PURE__ */ React14.createElement(Text11, null, " "), /* @__PURE__ */ React14.createElement(Pill, { label: badge2.label, ...PILL_MODEL[badge2.kind], bold: false }), active ? /* @__PURE__ */ React14.createElement(Text11, { color: TONE.brand }, " \xB7 current") : null);
|
|
17096
|
+
}
|
|
17097
|
+
var FALLBACK_MODELS = [
|
|
17098
|
+
"deepseek-v4-flash",
|
|
17099
|
+
"deepseek-v4-pro",
|
|
17100
|
+
"deepseek-chat",
|
|
17101
|
+
"deepseek-reasoner"
|
|
17102
|
+
];
|
|
17103
|
+
|
|
16987
17104
|
// src/cli/ui/PlanCheckpointConfirm.tsx
|
|
16988
|
-
import { Box as
|
|
16989
|
-
import
|
|
17105
|
+
import { Box as Box13 } from "ink";
|
|
17106
|
+
import React17 from "react";
|
|
16990
17107
|
|
|
16991
17108
|
// src/cli/ui/PlanStepList.tsx
|
|
16992
|
-
import { Box as
|
|
16993
|
-
import
|
|
17109
|
+
import { Box as Box12, Text as Text13 } from "ink";
|
|
17110
|
+
import React16 from "react";
|
|
16994
17111
|
|
|
16995
17112
|
// src/cli/ui/char-bar.tsx
|
|
16996
|
-
import { Box as
|
|
16997
|
-
import
|
|
17113
|
+
import { Box as Box11, Text as Text12 } from "ink";
|
|
17114
|
+
import React15 from "react";
|
|
16998
17115
|
function CharBar({
|
|
16999
17116
|
pct: pct2,
|
|
17000
17117
|
width = 24,
|
|
@@ -17006,7 +17123,7 @@ function CharBar({
|
|
|
17006
17123
|
const total = Math.max(4, width);
|
|
17007
17124
|
const clamped = Math.max(0, Math.min(100, Number.isFinite(pct2) ? pct2 : 0));
|
|
17008
17125
|
const filled = Math.round(total * clamped / 100);
|
|
17009
|
-
return /* @__PURE__ */
|
|
17126
|
+
return /* @__PURE__ */ React15.createElement(Box11, null, /* @__PURE__ */ React15.createElement(Text12, { color: color2 }, GLYPH.block.repeat(filled)), /* @__PURE__ */ React15.createElement(Text12, { color: emptyColor ?? COLOR.info, dimColor: true }, GLYPH.shade1.repeat(total - filled)), showLabel ? /* @__PURE__ */ React15.createElement(Text12, { dimColor: true }, ` ${label ?? `${Math.round(clamped)}%`}`) : null);
|
|
17010
17127
|
}
|
|
17011
17128
|
|
|
17012
17129
|
// src/cli/ui/PlanStepList.tsx
|
|
@@ -17036,25 +17153,25 @@ function PlanStepListInner({ steps, statuses, focusStepId }) {
|
|
|
17036
17153
|
const doneCount = statusList.filter((s) => s === "done").length;
|
|
17037
17154
|
const pct2 = Math.round(doneCount / total * 100);
|
|
17038
17155
|
const showProgress = doneCount > 0;
|
|
17039
|
-
return /* @__PURE__ */
|
|
17156
|
+
return /* @__PURE__ */ React16.createElement(Box12, { flexDirection: "column" }, /* @__PURE__ */ React16.createElement(Box12, null, /* @__PURE__ */ React16.createElement(Text13, { dimColor: true }, showProgress ? `${doneCount}/${total} done (${pct2}%) \xB7 ${total} step${total === 1 ? "" : "s"}` : `${total} step${total === 1 ? "" : "s"}`)), /* @__PURE__ */ React16.createElement(Box12, { flexDirection: "column" }, steps.map((step, i) => {
|
|
17040
17157
|
const status3 = statusList[i];
|
|
17041
17158
|
const isLast = i === total - 1;
|
|
17042
17159
|
const isCur = focusStepId === step.id;
|
|
17043
17160
|
const sg = statusGlyph(status3, isCur);
|
|
17044
17161
|
const risk = riskLabel(step.risk);
|
|
17045
17162
|
const titleDim = status3 === "done" || status3 === "skipped";
|
|
17046
|
-
return /* @__PURE__ */
|
|
17047
|
-
|
|
17163
|
+
return /* @__PURE__ */ React16.createElement(Box12, { key: step.id }, /* @__PURE__ */ React16.createElement(Text13, { color: COLOR.info, dimColor: true }, isLast ? GLYPH.branchEnd : GLYPH.branch), /* @__PURE__ */ React16.createElement(Text13, null, " "), /* @__PURE__ */ React16.createElement(Text13, { color: sg.color, bold: status3 === "running" || isCur }, sg.glyph), /* @__PURE__ */ React16.createElement(Text13, null, " "), /* @__PURE__ */ React16.createElement(
|
|
17164
|
+
Text13,
|
|
17048
17165
|
{
|
|
17049
17166
|
dimColor: titleDim,
|
|
17050
17167
|
bold: isCur || status3 === "running",
|
|
17051
17168
|
strikethrough: status3 === "done" || status3 === "skipped"
|
|
17052
17169
|
},
|
|
17053
17170
|
`${step.id} \xB7 ${step.title}`
|
|
17054
|
-
), risk ? /* @__PURE__ */
|
|
17055
|
-
})), showProgress ? /* @__PURE__ */
|
|
17171
|
+
), risk ? /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Text13, null, " "), /* @__PURE__ */ React16.createElement(Text13, { color: risk.color }, risk.text)) : null);
|
|
17172
|
+
})), showProgress ? /* @__PURE__ */ React16.createElement(Box12, null, /* @__PURE__ */ React16.createElement(Text13, null, " "), /* @__PURE__ */ React16.createElement(CharBar, { pct: pct2, width: 24 })) : null);
|
|
17056
17173
|
}
|
|
17057
|
-
var PlanStepList =
|
|
17174
|
+
var PlanStepList = React16.memo(PlanStepListInner);
|
|
17058
17175
|
|
|
17059
17176
|
// src/cli/ui/PlanCheckpointConfirm.tsx
|
|
17060
17177
|
function PlanCheckpointConfirmInner({
|
|
@@ -17073,7 +17190,7 @@ function PlanCheckpointConfirmInner({
|
|
|
17073
17190
|
const isLast = total > 0 && completed >= total;
|
|
17074
17191
|
const statuses = buildStatusMap(steps, completedStepIds, stepId, isLast);
|
|
17075
17192
|
const subtitle = counter ? `${counter} \xB7 ${label}` : label;
|
|
17076
|
-
return /* @__PURE__ */
|
|
17193
|
+
return /* @__PURE__ */ React17.createElement(ApprovalCard, { tone: "ok", glyph: "\u26C1", title: "Checkpoint \u2014 step done", metaRight: subtitle }, steps && steps.length > 0 ? /* @__PURE__ */ React17.createElement(Box13, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React17.createElement(PlanStepList, { steps, statuses, focusStepId: stepId })) : null, /* @__PURE__ */ React17.createElement(
|
|
17077
17194
|
SingleSelect,
|
|
17078
17195
|
{
|
|
17079
17196
|
initialValue: isLast ? "stop" : "continue",
|
|
@@ -17099,7 +17216,7 @@ function PlanCheckpointConfirmInner({
|
|
|
17099
17216
|
}
|
|
17100
17217
|
));
|
|
17101
17218
|
}
|
|
17102
|
-
var PlanCheckpointConfirm =
|
|
17219
|
+
var PlanCheckpointConfirm = React17.memo(PlanCheckpointConfirmInner);
|
|
17103
17220
|
function buildStatusMap(steps, completedStepIds, currentStepId, isLast) {
|
|
17104
17221
|
const map = /* @__PURE__ */ new Map();
|
|
17105
17222
|
if (!steps) return map;
|
|
@@ -17115,12 +17232,12 @@ function buildStatusMap(steps, completedStepIds, currentStepId, isLast) {
|
|
|
17115
17232
|
}
|
|
17116
17233
|
|
|
17117
17234
|
// src/cli/ui/PlanConfirm.tsx
|
|
17118
|
-
import { Box as
|
|
17119
|
-
import
|
|
17235
|
+
import { Box as Box15, Text as Text15 } from "ink";
|
|
17236
|
+
import React19 from "react";
|
|
17120
17237
|
|
|
17121
17238
|
// src/cli/ui/markdown-view.tsx
|
|
17122
|
-
import { Box as
|
|
17123
|
-
import
|
|
17239
|
+
import { Box as Box14, Text as Text14 } from "ink";
|
|
17240
|
+
import React18 from "react";
|
|
17124
17241
|
|
|
17125
17242
|
// node_modules/marked/lib/marked.esm.js
|
|
17126
17243
|
function _getDefaults() {
|
|
@@ -19466,33 +19583,33 @@ var TONE_BRAND = "#79c0ff";
|
|
|
19466
19583
|
var TONE_OK = "#7ee787";
|
|
19467
19584
|
var SURFACE_ELEV = "#161b22";
|
|
19468
19585
|
function MarkdownView({ text }) {
|
|
19469
|
-
return /* @__PURE__ */
|
|
19586
|
+
return /* @__PURE__ */ React18.createElement(MarkdownLines, { lines: markdownToLines(text) });
|
|
19470
19587
|
}
|
|
19471
19588
|
function MarkdownLines({
|
|
19472
19589
|
lines
|
|
19473
19590
|
}) {
|
|
19474
|
-
return /* @__PURE__ */
|
|
19591
|
+
return /* @__PURE__ */ React18.createElement(Box14, { flexDirection: "column" }, lines.map((line, i) => /* @__PURE__ */ React18.createElement(LineRow, { key: `md-${i}-${line.kind}`, line })));
|
|
19475
19592
|
}
|
|
19476
19593
|
function LineRow({ line }) {
|
|
19477
19594
|
switch (line.kind) {
|
|
19478
19595
|
case "blank":
|
|
19479
|
-
return /* @__PURE__ */
|
|
19596
|
+
return /* @__PURE__ */ React18.createElement(Text14, null, " ");
|
|
19480
19597
|
case "hr":
|
|
19481
|
-
return /* @__PURE__ */
|
|
19598
|
+
return /* @__PURE__ */ React18.createElement(Text14, { color: FG_FAINT }, "\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
19482
19599
|
case "heading":
|
|
19483
|
-
return /* @__PURE__ */
|
|
19600
|
+
return /* @__PURE__ */ React18.createElement(Box14, null, /* @__PURE__ */ React18.createElement(Text14, { bold: true, color: FG_STRONG }, `${"#".repeat(line.level)} `), /* @__PURE__ */ React18.createElement(Spans, { spans: line.spans, bold: true, strongColor: true }));
|
|
19484
19601
|
case "paragraph":
|
|
19485
|
-
return /* @__PURE__ */
|
|
19602
|
+
return /* @__PURE__ */ React18.createElement(Box14, null, /* @__PURE__ */ React18.createElement(Spans, { spans: line.spans }));
|
|
19486
19603
|
case "list": {
|
|
19487
19604
|
const indent = " ".repeat(line.depth * 2);
|
|
19488
19605
|
const marker = line.task === "done" ? "\u2713" : line.task === "todo" ? "\u25CB" : line.ordered ? `${line.index}.` : "\xB7";
|
|
19489
19606
|
const markerColor = line.task === "done" ? TONE_OK : line.task === "todo" ? FG_FAINT : FG_META;
|
|
19490
|
-
return /* @__PURE__ */
|
|
19607
|
+
return /* @__PURE__ */ React18.createElement(Box14, null, /* @__PURE__ */ React18.createElement(Text14, { color: markerColor }, `${indent}${marker} `), /* @__PURE__ */ React18.createElement(Spans, { spans: line.spans, dim: line.task === "done", strike: line.task === "done" }));
|
|
19491
19608
|
}
|
|
19492
19609
|
case "code":
|
|
19493
|
-
return /* @__PURE__ */
|
|
19610
|
+
return /* @__PURE__ */ React18.createElement(CodeBlock, { lang: line.lang, text: line.text });
|
|
19494
19611
|
case "blockquote":
|
|
19495
|
-
return /* @__PURE__ */
|
|
19612
|
+
return /* @__PURE__ */ React18.createElement(Box14, null, /* @__PURE__ */ React18.createElement(Text14, { color: TONE_BRAND }, "\u258E "), /* @__PURE__ */ React18.createElement(Spans, { spans: line.spans, italic: true }));
|
|
19496
19613
|
}
|
|
19497
19614
|
}
|
|
19498
19615
|
function spanKey(span, i) {
|
|
@@ -19500,14 +19617,14 @@ function spanKey(span, i) {
|
|
|
19500
19617
|
}
|
|
19501
19618
|
function CodeBlock({ lang, text }) {
|
|
19502
19619
|
const lines = text.split("\n");
|
|
19503
|
-
return /* @__PURE__ */
|
|
19620
|
+
return /* @__PURE__ */ React18.createElement(Box14, { flexDirection: "column" }, lang.length > 0 ? /* @__PURE__ */ React18.createElement(Text14, { color: FG_META }, ` ${lang}`) : null, lines.map((ln, i) => (
|
|
19504
19621
|
// biome-ignore lint/suspicious/noArrayIndexKey: code lines are positional + stable per render
|
|
19505
|
-
/* @__PURE__ */
|
|
19622
|
+
/* @__PURE__ */ React18.createElement(Text14, { key: `code-${i}`, backgroundColor: SURFACE_ELEV }, ` ${ln} `)
|
|
19506
19623
|
)));
|
|
19507
19624
|
}
|
|
19508
19625
|
function Spans({ spans, bold, italic, dim, strike, strongColor }) {
|
|
19509
|
-
if (spans.length === 0) return /* @__PURE__ */
|
|
19510
|
-
return /* @__PURE__ */
|
|
19626
|
+
if (spans.length === 0) return /* @__PURE__ */ React18.createElement(Text14, null, " ");
|
|
19627
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, spans.map((span, i) => /* @__PURE__ */ React18.createElement(
|
|
19511
19628
|
SpanText,
|
|
19512
19629
|
{
|
|
19513
19630
|
key: spanKey(span, i),
|
|
@@ -19529,11 +19646,11 @@ function SpanText({
|
|
|
19529
19646
|
strongColor
|
|
19530
19647
|
}) {
|
|
19531
19648
|
if (span.code) {
|
|
19532
|
-
return /* @__PURE__ */
|
|
19649
|
+
return /* @__PURE__ */ React18.createElement(Text14, { color: FG_STRONG, backgroundColor: SURFACE_ELEV }, ` ${span.text} `);
|
|
19533
19650
|
}
|
|
19534
19651
|
const color2 = span.fileRef ? TONE_BRAND : span.link ? TONE_BRAND : strongColor ? FG_STRONG : FG_BODY;
|
|
19535
|
-
return /* @__PURE__ */
|
|
19536
|
-
|
|
19652
|
+
return /* @__PURE__ */ React18.createElement(
|
|
19653
|
+
Text14,
|
|
19537
19654
|
{
|
|
19538
19655
|
color: color2,
|
|
19539
19656
|
bold: !!(span.bold || ambientBold),
|
|
@@ -19558,7 +19675,7 @@ function PlanConfirmInner({ plan: plan3, steps, onChoose }) {
|
|
|
19558
19675
|
const reservedFor = hasSteps ? stepRows : previewRows;
|
|
19559
19676
|
useReserveRows("modal", { min: 10, max: Math.max(16, reservedFor + 14) });
|
|
19560
19677
|
const hasOpenQuestions = /^#{1,6}\s*(open[-\s]?questions?|risks?|unknowns?|assumptions?|unclear)/im.test(plan3) || /^#{1,6}\s*(待确认|开放问题|风险|未知|假设|不确定)/im.test(plan3);
|
|
19561
|
-
return /* @__PURE__ */
|
|
19678
|
+
return /* @__PURE__ */ React19.createElement(
|
|
19562
19679
|
ApprovalCard,
|
|
19563
19680
|
{
|
|
19564
19681
|
tone: "accent",
|
|
@@ -19567,9 +19684,9 @@ function PlanConfirmInner({ plan: plan3, steps, onChoose }) {
|
|
|
19567
19684
|
metaRight: "awaiting",
|
|
19568
19685
|
metaRightColor: CARD.plan.color
|
|
19569
19686
|
},
|
|
19570
|
-
hasOpenQuestions ? /* @__PURE__ */
|
|
19571
|
-
hasSteps ? /* @__PURE__ */
|
|
19572
|
-
/* @__PURE__ */
|
|
19687
|
+
hasOpenQuestions ? /* @__PURE__ */ React19.createElement(Box15, { marginBottom: 1 }, /* @__PURE__ */ React19.createElement(Text15, { color: TONE.warn }, "\u25B2 the plan flags open questions or risks \u2014 pick ", /* @__PURE__ */ React19.createElement(Text15, { bold: true }, "refine"), " to write concrete answers before the model moves on.")) : null,
|
|
19688
|
+
hasSteps ? /* @__PURE__ */ React19.createElement(Box15, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React19.createElement(PlanStepList, { steps })) : plan3.trim().length > 0 ? /* @__PURE__ */ React19.createElement(Box15, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React19.createElement(MarkdownView, { text: previewBody }), truncatedBody ? /* @__PURE__ */ React19.createElement(Text15, { color: FG.faint }, `\u2026 ${planLines.length - PLAN_BODY_PREVIEW_LINES} more line${planLines.length - PLAN_BODY_PREVIEW_LINES === 1 ? "" : "s"} above in scrollback`) : null) : null,
|
|
19689
|
+
/* @__PURE__ */ React19.createElement(
|
|
19573
19690
|
SingleSelect,
|
|
19574
19691
|
{
|
|
19575
19692
|
initialValue: hasOpenQuestions ? "refine" : "approve",
|
|
@@ -19601,20 +19718,20 @@ function PlanConfirmInner({ plan: plan3, steps, onChoose }) {
|
|
|
19601
19718
|
)
|
|
19602
19719
|
);
|
|
19603
19720
|
}
|
|
19604
|
-
var PlanConfirm =
|
|
19721
|
+
var PlanConfirm = React19.memo(PlanConfirmInner);
|
|
19605
19722
|
|
|
19606
19723
|
// src/cli/ui/PlanRefineInput.tsx
|
|
19607
|
-
import { Box as
|
|
19608
|
-
import
|
|
19724
|
+
import { Box as Box16, Text as Text16 } from "ink";
|
|
19725
|
+
import React21, { useState as useState9 } from "react";
|
|
19609
19726
|
|
|
19610
19727
|
// src/cli/ui/ticker.tsx
|
|
19611
19728
|
import { useAnimation } from "ink";
|
|
19612
|
-
import
|
|
19729
|
+
import React20, { createContext as createContext3, useContext as useContext3, useState as useState8 } from "react";
|
|
19613
19730
|
var FAST_TICK_MS = 120;
|
|
19614
19731
|
var SLOW_TICK_MS = 1e3;
|
|
19615
19732
|
var TickerActiveContext = createContext3(true);
|
|
19616
19733
|
function TickerProvider({ children, disabled }) {
|
|
19617
|
-
return /* @__PURE__ */
|
|
19734
|
+
return /* @__PURE__ */ React20.createElement(TickerActiveContext.Provider, { value: !disabled }, children);
|
|
19618
19735
|
}
|
|
19619
19736
|
function useTickerActive() {
|
|
19620
19737
|
return useContext3(TickerActiveContext);
|
|
@@ -19628,7 +19745,7 @@ function useSlowTick() {
|
|
|
19628
19745
|
return useAnimation({ interval: SLOW_TICK_MS, isActive }).frame;
|
|
19629
19746
|
}
|
|
19630
19747
|
function useElapsedSeconds() {
|
|
19631
|
-
const [start] =
|
|
19748
|
+
const [start] = useState8(() => Date.now());
|
|
19632
19749
|
useSlowTick();
|
|
19633
19750
|
return Math.floor((Date.now() - start) / 1e3);
|
|
19634
19751
|
}
|
|
@@ -19677,7 +19794,7 @@ var MODES = {
|
|
|
19677
19794
|
}
|
|
19678
19795
|
};
|
|
19679
19796
|
function PlanRefineInput({ mode: mode2, onSubmit, onCancel }) {
|
|
19680
|
-
const [value, setValue] =
|
|
19797
|
+
const [value, setValue] = useState9("");
|
|
19681
19798
|
useKeystroke((ev) => {
|
|
19682
19799
|
if (ev.paste) {
|
|
19683
19800
|
setValue((v) => v + ev.input.replace(/\r?\n/g, " "));
|
|
@@ -19702,7 +19819,7 @@ function PlanRefineInput({ mode: mode2, onSubmit, onCancel }) {
|
|
|
19702
19819
|
const tick = useTick();
|
|
19703
19820
|
const cursorOn = Math.floor(tick / 4) % 2 === 0;
|
|
19704
19821
|
const meta = MODES[mode2];
|
|
19705
|
-
return /* @__PURE__ */
|
|
19822
|
+
return /* @__PURE__ */ React21.createElement(
|
|
19706
19823
|
ApprovalCard,
|
|
19707
19824
|
{
|
|
19708
19825
|
tone: meta.tone,
|
|
@@ -19710,14 +19827,14 @@ function PlanRefineInput({ mode: mode2, onSubmit, onCancel }) {
|
|
|
19710
19827
|
title: meta.title,
|
|
19711
19828
|
footerHint: "\u23CE send \xB7 esc return to picker"
|
|
19712
19829
|
},
|
|
19713
|
-
/* @__PURE__ */
|
|
19714
|
-
/* @__PURE__ */
|
|
19830
|
+
/* @__PURE__ */ React21.createElement(Box16, { marginBottom: 1 }, /* @__PURE__ */ React21.createElement(Text16, { color: FG.sub }, meta.hint, value === "" ? meta.blankHint : "")),
|
|
19831
|
+
/* @__PURE__ */ React21.createElement(Box16, null, /* @__PURE__ */ React21.createElement(Text16, { color: meta.cursorColor, bold: true }, "\u203A "), /* @__PURE__ */ React21.createElement(Text16, null, value), /* @__PURE__ */ React21.createElement(Text16, { color: meta.cursorColor, bold: true }, cursorOn ? "\u258D" : " "))
|
|
19715
19832
|
);
|
|
19716
19833
|
}
|
|
19717
19834
|
|
|
19718
19835
|
// src/cli/ui/PlanReviseConfirm.tsx
|
|
19719
|
-
import { Box as
|
|
19720
|
-
import
|
|
19836
|
+
import { Box as Box17, Text as Text17 } from "ink";
|
|
19837
|
+
import React22 from "react";
|
|
19721
19838
|
function computeDiff(oldSteps, newSteps) {
|
|
19722
19839
|
const oldIds = new Set(oldSteps.map((s) => s.id));
|
|
19723
19840
|
const newIds = new Set(newSteps.map((s) => s.id));
|
|
@@ -19753,7 +19870,7 @@ function PlanReviseConfirmInner({
|
|
|
19753
19870
|
const removedCount = rows.filter((r) => r.kind === "removed").length;
|
|
19754
19871
|
const addedCount = rows.filter((r) => r.kind === "added").length;
|
|
19755
19872
|
const keptCount = rows.filter((r) => r.kind === "kept").length;
|
|
19756
|
-
return /* @__PURE__ */
|
|
19873
|
+
return /* @__PURE__ */ React22.createElement(
|
|
19757
19874
|
ApprovalCard,
|
|
19758
19875
|
{
|
|
19759
19876
|
tone: "warn",
|
|
@@ -19761,17 +19878,17 @@ function PlanReviseConfirmInner({
|
|
|
19761
19878
|
title: "plan revision proposed",
|
|
19762
19879
|
metaRight: `\u2212${removedCount} +${addedCount} \xB7 ${keptCount} kept`
|
|
19763
19880
|
},
|
|
19764
|
-
/* @__PURE__ */
|
|
19765
|
-
summary ? /* @__PURE__ */
|
|
19766
|
-
/* @__PURE__ */
|
|
19881
|
+
/* @__PURE__ */ React22.createElement(Box17, { marginBottom: 1 }, /* @__PURE__ */ React22.createElement(Text17, null, reason)),
|
|
19882
|
+
summary ? /* @__PURE__ */ React22.createElement(Box17, { marginBottom: 1 }, /* @__PURE__ */ React22.createElement(Text17, { dimColor: true }, `updated summary: ${summary}`)) : null,
|
|
19883
|
+
/* @__PURE__ */ React22.createElement(Box17, { marginBottom: 1, flexDirection: "column" }, rows.map((row3) => {
|
|
19767
19884
|
const risk = riskDots(row3.step.risk);
|
|
19768
19885
|
const prefix = row3.kind === "removed" ? "\u2212" : row3.kind === "added" ? "+" : " ";
|
|
19769
19886
|
const prefixColor = row3.kind === "removed" ? "#f87171" : row3.kind === "added" ? "#4ade80" : "#94a3b8";
|
|
19770
19887
|
const dim = row3.kind === "kept";
|
|
19771
19888
|
const strike = row3.kind === "removed";
|
|
19772
|
-
return /* @__PURE__ */
|
|
19889
|
+
return /* @__PURE__ */ React22.createElement(Box17, { key: `${row3.kind}-${row3.step.id}` }, /* @__PURE__ */ React22.createElement(Text17, { color: prefixColor, bold: true }, `${prefix} `), /* @__PURE__ */ React22.createElement(Text17, { color: risk.color, bold: true, dimColor: dim }, risk.dots), /* @__PURE__ */ React22.createElement(Text17, { dimColor: dim, strikethrough: strike }, ` ${row3.step.id} \xB7 ${row3.step.title}`));
|
|
19773
19890
|
})),
|
|
19774
|
-
/* @__PURE__ */
|
|
19891
|
+
/* @__PURE__ */ React22.createElement(
|
|
19775
19892
|
SingleSelect,
|
|
19776
19893
|
{
|
|
19777
19894
|
initialValue: "accept",
|
|
@@ -19793,22 +19910,22 @@ function PlanReviseConfirmInner({
|
|
|
19793
19910
|
)
|
|
19794
19911
|
);
|
|
19795
19912
|
}
|
|
19796
|
-
var PlanReviseConfirm =
|
|
19913
|
+
var PlanReviseConfirm = React22.memo(PlanReviseConfirmInner);
|
|
19797
19914
|
|
|
19798
19915
|
// src/cli/ui/PlanReviseEditor.tsx
|
|
19799
|
-
import { Box as
|
|
19800
|
-
import
|
|
19916
|
+
import { Box as Box18, Text as Text18 } from "ink";
|
|
19917
|
+
import React23, { useState as useState10 } from "react";
|
|
19801
19918
|
function PlanReviseEditor({
|
|
19802
19919
|
steps,
|
|
19803
19920
|
completedStepIds,
|
|
19804
19921
|
onAccept,
|
|
19805
19922
|
onCancel
|
|
19806
19923
|
}) {
|
|
19807
|
-
const [rows, setRows] =
|
|
19924
|
+
const [rows, setRows] = useState10(
|
|
19808
19925
|
() => steps.map((s) => ({ step: s, done: completedStepIds?.has(s.id) ?? false, skipped: false }))
|
|
19809
19926
|
);
|
|
19810
19927
|
const firstEditableIndex = rows.findIndex((r) => !r.done);
|
|
19811
|
-
const [focus, setFocus] =
|
|
19928
|
+
const [focus, setFocus] = useState10(firstEditableIndex < 0 ? 0 : firstEditableIndex);
|
|
19812
19929
|
useKeystroke((ev) => {
|
|
19813
19930
|
if (ev.paste) return;
|
|
19814
19931
|
if (ev.escape) {
|
|
@@ -19869,7 +19986,7 @@ function PlanReviseEditor({
|
|
|
19869
19986
|
return;
|
|
19870
19987
|
}
|
|
19871
19988
|
});
|
|
19872
|
-
return /* @__PURE__ */
|
|
19989
|
+
return /* @__PURE__ */ React23.createElement(
|
|
19873
19990
|
ApprovalCard,
|
|
19874
19991
|
{
|
|
19875
19992
|
tone: "accent",
|
|
@@ -19878,7 +19995,7 @@ function PlanReviseEditor({
|
|
|
19878
19995
|
metaRight: `${rows.length} steps`,
|
|
19879
19996
|
footerHint: "\u2191\u2193 focus \xB7 space toggle skip \xB7 k/j move \xB7 \u23CE accept \xB7 esc cancel"
|
|
19880
19997
|
},
|
|
19881
|
-
rows.map((r, i) => /* @__PURE__ */
|
|
19998
|
+
rows.map((r, i) => /* @__PURE__ */ React23.createElement(ReviseRow, { key: r.step.id, row: r, index: i, focused: i === focus }))
|
|
19882
19999
|
);
|
|
19883
20000
|
}
|
|
19884
20001
|
function ReviseRow({
|
|
@@ -19889,13 +20006,13 @@ function ReviseRow({
|
|
|
19889
20006
|
const marker = row3.done ? "[\u2713]" : row3.skipped ? "[s]" : focused ? "[ ]" : "[ ]";
|
|
19890
20007
|
const markerColor = row3.done ? TONE.ok : row3.skipped ? FG.faint : focused ? TONE.brand : FG.faint;
|
|
19891
20008
|
const titleColor = row3.done ? FG.sub : row3.skipped ? FG.faint : focused ? FG.strong : FG.sub;
|
|
19892
|
-
const focusGlyph = focused ? /* @__PURE__ */
|
|
19893
|
-
return /* @__PURE__ */
|
|
20009
|
+
const focusGlyph = focused ? /* @__PURE__ */ React23.createElement(Text18, { color: TONE.brand }, "\u25B8 ") : /* @__PURE__ */ React23.createElement(Text18, null, " ");
|
|
20010
|
+
return /* @__PURE__ */ React23.createElement(Box18, null, focusGlyph, /* @__PURE__ */ React23.createElement(Text18, { color: markerColor }, marker), /* @__PURE__ */ React23.createElement(Text18, { color: titleColor, bold: focused, italic: row3.skipped, strikethrough: row3.skipped }, ` ${index + 1}. ${row3.step.title}`), row3.skipped ? /* @__PURE__ */ React23.createElement(Text18, { color: TONE.warn }, " \u2190 skipped") : null);
|
|
19894
20011
|
}
|
|
19895
20012
|
|
|
19896
20013
|
// src/cli/ui/PromptInput.tsx
|
|
19897
|
-
import { Box as
|
|
19898
|
-
import
|
|
20014
|
+
import { Box as Box19, Text as Text19, useStdout as useStdout5 } from "ink";
|
|
20015
|
+
import React24, { useRef as useRef2, useState as useState11 } from "react";
|
|
19899
20016
|
|
|
19900
20017
|
// src/cli/ui/key-normalize.ts
|
|
19901
20018
|
var CSI_TAIL_TO_FLAGS = [
|
|
@@ -19910,7 +20027,13 @@ var CSI_TAIL_TO_FLAGS = [
|
|
|
19910
20027
|
// Forward-delete (the key labelled Delete on most keyboards).
|
|
19911
20028
|
{ tail: "[3~", flags: { delete: true } },
|
|
19912
20029
|
// Shift+Tab — terminal sends `\x1b[Z` rather than tab-with-shift.
|
|
19913
|
-
|
|
20030
|
+
// `[1;2Z` is the modifier-encoded variant some Windows PowerShell
|
|
20031
|
+
// hosts emit; `[27;2;9~` and `[9;2u` cover modifyOtherKeys / Kitty
|
|
20032
|
+
// forms. Issue #373.
|
|
20033
|
+
{ tail: "[Z", flags: { shift: true, tab: true } },
|
|
20034
|
+
{ tail: "[1;2Z", flags: { shift: true, tab: true } },
|
|
20035
|
+
{ tail: "[27;2;9~", flags: { shift: true, tab: true } },
|
|
20036
|
+
{ tail: "[9;2u", flags: { shift: true, tab: true } }
|
|
19914
20037
|
];
|
|
19915
20038
|
function alreadyStructured(flags) {
|
|
19916
20039
|
return Boolean(
|
|
@@ -20330,7 +20453,7 @@ function PromptInput({
|
|
|
20330
20453
|
const inputLineCount = value.length > 0 ? value.split("\n").length : 1;
|
|
20331
20454
|
const reserveMax = Math.min(Math.ceil(inputLineCount / 4) * 4 + 3, 24);
|
|
20332
20455
|
useReserveRows("input", { min: 1, max: reserveMax });
|
|
20333
|
-
const [cursor, setCursor] =
|
|
20456
|
+
const [cursor, setCursor] = useState11(value.length);
|
|
20334
20457
|
const pastesRef = useRef2(/* @__PURE__ */ new Map());
|
|
20335
20458
|
const nextPasteIdRef = useRef2(0);
|
|
20336
20459
|
const lastLocalValueRef = useRef2(value);
|
|
@@ -20408,7 +20531,7 @@ function PromptInput({
|
|
|
20408
20531
|
if (action.chatScrollHandoff === "up") onChatScrollUp?.();
|
|
20409
20532
|
if (action.chatScrollHandoff === "down") onChatScrollDown?.();
|
|
20410
20533
|
}, !disabled);
|
|
20411
|
-
const { stdout: stdout4 } =
|
|
20534
|
+
const { stdout: stdout4 } = useStdout5();
|
|
20412
20535
|
const cols = stdout4?.columns ?? 80;
|
|
20413
20536
|
const promptPrefix = "\u203A ";
|
|
20414
20537
|
const continuationIndent = " ";
|
|
@@ -20421,14 +20544,14 @@ function PromptInput({
|
|
|
20421
20544
|
const { line: cursorLine, col: cursorCol } = lineAndColumn(value, cursor);
|
|
20422
20545
|
const renderItems = collapseLinesForDisplay(lines, cursorLine);
|
|
20423
20546
|
const showHugeBufferHints = lines.length > 20;
|
|
20424
|
-
return /* @__PURE__ */
|
|
20547
|
+
return /* @__PURE__ */ React24.createElement(Box19, { flexDirection: "column", paddingX: 1 }, (() => {
|
|
20425
20548
|
const rows = [];
|
|
20426
20549
|
let firstRowEmitted = false;
|
|
20427
20550
|
for (let renderIdx = 0; renderIdx < renderItems.length; renderIdx++) {
|
|
20428
20551
|
const item = renderItems[renderIdx];
|
|
20429
20552
|
if (item.kind === "skip") {
|
|
20430
20553
|
rows.push(
|
|
20431
|
-
/* @__PURE__ */
|
|
20554
|
+
/* @__PURE__ */ React24.createElement(Box19, { key: `skip-${renderIdx}` }, /* @__PURE__ */ React24.createElement(Text19, { color: FG.faint }, continuationIndent), /* @__PURE__ */ React24.createElement(Text19, { color: FG.faint }, `[\u2026 ${item.linesHidden} line${item.linesHidden === 1 ? "" : "s"} hidden \u2014 full content kept, submitted on Enter \u2026]`))
|
|
20432
20555
|
);
|
|
20433
20556
|
continue;
|
|
20434
20557
|
}
|
|
@@ -20438,7 +20561,7 @@ function PromptInput({
|
|
|
20438
20561
|
const showPlaceholder = i === 0 && value.length === 0;
|
|
20439
20562
|
if (showPlaceholder) {
|
|
20440
20563
|
rows.push(
|
|
20441
|
-
/* @__PURE__ */
|
|
20564
|
+
/* @__PURE__ */ React24.createElement(
|
|
20442
20565
|
PromptLine,
|
|
20443
20566
|
{
|
|
20444
20567
|
key: `ln-${i}-text-0`,
|
|
@@ -20469,7 +20592,7 @@ function PromptInput({
|
|
|
20469
20592
|
if (seg.kind === "paste") {
|
|
20470
20593
|
const cursorOnIt = isCursorLine && cursorCol >= seg.startOffset && cursorCol <= seg.startOffset + 1;
|
|
20471
20594
|
rows.push(
|
|
20472
|
-
/* @__PURE__ */
|
|
20595
|
+
/* @__PURE__ */ React24.createElement(
|
|
20473
20596
|
PasteChipRow,
|
|
20474
20597
|
{
|
|
20475
20598
|
key: `ln-${i}-paste-${segIdx}`,
|
|
@@ -20486,7 +20609,7 @@ function PromptInput({
|
|
|
20486
20609
|
}
|
|
20487
20610
|
const segHasCursor = isCursorLine && cursorCol >= seg.startOffset && cursorCol <= seg.startOffset + seg.text.length;
|
|
20488
20611
|
rows.push(
|
|
20489
|
-
/* @__PURE__ */
|
|
20612
|
+
/* @__PURE__ */ React24.createElement(
|
|
20490
20613
|
PromptLine,
|
|
20491
20614
|
{
|
|
20492
20615
|
key: `ln-${i}-text-${segIdx}`,
|
|
@@ -20511,7 +20634,7 @@ function PromptInput({
|
|
|
20511
20634
|
const isFirst = !firstRowEmitted;
|
|
20512
20635
|
firstRowEmitted = true;
|
|
20513
20636
|
rows.push(
|
|
20514
|
-
/* @__PURE__ */
|
|
20637
|
+
/* @__PURE__ */ React24.createElement(
|
|
20515
20638
|
PromptLine,
|
|
20516
20639
|
{
|
|
20517
20640
|
key: `ln-${i}-empty`,
|
|
@@ -20534,7 +20657,7 @@ function PromptInput({
|
|
|
20534
20657
|
}
|
|
20535
20658
|
}
|
|
20536
20659
|
return rows;
|
|
20537
|
-
})(), showHugeBufferHints && !disabled ? /* @__PURE__ */
|
|
20660
|
+
})(), showHugeBufferHints && !disabled ? /* @__PURE__ */ React24.createElement(Box19, null, /* @__PURE__ */ React24.createElement(Text19, { color: FG.faint }, ` [${lines.length} lines \xB7 PgUp/PgDn jump \xB7 Ctrl+U clear \xB7 Ctrl+W del word]`)) : null, !disabled ? /* @__PURE__ */ React24.createElement(Box19, { marginTop: 1 }, /* @__PURE__ */ React24.createElement(Text19, { color: FG.faint }, " \u23CE send \xB7 shift/alt+\u23CE newline \xB7 \u2191\u2193 history \xB7 esc abort \xB7 ctrl-c quit")) : /* @__PURE__ */ React24.createElement(Box19, { marginTop: 1 }, /* @__PURE__ */ React24.createElement(Text19, { color: FG.faint }, " esc to stop")));
|
|
20538
20661
|
}
|
|
20539
20662
|
function splitLineByPastes(line) {
|
|
20540
20663
|
const out = [];
|
|
@@ -20571,9 +20694,9 @@ function PasteChipRow({
|
|
|
20571
20694
|
const leadColor = isFirst ? accentColor : FG.faint;
|
|
20572
20695
|
const labelText = formatChipLabel(entry, pasteId, visibleCells - 6);
|
|
20573
20696
|
if (active) {
|
|
20574
|
-
return /* @__PURE__ */
|
|
20697
|
+
return /* @__PURE__ */ React24.createElement(Box19, null, /* @__PURE__ */ React24.createElement(Text19, { bold: true, color: leadColor }, lead), /* @__PURE__ */ React24.createElement(Text19, { bold: true, color: accentColor }, "\u25B8 "), /* @__PURE__ */ React24.createElement(Text19, { bold: true, color: "black", backgroundColor: accentColor }, ` ${labelText} `));
|
|
20575
20698
|
}
|
|
20576
|
-
return /* @__PURE__ */
|
|
20699
|
+
return /* @__PURE__ */ React24.createElement(Box19, null, /* @__PURE__ */ React24.createElement(Text19, { bold: true, color: leadColor }, lead), /* @__PURE__ */ React24.createElement(Text19, { color: FG.faint }, " "), /* @__PURE__ */ React24.createElement(Text19, { color: FG.meta }, "\u250C "), /* @__PURE__ */ React24.createElement(Text19, { color: FG.body, backgroundColor: SURFACE.bgElev }, `${labelText} `), /* @__PURE__ */ React24.createElement(Text19, { color: FG.meta }, " \u2510"));
|
|
20577
20700
|
}
|
|
20578
20701
|
function formatChipLabel(entry, pasteId, budget3) {
|
|
20579
20702
|
if (!entry) return `\u{1F4CB} paste #${pasteId + 1} \xB7 (missing)`;
|
|
@@ -20617,10 +20740,10 @@ function PromptLine({
|
|
|
20617
20740
|
disabled
|
|
20618
20741
|
}) {
|
|
20619
20742
|
if (showPlaceholder) {
|
|
20620
|
-
return /* @__PURE__ */
|
|
20743
|
+
return /* @__PURE__ */ React24.createElement(Box19, null, /* @__PURE__ */ React24.createElement(Text19, { bold: true, color: accentColor }, promptPrefix), !disabled ? /* @__PURE__ */ React24.createElement(Text19, { color: accentColor }, cursorVisible ? "\u258C" : " ") : null, /* @__PURE__ */ React24.createElement(Text19, { color: FG.faint }, placeholderText));
|
|
20621
20744
|
}
|
|
20622
20745
|
const viewport = buildViewport(line, isCursorLine ? cursorCol : null, visibleCells, pastes);
|
|
20623
|
-
return /* @__PURE__ */
|
|
20746
|
+
return /* @__PURE__ */ React24.createElement(Box19, null, isFirst ? /* @__PURE__ */ React24.createElement(Text19, { bold: true, color: accentColor }, promptPrefix) : /* @__PURE__ */ React24.createElement(Text19, { color: FG.faint }, continuationIndent), viewport.hiddenLeft ? /* @__PURE__ */ React24.createElement(Text19, { color: FG.faint }, "\u2039") : null, /* @__PURE__ */ React24.createElement(
|
|
20624
20747
|
ViewportContent,
|
|
20625
20748
|
{
|
|
20626
20749
|
segments: viewport.segments,
|
|
@@ -20628,7 +20751,7 @@ function PromptLine({
|
|
|
20628
20751
|
accentColor,
|
|
20629
20752
|
cursorVisible
|
|
20630
20753
|
}
|
|
20631
|
-
), viewport.hiddenRight ? /* @__PURE__ */
|
|
20754
|
+
), viewport.hiddenRight ? /* @__PURE__ */ React24.createElement(Text19, { color: FG.faint }, "\u203A") : null);
|
|
20632
20755
|
}
|
|
20633
20756
|
function ViewportContent({
|
|
20634
20757
|
segments,
|
|
@@ -20637,7 +20760,7 @@ function ViewportContent({
|
|
|
20637
20760
|
cursorVisible
|
|
20638
20761
|
}) {
|
|
20639
20762
|
if (cursorCell === null) {
|
|
20640
|
-
return /* @__PURE__ */
|
|
20763
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, segments.map((seg, i) => renderSegment(seg, i, false)));
|
|
20641
20764
|
}
|
|
20642
20765
|
const out = [];
|
|
20643
20766
|
let cells = 0;
|
|
@@ -20656,8 +20779,8 @@ function ViewportContent({
|
|
|
20656
20779
|
}
|
|
20657
20780
|
if (seg.kind === "paste") {
|
|
20658
20781
|
out.push(
|
|
20659
|
-
/* @__PURE__ */
|
|
20660
|
-
|
|
20782
|
+
/* @__PURE__ */ React24.createElement(
|
|
20783
|
+
Text19,
|
|
20661
20784
|
{
|
|
20662
20785
|
key: `p-${i}-cursor`,
|
|
20663
20786
|
color: FG.body,
|
|
@@ -20674,29 +20797,29 @@ function ViewportContent({
|
|
|
20674
20797
|
const offsetIntoSeg = cursorCell - cells;
|
|
20675
20798
|
const split = splitTextByCells(seg.text, offsetIntoSeg);
|
|
20676
20799
|
if (split.before.length > 0) {
|
|
20677
|
-
out.push(/* @__PURE__ */
|
|
20800
|
+
out.push(/* @__PURE__ */ React24.createElement(Text19, { key: `t-${i}-b` }, split.before));
|
|
20678
20801
|
}
|
|
20679
20802
|
if (split.atCursor.length > 0) {
|
|
20680
20803
|
out.push(
|
|
20681
|
-
/* @__PURE__ */
|
|
20804
|
+
/* @__PURE__ */ React24.createElement(Text19, { key: `t-${i}-c`, inverse: cursorVisible, color: accentColor }, split.atCursor)
|
|
20682
20805
|
);
|
|
20683
20806
|
} else {
|
|
20684
20807
|
out.push(
|
|
20685
|
-
/* @__PURE__ */
|
|
20808
|
+
/* @__PURE__ */ React24.createElement(Text19, { key: `t-${i}-c-eol`, color: accentColor }, cursorVisible ? "\u258C" : " ")
|
|
20686
20809
|
);
|
|
20687
20810
|
}
|
|
20688
20811
|
if (split.after.length > 0) {
|
|
20689
|
-
out.push(/* @__PURE__ */
|
|
20812
|
+
out.push(/* @__PURE__ */ React24.createElement(Text19, { key: `t-${i}-a` }, split.after));
|
|
20690
20813
|
}
|
|
20691
20814
|
placed = true;
|
|
20692
20815
|
cells += segCells;
|
|
20693
20816
|
}
|
|
20694
20817
|
if (!placed) {
|
|
20695
20818
|
out.push(
|
|
20696
|
-
/* @__PURE__ */
|
|
20819
|
+
/* @__PURE__ */ React24.createElement(Text19, { key: "cursor-eol", color: accentColor }, cursorVisible ? "\u258C" : " ")
|
|
20697
20820
|
);
|
|
20698
20821
|
}
|
|
20699
|
-
return /* @__PURE__ */
|
|
20822
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, out);
|
|
20700
20823
|
}
|
|
20701
20824
|
function segmentCells(seg) {
|
|
20702
20825
|
if (seg.kind === "paste") return seg.label.length;
|
|
@@ -20736,9 +20859,9 @@ function charCellsForText(ch) {
|
|
|
20736
20859
|
}
|
|
20737
20860
|
function renderSegment(seg, key, _inverse) {
|
|
20738
20861
|
if (seg.kind === "text") {
|
|
20739
|
-
return /* @__PURE__ */
|
|
20862
|
+
return /* @__PURE__ */ React24.createElement(Text19, { key: `s-${key}` }, seg.text);
|
|
20740
20863
|
}
|
|
20741
|
-
return /* @__PURE__ */
|
|
20864
|
+
return /* @__PURE__ */ React24.createElement(Text19, { key: `s-${key}`, backgroundColor: SURFACE.bgElev, color: FG.body }, seg.label);
|
|
20742
20865
|
}
|
|
20743
20866
|
var COLLAPSE_THRESHOLD = 20;
|
|
20744
20867
|
var COLLAPSE_HEAD_LINES = 3;
|
|
@@ -20765,20 +20888,20 @@ function collapseLinesForDisplay(lines, cursorLine) {
|
|
|
20765
20888
|
}
|
|
20766
20889
|
|
|
20767
20890
|
// src/cli/ui/SessionPicker.tsx
|
|
20768
|
-
import { Box as
|
|
20769
|
-
import
|
|
20770
|
-
var
|
|
20891
|
+
import { Box as Box20, Text as Text20, useStdout as useStdout6 } from "ink";
|
|
20892
|
+
import React25, { useState as useState12 } from "react";
|
|
20893
|
+
var PAGE_MARGIN2 = 6;
|
|
20771
20894
|
function SessionPicker({
|
|
20772
20895
|
sessions: sessions2,
|
|
20773
20896
|
workspace: workspace2,
|
|
20774
20897
|
onChoose,
|
|
20775
20898
|
walletCurrency
|
|
20776
20899
|
}) {
|
|
20777
|
-
const [focus, setFocus] =
|
|
20778
|
-
const [renaming, setRenaming] =
|
|
20779
|
-
const { stdout: stdout4 } =
|
|
20900
|
+
const [focus, setFocus] = useState12(0);
|
|
20901
|
+
const [renaming, setRenaming] = useState12(null);
|
|
20902
|
+
const { stdout: stdout4 } = useStdout6();
|
|
20780
20903
|
const rows = stdout4?.rows ?? 40;
|
|
20781
|
-
const visibleCount = Math.max(3, rows -
|
|
20904
|
+
const visibleCount = Math.max(3, rows - PAGE_MARGIN2);
|
|
20782
20905
|
useKeystroke((ev) => {
|
|
20783
20906
|
if (ev.paste) {
|
|
20784
20907
|
if (renaming) setRenaming({ ...renaming, buf: renaming.buf + ev.input });
|
|
@@ -20829,7 +20952,7 @@ function SessionPicker({
|
|
|
20829
20952
|
const end = Math.min(sessions2.length, start + visibleCount);
|
|
20830
20953
|
const shown = sessions2.slice(start, end);
|
|
20831
20954
|
const hiddenBelow = sessions2.length - end;
|
|
20832
|
-
return /* @__PURE__ */
|
|
20955
|
+
return /* @__PURE__ */ React25.createElement(Box20, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React25.createElement(Box20, null, /* @__PURE__ */ React25.createElement(Text20, { bold: true, color: TONE.brand }, " \u25C8 REASONIX \xB7 pick a session "), /* @__PURE__ */ React25.createElement(Text20, { color: FG.meta }, ` \xB7 ${workspace2}`)), /* @__PURE__ */ React25.createElement(Box20, { height: 1 }), sessions2.length === 0 ? /* @__PURE__ */ React25.createElement(Box20, null, /* @__PURE__ */ React25.createElement(Text20, { color: FG.faint }, " no saved sessions in this workspace yet \u2014 press "), /* @__PURE__ */ React25.createElement(Text20, { bold: true, color: TONE.brand }, "\u23CE"), /* @__PURE__ */ React25.createElement(Text20, { color: FG.faint }, " to start a new one")) : shown.map((s, i) => /* @__PURE__ */ React25.createElement(
|
|
20833
20956
|
SessionRow,
|
|
20834
20957
|
{
|
|
20835
20958
|
key: s.name,
|
|
@@ -20837,7 +20960,7 @@ function SessionPicker({
|
|
|
20837
20960
|
focused: start + i === focus,
|
|
20838
20961
|
walletCurrency
|
|
20839
20962
|
}
|
|
20840
|
-
)), hiddenBelow > 0 ? /* @__PURE__ */
|
|
20963
|
+
)), hiddenBelow > 0 ? /* @__PURE__ */ React25.createElement(Box20, null, /* @__PURE__ */ React25.createElement(Text20, { color: FG.faint }, ` \u2026 ${hiddenBelow} more`)) : null, renaming ? /* @__PURE__ */ React25.createElement(Box20, { marginTop: 1 }, /* @__PURE__ */ React25.createElement(Text20, { color: FG.faint }, ` rename "${renaming.from}" \u2192 `), /* @__PURE__ */ React25.createElement(Text20, { bold: true, color: TONE.brand }, renaming.buf), /* @__PURE__ */ React25.createElement(Text20, { backgroundColor: TONE.brand, color: "black" }, " ")) : null, /* @__PURE__ */ React25.createElement(Box20, { marginTop: 1 }, /* @__PURE__ */ React25.createElement(Text20, { color: FG.faint }, renaming ? " \u23CE confirm rename \xB7 esc cancel" : sessions2.length === 0 ? " \u23CE new session \xB7 esc quit" : " \u2191\u2193 pick \xB7 \u23CE open \xB7 [n] new \xB7 [d] delete \xB7 [r] rename \xB7 esc quit")));
|
|
20841
20964
|
}
|
|
20842
20965
|
function SessionRow({
|
|
20843
20966
|
info,
|
|
@@ -20850,7 +20973,7 @@ function SessionRow({
|
|
|
20850
20973
|
const currency = walletCurrency ?? info.meta.balanceCurrency;
|
|
20851
20974
|
const costLabel = info.meta.totalCostUsd !== void 0 ? formatCost(info.meta.totalCostUsd, currency, 2) : "";
|
|
20852
20975
|
const time = relativeTime2(info.mtime);
|
|
20853
|
-
return /* @__PURE__ */
|
|
20976
|
+
return /* @__PURE__ */ React25.createElement(Box20, null, /* @__PURE__ */ React25.createElement(Text20, { color: focused ? TONE.brand : FG.faint }, focused ? " \u25B8 " : " "), /* @__PURE__ */ React25.createElement(Text20, { bold: focused, color: focused ? FG.strong : FG.sub }, info.name.padEnd(12)), /* @__PURE__ */ React25.createElement(Text20, { color: FG.meta }, ` \xB7 ${branch2.padEnd(8)} \xB7 `), /* @__PURE__ */ React25.createElement(Text20, { color: focused ? FG.body : FG.sub }, truncate2(summary, 40)), /* @__PURE__ */ React25.createElement(Box20, { flexGrow: 1 }), /* @__PURE__ */ React25.createElement(Text20, { color: FG.faint }, `${time.padStart(11)} `), /* @__PURE__ */ React25.createElement(Text20, { color: FG.faint }, `${turns} turns`), costLabel ? /* @__PURE__ */ React25.createElement(Text20, { color: FG.faint }, ` \xB7 ${costLabel}`) : null);
|
|
20854
20977
|
}
|
|
20855
20978
|
function truncate2(s, max) {
|
|
20856
20979
|
if (s.length <= max) return s;
|
|
@@ -20870,15 +20993,15 @@ function relativeTime2(date) {
|
|
|
20870
20993
|
}
|
|
20871
20994
|
|
|
20872
20995
|
// src/cli/ui/ShellConfirm.tsx
|
|
20873
|
-
import { Box as
|
|
20874
|
-
import
|
|
20996
|
+
import { Box as Box21, Text as Text21 } from "ink";
|
|
20997
|
+
import React26, { useState as useState13 } from "react";
|
|
20875
20998
|
function ShellConfirm({ command, allowPrefix, kind, onChoose }) {
|
|
20876
20999
|
useReserveRows("modal", { min: 8, max: 14 });
|
|
20877
21000
|
const isBackground = kind === "run_background";
|
|
20878
21001
|
const subtitle = isBackground ? "long-running process \u2014 keeps running after approval, /kill to stop" : "model wants to run a shell command";
|
|
20879
|
-
const [phase, setPhase] =
|
|
21002
|
+
const [phase, setPhase] = useState13("pick");
|
|
20880
21003
|
if (phase === "deny") {
|
|
20881
|
-
return /* @__PURE__ */
|
|
21004
|
+
return /* @__PURE__ */ React26.createElement(
|
|
20882
21005
|
ApprovalCard,
|
|
20883
21006
|
{
|
|
20884
21007
|
tone: "error",
|
|
@@ -20887,7 +21010,7 @@ function ShellConfirm({ command, allowPrefix, kind, onChoose }) {
|
|
|
20887
21010
|
metaRight: "optional",
|
|
20888
21011
|
footerHint: "type context \xB7 \u23CE submit with reason \xB7 esc skip (deny without reason)"
|
|
20889
21012
|
},
|
|
20890
|
-
/* @__PURE__ */
|
|
21013
|
+
/* @__PURE__ */ React26.createElement(
|
|
20891
21014
|
DenyContextInput,
|
|
20892
21015
|
{
|
|
20893
21016
|
onSubmit: (context2) => onChoose("deny", context2 || void 0),
|
|
@@ -20896,7 +21019,7 @@ function ShellConfirm({ command, allowPrefix, kind, onChoose }) {
|
|
|
20896
21019
|
)
|
|
20897
21020
|
);
|
|
20898
21021
|
}
|
|
20899
|
-
return /* @__PURE__ */
|
|
21022
|
+
return /* @__PURE__ */ React26.createElement(
|
|
20900
21023
|
ApprovalCard,
|
|
20901
21024
|
{
|
|
20902
21025
|
tone: "warn",
|
|
@@ -20905,9 +21028,9 @@ function ShellConfirm({ command, allowPrefix, kind, onChoose }) {
|
|
|
20905
21028
|
metaRight: "awaiting",
|
|
20906
21029
|
footerHint: "\u2191\u2193 pick \xB7 \u23CE confirm \xB7 Tab add context \xB7 esc cancel"
|
|
20907
21030
|
},
|
|
20908
|
-
/* @__PURE__ */
|
|
20909
|
-
/* @__PURE__ */
|
|
20910
|
-
/* @__PURE__ */
|
|
21031
|
+
/* @__PURE__ */ React26.createElement(Box21, { marginBottom: 1 }, /* @__PURE__ */ React26.createElement(Text21, { color: FG.faint }, subtitle)),
|
|
21032
|
+
/* @__PURE__ */ React26.createElement(Box21, { marginBottom: 1 }, /* @__PURE__ */ React26.createElement(Text21, { bold: true, color: TONE.err }, "$ "), /* @__PURE__ */ React26.createElement(Text21, { bold: true, color: FG.strong }, command)),
|
|
21033
|
+
/* @__PURE__ */ React26.createElement(
|
|
20911
21034
|
SingleSelect,
|
|
20912
21035
|
{
|
|
20913
21036
|
initialValue: "run_once",
|
|
@@ -20970,8 +21093,8 @@ function derivePrefix(command) {
|
|
|
20970
21093
|
}
|
|
20971
21094
|
|
|
20972
21095
|
// src/cli/ui/SlashArgPicker.tsx
|
|
20973
|
-
import { Box as
|
|
20974
|
-
import
|
|
21096
|
+
import { Box as Box22, Text as Text22 } from "ink";
|
|
21097
|
+
import React27 from "react";
|
|
20975
21098
|
function SlashArgPicker({
|
|
20976
21099
|
matches,
|
|
20977
21100
|
selectedIndex,
|
|
@@ -20979,13 +21102,13 @@ function SlashArgPicker({
|
|
|
20979
21102
|
kind,
|
|
20980
21103
|
partial
|
|
20981
21104
|
}) {
|
|
20982
|
-
const headerRow = /* @__PURE__ */
|
|
21105
|
+
const headerRow = /* @__PURE__ */ React27.createElement(Box22, null, /* @__PURE__ */ React27.createElement(Text22, { color: COLOR.accent, bold: true }, "/ "), /* @__PURE__ */ React27.createElement(Text22, { color: COLOR.accent, bold: true }, `/${spec.cmd}`), spec.argsHint ? /* @__PURE__ */ React27.createElement(Text22, { dimColor: true }, ` ${spec.argsHint}`) : null, /* @__PURE__ */ React27.createElement(Text22, { dimColor: true }, ` ${spec.summary}`));
|
|
20983
21106
|
if (kind === "hint") {
|
|
20984
|
-
return /* @__PURE__ */
|
|
21107
|
+
return /* @__PURE__ */ React27.createElement(Box22, { paddingX: 1, marginTop: 1 }, headerRow);
|
|
20985
21108
|
}
|
|
20986
21109
|
if (matches === null) return null;
|
|
20987
21110
|
if (matches.length === 0) {
|
|
20988
|
-
return /* @__PURE__ */
|
|
21111
|
+
return /* @__PURE__ */ React27.createElement(Box22, { flexDirection: "column", paddingX: 1, marginTop: 1 }, headerRow, /* @__PURE__ */ React27.createElement(Box22, null, /* @__PURE__ */ React27.createElement(Text22, { color: COLOR.warn, bold: true }, GLYPH.warn), /* @__PURE__ */ React27.createElement(Text22, { color: COLOR.warn }, ` no match for "${partial}"`), /* @__PURE__ */ React27.createElement(Text22, { dimColor: true }, " \u2014 keep typing, or Backspace to edit")));
|
|
20989
21112
|
}
|
|
20990
21113
|
const MAX = 8;
|
|
20991
21114
|
const total = matches.length;
|
|
@@ -20993,22 +21116,22 @@ function SlashArgPicker({
|
|
|
20993
21116
|
const shown = matches.slice(windowStart, windowStart + MAX);
|
|
20994
21117
|
const hiddenAbove = windowStart;
|
|
20995
21118
|
const hiddenBelow = total - windowStart - shown.length;
|
|
20996
|
-
return /* @__PURE__ */
|
|
21119
|
+
return /* @__PURE__ */ React27.createElement(Box22, { flexDirection: "column", paddingX: 1, marginTop: 1 }, headerRow, hiddenAbove > 0 ? /* @__PURE__ */ React27.createElement(Text22, { dimColor: true }, ` \u2191 ${hiddenAbove} above`) : null, shown.map((value, i) => /* @__PURE__ */ React27.createElement(ArgRow, { key: value, value, isSelected: windowStart + i === selectedIndex })), hiddenBelow > 0 ? /* @__PURE__ */ React27.createElement(Text22, { dimColor: true }, ` \u2193 ${hiddenBelow} below`) : null, /* @__PURE__ */ React27.createElement(Box22, { marginTop: 0 }, /* @__PURE__ */ React27.createElement(Text22, { dimColor: true }, " \u2191\u2193 navigate \xB7 Tab / \u23CE pick \xB7 esc cancel")));
|
|
20997
21120
|
}
|
|
20998
21121
|
function ArgRow({ value, isSelected }) {
|
|
20999
|
-
return /* @__PURE__ */
|
|
21122
|
+
return /* @__PURE__ */ React27.createElement(Box22, null, /* @__PURE__ */ React27.createElement(Text22, { color: isSelected ? COLOR.primary : COLOR.info, bold: isSelected }, isSelected ? `${GLYPH.cur} ` : " "), /* @__PURE__ */ React27.createElement(Text22, { color: isSelected ? COLOR.user : COLOR.info, bold: isSelected, dimColor: !isSelected }, value));
|
|
21000
21123
|
}
|
|
21001
21124
|
|
|
21002
21125
|
// src/cli/ui/SlashSuggestions.tsx
|
|
21003
|
-
import { Box as
|
|
21004
|
-
import
|
|
21126
|
+
import { Box as Box23, Text as Text23 } from "ink";
|
|
21127
|
+
import React28 from "react";
|
|
21005
21128
|
function SlashSuggestions({
|
|
21006
21129
|
matches,
|
|
21007
21130
|
selectedIndex
|
|
21008
21131
|
}) {
|
|
21009
21132
|
if (matches === null) return null;
|
|
21010
21133
|
if (matches.length === 0) {
|
|
21011
|
-
return /* @__PURE__ */
|
|
21134
|
+
return /* @__PURE__ */ React28.createElement(Box23, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React28.createElement(Text23, { color: COLOR.warn, bold: true }, GLYPH.warn), /* @__PURE__ */ React28.createElement(Text23, null, " "), /* @__PURE__ */ React28.createElement(Text23, { color: COLOR.warn }, "no slash command matches that prefix"), /* @__PURE__ */ React28.createElement(Text23, { dimColor: true }, " \u2014 Backspace to edit, or /help for the full list"));
|
|
21012
21135
|
}
|
|
21013
21136
|
const MAX = 8;
|
|
21014
21137
|
const total = matches.length;
|
|
@@ -21016,7 +21139,7 @@ function SlashSuggestions({
|
|
|
21016
21139
|
const shown = matches.slice(windowStart, windowStart + MAX);
|
|
21017
21140
|
const hiddenAbove = windowStart;
|
|
21018
21141
|
const hiddenBelow = total - windowStart - shown.length;
|
|
21019
|
-
return /* @__PURE__ */
|
|
21142
|
+
return /* @__PURE__ */ React28.createElement(Box23, { flexDirection: "column", paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React28.createElement(Box23, null, /* @__PURE__ */ React28.createElement(Text23, { color: COLOR.accent, bold: true }, "/ "), /* @__PURE__ */ React28.createElement(Text23, { dimColor: true }, `${total} command${total === 1 ? "" : "s"}`), hiddenAbove > 0 ? /* @__PURE__ */ React28.createElement(Text23, { dimColor: true }, ` \u2191 ${hiddenAbove} above`) : null), shown.map((spec, i) => /* @__PURE__ */ React28.createElement(SuggestionRow, { key: spec.cmd, spec, isSelected: windowStart + i === selectedIndex })), hiddenBelow > 0 ? /* @__PURE__ */ React28.createElement(Text23, { dimColor: true }, ` \u2193 ${hiddenBelow} below`) : null, /* @__PURE__ */ React28.createElement(Box23, { marginTop: 0 }, /* @__PURE__ */ React28.createElement(Text23, { dimColor: true }, " \u2191\u2193 navigate \xB7 Tab / \u23CE pick \xB7 esc cancel")));
|
|
21020
21143
|
}
|
|
21021
21144
|
function SuggestionRow({ spec, isSelected }) {
|
|
21022
21145
|
const name = `/${spec.cmd}`;
|
|
@@ -21025,22 +21148,23 @@ function SuggestionRow({ spec, isSelected }) {
|
|
|
21025
21148
|
const translated = t(key);
|
|
21026
21149
|
const summary = translated === key ? spec.summary : translated;
|
|
21027
21150
|
const aliasHint = spec.aliases?.length ? ` \xB7 /${spec.aliases.join(" /")}` : "";
|
|
21028
|
-
return /* @__PURE__ */
|
|
21151
|
+
return /* @__PURE__ */ React28.createElement(Box23, null, /* @__PURE__ */ React28.createElement(Text23, { color: isSelected ? COLOR.primary : COLOR.info, bold: isSelected }, isSelected ? `${GLYPH.cur} ` : " "), /* @__PURE__ */ React28.createElement(Text23, { color: COLOR.accent, bold: isSelected }, name.padEnd(14)), /* @__PURE__ */ React28.createElement(Text23, { dimColor: true }, argsSuffix.padEnd(14)), /* @__PURE__ */ React28.createElement(Text23, null, " "), /* @__PURE__ */ React28.createElement(Text23, { color: isSelected ? COLOR.user : COLOR.info, dimColor: !isSelected }, summary), aliasHint ? /* @__PURE__ */ React28.createElement(Text23, { dimColor: true }, aliasHint) : null);
|
|
21029
21152
|
}
|
|
21030
21153
|
|
|
21031
21154
|
// src/cli/ui/WelcomeBanner.tsx
|
|
21032
|
-
import { Box as
|
|
21033
|
-
import
|
|
21155
|
+
import { Box as Box24, Text as Text24 } from "ink";
|
|
21156
|
+
import React29 from "react";
|
|
21034
21157
|
var HINTS = ["/help", "/init", "/memory", "/cost"];
|
|
21035
21158
|
function WelcomeBanner({
|
|
21036
21159
|
inCodeMode,
|
|
21160
|
+
workspaceRoot,
|
|
21037
21161
|
dashboardUrl
|
|
21038
21162
|
}) {
|
|
21039
21163
|
const tagline = inCodeMode ? t("ui.taglineCode") : t("ui.taglineChat");
|
|
21040
21164
|
const taglineSub = t("ui.taglineSub");
|
|
21041
21165
|
const startTextRaw = t("ui.startSessionHint");
|
|
21042
|
-
return /* @__PURE__ */
|
|
21043
|
-
|
|
21166
|
+
return /* @__PURE__ */ React29.createElement(Box24, { flexDirection: "column", alignItems: "center", marginY: 1 }, /* @__PURE__ */ React29.createElement(
|
|
21167
|
+
Box24,
|
|
21044
21168
|
{
|
|
21045
21169
|
flexDirection: "column",
|
|
21046
21170
|
alignItems: "center",
|
|
@@ -21049,9 +21173,9 @@ function WelcomeBanner({
|
|
|
21049
21173
|
paddingX: 4,
|
|
21050
21174
|
paddingY: 1
|
|
21051
21175
|
},
|
|
21052
|
-
/* @__PURE__ */
|
|
21053
|
-
/* @__PURE__ */
|
|
21054
|
-
), /* @__PURE__ */
|
|
21176
|
+
/* @__PURE__ */ React29.createElement(Box24, { flexDirection: "row", gap: 2 }, /* @__PURE__ */ React29.createElement(Text24, { color: TONE.brand, bold: true }, "REASONIX"), /* @__PURE__ */ React29.createElement(Text24, { color: FG.faint }, "\xD7"), /* @__PURE__ */ React29.createElement(Box24, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React29.createElement(Text24, null, "\u{1F40B}"), /* @__PURE__ */ React29.createElement(Text24, { color: TONE.accent, bold: true }, "DeepSeek"))),
|
|
21177
|
+
/* @__PURE__ */ React29.createElement(Box24, { marginTop: 1, flexDirection: "column", alignItems: "center" }, /* @__PURE__ */ React29.createElement(Text24, { color: FG.body }, tagline), /* @__PURE__ */ React29.createElement(Text24, { color: FG.meta }, taglineSub))
|
|
21178
|
+
), /* @__PURE__ */ React29.createElement(Box24, { marginTop: 1 }, /* @__PURE__ */ React29.createElement(Text24, { color: FG.sub }, startTextRaw)), /* @__PURE__ */ React29.createElement(Box24, { marginTop: 1, flexDirection: "row", gap: 3 }, HINTS.map((cmd) => /* @__PURE__ */ React29.createElement(Text24, { key: cmd, color: FG.meta }, cmd))), inCodeMode && workspaceRoot ? /* @__PURE__ */ React29.createElement(Box24, { marginTop: 1, flexDirection: "row", gap: 1 }, /* @__PURE__ */ React29.createElement(Text24, { color: TONE.brand }, "\u25B8 workspace"), /* @__PURE__ */ React29.createElement(Text24, { color: FG.faint }, "\xB7"), /* @__PURE__ */ React29.createElement(Text24, { color: FG.body }, workspaceRoot), /* @__PURE__ */ React29.createElement(Text24, { color: FG.faint }, " (relaunch with --dir <path> to switch)")) : null, dashboardUrl ? /* @__PURE__ */ React29.createElement(Box24, { marginTop: 1, flexDirection: "row", gap: 1 }, /* @__PURE__ */ React29.createElement(Text24, { color: TONE.brand, bold: true }, "\u25B8 web"), /* @__PURE__ */ React29.createElement(Text24, { color: FG.faint }, "\xB7"), /* @__PURE__ */ React29.createElement(Text24, { color: TONE.accent }, dashboardUrl)) : null);
|
|
21055
21179
|
}
|
|
21056
21180
|
|
|
21057
21181
|
// src/cli/ui/bang.ts
|
|
@@ -21437,12 +21561,12 @@ function useAgentSession({
|
|
|
21437
21561
|
}
|
|
21438
21562
|
|
|
21439
21563
|
// src/cli/ui/hooks/useChatScroll.ts
|
|
21440
|
-
import { useCallback as useCallback2, useEffect as useEffect4, useState as
|
|
21564
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useState as useState14 } from "react";
|
|
21441
21565
|
var SCROLL_PAGE_ROWS = 3;
|
|
21442
21566
|
function useChatScroll() {
|
|
21443
|
-
const [scrollRows, setScrollRows] =
|
|
21444
|
-
const [pinned, setPinned] =
|
|
21445
|
-
const [maxScroll, setMaxScrollState] =
|
|
21567
|
+
const [scrollRows, setScrollRows] = useState14(0);
|
|
21568
|
+
const [pinned, setPinned] = useState14(true);
|
|
21569
|
+
const [maxScroll, setMaxScrollState] = useState14(0);
|
|
21446
21570
|
useEffect4(() => {
|
|
21447
21571
|
if (pinned) setScrollRows(maxScroll);
|
|
21448
21572
|
}, [pinned, maxScroll]);
|
|
@@ -21545,10 +21669,10 @@ function useInputRecall(setInput) {
|
|
|
21545
21669
|
}
|
|
21546
21670
|
|
|
21547
21671
|
// src/cli/ui/hooks/useLoopMode.ts
|
|
21548
|
-
import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef4, useState as
|
|
21672
|
+
import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef4, useState as useState15 } from "react";
|
|
21549
21673
|
function useLoopMode(opts) {
|
|
21550
21674
|
const { log, busyRef, handleSubmitRef } = opts;
|
|
21551
|
-
const [activeLoop, setActiveLoop] =
|
|
21675
|
+
const [activeLoop, setActiveLoop] = useState15(null);
|
|
21552
21676
|
const activeLoopRef = useRef4(null);
|
|
21553
21677
|
const loopTimerRef = useRef4(null);
|
|
21554
21678
|
const loopFiringRef = useRef4(false);
|
|
@@ -21651,7 +21775,7 @@ function useQuit(transcriptRef) {
|
|
|
21651
21775
|
import { useMemo as useMemo5 } from "react";
|
|
21652
21776
|
|
|
21653
21777
|
// src/cli/ui/state/provider.tsx
|
|
21654
|
-
import
|
|
21778
|
+
import React30 from "react";
|
|
21655
21779
|
|
|
21656
21780
|
// src/cli/ui/state/reducer.ts
|
|
21657
21781
|
function reduce(state, event) {
|
|
@@ -21741,6 +21865,8 @@ function reduce(state, event) {
|
|
|
21741
21865
|
return { ...state, lang: event.lang };
|
|
21742
21866
|
case "session.update":
|
|
21743
21867
|
return { ...state, status: { ...state.status, ...event.patch } };
|
|
21868
|
+
case "session.model.change":
|
|
21869
|
+
return state.session.model === event.model ? state : { ...state, session: { ...state.session, model: event.model } };
|
|
21744
21870
|
case "focus.move":
|
|
21745
21871
|
return {
|
|
21746
21872
|
...state,
|
|
@@ -22030,26 +22156,26 @@ function createStore(session, initialCards) {
|
|
|
22030
22156
|
}
|
|
22031
22157
|
|
|
22032
22158
|
// src/cli/ui/state/provider.tsx
|
|
22033
|
-
var StoreCtx =
|
|
22159
|
+
var StoreCtx = React30.createContext(null);
|
|
22034
22160
|
function AgentStoreProvider({
|
|
22035
22161
|
session,
|
|
22036
22162
|
initialCards,
|
|
22037
22163
|
children
|
|
22038
22164
|
}) {
|
|
22039
|
-
const initialCardsRef =
|
|
22040
|
-
const store =
|
|
22041
|
-
return /* @__PURE__ */
|
|
22165
|
+
const initialCardsRef = React30.useRef(initialCards);
|
|
22166
|
+
const store = React30.useMemo(() => createStore(session, initialCardsRef.current), [session]);
|
|
22167
|
+
return /* @__PURE__ */ React30.createElement(StoreCtx.Provider, { value: store }, children);
|
|
22042
22168
|
}
|
|
22043
22169
|
function useAgentStore() {
|
|
22044
|
-
const store =
|
|
22170
|
+
const store = React30.useContext(StoreCtx);
|
|
22045
22171
|
if (!store) throw new Error("useAgentStore must be used inside AgentStoreProvider");
|
|
22046
22172
|
return store;
|
|
22047
22173
|
}
|
|
22048
22174
|
function useAgentState(selector) {
|
|
22049
22175
|
const store = useAgentStore();
|
|
22050
|
-
const subscribe =
|
|
22051
|
-
const getSnapshot =
|
|
22052
|
-
return
|
|
22176
|
+
const subscribe = React30.useCallback((cb) => store.subscribe(cb), [store]);
|
|
22177
|
+
const getSnapshot = React30.useCallback(() => selector(store.getState()), [store, selector]);
|
|
22178
|
+
return React30.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
22053
22179
|
}
|
|
22054
22180
|
function useDispatch() {
|
|
22055
22181
|
return useAgentStore().dispatch;
|
|
@@ -22289,21 +22415,21 @@ function useTranscriptWriter(transcriptRef, model2, prefixHash) {
|
|
|
22289
22415
|
}
|
|
22290
22416
|
|
|
22291
22417
|
// src/cli/ui/layout/CardStream.tsx
|
|
22292
|
-
import { Box as
|
|
22293
|
-
import
|
|
22418
|
+
import { Box as Box44, Text as Text46, useBoxMetrics } from "ink";
|
|
22419
|
+
import React54, { useEffect as useEffect7, useRef as useRef5 } from "react";
|
|
22294
22420
|
|
|
22295
22421
|
// src/cli/ui/cards/CardRenderer.tsx
|
|
22296
|
-
import { Box as
|
|
22297
|
-
import
|
|
22422
|
+
import { Box as Box43, Text as Text45 } from "ink";
|
|
22423
|
+
import React53 from "react";
|
|
22298
22424
|
|
|
22299
22425
|
// src/cli/ui/cards/BranchCard.tsx
|
|
22300
|
-
import { Box as
|
|
22301
|
-
import
|
|
22426
|
+
import { Box as Box27, Text as Text26 } from "ink";
|
|
22427
|
+
import React33 from "react";
|
|
22302
22428
|
|
|
22303
22429
|
// src/cli/ui/primitives/Card.tsx
|
|
22304
|
-
import { Box as
|
|
22305
|
-
import
|
|
22306
|
-
var ActiveCardContext =
|
|
22430
|
+
import { Box as Box25 } from "ink";
|
|
22431
|
+
import React31, { useContext as useContext4 } from "react";
|
|
22432
|
+
var ActiveCardContext = React31.createContext(true);
|
|
22307
22433
|
var STRIPE_BORDER = {
|
|
22308
22434
|
topLeft: " ",
|
|
22309
22435
|
top: " ",
|
|
@@ -22317,10 +22443,10 @@ var STRIPE_BORDER = {
|
|
|
22317
22443
|
function Card({ tone, children }) {
|
|
22318
22444
|
const active = useContext4(ActiveCardContext);
|
|
22319
22445
|
if (!active) {
|
|
22320
|
-
return /* @__PURE__ */
|
|
22446
|
+
return /* @__PURE__ */ React31.createElement(Box25, { flexDirection: "column", marginTop: 1 }, children);
|
|
22321
22447
|
}
|
|
22322
|
-
return /* @__PURE__ */
|
|
22323
|
-
|
|
22448
|
+
return /* @__PURE__ */ React31.createElement(
|
|
22449
|
+
Box25,
|
|
22324
22450
|
{
|
|
22325
22451
|
flexDirection: "column",
|
|
22326
22452
|
borderStyle: STRIPE_BORDER,
|
|
@@ -22337,8 +22463,8 @@ function Card({ tone, children }) {
|
|
|
22337
22463
|
}
|
|
22338
22464
|
|
|
22339
22465
|
// src/cli/ui/primitives/CardHeader.tsx
|
|
22340
|
-
import { Box as
|
|
22341
|
-
import
|
|
22466
|
+
import { Box as Box26, Text as Text25 } from "ink";
|
|
22467
|
+
import React32 from "react";
|
|
22342
22468
|
function CardHeader({
|
|
22343
22469
|
glyph,
|
|
22344
22470
|
tone,
|
|
@@ -22349,13 +22475,13 @@ function CardHeader({
|
|
|
22349
22475
|
meta,
|
|
22350
22476
|
right
|
|
22351
22477
|
}) {
|
|
22352
|
-
return /* @__PURE__ */
|
|
22478
|
+
return /* @__PURE__ */ React32.createElement(Box26, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React32.createElement(Text25, { color: tone }, glyph), titleBg ? /* @__PURE__ */ React32.createElement(Text25, { backgroundColor: titleBg, color: titleColor ?? tone, bold: true }, ` ${title} `) : /* @__PURE__ */ React32.createElement(Text25, { bold: true, color: titleColor ?? tone }, title), subtitle ? /* @__PURE__ */ React32.createElement(Text25, { color: FG.body }, subtitle) : null, meta?.map((item, i) => {
|
|
22353
22479
|
const isStr = typeof item === "string";
|
|
22354
22480
|
const text = isStr ? item : item.text;
|
|
22355
22481
|
const color2 = isStr ? FG.faint : item.color;
|
|
22356
22482
|
return (
|
|
22357
22483
|
// biome-ignore lint/suspicious/noArrayIndexKey: meta items are positional
|
|
22358
|
-
/* @__PURE__ */
|
|
22484
|
+
/* @__PURE__ */ React32.createElement(React32.Fragment, { key: `m-${i}` }, /* @__PURE__ */ React32.createElement(Text25, { color: FG.faint }, "\xB7"), /* @__PURE__ */ React32.createElement(Text25, { color: color2 }, text))
|
|
22359
22485
|
);
|
|
22360
22486
|
}), right);
|
|
22361
22487
|
}
|
|
@@ -22366,7 +22492,7 @@ function BranchCard({ card }) {
|
|
|
22366
22492
|
const ratio = card.total > 0 ? card.completed / card.total : 0;
|
|
22367
22493
|
const filled = Math.max(0, Math.min(BAR_CELLS, Math.round(ratio * BAR_CELLS)));
|
|
22368
22494
|
const tone = card.done ? TONE.ok : CARD.branch.color;
|
|
22369
|
-
return /* @__PURE__ */
|
|
22495
|
+
return /* @__PURE__ */ React33.createElement(Card, { tone }, /* @__PURE__ */ React33.createElement(
|
|
22370
22496
|
CardHeader,
|
|
22371
22497
|
{
|
|
22372
22498
|
glyph: "\u2387",
|
|
@@ -22374,22 +22500,22 @@ function BranchCard({ card }) {
|
|
|
22374
22500
|
title: card.done ? "branching done" : "branching",
|
|
22375
22501
|
meta: [`${card.completed} of ${card.total} samples`]
|
|
22376
22502
|
}
|
|
22377
|
-
), /* @__PURE__ */
|
|
22503
|
+
), /* @__PURE__ */ React33.createElement(Box27, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React33.createElement(Text26, { color: tone }, "\u2588".repeat(filled)), /* @__PURE__ */ React33.createElement(Text26, { color: FG.faint }, "\u2591".repeat(BAR_CELLS - filled)), /* @__PURE__ */ React33.createElement(Text26, { color: FG.faint }, `${(ratio * 100).toFixed(0)}%`)), !card.done && card.completed > 0 ? /* @__PURE__ */ React33.createElement(Text26, { color: FG.faint }, `latest \xB7 #${card.latestIndex} \xB7 T=${card.latestTemperature.toFixed(2)} \xB7 ${card.latestUncertainties} unc`) : null);
|
|
22378
22504
|
}
|
|
22379
22505
|
|
|
22380
22506
|
// src/cli/ui/cards/CtxCard.tsx
|
|
22381
|
-
import { Box as
|
|
22382
|
-
import
|
|
22507
|
+
import { Box as Box28, Text as Text27 } from "ink";
|
|
22508
|
+
import React34 from "react";
|
|
22383
22509
|
var BAR_CELLS2 = 32;
|
|
22384
22510
|
function row2(label, tokens, ratio, color2) {
|
|
22385
22511
|
const filled = Math.max(0, Math.min(BAR_CELLS2, Math.round(ratio * BAR_CELLS2)));
|
|
22386
|
-
return /* @__PURE__ */
|
|
22512
|
+
return /* @__PURE__ */ React34.createElement(Box28, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React34.createElement(Text27, { color: FG.sub }, label.padEnd(7)), /* @__PURE__ */ React34.createElement(Text27, { color: color2 }, "\u2588".repeat(filled)), /* @__PURE__ */ React34.createElement(Text27, { color: FG.faint }, "\u2591".repeat(BAR_CELLS2 - filled)), /* @__PURE__ */ React34.createElement(Text27, { bold: true, color: FG.body }, tokens.toLocaleString()), /* @__PURE__ */ React34.createElement(Text27, { color: FG.faint }, `\xB7 ${(ratio * 100).toFixed(1)}%`));
|
|
22387
22513
|
}
|
|
22388
22514
|
function CtxCard({ card }) {
|
|
22389
22515
|
const cap = Math.max(1, card.ctxMax);
|
|
22390
22516
|
const used = card.systemTokens + card.toolsTokens + card.logTokens + card.inputTokens;
|
|
22391
22517
|
const usedPct = used / cap * 100;
|
|
22392
|
-
return /* @__PURE__ */
|
|
22518
|
+
return /* @__PURE__ */ React34.createElement(Card, { tone: TONE.brand }, /* @__PURE__ */ React34.createElement(
|
|
22393
22519
|
CardHeader,
|
|
22394
22520
|
{
|
|
22395
22521
|
glyph: "\u2318",
|
|
@@ -22397,12 +22523,12 @@ function CtxCard({ card }) {
|
|
|
22397
22523
|
title: "context",
|
|
22398
22524
|
meta: [`${used.toLocaleString()} / ${cap.toLocaleString()} (${usedPct.toFixed(1)}%)`]
|
|
22399
22525
|
}
|
|
22400
|
-
), row2("system", card.systemTokens, card.systemTokens / cap, TONE.brand), row2("tools", card.toolsTokens, card.toolsTokens / cap, TONE.warn), row2("log", card.logTokens, card.logTokens / cap, TONE.ok), row2("input", card.inputTokens, card.inputTokens / cap, TONE.accent), card.topTools.length > 0 ? /* @__PURE__ */
|
|
22526
|
+
), row2("system", card.systemTokens, card.systemTokens / cap, TONE.brand), row2("tools", card.toolsTokens, card.toolsTokens / cap, TONE.warn), row2("log", card.logTokens, card.logTokens / cap, TONE.ok), row2("input", card.inputTokens, card.inputTokens / cap, TONE.accent), card.topTools.length > 0 ? /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(Text27, { color: FG.faint }, `top tools \xB7 ${card.toolsCount} total \xB7 ${card.logMessages} log msgs`), card.topTools.slice(0, 5).map((t3) => /* @__PURE__ */ React34.createElement(Box28, { key: `${t3.turn}-${t3.name}`, flexDirection: "row", gap: 1 }, /* @__PURE__ */ React34.createElement(Text27, { color: FG.sub }, t3.name), /* @__PURE__ */ React34.createElement(Text27, { color: FG.faint }, `\xB7 turn ${t3.turn} \xB7 ${t3.tokens.toLocaleString()}`)))) : null);
|
|
22401
22527
|
}
|
|
22402
22528
|
|
|
22403
22529
|
// src/cli/ui/cards/DiffCard.tsx
|
|
22404
|
-
import { Box as
|
|
22405
|
-
import
|
|
22530
|
+
import { Box as Box29, Text as Text28 } from "ink";
|
|
22531
|
+
import React35 from "react";
|
|
22406
22532
|
var LINE_COLOR = {
|
|
22407
22533
|
ctx: FG.sub,
|
|
22408
22534
|
add: TONE.ok,
|
|
@@ -22417,7 +22543,7 @@ var LINE_GLYPH = {
|
|
|
22417
22543
|
};
|
|
22418
22544
|
function DiffCard({ card }) {
|
|
22419
22545
|
const showFooter = card.hunks.length > 0;
|
|
22420
|
-
return /* @__PURE__ */
|
|
22546
|
+
return /* @__PURE__ */ React35.createElement(Card, { tone: TONE.ok }, /* @__PURE__ */ React35.createElement(
|
|
22421
22547
|
CardHeader,
|
|
22422
22548
|
{
|
|
22423
22549
|
glyph: "\xB1",
|
|
@@ -22429,12 +22555,12 @@ function DiffCard({ card }) {
|
|
|
22429
22555
|
{ text: `-${card.stats.del}`, color: TONE.err }
|
|
22430
22556
|
]
|
|
22431
22557
|
}
|
|
22432
|
-
), card.hunks.map((hunk) => /* @__PURE__ */
|
|
22558
|
+
), card.hunks.map((hunk) => /* @__PURE__ */ React35.createElement(Box29, { key: `${card.id}:${hunk.header}`, flexDirection: "column" }, /* @__PURE__ */ React35.createElement(Text28, { italic: true, color: FG.faint }, hunk.header), hunk.lines.map((line, li) => /* @__PURE__ */ React35.createElement(Box29, { key: `${card.id}:${hunk.header}:${li}`, flexDirection: "row", gap: 1 }, /* @__PURE__ */ React35.createElement(Text28, { color: LINE_COLOR[line.kind] }, LINE_GLYPH[line.kind]), /* @__PURE__ */ React35.createElement(Text28, { color: LINE_COLOR[line.kind], dimColor: line.kind === "ctx" }, line.text))))), showFooter && /* @__PURE__ */ React35.createElement(Box29, { flexDirection: "row", gap: 2 }, /* @__PURE__ */ React35.createElement(Text28, { bold: true, color: TONE.ok }, "[a] apply"), /* @__PURE__ */ React35.createElement(Text28, { color: FG.sub }, "[s] skip"), /* @__PURE__ */ React35.createElement(Text28, { bold: true, color: TONE.err }, "[r] reject")));
|
|
22433
22559
|
}
|
|
22434
22560
|
|
|
22435
22561
|
// src/cli/ui/cards/DoctorCard.tsx
|
|
22436
|
-
import { Box as
|
|
22437
|
-
import
|
|
22562
|
+
import { Box as Box30, Text as Text29 } from "ink";
|
|
22563
|
+
import React36 from "react";
|
|
22438
22564
|
var LEVEL_COLOR = {
|
|
22439
22565
|
ok: TONE.ok,
|
|
22440
22566
|
warn: TONE.warn,
|
|
@@ -22456,12 +22582,12 @@ function DoctorCard({ card }) {
|
|
|
22456
22582
|
const fail = card.checks.filter((c) => c.level === "fail").length;
|
|
22457
22583
|
const labelWidth = card.checks.reduce((m, c) => Math.max(m, c.label.length), 0);
|
|
22458
22584
|
const summary = `${card.checks.length} checks \xB7 ${ok} passed${warn > 0 ? ` \xB7 ${warn} warn` : ""}${fail > 0 ? ` \xB7 ${fail} fail` : ""}`;
|
|
22459
|
-
return /* @__PURE__ */
|
|
22585
|
+
return /* @__PURE__ */ React36.createElement(Card, { tone: CARD.tool.color }, /* @__PURE__ */ React36.createElement(CardHeader, { glyph: "\u2695", tone: CARD.tool.color, title: "doctor", meta: [summary] }), card.checks.map((c) => /* @__PURE__ */ React36.createElement(Box30, { key: c.label, flexDirection: "row", gap: 1 }, /* @__PURE__ */ React36.createElement(Text29, { color: LEVEL_COLOR[c.level] }, LEVEL_GLYPH[c.level]), /* @__PURE__ */ React36.createElement(Text29, { bold: true, color: FG.body }, c.label.padEnd(labelWidth + 1)), /* @__PURE__ */ React36.createElement(Text29, { color: FG.sub }, c.detail), /* @__PURE__ */ React36.createElement(Text29, { color: LEVEL_COLOR[c.level] }, LEVEL_TAG[c.level]))));
|
|
22460
22586
|
}
|
|
22461
22587
|
|
|
22462
22588
|
// src/cli/ui/cards/ErrorCard.tsx
|
|
22463
|
-
import { Box as
|
|
22464
|
-
import
|
|
22589
|
+
import { Box as Box31, Text as Text30 } from "ink";
|
|
22590
|
+
import React37 from "react";
|
|
22465
22591
|
var STACK_TAIL = 5;
|
|
22466
22592
|
function ErrorCard({ card }) {
|
|
22467
22593
|
const retryNote = card.retries !== void 0 && card.retries > 0 ? `${card.retries} retr${card.retries === 1 ? "y" : "ies"}` : null;
|
|
@@ -22471,7 +22597,7 @@ function ErrorCard({ card }) {
|
|
|
22471
22597
|
const stackHidden = stackTrunc ? stackLines.length - stackVisible.length : 0;
|
|
22472
22598
|
const hasStack = stackVisible.length > 0;
|
|
22473
22599
|
const messageLines = card.message.split("\n");
|
|
22474
|
-
return /* @__PURE__ */
|
|
22600
|
+
return /* @__PURE__ */ React37.createElement(Card, { tone: TONE.err }, /* @__PURE__ */ React37.createElement(
|
|
22475
22601
|
CardHeader,
|
|
22476
22602
|
{
|
|
22477
22603
|
glyph: "\u2716",
|
|
@@ -22479,16 +22605,16 @@ function ErrorCard({ card }) {
|
|
|
22479
22605
|
title: card.title || "error",
|
|
22480
22606
|
meta: retryNote ? [retryNote] : void 0
|
|
22481
22607
|
}
|
|
22482
|
-
), messageLines.map((line, i) => /* @__PURE__ */
|
|
22608
|
+
), messageLines.map((line, i) => /* @__PURE__ */ React37.createElement(Text30, { key: `${card.id}:msg:${i}`, color: TONE.err }, line || " ")), hasStack ? /* @__PURE__ */ React37.createElement(Box31, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React37.createElement(Text30, { color: FG.meta }, "stack trace"), stackHidden > 0 ? /* @__PURE__ */ React37.createElement(Text30, { color: FG.faint }, `\u22EE ${stackHidden} earlier stack line${stackHidden === 1 ? "" : "s"} hidden`) : null, stackVisible.map((line, i) => /* @__PURE__ */ React37.createElement(Text30, { key: `${card.id}:stk:${stackHidden + i}`, color: FG.meta }, line || " "))) : null);
|
|
22483
22609
|
}
|
|
22484
22610
|
|
|
22485
22611
|
// src/cli/ui/cards/LiveCard.tsx
|
|
22486
|
-
import { Box as
|
|
22487
|
-
import
|
|
22612
|
+
import { Box as Box32, Text as Text32 } from "ink";
|
|
22613
|
+
import React39 from "react";
|
|
22488
22614
|
|
|
22489
22615
|
// src/cli/ui/primitives/Spinner.tsx
|
|
22490
|
-
import { Text as
|
|
22491
|
-
import
|
|
22616
|
+
import { Text as Text31 } from "ink";
|
|
22617
|
+
import React38 from "react";
|
|
22492
22618
|
var FRAMES = {
|
|
22493
22619
|
circle: ["\u25D0", "\u25D3", "\u25D1", "\u25D2"],
|
|
22494
22620
|
braille: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827"]
|
|
@@ -22497,7 +22623,7 @@ function Spinner({ kind = "circle", color: color2, bold }) {
|
|
|
22497
22623
|
const frames = FRAMES[kind];
|
|
22498
22624
|
const tick = useTick();
|
|
22499
22625
|
const frame = tick % frames.length;
|
|
22500
|
-
return /* @__PURE__ */
|
|
22626
|
+
return /* @__PURE__ */ React38.createElement(Text31, { bold, color: color2 }, frames[frame]);
|
|
22501
22627
|
}
|
|
22502
22628
|
|
|
22503
22629
|
// src/cli/ui/cards/LiveCard.tsx
|
|
@@ -22524,12 +22650,12 @@ var VARIANT_GLYPH = {
|
|
|
22524
22650
|
function LiveCard({ card }) {
|
|
22525
22651
|
const color2 = TONE_TO_COLOR[card.tone];
|
|
22526
22652
|
const glyph = VARIANT_GLYPH[card.variant];
|
|
22527
|
-
return /* @__PURE__ */
|
|
22653
|
+
return /* @__PURE__ */ React39.createElement(Box32, { paddingLeft: 2, flexDirection: "row", gap: 1 }, card.variant === "thinking" ? /* @__PURE__ */ React39.createElement(Spinner, { kind: "circle", color: color2, bold: true }) : /* @__PURE__ */ React39.createElement(Text32, { bold: true, color: color2 }, glyph), /* @__PURE__ */ React39.createElement(Text32, { color: FG.body }, card.text), card.meta !== void 0 ? /* @__PURE__ */ React39.createElement(Text32, { color: FG.faint }, `\xB7 ${card.meta}`) : null);
|
|
22528
22654
|
}
|
|
22529
22655
|
|
|
22530
22656
|
// src/cli/ui/cards/MemoryCard.tsx
|
|
22531
|
-
import { Box as
|
|
22532
|
-
import
|
|
22657
|
+
import { Box as Box33, Text as Text33 } from "ink";
|
|
22658
|
+
import React40 from "react";
|
|
22533
22659
|
var CATEGORY_ORDER = [
|
|
22534
22660
|
"user",
|
|
22535
22661
|
"feedback",
|
|
@@ -22558,7 +22684,7 @@ function MemoryCard({ card }) {
|
|
|
22558
22684
|
const counts = countByCategory(card.entries);
|
|
22559
22685
|
const summary = CATEGORY_ORDER.filter((c) => counts[c] > 0).map((c) => `${counts[c]} ${c}`).join(" \xB7 ");
|
|
22560
22686
|
const tokens = card.tokens > 1024 ? `~${(card.tokens / 1024).toFixed(1)}K tok` : `~${card.tokens} tok`;
|
|
22561
|
-
return /* @__PURE__ */
|
|
22687
|
+
return /* @__PURE__ */ React40.createElement(Card, { tone: FG.meta }, /* @__PURE__ */ React40.createElement(
|
|
22562
22688
|
CardHeader,
|
|
22563
22689
|
{
|
|
22564
22690
|
glyph: "\u2311",
|
|
@@ -22571,7 +22697,7 @@ function MemoryCard({ card }) {
|
|
|
22571
22697
|
const all = card.entries.filter((e) => e.category === category);
|
|
22572
22698
|
const shown = all.slice(0, 5);
|
|
22573
22699
|
const remaining = all.length - shown.length;
|
|
22574
|
-
return /* @__PURE__ */
|
|
22700
|
+
return /* @__PURE__ */ React40.createElement(Box33, { key: category, flexDirection: "column" }, /* @__PURE__ */ React40.createElement(Text33, { color: FG.faint }, `${CATEGORY_LABEL[category]} (${counts[category]})`), shown.map((entry) => /* @__PURE__ */ React40.createElement(Box33, { key: `${category}:${entry.summary}`, flexDirection: "row", gap: 1 }, /* @__PURE__ */ React40.createElement(Text33, { color: CATEGORY_GLYPH_COLOR[category] }, CATEGORY_GLYPH[category]), /* @__PURE__ */ React40.createElement(Text33, { color: FG.sub }, entry.summary))), remaining > 0 ? /* @__PURE__ */ React40.createElement(Text33, { color: FG.faint }, `\u22EE +${remaining} more`) : null);
|
|
22575
22701
|
}));
|
|
22576
22702
|
}
|
|
22577
22703
|
function countByCategory(entries) {
|
|
@@ -22586,8 +22712,8 @@ function countByCategory(entries) {
|
|
|
22586
22712
|
}
|
|
22587
22713
|
|
|
22588
22714
|
// src/cli/ui/cards/PlanCard.tsx
|
|
22589
|
-
import { Box as
|
|
22590
|
-
import
|
|
22715
|
+
import { Box as Box34, Text as Text34 } from "ink";
|
|
22716
|
+
import React41 from "react";
|
|
22591
22717
|
var STATUS_GLYPH = {
|
|
22592
22718
|
queued: "\u25CB",
|
|
22593
22719
|
running: "\u25B6",
|
|
@@ -22612,11 +22738,11 @@ function PlanCard({ card }) {
|
|
|
22612
22738
|
const hasRunning = card.steps.some((s) => s.status === "running");
|
|
22613
22739
|
const tone = hasRunning ? TONE_ACTIVE.accent : TONE.accent;
|
|
22614
22740
|
const window = pickWindow(card.steps);
|
|
22615
|
-
return /* @__PURE__ */
|
|
22741
|
+
return /* @__PURE__ */ React41.createElement(Card, { tone }, /* @__PURE__ */ React41.createElement(CardHeader, { glyph: "\u229E", tone, title: card.title, meta: [progress] }), window.hiddenBefore > 0 ? /* @__PURE__ */ React41.createElement(Box34, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React41.createElement(Text34, { color: TONE.ok }, "\u2713"), /* @__PURE__ */ React41.createElement(Text34, { color: FG.faint }, `\u22EF ${window.hiddenBefore} done`)) : null, window.steps.map((step) => {
|
|
22616
22742
|
const isActive = step.status === "running";
|
|
22617
22743
|
const titleColor = isActive ? FG.strong : FG.sub;
|
|
22618
|
-
return /* @__PURE__ */
|
|
22619
|
-
}), window.hiddenAfter > 0 ? /* @__PURE__ */
|
|
22744
|
+
return /* @__PURE__ */ React41.createElement(Box34, { key: step.id, flexDirection: "row", gap: 1 }, /* @__PURE__ */ React41.createElement(Text34, { color: STATUS_COLOR[step.status] }, STATUS_GLYPH[step.status]), /* @__PURE__ */ React41.createElement(Text34, { bold: isActive, color: titleColor }, `${step.indexLabel}. ${step.title}`), isActive ? /* @__PURE__ */ React41.createElement(Text34, { color: TONE_ACTIVE.brand }, "\u2190 in progress") : null);
|
|
22745
|
+
}), window.hiddenAfter > 0 ? /* @__PURE__ */ React41.createElement(Box34, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React41.createElement(Text34, { color: FG.faint }, "\u25CB"), /* @__PURE__ */ React41.createElement(Text34, { color: FG.faint }, `\u22EF ${window.hiddenAfter} upcoming`)) : null);
|
|
22620
22746
|
}
|
|
22621
22747
|
function pickWindow(steps) {
|
|
22622
22748
|
if (steps.length <= VISIBLE_WINDOW) {
|
|
@@ -22644,8 +22770,8 @@ function anchorIndex(steps) {
|
|
|
22644
22770
|
}
|
|
22645
22771
|
|
|
22646
22772
|
// src/cli/ui/cards/ReasoningCard.tsx
|
|
22647
|
-
import { Box as
|
|
22648
|
-
import
|
|
22773
|
+
import { Box as Box35, Text as Text36, useStdout as useStdout7 } from "ink";
|
|
22774
|
+
import React43 from "react";
|
|
22649
22775
|
|
|
22650
22776
|
// src/frame/width.ts
|
|
22651
22777
|
import stringWidthLib from "string-width";
|
|
@@ -22696,44 +22822,12 @@ function wrapToCells(s, maxCells) {
|
|
|
22696
22822
|
}
|
|
22697
22823
|
|
|
22698
22824
|
// src/cli/ui/primitives/CursorBlock.tsx
|
|
22699
|
-
import { Text as
|
|
22700
|
-
import
|
|
22825
|
+
import { Text as Text35 } from "ink";
|
|
22826
|
+
import React42 from "react";
|
|
22701
22827
|
function CursorBlock() {
|
|
22702
22828
|
const tick = useTick();
|
|
22703
22829
|
const on = Math.floor(tick / 4) % 2 === 0;
|
|
22704
|
-
return /* @__PURE__ */
|
|
22705
|
-
}
|
|
22706
|
-
|
|
22707
|
-
// src/cli/ui/primitives/Pill.tsx
|
|
22708
|
-
import { Text as Text34 } from "ink";
|
|
22709
|
-
import React41 from "react";
|
|
22710
|
-
function Pill({ label, bg, fg, bold = true }) {
|
|
22711
|
-
return /* @__PURE__ */ React41.createElement(Text34, { backgroundColor: bg, color: fg, bold }, ` ${label} `);
|
|
22712
|
-
}
|
|
22713
|
-
var PILL_SECTION = {
|
|
22714
|
-
reason: { bg: "#2a1f3d", fg: "#d2a8ff" },
|
|
22715
|
-
output: { bg: "#0d1d2e", fg: "#79c0ff" },
|
|
22716
|
-
tool: { bg: "#0f2230", fg: "#79c0ff" },
|
|
22717
|
-
shell: { bg: "#0f2230", fg: "#79c0ff" },
|
|
22718
|
-
task: { bg: "#0d1d2e", fg: "#79c0ff" },
|
|
22719
|
-
taskDone: { bg: "#102815", fg: "#7ee787" },
|
|
22720
|
-
taskFailed: { bg: "#2c1416", fg: "#ff8b81" },
|
|
22721
|
-
plan: { bg: "#2a1f3d", fg: "#d2a8ff" },
|
|
22722
|
-
user: { bg: "#11141a", fg: "#8b949e" }
|
|
22723
|
-
};
|
|
22724
|
-
var PILL_MODEL = {
|
|
22725
|
-
flash: { bg: "#11141a", fg: "#79c0ff" },
|
|
22726
|
-
pro: { bg: "#11141a", fg: "#d2a8ff" },
|
|
22727
|
-
r1: { bg: "#11141a", fg: "#b395f5" },
|
|
22728
|
-
unknown: { bg: "#11141a", fg: "#8b949e" }
|
|
22729
|
-
};
|
|
22730
|
-
function modelBadgeFor(model2) {
|
|
22731
|
-
if (!model2) return { label: "?", kind: "unknown" };
|
|
22732
|
-
const stripped = model2.replace(/^deepseek-/, "");
|
|
22733
|
-
if (stripped === "v4-flash" || stripped === "chat") return { label: "v4-flash", kind: "flash" };
|
|
22734
|
-
if (stripped === "v4-pro") return { label: "v4-pro", kind: "pro" };
|
|
22735
|
-
if (stripped === "r1" || stripped === "reasoner") return { label: "r1", kind: "r1" };
|
|
22736
|
-
return { label: stripped, kind: "unknown" };
|
|
22830
|
+
return /* @__PURE__ */ React42.createElement(Text35, { inverse: on, color: CARD.streaming.color }, " ");
|
|
22737
22831
|
}
|
|
22738
22832
|
|
|
22739
22833
|
// src/cli/ui/cards/ReasoningCard.tsx
|
|
@@ -22743,13 +22837,13 @@ function ReasoningCard({
|
|
|
22743
22837
|
card,
|
|
22744
22838
|
expanded
|
|
22745
22839
|
}) {
|
|
22746
|
-
const { stdout: stdout4 } =
|
|
22840
|
+
const { stdout: stdout4 } = useStdout7();
|
|
22747
22841
|
const cols = stdout4?.columns ?? 80;
|
|
22748
22842
|
const lineCells = Math.max(20, cols - 4);
|
|
22749
22843
|
const allLines = card.text.length > 0 ? card.text.split("\n") : [];
|
|
22750
22844
|
const showBody = expanded && (allLines.length > 0 || card.streaming);
|
|
22751
22845
|
const tone = card.aborted ? TONE.err : card.streaming ? TONE_ACTIVE.accent : TONE.accent;
|
|
22752
|
-
return /* @__PURE__ */
|
|
22846
|
+
return /* @__PURE__ */ React43.createElement(Card, { tone }, /* @__PURE__ */ React43.createElement(ReasoningHeader, { card }), showBody && (card.streaming ? /* @__PURE__ */ React43.createElement(StreamingPreview, { card, allLines, lineCells }) : /* @__PURE__ */ React43.createElement(SettledPreview, { card, allLines, lineCells })));
|
|
22753
22847
|
}
|
|
22754
22848
|
function ReasoningHeader({ card }) {
|
|
22755
22849
|
const streamingActive = card.streaming && !card.aborted;
|
|
@@ -22762,7 +22856,7 @@ function ReasoningHeader({ card }) {
|
|
|
22762
22856
|
const duration = headerDuration(card);
|
|
22763
22857
|
if (duration) meta.push(duration);
|
|
22764
22858
|
const modelBadge = card.model ? modelBadgeFor(card.model) : null;
|
|
22765
|
-
return /* @__PURE__ */
|
|
22859
|
+
return /* @__PURE__ */ React43.createElement(
|
|
22766
22860
|
CardHeader,
|
|
22767
22861
|
{
|
|
22768
22862
|
glyph,
|
|
@@ -22771,7 +22865,7 @@ function ReasoningHeader({ card }) {
|
|
|
22771
22865
|
titleColor: PILL_SECTION.reason.fg,
|
|
22772
22866
|
titleBg: PILL_SECTION.reason.bg,
|
|
22773
22867
|
meta: meta.length > 0 ? meta : void 0,
|
|
22774
|
-
right: /* @__PURE__ */
|
|
22868
|
+
right: /* @__PURE__ */ React43.createElement(React43.Fragment, null, streamingActive ? /* @__PURE__ */ React43.createElement(Spinner, { kind: "braille", color: TONE_ACTIVE.accent }) : null, modelBadge ? /* @__PURE__ */ React43.createElement(Pill, { label: modelBadge.label, ...PILL_MODEL[modelBadge.kind], bold: false }) : null)
|
|
22775
22869
|
}
|
|
22776
22870
|
);
|
|
22777
22871
|
}
|
|
@@ -22792,13 +22886,13 @@ function headerDuration(card) {
|
|
|
22792
22886
|
function StreamingPreview({ card, allLines, lineCells }) {
|
|
22793
22887
|
const visualLines = allLines.flatMap((l) => wrapToCells(l, lineCells));
|
|
22794
22888
|
const visible = visualLines.slice(-STREAMING_PREVIEW_LINES);
|
|
22795
|
-
return /* @__PURE__ */
|
|
22889
|
+
return /* @__PURE__ */ React43.createElement(BodyLines, { card, lines: visible, lineCells, cursorOnLast: true });
|
|
22796
22890
|
}
|
|
22797
22891
|
function SettledPreview({ card, allLines, lineCells }) {
|
|
22798
22892
|
const visualLines = allLines.flatMap((l) => wrapToCells(l, lineCells));
|
|
22799
22893
|
const visible = visualLines.slice(-SETTLED_TAIL_LINES);
|
|
22800
22894
|
const droppedLines = Math.max(0, visualLines.length - visible.length);
|
|
22801
|
-
return /* @__PURE__ */
|
|
22895
|
+
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, droppedLines > 0 ? /* @__PURE__ */ React43.createElement(ElisionHint, { droppedLines, card }) : null, /* @__PURE__ */ React43.createElement(BodyLines, { card, lines: visible, lineCells, indexOffset: droppedLines }));
|
|
22802
22896
|
}
|
|
22803
22897
|
function BodyLines({
|
|
22804
22898
|
card,
|
|
@@ -22807,9 +22901,9 @@ function BodyLines({
|
|
|
22807
22901
|
cursorOnLast = false,
|
|
22808
22902
|
indexOffset = 0
|
|
22809
22903
|
}) {
|
|
22810
|
-
return /* @__PURE__ */
|
|
22904
|
+
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, lines.map((line, i) => {
|
|
22811
22905
|
const isLast = i === lines.length - 1;
|
|
22812
|
-
return /* @__PURE__ */
|
|
22906
|
+
return /* @__PURE__ */ React43.createElement(Box35, { key: `${card.id}:b:${indexOffset + i}`, flexDirection: "row" }, /* @__PURE__ */ React43.createElement(Text36, { italic: true, color: FG.meta }, clipToCells(line, lineCells)), isLast && cursorOnLast && /* @__PURE__ */ React43.createElement(CursorBlock, null));
|
|
22813
22907
|
}));
|
|
22814
22908
|
}
|
|
22815
22909
|
function ElisionHint({
|
|
@@ -22823,18 +22917,18 @@ function ElisionHint({
|
|
|
22823
22917
|
parts.push(`${droppedLines} line${droppedLines === 1 ? "" : "s"}`);
|
|
22824
22918
|
}
|
|
22825
22919
|
if (card.tokens > 0) parts.push(`${card.tokens.toLocaleString()} tok`);
|
|
22826
|
-
return /* @__PURE__ */
|
|
22920
|
+
return /* @__PURE__ */ React43.createElement(Text36, { color: FG.faint }, `\u22EF ${parts.join(" \xB7 ")} above \xB7 /reasoning last`);
|
|
22827
22921
|
}
|
|
22828
22922
|
|
|
22829
22923
|
// src/cli/ui/cards/SearchCard.tsx
|
|
22830
|
-
import { Box as
|
|
22831
|
-
import
|
|
22924
|
+
import { Box as Box36, Text as Text37 } from "ink";
|
|
22925
|
+
import React44 from "react";
|
|
22832
22926
|
function SearchCard({ card }) {
|
|
22833
22927
|
const fileCount = new Set(card.hits.map((h) => h.file)).size;
|
|
22834
22928
|
const elapsed = `${(card.elapsedMs / 1e3).toFixed(2)}s`;
|
|
22835
22929
|
const stats2 = `${card.hits.length} hit${card.hits.length === 1 ? "" : "s"} \xB7 ${fileCount} file${fileCount === 1 ? "" : "s"}`;
|
|
22836
22930
|
const grouped = groupByFile(card.hits.slice(0, 10));
|
|
22837
|
-
return /* @__PURE__ */
|
|
22931
|
+
return /* @__PURE__ */ React44.createElement(Card, { tone: TONE.info }, /* @__PURE__ */ React44.createElement(
|
|
22838
22932
|
CardHeader,
|
|
22839
22933
|
{
|
|
22840
22934
|
glyph: "\u2299",
|
|
@@ -22843,7 +22937,7 @@ function SearchCard({ card }) {
|
|
|
22843
22937
|
subtitle: `"${card.query}"`,
|
|
22844
22938
|
meta: [stats2, elapsed]
|
|
22845
22939
|
}
|
|
22846
|
-
), grouped.map(([file, hits]) => /* @__PURE__ */
|
|
22940
|
+
), grouped.map(([file, hits]) => /* @__PURE__ */ React44.createElement(Box36, { key: file, flexDirection: "column" }, /* @__PURE__ */ React44.createElement(Text37, { bold: true, color: FG.strong }, file), hits.map((h, i) => /* @__PURE__ */ React44.createElement(Box36, { key: `${file}:${h.line}:${i}`, flexDirection: "row", gap: 1 }, /* @__PURE__ */ React44.createElement(Text37, { color: FG.faint }, `${h.line.toString().padStart(4)} \u2502`), /* @__PURE__ */ React44.createElement(HighlightedLine, { text: h.preview, start: h.matchStart, end: h.matchEnd }))))), card.hits.length > 10 ? /* @__PURE__ */ React44.createElement(Text37, { color: FG.faint }, `\u22EE +${card.hits.length - 10} more hits`) : null);
|
|
22847
22941
|
}
|
|
22848
22942
|
function HighlightedLine({
|
|
22849
22943
|
text,
|
|
@@ -22851,9 +22945,9 @@ function HighlightedLine({
|
|
|
22851
22945
|
end
|
|
22852
22946
|
}) {
|
|
22853
22947
|
if (start < 0 || end <= start || end > text.length) {
|
|
22854
|
-
return /* @__PURE__ */
|
|
22948
|
+
return /* @__PURE__ */ React44.createElement(Text37, { color: FG.sub }, text);
|
|
22855
22949
|
}
|
|
22856
|
-
return /* @__PURE__ */
|
|
22950
|
+
return /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(Text37, { color: FG.sub }, text.slice(0, start)), /* @__PURE__ */ React44.createElement(Text37, { bold: true, inverse: true }, text.slice(start, end)), /* @__PURE__ */ React44.createElement(Text37, { color: FG.sub }, text.slice(end)));
|
|
22857
22951
|
}
|
|
22858
22952
|
function groupByFile(hits) {
|
|
22859
22953
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -22866,8 +22960,8 @@ function groupByFile(hits) {
|
|
|
22866
22960
|
}
|
|
22867
22961
|
|
|
22868
22962
|
// src/cli/ui/cards/StreamingCard.tsx
|
|
22869
|
-
import { Box as
|
|
22870
|
-
import
|
|
22963
|
+
import { Box as Box38, Text as Text39, useStdout as useStdout9 } from "ink";
|
|
22964
|
+
import React46, { useContext as useContext5 } from "react";
|
|
22871
22965
|
|
|
22872
22966
|
// src/cli/ui/layout/LiveExpandContext.ts
|
|
22873
22967
|
import { createContext as createContext4 } from "react";
|
|
@@ -22875,54 +22969,54 @@ var LiveExpandContext = createContext4(false);
|
|
|
22875
22969
|
|
|
22876
22970
|
// src/cli/ui/markdown.tsx
|
|
22877
22971
|
import { highlight, supportsLanguage } from "cli-highlight";
|
|
22878
|
-
import { Box as
|
|
22879
|
-
import
|
|
22972
|
+
import { Box as Box37, Text as Text38, useStdout as useStdout8 } from "ink";
|
|
22973
|
+
import React45 from "react";
|
|
22880
22974
|
import stringWidth from "string-width";
|
|
22881
22975
|
var BODY_LEFT_CELLS = 7;
|
|
22882
|
-
var MarkdownWidthCtx =
|
|
22976
|
+
var MarkdownWidthCtx = React45.createContext(void 0);
|
|
22883
22977
|
function useWidth() {
|
|
22884
|
-
const ctx =
|
|
22978
|
+
const ctx = React45.useContext(MarkdownWidthCtx);
|
|
22885
22979
|
if (ctx !== void 0) return ctx;
|
|
22886
|
-
return (
|
|
22980
|
+
return (useStdout8()?.stdout?.columns ?? process.stdout.columns ?? 80) - BODY_LEFT_CELLS;
|
|
22887
22981
|
}
|
|
22888
22982
|
marked.setOptions({ gfm: true, breaks: false });
|
|
22889
22983
|
function Markdown({ text, width }) {
|
|
22890
|
-
const tokens =
|
|
22984
|
+
const tokens = React45.useMemo(() => marked.lexer(text), [text]);
|
|
22891
22985
|
const ctxWidth = width !== void 0 ? Math.max(1, width) : void 0;
|
|
22892
|
-
return /* @__PURE__ */
|
|
22986
|
+
return /* @__PURE__ */ React45.createElement(MarkdownWidthCtx.Provider, { value: ctxWidth }, /* @__PURE__ */ React45.createElement(Box37, { flexDirection: "column", gap: 1 }, tokens.map((token, i) => /* @__PURE__ */ React45.createElement(BlockToken, { key: `${i}-${token.type}`, token }))));
|
|
22893
22987
|
}
|
|
22894
22988
|
function BlockToken({ token }) {
|
|
22895
22989
|
switch (token.type) {
|
|
22896
22990
|
case "heading":
|
|
22897
|
-
return /* @__PURE__ */
|
|
22991
|
+
return /* @__PURE__ */ React45.createElement(Heading, { token });
|
|
22898
22992
|
case "paragraph":
|
|
22899
|
-
return /* @__PURE__ */
|
|
22993
|
+
return /* @__PURE__ */ React45.createElement(Paragraph, { token });
|
|
22900
22994
|
case "list":
|
|
22901
|
-
return /* @__PURE__ */
|
|
22995
|
+
return /* @__PURE__ */ React45.createElement(List, { token, depth: 0 });
|
|
22902
22996
|
case "code":
|
|
22903
|
-
return /* @__PURE__ */
|
|
22997
|
+
return /* @__PURE__ */ React45.createElement(CodeBlock2, { token });
|
|
22904
22998
|
case "blockquote":
|
|
22905
|
-
return /* @__PURE__ */
|
|
22999
|
+
return /* @__PURE__ */ React45.createElement(Blockquote, { token });
|
|
22906
23000
|
case "hr":
|
|
22907
|
-
return /* @__PURE__ */
|
|
23001
|
+
return /* @__PURE__ */ React45.createElement(HorizontalRule, null);
|
|
22908
23002
|
case "table":
|
|
22909
|
-
return /* @__PURE__ */
|
|
23003
|
+
return /* @__PURE__ */ React45.createElement(Table, { token });
|
|
22910
23004
|
case "html":
|
|
22911
|
-
return /* @__PURE__ */
|
|
23005
|
+
return /* @__PURE__ */ React45.createElement(Text38, { color: FG.body }, token.text);
|
|
22912
23006
|
case "space":
|
|
22913
23007
|
return null;
|
|
22914
23008
|
default:
|
|
22915
|
-
return /* @__PURE__ */
|
|
23009
|
+
return /* @__PURE__ */ React45.createElement(Text38, { color: FG.body }, token.raw ?? "");
|
|
22916
23010
|
}
|
|
22917
23011
|
}
|
|
22918
23012
|
function Heading({ token }) {
|
|
22919
|
-
return /* @__PURE__ */
|
|
23013
|
+
return /* @__PURE__ */ React45.createElement(Box37, null, /* @__PURE__ */ React45.createElement(Text38, { bold: true, color: FG.strong, backgroundColor: SURFACE.bgElev }, ` ${plainText(token.tokens)} `));
|
|
22920
23014
|
}
|
|
22921
23015
|
function Paragraph({ token }) {
|
|
22922
|
-
return /* @__PURE__ */
|
|
23016
|
+
return /* @__PURE__ */ React45.createElement(Text38, { color: FG.body }, /* @__PURE__ */ React45.createElement(Inline, { tokens: token.tokens ?? [] }));
|
|
22923
23017
|
}
|
|
22924
23018
|
function List({ token, depth }) {
|
|
22925
|
-
return /* @__PURE__ */
|
|
23019
|
+
return /* @__PURE__ */ React45.createElement(Box37, { flexDirection: "column" }, token.items.map((item, i) => /* @__PURE__ */ React45.createElement(
|
|
22926
23020
|
ListItem,
|
|
22927
23021
|
{
|
|
22928
23022
|
key: `${i}-${item.text.slice(0, 24)}`,
|
|
@@ -22943,27 +23037,27 @@ function ListItem({
|
|
|
22943
23037
|
const markerColor = item.task ? item.checked ? TONE.ok : FG.faint : FG.meta;
|
|
22944
23038
|
const dim = item.task && item.checked === true;
|
|
22945
23039
|
const indent = " ".repeat(depth + 1);
|
|
22946
|
-
return /* @__PURE__ */
|
|
23040
|
+
return /* @__PURE__ */ React45.createElement(Box37, null, /* @__PURE__ */ React45.createElement(Text38, { color: markerColor }, `${indent}${marker} `), /* @__PURE__ */ React45.createElement(Box37, { flexDirection: "column" }, item.tokens.map((tok, i) => {
|
|
22947
23041
|
if (tok.type === "text") {
|
|
22948
23042
|
const inner = tok.tokens;
|
|
22949
23043
|
return (
|
|
22950
23044
|
// biome-ignore lint/suspicious/noArrayIndexKey: list-item children are positional and stable per render
|
|
22951
|
-
/* @__PURE__ */
|
|
23045
|
+
/* @__PURE__ */ React45.createElement(Text38, { key: `t-${i}`, color: dim ? FG.faint : FG.body, strikethrough: dim }, inner ? /* @__PURE__ */ React45.createElement(Inline, { tokens: inner }) : tok.text)
|
|
22952
23046
|
);
|
|
22953
23047
|
}
|
|
22954
23048
|
if (tok.type === "list") {
|
|
22955
|
-
return /* @__PURE__ */
|
|
23049
|
+
return /* @__PURE__ */ React45.createElement(List, { key: `l-${i}`, token: tok, depth: depth + 1 });
|
|
22956
23050
|
}
|
|
22957
|
-
return /* @__PURE__ */
|
|
23051
|
+
return /* @__PURE__ */ React45.createElement(BlockToken, { key: `b-${i}-${tok.type}`, token: tok });
|
|
22958
23052
|
})));
|
|
22959
23053
|
}
|
|
22960
23054
|
function CodeBlock2({ token }) {
|
|
22961
23055
|
const lang = token.lang?.split(/\s+/)[0] ?? "";
|
|
22962
23056
|
const colored = highlightCode(token.text, lang);
|
|
22963
23057
|
const lines = colored.split("\n");
|
|
22964
|
-
return /* @__PURE__ */
|
|
23058
|
+
return /* @__PURE__ */ React45.createElement(Box37, { flexDirection: "column" }, lang ? /* @__PURE__ */ React45.createElement(Box37, null, /* @__PURE__ */ React45.createElement(Text38, { color: FG.meta }, ` ${lang}`)) : null, /* @__PURE__ */ React45.createElement(Box37, { flexDirection: "column" }, lines.map((line, i) => (
|
|
22965
23059
|
// biome-ignore lint/suspicious/noArrayIndexKey: code lines are positional and stable per render
|
|
22966
|
-
/* @__PURE__ */
|
|
23060
|
+
/* @__PURE__ */ React45.createElement(Text38, { key: `code-${i}`, backgroundColor: SURFACE.bgElev }, ` ${line} `)
|
|
22967
23061
|
))));
|
|
22968
23062
|
}
|
|
22969
23063
|
function highlightCode(source, lang) {
|
|
@@ -22976,7 +23070,7 @@ function highlightCode(source, lang) {
|
|
|
22976
23070
|
}
|
|
22977
23071
|
}
|
|
22978
23072
|
function Blockquote({ token }) {
|
|
22979
|
-
return /* @__PURE__ */
|
|
23073
|
+
return /* @__PURE__ */ React45.createElement(Box37, { flexDirection: "column" }, (token.tokens ?? []).map((child, i) => /* @__PURE__ */ React45.createElement(Box37, { key: `${i}-${child.type}`, flexDirection: "row" }, /* @__PURE__ */ React45.createElement(Text38, { color: TONE.brand }, " \u258E "), /* @__PURE__ */ React45.createElement(Box37, { flexDirection: "column", flexGrow: 1 }, child.type === "paragraph" ? /* @__PURE__ */ React45.createElement(Text38, { italic: true, color: FG.sub }, /* @__PURE__ */ React45.createElement(Inline, { tokens: child.tokens ?? [] })) : /* @__PURE__ */ React45.createElement(BlockToken, { token: child })))));
|
|
22980
23074
|
}
|
|
22981
23075
|
function padToCells(text, cells) {
|
|
22982
23076
|
const w = stringWidth(text);
|
|
@@ -22986,7 +23080,7 @@ function padToCells(text, cells) {
|
|
|
22986
23080
|
function HorizontalRule() {
|
|
22987
23081
|
const width = useWidth();
|
|
22988
23082
|
const rule = "\u2500".repeat(Math.max(width, 1));
|
|
22989
|
-
return /* @__PURE__ */
|
|
23083
|
+
return /* @__PURE__ */ React45.createElement(Text38, { color: FG.faint }, ` ${rule}`);
|
|
22990
23084
|
}
|
|
22991
23085
|
function tableLayout(headerCells, bodyCells, availableWidth) {
|
|
22992
23086
|
const colCount = headerCells.length;
|
|
@@ -23014,7 +23108,7 @@ function Table({ token }) {
|
|
|
23014
23108
|
const bodyCells = token.rows.map((row3) => row3.map((c) => plainText(c.tokens)));
|
|
23015
23109
|
const layout = tableLayout(headerCells, bodyCells, width);
|
|
23016
23110
|
if (!layout.fallback)
|
|
23017
|
-
return /* @__PURE__ */
|
|
23111
|
+
return /* @__PURE__ */ React45.createElement(
|
|
23018
23112
|
ColumnarTable,
|
|
23019
23113
|
{
|
|
23020
23114
|
headerCells,
|
|
@@ -23024,7 +23118,7 @@ function Table({ token }) {
|
|
|
23024
23118
|
gap: layout.gap
|
|
23025
23119
|
}
|
|
23026
23120
|
);
|
|
23027
|
-
return /* @__PURE__ */
|
|
23121
|
+
return /* @__PURE__ */ React45.createElement(
|
|
23028
23122
|
FallbackTable,
|
|
23029
23123
|
{
|
|
23030
23124
|
headerCells,
|
|
@@ -23042,14 +23136,14 @@ function ColumnarTable({
|
|
|
23042
23136
|
gap
|
|
23043
23137
|
}) {
|
|
23044
23138
|
const ruleRow = widths.map((w) => "\u2500".repeat(w)).join(gap);
|
|
23045
|
-
return /* @__PURE__ */
|
|
23139
|
+
return /* @__PURE__ */ React45.createElement(Box37, { flexDirection: "column" }, /* @__PURE__ */ React45.createElement(Box37, null, /* @__PURE__ */ React45.createElement(Text38, null, " "), headerCells.map((cell, i) => (
|
|
23046
23140
|
// biome-ignore lint/suspicious/noArrayIndexKey: header cells positional
|
|
23047
|
-
/* @__PURE__ */
|
|
23048
|
-
))), /* @__PURE__ */
|
|
23141
|
+
/* @__PURE__ */ React45.createElement(React45.Fragment, { key: `h-${i}` }, /* @__PURE__ */ React45.createElement(Text38, { bold: true, color: FG.sub }, padToCells(cell, widths[i])), i < colCount - 1 ? /* @__PURE__ */ React45.createElement(Text38, null, gap) : null)
|
|
23142
|
+
))), /* @__PURE__ */ React45.createElement(Box37, null, /* @__PURE__ */ React45.createElement(Text38, null, " "), /* @__PURE__ */ React45.createElement(Text38, { color: FG.faint }, ruleRow)), bodyCells.map((row3, ri) => (
|
|
23049
23143
|
// biome-ignore lint/suspicious/noArrayIndexKey: body rows positional
|
|
23050
|
-
/* @__PURE__ */
|
|
23144
|
+
/* @__PURE__ */ React45.createElement(Box37, { key: `tr-${ri}` }, /* @__PURE__ */ React45.createElement(Text38, null, " "), row3.map((cell, i) => (
|
|
23051
23145
|
// biome-ignore lint/suspicious/noArrayIndexKey: cells positional
|
|
23052
|
-
/* @__PURE__ */
|
|
23146
|
+
/* @__PURE__ */ React45.createElement(React45.Fragment, { key: `c-${ri}-${i}` }, /* @__PURE__ */ React45.createElement(Text38, { color: FG.body }, padToCells(cell ?? "", widths[i])), i < colCount - 1 ? /* @__PURE__ */ React45.createElement(Text38, null, gap) : null)
|
|
23053
23147
|
)))
|
|
23054
23148
|
)));
|
|
23055
23149
|
}
|
|
@@ -23059,20 +23153,20 @@ function FallbackTable({
|
|
|
23059
23153
|
labelPad,
|
|
23060
23154
|
valueCells
|
|
23061
23155
|
}) {
|
|
23062
|
-
return /* @__PURE__ */
|
|
23156
|
+
return /* @__PURE__ */ React45.createElement(Box37, { flexDirection: "column" }, bodyCells.map((row3, ri) => (
|
|
23063
23157
|
// biome-ignore lint/suspicious/noArrayIndexKey: body rows positional
|
|
23064
|
-
/* @__PURE__ */
|
|
23158
|
+
/* @__PURE__ */ React45.createElement(Box37, { key: `fr-${ri}`, flexDirection: "column" }, ri > 0 ? /* @__PURE__ */ React45.createElement(Text38, null, " ") : null, headerCells.map((h, ci) => {
|
|
23065
23159
|
const label = `${padToCells(h, labelPad - 2)}: `;
|
|
23066
23160
|
const lines = wrapToCells(row3[ci] ?? "", valueCells);
|
|
23067
23161
|
return lines.map((line, li) => (
|
|
23068
23162
|
// biome-ignore lint/suspicious/noArrayIndexKey: fallback table lines are positional
|
|
23069
|
-
/* @__PURE__ */
|
|
23163
|
+
/* @__PURE__ */ React45.createElement(Box37, { key: `fc-${ri}-${ci}-${li}` }, li === 0 ? /* @__PURE__ */ React45.createElement(Text38, { bold: true, color: FG.sub }, label) : /* @__PURE__ */ React45.createElement(Text38, null, padToCells("", labelPad)), /* @__PURE__ */ React45.createElement(Text38, { color: FG.body }, line))
|
|
23070
23164
|
));
|
|
23071
23165
|
}))
|
|
23072
23166
|
)));
|
|
23073
23167
|
}
|
|
23074
23168
|
function Inline({ tokens }) {
|
|
23075
|
-
return /* @__PURE__ */
|
|
23169
|
+
return /* @__PURE__ */ React45.createElement(React45.Fragment, null, tokens.map((tok, i) => /* @__PURE__ */ React45.createElement(InlineToken, { key: `${i}-${tok.type}`, token: tok })));
|
|
23076
23170
|
}
|
|
23077
23171
|
var FILE_REF_RE2 = /\b([A-Za-z0-9_./@\-]+\.[A-Za-z0-9]{1,6})(?::(\d+)(?:-(\d+))?)?\b/g;
|
|
23078
23172
|
var MENTION_RE = /(?<![A-Za-z0-9_])@([A-Za-z0-9_./\-]+\.[A-Za-z0-9]{1,6})/g;
|
|
@@ -23083,10 +23177,10 @@ function looksLikeFileRef(path6, hasLine) {
|
|
|
23083
23177
|
return ext.length >= 2;
|
|
23084
23178
|
}
|
|
23085
23179
|
function osc8(label, _target, color2) {
|
|
23086
|
-
return /* @__PURE__ */
|
|
23180
|
+
return /* @__PURE__ */ React45.createElement(Text38, { color: color2, underline: true }, label);
|
|
23087
23181
|
}
|
|
23088
23182
|
function renderInlineText(raw) {
|
|
23089
|
-
if (!raw) return /* @__PURE__ */
|
|
23183
|
+
if (!raw) return /* @__PURE__ */ React45.createElement(Text38, null, raw);
|
|
23090
23184
|
const out = [];
|
|
23091
23185
|
let cursor = 0;
|
|
23092
23186
|
const hits = [];
|
|
@@ -23097,7 +23191,7 @@ function renderInlineText(raw) {
|
|
|
23097
23191
|
hits.push({
|
|
23098
23192
|
start,
|
|
23099
23193
|
end,
|
|
23100
|
-
node: /* @__PURE__ */
|
|
23194
|
+
node: /* @__PURE__ */ React45.createElement(Text38, { color: TONE.warn, underline: true }, `@${path6}`)
|
|
23101
23195
|
});
|
|
23102
23196
|
}
|
|
23103
23197
|
for (const m of raw.matchAll(FILE_REF_RE2)) {
|
|
@@ -23114,44 +23208,44 @@ function renderInlineText(raw) {
|
|
|
23114
23208
|
let key = 0;
|
|
23115
23209
|
for (const h of hits) {
|
|
23116
23210
|
if (h.start > cursor) {
|
|
23117
|
-
out.push(/* @__PURE__ */
|
|
23211
|
+
out.push(/* @__PURE__ */ React45.createElement(Text38, { key: `t-${key++}` }, raw.slice(cursor, h.start)));
|
|
23118
23212
|
}
|
|
23119
|
-
out.push(/* @__PURE__ */
|
|
23213
|
+
out.push(/* @__PURE__ */ React45.createElement(React45.Fragment, { key: `r-${key++}` }, h.node));
|
|
23120
23214
|
cursor = h.end;
|
|
23121
23215
|
}
|
|
23122
|
-
if (cursor < raw.length) out.push(/* @__PURE__ */
|
|
23123
|
-
return /* @__PURE__ */
|
|
23216
|
+
if (cursor < raw.length) out.push(/* @__PURE__ */ React45.createElement(Text38, { key: `t-${key++}` }, raw.slice(cursor)));
|
|
23217
|
+
return /* @__PURE__ */ React45.createElement(React45.Fragment, null, out);
|
|
23124
23218
|
}
|
|
23125
23219
|
function InlineToken({ token }) {
|
|
23126
23220
|
switch (token.type) {
|
|
23127
23221
|
case "text": {
|
|
23128
23222
|
const t3 = token;
|
|
23129
|
-
return t3.tokens ? /* @__PURE__ */
|
|
23223
|
+
return t3.tokens ? /* @__PURE__ */ React45.createElement(Inline, { tokens: t3.tokens }) : renderInlineText(t3.text);
|
|
23130
23224
|
}
|
|
23131
23225
|
case "strong":
|
|
23132
|
-
return /* @__PURE__ */
|
|
23226
|
+
return /* @__PURE__ */ React45.createElement(Text38, { bold: true, color: FG.strong }, /* @__PURE__ */ React45.createElement(Inline, { tokens: token.tokens }));
|
|
23133
23227
|
case "em":
|
|
23134
|
-
return /* @__PURE__ */
|
|
23228
|
+
return /* @__PURE__ */ React45.createElement(Text38, { italic: true }, /* @__PURE__ */ React45.createElement(Inline, { tokens: token.tokens }));
|
|
23135
23229
|
case "codespan":
|
|
23136
|
-
return /* @__PURE__ */
|
|
23230
|
+
return /* @__PURE__ */ React45.createElement(Text38, { color: FG.strong, backgroundColor: SURFACE.bgElev }, ` ${token.text} `);
|
|
23137
23231
|
case "del":
|
|
23138
|
-
return /* @__PURE__ */
|
|
23232
|
+
return /* @__PURE__ */ React45.createElement(Text38, { color: TONE.err, strikethrough: true }, /* @__PURE__ */ React45.createElement(Inline, { tokens: token.tokens }));
|
|
23139
23233
|
case "link": {
|
|
23140
23234
|
const l = token;
|
|
23141
|
-
return /* @__PURE__ */
|
|
23235
|
+
return /* @__PURE__ */ React45.createElement(Text38, { color: TONE.brand, underline: true }, /* @__PURE__ */ React45.createElement(Inline, { tokens: l.tokens }));
|
|
23142
23236
|
}
|
|
23143
23237
|
case "image": {
|
|
23144
23238
|
const im = token;
|
|
23145
|
-
return /* @__PURE__ */
|
|
23239
|
+
return /* @__PURE__ */ React45.createElement(Text38, { color: TONE.brand }, `[image: ${im.text || im.href}]`);
|
|
23146
23240
|
}
|
|
23147
23241
|
case "br":
|
|
23148
|
-
return /* @__PURE__ */
|
|
23242
|
+
return /* @__PURE__ */ React45.createElement(Text38, null, "\n");
|
|
23149
23243
|
case "escape":
|
|
23150
|
-
return /* @__PURE__ */
|
|
23244
|
+
return /* @__PURE__ */ React45.createElement(Text38, null, token.text);
|
|
23151
23245
|
case "html":
|
|
23152
|
-
return /* @__PURE__ */
|
|
23246
|
+
return /* @__PURE__ */ React45.createElement(Text38, null, token.text);
|
|
23153
23247
|
default:
|
|
23154
|
-
return /* @__PURE__ */
|
|
23248
|
+
return /* @__PURE__ */ React45.createElement(Text38, null, token.raw ?? "");
|
|
23155
23249
|
}
|
|
23156
23250
|
}
|
|
23157
23251
|
function plainText(tokens) {
|
|
@@ -23204,7 +23298,7 @@ function tokenRate(text, startTs, endTs) {
|
|
|
23204
23298
|
}
|
|
23205
23299
|
var PILL_RATE = { bg: "#11141a", fg: "#8b949e" };
|
|
23206
23300
|
function StreamingCard({ card }) {
|
|
23207
|
-
const { stdout: stdout4 } =
|
|
23301
|
+
const { stdout: stdout4 } = useStdout9();
|
|
23208
23302
|
const cols = stdout4?.columns ?? 80;
|
|
23209
23303
|
const expanded = useContext5(LiveExpandContext);
|
|
23210
23304
|
const reserveCap = expanded ? EXPANDED_MAX_LINES + 2 : STREAMING_PREVIEW_LINES2 + 2;
|
|
@@ -23214,19 +23308,19 @@ function StreamingCard({ card }) {
|
|
|
23214
23308
|
});
|
|
23215
23309
|
useSlowTick();
|
|
23216
23310
|
const modelBadge = card.model ? modelBadgeFor(card.model) : null;
|
|
23217
|
-
const modelPill = modelBadge ? /* @__PURE__ */
|
|
23311
|
+
const modelPill = modelBadge ? /* @__PURE__ */ React46.createElement(Pill, { label: modelBadge.label, ...PILL_MODEL[modelBadge.kind], bold: false }) : null;
|
|
23218
23312
|
if (card.done && !card.aborted) {
|
|
23219
23313
|
const { tokens, tps } = tokenRate(card.text, card.ts, card.endedAt ?? Date.now());
|
|
23220
|
-
const ratePill = tokens >= MIN_TOKENS_FOR_RATE && tps !== null ? /* @__PURE__ */
|
|
23221
|
-
return /* @__PURE__ */
|
|
23314
|
+
const ratePill = tokens >= MIN_TOKENS_FOR_RATE && tps !== null ? /* @__PURE__ */ React46.createElement(Pill, { label: `${formatTokenCount(tokens)} tok \xB7 ${tps} t/s`, ...PILL_RATE, bold: false }) : null;
|
|
23315
|
+
return /* @__PURE__ */ React46.createElement(Card, { tone: TONE.ok }, /* @__PURE__ */ React46.createElement(
|
|
23222
23316
|
CardHeader,
|
|
23223
23317
|
{
|
|
23224
23318
|
glyph: "\u2039",
|
|
23225
23319
|
tone: TONE.ok,
|
|
23226
23320
|
title: "reply",
|
|
23227
|
-
right: /* @__PURE__ */
|
|
23321
|
+
right: /* @__PURE__ */ React46.createElement(React46.Fragment, null, ratePill, modelPill)
|
|
23228
23322
|
}
|
|
23229
|
-
), /* @__PURE__ */
|
|
23323
|
+
), /* @__PURE__ */ React46.createElement(Markdown, { text: card.text }));
|
|
23230
23324
|
}
|
|
23231
23325
|
const lineCells = Math.max(20, cols - 4);
|
|
23232
23326
|
const allLines = card.text.length > 0 ? card.text.split("\n") : [""];
|
|
@@ -23239,28 +23333,28 @@ function StreamingCard({ card }) {
|
|
|
23239
23333
|
const glyph = aborted ? "\u2039" : "\u25C8";
|
|
23240
23334
|
const headLabel = aborted ? "aborted" : "writing\u2026";
|
|
23241
23335
|
const { tokens: liveTokens, tps: liveTps } = tokenRate(card.text, card.ts, Date.now());
|
|
23242
|
-
const liveRatePill = !aborted && liveTokens >= MIN_TOKENS_FOR_RATE && liveTps !== null ? /* @__PURE__ */
|
|
23243
|
-
const expandPill = !aborted ? /* @__PURE__ */
|
|
23244
|
-
return /* @__PURE__ */
|
|
23336
|
+
const liveRatePill = !aborted && liveTokens >= MIN_TOKENS_FOR_RATE && liveTps !== null ? /* @__PURE__ */ React46.createElement(Pill, { label: `${liveTps} t/s`, ...PILL_RATE, bold: false }) : null;
|
|
23337
|
+
const expandPill = !aborted ? /* @__PURE__ */ React46.createElement(Pill, { label: expanded ? "expanded \u2303o" : "preview \u2303o", ...PILL_RATE, bold: false }) : null;
|
|
23338
|
+
return /* @__PURE__ */ React46.createElement(Card, { tone: headColor }, /* @__PURE__ */ React46.createElement(
|
|
23245
23339
|
CardHeader,
|
|
23246
23340
|
{
|
|
23247
23341
|
glyph,
|
|
23248
23342
|
tone: headColor,
|
|
23249
23343
|
title: headLabel,
|
|
23250
|
-
right: /* @__PURE__ */
|
|
23344
|
+
right: /* @__PURE__ */ React46.createElement(React46.Fragment, null, liveRatePill, expandPill, aborted ? null : /* @__PURE__ */ React46.createElement(Spinner, { kind: "braille", color: TONE_ACTIVE.brand }), modelPill)
|
|
23251
23345
|
}
|
|
23252
|
-
), expanded && droppedAbove > 0 ? /* @__PURE__ */
|
|
23253
|
-
|
|
23346
|
+
), expanded && droppedAbove > 0 ? /* @__PURE__ */ React46.createElement(
|
|
23347
|
+
Text39,
|
|
23254
23348
|
{
|
|
23255
23349
|
color: FG.faint
|
|
23256
23350
|
},
|
|
23257
23351
|
`\u22EF ${droppedAbove} earlier line${droppedAbove === 1 ? "" : "s"} above`
|
|
23258
|
-
) : null, visible.map((line, i) => /* @__PURE__ */
|
|
23352
|
+
) : null, visible.map((line, i) => /* @__PURE__ */ React46.createElement(Box38, { key: `${card.id}:${visualLines.length - visible.length + i}`, flexDirection: "row" }, /* @__PURE__ */ React46.createElement(Text39, { color: aborted ? FG.meta : FG.body }, clipToCells(line, lineCells)))), aborted ? /* @__PURE__ */ React46.createElement(Text39, { color: FG.faint }, "[truncated by esc]") : null);
|
|
23259
23353
|
}
|
|
23260
23354
|
|
|
23261
23355
|
// src/cli/ui/cards/SubAgentCard.tsx
|
|
23262
|
-
import { Box as
|
|
23263
|
-
import
|
|
23356
|
+
import { Box as Box39, Text as Text40 } from "ink";
|
|
23357
|
+
import React47, { useContext as useContext6 } from "react";
|
|
23264
23358
|
var STATUS_COLOR2 = {
|
|
23265
23359
|
running: TONE_ACTIVE.violet,
|
|
23266
23360
|
done: TONE.ok,
|
|
@@ -23273,7 +23367,7 @@ function SubAgentCard({ card }) {
|
|
|
23273
23367
|
const isRunning = card.status === "running";
|
|
23274
23368
|
const inLive = useContext6(ActiveCardContext);
|
|
23275
23369
|
const headerMeta2 = isRunning ? runningChildren > 0 ? [`${runningChildren} running`] : ["working"] : [{ text: card.status, color: headColor }];
|
|
23276
|
-
return /* @__PURE__ */
|
|
23370
|
+
return /* @__PURE__ */ React47.createElement(Card, { tone: headColor }, /* @__PURE__ */ React47.createElement(
|
|
23277
23371
|
CardHeader,
|
|
23278
23372
|
{
|
|
23279
23373
|
glyph: headGlyph,
|
|
@@ -23283,7 +23377,7 @@ function SubAgentCard({ card }) {
|
|
|
23283
23377
|
subtitle: card.task,
|
|
23284
23378
|
meta: headerMeta2
|
|
23285
23379
|
}
|
|
23286
|
-
), card.name ? /* @__PURE__ */
|
|
23380
|
+
), card.name ? /* @__PURE__ */ React47.createElement(Text40, { color: FG.faint }, `agent \xB7 ${card.name}`) : null, card.tools && card.tools.length > 0 && /* @__PURE__ */ React47.createElement(Text40, { color: FG.faint }, `tools \xB7 ${card.tools.join(", ")}`), card.children.map((child) => /* @__PURE__ */ React47.createElement(Box39, { key: child.id, flexDirection: "row", gap: 1 }, inLive ? null : /* @__PURE__ */ React47.createElement(Text40, { color: TONE.violet }, "\u258E"), /* @__PURE__ */ React47.createElement(ChildRow, { card: child }))));
|
|
23287
23381
|
}
|
|
23288
23382
|
function isChildDone(card) {
|
|
23289
23383
|
switch (card.kind) {
|
|
@@ -23299,16 +23393,16 @@ function isChildDone(card) {
|
|
|
23299
23393
|
function ChildRow({ card }) {
|
|
23300
23394
|
const v = childVisual(card);
|
|
23301
23395
|
const isDone = isChildDone(card);
|
|
23302
|
-
return /* @__PURE__ */
|
|
23396
|
+
return /* @__PURE__ */ React47.createElement(React47.Fragment, null, v.statusGlyph, /* @__PURE__ */ React47.createElement(Text40, { color: v.kindColor }, v.kindGlyph), /* @__PURE__ */ React47.createElement(Text40, { dimColor: isDone, color: FG.body }, v.text));
|
|
23303
23397
|
}
|
|
23304
23398
|
function runningGlyph(color2) {
|
|
23305
|
-
return /* @__PURE__ */
|
|
23399
|
+
return /* @__PURE__ */ React47.createElement(Spinner, { kind: "circle", color: color2 });
|
|
23306
23400
|
}
|
|
23307
23401
|
function doneGlyph(color2) {
|
|
23308
|
-
return /* @__PURE__ */
|
|
23402
|
+
return /* @__PURE__ */ React47.createElement(Text40, { color: color2 }, "\u2713");
|
|
23309
23403
|
}
|
|
23310
23404
|
function failedGlyph() {
|
|
23311
|
-
return /* @__PURE__ */
|
|
23405
|
+
return /* @__PURE__ */ React47.createElement(Text40, { color: TONE.err }, "\u2716");
|
|
23312
23406
|
}
|
|
23313
23407
|
function childVisual(card) {
|
|
23314
23408
|
switch (card.kind) {
|
|
@@ -23353,7 +23447,7 @@ function childVisual(card) {
|
|
|
23353
23447
|
};
|
|
23354
23448
|
default:
|
|
23355
23449
|
return {
|
|
23356
|
-
statusGlyph: /* @__PURE__ */
|
|
23450
|
+
statusGlyph: /* @__PURE__ */ React47.createElement(Text40, { color: FG.faint }, "\xB7"),
|
|
23357
23451
|
kindGlyph: "\xB7",
|
|
23358
23452
|
kindColor: FG.faint,
|
|
23359
23453
|
text: card.kind
|
|
@@ -23362,8 +23456,8 @@ function childVisual(card) {
|
|
|
23362
23456
|
}
|
|
23363
23457
|
|
|
23364
23458
|
// src/cli/ui/cards/TaskCard.tsx
|
|
23365
|
-
import { Box as
|
|
23366
|
-
import
|
|
23459
|
+
import { Box as Box40, Text as Text41 } from "ink";
|
|
23460
|
+
import React48 from "react";
|
|
23367
23461
|
var STEP_GLYPH = {
|
|
23368
23462
|
queued: "\u25CB",
|
|
23369
23463
|
running: "\u25B6",
|
|
@@ -23388,7 +23482,7 @@ var TASK_GLYPH = {
|
|
|
23388
23482
|
};
|
|
23389
23483
|
function TaskCard({ card }) {
|
|
23390
23484
|
const elapsed = `${(card.elapsedMs / 1e3).toFixed(1)}s`;
|
|
23391
|
-
return /* @__PURE__ */
|
|
23485
|
+
return /* @__PURE__ */ React48.createElement(Card, { tone: TASK_COLOR[card.status] }, /* @__PURE__ */ React48.createElement(
|
|
23392
23486
|
CardHeader,
|
|
23393
23487
|
{
|
|
23394
23488
|
glyph: TASK_GLYPH[card.status],
|
|
@@ -23397,12 +23491,12 @@ function TaskCard({ card }) {
|
|
|
23397
23491
|
subtitle: card.title,
|
|
23398
23492
|
meta: [elapsed, card.status]
|
|
23399
23493
|
}
|
|
23400
|
-
), card.steps.map((step) => /* @__PURE__ */
|
|
23494
|
+
), card.steps.map((step) => /* @__PURE__ */ React48.createElement(Box40, { key: step.id, flexDirection: "row", gap: 1 }, /* @__PURE__ */ React48.createElement(Text41, { color: STEP_COLOR[step.status] }, STEP_GLYPH[step.status]), /* @__PURE__ */ React48.createElement(Text41, { bold: true, color: FG.body }, (step.toolName ?? "step").padEnd(7)), /* @__PURE__ */ React48.createElement(Text41, { color: FG.sub }, step.title), step.detail ? /* @__PURE__ */ React48.createElement(Text41, { color: FG.faint }, step.detail) : null, step.elapsedMs !== void 0 ? /* @__PURE__ */ React48.createElement(Text41, { color: FG.faint }, `${(step.elapsedMs / 1e3).toFixed(2)}s`) : null)));
|
|
23401
23495
|
}
|
|
23402
23496
|
|
|
23403
23497
|
// src/cli/ui/cards/ToolCard.tsx
|
|
23404
|
-
import { Text as
|
|
23405
|
-
import
|
|
23498
|
+
import { Text as Text42, useStdout as useStdout10 } from "ink";
|
|
23499
|
+
import React49 from "react";
|
|
23406
23500
|
var READ_TAIL = 2;
|
|
23407
23501
|
var OTHER_TAIL = 5;
|
|
23408
23502
|
function tailLinesFor(name) {
|
|
@@ -23410,7 +23504,7 @@ function tailLinesFor(name) {
|
|
|
23410
23504
|
return /(?:^|_)(read|search|list|tree|get|status|diff|fetch|grep)(_|$)/.test(lower) || lower === "job_output" ? READ_TAIL : OTHER_TAIL;
|
|
23411
23505
|
}
|
|
23412
23506
|
function ToolCard({ card }) {
|
|
23413
|
-
const { stdout: stdout4 } =
|
|
23507
|
+
const { stdout: stdout4 } = useStdout10();
|
|
23414
23508
|
const cols = stdout4?.columns ?? 80;
|
|
23415
23509
|
const lineCells = Math.max(20, cols - 4);
|
|
23416
23510
|
const argsLabel = formatArgsSummary(card.args);
|
|
@@ -23431,7 +23525,7 @@ function ToolCard({ card }) {
|
|
|
23431
23525
|
meta.push({ text: "rejected", color: TONE.err });
|
|
23432
23526
|
}
|
|
23433
23527
|
for (const part of metaTrail(card)) meta.push(part);
|
|
23434
|
-
return /* @__PURE__ */
|
|
23528
|
+
return /* @__PURE__ */ React49.createElement(Card, { tone: headColor }, /* @__PURE__ */ React49.createElement(
|
|
23435
23529
|
CardHeader,
|
|
23436
23530
|
{
|
|
23437
23531
|
glyph: statusGlyph2(status3),
|
|
@@ -23439,10 +23533,10 @@ function ToolCard({ card }) {
|
|
|
23439
23533
|
title: card.name,
|
|
23440
23534
|
subtitle: argsLabel || void 0,
|
|
23441
23535
|
meta: meta.length > 0 ? meta : void 0,
|
|
23442
|
-
right: status3 === "running" ? /* @__PURE__ */
|
|
23536
|
+
right: status3 === "running" ? /* @__PURE__ */ React49.createElement(Spinner, { kind: "braille", color: TONE_ACTIVE.brand, bold: true }) : void 0
|
|
23443
23537
|
}
|
|
23444
|
-
), showBody && /* @__PURE__ */
|
|
23445
|
-
|
|
23538
|
+
), showBody && /* @__PURE__ */ React49.createElement(React49.Fragment, null, hidden > 0 ? /* @__PURE__ */ React49.createElement(Text42, { color: FG.faint }, `\u22EE ${hidden} earlier line${hidden === 1 ? "" : "s"} (use /tool to read full)`) : null, visible.map((line, i) => /* @__PURE__ */ React49.createElement(
|
|
23539
|
+
Text42,
|
|
23446
23540
|
{
|
|
23447
23541
|
key: `${card.id}:${hidden + i}`,
|
|
23448
23542
|
color: errColor,
|
|
@@ -23528,8 +23622,8 @@ function formatBytes(n) {
|
|
|
23528
23622
|
}
|
|
23529
23623
|
|
|
23530
23624
|
// src/cli/ui/cards/UsageCard.tsx
|
|
23531
|
-
import { Box as
|
|
23532
|
-
import
|
|
23625
|
+
import { Box as Box42, Text as Text43 } from "ink";
|
|
23626
|
+
import React50 from "react";
|
|
23533
23627
|
var BAR_CELLS3 = 30;
|
|
23534
23628
|
function compactNum(n) {
|
|
23535
23629
|
if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
|
|
@@ -23539,25 +23633,25 @@ function compactNum(n) {
|
|
|
23539
23633
|
function bar(ratio, color2) {
|
|
23540
23634
|
const filled = Math.max(0, Math.min(BAR_CELLS3, Math.round(ratio * BAR_CELLS3)));
|
|
23541
23635
|
const empty = BAR_CELLS3 - filled;
|
|
23542
|
-
return /* @__PURE__ */
|
|
23636
|
+
return /* @__PURE__ */ React50.createElement(React50.Fragment, null, /* @__PURE__ */ React50.createElement(Text43, { color: color2 }, "\u2588".repeat(filled)), /* @__PURE__ */ React50.createElement(Text43, { color: FG.faint }, "\u2591".repeat(empty)));
|
|
23543
23637
|
}
|
|
23544
23638
|
function UsageCard({ card }) {
|
|
23545
|
-
if (card.compact) return /* @__PURE__ */
|
|
23639
|
+
if (card.compact) return /* @__PURE__ */ React50.createElement(CompactUsageRow, { card });
|
|
23546
23640
|
const cap = Math.max(1, card.tokens.promptCap);
|
|
23547
23641
|
const promptRatio = card.tokens.prompt / cap;
|
|
23548
23642
|
const reasonRatio = card.tokens.reason / cap;
|
|
23549
23643
|
const outputRatio = card.tokens.output / cap;
|
|
23550
23644
|
const headerMeta2 = [`turn ${card.turn}`, formatCost(card.cost, card.balanceCurrency)];
|
|
23551
23645
|
if (card.elapsedMs !== void 0) headerMeta2.push(`${(card.elapsedMs / 1e3).toFixed(1)}s`);
|
|
23552
|
-
return /* @__PURE__ */
|
|
23646
|
+
return /* @__PURE__ */ React50.createElement(Card, { tone: FG.meta }, /* @__PURE__ */ React50.createElement(CardHeader, { glyph: "\u03A3", tone: FG.meta, title: "usage", meta: headerMeta2 }), /* @__PURE__ */ React50.createElement(Box42, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React50.createElement(Text43, { color: FG.sub }, "prompt"), bar(promptRatio, TONE.brand), /* @__PURE__ */ React50.createElement(Text43, { bold: true, color: FG.body }, card.tokens.prompt.toLocaleString()), /* @__PURE__ */ React50.createElement(Text43, { color: FG.faint }, `/ 1M \xB7 ${(promptRatio * 100).toFixed(1)}%`)), /* @__PURE__ */ React50.createElement(Box42, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React50.createElement(Text43, { color: FG.sub }, "reason"), bar(reasonRatio, TONE.accent), /* @__PURE__ */ React50.createElement(Text43, { bold: true, color: FG.body }, card.tokens.reason.toLocaleString())), /* @__PURE__ */ React50.createElement(Box42, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React50.createElement(Text43, { color: FG.sub }, "output"), bar(outputRatio, TONE.brand), /* @__PURE__ */ React50.createElement(Text43, { bold: true, color: FG.body }, card.tokens.output.toLocaleString())), /* @__PURE__ */ React50.createElement(Box42, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React50.createElement(Text43, { color: FG.sub }, "cache "), bar(card.cacheHit, TONE.ok), /* @__PURE__ */ React50.createElement(Text43, { bold: true, color: TONE.ok }, `${(card.cacheHit * 100).toFixed(1)}%`)), /* @__PURE__ */ React50.createElement(Box42, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ React50.createElement(Text43, { color: FG.faint }, "session"), /* @__PURE__ */ React50.createElement(Text43, { bold: true, color: FG.body }, `\u26C1 ${formatCost(card.sessionCost, card.balanceCurrency, 3)}`), card.balance !== void 0 ? /* @__PURE__ */ React50.createElement(React50.Fragment, null, /* @__PURE__ */ React50.createElement(Text43, { color: FG.faint }, "\xB7 balance"), /* @__PURE__ */ React50.createElement(Text43, { bold: true, color: TONE.brand }, formatBalance(card.balance, card.balanceCurrency))) : null));
|
|
23553
23647
|
}
|
|
23554
23648
|
function CompactUsageRow({ card }) {
|
|
23555
23649
|
const elapsed = card.elapsedMs !== void 0 ? ` \xB7 ${(card.elapsedMs / 1e3).toFixed(1)}s` : "";
|
|
23556
|
-
return /* @__PURE__ */
|
|
23650
|
+
return /* @__PURE__ */ React50.createElement(Box42, { flexDirection: "row", gap: 1, marginTop: 1 }, /* @__PURE__ */ React50.createElement(Text43, { color: FG.meta }, "\u03A3"), /* @__PURE__ */ React50.createElement(Text43, { color: FG.faint }, `turn ${card.turn}`), /* @__PURE__ */ React50.createElement(Text43, { color: FG.meta }, `\xB7 ${compactNum(card.tokens.prompt)} prompt \xB7 ${compactNum(card.tokens.output)} out`), /* @__PURE__ */ React50.createElement(Text43, { color: FG.faint }, "\xB7 cache"), /* @__PURE__ */ React50.createElement(Text43, { color: TONE.ok }, `${(card.cacheHit * 100).toFixed(0)}%`), /* @__PURE__ */ React50.createElement(Text43, { color: FG.faint }, `\xB7 ${formatCost(card.cost, card.balanceCurrency)}${elapsed}`), card.balance !== void 0 ? /* @__PURE__ */ React50.createElement(Text43, { color: TONE.brand }, `\xB7 ${formatBalance(card.balance, card.balanceCurrency)}`) : null);
|
|
23557
23651
|
}
|
|
23558
23652
|
|
|
23559
23653
|
// src/cli/ui/cards/UserCard.tsx
|
|
23560
|
-
import
|
|
23654
|
+
import React51 from "react";
|
|
23561
23655
|
|
|
23562
23656
|
// src/cli/ui/cards/time.ts
|
|
23563
23657
|
function formatRelativeTime(ts, now = Date.now()) {
|
|
@@ -23574,7 +23668,7 @@ function formatRelativeTime(ts, now = Date.now()) {
|
|
|
23574
23668
|
|
|
23575
23669
|
// src/cli/ui/cards/UserCard.tsx
|
|
23576
23670
|
function UserCard({ card }) {
|
|
23577
|
-
return /* @__PURE__ */
|
|
23671
|
+
return /* @__PURE__ */ React51.createElement(Card, { tone: TONE.accent }, /* @__PURE__ */ React51.createElement(
|
|
23578
23672
|
CardHeader,
|
|
23579
23673
|
{
|
|
23580
23674
|
glyph: "\u203A",
|
|
@@ -23583,15 +23677,15 @@ function UserCard({ card }) {
|
|
|
23583
23677
|
titleColor: FG.sub,
|
|
23584
23678
|
meta: [formatRelativeTime(card.ts)]
|
|
23585
23679
|
}
|
|
23586
|
-
), /* @__PURE__ */
|
|
23680
|
+
), /* @__PURE__ */ React51.createElement(Markdown, { text: card.text }));
|
|
23587
23681
|
}
|
|
23588
23682
|
|
|
23589
23683
|
// src/cli/ui/cards/WarnCard.tsx
|
|
23590
|
-
import { Text as
|
|
23591
|
-
import
|
|
23684
|
+
import { Text as Text44 } from "ink";
|
|
23685
|
+
import React52 from "react";
|
|
23592
23686
|
function WarnCard({ card }) {
|
|
23593
23687
|
const messageLines = card.message.length > 0 ? card.message.split("\n") : [];
|
|
23594
|
-
return /* @__PURE__ */
|
|
23688
|
+
return /* @__PURE__ */ React52.createElement(Card, { tone: TONE.warn }, /* @__PURE__ */ React52.createElement(
|
|
23595
23689
|
CardHeader,
|
|
23596
23690
|
{
|
|
23597
23691
|
glyph: "\u26A0",
|
|
@@ -23599,57 +23693,57 @@ function WarnCard({ card }) {
|
|
|
23599
23693
|
title: card.title,
|
|
23600
23694
|
meta: card.detail ? [card.detail] : void 0
|
|
23601
23695
|
}
|
|
23602
|
-
), messageLines.map((line, i) => /* @__PURE__ */
|
|
23696
|
+
), messageLines.map((line, i) => /* @__PURE__ */ React52.createElement(Text44, { key: `${card.id}:${i}`, color: FG.body }, line || " ")));
|
|
23603
23697
|
}
|
|
23604
23698
|
|
|
23605
23699
|
// src/cli/ui/cards/CardRenderer.tsx
|
|
23606
|
-
var CardRenderer =
|
|
23700
|
+
var CardRenderer = React53.memo(function CardRenderer2({
|
|
23607
23701
|
card
|
|
23608
23702
|
}) {
|
|
23609
|
-
return /* @__PURE__ */
|
|
23703
|
+
return /* @__PURE__ */ React53.createElement(Box43, { flexDirection: "column" }, renderCard(card));
|
|
23610
23704
|
});
|
|
23611
23705
|
function renderCard(card) {
|
|
23612
23706
|
switch (card.kind) {
|
|
23613
23707
|
case "user":
|
|
23614
|
-
return /* @__PURE__ */
|
|
23708
|
+
return /* @__PURE__ */ React53.createElement(UserCard, { card });
|
|
23615
23709
|
case "reasoning":
|
|
23616
|
-
return /* @__PURE__ */
|
|
23710
|
+
return /* @__PURE__ */ React53.createElement(ReasoningCard, { card, expanded: true });
|
|
23617
23711
|
case "streaming":
|
|
23618
|
-
return /* @__PURE__ */
|
|
23712
|
+
return /* @__PURE__ */ React53.createElement(StreamingCard, { card });
|
|
23619
23713
|
case "tool":
|
|
23620
|
-
return /* @__PURE__ */
|
|
23714
|
+
return /* @__PURE__ */ React53.createElement(ToolCard, { card });
|
|
23621
23715
|
case "task":
|
|
23622
|
-
return /* @__PURE__ */
|
|
23716
|
+
return /* @__PURE__ */ React53.createElement(TaskCard, { card });
|
|
23623
23717
|
case "plan":
|
|
23624
|
-
return /* @__PURE__ */
|
|
23718
|
+
return /* @__PURE__ */ React53.createElement(PlanCard, { card });
|
|
23625
23719
|
case "diff":
|
|
23626
|
-
return /* @__PURE__ */
|
|
23720
|
+
return /* @__PURE__ */ React53.createElement(DiffCard, { card });
|
|
23627
23721
|
case "error":
|
|
23628
|
-
return /* @__PURE__ */
|
|
23722
|
+
return /* @__PURE__ */ React53.createElement(ErrorCard, { card });
|
|
23629
23723
|
case "warn":
|
|
23630
|
-
return /* @__PURE__ */
|
|
23724
|
+
return /* @__PURE__ */ React53.createElement(WarnCard, { card });
|
|
23631
23725
|
case "usage":
|
|
23632
|
-
return /* @__PURE__ */
|
|
23726
|
+
return /* @__PURE__ */ React53.createElement(UsageCard, { card });
|
|
23633
23727
|
case "memory":
|
|
23634
|
-
return /* @__PURE__ */
|
|
23728
|
+
return /* @__PURE__ */ React53.createElement(MemoryCard, { card });
|
|
23635
23729
|
case "subagent":
|
|
23636
|
-
return /* @__PURE__ */
|
|
23730
|
+
return /* @__PURE__ */ React53.createElement(SubAgentCard, { card });
|
|
23637
23731
|
case "search":
|
|
23638
|
-
return /* @__PURE__ */
|
|
23732
|
+
return /* @__PURE__ */ React53.createElement(SearchCard, { card });
|
|
23639
23733
|
case "live":
|
|
23640
|
-
return /* @__PURE__ */
|
|
23734
|
+
return /* @__PURE__ */ React53.createElement(LiveCard, { card });
|
|
23641
23735
|
case "ctx":
|
|
23642
|
-
return /* @__PURE__ */
|
|
23736
|
+
return /* @__PURE__ */ React53.createElement(CtxCard, { card });
|
|
23643
23737
|
case "doctor":
|
|
23644
|
-
return /* @__PURE__ */
|
|
23738
|
+
return /* @__PURE__ */ React53.createElement(DoctorCard, { card });
|
|
23645
23739
|
case "branch":
|
|
23646
|
-
return /* @__PURE__ */
|
|
23740
|
+
return /* @__PURE__ */ React53.createElement(BranchCard, { card });
|
|
23647
23741
|
default:
|
|
23648
|
-
return /* @__PURE__ */
|
|
23742
|
+
return /* @__PURE__ */ React53.createElement(FallbackCard, { card });
|
|
23649
23743
|
}
|
|
23650
23744
|
}
|
|
23651
23745
|
function FallbackCard({ card }) {
|
|
23652
|
-
return /* @__PURE__ */
|
|
23746
|
+
return /* @__PURE__ */ React53.createElement(Box43, { flexDirection: "row" }, /* @__PURE__ */ React53.createElement(Text45, { color: FG.faint }, ` \xB7 ${card.kind} card \xB7 not yet migrated`));
|
|
23653
23747
|
}
|
|
23654
23748
|
|
|
23655
23749
|
// src/cli/ui/layout/CardStream.tsx
|
|
@@ -23671,7 +23765,7 @@ function CardStream({
|
|
|
23671
23765
|
if (suppressLive && cards.length > 0 && !isFullySettled(cards[cards.length - 1])) {
|
|
23672
23766
|
visible = cards.slice(0, -1);
|
|
23673
23767
|
}
|
|
23674
|
-
return /* @__PURE__ */
|
|
23768
|
+
return /* @__PURE__ */ React54.createElement(React54.Fragment, null, scrollRows > 0 ? /* @__PURE__ */ React54.createElement(Text46, { color: FG.faint }, " \u2191 earlier \u2014 PgUp / wheel / \u2191") : null, /* @__PURE__ */ React54.createElement(Box44, { ref: outerRef, flexDirection: "column", flexGrow: 1, overflow: "hidden" }, /* @__PURE__ */ React54.createElement(Box44, { ref: innerRef, flexDirection: "column", marginTop: -scrollRows, flexShrink: 0 }, visible.map((card) => /* @__PURE__ */ React54.createElement(CardRenderer, { key: card.id, card })))));
|
|
23675
23769
|
}
|
|
23676
23770
|
function isFullySettled(card) {
|
|
23677
23771
|
switch (card.kind) {
|
|
@@ -23692,12 +23786,12 @@ function isFullySettled(card) {
|
|
|
23692
23786
|
}
|
|
23693
23787
|
|
|
23694
23788
|
// src/cli/ui/layout/LiveRows.tsx
|
|
23695
|
-
import { Box as
|
|
23696
|
-
import
|
|
23789
|
+
import { Box as Box45, Text as Text47, useStdout as useStdout11 } from "ink";
|
|
23790
|
+
import React55 from "react";
|
|
23697
23791
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
23698
23792
|
function ThinkingRow({ text }) {
|
|
23699
23793
|
const elapsed = useElapsedSeconds();
|
|
23700
|
-
return /* @__PURE__ */
|
|
23794
|
+
return /* @__PURE__ */ React55.createElement(Box45, { marginY: 1, paddingX: 1, gap: 1 }, /* @__PURE__ */ React55.createElement(Spinner, { kind: "circle", color: TONE.accent }), /* @__PURE__ */ React55.createElement(Text47, { italic: true, color: FG.sub }, text), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, `${elapsed}s`));
|
|
23701
23795
|
}
|
|
23702
23796
|
function ModeStatusBar({
|
|
23703
23797
|
editMode,
|
|
@@ -23709,27 +23803,27 @@ function ModeStatusBar({
|
|
|
23709
23803
|
}) {
|
|
23710
23804
|
useSlowTick();
|
|
23711
23805
|
const running = jobs2?.runningCount() ?? 0;
|
|
23712
|
-
const jobsTag = running > 0 ? /* @__PURE__ */
|
|
23806
|
+
const jobsTag = running > 0 ? /* @__PURE__ */ React55.createElement(Text47, { color: TONE.warn, bold: true }, ` \xB7 \u23F5 ${running} job${running === 1 ? "" : "s"}`) : null;
|
|
23713
23807
|
if (planMode) {
|
|
23714
|
-
return /* @__PURE__ */
|
|
23808
|
+
return /* @__PURE__ */ React55.createElement(ModeBarFrame, null, /* @__PURE__ */ React55.createElement(ModePill, { label: "PLAN MODE", color: TONE.err, flash }), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, " writes gated \xB7 /plan off to leave"), jobsTag);
|
|
23715
23809
|
}
|
|
23716
23810
|
const label = editMode === "yolo" ? "YOLO" : editMode === "auto" ? "AUTO" : "REVIEW";
|
|
23717
23811
|
const pillColor = editMode === "yolo" ? TONE.err : editMode === "auto" ? TONE.accent : TONE.brand;
|
|
23718
23812
|
const mid = editMode === "yolo" ? "edits + shell auto \xB7 /undo to roll back" : editMode === "auto" ? "edits land now \xB7 u to undo" : pendingCount > 0 ? `${pendingCount} queued \xB7 y apply \xB7 n discard` : "edits queued \xB7 y apply \xB7 n discard";
|
|
23719
|
-
return /* @__PURE__ */
|
|
23813
|
+
return /* @__PURE__ */ React55.createElement(ModeBarFrame, null, /* @__PURE__ */ React55.createElement(ModePill, { label, color: pillColor, flash }), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, ` ${mid} \xB7 Shift+Tab to flip`), jobsTag);
|
|
23720
23814
|
}
|
|
23721
23815
|
function ModeBarFrame({ children }) {
|
|
23722
|
-
const { stdout: stdout4 } =
|
|
23816
|
+
const { stdout: stdout4 } = useStdout11();
|
|
23723
23817
|
const cols = stdout4?.columns ?? 80;
|
|
23724
23818
|
const ruleWidth = Math.max(20, cols - 2);
|
|
23725
|
-
return /* @__PURE__ */
|
|
23819
|
+
return /* @__PURE__ */ React55.createElement(Box45, { flexDirection: "column" }, /* @__PURE__ */ React55.createElement(Box45, { paddingX: 1 }, /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, "\u254C".repeat(ruleWidth))), /* @__PURE__ */ React55.createElement(Box45, { paddingX: 1 }, children));
|
|
23726
23820
|
}
|
|
23727
23821
|
function ModePill({
|
|
23728
23822
|
label,
|
|
23729
23823
|
color: color2,
|
|
23730
23824
|
flash
|
|
23731
23825
|
}) {
|
|
23732
|
-
return /* @__PURE__ */
|
|
23826
|
+
return /* @__PURE__ */ React55.createElement(Text47, { color: color2, bold: true, inverse: flash }, `[${label}]`);
|
|
23733
23827
|
}
|
|
23734
23828
|
function UndoBanner({
|
|
23735
23829
|
banner
|
|
@@ -23744,7 +23838,7 @@ function UndoBanner({
|
|
|
23744
23838
|
const urgent = !paused && remainingSec <= 1;
|
|
23745
23839
|
const pct2 = remainingMs / totalMs * 100;
|
|
23746
23840
|
const tone = paused ? TONE.warn : urgent ? TONE.err : TONE.accent;
|
|
23747
|
-
return /* @__PURE__ */
|
|
23841
|
+
return /* @__PURE__ */ React55.createElement(Box45, { marginY: 1, paddingX: 1 }, /* @__PURE__ */ React55.createElement(Text47, { backgroundColor: TONE.accent, color: "black", bold: true }, ` \u2713 AUTO-APPLIED ${ok}/${total} `), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, " press "), /* @__PURE__ */ React55.createElement(Text47, { backgroundColor: TONE.brand, color: "black", bold: true }, " u "), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, paused ? " to undo \xB7 " : " to undo \xB7 "), /* @__PURE__ */ React55.createElement(Text47, { backgroundColor: paused ? TONE.warn : FG.faint, color: "black", bold: true }, " space "), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, paused ? " to resume " : " to pause "), /* @__PURE__ */ React55.createElement(CharBar, { pct: pct2, width: 20, color: tone, showLabel: false }), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, " "), /* @__PURE__ */ React55.createElement(Text47, { color: tone, bold: urgent || paused }, paused ? `${remainingSec}s \xB7 paused` : `${remainingSec}s`));
|
|
23748
23842
|
}
|
|
23749
23843
|
function subagentPhaseLabel(phase, iter, elapsedMs) {
|
|
23750
23844
|
if (phase === "summarising") return "summarising findings\u2026";
|
|
@@ -23759,7 +23853,7 @@ function SubagentRow({ activity }) {
|
|
|
23759
23853
|
const last = activity.lastInner;
|
|
23760
23854
|
const subtitle = activity.skillName ?? truncate3(activity.task, 48);
|
|
23761
23855
|
const modelBadge = activity.model ? modelBadgeFor(activity.model) : null;
|
|
23762
|
-
return /* @__PURE__ */
|
|
23856
|
+
return /* @__PURE__ */ React55.createElement(Card, { tone: CARD.subagent.color }, /* @__PURE__ */ React55.createElement(
|
|
23763
23857
|
CardHeader,
|
|
23764
23858
|
{
|
|
23765
23859
|
glyph: "\u232C",
|
|
@@ -23769,9 +23863,9 @@ function SubagentRow({ activity }) {
|
|
|
23769
23863
|
titleBg: PILL_SECTION.plan.bg,
|
|
23770
23864
|
subtitle,
|
|
23771
23865
|
meta: [`iter ${activity.iter}`, `${seconds}s`],
|
|
23772
|
-
right: /* @__PURE__ */
|
|
23866
|
+
right: /* @__PURE__ */ React55.createElement(React55.Fragment, null, modelBadge ? /* @__PURE__ */ React55.createElement(Pill, { label: modelBadge.label, ...PILL_MODEL[modelBadge.kind], bold: false }) : null, /* @__PURE__ */ React55.createElement(Spinner, { kind: "braille", color: CARD.subagent.color }))
|
|
23773
23867
|
}
|
|
23774
|
-
), /* @__PURE__ */
|
|
23868
|
+
), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, "task ", /* @__PURE__ */ React55.createElement(Text47, { color: FG.sub }, activity.task)), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, "last ", last ? /* @__PURE__ */ React55.createElement(React55.Fragment, null, /* @__PURE__ */ React55.createElement(Text47, { color: last.color }, `${last.glyph} `), /* @__PURE__ */ React55.createElement(Text47, { color: FG.body }, last.label), last.meta ? /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, ` ${last.meta}`) : null) : /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, "queued\u2026")), /* @__PURE__ */ React55.createElement(Text47, { color: TONE.brand }, "\u25B6 ", phase));
|
|
23775
23869
|
}
|
|
23776
23870
|
function SubagentLiveStack({
|
|
23777
23871
|
activities,
|
|
@@ -23779,13 +23873,13 @@ function SubagentLiveStack({
|
|
|
23779
23873
|
}) {
|
|
23780
23874
|
const tick = useTick();
|
|
23781
23875
|
if (activities.length === 0) return null;
|
|
23782
|
-
if (activities.length === 1) return /* @__PURE__ */
|
|
23876
|
+
if (activities.length === 1) return /* @__PURE__ */ React55.createElement(SubagentRow, { activity: activities[0] });
|
|
23783
23877
|
const visible = activities.slice(0, max);
|
|
23784
23878
|
const overflow = activities.length - visible.length;
|
|
23785
23879
|
const summarising = activities.filter((a) => a.phase === "summarising").length;
|
|
23786
23880
|
const metaParts = [`${activities.length} running`];
|
|
23787
23881
|
if (summarising > 0) metaParts.push(`${summarising} summarising`);
|
|
23788
|
-
return /* @__PURE__ */
|
|
23882
|
+
return /* @__PURE__ */ React55.createElement(Card, { tone: CARD.subagent.color }, /* @__PURE__ */ React55.createElement(
|
|
23789
23883
|
CardHeader,
|
|
23790
23884
|
{
|
|
23791
23885
|
glyph: "\u232C",
|
|
@@ -23794,9 +23888,9 @@ function SubagentLiveStack({
|
|
|
23794
23888
|
titleColor: PILL_SECTION.plan.fg,
|
|
23795
23889
|
titleBg: PILL_SECTION.plan.bg,
|
|
23796
23890
|
subtitle: metaParts.join(" \xB7 "),
|
|
23797
|
-
right: /* @__PURE__ */
|
|
23891
|
+
right: /* @__PURE__ */ React55.createElement(Spinner, { kind: "braille", color: CARD.subagent.color })
|
|
23798
23892
|
}
|
|
23799
|
-
), visible.map((a, i) => /* @__PURE__ */
|
|
23893
|
+
), visible.map((a, i) => /* @__PURE__ */ React55.createElement(CompactSubagentLine, { key: a.runId, activity: a, tick, index: i })), overflow > 0 ? /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, ` +${overflow} more running\u2026`) : null);
|
|
23800
23894
|
}
|
|
23801
23895
|
function CompactSubagentLine({
|
|
23802
23896
|
activity,
|
|
@@ -23811,7 +23905,7 @@ function CompactSubagentLine({
|
|
|
23811
23905
|
const title = activity.skillName ?? truncate3(activity.task, 28);
|
|
23812
23906
|
const titlePadded = title.padEnd(28);
|
|
23813
23907
|
const last = activity.lastInner;
|
|
23814
|
-
return /* @__PURE__ */
|
|
23908
|
+
return /* @__PURE__ */ React55.createElement(Box45, { flexDirection: "row" }, /* @__PURE__ */ React55.createElement(Text47, { color: glyphColor, bold: true }, ` ${glyph} `), /* @__PURE__ */ React55.createElement(Text47, { color: FG.body }, titlePadded), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, ` iter ${String(activity.iter).padStart(2)} \xB7 ${seconds}s \xB7 `), last ? /* @__PURE__ */ React55.createElement(React55.Fragment, null, /* @__PURE__ */ React55.createElement(Text47, { color: last.color }, `${last.glyph} `), /* @__PURE__ */ React55.createElement(Text47, { color: FG.body }, truncate3(last.label, 18)), last.meta ? /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, ` ${last.meta}`) : null) : /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, "queued\u2026"));
|
|
23815
23909
|
}
|
|
23816
23910
|
function truncate3(text, max) {
|
|
23817
23911
|
return text.length > max ? `${text.slice(0, max)}\u2026` : text;
|
|
@@ -23823,7 +23917,7 @@ function OngoingToolRow({
|
|
|
23823
23917
|
const tick = useTick();
|
|
23824
23918
|
const elapsed = useElapsedSeconds();
|
|
23825
23919
|
const summary = summarizeToolArgs(tool2.name, tool2.args);
|
|
23826
|
-
return /* @__PURE__ */
|
|
23920
|
+
return /* @__PURE__ */ React55.createElement(Box45, { marginY: 1, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React55.createElement(Box45, null, /* @__PURE__ */ React55.createElement(Text47, { color: CARD.tool.color, bold: true }, SPINNER_FRAMES[tick % SPINNER_FRAMES.length]), /* @__PURE__ */ React55.createElement(Text47, null, " "), /* @__PURE__ */ React55.createElement(Text47, { color: CARD.tool.color, bold: true }, `\u25A3 ${tool2.name}`), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, ` running \xB7 ${elapsed}s`)), progress ? /* @__PURE__ */ React55.createElement(Box45, { paddingLeft: 3 }, /* @__PURE__ */ React55.createElement(Text47, { color: TONE.brand }, renderProgressLine(progress))) : null, summary ? /* @__PURE__ */ React55.createElement(Box45, { paddingLeft: 3 }, /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, summary)) : null);
|
|
23827
23921
|
}
|
|
23828
23922
|
function renderProgressLine(p) {
|
|
23829
23923
|
const msg = p.message ? ` ${p.message}` : "";
|
|
@@ -23879,16 +23973,16 @@ function summarizeToolArgs(name, args) {
|
|
|
23879
23973
|
}
|
|
23880
23974
|
|
|
23881
23975
|
// src/cli/ui/layout/StatusRow.tsx
|
|
23882
|
-
import { Box as
|
|
23883
|
-
import
|
|
23976
|
+
import { Box as Box46, Text as Text49, useStdout as useStdout12 } from "ink";
|
|
23977
|
+
import React57 from "react";
|
|
23884
23978
|
|
|
23885
23979
|
// src/cli/ui/primitives/Countdown.tsx
|
|
23886
|
-
import { Text as
|
|
23887
|
-
import
|
|
23980
|
+
import { Text as Text48 } from "ink";
|
|
23981
|
+
import React56 from "react";
|
|
23888
23982
|
function Countdown({ endsAt, color: color2 = TONE.brand }) {
|
|
23889
23983
|
useSlowTick();
|
|
23890
23984
|
const remainingSec = Math.max(0, Math.ceil((endsAt - Date.now()) / 1e3));
|
|
23891
|
-
return /* @__PURE__ */
|
|
23985
|
+
return /* @__PURE__ */ React56.createElement(Text48, { bold: true, color: color2 }, String(remainingSec));
|
|
23892
23986
|
}
|
|
23893
23987
|
|
|
23894
23988
|
// src/cli/ui/layout/StatusRow.tsx
|
|
@@ -23897,17 +23991,17 @@ var RULE_MIN = 20;
|
|
|
23897
23991
|
function StatusRow() {
|
|
23898
23992
|
const status3 = useAgentState((s) => s.status);
|
|
23899
23993
|
const session = useAgentState((s) => s.session);
|
|
23900
|
-
const { stdout: stdout4 } =
|
|
23994
|
+
const { stdout: stdout4 } = useStdout12();
|
|
23901
23995
|
const cols = stdout4?.columns ?? 80;
|
|
23902
23996
|
const ruleWidth = Math.max(RULE_MIN, cols - RULE_PAD);
|
|
23903
23997
|
const hasTurn = status3.cost > 0;
|
|
23904
|
-
return /* @__PURE__ */
|
|
23905
|
-
|
|
23998
|
+
return /* @__PURE__ */ React57.createElement(Box46, { flexDirection: "column" }, /* @__PURE__ */ React57.createElement(Box46, null, /* @__PURE__ */ React57.createElement(Text49, null, " "), /* @__PURE__ */ React57.createElement(Text49, { color: FG.faint }, "\u2500".repeat(ruleWidth))), /* @__PURE__ */ React57.createElement(Box46, { flexDirection: "row" }, /* @__PURE__ */ React57.createElement(Text49, null, " "), status3.recording ? /* @__PURE__ */ React57.createElement(RecordingPill, { rec: status3.recording }) : status3.countdownSeconds !== void 0 ? /* @__PURE__ */ React57.createElement(CountdownRow, { mode: status3.mode, secondsLeft: status3.countdownSeconds }) : /* @__PURE__ */ React57.createElement(ModePill2, { mode: status3.mode, network: status3.network, detail: status3.networkDetail }), /* @__PURE__ */ React57.createElement(Sep, null), /* @__PURE__ */ React57.createElement(Text49, { color: FG.sub }, `${session.id} \xB7 ${session.branch}`), hasTurn && /* @__PURE__ */ React57.createElement(React57.Fragment, null, /* @__PURE__ */ React57.createElement(Sep, null), /* @__PURE__ */ React57.createElement(Text49, { bold: true, color: TONE.brand }, "\u25B8 "), /* @__PURE__ */ React57.createElement(Text49, { bold: true, color: FG.body }, `${formatCost(status3.cost, status3.balanceCurrency)} turn`)), /* @__PURE__ */ React57.createElement(Sep, null), /* @__PURE__ */ React57.createElement(
|
|
23999
|
+
Text49,
|
|
23906
24000
|
{
|
|
23907
24001
|
color: FG.sub
|
|
23908
24002
|
},
|
|
23909
24003
|
`${formatCost(status3.sessionCost, status3.balanceCurrency, 3)} session`
|
|
23910
|
-
), status3.balance !== void 0 && /* @__PURE__ */
|
|
24004
|
+
), status3.balance !== void 0 && /* @__PURE__ */ React57.createElement(React57.Fragment, null, /* @__PURE__ */ React57.createElement(Sep, null), /* @__PURE__ */ React57.createElement(Text49, { color: FG.faint }, "wallet "), /* @__PURE__ */ React57.createElement(Text49, { bold: true, color: balanceColor(status3.balance, status3.balanceCurrency) }, formatBalance(status3.balance, status3.balanceCurrency))), /* @__PURE__ */ React57.createElement(Sep, null), /* @__PURE__ */ React57.createElement(Text49, { color: TONE.accent }, `cache ${Math.round(status3.cacheHit * 100)}%`)));
|
|
23911
24005
|
}
|
|
23912
24006
|
function ModePill2({
|
|
23913
24007
|
mode: mode2,
|
|
@@ -23916,18 +24010,18 @@ function ModePill2({
|
|
|
23916
24010
|
}) {
|
|
23917
24011
|
if (network === "online") {
|
|
23918
24012
|
const pill = modeGlyph(mode2);
|
|
23919
|
-
return /* @__PURE__ */
|
|
24013
|
+
return /* @__PURE__ */ React57.createElement(Box46, { flexDirection: "row" }, /* @__PURE__ */ React57.createElement(Text49, { color: pill.color }, pill.glyph), /* @__PURE__ */ React57.createElement(Text49, { color: FG.sub }, ` ${mode2}`));
|
|
23920
24014
|
}
|
|
23921
24015
|
const dot2 = networkDot(network);
|
|
23922
24016
|
if (network === "slow") {
|
|
23923
24017
|
const tail = detail ? ` \xB7 ${detail}` : "";
|
|
23924
|
-
return /* @__PURE__ */
|
|
24018
|
+
return /* @__PURE__ */ React57.createElement(Box46, { flexDirection: "row" }, /* @__PURE__ */ React57.createElement(Text49, { color: dot2.color }, dot2.glyph), /* @__PURE__ */ React57.createElement(Text49, { color: dot2.color }, ` ${mode2} \xB7 slow${tail}`));
|
|
23925
24019
|
}
|
|
23926
24020
|
if (network === "disconnected") {
|
|
23927
24021
|
const tail = detail ? ` \xB7 ${detail}` : "";
|
|
23928
|
-
return /* @__PURE__ */
|
|
24022
|
+
return /* @__PURE__ */ React57.createElement(Box46, { flexDirection: "row" }, /* @__PURE__ */ React57.createElement(Text49, { color: dot2.color }, dot2.glyph), /* @__PURE__ */ React57.createElement(Text49, { color: dot2.color }, ` disconnect${tail}`));
|
|
23929
24023
|
}
|
|
23930
|
-
return /* @__PURE__ */
|
|
24024
|
+
return /* @__PURE__ */ React57.createElement(Box46, { flexDirection: "row" }, /* @__PURE__ */ React57.createElement(Text49, { color: dot2.color }, dot2.glyph), /* @__PURE__ */ React57.createElement(Text49, { color: dot2.color }, " reconnecting\u2026"));
|
|
23931
24025
|
}
|
|
23932
24026
|
function CountdownRow({
|
|
23933
24027
|
mode: mode2,
|
|
@@ -23935,14 +24029,14 @@ function CountdownRow({
|
|
|
23935
24029
|
}) {
|
|
23936
24030
|
const pill = modeGlyph(mode2);
|
|
23937
24031
|
const endsAt = Date.now() + secondsLeft * 1e3;
|
|
23938
|
-
return /* @__PURE__ */
|
|
24032
|
+
return /* @__PURE__ */ React57.createElement(Box46, { flexDirection: "row" }, /* @__PURE__ */ React57.createElement(Text49, { color: pill.color }, pill.glyph), /* @__PURE__ */ React57.createElement(Text49, { color: FG.sub }, ` ${mode2} \xB7 `), /* @__PURE__ */ React57.createElement(Text49, { color: TONE.warn }, "approving in "), /* @__PURE__ */ React57.createElement(Countdown, { endsAt }), /* @__PURE__ */ React57.createElement(Text49, { color: TONE.warn }, "s \xB7 esc to interrupt"));
|
|
23939
24033
|
}
|
|
23940
24034
|
function RecordingPill({ rec }) {
|
|
23941
24035
|
const sizeMb = (rec.sizeBytes / (1024 * 1024)).toFixed(1);
|
|
23942
|
-
return /* @__PURE__ */
|
|
24036
|
+
return /* @__PURE__ */ React57.createElement(Box46, { flexDirection: "row" }, /* @__PURE__ */ React57.createElement(Text49, { bold: true, color: TONE.err }, "\u25CFREC"), /* @__PURE__ */ React57.createElement(Text49, { color: TONE.err }, ` ${sizeMb} MB \xB7 ${rec.events} evt`));
|
|
23943
24037
|
}
|
|
23944
24038
|
function Sep() {
|
|
23945
|
-
return /* @__PURE__ */
|
|
24039
|
+
return /* @__PURE__ */ React57.createElement(Text49, { color: FG.meta }, " \xB7 ");
|
|
23946
24040
|
}
|
|
23947
24041
|
function modeGlyph(mode2) {
|
|
23948
24042
|
switch (mode2) {
|
|
@@ -23970,8 +24064,8 @@ function networkDot(state) {
|
|
|
23970
24064
|
}
|
|
23971
24065
|
|
|
23972
24066
|
// src/cli/ui/layout/ToastRail.tsx
|
|
23973
|
-
import { Box as
|
|
23974
|
-
import
|
|
24067
|
+
import { Box as Box47, Text as Text50, useStdout as useStdout13 } from "ink";
|
|
24068
|
+
import React58, { useEffect as useEffect8 } from "react";
|
|
23975
24069
|
var TONE_COLOR = {
|
|
23976
24070
|
ok: TONE.ok,
|
|
23977
24071
|
info: TONE.brand,
|
|
@@ -23993,7 +24087,7 @@ function ToastRail() {
|
|
|
23993
24087
|
const toasts = useAgentState((s) => s.toasts);
|
|
23994
24088
|
const dispatch2 = useDispatch();
|
|
23995
24089
|
useSlowTick();
|
|
23996
|
-
const { stdout: stdout4 } =
|
|
24090
|
+
const { stdout: stdout4 } = useStdout13();
|
|
23997
24091
|
const cols = stdout4?.columns ?? 80;
|
|
23998
24092
|
const rule = "\u2501".repeat(Math.max(20, cols - 4));
|
|
23999
24093
|
const now = Date.now();
|
|
@@ -24009,17 +24103,17 @@ function ToastRail() {
|
|
|
24009
24103
|
}, [toasts, dispatch2]);
|
|
24010
24104
|
const visible = toasts.filter((t3) => now - t3.bornAt < t3.ttlMs);
|
|
24011
24105
|
if (visible.length === 0) return null;
|
|
24012
|
-
return /* @__PURE__ */
|
|
24106
|
+
return /* @__PURE__ */ React58.createElement(Box47, { flexDirection: "column" }, visible.map((t3) => {
|
|
24013
24107
|
const color2 = TONE_COLOR[t3.tone];
|
|
24014
24108
|
const glyph = TONE_GLYPH[t3.tone];
|
|
24015
24109
|
const body = bodyColor(t3, now);
|
|
24016
24110
|
const remainingSec = Math.max(0, Math.ceil((t3.ttlMs - (now - t3.bornAt)) / 1e3));
|
|
24017
|
-
return /* @__PURE__ */
|
|
24111
|
+
return /* @__PURE__ */ React58.createElement(Box47, { key: t3.id, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React58.createElement(Text50, { color: color2 }, rule), /* @__PURE__ */ React58.createElement(Box47, { flexDirection: "row" }, /* @__PURE__ */ React58.createElement(Text50, { color: color2 }, glyph), /* @__PURE__ */ React58.createElement(Text50, { bold: true, color: body }, ` ${t3.title}`), t3.detail !== void 0 && /* @__PURE__ */ React58.createElement(Text50, { color: FG.sub }, ` \xB7 ${t3.detail}`), /* @__PURE__ */ React58.createElement(Box47, { flexGrow: 1 }), /* @__PURE__ */ React58.createElement(Text50, { color: FG.faint }, `${remainingSec}s`)));
|
|
24018
24112
|
}));
|
|
24019
24113
|
}
|
|
24020
24114
|
|
|
24021
24115
|
// src/cli/ui/layout/plan-live-row.tsx
|
|
24022
|
-
import
|
|
24116
|
+
import React59 from "react";
|
|
24023
24117
|
function isActivePlanInFlight(card) {
|
|
24024
24118
|
if (card.kind !== "plan") return false;
|
|
24025
24119
|
if (card.variant !== "active") return false;
|
|
@@ -24034,7 +24128,7 @@ function PlanLiveRow() {
|
|
|
24034
24128
|
return null;
|
|
24035
24129
|
});
|
|
24036
24130
|
if (!planCard) return null;
|
|
24037
|
-
return /* @__PURE__ */
|
|
24131
|
+
return /* @__PURE__ */ React59.createElement(PlanCard, { card: planCard });
|
|
24038
24132
|
}
|
|
24039
24133
|
|
|
24040
24134
|
// src/cli/ui/loop.ts
|
|
@@ -25957,10 +26051,10 @@ var model = (args, loop2, ctx) => {
|
|
|
25957
26051
|
const id = args[0];
|
|
25958
26052
|
const known = ctx.models ?? null;
|
|
25959
26053
|
if (!id) {
|
|
25960
|
-
|
|
25961
|
-
return { info: t("handlers.model.modelUsage", { hint }) };
|
|
26054
|
+
return { openModelPicker: true };
|
|
25962
26055
|
}
|
|
25963
26056
|
loop2.configure({ model: id });
|
|
26057
|
+
ctx.dispatch?.({ type: "session.model.change", model: id });
|
|
25964
26058
|
if (known && known.length > 0 && !known.includes(id)) {
|
|
25965
26059
|
return {
|
|
25966
26060
|
info: t("handlers.model.modelNotInCatalog", { id, list: known.join(", ") })
|
|
@@ -26000,7 +26094,7 @@ var harvest2 = (args, loop2) => {
|
|
|
26000
26094
|
}
|
|
26001
26095
|
return { info: t("handlers.model.harvestOff") };
|
|
26002
26096
|
};
|
|
26003
|
-
var preset = (args, loop2) => {
|
|
26097
|
+
var preset = (args, loop2, ctx) => {
|
|
26004
26098
|
const name = (args[0] ?? "").toLowerCase();
|
|
26005
26099
|
const applyAndPersist = (effort2) => {
|
|
26006
26100
|
try {
|
|
@@ -26008,8 +26102,7 @@ var preset = (args, loop2) => {
|
|
|
26008
26102
|
} catch {
|
|
26009
26103
|
}
|
|
26010
26104
|
};
|
|
26011
|
-
|
|
26012
|
-
const p = PRESETS.auto;
|
|
26105
|
+
const apply3 = (p) => {
|
|
26013
26106
|
loop2.configure({
|
|
26014
26107
|
model: p.model,
|
|
26015
26108
|
autoEscalate: p.autoEscalate,
|
|
@@ -26017,31 +26110,19 @@ var preset = (args, loop2) => {
|
|
|
26017
26110
|
harvest: p.harvest,
|
|
26018
26111
|
branch: p.branch
|
|
26019
26112
|
});
|
|
26113
|
+
ctx.dispatch?.({ type: "session.model.change", model: p.model });
|
|
26020
26114
|
applyAndPersist(p.reasoningEffort);
|
|
26115
|
+
};
|
|
26116
|
+
if (name === "auto") {
|
|
26117
|
+
apply3(PRESETS.auto);
|
|
26021
26118
|
return { info: t("handlers.model.presetAuto") };
|
|
26022
26119
|
}
|
|
26023
26120
|
if (name === "flash") {
|
|
26024
|
-
|
|
26025
|
-
loop2.configure({
|
|
26026
|
-
model: p.model,
|
|
26027
|
-
autoEscalate: p.autoEscalate,
|
|
26028
|
-
reasoningEffort: p.reasoningEffort,
|
|
26029
|
-
harvest: p.harvest,
|
|
26030
|
-
branch: p.branch
|
|
26031
|
-
});
|
|
26032
|
-
applyAndPersist(p.reasoningEffort);
|
|
26121
|
+
apply3(PRESETS.flash);
|
|
26033
26122
|
return { info: t("handlers.model.presetFlash") };
|
|
26034
26123
|
}
|
|
26035
26124
|
if (name === "pro") {
|
|
26036
|
-
|
|
26037
|
-
loop2.configure({
|
|
26038
|
-
model: p.model,
|
|
26039
|
-
autoEscalate: p.autoEscalate,
|
|
26040
|
-
reasoningEffort: p.reasoningEffort,
|
|
26041
|
-
harvest: p.harvest,
|
|
26042
|
-
branch: p.branch
|
|
26043
|
-
});
|
|
26044
|
-
applyAndPersist(p.reasoningEffort);
|
|
26125
|
+
apply3(PRESETS.pro);
|
|
26045
26126
|
return { info: t("handlers.model.presetPro") };
|
|
26046
26127
|
}
|
|
26047
26128
|
return { info: t("handlers.model.presetUsage") };
|
|
@@ -26151,17 +26232,17 @@ var handlers10 = {
|
|
|
26151
26232
|
};
|
|
26152
26233
|
|
|
26153
26234
|
// src/cli/ui/ctx-breakdown.tsx
|
|
26154
|
-
import { Box as
|
|
26155
|
-
import
|
|
26235
|
+
import { Box as Box48, Text as Text52 } from "ink";
|
|
26236
|
+
import React61 from "react";
|
|
26156
26237
|
|
|
26157
26238
|
// src/cli/ui/primitives.tsx
|
|
26158
|
-
import { Text as
|
|
26159
|
-
import
|
|
26239
|
+
import { Text as Text51, useStdout as useStdout14 } from "ink";
|
|
26240
|
+
import React60 from "react";
|
|
26160
26241
|
function ChromeRule() {
|
|
26161
|
-
const { stdout: stdout4 } =
|
|
26242
|
+
const { stdout: stdout4 } = useStdout14();
|
|
26162
26243
|
const cols = stdout4?.columns ?? 80;
|
|
26163
26244
|
const w = Math.max(20, cols - 2);
|
|
26164
|
-
return /* @__PURE__ */
|
|
26245
|
+
return /* @__PURE__ */ React60.createElement(Text51, { dimColor: true }, "\u2500".repeat(w));
|
|
26165
26246
|
}
|
|
26166
26247
|
function Bar({
|
|
26167
26248
|
ratio,
|
|
@@ -26170,7 +26251,7 @@ function Bar({
|
|
|
26170
26251
|
dim
|
|
26171
26252
|
}) {
|
|
26172
26253
|
const filled = Math.max(0, Math.min(cells, Math.round(ratio * cells)));
|
|
26173
|
-
return /* @__PURE__ */
|
|
26254
|
+
return /* @__PURE__ */ React60.createElement(Text51, null, /* @__PURE__ */ React60.createElement(Text51, { color: color2, dimColor: dim }, "\u25B0".repeat(filled)), /* @__PURE__ */ React60.createElement(Text51, { dimColor: true }, "\u25B1".repeat(cells - filled)));
|
|
26174
26255
|
}
|
|
26175
26256
|
|
|
26176
26257
|
// src/cli/ui/ctx-breakdown.tsx
|
|
@@ -26317,6 +26398,7 @@ var status = (_args, loop2, ctx) => {
|
|
|
26317
26398
|
const modeLine = ctx.editMode === "yolo" ? t("handlers.observability.statusModeYolo") : ctx.editMode === "auto" ? t("handlers.observability.statusModeAuto") : ctx.editMode === "review" ? t("handlers.observability.statusModeReview") : "";
|
|
26318
26399
|
const dashUrl = ctx.getDashboardUrl?.();
|
|
26319
26400
|
const dashLine = dashUrl ? t("handlers.observability.statusDash", { url: dashUrl }) : "";
|
|
26401
|
+
const workspaceLine = ctx.codeRoot ? t("handlers.observability.statusWorkspace", { path: ctx.codeRoot }) : "";
|
|
26320
26402
|
const lines = [
|
|
26321
26403
|
t("handlers.observability.statusModel", { model: loop2.model }),
|
|
26322
26404
|
t("handlers.observability.statusFlags", {
|
|
@@ -26330,6 +26412,7 @@ var status = (_args, loop2, ctx) => {
|
|
|
26330
26412
|
mcpLine,
|
|
26331
26413
|
sessionLine
|
|
26332
26414
|
];
|
|
26415
|
+
if (workspaceLine) lines.push(workspaceLine);
|
|
26333
26416
|
if (budgetLine) lines.push(budgetLine);
|
|
26334
26417
|
if (pendingLine) lines.push(pendingLine);
|
|
26335
26418
|
if (planLine) lines.push(planLine);
|
|
@@ -27239,7 +27322,7 @@ function hydrateCardsFromMessages(messages) {
|
|
|
27239
27322
|
}
|
|
27240
27323
|
|
|
27241
27324
|
// src/cli/ui/useCompletionPickers.ts
|
|
27242
|
-
import { useCallback as useCallback8, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef6, useState as
|
|
27325
|
+
import { useCallback as useCallback8, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef6, useState as useState16 } from "react";
|
|
27243
27326
|
function useCompletionPickers({
|
|
27244
27327
|
input,
|
|
27245
27328
|
setInput,
|
|
@@ -27248,7 +27331,7 @@ function useCompletionPickers({
|
|
|
27248
27331
|
models: models2,
|
|
27249
27332
|
mcpServers
|
|
27250
27333
|
}) {
|
|
27251
|
-
const [slashSelected, setSlashSelected] =
|
|
27334
|
+
const [slashSelected, setSlashSelected] = useState16(0);
|
|
27252
27335
|
const slashMatches = useMemo6(() => {
|
|
27253
27336
|
if (!input.startsWith("/") || input.includes(" ")) return null;
|
|
27254
27337
|
return suggestSlashCommands(input.slice(1), !!codeMode);
|
|
@@ -27260,8 +27343,8 @@ function useCompletionPickers({
|
|
|
27260
27343
|
return prev;
|
|
27261
27344
|
});
|
|
27262
27345
|
}, [slashMatches]);
|
|
27263
|
-
const [atSelected, setAtSelected] =
|
|
27264
|
-
const [atFiles, setAtFiles] =
|
|
27346
|
+
const [atSelected, setAtSelected] = useState16(0);
|
|
27347
|
+
const [atFiles, setAtFiles] = useState16([]);
|
|
27265
27348
|
useEffect9(() => {
|
|
27266
27349
|
if (!codeMode) {
|
|
27267
27350
|
setAtFiles([]);
|
|
@@ -27312,7 +27395,7 @@ function useCompletionPickers({
|
|
|
27312
27395
|
},
|
|
27313
27396
|
[atPicker, input, setInput]
|
|
27314
27397
|
);
|
|
27315
|
-
const [slashArgSelected, setSlashArgSelected] =
|
|
27398
|
+
const [slashArgSelected, setSlashArgSelected] = useState16(0);
|
|
27316
27399
|
const slashArgContext = useMemo6(() => {
|
|
27317
27400
|
if (!input.startsWith("/")) return null;
|
|
27318
27401
|
if (slashMatches !== null) return null;
|
|
@@ -27392,12 +27475,12 @@ function useCompletionPickers({
|
|
|
27392
27475
|
}
|
|
27393
27476
|
|
|
27394
27477
|
// src/cli/ui/useEditHistory.ts
|
|
27395
|
-
import { useCallback as useCallback9, useRef as useRef7, useState as
|
|
27478
|
+
import { useCallback as useCallback9, useRef as useRef7, useState as useState17 } from "react";
|
|
27396
27479
|
function useEditHistory(codeMode) {
|
|
27397
27480
|
const editHistory = useRef7([]);
|
|
27398
27481
|
const nextHistoryId = useRef7(1);
|
|
27399
27482
|
const currentTurnEntry = useRef7(null);
|
|
27400
|
-
const [undoBanner, setUndoBanner] =
|
|
27483
|
+
const [undoBanner, setUndoBanner] = useState17(null);
|
|
27401
27484
|
const undoTimeoutRef = useRef7(null);
|
|
27402
27485
|
const recordEdit = useCallback9(
|
|
27403
27486
|
(source, blocks, results, snaps) => {
|
|
@@ -27622,11 +27705,11 @@ function useEditHistory(codeMode) {
|
|
|
27622
27705
|
}
|
|
27623
27706
|
|
|
27624
27707
|
// src/cli/ui/useSessionInfo.ts
|
|
27625
|
-
import { useCallback as useCallback10, useEffect as useEffect10, useState as
|
|
27708
|
+
import { useCallback as useCallback10, useEffect as useEffect10, useState as useState18 } from "react";
|
|
27626
27709
|
function useSessionInfo(loop2) {
|
|
27627
|
-
const [balance, setBalance] =
|
|
27628
|
-
const [models2, setModels] =
|
|
27629
|
-
const [latestVersion, setLatestVersion] =
|
|
27710
|
+
const [balance, setBalance] = useState18(null);
|
|
27711
|
+
const [models2, setModels] = useState18(null);
|
|
27712
|
+
const [latestVersion, setLatestVersion] = useState18(null);
|
|
27630
27713
|
useEffect10(() => {
|
|
27631
27714
|
let cancelled = false;
|
|
27632
27715
|
void (async () => {
|
|
@@ -27695,7 +27778,7 @@ function useSessionInfo(loop2) {
|
|
|
27695
27778
|
}
|
|
27696
27779
|
|
|
27697
27780
|
// src/cli/ui/useSubagent.ts
|
|
27698
|
-
import { useEffect as useEffect11, useRef as useRef8, useState as
|
|
27781
|
+
import { useEffect as useEffect11, useRef as useRef8, useState as useState19 } from "react";
|
|
27699
27782
|
function summariseInner(ev) {
|
|
27700
27783
|
if (ev.role === "tool_start") {
|
|
27701
27784
|
return {
|
|
@@ -27726,7 +27809,7 @@ function useSubagent({
|
|
|
27726
27809
|
log,
|
|
27727
27810
|
getWalletCurrency
|
|
27728
27811
|
}) {
|
|
27729
|
-
const [activities, setActivities] =
|
|
27812
|
+
const [activities, setActivities] = useState19([]);
|
|
27730
27813
|
const sinkRef = useRef8({ current: null });
|
|
27731
27814
|
const getWalletCurrencyRef = useRef8(getWalletCurrency);
|
|
27732
27815
|
useEffect11(() => {
|
|
@@ -27814,13 +27897,13 @@ var PLAIN_UI = process.env.REASONIX_UI === "plain";
|
|
|
27814
27897
|
function LoopStatusRow({
|
|
27815
27898
|
loop: loop2
|
|
27816
27899
|
}) {
|
|
27817
|
-
const [, setTick] =
|
|
27818
|
-
|
|
27900
|
+
const [, setTick] = React62.useState(0);
|
|
27901
|
+
React62.useEffect(() => {
|
|
27819
27902
|
const id = setInterval(() => setTick((t3) => t3 + 1), 1e3);
|
|
27820
27903
|
return () => clearInterval(id);
|
|
27821
27904
|
}, []);
|
|
27822
27905
|
const nextFireMs = Math.max(0, loop2.nextFireAt - Date.now());
|
|
27823
|
-
return /* @__PURE__ */
|
|
27906
|
+
return /* @__PURE__ */ React62.createElement(Box49, null, /* @__PURE__ */ React62.createElement(Text53, { color: "cyan" }, `\u25B8 ${formatLoopStatus(loop2.prompt, nextFireMs, loop2.iter)} \xB7 /loop stop or type to cancel`));
|
|
27824
27907
|
}
|
|
27825
27908
|
function App(props) {
|
|
27826
27909
|
const session = useAgentSession({
|
|
@@ -27828,11 +27911,11 @@ function App(props) {
|
|
|
27828
27911
|
model: props.model,
|
|
27829
27912
|
workspace: props.codeMode?.rootDir ?? process.cwd()
|
|
27830
27913
|
});
|
|
27831
|
-
const initialCards =
|
|
27914
|
+
const initialCards = React62.useMemo(
|
|
27832
27915
|
() => props.session ? hydrateCardsFromMessages(loadSessionMessages(props.session)) : [],
|
|
27833
27916
|
[props.session]
|
|
27834
27917
|
);
|
|
27835
|
-
return /* @__PURE__ */
|
|
27918
|
+
return /* @__PURE__ */ React62.createElement(AgentStoreProvider, { session, initialCards }, /* @__PURE__ */ React62.createElement(AppInner, { ...props }));
|
|
27836
27919
|
}
|
|
27837
27920
|
function AppInner({
|
|
27838
27921
|
model: model2,
|
|
@@ -27858,22 +27941,22 @@ function AppInner({
|
|
|
27858
27941
|
);
|
|
27859
27942
|
const isStreaming = useAgentState((s) => s.cards.some((c) => c.kind === "streaming" && !c.done));
|
|
27860
27943
|
const chatScroll = useChatScroll();
|
|
27861
|
-
const [input, setInput] =
|
|
27862
|
-
const [busy, setBusy] =
|
|
27863
|
-
const [liveExpand, setLiveExpand] =
|
|
27944
|
+
const [input, setInput] = useState20("");
|
|
27945
|
+
const [busy, setBusy] = useState20(false);
|
|
27946
|
+
const [liveExpand, setLiveExpand] = useState20(false);
|
|
27864
27947
|
useEffect12(() => {
|
|
27865
27948
|
if (!isStreaming && liveExpand) setLiveExpand(false);
|
|
27866
27949
|
}, [isStreaming, liveExpand]);
|
|
27867
|
-
const [languageVersion, setLanguageVersion] =
|
|
27950
|
+
const [languageVersion, setLanguageVersion] = useState20(0);
|
|
27868
27951
|
useEffect12(() => onLanguageChange(() => setLanguageVersion((v) => v + 1)), []);
|
|
27869
|
-
const [liveMcpServers, setLiveMcpServers] =
|
|
27952
|
+
const [liveMcpServers, setLiveMcpServers] = useState20(() => mcpServers ?? []);
|
|
27870
27953
|
const abortedThisTurn = useRef9(false);
|
|
27871
27954
|
useEffect12(() => {
|
|
27872
27955
|
busyRef.current = busy;
|
|
27873
27956
|
}, [busy]);
|
|
27874
|
-
const [ongoingTool, setOngoingTool] =
|
|
27875
|
-
const [toolProgress, setToolProgress] =
|
|
27876
|
-
const { stdout: stdout4 } =
|
|
27957
|
+
const [ongoingTool, setOngoingTool] = useState20(null);
|
|
27958
|
+
const [toolProgress, setToolProgress] = useState20(null);
|
|
27959
|
+
const { stdout: stdout4 } = useStdout15();
|
|
27877
27960
|
useEffect12(() => {
|
|
27878
27961
|
if (!stdout4 || !stdout4.isTTY) return;
|
|
27879
27962
|
stdout4.write("\x1B[?2004h");
|
|
@@ -27889,9 +27972,9 @@ function AppInner({
|
|
|
27889
27972
|
log,
|
|
27890
27973
|
getWalletCurrency: () => walletCurrencyRef.current
|
|
27891
27974
|
});
|
|
27892
|
-
const [statusLine, setStatusLine] =
|
|
27893
|
-
const [currentRootDir] =
|
|
27894
|
-
const [hookList, setHookList] =
|
|
27975
|
+
const [statusLine, setStatusLine] = useState20(null);
|
|
27976
|
+
const [currentRootDir] = useState20(() => codeMode?.rootDir ?? process.cwd());
|
|
27977
|
+
const [hookList, setHookList] = useState20(
|
|
27895
27978
|
() => loadHooks({ projectRoot: codeMode?.rootDir })
|
|
27896
27979
|
);
|
|
27897
27980
|
const {
|
|
@@ -27907,13 +27990,13 @@ function AppInner({
|
|
|
27907
27990
|
touchedPaths
|
|
27908
27991
|
} = useEditHistory(codeMode);
|
|
27909
27992
|
const pendingEdits = useRef9([]);
|
|
27910
|
-
const [pendingCount, setPendingCount] =
|
|
27993
|
+
const [pendingCount, setPendingCount] = useState20(0);
|
|
27911
27994
|
const syncPendingCount = useCallback11(() => {
|
|
27912
27995
|
setPendingCount(pendingEdits.current.length);
|
|
27913
27996
|
setPendingTick((t3) => t3 + 1);
|
|
27914
27997
|
}, []);
|
|
27915
|
-
const [editMode, setEditMode] =
|
|
27916
|
-
const [preset2, setPreset] =
|
|
27998
|
+
const [editMode, setEditMode] = useState20(() => codeMode ? loadEditMode() : "review");
|
|
27999
|
+
const [preset2, setPreset] = useState20(() => {
|
|
27917
28000
|
if (model2 === "deepseek-v4-pro") return "pro";
|
|
27918
28001
|
return "auto";
|
|
27919
28002
|
});
|
|
@@ -27925,12 +28008,12 @@ function AppInner({
|
|
|
27925
28008
|
const planModeRef = useRef9(false);
|
|
27926
28009
|
const currentRootDirRef = useRef9("");
|
|
27927
28010
|
const latestVersionRef = useRef9(null);
|
|
27928
|
-
const [pendingEditReview, setPendingEditReview] =
|
|
27929
|
-
const [walkthroughActive, setWalkthroughActive] =
|
|
27930
|
-
const [pendingTick, setPendingTick] =
|
|
28011
|
+
const [pendingEditReview, setPendingEditReview] = useState20(null);
|
|
28012
|
+
const [walkthroughActive, setWalkthroughActive] = useState20(false);
|
|
28013
|
+
const [pendingTick, setPendingTick] = useState20(0);
|
|
27931
28014
|
const editReviewResolveRef = useRef9(null);
|
|
27932
28015
|
const turnEditPolicyRef = useRef9("ask");
|
|
27933
|
-
const [modeFlash, setModeFlash] =
|
|
28016
|
+
const [modeFlash, setModeFlash] = useState20(false);
|
|
27934
28017
|
const modeFlashTimeoutRef = useRef9(null);
|
|
27935
28018
|
const prevEditModeRef = useRef9(editMode);
|
|
27936
28019
|
useEffect12(() => {
|
|
@@ -27943,23 +28026,24 @@ function AppInner({
|
|
|
27943
28026
|
modeFlashTimeoutRef.current = null;
|
|
27944
28027
|
}, 1200);
|
|
27945
28028
|
}, [editMode]);
|
|
27946
|
-
const [pendingShell, setPendingShell] =
|
|
27947
|
-
const [pendingPlan, setPendingPlan] =
|
|
27948
|
-
const [pendingReviseEditor, setPendingReviseEditor] =
|
|
27949
|
-
const [pendingSessionsPicker, setPendingSessionsPicker] =
|
|
27950
|
-
const [sessionsPickerList, setSessionsPickerList] =
|
|
27951
|
-
const [pendingMcpHub, setPendingMcpHub] =
|
|
27952
|
-
const [
|
|
27953
|
-
const [
|
|
27954
|
-
const [
|
|
27955
|
-
const [
|
|
27956
|
-
const [
|
|
27957
|
-
const [
|
|
27958
|
-
const
|
|
27959
|
-
const
|
|
27960
|
-
const [
|
|
27961
|
-
const [
|
|
27962
|
-
const [
|
|
28029
|
+
const [pendingShell, setPendingShell] = useState20(null);
|
|
28030
|
+
const [pendingPlan, setPendingPlan] = useState20(null);
|
|
28031
|
+
const [pendingReviseEditor, setPendingReviseEditor] = useState20(null);
|
|
28032
|
+
const [pendingSessionsPicker, setPendingSessionsPicker] = useState20(false);
|
|
28033
|
+
const [sessionsPickerList, setSessionsPickerList] = useState20([]);
|
|
28034
|
+
const [pendingMcpHub, setPendingMcpHub] = useState20(null);
|
|
28035
|
+
const [pendingModelPicker, setPendingModelPicker] = useState20(false);
|
|
28036
|
+
const [stagedInput, setStagedInput] = useState20(null);
|
|
28037
|
+
const [pendingCheckpoint, setPendingCheckpoint] = useState20(null);
|
|
28038
|
+
const [stagedCheckpointRevise, setStagedCheckpointRevise] = useState20(null);
|
|
28039
|
+
const [pendingRevision, setPendingRevision] = useState20(null);
|
|
28040
|
+
const [pendingChoice, setPendingChoice] = useState20(null);
|
|
28041
|
+
const [stagedChoiceCustom, setStagedChoiceCustom] = useState20(null);
|
|
28042
|
+
const modalOpen = !!pendingShell || !!pendingPlan || !!pendingReviseEditor || !!pendingSessionsPicker || !!pendingMcpHub || pendingModelPicker || !!stagedInput || !!pendingEditReview || walkthroughActive || !!pendingChoice || !!stagedChoiceCustom || !!pendingRevision || !!stagedCheckpointRevise || !!pendingCheckpoint;
|
|
28043
|
+
const [planMode, setPlanMode] = useState20(false);
|
|
28044
|
+
const [proArmed, setProArmed] = useState20(false);
|
|
28045
|
+
const [turnOnPro, setTurnOnPro] = useState20(false);
|
|
28046
|
+
const [queuedSubmit, setQueuedSubmit] = useState20(null);
|
|
27963
28047
|
const { recallPrev, recallNext, pushHistory, resetCursor } = useInputRecall(setInput);
|
|
27964
28048
|
const assistantIterCounter = useRef9(0);
|
|
27965
28049
|
const atUrlCache = useRef9(/* @__PURE__ */ new Map());
|
|
@@ -27986,7 +28070,7 @@ function AppInner({
|
|
|
27986
28070
|
if (planSummaryRef.current) extras.summary = planSummaryRef.current;
|
|
27987
28071
|
savePlanState(session, steps, completedStepIdsRef.current, extras);
|
|
27988
28072
|
}, [session]);
|
|
27989
|
-
const [summary, setSummary] =
|
|
28073
|
+
const [summary, setSummary] = useState20({
|
|
27990
28074
|
turns: 0,
|
|
27991
28075
|
totalCostUsd: 0,
|
|
27992
28076
|
totalInputCostUsd: 0,
|
|
@@ -28762,7 +28846,7 @@ function AppInner({
|
|
|
28762
28846
|
const getDashboardUrl = useCallback11(() => {
|
|
28763
28847
|
return dashboardRef.current?.url ?? null;
|
|
28764
28848
|
}, []);
|
|
28765
|
-
const [dashboardUrl, setDashboardUrlState] =
|
|
28849
|
+
const [dashboardUrl, setDashboardUrlState] = useState20(null);
|
|
28766
28850
|
useEffect12(() => {
|
|
28767
28851
|
if (noDashboard) return;
|
|
28768
28852
|
if (dashboardRef.current) return;
|
|
@@ -28965,6 +29049,11 @@ function AppInner({
|
|
|
28965
29049
|
pushHistory(text);
|
|
28966
29050
|
return;
|
|
28967
29051
|
}
|
|
29052
|
+
if (result.openModelPicker) {
|
|
29053
|
+
setPendingModelPicker(true);
|
|
29054
|
+
pushHistory(text);
|
|
29055
|
+
return;
|
|
29056
|
+
}
|
|
28968
29057
|
if (result.openArgPickerFor) {
|
|
28969
29058
|
pushHistory(text);
|
|
28970
29059
|
setInput(`/${result.openArgPickerFor} `);
|
|
@@ -29158,9 +29247,15 @@ function AppInner({
|
|
|
29158
29247
|
const cost2 = (m.totalCostUsd ?? 0) + (ev.stats?.cost ?? 0);
|
|
29159
29248
|
const turn = (m.turnCount ?? 0) + 1;
|
|
29160
29249
|
const currency = walletCurrencyRef.current;
|
|
29250
|
+
const u = ev.stats?.usage;
|
|
29251
|
+
const cacheHitTokens = (m.cacheHitTokens ?? 0) + (u?.promptCacheHitTokens ?? 0);
|
|
29252
|
+
const cacheMissTokens = (m.cacheMissTokens ?? 0) + (u?.promptCacheMissTokens ?? 0);
|
|
29161
29253
|
patchSessionMeta(session, {
|
|
29162
29254
|
totalCostUsd: cost2,
|
|
29163
29255
|
turnCount: turn,
|
|
29256
|
+
cacheHitTokens,
|
|
29257
|
+
cacheMissTokens,
|
|
29258
|
+
...u?.promptTokens ? { lastPromptTokens: u.promptTokens } : {},
|
|
29164
29259
|
...currency ? { balanceCurrency: currency } : {}
|
|
29165
29260
|
});
|
|
29166
29261
|
}
|
|
@@ -29657,42 +29752,43 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29657
29752
|
[]
|
|
29658
29753
|
);
|
|
29659
29754
|
const tickerSuspended = PLAIN_UI || modalOpen || !busy && !isStreaming;
|
|
29660
|
-
return /* @__PURE__ */
|
|
29755
|
+
return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(TickerProvider, { disabled: tickerSuspended }, /* @__PURE__ */ React62.createElement(ViewportBudgetProvider, null, /* @__PURE__ */ React62.createElement(Box49, { flexDirection: "row", height: stdout4?.rows ?? 24 }, /* @__PURE__ */ React62.createElement(Box49, { flexDirection: "column", flexGrow: 1 }, /* @__PURE__ */ React62.createElement(Box49, { flexDirection: "column", flexGrow: 1 }, /* @__PURE__ */ React62.createElement(LiveExpandContext.Provider, { value: liveExpand }, /* @__PURE__ */ React62.createElement(
|
|
29661
29756
|
CardStream,
|
|
29662
29757
|
{
|
|
29663
29758
|
suppressLive: modalOpen,
|
|
29664
29759
|
scrollRows: chatScroll.scrollRows,
|
|
29665
29760
|
onMaxScrollChange: chatScroll.setMaxScroll
|
|
29666
29761
|
}
|
|
29667
|
-
)), !hasConversation && !busy && !isStreaming ? /* @__PURE__ */
|
|
29762
|
+
)), !hasConversation && !busy && !isStreaming ? /* @__PURE__ */ React62.createElement(
|
|
29668
29763
|
WelcomeBanner,
|
|
29669
29764
|
{
|
|
29670
29765
|
inCodeMode: !!codeMode,
|
|
29766
|
+
workspaceRoot: codeMode ? currentRootDir : void 0,
|
|
29671
29767
|
dashboardUrl,
|
|
29672
29768
|
languageVersion
|
|
29673
29769
|
}
|
|
29674
|
-
) : null, !PLAIN_UI && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpHub && !stagedInput && !pendingEditReview && ongoingTool ? /* @__PURE__ */
|
|
29770
|
+
) : null, !PLAIN_UI && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpHub && !stagedInput && !pendingEditReview && ongoingTool ? /* @__PURE__ */ React62.createElement(OngoingToolRow, { tool: ongoingTool, progress: toolProgress }) : null, !PLAIN_UI && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpHub && !stagedInput && !pendingEditReview && subagentActivities.length > 0 ? /* @__PURE__ */ React62.createElement(SubagentLiveStack, { activities: subagentActivities, max: 3 }) : null, !PLAIN_UI && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpHub && !stagedInput && !pendingEditReview && !ongoingTool && statusLine ? /* @__PURE__ */ React62.createElement(ThinkingRow, { text: statusLine }) : null, !PLAIN_UI && undoBanner && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpHub && !stagedInput && !pendingEditReview && !pendingChoice && !stagedChoiceCustom && !pendingRevision && !stagedCheckpointRevise && !pendingCheckpoint ? /* @__PURE__ */ React62.createElement(UndoBanner, { banner: undoBanner }) : null, !PLAIN_UI && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpHub && !stagedInput && !pendingEditReview && busy && !isStreaming && !ongoingTool && !statusLine ? /* @__PURE__ */ React62.createElement(ThinkingRow, { text: "processing\u2026" }) : null, !PLAIN_UI && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpHub && !stagedInput && !pendingEditReview ? /* @__PURE__ */ React62.createElement(PlanLiveRow, null) : null, /* @__PURE__ */ React62.createElement(ToastRail, null)), stagedInput ? /* @__PURE__ */ React62.createElement(
|
|
29675
29771
|
PlanRefineInput,
|
|
29676
29772
|
{
|
|
29677
29773
|
mode: stagedInput.mode,
|
|
29678
29774
|
onSubmit: handleStagedInputSubmit,
|
|
29679
29775
|
onCancel: handleStagedInputCancel
|
|
29680
29776
|
}
|
|
29681
|
-
) : stagedChoiceCustom ? /* @__PURE__ */
|
|
29777
|
+
) : stagedChoiceCustom ? /* @__PURE__ */ React62.createElement(
|
|
29682
29778
|
PlanRefineInput,
|
|
29683
29779
|
{
|
|
29684
29780
|
mode: "choice-custom",
|
|
29685
29781
|
onSubmit: handleChoiceCustomSubmit,
|
|
29686
29782
|
onCancel: handleChoiceCustomCancel
|
|
29687
29783
|
}
|
|
29688
|
-
) : stagedCheckpointRevise ? /* @__PURE__ */
|
|
29784
|
+
) : stagedCheckpointRevise ? /* @__PURE__ */ React62.createElement(
|
|
29689
29785
|
PlanRefineInput,
|
|
29690
29786
|
{
|
|
29691
29787
|
mode: "checkpoint-revise",
|
|
29692
29788
|
onSubmit: (text) => handleCheckpointReviseSubmit(text, stagedCheckpointRevise),
|
|
29693
29789
|
onCancel: handleCheckpointReviseCancel
|
|
29694
29790
|
}
|
|
29695
|
-
) : pendingChoice ? /* @__PURE__ */
|
|
29791
|
+
) : pendingChoice ? /* @__PURE__ */ React62.createElement(
|
|
29696
29792
|
ChoiceConfirm,
|
|
29697
29793
|
{
|
|
29698
29794
|
question: pendingChoice.question,
|
|
@@ -29700,7 +29796,7 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29700
29796
|
allowCustom: pendingChoice.allowCustom,
|
|
29701
29797
|
onChoose: stableHandleChoiceConfirm
|
|
29702
29798
|
}
|
|
29703
|
-
) : pendingRevision ? /* @__PURE__ */
|
|
29799
|
+
) : pendingRevision ? /* @__PURE__ */ React62.createElement(
|
|
29704
29800
|
PlanReviseConfirm,
|
|
29705
29801
|
{
|
|
29706
29802
|
reason: pendingRevision.reason,
|
|
@@ -29711,7 +29807,7 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29711
29807
|
summary: pendingRevision.summary,
|
|
29712
29808
|
onChoose: stableHandleReviseConfirm
|
|
29713
29809
|
}
|
|
29714
|
-
) : pendingCheckpoint ? /* @__PURE__ */
|
|
29810
|
+
) : pendingCheckpoint ? /* @__PURE__ */ React62.createElement(
|
|
29715
29811
|
PlanCheckpointConfirm,
|
|
29716
29812
|
{
|
|
29717
29813
|
stepId: pendingCheckpoint.stepId,
|
|
@@ -29722,7 +29818,7 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29722
29818
|
completedStepIds: completedStepIdsRef.current,
|
|
29723
29819
|
onChoose: stableHandleCheckpointConfirm
|
|
29724
29820
|
}
|
|
29725
|
-
) : pendingSessionsPicker ? /* @__PURE__ */
|
|
29821
|
+
) : pendingSessionsPicker ? /* @__PURE__ */ React62.createElement(
|
|
29726
29822
|
SessionPicker,
|
|
29727
29823
|
{
|
|
29728
29824
|
sessions: sessionsPickerList,
|
|
@@ -29766,7 +29862,22 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29766
29862
|
}
|
|
29767
29863
|
}
|
|
29768
29864
|
}
|
|
29769
|
-
) :
|
|
29865
|
+
) : pendingModelPicker ? /* @__PURE__ */ React62.createElement(
|
|
29866
|
+
ModelPicker,
|
|
29867
|
+
{
|
|
29868
|
+
models: models2,
|
|
29869
|
+
current: loop2.model,
|
|
29870
|
+
onRefresh: refreshModels,
|
|
29871
|
+
onChoose: (outcome) => {
|
|
29872
|
+
setPendingModelPicker(false);
|
|
29873
|
+
if (outcome.kind === "select") {
|
|
29874
|
+
loop2.configure({ model: outcome.id });
|
|
29875
|
+
agentStore.dispatch({ type: "session.model.change", model: outcome.id });
|
|
29876
|
+
log.pushInfo(`\u25B8 model: ${outcome.id}`);
|
|
29877
|
+
}
|
|
29878
|
+
}
|
|
29879
|
+
}
|
|
29880
|
+
) : pendingMcpHub ? /* @__PURE__ */ React62.createElement(
|
|
29770
29881
|
McpHub,
|
|
29771
29882
|
{
|
|
29772
29883
|
initialTab: pendingMcpHub.tab,
|
|
@@ -29785,7 +29896,7 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29785
29896
|
return r;
|
|
29786
29897
|
} : void 0
|
|
29787
29898
|
}
|
|
29788
|
-
) : pendingPlan ? /* @__PURE__ */
|
|
29899
|
+
) : pendingPlan ? /* @__PURE__ */ React62.createElement(
|
|
29789
29900
|
PlanConfirm,
|
|
29790
29901
|
{
|
|
29791
29902
|
plan: pendingPlan,
|
|
@@ -29794,7 +29905,7 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29794
29905
|
onChoose: stableHandlePlanConfirm,
|
|
29795
29906
|
projectRoot: currentRootDir
|
|
29796
29907
|
}
|
|
29797
|
-
) : pendingReviseEditor ? /* @__PURE__ */
|
|
29908
|
+
) : pendingReviseEditor ? /* @__PURE__ */ React62.createElement(
|
|
29798
29909
|
PlanReviseEditor,
|
|
29799
29910
|
{
|
|
29800
29911
|
steps: planStepsRef.current ?? [],
|
|
@@ -29813,7 +29924,7 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29813
29924
|
setPendingPlan(planText);
|
|
29814
29925
|
}
|
|
29815
29926
|
}
|
|
29816
|
-
) : pendingShell ? /* @__PURE__ */
|
|
29927
|
+
) : pendingShell ? /* @__PURE__ */ React62.createElement(
|
|
29817
29928
|
ShellConfirm,
|
|
29818
29929
|
{
|
|
29819
29930
|
command: pendingShell.command,
|
|
@@ -29821,7 +29932,7 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29821
29932
|
kind: pendingShell.kind,
|
|
29822
29933
|
onChoose: handleShellConfirm
|
|
29823
29934
|
}
|
|
29824
|
-
) : pendingEditReview ? /* @__PURE__ */
|
|
29935
|
+
) : pendingEditReview ? /* @__PURE__ */ React62.createElement(
|
|
29825
29936
|
EditConfirm,
|
|
29826
29937
|
{
|
|
29827
29938
|
block: pendingEditReview,
|
|
@@ -29833,14 +29944,14 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29833
29944
|
}
|
|
29834
29945
|
}
|
|
29835
29946
|
}
|
|
29836
|
-
) : walkthroughActive && pendingEdits.current.length > 0 ? /* @__PURE__ */
|
|
29947
|
+
) : walkthroughActive && pendingEdits.current.length > 0 ? /* @__PURE__ */ React62.createElement(
|
|
29837
29948
|
EditConfirm,
|
|
29838
29949
|
{
|
|
29839
29950
|
key: `walk-${pendingTick}`,
|
|
29840
29951
|
block: pendingEdits.current[0],
|
|
29841
29952
|
onChoose: handleWalkChoice
|
|
29842
29953
|
}
|
|
29843
|
-
) : !chatScroll.pinned ? /* @__PURE__ */
|
|
29954
|
+
) : !chatScroll.pinned ? /* @__PURE__ */ React62.createElement(Text53, { color: FG.faint }, " \u{1F4D6} reading history \u2014 End / PgDn to return \xB7 \u2193 to advance one line") : /* @__PURE__ */ React62.createElement(React62.Fragment, null, codeMode ? /* @__PURE__ */ React62.createElement(
|
|
29844
29955
|
ModeStatusBar,
|
|
29845
29956
|
{
|
|
29846
29957
|
editMode,
|
|
@@ -29850,7 +29961,7 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29850
29961
|
undoArmed: !!undoBanner || hasUndoable(),
|
|
29851
29962
|
jobs: codeMode.jobs
|
|
29852
29963
|
}
|
|
29853
|
-
) : null, activeLoop ? /* @__PURE__ */
|
|
29964
|
+
) : null, activeLoop ? /* @__PURE__ */ React62.createElement(LoopStatusRow, { loop: activeLoop }) : null, /* @__PURE__ */ React62.createElement(StatusRow, null), /* @__PURE__ */ React62.createElement(
|
|
29854
29965
|
PromptInput,
|
|
29855
29966
|
{
|
|
29856
29967
|
value: input,
|
|
@@ -29862,14 +29973,14 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29862
29973
|
onChatScrollUp: chatScroll.scrollUp,
|
|
29863
29974
|
onChatScrollDown: chatScroll.scrollDown
|
|
29864
29975
|
}
|
|
29865
|
-
), slashMatches !== null ? /* @__PURE__ */
|
|
29976
|
+
), slashMatches !== null ? /* @__PURE__ */ React62.createElement(SlashSuggestions, { matches: slashMatches, selectedIndex: slashSelected }) : null, atMatches !== null ? /* @__PURE__ */ React62.createElement(
|
|
29866
29977
|
AtMentionSuggestions,
|
|
29867
29978
|
{
|
|
29868
29979
|
matches: atMatches,
|
|
29869
29980
|
selectedIndex: atSelected,
|
|
29870
29981
|
query: atPicker?.query ?? ""
|
|
29871
29982
|
}
|
|
29872
|
-
) : null, slashArgContext ? /* @__PURE__ */
|
|
29983
|
+
) : null, slashArgContext ? /* @__PURE__ */ React62.createElement(
|
|
29873
29984
|
SlashArgPicker,
|
|
29874
29985
|
{
|
|
29875
29986
|
matches: slashArgMatches,
|
|
@@ -29882,12 +29993,12 @@ Stay in plan mode \u2014 address the feedback (explore more if needed), then sub
|
|
|
29882
29993
|
}
|
|
29883
29994
|
|
|
29884
29995
|
// src/cli/ui/Setup.tsx
|
|
29885
|
-
import { Box as
|
|
29886
|
-
import
|
|
29996
|
+
import { Box as Box50, Text as Text55, useApp } from "ink";
|
|
29997
|
+
import React64, { useState as useState21 } from "react";
|
|
29887
29998
|
|
|
29888
29999
|
// src/cli/ui/MaskedInput.tsx
|
|
29889
|
-
import { Text as
|
|
29890
|
-
import
|
|
30000
|
+
import { Text as Text54, useInput as useInput2 } from "ink";
|
|
30001
|
+
import React63, { useRef as useRef10 } from "react";
|
|
29891
30002
|
function stripPasteMarkers(s) {
|
|
29892
30003
|
return s.replace(/\u001b?\[20[01]~/g, "").replace(/\u001b/g, "");
|
|
29893
30004
|
}
|
|
@@ -29922,17 +30033,17 @@ function MaskedInput({
|
|
|
29922
30033
|
});
|
|
29923
30034
|
if (value.length === 0) {
|
|
29924
30035
|
if (placeholder.length === 0) {
|
|
29925
|
-
return /* @__PURE__ */
|
|
30036
|
+
return /* @__PURE__ */ React63.createElement(Text54, { inverse: true }, " ");
|
|
29926
30037
|
}
|
|
29927
|
-
return /* @__PURE__ */
|
|
30038
|
+
return /* @__PURE__ */ React63.createElement(React63.Fragment, null, /* @__PURE__ */ React63.createElement(Text54, { inverse: true }, placeholder[0]), /* @__PURE__ */ React63.createElement(Text54, { color: FG.faint }, placeholder.slice(1)));
|
|
29928
30039
|
}
|
|
29929
|
-
return /* @__PURE__ */
|
|
30040
|
+
return /* @__PURE__ */ React63.createElement(React63.Fragment, null, /* @__PURE__ */ React63.createElement(Text54, null, mask.repeat(value.length)), /* @__PURE__ */ React63.createElement(Text54, { inverse: true }, " "));
|
|
29930
30041
|
}
|
|
29931
30042
|
|
|
29932
30043
|
// src/cli/ui/Setup.tsx
|
|
29933
30044
|
function Setup({ onReady }) {
|
|
29934
|
-
const [value, setValue] =
|
|
29935
|
-
const [error, setError] =
|
|
30045
|
+
const [value, setValue] = useState21("");
|
|
30046
|
+
const [error, setError] = useState21(null);
|
|
29936
30047
|
const { exit: exit2 } = useApp();
|
|
29937
30048
|
const handleSubmit2 = (raw) => {
|
|
29938
30049
|
const trimmed = raw.trim();
|
|
@@ -29953,7 +30064,7 @@ function Setup({ onReady }) {
|
|
|
29953
30064
|
}
|
|
29954
30065
|
onReady(trimmed);
|
|
29955
30066
|
};
|
|
29956
|
-
return /* @__PURE__ */
|
|
30067
|
+
return /* @__PURE__ */ React64.createElement(Box50, { flexDirection: "column", paddingX: 1, marginY: 1 }, /* @__PURE__ */ React64.createElement(Box50, null, /* @__PURE__ */ React64.createElement(Text55, { bold: true, color: GRADIENT[0] }, GLYPH.brand), /* @__PURE__ */ React64.createElement(Text55, null, " "), /* @__PURE__ */ React64.createElement(Text55, { bold: true }, "Welcome to "), /* @__PURE__ */ React64.createElement(Text55, { bold: true, color: GRADIENT[2] }, "REASONIX")), /* @__PURE__ */ React64.createElement(Box50, { marginTop: 1 }, /* @__PURE__ */ React64.createElement(Text55, { color: COLOR.info }, "Paste your DeepSeek API key to get started.")), /* @__PURE__ */ React64.createElement(Box50, null, /* @__PURE__ */ React64.createElement(Text55, { dimColor: true }, " sign up at \xB7 "), /* @__PURE__ */ React64.createElement(Text55, { color: COLOR.primary }, "https://platform.deepseek.com/api_keys")), /* @__PURE__ */ React64.createElement(Box50, null, /* @__PURE__ */ React64.createElement(Text55, { dimColor: true }, " saved to "), /* @__PURE__ */ React64.createElement(Text55, { dimColor: true }, defaultConfigPath())), /* @__PURE__ */ React64.createElement(Box50, { marginTop: 1 }, /* @__PURE__ */ React64.createElement(Text55, { bold: true, color: COLOR.brand }, GLYPH.bar), /* @__PURE__ */ React64.createElement(Text55, { bold: true, color: COLOR.primary }, " \u203A "), /* @__PURE__ */ React64.createElement(
|
|
29957
30068
|
MaskedInput,
|
|
29958
30069
|
{
|
|
29959
30070
|
value,
|
|
@@ -29962,7 +30073,41 @@ function Setup({ onReady }) {
|
|
|
29962
30073
|
mask: "\u2022",
|
|
29963
30074
|
placeholder: "sk-..."
|
|
29964
30075
|
}
|
|
29965
|
-
)), error ? /* @__PURE__ */
|
|
30076
|
+
)), error ? /* @__PURE__ */ React64.createElement(Box50, { marginTop: 1 }, /* @__PURE__ */ React64.createElement(Text55, { color: COLOR.err, bold: true }, GLYPH.err), /* @__PURE__ */ React64.createElement(Text55, { color: COLOR.err }, ` ${error}`)) : value ? /* @__PURE__ */ React64.createElement(Box50, { marginTop: 1 }, /* @__PURE__ */ React64.createElement(Text55, { dimColor: true }, ` preview \xB7 ${redactKey(value)}`)) : null, /* @__PURE__ */ React64.createElement(Box50, { marginTop: 1 }, /* @__PURE__ */ React64.createElement(Text55, { dimColor: true }, " /exit to abort")));
|
|
30077
|
+
}
|
|
30078
|
+
|
|
30079
|
+
// src/cli/ui/drain-tty.ts
|
|
30080
|
+
import process2 from "process";
|
|
30081
|
+
async function drainTtyResponses(timeoutMs = 50) {
|
|
30082
|
+
const stdin5 = process2.stdin;
|
|
30083
|
+
if (!stdin5.isTTY && typeof stdin5.setRawMode !== "function") {
|
|
30084
|
+
return;
|
|
30085
|
+
}
|
|
30086
|
+
let raised = false;
|
|
30087
|
+
try {
|
|
30088
|
+
stdin5.setRawMode(true);
|
|
30089
|
+
raised = true;
|
|
30090
|
+
} catch {
|
|
30091
|
+
return;
|
|
30092
|
+
}
|
|
30093
|
+
stdin5.resume();
|
|
30094
|
+
await new Promise((resolve12) => {
|
|
30095
|
+
const onData = (_chunk) => {
|
|
30096
|
+
};
|
|
30097
|
+
stdin5.on("data", onData);
|
|
30098
|
+
const timer = setTimeout(() => {
|
|
30099
|
+
stdin5.off("data", onData);
|
|
30100
|
+
stdin5.pause();
|
|
30101
|
+
if (raised) {
|
|
30102
|
+
try {
|
|
30103
|
+
stdin5.setRawMode(false);
|
|
30104
|
+
} catch {
|
|
30105
|
+
}
|
|
30106
|
+
}
|
|
30107
|
+
resolve12();
|
|
30108
|
+
}, timeoutMs);
|
|
30109
|
+
timer.unref();
|
|
30110
|
+
});
|
|
29966
30111
|
}
|
|
29967
30112
|
|
|
29968
30113
|
// src/cli/ui/mcp-toast.ts
|
|
@@ -30139,13 +30284,13 @@ function Root({
|
|
|
30139
30284
|
mcpRuntime,
|
|
30140
30285
|
...appProps
|
|
30141
30286
|
}) {
|
|
30142
|
-
const [key, setKey] =
|
|
30143
|
-
const [pickerOpen, setPickerOpen] =
|
|
30144
|
-
const [activeSession, setActiveSession] =
|
|
30287
|
+
const [key, setKey] = useState22(initialKey);
|
|
30288
|
+
const [pickerOpen, setPickerOpen] = useState22(showPicker);
|
|
30289
|
+
const [activeSession, setActiveSession] = useState22(appProps.session);
|
|
30145
30290
|
const workspaceRoot = appProps.codeMode?.rootDir ?? process.cwd();
|
|
30146
|
-
const [sessions2, setSessions] =
|
|
30291
|
+
const [sessions2, setSessions] = useState22(() => listSessionsForWorkspace(workspaceRoot));
|
|
30147
30292
|
if (!key) {
|
|
30148
|
-
return /* @__PURE__ */
|
|
30293
|
+
return /* @__PURE__ */ React65.createElement(
|
|
30149
30294
|
Setup,
|
|
30150
30295
|
{
|
|
30151
30296
|
onReady: (k) => {
|
|
@@ -30157,7 +30302,7 @@ function Root({
|
|
|
30157
30302
|
}
|
|
30158
30303
|
process.env.DEEPSEEK_API_KEY = key;
|
|
30159
30304
|
if (pickerOpen) {
|
|
30160
|
-
return /* @__PURE__ */
|
|
30305
|
+
return /* @__PURE__ */ React65.createElement(KeystrokeProvider, null, /* @__PURE__ */ React65.createElement(
|
|
30161
30306
|
SessionPicker,
|
|
30162
30307
|
{
|
|
30163
30308
|
sessions: sessions2,
|
|
@@ -30190,7 +30335,7 @@ function Root({
|
|
|
30190
30335
|
}
|
|
30191
30336
|
));
|
|
30192
30337
|
}
|
|
30193
|
-
return /* @__PURE__ */
|
|
30338
|
+
return /* @__PURE__ */ React65.createElement(KeystrokeProvider, null, /* @__PURE__ */ React65.createElement(
|
|
30194
30339
|
App,
|
|
30195
30340
|
{
|
|
30196
30341
|
key: activeSession ?? "__new__",
|
|
@@ -30255,7 +30400,7 @@ async function chatCommand(opts) {
|
|
|
30255
30400
|
const launchWorkspace = opts.codeMode?.rootDir ?? process.cwd();
|
|
30256
30401
|
const showPicker = !opts.session && !opts.forceResume && listSessionsForWorkspace(launchWorkspace).length > 0;
|
|
30257
30402
|
const { waitUntilExit } = render(
|
|
30258
|
-
/* @__PURE__ */
|
|
30403
|
+
/* @__PURE__ */ React65.createElement(
|
|
30259
30404
|
Root,
|
|
30260
30405
|
{
|
|
30261
30406
|
initialKey,
|
|
@@ -30284,6 +30429,7 @@ async function chatCommand(opts) {
|
|
|
30284
30429
|
await waitUntilExit();
|
|
30285
30430
|
} finally {
|
|
30286
30431
|
await runtime.closeAll();
|
|
30432
|
+
await drainTtyResponses();
|
|
30287
30433
|
}
|
|
30288
30434
|
}
|
|
30289
30435
|
|
|
@@ -30641,19 +30787,19 @@ async function commitCommand(opts = {}) {
|
|
|
30641
30787
|
import { writeFileSync as writeFileSync14 } from "fs";
|
|
30642
30788
|
import { basename as basename3 } from "path";
|
|
30643
30789
|
import { render as render2 } from "ink";
|
|
30644
|
-
import
|
|
30790
|
+
import React69 from "react";
|
|
30645
30791
|
|
|
30646
30792
|
// src/cli/ui/DiffApp.tsx
|
|
30647
|
-
import { Box as
|
|
30648
|
-
import
|
|
30793
|
+
import { Box as Box53, Static, Text as Text58, useApp as useApp2, useInput as useInput3 } from "ink";
|
|
30794
|
+
import React68, { useState as useState23 } from "react";
|
|
30649
30795
|
|
|
30650
30796
|
// src/cli/ui/RecordView.tsx
|
|
30651
|
-
import { Box as
|
|
30652
|
-
import
|
|
30797
|
+
import { Box as Box52, Text as Text57 } from "ink";
|
|
30798
|
+
import React67 from "react";
|
|
30653
30799
|
|
|
30654
30800
|
// src/cli/ui/PlanStateBlock.tsx
|
|
30655
|
-
import { Box as
|
|
30656
|
-
import
|
|
30801
|
+
import { Box as Box51, Text as Text56 } from "ink";
|
|
30802
|
+
import React66 from "react";
|
|
30657
30803
|
function PlanStateBlock({ planState }) {
|
|
30658
30804
|
const fields = [];
|
|
30659
30805
|
if (planState.subgoals.length)
|
|
@@ -30665,7 +30811,7 @@ function PlanStateBlock({ planState }) {
|
|
|
30665
30811
|
if (planState.rejectedPaths.length)
|
|
30666
30812
|
fields.push(["rejected", planState.rejectedPaths, COLOR.info, true]);
|
|
30667
30813
|
if (fields.length === 0) return null;
|
|
30668
|
-
return /* @__PURE__ */
|
|
30814
|
+
return /* @__PURE__ */ React66.createElement(Box51, { flexDirection: "column", marginBottom: 1 }, fields.map(([label, items, color2, dim]) => /* @__PURE__ */ React66.createElement(Box51, { key: label }, /* @__PURE__ */ React66.createElement(Text56, { color: color2, bold: true, dimColor: dim }, label), /* @__PURE__ */ React66.createElement(Text56, { dimColor: true }, ` (${items.length})`), /* @__PURE__ */ React66.createElement(Text56, { dimColor: true }, " \xB7 "), /* @__PURE__ */ React66.createElement(Text56, { dimColor: dim, color: dim ? void 0 : COLOR.info }, items.join(" \xB7 ")))));
|
|
30669
30815
|
}
|
|
30670
30816
|
|
|
30671
30817
|
// src/cli/ui/RecordView.tsx
|
|
@@ -30674,21 +30820,21 @@ function RecordView({ rec, compact: compact2 = false }) {
|
|
|
30674
30820
|
const toolContentMax = compact2 ? 200 : 400;
|
|
30675
30821
|
if (rec.role === "user") {
|
|
30676
30822
|
const content = rec.content.includes("\n") ? rec.content.split("\n").join("\n ") : rec.content;
|
|
30677
|
-
return /* @__PURE__ */
|
|
30823
|
+
return /* @__PURE__ */ React67.createElement(Box52, { marginTop: 1 }, /* @__PURE__ */ React67.createElement(Text57, { bold: true, color: "cyan" }, "you \u203A", " "), /* @__PURE__ */ React67.createElement(Text57, null, content));
|
|
30678
30824
|
}
|
|
30679
30825
|
if (rec.role === "assistant_final") {
|
|
30680
|
-
return /* @__PURE__ */
|
|
30826
|
+
return /* @__PURE__ */ React67.createElement(Box52, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React67.createElement(Box52, null, /* @__PURE__ */ React67.createElement(Text57, { bold: true, color: "green" }, "assistant"), rec.cost !== void 0 ? /* @__PURE__ */ React67.createElement(Text57, { dimColor: true }, " $", rec.cost.toFixed(6)) : null, rec.usage ? /* @__PURE__ */ React67.createElement(CacheBadge, { usage: rec.usage }) : null), rec.planState ? /* @__PURE__ */ React67.createElement(PlanStateBlock, { planState: rec.planState }) : null, rec.content ? /* @__PURE__ */ React67.createElement(Text57, null, rec.content) : /* @__PURE__ */ React67.createElement(Text57, { dimColor: true, italic: true }, "(tool-call response only)"));
|
|
30681
30827
|
}
|
|
30682
30828
|
if (rec.role === "tool") {
|
|
30683
|
-
return /* @__PURE__ */
|
|
30829
|
+
return /* @__PURE__ */ React67.createElement(Box52, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React67.createElement(Text57, { color: "yellow" }, "tool<", rec.tool ?? "?", ">"), rec.args ? /* @__PURE__ */ React67.createElement(Text57, { dimColor: true }, " args: ", truncate4(rec.args, toolArgsMax)) : null, /* @__PURE__ */ React67.createElement(Text57, { dimColor: true }, " \u2192 ", truncate4(rec.content, toolContentMax)));
|
|
30684
30830
|
}
|
|
30685
30831
|
if (rec.role === "error") {
|
|
30686
|
-
return /* @__PURE__ */
|
|
30832
|
+
return /* @__PURE__ */ React67.createElement(Box52, { marginTop: 1 }, /* @__PURE__ */ React67.createElement(Text57, { color: "red", bold: true }, "error", " "), /* @__PURE__ */ React67.createElement(Text57, { color: "red" }, rec.error ?? rec.content));
|
|
30687
30833
|
}
|
|
30688
30834
|
if (rec.role === "done" || rec.role === "assistant_delta") {
|
|
30689
30835
|
return null;
|
|
30690
30836
|
}
|
|
30691
|
-
return /* @__PURE__ */
|
|
30837
|
+
return /* @__PURE__ */ React67.createElement(Box52, null, /* @__PURE__ */ React67.createElement(Text57, { dimColor: true }, "[", rec.role, "] ", rec.content));
|
|
30692
30838
|
}
|
|
30693
30839
|
function CacheBadge({ usage }) {
|
|
30694
30840
|
const hit = usage.prompt_cache_hit_tokens ?? 0;
|
|
@@ -30697,7 +30843,7 @@ function CacheBadge({ usage }) {
|
|
|
30697
30843
|
if (total === 0) return null;
|
|
30698
30844
|
const pct2 = hit / total * 100;
|
|
30699
30845
|
const color2 = pct2 >= 70 ? "green" : pct2 >= 40 ? "yellow" : "red";
|
|
30700
|
-
return /* @__PURE__ */
|
|
30846
|
+
return /* @__PURE__ */ React67.createElement(Text57, null, /* @__PURE__ */ React67.createElement(Text57, { dimColor: true }, " \xB7 cache "), /* @__PURE__ */ React67.createElement(Text57, { color: color2 }, pct2.toFixed(1), "%"));
|
|
30701
30847
|
}
|
|
30702
30848
|
function truncate4(s, max) {
|
|
30703
30849
|
return s.length <= max ? s : `${s.slice(0, max)}\u2026 (+${s.length - max} chars)`;
|
|
@@ -30708,7 +30854,7 @@ function DiffApp({ report }) {
|
|
|
30708
30854
|
const { exit: exit2 } = useApp2();
|
|
30709
30855
|
const maxIdx = Math.max(0, report.pairs.length - 1);
|
|
30710
30856
|
const initialIdx = report.firstDivergenceTurn ? report.pairs.findIndex((p) => p.turn === report.firstDivergenceTurn) : 0;
|
|
30711
|
-
const [idx, setIdx] =
|
|
30857
|
+
const [idx, setIdx] = useState23(Math.max(0, initialIdx));
|
|
30712
30858
|
useInput3((input, key) => {
|
|
30713
30859
|
if (input === "q" || key.ctrl && input === "c") {
|
|
30714
30860
|
exit2();
|
|
@@ -30731,7 +30877,7 @@ function DiffApp({ report }) {
|
|
|
30731
30877
|
}
|
|
30732
30878
|
});
|
|
30733
30879
|
const pair = report.pairs[idx];
|
|
30734
|
-
return /* @__PURE__ */
|
|
30880
|
+
return /* @__PURE__ */ React68.createElement(Box53, { flexDirection: "column" }, /* @__PURE__ */ React68.createElement(DiffHeader, { report }), /* @__PURE__ */ React68.createElement(Box53, { marginTop: 1, paddingX: 1, justifyContent: "space-between" }, /* @__PURE__ */ React68.createElement(Text58, { color: "cyan", bold: true }, "turn ", pair?.turn ?? "?", " (", idx + 1, " / ", report.pairs.length, ")"), /* @__PURE__ */ React68.createElement(Text58, null, pair ? /* @__PURE__ */ React68.createElement(KindBadge, { kind: pair.kind }) : null)), /* @__PURE__ */ React68.createElement(Box53, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React68.createElement(Pane, { label: report.a.label, headerColor: "blue", records: paneRecords(pair, "a") }), /* @__PURE__ */ React68.createElement(Pane, { label: report.b.label, headerColor: "magenta", records: paneRecords(pair, "b") })), pair?.divergenceNote ? /* @__PURE__ */ React68.createElement(Box53, { marginTop: 1, paddingX: 1 }, /* @__PURE__ */ React68.createElement(Text58, { color: "yellow" }, "\u2605 "), /* @__PURE__ */ React68.createElement(Text58, null, pair.divergenceNote)) : null, /* @__PURE__ */ React68.createElement(Box53, { marginTop: 1, paddingX: 1, borderStyle: "single", borderColor: "gray" }, /* @__PURE__ */ React68.createElement(Text58, { dimColor: true }, /* @__PURE__ */ React68.createElement(Text58, { bold: true }, "j"), "/", /* @__PURE__ */ React68.createElement(Text58, { bold: true }, "\u2193"), " next \xB7 ", /* @__PURE__ */ React68.createElement(Text58, { bold: true }, "k"), "/", /* @__PURE__ */ React68.createElement(Text58, { bold: true }, "\u2191"), " ", "prev \xB7 ", /* @__PURE__ */ React68.createElement(Text58, { bold: true }, "n"), " next-diverge \xB7 ", /* @__PURE__ */ React68.createElement(Text58, { bold: true }, "N"), "/", /* @__PURE__ */ React68.createElement(Text58, { bold: true }, "p"), " ", "prev-diverge \xB7 ", /* @__PURE__ */ React68.createElement(Text58, { bold: true }, "g"), "/", /* @__PURE__ */ React68.createElement(Text58, { bold: true }, "G"), " first/last \xB7 ", /* @__PURE__ */ React68.createElement(Text58, { bold: true }, "q"), " ", "quit")));
|
|
30735
30881
|
}
|
|
30736
30882
|
function DiffHeader({ report }) {
|
|
30737
30883
|
const a = report.a;
|
|
@@ -30749,15 +30895,15 @@ function DiffHeader({ report }) {
|
|
|
30749
30895
|
} else if (a.stats.prefixHashes[0] && a.stats.prefixHashes[0] === b.stats.prefixHashes[0]) {
|
|
30750
30896
|
prefixLine = `shared prefix hash ${a.stats.prefixHashes[0].slice(0, 12)}\u2026 \u2014 cache delta attributable to log stability, not prompt change.`;
|
|
30751
30897
|
}
|
|
30752
|
-
return /* @__PURE__ */
|
|
30898
|
+
return /* @__PURE__ */ React68.createElement(Box53, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1 }, /* @__PURE__ */ React68.createElement(Box53, { justifyContent: "space-between" }, /* @__PURE__ */ React68.createElement(Text58, null, /* @__PURE__ */ React68.createElement(Text58, { color: "cyan", bold: true }, "reasonix diff"), /* @__PURE__ */ React68.createElement(Text58, { dimColor: true }, " \xB7 A="), /* @__PURE__ */ React68.createElement(Text58, { color: "blue" }, a.label), /* @__PURE__ */ React68.createElement(Text58, { dimColor: true }, " vs B="), /* @__PURE__ */ React68.createElement(Text58, { color: "magenta" }, b.label)), /* @__PURE__ */ React68.createElement(Text58, { dimColor: true }, report.pairs.length, " turns aligned")), /* @__PURE__ */ React68.createElement(Box53, { marginTop: 1, gap: 3 }, /* @__PURE__ */ React68.createElement(Text58, null, /* @__PURE__ */ React68.createElement(Text58, { dimColor: true }, "cache "), /* @__PURE__ */ React68.createElement(Text58, null, (a.stats.cacheHitRatio * 100).toFixed(1), "%"), /* @__PURE__ */ React68.createElement(Text58, { dimColor: true }, " \u2192 "), /* @__PURE__ */ React68.createElement(Text58, null, (b.stats.cacheHitRatio * 100).toFixed(1), "%"), /* @__PURE__ */ React68.createElement(Text58, { color: cacheDelta >= 0 ? "green" : "red", bold: true }, " ", cacheDelta >= 0 ? "+" : "", (cacheDelta * 100).toFixed(1), "pp")), /* @__PURE__ */ React68.createElement(Text58, null, /* @__PURE__ */ React68.createElement(Text58, { dimColor: true }, "cost "), /* @__PURE__ */ React68.createElement(Text58, null, "$", a.stats.totalCostUsd.toFixed(6)), /* @__PURE__ */ React68.createElement(Text58, { dimColor: true }, " \u2192 "), /* @__PURE__ */ React68.createElement(Text58, null, "$", b.stats.totalCostUsd.toFixed(6)), /* @__PURE__ */ React68.createElement(Text58, { color: costDelta2 <= 0 ? "green" : "red", bold: true }, " ", costDelta2 >= 0 ? "+" : "", costDelta2.toFixed(1), "%")), /* @__PURE__ */ React68.createElement(Text58, null, /* @__PURE__ */ React68.createElement(Text58, { dimColor: true }, "model calls "), /* @__PURE__ */ React68.createElement(Text58, null, a.stats.turns, " \u2192 ", b.stats.turns))), prefixLine ? /* @__PURE__ */ React68.createElement(Box53, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text58, { dimColor: true, italic: true }, prefixLine)) : null);
|
|
30753
30899
|
}
|
|
30754
30900
|
function Pane({
|
|
30755
30901
|
label,
|
|
30756
30902
|
headerColor,
|
|
30757
30903
|
records
|
|
30758
30904
|
}) {
|
|
30759
|
-
return /* @__PURE__ */
|
|
30760
|
-
|
|
30905
|
+
return /* @__PURE__ */ React68.createElement(
|
|
30906
|
+
Box53,
|
|
30761
30907
|
{
|
|
30762
30908
|
flexDirection: "column",
|
|
30763
30909
|
flexGrow: 1,
|
|
@@ -30765,21 +30911,21 @@ function Pane({
|
|
|
30765
30911
|
borderStyle: "single",
|
|
30766
30912
|
borderColor: headerColor
|
|
30767
30913
|
},
|
|
30768
|
-
/* @__PURE__ */
|
|
30769
|
-
records.length === 0 ? /* @__PURE__ */
|
|
30914
|
+
/* @__PURE__ */ React68.createElement(Text58, { color: headerColor, bold: true }, label),
|
|
30915
|
+
records.length === 0 ? /* @__PURE__ */ React68.createElement(Box53, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text58, { dimColor: true, italic: true }, "(no records on this side for this turn)")) : /* @__PURE__ */ React68.createElement(Static, { items: records.map((rec, i) => ({ key: `${label}-${i}`, rec })) }, ({ key, rec }) => /* @__PURE__ */ React68.createElement(RecordView, { key, rec, compact: true }))
|
|
30770
30916
|
);
|
|
30771
30917
|
}
|
|
30772
30918
|
function KindBadge({ kind }) {
|
|
30773
30919
|
if (kind === "match") {
|
|
30774
|
-
return /* @__PURE__ */
|
|
30920
|
+
return /* @__PURE__ */ React68.createElement(Text58, { color: "green" }, "\u2713 match");
|
|
30775
30921
|
}
|
|
30776
30922
|
if (kind === "diverge") {
|
|
30777
|
-
return /* @__PURE__ */
|
|
30923
|
+
return /* @__PURE__ */ React68.createElement(Text58, { color: "yellow" }, "\u2605 diverge");
|
|
30778
30924
|
}
|
|
30779
30925
|
if (kind === "only_in_a") {
|
|
30780
|
-
return /* @__PURE__ */
|
|
30926
|
+
return /* @__PURE__ */ React68.createElement(Text58, { color: "blue" }, "\u2190 only in A");
|
|
30781
30927
|
}
|
|
30782
|
-
return /* @__PURE__ */
|
|
30928
|
+
return /* @__PURE__ */ React68.createElement(Text58, { color: "magenta" }, "\u2192 only in B");
|
|
30783
30929
|
}
|
|
30784
30930
|
function paneRecords(pair, side) {
|
|
30785
30931
|
if (!pair) return [];
|
|
@@ -30810,7 +30956,7 @@ markdown report written to ${opts.mdPath}`);
|
|
|
30810
30956
|
return;
|
|
30811
30957
|
}
|
|
30812
30958
|
if (wantTui) {
|
|
30813
|
-
const { waitUntilExit } = render2(
|
|
30959
|
+
const { waitUntilExit } = render2(React69.createElement(DiffApp, { report }), {
|
|
30814
30960
|
exitOnCtrlC: true,
|
|
30815
30961
|
patchConsole: false
|
|
30816
30962
|
});
|
|
@@ -31359,8 +31505,8 @@ function makeTtyWriter() {
|
|
|
31359
31505
|
}
|
|
31360
31506
|
|
|
31361
31507
|
// src/cli/commands/mcp-browse.tsx
|
|
31362
|
-
import { Box as
|
|
31363
|
-
import
|
|
31508
|
+
import { Box as Box54, Text as Text59, render as render3, useApp as useApp3, useInput as useInput4 } from "ink";
|
|
31509
|
+
import React70, { useCallback as useCallback12, useEffect as useEffect13, useMemo as useMemo8, useState as useState24 } from "react";
|
|
31364
31510
|
var VISIBLE_ROWS2 = 12;
|
|
31365
31511
|
function rankAndFilter2(entries, query) {
|
|
31366
31512
|
const q = query.trim().toLowerCase();
|
|
@@ -31374,7 +31520,7 @@ function rankAndFilter2(entries, query) {
|
|
|
31374
31520
|
}
|
|
31375
31521
|
function McpBrowseApp() {
|
|
31376
31522
|
const app = useApp3();
|
|
31377
|
-
const [state, setState] =
|
|
31523
|
+
const [state, setState] = useState24({
|
|
31378
31524
|
handle: null,
|
|
31379
31525
|
loading: true,
|
|
31380
31526
|
query: "",
|
|
@@ -31486,17 +31632,17 @@ function McpBrowseApp() {
|
|
|
31486
31632
|
Math.min(state.selected - Math.floor(VISIBLE_ROWS2 / 2), filtered.length - VISIBLE_ROWS2)
|
|
31487
31633
|
);
|
|
31488
31634
|
const window = filtered.slice(Math.max(0, start), Math.max(0, start) + VISIBLE_ROWS2);
|
|
31489
|
-
return /* @__PURE__ */
|
|
31635
|
+
return /* @__PURE__ */ React70.createElement(Box54, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React70.createElement(Box54, null, /* @__PURE__ */ React70.createElement(Text59, { bold: true, color: "cyan" }, "\u25C8 MCP marketplace"), /* @__PURE__ */ React70.createElement(Text59, { dimColor: true }, ` \xB7 ${state.status}`)), /* @__PURE__ */ React70.createElement(Box54, { marginTop: 1 }, /* @__PURE__ */ React70.createElement(Text59, null, "search: "), /* @__PURE__ */ React70.createElement(Text59, { color: "white" }, state.query || "(type to filter)"), /* @__PURE__ */ React70.createElement(Text59, { dimColor: true }, ` ${filtered.length} match${filtered.length === 1 ? "" : "es"}`)), /* @__PURE__ */ React70.createElement(Box54, { marginTop: 1, flexDirection: "column" }, window.length === 0 ? /* @__PURE__ */ React70.createElement(Text59, { dimColor: true }, state.loading ? "loading\u2026" : "no entries") : window.map((e, i) => {
|
|
31490
31636
|
const idx = (start || 0) + i;
|
|
31491
31637
|
const active = idx === state.selected;
|
|
31492
31638
|
const tag2 = e.source === "official" ? "[off]" : e.source === "smithery" ? "[smt]" : "[loc]";
|
|
31493
31639
|
const pop = e.popularity !== void 0 ? ` \xB7 ${e.popularity.toLocaleString()}` : "";
|
|
31494
|
-
return /* @__PURE__ */
|
|
31495
|
-
})), selected ? /* @__PURE__ */
|
|
31640
|
+
return /* @__PURE__ */ React70.createElement(Box54, { key: e.name }, /* @__PURE__ */ React70.createElement(Text59, { color: active ? "cyan" : void 0 }, active ? "\u25B8 " : " "), /* @__PURE__ */ React70.createElement(Text59, { bold: active }, e.name.padEnd(40).slice(0, 40)), /* @__PURE__ */ React70.createElement(Text59, { dimColor: true }, ` ${tag2}${pop}`));
|
|
31641
|
+
})), selected ? /* @__PURE__ */ React70.createElement(Box54, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React70.createElement(Text59, { bold: true, color: "white" }, selected.title), selected.description ? /* @__PURE__ */ React70.createElement(Text59, { dimColor: true }, selected.description.slice(0, 160)) : null, selected.install ? /* @__PURE__ */ React70.createElement(Text59, { dimColor: true }, `spec: ${selected.install.runtime} ${selected.install.packageId ?? selected.install.url ?? "\u2014"} \xB7 ${selected.install.transport}`) : /* @__PURE__ */ React70.createElement(Text59, { dimColor: true }, "(smithery listing \u2014 install info not exposed)"), selected.install?.requiredEnv?.length ? /* @__PURE__ */ React70.createElement(Text59, { color: "yellow" }, `needs: ${selected.install.requiredEnv.join(", ")}`) : null) : null, /* @__PURE__ */ React70.createElement(Box54, { marginTop: 1 }, /* @__PURE__ */ React70.createElement(Text59, { dimColor: true }, "type to filter \xB7 \u2191\u2193 pick \xB7 enter install \xB7 tab load more \xB7 esc quit")));
|
|
31496
31642
|
}
|
|
31497
31643
|
async function mcpBrowseCommand(_opts = {}) {
|
|
31498
31644
|
loadDotenv();
|
|
31499
|
-
const { waitUntilExit } = render3(/* @__PURE__ */
|
|
31645
|
+
const { waitUntilExit } = render3(/* @__PURE__ */ React70.createElement(McpBrowseApp, null), {
|
|
31500
31646
|
exitOnCtrlC: true,
|
|
31501
31647
|
patchConsole: false
|
|
31502
31648
|
});
|
|
@@ -31867,16 +32013,16 @@ function pruneSessionsCommand(opts) {
|
|
|
31867
32013
|
|
|
31868
32014
|
// src/cli/commands/replay.ts
|
|
31869
32015
|
import { render as render4 } from "ink";
|
|
31870
|
-
import
|
|
32016
|
+
import React73 from "react";
|
|
31871
32017
|
|
|
31872
32018
|
// src/cli/ui/ReplayApp.tsx
|
|
31873
|
-
import { Box as
|
|
31874
|
-
import
|
|
32019
|
+
import { Box as Box56, Static as Static2, Text as Text61, useApp as useApp4, useInput as useInput5 } from "ink";
|
|
32020
|
+
import React72, { useMemo as useMemo9, useState as useState25 } from "react";
|
|
31875
32021
|
|
|
31876
32022
|
// src/cli/ui/StatsPanel.tsx
|
|
31877
32023
|
import { basename as basename4 } from "path";
|
|
31878
|
-
import { Box as
|
|
31879
|
-
import
|
|
32024
|
+
import { Box as Box55, Text as Text60, useStdout as useStdout16 } from "ink";
|
|
32025
|
+
import React71 from "react";
|
|
31880
32026
|
import stringWidth2 from "string-width";
|
|
31881
32027
|
var COLD_START_TURNS = 3;
|
|
31882
32028
|
function StatsPanel({
|
|
@@ -31892,7 +32038,7 @@ function StatsPanel({
|
|
|
31892
32038
|
sessionName
|
|
31893
32039
|
}) {
|
|
31894
32040
|
const coldStart = summary.turns <= COLD_START_TURNS;
|
|
31895
|
-
return /* @__PURE__ */
|
|
32041
|
+
return /* @__PURE__ */ React71.createElement(Box55, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React71.createElement(
|
|
31896
32042
|
ChromeRow,
|
|
31897
32043
|
{
|
|
31898
32044
|
editMode,
|
|
@@ -31906,7 +32052,7 @@ function StatsPanel({
|
|
|
31906
32052
|
updateAvailable,
|
|
31907
32053
|
balance: balance ?? null
|
|
31908
32054
|
}
|
|
31909
|
-
), /* @__PURE__ */
|
|
32055
|
+
), /* @__PURE__ */ React71.createElement(ChromeRule, null), budgetUsd !== null && budgetUsd !== void 0 ? /* @__PURE__ */ React71.createElement(BudgetRow, { spent: summary.totalCostUsd, cap: budgetUsd }) : null);
|
|
31910
32056
|
}
|
|
31911
32057
|
function ChromeRow({
|
|
31912
32058
|
editMode,
|
|
@@ -31929,7 +32075,7 @@ function ChromeRow({
|
|
|
31929
32075
|
const costLabel = `[${formatCost(summary.totalCostUsd, balance?.currency)}]`;
|
|
31930
32076
|
const cacheLabel = "[c \u25B0\u25B0\u25B0\u25B0\u25B0\u25B0 100%]";
|
|
31931
32077
|
const updateLabel = updateAvailable ? `\u2191 ${updateAvailable}` : "";
|
|
31932
|
-
const { stdout: stdout4 } =
|
|
32078
|
+
const { stdout: stdout4 } = useStdout16();
|
|
31933
32079
|
const cols = (stdout4?.columns ?? 80) - 2;
|
|
31934
32080
|
const SEP_DOT = stringWidth2(" \xB7 ");
|
|
31935
32081
|
const SEP_ARROW = stringWidth2(" \u203A ");
|
|
@@ -31951,15 +32097,15 @@ function ChromeRow({
|
|
|
31951
32097
|
if (showSession) budget3 -= sessionW;
|
|
31952
32098
|
const showUpdate = updateW > 0 && budget3 >= updateW;
|
|
31953
32099
|
if (showUpdate) budget3 -= updateW;
|
|
31954
|
-
return /* @__PURE__ */
|
|
31955
|
-
|
|
32100
|
+
return /* @__PURE__ */ React71.createElement(Box55, null, /* @__PURE__ */ React71.createElement(Text60, { bold: true, color: GRADIENT[0] }, "\u25C8 "), /* @__PURE__ */ React71.createElement(Text60, { color: COLOR.brand, bold: true }, "reasonix"), projectName ? /* @__PURE__ */ React71.createElement(React71.Fragment, null, /* @__PURE__ */ React71.createElement(Text60, { color: COLOR.info, dimColor: true }, " \xB7 "), /* @__PURE__ */ React71.createElement(Text60, null, projectName), showSession && sessionName ? /* @__PURE__ */ React71.createElement(React71.Fragment, null, /* @__PURE__ */ React71.createElement(Text60, { color: COLOR.info, dimColor: true }, " \u203A "), /* @__PURE__ */ React71.createElement(Text60, { color: COLOR.info }, sessionName)) : null) : null, /* @__PURE__ */ React71.createElement(Box55, { flexGrow: 1 }), showUpdate ? /* @__PURE__ */ React71.createElement(React71.Fragment, null, /* @__PURE__ */ React71.createElement(Text60, { color: COLOR.warn, bold: true }, updateLabel), /* @__PURE__ */ React71.createElement(Text60, null, " ")) : null, modePill ? /* @__PURE__ */ React71.createElement(React71.Fragment, null, /* @__PURE__ */ React71.createElement(Text60, { color: modePill.color, bold: true }, `[${modePill.label}]`), /* @__PURE__ */ React71.createElement(Text60, null, " ")) : null, proPill ? /* @__PURE__ */ React71.createElement(React71.Fragment, null, /* @__PURE__ */ React71.createElement(Text60, { color: proPill.color, bold: true }, `[${proPill.label}]`), /* @__PURE__ */ React71.createElement(Text60, null, " ")) : null, /* @__PURE__ */ React71.createElement(
|
|
32101
|
+
Text60,
|
|
31956
32102
|
{
|
|
31957
32103
|
color: summary.turns === 0 || coldStart ? COLOR.info : sessionCostColor(summary.totalCostUsd),
|
|
31958
32104
|
bold: summary.turns > 0 && !coldStart,
|
|
31959
32105
|
dimColor: summary.turns === 0 || coldStart
|
|
31960
32106
|
},
|
|
31961
32107
|
costLabel
|
|
31962
|
-
), showBalance && balance ? /* @__PURE__ */
|
|
32108
|
+
), showBalance && balance ? /* @__PURE__ */ React71.createElement(React71.Fragment, null, /* @__PURE__ */ React71.createElement(Text60, null, " "), /* @__PURE__ */ React71.createElement(Text60, { color: balance.total < 1 ? COLOR.err : balance.total < 5 ? COLOR.warn : COLOR.ok }, balanceLabel)) : null, showCache ? /* @__PURE__ */ React71.createElement(React71.Fragment, null, /* @__PURE__ */ React71.createElement(Text60, null, " "), /* @__PURE__ */ React71.createElement(Text60, { dimColor: true }, "["), /* @__PURE__ */ React71.createElement(Text60, { dimColor: true }, "c "), /* @__PURE__ */ React71.createElement(
|
|
31963
32109
|
Bar,
|
|
31964
32110
|
{
|
|
31965
32111
|
ratio: summary.cacheHitRatio,
|
|
@@ -31967,7 +32113,7 @@ function ChromeRow({
|
|
|
31967
32113
|
cells: 6,
|
|
31968
32114
|
dim: coldStart
|
|
31969
32115
|
}
|
|
31970
|
-
), /* @__PURE__ */
|
|
32116
|
+
), /* @__PURE__ */ React71.createElement(Text60, null, " "), /* @__PURE__ */ React71.createElement(Text60, { color: coldStart ? void 0 : cacheColor, dimColor: coldStart }, coldStart && summary.turns === 0 ? "\u2014" : `${cachePct}%`), /* @__PURE__ */ React71.createElement(Text60, { dimColor: true }, "]")) : null);
|
|
31971
32117
|
}
|
|
31972
32118
|
function pickModePill(planMode, editMode) {
|
|
31973
32119
|
if (planMode) return { label: "PLAN", color: COLOR.err };
|
|
@@ -31979,7 +32125,7 @@ function pickModePill(planMode, editMode) {
|
|
|
31979
32125
|
function BudgetRow({ spent, cap }) {
|
|
31980
32126
|
const pct2 = Math.max(0, spent / cap * 100);
|
|
31981
32127
|
const color2 = pct2 >= 100 ? "#f87171" : pct2 >= 80 ? "#fbbf24" : "#94a3b8";
|
|
31982
|
-
return /* @__PURE__ */
|
|
32128
|
+
return /* @__PURE__ */ React71.createElement(Box55, null, /* @__PURE__ */ React71.createElement(Text60, { dimColor: true }, " budget "), /* @__PURE__ */ React71.createElement(Text60, { color: color2 }, `$${spent.toFixed(4)} / $${cap.toFixed(2)}`, /* @__PURE__ */ React71.createElement(Text60, { dimColor: true }, ` (${pct2.toFixed(0)}%)`)));
|
|
31983
32129
|
}
|
|
31984
32130
|
function sessionCostColor(cost2) {
|
|
31985
32131
|
if (cost2 <= 0) return void 0;
|
|
@@ -31992,7 +32138,7 @@ function sessionCostColor(cost2) {
|
|
|
31992
32138
|
function ReplayApp({ meta, pages }) {
|
|
31993
32139
|
const { exit: exit2 } = useApp4();
|
|
31994
32140
|
const maxIdx = Math.max(0, pages.length - 1);
|
|
31995
|
-
const [idx, setIdx] =
|
|
32141
|
+
const [idx, setIdx] = useState25(maxIdx);
|
|
31996
32142
|
useInput5((input, key) => {
|
|
31997
32143
|
if (input === "q" || key.ctrl && input === "c") {
|
|
31998
32144
|
exit2();
|
|
@@ -32028,7 +32174,7 @@ function ReplayApp({ meta, pages }) {
|
|
|
32028
32174
|
const prefixHash = cumStats.prefixHashes.length === 1 ? cumStats.prefixHashes[0].slice(0, 16) : cumStats.prefixHashes.length === 0 ? "(untracked)" : `(churned \xD7${cumStats.prefixHashes.length})`;
|
|
32029
32175
|
const currentPage = pages[idx];
|
|
32030
32176
|
const progressLabel = pages.length === 0 ? "empty transcript" : `turn ${idx + 1} / ${pages.length}`;
|
|
32031
|
-
return /* @__PURE__ */
|
|
32177
|
+
return /* @__PURE__ */ React72.createElement(Box56, { flexDirection: "column" }, /* @__PURE__ */ React72.createElement(StatsPanel, { summary }), /* @__PURE__ */ React72.createElement(Box56, { flexDirection: "column", marginTop: 1, paddingX: 1 }, /* @__PURE__ */ React72.createElement(Box56, { justifyContent: "space-between" }, /* @__PURE__ */ React72.createElement(Text61, { color: "cyan", bold: true }, progressLabel), meta ? /* @__PURE__ */ React72.createElement(Text61, { dimColor: true }, meta.source, meta.task ? ` \xB7 ${meta.task}` : "", meta.mode ? ` \xB7 ${meta.mode}` : "") : null), currentPage ? /* @__PURE__ */ React72.createElement(Static2, { items: currentPage.records.map((rec, i) => ({ key: `${idx}-${i}`, rec })) }, ({ key, rec }) => /* @__PURE__ */ React72.createElement(RecordView, { key, rec })) : /* @__PURE__ */ React72.createElement(Text61, { dimColor: true, italic: true }, "no records")), /* @__PURE__ */ React72.createElement(Box56, { marginTop: 1, paddingX: 1, borderStyle: "single", borderColor: "gray" }, /* @__PURE__ */ React72.createElement(Text61, { dimColor: true }, /* @__PURE__ */ React72.createElement(Text61, { bold: true }, "j"), "/", /* @__PURE__ */ React72.createElement(Text61, { bold: true }, "\u2193"), "/", /* @__PURE__ */ React72.createElement(Text61, { bold: true }, "space"), " next \xB7 ", /* @__PURE__ */ React72.createElement(Text61, { bold: true }, "k"), "/", /* @__PURE__ */ React72.createElement(Text61, { bold: true }, "\u2191"), " prev \xB7 ", /* @__PURE__ */ React72.createElement(Text61, { bold: true }, "g"), " first \xB7 ", /* @__PURE__ */ React72.createElement(Text61, { bold: true }, "G"), " last \xB7", " ", /* @__PURE__ */ React72.createElement(Text61, { bold: true }, "q"), " quit")));
|
|
32032
32178
|
}
|
|
32033
32179
|
|
|
32034
32180
|
// src/cli/commands/replay.ts
|
|
@@ -32040,7 +32186,7 @@ async function replayCommand(opts) {
|
|
|
32040
32186
|
}
|
|
32041
32187
|
const { parsed } = replayFromFile(opts.path);
|
|
32042
32188
|
const pages = groupRecordsByTurn(parsed.records);
|
|
32043
|
-
const { waitUntilExit } = render4(
|
|
32189
|
+
const { waitUntilExit } = render4(React73.createElement(ReplayApp, { meta: parsed.meta, pages }), {
|
|
32044
32190
|
exitOnCtrlC: true,
|
|
32045
32191
|
patchConsole: false
|
|
32046
32192
|
});
|
|
@@ -32372,29 +32518,29 @@ function truncate6(s, max) {
|
|
|
32372
32518
|
|
|
32373
32519
|
// src/cli/commands/setup.tsx
|
|
32374
32520
|
import { render as render5 } from "ink";
|
|
32375
|
-
import
|
|
32521
|
+
import React75 from "react";
|
|
32376
32522
|
|
|
32377
32523
|
// src/cli/ui/Wizard.tsx
|
|
32378
32524
|
import { mkdirSync as mkdirSync15, statSync as statSync12 } from "fs";
|
|
32379
|
-
import { Box as
|
|
32525
|
+
import { Box as Box57, Text as Text62, useApp as useApp5, useInput as useInput6 } from "ink";
|
|
32380
32526
|
import TextInput from "ink-text-input";
|
|
32381
|
-
import
|
|
32527
|
+
import React74, { useState as useState26 } from "react";
|
|
32382
32528
|
var CATALOG_BY_NAME = new Map(MCP_CATALOG.map((e) => [e.name, e]));
|
|
32383
32529
|
function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
32384
32530
|
const { exit: exit2 } = useApp5();
|
|
32385
|
-
const [step, setStep] =
|
|
32386
|
-
const [data, setData] =
|
|
32531
|
+
const [step, setStep] = useState26(existingApiKey ? "preset" : "apiKey");
|
|
32532
|
+
const [data, setData] = useState26({
|
|
32387
32533
|
apiKey: existingApiKey ?? "",
|
|
32388
32534
|
preset: initial?.preset ?? "auto",
|
|
32389
32535
|
selectedCatalog: deriveInitialCatalog(initial?.mcp ?? []),
|
|
32390
32536
|
catalogArgs: {}
|
|
32391
32537
|
});
|
|
32392
|
-
const [error, setError] =
|
|
32538
|
+
const [error, setError] = useState26(null);
|
|
32393
32539
|
useInput6((_input, key) => {
|
|
32394
32540
|
if (key.escape && step !== "saved" && onCancel) onCancel();
|
|
32395
32541
|
});
|
|
32396
32542
|
if (step === "apiKey") {
|
|
32397
|
-
return /* @__PURE__ */
|
|
32543
|
+
return /* @__PURE__ */ React74.createElement(
|
|
32398
32544
|
ApiKeyStep,
|
|
32399
32545
|
{
|
|
32400
32546
|
onSubmit: (key) => {
|
|
@@ -32408,7 +32554,7 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
32408
32554
|
);
|
|
32409
32555
|
}
|
|
32410
32556
|
if (step === "preset") {
|
|
32411
|
-
return /* @__PURE__ */
|
|
32557
|
+
return /* @__PURE__ */ React74.createElement(StepFrame, { title: "Pick a preset", step: 1, total: 3 }, /* @__PURE__ */ React74.createElement(
|
|
32412
32558
|
SingleSelect,
|
|
32413
32559
|
{
|
|
32414
32560
|
items: presetItems(),
|
|
@@ -32418,10 +32564,10 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
32418
32564
|
setStep("mcp");
|
|
32419
32565
|
}
|
|
32420
32566
|
}
|
|
32421
|
-
), /* @__PURE__ */
|
|
32567
|
+
), /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { dimColor: true }, "[\u2191\u2193] navigate \xB7 [Enter] confirm \xB7 [Esc] cancel")));
|
|
32422
32568
|
}
|
|
32423
32569
|
if (step === "mcp") {
|
|
32424
|
-
return /* @__PURE__ */
|
|
32570
|
+
return /* @__PURE__ */ React74.createElement(StepFrame, { title: "Which MCP servers should Reasonix wire up for you?", step: 2, total: 3 }, /* @__PURE__ */ React74.createElement(
|
|
32425
32571
|
MultiSelect,
|
|
32426
32572
|
{
|
|
32427
32573
|
items: mcpItems(),
|
|
@@ -32446,7 +32592,7 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
32446
32592
|
}
|
|
32447
32593
|
const currentName = pending[0];
|
|
32448
32594
|
const entry = CATALOG_BY_NAME.get(currentName);
|
|
32449
|
-
return /* @__PURE__ */
|
|
32595
|
+
return /* @__PURE__ */ React74.createElement(
|
|
32450
32596
|
McpArgsStep,
|
|
32451
32597
|
{
|
|
32452
32598
|
entry,
|
|
@@ -32464,7 +32610,7 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
32464
32610
|
}
|
|
32465
32611
|
if (step === "review") {
|
|
32466
32612
|
const specs = data.selectedCatalog.map((name) => buildSpec(name, data.catalogArgs));
|
|
32467
|
-
return /* @__PURE__ */
|
|
32613
|
+
return /* @__PURE__ */ React74.createElement(StepFrame, { title: "Ready to save", step: 3, total: 3 }, /* @__PURE__ */ React74.createElement(Box57, { flexDirection: "column" }, /* @__PURE__ */ React74.createElement(SummaryLine, { label: "API key", value: redactKey(data.apiKey) }), /* @__PURE__ */ React74.createElement(SummaryLine, { label: "Preset", value: data.preset }), /* @__PURE__ */ React74.createElement(
|
|
32468
32614
|
SummaryLine,
|
|
32469
32615
|
{
|
|
32470
32616
|
label: "MCP",
|
|
@@ -32472,8 +32618,8 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
32472
32618
|
}
|
|
32473
32619
|
), specs.map((spec, i) => (
|
|
32474
32620
|
// biome-ignore lint/suspicious/noArrayIndexKey: review-only render, order fixed
|
|
32475
|
-
/* @__PURE__ */
|
|
32476
|
-
)), /* @__PURE__ */
|
|
32621
|
+
/* @__PURE__ */ React74.createElement(Box57, { key: i, paddingLeft: 14 }, /* @__PURE__ */ React74.createElement(Text62, { dimColor: true }, "\xB7 ", spec))
|
|
32622
|
+
)), /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, null, "Saves to ", defaultConfigPath())), error ? /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { color: "red" }, error)) : null, /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { dimColor: true }, "[Enter] save \xB7 [Esc] cancel"))), /* @__PURE__ */ React74.createElement(
|
|
32477
32623
|
ReviewConfirm,
|
|
32478
32624
|
{
|
|
32479
32625
|
onConfirm: () => {
|
|
@@ -32499,15 +32645,15 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
32499
32645
|
}
|
|
32500
32646
|
));
|
|
32501
32647
|
}
|
|
32502
|
-
return /* @__PURE__ */
|
|
32648
|
+
return /* @__PURE__ */ React74.createElement(Box57, { flexDirection: "column", borderStyle: "round", borderColor: "green", paddingX: 1 }, /* @__PURE__ */ React74.createElement(Text62, { bold: true, color: "green" }, "\u25B8 Saved."), /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, null, "Run `reasonix` any time to start chatting \u2014 your settings are remembered.")), /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { dimColor: true }, "[Enter] to exit")), /* @__PURE__ */ React74.createElement(ExitOnEnter, { onExit: exit2 }));
|
|
32503
32649
|
}
|
|
32504
32650
|
function ApiKeyStep({
|
|
32505
32651
|
onSubmit,
|
|
32506
32652
|
error,
|
|
32507
32653
|
onError
|
|
32508
32654
|
}) {
|
|
32509
|
-
const [value, setValue] =
|
|
32510
|
-
return /* @__PURE__ */
|
|
32655
|
+
const [value, setValue] = useState26("");
|
|
32656
|
+
return /* @__PURE__ */ React74.createElement(Box57, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1 }, /* @__PURE__ */ React74.createElement(Text62, { bold: true, color: "cyan" }, "Welcome to Reasonix."), /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, null, "Paste your DeepSeek API key to get started.")), /* @__PURE__ */ React74.createElement(Text62, { dimColor: true }, "Get one at: https://platform.deepseek.com/api_keys"), /* @__PURE__ */ React74.createElement(Text62, { dimColor: true }, "Saved locally to ", defaultConfigPath()), /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { bold: true, color: "cyan" }, "key \u203A "), /* @__PURE__ */ React74.createElement(
|
|
32511
32657
|
TextInput,
|
|
32512
32658
|
{
|
|
32513
32659
|
value,
|
|
@@ -32524,7 +32670,7 @@ function ApiKeyStep({
|
|
|
32524
32670
|
mask: "\u2022",
|
|
32525
32671
|
placeholder: "sk-..."
|
|
32526
32672
|
}
|
|
32527
|
-
)), error ? /* @__PURE__ */
|
|
32673
|
+
)), error ? /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { color: "red" }, error)) : value ? /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { dimColor: true }, "preview: ", redactKey(value))) : null);
|
|
32528
32674
|
}
|
|
32529
32675
|
function McpArgsStep({
|
|
32530
32676
|
entry,
|
|
@@ -32532,8 +32678,8 @@ function McpArgsStep({
|
|
|
32532
32678
|
onSubmit,
|
|
32533
32679
|
onError
|
|
32534
32680
|
}) {
|
|
32535
|
-
const [value, setValue] =
|
|
32536
|
-
const [pendingCreate, setPendingCreate] =
|
|
32681
|
+
const [value, setValue] = useState26("");
|
|
32682
|
+
const [pendingCreate, setPendingCreate] = useState26(null);
|
|
32537
32683
|
useInput6((input, key) => {
|
|
32538
32684
|
if (!pendingCreate) return;
|
|
32539
32685
|
const ch = input.toLowerCase();
|
|
@@ -32555,9 +32701,9 @@ function McpArgsStep({
|
|
|
32555
32701
|
}
|
|
32556
32702
|
});
|
|
32557
32703
|
if (pendingCreate) {
|
|
32558
|
-
return /* @__PURE__ */
|
|
32704
|
+
return /* @__PURE__ */ React74.createElement(StepFrame, { title: `Configure ${entry.name}`, step: 2, total: 3 }, /* @__PURE__ */ React74.createElement(Box57, { flexDirection: "column" }, /* @__PURE__ */ React74.createElement(Text62, null, "Directory ", /* @__PURE__ */ React74.createElement(Text62, { bold: true }, pendingCreate), " doesn't exist."), /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { dimColor: true }, "[Y/Enter] create it (mkdir -p) \xB7 [N/Esc] enter a different path")), error ? /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { color: "red" }, error)) : null));
|
|
32559
32705
|
}
|
|
32560
|
-
return /* @__PURE__ */
|
|
32706
|
+
return /* @__PURE__ */ React74.createElement(StepFrame, { title: `Configure ${entry.name}`, step: 2, total: 3 }, /* @__PURE__ */ React74.createElement(Box57, { flexDirection: "column" }, /* @__PURE__ */ React74.createElement(Text62, null, entry.summary), entry.note ? /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { dimColor: true }, entry.note)) : null, /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, null, "Required parameter: "), /* @__PURE__ */ React74.createElement(Text62, { bold: true }, entry.userArgs)), /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { bold: true, color: "cyan" }, entry.userArgs, " \u203A "), /* @__PURE__ */ React74.createElement(
|
|
32561
32707
|
TextInput,
|
|
32562
32708
|
{
|
|
32563
32709
|
value,
|
|
@@ -32584,7 +32730,7 @@ function McpArgsStep({
|
|
|
32584
32730
|
},
|
|
32585
32731
|
placeholder: placeholderFor(entry)
|
|
32586
32732
|
}
|
|
32587
|
-
)), error ? /* @__PURE__ */
|
|
32733
|
+
)), error ? /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1 }, /* @__PURE__ */ React74.createElement(Text62, { color: "red" }, error)) : null));
|
|
32588
32734
|
}
|
|
32589
32735
|
function checkFilesystemPath(p) {
|
|
32590
32736
|
try {
|
|
@@ -32611,10 +32757,10 @@ function StepFrame({
|
|
|
32611
32757
|
total,
|
|
32612
32758
|
children
|
|
32613
32759
|
}) {
|
|
32614
|
-
return /* @__PURE__ */
|
|
32760
|
+
return /* @__PURE__ */ React74.createElement(Box57, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1 }, /* @__PURE__ */ React74.createElement(Box57, null, /* @__PURE__ */ React74.createElement(Text62, { dimColor: true }, "Step ", step, "/", total, " \xB7", " "), /* @__PURE__ */ React74.createElement(Text62, { bold: true, color: "cyan" }, title)), /* @__PURE__ */ React74.createElement(Box57, { marginTop: 1, flexDirection: "column" }, children));
|
|
32615
32761
|
}
|
|
32616
32762
|
function SummaryLine({ label, value }) {
|
|
32617
|
-
return /* @__PURE__ */
|
|
32763
|
+
return /* @__PURE__ */ React74.createElement(Box57, null, /* @__PURE__ */ React74.createElement(Text62, null, label.padEnd(12)), /* @__PURE__ */ React74.createElement(Text62, { bold: true }, value));
|
|
32618
32764
|
}
|
|
32619
32765
|
function presetItems() {
|
|
32620
32766
|
return ["auto", "flash", "pro"].map((name) => ({
|
|
@@ -32670,7 +32816,7 @@ async function setupCommand(_opts = {}) {
|
|
|
32670
32816
|
const existingKey = loadApiKey();
|
|
32671
32817
|
const existing = readConfig();
|
|
32672
32818
|
const { waitUntilExit, unmount } = render5(
|
|
32673
|
-
/* @__PURE__ */
|
|
32819
|
+
/* @__PURE__ */ React75.createElement(
|
|
32674
32820
|
Wizard,
|
|
32675
32821
|
{
|
|
32676
32822
|
existingApiKey: existingKey,
|