@crazyhappyone/dsh-tui 0.1.0-alpha.51 → 0.1.0-alpha.53

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
@@ -39537,38 +39537,91 @@ function padDisplayEnd(text4, width) {
39537
39537
  return `${text4}${" ".repeat(width - cols)}`;
39538
39538
  }
39539
39539
  function wrapDisplayLines(text4, maxCols) {
39540
+ return wrapDisplayLinesLimited(text4, maxCols, Number.POSITIVE_INFINITY).lines;
39541
+ }
39542
+ function wrapDisplayLinesLimited(text4, maxCols, limit) {
39543
+ const bounded = Number.isFinite(limit) ? Math.max(0, Math.floor(limit)) : Number.POSITIVE_INFINITY;
39540
39544
  const source = text4.split("\n");
39541
- if (maxCols <= 0) return source;
39545
+ if (bounded === 0) return { lines: [], truncated: text4 !== "" };
39546
+ if (maxCols <= 0) {
39547
+ const lines = source.slice(0, bounded);
39548
+ return { lines, truncated: source.length > lines.length };
39549
+ }
39542
39550
  const out = [];
39543
- for (const line5 of source) {
39551
+ const room = () => out.length < bounded;
39552
+ const mark2 = (line5) => {
39553
+ const marker = `${wcwidthSafeSlice(line5, Math.max(0, maxCols - 1))}\u2026`;
39554
+ if (out.length < bounded) out.push(marker);
39555
+ else out[out.length - 1] = marker;
39556
+ };
39557
+ for (let lineIndex = 0; lineIndex < source.length; lineIndex += 1) {
39558
+ const line5 = source[lineIndex] ?? "";
39559
+ const laterLine = lineIndex < source.length - 1;
39544
39560
  if (line5 === "" || displayWidth(line5) <= maxCols) {
39561
+ if (!room()) {
39562
+ mark2("");
39563
+ return { lines: out, truncated: true };
39564
+ }
39565
+ if (out.length + 1 === bounded && laterLine) {
39566
+ mark2(line5);
39567
+ return { lines: out, truncated: true };
39568
+ }
39545
39569
  out.push(line5);
39546
39570
  continue;
39547
39571
  }
39548
39572
  if (/^[\x20-\x7e]*$/u.test(line5)) {
39549
39573
  for (let i2 = 0; i2 < line5.length; i2 += maxCols) {
39550
- out.push(line5.slice(i2, i2 + maxCols));
39574
+ const piece = line5.slice(i2, i2 + maxCols);
39575
+ const continues = i2 + maxCols < line5.length || laterLine;
39576
+ if (!room()) {
39577
+ mark2(piece);
39578
+ return { lines: out, truncated: true };
39579
+ }
39580
+ if (out.length + 1 === bounded && continues) {
39581
+ mark2(piece);
39582
+ return { lines: out, truncated: true };
39583
+ }
39584
+ out.push(piece);
39551
39585
  }
39552
39586
  continue;
39553
39587
  }
39554
39588
  let curLine = "";
39555
39589
  let curCols = 0;
39556
- for (const { segment: segment2 } of GRAPHEME.segment(line5)) {
39590
+ const segments = [...GRAPHEME.segment(line5)];
39591
+ for (let segmentIndex = 0; segmentIndex < segments.length; segmentIndex += 1) {
39592
+ const segment2 = segments[segmentIndex]?.segment ?? "";
39557
39593
  const width = displayWidth(segment2);
39558
- if (curCols + width > maxCols && curLine !== "") {
39559
- out.push(curLine);
39560
- curLine = segment2;
39561
- curCols = width;
39562
- } else {
39594
+ if (curCols + width <= maxCols || curLine === "") {
39563
39595
  curLine += segment2;
39564
39596
  curCols += width;
39597
+ continue;
39598
+ }
39599
+ if (!room()) {
39600
+ mark2(curLine);
39601
+ return { lines: out, truncated: true };
39565
39602
  }
39603
+ const continues = segmentIndex < segments.length || laterLine;
39604
+ if (out.length + 1 === bounded && continues) {
39605
+ mark2(curLine);
39606
+ return { lines: out, truncated: true };
39607
+ }
39608
+ out.push(curLine);
39609
+ curLine = segment2;
39610
+ curCols = width;
39566
39611
  }
39567
39612
  if (curLine !== "") {
39613
+ if (!room()) {
39614
+ mark2(curLine);
39615
+ return { lines: out, truncated: true };
39616
+ }
39617
+ if (out.length + 1 === bounded && laterLine) {
39618
+ mark2(curLine);
39619
+ return { lines: out, truncated: true };
39620
+ }
39568
39621
  out.push(curLine);
39569
39622
  }
39570
39623
  }
39571
- return out;
39624
+ return { lines: out, truncated: false };
39572
39625
  }
39573
39626
 
39574
39627
  // packages/tui/tui-render/src/terminal-capabilities.ts
@@ -56347,6 +56400,14 @@ function transcriptBlockId(row) {
56347
56400
  function transcriptBlockVersion(row, revisions) {
56348
56401
  return revisions.revision(row.kind === "compaction" ? row.divider : row.message);
56349
56402
  }
56403
+ function settledProjectionSignature(row, revisions, options) {
56404
+ return [
56405
+ transcriptBlockVersion(row, revisions),
56406
+ options.hasSubsequent ? "gap" : "tail",
56407
+ options.isLatestAssistant ? "latest" : "",
56408
+ options.expandedCompactionId ?? ""
56409
+ ].join("\0");
56410
+ }
56350
56411
  function activeTurnVersion(turn, revisions) {
56351
56412
  return revisions.revision(turn, [
56352
56413
  turn.assistantText,
@@ -56880,6 +56941,9 @@ function StreamView({
56880
56941
  const viewportRef = (0, import_react37.useRef)(null);
56881
56942
  const layoutCache = (0, import_react37.useRef)(new TranscriptLayoutCache());
56882
56943
  const projectorStates = (0, import_react37.useRef)(/* @__PURE__ */ new Map());
56944
+ const settledProjectionCache = (0, import_react37.useRef)(/* @__PURE__ */ new Map());
56945
+ const settledProjectionScope = (0, import_react37.useRef)("");
56946
+ const settledProjectionPresenters = (0, import_react37.useRef)(void 0);
56883
56947
  const rebuildBlocks = (0, import_react37.useRef)(/* @__PURE__ */ new Map());
56884
56948
  const lineStore = (0, import_react37.useRef)(void 0);
56885
56949
  if (lineStore.current === void 0) {
@@ -57059,6 +57123,24 @@ function StreamView({
57059
57123
  );
57060
57124
  const hasActiveTurn = activeTurn !== void 0;
57061
57125
  const settledEntryRows = (0, import_react37.useMemo)(() => {
57126
+ const projectionScope = [
57127
+ settledBlockRowsScope.scopeKey,
57128
+ settledAssistantBlockRowsScope.scopeKey,
57129
+ reasoningExpanded ? "r1" : "r0",
57130
+ toolCardsExpanded ? "t1" : "t0",
57131
+ mode,
57132
+ locale
57133
+ ].join("\0");
57134
+ if (settledProjectionScope.current !== projectionScope) {
57135
+ settledProjectionCache.current = /* @__PURE__ */ new Map();
57136
+ settledProjectionScope.current = projectionScope;
57137
+ }
57138
+ if (settledProjectionPresenters.current !== presenters) {
57139
+ settledProjectionCache.current = /* @__PURE__ */ new Map();
57140
+ settledProjectionPresenters.current = presenters;
57141
+ }
57142
+ const previousCache = settledProjectionCache.current;
57143
+ const nextCache = /* @__PURE__ */ new Map();
57062
57144
  const definitions = /* @__PURE__ */ new Map();
57063
57145
  const batchPresenters = presenters === void 0 ? void 0 : { get(name2) {
57064
57146
  if (!definitions.has(name2)) definitions.set(name2, presenters.get(name2));
@@ -57075,6 +57157,24 @@ function StreamView({
57075
57157
  const latestAssistant = hasActiveTurn ? void 0 : latestAssistantId(history, void 0);
57076
57158
  for (const [index2, row] of transcript.entries()) {
57077
57159
  const id = transcriptBlockId(row);
57160
+ const hasSubsequent = index2 < transcript.length - 1 || hasActiveTurn;
57161
+ const cached2 = previousCache.get(id);
57162
+ const signature = settledProjectionSignature(row, revisions, {
57163
+ hasSubsequent,
57164
+ isLatestAssistant: row.kind === "message" && row.message.id === latestAssistant,
57165
+ expandedCompactionId
57166
+ });
57167
+ if (cached2?.signature === signature) {
57168
+ map2.set(id, cached2.lines);
57169
+ if (cached2.textRanges !== void 0) textRanges.set(id, cached2.textRanges);
57170
+ if (cached2.reasoningSticky !== void 0) reasoningSticky.set(id, cached2.reasoningSticky);
57171
+ if (cached2.toolSticky !== void 0) toolSticky.set(id, [...cached2.toolSticky]);
57172
+ if (cached2.userSticky !== void 0) userSticky.set(id, cached2.userSticky);
57173
+ for (const block of cached2.storeBlocks) storeBlocks.set(block.entry.id, block);
57174
+ nextCache.set(id, cached2);
57175
+ continue;
57176
+ }
57177
+ const blocksBefore = storeBlocks.size;
57078
57178
  if (row.kind === "compaction") {
57079
57179
  const meta3 = {
57080
57180
  compactionSummary: row.divider.summary,
@@ -57089,10 +57189,18 @@ function StreamView({
57089
57189
  meta: meta3
57090
57190
  }, settledBlockRowsScope, void 0, false);
57091
57191
  map2.set(id, projection.lines);
57192
+ nextCache.set(id, {
57193
+ signature,
57194
+ lines: projection.lines,
57195
+ textRanges: void 0,
57196
+ storeBlocks: [...storeBlocks.values()].slice(blocksBefore),
57197
+ reasoningSticky: void 0,
57198
+ toolSticky: void 0,
57199
+ userSticky: void 0
57200
+ });
57092
57201
  continue;
57093
57202
  }
57094
57203
  if (row.message.kind === "user") {
57095
- const hasSubsequent = index2 < transcript.length - 1 || hasActiveTurn;
57096
57204
  const projection = project(id, {
57097
57205
  id,
57098
57206
  kind: "user",
@@ -57100,7 +57208,17 @@ function StreamView({
57100
57208
  ...hasSubsequent ? { meta: { userMessageGap: true } } : {}
57101
57209
  }, settledBlockRowsScope, void 0, false);
57102
57210
  map2.set(id, projection.lines);
57103
- userSticky.set(id, { start: 0, end: projection.lines.length, text: row.message.text });
57211
+ const sticky = { start: 0, end: projection.lines.length, text: row.message.text };
57212
+ userSticky.set(id, sticky);
57213
+ nextCache.set(id, {
57214
+ signature,
57215
+ lines: projection.lines,
57216
+ textRanges: void 0,
57217
+ storeBlocks: [...storeBlocks.values()].slice(blocksBefore),
57218
+ reasoningSticky: void 0,
57219
+ toolSticky: void 0,
57220
+ userSticky: sticky
57221
+ });
57104
57222
  continue;
57105
57223
  }
57106
57224
  const parts = displayedParts(
@@ -57204,9 +57322,20 @@ function StreamView({
57204
57322
  meta: tailMeta
57205
57323
  }, settledBlockRowsScope, void 0, false).lines);
57206
57324
  }
57207
- map2.set(id, rows2.build());
57325
+ const built = rows2.build();
57326
+ map2.set(id, built);
57208
57327
  if (ranges.length > 0) textRanges.set(id, ranges);
57328
+ nextCache.set(id, {
57329
+ signature,
57330
+ lines: built,
57331
+ textRanges: ranges.length > 0 ? ranges : void 0,
57332
+ storeBlocks: [...storeBlocks.values()].slice(blocksBefore),
57333
+ reasoningSticky: reasoningSticky.get(id),
57334
+ toolSticky: toolSticky.get(id),
57335
+ userSticky: void 0
57336
+ });
57209
57337
  }
57338
+ settledProjectionCache.current = nextCache;
57210
57339
  return { rows: map2, textRanges, storeBlocks, reasoningSticky, toolSticky, userSticky };
57211
57340
  }, [
57212
57341
  contentWidth,
@@ -58990,8 +59119,116 @@ var SETTINGS_GROUP_LABELS = {
58990
59119
  other: "\u5176\u4ED6"
58991
59120
  };
58992
59121
 
58993
- // packages/tui/tui-render/src/settings-pane.tsx
59122
+ // packages/tui/tui-render/src/settings-browser.tsx
58994
59123
  var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
59124
+ function fit(text4, width) {
59125
+ const safe = escapeContent(text4).replace(/\n/gu, " \u21B5 ");
59126
+ return displayWidth(safe) <= width ? safe : `${wcwidthSafeSlice(safe, Math.max(0, width - 1))}\u2026`;
59127
+ }
59128
+ function canToggleSetting(row) {
59129
+ return row !== void 0 && row.navigable !== true && row.editable !== false && (row.value === "true" || row.value === "false" || row.namespace === "tui" && ["brandAnimation", "locale", "theme", "colorTier"].includes(row.field));
59130
+ }
59131
+ function tabLine(categories, activeId, width) {
59132
+ const active = Math.max(0, categories.findIndex((category) => category.id === activeId));
59133
+ let start = active;
59134
+ let end = active + 1;
59135
+ const label = (index2) => index2 === active ? `[${categories[index2].label}]` : ` ${categories[index2].label} `;
59136
+ const used = (from2, to2) => categories.slice(from2, to2).reduce((sum, _2, i2) => sum + displayWidth(escapeContent(label(from2 + i2))) + 1, 4);
59137
+ while (start > 0 || end < categories.length) {
59138
+ if (start > 0 && used(start - 1, end) <= width) {
59139
+ start--;
59140
+ continue;
59141
+ }
59142
+ if (end < categories.length && used(start, end + 1) <= width) {
59143
+ end++;
59144
+ continue;
59145
+ }
59146
+ break;
59147
+ }
59148
+ return [
59149
+ styled(start > 0 ? "\u2039 " : " ", "fgDim"),
59150
+ ...categories.slice(start, end).map((_2, index2) => styled(
59151
+ fit(label(start + index2), Math.max(1, width - 5)) + " ",
59152
+ start + index2 === active ? "accentText" : "fgDim",
59153
+ void 0,
59154
+ start + index2 === active
59155
+ )),
59156
+ styled(end < categories.length ? "\u203A" : "", "fgDim")
59157
+ ];
59158
+ }
59159
+ function fieldLabel(row, locale) {
59160
+ const label = row.label ?? row.field;
59161
+ if (row.namespace !== "tui" || label !== row.field) return label;
59162
+ if (row.field === "reasoning" || row.field === "scrollbar" || row.field === "statusDetails" || row.field === "locale") return `${tuiCopy(row.field, locale)} (${row.field})`;
59163
+ const names = { theme: "\u660E\u6697\u4E3B\u9898", brandAnimation: "\u54C1\u724C\u52A8\u753B", submitOnEnter: "\u56DE\u8F66\u53D1\u9001", colorTier: "\u8272\u5F69\u6863\u4F4D" };
59164
+ return locale !== "en-US" && names[row.field] !== void 0 ? `${names[row.field]} (${row.field})` : label;
59165
+ }
59166
+ function SettingsBrowser(props) {
59167
+ const { rows, selectedIndex, editing, updateError, busy, searching, filter = "", breadcrumb = ["\u8BBE\u7F6E"], categories = [], activeCategory, locale } = props;
59168
+ const width = Math.max(1, props.columns);
59169
+ const budget = Math.max(1, props.maxRows ?? 18);
59170
+ const selected = Math.max(0, Math.min(selectedIndex, rows.length - 1));
59171
+ const active = rows[selected];
59172
+ const compact = budget < 8;
59173
+ const filtered = filter !== "" || searching === true;
59174
+ const category = categories.find((entry) => entry.id === activeCategory)?.label ?? breadcrumb[1];
59175
+ const back = breadcrumb.length > 2 ? "\u8FD4\u56DE" : "\u5173\u95ED";
59176
+ const action = active?.navigable === true ? "\u8FDB\u5165" : active?.editable === false ? "\u53EA\u8BFB" : canToggleSetting(active) ? "\u5207\u6362" : "\u7F16\u8F91";
59177
+ const primary = action === "\u53EA\u8BFB" ? action : `Enter ${action}`;
59178
+ let footer = busy === true ? ["\u6B63\u5728\u5904\u7406\uFF0C\u8BF7\u7A0D\u5019\u2026"] : editing ? ["Enter \u4FDD\u5B58 \xB7 Esc \u53D6\u6D88"] : searching === true ? ["\u2191\u2193 \u9009\u62E9 \xB7 Enter \u5B8C\u6210\u641C\u7D22 \xB7 Esc \u6E05\u9664", "Tab/Shift+Tab \u5206\u7C7B"] : compact ? [`${primary} \xB7 Esc ${back}`] : width < 80 ? [`\u2191\u2193 \u9009\u62E9 \xB7 ${primary} \xB7 Esc ${back}`, `Tab \u5206\u7C7B \xB7 / \u641C\u7D22${active?.navigable === true && active.editable !== false ? " \xB7 i JSON" : ""}`] : [`\u2191\u2193 \u9009\u62E9 \xB7 PgUp/PgDn \u7FFB\u9875 \xB7 ${primary} \xB7 \u2190/Esc ${back}`, `Tab/Shift+Tab \u5206\u7C7B \xB7 / \u641C\u7D22${active?.navigable === true && active.editable !== false ? " \xB7 i JSON \u7F16\u8F91" : canToggleSetting(active) ? " \xB7 Space \u5207\u6362" : ""} \xB7 e \u5BFC\u51FA \xB7 r \u91CD\u8F7D`];
59179
+ if (budget <= 2) footer = [];
59180
+ const lines = [];
59181
+ const add = (text4, token = "fg", bold = false, bg = "bg") => lines.push({ parts: [styled(fit(text4, width), token, void 0, bold)], bg });
59182
+ const count = `${rows.length === 0 ? 0 : selected + 1}/${rows.length}`;
59183
+ const title = compact && category !== void 0 ? `[${category}]` : "\u8BBE\u7F6E";
59184
+ add(`${fit(title, Math.max(1, width - displayWidth(count) - 2))} ${count}`, "fg", true);
59185
+ const showTabs = !compact && categories.length > 0;
59186
+ if (showTabs) lines.push({ parts: tabLine(categories, activeCategory, width), bg: "bg" });
59187
+ if (!compact) {
59188
+ const path2 = breadcrumb.slice(showTabs ? 2 : 1).join(" \u203A ") || category || "\u9009\u62E9\u5206\u7C7B";
59189
+ const location = displayWidth(escapeContent(path2)) <= width ? path2 : `\u2026 \u203A ${breadcrumb.slice(-2).join(" \u203A ")}`;
59190
+ add(filtered ? `\u641C\u7D22\u7ED3\u679C /${filter}${searching === true ? "\u258F" : ""}` : location, filtered ? "accentText" : "fgDim");
59191
+ } else if (searching === true) {
59192
+ lines[0] = { parts: [styled(fit(`\u641C\u7D22 /${filter}\u258F`, width), "accentText")], bg: "bg" };
59193
+ }
59194
+ const status = updateError !== void 0 ? `\u2717 \u66F4\u65B0\u5931\u8D25\uFF1A${updateError}` : busy === true ? "\u6B63\u5728\u5904\u7406\u8BBE\u7F6E\u2026" : void 0;
59195
+ const space = Math.max(0, budget - lines.length - footer.length - (status === void 0 ? 0 : 1));
59196
+ const detail = [];
59197
+ const detailBudget = compact || active === void 0 ? 0 : Math.min(6, Math.max(0, space - Math.min(3, Math.max(1, rows.length))));
59198
+ if (active !== void 0 && detailBudget > 0) {
59199
+ const source = filtered ? `${active.namespace} \xB7 ${active.field}` : fieldLabel(active, locale);
59200
+ const pushBounded = (text4, limit) => {
59201
+ if (limit <= 0 || detail.length >= detailBudget) return;
59202
+ const room = Math.min(limit, detailBudget - detail.length);
59203
+ const wrapped = wrapDisplayLinesLimited(escapeContent(text4), width, room);
59204
+ detail.push(...wrapped.lines);
59205
+ };
59206
+ pushBounded(`\u5F53\u524D\u9879: ${source}`, filtered ? 2 : 1);
59207
+ const value = active.value === "" ? "\u2014" : active.value;
59208
+ pushBounded(`${active.navigable === true ? "\u5305\u542B" : "\u5F53\u524D\u503C"}: ${value}`, detailBudget);
59209
+ if (active.description !== void 0) pushBounded(active.description, detailBudget);
59210
+ }
59211
+ const size = Math.min(rows.length, Math.max(0, space - detail.length));
59212
+ const start = Math.max(0, Math.min(rows.length - size, selected - Math.floor(size / 2)));
59213
+ if (size === 0 && space > detail.length) add(filtered ? "\u6CA1\u6709\u5339\u914D\u7684\u8BBE\u7F6E \xB7 Esc \u6E05\u9664\u641C\u7D22" : "\u65E0\u53EF\u7528\u8BBE\u7F6E", "fgDim");
59214
+ for (const [offset, row] of rows.slice(start, start + size).entries()) {
59215
+ const isSelected = start + offset === selected;
59216
+ const rawValue = row.value === "true" ? "\u2713 \u5F00\u542F" : row.value === "false" ? "\u25CB \u5173\u95ED" : row.value;
59217
+ const value = rawValue || (row.navigable === true ? "\u6253\u5F00 \u203A" : "\u2014");
59218
+ const labelWidth = Math.max(1, Math.min(44, Math.floor((width - 4) * 0.45)));
59219
+ const label = fit(`${fieldLabel(row, locale)}${row.required === true ? " *" : ""}`, labelWidth);
59220
+ const gap = Math.max(2, labelWidth - displayWidth(label) + 2);
59221
+ const text4 = `${isSelected ? "\u203A " : " "}${label}${" ".repeat(gap)}${fit(`${row.navigable === true ? "\u203A " : ""}${value}`, Math.max(1, width - 2 - displayWidth(label) - gap))}`;
59222
+ add(text4, isSelected ? "fg" : "fgSoft", isSelected, isSelected ? "settingsCardBg" : "bg");
59223
+ }
59224
+ for (const text4 of detail) add(text4, "fgDim");
59225
+ if (status !== void 0) add(status, updateError === void 0 ? "fgDim" : "error");
59226
+ for (const text4 of footer) add(text4, "fgDim");
59227
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: lines.slice(0, budget).map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { height: 1, flexShrink: 0, width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { wrap: "truncate-end", children: paintBackgroundRow(line5.parts, line5.bg, width) }) }, index2)) });
59228
+ }
59229
+
59230
+ // packages/tui/tui-render/src/settings-pane.tsx
59231
+ var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
58995
59232
  var TITLE2 = "\u8BBE\u7F6E";
58996
59233
  var ONBOARDING_TITLE = "\u9996\u6B21\u8BBE\u7F6E";
58997
59234
  var EDIT_FOOTNOTE = "Enter \u5E94\u7528 \xB7 Esc \u53D6\u6D88";
@@ -59086,57 +59323,56 @@ function SettingsPane({
59086
59323
  maxRows,
59087
59324
  breadcrumb,
59088
59325
  filter,
59089
- searching
59326
+ searching,
59327
+ categories,
59328
+ activeCategory
59090
59329
  }) {
59091
59330
  const { columns } = use_window_size_default();
59092
59331
  const width = columns > 0 ? columns : 80;
59332
+ if (breadcrumb !== void 0 && onboarding !== true) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
59333
+ SettingsBrowser,
59334
+ {
59335
+ rows,
59336
+ selectedIndex,
59337
+ editing,
59338
+ columns: width,
59339
+ breadcrumb,
59340
+ ...locale === void 0 ? {} : { locale },
59341
+ ...filter === void 0 ? {} : { filter },
59342
+ ...searching === void 0 ? {} : { searching },
59343
+ ...categories === void 0 ? {} : { categories },
59344
+ ...activeCategory === void 0 ? {} : { activeCategory },
59345
+ ...maxRows === void 0 ? {} : { maxRows },
59346
+ ...updateError === void 0 ? {} : { updateError },
59347
+ ...busy === void 0 ? {} : { busy }
59348
+ }
59349
+ );
59093
59350
  const selected = Math.min(Math.max(0, selectedIndex), Math.max(0, rows.length - 1));
59094
59351
  const active = rows[selected];
59095
59352
  const errorReason2 = updateError ?? (rows.length === 0 ? EMPTY_TABLE_REASON2 : void 0);
59096
- const hierarchy = breadcrumb !== void 0;
59097
- const escapeHint = (breadcrumb?.length ?? 0) > 1 ? "Esc \u8FD4\u56DE" : "Esc \u5173\u95ED";
59098
- let footer = searching === true ? ["\u8F93\u5165\u641C\u7D22 \xB7 Enter \u786E\u5B9A \xB7 Esc \u6E05\u9664"] : onboarding === true ? [editing ? ONBOARDING_FOOTNOTE : "\u2191\u2193 \u9009\u62E9\u5BC6\u94A5 \xB7 Enter \u8F93\u5165 \xB7 Esc \u5173\u95ED"] : editing ? [EDIT_FOOTNOTE] : !hierarchy ? ["\u2191\u2193/jk \u9009\u62E9 \xB7 Enter \u7F16\u8F91 \xB7 e \u5BFC\u51FA \xB7 r \u91CD\u8F7D \xB7 Esc \u5173\u95ED"] : width < 80 ? ["\u2191\u2193 \u9009\u62E9 Enter \u6253\u5F00 \u2190 \u8FD4\u56DE", `/ \u641C\u7D22 i \u7F16\u8F91 Tab \u5206\u7C7B ${escapeHint}`] : ["\u2191\u2193/jk \u9009\u62E9 \xB7 Enter \u8FDB\u5165/\u7F16\u8F91 \xB7 \u2190 \u8FD4\u56DE \xB7 / \u641C\u7D22", `i JSON\u7F16\u8F91 \xB7 Space \u5207\u6362 \xB7 Tab \u5206\u7C7B \xB7 e \u5BFC\u51FA \xB7 r \u91CD\u8F7D \xB7 ${escapeHint}`];
59099
- const budget = maxRows ?? SETTINGS_WINDOW + 10;
59100
- const compact = hierarchy && budget < 8;
59101
- if (compact && footer.length > 1) footer = [`Enter \u6253\u5F00 \u2190\u8FD4\u56DE /\u641C\u7D22 ${escapeHint}`];
59102
- const hasSearch = !compact && (searching === true || filter !== void 0 && filter !== "");
59103
- const errorLines = errorReason2 === void 0 ? 0 : errorReason2 === EMPTY_TABLE_REASON2 || compact ? 1 : 2;
59104
- const showBusy = busy === true && (!compact || errorReason2 === void 0 && budget >= 5);
59105
- let room = budget - 1 - footer.length - errorLines - (hasSearch ? 1 : 0) - (showBusy ? 1 : 0) - 1;
59106
- const selectedValue = hierarchy && active !== void 0 && room-- > 0;
59107
- const description = hierarchy && room-- > 0 ? active?.description : void 0;
59108
- const fixed = 1 + footer.length + (selectedValue ? 1 : 0) + (description === void 0 ? 0 : 1) + errorLines + (hasSearch ? 1 : 0) + (showBusy ? 1 : 0);
59109
- const available = Math.max(1, budget - fixed);
59110
- const showOverflow = !compact && available >= 3;
59111
- const size = hierarchy ? Math.min(rows.length, rows.length > available && showOverflow ? available - 2 : available, maxRows === void 0 ? SETTINGS_WINDOW : rows.length) : Math.min(rows.length, computeSettingsWindow(maxRows, rows.length, errorReason2, busy === true));
59353
+ const footer = onboarding === true ? [editing ? ONBOARDING_FOOTNOTE : "\u2191\u2193 \u9009\u62E9\u5BC6\u94A5 \xB7 Enter \u8F93\u5165 \xB7 Esc \u5173\u95ED"] : [editing ? EDIT_FOOTNOTE : "\u2191\u2193/jk \u9009\u62E9 \xB7 Enter \u7F16\u8F91 \xB7 e \u5BFC\u51FA \xB7 r \u91CD\u8F7D \xB7 Esc \u5173\u95ED"];
59354
+ const size = Math.min(rows.length, computeSettingsWindow(maxRows, rows.length, errorReason2, busy === true));
59112
59355
  const start = Math.min(Math.max(0, selected - Math.floor(size / 2)), Math.max(0, rows.length - size));
59113
- const renderLine = (text4, token, bold = false) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { width: "100%", height: 1, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { wrap: "truncate-end", children: paintBackgroundRow([styled(fitValue(escapeContent(text4), width), token, void 0, bold)], "settingsCardBg", width) }) });
59114
- let heading = hierarchy ? breadcrumb.join(" \u203A ") : active === void 0 ? TITLE2 : `${TITLE2} \xB7 ${SETTINGS_GROUP_LABELS[settingsGroup(active)]}`;
59115
- if (displayWidth(escapeContent(heading)) > width && hierarchy) {
59116
- heading = `\u8BBE\u7F6E \u203A \u2026 \u203A ${breadcrumb[breadcrumb.length - 1] ?? ""}`;
59117
- }
59118
- if (compact && searching === true) heading = `\u641C\u7D22 /${filter ?? ""}`;
59356
+ const renderLine = (text4, token, bold = false) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box_default, { width: "100%", height: 1, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { wrap: "truncate-end", children: paintBackgroundRow([styled(fitValue(escapeContent(text4), width), token, void 0, bold)], "settingsCardBg", width) }) });
59357
+ let heading = active === void 0 ? TITLE2 : `${TITLE2} \xB7 ${SETTINGS_GROUP_LABELS[settingsGroup(active)]}`;
59119
59358
  if (onboarding === true) heading = rows.length > 1 ? "API \u5BC6\u94A5" : ONBOARDING_TITLE;
59120
- const counter = rows.length === 0 ? "" : `${!hierarchy && active !== void 0 ? `${active.namespace} \xB7 ` : ""}${String(selected + 1)}/${String(rows.length)}`;
59359
+ const counter = rows.length === 0 ? "" : `${active !== void 0 ? `${active.namespace} \xB7 ` : ""}${String(selected + 1)}/${String(rows.length)}`;
59121
59360
  if (counter !== "") heading = `${fitValue(escapeContent(heading), Math.max(1, width - displayWidth(counter) - 2))} ${counter}`;
59122
59361
  const localizedLabel = (row) => {
59123
59362
  if (row.label !== void 0 && !(row.namespace === "tui" && row.label === row.field)) return row.label;
59124
59363
  const resolved = locale ?? "zh-CN";
59125
59364
  const label = row.namespace === "tui" && (row.field === "reasoning" || row.field === "scrollbar" || row.field === "statusDetails" || row.field === "locale") ? `${row.field} \xB7 ${tuiCopy(row.field, locale)}` : row.namespace === "tui" && row.field in TUI_EXTRA_LABELS ? `${row.field} \xB7 ${TUI_EXTRA_LABELS[row.field][resolved === "en-US" ? "en-US" : "zh-CN"]}` : row.field === "apiKeyEnv" ? `${row.field} \xB7 \u73AF\u5883\u53D8\u91CF\u540D` : row.field;
59126
- return hierarchy ? label : `${row.namespace} \xB7 ${label}`;
59365
+ return `${row.namespace} \xB7 ${label}`;
59127
59366
  };
59128
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59367
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59129
59368
  renderLine(heading, "fg", true),
59130
- hasSearch ? renderLine(`\u641C\u7D22 /${filter ?? ""}${searching === true ? "\u258F" : ""}`, "accent") : null,
59131
- start > 0 && (!hierarchy || showOverflow) ? renderLine(`\u2191 \u4E0A\u65B9\u8FD8\u6709 ${String(start)} \u9879 (\u2026 \u8FD8\u6709 ${String(start)} \u9879)`, "fgDim") : null,
59132
- rows.slice(start, start + size).map((row, index2) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { width: "100%", height: 1, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { wrap: "truncate-end", children: paintBackgroundRow(fieldRow(localizedLabel(row), `${row.navigable === true ? "\u203A " : ""}${row.value}`, start + index2 === selected, width, row.required === true), "settingsCardBg", width) }) }, `${row.namespace}:${JSON.stringify(row.sourcePath ?? row.field)}:${String(start + index2)}`)),
59133
- rows.length > start + size && (!hierarchy || showOverflow) ? renderLine(`\u2026 \u8FD8\u6709 ${String(rows.length - start - size)} \u9879`, "fgDim") : null,
59134
- selectedValue ? renderLine(`\u503C: ${active.value === "" ? "\u2014" : active.value}`, "fg") : null,
59135
- description === void 0 ? null : renderLine(description, "fgDim"),
59369
+ start > 0 ? renderLine(`\u2191 \u4E0A\u65B9\u8FD8\u6709 ${String(start)} \u9879 (\u2026 \u8FD8\u6709 ${String(start)} \u9879)`, "fgDim") : null,
59370
+ rows.slice(start, start + size).map((row, index2) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box_default, { width: "100%", height: 1, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { wrap: "truncate-end", children: paintBackgroundRow(fieldRow(localizedLabel(row), `${row.navigable === true ? "\u203A " : ""}${row.value}`, start + index2 === selected, width, row.required === true), "settingsCardBg", width) }) }, `${row.namespace}:${JSON.stringify(row.sourcePath ?? row.field)}:${String(start + index2)}`)),
59371
+ rows.length > start + size ? renderLine(`\u2026 \u8FD8\u6709 ${String(rows.length - start - size)} \u9879`, "fgDim") : null,
59136
59372
  errorReason2 === void 0 ? null : renderLine(errorReason2 === EMPTY_TABLE_REASON2 ? EMPTY_TABLE_REASON2 : `\u2717 \u66F4\u65B0\u5931\u8D25\uFF1A${errorReason2}`, "error"),
59137
- errorLines < 2 ? null : renderLine(FAIL_NEXT2, "fgDim"),
59138
- showBusy ? renderLine(DISCOVERY_BUSY, "fgDim") : null,
59139
- footer.map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { width: "100%", height: 1, flexShrink: 0, children: renderLine(line5, "fgDim") }, index2))
59373
+ errorReason2 === void 0 || errorReason2 === EMPTY_TABLE_REASON2 ? null : renderLine(FAIL_NEXT2, "fgDim"),
59374
+ busy === true ? renderLine(DISCOVERY_BUSY, "fgDim") : null,
59375
+ footer.map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box_default, { width: "100%", height: 1, flexShrink: 0, children: renderLine(line5, "fgDim") }, index2))
59140
59376
  ] });
