@wrongstack/tui 0.316.2 → 0.317.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -386,17 +386,24 @@ function mixHexColors(colorA, colorB, weight) {
386
386
  return `#${[r, g, bl].map((c) => c.toString(16).padStart(2, "0")).join("")}`;
387
387
  }
388
388
  function parseHexColor(hex) {
389
- const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
389
+ const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
390
390
  if (!m) return null;
391
- const n = Number.parseInt(m[1], 16);
391
+ const raw = m[1];
392
+ if (raw.length === 3) {
393
+ const r = Number.parseInt(raw[0] + raw[0], 16);
394
+ const g = Number.parseInt(raw[1] + raw[1], 16);
395
+ const b = Number.parseInt(raw[2] + raw[2], 16);
396
+ return [r, g, b];
397
+ }
398
+ const n = Number.parseInt(raw, 16);
392
399
  return [n >> 16 & 255, n >> 8 & 255, n & 255];
393
400
  }
394
401
  function detectSupportsBackground(env = process.env, isTTY = process.stdout.isTTY ?? false) {
395
402
  if (!isTTY) return false;
396
- if (typeof env.NO_COLOR === "string" && env.NO_COLOR !== "") return false;
397
- const colorterm = env.COLORTERM ?? "";
403
+ if (typeof env["NO_COLOR"] === "string" && env["NO_COLOR"] !== "") return false;
404
+ const colorterm = env["COLORTERM"] ?? "";
398
405
  if (/^(truecolor|24bit)$/i.test(colorterm)) return true;
399
- const term = env.TERM ?? "";
406
+ const term = env["TERM"] ?? "";
400
407
  if (/truecolor|24bit/i.test(term)) return true;
401
408
  if (/256(color)?/i.test(term)) return true;
402
409
  if (colorterm !== "" && colorterm !== "false") return true;
@@ -5556,6 +5563,9 @@ function renderProgressBar(progress, trend, width = 20) {
5556
5563
  ] });
5557
5564
  }
5558
5565
 
5566
+ // src/components/help-overlay.tsx
5567
+ import { useState as useState7 } from "react";
5568
+
5559
5569
  // src/f-key-panels.ts
5560
5570
  var F_KEY_PANEL_ENTRIES = [
5561
5571
  {
@@ -5692,7 +5702,7 @@ function actionForFKeyPanel(entry, hiddenItems = []) {
5692
5702
  }
5693
5703
 
5694
5704
  // src/components/help-overlay.tsx
5695
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
5705
+ import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
5696
5706
  function helpSections() {
5697
5707
  const nav = [];
5698
5708
  nav.push(
@@ -5878,66 +5888,84 @@ function splitIntoColumns(entries) {
5878
5888
  }
5879
5889
  return [left, right];
5880
5890
  }
5891
+ function buildHelpRows(sections) {
5892
+ const rows = [];
5893
+ for (const sec of sections) {
5894
+ rows.push({ kind: "section", title: sec.title });
5895
+ if (sec.title === "Tool Colors") {
5896
+ const [leftCol, rightCol] = splitIntoColumns(sec.entries);
5897
+ for (let i = 0; i < leftCol.length; i++) {
5898
+ const left = leftCol[i];
5899
+ if (!left) continue;
5900
+ rows.push({ kind: "pair", left, right: rightCol[i] });
5901
+ }
5902
+ } else {
5903
+ for (const entry of sec.entries) {
5904
+ rows.push({ kind: "entry", keys: entry.keys, desc: entry.desc });
5905
+ }
5906
+ }
5907
+ }
5908
+ return rows;
5909
+ }
5881
5910
  function HelpOverlay() {
5882
- const sections = helpSections();
5883
- const otherSections = sections.filter((s2) => s2.title !== "Tool Colors");
5911
+ const rows = buildHelpRows(helpSections());
5912
+ const size = useMonitorSize();
5913
+ const [cursor, setCursor] = useState7(0);
5914
+ const limit = Math.max(3, size.contentRows - 3);
5915
+ const lastRow = Math.max(0, rows.length - 1);
5916
+ const page = Math.max(1, limit - 1);
5917
+ useInput((_input, key) => {
5918
+ if (key.upArrow) setCursor((c) => Math.max(0, c - 1));
5919
+ else if (key.downArrow) setCursor((c) => Math.min(lastRow, c + 1));
5920
+ else if (key.pageUp) setCursor((c) => Math.max(0, c - page));
5921
+ else if (key.pageDown) setCursor((c) => Math.min(lastRow, c + page));
5922
+ });
5923
+ const win = panelWindow(rows.length, cursor, limit);
5924
+ const visible = rows.slice(win.start, win.end);
5884
5925
  const otherKeyWidth = Math.max(
5885
- ...otherSections.flatMap((s2) => s2.entries.map((e) => e.keys.length)),
5926
+ ...rows.filter((r) => r.kind === "entry").map((r) => r.keys.length),
5886
5927
  0
5887
5928
  );
5888
- const toolSection = sections.find((s2) => s2.title === "Tool Colors");
5889
- const toolKeyWidth = toolSection ? Math.max(...toolSection.entries.map((e) => e.keys.length), 0) : 0;
5929
+ const otherKeyCol = otherKeyWidth + 2;
5930
+ const descWidth = Math.max(0, size.contentWidth - otherKeyCol);
5931
+ const toolKeyWidth = Math.max(
5932
+ ...rows.filter((r) => r.kind === "pair").flatMap((r) => [r.left.keys.length, r.right?.keys.length ?? 0]),
5933
+ 0
5934
+ );
5935
+ const toolKeyCol = toolKeyWidth + 2;
5936
+ const toolDescWidth = Math.max(
5937
+ 0,
5938
+ Math.floor((size.contentWidth - 2 * toolKeyCol - 2) / 2)
5939
+ );
5890
5940
  return /* @__PURE__ */ jsxs10(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
5891
5941
  /* @__PURE__ */ jsxs10(Box, { flexDirection: "row", gap: 1, children: [
5892
5942
  /* @__PURE__ */ jsx11(Text, { bold: true, color: theme.accent, children: "Keyboard shortcuts" }),
5893
- /* @__PURE__ */ jsx11(Text, { dimColor: true, children: "\xB7 Esc to close" })
5943
+ /* @__PURE__ */ jsx11(Text, { dimColor: true, children: "\xB7 \u2191/\u2193 scroll \xB7 PgUp/PgDn page \xB7 Esc to close" })
5894
5944
  ] }),
5895
- sections.map((sec) => {
5896
- if (sec.title === "Tool Colors") {
5897
- const [leftCol, rightCol] = splitIntoColumns(sec.entries);
5898
- return /* @__PURE__ */ jsxs10(Box, { flexDirection: "column", marginTop: 1, children: [
5899
- /* @__PURE__ */ jsx11(Text, { bold: true, color: theme.brand, children: sec.title }),
5900
- /* @__PURE__ */ jsxs10(Box, { flexDirection: "row", gap: 2, children: [
5901
- /* @__PURE__ */ jsx11(Box, { flexDirection: "column", children: leftCol.map((e, i) => /* @__PURE__ */ jsxs10(
5902
- Box,
5903
- {
5904
- flexDirection: "row",
5905
- children: [
5906
- /* @__PURE__ */ jsx11(Text, { color: theme.accent, children: e.keys.padEnd(toolKeyWidth + 2) }),
5907
- /* @__PURE__ */ jsx11(Text, { dimColor: true, children: e.desc })
5908
- ]
5909
- },
5910
- i
5911
- )) }),
5912
- /* @__PURE__ */ jsx11(Box, { flexDirection: "column", children: rightCol.map((e, i) => /* @__PURE__ */ jsxs10(
5913
- Box,
5914
- {
5915
- flexDirection: "row",
5916
- children: [
5917
- /* @__PURE__ */ jsx11(Text, { color: theme.accent, children: e.keys.padEnd(toolKeyWidth + 2) }),
5918
- /* @__PURE__ */ jsx11(Text, { dimColor: true, children: e.desc })
5919
- ]
5920
- },
5921
- i
5922
- )) })
5923
- ] })
5924
- ] }, sec.title);
5925
- }
5926
- return /* @__PURE__ */ jsxs10(Box, { flexDirection: "column", marginTop: 1, children: [
5927
- /* @__PURE__ */ jsx11(Text, { bold: true, color: theme.brand, children: sec.title }),
5928
- sec.entries.map((e, i) => /* @__PURE__ */ jsxs10(
5929
- Box,
5930
- {
5931
- flexDirection: "row",
5932
- children: [
5933
- /* @__PURE__ */ jsx11(Text, { color: theme.accent, children: e.keys.padEnd(otherKeyWidth + 2) }),
5934
- /* @__PURE__ */ jsx11(Text, { dimColor: true, children: e.desc })
5935
- ]
5936
- },
5937
- i
5938
- ))
5939
- ] }, sec.title);
5940
- })
5945
+ win.above > 0 ? /* @__PURE__ */ jsx11(Text, { dimColor: true, children: ` \u2191 ${win.above} more` }) : null,
5946
+ visible.map((row, i) => {
5947
+ if (row.kind === "section") {
5948
+ return /* @__PURE__ */ jsx11(Text, { bold: true, color: theme.brand, children: row.title }, `section-${row.title}`);
5949
+ }
5950
+ if (row.kind === "entry") {
5951
+ return /* @__PURE__ */ jsxs10(Text, { children: [
5952
+ /* @__PURE__ */ jsx11(Text, { color: theme.accent, children: row.keys.padEnd(otherKeyCol) }),
5953
+ /* @__PURE__ */ jsx11(Text, { dimColor: true, children: truncatePanelText(row.desc, descWidth) })
5954
+ ] }, `entry-${win.start + i}`);
5955
+ }
5956
+ const leftDesc = truncatePanelText(row.left.desc, toolDescWidth).padEnd(
5957
+ toolDescWidth + 2
5958
+ );
5959
+ return /* @__PURE__ */ jsxs10(Text, { children: [
5960
+ /* @__PURE__ */ jsx11(Text, { color: theme.accent, children: row.left.keys.padEnd(toolKeyCol) }),
5961
+ /* @__PURE__ */ jsx11(Text, { dimColor: true, children: leftDesc }),
5962
+ row.right ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
5963
+ /* @__PURE__ */ jsx11(Text, { color: theme.accent, children: row.right.keys.padEnd(toolKeyCol) }),
5964
+ /* @__PURE__ */ jsx11(Text, { dimColor: true, children: truncatePanelText(row.right.desc, toolDescWidth) })
5965
+ ] }) : null
5966
+ ] }, `pair-${win.start + i}`);
5967
+ }),
5968
+ win.below > 0 ? /* @__PURE__ */ jsx11(Text, { dimColor: true, children: ` \u2193 ${win.below} more` }) : null
5941
5969
  ] });
5942
5970
  }
5943
5971
 
@@ -5957,7 +5985,7 @@ import {
5957
5985
  updateTask
5958
5986
  } from "@wrongstack/kanban";
5959
5987
  import { applySessionKanbanTaskToSource } from "@wrongstack/tools/session-kanban";
5960
- import { useEffect as useEffect6, useMemo as useMemo3, useState as useState7 } from "react";
5988
+ import { useEffect as useEffect6, useMemo as useMemo3, useState as useState8 } from "react";
5961
5989
 
5962
5990
  // src/kanban-audit.ts
5963
5991
  var DEFAULT_REVIEW_STALE_AFTER_MS = 72 * 60 * 60 * 1e3;
@@ -6287,7 +6315,7 @@ function severityRank(severity) {
6287
6315
  }
6288
6316
 
6289
6317
  // src/components/kanban-panel.tsx
