reasonix 0.23.0 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +508 -330
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +57 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1936,7 +1936,7 @@ var StormBreaker = class {
|
|
|
1936
1936
|
if (count >= this.threshold - 1) {
|
|
1937
1937
|
return {
|
|
1938
1938
|
suppress: true,
|
|
1939
|
-
reason:
|
|
1939
|
+
reason: `${name} called with identical args ${count + 1} times \u2014 repeat-loop guard tripped`
|
|
1940
1940
|
};
|
|
1941
1941
|
}
|
|
1942
1942
|
this.recent.push({ name, args, readOnly });
|
|
@@ -2221,6 +2221,7 @@ var CacheFirstLoop = class {
|
|
|
2221
2221
|
_escalateThisTurn = false;
|
|
2222
2222
|
_turnFailureCount = 0;
|
|
2223
2223
|
_turnFailureTypes = {};
|
|
2224
|
+
_turnSelfCorrected = false;
|
|
2224
2225
|
constructor(opts) {
|
|
2225
2226
|
this.client = opts.client;
|
|
2226
2227
|
this.prefix = opts.prefix;
|
|
@@ -2265,7 +2266,12 @@ var CacheFirstLoop = class {
|
|
|
2265
2266
|
}
|
|
2266
2267
|
return def2.readOnly !== true;
|
|
2267
2268
|
};
|
|
2268
|
-
this.repair = new ToolCallRepair({
|
|
2269
|
+
this.repair = new ToolCallRepair({
|
|
2270
|
+
allowedToolNames: allowedNames,
|
|
2271
|
+
isMutating,
|
|
2272
|
+
stormThreshold: parsePositiveIntEnv(process.env.REASONIX_STORM_THRESHOLD),
|
|
2273
|
+
stormWindow: parsePositiveIntEnv(process.env.REASONIX_STORM_WINDOW)
|
|
2274
|
+
});
|
|
2269
2275
|
this.sessionName = opts.session ?? null;
|
|
2270
2276
|
if (this.sessionName) {
|
|
2271
2277
|
const prior = loadSessionMessages(this.sessionName);
|
|
@@ -2347,6 +2353,21 @@ var CacheFirstLoop = class {
|
|
|
2347
2353
|
}
|
|
2348
2354
|
}
|
|
2349
2355
|
}
|
|
2356
|
+
/** Swap the just-appended assistant entry — used by self-correction to restore the original tool_calls without dropping reasoning_content. */
|
|
2357
|
+
replaceTailAssistantMessage(message) {
|
|
2358
|
+
const entries = this.log.entries;
|
|
2359
|
+
const tail = entries[entries.length - 1];
|
|
2360
|
+
if (!tail || tail.role !== "assistant") return;
|
|
2361
|
+
const kept = entries.slice(0, -1);
|
|
2362
|
+
kept.push(message);
|
|
2363
|
+
this.log.compactInPlace(kept);
|
|
2364
|
+
if (this.sessionName) {
|
|
2365
|
+
try {
|
|
2366
|
+
rewriteSession(this.sessionName, kept);
|
|
2367
|
+
} catch {
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2350
2371
|
/** "New chat" — drops messages but keeps session + immutable prefix (cache-first invariant). */
|
|
2351
2372
|
clearLog() {
|
|
2352
2373
|
const dropped = this.log.length;
|
|
@@ -2447,7 +2468,7 @@ var CacheFirstLoop = class {
|
|
|
2447
2468
|
if (repair) {
|
|
2448
2469
|
if (repair.scavenged > 0) bump("scavenged", repair.scavenged);
|
|
2449
2470
|
if (repair.truncationsFixed > 0) bump("truncated", repair.truncationsFixed);
|
|
2450
|
-
if (repair.stormsBroken > 0) bump("
|
|
2471
|
+
if (repair.stormsBroken > 0) bump("repeat-loop", repair.stormsBroken);
|
|
2451
2472
|
}
|
|
2452
2473
|
if (bumped && !this._escalateThisTurn && this.autoEscalate && this._turnFailureCount >= FAILURE_ESCALATION_THRESHOLD) {
|
|
2453
2474
|
this._escalateThisTurn = true;
|
|
@@ -2517,6 +2538,7 @@ var CacheFirstLoop = class {
|
|
|
2517
2538
|
this.repair.resetStorm();
|
|
2518
2539
|
this._turnFailureCount = 0;
|
|
2519
2540
|
this._turnFailureTypes = {};
|
|
2541
|
+
this._turnSelfCorrected = false;
|
|
2520
2542
|
this._escalateThisTurn = false;
|
|
2521
2543
|
let armedConsumed = false;
|
|
2522
2544
|
if (this._proArmedForNextTurn) {
|
|
@@ -2868,10 +2890,35 @@ var CacheFirstLoop = class {
|
|
|
2868
2890
|
content: `\u21E7 auto-escalating to ${ESCALATION_MODEL} for the rest of this turn \u2014 flash hit ${this.formatFailureBreakdown()}. Next turn falls back to ${this.model} unless /pro is armed.`
|
|
2869
2891
|
};
|
|
2870
2892
|
}
|
|
2893
|
+
const allSuppressed = report.stormsBroken > 0 && repairedCalls.length === 0 && toolCalls.length > 0;
|
|
2894
|
+
if (allSuppressed && !this._turnSelfCorrected) {
|
|
2895
|
+
this._turnSelfCorrected = true;
|
|
2896
|
+
this.replaceTailAssistantMessage(
|
|
2897
|
+
this.assistantMessage(
|
|
2898
|
+
assistantContent,
|
|
2899
|
+
toolCalls,
|
|
2900
|
+
this.modelForCurrentCall(),
|
|
2901
|
+
reasoningContent
|
|
2902
|
+
)
|
|
2903
|
+
);
|
|
2904
|
+
for (const call of toolCalls) {
|
|
2905
|
+
this.appendAndPersist({
|
|
2906
|
+
role: "tool",
|
|
2907
|
+
tool_call_id: call.id ?? "",
|
|
2908
|
+
name: call.function?.name ?? "",
|
|
2909
|
+
content: "[repeat-loop guard] this call was suppressed because it was identical to a previous call in this turn. Earlier results for it are above \u2014 try a meaningfully different approach, or stop and answer if you have enough."
|
|
2910
|
+
});
|
|
2911
|
+
}
|
|
2912
|
+
yield {
|
|
2913
|
+
turn: this._turn,
|
|
2914
|
+
role: "warning",
|
|
2915
|
+
content: "Caught a repeated tool call \u2014 let the model see the issue and retry with a different approach."
|
|
2916
|
+
};
|
|
2917
|
+
continue;
|
|
2918
|
+
}
|
|
2871
2919
|
if (report.stormsBroken > 0) {
|
|
2872
2920
|
const noteTail = report.notes.length ? ` \u2014 ${report.notes[report.notes.length - 1]}` : "";
|
|
2873
|
-
const
|
|
2874
|
-
const phrase = allSuppressed ? `stopped the model from calling the same tool with identical args repeatedly (all ${toolCalls.length} call(s) this turn were already in the recent-repeat window). Likely a stuck retry \u2014 reword your instruction, rule out the underlying blocker, or try /retry after fixing it` : `suppressed ${report.stormsBroken} repeat tool call(s) that had fired 3+ times with identical args in a sliding window`;
|
|
2921
|
+
const phrase = allSuppressed ? "Stopped a stuck retry loop \u2014 the model kept calling the same tool with identical args after a self-correction nudge. Try /retry, rephrase, or rule out the underlying blocker." : `Suppressed ${report.stormsBroken} repeated tool call(s) \u2014 same name + args fired 3+ times.`;
|
|
2875
2922
|
yield {
|
|
2876
2923
|
turn: this._turn,
|
|
2877
2924
|
role: "warning",
|
|
@@ -2879,7 +2926,6 @@ var CacheFirstLoop = class {
|
|
|
2879
2926
|
};
|
|
2880
2927
|
}
|
|
2881
2928
|
if (repairedCalls.length === 0) {
|
|
2882
|
-
const allSuppressed = report.stormsBroken > 0 && toolCalls.length > 0;
|
|
2883
2929
|
if (allSuppressed) {
|
|
2884
2930
|
yield* this.forceSummaryAfterIterLimit({ reason: "stuck" });
|
|
2885
2931
|
return;
|
|
@@ -3104,6 +3150,11 @@ function stripHallucinatedToolMarkup(s) {
|
|
|
3104
3150
|
out = out.replace(/<|DSML|[\s\S]*$/g, "");
|
|
3105
3151
|
return out.trim();
|
|
3106
3152
|
}
|
|
3153
|
+
function parsePositiveIntEnv(raw) {
|
|
3154
|
+
if (!raw) return void 0;
|
|
3155
|
+
const n = Number.parseInt(raw, 10);
|
|
3156
|
+
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
3157
|
+
}
|
|
3107
3158
|
function safeParseToolArgs(raw) {
|
|
3108
3159
|
try {
|
|
3109
3160
|
return JSON.parse(raw);
|
|
@@ -7679,11 +7730,11 @@ function formatLogSize(path6 = defaultUsageLogPath()) {
|
|
|
7679
7730
|
|
|
7680
7731
|
// src/cli/commands/chat.tsx
|
|
7681
7732
|
import { render } from "ink";
|
|
7682
|
-
import
|
|
7733
|
+
import React60, { useState as useState17 } from "react";
|
|
7683
7734
|
|
|
7684
7735
|
// src/cli/ui/App.tsx
|
|
7685
|
-
import { Box as
|
|
7686
|
-
import
|
|
7736
|
+
import { Box as Box48, Text as Text50, useStdout as useStdout14 } from "ink";
|
|
7737
|
+
import React58, { useCallback as useCallback5, useEffect as useEffect8, useMemo as useMemo7, useRef as useRef6, useState as useState15 } from "react";
|
|
7687
7738
|
|
|
7688
7739
|
// src/adapters/event-sink-jsonl.ts
|
|
7689
7740
|
import { chmodSync as chmodSync3, createWriteStream as createWriteStream2, mkdirSync as mkdirSync6 } from "fs";
|
|
@@ -15582,7 +15633,7 @@ function reduce(state, event) {
|
|
|
15582
15633
|
makeLiveCard("thinking", `thinking \xB7 ${state.session.model}`, "brand")
|
|
15583
15634
|
);
|
|
15584
15635
|
case "reasoning.start":
|
|
15585
|
-
return appendCard(state, makeReasoningCard(event.id));
|
|
15636
|
+
return appendCard(state, makeReasoningCard(event.id, state.session.model));
|
|
15586
15637
|
case "reasoning.chunk":
|
|
15587
15638
|
return mutateCard(state, event.id, "reasoning", (c) => ({ ...c, text: c.text + event.text }));
|
|
15588
15639
|
case "reasoning.end":
|
|
@@ -15591,16 +15642,18 @@ function reduce(state, event) {
|
|
|
15591
15642
|
paragraphs: event.paragraphs,
|
|
15592
15643
|
tokens: event.tokens,
|
|
15593
15644
|
streaming: false,
|
|
15645
|
+
endedAt: Date.now(),
|
|
15594
15646
|
...event.aborted ? { aborted: true } : {}
|
|
15595
15647
|
}));
|
|
15596
15648
|
case "streaming.start":
|
|
15597
|
-
return appendCard(state, makeStreamingCard(event.id));
|
|
15649
|
+
return appendCard(state, makeStreamingCard(event.id, state.session.model));
|
|
15598
15650
|
case "streaming.chunk":
|
|
15599
15651
|
return mutateCard(state, event.id, "streaming", (c) => ({ ...c, text: c.text + event.text }));
|
|
15600
15652
|
case "streaming.end":
|
|
15601
15653
|
return mutateCard(state, event.id, "streaming", (c) => ({
|
|
15602
15654
|
...c,
|
|
15603
15655
|
done: true,
|
|
15656
|
+
endedAt: Date.now(),
|
|
15604
15657
|
...event.aborted ? { aborted: true } : {}
|
|
15605
15658
|
}));
|
|
15606
15659
|
case "tool.start":
|
|
@@ -15834,7 +15887,7 @@ function nextId(prefix) {
|
|
|
15834
15887
|
function makeUserCard(text) {
|
|
15835
15888
|
return { kind: "user", id: nextId("user"), ts: Date.now(), text };
|
|
15836
15889
|
}
|
|
15837
|
-
function makeReasoningCard(id) {
|
|
15890
|
+
function makeReasoningCard(id, model2) {
|
|
15838
15891
|
return {
|
|
15839
15892
|
kind: "reasoning",
|
|
15840
15893
|
id,
|
|
@@ -15842,11 +15895,19 @@ function makeReasoningCard(id) {
|
|
|
15842
15895
|
text: "",
|
|
15843
15896
|
paragraphs: 0,
|
|
15844
15897
|
tokens: 0,
|
|
15845
|
-
streaming: true
|
|
15898
|
+
streaming: true,
|
|
15899
|
+
...model2 ? { model: model2 } : {}
|
|
15846
15900
|
};
|
|
15847
15901
|
}
|
|
15848
|
-
function makeStreamingCard(id) {
|
|
15849
|
-
return {
|
|
15902
|
+
function makeStreamingCard(id, model2) {
|
|
15903
|
+
return {
|
|
15904
|
+
kind: "streaming",
|
|
15905
|
+
id,
|
|
15906
|
+
ts: Date.now(),
|
|
15907
|
+
text: "",
|
|
15908
|
+
done: false,
|
|
15909
|
+
...model2 ? { model: model2 } : {}
|
|
15910
|
+
};
|
|
15850
15911
|
}
|
|
15851
15912
|
function makeToolCard(id, name, args) {
|
|
15852
15913
|
return {
|
|
@@ -16190,11 +16251,11 @@ function useSyntheticSubmit(deps) {
|
|
|
16190
16251
|
|
|
16191
16252
|
// src/cli/ui/layout/CardStream.tsx
|
|
16192
16253
|
import { Static } from "ink";
|
|
16193
|
-
import
|
|
16254
|
+
import React50 from "react";
|
|
16194
16255
|
|
|
16195
16256
|
// src/cli/ui/cards/CardRenderer.tsx
|
|
16196
|
-
import { Box as
|
|
16197
|
-
import
|
|
16257
|
+
import { Box as Box42, Text as Text42 } from "ink";
|
|
16258
|
+
import React49 from "react";
|
|
16198
16259
|
|
|
16199
16260
|
// src/cli/ui/cards/BranchCard.tsx
|
|
16200
16261
|
import { Text as Text23 } from "ink";
|
|
@@ -16400,8 +16461,8 @@ function countByCategory(entries) {
|
|
|
16400
16461
|
}
|
|
16401
16462
|
|
|
16402
16463
|
// src/cli/ui/cards/ReasoningCard.tsx
|
|
16403
|
-
import { Box as
|
|
16404
|
-
import
|
|
16464
|
+
import { Box as Box32, Text as Text32, useStdout as useStdout7 } from "ink";
|
|
16465
|
+
import React39 from "react";
|
|
16405
16466
|
|
|
16406
16467
|
// src/frame/width.ts
|
|
16407
16468
|
import stringWidthLib from "string-width";
|
|
@@ -16430,39 +16491,176 @@ function clipToCells(s, maxCells) {
|
|
|
16430
16491
|
}
|
|
16431
16492
|
return `${out}\u2026`;
|
|
16432
16493
|
}
|
|
16494
|
+
function wrapToCells(s, maxCells) {
|
|
16495
|
+
if (maxCells <= 0) return [];
|
|
16496
|
+
if (s.length === 0) return [""];
|
|
16497
|
+
const out = [];
|
|
16498
|
+
let cur = "";
|
|
16499
|
+
let cells = 0;
|
|
16500
|
+
for (const g of graphemes(s)) {
|
|
16501
|
+
const w = graphemeWidth(g);
|
|
16502
|
+
if (cells + w > maxCells) {
|
|
16503
|
+
out.push(cur);
|
|
16504
|
+
cur = g;
|
|
16505
|
+
cells = w;
|
|
16506
|
+
} else {
|
|
16507
|
+
cur += g;
|
|
16508
|
+
cells += w;
|
|
16509
|
+
}
|
|
16510
|
+
}
|
|
16511
|
+
if (cur.length > 0 || out.length === 0) out.push(cur);
|
|
16512
|
+
return out;
|
|
16513
|
+
}
|
|
16514
|
+
|
|
16515
|
+
// src/cli/ui/primitives/CardBox.tsx
|
|
16516
|
+
import { Box as Box31 } from "ink";
|
|
16517
|
+
import React37 from "react";
|
|
16518
|
+
var BAR_STYLE = {
|
|
16519
|
+
topLeft: " ",
|
|
16520
|
+
top: " ",
|
|
16521
|
+
topRight: " ",
|
|
16522
|
+
right: " ",
|
|
16523
|
+
bottomRight: " ",
|
|
16524
|
+
bottom: " ",
|
|
16525
|
+
bottomLeft: " ",
|
|
16526
|
+
left: "\u258E"
|
|
16527
|
+
};
|
|
16528
|
+
function CardBox({
|
|
16529
|
+
color: color2,
|
|
16530
|
+
children
|
|
16531
|
+
}) {
|
|
16532
|
+
return /* @__PURE__ */ React37.createElement(Box31, { marginLeft: 2, flexDirection: "column" }, /* @__PURE__ */ React37.createElement(
|
|
16533
|
+
Box31,
|
|
16534
|
+
{
|
|
16535
|
+
flexDirection: "column",
|
|
16536
|
+
borderStyle: BAR_STYLE,
|
|
16537
|
+
borderTop: false,
|
|
16538
|
+
borderRight: false,
|
|
16539
|
+
borderBottom: false,
|
|
16540
|
+
borderLeft: true,
|
|
16541
|
+
borderLeftColor: color2,
|
|
16542
|
+
flexGrow: 1
|
|
16543
|
+
},
|
|
16544
|
+
children
|
|
16545
|
+
));
|
|
16546
|
+
}
|
|
16547
|
+
|
|
16548
|
+
// src/cli/ui/primitives/Pill.tsx
|
|
16549
|
+
import { Text as Text31 } from "ink";
|
|
16550
|
+
import React38 from "react";
|
|
16551
|
+
function Pill({ label, bg, fg, bold = true }) {
|
|
16552
|
+
return /* @__PURE__ */ React38.createElement(Text31, { backgroundColor: bg, color: fg, bold }, ` ${label} `);
|
|
16553
|
+
}
|
|
16554
|
+
var PILL_SECTION = {
|
|
16555
|
+
reason: { bg: "#2a1f3d", fg: "#d2a8ff" },
|
|
16556
|
+
output: { bg: "#0d1d2e", fg: "#79c0ff" },
|
|
16557
|
+
tool: { bg: "#0f2230", fg: "#79c0ff" },
|
|
16558
|
+
shell: { bg: "#0f2230", fg: "#79c0ff" },
|
|
16559
|
+
task: { bg: "#0d1d2e", fg: "#79c0ff" },
|
|
16560
|
+
taskDone: { bg: "#102815", fg: "#7ee787" },
|
|
16561
|
+
taskFailed: { bg: "#2c1416", fg: "#ff8b81" },
|
|
16562
|
+
plan: { bg: "#2a1f3d", fg: "#d2a8ff" },
|
|
16563
|
+
user: { bg: "#11141a", fg: "#8b949e" }
|
|
16564
|
+
};
|
|
16565
|
+
var PILL_MODEL = {
|
|
16566
|
+
flash: { bg: "#11141a", fg: "#79c0ff" },
|
|
16567
|
+
pro: { bg: "#11141a", fg: "#d2a8ff" },
|
|
16568
|
+
r1: { bg: "#11141a", fg: "#b395f5" },
|
|
16569
|
+
unknown: { bg: "#11141a", fg: "#8b949e" }
|
|
16570
|
+
};
|
|
16571
|
+
function modelBadgeFor(model2) {
|
|
16572
|
+
if (!model2) return { label: "?", kind: "unknown" };
|
|
16573
|
+
const stripped = model2.replace(/^deepseek-/, "");
|
|
16574
|
+
if (stripped === "v4-flash" || stripped === "chat") return { label: "v4-flash", kind: "flash" };
|
|
16575
|
+
if (stripped === "v4-pro") return { label: "v4-pro", kind: "pro" };
|
|
16576
|
+
if (stripped === "r1" || stripped === "reasoner") return { label: "r1", kind: "r1" };
|
|
16577
|
+
return { label: stripped, kind: "unknown" };
|
|
16578
|
+
}
|
|
16433
16579
|
|
|
16434
16580
|
// src/cli/ui/cards/ReasoningCard.tsx
|
|
16435
|
-
var
|
|
16436
|
-
var
|
|
16437
|
-
var
|
|
16581
|
+
var STREAMING_PREVIEW_LINES = 4;
|
|
16582
|
+
var SETTLED_TAIL_LINES = 2;
|
|
16583
|
+
var HEADER_PAD = 1;
|
|
16584
|
+
var BODY_PAD = 4;
|
|
16438
16585
|
function ReasoningCard({
|
|
16439
16586
|
card,
|
|
16440
16587
|
expanded
|
|
16441
16588
|
}) {
|
|
16442
16589
|
const { stdout: stdout4 } = useStdout7();
|
|
16443
16590
|
const cols = stdout4?.columns ?? 80;
|
|
16444
|
-
const lineCells = Math.max(20, cols -
|
|
16445
|
-
const meta = card.aborted ? "aborted" : card.streaming ? "streaming\u2026" : `${card.paragraphs} paragraph${card.paragraphs === 1 ? "" : "s"} \xB7 ${card.tokens} tok`;
|
|
16591
|
+
const lineCells = Math.max(20, cols - BODY_PAD - 4);
|
|
16446
16592
|
const allLines = card.text.length > 0 ? card.text.split("\n") : [];
|
|
16447
|
-
const
|
|
16448
|
-
const
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
const
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16593
|
+
const showBody = expanded && (allLines.length > 0 || card.streaming);
|
|
16594
|
+
const barColor = card.streaming ? CARD.reasoning.color : FG.faint;
|
|
16595
|
+
return /* @__PURE__ */ React39.createElement(CardBox, { color: barColor }, /* @__PURE__ */ React39.createElement(ReasoningHeader, { card }), showBody && /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(Box32, { height: 1 }), card.streaming ? /* @__PURE__ */ React39.createElement(StreamingPreview, { card, allLines, lineCells }) : /* @__PURE__ */ React39.createElement(SettledPreview, { card, allLines, lineCells })));
|
|
16596
|
+
}
|
|
16597
|
+
function ReasoningHeader({ card }) {
|
|
16598
|
+
const badge2 = modelBadgeFor(card.model);
|
|
16599
|
+
const mdl = PILL_MODEL[badge2.kind];
|
|
16600
|
+
const sec = PILL_SECTION.reason;
|
|
16601
|
+
const meta = headerMeta(card);
|
|
16602
|
+
const duration = headerDuration(card);
|
|
16603
|
+
return /* @__PURE__ */ React39.createElement(Box32, { paddingLeft: HEADER_PAD, flexDirection: "row" }, /* @__PURE__ */ React39.createElement(Pill, { label: "REASONING", bg: sec.bg, fg: sec.fg }), /* @__PURE__ */ React39.createElement(Text32, null, " "), /* @__PURE__ */ React39.createElement(Pill, { label: badge2.label, bg: mdl.bg, fg: mdl.fg }), meta && /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(Text32, null, " "), /* @__PURE__ */ React39.createElement(Text32, { color: FG.faint }, meta)), /* @__PURE__ */ React39.createElement(Box32, { flexGrow: 1 }), card.streaming && !card.aborted && /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(Spinner, { kind: "braille", color: CARD.reasoning.color }), /* @__PURE__ */ React39.createElement(Text32, { color: CARD.reasoning.color }, " thinking\u2026")), duration && /* @__PURE__ */ React39.createElement(Text32, { color: FG.faint }, duration));
|
|
16604
|
+
}
|
|
16605
|
+
function headerMeta(card) {
|
|
16606
|
+
if (card.aborted) return "aborted";
|
|
16607
|
+
if (card.streaming) {
|
|
16608
|
+
return card.tokens > 0 ? `${card.tokens.toLocaleString()} tok` : "";
|
|
16609
|
+
}
|
|
16610
|
+
const parts = [];
|
|
16611
|
+
if (card.tokens > 0) parts.push(`${card.tokens.toLocaleString()} tok`);
|
|
16612
|
+
if (card.paragraphs > 0) parts.push(`${card.paragraphs} \xB6`);
|
|
16613
|
+
return parts.join(" \xB7 ");
|
|
16614
|
+
}
|
|
16615
|
+
function headerDuration(card) {
|
|
16616
|
+
if (card.streaming || !card.endedAt) return "";
|
|
16617
|
+
const seconds = Math.max(0, (card.endedAt - card.ts) / 1e3);
|
|
16618
|
+
return `${seconds.toFixed(1)}s`;
|
|
16619
|
+
}
|
|
16620
|
+
function StreamingPreview({ card, allLines, lineCells }) {
|
|
16621
|
+
const visualLines = allLines.flatMap((l) => wrapToCells(l, lineCells));
|
|
16622
|
+
const visible = visualLines.slice(-STREAMING_PREVIEW_LINES);
|
|
16623
|
+
return /* @__PURE__ */ React39.createElement(BodyLines, { card, lines: visible, lineCells, cursorOnLast: true });
|
|
16624
|
+
}
|
|
16625
|
+
function SettledPreview({ card, allLines, lineCells }) {
|
|
16626
|
+
const visualLines = allLines.flatMap((l) => wrapToCells(l, lineCells));
|
|
16627
|
+
const visible = visualLines.slice(-SETTLED_TAIL_LINES);
|
|
16628
|
+
const droppedLines = Math.max(0, visualLines.length - visible.length);
|
|
16629
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, droppedLines > 0 && /* @__PURE__ */ React39.createElement(ElisionHint, { droppedLines, card }), /* @__PURE__ */ React39.createElement(BodyLines, { card, lines: visible, lineCells, indexOffset: droppedLines }));
|
|
16630
|
+
}
|
|
16631
|
+
function BodyLines({
|
|
16632
|
+
card,
|
|
16633
|
+
lines,
|
|
16634
|
+
lineCells,
|
|
16635
|
+
cursorOnLast = false,
|
|
16636
|
+
indexOffset = 0
|
|
16637
|
+
}) {
|
|
16638
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, lines.map((line, i) => {
|
|
16639
|
+
const isLast = i === lines.length - 1;
|
|
16640
|
+
return /* @__PURE__ */ React39.createElement(Box32, { key: `${card.id}:b:${indexOffset + i}`, paddingLeft: BODY_PAD, flexDirection: "row" }, /* @__PURE__ */ React39.createElement(Text32, { italic: true, color: FG.meta }, clipToCells(line, lineCells)), isLast && cursorOnLast && /* @__PURE__ */ React39.createElement(CursorBlock, null));
|
|
16641
|
+
}));
|
|
16642
|
+
}
|
|
16643
|
+
function ElisionHint({
|
|
16644
|
+
droppedLines,
|
|
16645
|
+
card
|
|
16646
|
+
}) {
|
|
16647
|
+
const parts = [];
|
|
16648
|
+
if (card.paragraphs > 1) {
|
|
16649
|
+
parts.push(`${card.paragraphs} \xB6`);
|
|
16650
|
+
} else {
|
|
16651
|
+
parts.push(`${droppedLines} line${droppedLines === 1 ? "" : "s"}`);
|
|
16652
|
+
}
|
|
16653
|
+
if (card.tokens > 0) parts.push(`${card.tokens.toLocaleString()} tok`);
|
|
16654
|
+
return /* @__PURE__ */ React39.createElement(Box32, { paddingLeft: BODY_PAD }, /* @__PURE__ */ React39.createElement(Text32, { color: FG.faint }, `\u22EF ${parts.join(" \xB7 ")} above \xB7 /reasoning last`));
|
|
16457
16655
|
}
|
|
16458
16656
|
|
|
16459
16657
|
// src/cli/ui/cards/SearchCard.tsx
|
|
16460
|
-
import { Box as
|
|
16461
|
-
import
|
|
16658
|
+
import { Box as Box33, Text as Text33 } from "ink";
|
|
16659
|
+
import React40 from "react";
|
|
16462
16660
|
function SearchCard({ card }) {
|
|
16463
16661
|
const fileCount = new Set(card.hits.map((h) => h.file)).size;
|
|
16464
16662
|
const meta = `${card.hits.length} hit${card.hits.length === 1 ? "" : "s"} in ${fileCount} file${fileCount === 1 ? "" : "s"} \xB7 ${(card.elapsedMs / 1e3).toFixed(2)}s`;
|
|
16465
|
-
return /* @__PURE__ */
|
|
16663
|
+
return /* @__PURE__ */ React40.createElement(Box33, { flexDirection: "column" }, /* @__PURE__ */ React40.createElement(CardHeader, { tone: "search", glyph: "\u2299", title: "Search", subtitle: `"${card.query}"`, meta }), card.hits.length > 0 && /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(BarRow, { tone: "search", indent: 0 }), groupByFile(card.hits.slice(0, 10)).map(([file, hits]) => /* @__PURE__ */ React40.createElement(Box33, { key: file, flexDirection: "column" }, /* @__PURE__ */ React40.createElement(BarRow, { tone: "search" }, /* @__PURE__ */ React40.createElement(Text33, { bold: true, color: FG.strong }, file)), hits.map((h, i) => /* @__PURE__ */ React40.createElement(BarRow, { key: `${file}:${h.line}:${i}`, tone: "search" }, /* @__PURE__ */ React40.createElement(Text33, { color: FG.faint }, `${h.line.toString().padStart(4)} \u2502 `), /* @__PURE__ */ React40.createElement(HighlightedLine, { text: h.preview, start: h.matchStart, end: h.matchEnd }))))), card.hits.length > 10 && /* @__PURE__ */ React40.createElement(BarRow, { tone: "search" }, /* @__PURE__ */ React40.createElement(Text33, { color: FG.faint }, `\u22EE +${card.hits.length - 10} more hits`))));
|
|
16466
16664
|
}
|
|
16467
16665
|
function HighlightedLine({
|
|
16468
16666
|
text,
|
|
@@ -16470,9 +16668,9 @@ function HighlightedLine({
|
|
|
16470
16668
|
end
|
|
16471
16669
|
}) {
|
|
16472
16670
|
if (start < 0 || end <= start || end > text.length) {
|
|
16473
|
-
return /* @__PURE__ */
|
|
16671
|
+
return /* @__PURE__ */ React40.createElement(Text33, { color: FG.sub }, text);
|
|
16474
16672
|
}
|
|
16475
|
-
return /* @__PURE__ */
|
|
16673
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(Text33, { color: FG.sub }, text.slice(0, start)), /* @__PURE__ */ React40.createElement(Text33, { bold: true, inverse: true }, text.slice(start, end)), /* @__PURE__ */ React40.createElement(Text33, { color: FG.sub }, text.slice(end)));
|
|
16476
16674
|
}
|
|
16477
16675
|
function groupByFile(hits) {
|
|
16478
16676
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -16485,12 +16683,12 @@ function groupByFile(hits) {
|
|
|
16485
16683
|
}
|
|
16486
16684
|
|
|
16487
16685
|
// src/cli/ui/cards/StreamingCard.tsx
|
|
16488
|
-
import { Box as
|
|
16489
|
-
import
|
|
16686
|
+
import { Box as Box35, Text as Text35, useStdout as useStdout8 } from "ink";
|
|
16687
|
+
import React42 from "react";
|
|
16490
16688
|
|
|
16491
16689
|
// src/cli/ui/markdown.tsx
|
|
16492
16690
|
import { highlight, supportsLanguage } from "cli-highlight";
|
|
16493
|
-
import { Box as
|
|
16691
|
+
import { Box as Box34, Text as Text34 } from "ink";
|
|
16494
16692
|
|
|
16495
16693
|
// node_modules/marked/lib/marked.esm.js
|
|
16496
16694
|
function _getDefaults() {
|
|
@@ -18502,7 +18700,7 @@ var parser = _Parser.parse;
|
|
|
18502
18700
|
var lexer = _Lexer.lex;
|
|
18503
18701
|
|
|
18504
18702
|
// src/cli/ui/markdown.tsx
|
|
18505
|
-
import
|
|
18703
|
+
import React41 from "react";
|
|
18506
18704
|
import stringWidth from "string-width";
|
|
18507
18705
|
function padToCells(text, cells) {
|
|
18508
18706
|
const w = stringWidth(text);
|
|
@@ -18511,41 +18709,41 @@ function padToCells(text, cells) {
|
|
|
18511
18709
|
}
|
|
18512
18710
|
marked.setOptions({ gfm: true, breaks: false });
|
|
18513
18711
|
function Markdown({ text }) {
|
|
18514
|
-
const tokens =
|
|
18515
|
-
return /* @__PURE__ */
|
|
18712
|
+
const tokens = React41.useMemo(() => marked.lexer(text), [text]);
|
|
18713
|
+
return /* @__PURE__ */ React41.createElement(Box34, { flexDirection: "column", gap: 1 }, tokens.map((token, i) => /* @__PURE__ */ React41.createElement(BlockToken, { key: `${i}-${token.type}`, token })));
|
|
18516
18714
|
}
|
|
18517
18715
|
function BlockToken({ token }) {
|
|
18518
18716
|
switch (token.type) {
|
|
18519
18717
|
case "heading":
|
|
18520
|
-
return /* @__PURE__ */
|
|
18718
|
+
return /* @__PURE__ */ React41.createElement(Heading, { token });
|
|
18521
18719
|
case "paragraph":
|
|
18522
|
-
return /* @__PURE__ */
|
|
18720
|
+
return /* @__PURE__ */ React41.createElement(Paragraph, { token });
|
|
18523
18721
|
case "list":
|
|
18524
|
-
return /* @__PURE__ */
|
|
18722
|
+
return /* @__PURE__ */ React41.createElement(List, { token, depth: 0 });
|
|
18525
18723
|
case "code":
|
|
18526
|
-
return /* @__PURE__ */
|
|
18724
|
+
return /* @__PURE__ */ React41.createElement(CodeBlock, { token });
|
|
18527
18725
|
case "blockquote":
|
|
18528
|
-
return /* @__PURE__ */
|
|
18726
|
+
return /* @__PURE__ */ React41.createElement(Blockquote, { token });
|
|
18529
18727
|
case "hr":
|
|
18530
|
-
return /* @__PURE__ */
|
|
18728
|
+
return /* @__PURE__ */ React41.createElement(HorizontalRule, null);
|
|
18531
18729
|
case "table":
|
|
18532
|
-
return /* @__PURE__ */
|
|
18730
|
+
return /* @__PURE__ */ React41.createElement(Table, { token });
|
|
18533
18731
|
case "html":
|
|
18534
|
-
return /* @__PURE__ */
|
|
18732
|
+
return /* @__PURE__ */ React41.createElement(Text34, { color: FG.body }, token.text);
|
|
18535
18733
|
case "space":
|
|
18536
18734
|
return null;
|
|
18537
18735
|
default:
|
|
18538
|
-
return /* @__PURE__ */
|
|
18736
|
+
return /* @__PURE__ */ React41.createElement(Text34, { color: FG.body }, token.raw ?? "");
|
|
18539
18737
|
}
|
|
18540
18738
|
}
|
|
18541
18739
|
function Heading({ token }) {
|
|
18542
|
-
return /* @__PURE__ */
|
|
18740
|
+
return /* @__PURE__ */ React41.createElement(Box34, null, /* @__PURE__ */ React41.createElement(Text34, { bold: true, color: FG.strong, backgroundColor: SURFACE.bgElev }, ` ${plainText(token.tokens)} `));
|
|
18543
18741
|
}
|
|
18544
18742
|
function Paragraph({ token }) {
|
|
18545
|
-
return /* @__PURE__ */
|
|
18743
|
+
return /* @__PURE__ */ React41.createElement(Text34, { color: FG.body }, /* @__PURE__ */ React41.createElement(Inline, { tokens: token.tokens ?? [] }));
|
|
18546
18744
|
}
|
|
18547
18745
|
function List({ token, depth }) {
|
|
18548
|
-
return /* @__PURE__ */
|
|
18746
|
+
return /* @__PURE__ */ React41.createElement(Box34, { flexDirection: "column" }, token.items.map((item, i) => /* @__PURE__ */ React41.createElement(
|
|
18549
18747
|
ListItem,
|
|
18550
18748
|
{
|
|
18551
18749
|
key: `${i}-${item.text.slice(0, 24)}`,
|
|
@@ -18566,27 +18764,27 @@ function ListItem({
|
|
|
18566
18764
|
const markerColor = item.task ? item.checked ? TONE.ok : FG.faint : FG.meta;
|
|
18567
18765
|
const dim = item.task && item.checked === true;
|
|
18568
18766
|
const indent = " ".repeat(depth + 1);
|
|
18569
|
-
return /* @__PURE__ */
|
|
18767
|
+
return /* @__PURE__ */ React41.createElement(Box34, null, /* @__PURE__ */ React41.createElement(Text34, { color: markerColor }, `${indent}${marker} `), /* @__PURE__ */ React41.createElement(Box34, { flexDirection: "column" }, item.tokens.map((tok, i) => {
|
|
18570
18768
|
if (tok.type === "text") {
|
|
18571
18769
|
const inner = tok.tokens;
|
|
18572
18770
|
return (
|
|
18573
18771
|
// biome-ignore lint/suspicious/noArrayIndexKey: list-item children are positional and stable per render
|
|
18574
|
-
/* @__PURE__ */
|
|
18772
|
+
/* @__PURE__ */ React41.createElement(Text34, { key: `t-${i}`, color: dim ? FG.faint : FG.body, strikethrough: dim }, inner ? /* @__PURE__ */ React41.createElement(Inline, { tokens: inner }) : tok.text)
|
|
18575
18773
|
);
|
|
18576
18774
|
}
|
|
18577
18775
|
if (tok.type === "list") {
|
|
18578
|
-
return /* @__PURE__ */
|
|
18776
|
+
return /* @__PURE__ */ React41.createElement(List, { key: `l-${i}`, token: tok, depth: depth + 1 });
|
|
18579
18777
|
}
|
|
18580
|
-
return /* @__PURE__ */
|
|
18778
|
+
return /* @__PURE__ */ React41.createElement(BlockToken, { key: `b-${i}-${tok.type}`, token: tok });
|
|
18581
18779
|
})));
|
|
18582
18780
|
}
|
|
18583
18781
|
function CodeBlock({ token }) {
|
|
18584
18782
|
const lang = token.lang?.split(/\s+/)[0] ?? "";
|
|
18585
18783
|
const colored = highlightCode(token.text, lang);
|
|
18586
18784
|
const lines = colored.split("\n");
|
|
18587
|
-
return /* @__PURE__ */
|
|
18785
|
+
return /* @__PURE__ */ React41.createElement(Box34, { flexDirection: "column" }, lang ? /* @__PURE__ */ React41.createElement(Box34, null, /* @__PURE__ */ React41.createElement(Text34, { color: FG.meta }, ` ${lang}`)) : null, /* @__PURE__ */ React41.createElement(Box34, { flexDirection: "column" }, lines.map((line, i) => (
|
|
18588
18786
|
// biome-ignore lint/suspicious/noArrayIndexKey: code lines are positional and stable per render
|
|
18589
|
-
/* @__PURE__ */
|
|
18787
|
+
/* @__PURE__ */ React41.createElement(Text34, { key: `code-${i}`, backgroundColor: SURFACE.bgElev }, ` ${line} `)
|
|
18590
18788
|
))));
|
|
18591
18789
|
}
|
|
18592
18790
|
function highlightCode(source, lang) {
|
|
@@ -18599,10 +18797,10 @@ function highlightCode(source, lang) {
|
|
|
18599
18797
|
}
|
|
18600
18798
|
}
|
|
18601
18799
|
function Blockquote({ token }) {
|
|
18602
|
-
return /* @__PURE__ */
|
|
18800
|
+
return /* @__PURE__ */ React41.createElement(Box34, { flexDirection: "column" }, (token.tokens ?? []).map((child, i) => /* @__PURE__ */ React41.createElement(Box34, { key: `${i}-${child.type}`, flexDirection: "row" }, /* @__PURE__ */ React41.createElement(Text34, { color: TONE.brand }, " \u258E "), /* @__PURE__ */ React41.createElement(Box34, { flexDirection: "column", flexGrow: 1 }, child.type === "paragraph" ? /* @__PURE__ */ React41.createElement(Text34, { italic: true, color: FG.sub }, /* @__PURE__ */ React41.createElement(Inline, { tokens: child.tokens ?? [] })) : /* @__PURE__ */ React41.createElement(BlockToken, { token: child })))));
|
|
18603
18801
|
}
|
|
18604
18802
|
function HorizontalRule() {
|
|
18605
|
-
return /* @__PURE__ */
|
|
18803
|
+
return /* @__PURE__ */ React41.createElement(Text34, { color: FG.faint }, " \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
18606
18804
|
}
|
|
18607
18805
|
function Table({ token }) {
|
|
18608
18806
|
const colCount = token.header.length;
|
|
@@ -18617,29 +18815,29 @@ function Table({ token }) {
|
|
|
18617
18815
|
}
|
|
18618
18816
|
const GAP = " ";
|
|
18619
18817
|
const ruleRow = widths.map((w) => "\u2500".repeat(w)).join(GAP);
|
|
18620
|
-
return /* @__PURE__ */
|
|
18818
|
+
return /* @__PURE__ */ React41.createElement(Box34, { flexDirection: "column" }, /* @__PURE__ */ React41.createElement(Box34, null, /* @__PURE__ */ React41.createElement(Text34, null, " "), headerCells.map((cell, i) => (
|
|
18621
18819
|
// biome-ignore lint/suspicious/noArrayIndexKey: header cells positional
|
|
18622
|
-
/* @__PURE__ */
|
|
18623
|
-
))), /* @__PURE__ */
|
|
18820
|
+
/* @__PURE__ */ React41.createElement(React41.Fragment, { key: `h-${i}` }, /* @__PURE__ */ React41.createElement(Text34, { bold: true, color: FG.sub }, padToCells(cell, widths[i])), i < colCount - 1 ? /* @__PURE__ */ React41.createElement(Text34, null, GAP) : null)
|
|
18821
|
+
))), /* @__PURE__ */ React41.createElement(Box34, null, /* @__PURE__ */ React41.createElement(Text34, null, " "), /* @__PURE__ */ React41.createElement(Text34, { color: FG.faint }, ruleRow)), bodyCells.map((row3, ri) => (
|
|
18624
18822
|
// biome-ignore lint/suspicious/noArrayIndexKey: body rows positional
|
|
18625
|
-
/* @__PURE__ */
|
|
18823
|
+
/* @__PURE__ */ React41.createElement(Box34, { key: `tr-${ri}` }, /* @__PURE__ */ React41.createElement(Text34, null, " "), row3.map((cell, i) => (
|
|
18626
18824
|
// biome-ignore lint/suspicious/noArrayIndexKey: cells positional
|
|
18627
|
-
/* @__PURE__ */
|
|
18825
|
+
/* @__PURE__ */ React41.createElement(React41.Fragment, { key: `c-${ri}-${i}` }, /* @__PURE__ */ React41.createElement(Text34, { color: FG.body }, padToCells(cell ?? "", widths[i])), i < colCount - 1 ? /* @__PURE__ */ React41.createElement(Text34, null, GAP) : null)
|
|
18628
18826
|
)))
|
|
18629
18827
|
)));
|
|
18630
18828
|
}
|
|
18631
18829
|
function Inline({ tokens }) {
|
|
18632
|
-
return /* @__PURE__ */
|
|
18830
|
+
return /* @__PURE__ */ React41.createElement(React41.Fragment, null, tokens.map((tok, i) => /* @__PURE__ */ React41.createElement(InlineToken, { key: `${i}-${tok.type}`, token: tok })));
|
|
18633
18831
|
}
|
|
18634
18832
|
var FILE_REF_RE = /\b([A-Za-z0-9_./@\-]+\.[A-Za-z0-9]{1,6})(?::(\d+)(?:-(\d+))?)?\b/g;
|
|
18635
18833
|
var MENTION_RE = /(?<![A-Za-z0-9_])@([A-Za-z0-9_./\-]+\.[A-Za-z0-9]{1,6})/g;
|
|
18636
18834
|
function osc8(label, target, color2) {
|
|
18637
18835
|
const open = `\x1B]8;;${target}\x07`;
|
|
18638
18836
|
const close = "\x1B]8;;\x07";
|
|
18639
|
-
return /* @__PURE__ */
|
|
18837
|
+
return /* @__PURE__ */ React41.createElement(Text34, { color: color2, underline: true }, `${open}${label}${close}`);
|
|
18640
18838
|
}
|
|
18641
18839
|
function renderInlineText(raw) {
|
|
18642
|
-
if (!raw) return /* @__PURE__ */
|
|
18840
|
+
if (!raw) return /* @__PURE__ */ React41.createElement(Text34, null, raw);
|
|
18643
18841
|
const out = [];
|
|
18644
18842
|
let cursor = 0;
|
|
18645
18843
|
const hits = [];
|
|
@@ -18650,7 +18848,7 @@ function renderInlineText(raw) {
|
|
|
18650
18848
|
hits.push({
|
|
18651
18849
|
start,
|
|
18652
18850
|
end,
|
|
18653
|
-
node: /* @__PURE__ */
|
|
18851
|
+
node: /* @__PURE__ */ React41.createElement(Text34, { color: TONE.warn, underline: true }, `@${path6}`)
|
|
18654
18852
|
});
|
|
18655
18853
|
}
|
|
18656
18854
|
for (const m of raw.matchAll(FILE_REF_RE)) {
|
|
@@ -18666,44 +18864,44 @@ function renderInlineText(raw) {
|
|
|
18666
18864
|
let key = 0;
|
|
18667
18865
|
for (const h of hits) {
|
|
18668
18866
|
if (h.start > cursor) {
|
|
18669
|
-
out.push(/* @__PURE__ */
|
|
18867
|
+
out.push(/* @__PURE__ */ React41.createElement(Text34, { key: `t-${key++}` }, raw.slice(cursor, h.start)));
|
|
18670
18868
|
}
|
|
18671
|
-
out.push(/* @__PURE__ */
|
|
18869
|
+
out.push(/* @__PURE__ */ React41.createElement(React41.Fragment, { key: `r-${key++}` }, h.node));
|
|
18672
18870
|
cursor = h.end;
|
|
18673
18871
|
}
|
|
18674
|
-
if (cursor < raw.length) out.push(/* @__PURE__ */
|
|
18675
|
-
return /* @__PURE__ */
|
|
18872
|
+
if (cursor < raw.length) out.push(/* @__PURE__ */ React41.createElement(Text34, { key: `t-${key++}` }, raw.slice(cursor)));
|
|
18873
|
+
return /* @__PURE__ */ React41.createElement(React41.Fragment, null, out);
|
|
18676
18874
|
}
|
|
18677
18875
|
function InlineToken({ token }) {
|
|
18678
18876
|
switch (token.type) {
|
|
18679
18877
|
case "text": {
|
|
18680
18878
|
const t2 = token;
|
|
18681
|
-
return t2.tokens ? /* @__PURE__ */
|
|
18879
|
+
return t2.tokens ? /* @__PURE__ */ React41.createElement(Inline, { tokens: t2.tokens }) : renderInlineText(t2.text);
|
|
18682
18880
|
}
|
|
18683
18881
|
case "strong":
|
|
18684
|
-
return /* @__PURE__ */
|
|
18882
|
+
return /* @__PURE__ */ React41.createElement(Text34, { bold: true, color: FG.strong }, /* @__PURE__ */ React41.createElement(Inline, { tokens: token.tokens }));
|
|
18685
18883
|
case "em":
|
|
18686
|
-
return /* @__PURE__ */
|
|
18884
|
+
return /* @__PURE__ */ React41.createElement(Text34, { italic: true }, /* @__PURE__ */ React41.createElement(Inline, { tokens: token.tokens }));
|
|
18687
18885
|
case "codespan":
|
|
18688
|
-
return /* @__PURE__ */
|
|
18886
|
+
return /* @__PURE__ */ React41.createElement(Text34, { color: FG.strong, backgroundColor: SURFACE.bgElev }, ` ${token.text} `);
|
|
18689
18887
|
case "del":
|
|
18690
|
-
return /* @__PURE__ */
|
|
18888
|
+
return /* @__PURE__ */ React41.createElement(Text34, { color: TONE.err, strikethrough: true }, /* @__PURE__ */ React41.createElement(Inline, { tokens: token.tokens }));
|
|
18691
18889
|
case "link": {
|
|
18692
18890
|
const l = token;
|
|
18693
|
-
return /* @__PURE__ */
|
|
18891
|
+
return /* @__PURE__ */ React41.createElement(Text34, { color: TONE.brand, underline: true }, /* @__PURE__ */ React41.createElement(Inline, { tokens: l.tokens }));
|
|
18694
18892
|
}
|
|
18695
18893
|
case "image": {
|
|
18696
18894
|
const im = token;
|
|
18697
|
-
return /* @__PURE__ */
|
|
18895
|
+
return /* @__PURE__ */ React41.createElement(Text34, { color: TONE.brand }, `[image: ${im.text || im.href}]`);
|
|
18698
18896
|
}
|
|
18699
18897
|
case "br":
|
|
18700
|
-
return /* @__PURE__ */
|
|
18898
|
+
return /* @__PURE__ */ React41.createElement(Text34, null, "\n");
|
|
18701
18899
|
case "escape":
|
|
18702
|
-
return /* @__PURE__ */
|
|
18900
|
+
return /* @__PURE__ */ React41.createElement(Text34, null, token.text);
|
|
18703
18901
|
case "html":
|
|
18704
|
-
return /* @__PURE__ */
|
|
18902
|
+
return /* @__PURE__ */ React41.createElement(Text34, null, token.text);
|
|
18705
18903
|
default:
|
|
18706
|
-
return /* @__PURE__ */
|
|
18904
|
+
return /* @__PURE__ */ React41.createElement(Text34, null, token.raw ?? "");
|
|
18707
18905
|
}
|
|
18708
18906
|
}
|
|
18709
18907
|
function plainText(tokens) {
|
|
@@ -18737,96 +18935,79 @@ function plainText(tokens) {
|
|
|
18737
18935
|
}
|
|
18738
18936
|
|
|
18739
18937
|
// src/cli/ui/cards/StreamingCard.tsx
|
|
18740
|
-
var
|
|
18938
|
+
var HEADER_PAD2 = 1;
|
|
18939
|
+
var BODY_PAD2 = 4;
|
|
18940
|
+
var STREAMING_PREVIEW_LINES2 = 4;
|
|
18741
18941
|
function StreamingCard({ card }) {
|
|
18742
18942
|
const { stdout: stdout4 } = useStdout8();
|
|
18743
18943
|
const cols = stdout4?.columns ?? 80;
|
|
18744
|
-
|
|
18944
|
+
useReserveRows("stream", {
|
|
18945
|
+
min: STREAMING_PREVIEW_LINES2 + 1,
|
|
18946
|
+
max: STREAMING_PREVIEW_LINES2 + 2
|
|
18947
|
+
});
|
|
18745
18948
|
if (card.done && !card.aborted) {
|
|
18746
|
-
return /* @__PURE__ */
|
|
18747
|
-
Box34,
|
|
18748
|
-
{
|
|
18749
|
-
flexDirection: "column",
|
|
18750
|
-
paddingLeft: 2,
|
|
18751
|
-
paddingRight: 1,
|
|
18752
|
-
borderStyle: "single",
|
|
18753
|
-
borderTop: false,
|
|
18754
|
-
borderRight: false,
|
|
18755
|
-
borderBottom: false,
|
|
18756
|
-
borderLeft: true,
|
|
18757
|
-
borderLeftColor: TONE.brand
|
|
18758
|
-
},
|
|
18759
|
-
/* @__PURE__ */ React40.createElement(Markdown, { text: card.text })
|
|
18760
|
-
);
|
|
18949
|
+
return /* @__PURE__ */ React42.createElement(CardBox, { color: FG.faint }, /* @__PURE__ */ React42.createElement(Box35, { paddingLeft: BODY_PAD2, flexDirection: "column" }, /* @__PURE__ */ React42.createElement(Markdown, { text: card.text })));
|
|
18761
18950
|
}
|
|
18762
|
-
const lineCells = Math.max(20, cols -
|
|
18951
|
+
const lineCells = Math.max(20, cols - BODY_PAD2 - 4);
|
|
18763
18952
|
const allLines = card.text.length > 0 ? card.text.split("\n") : [""];
|
|
18764
|
-
const
|
|
18765
|
-
const
|
|
18766
|
-
|
|
18767
|
-
|
|
18768
|
-
const headDropped = overflows ? allLines.length - visible.length : 0;
|
|
18769
|
-
return /* @__PURE__ */ React40.createElement(Box34, { flexDirection: "column" }, card.aborted && /* @__PURE__ */ React40.createElement(BarRow, { tone: "streaming", glyph: "\u2014" }, /* @__PURE__ */ React40.createElement(Text34, { color: FG.faint, bold: true }, "\u2014 aborted \u2014"), /* @__PURE__ */ React40.createElement(Text34, { color: TONE.warn }, " stopped")), headDropped > 0 && /* @__PURE__ */ React40.createElement(BarRow, { tone: "streaming", glyph: "\u25BE" }, /* @__PURE__ */ React40.createElement(
|
|
18770
|
-
Text34,
|
|
18953
|
+
const visualLines = allLines.flatMap((l) => wrapToCells(l, lineCells));
|
|
18954
|
+
const visible = visualLines.slice(-STREAMING_PREVIEW_LINES2);
|
|
18955
|
+
return /* @__PURE__ */ React42.createElement(CardBox, { color: card.aborted ? FG.faint : CARD.streaming.color }, !card.aborted && /* @__PURE__ */ React42.createElement(StreamingHeader, { card }), card.aborted && /* @__PURE__ */ React42.createElement(Box35, { paddingLeft: HEADER_PAD2, flexDirection: "row" }, /* @__PURE__ */ React42.createElement(Text35, { color: FG.faint, bold: true }, "\u2014 aborted \u2014"), /* @__PURE__ */ React42.createElement(Text35, { color: TONE.warn }, " stopped")), visible.map((line, i) => /* @__PURE__ */ React42.createElement(
|
|
18956
|
+
Box35,
|
|
18771
18957
|
{
|
|
18772
|
-
|
|
18958
|
+
key: `${card.id}:${allLines.length - visible.length + i}`,
|
|
18959
|
+
paddingLeft: BODY_PAD2,
|
|
18960
|
+
flexDirection: "row"
|
|
18773
18961
|
},
|
|
18774
|
-
|
|
18775
|
-
)),
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
|
|
18781
|
-
|
|
18782
|
-
tone: "streaming",
|
|
18783
|
-
glyph: isFirstRendered ? "\u25B6" : void 0
|
|
18784
|
-
},
|
|
18785
|
-
/* @__PURE__ */ React40.createElement(Text34, { color: card.aborted ? FG.meta : FG.body }, clipToCells(line, lineCells)),
|
|
18786
|
-
isLast && !card.done && /* @__PURE__ */ React40.createElement(CursorBlock, null)
|
|
18787
|
-
);
|
|
18788
|
-
}), card.aborted && /* @__PURE__ */ React40.createElement(BarRow, { tone: "streaming" }, /* @__PURE__ */ React40.createElement(Text34, { color: FG.faint }, "[truncated by esc]")));
|
|
18962
|
+
/* @__PURE__ */ React42.createElement(Text35, { color: card.aborted ? FG.meta : FG.body }, clipToCells(line, lineCells))
|
|
18963
|
+
)), card.aborted && /* @__PURE__ */ React42.createElement(Box35, { paddingLeft: BODY_PAD2 }, /* @__PURE__ */ React42.createElement(Text35, { color: FG.faint }, "[truncated by esc]")));
|
|
18964
|
+
}
|
|
18965
|
+
function StreamingHeader({ card }) {
|
|
18966
|
+
const badge2 = modelBadgeFor(card.model);
|
|
18967
|
+
const mdl = PILL_MODEL[badge2.kind];
|
|
18968
|
+
const sec = PILL_SECTION.output;
|
|
18969
|
+
return /* @__PURE__ */ React42.createElement(Box35, { paddingLeft: HEADER_PAD2, flexDirection: "row" }, /* @__PURE__ */ React42.createElement(Pill, { label: "OUTPUT", bg: sec.bg, fg: sec.fg }), /* @__PURE__ */ React42.createElement(Text35, null, " "), /* @__PURE__ */ React42.createElement(Pill, { label: badge2.label, bg: mdl.bg, fg: mdl.fg }), /* @__PURE__ */ React42.createElement(Box35, { flexGrow: 1 }), /* @__PURE__ */ React42.createElement(Spinner, { kind: "braille", color: CARD.streaming.color }), /* @__PURE__ */ React42.createElement(Text35, { color: CARD.streaming.color }, " writing\u2026"));
|
|
18789
18970
|
}
|
|
18790
18971
|
|
|
18791
18972
|
// src/cli/ui/cards/SubAgentCard.tsx
|
|
18792
|
-
import { Box as
|
|
18793
|
-
import
|
|
18973
|
+
import { Box as Box36, Text as Text36 } from "ink";
|
|
18974
|
+
import React43 from "react";
|
|
18794
18975
|
var STATUS_COLOR2 = {
|
|
18795
18976
|
running: TONE.violet,
|
|
18796
18977
|
done: TONE.ok,
|
|
18797
18978
|
failed: TONE.err
|
|
18798
18979
|
};
|
|
18799
18980
|
function SubAgentCard({ card }) {
|
|
18800
|
-
return /* @__PURE__ */
|
|
18981
|
+
return /* @__PURE__ */ React43.createElement(Box36, { flexDirection: "column" }, /* @__PURE__ */ React43.createElement(
|
|
18801
18982
|
CardHeader,
|
|
18802
18983
|
{
|
|
18803
18984
|
tone: "subagent",
|
|
18804
18985
|
glyph: "\u232C",
|
|
18805
18986
|
title: `Sub-agent \xB7 ${card.name}`,
|
|
18806
|
-
trailing: /* @__PURE__ */
|
|
18987
|
+
trailing: /* @__PURE__ */ React43.createElement(Text36, { color: STATUS_COLOR2[card.status] }, card.status)
|
|
18807
18988
|
}
|
|
18808
|
-
), /* @__PURE__ */
|
|
18989
|
+
), /* @__PURE__ */ React43.createElement(BarRow, { tone: "subagent", indent: 0 }), /* @__PURE__ */ React43.createElement(BarRow, { tone: "subagent" }, /* @__PURE__ */ React43.createElement(Text36, { color: FG.faint }, "Task "), /* @__PURE__ */ React43.createElement(Text36, { color: FG.sub }, card.task)), card.tools && card.tools.length > 0 && /* @__PURE__ */ React43.createElement(BarRow, { tone: "subagent" }, /* @__PURE__ */ React43.createElement(Text36, { color: FG.faint }, "Tools "), /* @__PURE__ */ React43.createElement(Text36, { color: FG.sub }, card.tools.join(", "))), card.children.length > 0 && /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(BarRow, { tone: "subagent", indent: 0 }), /* @__PURE__ */ React43.createElement(BarRow, { tone: "subagent" }, /* @__PURE__ */ React43.createElement(Text36, { color: FG.meta }, "sub-agent stream")), card.children.map((child) => /* @__PURE__ */ React43.createElement(BarRow, { key: child.id, tone: "subagent" }, /* @__PURE__ */ React43.createElement(Text36, { color: CARD.subagent.color }, "\u258E "), /* @__PURE__ */ React43.createElement(ChildSummary, { card: child })))));
|
|
18809
18990
|
}
|
|
18810
18991
|
function ChildSummary({ card }) {
|
|
18811
18992
|
switch (card.kind) {
|
|
18812
18993
|
case "reasoning":
|
|
18813
|
-
return /* @__PURE__ */
|
|
18994
|
+
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(Text36, { color: CARD.reasoning.color }, "\u25C6 "), /* @__PURE__ */ React43.createElement(Text36, { italic: true, color: FG.meta }, `Reasoning \xB7 ${card.paragraphs} paragraph${card.paragraphs === 1 ? "" : "s"}`));
|
|
18814
18995
|
case "tool":
|
|
18815
|
-
return /* @__PURE__ */
|
|
18996
|
+
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(Text36, { color: CARD.tool.color }, "\u25A3 "), /* @__PURE__ */ React43.createElement(Text36, { bold: true, color: FG.body }, card.name), card.elapsedMs > 0 && /* @__PURE__ */ React43.createElement(Text36, { color: FG.faint }, ` ${(card.elapsedMs / 1e3).toFixed(2)}s`));
|
|
18816
18997
|
case "streaming":
|
|
18817
|
-
return /* @__PURE__ */
|
|
18998
|
+
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(Text36, { color: CARD.streaming.color }, "\u25B6 "), /* @__PURE__ */ React43.createElement(Text36, { color: card.done ? FG.sub : TONE.brand }, card.done ? "response" : "streaming response \u2026"));
|
|
18818
18999
|
case "diff":
|
|
18819
|
-
return /* @__PURE__ */
|
|
19000
|
+
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(Text36, { color: CARD.diff.color }, "\xB1 "), /* @__PURE__ */ React43.createElement(Text36, { color: FG.sub }, card.file));
|
|
18820
19001
|
case "error":
|
|
18821
|
-
return /* @__PURE__ */
|
|
19002
|
+
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(Text36, { color: CARD.error.color }, "\u2716 "), /* @__PURE__ */ React43.createElement(Text36, { color: FG.sub }, card.title));
|
|
18822
19003
|
default:
|
|
18823
|
-
return /* @__PURE__ */
|
|
19004
|
+
return /* @__PURE__ */ React43.createElement(Text36, { color: FG.faint }, `\xB7 ${card.kind}`);
|
|
18824
19005
|
}
|
|
18825
19006
|
}
|
|
18826
19007
|
|
|
18827
19008
|
// src/cli/ui/cards/TaskCard.tsx
|
|
18828
|
-
import { Box as
|
|
18829
|
-
import
|
|
19009
|
+
import { Box as Box37, Text as Text37 } from "ink";
|
|
19010
|
+
import React44 from "react";
|
|
18830
19011
|
var STEP_GLYPH = {
|
|
18831
19012
|
queued: "\u25CB",
|
|
18832
19013
|
running: "\u25B6",
|
|
@@ -18852,25 +19033,25 @@ var TASK_GLYPH = {
|
|
|
18852
19033
|
function TaskCard({ card }) {
|
|
18853
19034
|
const elapsed = `${(card.elapsedMs / 1e3).toFixed(1)}s`;
|
|
18854
19035
|
const showSteps = card.steps.length > 0;
|
|
18855
|
-
return /* @__PURE__ */
|
|
19036
|
+
return /* @__PURE__ */ React44.createElement(Box37, { flexDirection: "column" }, /* @__PURE__ */ React44.createElement(
|
|
18856
19037
|
CardHeader,
|
|
18857
19038
|
{
|
|
18858
19039
|
tone: "task",
|
|
18859
19040
|
glyph: TASK_GLYPH[card.status],
|
|
18860
19041
|
title: `Step ${card.index} of ${card.total} \xB7 ${card.title}`,
|
|
18861
19042
|
meta: `${elapsed} \xB7 `,
|
|
18862
|
-
trailing: /* @__PURE__ */
|
|
19043
|
+
trailing: /* @__PURE__ */ React44.createElement(Text37, { color: TASK_COLOR[card.status] }, card.status),
|
|
18863
19044
|
barColor: TASK_COLOR[card.status]
|
|
18864
19045
|
}
|
|
18865
|
-
), showSteps && /* @__PURE__ */
|
|
19046
|
+
), showSteps && /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(BarRow, { tone: "task", indent: 0 }), card.steps.map((step) => /* @__PURE__ */ React44.createElement(BarRow, { key: step.id, tone: "task" }, /* @__PURE__ */ React44.createElement(Text37, { color: STEP_COLOR[step.status] }, STEP_GLYPH[step.status]), /* @__PURE__ */ React44.createElement(Text37, { bold: true, color: FG.body }, ` ${(step.toolName ?? "step").padEnd(7)} `), /* @__PURE__ */ React44.createElement(Text37, { color: FG.sub }, step.title), step.detail && /* @__PURE__ */ React44.createElement(Text37, { color: FG.faint }, ` ${step.detail}`), step.elapsedMs !== void 0 && /* @__PURE__ */ React44.createElement(Text37, { color: FG.faint }, ` ${(step.elapsedMs / 1e3).toFixed(2)}s`)))));
|
|
18866
19047
|
}
|
|
18867
19048
|
|
|
18868
19049
|
// src/cli/ui/cards/ToolCard.tsx
|
|
18869
|
-
import { Box as
|
|
18870
|
-
import
|
|
19050
|
+
import { Box as Box38, Text as Text38, useStdout as useStdout9 } from "ink";
|
|
19051
|
+
import React45 from "react";
|
|
18871
19052
|
var READ_TAIL = 2;
|
|
18872
19053
|
var OTHER_TAIL = 5;
|
|
18873
|
-
var
|
|
19054
|
+
var BODY_INDENT_CELLS = 7;
|
|
18874
19055
|
function tailLinesFor(name) {
|
|
18875
19056
|
const lower = name.toLowerCase();
|
|
18876
19057
|
return /(?:^|_)(read|search|list|tree|get|status|diff|fetch|grep)(_|$)/.test(lower) || lower === "job_output" ? READ_TAIL : OTHER_TAIL;
|
|
@@ -18878,7 +19059,7 @@ function tailLinesFor(name) {
|
|
|
18878
19059
|
function ToolCard({ card }) {
|
|
18879
19060
|
const { stdout: stdout4 } = useStdout9();
|
|
18880
19061
|
const cols = stdout4?.columns ?? 80;
|
|
18881
|
-
const lineCells = Math.max(20, cols -
|
|
19062
|
+
const lineCells = Math.max(20, cols - BODY_INDENT_CELLS - 1);
|
|
18882
19063
|
const argsLabel = formatArgsSummary(card.args);
|
|
18883
19064
|
const meta = formatMeta(card);
|
|
18884
19065
|
const allLines = card.output.length > 0 ? card.output.split("\n") : [];
|
|
@@ -18888,7 +19069,7 @@ function ToolCard({ card }) {
|
|
|
18888
19069
|
const hidden = truncated ? allLines.length - visible.length : 0;
|
|
18889
19070
|
const errColor = card.exitCode && card.exitCode !== 0 ? CARD.error.color : FG.sub;
|
|
18890
19071
|
const showBody = visible.length > 0;
|
|
18891
|
-
return /* @__PURE__ */
|
|
19072
|
+
return /* @__PURE__ */ React45.createElement(Box38, { flexDirection: "column" }, /* @__PURE__ */ React45.createElement(
|
|
18892
19073
|
CardHeader,
|
|
18893
19074
|
{
|
|
18894
19075
|
tone: "tool",
|
|
@@ -18896,10 +19077,10 @@ function ToolCard({ card }) {
|
|
|
18896
19077
|
title: card.name,
|
|
18897
19078
|
subtitle: argsLabel || void 0,
|
|
18898
19079
|
meta: meta || void 0,
|
|
18899
|
-
inline: !card.done ? /* @__PURE__ */
|
|
18900
|
-
trailing: card.retry ? /* @__PURE__ */
|
|
19080
|
+
inline: !card.done ? /* @__PURE__ */ React45.createElement(Spinner, { kind: "braille", color: CARD.tool.color, bold: true }) : void 0,
|
|
19081
|
+
trailing: card.retry ? /* @__PURE__ */ React45.createElement(Text38, { color: TONE.warn, bold: true }, `\u21BB retry ${card.retry.attempt}/${card.retry.max}`) : void 0
|
|
18901
19082
|
}
|
|
18902
|
-
), showBody && /* @__PURE__ */
|
|
19083
|
+
), showBody && /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement(BarRow, { tone: "tool", indent: 0 }), hidden > 0 && /* @__PURE__ */ React45.createElement(BarRow, { tone: "tool" }, /* @__PURE__ */ React45.createElement(Text38, { color: FG.faint }, `\u22EE ${hidden} earlier line${hidden === 1 ? "" : "s"} (use /tool to read full)`)), visible.map((line, i) => /* @__PURE__ */ React45.createElement(BarRow, { key: `${card.id}:${hidden + i}`, tone: "tool" }, /* @__PURE__ */ React45.createElement(Text38, { color: errColor }, clipToCells(line, lineCells))))));
|
|
18903
19084
|
}
|
|
18904
19085
|
function formatArgsSummary(args) {
|
|
18905
19086
|
if (typeof args === "string") return args.length > 60 ? `${args.slice(0, 60)}\u2026` : args;
|
|
@@ -18931,8 +19112,8 @@ function formatMeta(card) {
|
|
|
18931
19112
|
}
|
|
18932
19113
|
|
|
18933
19114
|
// src/cli/ui/cards/UsageCard.tsx
|
|
18934
|
-
import { Box as
|
|
18935
|
-
import
|
|
19115
|
+
import { Box as Box39, Text as Text39 } from "ink";
|
|
19116
|
+
import React46 from "react";
|
|
18936
19117
|
var BAR_CELLS3 = 30;
|
|
18937
19118
|
function compactNum(n) {
|
|
18938
19119
|
if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
|
|
@@ -18942,32 +19123,32 @@ function compactNum(n) {
|
|
|
18942
19123
|
function bar(ratio, color2) {
|
|
18943
19124
|
const filled = Math.max(0, Math.min(BAR_CELLS3, Math.round(ratio * BAR_CELLS3)));
|
|
18944
19125
|
const empty = BAR_CELLS3 - filled;
|
|
18945
|
-
return /* @__PURE__ */
|
|
19126
|
+
return /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(Text39, { color: color2 }, "\u2588".repeat(filled)), /* @__PURE__ */ React46.createElement(Text39, { color: FG.faint }, "\u2591".repeat(empty)));
|
|
18946
19127
|
}
|
|
18947
19128
|
function UsageCard({ card }) {
|
|
18948
|
-
if (card.compact) return /* @__PURE__ */
|
|
19129
|
+
if (card.compact) return /* @__PURE__ */ React46.createElement(CompactUsageRow, { card });
|
|
18949
19130
|
const cap = Math.max(1, card.tokens.promptCap);
|
|
18950
19131
|
const promptRatio = card.tokens.prompt / cap;
|
|
18951
19132
|
const reasonRatio = card.tokens.reason / cap;
|
|
18952
19133
|
const outputRatio = card.tokens.output / cap;
|
|
18953
19134
|
const elapsed = card.elapsedMs !== void 0 ? ` \xB7 ${(card.elapsedMs / 1e3).toFixed(1)}s` : "";
|
|
18954
19135
|
const meta = `${formatCNY(card.cost)}${elapsed}`;
|
|
18955
|
-
return /* @__PURE__ */
|
|
19136
|
+
return /* @__PURE__ */ React46.createElement(Box39, { flexDirection: "column" }, /* @__PURE__ */ React46.createElement(CardHeader, { tone: "usage", glyph: "\u03A3", title: "Usage", subtitle: `turn ${card.turn}`, meta }), /* @__PURE__ */ React46.createElement(BarRow, { tone: "usage", indent: 0 }), /* @__PURE__ */ React46.createElement(BarRow, { tone: "usage" }, /* @__PURE__ */ React46.createElement(Text39, { color: FG.sub }, "prompt "), bar(promptRatio, TONE.brand), /* @__PURE__ */ React46.createElement(Text39, { bold: true, color: FG.body }, ` ${card.tokens.prompt.toLocaleString()}`), /* @__PURE__ */ React46.createElement(Text39, { color: FG.faint }, ` / 1M \xB7 ${(promptRatio * 100).toFixed(1)}%`)), /* @__PURE__ */ React46.createElement(BarRow, { tone: "usage" }, /* @__PURE__ */ React46.createElement(Text39, { color: FG.sub }, "reason "), bar(reasonRatio, TONE.accent), /* @__PURE__ */ React46.createElement(Text39, { bold: true, color: FG.body }, ` ${card.tokens.reason.toLocaleString()}`)), /* @__PURE__ */ React46.createElement(BarRow, { tone: "usage" }, /* @__PURE__ */ React46.createElement(Text39, { color: FG.sub }, "output "), bar(outputRatio, TONE.brand), /* @__PURE__ */ React46.createElement(Text39, { bold: true, color: FG.body }, ` ${card.tokens.output.toLocaleString()}`)), /* @__PURE__ */ React46.createElement(BarRow, { tone: "usage", indent: 0 }), /* @__PURE__ */ React46.createElement(BarRow, { tone: "usage" }, /* @__PURE__ */ React46.createElement(Text39, { color: FG.sub }, "cache hit "), bar(card.cacheHit, TONE.ok), /* @__PURE__ */ React46.createElement(Text39, { bold: true, color: TONE.ok }, ` ${(card.cacheHit * 100).toFixed(1)}%`)), /* @__PURE__ */ React46.createElement(BarRow, { tone: "usage", indent: 0 }), /* @__PURE__ */ React46.createElement(BarRow, { tone: "usage" }, /* @__PURE__ */ React46.createElement(Text39, { color: FG.faint }, "session "), /* @__PURE__ */ React46.createElement(Text39, { bold: true, color: FG.body }, `\u26C1 ${formatCNY(card.sessionCost, 3)}`), card.balance !== void 0 && /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(Text39, { color: FG.meta }, " \xB7 "), /* @__PURE__ */ React46.createElement(Text39, { color: FG.faint }, "balance "), /* @__PURE__ */ React46.createElement(Text39, { bold: true, color: TONE.brand }, `\xA5${card.balance.toFixed(2)}`))));
|
|
18956
19137
|
}
|
|
18957
19138
|
function CompactUsageRow({ card }) {
|
|
18958
19139
|
const elapsed = card.elapsedMs !== void 0 ? ` \xB7 ${(card.elapsedMs / 1e3).toFixed(1)}s` : "";
|
|
18959
|
-
return /* @__PURE__ */
|
|
18960
|
-
|
|
19140
|
+
return /* @__PURE__ */ React46.createElement(Box39, null, /* @__PURE__ */ React46.createElement(Text39, { color: FG.faint }, ` \u03A3 turn ${card.turn} \xB7 `), /* @__PURE__ */ React46.createElement(
|
|
19141
|
+
Text39,
|
|
18961
19142
|
{
|
|
18962
19143
|
color: FG.meta
|
|
18963
19144
|
},
|
|
18964
19145
|
`${compactNum(card.tokens.prompt)} prompt \xB7 ${compactNum(card.tokens.output)} out`
|
|
18965
|
-
), /* @__PURE__ */
|
|
19146
|
+
), /* @__PURE__ */ React46.createElement(Text39, { color: FG.faint }, " \xB7 cache "), /* @__PURE__ */ React46.createElement(Text39, { color: TONE.ok }, `${(card.cacheHit * 100).toFixed(0)}%`), /* @__PURE__ */ React46.createElement(Text39, { color: FG.faint }, ` \xB7 ${formatCNY(card.cost)}${elapsed}`), card.balance !== void 0 && /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(Text39, { color: FG.faint }, " \xB7 "), /* @__PURE__ */ React46.createElement(Text39, { color: TONE.brand }, `\xA5${card.balance.toFixed(2)}`)));
|
|
18966
19147
|
}
|
|
18967
19148
|
|
|
18968
19149
|
// src/cli/ui/cards/UserCard.tsx
|
|
18969
|
-
import { Box as
|
|
18970
|
-
import
|
|
19150
|
+
import { Box as Box40, Text as Text40 } from "ink";
|
|
19151
|
+
import React47 from "react";
|
|
18971
19152
|
|
|
18972
19153
|
// src/cli/ui/cards/time.ts
|
|
18973
19154
|
function formatRelativeTime(ts, now = Date.now()) {
|
|
@@ -18984,15 +19165,15 @@ function formatRelativeTime(ts, now = Date.now()) {
|
|
|
18984
19165
|
|
|
18985
19166
|
// src/cli/ui/cards/UserCard.tsx
|
|
18986
19167
|
function UserCard({ card }) {
|
|
18987
|
-
return /* @__PURE__ */
|
|
19168
|
+
return /* @__PURE__ */ React47.createElement(Box40, { flexDirection: "column" }, /* @__PURE__ */ React47.createElement(Box40, { flexDirection: "row" }, /* @__PURE__ */ React47.createElement(Text40, null, " "), /* @__PURE__ */ React47.createElement(Text40, { color: FG.meta }, "\u25C7"), /* @__PURE__ */ React47.createElement(Text40, { bold: true, color: FG.sub }, " you"), /* @__PURE__ */ React47.createElement(Text40, { color: FG.faint }, ` \xB7 ${formatRelativeTime(card.ts)}`)), /* @__PURE__ */ React47.createElement(Box40, { flexDirection: "column", paddingLeft: 4 }, /* @__PURE__ */ React47.createElement(Markdown, { text: card.text })));
|
|
18988
19169
|
}
|
|
18989
19170
|
|
|
18990
19171
|
// src/cli/ui/cards/WarnCard.tsx
|
|
18991
|
-
import { Box as
|
|
18992
|
-
import
|
|
19172
|
+
import { Box as Box41, Text as Text41 } from "ink";
|
|
19173
|
+
import React48 from "react";
|
|
18993
19174
|
function WarnCard({ card }) {
|
|
18994
19175
|
const showBody = card.message.length > 0;
|
|
18995
|
-
return /* @__PURE__ */
|
|
19176
|
+
return /* @__PURE__ */ React48.createElement(Box41, { flexDirection: "column" }, /* @__PURE__ */ React48.createElement(
|
|
18996
19177
|
CardHeader,
|
|
18997
19178
|
{
|
|
18998
19179
|
tone: "warn",
|
|
@@ -19000,60 +19181,57 @@ function WarnCard({ card }) {
|
|
|
19000
19181
|
title: card.title,
|
|
19001
19182
|
meta: card.detail ? `\xB7 ${card.detail}` : void 0
|
|
19002
19183
|
}
|
|
19003
|
-
), showBody && /* @__PURE__ */
|
|
19184
|
+
), showBody && /* @__PURE__ */ React48.createElement(React48.Fragment, null, /* @__PURE__ */ React48.createElement(BarRow, { tone: "warn", indent: 0 }), card.message.split("\n").map((line, i) => /* @__PURE__ */ React48.createElement(BarRow, { key: `${card.id}:${i}`, tone: "warn" }, /* @__PURE__ */ React48.createElement(Text41, { color: FG.body }, line)))));
|
|
19004
19185
|
}
|
|
19005
19186
|
|
|
19006
19187
|
// src/cli/ui/cards/CardRenderer.tsx
|
|
19007
19188
|
function CardRenderer({ card }) {
|
|
19008
|
-
|
|
19009
|
-
(s) => s.cards.some((c) => c.kind === "streaming" && c.text.length > 0 && !c.done)
|
|
19010
|
-
);
|
|
19011
|
-
return /* @__PURE__ */ React47.createElement(Box41, { flexDirection: "column", marginTop: 1 }, renderCard(card, contentStreaming));
|
|
19189
|
+
return /* @__PURE__ */ React49.createElement(Box42, { flexDirection: "column", marginTop: 1 }, renderCard(card));
|
|
19012
19190
|
}
|
|
19013
|
-
function renderCard(card
|
|
19191
|
+
function renderCard(card) {
|
|
19014
19192
|
switch (card.kind) {
|
|
19015
19193
|
case "user":
|
|
19016
|
-
return /* @__PURE__ */
|
|
19194
|
+
return /* @__PURE__ */ React49.createElement(UserCard, { card });
|
|
19017
19195
|
case "reasoning":
|
|
19018
|
-
return /* @__PURE__ */
|
|
19196
|
+
return /* @__PURE__ */ React49.createElement(ReasoningCard, { card, expanded: true });
|
|
19019
19197
|
case "streaming":
|
|
19020
|
-
return /* @__PURE__ */
|
|
19198
|
+
return /* @__PURE__ */ React49.createElement(StreamingCard, { card });
|
|
19021
19199
|
case "tool":
|
|
19022
|
-
return /* @__PURE__ */
|
|
19200
|
+
return /* @__PURE__ */ React49.createElement(ToolCard, { card });
|
|
19023
19201
|
case "task":
|
|
19024
|
-
return /* @__PURE__ */
|
|
19202
|
+
return /* @__PURE__ */ React49.createElement(TaskCard, { card });
|
|
19025
19203
|
case "plan":
|
|
19026
|
-
return /* @__PURE__ */
|
|
19204
|
+
return /* @__PURE__ */ React49.createElement(PlanCard, { card });
|
|
19027
19205
|
case "diff":
|
|
19028
|
-
return /* @__PURE__ */
|
|
19206
|
+
return /* @__PURE__ */ React49.createElement(DiffCard, { card });
|
|
19029
19207
|
case "error":
|
|
19030
|
-
return /* @__PURE__ */
|
|
19208
|
+
return /* @__PURE__ */ React49.createElement(ErrorCard, { card });
|
|
19031
19209
|
case "warn":
|
|
19032
|
-
return /* @__PURE__ */
|
|
19210
|
+
return /* @__PURE__ */ React49.createElement(WarnCard, { card });
|
|
19033
19211
|
case "usage":
|
|
19034
|
-
return /* @__PURE__ */
|
|
19212
|
+
return /* @__PURE__ */ React49.createElement(UsageCard, { card });
|
|
19035
19213
|
case "memory":
|
|
19036
|
-
return /* @__PURE__ */
|
|
19214
|
+
return /* @__PURE__ */ React49.createElement(MemoryCard, { card });
|
|
19037
19215
|
case "subagent":
|
|
19038
|
-
return /* @__PURE__ */
|
|
19216
|
+
return /* @__PURE__ */ React49.createElement(SubAgentCard, { card });
|
|
19039
19217
|
case "search":
|
|
19040
|
-
return /* @__PURE__ */
|
|
19218
|
+
return /* @__PURE__ */ React49.createElement(SearchCard, { card });
|
|
19041
19219
|
case "approval":
|
|
19042
|
-
return /* @__PURE__ */
|
|
19220
|
+
return /* @__PURE__ */ React49.createElement(FallbackCard, { card });
|
|
19043
19221
|
case "live":
|
|
19044
|
-
return /* @__PURE__ */
|
|
19222
|
+
return /* @__PURE__ */ React49.createElement(LiveCard, { card });
|
|
19045
19223
|
case "ctx":
|
|
19046
|
-
return /* @__PURE__ */
|
|
19224
|
+
return /* @__PURE__ */ React49.createElement(CtxCard, { card });
|
|
19047
19225
|
case "doctor":
|
|
19048
|
-
return /* @__PURE__ */
|
|
19226
|
+
return /* @__PURE__ */ React49.createElement(DoctorCard, { card });
|
|
19049
19227
|
case "branch":
|
|
19050
|
-
return /* @__PURE__ */
|
|
19228
|
+
return /* @__PURE__ */ React49.createElement(BranchCard, { card });
|
|
19051
19229
|
default:
|
|
19052
|
-
return /* @__PURE__ */
|
|
19230
|
+
return /* @__PURE__ */ React49.createElement(FallbackCard, { card });
|
|
19053
19231
|
}
|
|
19054
19232
|
}
|
|
19055
19233
|
function FallbackCard({ card }) {
|
|
19056
|
-
return /* @__PURE__ */
|
|
19234
|
+
return /* @__PURE__ */ React49.createElement(Box42, { flexDirection: "row" }, /* @__PURE__ */ React49.createElement(Text42, { color: FG.faint }, ` \xB7 ${card.kind} card \xB7 not yet migrated`));
|
|
19057
19235
|
}
|
|
19058
19236
|
|
|
19059
19237
|
// src/cli/ui/layout/CardStream.tsx
|
|
@@ -19084,16 +19262,16 @@ function CardStream({ excludeId } = {}) {
|
|
|
19084
19262
|
}
|
|
19085
19263
|
const committed = filtered.slice(0, cutoff);
|
|
19086
19264
|
const live = filtered.slice(cutoff);
|
|
19087
|
-
return /* @__PURE__ */
|
|
19265
|
+
return /* @__PURE__ */ React50.createElement(React50.Fragment, null, /* @__PURE__ */ React50.createElement(Static, { items: committed }, (card) => /* @__PURE__ */ React50.createElement(CardRenderer, { key: card.id, card })), live.map((card) => /* @__PURE__ */ React50.createElement(CardRenderer, { key: card.id, card })));
|
|
19088
19266
|
}
|
|
19089
19267
|
|
|
19090
19268
|
// src/cli/ui/layout/LiveRows.tsx
|
|
19091
|
-
import { Box as
|
|
19092
|
-
import
|
|
19269
|
+
import { Box as Box43, Text as Text43, useStdout as useStdout10 } from "ink";
|
|
19270
|
+
import React51 from "react";
|
|
19093
19271
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
19094
19272
|
function ThinkingRow({ text }) {
|
|
19095
19273
|
const elapsed = useElapsedSeconds();
|
|
19096
|
-
return /* @__PURE__ */
|
|
19274
|
+
return /* @__PURE__ */ React51.createElement(Box43, { marginY: 1, paddingX: 1 }, /* @__PURE__ */ React51.createElement(Spinner, { kind: "circle", color: TONE.brand, bold: true }), /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: TONE.brand }, text), /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, ` \xB7 ${elapsed}s`));
|
|
19097
19275
|
}
|
|
19098
19276
|
function ModeStatusBar({
|
|
19099
19277
|
editMode,
|
|
@@ -19105,27 +19283,27 @@ function ModeStatusBar({
|
|
|
19105
19283
|
}) {
|
|
19106
19284
|
useSlowTick();
|
|
19107
19285
|
const running = jobs2?.runningCount() ?? 0;
|
|
19108
|
-
const jobsTag = running > 0 ? /* @__PURE__ */
|
|
19286
|
+
const jobsTag = running > 0 ? /* @__PURE__ */ React51.createElement(Text43, { color: TONE.warn, bold: true }, ` \xB7 \u23F5 ${running} job${running === 1 ? "" : "s"}`) : null;
|
|
19109
19287
|
if (planMode) {
|
|
19110
|
-
return /* @__PURE__ */
|
|
19288
|
+
return /* @__PURE__ */ React51.createElement(ModeBarFrame, null, /* @__PURE__ */ React51.createElement(ModePill, { label: "PLAN MODE", color: TONE.err, flash }), /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, " writes gated \xB7 /plan off to leave"), jobsTag);
|
|
19111
19289
|
}
|
|
19112
19290
|
const label = editMode === "yolo" ? "YOLO" : editMode === "auto" ? "AUTO" : "REVIEW";
|
|
19113
19291
|
const pillColor = editMode === "yolo" ? TONE.err : editMode === "auto" ? TONE.accent : TONE.brand;
|
|
19114
19292
|
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";
|
|
19115
|
-
return /* @__PURE__ */
|
|
19293
|
+
return /* @__PURE__ */ React51.createElement(ModeBarFrame, null, /* @__PURE__ */ React51.createElement(ModePill, { label, color: pillColor, flash }), /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, ` ${mid} \xB7 Shift+Tab to flip`), jobsTag);
|
|
19116
19294
|
}
|
|
19117
19295
|
function ModeBarFrame({ children }) {
|
|
19118
19296
|
const { stdout: stdout4 } = useStdout10();
|
|
19119
19297
|
const cols = stdout4?.columns ?? 80;
|
|
19120
19298
|
const ruleWidth = Math.max(20, cols - 2);
|
|
19121
|
-
return /* @__PURE__ */
|
|
19299
|
+
return /* @__PURE__ */ React51.createElement(Box43, { flexDirection: "column" }, /* @__PURE__ */ React51.createElement(Box43, { paddingX: 1 }, /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, "\u254C".repeat(ruleWidth))), /* @__PURE__ */ React51.createElement(Box43, { paddingX: 1 }, children));
|
|
19122
19300
|
}
|
|
19123
19301
|
function ModePill({
|
|
19124
19302
|
label,
|
|
19125
19303
|
color: color2,
|
|
19126
19304
|
flash
|
|
19127
19305
|
}) {
|
|
19128
|
-
return /* @__PURE__ */
|
|
19306
|
+
return /* @__PURE__ */ React51.createElement(Text43, { color: color2, bold: true, inverse: flash }, `[${label}]`);
|
|
19129
19307
|
}
|
|
19130
19308
|
function UndoBanner({
|
|
19131
19309
|
banner
|
|
@@ -19139,7 +19317,7 @@ function UndoBanner({
|
|
|
19139
19317
|
const urgent = remainingSec <= 1;
|
|
19140
19318
|
const pct2 = remainingMs / totalMs * 100;
|
|
19141
19319
|
const tone = urgent ? TONE.err : TONE.accent;
|
|
19142
|
-
return /* @__PURE__ */
|
|
19320
|
+
return /* @__PURE__ */ React51.createElement(Box43, { marginY: 1, paddingX: 1 }, /* @__PURE__ */ React51.createElement(Text43, { backgroundColor: TONE.accent, color: "black", bold: true }, ` \u2713 AUTO-APPLIED ${ok}/${total} `), /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, " press "), /* @__PURE__ */ React51.createElement(Text43, { backgroundColor: TONE.brand, color: "black", bold: true }, " u "), /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, " to undo "), /* @__PURE__ */ React51.createElement(CharBar, { pct: pct2, width: 20, color: tone, showLabel: false }), /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, " "), /* @__PURE__ */ React51.createElement(Text43, { color: tone, bold: urgent }, `${remainingSec}s`));
|
|
19143
19321
|
}
|
|
19144
19322
|
function subagentPhaseLabel(phase, iter, elapsedMs) {
|
|
19145
19323
|
if (phase === "summarising") return "summarising findings\u2026";
|
|
@@ -19159,7 +19337,7 @@ function SubagentRow({
|
|
|
19159
19337
|
const seconds = (activity.elapsedMs / 1e3).toFixed(1);
|
|
19160
19338
|
const phase = subagentPhaseLabel(activity.phase, activity.iter, activity.elapsedMs);
|
|
19161
19339
|
const last = activity.lastInner;
|
|
19162
|
-
return /* @__PURE__ */
|
|
19340
|
+
return /* @__PURE__ */ React51.createElement(Box43, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React51.createElement(Box43, null, /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.subagent.color }, "\u258E "), /* @__PURE__ */ React51.createElement(Text43, { bold: true, color: CARD.subagent.color }, `\u232C ${subagentTitle(activity.skillName, activity.task)}`), /* @__PURE__ */ React51.createElement(Box43, { flexGrow: 1 }), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.subagent.color }, `iter ${activity.iter} \xB7 ${seconds}s`), /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.subagent.color, bold: true }, SPINNER_FRAMES[tick % SPINNER_FRAMES.length])), /* @__PURE__ */ React51.createElement(Box43, null, /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.subagent.color }, "\u258E")), /* @__PURE__ */ React51.createElement(Box43, null, /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.subagent.color }, "\u258E "), /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, "Task "), /* @__PURE__ */ React51.createElement(Text43, { color: FG.sub }, activity.task)), /* @__PURE__ */ React51.createElement(Box43, null, /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.subagent.color }, "\u258E "), /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, "Model "), /* @__PURE__ */ React51.createElement(Text43, { color: FG.sub }, activity.model ?? "\u2014")), /* @__PURE__ */ React51.createElement(Box43, null, /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.subagent.color }, "\u258E")), /* @__PURE__ */ React51.createElement(Box43, null, /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.subagent.color }, "\u258E "), /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, "Last "), last ? /* @__PURE__ */ React51.createElement(React51.Fragment, null, /* @__PURE__ */ React51.createElement(Text43, { color: last.color }, `${last.glyph} `), /* @__PURE__ */ React51.createElement(Text43, { color: FG.body }, last.label), last.meta ? /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, ` ${last.meta}`) : null) : /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, "queued\u2026")), /* @__PURE__ */ React51.createElement(Box43, null, /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.subagent.color }, "\u258E")), /* @__PURE__ */ React51.createElement(Box43, null, /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.subagent.color }, "\u258E "), /* @__PURE__ */ React51.createElement(Text43, { bold: true, color: TONE.brand }, "\u25B6 "), /* @__PURE__ */ React51.createElement(Text43, { color: TONE.brand }, phase)));
|
|
19163
19341
|
}
|
|
19164
19342
|
function OngoingToolRow({
|
|
19165
19343
|
tool: tool2,
|
|
@@ -19168,7 +19346,7 @@ function OngoingToolRow({
|
|
|
19168
19346
|
const tick = useTick();
|
|
19169
19347
|
const elapsed = useElapsedSeconds();
|
|
19170
19348
|
const summary = summarizeToolArgs(tool2.name, tool2.args);
|
|
19171
|
-
return /* @__PURE__ */
|
|
19349
|
+
return /* @__PURE__ */ React51.createElement(Box43, { marginY: 1, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React51.createElement(Box43, null, /* @__PURE__ */ React51.createElement(Text43, { color: CARD.tool.color, bold: true }, SPINNER_FRAMES[tick % SPINNER_FRAMES.length]), /* @__PURE__ */ React51.createElement(Text43, null, " "), /* @__PURE__ */ React51.createElement(Text43, { color: CARD.tool.color, bold: true }, `\u25A3 ${tool2.name}`), /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, ` running \xB7 ${elapsed}s`)), progress ? /* @__PURE__ */ React51.createElement(Box43, { paddingLeft: 3 }, /* @__PURE__ */ React51.createElement(Text43, { color: TONE.brand }, renderProgressLine(progress))) : null, summary ? /* @__PURE__ */ React51.createElement(Box43, { paddingLeft: 3 }, /* @__PURE__ */ React51.createElement(Text43, { color: FG.faint }, summary)) : null);
|
|
19172
19350
|
}
|
|
19173
19351
|
function renderProgressLine(p) {
|
|
19174
19352
|
const msg = p.message ? ` ${p.message}` : "";
|
|
@@ -19224,8 +19402,8 @@ function summarizeToolArgs(name, args) {
|
|
|
19224
19402
|
}
|
|
19225
19403
|
|
|
19226
19404
|
// src/cli/ui/layout/SidebarPanel.tsx
|
|
19227
|
-
import { Box as
|
|
19228
|
-
import
|
|
19405
|
+
import { Box as Box44, Text as Text44 } from "ink";
|
|
19406
|
+
import React52 from "react";
|
|
19229
19407
|
var SIDEBAR_WIDTH = 28;
|
|
19230
19408
|
var SIDEBAR_MIN_TOTAL_COLS = 88;
|
|
19231
19409
|
function SidebarPanel({
|
|
@@ -19235,7 +19413,7 @@ function SidebarPanel({
|
|
|
19235
19413
|
const cards = useAgentState((s) => s.cards);
|
|
19236
19414
|
const activePlan = findActivePlan(cards);
|
|
19237
19415
|
if (!activePlan) return null;
|
|
19238
|
-
return /* @__PURE__ */
|
|
19416
|
+
return /* @__PURE__ */ React52.createElement(Box44, { flexDirection: "column", width: SIDEBAR_WIDTH, marginLeft: 1, paddingX: 1 }, /* @__PURE__ */ React52.createElement(PlanSection, { card: activePlan }), ongoingTool || subagentActivity ? /* @__PURE__ */ React52.createElement(RunningSection, { tool: ongoingTool, subagent: subagentActivity }) : null);
|
|
19239
19417
|
}
|
|
19240
19418
|
function findActivePlan(cards) {
|
|
19241
19419
|
for (let i = cards.length - 1; i >= 0; i--) {
|
|
@@ -19247,11 +19425,11 @@ function findActivePlan(cards) {
|
|
|
19247
19425
|
return null;
|
|
19248
19426
|
}
|
|
19249
19427
|
function SectionHeader({ glyph, title, tone }) {
|
|
19250
|
-
return /* @__PURE__ */
|
|
19428
|
+
return /* @__PURE__ */ React52.createElement(Box44, { marginBottom: 0 }, /* @__PURE__ */ React52.createElement(Text44, { color: tone, bold: true }, `${glyph} ${title}`));
|
|
19251
19429
|
}
|
|
19252
19430
|
function Divider() {
|
|
19253
|
-
return /* @__PURE__ */
|
|
19254
|
-
|
|
19431
|
+
return /* @__PURE__ */ React52.createElement(
|
|
19432
|
+
Box44,
|
|
19255
19433
|
{
|
|
19256
19434
|
borderStyle: "single",
|
|
19257
19435
|
borderTop: true,
|
|
@@ -19267,21 +19445,21 @@ function PlanSection({ card }) {
|
|
|
19267
19445
|
const done = card.steps.filter((s) => s.status === "done" || s.status === "skipped").length;
|
|
19268
19446
|
const runningIdx = card.steps.findIndex((s) => s.status === "running");
|
|
19269
19447
|
const visible = windowSteps(card.steps, runningIdx, 5);
|
|
19270
|
-
return /* @__PURE__ */
|
|
19448
|
+
return /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement(
|
|
19271
19449
|
SectionHeader,
|
|
19272
19450
|
{
|
|
19273
19451
|
glyph: CARD.plan.glyph,
|
|
19274
19452
|
title: `Plan ${done}/${total}`,
|
|
19275
19453
|
tone: CARD.plan.color
|
|
19276
19454
|
}
|
|
19277
|
-
), /* @__PURE__ */
|
|
19455
|
+
), /* @__PURE__ */ React52.createElement(Divider, null), visible.kind === "all" ? null : /* @__PURE__ */ React52.createElement(Text44, { color: FG.faint }, `(${visible.hidden} earlier hidden)`), visible.steps.map((s, i) => /* @__PURE__ */ React52.createElement(StepRow, { key: s.id, step: s, index: visible.startIndex + i })), visible.kind === "windowed" && visible.hiddenAfter > 0 ? /* @__PURE__ */ React52.createElement(Text44, { color: FG.faint }, `(${visible.hiddenAfter} more)`) : null);
|
|
19278
19456
|
}
|
|
19279
19457
|
function StepRow({ step, index }) {
|
|
19280
19458
|
const glyph = STATUS_GLYPH2[step.status];
|
|
19281
19459
|
const color2 = STATUS_COLOR3[step.status];
|
|
19282
19460
|
const num = `${index + 1}.`;
|
|
19283
19461
|
const truncated = truncate3(step.title, SIDEBAR_WIDTH - 6);
|
|
19284
|
-
return /* @__PURE__ */
|
|
19462
|
+
return /* @__PURE__ */ React52.createElement(Box44, null, /* @__PURE__ */ React52.createElement(Text44, { color: color2 }, glyph), /* @__PURE__ */ React52.createElement(Text44, { color: step.status === "running" ? FG.strong : FG.sub }, ` ${num} ${truncated}`));
|
|
19285
19463
|
}
|
|
19286
19464
|
var STATUS_GLYPH2 = {
|
|
19287
19465
|
queued: " ",
|
|
@@ -19303,7 +19481,7 @@ function RunningSection({
|
|
|
19303
19481
|
tool: tool2,
|
|
19304
19482
|
subagent
|
|
19305
19483
|
}) {
|
|
19306
|
-
return /* @__PURE__ */
|
|
19484
|
+
return /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement(Box44, { marginTop: 1 }, /* @__PURE__ */ React52.createElement(Text44, { color: TONE.info, bold: true }, "\u25D0 Running")), /* @__PURE__ */ React52.createElement(Divider, null), tool2 ? /* @__PURE__ */ React52.createElement(Box44, null, /* @__PURE__ */ React52.createElement(Text44, { color: CARD.tool.color }, CARD.tool.glyph), /* @__PURE__ */ React52.createElement(Text44, { color: FG.body }, ` ${truncate3(tool2.name, SIDEBAR_WIDTH - 4)}`)) : null, subagent ? /* @__PURE__ */ React52.createElement(Box44, null, /* @__PURE__ */ React52.createElement(Text44, { color: CARD.subagent.color }, CARD.subagent.glyph), /* @__PURE__ */ React52.createElement(Text44, { color: FG.body }, ` ${truncate3(subagent.task, SIDEBAR_WIDTH - 4)}`)) : null);
|
|
19307
19485
|
}
|
|
19308
19486
|
function truncate3(s, max) {
|
|
19309
19487
|
if (s.length <= max) return s;
|
|
@@ -19327,16 +19505,16 @@ function windowSteps(steps, focusIdx, padding) {
|
|
|
19327
19505
|
}
|
|
19328
19506
|
|
|
19329
19507
|
// src/cli/ui/layout/StatusRow.tsx
|
|
19330
|
-
import { Box as
|
|
19331
|
-
import
|
|
19508
|
+
import { Box as Box45, Text as Text46, useStdout as useStdout11 } from "ink";
|
|
19509
|
+
import React54 from "react";
|
|
19332
19510
|
|
|
19333
19511
|
// src/cli/ui/primitives/Countdown.tsx
|
|
19334
|
-
import { Text as
|
|
19335
|
-
import
|
|
19512
|
+
import { Text as Text45 } from "ink";
|
|
19513
|
+
import React53 from "react";
|
|
19336
19514
|
function Countdown({ endsAt, color: color2 = TONE.brand }) {
|
|
19337
19515
|
useSlowTick();
|
|
19338
19516
|
const remainingSec = Math.max(0, Math.ceil((endsAt - Date.now()) / 1e3));
|
|
19339
|
-
return /* @__PURE__ */
|
|
19517
|
+
return /* @__PURE__ */ React53.createElement(Text45, { bold: true, color: color2 }, String(remainingSec));
|
|
19340
19518
|
}
|
|
19341
19519
|
|
|
19342
19520
|
// src/cli/ui/layout/StatusRow.tsx
|
|
@@ -19356,7 +19534,7 @@ function StatusRow() {
|
|
|
19356
19534
|
const turnCny = status3.cost * USD_TO_CNY;
|
|
19357
19535
|
const sessionCny = status3.sessionCost * USD_TO_CNY;
|
|
19358
19536
|
const hasTurn = status3.cost > 0;
|
|
19359
|
-
return /* @__PURE__ */
|
|
19537
|
+
return /* @__PURE__ */ React54.createElement(Box45, { flexDirection: "column" }, /* @__PURE__ */ React54.createElement(Box45, null, /* @__PURE__ */ React54.createElement(Text46, null, " "), /* @__PURE__ */ React54.createElement(Text46, { color: FG.faint }, "\u2500".repeat(ruleWidth))), /* @__PURE__ */ React54.createElement(Box45, { flexDirection: "row" }, /* @__PURE__ */ React54.createElement(Text46, null, " "), status3.recording ? /* @__PURE__ */ React54.createElement(RecordingPill, { rec: status3.recording }) : status3.countdownSeconds !== void 0 ? /* @__PURE__ */ React54.createElement(CountdownRow, { mode: status3.mode, secondsLeft: status3.countdownSeconds }) : /* @__PURE__ */ React54.createElement(ModePill2, { mode: status3.mode, network: status3.network, detail: status3.networkDetail }), /* @__PURE__ */ React54.createElement(Sep, null), /* @__PURE__ */ React54.createElement(Text46, { color: FG.sub }, `${session.id} \xB7 ${session.branch}`), hasTurn && /* @__PURE__ */ React54.createElement(React54.Fragment, null, /* @__PURE__ */ React54.createElement(Sep, null), /* @__PURE__ */ React54.createElement(Text46, { bold: true, color: TONE.brand }, "\u25B8 "), /* @__PURE__ */ React54.createElement(Text46, { bold: true, color: FG.body }, `\xA5${turnCny.toFixed(4)} turn`)), /* @__PURE__ */ React54.createElement(Sep, null), /* @__PURE__ */ React54.createElement(Text46, { color: FG.sub }, `\xA5${sessionCny.toFixed(3)} session`), status3.balance !== void 0 && /* @__PURE__ */ React54.createElement(React54.Fragment, null, /* @__PURE__ */ React54.createElement(Sep, null), /* @__PURE__ */ React54.createElement(Text46, { color: FG.faint }, "wallet "), /* @__PURE__ */ React54.createElement(Text46, { bold: true, color: balanceColor(status3.balance) }, `\xA5${status3.balance.toFixed(2)}`)), /* @__PURE__ */ React54.createElement(Sep, null), /* @__PURE__ */ React54.createElement(Text46, { color: TONE.accent }, `cache ${Math.round(status3.cacheHit * 100)}%`)));
|
|
19360
19538
|
}
|
|
19361
19539
|
function ModePill2({
|
|
19362
19540
|
mode: mode2,
|
|
@@ -19365,18 +19543,18 @@ function ModePill2({
|
|
|
19365
19543
|
}) {
|
|
19366
19544
|
if (network === "online") {
|
|
19367
19545
|
const pill = modeGlyph(mode2);
|
|
19368
|
-
return /* @__PURE__ */
|
|
19546
|
+
return /* @__PURE__ */ React54.createElement(Box45, { flexDirection: "row" }, /* @__PURE__ */ React54.createElement(Text46, { color: pill.color }, pill.glyph), /* @__PURE__ */ React54.createElement(Text46, { color: FG.sub }, ` ${mode2}`));
|
|
19369
19547
|
}
|
|
19370
19548
|
const dot2 = networkDot(network);
|
|
19371
19549
|
if (network === "slow") {
|
|
19372
19550
|
const tail = detail ? ` \xB7 ${detail}` : "";
|
|
19373
|
-
return /* @__PURE__ */
|
|
19551
|
+
return /* @__PURE__ */ React54.createElement(Box45, { flexDirection: "row" }, /* @__PURE__ */ React54.createElement(Text46, { color: dot2.color }, dot2.glyph), /* @__PURE__ */ React54.createElement(Text46, { color: dot2.color }, ` ${mode2} \xB7 slow${tail}`));
|
|
19374
19552
|
}
|
|
19375
19553
|
if (network === "disconnected") {
|
|
19376
19554
|
const tail = detail ? ` \xB7 ${detail}` : "";
|
|
19377
|
-
return /* @__PURE__ */
|
|
19555
|
+
return /* @__PURE__ */ React54.createElement(Box45, { flexDirection: "row" }, /* @__PURE__ */ React54.createElement(Text46, { color: dot2.color }, dot2.glyph), /* @__PURE__ */ React54.createElement(Text46, { color: dot2.color }, ` disconnect${tail}`));
|
|
19378
19556
|
}
|
|
19379
|
-
return /* @__PURE__ */
|
|
19557
|
+
return /* @__PURE__ */ React54.createElement(Box45, { flexDirection: "row" }, /* @__PURE__ */ React54.createElement(Text46, { color: dot2.color }, dot2.glyph), /* @__PURE__ */ React54.createElement(Text46, { color: dot2.color }, " reconnecting\u2026"));
|
|
19380
19558
|
}
|
|
19381
19559
|
function CountdownRow({
|
|
19382
19560
|
mode: mode2,
|
|
@@ -19384,14 +19562,14 @@ function CountdownRow({
|
|
|
19384
19562
|
}) {
|
|
19385
19563
|
const pill = modeGlyph(mode2);
|
|
19386
19564
|
const endsAt = Date.now() + secondsLeft * 1e3;
|
|
19387
|
-
return /* @__PURE__ */
|
|
19565
|
+
return /* @__PURE__ */ React54.createElement(Box45, { flexDirection: "row" }, /* @__PURE__ */ React54.createElement(Text46, { color: pill.color }, pill.glyph), /* @__PURE__ */ React54.createElement(Text46, { color: FG.sub }, ` ${mode2} \xB7 `), /* @__PURE__ */ React54.createElement(Text46, { color: TONE.warn }, "approving in "), /* @__PURE__ */ React54.createElement(Countdown, { endsAt }), /* @__PURE__ */ React54.createElement(Text46, { color: TONE.warn }, "s \xB7 esc to interrupt"));
|
|
19388
19566
|
}
|
|
19389
19567
|
function RecordingPill({ rec }) {
|
|
19390
19568
|
const sizeMb = (rec.sizeBytes / (1024 * 1024)).toFixed(1);
|
|
19391
|
-
return /* @__PURE__ */
|
|
19569
|
+
return /* @__PURE__ */ React54.createElement(Box45, { flexDirection: "row" }, /* @__PURE__ */ React54.createElement(Text46, { bold: true, color: TONE.err }, "\u25CFREC"), /* @__PURE__ */ React54.createElement(Text46, { color: TONE.err }, ` ${sizeMb} MB \xB7 ${rec.events} evt`));
|
|
19392
19570
|
}
|
|
19393
19571
|
function Sep() {
|
|
19394
|
-
return /* @__PURE__ */
|
|
19572
|
+
return /* @__PURE__ */ React54.createElement(Text46, { color: FG.meta }, " \xB7 ");
|
|
19395
19573
|
}
|
|
19396
19574
|
function modeGlyph(mode2) {
|
|
19397
19575
|
switch (mode2) {
|
|
@@ -19419,8 +19597,8 @@ function networkDot(state) {
|
|
|
19419
19597
|
}
|
|
19420
19598
|
|
|
19421
19599
|
// src/cli/ui/layout/ToastRail.tsx
|
|
19422
|
-
import { Box as
|
|
19423
|
-
import
|
|
19600
|
+
import { Box as Box46, Text as Text47, useStdout as useStdout12 } from "ink";
|
|
19601
|
+
import React55, { useEffect as useEffect4 } from "react";
|
|
19424
19602
|
var TONE_COLOR = {
|
|
19425
19603
|
ok: TONE.ok,
|
|
19426
19604
|
info: TONE.brand,
|
|
@@ -19458,12 +19636,12 @@ function ToastRail() {
|
|
|
19458
19636
|
}, [toasts, dispatch2]);
|
|
19459
19637
|
const visible = toasts.filter((t2) => now - t2.bornAt < t2.ttlMs);
|
|
19460
19638
|
if (visible.length === 0) return null;
|
|
19461
|
-
return /* @__PURE__ */
|
|
19639
|
+
return /* @__PURE__ */ React55.createElement(Box46, { flexDirection: "column" }, visible.map((t2) => {
|
|
19462
19640
|
const color2 = TONE_COLOR[t2.tone];
|
|
19463
19641
|
const glyph = TONE_GLYPH[t2.tone];
|
|
19464
19642
|
const body = bodyColor(t2, now);
|
|
19465
19643
|
const remainingSec = Math.max(0, Math.ceil((t2.ttlMs - (now - t2.bornAt)) / 1e3));
|
|
19466
|
-
return /* @__PURE__ */
|
|
19644
|
+
return /* @__PURE__ */ React55.createElement(Box46, { key: t2.id, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React55.createElement(Text47, { color: color2 }, rule), /* @__PURE__ */ React55.createElement(Box46, { flexDirection: "row" }, /* @__PURE__ */ React55.createElement(Text47, { color: color2 }, glyph), /* @__PURE__ */ React55.createElement(Text47, { bold: true, color: body }, ` ${t2.title}`), t2.detail !== void 0 && /* @__PURE__ */ React55.createElement(Text47, { color: FG.sub }, ` \xB7 ${t2.detail}`), /* @__PURE__ */ React55.createElement(Box46, { flexGrow: 1 }), /* @__PURE__ */ React55.createElement(Text47, { color: FG.faint }, `${remainingSec}s`)));
|
|
19467
19645
|
}));
|
|
19468
19646
|
}
|
|
19469
19647
|
|
|
@@ -21612,17 +21790,17 @@ var handlers9 = {
|
|
|
21612
21790
|
};
|
|
21613
21791
|
|
|
21614
21792
|
// src/cli/ui/ctx-breakdown.tsx
|
|
21615
|
-
import { Box as
|
|
21616
|
-
import
|
|
21793
|
+
import { Box as Box47, Text as Text49 } from "ink";
|
|
21794
|
+
import React57 from "react";
|
|
21617
21795
|
|
|
21618
21796
|
// src/cli/ui/primitives.tsx
|
|
21619
|
-
import { Text as
|
|
21620
|
-
import
|
|
21797
|
+
import { Text as Text48, useStdout as useStdout13 } from "ink";
|
|
21798
|
+
import React56 from "react";
|
|
21621
21799
|
function ChromeRule() {
|
|
21622
21800
|
const { stdout: stdout4 } = useStdout13();
|
|
21623
21801
|
const cols = stdout4?.columns ?? 80;
|
|
21624
21802
|
const w = Math.max(20, cols - 2);
|
|
21625
|
-
return /* @__PURE__ */
|
|
21803
|
+
return /* @__PURE__ */ React56.createElement(Text48, { dimColor: true }, "\u2500".repeat(w));
|
|
21626
21804
|
}
|
|
21627
21805
|
function Bar({
|
|
21628
21806
|
ratio,
|
|
@@ -21631,7 +21809,7 @@ function Bar({
|
|
|
21631
21809
|
dim
|
|
21632
21810
|
}) {
|
|
21633
21811
|
const filled = Math.max(0, Math.min(cells, Math.round(ratio * cells)));
|
|
21634
|
-
return /* @__PURE__ */
|
|
21812
|
+
return /* @__PURE__ */ React56.createElement(Text48, null, /* @__PURE__ */ React56.createElement(Text48, { color: color2, dimColor: dim }, "\u25B0".repeat(filled)), /* @__PURE__ */ React56.createElement(Text48, { dimColor: true }, "\u25B1".repeat(cells - filled)));
|
|
21635
21813
|
}
|
|
21636
21814
|
|
|
21637
21815
|
// src/cli/ui/ctx-breakdown.tsx
|
|
@@ -23196,13 +23374,13 @@ var PLAIN_UI = process.env.REASONIX_UI === "plain";
|
|
|
23196
23374
|
function LoopStatusRow({
|
|
23197
23375
|
loop: loop2
|
|
23198
23376
|
}) {
|
|
23199
|
-
const [, setTick] =
|
|
23200
|
-
|
|
23377
|
+
const [, setTick] = React58.useState(0);
|
|
23378
|
+
React58.useEffect(() => {
|
|
23201
23379
|
const id = setInterval(() => setTick((t2) => t2 + 1), 1e3);
|
|
23202
23380
|
return () => clearInterval(id);
|
|
23203
23381
|
}, []);
|
|
23204
23382
|
const nextFireMs = Math.max(0, loop2.nextFireAt - Date.now());
|
|
23205
|
-
return /* @__PURE__ */
|
|
23383
|
+
return /* @__PURE__ */ React58.createElement(Box48, null, /* @__PURE__ */ React58.createElement(Text50, { color: "cyan" }, `\u25B8 ${formatLoopStatus(loop2.prompt, nextFireMs, loop2.iter)} \xB7 /loop stop or type to cancel`));
|
|
23206
23384
|
}
|
|
23207
23385
|
function App(props) {
|
|
23208
23386
|
const session = useAgentSession({
|
|
@@ -23210,11 +23388,11 @@ function App(props) {
|
|
|
23210
23388
|
model: props.model,
|
|
23211
23389
|
workspace: props.codeMode?.rootDir ?? process.cwd()
|
|
23212
23390
|
});
|
|
23213
|
-
const initialCards =
|
|
23391
|
+
const initialCards = React58.useMemo(
|
|
23214
23392
|
() => props.session ? hydrateCardsFromMessages(loadSessionMessages(props.session)) : [],
|
|
23215
23393
|
[props.session]
|
|
23216
23394
|
);
|
|
23217
|
-
return /* @__PURE__ */
|
|
23395
|
+
return /* @__PURE__ */ React58.createElement(AgentStoreProvider, { session, initialCards }, /* @__PURE__ */ React58.createElement(AppInner, { ...props }));
|
|
23218
23396
|
}
|
|
23219
23397
|
function AppInner({
|
|
23220
23398
|
model: model2,
|
|
@@ -25136,7 +25314,7 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25136
25314
|
async (choice) => handleReviseConfirmRef.current(choice),
|
|
25137
25315
|
[]
|
|
25138
25316
|
);
|
|
25139
|
-
return /* @__PURE__ */
|
|
25317
|
+
return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
|
|
25140
25318
|
TickerProvider,
|
|
25141
25319
|
{
|
|
25142
25320
|
disabled: PLAIN_UI || isResizing || !!pendingPlan || !!pendingReviseEditor || pendingSessionsPicker || pendingMcpBrowser || !!pendingShell || !!pendingEditReview || walkthroughActive || !!pendingCheckpoint || !!stagedCheckpointRevise || !!pendingChoice || !!stagedChoiceCustom || !!pendingRevision || // Idle gate: when nothing is actively happening, suspend the
|
|
@@ -25149,28 +25327,28 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25149
25327
|
// changes (incoming stream, key press, modal popup).
|
|
25150
25328
|
!busy && !isStreaming
|
|
25151
25329
|
},
|
|
25152
|
-
/* @__PURE__ */
|
|
25330
|
+
/* @__PURE__ */ React58.createElement(ViewportBudgetProvider, null, /* @__PURE__ */ React58.createElement(Box48, { flexDirection: "row" }, /* @__PURE__ */ React58.createElement(Box48, { flexDirection: "column", flexGrow: 1 }, /* @__PURE__ */ React58.createElement(Box48, { flexDirection: "column" }, /* @__PURE__ */ React58.createElement(CardStream, { excludeId: activePlanCard?.id }), !hasConversation && !busy && !isStreaming ? /* @__PURE__ */ React58.createElement(WelcomeBanner, { inCodeMode: !!codeMode, dashboardUrl }) : null, !PLAIN_UI && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpBrowser && !stagedInput && !pendingEditReview && !pendingCheckpoint && !stagedCheckpointRevise && ongoingTool ? /* @__PURE__ */ React58.createElement(OngoingToolRow, { tool: ongoingTool, progress: toolProgress }) : null, !PLAIN_UI && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpBrowser && !stagedInput && !pendingEditReview && !pendingCheckpoint && !stagedCheckpointRevise && subagentActivity ? /* @__PURE__ */ React58.createElement(SubagentRow, { activity: subagentActivity }) : null, !PLAIN_UI && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpBrowser && !stagedInput && !pendingEditReview && !pendingCheckpoint && !stagedCheckpointRevise && !ongoingTool && statusLine ? /* @__PURE__ */ React58.createElement(ThinkingRow, { text: statusLine }) : null, !PLAIN_UI && undoBanner && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpBrowser && !stagedInput && !pendingEditReview && !pendingCheckpoint && !stagedCheckpointRevise && !pendingChoice && !stagedChoiceCustom && !pendingRevision ? /* @__PURE__ */ React58.createElement(UndoBanner, { banner: undoBanner }) : null, !PLAIN_UI && !pendingShell && !pendingPlan && !pendingReviseEditor && !pendingSessionsPicker && !pendingMcpBrowser && !stagedInput && !pendingEditReview && !pendingCheckpoint && !stagedCheckpointRevise && busy && !isStreaming && !ongoingTool && !statusLine ? /* @__PURE__ */ React58.createElement(ThinkingRow, { text: "processing\u2026" }) : null, /* @__PURE__ */ React58.createElement(ToastRail, null)), !PLAIN_UI && activePlanCard ? /* @__PURE__ */ React58.createElement(Box48, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React58.createElement(PlanCard, { card: activePlanCard })) : null, stagedInput ? /* @__PURE__ */ React58.createElement(
|
|
25153
25331
|
PlanRefineInput,
|
|
25154
25332
|
{
|
|
25155
25333
|
mode: stagedInput.mode,
|
|
25156
25334
|
onSubmit: handleStagedInputSubmit,
|
|
25157
25335
|
onCancel: handleStagedInputCancel
|
|
25158
25336
|
}
|
|
25159
|
-
) : stagedCheckpointRevise ? /* @__PURE__ */
|
|
25337
|
+
) : stagedCheckpointRevise ? /* @__PURE__ */ React58.createElement(
|
|
25160
25338
|
PlanRefineInput,
|
|
25161
25339
|
{
|
|
25162
25340
|
mode: "checkpoint-revise",
|
|
25163
25341
|
onSubmit: handleCheckpointReviseSubmit,
|
|
25164
25342
|
onCancel: handleCheckpointReviseCancel
|
|
25165
25343
|
}
|
|
25166
|
-
) : stagedChoiceCustom ? /* @__PURE__ */
|
|
25344
|
+
) : stagedChoiceCustom ? /* @__PURE__ */ React58.createElement(
|
|
25167
25345
|
PlanRefineInput,
|
|
25168
25346
|
{
|
|
25169
25347
|
mode: "choice-custom",
|
|
25170
25348
|
onSubmit: handleChoiceCustomSubmit,
|
|
25171
25349
|
onCancel: handleChoiceCustomCancel
|
|
25172
25350
|
}
|
|
25173
|
-
) : pendingChoice ? /* @__PURE__ */
|
|
25351
|
+
) : pendingChoice ? /* @__PURE__ */ React58.createElement(
|
|
25174
25352
|
ChoiceConfirm,
|
|
25175
25353
|
{
|
|
25176
25354
|
question: pendingChoice.question,
|
|
@@ -25178,7 +25356,7 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25178
25356
|
allowCustom: pendingChoice.allowCustom,
|
|
25179
25357
|
onChoose: stableHandleChoiceConfirm
|
|
25180
25358
|
}
|
|
25181
|
-
) : pendingRevision ? /* @__PURE__ */
|
|
25359
|
+
) : pendingRevision ? /* @__PURE__ */ React58.createElement(
|
|
25182
25360
|
PlanReviseConfirm,
|
|
25183
25361
|
{
|
|
25184
25362
|
reason: pendingRevision.reason,
|
|
@@ -25189,7 +25367,7 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25189
25367
|
summary: pendingRevision.summary,
|
|
25190
25368
|
onChoose: stableHandleReviseConfirm
|
|
25191
25369
|
}
|
|
25192
|
-
) : pendingCheckpoint ? /* @__PURE__ */
|
|
25370
|
+
) : pendingCheckpoint ? /* @__PURE__ */ React58.createElement(
|
|
25193
25371
|
PlanCheckpointConfirm,
|
|
25194
25372
|
{
|
|
25195
25373
|
stepId: pendingCheckpoint.stepId,
|
|
@@ -25200,7 +25378,7 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25200
25378
|
completedStepIds: completedStepIdsRef.current,
|
|
25201
25379
|
onChoose: stableHandleCheckpointConfirm
|
|
25202
25380
|
}
|
|
25203
|
-
) : pendingSessionsPicker ? /* @__PURE__ */
|
|
25381
|
+
) : pendingSessionsPicker ? /* @__PURE__ */ React58.createElement(
|
|
25204
25382
|
SessionPicker,
|
|
25205
25383
|
{
|
|
25206
25384
|
sessions: sessionsPickerList,
|
|
@@ -25243,7 +25421,7 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25243
25421
|
}
|
|
25244
25422
|
}
|
|
25245
25423
|
}
|
|
25246
|
-
) : pendingMcpBrowser ? /* @__PURE__ */
|
|
25424
|
+
) : pendingMcpBrowser ? /* @__PURE__ */ React58.createElement(
|
|
25247
25425
|
McpBrowser,
|
|
25248
25426
|
{
|
|
25249
25427
|
servers: mcpServers ?? [],
|
|
@@ -25252,7 +25430,7 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25252
25430
|
postInfo: (text) => log.pushInfo(text),
|
|
25253
25431
|
applyAppend: (target, addedTools) => applyMcpAppend(loop2, target, addedTools)
|
|
25254
25432
|
}
|
|
25255
|
-
) : pendingPlan ? /* @__PURE__ */
|
|
25433
|
+
) : pendingPlan ? /* @__PURE__ */ React58.createElement(
|
|
25256
25434
|
PlanConfirm,
|
|
25257
25435
|
{
|
|
25258
25436
|
plan: pendingPlan,
|
|
@@ -25261,7 +25439,7 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25261
25439
|
onChoose: stableHandlePlanConfirm,
|
|
25262
25440
|
projectRoot: currentRootDir
|
|
25263
25441
|
}
|
|
25264
|
-
) : pendingReviseEditor ? /* @__PURE__ */
|
|
25442
|
+
) : pendingReviseEditor ? /* @__PURE__ */ React58.createElement(
|
|
25265
25443
|
PlanReviseEditor,
|
|
25266
25444
|
{
|
|
25267
25445
|
steps: planStepsRef.current ?? [],
|
|
@@ -25280,7 +25458,7 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25280
25458
|
setPendingPlan(planText);
|
|
25281
25459
|
}
|
|
25282
25460
|
}
|
|
25283
|
-
) : pendingShell ? /* @__PURE__ */
|
|
25461
|
+
) : pendingShell ? /* @__PURE__ */ React58.createElement(
|
|
25284
25462
|
ShellConfirm,
|
|
25285
25463
|
{
|
|
25286
25464
|
command: pendingShell.command,
|
|
@@ -25288,7 +25466,7 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25288
25466
|
kind: pendingShell.kind,
|
|
25289
25467
|
onChoose: handleShellConfirm
|
|
25290
25468
|
}
|
|
25291
|
-
) : pendingEditReview ? /* @__PURE__ */
|
|
25469
|
+
) : pendingEditReview ? /* @__PURE__ */ React58.createElement(
|
|
25292
25470
|
EditConfirm,
|
|
25293
25471
|
{
|
|
25294
25472
|
block: pendingEditReview,
|
|
@@ -25300,14 +25478,14 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25300
25478
|
}
|
|
25301
25479
|
}
|
|
25302
25480
|
}
|
|
25303
|
-
) : walkthroughActive && pendingEdits.current.length > 0 ? /* @__PURE__ */
|
|
25481
|
+
) : walkthroughActive && pendingEdits.current.length > 0 ? /* @__PURE__ */ React58.createElement(
|
|
25304
25482
|
EditConfirm,
|
|
25305
25483
|
{
|
|
25306
25484
|
key: `walk-${pendingTick}`,
|
|
25307
25485
|
block: pendingEdits.current[0],
|
|
25308
25486
|
onChoose: handleWalkChoice
|
|
25309
25487
|
}
|
|
25310
|
-
) : /* @__PURE__ */
|
|
25488
|
+
) : /* @__PURE__ */ React58.createElement(React58.Fragment, null, codeMode ? /* @__PURE__ */ React58.createElement(
|
|
25311
25489
|
ModeStatusBar,
|
|
25312
25490
|
{
|
|
25313
25491
|
editMode,
|
|
@@ -25317,7 +25495,7 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25317
25495
|
undoArmed: !!undoBanner || hasUndoable(),
|
|
25318
25496
|
jobs: codeMode.jobs
|
|
25319
25497
|
}
|
|
25320
|
-
) : null, activeLoop ? /* @__PURE__ */
|
|
25498
|
+
) : null, activeLoop ? /* @__PURE__ */ React58.createElement(LoopStatusRow, { loop: activeLoop }) : null, /* @__PURE__ */ React58.createElement(StatusRow, null), /* @__PURE__ */ React58.createElement(
|
|
25321
25499
|
PromptInput,
|
|
25322
25500
|
{
|
|
25323
25501
|
value: input,
|
|
@@ -25327,14 +25505,14 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25327
25505
|
onHistoryPrev: recallPrev,
|
|
25328
25506
|
onHistoryNext: recallNext
|
|
25329
25507
|
}
|
|
25330
|
-
), slashMatches !== null ? /* @__PURE__ */
|
|
25508
|
+
), slashMatches !== null ? /* @__PURE__ */ React58.createElement(SlashSuggestions, { matches: slashMatches, selectedIndex: slashSelected }) : null, atMatches !== null ? /* @__PURE__ */ React58.createElement(
|
|
25331
25509
|
AtMentionSuggestions,
|
|
25332
25510
|
{
|
|
25333
25511
|
matches: atMatches,
|
|
25334
25512
|
selectedIndex: atSelected,
|
|
25335
25513
|
query: atPicker?.query ?? ""
|
|
25336
25514
|
}
|
|
25337
|
-
) : null, slashArgContext ? /* @__PURE__ */
|
|
25515
|
+
) : null, slashArgContext ? /* @__PURE__ */ React58.createElement(
|
|
25338
25516
|
SlashArgPicker,
|
|
25339
25517
|
{
|
|
25340
25518
|
matches: slashArgMatches,
|
|
@@ -25343,14 +25521,14 @@ Continue executing from the next pending step. Call mark_step_complete after eac
|
|
|
25343
25521
|
kind: slashArgContext.kind,
|
|
25344
25522
|
partial: slashArgContext.partial
|
|
25345
25523
|
}
|
|
25346
|
-
) : null)), !PLAIN_UI && sidebarOpen && (process.stdout.columns ?? 80) >= SIDEBAR_MIN_TOTAL_COLS ? /* @__PURE__ */
|
|
25524
|
+
) : null)), !PLAIN_UI && sidebarOpen && (process.stdout.columns ?? 80) >= SIDEBAR_MIN_TOTAL_COLS ? /* @__PURE__ */ React58.createElement(SidebarPanel, { ongoingTool, subagentActivity }) : null))
|
|
25347
25525
|
));
|
|
25348
25526
|
}
|
|
25349
25527
|
|
|
25350
25528
|
// src/cli/ui/Setup.tsx
|
|
25351
|
-
import { Box as
|
|
25529
|
+
import { Box as Box49, Text as Text51, useApp } from "ink";
|
|
25352
25530
|
import TextInput from "ink-text-input";
|
|
25353
|
-
import
|
|
25531
|
+
import React59, { useState as useState16 } from "react";
|
|
25354
25532
|
function Setup({ onReady }) {
|
|
25355
25533
|
const [value, setValue] = useState16("");
|
|
25356
25534
|
const [error, setError] = useState16(null);
|
|
@@ -25374,7 +25552,7 @@ function Setup({ onReady }) {
|
|
|
25374
25552
|
}
|
|
25375
25553
|
onReady(trimmed);
|
|
25376
25554
|
};
|
|
25377
|
-
return /* @__PURE__ */
|
|
25555
|
+
return /* @__PURE__ */ React59.createElement(Box49, { flexDirection: "column", paddingX: 1, marginY: 1 }, /* @__PURE__ */ React59.createElement(Box49, null, /* @__PURE__ */ React59.createElement(Text51, { bold: true, color: GRADIENT[0] }, GLYPH.brand), /* @__PURE__ */ React59.createElement(Text51, null, " "), /* @__PURE__ */ React59.createElement(Text51, { bold: true }, "Welcome to "), /* @__PURE__ */ React59.createElement(Text51, { bold: true, color: GRADIENT[2] }, "REASONIX")), /* @__PURE__ */ React59.createElement(Box49, { marginTop: 1 }, /* @__PURE__ */ React59.createElement(Text51, { color: COLOR.info }, "Paste your DeepSeek API key to get started.")), /* @__PURE__ */ React59.createElement(Box49, null, /* @__PURE__ */ React59.createElement(Text51, { dimColor: true }, " sign up at \xB7 "), /* @__PURE__ */ React59.createElement(Text51, { color: COLOR.primary }, "https://platform.deepseek.com/api_keys")), /* @__PURE__ */ React59.createElement(Box49, null, /* @__PURE__ */ React59.createElement(Text51, { dimColor: true }, " saved to "), /* @__PURE__ */ React59.createElement(Text51, { dimColor: true }, defaultConfigPath())), /* @__PURE__ */ React59.createElement(Box49, { marginTop: 1 }, /* @__PURE__ */ React59.createElement(Text51, { bold: true, color: COLOR.brand }, GLYPH.bar), /* @__PURE__ */ React59.createElement(Text51, { bold: true, color: COLOR.primary }, " \u203A "), /* @__PURE__ */ React59.createElement(
|
|
25378
25556
|
TextInput,
|
|
25379
25557
|
{
|
|
25380
25558
|
value,
|
|
@@ -25383,7 +25561,7 @@ function Setup({ onReady }) {
|
|
|
25383
25561
|
mask: "\u2022",
|
|
25384
25562
|
placeholder: "sk-..."
|
|
25385
25563
|
}
|
|
25386
|
-
)), error ? /* @__PURE__ */
|
|
25564
|
+
)), error ? /* @__PURE__ */ React59.createElement(Box49, { marginTop: 1 }, /* @__PURE__ */ React59.createElement(Text51, { color: COLOR.err, bold: true }, GLYPH.err), /* @__PURE__ */ React59.createElement(Text51, { color: COLOR.err }, ` ${error}`)) : value ? /* @__PURE__ */ React59.createElement(Box49, { marginTop: 1 }, /* @__PURE__ */ React59.createElement(Text51, { dimColor: true }, ` preview \xB7 ${redactKey(value)}`)) : null, /* @__PURE__ */ React59.createElement(Box49, { marginTop: 1 }, /* @__PURE__ */ React59.createElement(Text51, { dimColor: true }, " /exit to abort")));
|
|
25387
25565
|
}
|
|
25388
25566
|
|
|
25389
25567
|
// src/cli/ui/mcp-toast.ts
|
|
@@ -25408,7 +25586,7 @@ function Root({
|
|
|
25408
25586
|
const workspaceRoot = appProps.codeMode?.rootDir ?? process.cwd();
|
|
25409
25587
|
const [sessions2, setSessions] = useState17(() => listSessionsForWorkspace(workspaceRoot));
|
|
25410
25588
|
if (!key) {
|
|
25411
|
-
return /* @__PURE__ */
|
|
25589
|
+
return /* @__PURE__ */ React60.createElement(
|
|
25412
25590
|
Setup,
|
|
25413
25591
|
{
|
|
25414
25592
|
onReady: (k) => {
|
|
@@ -25420,7 +25598,7 @@ function Root({
|
|
|
25420
25598
|
}
|
|
25421
25599
|
process.env.DEEPSEEK_API_KEY = key;
|
|
25422
25600
|
if (pickerOpen) {
|
|
25423
|
-
return /* @__PURE__ */
|
|
25601
|
+
return /* @__PURE__ */ React60.createElement(KeystrokeProvider, null, /* @__PURE__ */ React60.createElement(
|
|
25424
25602
|
SessionPicker,
|
|
25425
25603
|
{
|
|
25426
25604
|
sessions: sessions2,
|
|
@@ -25453,7 +25631,7 @@ function Root({
|
|
|
25453
25631
|
}
|
|
25454
25632
|
));
|
|
25455
25633
|
}
|
|
25456
|
-
return /* @__PURE__ */
|
|
25634
|
+
return /* @__PURE__ */ React60.createElement(KeystrokeProvider, null, /* @__PURE__ */ React60.createElement(
|
|
25457
25635
|
App,
|
|
25458
25636
|
{
|
|
25459
25637
|
key: activeSession ?? "__new__",
|
|
@@ -25586,7 +25764,7 @@ async function chatCommand(opts) {
|
|
|
25586
25764
|
const launchWorkspace = opts.codeMode?.rootDir ?? process.cwd();
|
|
25587
25765
|
const showPicker = !opts.session && !opts.forceResume && listSessionsForWorkspace(launchWorkspace).length > 0;
|
|
25588
25766
|
const { waitUntilExit } = render(
|
|
25589
|
-
/* @__PURE__ */
|
|
25767
|
+
/* @__PURE__ */ React60.createElement(
|
|
25590
25768
|
Root,
|
|
25591
25769
|
{
|
|
25592
25770
|
initialKey,
|
|
@@ -25962,19 +26140,19 @@ async function commitCommand(opts = {}) {
|
|
|
25962
26140
|
import { writeFileSync as writeFileSync14 } from "fs";
|
|
25963
26141
|
import { basename as basename3 } from "path";
|
|
25964
26142
|
import { render as render2 } from "ink";
|
|
25965
|
-
import
|
|
26143
|
+
import React64 from "react";
|
|
25966
26144
|
|
|
25967
26145
|
// src/cli/ui/DiffApp.tsx
|
|
25968
|
-
import { Box as
|
|
25969
|
-
import
|
|
26146
|
+
import { Box as Box52, Static as Static2, Text as Text54, useApp as useApp2, useInput as useInput2 } from "ink";
|
|
26147
|
+
import React63, { useState as useState18 } from "react";
|
|
25970
26148
|
|
|
25971
26149
|
// src/cli/ui/RecordView.tsx
|
|
25972
|
-
import { Box as
|
|
25973
|
-
import
|
|
26150
|
+
import { Box as Box51, Text as Text53 } from "ink";
|
|
26151
|
+
import React62 from "react";
|
|
25974
26152
|
|
|
25975
26153
|
// src/cli/ui/PlanStateBlock.tsx
|
|
25976
|
-
import { Box as
|
|
25977
|
-
import
|
|
26154
|
+
import { Box as Box50, Text as Text52 } from "ink";
|
|
26155
|
+
import React61 from "react";
|
|
25978
26156
|
function PlanStateBlock({ planState }) {
|
|
25979
26157
|
const fields = [];
|
|
25980
26158
|
if (planState.subgoals.length)
|
|
@@ -25986,7 +26164,7 @@ function PlanStateBlock({ planState }) {
|
|
|
25986
26164
|
if (planState.rejectedPaths.length)
|
|
25987
26165
|
fields.push(["rejected", planState.rejectedPaths, COLOR.info, true]);
|
|
25988
26166
|
if (fields.length === 0) return null;
|
|
25989
|
-
return /* @__PURE__ */
|
|
26167
|
+
return /* @__PURE__ */ React61.createElement(Box50, { flexDirection: "column", marginBottom: 1 }, fields.map(([label, items, color2, dim]) => /* @__PURE__ */ React61.createElement(Box50, { key: label }, /* @__PURE__ */ React61.createElement(Text52, { color: color2, bold: true, dimColor: dim }, label), /* @__PURE__ */ React61.createElement(Text52, { dimColor: true }, ` (${items.length})`), /* @__PURE__ */ React61.createElement(Text52, { dimColor: true }, " \xB7 "), /* @__PURE__ */ React61.createElement(Text52, { dimColor: dim, color: dim ? void 0 : COLOR.info }, items.join(" \xB7 ")))));
|
|
25990
26168
|
}
|
|
25991
26169
|
|
|
25992
26170
|
// src/cli/ui/RecordView.tsx
|
|
@@ -25995,21 +26173,21 @@ function RecordView({ rec, compact: compact2 = false }) {
|
|
|
25995
26173
|
const toolContentMax = compact2 ? 200 : 400;
|
|
25996
26174
|
if (rec.role === "user") {
|
|
25997
26175
|
const content = rec.content.includes("\n") ? rec.content.split("\n").join("\n ") : rec.content;
|
|
25998
|
-
return /* @__PURE__ */
|
|
26176
|
+
return /* @__PURE__ */ React62.createElement(Box51, { marginTop: 1 }, /* @__PURE__ */ React62.createElement(Text53, { bold: true, color: "cyan" }, "you \u203A", " "), /* @__PURE__ */ React62.createElement(Text53, null, content));
|
|
25999
26177
|
}
|
|
26000
26178
|
if (rec.role === "assistant_final") {
|
|
26001
|
-
return /* @__PURE__ */
|
|
26179
|
+
return /* @__PURE__ */ React62.createElement(Box51, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React62.createElement(Box51, null, /* @__PURE__ */ React62.createElement(Text53, { bold: true, color: "green" }, "assistant"), rec.cost !== void 0 ? /* @__PURE__ */ React62.createElement(Text53, { dimColor: true }, " $", rec.cost.toFixed(6)) : null, rec.usage ? /* @__PURE__ */ React62.createElement(CacheBadge, { usage: rec.usage }) : null), rec.planState ? /* @__PURE__ */ React62.createElement(PlanStateBlock, { planState: rec.planState }) : null, rec.content ? /* @__PURE__ */ React62.createElement(Text53, null, rec.content) : /* @__PURE__ */ React62.createElement(Text53, { dimColor: true, italic: true }, "(tool-call response only)"));
|
|
26002
26180
|
}
|
|
26003
26181
|
if (rec.role === "tool") {
|
|
26004
|
-
return /* @__PURE__ */
|
|
26182
|
+
return /* @__PURE__ */ React62.createElement(Box51, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React62.createElement(Text53, { color: "yellow" }, "tool<", rec.tool ?? "?", ">"), rec.args ? /* @__PURE__ */ React62.createElement(Text53, { dimColor: true }, " args: ", truncate4(rec.args, toolArgsMax)) : null, /* @__PURE__ */ React62.createElement(Text53, { dimColor: true }, " \u2192 ", truncate4(rec.content, toolContentMax)));
|
|
26005
26183
|
}
|
|
26006
26184
|
if (rec.role === "error") {
|
|
26007
|
-
return /* @__PURE__ */
|
|
26185
|
+
return /* @__PURE__ */ React62.createElement(Box51, { marginTop: 1 }, /* @__PURE__ */ React62.createElement(Text53, { color: "red", bold: true }, "error", " "), /* @__PURE__ */ React62.createElement(Text53, { color: "red" }, rec.error ?? rec.content));
|
|
26008
26186
|
}
|
|
26009
26187
|
if (rec.role === "done" || rec.role === "assistant_delta") {
|
|
26010
26188
|
return null;
|
|
26011
26189
|
}
|
|
26012
|
-
return /* @__PURE__ */
|
|
26190
|
+
return /* @__PURE__ */ React62.createElement(Box51, null, /* @__PURE__ */ React62.createElement(Text53, { dimColor: true }, "[", rec.role, "] ", rec.content));
|
|
26013
26191
|
}
|
|
26014
26192
|
function CacheBadge({ usage }) {
|
|
26015
26193
|
const hit = usage.prompt_cache_hit_tokens ?? 0;
|
|
@@ -26018,7 +26196,7 @@ function CacheBadge({ usage }) {
|
|
|
26018
26196
|
if (total === 0) return null;
|
|
26019
26197
|
const pct2 = hit / total * 100;
|
|
26020
26198
|
const color2 = pct2 >= 70 ? "green" : pct2 >= 40 ? "yellow" : "red";
|
|
26021
|
-
return /* @__PURE__ */
|
|
26199
|
+
return /* @__PURE__ */ React62.createElement(Text53, null, /* @__PURE__ */ React62.createElement(Text53, { dimColor: true }, " \xB7 cache "), /* @__PURE__ */ React62.createElement(Text53, { color: color2 }, pct2.toFixed(1), "%"));
|
|
26022
26200
|
}
|
|
26023
26201
|
function truncate4(s, max) {
|
|
26024
26202
|
return s.length <= max ? s : `${s.slice(0, max)}\u2026 (+${s.length - max} chars)`;
|
|
@@ -26052,7 +26230,7 @@ function DiffApp({ report }) {
|
|
|
26052
26230
|
}
|
|
26053
26231
|
});
|
|
26054
26232
|
const pair = report.pairs[idx];
|
|
26055
|
-
return /* @__PURE__ */
|
|
26233
|
+
return /* @__PURE__ */ React63.createElement(Box52, { flexDirection: "column" }, /* @__PURE__ */ React63.createElement(DiffHeader, { report }), /* @__PURE__ */ React63.createElement(Box52, { marginTop: 1, paddingX: 1, justifyContent: "space-between" }, /* @__PURE__ */ React63.createElement(Text54, { color: "cyan", bold: true }, "turn ", pair?.turn ?? "?", " (", idx + 1, " / ", report.pairs.length, ")"), /* @__PURE__ */ React63.createElement(Text54, null, pair ? /* @__PURE__ */ React63.createElement(KindBadge, { kind: pair.kind }) : null)), /* @__PURE__ */ React63.createElement(Box52, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React63.createElement(Pane, { label: report.a.label, headerColor: "blue", records: paneRecords(pair, "a") }), /* @__PURE__ */ React63.createElement(Pane, { label: report.b.label, headerColor: "magenta", records: paneRecords(pair, "b") })), pair?.divergenceNote ? /* @__PURE__ */ React63.createElement(Box52, { marginTop: 1, paddingX: 1 }, /* @__PURE__ */ React63.createElement(Text54, { color: "yellow" }, "\u2605 "), /* @__PURE__ */ React63.createElement(Text54, null, pair.divergenceNote)) : null, /* @__PURE__ */ React63.createElement(Box52, { marginTop: 1, paddingX: 1, borderStyle: "single", borderColor: "gray" }, /* @__PURE__ */ React63.createElement(Text54, { dimColor: true }, /* @__PURE__ */ React63.createElement(Text54, { bold: true }, "j"), "/", /* @__PURE__ */ React63.createElement(Text54, { bold: true }, "\u2193"), " next \xB7 ", /* @__PURE__ */ React63.createElement(Text54, { bold: true }, "k"), "/", /* @__PURE__ */ React63.createElement(Text54, { bold: true }, "\u2191"), " ", "prev \xB7 ", /* @__PURE__ */ React63.createElement(Text54, { bold: true }, "n"), " next-diverge \xB7 ", /* @__PURE__ */ React63.createElement(Text54, { bold: true }, "N"), "/", /* @__PURE__ */ React63.createElement(Text54, { bold: true }, "p"), " ", "prev-diverge \xB7 ", /* @__PURE__ */ React63.createElement(Text54, { bold: true }, "g"), "/", /* @__PURE__ */ React63.createElement(Text54, { bold: true }, "G"), " first/last \xB7 ", /* @__PURE__ */ React63.createElement(Text54, { bold: true }, "q"), " ", "quit")));
|
|
26056
26234
|
}
|
|
26057
26235
|
function DiffHeader({ report }) {
|
|
26058
26236
|
const a = report.a;
|
|
@@ -26070,15 +26248,15 @@ function DiffHeader({ report }) {
|
|
|
26070
26248
|
} else if (a.stats.prefixHashes[0] && a.stats.prefixHashes[0] === b.stats.prefixHashes[0]) {
|
|
26071
26249
|
prefixLine = `shared prefix hash ${a.stats.prefixHashes[0].slice(0, 12)}\u2026 \u2014 cache delta attributable to log stability, not prompt change.`;
|
|
26072
26250
|
}
|
|
26073
|
-
return /* @__PURE__ */
|
|
26251
|
+
return /* @__PURE__ */ React63.createElement(Box52, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1 }, /* @__PURE__ */ React63.createElement(Box52, { justifyContent: "space-between" }, /* @__PURE__ */ React63.createElement(Text54, null, /* @__PURE__ */ React63.createElement(Text54, { color: "cyan", bold: true }, "reasonix diff"), /* @__PURE__ */ React63.createElement(Text54, { dimColor: true }, " \xB7 A="), /* @__PURE__ */ React63.createElement(Text54, { color: "blue" }, a.label), /* @__PURE__ */ React63.createElement(Text54, { dimColor: true }, " vs B="), /* @__PURE__ */ React63.createElement(Text54, { color: "magenta" }, b.label)), /* @__PURE__ */ React63.createElement(Text54, { dimColor: true }, report.pairs.length, " turns aligned")), /* @__PURE__ */ React63.createElement(Box52, { marginTop: 1, gap: 3 }, /* @__PURE__ */ React63.createElement(Text54, null, /* @__PURE__ */ React63.createElement(Text54, { dimColor: true }, "cache "), /* @__PURE__ */ React63.createElement(Text54, null, (a.stats.cacheHitRatio * 100).toFixed(1), "%"), /* @__PURE__ */ React63.createElement(Text54, { dimColor: true }, " \u2192 "), /* @__PURE__ */ React63.createElement(Text54, null, (b.stats.cacheHitRatio * 100).toFixed(1), "%"), /* @__PURE__ */ React63.createElement(Text54, { color: cacheDelta >= 0 ? "green" : "red", bold: true }, " ", cacheDelta >= 0 ? "+" : "", (cacheDelta * 100).toFixed(1), "pp")), /* @__PURE__ */ React63.createElement(Text54, null, /* @__PURE__ */ React63.createElement(Text54, { dimColor: true }, "cost "), /* @__PURE__ */ React63.createElement(Text54, null, "$", a.stats.totalCostUsd.toFixed(6)), /* @__PURE__ */ React63.createElement(Text54, { dimColor: true }, " \u2192 "), /* @__PURE__ */ React63.createElement(Text54, null, "$", b.stats.totalCostUsd.toFixed(6)), /* @__PURE__ */ React63.createElement(Text54, { color: costDelta2 <= 0 ? "green" : "red", bold: true }, " ", costDelta2 >= 0 ? "+" : "", costDelta2.toFixed(1), "%")), /* @__PURE__ */ React63.createElement(Text54, null, /* @__PURE__ */ React63.createElement(Text54, { dimColor: true }, "model calls "), /* @__PURE__ */ React63.createElement(Text54, null, a.stats.turns, " \u2192 ", b.stats.turns))), prefixLine ? /* @__PURE__ */ React63.createElement(Box52, { marginTop: 1 }, /* @__PURE__ */ React63.createElement(Text54, { dimColor: true, italic: true }, prefixLine)) : null);
|
|
26074
26252
|
}
|
|
26075
26253
|
function Pane({
|
|
26076
26254
|
label,
|
|
26077
26255
|
headerColor,
|
|
26078
26256
|
records
|
|
26079
26257
|
}) {
|
|
26080
|
-
return /* @__PURE__ */
|
|
26081
|
-
|
|
26258
|
+
return /* @__PURE__ */ React63.createElement(
|
|
26259
|
+
Box52,
|
|
26082
26260
|
{
|
|
26083
26261
|
flexDirection: "column",
|
|
26084
26262
|
flexGrow: 1,
|
|
@@ -26086,21 +26264,21 @@ function Pane({
|
|
|
26086
26264
|
borderStyle: "single",
|
|
26087
26265
|
borderColor: headerColor
|
|
26088
26266
|
},
|
|
26089
|
-
/* @__PURE__ */
|
|
26090
|
-
records.length === 0 ? /* @__PURE__ */
|
|
26267
|
+
/* @__PURE__ */ React63.createElement(Text54, { color: headerColor, bold: true }, label),
|
|
26268
|
+
records.length === 0 ? /* @__PURE__ */ React63.createElement(Box52, { marginTop: 1 }, /* @__PURE__ */ React63.createElement(Text54, { dimColor: true, italic: true }, "(no records on this side for this turn)")) : /* @__PURE__ */ React63.createElement(Static2, { items: records.map((rec, i) => ({ key: `${label}-${i}`, rec })) }, ({ key, rec }) => /* @__PURE__ */ React63.createElement(RecordView, { key, rec, compact: true }))
|
|
26091
26269
|
);
|
|
26092
26270
|
}
|
|
26093
26271
|
function KindBadge({ kind }) {
|
|
26094
26272
|
if (kind === "match") {
|
|
26095
|
-
return /* @__PURE__ */
|
|
26273
|
+
return /* @__PURE__ */ React63.createElement(Text54, { color: "green" }, "\u2713 match");
|
|
26096
26274
|
}
|
|
26097
26275
|
if (kind === "diverge") {
|
|
26098
|
-
return /* @__PURE__ */
|
|
26276
|
+
return /* @__PURE__ */ React63.createElement(Text54, { color: "yellow" }, "\u2605 diverge");
|
|
26099
26277
|
}
|
|
26100
26278
|
if (kind === "only_in_a") {
|
|
26101
|
-
return /* @__PURE__ */
|
|
26279
|
+
return /* @__PURE__ */ React63.createElement(Text54, { color: "blue" }, "\u2190 only in A");
|
|
26102
26280
|
}
|
|
26103
|
-
return /* @__PURE__ */
|
|
26281
|
+
return /* @__PURE__ */ React63.createElement(Text54, { color: "magenta" }, "\u2192 only in B");
|
|
26104
26282
|
}
|
|
26105
26283
|
function paneRecords(pair, side) {
|
|
26106
26284
|
if (!pair) return [];
|
|
@@ -26131,7 +26309,7 @@ markdown report written to ${opts.mdPath}`);
|
|
|
26131
26309
|
return;
|
|
26132
26310
|
}
|
|
26133
26311
|
if (wantTui) {
|
|
26134
|
-
const { waitUntilExit } = render2(
|
|
26312
|
+
const { waitUntilExit } = render2(React64.createElement(DiffApp, { report }), {
|
|
26135
26313
|
exitOnCtrlC: true,
|
|
26136
26314
|
patchConsole: false
|
|
26137
26315
|
});
|
|
@@ -26802,16 +26980,16 @@ function pad2(s, width) {
|
|
|
26802
26980
|
|
|
26803
26981
|
// src/cli/commands/replay.ts
|
|
26804
26982
|
import { render as render3 } from "ink";
|
|
26805
|
-
import
|
|
26983
|
+
import React67 from "react";
|
|
26806
26984
|
|
|
26807
26985
|
// src/cli/ui/ReplayApp.tsx
|
|
26808
|
-
import { Box as
|
|
26809
|
-
import
|
|
26986
|
+
import { Box as Box54, Static as Static3, Text as Text56, useApp as useApp3, useInput as useInput3 } from "ink";
|
|
26987
|
+
import React66, { useMemo as useMemo8, useState as useState19 } from "react";
|
|
26810
26988
|
|
|
26811
26989
|
// src/cli/ui/StatsPanel.tsx
|
|
26812
26990
|
import { basename as basename4 } from "path";
|
|
26813
|
-
import { Box as
|
|
26814
|
-
import
|
|
26991
|
+
import { Box as Box53, Text as Text55, useStdout as useStdout15 } from "ink";
|
|
26992
|
+
import React65 from "react";
|
|
26815
26993
|
import stringWidth2 from "string-width";
|
|
26816
26994
|
var COLD_START_TURNS = 3;
|
|
26817
26995
|
function StatsPanel({
|
|
@@ -26827,7 +27005,7 @@ function StatsPanel({
|
|
|
26827
27005
|
sessionName
|
|
26828
27006
|
}) {
|
|
26829
27007
|
const coldStart = summary.turns <= COLD_START_TURNS;
|
|
26830
|
-
return /* @__PURE__ */
|
|
27008
|
+
return /* @__PURE__ */ React65.createElement(Box53, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React65.createElement(
|
|
26831
27009
|
ChromeRow,
|
|
26832
27010
|
{
|
|
26833
27011
|
editMode,
|
|
@@ -26841,7 +27019,7 @@ function StatsPanel({
|
|
|
26841
27019
|
updateAvailable,
|
|
26842
27020
|
balance: balance ?? null
|
|
26843
27021
|
}
|
|
26844
|
-
), /* @__PURE__ */
|
|
27022
|
+
), /* @__PURE__ */ React65.createElement(ChromeRule, null), budgetUsd !== null && budgetUsd !== void 0 ? /* @__PURE__ */ React65.createElement(BudgetRow, { spent: summary.totalCostUsd, cap: budgetUsd }) : null);
|
|
26845
27023
|
}
|
|
26846
27024
|
function ChromeRow({
|
|
26847
27025
|
editMode,
|
|
@@ -26886,15 +27064,15 @@ function ChromeRow({
|
|
|
26886
27064
|
if (showSession) budget3 -= sessionW;
|
|
26887
27065
|
const showUpdate = updateW > 0 && budget3 >= updateW;
|
|
26888
27066
|
if (showUpdate) budget3 -= updateW;
|
|
26889
|
-
return /* @__PURE__ */
|
|
26890
|
-
|
|
27067
|
+
return /* @__PURE__ */ React65.createElement(Box53, null, /* @__PURE__ */ React65.createElement(Text55, { bold: true, color: GRADIENT[0] }, "\u25C8 "), /* @__PURE__ */ React65.createElement(Text55, { color: COLOR.brand, bold: true }, "reasonix"), projectName ? /* @__PURE__ */ React65.createElement(React65.Fragment, null, /* @__PURE__ */ React65.createElement(Text55, { color: COLOR.info, dimColor: true }, " \xB7 "), /* @__PURE__ */ React65.createElement(Text55, null, projectName), showSession && sessionName ? /* @__PURE__ */ React65.createElement(React65.Fragment, null, /* @__PURE__ */ React65.createElement(Text55, { color: COLOR.info, dimColor: true }, " \u203A "), /* @__PURE__ */ React65.createElement(Text55, { color: COLOR.info }, sessionName)) : null) : null, /* @__PURE__ */ React65.createElement(Box53, { flexGrow: 1 }), showUpdate ? /* @__PURE__ */ React65.createElement(React65.Fragment, null, /* @__PURE__ */ React65.createElement(Text55, { color: COLOR.warn, bold: true }, updateLabel), /* @__PURE__ */ React65.createElement(Text55, null, " ")) : null, modePill ? /* @__PURE__ */ React65.createElement(React65.Fragment, null, /* @__PURE__ */ React65.createElement(Text55, { color: modePill.color, bold: true }, `[${modePill.label}]`), /* @__PURE__ */ React65.createElement(Text55, null, " ")) : null, proPill ? /* @__PURE__ */ React65.createElement(React65.Fragment, null, /* @__PURE__ */ React65.createElement(Text55, { color: proPill.color, bold: true }, `[${proPill.label}]`), /* @__PURE__ */ React65.createElement(Text55, null, " ")) : null, /* @__PURE__ */ React65.createElement(
|
|
27068
|
+
Text55,
|
|
26891
27069
|
{
|
|
26892
27070
|
color: summary.turns === 0 || coldStart ? COLOR.info : sessionCostColor(summary.totalCostUsd),
|
|
26893
27071
|
bold: summary.turns > 0 && !coldStart,
|
|
26894
27072
|
dimColor: summary.turns === 0 || coldStart
|
|
26895
27073
|
},
|
|
26896
27074
|
costLabel
|
|
26897
|
-
), showBalance && balance ? /* @__PURE__ */
|
|
27075
|
+
), showBalance && balance ? /* @__PURE__ */ React65.createElement(React65.Fragment, null, /* @__PURE__ */ React65.createElement(Text55, null, " "), /* @__PURE__ */ React65.createElement(Text55, { color: balance.total < 1 ? COLOR.err : balance.total < 5 ? COLOR.warn : COLOR.ok }, balanceLabel)) : null, showCache ? /* @__PURE__ */ React65.createElement(React65.Fragment, null, /* @__PURE__ */ React65.createElement(Text55, null, " "), /* @__PURE__ */ React65.createElement(Text55, { dimColor: true }, "["), /* @__PURE__ */ React65.createElement(Text55, { dimColor: true }, "c "), /* @__PURE__ */ React65.createElement(
|
|
26898
27076
|
Bar,
|
|
26899
27077
|
{
|
|
26900
27078
|
ratio: summary.cacheHitRatio,
|
|
@@ -26902,7 +27080,7 @@ function ChromeRow({
|
|
|
26902
27080
|
cells: 6,
|
|
26903
27081
|
dim: coldStart
|
|
26904
27082
|
}
|
|
26905
|
-
), /* @__PURE__ */
|
|
27083
|
+
), /* @__PURE__ */ React65.createElement(Text55, null, " "), /* @__PURE__ */ React65.createElement(Text55, { color: coldStart ? void 0 : cacheColor, dimColor: coldStart }, coldStart && summary.turns === 0 ? "\u2014" : `${cachePct}%`), /* @__PURE__ */ React65.createElement(Text55, { dimColor: true }, "]")) : null);
|
|
26906
27084
|
}
|
|
26907
27085
|
function pickModePill(planMode, editMode) {
|
|
26908
27086
|
if (planMode) return { label: "PLAN", color: COLOR.err };
|
|
@@ -26914,7 +27092,7 @@ function pickModePill(planMode, editMode) {
|
|
|
26914
27092
|
function BudgetRow({ spent, cap }) {
|
|
26915
27093
|
const pct2 = Math.max(0, spent / cap * 100);
|
|
26916
27094
|
const color2 = pct2 >= 100 ? "#f87171" : pct2 >= 80 ? "#fbbf24" : "#94a3b8";
|
|
26917
|
-
return /* @__PURE__ */
|
|
27095
|
+
return /* @__PURE__ */ React65.createElement(Box53, null, /* @__PURE__ */ React65.createElement(Text55, { dimColor: true }, " budget "), /* @__PURE__ */ React65.createElement(Text55, { color: color2 }, `$${spent.toFixed(4)} / $${cap.toFixed(2)}`, /* @__PURE__ */ React65.createElement(Text55, { dimColor: true }, ` (${pct2.toFixed(0)}%)`)));
|
|
26918
27096
|
}
|
|
26919
27097
|
function sessionCostColor(cost2) {
|
|
26920
27098
|
if (cost2 <= 0) return void 0;
|
|
@@ -26963,7 +27141,7 @@ function ReplayApp({ meta, pages }) {
|
|
|
26963
27141
|
const prefixHash = cumStats.prefixHashes.length === 1 ? cumStats.prefixHashes[0].slice(0, 16) : cumStats.prefixHashes.length === 0 ? "(untracked)" : `(churned \xD7${cumStats.prefixHashes.length})`;
|
|
26964
27142
|
const currentPage = pages[idx];
|
|
26965
27143
|
const progressLabel = pages.length === 0 ? "empty transcript" : `turn ${idx + 1} / ${pages.length}`;
|
|
26966
|
-
return /* @__PURE__ */
|
|
27144
|
+
return /* @__PURE__ */ React66.createElement(Box54, { flexDirection: "column" }, /* @__PURE__ */ React66.createElement(StatsPanel, { summary }), /* @__PURE__ */ React66.createElement(Box54, { flexDirection: "column", marginTop: 1, paddingX: 1 }, /* @__PURE__ */ React66.createElement(Box54, { justifyContent: "space-between" }, /* @__PURE__ */ React66.createElement(Text56, { color: "cyan", bold: true }, progressLabel), meta ? /* @__PURE__ */ React66.createElement(Text56, { dimColor: true }, meta.source, meta.task ? ` \xB7 ${meta.task}` : "", meta.mode ? ` \xB7 ${meta.mode}` : "") : null), currentPage ? /* @__PURE__ */ React66.createElement(Static3, { items: currentPage.records.map((rec, i) => ({ key: `${idx}-${i}`, rec })) }, ({ key, rec }) => /* @__PURE__ */ React66.createElement(RecordView, { key, rec })) : /* @__PURE__ */ React66.createElement(Text56, { dimColor: true, italic: true }, "no records")), /* @__PURE__ */ React66.createElement(Box54, { marginTop: 1, paddingX: 1, borderStyle: "single", borderColor: "gray" }, /* @__PURE__ */ React66.createElement(Text56, { dimColor: true }, /* @__PURE__ */ React66.createElement(Text56, { bold: true }, "j"), "/", /* @__PURE__ */ React66.createElement(Text56, { bold: true }, "\u2193"), "/", /* @__PURE__ */ React66.createElement(Text56, { bold: true }, "space"), " next \xB7 ", /* @__PURE__ */ React66.createElement(Text56, { bold: true }, "k"), "/", /* @__PURE__ */ React66.createElement(Text56, { bold: true }, "\u2191"), " prev \xB7 ", /* @__PURE__ */ React66.createElement(Text56, { bold: true }, "g"), " first \xB7 ", /* @__PURE__ */ React66.createElement(Text56, { bold: true }, "G"), " last \xB7", " ", /* @__PURE__ */ React66.createElement(Text56, { bold: true }, "q"), " quit")));
|
|
26967
27145
|
}
|
|
26968
27146
|
|
|
26969
27147
|
// src/cli/commands/replay.ts
|
|
@@ -26975,7 +27153,7 @@ async function replayCommand(opts) {
|
|
|
26975
27153
|
}
|
|
26976
27154
|
const { parsed } = replayFromFile(opts.path);
|
|
26977
27155
|
const pages = groupRecordsByTurn(parsed.records);
|
|
26978
|
-
const { waitUntilExit } = render3(
|
|
27156
|
+
const { waitUntilExit } = render3(React67.createElement(ReplayApp, { meta: parsed.meta, pages }), {
|
|
26979
27157
|
exitOnCtrlC: true,
|
|
26980
27158
|
patchConsole: false
|
|
26981
27159
|
});
|
|
@@ -27304,12 +27482,12 @@ function truncate6(s, max) {
|
|
|
27304
27482
|
|
|
27305
27483
|
// src/cli/commands/setup.tsx
|
|
27306
27484
|
import { render as render4 } from "ink";
|
|
27307
|
-
import
|
|
27485
|
+
import React69 from "react";
|
|
27308
27486
|
|
|
27309
27487
|
// src/cli/ui/Wizard.tsx
|
|
27310
|
-
import { Box as
|
|
27488
|
+
import { Box as Box55, Text as Text57, useApp as useApp4, useInput as useInput4 } from "ink";
|
|
27311
27489
|
import TextInput2 from "ink-text-input";
|
|
27312
|
-
import
|
|
27490
|
+
import React68, { useState as useState20 } from "react";
|
|
27313
27491
|
var CATALOG_BY_NAME = new Map(MCP_CATALOG.map((e) => [e.name, e]));
|
|
27314
27492
|
function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
27315
27493
|
const { exit: exit2 } = useApp4();
|
|
@@ -27325,7 +27503,7 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
27325
27503
|
if (key.escape && step !== "saved" && onCancel) onCancel();
|
|
27326
27504
|
});
|
|
27327
27505
|
if (step === "apiKey") {
|
|
27328
|
-
return /* @__PURE__ */
|
|
27506
|
+
return /* @__PURE__ */ React68.createElement(
|
|
27329
27507
|
ApiKeyStep,
|
|
27330
27508
|
{
|
|
27331
27509
|
onSubmit: (key) => {
|
|
@@ -27339,7 +27517,7 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
27339
27517
|
);
|
|
27340
27518
|
}
|
|
27341
27519
|
if (step === "preset") {
|
|
27342
|
-
return /* @__PURE__ */
|
|
27520
|
+
return /* @__PURE__ */ React68.createElement(StepFrame, { title: "Pick a preset", step: 1, total: 3 }, /* @__PURE__ */ React68.createElement(
|
|
27343
27521
|
SingleSelect,
|
|
27344
27522
|
{
|
|
27345
27523
|
items: presetItems(),
|
|
@@ -27349,10 +27527,10 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
27349
27527
|
setStep("mcp");
|
|
27350
27528
|
}
|
|
27351
27529
|
}
|
|
27352
|
-
), /* @__PURE__ */
|
|
27530
|
+
), /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, { dimColor: true }, "[\u2191\u2193] navigate \xB7 [Enter] confirm \xB7 [Esc] cancel")));
|
|
27353
27531
|
}
|
|
27354
27532
|
if (step === "mcp") {
|
|
27355
|
-
return /* @__PURE__ */
|
|
27533
|
+
return /* @__PURE__ */ React68.createElement(StepFrame, { title: "Which MCP servers should Reasonix wire up for you?", step: 2, total: 3 }, /* @__PURE__ */ React68.createElement(
|
|
27356
27534
|
MultiSelect,
|
|
27357
27535
|
{
|
|
27358
27536
|
items: mcpItems(),
|
|
@@ -27377,7 +27555,7 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
27377
27555
|
}
|
|
27378
27556
|
const currentName = pending[0];
|
|
27379
27557
|
const entry = CATALOG_BY_NAME.get(currentName);
|
|
27380
|
-
return /* @__PURE__ */
|
|
27558
|
+
return /* @__PURE__ */ React68.createElement(
|
|
27381
27559
|
McpArgsStep,
|
|
27382
27560
|
{
|
|
27383
27561
|
entry,
|
|
@@ -27395,7 +27573,7 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
27395
27573
|
}
|
|
27396
27574
|
if (step === "review") {
|
|
27397
27575
|
const specs = data.selectedCatalog.map((name) => buildSpec(name, data.catalogArgs));
|
|
27398
|
-
return /* @__PURE__ */
|
|
27576
|
+
return /* @__PURE__ */ React68.createElement(StepFrame, { title: "Ready to save", step: 3, total: 3 }, /* @__PURE__ */ React68.createElement(Box55, { flexDirection: "column" }, /* @__PURE__ */ React68.createElement(SummaryLine, { label: "API key", value: redactKey(data.apiKey) }), /* @__PURE__ */ React68.createElement(SummaryLine, { label: "Preset", value: data.preset }), /* @__PURE__ */ React68.createElement(
|
|
27399
27577
|
SummaryLine,
|
|
27400
27578
|
{
|
|
27401
27579
|
label: "MCP",
|
|
@@ -27403,8 +27581,8 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
27403
27581
|
}
|
|
27404
27582
|
), specs.map((spec, i) => (
|
|
27405
27583
|
// biome-ignore lint/suspicious/noArrayIndexKey: review-only render, order fixed
|
|
27406
|
-
/* @__PURE__ */
|
|
27407
|
-
)), /* @__PURE__ */
|
|
27584
|
+
/* @__PURE__ */ React68.createElement(Box55, { key: i, paddingLeft: 14 }, /* @__PURE__ */ React68.createElement(Text57, { dimColor: true }, "\xB7 ", spec))
|
|
27585
|
+
)), /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, null, "Saves to ", defaultConfigPath())), error ? /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, { color: "red" }, error)) : null, /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, { dimColor: true }, "[Enter] save \xB7 [Esc] cancel"))), /* @__PURE__ */ React68.createElement(
|
|
27408
27586
|
ReviewConfirm,
|
|
27409
27587
|
{
|
|
27410
27588
|
onConfirm: () => {
|
|
@@ -27430,7 +27608,7 @@ function Wizard({ onComplete, onCancel, existingApiKey, initial }) {
|
|
|
27430
27608
|
}
|
|
27431
27609
|
));
|
|
27432
27610
|
}
|
|
27433
|
-
return /* @__PURE__ */
|
|
27611
|
+
return /* @__PURE__ */ React68.createElement(Box55, { flexDirection: "column", borderStyle: "round", borderColor: "green", paddingX: 1 }, /* @__PURE__ */ React68.createElement(Text57, { bold: true, color: "green" }, "\u25B8 Saved."), /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, null, "Run `reasonix` any time to start chatting \u2014 your settings are remembered.")), /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, { dimColor: true }, "[Enter] to exit")), /* @__PURE__ */ React68.createElement(ExitOnEnter, { onExit: exit2 }));
|
|
27434
27612
|
}
|
|
27435
27613
|
function ApiKeyStep({
|
|
27436
27614
|
onSubmit,
|
|
@@ -27438,7 +27616,7 @@ function ApiKeyStep({
|
|
|
27438
27616
|
onError
|
|
27439
27617
|
}) {
|
|
27440
27618
|
const [value, setValue] = useState20("");
|
|
27441
|
-
return /* @__PURE__ */
|
|
27619
|
+
return /* @__PURE__ */ React68.createElement(Box55, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1 }, /* @__PURE__ */ React68.createElement(Text57, { bold: true, color: "cyan" }, "Welcome to Reasonix."), /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, null, "Paste your DeepSeek API key to get started.")), /* @__PURE__ */ React68.createElement(Text57, { dimColor: true }, "Get one at: https://platform.deepseek.com/api_keys"), /* @__PURE__ */ React68.createElement(Text57, { dimColor: true }, "Saved locally to ", defaultConfigPath()), /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, { bold: true, color: "cyan" }, "key \u203A "), /* @__PURE__ */ React68.createElement(
|
|
27442
27620
|
TextInput2,
|
|
27443
27621
|
{
|
|
27444
27622
|
value,
|
|
@@ -27455,7 +27633,7 @@ function ApiKeyStep({
|
|
|
27455
27633
|
mask: "\u2022",
|
|
27456
27634
|
placeholder: "sk-..."
|
|
27457
27635
|
}
|
|
27458
|
-
)), error ? /* @__PURE__ */
|
|
27636
|
+
)), error ? /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, { color: "red" }, error)) : value ? /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, { dimColor: true }, "preview: ", redactKey(value))) : null);
|
|
27459
27637
|
}
|
|
27460
27638
|
function McpArgsStep({
|
|
27461
27639
|
entry,
|
|
@@ -27464,7 +27642,7 @@ function McpArgsStep({
|
|
|
27464
27642
|
onError
|
|
27465
27643
|
}) {
|
|
27466
27644
|
const [value, setValue] = useState20("");
|
|
27467
|
-
return /* @__PURE__ */
|
|
27645
|
+
return /* @__PURE__ */ React68.createElement(StepFrame, { title: `Configure ${entry.name}`, step: 2, total: 3 }, /* @__PURE__ */ React68.createElement(Box55, { flexDirection: "column" }, /* @__PURE__ */ React68.createElement(Text57, null, entry.summary), entry.note ? /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, { dimColor: true }, entry.note)) : null, /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, null, "Required parameter: "), /* @__PURE__ */ React68.createElement(Text57, { bold: true }, entry.userArgs)), /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, { bold: true, color: "cyan" }, entry.userArgs, " \u203A "), /* @__PURE__ */ React68.createElement(
|
|
27468
27646
|
TextInput2,
|
|
27469
27647
|
{
|
|
27470
27648
|
value,
|
|
@@ -27480,7 +27658,7 @@ function McpArgsStep({
|
|
|
27480
27658
|
},
|
|
27481
27659
|
placeholder: placeholderFor(entry)
|
|
27482
27660
|
}
|
|
27483
|
-
)), error ? /* @__PURE__ */
|
|
27661
|
+
)), error ? /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1 }, /* @__PURE__ */ React68.createElement(Text57, { color: "red" }, error)) : null));
|
|
27484
27662
|
}
|
|
27485
27663
|
function ReviewConfirm({ onConfirm }) {
|
|
27486
27664
|
useInput4((_i, key) => {
|
|
@@ -27500,10 +27678,10 @@ function StepFrame({
|
|
|
27500
27678
|
total,
|
|
27501
27679
|
children
|
|
27502
27680
|
}) {
|
|
27503
|
-
return /* @__PURE__ */
|
|
27681
|
+
return /* @__PURE__ */ React68.createElement(Box55, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1 }, /* @__PURE__ */ React68.createElement(Box55, null, /* @__PURE__ */ React68.createElement(Text57, { dimColor: true }, "Step ", step, "/", total, " \xB7", " "), /* @__PURE__ */ React68.createElement(Text57, { bold: true, color: "cyan" }, title)), /* @__PURE__ */ React68.createElement(Box55, { marginTop: 1, flexDirection: "column" }, children));
|
|
27504
27682
|
}
|
|
27505
27683
|
function SummaryLine({ label, value }) {
|
|
27506
|
-
return /* @__PURE__ */
|
|
27684
|
+
return /* @__PURE__ */ React68.createElement(Box55, null, /* @__PURE__ */ React68.createElement(Text57, null, label.padEnd(12)), /* @__PURE__ */ React68.createElement(Text57, { bold: true }, value));
|
|
27507
27685
|
}
|
|
27508
27686
|
function presetItems() {
|
|
27509
27687
|
return ["auto", "flash", "pro"].map((name) => ({
|
|
@@ -27559,7 +27737,7 @@ async function setupCommand(_opts = {}) {
|
|
|
27559
27737
|
const existingKey = loadApiKey();
|
|
27560
27738
|
const existing = readConfig();
|
|
27561
27739
|
const { waitUntilExit, unmount } = render4(
|
|
27562
|
-
/* @__PURE__ */
|
|
27740
|
+
/* @__PURE__ */ React69.createElement(
|
|
27563
27741
|
Wizard,
|
|
27564
27742
|
{
|
|
27565
27743
|
existingApiKey: existingKey,
|