59141
59377
  }
59142
59378
 
@@ -59187,7 +59423,7 @@ function tokenizeComposer(text4) {
59187
59423
  }
59188
59424
 
59189
59425
  // packages/tui/tui-render/src/input-bar.tsx
59190
- var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
59426
+ var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
59191
59427
  var PROMPT_WIDTH = 2;
59192
59428
  var COMPOSER_PLACEHOLDER = tuiCopy("inputHint");
59193
59429
  function InputBar({
@@ -59200,7 +59436,8 @@ function InputBar({
59200
59436
  modelChip,
59201
59437
  modeChip,
59202
59438
  locale,
59203
- secret
59439
+ secret,
59440
+ actionHint
59204
59441
  }) {
59205
59442
  const { text: text4, caretIndex } = maskComposerInput(sourceText, sourceCaretIndex ?? sourceText.length, secret);
59206
59443
  const selectionAnchor = sourceSelectionAnchor === void 0 ? void 0 : maskComposerInput(sourceText, sourceSelectionAnchor, secret).caretIndex;
@@ -59241,7 +59478,7 @@ function InputBar({
59241
59478
  const leftPrefix = "\u2502 ";
59242
59479
  const placeholder = tuiCopy("inputHint", locale);
59243
59480
  const sendHint = tuiCopy("sendHint", locale);
59244
- const modeHint = commandMode ? tuiCopy("commandModeHint", locale) : mentionMode ? tuiCopy("mentionModeHint", locale) : void 0;
59481
+ const modeHint = actionHint ?? (commandMode ? tuiCopy("commandModeHint", locale) : mentionMode ? tuiCopy("mentionModeHint", locale) : void 0);
59245
59482
  const leftHint = modeHint === void 0 ? `\u203A ${placeholder} \xB7 ${sendHint}` : `\u203A ${modeHint}`;
59246
59483
  const leftWidth = displayWidth(leftPrefix + leftHint);
59247
59484
  const chipWidth = chipText !== "" ? displayWidth(chipText) : 0;
@@ -59257,14 +59494,14 @@ function InputBar({
59257
59494
  styled(escapeContent(chipText), "fgDim")
59258
59495
  ] : []
59259
59496
  ];
59260
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
59497
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
59261
59498
  Box_default,
59262
59499
  {
59263
59500
  flexDirection: "column",
59264
59501
  width: "100%",
59265
59502
  backgroundColor: inkColor("inputBg"),
59266
59503
  children: [
59267
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow(headerParts, "inputBg", columns) }),
59504
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow(headerParts, "inputBg", columns) }),
59268
59505
  lines.map((line5, lineIndex) => {
59269
59506
  const window2 = windows[lineIndex];
59270
59507
  let sourceColumn = 0;
@@ -59288,7 +59525,7 @@ function InputBar({
59288
59525
  return selection !== void 0 && start + begin >= selection.start && start + begin < selection.end && visible !== "" && currentTier() !== "none" ? `\x1B[7m${painted}\x1B[27m` : painted;
59289
59526
  });
59290
59527
  });
59291
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow([
59528
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow([
59292
59529
  styled(escapeContent("\u2502 "), "accentText"),
59293
59530
  styled(escapeContent(lineIndex === 0 ? "> " : " "), "accentText"),
59294
59531
  ...window2.hiddenPrefix ? [styled("\u2039", "fgDim")] : [],
@@ -59301,7 +59538,7 @@ function InputBar({
59301
59538
  }
59302
59539
 
59303
59540
  // packages/tui/tui-render/src/agent-hub-pane.tsx
59304
- var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
59541
+ var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
59305
59542
  function formatTokens(value) {
59306
59543
  const scaled = (next) => next >= 100 ? String(Math.round(next)) : String(Math.round(next * 10) / 10);
59307
59544
  if (value < 1e3) return String(value);
@@ -59338,14 +59575,14 @@ function aggregateLine(rows) {
59338
59575
  }
59339
59576
  function hubRow(row, selected) {
59340
59577
  const label = [row.label, row.execution ?? (row.activity === "" ? void 0 : row.activity), ...metricSegments(row)].filter((value) => value !== void 0).join(" \xB7 ");
59341
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box_default, { width: "100%", flexDirection: "column", children: [
59342
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text, { wrap: "truncate", children: [
59578
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { width: "100%", flexDirection: "column", children: [
59579
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text, { wrap: "truncate", children: [
59343
59580
  selected ? styled(escapeContent("\u203A "), "accent", void 0, true) : " ",
59344
59581
  paintRow([styled(escapeContent(label), selected ? "fg" : "fgSoft", void 0, selected)])
59345
59582
  ] }),
59346
- row.task !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintRow([styled(` \u4EFB\u52A1 \xB7 ${escapeContent(row.task)}`, "fgSoft")]) }),
59347
- row.summary !== void 0 && row.summary !== "" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintRow([styled(` \u5F53\u524D \xB7 ${escapeContent(row.summary)}`, "accent")]) }),
59348
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintRow([styled(` ${escapeContent(`\u5B50\u4F1A\u8BDD ID \xB7 ${row.id}`)}`, "fgDim")]) })
59583
+ row.task !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(` \u4EFB\u52A1 \xB7 ${escapeContent(row.task)}`, "fgSoft")]) }),
59584
+ row.summary !== void 0 && row.summary !== "" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(` \u5F53\u524D \xB7 ${escapeContent(row.summary)}`, "accent")]) }),
59585
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(` ${escapeContent(`\u5B50\u4F1A\u8BDD ID \xB7 ${row.id}`)}`, "fgDim")]) })
59349
59586
  ] }, row.id);
