@michengai/dsh-codex-ui 2.4.0 → 2.4.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.4.2] - 2026-11-21
4
+
5
+ - **Fix Prediction Candidates Display and Control Text Filtering with Reasoning Models (Issue #108, PR #109)**:
6
+ - Increased default prediction token budget to provide ample reasoning headroom, resolving the issue where ghost suggestions never appeared with certain reasoning models;
7
+ - Improved prediction truncation and candidate recovery to retain usable whole candidates when length limits are reached, preventing single-line completions from being accidentally cleared;
8
+ - Enhanced streaming preview by filtering out prompt echoes and control text, immediately halting when no prediction is available to keep ghost suggestions crisp and accurate.
9
+
10
+ ## [2.4.1] - 2026-11-20
11
+
12
+ - **Fix Network Noise and Continuous Error Logs When Theme Feature is Disabled (Issue #107)**:
13
+ - Fixed an issue where disabling the theme feature in configuration caused the client to continuously request theme status and log 404 network errors in DevTools;
14
+ - Improved the status probing behavior so failed probes back off and stop polling indefinitely, keeping the network panel and error count clean without background noise.
15
+
3
16
  ## [2.4.0] - 2026-11-20
4
17
 
5
18
  - **Searchable, keyboard-friendly workspace menu on the new-session page (PR #106)**:
@@ -1,5 +1,18 @@
1
1
  # 更新日志
2
2
 
3
+ ## [2.4.2] - 2026-11-21
4
+
5
+ - **修复输入预测在推理模型下的候选生成与显示异常(Issue #108、PR #109)**:
6
+ - 调高输入预测的默认生成 token 预算,为推理模型预留充分的思考空间,彻底解决在部分思考模型下幽灵候选文本持续为空的问题;
7
+ - 优化预测候选截断与回收机制,在输出达到长度限制时保留已生成可用的完整候选,避免单行文本被意外清空;
8
+ - 改进流式打字预览体验,自动过滤模型复述的提示词与控制标记,遇到无需建议时即刻停止,保持幽灵文本干净准确。
9
+
10
+ ## [2.4.1] - 2026-11-20
11
+
12
+ - **修复主题子插件停用时的网络异常与持续报错(Issue #107)**:
13
+ - 修复了在配置中停用主题功能后,桌面端和网页端仍会持续尝试请求主题状态并产生 404 错误日志的问题;
14
+ - 优化了插件状态探活机制,探测失败时有界退避并自动终止轮询,避免在控制台和开发者工具网络面板中持续产生红色错误记录,保持网络请求和错误徽标干净。
15
+
3
16
  ## [2.4.0] - 2026-11-20
4
17
 
5
18
  - **欢迎页工作区菜单支持搜索与键盘挑选(PR #106)**:
package/lib/client.js CHANGED
@@ -3681,20 +3681,30 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3681
3681
  //#region src/client/theme/index.ts
3682
3682
  let globalThemeRuntime;
3683
3683
  /**
3684
- * 校验主题子插件是否在 Host 侧被显式停用。
3685
- * 遵循统一的 fail-closed 契约:当端点 404 或网络不可达时视为停用并回退官方。
3684
+ * 读取主题子插件在 Host 侧的状态。
3685
+ * 返回 enabled(是否激活)和 explicitlyDisabled(是否为服务端明确回报的停用)。
3686
3686
  */
3687
- async function checkThemeEnabled() {
3687
+ async function fetchThemeSubPluginStatus() {
3688
3688
  try {
3689
3689
  const base = typeof document !== "undefined" && document.baseURI ? document.baseURI : "http://localhost";
3690
3690
  const normalizedBase = base.endsWith("/") ? base : `${base}/`;
3691
3691
  const path = CODEX_UI_API_ENDPOINTS.theme.startsWith("/") ? CODEX_UI_API_ENDPOINTS.theme.slice(1) : CODEX_UI_API_ENDPOINTS.theme;
3692
3692
  const url = new URL(path, normalizedBase).href;
3693
3693
  const res = await fetch(url);
3694
- if (!res.ok) return false;
3695
- return (await res.json())?.enabled === true;
3694
+ if (!res.ok) return {
3695
+ enabled: false,
3696
+ explicitlyDisabled: false
3697
+ };
3698
+ const data = await res.json();
3699
+ return {
3700
+ enabled: data?.enabled === true,
3701
+ explicitlyDisabled: data?.enabled === false
3702
+ };
3696
3703
  } catch {
3697
- return false;
3704
+ return {
3705
+ enabled: false,
3706
+ explicitlyDisabled: false
3707
+ };
3698
3708
  }
3699
3709
  }
3700
3710
  function tolerantRegistration(run) {
@@ -3931,11 +3941,13 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3931
3941
  disposers.push(() => clearInterval(timer));
3932
3942
  }
3933
3943
  let healTimer;
3934
- const checkAndSync = async () => {
3944
+ let startupRetryCount = 0;
3945
+ const MAX_STARTUP_RETRIES = 3;
3946
+ const checkAndSync = async (allowStartupRetry = false) => {
3935
3947
  if (disposed) return;
3936
- const enabled = await checkThemeEnabled();
3948
+ const status = await fetchThemeSubPluginStatus();
3937
3949
  if (disposed) return;
3938
- if (!enabled) {
3950
+ if (!status.enabled) {
3939
3951
  setThemeSubPluginEnabled(false);
3940
3952
  disposeGlassMode();
3941
3953
  removeThemeSurfaceStyles();
@@ -3945,21 +3957,39 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3945
3957
  restoreNativeThemePresentation(theme ?? globalThemeRuntime);
3946
3958
  hasAppliedCustomTheme = false;
3947
3959
  }
3948
- if (!healTimer) healTimer = setInterval(() => {
3949
- if (typeof document !== "undefined" && document.visibilityState === "visible") checkAndSync();
3950
- }, 3e3);
3960
+ if (status.explicitlyDisabled) {
3961
+ if (healTimer) {
3962
+ clearTimeout(healTimer);
3963
+ healTimer = void 0;
3964
+ }
3965
+ return;
3966
+ }
3967
+ if (allowStartupRetry && startupRetryCount < MAX_STARTUP_RETRIES) {
3968
+ startupRetryCount++;
3969
+ if (!healTimer) {
3970
+ const delay = startupRetryCount * 1e3;
3971
+ healTimer = setTimeout(() => {
3972
+ healTimer = void 0;
3973
+ if (!disposed) checkAndSync(true);
3974
+ }, delay);
3975
+ }
3976
+ } else if (healTimer) {
3977
+ clearTimeout(healTimer);
3978
+ healTimer = void 0;
3979
+ }
3951
3980
  return;
3952
3981
  }
3953
3982
  if (healTimer) {
3954
- clearInterval(healTimer);
3983
+ clearTimeout(healTimer);
3955
3984
  healTimer = void 0;
3956
3985
  }
3986
+ startupRetryCount = 0;
3957
3987
  setThemeSubPluginEnabled(true);
3958
3988
  applyCurrentState(true);
3959
3989
  };
3960
3990
  globalCheckAndSync = checkAndSync;
3961
3991
  const onFocus = () => {
3962
- if (!disposed) checkAndSync();
3992
+ if (!disposed) checkAndSync(false);
3963
3993
  };
3964
3994
  if (typeof window !== "undefined") {
3965
3995
  window.addEventListener("focus", onFocus);
@@ -3972,7 +4002,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3972
4002
  if (e.target?.closest?.("[data-plugin-rows], [data-plugin-row], [data-shortcut-modal=\"settings\"], [role=\"switch\"]")) {
3973
4003
  if (clickTimer) clearTimeout(clickTimer);
3974
4004
  clickTimer = setTimeout(() => {
3975
- if (!disposed) checkAndSync();
4005
+ if (!disposed) checkAndSync(false);
3976
4006
  }, 150);
3977
4007
  }
3978
4008
  };
@@ -3994,7 +4024,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3994
4024
  if (touchesSettings) {
3995
4025
  if (settingsObserverTimer) clearTimeout(settingsObserverTimer);
3996
4026
  settingsObserverTimer = setTimeout(() => {
3997
- if (!disposed) checkAndSync();
4027
+ if (!disposed) checkAndSync(false);
3998
4028
  }, 150);
3999
4029
  }
4000
4030
  });
@@ -4009,7 +4039,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
4009
4039
  observer.disconnect();
4010
4040
  });
4011
4041
  }
4012
- checkAndSync();
4042
+ checkAndSync(true);
4013
4043
  applyCurrentState(false);
4014
4044
  const offThemeChange = ctx.on("theme/change", () => {
4015
4045
  if (disposed || !isThemeSubPluginEnabled()) return;
@@ -4024,7 +4054,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
4024
4054
  return () => {
4025
4055
  disposed = true;
4026
4056
  if (globalCheckAndSync === checkAndSync) globalCheckAndSync = void 0;
4027
- if (healTimer) clearInterval(healTimer);
4057
+ if (healTimer) clearTimeout(healTimer);
4028
4058
  unsubscribe();
4029
4059
  offThemeChange?.();
4030
4060
  disposeGlassMode();
@@ -10971,6 +11001,32 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
10971
11001
  });
10972
11002
  }
10973
11003
  //#endregion
11004
+ //#region src/composer-prediction-format.ts
11005
+ const PREDICTION_CUES = {
11006
+ next: "Predict the user's next message.",
11007
+ continue: "Write only the continuation text."
11008
+ };
11009
+ const PREDICTION_LABELS = {
11010
+ conversation: "Conversation tail (oldest first):",
11011
+ tools: "Recent tool activity (oldest first):",
11012
+ draft: "Draft text ending at the caret:"
11013
+ };
11014
+ const NO_PREDICTION = "NONE";
11015
+ function isNoPrediction(text) {
11016
+ return text.trim().toUpperCase() === NO_PREDICTION;
11017
+ }
11018
+ function predictionLineIdentity(text) {
11019
+ return text.replace(/[.:!?]+$/u, "").trim().toLocaleLowerCase();
11020
+ }
11021
+ const LABEL_IDENTITIES = Object.values(PREDICTION_LABELS).map(predictionLineIdentity);
11022
+ const NO_PREDICTION_IDENTITY = predictionLineIdentity(NO_PREDICTION);
11023
+ /** 只对未结束的末行暂缓显示可能还在输出中的控制文本。 */
11024
+ function isPredictionPromptEcho(identity, cueIdentity, partial = false) {
11025
+ if (identity === "") return true;
11026
+ const matches = (marker) => identity === marker || identity.startsWith(marker) && /[ .:!?]/u.test(identity.charAt(marker.length)) || partial && marker.startsWith(identity);
11027
+ return cueIdentity !== "" && matches(cueIdentity) || LABEL_IDENTITIES.some(matches) || partial && NO_PREDICTION_IDENTITY.startsWith(identity);
11028
+ }
11029
+ //#endregion
10974
11030
  //#region src/client/composer/ComposerPredictionOverlay.tsx
10975
11031
  /**
10976
11032
  * Browser half of composer predictions (1:1 完整无损移植自 dsh-composer-predictions 1.2.8 原版源码)
@@ -11143,21 +11199,22 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
11143
11199
  function isTriggerToken(draft) {
11144
11200
  return /(?:^|\s)\/[^\s]*$/u.test(draft) || /(?:^|\s)@"?[^\s]*$/u.test(draft);
11145
11201
  }
11146
- /** Show the model's first line while it is still streaming. */
11147
- function streamingCandidate(stream) {
11202
+ /** 流式预览只显示候选,不显示模型复述的提示词。 */
11203
+ function streamingCandidate(stream, mode) {
11148
11204
  if (stream.trim().length < STREAM_MIN_CHARS) return "";
11149
- for (const raw of stream.split(/\r?\n/u)) {
11150
- let line = raw.trim();
11151
- if (line === "") continue;
11152
- if (/^none$/iu.test(line)) return "";
11153
- line = cleanLine(line);
11205
+ const lines = stream.split("\n");
11206
+ const cue = predictionLineIdentity(PREDICTION_CUES[mode]);
11207
+ for (const [index, raw] of lines.entries()) {
11208
+ const line = cleanLine(raw);
11154
11209
  if (line === "") continue;
11210
+ if (isNoPrediction(line)) return "";
11211
+ if (isPredictionPromptEcho(predictionLineIdentity(line), cue, index === lines.length - 1)) continue;
11155
11212
  return line.length > 240 ? line.slice(0, 240) : line;
11156
11213
  }
11157
11214
  return "";
11158
11215
  }
11159
11216
  function cleanLine(line) {
11160
- return line.replace(/^(?:[-*•]|\d+[.)])\s+/u, "").replace(/^["'`\u201c\u201d]+|["'`\u201c\u201d]+$/gu, "").replace(/\s+/gu, " ").trim();
11217
+ return line.trimStart().replace(/^(?:[-*•]|\d+[.)])\s+/u, "").replace(/^user\s*:\s*/iu, "").replace(/^["'`\u201c\u201d]+|["'`\u201c\u201d]+$/gu, "").replace(/\s+/gu, " ").trim();
11161
11218
  }
11162
11219
  /**
11163
11220
  * Join a continuation onto the draft without gluing words together.
@@ -11425,7 +11482,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
11425
11482
  request,
11426
11483
  allowNext
11427
11484
  ]);
11428
- const rawCandidate = ghost.items.length > 0 ? ghost.items[Math.min(ghost.index, ghost.items.length - 1)] ?? "" : streamingCandidate(ghost.stream);
11485
+ const rawCandidate = ghost.items.length > 0 ? ghost.items[Math.min(ghost.index, ghost.items.length - 1)] ?? "" : streamingCandidate(ghost.stream, ghost.mode === "continue" ? "continue" : "next");
11429
11486
  const current = ghost.mode === "continue" ? joinContinuation(draft, rawCandidate) : rawCandidate;
11430
11487
  currentRef.current = current;
11431
11488
  const hasCandidate = current !== "";
@@ -20,7 +20,7 @@ type ComposerPluginConfig = {
20
20
  model?: string;
21
21
  /** 预测调用的 reasoning effort(off | low | high | max) */
22
22
  reasoningEffort?: string;
23
- /** 预测生成的最大 token 数(16 ~ 4096,默认 220) */
23
+ /** 预测生成的最大 token 数(16 ~ 4096,默认 1024) */
24
24
  maxOutputTokens?: number;
25
25
  /** 单次预测超时时间毫秒数(1000 ~ 120000,默认 20000) */
26
26
  timeoutMs?: number;
@@ -1,4 +1,30 @@
1
1
  import { r as CODEX_UI_API_ENDPOINTS, t as isSubPluginDisabledOnDisk$1 } from "./profile-resolver-DSHfL3KW.mjs";
2
+ //#region src/composer-prediction-format.ts
3
+ const PREDICTION_CUES = {
4
+ next: "Predict the user's next message.",
5
+ continue: "Write only the continuation text."
6
+ };
7
+ const PREDICTION_LABELS = {
8
+ conversation: "Conversation tail (oldest first):",
9
+ tools: "Recent tool activity (oldest first):",
10
+ draft: "Draft text ending at the caret:"
11
+ };
12
+ const NO_PREDICTION = "NONE";
13
+ function isNoPrediction(text) {
14
+ return text.trim().toUpperCase() === NO_PREDICTION;
15
+ }
16
+ function predictionLineIdentity(text) {
17
+ return text.replace(/[.:!?]+$/u, "").trim().toLocaleLowerCase();
18
+ }
19
+ const LABEL_IDENTITIES = Object.values(PREDICTION_LABELS).map(predictionLineIdentity);
20
+ const NO_PREDICTION_IDENTITY = predictionLineIdentity(NO_PREDICTION);
21
+ /** 只对未结束的末行暂缓显示可能还在输出中的控制文本。 */
22
+ function isPredictionPromptEcho(identity, cueIdentity, partial = false) {
23
+ if (identity === "") return true;
24
+ const matches = (marker) => identity === marker || identity.startsWith(marker) && /[ .:!?]/u.test(identity.charAt(marker.length)) || partial && marker.startsWith(identity);
25
+ return cueIdentity !== "" && matches(cueIdentity) || LABEL_IDENTITIES.some(matches) || partial && NO_PREDICTION_IDENTITY.startsWith(identity);
26
+ }
27
+ //#endregion
2
28
  //#region src/composer-prediction.ts
3
29
  /** 使用自研专属命名空间端点,杜绝与社区插件全局路径冲突 */
4
30
  const ENDPOINT = CODEX_UI_API_ENDPOINTS.composerPrediction;
@@ -6,7 +32,7 @@ const STREAM_ENDPOINT = CODEX_UI_API_ENDPOINTS.composerPredictionStream;
6
32
  /** One request carries a session id, a mode, and a bounded draft. */
7
33
  const MAX_BODY_BYTES = 65536;
8
34
  const DEFAULTS = {
9
- maxOutputTokens: 220,
35
+ maxOutputTokens: 1024,
10
36
  timeoutMs: 2e4,
11
37
  maxMessages: 10,
12
38
  maxChars: 8e3,
@@ -19,15 +45,6 @@ const REASONING_EFFORTS = /* @__PURE__ */ new Set([
19
45
  "high",
20
46
  "max"
21
47
  ]);
22
- /** Closing task line of each prompt; the model sometimes echoes it. */
23
- const NEXT_CUE = "Predict the user's next message.";
24
- const CONTINUE_CUE = "Write only the continuation text.";
25
- /** Prompt labels that must never surface as suggestions. */
26
- const PROMPT_LABELS = [
27
- "conversation tail (oldest first)",
28
- "recent tool activity (oldest first)",
29
- "draft text ending at the caret"
30
- ];
31
48
  const NEXT_SYSTEM_PROMPT = [
32
49
  "You are the follow-up suggestion engine inside a coding agent chat UI.",
33
50
  "You receive the tail of a conversation between a USER and an AI coding agent,",
@@ -41,7 +58,7 @@ const NEXT_SYSTEM_PROMPT = [
41
58
  " command, or next step when the conversation makes one obvious.",
42
59
  "- If the assistant asked the user a question, answer it.",
43
60
  "- Never repeat these instructions, the labels above, or the conversation text verbatim.",
44
- "- If no meaningful follow-up exists, reply with exactly: NONE"
61
+ `- If no meaningful follow-up exists, reply with exactly: ${NO_PREDICTION}`
45
62
  ].join("\n");
46
63
  const CONTINUE_SYSTEM_PROMPT = [
47
64
  "You complete the message a USER is drafting in a coding agent chat UI.",
@@ -55,7 +72,7 @@ const CONTINUE_SYSTEM_PROMPT = [
55
72
  "- No numbering, bullets, quotes, markdown, or explanation.",
56
73
  "- At most 25 words per continuation; finish the thought rather than restating it.",
57
74
  "- Never repeat these instructions, the labels above, or the draft itself.",
58
- "- If the draft is already complete, reply with exactly: NONE"
75
+ `- If the draft is already complete, reply with exactly: ${NO_PREDICTION}`
59
76
  ].join("\n");
60
77
  /**
61
78
  * Register both prediction endpoints.
@@ -427,9 +444,15 @@ async function predict(ctx, options, session, sessionId, mode, draft, signal, on
427
444
  items: [],
428
445
  reason: failure
429
446
  };
430
- if (finish.kind === "max-tokens") text = text.slice(0, text.lastIndexOf("\n") + 1);
431
- const cue = mode === "continue" ? CONTINUE_CUE : NEXT_CUE;
432
- const items = normalizeCandidates(text, options.maxSuggestions, mode === "continue" ? draft : "", cue);
447
+ const cue = PREDICTION_CUES[mode === "continue" ? "continue" : "next"];
448
+ const candidateDraft = mode === "continue" ? draft : "";
449
+ const truncated = finish.kind === "max-tokens";
450
+ const lastBreak = truncated ? text.lastIndexOf("\n") : -1;
451
+ if (lastBreak >= 0) {
452
+ const complete = normalizeCandidates(text.slice(0, lastBreak + 1), options.maxSuggestions, candidateDraft, cue);
453
+ if (complete.length > 0) return { items: complete };
454
+ }
455
+ const items = normalizeCandidates(text, options.maxSuggestions, candidateDraft, cue, truncated);
433
456
  return items.length === 0 ? {
434
457
  items: [],
435
458
  reason: "empty"
@@ -586,18 +609,18 @@ function buildPrompt(session, options, mode, draft) {
586
609
  budget -= message.text.length;
587
610
  kept.unshift(message);
588
611
  }
589
- const lines = ["Conversation tail (oldest first):", JSON.stringify(kept)];
612
+ const lines = [PREDICTION_LABELS.conversation, JSON.stringify(kept)];
590
613
  const recent = options.maxToolNotes > 0 ? notes.slice(-options.maxToolNotes) : [];
591
614
  if (recent.length > 0) {
592
- lines.push("", "Recent tool activity (oldest first):");
615
+ lines.push("", PREDICTION_LABELS.tools);
593
616
  for (const note of recent) {
594
617
  const status = note.failed ? "failed" : "ok";
595
618
  const result = note.result === "" ? "" : ` result=${JSON.stringify(clip(note.result, 320))}`;
596
619
  lines.push(`- ${note.name}(${clip(note.input, 320)}) -> ${status}${result}`);
597
620
  }
598
621
  }
599
- if (mode === "continue") lines.push("", "Draft text ending at the caret:", JSON.stringify(draft), "", CONTINUE_CUE);
600
- else lines.push("", NEXT_CUE);
622
+ if (mode === "continue") lines.push("", PREDICTION_LABELS.draft, JSON.stringify(draft), "", PREDICTION_CUES.continue);
623
+ else lines.push("", PREDICTION_CUES.next);
601
624
  return lines.join("\n");
602
625
  }
603
626
  function plainText(blocks) {
@@ -606,27 +629,31 @@ function plainText(blocks) {
606
629
  function clip(text, maximum) {
607
630
  return text.length > maximum ? `${text.slice(0, maximum)}…` : text;
608
631
  }
609
- /** Split model output into clean, de-duplicated, bounded candidates. */
610
- function normalizeCandidates(text, maximum, draft, cue = "") {
632
+ /** 清洗、去重并限制模型返回的候选。 */
633
+ function normalizeCandidates(text, maximum, draft, cue = "", partialLastLine = false) {
611
634
  const items = [];
612
635
  const seen = /* @__PURE__ */ new Set();
613
636
  const prefix = draft === "" ? "" : draft.trimEnd();
614
637
  const prefixLower = prefix.toLocaleLowerCase();
615
- const cueIdentity = identityOf(cue);
616
- for (const raw of text.split(/\r?\n/)) {
638
+ const cueIdentity = predictionLineIdentity(cue);
639
+ const lines = text.split("\n");
640
+ for (const [index, raw] of lines.entries()) {
617
641
  const hadLeadingSpace = /^\s/u.test(raw);
618
642
  const line = raw.replace(/^(?:[-*•]|\d+[.)])\s+/u, "").replace(/^user\s*:\s*/iu, "").trim();
619
643
  if (line === "") continue;
620
644
  let body = line.replace(/^["'`\u201c\u201d]+|["'`\u201c\u201d]+$/gu, "").replace(/\s+/gu, " ");
621
- if (body === "" || /^none$/iu.test(body)) continue;
645
+ if (isNoPrediction(body)) break;
646
+ const partial = partialLastLine && index === lines.length - 1;
647
+ const originalIdentity = predictionLineIdentity(body);
648
+ if (isPredictionPromptEcho(originalIdentity, cueIdentity, partial)) continue;
622
649
  if (prefixLower !== "" && body.toLocaleLowerCase().startsWith(prefixLower)) body = body.slice(prefix.length).replace(/^\s+/u, " ");
623
650
  else if (draft !== "" && hadLeadingSpace && !/^\s/u.test(body)) body = ` ${body}`;
624
651
  body = draft === "" ? body.trim() : body.replace(/\s+$/u, "");
625
652
  if (body.trim() === "") continue;
626
653
  body = boundSuggestion(body);
627
654
  if (body === "") continue;
628
- const identity = identityOf(body);
629
- if (isInstructionEcho(identity, cueIdentity)) continue;
655
+ const identity = predictionLineIdentity(body);
656
+ if (identity !== originalIdentity && isPredictionPromptEcho(identity, cueIdentity, partial)) continue;
630
657
  if (seen.has(identity)) continue;
631
658
  seen.add(identity);
632
659
  items.push(body);
@@ -634,16 +661,6 @@ function normalizeCandidates(text, maximum, draft, cue = "") {
634
661
  }
635
662
  return items;
636
663
  }
637
- /** Normalize a line for echo comparison: lowercase, no trailing punctuation. */
638
- function identityOf(text) {
639
- return text.replace(/[.:!?]+$/u, "").trim().toLocaleLowerCase();
640
- }
641
- /** Drop the prompt's own labels and task line when the model echoes them. */
642
- function isInstructionEcho(identity, cueIdentity) {
643
- if (identity === "") return true;
644
- if (cueIdentity !== "" && (identity === cueIdentity || identity.startsWith(`${cueIdentity} `))) return true;
645
- return PROMPT_LABELS.some((label) => identity === label || identity.startsWith(`${label} `));
646
- }
647
664
  function boundSuggestion(line) {
648
665
  if (line.length <= 240) return line;
649
666
  const cut = line.slice(0, 240);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-codex-ui",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "DSH Codex UI — 为 DeepSeek Harness 提供极速历史召回、全屏设置皮肤、原生物理毛玻璃换肤、模块化侧栏与桌面原生窗口菜单 · Input enhancement, settings skin, native glass theme, modular sidebar, and desktop titlebar menu for DSH",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {