@surfishs/dsh-prompt-enhance 0.0.7 → 0.0.8

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.
Files changed (56) hide show
  1. package/README.en.md +3 -0
  2. package/README.md +3 -0
  3. package/cordis.patch.yml +1 -1
  4. package/lib/client.js +341 -383
  5. package/lib/index.js +67 -56
  6. package/lib/index.js.map +3 -3
  7. package/package.json +23 -15
  8. package/src/client/ActionIcons.tsx +4 -17
  9. package/src/client/EnhanceButton.tsx +52 -48
  10. package/src/client/ResultDock.tsx +22 -9
  11. package/src/client/ResultPanel.tsx +83 -52
  12. package/src/client/SparkleFishIcon.tsx +3 -13
  13. package/src/client/SparkleIcon.tsx +2 -12
  14. package/src/client/UndoBar.tsx +11 -6
  15. package/src/client/enhance-client.ts +44 -40
  16. package/src/client/index.tsx +3 -12
  17. package/src/client/llm-catalog.ts +14 -16
  18. package/src/client/locales.ts +18 -4
  19. package/src/client/reasoning-options.ts +7 -15
  20. package/src/client/settings-page-controls.tsx +449 -0
  21. package/src/client/settings-page-copy.ts +112 -0
  22. package/src/client/settings-page-spec.ts +330 -0
  23. package/src/client/settings-page-styles.ts +161 -0
  24. package/src/client/settings-page.tsx +113 -1110
  25. package/src/client/settings-source.ts +41 -31
  26. package/src/client/settings.ts +17 -12
  27. package/src/client/shortcut.ts +7 -6
  28. package/src/client/useDockAlignment.ts +5 -15
  29. package/src/config.ts +84 -27
  30. package/src/context.ts +1 -5
  31. package/src/enhance-routes.ts +8 -8
  32. package/src/enhancer.ts +43 -34
  33. package/src/orchestrate.ts +19 -23
  34. package/src/prompts.ts +4 -4
  35. package/src/provider-catalog.ts +1 -1
  36. package/src/reasoning-cache.ts +4 -4
  37. package/src/reasoning-efforts.ts +4 -9
  38. package/src/settings-source.ts +37 -23
  39. package/src/shared/limits.ts +38 -0
  40. package/src/shared/normalize.ts +4 -1
  41. package/src/shared/protocol.ts +27 -23
  42. package/src/shared/reasoning.ts +1 -7
  43. package/src/shared/stream-text.ts +0 -6
  44. package/src/shared/validate.ts +3 -9
  45. package/docs/code-review-2026-09.md +0 -211
  46. package/docs/handoff-settings-page.md +0 -195
  47. package/docs/release-0.2.3.md +0 -47
  48. package/docs/release-0.2.4.md +0 -20
  49. package/docs/release-0.2.5.md +0 -28
  50. package/docs/release-0.2.6.md +0 -33
  51. package/docs/release-0.2.7.md +0 -22
  52. package/docs/release-0.3.0.md +0 -36
  53. package/docs/release-0.3.1.md +0 -50
  54. package/docs/release-0.3.2.md +0 -41
  55. package/docs/release-0.3.3.md +0 -53
  56. package/docs/release-0.3.4.md +0 -43
package/lib/client.js CHANGED
@@ -66,12 +66,7 @@ function checkInputText(text, maxChars) {
66
66
  // src/shared/protocol.ts
67
67
  var ENHANCE_ENDPOINT = "/dsh-prompt-enhance/enhance";
68
68
  var ENHANCE_STREAM_ENDPOINT = "/dsh-prompt-enhance/enhance-stream";
69
- var PROMPT_ENHANCE_ROW_IDS = [
70
- "dsh-prompt-enhance",
71
- "prompt-enhance",
72
- "web-ui-dsh-prompt-enhance",
73
- "web-ui-prompt-enhance"
74
- ];
69
+ var PROMPT_ENHANCE_ROW_IDS = ["dsh-prompt-enhance", "prompt-enhance", "web-ui-dsh-prompt-enhance", "web-ui-prompt-enhance"];
75
70
 
76
71
  // src/client/enhance-client.ts
77
72
  var EnhanceClientError = class extends Error {
@@ -83,17 +78,7 @@ var EnhanceClientError = class extends Error {
83
78
  function jsonBody(body) {
84
79
  return new TextEncoder().encode(JSON.stringify(body));
85
80
  }
86
- var KNOWN_ERROR_CODES = /* @__PURE__ */ new Set([
87
- "rejected",
88
- "rate-limit",
89
- "concurrency-limit",
90
- "cooldown",
91
- "timeout",
92
- "upstream",
93
- "unconfigured",
94
- "internal",
95
- "effort-unsupported"
96
- ]);
81
+ var KNOWN_ERROR_CODES = /* @__PURE__ */ new Set(["rejected", "rate-limit", "concurrency-limit", "cooldown", "timeout", "upstream", "unconfigured", "internal", "effort-unsupported"]);
97
82
  function parseError(value) {
98
83
  const record = value;
99
84
  if (record !== null && typeof record === "object") {
@@ -102,7 +87,7 @@ function parseError(value) {
102
87
  const params = record.params !== null && typeof record.params === "object" ? record.params : void 0;
103
88
  return { code, ...message !== void 0 ? { message } : {}, ...params !== void 0 ? { params } : {} };
104
89
  }
105
- return { code: "internal", message: "\u5BBF\u4E3B\u670D\u52A1\u8FD4\u56DE\u5F02\u5E38\u3002" };
90
+ return { code: "internal", params: { reason: "malformed" } };
106
91
  }
107
92
  function tokenCount(value) {
108
93
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
@@ -136,14 +121,14 @@ function parseResult(value) {
136
121
  ...usage === void 0 ? {} : { usage }
137
122
  };
138
123
  }
139
- throw new EnhanceClientError({ code: "internal", message: "\u5BBF\u4E3B\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u89E3\u6790\u7684\u7ED3\u679C\u3002" });
124
+ throw new EnhanceClientError({ code: "internal", params: { reason: "malformed" } });
140
125
  }
141
126
  async function readEnvelope(response) {
142
127
  let parsed;
143
128
  try {
144
129
  parsed = await response.json();
145
130
  } catch {
146
- throw new EnhanceClientError({ code: "internal", message: "\u5BBF\u4E3B\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u89E3\u6790\u7684\u54CD\u5E94\u3002" });
131
+ throw new EnhanceClientError({ code: "internal", params: { reason: "malformed" } });
147
132
  }
148
133
  const envelope = parsed;
149
134
  if (envelope !== null && typeof envelope === "object" && envelope.ok === true) {
@@ -152,7 +137,7 @@ async function readEnvelope(response) {
152
137
  if (envelope !== null && typeof envelope === "object" && envelope.error !== void 0) {
153
138
  throw new EnhanceClientError(parseError(envelope.error));
154
139
  }
155
- throw new EnhanceClientError({ code: "internal", message: `\u5BBF\u4E3B\u670D\u52A1\u8FD4\u56DE\u5F02\u5E38\uFF08HTTP ${response.status}\uFF09\u3002` });
140
+ throw new EnhanceClientError({ code: "internal", params: { reason: "malformed", status: response.status } });
156
141
  }
157
142
  async function rejectionOf(response) {
158
143
  try {
@@ -162,7 +147,7 @@ async function rejectionOf(response) {
162
147
  }
163
148
  } catch {
164
149
  }
165
- return new EnhanceClientError({ code: "internal", message: `\u5BBF\u4E3B\u670D\u52A1\u62D2\u7EDD\u4E86\u8BF7\u6C42\uFF08HTTP ${response.status}\uFF09\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002` });
150
+ return new EnhanceClientError({ code: "internal", params: { reason: "refused", status: response.status } });
166
151
  }
167
152
  function takeFrames(buffer) {
168
153
  const frames = [];
@@ -204,10 +189,10 @@ async function requestEnhanceStream(body, options) {
204
189
  });
205
190
  } catch (error) {
206
191
  if (options.signal?.aborted) {
207
- throw new EnhanceClientError({ code: "internal", message: "\u5DF2\u53D6\u6D88\u589E\u5F3A\uFF1B\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002" });
192
+ throw new EnhanceClientError({ code: "internal", params: { reason: "cancelled" } });
208
193
  }
209
194
  void error;
210
- throw new EnhanceClientError({ code: "internal", message: "\u65E0\u6CD5\u8FDE\u63A5\u5BBF\u4E3B\u670D\u52A1\uFF0C\u8BF7\u786E\u8BA4 dsh web \u6B63\u5728\u8FD0\u884C\u540E\u91CD\u8BD5\u3002" });
195
+ throw new EnhanceClientError({ code: "internal", params: { reason: "unreachable" } });
211
196
  }
212
197
  const contentType = String(response.headers.get("content-type") ?? "").toLowerCase();
213
198
  if (!response.ok) throw await rejectionOf(response);
@@ -239,7 +224,7 @@ async function requestEnhanceStream(body, options) {
239
224
  void Promise.resolve().then(() => reader.cancel()).catch(() => {
240
225
  });
241
226
  }
242
- throw new EnhanceClientError({ code: "internal", message: "\u5BBF\u4E3B\u670D\u52A1\u63D0\u524D\u5173\u95ED\u4E86\u589E\u5F3A\u6D41\uFF0C\u8BF7\u91CD\u8BD5\uFF1B\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002" });
227
+ throw new EnhanceClientError({ code: "internal", params: { reason: "stream-closed" } });
243
228
  }
244
229
  async function requestEnhance(body, signal) {
245
230
  let response;
@@ -252,10 +237,10 @@ async function requestEnhance(body, signal) {
252
237
  });
253
238
  } catch (error) {
254
239
  if (signal?.aborted) {
255
- throw new EnhanceClientError({ code: "internal", message: "\u5DF2\u53D6\u6D88\u589E\u5F3A\uFF1B\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002" });
240
+ throw new EnhanceClientError({ code: "internal", params: { reason: "cancelled" } });
256
241
  }
257
242
  void error;
258
- throw new EnhanceClientError({ code: "internal", message: "\u65E0\u6CD5\u8FDE\u63A5\u5BBF\u4E3B\u670D\u52A1\uFF0C\u8BF7\u786E\u8BA4 dsh web \u6B63\u5728\u8FD0\u884C\u540E\u91CD\u8BD5\u3002" });
243
+ throw new EnhanceClientError({ code: "internal", params: { reason: "unreachable" } });
259
244
  }
260
245
  return readEnvelope(response);
261
246
  }
@@ -266,23 +251,11 @@ var FISH_PATH = "M22.9168 1.43018C22.6713 1.31018 22.5658 1.53918 22.4223 1.6551
266
251
  var STAR_PATH = "M5.715 0 L7.2 4.2 L11.43 5.715 L7.2 7.2 L5.715 11.43 L4.2 7.2 L0 5.715 L4.2 4.2 Z";
267
252
  function SparkleFishIcon(props) {
268
253
  const size = props.size ?? 15;
269
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
270
- "svg",
271
- {
272
- width: size * 1.3,
273
- height: size,
274
- viewBox: "0 0 26 20",
275
- fill: "none",
276
- "aria-hidden": "true",
277
- focusable: "false",
278
- style: { display: "block", flexShrink: 0 },
279
- children: [
280
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { transform: "translate(5,3) scale(0.85)", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: FISH_PATH, fill: "currentColor" }) }),
281
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: STAR_PATH, transform: "translate(1.2,0.8) scale(0.55)", fill: "currentColor" }),
282
- props.spinning === true ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("animate", { attributeName: "opacity", values: "1;0.35;1", dur: "1.1s", repeatCount: "indefinite" }) : null
283
- ]
284
- }
285
- );
254
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: size * 1.3, height: size, viewBox: "0 0 26 20", fill: "none", "aria-hidden": "true", focusable: "false", style: { display: "block", flexShrink: 0 }, children: [
255
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { transform: "translate(5,3) scale(0.85)", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: FISH_PATH, fill: "currentColor" }) }),
256
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: STAR_PATH, transform: "translate(1.2,0.8) scale(0.55)", fill: "currentColor" }),
257
+ props.spinning === true ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("animate", { attributeName: "opacity", values: "1;0.35;1", dur: "1.1s", repeatCount: "indefinite" }) : null
258
+ ] });
286
259
  }
