@wrongstack/tui 0.268.0 → 0.270.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -91,17 +91,14 @@ var Box = forwardRef(function Box2({ borderColor, backgroundColor, ...rest }, re
91
91
  function snapshotTokenCounter(tokenCounter) {
92
92
  return {
93
93
  usage: tokenCounter.total(),
94
+ currentRequest: tokenCounter.currentRequestTokens(),
94
95
  cost: tokenCounter.estimateCost(),
95
96
  cacheStats: tokenCounter.cacheStats()
96
97
  };
97
98
  }
98
99
  function useTokenCounterRefresh(tokenCounter, events) {
99
100
  const [data, setData] = useState(
100
- () => tokenCounter ? {
101
- usage: tokenCounter.total(),
102
- cost: tokenCounter.estimateCost(),
103
- cacheStats: tokenCounter.cacheStats()
104
- } : void 0
101
+ () => tokenCounter ? snapshotTokenCounter(tokenCounter) : void 0
105
102
  );
106
103
  useEffect(() => {
107
104
  if (!tokenCounter) {
@@ -118,6 +115,19 @@ function useTokenCounterRefresh(tokenCounter, events) {
118
115
  }, [tokenCounter, events]);
119
116
  return data;
120
117
  }
118
+
119
+ // src/thinking-word.ts
120
+ var DEFAULT_TUI_THINKING_WORD = "thinking";
121
+ var MAX_TUI_THINKING_WORD_LENGTH = 16;
122
+ function normalizeTuiThinkingWord(value) {
123
+ if (typeof value !== "string") return DEFAULT_TUI_THINKING_WORD;
124
+ const word = value.trim();
125
+ if (word.length === 0 || word.length > MAX_TUI_THINKING_WORD_LENGTH) {
126
+ return DEFAULT_TUI_THINKING_WORD;
127
+ }
128
+ if (!/^[\p{L}\p{N}_-]+$/u.test(word)) return DEFAULT_TUI_THINKING_WORD;
129
+ return word;
130
+ }
121
131
  function chipExpired(meta, now = Date.now()) {
122
132
  if (meta.expiresIn == null) return false;
123
133
  return now >= meta.shownAt + meta.expiresIn * 6e4;
@@ -160,10 +170,23 @@ var COMPACT_THRESHOLD = 50;
160
170
  var COMFORTABLE_THRESHOLD = 90;
161
171
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
162
172
  var SPINNER_INTERVAL_MS = 250;
173
+ function tokenDisplayTotals(usage, currentRequest) {
174
+ const usageInput = usage ? usage.input + (usage.cacheRead ?? 0) + (usage.cacheWrite ?? 0) : 0;
175
+ const usageOutput = usage?.output ?? 0;
176
+ const fallbackInput = currentRequest ? currentRequest.input + currentRequest.cacheRead : 0;
177
+ return {
178
+ input: usageInput > 0 ? usageInput : fallbackInput,
179
+ output: usageOutput
180
+ };
181
+ }
182
+ function hasTokenDisplay(tokens) {
183
+ return tokens.input > 0 || tokens.output > 0;
184
+ }
163
185
  function StatusBar({
164
186
  model,
165
187
  version,
166
188
  state,
189
+ thinkingWord,
167
190
  tokenCounter,
168
191
  hint,
169
192
  queueCount = 0,
@@ -217,6 +240,8 @@ function StatusBar({
217
240
  const hiddenSet = new Set(hiddenItems);
218
241
  const tokenData = useTokenCounterRefresh(tokenCounter, events);
219
242
  const usage = tokenData?.usage;
243
+ const displayTokens = tokenDisplayTotals(usage, tokenData?.currentRequest);
244
+ const showTokenDisplay = hasTokenDisplay(displayTokens);
220
245
  const cost = tokenData?.cost;
221
246
  const cache2 = tokenData?.cacheStats;
222
247
  const [elapsedMs, setElapsedMs] = useState(startedAt ? Date.now() - startedAt : 0);
@@ -235,7 +260,7 @@ function StatusBar({
235
260
  return () => clearInterval(t);
236
261
  }, [state]);
237
262
  const spinner = expectDefined$1(SPINNER_FRAMES[spinnerIdx]);
238
- const { label: stateLabel, color: stateColor } = stateChip(state, fleet?.running ?? 0);
263
+ const { label: stateLabel, color: stateColor } = stateChip(state, fleet?.running ?? 0, thinkingWord);
239
264
  const statePrefix = state === "idle" || state === "aborting" ? "\u25CF" : spinner;
240
265
  const thinking = state === "running" || state === "streaming";
241
266
  const hasAutoProceed = autoProceedCountdown != null && autoProceedCountdown > 0;
@@ -295,6 +320,16 @@ function StatusBar({
295
320
  fmtTok(ctxMax)
296
321
  ] })
297
322
  ] }) : null,
323
+ showTokenDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
324
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2502" }),
325
+ /* @__PURE__ */ jsxs(Text, { children: [
326
+ "\u2191 ",
327
+ /* @__PURE__ */ jsx(Text, { color: "cyan", children: fmtTok(displayTokens.input) }),
328
+ " \u2193",
329
+ " ",
330
+ /* @__PURE__ */ jsx(Text, { color: "cyan", children: fmtTok(displayTokens.output) })
331
+ ] })
332
+ ] }) : null,
298
333
  cost && cost.total > 0 && !hiddenSet.has("cost") ? /* @__PURE__ */ jsxs(Fragment, { children: [
299
334
  /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2502" }),
300
335
  /* @__PURE__ */ jsxs(Text, { color: "yellow", children: [
@@ -372,15 +407,14 @@ function StatusBar({
372
407
  ] });
373
408
  })()
374
409
  ] }) : null,
375
- usage && isComfortable ? /* @__PURE__ */ jsxs(Fragment, { children: [
410
+ showTokenDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
376
411
  /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2502" }),
377
412
  /* @__PURE__ */ jsxs(Text, { children: [
378
- "\u2191",
413
+ "\u2191 ",
414
+ /* @__PURE__ */ jsx(Text, { color: "cyan", children: fmtTok(displayTokens.input) }),
415
+ " \u2193",
379
416
  " ",
380
- /* @__PURE__ */ jsx(Text, { color: "cyan", children: fmtTok(usage.input + (usage.cacheRead ?? 0) + (usage.cacheWrite ?? 0)) }),
381
- " ",
382
- "\u2193 ",
383
- /* @__PURE__ */ jsx(Text, { color: "cyan", children: fmtTok(usage.output) })
417
+ /* @__PURE__ */ jsx(Text, { color: "cyan", children: fmtTok(displayTokens.output) })
384
418
  ] })
385
419
  ] }) : null,
386
420
  cache2 && cache2.hitRatio > 0 && isComfortable ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -894,7 +928,7 @@ function statusBarModelSpan(opts) {
894
928
  col += `WS v${opts.version}`.length + SB_GAP;
895
929
  col += 1 + SB_GAP;
896
930
  }
897
- const { label } = stateChip(opts.state, opts.fleetRunning ?? 0);
931
+ const { label } = stateChip(opts.state, opts.fleetRunning ?? 0, opts.thinkingWord);
898
932
  col += 2 + label.length + SB_GAP;
899
933
  col += 1 + SB_GAP;
900
934
  return { start: col, len: opts.model.length };
@@ -912,13 +946,13 @@ function statusBarTodosSpan() {
912
946
  const LABEL_MAX = 20;
913
947
  return { start: SB_PADX, len: LABEL_MAX };
914
948
  }
915
- function stateChip(state, fleetRunning) {
949
+ function stateChip(state, fleetRunning, thinkingWord) {
916
950
  if (state === "idle" && fleetRunning > 0) {
917
951
  return { label: `agents \u25B6${fleetRunning}`, color: "magenta" };
918
952
  }
919
953
  if (state === "idle") return { label: "idle", color: "cyan" };
920
954
  if (state === "aborting") return { label: "aborting\u2026", color: "yellow" };
921
- return { label: "thinking\u2026", color: "green" };
955
+ return { label: `${normalizeTuiThinkingWord(thinkingWord)}\u2026`, color: "green" };
922
956
  }
923
957
  var WAVE_COLORS = [
924
958
  "#f38ba8",
@@ -2174,36 +2208,36 @@ var F_KEY_PANEL_ENTRIES = [
2174
2208
  key: 1,
2175
2209
  label: "Project switcher",
2176
2210
  action: "projectPickerOpen",
2177
- helpKeys: "F1",
2178
- helpDescription: "project switcher (also /project)"
2211
+ helpKeys: "F1 or /project",
2212
+ helpDescription: "project switcher (F1 may open terminal help)"
2179
2213
  },
2180
2214
  {
2181
2215
  key: 2,
2182
2216
  label: "Fleet orchestration monitor",
2183
2217
  action: "toggleMonitor",
2184
- helpKeys: "Ctrl+F / F2",
2185
- helpDescription: "fleet orchestration monitor"
2218
+ helpKeys: "F2 or /fleet",
2219
+ helpDescription: "fleet monitor (Ctrl+F may be terminal Find)"
2186
2220
  },
2187
2221
  {
2188
2222
  key: 3,
2189
2223
  label: "Agents live monitor",
2190
2224
  action: "toggleAgentsMonitor",
2191
- helpKeys: "Ctrl+G / F3",
2192
- helpDescription: "agents live monitor"
2225
+ helpKeys: "F3 or Ctrl+G",
2226
+ helpDescription: "agents live monitor (F3 is safer)"
2193
2227
  },
2194
2228
  {
2195
2229
  key: 4,
2196
2230
  label: "Worktree monitor",
2197
2231
  action: "toggleWorktreeMonitor",
2198
- helpKeys: "Ctrl+T / F4",
2199
- helpDescription: "worktree monitor"
2232
+ helpKeys: "F4 or /worktree",
2233
+ helpDescription: "worktree monitor (Ctrl+T may be reserved)"
2200
2234
  },
2201
2235
  {
2202
2236
  key: 5,
2203
2237
  label: "Plan panel",
2204
2238
  action: "togglePlanPanel",
2205
- helpKeys: "F5",
2206
- helpDescription: "plan panel"
2239
+ helpKeys: "F5 or /plan",
2240
+ helpDescription: "plan panel (F5 may be host refresh/run)"
2207
2241
  },
2208
2242
  {
2209
2243
  key: 6,
@@ -2237,22 +2271,22 @@ var F_KEY_PANEL_ENTRIES = [
2237
2271
  key: 10,
2238
2272
  label: "Live sessions panel",
2239
2273
  action: "toggleSessionsPanel",
2240
- helpKeys: "F10",
2241
- helpDescription: "live sessions panel"
2274
+ helpKeys: "F10 or /resume",
2275
+ helpDescription: "live sessions panel (F10 may open host menu)"
2242
2276
  },
2243
2277
  {
2244
2278
  key: 11,
2245
2279
  label: "Coordinator monitor",
2246
2280
  action: "toggleCoordinatorMonitor",
2247
- helpKeys: "F11",
2248
- helpDescription: "coordinator monitor"
2281
+ helpKeys: "F11 or /coordinator",
2282
+ helpDescription: "coordinator monitor (F11 may toggle fullscreen)"
2249
2283
  },
2250
2284
  {
2251
2285
  key: 12,
2252
2286
  label: "Status line picker",
2253
2287
  action: "statuslineOpen",
2254
- helpKeys: "F12",
2255
- helpDescription: "status line picker"
2288
+ helpKeys: "F12 or /sl",
2289
+ helpDescription: "status line picker (F12 may be host/devtools)"
2256
2290
  }
2257
2291
  ];
2258
2292
  var PAYLOAD_FREE_ACTIONS = /* @__PURE__ */ new Set([
@@ -2420,8 +2454,11 @@ function helpSections() {
2420
2454
  entries: [
2421
2455
  { keys: "Enter", desc: "send (queues while the agent is busy)" },
2422
2456
  { keys: "Esc Esc", desc: "clear the input buffer" },
2423
- { keys: "Ctrl+Backspace", desc: "delete the previous word" },
2424
- { keys: "Ctrl+S", desc: "edit autonomy settings" },
2457
+ { keys: "Ctrl+\u2190/\u2192", desc: "word navigation (terminal-dependent)" },
2458
+ { keys: "Ctrl+Backspace", desc: "delete previous word/chip" },
2459
+ { keys: "Ctrl+S or /settings", desc: "settings (Ctrl+S may be reserved)" },
2460
+ { keys: "Ctrl+V", desc: "paste text (may be host paste)" },
2461
+ { keys: "Alt+V", desc: "paste image (terminal-dependent)" },
2425
2462
  { keys: "Ctrl+C", desc: "interrupt the run \xB7 twice to exit" }
2426
2463
  ]
2427
2464
  },
@@ -4441,7 +4478,7 @@ function parseRawNumbered(content) {
4441
4478
  const m = ITEM_RE.exec(line);
4442
4479
  if (!m) continue;
4443
4480
  const numPart = m[1];
4444
- let text = m[2].trim();
4481
+ const text = m[2].trim();
4445
4482
  const hasAuto = !!m[3];
4446
4483
  let index;
4447
4484
  if (numPart !== void 0) {
@@ -4479,7 +4516,7 @@ function parseWithHeading(content, strict) {
4479
4516
  const m = ITEM_RE.exec(line);
4480
4517
  if (!m) break;
4481
4518
  const numPart = m[1];
4482
- let text = m[2].trim();
4519
+ const text = m[2].trim();
4483
4520
  const hasAuto = !!m[3];
4484
4521
  let index;
4485
4522
  if (numPart !== void 0) {
@@ -5110,6 +5147,15 @@ function tokenLengthForward(buffer, cursor) {
5110
5147
  const m = buffer.slice(cursor).match(AT_START);
5111
5148
  return m ? m[0].length : 0;
5112
5149
  }
5150
+ function tokenSpanAt(buffer, cursor) {
5151
+ const clamped = Math.max(0, Math.min(cursor, buffer.length));
5152
+ for (const m of buffer.matchAll(GLOBAL)) {
5153
+ const start = m.index ?? 0;
5154
+ const end = start + m[0].length;
5155
+ if (clamped >= start && clamped <= end) return { start, end };
5156
+ }
5157
+ return null;
5158
+ }
5113
5159
  function splitChips(text) {
5114
5160
  if (!text) return [];
5115
5161
  const spans = [];
@@ -5294,6 +5340,11 @@ function isHomeEnd(data) {
5294
5340
  return "end";
5295
5341
  return null;
5296
5342
  }
5343
+ function isCtrlArrow(data) {
5344
+ if (data === "\x1B[1;5D" || data === "\x1B[5D") return "left";
5345
+ if (data === "\x1B[1;5C" || data === "\x1B[5C") return "right";
5346
+ return null;
5347
+ }
5297
5348
  function isBackspaceOrDelete(data) {
5298
5349
  if (data === "\x1B\x7F" || data === "\x1B\b") return "metaBackspace";
5299
5350
  if (data === "\x7F" || data === "\b") return "backspace";
@@ -5331,6 +5382,8 @@ var Input = memo(function Input2({
5331
5382
  const suppressInkEscRef = useRef(false);
5332
5383
  const suppressInkBackspaceRef = useRef(false);
5333
5384
  const suppressInkDeleteRef = useRef(false);
5385
+ const suppressInkCtrlLeftRef = useRef(false);
5386
+ const suppressInkCtrlRightRef = useRef(false);
5334
5387
  useInput((input, key) => {
5335
5388
  if (disabled) return;
5336
5389
  if (input && isLeakedMouseInput(input)) return;
@@ -5346,6 +5399,14 @@ var Input = memo(function Input2({
5346
5399
  suppressInkDeleteRef.current = false;
5347
5400
  return;
5348
5401
  }
5402
+ if (key.ctrl && key.leftArrow && suppressInkCtrlLeftRef.current) {
5403
+ suppressInkCtrlLeftRef.current = false;
5404
+ return;
5405
+ }
5406
+ if (key.ctrl && key.rightArrow && suppressInkCtrlRightRef.current) {
5407
+ suppressInkCtrlRightRef.current = false;
5408
+ return;
5409
+ }
5349
5410
  onKey(input, key);
5350
5411
  });
5351
5412
  const { stdin } = useStdin();
@@ -5381,6 +5442,17 @@ var Input = memo(function Input2({
5381
5442
  onKey("", { ...EMPTY_KEY, end: true });
5382
5443
  return;
5383
5444
  }
5445
+ const ctrlArrow = isCtrlArrow(s2);
5446
+ if (ctrlArrow === "left") {
5447
+ suppressInkCtrlLeftRef.current = true;
5448
+ onKey("", { ...EMPTY_KEY, leftArrow: true, ctrl: true });
5449
+ return;
5450
+ }
5451
+ if (ctrlArrow === "right") {
5452
+ suppressInkCtrlRightRef.current = true;
5453
+ onKey("", { ...EMPTY_KEY, rightArrow: true, ctrl: true });
5454
+ return;
5455
+ }
5384
5456
  const bsdel = isBackspaceOrDelete(s2);
5385
5457
  if (bsdel === "backspace") {
5386
5458
  suppressInkBackspaceRef.current = true;
@@ -6555,7 +6627,7 @@ var MODE_DESC = {
6555
6627
  suggest: "Shows next-step suggestions after each turn",
6556
6628
  auto: "Self-driving \u2014 agent continues automatically"
6557
6629
  };
6558
- var SETTINGS_FIELD_COUNT = 34;
6630
+ var SETTINGS_FIELD_COUNT = 35;
6559
6631
  var CONFIG_SCOPES = ["global", "project"];
6560
6632
  function SettingsPicker({
6561
6633
  field,
@@ -6574,24 +6646,25 @@ function SettingsPicker({
6574
6646
  featureModelsRegistry,
6575
6647
  tokenSavingTier,
6576
6648
  allowOutsideProjectRoot,
6577
- contextAutoCompact,
6578
- contextStrategy,
6579
- contextMode,
6580
- maxConcurrent,
6581
- logLevel,
6582
- auditLevel,
6583
- indexOnStart,
6584
6649
  maxIterations,
6585
6650
  autoProceedMaxIterations,
6586
6651
  enhanceDelayMs,
6587
6652
  enhanceEnabled,
6588
6653
  enhanceLanguage,
6589
- debugStream,
6590
- statuslineMode,
6654
+ indexOnStart,
6655
+ thinkingWord,
6591
6656
  reasoningMode,
6592
6657
  reasoningEffort,
6593
6658
  reasoningPreserve,
6594
6659
  cacheTtl,
6660
+ contextAutoCompact,
6661
+ contextStrategy,
6662
+ contextMode,
6663
+ maxConcurrent,
6664
+ logLevel,
6665
+ auditLevel,
6666
+ debugStream,
6667
+ statuslineMode,
6595
6668
  configScope,
6596
6669
  hint
6597
6670
  }) {
@@ -6674,51 +6747,6 @@ function SettingsPicker({
6674
6747
  value: boolVal(allowOutsideProjectRoot),
6675
6748
  detail: "Allow tools to access paths outside project root"
6676
6749
  },
6677
- // ── Context ──
6678
- { section: "Context" },
6679
- {
6680
- label: "Auto-compact",
6681
- value: boolVal(contextAutoCompact),
6682
- detail: "Auto-compact context when thresholds crossed"
6683
- },
6684
- {
6685
- label: "Compactor strategy",
6686
- value: contextStrategy,
6687
- detail: "hybrid (fast) | intelligent (LLM) | selective"
6688
- },
6689
- {
6690
- label: "Context mode",
6691
- value: contextMode,
6692
- detail: CONTEXT_MODE_DESCS[contextMode]
6693
- },
6694
- // ── Fleet ──
6695
- { section: "Fleet" },
6696
- {
6697
- label: "Max concurrent",
6698
- value: maxConcurrent === 0 ? "unlimited" : String(maxConcurrent),
6699
- detail: "Max subagents (0 = unlimited)"
6700
- },
6701
- // ── Logging ──
6702
- { section: "Logging" },
6703
- {
6704
- label: "Log level",
6705
- value: logLevel,
6706
- detail: "Console log verbosity"
6707
- },
6708
- // ── Session ──
6709
- { section: "Session" },
6710
- {
6711
- label: "Audit level",
6712
- value: auditLevel,
6713
- detail: "minimal | standard | full (large)"
6714
- },
6715
- // ── Indexing ──
6716
- { section: "Indexing" },
6717
- {
6718
- label: "Index on session start",
6719
- value: boolVal(indexOnStart),
6720
- detail: "Run incremental index at session start"
6721
- },
6722
6750
  // ── Tools ──
6723
6751
  { section: "Tools" },
6724
6752
  {
@@ -6746,8 +6774,18 @@ function SettingsPicker({
6746
6774
  value: enhanceLanguage,
6747
6775
  detail: "original (keep language) | english (translate)"
6748
6776
  },
6777
+ {
6778
+ label: "Index on session start",
6779
+ value: boolVal(indexOnStart),
6780
+ detail: "Run incremental index at session start"
6781
+ },
6749
6782
  // ── Reasoning ──
6750
6783
  { section: "Reasoning" },
6784
+ {
6785
+ label: "Thinking word",
6786
+ value: thinkingWord,
6787
+ detail: "Word shown in status bar while agent works"
6788
+ },
6751
6789
  {
6752
6790
  label: "Reasoning mode",
6753
6791
  value: reasoningMode,
@@ -6768,6 +6806,42 @@ function SettingsPicker({
6768
6806
  value: cacheTtl,
6769
6807
  detail: "Prompt cache TTL (5m | 1h)"
6770
6808
  },
6809
+ // ── Context ──
6810
+ { section: "Context" },
6811
+ {
6812
+ label: "Auto-compact",
6813
+ value: boolVal(contextAutoCompact),
6814
+ detail: "Auto-compact context when thresholds crossed"
6815
+ },
6816
+ {
6817
+ label: "Compactor strategy",
6818
+ value: contextStrategy,
6819
+ detail: "hybrid (fast) | intelligent (LLM) | selective"
6820
+ },
6821
+ {
6822
+ label: "Context mode",
6823
+ value: contextMode,
6824
+ detail: CONTEXT_MODE_DESCS[contextMode]
6825
+ },
6826
+ // ── Fleet ──
6827
+ { section: "Fleet" },
6828
+ {
6829
+ label: "Max concurrent",
6830
+ value: maxConcurrent === 0 ? "unlimited" : String(maxConcurrent),
6831
+ detail: "Max subagents (0 = unlimited)"
6832
+ },
6833
+ // ── Logging ──
6834
+ { section: "Logging" },
6835
+ {
6836
+ label: "Log level",
6837
+ value: logLevel,
6838
+ detail: "Console log verbosity"
6839
+ },
6840
+ {
6841
+ label: "Audit level",
6842
+ value: auditLevel,
6843
+ detail: "minimal | standard | full (large)"
6844
+ },
6771
6845
  // ── Debug ──
6772
6846
  { section: "Debug" },
6773
6847
  {
@@ -7092,9 +7166,9 @@ function hintsFor(ctx) {
7092
7166
  if (ctx.monitor) {
7093
7167
  const hints = [
7094
7168
  { key: "Esc", label: "close" },
7095
- { key: "^F", label: "fleet" },
7096
- { key: "^G", label: "agents" },
7097
- { key: "^T", label: "worktrees" },
7169
+ { key: "F2", label: "fleet" },
7170
+ { key: "F3", label: "agents" },
7171
+ { key: "F4", label: "worktrees" },
7098
7172
  { key: "F6", label: "todos" },
7099
7173
  { key: "F9", label: "goal" }
7100
7174
  ];
@@ -7105,7 +7179,7 @@ function hintsFor(ctx) {
7105
7179
  }
7106
7180
  const base = [{ key: "?", label: "help" }];
7107
7181
  if (ctx.managed) base.push({ key: "PgUp/PgDn", label: "scroll" });
7108
- base.push({ key: "^G", label: "agents" }, { key: "^C", label: "stop" });
7182
+ base.push({ key: "F3", label: "agents" }, { key: "^C", label: "stop" });
7109
7183
  if (ctx.nextPanelHint) {
7110
7184
  base.push({ key: ctx.nextPanelHint.key, label: ctx.nextPanelHint.label, discovery: true });
7111
7185
  }
@@ -7242,6 +7316,9 @@ var WT_STATUS = {
7242
7316
  function fmt(s2) {
7243
7317
  return WT_STATUS[s2] ?? { icon: "?", color: "white", label: s2 };
7244
7318
  }
7319
+ function isWorktreeMonitorCloseKey(input, key) {
7320
+ return key.escape === true || key.ctrl === true && input === "w";
7321
+ }
7245
7322
  function WorktreeMonitor({
7246
7323
  worktrees,
7247
7324
  baseBranch,
@@ -7249,7 +7326,7 @@ function WorktreeMonitor({
7249
7326
  onClose
7250
7327
  }) {
7251
7328
  useInput((input, key) => {
7252
- if (key.ctrl && input === "w") onClose();
7329
+ if (isWorktreeMonitorCloseKey(input, key)) onClose();
7253
7330
  });
7254
7331
  const TERMINAL_TTL_MS = 5 * 6e4;
7255
7332
  const list = Object.values(worktrees);
@@ -7286,7 +7363,7 @@ function WorktreeMonitor({
7286
7363
  failed
7287
7364
  ] })
7288
7365
  ] }) : null,
7289
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2502 Ctrl+T / F4 to close" })
7366
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2502 Esc / F4 to close" })
7290
7367
  ] }),
7291
7368
  recent.length === 0 ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: "No worktrees. They appear when AutoPhase runs with isolation on." }) : recent.map((w) => {
7292
7369
  const s2 = fmt(w.status);
@@ -7336,7 +7413,7 @@ function WorktreeMonitor({
7336
7413
  ] }, w.branch);
7337
7414
  }),
7338
7415
  /* @__PURE__ */ jsxs(Box, { marginTop: 1, children: [
7339
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Ctrl+T to close \xB7 merge conflicts with /worktree merge <branch>" }),
7416
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Esc / F4 to close \xB7 merge conflicts with /worktree merge <branch>" }),
7340
7417
  staleTerminal > 0 ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` \xB7 ${staleTerminal} terminal pruned` }) : null
7341
7418
  ] })
7342
7419
  ] });
@@ -9123,6 +9200,7 @@ function reducer(state, action) {
9123
9200
  reasoningMode: action.reasoningMode,
9124
9201
  reasoningEffort: action.reasoningEffort,
9125
9202
  reasoningPreserve: action.reasoningPreserve,
9203
+ thinkingWord: action.thinkingWord,
9126
9204
  cacheTtl: action.cacheTtl,
9127
9205
  configScope: action.configScope,
9128
9206
  hint: void 0
@@ -9178,95 +9256,96 @@ function reducer(state, action) {
9178
9256
  return { ...state, settingsPicker: { ...sp, tokenSavingTier: TOKEN_SAVING_TIERS[next] ?? "off", hint: bootHint } };
9179
9257
  }
9180
9258
  if (f === 14) return { ...state, settingsPicker: { ...sp, allowOutsideProjectRoot: !sp.allowOutsideProjectRoot, hint: void 0 } };
9181
- if (f === 15) return { ...state, settingsPicker: { ...sp, contextAutoCompact: !sp.contextAutoCompact, hint: void 0 } };
9259
+ if (f === 15) {
9260
+ const j = MAX_ITERATIONS_PRESETS.indexOf(sp.maxIterations);
9261
+ const base = j < 0 ? 0 : j;
9262
+ const next = (base + action.delta + MAX_ITERATIONS_PRESETS.length) % MAX_ITERATIONS_PRESETS.length;
9263
+ return { ...state, settingsPicker: { ...sp, maxIterations: expectDefined$1(MAX_ITERATIONS_PRESETS[next]), hint: void 0 } };
9264
+ }
9182
9265
  if (f === 16) {
9266
+ const aj = AUTO_PROCEED_MAX_PRESETS.indexOf(sp.autoProceedMaxIterations);
9267
+ const abase = aj < 0 ? 0 : aj;
9268
+ const anext = (abase + action.delta + AUTO_PROCEED_MAX_PRESETS.length) % AUTO_PROCEED_MAX_PRESETS.length;
9269
+ return { ...state, settingsPicker: { ...sp, autoProceedMaxIterations: expectDefined$1(AUTO_PROCEED_MAX_PRESETS[anext]), hint: void 0 } };
9270
+ }
9271
+ if (f === 17) {
9272
+ const ej = ENHANCE_DELAY_PRESETS.indexOf(sp.enhanceDelayMs);
9273
+ const ebase = ej < 0 ? 0 : ej;
9274
+ const enext = (ebase + action.delta + ENHANCE_DELAY_PRESETS.length) % ENHANCE_DELAY_PRESETS.length;
9275
+ return { ...state, settingsPicker: { ...sp, enhanceDelayMs: expectDefined$1(ENHANCE_DELAY_PRESETS[enext]), hint: void 0 } };
9276
+ }
9277
+ if (f === 18) return { ...state, settingsPicker: { ...sp, enhanceEnabled: !sp.enhanceEnabled, hint: void 0 } };
9278
+ if (f === 19) {
9279
+ const i = ENHANCE_LANGUAGES.indexOf(sp.enhanceLanguage);
9280
+ const base = i < 0 ? 0 : i;
9281
+ const next = (base + action.delta + ENHANCE_LANGUAGES.length) % ENHANCE_LANGUAGES.length;
9282
+ return { ...state, settingsPicker: { ...sp, enhanceLanguage: expectDefined$1(ENHANCE_LANGUAGES[next]), hint: void 0 } };
9283
+ }
9284
+ if (f === 20) return { ...state, settingsPicker: { ...sp, indexOnStart: !sp.indexOnStart, hint: bootHint } };
9285
+ if (f === 21) return state;
9286
+ if (f === 22) {
9287
+ const i = REASONING_MODES.indexOf(sp.reasoningMode);
9288
+ const base = i < 0 ? 0 : i;
9289
+ const next = (base + action.delta + REASONING_MODES.length) % REASONING_MODES.length;
9290
+ return { ...state, settingsPicker: { ...sp, reasoningMode: expectDefined$1(REASONING_MODES[next]), hint: void 0 } };
9291
+ }
9292
+ if (f === 23) {
9293
+ const i = REASONING_EFFORTS.indexOf(sp.reasoningEffort);
9294
+ const base = i < 0 ? REASONING_EFFORTS.indexOf("high") : i;
9295
+ const next = (base + action.delta + REASONING_EFFORTS.length) % REASONING_EFFORTS.length;
9296
+ return { ...state, settingsPicker: { ...sp, reasoningEffort: expectDefined$1(REASONING_EFFORTS[next]), hint: void 0 } };
9297
+ }
9298
+ if (f === 24) return { ...state, settingsPicker: { ...sp, reasoningPreserve: !sp.reasoningPreserve, hint: void 0 } };
9299
+ if (f === 25) {
9300
+ const i = CACHE_TTLS.indexOf(sp.cacheTtl);
9301
+ const base = i < 0 ? 0 : i;
9302
+ const next = (base + action.delta + CACHE_TTLS.length) % CACHE_TTLS.length;
9303
+ return { ...state, settingsPicker: { ...sp, cacheTtl: expectDefined$1(CACHE_TTLS[next]), hint: void 0 } };
9304
+ }
9305
+ if (f === 26) return { ...state, settingsPicker: { ...sp, contextAutoCompact: !sp.contextAutoCompact, hint: void 0 } };
9306
+ if (f === 27) {
9183
9307
  const i = COMPACTOR_STRATEGIES.indexOf(sp.contextStrategy);
9184
9308
  const base = i < 0 ? 0 : i;
9185
9309
  const next = (base + action.delta + COMPACTOR_STRATEGIES.length) % COMPACTOR_STRATEGIES.length;
9186
9310
  return { ...state, settingsPicker: { ...sp, contextStrategy: expectDefined$1(COMPACTOR_STRATEGIES[next]), hint: bootHint } };
9187
9311
  }
9188
- if (f === 17) {
9312
+ if (f === 28) {
9189
9313
  const i = CONTEXT_MODES.indexOf(sp.contextMode);
9190
9314
  const base = i < 0 ? 0 : i;
9191
9315
  const next = (base + action.delta + CONTEXT_MODES.length) % CONTEXT_MODES.length;
9192
9316
  return { ...state, settingsPicker: { ...sp, contextMode: expectDefined$1(CONTEXT_MODES[next]), hint: bootHint } };
9193
9317
  }
9194
- if (f === 18) {
9318
+ if (f === 29) {
9195
9319
  const j = MAX_CONCURRENT_PRESETS.indexOf(sp.maxConcurrent);
9196
9320
  const base = j < 0 ? 0 : j;
9197
9321
  const next = (base + action.delta + MAX_CONCURRENT_PRESETS.length) % MAX_CONCURRENT_PRESETS.length;
9198
9322
  return { ...state, settingsPicker: { ...sp, maxConcurrent: expectDefined$1(MAX_CONCURRENT_PRESETS[next]), hint: void 0 } };
9199
9323
  }
9200
- if (f === 19) {
9324
+ if (f === 30) {
9201
9325
  const i = LOG_LEVELS.indexOf(sp.logLevel);
9202
9326
  const base = i < 0 ? 0 : i;
9203
9327
  const next = (base + action.delta + LOG_LEVELS.length) % LOG_LEVELS.length;
9204
9328
  return { ...state, settingsPicker: { ...sp, logLevel: expectDefined$1(LOG_LEVELS[next]), hint: void 0 } };
9205
9329
  }
9206
- if (f === 20) {
9330
+ if (f === 31) {
9207
9331
  const i = AUDIT_LEVELS.indexOf(sp.auditLevel);
9208
9332
  const base = i < 0 ? 0 : i;
9209
9333
  const next = (base + action.delta + AUDIT_LEVELS.length) % AUDIT_LEVELS.length;
9210
9334
  return { ...state, settingsPicker: { ...sp, auditLevel: expectDefined$1(AUDIT_LEVELS[next]), hint: void 0 } };
9211
9335
  }
9212
- if (f === 21) return { ...state, settingsPicker: { ...sp, indexOnStart: !sp.indexOnStart, hint: bootHint } };
9213
- if (f === 22) {
9214
- const j = MAX_ITERATIONS_PRESETS.indexOf(sp.maxIterations);
9215
- const base = j < 0 ? 0 : j;
9216
- const next = (base + action.delta + MAX_ITERATIONS_PRESETS.length) % MAX_ITERATIONS_PRESETS.length;
9217
- return { ...state, settingsPicker: { ...sp, maxIterations: expectDefined$1(MAX_ITERATIONS_PRESETS[next]), hint: void 0 } };
9218
- }
9219
- if (f === 23) {
9220
- const aj = AUTO_PROCEED_MAX_PRESETS.indexOf(sp.autoProceedMaxIterations);
9221
- const abase = aj < 0 ? 0 : aj;
9222
- const anext = (abase + action.delta + AUTO_PROCEED_MAX_PRESETS.length) % AUTO_PROCEED_MAX_PRESETS.length;
9223
- return { ...state, settingsPicker: { ...sp, autoProceedMaxIterations: expectDefined$1(AUTO_PROCEED_MAX_PRESETS[anext]), hint: void 0 } };
9224
- }
9225
- if (f === 24) {
9226
- const ej = ENHANCE_DELAY_PRESETS.indexOf(sp.enhanceDelayMs);
9227
- const ebase = ej < 0 ? 0 : ej;
9228
- const enext = (ebase + action.delta + ENHANCE_DELAY_PRESETS.length) % ENHANCE_DELAY_PRESETS.length;
9229
- return { ...state, settingsPicker: { ...sp, enhanceDelayMs: expectDefined$1(ENHANCE_DELAY_PRESETS[enext]), hint: void 0 } };
9230
- }
9231
- if (f === 25) return { ...state, settingsPicker: { ...sp, enhanceEnabled: !sp.enhanceEnabled, hint: void 0 } };
9232
- if (f === 26) {
9233
- const i = ENHANCE_LANGUAGES.indexOf(sp.enhanceLanguage);
9234
- const base = i < 0 ? 0 : i;
9235
- const next = (base + action.delta + ENHANCE_LANGUAGES.length) % ENHANCE_LANGUAGES.length;
9236
- return { ...state, settingsPicker: { ...sp, enhanceLanguage: expectDefined$1(ENHANCE_LANGUAGES[next]), hint: void 0 } };
9237
- }
9238
- if (f === 27) return { ...state, settingsPicker: { ...sp, debugStream: !sp.debugStream, hint: void 0 } };
9239
- if (f === 28) {
9336
+ if (f === 32) return { ...state, settingsPicker: { ...sp, debugStream: !sp.debugStream, hint: void 0 } };
9337
+ if (f === 33) {
9240
9338
  const i = STATUSLINE_MODES.indexOf(sp.statuslineMode);
9241
9339
  const base = i < 0 ? STATUSLINE_MODES.indexOf("detailed") : i;
9242
9340
  const next = (base + action.delta + STATUSLINE_MODES.length) % STATUSLINE_MODES.length;
9243
9341
  return { ...state, settingsPicker: { ...sp, statuslineMode: expectDefined$1(STATUSLINE_MODES[next]), hint: void 0 } };
9244
9342
  }
9245
- if (f === 29) {
9343
+ if (f === 34) {
9246
9344
  const i = CONFIG_SCOPES.indexOf(sp.configScope);
9247
9345
  const base = i < 0 ? 0 : i;
9248
9346
  const next = (base + action.delta + CONFIG_SCOPES.length) % CONFIG_SCOPES.length;
9249
9347
  return { ...state, settingsPicker: { ...sp, configScope: expectDefined$1(CONFIG_SCOPES[next]), hint: void 0 } };
9250
9348
  }
9251
- if (f === 30) {
9252
- const i = REASONING_MODES.indexOf(sp.reasoningMode);
9253
- const base = i < 0 ? 0 : i;
9254
- const next = (base + action.delta + REASONING_MODES.length) % REASONING_MODES.length;
9255
- return { ...state, settingsPicker: { ...sp, reasoningMode: expectDefined$1(REASONING_MODES[next]), hint: void 0 } };
9256
- }
9257
- if (f === 31) {
9258
- const i = REASONING_EFFORTS.indexOf(sp.reasoningEffort);
9259
- const base = i < 0 ? REASONING_EFFORTS.indexOf("high") : i;
9260
- const next = (base + action.delta + REASONING_EFFORTS.length) % REASONING_EFFORTS.length;
9261
- return { ...state, settingsPicker: { ...sp, reasoningEffort: expectDefined$1(REASONING_EFFORTS[next]), hint: void 0 } };
9262
- }
9263
- if (f === 32) return { ...state, settingsPicker: { ...sp, reasoningPreserve: !sp.reasoningPreserve, hint: void 0 } };
9264
- if (f === 33) {
9265
- const i = CACHE_TTLS.indexOf(sp.cacheTtl);
9266
- const base = i < 0 ? 0 : i;
9267
- const next = (base + action.delta + CACHE_TTLS.length) % CACHE_TTLS.length;
9268
- return { ...state, settingsPicker: { ...sp, cacheTtl: expectDefined$1(CACHE_TTLS[next]), hint: void 0 } };
9269
- }
9270
9349
  return state;
9271
9350
  }
9272
9351
  case "settingsHint":
@@ -10184,6 +10263,41 @@ function selectedSlashCommandLine(picker) {
10184
10263
  const picked = picker.matches[picker.selected];
10185
10264
  return picked ? `/${picked.name}` : null;
10186
10265
  }
10266
+ function isInputWordSeparator(ch) {
10267
+ return ch === void 0 || /\s/.test(ch);
10268
+ }
10269
+ function previousInputWordStart(buffer, cursor) {
10270
+ let i = Math.max(0, Math.min(cursor, buffer.length));
10271
+ const chipAtCursor = tokenSpanAt(buffer, i);
10272
+ if (chipAtCursor && i > chipAtCursor.start) return chipAtCursor.start;
10273
+ while (i > 0 && isInputWordSeparator(buffer[i - 1])) i--;
10274
+ const chipBeforeCursor = tokenSpanAt(buffer, i);
10275
+ if (chipBeforeCursor && i === chipBeforeCursor.end) return chipBeforeCursor.start;
10276
+ while (i > 0 && !isInputWordSeparator(buffer[i - 1])) {
10277
+ const chip = tokenSpanAt(buffer, i - 1);
10278
+ if (chip) {
10279
+ i = chip.start;
10280
+ continue;
10281
+ }
10282
+ i--;
10283
+ }
10284
+ return i;
10285
+ }
10286
+ function nextInputWordStart(buffer, cursor) {
10287
+ let i = Math.max(0, Math.min(cursor, buffer.length));
10288
+ const chipAtCursor = tokenSpanAt(buffer, i);
10289
+ if (chipAtCursor && i < chipAtCursor.end) i = chipAtCursor.end;
10290
+ else while (i < buffer.length && !isInputWordSeparator(buffer[i])) {
10291
+ const chip = tokenSpanAt(buffer, i);
10292
+ if (chip) {
10293
+ i = chip.end;
10294
+ continue;
10295
+ }
10296
+ i++;
10297
+ }
10298
+ while (i < buffer.length && isInputWordSeparator(buffer[i])) i++;
10299
+ return i;
10300
+ }
10187
10301
  function rehydrateHistory(messages, startId, toolCalls) {
10188
10302
  const entries = [];
10189
10303
  let nextId = startId;
@@ -10457,7 +10571,7 @@ function App({
10457
10571
  },
10458
10572
  autonomyPicker: { open: false, options: [], selected: 0 },
10459
10573
  resumePicker: { open: false, sessions: [], selected: 0, busy: false, hint: void 0, error: void 0 },
10460
- settingsPicker: { open: false, field: 0, mode: "off", delayMs: 0, titleAnimation: true, yolo: false, streamFleet: true, chime: false, confirmExit: true, nextPrediction: false, featureMcp: true, featurePlugins: true, featureMemory: true, featureSkills: true, featureModelsRegistry: true, tokenSavingTier: "off", allowOutsideProjectRoot: true, contextAutoCompact: true, contextStrategy: "hybrid", contextMode: "balanced", maxConcurrent: 10, logLevel: "info", auditLevel: "standard", indexOnStart: true, maxIterations: 500, autoProceedMaxIterations: 50, enhanceDelayMs: 6e4, enhanceEnabled: true, enhanceLanguage: "original", debugStream: false, statuslineMode: "detailed", reasoningMode: "auto", reasoningEffort: "high", reasoningPreserve: false, cacheTtl: "default", configScope: "global" },
10574
+ settingsPicker: { open: false, field: 0, mode: "off", delayMs: 0, titleAnimation: true, yolo: false, streamFleet: true, chime: false, confirmExit: true, nextPrediction: false, featureMcp: true, featurePlugins: true, featureMemory: true, featureSkills: true, featureModelsRegistry: true, tokenSavingTier: "off", allowOutsideProjectRoot: true, contextAutoCompact: true, contextStrategy: "hybrid", contextMode: "balanced", maxConcurrent: 10, logLevel: "info", auditLevel: "standard", indexOnStart: true, maxIterations: 500, autoProceedMaxIterations: 50, enhanceDelayMs: 6e4, enhanceEnabled: true, enhanceLanguage: "original", debugStream: false, statuslineMode: "detailed", reasoningMode: "auto", reasoningEffort: "high", reasoningPreserve: false, thinkingWord: "thinking", cacheTtl: "default", configScope: "global" },
10461
10575
  statuslinePicker: { open: false, field: 0, hiddenItems: [], visibleChips: [], hint: void 0 },
10462
10576
  projectPicker: { open: false, allItems: [], items: [], selected: 0, filter: "", hint: void 0 },
10463
10577
  fKeyPicker: { open: false, selected: 0 },
@@ -10592,6 +10706,7 @@ function App({
10592
10706
  }, [agent.ctx, projectRoot]);
10593
10707
  const liveSettings = getSettings?.();
10594
10708
  const liveStatuslineMode = liveSettings?.statuslineMode ?? "detailed";
10709
+ const liveThinkingWord = liveSettings?.thinkingWord ?? "thinking";
10595
10710
  const chimeRef = useRef(chime);
10596
10711
  chimeRef.current = liveSettings?.chime ?? chime;
10597
10712
  const confirmExitRef = useRef(confirmExit);
@@ -11175,6 +11290,7 @@ function App({
11175
11290
  reasoningMode: sp.reasoningMode,
11176
11291
  reasoningEffort: sp.reasoningEffort,
11177
11292
  reasoningPreserve: sp.reasoningPreserve,
11293
+ thinkingWord: sp.thinkingWord,
11178
11294
  cacheTtl: sp.cacheTtl,
11179
11295
  configScope: sp.configScope
11180
11296
  });
@@ -11590,6 +11706,7 @@ function App({
11590
11706
  reasoningMode: s2.reasoningMode ?? "auto",
11591
11707
  reasoningEffort: s2.reasoningEffort ?? "high",
11592
11708
  reasoningPreserve: s2.reasoningPreserve ?? false,
11709
+ thinkingWord: s2.thinkingWord ?? "thinking",
11593
11710
  cacheTtl: s2.cacheTtl ?? "default",
11594
11711
  configScope: s2.configScope ?? "global"
11595
11712
  });
@@ -11733,6 +11850,7 @@ function App({
11733
11850
  reasoningMode: sp.reasoningMode,
11734
11851
  reasoningEffort: sp.reasoningEffort,
11735
11852
  reasoningPreserve: sp.reasoningPreserve,
11853
+ thinkingWord: sp.thinkingWord,
11736
11854
  cacheTtl: sp.cacheTtl,
11737
11855
  configScope: sp.configScope
11738
11856
  })).then((err) => {
@@ -11772,7 +11890,9 @@ function App({
11772
11890
  state.settingsPicker.reasoningMode,
11773
11891
  state.settingsPicker.reasoningEffort,
11774
11892
  state.settingsPicker.reasoningPreserve,
11893
+ state.settingsPicker.thinkingWord,
11775
11894
  state.settingsPicker.cacheTtl,
11895
+ state.settingsPicker.configScope,
11776
11896
  saveSettings
11777
11897
  ]);
11778
11898
  useEffect(() => {
@@ -12570,7 +12690,7 @@ function App({
12570
12690
  const now = Date.now();
12571
12691
  if (now - lastEnterAtRef.current < 50) return;
12572
12692
  lastEnterAtRef.current = now;
12573
- dispatch({ type: "settingsClose" });
12693
+ dispatch({ type: "settingsValueChange", delta: 1 });
12574
12694
  return;
12575
12695
  }
12576
12696
  return;
@@ -13079,6 +13199,35 @@ function App({
13079
13199
  dispatch({ type: "statuslineOpen", hiddenItems: state.statuslinePicker.hiddenItems });
13080
13200
  return;
13081
13201
  }
13202
+ if (state.settingsPicker.open) {
13203
+ if (key.escape) {
13204
+ dispatch({ type: "settingsClose" });
13205
+ return;
13206
+ }
13207
+ if (key.upArrow) {
13208
+ dispatch({ type: "settingsFieldMove", delta: -1 });
13209
+ return;
13210
+ }
13211
+ if (key.downArrow) {
13212
+ dispatch({ type: "settingsFieldMove", delta: 1 });
13213
+ return;
13214
+ }
13215
+ if (key.leftArrow) {
13216
+ dispatch({ type: "settingsValueChange", delta: -1 });
13217
+ return;
13218
+ }
13219
+ if (key.rightArrow) {
13220
+ dispatch({ type: "settingsValueChange", delta: 1 });
13221
+ return;
13222
+ }
13223
+ if (isEnter) {
13224
+ const now = Date.now();
13225
+ if (now - lastEnterAtRef.current < 50) return;
13226
+ lastEnterAtRef.current = now;
13227
+ dispatch({ type: "settingsValueChange", delta: 1 });
13228
+ return;
13229
+ }
13230
+ }
13082
13231
  if (key.ctrl && input === "s") {
13083
13232
  if (state.settingsPicker.open) {
13084
13233
  dispatch({ type: "settingsClose" });
@@ -13125,6 +13274,7 @@ function App({
13125
13274
  reasoningMode: cfg.reasoningMode ?? "auto",
13126
13275
  reasoningEffort: cfg.reasoningEffort ?? "high",
13127
13276
  reasoningPreserve: cfg.reasoningPreserve ?? false,
13277
+ thinkingWord: cfg.thinkingWord ?? "thinking",
13128
13278
  cacheTtl: cfg.cacheTtl ?? "default",
13129
13279
  configScope: cfg.configScope ?? "global"
13130
13280
  });
@@ -13213,10 +13363,18 @@ function App({
13213
13363
  if (key.backspace) {
13214
13364
  if (key.ctrl) {
13215
13365
  if (cursor === 0) return;
13216
- const beforeCursor = buffer.slice(0, cursor);
13217
- const lastWordStart = beforeCursor.lastIndexOf(" ") + 1;
13218
- const next3 = beforeCursor.slice(0, lastWordStart) + buffer.slice(cursor);
13219
- setDraft(next3, lastWordStart);
13366
+ const chip = tokenSpanAt(buffer, cursor);
13367
+ const deleteStart = chip && cursor > chip.start && cursor < chip.end ? chip.start : previousInputWordStart(buffer, cursor);
13368
+ const deleteEnd = chip && cursor > chip.start && cursor < chip.end ? chip.end : cursor;
13369
+ const next3 = buffer.slice(0, deleteStart) + buffer.slice(deleteEnd);
13370
+ if (nextStepsAutoSubmitTimerRef.current != null) {
13371
+ clearInterval(nextStepsAutoSubmitTimerRef.current);
13372
+ nextStepsAutoSubmitTimerRef.current = void 0;
13373
+ setNextStepsAutoSubmitCountdown(null);
13374
+ setNextStepsAutoSubmitLabel(null);
13375
+ nextStepsAutoSubmitSuggestionRef.current = null;
13376
+ }
13377
+ setDraft(next3, deleteStart);
13220
13378
  return;
13221
13379
  }
13222
13380
  const tokenDel = deleteTokenBackward(buffer, cursor);
@@ -13239,17 +13397,18 @@ function App({
13239
13397
  if (key.delete) {
13240
13398
  if (key.ctrl) {
13241
13399
  if (cursor >= buffer.length) return;
13242
- const afterCursor = buffer.slice(cursor);
13243
- const nextWordStart = afterCursor.indexOf(" ");
13244
- const end = nextWordStart === -1 ? buffer.length : cursor + nextWordStart + 1;
13245
- const next3 = buffer.slice(0, cursor) + buffer.slice(end);
13400
+ const chip = tokenSpanAt(buffer, cursor);
13401
+ const deleteStart = chip && cursor > chip.start && cursor < chip.end ? chip.start : cursor;
13402
+ const deleteEnd = chip && cursor > chip.start && cursor < chip.end ? chip.end : nextInputWordStart(buffer, cursor);
13403
+ const next3 = buffer.slice(0, deleteStart) + buffer.slice(deleteEnd);
13246
13404
  if (nextStepsAutoSubmitTimerRef.current != null) {
13247
13405
  clearInterval(nextStepsAutoSubmitTimerRef.current);
13248
13406
  nextStepsAutoSubmitTimerRef.current = void 0;
13249
13407
  setNextStepsAutoSubmitCountdown(null);
13408
+ setNextStepsAutoSubmitLabel(null);
13250
13409
  nextStepsAutoSubmitSuggestionRef.current = null;
13251
13410
  }
13252
- setDraft(next3, cursor);
13411
+ setDraft(next3, deleteStart);
13253
13412
  return;
13254
13413
  }
13255
13414
  if (cursor >= buffer.length) return;
@@ -13267,11 +13426,7 @@ function App({
13267
13426
  }
13268
13427
  if (key.leftArrow) {
13269
13428
  if (key.ctrl) {
13270
- if (cursor === 0) return;
13271
- const beforeCursor = buffer.slice(0, cursor);
13272
- const prevWordStart = beforeCursor.lastIndexOf(" ");
13273
- const target = prevWordStart === -1 ? 0 : prevWordStart + 1;
13274
- setDraft(buffer, target);
13429
+ setDraft(buffer, previousInputWordStart(buffer, cursor));
13275
13430
  return;
13276
13431
  }
13277
13432
  if (cursor > 0) setDraft(buffer, cursor - 1);
@@ -13279,11 +13434,7 @@ function App({
13279
13434
  }
13280
13435
  if (key.rightArrow) {
13281
13436
  if (key.ctrl) {
13282
- if (cursor >= buffer.length) return;
13283
- const afterCursor = buffer.slice(cursor);
13284
- const nextWordStart = afterCursor.indexOf(" ");
13285
- const target = nextWordStart === -1 ? buffer.length : cursor + nextWordStart + 1;
13286
- setDraft(buffer, target);
13437
+ setDraft(buffer, nextInputWordStart(buffer, cursor));
13287
13438
  return;
13288
13439
  }
13289
13440
  if (cursor < buffer.length) setDraft(buffer, cursor + 1);
@@ -14166,6 +14317,7 @@ User message:
14166
14317
  logLevel: state.settingsPicker.logLevel,
14167
14318
  auditLevel: state.settingsPicker.auditLevel,
14168
14319
  indexOnStart: state.settingsPicker.indexOnStart,
14320
+ thinkingWord: state.settingsPicker.thinkingWord,
14169
14321
  maxIterations: state.settingsPicker.maxIterations,
14170
14322
  autoProceedMaxIterations: state.settingsPicker.autoProceedMaxIterations,
14171
14323
  enhanceDelayMs: state.settingsPicker.enhanceDelayMs,
@@ -14336,6 +14488,7 @@ User message:
14336
14488
  model: `${liveProvider}/${liveModel}`,
14337
14489
  version: appVersion,
14338
14490
  state: state.status,
14491
+ thinkingWord: liveThinkingWord,
14339
14492
  tokenCounter,
14340
14493
  hint: renderRunningTools(state.runningTools) || state.hint,
14341
14494
  queueCount: state.queue.length,