kimiflare 0.82.1 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3595,7 +3595,7 @@ How to work:
3595
3595
  - Prefer calling tools over guessing. Read files before editing them. Use \`glob\` and \`grep\` to explore code before assuming structure.
3596
3596
  - Before any mutating tool call (write, edit, bash), state in one short sentence what you're about to do, then call the tool. The user will be asked to approve each mutating call.
3597
3597
  - When the user asks for a change, make the change. Do not paste code in chat that you could apply with \`edit\` or \`write\`.
3598
- - For multi-step work, call \`tasks_set\` at the start with a short task list (one task "in_progress", the rest "pending"), then call it again after each step completes (flip that one to "completed" and the next to "in_progress"). Skip it for trivial single-step requests.
3598
+ - When working through a multi-step task list, you MUST call \`tasks_set\` **immediately before starting each new step** and **immediately after completing each step**. Do not execute mutating tools (\`write\`, \`edit\`, \`bash\`) without updating task progress first. Skip \`tasks_set\` for trivial single-step requests.
3599
3599
  - Keep responses terse. The user sees tool calls and their results inline \u2014 do not re-summarize them unless asked.
3600
3600
  - If a tool returns an error, read it carefully and adjust; do not retry the same call blindly.
3601
3601
  - Read as much of a file as needed rather than guessing; your context window is large enough to absorb whole files.
@@ -3727,7 +3727,7 @@ function raceWithSignal(promise, signal) {
3727
3727
  async function runAgentTurn(opts2) {
3728
3728
  const turnStart = performance.now();
3729
3729
  logger.info("turn:start", { sessionId: opts2.sessionId, codeMode: opts2.codeMode ?? false });
3730
- const max = opts2.maxToolIterations ?? 50;
3730
+ const max = opts2.maxToolIterations ?? 200;
3731
3731
  const codeMode = opts2.codeMode ?? false;
3732
3732
  const fireStopHook = async () => {
3733
3733
  if (opts2.signal.aborted) return;
@@ -3877,6 +3877,16 @@ Use console.log() to return results. Only console.log output will be sent back t
3877
3877
  let iter = 0;
3878
3878
  let budgetExhausted = false;
3879
3879
  let loopExhausted = false;
3880
+ let currentTasks = [];
3881
+ let mutatingToolsSinceLastTasksSet = 0;
3882
+ const MUTATING_TOOLS2 = /* @__PURE__ */ new Set(["write", "edit", "bash"]);
3883
+ const AUTO_ADVANCE_THRESHOLD = 3;
3884
+ const originalOnTasks = opts2.callbacks.onTasks;
3885
+ const wrappedOnTasks = (tasks) => {
3886
+ currentTasks = tasks;
3887
+ mutatingToolsSinceLastTasksSet = 0;
3888
+ originalOnTasks?.(tasks);
3889
+ };
3880
3890
  while (true) {
3881
3891
  if (budgetExhausted) {
3882
3892
  opts2.messages.push({
@@ -4092,7 +4102,7 @@ Use console.log() to return results. Only console.log output will be sent back t
4092
4102
  return;
4093
4103
  }
4094
4104
  let blockedCount = 0;
4095
- for (const tc of toolCalls) {
4105
+ for (const [i, tc] of toolCalls.entries()) {
4096
4106
  if (opts2.signal.aborted) throw new DOMException("aborted", "AbortError");
4097
4107
  const loopSignature = `${tc.function.name}:${stableStringify(tc.function.arguments)}`;
4098
4108
  const loopCount = recentToolCalls.filter((s) => s === loopSignature).length;
@@ -4200,7 +4210,7 @@ Use console.log() to return results. Only console.log output will be sent back t
4200
4210
  tools: opts2.tools,
4201
4211
  executor: opts2.executor,
4202
4212
  askPermission: opts2.callbacks.askPermission,
4203
- ctx: { cwd: opts2.cwd, signal: opts2.signal, onTasks: opts2.callbacks.onTasks, coauthor: opts2.coauthor, memoryManager: opts2.memoryManager, sessionId: opts2.sessionId, githubToken: opts2.githubToken },
4213
+ ctx: { cwd: opts2.cwd, signal: opts2.signal, onTasks: wrappedOnTasks, onPlanOptions: opts2.callbacks.onPlanOptions, coauthor: opts2.coauthor, memoryManager: opts2.memoryManager, sessionId: opts2.sessionId, githubToken: opts2.githubToken },
4204
4214
  timeoutMs: 3e4,
4205
4215
  memoryLimitMB: 128
4206
4216
  });
@@ -4260,7 +4270,8 @@ ${sandboxResult.output}` : sandboxResult.output;
4260
4270
  {
4261
4271
  cwd: opts2.cwd,
4262
4272
  signal: opts2.signal,
4263
- onTasks: opts2.callbacks.onTasks,
4273
+ onTasks: wrappedOnTasks,
4274
+ onPlanOptions: opts2.callbacks.onPlanOptions,
4264
4275
  coauthor: opts2.coauthor,
4265
4276
  memoryManager: opts2.memoryManager,
4266
4277
  sessionId: opts2.sessionId,
@@ -4397,6 +4408,24 @@ ${sandboxResult.output}` : sandboxResult.output;
4397
4408
  recentToolCalls.push(loopSignature);
4398
4409
  if (recentToolCalls.length > LOOP_WINDOW) recentToolCalls.shift();
4399
4410
  }
4411
+ if (MUTATING_TOOLS2.has(tc.function.name)) {
4412
+ mutatingToolsSinceLastTasksSet++;
4413
+ const hasTasksSetComing = toolCalls.slice(i + 1).some((t) => t.function.name === "tasks_set");
4414
+ if (!hasTasksSetComing && mutatingToolsSinceLastTasksSet >= AUTO_ADVANCE_THRESHOLD) {
4415
+ const inProgressIdx = currentTasks.findIndex((t) => t.status === "in_progress");
4416
+ const nextPendingIdx = currentTasks.findIndex((t) => t.status === "pending");
4417
+ if (inProgressIdx !== -1 && nextPendingIdx !== -1) {
4418
+ const updated = currentTasks.map((t, idx) => {
4419
+ if (idx === inProgressIdx) return { ...t, status: "completed" };
4420
+ if (idx === nextPendingIdx) return { ...t, status: "in_progress" };
4421
+ return t;
4422
+ });
4423
+ currentTasks = updated;
4424
+ mutatingToolsSinceLastTasksSet = 0;
4425
+ wrappedOnTasks(updated);
4426
+ }
4427
+ }
4428
+ }
4400
4429
  }
4401
4430
  if (blockedCount === toolCalls.length && toolCalls.length > 0) {
4402
4431
  loopExhausted = true;
@@ -6264,6 +6293,65 @@ var init_spawn_worker = __esm({
6264
6293
  }
6265
6294
  });
6266
6295
 
6296
+ // src/tools/plan-options.ts
6297
+ function validatePlanOptions(input) {
6298
+ if (!Array.isArray(input)) throw new Error("options must be an array");
6299
+ return input.map((item, i) => {
6300
+ if (!item || typeof item !== "object") throw new Error(`options[${i}] must be an object`);
6301
+ const rec = item;
6302
+ const label = typeof rec.label === "string" ? rec.label.trim() : "";
6303
+ if (!label) throw new Error(`options[${i}].label is required`);
6304
+ const plan = typeof rec.plan === "string" ? rec.plan.trim() : "";
6305
+ if (!plan) throw new Error(`options[${i}].plan is required`);
6306
+ return { label, plan };
6307
+ });
6308
+ }
6309
+ var presentPlanOptionsTool;
6310
+ var init_plan_options = __esm({
6311
+ "src/tools/plan-options.ts"() {
6312
+ "use strict";
6313
+ presentPlanOptionsTool = {
6314
+ name: "present_plan_options",
6315
+ description: [
6316
+ "Present a list of plan options to the user and let them pick one.",
6317
+ "Use this when you have multiple viable approaches and want the user to choose",
6318
+ "which plan to pursue. Each option needs a short label and the full plan text.",
6319
+ "After the user selects an option, the session resets and starts fresh with the chosen plan."
6320
+ ].join(" "),
6321
+ parameters: {
6322
+ type: "object",
6323
+ properties: {
6324
+ options: {
6325
+ type: "array",
6326
+ description: "The list of plan options to present to the user.",
6327
+ items: {
6328
+ type: "object",
6329
+ properties: {
6330
+ label: {
6331
+ type: "string",
6332
+ description: "Short human-readable label for this option (shown in the picker)."
6333
+ },
6334
+ plan: {
6335
+ type: "string",
6336
+ description: "The full plan text that will seed the new session if this option is chosen."
6337
+ }
6338
+ },
6339
+ required: ["label", "plan"]
6340
+ }
6341
+ }
6342
+ },
6343
+ required: ["options"]
6344
+ },
6345
+ needsPermission: false,
6346
+ run: async (args, ctx) => {
6347
+ const options = validatePlanOptions(args.options);
6348
+ ctx.onPlanOptions?.(options);
6349
+ return `Presented ${options.length} plan option(s) to the user.`;
6350
+ }
6351
+ };
6352
+ }
6353
+ });
6354
+
6267
6355
  // src/tools/artifact-store.ts
6268
6356
  var ToolArtifactStore;
6269
6357
  var init_artifact_store = __esm({
@@ -6892,6 +6980,7 @@ var init_executor = __esm({
6892
6980
  init_tasks();
6893
6981
  init_memory();
6894
6982
  init_spawn_worker();
6983
+ init_plan_options();
6895
6984
  init_artifact_store();
6896
6985
  init_reducer();
6897
6986
  init_expand_artifact();
@@ -6912,7 +7001,8 @@ var init_executor = __esm({
6912
7001
  memoryRememberTool,
6913
7002
  memoryRecallTool,
6914
7003
  memoryForgetTool,
6915
- spawnWorkerTool
7004
+ spawnWorkerTool,
7005
+ presentPlanOptionsTool
6916
7006
  ];
6917
7007
  HOOK_RESULT_CONTENT_CAP_BYTES = 4 * 1024;
6918
7008
  ToolExecutor = class {
@@ -10764,7 +10854,7 @@ async function getCostReport(sessionId) {
10764
10854
  promptTokens: rawSession.promptTokens,
10765
10855
  completionTokens: rawSession.completionTokens,
10766
10856
  cachedTokens: rawSession.cachedTokens,
10767
- cost: rawSession.cost,
10857
+ cost: rawSession.cost + (rawSession.baselineCost ?? 0),
10768
10858
  gatewayRequests: rawSession.gatewayRequests,
10769
10859
  gatewayCachedRequests: rawSession.gatewayCachedRequests,
10770
10860
  gatewayCost: rawSession.gatewayCost,
@@ -10808,6 +10898,16 @@ async function getCostReport(sessionId) {
10808
10898
  }
10809
10899
  return { session, today: todayUsage, month: monthUsage, allTime };
10810
10900
  }
10901
+ async function carryOverSessionBaseline(fromSessionId, toSessionId) {
10902
+ await withLock(async () => {
10903
+ const log2 = pruneUsageLog(await loadLog2());
10904
+ const fromSession = log2.sessions.find((s) => s.id === fromSessionId);
10905
+ const baseline = fromSession ? Math.max(0, fromSession.cost + (fromSession.baselineCost ?? 0)) : 0;
10906
+ const toSession = getOrCreateSession(log2, toSessionId, today2());
10907
+ toSession.baselineCost = baseline;
10908
+ await saveLog(log2);
10909
+ });
10910
+ }
10811
10911
  function hasPendingReconcile(session) {
10812
10912
  if (!session.turns) return false;
10813
10913
  return session.turns.some(
@@ -16260,6 +16360,7 @@ ${err instanceof Error ? err.message : err}`);
16260
16360
  let currentThemeName = "everforest-dark";
16261
16361
  const branch = tryGitBranch2();
16262
16362
  let currentSessionFilePath = null;
16363
+ let sessionPlan = null;
16263
16364
  const startupCfg = await loadConfig().catch(() => null);
16264
16365
  let multiAgentEnabled = (startupCfg?.multiAgentEnabled ?? false) || /^(1|true|yes|on)$/i.test(process.env.KIMIFLARE_MULTI_AGENT_ENABLED ?? "");
16265
16366
  const multiAgentSupervisor = new TurnSupervisor();
@@ -16631,6 +16732,7 @@ ${err instanceof Error ? err.message : err}`);
16631
16732
  let streamCounter = 0;
16632
16733
  let currentStreamId = null;
16633
16734
  const repeatedToolSignatures = /* @__PURE__ */ new Map();
16735
+ const planOptionsRef = { current: null };
16634
16736
  async function runTurn(text) {
16635
16737
  kimiLog({ dir: "turn", phase: "start", text_preview: text.slice(0, 80) });
16636
16738
  const before = recentMentions.size;
@@ -16783,6 +16885,9 @@ Executor opened PR: ${prUrl}` : plan });
16783
16885
  cam.send("BackgroundTaskUpdate", { task_id: t.id, label: t.title, state });
16784
16886
  }
16785
16887
  },
16888
+ onPlanOptions: (options) => {
16889
+ planOptionsRef.current = options;
16890
+ },
16786
16891
  onSkillsSelected: (result) => {
16787
16892
  const n = result?.selected?.length ?? 0;
16788
16893
  if (n > 0) {
@@ -16811,7 +16916,7 @@ Executor opened PR: ${prUrl}` : plan });
16811
16916
  onToolLimitReached: async () => {
16812
16917
  const r = await confirm(cam, {
16813
16918
  id: `lim-${Date.now()}`,
16814
- prompt: "Tool-call limit reached (50). Continue running?",
16919
+ prompt: "Tool-call limit reached (200). Continue running?",
16815
16920
  yes_label: "Continue",
16816
16921
  no_label: "Stop turn",
16817
16922
  default: "no",
@@ -16924,6 +17029,54 @@ Executor opened PR: ${prUrl}` : plan });
16924
17029
  setPhase("idle");
16925
17030
  cam.send("StatusUpdate", { segments: { elapsed: "" } });
16926
17031
  kimiLog({ dir: "turn", phase: "end" });
17032
+ if (currentMode === "plan" && !currentController?.signal.aborted) {
17033
+ const plan = distillSessionPlan(messages);
17034
+ if (plan) {
17035
+ sessionPlan = plan;
17036
+ }
17037
+ }
17038
+ if (planOptionsRef.current && !currentController?.signal.aborted) {
17039
+ const options = planOptionsRef.current;
17040
+ planOptionsRef.current = null;
17041
+ const pick3 = await selectList(cam, {
17042
+ id: `plan-options-${Date.now()}`,
17043
+ prompt: "Choose a plan to start fresh with",
17044
+ options: [
17045
+ ...options.map((o, i) => ({
17046
+ value: String(i),
17047
+ label: o.label
17048
+ })),
17049
+ { value: "__chat__", label: "Chat about this" }
17050
+ ],
17051
+ allow_cancel: true
17052
+ });
17053
+ if (pick3.cancelled || pick3.value === null) {
17054
+ } else if (pick3.value === "__chat__") {
17055
+ } else {
17056
+ const selected = options[Number(pick3.value)];
17057
+ if (selected) {
17058
+ const systemMessages = messages.filter((m) => m.role === "system");
17059
+ messages.length = 0;
17060
+ messages.push(...systemMessages);
17061
+ sessionCostUsd = 0;
17062
+ promptTokens = 0;
17063
+ cachedTokens = 0;
17064
+ completionTokens = 0;
17065
+ sessionPlan = null;
17066
+ cam.send("TranscriptCleared", {});
17067
+ cam.send("StatusUpdate", {
17068
+ segments: { tokens: "in 0", cost: "$0.00", elapsed: "" }
17069
+ });
17070
+ messages.push({ role: "user", content: selected.plan });
17071
+ cam.send("UserMessageCreated", { text: selected.plan });
17072
+ cam.send("ShowToast", {
17073
+ text: `Starting fresh with plan: ${selected.label}`,
17074
+ kind: "success",
17075
+ ttl_ms: 3e3
17076
+ });
17077
+ }
17078
+ }
17079
+ }
16927
17080
  }
16928
17081
  }
16929
17082
  async function nextFollowUp() {
@@ -17480,6 +17633,7 @@ Executor opened PR: ${prUrl}` : plan });
17480
17633
  promptTokens = 0;
17481
17634
  cachedTokens = 0;
17482
17635
  completionTokens = 0;
17636
+ sessionPlan = null;
17483
17637
  cam.send("TranscriptCleared", {});
17484
17638
  cam.send("StatusUpdate", {
17485
17639
  segments: { tokens: "in 0", cost: "$0.00", elapsed: "" }
@@ -18110,7 +18264,7 @@ Executor opened PR: ${prUrl}` : plan });
18110
18264
  cam.send("ShowToast", { text: "can't /fresh while model is running \u2014 press Esc to interrupt first", kind: "warn", ttl_ms: 2500 });
18111
18265
  return true;
18112
18266
  }