287
260
 
288
261
  // src/client/undo-stack.ts
@@ -460,12 +433,34 @@ function shortcutTarget() {
460
433
  return fallback === void 0 ? void 0 : () => fallback.run();
461
434
  }
462
435
 
463
- // src/client/settings.ts
464
- var DEFAULT_CLIENT_SETTINGS = {
436
+ // src/shared/defaults.ts
437
+ var DEFAULT_VALUES = {
465
438
  enabled: true,
439
+ temperature: 0.3,
440
+ // A rewrite does not need deep reasoning, and the route default is expensive
441
+ // (measured: 2897 output tokens at `high` vs 252 at `off` for the same draft).
442
+ // Sent explicitly, because omitting the field inherits that route default.
443
+ reasoningEffort: "off",
444
+ maxOutputTokens: 8192,
466
445
  maxInputChars: 12e3,
446
+ timeoutMs: 6e4,
447
+ systemPrompt: "",
448
+ strategyMode: "replace-default",
467
449
  shortcut: "",
468
- streaming: true
450
+ maxConcurrent: 2,
451
+ rateLimitPerMinute: 10,
452
+ streaming: true,
453
+ contextAware: true,
454
+ contextMaxMessages: 8,
455
+ contextMaxChars: 4e3
456
+ };
457
+
458
+ // src/client/settings.ts
459
+ var DEFAULT_CLIENT_SETTINGS = {
460
+ enabled: DEFAULT_VALUES.enabled,
461
+ maxInputChars: DEFAULT_VALUES.maxInputChars,
462
+ shortcut: DEFAULT_VALUES.shortcut,
463
+ streaming: DEFAULT_VALUES.streaming
469
464
  };
470
465
  var listeners2 = /* @__PURE__ */ new Set();
471
466
  var current = DEFAULT_CLIENT_SETTINGS;
@@ -537,46 +532,52 @@ function EnhanceButton(props) {
537
532
  const anyBusy = panel !== void 0 && panel.phase === "loading";
538
533
  const otherBusy = anyBusy && !busy;
539
534
  const empty = draft.trim() === "";
540
- const start = (0, import_react2.useCallback)((overrideText) => {
541
- const source = overrideText ?? draft;
542
- if (anyBusy || source.trim() === "") return;
543
- if (!settings.enabled) {
544
- const disabled = t("error.disabled");
545
- openError(uiKey, draft, { code: "rejected", localized: disabled });
546
- return;
547
- }
548
- const check = checkInputText(source, settings.maxInputChars);
549
- if (!check.ok) {
550
- const message = check.code === "empty" ? t("error.empty") : t("error.tooLong", { count: check.count, max: check.max });
551
- openError(uiKey, source, { code: "rejected", localized: message });
552
- return;
553
- }
554
- if (occurrenceCount > 0) {
555
- const occurrences = t("error.occurrences");
556
- openError(uiKey, source, { code: "rejected", localized: occurrences });
557
- return;
558
- }
559
- if (phase !== "plain") {
560
- const busyPhase = t("error.phase");
561
- openError(uiKey, source, { code: "rejected", localized: busyPhase });
562
- return;
563
- }
564
- const controller = new AbortController();
565
- openLoading({ sessionId: uiKey, original: source, abort: () => controller.abort() });
566
- const settle = (result) => settleResult(uiKey, result);
567
- const fail = (error) => {
568
- const detail = error instanceof EnhanceClientError ? error.detail : { code: "internal", message: error instanceof Error ? error.message : String(error) };
569
- settleError(uiKey, detail);
570
- };
571
- if (settings.streaming) {
572
- requestEnhanceStream({ sessionId: wireId, text: source }, {
573
- signal: controller.signal,
574
- onDelta: (delta) => appendDelta(uiKey, delta)
575
- }).then(settle, fail);
576
- return;
577
- }
578
- requestEnhance({ sessionId: wireId, text: source }, controller.signal).then(settle, fail);
579
- }, [anyBusy, draft, occurrenceCount, phase, settings, uiKey, wireId, t]);
535
+ const start = (0, import_react2.useCallback)(
536
+ (overrideText) => {
537
+ const source = overrideText ?? draft;
538
+ if (anyBusy || source.trim() === "") return;
539
+ if (!settings.enabled) {
540
+ const disabled = t("error.disabled");
541
+ openError(uiKey, draft, { code: "rejected", localized: disabled });
542
+ return;
543
+ }
544
+ const check = checkInputText(source, settings.maxInputChars);
545
+ if (!check.ok) {
546
+ const message = check.code === "empty" ? t("error.empty") : t("error.tooLong", { count: check.count, max: check.max });
547
+ openError(uiKey, source, { code: "rejected", localized: message });
548
+ return;
549
+ }
550
+ if (occurrenceCount > 0) {
551
+ const occurrences = t("error.occurrences");
552
+ openError(uiKey, source, { code: "rejected", localized: occurrences });
553
+ return;
554
+ }
555
+ if (phase !== "plain") {
556
+ const busyPhase = t("error.phase");
557
+ openError(uiKey, source, { code: "rejected", localized: busyPhase });
558
+ return;
559
+ }
560
+ const controller = new AbortController();
561
+ openLoading({ sessionId: uiKey, original: source, abort: () => controller.abort() });
562
+ const settle = (result) => settleResult(uiKey, result);
563
+ const fail = (error) => {
564
+ const detail = error instanceof EnhanceClientError ? error.detail : { code: "internal", message: error instanceof Error ? error.message : String(error) };
565
+ settleError(uiKey, detail);
566
+ };
567
+ if (settings.streaming) {
568
+ requestEnhanceStream(
569
+ { sessionId: wireId, text: source },
570
+ {
571
+ signal: controller.signal,
572
+ onDelta: (delta) => appendDelta(uiKey, delta)
573
+ }
574
+ ).then(settle, fail);
575
+ return;
576
+ }
577
+ requestEnhance({ sessionId: wireId, text: source }, controller.signal).then(settle, fail);
578
+ },
579
+ [anyBusy, draft, occurrenceCount, phase, settings, uiKey, wireId, t]
580
+ );
580
581
  const runRef = (0, import_react2.useRef)(start);
581
582
  (0, import_react2.useEffect)(() => {
582
583
  runRef.current = start;
@@ -637,29 +638,16 @@ function icon(paths) {
637
638
  );
638
639
  }
639
640
  function RegenerateIcon() {
640
- return icon([
641
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 12a9 9 0 1 1-3-6.7L21 8" }, "arc"),
642
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 3v5h-5" }, "head")
643
- ]);
641
+ return icon([/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 12a9 9 0 1 1-3-6.7L21 8" }, "arc"), /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 3v5h-5" }, "head")]);
644
642
  }
645
643
  function CopyIcon() {
646
- return icon([
647
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }, "front"),
648
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, "back")
649
- ]);
644
+ return icon([/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }, "front"), /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, "back")]);
650
645
  }
