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

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
@@ -58990,8 +58990,114 @@ var SETTINGS_GROUP_LABELS = {
58990
58990
  other: "\u5176\u4ED6"
58991
58991
  };
58992
58992
 
58993
- // packages/tui/tui-render/src/settings-pane.tsx
58993
+ // packages/tui/tui-render/src/settings-browser.tsx
58994
58994
  var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
58995
+ function fit(text4, width) {
58996
+ const safe = escapeContent(text4).replace(/\n/gu, " \u21B5 ");
58997
+ return displayWidth(safe) <= width ? safe : `${wcwidthSafeSlice(safe, Math.max(0, width - 1))}\u2026`;
58998
+ }
58999
+ function canToggleSetting(row) {
59000
+ 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));
59001
+ }
59002
+ function tabLine(categories, activeId, width) {
59003
+ const active = Math.max(0, categories.findIndex((category) => category.id === activeId));
59004
+ let start = active;
59005
+ let end = active + 1;
59006
+ const label = (index2) => index2 === active ? `[${categories[index2].label}]` : ` ${categories[index2].label} `;
59007
+ const used = (from2, to2) => categories.slice(from2, to2).reduce((sum, _2, i2) => sum + displayWidth(escapeContent(label(from2 + i2))) + 1, 4);
59008
+ while (start > 0 || end < categories.length) {
59009
+ if (start > 0 && used(start - 1, end) <= width) {
59010
+ start--;
59011
+ continue;
59012
+ }
59013
+ if (end < categories.length && used(start, end + 1) <= width) {
59014
+ end++;
59015
+ continue;
59016
+ }
59017
+ break;
59018
+ }
59019
+ return [
59020
+ styled(start > 0 ? "\u2039 " : " ", "fgDim"),
59021
+ ...categories.slice(start, end).map((_2, index2) => styled(
59022
+ fit(label(start + index2), Math.max(1, width - 5)) + " ",
59023
+ start + index2 === active ? "accentText" : "fgDim",
59024
+ void 0,
59025
+ start + index2 === active
59026
+ )),
59027
+ styled(end < categories.length ? "\u203A" : "", "fgDim")
59028
+ ];
59029
+ }
59030
+ function fieldLabel(row, locale) {
59031
+ const label = row.label ?? row.field;
59032
+ if (row.namespace !== "tui" || label !== row.field) return label;
59033
+ if (row.field === "reasoning" || row.field === "scrollbar" || row.field === "statusDetails" || row.field === "locale") return `${tuiCopy(row.field, locale)} (${row.field})`;
59034
+ const names = { theme: "\u660E\u6697\u4E3B\u9898", brandAnimation: "\u54C1\u724C\u52A8\u753B", submitOnEnter: "\u56DE\u8F66\u53D1\u9001", colorTier: "\u8272\u5F69\u6863\u4F4D" };
59035
+ return locale !== "en-US" && names[row.field] !== void 0 ? `${names[row.field]} (${row.field})` : label;
59036
+ }
59037
+ function SettingsBrowser(props) {
59038
+ const { rows, selectedIndex, editing, updateError, busy, searching, filter = "", breadcrumb = ["\u8BBE\u7F6E"], categories = [], activeCategory, locale } = props;
59039
+ const width = Math.max(1, props.columns);
59040
+ const budget = Math.max(1, props.maxRows ?? 18);
59041
+ const selected = Math.max(0, Math.min(selectedIndex, rows.length - 1));
59042
+ const active = rows[selected];
59043
+ const compact = budget < 8;
59044
+ const filtered = filter !== "" || searching === true;
59045
+ const category = categories.find((entry) => entry.id === activeCategory)?.label ?? breadcrumb[1];
59046
+ const back = breadcrumb.length > 2 ? "\u8FD4\u56DE" : "\u5173\u95ED";
59047
+ const action = active?.navigable === true ? "\u8FDB\u5165" : active?.editable === false ? "\u53EA\u8BFB" : canToggleSetting(active) ? "\u5207\u6362" : "\u7F16\u8F91";
59048
+ const primary = action === "\u53EA\u8BFB" ? action : `Enter ${action}`;
59049
+ 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`];
59050
+ if (budget <= 2) footer = [];
59051
+ const lines = [];
59052
+ const add = (text4, token = "fg", bold = false, bg = "bg") => lines.push({ parts: [styled(fit(text4, width), token, void 0, bold)], bg });
59053
+ const count = `${rows.length === 0 ? 0 : selected + 1}/${rows.length}`;
59054
+ const title = compact && category !== void 0 ? `[${category}]` : "\u8BBE\u7F6E";
59055
+ add(`${fit(title, Math.max(1, width - displayWidth(count) - 2))} ${count}`, "fg", true);
59056
+ const showTabs = !compact && categories.length > 0;
59057
+ if (showTabs) lines.push({ parts: tabLine(categories, activeCategory, width), bg: "bg" });
59058
+ if (!compact) {
59059
+ const path2 = breadcrumb.slice(showTabs ? 2 : 1).join(" \u203A ") || category || "\u9009\u62E9\u5206\u7C7B";
59060
+ const location = displayWidth(escapeContent(path2)) <= width ? path2 : `\u2026 \u203A ${breadcrumb.slice(-2).join(" \u203A ")}`;
59061
+ add(filtered ? `\u641C\u7D22\u7ED3\u679C /${filter}${searching === true ? "\u258F" : ""}` : location, filtered ? "accentText" : "fgDim");
59062
+ } else if (searching === true) {
59063
+ lines[0] = { parts: [styled(fit(`\u641C\u7D22 /${filter}\u258F`, width), "accentText")], bg: "bg" };
59064
+ }
59065
+ const status = updateError !== void 0 ? `\u2717 \u66F4\u65B0\u5931\u8D25\uFF1A${updateError}` : busy === true ? "\u6B63\u5728\u5904\u7406\u8BBE\u7F6E\u2026" : void 0;
59066
+ const space = Math.max(0, budget - lines.length - footer.length - (status === void 0 ? 0 : 1));
59067
+ const detail = [];
59068
+ const detailBudget = compact || active === void 0 ? 0 : Math.min(6, Math.max(0, space - Math.min(3, Math.max(1, rows.length))));
59069
+ if (active !== void 0 && detailBudget > 0) {
59070
+ const source = filtered ? `${active.namespace} \xB7 ${active.field}` : fieldLabel(active, locale);
59071
+ detail.push(...wrapDisplayLines(escapeContent(`\u5F53\u524D\u9879: ${source}`), width).slice(0, filtered ? 2 : 1));
59072
+ const value = active.value === "" ? "\u2014" : active.value;
59073
+ detail.push(...wrapDisplayLines(escapeContent(`${active.navigable === true ? "\u5305\u542B" : "\u5F53\u524D\u503C"}: ${value}`), width));
59074
+ if (active.description !== void 0) detail.push(...wrapDisplayLines(escapeContent(active.description), width));
59075
+ if (detail.length > detailBudget) {
59076
+ detail.length = detailBudget;
59077
+ detail[detail.length - 1] = `${wcwidthSafeSlice(detail[detail.length - 1], Math.max(0, width - 1))}\u2026`;
59078
+ }
59079
+ }
59080
+ const size = Math.min(rows.length, Math.max(0, space - detail.length));
59081
+ const start = Math.max(0, Math.min(rows.length - size, selected - Math.floor(size / 2)));
59082
+ 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");
59083
+ for (const [offset, row] of rows.slice(start, start + size).entries()) {
59084
+ const isSelected = start + offset === selected;
59085
+ const rawValue = row.value === "true" ? "\u2713 \u5F00\u542F" : row.value === "false" ? "\u25CB \u5173\u95ED" : row.value;
59086
+ const value = rawValue || (row.navigable === true ? "\u6253\u5F00 \u203A" : "\u2014");
59087
+ const labelWidth = Math.max(1, Math.min(44, Math.floor((width - 4) * 0.45)));
59088
+ const label = fit(`${fieldLabel(row, locale)}${row.required === true ? " *" : ""}`, labelWidth);
59089
+ const gap = Math.max(2, labelWidth - displayWidth(label) + 2);
59090
+ const text4 = `${isSelected ? "\u203A " : " "}${label}${" ".repeat(gap)}${fit(`${row.navigable === true ? "\u203A " : ""}${value}`, Math.max(1, width - 2 - displayWidth(label) - gap))}`;
59091
+ add(text4, isSelected ? "fg" : "fgSoft", isSelected, isSelected ? "settingsCardBg" : "bg");
59092
+ }
59093
+ for (const text4 of detail) add(text4, "fgDim");
59094
+ if (status !== void 0) add(status, updateError === void 0 ? "fgDim" : "error");
59095
+ for (const text4 of footer) add(text4, "fgDim");
59096
+ 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)) });
59097
+ }
59098
+
59099
+ // packages/tui/tui-render/src/settings-pane.tsx
59100
+ var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
58995
59101
  var TITLE2 = "\u8BBE\u7F6E";
58996
59102
  var ONBOARDING_TITLE = "\u9996\u6B21\u8BBE\u7F6E";
58997
59103
  var EDIT_FOOTNOTE = "Enter \u5E94\u7528 \xB7 Esc \u53D6\u6D88";
@@ -59086,57 +59192,56 @@ function SettingsPane({
59086
59192
  maxRows,
59087
59193
  breadcrumb,
59088
59194
  filter,
59089
- searching
59195
+ searching,
59196
+ categories,
59197
+ activeCategory
59090
59198
  }) {
59091
59199
  const { columns } = use_window_size_default();
59092
59200
  const width = columns > 0 ? columns : 80;
59201
+ if (breadcrumb !== void 0 && onboarding !== true) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
59202
+ SettingsBrowser,
59203
+ {
59204
+ rows,
59205
+ selectedIndex,
59206
+ editing,
59207
+ columns: width,
59208
+ breadcrumb,
59209
+ ...locale === void 0 ? {} : { locale },
59210
+ ...filter === void 0 ? {} : { filter },
59211
+ ...searching === void 0 ? {} : { searching },
59212
+ ...categories === void 0 ? {} : { categories },
59213
+ ...activeCategory === void 0 ? {} : { activeCategory },
59214
+ ...maxRows === void 0 ? {} : { maxRows },
59215
+ ...updateError === void 0 ? {} : { updateError },
59216
+ ...busy === void 0 ? {} : { busy }
59217
+ }
59218
+ );
59093
59219
  const selected = Math.min(Math.max(0, selectedIndex), Math.max(0, rows.length - 1));
59094
59220
  const active = rows[selected];
59095
59221
  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));
59222
+ 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"];
59223
+ const size = Math.min(rows.length, computeSettingsWindow(maxRows, rows.length, errorReason2, busy === true));
59112
59224
  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 ?? ""}`;
59225
+ 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) }) });
59226
+ let heading = active === void 0 ? TITLE2 : `${TITLE2} \xB7 ${SETTINGS_GROUP_LABELS[settingsGroup(active)]}`;
59119
59227
  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)}`;
59228
+ const counter = rows.length === 0 ? "" : `${active !== void 0 ? `${active.namespace} \xB7 ` : ""}${String(selected + 1)}/${String(rows.length)}`;
59121
59229
  if (counter !== "") heading = `${fitValue(escapeContent(heading), Math.max(1, width - displayWidth(counter) - 2))} ${counter}`;
59122
59230
  const localizedLabel = (row) => {
59123
59231
  if (row.label !== void 0 && !(row.namespace === "tui" && row.label === row.field)) return row.label;
59124
59232
  const resolved = locale ?? "zh-CN";
59125
59233
  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}`;
59234
+ return `${row.namespace} \xB7 ${label}`;
59127
59235
  };
59128
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59236
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59129
59237
  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"),
59238
+ start > 0 ? renderLine(`\u2191 \u4E0A\u65B9\u8FD8\u6709 ${String(start)} \u9879 (\u2026 \u8FD8\u6709 ${String(start)} \u9879)`, "fgDim") : null,
59239
+ 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)}`)),
59240
+ rows.length > start + size ? renderLine(`\u2026 \u8FD8\u6709 ${String(rows.length - start - size)} \u9879`, "fgDim") : null,
59136
59241
  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))
59242
+ errorReason2 === void 0 || errorReason2 === EMPTY_TABLE_REASON2 ? null : renderLine(FAIL_NEXT2, "fgDim"),
59243
+ busy === true ? renderLine(DISCOVERY_BUSY, "fgDim") : null,
59244
+ footer.map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box_default, { width: "100%", height: 1, flexShrink: 0, children: renderLine(line5, "fgDim") }, index2))
59140
59245
  ] });
59141
59246
  }
59142
59247
 
@@ -59187,7 +59292,7 @@ function tokenizeComposer(text4) {
59187
59292
  }
59188
59293
 
59189
59294
  // packages/tui/tui-render/src/input-bar.tsx
59190
- var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
59295
+ var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
59191
59296
  var PROMPT_WIDTH = 2;
59192
59297
  var COMPOSER_PLACEHOLDER = tuiCopy("inputHint");
59193
59298
  function InputBar({
@@ -59200,7 +59305,8 @@ function InputBar({
59200
59305
  modelChip,
59201
59306
  modeChip,
59202
59307
  locale,
59203
- secret
59308
+ secret,
59309
+ actionHint
59204
59310
  }) {
59205
59311
  const { text: text4, caretIndex } = maskComposerInput(sourceText, sourceCaretIndex ?? sourceText.length, secret);
59206
59312
  const selectionAnchor = sourceSelectionAnchor === void 0 ? void 0 : maskComposerInput(sourceText, sourceSelectionAnchor, secret).caretIndex;
@@ -59241,7 +59347,7 @@ function InputBar({
59241
59347
  const leftPrefix = "\u2502 ";
59242
59348
  const placeholder = tuiCopy("inputHint", locale);
59243
59349
  const sendHint = tuiCopy("sendHint", locale);
59244
- const modeHint = commandMode ? tuiCopy("commandModeHint", locale) : mentionMode ? tuiCopy("mentionModeHint", locale) : void 0;
59350
+ const modeHint = actionHint ?? (commandMode ? tuiCopy("commandModeHint", locale) : mentionMode ? tuiCopy("mentionModeHint", locale) : void 0);
59245
59351
  const leftHint = modeHint === void 0 ? `\u203A ${placeholder} \xB7 ${sendHint}` : `\u203A ${modeHint}`;
59246
59352
  const leftWidth = displayWidth(leftPrefix + leftHint);
59247
59353
  const chipWidth = chipText !== "" ? displayWidth(chipText) : 0;
@@ -59257,14 +59363,14 @@ function InputBar({
59257
59363
  styled(escapeContent(chipText), "fgDim")
59258
59364
  ] : []
59259
59365
  ];
59260
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
59366
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
59261
59367
  Box_default,
59262
59368
  {
59263
59369
  flexDirection: "column",
59264
59370
  width: "100%",
59265
59371
  backgroundColor: inkColor("inputBg"),
59266
59372
  children: [
59267
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow(headerParts, "inputBg", columns) }),
59373
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow(headerParts, "inputBg", columns) }),
59268
59374
  lines.map((line5, lineIndex) => {
59269
59375
  const window2 = windows[lineIndex];
59270
59376
  let sourceColumn = 0;
@@ -59288,7 +59394,7 @@ function InputBar({
59288
59394
  return selection !== void 0 && start + begin >= selection.start && start + begin < selection.end && visible !== "" && currentTier() !== "none" ? `\x1B[7m${painted}\x1B[27m` : painted;
59289
59395
  });
59290
59396
  });
59291
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow([
59397
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow([
59292
59398
  styled(escapeContent("\u2502 "), "accentText"),
59293
59399
  styled(escapeContent(lineIndex === 0 ? "> " : " "), "accentText"),
59294
59400
  ...window2.hiddenPrefix ? [styled("\u2039", "fgDim")] : [],
@@ -59301,7 +59407,7 @@ function InputBar({
59301
59407
  }
59302
59408
 
59303
59409
  // packages/tui/tui-render/src/agent-hub-pane.tsx
59304
- var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
59410
+ var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
59305
59411
  function formatTokens(value) {
59306
59412
  const scaled = (next) => next >= 100 ? String(Math.round(next)) : String(Math.round(next * 10) / 10);
59307
59413
  if (value < 1e3) return String(value);
@@ -59338,14 +59444,14 @@ function aggregateLine(rows) {
59338
59444
  }
59339
59445
  function hubRow(row, selected) {
59340
59446
  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: [
59447
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { width: "100%", flexDirection: "column", children: [
59448
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text, { wrap: "truncate", children: [
59343
59449
  selected ? styled(escapeContent("\u203A "), "accent", void 0, true) : " ",
59344
59450
  paintRow([styled(escapeContent(label), selected ? "fg" : "fgSoft", void 0, selected)])
59345
59451
  ] }),
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")]) })
59452
+ row.task !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(` \u4EFB\u52A1 \xB7 ${escapeContent(row.task)}`, "fgSoft")]) }),
59453
+ 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")]) }),
59454
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(` ${escapeContent(`\u5B50\u4F1A\u8BDD ID \xB7 ${row.id}`)}`, "fgDim")]) })
59349
59455
  ] }, row.id);
59350
59456
  }
59351
59457
  function hubLimitsFootnote(liveContinuable, maxActiveSubagents, maxDepth) {
@@ -59391,7 +59497,7 @@ function AgentHubBody({
59391
59497
  if (view === "transcript") onViewportChange?.({ offset: start, maxOffset: maximum, pageRows: pageSize });
59392
59498
  }, [view, start, maximum, pageSize, onViewportChange]);
59393
59499
  if (missing) {
59394
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
59500
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
59395
59501
  OverlayShell,
59396
59502
  {
59397
59503
  title: "\u5B50\u4EE3\u7406",
@@ -59404,13 +59510,13 @@ function AgentHubBody({
59404
59510
  const selected = rows[clamped];
59405
59511
  const addressable = selected?.parentSessionId !== void 0 && selected.parentSessionId !== selected.id && selected.mode !== void 0;
59406
59512
  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 })
59513
+ const editor = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
59514
+ notice !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(notice), "fgDim")]) }),
59515
+ renderEditor && prompt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(InputBar, { text: prompt, caretIndex, commandMode: false, mentionMode: false })
59410
59516
  ] });
59411
59517
  if (view === "transcript") {
59412
59518
  if (error51 !== void 0 && error51 !== "" && prompt === void 0) {
59413
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
59519
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
59414
59520
  OverlayShell,
59415
59521
  {
59416
59522
  title: "\u5B50\u4EE3\u7406",
@@ -59428,7 +59534,7 @@ function AgentHubBody({
59428
59534
  const total = lines.length;
59429
59535
  const slice = lines.slice(start, start + pageSize);
59430
59536
  const scrollInfo = total > pageSize ? ` (${String(start + 1)}-${String(Math.min(start + slice.length, total))}/${String(total)})` : "";
59431
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
59537
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
59432
59538
  OverlayShell,
59433
59539
  {
59434
59540
  title: "\u5B50\u4EE3\u7406",
@@ -59438,10 +59544,10 @@ ${controls}
59438
59544
  Esc \u8FD4\u56DE \xB7 ${scrollOffset === Number.MAX_SAFE_INTEGER ? "\u8DDF\u968F\u6700\u65B0" : "\u9605\u8BFB\u4E2D"}${scrollInfo}
59439
59545
  ${split ? "\u5E76\u6392\u67E5\u770B" : "\u53EA\u8BFB\u67E5\u770B"}\uFF0C\u4E3B\u4F1A\u8BDD\u7EE7\u7EED\u8FD0\u884C`,
59440
59546
  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")]) })
59547
+ headerSegments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { width: "100%", flexDirection: "column", marginY: 0, children: [
59548
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(headerSegments.join(" \xB7 ")), "accent", void 0, true)]) }),
59549
+ selectedRow?.id && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(`\u5B50\u4F1A\u8BDD ID \xB7 ${selectedRow.id}`), "fgDim")]) }),
59550
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: paintRow([styled(escapeContent("\u2500\u2500\u2500 \u6267\u884C\u60C5\u51B5 \u2500\u2500\u2500"), "fgDim")]) })
59445
59551
  ] }),