18113
- const plan = distillSessionPlan(messages);
18267
+ const plan = sessionPlan ?? distillSessionPlan(messages);
18114
18268
  if (!plan) {
18115
18269
  cam.send("ShowToast", { text: "No plan found to start fresh with.", kind: "error", ttl_ms: 2500 });
18116
18270
  return true;
@@ -18123,6 +18277,7 @@ Executor opened PR: ${prUrl}` : plan });
18123
18277
  promptTokens = 0;
18124
18278
  cachedTokens = 0;
18125
18279
  completionTokens = 0;
18280
+ sessionPlan = null;
18126
18281
  cam.send("TranscriptCleared", {});
18127
18282
  cam.send("StatusUpdate", {
18128
18283
  segments: { tokens: "in 0", cost: "$0.00", elapsed: "" }
@@ -21360,15 +21515,80 @@ var init_checkpoint_picker = __esm({
21360
21515
  }
21361
21516
  });
21362
21517
 
21518
+ // src/ui/plan-options-picker.tsx
21519
+ import { useState as useState8 } from "react";
21520
+ import { Box as Box10, Text as Text11, useInput as useInput5 } from "ink";
21521
+ import SelectInput3 from "ink-select-input";
21522
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
21523
+ function PlanOptionsPicker({ options, onPick }) {
21524
+ const theme = useTheme();
21525
+ const [selectedIndex, setSelectedIndex] = useState8(0);
21526
+ useInput5((input, key) => {
21527
+ if (input === "q" || key.escape) {
21528
+ onPick(null);
21529
+ return;
21530
+ }
21531
+ });
21532
+ const items = [
21533
+ ...options.map((opt, i) => ({
21534
+ label: `${i + 1}. ${opt.label}`,
21535
+ value: String(i)
21536
+ })),
21537
+ {
21538
+ label: "Chat about this",
21539
+ value: "__chat__"
21540
+ }
21541
+ ];
21542
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
21543
+ /* @__PURE__ */ jsx12(Text11, { color: theme.accent, bold: true, children: "Choose a plan to start fresh with" }),
21544
+ /* @__PURE__ */ jsxs10(Text11, { color: theme.info.color, children: [
21545
+ options.length,
21546
+ " option",
21547
+ options.length === 1 ? "" : "s",
21548
+ " available"
21549
+ ] }),
21550
+ /* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx12(
21551
+ SelectInput3,
21552
+ {
21553
+ items,
21554
+ initialIndex: selectedIndex,
21555
+ onHighlight: (item) => {
21556
+ const idx = items.findIndex((i) => i.value === item.value);
21557
+ if (idx >= 0) setSelectedIndex(idx);
21558
+ },
21559
+ onSelect: (item) => {
21560
+ if (item.value === "__chat__") {
21561
+ onPick(null);
21562
+ return;
21563
+ }
21564
+ const opt = options[Number(item.value)];
21565
+ if (opt) {
21566
+ onPick(opt);
21567
+ } else {
21568
+ onPick(null);
21569
+ }
21570
+ }
21571
+ }
21572
+ ) }),
21573
+ /* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text11, { color: theme.info.color, children: "q / Esc: cancel" }) })
21574
+ ] });
21575
+ }
21576
+ var init_plan_options_picker = __esm({
21577
+ "src/ui/plan-options-picker.tsx"() {
21578
+ "use strict";
21579
+ init_theme_context();
21580
+ }
21581
+ });
21582
+
21363
21583
  // src/ui/task-list.tsx
21364
- import { useEffect as useEffect4, useRef as useRef3, useState as useState8 } from "react";
21365
- import { Box as Box10, Text as Text11 } from "ink";
21584
+ import { useEffect as useEffect4, useRef as useRef3, useState as useState9 } from "react";
21585
+ import { Box as Box11, Text as Text12 } from "ink";
21366
21586
  import Spinner4 from "ink-spinner";
21367
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
21587
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
21368
21588
  function TaskList({ tasks, startedAt, tokensDelta }) {
21369
21589
  const theme = useTheme();
21370
- const [now2, setNow] = useState8(Date.now());
21371
- const [celebrating, setCelebrating] = useState8(false);
21590
+ const [now2, setNow] = useState9(Date.now());
21591
+ const [celebrating, setCelebrating] = useState9(false);
21372
21592
  const tasksRef = useRef3(tasks);
21373
21593
  const prevAllDoneRef = useRef3(false);
21374
21594
  tasksRef.current = tasks;
@@ -21402,18 +21622,18 @@ function TaskList({ tasks, startedAt, tokensDelta }) {
21402
21622
  const headerStats = [elapsed, tokensDelta > 0 ? `\u2191 ${formatTokens(tokensDelta)} tokens` : null].filter(Boolean).join(" \xB7 ");
21403
21623
  const visibleTasks = tasks.slice(0, MAX_VISIBLE);
21404
21624
  const hiddenPending = Math.max(0, tasks.length - visibleTasks.length);
21405
- return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginBottom: 1, children: [
21406
- /* @__PURE__ */ jsxs10(Box10, { children: [
21407
- /* @__PURE__ */ jsx12(Text11, { color: celebrating ? theme.palette.success : allDone ? "green" : theme.accent, bold: true, children: celebrating ? `\u2728 ${header}` : header }),
21408
- headerStats && /* @__PURE__ */ jsxs10(Text11, { color: theme.info.color, children: [
21625
+ return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginBottom: 1, children: [
21626
+ /* @__PURE__ */ jsxs11(Box11, { children: [
21627
+ /* @__PURE__ */ jsx13(Text12, { color: celebrating ? theme.palette.success : allDone ? "green" : theme.accent, bold: true, children: celebrating ? `\u2728 ${header}` : header }),
21628
+ headerStats && /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
21409
21629
  " ",
21410
21630
  "(",
21411
21631
  headerStats,
21412
21632
  ")"
21413
21633
  ] })
21414
21634
  ] }),
21415
- visibleTasks.map((t) => /* @__PURE__ */ jsx12(TaskRow, { task: t }, t.id)),
21416
- hiddenPending > 0 && /* @__PURE__ */ jsxs10(Text11, { color: theme.info.color, children: [
21635
+ visibleTasks.map((t) => /* @__PURE__ */ jsx13(TaskRow, { task: t }, t.id)),
21636
+ hiddenPending > 0 && /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
21417
21637
  " ",
21418
21638
  "\u2026 +",
21419
21639
  hiddenPending,
@@ -21424,21 +21644,21 @@ function TaskList({ tasks, startedAt, tokensDelta }) {
21424
21644
  function TaskRow({ task }) {
21425
21645
  const theme = useTheme();
21426
21646
  if (task.status === "completed") {
21427
- return /* @__PURE__ */ jsxs10(Text11, { color: theme.info.color, children: [
21647
+ return /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
21428
21648
  " ",
21429
21649
  "\u2713 ",
21430
- /* @__PURE__ */ jsx12(Text11, { strikethrough: true, children: task.title })
21650
+ /* @__PURE__ */ jsx13(Text12, { strikethrough: true, children: task.title })
21431
21651
  ] });
21432
21652
  }
21433
21653
  if (task.status === "in_progress") {
21434
- return /* @__PURE__ */ jsxs10(Text11, { color: theme.accent, bold: true, children: [
21654
+ return /* @__PURE__ */ jsxs11(Text12, { color: theme.accent, bold: true, children: [
21435
21655
  " ",
21436
- /* @__PURE__ */ jsx12(Spinner4, { type: "line" }),
21656
+ /* @__PURE__ */ jsx13(Spinner4, { type: "line" }),
21437
21657
  " ",
21438
21658
  task.title
21439
21659
  ] });
21440
21660
  }
21441
- return /* @__PURE__ */ jsxs10(Text11, { color: theme.info.color, children: [
21661
+ return /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
21442
21662
  " ",
21443
21663
  "\u2610 ",
21444
21664
  task.title
@@ -21465,10 +21685,10 @@ var init_task_list = __esm({
21465
21685
  });
21466
21686
 
21467
21687
  // src/ui/worker-list.tsx
21468
- import { useEffect as useEffect5, useState as useState9 } from "react";
21469
- import { Box as Box11, Text as Text12 } from "ink";
21688
+ import { useEffect as useEffect5, useState as useState10 } from "react";
21689
+ import { Box as Box12, Text as Text13 } from "ink";
21470
21690
  import Spinner5 from "ink-spinner";
21471
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
21691
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
21472
21692
  function WorkerList({ workers, isSynthesizing, narration }) {
21473
21693
  const theme = useTheme();
21474
21694
  if (workers.length === 0 && !narration) return null;
@@ -21478,12 +21698,12 @@ function WorkerList({ workers, isSynthesizing, narration }) {
21478
21698
  const budgetExhausted = workers.filter((w) => w.status === "budget_exhausted").length;
21479
21699
  const pending = workers.filter((w) => w.status === "pending").length;
21480
21700
  const showSynthesis = isSynthesizing && running === 0;
21481
- return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginBottom: 1, children: [
21482
- narration && /* @__PURE__ */ jsx13(Box11, { marginBottom: 1, children: /* @__PURE__ */ jsx13(Text12, { color: theme.info.color, italic: true, children: narration.split("\n").map((line, i) => /* @__PURE__ */ jsxs11(Text12, { children: [
21701
+ return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", marginBottom: 1, children: [
21702
+ narration && /* @__PURE__ */ jsx14(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsx14(Text13, { color: theme.info.color, italic: true, children: narration.split("\n").map((line, i) => /* @__PURE__ */ jsxs12(Text13, { children: [
21483
21703
  line,
21484
21704
  "\n"
21485
21705
  ] }, `narration-${i}`)) }) }),
21486
- /* @__PURE__ */ jsx13(Box11, { children: /* @__PURE__ */ jsxs11(Text12, { color: theme.accent, bold: true, children: [
21706
+ /* @__PURE__ */ jsx14(Box12, { children: /* @__PURE__ */ jsxs12(Text13, { color: theme.accent, bold: true, children: [
21487
21707
  "Workers: ",
21488
21708
  pending > 0 ? `${pending} todo \xB7 ` : "",
21489
21709
  running > 0 ? `${running} ongoing \xB7 ` : "",
@@ -21496,7 +21716,7 @@ function WorkerList({ workers, isSynthesizing, narration }) {
21496
21716
  if (!anyPreRead) return null;
21497
21717
  const fileCount = anyPreRead.preReadFiles.length;
21498
21718
  const chars = anyPreRead.preReadChars ?? 0;
21499
- return /* @__PURE__ */ jsx13(Box11, { marginLeft: 2, children: /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
21719
+ return /* @__PURE__ */ jsx14(Box12, { marginLeft: 2, children: /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
21500
21720
  "\u{1F4E6} Shared cache: ",
21501
21721
  fileCount,
21502
21722
  " file",
@@ -21506,18 +21726,18 @@ function WorkerList({ workers, isSynthesizing, narration }) {
21506
21726
  " chars)"
21507
21727
  ] }) });
21508
21728
  })(),
21509
- workers.map((w) => /* @__PURE__ */ jsx13(WorkerRow, { worker: w }, w.id)),
21510
- showSynthesis && /* @__PURE__ */ jsx13(Box11, { marginLeft: 2, children: /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
21511
- /* @__PURE__ */ jsx13(Spinner5, { type: "dots" }),
21729
+ workers.map((w) => /* @__PURE__ */ jsx14(WorkerRow, { worker: w }, w.id)),
21730
+ showSynthesis && /* @__PURE__ */ jsx14(Box12, { marginLeft: 2, children: /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
21731
+ /* @__PURE__ */ jsx14(Spinner5, { type: "dots" }),
21512
21732
  " ",
21513
- /* @__PURE__ */ jsx13(Text12, { bold: true, children: "[coordinator]" }),
21733
+ /* @__PURE__ */ jsx14(Text13, { bold: true, children: "[coordinator]" }),
21514
21734
  " Synthesizing findings\u2026"
21515
21735
  ] }) })
21516
21736
  ] });
21517
21737
  }
21518
21738
  function WorkerRow({ worker }) {
21519
21739
  const theme = useTheme();
21520
- const [now2, setNow] = useState9(Date.now());
21740
+ const [now2, setNow] = useState10(Date.now());
21521
21741
  useEffect5(() => {
21522
21742
  if (worker.status !== "running") return;
21523
21743
  const id = setInterval(() => setNow(Date.now()), 1e3);
@@ -21525,22 +21745,22 @@ function WorkerRow({ worker }) {
21525
21745
  }, [worker.status]);
21526
21746
  const elapsed = formatElapsed6(now2 - worker.startedAt);
21527
21747
  const modeLabel2 = worker.mode === "plan" ? "research" : "executor";
21528
- const statusIcon = worker.status === "pending" ? /* @__PURE__ */ jsx13(Text12, { color: theme.muted?.color ?? theme.info.color, children: "\u2610" }) : worker.status === "running" ? /* @__PURE__ */ jsx13(Text12, { color: theme.info.color, children: /* @__PURE__ */ jsx13(Spinner5, { type: "line" }) }) : worker.status === "completed" ? /* @__PURE__ */ jsx13(Text12, { color: theme.palette.success, children: "\u2611" }) : worker.status === "budget_exhausted" ? /* @__PURE__ */ jsx13(Text12, { color: theme.info.color, children: "\u26A0" }) : /* @__PURE__ */ jsx13(Text12, { color: theme.palette.error, children: "\u2612" });
21748
+ const statusIcon = worker.status === "pending" ? /* @__PURE__ */ jsx14(Text13, { color: theme.muted?.color ?? theme.info.color, children: "\u2610" }) : worker.status === "running" ? /* @__PURE__ */ jsx14(Text13, { color: theme.info.color, children: /* @__PURE__ */ jsx14(Spinner5, { type: "line" }) }) : worker.status === "completed" ? /* @__PURE__ */ jsx14(Text13, { color: theme.palette.success, children: "\u2611" }) : worker.status === "budget_exhausted" ? /* @__PURE__ */ jsx14(Text13, { color: theme.info.color, children: "\u26A0" }) : /* @__PURE__ */ jsx14(Text13, { color: theme.palette.error, children: "\u2612" });
21529
21749
  const statusLabel = worker.status === "pending" ? "todo" : worker.status === "running" ? "ongoing" : worker.status === "completed" ? "done" : worker.status === "budget_exhausted" ? "budget hit" : "failed";
21530
21750
  const isDone = worker.status === "completed" || worker.status === "failed" || worker.status === "budget_exhausted";
21531
21751
  const hasSteps = worker.steps && worker.steps.length > 0;
21532
- return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginLeft: 2, children: [
21533
- /* @__PURE__ */ jsx13(Box11, { children: /* @__PURE__ */ jsxs11(Text12, { children: [
21752
+ return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", marginLeft: 2, children: [
21753
+ /* @__PURE__ */ jsx14(Box12, { children: /* @__PURE__ */ jsxs12(Text13, { children: [
21534
21754
  statusIcon,
21535
21755
  " ",
21536
- /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, bold: true, children: [
21756
+ /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, bold: true, children: [
21537
21757
  "[",
21538
21758
  modeLabel2,
21539
21759
  "]"
21540
21760
  ] }),
21541
21761
  " ",
21542
- /* @__PURE__ */ jsx13(
21543
- Text12,
21762
+ /* @__PURE__ */ jsx14(
21763
+ Text13,
21544
21764
  {
21545
21765
  color: isDone ? theme.muted?.color ?? theme.info.color : theme.info.color,
21546
21766
  italic: worker.status === "pending",
@@ -21548,48 +21768,48 @@ function WorkerRow({ worker }) {
21548
21768
  children: worker.task.slice(0, 60)
21549
21769
  }
21550
21770
  ),
21551
- worker.status === "running" ? /* @__PURE__ */ jsxs11(Text12, { color: theme.accent, children: [
21771
+ worker.status === "running" ? /* @__PURE__ */ jsxs12(Text13, { color: theme.accent, children: [
21552
21772
  " \xB7 ",
21553
21773
  elapsed
21554
- ] }) : /* @__PURE__ */ jsxs11(Text12, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
21774
+ ] }) : /* @__PURE__ */ jsxs12(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
21555
21775
  " ",
21556
21776
  "\xB7 ",
21557
21777
  statusLabel
21558
21778
  ] }),
21559
- worker.error ? /* @__PURE__ */ jsxs11(Text12, { color: theme.palette.error, children: [
21779
+ worker.error ? /* @__PURE__ */ jsxs12(Text13, { color: theme.palette.error, children: [
21560
21780
  " \xB7 ",
21561
21781
  worker.error.slice(0, 60)
21562
21782
  ] }) : null
21563
21783
  ] }) }),
21564
- hasSteps && /* @__PURE__ */ jsx13(Box11, { flexDirection: "column", marginLeft: 4, children: worker.steps.map((step, i) => /* @__PURE__ */ jsx13(StepRow, { step, theme }, `${worker.id}-step-${i}`)) }),
21565
- worker.logs.length > 0 && /* @__PURE__ */ jsx13(Box11, { flexDirection: "column", marginLeft: 4, children: worker.logs.slice(-3).map((line, i) => /* @__PURE__ */ jsx13(Text12, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: line.slice(0, 120) }, `${worker.id}-log-${i}`)) }),
21566
- isDone && worker.result?.phases && worker.result.phases.length > 0 && /* @__PURE__ */ jsx13(Box11, { marginLeft: 4, children: /* @__PURE__ */ jsx13(Text12, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: worker.result.phases.map((p) => `${p.name}: ${formatElapsed6(p.ms)}`).join(" \xB7 ") }) })
21784
+ hasSteps && /* @__PURE__ */ jsx14(Box12, { flexDirection: "column", marginLeft: 4, children: worker.steps.map((step, i) => /* @__PURE__ */ jsx14(StepRow, { step, theme }, `${worker.id}-step-${i}`)) }),
21785
+ worker.logs.length > 0 && /* @__PURE__ */ jsx14(Box12, { flexDirection: "column", marginLeft: 4, children: worker.logs.slice(-3).map((line, i) => /* @__PURE__ */ jsx14(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: line.slice(0, 120) }, `${worker.id}-log-${i}`)) }),
21786
+ isDone && worker.result?.phases && worker.result.phases.length > 0 && /* @__PURE__ */ jsx14(Box12, { marginLeft: 4, children: /* @__PURE__ */ jsx14(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: worker.result.phases.map((p) => `${p.name}: ${formatElapsed6(p.ms)}`).join(" \xB7 ") }) })
21567
21787
  ] });
21568
21788
  }
21569
21789
  function StepRow({ step, theme }) {
21570
21790
  if (step.status === "completed") {
21571
- return /* @__PURE__ */ jsxs11(Text12, { color: theme.palette.success, children: [
21791
+ return /* @__PURE__ */ jsxs12(Text13, { color: theme.palette.success, children: [
21572
21792
  " ",
21573
21793
  "\u2713 ",
21574
- /* @__PURE__ */ jsx13(Text12, { strikethrough: true, children: step.label })
21794
+ /* @__PURE__ */ jsx14(Text13, { strikethrough: true, children: step.label })
21575
21795
  ] });
21576
21796
  }
21577
21797
  if (step.status === "active") {
21578
- return /* @__PURE__ */ jsxs11(Text12, { color: theme.accent, bold: true, children: [
21798
+ return /* @__PURE__ */ jsxs12(Text13, { color: theme.accent, bold: true, children: [
21579
21799
  " ",
21580
- /* @__PURE__ */ jsx13(Spinner5, { type: "line" }),
21800
+ /* @__PURE__ */ jsx14(Spinner5, { type: "line" }),
21581
21801
  " ",
21582
21802
  step.label
21583
21803
  ] });
21584
21804
  }
21585
21805
  if (step.status === "failed") {
21586
- return /* @__PURE__ */ jsxs11(Text12, { color: theme.palette.error, children: [
21806
+ return /* @__PURE__ */ jsxs12(Text13, { color: theme.palette.error, children: [
21587
21807
  " ",
21588
21808
  "\u2612 ",
21589
21809
  step.label
21590
21810
  ] });
21591
21811
  }
21592
- return /* @__PURE__ */ jsxs11(Text12, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
21812
+ return /* @__PURE__ */ jsxs12(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
21593
21813
  " ",
21594
21814
  "\u2610 ",
21595
21815
  step.label
@@ -21610,9 +21830,9 @@ var init_worker_list = __esm({
21610
21830
  });
21611
21831
 
21612
21832
  // src/ui/model-picker.tsx
21613
- import { useEffect as useEffect6, useMemo as useMemo2, useState as useState10 } from "react";
21614
- import { Box as Box12, Text as Text13, useInput as useInput5 } from "ink";
21615
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
21833
+ import { useEffect as useEffect6, useMemo as useMemo2, useState as useState11 } from "react";
21834
+ import { Box as Box13, Text as Text14, useInput as useInput6 } from "ink";
21835
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
21616
21836
  function formatContext(n) {
21617
21837
  if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
21618
21838
  if (n >= 1e3) return `${Math.round(n / 1e3)}k`;
@@ -21696,9 +21916,9 @@ function buildRowsFlat(opts2) {
21696
21916
  }
21697
21917
  function ModelPicker({ current, onPick }) {
21698
21918
  const theme = useTheme();
21699
- const [query, setQuery] = useState10("");
21700
- const [page, setPage] = useState10(0);
21701
- const [selectedIndex, setSelectedIndex] = useState10(0);
21919
+ const [query, setQuery] = useState11("");
21920
+ const [page, setPage] = useState11(0);
21921
+ const [selectedIndex, setSelectedIndex] = useState11(0);
21702
21922
  const allModels = useMemo2(() => listModels(), []);
21703
21923
  const filtered = useMemo2(() => {
21704
21924
  if (!query.trim()) return allModels;
@@ -21742,7 +21962,7 @@ function ModelPicker({ current, onPick }) {
21742
21962
  useEffect6(() => {
21743
21963
  setSelectedIndex(Math.max(0, firstSelectable));
21744
21964
  }, [firstSelectable]);
21745
- useInput5((input, key) => {
21965
+ useInput6((input, key) => {
21746
21966
  if (key.escape || input === "q") {
21747
21967
  onPick(null);
21748
21968
  return;
@@ -21793,20 +22013,20 @@ function ModelPicker({ current, onPick }) {
21793
22013
  const headerIdCell = padRight("", maxIdRender + 2);
21794
22014
  const headerCtxCell = padRight("context", ctxColWidth);
21795
22015
  const headerLine = `${headerIdCell} ${headerCtxCell} in / out / cached`;
21796
- return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
21797
- /* @__PURE__ */ jsxs12(Text13, { color: theme.accent, bold: true, children: [
22016
+ return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
22017
+ /* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
21798
22018
  "Pick a model \xB7 current: ",
21799
22019
  current
21800
22020
  ] }),
21801
- /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
22021
+ /* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
21802
22022
  query ? `Search: ${query}\u258C` : "Type to search\u2026",
21803
22023
  totalPages > 1 ? ` \xB7 Page ${safePage + 1} of ${totalPages}` : "",
21804
22024
  ` \xB7 ${modelRows.length} model${modelRows.length === 1 ? "" : "s"}`
21805
22025
  ] }),
21806
- /* @__PURE__ */ jsx14(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: headerLine }) }),
21807
- /* @__PURE__ */ jsx14(Box12, { flexDirection: "column", children: pageRows.map((row, i) => {
22026
+ /* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(Text14, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: headerLine }) }),
22027
+ /* @__PURE__ */ jsx15(Box13, { flexDirection: "column", children: pageRows.map((row, i) => {
21808
22028
  if (row.kind === "header") {
21809
- return /* @__PURE__ */ jsx14(Box12, { children: /* @__PURE__ */ jsx14(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: row.label }) }, row.key);
22029
+ return /* @__PURE__ */ jsx15(Box13, { children: /* @__PURE__ */ jsx15(Text14, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: row.label }) }, row.key);
21810
22030
  }
21811
22031
  const isSelected = i === selectedIndex;
21812
22032
  const id = truncateMiddle(row.displayId, maxIdRender);
@@ -21814,12 +22034,12 @@ function ModelPicker({ current, onPick }) {
21814
22034
  const idCell = padRight(`${marker}${id}`, maxIdRender + 2);
21815
22035
  const ctxCell = padRight(row.context, ctxColWidth);
21816
22036
  const label = `${idCell} ${ctxCell} ${row.price}`;
21817
- return /* @__PURE__ */ jsx14(Box12, { children: /* @__PURE__ */ jsxs12(Text13, { color: isSelected ? theme.accent : theme.info.color, bold: isSelected, children: [
22037
+ return /* @__PURE__ */ jsx15(Box13, { children: /* @__PURE__ */ jsxs13(Text14, { color: isSelected ? theme.accent : theme.info.color, bold: isSelected, children: [
21818
22038
  isSelected ? "\u203A " : " ",
21819
22039
  label
21820
22040
  ] }) }, row.model.id);
21821
22041
  }) }),
21822
- /* @__PURE__ */ jsx14(Box12, { marginTop: 1, children: /* @__PURE__ */ jsxs12(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
22042
+ /* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsxs13(Text14, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
21823
22043
  safePage > 0 ? "\u2190 prev " : "",
21824
22044
  safePage < totalPages - 1 ? "\u2192 next " : "",
21825
22045
  "\u25CF current \xB7 type to search \xB7 Enter pick \xB7 Esc cancel"
@@ -21853,21 +22073,21 @@ var init_model_picker = __esm({
21853
22073
  });
21854
22074
 
21855
22075
  // src/ui/billing-chooser.tsx
21856
- import { Box as Box13, Text as Text14, useInput as useInput6 } from "ink";
21857
- import SelectInput3 from "ink-select-input";
21858
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
22076
+ import { Box as Box14, Text as Text15, useInput as useInput7 } from "ink";
22077
+ import SelectInput4 from "ink-select-input";
22078
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
21859
22079
  function BillingChooser({ model, onPick }) {
21860
22080
  const theme = useTheme();
21861
22081
  const name = PROVIDER_NAME[model.provider];
21862
- useInput6((_input, key) => {
22082
+ useInput7((_input, key) => {
21863
22083
  if (key.escape) onPick(null);
21864
22084
  });
21865
22085
  const items = [
21866
22086
  { label: `Use Cloudflare credits \xB7 no extra key`, value: "unified" },
21867
22087
  { label: `Use my own ${name} API key`, value: "byok" }
21868
22088
  ];
21869
- return /* @__PURE__ */ jsxs13(
21870
- Box13,
22089
+ return /* @__PURE__ */ jsxs14(
22090
+ Box14,
21871
22091
  {
21872
22092
  flexDirection: "column",
21873
22093
  borderStyle: "round",
@@ -21875,17 +22095,17 @@ function BillingChooser({ model, onPick }) {
21875
22095
  paddingX: 2,
21876
22096
  paddingY: 1,
21877
22097
  children: [
21878
- /* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
22098
+ /* @__PURE__ */ jsxs14(Text15, { color: theme.accent, bold: true, children: [
21879
22099
  "Pay for ",
21880
22100
  name
21881
22101
  ] }),
21882
- /* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsxs13(Text14, { children: [
22102
+ /* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsxs14(Text15, { children: [
21883
22103
  "You picked ",
21884
- /* @__PURE__ */ jsx15(Text14, { bold: true, children: model.id }),
22104
+ /* @__PURE__ */ jsx16(Text15, { bold: true, children: model.id }),
21885
22105
  ". How would you like to pay for it?"
21886
22106
  ] }) }),
21887
- /* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(SelectInput3, { items, onSelect: (item) => onPick(item.value) }) }),
21888
- /* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(Text14, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "\u2191/\u2193 select \xB7 Enter \xB7 Esc cancel" }) })
22107
+ /* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(SelectInput4, { items, onSelect: (item) => onPick(item.value) }) }),
22108
+ /* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text15, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "\u2191/\u2193 select \xB7 Enter \xB7 Esc cancel" }) })
21889
22109
  ]
21890
22110
  }
21891
22111
  );
@@ -21977,10 +22197,10 @@ var init_probe_unified_billing = __esm({
21977
22197
  });
21978
22198
 
21979
22199
  // src/ui/unified-billing-status.tsx
21980
- import { useEffect as useEffect7, useState as useState11 } from "react";
21981
- import { Box as Box14, Text as Text15, useInput as useInput7 } from "ink";
21982
- import SelectInput4 from "ink-select-input";
21983
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
22200
+ import { useEffect as useEffect7, useState as useState12 } from "react";
22201
+ import { Box as Box15, Text as Text16, useInput as useInput8 } from "ink";
22202
+ import SelectInput5 from "ink-select-input";
22203
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
21984
22204
  function UnifiedBillingStatus({
21985
22205
  model,
21986
22206
  accountId,
@@ -21989,8 +22209,8 @@ function UnifiedBillingStatus({
21989
22209
  onResolve
21990
22210
  }) {
21991
22211
  const theme = useTheme();
21992
- const [phase, setPhase] = useState11({ kind: "probing" });
21993
- const [attempt, setAttempt] = useState11(0);
22212
+ const [phase, setPhase] = useState12({ kind: "probing" });
22213
+ const [attempt, setAttempt] = useState12(0);
21994
22214
  const name = PROVIDER_NAME2[model.provider];
21995
22215
  useEffect7(() => {
21996
22216
  let cancelled = false;
@@ -22025,21 +22245,21 @@ function UnifiedBillingStatus({
22025
22245
  cancelled = true;
22026
22246
  };
22027
22247
  }, [attempt]);
22028
- useInput7((_input, key) => {
22248
+ useInput8((_input, key) => {
22029
22249
  if (key.escape) onResolve("cancelled");
22030
22250
  });
22031
22251
  if (phase.kind === "probing") {
22032
- return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: [
22033
- /* @__PURE__ */ jsxs14(Text15, { color: theme.accent, bold: true, children: [
22252
+ return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: [
22253
+ /* @__PURE__ */ jsxs15(Text16, { color: theme.accent, bold: true, children: [
22034
22254
  "Enabling unified billing for ",
22035
22255
  name,
22036
22256
  "\u2026"
22037
22257
  ] }),
22038
- /* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text15, { color: theme.info.color, dimColor: true, children: "Sending a 1-token test request through your AI Gateway. This takes a moment." }) })
22258
+ /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.info.color, dimColor: true, children: "Sending a 1-token test request through your AI Gateway. This takes a moment." }) })
22039
22259
  ] });
22040
22260
  }
22041
22261
  if (phase.kind === "success") {
22042
- return /* @__PURE__ */ jsx16(Box14, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: /* @__PURE__ */ jsxs14(Text15, { color: theme.accent, bold: true, children: [
22262
+ return /* @__PURE__ */ jsx17(Box15, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: /* @__PURE__ */ jsxs15(Text16, { color: theme.accent, bold: true, children: [
22043
22263
  "\u2713 done \u2014 ",
22044
22264
  name,
22045
22265
  " billed via your Cloudflare credits."
@@ -22055,45 +22275,45 @@ function UnifiedBillingStatus({
22055
22275
  { label: `Use my own ${name} API key instead`, value: "byok" },
22056
22276
  { label: "Cancel", value: "cancel" }
22057
22277
  ];
22058
- return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: [
22059
- /* @__PURE__ */ jsxs14(Text15, { color: theme.accent, bold: true, children: [
22278
+ return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: [
22279
+ /* @__PURE__ */ jsxs15(Text16, { color: theme.accent, bold: true, children: [
22060
22280
  name,
22061
22281
  " needs Cloudflare credits before Unified Billing can pay for it."
22062
22282
  ] }),
22063
- /* @__PURE__ */ jsxs14(Box14, { marginTop: 1, flexDirection: "column", children: [
22064
- /* @__PURE__ */ jsx16(Text15, { children: "Step-by-step (Unified Billing is implicit \u2014 adding credits IS enabling it):" }),
22065
- /* @__PURE__ */ jsx16(Text15, { children: " 1. Open the AI Gateway Credits page:" }),
22066
- /* @__PURE__ */ jsx16(Text15, { color: theme.accent, underline: true, children: ` https://dash.cloudflare.com/${accountId}/ai/ai-gateway/credits` }),
22067
- /* @__PURE__ */ jsx16(Text15, { children: " 2. Add a payment method if you don't have one yet." }),
22068
- /* @__PURE__ */ jsxs14(Text15, { children: [
22283
+ /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
22284
+ /* @__PURE__ */ jsx17(Text16, { children: "Step-by-step (Unified Billing is implicit \u2014 adding credits IS enabling it):" }),
22285
+ /* @__PURE__ */ jsx17(Text16, { children: " 1. Open the AI Gateway Credits page:" }),
22286
+ /* @__PURE__ */ jsx17(Text16, { color: theme.accent, underline: true, children: ` https://dash.cloudflare.com/${accountId}/ai/ai-gateway/credits` }),
22287
+ /* @__PURE__ */ jsx17(Text16, { children: " 2. Add a payment method if you don't have one yet." }),
22288
+ /* @__PURE__ */ jsxs15(Text16, { children: [
22069
22289
  " 3. Click ",
22070
- /* @__PURE__ */ jsx16(Text15, { bold: true, children: '"Top-up credits"' }),
22290
+ /* @__PURE__ */ jsx17(Text16, { bold: true, children: '"Top-up credits"' }),
22071
22291
  " and confirm the amount."
22072
22292
  ] }),
22073
- /* @__PURE__ */ jsxs14(Text15, { children: [
22293
+ /* @__PURE__ */ jsxs15(Text16, { children: [
22074
22294
  " 4. Come back here and pick ",
22075
- /* @__PURE__ */ jsx16(Text15, { bold: true, children: `"I've enabled it \u2014 try again"` }),
22295
+ /* @__PURE__ */ jsx17(Text16, { bold: true, children: `"I've enabled it \u2014 try again"` }),
22076
22296
  "."
22077
22297
  ] }),
22078
- /* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text15, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Credits are one account-wide pool. Confirmed providers: OpenAI & Anthropic. Others (Google, Groq, xAI) may not be supported yet \u2014 the retry will tell you." }) }),
22079
- /* @__PURE__ */ jsx16(Box14, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx16(Text15, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: 'Hint: if you already have credits, your gateway probably has Authentication turned off. CF needs it ON for Unified Billing to activate. Picking "Enable Authentication" above flips it for you.' }) }),
22080
- phase.eventId ? /* @__PURE__ */ jsxs14(Box14, { marginTop: 1, flexDirection: "column", children: [
22081
- /* @__PURE__ */ jsxs14(Text15, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
22298
+ /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Credits are one account-wide pool. Confirmed providers: OpenAI & Anthropic. Others (Google, Groq, xAI) may not be supported yet \u2014 the retry will tell you." }) }),
22299
+ /* @__PURE__ */ jsx17(Box15, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: 'Hint: if you already have credits, your gateway probably has Authentication turned off. CF needs it ON for Unified Billing to activate. Picking "Enable Authentication" above flips it for you.' }) }),
22300
+ phase.eventId ? /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
22301
+ /* @__PURE__ */ jsxs15(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
22082
22302
  "Debug \xB7 HTTP ",
22083
22303
  phase.status,
22084
22304
  " \xB7 cf-aig-event-id: ",
22085
22305
  phase.eventId
22086
22306
  ] }),
22087
- /* @__PURE__ */ jsx16(Text15, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Look up the full upstream error at:" }),
22088
- /* @__PURE__ */ jsx16(Text15, { color: theme.accent, underline: true, children: ` https://dash.cloudflare.com/${accountId}/ai/ai-gateway/gateways/${gatewayId}/logs` }),
22089
- /* @__PURE__ */ jsxs14(Text15, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
22307
+ /* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Look up the full upstream error at:" }),
22308
+ /* @__PURE__ */ jsx17(Text16, { color: theme.accent, underline: true, children: ` https://dash.cloudflare.com/${accountId}/ai/ai-gateway/gateways/${gatewayId}/logs` }),
22309
+ /* @__PURE__ */ jsxs15(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
22090
22310
  "CF response: ",
22091
22311
  phase.message
22092
22312
  ] })
22093
22313
  ] }) : null
22094
22314
  ] }),
22095
- /* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(
22096
- SelectInput4,
22315
+ /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(
22316
+ SelectInput5,
22097
22317
  {
22098
22318
  items: items2,
22099
22319
  onSelect: (item) => {
@@ -22129,21 +22349,21 @@ function UnifiedBillingStatus({
22129
22349
  { label: `Use my own ${name} API key instead`, value: "byok" },
22130
22350
  { label: "Cancel", value: "cancel" }
22131
22351
  ];
22132
- return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: [
22133
- /* @__PURE__ */ jsx16(Text15, { color: theme.accent, bold: true, children: "Couldn't reach your AI Gateway." }),
22134
- /* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text15, { color: theme.info.color, children: phase.message }) }),
22135
- phase.eventId ? /* @__PURE__ */ jsxs14(Box14, { marginTop: 1, flexDirection: "column", children: [
22136
- /* @__PURE__ */ jsxs14(Text15, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
22352
+ return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: [
22353
+ /* @__PURE__ */ jsx17(Text16, { color: theme.accent, bold: true, children: "Couldn't reach your AI Gateway." }),
22354
+ /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.info.color, children: phase.message }) }),
22355
+ phase.eventId ? /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
22356
+ /* @__PURE__ */ jsxs15(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
22137
22357
  "Debug \xB7 HTTP ",
22138
22358
  phase.status,
22139
22359
  " \xB7 cf-aig-event-id: ",
22140
22360
  phase.eventId
22141
22361
  ] }),
22142
- /* @__PURE__ */ jsx16(Text15, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Look up the full upstream error at:" }),
22143
- /* @__PURE__ */ jsx16(Text15, { color: theme.accent, underline: true, children: ` https://dash.cloudflare.com/${accountId}/ai/ai-gateway/gateways/${gatewayId}/logs` })
22362
+ /* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Look up the full upstream error at:" }),
22363
+ /* @__PURE__ */ jsx17(Text16, { color: theme.accent, underline: true, children: ` https://dash.cloudflare.com/${accountId}/ai/ai-gateway/gateways/${gatewayId}/logs` })
22144
22364
  ] }) : null,
22145
- /* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(
22146
- SelectInput4,
22365
+ /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(
22366
+ SelectInput5,
22147
22367
  {
22148
22368
  items,
22149
22369
  onSelect: (item) => {
@@ -22257,10 +22477,10 @@ var init_secrets_store = __esm({
22257
22477
  });
22258
22478
 
22259
22479
  // src/ui/key-entry-modal.tsx
22260
- import { useState as useState12 } from "react";
22261
- import { Box as Box15, Text as Text16, useInput as useInput8 } from "ink";
22262
- import SelectInput5 from "ink-select-input";
22263
- import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
22480
+ import { useState as useState13 } from "react";
22481
+ import { Box as Box16, Text as Text17, useInput as useInput9 } from "ink";
22482
+ import SelectInput6 from "ink-select-input";
22483
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
22264
22484
  function maskPreview(value) {
22265
22485
  if (!value) return "";
22266
22486
  if (value.length <= 8) return "\u2022".repeat(value.length);
@@ -22275,11 +22495,11 @@ function KeyEntryModal({
22275
22495
  onCancel
22276
22496
  }) {
22277
22497
  const theme = useTheme();
22278
- const [value, setValue] = useState12("");
22279
- const [reveal, setReveal] = useState12(false);
22280
- const [phase, setPhase] = useState12({ kind: "collecting" });
22498
+ const [value, setValue] = useState13("");
22499
+ const [reveal, setReveal] = useState13(false);
22500
+ const [phase, setPhase] = useState13({ kind: "collecting" });
22281
22501
  const info = PROVIDER_INFO[model.provider];
22282
- useInput8((input, key) => {
22502
+ useInput9((input, key) => {
22283
22503
  if (key.escape && phase.kind === "collecting") {
22284
22504
  onCancel();
22285
22505
  return;
@@ -22327,8 +22547,8 @@ function KeyEntryModal({
22327
22547
  void upload(trimmed);
22328
22548
  };
22329
22549
  if (phase.kind === "uploading") {
22330
- return /* @__PURE__ */ jsxs15(
22331
- Box15,
22550
+ return /* @__PURE__ */ jsxs16(
22551
+ Box16,
22332
22552
  {
22333
22553
  flexDirection: "column",
22334
22554
  borderStyle: "round",
@@ -22336,8 +22556,8 @@ function KeyEntryModal({
22336
22556
  paddingX: 2,
22337
22557
  paddingY: 1,
22338
22558
  children: [
22339
- /* @__PURE__ */ jsx17(Text16, { color: theme.accent, bold: true, children: "Storing in Cloudflare Secrets Store\u2026" }),
22340
- /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.info.color, dimColor: true, children: "Your key never touches disk \u2014 it's being pushed straight to Cloudflare with scope: ai_gateway." }) })
22559
+ /* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Storing in Cloudflare Secrets Store\u2026" }),
22560
+ /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: true, children: "Your key never touches disk \u2014 it's being pushed straight to Cloudflare with scope: ai_gateway." }) })
22341
22561
  ]
22342
22562
  }
22343
22563
  );
@@ -22348,8 +22568,8 @@ function KeyEntryModal({
22348
22568
  { label: "Store the key locally instead (\u26A0 less safe)", value: "local" },
22349
22569
  { label: "Cancel", value: "cancel" }
22350
22570
  ];
22351
- return /* @__PURE__ */ jsxs15(
22352
- Box15,
22571
+ return /* @__PURE__ */ jsxs16(
22572
+ Box16,
22353
22573
  {
22354
22574
  flexDirection: "column",
22355
22575
  borderStyle: "round",
@@ -22357,17 +22577,17 @@ function KeyEntryModal({
22357
22577
  paddingX: 2,
22358
22578
  paddingY: 1,
22359
22579
  children: [
22360
- /* @__PURE__ */ jsx17(Text16, { color: theme.accent, bold: true, children: "Your Cloudflare token can't write to Secrets Store." }),
22361
- /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
22362
- /* @__PURE__ */ jsxs15(Text16, { color: theme.info.color, children: [
22580
+ /* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Your Cloudflare token can't write to Secrets Store." }),
22581
+ /* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
22582
+ /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
22363
22583
  "To keep your key off disk, add the ",
22364
- /* @__PURE__ */ jsx17(Text16, { bold: true, children: "Secrets Store Edit" }),
22584
+ /* @__PURE__ */ jsx18(Text17, { bold: true, children: "Secrets Store Edit" }),
22365
22585
  " permission to your token at:"
22366
22586
  ] }),
22367
- /* @__PURE__ */ jsx17(Text16, { color: theme.accent, underline: true, children: "https://dash.cloudflare.com/profile/api-tokens" })
22587
+ /* @__PURE__ */ jsx18(Text17, { color: theme.accent, underline: true, children: "https://dash.cloudflare.com/profile/api-tokens" })
22368
22588
  ] }),
22369
- /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(
22370
- SelectInput5,
22589
+ /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
22590
+ SelectInput6,
22371
22591
  {
22372
22592
  items: fallbackItems,
22373
22593
  onSelect: (item) => {
@@ -22381,14 +22601,14 @@ function KeyEntryModal({
22381
22601
  }
22382
22602
  }
22383
22603
  ) }),
22384
- /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Local fallback writes to ~/.config/kimiflare/config.json (mode 600). Do not commit that file." }) })
22604
+ /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Local fallback writes to ~/.config/kimiflare/config.json (mode 600). Do not commit that file." }) })
22385
22605
  ]
22386
22606
  }
22387
22607
  );
22388
22608
  }
22389
22609
  if (phase.kind === "error") {
22390
- return /* @__PURE__ */ jsxs15(
22391
- Box15,
22610
+ return /* @__PURE__ */ jsxs16(
22611
+ Box16,
22392
22612
  {
22393
22613
  flexDirection: "column",
22394
22614
  borderStyle: "round",
@@ -22396,10 +22616,10 @@ function KeyEntryModal({
22396
22616
  paddingX: 2,
22397
22617
  paddingY: 1,
22398
22618
  children: [
22399
- /* @__PURE__ */ jsx17(Text16, { color: theme.accent, bold: true, children: "Couldn't store the key." }),
22400
- /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.info.color, children: phase.message }) }),
22401
- /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(
22402
- SelectInput5,
22619
+ /* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Couldn't store the key." }),
22620
+ /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: phase.message }) }),
22621
+ /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
22622
+ SelectInput6,
22403
22623
  {
22404
22624
  items: [
22405
22625
  { label: "Try again", value: "retry" },
@@ -22415,8 +22635,8 @@ function KeyEntryModal({
22415
22635
  }
22416
22636
  );
22417
22637
  }
22418
- return /* @__PURE__ */ jsxs15(
22419
- Box15,
22638
+ return /* @__PURE__ */ jsxs16(
22639
+ Box16,
22420
22640
  {
22421
22641
  flexDirection: "column",
22422
22642
  borderStyle: "round",
@@ -22424,39 +22644,39 @@ function KeyEntryModal({
22424
22644
  paddingX: 2,
22425
22645
  paddingY: 1,
22426
22646
  children: [
22427
- /* @__PURE__ */ jsxs15(Text16, { color: theme.accent, bold: true, children: [
22647
+ /* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
22428
22648
  "Connect ",
22429
22649
  info.name
22430
22650
  ] }),
22431
- /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
22432
- /* @__PURE__ */ jsxs15(Text16, { children: [
22651
+ /* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
22652
+ /* @__PURE__ */ jsxs16(Text17, { children: [
22433
22653
  "To use ",
22434
- /* @__PURE__ */ jsx17(Text16, { bold: true, children: model.id }),
22654
+ /* @__PURE__ */ jsx18(Text17, { bold: true, children: model.id }),
22435
22655
  ", kimi-code needs your ",
22436
22656
  info.name,
22437
22657
  " API key."
22438
22658
  ] }),
22439
- /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsxs15(Text16, { children: [
22659
+ /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsxs16(Text17, { children: [
22440
22660
  "1. Get a key here:",
22441
22661
  " ",
22442
- /* @__PURE__ */ jsx17(Text16, { color: theme.accent, underline: true, children: info.url })
22662
+ /* @__PURE__ */ jsx18(Text17, { color: theme.accent, underline: true, children: info.url })
22443
22663
  ] }) }),
22444
- /* @__PURE__ */ jsx17(Text16, { children: "2. Paste it below and press Enter." }),
22445
- /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: info.hint }) })
22664
+ /* @__PURE__ */ jsx18(Text17, { children: "2. Paste it below and press Enter." }),
22665
+ /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: info.hint }) })
22446
22666
  ] }),
22447
- /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
22448
- /* @__PURE__ */ jsx17(Text16, { color: theme.info.color, children: "API key:" }),
22449
- reveal ? /* @__PURE__ */ jsx17(CustomTextInput, { value, onChange: setValue, onSubmit: submit, focus: true }) : /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", children: [
22450
- /* @__PURE__ */ jsx17(Text16, { children: maskPreview(value) || " " }),
22451
- /* @__PURE__ */ jsx17(Box15, { height: 0, overflow: "hidden", children: /* @__PURE__ */ jsx17(CustomTextInput, { value, onChange: setValue, onSubmit: submit, focus: true }) })
22667
+ /* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
22668
+ /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "API key:" }),
22669
+ reveal ? /* @__PURE__ */ jsx18(CustomTextInput, { value, onChange: setValue, onSubmit: submit, focus: true }) : /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", children: [
22670
+ /* @__PURE__ */ jsx18(Text17, { children: maskPreview(value) || " " }),
22671
+ /* @__PURE__ */ jsx18(Box16, { height: 0, overflow: "hidden", children: /* @__PURE__ */ jsx18(CustomTextInput, { value, onChange: setValue, onSubmit: submit, focus: true }) })
22452
22672
  ] })
22453
22673
  ] }),
22454
- /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsxs15(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
22674
+ /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsxs16(Text17, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
22455
22675
  "Enter to save \xB7 Ctrl+R to ",
22456
22676
  reveal ? "hide" : "reveal",
22457
22677
  " \xB7 Esc to cancel"
22458
22678
  ] }) }),
22459
- /* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Key never touches disk. Pushed to Cloudflare Secrets Store (scope: ai_gateway), then referenced by alias on every request. Audit: src/agent/secrets-store.ts \xB7 src/agent/client.ts" }) })
22679
+ /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Key never touches disk. Pushed to Cloudflare Secrets Store (scope: ai_gateway), then referenced by alias on every request. Audit: src/agent/secrets-store.ts \xB7 src/agent/client.ts" }) })
22460
22680
  ]
22461
22681
  }
22462
22682
  );
@@ -22499,31 +22719,31 @@ var init_key_entry_modal = __esm({
22499
22719
  });
22500
22720
 
22501
22721
  // src/ui/onboarding.tsx
22502
- import { useState as useState13, useCallback as useCallback3, useEffect as useEffect8 } from "react";
22503
- import { Box as Box16, Text as Text17, useInput as useInput9 } from "ink";
22504
- import { Fragment, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
22722
+ import { useState as useState14, useCallback as useCallback3, useEffect as useEffect8 } from "react";
22723
+ import { Box as Box17, Text as Text18, useInput as useInput10 } from "ink";
22724
+ import { Fragment, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
22505
22725
  function Onboarding({ onDone, onCancel }) {
22506
22726
  const theme = useTheme();
22507
- const [step, setStep] = useState13("accountId");
22508
- const [accountId, setAccountId] = useState13("");
22509
- const [apiToken, setApiToken] = useState13("");
22510
- const [model, setModel] = useState13(DEFAULT_MODEL);
22511
- const [savedPath, setSavedPath] = useState13(null);
22512
- const [useGateway, setUseGateway] = useState13(null);
22513
- const [routingPickIdx, setRoutingPickIdx] = useState13(0);
22514
- const [gateways, setGateways] = useState13([]);
22515
- const [gatewayPickIdx, setGatewayPickIdx] = useState13(0);
22516
- const [aiGatewayId, setAiGatewayId] = useState13("");
22517
- const [gatewayNewName, setGatewayNewName] = useState13("kimiflare");
22518
- const [gatewayManualId, setGatewayManualId] = useState13("");
22519
- const [gatewayError, setGatewayError] = useState13(null);
22520
- const [gatewayProbeMsg, setGatewayProbeMsg] = useState13(null);
22521
- const [pickedEntry, setPickedEntry] = useState13(null);
22522
- const [unifiedBilling, setUnifiedBilling] = useState13(false);
22523
- const [providerKeyAliases, setProviderKeyAliases] = useState13({});
22524
- const [providerKeys, setProviderKeys] = useState13({});
22525
- const [secretsStoreId, setSecretsStoreId] = useState13(void 0);
22526
- useInput9(
22727
+ const [step, setStep] = useState14("accountId");
22728
+ const [accountId, setAccountId] = useState14("");
22729
+ const [apiToken, setApiToken] = useState14("");
22730
+ const [model, setModel] = useState14(DEFAULT_MODEL);
22731
+ const [savedPath, setSavedPath] = useState14(null);
22732
+ const [useGateway, setUseGateway] = useState14(null);
22733
+ const [routingPickIdx, setRoutingPickIdx] = useState14(0);
22734
+ const [gateways, setGateways] = useState14([]);
22735
+ const [gatewayPickIdx, setGatewayPickIdx] = useState14(0);
22736
+ const [aiGatewayId, setAiGatewayId] = useState14("");
22737
+ const [gatewayNewName, setGatewayNewName] = useState14("kimiflare");
22738
+ const [gatewayManualId, setGatewayManualId] = useState14("");
22739
+ const [gatewayError, setGatewayError] = useState14(null);
22740
+ const [gatewayProbeMsg, setGatewayProbeMsg] = useState14(null);
22741
+ const [pickedEntry, setPickedEntry] = useState14(null);
22742
+ const [unifiedBilling, setUnifiedBilling] = useState14(false);
22743
+ const [providerKeyAliases, setProviderKeyAliases] = useState14({});
22744
+ const [providerKeys, setProviderKeys] = useState14({});
22745
+ const [secretsStoreId, setSecretsStoreId] = useState14(void 0);
22746
+ useInput10(
22527
22747
  useCallback3(
22528
22748
  (_input, key) => {
22529
22749
  if (key.escape && onCancel) {
@@ -22533,7 +22753,7 @@ function Onboarding({ onDone, onCancel }) {
22533
22753
  [onCancel]
22534
22754
  )
22535
22755
  );
22536
- useInput9(
22756
+ useInput10(
22537
22757
  (_input, key) => {
22538
22758
  if (step !== "routingMode") return;
22539
22759
  const total = 2;
@@ -22552,7 +22772,7 @@ function Onboarding({ onDone, onCancel }) {
22552
22772
  }
22553
22773
  }
22554
22774
  );
22555
- useInput9(
22775
+ useInput10(
22556
22776
  (_input, key) => {
22557
22777
  if (step !== "gatewayPick") return;
22558
22778
  const total = gateways.length + 1;
@@ -22720,26 +22940,26 @@ function Onboarding({ onDone, onCancel }) {
22720
22940
  const visibleSteps = ["accountId", "apiToken", "routingMode", "model", "confirm"];
22721
22941
  const stepIndex = Math.max(1, visibleSteps.indexOf(step) === -1 ? 3 : visibleSteps.indexOf(step) + 1);
22722
22942
  const totalSteps = visibleSteps.length;
22723
- return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", paddingY: 1, children: [
22724
- /* @__PURE__ */ jsxs16(Box16, { marginBottom: 1, children: [
22725
- /* @__PURE__ */ jsx18(Text17, { bold: true, color: theme.palette.primary, children: "kimiflare" }),
22726
- /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
22943
+ return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", paddingY: 1, children: [
22944
+ /* @__PURE__ */ jsxs17(Box17, { marginBottom: 1, children: [
22945
+ /* @__PURE__ */ jsx19(Text18, { bold: true, color: theme.palette.primary, children: "kimiflare" }),
22946
+ /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
22727
22947
  " ",
22728
22948
  "Terminal coding agent"
22729
22949
  ] })
22730
22950
  ] }),