651
646
  function FillIcon() {
652
- return icon([
653
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 3v12" }, "stem"),
654
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m7 10 5 5 5-5" }, "head"),
655
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5 21h14" }, "tray")
656
- ]);
647
+ return icon([/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 3v12" }, "stem"), /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m7 10 5 5 5-5" }, "head"), /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5 21h14" }, "tray")]);
657
648
  }
658
649
  function UndoIcon() {
659
- return icon([
660
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M9 14 4 9l5-5" }, "head"),
661
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 0 11H8" }, "curve")
662
- ]);
650
+ return icon([/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M9 14 4 9l5-5" }, "head"), /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 0 11H8" }, "curve")]);
663
651
  }
664
652
 
665
653
  // src/client/ResultPanel.tsx
@@ -675,6 +663,16 @@ var UPSTREAM_ERROR_KEYS = {
675
663
  "tool-call": "error.upstream.toolCall",
676
664
  "max-tokens": "error.upstream.maxTokens"
677
665
  };
666
+ var CLIENT_ERROR_KEYS = {
667
+ unreachable: "error.client.unreachable",
668
+ malformed: "error.client.malformed",
669
+ refused: "error.client.refused",
670
+ "stream-closed": "error.client.streamClosed",
671
+ cancelled: "error.client.cancelled"
672
+ };
673
+ function isClientFailureReason(value) {
674
+ return typeof value === "string" && Object.hasOwn(CLIENT_ERROR_KEYS, value);
675
+ }
678
676
  function localizedErrorMessage(t, code, params) {
679
677
  if (code === "rejected" && typeof params?.count === "number" && typeof params?.max === "number") {
680
678
  return t("error.tooLong", { count: params.count, max: params.max });
@@ -683,6 +681,9 @@ function localizedErrorMessage(t, code, params) {
683
681
  const specific = UPSTREAM_ERROR_KEYS[params.reason];
684
682
  if (specific !== void 0) return t(specific);
685
683
  }
684
+ if (code === "internal" && isClientFailureReason(params?.reason)) {
685
+ return t(CLIENT_ERROR_KEYS[params.reason], params);
686
+ }
686
687
  switch (code) {
687
688
  case "rejected":
688
689
  return t("error.rejected");
@@ -736,17 +737,17 @@ function ResultPanel(props) {
736
737
  if (ok) setTimeout(() => setCopied("idle"), 2500);
737
738
  };
738
739
  if (navigator.clipboard !== void 0) {
739
- navigator.clipboard.writeText(text).then(() => done(true), () => done(fallbackCopy(text)));
740
+ navigator.clipboard.writeText(text).then(
741
+ () => done(true),
742
+ () => done(fallbackCopy(text))
743
+ );
740
744
  return;
741
745
  }
742
746
  done(fallbackCopy(text));
743
747
  }, [state.result]);
744
748
  const formatMs = (ms) => ms < 1e3 ? `${ms}ms` : `${(ms / 1e3).toFixed(1)}s`;
745
749
  const tokenDetail = (usage) => {
746
- const parts = [
747
- t("panel.tokens.input", { count: formatTokens(usage.inputTokens) }),
748
- t("panel.tokens.output", { count: formatTokens(usage.outputTokens) })
749
- ];
750
+ const parts = [t("panel.tokens.input", { count: formatTokens(usage.inputTokens) }), t("panel.tokens.output", { count: formatTokens(usage.outputTokens) })];
750
751
  if ((usage.cacheReadTokens ?? 0) > 0) {
751
752
  parts.push(t("panel.tokens.cacheRead", { count: formatTokens(usage.cacheReadTokens ?? 0) }));
752
753
  }
@@ -837,7 +838,6 @@ function useDockAlignment(active) {
837
838
  const parent = root.parentElement;
838
839
  if (parent === null) return;
839
840
  root.style.transform = "";
840
- const previousMargin = parseFloat(root.style.marginLeft) || 0;
841
841
  const rootRect = root.getBoundingClientRect();
842
842
  const editors = Array.from(document.querySelectorAll('textarea, [contenteditable="true"], [role="textbox"]'));
843
843
  const editor = editors.find((node2) => {
@@ -910,8 +910,14 @@ function ResultDock(props) {
910
910
  return typeof value === "string" ? value : "";
911
911
  });
912
912
  const useSession = props.useSession;
913
- const sessionRunning = useSession === void 0 ? false : Boolean(useSession((state) => state.running));
914
- const sessionQueued = useSession === void 0 ? 0 : Number(useSession((state) => state.queue?.length ?? 0));
913
+ const sessionRunning = useSession === void 0 ? false : (
914
+ // eslint-disable-next-line react-hooks/rules-of-hooks
915
+ Boolean(useSession((state) => state.running))
916
+ );
917
+ const sessionQueued = useSession === void 0 ? 0 : (
918
+ // eslint-disable-next-line react-hooks/rules-of-hooks
919
+ Number(useSession((state) => state.queue?.length ?? 0))
920
+ );
915
921
  const entry = peekUndo(uiKey);
916
922
  const applied = entry !== void 0 && entry.applied === draft;
917
923
  const prevSession = (0, import_react5.useRef)({ running: sessionRunning, queued: sessionQueued });
@@ -1087,6 +1093,11 @@ var zh = {
1087
1093
  "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\u8DDF\u968F\u63D0\u4F9B\u65B9\u9ED8\u8BA4\u300D\u3002",
1088
1094
  "error.upstream": "\u6A21\u578B\u670D\u52A1\u8FD4\u56DE\u9519\u8BEF\uFF0C\u8BF7\u91CD\u8BD5\uFF1B\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002",
1089
1095
  "error.internal": "\u589E\u5F3A\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\uFF1B\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002",
1096
+ "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",
1097
+ "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",
1098
+ "error.client.refused": "\u5BBF\u4E3B\u670D\u52A1\u62D2\u7EDD\u4E86\u8BF7\u6C42\uFF08HTTP {status}\uFF09\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
1099
+ "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",
1100
+ "error.client.cancelled": "\u5DF2\u53D6\u6D88\u589E\u5F3A\uFF1B\u539F\u8F93\u5165\u672A\u6539\u52A8\u3002",
1090
1101
  "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",
1091
1102
  "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",
1092
1103
  "error.cooldown": "\u8FDE\u7EED {failures} \u6B21\u589E\u5F3A\u5931\u8D25\uFF0C\u5DF2\u6682\u505C\u8C03\u7528\u4EE5\u514D\u6301\u7EED\u51B2\u51FB\u6A21\u578B\u670D\u52A1\uFF1B\u8BF7 {retryAfterSeconds} \u79D2\u540E\u91CD\u8BD5\uFF0C\u6216\u5148\u68C0\u67E5\u8BBE\u7F6E\u91CC\u7684\u6A21\u578B\u914D\u7F6E\u3002",
@@ -1228,6 +1239,11 @@ var en = {
1228
1239
  "error.effortUnsupported": 'This model does not support the selected reasoning effort "{effort}". Choose another tier, or use "follow provider default".',
1229
1240
  "error.upstream": "The model provider returned an error. Retry; your draft is untouched.",
1230
1241
  "error.internal": "Enhancement failed. Retry; your draft is untouched.",
1242
+ "error.client.unreachable": "Cannot reach the host service \u2014 make sure dsh web is running, then retry.",
1243
+ "error.client.malformed": "The host returned data that could not be parsed. Retry; your draft is untouched.",
1244
+ "error.client.refused": "The host refused the request (HTTP {status}). Retry later.",
1245
+ "error.client.streamClosed": "The host closed the enhance stream early. Retry; your draft is untouched.",
1246
+ "error.client.cancelled": "The enhancement was cancelled; your draft is untouched.",
1231
1247
  "error.rateLimit": "Too many requests \u2014 at most {limit} enhancements per minute; retry in {retryAfterSeconds} seconds.",
1232
1248
  "error.concurrencyLimit": "{max} enhancements are already running \u2014 wait for one to finish, then retry.",
1233
1249
  "error.cooldown": "{failures} enhancements failed in a row; calls are paused to stop hammering the model service. Retry in {retryAfterSeconds}s, or check the model settings first.",
@@ -1797,21 +1813,27 @@ function installClientSettingsSource(ctx, options) {
1797
1813
  }
1798
1814
  };
1799
1815
  bind();
1800
- ctx.effect(() => () => {
1801
- try {
1802
- unsubscribeForm?.();
1803
- } catch {
1804
- }
1805
- }, "dsh-prompt-enhance: settings form mirror");
1816
+ ctx.effect(
1817
+ () => () => {
1818
+ try {
1819
+ unsubscribeForm?.();
1820
+ } catch {
1821
+ }
1822
+ },
1823
+ "dsh-prompt-enhance: settings form mirror"
1824
+ );
1806
1825
  try {
1807
1826
  const watch = forms.describe?.()?.subscribe?.(() => bind());
1808
1827
  if (typeof watch === "function") {
1809
- ctx.effect(() => () => {
1810
- try {
1811
- watch();
1812
- } catch {
1813
- }
1814
- }, "dsh-prompt-enhance: settings namespace watch");
1828
+ ctx.effect(
1829
+ () => () => {
1830
+ try {
1831
+ watch();
1832
+ } catch {
1833
+ }
1834
+ },
1835
+ "dsh-prompt-enhance: settings namespace watch"
1836
+ );
1815
1837
  }
1816
1838
  } catch {
1817
1839
  }
@@ -1836,12 +1858,15 @@ function installClientSettingsSource(ctx, options) {
1836
1858
  } catch {
1837
1859
  unsubscribe = void 0;
1838
1860
  }
1839
- ctx.effect(() => () => {
1840
- try {
1841
- unsubscribe?.();
1842
- } catch {
1843
- }
1844
- }, "dsh-prompt-enhance: settings binder mirror");
1861
+ ctx.effect(
1862
+ () => () => {
1863
+ try {
1864
+ unsubscribe?.();
1865
+ } catch {
1866
+ }
1867
+ },
1868
+ "dsh-prompt-enhance: settings binder mirror"
1869
+ );
1845
1870
  });
1846
1871
  ctx.inject(["settingsScope"], (scopeCtx) => {
1847
1872
  const scopeCtxLike = scopeCtx;
@@ -1860,88 +1885,20 @@ function installClientSettingsSource(ctx, options) {
1860
1885
  } catch {
1861
1886
  unsubscribe = void 0;
1862
1887
  }
1863
- ctx.effect(() => () => {
1864
- try {
1865
- unsubscribe?.();
1866
- } catch {
1867
- }
1868
- }, "dsh-prompt-enhance: settings scope mirror");
1888
+ ctx.effect(
1889
+ () => () => {
1890
+ try {
1891
+ unsubscribe?.();
1892
+ } catch {
1893
+ }
1894
+ },
1895
+ "dsh-prompt-enhance: settings scope mirror"
1896
+ );
1869
1897
  });
1870
1898
  }
1871
1899
 
1872
1900
  // src/client/settings-page.tsx
1873
- var import_react8 = require("react");
1874
-
1875
- // src/shared/defaults.ts
1876
- var DEFAULT_VALUES = {
1877
- enabled: true,
1878
- temperature: 0.3,
1879
- // A rewrite does not need deep reasoning, and the route default is expensive
1880
- // (measured: 2897 output tokens at `high` vs 252 at `off` for the same draft).
1881
- // Sent explicitly, because omitting the field inherits that route default.
1882
- reasoningEffort: "off",
1883
- maxOutputTokens: 8192,
1884
- maxInputChars: 12e3,
1885
- timeoutMs: 6e4,
1886
- systemPrompt: "",
1887
- strategyMode: "replace-default",
1888
- shortcut: "",
1889
- maxConcurrent: 2,
1890
- rateLimitPerMinute: 10,
1891
- streaming: true,
1892
- contextAware: true,
1893
- contextMaxMessages: 8,
1894
- contextMaxChars: 4e3
1895
- };
1896
-
1897
- // src/shared/reasoning.ts
1898
- var REASONING_EFFORTS_ENDPOINT = "/dsh-prompt-enhance/reasoning-efforts";
1899
-
1900
- // src/client/reasoning-options.ts
1901
- function effortOf(value) {
1902
- if (value === null || typeof value !== "object") return void 0;
1903
- const record = value;
1904
- if (typeof record.id !== "string" || record.id === "" || typeof record.name !== "string" || record.name === "") return void 0;
1905
- return {
1906
- id: record.id,
1907
- name: record.name,
1908
- ...typeof record.description === "string" && record.description !== "" ? { description: record.description } : {}
1909
- };
1910
- }
1911
- function capabilitiesOf(value) {
1912
- if (value === null || typeof value !== "object") return { efforts: [], source: "unavailable", reason: "resolve-failed" };
1913
- const record = value;
1914
- const source = record.source === "resolved" || record.source === "default" || record.source === "unavailable" ? record.source : "unavailable";
1915
- const efforts = Array.isArray(record.efforts) ? record.efforts.map(effortOf).filter((effort) => effort !== void 0) : [];
1916
- const reason = typeof record.reason === "string" ? record.reason : void 0;
1917
- if (source !== "unavailable" && efforts.length === 0) return { efforts: [], source: "unavailable", reason: "no-efforts" };
1918
- return {
1919
- efforts,
1920
- source,
1921
- ...typeof record.defaultEffort === "string" && record.defaultEffort !== "" ? { defaultEffort: record.defaultEffort } : {},
1922
- ...reason === void 0 ? {} : { reason }
1923
- };
1924
- }
1925
- async function fetchReasoningCapabilities(provider, model, options = {}) {
1926
- const url = new URL(REASONING_EFFORTS_ENDPOINT, globalThis.location?.origin ?? "http://127.0.0.1");
1927
- if (provider !== void 0 && model !== void 0) {
1928
- url.searchParams.set("provider", provider);
1929
- url.searchParams.set("model", model);
1930
- }
1931
- if (options.refresh === true) url.searchParams.set("refresh", "1");
1932
- try {
1933
- const response = await fetch(url, { signal: options.signal, headers: { accept: "application/json" } });
1934
- if (!response.ok) return { efforts: [], source: "unavailable", reason: "resolve-failed" };
1935
- const body = await response.json();
1936
- const envelope = body;
1937
- if (envelope === null || envelope === void 0 || envelope.ok !== true) {
1938
- return { efforts: [], source: "unavailable", reason: "resolve-failed" };
1939
- }
1940
- return capabilitiesOf(envelope.value);
1941
- } catch {
1942
- return { efforts: [], source: "unavailable", reason: "resolve-failed" };
1943
- }
1944
- }
1901
+ var import_react9 = require("react");
1945
1902
 
1946
1903
  // src/client/llm-catalog.ts
1947
1904
  var import_react7 = require("react");
@@ -1972,12 +1929,16 @@ function endpoint(path, params = {}) {
1972
1929
  async function fetchProviders(signal) {
1973
1930
  const value = await getJson(endpoint(LLM_PROVIDERS_ENDPOINT), signal);
1974
1931
  if (value === void 0 || !Array.isArray(value.providers)) return void 0;
1975
- return value.providers.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.id === "string" && entry.id !== "" && typeof entry.name === "string" && entry.name !== "" && typeof entry.registered === "boolean");
1932
+ return value.providers.filter(
1933
+ (entry) => entry !== null && typeof entry === "object" && typeof entry.id === "string" && entry.id !== "" && typeof entry.name === "string" && entry.name !== "" && typeof entry.registered === "boolean"
1934
+ );
1976
1935
  }
1977
1936
  async function fetchModels(provider, signal) {
1978
1937
  const value = await getJson(endpoint(LLM_MODELS_ENDPOINT, { provider }), signal);
1979
1938
  if (value === void 0 || !Array.isArray(value.models)) return void 0;
1980
- const models = value.models.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.id === "string" && entry.id !== "" && typeof entry.name === "string" && entry.name !== "").map((entry) => ({
1939
+ const models = value.models.filter(
1940
+ (entry) => entry !== null && typeof entry === "object" && typeof entry.id === "string" && entry.id !== "" && typeof entry.name === "string" && entry.name !== ""
1941
+ ).map((entry) => ({
1981
1942
  id: entry.id,
1982
1943
  name: entry.name,
1983
1944
  ...typeof entry.description === "string" && entry.description !== "" ? { description: entry.description } : {}
@@ -2077,21 +2038,12 @@ function useLlmRouting(provider, model) {
2077
2038
  };
2078
2039
  }
2079
2040
 
2080
- // src/client/settings-page.tsx
2041
+ // src/client/settings-page-spec.ts
2081
2042
  var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
2082
- var import_jsx_runtime7 = require("react/jsx-runtime");
2083
2043
  var SETTINGS_SECTION_SLOT = "settings.section";
2084
2044
  var SETTINGS_SECTION_ID = "dsh-prompt-enhance";
2085
2045
  var SETTINGS_SECTION_ORDER = 70;
2086
2046
  var SETTINGS_SECTION_LABEL = "\u63D0\u793A\u8BCD\u589E\u5F3A";
2087
- function sectionTitle(getLocale) {
2088
- try {
2089
- const t = getLocale?.()?.bind(NS);
2090
- return t === void 0 ? SETTINGS_SECTION_LABEL : t("settings.title");
2091
- } catch {
2092
- return SETTINGS_SECTION_LABEL;
2093
- }
2094
- }
2095
2047
  var SETTINGS_ROW_CONFIG_SLOT = "plugins.row.config";
2096
2048
  var SETTINGS_NAMESPACE = "dsh-prompt-enhance";
2097
2049
  var SETTINGS_BUNDLE = "@surfishs/dsh-prompt-enhance";
@@ -2154,7 +2106,10 @@ function descriptorOf(row) {
2154
2106
  case "boolean":
2155
2107
  return settingsBooleanField(row.key);
2156
2108
  case "strategy":
2157
- return settingsEnumField(row.key, STRATEGY_OPTIONS.map((option) => option.value));
2109
+ return settingsEnumField(
2110
+ row.key,
2111
+ STRATEGY_OPTIONS.map((option) => option.value)
2112
+ );
2158
2113
  case "reasoning":
2159
2114
  return (0, import_dsh_client_ui_primitives.settingsTextField)(row.key);
2160
2115
  default:
@@ -2165,6 +2120,38 @@ var FIELD_SPECS = ROWS.map((row) => descriptorOf(row));
2165
2120
  function createSettingsForm(scope) {
2166
2121
  return new import_dsh_client_ui_primitives.SettingsFormModel(scope, FIELD_SPECS);
2167
2122
  }
2123
+ function viewOf(snapshot, key) {
2124
+ const value = snapshot[key];
2125
+ if (value === null || typeof value !== "object") return { text: "", overridden: false, invalid: false };
2126
+ const field = value;
2127
+ return {
2128
+ text: typeof field.text === "string" ? field.text : "",
2129
+ overridden: field.overridden === true,
2130
+ invalid: field.invalid === true
2131
+ };
2132
+ }
2133
+ function defaultTextOf(key) {
2134
+ const descriptor = FIELD_SPECS.find((item) => item.field === key);
2135
+ const fallback = DEFAULT_VALUES[key];
2136
+ if (descriptor === void 0 || fallback === void 0) return "";
2137
+ try {
2138
+ return descriptor.format(fallback);
2139
+ } catch {
2140
+ return "";
2141
+ }
2142
+ }
2143
+ function atDefaultValue(key, text) {
2144
+ const fallback = DEFAULT_VALUES[key];
2145
+ if (fallback === void 0) return text.trim() === "";
2146
+ if (typeof fallback === "boolean") return text.trim() === String(fallback);
2147
+ if (typeof fallback === "number") {
2148
+ const parsed = Number(text.trim());
2149
+ return Number.isFinite(parsed) && parsed === fallback;
2150
+ }
2151
+ return text.trim() === String(fallback);
2152
+ }
2153
+
2154
+ // src/client/settings-page-copy.ts
2168
2155
  var ZH_COPY = zh;
2169
2156
  function translator(t) {
2170
2157
  if (typeof t === "function") return t;
@@ -2218,6 +2205,61 @@ function pageCopy(t) {
2218
2205
  interpolate: (key, params) => t(key, params)
2219
2206
  };
2220
2207
  }
2208
+
2209
+ // src/client/settings-page-controls.tsx
2210
+ var import_react8 = require("react");
2211
+ var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
2212
+
2213
+ // src/shared/reasoning.ts
2214
+ var REASONING_EFFORTS_ENDPOINT = "/dsh-prompt-enhance/reasoning-efforts";
2215
+
2216
+ // src/client/reasoning-options.ts
2217
+ function effortOf(value) {
2218
+ if (value === null || typeof value !== "object") return void 0;
2219
+ const record = value;
2220
+ if (typeof record.id !== "string" || record.id === "" || typeof record.name !== "string" || record.name === "") return void 0;
2221
+ return {
2222
+ id: record.id,
2223
+ name: record.name,
2224
+ ...typeof record.description === "string" && record.description !== "" ? { description: record.description } : {}
2225
+ };
2226
+ }
2227
+ function capabilitiesOf(value) {
2228
+ if (value === null || typeof value !== "object") return { efforts: [], source: "unavailable", reason: "resolve-failed" };
2229
+ const record = value;
2230
+ const source = record.source === "resolved" || record.source === "default" || record.source === "unavailable" ? record.source : "unavailable";
2231
+ const efforts = Array.isArray(record.efforts) ? record.efforts.map(effortOf).filter((effort) => effort !== void 0) : [];
2232
+ const reason = typeof record.reason === "string" ? record.reason : void 0;
2233
+ if (source !== "unavailable" && efforts.length === 0) return { efforts: [], source: "unavailable", reason: "no-efforts" };
2234
+ return {
2235
+ efforts,
2236
+ source,
2237
+ ...typeof record.defaultEffort === "string" && record.defaultEffort !== "" ? { defaultEffort: record.defaultEffort } : {},
2238
+ ...reason === void 0 ? {} : { reason }
2239
+ };
2240
+ }
2241
+ async function fetchReasoningCapabilities(provider, model, options = {}) {
2242
+ const url = new URL(REASONING_EFFORTS_ENDPOINT, globalThis.location?.origin ?? "http://127.0.0.1");
2243
+ if (provider !== void 0 && model !== void 0) {
2244
+ url.searchParams.set("provider", provider);
2245
+ url.searchParams.set("model", model);
2246
+ }
2247
+ if (options.refresh === true) url.searchParams.set("refresh", "1");
2248
+ try {
2249
+ const response = await fetch(url, { signal: options.signal, headers: { accept: "application/json" } });
2250
+ if (!response.ok) return { efforts: [], source: "unavailable", reason: "resolve-failed" };
2251
+ const body = await response.json();
2252
+ const envelope = body;
2253
+ if (envelope === null || envelope === void 0 || envelope.ok !== true) {
2254
+ return { efforts: [], source: "unavailable", reason: "resolve-failed" };
2255
+ }
2256
+ return capabilitiesOf(envelope.value);
2257
+ } catch {
2258
+ return { efforts: [], source: "unavailable", reason: "resolve-failed" };
2259
+ }
2260
+ }
2261
+
2262
+ // src/client/settings-page-styles.ts
2221
2263
  var ROW_STYLE = { display: "flex", flexDirection: "column", gap: 6, padding: "12px 0" };
2222
2264
  var HEAD_STYLE = { display: "flex", alignItems: "center", gap: 8 };
2223
2265
  var LABEL_STYLE = {
@@ -2296,7 +2338,7 @@ var REPOSITORY_URL = "https://github.com/surfishs/dsh-prompt-enhance";
2296
2338
  var NPM_URL = "https://www.npmjs.com/package/@surfishs/dsh-prompt-enhance";
2297
2339
  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";
2298
2340
  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";
2299
- var PLUGIN_VERSION = true ? "0.0.7" : "0.0.0";
2341
+ var PLUGIN_VERSION = true ? "0.0.8" : "0.0.0";
2300
2342
  var HEADER_STYLE = { display: "flex", flexDirection: "column", gap: 12, padding: "2px 0" };
2301
2343
  var HEADER_ROW_STYLE = { display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" };
2302
2344
  var HEADER_TITLE_STYLE = {
@@ -2341,83 +2383,18 @@ var HEADER_DESCRIPTION_STYLE = {
2341
2383
  textWrap: "pretty",
2342
2384
  maxWidth: "72ch"
2343
2385
  };
2344
- function PageHeader(props) {
2345
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: HEADER_STYLE, children: [
2346
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: HEADER_ROW_STYLE, children: [
2347
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: HEADER_TITLE_STYLE, children: props.title }),
2348
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("a", { href: REPOSITORY_URL, target: "_blank", rel: "noreferrer", style: HEADER_LINK_STYLE, children: [
2349
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { width: 11, height: 11, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { fill: "currentColor", d: GITHUB_MARK }) }),
2350
- "GitHub"
2351
- ] }),
2352
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("a", { href: NPM_URL, target: "_blank", rel: "noreferrer", style: HEADER_LINK_STYLE, children: [
2353
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { width: 11, height: 11, viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { fill: "currentColor", d: NPM_MARK }) }),
2354
- "npm"
2355
- ] }),
2356
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { style: HEADER_VERSION_STYLE, children: [
2357
- "v",
2358
- props.version
2359
- ] })
2360
- ] }),
2361
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: HEADER_DESCRIPTION_STYLE, children: props.description })
2362
- ] });
2363
- }
2364
- function viewOf(snapshot, key) {
2365
- const value = snapshot[key];
2366
- if (value === null || typeof value !== "object") return { text: "", overridden: false, invalid: false };
2367
- const field = value;
2368
- return {
2369
- text: typeof field.text === "string" ? field.text : "",
2370
- overridden: field.overridden === true,
2371
- invalid: field.invalid === true
2372
- };
2373
- }
2374
- function defaultTextOf(key) {
2375
- const descriptor = FIELD_SPECS.find((item) => item.field === key);
2376
- const fallback = DEFAULT_VALUES[key];
2377
- if (descriptor === void 0 || fallback === void 0) return "";
2378
- try {
2379
- return descriptor.format(fallback);
2380
- } catch {
2381
- return "";
2382
- }
2383
- }
2384
- function atDefaultValue(key, text) {
2385
- const fallback = DEFAULT_VALUES[key];
2386
- if (fallback === void 0) return text.trim() === "";
2387
- if (typeof fallback === "boolean") return text.trim() === String(fallback);
2388
- if (typeof fallback === "number") {
2389
- const parsed = Number(text.trim());
2390
- return Number.isFinite(parsed) && parsed === fallback;
2391
- }
2392
- return text.trim() === String(fallback);
2393
- }
2386
+
2387
+ // src/client/settings-page-controls.tsx
2388
+ var import_jsx_runtime7 = require("react/jsx-runtime");
2394
2389
  function OverrideActions(props) {
2395
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2396
- "button",
2397
- {
2398
- type: "button",
2399
- className: "dsh-pe-chip-reset",
2400
- style: { ...RESET_STYLE, ...props.disabled ? { opacity: 0.5, cursor: "default" } : {} },
2401
- disabled: props.disabled,
2402
- onClick: props.onReset,
2403
- children: props.copy.labels.reset
2404
- }
2405
- );
2390
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "dsh-pe-chip-reset", style: { ...RESET_STYLE, ...props.disabled ? { opacity: 0.5, cursor: "default" } : {} }, disabled: props.disabled, onClick: props.onReset, children: props.copy.labels.reset });
2406
2391
  }
