@wrongstack/tui 1.0.17 → 1.0.19

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
@@ -25216,7 +25216,7 @@ var init_connections_health = __esm({
25216
25216
  });
25217
25217
 
25218
25218
  // src/app.tsx
25219
- var import_react154 = __toESM(require_react(), 1);
25219
+ var import_react156 = __toESM(require_react(), 1);
25220
25220
 
25221
25221
  // src/hooks/use-terminal-size.ts
25222
25222
  var import_react35 = __toESM(require_react(), 1);
@@ -36939,7 +36939,11 @@ function resolveSidebarLayout(state, termCols, panelPositionsInput, mailboxPanel
36939
36939
  };
36940
36940
  }
36941
36941
 
36942
+ // src/app-view.tsx
36943
+ var import_react86 = __toESM(require_react(), 1);
36944
+
36942
36945
  // src/app-status-region.tsx
36946
+ var import_react56 = __toESM(require_react(), 1);
36943
36947
  import { getProcessRegistry as getProcessRegistry2 } from "@wrongstack/tools";
36944
36948
 
36945
36949
  // src/components/agents-monitor.tsx
@@ -40556,6 +40560,7 @@ function auditKanbanBoard(board, options) {
40556
40560
  for (const task of board.tasks) {
40557
40561
  if (TERMINAL_STATUSES.has(task.status)) continue;
40558
40562
  addRequiredDetailIssues(issues, task, requireDueDate, managed);
40563
+ addParkedIssue(issues, task);
40559
40564
  addRunningIssue(issues, task, now, liveIdentities);
40560
40565
  addReviewIssue(issues, task, now, reviewStaleAfterMs);
40561
40566
  if (lifecycleOrder.length > 1) addLifecycleIssue(issues, task, lifecycleOrder);
@@ -40645,6 +40650,17 @@ function boardByteSize(board) {
40645
40650
  return 0;
40646
40651
  }
40647
40652
  }
40653
+ function addParkedIssue(issues, task) {
40654
+ const park = task.park;
40655
+ if (!park) return;
40656
+ pushIssue(
40657
+ issues,
40658
+ task,
40659
+ "parked-card",
40660
+ "warning",
40661
+ `Parked after ${park.attempts} refused completion${park.attempts === 1 ? "" : "s"}: ${park.reason}`
40662
+ );
40663
+ }
40648
40664
  function addRunningIssue(issues, task, now, liveIdentities) {
40649
40665
  const assignment = task.assignment;
40650
40666
  const running = task.status === "in_progress" || assignment?.status === "running";
@@ -43877,7 +43893,7 @@ function buildDetailedRails(p, opts) {
43877
43893
  // src/components/status-bar.tsx
43878
43894
  var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
43879
43895
  var STATUSLINE_SIDE_INSET = 1;
43880
- function StatusBar({
43896
+ var StatusBar = (0, import_react50.memo)(function StatusBar2({
43881
43897
  model,
43882
43898
  provider,
43883
43899
  version,
@@ -44186,7 +44202,7 @@ function StatusBar({
44186
44202
  },
44187
44203
  `sb-${stalenessGuard.renderNonce}`
44188
44204
  );
44189
- }
44205
+ });
44190
44206
 
44191
44207
  // src/components/plan-panel.tsx
44192
44208
  var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
@@ -44217,6 +44233,7 @@ function usePlanPanelData(projectRoot, sessionId, enabled = true) {
44217
44233
  const [loading, setLoading] = (0, import_react51.useState)(true);
44218
44234
  const [error, setError] = (0, import_react51.useState)(null);
44219
44235
  const [updatedAt, setUpdatedAt] = (0, import_react51.useState)(void 0);
44236
+ const lastFingerprintRef = (0, import_react51.useRef)("");
44220
44237
  const load = (0, import_react51.useCallback)(
44221
44238
  async (scope_, quiet = false) => {
44222
44239
  if (!quiet) setLoading(true);
@@ -44225,8 +44242,13 @@ function usePlanPanelData(projectRoot, sessionId, enabled = true) {
44225
44242
  const filePath = planFilePath(projectRoot, sessionId, scope_);
44226
44243
  let content;
44227
44244
  try {
44245
+ const stat5 = await fs3.stat(filePath);
44246
+ const fingerprint = `${scope_}:${stat5.mtimeMs}:${stat5.size}`;
44247
+ if (quiet && fingerprint === lastFingerprintRef.current) return;
44248
+ lastFingerprintRef.current = fingerprint;
44228
44249
  content = await fs3.readFile(filePath, "utf-8");
44229
44250
  } catch {
44251
+ lastFingerprintRef.current = "";
44230
44252
  setItems([]);
44231
44253
  setTitle2(void 0);
44232
44254
  setUpdatedAt(void 0);
@@ -45855,6 +45877,10 @@ function AppStatusRegion({
45855
45877
  const projectRoot = agent.ctx.projectRoot;
45856
45878
  const panelPositions = effectivePanelPositions(state, liveSettings);
45857
45879
  const routedToBottom = (id) => panelPositions[id] === "bottom";
45880
+ const effectiveHiddenItems = (0, import_react56.useMemo)(
45881
+ () => mergeComposerOwnedChips(hiddenItems),
45882
+ [hiddenItems]
45883
+ );
45858
45884
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
45859
45885
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Box2, { ref: statusBarWrapRef, flexDirection: "column", flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
45860
45886
  StatusBar,
@@ -45897,7 +45923,7 @@ function AppStatusRegion({
45897
45923
  workingDir: workingDirChip,
45898
45924
  subagentCount: visibleSubagentCount,
45899
45925
  processCount: getProcessRegistry2().activeCount,
45900
- hiddenItems: mergeComposerOwnedChips(hiddenItems),
45926
+ hiddenItems: effectiveHiddenItems,
45901
45927
  statuslineLines: lines,
45902
45928
  statuslineDensities: densities,
45903
45929
  statuslineOrder: order,
@@ -47471,16 +47497,16 @@ function BrainPanel({
47471
47497
  }
47472
47498
 
47473
47499
  // src/components/bug-hunt-continue-panel.tsx
47474
- var import_react56 = __toESM(require_react(), 1);
47500
+ var import_react57 = __toESM(require_react(), 1);
47475
47501
  var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
47476
47502
  function BugHuntContinuePanel({
47477
47503
  completedRounds,
47478
47504
  totalRounds,
47479
47505
  onDecision
47480
47506
  }) {
47481
- const [remaining, setRemaining] = import_react56.default.useState(30);
47482
- const decidedRef = import_react56.default.useRef(false);
47483
- const decide = import_react56.default.useCallback(
47507
+ const [remaining, setRemaining] = import_react57.default.useState(30);
47508
+ const decidedRef = import_react57.default.useRef(false);
47509
+ const decide = import_react57.default.useCallback(
47484
47510
  (decision) => {
47485
47511
  if (decidedRef.current) return;
47486
47512
  decidedRef.current = true;
@@ -47488,7 +47514,7 @@ function BugHuntContinuePanel({
47488
47514
  },
47489
47515
  [onDecision]
47490
47516
  );
47491
- import_react56.default.useEffect(() => {
47517
+ import_react57.default.useEffect(() => {
47492
47518
  const id = setInterval(() => {
47493
47519
  setRemaining((current) => {
47494
47520
  if (current <= 1) {
@@ -47646,7 +47672,7 @@ function ClearConfirmPanel({
47646
47672
  }
47647
47673
 
47648
47674
  // src/components/confirm-prompt.tsx
47649
- var import_react59 = __toESM(require_react(), 1);
47675
+ var import_react60 = __toESM(require_react(), 1);
47650
47676
  import { unifiedDiff, writeOut } from "@wrongstack/core/utils";
47651
47677
 
47652
47678
  // src/highlight.ts
@@ -48095,7 +48121,7 @@ function langFromPath(path13) {
48095
48121
  }
48096
48122
 
48097
48123
  // src/components/history/code-block.tsx
48098
- var import_react58 = __toESM(require_react(), 1);
48124
+ var import_react59 = __toESM(require_react(), 1);
48099
48125
  import {
48100
48126
  parseUnifiedDiffPreview
48101
48127
  } from "@wrongstack/tools/tool-diff";
@@ -48308,7 +48334,7 @@ function formatMatchHit(hit) {
48308
48334
  }
48309
48335
 
48310
48336
  // src/components/history/stream-box.tsx
48311
- var import_react57 = __toESM(require_react(), 1);
48337
+ var import_react58 = __toESM(require_react(), 1);
48312
48338
  var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
48313
48339
  var MAX_STREAM_DISPLAY_CHARS = 480;
48314
48340
  var MAX_STREAM_LINES = 8;
@@ -48328,7 +48354,7 @@ function toolStreamBoxHeight(name) {
48328
48354
  function toolPendingLineHeight() {
48329
48355
  return 1;
48330
48356
  }
48331
- var ToolPendingLine = import_react57.default.memo(function ToolPendingLine2({
48357
+ var ToolPendingLine = import_react58.default.memo(function ToolPendingLine2({
48332
48358
  name,
48333
48359
  startedAt,
48334
48360
  termWidth
@@ -48357,7 +48383,7 @@ function streamBoxRows(text, maxLines, contentWidth) {
48357
48383
  }
48358
48384
  return rows;
48359
48385
  }
48360
- var ToolStreamBox = import_react57.default.memo(function ToolStreamBox2({
48386
+ var ToolStreamBox = import_react58.default.memo(function ToolStreamBox2({
48361
48387
  name,
48362
48388
  text,
48363
48389
  startedAt,
@@ -48395,7 +48421,7 @@ var ToolStreamBox = import_react57.default.memo(function ToolStreamBox2({
48395
48421
  ))
48396
48422
  ] });
48397
48423
  });
48398
- var AssistantStreamBox = import_react57.default.memo(function AssistantStreamBox2({
48424
+ var AssistantStreamBox = import_react58.default.memo(function AssistantStreamBox2({
48399
48425
  text,
48400
48426
  termWidth
48401
48427
  }) {
@@ -50859,7 +50885,7 @@ function extractMultiFileDiffs(toolName, output, input) {
50859
50885
  }
50860
50886
  return previews.length > 0 ? previews : void 0;
50861
50887
  }
50862
- var CodeBlock = (0, import_react58.memo)(CodeBlockImpl);
50888
+ var CodeBlock = (0, import_react59.memo)(CodeBlockImpl);
50863
50889
 
50864
50890
  // src/components/confirm-prompt.tsx
50865
50891
  var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
@@ -50939,7 +50965,7 @@ function ConfirmPrompt({
50939
50965
  boundaryReason,
50940
50966
  writeTargets
50941
50967
  }) {
50942
- import_react59.default.useEffect(() => {
50968
+ import_react60.default.useEffect(() => {
50943
50969
  writeOut("\x07");
50944
50970
  }, []);
50945
50971
  use_input_default((input2, _key) => {
@@ -50981,7 +51007,7 @@ function ConfirmPrompt({
50981
51007
  ] }) : null,
50982
51008
  diff2 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Box2, { flexDirection: "column", marginY: 1, children: renderDiff(diff2, diffPath) }) : null,
50983
51009
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text2, { dimColor: true, children: "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" }),
50984
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Box2, { flexDirection: "row", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text2, { children: buttonLabels(suggestedPattern).map((l) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react59.default.Fragment, { children: [
51010
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Box2, { flexDirection: "row", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text2, { children: buttonLabels(suggestedPattern).map((l) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react60.default.Fragment, { children: [
50985
51011
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text2, { bold: true, color: BUTTON_COLOR[l.decision], children: l.bracket }),
50986
51012
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text2, { dimColor: true, children: l.rest })
50987
51013
  ] }, l.decision)) }) }),
@@ -50999,7 +51025,7 @@ function ConfirmPrompt({
50999
51025
  }
51000
51026
 
51001
51027
  // src/components/connections-panel.tsx
51002
- var import_react60 = __toESM(require_react(), 1);
51028
+ var import_react61 = __toESM(require_react(), 1);
51003
51029
  init_connections_health();
51004
51030
  var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
51005
51031
  var REFRESH_MS = 8e3;
@@ -51070,11 +51096,11 @@ function ConnectionsPanel({
51070
51096
  projectRoot,
51071
51097
  onClose
51072
51098
  }) {
51073
- const [report, setReport] = (0, import_react60.useState)(null);
51074
- const [loading, setLoading] = (0, import_react60.useState)(true);
51075
- const [error, setError] = (0, import_react60.useState)(null);
51076
- const cancelledRef = (0, import_react60.useRef)(false);
51077
- const fetch2 = (0, import_react60.useCallback)(async () => {
51099
+ const [report, setReport] = (0, import_react61.useState)(null);
51100
+ const [loading, setLoading] = (0, import_react61.useState)(true);
51101
+ const [error, setError] = (0, import_react61.useState)(null);
51102
+ const cancelledRef = (0, import_react61.useRef)(false);
51103
+ const fetch2 = (0, import_react61.useCallback)(async () => {
51078
51104
  try {
51079
51105
  const r = await collectConnectionsHealth(projectRoot);
51080
51106
  if (cancelledRef.current) return;
@@ -51087,7 +51113,7 @@ function ConnectionsPanel({
51087
51113
  if (!cancelledRef.current) setLoading(false);
51088
51114
  }
51089
51115
  }, [projectRoot]);
51090
- (0, import_react60.useEffect)(() => {
51116
+ (0, import_react61.useEffect)(() => {
51091
51117
  cancelledRef.current = false;
51092
51118
  void fetch2();
51093
51119
  const timer = setInterval(() => void fetch2(), REFRESH_MS);
@@ -51139,7 +51165,7 @@ function ConnectionsPanel({
51139
51165
  }
51140
51166
 
51141
51167
  // src/components/continue-confirm-panel.tsx
51142
- var import_react61 = __toESM(require_react(), 1);
51168
+ var import_react62 = __toESM(require_react(), 1);
51143
51169
  var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
51144
51170
  function continueAutoProceedSeconds(grounded, delayMs) {
51145
51171
  return grounded ? Math.max(1, Math.ceil(delayMs / 1e3)) : null;
@@ -51153,10 +51179,10 @@ function ContinueConfirmPanel({
51153
51179
  onDecision
51154
51180
  }) {
51155
51181
  const autoProceedSecs = continueAutoProceedSeconds(grounded, delayMs);
51156
- const remainingRef = import_react61.default.useRef(autoProceedSecs ?? 0);
51157
- const decideRef = import_react61.default.useRef(onDecision);
51182
+ const remainingRef = import_react62.default.useRef(autoProceedSecs ?? 0);
51183
+ const decideRef = import_react62.default.useRef(onDecision);
51158
51184
  decideRef.current = onDecision;
51159
- import_react61.default.useEffect(() => {
51185
+ import_react62.default.useEffect(() => {
51160
51186
  if (!grounded) return;
51161
51187
  const id = setInterval(() => {
51162
51188
  const r = remainingRef.current - 1;
@@ -51209,7 +51235,7 @@ function ContinueConfirmPanel({
51209
51235
  }
51210
51236
 
51211
51237
  // src/components/coordinator-panel.tsx
51212
- var import_react62 = __toESM(require_react(), 1);
51238
+ var import_react63 = __toESM(require_react(), 1);
51213
51239
  var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
51214
51240
  var KIND_COLOR = {
51215
51241
  goal: theme.accent,
@@ -51243,9 +51269,9 @@ function CoordinatorPanel({
51243
51269
  onClose
51244
51270
  }) {
51245
51271
  const size = useMonitorSize();
51246
- const [selectedGoal, setSelectedGoal] = (0, import_react62.useState)(0);
51272
+ const [selectedGoal, setSelectedGoal] = (0, import_react63.useState)(0);
51247
51273
  const { goals, timeline, knowledgeCount, healthy } = coordinator;
51248
- (0, import_react62.useEffect)(() => {
51274
+ (0, import_react63.useEffect)(() => {
51249
51275
  setSelectedGoal((value) => Math.min(value, Math.max(0, goals.length - 1)));
51250
51276
  }, [goals.length]);
51251
51277
  const shortcutsEnabled = usePanelShortcutsEnabled();
@@ -51455,7 +51481,7 @@ function DesignPicker({
51455
51481
  }
51456
51482
 
51457
51483
  // src/components/enhance-panel.tsx
51458
- var import_react63 = __toESM(require_react(), 1);
51484
+ var import_react64 = __toESM(require_react(), 1);
51459
51485
  var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
51460
51486
  function normalizePreviewText(text) {
51461
51487
  return text.replace(/\s+/g, " ").trim();
@@ -51641,12 +51667,12 @@ function EnhancePanel({
51641
51667
  const recommendedLabel = preferredDecision === "english" ? "RECOMMENDED (ENGLISH)" : "RECOMMENDED";
51642
51668
  const secondaryLabel = preferredDecision === "english" ? "ORIGINAL LANGUAGE" : "ENGLISH OPTION";
51643
51669
  const totalSecs = Math.max(1, Math.ceil(delayMs / 1e3));
51644
- const remainingRef = (0, import_react63.useRef)(totalSecs);
51645
- const decideRef = (0, import_react63.useRef)(onDecision);
51670
+ const remainingRef = (0, import_react64.useRef)(totalSecs);
51671
+ const decideRef = (0, import_react64.useRef)(onDecision);
51646
51672
  decideRef.current = onDecision;
51647
- const tickRef = (0, import_react63.useRef)(onTick);
51673
+ const tickRef = (0, import_react64.useRef)(onTick);
51648
51674
  tickRef.current = onTick;
51649
- (0, import_react63.useEffect)(() => {
51675
+ (0, import_react64.useEffect)(() => {
51650
51676
  tickRef.current?.(remainingRef.current);
51651
51677
  const id = setInterval(() => {
51652
51678
  const remaining = remainingRef.current - 1;
@@ -51933,7 +51959,7 @@ function FKeyPicker({ selected }) {
51933
51959
  }
51934
51960
 
51935
51961
  // src/components/fallback-overlay.tsx
51936
- var import_react64 = __toESM(require_react(), 1);
51962
+ var import_react65 = __toESM(require_react(), 1);
51937
51963
  var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
51938
51964
  function FallbackOverlay({
51939
51965
  from,
@@ -51944,15 +51970,15 @@ function FallbackOverlay({
51944
51970
  onChoose,
51945
51971
  onMove
51946
51972
  }) {
51947
- const [remaining, setRemaining] = (0, import_react64.useState)(Math.max(1, autoSwitchSeconds));
51948
- const resolvedRef = (0, import_react64.useRef)(false);
51949
- const selectedRef = (0, import_react64.useRef)(selected);
51973
+ const [remaining, setRemaining] = (0, import_react65.useState)(Math.max(1, autoSwitchSeconds));
51974
+ const resolvedRef = (0, import_react65.useRef)(false);
51975
+ const selectedRef = (0, import_react65.useRef)(selected);
51950
51976
  selectedRef.current = selected;
51951
- const candidatesRef = (0, import_react64.useRef)(candidates);
51977
+ const candidatesRef = (0, import_react65.useRef)(candidates);
51952
51978
  candidatesRef.current = candidates;
51953
- const onChooseRef = (0, import_react64.useRef)(onChoose);
51979
+ const onChooseRef = (0, import_react65.useRef)(onChoose);
51954
51980
  onChooseRef.current = onChoose;
51955
- (0, import_react64.useEffect)(() => {
51981
+ (0, import_react65.useEffect)(() => {
51956
51982
  const id = setInterval(() => {
51957
51983
  setRemaining((prev) => {
51958
51984
  if (prev <= 1) {
@@ -53212,7 +53238,7 @@ function PromptPicker({
53212
53238
  }
53213
53239
 
53214
53240
  // src/components/refine-countdown-panel.tsx
53215
- var import_react65 = __toESM(require_react(), 1);
53241
+ var import_react66 = __toESM(require_react(), 1);
53216
53242
  var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
53217
53243
  function RefineCountdownPanel({
53218
53244
  original,
@@ -53221,13 +53247,13 @@ function RefineCountdownPanel({
53221
53247
  providerId,
53222
53248
  model
53223
53249
  }) {
53224
- const [remaining, setRemaining] = (0, import_react65.useState)(Math.max(1, seconds));
53225
- const resolvedRef = (0, import_react65.useRef)(false);
53226
- const onDecisionRef = (0, import_react65.useRef)(onDecision);
53227
- (0, import_react65.useEffect)(() => {
53250
+ const [remaining, setRemaining] = (0, import_react66.useState)(Math.max(1, seconds));
53251
+ const resolvedRef = (0, import_react66.useRef)(false);
53252
+ const onDecisionRef = (0, import_react66.useRef)(onDecision);
53253
+ (0, import_react66.useEffect)(() => {
53228
53254
  onDecisionRef.current = onDecision;
53229
53255
  }, [onDecision]);
53230
- (0, import_react65.useEffect)(() => {
53256
+ (0, import_react66.useEffect)(() => {
53231
53257
  const id = setInterval(() => {
53232
53258
  setRemaining((prev) => {
53233
53259
  if (prev <= 1) {
@@ -53300,7 +53326,7 @@ function RefineCountdownPanel({
53300
53326
  }
53301
53327
 
53302
53328
  // src/components/refine-failure-panel.tsx
53303
- var import_react66 = __toESM(require_react(), 1);
53329
+ var import_react67 = __toESM(require_react(), 1);
53304
53330
  var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
53305
53331
  function filterRefineModels(models, query) {
53306
53332
  const normalized = query.trim().toLowerCase();
@@ -53322,10 +53348,10 @@ function RefineFailurePanel({
53322
53348
  onDecision
53323
53349
  }) {
53324
53350
  const columns = useColumns();
53325
- const [view, setView] = (0, import_react66.useState)("options");
53326
- const [cursor, setCursor] = (0, import_react66.useState)(0);
53327
- const [query, setQuery] = (0, import_react66.useState)("");
53328
- const filteredModels = (0, import_react66.useMemo)(() => filterRefineModels(models, query), [models, query]);
53351
+ const [view, setView] = (0, import_react67.useState)("options");
53352
+ const [cursor, setCursor] = (0, import_react67.useState)(0);
53353
+ const [query, setQuery] = (0, import_react67.useState)("");
53354
+ const filteredModels = (0, import_react67.useMemo)(() => filterRefineModels(models, query), [models, query]);
53329
53355
  const width = Math.max(30, columns - 4);
53330
53356
  const canPick = models.length > 0;
53331
53357
  const canFallback = !!fallbackRef;
@@ -53873,7 +53899,7 @@ function SendModePicker({
53873
53899
  }
53874
53900
 
53875
53901
  // src/components/settings-picker.tsx
53876
- var import_react67 = __toESM(require_react(), 1);
53902
+ var import_react68 = __toESM(require_react(), 1);
53877
53903
 
53878
53904
  // src/components/settings-picker-filter.ts
53879
53905
  function fuzzyMatch(haystack, needle) {
@@ -55031,7 +55057,7 @@ function SettingsPicker({
55031
55057
  for (let i = 0; i < rows.length; i++) {
55032
55058
  if (!rows[i]?.section) fieldRowIndex.push(i);
55033
55059
  }
55034
- (0, import_react67.useEffect)(() => {
55060
+ (0, import_react68.useEffect)(() => {
55035
55061
  onLayoutComputed?.({ rows, fieldRowIndex });
55036
55062
  });
55037
55063
  const { filterActive, rankedResults, filteredFieldIndices, highlightSegments } = buildSettingsFilterState(filter, SETTINGS_PICKER_JUMP_CHORDS);
@@ -55205,7 +55231,7 @@ function ShadowPanel({ shadow, hint }) {
55205
55231
  }
55206
55232
 
55207
55233
  // src/components/shell-command-warning.tsx
55208
- var import_react68 = __toESM(require_react(), 1);
55234
+ var import_react69 = __toESM(require_react(), 1);
55209
55235
  var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
55210
55236
  import { writeOut as writeOut2 } from "@wrongstack/core/utils";
55211
55237
  function truncateShellCommandWarningCommand(text, max = 80) {
@@ -55215,7 +55241,7 @@ function ShellCommandWarning({
55215
55241
  command,
55216
55242
  onDecision
55217
55243
  }) {
55218
- import_react68.default.useEffect(() => {
55244
+ import_react69.default.useEffect(() => {
55219
55245
  writeOut2("\x07");
55220
55246
  }, []);
55221
55247
  use_input_default((input, _key) => {
@@ -56630,9 +56656,9 @@ function AppViewPickers({
56630
56656
  }
56631
56657
 
56632
56658
  // src/react-wrap-truncate.ts
56633
- var import_react69 = __toESM(require_react(), 1);
56659
+ var import_react70 = __toESM(require_react(), 1);
56634
56660
  function isReactElement(value) {
56635
- return import_react69.default.isValidElement(value);
56661
+ return import_react70.default.isValidElement(value);
56636
56662
  }
56637
56663
  function truncateTextDeep(node) {
56638
56664
  if (node === null || node === void 0 || node === false || node === true) {
@@ -56645,7 +56671,7 @@ function truncateTextDeep(node) {
56645
56671
  return node.map((child, index) => {
56646
56672
  const walked = truncateTextDeep(child);
56647
56673
  if (isReactElement(walked) && walked.key === null) {
56648
- return import_react69.default.cloneElement(walked, { key: `wst-wrap-${index}` });
56674
+ return import_react70.default.cloneElement(walked, { key: `wst-wrap-${index}` });
56649
56675
  }
56650
56676
  return walked;
56651
56677
  });
@@ -56655,9 +56681,9 @@ function truncateTextDeep(node) {
56655
56681
  }
56656
56682
  const element = node;
56657
56683
  const type = element.type;
56658
- if (type === import_react69.default.Fragment) {
56684
+ if (type === import_react70.default.Fragment) {
56659
56685
  const child = element.props.children;
56660
- return import_react69.default.cloneElement(element, { ...element.props, children: truncateTextDeep(child) });
56686
+ return import_react70.default.cloneElement(element, { ...element.props, children: truncateTextDeep(child) });
56661
56687
  }
56662
56688
  const props = element.props;
56663
56689
  const nextProps = { ...props };
@@ -56667,7 +56693,7 @@ function truncateTextDeep(node) {
56667
56693
  if ("children" in props) {
56668
56694
  nextProps.children = truncateTextDeep(props.children);
56669
56695
  }
56670
- return import_react69.default.cloneElement(element, nextProps);
56696
+ return import_react70.default.cloneElement(element, nextProps);
56671
56697
  }
56672
56698
  function truncateTextChildren(node) {
56673
56699
  return truncateTextDeep(node);
@@ -56742,7 +56768,7 @@ function Card({
56742
56768
  }
56743
56769
 
56744
56770
  // src/components/sidebar-panel-frame.tsx
56745
- var import_react70 = __toESM(require_react(), 1);
56771
+ var import_react71 = __toESM(require_react(), 1);
56746
56772
  var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1);
56747
56773
  function trunc(s2, max) {
56748
56774
  return truncateDisplay(s2, max);
@@ -56896,7 +56922,7 @@ function SidebarCountsRow({
56896
56922
  ] }, `${c.label}-${i}`)) });
56897
56923
  }
56898
56924
  function getPillLabel(pill) {
56899
- if (import_react70.default.isValidElement(pill) && pill.type?.name === "SidebarStatusPill") {
56925
+ if (import_react71.default.isValidElement(pill) && pill.type?.name === "SidebarStatusPill") {
56900
56926
  const props = pill.props;
56901
56927
  return props.label ?? "";
56902
56928
  }
@@ -59102,7 +59128,7 @@ function AppViewSidebar({
59102
59128
  }
59103
59129
 
59104
59130
  // src/components/input.tsx
59105
- var import_react71 = __toESM(require_react(), 1);
59131
+ var import_react72 = __toESM(require_react(), 1);
59106
59132
 
59107
59133
  // src/fn-keys.ts
59108
59134
  function fnKey(data) {
@@ -59635,7 +59661,7 @@ var EMPTY_KEY = {
59635
59661
  home: false,
59636
59662
  end: false
59637
59663
  };
59638
- var Input = (0, import_react71.memo)(function Input2({
59664
+ var Input = (0, import_react72.memo)(function Input2({
59639
59665
  prompt = DEFAULT_INPUT_PROMPT,
59640
59666
  value,
59641
59667
  cursor,
@@ -59653,13 +59679,13 @@ var Input = (0, import_react71.memo)(function Input2({
59653
59679
  onKey,
59654
59680
  maxWidth
59655
59681
  }) {
59656
- const suppressInkEscRef = (0, import_react71.useRef)(false);
59657
- const suppressInkBackspaceRef = (0, import_react71.useRef)(false);
59658
- const suppressInkDeleteRef = (0, import_react71.useRef)(false);
59659
- const suppressInkCtrlLeftRef = (0, import_react71.useRef)(false);
59660
- const suppressInkCtrlRightRef = (0, import_react71.useRef)(false);
59661
- const suppressInkShiftEnterRef = (0, import_react71.useRef)(false);
59662
- const mousePartialRef = (0, import_react71.useRef)("");
59682
+ const suppressInkEscRef = (0, import_react72.useRef)(false);
59683
+ const suppressInkBackspaceRef = (0, import_react72.useRef)(false);
59684
+ const suppressInkDeleteRef = (0, import_react72.useRef)(false);
59685
+ const suppressInkCtrlLeftRef = (0, import_react72.useRef)(false);
59686
+ const suppressInkCtrlRightRef = (0, import_react72.useRef)(false);
59687
+ const suppressInkShiftEnterRef = (0, import_react72.useRef)(false);
59688
+ const mousePartialRef = (0, import_react72.useRef)("");
59663
59689
  use_input_default((input, key) => {
59664
59690
  if (disabled) {
59665
59691
  if (key.ctrl && (input === "c" || input === "C")) {
@@ -59698,7 +59724,7 @@ var Input = (0, import_react71.memo)(function Input2({
59698
59724
  onKey(input, key);
59699
59725
  });
59700
59726
  const { stdin } = use_stdin_default();
59701
- (0, import_react71.useEffect)(() => {
59727
+ (0, import_react72.useEffect)(() => {
59702
59728
  if (!stdin) return;
59703
59729
  let escTimer = null;
59704
59730
  const handleData = (data) => {
@@ -59827,18 +59853,18 @@ var Input = (0, import_react71.memo)(function Input2({
59827
59853
  }
59828
59854
  }
59829
59855
  }
59830
- const [vScroll, setVScroll] = (0, import_react71.useState)(0);
59831
- const vScrollRef = (0, import_react71.useRef)(vScroll);
59856
+ const [vScroll, setVScroll] = (0, import_react72.useState)(0);
59857
+ const vScrollRef = (0, import_react72.useRef)(vScroll);
59832
59858
  vScrollRef.current = vScroll;
59833
59859
  const clampedScroll = needsScroll ? Math.max(0, Math.min(vScroll, rows.length - MAX_VISIBLE_ROWS)) : 0;
59834
- (0, import_react71.useEffect)(() => {
59860
+ (0, import_react72.useEffect)(() => {
59835
59861
  if (!needsScroll || !onKey) return;
59836
59862
  const cur = vScrollRef.current;
59837
59863
  const clamped = Math.max(0, Math.min(cur, rows.length - MAX_VISIBLE_ROWS));
59838
59864
  if (cursorRow < clamped) setVScroll(cursorRow);
59839
59865
  else if (cursorRow >= clamped + MAX_VISIBLE_ROWS) setVScroll(cursorRow - MAX_VISIBLE_ROWS + 1);
59840
59866
  }, [cursorRow, needsScroll, onKey]);
59841
- (0, import_react71.useEffect)(() => {
59867
+ (0, import_react72.useEffect)(() => {
59842
59868
  if (!needsScroll && vScroll > 0) setVScroll(0);
59843
59869
  }, [needsScroll]);
59844
59870
  const visibleRows = needsScroll ? rows.slice(clampedScroll, clampedScroll + MAX_VISIBLE_ROWS) : rows;
@@ -59902,7 +59928,7 @@ var Input = (0, import_react71.memo)(function Input2({
59902
59928
  });
59903
59929
 
59904
59930
  // src/components/inspect-overlay.tsx
59905
- var import_react72 = __toESM(require_react(), 1);
59931
+ var import_react73 = __toESM(require_react(), 1);
59906
59932
 
59907
59933
  // src/components/history/copy-icon.ts
59908
59934
  var COPY_ICON = "\u274F";
@@ -60155,7 +60181,7 @@ function scrollbarThumbGeometry(totalRows, visibleRows, offset) {
60155
60181
  const clamped = Math.max(0, Math.min(offset, maxScroll));
60156
60182
  return { thumbStart: Math.round(clamped / maxScroll * travel), thumbLength };
60157
60183
  }
60158
- function InspectOverlay({
60184
+ var InspectOverlay = (0, import_react73.memo)(function InspectOverlay2({
60159
60185
  title,
60160
60186
  body,
60161
60187
  scroll,
@@ -60169,7 +60195,7 @@ function InspectOverlay({
60169
60195
  const { width, height } = inspectOverlaySize(termCols, viewportRows);
60170
60196
  const contentWidth = Math.max(8, width - 5);
60171
60197
  const bodyRows = Math.max(4, height - 4);
60172
- const lines = (0, import_react72.useMemo)(() => wrapInspectLines(body, contentWidth), [body, contentWidth]);
60198
+ const lines = (0, import_react73.useMemo)(() => wrapInspectLines(body, contentWidth), [body, contentWidth]);
60173
60199
  const maxScroll = Math.max(0, lines.length - bodyRows);
60174
60200
  const offset = Math.max(0, Math.min(scroll, maxScroll));
60175
60201
  const visible = lines.slice(offset, offset + bodyRows);
@@ -60242,10 +60268,10 @@ function InspectOverlay({
60242
60268
  )
60243
60269
  }
60244
60270
  );
60245
- }
60271
+ });
60246
60272
 
60247
60273
  // src/components/scrollable-history.tsx
60248
- var import_react83 = __toESM(require_react(), 1);
60274
+ var import_react84 = __toESM(require_react(), 1);
60249
60275
 
60250
60276
  // src/height-cache.ts
60251
60277
  var DEFAULT_ENTRY_HEIGHT = 3;
@@ -60848,9 +60874,9 @@ function snapshotTuiMemoryCounters() {
60848
60874
  }
60849
60875
 
60850
60876
  // src/components/entry-error-boundary.tsx
60851
- var import_react73 = __toESM(require_react(), 1);
60877
+ var import_react74 = __toESM(require_react(), 1);
60852
60878
  var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
60853
- var EntryErrorBoundary = class extends import_react73.Component {
60879
+ var EntryErrorBoundary = class extends import_react74.Component {
60854
60880
  state = { error: null };
60855
60881
  static getDerivedStateFromError(error) {
60856
60882
  return { error };
@@ -60883,7 +60909,7 @@ var EntryErrorBoundary = class extends import_react73.Component {
60883
60909
  };
60884
60910
 
60885
60911
  // src/components/history/tool-group.tsx
60886
- var import_react74 = __toESM(require_react(), 1);
60912
+ var import_react75 = __toESM(require_react(), 1);
60887
60913
  var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
60888
60914
  var MAX_TOOL_GROUP_ENTRIES = 12;
60889
60915
  var STRUCTURED_DIFF_TOOLS = /* @__PURE__ */ new Set([
@@ -61131,7 +61157,7 @@ function ToolGroupItem({
61131
61157
  metaStr ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text2, { dimColor: true, children: ` \xB7 ${metaStr}` }) : null
61132
61158
  ] });
61133
61159
  }
61134
- var ToolGroup = (0, import_react74.memo)(ToolGroupImpl);
61160
+ var ToolGroup = (0, import_react75.memo)(ToolGroupImpl);
61135
61161
 
61136
61162
  // src/components/history/copy-registry.ts
61137
61163
  function buildCopyRegistry(opts) {
@@ -61186,7 +61212,7 @@ function buildCopyRegistry(opts) {
61186
61212
  }
61187
61213
 
61188
61214
  // src/components/history/entry.tsx
61189
- var import_react79 = __toESM(require_react(), 1);
61215
+ var import_react80 = __toESM(require_react(), 1);
61190
61216
  import { hasOpenTodos } from "@wrongstack/core/utils";
61191
61217
  import { parseNextSteps } from "@wrongstack/tools/next-steps";
61192
61218
 
@@ -61199,10 +61225,10 @@ var MEMORY_GATE_DEFAULTS = {
61199
61225
  };
61200
61226
 
61201
61227
  // src/components/history/assistant.tsx
61202
- var import_react76 = __toESM(require_react(), 1);
61228
+ var import_react77 = __toESM(require_react(), 1);
61203
61229
 
61204
61230
  // src/markdown.tsx
61205
- var import_react75 = __toESM(require_react(), 1);
61231
+ var import_react76 = __toESM(require_react(), 1);
61206
61232
 
61207
61233
  // src/markdown-table.ts
61208
61234
  import { expectDefined as expectDefined3 } from "@wrongstack/core/utils";
@@ -61644,7 +61670,7 @@ function MarkdownViewImpl({
61644
61670
  }
61645
61671
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Box2, { flexDirection: "column", width: tableBudget, children: rows });
61646
61672
  }
61647
- var MarkdownView = (0, import_react75.memo)(MarkdownViewImpl);
61673
+ var MarkdownView = (0, import_react76.memo)(MarkdownViewImpl);
61648
61674
 
61649
61675
  // src/components/history/assistant.tsx
61650
61676
  var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
@@ -61704,12 +61730,12 @@ function AssistantBodyImpl({
61704
61730
  )
61705
61731
  ) });
61706
61732
  }
61707
- var AssistantBody = (0, import_react76.memo)(AssistantBodyImpl);
61733
+ var AssistantBody = (0, import_react77.memo)(AssistantBodyImpl);
61708
61734
 
61709
61735
  // src/hooks/use-active-theme.ts
61710
- var import_react77 = __toESM(require_react(), 1);
61736
+ var import_react78 = __toESM(require_react(), 1);
61711
61737
  function useActiveTheme() {
61712
- (0, import_react77.useSyncExternalStore)(subscribeToTheme, getActiveThemeName, getActiveThemeName);
61738
+ (0, import_react78.useSyncExternalStore)(subscribeToTheme, getActiveThemeName, getActiveThemeName);
61713
61739
  return getActiveTheme();
61714
61740
  }
61715
61741
 
@@ -62060,7 +62086,7 @@ function Banner({
62060
62086
  }
62061
62087
 
62062
62088
  // src/components/history/tool-entry.tsx
62063
- var import_react78 = __toESM(require_react(), 1);
62089
+ var import_react79 = __toESM(require_react(), 1);
62064
62090
 
62065
62091
  // src/components/history/sage-memory-block.tsx
62066
62092
  var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
@@ -62216,7 +62242,7 @@ function ToolEntry({
62216
62242
  mutation,
62217
62243
  fullOutputLines,
62218
62244
  fullOutputTruncated
62219
- } = (0, import_react78.useMemo)(() => {
62245
+ } = (0, import_react79.useMemo)(() => {
62220
62246
  const argSummary2 = formatToolArgs(entry2.name, entry2.input);
62221
62247
  const {
62222
62248
  cleanOutput: outputForFormatting,
@@ -62496,11 +62522,11 @@ function AnimatedNextStepText({
62496
62522
  deadlineMs
62497
62523
  }) {
62498
62524
  const safeText = sanitizeTerminalText(text);
62499
- const glyphs2 = (0, import_react79.useMemo)(() => Array.from(safeText), [safeText]);
62500
- const [frameNowMs, setFrameNowMs] = (0, import_react79.useState)(Date.now);
62525
+ const glyphs2 = (0, import_react80.useMemo)(() => Array.from(safeText), [safeText]);
62526
+ const [frameNowMs, setFrameNowMs] = (0, import_react80.useState)(Date.now);
62501
62527
  const litGlyphs = nextStepSweepGlyphCount(glyphs2.length, deadlineMs, frameNowMs);
62502
62528
  const sweep = nextStepSweepParts(safeText, deadlineMs, frameNowMs);
62503
- (0, import_react79.useEffect)(() => {
62529
+ (0, import_react80.useEffect)(() => {
62504
62530
  let timeout;
62505
62531
  const update = () => {
62506
62532
  const now = Date.now();
@@ -62523,7 +62549,7 @@ function AnimatedNextStepText({
62523
62549
  ] }) : null
62524
62550
  ] });
62525
62551
  }
62526
- var Entry = import_react79.default.memo(function Entry2({
62552
+ var Entry = import_react80.default.memo(function Entry2({
62527
62553
  entry: entry2,
62528
62554
  termWidth,
62529
62555
  termHeight,
@@ -62539,11 +62565,11 @@ var Entry = import_react79.default.memo(function Entry2({
62539
62565
  }) {
62540
62566
  const openTodos = hasOpenTodos(todos);
62541
62567
  const isFinalTurnEntry = entry2.kind === "assistant" && entry2.final === true;
62542
- const nextSteps = (0, import_react79.useMemo)(() => {
62568
+ const nextSteps = (0, import_react80.useMemo)(() => {
62543
62569
  if (entry2.kind !== "assistant") return { steps: [], stripped: "" };
62544
62570
  return parseNextSteps(entry2.text, true);
62545
62571
  }, [entry2.kind, entry2.text]);
62546
- (0, import_react79.useEffect)(() => {
62572
+ (0, import_react80.useEffect)(() => {
62547
62573
  if (!setSuggestions) return;
62548
62574
  if (entry2.kind !== "assistant") return;
62549
62575
  if (openTodos) return;
@@ -62831,7 +62857,7 @@ function createSelectionBandStore() {
62831
62857
  }
62832
62858
 
62833
62859
  // src/components/history/use-history-controller.ts
62834
- var import_react80 = __toESM(require_react(), 1);
62860
+ var import_react81 = __toESM(require_react(), 1);
62835
62861
 
62836
62862
  // src/clipboard.ts
62837
62863
  import {
@@ -62955,13 +62981,13 @@ function useHistoryController(opts) {
62955
62981
  controllerRef,
62956
62982
  onToolResultViewChange
62957
62983
  } = opts;
62958
- const geometryRef = (0, import_react80.useRef)(geometry);
62984
+ const geometryRef = (0, import_react81.useRef)(geometry);
62959
62985
  geometryRef.current = geometry;
62960
- const effectiveAnchorRef = (0, import_react80.useRef)(effectiveAnchor);
62986
+ const effectiveAnchorRef = (0, import_react81.useRef)(effectiveAnchor);
62961
62987
  effectiveAnchorRef.current = effectiveAnchor;
62962
- const groupIdsRef = (0, import_react80.useRef)(groupIds);
62988
+ const groupIdsRef = (0, import_react81.useRef)(groupIds);
62963
62989
  groupIdsRef.current = groupIds;
62964
- const publishBand = (0, import_react80.useCallback)(() => {
62990
+ const publishBand = (0, import_react81.useCallback)(() => {
62965
62991
  const cur = selectionRef.current;
62966
62992
  selectionBandStore?.publish(
62967
62993
  cur.anchor !== null && cur.head !== null && cur.inProgress ? bandFromSelection(cur.anchor, cur.head) : null
@@ -62978,7 +63004,7 @@ function useHistoryController(opts) {
62978
63004
  const gutter = gutterWidthForEntry(hit?.entryId);
62979
63005
  return gutter === 0 ? col : Math.max(0, col - gutter);
62980
63006
  };
62981
- const applyAnchor = (0, import_react80.useCallback)(
63007
+ const applyAnchor = (0, import_react81.useCallback)(
62982
63008
  (next) => {
62983
63009
  const ids = groupIdsRef.current;
62984
63010
  const nextId = next ? ids[next.index] : void 0;
@@ -62991,7 +63017,7 @@ function useHistoryController(opts) {
62991
63017
  },
62992
63018
  [selectionRef, publishBand, setAnchor, setMountBump]
62993
63019
  );
62994
- const controller = (0, import_react80.useMemo)(
63020
+ const controller = (0, import_react81.useMemo)(
62995
63021
  () => ({
62996
63022
  scrollBy: (deltaUp) => {
62997
63023
  applyAnchor(scrollAnchorBy(geometryRef.current, effectiveAnchorRef.current, deltaUp));
@@ -63149,7 +63175,7 @@ function useHistoryController(opts) {
63149
63175
  onToolResultViewChange
63150
63176
  ]
63151
63177
  );
63152
- (0, import_react80.useEffect)(() => {
63178
+ (0, import_react81.useEffect)(() => {
63153
63179
  if (!controllerRef) return void 0;
63154
63180
  controllerRef.current = controller;
63155
63181
  return () => {
@@ -63166,9 +63192,9 @@ function useHistoryController(opts) {
63166
63192
  }
63167
63193
 
63168
63194
  // src/components/history/index.tsx
63169
- var import_react81 = __toESM(require_react(), 1);
63195
+ var import_react82 = __toESM(require_react(), 1);
63170
63196
  var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
63171
- var History = (0, import_react81.memo)(function History2({
63197
+ var History = (0, import_react82.memo)(function History2({
63172
63198
  entries,
63173
63199
  generation,
63174
63200
  toolStream,
@@ -63185,12 +63211,12 @@ var History = (0, import_react81.memo)(function History2({
63185
63211
  }) {
63186
63212
  const termSize = useTerminalSize();
63187
63213
  const termWidth = termSize.columns;
63188
- const armedNextStepsEntryId = (0, import_react81.useMemo)(
63214
+ const armedNextStepsEntryId = (0, import_react82.useMemo)(
63189
63215
  () => findArmedNextStepsEntryId(entries, nextStepsAutoSubmitLabel),
63190
63216
  [entries, nextStepsAutoSubmitLabel]
63191
63217
  );
63192
63218
  const presentationKey = `w${termWidth}-mr${showModelReasoning}-tv${toolResultViewMode ?? "normal"}`;
63193
- const emissionRef = (0, import_react81.useRef)({
63219
+ const emissionRef = (0, import_react82.useRef)({
63194
63220
  generation: generation ?? 0,
63195
63221
  presentationKey,
63196
63222
  revision: 0,
@@ -63259,7 +63285,7 @@ var History = (0, import_react81.memo)(function History2({
63259
63285
  });
63260
63286
 
63261
63287
  // src/components/history/scrollbar-rail.tsx
63262
- var import_react82 = __toESM(require_react(), 1);
63288
+ var import_react83 = __toESM(require_react(), 1);
63263
63289
  var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1);
63264
63290
  var NO_BAND = createSelectionBandStore();
63265
63291
  function Scrollbar({
@@ -63270,7 +63296,7 @@ function Scrollbar({
63270
63296
  copiedEntryId,
63271
63297
  selectionBandStore = NO_BAND
63272
63298
  }) {
63273
- const band = (0, import_react82.useSyncExternalStore)(selectionBandStore.subscribe, selectionBandStore.getSnapshot);
63299
+ const band = (0, import_react83.useSyncExternalStore)(selectionBandStore.subscribe, selectionBandStore.getSnapshot);
63274
63300
  const { top: thumbTop, size: thumbSize, scrollable } = scrollbarThumb(rows, offset, total);
63275
63301
  const cells = [];
63276
63302
  for (let i = 0; i < rows; i++) {
@@ -63309,7 +63335,7 @@ function Scrollbar({
63309
63335
  var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1);
63310
63336
  var UNDERFILL_BUMP_ROWS = 16;
63311
63337
  var MAX_UNDERFILL_BUMPS = 8;
63312
- var ScrollableHistory = (0, import_react83.memo)(function ScrollableHistory2({
63338
+ var ScrollableHistory = (0, import_react84.memo)(function ScrollableHistory2({
63313
63339
  entries,
63314
63340
  toolStream,
63315
63341
  streamingText,
@@ -63333,20 +63359,20 @@ var ScrollableHistory = (0, import_react83.memo)(function ScrollableHistory2({
63333
63359
  onToolResultViewChange
63334
63360
  }) {
63335
63361
  const { stdout } = use_stdout_default();
63336
- const resolveViewportWidth = (0, import_react83.useCallback)(() => {
63362
+ const resolveViewportWidth = (0, import_react84.useCallback)(() => {
63337
63363
  const raw = stdout?.columns ?? 80;
63338
63364
  return maxWidth ? Math.min(raw, maxWidth) : raw;
63339
63365
  }, [stdout, maxWidth]);
63340
- const [viewportWidth, setViewportWidth] = (0, import_react83.useState)(resolveViewportWidth);
63341
- const termWidth = (0, import_react83.useMemo)(
63366
+ const [viewportWidth, setViewportWidth] = (0, import_react84.useState)(resolveViewportWidth);
63367
+ const termWidth = (0, import_react84.useMemo)(
63342
63368
  () => Math.max(1, viewportWidth - SCROLLBAR_HIT_WIDTH),
63343
63369
  [viewportWidth]
63344
63370
  );
63345
- const armedNextStepsEntryId = (0, import_react83.useMemo)(
63371
+ const armedNextStepsEntryId = (0, import_react84.useMemo)(
63346
63372
  () => findArmedNextStepsEntryId(entries, nextStepsAutoSubmitLabel),
63347
63373
  [entries, nextStepsAutoSubmitLabel]
63348
63374
  );
63349
- (0, import_react83.useEffect)(() => {
63375
+ (0, import_react84.useEffect)(() => {
63350
63376
  const handleResize = () => {
63351
63377
  setViewportWidth(resolveViewportWidth());
63352
63378
  };
@@ -63360,37 +63386,37 @@ var ScrollableHistory = (0, import_react83.memo)(function ScrollableHistory2({
63360
63386
  const toolTailHeight = toolStream ? toolTail ? toolStreamBoxHeight(toolStream.name) : toolPendingLineHeight() : 0;
63361
63387
  const assistantTail = streamingText ? tailForDisplay(streamingText, MAX_STREAM_DISPLAY_CHARS) : "";
63362
63388
  const assistantTailHeight = assistantTail ? assistantStreamBoxHeight() : 0;
63363
- const viewModeForEntry = (0, import_react83.useCallback)(
63389
+ const viewModeForEntry = (0, import_react84.useCallback)(
63364
63390
  (entryId) => toolResultViewOverrides?.get(entryId) ?? toolResultViewMode,
63365
63391
  [toolResultViewMode, toolResultViewOverrides]
63366
63392
  );
63367
- const groupedEntries = (0, import_react83.useMemo)(
63393
+ const groupedEntries = (0, import_react84.useMemo)(
63368
63394
  () => groupEntries(entries, viewModeForEntry),
63369
63395
  [entries, viewModeForEntry]
63370
63396
  );
63371
- const groupIds = (0, import_react83.useMemo)(() => groupedEntries.map(renderGroupId), [groupedEntries]);
63397
+ const groupIds = (0, import_react84.useMemo)(() => groupedEntries.map(renderGroupId), [groupedEntries]);
63372
63398
  const groupIdsKey = groupIds.join(",");
63373
- const heightCacheRef = (0, import_react83.useRef)(null);
63399
+ const heightCacheRef = (0, import_react84.useRef)(null);
63374
63400
  if (heightCacheRef.current === null) heightCacheRef.current = new EntryHeightCache();
63375
63401
  const heightCache = heightCacheRef.current;
63376
- const selectionBandStoreRef = (0, import_react83.useRef)(null);
63402
+ const selectionBandStoreRef = (0, import_react84.useRef)(null);
63377
63403
  if (selectionBandStoreRef.current === null) {
63378
63404
  selectionBandStoreRef.current = createSelectionBandStore();
63379
63405
  }
63380
63406
  const selectionBandStore = selectionBandStoreRef.current;
63381
- const entryNodeRefs = (0, import_react83.useRef)(/* @__PURE__ */ new Map());
63382
- const measuredGroupIdsRef = (0, import_react83.useRef)(/* @__PURE__ */ new Set());
63383
- const copyHitsRef = (0, import_react83.useRef)([]);
63384
- const liveToolCopyHitRef = (0, import_react83.useRef)(null);
63385
- const mountedGroupSpansRef = (0, import_react83.useRef)([]);
63386
- const spansSignatureRef = (0, import_react83.useRef)("");
63387
- const selectionRef = (0, import_react83.useRef)({ anchor: null, head: null, inProgress: false });
63388
- const toolStreamRef = (0, import_react83.useRef)(toolStream);
63407
+ const entryNodeRefs = (0, import_react84.useRef)(/* @__PURE__ */ new Map());
63408
+ const measuredGroupIdsRef = (0, import_react84.useRef)(/* @__PURE__ */ new Set());
63409
+ const copyHitsRef = (0, import_react84.useRef)([]);
63410
+ const liveToolCopyHitRef = (0, import_react84.useRef)(null);
63411
+ const mountedGroupSpansRef = (0, import_react84.useRef)([]);
63412
+ const spansSignatureRef = (0, import_react84.useRef)("");
63413
+ const selectionRef = (0, import_react84.useRef)({ anchor: null, head: null, inProgress: false });
63414
+ const toolStreamRef = (0, import_react84.useRef)(toolStream);
63389
63415
  toolStreamRef.current = toolStream;
63390
- const entriesByIdRef = (0, import_react83.useRef)(/* @__PURE__ */ new Map());
63416
+ const entriesByIdRef = (0, import_react84.useRef)(/* @__PURE__ */ new Map());
63391
63417
  entriesByIdRef.current = new Map(entries.map((entry2) => [entry2.id, entry2]));
63392
- const preparedGroupIdsRef = (0, import_react83.useRef)(null);
63393
- const preparedEstimateWidthRef = (0, import_react83.useRef)(null);
63418
+ const preparedGroupIdsRef = (0, import_react84.useRef)(null);
63419
+ const preparedEstimateWidthRef = (0, import_react84.useRef)(null);
63394
63420
  const reasoningKey = showModelReasoning === false ? "|r0" : "";
63395
63421
  const sageKey = showSageMemoryInject === false ? "|s0" : "";
63396
63422
  const toolViewKey = entries.filter((entry2) => entry2.kind === "tool").map((entry2) => `${entry2.id}:${viewModeForEntry(entry2.id)}`).join(",");
@@ -63466,26 +63492,26 @@ var ScrollableHistory = (0, import_react83.memo)(function ScrollableHistory2({
63466
63492
  preparedEstimateWidthRef.current = termWidth;
63467
63493
  }
63468
63494
  const vp = Math.max(1, viewportRows);
63469
- const [anchor, setAnchor] = (0, import_react83.useState)(null);
63470
- const [mountBump, setMountBump] = (0, import_react83.useState)(0);
63471
- const prevTermWidthRef = (0, import_react83.useRef)(termWidth);
63495
+ const [anchor, setAnchor] = (0, import_react84.useState)(null);
63496
+ const [mountBump, setMountBump] = (0, import_react84.useState)(0);
63497
+ const prevTermWidthRef = (0, import_react84.useRef)(termWidth);
63472
63498
  if (prevTermWidthRef.current !== termWidth) {
63473
63499
  prevTermWidthRef.current = termWidth;
63474
63500
  setMountBump(0);
63475
63501
  }
63476
- const prevVpRef = (0, import_react83.useRef)(viewportRows);
63502
+ const prevVpRef = (0, import_react84.useRef)(viewportRows);
63477
63503
  if (prevVpRef.current !== viewportRows) {
63478
63504
  prevVpRef.current = viewportRows;
63479
63505
  setMountBump(0);
63480
63506
  }
63481
- const [, setMeasureTick] = (0, import_react83.useState)(0);
63507
+ const [, setMeasureTick] = (0, import_react84.useState)(0);
63482
63508
  const geometry = {
63483
63509
  cache: heightCache,
63484
63510
  groupCount: groupedEntries.length,
63485
63511
  viewportRows: vp,
63486
63512
  tailRows: toolTailHeight + assistantTailHeight
63487
63513
  };
63488
- const groupIndexById = (0, import_react83.useMemo)(() => {
63514
+ const groupIndexById = (0, import_react84.useMemo)(() => {
63489
63515
  const indexes = /* @__PURE__ */ new Map();
63490
63516
  groupIds.forEach((id, index) => {
63491
63517
  indexes.set(id, index);
@@ -63521,14 +63547,14 @@ var ScrollableHistory = (0, import_react83.memo)(function ScrollableHistory2({
63521
63547
  controllerRef,
63522
63548
  onToolResultViewChange
63523
63549
  });
63524
- const lastReportedScrolled = (0, import_react83.useRef)(null);
63525
- const onScrollInfoRef = (0, import_react83.useRef)(onScrollInfo);
63550
+ const lastReportedScrolled = (0, import_react84.useRef)(null);
63551
+ const onScrollInfoRef = (0, import_react84.useRef)(onScrollInfo);
63526
63552
  onScrollInfoRef.current = onScrollInfo;
63527
- const planStartIdxRef = (0, import_react83.useRef)(0);
63528
- const requestOlderFiredRef = (0, import_react83.useRef)(false);
63529
- const onRequestOlderEntriesRef = (0, import_react83.useRef)(onRequestOlderEntries);
63553
+ const planStartIdxRef = (0, import_react84.useRef)(0);
63554
+ const requestOlderFiredRef = (0, import_react84.useRef)(false);
63555
+ const onRequestOlderEntriesRef = (0, import_react84.useRef)(onRequestOlderEntries);
63530
63556
  onRequestOlderEntriesRef.current = onRequestOlderEntries;
63531
- (0, import_react83.useEffect)(() => {
63557
+ (0, import_react84.useEffect)(() => {
63532
63558
  if (lastReportedScrolled.current === scrolled) return;
63533
63559
  lastReportedScrolled.current = scrolled;
63534
63560
  onScrollInfoRef.current?.({ scrolled });
@@ -63586,7 +63612,7 @@ var ScrollableHistory = (0, import_react83.memo)(function ScrollableHistory2({
63586
63612
  spansSignatureRef.current = nextSignature;
63587
63613
  }
63588
63614
  mountedGroupSpansRef.current = nextSpans;
63589
- (0, import_react83.useLayoutEffect)(() => {
63615
+ (0, import_react84.useLayoutEffect)(() => {
63590
63616
  let changed = false;
63591
63617
  for (const group of renderGroups) {
63592
63618
  const gid = renderGroupId(group);
@@ -63753,7 +63779,7 @@ var ScrollableHistory = (0, import_react83.memo)(function ScrollableHistory2({
63753
63779
  });
63754
63780
 
63755
63781
  // src/hooks/use-sidebar-panel-data.ts
63756
- var import_react84 = __toESM(require_react(), 1);
63782
+ var import_react85 = __toESM(require_react(), 1);
63757
63783
  import { getProcessRegistry as getProcessRegistry3 } from "@wrongstack/tools";
63758
63784
  function sameList(a, b, eq) {
63759
63785
  if (a === b) return true;
@@ -63764,8 +63790,8 @@ function sameList(a, b, eq) {
63764
63790
  return true;
63765
63791
  }
63766
63792
  function useSidebarProcessList(enabled = true) {
63767
- const [data, setData] = (0, import_react84.useState)({ activeCount: 0, totalCount: 0, processes: [] });
63768
- (0, import_react84.useEffect)(() => {
63793
+ const [data, setData] = (0, import_react85.useState)({ activeCount: 0, totalCount: 0, processes: [] });
63794
+ (0, import_react85.useEffect)(() => {
63769
63795
  if (!enabled) return;
63770
63796
  const read = () => {
63771
63797
  const registry = getProcessRegistry3();
@@ -63792,8 +63818,8 @@ function useSidebarProcessList(enabled = true) {
63792
63818
  return data;
63793
63819
  }
63794
63820
  function useSidebarConnections(projectRoot, enabled = true) {
63795
- const [connections, setConnections] = (0, import_react84.useState)([]);
63796
- (0, import_react84.useEffect)(() => {
63821
+ const [connections, setConnections] = (0, import_react85.useState)([]);
63822
+ (0, import_react85.useEffect)(() => {
63797
63823
  if (!enabled) return;
63798
63824
  let cancelled = false;
63799
63825
  const poll = async () => {
@@ -63832,8 +63858,8 @@ function setProxyData(setData, next) {
63832
63858
  );
63833
63859
  }
63834
63860
  function useSidebarWrongProxy(url, enabled = true) {
63835
- const [data, setData] = (0, import_react84.useState)(null);
63836
- (0, import_react84.useEffect)(() => {
63861
+ const [data, setData] = (0, import_react85.useState)(null);
63862
+ (0, import_react85.useEffect)(() => {
63837
63863
  if (!enabled || !url) {
63838
63864
  setData(null);
63839
63865
  return;
@@ -63901,8 +63927,8 @@ function useSidebarWrongProxy(url, enabled = true) {
63901
63927
  return data;
63902
63928
  }
63903
63929
  function useSidebarKanban(projectRoot, enabled = true) {
63904
- const [data, setData] = (0, import_react84.useState)({ columns: [], totalActive: 0, activeCardTitles: [] });
63905
- (0, import_react84.useEffect)(() => {
63930
+ const [data, setData] = (0, import_react85.useState)({ columns: [], totalActive: 0, activeCardTitles: [] });
63931
+ (0, import_react85.useEffect)(() => {
63906
63932
  if (!enabled) return;
63907
63933
  let cancelled = false;
63908
63934
  const poll = async () => {
@@ -64499,6 +64525,21 @@ function AppView({ host, runtime }) {
64499
64525
  sidebarSlotVisible("plan")
64500
64526
  );
64501
64527
  const inspectContent = state.inspectOverlay ? resolveInspectOverlayContent(state.inspectOverlay, state.entries, state.toolStream) : null;
64528
+ const onToolResultViewChange = (0, import_react86.useCallback)(
64529
+ (entryIds, mode) => {
64530
+ runtime.dispatch({ type: "toolResultViewSet", entryIds, mode });
64531
+ },
64532
+ [runtime.dispatch]
64533
+ );
64534
+ const onInspectScroll = (0, import_react86.useCallback)(
64535
+ (delta) => {
64536
+ runtime.dispatch({ type: "inspectOverlayScroll", delta });
64537
+ },
64538
+ [runtime.dispatch]
64539
+ );
64540
+ const onInspectClose = (0, import_react86.useCallback)(() => {
64541
+ runtime.dispatch({ type: "inspectOverlayClose" });
64542
+ }, [runtime.dispatch]);
64502
64543
  return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(PanelShortcutsProvider, { value: state.buffer.length === 0, children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
64503
64544
  Box2,
64504
64545
  {
@@ -64516,8 +64557,8 @@ function AppView({ host, runtime }) {
64516
64557
  scroll: state.inspectOverlay.scroll,
64517
64558
  termCols: mainColumnWidth,
64518
64559
  viewportRows: state.viewportRows,
64519
- onScroll: (delta) => runtime.dispatch({ type: "inspectOverlayScroll", delta }),
64520
- onClose: () => runtime.dispatch({ type: "inspectOverlayClose" }),
64560
+ onScroll: onInspectScroll,
64561
+ onClose: onInspectClose,
64521
64562
  copied: state.copiedEntryId === state.inspectOverlay.entryId,
64522
64563
  headerRef: runtime.inspectOverlayHeaderRef
64523
64564
  }
@@ -64541,7 +64582,7 @@ function AppView({ host, runtime }) {
64541
64582
  showSageMemoryInject: state.settingsPicker.open ? state.settingsPicker.showSageMemoryInject : liveSettings?.showSageMemoryInject ?? false,
64542
64583
  toolResultViewMode,
64543
64584
  toolResultViewOverrides: state.toolResultViewOverrides,
64544
- onToolResultViewChange: (entryIds, mode) => runtime.dispatch({ type: "toolResultViewSet", entryIds, mode }),
64585
+ onToolResultViewChange,
64545
64586
  layoutStore,
64546
64587
  copiedEntryId: state.copiedEntryId,
64547
64588
  onRequestOlderEntries: runtime.onRequestOlderEntries
@@ -64652,11 +64693,11 @@ function deriveAppViewState(options) {
64652
64693
  }
64653
64694
 
64654
64695
  // src/components/user-input-prompt.tsx
64655
- var import_react85 = __toESM(require_react(), 1);
64696
+ var import_react87 = __toESM(require_react(), 1);
64656
64697
  var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1);
64657
64698
  function usePendingUserInput(events) {
64658
- const [pending, setPending] = (0, import_react85.useState)(null);
64659
- (0, import_react85.useEffect)(() => {
64699
+ const [pending, setPending] = (0, import_react87.useState)(null);
64700
+ (0, import_react87.useEffect)(() => {
64660
64701
  const offRequest = events.on(
64661
64702
  "user.input_requested",
64662
64703
  (event) => setPending({ request: event.request, resolve: event.resolve })
@@ -64676,15 +64717,15 @@ function UserInputPrompt({ pending }) {
64676
64717
  const { stdout } = use_stdout_default();
64677
64718
  const terminalRows = stdout?.rows ?? 24;
64678
64719
  const terminalColumns = stdout?.columns ?? 80;
64679
- const [activeTabIndex, setActiveTabIndex] = (0, import_react85.useState)(0);
64680
- const [questionIndex, setQuestionIndex] = (0, import_react85.useState)(0);
64681
- const [optionIndex, setOptionIndex] = (0, import_react85.useState)(0);
64682
- const [editing, setEditing] = (0, import_react85.useState)(false);
64683
- const [notice, setNotice] = (0, import_react85.useState)("");
64684
- const [draft, setDraft] = (0, import_react85.useState)(() => initialDraft(pending.request));
64685
- const submitButtonRef = (0, import_react85.useRef)(null);
64686
- const mousePartialRef = (0, import_react85.useRef)("");
64687
- const allQuestions = (0, import_react85.useMemo)(
64720
+ const [activeTabIndex, setActiveTabIndex] = (0, import_react87.useState)(0);
64721
+ const [questionIndex, setQuestionIndex] = (0, import_react87.useState)(0);
64722
+ const [optionIndex, setOptionIndex] = (0, import_react87.useState)(0);
64723
+ const [editing, setEditing] = (0, import_react87.useState)(false);
64724
+ const [notice, setNotice] = (0, import_react87.useState)("");
64725
+ const [draft, setDraft] = (0, import_react87.useState)(() => initialDraft(pending.request));
64726
+ const submitButtonRef = (0, import_react87.useRef)(null);
64727
+ const mousePartialRef = (0, import_react87.useRef)("");
64728
+ const allQuestions = (0, import_react87.useMemo)(
64688
64729
  () => pending.request.tabs.flatMap((tab2) => tab2.questions),
64689
64730
  [pending.request]
64690
64731
  );
@@ -64751,7 +64792,7 @@ function UserInputPrompt({ pending }) {
64751
64792
  });
64752
64793
  };
64753
64794
  const { stdin } = use_stdin_default();
64754
- (0, import_react85.useEffect)(() => {
64795
+ (0, import_react87.useEffect)(() => {
64755
64796
  if (!stdin) return;
64756
64797
  const handleMouse = (data) => {
64757
64798
  const { consumed, pending: partial } = splitTrailingMousePartial(
@@ -65207,11 +65248,11 @@ function visibleWindow(items, selected, limit) {
65207
65248
  }
65208
65249
 
65209
65250
  // src/hooks/use-app-environment.ts
65210
- var import_react100 = __toESM(require_react(), 1);
65251
+ var import_react102 = __toESM(require_react(), 1);
65211
65252
  import path4 from "node:path";
65212
65253
 
65213
65254
  // src/hooks/use-autonomy-drivers.ts
65214
- var import_react86 = __toESM(require_react(), 1);
65255
+ var import_react88 = __toESM(require_react(), 1);
65215
65256
  import { toErrorMessage as toErrorMessage2 } from "@wrongstack/core/utils";
65216
65257
  var BETWEEN_ITERATION_YIELD_MS = 200;
65217
65258
  function yieldBetweenIterations(ms = BETWEEN_ITERATION_YIELD_MS) {
@@ -65231,8 +65272,8 @@ function useAutonomyDrivers({
65231
65272
  eternalLoopRunningRef,
65232
65273
  parallelLoopRunningRef
65233
65274
  }) {
65234
- const mountedRef = (0, import_react86.useRef)(true);
65235
- (0, import_react86.useEffect)(() => {
65275
+ const mountedRef = (0, import_react88.useRef)(true);
65276
+ (0, import_react88.useEffect)(() => {
65236
65277
  mountedRef.current = true;
65237
65278
  return () => {
65238
65279
  mountedRef.current = false;
@@ -65279,7 +65320,7 @@ function useAutonomyDrivers({
65279
65320
  }
65280
65321
  }
65281
65322
  };
65282
- const runEternalLoopRef = (0, import_react86.useRef)(runEternalLoop);
65323
+ const runEternalLoopRef = (0, import_react88.useRef)(runEternalLoop);
65283
65324
  runEternalLoopRef.current = runEternalLoop;
65284
65325
  const runParallelLoop = async () => {
65285
65326
  const engine = getParallelEngine?.();
@@ -65322,9 +65363,9 @@ function useAutonomyDrivers({
65322
65363
  }
65323
65364
  }
65324
65365
  };
65325
- const runParallelLoopRef = (0, import_react86.useRef)(runParallelLoop);
65366
+ const runParallelLoopRef = (0, import_react88.useRef)(runParallelLoop);
65326
65367
  runParallelLoopRef.current = runParallelLoop;
65327
- (0, import_react86.useEffect)(() => {
65368
+ (0, import_react88.useEffect)(() => {
65328
65369
  if (!subscribeEternalIteration) return;
65329
65370
  const unsub = subscribeEternalIteration((entry2) => {
65330
65371
  const mark = entry2.status === "success" ? "\u2713" : entry2.status === "failure" ? "\u2717" : entry2.status === "aborted" ? "\u2298" : "\xB7";
@@ -65335,7 +65376,7 @@ function useAutonomyDrivers({
65335
65376
  });
65336
65377
  return unsub;
65337
65378
  }, [subscribeEternalIteration]);
65338
- (0, import_react86.useEffect)(() => {
65379
+ (0, import_react88.useEffect)(() => {
65339
65380
  if (!subscribeEternalStage) return;
65340
65381
  const unsub = subscribeEternalStage((stage) => {
65341
65382
  dispatch({ type: "eternalStage", stage });
@@ -65346,7 +65387,7 @@ function useAutonomyDrivers({
65346
65387
  }
65347
65388
 
65348
65389
  // src/hooks/use-git-session-status.ts
65349
- var import_react87 = __toESM(require_react(), 1);
65390
+ var import_react89 = __toESM(require_react(), 1);
65350
65391
  import { watchProjectTree } from "@wrongstack/core/utils";
65351
65392
 
65352
65393
  // src/git-info.ts
@@ -65444,13 +65485,13 @@ function useGitSessionStatus({
65444
65485
  setSessionCount,
65445
65486
  hiddenItems = []
65446
65487
  }) {
65447
- const [gitInfo, setGitInfo] = (0, import_react87.useState)(null);
65448
- const previousBranchRef = (0, import_react87.useRef)(null);
65488
+ const [gitInfo, setGitInfo] = (0, import_react89.useState)(null);
65489
+ const previousBranchRef = (0, import_react89.useRef)(null);
65449
65490
  const gitHidden = hiddenItems.includes("git");
65450
- (0, import_react87.useEffect)(() => {
65491
+ (0, import_react89.useEffect)(() => {
65451
65492
  if (gitHidden) previousBranchRef.current = null;
65452
65493
  }, [gitHidden]);
65453
- (0, import_react87.useEffect)(() => {
65494
+ (0, import_react89.useEffect)(() => {
65454
65495
  if (gitHidden) return;
65455
65496
  let cancelled = false;
65456
65497
  let dirty = true;
@@ -65499,7 +65540,7 @@ function useGitSessionStatus({
65499
65540
  watcher?.close();
65500
65541
  };
65501
65542
  }, [agent.ctx, gitHidden]);
65502
- (0, import_react87.useEffect)(() => {
65543
+ (0, import_react89.useEffect)(() => {
65503
65544
  if (!getLiveSessions) return;
65504
65545
  let cancelled = false;
65505
65546
  const poll = async () => {
@@ -65521,22 +65562,22 @@ function useGitSessionStatus({
65521
65562
  }
65522
65563
 
65523
65564
  // src/hooks/use-history-viewport-sync.ts
65524
- var import_react88 = __toESM(require_react(), 1);
65565
+ var import_react90 = __toESM(require_react(), 1);
65525
65566
  function useHistoryViewportSync(input) {
65526
65567
  const { stdoutRows, viewportRows, setViewportRows } = input;
65527
- const bottomRegionRef = (0, import_react88.useRef)(null);
65528
- const statusBarWrapRef = (0, import_react88.useRef)(null);
65529
- const belowStatusBarRef = (0, import_react88.useRef)(null);
65530
- const [termRows, setTermRows] = (0, import_react88.useState)(stdoutRows ?? 24);
65531
- const [statusBarRows, setStatusBarRows] = (0, import_react88.useState)(2);
65532
- (0, import_react88.useEffect)(() => {
65568
+ const bottomRegionRef = (0, import_react90.useRef)(null);
65569
+ const statusBarWrapRef = (0, import_react90.useRef)(null);
65570
+ const belowStatusBarRef = (0, import_react90.useRef)(null);
65571
+ const [termRows, setTermRows] = (0, import_react90.useState)(stdoutRows ?? 24);
65572
+ const [statusBarRows, setStatusBarRows] = (0, import_react90.useState)(2);
65573
+ (0, import_react90.useEffect)(() => {
65533
65574
  const handleResize = () => setTermRows(process.stdout.rows ?? 24);
65534
65575
  process.stdout.prependListener("resize", handleResize);
65535
65576
  return () => {
65536
65577
  process.stdout.off("resize", handleResize);
65537
65578
  };
65538
65579
  }, []);
65539
- (0, import_react88.useLayoutEffect)(() => {
65580
+ (0, import_react90.useLayoutEffect)(() => {
65540
65581
  const node = bottomRegionRef.current;
65541
65582
  if (!node) return;
65542
65583
  const rows = historyViewportRows(termRows, measure_element_default(node).height);
@@ -65544,7 +65585,7 @@ function useHistoryViewportSync(input) {
65544
65585
  setViewportRows(rows);
65545
65586
  }
65546
65587
  });
65547
- (0, import_react88.useLayoutEffect)(() => {
65588
+ (0, import_react90.useLayoutEffect)(() => {
65548
65589
  const bar2 = statusBarWrapRef.current;
65549
65590
  const below = belowStatusBarRef.current;
65550
65591
  if (!bar2 && !below) return;
@@ -65556,7 +65597,7 @@ function useHistoryViewportSync(input) {
65556
65597
  }
65557
65598
 
65558
65599
  // src/hooks/use-live-settings-state.ts
65559
- var import_react89 = __toESM(require_react(), 1);
65600
+ var import_react91 = __toESM(require_react(), 1);
65560
65601
  function useLiveSettingsState({
65561
65602
  getSettings,
65562
65603
  titleController,
@@ -65567,12 +65608,12 @@ function useLiveSettingsState({
65567
65608
  const liveStatuslineMode = liveSettings?.statuslineMode ?? DEFAULT_STATUSLINE_MODE;
65568
65609
  const liveAnimationStyle = liveSettings?.animationStyle ?? "rainbow";
65569
65610
  const liveThinkingWord = liveSettings?.thinkingWord ?? "thinking";
65570
- const chimeRef = (0, import_react89.useRef)(chime);
65611
+ const chimeRef = (0, import_react91.useRef)(chime);
65571
65612
  chimeRef.current = liveSettings?.chime ?? chime;
65572
- const confirmExitRef = (0, import_react89.useRef)(confirmExit);
65613
+ const confirmExitRef = (0, import_react91.useRef)(confirmExit);
65573
65614
  confirmExitRef.current = liveSettings?.confirmExit ?? confirmExit;
65574
65615
  const liveTitleAnimation = liveSettings?.titleAnimation;
65575
- (0, import_react89.useEffect)(() => {
65616
+ (0, import_react91.useEffect)(() => {
65576
65617
  if (!titleController) return;
65577
65618
  titleController.setEnabled(liveTitleAnimation !== false);
65578
65619
  }, [titleController, liveTitleAnimation]);
@@ -65587,11 +65628,11 @@ function useLiveSettingsState({
65587
65628
  }
65588
65629
 
65589
65630
  // src/hooks/use-mouse-tracking.ts
65590
- var import_react90 = __toESM(require_react(), 1);
65631
+ var import_react92 = __toESM(require_react(), 1);
65591
65632
  function useMouseTracking(input) {
65592
65633
  const { initialMouseMode, initialNativeMouse, overlayOpen, protocol, stdout } = input;
65593
- const [mouseMode, setMouseMode] = (0, import_react90.useState)(initialMouseMode);
65594
- const [nativeMouse, setNativeMouse] = (0, import_react90.useState)(initialNativeMouse ?? false);
65634
+ const [mouseMode, setMouseMode] = (0, import_react92.useState)(initialMouseMode);
65635
+ const [nativeMouse, setNativeMouse] = (0, import_react92.useState)(initialNativeMouse ?? false);
65595
65636
  const mouseTrackingOn = shouldEnableMouseTracking({
65596
65637
  fullMode: mouseMode,
65597
65638
  overlayOpen,
@@ -65600,8 +65641,8 @@ function useMouseTracking(input) {
65600
65641
  protocol
65601
65642
  });
65602
65643
  const mouseTrackingSequence = mouseTrackingOn ? MOUSE_DRAG_ON : MOUSE_OFF;
65603
- const mouseWrittenRef = (0, import_react90.useRef)(null);
65604
- (0, import_react90.useEffect)(() => {
65644
+ const mouseWrittenRef = (0, import_react92.useRef)(null);
65645
+ (0, import_react92.useEffect)(() => {
65605
65646
  if (mouseWrittenRef.current === mouseTrackingSequence) return;
65606
65647
  mouseWrittenRef.current = mouseTrackingSequence;
65607
65648
  try {
@@ -65609,7 +65650,7 @@ function useMouseTracking(input) {
65609
65650
  } catch {
65610
65651
  }
65611
65652
  }, [mouseTrackingSequence, stdout]);
65612
- (0, import_react90.useEffect)(
65653
+ (0, import_react92.useEffect)(
65613
65654
  () => () => {
65614
65655
  const wasTracking = mouseWrittenRef.current !== null && mouseWrittenRef.current !== MOUSE_OFF;
65615
65656
  mouseWrittenRef.current = null;
@@ -65625,15 +65666,15 @@ function useMouseTracking(input) {
65625
65666
  }
65626
65667
 
65627
65668
  // src/hooks/use-settings-auto-save.ts
65628
- var import_react91 = __toESM(require_react(), 1);
65669
+ var import_react93 = __toESM(require_react(), 1);
65629
65670
  function useSettingsAutoSave(state, saveSettings, dispatch) {
65630
- const settingsAutoSaveGateRef = (0, import_react91.useRef)(true);
65631
- (0, import_react91.useEffect)(() => {
65671
+ const settingsAutoSaveGateRef = (0, import_react93.useRef)(true);
65672
+ (0, import_react93.useEffect)(() => {
65632
65673
  if (state.settingsPicker.open) {
65633
65674
  settingsAutoSaveGateRef.current = true;
65634
65675
  }
65635
65676
  }, [state.settingsPicker.open]);
65636
- (0, import_react91.useEffect)(() => {
65677
+ (0, import_react93.useEffect)(() => {
65637
65678
  const sp = state.settingsPicker;
65638
65679
  const save = saveSettings;
65639
65680
  if (!sp.open || !save) return;
@@ -65761,7 +65802,7 @@ function useSettingsAutoSave(state, saveSettings, dispatch) {
65761
65802
  }
65762
65803
 
65763
65804
  // src/hooks/use-status-sync-interval.ts
65764
- var import_react92 = __toESM(require_react(), 1);
65805
+ var import_react94 = __toESM(require_react(), 1);
65765
65806
  function useStatusSyncInterval({
65766
65807
  getAutonomy,
65767
65808
  getYolo,
@@ -65782,8 +65823,8 @@ function useStatusSyncInterval({
65782
65823
  runEternalLoopRef,
65783
65824
  runParallelLoopRef
65784
65825
  }) {
65785
- const staleGuardRef = (0, import_react92.useRef)(JSON.stringify({ a: "", y: false, m: "", model: "", provider: "" }));
65786
- (0, import_react92.useEffect)(() => {
65826
+ const staleGuardRef = (0, import_react94.useRef)(JSON.stringify({ a: "", y: false, m: "", model: "", provider: "" }));
65827
+ (0, import_react94.useEffect)(() => {
65787
65828
  const poll = () => {
65788
65829
  const a = getAutonomy?.() ?? "off";
65789
65830
  const y = getYolo?.() ?? false;
@@ -65828,7 +65869,7 @@ function useStatusSyncInterval({
65828
65869
  }
65829
65870
 
65830
65871
  // src/hooks/use-statusline-hidden-sync.ts
65831
- var import_react93 = __toESM(require_react(), 1);
65872
+ var import_react95 = __toESM(require_react(), 1);
65832
65873
  function statuslineHiddenDiffers(hookHidden, pickerHidden) {
65833
65874
  const currentHidden = new Set(hookHidden);
65834
65875
  const pickerHiddenSet = new Set(pickerHidden);
@@ -65846,7 +65887,7 @@ function useStatuslineHiddenSync({
65846
65887
  hiddenItems,
65847
65888
  setHiddenItems
65848
65889
  }) {
65849
- (0, import_react93.useEffect)(() => {
65890
+ (0, import_react95.useEffect)(() => {
65850
65891
  if (!pickerOpen) return;
65851
65892
  if (statuslineHiddenDiffers(hiddenItems, pickerHidden)) {
65852
65893
  setHiddenItems([...pickerHidden]);
@@ -65866,15 +65907,15 @@ function useStatuslineLayoutSync({
65866
65907
  setDensities,
65867
65908
  setOrder
65868
65909
  }) {
65869
- (0, import_react93.useEffect)(() => {
65910
+ (0, import_react95.useEffect)(() => {
65870
65911
  if (!pickerOpen || !layoutSeeded) return;
65871
65912
  if (statuslineLayoutDiffers(lines, pickerLines)) setLines({ ...pickerLines });
65872
65913
  }, [pickerOpen, layoutSeeded, pickerLines, lines, setLines]);
65873
- (0, import_react93.useEffect)(() => {
65914
+ (0, import_react95.useEffect)(() => {
65874
65915
  if (!pickerOpen || !layoutSeeded) return;
65875
65916
  if (statuslineLayoutDiffers(densities, pickerDensities)) setDensities({ ...pickerDensities });
65876
65917
  }, [pickerOpen, layoutSeeded, pickerDensities, densities, setDensities]);
65877
- (0, import_react93.useEffect)(() => {
65918
+ (0, import_react95.useEffect)(() => {
65878
65919
  if (!pickerOpen || !layoutSeeded) return;
65879
65920
  if (pickerOrder.length !== order.length || pickerOrder.some((item, index) => item !== order[index])) {
65880
65921
  setOrder([...pickerOrder]);
@@ -65883,7 +65924,7 @@ function useStatuslineLayoutSync({
65883
65924
  }
65884
65925
 
65885
65926
  // src/hooks/use-stream-chip-expiration.ts
65886
- var import_react94 = __toESM(require_react(), 1);
65927
+ var import_react96 = __toESM(require_react(), 1);
65887
65928
  function computeStreamChipActions(input) {
65888
65929
  const actions = [];
65889
65930
  const visible = new Set(input.visibleChipKeys);
@@ -65908,9 +65949,9 @@ function useStreamChipExpiration({
65908
65949
  visibleChips,
65909
65950
  dispatch
65910
65951
  }) {
65911
- const prevBrainPromptRef = (0, import_react94.useRef)(brainPrompt);
65912
- const prevEnhanceRef = (0, import_react94.useRef)(enhance);
65913
- (0, import_react94.useEffect)(() => {
65952
+ const prevBrainPromptRef = (0, import_react96.useRef)(brainPrompt);
65953
+ const prevEnhanceRef = (0, import_react96.useRef)(enhance);
65954
+ (0, import_react96.useEffect)(() => {
65914
65955
  const actions = computeStreamChipActions({
65915
65956
  brainPromptNow: !!brainPrompt,
65916
65957
  brainPromptPrev: !!prevBrainPromptRef.current,
@@ -65922,7 +65963,7 @@ function useStreamChipExpiration({
65922
65963
  prevBrainPromptRef.current = brainPrompt;
65923
65964
  prevEnhanceRef.current = enhance;
65924
65965
  }, [brainPrompt, enhance, visibleChips, dispatch]);
65925
- (0, import_react94.useEffect)(() => {
65966
+ (0, import_react96.useEffect)(() => {
65926
65967
  const interval = setInterval(() => {
65927
65968
  const expired = computeExpiredChipKeys(visibleChips, Date.now());
65928
65969
  for (const key of expired) {
@@ -65934,9 +65975,9 @@ function useStreamChipExpiration({
65934
65975
  }
65935
65976
 
65936
65977
  // src/hooks/use-theme-state.ts
65937
- var import_react95 = __toESM(require_react(), 1);
65978
+ var import_react97 = __toESM(require_react(), 1);
65938
65979
  function useThemeState({ configStore }) {
65939
- (0, import_react95.useEffect)(() => {
65980
+ (0, import_react97.useEffect)(() => {
65940
65981
  let randomMode = false;
65941
65982
  let rotation;
65942
65983
  const stopRotation = () => {
@@ -65976,7 +66017,7 @@ function useThemeState({ configStore }) {
65976
66017
  }
65977
66018
 
65978
66019
  // src/hooks/use-tui-activity.ts
65979
- var import_react96 = __toESM(require_react(), 1);
66020
+ var import_react98 = __toESM(require_react(), 1);
65980
66021
  import * as fs4 from "node:fs/promises";
65981
66022
  import * as os4 from "node:os";
65982
66023
  import { loadGoal } from "@wrongstack/core/storage";
@@ -66025,30 +66066,30 @@ function useTuiActivity({
66025
66066
  builderRef
66026
66067
  }) {
66027
66068
  recordTuiAppRender();
66028
- const [rolledThinkingWord, setRolledThinkingWord] = (0, import_react96.useState)(() => pickRandomTuiThinkingWord());
66069
+ const [rolledThinkingWord, setRolledThinkingWord] = (0, import_react98.useState)(() => pickRandomTuiThinkingWord());
66029
66070
  const thinkingWorking = status === "running" || status === "streaming";
66030
- const prevThinkingWorkingRef = (0, import_react96.useRef)(false);
66031
- (0, import_react96.useEffect)(() => {
66071
+ const prevThinkingWorkingRef = (0, import_react98.useRef)(false);
66072
+ (0, import_react98.useEffect)(() => {
66032
66073
  if (thinkingWorking && !prevThinkingWorkingRef.current) {
66033
66074
  setRolledThinkingWord((previous) => pickRandomTuiThinkingWord(previous));
66034
66075
  }
66035
66076
  prevThinkingWorkingRef.current = thinkingWorking;
66036
66077
  }, [thinkingWorking]);
66037
66078
  const displayThinkingWord = isRandomTuiThinkingWord(thinkingWord) ? rolledThinkingWord : thinkingWord;
66038
- const fleetRunningCount = (0, import_react96.useMemo)(
66079
+ const fleetRunningCount = (0, import_react98.useMemo)(
66039
66080
  () => Object.values(fleet).filter((entry2) => entry2.status === "running").length,
66040
66081
  [fleet]
66041
66082
  );
66042
- const startedAtRef = (0, import_react96.useRef)(Date.now());
66043
- const [nowTick, setNowTick] = (0, import_react96.useState)(Date.now());
66044
- (0, import_react96.useEffect)(() => {
66083
+ const startedAtRef = (0, import_react98.useRef)(Date.now());
66084
+ const [nowTick, setNowTick] = (0, import_react98.useState)(Date.now());
66085
+ (0, import_react98.useEffect)(() => {
66045
66086
  const timer = setInterval(() => setNowTick(Date.now()), 1e4);
66046
66087
  return () => clearInterval(timer);
66047
66088
  }, []);
66048
- const [workingTimeBase, setWorkingTimeBase] = (0, import_react96.useState)(0);
66049
- const workingStartRef = (0, import_react96.useRef)(null);
66050
- const prevStatusRef = (0, import_react96.useRef)(status);
66051
- (0, import_react96.useEffect)(() => {
66089
+ const [workingTimeBase, setWorkingTimeBase] = (0, import_react98.useState)(0);
66090
+ const workingStartRef = (0, import_react98.useRef)(null);
66091
+ const prevStatusRef = (0, import_react98.useRef)(status);
66092
+ (0, import_react98.useEffect)(() => {
66052
66093
  if (prevStatusRef.current === status) return;
66053
66094
  const wasWorking = prevStatusRef.current === "running" || prevStatusRef.current === "streaming";
66054
66095
  const isWorking = status === "running" || status === "streaming";
@@ -66061,10 +66102,10 @@ function useTuiActivity({
66061
66102
  }
66062
66103
  prevStatusRef.current = status;
66063
66104
  }, [status]);
66064
- const [fleetWorkingBase, setFleetWorkingBase] = (0, import_react96.useState)(0);
66065
- const fleetWorkingStartRef = (0, import_react96.useRef)(null);
66066
- const prevFleetRunningRef = (0, import_react96.useRef)(0);
66067
- (0, import_react96.useEffect)(() => {
66105
+ const [fleetWorkingBase, setFleetWorkingBase] = (0, import_react98.useState)(0);
66106
+ const fleetWorkingStartRef = (0, import_react98.useRef)(null);
66107
+ const prevFleetRunningRef = (0, import_react98.useRef)(0);
66108
+ (0, import_react98.useEffect)(() => {
66068
66109
  const running = fleetRunningCount;
66069
66110
  if (prevFleetRunningRef.current === running) return;
66070
66111
  const wasRunning = prevFleetRunningRef.current > 0;
@@ -66087,17 +66128,17 @@ function useTuiActivity({
66087
66128
  const timingNow = Date.now();
66088
66129
  const workingTimeMs = workingStartRef.current === null ? workingTimeBase : workingTimeBase + (timingNow - workingStartRef.current);
66089
66130
  const fleetWorkingTimeMs = fleetWorkingStartRef.current === null ? fleetWorkingBase : fleetWorkingBase + (timingNow - fleetWorkingStartRef.current);
66090
- const rssHistoryRef = (0, import_react96.useRef)([]);
66091
- const heapHistoryRef = (0, import_react96.useRef)([]);
66092
- const processMemory = (0, import_react96.useMemo)(() => {
66131
+ const rssHistoryRef = (0, import_react98.useRef)([]);
66132
+ const heapHistoryRef = (0, import_react98.useRef)([]);
66133
+ const processMemory = (0, import_react98.useMemo)(() => {
66093
66134
  const sample = takeHeapSample();
66094
66135
  pushMetricHistory(rssHistoryRef.current, Math.min(1, sample.rss / TOTAL_MEM));
66095
66136
  pushMetricHistory(heapHistoryRef.current, Math.min(1, sample.load));
66096
66137
  return sample;
66097
66138
  }, [nowTick]);
66098
- const cpuPrevRef = (0, import_react96.useRef)(null);
66099
- const cpuHistoryRef = (0, import_react96.useRef)([]);
66100
- const cpuPercent = (0, import_react96.useMemo)(() => {
66139
+ const cpuPrevRef = (0, import_react98.useRef)(null);
66140
+ const cpuHistoryRef = (0, import_react98.useRef)([]);
66141
+ const cpuPercent = (0, import_react98.useMemo)(() => {
66101
66142
  const now = process.hrtime.bigint();
66102
66143
  const cpuNow = process.cpuUsage();
66103
66144
  const prev = cpuPrevRef.current;
@@ -66110,7 +66151,7 @@ function useTuiActivity({
66110
66151
  pushMetricHistory(cpuHistoryRef.current, pct / 100);
66111
66152
  return pct;
66112
66153
  }, [nowTick]);
66113
- (0, import_react96.useEffect)(() => {
66154
+ (0, import_react98.useEffect)(() => {
66114
66155
  const stopHeapWatchdog = startSharedHeapWatchdog({
66115
66156
  collectStats: () => {
66116
66157
  const currentState = stateRef.current;
@@ -66154,16 +66195,16 @@ function useTuiActivity({
66154
66195
  void stopHeapWatchdog();
66155
66196
  };
66156
66197
  }, [agentContext, dispatch, stateRef, attachments, builderRef]);
66157
- const goalSummaryFingerprintRef = (0, import_react96.useRef)(void 0);
66158
- const goalSummaryGenerationRef = (0, import_react96.useRef)(0);
66159
- const goalStatFingerprintRef = (0, import_react96.useRef)(void 0);
66160
- const refreshGoalSummary = (0, import_react96.useCallback)(() => {
66198
+ const goalSummaryFingerprintRef = (0, import_react98.useRef)(void 0);
66199
+ const goalSummaryGenerationRef = (0, import_react98.useRef)(0);
66200
+ const goalStatFingerprintRef = (0, import_react98.useRef)(void 0);
66201
+ const refreshGoalSummary = (0, import_react98.useCallback)(() => {
66161
66202
  const generation = ++goalSummaryGenerationRef.current;
66162
66203
  if (!projectRoot) return;
66163
66204
  const goalPath = resolveWstackPaths3({ projectRoot }).projectGoal;
66164
66205
  fs4.stat(goalPath).then(
66165
- (stat4) => {
66166
- const statFingerprint = `${stat4.mtimeMs}:${stat4.size}`;
66206
+ (stat5) => {
66207
+ const statFingerprint = `${stat5.mtimeMs}:${stat5.size}`;
66167
66208
  if (statFingerprint === goalStatFingerprintRef.current) return void 0;
66168
66209
  goalStatFingerprintRef.current = statFingerprint;
66169
66210
  return loadGoal(goalPath);
@@ -66205,7 +66246,7 @@ function useTuiActivity({
66205
66246
  }).catch(() => {
66206
66247
  });
66207
66248
  }, [dispatch, projectRoot]);
66208
- (0, import_react96.useEffect)(() => {
66249
+ (0, import_react98.useEffect)(() => {
66209
66250
  refreshGoalSummary();
66210
66251
  }, [nowTick, refreshGoalSummary]);
66211
66252
  const enhanceDots = enhanceBusy ? timingFrame % 36 : 0;
@@ -66228,27 +66269,27 @@ function useTuiActivity({
66228
66269
  }
66229
66270
 
66230
66271
  // src/hooks/use-tui-environment-state.ts
66231
- var import_react98 = __toESM(require_react(), 1);
66272
+ var import_react100 = __toESM(require_react(), 1);
66232
66273
  import { getIndexState as getIndexState2, getProcessRegistry as getProcessRegistry4, onIndexStateChange } from "@wrongstack/tools";
66233
66274
 
66234
66275
  // src/hooks/use-statusline-state.ts
66235
- var import_react97 = __toESM(require_react(), 1);
66276
+ var import_react99 = __toESM(require_react(), 1);
66236
66277
  function useStatuslineState(opts) {
66237
- const [liveModel, setLiveModel] = (0, import_react97.useState)(opts.model);
66238
- const [liveProvider, setLiveProvider] = (0, import_react97.useState)(opts.provider ?? "agent");
66239
- const [activeMaxContext, setActiveMaxContext] = (0, import_react97.useState)(
66278
+ const [liveModel, setLiveModel] = (0, import_react99.useState)(opts.model);
66279
+ const [liveProvider, setLiveProvider] = (0, import_react99.useState)(opts.provider ?? "agent");
66280
+ const [activeMaxContext, setActiveMaxContext] = (0, import_react99.useState)(
66240
66281
  opts.effectiveMaxContext
66241
66282
  );
66242
- const [yoloLive, setYoloLive] = (0, import_react97.useState)(opts.yolo);
66243
- const [autonomyLive, setAutonomyLive] = (0, import_react97.useState)(opts.getAutonomy?.() ?? "off");
66244
- const [liveModeLabel, setLiveModeLabel] = (0, import_react97.useState)(opts.modeLabel ?? "");
66245
- const [hiddenItems, setHiddenItems] = (0, import_react97.useState)(
66283
+ const [yoloLive, setYoloLive] = (0, import_react99.useState)(opts.yolo);
66284
+ const [autonomyLive, setAutonomyLive] = (0, import_react99.useState)(opts.getAutonomy?.() ?? "off");
66285
+ const [liveModeLabel, setLiveModeLabel] = (0, import_react99.useState)(opts.modeLabel ?? "");
66286
+ const [hiddenItems, setHiddenItems] = (0, import_react99.useState)(
66246
66287
  Array.isArray(opts.statuslineHiddenItems) ? [...opts.statuslineHiddenItems] : [...opts.statuslineHiddenItems]
66247
66288
  );
66248
- const [lines, setLines] = (0, import_react97.useState)(opts.statuslineLines ?? {});
66249
- const [densities, setDensities] = (0, import_react97.useState)(opts.statuslineDensities ?? {});
66250
- const [order, setOrder] = (0, import_react97.useState)(opts.statuslineOrder ?? []);
66251
- const [sessionCount, setSessionCount] = (0, import_react97.useState)(0);
66289
+ const [lines, setLines] = (0, import_react99.useState)(opts.statuslineLines ?? {});
66290
+ const [densities, setDensities] = (0, import_react99.useState)(opts.statuslineDensities ?? {});
66291
+ const [order, setOrder] = (0, import_react99.useState)(opts.statuslineOrder ?? []);
66292
+ const [sessionCount, setSessionCount] = (0, import_react99.useState)(0);
66252
66293
  return {
66253
66294
  liveModel,
66254
66295
  setLiveModel,
@@ -66312,14 +66353,14 @@ function useTuiEnvironmentState({
66312
66353
  setStatuslineOrder,
66313
66354
  saveStatuslineOrder
66314
66355
  }) {
66315
- const [memoryContextMonitor, setMemoryContextMonitor] = (0, import_react98.useState)(emptyMemoryContextMonitor);
66316
- const [memoryRecordTotal, setMemoryRecordTotal] = (0, import_react98.useState)();
66317
- const memoryContextMonitorRef = (0, import_react98.useRef)(memoryContextMonitor);
66356
+ const [memoryContextMonitor, setMemoryContextMonitor] = (0, import_react100.useState)(emptyMemoryContextMonitor);
66357
+ const [memoryRecordTotal, setMemoryRecordTotal] = (0, import_react100.useState)();
66358
+ const memoryContextMonitorRef = (0, import_react100.useRef)(memoryContextMonitor);
66318
66359
  memoryContextMonitorRef.current = memoryContextMonitor;
66319
- const memoryRecordTotalRef = (0, import_react98.useRef)(memoryRecordTotal);
66360
+ const memoryRecordTotalRef = (0, import_react100.useRef)(memoryRecordTotal);
66320
66361
  memoryRecordTotalRef.current = memoryRecordTotal;
66321
66362
  const activeMemoryInContext = activeMemoryContextCount(memoryContextMonitor);
66322
- (0, import_react98.useEffect)(() => {
66363
+ (0, import_react100.useEffect)(() => {
66323
66364
  let cancelled = false;
66324
66365
  const refreshTotal = async () => {
66325
66366
  try {
@@ -66348,19 +66389,19 @@ function useTuiEnvironmentState({
66348
66389
  statuslineDensities,
66349
66390
  statuslineOrder
66350
66391
  });
66351
- const hiddenItemsRef = (0, import_react98.useRef)(statusline.hiddenItems);
66392
+ const hiddenItemsRef = (0, import_react100.useRef)(statusline.hiddenItems);
66352
66393
  hiddenItemsRef.current = statusline.hiddenItems;
66353
- const [liveToolCount, setLiveToolCount] = (0, import_react98.useState)(toolCount);
66354
- (0, import_react98.useEffect)(() => setLiveToolCount(toolCount), [toolCount]);
66355
- const [indexState, setIndexState] = (0, import_react98.useState)(() => getIndexState2());
66356
- (0, import_react98.useEffect)(() => {
66394
+ const [liveToolCount, setLiveToolCount] = (0, import_react100.useState)(toolCount);
66395
+ (0, import_react100.useEffect)(() => setLiveToolCount(toolCount), [toolCount]);
66396
+ const [indexState, setIndexState] = (0, import_react100.useState)(() => getIndexState2());
66397
+ (0, import_react100.useEffect)(() => {
66357
66398
  setIndexState(getIndexState2());
66358
66399
  return onIndexStateChange(setIndexState);
66359
66400
  }, []);
66360
- const [breakerCountdown, setBreakerCountdown] = (0, import_react98.useState)(
66401
+ const [breakerCountdown, setBreakerCountdown] = (0, import_react100.useState)(
66361
66402
  () => getProcessRegistry4().getBreakerCountdown()
66362
66403
  );
66363
- (0, import_react98.useEffect)(() => {
66404
+ (0, import_react100.useEffect)(() => {
66364
66405
  const settings = getSettings?.();
66365
66406
  if (settings) {
66366
66407
  getProcessRegistry4().setBreakerConfig({
@@ -66371,7 +66412,7 @@ function useTuiEnvironmentState({
66371
66412
  return getProcessRegistry4().onBreakerCountdownChange(setBreakerCountdown);
66372
66413
  }, [getSettings]);
66373
66414
  const breakerArmed = breakerCountdown !== null;
66374
- (0, import_react98.useEffect)(() => {
66415
+ (0, import_react100.useEffect)(() => {
66375
66416
  if (!breakerArmed) return;
66376
66417
  const timer = setInterval(
66377
66418
  () => setBreakerCountdown(getProcessRegistry4().getBreakerCountdown()),
@@ -66379,10 +66420,10 @@ function useTuiEnvironmentState({
66379
66420
  );
66380
66421
  return () => clearInterval(timer);
66381
66422
  }, [breakerArmed]);
66382
- (0, import_react98.useEffect)(() => {
66423
+ (0, import_react100.useEffect)(() => {
66383
66424
  statusline.setHiddenItems([...statuslineHiddenItems]);
66384
66425
  }, [statuslineHiddenItems, statusline.setHiddenItems]);
66385
- (0, import_react98.useEffect)(() => {
66426
+ (0, import_react100.useEffect)(() => {
66386
66427
  setStatuslineHiddenItems(statusline.hiddenItems);
66387
66428
  saveStatuslineHiddenItems(statusline.hiddenItems).catch?.((error) => {
66388
66429
  console.error(
@@ -66395,8 +66436,8 @@ function useTuiEnvironmentState({
66395
66436
  );
66396
66437
  });
66397
66438
  }, [setStatuslineHiddenItems, saveStatuslineHiddenItems, statusline.hiddenItems]);
66398
- const layoutHydrated = (0, import_react98.useRef)(false);
66399
- (0, import_react98.useEffect)(() => {
66439
+ const layoutHydrated = (0, import_react100.useRef)(false);
66440
+ (0, import_react100.useEffect)(() => {
66400
66441
  if (!layoutHydrated.current) {
66401
66442
  layoutHydrated.current = true;
66402
66443
  return;
@@ -66406,8 +66447,8 @@ function useTuiEnvironmentState({
66406
66447
  logPersistFailure("statusline.persist_lines_failed")
66407
66448
  );
66408
66449
  }, [setStatuslineLines, saveStatuslineLines, statusline.lines]);
66409
- const densityHydrated = (0, import_react98.useRef)(false);
66410
- (0, import_react98.useEffect)(() => {
66450
+ const densityHydrated = (0, import_react100.useRef)(false);
66451
+ (0, import_react100.useEffect)(() => {
66411
66452
  if (!densityHydrated.current) {
66412
66453
  densityHydrated.current = true;
66413
66454
  return;
@@ -66417,8 +66458,8 @@ function useTuiEnvironmentState({
66417
66458
  logPersistFailure("statusline.persist_densities_failed")
66418
66459
  );
66419
66460
  }, [setStatuslineDensities, saveStatuslineDensities, statusline.densities]);
66420
- const orderHydrated = (0, import_react98.useRef)(false);
66421
- (0, import_react98.useEffect)(() => {
66461
+ const orderHydrated = (0, import_react100.useRef)(false);
66462
+ (0, import_react100.useEffect)(() => {
66422
66463
  if (!orderHydrated.current) {
66423
66464
  orderHydrated.current = true;
66424
66465
  return;
@@ -66445,7 +66486,7 @@ function useTuiEnvironmentState({
66445
66486
  }
66446
66487
 
66447
66488
  // src/hooks/use-working-dir-chip.ts
66448
- var import_react99 = __toESM(require_react(), 1);
66489
+ var import_react101 = __toESM(require_react(), 1);
66449
66490
  import * as path3 from "node:path";
66450
66491
  function formatWorkingDirChip(workingDir, projectRoot) {
66451
66492
  if (!workingDir || workingDir === projectRoot) return void 0;
@@ -66455,10 +66496,10 @@ function formatWorkingDirChip(workingDir, projectRoot) {
66455
66496
  return rel.replaceAll(impl.sep, "/");
66456
66497
  }
66457
66498
  function useWorkingDirChip(ctx, projectRoot) {
66458
- const [workingDirChip, setWorkingDirChip] = (0, import_react99.useState)(
66499
+ const [workingDirChip, setWorkingDirChip] = (0, import_react101.useState)(
66459
66500
  () => formatWorkingDirChip(ctx.workingDir, projectRoot)
66460
66501
  );
66461
- (0, import_react99.useEffect)(() => {
66502
+ (0, import_react101.useEffect)(() => {
66462
66503
  setWorkingDirChip(formatWorkingDirChip(ctx.workingDir, projectRoot));
66463
66504
  return ctx.onWorkingDirChanged((newDir) => {
66464
66505
  setWorkingDirChip(formatWorkingDirChip(newDir, projectRoot));
@@ -66570,14 +66611,14 @@ function useAppEnvironment(deps) {
66570
66611
  memoryRecordTotalRef,
66571
66612
  setLiveToolCount
66572
66613
  } = environment;
66573
- const linesRef = (0, import_react100.useRef)(lines);
66614
+ const linesRef = (0, import_react102.useRef)(lines);
66574
66615
  linesRef.current = lines;
66575
- const densitiesRef = (0, import_react100.useRef)(densities);
66616
+ const densitiesRef = (0, import_react102.useRef)(densities);
66576
66617
  densitiesRef.current = densities;
66577
- const orderRef = (0, import_react100.useRef)(order);
66618
+ const orderRef = (0, import_react102.useRef)(order);
66578
66619
  orderRef.current = order;
66579
66620
  const projectRoot = agent.ctx.projectRoot;
66580
- const projectName = import_react100.default.useMemo(() => {
66621
+ const projectName = import_react102.default.useMemo(() => {
66581
66622
  const base = path4.basename(projectRoot);
66582
66623
  return base && base !== path4.sep ? base : void 0;
66583
66624
  }, [projectRoot]);
@@ -66596,7 +66637,7 @@ function useAppEnvironment(deps) {
66596
66637
  liveSettings,
66597
66638
  mailboxPanelOpen
66598
66639
  );
66599
- (0, import_react100.useEffect)(() => {
66640
+ (0, import_react102.useEffect)(() => {
66600
66641
  titleController?.setModel(liveModel);
66601
66642
  }, [titleController, liveModel]);
66602
66643
  const activity = useTuiActivity({
@@ -69396,11 +69437,11 @@ User message:
69396
69437
  }
69397
69438
 
69398
69439
  // src/hooks/use-stable-key-handler.ts
69399
- var import_react101 = __toESM(require_react(), 1);
69440
+ var import_react103 = __toESM(require_react(), 1);
69400
69441
  function useStableKeyHandler(handleKey) {
69401
- const handleKeyRef = (0, import_react101.useRef)(null);
69442
+ const handleKeyRef = (0, import_react103.useRef)(null);
69402
69443
  handleKeyRef.current = handleKey;
69403
- return (0, import_react101.useCallback)((input, key) => {
69444
+ return (0, import_react103.useCallback)((input, key) => {
69404
69445
  handleKeyRef.current?.(input, key)?.catch(() => {
69405
69446
  });
69406
69447
  return Promise.resolve();
@@ -69420,7 +69461,7 @@ function useAppExecutionPipeline(args) {
69420
69461
  }
69421
69462
 
69422
69463
  // src/hooks/use-app-picker-keys.ts
69423
- var import_react103 = __toESM(require_react(), 1);
69464
+ var import_react105 = __toESM(require_react(), 1);
69424
69465
  import { toErrorMessage as toErrorMessage6 } from "@wrongstack/core/utils";
69425
69466
 
69426
69467
  // src/resume-load.ts
@@ -69579,7 +69620,7 @@ function aliasCandidates({ cmd, owner }) {
69579
69620
  }
69580
69621
 
69581
69622
  // src/hooks/use-picker-keys.ts
69582
- var import_react102 = __toESM(require_react(), 1);
69623
+ var import_react104 = __toESM(require_react(), 1);
69583
69624
 
69584
69625
  // src/hooks/use-picker-keys-auth-model.ts
69585
69626
  function tryAuthModelPickerKeys(host, input, key, isEnter, debouncedEnter2) {
@@ -70751,7 +70792,7 @@ function debouncedEnter(host) {
70751
70792
  return false;
70752
70793
  }
70753
70794
  function usePickerKeys(host) {
70754
- return (0, import_react102.useCallback)(
70795
+ return (0, import_react104.useCallback)(
70755
70796
  (input, key, isEnter) => {
70756
70797
  if (tryAuthModelPickerKeys(host, input, key, isEnter, debouncedEnter)) {
70757
70798
  return true;
@@ -70819,16 +70860,16 @@ function useAppPickerKeys({
70819
70860
  } = panelControllers;
70820
70861
  const brainCtl = brainController;
70821
70862
  const projectRoot = agent.ctx.projectRoot;
70822
- const resumeInFlightRef = (0, import_react103.useRef)(false);
70823
- const sessionsResumeInFlightRef = (0, import_react103.useRef)(false);
70824
- const mountedRef = (0, import_react103.useRef)(true);
70825
- (0, import_react103.useEffect)(() => {
70863
+ const resumeInFlightRef = (0, import_react105.useRef)(false);
70864
+ const sessionsResumeInFlightRef = (0, import_react105.useRef)(false);
70865
+ const mountedRef = (0, import_react105.useRef)(true);
70866
+ (0, import_react105.useEffect)(() => {
70826
70867
  mountedRef.current = true;
70827
70868
  return () => {
70828
70869
  mountedRef.current = false;
70829
70870
  };
70830
70871
  }, []);
70831
- const resumeRunRef = (0, import_react103.useRef)(0);
70872
+ const resumeRunRef = (0, import_react105.useRef)(0);
70832
70873
  const runResume = async (sessionId, label, hooks = {}) => {
70833
70874
  resumeRunRef.current += 1;
70834
70875
  const run = resumeRunRef.current;
@@ -71512,47 +71553,47 @@ function buildAppPipelineArgs(params) {
71512
71553
  }
71513
71554
 
71514
71555
  // src/hooks/use-app-ref-spine.ts
71515
- var import_react106 = __toESM(require_react(), 1);
71556
+ var import_react108 = __toESM(require_react(), 1);
71516
71557
 
71517
71558
  // src/hooks/use-app-runtime-refs.ts
71518
- var import_react104 = __toESM(require_react(), 1);
71559
+ var import_react106 = __toESM(require_react(), 1);
71519
71560
  import { InputBuilder } from "@wrongstack/core/agent";
71520
71561
  function useAppRuntimeRefs(attachments, state) {
71521
- const promptUsageRef = (0, import_react104.useRef)(null);
71522
- const builderRef = (0, import_react104.useRef)(null);
71562
+ const promptUsageRef = (0, import_react106.useRef)(null);
71563
+ const builderRef = (0, import_react106.useRef)(null);
71523
71564
  if (builderRef.current === null) {
71524
71565
  builderRef.current = new InputBuilder({ store: attachments });
71525
71566
  }
71526
- const activeCtrlRef = (0, import_react104.useRef)(null);
71527
- (0, import_react104.useEffect)(
71567
+ const activeCtrlRef = (0, import_react106.useRef)(null);
71568
+ (0, import_react106.useEffect)(
71528
71569
  () => () => {
71529
71570
  activeCtrlRef.current?.abort("TUI unmounted");
71530
71571
  activeCtrlRef.current = null;
71531
71572
  },
71532
71573
  []
71533
71574
  );
71534
- const eternalLoopRunningRef = (0, import_react104.useRef)(false);
71535
- const parallelLoopRunningRef = (0, import_react104.useRef)(false);
71536
- const activeRunSettledRef = (0, import_react104.useRef)(Promise.resolve());
71537
- const exitRequestedRef = (0, import_react104.useRef)(false);
71538
- const inputGateRef = (0, import_react104.useRef)(false);
71539
- const lastEnterAtRef = (0, import_react104.useRef)(0);
71540
- const tokenPreviewsRef = (0, import_react104.useRef)(new TokenPreviewStore());
71541
- const streamingTextRef = (0, import_react104.useRef)("");
71542
- const streamSegmentsRef = (0, import_react104.useRef)([]);
71543
- const pendingDeltaRef = (0, import_react104.useRef)("");
71544
- const flushTimerRef = (0, import_react104.useRef)(null);
71545
- const sessionGenerationRef = (0, import_react104.useRef)(0);
71546
- const activeRunGenerationRef = (0, import_react104.useRef)(0);
71547
- const assistantCommittedThisRunRef = (0, import_react104.useRef)(false);
71548
- const stateRef = (0, import_react104.useRef)(state);
71575
+ const eternalLoopRunningRef = (0, import_react106.useRef)(false);
71576
+ const parallelLoopRunningRef = (0, import_react106.useRef)(false);
71577
+ const activeRunSettledRef = (0, import_react106.useRef)(Promise.resolve());
71578
+ const exitRequestedRef = (0, import_react106.useRef)(false);
71579
+ const inputGateRef = (0, import_react106.useRef)(false);
71580
+ const lastEnterAtRef = (0, import_react106.useRef)(0);
71581
+ const tokenPreviewsRef = (0, import_react106.useRef)(new TokenPreviewStore());
71582
+ const streamingTextRef = (0, import_react106.useRef)("");
71583
+ const streamSegmentsRef = (0, import_react106.useRef)([]);
71584
+ const pendingDeltaRef = (0, import_react106.useRef)("");
71585
+ const flushTimerRef = (0, import_react106.useRef)(null);
71586
+ const sessionGenerationRef = (0, import_react106.useRef)(0);
71587
+ const activeRunGenerationRef = (0, import_react106.useRef)(0);
71588
+ const assistantCommittedThisRunRef = (0, import_react106.useRef)(false);
71589
+ const stateRef = (0, import_react106.useRef)(state);
71549
71590
  stateRef.current = state;
71550
- const draftRef = (0, import_react104.useRef)({ buffer: state.buffer, cursor: state.cursor });
71591
+ const draftRef = (0, import_react106.useRef)({ buffer: state.buffer, cursor: state.cursor });
71551
71592
  draftRef.current = { buffer: state.buffer, cursor: state.cursor };
71552
- const runBlocksRef = (0, import_react104.useRef)(async () => void 0);
71553
- const lastEscAtRef = (0, import_react104.useRef)(0);
71554
- const dismissedEscAtRef = (0, import_react104.useRef)(0);
71555
- const submitRef = (0, import_react104.useRef)(() => {
71593
+ const runBlocksRef = (0, import_react106.useRef)(async () => void 0);
71594
+ const lastEscAtRef = (0, import_react106.useRef)(0);
71595
+ const dismissedEscAtRef = (0, import_react106.useRef)(0);
71596
+ const submitRef = (0, import_react106.useRef)(() => {
71556
71597
  });
71557
71598
  return {
71558
71599
  promptUsageRef,
@@ -71582,24 +71623,24 @@ function useAppRuntimeRefs(attachments, state) {
71582
71623
  }
71583
71624
 
71584
71625
  // src/hooks/use-enhance-runtime-state.ts
71585
- var import_react105 = __toESM(require_react(), 1);
71626
+ var import_react107 = __toESM(require_react(), 1);
71586
71627
  function useEnhanceRuntimeState({
71587
71628
  enhanceEnabled,
71588
71629
  midRunSendPicker
71589
71630
  }) {
71590
- const enhanceEnabledRef = (0, import_react105.useRef)(enhanceEnabled);
71591
- (0, import_react105.useEffect)(() => {
71631
+ const enhanceEnabledRef = (0, import_react107.useRef)(enhanceEnabled);
71632
+ (0, import_react107.useEffect)(() => {
71592
71633
  enhanceEnabledRef.current = enhanceEnabled;
71593
71634
  }, [enhanceEnabled]);
71594
- const midRunSendPickerRef = (0, import_react105.useRef)(midRunSendPicker);
71595
- const enhanceAbortRef = (0, import_react105.useRef)(null);
71596
- const enhanceCancelledRef = (0, import_react105.useRef)(false);
71597
- const enhanceOriginalRef = (0, import_react105.useRef)("");
71598
- const [enhanceCountdown, setEnhanceCountdown] = (0, import_react105.useState)(null);
71599
- const [enhanceStartedAt, setEnhanceStartedAt] = (0, import_react105.useState)(null);
71600
- const [enhanceDurationMs, setEnhanceDurationMs] = (0, import_react105.useState)(null);
71601
- const [refineProviderId, setRefineProviderId] = (0, import_react105.useState)(null);
71602
- const [refineModel, setRefineModel] = (0, import_react105.useState)(null);
71635
+ const midRunSendPickerRef = (0, import_react107.useRef)(midRunSendPicker);
71636
+ const enhanceAbortRef = (0, import_react107.useRef)(null);
71637
+ const enhanceCancelledRef = (0, import_react107.useRef)(false);
71638
+ const enhanceOriginalRef = (0, import_react107.useRef)("");
71639
+ const [enhanceCountdown, setEnhanceCountdown] = (0, import_react107.useState)(null);
71640
+ const [enhanceStartedAt, setEnhanceStartedAt] = (0, import_react107.useState)(null);
71641
+ const [enhanceDurationMs, setEnhanceDurationMs] = (0, import_react107.useState)(null);
71642
+ const [refineProviderId, setRefineProviderId] = (0, import_react107.useState)(null);
71643
+ const [refineModel, setRefineModel] = (0, import_react107.useState)(null);
71603
71644
  return {
71604
71645
  enhanceEnabledRef,
71605
71646
  midRunSendPickerRef,
@@ -71623,9 +71664,9 @@ function useEnhanceRuntimeState({
71623
71664
  function useAppRefSpine(deps) {
71624
71665
  const { attachments, state, midRunSendPicker } = deps;
71625
71666
  const refs = useAppRuntimeRefs(attachments, state);
71626
- const historyScrollRef = (0, import_react106.useRef)(null);
71627
- const statusBarClickMapRef = (0, import_react106.useRef)(null);
71628
- const inspectOverlayHeaderRef = (0, import_react106.useRef)(null);
71667
+ const historyScrollRef = (0, import_react108.useRef)(null);
71668
+ const statusBarClickMapRef = (0, import_react108.useRef)(null);
71669
+ const inspectOverlayHeaderRef = (0, import_react108.useRef)(null);
71629
71670
  const enhance = useEnhanceRuntimeState({
71630
71671
  enhanceEnabled: state.enhanceEnabled,
71631
71672
  midRunSendPicker: midRunSendPicker ?? false
@@ -71640,7 +71681,7 @@ function useAppRefSpine(deps) {
71640
71681
  }
71641
71682
 
71642
71683
  // src/hooks/use-app-session-state.ts
71643
- var import_react107 = __toESM(require_react(), 1);
71684
+ var import_react109 = __toESM(require_react(), 1);
71644
71685
 
71645
71686
  // src/components/history/replay.ts
71646
71687
  import {
@@ -76061,7 +76102,7 @@ var LayoutStore = class {
76061
76102
  // src/hooks/use-app-session-state.ts
76062
76103
  function useAppSessionState(options) {
76063
76104
  const restoredMessageSource = options.restoredMessages ?? options.agent.ctx.messages;
76064
- const restoredEntries = (0, import_react107.useMemo)(
76105
+ const restoredEntries = (0, import_react109.useMemo)(
76065
76106
  () => buildRestoredEntries(
76066
76107
  restoredMessageSource,
76067
76108
  options.restoredToolCalls,
@@ -76069,11 +76110,11 @@ function useAppSessionState(options) {
76069
76110
  ),
76070
76111
  [restoredMessageSource, options.restoredToolCalls, options.restoredEvents]
76071
76112
  );
76072
- const restoredCheckpoints = (0, import_react107.useMemo)(
76113
+ const restoredCheckpoints = (0, import_react109.useMemo)(
76073
76114
  () => buildRestoredCheckpoints(options.restoredEvents),
76074
76115
  [options.restoredEvents]
76075
76116
  );
76076
- const initialContextSnapshot = (0, import_react107.useMemo)(() => {
76117
+ const initialContextSnapshot = (0, import_react109.useMemo)(() => {
76077
76118
  const lastReq = options.agent?.ctx?.lastRequestTokens;
76078
76119
  const reqTokens = options.agent?.ctx?.tokenCounter?.currentRequestTokens?.();
76079
76120
  const sumReqTokens = (typeof reqTokens === "number" ? reqTokens : 0) + (typeof reqTokens?.input === "number" ? reqTokens.input : 0) + (typeof reqTokens?.cacheRead === "number" ? reqTokens.cacheRead : 0) + (typeof reqTokens?.cacheWrite === "number" ? reqTokens.cacheWrite : 0);
@@ -76081,7 +76122,7 @@ function useAppSessionState(options) {
76081
76122
  const maxContext = options.agent?.ctx?.provider?.capabilities?.maxContext ?? 0;
76082
76123
  return tokens > 0 ? { tokens, maxContext } : void 0;
76083
76124
  }, [options.agent?.ctx]);
76084
- const [state, dispatch] = (0, import_react107.useReducer)(
76125
+ const [state, dispatch] = (0, import_react109.useReducer)(
76085
76126
  reducer,
76086
76127
  createInitialState({
76087
76128
  banner: options.banner,
@@ -76103,14 +76144,14 @@ function useAppSessionState(options) {
76103
76144
  initialFleetChat: options.initialFleetChat
76104
76145
  })
76105
76146
  );
76106
- const layoutStore = (0, import_react107.useMemo)(
76147
+ const layoutStore = (0, import_react109.useMemo)(
76107
76148
  () => new LayoutStore({
76108
76149
  sessionDataDir: options.sessionsDir,
76109
76150
  ephemeral: !options.sessionsDir
76110
76151
  }),
76111
76152
  [options.sessionsDir]
76112
76153
  );
76113
- (0, import_react107.useEffect)(() => {
76154
+ (0, import_react109.useEffect)(() => {
76114
76155
  void layoutStore.load();
76115
76156
  return () => {
76116
76157
  void layoutStore.flushNow();
@@ -76120,10 +76161,10 @@ function useAppSessionState(options) {
76120
76161
  }
76121
76162
 
76122
76163
  // src/hooks/use-live-todos.ts
76123
- var import_react108 = __toESM(require_react(), 1);
76164
+ var import_react110 = __toESM(require_react(), 1);
76124
76165
  function useLiveTodos(context) {
76125
- const [todos, setTodos] = (0, import_react108.useState)(() => [...context.todos]);
76126
- (0, import_react108.useEffect)(() => {
76166
+ const [todos, setTodos] = (0, import_react110.useState)(() => [...context.todos]);
76167
+ (0, import_react110.useEffect)(() => {
76127
76168
  setTodos([...context.todos]);
76128
76169
  return context.state.onChange((change) => {
76129
76170
  if (change.kind === "todos_replaced") setTodos([...change.todos]);
@@ -76141,7 +76182,7 @@ function useAppState(deps) {
76141
76182
  }
76142
76183
 
76143
76184
  // src/hooks/use-auth-panel.ts
76144
- var import_react109 = __toESM(require_react(), 1);
76185
+ var import_react111 = __toESM(require_react(), 1);
76145
76186
  function abortError() {
76146
76187
  return Object.assign(new Error("Cancelled"), { name: "AbortError" });
76147
76188
  }
@@ -76150,11 +76191,11 @@ function toMessage(err) {
76150
76191
  }
76151
76192
  function useAuthPanel(opts) {
76152
76193
  const { authHost, stateRef, dispatch, open: open2 } = opts;
76153
- const flowAbortRef = (0, import_react109.useRef)(null);
76154
- const standaloneSecretRef = (0, import_react109.useRef)(false);
76155
- const promptRef = (0, import_react109.useRef)(null);
76156
- const mountedRef = (0, import_react109.useRef)(true);
76157
- const abortLiveFlow = (0, import_react109.useCallback)(() => {
76194
+ const flowAbortRef = (0, import_react111.useRef)(null);
76195
+ const standaloneSecretRef = (0, import_react111.useRef)(false);
76196
+ const promptRef = (0, import_react111.useRef)(null);
76197
+ const mountedRef = (0, import_react111.useRef)(true);
76198
+ const abortLiveFlow = (0, import_react111.useCallback)(() => {
76158
76199
  flowAbortRef.current?.abort();
76159
76200
  flowAbortRef.current = null;
76160
76201
  standaloneSecretRef.current = false;
@@ -76162,17 +76203,17 @@ function useAuthPanel(opts) {
76162
76203
  promptRef.current = null;
76163
76204
  pending?.reject(abortError());
76164
76205
  }, []);
76165
- (0, import_react109.useEffect)(() => {
76206
+ (0, import_react111.useEffect)(() => {
76166
76207
  mountedRef.current = true;
76167
76208
  return () => {
76168
76209
  mountedRef.current = false;
76169
76210
  abortLiveFlow();
76170
76211
  };
76171
76212
  }, [abortLiveFlow]);
76172
- (0, import_react109.useEffect)(() => {
76213
+ (0, import_react111.useEffect)(() => {
76173
76214
  if (!open2) abortLiveFlow();
76174
76215
  }, [open2, abortLiveFlow]);
76175
- const reloadProviders = (0, import_react109.useCallback)(async () => {
76216
+ const reloadProviders = (0, import_react111.useCallback)(async () => {
76176
76217
  if (!authHost || !mountedRef.current) return;
76177
76218
  try {
76178
76219
  const providers = await authHost.listProviders();
@@ -76183,7 +76224,7 @@ function useAuthPanel(opts) {
76183
76224
  dispatch({ type: "authBusy", busy: false });
76184
76225
  }
76185
76226
  }, [authHost, dispatch]);
76186
- const openAuthPanel = (0, import_react109.useCallback)(
76227
+ const openAuthPanel = (0, import_react111.useCallback)(
76187
76228
  (view = "list") => {
76188
76229
  if (!authHost) return false;
76189
76230
  abortLiveFlow();
@@ -76198,7 +76239,7 @@ function useAuthPanel(opts) {
76198
76239
  },
76199
76240
  [authHost, dispatch, reloadProviders, abortLiveFlow]
76200
76241
  );
76201
- const runFlow = (0, import_react109.useCallback)(
76242
+ const runFlow = (0, import_react111.useCallback)(
76202
76243
  (title, run) => {
76203
76244
  if (!authHost) return;
76204
76245
  const ac = new AbortController();
@@ -76239,7 +76280,7 @@ function useAuthPanel(opts) {
76239
76280
  },
76240
76281
  [authHost, dispatch, reloadProviders, stateRef]
76241
76282
  );
76242
- const openCatalog = (0, import_react109.useCallback)(() => {
76283
+ const openCatalog = (0, import_react111.useCallback)(() => {
76243
76284
  if (!authHost) return;
76244
76285
  dispatch({ type: "authView", view: "catalog" });
76245
76286
  dispatch({ type: "authBusy", busy: true });
@@ -76254,7 +76295,7 @@ function useAuthPanel(opts) {
76254
76295
  }
76255
76296
  })();
76256
76297
  }, [authHost, dispatch]);
76257
- const openCustomSetupForm = (0, import_react109.useCallback)(() => {
76298
+ const openCustomSetupForm = (0, import_react111.useCallback)(() => {
76258
76299
  dispatch({
76259
76300
  type: "authFormStart",
76260
76301
  form: {
@@ -76273,7 +76314,7 @@ function useAuthPanel(opts) {
76273
76314
  }
76274
76315
  });
76275
76316
  }, [dispatch]);
76276
- const openCatalogSetupForm = (0, import_react109.useCallback)(
76317
+ const openCatalogSetupForm = (0, import_react111.useCallback)(
76277
76318
  (entry2) => {
76278
76319
  const family = WIRE_FAMILIES.includes(entry2.family) ? entry2.family : "openai-compatible";
76279
76320
  dispatch({
@@ -76296,7 +76337,7 @@ function useAuthPanel(opts) {
76296
76337
  },
76297
76338
  [dispatch]
76298
76339
  );
76299
- const openEditProviderForm = (0, import_react109.useCallback)(
76340
+ const openEditProviderForm = (0, import_react111.useCallback)(
76300
76341
  (providerId) => {
76301
76342
  const provider = stateRef.current.authPanel.providers.find((p) => p.id === providerId);
76302
76343
  if (!provider) {
@@ -76327,7 +76368,7 @@ function useAuthPanel(opts) {
76327
76368
  },
76328
76369
  [dispatch, stateRef]
76329
76370
  );
76330
- const submitAuthForm = (0, import_react109.useCallback)(async () => {
76371
+ const submitAuthForm = (0, import_react111.useCallback)(async () => {
76331
76372
  if (!authHost) return;
76332
76373
  const form = stateRef.current.authPanel.form;
76333
76374
  if (!form) return;
@@ -76373,7 +76414,7 @@ function useAuthPanel(opts) {
76373
76414
  });
76374
76415
  await reloadProviders();
76375
76416
  }, [authHost, stateRef, dispatch, reloadProviders]);
76376
- const openLocalForm = (0, import_react109.useCallback)(
76417
+ const openLocalForm = (0, import_react111.useCallback)(
76377
76418
  (preset) => {
76378
76419
  dispatch({
76379
76420
  type: "authFormStart",
@@ -76396,7 +76437,7 @@ function useAuthPanel(opts) {
76396
76437
  },
76397
76438
  [dispatch]
76398
76439
  );
76399
- const startLocalFlow = (0, import_react109.useCallback)(
76440
+ const startLocalFlow = (0, import_react111.useCallback)(
76400
76441
  (form) => {
76401
76442
  if (!authHost) return;
76402
76443
  const presetId = form.presetId ?? "";
@@ -76411,7 +76452,7 @@ function useAuthPanel(opts) {
76411
76452
  },
76412
76453
  [authHost, stateRef, runFlow]
76413
76454
  );
76414
- const onAuthEnter = (0, import_react109.useCallback)(() => {
76455
+ const onAuthEnter = (0, import_react111.useCallback)(() => {
76415
76456
  if (!authHost) return;
76416
76457
  const panel = stateRef.current.authPanel;
76417
76458
  if (panel.busy && panel.view !== "flow") return;
@@ -76514,7 +76555,7 @@ function useAuthPanel(opts) {
76514
76555
  return;
76515
76556
  }
76516
76557
  }, [authHost, stateRef, dispatch, runFlow, openCatalog, reloadProviders]);
76517
- const onAuthBack = (0, import_react109.useCallback)(() => {
76558
+ const onAuthBack = (0, import_react111.useCallback)(() => {
76518
76559
  const panel = stateRef.current.authPanel;
76519
76560
  if (panel.view === "catalog" && panel.filter.length > 0) {
76520
76561
  dispatch({ type: "authFilter", filter: "" });
@@ -76530,7 +76571,7 @@ function useAuthPanel(opts) {
76530
76571
  }
76531
76572
  dispatch({ type: "authView", view: "list" });
76532
76573
  }, [stateRef, dispatch]);
76533
- const onAuthShortcut = (0, import_react109.useCallback)(
76574
+ const onAuthShortcut = (0, import_react111.useCallback)(
76534
76575
  (input) => {
76535
76576
  if (!authHost) return;
76536
76577
  const panel = stateRef.current.authPanel;
@@ -76585,7 +76626,7 @@ function useAuthPanel(opts) {
76585
76626
  },
76586
76627
  [authHost, stateRef, dispatch, runFlow, reloadProviders]
76587
76628
  );
76588
- const onAuthPromptSubmit = (0, import_react109.useCallback)(() => {
76629
+ const onAuthPromptSubmit = (0, import_react111.useCallback)(() => {
76589
76630
  const pending = promptRef.current;
76590
76631
  const draft = stateRef.current.authPanel.input?.draft ?? "";
76591
76632
  promptRef.current = null;
@@ -76596,7 +76637,7 @@ function useAuthPanel(opts) {
76596
76637
  }
76597
76638
  pending?.resolve(draft);
76598
76639
  }, [stateRef, dispatch]);
76599
- const onAuthPromptCancel = (0, import_react109.useCallback)(() => {
76640
+ const onAuthPromptCancel = (0, import_react111.useCallback)(() => {
76600
76641
  const pending = promptRef.current;
76601
76642
  promptRef.current = null;
76602
76643
  dispatch({ type: "authPromptEnd" });
@@ -76606,7 +76647,7 @@ function useAuthPanel(opts) {
76606
76647
  }
76607
76648
  pending?.reject(abortError());
76608
76649
  }, [dispatch]);
76609
- const readPrompt = (0, import_react109.useCallback)(
76650
+ const readPrompt = (0, import_react111.useCallback)(
76610
76651
  (label, masked) => new Promise((resolve, reject) => {
76611
76652
  const pending = promptRef.current;
76612
76653
  if (pending) {
@@ -76620,9 +76661,9 @@ function useAuthPanel(opts) {
76620
76661
  }),
76621
76662
  [dispatch]
76622
76663
  );
76623
- const readSecret = (0, import_react109.useCallback)((label) => readPrompt(label, true), [readPrompt]);
76624
- const readText = (0, import_react109.useCallback)((label) => readPrompt(label, false), [readPrompt]);
76625
- const onAuthConfirm = (0, import_react109.useCallback)(
76664
+ const readSecret = (0, import_react111.useCallback)((label) => readPrompt(label, true), [readPrompt]);
76665
+ const readText = (0, import_react111.useCallback)((label) => readPrompt(label, false), [readPrompt]);
76666
+ const onAuthConfirm = (0, import_react111.useCallback)(
76626
76667
  (yes) => {
76627
76668
  if (!authHost) return;
76628
76669
  const confirm = stateRef.current.authPanel.confirm;
@@ -76657,7 +76698,7 @@ function useAuthPanel(opts) {
76657
76698
  },
76658
76699
  [authHost, stateRef, dispatch, reloadProviders]
76659
76700
  );
76660
- const onAuthFlowCancel = (0, import_react109.useCallback)(() => {
76701
+ const onAuthFlowCancel = (0, import_react111.useCallback)(() => {
76661
76702
  const panel = stateRef.current.authPanel;
76662
76703
  if (panel.flowDone) {
76663
76704
  dispatch({ type: "authView", view: "list" });
@@ -76666,7 +76707,7 @@ function useAuthPanel(opts) {
76666
76707
  dispatch({ type: "authPromptEnd" });
76667
76708
  abortLiveFlow();
76668
76709
  }, [stateRef, dispatch, abortLiveFlow]);
76669
- const onAuthCtrlC = (0, import_react109.useCallback)(() => {
76710
+ const onAuthCtrlC = (0, import_react111.useCallback)(() => {
76670
76711
  dispatch({ type: "authPromptEnd" });
76671
76712
  abortLiveFlow();
76672
76713
  dispatch({ type: "authClose" });
@@ -76688,17 +76729,17 @@ function useAuthPanel(opts) {
76688
76729
  }
76689
76730
 
76690
76731
  // src/hooks/use-autonomous-coordinator.ts
76691
- var import_react110 = __toESM(require_react(), 1);
76732
+ var import_react112 = __toESM(require_react(), 1);
76692
76733
  function useAutonomousCoordinator(subscribeCoordinatorEvents, dispatch) {
76693
- const dispatchRef = (0, import_react110.useRef)(dispatch);
76734
+ const dispatchRef = (0, import_react112.useRef)(dispatch);
76694
76735
  dispatchRef.current = dispatch;
76695
- const handler = (0, import_react110.useCallback)((event) => {
76736
+ const handler = (0, import_react112.useCallback)((event) => {
76696
76737
  dispatchRef.current({
76697
76738
  type: "coordinatorEvent",
76698
76739
  event
76699
76740
  });
76700
76741
  }, []);
76701
- (0, import_react110.useEffect)(() => {
76742
+ (0, import_react112.useEffect)(() => {
76702
76743
  if (!subscribeCoordinatorEvents) return;
76703
76744
  const unsubscribe = subscribeCoordinatorEvents(handler);
76704
76745
  return unsubscribe;
@@ -76706,7 +76747,7 @@ function useAutonomousCoordinator(subscribeCoordinatorEvents, dispatch) {
76706
76747
  }
76707
76748
 
76708
76749
  // src/hooks/use-brain-panel.ts
76709
- var import_react111 = __toESM(require_react(), 1);
76750
+ var import_react113 = __toESM(require_react(), 1);
76710
76751
  function cycleEnum(values, current, delta) {
76711
76752
  const at = values.indexOf(current);
76712
76753
  return values[(((at >= 0 ? at : 0) + delta) % values.length + values.length) % values.length];
@@ -76720,7 +76761,7 @@ var DENY_TERMINAL_MODES = ["never", "when-decided", "always"];
76720
76761
  var TRACE_CONTENT_MODES = ["none", "redacted", "full"];
76721
76762
  function useBrainPanel(opts) {
76722
76763
  const { dispatch, getBrainData, brainPanelHost, requestModelPick } = opts;
76723
- const openBrainPanel = import_react111.default.useCallback(() => {
76764
+ const openBrainPanel = import_react113.default.useCallback(() => {
76724
76765
  if (!getBrainData) return;
76725
76766
  const data = getBrainData();
76726
76767
  dispatch({
@@ -76730,7 +76771,7 @@ function useBrainPanel(opts) {
76730
76771
  settings: brainPanelHost?.getSettings()
76731
76772
  });
76732
76773
  }, [dispatch, getBrainData, brainPanelHost]);
76733
- const runBrainMutation = import_react111.default.useCallback(
76774
+ const runBrainMutation = import_react113.default.useCallback(
76734
76775
  (op, successHint, onSuccess) => {
76735
76776
  if (!brainPanelHost) return;
76736
76777
  dispatch({ type: "brainBusy", busy: true });
@@ -76748,14 +76789,14 @@ function useBrainPanel(opts) {
76748
76789
  },
76749
76790
  [dispatch, brainPanelHost]
76750
76791
  );
76751
- const reportError2 = import_react111.default.useCallback(
76792
+ const reportError2 = import_react113.default.useCallback(
76752
76793
  (e) => {
76753
76794
  dispatch({ type: "brainBusy", busy: false });
76754
76795
  dispatch({ type: "brainHint", text: e instanceof Error ? e.message : String(e) });
76755
76796
  },
76756
76797
  [dispatch]
76757
76798
  );
76758
- const pickThenApply = import_react111.default.useCallback(
76799
+ const pickThenApply = import_react113.default.useCallback(
76759
76800
  (title, apply) => {
76760
76801
  if (!requestModelPick) return;
76761
76802
  void requestModelPick(title).then((sel) => {
@@ -76764,7 +76805,7 @@ function useBrainPanel(opts) {
76764
76805
  },
76765
76806
  [requestModelPick, runBrainMutation, reportError2]
76766
76807
  );
76767
- const addVotersViaPicker = import_react111.default.useCallback(() => {
76808
+ const addVotersViaPicker = import_react113.default.useCallback(() => {
76768
76809
  const host = brainPanelHost;
76769
76810
  if (!host || !requestModelPick) return;
76770
76811
  const loop = async () => {
@@ -76780,7 +76821,7 @@ function useBrainPanel(opts) {
76780
76821
  };
76781
76822
  void loop().catch(reportError2);
76782
76823
  }, [dispatch, brainPanelHost, requestModelPick, reportError2]);
76783
- const handleBrainAdjust = import_react111.default.useCallback(
76824
+ const handleBrainAdjust = import_react113.default.useCallback(
76784
76825
  (row, delta) => {
76785
76826
  const host = brainPanelHost;
76786
76827
  const settings = host?.getSettings();
@@ -76955,7 +76996,7 @@ function useBrainPanel(opts) {
76955
76996
  },
76956
76997
  [brainPanelHost, runBrainMutation]
76957
76998
  );
76958
- const handleBrainEnter = import_react111.default.useCallback(
76999
+ const handleBrainEnter = import_react113.default.useCallback(
76959
77000
  (row) => {
76960
77001
  switch (row.kind) {
76961
77002
  case "mode":
@@ -77012,7 +77053,7 @@ function useBrainPanel(opts) {
77012
77053
  },
77013
77054
  [brainPanelHost, handleBrainAdjust, addVotersViaPicker, pickThenApply, runBrainMutation]
77014
77055
  );
77015
- const handleBrainDelete = import_react111.default.useCallback(
77056
+ const handleBrainDelete = import_react113.default.useCallback(
77016
77057
  (row) => {
77017
77058
  const host = brainPanelHost;
77018
77059
  if (!host) return;
@@ -77022,7 +77063,7 @@ function useBrainPanel(opts) {
77022
77063
  },
77023
77064
  [brainPanelHost, runBrainMutation]
77024
77065
  );
77025
- const handleBrainVoterMod = import_react111.default.useCallback(
77066
+ const handleBrainVoterMod = import_react113.default.useCallback(
77026
77067
  (index, mod) => {
77027
77068
  const host = brainPanelHost;
77028
77069
  if (!host) return;
@@ -77042,21 +77083,21 @@ function useBrainPanel(opts) {
77042
77083
  }
77043
77084
 
77044
77085
  // src/hooks/use-brain-risk-sync.ts
77045
- var import_react112 = __toESM(require_react(), 1);
77086
+ var import_react114 = __toESM(require_react(), 1);
77046
77087
  function useBrainRiskSync({
77047
77088
  dispatch,
77048
77089
  riskLevel,
77049
77090
  brainPanelOpen,
77050
77091
  onBrainRiskLevel
77051
77092
  }) {
77052
- const changeBrainRisk = (0, import_react112.useCallback)(
77093
+ const changeBrainRisk = (0, import_react114.useCallback)(
77053
77094
  (delta) => {
77054
77095
  dispatch({ type: "brainRiskChange", delta });
77055
77096
  },
77056
77097
  [dispatch]
77057
77098
  );
77058
- const prevRiskRef = (0, import_react112.useRef)(riskLevel);
77059
- (0, import_react112.useEffect)(() => {
77099
+ const prevRiskRef = (0, import_react114.useRef)(riskLevel);
77100
+ (0, import_react114.useEffect)(() => {
77060
77101
  if (!brainPanelOpen) return;
77061
77102
  if (riskLevel !== prevRiskRef.current && onBrainRiskLevel) {
77062
77103
  prevRiskRef.current = riskLevel;
@@ -77069,7 +77110,7 @@ function useBrainRiskSync({
77069
77110
  }
77070
77111
 
77071
77112
  // src/hooks/use-bug-hunt-loop.ts
77072
- var import_react113 = __toESM(require_react(), 1);
77113
+ var import_react115 = __toESM(require_react(), 1);
77073
77114
  function parseBugHuntScope(command) {
77074
77115
  const args = command.replace(/^\/bughunt(?:\s+|$)/, "").trim();
77075
77116
  const match = args.match(/^--rounds(?:\s+|=)\d+(?:\s+([\s\S]*))?$/);
@@ -77086,17 +77127,17 @@ function submitAfterCurrentRun(submit) {
77086
77127
  return setTimeout(submit, 0);
77087
77128
  }
77088
77129
  function useBugHuntLoop(dispatch, submit, historyGen) {
77089
- const activeRef = (0, import_react113.useRef)(null);
77090
- const replayCommandRef = (0, import_react113.useRef)(null);
77091
- const pendingSubmitRef = (0, import_react113.useRef)(null);
77092
- const cancelPendingSubmit = (0, import_react113.useCallback)(() => {
77130
+ const activeRef = (0, import_react115.useRef)(null);
77131
+ const replayCommandRef = (0, import_react115.useRef)(null);
77132
+ const pendingSubmitRef = (0, import_react115.useRef)(null);
77133
+ const cancelPendingSubmit = (0, import_react115.useCallback)(() => {
77093
77134
  if (pendingSubmitRef.current !== null) clearTimeout(pendingSubmitRef.current);
77094
77135
  pendingSubmitRef.current = null;
77095
77136
  replayCommandRef.current = null;
77096
77137
  }, []);
77097
- (0, import_react113.useEffect)(() => cancelPendingSubmit, [cancelPendingSubmit]);
77098
- const lastHistoryGenRef = (0, import_react113.useRef)(historyGen);
77099
- (0, import_react113.useEffect)(() => {
77138
+ (0, import_react115.useEffect)(() => cancelPendingSubmit, [cancelPendingSubmit]);
77139
+ const lastHistoryGenRef = (0, import_react115.useRef)(historyGen);
77140
+ (0, import_react115.useEffect)(() => {
77100
77141
  if (historyGen === void 0) return;
77101
77142
  if (historyGen === lastHistoryGenRef.current) return;
77102
77143
  lastHistoryGenRef.current = historyGen;
@@ -77104,7 +77145,7 @@ function useBugHuntLoop(dispatch, submit, historyGen) {
77104
77145
  activeRef.current = null;
77105
77146
  replayCommandRef.current = null;
77106
77147
  }, [historyGen, cancelPendingSubmit]);
77107
- const onBugHuntStarted = (0, import_react113.useCallback)(
77148
+ const onBugHuntStarted = (0, import_react115.useCallback)(
77108
77149
  (command, totalRounds) => {
77109
77150
  const active = activeRef.current;
77110
77151
  if (active?.command === command) {
@@ -77128,7 +77169,7 @@ function useBugHuntLoop(dispatch, submit, historyGen) {
77128
77169
  },
77129
77170
  [dispatch, cancelPendingSubmit]
77130
77171
  );
77131
- const onRunFinished = (0, import_react113.useCallback)(
77172
+ const onRunFinished = (0, import_react115.useCallback)(
77132
77173
  (status) => {
77133
77174
  const active = activeRef.current;
77134
77175
  if (!active) return;
@@ -77180,17 +77221,17 @@ function useBugHuntLoop(dispatch, submit, historyGen) {
77180
77221
  },
77181
77222
  [dispatch, submit, cancelPendingSubmit]
77182
77223
  );
77183
- const consumeReplay = (0, import_react113.useCallback)((command) => {
77224
+ const consumeReplay = (0, import_react115.useCallback)((command) => {
77184
77225
  if (replayCommandRef.current !== command) return false;
77185
77226
  replayCommandRef.current = null;
77186
77227
  return true;
77187
77228
  }, []);
77188
- const shouldSuppressNextSteps = (0, import_react113.useCallback)(() => activeRef.current !== null, []);
77229
+ const shouldSuppressNextSteps = (0, import_react115.useCallback)(() => activeRef.current !== null, []);
77189
77230
  return { onBugHuntStarted, onRunFinished, consumeReplay, shouldSuppressNextSteps };
77190
77231
  }
77191
77232
 
77192
77233
  // src/hooks/use-client-telemetry.ts
77193
- var import_react114 = __toESM(require_react(), 1);
77234
+ var import_react116 = __toESM(require_react(), 1);
77194
77235
  import { projectSlug } from "@wrongstack/core/utils";
77195
77236
  function useClientTelemetry({
77196
77237
  events,
@@ -77202,7 +77243,7 @@ function useClientTelemetry({
77202
77243
  restoreDebugStreamCallback,
77203
77244
  dispatch
77204
77245
  }) {
77205
- (0, import_react114.useEffect)(() => {
77246
+ (0, import_react116.useEffect)(() => {
77206
77247
  if (!clientId || !events) return;
77207
77248
  let toolCalls = 0;
77208
77249
  const emitStatus = () => {
@@ -77244,7 +77285,7 @@ function useClientTelemetry({
77244
77285
  offIterCompleted();
77245
77286
  };
77246
77287
  }, [events, clientId, tokenCounter, getAutonomy, agent.ctx.model, agent.ctx.projectRoot]);
77247
- (0, import_react114.useEffect)(() => {
77288
+ (0, import_react116.useEffect)(() => {
77248
77289
  if (!registerDebugStreamCallback) return;
77249
77290
  let cancelled = false;
77250
77291
  registerDebugStreamCallback((stats) => {
@@ -77274,7 +77315,7 @@ function useClientTelemetry({
77274
77315
  }
77275
77316
 
77276
77317
  // src/hooks/use-core-tui-commands.ts
77277
- var import_react115 = __toESM(require_react(), 1);
77318
+ var import_react117 = __toESM(require_react(), 1);
77278
77319
  import { toErrorMessage as toErrorMessage7 } from "@wrongstack/core/utils";
77279
77320
  import { getProcessRegistry as getProcessRegistry7 } from "@wrongstack/tools";
77280
77321
 
@@ -77949,6 +77990,10 @@ function renderHealthReport(health2) {
77949
77990
  attention.push(
77950
77991
  ` heartbeat-due ${health2.heartbeatDue.count}` + (health2.heartbeatDue.count > 0 ? ` (first: ${summarizeSearchResult(health2.heartbeatDue.tasks[0])})` : "")
77951
77992
  );
77993
+ const parkedCount = health2.parked?.count ?? 0;
77994
+ attention.push(
77995
+ ` parked ${parkedCount}` + (parkedCount > 0 ? ` (first: ${summarizeSearchResult(health2.parked?.tasks[0])})` : "")
77996
+ );
77952
77997
  attention.push("");
77953
77998
  const stamps = [" **Activity**"];
77954
77999
  stamps.push(` last dispatch ${health2.lastDispatchedAt ?? "never"}`);
@@ -79196,8 +79241,8 @@ function useCoreTuiCommands({
79196
79241
  handleRewindTo
79197
79242
  }) {
79198
79243
  const stdout = { columns: terminalWidth };
79199
- const getCronJobs = (0, import_react115.useMemo)(() => createCronJobsGetter(agent), [agent]);
79200
- (0, import_react115.useEffect)(() => {
79244
+ const getCronJobs = (0, import_react117.useMemo)(() => createCronJobsGetter(agent), [agent]);
79245
+ (0, import_react117.useEffect)(() => {
79201
79246
  const cleanups = [];
79202
79247
  cleanups.push(registerSlashCommandLifecycle(slashRegistry, createKillSlashCommand()));
79203
79248
  cleanups.push(registerSlashCommandLifecycle(slashRegistry, createPsSlashCommand()));
@@ -79272,12 +79317,12 @@ function useCoreTuiCommands({
79272
79317
  getModeLabel,
79273
79318
  getCronJobs
79274
79319
  ]);
79275
- (0, import_react115.useEffect)(() => {
79320
+ (0, import_react117.useEffect)(() => {
79276
79321
  return () => {
79277
79322
  getProcessRegistry7().killAll({ preserveBackground: true });
79278
79323
  };
79279
79324
  }, []);
79280
- const runSteerSequence = (0, import_react115.useCallback)(
79325
+ const runSteerSequence = (0, import_react117.useCallback)(
79281
79326
  (text) => {
79282
79327
  const s2 = stateRef.current;
79283
79328
  const runningTools = Array.from(s2.runningTools.values()).map((t) => t.name);
@@ -79304,7 +79349,7 @@ function useCoreTuiCommands({
79304
79349
  },
79305
79350
  [liveDirector, clearPendingConfirms, dispatch]
79306
79351
  );
79307
- (0, import_react115.useEffect)(() => {
79352
+ (0, import_react117.useEffect)(() => {
79308
79353
  const cmd = {
79309
79354
  name: "steer",
79310
79355
  description: "Interrupt the running agent (incl. fleet) and redirect: /steer <new direction>",
@@ -79333,7 +79378,7 @@ function useCoreTuiCommands({
79333
79378
  };
79334
79379
  return registerSlashCommandLifecycle(slashRegistry, cmd);
79335
79380
  }, [slashRegistry, director, runSteerSequence]);
79336
- (0, import_react115.useEffect)(() => {
79381
+ (0, import_react117.useEffect)(() => {
79337
79382
  const cmd = {
79338
79383
  name: "rewind",
79339
79384
  description: "Open checkpoint timeline to rewind session: /rewind [checkpoint-index]",
@@ -79367,7 +79412,7 @@ function useCoreTuiCommands({
79367
79412
  };
79368
79413
  return registerSlashCommandLifecycle(slashRegistry, cmd);
79369
79414
  }, [slashRegistry, handleRewindTo]);
79370
- (0, import_react115.useEffect)(() => {
79415
+ (0, import_react117.useEffect)(() => {
79371
79416
  const original = slashRegistry.get("agents");
79372
79417
  const cmd = {
79373
79418
  name: "agents",
@@ -79392,7 +79437,7 @@ function useCoreTuiCommands({
79392
79437
  }
79393
79438
 
79394
79439
  // src/hooks/use-director-fleet-bridge.ts
79395
- var import_react117 = __toESM(require_react(), 1);
79440
+ var import_react119 = __toESM(require_react(), 1);
79396
79441
  import { stripNextStepsBlock } from "@wrongstack/tools/next-steps";
79397
79442
 
79398
79443
  // src/hooks/fleet-chat-coalescer.ts
@@ -79489,11 +79534,11 @@ function formatDelegateSuccessText(input) {
79489
79534
  }
79490
79535
 
79491
79536
  // src/hooks/use-fleet-generation-gate.ts
79492
- var import_react116 = __toESM(require_react(), 1);
79537
+ var import_react118 = __toESM(require_react(), 1);
79493
79538
  function useFleetGenerationGate(sessionGenerationRef) {
79494
- const spawnGenRef = (0, import_react116.useRef)(/* @__PURE__ */ new Map());
79495
- const sweptGenRef = (0, import_react116.useRef)(void 0);
79496
- const sweep = (0, import_react116.useCallback)(() => {
79539
+ const spawnGenRef = (0, import_react118.useRef)(/* @__PURE__ */ new Map());
79540
+ const sweptGenRef = (0, import_react118.useRef)(void 0);
79541
+ const sweep = (0, import_react118.useCallback)(() => {
79497
79542
  if (!sessionGenerationRef) return;
79498
79543
  const cur = sessionGenerationRef.current;
79499
79544
  if (sweptGenRef.current === cur) return;
@@ -79502,7 +79547,7 @@ function useFleetGenerationGate(sessionGenerationRef) {
79502
79547
  if (gen < cur - 1) spawnGenRef.current.delete(id);
79503
79548
  }
79504
79549
  }, [sessionGenerationRef]);
79505
- const track = (0, import_react116.useCallback)(
79550
+ const track = (0, import_react118.useCallback)(
79506
79551
  (subagentId) => {
79507
79552
  if (sessionGenerationRef) {
79508
79553
  sweep();
@@ -79511,7 +79556,7 @@ function useFleetGenerationGate(sessionGenerationRef) {
79511
79556
  },
79512
79557
  [sessionGenerationRef, sweep]
79513
79558
  );
79514
- const isLive = (0, import_react116.useCallback)(
79559
+ const isLive = (0, import_react118.useCallback)(
79515
79560
  (subagentId) => {
79516
79561
  if (!sessionGenerationRef) return true;
79517
79562
  const gen = spawnGenRef.current.get(subagentId);
@@ -79520,10 +79565,10 @@ function useFleetGenerationGate(sessionGenerationRef) {
79520
79565
  },
79521
79566
  [sessionGenerationRef]
79522
79567
  );
79523
- const forget = (0, import_react116.useCallback)((subagentId) => {
79568
+ const forget = (0, import_react118.useCallback)((subagentId) => {
79524
79569
  spawnGenRef.current.delete(subagentId);
79525
79570
  }, []);
79526
- return (0, import_react116.useMemo)(() => ({ track, isLive, forget, sweep }), [track, isLive, forget, sweep]);
79571
+ return (0, import_react118.useMemo)(() => ({ track, isLive, forget, sweep }), [track, isLive, forget, sweep]);
79527
79572
  }
79528
79573
 
79529
79574
  // src/hooks/use-director-fleet-bridge.ts
@@ -79548,13 +79593,13 @@ function useDirectorFleetBridge({
79548
79593
  chatMode,
79549
79594
  sessionGenerationRef
79550
79595
  }) {
79551
- const labelsRef = (0, import_react117.useRef)(/* @__PURE__ */ new Map());
79552
- const chatModeRef = (0, import_react117.useRef)(chatMode);
79596
+ const labelsRef = (0, import_react119.useRef)(/* @__PURE__ */ new Map());
79597
+ const chatModeRef = (0, import_react119.useRef)(chatMode);
79553
79598
  const gate = useFleetGenerationGate(sessionGenerationRef);
79554
- (0, import_react117.useEffect)(() => {
79599
+ (0, import_react119.useEffect)(() => {
79555
79600
  chatModeRef.current = chatMode;
79556
79601
  }, [chatMode]);
79557
- (0, import_react117.useEffect)(() => {
79602
+ (0, import_react119.useEffect)(() => {
79558
79603
  const d = director;
79559
79604
  if (!d) return;
79560
79605
  const batch = [];
@@ -80020,7 +80065,7 @@ function handleCollabDone(event, dispatch, stateRef) {
80020
80065
  }
80021
80066
 
80022
80067
  // src/hooks/use-exit-command.ts
80023
- var import_react118 = __toESM(require_react(), 1);
80068
+ var import_react120 = __toESM(require_react(), 1);
80024
80069
  import { getProcessRegistry as getProcessRegistry8 } from "@wrongstack/tools";
80025
80070
 
80026
80071
  // src/exit-slash.ts
@@ -80067,14 +80112,14 @@ function useExitCommand({
80067
80112
  interruptController,
80068
80113
  getDirector
80069
80114
  }) {
80070
- const hostExitCommandRef = (0, import_react118.useRef)(void 0);
80071
- const hostExitCapturedRef = (0, import_react118.useRef)(false);
80115
+ const hostExitCommandRef = (0, import_react120.useRef)(void 0);
80116
+ const hostExitCapturedRef = (0, import_react120.useRef)(false);
80072
80117
  if (!hostExitCapturedRef.current) {
80073
80118
  hostExitCommandRef.current = slashRegistry.get?.("exit");
80074
80119
  hostExitCapturedRef.current = true;
80075
80120
  }
80076
- const pendingResolveRef = (0, import_react118.useRef)(null);
80077
- const terminateWork = (0, import_react118.useCallback)(async () => {
80121
+ const pendingResolveRef = (0, import_react120.useRef)(null);
80122
+ const terminateWork = (0, import_react120.useCallback)(async () => {
80078
80123
  sessionGenerationRef.current += 1;
80079
80124
  interruptController?.abortLeader();
80080
80125
  const cleanup = [];
@@ -80095,7 +80140,7 @@ function useExitCommand({
80095
80140
  if (timeout) clearTimeout(timeout);
80096
80141
  }
80097
80142
  }, [getDirector, interruptController, sessionGenerationRef]);
80098
- const confirmExit = (0, import_react118.useCallback)(
80143
+ const confirmExit = (0, import_react120.useCallback)(
80099
80144
  (info) => {
80100
80145
  if (!info.leaderActive && info.subagentCount === 0) {
80101
80146
  return Promise.resolve(true);
@@ -80127,7 +80172,7 @@ function useExitCommand({
80127
80172
  },
80128
80173
  [dispatch, terminateWork]
80129
80174
  );
80130
- (0, import_react118.useEffect)(() => {
80175
+ (0, import_react120.useEffect)(() => {
80131
80176
  const cmd = createExitSlashCommand({
80132
80177
  isLeaderActive: () => interruptController?.isRunning?.() ?? stateRef.current.status !== "idle",
80133
80178
  countRunningSubagents: () => Object.values(stateRef.current.fleet).filter((e) => e.status === "running").length,
@@ -80144,7 +80189,7 @@ function useExitCommand({
80144
80189
  }
80145
80190
 
80146
80191
  // src/hooks/use-file-search.ts
80147
- var import_react119 = __toESM(require_react(), 1);
80192
+ var import_react121 = __toESM(require_react(), 1);
80148
80193
  import * as fs6 from "node:fs/promises";
80149
80194
  import * as path7 from "node:path";
80150
80195
  import { toErrorMessage as toErrorMessage8 } from "@wrongstack/core/utils";
@@ -80162,7 +80207,13 @@ var IGNORED_DIRS = /* @__PURE__ */ new Set([
80162
80207
  ".cache",
80163
80208
  "coverage",
80164
80209
  ".idea",
80165
- ".vscode"
80210
+ ".vscode",
80211
+ ".venv",
80212
+ "venv",
80213
+ "target",
80214
+ "vendor",
80215
+ ".gradle",
80216
+ ".yarn"
80166
80217
  ]);
80167
80218
  var MAX_FILES_INDEXED = 5e3;
80168
80219
  var MAX_DEPTH = 8;
@@ -80250,7 +80301,7 @@ function detectAtToken(buffer, cursor) {
80250
80301
  }
80251
80302
  function useFileSearch(options) {
80252
80303
  const { state, dispatch, projectRoot, builderRef, draftRef, setDraft, tokenPreviewsRef } = options;
80253
- (0, import_react119.useEffect)(() => {
80304
+ (0, import_react121.useEffect)(() => {
80254
80305
  const detected = detectAtToken(state.buffer, state.cursor);
80255
80306
  if (!detected) {
80256
80307
  if (state.picker.open) dispatch({ type: "pickerClose" });
@@ -80296,10 +80347,10 @@ function useFileSearch(options) {
80296
80347
  }
80297
80348
  const absPath = path7.isAbsolute(picked) ? picked : path7.join(projectRoot, picked);
80298
80349
  try {
80299
- const stat4 = await fs6.stat(absPath);
80350
+ const stat5 = await fs6.stat(absPath);
80300
80351
  let data;
80301
- if (stat4.size > TEXT_FILE_ATTACHMENT_INLINE_MAX_BYTES) {
80302
- data = fileReadContract(picked, stat4.size);
80352
+ if (stat5.size > TEXT_FILE_ATTACHMENT_INLINE_MAX_BYTES) {
80353
+ data = fileReadContract(picked, stat5.size);
80303
80354
  } else {
80304
80355
  const inline = await fs6.readFile(absPath, "utf8");
80305
80356
  const bytes = Buffer.byteLength(inline, "utf8");
@@ -80339,9 +80390,9 @@ function fileReadContract(filePath, bytes) {
80339
80390
  }
80340
80391
 
80341
80392
  // src/hooks/use-help-panel.ts
80342
- var import_react120 = __toESM(require_react(), 1);
80393
+ var import_react122 = __toESM(require_react(), 1);
80343
80394
  function useHelpPanel(dispatch, slashRegistry) {
80344
- const openHelpPanel = (0, import_react120.useCallback)(() => {
80395
+ const openHelpPanel = (0, import_react122.useCallback)(() => {
80345
80396
  const entries = Array.from(slashRegistry.listWithOwner()).map(({ cmd, owner }) => ({
80346
80397
  name: owner === "core" ? cmd.name : `${owner}:${cmd.name}`,
80347
80398
  description: cmd.description,
@@ -80355,7 +80406,7 @@ function useHelpPanel(dispatch, slashRegistry) {
80355
80406
  }
80356
80407
 
80357
80408
  // src/hooks/use-history-archive.ts
80358
- var import_react121 = __toESM(require_react(), 1);
80409
+ var import_react123 = __toESM(require_react(), 1);
80359
80410
  import * as fsp2 from "node:fs/promises";
80360
80411
  import * as path9 from "node:path";
80361
80412
 
@@ -80475,8 +80526,8 @@ var HistoryArchive = class {
80475
80526
  async buildIndex() {
80476
80527
  if (this.index !== null) return;
80477
80528
  const handle = await this.ensureOpen();
80478
- const stat4 = await handle.stat();
80479
- if (stat4.size === 0) {
80529
+ const stat5 = await handle.stat();
80530
+ if (stat5.size === 0) {
80480
80531
  this.index = [];
80481
80532
  return;
80482
80533
  }
@@ -80489,9 +80540,9 @@ var HistoryArchive = class {
80489
80540
  let read = 0;
80490
80541
  let lineStart = 0;
80491
80542
  let pending = null;
80492
- let chunk = Buffer.allocUnsafe(Math.min(CHUNK_BYTES, stat4.size));
80493
- while (read < stat4.size) {
80494
- const want = Math.min(CHUNK_BYTES, stat4.size - read);
80543
+ let chunk = Buffer.allocUnsafe(Math.min(CHUNK_BYTES, stat5.size));
80544
+ while (read < stat5.size) {
80545
+ const want = Math.min(CHUNK_BYTES, stat5.size - read);
80495
80546
  if (chunk.length !== want) chunk = Buffer.allocUnsafe(want);
80496
80547
  const { bytesRead } = await handle.read(chunk, 0, want, read);
80497
80548
  if (bytesRead <= 0) break;
@@ -80555,15 +80606,15 @@ function useHistoryArchive({
80555
80606
  sessionsDir,
80556
80607
  sessionId
80557
80608
  }) {
80558
- const archiveRef = (0, import_react121.useRef)(null);
80559
- const lastArchivedIdRef = (0, import_react121.useRef)(-1);
80560
- const appendedCountRef = (0, import_react121.useRef)(0);
80561
- const nextLoadEndRef = (0, import_react121.useRef)(null);
80562
- const loadingRef = (0, import_react121.useRef)(false);
80563
- const entriesRef = (0, import_react121.useRef)(entries);
80609
+ const archiveRef = (0, import_react123.useRef)(null);
80610
+ const lastArchivedIdRef = (0, import_react123.useRef)(-1);
80611
+ const appendedCountRef = (0, import_react123.useRef)(0);
80612
+ const nextLoadEndRef = (0, import_react123.useRef)(null);
80613
+ const loadingRef = (0, import_react123.useRef)(false);
80614
+ const entriesRef = (0, import_react123.useRef)(entries);
80564
80615
  entriesRef.current = entries;
80565
- const [archiveGeneration, setArchiveGeneration] = (0, import_react121.useState)(0);
80566
- (0, import_react121.useEffect)(() => {
80616
+ const [archiveGeneration, setArchiveGeneration] = (0, import_react123.useState)(0);
80617
+ (0, import_react123.useEffect)(() => {
80567
80618
  if (!sessionsDir || !sessionId) return;
80568
80619
  let disposed = false;
80569
80620
  let created = null;
@@ -80588,7 +80639,7 @@ function useHistoryArchive({
80588
80639
  void created?.close();
80589
80640
  };
80590
80641
  }, [sessionsDir, sessionId]);
80591
- (0, import_react121.useEffect)(() => {
80642
+ (0, import_react123.useEffect)(() => {
80592
80643
  const archive = archiveRef.current;
80593
80644
  if (!archive) return;
80594
80645
  const since = lastArchivedIdRef.current;
@@ -80604,7 +80655,7 @@ function useHistoryArchive({
80604
80655
  lastArchivedIdRef.current = highest;
80605
80656
  appendedCountRef.current += appended;
80606
80657
  }, [entries, archiveGeneration]);
80607
- const onRequestOlderEntries = (0, import_react121.useCallback)(() => {
80658
+ const onRequestOlderEntries = (0, import_react123.useCallback)(() => {
80608
80659
  if (loadingRef.current) return;
80609
80660
  const settleEmpty = () => {
80610
80661
  dispatch({ type: "startArchiveLoad" });
@@ -80645,21 +80696,21 @@ function useHistoryArchive({
80645
80696
  }
80646
80697
 
80647
80698
  // src/hooks/use-history-auto-scroll.ts
80648
- var import_react122 = __toESM(require_react(), 1);
80699
+ var import_react124 = __toESM(require_react(), 1);
80649
80700
  var HISTORY_AUTO_SCROLL_DELAY_MS = 3e4;
80650
80701
  function useHistoryAutoScroll({
80651
80702
  historyScrolled,
80652
80703
  historyScrollRef
80653
80704
  }) {
80654
- const timerRef = (0, import_react122.useRef)(null);
80655
- const schedule = (0, import_react122.useCallback)(() => {
80705
+ const timerRef = (0, import_react124.useRef)(null);
80706
+ const schedule = (0, import_react124.useCallback)(() => {
80656
80707
  if (timerRef.current) clearTimeout(timerRef.current);
80657
80708
  timerRef.current = setTimeout(() => {
80658
80709
  timerRef.current = null;
80659
80710
  historyScrollRef.current?.scrollToBottom();
80660
80711
  }, HISTORY_AUTO_SCROLL_DELAY_MS);
80661
80712
  }, [historyScrollRef]);
80662
- (0, import_react122.useEffect)(() => {
80713
+ (0, import_react124.useEffect)(() => {
80663
80714
  if (!historyScrolled) {
80664
80715
  if (timerRef.current) clearTimeout(timerRef.current);
80665
80716
  timerRef.current = null;
@@ -80668,22 +80719,22 @@ function useHistoryAutoScroll({
80668
80719
  schedule();
80669
80720
  return void 0;
80670
80721
  }, [historyScrolled, schedule]);
80671
- (0, import_react122.useEffect)(
80722
+ (0, import_react124.useEffect)(
80672
80723
  () => () => {
80673
80724
  if (timerRef.current) clearTimeout(timerRef.current);
80674
80725
  },
80675
80726
  []
80676
80727
  );
80677
- return (0, import_react122.useCallback)(() => {
80728
+ return (0, import_react124.useCallback)(() => {
80678
80729
  if (historyScrolled) schedule();
80679
80730
  }, [historyScrolled, schedule]);
80680
80731
  }
80681
80732
 
80682
80733
  // src/hooks/use-history-copy-notice.ts
80683
- var import_react123 = __toESM(require_react(), 1);
80734
+ var import_react125 = __toESM(require_react(), 1);
80684
80735
  function useHistoryCopyNotice(dispatch) {
80685
- const copiedHintTimerRef = (0, import_react123.useRef)(null);
80686
- const onHistoryCopy = (0, import_react123.useCallback)(
80736
+ const copiedHintTimerRef = (0, import_react125.useRef)(null);
80737
+ const onHistoryCopy = (0, import_react125.useCallback)(
80687
80738
  (entryId) => {
80688
80739
  dispatch({ type: "copiedNotice", text: "\u2713 Copied", entryId });
80689
80740
  if (copiedHintTimerRef.current) clearTimeout(copiedHintTimerRef.current);
@@ -80694,7 +80745,7 @@ function useHistoryCopyNotice(dispatch) {
80694
80745
  },
80695
80746
  [dispatch]
80696
80747
  );
80697
- (0, import_react123.useEffect)(
80748
+ (0, import_react125.useEffect)(
80698
80749
  () => () => {
80699
80750
  if (copiedHintTimerRef.current) clearTimeout(copiedHintTimerRef.current);
80700
80751
  },
@@ -80704,7 +80755,7 @@ function useHistoryCopyNotice(dispatch) {
80704
80755
  }
80705
80756
 
80706
80757
  // src/hooks/use-initial-prompt.ts
80707
- var import_react124 = __toESM(require_react(), 1);
80758
+ var import_react126 = __toESM(require_react(), 1);
80708
80759
  import { buildGoalPreamble } from "@wrongstack/core/execution";
80709
80760
  function useInitialPrompt({
80710
80761
  initialGoal,
@@ -80713,8 +80764,8 @@ function useInitialPrompt({
80713
80764
  runBlocksRef,
80714
80765
  dispatch
80715
80766
  }) {
80716
- const bootInjectedRef = (0, import_react124.useRef)(false);
80717
- (0, import_react124.useEffect)(() => {
80767
+ const bootInjectedRef = (0, import_react126.useRef)(false);
80768
+ (0, import_react126.useEffect)(() => {
80718
80769
  if (bootInjectedRef.current) return;
80719
80770
  const goal = initialGoal?.trim();
80720
80771
  const ask = initialAsk?.trim();
@@ -80758,7 +80809,7 @@ function useInitialPrompt({
80758
80809
  }
80759
80810
 
80760
80811
  // src/hooks/use-input-history-persistence.ts
80761
- var import_react125 = __toESM(require_react(), 1);
80812
+ var import_react127 = __toESM(require_react(), 1);
80762
80813
  import { DefaultSecretScrubber } from "@wrongstack/core/security";
80763
80814
  import { INPUT_HISTORY_DEFAULT_MAX, InputHistoryStore } from "@wrongstack/core/storage";
80764
80815
  import { resolveWstackPaths as resolveWstackPaths4 } from "@wrongstack/core/utils";
@@ -80767,15 +80818,15 @@ function useInputHistoryPersistence({
80767
80818
  inputHistory,
80768
80819
  dispatch
80769
80820
  }) {
80770
- const inputHistoryStore = (0, import_react125.useMemo)(() => {
80821
+ const inputHistoryStore = (0, import_react127.useMemo)(() => {
80771
80822
  if (!projectRoot) return null;
80772
80823
  const file = resolveWstackPaths4({ projectRoot }).projectInputHistory;
80773
80824
  return new InputHistoryStore(file, new DefaultSecretScrubber(), INPUT_HISTORY_DEFAULT_MAX);
80774
80825
  }, [projectRoot]);
80775
- const inputHistoryLoadedRef = (0, import_react125.useRef)(false);
80776
- const inputHistorySaveTimerRef = (0, import_react125.useRef)(void 0);
80777
- const inputHistoryLastSavedRef = (0, import_react125.useRef)("");
80778
- (0, import_react125.useEffect)(() => {
80826
+ const inputHistoryLoadedRef = (0, import_react127.useRef)(false);
80827
+ const inputHistorySaveTimerRef = (0, import_react127.useRef)(void 0);
80828
+ const inputHistoryLastSavedRef = (0, import_react127.useRef)("");
80829
+ (0, import_react127.useEffect)(() => {
80779
80830
  if (!inputHistoryStore) return;
80780
80831
  let cancelled = false;
80781
80832
  inputHistoryStore.load().then((entries) => {
@@ -80791,7 +80842,7 @@ function useInputHistoryPersistence({
80791
80842
  cancelled = true;
80792
80843
  };
80793
80844
  }, [inputHistoryStore, dispatch]);
80794
- (0, import_react125.useEffect)(() => {
80845
+ (0, import_react127.useEffect)(() => {
80795
80846
  if (!inputHistoryStore || !inputHistoryLoadedRef.current) return;
80796
80847
  const snapshot = JSON.stringify(inputHistory);
80797
80848
  if (snapshot === inputHistoryLastSavedRef.current) return;
@@ -80808,7 +80859,7 @@ function useInputHistoryPersistence({
80808
80859
  }
80809
80860
 
80810
80861
  // src/hooks/use-interrupt-ladder.ts
80811
- var import_react126 = __toESM(require_react(), 1);
80862
+ var import_react128 = __toESM(require_react(), 1);
80812
80863
  import { getProcessRegistry as getProcessRegistry9 } from "@wrongstack/tools";
80813
80864
  var INTERRUPT_PRESS_WINDOW_MS = 2e3;
80814
80865
  function useInterruptLadder({
@@ -80829,9 +80880,9 @@ function useInterruptLadder({
80829
80880
  getSddRun,
80830
80881
  confirmExitRef
80831
80882
  }) {
80832
- const interruptsSyncRef = (0, import_react126.useRef)(0);
80833
- const lastPressAtRef = (0, import_react126.useRef)(0);
80834
- const runInterruptLadder = (0, import_react126.useCallback)(() => {
80883
+ const interruptsSyncRef = (0, import_react128.useRef)(0);
80884
+ const lastPressAtRef = (0, import_react128.useRef)(0);
80885
+ const runInterruptLadder = (0, import_react128.useCallback)(() => {
80835
80886
  const current = stateRef.current;
80836
80887
  const now = Date.now();
80837
80888
  if (interruptsSyncRef.current > 0 && current.status === "idle" && now - lastPressAtRef.current > INTERRUPT_PRESS_WINDOW_MS) {
@@ -81006,7 +81057,7 @@ function useInterruptLadder({
81006
81057
  onExit,
81007
81058
  exit
81008
81059
  ]);
81009
- (0, import_react126.useEffect)(() => {
81060
+ (0, import_react128.useEffect)(() => {
81010
81061
  process.on("SIGINT", runInterruptLadder);
81011
81062
  return () => {
81012
81063
  process.off("SIGINT", runInterruptLadder);
@@ -81016,10 +81067,10 @@ function useInterruptLadder({
81016
81067
  }
81017
81068
 
81018
81069
  // src/hooks/use-kanban-board-focus.ts
81019
- var import_react127 = __toESM(require_react(), 1);
81070
+ var import_react129 = __toESM(require_react(), 1);
81020
81071
  function useKanbanBoardFocus() {
81021
- const [focusedBoardId, setFocusedBoardId] = (0, import_react127.useState)(null);
81022
- const boardFocusRef = (0, import_react127.useRef)(null);
81072
+ const [focusedBoardId, setFocusedBoardId] = (0, import_react129.useState)(null);
81073
+ const boardFocusRef = (0, import_react129.useRef)(null);
81023
81074
  if (!boardFocusRef.current) {
81024
81075
  boardFocusRef.current = {
81025
81076
  current: (boardId) => {
@@ -81032,17 +81083,17 @@ function useKanbanBoardFocus() {
81032
81083
  }
81033
81084
 
81034
81085
  // src/hooks/use-mailbox-view-model.ts
81035
- var import_react128 = __toESM(require_react(), 1);
81086
+ var import_react130 = __toESM(require_react(), 1);
81036
81087
  function useMailboxViewModel(events) {
81037
- const [mailboxStatus, setMailboxStatus] = (0, import_react128.useState)({
81088
+ const [mailboxStatus, setMailboxStatus] = (0, import_react130.useState)({
81038
81089
  unread: 0,
81039
81090
  onlineAgents: 0,
81040
81091
  onlineClients: { tui: 0, webui: 0, repl: 0 }
81041
81092
  });
81042
- const [mailboxPanelOpen, setMailboxPanelOpen] = (0, import_react128.useState)(false);
81043
- const [mailboxMessages, setMailboxMessages] = (0, import_react128.useState)([]);
81044
- const [mailboxAgents, setMailboxAgents] = (0, import_react128.useState)([]);
81045
- (0, import_react128.useEffect)(() => {
81093
+ const [mailboxPanelOpen, setMailboxPanelOpen] = (0, import_react130.useState)(false);
81094
+ const [mailboxMessages, setMailboxMessages] = (0, import_react130.useState)([]);
81095
+ const [mailboxAgents, setMailboxAgents] = (0, import_react130.useState)([]);
81096
+ (0, import_react130.useEffect)(() => {
81046
81097
  const AGENT_ONLINE_TTL_MS = 12e4;
81047
81098
  const lastSeen = /* @__PURE__ */ new Map();
81048
81099
  const unsubUnread = events.onPattern("mailbox.unread_count", (_event, payload) => {
@@ -81104,7 +81155,7 @@ function useMailboxViewModel(events) {
81104
81155
  unsubSnapshot();
81105
81156
  };
81106
81157
  }, [events]);
81107
- (0, import_react128.useEffect)(() => {
81158
+ (0, import_react130.useEffect)(() => {
81108
81159
  const unsubMessage = events.onPattern("mailbox.received", (_event, payload) => {
81109
81160
  const data = payload;
81110
81161
  if (!data?.messageId) return;
@@ -81205,12 +81256,12 @@ function useMailboxViewModel(events) {
81205
81256
  }
81206
81257
 
81207
81258
  // src/hooks/use-mode-picker.ts
81208
- var import_react129 = __toESM(require_react(), 1);
81259
+ var import_react131 = __toESM(require_react(), 1);
81209
81260
  function buildModePickerOptions(result) {
81210
81261
  return toModeOptions(result.modes, result.activeId);
81211
81262
  }
81212
81263
  function useModePicker({ dispatch, getModes }) {
81213
- const openModePicker = (0, import_react129.useCallback)(async () => {
81264
+ const openModePicker = (0, import_react131.useCallback)(async () => {
81214
81265
  if (!getModes) return;
81215
81266
  const result = await getModes();
81216
81267
  const options = buildModePickerOptions(result);
@@ -81220,11 +81271,11 @@ function useModePicker({ dispatch, getModes }) {
81220
81271
  }
81221
81272
 
81222
81273
  // src/hooks/use-model-pick.ts
81223
- var import_react130 = __toESM(require_react(), 1);
81274
+ var import_react132 = __toESM(require_react(), 1);
81224
81275
  function useModelPickRequest(opts) {
81225
81276
  const { dispatch, getPickableProviders, pickerOpen } = opts;
81226
- const resolverRef = import_react130.default.useRef(null);
81227
- const requestModelPick = import_react130.default.useCallback(
81277
+ const resolverRef = import_react132.default.useRef(null);
81278
+ const requestModelPick = import_react132.default.useCallback(
81228
81279
  async (title) => {
81229
81280
  if (!getPickableProviders) return null;
81230
81281
  resolverRef.current?.(null);
@@ -81236,12 +81287,12 @@ function useModelPickRequest(opts) {
81236
81287
  },
81237
81288
  [dispatch, getPickableProviders]
81238
81289
  );
81239
- const handleModelPicked = import_react130.default.useCallback((providerId, modelId) => {
81290
+ const handleModelPicked = import_react132.default.useCallback((providerId, modelId) => {
81240
81291
  const resolve = resolverRef.current;
81241
81292
  resolverRef.current = null;
81242
81293
  resolve?.({ providerId, model: modelId });
81243
81294
  }, []);
81244
- import_react130.default.useEffect(() => {
81295
+ import_react132.default.useEffect(() => {
81245
81296
  if (!pickerOpen && resolverRef.current) {
81246
81297
  const resolve = resolverRef.current;
81247
81298
  resolverRef.current = null;
@@ -81252,7 +81303,7 @@ function useModelPickRequest(opts) {
81252
81303
  }
81253
81304
 
81254
81305
  // src/hooks/use-next-steps-auto-submit.ts
81255
- var import_react131 = __toESM(require_react(), 1);
81306
+ var import_react133 = __toESM(require_react(), 1);
81256
81307
  import { resolveContinuation as resolveContinuation2 } from "@wrongstack/core/agent";
81257
81308
  import {
81258
81309
  createAutoProceedLoopGuard,
@@ -81306,30 +81357,30 @@ function useNextStepsAutoSubmit({
81306
81357
  clearDraft,
81307
81358
  runBlocksRef
81308
81359
  }) {
81309
- const [nextStepsAutoSubmitCountdown, setNextStepsAutoSubmitCountdown] = (0, import_react131.useState)(
81360
+ const [nextStepsAutoSubmitCountdown, setNextStepsAutoSubmitCountdown] = (0, import_react133.useState)(
81310
81361
  null
81311
81362
  );
81312
- const [nextStepsAutoSubmitLabel, setNextStepsAutoSubmitLabel] = (0, import_react131.useState)(null);
81313
- const [nextStepsAutoSubmitDeadlineMs, setNextStepsAutoSubmitDeadlineMs] = (0, import_react131.useState)(
81363
+ const [nextStepsAutoSubmitLabel, setNextStepsAutoSubmitLabel] = (0, import_react133.useState)(null);
81364
+ const [nextStepsAutoSubmitDeadlineMs, setNextStepsAutoSubmitDeadlineMs] = (0, import_react133.useState)(
81314
81365
  null
81315
81366
  );
81316
- const nextStepsAutoSubmitSuggestionRef = (0, import_react131.useRef)(null);
81317
- const nextStepsAutoSubmitSourceRef = (0, import_react131.useRef)(null);
81318
- const nextStepsAutoSubmitTodoIdRef = (0, import_react131.useRef)(null);
81319
- const nextStepsAutoSubmitTodosRef = (0, import_react131.useRef)([]);
81320
- const nextStepsAutoSubmitTimerRef = (0, import_react131.useRef)(void 0);
81321
- const autoSubmitStreakRef = (0, import_react131.useRef)(0);
81322
- const autoSubmitCapWarnedRef = (0, import_react131.useRef)(false);
81323
- const autoSubmitLoopGuardRef = (0, import_react131.useRef)(createAutoProceedLoopGuard());
81324
- const continuationAttemptTrackerRef = (0, import_react131.useRef)(createContinuationAttemptTracker());
81325
- const [nextStepsRecheck, setNextStepsRecheck] = (0, import_react131.useState)(0);
81326
- (0, import_react131.useEffect)(() => {
81367
+ const nextStepsAutoSubmitSuggestionRef = (0, import_react133.useRef)(null);
81368
+ const nextStepsAutoSubmitSourceRef = (0, import_react133.useRef)(null);
81369
+ const nextStepsAutoSubmitTodoIdRef = (0, import_react133.useRef)(null);
81370
+ const nextStepsAutoSubmitTodosRef = (0, import_react133.useRef)([]);
81371
+ const nextStepsAutoSubmitTimerRef = (0, import_react133.useRef)(void 0);
81372
+ const autoSubmitStreakRef = (0, import_react133.useRef)(0);
81373
+ const autoSubmitCapWarnedRef = (0, import_react133.useRef)(false);
81374
+ const autoSubmitLoopGuardRef = (0, import_react133.useRef)(createAutoProceedLoopGuard());
81375
+ const continuationAttemptTrackerRef = (0, import_react133.useRef)(createContinuationAttemptTracker());
81376
+ const [nextStepsRecheck, setNextStepsRecheck] = (0, import_react133.useState)(0);
81377
+ (0, import_react133.useEffect)(() => {
81327
81378
  autoSubmitStreakRef.current = 0;
81328
81379
  autoSubmitCapWarnedRef.current = false;
81329
81380
  autoSubmitLoopGuardRef.current.reset();
81330
81381
  continuationAttemptTrackerRef.current.reset();
81331
81382
  }, [autonomyLive]);
81332
- (0, import_react131.useEffect)(() => {
81383
+ (0, import_react133.useEffect)(() => {
81333
81384
  const liveAutonomy = getAutonomy?.() ?? autonomyLive;
81334
81385
  if (state.status !== "idle" || liveAutonomy !== "auto" || state.bugHuntRunning != null) {
81335
81386
  clearInterval(nextStepsAutoSubmitTimerRef.current);
@@ -81581,7 +81632,7 @@ ${GROUNDED_NO_PROGRESS_STEER}` : suggestion;
81581
81632
  autonomyNextPrompt,
81582
81633
  dispatch
81583
81634
  ]);
81584
- const cancelNextStepsCountdown = (0, import_react131.useCallback)(() => {
81635
+ const cancelNextStepsCountdown = (0, import_react133.useCallback)(() => {
81585
81636
  if (nextStepsAutoSubmitTimerRef.current == null) return;
81586
81637
  clearInterval(nextStepsAutoSubmitTimerRef.current);
81587
81638
  nextStepsAutoSubmitTimerRef.current = void 0;
@@ -81608,7 +81659,7 @@ ${GROUNDED_NO_PROGRESS_STEER}` : suggestion;
81608
81659
  }
81609
81660
 
81610
81661
  // src/hooks/use-panel-controllers.ts
81611
- var import_react132 = __toESM(require_react(), 1);
81662
+ var import_react134 = __toESM(require_react(), 1);
81612
81663
  import { toErrorMessage as toErrorMessage9 } from "@wrongstack/core/utils";
81613
81664
 
81614
81665
  // src/on-panel-open.ts
@@ -81725,20 +81776,20 @@ function usePanelControllers({
81725
81776
  getActiveModelReasoningEffortLevels
81726
81777
  }) {
81727
81778
  const authPanelController = { openAuthPanel };
81728
- const openModelPicker = import_react132.default.useCallback(async () => {
81779
+ const openModelPicker = import_react134.default.useCallback(async () => {
81729
81780
  if (!getPickableProviders) return;
81730
81781
  const providers = await getPickableProviders();
81731
81782
  dispatch({ type: "modelPickerOpen", providers });
81732
81783
  }, [getPickableProviders]);
81733
- const openProjectPicker = import_react132.default.useCallback(async () => {
81784
+ const openProjectPicker = import_react134.default.useCallback(async () => {
81734
81785
  if (!getProjectPickerItems) return;
81735
81786
  const items = await getProjectPickerItems();
81736
81787
  dispatch({ type: "projectPickerOpen", items });
81737
81788
  }, [getProjectPickerItems]);
81738
- const openFKeyPicker = import_react132.default.useCallback(() => {
81789
+ const openFKeyPicker = import_react134.default.useCallback(() => {
81739
81790
  dispatch({ type: "fKeyPickerOpen" });
81740
81791
  }, [dispatch]);
81741
- const loadLiveSessions = import_react132.default.useCallback(async () => {
81792
+ const loadLiveSessions = import_react134.default.useCallback(async () => {
81742
81793
  if (!getLiveSessions) {
81743
81794
  dispatch({ type: "sessionsPanelSet", sessions: [] });
81744
81795
  return;
@@ -81751,7 +81802,7 @@ function usePanelControllers({
81751
81802
  dispatch({ type: "sessionsPanelBusy", on: false });
81752
81803
  }
81753
81804
  }, [getLiveSessions]);
81754
- (0, import_react132.useEffect)(() => {
81805
+ (0, import_react134.useEffect)(() => {
81755
81806
  if (!onPanelOpen) return;
81756
81807
  const dispatcher = createPanelOpenDispatcher({
81757
81808
  dispatch,
@@ -81780,14 +81831,14 @@ function usePanelControllers({
81780
81831
  openSubagentModelsPanel,
81781
81832
  openHelpPanel
81782
81833
  ]);
81783
- (0, import_react132.useEffect)(() => {
81834
+ (0, import_react134.useEffect)(() => {
81784
81835
  if (!state.sessionsPanelOpen || !getLiveSessions) return void 0;
81785
81836
  const t = setInterval(() => {
81786
81837
  void loadLiveSessions();
81787
81838
  }, 5e3);
81788
81839
  return () => clearInterval(t);
81789
81840
  }, [state.sessionsPanelOpen, getLiveSessions, loadLiveSessions]);
81790
- const openSettings = import_react132.default.useCallback(() => {
81841
+ const openSettings = import_react134.default.useCallback(() => {
81791
81842
  if (!getSettings) return;
81792
81843
  const s2 = getSettings();
81793
81844
  dispatch({
@@ -81863,15 +81914,15 @@ function usePanelControllers({
81863
81914
  wrongProxyUrl: s2.wrongProxyUrl ?? "http://localhost:3444"
81864
81915
  });
81865
81916
  }, [getSettings, getActiveModelReasoningEffortLevels]);
81866
- const refreshPluginPicker = import_react132.default.useCallback(() => {
81917
+ const refreshPluginPicker = import_react134.default.useCallback(() => {
81867
81918
  if (!getPluginItems) return;
81868
81919
  dispatch({ type: "pluginPickerSetItems", items: getPluginItems() });
81869
81920
  }, [getPluginItems]);
81870
- (0, import_react132.useEffect)(() => {
81921
+ (0, import_react134.useEffect)(() => {
81871
81922
  if (!state.pluginPicker.open) return;
81872
81923
  refreshPluginPicker();
81873
81924
  }, [state.pluginPicker.open, refreshPluginPicker]);
81874
- const toggleSelectedPlugin = import_react132.default.useCallback(async () => {
81925
+ const toggleSelectedPlugin = import_react134.default.useCallback(async () => {
81875
81926
  if (!onPluginToggle) return;
81876
81927
  const selected = stateRef.current.pluginPicker.items[stateRef.current.pluginPicker.selected];
81877
81928
  if (!selected) return;
@@ -81895,15 +81946,15 @@ function usePanelControllers({
81895
81946
  });
81896
81947
  }
81897
81948
  }, [onPluginToggle]);
81898
- const refreshMcpPicker = import_react132.default.useCallback(() => {
81949
+ const refreshMcpPicker = import_react134.default.useCallback(() => {
81899
81950
  if (!getMcpServers) return;
81900
81951
  dispatch({ type: "mcpPickerSetItems", items: getMcpServers() });
81901
81952
  }, [getMcpServers]);
81902
- (0, import_react132.useEffect)(() => {
81953
+ (0, import_react134.useEffect)(() => {
81903
81954
  if (!state.mcpPicker.open) return;
81904
81955
  refreshMcpPicker();
81905
81956
  }, [state.mcpPicker.open, refreshMcpPicker]);
81906
- const toggleSelectedMcpServer = import_react132.default.useCallback(async () => {
81957
+ const toggleSelectedMcpServer = import_react134.default.useCallback(async () => {
81907
81958
  if (!onMcpToggle) return;
81908
81959
  const selected = stateRef.current.mcpPicker.items[stateRef.current.mcpPicker.selected];
81909
81960
  if (!selected) return;
@@ -81920,7 +81971,7 @@ function usePanelControllers({
81920
81971
  });
81921
81972
  }
81922
81973
  }, [onMcpToggle]);
81923
- const restartSelectedMcpServer = import_react132.default.useCallback(async () => {
81974
+ const restartSelectedMcpServer = import_react134.default.useCallback(async () => {
81924
81975
  if (!onMcpRestart) return;
81925
81976
  const selected = stateRef.current.mcpPicker.items[stateRef.current.mcpPicker.selected];
81926
81977
  if (!selected) return;
@@ -81937,17 +81988,17 @@ function usePanelControllers({
81937
81988
  });
81938
81989
  }
81939
81990
  }, [onMcpRestart]);
81940
- const refreshToolsPicker = import_react132.default.useCallback(() => {
81991
+ const refreshToolsPicker = import_react134.default.useCallback(() => {
81941
81992
  if (!getToolsItems) return;
81942
81993
  const items = getToolsItems();
81943
81994
  dispatch({ type: "toolsPickerSetItems", items });
81944
81995
  setLiveToolCount(items.filter((item) => item.enabled).length);
81945
81996
  }, [getToolsItems]);
81946
- (0, import_react132.useEffect)(() => {
81997
+ (0, import_react134.useEffect)(() => {
81947
81998
  if (!state.toolsPicker.open) return;
81948
81999
  refreshToolsPicker();
81949
82000
  }, [state.toolsPicker.open, refreshToolsPicker]);
81950
- const toggleSelectedTool = import_react132.default.useCallback(async () => {
82001
+ const toggleSelectedTool = import_react134.default.useCallback(async () => {
81951
82002
  if (!onToolToggle) return;
81952
82003
  const selected = stateRef.current.toolsPicker.items[stateRef.current.toolsPicker.selected];
81953
82004
  if (!selected) return;
@@ -81979,7 +82030,7 @@ function usePanelControllers({
81979
82030
  }
81980
82031
 
81981
82032
  // src/hooks/use-paste-handling.ts
81982
- var import_react133 = __toESM(require_react(), 1);
82033
+ var import_react135 = __toESM(require_react(), 1);
81983
82034
  import { toErrorMessage as toErrorMessage10 } from "@wrongstack/core/utils";
81984
82035
  function usePasteHandling({
81985
82036
  builderRef,
@@ -81988,8 +82039,8 @@ function usePasteHandling({
81988
82039
  setDraft,
81989
82040
  tokenPreviewsRef
81990
82041
  }) {
81991
- const pasteAccumRef = (0, import_react133.useRef)(null);
81992
- const pasteFlushTimerRef = (0, import_react133.useRef)(null);
82042
+ const pasteAccumRef = (0, import_react135.useRef)(null);
82043
+ const pasteFlushTimerRef = (0, import_react135.useRef)(null);
81993
82044
  const commitPaste = async (full) => {
81994
82045
  const builder = builderRef.current;
81995
82046
  if (!builder || !full) return;
@@ -82079,7 +82130,7 @@ function usePasteHandling({
82079
82130
  }
82080
82131
 
82081
82132
  // src/hooks/use-prompt-picker.ts
82082
- var import_react134 = __toESM(require_react(), 1);
82133
+ var import_react136 = __toESM(require_react(), 1);
82083
82134
  import { createRequire } from "node:module";
82084
82135
  import * as path10 from "node:path";
82085
82136
  import { DefaultPromptLoader } from "@wrongstack/core/execution";
@@ -82105,9 +82156,9 @@ function buildPromptPickerPayload(all, recentSlugs) {
82105
82156
  return { all: entries, categories, recentSlugs };
82106
82157
  }
82107
82158
  function usePromptPicker({ projectRoot, dispatch }) {
82108
- const promptLoaderRef = (0, import_react134.useRef)(null);
82109
- const promptUsageRef = (0, import_react134.useRef)(null);
82110
- const getPromptLoader = (0, import_react134.useCallback)(() => {
82159
+ const promptLoaderRef = (0, import_react136.useRef)(null);
82160
+ const promptUsageRef = (0, import_react136.useRef)(null);
82161
+ const getPromptLoader = (0, import_react136.useCallback)(() => {
82111
82162
  if (!promptLoaderRef.current && projectRoot) {
82112
82163
  let bundledDir;
82113
82164
  try {
@@ -82126,7 +82177,7 @@ function usePromptPicker({ projectRoot, dispatch }) {
82126
82177
  }
82127
82178
  return promptLoaderRef.current;
82128
82179
  }, [projectRoot]);
82129
- const openPromptPicker = (0, import_react134.useCallback)(async () => {
82180
+ const openPromptPicker = (0, import_react136.useCallback)(async () => {
82130
82181
  const loader = getPromptLoader();
82131
82182
  if (!loader) return;
82132
82183
  loader.invalidateCache();
@@ -82135,7 +82186,7 @@ function usePromptPicker({ projectRoot, dispatch }) {
82135
82186
  const payload = buildPromptPickerPayload(all, recentSlugs);
82136
82187
  dispatch({ type: "promptPickerOpen", ...payload });
82137
82188
  }, [dispatch, getPromptLoader]);
82138
- const setPromptFavorite = (0, import_react134.useCallback)(
82189
+ const setPromptFavorite = (0, import_react136.useCallback)(
82139
82190
  async (slug, favorite) => {
82140
82191
  const loader = getPromptLoader();
82141
82192
  if (!loader) return;
@@ -82148,7 +82199,7 @@ function usePromptPicker({ projectRoot, dispatch }) {
82148
82199
  }
82149
82200
 
82150
82201
  // src/hooks/use-provider-event-bridge.ts
82151
- var import_react135 = __toESM(require_react(), 1);
82202
+ var import_react137 = __toESM(require_react(), 1);
82152
82203
  import { tuiStreamFlushMs } from "@wrongstack/core/utils";
82153
82204
  import { DEFAULT_MIN_IMPORTANCE as DEFAULT_MIN_IMPORTANCE2, DEFAULT_MIN_SCORE as DEFAULT_MIN_SCORE2, MIN_RELATION_STRENGTH as MIN_RELATION_STRENGTH2 } from "@wrongstack/sage";
82154
82205
  import { isFinalTurnStopReason as isFinalTurnStopReason2 } from "@wrongstack/tools/next-steps";
@@ -82308,7 +82359,7 @@ function useProviderEventBridge({
82308
82359
  assistantCommittedThisRunRef,
82309
82360
  setMemoryContextMonitor
82310
82361
  }) {
82311
- (0, import_react135.useEffect)(() => {
82362
+ (0, import_react137.useEffect)(() => {
82312
82363
  const FLUSH_MS2 = tuiStreamFlushMs();
82313
82364
  let pendingToolStream = null;
82314
82365
  const pendingSageStats = /* @__PURE__ */ new Map();
@@ -82758,7 +82809,7 @@ function useProviderEventBridge({
82758
82809
  }
82759
82810
 
82760
82811
  // src/hooks/use-queue-manager.ts
82761
- var import_react136 = __toESM(require_react(), 1);
82812
+ var import_react138 = __toESM(require_react(), 1);
82762
82813
 
82763
82814
  // src/queue-slash.ts
82764
82815
  var USAGE5 = "Usage:\n /queue \u2014 list pending messages\n /queue list \u2014 same as /queue\n /queue clear \u2014 drop all pending messages\n /queue delete N M\u2026 \u2014 drop messages at 1-based positions\n /queue picker on|off \u2014 toggle the mid-run send-mode picker (queue/btw/steer)\n /queue picker \u2014 show whether the picker is on";
@@ -82865,9 +82916,9 @@ function useQueueManager({
82865
82916
  saveSettings,
82866
82917
  midRunSendPickerRef
82867
82918
  }) {
82868
- const persistState = (0, import_react136.useRef)({ running: false, pending: null });
82869
- const hydrated = (0, import_react136.useRef)(!queueStore);
82870
- const pendingBeforeHydration = (0, import_react136.useRef)(false);
82919
+ const persistState = (0, import_react138.useRef)({ running: false, pending: null });
82920
+ const hydrated = (0, import_react138.useRef)(!queueStore);
82921
+ const pendingBeforeHydration = (0, import_react138.useRef)(false);
82871
82922
  const writeQueue = (store) => {
82872
82923
  const raw = stateRef.current.queue.map(
82873
82924
  ({
@@ -82898,7 +82949,7 @@ function useQueueManager({
82898
82949
  }
82899
82950
  })();
82900
82951
  };
82901
- (0, import_react136.useEffect)(() => {
82952
+ (0, import_react138.useEffect)(() => {
82902
82953
  if (!queueStore) return;
82903
82954
  let cancelled = false;
82904
82955
  queueStore.read().then((items) => {
@@ -82933,7 +82984,7 @@ function useQueueManager({
82933
82984
  cancelled = true;
82934
82985
  };
82935
82986
  }, [queueStore]);
82936
- (0, import_react136.useEffect)(() => {
82987
+ (0, import_react138.useEffect)(() => {
82937
82988
  if (!queueStore) return;
82938
82989
  if (!hydrated.current) {
82939
82990
  pendingBeforeHydration.current = true;
@@ -82941,10 +82992,10 @@ function useQueueManager({
82941
82992
  }
82942
82993
  writeQueue(queueStore);
82943
82994
  }, [stateRef.current.queue, queueStore, stateRef]);
82944
- (0, import_react136.useEffect)(() => {
82995
+ (0, import_react138.useEffect)(() => {
82945
82996
  onQueueChange?.(stateRef.current.queue.map((q) => q.displayText));
82946
82997
  }, [stateRef.current.queue, onQueueChange, stateRef]);
82947
- (0, import_react136.useEffect)(() => {
82998
+ (0, import_react138.useEffect)(() => {
82948
82999
  const cmd = createQueueSlashCommand({
82949
83000
  getQueue: () => stateRef.current.queue,
82950
83001
  clear: () => dispatch({ type: "queueClear" }),
@@ -82967,7 +83018,7 @@ function useQueueManager({
82967
83018
  }
82968
83019
 
82969
83020
  // src/hooks/use-session-interrupt-controller.ts
82970
- var import_react137 = __toESM(require_react(), 1);
83021
+ var import_react139 = __toESM(require_react(), 1);
82971
83022
  function useSessionInterruptController({
82972
83023
  interruptController,
82973
83024
  dispatch,
@@ -82989,7 +83040,7 @@ function useSessionInterruptController({
82989
83040
  getSddRun,
82990
83041
  switchAutonomy
82991
83042
  }) {
82992
- (0, import_react137.useEffect)(() => {
83043
+ (0, import_react139.useEffect)(() => {
82993
83044
  if (!interruptController) return;
82994
83045
  let pendingClearResolve = null;
82995
83046
  let pendingSlashResolve = null;
@@ -83117,7 +83168,7 @@ function useSessionInterruptController({
83117
83168
  }
83118
83169
 
83119
83170
  // src/hooks/use-session-rewind.ts
83120
- var import_react138 = __toESM(require_react(), 1);
83171
+ var import_react140 = __toESM(require_react(), 1);
83121
83172
  import { applyRewindToConversation, DefaultSessionRewinder } from "@wrongstack/core/storage";
83122
83173
  function useSessionRewind({
83123
83174
  agent,
@@ -83126,7 +83177,7 @@ function useSessionRewind({
83126
83177
  liveDirector,
83127
83178
  sessionGenerationRef
83128
83179
  }) {
83129
- const handleRewindTo = (0, import_react138.useCallback)(
83180
+ const handleRewindTo = (0, import_react140.useCallback)(
83130
83181
  async (checkpointIndex) => {
83131
83182
  const sessionId = agent.ctx.session.id;
83132
83183
  if (!sessionId) return;
@@ -83177,15 +83228,15 @@ function useSessionRewind({
83177
83228
  }
83178
83229
 
83179
83230
  // src/hooks/use-shadow-panel.ts
83180
- var import_react139 = __toESM(require_react(), 1);
83231
+ var import_react141 = __toESM(require_react(), 1);
83181
83232
  import { toErrorMessage as toErrorMessage11 } from "@wrongstack/core/utils";
83182
83233
  function useShadowPanel(dispatch, host) {
83183
83234
  const { getShadowData, onShadowStart, onShadowStop } = host;
83184
- const openShadowPanel = (0, import_react139.useCallback)(() => {
83235
+ const openShadowPanel = (0, import_react141.useCallback)(() => {
83185
83236
  if (!getShadowData) return;
83186
83237
  dispatch({ type: "shadowOpen", shadow: getShadowData() });
83187
83238
  }, [dispatch, getShadowData]);
83188
- const handleShadowStart = (0, import_react139.useCallback)(async () => {
83239
+ const handleShadowStart = (0, import_react141.useCallback)(async () => {
83189
83240
  if (!onShadowStart) return;
83190
83241
  dispatch({ type: "shadowHint", text: "Starting Shadow Agent\u2026" });
83191
83242
  try {
@@ -83199,7 +83250,7 @@ function useShadowPanel(dispatch, host) {
83199
83250
  dispatch({ type: "shadowHint", text: `Failed to start: ${toErrorMessage11(error)}` });
83200
83251
  }
83201
83252
  }, [dispatch, getShadowData, onShadowStart]);
83202
- const handleShadowStop = (0, import_react139.useCallback)(async () => {
83253
+ const handleShadowStop = (0, import_react141.useCallback)(async () => {
83203
83254
  if (!onShadowStop) return;
83204
83255
  dispatch({ type: "shadowHint", text: "Stopping Shadow Agent\u2026" });
83205
83256
  try {
@@ -83217,14 +83268,14 @@ function useShadowPanel(dispatch, host) {
83217
83268
  }
83218
83269
 
83219
83270
  // src/hooks/use-slash-picker.ts
83220
- var import_react140 = __toESM(require_react(), 1);
83271
+ var import_react142 = __toESM(require_react(), 1);
83221
83272
  function useSlashPicker({
83222
83273
  state,
83223
83274
  slashRegistry,
83224
83275
  dispatch,
83225
83276
  setDraft
83226
83277
  }) {
83227
- (0, import_react140.useEffect)(() => {
83278
+ (0, import_react142.useEffect)(() => {
83228
83279
  if (state.bashMode) {
83229
83280
  if (state.slashPicker.open) dispatch({ type: "slashPickerClose" });
83230
83281
  return;
@@ -83240,7 +83291,7 @@ function useSlashPicker({
83240
83291
  dispatch({ type: "slashPickerOpen", query, matches });
83241
83292
  }
83242
83293
  }, [state.buffer, state.bashMode, state.slashPicker.open, state.slashPicker.query, slashRegistry, dispatch]);
83243
- return (0, import_react140.useCallback)(() => {
83294
+ return (0, import_react142.useCallback)(() => {
83244
83295
  const { open: open2, matches, selected } = state.slashPicker;
83245
83296
  if (!open2 || matches.length === 0) return;
83246
83297
  const picked = matches[selected];
@@ -83252,7 +83303,7 @@ function useSlashPicker({
83252
83303
  }
83253
83304
 
83254
83305
  // src/hooks/use-statusbar-view-model.ts
83255
- var import_react141 = __toESM(require_react(), 1);
83306
+ var import_react143 = __toESM(require_react(), 1);
83256
83307
  import * as fs7 from "node:fs/promises";
83257
83308
  import { getContextBreakdown } from "@wrongstack/core/utils";
83258
83309
 
@@ -83306,7 +83357,7 @@ function useStatusbarViewModel({
83306
83357
  const conversationRevision = agent.ctx.state?.revision ?? 0;
83307
83358
  const messageCount = agent.ctx.messages?.length ?? 0;
83308
83359
  const toolDefCount = agent.ctx.tools?.length ?? 0;
83309
- const contextBreakdown = (0, import_react141.useMemo)(() => {
83360
+ const contextBreakdown = (0, import_react143.useMemo)(() => {
83310
83361
  if (!needBreakdown) return void 0;
83311
83362
  try {
83312
83363
  return getContextBreakdown(agent.ctx);
@@ -83327,12 +83378,12 @@ function useStatusbarViewModel({
83327
83378
  localEstimate: contextBreakdown?.total,
83328
83379
  maxContext
83329
83380
  }).used : cheapFill.used;
83330
- const contextWindow = (0, import_react141.useMemo)(() => {
83381
+ const contextWindow = (0, import_react143.useMemo)(() => {
83331
83382
  void state.contextChipVersion;
83332
83383
  if (resuming) return void 0;
83333
83384
  return maxContext > 0 ? { used: currentContextTokens, max: maxContext } : void 0;
83334
83385
  }, [currentContextTokens, maxContext, resuming, state.contextChipVersion]);
83335
- const todos = (0, import_react141.useMemo)(() => {
83386
+ const todos = (0, import_react143.useMemo)(() => {
83336
83387
  const counts = { pending: 0, inProgress: 0, completed: 0 };
83337
83388
  for (const todo of liveTodos) {
83338
83389
  if (todo.status === "pending") counts.pending++;
@@ -83341,7 +83392,7 @@ function useStatusbarViewModel({
83341
83392
  }
83342
83393
  return counts;
83343
83394
  }, [liveTodos]);
83344
- const fleetCounts = (0, import_react141.useMemo)(() => {
83395
+ const fleetCounts = (0, import_react143.useMemo)(() => {
83345
83396
  const entries = Object.values(state.fleet);
83346
83397
  if (entries.length === 0) return void 0;
83347
83398
  const counts = { running: 0, idle: 0, pending: 0, completed: 0 };
@@ -83353,11 +83404,11 @@ function useStatusbarViewModel({
83353
83404
  return counts.running > 0 ? counts : void 0;
83354
83405
  }, [state.fleet]);
83355
83406
  const visibleSubagentCount = fleetCounts?.running ?? 0;
83356
- const hasVisibleFleetPanel = (0, import_react141.useMemo)(
83407
+ const hasVisibleFleetPanel = (0, import_react143.useMemo)(
83357
83408
  () => Object.values(state.fleet).some((entry2) => entry2.status === "running"),
83358
83409
  [state.fleet]
83359
83410
  );
83360
- const entriesWithLeader = (0, import_react141.useMemo)(() => {
83411
+ const entriesWithLeader = (0, import_react143.useMemo)(() => {
83361
83412
  const leaderEntry = {
83362
83413
  id: "leader",
83363
83414
  name: "LEADER",
@@ -83390,8 +83441,8 @@ function useStatusbarViewModel({
83390
83441
  const planHidden = hiddenItems.includes("plan");
83391
83442
  const taskHidden = hiddenItems.includes("tasks");
83392
83443
  const planPath = agent.ctx.meta["plan.path"];
83393
- const [planCounts, setPlanCounts] = (0, import_react141.useState)(null);
83394
- (0, import_react141.useEffect)(() => {
83444
+ const [planCounts, setPlanCounts] = (0, import_react143.useState)(null);
83445
+ (0, import_react143.useEffect)(() => {
83395
83446
  if (planHidden) return;
83396
83447
  if (typeof planPath !== "string" || !planPath) {
83397
83448
  setPlanCounts(null);
@@ -83401,8 +83452,8 @@ function useStatusbarViewModel({
83401
83452
  let lastFingerprint = "";
83402
83453
  const poll = async () => {
83403
83454
  try {
83404
- const stat4 = await fs7.stat(planPath);
83405
- const fingerprint = `${stat4.mtimeMs}:${stat4.size}`;
83455
+ const stat5 = await fs7.stat(planPath);
83456
+ const fingerprint = `${stat5.mtimeMs}:${stat5.size}`;
83406
83457
  if (fingerprint === lastFingerprint) return;
83407
83458
  const data = await fs7.readFile(planPath, "utf8");
83408
83459
  const parsed = JSON.parse(data);
@@ -83437,8 +83488,8 @@ function useStatusbarViewModel({
83437
83488
  };
83438
83489
  }, [planPath, planHidden]);
83439
83490
  const taskPath = agent.ctx.meta["task.path"];
83440
- const [taskCounts, setTaskCounts] = (0, import_react141.useState)(null);
83441
- (0, import_react141.useEffect)(() => {
83491
+ const [taskCounts, setTaskCounts] = (0, import_react143.useState)(null);
83492
+ (0, import_react143.useEffect)(() => {
83442
83493
  if (taskHidden) return;
83443
83494
  if (typeof taskPath !== "string" || !taskPath) {
83444
83495
  setTaskCounts(null);
@@ -83448,8 +83499,8 @@ function useStatusbarViewModel({
83448
83499
  let lastFingerprint = "";
83449
83500
  const poll = async () => {
83450
83501
  try {
83451
- const stat4 = await fs7.stat(taskPath);
83452
- const fingerprint = `${stat4.mtimeMs}:${stat4.size}`;
83502
+ const stat5 = await fs7.stat(taskPath);
83503
+ const fingerprint = `${stat5.mtimeMs}:${stat5.size}`;
83453
83504
  if (fingerprint === lastFingerprint) return;
83454
83505
  const data = await fs7.readFile(taskPath, "utf8");
83455
83506
  const parsed = JSON.parse(data);
@@ -83513,10 +83564,10 @@ function useStatusbarViewModel({
83513
83564
  }
83514
83565
 
83515
83566
  // src/hooks/use-subagent-models-panel.ts
83516
- var import_react142 = __toESM(require_react(), 1);
83567
+ var import_react144 = __toESM(require_react(), 1);
83517
83568
  function useSubagentModelsPanel(opts) {
83518
83569
  const { dispatch, subagentModelsHost, requestModelPick } = opts;
83519
- const refresh = import_react142.default.useCallback(
83570
+ const refresh = import_react144.default.useCallback(
83520
83571
  (hint) => {
83521
83572
  if (!subagentModelsHost) return;
83522
83573
  const snap = subagentModelsHost.snapshot();
@@ -83533,7 +83584,7 @@ function useSubagentModelsPanel(opts) {
83533
83584
  },
83534
83585
  [dispatch, subagentModelsHost]
83535
83586
  );
83536
- const openSubagentModelsPanel = import_react142.default.useCallback(() => {
83587
+ const openSubagentModelsPanel = import_react144.default.useCallback(() => {
83537
83588
  if (!subagentModelsHost) return;
83538
83589
  const snap = subagentModelsHost.snapshot();
83539
83590
  dispatch({
@@ -83546,7 +83597,7 @@ function useSubagentModelsPanel(opts) {
83546
83597
  sessionTarget: snap.sessionTarget
83547
83598
  });
83548
83599
  }, [dispatch, subagentModelsHost]);
83549
- const apply = import_react142.default.useCallback(
83600
+ const apply = import_react144.default.useCallback(
83550
83601
  (run, okHint) => {
83551
83602
  void run().then((err) => refresh(err ?? okHint)).catch((e) => {
83552
83603
  dispatch({
@@ -83557,7 +83608,7 @@ function useSubagentModelsPanel(opts) {
83557
83608
  },
83558
83609
  [dispatch, refresh]
83559
83610
  );
83560
- const onSubagentLaneEdit = import_react142.default.useCallback(
83611
+ const onSubagentLaneEdit = import_react144.default.useCallback(
83561
83612
  (index) => {
83562
83613
  if (!subagentModelsHost || !requestModelPick) return;
83563
83614
  void requestModelPick(`Lane ${index + 1} model (Esc = keep)`).then((sel) => {
@@ -83575,14 +83626,14 @@ function useSubagentModelsPanel(opts) {
83575
83626
  },
83576
83627
  [apply, dispatch, requestModelPick, subagentModelsHost]
83577
83628
  );
83578
- const onSubagentLaneClear = import_react142.default.useCallback(
83629
+ const onSubagentLaneClear = import_react144.default.useCallback(
83579
83630
  (index) => {
83580
83631
  if (!subagentModelsHost) return;
83581
83632
  apply(() => subagentModelsHost.clearLane(index), `Lane ${index + 1} cleared`);
83582
83633
  },
83583
83634
  [apply, subagentModelsHost]
83584
83635
  );
83585
- const onSubagentPlanToggle = import_react142.default.useCallback(
83636
+ const onSubagentPlanToggle = import_react144.default.useCallback(
83586
83637
  (field) => {
83587
83638
  if (!subagentModelsHost) return;
83588
83639
  apply(() => subagentModelsHost.toggle(field), `${field} toggled`);
@@ -83598,14 +83649,14 @@ function useSubagentModelsPanel(opts) {
83598
83649
  }
83599
83650
 
83600
83651
  // src/hooks/use-theme-picker-handler.ts
83601
- var import_react143 = __toESM(require_react(), 1);
83652
+ var import_react145 = __toESM(require_react(), 1);
83602
83653
  function useThemePickerHandler({
83603
83654
  configStore,
83604
83655
  saveThemePreset,
83605
83656
  dispatch,
83606
83657
  selectedIndex
83607
83658
  }) {
83608
- const onThemePickerEnter = (0, import_react143.useCallback)(() => {
83659
+ const onThemePickerEnter = (0, import_react145.useCallback)(() => {
83609
83660
  const preset = THEME_OPTIONS[Math.max(0, selectedIndex)];
83610
83661
  const presetName = preset?.id;
83611
83662
  if (!presetName) return;
@@ -83636,7 +83687,7 @@ function useThemePickerHandler({
83636
83687
  }
83637
83688
 
83638
83689
  // src/hooks/use-tui-controllers.ts
83639
- var import_react144 = __toESM(require_react(), 1);
83690
+ var import_react146 = __toESM(require_react(), 1);
83640
83691
  function useTuiControllers({
83641
83692
  dispatch,
83642
83693
  fleetChat,
@@ -83646,7 +83697,7 @@ function useTuiControllers({
83646
83697
  enhanceController,
83647
83698
  agentsMonitorController
83648
83699
  }) {
83649
- (0, import_react144.useEffect)(() => {
83700
+ (0, import_react146.useEffect)(() => {
83650
83701
  if (!fleetStreamController) return;
83651
83702
  fleetStreamController.mode = fleetChat;
83652
83703
  fleetStreamController.setMode = (mode) => {
@@ -83658,12 +83709,12 @@ function useTuiControllers({
83658
83709
  };
83659
83710
  };
83660
83711
  }, [dispatch, fleetStreamController, fleetChat]);
83661
- (0, import_react144.useEffect)(() => {
83712
+ (0, import_react146.useEffect)(() => {
83662
83713
  if (fleetStreamController) {
83663
83714
  fleetStreamController.mode = fleetChat;
83664
83715
  }
83665
83716
  }, [fleetStreamController, fleetChat]);
83666
- (0, import_react144.useEffect)(() => {
83717
+ (0, import_react146.useEffect)(() => {
83667
83718
  if (!enhanceController) return;
83668
83719
  enhanceController.enabled = enhanceEnabled;
83669
83720
  enhanceController.setEnabled = (enabled) => {
@@ -83675,7 +83726,7 @@ function useTuiControllers({
83675
83726
  };
83676
83727
  };
83677
83728
  }, [dispatch, enhanceController, enhanceEnabled]);
83678
- (0, import_react144.useEffect)(() => {
83729
+ (0, import_react146.useEffect)(() => {
83679
83730
  if (!agentsMonitorController) return;
83680
83731
  agentsMonitorController.visible = agentsMonitorOpen;
83681
83732
  agentsMonitorController.setVisible = (visible) => {
@@ -83689,19 +83740,19 @@ function useTuiControllers({
83689
83740
  };
83690
83741
  };
83691
83742
  }, [agentsMonitorController, agentsMonitorOpen, dispatch]);
83692
- (0, import_react144.useEffect)(() => {
83743
+ (0, import_react146.useEffect)(() => {
83693
83744
  if (agentsMonitorController) agentsMonitorController.visible = agentsMonitorOpen;
83694
83745
  }, [agentsMonitorController, agentsMonitorOpen]);
83695
83746
  }
83696
83747
 
83697
83748
  // src/hooks/use-tui-event-bridge.ts
83698
- var import_react147 = __toESM(require_react(), 1);
83749
+ var import_react149 = __toESM(require_react(), 1);
83699
83750
 
83700
83751
  // src/hooks/use-brain-events.ts
83701
- var import_react145 = __toESM(require_react(), 1);
83752
+ var import_react147 = __toESM(require_react(), 1);
83702
83753
  var MONITOR_INTERVENTION_GRACE_MS = 5e3;
83703
83754
  function useBrainEvents(events, dispatch, getSessionId) {
83704
- (0, import_react145.useEffect)(() => {
83755
+ (0, import_react147.useEffect)(() => {
83705
83756
  const isCurrentSession2 = (sessionId) => {
83706
83757
  const current = getSessionId?.();
83707
83758
  return !sessionId || !current || sessionId === current;
@@ -83913,7 +83964,7 @@ function useBrainEvents(events, dispatch, getSessionId) {
83913
83964
  }
83914
83965
 
83915
83966
  // src/hooks/use-subagent-events.ts
83916
- var import_react146 = __toESM(require_react(), 1);
83967
+ var import_react148 = __toESM(require_react(), 1);
83917
83968
  import { expectDefined as expectDefined5 } from "@wrongstack/core/utils";
83918
83969
  var STREAM_COLORS2 = ["cyan", "magenta", "yellow", "green", "blue"];
83919
83970
  function providerContextLimitHistoryEntry(event) {
@@ -83957,19 +84008,19 @@ function labelFor2(labelsRef, id, name) {
83957
84008
  return v;
83958
84009
  }
83959
84010
  function useSubagentEvents(events, dispatch, setActiveMaxContext, getSessionId, getChatMode, sessionGenerationRef) {
83960
- const labelsRef = (0, import_react146.useRef)(/* @__PURE__ */ new Map());
83961
- const ctxDispatchRef = (0, import_react146.useRef)(/* @__PURE__ */ new Map());
83962
- const leaderCtxDispatchRef = (0, import_react146.useRef)(void 0);
83963
- const leaderCtxFlushRef = (0, import_react146.useRef)(void 0);
83964
- const latestLeaderCtxPctRef = (0, import_react146.useRef)(void 0);
83965
- const ctxFlushRef = (0, import_react146.useRef)(/* @__PURE__ */ new Map());
84011
+ const labelsRef = (0, import_react148.useRef)(/* @__PURE__ */ new Map());
84012
+ const ctxDispatchRef = (0, import_react148.useRef)(/* @__PURE__ */ new Map());
84013
+ const leaderCtxDispatchRef = (0, import_react148.useRef)(void 0);
84014
+ const leaderCtxFlushRef = (0, import_react148.useRef)(void 0);
84015
+ const latestLeaderCtxPctRef = (0, import_react148.useRef)(void 0);
84016
+ const ctxFlushRef = (0, import_react148.useRef)(/* @__PURE__ */ new Map());
83966
84017
  const gate = useFleetGenerationGate(sessionGenerationRef);
83967
- const lbl = (0, import_react146.useCallback)(
84018
+ const lbl = (0, import_react148.useCallback)(
83968
84019
  (id, name) => labelFor2(labelsRef, id, name),
83969
84020
  []
83970
84021
  // labelsRef is a stable ref
83971
84022
  );
83972
- (0, import_react146.useEffect)(() => {
84023
+ (0, import_react148.useEffect)(() => {
83973
84024
  const seen = /* @__PURE__ */ new Set();
83974
84025
  const isCurrentSession2 = (sessionId) => {
83975
84026
  const current = getSessionId?.();
@@ -84307,7 +84358,7 @@ function useTuiEventBridge({
84307
84358
  onClearHistory,
84308
84359
  sessionGenerationRef
84309
84360
  }) {
84310
- const getChatMode = (0, import_react147.useCallback)(() => stateRef.current.fleetChat, [stateRef]);
84361
+ const getChatMode = (0, import_react149.useCallback)(() => stateRef.current.fleetChat, [stateRef]);
84311
84362
  useSubagentEvents(
84312
84363
  events,
84313
84364
  dispatch,
@@ -84321,7 +84372,7 @@ function useTuiEventBridge({
84321
84372
  useGoalEvents(subscribeGoal, dispatch, stateRef, getSessionId);
84322
84373
  }
84323
84374
  function useSessionEvents(events, dispatch, onClearHistory, getSessionId) {
84324
- (0, import_react147.useEffect)(() => {
84375
+ (0, import_react149.useEffect)(() => {
84325
84376
  const isCurrentSession2 = (sessionId) => {
84326
84377
  const current = getSessionId?.();
84327
84378
  return !sessionId || !current || sessionId === current;
@@ -84352,7 +84403,7 @@ function useSessionEvents(events, dispatch, onClearHistory, getSessionId) {
84352
84403
  }, [events, dispatch, onClearHistory, getSessionId]);
84353
84404
  }
84354
84405
  function useGoalEvents(subscribeGoal, dispatch, stateRef, getSessionId) {
84355
- (0, import_react147.useEffect)(() => {
84406
+ (0, import_react149.useEffect)(() => {
84356
84407
  if (!subscribeGoal) return;
84357
84408
  const isCurrentSession2 = (sessionId) => {
84358
84409
  const current = getSessionId?.();
@@ -84563,7 +84614,7 @@ function useGoalEvents(subscribeGoal, dispatch, stateRef, getSessionId) {
84563
84614
  }
84564
84615
 
84565
84616
  // src/hooks/use-design-kit-slash-commands.ts
84566
- var import_react148 = __toESM(require_react(), 1);
84617
+ var import_react150 = __toESM(require_react(), 1);
84567
84618
  import {
84568
84619
  applyTokenOverrides,
84569
84620
  clearActiveKit,
@@ -84579,7 +84630,7 @@ import {
84579
84630
  } from "@wrongstack/core/design";
84580
84631
  function useDesignKitSlashCommands(deps) {
84581
84632
  const { slashRegistry, projectRoot, agent, dispatch } = deps;
84582
- (0, import_react148.useEffect)(() => {
84633
+ (0, import_react150.useEffect)(() => {
84583
84634
  const cmd = {
84584
84635
  name: "design",
84585
84636
  description: "Design Studio: /design (picker) | <kit> [stack] | off | foundations | set <k=v> | tune <k=v> | swap <kit> | materialize [stack] [path] | verify.",
@@ -84714,7 +84765,7 @@ ${menu}` };
84714
84765
  }
84715
84766
 
84716
84767
  // src/hooks/use-provider-slash-commands.ts
84717
- var import_react149 = __toESM(require_react(), 1);
84768
+ var import_react151 = __toESM(require_react(), 1);
84718
84769
  function useProviderSlashCommands(deps) {
84719
84770
  const {
84720
84771
  slashRegistry,
@@ -84723,7 +84774,7 @@ function useProviderSlashCommands(deps) {
84723
84774
  openModelPicker,
84724
84775
  openFKeyPicker
84725
84776
  } = deps;
84726
- (0, import_react149.useEffect)(() => {
84777
+ (0, import_react151.useEffect)(() => {
84727
84778
  if (!getPickableProviders || !switchProviderAndModel) return;
84728
84779
  const cmd = {
84729
84780
  name: "model",
@@ -84739,7 +84790,7 @@ function useProviderSlashCommands(deps) {
84739
84790
  official: true
84740
84791
  });
84741
84792
  }, [slashRegistry, getPickableProviders, switchProviderAndModel, openModelPicker]);
84742
- (0, import_react149.useEffect)(() => {
84793
+ (0, import_react151.useEffect)(() => {
84743
84794
  const cmd = {
84744
84795
  name: "f",
84745
84796
  description: "Open F-key panel picker. Arrow keys to navigate, Enter to open, Esc to close.",
@@ -84756,12 +84807,12 @@ function useProviderSlashCommands(deps) {
84756
84807
  }
84757
84808
 
84758
84809
  // src/hooks/use-resource-slash-commands.ts
84759
- var import_react150 = __toESM(require_react(), 1);
84810
+ var import_react152 = __toESM(require_react(), 1);
84760
84811
  import { SKILL_LIMITS, stripFrontmatter } from "@wrongstack/core/skills";
84761
84812
  import { toErrorMessage as toErrorMessage12 } from "@wrongstack/core/utils";
84762
84813
  function useResourceSlashCommands(deps) {
84763
84814
  const { slashRegistry, skillLoader, getResourceMenu, dispatch, openPromptPicker } = deps;
84764
- (0, import_react150.useEffect)(() => {
84815
+ (0, import_react152.useEffect)(() => {
84765
84816
  if (!skillLoader) return;
84766
84817
  const cmd = {
84767
84818
  name: "skill",
@@ -84795,7 +84846,7 @@ function useResourceSlashCommands(deps) {
84795
84846
  official: true
84796
84847
  });
84797
84848
  }, [slashRegistry, skillLoader, dispatch]);
84798
- (0, import_react150.useEffect)(() => {
84849
+ (0, import_react152.useEffect)(() => {
84799
84850
  if (!getResourceMenu) return;
84800
84851
  const names = [
84801
84852
  "fallback",
@@ -84837,7 +84888,7 @@ function useResourceSlashCommands(deps) {
84837
84888
  for (const cleanup of [...cleanups].reverse()) cleanup();
84838
84889
  };
84839
84890
  }, [slashRegistry, getResourceMenu, dispatch]);
84840
- (0, import_react150.useEffect)(() => {
84891
+ (0, import_react152.useEffect)(() => {
84841
84892
  const definitions = [
84842
84893
  { name: "cron", open: () => dispatch({ type: "toggleCronMonitor" }) },
84843
84894
  { name: "prompts", open: () => void openPromptPicker() }
@@ -84872,7 +84923,7 @@ function useResourceSlashCommands(deps) {
84872
84923
  }
84873
84924
 
84874
84925
  // src/hooks/use-session-slash-commands.ts
84875
- var import_react151 = __toESM(require_react(), 1);
84926
+ var import_react153 = __toESM(require_react(), 1);
84876
84927
  import {
84877
84928
  areSubagentsAllowed,
84878
84929
  isSubagentPolicyLocked,
@@ -84882,7 +84933,7 @@ import { toErrorMessage as toErrorMessage13 } from "@wrongstack/core/utils";
84882
84933
  var RESUME_PICKER_SESSIONS = 500;
84883
84934
  function useSessionSlashCommands(deps, part) {
84884
84935
  const { agent, slashRegistry, dispatch, setMailboxPanelOpen, switchAutonomy, listSessions } = deps;
84885
- (0, import_react151.useEffect)(() => {
84936
+ (0, import_react153.useEffect)(() => {
84886
84937
  if (part !== "head") return;
84887
84938
  const cmd = {
84888
84939
  name: "solo",
@@ -84913,7 +84964,7 @@ function useSessionSlashCommands(deps, part) {
84913
84964
  official: true
84914
84965
  });
84915
84966
  }, [part, agent, slashRegistry]);
84916
- (0, import_react151.useEffect)(() => {
84967
+ (0, import_react153.useEffect)(() => {
84917
84968
  if (part !== "mid") return;
84918
84969
  const cmd = {
84919
84970
  name: "mailbox",
@@ -84929,7 +84980,7 @@ function useSessionSlashCommands(deps, part) {
84929
84980
  official: true
84930
84981
  });
84931
84982
  }, [part, slashRegistry]);
84932
- (0, import_react151.useEffect)(() => {
84983
+ (0, import_react153.useEffect)(() => {
84933
84984
  if (part !== "mid") return;
84934
84985
  if (!switchAutonomy) return;
84935
84986
  const cmd = {
@@ -84946,7 +84997,7 @@ function useSessionSlashCommands(deps, part) {
84946
84997
  official: true
84947
84998
  });
84948
84999
  }, [part, slashRegistry, switchAutonomy]);
84949
- (0, import_react151.useEffect)(() => {
85000
+ (0, import_react153.useEffect)(() => {
84950
85001
  if (part !== "tail") return;
84951
85002
  const hostSessions = slashRegistry.get("sessions");
84952
85003
  const cmd = {
@@ -84997,7 +85048,7 @@ function useSessionSlashCommands(deps, part) {
84997
85048
  }
84998
85049
 
84999
85050
  // src/hooks/use-settings-slash-commands.ts
85000
- var import_react152 = __toESM(require_react(), 1);
85051
+ var import_react154 = __toESM(require_react(), 1);
85001
85052
  function useSettingsSlashCommands(deps, part) {
85002
85053
  const {
85003
85054
  slashRegistry,
@@ -85010,7 +85061,7 @@ function useSettingsSlashCommands(deps, part) {
85010
85061
  setHiddenItems,
85011
85062
  openStatuslinePicker
85012
85063
  } = deps;
85013
- (0, import_react152.useEffect)(() => {
85064
+ (0, import_react154.useEffect)(() => {
85014
85065
  if (part !== "core") return;
85015
85066
  if (!getSettings || !saveSettings) return;
85016
85067
  const cmd = {
@@ -85129,7 +85180,7 @@ Available chords:
85129
85180
  official: true
85130
85181
  });
85131
85182
  }, [part, slashRegistry, getSettings, saveSettings, openSettings, dispatch]);
85132
- (0, import_react152.useEffect)(() => {
85183
+ (0, import_react154.useEffect)(() => {
85133
85184
  if (part !== "core") return;
85134
85185
  const cmd = {
85135
85186
  name: "settings-get",
@@ -85162,7 +85213,7 @@ Available chords:
85162
85213
  official: true
85163
85214
  });
85164
85215
  }, [part, slashRegistry, state.settingsPicker]);
85165
- (0, import_react152.useEffect)(() => {
85216
+ (0, import_react154.useEffect)(() => {
85166
85217
  if (part !== "core") return;
85167
85218
  const cmd = {
85168
85219
  name: "statusline",
@@ -85216,7 +85267,7 @@ Available chords:
85216
85267
  official: true
85217
85268
  });
85218
85269
  }, [part, slashRegistry, openStatuslinePicker, setHiddenItems]);
85219
- (0, import_react152.useEffect)(() => {
85270
+ (0, import_react154.useEffect)(() => {
85220
85271
  if (part !== "core") return;
85221
85272
  if (!getSettings || !saveSettings) return;
85222
85273
  const applyLayoutPreset = async (statuslineMode, showSidebar) => {
@@ -85268,7 +85319,7 @@ Available chords:
85268
85319
  teardownFull();
85269
85320
  };
85270
85321
  }, [part, slashRegistry, getSettings, saveSettings, dispatch]);
85271
- (0, import_react152.useEffect)(() => {
85322
+ (0, import_react154.useEffect)(() => {
85272
85323
  if (part !== "appearance") return;
85273
85324
  const cmd = {
85274
85325
  name: "theme",
@@ -85364,7 +85415,7 @@ function useTuiSlashCommands({
85364
85415
  import { buildGoalPreamble as buildGoalPreamble2 } from "@wrongstack/core/execution";
85365
85416
 
85366
85417
  // src/hooks/use-leader-auto-wake.ts
85367
- var import_react153 = __toESM(require_react(), 1);
85418
+ var import_react155 = __toESM(require_react(), 1);
85368
85419
  function normalizeSessionId(sessionId) {
85369
85420
  return (sessionId ?? "").trim().replace(/\\/g, "/");
85370
85421
  }
@@ -85385,11 +85436,11 @@ function createTuiLeaderWakePort(deps) {
85385
85436
  };
85386
85437
  }
85387
85438
  function useLeaderAutoWake(args) {
85388
- const argsRef = (0, import_react153.useRef)(args);
85439
+ const argsRef = (0, import_react155.useRef)(args);
85389
85440
  argsRef.current = args;
85390
- const pendingForms = (0, import_react153.useRef)(0);
85441
+ const pendingForms = (0, import_react155.useRef)(0);
85391
85442
  const { leaderAutoWake, events } = args;
85392
- (0, import_react153.useEffect)(() => {
85443
+ (0, import_react155.useEffect)(() => {
85393
85444
  if (!leaderAutoWake) return;
85394
85445
  const live = argsRef;
85395
85446
  const port = createTuiLeaderWakePort({
@@ -85614,7 +85665,7 @@ function App2(props) {
85614
85665
  refineModel,
85615
85666
  setRefineModel
85616
85667
  } = useAppRefSpine({ attachments, state, midRunSendPicker });
85617
- const onScrollInfo = (0, import_react154.useCallback)(
85668
+ const onScrollInfo = (0, import_react156.useCallback)(
85618
85669
  (info) => dispatch({ type: "setHistoryScrolled", scrolled: info.scrolled }),
85619
85670
  [dispatch]
85620
85671
  );
@@ -85771,11 +85822,11 @@ function App2(props) {
85771
85822
  setLiveModeLabel
85772
85823
  } = environment;
85773
85824
  const { displayThinkingWord } = activity;
85774
- const liveDirector = (0, import_react154.useCallback)(
85825
+ const liveDirector = (0, import_react156.useCallback)(
85775
85826
  () => getDirector?.() ?? director,
85776
85827
  [getDirector, director]
85777
85828
  );
85778
- const clearPendingConfirms = (0, import_react154.useCallback)(() => {
85829
+ const clearPendingConfirms = (0, import_react156.useCallback)(() => {
85779
85830
  const queue = stateRef.current.confirmQueue;
85780
85831
  if (queue.length === 0) return;
85781
85832
  for (const c of queue) {
@@ -85792,7 +85843,7 @@ function App2(props) {
85792
85843
  dispatch,
85793
85844
  open: state.authPanel.open
85794
85845
  });
85795
- (0, import_react154.useEffect)(() => {
85846
+ (0, import_react156.useEffect)(() => {
85796
85847
  if (!secretInputController) return;
85797
85848
  const previousSecret = secretInputController.readSecret;
85798
85849
  const previousText = secretInputController.readText;
@@ -85804,13 +85855,13 @@ function App2(props) {
85804
85855
  else delete secretInputController.readText;
85805
85856
  };
85806
85857
  }, [secretInputController, authPanelController.readSecret, authPanelController.readText]);
85807
- const statuslineHiddenForPicker = (0, import_react154.useCallback)(() => {
85858
+ const statuslineHiddenForPicker = (0, import_react156.useCallback)(() => {
85808
85859
  return mergeStatuslineHiddenItems(
85809
85860
  hiddenItemsRef.current,
85810
85861
  stateRef.current.statuslinePicker.hiddenItems
85811
85862
  );
85812
85863
  }, [hiddenItemsRef, stateRef]);
85813
- const openStatuslinePicker = (0, import_react154.useCallback)(
85864
+ const openStatuslinePicker = (0, import_react156.useCallback)(
85814
85865
  (field) => {
85815
85866
  if (field !== void 0) {
85816
85867
  dispatch({ type: "statuslineFieldSet", field });
@@ -86004,8 +86055,8 @@ function App2(props) {
86004
86055
  saveSettings,
86005
86056
  midRunSendPickerRef
86006
86057
  });
86007
- const getActiveSessionId = (0, import_react154.useCallback)(() => agent.ctx.session.id, [agent]);
86008
- const getLeaderTranscript = (0, import_react154.useCallback)(
86058
+ const getActiveSessionId = (0, import_react156.useCallback)(() => agent.ctx.session.id, [agent]);
86059
+ const getLeaderTranscript = (0, import_react156.useCallback)(
86009
86060
  () => leaderTimelineFromEntries(stateRef.current.entries),
86010
86061
  [stateRef]
86011
86062
  );
@@ -86314,7 +86365,7 @@ import {
86314
86365
  } from "@wrongstack/tools/next-steps";
86315
86366
 
86316
86367
  // src/run-tui.ts
86317
- var import_react155 = __toESM(require_react(), 1);
86368
+ var import_react157 = __toESM(require_react(), 1);
86318
86369
  import { createWriteStream } from "node:fs";
86319
86370
  import { tmpdir } from "node:os";
86320
86371
  import { join as join8 } from "node:path";
@@ -87102,7 +87153,7 @@ async function runTui(opts) {
87102
87153
  stdout.write(BRACKETED_PASTE_ON);
87103
87154
  stdout.write("\x1B[2J\x1B[H");
87104
87155
  lifecycle.acquire(stdin);
87105
- const appElement = import_react155.default.createElement(App2, {
87156
+ const appElement = import_react157.default.createElement(App2, {
87106
87157
  agent: opts.agent,
87107
87158
  slashRegistry: opts.slashRegistry,
87108
87159
  skillLoader: opts.skillLoader,