@surfishs/dsh-prompt-enhance 0.0.7 → 0.0.9

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 (57) hide show
  1. package/README.en.md +24 -18
  2. package/README.md +24 -18
  3. package/cordis.patch.yml +1 -1
  4. package/icon.svg +14 -0
  5. package/lib/client.js +343 -383
  6. package/lib/index.js +67 -56
  7. package/lib/index.js.map +3 -3
  8. package/package.json +26 -16
  9. package/src/client/ActionIcons.tsx +4 -17
  10. package/src/client/EnhanceButton.tsx +52 -48
  11. package/src/client/ResultDock.tsx +22 -9
  12. package/src/client/ResultPanel.tsx +83 -52
  13. package/src/client/SparkleFishIcon.tsx +25 -20
  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
  57. package/src/client/SparkleIcon.tsx +0 -33
package/lib/index.js CHANGED
@@ -82,6 +82,18 @@ var DEFAULT_VALUES = {
82
82
  contextMaxChars: 4e3
83
83
  };
84
84
 
85
+ // src/shared/limits.ts
86
+ var TEMPERATURE = { min: 0, max: 1, step: 0.05 };
87
+ var FIELD_LIMITS = {
88
+ maxOutputTokens: { min: 256, max: 32768 },
89
+ maxInputChars: { min: 200, max: 2e5 },
90
+ timeoutMs: { min: 5e3, max: 6e5 },
91
+ maxConcurrent: { min: 1, max: 16 },
92
+ rateLimitPerMinute: { min: 1, max: 600 },
93
+ contextMaxMessages: { min: 0, max: 50 },
94
+ contextMaxChars: { min: 0, max: 1e5 }
95
+ };
96
+
85
97
  // src/config.ts
86
98
  var PROMPT_ENHANCE_NAMESPACE = "dsh-prompt-enhance";
87
99
  var DEFAULT_CONFIG = { ...DEFAULT_VALUES };