2407
2392
  function BooleanRow(props) {
2408
2393
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: ROW_STYLE, children: [
2409
2394
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: HEAD_STYLE, children: [
2410
2395
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: LABEL_STYLE, children: props.label }),
2411
2396
  props.view.overridden ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OverrideActions, { copy: props.copy, disabled: props.disabled, onReset: props.onReset }) : null,
2412
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2413
- import_dsh_client_ui_primitives.Switch,
2414
- {
2415
- checked: props.view.text === "true",
2416
- disabled: props.disabled,
2417
- label: props.label,
2418
- onChange: (next) => props.onEdit(next ? "true" : "false")
2419
- }
2420
- )
2397
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives2.Switch, { checked: props.view.text === "true", disabled: props.disabled, label: props.label, onChange: (next) => props.onEdit(next ? "true" : "false") })
2421
2398
  ] }),
2422
2399
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: HINT_STYLE, children: props.hint })
2423
2400
  ] });
@@ -2429,7 +2406,7 @@ function ChoiceRow(props) {
2429
2406
  props.view.overridden ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OverrideActions, { copy: props.copy, disabled: props.disabled, onReset: props.onReset }) : null
2430
2407
  ] }),
2431
2408
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2432
- import_dsh_client_ui_primitives.SegmentedControl,
2409
+ import_dsh_client_ui_primitives2.SegmentedControl,
2433
2410
  {
2434
2411
  id: props.id,
2435
2412
  className: "dsh-pe-segmented-labels",
@@ -2470,11 +2447,7 @@ function ReasoningRow(props) {
2470
2447
  feedbackTimer.current = void 0;
2471
2448
  }, 3e3);
2472
2449
  };
2473
- fetchReasoningCapabilities(
2474
- props.provider === "" ? void 0 : props.provider,
2475
- props.model === "" ? void 0 : props.model,
2476
- { refresh: force, signal: controller.signal }
2477
- ).then((answer) => {
2450
+ fetchReasoningCapabilities(props.provider === "" ? void 0 : props.provider, props.model === "" ? void 0 : props.model, { refresh: force, signal: controller.signal }).then((answer) => {
2478
2451
  if (controller.signal.aborted) return;
2479
2452
  setCapabilities(answer);
2480
2453
  setPhase("ready");
@@ -2527,21 +2500,11 @@ function ReasoningRow(props) {
2527
2500
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: ROW_STYLE, children: [
2528
2501
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: HEAD_STYLE, children: [
2529
2502
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: LABEL_STYLE, children: props.label }),
2530
- phase === "ready" || refreshing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2531
- "button",
2532
- {
2533
- type: "button",
2534
- className: "dsh-pe-chip-refresh",
2535
- style: { ...REFRESH_STYLE, opacity: props.disabled || refreshing ? 0.5 : 1 },
2536
- disabled: props.disabled || refreshing,
2537
- onClick: refresh,
2538
- children: props.copy.choice(refreshing ? "settings.reasoning.refreshing" : "settings.reasoning.refresh")
2539
- }
2540
- ) : null,
2503
+ phase === "ready" || refreshing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "dsh-pe-chip-refresh", style: { ...REFRESH_STYLE, opacity: props.disabled || refreshing ? 0.5 : 1 }, disabled: props.disabled || refreshing, onClick: refresh, children: props.copy.choice(refreshing ? "settings.reasoning.refreshing" : "settings.reasoning.refresh") }) : null,
2541
2504
  props.view.overridden ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OverrideActions, { copy: props.copy, disabled: props.disabled, onReset: props.onReset }) : null
2542
2505
  ] }),
2543
2506
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2544
- import_dsh_client_ui_primitives.SegmentedControl,
2507
+ import_dsh_client_ui_primitives2.SegmentedControl,
2545
2508
  {
2546
2509
  id: props.id,
2547
2510
  className: "dsh-pe-segmented-labels",
@@ -2638,15 +2601,7 @@ function ModelRow(props) {
2638
2601
  ]
2639
2602
  }
2640
2603
  ),
2641
- showCustom ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2642
- TextControl,
2643
- {
2644
- value: current2,
2645
- placeholder: props.copy.choice("settings.routing.customPlaceholder"),
2646
- disabled: props.disabled,
2647
- onChange: props.onEdit
2648
- }
2649
- ) : null,
2604
+ showCustom ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TextControl, { value: current2, placeholder: props.copy.choice("settings.routing.customPlaceholder"), disabled: props.disabled, onChange: props.onEdit }) : null,
2650
2605
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: HINT_STYLE, children: props.hint }),
2651
2606
  props.routing.models.loading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: STATUS_STYLE, children: props.copy.choice("settings.routing.modelsLoading") }) : null,
2652
2607
  props.routing.models.failed && !showCustom ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: STATUS_STYLE, children: props.copy.choice("settings.routing.modelsFailed") }) : null,
@@ -2717,6 +2672,37 @@ function ValueRow(props) {
2717
2672
  invalid ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: INVALID_STYLE, children: props.copy.labels.invalidNumber }) : null
