@surfishs/dsh-prompt-enhance 0.1.2 → 0.1.4

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/lib/client.js CHANGED
@@ -109,10 +109,28 @@ function parseUsage(value) {
109
109
  ...cacheWriteTokens === void 0 ? {} : { cacheWriteTokens }
110
110
  };
111
111
  }
112
+ function parseContextUsage(value) {
113
+ const record = value;
114
+ if (record === null || typeof record !== "object") return void 0;
115
+ const integer = (field) => typeof field === "number" && Number.isInteger(field) && field >= 0;
116
+ if (!integer(record.usedTurns) || !integer(record.maxTurns) || !integer(record.usedChars) || !integer(record.maxChars) || !integer(record.droppedTurns) || record.limitedBy !== null && record.limitedBy !== "turns" && record.limitedBy !== "chars" || typeof record.cutTurn !== "boolean") {
117
+ return void 0;
118
+ }
119
+ return {
120
+ usedTurns: record.usedTurns,
121
+ maxTurns: record.maxTurns,
122
+ usedChars: record.usedChars,
123
+ maxChars: record.maxChars,
124
+ droppedTurns: record.droppedTurns,
125
+ limitedBy: record.limitedBy,
126
+ cutTurn: record.cutTurn
127
+ };
128
+ }
112
129
  function parseResult(value) {
113
130
  const record = value;
114
131
  if (record !== null && typeof record === "object" && typeof record.text === "string" && record.text !== "" && typeof record.provider === "string" && record.provider !== "" && typeof record.model === "string" && record.model !== "" && typeof record.elapsedMs === "number" && Number.isFinite(record.elapsedMs)) {
115
132
  const usage = parseUsage(record.usage);
133
+ const context = parseContextUsage(record.context);
116
134
  return {
117
135
  text: record.text,
118
136
  provider: record.provider,
@@ -128,7 +146,8 @@ function parseResult(value) {
128
146
  // Same trap as runcated above: rebuilding the object field by field
129
147
  // drops anything not listed here, so a new result field has to be added
130
148
  // in this exact place or the UI silently never sees it.
131
- ...typeof record.reasoningEffort === "string" ? { reasoningEffort: record.reasoningEffort } : {}
149
+ ...typeof record.reasoningEffort === "string" ? { reasoningEffort: record.reasoningEffort } : {},
150
+ ...context === void 0 ? {} : { context }
132
151
  };
133
152
  }
134
153
  throw new EnhanceClientError({ code: "internal", params: { reason: "malformed" } });
@@ -377,7 +396,13 @@ function openLoading(state) {
377
396
  }
378
397
  function settleResult(sessionId, result) {
379
398
  if (panelState?.sessionId !== sessionId || panelState.phase !== "loading") return;
380
- panelState = { sessionId, phase: "result", original: panelState.original, result };
399
+ panelState = {
400
+ sessionId,
401
+ phase: "result",
402
+ original: panelState.original,
403
+ result,
404
+ ...panelState.attachments === void 0 ? {} : { attachments: panelState.attachments }
405
+ };
381
406
  notify();
382
407
  }
383
408
  function settleError(sessionId, error) {
@@ -982,6 +1007,9 @@ var OCCURRENCES_UNKNOWN = -1;
982
1007
  function occurrenceCountOf(value) {
983
1008
  return Array.isArray(value) ? value.length : OCCURRENCES_UNKNOWN;
984
1009
  }
1010
+ function attachmentCountOf(value) {
1011
+ return Array.isArray(value) ? value.length : 0;
1012
+ }
985
1013
  function stringOf(value) {
986
1014
  return typeof value === "string" ? value : "";
987
1015
  }
@@ -992,6 +1020,7 @@ function EnhanceButton(props) {
992
1020
  const draft = useInput((state) => stringOf(state.draft));
993
1021
  const phase = useInput((state) => state.phase);
994
1022
  const occurrenceCount = useInput((state) => occurrenceCountOf(state.occurrences));
1023
+ const attachmentCount = useInput((state) => attachmentCountOf(state.attachmentIds));
995
1024
  const settings = (0, import_react4.useSyncExternalStore)(subscribeClientSettings, getClientSettings);
996
1025
  const panel = (0, import_react4.useSyncExternalStore)(subscribe, getPanel);
997
1026
  const rootRef = (0, import_react4.useRef)(null);
@@ -1177,13 +1206,19 @@ function EnhanceButton(props) {
1177
1206
  openError(uiKey, source, { code: "rejected", localized: occurrences });
1178
1207
  return;
1179
1208
  }
1209
+ if (phase === "claimed") {
1210
+ const command = t("error.command");
1211
+ openError(uiKey, source, { code: "rejected", localized: command });
1212
+ return;
1213
+ }
1180
1214
  if (phase !== "plain") {
1181
1215
  const busyPhase = t("error.phase");
1182
1216
  openError(uiKey, source, { code: "rejected", localized: busyPhase });
1183
1217
  return;
1184
1218
  }
1185
1219
  const controller = new AbortController();
1186
- openLoading({ sessionId: uiKey, original: source, abort: () => controller.abort() });
1220
+ const attachments = attachmentCount > 0 ? { attachments: { count: attachmentCount } } : {};
1221
+ openLoading({ sessionId: uiKey, original: source, abort: () => controller.abort(), ...attachments });
1187
1222
  const settle = (result) => settleResult(uiKey, result);
1188
1223
  const fail = (error) => {
1189
1224
  const detail = error instanceof EnhanceClientError ? error.detail : { code: "internal", message: error instanceof Error ? error.message : String(error) };
@@ -1191,7 +1226,7 @@ function EnhanceButton(props) {
1191
1226
  };
1192
1227
  if (settings.streaming) {
1193
1228
  requestEnhanceStream(
1194
- { sessionId: wireId, text: source },
1229
+ { sessionId: wireId, text: source, ...attachments },
1195
1230
  {
1196
1231
  signal: controller.signal,
1197
1232
  onDelta: (delta) => appendDelta(uiKey, delta)
@@ -1199,9 +1234,9 @@ function EnhanceButton(props) {
1199
1234
  ).then(settle, fail);
1200
1235
  return;
1201
1236
  }
1202
- requestEnhance({ sessionId: wireId, text: source }, controller.signal).then(settle, fail);
1237
+ requestEnhance({ sessionId: wireId, text: source, ...attachments }, controller.signal).then(settle, fail);
1203
1238
  },
1204
- [anyBusy, draft, occurrenceCount, phase, settings, uiKey, wireId, t]
1239
+ [anyBusy, draft, occurrenceCount, attachmentCount, phase, settings, uiKey, wireId, t]
1205
1240
  );
1206
1241
  const runRef = (0, import_react4.useRef)(start);
1207
1242
  (0, import_react4.useEffect)(() => {
@@ -1472,8 +1507,50 @@ function capitalizeEffort(value) {
1472
1507
  function totalTokensOf(usage) {
1473
1508
  return usage.totalTokens ?? usage.inputTokens + usage.outputTokens + (usage.cacheReadTokens ?? 0) + (usage.cacheWriteTokens ?? 0);
1474
1509
  }
1510
+ function ContextUsageInfo(props) {
1511
+ const { usage, attachments, t } = props;
1512
+ const [open, setOpen] = (0, import_react5.useState)(false);
1513
+ const limited = usage !== void 0 && (usage.cutTurn || usage.limitedBy === "chars");
1514
+ const percent = usage !== void 0 && usage.maxChars > 0 ? Math.round(usage.usedChars / usage.maxChars * 100) : 0;
1515
+ const stats = usage === void 0 ? t("panel.contextUnused") : t("panel.contextStats", {
1516
+ turns: usage.usedTurns,
1517
+ maxTurns: usage.maxTurns,
1518
+ chars: formatTokens(usage.usedChars),
1519
+ maxChars: formatTokens(usage.maxChars),
1520
+ percent
1521
+ });
1522
+ const reason = usage === void 0 ? "" : usage.cutTurn ? t("panel.contextCut") : usage.limitedBy === "chars" ? t("panel.contextCharsLimited") : "";
1523
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "dsh-pe-context-wrap", children: [
1524
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1525
+ "button",
1526
+ {
1527
+ type: "button",
1528
+ className: `dsh-pe-context${limited ? " is-limited" : ""}`,
1529
+ "aria-label": t("panel.contextUsage"),
1530
+ "aria-expanded": open,
1531
+ onMouseEnter: () => setOpen(true),
1532
+ onMouseLeave: () => setOpen(false),
1533
+ onFocus: () => setOpen(true),
1534
+ onBlur: () => setOpen(false),
1535
+ onClick: () => setOpen((value) => !value),
1536
+ onKeyDown: (event) => {
1537
+ if (event.key === "Escape") setOpen(false);
1538
+ },
1539
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { className: "dsh-pe-context-icon", viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: [
1540
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "2.2", y: "3.4", width: "11.6", height: "9.2", rx: "2.2", fill: "none", stroke: "currentColor", strokeWidth: "1.2" }),
1541
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M5.2 6.6h5.6M5.2 9.2h3.8", fill: "none", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round" })
1542
+ ] })
1543
+ }
1544
+ ),
1545
+ open && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { role: "tooltip", className: "dsh-pe-context-tip", children: [
1546
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-pe-context-stats", children: stats }),
1547
+ reason !== "" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-pe-context-reason", children: reason }),
1548
+ attachments !== void 0 && attachments.count > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-pe-context-attachments", children: t("panel.attachmentsCount", { count: attachments.count }) })
1549
+ ] })
1550
+ ] });
1551
+ }
1475
1552
  function ResultPanel(props) {
1476
- const { state, t, onApply, onCancel, onRetry, applied = false, onUndo, onRegenerate, regenerated = false, collapsed = false, onToggleCollapsed, foldAnimation = true } = props;
1553
+ const { state, t, onApply, onCancel, onRetry, applied = false, onUndo, onRegenerate, draftEmpty = false, regenerated = false, collapsed = false, onToggleCollapsed, foldAnimation = true } = props;
1477
1554
  const [copied, setCopied] = (0, import_react5.useState)("idle");
1478
1555
  const copyTimer = (0, import_react5.useRef)(void 0);
1479
1556
  const copy = (0, import_react5.useCallback)(() => {
@@ -1525,7 +1602,7 @@ function ResultPanel(props) {
1525
1602
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { title: tokenDetail(state.result.usage), children: t("panel.tokens", { total: formatTokens(totalTokensOf(state.result.usage)) }) })
1526
1603
  ] })
1527
1604
  ] }),
1528
- collapsed && (state.stale === true || state.result?.truncated === true) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-pe-warn-dot", title: state.stale === true ? t("panel.stale.warn") : t("panel.truncated"), "aria-hidden": "true", children: "\u26A0" }) : null,
1605
+ collapsed && (state.stale === true || state.result?.truncated === true) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `dsh-pe-warn-dot${state.stale === true ? "" : " is-danger"}`, title: state.stale === true ? t("panel.stale.dot") : t("panel.truncated.dot"), "aria-hidden": "true", children: "\u26A0" }) : null,
1529
1606
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "dsh-pe-collapse", "aria-label": collapsed ? t("panel.expand") : t("panel.collapse"), "aria-expanded": !collapsed, onClick: onToggleCollapsed, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronIcon, { open: !collapsed }) }),
1530
1607
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "dsh-pe-close", "aria-label": t("panel.close"), onClick: onCancel, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(XIcon, {}) })
1531
1608
  ] })
@@ -1547,24 +1624,36 @@ function ResultPanel(props) {
1547
1624
  state.error.message !== void 0 && state.error.message !== "" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dsh-pe-error-detail", children: state.error.message })
1548
1625
  ] }) }),
1549
1626
  state.phase === "result" && state.result !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dsh-pe-result", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pre", { className: "dsh-pe-result-text", children: state.result.text }) }),
1550
- state.phase === "result" && state.result?.truncated === true && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsh-pe-stale", children: [
1627
+ state.phase === "result" && state.result?.truncated === true && !state.stale && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsh-pe-stale dsh-pe-truncated", children: [
1551
1628
  "\u26A0 ",
1552
1629
  t("panel.truncated")
1553
1630
  ] }),
1554
1631
  state.phase === "result" && state.stale && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsh-pe-stale", children: [
1555
1632
  "\u26A0 ",
1556
- t("panel.stale.warn")
1633
+ t(draftEmpty ? "panel.stale.empty" : "panel.stale.warn")
1557
1634
  ] })
1558
1635
  ] }) }),
1559
1636
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("footer", { className: "dsh-pe-foot", children: [
1637
+ state.phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ContextUsageInfo, { usage: state.result?.context, attachments: state.attachments, t }),
1560
1638
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-pe-grow" }),
1561
- state.phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "dsh-pe-btn-action plain dsh-pe-btn-floor", onClick: onRegenerate, disabled: onRegenerate === void 0, children: [
1562
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RegenerateIcon, {}),
1563
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "dsh-pe-swap", children: [
1564
- swapLabel(!regenerated, t("panel.regenerate")),
1565
- swapLabel(regenerated, t("panel.regenerated"))
1566
- ] })
1567
- ] }),
1639
+ state.phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1640
+ "button",
1641
+ {
1642
+ type: "button",
1643
+ className: "dsh-pe-btn-action plain dsh-pe-btn-floor",
1644
+ onClick: onRegenerate,
1645
+ disabled: onRegenerate === void 0,
1646
+ "aria-disabled": draftEmpty || void 0,
1647
+ title: draftEmpty ? t("panel.regenerate.empty") : void 0,
1648
+ children: [
1649
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RegenerateIcon, {}),
1650
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "dsh-pe-swap", children: [
1651
+ swapLabel(!regenerated, t("panel.regenerate")),
1652
+ swapLabel(regenerated, t("panel.regenerated"))
1653
+ ] })
1654
+ ]
1655
+ }
1656
+ ),
1568
1657
  state.phase === "error" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: retryable(state.error) && onRetry !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "dsh-pe-btn-action plain dsh-pe-btn-floor", onClick: onRetry, children: t("panel.retry") }) }),
1569
1658
  state.phase === "loading" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "dsh-pe-btn-action plain dsh-pe-btn-floor", onClick: onCancel, children: t("panel.cancel") }),
1570
1659
  state.phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
@@ -1713,6 +1802,7 @@ function ResultDock(props) {
1713
1802
  const value = state.draft;
1714
1803
  return typeof value === "string" ? value : "";
1715
1804
  });