59350
59587
  }
59351
59588
  function hubLimitsFootnote(liveContinuable, maxActiveSubagents, maxDepth) {
@@ -59391,7 +59628,7 @@ function AgentHubBody({
59391
59628
  if (view === "transcript") onViewportChange?.({ offset: start, maxOffset: maximum, pageRows: pageSize });
59392
59629
  }, [view, start, maximum, pageSize, onViewportChange]);
59393
59630
  if (missing) {
59394
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
59631
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
59395
59632
  OverlayShell,
59396
59633
  {
59397
59634
  title: "\u5B50\u4EE3\u7406",
@@ -59404,13 +59641,13 @@ function AgentHubBody({
59404
59641
  const selected = rows[clamped];
59405
59642
  const addressable = selected?.parentSessionId !== void 0 && selected.parentSessionId !== selected.id && selected.mode !== void 0;
59406
59643
  const controls = prompt === void 0 ? [addressable && selected.mode === "continuable" ? "c \u7EED\u804A" : "", addressable ? "s \u8BF7\u6C42\u505C\u6B62" : "", "v \u5E76\u6392"].filter(Boolean).join(" \xB7 ") : `Enter \u6392\u961F \xB7 Ctrl+Enter \u5F15\u5BFC \xB7 Esc \u53D6\u6D88${busy ? " \xB7 \u53D1\u9001\u4E2D" : ""}`;
59407
- const editor = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
59408
- notice !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(notice), "fgDim")]) }),
59409
- renderEditor && prompt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(InputBar, { text: prompt, caretIndex, commandMode: false, mentionMode: false })
59644
+ const editor = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
59645
+ notice !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(notice), "fgDim")]) }),
59646
+ renderEditor && prompt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(InputBar, { text: prompt, caretIndex, commandMode: false, mentionMode: false })
59410
59647
  ] });