59446
59552
  slice.map((lineText, index2) => {
59447
59553
  const isUser = lineText.startsWith("> ");
@@ -59452,7 +59558,7 @@ ${split ? "\u5E76\u6392\u67E5\u770B" : "\u53EA\u8BFB\u67E5\u770B"}\uFF0C\u4E3B\u
59452
59558
  if (isUser) token = "accent";
59453
59559
  else if (isTool) token = "codeKeyword";
59454
59560
  else if (isResult || isTurn) token = "fgDim";
59455
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { children: paintRow([styled(escapeContent(lineText), token)]) }, start + index2);
59561
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: paintRow([styled(escapeContent(lineText), token)]) }, start + index2);
59456
59562
  }),
59457
59563
  editor
59458
59564
  ]
@@ -59460,7 +59566,7 @@ ${split ? "\u5E76\u6392\u67E5\u770B" : "\u53EA\u8BFB\u67E5\u770B"}\uFF0C\u4E3B\u
59460
59566
  );
59461
59567
  }
59462
59568
  if (error51 !== void 0 && error51 !== "" && prompt === void 0) {
59463
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
59569
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
59464
59570
  OverlayShell,
59465
59571
  {
59466
59572
  title: "\u5B50\u4EE3\u7406",
@@ -59470,7 +59576,7 @@ ${split ? "\u5E76\u6392\u67E5\u770B" : "\u53EA\u8BFB\u67E5\u770B"}\uFF0C\u4E3B\u
59470
59576
  );
59471
59577
  }
59472
59578
  if (rows.length === 0) {
59473
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
59579
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
59474
59580
  OverlayShell,
59475
59581
  {
59476
59582
  title: "\u5B50\u4EE3\u7406",
@@ -59487,7 +59593,7 @@ ${controls}`;
59487
59593
  const footerRows = wrapDisplayLines(footnote, columns || 80).length;
59488
59594
  const windowSize = Math.max(1, Math.floor((height - 9 - footerRows) / 4));
59489
59595
  const rowStart = Math.max(0, Math.min(rows.length - windowSize, clamped - Math.floor(windowSize / 2)));
59490
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
59596
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
59491
59597
  OverlayShell,
59492
59598
  {
59493
59599
  title: "\u5B50\u4EE3\u7406",
@@ -59495,18 +59601,18 @@ ${controls}`;
59495
59601
  footnote,
59496
59602
  children: [
59497
59603
  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")]) }),
59604
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(aggregateLine(rows)), "fgDim")]) }),
59499
59605
  editor
59500
59606
  ]
59501
59607
  }
59502
59608
  );
59503
59609
  }
59504
59610
  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 }) });
59611
+ 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
59612
  }
59507
59613
 
59508
59614
  // packages/tui/tui-render/src/plan-directory-pane.tsx
59509
- var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
59615
+ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
59510
59616
  var TITLE3 = "\u8BA1\u5212";
59511
59617
  var FOOTNOTE2 = "j/k \u9009\u62E9 \xB7 Enter \u5207\u6362 \xB7 Esc \u5173\u95ED";
59512
59618
  var SWITCH_NEXT = "\u5F53\u524D\u6A21\u5F0F\u4FDD\u6301\u4E0D\u53D8 \xB7 \u53EF\u91CD\u8BD5";
@@ -59519,13 +59625,13 @@ var EMPTY_PLAN_DIRECTORY_PANE = {
59519
59625
  };
59520
59626
  function directoryRow(label, selected, current) {
59521
59627
  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")]) })
59628
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Box_default, { width: "100%", children: [
59629
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: selected ? styled(escapeContent("\u203A "), "accent", void 0, true) : " " }),
59630
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: paintRow([styled(escapeContent(text4), selected ? "fg" : "fgDim")]) })
59525
59631
  ] }, label);
59526
59632
  }
59527
59633
  function line3(text4, token) {
59528
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: paintRow([styled(escapeContent(text4), token)]) });
59634
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: paintRow([styled(escapeContent(text4), token)]) });
59529
59635
  }
59530
59636
  function PlanDirectoryPane({
59531
59637
  selectedIndex = 0,
@@ -59534,7 +59640,7 @@ function PlanDirectoryPane({
59534
59640
  statusError
59535
59641
  }) {
59536
59642
  if (statusError !== void 0 && statusError !== "") {
59537
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
59643
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
59538
59644
  OverlayShell,
59539
59645
  {
59540
59646
  title: TITLE3,
@@ -59543,7 +59649,7 @@ function PlanDirectoryPane({
59543
59649
  }
59544
59650
  );
59545
59651
  }
59546
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(OverlayShell, { title: TITLE3, footnote: FOOTNOTE2, children: [
59652
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(OverlayShell, { title: TITLE3, footnote: FOOTNOTE2, children: [
59547
59653
  ROWS.map(
59548
59654
  (label, index2) => directoryRow(
59549
59655
  label,
@@ -59551,7 +59657,7 @@ function PlanDirectoryPane({
59551
59657
  label === "\u5F00\u542F" ? currentActive : !currentActive
59552
59658
  )
59553
59659
  ),
59554
- switchError !== void 0 && switchError !== "" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59660
+ switchError !== void 0 && switchError !== "" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59555
59661
  line3(`\u2717 \u5207\u6362\u8BA1\u5212\u5931\u8D25\uFF1A${switchError}`, "error"),
59556
59662
  line3(SWITCH_NEXT, "fgDim")
59557
59663
  ] }) : null
@@ -59560,7 +59666,7 @@ function PlanDirectoryPane({
59560
59666
 
59561
59667
  // packages/tui/tui-render/src/plan-review-pane.tsx
59562
59668
  var import_react43 = __toESM(require_react(), 1);
59563
- var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
59669
+ var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
59564
59670
  var TITLE4 = "\u8BA1\u5212\u8BC4\u5BA1";
59565
59671
  var FOOTNOTE3 = "y \u6279\u51C6 \xB7 n \u7EE7\u7EED\u89C4\u5212 \xB7 Esc \u53D6\u6D88";
59566
59672
  var EMPTY_BODY = "\u8BA1\u5212\u6B63\u6587\u4E3A\u7A7A";
@@ -59570,7 +59676,7 @@ var EMPTY_PLAN_REVIEW_PANE = {
59570
59676
  open: false
59571
59677
  };
59572
59678
  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)]) });
59679
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(escapeContent(text4), token, void 0, bold)]) });
59574
59680
  }
59575
59681
  function PlanReviewPane({
59576
59682
  plan = "",
@@ -59604,20 +59710,20 @@ ${DELIVERY_NEXT2}` : "", width);
59604
59710
  const view = failed ? errorView : planView;
59605
59711
  const position2 = view.total > 0 ? ` ${view.start + 1}\u2013${view.start + view.visible.length}/${view.total}` : "";
59606
59712
  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));
59713
+ 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
59714
  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")]) }),
59715
+ 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));
59716
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59717
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([styled(TITLE4, "fg", void 0, true), styled(position2, "fgDim")]) }),
59612
59718
  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")]) }),
59719
+ /* @__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")]) }),
59720
+ /* @__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
59721
  line4(width < 70 ? "\u2191\u2193/PgUp/PgDn \xB7 Home/End \xB7 Esc \u53D6\u6D88" : `${FOOTNOTE3} \xB7 \u2191\u2193/PgUp/PgDn \u6D4F\u89C8`, "fgDim")
59616
59722
  ] });
59617
59723
  }
59618
59724
 
59619
59725
  // packages/tui/tui-render/src/ask-user-pane.tsx
59620
- var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
59726
+ var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
59621
59727
  var FOOTNOTE4 = "Enter \u4F5C\u7B54 \xB7 Esc \u53D6\u6D88\u63D0\u95EE";
59622
59728
  var INVALID_TITLE = "\u2717 \u63D0\u95EE\u65E0\u6548";
59623
59729
  var INVALID_NEXT = "Esc \u53D6\u6D88";
@@ -59662,9 +59768,9 @@ function AskUserPane({
59662
59768
  const detailRows = useDialogTextRows(source, width);
59663
59769
  const view = useDialogWindow(detailRows, offset, limit, detailsOpen ? onOffsetChange : void 0);
59664
59770
  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)(
59771
+ if (editingCustom && !detailsOpen) return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59772
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([styled(`${escapeContent(header)}${progress}`, "fg", void 0, true)]) }),
59773
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
59668
59774
  InputBar,
59669
59775
  {
59670
59776
  text: (customText ?? "").replace(/[\r\n]/gu, "\u21B5"),
@@ -59674,10 +59780,10 @@ function AskUserPane({
59674
59780
  rowsBelow: customRowsBelow ?? 2
59675
59781
  }
59676
59782
  ),
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")]) })
59783
+ /* @__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
59784
  ] });
59679
59785
  if (options.length === 0 && !editingCustom) {
59680
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59786
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59681
59787
  renderPaneLine(INVALID_TITLE, "error", true),
59682
59788
  renderPaneLine(INVALID_NEXT, "fgDim")
59683
59789
  ] });
@@ -59685,28 +59791,28 @@ function AskUserPane({
59685
59791
  const start = Math.max(0, Math.min(options.length - limit, selected - Math.floor(limit / 2)));
59686
59792
  const position2 = detailsOpen ? ` ${view.start + 1}\u2013${view.start + view.visible.length}/${view.total}` : "";
59687
59793
  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) => {
59794
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59795
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([styled(heading, "fg", void 0, true)]) }),
59796
+ 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
59797
  const actualIndex = start + index2;
59692
59798
  const active = actualIndex === selected;
59693
59799
  const marker = multiSelect ? selectedIndices?.includes(actualIndex) ? "[x] " : "[ ] " : "";
59694
59800
  const numbered = escapeContent(`${actualIndex + 1} ${marker}${label}`).replace(/\n/g, " \u21B5 ");
59695
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { wrap: "truncate", children: paintRow([
59801
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([
59696
59802
  styled(active ? "\u203A " : " ", "accent", void 0, active),
59697
59803
  styled(numbered, active ? "fg" : "fgDim", void 0, active)
59698
59804
  ]) }, actualIndex);
59699
59805
  }),
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")]) })
59806
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", width: "100%", flexShrink: 0, children: [
59807
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { wrap: "truncate", children: paintRow([styled(editingCustom ? "Tab/Esc \u8FD4\u56DE\u8F93\u5165" : FOOTNOTE4, "fgDim")]) }),
59808
+ /* @__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")]) }),
59809
+ /* @__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
59810
  ] })
59705
59811
  ] });
59706
59812
  }
59707
59813
 
59708
59814
  // packages/tui/tui-render/src/timeline-view.tsx
59709
- var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
59815
+ var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
59710
59816
  var FIRST_LINE_MAX = 120;
59711
59817
  var TIMELINE_WINDOW = 60;
59712
59818
  function TimelineView({
@@ -59721,19 +59827,19 @@ function TimelineView({
59721
59827
  const start = Math.max(0, end - TIMELINE_WINDOW);
59722
59828
  const visible = history.slice(start, end);
59723
59829
  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: [
59830
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
59831
+ history.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { dimColor: true, children: "\uFF08\u65E0\u5386\u53F2\u6D88\u606F\uFF09" }) : null,
59832
+ start > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Text, { dimColor: true, children: [
59727
59833
  "\u2026 \u8FD8\u6709 ",
59728
59834
  start,
59729
59835
  " \u6761"
59730
59836
  ] }) : null,
59731
- visible.map((message, index2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { children: [
59837
+ visible.map((message, index2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Text, { children: [
59732
59838
  styled(relativeTime(message.timestamp, clock), "fgDim"),
59733
59839
  ` ${message.kind === "user" ? "> " : "\u25CF "}`,
59734
59840
  index2 === current ? styled(escapeContent(firstLine(message.text)), "accent") : escapeContent(firstLine(message.text))
59735
59841
  ] }, start + index2)),
59736
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { children: styled(escapeContent("\u2191\u2193/jk \u6EDA\u52A8 \xB7 Esc \u5173\u95ED"), "fgDim") })
59842
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { children: styled(escapeContent("\u2191\u2193/jk \u6EDA\u52A8 \xB7 Esc \u5173\u95ED"), "fgDim") })
59737
59843
  ] });
59738
59844
  }
59739
59845
  function firstLine(text4) {
@@ -59742,7 +59848,7 @@ function firstLine(text4) {
59742
59848
  }
59743
59849
 
59744
59850
  // packages/tui/tui-render/src/command-menu.tsx
59745
- var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
59851
+ var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
59746
59852
  var COMMAND_MENU_WINDOW = 8;
59747
59853
  var MARKER_COLS2 = 2;
59748
59854
  var NAME_GAP = 2;
@@ -59809,11 +59915,11 @@ function CommandMenu({
59809
59915
  const widthName = displayWidth(`/${item.name}`);
59810
59916
  if (widthName > nameCols) nameCols = widthName;
59811
59917
  }
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)) }) });
59918
+ 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
59919
  }
59814
59920
 
59815
59921
  // packages/tui/tui-render/src/mention.tsx
59816
- var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
59922
+ var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
59817
59923
  var KIND_LABELS = {
59818
59924
  file: "\u6587\u4EF6",
59819
59925
  directory: "\u76EE\u5F55",
@@ -59831,10 +59937,10 @@ function Mention({
59831
59937
  const { columns } = use_window_size_default();
59832
59938
  const width = conversationWidth(columns > 0 ? columns : 80);
59833
59939
  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" }) }) });
59940
+ 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
59941
  }
59836
59942
  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" }) }) });
59943
+ 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
59944
  }
59839
59945
  const clampedIndex = Math.max(0, Math.min(selectedIndex, candidates.length - 1));
59840
59946
  const sections = /* @__PURE__ */ new Map();
@@ -59850,12 +59956,12 @@ function Mention({
59850
59956
  let rowIndex = 0;
59851
59957
  for (const [kind, group] of sections) {
59852
59958
  rows.push(
59853
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { wrap: "truncate", children: styled(KIND_LABELS[kind], "accentText", void 0, true) }, kind)
59959
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { wrap: "truncate", children: styled(KIND_LABELS[kind], "accentText", void 0, true) }, kind)
59854
59960
  );
59855
59961
  for (const candidate of group) {
59856
59962
  const selected = rowIndex === clampedIndex;
59857
59963
  rows.push(
59858
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Text, { wrap: "truncate", children: [
59964
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { wrap: "truncate", children: [
59859
59965
  selected ? styled(escapeContent("\u203A "), "accent", void 0, true) : " ",
59860
59966
  styled(`@ ${escapeContent(candidate.name)}`, selected ? "fg" : "fgSoft", void 0, selected),
59861
59967
  candidate.description !== void 0 ? styled(` \u2014 ${escapeContent(candidate.description)}`, "fgDim") : ""
@@ -59864,7 +59970,7 @@ function Mention({
59864
59970
  rowIndex += 1;
59865
59971
  }
59866
59972
  }
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 }) });
59973
+ 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
59974
  }
59869
59975
 
59870
59976
  // packages/tui/tui-render/src/goal-footer.ts
@@ -60248,7 +60354,7 @@ function layoutHud(input) {
60248
60354
  }
60249
60355
 
60250
60356
  // packages/tui/tui-render/src/workflow-overlay.tsx
60251
- var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
60357
+ var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
60252
60358
  var WORKFLOW_OVERLAY_WINDOW = 8;
60253
60359
  var EMPTY_WORKFLOW_OVERLAY = { open: false, offset: 0 };
60254
60360
  function WorkflowOverlay({
@@ -60256,15 +60362,15 @@ function WorkflowOverlay({
60256
60362
  }) {
60257
60363
  if (!state.open) return null;
60258
60364
  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" });
60365
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u6D41", error: state.error, footnote: "Esc \u5173\u95ED" });
60260
60366
  }
60261
60367
  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" });
60368
+ 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
60369
  }
60264
60370
  const rows = [];
60265
60371
  if (state.run.phase !== void 0 && state.run.phase !== "") {
60266
60372
  rows.push(
60267
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { children: paintRow([styled(escapeContent(`\u9636\u6BB5 ${state.run.phase}`), "fg")]) }, "phase")
60373
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { children: paintRow([styled(escapeContent(`\u9636\u6BB5 ${state.run.phase}`), "fg")]) }, "phase")
60268
60374
  );
60269
60375
  }
60270
60376
  const windowed = state.run.members.slice(
@@ -60274,17 +60380,17 @@ function WorkflowOverlay({
60274
60380
  for (const member of windowed) {
60275
60381
  const outcomeSuffix = member.outcome === void 0 ? "" : ` \xB7 ${member.outcome}`;
60276
60382
  rows.push(
60277
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { children: paintRow([
60383
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { children: paintRow([
60278
60384
  styled(escapeContent(`${member.seq} \xB7 ${member.label}${outcomeSuffix}`), "fgDim")
60279
60385
  ]) }, member.seq)
60280
60386
  );
60281
60387
  }
60282
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u6D41", footnote: "j/k \u6EDA\u52A8 \xB7 Esc \u5173\u95ED", children: rows });
60388
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u6D41", footnote: "j/k \u6EDA\u52A8 \xB7 Esc \u5173\u95ED", children: rows });
60283
60389
  }
60284
60390
 
60285
60391
  // packages/tui/tui-render/src/workspace-pane.tsx
60286
60392
  var import_react44 = __toESM(require_react(), 1);
60287
- var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
60393
+ var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
60288
60394
  var EMPTY_WORKSPACE_PANE = {
60289
60395
  open: false,
60290
60396
  root: "",
@@ -60377,12 +60483,12 @@ function WorkspacePreview({ preview, columns, maxRows, onLayout, systemOpen }) {
60377
60483
  if (start >= fragment.end) break;
60378
60484
  }
60379
60485
  }
60380
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow(parts, "codeBg", columns) }, `${fragment.line}:${fragment.start}`);
60486
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { wrap: "truncate", children: paintBackgroundRow(parts, "codeBg", columns) }, `${fragment.line}:${fragment.start}`);
60381
60487
  });
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)]) }),
60488
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Box_default, { flexDirection: "column", width: columns, children: [
60489
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { wrap: "truncate", children: paintRow([styled(title, "fg", void 0, true)]) }),
60384
60490
  rows,
60385
- maxRows > 1 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { wrap: "truncate", children: paintRow([styled(footnote, "fgDim")]) }) : null
60491
+ maxRows > 1 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { wrap: "truncate", children: paintRow([styled(footnote, "fgDim")]) }) : null
60386
60492
  ] });
60387
60493
  }
60388
60494
  function WorkspacePane({
@@ -60394,10 +60500,10 @@ function WorkspacePane({
60394
60500
  const { rows: windowRows, columns: windowColumns } = use_window_size_default();
60395
60501
  if (!state.open) return null;
60396
60502
  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" });
60503
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(OverlayShell, { title: "\u5DE5\u4F5C\u533A", error: state.error, footnote: "Esc \u5173\u95ED" });
60398
60504
  }
60399
60505
  if (state.preview !== void 0) {
60400
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
60506
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
60401
60507
  WorkspacePreview,
60402
60508
  {
60403
60509
  preview: state.preview,
@@ -60418,7 +60524,7 @@ function WorkspacePane({
60418
60524
  const selected = index2 === state.selectedIndex && !state.editing;
60419
60525
  const head = `${selected ? "\u203A " : " "}${" ".repeat(node2.depth)}${glyph} `;
60420
60526
  rows.push(
60421
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { wrap: "truncate", children: paintRow([
60527
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { wrap: "truncate", children: paintRow([
60422
60528
  styled(escapeContent(head), selected ? "accent" : "fgDim"),
60423
60529
  styled(
60424
60530
  truncateDisplay(
@@ -60430,7 +60536,7 @@ function WorkspacePane({
60430
60536
  ]) }, node2.path)
60431
60537
  );
60432
60538
  });
60433
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
60539
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
60434
60540
  OverlayShell,
60435
60541
  {
60436
60542
  title: state.mode === "deliveries" ? "\u4EA4\u4ED8\u6587\u4EF6" : "\u5DE5\u4F5C\u533A",
@@ -60444,7 +60550,7 @@ function WorkspacePane({
60444
60550
  }
60445
60551
 
60446
60552
  // packages/tui/tui-render/src/plugins-pane.tsx
60447
- var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
60553
+ var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
60448
60554
  var EMPTY_PLUGINS_PANE = {
60449
60555
  open: false,
60450
60556
  available: false,
@@ -60549,11 +60655,11 @@ function PluginsPane({ state, locale = "zh-CN", maxCols, maxRows }) {
60549
60655
  return { text: text4, token };
60550
60656
  });
60551
60657
  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)) });
60658
+ 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
60659
  }
60554
60660
 
60555
60661
  // packages/tui/tui-render/src/account-pane.tsx
60556
- var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
60662
+ var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
60557
60663
  var EMPTY_ACCOUNT_PANE = {
60558
60664
  open: false,
60559
60665
  available: false,
@@ -60648,11 +60754,11 @@ function AccountPane({ state, locale = "zh-CN", maxCols }) {
60648
60754
  }
60649
60755
  if (state.busy) hint = copy("accountBusyHint");
60650
60756
  }
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)) });
60757
+ 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
60758
  }
60653
60759
 
60654
60760
  // packages/tui/tui-render/src/feedback-pane.tsx
60655
- var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
60761
+ var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
60656
60762
  var EMPTY_FEEDBACK_PANE = {
60657
60763
  open: false,
60658
60764
  hasTarget: false,
@@ -60668,10 +60774,10 @@ function FeedbackPane({
60668
60774
  }) {
60669
60775
  if (!state.open) return null;
60670
60776
  if (state.error !== void 0) {
60671
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(OverlayShell, { title: "\u53CD\u9988", error: state.error, footnote: "Esc \u5173\u95ED" });
60777
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(OverlayShell, { title: "\u53CD\u9988", error: state.error, footnote: "Esc \u5173\u95ED" });
60672
60778
  }
60673
60779
  if (!state.hasTarget) {
60674
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
60780
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
60675
60781
  OverlayShell,
60676
60782
  {
60677
60783
  title: "\u53CD\u9988",
@@ -60687,7 +60793,7 @@ function FeedbackPane({
60687
60793
  { key: "negative", shortcut: "[d] ", label: "\u8E29", token: "warning" }
60688
60794
  ].map((row) => {
60689
60795
  const isCurrent = state.rating === row.key;
60690
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text, { wrap: "truncate", children: paintRow([
60796
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text, { wrap: "truncate", children: paintRow([
60691
60797
  styled(escapeContent(` ${row.shortcut}`), isCurrent ? row.token : "fgDim", void 0, isCurrent),
60692
60798
  styled(
60693
60799
  escapeContent(`${row.label}${isCurrent ? " \xB7 \u5F53\u524D" : ""}`),
@@ -60699,13 +60805,13 @@ function FeedbackPane({
60699
60805
  });
60700
60806
  if (state.note !== void 0 && state.note.trim() !== "") {
60701
60807
  rows.push(
60702
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text, { wrap: "truncate", children: paintRow([
60808
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text, { wrap: "truncate", children: paintRow([
60703
60809
  styled(" \u5907\u6CE8: ", "fgDim"),
60704
60810
  styled(escapeContent(state.note), "fgSoft")
60705
60811
  ]) }, "note")
60706
60812
  );
60707
60813
  }
60708
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
60814
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
60709
60815
  OverlayShell,
60710
60816
  {
60711
60817
  title: "\u53CD\u9988",
@@ -60757,7 +60863,7 @@ function toolDetailsKeyAction(key, info) {
60757
60863
 
60758
60864
  // packages/tui/tui-render/src/todo-pane.tsx
60759
60865
  var import_react45 = __toESM(require_react(), 1);
60760
- var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
60866
+ var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
60761
60867
  function TodoPane({ todos, offset, onOffsetChange, locale }) {
60762
60868
  const { columns, rows } = use_window_size_default();
60763
60869
  const width = Math.max(1, (columns || 80) - 4);
@@ -60790,15 +60896,15 @@ function TodoPane({ todos, offset, onOffsetChange, locale }) {
60790
60896
  }, [start, offset, onOffsetChange]);
60791
60897
  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
60898
  const position2 = lines.length === 0 ? "" : ` ${start + 1}\u2013${Math.min(start + height, lines.length)}/${lines.length}`;
60793
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
60899
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
60794
60900
  OverlayShell,
60795
60901
  {
60796
60902
  title: english ? "TODO list" : "\u5F85\u529E\u6E05\u5355",
60797
60903
  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
60904
  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))
60905
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { wrap: "truncate", children: paintRow([styled(summary2, "fgDim")]) }),
60906
+ 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" }),
60907
+ 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
60908
  ]
60803
60909
  }
60804
60910
  );
@@ -60806,7 +60912,7 @@ function TodoPane({ todos, offset, onOffsetChange, locale }) {
60806
60912
 
60807
60913
  // packages/tui/tui-render/src/schedule-pane.tsx
60808
60914
  var import_react46 = __toESM(require_react(), 1);
60809
- var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
60915
+ var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
60810
60916
  var EMPTY_SCHEDULE_PANE = {
60811
60917
  open: false,
60812
60918
  rows: [],
@@ -60853,14 +60959,14 @@ ${escapeContent(selected.id)}
60853
60959
  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
60960
  }
60855
60961
  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))
60962
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(OverlayShell, { title: `\u5B9A\u65F6\u4EFB\u52A1 \xB7 ${state.rows.length}`, footnote, children: [
60963
+ state.error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { wrap: "truncate", children: paintRow([styled(truncateDisplay(escapeContent(state.error), width), "fg")]) }),
60964
+ 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
60965
  ] });
60860
60966
  }
60861
60967
 
60862
60968
  // packages/tui/tui-render/src/tool-details-pane.tsx
60863
- var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
60969
+ var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
60864
60970
  var EMPTY_TOOL_DETAILS_PANE = Object.freeze({
60865
60971
  open: false,
60866
60972
  cards: [],
@@ -60897,21 +61003,21 @@ function ToolDetailsPane({ state, columns, maxRows, pageRows, locale }) {
60897
61003
  }
60898
61004
  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
61005
  }
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)) })
61006
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
61007
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { wrap: "truncate", children: heading }),
61008
+ lines.map((line5, index2) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { wrap: "truncate", children: line5 }, index2)),
61009
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { dimColor: true, wrap: "truncate", children: escapeContent(tuiCopy(state.detail ? "toolPageHint" : "toolListHint", locale)) })
60904
61010
  ] });
60905
61011
  }
60906
61012
 
60907
61013
  // packages/tui/tui-render/src/queue-chip.tsx
60908
- var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
61014
+ var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
60909
61015
  function queueChipText(count) {
60910
61016
  return count <= 0 ? void 0 : `\u5F85\u53D1 ${String(count)} \xB7 \u2191 \u53D6\u51FA`;
60911
61017
  }
60912
61018
  function QueueChip({ count }) {
60913
61019
  const text4 = queueChipText(count);
60914
- return text4 === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { children: paintRow([styled(escapeContent(text4), "fg")]) });
61020
+ return text4 === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { children: paintRow([styled(escapeContent(text4), "fg")]) });
60915
61021
  }
60916
61022
 
60917
61023
  // packages/tui/tui-render/src/loop.tsx
@@ -61365,10 +61471,15 @@ function mapKeyEvent(state, key, keyInfo, commands, pane, search2, timeline = {
61365
61471
  });
61366
61472
  }
61367
61473
  if (settings.open) {
61474
+ if (settings.busy === true) return { kind: "none" };
61368
61475
  if (settings.searching === true) {
61369
61476
  const query = settings.filter ?? "";
61370
61477
  if (keyInfo.escape) return holdComposer(state, { kind: "settings-search", query: "", active: false });
61371
61478
  if (keyInfo.return) return holdComposer(state, { kind: "settings-search", query, active: false });
61479
+ if (keyInfo.tab) return holdComposer(state, { kind: "settings-group", delta: keyInfo.shift ? -1 : 1 });
61480
+ if (keyInfo.downArrow || keyInfo.upArrow) return holdComposer(state, { kind: "settings-move", delta: keyInfo.downArrow ? 1 : -1 });
61481
+ if (keyInfo.pageDown || keyInfo.pageUp) return holdComposer(state, { kind: "settings-move", delta: keyInfo.pageDown ? 5 : -5 });
61482
+ if (keyInfo.home || keyInfo.end) return holdComposer(state, { kind: "settings-move", delta: keyInfo.end ? 1e4 : -1e4 });
61372
61483
  if (keyInfo.backspace || keyInfo.delete) return holdComposer(state, { kind: "settings-search", query: Array.from(query).slice(0, -1).join(""), active: true });
61373
61484
  if (!keyInfo.ctrl && !keyInfo.meta && !keyInfo.upArrow && !keyInfo.downArrow && key !== "") return holdComposer(state, { kind: "settings-search", query: query + key, active: true });
61374
61485
  return { kind: "none" };
@@ -61381,7 +61492,9 @@ function mapKeyEvent(state, key, keyInfo, commands, pane, search2, timeline = {
61381
61492
  }
61382
61493
  if (keyInfo.return || keyInfo.rightArrow || key === "i") {
61383
61494
  if (key !== "i" && settings.navigable === true) return holdComposer(state, { kind: "settings-edit" });
61495
+ if (keyInfo.rightArrow) return { kind: "none" };
61384
61496
  if (settings.editable === false) return { kind: "none" };
61497
+ if (keyInfo.return && settings.toggleable === true) return holdComposer(state, { kind: "settings-toggle" });
61385
61498
  return {
61386
61499
  kind: "dispatch",
61387
61500
  action: { kind: key === "i" ? "settings-edit-json" : "settings-edit" },
@@ -62855,6 +62968,8 @@ function TuiLoop({
62855
62968
  editing: settingsPaneRef.current.editing,
62856
62969
  onboarding: settingsPaneRef.current.onboarding,
62857
62970
  navigable: settingsPaneRef.current.rows[settingsPaneRef.current.selectedIndex]?.navigable,
62971
+ toggleable: canToggleSetting(settingsPaneRef.current.rows[settingsPaneRef.current.selectedIndex]),
62972
+ busy: settingsPaneRef.current.busy,
62858
62973
  editable: settingsPaneRef.current.rows[settingsPaneRef.current.selectedIndex]?.editable,
62859
62974
  searching: settingsPaneRef.current.searching,
62860
62975
  filter: settingsPaneRef.current.filter,
@@ -63386,6 +63501,8 @@ function TuiLoop({
63386
63501
  locale,
63387
63502
  rows: settingsPane.rows,
63388
63503
  ...settingsPane.breadcrumb === void 0 ? {} : { breadcrumb: settingsPane.breadcrumb },
63504
+ ...settingsPane.categories === void 0 ? {} : { categories: settingsPane.categories },
63505
+ ...settingsPane.activeCategory === void 0 ? {} : { activeCategory: settingsPane.activeCategory },
63389
63506
  ...settingsPane.filter === void 0 ? {} : { filter: settingsPane.filter },
63390
63507
  ...settingsPane.searching === void 0 ? {} : { searching: settingsPane.searching },
63391
63508
  selectedIndex: settingsPane.selectedIndex,
@@ -63537,7 +63654,12 @@ function TuiLoop({
63537
63654
  mentionMode: false,
63538
63655
  caretIndex: state.caretIndex,
63539
63656
  selectionAnchor: state.selectionAnchor,
63540
- secret: settingsPane.editing && (settingsPane.onboarding === true || settingsPane.rows[settingsPane.selectedIndex]?.namespace === "credentials")
63657
+ secret: settingsPane.editing && (settingsPane.onboarding === true || settingsPane.rows[settingsPane.selectedIndex]?.namespace === "credentials"),
63658
+ ...settingsPane.editing ? {
63659
+ actionHint: locale === "en-US" ? "Setting value \xB7 Enter save \xB7 Esc cancel" : "\u8BBE\u7F6E\u503C \xB7 Enter \u4FDD\u5B58 \xB7 Esc \u53D6\u6D88",
63660
+ modelChip: "",
63661
+ modeChip: ""
63662
+ } : {}
63541
63663
  });
63542
63664
  } else if (toolDetailsPane.open) {
63543
63665
  inputSlot = void 0;
@@ -69385,13 +69507,13 @@ ${formattedError}` });
69385
69507
  }
