@wrongstack/tui 1.0.16 → 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({
@@ -67706,7 +67747,7 @@ function validatePasteContent(content) {
67706
67747
  error: `paste: C0 control char 0x${code.toString(16)} at position ${i} is not allowed.`
67707
67748
  };
67708
67749
  }
67709
- if (code > 0 && code < 9) nonPrintableCount++;
67750
+ if (code === 127 || code >= 128 && code <= 159) nonPrintableCount++;
67710
67751
  }
67711
67752
  if (content.length > 10 && nonPrintableCount / content.length > 0.3) {
67712
67753
  return {
@@ -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]*))?$/);
@@ -77082,21 +77123,29 @@ function buildContinuationMessage(active) {
77082
77123
  const scope = active.scope ? ` Stay within the original scope: ${active.scope}.` : "";
77083
77124
  return `This is ${roundLabel}; we're continuing the bug hunt.${scope}`;
77084
77125
  }
77085
- function submitAfterCurrentRun(submit, command) {
77086
- setTimeout(() => submit(command), 0);
77126
+ function submitAfterCurrentRun(submit) {
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 lastHistoryGenRef = (0, import_react113.useRef)(historyGen);
77092
- (0, import_react113.useEffect)(() => {
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)(() => {
77134
+ if (pendingSubmitRef.current !== null) clearTimeout(pendingSubmitRef.current);
77135
+ pendingSubmitRef.current = null;
77136
+ replayCommandRef.current = null;
77137
+ }, []);
77138
+ (0, import_react115.useEffect)(() => cancelPendingSubmit, [cancelPendingSubmit]);
77139
+ const lastHistoryGenRef = (0, import_react115.useRef)(historyGen);
77140
+ (0, import_react115.useEffect)(() => {
77093
77141
  if (historyGen === void 0) return;
77094
77142
  if (historyGen === lastHistoryGenRef.current) return;
77095
77143
  lastHistoryGenRef.current = historyGen;
77144
+ cancelPendingSubmit();
77096
77145
  activeRef.current = null;
77097
77146
  replayCommandRef.current = null;
77098
- }, [historyGen]);
77099
- const onBugHuntStarted = (0, import_react113.useCallback)(
77147
+ }, [historyGen, cancelPendingSubmit]);
77148
+ const onBugHuntStarted = (0, import_react115.useCallback)(
77100
77149
  (command, totalRounds) => {
77101
77150
  const active = activeRef.current;
77102
77151
  if (active?.command === command) {
@@ -77109,6 +77158,7 @@ function useBugHuntLoop(dispatch, submit, historyGen) {
77109
77158
  });
77110
77159
  return;
77111
77160
  }
77161
+ cancelPendingSubmit();
77112
77162
  activeRef.current = {
77113
77163
  command,
77114
77164
  scope: parseBugHuntScope(command),
@@ -77117,14 +77167,16 @@ function useBugHuntLoop(dispatch, submit, historyGen) {
77117
77167
  };
77118
77168
  dispatch({ type: "bugHuntRunningOpen", info: { currentRound: 1, totalRounds } });
77119
77169
  },
77120
- [dispatch]
77170
+ [dispatch, cancelPendingSubmit]
77121
77171
  );
77122
- const onRunFinished = (0, import_react113.useCallback)(
77172
+ const onRunFinished = (0, import_react115.useCallback)(
77123
77173
  (status) => {
77124
77174
  const active = activeRef.current;
77125
77175
  if (!active) return;
77176
+ if (status === "done" && pendingSubmitRef.current !== null) return;
77126
77177
  dispatch({ type: "bugHuntRunningClose" });
77127
77178
  if (status !== "done") {
77179
+ cancelPendingSubmit();
77128
77180
  activeRef.current = null;
77129
77181
  dispatch({
77130
77182
  type: "addEntry",
@@ -77151,7 +77203,6 @@ function useBugHuntLoop(dispatch, submit, historyGen) {
77151
77203
  const snapshot = { ...active };
77152
77204
  const continueWithNextRound = () => {
77153
77205
  const continuation = buildContinuationMessage(snapshot);
77154
- replayCommandRef.current = continuation;
77155
77206
  dispatch({
77156
77207
  type: "bugHuntRunningOpen",
77157
77208
  info: {
@@ -77159,23 +77210,28 @@ function useBugHuntLoop(dispatch, submit, historyGen) {
77159
77210
  totalRounds: snapshot.totalRounds
77160
77211
  }
77161
77212
  });
77162
- submitAfterCurrentRun(submit, continuation);
77213
+ pendingSubmitRef.current = submitAfterCurrentRun(() => {
77214
+ pendingSubmitRef.current = null;
77215
+ if (activeRef.current !== active) return;
77216
+ replayCommandRef.current = continuation;
77217
+ submit(continuation);
77218
+ });
77163
77219
  };
77164
77220
  continueWithNextRound();
77165
77221
  },
77166
- [dispatch, submit]
77222
+ [dispatch, submit, cancelPendingSubmit]
77167
77223
  );
77168
- const consumeReplay = (0, import_react113.useCallback)((command) => {
77224
+ const consumeReplay = (0, import_react115.useCallback)((command) => {
77169
77225
  if (replayCommandRef.current !== command) return false;
77170
77226
  replayCommandRef.current = null;
77171
77227
  return true;
77172
77228
  }, []);
77173
- const shouldSuppressNextSteps = (0, import_react113.useCallback)(() => activeRef.current !== null, []);
77229
+ const shouldSuppressNextSteps = (0, import_react115.useCallback)(() => activeRef.current !== null, []);
77174
77230
  return { onBugHuntStarted, onRunFinished, consumeReplay, shouldSuppressNextSteps };
77175
77231
  }
77176
77232
 
77177
77233
  // src/hooks/use-client-telemetry.ts
77178
- var import_react114 = __toESM(require_react(), 1);
77234
+ var import_react116 = __toESM(require_react(), 1);
77179
77235
  import { projectSlug } from "@wrongstack/core/utils";
77180
77236
  function useClientTelemetry({
77181
77237
  events,
@@ -77187,7 +77243,7 @@ function useClientTelemetry({
77187
77243
  restoreDebugStreamCallback,
77188
77244
  dispatch
77189
77245
  }) {
77190
- (0, import_react114.useEffect)(() => {
77246
+ (0, import_react116.useEffect)(() => {
77191
77247
  if (!clientId || !events) return;
77192
77248
  let toolCalls = 0;
77193
77249
  const emitStatus = () => {
@@ -77229,7 +77285,7 @@ function useClientTelemetry({
77229
77285
  offIterCompleted();
77230
77286
  };
77231
77287
  }, [events, clientId, tokenCounter, getAutonomy, agent.ctx.model, agent.ctx.projectRoot]);
77232
- (0, import_react114.useEffect)(() => {
77288
+ (0, import_react116.useEffect)(() => {
77233
77289
  if (!registerDebugStreamCallback) return;
77234
77290
  let cancelled = false;
77235
77291
  registerDebugStreamCallback((stats) => {
@@ -77259,7 +77315,7 @@ function useClientTelemetry({
77259
77315
  }
77260
77316
 
77261
77317
  // src/hooks/use-core-tui-commands.ts
77262
- var import_react115 = __toESM(require_react(), 1);
77318
+ var import_react117 = __toESM(require_react(), 1);
77263
77319
  import { toErrorMessage as toErrorMessage7 } from "@wrongstack/core/utils";
77264
77320
  import { getProcessRegistry as getProcessRegistry7 } from "@wrongstack/tools";
77265
77321
 
@@ -77934,6 +77990,10 @@ function renderHealthReport(health2) {
77934
77990
  attention.push(
77935
77991
  ` heartbeat-due ${health2.heartbeatDue.count}` + (health2.heartbeatDue.count > 0 ? ` (first: ${summarizeSearchResult(health2.heartbeatDue.tasks[0])})` : "")
77936
77992
  );
77993
+ const parkedCount = health2.parked?.count ?? 0;
77994
+ attention.push(
77995
+ ` parked ${parkedCount}` + (parkedCount > 0 ? ` (first: ${summarizeSearchResult(health2.parked?.tasks[0])})` : "")
77996
+ );
77937
77997
  attention.push("");
77938
77998
  const stamps = [" **Activity**"];
77939
77999
  stamps.push(` last dispatch ${health2.lastDispatchedAt ?? "never"}`);
@@ -79181,8 +79241,8 @@ function useCoreTuiCommands({
79181
79241
  handleRewindTo
79182
79242
  }) {
79183
79243
  const stdout = { columns: terminalWidth };
79184
- const getCronJobs = (0, import_react115.useMemo)(() => createCronJobsGetter(agent), [agent]);
79185
- (0, import_react115.useEffect)(() => {
79244
+ const getCronJobs = (0, import_react117.useMemo)(() => createCronJobsGetter(agent), [agent]);
79245
+ (0, import_react117.useEffect)(() => {
79186
79246
  const cleanups = [];
79187
79247
  cleanups.push(registerSlashCommandLifecycle(slashRegistry, createKillSlashCommand()));
79188
79248
  cleanups.push(registerSlashCommandLifecycle(slashRegistry, createPsSlashCommand()));
@@ -79257,12 +79317,12 @@ function useCoreTuiCommands({
79257
79317
  getModeLabel,
79258
79318
  getCronJobs
79259
79319
  ]);
79260
- (0, import_react115.useEffect)(() => {
79320
+ (0, import_react117.useEffect)(() => {
79261
79321
  return () => {
79262
79322
  getProcessRegistry7().killAll({ preserveBackground: true });
79263
79323
  };
79264
79324
  }, []);
79265
- const runSteerSequence = (0, import_react115.useCallback)(
79325
+ const runSteerSequence = (0, import_react117.useCallback)(
79266
79326
  (text) => {
79267
79327
  const s2 = stateRef.current;
79268
79328
  const runningTools = Array.from(s2.runningTools.values()).map((t) => t.name);
@@ -79289,7 +79349,7 @@ function useCoreTuiCommands({
79289
79349
  },
79290
79350
  [liveDirector, clearPendingConfirms, dispatch]
79291
79351
  );
79292
- (0, import_react115.useEffect)(() => {
79352
+ (0, import_react117.useEffect)(() => {
79293
79353
  const cmd = {
79294
79354
  name: "steer",
79295
79355
  description: "Interrupt the running agent (incl. fleet) and redirect: /steer <new direction>",
@@ -79318,7 +79378,7 @@ function useCoreTuiCommands({
79318
79378
  };
79319
79379
  return registerSlashCommandLifecycle(slashRegistry, cmd);
79320
79380
  }, [slashRegistry, director, runSteerSequence]);
79321
- (0, import_react115.useEffect)(() => {
79381
+ (0, import_react117.useEffect)(() => {
79322
79382
  const cmd = {
79323
79383
  name: "rewind",
79324
79384
  description: "Open checkpoint timeline to rewind session: /rewind [checkpoint-index]",
@@ -79352,7 +79412,7 @@ function useCoreTuiCommands({
79352
79412
  };
79353
79413
  return registerSlashCommandLifecycle(slashRegistry, cmd);
79354
79414
  }, [slashRegistry, handleRewindTo]);
79355
- (0, import_react115.useEffect)(() => {
79415
+ (0, import_react117.useEffect)(() => {
79356
79416
  const original = slashRegistry.get("agents");
79357
79417
  const cmd = {
79358
79418
  name: "agents",
@@ -79377,7 +79437,7 @@ function useCoreTuiCommands({
79377
79437
  }
79378
79438
 
79379
79439
  // src/hooks/use-director-fleet-bridge.ts
79380
- var import_react117 = __toESM(require_react(), 1);
79440
+ var import_react119 = __toESM(require_react(), 1);
79381
79441
  import { stripNextStepsBlock } from "@wrongstack/tools/next-steps";
79382
79442
 
79383
79443
  // src/hooks/fleet-chat-coalescer.ts
@@ -79474,11 +79534,11 @@ function formatDelegateSuccessText(input) {
79474
79534
  }
79475
79535
 
79476
79536
  // src/hooks/use-fleet-generation-gate.ts
79477
- var import_react116 = __toESM(require_react(), 1);
79537
+ var import_react118 = __toESM(require_react(), 1);
79478
79538
  function useFleetGenerationGate(sessionGenerationRef) {
79479
- const spawnGenRef = (0, import_react116.useRef)(/* @__PURE__ */ new Map());
79480
- const sweptGenRef = (0, import_react116.useRef)(void 0);
79481
- 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)(() => {
79482
79542
  if (!sessionGenerationRef) return;
79483
79543
  const cur = sessionGenerationRef.current;
79484
79544
  if (sweptGenRef.current === cur) return;
@@ -79487,7 +79547,7 @@ function useFleetGenerationGate(sessionGenerationRef) {
79487
79547
  if (gen < cur - 1) spawnGenRef.current.delete(id);
79488
79548
  }
79489
79549
  }, [sessionGenerationRef]);
79490
- const track = (0, import_react116.useCallback)(
79550
+ const track = (0, import_react118.useCallback)(
79491
79551
  (subagentId) => {
79492
79552
  if (sessionGenerationRef) {
79493
79553
  sweep();
@@ -79496,7 +79556,7 @@ function useFleetGenerationGate(sessionGenerationRef) {
79496
79556
  },
79497
79557
  [sessionGenerationRef, sweep]
79498
79558
  );
79499
- const isLive = (0, import_react116.useCallback)(
79559
+ const isLive = (0, import_react118.useCallback)(
79500
79560
  (subagentId) => {
79501
79561
  if (!sessionGenerationRef) return true;
79502
79562
  const gen = spawnGenRef.current.get(subagentId);
@@ -79505,10 +79565,10 @@ function useFleetGenerationGate(sessionGenerationRef) {
79505
79565
  },
79506
79566
  [sessionGenerationRef]
79507
79567
  );
79508
- const forget = (0, import_react116.useCallback)((subagentId) => {
79568
+ const forget = (0, import_react118.useCallback)((subagentId) => {
79509
79569
  spawnGenRef.current.delete(subagentId);
79510
79570
  }, []);
79511
- 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]);
79512
79572
  }
79513
79573
 
79514
79574
  // src/hooks/use-director-fleet-bridge.ts
@@ -79533,13 +79593,13 @@ function useDirectorFleetBridge({
79533
79593
  chatMode,
79534
79594
  sessionGenerationRef
79535
79595
  }) {
79536
- const labelsRef = (0, import_react117.useRef)(/* @__PURE__ */ new Map());
79537
- 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);
79538
79598
  const gate = useFleetGenerationGate(sessionGenerationRef);
79539
- (0, import_react117.useEffect)(() => {
79599
+ (0, import_react119.useEffect)(() => {
79540
79600
  chatModeRef.current = chatMode;
79541
79601
  }, [chatMode]);
79542
- (0, import_react117.useEffect)(() => {
79602
+ (0, import_react119.useEffect)(() => {
79543
79603
  const d = director;
79544
79604
  if (!d) return;
79545
79605
  const batch = [];
@@ -80005,7 +80065,7 @@ function handleCollabDone(event, dispatch, stateRef) {
80005
80065
  }
80006
80066
 
80007
80067
  // src/hooks/use-exit-command.ts
80008
- var import_react118 = __toESM(require_react(), 1);
80068
+ var import_react120 = __toESM(require_react(), 1);
80009
80069
  import { getProcessRegistry as getProcessRegistry8 } from "@wrongstack/tools";
80010
80070
 
80011
80071
  // src/exit-slash.ts
@@ -80052,14 +80112,14 @@ function useExitCommand({
80052
80112
  interruptController,
80053
80113
  getDirector
80054
80114
  }) {
80055
- const hostExitCommandRef = (0, import_react118.useRef)(void 0);
80056
- const hostExitCapturedRef = (0, import_react118.useRef)(false);
80115
+ const hostExitCommandRef = (0, import_react120.useRef)(void 0);
80116
+ const hostExitCapturedRef = (0, import_react120.useRef)(false);
80057
80117
  if (!hostExitCapturedRef.current) {
80058
80118
  hostExitCommandRef.current = slashRegistry.get?.("exit");
80059
80119
  hostExitCapturedRef.current = true;
80060
80120
  }
80061
- const pendingResolveRef = (0, import_react118.useRef)(null);
80062
- const terminateWork = (0, import_react118.useCallback)(async () => {
80121
+ const pendingResolveRef = (0, import_react120.useRef)(null);
80122
+ const terminateWork = (0, import_react120.useCallback)(async () => {
80063
80123
  sessionGenerationRef.current += 1;
80064
80124
  interruptController?.abortLeader();
80065
80125
  const cleanup = [];
@@ -80080,7 +80140,7 @@ function useExitCommand({
80080
80140
  if (timeout) clearTimeout(timeout);
80081
80141
  }
80082
80142
  }, [getDirector, interruptController, sessionGenerationRef]);
80083
- const confirmExit = (0, import_react118.useCallback)(
80143
+ const confirmExit = (0, import_react120.useCallback)(
80084
80144
  (info) => {
80085
80145
  if (!info.leaderActive && info.subagentCount === 0) {
80086
80146
  return Promise.resolve(true);
@@ -80112,7 +80172,7 @@ function useExitCommand({
80112
80172
  },
80113
80173
  [dispatch, terminateWork]
80114
80174
  );
80115
- (0, import_react118.useEffect)(() => {
80175
+ (0, import_react120.useEffect)(() => {
80116
80176
  const cmd = createExitSlashCommand({
80117
80177
  isLeaderActive: () => interruptController?.isRunning?.() ?? stateRef.current.status !== "idle",
80118
80178
  countRunningSubagents: () => Object.values(stateRef.current.fleet).filter((e) => e.status === "running").length,
@@ -80129,7 +80189,7 @@ function useExitCommand({
80129
80189
  }
80130
80190
 
80131
80191
  // src/hooks/use-file-search.ts
80132
- var import_react119 = __toESM(require_react(), 1);
80192
+ var import_react121 = __toESM(require_react(), 1);
80133
80193
  import * as fs6 from "node:fs/promises";
80134
80194
  import * as path7 from "node:path";
80135
80195
  import { toErrorMessage as toErrorMessage8 } from "@wrongstack/core/utils";
@@ -80147,7 +80207,13 @@ var IGNORED_DIRS = /* @__PURE__ */ new Set([
80147
80207
  ".cache",
80148
80208
  "coverage",
80149
80209
  ".idea",
80150
- ".vscode"
80210
+ ".vscode",
80211
+ ".venv",
80212
+ "venv",
80213
+ "target",
80214
+ "vendor",
80215
+ ".gradle",
80216
+ ".yarn"
80151
80217
  ]);
80152
80218
  var MAX_FILES_INDEXED = 5e3;
80153
80219
  var MAX_DEPTH = 8;
@@ -80235,7 +80301,7 @@ function detectAtToken(buffer, cursor) {
80235
80301
  }
80236
80302
  function useFileSearch(options) {
80237
80303
  const { state, dispatch, projectRoot, builderRef, draftRef, setDraft, tokenPreviewsRef } = options;
80238
- (0, import_react119.useEffect)(() => {
80304
+ (0, import_react121.useEffect)(() => {
80239
80305
  const detected = detectAtToken(state.buffer, state.cursor);
80240
80306
  if (!detected) {
80241
80307
  if (state.picker.open) dispatch({ type: "pickerClose" });
@@ -80281,10 +80347,10 @@ function useFileSearch(options) {
80281
80347
  }
80282
80348
  const absPath = path7.isAbsolute(picked) ? picked : path7.join(projectRoot, picked);
80283
80349
  try {
80284
- const stat4 = await fs6.stat(absPath);
80350
+ const stat5 = await fs6.stat(absPath);
80285
80351
  let data;
80286
- if (stat4.size > TEXT_FILE_ATTACHMENT_INLINE_MAX_BYTES) {
80287
- data = fileReadContract(picked, stat4.size);
80352
+ if (stat5.size > TEXT_FILE_ATTACHMENT_INLINE_MAX_BYTES) {
80353
+ data = fileReadContract(picked, stat5.size);
80288
80354
  } else {
80289
80355
  const inline = await fs6.readFile(absPath, "utf8");
80290
80356
  const bytes = Buffer.byteLength(inline, "utf8");
@@ -80324,9 +80390,9 @@ function fileReadContract(filePath, bytes) {
80324
80390
  }
80325
80391
 
80326
80392
  // src/hooks/use-help-panel.ts
80327
- var import_react120 = __toESM(require_react(), 1);
80393
+ var import_react122 = __toESM(require_react(), 1);
80328
80394
  function useHelpPanel(dispatch, slashRegistry) {
80329
- const openHelpPanel = (0, import_react120.useCallback)(() => {
80395
+ const openHelpPanel = (0, import_react122.useCallback)(() => {
80330
80396
  const entries = Array.from(slashRegistry.listWithOwner()).map(({ cmd, owner }) => ({
80331
80397
  name: owner === "core" ? cmd.name : `${owner}:${cmd.name}`,
80332
80398
  description: cmd.description,
@@ -80340,7 +80406,7 @@ function useHelpPanel(dispatch, slashRegistry) {
80340
80406
  }
80341
80407
 
80342
80408
  // src/hooks/use-history-archive.ts
80343
- var import_react121 = __toESM(require_react(), 1);
80409
+ var import_react123 = __toESM(require_react(), 1);
80344
80410
  import * as fsp2 from "node:fs/promises";
80345
80411
  import * as path9 from "node:path";
80346
80412
 
@@ -80460,8 +80526,8 @@ var HistoryArchive = class {
80460
80526
  async buildIndex() {
80461
80527
  if (this.index !== null) return;
80462
80528
  const handle = await this.ensureOpen();
80463
- const stat4 = await handle.stat();
80464
- if (stat4.size === 0) {
80529
+ const stat5 = await handle.stat();
80530
+ if (stat5.size === 0) {
80465
80531
  this.index = [];
80466
80532
  return;
80467
80533
  }
@@ -80474,9 +80540,9 @@ var HistoryArchive = class {
80474
80540
  let read = 0;
80475
80541
  let lineStart = 0;
80476
80542
  let pending = null;
80477
- let chunk = Buffer.allocUnsafe(Math.min(CHUNK_BYTES, stat4.size));
80478
- while (read < stat4.size) {
80479
- 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);
80480
80546
  if (chunk.length !== want) chunk = Buffer.allocUnsafe(want);
80481
80547
  const { bytesRead } = await handle.read(chunk, 0, want, read);
80482
80548
  if (bytesRead <= 0) break;
@@ -80540,15 +80606,15 @@ function useHistoryArchive({
80540
80606
  sessionsDir,
80541
80607
  sessionId
80542
80608
  }) {
80543
- const archiveRef = (0, import_react121.useRef)(null);
80544
- const lastArchivedIdRef = (0, import_react121.useRef)(-1);
80545
- const appendedCountRef = (0, import_react121.useRef)(0);
80546
- const nextLoadEndRef = (0, import_react121.useRef)(null);
80547
- const loadingRef = (0, import_react121.useRef)(false);
80548
- 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);
80549
80615
  entriesRef.current = entries;
80550
- const [archiveGeneration, setArchiveGeneration] = (0, import_react121.useState)(0);
80551
- (0, import_react121.useEffect)(() => {
80616
+ const [archiveGeneration, setArchiveGeneration] = (0, import_react123.useState)(0);
80617
+ (0, import_react123.useEffect)(() => {
80552
80618
  if (!sessionsDir || !sessionId) return;
80553
80619
  let disposed = false;
80554
80620
  let created = null;
@@ -80573,7 +80639,7 @@ function useHistoryArchive({
80573
80639
  void created?.close();
80574
80640
  };
80575
80641
  }, [sessionsDir, sessionId]);
80576
- (0, import_react121.useEffect)(() => {
80642
+ (0, import_react123.useEffect)(() => {
80577
80643
  const archive = archiveRef.current;
80578
80644
  if (!archive) return;
80579
80645
  const since = lastArchivedIdRef.current;
@@ -80589,7 +80655,7 @@ function useHistoryArchive({
80589
80655
  lastArchivedIdRef.current = highest;
80590
80656
  appendedCountRef.current += appended;
80591
80657
  }, [entries, archiveGeneration]);
80592
- const onRequestOlderEntries = (0, import_react121.useCallback)(() => {
80658
+ const onRequestOlderEntries = (0, import_react123.useCallback)(() => {
80593
80659
  if (loadingRef.current) return;
80594
80660
  const settleEmpty = () => {
80595
80661
  dispatch({ type: "startArchiveLoad" });
@@ -80630,21 +80696,21 @@ function useHistoryArchive({
80630
80696
  }
80631
80697
 
80632
80698
  // src/hooks/use-history-auto-scroll.ts
80633
- var import_react122 = __toESM(require_react(), 1);
80699
+ var import_react124 = __toESM(require_react(), 1);
80634
80700
  var HISTORY_AUTO_SCROLL_DELAY_MS = 3e4;
80635
80701
  function useHistoryAutoScroll({
80636
80702
  historyScrolled,
80637
80703
  historyScrollRef
80638
80704
  }) {
80639
- const timerRef = (0, import_react122.useRef)(null);
80640
- const schedule = (0, import_react122.useCallback)(() => {
80705
+ const timerRef = (0, import_react124.useRef)(null);
80706
+ const schedule = (0, import_react124.useCallback)(() => {
80641
80707
  if (timerRef.current) clearTimeout(timerRef.current);
80642
80708
  timerRef.current = setTimeout(() => {
80643
80709
  timerRef.current = null;
80644
80710
  historyScrollRef.current?.scrollToBottom();
80645
80711
  }, HISTORY_AUTO_SCROLL_DELAY_MS);
80646
80712
  }, [historyScrollRef]);
80647
- (0, import_react122.useEffect)(() => {
80713
+ (0, import_react124.useEffect)(() => {
80648
80714
  if (!historyScrolled) {
80649
80715
  if (timerRef.current) clearTimeout(timerRef.current);
80650
80716
  timerRef.current = null;
@@ -80653,22 +80719,22 @@ function useHistoryAutoScroll({
80653
80719
  schedule();
80654
80720
  return void 0;
80655
80721
  }, [historyScrolled, schedule]);
80656
- (0, import_react122.useEffect)(
80722
+ (0, import_react124.useEffect)(
80657
80723
  () => () => {
80658
80724
  if (timerRef.current) clearTimeout(timerRef.current);
80659
80725
  },
80660
80726
  []
80661
80727
  );
80662
- return (0, import_react122.useCallback)(() => {
80728
+ return (0, import_react124.useCallback)(() => {
80663
80729
  if (historyScrolled) schedule();
80664
80730
  }, [historyScrolled, schedule]);
80665
80731
  }
80666
80732
 
80667
80733
  // src/hooks/use-history-copy-notice.ts
80668
- var import_react123 = __toESM(require_react(), 1);
80734
+ var import_react125 = __toESM(require_react(), 1);
80669
80735
  function useHistoryCopyNotice(dispatch) {
80670
- const copiedHintTimerRef = (0, import_react123.useRef)(null);
80671
- const onHistoryCopy = (0, import_react123.useCallback)(
80736
+ const copiedHintTimerRef = (0, import_react125.useRef)(null);
80737
+ const onHistoryCopy = (0, import_react125.useCallback)(
80672
80738
  (entryId) => {
80673
80739
  dispatch({ type: "copiedNotice", text: "\u2713 Copied", entryId });
80674
80740
  if (copiedHintTimerRef.current) clearTimeout(copiedHintTimerRef.current);
@@ -80679,7 +80745,7 @@ function useHistoryCopyNotice(dispatch) {
80679
80745
  },
80680
80746
  [dispatch]
80681
80747
  );
80682
- (0, import_react123.useEffect)(
80748
+ (0, import_react125.useEffect)(
80683
80749
  () => () => {
80684
80750
  if (copiedHintTimerRef.current) clearTimeout(copiedHintTimerRef.current);
80685
80751
  },
@@ -80689,7 +80755,7 @@ function useHistoryCopyNotice(dispatch) {
80689
80755
  }
80690
80756
 
80691
80757
  // src/hooks/use-initial-prompt.ts
80692
- var import_react124 = __toESM(require_react(), 1);
80758
+ var import_react126 = __toESM(require_react(), 1);
80693
80759
  import { buildGoalPreamble } from "@wrongstack/core/execution";
80694
80760
  function useInitialPrompt({
80695
80761
  initialGoal,
@@ -80698,8 +80764,8 @@ function useInitialPrompt({
80698
80764
  runBlocksRef,
80699
80765
  dispatch
80700
80766
  }) {
80701
- const bootInjectedRef = (0, import_react124.useRef)(false);
80702
- (0, import_react124.useEffect)(() => {
80767
+ const bootInjectedRef = (0, import_react126.useRef)(false);
80768
+ (0, import_react126.useEffect)(() => {
80703
80769
  if (bootInjectedRef.current) return;
80704
80770
  const goal = initialGoal?.trim();
80705
80771
  const ask = initialAsk?.trim();
@@ -80743,7 +80809,7 @@ function useInitialPrompt({
80743
80809
  }
80744
80810
 
80745
80811
  // src/hooks/use-input-history-persistence.ts
80746
- var import_react125 = __toESM(require_react(), 1);
80812
+ var import_react127 = __toESM(require_react(), 1);
80747
80813
  import { DefaultSecretScrubber } from "@wrongstack/core/security";
80748
80814
  import { INPUT_HISTORY_DEFAULT_MAX, InputHistoryStore } from "@wrongstack/core/storage";
80749
80815
  import { resolveWstackPaths as resolveWstackPaths4 } from "@wrongstack/core/utils";
@@ -80752,15 +80818,15 @@ function useInputHistoryPersistence({
80752
80818
  inputHistory,
80753
80819
  dispatch
80754
80820
  }) {
80755
- const inputHistoryStore = (0, import_react125.useMemo)(() => {
80821
+ const inputHistoryStore = (0, import_react127.useMemo)(() => {
80756
80822
  if (!projectRoot) return null;
80757
80823
  const file = resolveWstackPaths4({ projectRoot }).projectInputHistory;
80758
80824
  return new InputHistoryStore(file, new DefaultSecretScrubber(), INPUT_HISTORY_DEFAULT_MAX);
80759
80825
  }, [projectRoot]);
80760
- const inputHistoryLoadedRef = (0, import_react125.useRef)(false);
80761
- const inputHistorySaveTimerRef = (0, import_react125.useRef)(void 0);
80762
- const inputHistoryLastSavedRef = (0, import_react125.useRef)("");
80763
- (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)(() => {
80764
80830
  if (!inputHistoryStore) return;
80765
80831
  let cancelled = false;
80766
80832
  inputHistoryStore.load().then((entries) => {
@@ -80776,7 +80842,7 @@ function useInputHistoryPersistence({
80776
80842
  cancelled = true;
80777
80843
  };
80778
80844
  }, [inputHistoryStore, dispatch]);
80779
- (0, import_react125.useEffect)(() => {
80845
+ (0, import_react127.useEffect)(() => {
80780
80846
  if (!inputHistoryStore || !inputHistoryLoadedRef.current) return;
80781
80847
  const snapshot = JSON.stringify(inputHistory);
80782
80848
  if (snapshot === inputHistoryLastSavedRef.current) return;
@@ -80793,7 +80859,7 @@ function useInputHistoryPersistence({
80793
80859
  }
80794
80860
 
80795
80861
  // src/hooks/use-interrupt-ladder.ts
80796
- var import_react126 = __toESM(require_react(), 1);
80862
+ var import_react128 = __toESM(require_react(), 1);
80797
80863
  import { getProcessRegistry as getProcessRegistry9 } from "@wrongstack/tools";
80798
80864
  var INTERRUPT_PRESS_WINDOW_MS = 2e3;
80799
80865
  function useInterruptLadder({
@@ -80814,9 +80880,9 @@ function useInterruptLadder({
80814
80880
  getSddRun,
80815
80881
  confirmExitRef
80816
80882
  }) {
80817
- const interruptsSyncRef = (0, import_react126.useRef)(0);
80818
- const lastPressAtRef = (0, import_react126.useRef)(0);
80819
- 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)(() => {
80820
80886
  const current = stateRef.current;
80821
80887
  const now = Date.now();
80822
80888
  if (interruptsSyncRef.current > 0 && current.status === "idle" && now - lastPressAtRef.current > INTERRUPT_PRESS_WINDOW_MS) {
@@ -80991,7 +81057,7 @@ function useInterruptLadder({
80991
81057
  onExit,
80992
81058
  exit
80993
81059
  ]);
80994
- (0, import_react126.useEffect)(() => {
81060
+ (0, import_react128.useEffect)(() => {
80995
81061
  process.on("SIGINT", runInterruptLadder);
80996
81062
  return () => {
80997
81063
  process.off("SIGINT", runInterruptLadder);
@@ -81001,10 +81067,10 @@ function useInterruptLadder({
81001
81067
  }
81002
81068
 
81003
81069
  // src/hooks/use-kanban-board-focus.ts
81004
- var import_react127 = __toESM(require_react(), 1);
81070
+ var import_react129 = __toESM(require_react(), 1);
81005
81071
  function useKanbanBoardFocus() {
81006
- const [focusedBoardId, setFocusedBoardId] = (0, import_react127.useState)(null);
81007
- const boardFocusRef = (0, import_react127.useRef)(null);
81072
+ const [focusedBoardId, setFocusedBoardId] = (0, import_react129.useState)(null);
81073
+ const boardFocusRef = (0, import_react129.useRef)(null);
81008
81074
  if (!boardFocusRef.current) {
81009
81075
  boardFocusRef.current = {
81010
81076
  current: (boardId) => {
@@ -81017,17 +81083,17 @@ function useKanbanBoardFocus() {
81017
81083
  }
81018
81084
 
81019
81085
  // src/hooks/use-mailbox-view-model.ts
81020
- var import_react128 = __toESM(require_react(), 1);
81086
+ var import_react130 = __toESM(require_react(), 1);
81021
81087
  function useMailboxViewModel(events) {
81022
- const [mailboxStatus, setMailboxStatus] = (0, import_react128.useState)({
81088
+ const [mailboxStatus, setMailboxStatus] = (0, import_react130.useState)({
81023
81089
  unread: 0,
81024
81090
  onlineAgents: 0,
81025
81091
  onlineClients: { tui: 0, webui: 0, repl: 0 }
81026
81092
  });
81027
- const [mailboxPanelOpen, setMailboxPanelOpen] = (0, import_react128.useState)(false);
81028
- const [mailboxMessages, setMailboxMessages] = (0, import_react128.useState)([]);
81029
- const [mailboxAgents, setMailboxAgents] = (0, import_react128.useState)([]);
81030
- (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)(() => {
81031
81097
  const AGENT_ONLINE_TTL_MS = 12e4;
81032
81098
  const lastSeen = /* @__PURE__ */ new Map();
81033
81099
  const unsubUnread = events.onPattern("mailbox.unread_count", (_event, payload) => {
@@ -81089,7 +81155,7 @@ function useMailboxViewModel(events) {
81089
81155
  unsubSnapshot();
81090
81156
  };
81091
81157
  }, [events]);
81092
- (0, import_react128.useEffect)(() => {
81158
+ (0, import_react130.useEffect)(() => {
81093
81159
  const unsubMessage = events.onPattern("mailbox.received", (_event, payload) => {
81094
81160
  const data = payload;
81095
81161
  if (!data?.messageId) return;
@@ -81190,12 +81256,12 @@ function useMailboxViewModel(events) {
81190
81256
  }
81191
81257
 
81192
81258
  // src/hooks/use-mode-picker.ts
81193
- var import_react129 = __toESM(require_react(), 1);
81259
+ var import_react131 = __toESM(require_react(), 1);
81194
81260
  function buildModePickerOptions(result) {
81195
81261
  return toModeOptions(result.modes, result.activeId);
81196
81262
  }
81197
81263
  function useModePicker({ dispatch, getModes }) {
81198
- const openModePicker = (0, import_react129.useCallback)(async () => {
81264
+ const openModePicker = (0, import_react131.useCallback)(async () => {
81199
81265
  if (!getModes) return;
81200
81266
  const result = await getModes();
81201
81267
  const options = buildModePickerOptions(result);
@@ -81205,11 +81271,11 @@ function useModePicker({ dispatch, getModes }) {
81205
81271
  }
81206
81272
 
81207
81273
  // src/hooks/use-model-pick.ts
81208
- var import_react130 = __toESM(require_react(), 1);
81274
+ var import_react132 = __toESM(require_react(), 1);
81209
81275
  function useModelPickRequest(opts) {
81210
81276
  const { dispatch, getPickableProviders, pickerOpen } = opts;
81211
- const resolverRef = import_react130.default.useRef(null);
81212
- const requestModelPick = import_react130.default.useCallback(
81277
+ const resolverRef = import_react132.default.useRef(null);
81278
+ const requestModelPick = import_react132.default.useCallback(
81213
81279
  async (title) => {
81214
81280
  if (!getPickableProviders) return null;
81215
81281
  resolverRef.current?.(null);
@@ -81221,12 +81287,12 @@ function useModelPickRequest(opts) {
81221
81287
  },
81222
81288
  [dispatch, getPickableProviders]
81223
81289
  );
81224
- const handleModelPicked = import_react130.default.useCallback((providerId, modelId) => {
81290
+ const handleModelPicked = import_react132.default.useCallback((providerId, modelId) => {
81225
81291
  const resolve = resolverRef.current;
81226
81292
  resolverRef.current = null;
81227
81293
  resolve?.({ providerId, model: modelId });
81228
81294
  }, []);
81229
- import_react130.default.useEffect(() => {
81295
+ import_react132.default.useEffect(() => {
81230
81296
  if (!pickerOpen && resolverRef.current) {
81231
81297
  const resolve = resolverRef.current;
81232
81298
  resolverRef.current = null;
@@ -81237,7 +81303,7 @@ function useModelPickRequest(opts) {
81237
81303
  }
81238
81304
 
81239
81305
  // src/hooks/use-next-steps-auto-submit.ts
81240
- var import_react131 = __toESM(require_react(), 1);
81306
+ var import_react133 = __toESM(require_react(), 1);
81241
81307
  import { resolveContinuation as resolveContinuation2 } from "@wrongstack/core/agent";
81242
81308
  import {
81243
81309
  createAutoProceedLoopGuard,
@@ -81291,30 +81357,30 @@ function useNextStepsAutoSubmit({
81291
81357
  clearDraft,
81292
81358
  runBlocksRef
81293
81359
  }) {
81294
- const [nextStepsAutoSubmitCountdown, setNextStepsAutoSubmitCountdown] = (0, import_react131.useState)(
81360
+ const [nextStepsAutoSubmitCountdown, setNextStepsAutoSubmitCountdown] = (0, import_react133.useState)(
81295
81361
  null
81296
81362
  );
81297
- const [nextStepsAutoSubmitLabel, setNextStepsAutoSubmitLabel] = (0, import_react131.useState)(null);
81298
- const [nextStepsAutoSubmitDeadlineMs, setNextStepsAutoSubmitDeadlineMs] = (0, import_react131.useState)(
81363
+ const [nextStepsAutoSubmitLabel, setNextStepsAutoSubmitLabel] = (0, import_react133.useState)(null);
81364
+ const [nextStepsAutoSubmitDeadlineMs, setNextStepsAutoSubmitDeadlineMs] = (0, import_react133.useState)(
81299
81365
  null
81300
81366
  );
81301
- const nextStepsAutoSubmitSuggestionRef = (0, import_react131.useRef)(null);
81302
- const nextStepsAutoSubmitSourceRef = (0, import_react131.useRef)(null);
81303
- const nextStepsAutoSubmitTodoIdRef = (0, import_react131.useRef)(null);
81304
- const nextStepsAutoSubmitTodosRef = (0, import_react131.useRef)([]);
81305
- const nextStepsAutoSubmitTimerRef = (0, import_react131.useRef)(void 0);
81306
- const autoSubmitStreakRef = (0, import_react131.useRef)(0);
81307
- const autoSubmitCapWarnedRef = (0, import_react131.useRef)(false);
81308
- const autoSubmitLoopGuardRef = (0, import_react131.useRef)(createAutoProceedLoopGuard());
81309
- const continuationAttemptTrackerRef = (0, import_react131.useRef)(createContinuationAttemptTracker());
81310
- const [nextStepsRecheck, setNextStepsRecheck] = (0, import_react131.useState)(0);
81311
- (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)(() => {
81312
81378
  autoSubmitStreakRef.current = 0;
81313
81379
  autoSubmitCapWarnedRef.current = false;
81314
81380
  autoSubmitLoopGuardRef.current.reset();
81315
81381
  continuationAttemptTrackerRef.current.reset();
81316
81382
  }, [autonomyLive]);
81317
- (0, import_react131.useEffect)(() => {
81383
+ (0, import_react133.useEffect)(() => {
81318
81384
  const liveAutonomy = getAutonomy?.() ?? autonomyLive;
81319
81385
  if (state.status !== "idle" || liveAutonomy !== "auto" || state.bugHuntRunning != null) {
81320
81386
  clearInterval(nextStepsAutoSubmitTimerRef.current);
@@ -81566,7 +81632,7 @@ ${GROUNDED_NO_PROGRESS_STEER}` : suggestion;
81566
81632
  autonomyNextPrompt,
81567
81633
  dispatch
81568
81634
  ]);
81569
- const cancelNextStepsCountdown = (0, import_react131.useCallback)(() => {
81635
+ const cancelNextStepsCountdown = (0, import_react133.useCallback)(() => {
81570
81636
  if (nextStepsAutoSubmitTimerRef.current == null) return;
81571
81637
  clearInterval(nextStepsAutoSubmitTimerRef.current);
81572
81638
  nextStepsAutoSubmitTimerRef.current = void 0;
@@ -81593,7 +81659,7 @@ ${GROUNDED_NO_PROGRESS_STEER}` : suggestion;
81593
81659
  }
81594
81660
 
81595
81661
  // src/hooks/use-panel-controllers.ts
81596
- var import_react132 = __toESM(require_react(), 1);
81662
+ var import_react134 = __toESM(require_react(), 1);
81597
81663
  import { toErrorMessage as toErrorMessage9 } from "@wrongstack/core/utils";
81598
81664
 
81599
81665
  // src/on-panel-open.ts
@@ -81710,20 +81776,20 @@ function usePanelControllers({
81710
81776
  getActiveModelReasoningEffortLevels
81711
81777
  }) {
81712
81778
  const authPanelController = { openAuthPanel };
81713
- const openModelPicker = import_react132.default.useCallback(async () => {
81779
+ const openModelPicker = import_react134.default.useCallback(async () => {
81714
81780
  if (!getPickableProviders) return;
81715
81781
  const providers = await getPickableProviders();
81716
81782
  dispatch({ type: "modelPickerOpen", providers });
81717
81783
  }, [getPickableProviders]);
81718
- const openProjectPicker = import_react132.default.useCallback(async () => {
81784
+ const openProjectPicker = import_react134.default.useCallback(async () => {
81719
81785
  if (!getProjectPickerItems) return;
81720
81786
  const items = await getProjectPickerItems();
81721
81787
  dispatch({ type: "projectPickerOpen", items });
81722
81788
  }, [getProjectPickerItems]);
81723
- const openFKeyPicker = import_react132.default.useCallback(() => {
81789
+ const openFKeyPicker = import_react134.default.useCallback(() => {
81724
81790
  dispatch({ type: "fKeyPickerOpen" });
81725
81791
  }, [dispatch]);
81726
- const loadLiveSessions = import_react132.default.useCallback(async () => {
81792
+ const loadLiveSessions = import_react134.default.useCallback(async () => {
81727
81793
  if (!getLiveSessions) {
81728
81794
  dispatch({ type: "sessionsPanelSet", sessions: [] });
81729
81795
  return;
@@ -81736,7 +81802,7 @@ function usePanelControllers({
81736
81802
  dispatch({ type: "sessionsPanelBusy", on: false });
81737
81803
  }
81738
81804
  }, [getLiveSessions]);
81739
- (0, import_react132.useEffect)(() => {
81805
+ (0, import_react134.useEffect)(() => {
81740
81806
  if (!onPanelOpen) return;
81741
81807
  const dispatcher = createPanelOpenDispatcher({
81742
81808
  dispatch,
@@ -81765,14 +81831,14 @@ function usePanelControllers({
81765
81831
  openSubagentModelsPanel,
81766
81832
  openHelpPanel
81767
81833
  ]);
81768
- (0, import_react132.useEffect)(() => {
81834
+ (0, import_react134.useEffect)(() => {
81769
81835
  if (!state.sessionsPanelOpen || !getLiveSessions) return void 0;
81770
81836
  const t = setInterval(() => {
81771
81837
  void loadLiveSessions();
81772
81838
  }, 5e3);
81773
81839
  return () => clearInterval(t);
81774
81840
  }, [state.sessionsPanelOpen, getLiveSessions, loadLiveSessions]);
81775
- const openSettings = import_react132.default.useCallback(() => {
81841
+ const openSettings = import_react134.default.useCallback(() => {
81776
81842
  if (!getSettings) return;
81777
81843
  const s2 = getSettings();
81778
81844
  dispatch({
@@ -81848,15 +81914,15 @@ function usePanelControllers({
81848
81914
  wrongProxyUrl: s2.wrongProxyUrl ?? "http://localhost:3444"
81849
81915
  });
81850
81916
  }, [getSettings, getActiveModelReasoningEffortLevels]);
81851
- const refreshPluginPicker = import_react132.default.useCallback(() => {
81917
+ const refreshPluginPicker = import_react134.default.useCallback(() => {
81852
81918
  if (!getPluginItems) return;
81853
81919
  dispatch({ type: "pluginPickerSetItems", items: getPluginItems() });
81854
81920
  }, [getPluginItems]);
81855
- (0, import_react132.useEffect)(() => {
81921
+ (0, import_react134.useEffect)(() => {
81856
81922
  if (!state.pluginPicker.open) return;
81857
81923
  refreshPluginPicker();
81858
81924
  }, [state.pluginPicker.open, refreshPluginPicker]);
81859
- const toggleSelectedPlugin = import_react132.default.useCallback(async () => {
81925
+ const toggleSelectedPlugin = import_react134.default.useCallback(async () => {
81860
81926
  if (!onPluginToggle) return;
81861
81927
  const selected = stateRef.current.pluginPicker.items[stateRef.current.pluginPicker.selected];
81862
81928
  if (!selected) return;
@@ -81880,15 +81946,15 @@ function usePanelControllers({
81880
81946
  });
81881
81947
  }
81882
81948
  }, [onPluginToggle]);
81883
- const refreshMcpPicker = import_react132.default.useCallback(() => {
81949
+ const refreshMcpPicker = import_react134.default.useCallback(() => {
81884
81950
  if (!getMcpServers) return;
81885
81951
  dispatch({ type: "mcpPickerSetItems", items: getMcpServers() });
81886
81952
  }, [getMcpServers]);
81887
- (0, import_react132.useEffect)(() => {
81953
+ (0, import_react134.useEffect)(() => {
81888
81954
  if (!state.mcpPicker.open) return;
81889
81955
  refreshMcpPicker();
81890
81956
  }, [state.mcpPicker.open, refreshMcpPicker]);
81891
- const toggleSelectedMcpServer = import_react132.default.useCallback(async () => {
81957
+ const toggleSelectedMcpServer = import_react134.default.useCallback(async () => {
81892
81958
  if (!onMcpToggle) return;
81893
81959
  const selected = stateRef.current.mcpPicker.items[stateRef.current.mcpPicker.selected];
81894
81960
  if (!selected) return;
@@ -81905,7 +81971,7 @@ function usePanelControllers({
81905
81971
  });
81906
81972
  }
81907
81973
  }, [onMcpToggle]);
81908
- const restartSelectedMcpServer = import_react132.default.useCallback(async () => {
81974
+ const restartSelectedMcpServer = import_react134.default.useCallback(async () => {
81909
81975
  if (!onMcpRestart) return;
81910
81976
  const selected = stateRef.current.mcpPicker.items[stateRef.current.mcpPicker.selected];
81911
81977
  if (!selected) return;
@@ -81922,17 +81988,17 @@ function usePanelControllers({
81922
81988
  });
81923
81989
  }
81924
81990
  }, [onMcpRestart]);
81925
- const refreshToolsPicker = import_react132.default.useCallback(() => {
81991
+ const refreshToolsPicker = import_react134.default.useCallback(() => {
81926
81992
  if (!getToolsItems) return;
81927
81993
  const items = getToolsItems();
81928
81994
  dispatch({ type: "toolsPickerSetItems", items });
81929
81995
  setLiveToolCount(items.filter((item) => item.enabled).length);
81930
81996
  }, [getToolsItems]);
81931
- (0, import_react132.useEffect)(() => {
81997
+ (0, import_react134.useEffect)(() => {
81932
81998
  if (!state.toolsPicker.open) return;
81933
81999
  refreshToolsPicker();
81934
82000
  }, [state.toolsPicker.open, refreshToolsPicker]);
81935
- const toggleSelectedTool = import_react132.default.useCallback(async () => {
82001
+ const toggleSelectedTool = import_react134.default.useCallback(async () => {
81936
82002
  if (!onToolToggle) return;
81937
82003
  const selected = stateRef.current.toolsPicker.items[stateRef.current.toolsPicker.selected];
81938
82004
  if (!selected) return;
@@ -81964,7 +82030,7 @@ function usePanelControllers({
81964
82030
  }
81965
82031
 
81966
82032
  // src/hooks/use-paste-handling.ts
81967
- var import_react133 = __toESM(require_react(), 1);
82033
+ var import_react135 = __toESM(require_react(), 1);
81968
82034
  import { toErrorMessage as toErrorMessage10 } from "@wrongstack/core/utils";
81969
82035
  function usePasteHandling({
81970
82036
  builderRef,
@@ -81973,8 +82039,8 @@ function usePasteHandling({
81973
82039
  setDraft,
81974
82040
  tokenPreviewsRef
81975
82041
  }) {
81976
- const pasteAccumRef = (0, import_react133.useRef)(null);
81977
- const pasteFlushTimerRef = (0, import_react133.useRef)(null);
82042
+ const pasteAccumRef = (0, import_react135.useRef)(null);
82043
+ const pasteFlushTimerRef = (0, import_react135.useRef)(null);
81978
82044
  const commitPaste = async (full) => {
81979
82045
  const builder = builderRef.current;
81980
82046
  if (!builder || !full) return;
@@ -82064,7 +82130,7 @@ function usePasteHandling({
82064
82130
  }
82065
82131
 
82066
82132
  // src/hooks/use-prompt-picker.ts
82067
- var import_react134 = __toESM(require_react(), 1);
82133
+ var import_react136 = __toESM(require_react(), 1);
82068
82134
  import { createRequire } from "node:module";
82069
82135
  import * as path10 from "node:path";
82070
82136
  import { DefaultPromptLoader } from "@wrongstack/core/execution";
@@ -82090,9 +82156,9 @@ function buildPromptPickerPayload(all, recentSlugs) {
82090
82156
  return { all: entries, categories, recentSlugs };
82091
82157
  }
82092
82158
  function usePromptPicker({ projectRoot, dispatch }) {
82093
- const promptLoaderRef = (0, import_react134.useRef)(null);
82094
- const promptUsageRef = (0, import_react134.useRef)(null);
82095
- 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)(() => {
82096
82162
  if (!promptLoaderRef.current && projectRoot) {
82097
82163
  let bundledDir;
82098
82164
  try {
@@ -82111,7 +82177,7 @@ function usePromptPicker({ projectRoot, dispatch }) {
82111
82177
  }
82112
82178
  return promptLoaderRef.current;
82113
82179
  }, [projectRoot]);
82114
- const openPromptPicker = (0, import_react134.useCallback)(async () => {
82180
+ const openPromptPicker = (0, import_react136.useCallback)(async () => {
82115
82181
  const loader = getPromptLoader();
82116
82182
  if (!loader) return;
82117
82183
  loader.invalidateCache();
@@ -82120,7 +82186,7 @@ function usePromptPicker({ projectRoot, dispatch }) {
82120
82186
  const payload = buildPromptPickerPayload(all, recentSlugs);
82121
82187
  dispatch({ type: "promptPickerOpen", ...payload });
82122
82188
  }, [dispatch, getPromptLoader]);
82123
- const setPromptFavorite = (0, import_react134.useCallback)(
82189
+ const setPromptFavorite = (0, import_react136.useCallback)(
82124
82190
  async (slug, favorite) => {
82125
82191
  const loader = getPromptLoader();
82126
82192
  if (!loader) return;
@@ -82133,7 +82199,7 @@ function usePromptPicker({ projectRoot, dispatch }) {
82133
82199
  }
82134
82200
 
82135
82201
  // src/hooks/use-provider-event-bridge.ts
82136
- var import_react135 = __toESM(require_react(), 1);
82202
+ var import_react137 = __toESM(require_react(), 1);
82137
82203
  import { tuiStreamFlushMs } from "@wrongstack/core/utils";
82138
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";
82139
82205
  import { isFinalTurnStopReason as isFinalTurnStopReason2 } from "@wrongstack/tools/next-steps";
@@ -82293,7 +82359,7 @@ function useProviderEventBridge({
82293
82359
  assistantCommittedThisRunRef,
82294
82360
  setMemoryContextMonitor
82295
82361
  }) {
82296
- (0, import_react135.useEffect)(() => {
82362
+ (0, import_react137.useEffect)(() => {
82297
82363
  const FLUSH_MS2 = tuiStreamFlushMs();
82298
82364
  let pendingToolStream = null;
82299
82365
  const pendingSageStats = /* @__PURE__ */ new Map();
@@ -82743,7 +82809,7 @@ function useProviderEventBridge({
82743
82809
  }
82744
82810
 
82745
82811
  // src/hooks/use-queue-manager.ts
82746
- var import_react136 = __toESM(require_react(), 1);
82812
+ var import_react138 = __toESM(require_react(), 1);
82747
82813
 
82748
82814
  // src/queue-slash.ts
82749
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";
@@ -82850,9 +82916,9 @@ function useQueueManager({
82850
82916
  saveSettings,
82851
82917
  midRunSendPickerRef
82852
82918
  }) {
82853
- const persistState = (0, import_react136.useRef)({ running: false, pending: null });
82854
- const hydrated = (0, import_react136.useRef)(!queueStore);
82855
- 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);
82856
82922
  const writeQueue = (store) => {
82857
82923
  const raw = stateRef.current.queue.map(
82858
82924
  ({
@@ -82883,7 +82949,7 @@ function useQueueManager({
82883
82949
  }
82884
82950
  })();
82885
82951
  };
82886
- (0, import_react136.useEffect)(() => {
82952
+ (0, import_react138.useEffect)(() => {
82887
82953
  if (!queueStore) return;
82888
82954
  let cancelled = false;
82889
82955
  queueStore.read().then((items) => {
@@ -82918,7 +82984,7 @@ function useQueueManager({
82918
82984
  cancelled = true;
82919
82985
  };
82920
82986
  }, [queueStore]);
82921
- (0, import_react136.useEffect)(() => {
82987
+ (0, import_react138.useEffect)(() => {
82922
82988
  if (!queueStore) return;
82923
82989
  if (!hydrated.current) {
82924
82990
  pendingBeforeHydration.current = true;
@@ -82926,10 +82992,10 @@ function useQueueManager({
82926
82992
  }
82927
82993
  writeQueue(queueStore);
82928
82994
  }, [stateRef.current.queue, queueStore, stateRef]);
82929
- (0, import_react136.useEffect)(() => {
82995
+ (0, import_react138.useEffect)(() => {
82930
82996
  onQueueChange?.(stateRef.current.queue.map((q) => q.displayText));
82931
82997
  }, [stateRef.current.queue, onQueueChange, stateRef]);
82932
- (0, import_react136.useEffect)(() => {
82998
+ (0, import_react138.useEffect)(() => {
82933
82999
  const cmd = createQueueSlashCommand({
82934
83000
  getQueue: () => stateRef.current.queue,
82935
83001
  clear: () => dispatch({ type: "queueClear" }),
@@ -82952,7 +83018,7 @@ function useQueueManager({
82952
83018
  }
82953
83019
 
82954
83020
  // src/hooks/use-session-interrupt-controller.ts
82955
- var import_react137 = __toESM(require_react(), 1);
83021
+ var import_react139 = __toESM(require_react(), 1);
82956
83022
  function useSessionInterruptController({
82957
83023
  interruptController,
82958
83024
  dispatch,
@@ -82974,7 +83040,7 @@ function useSessionInterruptController({
82974
83040
  getSddRun,
82975
83041
  switchAutonomy
82976
83042
  }) {
82977
- (0, import_react137.useEffect)(() => {
83043
+ (0, import_react139.useEffect)(() => {
82978
83044
  if (!interruptController) return;
82979
83045
  let pendingClearResolve = null;
82980
83046
  let pendingSlashResolve = null;
@@ -83102,7 +83168,7 @@ function useSessionInterruptController({
83102
83168
  }
83103
83169
 
83104
83170
  // src/hooks/use-session-rewind.ts
83105
- var import_react138 = __toESM(require_react(), 1);
83171
+ var import_react140 = __toESM(require_react(), 1);
83106
83172
  import { applyRewindToConversation, DefaultSessionRewinder } from "@wrongstack/core/storage";
83107
83173
  function useSessionRewind({
83108
83174
  agent,
@@ -83111,7 +83177,7 @@ function useSessionRewind({
83111
83177
  liveDirector,
83112
83178
  sessionGenerationRef
83113
83179
  }) {
83114
- const handleRewindTo = (0, import_react138.useCallback)(
83180
+ const handleRewindTo = (0, import_react140.useCallback)(
83115
83181
  async (checkpointIndex) => {
83116
83182
  const sessionId = agent.ctx.session.id;
83117
83183
  if (!sessionId) return;
@@ -83162,15 +83228,15 @@ function useSessionRewind({
83162
83228
  }
83163
83229
 
83164
83230
  // src/hooks/use-shadow-panel.ts
83165
- var import_react139 = __toESM(require_react(), 1);
83231
+ var import_react141 = __toESM(require_react(), 1);
83166
83232
  import { toErrorMessage as toErrorMessage11 } from "@wrongstack/core/utils";
83167
83233
  function useShadowPanel(dispatch, host) {
83168
83234
  const { getShadowData, onShadowStart, onShadowStop } = host;
83169
- const openShadowPanel = (0, import_react139.useCallback)(() => {
83235
+ const openShadowPanel = (0, import_react141.useCallback)(() => {
83170
83236
  if (!getShadowData) return;
83171
83237
  dispatch({ type: "shadowOpen", shadow: getShadowData() });
83172
83238
  }, [dispatch, getShadowData]);
83173
- const handleShadowStart = (0, import_react139.useCallback)(async () => {
83239
+ const handleShadowStart = (0, import_react141.useCallback)(async () => {
83174
83240
  if (!onShadowStart) return;
83175
83241
  dispatch({ type: "shadowHint", text: "Starting Shadow Agent\u2026" });
83176
83242
  try {
@@ -83184,7 +83250,7 @@ function useShadowPanel(dispatch, host) {
83184
83250
  dispatch({ type: "shadowHint", text: `Failed to start: ${toErrorMessage11(error)}` });
83185
83251
  }
83186
83252
  }, [dispatch, getShadowData, onShadowStart]);
83187
- const handleShadowStop = (0, import_react139.useCallback)(async () => {
83253
+ const handleShadowStop = (0, import_react141.useCallback)(async () => {
83188
83254
  if (!onShadowStop) return;
83189
83255
  dispatch({ type: "shadowHint", text: "Stopping Shadow Agent\u2026" });
83190
83256
  try {
@@ -83202,14 +83268,14 @@ function useShadowPanel(dispatch, host) {
83202
83268
  }
83203
83269
 
83204
83270
  // src/hooks/use-slash-picker.ts
83205
- var import_react140 = __toESM(require_react(), 1);
83271
+ var import_react142 = __toESM(require_react(), 1);
83206
83272
  function useSlashPicker({
83207
83273
  state,
83208
83274
  slashRegistry,
83209
83275
  dispatch,
83210
83276
  setDraft
83211
83277
  }) {
83212
- (0, import_react140.useEffect)(() => {
83278
+ (0, import_react142.useEffect)(() => {
83213
83279
  if (state.bashMode) {
83214
83280
  if (state.slashPicker.open) dispatch({ type: "slashPickerClose" });
83215
83281
  return;
@@ -83225,7 +83291,7 @@ function useSlashPicker({
83225
83291
  dispatch({ type: "slashPickerOpen", query, matches });
83226
83292
  }
83227
83293
  }, [state.buffer, state.bashMode, state.slashPicker.open, state.slashPicker.query, slashRegistry, dispatch]);
83228
- return (0, import_react140.useCallback)(() => {
83294
+ return (0, import_react142.useCallback)(() => {
83229
83295
  const { open: open2, matches, selected } = state.slashPicker;
83230
83296
  if (!open2 || matches.length === 0) return;
83231
83297
  const picked = matches[selected];
@@ -83237,7 +83303,7 @@ function useSlashPicker({
83237
83303
  }
83238
83304
 
83239
83305
  // src/hooks/use-statusbar-view-model.ts
83240
- var import_react141 = __toESM(require_react(), 1);
83306
+ var import_react143 = __toESM(require_react(), 1);
83241
83307
  import * as fs7 from "node:fs/promises";
83242
83308
  import { getContextBreakdown } from "@wrongstack/core/utils";
83243
83309
 
@@ -83291,7 +83357,7 @@ function useStatusbarViewModel({
83291
83357
  const conversationRevision = agent.ctx.state?.revision ?? 0;
83292
83358
  const messageCount = agent.ctx.messages?.length ?? 0;
83293
83359
  const toolDefCount = agent.ctx.tools?.length ?? 0;
83294
- const contextBreakdown = (0, import_react141.useMemo)(() => {
83360
+ const contextBreakdown = (0, import_react143.useMemo)(() => {
83295
83361
  if (!needBreakdown) return void 0;
83296
83362
  try {
83297
83363
  return getContextBreakdown(agent.ctx);
@@ -83312,12 +83378,12 @@ function useStatusbarViewModel({
83312
83378
  localEstimate: contextBreakdown?.total,
83313
83379
  maxContext
83314
83380
  }).used : cheapFill.used;
83315
- const contextWindow = (0, import_react141.useMemo)(() => {
83381
+ const contextWindow = (0, import_react143.useMemo)(() => {
83316
83382
  void state.contextChipVersion;
83317
83383
  if (resuming) return void 0;
83318
83384
  return maxContext > 0 ? { used: currentContextTokens, max: maxContext } : void 0;
83319
83385
  }, [currentContextTokens, maxContext, resuming, state.contextChipVersion]);
83320
- const todos = (0, import_react141.useMemo)(() => {
83386
+ const todos = (0, import_react143.useMemo)(() => {
83321
83387
  const counts = { pending: 0, inProgress: 0, completed: 0 };
83322
83388
  for (const todo of liveTodos) {
83323
83389
  if (todo.status === "pending") counts.pending++;
@@ -83326,7 +83392,7 @@ function useStatusbarViewModel({
83326
83392
  }
83327
83393
  return counts;
83328
83394
  }, [liveTodos]);
83329
- const fleetCounts = (0, import_react141.useMemo)(() => {
83395
+ const fleetCounts = (0, import_react143.useMemo)(() => {
83330
83396
  const entries = Object.values(state.fleet);
83331
83397
  if (entries.length === 0) return void 0;
83332
83398
  const counts = { running: 0, idle: 0, pending: 0, completed: 0 };
@@ -83338,11 +83404,11 @@ function useStatusbarViewModel({
83338
83404
  return counts.running > 0 ? counts : void 0;
83339
83405
  }, [state.fleet]);
83340
83406
  const visibleSubagentCount = fleetCounts?.running ?? 0;
83341
- const hasVisibleFleetPanel = (0, import_react141.useMemo)(
83407
+ const hasVisibleFleetPanel = (0, import_react143.useMemo)(
83342
83408
  () => Object.values(state.fleet).some((entry2) => entry2.status === "running"),
83343
83409
  [state.fleet]
83344
83410
  );
83345
- const entriesWithLeader = (0, import_react141.useMemo)(() => {
83411
+ const entriesWithLeader = (0, import_react143.useMemo)(() => {
83346
83412
  const leaderEntry = {
83347
83413
  id: "leader",
83348
83414
  name: "LEADER",
@@ -83375,8 +83441,8 @@ function useStatusbarViewModel({
83375
83441
  const planHidden = hiddenItems.includes("plan");
83376
83442
  const taskHidden = hiddenItems.includes("tasks");
83377
83443
  const planPath = agent.ctx.meta["plan.path"];
83378
- const [planCounts, setPlanCounts] = (0, import_react141.useState)(null);
83379
- (0, import_react141.useEffect)(() => {
83444
+ const [planCounts, setPlanCounts] = (0, import_react143.useState)(null);
83445
+ (0, import_react143.useEffect)(() => {
83380
83446
  if (planHidden) return;
83381
83447
  if (typeof planPath !== "string" || !planPath) {
83382
83448
  setPlanCounts(null);
@@ -83386,8 +83452,8 @@ function useStatusbarViewModel({
83386
83452
  let lastFingerprint = "";
83387
83453
  const poll = async () => {
83388
83454
  try {
83389
- const stat4 = await fs7.stat(planPath);
83390
- const fingerprint = `${stat4.mtimeMs}:${stat4.size}`;
83455
+ const stat5 = await fs7.stat(planPath);
83456
+ const fingerprint = `${stat5.mtimeMs}:${stat5.size}`;
83391
83457
  if (fingerprint === lastFingerprint) return;
83392
83458
  const data = await fs7.readFile(planPath, "utf8");
83393
83459
  const parsed = JSON.parse(data);
@@ -83422,8 +83488,8 @@ function useStatusbarViewModel({
83422
83488
  };
83423
83489
  }, [planPath, planHidden]);
83424
83490
  const taskPath = agent.ctx.meta["task.path"];
83425
- const [taskCounts, setTaskCounts] = (0, import_react141.useState)(null);
83426
- (0, import_react141.useEffect)(() => {
83491
+ const [taskCounts, setTaskCounts] = (0, import_react143.useState)(null);
83492
+ (0, import_react143.useEffect)(() => {
83427
83493
  if (taskHidden) return;
83428
83494
  if (typeof taskPath !== "string" || !taskPath) {
83429
83495
  setTaskCounts(null);
@@ -83433,8 +83499,8 @@ function useStatusbarViewModel({
83433
83499
  let lastFingerprint = "";
83434
83500
  const poll = async () => {
83435
83501
  try {
83436
- const stat4 = await fs7.stat(taskPath);
83437
- const fingerprint = `${stat4.mtimeMs}:${stat4.size}`;
83502
+ const stat5 = await fs7.stat(taskPath);
83503
+ const fingerprint = `${stat5.mtimeMs}:${stat5.size}`;
83438
83504
  if (fingerprint === lastFingerprint) return;
83439
83505
  const data = await fs7.readFile(taskPath, "utf8");
83440
83506
  const parsed = JSON.parse(data);
@@ -83498,10 +83564,10 @@ function useStatusbarViewModel({
83498
83564
  }
83499
83565
 
83500
83566
  // src/hooks/use-subagent-models-panel.ts
83501
- var import_react142 = __toESM(require_react(), 1);
83567
+ var import_react144 = __toESM(require_react(), 1);
83502
83568
  function useSubagentModelsPanel(opts) {
83503
83569
  const { dispatch, subagentModelsHost, requestModelPick } = opts;
83504
- const refresh = import_react142.default.useCallback(
83570
+ const refresh = import_react144.default.useCallback(
83505
83571
  (hint) => {
83506
83572
  if (!subagentModelsHost) return;
83507
83573
  const snap = subagentModelsHost.snapshot();
@@ -83518,7 +83584,7 @@ function useSubagentModelsPanel(opts) {
83518
83584
  },
83519
83585
  [dispatch, subagentModelsHost]
83520
83586
  );
83521
- const openSubagentModelsPanel = import_react142.default.useCallback(() => {
83587
+ const openSubagentModelsPanel = import_react144.default.useCallback(() => {
83522
83588
  if (!subagentModelsHost) return;
83523
83589
  const snap = subagentModelsHost.snapshot();
83524
83590
  dispatch({
@@ -83531,7 +83597,7 @@ function useSubagentModelsPanel(opts) {
83531
83597
  sessionTarget: snap.sessionTarget
83532
83598
  });
83533
83599
  }, [dispatch, subagentModelsHost]);
83534
- const apply = import_react142.default.useCallback(
83600
+ const apply = import_react144.default.useCallback(
83535
83601
  (run, okHint) => {
83536
83602
  void run().then((err) => refresh(err ?? okHint)).catch((e) => {
83537
83603
  dispatch({
@@ -83542,7 +83608,7 @@ function useSubagentModelsPanel(opts) {
83542
83608
  },
83543
83609
  [dispatch, refresh]
83544
83610
  );
83545
- const onSubagentLaneEdit = import_react142.default.useCallback(
83611
+ const onSubagentLaneEdit = import_react144.default.useCallback(
83546
83612
  (index) => {
83547
83613
  if (!subagentModelsHost || !requestModelPick) return;
83548
83614
  void requestModelPick(`Lane ${index + 1} model (Esc = keep)`).then((sel) => {
@@ -83560,14 +83626,14 @@ function useSubagentModelsPanel(opts) {
83560
83626
  },
83561
83627
  [apply, dispatch, requestModelPick, subagentModelsHost]
83562
83628
  );
83563
- const onSubagentLaneClear = import_react142.default.useCallback(
83629
+ const onSubagentLaneClear = import_react144.default.useCallback(
83564
83630
  (index) => {
83565
83631
  if (!subagentModelsHost) return;
83566
83632
  apply(() => subagentModelsHost.clearLane(index), `Lane ${index + 1} cleared`);
83567
83633
  },
83568
83634
  [apply, subagentModelsHost]
83569
83635
  );
83570
- const onSubagentPlanToggle = import_react142.default.useCallback(
83636
+ const onSubagentPlanToggle = import_react144.default.useCallback(
83571
83637
  (field) => {
83572
83638
  if (!subagentModelsHost) return;
83573
83639
  apply(() => subagentModelsHost.toggle(field), `${field} toggled`);
@@ -83583,14 +83649,14 @@ function useSubagentModelsPanel(opts) {
83583
83649
  }
83584
83650
 
83585
83651
  // src/hooks/use-theme-picker-handler.ts
83586
- var import_react143 = __toESM(require_react(), 1);
83652
+ var import_react145 = __toESM(require_react(), 1);
83587
83653
  function useThemePickerHandler({
83588
83654
  configStore,
83589
83655
  saveThemePreset,
83590
83656
  dispatch,
83591
83657
  selectedIndex
83592
83658
  }) {
83593
- const onThemePickerEnter = (0, import_react143.useCallback)(() => {
83659
+ const onThemePickerEnter = (0, import_react145.useCallback)(() => {
83594
83660
  const preset = THEME_OPTIONS[Math.max(0, selectedIndex)];
83595
83661
  const presetName = preset?.id;
83596
83662
  if (!presetName) return;
@@ -83621,7 +83687,7 @@ function useThemePickerHandler({
83621
83687
  }
83622
83688
 
83623
83689
  // src/hooks/use-tui-controllers.ts
83624
- var import_react144 = __toESM(require_react(), 1);
83690
+ var import_react146 = __toESM(require_react(), 1);
83625
83691
  function useTuiControllers({
83626
83692
  dispatch,
83627
83693
  fleetChat,
@@ -83631,7 +83697,7 @@ function useTuiControllers({
83631
83697
  enhanceController,
83632
83698
  agentsMonitorController
83633
83699
  }) {
83634
- (0, import_react144.useEffect)(() => {
83700
+ (0, import_react146.useEffect)(() => {
83635
83701
  if (!fleetStreamController) return;
83636
83702
  fleetStreamController.mode = fleetChat;
83637
83703
  fleetStreamController.setMode = (mode) => {
@@ -83643,12 +83709,12 @@ function useTuiControllers({
83643
83709
  };
83644
83710
  };
83645
83711
  }, [dispatch, fleetStreamController, fleetChat]);
83646
- (0, import_react144.useEffect)(() => {
83712
+ (0, import_react146.useEffect)(() => {
83647
83713
  if (fleetStreamController) {
83648
83714
  fleetStreamController.mode = fleetChat;
83649
83715
  }
83650
83716
  }, [fleetStreamController, fleetChat]);
83651
- (0, import_react144.useEffect)(() => {
83717
+ (0, import_react146.useEffect)(() => {
83652
83718
  if (!enhanceController) return;
83653
83719
  enhanceController.enabled = enhanceEnabled;
83654
83720
  enhanceController.setEnabled = (enabled) => {
@@ -83660,7 +83726,7 @@ function useTuiControllers({
83660
83726
  };
83661
83727
  };
83662
83728
  }, [dispatch, enhanceController, enhanceEnabled]);
83663
- (0, import_react144.useEffect)(() => {
83729
+ (0, import_react146.useEffect)(() => {
83664
83730
  if (!agentsMonitorController) return;
83665
83731
  agentsMonitorController.visible = agentsMonitorOpen;
83666
83732
  agentsMonitorController.setVisible = (visible) => {
@@ -83674,19 +83740,19 @@ function useTuiControllers({
83674
83740
  };
83675
83741
  };
83676
83742
  }, [agentsMonitorController, agentsMonitorOpen, dispatch]);
83677
- (0, import_react144.useEffect)(() => {
83743
+ (0, import_react146.useEffect)(() => {
83678
83744
  if (agentsMonitorController) agentsMonitorController.visible = agentsMonitorOpen;
83679
83745
  }, [agentsMonitorController, agentsMonitorOpen]);
83680
83746
  }
83681
83747
 
83682
83748
  // src/hooks/use-tui-event-bridge.ts
83683
- var import_react147 = __toESM(require_react(), 1);
83749
+ var import_react149 = __toESM(require_react(), 1);
83684
83750
 
83685
83751
  // src/hooks/use-brain-events.ts
83686
- var import_react145 = __toESM(require_react(), 1);
83752
+ var import_react147 = __toESM(require_react(), 1);
83687
83753
  var MONITOR_INTERVENTION_GRACE_MS = 5e3;
83688
83754
  function useBrainEvents(events, dispatch, getSessionId) {
83689
- (0, import_react145.useEffect)(() => {
83755
+ (0, import_react147.useEffect)(() => {
83690
83756
  const isCurrentSession2 = (sessionId) => {
83691
83757
  const current = getSessionId?.();
83692
83758
  return !sessionId || !current || sessionId === current;
@@ -83898,7 +83964,7 @@ function useBrainEvents(events, dispatch, getSessionId) {
83898
83964
  }
83899
83965
 
83900
83966
  // src/hooks/use-subagent-events.ts
83901
- var import_react146 = __toESM(require_react(), 1);
83967
+ var import_react148 = __toESM(require_react(), 1);
83902
83968
  import { expectDefined as expectDefined5 } from "@wrongstack/core/utils";
83903
83969
  var STREAM_COLORS2 = ["cyan", "magenta", "yellow", "green", "blue"];
83904
83970
  function providerContextLimitHistoryEntry(event) {
@@ -83942,19 +84008,19 @@ function labelFor2(labelsRef, id, name) {
83942
84008
  return v;
83943
84009
  }
83944
84010
  function useSubagentEvents(events, dispatch, setActiveMaxContext, getSessionId, getChatMode, sessionGenerationRef) {
83945
- const labelsRef = (0, import_react146.useRef)(/* @__PURE__ */ new Map());
83946
- const ctxDispatchRef = (0, import_react146.useRef)(/* @__PURE__ */ new Map());
83947
- const leaderCtxDispatchRef = (0, import_react146.useRef)(void 0);
83948
- const leaderCtxFlushRef = (0, import_react146.useRef)(void 0);
83949
- const latestLeaderCtxPctRef = (0, import_react146.useRef)(void 0);
83950
- 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());
83951
84017
  const gate = useFleetGenerationGate(sessionGenerationRef);
83952
- const lbl = (0, import_react146.useCallback)(
84018
+ const lbl = (0, import_react148.useCallback)(
83953
84019
  (id, name) => labelFor2(labelsRef, id, name),
83954
84020
  []
83955
84021
  // labelsRef is a stable ref
83956
84022
  );
83957
- (0, import_react146.useEffect)(() => {
84023
+ (0, import_react148.useEffect)(() => {
83958
84024
  const seen = /* @__PURE__ */ new Set();
83959
84025
  const isCurrentSession2 = (sessionId) => {
83960
84026
  const current = getSessionId?.();
@@ -84292,7 +84358,7 @@ function useTuiEventBridge({
84292
84358
  onClearHistory,
84293
84359
  sessionGenerationRef
84294
84360
  }) {
84295
- const getChatMode = (0, import_react147.useCallback)(() => stateRef.current.fleetChat, [stateRef]);
84361
+ const getChatMode = (0, import_react149.useCallback)(() => stateRef.current.fleetChat, [stateRef]);
84296
84362
  useSubagentEvents(
84297
84363
  events,
84298
84364
  dispatch,
@@ -84306,7 +84372,7 @@ function useTuiEventBridge({
84306
84372
  useGoalEvents(subscribeGoal, dispatch, stateRef, getSessionId);
84307
84373
  }
84308
84374
  function useSessionEvents(events, dispatch, onClearHistory, getSessionId) {
84309
- (0, import_react147.useEffect)(() => {
84375
+ (0, import_react149.useEffect)(() => {
84310
84376
  const isCurrentSession2 = (sessionId) => {
84311
84377
  const current = getSessionId?.();
84312
84378
  return !sessionId || !current || sessionId === current;
@@ -84337,7 +84403,7 @@ function useSessionEvents(events, dispatch, onClearHistory, getSessionId) {
84337
84403
  }, [events, dispatch, onClearHistory, getSessionId]);
84338
84404
  }
84339
84405
  function useGoalEvents(subscribeGoal, dispatch, stateRef, getSessionId) {
84340
- (0, import_react147.useEffect)(() => {
84406
+ (0, import_react149.useEffect)(() => {
84341
84407
  if (!subscribeGoal) return;
84342
84408
  const isCurrentSession2 = (sessionId) => {
84343
84409
  const current = getSessionId?.();
@@ -84548,7 +84614,7 @@ function useGoalEvents(subscribeGoal, dispatch, stateRef, getSessionId) {
84548
84614
  }
84549
84615
 
84550
84616
  // src/hooks/use-design-kit-slash-commands.ts
84551
- var import_react148 = __toESM(require_react(), 1);
84617
+ var import_react150 = __toESM(require_react(), 1);
84552
84618
  import {
84553
84619
  applyTokenOverrides,
84554
84620
  clearActiveKit,
@@ -84564,7 +84630,7 @@ import {
84564
84630
  } from "@wrongstack/core/design";
84565
84631
  function useDesignKitSlashCommands(deps) {
84566
84632
  const { slashRegistry, projectRoot, agent, dispatch } = deps;
84567
- (0, import_react148.useEffect)(() => {
84633
+ (0, import_react150.useEffect)(() => {
84568
84634
  const cmd = {
84569
84635
  name: "design",
84570
84636
  description: "Design Studio: /design (picker) | <kit> [stack] | off | foundations | set <k=v> | tune <k=v> | swap <kit> | materialize [stack] [path] | verify.",
@@ -84699,7 +84765,7 @@ ${menu}` };
84699
84765
  }
84700
84766
 
84701
84767
  // src/hooks/use-provider-slash-commands.ts
84702
- var import_react149 = __toESM(require_react(), 1);
84768
+ var import_react151 = __toESM(require_react(), 1);
84703
84769
  function useProviderSlashCommands(deps) {
84704
84770
  const {
84705
84771
  slashRegistry,
@@ -84708,7 +84774,7 @@ function useProviderSlashCommands(deps) {
84708
84774
  openModelPicker,
84709
84775
  openFKeyPicker
84710
84776
  } = deps;
84711
- (0, import_react149.useEffect)(() => {
84777
+ (0, import_react151.useEffect)(() => {
84712
84778
  if (!getPickableProviders || !switchProviderAndModel) return;
84713
84779
  const cmd = {
84714
84780
  name: "model",
@@ -84724,7 +84790,7 @@ function useProviderSlashCommands(deps) {
84724
84790
  official: true
84725
84791
  });
84726
84792
  }, [slashRegistry, getPickableProviders, switchProviderAndModel, openModelPicker]);
84727
- (0, import_react149.useEffect)(() => {
84793
+ (0, import_react151.useEffect)(() => {
84728
84794
  const cmd = {
84729
84795
  name: "f",
84730
84796
  description: "Open F-key panel picker. Arrow keys to navigate, Enter to open, Esc to close.",
@@ -84741,12 +84807,12 @@ function useProviderSlashCommands(deps) {
84741
84807
  }
84742
84808
 
84743
84809
  // src/hooks/use-resource-slash-commands.ts
84744
- var import_react150 = __toESM(require_react(), 1);
84810
+ var import_react152 = __toESM(require_react(), 1);
84745
84811
  import { SKILL_LIMITS, stripFrontmatter } from "@wrongstack/core/skills";
84746
84812
  import { toErrorMessage as toErrorMessage12 } from "@wrongstack/core/utils";
84747
84813
  function useResourceSlashCommands(deps) {
84748
84814
  const { slashRegistry, skillLoader, getResourceMenu, dispatch, openPromptPicker } = deps;
84749
- (0, import_react150.useEffect)(() => {
84815
+ (0, import_react152.useEffect)(() => {
84750
84816
  if (!skillLoader) return;
84751
84817
  const cmd = {
84752
84818
  name: "skill",
@@ -84780,7 +84846,7 @@ function useResourceSlashCommands(deps) {
84780
84846
  official: true
84781
84847
  });
84782
84848
  }, [slashRegistry, skillLoader, dispatch]);
84783
- (0, import_react150.useEffect)(() => {
84849
+ (0, import_react152.useEffect)(() => {
84784
84850
  if (!getResourceMenu) return;
84785
84851
  const names = [
84786
84852
  "fallback",
@@ -84822,7 +84888,7 @@ function useResourceSlashCommands(deps) {
84822
84888
  for (const cleanup of [...cleanups].reverse()) cleanup();
84823
84889
  };
84824
84890
  }, [slashRegistry, getResourceMenu, dispatch]);
84825
- (0, import_react150.useEffect)(() => {
84891
+ (0, import_react152.useEffect)(() => {
84826
84892
  const definitions = [
84827
84893
  { name: "cron", open: () => dispatch({ type: "toggleCronMonitor" }) },
84828
84894
  { name: "prompts", open: () => void openPromptPicker() }
@@ -84857,7 +84923,7 @@ function useResourceSlashCommands(deps) {
84857
84923
  }
84858
84924
 
84859
84925
  // src/hooks/use-session-slash-commands.ts
84860
- var import_react151 = __toESM(require_react(), 1);
84926
+ var import_react153 = __toESM(require_react(), 1);
84861
84927
  import {
84862
84928
  areSubagentsAllowed,
84863
84929
  isSubagentPolicyLocked,
@@ -84867,7 +84933,7 @@ import { toErrorMessage as toErrorMessage13 } from "@wrongstack/core/utils";
84867
84933
  var RESUME_PICKER_SESSIONS = 500;
84868
84934
  function useSessionSlashCommands(deps, part) {
84869
84935
  const { agent, slashRegistry, dispatch, setMailboxPanelOpen, switchAutonomy, listSessions } = deps;
84870
- (0, import_react151.useEffect)(() => {
84936
+ (0, import_react153.useEffect)(() => {
84871
84937
  if (part !== "head") return;
84872
84938
  const cmd = {
84873
84939
  name: "solo",
@@ -84898,7 +84964,7 @@ function useSessionSlashCommands(deps, part) {
84898
84964
  official: true
84899
84965
  });
84900
84966
  }, [part, agent, slashRegistry]);
84901
- (0, import_react151.useEffect)(() => {
84967
+ (0, import_react153.useEffect)(() => {
84902
84968
  if (part !== "mid") return;
84903
84969
  const cmd = {
84904
84970
  name: "mailbox",
@@ -84914,7 +84980,7 @@ function useSessionSlashCommands(deps, part) {
84914
84980
  official: true
84915
84981
  });
84916
84982
  }, [part, slashRegistry]);
84917
- (0, import_react151.useEffect)(() => {
84983
+ (0, import_react153.useEffect)(() => {
84918
84984
  if (part !== "mid") return;
84919
84985
  if (!switchAutonomy) return;
84920
84986
  const cmd = {
@@ -84931,7 +84997,7 @@ function useSessionSlashCommands(deps, part) {
84931
84997
  official: true
84932
84998
  });
84933
84999
  }, [part, slashRegistry, switchAutonomy]);
84934
- (0, import_react151.useEffect)(() => {
85000
+ (0, import_react153.useEffect)(() => {
84935
85001
  if (part !== "tail") return;
84936
85002
  const hostSessions = slashRegistry.get("sessions");
84937
85003
  const cmd = {
@@ -84982,7 +85048,7 @@ function useSessionSlashCommands(deps, part) {
84982
85048
  }
84983
85049
 
84984
85050
  // src/hooks/use-settings-slash-commands.ts
84985
- var import_react152 = __toESM(require_react(), 1);
85051
+ var import_react154 = __toESM(require_react(), 1);
84986
85052
  function useSettingsSlashCommands(deps, part) {
84987
85053
  const {
84988
85054
  slashRegistry,
@@ -84995,7 +85061,7 @@ function useSettingsSlashCommands(deps, part) {
84995
85061
  setHiddenItems,
84996
85062
  openStatuslinePicker
84997
85063
  } = deps;
84998
- (0, import_react152.useEffect)(() => {
85064
+ (0, import_react154.useEffect)(() => {
84999
85065
  if (part !== "core") return;
85000
85066
  if (!getSettings || !saveSettings) return;
85001
85067
  const cmd = {
@@ -85114,7 +85180,7 @@ Available chords:
85114
85180
  official: true
85115
85181
  });
85116
85182
  }, [part, slashRegistry, getSettings, saveSettings, openSettings, dispatch]);
85117
- (0, import_react152.useEffect)(() => {
85183
+ (0, import_react154.useEffect)(() => {
85118
85184
  if (part !== "core") return;
85119
85185
  const cmd = {
85120
85186
  name: "settings-get",
@@ -85147,7 +85213,7 @@ Available chords:
85147
85213
  official: true
85148
85214
  });
85149
85215
  }, [part, slashRegistry, state.settingsPicker]);
85150
- (0, import_react152.useEffect)(() => {
85216
+ (0, import_react154.useEffect)(() => {
85151
85217
  if (part !== "core") return;
85152
85218
  const cmd = {
85153
85219
  name: "statusline",
@@ -85201,7 +85267,7 @@ Available chords:
85201
85267
  official: true
85202
85268
  });
85203
85269
  }, [part, slashRegistry, openStatuslinePicker, setHiddenItems]);
85204
- (0, import_react152.useEffect)(() => {
85270
+ (0, import_react154.useEffect)(() => {
85205
85271
  if (part !== "core") return;
85206
85272
  if (!getSettings || !saveSettings) return;
85207
85273
  const applyLayoutPreset = async (statuslineMode, showSidebar) => {
@@ -85253,7 +85319,7 @@ Available chords:
85253
85319
  teardownFull();
85254
85320
  };
85255
85321
  }, [part, slashRegistry, getSettings, saveSettings, dispatch]);
85256
- (0, import_react152.useEffect)(() => {
85322
+ (0, import_react154.useEffect)(() => {
85257
85323
  if (part !== "appearance") return;
85258
85324
  const cmd = {
85259
85325
  name: "theme",
@@ -85349,7 +85415,7 @@ function useTuiSlashCommands({
85349
85415
  import { buildGoalPreamble as buildGoalPreamble2 } from "@wrongstack/core/execution";
85350
85416
 
85351
85417
  // src/hooks/use-leader-auto-wake.ts
85352
- var import_react153 = __toESM(require_react(), 1);
85418
+ var import_react155 = __toESM(require_react(), 1);
85353
85419
  function normalizeSessionId(sessionId) {
85354
85420
  return (sessionId ?? "").trim().replace(/\\/g, "/");
85355
85421
  }
@@ -85370,11 +85436,11 @@ function createTuiLeaderWakePort(deps) {
85370
85436
  };
85371
85437
  }
85372
85438
  function useLeaderAutoWake(args) {
85373
- const argsRef = (0, import_react153.useRef)(args);
85439
+ const argsRef = (0, import_react155.useRef)(args);
85374
85440
  argsRef.current = args;
85375
- const pendingForms = (0, import_react153.useRef)(0);
85441
+ const pendingForms = (0, import_react155.useRef)(0);
85376
85442
  const { leaderAutoWake, events } = args;
85377
- (0, import_react153.useEffect)(() => {
85443
+ (0, import_react155.useEffect)(() => {
85378
85444
  if (!leaderAutoWake) return;
85379
85445
  const live = argsRef;
85380
85446
  const port = createTuiLeaderWakePort({
@@ -85599,7 +85665,7 @@ function App2(props) {
85599
85665
  refineModel,
85600
85666
  setRefineModel
85601
85667
  } = useAppRefSpine({ attachments, state, midRunSendPicker });
85602
- const onScrollInfo = (0, import_react154.useCallback)(
85668
+ const onScrollInfo = (0, import_react156.useCallback)(
85603
85669
  (info) => dispatch({ type: "setHistoryScrolled", scrolled: info.scrolled }),
85604
85670
  [dispatch]
85605
85671
  );
@@ -85756,11 +85822,11 @@ function App2(props) {
85756
85822
  setLiveModeLabel
85757
85823
  } = environment;
85758
85824
  const { displayThinkingWord } = activity;
85759
- const liveDirector = (0, import_react154.useCallback)(
85825
+ const liveDirector = (0, import_react156.useCallback)(
85760
85826
  () => getDirector?.() ?? director,
85761
85827
  [getDirector, director]
85762
85828
  );
85763
- const clearPendingConfirms = (0, import_react154.useCallback)(() => {
85829
+ const clearPendingConfirms = (0, import_react156.useCallback)(() => {
85764
85830
  const queue = stateRef.current.confirmQueue;
85765
85831
  if (queue.length === 0) return;
85766
85832
  for (const c of queue) {
@@ -85777,7 +85843,7 @@ function App2(props) {
85777
85843
  dispatch,
85778
85844
  open: state.authPanel.open
85779
85845
  });
85780
- (0, import_react154.useEffect)(() => {
85846
+ (0, import_react156.useEffect)(() => {
85781
85847
  if (!secretInputController) return;
85782
85848
  const previousSecret = secretInputController.readSecret;
85783
85849
  const previousText = secretInputController.readText;
@@ -85789,13 +85855,13 @@ function App2(props) {
85789
85855
  else delete secretInputController.readText;
85790
85856
  };
85791
85857
  }, [secretInputController, authPanelController.readSecret, authPanelController.readText]);
85792
- const statuslineHiddenForPicker = (0, import_react154.useCallback)(() => {
85858
+ const statuslineHiddenForPicker = (0, import_react156.useCallback)(() => {
85793
85859
  return mergeStatuslineHiddenItems(
85794
85860
  hiddenItemsRef.current,
85795
85861
  stateRef.current.statuslinePicker.hiddenItems
85796
85862
  );
85797
85863
  }, [hiddenItemsRef, stateRef]);
85798
- const openStatuslinePicker = (0, import_react154.useCallback)(
85864
+ const openStatuslinePicker = (0, import_react156.useCallback)(
85799
85865
  (field) => {
85800
85866
  if (field !== void 0) {
85801
85867
  dispatch({ type: "statuslineFieldSet", field });
@@ -85989,8 +86055,8 @@ function App2(props) {
85989
86055
  saveSettings,
85990
86056
  midRunSendPickerRef
85991
86057
  });
85992
- const getActiveSessionId = (0, import_react154.useCallback)(() => agent.ctx.session.id, [agent]);
85993
- 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)(
85994
86060
  () => leaderTimelineFromEntries(stateRef.current.entries),
85995
86061
  [stateRef]
85996
86062
  );
@@ -86299,7 +86365,7 @@ import {
86299
86365
  } from "@wrongstack/tools/next-steps";
86300
86366
 
86301
86367
  // src/run-tui.ts
86302
- var import_react155 = __toESM(require_react(), 1);
86368
+ var import_react157 = __toESM(require_react(), 1);
86303
86369
  import { createWriteStream } from "node:fs";
86304
86370
  import { tmpdir } from "node:os";
86305
86371
  import { join as join8 } from "node:path";
@@ -87087,7 +87153,7 @@ async function runTui(opts) {
87087
87153
  stdout.write(BRACKETED_PASTE_ON);
87088
87154
  stdout.write("\x1B[2J\x1B[H");
87089
87155
  lifecycle.acquire(stdin);
87090
- const appElement = import_react155.default.createElement(App2, {
87156
+ const appElement = import_react157.default.createElement(App2, {
87091
87157
  agent: opts.agent,
87092
87158
  slashRegistry: opts.slashRegistry,
87093
87159
  skillLoader: opts.skillLoader,