59411
59648
  if (view === "transcript") {
59412
59649
  if (error51 !== void 0 && error51 !== "" && prompt === void 0) {
59413
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
59650
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
59414
59651
  OverlayShell,
59415
59652
  {
59416
59653
  title: "\u5B50\u4EE3\u7406",
@@ -59428,7 +59665,7 @@ function AgentHubBody({
59428
59665
  const total = lines.length;
59429
59666
  const slice = lines.slice(start, start + pageSize);
59430
59667
  const scrollInfo = total > pageSize ? ` (${String(start + 1)}-${String(Math.min(start + slice.length, total))}/${String(total)})` : "";
59431
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
59668
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
59432
59669
  OverlayShell,
59433
59670
  {
59434
59671
  title: "\u5B50\u4EE3\u7406",
@@ -59438,10 +59675,10 @@ ${controls}
59438
59675
  Esc \u8FD4\u56DE \xB7 ${scrollOffset === Number.MAX_SAFE_INTEGER ? "\u8DDF\u968F\u6700\u65B0" : "\u9605\u8BFB\u4E2D"}${scrollInfo}
59439
59676
  ${split ? "\u5E76\u6392\u67E5\u770B" : "\u53EA\u8BFB\u67E5\u770B"}\uFF0C\u4E3B\u4F1A\u8BDD\u7EE7\u7EED\u8FD0\u884C`,
59440
59677
  children: [
59441
- headerSegments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box_default, { width: "100%", flexDirection: "column", marginY: 0, children: [
59442
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(headerSegments.join(" \xB7 ")), "accent", void 0, true)]) }),
59443
- selectedRow?.id && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(`\u5B50\u4F1A\u8BDD ID \xB7 ${selectedRow.id}`), "fgDim")]) }),
59444
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { children: paintRow([styled(escapeContent("\u2500\u2500\u2500 \u6267\u884C\u60C5\u51B5 \u2500\u2500\u2500"), "fgDim")]) })
59678
+ headerSegments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { width: "100%", flexDirection: "column", marginY: 0, children: [
59679
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(headerSegments.join(" \xB7 ")), "accent", void 0, true)]) }),
59680
+ selectedRow?.id && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(`\u5B50\u4F1A\u8BDD ID \xB7 ${selectedRow.id}`), "fgDim")]) }),
59681
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: paintRow([styled(escapeContent("\u2500\u2500\u2500 \u6267\u884C\u60C5\u51B5 \u2500\u2500\u2500"), "fgDim")]) })
59445
59682
  ] }),
59446
59683
  slice.map((lineText, index2) => {
59447
59684
  const isUser = lineText.startsWith("> ");
@@ -59452,7 +59689,7 @@ ${split ? "\u5E76\u6392\u67E5\u770B" : "\u53EA\u8BFB\u67E5\u770B"}\uFF0C\u4E3B\u
59452
59689
  if (isUser) token = "accent";
59453
59690
  else if (isTool) token = "codeKeyword";
59454
59691
  else if (isResult || isTurn) token = "fgDim";
59455
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { children: paintRow([styled(escapeContent(lineText), token)]) }, start + index2);
59692
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: paintRow([styled(escapeContent(lineText), token)]) }, start + index2);
59456
59693
  }),
59457
59694
  editor
59458
59695
  ]
@@ -59460,7 +59697,7 @@ ${split ? "\u5E76\u6392\u67E5\u770B" : "\u53EA\u8BFB\u67E5\u770B"}\uFF0C\u4E3B\u
59460
59697
  );
59461
59698
  }
59462
59699
  if (error51 !== void 0 && error51 !== "" && prompt === void 0) {
59463
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
59700
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
59464
59701
  OverlayShell,
59465
59702
  {
59466
59703
  title: "\u5B50\u4EE3\u7406",
@@ -59470,7 +59707,7 @@ ${split ? "\u5E76\u6392\u67E5\u770B" : "\u53EA\u8BFB\u67E5\u770B"}\uFF0C\u4E3B\u
59470
59707
  );
59471
59708
  }
59472
59709
  if (rows.length === 0) {
59473
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
59710
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
59474
59711
  OverlayShell,
59475
59712
  {
59476
59713
  title: "\u5B50\u4EE3\u7406",
@@ -59487,7 +59724,7 @@ ${controls}`;
59487
59724
  const footerRows = wrapDisplayLines(footnote, columns || 80).length;
59488
59725
  const windowSize = Math.max(1, Math.floor((height - 9 - footerRows) / 4));
59489
59726
  const rowStart = Math.max(0, Math.min(rows.length - windowSize, clamped - Math.floor(windowSize / 2)));
59490
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
59727
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
59491
59728
  OverlayShell,
59492
59729
  {
59493
59730
  title: "\u5B50\u4EE3\u7406",
@@ -59495,18 +59732,18 @@ ${controls}`;
59495
59732
  footnote,
59496
59733
  children: [
59497
59734
  rows.slice(rowStart, rowStart + windowSize).map((row) => hubRow(row, row.id === rows[clamped]?.id)),
59498
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(aggregateLine(rows)), "fgDim")]) }),
59735
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(aggregateLine(rows)), "fgDim")]) }),
59499
59736
  editor
59500
59737
  ]
59501
59738
  }
59502
59739
  );
59503
59740
  }
59504
59741
  function AgentHubPane(props) {
59505
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Box_default, { width: props.maxCols ?? "100%", flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AgentHubBody, { ...props }) });
59742
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Box_default, { width: props.maxCols ?? "100%", flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AgentHubBody, { ...props }) });
59506
59743
  }
59507
59744
 
59508
59745
  // packages/tui/tui-render/src/plan-directory-pane.tsx
59509
- var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
59746
+ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
59510
59747
  var TITLE3 = "\u8BA1\u5212";
59511
59748
  var FOOTNOTE2 = "j/k \u9009\u62E9 \xB7 Enter \u5207\u6362 \xB7 Esc \u5173\u95ED";
59512
59749
  var SWITCH_NEXT = "\u5F53\u524D\u6A21\u5F0F\u4FDD\u6301\u4E0D\u53D8 \xB7 \u53EF\u91CD\u8BD5";
@@ -59519,13 +59756,13 @@ var EMPTY_PLAN_DIRECTORY_PANE = {
59519
59756
  };
59520
59757
  function directoryRow(label, selected, current) {
59521
59758
  const text4 = current ? `${label} \xB7 \u5F53\u524D` : label;
59522
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { width: "100%", children: [
59523
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: selected ? styled(escapeContent("\u203A "), "accent", void 0, true) : " " }),
59524
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: paintRow([styled(escapeContent(text4), selected ? "fg" : "fgDim")]) })
59759
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Box_default, { width: "100%", children: [
59760
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: selected ? styled(escapeContent("\u203A "), "accent", void 0, true) : " " }),
59761
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: paintRow([styled(escapeContent(text4), selected ? "fg" : "fgDim")]) })
59525
59762
  ] }, label);
59526
59763
  }
59527
59764
  function line3(text4, token) {
59528
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: paintRow([styled(escapeContent(text4), token)]) });
59765
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: paintRow([styled(escapeContent(text4), token)]) });
59529
59766
  }
59530
59767
  function PlanDirectoryPane({
59531
59768
  selectedIndex = 0,
@@ -59534,7 +59771,7 @@ function PlanDirectoryPane({
59534
59771
  statusError
59535
59772
  }) {
59536
59773
  if (statusError !== void 0 && statusError !== "") {
59537
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
59774
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
59538
59775
  OverlayShell,
59539
59776
  {
59540
59777
  title: TITLE3,
@@ -59543,7 +59780,7 @@ function PlanDirectoryPane({
59543
59780
  }
59544
59781
  );
59545
59782
  }
59546
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(OverlayShell, { title: TITLE3, footnote: FOOTNOTE2, children: [
59783
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(OverlayShell, { title: TITLE3, footnote: FOOTNOTE2, children: [
59547
59784
  ROWS.map(
59548
59785
  (label, index2) => directoryRow(
59549
59786
  label,
@@ -59551,7 +59788,7 @@ function PlanDirectoryPane({
59551
59788
  label === "\u5F00\u542F" ? currentActive : !currentActive
59552
59789
  )
59553
59790
  ),
59554
- switchError !== void 0 && switchError !== "" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59791
+ switchError !== void 0 && switchError !== "" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59555
59792
  line3(`\u2717 \u5207\u6362\u8BA1\u5212\u5931\u8D25\uFF1A${switchError}`, "error"),
59556
59793
  line3(SWITCH_NEXT, "fgDim")
59557
59794
  ] }) : null
@@ -59560,7 +59797,7 @@ function PlanDirectoryPane({
59560
59797
 
59561
59798
  // packages/tui/tui-render/src/plan-review-pane.tsx
59562
59799
  var import_react43 = __toESM(require_react(), 1);
59563
- var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
59800
+ var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
59564
59801
  var TITLE4 = "\u8BA1\u5212\u8BC4\u5BA1";
59565
59802
  var FOOTNOTE3 = "y \u6279\u51C6 \xB7 n \u7EE7\u7EED\u89C4\u5212 \xB7 Esc \u53D6\u6D88";
59566
59803
  var EMPTY_BODY = "\u8BA1\u5212\u6B63\u6587\u4E3A\u7A7A";
@@ -59570,7 +59807,7 @@ var EMPTY_PLAN_REVIEW_PANE = {
59570
59807
  open: false
59571
59808
  };
59572
59809
  function line4(text4, token, bold = false) {
59573
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(text4), token, void 0, bold)]) });
59810
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(text4), token, void 0, bold)]) });
59574
59811
  }
59575
59812
  function PlanReviewPane({
59576
59813
  plan = "",
@@ -59604,20 +59841,20 @@ ${DELIVERY_NEXT2}` : "", width);
59604
59841
  const view = failed ? errorView : planView;
59605
59842
  const position2 = view.total > 0 ? ` ${view.start + 1}\u2013${view.start + view.visible.length}/${view.total}` : "";
59606
59843
  let body;
59607
- if (failed) body = errorView.visible.map((text4, index2) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { wrap: "truncate", children: paintRow([styled(text4 || " ", "error")]) }, errorView.start + index2));
59844
+ if (failed) body = errorView.visible.map((text4, index2) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(text4 || " ", "error")]) }, errorView.start + index2));
59608
59845
  else if (plan.trim() === "") body = line4(EMPTY_BODY, "fg");
59609
- else body = planView.visible.map((row, index2) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { wrap: "truncate", children: row.spans.length === 0 ? " " : paintLineFromRenderLine(row, links) }, planView.start + index2));
59610
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59611
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { wrap: "truncate", children: paintRow([styled(TITLE4, "fg", void 0, true), styled(position2, "fgDim")]) }),
59846
+ else body = planView.visible.map((row, index2) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: row.spans.length === 0 ? " " : paintLineFromRenderLine(row, links) }, planView.start + index2));
59847
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59848
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(TITLE4, "fg", void 0, true), styled(position2, "fgDim")]) }),
59612
59849
  body,
59613
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { wrap: "truncate", children: paintRow([styled(" [y] ", "success", void 0, true), styled("\u6279\u51C6", "fg", void 0, true), styled(" (\u5F00\u59CB\u6267\u884C\u8BA1\u5212)", "fgDim")]) }),
59614
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { wrap: "truncate", children: paintRow([styled(" [n] ", "warning", void 0, true), styled("\u7EE7\u7EED\u89C4\u5212", "fg", void 0, true), styled(" (\u8FD4\u56DE\u8C03\u6574\u65B9\u6848)", "fgDim")]) }),
59850
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(" [y] ", "success", void 0, true), styled("\u6279\u51C6", "fg", void 0, true), styled(" (\u5F00\u59CB\u6267\u884C\u8BA1\u5212)", "fgDim")]) }),
59851
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(" [n] ", "warning", void 0, true), styled("\u7EE7\u7EED\u89C4\u5212", "fg", void 0, true), styled(" (\u8FD4\u56DE\u8C03\u6574\u65B9\u6848)", "fgDim")]) }),
59615
59852
  line4(width < 70 ? "\u2191\u2193/PgUp/PgDn \xB7 Home/End \xB7 Esc \u53D6\u6D88" : `${FOOTNOTE3} \xB7 \u2191\u2193/PgUp/PgDn \u6D4F\u89C8`, "fgDim")
59616
59853
  ] });
59617
59854
  }
59618
59855
 
59619
59856
  // packages/tui/tui-render/src/ask-user-pane.tsx
59620
- var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
59857
+ var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
59621
59858
  var FOOTNOTE4 = "Enter \u4F5C\u7B54 \xB7 Esc \u53D6\u6D88\u63D0\u95EE";
59622
59859
  var INVALID_TITLE = "\u2717 \u63D0\u95EE\u65E0\u6548";