69386
69508
 
69387
69509
  // packages/tui/tui-render/src/todo-hud.tsx
69388
- var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
69510
+ var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
69389
69511
 
69390
69512
  // packages/tui/tui-render/src/jobs-hud.tsx
69391
- var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
69513
+ var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
69392
69514
 
69393
69515
  // packages/tui/tui-render/src/workflow-hud.tsx
69394
- var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
69516
+ var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
69395
69517
 
69396
69518
  // packages/tui/tui-render/src/interaction-state.ts
69397
69519
  function reduceInteraction(state, event) {
@@ -99609,6 +99731,7 @@ var SettingsNavigation = class {
99609
99731
  parentId = "";
99610
99732
  query = "";
99611
99733
  selections = /* @__PURE__ */ new Map();
99734
+ categoryPositions = /* @__PURE__ */ new Map();
99612
99735
  beforeSearchIndex = 0;
99613
99736
  get rows() {
99614
99737
  const query = this.query.toLocaleLowerCase();
@@ -99624,10 +99747,28 @@ var SettingsNavigation = class {
99624
99747
  }
99625
99748
  return [...labels, ...tail];
99626
99749
  }
99750
+ get categories() {
99751
+ return this.nodes.filter((node2) => node2.parentId === "").map((node2) => ({
99752
+ id: node2.id,
99753
+ label: node2.label ?? node2.field,
99754
+ count: this.nodes.filter((child) => child.parentId === node2.id).length
99755
+ }));
99756
+ }
99757
+ get activeCategory() {
99758
+ let node2 = this.nodes.find((entry) => entry.id === this.parentId);
99759
+ while (node2 !== void 0 && node2.parentId !== "") node2 = this.nodes.find((entry) => entry.id === node2?.parentId);
99760
+ return node2?.id;
99761
+ }
99762
+ open() {
99763
+ if (this.parentId === "") this.group(1);
99764
+ }
99627
99765
  get filter() {
99628
99766
  return this.query;
99629
99767
  }
99630
99768
  remember() {
99769
+ if (this.query !== "") return;
99770
+ const category = this.activeCategory;
99771
+ if (category !== void 0) this.categoryPositions.set(category, this.parentId);
99631
99772
  const id = this.rows[this.selectedIndex]?.id;
99632
99773
  if (id !== void 0) this.selections.set(this.parentId, id);
99633
99774
  }
@@ -99638,8 +99779,22 @@ var SettingsNavigation = class {
99638
99779
  replace(nodes) {
99639
99780
  const selected = this.rows[this.selectedIndex]?.id;
99640
99781
  this.remember();
99782
+ const previous3 = this.nodes;
99641
99783
  this.nodes = nodes;
99642
- if (!nodes.some((node2) => node2.id === this.parentId)) this.parentId = "";
99784
+ const survivingParent = (parent) => {
99785
+ while (parent !== "" && !nodes.some((node2) => node2.id === parent)) {
99786
+ parent = previous3.find((node2) => node2.id === parent)?.parentId ?? "";
99787
+ }
99788
+ return parent;
99789
+ };
99790
+ this.parentId = survivingParent(this.parentId);
99791
+ for (const [parent, id] of this.selections) {
99792
+ if (!nodes.some((node2) => node2.id === id && node2.parentId === parent)) this.selections.delete(parent);
99793
+ }
99794
+ for (const [category, parent] of this.categoryPositions) {
99795
+ if (!nodes.some((node2) => node2.id === category && node2.parentId === "")) this.categoryPositions.delete(category);
99796
+ else this.categoryPositions.set(category, survivingParent(parent));
99797
+ }
99643
99798
  const index2 = this.rows.findIndex((node2) => node2.id === selected);
99644
99799
  if (index2 >= 0) this.selectedIndex = index2;
99645
99800
  else this.restore();
@@ -99660,7 +99815,7 @@ var SettingsNavigation = class {
99660
99815
  return true;
99661
99816
  }
99662
99817
  const node2 = this.nodes.find((entry) => entry.id === this.parentId);
99663
- if (node2 === void 0) return false;
99818
+ if (node2 === void 0 || node2.parentId === "") return false;
99664
99819
  this.remember();
99665
99820
  this.parentId = node2.parentId;
99666
99821
  this.selectedIndex = 0;
@@ -99668,6 +99823,7 @@ var SettingsNavigation = class {
99668
99823
  return true;
99669
99824
  }
99670
99825
  search(query) {
99826
+ if (query === this.query) return;
99671
99827
  if (this.query === "") {
99672
99828
  this.remember();
99673
99829
  this.beforeSearchIndex = this.selectedIndex;
@@ -99677,14 +99833,14 @@ var SettingsNavigation = class {
99677
99833
  if (query === "") this.restore();
99678
99834
  }
99679
99835
  group(delta) {
99836
+ if (this.query !== "") this.search("");
99680
99837
  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];
99838
+ const groups = this.categories;
99839
+ const index2 = groups.findIndex((node2) => node2.id === this.activeCategory);
99840
+ const nextIndex = index2 < 0 ? delta < 0 ? groups.length - 1 : 0 : (index2 + (delta < 0 ? -1 : 1) + groups.length) % groups.length;
99841
+ const next = groups[nextIndex];
99685
99842
  if (next === void 0) return;
99686
- this.parentId = next.id;
99687
- this.query = "";
99843
+ this.parentId = this.categoryPositions.get(next.id) ?? next.id;
99688
99844
  this.selectedIndex = 0;
99689
99845
  this.restore();
99690
99846
  }
@@ -101091,7 +101247,7 @@ var RuntimeController = class _RuntimeController {
101091
101247
  rows: this.settingsRows,
101092
101248
  selectedIndex: this.settingsSelectedIndex,
101093
101249
  editing: this.settingsEditing,
101094
- ...!this.settingsOnboarding ? { breadcrumb: this.settingsNavigation.breadcrumb, filter: this.settingsNavigation.filter, searching: this.settingsSearching } : {},
101250
+ ...!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
101251
  ...this.settingsOnboarding ? { onboarding: true } : {},
101096
101252
  ...this.settingsBusy ? { busy: true } : {},
101097
101253
  ...this.settingsUpdateError === void 0 ? {} : { updateError: this.settingsUpdateError }
@@ -103323,7 +103479,7 @@ ${line5}`.slice(-64e3);
103323
103479
  return;
103324
103480
  }
103325
103481
  case "settings-escape":
103326
- if (!this.settingsOpen) return;
103482
+ if (!this.settingsOpen || this.settingsBusy) return;
103327
103483
  if (this.settingsOnboarding) {
103328
103484
  this.settingsOnboarding = false;
103329
103485
  this.settingsOpen = false;
@@ -103356,6 +103512,7 @@ ${line5}`.slice(-64e3);
103356
103512
  if (!this.settingsOpen || this.settingsEditing || this.settingsOnboarding || this.settingsBusy) return;
103357
103513
  this.settingsNavigation.selectedIndex = this.settingsSelectedIndex;
103358
103514
  this.settingsNavigation.group(action.delta);
103515
+ this.settingsSearching = false;
103359
103516
  this.syncSettingsNavigation();
103360
103517
  return;
103361
103518
  case "settings-move":
@@ -103390,7 +103547,7 @@ ${line5}`.slice(-64e3);
103390
103547
  this.emit();
103391
103548
  return;
103392
103549
  case "settings-cancel-edit":
103393
- if (!this.settingsOpen) return;
103550
+ if (!this.settingsOpen || this.settingsBusy) return;
103394
103551
  if (this.settingsOnboarding) {
103395
103552
  this.settingsOnboarding = false;
103396
103553
  this.settingsOpen = false;
@@ -105170,7 +105327,10 @@ ${row.hint ?? ""}` });
105170
105327
  this.settingsNavigation = new SettingsNavigation([]);
105171
105328
  this.settingsSelectedIndex = 0;
105172
105329
  this.settingsSearching = false;
105173
- this.settingsRows = this.readSettingsRows();
105330
+ this.readSettingsRows();
105331
+ this.settingsNavigation.open();
105332
+ this.settingsRows = this.settingsNavigation.rows;
105333
+ this.settingsSelectedIndex = this.settingsNavigation.selectedIndex;
105174
105334
  this.settingsOnboarding = false;
105175
105335
  this.settingsOpen = true;
105176
105336
  this.emit();
@@ -105297,7 +105457,7 @@ ${row.hint ?? ""}` });
105297
105457
  * @param value - composer draft captured by the key reducer.
105298
105458
  */
105299
105459
  applySettingsValue(value) {
105300
- if (!this.settingsOpen || !this.settingsEditing) return;
105460
+ if (!this.settingsOpen || !this.settingsEditing || this.settingsBusy) return;
105301
105461
  this.settingsEditing = false;
105302
105462
  const row = this.settingsRows[this.settingsSelectedIndex];
105303
105463
  if (row === void 0) {
@@ -105345,6 +105505,9 @@ ${row.hint ?? ""}` });
105345
105505
  this.applyAutoDiscoverProvider(row.namespace, row.field, parsed);
105346
105506
  return;
105347
105507
  }
105508
+ this.settingsBusy = true;
105509
+ this.settingsUpdateError = void 0;
105510
+ this.emit();
105348
105511
  this.ownWork((async () => {
105349
105512
  try {
105350
105513
  const descriptor = settings.describe().find((form) => String(form.ns) === row.namespace);
@@ -105358,6 +105521,7 @@ ${row.hint ?? ""}` });
105358
105521
  this.setFeedback(`\u2713 \u5DF2\u66F4\u65B0 ${row.field}`);
105359
105522
  } catch (error51) {
105360
105523
  if (this.closed) return;
105524
+ this.settingsBusy = false;
105361
105525
  this.settingsUpdateError = errorReason(error51);
105362
105526
  this.settingsRows = this.readSettingsRows();
105363
105527
  this.emit();
@@ -105371,7 +105535,7 @@ ${row.hint ?? ""}` });
105371
105535
  toggleSelectedSettingValue() {
105372
105536
  if (!this.settingsOpen || this.settingsEditing || this.settingsOnboarding || this.settingsBusy) return;
105373
105537
  const row = this.settingsRows[this.settingsSelectedIndex];
105374
- if (row === void 0) return;
105538
+ if (row === void 0 || row.editable === false) return;
105375
105539
  let nextValue;
105376
105540
  if (row.value === "true") {
105377
105541
  nextValue = false;
@@ -105395,17 +105559,22 @@ ${row.hint ?? ""}` });
105395
105559
  }
105396
105560
  const settings = this.ctx.get("settings");
105397
105561
  if (settings === void 0) return;
105562
+ this.settingsBusy = true;
105563
+ this.settingsUpdateError = void 0;
105564
+ this.emit();
105398
105565
  this.ownWork((async () => {
105399
105566
  try {
105400
105567
  const descriptor = settings.describe().find((form) => String(form.ns) === row.namespace);
105401
105568
  await settings.update(row.namespace, settingsPathPatch(descriptor?.value, row.sourcePath ?? row.field.split("."), nextValue, descriptor?.user));
105402
105569
  if (this.closed) return;
105403
105570
  if (row.namespace === TUI_SETTINGS_NS) this.applyColorTierSetting();
105571
+ this.settingsBusy = false;
105404
105572
  this.settingsUpdateError = void 0;
105405
105573
  this.settingsRows = this.readSettingsRows();
105406
105574
  this.setFeedback(`\u2713 \u5DF2\u66F4\u65B0 ${row.field}`);
105407
105575
  } catch (error51) {
105408
105576
  if (this.closed) return;
105577
+ this.settingsBusy = false;
105409
105578
  this.settingsUpdateError = errorReason(error51);
105410
105579
  this.settingsRows = this.readSettingsRows();
105411
105580
  this.emit();