@@ -89,20 +101,20 @@ var Config = z.object({
89
101
  enabled: z.boolean().default(DEFAULT_CONFIG.enabled).description("\u603B\u5F00\u5173\uFF1A\u5173\u95ED\u540E\u9690\u85CF\u8F93\u5165\u6846\u589E\u5F3A\u6309\u94AE\u5E76\u505C\u7528\u6240\u6709\u89E6\u53D1\u65B9\u5F0F").volatile(),
90
102
  provider: z.string().description("\u8986\u76D6\u6A21\u578B\u8DEF\u7531\u7684 provider\uFF08\u4E0E\u300C\u6A21\u578B\u300D\u5FC5\u987B\u6210\u5BF9\u586B\u5199\uFF1B\u7559\u7A7A\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u6A21\u578B\uFF09").volatile(),
91
103
  model: z.string().description("\u8986\u76D6\u6A21\u578B\u8DEF\u7531\u7684 model\uFF08\u4E0E\u300Cprovider\u300D\u5FC5\u987B\u6210\u5BF9\u586B\u5199\uFF1B\u7559\u7A7A\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u6A21\u578B\uFF09").volatile(),
92
- temperature: z.number().min(0).max(1).step(0.05).default(DEFAULT_CONFIG.temperature).description("\u91C7\u6837\u6E29\u5EA6\uFF1B\u4F4E\u6E29\u6539\u5199\u66F4\u5FE0\u5B9E\u4E8E\u539F\u610F").volatile(),
104
+ temperature: z.number().min(TEMPERATURE.min).max(TEMPERATURE.max).step(TEMPERATURE.step).default(DEFAULT_CONFIG.temperature).description("\u91C7\u6837\u6E29\u5EA6\uFF1B\u4F4E\u6E29\u6539\u5199\u66F4\u5FE0\u5B9E\u4E8E\u539F\u610F").volatile(),
93
105
  reasoningEffort: z.string().default(DEFAULT_CONFIG.reasoningEffort).description("\u63A8\u7406\u6863\u4F4D\uFF1A\u586B\u5199\u5F53\u524D provider/model \u58F0\u660E\u7684\u6863\u4F4D id\uFF08\u5982 DeepSeek \u7684 off/low/high/max\uFF09\uFF1Binherit \u8868\u793A\u4E0D\u4F20\u8BE5\u5B57\u6BB5\u3001\u8DDF\u968F\u63D0\u4F9B\u65B9\u9ED8\u8BA4\u6863").volatile(),
94
- maxOutputTokens: z.number().step(1).min(256).max(32768).default(DEFAULT_CONFIG.maxOutputTokens).description("\u5355\u6B21\u589E\u5F3A\u7684\u8F93\u51FA token \u4E0A\u9650").volatile(),
95
- maxInputChars: z.number().step(1).min(200).max(2e5).default(DEFAULT_CONFIG.maxInputChars).description("\u8F93\u5165\u5B57\u6570\u4E0A\u9650\uFF1B\u8D85\u9650\u62D2\u7EDD\u800C\u4E0D\u622A\u65AD\uFF0C\u907F\u514D\u6539\u53D8\u539F\u610F").volatile(),
96
- timeoutMs: z.number().step(1).min(5e3).max(6e5).default(DEFAULT_CONFIG.timeoutMs).description("\u5355\u6B21\u589E\u5F3A\u7684\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09").volatile(),
106
+ maxOutputTokens: z.number().step(1).min(FIELD_LIMITS.maxOutputTokens.min).max(FIELD_LIMITS.maxOutputTokens.max).default(DEFAULT_CONFIG.maxOutputTokens).description("\u5355\u6B21\u589E\u5F3A\u7684\u8F93\u51FA token \u4E0A\u9650").volatile(),
107
+ maxInputChars: z.number().step(1).min(FIELD_LIMITS.maxInputChars.min).max(FIELD_LIMITS.maxInputChars.max).default(DEFAULT_CONFIG.maxInputChars).description("\u8F93\u5165\u5B57\u6570\u4E0A\u9650\uFF1B\u8D85\u9650\u62D2\u7EDD\u800C\u4E0D\u622A\u65AD\uFF0C\u907F\u514D\u6539\u53D8\u539F\u610F").volatile(),
108
+ timeoutMs: z.number().step(1).min(FIELD_LIMITS.timeoutMs.min).max(FIELD_LIMITS.timeoutMs.max).default(DEFAULT_CONFIG.timeoutMs).description("\u5355\u6B21\u589E\u5F3A\u7684\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09").volatile(),
97
109
  systemPrompt: z.string().role("textarea").default(DEFAULT_CONFIG.systemPrompt).description("\u7CFB\u7EDF\u63D0\u793A\u8BCD\uFF1B\u7559\u7A7A\u4F7F\u7528\u5185\u7F6E\u589E\u5F3A\u7B56\u7565").volatile(),
98
110
  strategyMode: z.union(["replace-default", "extend-default"]).default(DEFAULT_CONFIG.strategyMode).description("\u81EA\u5B9A\u4E49\u7CFB\u7EDF\u63D0\u793A\u8BCD\u7684\u7EC4\u5408\u65B9\u5F0F\uFF1A\u6574\u4F53\u66FF\u6362\u5185\u7F6E\u7B56\u7565\uFF08\u9ED8\u8BA4\uFF1B\u4EC5\u4FDD\u7559\u63D2\u4EF6\u59CB\u7EC8\u8FFD\u52A0\u7684\u6700\u5C0F\u8F93\u51FA\u5951\u7EA6\uFF1A\u8F93\u5165\u662F\u6570\u636E\u3001\u53EA\u8F93\u51FA\u6539\u5199\u7ED3\u679C\uFF09\uFF0C\u6216\u628A\u81EA\u5B9A\u4E49\u6587\u672C\u8FFD\u52A0\u5728\u5185\u7F6E\u7B56\u7565\u4E4B\u540E\uFF08\u5185\u7F6E\u89C4\u5219\u7EE7\u7EED\u751F\u6548\uFF09").volatile(),
99
111
  shortcut: z.string().default(DEFAULT_CONFIG.shortcut).description("\u89E6\u53D1\u5FEB\u6377\u952E\uFF0C\u9ED8\u8BA4\u7559\u7A7A\u5373\u7981\u7528\uFF1B\u5982\u9700\u542F\u7528\uFF0C\u586B\u5982 ctrl+alt+e\uFF08\u987B\u5305\u542B ctrl/alt/meta \u4E2D\u81F3\u5C11\u4E00\u4E2A\u4FEE\u9970\u952E\uFF0Cshift \u4EC5\u53EF\u4F5C\u9644\u52A0\uFF0C\u7EAF\u5B57\u6BCD/\u6570\u5B57\u6216 shift+\u5B57\u6BCD\u4F1A\u88AB\u5FFD\u7565\uFF09").volatile(),
100
- maxConcurrent: z.number().step(1).min(1).max(16).default(DEFAULT_CONFIG.maxConcurrent).description("\u5BBF\u4E3B\u4FA7\u5E76\u53D1\u4E0A\u9650\uFF1A\u540C\u65F6\u8FDB\u884C\u7684\u589E\u5F3A\u8C03\u7528\u6570\uFF0C\u8D85\u51FA\u7684\u8BF7\u6C42\u8FD4\u56DE 429").volatile(),
101
- rateLimitPerMinute: z.number().step(1).min(1).max(600).default(DEFAULT_CONFIG.rateLimitPerMinute).description("\u6BCF\u5206\u949F\u589E\u5F3A\u6B21\u6570\u4E0A\u9650\uFF08\u6ED1\u52A8\u7A97\u53E3\uFF09\uFF0C\u8D85\u51FA\u8FD4\u56DE 429").volatile(),
112
+ maxConcurrent: z.number().step(1).min(FIELD_LIMITS.maxConcurrent.min).max(FIELD_LIMITS.maxConcurrent.max).default(DEFAULT_CONFIG.maxConcurrent).description("\u5BBF\u4E3B\u4FA7\u5E76\u53D1\u4E0A\u9650\uFF1A\u540C\u65F6\u8FDB\u884C\u7684\u589E\u5F3A\u8C03\u7528\u6570\uFF0C\u8D85\u51FA\u7684\u8BF7\u6C42\u8FD4\u56DE 429").volatile(),
113
+ rateLimitPerMinute: z.number().step(1).min(FIELD_LIMITS.rateLimitPerMinute.min).max(FIELD_LIMITS.rateLimitPerMinute.max).default(DEFAULT_CONFIG.rateLimitPerMinute).description("\u6BCF\u5206\u949F\u589E\u5F3A\u6B21\u6570\u4E0A\u9650\uFF08\u6ED1\u52A8\u7A97\u53E3\uFF09\uFF0C\u8D85\u51FA\u8FD4\u56DE 429").volatile(),
102
114
  streaming: z.boolean().default(DEFAULT_CONFIG.streaming).description("\u589E\u91CF\u5C55\u793A\uFF1A\u6A21\u578B\u8FB9\u5199\u8FB9\u5728\u9762\u677F\u663E\u793A\uFF08\u4EC5\u5F71\u54CD\u663E\u793A\u8282\u594F\uFF0C\u6700\u7EC8\u7ED3\u679C\u4E0D\u53D8\uFF1B\u5BBF\u4E3B\u6216\u7F51\u7EDC\u4E0D\u652F\u6301\u65F6\u81EA\u52A8\u56DE\u9000\u4E3A\u4E00\u6B21\u6027\u8FD4\u56DE\uFF09").volatile(),
103
115
  contextAware: z.boolean().default(DEFAULT_CONFIG.contextAware).description("\u4E0A\u4E0B\u6587\u611F\u77E5\uFF1A\u8BFB\u53D6\u5F53\u524D\u4F1A\u8BDD\u8FD1\u671F\u5BF9\u8BDD\uFF0C\u7528\u4E8E\u6D88\u89E3\u6307\u4EE3\u3001\u8865\u5168\u7701\u7565\u4E0E\u672F\u8BED\u7EA6\u675F\uFF1B\u65E0\u5386\u53F2\u6216\u5386\u53F2\u4E0D\u8DB3\u65F6\u81EA\u52A8\u56DE\u9000\u4E3A\u5355\u6761\u589E\u5F3A\uFF0C\u4E0D\u81C6\u9020\u4FE1\u606F").volatile(),
104
- contextMaxMessages: z.number().step(1).min(0).max(50).default(DEFAULT_CONFIG.contextMaxMessages).description("\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF08\u6761\u6570\uFF09\uFF1A\u6700\u591A\u53C2\u8003\u6700\u8FD1\u591A\u5C11\u6761 user/assistant \u8F6E\u6B21\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003").volatile(),
105
- contextMaxChars: z.number().step(1).min(0).max(1e5).default(DEFAULT_CONFIG.contextMaxChars).description("\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF08\u5B57\u6570\uFF09\uFF1A\u5386\u53F2\u7247\u6BB5\u7684\u5B57\u7B26\u9884\u7B97\uFF0C\u4ECE\u6700\u65B0\u4E00\u6761\u5411\u524D\u88C5\u914D\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003").volatile()
116
+ contextMaxMessages: z.number().step(1).min(FIELD_LIMITS.contextMaxMessages.min).max(FIELD_LIMITS.contextMaxMessages.max).default(DEFAULT_CONFIG.contextMaxMessages).description("\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF08\u6761\u6570\uFF09\uFF1A\u6700\u591A\u53C2\u8003\u6700\u8FD1\u591A\u5C11\u6761 user/assistant \u8F6E\u6B21\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003").volatile(),
117
+ contextMaxChars: z.number().step(1).min(FIELD_LIMITS.contextMaxChars.min).max(FIELD_LIMITS.contextMaxChars.max).default(DEFAULT_CONFIG.contextMaxChars).description("\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF08\u5B57\u6570\uFF09\uFF1A\u5386\u53F2\u7247\u6BB5\u7684\u5B57\u7B26\u9884\u7B97\uFF0C\u4ECE\u6700\u65B0\u4E00\u6761\u5411\u524D\u88C5\u914D\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003").volatile()
106
118
  });