6290
- import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
6318
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
6291
6319
  function KanbanPanel({
6292
6320
  projectRoot,
6293
6321
  sessionId,
@@ -6297,14 +6325,14 @@ function KanbanPanel({
6297
6325
  initialBoardId
6298
6326
  }) {
6299
6327
  const eventContext = { sessionId, actor: "tui-operator" };
6300
- const [boards, setBoards] = useState7([]);
6301
- const [selectedBoard, setSelectedBoard] = useState7(0);
6302
- const [selectedTask, setSelectedTask] = useState7(0);
6303
- const [board, setBoard] = useState7(null);
6304
- const [loading, setLoading] = useState7(true);
6305
- const [error, setError] = useState7(null);
6306
- const [notice, setNotice] = useState7(null);
6307
- const [prompt, setPrompt] = useState7(null);
6328
+ const [boards, setBoards] = useState8([]);
6329
+ const [selectedBoard, setSelectedBoard] = useState8(0);
6330
+ const [selectedTask, setSelectedTask] = useState8(0);
6331
+ const [board, setBoard] = useState8(null);
6332
+ const [loading, setLoading] = useState8(true);
6333
+ const [error, setError] = useState8(null);
6334
+ const [notice, setNotice] = useState8(null);
6335
+ const [prompt, setPrompt] = useState8(null);
6308
6336
  const sortedColumns = useMemo3(
6309
6337
  () => [...board?.columns ?? []].sort((a, b) => a.order - b.order),
6310
6338
  [board]
@@ -6635,7 +6663,7 @@ function KanbanPanel({
6635
6663
  " board",
6636
6664
  boards.length === 1 ? "" : "s"
6637
6665
  ] }),
6638
- board ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
6666
+ board ? /* @__PURE__ */ jsxs11(Fragment5, { children: [
6639
6667
  /* @__PURE__ */ jsx12(Text, { dimColor: true, children: "|" }),
6640
6668
  /* @__PURE__ */ jsx12(Text, { children: board.title })
6641
6669
  ] }) : null,
@@ -6855,7 +6883,7 @@ function TaskDetail({
6855
6883
  }) {
6856
6884
  return /* @__PURE__ */ jsxs11(Box, { flexDirection: "column", width: 34, borderStyle: "single", borderColor: "gray", paddingX: 1, children: [
6857
6885
  /* @__PURE__ */ jsx12(Text, { bold: true, color: "cyan", children: "Task" }),
6858
- !task ? /* @__PURE__ */ jsx12(Text, { dimColor: true, children: "No task selected." }) : /* @__PURE__ */ jsxs11(Fragment4, { children: [
6886
+ !task ? /* @__PURE__ */ jsx12(Text, { dimColor: true, children: "No task selected." }) : /* @__PURE__ */ jsxs11(Fragment5, { children: [
6859
6887
  /* @__PURE__ */ jsx12(Text, { wrap: "truncate", children: task.title }),
6860
6888
  /* @__PURE__ */ jsxs11(Text, { dimColor: true, children: [
6861
6889
  "ID ",
@@ -7079,7 +7107,7 @@ function BoardSummary({
7079
7107
  "scope ",
7080
7108
  describeKanbanBoundary(board.boundary)
7081
7109
  ] }),
7082
- target ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
7110
+ target ? /* @__PURE__ */ jsxs11(Fragment5, { children: [
7083
7111
  /* @__PURE__ */ jsx12(Text, { dimColor: true, children: "|" }),
7084
7112
  /* @__PURE__ */ jsxs11(Text, { dimColor: true, children: [
7085
7113
  "next board: ",
@@ -7124,7 +7152,7 @@ function clamp(value, min, max) {
7124
7152
  }
7125
7153
 
7126
7154
  // src/components/key-hint-bar.tsx
7127
- import { useEffect as useEffect7, useState as useState8 } from "react";
7155
+ import { useEffect as useEffect7, useState as useState9 } from "react";
7128
7156
  import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
7129
7157
  var IDLE_MESSAGES = [
7130
7158
  { key: "", label: "github.com/wrongstack/wrongstack" },
@@ -7180,7 +7208,7 @@ function hintsFor(ctx) {
7180
7208
  function KeyHintBar({ context }) {
7181
7209
  const hints = hintsFor(context);
7182
7210
  const idle = isIdleContext(context);
7183
- const [idleIndex, setIdleIndex] = useState8(0);
7211
+ const [idleIndex, setIdleIndex] = useState9(0);
7184
7212
  useEffect7(() => {
7185
7213
  if (!idle) return;
7186
7214
  const id = setInterval(() => {
@@ -7288,7 +7316,7 @@ function MailboxPanel({
7288
7316
  }
7289
7317
 
7290
7318
  // src/components/phase-monitor.tsx
7291
- import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
7319
+ import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
7292
7320
  var fmtElapsed2 = (ms) => {
7293
7321
  const s2 = Math.floor(ms / 1e3);
7294
7322
  const m = Math.floor(s2 / 60);
@@ -7339,7 +7367,7 @@ function PhaseMonitor({
7339
7367
  "\u2713",
7340
7368
  done.length
7341
7369
  ] }),
7342
- failed.length > 0 ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
7370
+ failed.length > 0 ? /* @__PURE__ */ jsxs14(Fragment6, { children: [
7343
7371
  /* @__PURE__ */ jsx15(Text, { dimColor: true, children: "\xB7" }),
7344
7372
  /* @__PURE__ */ jsxs14(Text, { color: "red", children: [
7345
7373
  "\u2717",
@@ -7360,14 +7388,14 @@ function PhaseMonitor({
7360
7388
  /* @__PURE__ */ jsx15(Text, { bold: true, children: phase.name }),
7361
7389
  /* @__PURE__ */ jsx15(Text, { dimColor: true, children: "\xB7" }),
7362
7390
  /* @__PURE__ */ jsx15(Text, { color: s2.color, children: s2.label }),
7363
- isRunning ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
7391
+ isRunning ? /* @__PURE__ */ jsxs14(Fragment6, { children: [
7364
7392
  /* @__PURE__ */ jsx15(Text, { dimColor: true, children: "\xB7" }),
7365
7393
  /* @__PURE__ */ jsxs14(Text, { dimColor: true, children: [
7366
7394
  "elapsed ",
7367
7395
  elapsed
7368
7396
  ] })
7369
7397
  ] }) : null,
7370
- phase.totalTasks > 0 && /* @__PURE__ */ jsxs14(Fragment5, { children: [
7398
+ phase.totalTasks > 0 && /* @__PURE__ */ jsxs14(Fragment6, { children: [
7371
7399
  /* @__PURE__ */ jsx15(Text, { dimColor: true, children: "\xB7" }),
7372
7400
  /* @__PURE__ */ jsxs14(Text, { dimColor: true, children: [
7373
7401
  "tasks ",
@@ -7584,14 +7612,14 @@ function PhasePanel({ phases, nowTick }) {
7584
7612
  import * as fs from "node:fs/promises";
7585
7613
  import * as path from "node:path";
7586
7614
  import { resolveWstackPaths, sessionScopedPath } from "@wrongstack/core/utils";
7587
- import { useCallback as useCallback2, useEffect as useEffect11, useMemo as useMemo5, useState as useState12 } from "react";
7615
+ import { useCallback as useCallback2, useEffect as useEffect11, useMemo as useMemo5, useState as useState13 } from "react";
7588
7616
 
7589
7617
  // src/components/status-bar.tsx
7590
7618
  import { expectDefined } from "@wrongstack/core/utils";
7591
7619
  import { useMemo as useMemo4 } from "react";
7592
7620
 
7593
7621
  // src/hooks/use-chip-staleness-guard.ts
7594
- import { useCallback, useEffect as useEffect8, useRef, useState as useState9 } from "react";
7622
+ import { useCallback, useEffect as useEffect8, useRef, useState as useState10 } from "react";
7595
7623
  var DEFAULT_STALENESS_THRESHOLD_MS = 15e3;
7596
7624
  var DEFAULT_CHECK_INTERVAL_MS = 1e4;
7597
7625
  var DEFAULT_MAX_RECOVERIES = 5;
@@ -7608,10 +7636,10 @@ function useChipStalenessGuard(opts) {
7608
7636
  checkIntervalMs = DEFAULT_CHECK_INTERVAL_MS,
7609
7637
  maxRecoveries = DEFAULT_MAX_RECOVERIES
7610
7638
  } = opts;
7611
- const [renderNonce, setRenderNonce] = useState9(0);
7612
- const [diagnoses, setDiagnoses] = useState9([]);
7639
+ const [renderNonce, setRenderNonce] = useState10(0);
7640
+ const [diagnoses, setDiagnoses] = useState10([]);
7613
7641
  const recoveryCountRef = useRef(0);
7614
- const [recoveryCount, setRecoveryCount] = useState9(0);
7642
+ const [recoveryCount, setRecoveryCount] = useState10(0);
7615
7643
  const lastSpinnerPhaseRef = useRef(spinnerPhase);
7616
7644
  const lastSpinnerChangeAtRef = useRef(Date.now());
7617
7645
  const lastTokenFingerprintRef = useRef(tokenFingerprint);
@@ -7694,10 +7722,10 @@ function computeTokenFingerprint(input, output, cost) {
7694
7722
  }
7695
7723
 
7696
7724
  // src/hooks/use-todos-auto-clear.ts
7697
- import { useEffect as useEffect9, useRef as useRef2, useState as useState10 } from "react";
7725
+ import { useEffect as useEffect9, useRef as useRef2, useState as useState11 } from "react";
7698
7726
  var TODOS_CLEAR_DELAY_MS = 3e3;
7699
7727
  function useTodosAutoClear(todos) {
7700
- const [todosCleared, setTodosCleared] = useState10(false);
7728
+ const [todosCleared, setTodosCleared] = useState11(false);
7701
7729
  const todosClearTimerRef = useRef2(null);
7702
7730
  useEffect9(() => {
7703
7731
  const hasActive = todos && (todos.pending > 0 || todos.inProgress > 0);
@@ -7730,7 +7758,7 @@ function useTodosAutoClear(todos) {
7730
7758
  }
7731
7759
 
7732
7760
  // src/hooks/use-token-counter-refresh.ts
7733
- import { useEffect as useEffect10, useState as useState11 } from "react";
7761
+ import { useEffect as useEffect10, useState as useState12 } from "react";
7734
7762
  function snapshotTokenCounter(tokenCounter) {
7735
7763
  return {
7736
7764
  usage: tokenCounter.total(),
@@ -7740,7 +7768,7 @@ function snapshotTokenCounter(tokenCounter) {
7740
7768
  };
7741
7769
  }
7742
7770
  function useTokenCounterRefresh(tokenCounter, events, sessionId) {
7743
- const [data, setData] = useState11(
7771
+ const [data, setData] = useState12(
7744
7772
  () => tokenCounter ? snapshotTokenCounter(tokenCounter) : void 0
7745
7773
  );
7746
7774
  useEffect10(() => {
@@ -7970,7 +7998,7 @@ function PowerlineRail({
7970
7998
  }
7971
7999
 
7972
8000
  // src/components/status-bar-chips.tsx
7973
- import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
8001
+ import { Fragment as Fragment7, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
7974
8002
  function BrainChip({
7975
8003
  brain,
7976
8004
  monochrome
@@ -7998,7 +8026,7 @@ function EternalStageChip({
7998
8026
  return /* @__PURE__ */ jsx18(Text, { color: color(theme.accent), children: monochrome ? `decide: ${stage.reason}` : `\u25C7 decide: ${stage.reason}` });
7999
8027
  case "execute":
8000
8028
  return /* @__PURE__ */ jsxs17(Text, { color: color(theme.success), children: [
8001
- monochrome ? null : /* @__PURE__ */ jsxs17(Fragment6, { children: [
8029
+ monochrome ? null : /* @__PURE__ */ jsxs17(Fragment7, { children: [
8002
8030
  icon("\u25B6"),
8003
8031
  " "
8004
8032
  ] }),
@@ -8380,7 +8408,7 @@ function numberValue(value) {
8380
8408
  }
8381
8409
 
8382
8410
  // src/components/status-bar-rails.tsx
8383
- import { Fragment as Fragment7, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
8411
+ import { Fragment as Fragment8, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
8384
8412
  function buildPrimaryChips(p) {
8385
8413
  const {
8386
8414
  context,
@@ -8842,7 +8870,7 @@ function buildWorkRowEntries(p) {
8842
8870
  },
8843
8871
  {
8844
8872
  id: "next_steps",
8845
- node: hasNextStepsAutoSubmit && nextStepsAutoSubmitCountdown != null && showChip("next_steps") ? /* @__PURE__ */ jsxs18(Fragment7, { children: [
8873
+ node: hasNextStepsAutoSubmit && nextStepsAutoSubmitCountdown != null && showChip("next_steps") ? /* @__PURE__ */ jsxs18(Fragment8, { children: [
8846
8874
  /* @__PURE__ */ jsx19(Text, { color: isNoColor ? void 0 : nextStepsColor, bold: true, children: isNoColor ? `${nextStepsAutoSubmitCountdown}s` : `${STATUSLINE_ICONS.next_steps} ${nextStepsAutoSubmitCountdown}s` }),
8847
8875
  /* @__PURE__ */ jsxs18(Text, { dimColor: !isNoColor, children: [
8848
8876
  " ",
@@ -8971,7 +8999,7 @@ function buildMemoryDetailChips(memoryContextMonitor, Sage, isNoColor) {
8971
8999
  /* @__PURE__ */ jsxs18(Text, { children: [
8972
9000
  Sage.total,
8973
9001
  " total",
8974
- reportedActive > 0 ? /* @__PURE__ */ jsxs18(Fragment7, { children: [
9002
+ reportedActive > 0 ? /* @__PURE__ */ jsxs18(Fragment8, { children: [
8975
9003
  /* @__PURE__ */ jsx19(Text, { dimColor: !isNoColor, children: " \xB7 " }),
8976
9004
  /* @__PURE__ */ jsxs18(Text, { color: chipColor(theme.success, isNoColor), children: [
8977
9005
  reportedActive,
@@ -9034,7 +9062,7 @@ import {
9034
9062
  DEFAULT_LINES,
9035
9063
  STATUSLINE_ITEMS
9036
9064
  } from "@wrongstack/core/statusline";
9037
- import { Fragment as Fragment8, jsxs as jsxs19 } from "react/jsx-runtime";
9065
+ import { Fragment as Fragment9, jsxs as jsxs19 } from "react/jsx-runtime";
9038
9066
  function canonicalChipKey(entryId) {
9039
9067
  if (entryId === "primary-0") return "context";
9040
9068
  if (entryId.startsWith("detail-")) return "mailbox";
@@ -9061,7 +9089,7 @@ function placeAnchors(rails, anchors, lines) {
9061
9089
  if (!anchor.node) continue;
9062
9090
  const line = assignedLine(anchor.key, DEFAULT_LINES[anchor.key], lines);
9063
9091
  const rail = rails[line - 1];
9064
- rail.rightAnchor = rail.rightAnchor ? /* @__PURE__ */ jsxs19(Fragment8, { children: [
9092
+ rail.rightAnchor = rail.rightAnchor ? /* @__PURE__ */ jsxs19(Fragment9, { children: [
9065
9093
  rail.rightAnchor,
9066
9094
  " ",
9067
9095
  anchor.node
@@ -9398,12 +9426,12 @@ function planFilePath(projectRoot, sessionId, scope) {
9398
9426
  return path.join(base, "backlog.plan.json");
9399
9427
  }
9400
9428
  function usePlanPanelData(projectRoot, sessionId, enabled = true) {
9401
- const [items, setItems] = useState12([]);
9402
- const [title, setTitle2] = useState12(void 0);
9403
- const [scope, setScope] = useState12("session");
9404
- const [loading, setLoading] = useState12(true);
9405
- const [error, setError] = useState12(null);
9406
- const [updatedAt, setUpdatedAt] = useState12(void 0);
9429
+ const [items, setItems] = useState13([]);
9430
+ const [title, setTitle2] = useState13(void 0);
9431
+ const [scope, setScope] = useState13("session");
9432
+ const [loading, setLoading] = useState13(true);
9433
+ const [error, setError] = useState13(null);
9434
+ const [updatedAt, setUpdatedAt] = useState13(void 0);
9407
9435
  const load = useCallback2(
9408
9436
  async (scope_, quiet = false) => {
9409
9437
  if (!quiet) setLoading(true);
@@ -9453,7 +9481,7 @@ function PlanPanel({
9453
9481
  projectRoot,
9454
9482
  sessionId
9455
9483
  );
9456
- const [selected, setSelected] = useState12(0);
9484
+ const [selected, setSelected] = useState13(0);
9457
9485
  async function handleScopeSwitch(newScope) {
9458
9486
  await load(newScope);
9459
9487
  }
@@ -9600,14 +9628,14 @@ function PlanRow({
9600
9628
  }
9601
9629
 
9602
9630
  // src/components/process-list.tsx
9603
- import { useEffect as useEffect12, useState as useState13 } from "react";
9631
+ import { useEffect as useEffect12, useState as useState14 } from "react";
9604
9632
  import { getProcessRegistry } from "@wrongstack/tools";
9605
9633
  import { jsx as jsx22, jsxs as jsxs22 } from "react/jsx-runtime";
9606
9634
  function ProcessListMonitor() {
9607
9635
  const size = useMonitorSize();
9608
- const [, setTick] = useState13(0);
9609
- const [selectedIndex, setSelectedIndex] = useState13(0);
9610
- const [pendingAction, setPendingAction] = useState13(null);
9636
+ const [, setTick] = useState14(0);
9637
+ const [selectedIndex, setSelectedIndex] = useState14(0);
9638
+ const [pendingAction, setPendingAction] = useState14(null);
9611
9639
  useEffect12(() => {
9612
9640
  const id = setInterval(() => setTick((t) => t + 1), 1e3);
9613
9641
  return () => clearInterval(id);
@@ -9773,7 +9801,7 @@ function ProcessListMonitor() {
9773
9801
  }
9774
9802
 
9775
9803
  // src/components/queue-panel.tsx
9776
- import { useCallback as useCallback3, useEffect as useEffect13, useState as useState14 } from "react";
9804
+ import { useCallback as useCallback3, useEffect as useEffect13, useState as useState15 } from "react";
9777
9805
  import { jsx as jsx23, jsxs as jsxs23 } from "react/jsx-runtime";
9778
9806
  function QueuePanel({
9779
9807
  items,
@@ -9783,8 +9811,8 @@ function QueuePanel({
9783
9811
  onToggleRefine
9784
9812
  }) {
9785
9813
  const size = useMonitorSize();
9786
- const [selected, setSelected] = useState14(0);
9787
- const [confirmClear, setConfirmClear] = useState14(false);
9814
+ const [selected, setSelected] = useState15(0);
9815
+ const [confirmClear, setConfirmClear] = useState15(false);
9788
9816
  const maxVisible = Math.max(3, size.contentRows - 2);
9789
9817
  const window = panelWindow(items.length, selected, maxVisible);
9790
9818
  const visible = items.slice(window.start, window.end);
@@ -10056,7 +10084,7 @@ function SddBoardOverlay({
10056
10084
  }
10057
10085
 
10058
10086
  // src/components/sessions-panel.tsx
10059
- import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs25 } from "react/jsx-runtime";
10087
+ import { Fragment as Fragment10, jsx as jsx25, jsxs as jsxs25 } from "react/jsx-runtime";
10060
10088
  function statusIcon2(status) {
10061
10089
  switch (status) {
10062
10090
  case "active":
@@ -10225,7 +10253,7 @@ function SessionsPanel({
10225
10253
  " agents"
10226
10254
  ] })
10227
10255
  ] }),
10228
- isSelected ? /* @__PURE__ */ jsxs25(Fragment9, { children: [
10256
+ isSelected ? /* @__PURE__ */ jsxs25(Fragment10, { children: [
10229
10257
  /* @__PURE__ */ jsxs25(Text, { color: theme.textMuted, children: [
10230
10258
  " ",
10231
10259
  truncatePanelText(s2.workingDir, size.contentWidth - 4),
@@ -10276,11 +10304,11 @@ function SessionsPanel({
10276
10304
  }
10277
10305
 
10278
10306
  // src/components/todos-monitor.tsx
10279
- import { useEffect as useEffect14, useState as useState15 } from "react";
10307
+ import { useEffect as useEffect14, useState as useState16 } from "react";
10280
10308
  import { jsx as jsx26, jsxs as jsxs26 } from "react/jsx-runtime";
10281
10309
  function TodosMonitor({ todos }) {
10282
10310
  const size = useMonitorSize();
10283
- const [selected, setSelected] = useState15(0);
10311
+ const [selected, setSelected] = useState16(0);
10284
10312
  const done = todos.filter((t) => t.status === "completed").length;
10285
10313
  const inProgress = todos.filter((t) => t.status === "in_progress").length;
10286
10314
  const pending = todos.filter((t) => t.status === "pending").length;
@@ -10410,7 +10438,7 @@ function TodosMonitor({ todos }) {
10410
10438
  }
10411
10439
 
10412
10440
  // src/components/worktree-monitor.tsx
10413
- import { useEffect as useEffect15, useState as useState16 } from "react";
10441
+ import { useEffect as useEffect15, useState as useState17 } from "react";
10414
10442
  import { jsx as jsx27, jsxs as jsxs27 } from "react/jsx-runtime";
10415
10443
  var fmtElapsed4 = (ms) => {
10416
10444
  const s2 = Math.floor(ms / 1e3);
@@ -10442,7 +10470,7 @@ function WorktreeMonitor({
10442
10470
  onClose
10443
10471
  }) {
10444
10472
  const size = useMonitorSize();
10445
- const [selected, setSelected] = useState16(0);
10473
+ const [selected, setSelected] = useState17(0);
10446
10474
  const shortcutsEnabled = usePanelShortcutsEnabled();
10447
10475
  useInput((input, key) => {
10448
10476
  if (key.escape === true || shortcutsEnabled && isWorktreeMonitorCloseKey(input, key))
@@ -10695,7 +10723,7 @@ function renderRunningTools(running) {
10695
10723
  }
10696
10724
 
10697
10725
  // src/app-status-region.tsx
10698
- import { Fragment as Fragment10, jsx as jsx29, jsxs as jsxs29 } from "react/jsx-runtime";
10726
+ import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs29 } from "react/jsx-runtime";
10699
10727
  function AppStatusRegion({
10700
10728
  host,
10701
10729
  runtime,
@@ -10781,7 +10809,7 @@ function AppStatusRegion({
10781
10809
  const projectRoot = agent.ctx.projectRoot;
10782
10810
  const panelPositions = effectivePanelPositions(state, liveSettings);
10783
10811
  const routedToBottom = (id) => panelPositions[id] === "bottom";
10784
- return /* @__PURE__ */ jsxs29(Fragment10, { children: [
10812
+ return /* @__PURE__ */ jsxs29(Fragment11, { children: [
10785
10813
  /* @__PURE__ */ jsx29(Box, { ref: statusBarWrapRef, flexDirection: "column", flexShrink: 0, children: /* @__PURE__ */ jsx29(
10786
10814
  StatusBar,
10787
10815
  {
@@ -11943,7 +11971,7 @@ function cyclePreset(presets, current, delta) {
11943
11971
  }
11944
11972
 
11945
11973
  // src/components/brain-panel.tsx
11946
- import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs34 } from "react/jsx-runtime";
11974
+ import { Fragment as Fragment12, jsx as jsx34, jsxs as jsxs34 } from "react/jsx-runtime";
11947
11975
  var CHROME_ROWS2 = 14;
11948
11976
  var RISK_DESCS = {
11949
11977
  off: "Human decides everything",
@@ -12274,7 +12302,7 @@ function BrainPanel({
12274
12302
  ] }),
12275
12303
  /* @__PURE__ */ jsxs34(Box, { marginTop: 1, flexDirection: "column", children: [
12276
12304
  /* @__PURE__ */ jsx34(Text, { bold: true, color: "blue", children: "Recent decisions" }),
12277
- total === 0 ? /* @__PURE__ */ jsx34(Text, { dimColor: true, children: " No decisions recorded yet this session." }) : /* @__PURE__ */ jsxs34(Fragment11, { children: [
12305
+ total === 0 ? /* @__PURE__ */ jsx34(Text, { dimColor: true, children: " No decisions recorded yet this session." }) : /* @__PURE__ */ jsxs34(Fragment12, { children: [
12278
12306
  above > 0 ? /* @__PURE__ */ jsx34(Text, { dimColor: true, children: ` \u2191 ${above} more` }) : null,
12279
12307
  log.slice(windowStart, windowEnd).map((entry, i) => {
12280
12308
  const index = windowStart + i;
@@ -12935,12 +12963,20 @@ function firstNonEmpty(text) {
12935
12963
  return line ? line.replace(/\s+/g, " ").trim() : void 0;
12936
12964
  }
12937
12965
  function formatMatchHit(hit) {
12938
- if (typeof hit === "string") return truncMid(hit, 70);
12966
+ if (typeof hit === "string") {
12967
+ const m = hit.match(/^((?:[A-Za-z]:)?[^:]+):(\d+)[:\-](.*)$/);
12968
+ if (m?.[1] && m[2]) {
12969
+ const head = `${shortenPath(m[1], 40)}:${m[2]}`;
12970
+ const snippet2 = m[3]?.trim();
12971
+ return snippet2 ? `${head} ${truncMid(snippet2.replace(/\s+/g, " "), 40)}` : head;
12972
+ }
12973
+ return truncMid(hit, 70);
12974
+ }
12939
12975
  if (hit && typeof hit === "object") {
12940
12976
  const o = hit;
12941
- const file = stringOf(o["file"]) ?? stringOf(o["path"]);
12942
- const line = numOf(o["line"]) ?? numOf(o["lineNumber"]);
12943
- const snippet2 = stringOf(o["text"]) ?? stringOf(o["match"]) ?? stringOf(o["preview"]);
12977
+ const file = stringOf(o["file"]) ?? stringOf(o["path"]) ?? stringOf(o["filename"]) ?? stringOf(o["Filename"]);
12978
+ const line = numOf(o["line"]) ?? numOf(o["lineNumber"]) ?? numOf(o["line_number"]) ?? numOf(o["LineNumber"]);
12979
+ const snippet2 = stringOf(o["text"]) ?? stringOf(o["match"]) ?? stringOf(o["preview"]) ?? stringOf(o["lineContent"]) ?? stringOf(o["LineContent"]) ?? stringOf(o["line_content"]);
12944
12980
  if (file) {
12945
12981
  const head = line !== void 0 ? `${shortenPath(file, 40)}:${line}` : shortenPath(file, 50);
12946
12982
  return snippet2 ? `${head} ${truncMid(snippet2.replace(/\s+/g, " "), 40)}` : head;
@@ -12958,6 +12994,12 @@ var MAX_STREAM_LINES = 8;
12958
12994
  var WRITE_CREATE_STREAM_LINES = 3;
12959
12995
  var TOOL_STREAM_MARGIN_ROWS = 2;
12960
12996
  var TOOL_STREAM_HEADER_ROWS = 1;
12997
+ var ASSISTANT_STREAM_LINES = 6;
12998
+ var ASSISTANT_STREAM_MARGIN_ROWS = 2;
12999
+ var ASSISTANT_STREAM_HEADER_ROWS = 1;
13000
+ function assistantStreamBoxHeight() {
13001
+ return ASSISTANT_STREAM_MARGIN_ROWS + ASSISTANT_STREAM_HEADER_ROWS + ASSISTANT_STREAM_LINES;
13002
+ }
12961
13003
  function toolStreamBoxHeight(name) {
12962
13004
  const contentRows2 = name === "write" ? WRITE_CREATE_STREAM_LINES : MAX_STREAM_LINES;
12963
13005
  return TOOL_STREAM_MARGIN_ROWS + TOOL_STREAM_HEADER_ROWS + contentRows2;
@@ -13028,6 +13070,37 @@ var ToolStreamBox = React.memo(function ToolStreamBox2({
13028
13070
  }
13029
13071
  );
13030
13072
  });
13073
+ var AssistantStreamBox = React.memo(function AssistantStreamBox2({
13074
+ text,
13075
+ termWidth
13076
+ }) {
13077
+ const contentWidth = Math.max(1, Math.min(termWidth - 4, 100));
13078
+ const totalLines = text.split("\n").length;
13079
+ const hidden = Math.max(0, totalLines - ASSISTANT_STREAM_LINES);
13080
+ const rows = streamBoxRows(text, ASSISTANT_STREAM_LINES, contentWidth);
13081
+ const color = theme.assistant ?? "cyan";
13082
+ return /* @__PURE__ */ jsxs37(
13083
+ Box,
13084
+ {
13085
+ flexDirection: "column",
13086
+ marginY: 1,
13087
+ borderStyle: "single",
13088
+ borderTop: false,
13089
+ borderRight: false,
13090
+ borderBottom: false,
13091
+ borderColor: color,
13092
+ paddingLeft: 1,
13093
+ children: [
13094
+ /* @__PURE__ */ jsxs37(Box, { flexDirection: "row", children: [
13095
+ /* @__PURE__ */ jsx37(Text, { color, children: "\u2726 " }),
13096
+ /* @__PURE__ */ jsx37(Text, { bold: true, color, children: "assistant \xB7 streaming" }),
13097
+ hidden > 0 ? /* @__PURE__ */ jsx37(Text, { dimColor: true, children: ` (${totalLines} lines, showing last ${ASSISTANT_STREAM_LINES})` }) : null
13098
+ ] }),
13099
+ /* @__PURE__ */ jsx37(Box, { flexDirection: "column", marginLeft: 1, children: rows.map((r, i) => /* @__PURE__ */ jsx37(Text, { color: "white", italic: Boolean(r.italic), children: r.text || " " }, i)) })
13100
+ ]
13101
+ }
13102
+ );
13103
+ });
13031
13104
  function tailForDisplay(text, maxChars) {
13032
13105
  if (text.length <= maxChars) return text;
13033
13106
  const cut = text.length - maxChars;
@@ -13039,23 +13112,23 @@ function tailForDisplay(text, maxChars) {
13039
13112
  }
13040
13113
 
13041
13114
  // src/components/history/visual-lines.tsx
13042
- import { Fragment as Fragment12, jsx as jsx38, jsxs as jsxs38 } from "react/jsx-runtime";
13115
+ import { Fragment as Fragment13, jsx as jsx38, jsxs as jsxs38 } from "react/jsx-runtime";
13043
13116
  var VISUAL_TEXT_BUDGET = 92;
13044
13117
  function ToolOutputLines({
13045
13118
  lines,
13046
13119
  hasFollowingBlock
13047
13120
  }) {
13048
- return /* @__PURE__ */ jsx38(Fragment12, { children: lines.map((line, i) => {
13121
+ return /* @__PURE__ */ jsx38(Fragment13, { children: lines.map((line, i) => {
13049
13122
  const branch = i === lines.length - 1 && !hasFollowingBlock ? " \u2514\u2500 " : " \u251C\u2500 ";
13050
13123
  const color = colorForVisualKind(line.kind);
13051
13124
  return /* @__PURE__ */ jsxs38(Text, { children: [
13052
13125
  /* @__PURE__ */ jsx38(Text, { dimColor: true, children: branch }),
13053
13126
  line.marker ? /* @__PURE__ */ jsx38(Text, { color, bold: true, children: line.marker }) : null,
13054
- line.path ? /* @__PURE__ */ jsxs38(Fragment12, { children: [
13127
+ line.path ? /* @__PURE__ */ jsxs38(Fragment13, { children: [
13055
13128
  /* @__PURE__ */ jsx38(Text, { color: "cyan", children: shortenPath(sanitizeTerminalText(line.path), 56) }),
13056
13129
  /* @__PURE__ */ jsx38(Text, { dimColor: true, children: " " })
13057
13130
  ] }) : null,
13058
- line.lineNo ? /* @__PURE__ */ jsxs38(Fragment12, { children: [
13131
+ line.lineNo ? /* @__PURE__ */ jsxs38(Fragment13, { children: [
13059
13132
  /* @__PURE__ */ jsx38(Text, { color: "yellow", children: String(line.lineNo).padStart(4, " ") }),
13060
13133
  /* @__PURE__ */ jsx38(Text, { dimColor: true, children: " \u2502 " })
13061
13134
  ] }) : null,
@@ -13145,7 +13218,7 @@ function appendOutputPreview(rows, output, kind) {
13145
13218
  }
13146
13219
  function bodyLines(text) {
13147
13220
  const lines = text.replace(/\r/g, "").split("\n");
13148
- if (lines.length > 0 && /^[^\n]+(?:\s+\([^)]*\))?$/.test(lines[0] ?? "")) {
13221
+ if (lines.length > 1 && /^[^\s()]+\s+\([^)]*=[^)]*\)$/.test(lines[0] ?? "")) {
13149
13222
  return lines.slice(1);
13150
13223
  }
13151
13224
  return lines;
@@ -13478,6 +13551,37 @@ function visualCodebase(toolName, text, ok) {
13478
13551
  }
13479
13552
  return rows.slice(0, VISUAL_MAX_LINES2);
13480
13553
  }
13554
+ if (toolName === "codebase-incoming-calls" || toolName === "codebase-outgoing-calls") {
13555
+ const total = numOf(obj["total"]) ?? (Array.isArray(obj["calls"]) ? obj["calls"].length : 0);
13556
+ const targetSymbol = stringOf(obj["symbol"]) ?? "";
13557
+ const label = toolName === "codebase-incoming-calls" ? `${total} caller${total === 1 ? "" : "s"} for "${targetSymbol}"` : `${total} outgoing call${total === 1 ? "" : "s"} from "${targetSymbol}"`;
13558
+ const rows = [
13559
+ {
13560
+ kind: "ok",
13561
+ marker: "ok ",
13562
+ text: label
13563
+ }
13564
+ ];
13565
+ const calls = Array.isArray(obj["calls"]) ? obj["calls"] : [];
13566
+ for (const call of calls.slice(0, 5)) {
13567
+ if (call && typeof call === "object") {
13568
+ const c = call;
13569
+ const sym = c["symbol"] && typeof c["symbol"] === "object" ? c["symbol"] : void 0;
13570
+ const file = stringOf(sym?.["file"]) ?? stringOf(c["file"]);
13571
+ const line = numOf(sym?.["line"]) ?? numOf(c["line"]);
13572
+ const name = stringOf(sym?.["name"]) ?? stringOf(c["name"]);
13573
+ const sig = stringOf(sym?.["signature"]) ?? stringOf(c["signature"]);
13574
+ const callType = stringOf(c["callType"]);
13575
+ rows.push({
13576
+ kind: "match",
13577
+ path: file,
13578
+ lineNo: line?.toString(),
13579
+ text: [name, callType ? `[${callType}]` : void 0, sig].filter(Boolean).join(" \xB7 ")
13580
+ });
13581
+ }
13582
+ }
13583
+ return rows.slice(0, VISUAL_MAX_LINES2);
13584
+ }
13481
13585
  if (toolName === "codebase-index") {
13482
13586
  const errors = Array.isArray(obj["errors"]) ? obj["errors"] : [];
13483
13587
  return [
@@ -13551,7 +13655,7 @@ function visualLsp(toolName, text, ok) {
13551
13655
  });
13552
13656
  continue;
13553
13657
  }
13554
- const location = line.match(/^(.+):(\d+):(\d+)$/);
13658
+ const location = line.match(/^((?:[A-Za-z]:)?[^:]+):(\d+):(\d+)$/);
13555
13659
  if (location?.[1]) {
13556
13660
  push({ kind: "path", path: location[1], lineNo: location[2], text: `column ${location[3]}` });
13557
13661
  continue;
@@ -13963,13 +14067,17 @@ function formatToolArgs(toolName, input) {
13963
14067
  const obj = input;
13964
14068
  switch (toolName) {
13965
14069
  case "read":
14070
+ case "view_file":
13966
14071
  case "write":
14072
+ case "write_to_file":
13967
14073
  case "edit":
14074
+ case "replace_file_content":
13968
14075
  case "patch":
13969
14076
  case "list_dir":
14077
+ case "list_directory":
13970
14078
  case "ls":
13971
14079
  case "tree": {
13972
- const p = stringOf(obj["path"]) ?? stringOf(obj["file"]);
14080
+ const p = stringOf(obj["path"]) ?? stringOf(obj["file"]) ?? stringOf(obj["AbsolutePath"]) ?? stringOf(obj["TargetFile"]) ?? stringOf(obj["DirectoryPath"]);
13973
14081
  return p ? shortenPath(p, ARG_BUDGET) : "";
13974
14082
  }
13975
14083
  case "document": {
@@ -13979,23 +14087,30 @@ function formatToolArgs(toolName, input) {
13979
14087
  return [target, scope, style].filter(Boolean).join(" \xB7 ");
13980
14088
  }
13981
14089
  case "grep":
14090
+ case "grep_search":
13982
14091
  case "search":
13983
14092
  case "replace": {
13984
- const pat = stringOf(obj["pattern"]) ?? stringOf(obj["query"]);
13985
- const scope = stringOf(obj["path"]) ?? stringOf(obj["glob"]);
14093
+ const pat = stringOf(obj["pattern"]) ?? stringOf(obj["query"]) ?? stringOf(obj["Query"]);
14094
+ const scope = stringOf(obj["path"]) ?? stringOf(obj["glob"]) ?? stringOf(obj["SearchPath"]) ?? stringOf(obj["search_path"]);
13986
14095
  const head = pat ? `"${truncMid(pat, 36)}"` : "";
13987
14096
  const tail = scope ? ` in ${shortenPath(scope, 28)}` : "";
13988
14097
  return `${head}${tail}` || (stringOf(obj["command"]) ?? "");
13989
14098
  }
13990
- case "glob": {
13991
- const pat = stringOf(obj["pattern"]) ?? stringOf(obj["glob"]);
13992
- return pat ? `"${truncMid(pat, ARG_BUDGET - 2)}"` : "";
14099
+ case "glob":
14100
+ case "find_by_name":
14101
+ case "find_files": {
14102
+ const pat = stringOf(obj["pattern"]) ?? stringOf(obj["glob"]) ?? stringOf(obj["Pattern"]);
14103
+ const dir = stringOf(obj["SearchDirectory"]) ?? stringOf(obj["path"]);
14104
+ const head = pat ? `"${truncMid(pat, ARG_BUDGET - (dir ? 22 : 2))}"` : "";
14105
+ const tail = dir ? ` in ${shortenPath(dir, 18)}` : "";
14106
+ return `${head}${tail}`;
13993
14107
  }
13994
14108
  case "bash":
13995
14109
  case "shell":
14110
+ case "run_command":
13996
14111
  case "install":
13997
14112
  case "git": {
13998
- const cmd = stringOf(obj["command"]) ?? stringOf(obj["args"]);
14113
+ const cmd = stringOf(obj["command"]) ?? stringOf(obj["args"]) ?? stringOf(obj["CommandLine"]);
13999
14114
  return cmd ? truncMid(cmd, ARG_BUDGET) : "";
14000
14115
  }
14001
14116
  case "exec": {
@@ -14018,10 +14133,16 @@ function formatToolArgs(toolName, input) {
14018
14133
  }
14019
14134
  case "fetch":
14020
14135
  case "webfetch":
14021
- case "web_fetch": {
14022
- const u = stringOf(obj["url"]);
14136
+ case "web_fetch":
14137
+ case "read_url_content": {
14138
+ const u = stringOf(obj["url"]) ?? stringOf(obj["Url"]);
14023
14139
  return u ? truncMid(u, ARG_BUDGET) : "";
14024
14140
  }
14141
+ case "search_web":
14142
+ case "web_search": {
14143
+ const q = stringOf(obj["query"]) ?? stringOf(obj["q"]);
14144
+ return q ? `"${truncMid(q, ARG_BUDGET - 2)}"` : "";
14145
+ }
14025
14146
  case "todo": {
14026
14147
  const list = obj["todos"];
14027
14148
  if (Array.isArray(list)) return `${list.length} item${list.length === 1 ? "" : "s"}`;
@@ -14556,20 +14677,23 @@ function formatToolVisualOutput(toolName, output, ok, input) {
14556
14677
  if (!output) return void 0;
14557
14678
  const text = output.trim();
14558
14679
  if (!text) return void 0;
14559
- if (toolName === "read") return visualRead(text);
14560
- if (toolName === "grep" || toolName === "search") return visualSearch(toolName, text);
14561
- if (toolName === "glob") return visualPathList(toolName, text);
14680
+ if (toolName === "read" || toolName === "view_file") return visualRead(text);
14681
+ if (toolName === "grep" || toolName === "search" || toolName === "grep_search")
14682
+ return visualSearch(toolName, text);
14683
+ if (toolName === "glob" || toolName === "find" || toolName === "find_by_name" || toolName === "find_files" || toolName === "list_dir" || toolName === "dir_list" || toolName === "list_directory") {
14684
+ return visualPathList(toolName, text);
14685
+ }
14562
14686
  if (toolName === "tree") return visualTree(text);
14563
- if (toolName === "edit" || toolName === "write" || toolName === "diff" || toolName === "patch" || toolName === "replace") {
14687
+ if (toolName === "edit" || toolName === "replace_file_content" || toolName === "write" || toolName === "write_to_file" || toolName === "diff" || toolName === "patch" || toolName === "replace") {
14564
14688
  return visualEdit(toolName, text, ok);
14565
14689
  }
14566
- if (toolName === "bash" || toolName === "shell" || toolName === "git" || toolName === "exec" || toolName === "install") {
14690
+ if (toolName === "bash" || toolName === "shell" || toolName === "run_command" || toolName === "git" || toolName === "exec" || toolName === "install") {
14567
14691
  return visualCommand(toolName, text, ok);
14568
14692
  }
14569
14693
  if (toolName === "test" || toolName === "lint" || toolName === "typecheck" || toolName === "format") {
14570
14694
  return visualVerifier(toolName, text, ok);
14571
14695
  }
14572
- if (toolName === "fetch" || toolName === "webfetch" || toolName === "web_fetch") {
14696
+ if (toolName === "fetch" || toolName === "webfetch" || toolName === "web_fetch" || toolName === "read_url_content") {
14573
14697
  return visualFetch(text);
14574
14698
  }
14575
14699
  if (toolName === "json") return visualJson(text);
@@ -14587,7 +14711,7 @@ function formatToolVisualOutput(toolName, output, ok, input) {
14587
14711
  return visualToolCatalog(toolName, text);
14588
14712
  if (toolName === "tool_use" || toolName === "batch_tool_use")
14589
14713
  return visualMetaExecution(toolName, text, ok);
14590
- if (toolName === "codebase-index" || toolName === "codebase-search" || toolName === "codebase-stats") {
14714
+ if (toolName === "codebase-index" || toolName === "codebase-search" || toolName === "codebase-stats" || toolName === "codebase-incoming-calls" || toolName === "codebase-outgoing-calls") {
14591
14715
  return visualCodebase(toolName, text, ok);
14592
14716
  }
14593
14717
  if (toolName.startsWith("lsp_") || toolName === "codebase-lsp-search") {
@@ -14695,8 +14819,8 @@ function visualSearch(toolName, text) {
14695
14819
  consumed++;
14696
14820
  continue;
14697
14821
  }
14698
- const direct = line.match(/^(.+?):(\d+):(.*)$/);
14699
- const grouped = line.match(/^(\d+):(.*)$/);
14822
+ const direct = line.match(/^((?:[A-Za-z]:)?[^:]+):(\d+)[:\-](.*)$/);
14823
+ const grouped = line.match(/^(\d+)[:\-](.*)$/);
14700
14824
  if (direct?.[1] && direct[2]) {
14701
14825
  rows.push({ kind: "match", path: direct[1], lineNo: direct[2], text: direct[3] ?? "" });
14702
14826
  consumed++;
@@ -14727,25 +14851,32 @@ function visualSearchMatches(matches, count) {
14727
14851
  }
14728
14852
  function parseMatchHit(hit) {
14729
14853
  if (typeof hit === "string") {
14730
- const m = hit.match(/^(.+?):(\d+):(.*)$/);
14854
+ const m = hit.match(/^((?:[A-Za-z]:)?[^:]+):(\d+)[:\-](.*)$/);
14731
14855
  return m?.[1] && m[2] ? { path: m[1], line: m[2], text: m[3] ?? "" } : { text: hit };
14732
14856
  }
14733
14857
  if (hit && typeof hit === "object") {
14734
14858
  const o = hit;
14735
- const path12 = stringOf(o["file"]) ?? stringOf(o["path"]) ?? stringOf(o["url"]);
14736
- const line = numOf(o["line"]) ?? numOf(o["lineNumber"]);
14859
+ const path12 = stringOf(o["file"]) ?? stringOf(o["path"]) ?? stringOf(o["url"]) ?? stringOf(o["filename"]) ?? stringOf(o["Filename"]);
14860
+ const lineNum = numOf(o["line"]) ?? numOf(o["lineNumber"]) ?? numOf(o["line_number"]) ?? numOf(o["LineNumber"]);
14861
+ const line = lineNum === void 0 ? void 0 : String(lineNum);
14737
14862
  const title = stringOf(o["title"]);
14738
- const snippet2 = stringOf(o["snippet"]);
14739
- const text = stringOf(o["text"]) ?? stringOf(o["match"]) ?? stringOf(o["preview"]) ?? [title, snippet2].filter(Boolean).join(" \u2014 ");
14740
- return { path: path12, line: line === void 0 ? void 0 : String(line), text };
14863
+ const snippet2 = stringOf(o["snippet"]) ?? stringOf(o["lineContent"]) ?? stringOf(o["LineContent"]) ?? stringOf(o["line_content"]);
14864
+ const text = stringOf(o["text"]) ?? stringOf(o["match"]) ?? stringOf(o["preview"]) ?? snippet2 ?? title ?? [title, snippet2].filter(Boolean).join(" \u2014 ");
14865
+ return { path: path12, line, text };
14741
14866
  }
14742
14867
  return void 0;
14743
14868
  }
14744
14869
  function visualPathList(toolName, text) {
14745
14870
  const json = tryParseJson(text);
14746
- const files = json && typeof json === "object" && Array.isArray(json["files"]) ? json["files"].filter(
14747
- (v) => typeof v === "string"
14748
- ) : bodyLines(text).filter((line) => line.trim() && !line.startsWith(`${toolName}:`));
14871
+ const rawList = json && typeof json === "object" ? Array.isArray(json["files"]) ? json["files"] : Array.isArray(json["paths"]) ? json["paths"] : Array.isArray(json["matches"]) ? json["matches"] : Array.isArray(json["entries"]) ? json["entries"] : Array.isArray(json) ? json : void 0 : void 0;
14872
+ const files = rawList ? rawList.map((v) => {
14873
+ if (typeof v === "string") return v;
14874
+ if (v && typeof v === "object") {
14875
+ const o = v;
14876
+ return stringOf(o["path"]) ?? stringOf(o["relativePath"]) ?? stringOf(o["name"]) ?? stringOf(o["file"]);
14877
+ }
14878
+ return void 0;
14879
+ }).filter((v) => typeof v === "string") : bodyLines(text).filter((line) => line.trim() && !line.startsWith(`${toolName}:`));
14749
14880
  if (files.length === 0) return void 0;
14750
14881
  const rows = files.slice(0, VISUAL_MAX_LINES6).map(
14751
14882
  (file) => ({
@@ -14759,6 +14890,20 @@ function visualPathList(toolName, text) {
14759
14890
  return rows;
14760
14891
  }
14761
14892
  function visualTree(text) {
14893
+ const json = tryParseJson(text);
14894
+ if (json && typeof json === "object") {
14895
+ const obj = json;
14896
+ const files = numOf(obj["total_files"]) ?? numOf(obj["files"]);
14897
+ const dirs = numOf(obj["total_dirs"]) ?? numOf(obj["dirs"]);
14898
+ if (files !== void 0 || dirs !== void 0) {
14899
+ const parts = [
14900
+ files !== void 0 ? `${files} file${files === 1 ? "" : "s"}` : void 0,
14901
+ dirs !== void 0 ? `${dirs} dir${dirs === 1 ? "" : "s"}` : void 0,
14902
+ obj["truncated"] === true ? "truncated" : void 0
14903
+ ].filter(Boolean);
14904
+ return [{ kind: "meta", text: parts.join(" \xB7 ") }];
14905
+ }
14906
+ }
14762
14907
  const lines = bodyLines(text).filter((line) => line.trim());
14763
14908
  if (lines.length === 0) return void 0;
14764
14909
  const rows = lines.slice(0, VISUAL_MAX_LINES6).map(
@@ -15019,7 +15164,7 @@ function extractPatchHeaderPath(diffText) {
15019
15164
  }
15020
15165
 
15021
15166
  // src/components/history/code-block.tsx
15022
- import { Fragment as Fragment13, jsx as jsx39, jsxs as jsxs39 } from "react/jsx-runtime";
15167
+ import { Fragment as Fragment14, jsx as jsx39, jsxs as jsxs39 } from "react/jsx-runtime";
15023
15168
  var MAX_CODE_LINES = 80;
15024
15169
  var DIFF_MAX_LINES = 200;
15025
15170
  var MULTI_DIFF_MAX_FILES = 20;
@@ -15149,7 +15294,10 @@ function DiffFileBlock({
15149
15294
  contentWidth
15150
15295
  }) {
15151
15296
  return /* @__PURE__ */ jsxs39(Box, { flexDirection: "column", marginTop: 1, children: [
15152
- /* @__PURE__ */ jsx39(Text, { dimColor: true, italic: true, children: path12 }),
15297
+ /* @__PURE__ */ jsxs39(Box, { flexDirection: "row", marginBottom: 0, children: [
15298
+ /* @__PURE__ */ jsx39(Text, { bold: true, color: theme.accent, children: `\u{1F4C4} ${path12}` }),
15299
+ preview.added > 0 || preview.removed > 0 ? /* @__PURE__ */ jsx39(Text, { dimColor: true, children: ` (${preview.added > 0 ? `+${preview.added}` : ""}${preview.added > 0 && preview.removed > 0 ? " " : ""}${preview.removed > 0 ? `-${preview.removed}` : ""})` }) : null
15300
+ ] }),
15153
15301
  /* @__PURE__ */ jsx39(
15154
15302
  DiffBlock,
15155
15303
  {
@@ -15161,6 +15309,7 @@ function DiffFileBlock({
15161
15309
  hiddenRemoved: preview.hiddenRemoved,
15162
15310
  useColor,
15163
15311
  lang: langFromPath(path12),
15312
+ showStats: false,
15164
15313
  contentWidth
15165
15314
  }
15166
15315
  )
@@ -15300,7 +15449,7 @@ function DiffBlock({
15300
15449
  return /* @__PURE__ */ jsx39(Box, { flexDirection: "column", children: segments.map((seg, si) => {
15301
15450
  const pad = padBody(seg);
15302
15451
  return /* @__PURE__ */ jsxs39(Text, { backgroundColor: bg, children: [
15303
- si === 0 ? /* @__PURE__ */ jsxs39(Fragment13, { children: [
15452
+ si === 0 ? /* @__PURE__ */ jsxs39(Fragment14, { children: [
15304
15453
  /* @__PURE__ */ jsx39(Text, { dimColor: true, children: ` ${ln} ` }),
15305
15454
  /* @__PURE__ */ jsx39(Text, { color: markerColor, bold: true, children: marker }),
15306
15455
  /* @__PURE__ */ jsx39(Text, { children: " " })
@@ -15311,7 +15460,7 @@ function DiffBlock({
15311
15460
  }) }, key);
15312
15461
  }
15313
15462
  return /* @__PURE__ */ jsx39(Box, { flexDirection: "column", children: segments.map((seg, si) => /* @__PURE__ */ jsxs39(Text, { children: [
15314
- si === 0 ? /* @__PURE__ */ jsxs39(Fragment13, { children: [
15463
+ si === 0 ? /* @__PURE__ */ jsxs39(Fragment14, { children: [
15315
15464
  /* @__PURE__ */ jsx39(Text, { dimColor: true, children: ` ${ln} ` }),
15316
15465
  /* @__PURE__ */ jsx39(Text, { color: markerColor, bold: true, children: marker }),
15317
15466
  /* @__PURE__ */ jsx39(Text, { children: " " })
@@ -15520,7 +15669,7 @@ function ConfirmPrompt({
15520
15669
 
15521
15670
  // src/components/connections-panel.tsx
15522
15671
  init_connections_health();
15523
- import { useCallback as useCallback4, useEffect as useEffect16, useRef as useRef3, useState as useState17 } from "react";
15672
+ import { useCallback as useCallback4, useEffect as useEffect16, useRef as useRef3, useState as useState18 } from "react";
15524
15673
  import { jsx as jsx41, jsxs as jsxs41 } from "react/jsx-runtime";
15525
15674
  var REFRESH_MS = 8e3;
15526
15675
  var STATUS_GLYPH = {
@@ -15590,9 +15739,9 @@ function ConnectionsPanel({
15590
15739
  projectRoot,
15591
15740
  onClose
15592
15741
  }) {
15593
- const [report, setReport] = useState17(null);
15594
- const [loading, setLoading] = useState17(true);
15595
- const [error, setError] = useState17(null);
15742
+ const [report, setReport] = useState18(null);
15743
+ const [loading, setLoading] = useState18(true);
15744
+ const [error, setError] = useState18(null);
15596
15745
  const cancelledRef = useRef3(false);
15597
15746
  const fetch2 = useCallback4(async () => {
15598
15747
  try {
@@ -15729,7 +15878,7 @@ function ContinueConfirmPanel({
15729
15878
  }
15730
15879
 
15731
15880
  // src/components/coordinator-panel.tsx
15732
- import { useEffect as useEffect17, useState as useState18 } from "react";
15881
+ import { useEffect as useEffect17, useState as useState19 } from "react";
15733
15882
  import { jsx as jsx43, jsxs as jsxs43 } from "react/jsx-runtime";
15734
15883
  var KIND_COLOR = {
15735
15884
  goal: theme.accent,
@@ -15763,7 +15912,7 @@ function CoordinatorPanel({
15763
15912
  onClose
15764
15913
  }) {
15765
15914
  const size = useMonitorSize();
15766
- const [selectedGoal, setSelectedGoal] = useState18(0);
15915
+ const [selectedGoal, setSelectedGoal] = useState19(0);
15767
15916
  const { goals, timeline, knowledgeCount, healthy } = coordinator;
15768
15917
  useEffect17(() => {
15769
15918
  setSelectedGoal((value) => Math.min(value, Math.max(0, goals.length - 1)));
@@ -15926,7 +16075,7 @@ function CoordinatorPanel({
15926
16075
  }
15927
16076
 
15928
16077
  // src/components/design-picker.tsx
15929
- import { Fragment as Fragment14, jsx as jsx44, jsxs as jsxs44 } from "react/jsx-runtime";
16078
+ import { Fragment as Fragment15, jsx as jsx44, jsxs as jsxs44 } from "react/jsx-runtime";
15930
16079
  function DesignPicker({ kits, selected, stack }) {
15931
16080
  const { start, end, hasAbove, hasBelow } = useWindowedPicker({
15932
16081
  total: kits.length,
@@ -15945,7 +16094,7 @@ function DesignPicker({ kits, selected, stack }) {
15945
16094
  stack,
15946
16095
  " \xB7 Enter apply \xB7 Esc cancel"
15947
16096
  ] }),
15948
- kits.length === 0 ? /* @__PURE__ */ jsx44(Text, { dimColor: true, children: "No design kits installed." }) : /* @__PURE__ */ jsxs44(Fragment14, { children: [
16097
+ kits.length === 0 ? /* @__PURE__ */ jsx44(Text, { dimColor: true, children: "No design kits installed." }) : /* @__PURE__ */ jsxs44(Fragment15, { children: [
15949
16098
  hasAbove ? /* @__PURE__ */ jsxs44(Text, { dimColor: true, children: [
15950
16099
  " \u2026 ",
15951
16100
  start,
@@ -15970,7 +16119,7 @@ function DesignPicker({ kits, selected, stack }) {
15970
16119
 
15971
16120
  // src/components/enhance-panel.tsx
15972
16121
  import { useEffect as useEffect18, useRef as useRef4 } from "react";
15973
- import { Fragment as Fragment15, jsx as jsx45, jsxs as jsxs45 } from "react/jsx-runtime";
16122
+ import { Fragment as Fragment16, jsx as jsx45, jsxs as jsxs45 } from "react/jsx-runtime";
15974
16123
  function normalizePreviewText(text) {
15975
16124
  return text.replace(/\s+/g, " ").trim();
15976
16125
  }
@@ -16271,7 +16420,7 @@ function EnhancePanel({
16271
16420
  /* @__PURE__ */ jsx45(KeyHint, { keyName: "R", label: "retry", color: theme.brand }),
16272
16421
  /* @__PURE__ */ jsx45(KeyHint, { keyName: "T", label: "edit", color: theme.warn }),
16273
16422
  /* @__PURE__ */ jsx45(KeyHint, { keyName: "Esc", label: "cancel", color: theme.error })
16274
- ] }) : /* @__PURE__ */ jsxs45(Fragment15, { children: [
16423
+ ] }) : /* @__PURE__ */ jsxs45(Fragment16, { children: [
16275
16424
  /* @__PURE__ */ jsxs45(Box, { height: 1, gap: 2, children: [
16276
16425
  /* @__PURE__ */ jsx45(
16277
16426
  KeyHint,
@@ -16385,7 +16534,7 @@ function ExitConfirmPanel({
16385
16534
  }
16386
16535
 
16387
16536
  // src/components/f-key-picker.tsx
16388
- import { Fragment as Fragment16, jsx as jsx48, jsxs as jsxs48 } from "react/jsx-runtime";
16537
+ import { Fragment as Fragment17, jsx as jsx48, jsxs as jsxs48 } from "react/jsx-runtime";
16389
16538
  function FKeyPicker({ selected }) {
16390
16539
  const size = useMonitorSize();
16391
16540
  const safeSelected = Math.min(Math.max(0, selected), F_KEY_PANEL_ENTRIES.length - 1);
@@ -16430,7 +16579,7 @@ function FKeyPicker({ selected }) {
16430
16579
  Math.max(14, size.columns >= 92 ? 34 : size.contentWidth - 12)
16431
16580
  )
16432
16581
  ] }),
16433
- size.columns >= 92 ? /* @__PURE__ */ jsxs48(Fragment16, { children: [
16582
+ size.columns >= 92 ? /* @__PURE__ */ jsxs48(Fragment17, { children: [
16434
16583
  /* @__PURE__ */ jsx48(Box, { flexGrow: 1 }),
16435
16584
  /* @__PURE__ */ jsx48(Text, { color: theme.textMuted, children: truncatePanelText(entry.helpDescription, 42) })
16436
16585
  ] }) : null
@@ -16447,7 +16596,7 @@ function FKeyPicker({ selected }) {
16447
16596
  }
16448
16597
 
16449
16598
  // src/components/fallback-overlay.tsx
16450
- import { useEffect as useEffect19, useRef as useRef5, useState as useState19 } from "react";
16599
+ import { useEffect as useEffect19, useRef as useRef5, useState as useState20 } from "react";
16451
16600
  import { jsx as jsx49, jsxs as jsxs49 } from "react/jsx-runtime";
16452
16601
  function FallbackOverlay({
16453
16602
  from,
@@ -16458,7 +16607,7 @@ function FallbackOverlay({
16458
16607
  onChoose,
16459
16608
  onMove
16460
16609
  }) {
16461
- const [remaining, setRemaining] = useState19(Math.max(1, autoSwitchSeconds));
16610
+ const [remaining, setRemaining] = useState20(Math.max(1, autoSwitchSeconds));
16462
16611
  const resolvedRef = useRef5(false);
16463
16612
  const selectedRef = useRef5(selected);
16464
16613
  selectedRef.current = selected;
@@ -16574,7 +16723,7 @@ function highlight(path12, _query) {
16574
16723
  }
16575
16724
 
16576
16725
  // src/components/help-panel.tsx
16577
- import { Fragment as Fragment17, jsx as jsx51, jsxs as jsxs51 } from "react/jsx-runtime";
16726
+ import { Fragment as Fragment18, jsx as jsx51, jsxs as jsxs51 } from "react/jsx-runtime";
16578
16727
  var CATEGORY_ORDER = ["Run", "Session", "Inspect", "Agent", "Config", "App"];
16579
16728
  var CHROME_ROWS3 = 7;
16580
16729
  function normalizeQuery(raw) {
@@ -16654,7 +16803,7 @@ function HelpPanel({
16654
16803
  'No commands match "',
16655
16804
  filter,
16656
16805
  '".'
16657
- ] }) : /* @__PURE__ */ jsxs51(Fragment17, { children: [
16806
+ ] }) : /* @__PURE__ */ jsxs51(Fragment18, { children: [
16658
16807
  hiddenAbove > 0 && !hasFilter ? /* @__PURE__ */ jsx51(Text, { dimColor: true, children: ` \u2191 ${hiddenAbove} more` }) : null,
16659
16808
  contextHeader && !hasFilter ? /* @__PURE__ */ jsxs51(Text, { bold: true, color: "yellow", dimColor: true, children: [
16660
16809
  " ",
@@ -16706,7 +16855,7 @@ function HelpPanel({
16706
16855
  }
16707
16856
 
16708
16857
  // src/components/mcp-picker.tsx
16709
- import { Fragment as Fragment18, jsx as jsx52, jsxs as jsxs52 } from "react/jsx-runtime";
16858
+ import { Fragment as Fragment19, jsx as jsx52, jsxs as jsxs52 } from "react/jsx-runtime";
16710
16859
  var CHROME_ROWS4 = 17;
16711
16860
  function statusBadge(status, enabled) {
16712
16861
  if (!enabled) return /* @__PURE__ */ jsx52(Text, { dimColor: true, children: "\u25CB disabled" });
@@ -16742,7 +16891,7 @@ function McpPicker({
16742
16891
  return /* @__PURE__ */ jsxs52(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
16743
16892
  /* @__PURE__ */ jsx52(Text, { bold: true, color: "cyan", children: "MCP Servers" }),
16744
16893
  /* @__PURE__ */ jsx52(Text, { dimColor: true, children: "\u2191/\u2193 select \xB7 Enter/\u2190/\u2192 toggle enable \xB7 r restart \xB7 Esc close" }),
16745
- /* @__PURE__ */ jsx52(Box, { marginTop: 1, flexDirection: "column", children: items.length === 0 ? /* @__PURE__ */ jsx52(Text, { dimColor: true, children: busy ? "Loading servers\u2026" : "No MCP servers configured." }) : /* @__PURE__ */ jsxs52(Fragment18, { children: [
16894
+ /* @__PURE__ */ jsx52(Box, { marginTop: 1, flexDirection: "column", children: items.length === 0 ? /* @__PURE__ */ jsx52(Text, { dimColor: true, children: busy ? "Loading servers\u2026" : "No MCP servers configured." }) : /* @__PURE__ */ jsxs52(Fragment19, { children: [
16746
16895
  above > 0 ? /* @__PURE__ */ jsx52(Text, { dimColor: true, children: ` \u2191 ${above} more` }) : null,
16747
16896
  items.slice(windowStart, windowEnd).map((item, i) => {
16748
16897
  const index = windowStart + i;
@@ -17112,7 +17261,7 @@ function formatCost(value) {
17112
17261
  }
17113
17262
 
17114
17263
  // src/components/plugin-picker.tsx
17115
- import { Fragment as Fragment19, jsx as jsx55, jsxs as jsxs55 } from "react/jsx-runtime";
17264
+ import { Fragment as Fragment20, jsx as jsx55, jsxs as jsxs55 } from "react/jsx-runtime";
17116
17265
  var CHROME_ROWS5 = 17;
17117
17266
  var MAX_PICKER_ITEMS = 15;
17118
17267
  function PluginPicker({
@@ -17137,7 +17286,7 @@ function PluginPicker({
17137
17286
  hasLockedRows ? " \xB7 \u{1F512} = locked" : "",
17138
17287
  " \xB7 Esc close"
17139
17288
  ] }),
17140
- /* @__PURE__ */ jsx55(Box, { marginTop: 1, flexDirection: "column", children: items.length === 0 ? /* @__PURE__ */ jsx55(Text, { dimColor: true, children: busy ? "Loading plugins\u2026" : "No plugins available." }) : /* @__PURE__ */ jsxs55(Fragment19, { children: [
17289
+ /* @__PURE__ */ jsx55(Box, { marginTop: 1, flexDirection: "column", children: items.length === 0 ? /* @__PURE__ */ jsx55(Text, { dimColor: true, children: busy ? "Loading plugins\u2026" : "No plugins available." }) : /* @__PURE__ */ jsxs55(Fragment20, { children: [
17141
17290
  above > 0 ? /* @__PURE__ */ jsx55(Text, { dimColor: true, children: ` \u2191 ${above} more` }) : null,
17142
17291
  items.slice(windowStart, windowEnd).map((item, i) => {
17143
17292
  const index = windowStart + i;
@@ -17422,7 +17571,7 @@ function PromptPicker({
17422
17571
  }
17423
17572
 
17424
17573
  // src/components/refine-countdown-panel.tsx
17425
- import { useEffect as useEffect20, useRef as useRef6, useState as useState20 } from "react";
17574
+ import { useEffect as useEffect20, useRef as useRef6, useState as useState21 } from "react";
17426
17575
  import { jsx as jsx58, jsxs as jsxs58 } from "react/jsx-runtime";
17427
17576
  function RefineCountdownPanel({
17428
17577
  original,
@@ -17431,7 +17580,7 @@ function RefineCountdownPanel({
17431
17580
  providerId,
17432
17581
  model
17433
17582
  }) {
17434
- const [remaining, setRemaining] = useState20(Math.max(1, seconds));
17583
+ const [remaining, setRemaining] = useState21(Math.max(1, seconds));
17435
17584
  const resolvedRef = useRef6(false);
17436
17585
  const onDecisionRef = useRef6(onDecision);
17437
17586
  useEffect20(() => {
@@ -17510,7 +17659,7 @@ function RefineCountdownPanel({
17510
17659
  }
17511
17660
 
17512
17661
  // src/components/refine-failure-panel.tsx
17513
- import { useState as useState21, useMemo as useMemo6 } from "react";
17662
+ import { useState as useState22, useMemo as useMemo6 } from "react";
17514
17663
  import { jsx as jsx59, jsxs as jsxs59 } from "react/jsx-runtime";
17515
17664
  function filterRefineModels(models, query) {
17516
17665
  const normalized = query.trim().toLowerCase();
@@ -17532,9 +17681,9 @@ function RefineFailurePanel({
17532
17681
  onDecision
17533
17682
  }) {
17534
17683
  const columns = useColumns();
17535
- const [view, setView] = useState21("options");
17536
- const [cursor, setCursor] = useState21(0);
17537
- const [query, setQuery] = useState21("");
17684
+ const [view, setView] = useState22("options");
17685
+ const [cursor, setCursor] = useState22(0);
17686
+ const [query, setQuery] = useState22("");
17538
17687
  const filteredModels = useMemo6(() => filterRefineModels(models, query), [models, query]);
17539
17688
  const width = Math.max(30, columns - 4);
17540
17689
  const canPick = models.length > 0;
@@ -17739,7 +17888,7 @@ function RefineFailurePanel({
17739
17888
  }
17740
17889
 
17741
17890
  // src/components/resource-menu.tsx
17742
- import { Fragment as Fragment20, jsx as jsx60, jsxs as jsxs60 } from "react/jsx-runtime";
17891
+ import { Fragment as Fragment21, jsx as jsx60, jsxs as jsxs60 } from "react/jsx-runtime";
17743
17892
  function ResourceMenu({
17744
17893
  snapshot,
17745
17894
  selected,
@@ -17862,11 +18011,11 @@ function ResourceDetail({
17862
18011
  ] }),
17863
18012
  detail.value
17864
18013
  ] }, `${detail.label}:${detail.value}`)),
17865
- item.body ? /* @__PURE__ */ jsxs60(Fragment20, { children: [
18014
+ item.body ? /* @__PURE__ */ jsxs60(Fragment21, { children: [
17866
18015
  /* @__PURE__ */ jsx60(Text, { children: " " }),
17867
18016
  /* @__PURE__ */ jsx60(Text, { wrap: "wrap", children: truncate2(item.body, bodyLimit) })
17868
18017
  ] }) : null,
17869
- item.actions && item.actions.length > 0 ? /* @__PURE__ */ jsxs60(Fragment20, { children: [
18018
+ item.actions && item.actions.length > 0 ? /* @__PURE__ */ jsxs60(Fragment21, { children: [
17870
18019
  /* @__PURE__ */ jsx60(Text, { children: " " }),
17871
18020
  /* @__PURE__ */ jsx60(Text, { color: theme.textMuted, wrap: "wrap", children: item.actions.map((action) => `${action.key} ${action.label}`).join(" \xB7 ") })
17872
18021
  ] }) : null
@@ -17892,7 +18041,7 @@ function truncate2(value, max) {
17892
18041
  }
17893
18042
 
17894
18043
  // src/components/resume-picker.tsx
17895
- import { Fragment as Fragment21, jsx as jsx61, jsxs as jsxs61 } from "react/jsx-runtime";
18044
+ import { Fragment as Fragment22, jsx as jsx61, jsxs as jsxs61 } from "react/jsx-runtime";
17896
18045
  function ResumePicker({
17897
18046
  sessions,
17898
18047
  selected,
@@ -17917,7 +18066,7 @@ function ResumePicker({
17917
18066
  `${sessions.length > 0 ? `${selected + 1}/${sessions.length} \xB7 ` : ""}\u2191/\u2193 navigate \xB7 Enter select \xB7 Esc cancel`
17918
18067
  ) }),
17919
18068
  error ? /* @__PURE__ */ jsx61(Text, { color: "red", children: error }) : null,
17920
- sessions.length === 0 && !busy ? /* @__PURE__ */ jsx61(Text, { dimColor: true, children: "No sessions found." }) : /* @__PURE__ */ jsxs61(Fragment21, { children: [
18069
+ sessions.length === 0 && !busy ? /* @__PURE__ */ jsx61(Text, { dimColor: true, children: "No sessions found." }) : /* @__PURE__ */ jsxs61(Fragment22, { children: [
17921
18070
  hasAbove ? /* @__PURE__ */ jsxs61(Text, { dimColor: true, children: [
17922
18071
  " \u2026 ",
17923
18072
  start,
@@ -19024,14 +19173,14 @@ function buildResetPatch(field) {
19024
19173
  }
19025
19174
 
19026
19175
  // src/components/settings-picker-row-list.tsx
19027
- import { Fragment as Fragment22, jsx as jsx63, jsxs as jsxs63 } from "react/jsx-runtime";
19176
+ import { Fragment as Fragment23, jsx as jsx63, jsxs as jsxs63 } from "react/jsx-runtime";
19028
19177
  function renderPickerRow(row, fieldIdx, selected, filterActive, highlightSegments) {
19029
19178
  const labelStr = row.label ?? "";
19030
19179
  const segments = highlightSegments(labelStr);
19031
19180
  const padNeeded = Math.max(0, 26 - labelStr.length);
19032
19181
  return /* @__PURE__ */ jsxs63(Text, { inverse: selected, ...selected ? { color: "yellow" } : {}, children: [
19033
19182
  selected ? "\u203A " : " ",
19034
- filterActive ? /* @__PURE__ */ jsxs63(Fragment22, { children: [
19183
+ filterActive ? /* @__PURE__ */ jsxs63(Fragment23, { children: [
19035
19184
  segments.map((seg, j) => /* @__PURE__ */ jsx63(Text, { bold: true, ...seg.match ? { color: "yellow" } : { dimColor: true }, children: seg.text }, j)),
19036
19185
  /* @__PURE__ */ jsx63(Text, { bold: true, dimColor: true, children: " ".repeat(padNeeded) })
19037
19186
  ] }) : /* @__PURE__ */ jsx63(Text, { bold: true, children: labelStr.padEnd(26) }),
@@ -19075,7 +19224,7 @@ function SettingsPickerRowList({
19075
19224
  filterWindowEnd
19076
19225
  }) {
19077
19226
  if (filterActive) {
19078
- return /* @__PURE__ */ jsx63(Fragment22, { children: rankedResults.slice(filterWindowStart, filterWindowEnd).map((result) => {
19227
+ return /* @__PURE__ */ jsx63(Fragment23, { children: rankedResults.slice(filterWindowStart, filterWindowEnd).map((result) => {
19079
19228
  const fieldIdx = result.chord.field;
19080
19229
  const rowIdx = fieldRowIndex[fieldIdx] ?? -1;
19081
19230
  const row = rows[rowIdx];
@@ -19084,7 +19233,7 @@ function SettingsPickerRowList({
19084
19233
  }) });
19085
19234
  }
19086
19235
  const visibleSections = buildVisibleSectionHeaders(rows, fieldRowIndex, windowStart, windowEnd);
19087
- return /* @__PURE__ */ jsx63(Fragment22, { children: rows.map((row, i) => {
19236
+ return /* @__PURE__ */ jsx63(Fragment23, { children: rows.map((row, i) => {
19088
19237
  const fieldAtRow = fieldRowIndex.indexOf(i);
19089
19238
  if (fieldAtRow === -1) {
19090
19239
  if (!visibleSections.has(i)) return null;
@@ -20315,7 +20464,7 @@ var PREVIEW_MIN_ROWS = 12;
20315
20464
  var PREVIEW_FULL_ROWS = 18;
20316
20465
 
20317
20466
  // src/components/tools-picker.tsx
20318
- import { Fragment as Fragment23, jsx as jsx73, jsxs as jsxs73 } from "react/jsx-runtime";
20467
+ import { Fragment as Fragment24, jsx as jsx73, jsxs as jsxs73 } from "react/jsx-runtime";
20319
20468
  var CHROME_ROWS6 = 15;
20320
20469
  var MAX_PICKER_ITEMS2 = 15;
20321
20470
  function toolActionLabel(enabled) {
@@ -20436,7 +20585,7 @@ function ToolsPicker({
20436
20585
  'No tools match "',
20437
20586
  filter,
20438
20587
  '".'
20439
- ] }) : /* @__PURE__ */ jsxs73(Fragment23, { children: [
20588
+ ] }) : /* @__PURE__ */ jsxs73(Fragment24, { children: [
20440
20589
  hiddenAbove > 0 ? /* @__PURE__ */ jsx73(Text, { dimColor: true, children: ` \u2191 ${hiddenAbove} more` }) : null,
20441
20590
  displayRows.map(({ item, index }) => {
20442
20591
  const focused = index === visibleSelected;
@@ -20513,7 +20662,7 @@ function TopicCheckPanel({ prompt }) {
20513
20662
  }
20514
20663
 
20515
20664
  // src/app-view-pickers.tsx
20516
- import { Fragment as Fragment24, jsx as jsx75, jsxs as jsxs75 } from "react/jsx-runtime";
20665
+ import { Fragment as Fragment25, jsx as jsx75, jsxs as jsxs75 } from "react/jsx-runtime";
20517
20666
  var CONTINUE_CONFIRM_DELAY_MS = 4e3;
20518
20667
  function AppViewPickers({
20519
20668
  host,
@@ -20553,7 +20702,7 @@ function AppViewPickers({
20553
20702
  const { nowTick, enhanceDots } = activity;
20554
20703
  const { setYoloLive } = environment;
20555
20704
  const { inputHeight } = viewState;
20556
- return /* @__PURE__ */ jsxs75(Fragment24, { children: [
20705
+ return /* @__PURE__ */ jsxs75(Fragment25, { children: [
20557
20706
  state.picker.open ? /* @__PURE__ */ jsx75(
20558
20707
  FilePicker,
20559
20708
  {
@@ -21128,7 +21277,13 @@ function truncateTextDeep(node) {
21128
21277
  return node;
21129
21278
  }
21130
21279
  if (Array.isArray(node)) {
21131
- return node.map((child) => truncateTextDeep(child));
21280
+ return node.map((child, index) => {
21281
+ const walked = truncateTextDeep(child);
21282
+ if (isReactElement(walked) && walked.key === null) {
21283
+ return React5.cloneElement(walked, { key: `wst-wrap-${index}` });
21284
+ }
21285
+ return walked;
21286
+ });
21132
21287
  }
21133
21288
  if (!isReactElement(node)) {
21134
21289
  return node;
@@ -21218,7 +21373,7 @@ function Card({
21218
21373
 
21219
21374
  // src/components/sidebar-panel-frame.tsx
21220
21375
  import React6 from "react";
21221
- import { Fragment as Fragment25, jsx as jsx77, jsxs as jsxs77 } from "react/jsx-runtime";
21376
+ import { Fragment as Fragment26, jsx as jsx77, jsxs as jsxs77 } from "react/jsx-runtime";
21222
21377
  function trunc(s2, max) {
21223
21378
  return truncateDisplay(s2, max);
21224
21379
  }
@@ -21322,7 +21477,7 @@ function SidebarPanelFrame({
21322
21477
  innerWidth - 4 - (effectivePill && innerWidth >= 22 ? displayWidth(getPillLabel(effectivePill)) + 2 : 0)
21323
21478
  )
21324
21479
  ) }),
21325
- effectivePill && innerWidth >= 22 ? /* @__PURE__ */ jsxs77(Fragment25, { children: [
21480
+ effectivePill && innerWidth >= 22 ? /* @__PURE__ */ jsxs77(Fragment26, { children: [
21326
21481
  /* @__PURE__ */ jsx77(Box, { flexGrow: 1 }),
21327
21482
  effectivePill
21328
21483
  ] }) : null
@@ -21352,7 +21507,7 @@ function getPillLabel(pill) {
21352
21507
  }
21353
21508
 
21354
21509
  // src/components/sidebar-content.tsx
21355
- import { Fragment as Fragment26, jsx as jsx78, jsxs as jsxs78 } from "react/jsx-runtime";
21510
+ import { Fragment as Fragment27, jsx as jsx78, jsxs as jsxs78 } from "react/jsx-runtime";
21356
21511
  function trunc2(s2, max) {
21357
21512
  if (s2.length <= max) return s2;
21358
21513
  return `${s2.slice(0, Math.max(1, max - 1))}\u2026`;
@@ -21539,7 +21694,7 @@ function DialRow({
21539
21694
  /* @__PURE__ */ jsx78(Text, { color, children: dialGlyph(ratio) }),
21540
21695
  /* @__PURE__ */ jsx78(Text, { children: " " }),
21541
21696
  /* @__PURE__ */ jsx78(Text, { color, bold: true, children: value }),
21542
- spark ? /* @__PURE__ */ jsxs78(Fragment26, { children: [
21697
+ spark ? /* @__PURE__ */ jsxs78(Fragment27, { children: [
21543
21698
  /* @__PURE__ */ jsx78(Box, { flexGrow: 1 }),
21544
21699
  /* @__PURE__ */ jsx78(Text, { color, children: spark })
21545
21700
  ] }) : null
@@ -21606,7 +21761,7 @@ function SidebarContent({
21606
21761
  ]
21607
21762
  }
21608
21763
  ) : null,
21609
- /* @__PURE__ */ jsx78(Card, { innerWidth, accent: ctxColor, children: (bodyWidth) => /* @__PURE__ */ jsxs78(Fragment26, { children: [
21764
+ /* @__PURE__ */ jsx78(Card, { innerWidth, accent: ctxColor, children: (bodyWidth) => /* @__PURE__ */ jsxs78(Fragment27, { children: [
21610
21765
  /* @__PURE__ */ jsxs78(Box, { width: bodyWidth, justifyContent: "space-between", children: [
21611
21766
  /* @__PURE__ */ jsxs78(Box, { children: [
21612
21767
  /* @__PURE__ */ jsx78(Text, { color: theme.accent, bold: true, children: glyphs.railHeavy }),
@@ -21618,7 +21773,7 @@ function SidebarContent({
21618
21773
  /* @__PURE__ */ jsx78(Text, { color: theme.textMuted, wrap: "truncate", children: provider ? `${glyphs.diamondOpen} ${trunc2(provider.toUpperCase(), Math.max(1, bodyWidth - 2))}` : `${glyphs.diamondOpen} ACTIVE` }),
21619
21774
  /* @__PURE__ */ jsx78(Text, { color: theme.textPrimary, bold: true, wrap: "truncate", children: trunc2(modelIdentity, bodyWidth) })
21620
21775
  ] }) : null,
21621
- contextWindow ? /* @__PURE__ */ jsxs78(Fragment26, { children: [
21776
+ contextWindow ? /* @__PURE__ */ jsxs78(Fragment27, { children: [
21622
21777
  (() => {
21623
21778
  const tokensLabel = `${fmtTok(contextWindow.used)} / ${fmtTok(contextWindow.max)}`;
21624
21779
  const pctLabel = `${ctxPct} `;
@@ -21720,7 +21875,7 @@ function SidebarContent({
21720
21875
  /* @__PURE__ */ jsx78(Card, { innerWidth, accent: hasCacheActivity ? theme.success : void 0, children: (bodyWidth) => {
21721
21876
  const meterInner = Math.max(1, bodyWidth - 2);
21722
21877
  const dynamicMeter = renderMeter(cs.hitRatio, meterInner);
21723
- return /* @__PURE__ */ jsxs78(Fragment26, { children: [
21878
+ return /* @__PURE__ */ jsxs78(Fragment27, { children: [
21724
21879
  /* @__PURE__ */ jsx78(
21725
21880
  SidebarSectionHeader,
21726
21881
  {
@@ -21734,17 +21889,17 @@ function SidebarContent({
21734
21889
  badgeMuted: !hasCacheActivity
21735
21890
  }
21736
21891
  ),
21737
- hasCacheActivity ? /* @__PURE__ */ jsxs78(Fragment26, { children: [
21892
+ hasCacheActivity ? /* @__PURE__ */ jsxs78(Fragment27, { children: [
21738
21893
  /* @__PURE__ */ jsx78(Box, { width: bodyWidth, flexDirection: "row", children: /* @__PURE__ */ jsx78(Text, { color: theme.success, children: dynamicMeter }) }),
21739
21894
  bodyWidth >= 28 ? /* @__PURE__ */ jsx78(Box, { flexDirection: "row", width: bodyWidth, justifyContent: "space-between", children: /* @__PURE__ */ jsxs78(Text, { color: theme.textSecondary, wrap: "truncate", children: [
21740
21895
  "read ",
21741
21896
  /* @__PURE__ */ jsx78(Text, { color: theme.textPrimary, bold: true, children: fmtTok(cs.readTokens) }),
21742
- cs.writeTokens > 0 ? /* @__PURE__ */ jsxs78(Fragment26, { children: [
21897
+ cs.writeTokens > 0 ? /* @__PURE__ */ jsxs78(Fragment27, { children: [
21743
21898
  " \xB7 ",
21744
21899
  "write ",
21745
21900
  /* @__PURE__ */ jsx78(Text, { color: theme.textPrimary, bold: true, children: fmtTok(cs.writeTokens) })
21746
21901
  ] }) : null,
21747
- cs.savedUsd > 0 ? /* @__PURE__ */ jsxs78(Fragment26, { children: [
21902
+ cs.savedUsd > 0 ? /* @__PURE__ */ jsxs78(Fragment27, { children: [
21748
21903
  " \xB7 ",
21749
21904
  "saved",
21750
21905
  " ",
@@ -21753,7 +21908,7 @@ function SidebarContent({
21753
21908
  cs.savedUsd.toFixed(2)
21754
21909
  ] })
21755
21910
  ] }) : null
21756
- ] }) }) : /* @__PURE__ */ jsxs78(Fragment26, { children: [
21911
+ ] }) }) : /* @__PURE__ */ jsxs78(Fragment27, { children: [
21757
21912
  /* @__PURE__ */ jsxs78(Box, { flexDirection: "row", width: bodyWidth, justifyContent: "space-between", children: [
21758
21913
  /* @__PURE__ */ jsxs78(Text, { color: theme.textSecondary, wrap: "truncate", children: [
21759
21914
  "read ",
@@ -21783,7 +21938,7 @@ function SidebarContent({
21783
21938
  const isWarnLoad = (cpuPercent ?? 0) > 60 || (processMemory?.load ?? 0) > 0.6;
21784
21939
  const healthBadge = isHighLoad ? "HIGH" : isWarnLoad ? "WARN" : "HEALTHY";
21785
21940
  const healthColor = isHighLoad ? theme.error : isWarnLoad ? theme.warn : theme.success;
21786
- return /* @__PURE__ */ jsxs78(Fragment26, { children: [
21941
+ return /* @__PURE__ */ jsxs78(Fragment27, { children: [
21787
21942
  /* @__PURE__ */ jsx78(
21788
21943
  SidebarSectionHeader,
21789
21944
  {
@@ -21806,7 +21961,7 @@ function SidebarContent({
21806
21961
  innerWidth: bodyWidth
21807
21962
  }
21808
21963
  ) : null,
21809
- processMemory ? /* @__PURE__ */ jsxs78(Fragment26, { children: [
21964
+ processMemory ? /* @__PURE__ */ jsxs78(Fragment27, { children: [
21810
21965
  /* @__PURE__ */ jsx78(
21811
21966
  DialRow,
21812
21967
  {
@@ -21835,7 +21990,7 @@ function SidebarContent({
21835
21990
  {
21836
21991
  innerWidth,
21837
21992
  accent: running > 0 ? theme.monitor.fleet : theme.borderSubtle,
21838
- children: (bodyWidth) => /* @__PURE__ */ jsxs78(Fragment26, { children: [
21993
+ children: (bodyWidth) => /* @__PURE__ */ jsxs78(Fragment27, { children: [
21839
21994
  /* @__PURE__ */ jsx78(
21840
21995
  SidebarSectionHeader,
21841
21996
  {
@@ -21909,7 +22064,7 @@ function SidebarContent({
21909
22064
  {
21910
22065
  innerWidth,
21911
22066
  accent: mission.done === mission.total ? theme.success : theme.warn,
21912
- children: (bodyWidth) => /* @__PURE__ */ jsxs78(Fragment26, { children: [
22067
+ children: (bodyWidth) => /* @__PURE__ */ jsxs78(Fragment27, { children: [
21913
22068
  /* @__PURE__ */ jsx78(
21914
22069
  SidebarSectionHeader,
21915
22070
  {
@@ -21977,7 +22132,7 @@ function SidebarContent({
21977
22132
  ] })
21978
22133
  }
21979
22134
  ) : null,
21980
- ((liveSessions?.length ?? 0) > 0 || (resumeSessions?.length ?? 0) > 0) && !effectiveSidebarRoutes?.has("sessions") ? /* @__PURE__ */ jsx78(Card, { innerWidth, marginBottom: 0, accent: theme.success, children: (bodyWidth) => /* @__PURE__ */ jsxs78(Fragment26, { children: [
22135
+ ((liveSessions?.length ?? 0) > 0 || (resumeSessions?.length ?? 0) > 0) && !effectiveSidebarRoutes?.has("sessions") ? /* @__PURE__ */ jsx78(Card, { innerWidth, marginBottom: 0, accent: theme.success, children: (bodyWidth) => /* @__PURE__ */ jsxs78(Fragment27, { children: [
21981
22136
  /* @__PURE__ */ jsx78(
21982
22137
  SidebarSectionHeader,
21983
22138
  {
@@ -22138,7 +22293,7 @@ function SidebarWorklistRow({
22138
22293
  }
22139
22294
 
22140
22295
  // src/components/sidebar-panels-task.tsx
22141
- import { Fragment as Fragment27, jsx as jsx80, jsxs as jsxs80 } from "react/jsx-runtime";
22296
+ import { Fragment as Fragment28, jsx as jsx80, jsxs as jsxs80 } from "react/jsx-runtime";
22142
22297
  function PlanPanelSidebar({
22143
22298
  openCount,
22144
22299
  inProgressCount,
@@ -22343,7 +22498,7 @@ function ProcessListPanelSidebar({
22343
22498
  /* @__PURE__ */ jsx80(Text, { color: statusVisual2.color, children: statusVisual2.glyph }),
22344
22499
  /* @__PURE__ */ jsx80(Text, { color: theme.textPrimary, children: " " }),
22345
22500
  /* @__PURE__ */ jsx80(Text, { wrap: "truncate", children: trunc(p.name, Math.max(4, bodyWidth - 2 - (showPid ? displayWidth(pidLabel) + 1 : 0))) }),
22346
- showPid ? /* @__PURE__ */ jsxs80(Fragment27, { children: [
22501
+ showPid ? /* @__PURE__ */ jsxs80(Fragment28, { children: [
22347
22502
  /* @__PURE__ */ jsx80(Box, { flexGrow: 1 }),
22348
22503
  /* @__PURE__ */ jsx80(Text, { color: theme.textMuted, children: pidLabel })
22349
22504
  ] }) : null
@@ -22383,7 +22538,7 @@ function GoalPanelSidebar({
22383
22538
  goal.goalState.toUpperCase()
22384
22539
  ] }) : null,
22385
22540
  footer: "F9 details",
22386
- children: !goal ? /* @__PURE__ */ jsx80(EmptyState, { message: "no mission set", innerWidth: bodyWidth }) : /* @__PURE__ */ jsxs80(Fragment27, { children: [
22541
+ children: !goal ? /* @__PURE__ */ jsx80(EmptyState, { message: "no mission set", innerWidth: bodyWidth }) : /* @__PURE__ */ jsxs80(Fragment28, { children: [
22387
22542
  /* @__PURE__ */ jsx80(
22388
22543
  SidebarSectionHeader,
22389
22544
  {
@@ -22466,7 +22621,7 @@ function SessionsPanelSidebar({
22466
22621
  right: inner < PILL_MIN_INNER_WIDTH ? /* @__PURE__ */ jsx80(Text, { color: total > 0 ? theme.success : theme.textMuted, children: total }) : void 0,
22467
22622
  footer: "F10 details",
22468
22623
  children: [
22469
- live.length > 0 ? /* @__PURE__ */ jsxs80(Fragment27, { children: [
22624
+ live.length > 0 ? /* @__PURE__ */ jsxs80(Fragment28, { children: [
22470
22625
  /* @__PURE__ */ jsx80(
22471
22626
  SidebarSectionHeader,
22472
22627
  {
@@ -22489,7 +22644,7 @@ function SessionsPanelSidebar({
22489
22644
  " ",
22490
22645
  trunc(s2.projectName, Math.max(4, bodyWidth - (showAgentCount ? 6 : 2)))
22491
22646
  ] }),
22492
- showAgentCount ? /* @__PURE__ */ jsxs80(Fragment27, { children: [
22647
+ showAgentCount ? /* @__PURE__ */ jsxs80(Fragment28, { children: [
22493
22648
  /* @__PURE__ */ jsx80(Box, { flexGrow: 1 }),
22494
22649
  /* @__PURE__ */ jsxs80(Text, { color: theme.textMuted, children: [
22495
22650
  s2.agentCount,
@@ -22499,7 +22654,7 @@ function SessionsPanelSidebar({
22499
22654
  ] }, s2.sessionId);
22500
22655
  })
22501
22656
  ] }) : null,
22502
- resume.length > 0 ? /* @__PURE__ */ jsxs80(Fragment27, { children: [
22657
+ resume.length > 0 ? /* @__PURE__ */ jsxs80(Fragment28, { children: [
22503
22658
  /* @__PURE__ */ jsx80(
22504
22659
  SidebarSectionHeader,
22505
22660
  {
@@ -22535,7 +22690,7 @@ function SessionsPanelSidebar({
22535
22690
  ]
22536
22691
  }
22537
22692
  ),
22538
- showRelativeTime ? /* @__PURE__ */ jsxs80(Fragment27, { children: [
22693
+ showRelativeTime ? /* @__PURE__ */ jsxs80(Fragment28, { children: [
22539
22694
  /* @__PURE__ */ jsx80(Box, { flexGrow: 1 }),
22540
22695
  /* @__PURE__ */ jsx80(Text, { color: theme.textMuted, children: rel })
22541
22696
  ] }) : null
@@ -22623,7 +22778,7 @@ function KanbanPanelSidebar({
22623
22778
  }
22624
22779
 
22625
22780
  // src/components/sidebar-panels-workspace.tsx
22626
- import { Fragment as Fragment28, jsx as jsx81, jsxs as jsxs81 } from "react/jsx-runtime";
22781
+ import { Fragment as Fragment29, jsx as jsx81, jsxs as jsxs81 } from "react/jsx-runtime";
22627
22782
  function ProjectPickerSidebar({
22628
22783
  items,
22629
22784
  selected,
@@ -22783,14 +22938,14 @@ function AgentsPanelSidebar({
22783
22938
  /* @__PURE__ */ jsx81(Text, { color: theme.warn, children: running.length }),
22784
22939
  /* @__PURE__ */ jsx81(Text, { color: theme.textMuted, children: " " }),
22785
22940
  /* @__PURE__ */ jsx81(Text, { color: theme.success, children: done.length }),
22786
- failed.length > 0 ? /* @__PURE__ */ jsxs81(Fragment28, { children: [
22941
+ failed.length > 0 ? /* @__PURE__ */ jsxs81(Fragment29, { children: [
22787
22942
  /* @__PURE__ */ jsx81(Text, { color: theme.textMuted, children: " " }),
22788
22943
  /* @__PURE__ */ jsx81(Text, { color: theme.error, children: failed.length })
22789
22944
  ] }) : null
22790
22945
  ] }) : void 0,
22791
22946
  footer: `F3 details ${glyphs.dividerDiamond} $${totalCost.toFixed(4)}`,
22792
22947
  children: [
22793
- hotAgent ? /* @__PURE__ */ jsxs81(Fragment28, { children: [
22948
+ hotAgent ? /* @__PURE__ */ jsxs81(Fragment29, { children: [
22794
22949
  /* @__PURE__ */ jsx81(
22795
22950
  SidebarSectionHeader,
22796
22951
  {
@@ -22831,7 +22986,7 @@ function AgentsPanelSidebar({
22831
22986
  /* @__PURE__ */ jsx81(Text, { color: v.color, children: v.glyph }),
22832
22987
  /* @__PURE__ */ jsx81(Text, { color: theme.textPrimary, children: " " }),
22833
22988
  /* @__PURE__ */ jsx81(Text, { wrap: "truncate", children: name }),
22834
- showElapsed ? /* @__PURE__ */ jsxs81(Fragment28, { children: [
22989
+ showElapsed ? /* @__PURE__ */ jsxs81(Fragment29, { children: [
22835
22990
  /* @__PURE__ */ jsx81(Box, { flexGrow: 1 }),
22836
22991
  /* @__PURE__ */ jsx81(Text, { color: theme.textMuted, children: elapsedLabel })
22837
22992
  ] }) : null
@@ -22891,7 +23046,7 @@ function WorktreePanelSidebar({
22891
23046
  "D",
22892
23047
  merged
22893
23048
  ] }),
22894
- failed > 0 ? /* @__PURE__ */ jsxs81(Fragment28, { children: [
23049
+ failed > 0 ? /* @__PURE__ */ jsxs81(Fragment29, { children: [
22895
23050
  /* @__PURE__ */ jsx81(Text, { color: theme.textMuted, children: " " }),
22896
23051
  /* @__PURE__ */ jsxs81(Text, { color: theme.error, children: [
22897
23052
  "!",
@@ -22914,7 +23069,7 @@ function WorktreePanelSidebar({
22914
23069
  /* @__PURE__ */ jsx81(Text, { color: v.color, children: v.glyph }),
22915
23070
  /* @__PURE__ */ jsx81(Text, { color: theme.textPrimary, children: " " }),
22916
23071
  /* @__PURE__ */ jsx81(Text, { wrap: "truncate", children: branch }),
22917
- showDiff ? /* @__PURE__ */ jsxs81(Fragment28, { children: [
23072
+ showDiff ? /* @__PURE__ */ jsxs81(Fragment29, { children: [
22918
23073
  /* @__PURE__ */ jsx81(Box, { flexGrow: 1 }),
22919
23074
  /* @__PURE__ */ jsx81(Text, { color: theme.textMuted, children: diff })
22920
23075
  ] }) : null
@@ -23061,7 +23216,7 @@ function ConnectionsPanelSidebar({
23061
23216
  c.name,
23062
23217
  Math.max(3, bodyWidth - rowChrome - (lat ? displayWidth(lat) + 1 : 0))
23063
23218
  ) }),
23064
- lat ? /* @__PURE__ */ jsxs81(Fragment28, { children: [
23219
+ lat ? /* @__PURE__ */ jsxs81(Fragment29, { children: [
23065
23220
  /* @__PURE__ */ jsx81(Box, { flexGrow: 1 }),
23066
23221
  /* @__PURE__ */ jsx81(Text, { color, children: lat })
23067
23222
  ] }) : null
@@ -23124,7 +23279,7 @@ function WrongProxyPanelSidebar({
23124
23279
  )
23125
23280
  )
23126
23281
  ] }),
23127
- showLatency && latencyLabel ? /* @__PURE__ */ jsxs81(Fragment28, { children: [
23282
+ showLatency && latencyLabel ? /* @__PURE__ */ jsxs81(Fragment29, { children: [
23128
23283
  /* @__PURE__ */ jsx81(Box, { flexGrow: 1 }),
23129
23284
  /* @__PURE__ */ jsx81(Text, { color: theme.textMuted, children: latencyLabel })
23130
23285
  ] }) : null
@@ -23324,7 +23479,7 @@ function AppViewSidebar({
23324
23479
  }
23325
23480
 
23326
23481
  // src/components/input.tsx
23327
- import { memo as memo2, useEffect as useEffect22, useRef as useRef7, useState as useState22 } from "react";
23482
+ import { memo as memo2, useEffect as useEffect22, useRef as useRef7, useState as useState23 } from "react";
23328
23483
 
23329
23484
  // src/fn-keys.ts
23330
23485
  function fnKey(data) {
@@ -23545,7 +23700,7 @@ function isLeakedMouseInput(input) {
23545
23700
  }
23546
23701
 
23547
23702
  // src/components/composer-status-chip.tsx
23548
- import { Fragment as Fragment29, jsx as jsx83, jsxs as jsxs83 } from "react/jsx-runtime";
23703
+ import { Fragment as Fragment30, jsx as jsx83, jsxs as jsxs83 } from "react/jsx-runtime";
23549
23704
  var SPINNER_INTERVAL_MS2 = 1e3;
23550
23705
  var ACTIVITY_INTERVAL_MS = 130;
23551
23706
  var ACTIVITY_FRAMES_UNICODE = ["\xB7", "\u25E6", "\u2022", "\u25CF", "\u25C9", "\u25CF", "\u2022", "\u25E6"];
@@ -23620,7 +23775,7 @@ function composerStatusReservedWidth(status) {
23620
23775
  }
23621
23776
  function withPad(node, contentWidth, reservedWidth) {
23622
23777
  const pad = Math.max(0, reservedWidth - contentWidth);
23623
- return /* @__PURE__ */ jsxs83(Fragment29, { children: [
23778
+ return /* @__PURE__ */ jsxs83(Fragment30, { children: [
23624
23779
  node,
23625
23780
  pad > 0 ? /* @__PURE__ */ jsx83(Text, { children: " ".repeat(pad) }) : null
23626
23781
  ] });
@@ -23704,7 +23859,7 @@ function ComposerStatusChip({
23704
23859
  }
23705
23860
 
23706
23861
  // src/components/input.tsx
23707
- import { Fragment as Fragment30, jsx as jsx84, jsxs as jsxs84 } from "react/jsx-runtime";
23862
+ import { Fragment as Fragment31, jsx as jsx84, jsxs as jsxs84 } from "react/jsx-runtime";
23708
23863
  var DEFAULT_INPUT_PROMPT = `${glyphs.prompt} `;
23709
23864
  function ComposerTopRail({
23710
23865
  width,
@@ -23729,7 +23884,7 @@ function ComposerTopRail({
23729
23884
  const remaining = Math.max(0, available - titleW - statusSectionW);
23730
23885
  return /* @__PURE__ */ jsxs84(Text, { bold: true, color: disabled ? theme.error : theme.brandPrimary, children: [
23731
23886
  "\u256D",
23732
- title ? /* @__PURE__ */ jsxs84(Fragment30, { children: [
23887
+ title ? /* @__PURE__ */ jsxs84(Fragment31, { children: [
23733
23888
  /* @__PURE__ */ jsx84(Text, { children: "\u2500 " }),
23734
23889
  staticMode ? /* @__PURE__ */ jsx84(Text, { bold: true, children: glyphs.brand }) : /* @__PURE__ */ jsx84(ComposerActivityIcon, { status, idleGlyph: glyphs.brand, disabled }),
23735
23890
  /* @__PURE__ */ jsx84(Text, { children: ` ${title}` }),
@@ -24020,7 +24175,7 @@ var Input = memo2(function Input2({
24020
24175
  }
24021
24176
  }
24022
24177
  }
24023
- const [vScroll, setVScroll] = useState22(0);
24178
+ const [vScroll, setVScroll] = useState23(0);
24024
24179
  const vScrollRef = useRef7(vScroll);
24025
24180
  vScrollRef.current = vScroll;
24026
24181
  const clampedScroll = needsScroll ? Math.max(0, Math.min(vScroll, rows.length - MAX_VISIBLE_ROWS)) : 0;
@@ -24092,7 +24247,7 @@ import {
24092
24247
  useLayoutEffect,
24093
24248
  useMemo as useMemo10,
24094
24249
  useRef as useRef10,
24095
- useState as useState23
24250
+ useState as useState24
24096
24251
  } from "react";
24097
24252
 
24098
24253
  // src/height-cache.ts
@@ -24845,9 +25000,17 @@ function liveToolStreamCopyHit(opts) {
24845
25000
 
24846
25001
  // src/components/history/tool-group.tsx
24847
25002
  import { memo as memo3 } from "react";
24848
- import { Fragment as Fragment31, jsx as jsx86, jsxs as jsxs85 } from "react/jsx-runtime";
25003
+ import { Fragment as Fragment32, jsx as jsx86, jsxs as jsxs85 } from "react/jsx-runtime";
24849
25004
  var MAX_TOOL_GROUP_ENTRIES = 12;
24850
- var STRUCTURED_DIFF_TOOLS = /* @__PURE__ */ new Set(["edit", "write", "replace", "diff", "patch"]);
25005
+ var STRUCTURED_DIFF_TOOLS = /* @__PURE__ */ new Set([
25006
+ "edit",
25007
+ "replace_file_content",
25008
+ "write",
25009
+ "write_to_file",
25010
+ "replace",
25011
+ "diff",
25012
+ "patch"
25013
+ ]);
24851
25014
  function hasInjectedMemory(entry) {
24852
25015
  return resolveEntrySage(entry.output, entry.sageLines).sageLines.length > 0;
24853
25016
  }
@@ -24878,13 +25041,19 @@ function estimateRenderGroupRows(group, contentWidth, showSageMemoryInject) {
24878
25041
  const { cleanOutput, sageLines } = resolveEntrySage(entry.output, entry.sageLines);
24879
25042
  const memoryLines = sageLines.slice(1);
24880
25043
  const panelContentWidth = Math.max(1, contentWidth - 4);
24881
- const sagePanelRows = showSageMemoryInject === false || memoryLines.length === 0 ? 0 : 4 + memoryLines.reduce((sum, line) => {
25044
+ const headerWidth = displayWidth(
25045
+ `\u{1F9E0} SAGE MEMORY INJECTED \xB7 ${entry.name} ${memoryLines.length} ${memoryLines.length === 1 ? "memory" : "memories"}`
25046
+ );
25047
+ const headerRows = Math.max(1, Math.ceil(headerWidth / panelContentWidth));
25048
+ const sagePanelRows = showSageMemoryInject === false || memoryLines.length === 0 ? 0 : 2 + headerRows + memoryLines.reduce((sum, line, index) => {
24882
25049
  const parsed = parseSageMemoryLine(line);
24883
25050
  const bodySource = parsed ? parsed.text : line;
24884
25051
  const bodyWidth = displayWidth(sanitizeTerminalText(bodySource));
24885
25052
  const bodyRows = Math.max(1, Math.ceil(bodyWidth / panelContentWidth));
24886
- const kvRows = panelContentWidth < 48 ? 2 : 1;
24887
- return sum + 1 + bodyRows + kvRows;
25053
+ const badgeCount = (parsed?.id ? 1 : 0) + (parsed?.anchor ? 1 : 0) + (parsed?.relation ? 1 : 0) + (parsed?.tags && parsed.tags.length > 0 ? 1 : 0);
25054
+ const kvRows = panelContentWidth < 50 ? badgeCount : panelContentWidth < 70 ? Math.max(1, Math.ceil(badgeCount / 2)) : 1;
25055
+ const sep2 = index > 0 ? 1 : 0;
25056
+ return sum + 1 + bodyRows + kvRows + sep2;
24888
25057
  }, 0);
24889
25058
  if (entry.resultRenderMode === "simple") return 3 + sagePanelRows;
24890
25059
  if (STRUCTURED_DIFF_TOOLS.has(entry.name)) {
@@ -25058,7 +25227,7 @@ function ToolGroupItem({
25058
25227
  return /* @__PURE__ */ jsxs85(Text, { children: [
25059
25228
  /* @__PURE__ */ jsx86(Text, { bold: true, color: statusColor3, children: statusMark }),
25060
25229
  /* @__PURE__ */ jsx86(Text, { dimColor: true, children: ` #${index}` }),
25061
- argPreview ? /* @__PURE__ */ jsxs85(Fragment31, { children: [
25230
+ argPreview ? /* @__PURE__ */ jsxs85(Fragment32, { children: [
25062
25231
  /* @__PURE__ */ jsx86(Text, { children: " " }),
25063
25232
  /* @__PURE__ */ jsx86(Text, { color: theme.textSecondary, children: argPreview })
25064
25233
  ] }) : null,
@@ -25642,7 +25811,7 @@ function useActiveTheme() {
25642
25811
  }
25643
25812
 
25644
25813
  // src/components/history/banner.tsx
25645
- import { Fragment as Fragment32, jsx as jsx89, jsxs as jsxs87 } from "react/jsx-runtime";
25814
+ import { Fragment as Fragment33, jsx as jsx89, jsxs as jsxs87 } from "react/jsx-runtime";
25646
25815
  var STACK_ORANGE2 = () => theme.brandPrimary;
25647
25816
  var SIGNAL_PINK = () => theme.brandAccent;
25648
25817
  var BORDER = () => theme.borderDefault;
@@ -25792,7 +25961,7 @@ function ProfileRow({
25792
25961
  return /* @__PURE__ */ jsxs87(Text, { children: [
25793
25962
  /* @__PURE__ */ jsx89(Text, { color: STACK_ORANGE2(), children: icon }),
25794
25963
  /* @__PURE__ */ jsx89(Text, { color: STACK_ORANGE2(), bold: true, children: ` ${trunc3(label, labelWidth).padEnd(labelWidth)} ` }),
25795
- segIdx >= 0 && profileSegment ? /* @__PURE__ */ jsxs87(Fragment32, { children: [
25964
+ segIdx >= 0 && profileSegment ? /* @__PURE__ */ jsxs87(Fragment33, { children: [
25796
25965
  /* @__PURE__ */ jsx89(Text, { color: MUTED(), children: displayPath.slice(0, segIdx) }),
25797
25966
  /* @__PURE__ */ jsx89(Text, { color: STACK_ORANGE2(), bold: true, children: profileSegment }),
25798
25967
  /* @__PURE__ */ jsx89(Text, { color: MUTED(), children: displayPath.slice(segIdx + profileSegment.length) })
@@ -25808,7 +25977,7 @@ function Footer({
25808
25977
  return /* @__PURE__ */ jsx89(Box, { flexDirection: "column", alignItems: "center", marginTop: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs87(Text, { children: [
25809
25978
  /* @__PURE__ */ jsx89(Text, { color: SIGNAL_PINK(), children: "\u25C6 " }),
25810
25979
  /* @__PURE__ */ jsx89(Text, { dimColor: true, children: OSC8_WRONGSTACK }),
25811
- !compact || contentWidth >= 35 ? /* @__PURE__ */ jsxs87(Fragment32, { children: [
25980
+ !compact || contentWidth >= 35 ? /* @__PURE__ */ jsxs87(Fragment33, { children: [
25812
25981
  /* @__PURE__ */ jsx89(Text, { dimColor: true, children: " \xB7 " }),
25813
25982
  /* @__PURE__ */ jsx89(Text, { color: STACK_ORANGE2(), children: "\u2605 " }),
25814
25983
  /* @__PURE__ */ jsx89(Text, { dimColor: true, children: OSC8_GITHUB })
@@ -25904,10 +26073,10 @@ function Banner({
25904
26073
  ] }) : null
25905
26074
  ] }),
25906
26075
  /* @__PURE__ */ jsx89(Box, { justifyContent: "center", marginTop: compact ? 0 : 1, children: /* @__PURE__ */ jsx89(BrandMark, { pinkRow }) }),
25907
- compact ? /* @__PURE__ */ jsxs87(Fragment32, { children: [
26076
+ compact ? /* @__PURE__ */ jsxs87(Fragment33, { children: [
25908
26077
  /* @__PURE__ */ jsx89(Box, { justifyContent: "center", marginTop: 1, children: /* @__PURE__ */ jsx89(GradientText, { text: "WrongStack" }) }),
25909
26078
  /* @__PURE__ */ jsx89(Box, { justifyContent: "center", children: /* @__PURE__ */ jsx89(Text, { color: MUTED(), children: trunc3("TERMINAL AI ENGINE", contentWidth) }) })
25910
- ] }) : /* @__PURE__ */ jsxs87(Fragment32, { children: [
26079
+ ] }) : /* @__PURE__ */ jsxs87(Fragment33, { children: [
25911
26080
  /* @__PURE__ */ jsx89(Box, { justifyContent: "center", marginTop: 1, children: /* @__PURE__ */ jsx89(PixelWordmark, {}) }),
25912
26081
  /* @__PURE__ */ jsx89(Box, { justifyContent: "center", marginTop: 1, children: /* @__PURE__ */ jsx89(Text, { color: MUTED(), italic: true, children: "BUILT ON THE WRONG STACK. SHIPPED ANYWAY." }) })
25913
26082
  ] }),
@@ -26144,7 +26313,7 @@ function SageKv({ label, value }) {
26144
26313
  }
26145
26314
 
26146
26315
  // src/components/history/tool-card.tsx
26147
- import { Fragment as Fragment33, jsx as jsx92, jsxs as jsxs90 } from "react/jsx-runtime";
26316
+ import { Fragment as Fragment34, jsx as jsx92, jsxs as jsxs90 } from "react/jsx-runtime";
26148
26317
  function ToolCard({
26149
26318
  glyph: glyph2,
26150
26319
  color,
@@ -26181,7 +26350,7 @@ function ToolCard({
26181
26350
  visibleDetail ? /* @__PURE__ */ jsx92(Text, { color: theme.textSecondary, children: ` ${visibleDetail}` }) : null,
26182
26351
  visibleMeta ? /* @__PURE__ */ jsx92(Text, { color: theme.textMuted, children: ` \xB7 ${visibleMeta}` }) : null
26183
26352
  ] }),
26184
- hasBody ? /* @__PURE__ */ jsxs90(Fragment33, { children: [
26353
+ hasBody ? /* @__PURE__ */ jsxs90(Fragment34, { children: [
26185
26354
  /* @__PURE__ */ jsx92(
26186
26355
  Box,
26187
26356
  {
@@ -26229,7 +26398,8 @@ function ToolEntry({
26229
26398
  entry.ok,
26230
26399
  entry.input
26231
26400
  );
26232
- const diff2 = entry.ok ? extractDiffPreview(entry.name, outputForFormatting, entry.input) : void 0;
26401
+ const diffSource = entry.name === "replace_file_content" ? "edit" : entry.name === "write_to_file" ? "write" : entry.name;
26402
+ const diff2 = entry.ok ? extractDiffPreview(diffSource, outputForFormatting, entry.input) : void 0;
26233
26403
  const multiDiffs2 = entry.ok && !diff2 && (entry.name === "replace" || entry.name === "diff" || entry.name === "patch") ? extractMultiFileDiffs(entry.name, outputForFormatting, entry.input) : void 0;
26234
26404
  const sizeChip2 = (() => {
26235
26405
  if (!entry.ok) return "";
@@ -26247,24 +26417,28 @@ function ToolEntry({
26247
26417
  })();
26248
26418
  const mutation2 = (() => {
26249
26419
  const name = entry.name;
26250
- if (name !== "edit" && name !== "write" && name !== "patch" && name !== "replace") {
26420
+ if (name !== "edit" && name !== "replace_file_content" && name !== "write" && name !== "write_to_file" && name !== "patch" && name !== "replace" && name !== "diff") {
26251
26421
  return void 0;
26252
26422
  }
26253
26423
  if (!entry.ok || !diff2 && !multiDiffs2) return void 0;
26254
26424
  const inputObj = entry.input && typeof entry.input === "object" ? entry.input : void 0;
26255
26425
  const outJson = tryParseJson(outputForFormatting.trim());
26256
26426
  const outObj = outJson && typeof outJson === "object" ? outJson : void 0;
26257
- const created = name === "write" && (outObj?.["created"] === true || /^[^\n]*\bcreated=true\b/.test(outputForFormatting));
26258
- const verb = created ? "Write" : "Update";
26259
- const path12 = stringOf(inputObj?.["path"]) ?? stringOf(outObj?.["path"]);
26427
+ const created = (name === "write" || name === "write_to_file") && (outObj?.["created"] === true || /^[^\n]*\bcreated=true\b/.test(outputForFormatting));
26428
+ const verb = name === "diff" ? "Diff" : created ? "Write" : "Update";
26429
+ const outFiles = Array.isArray(outObj?.["files"]) ? outObj?.["files"] : void 0;
26430
+ const firstOutFile = outFiles && outFiles.length > 0 ? stringOf(outFiles[0]) : void 0;
26431
+ const path12 = stringOf(inputObj?.["path"]) ?? stringOf(inputObj?.["TargetFile"]) ?? stringOf(inputObj?.["file"]) ?? stringOf(inputObj?.["files"]) ?? stringOf(inputObj?.["a"]) ?? stringOf(outObj?.["path"]) ?? firstOutFile;
26260
26432
  const agg = multiDiffs2 ? summarizeMultiFileDiffs(multiDiffs2) : void 0;
26261
- const target = multiDiffs2 ? agg?.fileCount === 1 ? multiDiffs2[0].path : `${agg?.fileCount ?? multiDiffs2.length} files` : path12 ?? "file";
26433
+ const target = multiDiffs2 ? agg?.fileCount === 1 ? multiDiffs2[0].path : `${agg?.fileCount ?? multiDiffs2.length} files` : path12 ?? "changes";
26262
26434
  return {
26263
26435
  verb,
26264
26436
  target,
26265
26437
  added: agg ? agg.added : diff2?.added ?? 0,
26266
26438
  removed: agg ? agg.removed : diff2?.removed ?? 0,
26267
- lang: langFromPath(multiDiffs2 ? "" : path12 ?? "")
26439
+ lang: langFromPath(
26440
+ multiDiffs2 && multiDiffs2.length > 1 ? "" : multiDiffs2?.[0]?.path ?? path12 ?? ""
26441
+ )
26268
26442
  };
26269
26443
  })();
26270
26444
  return {
@@ -26438,7 +26612,7 @@ var USER_LABEL = "\u{1F464} USER ";
26438
26612
  var INFO_PREFIX = "\u2139 ";
26439
26613
 
26440
26614
  // src/components/history/entry.tsx
26441
- import { Fragment as Fragment34, jsx as jsx94, jsxs as jsxs92 } from "react/jsx-runtime";
26615
+ import { Fragment as Fragment35, jsx as jsx94, jsxs as jsxs92 } from "react/jsx-runtime";
26442
26616
  var Entry = React7.memo(function Entry2({
26443
26617
  entry,
26444
26618
  termWidth,
@@ -26487,7 +26661,7 @@ var Entry = React7.memo(function Entry2({
26487
26661
  /* @__PURE__ */ jsx94(Text, { bold: true, color: theme.user, children: USER_LABEL }),
26488
26662
  /* @__PURE__ */ jsx94(Text, { color: "white", children: sanitizeTerminalText(entry.text) }),
26489
26663
  entry.queued ? /* @__PURE__ */ jsx94(Text, { dimColor: true, children: " (queued)" }) : null,
26490
- entry.pasteContent ? /* @__PURE__ */ jsxs92(Fragment34, { children: [
26664
+ entry.pasteContent ? /* @__PURE__ */ jsxs92(Fragment35, { children: [
26491
26665
  entry.text ? "\n" : null,
26492
26666
  /* @__PURE__ */ jsxs92(Text, { dimColor: true, children: [
26493
26667
  " \u21B3 ",
@@ -26784,7 +26958,7 @@ var Entry = React7.memo(function Entry2({
26784
26958
  /* @__PURE__ */ jsx94(Text, { bold: true, color: entry.agentColor, children: sanitizeTerminalText(entry.agentLabel) }),
26785
26959
  /* @__PURE__ */ jsx94(Text, { children: " " }),
26786
26960
  /* @__PURE__ */ jsx94(Text, { color: theme.textSecondary, children: lines[0] ?? "" }),
26787
- entry.detail ? /* @__PURE__ */ jsxs92(Fragment34, { children: [
26961
+ entry.detail ? /* @__PURE__ */ jsxs92(Fragment35, { children: [
26788
26962
  /* @__PURE__ */ jsx94(Text, { color: theme.textMuted, children: " \xB7 " }),
26789
26963
  /* @__PURE__ */ jsx94(Text, { color: theme.textMuted, children: sanitizeTerminalText(entry.detail) })
26790
26964
  ] }) : null
@@ -26799,7 +26973,7 @@ var Entry = React7.memo(function Entry2({
26799
26973
  });
26800
26974
 
26801
26975
  // src/components/history/index.tsx
26802
- import { Fragment as Fragment35, jsx as jsx95, jsxs as jsxs93 } from "react/jsx-runtime";
26976
+ import { Fragment as Fragment36, jsx as jsx95, jsxs as jsxs93 } from "react/jsx-runtime";
26803
26977
  var History = memo6(function History2({
26804
26978
  entries,
26805
26979
  generation,
@@ -26860,7 +27034,7 @@ var History = memo6(function History2({
26860
27034
  const staticKey = `${generation ?? 0}-${staticRevision}-${presentationKey}`;
26861
27035
  const staticEntries = pendingEntries;
26862
27036
  void toolStream;
26863
- return /* @__PURE__ */ jsxs93(Fragment35, { children: [
27037
+ return /* @__PURE__ */ jsxs93(Fragment36, { children: [
26864
27038
  /* @__PURE__ */ jsx95(Static, { items: staticEntries, children: (entry) => /* @__PURE__ */ jsx95(Box, { marginBottom: entry.kind === "turn-summary" ? 1 : 0, children: /* @__PURE__ */ jsx95(
26865
27039
  Entry,
26866
27040
  {
@@ -27273,6 +27447,7 @@ var MAX_UNDERFILL_BUMPS = 8;
27273
27447
  var ScrollableHistory = memo7(function ScrollableHistory2({
27274
27448
  entries,
27275
27449
  toolStream,
27450
+ streamingText,
27276
27451
  viewportRows,
27277
27452
  controllerRef,
27278
27453
  onScrollInfo,
@@ -27292,7 +27467,7 @@ var ScrollableHistory = memo7(function ScrollableHistory2({
27292
27467
  const raw = stdout?.columns ?? 80;
27293
27468
  return maxWidth ? Math.min(raw, maxWidth) : raw;
27294
27469
  }, [stdout, maxWidth]);
27295
- const [viewportWidth, setViewportWidth] = useState23(resolveViewportWidth);
27470
+ const [viewportWidth, setViewportWidth] = useState24(resolveViewportWidth);
27296
27471
  const termWidth = useMemo10(
27297
27472
  () => Math.max(1, viewportWidth - SCROLLBAR_HIT_WIDTH),
27298
27473
  [viewportWidth]
@@ -27309,6 +27484,8 @@ var ScrollableHistory = memo7(function ScrollableHistory2({
27309
27484
  }, [stdout, resolveViewportWidth]);
27310
27485
  const toolTail = toolStream?.text ? tailForDisplay(toolStream.text, MAX_STREAM_DISPLAY_CHARS) : "";
27311
27486
  const toolTailHeight = toolTail && toolStream ? toolStreamBoxHeight(toolStream.name) : 0;
27487
+ const assistantTail = streamingText ? tailForDisplay(streamingText, MAX_STREAM_DISPLAY_CHARS) : "";
27488
+ const assistantTailHeight = assistantTail ? assistantStreamBoxHeight() : 0;
27312
27489
  const groupedEntries = useMemo10(() => groupEntries(entries), [entries]);
27313
27490
  const groupIds = useMemo10(() => groupedEntries.map(renderGroupId), [groupedEntries]);
27314
27491
  const groupIdsKey = groupIds.join(",");
@@ -27395,8 +27572,8 @@ var ScrollableHistory = memo7(function ScrollableHistory2({
27395
27572
  preparedEstimateWidthRef.current = termWidth;
27396
27573
  }
27397
27574
  const vp = Math.max(1, viewportRows);
27398
- const [anchor, setAnchor] = useState23(null);
27399
- const [mountBump, setMountBump] = useState23(0);
27575
+ const [anchor, setAnchor] = useState24(null);
27576
+ const [mountBump, setMountBump] = useState24(0);
27400
27577
  const prevTermWidthRef = useRef10(termWidth);
27401
27578
  if (prevTermWidthRef.current !== termWidth) {
27402
27579
  prevTermWidthRef.current = termWidth;
@@ -27407,12 +27584,12 @@ var ScrollableHistory = memo7(function ScrollableHistory2({
27407
27584
  prevVpRef.current = viewportRows;
27408
27585
  setMountBump(0);
27409
27586
  }
27410
- const [, setMeasureTick] = useState23(0);
27587
+ const [, setMeasureTick] = useState24(0);
27411
27588
  const geometry = {
27412
27589
  cache: heightCache,
27413
27590
  groupCount: groupedEntries.length,
27414
27591
  viewportRows: vp,
27415
- tailRows: toolTailHeight
27592
+ tailRows: toolTailHeight + assistantTailHeight
27416
27593
  };
27417
27594
  const groupIndexById = useMemo10(() => {
27418
27595
  const indexes = /* @__PURE__ */ new Map();
@@ -27481,12 +27658,13 @@ var ScrollableHistory = memo7(function ScrollableHistory2({
27481
27658
  historyTotalRows: totalRows
27482
27659
  });
27483
27660
  const offsetFromBottom = scrolled ? Math.max(0, maxTopRow(geometry) - anchorTopRow(geometry, effectiveAnchor)) : 0;
27661
+ const mountedTailRows = plan.mountTail ? toolTailHeight + assistantTailHeight : 0;
27484
27662
  const copyRegistry = buildCopyRegistry({
27485
27663
  renderGroups,
27486
27664
  heightCache,
27487
27665
  scrolled,
27488
27666
  clip: clip2,
27489
- tailRows: plan.mountTail ? toolTailHeight : 0,
27667
+ tailRows: mountedTailRows,
27490
27668
  viewportRows: vp,
27491
27669
  iconCol: termWidth,
27492
27670
  showModelReasoning,
@@ -27500,7 +27678,7 @@ var ScrollableHistory = memo7(function ScrollableHistory2({
27500
27678
  heightCache,
27501
27679
  scrolled,
27502
27680
  clip: clip2,
27503
- tailRows: plan.mountTail ? toolTailHeight : 0,
27681
+ tailRows: mountedTailRows,
27504
27682
  viewportRows: vp,
27505
27683
  showModelReasoning
27506
27684
  });
@@ -27642,6 +27820,13 @@ var ScrollableHistory = memo7(function ScrollableHistory2({
27642
27820
  startedAt: toolStream.startedAt,
27643
27821
  termWidth
27644
27822
  }
27823
+ ) : null,
27824
+ plan.mountTail && assistantTail ? /* @__PURE__ */ jsx97(
27825
+ AssistantStreamBox,
27826
+ {
27827
+ text: assistantTail,
27828
+ termWidth
27829
+ }
27645
27830
  ) : null
27646
27831
  ] })
27647
27832
  }
@@ -27662,7 +27847,7 @@ var ScrollableHistory = memo7(function ScrollableHistory2({
27662
27847
 
27663
27848
  // src/hooks/use-sidebar-panel-data.ts
27664
27849
  import { getProcessRegistry as getProcessRegistry3 } from "@wrongstack/tools";
27665
- import { useEffect as useEffect26, useState as useState24 } from "react";
27850
+ import { useEffect as useEffect26, useState as useState25 } from "react";
27666
27851
  function sameList(a, b, eq) {
27667
27852
  if (a === b) return true;
27668
27853
  if (a.length !== b.length) return false;
@@ -27672,7 +27857,7 @@ function sameList(a, b, eq) {
27672
27857
  return true;
27673
27858
  }
27674
27859
  function useSidebarProcessList(enabled = true) {
27675
- const [data, setData] = useState24({ activeCount: 0, totalCount: 0, processes: [] });
27860
+ const [data, setData] = useState25({ activeCount: 0, totalCount: 0, processes: [] });
27676
27861
  useEffect26(() => {
27677
27862
  if (!enabled) return;
27678
27863
  const read = () => {
@@ -27700,7 +27885,7 @@ function useSidebarProcessList(enabled = true) {
27700
27885
  return data;
27701
27886
  }
27702
27887
  function useSidebarConnections(projectRoot, enabled = true) {
27703
- const [connections, setConnections] = useState24([]);
27888
+ const [connections, setConnections] = useState25([]);
27704
27889
  useEffect26(() => {
27705
27890
  if (!enabled) return;
27706
27891
  let cancelled = false;
@@ -27740,7 +27925,7 @@ function setProxyData(setData, next) {
27740
27925
  );
27741
27926
  }
27742
27927
  function useSidebarWrongProxy(url, enabled = true) {
27743
- const [data, setData] = useState24(null);
27928
+ const [data, setData] = useState25(null);
27744
27929
  useEffect26(() => {
27745
27930
  if (!enabled || !url) {
27746
27931
  setData(null);
@@ -27809,7 +27994,7 @@ function useSidebarWrongProxy(url, enabled = true) {
27809
27994
  return data;
27810
27995
  }
27811
27996
  function useSidebarKanban(projectRoot, enabled = true) {
27812
- const [data, setData] = useState24({ columns: [], totalActive: 0, activeCardTitles: [] });
27997
+ const [data, setData] = useState25({ columns: [], totalActive: 0, activeCardTitles: [] });
27813
27998
  useEffect26(() => {
27814
27999
  if (!enabled) return;
27815
28000
  let cancelled = false;
@@ -27935,6 +28120,7 @@ function AppView({ host, runtime }) {
27935
28120
  {
27936
28121
  entries: state.entries,
27937
28122
  toolStream: state.toolStream,
28123
+ streamingText: state.streamingText,
27938
28124
  viewportRows: state.viewportRows,
27939
28125
  maxWidth: mainColumnWidth,
27940
28126
  controllerRef: historyScrollRef,
@@ -40536,7 +40722,7 @@ function handleCollabDone(event, dispatch, stateRef) {
40536
40722
  }
40537
40723
 
40538
40724
  // src/hooks/use-enhance-runtime-state.ts
40539
- import { useEffect as useEffect37, useRef as useRef20, useState as useState25 } from "react";
40725
+ import { useEffect as useEffect37, useRef as useRef20, useState as useState26 } from "react";
40540
40726
  function useEnhanceRuntimeState({
40541
40727
  enhanceEnabled,
40542
40728
  midRunSendPicker
@@ -40549,11 +40735,11 @@ function useEnhanceRuntimeState({
40549
40735
  const enhanceAbortRef = useRef20(null);
40550
40736
  const enhanceCancelledRef = useRef20(false);
40551
40737
  const enhanceOriginalRef = useRef20("");
40552
- const [enhanceCountdown, setEnhanceCountdown] = useState25(null);
40553
- const [enhanceStartedAt, setEnhanceStartedAt] = useState25(null);
40554
- const [enhanceDurationMs, setEnhanceDurationMs] = useState25(null);
40555
- const [refineProviderId, setRefineProviderId] = useState25(null);
40556
- const [refineModel, setRefineModel] = useState25(null);
40738
+ const [enhanceCountdown, setEnhanceCountdown] = useState26(null);
40739
+ const [enhanceStartedAt, setEnhanceStartedAt] = useState26(null);
40740
+ const [enhanceDurationMs, setEnhanceDurationMs] = useState26(null);
40741
+ const [refineProviderId, setRefineProviderId] = useState26(null);
40742
+ const [refineModel, setRefineModel] = useState26(null);
40557
40743
  return {
40558
40744
  enhanceEnabledRef,
40559
40745
  midRunSendPickerRef,
@@ -40894,7 +41080,7 @@ function fileReadContract(filePath, bytes) {
40894
41080
 
40895
41081
  // src/hooks/use-git-session-status.ts
40896
41082
  import { watchProjectTree } from "@wrongstack/core/utils";
40897
- import { useEffect as useEffect40, useRef as useRef22, useState as useState26 } from "react";
41083
+ import { useEffect as useEffect40, useRef as useRef22, useState as useState27 } from "react";
40898
41084
 
40899
41085
  // src/git-info.ts
40900
41086
  import { spawn } from "node:child_process";
@@ -40991,7 +41177,7 @@ function useGitSessionStatus({
40991
41177
  setSessionCount,
40992
41178
  hiddenItems = []
40993
41179
  }) {
40994
- const [gitInfo, setGitInfo] = useState26(null);
41180
+ const [gitInfo, setGitInfo] = useState27(null);
40995
41181
  const previousBranchRef = useRef22(null);
40996
41182
  const gitHidden = hiddenItems.includes("git");
40997
41183
  useEffect40(() => {
@@ -41086,7 +41272,7 @@ function useHelpPanel(dispatch, slashRegistry) {
41086
41272
  // src/hooks/use-history-archive.ts
41087
41273
  import * as fsp2 from "node:fs/promises";
41088
41274
  import * as path6 from "node:path";
41089
- import { useCallback as useCallback16, useEffect as useEffect41, useRef as useRef23, useState as useState27 } from "react";
41275
+ import { useCallback as useCallback16, useEffect as useEffect41, useRef as useRef23, useState as useState28 } from "react";
41090
41276
 
41091
41277
  // src/history-archive.ts
41092
41278
  import * as fsp from "node:fs/promises";
@@ -41248,7 +41434,7 @@ function useHistoryArchive({
41248
41434
  const loadingRef = useRef23(false);
41249
41435
  const entriesRef = useRef23(entries);
41250
41436
  entriesRef.current = entries;
41251
- const [archiveGeneration, setArchiveGeneration] = useState27(0);
41437
+ const [archiveGeneration, setArchiveGeneration] = useState28(0);
41252
41438
  useEffect41(() => {
41253
41439
  if (!sessionsDir || !sessionId) return;
41254
41440
  let disposed = false;
@@ -41349,14 +41535,14 @@ function useHistoryCopyNotice(dispatch) {
41349
41535
  }
41350
41536
 
41351
41537
  // src/hooks/use-history-viewport-sync.ts
41352
- import { useEffect as useEffect43, useLayoutEffect as useLayoutEffect2, useRef as useRef25, useState as useState28 } from "react";
41538
+ import { useEffect as useEffect43, useLayoutEffect as useLayoutEffect2, useRef as useRef25, useState as useState29 } from "react";
41353
41539
  function useHistoryViewportSync(input) {
41354
41540
  const { stdoutRows, viewportRows, setViewportRows } = input;
41355
41541
  const bottomRegionRef = useRef25(null);
41356
41542
  const statusBarWrapRef = useRef25(null);
41357
41543
  const belowStatusBarRef = useRef25(null);
41358
- const [termRows, setTermRows] = useState28(stdoutRows ?? 24);
41359
- const [statusBarRows, setStatusBarRows] = useState28(2);
41544
+ const [termRows, setTermRows] = useState29(stdoutRows ?? 24);
41545
+ const [statusBarRows, setStatusBarRows] = useState29(2);
41360
41546
  useEffect43(() => {
41361
41547
  const handleResize = () => setTermRows(process.stdout.rows ?? 24);
41362
41548
  process.stdout.prependListener("resize", handleResize);
@@ -41700,9 +41886,9 @@ function useInterruptLadder({
41700
41886
  }
41701
41887
 
41702
41888
  // src/hooks/use-kanban-board-focus.ts
41703
- import { useRef as useRef29, useState as useState29 } from "react";
41889
+ import { useRef as useRef29, useState as useState30 } from "react";
41704
41890
  function useKanbanBoardFocus() {
41705
- const [focusedBoardId, setFocusedBoardId] = useState29(null);
41891
+ const [focusedBoardId, setFocusedBoardId] = useState30(null);
41706
41892
  const boardFocusRef = useRef29(null);
41707
41893
  if (!boardFocusRef.current) {
41708
41894
  boardFocusRef.current = {
@@ -41747,9 +41933,9 @@ function useLiveSettingsState({
41747
41933
  }
41748
41934
 
41749
41935
  // src/hooks/use-live-todos.ts
41750
- import { useEffect as useEffect48, useState as useState30 } from "react";
41936
+ import { useEffect as useEffect48, useState as useState31 } from "react";
41751
41937
  function useLiveTodos(context) {
41752
- const [todos, setTodos] = useState30(() => [...context.todos]);
41938
+ const [todos, setTodos] = useState31(() => [...context.todos]);
41753
41939
  useEffect48(() => {
41754
41940
  setTodos([...context.todos]);
41755
41941
  return context.state.onChange((change) => {
@@ -41760,16 +41946,16 @@ function useLiveTodos(context) {
41760
41946
  }
41761
41947
 
41762
41948
  // src/hooks/use-mailbox-view-model.ts
41763
- import { useEffect as useEffect49, useState as useState31 } from "react";
41949
+ import { useEffect as useEffect49, useState as useState32 } from "react";
41764
41950
  function useMailboxViewModel(events) {
41765
- const [mailboxStatus, setMailboxStatus] = useState31({
41951
+ const [mailboxStatus, setMailboxStatus] = useState32({
41766
41952
  unread: 0,
41767
41953
  onlineAgents: 0,
41768
41954
  onlineClients: { tui: 0, webui: 0, repl: 0 }
41769
41955
  });
41770
- const [mailboxPanelOpen, setMailboxPanelOpen] = useState31(false);
41771
- const [mailboxMessages, setMailboxMessages] = useState31([]);
41772
- const [mailboxAgents, setMailboxAgents] = useState31([]);
41956
+ const [mailboxPanelOpen, setMailboxPanelOpen] = useState32(false);
41957
+ const [mailboxMessages, setMailboxMessages] = useState32([]);
41958
+ const [mailboxAgents, setMailboxAgents] = useState32([]);
41773
41959
  useEffect49(() => {
41774
41960
  const AGENT_ONLINE_TTL_MS = 12e4;
41775
41961
  const lastSeen = /* @__PURE__ */ new Map();
@@ -41983,11 +42169,11 @@ function useModelPickRequest(opts) {
41983
42169
  }
41984
42170
 
41985
42171
  // src/hooks/use-mouse-tracking.ts
41986
- import { useEffect as useEffect50, useRef as useRef31, useState as useState32 } from "react";
42172
+ import { useEffect as useEffect50, useRef as useRef31, useState as useState33 } from "react";
41987
42173
  function useMouseTracking(input) {
41988
42174
  const { initialMouseMode, initialNativeMouse, overlayOpen, protocol, stdout } = input;
41989
- const [mouseMode, setMouseMode] = useState32(initialMouseMode);
41990
- const [nativeMouse, setNativeMouse] = useState32(initialNativeMouse ?? false);
42175
+ const [mouseMode, setMouseMode] = useState33(initialMouseMode);
42176
+ const [nativeMouse, setNativeMouse] = useState33(initialNativeMouse ?? false);
41991
42177
  const mouseTrackingOn = shouldEnableMouseTracking({
41992
42178
  fullMode: mouseMode,
41993
42179
  overlayOpen,
@@ -42035,7 +42221,7 @@ import {
42035
42221
  useCallback as useCallback20,
42036
42222
  useEffect as useEffect51,
42037
42223
  useRef as useRef32,
42038
- useState as useState33
42224
+ useState as useState34
42039
42225
  } from "react";
42040
42226
  async function commitTodoTransition(agent, todos) {
42041
42227
  if (!agent?.ctx?.state) return null;
@@ -42080,10 +42266,10 @@ function useNextStepsAutoSubmit({
42080
42266
  clearDraft,
42081
42267
  runBlocksRef
42082
42268
  }) {
42083
- const [nextStepsAutoSubmitCountdown, setNextStepsAutoSubmitCountdown] = useState33(
42269
+ const [nextStepsAutoSubmitCountdown, setNextStepsAutoSubmitCountdown] = useState34(
42084
42270
  null
42085
42271
  );
42086
- const [nextStepsAutoSubmitLabel, setNextStepsAutoSubmitLabel] = useState33(null);
42272
+ const [nextStepsAutoSubmitLabel, setNextStepsAutoSubmitLabel] = useState34(null);
42087
42273
  const nextStepsAutoSubmitSuggestionRef = useRef32(null);
42088
42274
  const nextStepsAutoSubmitSourceRef = useRef32(null);
42089
42275
  const nextStepsAutoSubmitTodoIdRef = useRef32(null);
@@ -42093,7 +42279,7 @@ function useNextStepsAutoSubmit({
42093
42279
  const autoSubmitCapWarnedRef = useRef32(false);
42094
42280
  const autoSubmitLoopGuardRef = useRef32(createAutoProceedLoopGuard());
42095
42281
  const continuationAttemptTrackerRef = useRef32(createContinuationAttemptTracker());
42096
- const [nextStepsRecheck, setNextStepsRecheck] = useState33(0);
42282
+ const [nextStepsRecheck, setNextStepsRecheck] = useState34(0);
42097
42283
  useEffect51(() => {
42098
42284
  autoSubmitStreakRef.current = 0;
42099
42285
  autoSubmitCapWarnedRef.current = false;
@@ -43122,10 +43308,20 @@ function useProviderEventBridge({
43122
43308
  }
43123
43309
  };
43124
43310
  const flush = () => {
43311
+ if (activeRunGenerationRef.current !== sessionGenerationRef.current) {
43312
+ pendingToolStream = null;
43313
+ pendingDeltaRef.current = "";
43314
+ flushTimerRef.current = null;
43315
+ return;
43316
+ }
43125
43317
  if (pendingToolStream) {
43126
43318
  dispatch({ type: "toolStreamAppend", ...pendingToolStream });
43127
43319
  pendingToolStream = null;
43128
43320
  }
43321
+ if (pendingDeltaRef.current) {
43322
+ dispatch({ type: "streamDelta", delta: pendingDeltaRef.current });
43323
+ pendingDeltaRef.current = "";
43324
+ }
43129
43325
  recordStreamFlush();
43130
43326
  flushTimerRef.current = null;
43131
43327
  };
@@ -43142,12 +43338,16 @@ function useProviderEventBridge({
43142
43338
  MAX_ASSISTANT_STREAM_RETAINED_CHARS
43143
43339
  );
43144
43340
  appendStreamSegment("assistant", text);
43341
+ pendingDeltaRef.current += text;
43342
+ scheduleFlush();
43145
43343
  });
43146
43344
  const offThinking = events.on("provider.thinking_delta", (e) => {
43147
43345
  if (activeRunGenerationRef.current !== sessionGenerationRef.current) return;
43148
43346
  const text = e.text.replace(/\x1b?\[200~|\x1b?\[201~/g, "");
43149
43347
  recordProviderThinkingDelta(text.length);
43150
43348
  appendStreamSegment("thinking", text);
43349
+ pendingDeltaRef.current += text;
43350
+ scheduleFlush();
43151
43351
  });
43152
43352
  const offToolStart = events.on("tool.started", (e) => {
43153
43353
  dispatch({ type: "toolStarted", id: e.id, name: e.name });
@@ -43788,6 +43988,7 @@ function useSessionInterruptController({
43788
43988
  clearTimeout(flushTimerRef.current);
43789
43989
  flushTimerRef.current = null;
43790
43990
  }
43991
+ dispatch({ type: "streamReset" });
43791
43992
  dispatch({ type: "status", status: "aborting" });
43792
43993
  interrupted = true;
43793
43994
  }
@@ -44183,7 +44384,7 @@ function useStatusSyncInterval({
44183
44384
  // src/hooks/use-statusbar-view-model.ts
44184
44385
  import * as fs4 from "node:fs/promises";
44185
44386
  import { getContextBreakdown } from "@wrongstack/core/utils";
44186
- import { useEffect as useEffect59, useMemo as useMemo15, useState as useState34 } from "react";
44387
+ import { useEffect as useEffect59, useMemo as useMemo15, useState as useState35 } from "react";
44187
44388
 
44188
44389
  // src/context-fill.ts
44189
44390
  function resolveContextFill(inputs) {
@@ -44319,7 +44520,7 @@ function useStatusbarViewModel({
44319
44520
  const planHidden = hiddenItems.includes("plan");
44320
44521
  const taskHidden = hiddenItems.includes("tasks");
44321
44522
  const planPath = agent.ctx.meta["plan.path"];
44322
- const [planCounts, setPlanCounts] = useState34(null);
44523
+ const [planCounts, setPlanCounts] = useState35(null);
44323
44524
  useEffect59(() => {
44324
44525
  if (planHidden) return;
44325
44526
  if (typeof planPath !== "string" || !planPath) {
@@ -44366,7 +44567,7 @@ function useStatusbarViewModel({
44366
44567
  };
44367
44568
  }, [planPath, planHidden]);
44368
44569
  const taskPath = agent.ctx.meta["task.path"];
44369
- const [taskCounts, setTaskCounts] = useState34(null);
44570
+ const [taskCounts, setTaskCounts] = useState35(null);
44370
44571
  useEffect59(() => {
44371
44572
  if (taskHidden) return;
44372
44573
  if (typeof taskPath !== "string" || !taskPath) {
@@ -44577,7 +44778,7 @@ import * as fs5 from "node:fs/promises";
44577
44778
  import * as os from "node:os";
44578
44779
  import { loadGoal } from "@wrongstack/core/storage";
44579
44780
  import { resolveWstackPaths as resolveWstackPaths5 } from "@wrongstack/core/utils";
44580
- import { useCallback as useCallback26, useEffect as useEffect63, useMemo as useMemo16, useRef as useRef39, useState as useState35 } from "react";
44781
+ import { useCallback as useCallback26, useEffect as useEffect63, useMemo as useMemo16, useRef as useRef39, useState as useState36 } from "react";
44581
44782
 
44582
44783
  // src/heap-watchdog.ts
44583
44784
  import {
@@ -44622,7 +44823,7 @@ function useTuiActivity({
44622
44823
  builderRef
44623
44824
  }) {
44624
44825
  recordTuiAppRender();
44625
- const [rolledThinkingWord, setRolledThinkingWord] = useState35(() => pickRandomTuiThinkingWord());
44826
+ const [rolledThinkingWord, setRolledThinkingWord] = useState36(() => pickRandomTuiThinkingWord());
44626
44827
  const thinkingWorking = status === "running" || status === "streaming";
44627
44828
  const prevThinkingWorkingRef = useRef39(false);
44628
44829
  useEffect63(() => {
@@ -44637,12 +44838,12 @@ function useTuiActivity({
44637
44838
  [fleet]
44638
44839
  );
44639
44840
  const startedAtRef = useRef39(Date.now());
44640
- const [nowTick, setNowTick] = useState35(Date.now());
44841
+ const [nowTick, setNowTick] = useState36(Date.now());
44641
44842
  useEffect63(() => {
44642
44843
  const timer = setInterval(() => setNowTick(Date.now()), 1e4);
44643
44844
  return () => clearInterval(timer);
44644
44845
  }, []);
44645
- const [workingTimeBase, setWorkingTimeBase] = useState35(0);
44846
+ const [workingTimeBase, setWorkingTimeBase] = useState36(0);
44646
44847
  const workingStartRef = useRef39(null);
44647
44848
  const prevStatusRef = useRef39(status);
44648
44849
  useEffect63(() => {
@@ -44658,7 +44859,7 @@ function useTuiActivity({
44658
44859
  }
44659
44860
  prevStatusRef.current = status;
44660
44861
  }, [status]);
44661
- const [fleetWorkingBase, setFleetWorkingBase] = useState35(0);
44862
+ const [fleetWorkingBase, setFleetWorkingBase] = useState36(0);
44662
44863
  const fleetWorkingStartRef = useRef39(null);
44663
44864
  const prevFleetRunningRef = useRef39(0);
44664
44865
  useEffect63(() => {
@@ -44885,22 +45086,22 @@ function useTuiControllers({
44885
45086
 
44886
45087
  // src/hooks/use-tui-environment-state.ts
44887
45088
  import { getIndexState as getIndexState2, getProcessRegistry as getProcessRegistry9, onIndexStateChange } from "@wrongstack/tools";
44888
- import { useEffect as useEffect65, useRef as useRef40, useState as useState37 } from "react";
45089
+ import { useEffect as useEffect65, useRef as useRef40, useState as useState38 } from "react";
44889
45090
 
44890
45091
  // src/hooks/use-statusline-state.ts
44891
- import { useState as useState36 } from "react";
45092
+ import { useState as useState37 } from "react";
44892
45093
  function useStatuslineState(opts) {
44893
- const [liveModel, setLiveModel] = useState36(opts.model);
44894
- const [liveProvider, setLiveProvider] = useState36(opts.provider ?? "agent");
44895
- const [activeMaxContext, setActiveMaxContext] = useState36(opts.effectiveMaxContext);
44896
- const [yoloLive, setYoloLive] = useState36(opts.yolo);
44897
- const [autonomyLive, setAutonomyLive] = useState36(opts.getAutonomy?.() ?? "off");
44898
- const [liveModeLabel, setLiveModeLabel] = useState36(opts.modeLabel ?? "");
44899
- const [hiddenItems, setHiddenItems] = useState36(
45094
+ const [liveModel, setLiveModel] = useState37(opts.model);
45095
+ const [liveProvider, setLiveProvider] = useState37(opts.provider ?? "agent");
45096
+ const [activeMaxContext, setActiveMaxContext] = useState37(opts.effectiveMaxContext);
45097
+ const [yoloLive, setYoloLive] = useState37(opts.yolo);
45098
+ const [autonomyLive, setAutonomyLive] = useState37(opts.getAutonomy?.() ?? "off");
45099
+ const [liveModeLabel, setLiveModeLabel] = useState37(opts.modeLabel ?? "");
45100
+ const [hiddenItems, setHiddenItems] = useState37(
44900
45101
  Array.isArray(opts.statuslineHiddenItems) ? [...opts.statuslineHiddenItems] : [...opts.statuslineHiddenItems]
44901
45102
  );
44902
- const [lines, setLines] = useState36(opts.statuslineLines ?? {});
44903
- const [sessionCount, setSessionCount] = useState36(0);
45103
+ const [lines, setLines] = useState37(opts.statuslineLines ?? {});
45104
+ const [sessionCount, setSessionCount] = useState37(0);
44904
45105
  return {
44905
45106
  liveModel,
44906
45107
  setLiveModel,
@@ -44940,8 +45141,8 @@ function useTuiEnvironmentState({
44940
45141
  setStatuslineHiddenItems,
44941
45142
  saveStatuslineHiddenItems
44942
45143
  }) {
44943
- const [memoryContextMonitor, setMemoryContextMonitor] = useState37(emptyMemoryContextMonitor);
44944
- const [memoryRecordTotal, setMemoryRecordTotal] = useState37();
45144
+ const [memoryContextMonitor, setMemoryContextMonitor] = useState38(emptyMemoryContextMonitor);
45145
+ const [memoryRecordTotal, setMemoryRecordTotal] = useState38();
44945
45146
  const memoryContextMonitorRef = useRef40(memoryContextMonitor);
44946
45147
  memoryContextMonitorRef.current = memoryContextMonitor;
44947
45148
  const memoryRecordTotalRef = useRef40(memoryRecordTotal);
@@ -44976,14 +45177,14 @@ function useTuiEnvironmentState({
44976
45177
  });
44977
45178
  const hiddenItemsRef = useRef40(statusline.hiddenItems);
44978
45179
  hiddenItemsRef.current = statusline.hiddenItems;
44979
- const [liveToolCount, setLiveToolCount] = useState37(toolCount);
45180
+ const [liveToolCount, setLiveToolCount] = useState38(toolCount);
44980
45181
  useEffect65(() => setLiveToolCount(toolCount), [toolCount]);
44981
- const [indexState, setIndexState] = useState37(() => getIndexState2());
45182
+ const [indexState, setIndexState] = useState38(() => getIndexState2());
44982
45183
  useEffect65(() => {
44983
45184
  setIndexState(getIndexState2());
44984
45185
  return onIndexStateChange(setIndexState);
44985
45186
  }, []);
44986
- const [breakerCountdown, setBreakerCountdown] = useState37(
45187
+ const [breakerCountdown, setBreakerCountdown] = useState38(
44987
45188
  () => getProcessRegistry9().getBreakerCountdown()
44988
45189
  );
44989
45190
  useEffect65(() => {
@@ -45869,6 +46070,11 @@ import {
45869
46070
  setDesignOverrides
45870
46071
  } from "@wrongstack/core/design";
45871
46072
  import { SKILL_LIMITS, stripFrontmatter } from "@wrongstack/core/skills";
46073
+ import {
46074
+ areSubagentsAllowed,
46075
+ isSubagentPolicyLocked,
46076
+ setSessionSubagentsAllowed
46077
+ } from "@wrongstack/core/coordination";
45872
46078
  import { toErrorMessage as toErrorMessage12 } from "@wrongstack/core/utils";
45873
46079
  import { useEffect as useEffect69 } from "react";
45874
46080
  var RESUME_PICKER_SESSIONS = 500;
@@ -45895,6 +46101,36 @@ function useTuiSlashCommands({
45895
46101
  listSessions,
45896
46102
  openPromptPicker
45897
46103
  }) {
46104
+ useEffect69(() => {
46105
+ const cmd = {
46106
+ name: "solo",
46107
+ description: "Control session-only subagents before the first message: /solo on|off|status.",
46108
+ async run(args) {
46109
+ const action = (args ?? "").trim().toLowerCase() || "status";
46110
+ const allowed = areSubagentsAllowed(agent.ctx);
46111
+ if (action === "status") {
46112
+ return {
46113
+ message: `Solo session is ${allowed ? "off" : "on"}${isSubagentPolicyLocked(agent.ctx) ? " (locked)" : ""}.`
46114
+ };
46115
+ }
46116
+ if (action !== "on" && action !== "off") {
46117
+ return { message: "Usage: /solo on|off|status" };
46118
+ }
46119
+ try {
46120
+ await setSessionSubagentsAllowed(agent.ctx, action === "off");
46121
+ return {
46122
+ message: action === "on" ? "Solo session enabled. Chimera, delegation, and background subagents are blocked." : "Solo session disabled. Subagents are allowed for this session."
46123
+ };
46124
+ } catch (err) {
46125
+ return { message: toErrorMessage12(err) };
46126
+ }
46127
+ }
46128
+ };
46129
+ return registerSlashCommandLifecycle(slashRegistry, cmd, {
46130
+ owner: "tui",
46131
+ official: true
46132
+ });
46133
+ }, [agent, slashRegistry]);
45898
46134
  useEffect69(() => {
45899
46135
  if (!getPickableProviders || !switchProviderAndModel) return;
45900
46136
  const cmd = {
@@ -46497,7 +46733,7 @@ Available chords:
46497
46733
 
46498
46734
  // src/hooks/use-working-dir-chip.ts
46499
46735
  import * as path8 from "node:path";
46500
- import { useEffect as useEffect70, useState as useState38 } from "react";
46736
+ import { useEffect as useEffect70, useState as useState39 } from "react";
46501
46737
  function formatWorkingDirChip(workingDir, projectRoot) {
46502
46738
  if (!workingDir || workingDir === projectRoot) return void 0;
46503
46739
  const impl = workingDir.includes("\\") || projectRoot.includes("\\") ? path8.win32 : path8;
@@ -46506,7 +46742,7 @@ function formatWorkingDirChip(workingDir, projectRoot) {
46506
46742
  return rel.replaceAll(impl.sep, "/");
46507
46743
  }
46508
46744
  function useWorkingDirChip(ctx, projectRoot) {
46509
- const [workingDirChip, setWorkingDirChip] = useState38(
46745
+ const [workingDirChip, setWorkingDirChip] = useState39(
46510
46746
  () => formatWorkingDirChip(ctx.workingDir, projectRoot)
46511
46747
  );
46512
46748
  useEffect70(() => {