59623
59860
  var INVALID_NEXT = "Esc \u53D6\u6D88";
@@ -59662,9 +59899,9 @@ function AskUserPane({
59662
59899
  const detailRows = useDialogTextRows(source, width);
59663
59900
  const view = useDialogWindow(detailRows, offset, limit, detailsOpen ? onOffsetChange : void 0);
59664
59901
  const progress = questionCount === void 0 ? "" : ` (${questionNumber}/${questionCount})`;
59665
- if (editingCustom && !detailsOpen) return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59666
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(`${escapeContent(header)}${progress}`, "fg", void 0, true)]) }),
59667
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
59902
+ if (editingCustom && !detailsOpen) return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59903
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([styled(`${escapeContent(header)}${progress}`, "fg", void 0, true)]) }),
59904
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
59668
59905
  InputBar,
59669
59906
  {
59670
59907
  text: (customText ?? "").replace(/[\r\n]/gu, "\u21B5"),
@@ -59674,10 +59911,10 @@ function AskUserPane({
59674
59911
  rowsBelow: customRowsBelow ?? 2
59675
59912
  }
59676
59913
  ),
59677
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled("Enter \u786E\u8BA4 \xB7 Tab \u5168\u6587 \xB7 Esc \u53D6\u6D88", "fgDim")]) })
59914
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([styled("Enter \u786E\u8BA4 \xB7 Tab \u5168\u6587 \xB7 Esc \u53D6\u6D88", "fgDim")]) })
59678
59915
  ] });
59679
59916
  if (options.length === 0 && !editingCustom) {
59680
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59917
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59681
59918
  renderPaneLine(INVALID_TITLE, "error", true),
59682
59919
  renderPaneLine(INVALID_NEXT, "fgDim")
59683
59920
  ] });
@@ -59685,28 +59922,28 @@ function AskUserPane({
59685
59922
  const start = Math.max(0, Math.min(options.length - limit, selected - Math.floor(limit / 2)));
59686
59923
  const position2 = detailsOpen ? ` ${view.start + 1}\u2013${view.start + view.visible.length}/${view.total}` : "";
59687
59924
  const heading = detailsOpen ? `\u63D0\u95EE\u5168\u6587${options.length === 0 ? progress : ` \xB7 \u9009\u9879 ${selected + 1}/${options.length}`}${position2}` : `${escapeContent(header || "\u8BF7\u9009\u62E9").replace(/\n/g, " \u21B5 ")}${progress}`;
59688
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59689
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(heading, "fg", void 0, true)]) }),
59690
- detailsOpen ? view.visible.map((text4, index2) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(text4 || " ", "fg")]) }, view.start + index2)) : options.slice(start, start + limit).map((label, index2) => {
59925
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59926
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([styled(heading, "fg", void 0, true)]) }),
59927
+ detailsOpen ? view.visible.map((text4, index2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([styled(text4 || " ", "fg")]) }, view.start + index2)) : options.slice(start, start + limit).map((label, index2) => {
59691
59928
  const actualIndex = start + index2;
59692
59929
  const active = actualIndex === selected;
59693
59930
  const marker = multiSelect ? selectedIndices?.includes(actualIndex) ? "[x] " : "[ ] " : "";
59694
59931
  const numbered = escapeContent(`${actualIndex + 1} ${marker}${label}`).replace(/\n/g, " \u21B5 ");
59695
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([
59932
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([
59696
59933
  styled(active ? "\u203A " : " ", "accent", void 0, active),
59697
59934
  styled(numbered, active ? "fg" : "fgDim", void 0, active)
59698
59935
  ]) }, actualIndex);
59699
59936
  }),
59700
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59701
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(editingCustom ? "Tab/Esc \u8FD4\u56DE\u8F93\u5165" : FOOTNOTE4, "fgDim")]) }),
59702
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(editingCustom ? "\u2191\u2193/jk \u6EDA\u52A8 \xB7 Home/End \u9996\u5C3E" : multiSelect ? "\u2191\u2193 \u79FB\u52A8 \xB7 Space \u591A\u9009 \xB7 c \u81EA\u5B9A\u4E49" : "\u2191\u2193/jk \u79FB\u52A8 \xB7 1-9 \u9009\u62E9 \xB7 c \u81EA\u5B9A\u4E49", "fgDim")]) }),
59703
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(editingCustom ? "PgUp/PgDn \u7FFB\u9875" : customText === void 0 ? "[i] \u5168\u6587 \xB7 PgUp/PgDn \u7FFB\u9875" : "\u5DF2\u6709\u81EA\u5B9A\u4E49\u56DE\u7B54 \xB7 [i] \u5168\u6587", "fgDim")]) })
59937
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59938
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([styled(editingCustom ? "Tab/Esc \u8FD4\u56DE\u8F93\u5165" : FOOTNOTE4, "fgDim")]) }),
59939
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([styled(editingCustom ? "\u2191\u2193/jk \u6EDA\u52A8 \xB7 Home/End \u9996\u5C3E" : multiSelect ? "\u2191\u2193 \u79FB\u52A8 \xB7 Space \u591A\u9009 \xB7 c \u81EA\u5B9A\u4E49" : "\u2191\u2193/jk \u79FB\u52A8 \xB7 1-9 \u9009\u62E9 \xB7 c \u81EA\u5B9A\u4E49", "fgDim")]) }),
59940
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([styled(editingCustom ? "PgUp/PgDn \u7FFB\u9875" : customText === void 0 ? "[i] \u5168\u6587 \xB7 PgUp/PgDn \u7FFB\u9875" : "\u5DF2\u6709\u81EA\u5B9A\u4E49\u56DE\u7B54 \xB7 [i] \u5168\u6587", "fgDim")]) })
59704
59941
  ] })
59705
59942
  ] });
59706
59943
  }
59707
59944
 
59708
59945
  // packages/tui/tui-render/src/timeline-view.tsx
59709
- var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
59946
+ var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
59710
59947
  var FIRST_LINE_MAX = 120;
59711
59948
  var TIMELINE_WINDOW = 60;
59712
59949
  function TimelineView({
@@ -59721,19 +59958,19 @@ function TimelineView({
59721
59958
  const start = Math.max(0, end - TIMELINE_WINDOW);
59722
59959
  const visible = history.slice(start, end);
59723
59960
  const current = end >= history.length ? visible.length - 1 : -1;
59724
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59725
- history.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: "\uFF08\u65E0\u5386\u53F2\u6D88\u606F\uFF09" }) : null,
59726
- start > 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { dimColor: true, children: [
59961
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59962
+ history.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { dimColor: true, children: "\uFF08\u65E0\u5386\u53F2\u6D88\u606F\uFF09" }) : null,
59963
+ start > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Text, { dimColor: true, children: [
59727
59964
  "\u2026 \u8FD8\u6709 ",
59728
59965
  start,
59729
59966
  " \u6761"
59730
59967
  ] }) : null,
59731
- visible.map((message, index2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { children: [
59968
+ visible.map((message, index2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Text, { children: [
59732
59969
  styled(relativeTime(message.timestamp, clock), "fgDim"),
59733
59970
  ` ${message.kind === "user" ? "> " : "\u25CF "}`,
59734
59971
  index2 === current ? styled(escapeContent(firstLine(message.text)), "accent") : escapeContent(firstLine(message.text))
59735
59972
  ] }, start + index2)),
59736
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { children: styled(escapeContent("\u2191\u2193/jk \u6EDA\u52A8 \xB7 Esc \u5173\u95ED"), "fgDim") })
59973
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { children: styled(escapeContent("\u2191\u2193/jk \u6EDA\u52A8 \xB7 Esc \u5173\u95ED"), "fgDim") })
59737
59974
  ] });
59738
59975
  }
59739
59976
  function firstLine(text4) {
@@ -59742,7 +59979,7 @@ function firstLine(text4) {
59742
59979
  }
59743
59980
 
59744
59981
  // packages/tui/tui-render/src/command-menu.tsx
59745
- var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
59982
+ var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
59746
59983
  var COMMAND_MENU_WINDOW = 8;
59747
59984
  var MARKER_COLS2 = 2;
59748
59985
  var NAME_GAP = 2;
@@ -59809,11 +60046,11 @@ function CommandMenu({
59809
60046
  const widthName = displayWidth(`/${item.name}`);
59810
60047
  if (widthName > nameCols) nameCols = widthName;
59811
60048
  }
59812
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box_default, { flexDirection: "column", alignItems: "center", width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box_default, { flexDirection: "column", width, children: matches.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box_default, { width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { children: paintRow(paletteRow(item, offset + index2 === clampedIndex, nameCols, width)) }) }, item.name)) }) });
60049
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box_default, { flexDirection: "column", alignItems: "center", width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box_default, { flexDirection: "column", width, children: matches.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box_default, { width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { children: paintRow(paletteRow(item, offset + index2 === clampedIndex, nameCols, width)) }) }, item.name)) }) });
59813
60050
  }
59814
60051
 
59815
60052
  // packages/tui/tui-render/src/mention.tsx
59816
- var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
60053
+ var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
59817
60054
  var KIND_LABELS = {
59818
60055
  file: "\u6587\u4EF6",
59819
60056
  directory: "\u76EE\u5F55",
@@ -59831,10 +60068,10 @@ function Mention({
59831
60068
  const { columns } = use_window_size_default();
59832
60069
  const width = conversationWidth(columns > 0 ? columns : 80);
59833
60070
  if (phase === "loading") {
59834
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box_default, { width: "100%", alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box_default, { width, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { dimColor: true, children: "\u52A0\u8F7D\u4E2D\u2026" }) }) });
60071
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width: "100%", alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { dimColor: true, children: "\u52A0\u8F7D\u4E2D\u2026" }) }) });
59835
60072
  }
59836
60073
  if (candidates.length === 0) {
59837
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box_default, { width: "100%", alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box_default, { width, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { dimColor: true, children: "\u65E0\u5339\u914D" }) }) });
60074
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width: "100%", alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { width, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { dimColor: true, children: "\u65E0\u5339\u914D" }) }) });
59838
60075
  }
59839
60076
  const clampedIndex = Math.max(0, Math.min(selectedIndex, candidates.length - 1));
59840
60077
  const sections = /* @__PURE__ */ new Map();
@@ -59850,12 +60087,12 @@ function Mention({
59850
60087
  let rowIndex = 0;
59851
60088
  for (const [kind, group] of sections) {
59852
60089
  rows.push(
59853
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { wrap: "truncate", children: styled(KIND_LABELS[kind], "accentText", void 0, true) }, kind)
60090
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { wrap: "truncate", children: styled(KIND_LABELS[kind], "accentText", void 0, true) }, kind)
59854
60091
  );
59855
60092
  for (const candidate of group) {
59856
60093
  const selected = rowIndex === clampedIndex;
59857
60094
  rows.push(
59858
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Text, { wrap: "truncate", children: [
60095
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { wrap: "truncate", children: [
59859
60096
  selected ? styled(escapeContent("\u203A "), "accent", void 0, true) : " ",
59860
60097
  styled(`@ ${escapeContent(candidate.name)}`, selected ? "fg" : "fgSoft", void 0, selected),
59861
60098
  candidate.description !== void 0 ? styled(` \u2014 ${escapeContent(candidate.description)}`, "fgDim") : ""
@@ -59864,7 +60101,7 @@ function Mention({
59864
60101
  rowIndex += 1;
59865
60102
  }
59866
60103
  }
59867
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box_default, { flexDirection: "column", alignItems: "center", width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box_default, { flexDirection: "column", width, children: rows }) });
60104
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { flexDirection: "column", alignItems: "center", width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box_default, { flexDirection: "column", width, children: rows }) });
59868
60105
  }
59869
60106
 
59870
60107
  // packages/tui/tui-render/src/goal-footer.ts
@@ -60248,7 +60485,7 @@ function layoutHud(input) {
60248
60485
  }
60249
60486
 
60250
60487
  // packages/tui/tui-render/src/workflow-overlay.tsx
60251
- var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
60488
+ var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
60252
60489
  var WORKFLOW_OVERLAY_WINDOW = 8;
60253
60490
  var EMPTY_WORKFLOW_OVERLAY = { open: false, offset: 0 };
60254
60491
  function WorkflowOverlay({
@@ -60256,15 +60493,15 @@ function WorkflowOverlay({
60256
60493
  }) {
60257
60494
  if (!state.open) return null;
60258
60495
  if (state.error !== void 0) {
60259
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u6D41", error: state.error, footnote: "Esc \u5173\u95ED" });
60496
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u6D41", error: state.error, footnote: "Esc \u5173\u95ED" });
60260
60497
  }
60261
60498
  if (state.run === void 0) {
60262
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u6D41", body: "\u5F53\u524D\u65E0\u5DE5\u4F5C\u6D41\u8FD0\u884C", footnote: "Esc \u5173\u95ED" });
60499
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u6D41", body: "\u5F53\u524D\u65E0\u5DE5\u4F5C\u6D41\u8FD0\u884C", footnote: "Esc \u5173\u95ED" });
60263
60500
  }
60264
60501
  const rows = [];
60265
60502
  if (state.run.phase !== void 0 && state.run.phase !== "") {
60266
60503
  rows.push(
60267
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { children: paintRow([styled(escapeContent(`\u9636\u6BB5 ${state.run.phase}`), "fg")]) }, "phase")
60504
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { children: paintRow([styled(escapeContent(`\u9636\u6BB5 ${state.run.phase}`), "fg")]) }, "phase")
60268
60505
  );
60269
60506
  }
60270
60507
  const windowed = state.run.members.slice(
@@ -60274,17 +60511,17 @@ function WorkflowOverlay({
60274
60511
  for (const member of windowed) {
60275
60512
  const outcomeSuffix = member.outcome === void 0 ? "" : ` \xB7 ${member.outcome}`;
60276
60513
  rows.push(
60277
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { children: paintRow([
60514
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { children: paintRow([
60278
60515
  styled(escapeContent(`${member.seq} \xB7 ${member.label}${outcomeSuffix}`), "fgDim")
60279
60516
  ]) }, member.seq)
60280
60517
  );
60281
60518
  }
60282
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u6D41", footnote: "j/k \u6EDA\u52A8 \xB7 Esc \u5173\u95ED", children: rows });
60519
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u6D41", footnote: "j/k \u6EDA\u52A8 \xB7 Esc \u5173\u95ED", children: rows });
60283
60520
  }
60284
60521
 
60285
60522
  // packages/tui/tui-render/src/workspace-pane.tsx
60286
60523
  var import_react44 = __toESM(require_react(), 1);
60287
- var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
60524
+ var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
60288
60525
  var EMPTY_WORKSPACE_PANE = {
60289
60526
  open: false,
60290
60527
  root: "",
@@ -60377,12 +60614,12 @@ function WorkspacePreview({ preview, columns, maxRows, onLayout, systemOpen }) {
60377
60614
  if (start >= fragment.end) break;
60378
60615
  }
60379
60616
  }
60380
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow(parts, "codeBg", columns) }, `${fragment.line}:${fragment.start}`);
60617
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow(parts, "codeBg", columns) }, `${fragment.line}:${fragment.start}`);
60381
60618
  });
60382
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Box_default, { flexDirection: "column", width: columns, children: [
60383
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { wrap: "truncate", children: paintRow([styled(title, "fg", void 0, true)]) }),
60619
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Box_default, { flexDirection: "column", width: columns, children: [
60620
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { wrap: "truncate", children: paintRow([styled(title, "fg", void 0, true)]) }),
60384
60621
  rows,
60385
- maxRows > 1 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { wrap: "truncate", children: paintRow([styled(footnote, "fgDim")]) }) : null
60622
+ maxRows > 1 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { wrap: "truncate", children: paintRow([styled(footnote, "fgDim")]) }) : null
60386
60623
  ] });
60387
60624
  }
60388
60625
  function WorkspacePane({
@@ -60394,10 +60631,10 @@ function WorkspacePane({
60394
60631
  const { rows: windowRows, columns: windowColumns } = use_window_size_default();
60395
60632
  if (!state.open) return null;
60396
60633
  if (state.error !== void 0) {
60397
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u533A", error: state.error, footnote: "Esc \u5173\u95ED" });
60634
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u533A", error: state.error, footnote: "Esc \u5173\u95ED" });
60398
60635
  }
60399
60636
  if (state.preview !== void 0) {
60400
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
60637
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
60401
60638
  WorkspacePreview,
60402
60639
  {
60403
60640
  preview: state.preview,
@@ -60418,7 +60655,7 @@ function WorkspacePane({
60418
60655
  const selected = index2 === state.selectedIndex && !state.editing;
60419
60656
  const head = `${selected ? "\u203A " : " "}${" ".repeat(node2.depth)}${glyph} `;
60420
60657
  rows.push(
60421
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { wrap: "truncate", children: paintRow([
60658
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { wrap: "truncate", children: paintRow([
60422
60659
  styled(escapeContent(head), selected ? "accent" : "fgDim"),
60423
60660
  styled(
60424
60661
  truncateDisplay(
@@ -60430,7 +60667,7 @@ function WorkspacePane({
60430
60667
  ]) }, node2.path)
60431
60668
  );
60432
60669
  });
60433
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
60670
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
60434
60671
  OverlayShell,
60435
60672
  {
60436
60673
  title: state.mode === "deliveries" ? "\u4EA4\u4ED8\u6587\u4EF6" : "\u5DE5\u4F5C\u533A",
@@ -60444,7 +60681,7 @@ function WorkspacePane({
60444
60681
  }
60445
60682
 
60446
60683
  // packages/tui/tui-render/src/plugins-pane.tsx
60447
- var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
60684
+ var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
60448
60685
  var EMPTY_PLUGINS_PANE = {
60449
60686
  open: false,
60450
60687
  available: false,
@@ -60549,11 +60786,11 @@ function PluginsPane({ state, locale = "zh-CN", maxCols, maxRows }) {
60549
60786
  return { text: text4, token };
60550
60787
  });
60551
60788
  const visible = [...lines.slice(start, start + bodyBudget), ...statusEntries];
60552
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(OverlayShell, { title: clean(copy("pluginsTitle")), body: clean(copy("pluginsScope")), footnote: clean(hint), children: visible.map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { wrap: "truncate", children: paintRow([styled(clean(line5.text), line5.token ?? (line5.selected ? "accent" : "fg"), void 0, line5.bold === true)]) }, index2)) });
60789
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(OverlayShell, { title: clean(copy("pluginsTitle")), body: clean(copy("pluginsScope")), footnote: clean(hint), children: visible.map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { wrap: "truncate", children: paintRow([styled(clean(line5.text), line5.token ?? (line5.selected ? "accent" : "fg"), void 0, line5.bold === true)]) }, index2)) });
60553
60790
  }
60554
60791
 
60555
60792
  // packages/tui/tui-render/src/account-pane.tsx
60556
- var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
60793
+ var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
60557
60794
  var EMPTY_ACCOUNT_PANE = {
60558
60795
  open: false,
60559
60796
  available: false,
@@ -60648,11 +60885,11 @@ function AccountPane({ state, locale = "zh-CN", maxCols }) {
60648
60885
  }
60649
60886
  if (state.busy) hint = copy("accountBusyHint");
60650
60887
  }
60651
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(OverlayShell, { title: copy("accountTitle"), footnote: truncateDisplay(escapeContent(hint), width), error: state.error, children: lines.map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { wrap: "truncate", children: paintRow([styled(line5.wrap === true ? escapeContent(line5.text) : truncateDisplay(escapeContent(line5.text), width), line5.token, void 0, line5.bold === true)]) }, index2)) });
60888
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(OverlayShell, { title: copy("accountTitle"), footnote: truncateDisplay(escapeContent(hint), width), error: state.error, children: lines.map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text, { wrap: "truncate", children: paintRow([styled(line5.wrap === true ? escapeContent(line5.text) : truncateDisplay(escapeContent(line5.text), width), line5.token, void 0, line5.bold === true)]) }, index2)) });
60652
60889
  }
60653
60890
 
60654
60891
  // packages/tui/tui-render/src/feedback-pane.tsx
60655
- var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
60892
+ var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
60656
60893
  var EMPTY_FEEDBACK_PANE = {
60657
60894
  open: false,
60658
60895
  hasTarget: false,
@@ -60668,10 +60905,10 @@ function FeedbackPane({
60668
60905
  }) {
60669
60906
  if (!state.open) return null;
60670
60907
  if (state.error !== void 0) {
60671
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(OverlayShell, { title: "\u53CD\u9988", error: state.error, footnote: "Esc \u5173\u95ED" });
60908
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(OverlayShell, { title: "\u53CD\u9988", error: state.error, footnote: "Esc \u5173\u95ED" });
60672
60909
  }
60673
60910
  if (!state.hasTarget) {
60674
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
60911
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
60675
60912
  OverlayShell,
60676
60913
  {
60677
60914
  title: "\u53CD\u9988",
@@ -60687,7 +60924,7 @@ function FeedbackPane({
60687
60924
  { key: "negative", shortcut: "[d] ", label: "\u8E29", token: "warning" }
60688
60925
  ].map((row) => {
60689
60926
  const isCurrent = state.rating === row.key;
60690
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text, { wrap: "truncate", children: paintRow([
60927
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text, { wrap: "truncate", children: paintRow([
60691
60928
  styled(escapeContent(` ${row.shortcut}`), isCurrent ? row.token : "fgDim", void 0, isCurrent),
60692
60929
  styled(
60693
60930
  escapeContent(`${row.label}${isCurrent ? " \xB7 \u5F53\u524D" : ""}`),
@@ -60699,13 +60936,13 @@ function FeedbackPane({
60699
60936
  });
60700
60937
  if (state.note !== void 0 && state.note.trim() !== "") {
60701
60938
  rows.push(
60702
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text, { wrap: "truncate", children: paintRow([
60939
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text, { wrap: "truncate", children: paintRow([
60703
60940
  styled(" \u5907\u6CE8: ", "fgDim"),
60704
60941
  styled(escapeContent(state.note), "fgSoft")
60705
60942
  ]) }, "note")
60706
60943
  );
60707
60944
  }
60708
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
60945
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
60709
60946
  OverlayShell,
60710
60947
  {
60711
60948
  title: "\u53CD\u9988",
@@ -60757,7 +60994,7 @@ function toolDetailsKeyAction(key, info) {
60757
60994
 
60758
60995
  // packages/tui/tui-render/src/todo-pane.tsx
60759
60996
  var import_react45 = __toESM(require_react(), 1);
60760
- var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
60997
+ var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
60761
60998
  function TodoPane({ todos, offset, onOffsetChange, locale }) {
60762
60999
  const { columns, rows } = use_window_size_default();
60763
61000
  const width = Math.max(1, (columns || 80) - 4);
@@ -60790,15 +61027,15 @@ function TodoPane({ todos, offset, onOffsetChange, locale }) {
60790
61027
  }, [start, offset, onOffsetChange]);
60791
61028
  const summary2 = english ? `${todos.length} tasks \xB7 ${counts.in_progress} active \xB7 ${counts.pending} pending \xB7 ${counts.completed} done` : `\u5171 ${todos.length} \u9879 \xB7 \u8FDB\u884C\u4E2D ${counts.in_progress} \xB7 \u5F85\u529E ${counts.pending} \xB7 \u5DF2\u5B8C\u6210 ${counts.completed}`;
60792
61029
  const position2 = lines.length === 0 ? "" : ` ${start + 1}\u2013${Math.min(start + height, lines.length)}/${lines.length}`;
60793
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
61030
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
60794
61031
  OverlayShell,
60795
61032
  {
60796
61033
  title: english ? "TODO list" : "\u5F85\u529E\u6E05\u5355",
60797
61034
  footnote: `${english ? "\u2191\u2193/jk Scroll \xB7 PgUp/PgDn Page \xB7 Esc Back" : "\u2191\u2193/jk \u6EDA\u52A8 \xB7 PgUp/PgDn \u7FFB\u9875 \xB7 Esc \u8FD4\u56DE"}${position2}`,
60798
61035
  children: [
60799
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text, { wrap: "truncate", children: paintRow([styled(summary2, "fgDim")]) }),
60800
- todos.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text, { children: english ? "No TODO list in this turn." : "\u5F53\u524D\u56DE\u5408\u6682\u65E0\u5F85\u529E\u6E05\u5355\u3002" }),
60801
- lines.slice(start, start + height).map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text, { wrap: "truncate", children: paintRow([styled(line5.text || " ", line5.token)]) }, start + index2))
61036
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { wrap: "truncate", children: paintRow([styled(summary2, "fgDim")]) }),
61037
+ todos.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { children: english ? "No TODO list in this turn." : "\u5F53\u524D\u56DE\u5408\u6682\u65E0\u5F85\u529E\u6E05\u5355\u3002" }),
61038
+ lines.slice(start, start + height).map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { wrap: "truncate", children: paintRow([styled(line5.text || " ", line5.token)]) }, start + index2))
60802
61039
  ]
60803
61040
  }
60804
61041
  );
@@ -60806,7 +61043,7 @@ function TodoPane({ todos, offset, onOffsetChange, locale }) {
60806
61043
 
60807
61044
  // packages/tui/tui-render/src/schedule-pane.tsx
60808
61045
  var import_react46 = __toESM(require_react(), 1);
60809
- var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
61046
+ var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
60810
61047
  var EMPTY_SCHEDULE_PANE = {
60811
61048
  open: false,
60812
61049
  rows: [],
@@ -60853,14 +61090,14 @@ ${escapeContent(selected.id)}
60853
61090
  if (lines.length === 0) lines = [state.loading ? "\u6B63\u5728\u8BFB\u53D6\u4EFB\u52A1\u2026" : "\u6682\u65E0\u4EFB\u52A1\uFF1B\u53EF\u8BA9\u6A21\u578B\u521B\u5EFA\u5B9A\u65F6\u63D0\u9192\u3002"];
60854
61091
  }
60855
61092
  const footnote = state.busy ? "\u6B63\u5728\u53D6\u6D88\u4EFB\u52A1\u2026" : state.confirmDelete ? "y \u786E\u8BA4\u53D6\u6D88 \xB7 n/Esc \u4FDD\u7559" : state.details ? "\u2191\u2193/PgUp/PgDn \u9605\u8BFB \xB7 Enter \u539F\u4F1A\u8BDD \xB7 d \u53D6\u6D88\u4EFB\u52A1 \xB7 Esc \u5217\u8868" : "\u2191\u2193 \u9009\u62E9 \xB7 Enter \u8BE6\u60C5 \xB7 d \u53D6\u6D88\u4EFB\u52A1 \xB7 r \u5237\u65B0 \xB7 Esc \u8FD4\u56DE";
60856
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(OverlayShell, { title: `\u5B9A\u65F6\u4EFB\u52A1 \xB7 ${state.rows.length}`, footnote, children: [
60857
- state.error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { wrap: "truncate", children: paintRow([styled(truncateDisplay(escapeContent(state.error), width), "fg")]) }),
60858
- lines.slice(0, Math.max(0, capacity - (state.error === void 0 ? 0 : 1))).map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { wrap: "truncate", children: paintRow([styled(line5 || " ", "fg")]) }, index2))
61093
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(OverlayShell, { title: `\u5B9A\u65F6\u4EFB\u52A1 \xB7 ${state.rows.length}`, footnote, children: [
61094
+ state.error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { wrap: "truncate", children: paintRow([styled(truncateDisplay(escapeContent(state.error), width), "fg")]) }),
61095
+ lines.slice(0, Math.max(0, capacity - (state.error === void 0 ? 0 : 1))).map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { wrap: "truncate", children: paintRow([styled(line5 || " ", "fg")]) }, index2))
60859
61096
  ] });
60860
61097
  }
60861
61098
 
60862
61099
  // packages/tui/tui-render/src/tool-details-pane.tsx
60863
- var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
61100
+ var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
60864
61101
  var EMPTY_TOOL_DETAILS_PANE = Object.freeze({
60865
61102
  open: false,
60866
61103
  cards: [],
@@ -60897,21 +61134,21 @@ function ToolDetailsPane({ state, columns, maxRows, pageRows, locale }) {
60897
61134
  }
60898
61135
  lines.push(truncateDisplay(`${state.page + 1} \xB7 ${page.remainingLines} ${tuiCopy("remaining", locale)} \xB7 d ${tuiCopy("diagnostics", locale)} ${tuiCopy(state.diagnostics ? "on" : "off", locale)}`, columns));
60899
61136
  }
60900
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
60901
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { wrap: "truncate", children: heading }),
60902
- lines.map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { wrap: "truncate", children: line5 }, index2)),
60903
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { dimColor: true, wrap: "truncate", children: escapeContent(tuiCopy(state.detail ? "toolPageHint" : "toolListHint", locale)) })
61137
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
61138
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { wrap: "truncate", children: heading }),
61139
+ lines.map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { wrap: "truncate", children: line5 }, index2)),
61140
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { dimColor: true, wrap: "truncate", children: escapeContent(tuiCopy(state.detail ? "toolPageHint" : "toolListHint", locale)) })
60904
61141
  ] });