107
119
  function resolveReasoningEffort(value) {
108
120
  if (typeof value === "string") {
@@ -125,17 +137,17 @@ function resolveConfig(config) {
125
137
  throw new Error("dsh-prompt-enhance: provider/model \u8986\u76D6\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32");
126
138
  }
127
139
  const temperature = config.temperature;
128
- if (typeof temperature !== "number" || !Number.isFinite(temperature) || temperature < 0 || temperature > 1) {
129
- throw new Error("dsh-prompt-enhance: temperature \u5FC5\u987B\u662F 0\u20131 \u4E4B\u95F4\u7684\u6709\u9650\u6570\u5B57");
140
+ if (typeof temperature !== "number" || !Number.isFinite(temperature) || temperature < TEMPERATURE.min || temperature > TEMPERATURE.max) {
141
+ throw new Error(`dsh-prompt-enhance: temperature \u5FC5\u987B\u662F ${TEMPERATURE.min}\u2013${TEMPERATURE.max} \u4E4B\u95F4\u7684\u6709\u9650\u6570\u5B57`);
130
142
  }
131
143
  const pairOrUndefined = (value) => {
132
144
  if (value === void 0) return void 0;
133
145
  const trimmed = value.trim();
134
146
  return trimmed === "" ? void 0 : trimmed;
135
147
  };
136
- const intInRange = (value, name2, min, max) => {
137
- if (typeof value !== "number" || !Number.isInteger(value) || value < min || value > max) {
138
- throw new Error(`dsh-prompt-enhance: ${name2} \u5FC5\u987B\u662F ${min}\u2013${max} \u4E4B\u95F4\u7684\u6574\u6570`);
148
+ const intInRange = (value, name2, range) => {
149
+ if (typeof value !== "number" || !Number.isInteger(value) || value < range.min || value > range.max) {
150
+ throw new Error(`dsh-prompt-enhance: ${name2} \u5FC5\u987B\u662F ${range.min}\u2013${range.max} \u4E4B\u95F4\u7684\u6574\u6570`);
139
151
  }
140
152
  return value;
141
153
  };
@@ -149,21 +161,21 @@ function resolveConfig(config) {
149
161
  // does not declare is rejected by the adapter with a clear error rather
150
162
  // than silently replaced.
151
163
  reasoningEffort: resolveReasoningEffort(config.reasoningEffort),
152
- maxOutputTokens: intInRange(config.maxOutputTokens, "maxOutputTokens", 256, 32768),
153
- maxInputChars: intInRange(config.maxInputChars, "maxInputChars", 200, 2e5),
154
- timeoutMs: intInRange(config.timeoutMs, "timeoutMs", 5e3, 6e5),
164
+ maxOutputTokens: intInRange(config.maxOutputTokens, "maxOutputTokens", FIELD_LIMITS.maxOutputTokens),
165
+ maxInputChars: intInRange(config.maxInputChars, "maxInputChars", FIELD_LIMITS.maxInputChars),
166
+ timeoutMs: intInRange(config.timeoutMs, "timeoutMs", FIELD_LIMITS.timeoutMs),
155
167
  systemPrompt: typeof config.systemPrompt === "string" ? config.systemPrompt : "",
156
168
  // Tolerate absent or hand-edited values: anything but the extend literal
157
169
  // means replace, so stored sections from earlier versions keep exactly
158
170
  // the behavior they were saved under.
159
171
  strategyMode: config.strategyMode === "extend-default" ? "extend-default" : "replace-default",
160
172
  shortcut: typeof config.shortcut === "string" ? config.shortcut : "",
161
- maxConcurrent: intInRange(config.maxConcurrent, "maxConcurrent", 1, 16),
162
- rateLimitPerMinute: intInRange(config.rateLimitPerMinute, "rateLimitPerMinute", 1, 600),
173
+ maxConcurrent: intInRange(config.maxConcurrent, "maxConcurrent", FIELD_LIMITS.maxConcurrent),
174
+ rateLimitPerMinute: intInRange(config.rateLimitPerMinute, "rateLimitPerMinute", FIELD_LIMITS.rateLimitPerMinute),
163
175
  streaming: typeof config.streaming === "boolean" ? config.streaming : DEFAULT_CONFIG.streaming,
164
176
  contextAware: typeof config.contextAware === "boolean" ? config.contextAware : DEFAULT_CONFIG.contextAware,
165
- contextMaxMessages: intInRange(config.contextMaxMessages, "contextMaxMessages", 0, 50),
166
- contextMaxChars: intInRange(config.contextMaxChars, "contextMaxChars", 0, 1e5)
177
+ contextMaxMessages: intInRange(config.contextMaxMessages, "contextMaxMessages", FIELD_LIMITS.contextMaxMessages),
178
+ contextMaxChars: intInRange(config.contextMaxChars, "contextMaxChars", FIELD_LIMITS.contextMaxChars)
167
179
  };
168
180
  }
169
181
  function effectiveSystemPrompt(config, builtin) {
@@ -192,6 +204,7 @@ function pickRow(rows, rowIds) {
192
204
  function installSettingsSource(ctx, options) {
193
205
  let reader;
194
206
  let resolvedRowId;
207
+ let warnedReadFailure = false;
195
208
  const legacyHooks = {
196
209
  setSource: (source) => {
197
210
  reader = source;
@@ -233,21 +246,24 @@ function installSettingsSource(ctx, options) {
233
246
  }
234
247
  return;
235
248
  }
236
- void import("@deepseek-ai/dsh-settings").then((mod) => {
237
- const legacy = mod;
238
- if (typeof legacy.installSettingsSection !== "function") return;
239
- try {
240
- legacy.installSettingsSection(
241
- ctx,
242
- typeof legacy.settingsNamespace === "function" ? legacy.settingsNamespace(options.namespace) : options.namespace,
243
- options.schema,
244
- options.entry,
245
- legacyHooks
246
- );
247
- } catch {
249
+ void import("@deepseek-ai/dsh-settings").then(
250
+ (mod) => {
251
+ const legacy = mod;
252
+ if (typeof legacy.installSettingsSection !== "function") return;
253
+ try {
254
+ legacy.installSettingsSection(
255
+ ctx,
256
+ typeof legacy.settingsNamespace === "function" ? legacy.settingsNamespace(options.namespace) : options.namespace,
257
+ options.schema,
258
+ options.entry,
259
+ legacyHooks
260
+ );
261
+ } catch {
262
+ }
263
+ },
264
+ () => {
248
265
  }
249
- }, () => {
250
- });
266
+ );
251
267
  });
252
268
  return {
253
269
  read() {
@@ -255,7 +271,11 @@ function installSettingsSource(ctx, options) {
255
271
  try {
256
272
  const value = reader();
257
273
  if (value !== void 0) return value;
258
- } catch {
274
+ } catch (error) {
275
+ if (!warnedReadFailure) {
276
+ warnedReadFailure = true;
277
+ console.warn("[dsh-prompt-enhance] reading the settings section failed; using the composition config for the rest of this session.", error);
278
+ }
259
279
  }
260
280
  }
261
281
  return options.fallback();
@@ -273,12 +293,7 @@ function installSettingsSource(ctx, options) {
273
293
  var ENHANCE_ENDPOINT = "/dsh-prompt-enhance/enhance";
274
294
  var ENHANCE_PREFIX = "/dsh-prompt-enhance";
275
295
  var ENHANCE_STREAM_ENDPOINT = "/dsh-prompt-enhance/enhance-stream";
276
- var PROMPT_ENHANCE_ROW_IDS = [
277
- "dsh-prompt-enhance",
278
- "prompt-enhance",
279
- "web-ui-dsh-prompt-enhance",
280
- "web-ui-prompt-enhance"
281
- ];
296
+ var PROMPT_ENHANCE_ROW_IDS = ["dsh-prompt-enhance", "prompt-enhance", "web-ui-dsh-prompt-enhance", "web-ui-prompt-enhance"];
282
297
 
283
298
  // src/shared/stream-text.ts
284
299
  var LEADING_FENCE = /^[ \t]*```[A-Za-z0-9_+-]*[ \t]*\r?\n/;
@@ -307,11 +322,6 @@ function createStreamNormalizer() {
307
322
  if (POSSIBLE_FENCE_PREFIX.test(buffer) && buffer.length <= MAX_FENCE_PREFIX_LOOKAHEAD) return;
308
323
  opened = true;
309
324
  };
310
- const stripTrailingFence = () => {
311
- const rest = buffer.replace(/```[ \t]*$/, "");
312
- buffer = "";
313
- return rest;
314
- };
315
325
  return {
316
326
  push(chunk) {
317
327
  buffer += chunk;
@@ -957,11 +967,7 @@ function conversationContextOf(ctx, sessionId, config, draft) {
957
967
  } catch {
958
968
  return void 0;
959
969
  }
960
- return buildConversationContext(
961
- messages,
962
- { maxMessages: config.contextMaxMessages, maxChars: config.contextMaxChars },
963
- draft
964
- );
970
+ return buildConversationContext(messages, { maxMessages: config.contextMaxMessages, maxChars: config.contextMaxChars }, draft);
965
971
  }
966
972
  async function effectiveReasoningEffort(llm, provider, model, configured) {
967
973
  if (configured === "inherit") return configured;
@@ -977,11 +983,16 @@ async function effectiveReasoningEffort(llm, provider, model, configured) {
977
983
  await writeCachedCapabilities(provider, model, [], void 0, true);
978
984
  return "inherit";
979
985
  }
980
- await writeCachedCapabilities(provider, model, reasoning.efforts.map((effort) => ({
981
- id: effort.id,
982
- name: effort.name,
983
- ...effort.description === void 0 ? {} : { description: effort.description }
984
- })), reasoning.defaultEffort);
986
+ await writeCachedCapabilities(
987
+ provider,
988
+ model,
989
+ reasoning.efforts.map((effort) => ({
990
+ id: effort.id,
991
+ name: effort.name,
992
+ ...effort.description === void 0 ? {} : { description: effort.description }
993
+ })),
994
+ reasoning.defaultEffort
995
+ );
985
996
  return configured;
986
997
  } catch {
987
998
  return configured;