22731
- /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
22951
+ /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
22732
22952
  "Step ",
22733
22953
  stepIndex,
22734
22954
  " of ",
22735
22955
  totalSteps
22736
22956
  ] }),
22737
- /* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
22738
- step === "accountId" && /* @__PURE__ */ jsxs16(Fragment, { children: [
22739
- /* @__PURE__ */ jsx18(Text17, { children: "Enter your Cloudflare Account ID" }),
22740
- /* @__PURE__ */ jsxs16(Box16, { marginTop: 1, children: [
22741
- /* @__PURE__ */ jsx18(Text17, { color: theme.palette.primary, children: "\u203A " }),
22742
- /* @__PURE__ */ jsx18(
22957
+ /* @__PURE__ */ jsxs17(Box17, { marginTop: 1, flexDirection: "column", children: [
22958
+ step === "accountId" && /* @__PURE__ */ jsxs17(Fragment, { children: [
22959
+ /* @__PURE__ */ jsx19(Text18, { children: "Enter your Cloudflare Account ID" }),
22960
+ /* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
22961
+ /* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "\u203A " }),
22962
+ /* @__PURE__ */ jsx19(
22743
22963
  CustomTextInput,
22744
22964
  {
22745
22965
  value: accountId,
@@ -22749,13 +22969,13 @@ function Onboarding({ onDone, onCancel }) {
22749
22969
  )
22750
22970
  ] })
22751
22971
  ] }),
22752
- step === "apiToken" && /* @__PURE__ */ jsxs16(Fragment, { children: [
22753
- /* @__PURE__ */ jsx18(Text17, { children: "Enter your Cloudflare API Token" }),
22754
- /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Create one at https://dash.cloudflare.com/profile/api-tokens" }),
22755
- /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Required permissions: Workers AI:Read, AI Gateway:Read, AI Gateway:Edit" }),
22756
- /* @__PURE__ */ jsxs16(Box16, { marginTop: 1, children: [
22757
- /* @__PURE__ */ jsx18(Text17, { color: theme.palette.primary, children: "\u203A " }),
22758
- /* @__PURE__ */ jsx18(
22972
+ step === "apiToken" && /* @__PURE__ */ jsxs17(Fragment, { children: [
22973
+ /* @__PURE__ */ jsx19(Text18, { children: "Enter your Cloudflare API Token" }),
22974
+ /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Create one at https://dash.cloudflare.com/profile/api-tokens" }),
22975
+ /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Required permissions: Workers AI:Read, AI Gateway:Read, AI Gateway:Edit" }),
22976
+ /* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
22977
+ /* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "\u203A " }),
22978
+ /* @__PURE__ */ jsx19(
22759
22979
  CustomTextInput,
22760
22980
  {
22761
22981
  value: apiToken,
@@ -22766,50 +22986,50 @@ function Onboarding({ onDone, onCancel }) {
22766
22986
  )
22767
22987
  ] })
22768
22988
  ] }),
22769
- step === "routingMode" && /* @__PURE__ */ jsxs16(Fragment, { children: [
22770
- /* @__PURE__ */ jsx18(Text17, { children: "Choose how to route AI requests" }),
22771
- /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Use \u2191/\u2193 to navigate, Enter to select." }),
22772
- /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", marginTop: 1, children: [
22773
- /* @__PURE__ */ jsxs16(Text17, { color: routingPickIdx === 0 ? theme.palette.primary : void 0, children: [
22989
+ step === "routingMode" && /* @__PURE__ */ jsxs17(Fragment, { children: [
22990
+ /* @__PURE__ */ jsx19(Text18, { children: "Choose how to route AI requests" }),
22991
+ /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Use \u2191/\u2193 to navigate, Enter to select." }),
22992
+ /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", marginTop: 1, children: [
22993
+ /* @__PURE__ */ jsxs17(Text18, { color: routingPickIdx === 0 ? theme.palette.primary : void 0, children: [
22774
22994
  routingPickIdx === 0 ? "\u203A " : " ",
22775
22995
  "Workers AI (direct) \u2014 fastest, no gateway overhead"
22776
22996
  ] }),
22777
- /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, dimColor: true, children: [
22997
+ /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, dimColor: true, children: [
22778
22998
  " ",
22779
22999
  "Recommended for the best terminal experience. Uses Cloudflare Workers AI directly."
22780
23000
  ] }),
22781
- /* @__PURE__ */ jsx18(Text17, { children: " " }),
22782
- /* @__PURE__ */ jsxs16(Text17, { color: routingPickIdx === 1 ? theme.palette.primary : void 0, children: [
23001
+ /* @__PURE__ */ jsx19(Text18, { children: " " }),
23002
+ /* @__PURE__ */ jsxs17(Text18, { color: routingPickIdx === 1 ? theme.palette.primary : void 0, children: [
22783
23003
  routingPickIdx === 1 ? "\u203A " : " ",
22784
23004
  "AI Gateway \u2014 logs, caching, multi-provider support"
22785
23005
  ] }),
22786
- /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, dimColor: true, children: [
23006
+ /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, dimColor: true, children: [
22787
23007
  " ",
22788
23008
  "Slightly higher latency, but gives you a dashboard, request logs, and the ability to use non-Workers-AI models later."
22789
23009
  ] })
22790
23010
  ] })
22791
23011
  ] }),
22792
- step === "gatewayLoading" && /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Looking up your AI Gateways\u2026" }),
22793
- step === "gatewayPick" && /* @__PURE__ */ jsxs16(Fragment, { children: [
22794
- /* @__PURE__ */ jsx18(Text17, { children: "Pick an AI Gateway to route requests through" }),
22795
- /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Use \u2191/\u2193 to navigate, Enter to select." }),
22796
- /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", marginTop: 1, children: [
22797
- gateways.map((gw, i) => /* @__PURE__ */ jsxs16(Text17, { color: i === gatewayPickIdx ? theme.palette.primary : void 0, children: [
23012
+ step === "gatewayLoading" && /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Looking up your AI Gateways\u2026" }),
23013
+ step === "gatewayPick" && /* @__PURE__ */ jsxs17(Fragment, { children: [
23014
+ /* @__PURE__ */ jsx19(Text18, { children: "Pick an AI Gateway to route requests through" }),
23015
+ /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Use \u2191/\u2193 to navigate, Enter to select." }),
23016
+ /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", marginTop: 1, children: [
23017
+ gateways.map((gw, i) => /* @__PURE__ */ jsxs17(Text18, { color: i === gatewayPickIdx ? theme.palette.primary : void 0, children: [
22798
23018
  i === gatewayPickIdx ? "\u203A " : " ",
22799
23019
  gw.id
22800
23020
  ] }, gw.id)),
22801
- /* @__PURE__ */ jsxs16(Text17, { color: gatewayPickIdx === gateways.length ? theme.palette.primary : void 0, children: [
23021
+ /* @__PURE__ */ jsxs17(Text18, { color: gatewayPickIdx === gateways.length ? theme.palette.primary : void 0, children: [
22802
23022
  gatewayPickIdx === gateways.length ? "\u203A " : " ",
22803
23023
  "+ Create new\u2026"
22804
23024
  ] })
22805
23025
  ] })
22806
23026
  ] }),
22807
- step === "gatewayCreate" && /* @__PURE__ */ jsxs16(Fragment, { children: [
22808
- /* @__PURE__ */ jsx18(Text17, { children: "Name for your new AI Gateway" }),
22809
- /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Lowercase letters, numbers, _ and - only. Default: kimiflare" }),
22810
- /* @__PURE__ */ jsxs16(Box16, { marginTop: 1, children: [
22811
- /* @__PURE__ */ jsx18(Text17, { color: theme.palette.primary, children: "\u203A " }),
22812
- /* @__PURE__ */ jsx18(
23027
+ step === "gatewayCreate" && /* @__PURE__ */ jsxs17(Fragment, { children: [
23028
+ /* @__PURE__ */ jsx19(Text18, { children: "Name for your new AI Gateway" }),
23029
+ /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Lowercase letters, numbers, _ and - only. Default: kimiflare" }),
23030
+ /* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
23031
+ /* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "\u203A " }),
23032
+ /* @__PURE__ */ jsx19(
22813
23033
  CustomTextInput,
22814
23034
  {
22815
23035
  value: gatewayNewName,
@@ -22819,25 +23039,25 @@ function Onboarding({ onDone, onCancel }) {
22819
23039
  )
22820
23040
  ] })
22821
23041
  ] }),
22822
- step === "gatewayProbing" && /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Verifying gateway routing\u2026" }),
22823
- step === "gatewayScopeError" && /* @__PURE__ */ jsxs16(Fragment, { children: [
22824
- /* @__PURE__ */ jsxs16(Text17, { color: theme.palette.error ?? "red", children: [
23042
+ step === "gatewayProbing" && /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Verifying gateway routing\u2026" }),
23043
+ step === "gatewayScopeError" && /* @__PURE__ */ jsxs17(Fragment, { children: [
23044
+ /* @__PURE__ */ jsxs17(Text18, { color: theme.palette.error ?? "red", children: [
22825
23045
  "Couldn't reach AI Gateway: ",
22826
23046
  gatewayError ?? "permission denied"
22827
23047
  ] }),
22828
- /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", marginTop: 1, children: [
22829
- /* @__PURE__ */ jsx18(Text17, { children: "Your API token likely lacks the required scopes." }),
22830
- /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Required permissions:" }),
22831
- /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: " \u2022 AI Gateway:Read (to list gateways)" }),
22832
- /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: " \u2022 AI Gateway:Edit (to create one)" }),
22833
- /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: " \u2022 Workers AI:Read (to run models)" }),
22834
- /* @__PURE__ */ jsx18(Text17, { children: "Edit your token at: https://dash.cloudflare.com/profile/api-tokens" })
23048
+ /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", marginTop: 1, children: [
23049
+ /* @__PURE__ */ jsx19(Text18, { children: "Your API token likely lacks the required scopes." }),
23050
+ /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Required permissions:" }),
23051
+ /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: " \u2022 AI Gateway:Read (to list gateways)" }),
23052
+ /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: " \u2022 AI Gateway:Edit (to create one)" }),
23053
+ /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: " \u2022 Workers AI:Read (to run models)" }),
23054
+ /* @__PURE__ */ jsx19(Text18, { children: "Edit your token at: https://dash.cloudflare.com/profile/api-tokens" })
22835
23055
  ] }),
22836
- /* @__PURE__ */ jsx18(Text17, { children: " " }),
22837
- /* @__PURE__ */ jsx18(Text17, { children: "Press Enter to retry, or type a Gateway ID manually below." }),
22838
- /* @__PURE__ */ jsxs16(Box16, { marginTop: 1, children: [
22839
- /* @__PURE__ */ jsx18(Text17, { color: theme.palette.primary, children: "retry \u203A " }),
22840
- /* @__PURE__ */ jsx18(
23056
+ /* @__PURE__ */ jsx19(Text18, { children: " " }),
23057
+ /* @__PURE__ */ jsx19(Text18, { children: "Press Enter to retry, or type a Gateway ID manually below." }),
23058
+ /* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
23059
+ /* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "retry \u203A " }),
23060
+ /* @__PURE__ */ jsx19(
22841
23061
  CustomTextInput,
22842
23062
  {
22843
23063
  value: "",
@@ -22847,9 +23067,9 @@ function Onboarding({ onDone, onCancel }) {
22847
23067
  }
22848
23068
  )
22849
23069
  ] }),
22850
- /* @__PURE__ */ jsxs16(Box16, { marginTop: 1, children: [
22851
- /* @__PURE__ */ jsx18(Text17, { color: theme.palette.primary, children: "manual \u203A " }),
22852
- /* @__PURE__ */ jsx18(
23070
+ /* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
23071
+ /* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "manual \u203A " }),
23072
+ /* @__PURE__ */ jsx19(
22853
23073
  CustomTextInput,
22854
23074
  {
22855
23075
  value: gatewayManualId,
@@ -22859,23 +23079,23 @@ function Onboarding({ onDone, onCancel }) {
22859
23079
  )
22860
23080
  ] })
22861
23081
  ] }),
22862
- step === "model" && /* @__PURE__ */ jsxs16(Fragment, { children: [
22863
- /* @__PURE__ */ jsx18(Text17, { children: "Pick a model to start with (you can change it anytime with /model)" }),
22864
- aiGatewayId && /* @__PURE__ */ jsxs16(Text17, { color: theme.palette.success, children: [
23082
+ step === "model" && /* @__PURE__ */ jsxs17(Fragment, { children: [
23083
+ /* @__PURE__ */ jsx19(Text18, { children: "Pick a model to start with (you can change it anytime with /model)" }),
23084
+ aiGatewayId && /* @__PURE__ */ jsxs17(Text18, { color: theme.palette.success, children: [
22865
23085
  "Gateway: ",
22866
23086
  aiGatewayId,
22867
23087
  " \u2713"
22868
23088
  ] }),
22869
- !aiGatewayId && useGateway === false && /* @__PURE__ */ jsx18(Text17, { color: theme.palette.success, children: "Routing: Workers AI (direct) \u2713" }),
22870
- /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(ModelPicker, { current: model, onPick: handleModelPick }) }),
22871
- /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, dimColor: true, children: [
23089
+ !aiGatewayId && useGateway === false && /* @__PURE__ */ jsx19(Text18, { color: theme.palette.success, children: "Routing: Workers AI (direct) \u2713" }),
23090
+ /* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(ModelPicker, { current: model, onPick: handleModelPick }) }),
23091
+ /* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, dimColor: true, children: [
22872
23092
  "Tip: Esc keeps the default (",
22873
23093
  DEFAULT_MODEL,
22874
23094
  ") and continues."
22875
23095
  ] }) })
22876
23096
  ] }),
22877
- step === "billingChoice" && pickedEntry && /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(BillingChooser, { model: pickedEntry, onPick: handleBillingChoice }) }),
22878
- step === "unifiedProbe" && pickedEntry && /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
23097
+ step === "billingChoice" && pickedEntry && /* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(BillingChooser, { model: pickedEntry, onPick: handleBillingChoice }) }),
23098
+ step === "unifiedProbe" && pickedEntry && /* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(
22879
23099
  UnifiedBillingStatus,
22880
23100
  {
22881
23101
  model: pickedEntry,
@@ -22885,7 +23105,7 @@ function Onboarding({ onDone, onCancel }) {
22885
23105
  onResolve: handleProbeResolve
22886
23106
  }
22887
23107
  ) }),
22888
- step === "keyEntry" && pickedEntry && /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
23108
+ step === "keyEntry" && pickedEntry && /* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(
22889
23109
  KeyEntryModal,
22890
23110
  {
22891
23111
  model: pickedEntry,
@@ -22896,10 +23116,10 @@ function Onboarding({ onDone, onCancel }) {
22896
23116
  onCancel: handleCancelKeyEntry
22897
23117
  }
22898
23118
  ) }),
22899
- step === "confirm" && /* @__PURE__ */ jsxs16(Fragment, { children: [
22900
- /* @__PURE__ */ jsx18(Text17, { children: "Ready to save configuration" }),
22901
- /* @__PURE__ */ jsxs16(
22902
- Box16,
23119
+ step === "confirm" && /* @__PURE__ */ jsxs17(Fragment, { children: [
23120
+ /* @__PURE__ */ jsx19(Text18, { children: "Ready to save configuration" }),
23121
+ /* @__PURE__ */ jsxs17(
23122
+ Box17,
22903
23123
  {
22904
23124
  flexDirection: "column",
22905
23125
  marginTop: 1,
@@ -22908,29 +23128,29 @@ function Onboarding({ onDone, onCancel }) {
22908
23128
  borderColor: theme.info.color,
22909
23129
  paddingX: 1,
22910
23130
  children: [
22911
- /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
23131
+ /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
22912
23132
  "Account ID: ",
22913
23133
  accountId
22914
23134
  ] }),
22915
- /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
23135
+ /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
22916
23136
  "API Token: ",
22917
23137
  "\u2022".repeat(apiToken.length)
22918
23138
  ] }),
22919
- /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
23139
+ /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
22920
23140
  "Model: ",
22921
23141
  model
22922
23142
  ] }),
22923
- aiGatewayId ? /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
23143
+ aiGatewayId ? /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
22924
23144
  "AI Gateway: ",
22925
23145
  aiGatewayId
22926
- ] }) : /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Routing: Workers AI (direct)" }),
22927
- unifiedBilling && /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Billing: Cloudflare credits (Unified Billing)" }),
22928
- Object.keys(providerKeyAliases).length > 0 && /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
23146
+ ] }) : /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Routing: Workers AI (direct)" }),
23147
+ unifiedBilling && /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Billing: Cloudflare credits (Unified Billing)" }),
23148
+ Object.keys(providerKeyAliases).length > 0 && /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
22929
23149
  "Provider keys: ",
22930
23150
  Object.keys(providerKeyAliases).join(", "),
22931
23151
  " (in Cloudflare Secrets Store)"
22932
23152
  ] }),
22933
- Object.keys(providerKeys).length > 0 && /* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
23153
+ Object.keys(providerKeys).length > 0 && /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
22934
23154
  "Provider keys: ",
22935
23155
  Object.keys(providerKeys).join(", "),
22936
23156
  " (local \u2014 do not commit ~/.config/kimiflare/config.json)"
@@ -22938,11 +23158,11 @@ function Onboarding({ onDone, onCancel }) {
22938
23158
  ]
22939
23159
  }
22940
23160
  ),
22941
- /* @__PURE__ */ jsx18(Text17, { children: "Press Enter to confirm, or Ctrl+C to cancel" }),
22942
- aiGatewayId && /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Tip: enable response caching with `/gateway cache-ttl 60` to cut costs on repeated prompts." }),
22943
- /* @__PURE__ */ jsxs16(Box16, { marginTop: 1, children: [
22944
- /* @__PURE__ */ jsx18(Text17, { color: theme.palette.primary, children: "\u203A " }),
22945
- /* @__PURE__ */ jsx18(
23161
+ /* @__PURE__ */ jsx19(Text18, { children: "Press Enter to confirm, or Ctrl+C to cancel" }),
23162
+ aiGatewayId && /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Tip: enable response caching with `/gateway cache-ttl 60` to cut costs on repeated prompts." }),
23163
+ /* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
23164
+ /* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "\u203A " }),
23165
+ /* @__PURE__ */ jsx19(
22946
23166
  CustomTextInput,
22947
23167
  {
22948
23168
  value: "",
@@ -22953,11 +23173,11 @@ function Onboarding({ onDone, onCancel }) {
22953
23173
  )
22954
23174
  ] })
22955
23175
  ] }),
22956
- gatewayProbeMsg && step !== "gatewayProbing" && step !== "gatewayScopeError" && /* @__PURE__ */ jsxs16(Text17, { color: theme.palette.error ?? "red", children: [
23176
+ gatewayProbeMsg && step !== "gatewayProbing" && step !== "gatewayScopeError" && /* @__PURE__ */ jsxs17(Text18, { color: theme.palette.error ?? "red", children: [
22957
23177
  "Probe failed: ",
22958
23178
  gatewayProbeMsg
22959
23179
  ] }),
22960
- savedPath && /* @__PURE__ */ jsxs16(Text17, { color: theme.palette.success, children: [
23180
+ savedPath && /* @__PURE__ */ jsxs17(Text18, { color: theme.palette.success, children: [
22961
23181
  "Config saved to ",
22962
23182
  savedPath
22963
23183
  ] })
@@ -22980,8 +23200,8 @@ var init_onboarding = __esm({
22980
23200
  });
22981
23201
 
22982
23202
  // src/ui/welcome.tsx
22983
- import { Box as Box17, Text as Text18 } from "ink";
22984
- import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
23203
+ import { Box as Box18, Text as Text19 } from "ink";
23204
+ import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
22985
23205
  function Welcome() {
22986
23206
  const theme = useTheme();
22987
23207
  const now2 = /* @__PURE__ */ new Date();
@@ -22989,9 +23209,9 @@ function Welcome() {
22989
23209
  hour: now2.getHours(),
22990
23210
  day: now2.getDay()
22991
23211
  });
22992
- return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", marginBottom: 1, children: [
22993
- /* @__PURE__ */ jsx19(Box17, { marginBottom: 1, children: /* @__PURE__ */ jsx19(Text18, { bold: true, color: theme.accent, children: headline }) }),
22994
- /* @__PURE__ */ jsx19(Box17, { flexDirection: "column", children: /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, dimColor: true, children: "Type / for commands" }) })
23212
+ return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", marginBottom: 1, children: [
23213
+ /* @__PURE__ */ jsx20(Box18, { marginBottom: 1, children: /* @__PURE__ */ jsx20(Text19, { bold: true, color: theme.accent, children: headline }) }),
23214
+ /* @__PURE__ */ jsx20(Box18, { flexDirection: "column", children: /* @__PURE__ */ jsx20(Text19, { color: theme.info.color, dimColor: true, children: "Type / for commands" }) })
22995
23215
  ] });
22996
23216
  }
22997
23217
  var init_welcome = __esm({
@@ -23593,8 +23813,8 @@ var init_lsp_nudge = __esm({
23593
23813
  });
23594
23814
 
23595
23815
  // src/ui/file-picker.tsx
23596
- import { Box as Box18, Text as Text19 } from "ink";
23597
- import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
23816
+ import { Box as Box19, Text as Text20 } from "ink";
23817
+ import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
23598
23818
  function FilePicker({ items, selectedIndex, query, recentFiles }) {
23599
23819
  const theme = useTheme();
23600
23820
  let startIndex = 0;
@@ -23606,12 +23826,12 @@ function FilePicker({ items, selectedIndex, query, recentFiles }) {
23606
23826
  const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT;
23607
23827
  const recentInVisible = visible.filter((item) => recentFiles?.has(item.name)).length;
23608
23828
  const hasRecentSection = recentInVisible > 0;
23609
- return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
23610
- /* @__PURE__ */ jsx20(Text19, { color: theme.accent, bold: true, children: query ? `Files matching "${query}"` : "Mention a file" }),
23611
- /* @__PURE__ */ jsx20(Text19, { color: theme.info.color, dimColor: true, children: "\u2191\u2193 navigate \xB7 Enter pick \xB7 Esc cancel" }),
23612
- /* @__PURE__ */ jsxs18(Box18, { marginTop: 1, flexDirection: "column", children: [
23613
- visible.length === 0 && /* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "No matches" }),
23614
- hasMoreAbove && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, dimColor: true, children: [
23829
+ return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
23830
+ /* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: query ? `Files matching "${query}"` : "Mention a file" }),
23831
+ /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: true, children: "\u2191\u2193 navigate \xB7 Enter pick \xB7 Esc cancel" }),
23832
+ /* @__PURE__ */ jsxs19(Box19, { marginTop: 1, flexDirection: "column", children: [
23833
+ visible.length === 0 && /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "No matches" }),
23834
+ hasMoreAbove && /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, dimColor: true, children: [
23615
23835
  "\u2026 ",
23616
23836
  startIndex,
23617
23837
  " more above"
@@ -23623,28 +23843,28 @@ function FilePicker({ items, selectedIndex, query, recentFiles }) {
23623
23843
  const label = item.isDirectory ? `${item.name}/` : item.name;
23624
23844
  const isFirstRecent = isRecent && (i === 0 || !recentFiles?.has(visible[i - 1]?.name ?? ""));
23625
23845
  const isFirstNonRecentAfterRecent = !isRecent && (i > 0 && recentFiles?.has(visible[i - 1]?.name ?? ""));
23626
- return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", children: [
23627
- hasRecentSection && isFirstRecent && /* @__PURE__ */ jsxs18(Text19, { color: theme.palette.success, bold: true, children: [
23846
+ return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", children: [
23847
+ hasRecentSection && isFirstRecent && /* @__PURE__ */ jsxs19(Text20, { color: theme.palette.success, bold: true, children: [
23628
23848
  " ",
23629
23849
  "Recent"
23630
23850
  ] }),
23631
- hasRecentSection && isFirstNonRecentAfterRecent && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, dimColor: true, children: [
23851
+ hasRecentSection && isFirstNonRecentAfterRecent && /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, dimColor: true, children: [
23632
23852
  " ",
23633
23853
  "All files"
23634
23854
  ] }),
23635
- /* @__PURE__ */ jsxs18(Text19, { color: isSelected ? theme.accent : isRecent ? theme.palette.success : void 0, bold: isSelected || isRecent, children: [
23855
+ /* @__PURE__ */ jsxs19(Text20, { color: isSelected ? theme.accent : isRecent ? theme.palette.success : void 0, bold: isSelected || isRecent, children: [
23636
23856
  isSelected ? "\u203A " : isRecent ? "\u2192 " : " ",
23637
23857
  isRecent ? "\u21BB " : "",
23638
23858
  label
23639
23859
  ] })
23640
23860
  ] }, item.name);
23641
23861
  }),
23642
- hasMoreBelow && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, dimColor: true, children: [
23862
+ hasMoreBelow && /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, dimColor: true, children: [
23643
23863
  "\u2026 ",
23644
23864
  items.length - (startIndex + VISIBLE_LIMIT),
23645
23865
  " more below"
23646
23866
  ] }),
23647
- hasRecentSection && /* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(Text19, { color: theme.info.color, dimColor: true, children: "\u21BB = recently used" }) })
23867
+ hasRecentSection && /* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: true, children: "\u21BB = recently used" }) })
23648
23868
  ] })
23649
23869
  ] });
23650
23870
  }
@@ -23658,8 +23878,8 @@ var init_file_picker = __esm({
23658
23878
  });
23659
23879
 
23660
23880
  // src/ui/slash-picker.tsx
23661
- import { Box as Box19, Text as Text20 } from "ink";
23662
- import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
23881
+ import { Box as Box20, Text as Text21 } from "ink";
23882
+ import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
23663
23883
  function sourceBadge(source) {
23664
23884
  if (source === "builtin") return "";
23665
23885
  if (source === "project") return "project";
@@ -23679,12 +23899,12 @@ function SlashPicker({ items, selectedIndex, query }) {
23679
23899
  const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT2;
23680
23900
  const longestLabel = visible.reduce((m, it) => Math.max(m, commandLabel(it).length), 0);
23681
23901
  const nameColWidth = Math.max(NAME_COL_MIN_WIDTH, longestLabel + NAME_DESC_GAP);
23682
- return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
23683
- /* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: query ? `Commands matching "/${query}"` : "Slash commands" }),
23684
- /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
23685
- /* @__PURE__ */ jsxs19(Box19, { marginTop: 1, flexDirection: "column", children: [
23686
- visible.length === 0 && /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "No matches" }),
23687
- hasMoreAbove && /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, children: [
23902
+ return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
23903
+ /* @__PURE__ */ jsx22(Text21, { color: theme.accent, bold: true, children: query ? `Commands matching "/${query}"` : "Slash commands" }),
23904
+ /* @__PURE__ */ jsx22(Text21, { color: theme.info.color, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
23905
+ /* @__PURE__ */ jsxs20(Box20, { marginTop: 1, flexDirection: "column", children: [
23906
+ visible.length === 0 && /* @__PURE__ */ jsx22(Text21, { color: theme.info.color, children: "No matches" }),
23907
+ hasMoreAbove && /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
23688
23908
  "\u2026 ",
23689
23909
  startIndex,
23690
23910
  " more above"
@@ -23694,16 +23914,16 @@ function SlashPicker({ items, selectedIndex, query }) {
23694
23914
  const isSelected = actualIndex === selectedIndex;
23695
23915
  const nameCol = commandLabel(item).padEnd(nameColWidth);
23696
23916
  const badge = sourceBadge(item.source);
23697
- return /* @__PURE__ */ jsxs19(Text20, { color: isSelected ? theme.accent : void 0, bold: isSelected, children: [
23917
+ return /* @__PURE__ */ jsxs20(Text21, { color: isSelected ? theme.accent : void 0, bold: isSelected, children: [
23698
23918
  isSelected ? "\u203A " : " ",
23699
23919
  nameCol,
23700
- /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, children: [
23920
+ /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
23701
23921
  item.description,
23702
23922
  badge && ` [${badge}]`
23703
23923
  ] })
23704
23924
  ] }, item.name);
23705
23925
  }),
23706
- hasMoreBelow && /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, children: [
23926
+ hasMoreBelow && /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
23707
23927
  "\u2026 ",
23708
23928
  items.length - (startIndex + VISIBLE_LIMIT2),
23709
23929
  " more below"
@@ -23723,7 +23943,7 @@ var init_slash_picker = __esm({
23723
23943
  });
23724
23944
 
23725
23945
  // src/ui/use-picker-controller.ts
23726
- import { useCallback as useCallback4, useEffect as useEffect9, useMemo as useMemo3, useRef as useRef4, useState as useState14 } from "react";
23946
+ import { useCallback as useCallback4, useEffect as useEffect9, useMemo as useMemo3, useRef as useRef4, useState as useState15 } from "react";
23727
23947
  function filterPickerItems(items, query) {
23728
23948
  return fuzzyFilter(items, query, (item) => item.name).slice(0, 50);
23729
23949
  }
@@ -23789,8 +24009,8 @@ function usePickerController(opts2) {
23789
24009
  onSlashSelected,
23790
24010
  getRecentFiles
23791
24011
  } = opts2;
23792
- const [active, setActive] = useState14(null);
23793
- const [fileItemsRaw, setFileItemsRaw] = useState14([]);
24012
+ const [active, setActive] = useState15(null);
24013
+ const [fileItemsRaw, setFileItemsRaw] = useState15([]);
23794
24014
  const filesLoadedRef = useRef4(false);
23795
24015
  const cancelOffsetRef = useRef4(null);
23796
24016
  const onFileSelectedRef = useRef4(onFileSelected);
@@ -23927,32 +24147,32 @@ var init_use_picker_controller = __esm({
23927
24147
  });
23928
24148
 
23929
24149
  // src/ui/use-modal-host.ts
23930
- import { useMemo as useMemo4, useState as useState15 } from "react";
24150
+ import { useMemo as useMemo4, useState as useState16 } from "react";
23931
24151
  function useModalHost() {
23932
- const [limitModal, setLimitModal] = useState15(null);
23933
- const [loopModal, setLoopModal] = useState15(null);
23934
- const [commandWizard, setCommandWizard] = useState15(null);
23935
- const [commandPicker, setCommandPicker] = useState15(null);
23936
- const [commandToDelete, setCommandToDelete] = useState15(null);
23937
- const [showCommandList, setShowCommandList] = useState15(false);
23938
- const [showLspWizard, setShowLspWizard] = useState15(false);
23939
- const [showThemePicker, setShowThemePicker] = useState15(false);
23940
- const [showUiPicker, setShowUiPicker] = useState15(false);
23941
- const [showModelPicker, setShowModelPicker] = useState15(false);
23942
- const [showModePicker, setShowModePicker] = useState15(false);
23943
- const [keyEntryFor, setKeyEntryFor] = useState15(null);
23944
- const [billingChooserFor, setBillingChooserFor] = useState15(null);
23945
- const [unifiedProbeFor, setUnifiedProbeFor] = useState15(null);
23946
- const [showRemoteDashboard, setShowRemoteDashboard] = useState15(false);
23947
- const [showInboxModal, setShowInboxModal] = useState15(false);
23948
- const [showMultiAgentModal, setShowMultiAgentModal] = useState15(false);
23949
- const [showHooksDashboard, setShowHooksDashboard] = useState15(false);
23950
- const [showHelpMenu, setShowHelpMenu] = useState15(false);
23951
- const [showMemoryPicker, setShowMemoryPicker] = useState15(false);
23952
- const [showGatewayPicker, setShowGatewayPicker] = useState15(false);
23953
- const [showSkillsPicker, setShowSkillsPicker] = useState15(false);
23954
- const [showShellPicker, setShowShellPicker] = useState15(false);
23955
- const [showPlanCompletePicker, setShowPlanCompletePicker] = useState15(false);
24152
+ const [limitModal, setLimitModal] = useState16(null);
24153
+ const [loopModal, setLoopModal] = useState16(null);
24154
+ const [commandWizard, setCommandWizard] = useState16(null);
24155
+ const [commandPicker, setCommandPicker] = useState16(null);
24156
+ const [commandToDelete, setCommandToDelete] = useState16(null);
24157
+ const [showCommandList, setShowCommandList] = useState16(false);
24158
+ const [showLspWizard, setShowLspWizard] = useState16(false);
24159
+ const [showThemePicker, setShowThemePicker] = useState16(false);
24160
+ const [showUiPicker, setShowUiPicker] = useState16(false);
24161
+ const [showModelPicker, setShowModelPicker] = useState16(false);
24162
+ const [showModePicker, setShowModePicker] = useState16(false);
24163
+ const [keyEntryFor, setKeyEntryFor] = useState16(null);
24164
+ const [billingChooserFor, setBillingChooserFor] = useState16(null);
24165
+ const [unifiedProbeFor, setUnifiedProbeFor] = useState16(null);
24166
+ const [showRemoteDashboard, setShowRemoteDashboard] = useState16(false);
24167
+ const [showInboxModal, setShowInboxModal] = useState16(false);
24168
+ const [showMultiAgentModal, setShowMultiAgentModal] = useState16(false);
24169
+ const [showHooksDashboard, setShowHooksDashboard] = useState16(false);
24170
+ const [showHelpMenu, setShowHelpMenu] = useState16(false);
24171
+ const [showMemoryPicker, setShowMemoryPicker] = useState16(false);
24172
+ const [showGatewayPicker, setShowGatewayPicker] = useState16(false);
24173
+ const [showSkillsPicker, setShowSkillsPicker] = useState16(false);
24174
+ const [showShellPicker, setShowShellPicker] = useState16(false);
24175
+ const [showPlanCompletePicker, setShowPlanCompletePicker] = useState16(false);
23956
24176
  const flags = useMemo4(() => {
23957
24177
  const hasFullscreenModal = commandWizard !== null || commandPicker !== null || commandToDelete !== null || showCommandList || showLspWizard || showThemePicker || showUiPicker || showModelPicker || showModePicker || keyEntryFor !== null || billingChooserFor !== null || unifiedProbeFor !== null || showRemoteDashboard || showInboxModal || showMultiAgentModal || showHooksDashboard || showHelpMenu || showMemoryPicker || showGatewayPicker || showSkillsPicker || showShellPicker;
23958
24178
  const hasOverlayModal = limitModal !== null || loopModal !== null || showPlanCompletePicker;
@@ -24046,9 +24266,9 @@ var init_use_modal_host = __esm({
24046
24266
  });
24047
24267
 
24048
24268
  // src/ui/limit-modal.tsx
24049
- import { Box as Box20, Text as Text21 } from "ink";
24050
- import SelectInput6 from "ink-select-input";
24051
- import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
24269
+ import { Box as Box21, Text as Text22 } from "ink";
24270
+ import SelectInput7 from "ink-select-input";
24271
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
24052
24272
  function LimitModal({ limit, onDecide, title, description, items }) {
24053
24273
  const theme = useTheme();
24054
24274
  const defaultItems = [
@@ -24056,11 +24276,11 @@ function LimitModal({ limit, onDecide, title, description, items }) {
24056
24276
  { label: "Stop", value: "stop" }
24057
24277
  ];
24058
24278
  const selectItems = items ?? defaultItems;
24059
- return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", borderStyle: "round", borderColor: theme.error, paddingX: 1, children: [
24060
- /* @__PURE__ */ jsx22(Text21, { color: theme.error, bold: true, children: title ?? `Tool-call limit reached (${limit})` }),
24061
- /* @__PURE__ */ jsx22(Text21, { dimColor: true, children: description ?? `This session has made ${limit} tool calls. What would you like to do?` }),
24062
- /* @__PURE__ */ jsx22(Box20, { marginTop: 1, children: /* @__PURE__ */ jsx22(
24063
- SelectInput6,
24279
+ return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.error, paddingX: 1, children: [
24280
+ /* @__PURE__ */ jsx23(Text22, { color: theme.error, bold: true, children: title ?? `Tool-call limit reached (${limit})` }),
24281
+ /* @__PURE__ */ jsx23(Text22, { dimColor: true, children: description ?? `This session has made ${limit} tool calls. What would you like to do?` }),
24282
+ /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
24283
+ SelectInput7,
24064
24284
  {
24065
24285
  items: selectItems,
24066
24286
  onSelect: (item) => onDecide(item.value)
@@ -24076,21 +24296,21 @@ var init_limit_modal = __esm({
24076
24296
  });
24077
24297
 
24078
24298
  // src/ui/command-wizard.tsx
24079
- import { useState as useState16 } from "react";
24080
- import { Box as Box21, Text as Text22, useInput as useInput10, useWindowSize } from "ink";
24081
- import SelectInput7 from "ink-select-input";
24082
- import { Fragment as Fragment2, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
24299
+ import { useState as useState17 } from "react";
24300
+ import { Box as Box22, Text as Text23, useInput as useInput11, useWindowSize } from "ink";
24301
+ import SelectInput8 from "ink-select-input";
24302
+ import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
24083
24303
  function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onSave }) {
24084
24304
  const theme = useTheme();
24085
- const [step, setStep] = useState16("name");
24086
- const [name, setName] = useState16(initial?.name ?? "");
24087
- const [description, setDescription] = useState16(initial?.description ?? "");
24088
- const [template, setTemplate] = useState16(initial?.template ?? "");
24089
- const [cmdMode, setCmdMode] = useState16(initial?.mode);
24090
- const [cmdEffort, setCmdEffort] = useState16(initial?.effort);
24091
- const [cmdModel, setCmdModel] = useState16(initial?.model);
24092
- const [source, setSource] = useState16(initial?.source ?? "project");
24093
- const [error, setError] = useState16(null);
24305
+ const [step, setStep] = useState17("name");
24306
+ const [name, setName] = useState17(initial?.name ?? "");
24307
+ const [description, setDescription] = useState17(initial?.description ?? "");
24308
+ const [template, setTemplate] = useState17(initial?.template ?? "");
24309
+ const [cmdMode, setCmdMode] = useState17(initial?.mode);
24310
+ const [cmdEffort, setCmdEffort] = useState17(initial?.effort);
24311
+ const [cmdModel, setCmdModel] = useState17(initial?.model);
24312
+ const [source, setSource] = useState17(initial?.source ?? "project");
24313
+ const [error, setError] = useState17(null);
24094
24314
  const { columns } = useWindowSize();
24095
24315
  const totalSteps = 5;
24096
24316
  const stepIndex = step === "name" ? 1 : step === "description" ? 2 : step === "template" ? 3 : step === "advanced" || step === "mode" || step === "effort" || step === "model" ? 4 : step === "location" ? 4 : 5;
@@ -24103,7 +24323,7 @@ function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onS
24103
24323
  if (existingNames.includes(trimmed) && !isEditingSelf(trimmed)) return `/${trimmed} already exists`;
24104
24324
  return null;
24105
24325
  };
24106
- useInput10((_input, key) => {
24326
+ useInput11((_input, key) => {
24107
24327
  if (key.escape) {
24108
24328
  onDone();
24109
24329
  }
@@ -24203,8 +24423,8 @@ ${template}`;
24203
24423
  const renderStep = () => {
24204
24424
  switch (step) {
24205
24425
  case "name":
24206
- return /* @__PURE__ */ jsxs21(Fragment2, { children: [
24207
- /* @__PURE__ */ jsxs21(Text22, { color: theme.accent, bold: true, children: [
24426
+ return /* @__PURE__ */ jsxs22(Fragment2, { children: [
24427
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
24208
24428
  mode === "create" ? "Create" : "Edit",
24209
24429
  " custom command \u2014 Name (",
24210
24430
  stepIndex,
@@ -24212,8 +24432,8 @@ ${template}`;
24212
24432
  totalSteps,
24213
24433
  ")"
24214
24434
  ] }),
24215
- error && /* @__PURE__ */ jsx23(Text22, { color: theme.error, children: error }),
24216
- /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
24435
+ error && /* @__PURE__ */ jsx24(Text23, { color: theme.error, children: error }),
24436
+ /* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
24217
24437
  CustomTextInput,
24218
24438
  {
24219
24439
  value: name,
@@ -24222,11 +24442,11 @@ ${template}`;
24222
24442
  focus: true
24223
24443
  }
24224
24444
  ) }),
24225
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "letters, numbers, _ - / only; must start with a letter" })
24445
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "letters, numbers, _ - / only; must start with a letter" })
24226
24446
  ] });
24227
24447
  case "description":
24228
- return /* @__PURE__ */ jsxs21(Fragment2, { children: [
24229
- /* @__PURE__ */ jsxs21(Text22, { color: theme.accent, bold: true, children: [
24448
+ return /* @__PURE__ */ jsxs22(Fragment2, { children: [
24449
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
24230
24450
  mode === "create" ? "Create" : "Edit",
24231
24451
  " custom command \u2014 Description (",
24232
24452
  stepIndex,
@@ -24234,7 +24454,7 @@ ${template}`;
24234
24454
  totalSteps,
24235
24455
  ")"
24236
24456
  ] }),
24237
- /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
24457
+ /* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
24238
24458
  CustomTextInput,
24239
24459
  {
24240
24460
  value: description,
@@ -24243,49 +24463,49 @@ ${template}`;
24243
24463
  focus: true
24244
24464
  }
24245
24465
  ) }),
24246
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "Press Enter to skip" })
24466
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Press Enter to skip" })
24247
24467
  ] });
24248
24468
  case "template": {
24249
- const guide = /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", paddingLeft: 1, children: [
24250
- /* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "What is this?" }),
24251
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "A prompt template \u2014 instructions to the AI." }),
24252
- /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, children: [
24469
+ const guide = /* @__PURE__ */ jsxs22(Box22, { flexDirection: "column", paddingLeft: 1, children: [
24470
+ /* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: "What is this?" }),
24471
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "A prompt template \u2014 instructions to the AI." }),
24472
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
24253
24473
  "When you type /",
24254
24474
  name || "yourcommand",
24255
24475
  " later, this gets sent to the model."
24256
24476
  ] }),
24257
- /* @__PURE__ */ jsxs21(Box21, { marginTop: 1, flexDirection: "column", children: [
24258
- /* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Variables" }),
24259
- /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, children: [
24477
+ /* @__PURE__ */ jsxs22(Box22, { marginTop: 1, flexDirection: "column", children: [
24478
+ /* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: "Variables" }),
24479
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
24260
24480
  " ",
24261
24481
  "$1, $2 ... \u2192 arguments you type"
24262
24482
  ] }),
24263
- /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, children: [
24483
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
24264
24484
  " ",
24265
24485
  "$ARGUMENTS \u2192 everything after the command"
24266
24486
  ] })
24267
24487
  ] }),
24268
- /* @__PURE__ */ jsxs21(Box21, { marginTop: 1, flexDirection: "column", children: [
24269
- /* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Dynamic inlines" }),
24270
- /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, children: [
24488
+ /* @__PURE__ */ jsxs22(Box22, { marginTop: 1, flexDirection: "column", children: [
24489
+ /* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: "Dynamic inlines" }),
24490
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
24271
24491
  " ",
24272
24492
  "!`git diff` \u2192 shell output inlined"
24273
24493
  ] }),
24274
- /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, children: [
24494
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
24275
24495
  " ",
24276
24496
  "@README.md \u2192 file contents inlined"
24277
24497
  ] })
24278
24498
  ] }),
24279
- /* @__PURE__ */ jsxs21(Box21, { marginTop: 1, flexDirection: "column", children: [
24280
- /* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Example" }),
24281
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "Review this PR diff:" }),
24282
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "!`git diff main...HEAD`" }),
24283
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "Focus on: $1" })
24499
+ /* @__PURE__ */ jsxs22(Box22, { marginTop: 1, flexDirection: "column", children: [
24500
+ /* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: "Example" }),
24501
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Review this PR diff:" }),
24502
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "!`git diff main...HEAD`" }),
24503
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Focus on: $1" })
24284
24504
  ] })
24285
24505
  ] });
24286
- const inputArea = /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", flexGrow: 1, children: [
24287
- error && /* @__PURE__ */ jsx23(Text22, { color: theme.error, children: error }),
24288
- /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
24506
+ const inputArea = /* @__PURE__ */ jsxs22(Box22, { flexDirection: "column", flexGrow: 1, children: [
24507
+ error && /* @__PURE__ */ jsx24(Text23, { color: theme.error, children: error }),
24508
+ /* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
24289
24509
  CustomTextInput,
24290
24510
  {
24291
24511
  value: template,
@@ -24295,13 +24515,13 @@ ${template}`;
24295
24515
  enablePaste: true
24296
24516
  }
24297
24517
  ) }),
24298
- columns < 100 && /* @__PURE__ */ jsxs21(Fragment2, { children: [
24299
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "Paste multi-line templates with Ctrl+V." }),
24300
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "Variables: $1 $2 ... $ARGUMENTS Shell: !`cmd` File: @path" })
24518
+ columns < 100 && /* @__PURE__ */ jsxs22(Fragment2, { children: [
24519
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Paste multi-line templates with Ctrl+V." }),
24520
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Variables: $1 $2 ... $ARGUMENTS Shell: !`cmd` File: @path" })
24301
24521
  ] })
24302
24522
  ] });
24303
- return /* @__PURE__ */ jsxs21(Fragment2, { children: [
24304
- /* @__PURE__ */ jsxs21(Text22, { color: theme.accent, bold: true, children: [
24523
+ return /* @__PURE__ */ jsxs22(Fragment2, { children: [
24524
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
24305
24525
  mode === "create" ? "Create" : "Edit",
24306
24526
  " custom command \u2014 Template (",
24307
24527
  stepIndex,
@@ -24309,10 +24529,10 @@ ${template}`;
24309
24529
  totalSteps,
24310
24530
  ")"
24311
24531
  ] }),
24312
- columns >= 100 ? /* @__PURE__ */ jsxs21(Box21, { flexDirection: "row", marginTop: 1, children: [
24313
- /* @__PURE__ */ jsx23(Box21, { flexDirection: "column", width: "50%", children: inputArea }),
24314
- /* @__PURE__ */ jsx23(Box21, { flexDirection: "column", width: "50%", children: guide })
24315
- ] }) : /* @__PURE__ */ jsx23(Box21, { flexDirection: "column", marginTop: 1, children: inputArea })
24532
+ columns >= 100 ? /* @__PURE__ */ jsxs22(Box22, { flexDirection: "row", marginTop: 1, children: [
24533
+ /* @__PURE__ */ jsx24(Box22, { flexDirection: "column", width: "50%", children: inputArea }),
24534
+ /* @__PURE__ */ jsx24(Box22, { flexDirection: "column", width: "50%", children: guide })
24535
+ ] }) : /* @__PURE__ */ jsx24(Box22, { flexDirection: "column", marginTop: 1, children: inputArea })
24316
24536
  ] });
24317
24537
  }
24318
24538
  case "advanced": {
@@ -24321,8 +24541,8 @@ ${template}`;
24321
24541
  { label: "Skip", value: "skip", key: "skip" },
24322
24542
  { label: "\u2190 Cancel", value: "cancel", key: "cancel" }
24323
24543
  ];
24324
- return /* @__PURE__ */ jsxs21(Fragment2, { children: [
24325
- /* @__PURE__ */ jsxs21(Text22, { color: theme.accent, bold: true, children: [
24544
+ return /* @__PURE__ */ jsxs22(Fragment2, { children: [
24545
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
24326
24546
  mode === "create" ? "Create" : "Edit",
24327
24547
  " custom command \u2014 Options (",
24328
24548
  stepIndex,
@@ -24330,8 +24550,8 @@ ${template}`;
24330
24550
  totalSteps,
24331
24551
  ")"
24332
24552
  ] }),
24333
- /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
24334
- SelectInput7,
24553
+ /* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
24554
+ SelectInput8,
24335
24555
  {
24336
24556
  items,
24337
24557
  onSelect: (item) => {
@@ -24350,17 +24570,17 @@ ${template}`;
24350
24570
  { label: cmdMode === "auto" ? "auto \xB7 current" : "auto", value: "auto", key: "auto" },
24351
24571
  { label: "\u2190 Back", value: "__back__", key: "__back__" }
24352
24572
  ];
24353
- return /* @__PURE__ */ jsxs21(Fragment2, { children: [
24354
- /* @__PURE__ */ jsxs21(Text22, { color: theme.accent, bold: true, children: [
24573
+ return /* @__PURE__ */ jsxs22(Fragment2, { children: [
24574
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
24355
24575
  "Mode override (",
24356
24576
  stepIndex,
24357
24577
  "/",
24358
24578
  totalSteps,
24359
24579
  ")"
24360
24580
  ] }),
24361
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "Saved to file but not yet enforced at runtime" }),
24362
- /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
24363
- SelectInput7,
24581
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Saved to file but not yet enforced at runtime" }),
24582
+ /* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
24583
+ SelectInput8,
24364
24584
  {
24365
24585
  items,
24366
24586
  onSelect: (item) => {
@@ -24379,16 +24599,16 @@ ${template}`;
24379
24599
  { label: cmdEffort === "high" ? "high \xB7 current" : "high", value: "high", key: "high" },
24380
24600
  { label: "\u2190 Back", value: "__back__", key: "__back__" }
24381
24601
  ];
24382
- return /* @__PURE__ */ jsxs21(Fragment2, { children: [
24383
- /* @__PURE__ */ jsxs21(Text22, { color: theme.accent, bold: true, children: [
24602
+ return /* @__PURE__ */ jsxs22(Fragment2, { children: [
24603
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
24384
24604
  "Reasoning effort (",
24385
24605
  stepIndex,
24386
24606
  "/",
24387
24607
  totalSteps,
24388
24608
  ")"
24389
24609
  ] }),
24390
- /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
24391
- SelectInput7,
24610
+ /* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
24611
+ SelectInput8,
24392
24612
  {
24393
24613
  items,
24394
24614
  onSelect: (item) => {
@@ -24400,15 +24620,15 @@ ${template}`;
24400
24620
  ] });
24401
24621
  }
24402
24622
  case "model":
24403
- return /* @__PURE__ */ jsxs21(Fragment2, { children: [
24404
- /* @__PURE__ */ jsxs21(Text22, { color: theme.accent, bold: true, children: [
24623
+ return /* @__PURE__ */ jsxs22(Fragment2, { children: [
24624
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
24405
24625
  "Model override (",
24406
24626
  stepIndex,
24407
24627
  "/",
24408
24628
  totalSteps,
24409
24629
  ")"
24410
24630
  ] }),
24411
- /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
24631
+ /* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
24412
24632
  CustomTextInput,
24413
24633
  {
24414
24634
  value: cmdModel ?? "",
@@ -24417,7 +24637,7 @@ ${template}`;
24417
24637
  focus: true
24418
24638
  }
24419
24639
  ) }),
24420
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "Press Enter to skip" })
24640
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Press Enter to skip" })
24421
24641
  ] });
24422
24642
  case "location": {
24423
24643
  const items = [
@@ -24425,16 +24645,16 @@ ${template}`;
24425
24645
  { label: source === "global" ? "Global \xB7 current" : "Global", value: "global", key: "global" },
24426
24646
  { label: "\u2190 Back", value: "__back__", key: "__back__" }
24427
24647
  ];
24428
- return /* @__PURE__ */ jsxs21(Fragment2, { children: [
24429
- /* @__PURE__ */ jsxs21(Text22, { color: theme.accent, bold: true, children: [
24648
+ return /* @__PURE__ */ jsxs22(Fragment2, { children: [
24649
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
24430
24650
  "Save location (",
24431
24651
  stepIndex,
24432
24652
  "/",
24433
24653
  totalSteps,
24434
24654
  ")"
24435
24655
  ] }),
24436
- /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
24437
- SelectInput7,
24656
+ /* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
24657
+ SelectInput8,
24438
24658
  {
24439
24659
  items,
24440
24660
  onSelect: (item) => {
@@ -24443,7 +24663,7 @@ ${template}`;
24443
24663
  }
24444
24664
  }
24445
24665
  ) }),
24446
- /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "Project: .kimiflare/commands/ Global: ~/.config/kimiflare/commands/" })
24666
+ /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Project: .kimiflare/commands/ Global: ~/.config/kimiflare/commands/" })
24447
24667
  ] });
24448
24668
  }
24449
24669
  case "confirm": {
@@ -24451,8 +24671,8 @@ ${template}`;
24451
24671
  { label: "Save", value: "save", key: "save" },
24452
24672
  { label: "Cancel", value: "cancel", key: "cancel" }
24453
24673
  ];
24454
- return /* @__PURE__ */ jsxs21(Fragment2, { children: [
24455
- /* @__PURE__ */ jsxs21(Text22, { color: theme.accent, bold: true, children: [
24674
+ return /* @__PURE__ */ jsxs22(Fragment2, { children: [
24675
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
24456
24676
  mode === "create" ? "Create" : "Edit",
24457
24677
  " custom command \u2014 Confirm (",
24458
24678
  stepIndex,
@@ -24460,14 +24680,14 @@ ${template}`;
24460
24680
  totalSteps,
24461
24681
  ")"
24462
24682
  ] }),
24463
- /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, children: [
24683
+ /* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
24464
24684
  source === "project" ? ".kimiflare/commands/" : "~/.config/kimiflare/commands/",
24465
24685
  name,
24466
24686
  ".md"
24467
24687
  ] }),
24468
- /* @__PURE__ */ jsx23(Box21, { marginTop: 1, flexDirection: "column", children: previewContent().split("\n").map((line, i) => /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: line || " " }, i)) }),
24469
- /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
24470
- SelectInput7,
24688
+ /* @__PURE__ */ jsx24(Box22, { marginTop: 1, flexDirection: "column", children: previewContent().split("\n").map((line, i) => /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: line || " " }, i)) }),
24689
+ /* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
24690
+ SelectInput8,
24471
24691
  {
24472
24692
  items,
24473
24693
  onSelect: (item) => handleConfirm(item.value)
@@ -24477,7 +24697,7 @@ ${template}`;
24477
24697
  }
24478
24698
  }
24479
24699
  };
24480
- return /* @__PURE__ */ jsx23(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: renderStep() });
24700
+ return /* @__PURE__ */ jsx24(Box22, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: renderStep() });
24481
24701
  }
24482
24702
  var NAME_RE;
24483
24703
  var init_command_wizard = __esm({
@@ -24490,9 +24710,9 @@ var init_command_wizard = __esm({
24490
24710
  });
24491
24711
 
24492
24712
  // src/ui/command-picker.tsx
24493
- import { Box as Box22, Text as Text23 } from "ink";
24494
- import SelectInput8 from "ink-select-input";
24495
- import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
24713
+ import { Box as Box23, Text as Text24 } from "ink";
24714
+ import SelectInput9 from "ink-select-input";
24715
+ import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
24496
24716
  function CommandPicker({ commands, title, onPick }) {
24497
24717
  const theme = useTheme();
24498
24718
  const items = commands.map((cmd) => ({
@@ -24501,11 +24721,11 @@ function CommandPicker({ commands, title, onPick }) {
24501
24721
  key: cmd.name
24502
24722
  }));
24503
24723
  items.push({ label: "\u2190 Cancel", value: null, key: "__cancel__" });
24504
- return /* @__PURE__ */ jsxs22(Box22, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24505
- /* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: title }),
24506
- /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
24507
- /* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
24508
- SelectInput8,
24724
+ return /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24725
+ /* @__PURE__ */ jsx25(Text24, { color: theme.accent, bold: true, children: title }),
24726
+ /* @__PURE__ */ jsx25(Text24, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
24727
+ /* @__PURE__ */ jsx25(Box23, { marginTop: 1, children: /* @__PURE__ */ jsx25(
24728
+ SelectInput9,
24509
24729
  {
24510
24730
  items,
24511
24731
  onSelect: (item) => {
@@ -24527,64 +24747,64 @@ var init_command_picker = __esm({
24527
24747
  });
24528
24748
 
24529
24749
  // src/ui/command-list.tsx
24530
- import { Box as Box23, Text as Text24, useInput as useInput11 } from "ink";
24531
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
24750
+ import { Box as Box24, Text as Text25, useInput as useInput12 } from "ink";
24751
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
24532
24752
  function CommandList({ commands, onDone }) {
24533
24753
  const theme = useTheme();
24534
- useInput11((_input, key) => {
24754
+ useInput12((_input, key) => {
24535
24755
  if (key.escape) {
24536
24756
  onDone();
24537
24757
  }
24538
24758
  });
24539
- return /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24540
- /* @__PURE__ */ jsx25(Text24, { color: theme.accent, bold: true, children: "Custom commands" }),
24541
- /* @__PURE__ */ jsx25(Text24, { color: theme.info.color, dimColor: false, children: "Esc to close." }),
24542
- /* @__PURE__ */ jsxs23(Box23, { marginTop: 1, flexDirection: "column", children: [
24543
- commands.length === 0 && /* @__PURE__ */ jsx25(Text24, { color: theme.info.color, children: "No custom commands found." }),
24544
- commands.map((cmd) => /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", marginBottom: 1, children: [
24545
- /* @__PURE__ */ jsxs23(Text24, { color: theme.accent, bold: true, children: [
24759
+ return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24760
+ /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Custom commands" }),
24761
+ /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: "Esc to close." }),
24762
+ /* @__PURE__ */ jsxs24(Box24, { marginTop: 1, flexDirection: "column", children: [
24763
+ commands.length === 0 && /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, children: "No custom commands found." }),
24764
+ commands.map((cmd) => /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", marginBottom: 1, children: [
24765
+ /* @__PURE__ */ jsxs24(Text25, { color: theme.accent, bold: true, children: [
24546
24766
  "/",
24547
24767
  cmd.name
24548
24768
  ] }),
24549
- /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, children: [
24769
+ /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
24550
24770
  " ",
24551
24771
  "source: ",
24552
24772
  cmd.source
24553
24773
  ] }),
24554
- /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, children: [
24774
+ /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
24555
24775
  " ",
24556
24776
  "path: ",
24557
24777
  cmd.filepath
24558
24778
  ] }),
24559
- cmd.description && /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, children: [
24779
+ cmd.description && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
24560
24780
  " ",
24561
24781
  "desc: ",
24562
24782
  cmd.description
24563
24783
  ] }),
24564
- cmd.mode && /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, children: [
24784
+ cmd.mode && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
24565
24785
  " ",
24566
24786
  "mode: ",
24567
24787
  cmd.mode
24568
24788
  ] }),
24569
- cmd.effort && /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, children: [
24789
+ cmd.effort && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
24570
24790
  " ",
24571
24791
  "effort: ",
24572
24792
  cmd.effort
24573
24793
  ] }),
24574
- cmd.model && /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, children: [
24794
+ cmd.model && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
24575
24795
  " ",
24576
24796
  "model: ",
24577
24797
  cmd.model
24578
24798
  ] }),
24579
- /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, children: [
24799
+ /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
24580
24800
  " ",
24581
24801
  "template:"
24582
24802
  ] }),
24583
- cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, children: [
24803
+ cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
24584
24804
  " ",
24585
24805
  line || " "
24586
24806
  ] }, i)),
24587
- cmd.template.split("\n").length > 5 && /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, children: [
24807
+ cmd.template.split("\n").length > 5 && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
24588
24808
  " ",
24589
24809
  "..."
24590
24810
  ] })
@@ -24600,20 +24820,20 @@ var init_command_list = __esm({
24600
24820
  });
24601
24821
 
24602
24822
  // src/ui/lsp-wizard.tsx
24603
- import { useState as useState17 } from "react";
24604
- import { Box as Box24, Text as Text25 } from "ink";
24605
- import SelectInput9 from "ink-select-input";
24823
+ import { useState as useState18 } from "react";
24824
+ import { Box as Box25, Text as Text26 } from "ink";
24825
+ import SelectInput10 from "ink-select-input";
24606
24826
  import { spawn as spawn6 } from "child_process";
24607
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
24827
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
24608
24828
  function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24609
24829
  const theme = useTheme();
24610
- const [page, setPage] = useState17("main");
24611
- const [selectedPreset, setSelectedPreset] = useState17(null);
24612
- const [customName, setCustomName] = useState17("");
24613
- const [customCommand, setCustomCommand] = useState17("");
24614
- const [installState, setInstallState] = useState17({ status: "idle", output: "" });
24615
- const [pendingServers, setPendingServers] = useState17(null);
24616
- const [pendingEnabled, setPendingEnabled] = useState17(true);
24830
+ const [page, setPage] = useState18("main");
24831
+ const [selectedPreset, setSelectedPreset] = useState18(null);
24832
+ const [customName, setCustomName] = useState18("");
24833
+ const [customCommand, setCustomCommand] = useState18("");
24834
+ const [installState, setInstallState] = useState18({ status: "idle", output: "" });
24835
+ const [pendingServers, setPendingServers] = useState18(null);
24836
+ const [pendingEnabled, setPendingEnabled] = useState18(true);
24617
24837
  const runInstall = (command) => {
24618
24838
  setInstallState({ status: "running", output: "Installing..." });
24619
24839
  const { shell, args } = getShellCommand();
@@ -24716,11 +24936,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24716
24936
  { label: "(close)", value: "__close__", key: "__close__" }
24717
24937
  ];
24718
24938
  if (page === "main") {
24719
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24720
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "LSP Servers" }),
24721
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
24722
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
24723
- SelectInput9,
24939
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24940
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "LSP Servers" }),
24941
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
24942
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
24943
+ SelectInput10,
24724
24944
  {
24725
24945
  items: mainItems,
24726
24946
  onSelect: (item) => {
@@ -24747,11 +24967,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24747
24967
  }),
24748
24968
  { label: "\u2190 Back", value: "__back__", key: "__back__" }
24749
24969
  ];
24750
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24751
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Add LSP Server" }),
24752
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: "Select a language server to configure." }),
24753
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
24754
- SelectInput9,
24970
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24971
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Add LSP Server" }),
24972
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Select a language server to configure." }),
24973
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
24974
+ SelectInput10,
24755
24975
  {
24756
24976
  items,
24757
24977
  onSelect: (item) => {
@@ -24778,19 +24998,19 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24778
24998
  { label: isSuccess ? "Save to config \u2713" : "Save anyway", value: "save", key: "save" },
24779
24999
  { label: "\u2190 Back", value: "__back__", key: "__back__" }
24780
25000
  ];
24781
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24782
- /* @__PURE__ */ jsxs24(Text25, { color: theme.accent, bold: true, children: [
25001
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25002
+ /* @__PURE__ */ jsxs25(Text26, { color: theme.accent, bold: true, children: [
24783
25003
  "Install ",
24784
25004
  selectedPreset.name
24785
25005
  ] }),
24786
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: selectedPreset.installHint }),
24787
- /* @__PURE__ */ jsxs24(Box24, { marginTop: 1, flexDirection: "column", children: [
24788
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: "Command:" }),
24789
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, children: selectedPreset.installCommand || "(none required)" })
25006
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: selectedPreset.installHint }),
25007
+ /* @__PURE__ */ jsxs25(Box25, { marginTop: 1, flexDirection: "column", children: [
25008
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Command:" }),
25009
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, children: selectedPreset.installCommand || "(none required)" })
24790
25010
  ] }),
24791
- installState.output && /* @__PURE__ */ jsx26(Box24, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx26(Text25, { color: isSuccess ? theme.accent : theme.error, children: installState.output.slice(-500) }) }),
24792
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
24793
- SelectInput9,
25011
+ installState.output && /* @__PURE__ */ jsx27(Box25, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx27(Text26, { color: isSuccess ? theme.accent : theme.error, children: installState.output.slice(-500) }) }),
25012
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
25013
+ SelectInput10,
24794
25014
  {
24795
25015
  items,
24796
25016
  onSelect: (item) => {
@@ -24807,16 +25027,16 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24807
25027
  }
24808
25028
  }
24809
25029
  ) }),
24810
- isSuccess && /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(Text25, { color: theme.accent, children: "Server saved. Run /lsp reload to start it." }) })
25030
+ isSuccess && /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(Text26, { color: theme.accent, children: "Server saved. Run /lsp reload to start it." }) })
24811
25031
  ] });
24812
25032
  }
24813
25033
  if (page === "custom-name") {
24814
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24815
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Name" }),
24816
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: "Enter a name for this server (e.g., my-server)." }),
24817
- /* @__PURE__ */ jsxs24(Box24, { marginTop: 1, children: [
24818
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, children: "\u203A " }),
24819
- /* @__PURE__ */ jsx26(
25034
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25035
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Name" }),
25036
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Enter a name for this server (e.g., my-server)." }),
25037
+ /* @__PURE__ */ jsxs25(Box25, { marginTop: 1, children: [
25038
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, children: "\u203A " }),
25039
+ /* @__PURE__ */ jsx27(
24820
25040
  CustomTextInput,
24821
25041
  {
24822
25042
  value: customName,
@@ -24830,8 +25050,8 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24830
25050
  }
24831
25051
  )
24832
25052
  ] }),
24833
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
24834
- SelectInput9,
25053
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
25054
+ SelectInput10,
24835
25055
  {
24836
25056
  items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
24837
25057
  onSelect: () => setPage("add")
@@ -24840,12 +25060,12 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24840
25060
  ] });
24841
25061
  }
24842
25062
  if (page === "custom-command") {
24843
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24844
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Command" }),
24845
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: "Enter the command to start the server (space-separated)." }),
24846
- /* @__PURE__ */ jsxs24(Box24, { marginTop: 1, children: [
24847
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, children: "\u203A " }),
24848
- /* @__PURE__ */ jsx26(
25063
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25064
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Command" }),
25065
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Enter the command to start the server (space-separated)." }),
25066
+ /* @__PURE__ */ jsxs25(Box25, { marginTop: 1, children: [
25067
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, children: "\u203A " }),
25068
+ /* @__PURE__ */ jsx27(
24849
25069
  CustomTextInput,
24850
25070
  {
24851
25071
  value: customCommand,
@@ -24859,8 +25079,8 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24859
25079
  }
24860
25080
  )
24861
25081
  ] }),
24862
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
24863
- SelectInput9,
25082
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
25083
+ SelectInput10,
24864
25084
  {
24865
25085
  items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
24866
25086
  onSelect: () => setPage("custom-name")
@@ -24883,11 +25103,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24883
25103
  },
24884
25104
  { label: "\u2190 Back", value: "__back__", key: "__back__" }
24885
25105
  ];
24886
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24887
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Save LSP Config" }),
24888
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: "Where should this server configuration be saved?" }),
24889
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
24890
- SelectInput9,
25106
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25107
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Save LSP Config" }),
25108
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Where should this server configuration be saved?" }),
25109
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
25110
+ SelectInput10,
24891
25111
  {
24892
25112
  items,
24893
25113
  onSelect: (item) => {
@@ -24905,11 +25125,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24905
25125
  if (page === "edit") {
24906
25126
  const keys = Object.keys(servers);
24907
25127
  if (keys.length === 0) {
24908
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24909
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
24910
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, children: "No servers configured." }),
24911
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
24912
- SelectInput9,
25128
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25129
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
25130
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, children: "No servers configured." }),
25131
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
25132
+ SelectInput10,
24913
25133
  {
24914
25134
  items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
24915
25135
  onSelect: () => setPage("main")
@@ -24929,11 +25149,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24929
25149
  }),
24930
25150
  { label: "\u2190 Back", value: "__back__", key: "__back__" }
24931
25151
  ];
24932
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24933
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
24934
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: "Select a server to toggle enabled/disabled." }),
24935
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
24936
- SelectInput9,
25152
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25153
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
25154
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Select a server to toggle enabled/disabled." }),
25155
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
25156
+ SelectInput10,
24937
25157
  {
24938
25158
  items,
24939
25159
  onSelect: (item) => {
@@ -24950,11 +25170,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24950
25170
  if (page === "delete") {
24951
25171
  const keys = Object.keys(servers);
24952
25172
  if (keys.length === 0) {
24953
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24954
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
24955
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, children: "No servers configured." }),
24956
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
24957
- SelectInput9,
25173
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25174
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
25175
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, children: "No servers configured." }),
25176
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
25177
+ SelectInput10,
24958
25178
  {
24959
25179
  items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
24960
25180
  onSelect: () => setPage("main")
@@ -24970,11 +25190,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24970
25190
  })),
24971
25191
  { label: "\u2190 Back", value: "__back__", key: "__back__" }
24972
25192
  ];
24973
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24974
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
24975
- /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: "Select a server to remove from config." }),
24976
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
24977
- SelectInput9,
25193
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25194
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
25195
+ /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Select a server to remove from config." }),
25196
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
25197
+ SelectInput10,
24978
25198
  {
24979
25199
  items,
24980
25200
  onSelect: (item) => {
@@ -24990,15 +25210,15 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
24990
25210
  }
24991
25211
  if (page === "list") {
24992
25212
  const keys = Object.keys(servers);
24993
- return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
24994
- /* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Configured LSP Servers" }),
24995
- keys.length === 0 ? /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, children: "No servers configured." }) : /* @__PURE__ */ jsx26(Box24, { marginTop: 1, flexDirection: "column", children: keys.map((k) => {
25213
+ return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25214
+ /* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Configured LSP Servers" }),
25215
+ keys.length === 0 ? /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, children: "No servers configured." }) : /* @__PURE__ */ jsx27(Box25, { marginTop: 1, flexDirection: "column", children: keys.map((k) => {
24996
25216
  const s = servers[k];
24997
25217
  const status = s.enabled !== false ? "enabled" : "disabled";
24998
- return /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, children: ` ${k.padEnd(16)} ${status} ${s.command.join(" ")}` }, k);
25218
+ return /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, children: ` ${k.padEnd(16)} ${status} ${s.command.join(" ")}` }, k);
24999
25219
  }) }),
25000
- /* @__PURE__ */ jsx26(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx26(
25001
- SelectInput9,
25220
+ /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
25221
+ SelectInput10,
25002
25222
  {
25003
25223
  items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
25004
25224
  onSelect: () => setPage("main")
@@ -25125,9 +25345,9 @@ var init_lsp_wizard = __esm({
25125
25345
  });
25126
25346
 
25127
25347
  // src/ui/theme-picker.tsx
25128
- import { Box as Box25, Text as Text26 } from "ink";
25129
- import SelectInput10 from "ink-select-input";
25130
- import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
25348
+ import { Box as Box26, Text as Text27 } from "ink";
25349
+ import SelectInput11 from "ink-select-input";
25350
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
25131
25351
  function PaletteSwatches({ palette }) {
25132
25352
  const colors = [
25133
25353
  palette.primary,
@@ -25135,7 +25355,7 @@ function PaletteSwatches({ palette }) {
25135
25355
  palette.success,
25136
25356
  palette.error
25137
25357
  ];
25138
- return /* @__PURE__ */ jsx27(Box25, { children: colors.map((c, i) => /* @__PURE__ */ jsx27(Text26, { color: c, children: "\u2588" }, i)) });
25358
+ return /* @__PURE__ */ jsx28(Box26, { children: colors.map((c, i) => /* @__PURE__ */ jsx28(Text27, { color: c, children: "\u2588" }, i)) });
25139
25359
  }
25140
25360
  function ThemePicker({ themes, onPick }) {
25141
25361
  const current = useTheme();
@@ -25143,10 +25363,10 @@ function ThemePicker({ themes, onPick }) {
25143
25363
  ...themes.map((t) => ({ label: t.label, value: t.name })),
25144
25364
  { label: "< Back", value: "__back__" }
25145
25365
  ];
25146
- return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: current.accent, paddingX: 1, children: [
25147
- /* @__PURE__ */ jsx27(Text26, { color: current.accent, bold: true, children: "Pick a theme (restart to apply)" }),
25148
- /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
25149
- SelectInput10,
25366
+ return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "column", borderStyle: "round", borderColor: current.accent, paddingX: 1, children: [
25367
+ /* @__PURE__ */ jsx28(Text27, { color: current.accent, bold: true, children: "Pick a theme (restart to apply)" }),
25368
+ /* @__PURE__ */ jsx28(Box26, { marginTop: 1, children: /* @__PURE__ */ jsx28(
25369
+ SelectInput11,
25150
25370
  {
25151
25371
  items,
25152
25372
  onSelect: (item) => {
@@ -25160,9 +25380,9 @@ function ThemePicker({ themes, onPick }) {
25160
25380
  itemComponent: ({ label, isSelected }) => {
25161
25381
  const t = themes.find((x) => x.label === label);
25162
25382
  const color = t?.accent ?? current.accent;
25163
- return /* @__PURE__ */ jsxs25(Box25, { children: [
25164
- /* @__PURE__ */ jsx27(Text26, { color, bold: isSelected, dimColor: !isSelected, children: label }),
25165
- t && /* @__PURE__ */ jsx27(Box25, { marginLeft: 1, children: /* @__PURE__ */ jsx27(PaletteSwatches, { palette: t.palette }) })
25383
+ return /* @__PURE__ */ jsxs26(Box26, { children: [
25384
+ /* @__PURE__ */ jsx28(Text27, { color, bold: isSelected, dimColor: !isSelected, children: label }),
25385
+ t && /* @__PURE__ */ jsx28(Box26, { marginLeft: 1, children: /* @__PURE__ */ jsx28(PaletteSwatches, { palette: t.palette }) })
25166
25386
  ] });
25167
25387
  }
25168
25388
  }
@@ -25177,9 +25397,9 @@ var init_theme_picker = __esm({
25177
25397
  });
25178
25398
 
25179
25399
  // src/ui/ui-picker.tsx
25180
- import { Box as Box26, Text as Text27 } from "ink";
25181
- import SelectInput11 from "ink-select-input";
25182
- import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
25400
+ import { Box as Box27, Text as Text28 } from "ink";
25401
+ import SelectInput12 from "ink-select-input";
25402
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
25183
25403
  function UiPicker({ current, onPick }) {
25184
25404
  const theme = useTheme();
25185
25405
  const items = [
@@ -25195,10 +25415,10 @@ function UiPicker({ current, onPick }) {
25195
25415
  },
25196
25416
  { label: "< Back", value: "__back__", description: "" }
25197
25417
  ];
25198
- return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25199
- /* @__PURE__ */ jsx28(Text27, { color: theme.accent, bold: true, children: "Pick UI engine (takes effect on next launch)" }),
25200
- /* @__PURE__ */ jsx28(Box26, { marginTop: 1, children: /* @__PURE__ */ jsx28(
25201
- SelectInput11,
25418
+ return /* @__PURE__ */ jsxs27(Box27, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25419
+ /* @__PURE__ */ jsx29(Text28, { color: theme.accent, bold: true, children: "Pick UI engine (takes effect on next launch)" }),
25420
+ /* @__PURE__ */ jsx29(Box27, { marginTop: 1, children: /* @__PURE__ */ jsx29(
25421
+ SelectInput12,
25202
25422
  {
25203
25423
  items,
25204
25424
  initialIndex: items.findIndex((i) => i.value === current),
@@ -25212,9 +25432,9 @@ function UiPicker({ current, onPick }) {
25212
25432
  itemComponent: ({ label, isSelected }) => {
25213
25433
  const item = items.find((i) => i.label === label);
25214
25434
  const desc = item?.description ?? "";
25215
- return /* @__PURE__ */ jsxs26(Box26, { children: [
25216
- /* @__PURE__ */ jsx28(Text27, { bold: isSelected, dimColor: !isSelected, children: label }),
25217
- desc ? /* @__PURE__ */ jsx28(Text27, { dimColor: true, children: ` \u2014 ${desc}` }) : null
25435
+ return /* @__PURE__ */ jsxs27(Box27, { children: [
25436
+ /* @__PURE__ */ jsx29(Text28, { bold: isSelected, dimColor: !isSelected, children: label }),
25437
+ desc ? /* @__PURE__ */ jsx29(Text28, { dimColor: true, children: ` \u2014 ${desc}` }) : null
25218
25438
  ] });
25219
25439
  }
25220
25440
  }
@@ -25229,9 +25449,9 @@ var init_ui_picker = __esm({
25229
25449
  });
25230
25450
 
25231
25451
  // src/ui/mode-picker.tsx
25232
- import { Box as Box27, Text as Text28 } from "ink";
25233
- import SelectInput12 from "ink-select-input";
25234
- import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
25452
+ import { Box as Box28, Text as Text29 } from "ink";
25453
+ import SelectInput13 from "ink-select-input";
25454
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
25235
25455
  function ModePicker({ current, onPick, multiAgentEnabled }) {
25236
25456
  const theme = useTheme();
25237
25457
  const availableModes = multiAgentEnabled ? MODES : MODES.filter((m) => m !== "multi-agent-experimental");
@@ -25240,11 +25460,11 @@ function ModePicker({ current, onPick, multiAgentEnabled }) {
25240
25460
  value: m,
25241
25461
  key: m
25242
25462
  }));
25243
- return /* @__PURE__ */ jsxs27(Box27, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25244
- /* @__PURE__ */ jsx29(Text28, { color: theme.accent, bold: true, children: "Select mode" }),
25245
- /* @__PURE__ */ jsx29(Text28, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
25246
- /* @__PURE__ */ jsx29(Box27, { marginTop: 1, children: /* @__PURE__ */ jsx29(
25247
- SelectInput12,
25463
+ return /* @__PURE__ */ jsxs28(Box28, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25464
+ /* @__PURE__ */ jsx30(Text29, { color: theme.accent, bold: true, children: "Select mode" }),
25465
+ /* @__PURE__ */ jsx30(Text29, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
25466
+ /* @__PURE__ */ jsx30(Box28, { marginTop: 1, children: /* @__PURE__ */ jsx30(
25467
+ SelectInput13,
25248
25468
  {
25249
25469
  items,
25250
25470
  onSelect: (item) => onPick(item.value)
@@ -25261,9 +25481,9 @@ var init_mode_picker = __esm({
25261
25481
  });
25262
25482
 
25263
25483
  // src/ui/shell-picker.tsx
25264
- import { Box as Box28, Text as Text29 } from "ink";
25265
- import SelectInput13 from "ink-select-input";
25266
- import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
25484
+ import { Box as Box29, Text as Text30 } from "ink";
25485
+ import SelectInput14 from "ink-select-input";
25486
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
25267
25487
  function ShellPicker({ current, onPick }) {
25268
25488
  const theme = useTheme();
25269
25489
  const items = SHELLS.map((s) => ({
@@ -25271,10 +25491,10 @@ function ShellPicker({ current, onPick }) {
25271
25491
  value: s.value,
25272
25492
  key: s.value
25273
25493
  }));
25274
- return /* @__PURE__ */ jsxs28(Box28, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25275
- /* @__PURE__ */ jsx30(Text29, { color: theme.accent, bold: true, children: "Select shell" }),
25276
- /* @__PURE__ */ jsx30(Text29, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
25277
- /* @__PURE__ */ jsx30(Box28, { marginTop: 1, children: /* @__PURE__ */ jsx30(SelectInput13, { items, onSelect: (item) => onPick(item.value) }) })
25494
+ return /* @__PURE__ */ jsxs29(Box29, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25495
+ /* @__PURE__ */ jsx31(Text30, { color: theme.accent, bold: true, children: "Select shell" }),
25496
+ /* @__PURE__ */ jsx31(Text30, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
25497
+ /* @__PURE__ */ jsx31(Box29, { marginTop: 1, children: /* @__PURE__ */ jsx31(SelectInput14, { items, onSelect: (item) => onPick(item.value) }) })
25278
25498
  ] });
25279
25499
  }
25280
25500
  var SHELLS;
@@ -25292,18 +25512,18 @@ var init_shell_picker = __esm({
25292
25512
  });
25293
25513
 
25294
25514
  // src/ui/memory-picker.tsx
25295
- import { useState as useState18, useCallback as useCallback5 } from "react";
25296
- import { Box as Box29, Text as Text30, useInput as useInput12 } from "ink";
25297
- import SelectInput14 from "ink-select-input";
25298
- import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
25515
+ import { useState as useState19, useCallback as useCallback5 } from "react";
25516
+ import { Box as Box30, Text as Text31, useInput as useInput13 } from "ink";
25517
+ import SelectInput15 from "ink-select-input";
25518
+ import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
25299
25519
  function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
25300
25520
  const theme = useTheme();
25301
- const [screen, setScreen] = useState18("menu");
25302
- const [query, setQuery] = useState18("");
25303
- const [results, setResults] = useState18([]);
25304
- const [searching, setSearching] = useState18(false);
25305
- const [searched, setSearched] = useState18(false);
25306
- useInput12((_, key) => {
25521
+ const [screen, setScreen] = useState19("menu");
25522
+ const [query, setQuery] = useState19("");
25523
+ const [results, setResults] = useState19([]);
25524
+ const [searching, setSearching] = useState19(false);
25525
+ const [searched, setSearched] = useState19(false);
25526
+ useInput13((_, key) => {
25307
25527
  if (key.escape) {
25308
25528
  if (screen === "search" || screen === "confirm-clear") {
25309
25529
  setScreen("menu");
@@ -25332,11 +25552,11 @@ function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
25332
25552
  [memoryManager]
25333
25553
  );
25334
25554
  if (screen === "confirm-clear") {
25335
- return /* @__PURE__ */ jsxs29(Box29, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25336
- /* @__PURE__ */ jsx31(Text30, { color: theme.accent, bold: true, children: "\u26A0\uFE0F Clear All Memories" }),
25337
- /* @__PURE__ */ jsx31(Text30, { color: theme.info.color, children: "This will permanently delete every stored memory. This cannot be undone." }),
25338
- /* @__PURE__ */ jsx31(Box29, { marginTop: 1, children: /* @__PURE__ */ jsx31(
25339
- SelectInput14,
25555
+ return /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25556
+ /* @__PURE__ */ jsx32(Text31, { color: theme.accent, bold: true, children: "\u26A0\uFE0F Clear All Memories" }),
25557
+ /* @__PURE__ */ jsx32(Text31, { color: theme.info.color, children: "This will permanently delete every stored memory. This cannot be undone." }),
25558
+ /* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(
25559
+ SelectInput15,
25340
25560
  {
25341
25561
  items: [
25342
25562
  { label: "Yes, clear everything", value: "yes", key: "yes" },
@@ -25353,10 +25573,10 @@ function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
25353
25573
  ] });
25354
25574
  }
25355
25575
  if (screen === "search") {
25356
- return /* @__PURE__ */ jsxs29(Box29, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25357
- /* @__PURE__ */ jsx31(Text30, { color: theme.accent, bold: true, children: "Search Memories" }),
25358
- /* @__PURE__ */ jsx31(Text30, { color: theme.info.color, dimColor: false, children: "Type a query and press Enter. Esc to go back." }),
25359
- /* @__PURE__ */ jsx31(Box29, { marginTop: 1, children: /* @__PURE__ */ jsx31(
25576
+ return /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25577
+ /* @__PURE__ */ jsx32(Text31, { color: theme.accent, bold: true, children: "Search Memories" }),
25578
+ /* @__PURE__ */ jsx32(Text31, { color: theme.info.color, dimColor: false, children: "Type a query and press Enter. Esc to go back." }),
25579
+ /* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(
25360
25580
  CustomTextInput,
25361
25581
  {
25362
25582
  value: query,
@@ -25365,16 +25585,16 @@ function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
25365
25585
  focus: true
25366
25586
  }
25367
25587
  ) }),
25368
- searching && /* @__PURE__ */ jsx31(Box29, { marginTop: 1, children: /* @__PURE__ */ jsx31(Text30, { color: theme.info.color, children: "Searching\u2026" }) }),
25369
- searched && !searching && results.length === 0 && /* @__PURE__ */ jsx31(Box29, { marginTop: 1, children: /* @__PURE__ */ jsx31(Text30, { color: theme.info.color, children: "No memories found." }) }),
25370
- results.length > 0 && /* @__PURE__ */ jsxs29(Box29, { flexDirection: "column", marginTop: 1, children: [
25371
- /* @__PURE__ */ jsxs29(Text30, { color: theme.accent, bold: true, children: [
25588
+ searching && /* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(Text31, { color: theme.info.color, children: "Searching\u2026" }) }),
25589
+ searched && !searching && results.length === 0 && /* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(Text31, { color: theme.info.color, children: "No memories found." }) }),
25590
+ results.length > 0 && /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", marginTop: 1, children: [
25591
+ /* @__PURE__ */ jsxs30(Text31, { color: theme.accent, bold: true, children: [
25372
25592
  "Results (",
25373
25593
  results.length,
25374
25594
  ")"
25375
25595
  ] }),
25376
- results.map((r, i) => /* @__PURE__ */ jsxs29(Box29, { flexDirection: "column", marginTop: 1, children: [
25377
- /* @__PURE__ */ jsxs29(Text30, { color: theme.info.color, dimColor: false, children: [
25596
+ results.map((r, i) => /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", marginTop: 1, children: [
25597
+ /* @__PURE__ */ jsxs30(Text31, { color: theme.info.color, dimColor: false, children: [
25378
25598
  "#",
25379
25599
  i + 1,
25380
25600
  " \xB7 ",
@@ -25382,8 +25602,8 @@ function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
25382
25602
  " \xB7 importance ",
25383
25603
  r.memory.importance
25384
25604
  ] }),
25385
- /* @__PURE__ */ jsx31(Text30, { children: r.memory.content.length > 120 ? r.memory.content.slice(0, 120) + "\u2026" : r.memory.content }),
25386
- /* @__PURE__ */ jsxs29(Text30, { color: theme.info.color, dimColor: false, children: [
25605
+ /* @__PURE__ */ jsx32(Text31, { children: r.memory.content.length > 120 ? r.memory.content.slice(0, 120) + "\u2026" : r.memory.content }),
25606
+ /* @__PURE__ */ jsxs30(Text31, { color: theme.info.color, dimColor: false, children: [
25387
25607
  "score: ",
25388
25608
  r.combinedScore.toFixed(3),
25389
25609
  " \xB7 ",
@@ -25400,11 +25620,11 @@ function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
25400
25620
  { label: " Search memories\u2026", value: "search", key: "search" },
25401
25621
  { label: " (close)", value: "__close__", key: "close" }
25402
25622
  ];
25403
- return /* @__PURE__ */ jsxs29(Box29, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25404
- /* @__PURE__ */ jsx31(Text30, { color: theme.accent, bold: true, children: "Memory" }),
25405
- /* @__PURE__ */ jsx31(Text30, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
25406
- /* @__PURE__ */ jsx31(Box29, { marginTop: 1, children: /* @__PURE__ */ jsx31(
25407
- SelectInput14,
25623
+ return /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25624
+ /* @__PURE__ */ jsx32(Text31, { color: theme.accent, bold: true, children: "Memory" }),
25625
+ /* @__PURE__ */ jsx32(Text31, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
25626
+ /* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(
25627
+ SelectInput15,
25408
25628
  {
25409
25629
  items,
25410
25630
  onSelect: (item) => {
@@ -25435,9 +25655,9 @@ var init_memory_picker = __esm({
25435
25655
  });
25436
25656
 
25437
25657
  // src/ui/gateway-picker.tsx
25438
- import { Box as Box30, Text as Text31 } from "ink";
25439
- import SelectInput15 from "ink-select-input";
25440
- import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
25658
+ import { Box as Box31, Text as Text32 } from "ink";
25659
+ import SelectInput16 from "ink-select-input";
25660
+ import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
25441
25661
  function GatewayPicker({ gatewayId, skipCache, collectLogs, metadataCount, onAction, onDone }) {
25442
25662
  const theme = useTheme();
25443
25663
  const items = [
@@ -25477,11 +25697,11 @@ function GatewayPicker({ gatewayId, skipCache, collectLogs, metadataCount, onAct
25477
25697
  }
25478
25698
  items.push({ label: " (close)", value: "__close__", key: "close" });
25479
25699
  const selectable = items.filter((i) => !i.value.startsWith("__label_"));
25480
- return /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25481
- /* @__PURE__ */ jsx32(Text31, { color: theme.accent, bold: true, children: "AI Gateway" }),
25482
- /* @__PURE__ */ jsx32(Text31, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
25483
- /* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(
25484
- SelectInput15,
25700
+ return /* @__PURE__ */ jsxs31(Box31, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25701
+ /* @__PURE__ */ jsx33(Text32, { color: theme.accent, bold: true, children: "AI Gateway" }),
25702
+ /* @__PURE__ */ jsx33(Text32, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
25703
+ /* @__PURE__ */ jsx33(Box31, { marginTop: 1, children: /* @__PURE__ */ jsx33(
25704
+ SelectInput16,
25485
25705
  {
25486
25706
  items: selectable,
25487
25707
  onSelect: (item) => {
@@ -25503,9 +25723,9 @@ var init_gateway_picker = __esm({
25503
25723
  });
25504
25724
 
25505
25725
  // src/ui/skills-picker.tsx
25506
- import { Box as Box31, Text as Text32 } from "ink";
25507
- import SelectInput16 from "ink-select-input";
25508
- import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
25726
+ import { Box as Box32, Text as Text33 } from "ink";
25727
+ import SelectInput17 from "ink-select-input";
25728
+ import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
25509
25729
  function SkillsPicker({ onAction, onDone }) {
25510
25730
  const theme = useTheme();
25511
25731
  const items = [
@@ -25517,11 +25737,11 @@ function SkillsPicker({ onAction, onDone }) {
25517
25737
  { label: " Disable skill\u2026", value: "disable", key: "disable" },
25518
25738
  { label: " (close)", value: "__close__", key: "close" }
25519
25739
  ];
25520
- return /* @__PURE__ */ jsxs31(Box31, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25521
- /* @__PURE__ */ jsx33(Text32, { color: theme.accent, bold: true, children: "Skills" }),
25522
- /* @__PURE__ */ jsx33(Text32, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
25523
- /* @__PURE__ */ jsx33(Box31, { marginTop: 1, children: /* @__PURE__ */ jsx33(
25524
- SelectInput16,
25740
+ return /* @__PURE__ */ jsxs32(Box32, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25741
+ /* @__PURE__ */ jsx34(Text33, { color: theme.accent, bold: true, children: "Skills" }),
25742
+ /* @__PURE__ */ jsx34(Text33, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
25743
+ /* @__PURE__ */ jsx34(Box32, { marginTop: 1, children: /* @__PURE__ */ jsx34(
25744
+ SelectInput17,
25525
25745
  {
25526
25746
  items,
25527
25747
  onSelect: (item) => {
@@ -25543,16 +25763,16 @@ var init_skills_picker = __esm({
25543
25763
  });
25544
25764
 
25545
25765
  // src/ui/remote-dashboard.tsx
25546
- import { useEffect as useEffect10, useState as useState19 } from "react";
25547
- import { Box as Box32, Text as Text33, useInput as useInput13 } from "ink";
25548
- import SelectInput17 from "ink-select-input";
25549
- import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
25766
+ import { useEffect as useEffect10, useState as useState20 } from "react";
25767
+ import { Box as Box33, Text as Text34, useInput as useInput14 } from "ink";
25768
+ import SelectInput18 from "ink-select-input";
25769
+ import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
25550
25770
  function RemoteDashboard({ onSelect, onCancel }) {
25551
25771
  const theme = useTheme();
25552
- const [sessions, setSessions] = useState19([]);
25553
- const [loading, setLoading] = useState19(true);
25554
- const [error, setError] = useState19(null);
25555
- const [refreshing, setRefreshing] = useState19(false);
25772
+ const [sessions, setSessions] = useState20([]);
25773
+ const [loading, setLoading] = useState20(true);
25774
+ const [error, setError] = useState20(null);
25775
+ const [refreshing, setRefreshing] = useState20(false);
25556
25776
  useEffect10(() => {
25557
25777
  loadSessions();
25558
25778
  }, []);
@@ -25589,7 +25809,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
25589
25809
  setRefreshing(false);
25590
25810
  }
25591
25811
  }
25592
- useInput13((input, key) => {
25812
+ useInput14((input, key) => {
25593
25813
  if (input === "r" || input === "R") {
25594
25814
  void loadSessions();
25595
25815
  }
@@ -25602,31 +25822,31 @@ function RemoteDashboard({ onSelect, onCancel }) {
25602
25822
  value: s.sessionId
25603
25823
  }));
25604
25824
  if (loading) {
25605
- return /* @__PURE__ */ jsx34(Box32, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ jsx34(Text33, { color: theme.accent, children: "Loading remote sessions..." }) });
25825
+ return /* @__PURE__ */ jsx35(Box33, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ jsx35(Text34, { color: theme.accent, children: "Loading remote sessions..." }) });
25606
25826
  }
25607
25827
  if (error) {
25608
- return /* @__PURE__ */ jsxs32(Box32, { flexDirection: "column", padding: 1, children: [
25609
- /* @__PURE__ */ jsxs32(Text33, { color: theme.error, children: [
25828
+ return /* @__PURE__ */ jsxs33(Box33, { flexDirection: "column", padding: 1, children: [
25829
+ /* @__PURE__ */ jsxs33(Text34, { color: theme.error, children: [
25610
25830
  "Error: ",
25611
25831
  error
25612
25832
  ] }),
25613
- /* @__PURE__ */ jsx34(Text33, { dimColor: true, children: "Press R to retry, Esc to close" })
25833
+ /* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "Press R to retry, Esc to close" })
25614
25834
  ] });
25615
25835
  }
25616
25836
  if (sessions.length === 0) {
25617
- return /* @__PURE__ */ jsxs32(Box32, { flexDirection: "column", padding: 1, children: [
25618
- /* @__PURE__ */ jsx34(Text33, { color: theme.accent, children: "No remote sessions yet." }),
25619
- /* @__PURE__ */ jsx34(Text33, { dimColor: true, children: "Type /remote <prompt> to start one." }),
25620
- /* @__PURE__ */ jsx34(Text33, { dimColor: true, children: "Press Esc to close" })
25837
+ return /* @__PURE__ */ jsxs33(Box33, { flexDirection: "column", padding: 1, children: [
25838
+ /* @__PURE__ */ jsx35(Text34, { color: theme.accent, children: "No remote sessions yet." }),
25839
+ /* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "Type /remote <prompt> to start one." }),
25840
+ /* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "Press Esc to close" })
25621
25841
  ] });
25622
25842
  }
25623
- return /* @__PURE__ */ jsxs32(Box32, { flexDirection: "column", padding: 1, children: [
25624
- /* @__PURE__ */ jsxs32(Text33, { bold: true, color: theme.accent, children: [
25843
+ return /* @__PURE__ */ jsxs33(Box33, { flexDirection: "column", padding: 1, children: [
25844
+ /* @__PURE__ */ jsxs33(Text34, { bold: true, color: theme.accent, children: [
25625
25845
  "Recent remote tasks ",
25626
25846
  refreshing ? "(refreshing...)" : ""
25627
25847
  ] }),
25628
- /* @__PURE__ */ jsx34(Box32, { marginTop: 1, children: /* @__PURE__ */ jsx34(
25629
- SelectInput17,
25848
+ /* @__PURE__ */ jsx35(Box33, { marginTop: 1, children: /* @__PURE__ */ jsx35(
25849
+ SelectInput18,
25630
25850
  {
25631
25851
  items,
25632
25852
  onSelect: (item) => {
@@ -25635,7 +25855,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
25635
25855
  }
25636
25856
  }
25637
25857
  ) }),
25638
- /* @__PURE__ */ jsx34(Box32, { marginTop: 1, children: /* @__PURE__ */ jsx34(Text33, { dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter select \u2022 R refresh \u2022 Esc close" }) })
25858
+ /* @__PURE__ */ jsx35(Box33, { marginTop: 1, children: /* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter select \u2022 R refresh \u2022 Esc close" }) })
25639
25859
  ] });
25640
25860
  }
25641
25861
  function formatSessionLine(s) {
@@ -25667,8 +25887,8 @@ function RemoteSessionDetail({
25667
25887
  onCancel
25668
25888
  }) {
25669
25889
  const theme = useTheme();
25670
- const [cancelling, setCancelling] = useState19(false);
25671
- useInput13((input, key) => {
25890
+ const [cancelling, setCancelling] = useState20(false);
25891
+ useInput14((input, key) => {
25672
25892
  if (key.escape) {
25673
25893
  onBack();
25674
25894
  }
@@ -25688,50 +25908,50 @@ function RemoteSessionDetail({
25688
25908
  }
25689
25909
  }
25690
25910
  const isRunning = session.status === "running" || session.status === "pending";
25691
- return /* @__PURE__ */ jsxs32(Box32, { flexDirection: "column", padding: 1, children: [
25692
- /* @__PURE__ */ jsx34(Text33, { bold: true, color: theme.accent, children: "Remote Session" }),
25693
- /* @__PURE__ */ jsxs32(Box32, { marginTop: 1, flexDirection: "column", children: [
25694
- /* @__PURE__ */ jsxs32(Text33, { children: [
25911
+ return /* @__PURE__ */ jsxs33(Box33, { flexDirection: "column", padding: 1, children: [
25912
+ /* @__PURE__ */ jsx35(Text34, { bold: true, color: theme.accent, children: "Remote Session" }),
25913
+ /* @__PURE__ */ jsxs33(Box33, { marginTop: 1, flexDirection: "column", children: [
25914
+ /* @__PURE__ */ jsxs33(Text34, { children: [
25695
25915
  "ID: ",
25696
25916
  session.sessionId
25697
25917
  ] }),
25698
- /* @__PURE__ */ jsxs32(Text33, { children: [
25918
+ /* @__PURE__ */ jsxs33(Text34, { children: [
25699
25919
  "Repo: ",
25700
25920
  session.repo
25701
25921
  ] }),
25702
- /* @__PURE__ */ jsxs32(Text33, { children: [
25922
+ /* @__PURE__ */ jsxs33(Text34, { children: [
25703
25923
  "Status: ",
25704
25924
  session.status
25705
25925
  ] }),
25706
- /* @__PURE__ */ jsxs32(Text33, { children: [
25926
+ /* @__PURE__ */ jsxs33(Text34, { children: [
25707
25927
  "Prompt: ",
25708
25928
  session.prompt
25709
25929
  ] }),
25710
- session.prUrl && /* @__PURE__ */ jsxs32(Text33, { children: [
25930
+ session.prUrl && /* @__PURE__ */ jsxs33(Text34, { children: [
25711
25931
  "PR: ",
25712
25932
  session.prUrl
25713
25933
  ] }),
25714
- session.errorMessage && /* @__PURE__ */ jsxs32(Text33, { color: theme.error, children: [
25934
+ session.errorMessage && /* @__PURE__ */ jsxs33(Text34, { color: theme.error, children: [
25715
25935
  "Error: ",
25716
25936
  session.errorMessage
25717
25937
  ] }),
25718
- session.tokensUsed !== void 0 && /* @__PURE__ */ jsxs32(Text33, { children: [
25938
+ session.tokensUsed !== void 0 && /* @__PURE__ */ jsxs33(Text34, { children: [
25719
25939
  "Tokens: ",
25720
25940
  formatTokens2(session.tokensUsed),
25721
25941
  session.tokensBudget ? ` / ${formatTokens2(session.tokensBudget)}` : ""
25722
25942
  ] }),
25723
- /* @__PURE__ */ jsxs32(Text33, { children: [
25943
+ /* @__PURE__ */ jsxs33(Text34, { children: [
25724
25944
  "Created: ",
25725
25945
  new Date(session.createdAt).toLocaleString()
25726
25946
  ] }),
25727
- session.finishedAt && /* @__PURE__ */ jsxs32(Text33, { children: [
25947
+ session.finishedAt && /* @__PURE__ */ jsxs33(Text34, { children: [
25728
25948
  "Finished: ",
25729
25949
  new Date(session.finishedAt).toLocaleString()
25730
25950
  ] })
25731
25951
  ] }),
25732
- /* @__PURE__ */ jsxs32(Box32, { marginTop: 1, flexDirection: "row", gap: 2, children: [
25733
- isRunning && onCancel && /* @__PURE__ */ jsx34(Text33, { color: theme.error, children: cancelling ? "Cancelling..." : "[C] Cancel session" }),
25734
- /* @__PURE__ */ jsx34(Text33, { dimColor: true, children: "Esc back" })
25952
+ /* @__PURE__ */ jsxs33(Box33, { marginTop: 1, flexDirection: "row", gap: 2, children: [
25953
+ isRunning && onCancel && /* @__PURE__ */ jsx35(Text34, { color: theme.error, children: cancelling ? "Cancelling..." : "[C] Cancel session" }),
25954
+ /* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "Esc back" })
25735
25955
  ] })
25736
25956
  ] });
25737
25957
  }
@@ -25745,17 +25965,17 @@ var init_remote_dashboard = __esm({
25745
25965
  });
25746
25966
 
25747
25967
  // src/ui/inbox-modal.tsx
25748
- import { useState as useState20, useCallback as useCallback6 } from "react";
25749
- import { Box as Box33, Text as Text34, useInput as useInput14 } from "ink";
25750
- import { Fragment as Fragment3, jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
25968
+ import { useState as useState21, useCallback as useCallback6 } from "react";
25969
+ import { Box as Box34, Text as Text35, useInput as useInput15 } from "ink";
25970
+ import { Fragment as Fragment3, jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
25751
25971
  function InboxModal({ onDone, onOpen }) {
25752
25972
  const theme = useTheme();
25753
- const [step, setStep] = useState20("twitter");
25754
- const [twitter, setTwitter] = useState20("");
25755
- const [secret, setSecret] = useState20("");
25756
- const [messages, setMessages] = useState20([]);
25757
- const [selectedIndex, setSelectedIndex] = useState20(0);
25758
- const [error, setError] = useState20(null);
25973
+ const [step, setStep] = useState21("twitter");
25974
+ const [twitter, setTwitter] = useState21("");
25975
+ const [secret, setSecret] = useState21("");
25976
+ const [messages, setMessages] = useState21([]);
25977
+ const [selectedIndex, setSelectedIndex] = useState21(0);
25978
+ const [error, setError] = useState21(null);
25759
25979
  const checkInbox = useCallback6(
25760
25980
  async (u, s) => {
25761
25981
  setStep("checking");
@@ -25812,7 +26032,7 @@ function InboxModal({ onDone, onOpen }) {
25812
26032
  onOpen(url);
25813
26033
  onDone();
25814
26034
  }, [messages, selectedIndex, twitter, secret, onOpen, onDone]);
25815
- useInput14(
26035
+ useInput15(
25816
26036
  (_input, key) => {
25817
26037
  if (key.escape) {
25818
26038
  onDone();
@@ -25834,11 +26054,11 @@ function InboxModal({ onDone, onOpen }) {
25834
26054
  },
25835
26055
  { isActive: step === "result" }
25836
26056
  );
25837
- return /* @__PURE__ */ jsxs33(Box33, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
25838
- /* @__PURE__ */ jsx35(Text34, { color: theme.accent, bold: true, children: "/inbox" }),
25839
- step === "twitter" && /* @__PURE__ */ jsxs33(Fragment3, { children: [
25840
- /* @__PURE__ */ jsx35(Text34, { color: theme.palette.foreground, children: "Enter your Twitter username (or press Enter to cancel):" }),
25841
- /* @__PURE__ */ jsx35(Box33, { marginTop: 1, children: /* @__PURE__ */ jsx35(
26057
+ return /* @__PURE__ */ jsxs34(Box34, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
26058
+ /* @__PURE__ */ jsx36(Text35, { color: theme.accent, bold: true, children: "/inbox" }),
26059
+ step === "twitter" && /* @__PURE__ */ jsxs34(Fragment3, { children: [
26060
+ /* @__PURE__ */ jsx36(Text35, { color: theme.palette.foreground, children: "Enter your Twitter username (or press Enter to cancel):" }),
26061
+ /* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(
25842
26062
  CustomTextInput,
25843
26063
  {
25844
26064
  value: twitter,
@@ -25848,9 +26068,9 @@ function InboxModal({ onDone, onOpen }) {
25848
26068
  }
25849
26069
  ) })
25850
26070
  ] }),
25851
- step === "secret" && /* @__PURE__ */ jsxs33(Fragment3, { children: [
25852
- /* @__PURE__ */ jsx35(Text34, { color: theme.palette.foreground, children: "Enter your secret (or press Enter to cancel):" }),
25853
- /* @__PURE__ */ jsx35(Box33, { marginTop: 1, children: /* @__PURE__ */ jsx35(
26071
+ step === "secret" && /* @__PURE__ */ jsxs34(Fragment3, { children: [
26072
+ /* @__PURE__ */ jsx36(Text35, { color: theme.palette.foreground, children: "Enter your secret (or press Enter to cancel):" }),
26073
+ /* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(
25854
26074
  CustomTextInput,
25855
26075
  {
25856
26076
  value: secret,
@@ -25861,13 +26081,13 @@ function InboxModal({ onDone, onOpen }) {
25861
26081
  }
25862
26082
  ) })
25863
26083
  ] }),
25864
- step === "checking" && /* @__PURE__ */ jsx35(Text34, { color: theme.info.color, children: "Checking your inbox\u2026" }),
25865
- step === "result" && /* @__PURE__ */ jsxs33(Fragment3, { children: [
25866
- error ? /* @__PURE__ */ jsxs33(Text34, { color: theme.error, children: [
26084
+ step === "checking" && /* @__PURE__ */ jsx36(Text35, { color: theme.info.color, children: "Checking your inbox\u2026" }),
26085
+ step === "result" && /* @__PURE__ */ jsxs34(Fragment3, { children: [
26086
+ error ? /* @__PURE__ */ jsxs34(Text35, { color: theme.error, children: [
25867
26087
  "Error: ",
25868
26088
  error
25869
- ] }) : messages.length > 0 ? /* @__PURE__ */ jsxs33(Fragment3, { children: [
25870
- /* @__PURE__ */ jsxs33(Text34, { color: theme.palette.foreground, children: [
26089
+ ] }) : messages.length > 0 ? /* @__PURE__ */ jsxs34(Fragment3, { children: [
26090
+ /* @__PURE__ */ jsxs34(Text35, { color: theme.palette.foreground, children: [
25871
26091
  "You have ",
25872
26092
  messages.length,
25873
26093
  " message",
@@ -25875,12 +26095,12 @@ function InboxModal({ onDone, onOpen }) {
25875
26095
  messages.some((m) => !m.seen) ? " (\u{1F534} new)" : "",
25876
26096
  ":"
25877
26097
  ] }),
25878
- /* @__PURE__ */ jsx35(Box33, { flexDirection: "column", marginTop: 1, children: messages.map((msg, idx) => {
26098
+ /* @__PURE__ */ jsx36(Box34, { flexDirection: "column", marginTop: 1, children: messages.map((msg, idx) => {
25879
26099
  const isSelected = idx === selectedIndex;
25880
26100
  const dateStr = new Date(msg.createdAt).toLocaleString();
25881
26101
  const marker = msg.seen ? " " : "\u{1F534} ";
25882
- return /* @__PURE__ */ jsxs33(
25883
- Text34,
26102
+ return /* @__PURE__ */ jsxs34(
26103
+ Text35,
25884
26104
  {
25885
26105
  color: isSelected ? theme.accent : theme.palette.foreground,
25886
26106
  bold: isSelected,
@@ -25895,15 +26115,15 @@ function InboxModal({ onDone, onOpen }) {
25895
26115
  msg.id
25896
26116
  );
25897
26117
  }) }),
25898
- /* @__PURE__ */ jsx35(Box33, { marginTop: 1, children: /* @__PURE__ */ jsx35(Text34, { color: theme.info.color, children: "\u2191\u2193 to select \xB7 Enter to open in browser" }) })
25899
- ] }) : /* @__PURE__ */ jsxs33(Text34, { color: theme.muted?.color ?? theme.palette.secondary, children: [
26118
+ /* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(Text35, { color: theme.info.color, children: "\u2191\u2193 to select \xB7 Enter to open in browser" }) })
26119
+ ] }) : /* @__PURE__ */ jsxs34(Text35, { color: theme.muted?.color ?? theme.palette.secondary, children: [
25900
26120
  "No messages yet for @",
25901
26121
  twitter,
25902
26122
  " / ",
25903
26123
  secret.replace(/./g, "*"),
25904
26124
  "."
25905
26125
  ] }),
25906
- /* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "Press Esc to close." })
26126
+ /* @__PURE__ */ jsx36(Text35, { dimColor: true, children: "Press Esc to close." })
25907
26127
  ] })
25908
26128
  ] });
25909
26129
  }
@@ -26160,17 +26380,17 @@ var init_app_helpers = __esm({
26160
26380
  });
26161
26381
 
26162
26382
  // src/ui/multi-agent-modal.tsx
26163
- import { useState as useState21, useCallback as useCallback7 } from "react";
26164
- import { Box as Box34, Text as Text35, useInput as useInput15 } from "ink";
26165
- import { Fragment as Fragment4, jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
26383
+ import { useState as useState22, useCallback as useCallback7 } from "react";
26384
+ import { Box as Box35, Text as Text36, useInput as useInput16 } from "ink";
26385
+ import { Fragment as Fragment4, jsx as jsx37, jsxs as jsxs35 } from "react/jsx-runtime";
26166
26386
  function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthSecret }) {
26167
26387
  const theme = useTheme();
26168
- const [state, setState] = useState21(initial);
26169
- const [cursor, setCursor] = useState21(0);
26170
- const [editing, setEditing] = useState21(null);
26171
- const [editValue, setEditValue] = useState21("");
26172
- const [deployLog, setDeployLog] = useState21([]);
26173
- const [deploying, setDeploying] = useState21(false);
26388
+ const [state, setState] = useState22(initial);
26389
+ const [cursor, setCursor] = useState22(0);
26390
+ const [editing, setEditing] = useState22(null);
26391
+ const [editValue, setEditValue] = useState22("");
26392
+ const [deployLog, setDeployLog] = useState22([]);
26393
+ const [deploying, setDeploying] = useState22(false);
26174
26394
  const isBool = (f) => f === "enabled" || f === "autoExecute";
26175
26395
  const currentBool = (f) => f === "enabled" ? !!state.multiAgentEnabled : !!state.autoExecute;
26176
26396
  const currentStr = (f) => {
@@ -26195,8 +26415,8 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
26195
26415
  "deploy",
26196
26416
  ...hasEndpoint ? ["teardown"] : []
26197
26417
  ];
26198
- const [pickerCandidates, setPickerCandidates] = useState21(null);
26199
- const [pickerCursor, setPickerCursor] = useState21(0);
26418
+ const [pickerCandidates, setPickerCandidates] = useState22(null);
26419
+ const [pickerCursor, setPickerCursor] = useState22(0);
26200
26420
  const startDeployWithName = useCallback7(async (workerName) => {
26201
26421
  setDeploying(true);
26202
26422
  setDeployLog([`Starting deploy${workerName ? ` to ${workerName}` : ""}\u2026`]);
@@ -26230,7 +26450,7 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
26230
26450
  }
26231
26451
  await startDeployWithName();
26232
26452
  }, [startDeployWithName]);
26233
- const [teardownConfirming, setTeardownConfirming] = useState21(false);
26453
+ const [teardownConfirming, setTeardownConfirming] = useState22(false);
26234
26454
  const runTeardown = useCallback7(async () => {
26235
26455
  setDeploying(true);
26236
26456
  setDeployLog(["Starting tear-down\u2026"]);
@@ -26280,7 +26500,7 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
26280
26500
  setEditing(null);
26281
26501
  setEditValue("");
26282
26502
  }, [editing, persist]);
26283
- useInput15(
26503
+ useInput16(
26284
26504
  (input, key) => {
26285
26505
  if (deploying) return;
26286
26506
  if (pickerCandidates) {
@@ -26381,12 +26601,12 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
26381
26601
  if (!v) return "(not set)";
26382
26602
  return v;
26383
26603
  };
26384
- return /* @__PURE__ */ jsxs34(Box34, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
26385
- /* @__PURE__ */ jsx36(Text35, { color: theme.accent, bold: true, children: "/multi-agent \xB7 settings" }),
26386
- pickerCandidates ? /* @__PURE__ */ jsxs34(Box34, { flexDirection: "column", marginTop: 1, children: [
26387
- /* @__PURE__ */ jsx36(Text35, { color: theme.accent, bold: true, children: "Existing Workers found on your account" }),
26388
- /* @__PURE__ */ jsx36(Text35, { dimColor: true, children: "Pick one to deploy to, or create a new isolated Worker:" }),
26389
- /* @__PURE__ */ jsx36(Box34, { flexDirection: "column", marginTop: 1, children: [
26604
+ return /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
26605
+ /* @__PURE__ */ jsx37(Text36, { color: theme.accent, bold: true, children: "/multi-agent \xB7 settings" }),
26606
+ pickerCandidates ? /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, children: [
26607
+ /* @__PURE__ */ jsx37(Text36, { color: theme.accent, bold: true, children: "Existing Workers found on your account" }),
26608
+ /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: "Pick one to deploy to, or create a new isolated Worker:" }),
26609
+ /* @__PURE__ */ jsx37(Box35, { flexDirection: "column", marginTop: 1, children: [
26390
26610
  ...pickerCandidates.map((n, idx) => ({
26391
26611
  key: n,
26392
26612
  idx,
@@ -26399,23 +26619,23 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
26399
26619
  }
26400
26620
  ].map(({ key, idx, label }) => {
26401
26621
  const selected = idx === pickerCursor;
26402
- return /* @__PURE__ */ jsxs34(Text35, { color: selected ? theme.accent : theme.palette.foreground, bold: selected, children: [
26622
+ return /* @__PURE__ */ jsxs35(Text36, { color: selected ? theme.accent : theme.palette.foreground, bold: selected, children: [
26403
26623
  selected ? "\u203A " : " ",
26404
26624
  label
26405
26625
  ] }, key);
26406
26626
  }) }),
26407
- /* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(Text35, { dimColor: true, children: "\u2191\u2193 to pick \xB7 Enter to deploy \xB7 Esc to cancel" }) })
26408
- ] }) : teardownConfirming ? /* @__PURE__ */ jsxs34(Box34, { flexDirection: "column", marginTop: 1, children: [
26409
- /* @__PURE__ */ jsx36(Text35, { color: theme.palette.error, bold: true, children: "Tear down multi-agent?" }),
26410
- /* @__PURE__ */ jsx36(Text35, { color: theme.palette.foreground, children: "This deletes the Worker and OAUTH_KV namespace from your Cloudflare account, and clears your local config." }),
26411
- /* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(Text35, { dimColor: true, children: "y to confirm \xB7 n or Esc to cancel" }) })
26412
- ] }) : editing ? /* @__PURE__ */ jsxs34(Box34, { flexDirection: "column", marginTop: 1, children: [
26413
- /* @__PURE__ */ jsxs34(Text35, { color: theme.palette.foreground, children: [
26627
+ /* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: "\u2191\u2193 to pick \xB7 Enter to deploy \xB7 Esc to cancel" }) })
26628
+ ] }) : teardownConfirming ? /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, children: [
26629
+ /* @__PURE__ */ jsx37(Text36, { color: theme.palette.error, bold: true, children: "Tear down multi-agent?" }),
26630
+ /* @__PURE__ */ jsx37(Text36, { color: theme.palette.foreground, children: "This deletes the Worker and OAUTH_KV namespace from your Cloudflare account, and clears your local config." }),
26631
+ /* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: "y to confirm \xB7 n or Esc to cancel" }) })
26632
+ ] }) : editing ? /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, children: [
26633
+ /* @__PURE__ */ jsxs35(Text36, { color: theme.palette.foreground, children: [
26414
26634
  LABELS[editing],
26415
26635
  ":"
26416
26636
  ] }),
26417
- PLACEHOLDERS[editing] ? /* @__PURE__ */ jsx36(Text35, { dimColor: true, children: `example: ${PLACEHOLDERS[editing]}` }) : null,
26418
- /* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(
26637
+ PLACEHOLDERS[editing] ? /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: `example: ${PLACEHOLDERS[editing]}` }) : null,
26638
+ /* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(
26419
26639
  CustomTextInput,
26420
26640
  {
26421
26641
  value: editValue,
@@ -26425,11 +26645,11 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
26425
26645
  focus: true
26426
26646
  }
26427
26647
  ) }),
26428
- /* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(Text35, { dimColor: true, children: "Enter to save \xB7 Esc to cancel \xB7 blank to clear" }) })
26429
- ] }) : /* @__PURE__ */ jsxs34(Fragment4, { children: [
26430
- !deploying && /* @__PURE__ */ jsx36(Box34, { flexDirection: "column", marginTop: 1, children: fields.map((f, idx) => {
26648
+ /* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: "Enter to save \xB7 Esc to cancel \xB7 blank to clear" }) })
26649
+ ] }) : /* @__PURE__ */ jsxs35(Fragment4, { children: [
26650
+ !deploying && /* @__PURE__ */ jsx37(Box35, { flexDirection: "column", marginTop: 1, children: fields.map((f, idx) => {
26431
26651
  const selected = idx === cursor;
26432
- return /* @__PURE__ */ jsx36(Box34, { children: /* @__PURE__ */ jsxs34(Text35, { color: selected ? theme.accent : theme.palette.foreground, bold: selected, children: [
26652
+ return /* @__PURE__ */ jsx37(Box35, { children: /* @__PURE__ */ jsxs35(Text36, { color: selected ? theme.accent : theme.palette.foreground, bold: selected, children: [
26433
26653
  selected ? "\u203A " : " ",
26434
26654
  LABELS[f].padEnd(28),
26435
26655
  " ",
@@ -26439,42 +26659,42 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
26439
26659
  deployLog.length > 0 && (() => {
26440
26660
  const failed = !deploying && deployLog.some((l) => l.startsWith("\u2717"));
26441
26661
  const ctaUrl = deployLog.map((l) => l.match(/https:\/\/dash\.cloudflare\.com\/[^\s)]+/)?.[0]).find((u) => !!u) ?? "https://dash.cloudflare.com/profile/api-tokens";
26442
- return /* @__PURE__ */ jsxs34(Fragment4, { children: [
26443
- /* @__PURE__ */ jsxs34(Box34, { flexDirection: "column", marginTop: 1, borderStyle: "single", borderColor: failed ? theme.palette.error : theme.info.color, paddingX: 1, children: [
26444
- /* @__PURE__ */ jsx36(Text35, { color: theme.accent, bold: true, children: deploying ? "Deploying\u2026" : failed ? "Setup failed" : "Deploy log" }),
26662
+ return /* @__PURE__ */ jsxs35(Fragment4, { children: [
26663
+ /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, borderStyle: "single", borderColor: failed ? theme.palette.error : theme.info.color, paddingX: 1, children: [
26664
+ /* @__PURE__ */ jsx37(Text36, { color: theme.accent, bold: true, children: deploying ? "Deploying\u2026" : failed ? "Setup failed" : "Deploy log" }),
26445
26665
  deployLog.slice(-16).map((line, i) => {
26446
26666
  const isErr = line.startsWith("\u2717");
26447
26667
  const isDone = line.startsWith("\u2713");
26448
- return /* @__PURE__ */ jsx36(Text35, { color: isErr ? theme.palette.error : isDone ? theme.palette.success : theme.palette.foreground, children: line }, i);
26668
+ return /* @__PURE__ */ jsx37(Text36, { color: isErr ? theme.palette.error : isDone ? theme.palette.success : theme.palette.foreground, children: line }, i);
26449
26669
  })
26450
26670
  ] }),
26451
- failed && /* @__PURE__ */ jsxs34(Box34, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
26452
- /* @__PURE__ */ jsx36(Text35, { color: theme.accent, bold: true, children: "Next steps" }),
26453
- /* @__PURE__ */ jsxs34(Text35, { children: [
26671
+ failed && /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
26672
+ /* @__PURE__ */ jsx37(Text36, { color: theme.accent, bold: true, children: "Next steps" }),
26673
+ /* @__PURE__ */ jsxs35(Text36, { children: [
26454
26674
  "1. Press ",
26455
- /* @__PURE__ */ jsx36(Text35, { bold: true, children: "O" }),
26675
+ /* @__PURE__ */ jsx37(Text36, { bold: true, children: "O" }),
26456
26676
  " to open your Cloudflare tokens"
26457
26677
  ] }),
26458
- /* @__PURE__ */ jsx36(Text35, { children: "2. Find the token kimiflare is using \u2192 Edit \u2192 add the scopes above" }),
26459
- /* @__PURE__ */ jsx36(Text35, { children: "3. Save (the token value doesn't change)" }),
26460
- /* @__PURE__ */ jsxs34(Text35, { children: [
26678
+ /* @__PURE__ */ jsx37(Text36, { children: "2. Find the token kimiflare is using \u2192 Edit \u2192 add the scopes above" }),
26679
+ /* @__PURE__ */ jsx37(Text36, { children: "3. Save (the token value doesn't change)" }),
26680
+ /* @__PURE__ */ jsxs35(Text36, { children: [
26461
26681
  "4. Press ",
26462
- /* @__PURE__ */ jsx36(Text35, { bold: true, children: "R" }),
26682
+ /* @__PURE__ */ jsx37(Text36, { bold: true, children: "R" }),
26463
26683
  " to retry, or Esc to close"
26464
26684
  ] }),
26465
- /* @__PURE__ */ jsx36(Text35, { dimColor: true, children: ctaUrl })
26685
+ /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: ctaUrl })
26466
26686
  ] }),
26467
- !failed && !deploying && deployLog.some((l) => l.startsWith("\u2713")) && /* @__PURE__ */ jsxs34(Box34, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.palette.success, paddingX: 1, children: [
26468
- /* @__PURE__ */ jsx36(Text35, { color: theme.palette.success, bold: true, children: "Multi-agent is ready" }),
26469
- /* @__PURE__ */ jsxs34(Text35, { children: [
26687
+ !failed && !deploying && deployLog.some((l) => l.startsWith("\u2713")) && /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.palette.success, paddingX: 1, children: [
26688
+ /* @__PURE__ */ jsx37(Text36, { color: theme.palette.success, bold: true, children: "Multi-agent is ready" }),
26689
+ /* @__PURE__ */ jsxs35(Text36, { children: [
26470
26690
  "Press ",
26471
- /* @__PURE__ */ jsx36(Text35, { bold: true, children: "Enter" }),
26691
+ /* @__PURE__ */ jsx37(Text36, { bold: true, children: "Enter" }),
26472
26692
  " to close and start using it."
26473
26693
  ] })
26474
26694
  ] })
26475
26695
  ] });
26476
26696
  })(),
26477
- /* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(Text35, { dimColor: true, children: deploying ? "Deploying\u2026 please wait." : deployLog.some((l) => l.startsWith("\u2717")) ? "O open CF tokens \xB7 R retry \xB7 Esc close" : deployLog.some((l) => l.startsWith("\u2713")) ? "Enter to close \xB7 Esc to close" : `\u2191\u2193 to pick \xB7 Enter to ${fields[cursor] === "deploy" ? "deploy" : fields[cursor] === "teardown" ? "tear down" : isBool(fields[cursor]) ? "toggle" : "edit"} \xB7 Esc to close` }) })
26697
+ /* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: deploying ? "Deploying\u2026 please wait." : deployLog.some((l) => l.startsWith("\u2717")) ? "O open CF tokens \xB7 R retry \xB7 Esc close" : deployLog.some((l) => l.startsWith("\u2713")) ? "Enter to close \xB7 Esc to close" : `\u2191\u2193 to pick \xB7 Enter to ${fields[cursor] === "deploy" ? "deploy" : fields[cursor] === "teardown" ? "tear down" : isBool(fields[cursor]) ? "toggle" : "edit"} \xB7 Esc to close` }) })
26478
26698
  ] })
26479
26699
  ] });
26480
26700
  }
@@ -26597,21 +26817,21 @@ var init_recommended = __esm({
26597
26817
  });
26598
26818
 
26599
26819
  // src/ui/hooks-wizard.tsx
26600
- import { useState as useState22 } from "react";
26601
- import { Box as Box35, Text as Text36, useInput as useInput16 } from "ink";
26602
- import SelectInput18 from "ink-select-input";
26603
- import { jsx as jsx37, jsxs as jsxs35 } from "react/jsx-runtime";
26820
+ import { useState as useState23 } from "react";
26821
+ import { Box as Box36, Text as Text37, useInput as useInput17 } from "ink";
26822
+ import SelectInput19 from "ink-select-input";
26823
+ import { jsx as jsx38, jsxs as jsxs36 } from "react/jsx-runtime";
26604
26824
  function HooksWizard(props) {
26605
26825
  const theme = useTheme();
26606
- const [step, setStep] = useState22("event");
26607
- const [event, setEvent] = useState22(null);
26608
- const [matcher, setMatcher] = useState22("");
26609
- const [command, setCommand] = useState22("");
26610
- const [id, setId] = useState22("");
26611
- const [description, setDescription] = useState22("");
26612
- const [scope, setScope] = useState22("project");
26613
- const [error, setError] = useState22(null);
26614
- useInput16((_input, key) => {
26826
+ const [step, setStep] = useState23("event");
26827
+ const [event, setEvent] = useState23(null);
26828
+ const [matcher, setMatcher] = useState23("");
26829
+ const [command, setCommand] = useState23("");
26830
+ const [id, setId] = useState23("");
26831
+ const [description, setDescription] = useState23("");
26832
+ const [scope, setScope] = useState23("project");
26833
+ const [error, setError] = useState23(null);
26834
+ useInput17((_input, key) => {
26615
26835
  if (!key.escape) return;
26616
26836
  setError(null);
26617
26837
  if (step === "event") {
@@ -26649,14 +26869,14 @@ function HooksWizard(props) {
26649
26869
  value: ev,
26650
26870
  key: ev
26651
26871
  }));
26652
- return /* @__PURE__ */ jsx37(
26872
+ return /* @__PURE__ */ jsx38(
26653
26873
  WizardFrame,
26654
26874
  {
26655
26875
  title: "Create hook \xB7 step 1 of 6: pick the event",
26656
26876
  hint: "The lifecycle moment that fires your command.",
26657
26877
  error,
26658
- children: /* @__PURE__ */ jsx37(
26659
- SelectInput18,
26878
+ children: /* @__PURE__ */ jsx38(
26879
+ SelectInput19,
26660
26880
  {
26661
26881
  items,
26662
26882
  onSelect: (it) => {
@@ -26669,7 +26889,7 @@ function HooksWizard(props) {
26669
26889
  );
26670
26890
  }
26671
26891
  if (step === "matcher") {
26672
- return /* @__PURE__ */ jsxs35(
26892
+ return /* @__PURE__ */ jsxs36(
26673
26893
  WizardFrame,
26674
26894
  {
26675
26895
  title: `Create hook \xB7 step 2 of 6: matcher (optional)`,
@@ -26679,8 +26899,8 @@ Common patterns:
26679
26899
  ` + MATCHER_EXAMPLES.map((s) => ` ${s}`).join("\n"),
26680
26900
  error,
26681
26901
  children: [
26682
- /* @__PURE__ */ jsx37(Box35, { marginBottom: 1, children: /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "Your matcher: " }) }),
26683
- /* @__PURE__ */ jsx37(
26902
+ /* @__PURE__ */ jsx38(Box36, { marginBottom: 1, children: /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Your matcher: " }) }),
26903
+ /* @__PURE__ */ jsx38(
26684
26904
  CustomTextInput,
26685
26905
  {
26686
26906
  value: matcher,
@@ -26702,7 +26922,7 @@ Common patterns:
26702
26922
  focus: true
26703
26923
  }
26704
26924
  ),
26705
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "Enter (even if blank) to continue \xB7 Esc to go back" })
26925
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Enter (even if blank) to continue \xB7 Esc to go back" })
26706
26926
  ]
26707
26927
  }
26708
26928
  );
@@ -26710,7 +26930,7 @@ Common patterns:
26710
26930
  if (step === "command") {
26711
26931
  const stepNum = TOOL_EVENTS.has(event) ? 3 : 2;
26712
26932
  const examples = EVENT_COMMAND_EXAMPLES[event];
26713
- return /* @__PURE__ */ jsxs35(
26933
+ return /* @__PURE__ */ jsxs36(
26714
26934
  WizardFrame,
26715
26935
  {
26716
26936
  title: `Create hook \xB7 step ${stepNum} of 6: shell command`,
@@ -26729,13 +26949,13 @@ Note: this is a VETO event \u2014 exit non-zero (e.g. \`exit 1\`) to cancel
26729
26949
  the ${event === "PreToolUse" ? "tool call" : "prompt"}. Stdout becomes the rejection reason shown to the user.` : ""),
26730
26950
  error,
26731
26951
  children: [
26732
- /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginBottom: 1, children: [
26733
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "\u2500\u2500 Examples (copy / adapt) \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" }),
26734
- examples.map((line, i) => /* @__PURE__ */ jsx37(Text36, { color: line.startsWith("#") ? theme.info.color : void 0, dimColor: line.startsWith("#"), children: line || " " }, i)),
26735
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" })
26952
+ /* @__PURE__ */ jsxs36(Box36, { flexDirection: "column", marginBottom: 1, children: [
26953
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "\u2500\u2500 Examples (copy / adapt) \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" }),
26954
+ examples.map((line, i) => /* @__PURE__ */ jsx38(Text37, { color: line.startsWith("#") ? theme.info.color : void 0, dimColor: line.startsWith("#"), children: line || " " }, i)),
26955
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" })
26736
26956
  ] }),
26737
- /* @__PURE__ */ jsx37(Box35, { children: /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "Your command: " }) }),
26738
- /* @__PURE__ */ jsx37(
26957
+ /* @__PURE__ */ jsx38(Box36, { children: /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Your command: " }) }),
26958
+ /* @__PURE__ */ jsx38(
26739
26959
  CustomTextInput,
26740
26960
  {
26741
26961
  value: command,
@@ -26753,14 +26973,14 @@ the ${event === "PreToolUse" ? "tool call" : "prompt"}. Stdout becomes the rejec
26753
26973
  focus: true
26754
26974
  }
26755
26975
  ),
26756
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "Enter to continue \xB7 Esc to go back" })
26976
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Enter to continue \xB7 Esc to go back" })
26757
26977
  ]
26758
26978
  }
26759
26979
  );
26760
26980
  }
26761
26981
  if (step === "id") {
26762
26982
  const stepNum = TOOL_EVENTS.has(event) ? 4 : 3;
26763
- return /* @__PURE__ */ jsxs35(
26983
+ return /* @__PURE__ */ jsxs36(
26764
26984
  WizardFrame,
26765
26985
  {
26766
26986
  title: `Create hook \xB7 step ${stepNum} of 6: id (optional)`,
@@ -26768,7 +26988,7 @@ the ${event === "PreToolUse" ? "tool call" : "prompt"}. Stdout becomes the rejec
26768
26988
  derive from event+command (8 hex chars).`,
26769
26989
  error,
26770
26990
  children: [
26771
- /* @__PURE__ */ jsx37(
26991
+ /* @__PURE__ */ jsx38(
26772
26992
  CustomTextInput,
26773
26993
  {
26774
26994
  value: id,
@@ -26781,21 +27001,21 @@ derive from event+command (8 hex chars).`,
26781
27001
  focus: true
26782
27002
  }
26783
27003
  ),
26784
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "Enter to continue \xB7 Esc to go back" })
27004
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Enter to continue \xB7 Esc to go back" })
26785
27005
  ]
26786
27006
  }
26787
27007
  );
26788
27008
  }
26789
27009
  if (step === "description") {
26790
27010
  const stepNum = TOOL_EVENTS.has(event) ? 5 : 4;
26791
- return /* @__PURE__ */ jsxs35(
27011
+ return /* @__PURE__ */ jsxs36(
26792
27012
  WizardFrame,
26793
27013
  {
26794
27014
  title: `Create hook \xB7 step ${stepNum} of 6: description (optional)`,
26795
27015
  hint: "One-line summary shown by /hooks list.",
26796
27016
  error,
26797
27017
  children: [
26798
- /* @__PURE__ */ jsx37(
27018
+ /* @__PURE__ */ jsx38(
26799
27019
  CustomTextInput,
26800
27020
  {
26801
27021
  value: description,
@@ -26808,14 +27028,14 @@ derive from event+command (8 hex chars).`,
26808
27028
  focus: true
26809
27029
  }
26810
27030
  ),
26811
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "Enter to continue \xB7 Esc to go back" })
27031
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Enter to continue \xB7 Esc to go back" })
26812
27032
  ]
26813
27033
  }
26814
27034
  );
26815
27035
  }
26816
27036
  if (step === "scope") {
26817
27037
  const stepNum = TOOL_EVENTS.has(event) ? 6 : 5;
26818
- return /* @__PURE__ */ jsx37(
27038
+ return /* @__PURE__ */ jsx38(
26819
27039
  WizardFrame,
26820
27040
  {
26821
27041
  title: `Create hook \xB7 step ${stepNum} of 6: scope`,
@@ -26824,8 +27044,8 @@ derive from event+command (8 hex chars).`,
26824
27044
  global \u2014 lives in ~/.config/kimiflare/settings.json (applies to
26825
27045
  every project)`,
26826
27046
  error,
26827
- children: /* @__PURE__ */ jsx37(
26828
- SelectInput18,
27047
+ children: /* @__PURE__ */ jsx38(
27048
+ SelectInput19,
26829
27049
  {
26830
27050
  items: [
26831
27051
  { label: "project (.kimiflare/settings.json)", value: "project", key: "project" },
@@ -26847,41 +27067,41 @@ global \u2014 lives in ~/.config/kimiflare/settings.json (applies to
26847
27067
  ...description ? { description } : {},
26848
27068
  enabled: true
26849
27069
  };
26850
- return /* @__PURE__ */ jsxs35(
27070
+ return /* @__PURE__ */ jsxs36(
26851
27071
  WizardFrame,
26852
27072
  {
26853
27073
  title: "Create hook \xB7 step 6 of 6: review + save",
26854
27074
  hint: "Enter on 'Save' to write to settings.json. Esc to go back.",
26855
27075
  error,
26856
27076
  children: [
26857
- /* @__PURE__ */ jsxs35(Box35, { marginTop: 1, flexDirection: "column", children: [
26858
- /* @__PURE__ */ jsxs35(Text36, { children: [
26859
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "event: " }),
27077
+ /* @__PURE__ */ jsxs36(Box36, { marginTop: 1, flexDirection: "column", children: [
27078
+ /* @__PURE__ */ jsxs36(Text37, { children: [
27079
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "event: " }),
26860
27080
  event
26861
27081
  ] }),
26862
- matcher && /* @__PURE__ */ jsxs35(Text36, { children: [
26863
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "matcher: " }),
27082
+ matcher && /* @__PURE__ */ jsxs36(Text37, { children: [
27083
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "matcher: " }),
26864
27084
  matcher
26865
27085
  ] }),
26866
- /* @__PURE__ */ jsxs35(Text36, { children: [
26867
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "command: " }),
27086
+ /* @__PURE__ */ jsxs36(Text37, { children: [
27087
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "command: " }),
26868
27088
  command
26869
27089
  ] }),
26870
- id && /* @__PURE__ */ jsxs35(Text36, { children: [
26871
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "id: " }),
27090
+ id && /* @__PURE__ */ jsxs36(Text37, { children: [
27091
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "id: " }),
26872
27092
  id
26873
27093
  ] }),
26874
- description && /* @__PURE__ */ jsxs35(Text36, { children: [
26875
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "description: " }),
27094
+ description && /* @__PURE__ */ jsxs36(Text37, { children: [
27095
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "description: " }),
26876
27096
  description
26877
27097
  ] }),
26878
- /* @__PURE__ */ jsxs35(Text36, { children: [
26879
- /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: "scope: " }),
27098
+ /* @__PURE__ */ jsxs36(Text37, { children: [
27099
+ /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "scope: " }),
26880
27100
  scope
26881
27101
  ] })
26882
27102
  ] }),
26883
- /* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(
26884
- SelectInput18,
27103
+ /* @__PURE__ */ jsx38(Box36, { marginTop: 1, children: /* @__PURE__ */ jsx38(
27104
+ SelectInput19,
26885
27105
  {
26886
27106
  items: [
26887
27107
  { label: "\u2713 Save", value: "save", key: "save" },
@@ -26907,11 +27127,11 @@ global \u2014 lives in ~/.config/kimiflare/settings.json (applies to
26907
27127
  }
26908
27128
  function WizardFrame(props) {
26909
27129
  const theme = useTheme();
26910
- return /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
26911
- /* @__PURE__ */ jsx37(Text36, { color: theme.accent, bold: true, children: props.title }),
26912
- props.hint && /* @__PURE__ */ jsx37(Box35, { marginTop: 1, flexDirection: "column", children: props.hint.split("\n").map((line, i) => /* @__PURE__ */ jsx37(Text36, { color: theme.info.color, dimColor: true, children: line }, i)) }),
26913
- /* @__PURE__ */ jsx37(Box35, { marginTop: 1, flexDirection: "column", children: props.children }),
26914
- props.error && /* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(Text36, { color: theme.palette.error, children: props.error }) })
27130
+ return /* @__PURE__ */ jsxs36(Box36, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27131
+ /* @__PURE__ */ jsx38(Text37, { color: theme.accent, bold: true, children: props.title }),
27132
+ props.hint && /* @__PURE__ */ jsx38(Box36, { marginTop: 1, flexDirection: "column", children: props.hint.split("\n").map((line, i) => /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: line }, i)) }),
27133
+ /* @__PURE__ */ jsx38(Box36, { marginTop: 1, flexDirection: "column", children: props.children }),
27134
+ props.error && /* @__PURE__ */ jsx38(Box36, { marginTop: 1, children: /* @__PURE__ */ jsx38(Text37, { color: theme.palette.error, children: props.error }) })
26915
27135
  ] });
26916
27136
  }
26917
27137
  var TOOL_EVENTS, EVENT_DESCRIPTIONS, EVENT_COMMAND_EXAMPLES, MATCHER_EXAMPLES;
@@ -26974,10 +27194,10 @@ var init_hooks_wizard = __esm({
26974
27194
  });
26975
27195
 
26976
27196
  // src/ui/hooks-dashboard.tsx
26977
- import { useMemo as useMemo5, useState as useState23 } from "react";
26978
- import { Box as Box36, Text as Text37, useInput as useInput17 } from "ink";
26979
- import SelectInput19 from "ink-select-input";
26980
- import { jsx as jsx38, jsxs as jsxs36 } from "react/jsx-runtime";
27197
+ import { useMemo as useMemo5, useState as useState24 } from "react";
27198
+ import { Box as Box37, Text as Text38, useInput as useInput18 } from "ink";
27199
+ import SelectInput20 from "ink-select-input";
27200
+ import { jsx as jsx39, jsxs as jsxs37 } from "react/jsx-runtime";
26981
27201
  function tag(event) {
26982
27202
  return `[${event}]`.padEnd(20);
26983
27203
  }
@@ -26991,22 +27211,22 @@ function ColoredRow({ isSelected, label }) {
26991
27211
  const match = label.match(/^(.+?)(\[ [✓✗+] \w+\s*\])\s*$/);
26992
27212
  const baseColor = isSelected ? "cyan" : void 0;
26993
27213
  if (!match) {
26994
- return /* @__PURE__ */ jsx38(Text37, { color: baseColor, bold: isSelected, children: label });
27214
+ return /* @__PURE__ */ jsx39(Text38, { color: baseColor, bold: isSelected, children: label });
26995
27215
  }
26996
27216
  const [, body, badge] = match;
26997
27217
  const badgeColor = badge.includes("\u2713") ? "green" : badge.includes("\u2717") ? "red" : void 0;
26998
- return /* @__PURE__ */ jsxs36(Text37, { color: baseColor, bold: isSelected, children: [
27218
+ return /* @__PURE__ */ jsxs37(Text38, { color: baseColor, bold: isSelected, children: [
26999
27219
  body,
27000
- /* @__PURE__ */ jsx38(Text37, { color: badgeColor, dimColor: badgeColor === void 0, children: badge })
27220
+ /* @__PURE__ */ jsx39(Text38, { color: badgeColor, dimColor: badgeColor === void 0, children: badge })
27001
27221
  ] });
27002
27222
  }
27003
27223
  function HooksDashboard(props) {
27004
27224
  const theme = useTheme();
27005
- const [message2, setMessage] = useState23(null);
27006
- const [version, setVersion] = useState23(0);
27007
- const [highlighted, setHighlighted] = useState23(null);
27008
- const [showWizard, setShowWizard] = useState23(false);
27009
- useInput17((_input, key) => {
27225
+ const [message2, setMessage] = useState24(null);
27226
+ const [version, setVersion] = useState24(0);
27227
+ const [highlighted, setHighlighted] = useState24(null);
27228
+ const [showWizard, setShowWizard] = useState24(false);
27229
+ useInput18((_input, key) => {
27010
27230
  if (showWizard) return;
27011
27231
  if (key.escape) props.onDone();
27012
27232
  });
@@ -27089,7 +27309,7 @@ function HooksDashboard(props) {
27089
27309
  }
27090
27310
  };
27091
27311
  if (showWizard) {
27092
- return /* @__PURE__ */ jsx38(
27312
+ return /* @__PURE__ */ jsx39(
27093
27313
  HooksWizard,
27094
27314
  {
27095
27315
  cwd: props.cwd,
@@ -27105,49 +27325,49 @@ function HooksDashboard(props) {
27105
27325
  }
27106
27326
  const focus = highlighted ?? items[0]?.value ?? null;
27107
27327
  const focusMeta = focus && focus.kind === "row" ? focus.meta : null;
27108
- return /* @__PURE__ */ jsxs36(Box36, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27109
- /* @__PURE__ */ jsx38(Text37, { color: theme.accent, bold: true, children: "Hooks" }),
27110
- /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Arrow keys to navigate. Enter to toggle. Esc when done." }),
27111
- message2 && /* @__PURE__ */ jsx38(Box36, { marginTop: 1, paddingX: 1, borderStyle: "single", borderColor: "green", children: /* @__PURE__ */ jsxs36(Text37, { color: "green", bold: true, children: [
27328
+ return /* @__PURE__ */ jsxs37(Box37, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27329
+ /* @__PURE__ */ jsx39(Text38, { color: theme.accent, bold: true, children: "Hooks" }),
27330
+ /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "Arrow keys to navigate. Enter to toggle. Esc when done." }),
27331
+ message2 && /* @__PURE__ */ jsx39(Box37, { marginTop: 1, paddingX: 1, borderStyle: "single", borderColor: "green", children: /* @__PURE__ */ jsxs37(Text38, { color: "green", bold: true, children: [
27112
27332
  "\u2713 ",
27113
27333
  message2
27114
27334
  ] }) }),
27115
- /* @__PURE__ */ jsxs36(Box36, { marginTop: 1, flexDirection: "column", children: [
27116
- /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Events:" }),
27117
- /* @__PURE__ */ jsxs36(Text37, { children: [
27335
+ /* @__PURE__ */ jsxs37(Box37, { marginTop: 1, flexDirection: "column", children: [
27336
+ /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "Events:" }),
27337
+ /* @__PURE__ */ jsxs37(Text38, { children: [
27118
27338
  " ",
27119
- /* @__PURE__ */ jsx38(Text37, { bold: true, children: "PreToolUse" }),
27339
+ /* @__PURE__ */ jsx39(Text38, { bold: true, children: "PreToolUse" }),
27120
27340
  " \u2014 ",
27121
27341
  EVENT_EXPLANATIONS.PreToolUse
27122
27342
  ] }),
27123
- /* @__PURE__ */ jsxs36(Text37, { children: [
27343
+ /* @__PURE__ */ jsxs37(Text38, { children: [
27124
27344
  " ",
27125
- /* @__PURE__ */ jsx38(Text37, { bold: true, children: "PostToolUse" }),
27345
+ /* @__PURE__ */ jsx39(Text38, { bold: true, children: "PostToolUse" }),
27126
27346
  " \u2014 ",
27127
27347
  EVENT_EXPLANATIONS.PostToolUse
27128
27348
  ] }),
27129
- /* @__PURE__ */ jsxs36(Text37, { children: [
27349
+ /* @__PURE__ */ jsxs37(Text38, { children: [
27130
27350
  " ",
27131
- /* @__PURE__ */ jsx38(Text37, { bold: true, children: "UserPromptSubmit" }),
27351
+ /* @__PURE__ */ jsx39(Text38, { bold: true, children: "UserPromptSubmit" }),
27132
27352
  " \u2014 ",
27133
27353
  EVENT_EXPLANATIONS.UserPromptSubmit
27134
27354
  ] }),
27135
- /* @__PURE__ */ jsxs36(Text37, { children: [
27355
+ /* @__PURE__ */ jsxs37(Text38, { children: [
27136
27356
  " ",
27137
- /* @__PURE__ */ jsx38(Text37, { bold: true, children: "Stop" }),
27357
+ /* @__PURE__ */ jsx39(Text38, { bold: true, children: "Stop" }),
27138
27358
  " \u2014 ",
27139
27359
  EVENT_EXPLANATIONS.Stop
27140
27360
  ] }),
27141
- /* @__PURE__ */ jsxs36(Text37, { children: [
27361
+ /* @__PURE__ */ jsxs37(Text38, { children: [
27142
27362
  " ",
27143
- /* @__PURE__ */ jsx38(Text37, { bold: true, children: "PreCompact" }),
27363
+ /* @__PURE__ */ jsx39(Text38, { bold: true, children: "PreCompact" }),
27144
27364
  " \u2014 ",
27145
27365
  EVENT_EXPLANATIONS.PreCompact
27146
27366
  ] })
27147
27367
  ] }),
27148
- configured.length === 0 && /* @__PURE__ */ jsx38(Box36, { marginTop: 1, children: /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "No hooks configured yet. Pick a recommended one below \u2014 or create your own." }) }),
27149
- /* @__PURE__ */ jsx38(Box36, { marginTop: 1, children: /* @__PURE__ */ jsx38(
27150
- SelectInput19,
27368
+ configured.length === 0 && /* @__PURE__ */ jsx39(Box37, { marginTop: 1, children: /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "No hooks configured yet. Pick a recommended one below \u2014 or create your own." }) }),
27369
+ /* @__PURE__ */ jsx39(Box37, { marginTop: 1, children: /* @__PURE__ */ jsx39(
27370
+ SelectInput20,
27151
27371
  {
27152
27372
  items,
27153
27373
  itemComponent: ColoredRow,
@@ -27155,26 +27375,26 @@ function HooksDashboard(props) {
27155
27375
  onHighlight: (it) => setHighlighted(it.value)
27156
27376
  }
27157
27377
  ) }),
27158
- focusMeta && /* @__PURE__ */ jsxs36(Box36, { marginTop: 1, flexDirection: "column", borderStyle: "single", borderColor: theme.info.color, paddingX: 1, children: [
27159
- /* @__PURE__ */ jsxs36(Text37, { children: [
27160
- /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "id: " }),
27161
- /* @__PURE__ */ jsx38(Text37, { bold: true, children: focusMeta.id }),
27162
- /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: " event: " }),
27163
- /* @__PURE__ */ jsx38(Text37, { children: focusMeta.event }),
27164
- /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: " source: " }),
27165
- /* @__PURE__ */ jsx38(Text37, { children: focusMeta.source ?? "\u2014" })
27378
+ focusMeta && /* @__PURE__ */ jsxs37(Box37, { marginTop: 1, flexDirection: "column", borderStyle: "single", borderColor: theme.info.color, paddingX: 1, children: [
27379
+ /* @__PURE__ */ jsxs37(Text38, { children: [
27380
+ /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "id: " }),
27381
+ /* @__PURE__ */ jsx39(Text38, { bold: true, children: focusMeta.id }),
27382
+ /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: " event: " }),
27383
+ /* @__PURE__ */ jsx39(Text38, { children: focusMeta.event }),
27384
+ /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: " source: " }),
27385
+ /* @__PURE__ */ jsx39(Text38, { children: focusMeta.source ?? "\u2014" })
27166
27386
  ] }),
27167
- focusMeta.description && /* @__PURE__ */ jsxs36(Text37, { children: [
27168
- /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "what: " }),
27387
+ focusMeta.description && /* @__PURE__ */ jsxs37(Text38, { children: [
27388
+ /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "what: " }),
27169
27389
  focusMeta.description
27170
27390
  ] }),
27171
- /* @__PURE__ */ jsxs36(Text37, { children: [
27172
- /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "runs: " }),
27173
- /* @__PURE__ */ jsx38(Text37, { children: focusMeta.command.length > 100 ? focusMeta.command.slice(0, 100) + "\u2026" : focusMeta.command })
27391
+ /* @__PURE__ */ jsxs37(Text38, { children: [
27392
+ /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "runs: " }),
27393
+ /* @__PURE__ */ jsx39(Text38, { children: focusMeta.command.length > 100 ? focusMeta.command.slice(0, 100) + "\u2026" : focusMeta.command })
27174
27394
  ] }),
27175
- /* @__PURE__ */ jsxs36(Text37, { children: [
27176
- /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "action: " }),
27177
- /* @__PURE__ */ jsxs36(Text37, { color: theme.accent, children: [
27395
+ /* @__PURE__ */ jsxs37(Text38, { children: [
27396
+ /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "action: " }),
27397
+ /* @__PURE__ */ jsxs37(Text38, { color: theme.accent, children: [
27178
27398
  "Enter to ",
27179
27399
  focusMeta.kind === "configured" ? focusMeta.enabled ? "disable" : "re-enable" : "enable (adds to project settings.json)"
27180
27400
  ] })
@@ -27201,15 +27421,15 @@ var init_hooks_dashboard = __esm({
27201
27421
  });
27202
27422
 
27203
27423
  // src/ui/help-menu.tsx
27204
- import { useState as useState24 } from "react";
27205
- import { Box as Box37, Text as Text38, useInput as useInput18 } from "ink";
27206
- import SelectInput20 from "ink-select-input";
27207
- import { jsx as jsx39, jsxs as jsxs37 } from "react/jsx-runtime";
27424
+ import { useState as useState25 } from "react";
27425
+ import { Box as Box38, Text as Text39, useInput as useInput19 } from "ink";
27426
+ import SelectInput21 from "ink-select-input";
27427
+ import { jsx as jsx40, jsxs as jsxs38 } from "react/jsx-runtime";
27208
27428
  function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand }) {
27209
27429
  const theme = useTheme();
27210
- const [page, setPage] = useState24("main");
27430
+ const [page, setPage] = useState25("main");
27211
27431
  const customs = customCommands ?? [];
27212
- useInput18((_input, key) => {
27432
+ useInput19((_input, key) => {
27213
27433
  if (key.escape) {
27214
27434
  if (page !== "main") {
27215
27435
  setPage("main");
@@ -27233,11 +27453,11 @@ function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand })
27233
27453
  items2.push({ label: "Run custom commands", value: "custom", key: "custom" });
27234
27454
  }
27235
27455
  items2.push({ label: "(close)", value: "__close__", key: "__close__" });
27236
- return /* @__PURE__ */ jsxs37(Box37, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27237
- /* @__PURE__ */ jsx39(Text38, { color: theme.accent, bold: true, children: "Help" }),
27238
- /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
27239
- /* @__PURE__ */ jsx39(Box37, { marginTop: 1, children: /* @__PURE__ */ jsx39(
27240
- SelectInput20,
27456
+ return /* @__PURE__ */ jsxs38(Box38, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27457
+ /* @__PURE__ */ jsx40(Text39, { color: theme.accent, bold: true, children: "Help" }),
27458
+ /* @__PURE__ */ jsx40(Text39, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
27459
+ /* @__PURE__ */ jsx40(Box38, { marginTop: 1, children: /* @__PURE__ */ jsx40(
27460
+ SelectInput21,
27241
27461
  {
27242
27462
  items: items2,
27243
27463
  onSelect: (item) => {
@@ -27249,8 +27469,8 @@ function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand })
27249
27469
  }
27250
27470
  }
27251
27471
  ) }),
27252
- /* @__PURE__ */ jsx39(Box37, { marginTop: 1, flexDirection: "column", children: SINGLE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: false, children: ` ${cmd.command.padEnd(20)} ${cmd.description}` }, cmd.command)) }),
27253
- /* @__PURE__ */ jsx39(Box37, { marginTop: 1, children: /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: false, children: "keys: ctrl-c interrupt/exit \xB7 ctrl-r toggle reasoning \xB7 ctrl-o verbose \xB7 shift+tab cycle mode \xB7 \u2191/\u2193 history" }) })
27472
+ /* @__PURE__ */ jsx40(Box38, { marginTop: 1, flexDirection: "column", children: SINGLE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx40(Text39, { color: theme.info.color, dimColor: false, children: ` ${cmd.command.padEnd(20)} ${cmd.description}` }, cmd.command)) }),
27473
+ /* @__PURE__ */ jsx40(Box38, { marginTop: 1, children: /* @__PURE__ */ jsx40(Text39, { color: theme.info.color, dimColor: false, children: "keys: ctrl-c interrupt/exit \xB7 ctrl-r toggle reasoning \xB7 ctrl-o verbose \xB7 shift+tab cycle mode \xB7 \u2191/\u2193 history" }) })
27254
27474
  ] });
27255
27475
  }
27256
27476
  if (page === "custom") {
@@ -27260,11 +27480,11 @@ function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand })
27260
27480
  key: c.name
27261
27481
  }));
27262
27482
  items2.push({ label: "\u2190 Back", value: "__back__", key: "__back__" });
27263
- return /* @__PURE__ */ jsxs37(Box37, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27264
- /* @__PURE__ */ jsx39(Text38, { color: theme.accent, bold: true, children: "Custom commands" }),
27265
- /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: false, children: customs.length === 0 ? "no custom commands found in .kimiflare/commands/" : "Arrow keys to navigate, Enter to run, Esc to go back." }),
27266
- /* @__PURE__ */ jsx39(Box37, { marginTop: 1, children: /* @__PURE__ */ jsx39(
27267
- SelectInput20,
27483
+ return /* @__PURE__ */ jsxs38(Box38, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27484
+ /* @__PURE__ */ jsx40(Text39, { color: theme.accent, bold: true, children: "Custom commands" }),
27485
+ /* @__PURE__ */ jsx40(Text39, { color: theme.info.color, dimColor: false, children: customs.length === 0 ? "no custom commands found in .kimiflare/commands/" : "Arrow keys to navigate, Enter to run, Esc to go back." }),
27486
+ /* @__PURE__ */ jsx40(Box38, { marginTop: 1, children: /* @__PURE__ */ jsx40(
27487
+ SelectInput21,
27268
27488
  {
27269
27489
  items: items2,
27270
27490
  onSelect: (item) => {
@@ -27287,11 +27507,11 @@ function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand })
27287
27507
  key: cmd.command
27288
27508
  }));
27289
27509
  items.push({ label: "\u2190 Back", value: "__back__", key: "__back__" });
27290
- return /* @__PURE__ */ jsxs37(Box37, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27291
- /* @__PURE__ */ jsx39(Text38, { color: theme.accent, bold: true, children: category.label }),
27292
- /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to execute, Esc to go back." }),
27293
- /* @__PURE__ */ jsx39(Box37, { marginTop: 1, children: /* @__PURE__ */ jsx39(
27294
- SelectInput20,
27510
+ return /* @__PURE__ */ jsxs38(Box38, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27511
+ /* @__PURE__ */ jsx40(Text39, { color: theme.accent, bold: true, children: category.label }),
27512
+ /* @__PURE__ */ jsx40(Text39, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to execute, Esc to go back." }),
27513
+ /* @__PURE__ */ jsx40(Box38, { marginTop: 1, children: /* @__PURE__ */ jsx40(
27514
+ SelectInput21,
27295
27515
  {
27296
27516
  items,
27297
27517
  onSelect: (item) => {
@@ -27303,7 +27523,7 @@ function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand })
27303
27523
  }
27304
27524
  }
27305
27525
  ) }),
27306
- staticCmds.length > 0 && /* @__PURE__ */ jsx39(Box37, { marginTop: 1, flexDirection: "column", children: staticCmds.map((cmd) => /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, children: ` ${cmd.command.padEnd(28)} ${cmd.description}` }, cmd.command)) })
27526
+ staticCmds.length > 0 && /* @__PURE__ */ jsx40(Box38, { marginTop: 1, flexDirection: "column", children: staticCmds.map((cmd) => /* @__PURE__ */ jsx40(Text39, { color: theme.info.color, children: ` ${cmd.command.padEnd(28)} ${cmd.description}` }, cmd.command)) })
27307
27527
  ] });
27308
27528
  }
27309
27529
  var CATEGORIES, SINGLE_COMMANDS;
@@ -27442,9 +27662,9 @@ var init_help_menu = __esm({
27442
27662
  });
27443
27663
 
27444
27664
  // src/ui/modal-host.tsx
27445
- import { Box as Box38, Text as Text39 } from "ink";
27446
- import SelectInput21 from "ink-select-input";
27447
- import { jsx as jsx40, jsxs as jsxs38 } from "react/jsx-runtime";
27665
+ import { Box as Box39, Text as Text40 } from "ink";
27666
+ import SelectInput22 from "ink-select-input";
27667
+ import { jsx as jsx41, jsxs as jsxs39 } from "react/jsx-runtime";
27448
27668
  function ModalHost(props) {
27449
27669
  const {
27450
27670
  modals,
@@ -27477,7 +27697,7 @@ function ModalHost(props) {
27477
27697
  onInboxOpen
27478
27698
  } = props;
27479
27699
  if (modals.showRemoteDashboard) {
27480
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: selectedRemoteSession ? /* @__PURE__ */ jsx40(
27700
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: selectedRemoteSession ? /* @__PURE__ */ jsx41(
27481
27701
  RemoteSessionDetail,
27482
27702
  {
27483
27703
  session: selectedRemoteSession,
@@ -27486,7 +27706,7 @@ function ModalHost(props) {
27486
27706
  void onCancelRemoteSession(session);
27487
27707
  }
27488
27708
  }
27489
- ) : /* @__PURE__ */ jsx40(
27709
+ ) : /* @__PURE__ */ jsx41(
27490
27710
  RemoteDashboard,
27491
27711
  {
27492
27712
  onSelect: (session) => onSelectRemoteSession(session),
@@ -27495,7 +27715,7 @@ function ModalHost(props) {
27495
27715
  ) }) });
27496
27716
  }
27497
27717
  if (modals.showInboxModal) {
27498
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27718
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27499
27719
  InboxModal,
27500
27720
  {
27501
27721
  onDone: () => modals.setShowInboxModal(false),
@@ -27504,7 +27724,7 @@ function ModalHost(props) {
27504
27724
  ) }) });
27505
27725
  }
27506
27726
  if (modals.showMultiAgentModal) {
27507
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27727
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27508
27728
  MultiAgentModal,
27509
27729
  {
27510
27730
  initial: props.multiAgentSettings ?? {},
@@ -27517,7 +27737,7 @@ function ModalHost(props) {
27517
27737
  ) }) });
27518
27738
  }
27519
27739
  if (modals.showHooksDashboard) {
27520
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27740
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27521
27741
  HooksDashboard,
27522
27742
  {
27523
27743
  getConfigured: props.getConfiguredHooks,
@@ -27528,7 +27748,7 @@ function ModalHost(props) {
27528
27748
  ) }) });
27529
27749
  }
27530
27750
  if (modals.showHelpMenu) {
27531
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27751
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27532
27752
  HelpMenu,
27533
27753
  {
27534
27754
  customCommands: customCommands.map((c) => ({ name: c.name, description: c.description })),
@@ -27542,10 +27762,10 @@ function ModalHost(props) {
27542
27762
  ) }) });
27543
27763
  }
27544
27764
  if (modals.showShellPicker) {
27545
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(ShellPicker, { current: props.currentShell, onPick: props.onPickShell }) }) });
27765
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(ShellPicker, { current: props.currentShell, onPick: props.onPickShell }) }) });
27546
27766
  }
27547
27767
  if (modals.showMemoryPicker) {
27548
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27768
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27549
27769
  MemoryPicker,
27550
27770
  {
27551
27771
  enabled: props.memoryEnabled,
@@ -27556,7 +27776,7 @@ function ModalHost(props) {
27556
27776
  ) }) });
27557
27777
  }
27558
27778
  if (modals.showGatewayPicker) {
27559
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27779
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27560
27780
  GatewayPicker,
27561
27781
  {
27562
27782
  gatewayId: props.gatewayId,
@@ -27569,10 +27789,10 @@ function ModalHost(props) {
27569
27789
  ) }) });
27570
27790
  }
27571
27791
  if (modals.showSkillsPicker) {
27572
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(SkillsPicker, { onAction: props.onSkillsAction, onDone: props.onSkillsDone }) }) });
27792
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(SkillsPicker, { onAction: props.onSkillsAction, onDone: props.onSkillsDone }) }) });
27573
27793
  }
27574
27794
  if (modals.showLspWizard) {
27575
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27795
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27576
27796
  LspWizard,
27577
27797
  {
27578
27798
  servers: lspServers,
@@ -27584,7 +27804,7 @@ function ModalHost(props) {
27584
27804
  ) }) });
27585
27805
  }
27586
27806
  if (modals.commandWizard) {
27587
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27807
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27588
27808
  CommandWizard,
27589
27809
  {
27590
27810
  mode: modals.commandWizard.mode,
@@ -27598,7 +27818,7 @@ function ModalHost(props) {
27598
27818
  }
27599
27819
  if (modals.commandPicker) {
27600
27820
  const pickerMode = modals.commandPicker.mode;
27601
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27821
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27602
27822
  CommandPicker,
27603
27823
  {
27604
27824
  commands: customCommands,
@@ -27617,15 +27837,15 @@ function ModalHost(props) {
27617
27837
  }
27618
27838
  if (modals.commandToDelete) {
27619
27839
  const cmd = modals.commandToDelete;
27620
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs38(Box38, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27621
- /* @__PURE__ */ jsxs38(Text39, { color: theme.accent, bold: true, children: [
27840
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs39(Box39, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27841
+ /* @__PURE__ */ jsxs39(Text40, { color: theme.accent, bold: true, children: [
27622
27842
  "Delete /",
27623
27843
  cmd.name,
27624
27844
  "?"
27625
27845
  ] }),
27626
- /* @__PURE__ */ jsx40(Text39, { color: theme.info.color, children: cmd.filepath }),
27627
- /* @__PURE__ */ jsx40(Box38, { marginTop: 1, children: /* @__PURE__ */ jsx40(
27628
- SelectInput21,
27846
+ /* @__PURE__ */ jsx41(Text40, { color: theme.info.color, children: cmd.filepath }),
27847
+ /* @__PURE__ */ jsx41(Box39, { marginTop: 1, children: /* @__PURE__ */ jsx41(
27848
+ SelectInput22,
27629
27849
  {
27630
27850
  items: [
27631
27851
  { label: "Yes, delete", value: "yes", key: "yes" },
@@ -27643,7 +27863,7 @@ function ModalHost(props) {
27643
27863
  ] }) });
27644
27864
  }
27645
27865
  if (modals.showCommandList) {
27646
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27866
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27647
27867
  CommandList,
27648
27868
  {
27649
27869
  commands: customCommands,
@@ -27652,24 +27872,24 @@ function ModalHost(props) {
27652
27872
  ) }) });
27653
27873
  }
27654
27874
  if (modals.showThemePicker) {
27655
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(ThemePicker, { themes, onPick: onPickTheme }) }) });
27875
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(ThemePicker, { themes, onPick: onPickTheme }) }) });
27656
27876
  }
27657
27877
  if (modals.showUiPicker) {
27658
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(UiPicker, { current: currentUiEngine, onPick: onPickUi }) }) });
27878
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(UiPicker, { current: currentUiEngine, onPick: onPickUi }) }) });
27659
27879
  }
27660
27880
  if (modals.showModelPicker) {
27661
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(ModelPicker, { current: currentModel, onPick: onPickModel }) }) });
27881
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(ModelPicker, { current: currentModel, onPick: onPickModel }) }) });
27662
27882
  }
27663
27883
  if (modals.showModePicker) {
27664
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(ModePicker, { current: props.currentMode, onPick: props.onPickMode, multiAgentEnabled: props.multiAgentEnabled }) }) });
27884
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(ModePicker, { current: props.currentMode, onPick: props.onPickMode, multiAgentEnabled: props.multiAgentEnabled }) }) });
27665
27885
  }
27666
27886
  if (modals.billingChooserFor) {
27667
27887
  const model = modals.billingChooserFor;
27668
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(BillingChooser, { model, onPick: (choice) => onPickBilling(model, choice) }) }) });
27888
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(BillingChooser, { model, onPick: (choice) => onPickBilling(model, choice) }) }) });
27669
27889
  }
27670
27890
  if (modals.unifiedProbeFor) {
27671
27891
  const model = modals.unifiedProbeFor;
27672
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27892
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27673
27893
  UnifiedBillingStatus,
27674
27894
  {
27675
27895
  model,
@@ -27682,7 +27902,7 @@ function ModalHost(props) {
27682
27902
  }
27683
27903
  if (modals.keyEntryFor) {
27684
27904
  const model = modals.keyEntryFor;
27685
- return /* @__PURE__ */ jsx40(ThemeProvider, { theme, children: /* @__PURE__ */ jsx40(Box38, { flexDirection: "column", children: /* @__PURE__ */ jsx40(
27905
+ return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
27686
27906
  KeyEntryModal,
27687
27907
  {
27688
27908
  model,
@@ -27703,7 +27923,7 @@ function ModalOverlay({
27703
27923
  }) {
27704
27924
  if (modals.limitModal) {
27705
27925
  const m = modals.limitModal;
27706
- return /* @__PURE__ */ jsx40(
27926
+ return /* @__PURE__ */ jsx41(
27707
27927
  LimitModal,
27708
27928
  {
27709
27929
  limit: m.limit,
@@ -27717,7 +27937,7 @@ function ModalOverlay({
27717
27937
  }
27718
27938
  if (modals.loopModal) {
27719
27939
  const m = modals.loopModal;
27720
- return /* @__PURE__ */ jsx40(
27940
+ return /* @__PURE__ */ jsx41(
27721
27941
  LimitModal,
27722
27942
  {
27723
27943
  limit: 50,
@@ -27766,9 +27986,9 @@ var init_modal_host = __esm({
27766
27986
  });
27767
27987
 
27768
27988
  // src/ui/plan-complete-picker.tsx
27769
- import { Box as Box39, Text as Text40 } from "ink";
27770
- import SelectInput22 from "ink-select-input";
27771
- import { jsx as jsx41, jsxs as jsxs39 } from "react/jsx-runtime";
27989
+ import { Box as Box40, Text as Text41 } from "ink";
27990
+ import SelectInput23 from "ink-select-input";
27991
+ import { jsx as jsx42, jsxs as jsxs40 } from "react/jsx-runtime";
27772
27992
  function PlanCompletePicker({ onPick }) {
27773
27993
  const theme = useTheme();
27774
27994
  const items = [
@@ -27776,11 +27996,11 @@ function PlanCompletePicker({ onPick }) {
27776
27996
  { label: "\u25B8 Start building and ask for permission (edit mode)", value: "edit", key: "edit" },
27777
27997
  { label: "\u25B8 Continue planning / ask a question", value: "continue", key: "continue" }
27778
27998
  ];
27779
- return /* @__PURE__ */ jsxs39(Box39, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
27780
- /* @__PURE__ */ jsx41(Text40, { color: theme.accent, bold: true, children: "Plan complete \u2014 what next?" }),
27781
- /* @__PURE__ */ jsx41(Text40, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
27782
- /* @__PURE__ */ jsx41(Box39, { marginTop: 1, children: /* @__PURE__ */ jsx41(
27783
- SelectInput22,
27999
+ return /* @__PURE__ */ jsxs40(Box40, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
28000
+ /* @__PURE__ */ jsx42(Text41, { color: theme.accent, bold: true, children: "Plan complete \u2014 what next?" }),
28001
+ /* @__PURE__ */ jsx42(Text41, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
28002
+ /* @__PURE__ */ jsx42(Box40, { marginTop: 1, children: /* @__PURE__ */ jsx42(
28003
+ SelectInput23,
27784
28004
  {
27785
28005
  items,
27786
28006
  onSelect: (item) => onPick(item.value),
@@ -27798,7 +28018,7 @@ var init_plan_complete_picker = __esm({
27798
28018
  });
27799
28019
 
27800
28020
  // src/ui/use-session-manager.ts
27801
- import { useCallback as useCallback8, useRef as useRef5, useState as useState25 } from "react";
28021
+ import { useCallback as useCallback8, useRef as useRef5, useState as useState26 } from "react";
27802
28022
  function extractFirstUserText(messages) {
27803
28023
  const firstUser = messages.find((m) => m.role === "user");
27804
28024
  if (!firstUser) return "session";
@@ -27815,9 +28035,9 @@ function useSessionManager(deps) {
27815
28035
  const sessionIdRef = useRef5(null);
27816
28036
  const sessionCreatedAtRef = useRef5(null);
27817
28037
  const sessionTitleRef = useRef5(null);
27818
- const [resumeSessions, setResumeSessions] = useState25(null);
27819
- const [checkpointSession, setCheckpointSession] = useState25(null);
27820
- const [checkpointList, setCheckpointList] = useState25([]);
28038
+ const [resumeSessions, setResumeSessions] = useState26(null);
28039
+ const [checkpointSession, setCheckpointSession] = useState26(null);
28040
+ const [checkpointList, setCheckpointList] = useState26([]);
27821
28041
  const depsRef = useRef5(deps);
27822
28042
  depsRef.current = deps;
27823
28043
  const ensureSessionId = useCallback8(() => {
@@ -27993,26 +28213,26 @@ var init_use_session_manager = __esm({
27993
28213
  });
27994
28214
 
27995
28215
  // src/ui/use-turn-controller.ts
27996
- import { useCallback as useCallback9, useRef as useRef6, useState as useState26 } from "react";
28216
+ import { useCallback as useCallback9, useRef as useRef6, useState as useState27 } from "react";
27997
28217
  function useTurnController() {
27998
- const [busy, setBusy] = useState26(false);
28218
+ const [busy, setBusy] = useState27(false);
27999
28219
  const busyRef = useRef6(false);
28000
28220
  const isAbortingRef = useRef6(false);
28001
28221
  const lastEscapeAtRef = useRef6(0);
28002
28222
  const supervisorRef = useRef6(new TurnSupervisor());
28003
- const [turnPhase, setTurnPhase] = useState26("waiting");
28004
- const [turnStartedAt, setTurnStartedAt] = useState26(null);
28005
- const [currentToolName, setCurrentToolName] = useState26(null);
28006
- const [lastActivityAt, setLastActivityAt] = useState26(null);
28223
+ const [turnPhase, setTurnPhase] = useState27("waiting");
28224
+ const [turnStartedAt, setTurnStartedAt] = useState27(null);
28225
+ const [currentToolName, setCurrentToolName] = useState27(null);
28226
+ const [lastActivityAt, setLastActivityAt] = useState27(null);
28007
28227
  const turnCounterRef = useRef6(0);
28008
- const [showReasoning, setShowReasoning] = useState26(false);
28228
+ const [showReasoning, setShowReasoning] = useState27(false);
28009
28229
  const toggleReasoning = useCallback9(() => {
28010
28230
  setShowReasoning((s) => !s);
28011
28231
  }, []);
28012
- const [tasks, setTasks] = useState26([]);
28232
+ const [tasks, setTasks] = useState27([]);
28013
28233
  const tasksRef = useRef6([]);
28014
- const [tasksStartedAt, setTasksStartedAt] = useState26(null);
28015
- const [tasksStartTokens, setTasksStartTokens] = useState26(0);
28234
+ const [tasksStartedAt, setTasksStartedAt] = useState27(null);
28235
+ const [tasksStartTokens, setTasksStartTokens] = useState27(0);
28016
28236
  const beginTurn = useCallback9(() => {
28017
28237
  setBusy(true);
28018
28238
  busyRef.current = true;
@@ -28218,6 +28438,42 @@ var init_tui_report = __esm({
28218
28438
  import { join as join32 } from "path";
28219
28439
  import { unlink as unlink5 } from "fs/promises";
28220
28440
  import QRCode from "qrcode";
28441
+ function executeFreshStart(ctx, planText) {
28442
+ const oldSessionId = ctx.sessionIdRef.current;
28443
+ if (ctx.cacheStableRef.current && ctx.messagesRef.current.length >= 2) {
28444
+ ctx.messagesRef.current = [ctx.messagesRef.current[0], ctx.messagesRef.current[1]];
28445
+ } else {
28446
+ ctx.messagesRef.current = [ctx.messagesRef.current[0]];
28447
+ }
28448
+ ctx.resetSession();
28449
+ ctx.executorRef.current.clearArtifacts();
28450
+ if (ctx.flushTimeoutRef.current) {
28451
+ clearTimeout(ctx.flushTimeoutRef.current);
28452
+ ctx.flushTimeoutRef.current = null;
28453
+ }
28454
+ ctx.pendingTextRef.current.clear();
28455
+ ctx.activeAsstIdRef.current = null;
28456
+ ctx.pendingToolCallsRef.current.clear();
28457
+ ctx.usageRef.current = null;
28458
+ ctx.turnCounterRef.current = 0;
28459
+ ctx.setEvents([]);
28460
+ ctx.setUsage(null);
28461
+ ctx.setSessionUsage(null);
28462
+ ctx.gatewayMetaRef.current = null;
28463
+ ctx.setGatewayMeta(null);
28464
+ ctx.clearTaskTracking();
28465
+ ctx.compactSuggestedRef.current = false;
28466
+ ctx.updateNudgedRef.current = false;
28467
+ ctx.sessionPlanRef.current = null;
28468
+ ctx.messagesRef.current.push({ role: "user", content: planText });
28469
+ const newSessionId = ctx.ensureSessionId();
28470
+ if (oldSessionId) {
28471
+ void carryOverSessionBaseline(oldSessionId, newSessionId).then(() => {
28472
+ void getCostReport(newSessionId).then((report) => ctx.setSessionUsage(report.session));
28473
+ });
28474
+ }
28475
+ return writeToClipboard(planText);
28476
+ }
28221
28477
  function dispatchSlashCommand(ctx, cmd) {
28222
28478
  const raw = cmd.trim();
28223
28479
  const [head, ...rest] = raw.split(/\s+/);
@@ -28290,6 +28546,7 @@ var init_slash_commands = __esm({
28290
28546
  ctx.clearTaskTracking();
28291
28547
  ctx.compactSuggestedRef.current = false;
28292
28548
  ctx.updateNudgedRef.current = false;
28549
+ ctx.sessionPlanRef.current = null;
28293
28550
  return true;
28294
28551
  };
28295
28552
  handleFresh = (ctx) => {
@@ -28301,7 +28558,7 @@ var init_slash_commands = __esm({
28301
28558
  ]);
28302
28559
  return true;
28303
28560
  }
28304
- const plan = distillSessionPlan(ctx.messagesRef.current);
28561
+ const plan = ctx.sessionPlanRef.current ?? distillSessionPlan(ctx.messagesRef.current);
28305
28562
  if (!plan) {
28306
28563
  setEvents((e) => [
28307
28564
  ...e,
@@ -28309,32 +28566,7 @@ var init_slash_commands = __esm({
28309
28566
  ]);
28310
28567
  return true;
28311
28568
  }
28312
- const clipResult = writeToClipboard(plan);
28313
- if (ctx.cacheStableRef.current && ctx.messagesRef.current.length >= 2) {
28314
- ctx.messagesRef.current = [ctx.messagesRef.current[0], ctx.messagesRef.current[1]];
28315
- } else {
28316
- ctx.messagesRef.current = [ctx.messagesRef.current[0]];
28317
- }
28318
- ctx.resetSession();
28319
- ctx.executorRef.current.clearArtifacts();
28320
- if (ctx.flushTimeoutRef.current) {
28321
- clearTimeout(ctx.flushTimeoutRef.current);
28322
- ctx.flushTimeoutRef.current = null;
28323
- }
28324
- ctx.pendingTextRef.current.clear();
28325
- ctx.activeAsstIdRef.current = null;
28326
- ctx.pendingToolCallsRef.current.clear();
28327
- ctx.usageRef.current = null;
28328
- ctx.turnCounterRef.current = 0;
28329
- setEvents([]);
28330
- ctx.setUsage(null);
28331
- ctx.setSessionUsage(null);
28332
- ctx.gatewayMetaRef.current = null;
28333
- ctx.setGatewayMeta(null);
28334
- ctx.clearTaskTracking();
28335
- ctx.compactSuggestedRef.current = false;
28336
- ctx.updateNudgedRef.current = false;
28337
- ctx.messagesRef.current.push({ role: "user", content: plan });
28569
+ const clipResult = executeFreshStart(ctx, plan);
28338
28570
  setEvents((e) => [
28339
28571
  ...e,
28340
28572
  {
@@ -30726,11 +30958,11 @@ var app_exports = {};
30726
30958
  __export(app_exports, {
30727
30959
  renderApp: () => renderApp
30728
30960
  });
30729
- import React23, { useState as useState27, useRef as useRef7, useEffect as useEffect11, useCallback as useCallback10, useMemo as useMemo6 } from "react";
30730
- import { Box as Box40, Text as Text41, useApp, useInput as useInput19, render } from "ink";
30961
+ import React24, { useState as useState28, useRef as useRef7, useEffect as useEffect11, useCallback as useCallback10, useMemo as useMemo6 } from "react";
30962
+ import { Box as Box41, Text as Text42, useApp, useInput as useInput20, render } from "ink";
30731
30963
  import { existsSync as existsSync8 } from "fs";
30732
30964
  import { join as join37 } from "path";
30733
- import { jsx as jsx42, jsxs as jsxs40 } from "react/jsx-runtime";
30965
+ import { jsx as jsx43, jsxs as jsxs41 } from "react/jsx-runtime";
30734
30966
  function App({
30735
30967
  initialCfg,
30736
30968
  initialUpdateResult,
@@ -30738,14 +30970,14 @@ function App({
30738
30970
  initialLspProjectPath
30739
30971
  }) {
30740
30972
  const { exit } = useApp();
30741
- const [cfg, setCfg] = useState27(initialCfg);
30973
+ const [cfg, setCfg] = useState28(initialCfg);
30742
30974
  const modelContextLimit = useMemo6(
30743
30975
  () => cfg ? getModelOrInfer(cfg.model).contextWindow : CONTEXT_LIMIT,
30744
30976
  [cfg?.model]
30745
30977
  );
30746
- const [lspScope, setLspScope] = useState27(initialLspScope);
30747
- const [lspProjectPath, setLspProjectPath] = useState27(initialLspProjectPath);
30748
- const [events, setRawEvents] = useState27([]);
30978
+ const [lspScope, setLspScope] = useState28(initialLspScope);
30979
+ const [lspProjectPath, setLspProjectPath] = useState28(initialLspProjectPath);
30980
+ const [events, setRawEvents] = useState28([]);
30749
30981
  const setEvents = useCallback10(
30750
30982
  (updater) => {
30751
30983
  setRawEvents((prev) => {
@@ -30755,9 +30987,9 @@ function App({
30755
30987
  },
30756
30988
  []
30757
30989
  );
30758
- const [input, setInput] = useState27("");
30759
- const [usage, setUsage] = useState27(null);
30760
- const [sessionUsage, setSessionUsage] = useState27(null);
30990
+ const [input, setInput] = useState28("");
30991
+ const [usage, setUsage] = useState28(null);
30992
+ const [sessionUsage, setSessionUsage] = useState28(null);
30761
30993
  useEffect11(() => {
30762
30994
  const handler = (sid) => {
30763
30995
  if (sessionIdRef.current && sid === sessionIdRef.current) {
@@ -30769,7 +31001,7 @@ function App({
30769
31001
  usageEvents.off("update", handler);
30770
31002
  };
30771
31003
  }, []);
30772
- const [gatewayMeta, setGatewayMeta] = useState27(null);
31004
+ const [gatewayMeta, setGatewayMeta] = useState28(null);
30773
31005
  const turn = useTurnController();
30774
31006
  const {
30775
31007
  busy,
@@ -30797,6 +31029,8 @@ function App({
30797
31029
  endTurn,
30798
31030
  clearTaskTracking
30799
31031
  } = turn;
31032
+ const [planOptions, setPlanOptions] = useState28(null);
31033
+ const planOptionsRef = useRef7(null);
30800
31034
  const {
30801
31035
  pending: perm,
30802
31036
  askPermission: askForPermission,
@@ -30865,36 +31099,36 @@ function App({
30865
31099
  hasFullscreenModal,
30866
31100
  hasAnyModal
30867
31101
  } = modals;
30868
- const [queue2, setQueue] = useState27([]);
30869
- const [history, setHistory] = useState27([]);
30870
- const [historyIndex, setHistoryIndex] = useState27(-1);
30871
- const [draftInput, setDraftInput] = useState27("");
30872
- const [mode, setMode] = useState27("edit");
31102
+ const [queue2, setQueue] = useState28([]);
31103
+ const [history, setHistory] = useState28([]);
31104
+ const [historyIndex, setHistoryIndex] = useState28(-1);
31105
+ const [draftInput, setDraftInput] = useState28("");
31106
+ const [mode, setMode] = useState28("edit");
30873
31107
  useEffect11(() => {
30874
31108
  if (mode === "multi-agent-experimental" && cfg && !cfg.workerEndpoint && !cfg.remoteWorkerUrl && !showMultiAgentModal) {
30875
31109
  setShowMultiAgentModal(true);
30876
31110
  }
30877
31111
  }, [mode, cfg?.workerEndpoint, cfg?.remoteWorkerUrl]);
30878
- const [codeMode, setCodeMode] = useState27(false);
31112
+ const [codeMode, setCodeMode] = useState28(false);
30879
31113
  const filePickerEnabled = initialCfg?.filePicker ?? true;
30880
- const [effort, setEffort] = useState27(
31114
+ const [effort, setEffort] = useState28(
30881
31115
  initialCfg?.reasoningEffort ?? DEFAULT_REASONING_EFFORT
30882
31116
  );
30883
- const [selectedRemoteSession, setSelectedRemoteSession] = useState27(null);
30884
- const [verbose, setVerbose] = useState27(false);
30885
- const [hasUpdate, setHasUpdate] = useState27(initialUpdateResult?.hasUpdate ?? false);
30886
- const [latestVersion, setLatestVersion] = useState27(initialUpdateResult?.latestVersion ?? null);
30887
- const [theme, setTheme] = useState27(resolveTheme(initialCfg?.theme));
30888
- const [originalTheme, setOriginalTheme] = useState27(null);
30889
- const [skillsActive, setSkillsActive] = useState27(0);
30890
- const [memoryRecalled, setMemoryRecalled] = useState27(false);
30891
- const [intentTier, setIntentTier] = useState27(null);
30892
- const [kimiMdStale, setKimiMdStale] = useState27(false);
30893
- const [gitBranch, setGitBranch] = useState27(null);
30894
- const [lastSessionTopic, setLastSessionTopic] = useState27(null);
30895
- const [activeWorkers, setActiveWorkers] = useState27([]);
30896
- const [isSynthesizing, setIsSynthesizing] = useState27(false);
30897
- const [coordinatorNarration, setCoordinatorNarration] = useState27("");
31117
+ const [selectedRemoteSession, setSelectedRemoteSession] = useState28(null);
31118
+ const [verbose, setVerbose] = useState28(false);
31119
+ const [hasUpdate, setHasUpdate] = useState28(initialUpdateResult?.hasUpdate ?? false);
31120
+ const [latestVersion, setLatestVersion] = useState28(initialUpdateResult?.latestVersion ?? null);
31121
+ const [theme, setTheme] = useState28(resolveTheme(initialCfg?.theme));
31122
+ const [originalTheme, setOriginalTheme] = useState28(null);
31123
+ const [skillsActive, setSkillsActive] = useState28(0);
31124
+ const [memoryRecalled, setMemoryRecalled] = useState28(false);
31125
+ const [intentTier, setIntentTier] = useState28(null);
31126
+ const [kimiMdStale, setKimiMdStale] = useState28(false);
31127
+ const [gitBranch, setGitBranch] = useState28(null);
31128
+ const [lastSessionTopic, setLastSessionTopic] = useState28(null);
31129
+ const [activeWorkers, setActiveWorkers] = useState28([]);
31130
+ const [isSynthesizing, setIsSynthesizing] = useState28(false);
31131
+ const [coordinatorNarration, setCoordinatorNarration] = useState28("");
30898
31132
  useEffect11(() => {
30899
31133
  setGitBranch(detectGitBranch());
30900
31134
  }, []);
@@ -30944,8 +31178,8 @@ ${wcagWarnings.join("\n")}` }
30944
31178
  cancelled = true;
30945
31179
  };
30946
31180
  }, []);
30947
- const [cursorOffset, setCursorOffset] = useState27(0);
30948
- const [customCommandsVersion, setCustomCommandsVersion] = useState27(0);
31181
+ const [cursorOffset, setCursorOffset] = useState28(0);
31182
+ const [customCommandsVersion, setCustomCommandsVersion] = useState28(0);
30949
31183
  const cacheStableRef = useRef7(initialCfg?.cacheStablePrompts !== false);
30950
31184
  const messagesRef = useRef7(
30951
31185
  makePrefixMessages(cacheStableRef.current, cfg?.model ?? DEFAULT_MODEL, "edit", ALL_TOOLS)
@@ -30986,6 +31220,7 @@ ${wcagWarnings.join("\n")}` }
30986
31220
  }, []);
30987
31221
  const sessionStartRecallRef = useRef7(null);
30988
31222
  const kimiMdStaleNudgedRef = useRef7(false);
31223
+ const sessionPlanRef = useRef7(null);
30989
31224
  const sessionMgr = useSessionManager({
30990
31225
  cfg,
30991
31226
  messagesRef,
@@ -31023,7 +31258,7 @@ ${wcagWarnings.join("\n")}` }
31023
31258
  const customCommandsRef = useRef7([]);
31024
31259
  const recentFilesRef = useRef7(/* @__PURE__ */ new Map());
31025
31260
  const MAX_RECENT_FILES = 10;
31026
- const allSlashCommands = React23.useMemo(() => {
31261
+ const allSlashCommands = React24.useMemo(() => {
31027
31262
  const customs = customCommandsRef.current.filter((c) => !BUILTIN_COMMAND_NAMES.has(c.name.toLowerCase())).map((c) => ({
31028
31263
  name: c.name,
31029
31264
  description: c.description ?? "",
@@ -31389,7 +31624,7 @@ ${wcagWarnings.join("\n")}` }
31389
31624
  [cfg]
31390
31625
  );
31391
31626
  const interruptDepsRef = useRef7(null);
31392
- useInput19((inputChar, key) => {
31627
+ useInput20((inputChar, key) => {
31393
31628
  if (key.ctrl && inputChar === "c") {
31394
31629
  logger.info("input:ctrl+c", {
31395
31630
  busy: busyRef.current,
@@ -31411,7 +31646,7 @@ ${wcagWarnings.join("\n")}` }
31411
31646
  }
31412
31647
  if (key.escape) {
31413
31648
  const now2 = Date.now();
31414
- const modalOpen = perm !== null || limitModal !== null || loopModal !== null || showLspWizard || showCommandList || commandWizard !== null || commandToDelete !== null || resumeSessions !== null || checkpointSession !== null || showThemePicker;
31649
+ const modalOpen = perm !== null || limitModal !== null || loopModal !== null || showLspWizard || showCommandList || commandWizard !== null || commandToDelete !== null || resumeSessions !== null || checkpointSession !== null || planOptions !== null || showThemePicker;
31415
31650
  if (!modalOpen && !isAbortingRef.current && now2 - lastEscapeAtRef.current > 500) {
31416
31651
  if (multiAgentAbortRef.current) {
31417
31652
  lastEscapeAtRef.current = now2;
@@ -31663,7 +31898,7 @@ ${wcagWarnings.join("\n")}` }
31663
31898
  (picked) => {
31664
31899
  setShowPlanCompletePicker(false);
31665
31900
  if (!picked || picked === "continue") return;
31666
- const plan = distillSessionPlan(messagesRef.current);
31901
+ const plan = sessionPlanRef.current ?? distillSessionPlan(messagesRef.current);
31667
31902
  if (!plan) {
31668
31903
  setEvents((e) => [
31669
31904
  ...e,
@@ -31697,6 +31932,7 @@ ${wcagWarnings.join("\n")}` }
31697
31932
  clearTaskTracking();
31698
31933
  compactSuggestedRef.current = false;
31699
31934
  updateNudgedRef.current = false;
31935
+ sessionPlanRef.current = null;
31700
31936
  setEvents((e) => [
31701
31937
  ...e,
31702
31938
  {
@@ -31923,7 +32159,8 @@ ${wcagWarnings.join("\n")}` }
31923
32159
  sessionStateRef,
31924
32160
  compiledContextRef,
31925
32161
  lastApiErrorRef,
31926
- activeScopeRef
32162
+ activeScopeRef,
32163
+ sessionPlanRef
31927
32164
  }), [
31928
32165
  exit,
31929
32166
  busy,
@@ -32355,10 +32592,13 @@ ${conflicts.join("\n")}` }
32355
32592
  setTasksStartTokens(0);
32356
32593
  }
32357
32594
  },
32595
+ onPlanOptions: (options) => {
32596
+ planOptionsRef.current = options;
32597
+ },
32358
32598
  askPermission: askForPermission,
32359
32599
  onToolLimitReached: () => new Promise((resolve5) => {
32360
32600
  limitResolveRef.current = resolve5;
32361
- setLimitModal({ limit: 50, resolve: resolve5 });
32601
+ setLimitModal({ limit: 200, resolve: resolve5 });
32362
32602
  }),
32363
32603
  onLoopDetected: () => new Promise((resolve5) => {
32364
32604
  loopResolveRef.current = resolve5;
@@ -32580,9 +32820,13 @@ ${conflicts.join("\n")}` }
32580
32820
  if (modeRef.current === "plan") {
32581
32821
  const plan = distillSessionPlan(messagesRef.current);
32582
32822
  if (plan) {
32823
+ sessionPlanRef.current = plan;
32583
32824
  setShowPlanCompletePicker(true);
32584
32825
  }
32585
32826
  }
32827
+ if (planOptionsRef.current) {
32828
+ setPlanOptions(planOptionsRef.current);
32829
+ }
32586
32830
  },
32587
32831
  onError: async (e) => {
32588
32832
  if (e.name === "AbortError") {
@@ -32677,7 +32921,7 @@ ${conflicts.join("\n")}` }
32677
32921
  });
32678
32922
  }, [usage, modelContextLimit, busy, runCompact2]);
32679
32923
  if (!cfg) {
32680
- return /* @__PURE__ */ jsx42(ThemeProvider, { theme, children: /* @__PURE__ */ jsx42(
32924
+ return /* @__PURE__ */ jsx43(ThemeProvider, { theme, children: /* @__PURE__ */ jsx43(
32681
32925
  Onboarding,
32682
32926
  {
32683
32927
  onCancel: () => exit(),
@@ -32691,8 +32935,38 @@ ${conflicts.join("\n")}` }
32691
32935
  }
32692
32936
  ) });
32693
32937
  }
32938
+ if (planOptions !== null) {
32939
+ return /* @__PURE__ */ jsx43(ThemeProvider, { theme, children: /* @__PURE__ */ jsx43(Box41, { flexDirection: "column", children: /* @__PURE__ */ jsx43(
32940
+ PlanOptionsPicker,
32941
+ {
32942
+ options: planOptions,
32943
+ onPick: (option) => {
32944
+ setPlanOptions(null);
32945
+ planOptionsRef.current = null;
32946
+ if (option) {
32947
+ const ctx = buildSlashContext();
32948
+ const clipResult = executeFreshStart(ctx, option.plan);
32949
+ setEvents((e) => [
32950
+ ...e,
32951
+ {
32952
+ kind: "info",
32953
+ key: mkKey(),
32954
+ text: clipResult.success ? `Plan "${option.label}" copied to clipboard. Starting fresh session with plan only\u2026` : `Starting fresh session with plan "${option.label}"\u2026`
32955
+ }
32956
+ ]);
32957
+ if (!clipResult.success) {
32958
+ setEvents((e) => [
32959
+ ...e,
32960
+ { kind: "info", key: mkKey(), text: "--- Plan ---\n" + option.plan }
32961
+ ]);
32962
+ }
32963
+ }
32964
+ }
32965
+ }
32966
+ ) }) });
32967
+ }
32694
32968
  if (checkpointSession !== null) {
32695
- return /* @__PURE__ */ jsx42(ThemeProvider, { theme, children: /* @__PURE__ */ jsx42(Box40, { flexDirection: "column", children: /* @__PURE__ */ jsx42(
32969
+ return /* @__PURE__ */ jsx43(ThemeProvider, { theme, children: /* @__PURE__ */ jsx43(Box41, { flexDirection: "column", children: /* @__PURE__ */ jsx43(
32696
32970
  CheckpointPicker,
32697
32971
  {
32698
32972
  session: checkpointSession,
@@ -32702,10 +32976,10 @@ ${conflicts.join("\n")}` }
32702
32976
  ) }) });
32703
32977
  }
32704
32978
  if (resumeSessions !== null) {
32705
- return /* @__PURE__ */ jsx42(ThemeProvider, { theme, children: /* @__PURE__ */ jsx42(Box40, { flexDirection: "column", children: /* @__PURE__ */ jsx42(ResumePicker, { sessions: resumeSessions, onPick: handleResumePick }) }) });
32979
+ return /* @__PURE__ */ jsx43(ThemeProvider, { theme, children: /* @__PURE__ */ jsx43(Box41, { flexDirection: "column", children: /* @__PURE__ */ jsx43(ResumePicker, { sessions: resumeSessions, onPick: handleResumePick }) }) });
32706
32980
  }
32707
32981
  if (hasFullscreenModal) {
32708
- return /* @__PURE__ */ jsx42(
32982
+ return /* @__PURE__ */ jsx43(
32709
32983
  ModalHost,
32710
32984
  {
32711
32985
  modals,
@@ -32849,9 +33123,9 @@ ${conflicts.join("\n")}` }
32849
33123
  );
32850
33124
  }
32851
33125
  const hasConversation = events.some((e) => e.kind === "user" || e.kind === "assistant");
32852
- return /* @__PURE__ */ jsx42(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs40(Box40, { flexDirection: "column", children: [
32853
- !hasConversation && events.length === 0 ? /* @__PURE__ */ jsx42(Welcome, {}) : /* @__PURE__ */ jsx42(ChatView, { events, showReasoning, verbose, intentTier: intentTier ?? void 0 }),
32854
- perm ? /* @__PURE__ */ jsx42(
33126
+ return /* @__PURE__ */ jsx43(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs41(Box41, { flexDirection: "column", children: [
33127
+ !hasConversation && events.length === 0 ? /* @__PURE__ */ jsx43(Welcome, {}) : /* @__PURE__ */ jsx43(ChatView, { events, showReasoning, verbose, intentTier: intentTier ?? void 0 }),
33128
+ perm ? /* @__PURE__ */ jsx43(
32855
33129
  PermissionModal,
32856
33130
  {
32857
33131
  tool: perm.tool,
@@ -32861,7 +33135,7 @@ ${conflicts.join("\n")}` }
32861
33135
  submitRef.current(text);
32862
33136
  }
32863
33137
  }
32864
- ) : limitModal || loopModal ? /* @__PURE__ */ jsx42(
33138
+ ) : limitModal || loopModal ? /* @__PURE__ */ jsx43(
32865
33139
  ModalOverlay,
32866
33140
  {
32867
33141
  modals,
@@ -32872,9 +33146,9 @@ ${conflicts.join("\n")}` }
32872
33146
  loopResolveRef.current = null;
32873
33147
  }
32874
33148
  }
32875
- ) : showPlanCompletePicker ? /* @__PURE__ */ jsx42(PlanCompletePicker, { onPick: handlePlanCompletePick }) : /* @__PURE__ */ jsxs40(Box40, { flexDirection: "column", marginTop: 1, children: [
32876
- (activeWorkers.length > 0 || coordinatorNarration) && /* @__PURE__ */ jsx42(WorkerList, { workers: activeWorkers, isSynthesizing, narration: coordinatorNarration }),
32877
- tasks.length > 0 && /* @__PURE__ */ jsx42(
33149
+ ) : showPlanCompletePicker ? /* @__PURE__ */ jsx43(PlanCompletePicker, { onPick: handlePlanCompletePick }) : /* @__PURE__ */ jsxs41(Box41, { flexDirection: "column", marginTop: 1, children: [
33150
+ (activeWorkers.length > 0 || coordinatorNarration) && /* @__PURE__ */ jsx43(WorkerList, { workers: activeWorkers, isSynthesizing, narration: coordinatorNarration }),
33151
+ tasks.length > 0 && /* @__PURE__ */ jsx43(
32878
33152
  TaskList,
32879
33153
  {
32880
33154
  tasks,
@@ -32882,11 +33156,11 @@ ${conflicts.join("\n")}` }
32882
33156
  tokensDelta: Math.max(0, (usage?.prompt_tokens ?? 0) - tasksStartTokens)
32883
33157
  }
32884
33158
  ),
32885
- queue2.length > 0 && /* @__PURE__ */ jsx42(Box40, { flexDirection: "column", marginBottom: 1, children: queue2.map((q, i) => /* @__PURE__ */ jsxs40(Text41, { color: theme.info.color, dimColor: theme.info.dim, children: [
33159
+ queue2.length > 0 && /* @__PURE__ */ jsx43(Box41, { flexDirection: "column", marginBottom: 1, children: queue2.map((q, i) => /* @__PURE__ */ jsxs41(Text42, { color: theme.info.color, dimColor: theme.info.dim, children: [
32886
33160
  "\u23F3 ",
32887
33161
  q.display
32888
33162
  ] }, `queue_${i}`)) }),
32889
- /* @__PURE__ */ jsx42(
33163
+ /* @__PURE__ */ jsx43(
32890
33164
  StatusBar,
32891
33165
  {
32892
33166
  usage,
@@ -32908,7 +33182,7 @@ ${conflicts.join("\n")}` }
32908
33182
  intentTier: intentTier ?? void 0
32909
33183
  }
32910
33184
  ),
32911
- picker.active?.kind === "file" && /* @__PURE__ */ jsx42(
33185
+ picker.active?.kind === "file" && /* @__PURE__ */ jsx43(
32912
33186
  FilePicker,
32913
33187
  {
32914
33188
  items: picker.fileItems,
@@ -32917,7 +33191,7 @@ ${conflicts.join("\n")}` }
32917
33191
  recentFiles: new Set(recentFilesRef.current.keys())
32918
33192
  }
32919
33193
  ),
32920
- picker.active?.kind === "slash" && /* @__PURE__ */ jsx42(
33194
+ picker.active?.kind === "slash" && /* @__PURE__ */ jsx43(
32921
33195
  SlashPicker,
32922
33196
  {
32923
33197
  items: picker.slashItems,
@@ -32925,9 +33199,9 @@ ${conflicts.join("\n")}` }
32925
33199
  query: picker.query
32926
33200
  }
32927
33201
  ),
32928
- /* @__PURE__ */ jsxs40(Box40, { marginTop: 1, children: [
32929
- /* @__PURE__ */ jsx42(Text41, { color: theme.prompt ?? theme.accent, children: "\u203A " }),
32930
- /* @__PURE__ */ jsx42(
33202
+ /* @__PURE__ */ jsxs41(Box41, { marginTop: 1, children: [
33203
+ /* @__PURE__ */ jsx43(Text42, { color: theme.prompt ?? theme.accent, children: "\u203A " }),
33204
+ /* @__PURE__ */ jsx43(
32931
33205
  CustomTextInput,
32932
33206
  {
32933
33207
  value: input,
@@ -32984,7 +33258,7 @@ ${conflicts.join("\n")}` }
32984
33258
  }
32985
33259
  async function renderApp(cfg, updateResult, lspScope = "global", lspProjectPath = null) {
32986
33260
  const instance = render(
32987
- /* @__PURE__ */ jsx42(
33261
+ /* @__PURE__ */ jsx43(
32988
33262
  App,
32989
33263
  {
32990
33264
  initialCfg: cfg,
@@ -33029,6 +33303,7 @@ var init_app = __esm({
33029
33303
  init_use_permission_controller();
33030
33304
  init_resume_picker();
33031
33305
  init_checkpoint_picker();
33306
+ init_plan_options_picker();
33032
33307
  init_task_list();
33033
33308
  init_worker_list();
33034
33309
  init_text_input();
@@ -33261,7 +33536,7 @@ function renderLogo(version) {
33261
33536
 
33262
33537
  // src/index.tsx
33263
33538
  var program = new Command2();
33264
- program.name("kimiflare").description("Terminal coding agent powered by Kimi-K2.6 on Cloudflare Workers AI.").version(getAppVersion()).option("-p, --print <prompt>", "one-shot mode: send prompt, stream reply to stdout, exit").option("-m, --model <id>", "model id (defaults to @cf/moonshotai/kimi-k2.6)").option("--dangerously-allow-all", "auto-approve every permission prompt (print mode only)").option("--reasoning", "include reasoning in stdout (print mode only)").option("--continue-on-limit", "reset tool-call counter and continue when the 50-call limit is hit (print mode only)").option("--max-input-tokens <n>", "cumulative prompt token budget; exits 42 when exhausted (print mode only)", (v) => parseInt(v, 10)).option("--emit-events", "emit Camouflage NDJSON events to stdout; requires -p (for initial prompt)").option("--multi-turn", "with --emit-events: keep reading stdin for UserInputSubmitted follow-ups after the initial turn").option("--ui <name>", "render UI with the given engine: `ink` (default, stable) or `camouflage` (experimental Rust TUI). Can also be set via the KIMIFLARE_UI environment variable.").option("--camouflage-bin <path>", "with --ui camouflage: path to the camouflage-tui binary (defaults to PATH lookup)").option("--mode <mode>", "run mode: interactive (default), print, rpc");
33539
+ program.name("kimiflare").description("Terminal coding agent powered by Kimi-K2.6 on Cloudflare Workers AI.").version(getAppVersion()).option("-p, --print <prompt>", "one-shot mode: send prompt, stream reply to stdout, exit").option("-m, --model <id>", "model id (defaults to @cf/moonshotai/kimi-k2.6)").option("--dangerously-allow-all", "auto-approve every permission prompt (print mode only)").option("--reasoning", "include reasoning in stdout (print mode only)").option("--continue-on-limit", "reset tool-call counter and continue when the 200-call limit is hit (print mode only)").option("--max-input-tokens <n>", "cumulative prompt token budget; exits 42 when exhausted (print mode only)", (v) => parseInt(v, 10)).option("--emit-events", "emit Camouflage NDJSON events to stdout; requires -p (for initial prompt)").option("--multi-turn", "with --emit-events: keep reading stdin for UserInputSubmitted follow-ups after the initial turn").option("--ui <name>", "render UI with the given engine: `ink` (default, stable) or `camouflage` (experimental Rust TUI). Can also be set via the KIMIFLARE_UI environment variable.").option("--camouflage-bin <path>", "with --ui camouflage: path to the camouflage-tui binary (defaults to PATH lookup)").option("--mode <mode>", "run mode: interactive (default), print, rpc");
33265
33540
  program.command("cost").description("Show cost attribution by task type (requires costAttribution enabled)").option("-w, --week", "last 7 days (default)").option("-m, --month", "last 30 days").option("-d, --day", "today only").option("-s, --session <id>", "single session detail").option("-c, --category <name>", "filter by category").option("--json", "machine-readable output").option("--reclassify", "re-run classification on all sessions").option("--local-only", "skip Cloudflare reconciliation").action(async (cmdOpts) => {
33266
33541
  const cfg = await loadConfig();
33267
33542
  const enabled = cfg?.costAttribution ?? false;