60905
61142
  }
60906
61143
 
60907
61144
  // packages/tui/tui-render/src/queue-chip.tsx
60908
- var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
61145
+ var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
60909
61146
  function queueChipText(count) {
60910
61147
  return count <= 0 ? void 0 : `\u5F85\u53D1 ${String(count)} \xB7 \u2191 \u53D6\u51FA`;
60911
61148
  }
60912
61149
  function QueueChip({ count }) {
60913
61150
  const text4 = queueChipText(count);
60914
- return text4 === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { children: paintRow([styled(escapeContent(text4), "fg")]) });
61151
+ return text4 === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { children: paintRow([styled(escapeContent(text4), "fg")]) });
60915
61152
  }
60916
61153
 
60917
61154
  // packages/tui/tui-render/src/loop.tsx
@@ -61365,10 +61602,15 @@ function mapKeyEvent(state, key, keyInfo, commands, pane, search2, timeline = {
61365
61602
  });
61366
61603
  }
61367
61604
  if (settings.open) {
61605
+ if (settings.busy === true) return { kind: "none" };
61368
61606
  if (settings.searching === true) {
61369
61607
  const query = settings.filter ?? "";
61370
61608
  if (keyInfo.escape) return holdComposer(state, { kind: "settings-search", query: "", active: false });
61371
61609
  if (keyInfo.return) return holdComposer(state, { kind: "settings-search", query, active: false });
61610
+ if (keyInfo.tab) return holdComposer(state, { kind: "settings-group", delta: keyInfo.shift ? -1 : 1 });
61611
+ if (keyInfo.downArrow || keyInfo.upArrow) return holdComposer(state, { kind: "settings-move", delta: keyInfo.downArrow ? 1 : -1 });
61612
+ if (keyInfo.pageDown || keyInfo.pageUp) return holdComposer(state, { kind: "settings-move", delta: keyInfo.pageDown ? 5 : -5 });
61613
+ if (keyInfo.home || keyInfo.end) return holdComposer(state, { kind: "settings-move", delta: keyInfo.end ? 1e4 : -1e4 });
61372
61614
  if (keyInfo.backspace || keyInfo.delete) return holdComposer(state, { kind: "settings-search", query: Array.from(query).slice(0, -1).join(""), active: true });
61373
61615
  if (!keyInfo.ctrl && !keyInfo.meta && !keyInfo.upArrow && !keyInfo.downArrow && key !== "") return holdComposer(state, { kind: "settings-search", query: query + key, active: true });
61374
61616
  return { kind: "none" };
@@ -61381,7 +61623,9 @@ function mapKeyEvent(state, key, keyInfo, commands, pane, search2, timeline = {
61381
61623
  }
61382
61624
  if (keyInfo.return || keyInfo.rightArrow || key === "i") {
61383
61625
  if (key !== "i" && settings.navigable === true) return holdComposer(state, { kind: "settings-edit" });
61626
+ if (keyInfo.rightArrow) return { kind: "none" };
61384
61627
  if (settings.editable === false) return { kind: "none" };
61628
+ if (keyInfo.return && settings.toggleable === true) return holdComposer(state, { kind: "settings-toggle" });
61385
61629
  return {
61386
61630
  kind: "dispatch",
61387
61631
  action: { kind: key === "i" ? "settings-edit-json" : "settings-edit" },
@@ -62855,6 +63099,8 @@ function TuiLoop({
62855
63099
  editing: settingsPaneRef.current.editing,
62856
63100
  onboarding: settingsPaneRef.current.onboarding,
62857
63101
  navigable: settingsPaneRef.current.rows[settingsPaneRef.current.selectedIndex]?.navigable,
63102
+ toggleable: canToggleSetting(settingsPaneRef.current.rows[settingsPaneRef.current.selectedIndex]),
63103
+ busy: settingsPaneRef.current.busy,
62858
63104
  editable: settingsPaneRef.current.rows[settingsPaneRef.current.selectedIndex]?.editable,
62859
63105
  searching: settingsPaneRef.current.searching,
62860
63106
  filter: settingsPaneRef.current.filter,
@@ -63386,6 +63632,8 @@ function TuiLoop({
63386
63632
  locale,
63387
63633
  rows: settingsPane.rows,
63388
63634
  ...settingsPane.breadcrumb === void 0 ? {} : { breadcrumb: settingsPane.breadcrumb },
63635
+ ...settingsPane.categories === void 0 ? {} : { categories: settingsPane.categories },
63636
+ ...settingsPane.activeCategory === void 0 ? {} : { activeCategory: settingsPane.activeCategory },
63389
63637
  ...settingsPane.filter === void 0 ? {} : { filter: settingsPane.filter },
63390
63638
  ...settingsPane.searching === void 0 ? {} : { searching: settingsPane.searching },
63391
63639
  selectedIndex: settingsPane.selectedIndex,
@@ -63537,7 +63785,12 @@ function TuiLoop({
63537
63785
  mentionMode: false,
63538
63786
  caretIndex: state.caretIndex,
63539
63787
  selectionAnchor: state.selectionAnchor,
63540
- secret: settingsPane.editing && (settingsPane.onboarding === true || settingsPane.rows[settingsPane.selectedIndex]?.namespace === "credentials")
63788
+ secret: settingsPane.editing && (settingsPane.onboarding === true || settingsPane.rows[settingsPane.selectedIndex]?.namespace === "credentials"),
63789
+ ...settingsPane.editing ? {
63790
+ actionHint: locale === "en-US" ? "Setting value \xB7 Enter save \xB7 Esc cancel" : "\u8BBE\u7F6E\u503C \xB7 Enter \u4FDD\u5B58 \xB7 Esc \u53D6\u6D88",
63791
+ modelChip: "",
63792
+ modeChip: ""
63793
+ } : {}
63541
63794
  });
63542
63795
  } else if (toolDetailsPane.open) {
63543
63796
  inputSlot = void 0;
@@ -69385,13 +69638,13 @@ ${formattedError}` });
69385
69638
  }
69386
69639
 
69387
69640
  // packages/tui/tui-render/src/todo-hud.tsx
69388
- var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
69641
+ var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
69389
69642
 
69390
69643
  // packages/tui/tui-render/src/jobs-hud.tsx
69391
- var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
69644
+ var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
69392
69645
 
69393
69646
  // packages/tui/tui-render/src/workflow-hud.tsx
69394
- var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
69647
+ var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
69395
69648
 
69396
69649
  // packages/tui/tui-render/src/interaction-state.ts
69397
69650
  function reduceInteraction(state, event) {
@@ -99464,7 +99717,19 @@ function parseSettingsFieldValue(namespace, field, current, draft, knownProvider
99464
99717
  if (field === "defaultInput" || field.endsWith(".defaultInput")) {
99465
99718
  const trimmed = draft.trim().toLowerCase();
99466
99719
  if (trimmed === "") return ["text", "image"];
99467
- const tokens = trimmed.split(/[,\s]+/).filter((t2) => t2 !== "");
99720
+ const json2 = trimmed.startsWith("[") ? trimmed : void 0;
99721
+ let parsed;
99722
+ if (json2 !== void 0) {
99723
+ try {
99724
+ parsed = JSON.parse(json2);
99725
+ } catch {
99726
+ throw new TypeError("JSON \u65E0\u6548");
99727
+ }
99728
+ if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string")) {
99729
+ throw new TypeError('defaultInput \u9700\u8981\u5B57\u7B26\u4E32\u6570\u7EC4\uFF0C\u4F8B\u5982 ["text", "image"]');
99730
+ }
99731
+ }
99732
+ const tokens = parsed === void 0 ? trimmed.split(/[,\s]+/).filter((t2) => t2 !== "") : parsed;
99468
99733
  const result = [];
99469
99734
  for (const token of tokens) {
99470
99735
  if (token === "text" || token === "\u6587\u672C") {
@@ -99511,6 +99776,10 @@ function childSchema(schema, key) {
99511
99776
  const node2 = record2(schema);
99512
99777
  return record2(node2.dict)[key] ?? record2(node2.properties)[key] ?? node2.inner ?? node2.items;
99513
99778
  }
99779
+ function navigableValue(value) {
99780
+ if (Array.isArray(value)) return value.some((item) => typeof item !== "string");
99781
+ return value !== null && typeof value === "object";
99782
+ }
99514
99783
  function summary(value) {
99515
99784
  return Array.isArray(value) ? `${String(value.length)} \u9879` : value !== null && typeof value === "object" ? `${String(Object.keys(value).length)} \u4E2A\u5B57\u6BB5` : stringifySettingValue(value);
99516
99785
  }
@@ -99550,6 +99819,7 @@ function settingsTreeFromDescribe(descriptors, credentials) {
99550
99819
  const identity = Array.isArray(parentValue) && typeof modelId === "string" && parentValue.filter((entry) => record2(entry).id === modelId).length === 1 ? `id:${modelId}` : key;
99551
99820
  const id = `${parentId}:${JSON.stringify(identity)}`;
99552
99821
  const nested = value !== null && typeof value === "object";
99822
+ const navigable = navigableValue(value);
99553
99823
  const meta3 = record2(record2(schema).meta);
99554
99824
  const label = Array.isArray(parentValue) ? String(record2(value).id ?? record2(value).name ?? key) : key;
99555
99825
  nodes.push({
@@ -99559,14 +99829,14 @@ function settingsTreeFromDescribe(descriptors, credentials) {
99559
99829
  field,
99560
99830
  sourcePath: path2,
99561
99831
  label,
99562
- value: path2.length === 2 && path2[0] === "providers" ? `${String(Array.isArray(record2(value).models) ? record2(value).models.length : 0)} \u6A21\u578B \xB7 ${String(record2(value).api ?? "\u9ED8\u8BA4\u534F\u8BAE")}` : nested ? summary(value) : stringifySettingsFieldValue(namespace, field, value),
99832
+ value: path2.length === 2 && path2[0] === "providers" ? `${String(Array.isArray(record2(value).models) ? record2(value).models.length : 0)} \u6A21\u578B \xB7 ${String(record2(value).api ?? "\u9ED8\u8BA4\u534F\u8BAE")}` : navigable ? summary(value) : stringifySettingsFieldValue(namespace, field, value),
99563
99833
  editValue: stringifySettingValue(value),
99564
- ...nested && secrets.some((secret) => path2.every((key2, index2) => secret[index2] === key2)) ? { editable: false } : {},
99565
- ...nested ? { navigable: true } : {},
99834
+ ...navigable && secrets.some((secret) => path2.every((key2, index2) => secret[index2] === key2)) ? { editable: false } : {},
99835
+ ...navigable ? { navigable: true } : {},
99566
99836
  ...typeof meta3.description === "string" ? { description: meta3.description } : {},
99567
99837
  ...meta3.required === true ? { required: true } : {}
99568
99838
  });
99569
- if (nested) {
99839
+ if (navigable) {
99570
99840
  for (const [child, next] of Object.entries(value)) walk(next, [...path2, child], id, childSchema(schema, child));
99571
99841
  if (namespace === "llm-pi-ai" && field === "providers") {
99572
99842
  nodes.push({ id: `${id}:add`, parentId: id, namespace, field, sourcePath: path2, label: "+ \u6DFB\u52A0 Provider", value: "\u76EE\u5F55\u540D / \u8868\u5355", editValue: PROVIDER_FORM_TEMPLATE });
@@ -99609,6 +99879,7 @@ var SettingsNavigation = class {
99609
99879
  parentId = "";
99610
99880
  query = "";
99611
99881
  selections = /* @__PURE__ */ new Map();
99882
+ categoryPositions = /* @__PURE__ */ new Map();
99612
99883
  beforeSearchIndex = 0;
99613
99884
  get rows() {
99614
99885
  const query = this.query.toLocaleLowerCase();
@@ -99624,10 +99895,28 @@ var SettingsNavigation = class {
99624
99895
  }
99625
99896
  return [...labels, ...tail];
99626
99897
  }
99898
+ get categories() {
99899
+ return this.nodes.filter((node2) => node2.parentId === "").map((node2) => ({
99900
+ id: node2.id,
99901
+ label: node2.label ?? node2.field,
99902
+ count: this.nodes.filter((child) => child.parentId === node2.id).length
99903
+ }));
99904
+ }
99905
+ get activeCategory() {
99906
+ let node2 = this.nodes.find((entry) => entry.id === this.parentId);
99907
+ while (node2 !== void 0 && node2.parentId !== "") node2 = this.nodes.find((entry) => entry.id === node2?.parentId);
99908
+ return node2?.id;
99909
+ }
99910
+ open() {
99911
+ if (this.parentId === "") this.group(1);
99912
+ }
99627
99913
  get filter() {
99628
99914
  return this.query;
99629
99915
  }
99630
99916
  remember() {
99917
+ if (this.query !== "") return;
99918
+ const category = this.activeCategory;
99919
+ if (category !== void 0) this.categoryPositions.set(category, this.parentId);
99631
99920
  const id = this.rows[this.selectedIndex]?.id;
99632
99921
  if (id !== void 0) this.selections.set(this.parentId, id);
99633
99922
  }
@@ -99638,8 +99927,22 @@ var SettingsNavigation = class {
99638
99927
  replace(nodes) {
99639
99928
  const selected = this.rows[this.selectedIndex]?.id;
99640
99929
  this.remember();
99930
+ const previous3 = this.nodes;
99641
99931
  this.nodes = nodes;
99642
- if (!nodes.some((node2) => node2.id === this.parentId)) this.parentId = "";
99932
+ const survivingParent = (parent) => {
99933
+ while (parent !== "" && !nodes.some((node2) => node2.id === parent)) {
99934
+ parent = previous3.find((node2) => node2.id === parent)?.parentId ?? "";
99935
+ }
99936
+ return parent;
99937
+ };
99938
+ this.parentId = survivingParent(this.parentId);
99939
+ for (const [parent, id] of this.selections) {
99940
+ if (!nodes.some((node2) => node2.id === id && node2.parentId === parent)) this.selections.delete(parent);
99941
+ }
99942
+ for (const [category, parent] of this.categoryPositions) {
99943
+ if (!nodes.some((node2) => node2.id === category && node2.parentId === "")) this.categoryPositions.delete(category);
99944
+ else this.categoryPositions.set(category, survivingParent(parent));
99945
+ }
99643
99946
  const index2 = this.rows.findIndex((node2) => node2.id === selected);
99644
99947
  if (index2 >= 0) this.selectedIndex = index2;
99645
99948
  else this.restore();
@@ -99660,7 +99963,7 @@ var SettingsNavigation = class {
99660
99963
  return true;
99661
99964
  }
99662
99965
  const node2 = this.nodes.find((entry) => entry.id === this.parentId);
99663
- if (node2 === void 0) return false;
99966
+ if (node2 === void 0 || node2.parentId === "") return false;
99664
99967
  this.remember();
99665
99968
  this.parentId = node2.parentId;
99666
99969
  this.selectedIndex = 0;
@@ -99668,6 +99971,7 @@ var SettingsNavigation = class {
99668
99971
  return true;
99669
99972
  }
99670
99973
  search(query) {
99974
+ if (query === this.query) return;
99671
99975
  if (this.query === "") {
99672
99976
  this.remember();
99673
99977
  this.beforeSearchIndex = this.selectedIndex;
@@ -99677,14 +99981,14 @@ var SettingsNavigation = class {
99677
99981
  if (query === "") this.restore();
99678
99982
  }
99679
99983
  group(delta) {
99984
+ if (this.query !== "") this.search("");
99680
99985
  this.remember();
99681
- const groups = this.nodes.filter((node2) => node2.parentId === "");
99682
- const current = this.breadcrumb[1];
99683
- const index2 = groups.findIndex((node2) => node2.label === current);
99684
- const next = groups[(index2 + (delta < 0 ? -1 : 1) + groups.length) % groups.length];
99986
+ const groups = this.categories;
99987
+ const index2 = groups.findIndex((node2) => node2.id === this.activeCategory);
99988
+ const nextIndex = index2 < 0 ? delta < 0 ? groups.length - 1 : 0 : (index2 + (delta < 0 ? -1 : 1) + groups.length) % groups.length;
99989
+ const next = groups[nextIndex];
99685
99990
  if (next === void 0) return;
99686
- this.parentId = next.id;
99687
- this.query = "";
99991
+ this.parentId = this.categoryPositions.get(next.id) ?? next.id;
99688
99992
  this.selectedIndex = 0;
99689
99993
  this.restore();
99690
99994
  }
@@ -100443,6 +100747,9 @@ var RuntimeController = class _RuntimeController {
100443
100747
  settingsOpen = false;
100444
100748
  settingsRows = [];
100445
100749
  settingsSelectedIndex = 0;
100750
+ /** Selection changes inside one input burst share one settings notification. */
100751
+ settingsMovePending = false;
100752
+ settingsMoveEmit;
100446
100753
  settingsNavigation = new SettingsNavigation([]);
100447
100754
  settingsSearching = false;
100448
100755
  settingsEditing = false;
@@ -101091,7 +101398,7 @@ var RuntimeController = class _RuntimeController {
101091
101398
  rows: this.settingsRows,
101092
101399
  selectedIndex: this.settingsSelectedIndex,
101093
101400
  editing: this.settingsEditing,
101094
- ...!this.settingsOnboarding ? { breadcrumb: this.settingsNavigation.breadcrumb, filter: this.settingsNavigation.filter, searching: this.settingsSearching } : {},
101401
+ ...!this.settingsOnboarding ? { breadcrumb: this.settingsNavigation.breadcrumb, filter: this.settingsNavigation.filter, searching: this.settingsSearching, categories: this.settingsNavigation.categories, ...this.settingsNavigation.activeCategory === void 0 ? {} : { activeCategory: this.settingsNavigation.activeCategory } } : {},
101095
101402
  ...this.settingsOnboarding ? { onboarding: true } : {},
101096
101403
  ...this.settingsBusy ? { busy: true } : {},
101097
101404
  ...this.settingsUpdateError === void 0 ? {} : { updateError: this.settingsUpdateError }
@@ -103323,7 +103630,7 @@ ${line5}`.slice(-64e3);
103323
103630
  return;
103324
103631
  }
103325
103632
  case "settings-escape":
103326
- if (!this.settingsOpen) return;
103633
+ if (!this.settingsOpen || this.settingsBusy) return;
103327
103634
  if (this.settingsOnboarding) {
103328
103635
  this.settingsOnboarding = false;
103329
103636
  this.settingsOpen = false;
@@ -103356,6 +103663,7 @@ ${line5}`.slice(-64e3);
103356
103663
  if (!this.settingsOpen || this.settingsEditing || this.settingsOnboarding || this.settingsBusy) return;
103357
103664
  this.settingsNavigation.selectedIndex = this.settingsSelectedIndex;
103358
103665
  this.settingsNavigation.group(action.delta);
103666
+ this.settingsSearching = false;
103359
103667
  this.syncSettingsNavigation();
103360
103668
  return;
103361
103669
  case "settings-move":
@@ -103366,7 +103674,8 @@ ${line5}`.slice(-64e3);
103366
103674
  Math.max(0, this.settingsSelectedIndex + action.delta)
103367
103675
  );
103368
103676
  this.settingsNavigation.selectedIndex = this.settingsSelectedIndex;
103369
- this.emit();
103677
+ this.settingsPaneSnapshot = void 0;
103678
+ this.scheduleSettingsSelectionEmit();
103370
103679
  return;
103371
103680
  case "settings-edit":
103372
103681
  case "settings-edit-json":
@@ -103390,7 +103699,7 @@ ${line5}`.slice(-64e3);
103390
103699
  this.emit();
103391
103700
  return;
103392
103701
  case "settings-cancel-edit":
103393
- if (!this.settingsOpen) return;
103702
+ if (!this.settingsOpen || this.settingsBusy) return;
103394
103703
  if (this.settingsOnboarding) {
103395
103704
  this.settingsOnboarding = false;
103396
103705
  this.settingsOpen = false;
@@ -105170,7 +105479,10 @@ ${row.hint ?? ""}` });
105170
105479
  this.settingsNavigation = new SettingsNavigation([]);
105171
105480
  this.settingsSelectedIndex = 0;
105172
105481
  this.settingsSearching = false;
105173
- this.settingsRows = this.readSettingsRows();
105482
+ this.readSettingsRows();
105483
+ this.settingsNavigation.open();
105484
+ this.settingsRows = this.settingsNavigation.rows;
105485
+ this.settingsSelectedIndex = this.settingsNavigation.selectedIndex;
105174
105486
  this.settingsOnboarding = false;
105175
105487
  this.settingsOpen = true;
105176
105488
  this.emit();
@@ -105297,7 +105609,7 @@ ${row.hint ?? ""}` });
105297
105609
  * @param value - composer draft captured by the key reducer.
105298
105610
  */
105299
105611
  applySettingsValue(value) {
105300
- if (!this.settingsOpen || !this.settingsEditing) return;
105612
+ if (!this.settingsOpen || !this.settingsEditing || this.settingsBusy) return;
105301
105613
  this.settingsEditing = false;
105302
105614
  const row = this.settingsRows[this.settingsSelectedIndex];
105303
105615
  if (row === void 0) {
@@ -105345,6 +105657,9 @@ ${row.hint ?? ""}` });
105345
105657
  this.applyAutoDiscoverProvider(row.namespace, row.field, parsed);
105346
105658
  return;
105347
105659
  }
105660
+ this.settingsBusy = true;
105661
+ this.settingsUpdateError = void 0;
105662
+ this.emit();
105348
105663
  this.ownWork((async () => {
105349
105664
  try {
105350
105665
  const descriptor = settings.describe().find((form) => String(form.ns) === row.namespace);
@@ -105358,6 +105673,7 @@ ${row.hint ?? ""}` });
105358
105673
  this.setFeedback(`\u2713 \u5DF2\u66F4\u65B0 ${row.field}`);
105359
105674
  } catch (error51) {
105360
105675
  if (this.closed) return;
105676
+ this.settingsBusy = false;
105361
105677
  this.settingsUpdateError = errorReason(error51);
105362
105678
  this.settingsRows = this.readSettingsRows();
105363
105679
  this.emit();
@@ -105371,7 +105687,7 @@ ${row.hint ?? ""}` });
105371
105687
  toggleSelectedSettingValue() {
105372
105688
  if (!this.settingsOpen || this.settingsEditing || this.settingsOnboarding || this.settingsBusy) return;
105373
105689
  const row = this.settingsRows[this.settingsSelectedIndex];
105374
- if (row === void 0) return;
105690
+ if (row === void 0 || row.editable === false) return;
105375
105691
  let nextValue;
105376
105692
  if (row.value === "true") {
105377
105693
  nextValue = false;
@@ -105395,17 +105711,22 @@ ${row.hint ?? ""}` });
105395
105711
  }
105396
105712
  const settings = this.ctx.get("settings");
105397
105713
  if (settings === void 0) return;
105714
+ this.settingsBusy = true;
105715
+ this.settingsUpdateError = void 0;
105716
+ this.emit();
105398
105717
  this.ownWork((async () => {
105399
105718
  try {
105400
105719
  const descriptor = settings.describe().find((form) => String(form.ns) === row.namespace);
105401
105720
  await settings.update(row.namespace, settingsPathPatch(descriptor?.value, row.sourcePath ?? row.field.split("."), nextValue, descriptor?.user));
105402
105721
  if (this.closed) return;
105403
105722
  if (row.namespace === TUI_SETTINGS_NS) this.applyColorTierSetting();
105723
+ this.settingsBusy = false;
105404
105724
  this.settingsUpdateError = void 0;
105405
105725
  this.settingsRows = this.readSettingsRows();
105406
105726
  this.setFeedback(`\u2713 \u5DF2\u66F4\u65B0 ${row.field}`);
105407
105727
  } catch (error51) {
105408
105728
  if (this.closed) return;
105729
+ this.settingsBusy = false;
105409
105730
  this.settingsUpdateError = errorReason(error51);
105410
105731
  this.settingsRows = this.readSettingsRows();
105411
105732
  this.emit();
@@ -106688,6 +107009,8 @@ ${row.hint ?? ""}` });
106688
107009
  notifyListeners() {
106689
107010
  this.emitLastRun = Date.now();
106690
107011
  this.emitPending = false;
107012
+ this.settingsMovePending = false;
107013
+ this.settingsMoveEmit = void 0;
106691
107014
  for (const listener of this.listeners) {
106692
107015
  try {
106693
107016
  listener();
@@ -106696,8 +107019,27 @@ ${row.hint ?? ""}` });
106696
107019
  }
106697
107020
  }
106698
107021
  }
107022
+ /**
107023
+ * Publish only the settings selection. A wheel or key burst keeps the latest
107024
+ * index readable immediately and notifies subscribers once per turn.
107025
+ */
107026
+ scheduleSettingsSelectionEmit() {
107027
+ if (this.closed) return;
107028
+ this.settingsMovePending = true;
107029
+ if (this.settingsMoveEmit !== void 0) return;
107030
+ const token = queueMicrotask(() => {
107031
+ if (this.settingsMoveEmit !== token || this.closed || !this.settingsMovePending) return;
107032
+ this.settingsMoveEmit = void 0;
107033
+ this.settingsMovePending = false;
107034
+ if (this.emitTimer !== void 0) this.emitPending = true;
107035
+ else this.notifyListeners();
107036
+ });
107037
+ this.settingsMoveEmit = token;
107038
+ }
106699
107039
  emit() {
106700
107040
  if (this.closed) return;
107041
+ this.settingsMovePending = false;
107042
+ this.settingsMoveEmit = void 0;
106701
107043
  this.modelSnapshot = void 0;
106702
107044
  this.sessionPaneSnapshot = void 0;
106703
107045
  this.searchPaneSnapshot = void 0;