2718
2673
  ] });
2719
2674
  }
2675
+
2676
+ // src/client/settings-page.tsx
2677
+ var import_jsx_runtime8 = require("react/jsx-runtime");
2678
+ function sectionTitle(getLocale) {
2679
+ try {
2680
+ const t = getLocale?.()?.bind(NS);
2681
+ return t === void 0 ? SETTINGS_SECTION_LABEL : t("settings.title");
2682
+ } catch {
2683
+ return SETTINGS_SECTION_LABEL;
2684
+ }
2685
+ }
2686
+ function PageHeader(props) {
2687
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: HEADER_STYLE, children: [
2688
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: HEADER_ROW_STYLE, children: [
2689
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: HEADER_TITLE_STYLE, children: props.title }),
2690
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("a", { href: REPOSITORY_URL, target: "_blank", rel: "noreferrer", style: HEADER_LINK_STYLE, children: [
2691
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: 11, height: 11, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { fill: "currentColor", d: GITHUB_MARK }) }),
2692
+ "GitHub"
2693
+ ] }),
2694
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("a", { href: NPM_URL, target: "_blank", rel: "noreferrer", style: HEADER_LINK_STYLE, children: [
2695
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: 11, height: 11, viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { fill: "currentColor", d: NPM_MARK }) }),
2696
+ "npm"
2697
+ ] }),
2698
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { style: HEADER_VERSION_STYLE, children: [
2699
+ "v",
2700
+ props.version
2701
+ ] })
2702
+ ] }),
2703
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { style: HEADER_DESCRIPTION_STYLE, children: props.description })
2704
+ ] });
2705
+ }
2720
2706
  function SettingsRow(props) {
2721
2707
  const shared = {
2722
2708
  id: `dsh-prompt-enhance-${props.row.key}`,
@@ -2731,29 +2717,29 @@ function SettingsRow(props) {
2731
2717
  };
2732
2718
  switch (props.row.kind) {
2733
2719
  case "boolean":
2734
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BooleanRow, { ...shared });
2720
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BooleanRow, { ...shared });
2735
2721
  case "strategy":
2736
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChoiceRow, { ...shared, options: STRATEGY_OPTIONS.map((option) => ({ value: option.value, label: props.copy.choice(option.label) })) });
2722
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChoiceRow, { ...shared, options: STRATEGY_OPTIONS.map((option) => ({ value: option.value, label: props.copy.choice(option.label) })) });
2737
2723
  case "reasoning":
2738
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ReasoningRow, { ...shared, provider: props.reasoningPair.provider, model: props.reasoningPair.model });
2724
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ReasoningRow, { ...shared, provider: props.reasoningPair.provider, model: props.reasoningPair.model });
2739
2725
  case "provider":
2740
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ProviderRow, { ...shared, routing: props.routing });
2726
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ProviderRow, { ...shared, routing: props.routing });
2741
2727
  case "model":
2742
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ModelRow, { ...shared, routing: props.routing, providerValue: props.providerValue });
2728
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ModelRow, { ...shared, routing: props.routing, providerValue: props.providerValue });
2743
2729
  default:
2744
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ValueRow, { ...shared, numeric: props.row.kind === "number", placeholder: props.copy.placeholder(props.row) });
2730
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ValueRow, { ...shared, numeric: props.row.kind === "number", placeholder: props.copy.placeholder(props.row) });
2745
2731
  }
2746
2732
  }
2747
2733
  function SettingsRows(props) {
2748
2734
  const provider = viewOf(props.state, "provider").text.trim();
2749
2735
  const model = viewOf(props.state, "model").text.trim();
2750
2736
  const routing = useLlmRouting(provider, model);
2751
- const [saveState, setSaveState] = (0, import_react8.useState)("idle");
2752
- const timers = (0, import_react8.useRef)(/* @__PURE__ */ new Map());
2753
- const savedTimer = (0, import_react8.useRef)(void 0);
2754
- const savedValues = (0, import_react8.useRef)(/* @__PURE__ */ new Map());
2755
- const sequence = (0, import_react8.useRef)(0);
2756
- (0, import_react8.useEffect)(() => {
2737
+ const [saveState, setSaveState] = (0, import_react9.useState)("idle");
2738
+ const timers = (0, import_react9.useRef)(/* @__PURE__ */ new Map());
2739
+ const savedTimer = (0, import_react9.useRef)(void 0);
2740
+ const savedValues = (0, import_react9.useRef)(/* @__PURE__ */ new Map());
2741
+ const sequence = (0, import_react9.useRef)(0);
2742
+ (0, import_react9.useEffect)(() => {
2757
2743
  for (const row of ROWS) {
2758
2744
  if (!savedValues.current.has(row.key)) {
2759
2745
  savedValues.current.set(row.key, viewOf(props.state, row.key).text);
@@ -2863,16 +2849,19 @@ function SettingsRows(props) {
2863
2849
  }
2864
2850
  void runSave(key, text ?? viewOf(props.state, key).text);
2865
2851
  };
2866
- (0, import_react8.useEffect)(() => () => {
2867
- for (const timer of timers.current.values()) clearTimeout(timer);
2868
- timers.current.clear();
2869
- if (savedTimer.current !== void 0) clearTimeout(savedTimer.current);
2870
- }, []);
2852
+ (0, import_react9.useEffect)(
2853
+ () => () => {
2854
+ for (const timer of timers.current.values()) clearTimeout(timer);
2855
+ timers.current.clear();
2856
+ if (savedTimer.current !== void 0) clearTimeout(savedTimer.current);
2857
+ },
2858
+ []
2859
+ );
2871
2860
  const statusText = props.state.writable === false ? props.copy.labels.readOnly : saveState === "saving" ? props.copy.labels.saving : saveState === "saved" ? props.copy.labels.saved : saveState === "failed" ? props.copy.labels.saveFailedShort : "";
2872
2861
  const renderRow = (row, index) => {
2873
2862
  const raw = viewOf(props.state, row.key);
2874
2863
  const view = raw.overridden && atDefaultValue(row.key, raw.text) ? { ...raw, overridden: false } : raw;
2875
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: index === 0 ? void 0 : SEPARATOR_STYLE, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2864
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: index === 0 ? void 0 : SEPARATOR_STYLE, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2876
2865
  SettingsRow,
2877
2866
  {
2878
2867
  row,
@@ -2888,15 +2877,15 @@ function SettingsRows(props) {
2888
2877
  }
2889
2878
  ) }, row.key);
2890
2879
  };
2891
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsh-pe-form", children: [
2880
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "dsh-pe-form", children: [
2892
2881
  BASIC_ROWS.map(renderRow),
2893
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { className: "dsh-pe-advanced", children: [
2894
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("summary", { children: props.copy.labels.advanced }),
2882
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("details", { className: "dsh-pe-advanced", children: [
2883
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("summary", { children: props.copy.labels.advanced }),
2895
2884
  ADVANCED_ROWS.map(renderRow)
2896
2885
  ] }),
2897
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "dsh-pe-form-footer", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsh-pe-save-group", children: [
2898
- statusText === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "dsh-pe-save-status", role: "status", "aria-live": "polite", children: statusText }),
2899
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2886
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "dsh-pe-form-footer", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "dsh-pe-save-group", children: [
2887
+ statusText === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "dsh-pe-save-status", role: "status", "aria-live": "polite", children: statusText }),
2888
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2900
2889
  "button",
2901
2890
  {
2902
2891
  type: "button",
@@ -2919,26 +2908,15 @@ function SettingsSection(props) {
2919
2908
  const t = translator(props.translate);
2920
2909
  const chinese = (locale?.active ?? "zh").toLowerCase().startsWith("zh");
2921
2910
  if (state === void 0) {
2922
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: { margin: 0, fontSize: 12, lineHeight: 1.6 }, children: t("settings.disconnected") });
2911
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { style: { margin: 0, fontSize: 12, lineHeight: 1.6 }, children: t("settings.disconnected") });
2923
2912
  }
2924
2913
  const edit = props.edit ?? (() => {
2925
2914
  });
2926
2915
  const resetField = props.resetField ?? (() => {
2927
2916
  });
2928
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
2929
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageHeader, { title: t("settings.title"), description: t("settings.description"), version: PLUGIN_VERSION }),
2930
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2931
- SettingsRows,
2932
- {
2933
- copy: sectionCopy(t, chinese),
2934
- state,
2935
- edit,
2936
- resetField,
2937
- save: props.save,
2938
- discard: props.discard,
2939
- writeField: props.writeField
2940
- }
2941
- )
2917
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
2918
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PageHeader, { title: t("settings.title"), description: t("settings.description"), version: PLUGIN_VERSION }),
2919
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SettingsRows, { copy: sectionCopy(t, chinese), state, edit, resetField, save: props.save, discard: props.discard, writeField: props.writeField })
2942
2920
  ] });
2943
2921
  }
2944
2922
  function SettingsPage(props) {
@@ -2947,24 +2925,13 @@ function SettingsPage(props) {
2947
2925
  const state = read === void 0 ? void 0 : read((snapshot) => snapshot);
2948
2926
  if (props.view === "summary") return t("settings.summary");
2949
2927
  if (state === void 0) {
2950
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: { margin: 0, fontSize: 12, lineHeight: 1.6 }, children: t("settings.disconnected") });
2928
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { style: { margin: 0, fontSize: 12, lineHeight: 1.6 }, children: t("settings.disconnected") });
2951
2929
  }
2952
2930
  const edit = props.edit ?? (() => {
2953
2931
  });
2954
2932
  const resetField = props.resetField ?? (() => {
2955
2933
  });
2956
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2957
- SettingsRows,
2958
- {
2959
- copy: pageCopy(t),
2960
- state,
2961
- edit,
2962
- resetField,
2963
- save: props.save,
2964
- discard: props.discard,
2965
- writeField: props.writeField
2966
- }
2967
- );
2934
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SettingsRows, { copy: pageCopy(t), state, edit, resetField, save: props.save, discard: props.discard, writeField: props.writeField });
2968
2935
  }
2969
2936
  var SettingsPageController = class {
2970
2937
  /**
@@ -3126,10 +3093,7 @@ function apply(ctx) {
3126
3093
  if (slots === void 0) return;
3127
3094
  return slots.inject("conversation.input.right", () => {
3128
3095
  try {
3129
- return slots.register(
3130
- { name: "conversation.input.right", id: "dsh-prompt-enhance", order: 60, locale: NS },
3131
- EnhanceButton
3132
- );
3096
+ return slots.register({ name: "conversation.input.right", id: "dsh-prompt-enhance", order: 60, locale: NS }, EnhanceButton);
3133
3097
  } catch (error) {
3134
3098
  return report("composer enhance button slot", error);
3135
3099
  }
@@ -3140,10 +3104,7 @@ function apply(ctx) {
3140
3104
  if (slots === void 0) return;
3141
3105
  return slots.inject("conversation.input.dock", () => {
3142
3106
  try {
3143
- return slots.register(
3144
- { name: "conversation.input.dock", id: "dsh-prompt-enhance-result", order: 30, locale: NS },
3145
- ResultDock
3146
- );
3107
+ return slots.register({ name: "conversation.input.dock", id: "dsh-prompt-enhance-result", order: 30, locale: NS }, ResultDock);
3147
3108
  } catch (error) {
3148
3109
  return report("result dock slot", error);
3149
3110
  }
@@ -3154,10 +3115,7 @@ function apply(ctx) {
3154
3115
  if (slots === void 0) return;
3155
3116
  return slots.inject("conversation.input.dock", () => {
3156
3117
  try {
3157
- return slots.register(
3158
- { name: "conversation.input.dock", id: "dsh-prompt-enhance-undo", order: 90, locale: NS },
3159
- UndoBar
3160
- );
3118
+ return slots.register({ name: "conversation.input.dock", id: "dsh-prompt-enhance-undo", order: 90, locale: NS }, UndoBar);
3161
3119
  } catch (error) {
3162
3120
  return report("undo bar slot", error);
3163
3121
  }