1805
+ const draftEmpty = draft.trim() === "";
1716
1806
  const phase = useInput((state) => {
1717
1807
  const value = state.phase;
1718
1808
  return typeof value === "string" ? value : "";
@@ -1781,6 +1871,7 @@ function ResultDock(props) {
1781
1871
  };
1782
1872
  const regenerate = () => {
1783
1873
  if (panel.phase !== "result") return;
1874
+ if (draftEmpty) return;
1784
1875
  setRegeneratedNotice(false);
1785
1876
  previousResultRef.current = panel.result;
1786
1877
  pendingRegenerate.current = true;
@@ -1793,6 +1884,7 @@ function ResultDock(props) {
1793
1884
  t,
1794
1885
  applied,
1795
1886
  regenerated: regeneratedNotice,
1887
+ draftEmpty,
1796
1888
  collapsed: panel.collapsed === true,
1797
1889
  onToggleCollapsed: () => setCollapsed(uiKey, panel.collapsed !== true),
1798
1890
  foldAnimation: settings.foldAnimation,
@@ -1856,7 +1948,7 @@ var zh = {
1856
1948
  "menu.effortsNone": "\u8BE5\u6A21\u578B\u672A\u58F0\u660E\u63A8\u7406\u6863\u4F4D",
1857
1949
  "menu.effortsFailed": "\u65E0\u6CD5\u8BFB\u53D6\u8BE5\u6A21\u578B\u7684\u6863\u4F4D",
1858
1950
  "menu.effort": "\u63A8\u7406\u7B49\u7EA7",
1859
- "menu.effortDefault": "\u4E0D\u6307\u5B9A",
1951
+ "menu.effortDefault": "\u6A21\u578B\u9ED8\u8BA4",
1860
1952
  "menu.context": "\u4E0A\u4E0B\u6587\u611F\u77E5",
1861
1953
  "menu.contextOn": "\u5F00",
1862
1954
  "menu.contextOff": "\u5173",
@@ -1870,6 +1962,7 @@ var zh = {
1870
1962
  "panel.enhanced": "\u589E\u5F3A\u7ED3\u679C",
1871
1963
  "panel.apply": "\u56DE\u586B\u5230\u8F93\u5165\u6846",
1872
1964
  "panel.regenerate": "\u91CD\u65B0\u751F\u6210",
1965
+ "panel.regenerate.empty": "\u8BF7\u5148\u8F93\u5165\u6587\u5B57\u540E\u518D\u91CD\u65B0\u751F\u6210",
1873
1966
  "panel.regenerated": "\u5DF2\u91CD\u65B0\u751F\u6210",
1874
1967
  "panel.copy": "\u590D\u5236\u7ED3\u679C",
1875
1968
  "panel.copied": "\u5DF2\u590D\u5236",
@@ -1878,12 +1971,21 @@ var zh = {
1878
1971
  "panel.collapse": "\u6298\u53E0",
1879
1972
  "panel.expand": "\u5C55\u5F00",
1880
1973
  "panel.retry": "\u91CD\u8BD5",
1881
- "panel.stale.warn": "\u8349\u7A3F\u5DF2\u6539\u52A8\uFF0C\u5F53\u524D\u7ED3\u679C\u57FA\u4E8E\u65E7\u6587\u672C\u3002\u300C\u91CD\u65B0\u751F\u6210\u300D\u4F1A\u6309\u5F53\u524D\u6587\u672C\u91CD\u8DD1\uFF1B\u56DE\u586B\u4ECD\u4F1A\u8986\u76D6\u5F53\u524D\u8F93\u5165\uFF08\u53EF\u64A4\u9500\uFF09\u3002",
1882
- "panel.truncated": "\u8F93\u51FA\u88AB\u622A\u65AD\uFF08\u8FBE\u5230\u8F93\u51FA\u4E0A\u9650\uFF09\uFF0C\u7ED3\u679C\u53EF\u80FD\u4E0D\u5B8C\u6574\u3002\u53EF\u5728\u8BBE\u7F6E\u91CC\u8C03\u9AD8\u300C\u8F93\u51FA token \u4E0A\u9650\u300D\u540E\u91CD\u65B0\u751F\u6210\u3002",
1974
+ "panel.stale.warn": "\u8349\u7A3F\u5DF2\u6539\u52A8\uFF1A\u5F53\u524D\u7ED3\u679C\u57FA\u4E8E\u65E7\u6587\u672C\u3002\u300C\u91CD\u65B0\u751F\u6210\u300D\u4F1A\u6309\u5F53\u524D\u6587\u672C\u91CD\u8DD1\uFF1B\u56DE\u586B\u4F1A\u8986\u76D6\u4F60\u540E\u6765\u7684\u4FEE\u6539\uFF08\u53EF\u64A4\u9500\uFF09\u3002",
1975
+ "panel.stale.empty": "\u8349\u7A3F\u5DF2\u6539\u52A8\uFF1A\u5F53\u524D\u4E3A\u7A7A\u3002\u300C\u91CD\u65B0\u751F\u6210\u300D\u4E0D\u53EF\u7528\uFF0C\u8BF7\u5148\u8F93\u5165\u6587\u5B57\uFF1B\u56DE\u586B\u4F1A\u8986\u76D6\u4F60\u540E\u6765\u7684\u4FEE\u6539\uFF08\u53EF\u64A4\u9500\uFF09\u3002",
1976
+ "panel.stale.dot": "\u8349\u7A3F\u5DF2\u6539\u52A8",
1977
+ "panel.truncated": "\u8F93\u51FA\u5DF2\u8FBE\u5230\u300C\u8F93\u51FA token \u4E0A\u9650\u300D\uFF0C\u7ED3\u679C\u53EF\u80FD\u4E0D\u5B8C\u6574\u3002\u8BF7\u5728\u8BBE\u7F6E\u91CC\u8C03\u9AD8\u8BE5\u4E0A\u9650\u540E\u518D\u91CD\u65B0\u751F\u6210\u3002",
1978
+ "panel.truncated.dot": "\u8F93\u51FA\u88AB\u622A\u65AD",
1979
+ "panel.contextUsage": "\u4E0A\u4E0B\u6587\u7528\u91CF",
1980
+ "panel.contextStats": "\u4E0A\u4E0B\u6587 {turns}/{maxTurns} \u6761 \xB7 {chars}/{maxChars} \u5B57\uFF08{percent}%\uFF09",
1981
+ "panel.contextCharsLimited": "\u5DF2\u8FBE\u5B57\u6570\u4E0A\u9650\uFF0C\u8F83\u65E9\u5185\u5BB9\u672A\u53D1\u9001",
1982
+ "panel.contextCut": "\u5DF2\u8FBE\u5B57\u6570\u4E0A\u9650\uFF0C\u6700\u65B0\u4E00\u6761\u4EC5\u53D1\u9001\u4E86\u5F00\u5934",
1983
+ "panel.contextUnused": "\u672C\u6B21\u672A\u4F7F\u7528\u4E0A\u4E0B\u6587",
1984
+ "panel.attachmentsCount": "\u9644\u4EF6\uFF1A{count} \u4E2A",
1883
1985
  "panel.model": "\u6A21\u578B\uFF1A{provider} / {model}",
1884
1986
  "panel.elapsed": "\u8017\u65F6 {ms}",
1885
1987
  "panel.tokens": "{total} tokens",
1886
- "panel.effortDefault": "\u4E0D\u6307\u5B9A",
1988
+ "panel.effortDefault": "\u6A21\u578B\u9ED8\u8BA4",
1887
1989
  "panel.tokens.input": "\u8F93\u5165 {count}",
1888
1990
  "panel.tokens.output": "\u8F93\u51FA {count}",
1889
1991
  "panel.tokens.cacheRead": "\u7F13\u5B58\u8BFB\u53D6 {count}",
@@ -1891,34 +1993,35 @@ var zh = {
1891
1993
  "undo.applied": "\u5DF2\u66FF\u6362\u539F\u63D0\u793A\u8BCD",
1892
1994
  "undo.undo": "\u64A4\u9500",
1893
1995
  "undo.dismiss": "\u5173\u95ED\u63D0\u793A",
1894
- "error.empty": "\u8F93\u5165\u6846\u4E3A\u7A7A\uFF0C\u8BF7\u5148\u8F93\u5165\u8981\u589E\u5F3A\u7684\u63D0\u793A\u8BCD\u3002",
1895
- "error.tooLong": "\u5185\u5BB9 {count} \u5B57\uFF0C\u8D85\u8FC7 {max} \u5B57\u4E0A\u9650\uFF08\u6309\u5B57\u7B26\u8BA1\uFF0C\u975E token\uFF09\uFF1B\u4E0D\u4F1A\u81EA\u52A8\u622A\u65AD\uFF0C\u8BF7\u7CBE\u7B80\u540E\u91CD\u8BD5\u3002",
1896
- "error.occurrences": "\u8F93\u5165\u5185\u5BB9\u5305\u542B\u547D\u4EE4\u6216\u6587\u4EF6\u5F15\u7528\uFF0C\u6682\u4E0D\u652F\u6301\u589E\u5F3A\uFF1B\u8BF7\u5148\u79FB\u9664\u540E\u518D\u8BD5\u3002",
1897
- "error.chipsUnknown": "\u65E0\u6CD5\u8BFB\u53D6\u8F93\u5165\u6846\u91CC\u7684\u5F15\u7528\u72B6\u6001\uFF1B\u4E3A\u907F\u514D\u8986\u76D6\u4F60\u7684\u547D\u4EE4\u6216\u6587\u4EF6\u5F15\u7528\uFF0C\u672C\u6B21\u5DF2\u963B\u6B62\u3002\u8BF7\u6539\u4E3A\u7EAF\u6587\u672C\u540E\u91CD\u8BD5\u3002",
1898
- "error.phase": "\u5F53\u524D\u8F93\u5165\u6B63\u88AB\u5360\u7528\uFF08\u63D0\u4EA4\u4E2D\uFF09\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",
1899
- "error.disabled": "\u63D0\u793A\u8BCD\u589E\u5F3A\u5DF2\u5728\u63D2\u4EF6\u8BBE\u7F6E\u4E2D\u5173\u95ED\uFF0C\u53EF\u5728\u8BBE\u7F6E\u91CC\u91CD\u65B0\u5F00\u542F\u3002",
1900
- "error.rejected": "\u589E\u5F3A\u8BF7\u6C42\u88AB\u62D2\u7EDD\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF1B\u82E5\u6301\u7EED\u51FA\u73B0\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u8BBE\u7F6E\u3002",
1901
- "error.timeout": "\u589E\u5F3A\u8D85\u65F6\uFF08{seconds} \u79D2\uFF09\u3002\u53EF\u76F4\u63A5\u91CD\u8BD5\uFF0C\u6216\u5230\u8BBE\u7F6E\u91CC\u8C03\u9AD8\u300C\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09\u300D\uFF1B\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002",
1902
- "error.unconfigured": "\u8FD8\u6CA1\u786E\u5B9A\u7528\u54EA\u4E2A\u6A21\u578B\uFF1A\u8BF7\u5728\u63D2\u4EF6\u8BBE\u7F6E\u91CC\u586B\u5199 provider \u548C model\uFF08\u4E24\u9879\u90FD\u8981\u586B\uFF09\uFF0C\u6216\u5728\u5F53\u524D\u4F1A\u8BDD\u5148\u53D1\u4E00\u6761\u6D88\u606F\u4EE5\u8DDF\u968F\u4F1A\u8BDD\u6A21\u578B\u3002",
1903
- "error.effortUnsupported": "\u8BE5\u6A21\u578B\u4E0D\u652F\u6301\u6240\u9009\u63A8\u7406\u6863\u4F4D\u300C{effort}\u300D\uFF0C\u8BF7\u6539\u9009\u5176\u5B83\u6863\u4F4D\uFF0C\u6216\u6539\u7528\u300C\u4E0D\u6307\u5B9A\u300D\u3002",
1904
- "error.upstream": "\u6A21\u578B\u670D\u52A1\u8FD4\u56DE\u9519\u8BEF\uFF1B\u82E5\u4E0B\u65B9\u6709\u8BE6\u60C5\uFF0C\u8BF7\u6309\u8BE6\u60C5\u5904\u7406\uFF0C\u5426\u5219\u53EF\u76F4\u63A5\u91CD\u8BD5\u3002\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002",
1905
- "error.internal": "\u589E\u5F3A\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u53CD\u590D\u5931\u8D25\uFF0C\u8BF7\u67E5\u770B dsh \u8FD0\u884C\u65E5\u5FD7\u3002\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002",
1906
- "error.client.unreachable": "\u65E0\u6CD5\u8FDE\u63A5\u5BBF\u4E3B\u670D\u52A1\uFF0C\u8BF7\u786E\u8BA4 dsh web \u6B63\u5728\u8FD0\u884C\u540E\u91CD\u8BD5\u3002",
1907
- "error.client.malformed": "\u5BBF\u4E3B\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u89E3\u6790\u7684\u6570\u636E\uFF0C\u8BF7\u91CD\u8BD5\uFF1B\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002",
1908
- "error.client.refused": "\u5BBF\u4E3B\u670D\u52A1\u62D2\u7EDD\u4E86\u8BF7\u6C42\uFF08HTTP {status}\uFF09\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
1909
- "error.client.streamClosed": "\u5BBF\u4E3B\u670D\u52A1\u63D0\u524D\u5173\u95ED\u4E86\u589E\u5F3A\u6D41\uFF0C\u8BF7\u91CD\u8BD5\uFF1B\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002",
1910
- "error.client.cancelled": "\u5DF2\u53D6\u6D88\u589E\u5F3A\uFF1B\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002",
1911
- "error.rateLimit": "\u8BF7\u6C42\u8FC7\u4E8E\u9891\u7E41\uFF1A\u6BCF\u5206\u949F\u6700\u591A {limit} \u6B21\u589E\u5F3A\uFF0C\u8BF7\u5728 {retryAfterSeconds} \u79D2\u540E\u518D\u8BD5\u3002",
1912
- "error.concurrencyLimit": "\u5DF2\u6709 {max} \u4E2A\u589E\u5F3A\u6B63\u5728\u8FDB\u884C\uFF0C\u8BF7\u7B49\u5176\u4E2D\u4E00\u4E2A\u5B8C\u6210\u540E\u518D\u8BD5\u3002",
1913
- "error.cooldown": "\u8FDE\u7EED {failures} \u6B21\u589E\u5F3A\u5931\u8D25\uFF0C\u5DF2\u6682\u505C {retryAfterSeconds} \u79D2\u4EE5\u514D\u6301\u7EED\u51B2\u51FB\u6A21\u578B\u670D\u52A1\uFF1B\u53EF\u7A0D\u540E\u91CD\u8BD5\uFF0C\u6216\u5148\u68C0\u67E5\u6A21\u578B\u914D\u7F6E\u3002",
1914
- "error.upstream.auth": "\u9274\u6743\u5931\u8D25\uFF1A\u8BF7\u68C0\u67E5\u8BE5 provider \u7684 API Key \u914D\u7F6E\u3002",
1915
- "error.upstream.invalidCredential": "\u9274\u6743\u5931\u8D25\uFF1A\u5B58\u50A8\u7684 API Key \u4E0D\u53EF\u7528\uFF0C\u8BF7\u4FEE\u6B63\u540E\u91CD\u8BD5\u3002",
1916
- "error.upstream.rateLimit": "\u6A21\u578B\u670D\u52A1\u9650\u6D41\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
1917
- "error.upstream.quota": "\u6A21\u578B\u670D\u52A1\u914D\u989D/\u4F59\u989D\u4E0D\u8DB3\uFF0C\u8BF7\u68C0\u67E5\u8D26\u6237\u3002",
1918
- "error.upstream.empty": "\u6A21\u578B\u8FD4\u56DE\u4E86\u7A7A\u54CD\u5E94\uFF0C\u8BF7\u91CD\u8BD5\u3002",
1919
- "error.upstream.contextWindow": "\u8F93\u5165\u8D85\u51FA\u6A21\u578B\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF0C\u8BF7\u7CBE\u7B80\u539F\u6587\u6216\u66F4\u6362\u6A21\u578B\u3002",
1920
- "error.upstream.toolCall": "\u6A21\u578B\u8BF7\u6C42\u4E86\u5DE5\u5177\u8C03\u7528\uFF0C\u63D0\u793A\u8BCD\u589E\u5F3A\u53EA\u9700\u8981\u7EAF\u6587\u672C\uFF1B\u8BF7\u66F4\u6362\u6A21\u578B\u540E\u91CD\u8BD5\u3002",
1921
- "error.upstream.maxTokens": "\u91CD\u5199\u7ED3\u679C\u8FBE\u5230\u300C\u8F93\u51FA token \u4E0A\u9650\u300D\uFF0C\u8BF7\u8C03\u9AD8\u8BE5\u8BBE\u7F6E\u6216\u7CBE\u7B80\u539F\u6587\u540E\u91CD\u8BD5\u3002",
1996
+ "error.empty": "\u8F93\u5165\u6846\u662F\u7A7A\u7684\uFF0C\u8BF7\u5148\u8F93\u5165\u8981\u589E\u5F3A\u7684\u6587\u5B57\u3002",
1997
+ "error.tooLong": "\u8349\u7A3F\u5171 {count} \u5B57\uFF0C\u8D85\u8FC7 {max} \u5B57\u4E0A\u9650\uFF08\u6309\u5B57\u7B26\u8BA1\uFF0C\u4E0D\u662F token\uFF09\u3002\u4E0D\u4F1A\u81EA\u52A8\u622A\u65AD\uFF0C\u8BF7\u7CBE\u7B80\u540E\u518D\u8BD5\u3002",
1998
+ "error.occurrences": "\u8349\u7A3F\u91CC\u6709\u6587\u4EF6\u6216\u4F1A\u8BDD\u5F15\u7528\uFF0C\u6682\u4E0D\u652F\u6301\u589E\u5F3A\uFF1B\u8BF7\u5148\u79FB\u9664\u5F15\u7528\uFF0C\u589E\u5F3A\u540E\u518D\u624B\u52A8\u63D2\u56DE\u3002",
1999
+ "error.chipsUnknown": "\u8BFB\u4E0D\u5230\u8F93\u5165\u6846\u91CC\u7684\u5F15\u7528\u72B6\u6001\u3002\u4E3A\u907F\u514D\u56DE\u586B\u65F6\u8986\u76D6\u4F60\u7684\u547D\u4EE4\u6216\u6587\u4EF6\u5F15\u7528\uFF0C\u672C\u6B21\u6CA1\u6709\u6267\u884C\uFF1B\u8BF7\u6539\u6210\u7EAF\u6587\u672C\u540E\u518D\u8BD5\u3002",
2000
+ "error.phase": "\u8F93\u5165\u6846\u6B63\u5728\u63D0\u4EA4\u6216\u6821\u9A8C\u4E2D\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u540E\u518D\u8BD5\u3002",
2001
+ "error.command": "\u8349\u7A3F\u4EE5\u547D\u4EE4\u5757\u5F00\u5934\uFF08\u5982 /\u8BA1\u5212\uFF09\uFF0C\u6682\u4E0D\u652F\u6301\u589E\u5F3A\uFF1B\u8BF7\u5148\u79FB\u9664\u547D\u4EE4\u5757\uFF0C\u518D\u5355\u72EC\u589E\u5F3A\u6B63\u6587\u3002",
2002
+ "error.disabled": "\u63D0\u793A\u8BCD\u589E\u5F3A\u5DF2\u5728\u63D2\u4EF6\u8BBE\u7F6E\u4E2D\u5173\u95ED\uFF1B\u8BF7\u5728\u8BBE\u7F6E\u91CC\u91CD\u65B0\u5F00\u542F\u540E\u518D\u8BD5\u3002",
2003
+ "error.rejected": "\u8FD9\u6B21\u589E\u5F3A\u88AB\u62D2\u7EDD\u4E86\u3002\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF1B\u5982\u679C\u4E00\u76F4\u5982\u6B64\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u8BBE\u7F6E\u3002",
2004
+ "error.timeout": "\u7B49\u4E86 {seconds} \u79D2\u4ECD\u6CA1\u6709\u7ED3\u679C\uFF0C\u672C\u6B21\u5DF2\u53D6\u6D88\u3002\u53EF\u4EE5\u91CD\u8BD5\uFF0C\u6216\u5230\u8BBE\u7F6E\u91CC\u8C03\u5927\u300C\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09\u300D\uFF1B\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
2005
+ "error.unconfigured": "\u8FD8\u6CA1\u786E\u5B9A\u7528\u54EA\u4E2A\u6A21\u578B\uFF1A\u8BF7\u5728\u63D2\u4EF6\u8BBE\u7F6E\u91CC\u586B\u597D provider \u548C model\uFF08\u4E24\u9879\u90FD\u8981\u586B\uFF09\uFF0C\u6216\u5148\u5728\u5F53\u524D\u4F1A\u8BDD\u53D1\u4E00\u6761\u6D88\u606F\uFF0C\u8BA9\u589E\u5F3A\u8DDF\u968F\u4F1A\u8BDD\u6A21\u578B\u3002",
2006
+ "error.effortUnsupported": "\u5F53\u524D\u6A21\u578B\u4E0D\u652F\u6301\u6240\u9009\u63A8\u7406\u6863\u4F4D\u300C{effort}\u300D\uFF1B\u8BF7\u6362\u4E00\u4E2A\u6863\u4F4D\uFF0C\u6216\u6539\u7528\u300C\u6A21\u578B\u9ED8\u8BA4\u300D\u3002",
2007
+ "error.upstream": "\u6A21\u578B\u670D\u52A1\u8FD4\u56DE\u4E86\u9519\u8BEF\u3002\u4E0B\u65B9\u6709\u8BE6\u60C5\u65F6\u6309\u8BE6\u60C5\u5904\u7406\uFF0C\u5426\u5219\u53EF\u4EE5\u76F4\u63A5\u91CD\u8BD5\uFF1B\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
2008
+ "error.internal": "\u589E\u5F3A\u5931\u8D25\u3002\u8BF7\u91CD\u8BD5\uFF1B\u5982\u679C\u53CD\u590D\u5931\u8D25\uFF0C\u8BF7\u67E5\u770B DSH \u8FD0\u884C\u65E5\u5FD7\u3002\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
2009
+ "error.client.unreachable": "\u8FDE\u4E0D\u4E0A DSH \u670D\u52A1\uFF1A\u8BF7\u786E\u8BA4 DSH \u6B63\u5728\u8FD0\u884C\uFF0C\u7136\u540E\u91CD\u8BD5\u3002",
2010
+ "error.client.malformed": "DSH \u8FD4\u56DE\u4E86\u65E0\u6CD5\u89E3\u6790\u7684\u6570\u636E\u3002\u8BF7\u91CD\u8BD5\uFF1B\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
2011
+ "error.client.refused": "DSH \u62D2\u7EDD\u4E86\u8FD9\u6B21\u8BF7\u6C42\uFF08HTTP {status}\uFF09\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
2012
+ "error.client.streamClosed": "\u7ED3\u679C\u8FD4\u56DE\u524D\u8FDE\u63A5\u65AD\u5F00\u4E86\u3002\u8BF7\u91CD\u8BD5\uFF1B\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
2013
+ "error.client.cancelled": "\u5DF2\u53D6\u6D88\u589E\u5F3A\uFF0C\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
2014
+ "error.rateLimit": "\u64CD\u4F5C\u592A\u9891\u7E41\uFF1A\u6BCF\u5206\u949F\u6700\u591A {limit} \u6B21\u589E\u5F3A\u3002\u8BF7\u7B49 {retryAfterSeconds} \u79D2\u518D\u8BD5\u3002",
2015
+ "error.concurrencyLimit": "\u540C\u65F6\u6700\u591A {max} \u4E2A\u589E\u5F3A\u5728\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u7B49\u5176\u4E2D\u4E00\u4E2A\u5B8C\u6210\u540E\u518D\u8BD5\u3002",
2016
+ "error.cooldown": "\u8FDE\u7EED {failures} \u6B21\u589E\u5F3A\u5931\u8D25\uFF0C\u5DF2\u6682\u505C {retryAfterSeconds} \u79D2\uFF0C\u907F\u514D\u7EE7\u7EED\u8BF7\u6C42\u6A21\u578B\u670D\u52A1\u3002\u53EF\u4EE5\u5148\u68C0\u67E5\u6A21\u578B\u914D\u7F6E\uFF0C\u7A0D\u540E\u518D\u8BD5\u3002",
2017
+ "error.upstream.auth": "\u6A21\u578B\u670D\u52A1\u9274\u6743\u5931\u8D25\uFF1A\u8BF7\u68C0\u67E5\u8BE5 provider \u7684 API Key\u3002",
2018
+ "error.upstream.invalidCredential": "\u6A21\u578B\u670D\u52A1\u9274\u6743\u5931\u8D25\uFF1A\u4FDD\u5B58\u7684 API Key \u4E0D\u53EF\u7528\uFF0C\u8BF7\u66F4\u65B0\u540E\u91CD\u8BD5\u3002",
2019
+ "error.upstream.rateLimit": "\u6A21\u578B\u670D\u52A1\u6B63\u5728\u9650\u6D41\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
2020
+ "error.upstream.quota": "\u6A21\u578B\u670D\u52A1\u4F59\u989D\u6216\u914D\u989D\u4E0D\u8DB3\uFF0C\u8BF7\u68C0\u67E5\u8D26\u6237\u3002",
2021
+ "error.upstream.empty": "\u6A21\u578B\u8FD4\u56DE\u4E86\u7A7A\u7ED3\u679C\uFF0C\u8BF7\u91CD\u8BD5\u3002",
2022
+ "error.upstream.contextWindow": "\u5185\u5BB9\u8D85\u51FA\u6A21\u578B\u7684\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF0C\u8BF7\u7CBE\u7B80\u539F\u6587\u6216\u6362\u4E00\u4E2A\u6A21\u578B\u3002",
2023
+ "error.upstream.toolCall": "\u6A21\u578B\u5C1D\u8BD5\u8C03\u7528\u5DE5\u5177\uFF0C\u800C\u63D0\u793A\u8BCD\u589E\u5F3A\u53EA\u9700\u8981\u7EAF\u6587\u672C\uFF1B\u8BF7\u6362\u4E00\u4E2A\u6A21\u578B\u540E\u91CD\u8BD5\u3002",
2024
+ "error.upstream.maxTokens": "\u7ED3\u679C\u8FBE\u5230\u4E86\u300C\u8F93\u51FA token \u4E0A\u9650\u300D\u3002\u8BF7\u8C03\u9AD8\u8BE5\u8BBE\u7F6E\uFF0C\u6216\u7CBE\u7B80\u539F\u6587\u540E\u91CD\u8BD5\u3002",
1922
2025
  "settings.summary": "\u6A21\u578B\u3001\u4E0A\u4E0B\u6587\u4E0E\u8D44\u6E90\u9650\u5236",
1923
2026
  "settings.title": "\u63D0\u793A\u8BCD\u589E\u5F3A",
1924
2027
  "settings.description": "\u628A\u8F93\u5165\u6846\u8349\u7A3F\u6539\u5199\u4E3A\u7ED3\u6784\u5316\u63D0\u793A\u8BCD\uFF1A\u89D2\u8272\u4E0E\u76EE\u6807\u3001\u53EF\u6267\u884C\u6B65\u9AA4\u3001\u8F93\u51FA\u683C\u5F0F\u3001\u9A8C\u6536\u6807\u51C6\u3001\u8FB9\u754C\u6761\u4EF6\u3002\u539F\u6587\u4FDD\u7559\uFF0C\u5931\u8D25\u4E0D\u6539\u8349\u7A3F\uFF1B\u4FDD\u5B58\u540E\u4E0B\u4E00\u6B21\u8C03\u7528\u5373\u751F\u6548\u3002",
@@ -1941,7 +2044,7 @@ var zh = {
1941
2044
  "settings.row.enabled.label": "\u603B\u5F00\u5173",
1942
2045
  "settings.row.enabled.hint": "\u5173\u95ED\u540E\u9690\u85CF\u8F93\u5165\u6846\u7684\u589E\u5F3A\u6309\u94AE\uFF0C\u547D\u4EE4\u4E0E\u5FEB\u6377\u952E\u4E00\u5E76\u505C\u7528\u3002",
1943
2046
  "settings.row.contextAware.label": "\u4E0A\u4E0B\u6587\u611F\u77E5",
1944
- "settings.row.contextAware.hint": "\u8BFB\u53D6\u5F53\u524D\u4F1A\u8BDD\u6700\u8FD1\u51E0\u8F6E\u5BF9\u8BDD\u6765\u6D88\u89E3\u6307\u4EE3\u3001\u8865\u5168\u7701\u7565\uFF1B\u65E0\u5386\u53F2\u65F6\u56DE\u9000\u4E3A\u5355\u6761\u589E\u5F3A\u3002",
2047
+ "settings.row.contextAware.hint": "\u8BFB\u53D6\u5F53\u524D\u4F1A\u8BDD\u6700\u8FD1\u51E0\u6761\u6D88\u606F\u6765\u6D88\u89E3\u6307\u4EE3\u3001\u8865\u5168\u7701\u7565\uFF1B\u65E0\u5386\u53F2\u65F6\u56DE\u9000\u4E3A\u5355\u6761\u589E\u5F3A\u3002",
1945
2048
  "settings.row.streaming.label": "\u589E\u91CF\u5C55\u793A",
1946
2049
  "settings.row.streaming.hint": "\u6A21\u578B\u8FB9\u5199\u8FB9\u5728\u9762\u677F\u663E\u793A\uFF1B\u4EC5\u5F71\u54CD\u663E\u793A\u8282\u594F\uFF0C\u6700\u7EC8\u5199\u5165\u7684\u6587\u672C\u4E0D\u53D8\u3002",
1947
2050
  "settings.row.foldAnimation.label": "\u5361\u7247\u6298\u53E0\u52A8\u753B",
@@ -1974,9 +2077,12 @@ var zh = {
1974
2077
  "settings.row.temperature.label": "\u6E29\u5EA6",
1975
2078
  "settings.row.temperature.hint": "\u91C7\u6837\u6E29\u5EA6\uFF080~1\uFF0C\u6B65\u8FDB 0.05\uFF09\uFF0C\u8D8A\u4F4E\u8D8A\u5FE0\u5B9E\u539F\u6587\uFF1B\u9ED8\u8BA4 0.3\u3002",
1976
2079
  "settings.row.reasoningEffort.label": "\u63A8\u7406\u9884\u7B97",
1977
- "settings.row.reasoningEffort.hint": "\u6863\u4F4D\u9009\u9879\u6765\u81EA\u5F53\u524D provider/model \u7684\u58F0\u660E\uFF1B\u81EA\u5B9A\u4E49\u6A21\u578B\u65F6\u6309\u9700\u8BFB\u53D6\u3002\u300C\u4E0D\u6307\u5B9A\u300D\u8868\u793A\u4E0D\u4F20\u8BE5\u5B57\u6BB5\u3002",
2080
+ "settings.row.reasoningEffort.hint": "\u6863\u4F4D\u9009\u9879\u6765\u81EA\u5F53\u524D provider/model \u7684\u58F0\u660E\uFF1B\u81EA\u5B9A\u4E49\u6A21\u578B\u65F6\u6309\u9700\u8BFB\u53D6\u3002\u300C\u6A21\u578B\u9ED8\u8BA4\u300D\u8868\u793A\u4E0D\u53D1\u9001\u8BE5\u5B57\u6BB5\uFF0C\u7531\u63D0\u4F9B\u65B9\u4F7F\u7528\u9ED8\u8BA4\u6863\u3002",
1978
2081
  "settings.row.maxOutputTokens.label": "\u8F93\u51FA token \u4E0A\u9650",
1979
2082
  "settings.row.maxOutputTokens.hint": "\u5355\u6B21\u589E\u5F3A\u7684\u8F93\u51FA\u9884\u7B97\uFF1B\u9ED8\u8BA4 8192\u3002",
2083
+ "settings.row.invalidInteger": "\u8BF7\u8F93\u5165 {min}\u2013{max} \u4E4B\u95F4\u7684\u6574\u6570",
2084
+ "settings.row.invalidNumber": "\u8BF7\u8F93\u5165 {min}\u2013{max} \u4E4B\u95F4\u7684\u6570\u5B57",
2085
+ "settings.row.blankDefault": "\u7559\u7A7A = \u4F7F\u7528\u9ED8\u8BA4\u503C {value}",
1980
2086
  "settings.row.maxInputChars.label": "\u8F93\u5165\u5B57\u7B26\u4E0A\u9650",
1981
2087
  "settings.row.maxInputChars.hint": "\u8D85\u51FA\u76F4\u63A5\u62D2\u7EDD\u3001\u4E0D\u622A\u65AD\uFF1B\u9ED8\u8BA4 12000\u3002",
1982
2088
  "settings.row.timeoutMs.label": "\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
@@ -1987,7 +2093,7 @@ var zh = {
1987
2093
  "settings.row.systemPrompt.hint": "\u7559\u7A7A\u4F7F\u7528\u5185\u7F6E\u589E\u5F3A\u7B56\u7565\u3002",
1988
2094
  "settings.row.systemPrompt.placeholder": "\u4F8B\uFF1A\u628A\u7528\u6237\u7684\u4E2D\u6587\u8F93\u5165\u7FFB\u8BD1\u6210\u82F1\u6587\u3002",
1989
2095
  "settings.row.contextMaxMessages.label": "\u4E0A\u4E0B\u6587\u6D88\u606F\u6761\u6570",
1990
- "settings.row.contextMaxMessages.hint": "\u6700\u591A\u53C2\u8003\u6700\u8FD1\u591A\u5C11\u8F6E\u5BF9\u8BDD\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003\uFF1B\u9ED8\u8BA4 8\u3002",
2096
+ "settings.row.contextMaxMessages.hint": "\u6700\u591A\u53C2\u8003\u6700\u8FD1\u591A\u5C11\u6761\u6D88\u606F\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003\uFF1B\u9ED8\u8BA4 8\u3002",
1991
2097
  "settings.row.contextMaxChars.label": "\u4E0A\u4E0B\u6587\u5B57\u7B26\u4E0A\u9650",
1992
2098
  "settings.row.contextMaxChars.hint": "\u5386\u53F2\u7247\u6BB5\u7684\u5B57\u7B26\u9884\u7B97\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003\uFF1B\u9ED8\u8BA4 4000\u3002",
1993
2099
  "settings.row.maxConcurrent.label": "\u5E76\u53D1\u4E0A\u9650",
@@ -1999,7 +2105,7 @@ var zh = {
1999
2105
  "settings.row.shortcut.placeholder": "\u4F8B\uFF1Actrl+alt+shift+e",
2000
2106
  "settings.strategy.replace": "\u66FF\u6362\u5185\u7F6E\u7B56\u7565",
2001
2107
  "settings.strategy.extend": "\u8FFD\u52A0\u5728\u5185\u7F6E\u7B56\u7565\u540E",
2002
- "settings.reasoning.inherit": "\u4E0D\u6307\u5B9A",
2108
+ "settings.reasoning.inherit": "\u6A21\u578B\u9ED8\u8BA4",
2003
2109
  "settings.reasoning.loading": "\u6B63\u5728\u8BFB\u53D6\u8BE5\u6A21\u578B\u7684\u6863\u4F4D\u2026",
2004
2110
  "settings.reasoning.unavailable": "\u65E0\u6CD5\u8BFB\u53D6\u8BE5\u6A21\u578B\u7684\u6863\u4F4D\u5217\u8868\uFF1B\u5DF2\u4FDD\u5B58\u7684\u6863\u4F4D\u4ECD\u4F1A\u7167\u5E38\u53D1\u9001\u3002",
2005
2111
  "settings.reasoning.noTiers": "\u8BE5\u6A21\u578B\u672A\u58F0\u660E\u63A8\u7406\u6863\u4F4D\uFF1B\u8C03\u7528\u65F6\u4E0D\u53D1\u9001\u6863\u4F4D\uFF0C\u7531\u63D0\u4F9B\u65B9\u51B3\u5B9A\u3002",
@@ -2024,7 +2130,7 @@ var en = {
2024
2130
  "menu.effortsNone": "This model declares no reasoning tiers",
2025
2131
  "menu.effortsFailed": "Could not read this model tiers",
2026
2132
  "menu.effort": "Reasoning effort",
2027
- "menu.effortDefault": "Not specified",
2133
+ "menu.effortDefault": "Model default",
2028
2134
  "menu.context": "Context awareness",
2029
2135
  "menu.contextOn": "on",
2030
2136
  "menu.contextOff": "off",
@@ -2038,6 +2144,7 @@ var en = {
2038
2144
  "panel.enhanced": "Enhanced result",
2039
2145
  "panel.apply": "Fill into input box",
2040
2146
  "panel.regenerate": "Regenerate",
2147
+ "panel.regenerate.empty": "Type some text before regenerating",
2041
2148
  "panel.regenerated": "Regenerated",
2042
2149
  "panel.copy": "Copy result",
2043
2150
  "panel.copied": "Copied",
@@ -2046,12 +2153,21 @@ var en = {
2046
2153
  "panel.collapse": "Collapse",
2047
2154
  "panel.expand": "Expand",
2048
2155
  "panel.retry": "Retry",
2049
- "panel.stale.warn": "Draft changed \u2014 this result uses the earlier text. Regenerate re-runs on the current draft; Apply still overwrites the input (undoable).",
2050
- "panel.truncated": 'Output was cut at the output limit, so the result may be incomplete. Raise "Output token budget" in the settings, then regenerate.',
2156
+ "panel.stale.warn": "Draft changed: this result uses the earlier text. Regenerate re-runs on the current draft; filling into the input box overwrites your later edits (undoable).",
2157
+ "panel.stale.empty": "Draft changed: it is now empty. Regenerate is unavailable \u2014 type some text first; filling into the input box overwrites your later edits (undoable).",
2158
+ "panel.stale.dot": "Draft changed",
2159
+ "panel.truncated": 'The output hit the "Output token budget" limit, so the result may be incomplete. Raise that limit in the settings, then regenerate.',
2160
+ "panel.truncated.dot": "Output truncated",
2161
+ "panel.contextUsage": "Context usage",
2162
+ "panel.contextStats": "Context {turns}/{maxTurns} messages \xB7 {chars}/{maxChars} chars ({percent}%)",
2163
+ "panel.contextCharsLimited": "Character cap reached; earlier messages were not sent",
2164
+ "panel.contextCut": "Character limit reached; only the opening of the latest message was sent",
2165
+ "panel.contextUnused": "No conversation context was used for this call",
2166
+ "panel.attachmentsCount": "Attachments: {count}",
2051
2167
  "panel.model": "Model: {provider} / {model}",
2052
2168
  "panel.elapsed": "{ms} elapsed",
2053
2169
  "panel.tokens": "{total} tokens",
2054
- "panel.effortDefault": "Not specified",
2170
+ "panel.effortDefault": "Model default",
2055
2171
  "panel.tokens.input": "Input {count}",
2056
2172
  "panel.tokens.output": "Output {count}",
2057
2173
  "panel.tokens.cacheRead": "Cache read {count}",
@@ -2059,34 +2175,35 @@ var en = {
2059
2175
  "undo.applied": "Original draft replaced",
2060
2176
  "undo.undo": "Undo",
2061
2177
  "undo.dismiss": "Dismiss",
2062
- "error.empty": "The input box is empty \u2014 type a prompt to enhance first.",
2063
- "error.tooLong": "The draft is {count} characters, over the {max} limit (characters, not tokens); it is never truncated automatically \u2014 please shorten it.",
2064
- "error.occurrences": "The draft contains commands or file references, which are not supported yet \u2014 remove them first.",
2065
- "error.chipsUnknown": "The composer reference state could not be read, so the enhancement was blocked to avoid overwriting your command or file reference. Use plain text, then retry.",
2066
- "error.phase": "The input box is busy (submitting) \u2014 try again in a moment.",
2067
- "error.disabled": "Prompt enhance is disabled in the plugin settings; re-enable it there.",
2068
- "error.rejected": "The enhance request was rejected. Retry later; if it persists, check the plugin settings.",
2069
- "error.timeout": 'The enhancement timed out ({seconds}s). Retry, or raise "Timeout (ms)" in the settings; your draft is untouched.',
2070
- "error.unconfigured": "No model is configured for the enhancement: fill in both provider and model in the plugin settings, or send a message in the current session first to follow the session model.",
2071
- "error.effortUnsupported": 'This model does not support the selected reasoning effort "{effort}". Choose another tier, or use "Not specified".',
2072
- "error.upstream": "The model provider returned an error. If there is detail below, act on it; otherwise retry. Your draft is untouched.",
2073
- "error.internal": "Enhancement failed. Retry; if it keeps failing, check the dsh logs. Your draft is untouched.",
2074
- "error.client.unreachable": "Cannot reach the host service \u2014 make sure dsh web is running, then retry.",
2075
- "error.client.malformed": "The host returned data that could not be parsed. Retry; your draft is untouched.",
2076
- "error.client.refused": "The host refused the request (HTTP {status}). Retry later.",
2077
- "error.client.streamClosed": "The host closed the enhance stream early. Retry; your draft is untouched.",
2078
- "error.client.cancelled": "The enhancement was cancelled; your draft is untouched.",
2079
- "error.rateLimit": "Too many requests \u2014 at most {limit} enhancements per minute; retry in {retryAfterSeconds} seconds.",
2080
- "error.concurrencyLimit": "{max} enhancements are already running \u2014 wait for one to finish, then retry.",
2081
- "error.cooldown": "{failures} enhancements failed in a row; calls are paused for {retryAfterSeconds}s to stop hammering the model service. Retry later, or check the model settings first.",
2082
- "error.upstream.auth": "Authentication failed \u2014 check the API key configured for this provider.",
2083
- "error.upstream.invalidCredential": "Authentication failed \u2014 the stored API key is invalid; fix it and retry.",
2084
- "error.upstream.rateLimit": "The model provider is rate-limiting; retry later.",
2085
- "error.upstream.quota": "The model provider reports a quota/balance issue \u2014 check your account.",
2086
- "error.upstream.empty": "The model returned an empty response; retry.",
2087
- "error.upstream.contextWindow": "The input exceeds the model context window \u2014 shorten it or switch models.",
2088
- "error.upstream.toolCall": "The model requested tool calls, but prompt enhance needs plain text \u2014 switch models and retry.",
2089
- "error.upstream.maxTokens": 'The rewrite hit the "Output token budget" limit \u2014 raise that setting or shorten the draft, then retry.',
2178
+ "error.empty": "The input box is empty \u2014 type the text you want enhanced first.",
2179
+ "error.tooLong": "The draft is {count} characters, over the {max}-character limit (characters, not tokens). It is never truncated automatically \u2014 shorten it and try again.",
2180
+ "error.occurrences": "The draft contains file or session references, which are not supported yet \u2014 remove them first, then re-insert them after enhancing.",
2181
+ "error.chipsUnknown": "The composer reference state could not be read. To avoid overwriting your command or file reference on fill-back, nothing was run \u2014 use plain text and try again.",
2182
+ "error.phase": "The input box is busy submitting or checking \u2014 wait for it to finish, then try again.",
2183
+ "error.command": "The draft starts with a command chip (for example /plan), which is not supported yet \u2014 remove the command first, then enhance the body on its own.",
2184
+ "error.disabled": "Prompt enhance is turned off in the plugin settings \u2014 re-enable it there and try again.",
2185
+ "error.rejected": "This enhancement was refused. Retry later; if it keeps happening, check the plugin settings.",
2186
+ "error.timeout": 'No result after {seconds}s, so this call was cancelled. Retry, or raise "Timeout (ms)" in the settings; your input was not changed.',
2187
+ "error.unconfigured": "No model is configured yet: fill in both provider and model in the plugin settings, or send a message in the current session first so the enhancement follows the session model.",
2188
+ "error.effortUnsupported": 'The current model does not support the selected reasoning effort "{effort}" \u2014 choose another tier, or use "Model default".',
2189
+ "error.upstream": "The model provider returned an error. If there is detail below, act on it; otherwise retry. Your input was not changed.",
2190
+ "error.internal": "Enhancement failed. Retry; if it keeps failing, check the DSH logs. Your input was not changed.",
2191
+ "error.client.unreachable": "Cannot reach the DSH service \u2014 make sure DSH is running, then retry.",
2192
+ "error.client.malformed": "DSH returned data that could not be parsed. Retry; your input was not changed.",
2193
+ "error.client.refused": "DSH refused the request (HTTP {status}). Retry later.",
2194
+ "error.client.streamClosed": "The connection closed before the result arrived. Retry; your input was not changed.",
2195
+ "error.client.cancelled": "Enhancement cancelled; your input was not changed.",
2196
+ "error.rateLimit": "Too many requests: at most {limit} enhancements per minute. Try again in {retryAfterSeconds}s.",
2197
+ "error.concurrencyLimit": "At most {max} enhancements can run at once \u2014 wait for one to finish, then try again.",
2198
+ "error.cooldown": "{failures} enhancements failed in a row, so calls are paused for {retryAfterSeconds}s to avoid hammering the model service. Check the model settings, then retry.",
2199
+ "error.upstream.auth": "Model service authentication failed: check this provider's API key.",
2200
+ "error.upstream.invalidCredential": "Model service authentication failed: the stored API key is not usable \u2014 update it and retry.",
2201
+ "error.upstream.rateLimit": "The model service is rate-limiting requests. Retry later.",
2202
+ "error.upstream.quota": "The model service is out of quota or balance \u2014 check the account.",
2203
+ "error.upstream.empty": "The model returned an empty result \u2014 retry.",
2204
+ "error.upstream.contextWindow": "The content exceeds the model's context window \u2014 shorten the draft or switch models.",
2205
+ "error.upstream.toolCall": "The model tried to call a tool, but prompt enhancement only sends plain text \u2014 switch models and retry.",
2206
+ "error.upstream.maxTokens": 'The result hit the "Output token budget" limit. Raise that setting, or shorten the draft and retry.',
2090
2207
  "settings.summary": "Model, context, and resource limits",
2091
2208
  "settings.title": "Prompt enhance",
2092
2209
  "settings.description": "Turns a composer draft into a structured prompt: role and goal, executable steps, output format, acceptance criteria, edge cases. The draft is preserved, failures never touch it, and saved values apply to the next call.",
@@ -2109,7 +2226,7 @@ var en = {
2109
2226
  "settings.row.enabled.label": "Master switch",
2110
2227
  "settings.row.enabled.hint": "Off hides the composer button and disables the command and the shortcut.",
2111
2228
  "settings.row.contextAware.label": "Context aware",
2112
- "settings.row.contextAware.hint": "Reads the recent turns of the current conversation; falls back to a single-prompt rewrite when there is no history.",
2229
+ "settings.row.contextAware.hint": "Reads the recent messages of the current conversation; falls back to a single-prompt rewrite when there is no history.",
2113
2230
  "settings.row.streaming.label": "Streaming display",
2114
2231
  "settings.row.streaming.hint": "Shows the rewrite while it is being written. Display only: the applied text is unchanged.",
2115
2232
  "settings.row.foldAnimation.label": "Card fold animation",
@@ -2142,9 +2259,12 @@ var en = {
2142
2259
  "settings.row.temperature.label": "Temperature",
2143
2260
  "settings.row.temperature.hint": "Sampling temperature (0\u20131, step 0.05); lower stays closer to the original. Default 0.3.",
2144
2261
  "settings.row.reasoningEffort.label": "Reasoning effort",
2145
- "settings.row.reasoningEffort.hint": 'Tier choices come from what the configured provider/model declares; custom models are read on demand. "Not specified" omits the field.',
2262
+ "settings.row.reasoningEffort.hint": 'Tier choices come from what the configured provider/model declares; custom models are read on demand. "Model default" means the field is omitted and the provider applies its default.',
2146
2263
  "settings.row.maxOutputTokens.label": "Output token budget",
2147
2264
  "settings.row.maxOutputTokens.hint": "Output budget for one enhancement call. Default 8192.",
2265
+ "settings.row.invalidInteger": "Enter an integer between {min} and {max}",
2266
+ "settings.row.invalidNumber": "Enter a number between {min} and {max}",
2267
+ "settings.row.blankDefault": "Leave blank to use the default: {value}",
2148
2268
  "settings.row.maxInputChars.label": "Input character cap",
2149
2269
  "settings.row.maxInputChars.hint": "Over-limit drafts are rejected, never truncated. Default 12000.",
2150
2270
  "settings.row.timeoutMs.label": "Timeout (ms)",
@@ -2154,8 +2274,8 @@ var en = {
2154
2274
  "settings.row.systemPrompt.label": "Custom system prompt",
2155
2275
  "settings.row.systemPrompt.hint": "Leave empty to use the built-in enhancement strategy.",
2156
2276
  "settings.row.systemPrompt.placeholder": "e.g. translate the user text from Chinese into English.",
2157
- "settings.row.contextMaxMessages.label": "Context turns",
2158
- "settings.row.contextMaxMessages.hint": "How many recent turns may ground the rewrite; 0 disables context. Default 8.",
2277
+ "settings.row.contextMaxMessages.label": "Context messages",
2278
+ "settings.row.contextMaxMessages.hint": "How many recent messages may ground the rewrite; 0 disables context. Default 8.",
2159
2279
  "settings.row.contextMaxChars.label": "Context characters",
2160
2280
  "settings.row.contextMaxChars.hint": "Character budget for the context snippet; 0 disables it. Default 4000.",
2161
2281
  "settings.row.maxConcurrent.label": "Concurrency cap",
@@ -2167,7 +2287,7 @@ var en = {
2167
2287
  "settings.row.shortcut.placeholder": "e.g. ctrl+alt+shift+e",
2168
2288
  "settings.strategy.replace": "Replace the built-in strategy",
2169
2289
  "settings.strategy.extend": "Append after the built-in strategy",
2170
- "settings.reasoning.inherit": "Not specified",
2290
+ "settings.reasoning.inherit": "Model default",
2171
2291
  "settings.reasoning.loading": "Reading this model\u2019s tiers\u2026",
2172
2292
  "settings.reasoning.unavailable": "Could not read this model\u2019s tier list; your saved tier is still sent.",
2173
2293
  "settings.reasoning.noTiers": "This model declares no reasoning tiers; calls omit the field and let the provider decide.",
@@ -2209,6 +2329,9 @@ var CSS = `
2209
2329
  from the other scheme. */
2210
2330
  --pe-warn-border: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e8c07d) 35%, transparent);
2211
2331
  --pe-warn-bg: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e8c07d) 12%, transparent);
2332
+ /* Same tint recipe for the truncation banner: red is a state, not a theme. */
2333
+ --pe-danger-border: color-mix(in srgb, var(--dsw-alias-state-error-primary, #ffb4a8) 35%, transparent);
2334
+ --pe-danger-bg: color-mix(in srgb, var(--dsw-alias-state-error-primary, #ffb4a8) 12%, transparent);
2212
2335
  }
2213
2336
  /* Quick-settings menu, copied from the shell's own menu primitives:
2214
2337
  - the card surface is MenuSurface.module.css (radius-lg, elevation stroke,
@@ -2531,6 +2654,7 @@ html[data-platform='darwin'] .dsh-pe-menu {
2531
2654
  /* Collapsed, the warning banners live in the hidden body; this marker stands in
2532
2655
  for them so a stale or truncated result never folds away silently. */
2533
2656
  .dsh-pe-warn-dot { font-size: 15px; line-height: 1; color: var(--pe-warn-fg); }
2657
+ .dsh-pe-warn-dot.is-danger { color: var(--pe-danger); }
2534
2658
  .dsh-pe-result { padding: 2px 10px 6px; }
2535
2659
  .dsh-pe-result-text {
2536
2660
  margin: 0;
@@ -2598,6 +2722,114 @@ html[data-platform='darwin'] .dsh-pe-menu {
2598
2722
  border-top: 1px solid var(--pe-separator);
2599
2723
  }
2600
2724
  .dsh-pe-foot .dsh-pe-grow { flex: 1; }
2725
+
2726
+ /* The context-usage button sits at the quiet end of the footer, opposite the
2727
+ actions. Its tooltip opens upward into the card body, so no portal is needed
2728
+ and the card's own overflow clipping stays out of the way. */
2729
+ .dsh-pe-context-wrap {
2730
+ position: relative;
2731
+ display: inline-flex;
2732
+ }
2733
+ .dsh-pe-context {
2734
+ box-sizing: border-box;
2735
+ display: inline-flex;
2736
+ flex: none;
2737
+ align-items: center;
2738
+ justify-content: center;
2739
+ width: 28px;
2740
+ height: 28px;
2741
+ padding: 0;
2742
+ border: 0;
2743
+ border-radius: 8px;
2744
+ background: transparent;
2745
+ /* The glyph carries the state on its own: grey when the window is healthy,
2746
+ amber when it had to cut something. The precise counts stay in the
2747
+ tooltip. */
2748
+ --pe-context-accent: var(--dsw-alias-label-tertiary, #8a8a8a);
2749
+ color: var(--pe-context-accent);
2750
+ cursor: default;
2751
+ }
2752
+ .dsh-pe-context:hover { background: var(--pe-hover); }
2753
+ .dsh-pe-context.is-limited {
2754
+ --pe-context-accent: #b45309;
2755
+ color: var(--pe-context-accent);
2756
+ }
2757
+ /* The warning lives in the glyph alone by default; the amber tint appears on
2758
+ hover or keyboard focus, matching the plain state's on-demand background. */
2759
+ .dsh-pe-context.is-limited:hover,
2760
+ .dsh-pe-context.is-limited:focus-visible {
2761
+ background: rgba(180, 83, 9, 0.1);
2762
+ }
2763
+ .dsh-pe-context-icon {
2764
+ position: relative;
2765
+ z-index: 1;
2766
+ display: block;
2767
+ width: 20px;
2768
+ height: 20px;
2769
+ color: var(--pe-context-accent);
2770
+ }
2771
+ .dsh-pe-context-tip {
2772
+ position: absolute;
2773
+ left: 0;
2774
+ bottom: calc(100% + 8px);
2775
+ z-index: 5;
2776
+ display: flex;
2777
+ flex-direction: column;
2778
+ gap: 2px;
2779
+ box-sizing: border-box;
2780
+ width: max-content;
2781
+ max-width: min(340px, calc(100vw - 40px));
2782
+ padding: 6px 10px;
2783
+ border-radius: var(--dsw-radius-sm, 6px);
2784
+ background: var(--dsw-alias-tooltip-bg, #2f2f2f);
2785
+ color: var(--dsw-alias-tooltip-label, #ffffff);
2786
+ font-size: 13px;
2787
+ line-height: 20px;
2788
+ font-variant-numeric: tabular-nums;
2789
+ white-space: normal;
2790
+ box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
2791
+ pointer-events: none;
2792
+ animation: dsh-pe-context-tip-in 140ms ease-out;
2793
+ }
2794
+ /* The bubble needs an anchor: it floats above the icon and would otherwise
2795
+ read as disconnected from the footer. */
2796
+ .dsh-pe-context-tip::after {
2797
+ content: '';
2798
+ position: absolute;
2799
+ left: 12px;
2800
+ bottom: -5px;
2801
+ width: 0;
2802
+ height: 0;
2803
+ border-left: 5px solid transparent;
2804
+ border-right: 5px solid transparent;
2805
+ border-top: 5px solid var(--dsw-alias-tooltip-bg, #2f2f2f);
2806
+ }
2807
+ @keyframes dsh-pe-context-tip-in {
2808
+ from {
2809
+ opacity: 0;
2810
+ transform: translateY(2px);
2811
+ }
2812
+ }
2813
+ @media (prefers-reduced-motion: reduce) {
2814
+ .dsh-pe-context-tip { animation: none; }
2815
+ }
2816
+ /* The stats line is one unit: a wrap that leaves the percentage alone reads
2817
+ as a layout bug. The reason line may wrap freely. */
2818
+ .dsh-pe-context-tip .dsh-pe-context-stats { white-space: nowrap; }
2819
+ .dsh-pe-context-tip .dsh-pe-context-reason { color: #f2c185; }
2820
+ /* Attachment count is metadata, not a warning: same tooltip body color. */
2821
+ .dsh-pe-context-tip .dsh-pe-context-attachments { white-space: nowrap; }
2822
+ /* Narrow viewports: the card itself is close to the viewport width, so the
2823
+ fixed tooltip width would clip. Give it a viewport-relative cap and let the
2824
+ stats line wrap instead of overflowing. */
2825
+ @media (max-width: 560px) {
2826
+ .dsh-pe-context-tip {
2827
+ min-width: 0;
2828
+ width: 230px;
2829
+ max-width: calc(100vw - 40px);
2830
+ }
2831
+ .dsh-pe-context-tip .dsh-pe-context-stats { white-space: normal; }
2832
+ }
2601
2833
  .dsh-pe-btn-action {
2602
2834
  box-sizing: border-box;
2603
2835
  display: inline-flex;
@@ -2641,6 +2873,10 @@ html[data-platform='darwin'] .dsh-pe-menu {
2641
2873
  (retry, cancel) the same size as the rest. */
2642
2874
  .dsh-pe-btn-floor { min-width: 96px; }
2643
2875
  .dsh-pe-btn-action:disabled { opacity: 0.45; cursor: default; }
2876
+ /* aria-disabled, not the native attribute: the button keeps focus and its
2877
+ click handler so the reason stays reachable (the handler refuses to run). */
2878
+ .dsh-pe-btn-action[aria-disabled='true'] { opacity: 0.45; cursor: not-allowed; }
2879
+ .dsh-pe-btn-action[aria-disabled='true']:hover { background: transparent; }
2644
2880
 
2645
2881
  /* Both labels of the regenerate button share one cell, so the button is as wide
2646
2882
  as the longer label of the active language and a label swap can never move
@@ -2658,6 +2894,13 @@ html[data-platform='darwin'] .dsh-pe-menu {
2658
2894
  background: var(--pe-warn-bg);
2659
2895
  color: var(--pe-warn-fg);
2660
2896
  }
2897
+ /* Truncation is a result-quality problem, not a stale-draft warning: red says
2898
+ the result itself is incomplete, while the stale banner keeps the amber. */
2899
+ .dsh-pe-stale.dsh-pe-truncated {
2900
+ border-top-color: var(--pe-danger-border);
2901
+ background: var(--pe-danger-bg);
2902
+ color: var(--pe-danger);
2903
+ }
2661
2904
 
2662
2905
  .dsh-pe-btn {
2663
2906
  display: inline-flex;
@@ -3106,6 +3349,20 @@ var import_react10 = require("react");
3106
3349
 
3107
3350
  // src/client/settings-page-spec.ts
3108
3351
  var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
3352
+
3353
+ // src/shared/limits.ts
3354
+ var TEMPERATURE = { min: 0, max: 1, step: 0.05 };
3355
+ var FIELD_LIMITS = {
3356
+ maxOutputTokens: { min: 256, max: 32768 },
3357
+ maxInputChars: { min: 200, max: 2e5 },
3358
+ timeoutMs: { min: 5e3, max: 6e5 },
3359
+ maxConcurrent: { min: 1, max: 16 },
3360
+ rateLimitPerMinute: { min: 1, max: 600 },
3361
+ contextMaxMessages: { min: 0, max: 50 },
3362
+ contextMaxChars: { min: 0, max: 1e5 }
3363
+ };
3364
+
3365
+ // src/client/settings-page-spec.ts
3109
3366
  var SETTINGS_SECTION_SLOT = "settings.section";
3110
3367
  var SETTINGS_SECTION_ID = "dsh-prompt-enhance";
3111
3368
  var SETTINGS_SECTION_ORDER = 70;
@@ -3143,12 +3400,30 @@ var STRATEGY_OPTIONS = [
3143
3400
  { value: "replace-default", label: "settings.strategy.replace" },
3144
3401
  { value: "extend-default", label: "settings.strategy.extend" }
3145
3402
  ];
3403
+ function validateNumber(text, range, integer) {
3404
+ const trimmed = text.trim();
3405
+ if (trimmed === "") return true;
3406
+ const value = Number(trimmed);
3407
+ if (!Number.isFinite(value)) return false;
3408
+ if (integer && !Number.isInteger(value)) return false;
3409
+ return value >= range.min && value <= range.max;
3410
+ }
3411
+ function numberRow(key, label, hint, range, integer = true) {
3412
+ return {
3413
+ key,
3414
+ kind: "number",
3415
+ label,
3416
+ hint,
3417
+ range: { ...range, integer },
3418
+ validate: (text) => validateNumber(text, range, integer)
3419
+ };
3420
+ }
3146
3421
  var BASIC_ROWS = [
3147
3422
  { key: "enabled", kind: "boolean", label: "settings.row.enabled.label", hint: "settings.row.enabled.hint" },
3148
3423
  { key: "provider", kind: "provider", label: "settings.row.provider.label", hint: "settings.row.provider.hint" },
3149
3424
  { key: "model", kind: "model", label: "settings.row.model.label", hint: "settings.row.model.hint" },
3150
3425
  { key: "reasoningEffort", kind: "reasoning", label: "settings.row.reasoningEffort.label", hint: "settings.row.reasoningEffort.hint" },
3151
- { key: "temperature", kind: "number", label: "settings.row.temperature.label", hint: "settings.row.temperature.hint" },
3426
+ numberRow("temperature", "settings.row.temperature.label", "settings.row.temperature.hint", TEMPERATURE, false),
3152
3427
  { key: "contextAware", kind: "boolean", label: "settings.row.contextAware.label", hint: "settings.row.contextAware.hint" },
3153
3428
  { key: "streaming", kind: "boolean", label: "settings.row.streaming.label", hint: "settings.row.streaming.hint" },
3154
3429
  { key: "systemPrompt", kind: "text", label: "settings.row.systemPrompt.label", hint: "settings.row.systemPrompt.hint", placeholder: "settings.row.systemPrompt.placeholder" },
@@ -3167,13 +3442,13 @@ var ADVANCED_ROWS = [
3167
3442
  { key: "foldAnimation", kind: "boolean", label: "settings.row.foldAnimation.label", hint: "settings.row.foldAnimation.hint" },
3168
3443
  { key: "autoFold", kind: "boolean", label: "settings.row.autoFold.label", hint: "settings.row.autoFold.hint" },
3169
3444
  { key: "strategyMode", kind: "strategy", label: "settings.row.strategyMode.label", hint: "settings.row.strategyMode.hint" },
3170
- { key: "maxInputChars", kind: "number", label: "settings.row.maxInputChars.label", hint: "settings.row.maxInputChars.hint" },
3171
- { key: "maxOutputTokens", kind: "number", label: "settings.row.maxOutputTokens.label", hint: "settings.row.maxOutputTokens.hint" },
3172
- { key: "timeoutMs", kind: "number", label: "settings.row.timeoutMs.label", hint: "settings.row.timeoutMs.hint" },
3173
- { key: "contextMaxMessages", kind: "number", label: "settings.row.contextMaxMessages.label", hint: "settings.row.contextMaxMessages.hint" },
3174
- { key: "contextMaxChars", kind: "number", label: "settings.row.contextMaxChars.label", hint: "settings.row.contextMaxChars.hint" },
3175
- { key: "maxConcurrent", kind: "number", label: "settings.row.maxConcurrent.label", hint: "settings.row.maxConcurrent.hint" },
3176
- { key: "rateLimitPerMinute", kind: "number", label: "settings.row.rateLimitPerMinute.label", hint: "settings.row.rateLimitPerMinute.hint" }
3445
+ numberRow("maxInputChars", "settings.row.maxInputChars.label", "settings.row.maxInputChars.hint", FIELD_LIMITS.maxInputChars),
3446
+ numberRow("maxOutputTokens", "settings.row.maxOutputTokens.label", "settings.row.maxOutputTokens.hint", FIELD_LIMITS.maxOutputTokens),
3447
+ numberRow("timeoutMs", "settings.row.timeoutMs.label", "settings.row.timeoutMs.hint", FIELD_LIMITS.timeoutMs),
3448
+ numberRow("contextMaxMessages", "settings.row.contextMaxMessages.label", "settings.row.contextMaxMessages.hint", FIELD_LIMITS.contextMaxMessages),
3449
+ numberRow("contextMaxChars", "settings.row.contextMaxChars.label", "settings.row.contextMaxChars.hint", FIELD_LIMITS.contextMaxChars),
3450
+ numberRow("maxConcurrent", "settings.row.maxConcurrent.label", "settings.row.maxConcurrent.hint", FIELD_LIMITS.maxConcurrent),
3451
+ numberRow("rateLimitPerMinute", "settings.row.rateLimitPerMinute.label", "settings.row.rateLimitPerMinute.hint", FIELD_LIMITS.rateLimitPerMinute)
3177
3452
  ];
3178
3453
  var ROWS = [...BASIC_ROWS, ...ADVANCED_ROWS];
3179
3454
  function descriptorOf(row) {
@@ -3230,6 +3505,11 @@ function atDefaultValue(key, text) {
3230
3505
 
3231
3506
  // src/client/settings-page-copy.ts
3232
3507
  var ZH_COPY = zh;
3508
+ function interpolate(t, key, params) {
3509
+ let text = t(key);
3510
+ for (const [name, value] of Object.entries(params)) text = text.split(`{${name}}`).join(value);
3511
+ return text;
3512
+ }
3233
3513
  function translator(t) {
3234
3514
  if (typeof t === "function") return t;
3235
3515
  return ((key, params) => {
@@ -3263,7 +3543,7 @@ function sectionCopy(t, chinese) {
3263
3543
  hint: (row) => t(row.hint),
3264
3544
  placeholder: (row) => row.placeholder === void 0 ? void 0 : t(row.placeholder),
3265
3545
  choice: (key) => t(key),
3266
- interpolate: (key, params) => t(key, params)
3546
+ interpolate: (key, params) => interpolate(t, key, params)
3267
3547
  };
3268
3548
  }
3269
3549
  function pageCopy(t) {
@@ -3289,7 +3569,7 @@ function pageCopy(t) {
3289
3569
  hint: (row) => t(row.hint),
3290
3570
  placeholder: (row) => row.placeholder === void 0 ? void 0 : t(row.placeholder),
3291
3571
  choice: (key) => t(key),
3292
- interpolate: (key, params) => t(key, params)
3572
+ interpolate: (key, params) => interpolate(t, key, params)
3293
3573
  };
3294
3574
  }
3295
3575
 
@@ -3403,7 +3683,7 @@ var REPOSITORY_URL = "https://github.com/surfishs/dsh-prompt-enhance";
3403
3683
  var NPM_URL = "https://www.npmjs.com/package/@surfishs/dsh-prompt-enhance";
3404
3684
  var GITHUB_MARK = "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z";
3405
3685
  var NPM_MARK = "M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z";
3406
- var PLUGIN_VERSION = true ? "0.1.2" : "0.0.0";
3686
+ var PLUGIN_VERSION = true ? "0.1.4" : "0.0.0";
3407
3687
  var HEADER_STYLE = { display: "flex", flexDirection: "column", gap: 12, padding: "2px 0" };
3408
3688
  var HEADER_ROW_STYLE = { display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" };
3409
3689
  var HEADER_TITLE_STYLE = {
@@ -3847,6 +4127,19 @@ function PageHeader(props) {
3847
4127
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { style: HEADER_DESCRIPTION_STYLE, children: props.description })
3848
4128
  ] });
3849
4129
  }
4130
+ function invalidMessageOf(row, text, copy) {
4131
+ if (row.validate === void 0 || row.validate(text)) return void 0;
4132
+ if (row.range !== void 0) {
4133
+ const key = row.range.integer === false ? "settings.row.invalidNumber" : "settings.row.invalidInteger";
4134
+ return copy.interpolate(key, { min: String(row.range.min), max: String(row.range.max) });
4135
+ }
4136
+ return copy.labels.invalidShortcut;
4137
+ }
4138
+ function placeholderOf(row, view, copy) {
4139
+ if (row.kind !== "number" || view.text.trim() !== "") return copy.placeholder(row);
4140
+ const fallback = defaultTextOf(row.key);
4141
+ return fallback === "" ? copy.placeholder(row) : copy.interpolate("settings.row.blankDefault", { value: fallback });
4142
+ }
3850
4143
  function SettingsRow(props) {
3851
4144
  const shared = {
3852
4145
  id: `dsh-prompt-enhance-${props.row.key}`,
@@ -3876,8 +4169,8 @@ function SettingsRow(props) {
3876
4169
  {
3877
4170
  ...shared,
3878
4171
  numeric: props.row.kind === "number",
3879
- placeholder: props.copy.placeholder(props.row),
3880
- invalidMessage: props.row.validate !== void 0 && !props.row.validate(props.view.text) ? props.copy.labels.invalidShortcut : void 0,
4172
+ placeholder: placeholderOf(props.row, props.view, props.copy),
4173
+ invalidMessage: invalidMessageOf(props.row, props.view.text, props.copy),
3881
4174
  recordable: props.row.recordable === true
3882
4175
  }
3883
4176
  );