@michengai/dsh-codex-ui 2.0.14 → 2.0.16

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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.16 (2026-11-04)
4
+
5
+ - **Scoped Settings Sidebar Styles to Direct Children**: Restricted capsule navigation styles strictly to the direct left sidebar container of the settings workbench, completely preventing style bleed into the right-hand options content area. Third-party plugins with internal tabs or button navigations now preserve their native button dimensions and flex layout without being stretched to 100% full-width rows.
6
+ - **Added an inline-prediction switch**: a new "Composer Enhancements" card in settings toggles inline suggestions on and off. Turning it off takes effect immediately, clears the current ghost, and **issues no further requests at all**, so no model tokens are spent. `↑`/`↓` history recall, width handles, and starter suggestion cards are unaffected.
7
+ - **Added a site-level config flag**: a Profile can set `config.prediction: false` on `codex-ui-composer` in `cordis.patch.yml` to disable predictions wholesale. The Host then does not register the prediction routes (direct hits return 404), and the settings switch is locked off with an explanatory hint.
8
+
9
+ ## 2.0.15 (2026-11-04)
10
+
11
+ - **Fixed Input Prediction & Inline Continuation Never Appearing**: The auxiliary model call was issued without a session id, so OpenCode-compatible gateways — which route on the `x-opencode-session` header — rejected every prediction request with `400 MissingSessionID` and no suggestion ever appeared at the caret. The owning session id is now forwarded with the prepared call, restoring the inline suggestion together with `Tab` acceptance, `Alt + ↓/↑` candidate cycling and `Esc` dismissal.
12
+
3
13
  ## 2.0.14 (2026-11-04)
4
14
 
5
15
  - **Enhanced Sidebar Section Submenu Stability & Hover Transitions**: Resolved an issue where moving the pointer onto the "Partition" submenu could unexpectedly close the menu chain. Seamlessly supports hover transitions and click expansions across both expanded and collapsed sidebar states, ensuring the flyout menu layer always renders above sidebar rows without clipping.
@@ -1,5 +1,15 @@
1
1
  # 更新日志
2
2
 
3
+ ## 2.0.16 (2026-11-04)
4
+
5
+ - **隔离设置皮肤侧栏样式,消除第三方插件布局误伤**:将全屏设置界面的侧栏胶囊导航样式严格限定在模态框直属的左侧导航容器内,杜绝规则向右侧内容区域扩散。安装包含标签页或按钮导航的第三方插件时,插件内部的选项卡与功能按钮完全保持其原生尺寸与排版,不再被强制拉伸变形或撑满整行。
6
+ - **新增智能输入预测开关**:设置页「输入框增强」卡片可一键开启或关闭行内预测建议,关闭后立即生效、光标处建议瞬间消失,并且**完全不再发起任何请求**,不消耗模型额度;`↑`/`↓` 历史召回、宽度拖拽手柄、新会话建议卡片等其余输入框能力不受影响。
7
+ - **补充站点级配置位**:Profile 的 `cordis.patch.yml` 可给 `codex-ui-composer` 配置 `config.prediction: false` 做整体关闭;此时 Host 不注册预测路由(直连返回 404),设置页开关置灰并给出原因说明,用户无法自行开启。
8
+
9
+ ## 2.0.15 (2026-11-04)
10
+
11
+ - **修复智能输入预测与行内续写完全不出现**:辅助模型调用此前没有携带会话 ID,OpenCode 兼容网关按 `x-opencode-session` 头路由,直接以 400(MissingSessionID)拒绝,于是打字停顿后光标处始终没有任何建议。补齐会话 ID 后,预测建议恢复正常浮现,`Tab` 一键采纳、`Alt + ↓/↑` 切换候选、`Esc` 忽略均可用。
12
+
3
13
  ## 2.0.14 (2026-11-04)
4
14
 
5
15
  - **侧栏工作区分组飞出菜单交互与稳定性全面加固**:彻底解决鼠标移向「分区」二级菜单时菜单链偶发意外关闭的问题,支持顺畅的鼠标悬停穿梭与点击展开;即使在桌面端侧边栏收起抽屉模式下也能稳定展开,二级面板层级优先,绝不被侧边栏列边缘裁切或压在文字下方。
package/README.md CHANGED
@@ -163,6 +163,7 @@ Once installed, restart your DSH Web instance and hard-refresh your browser (`Ct
163
163
  | Feature | How to Use |
164
164
  | :--- | :--- |
165
165
  | **Accept Input Prediction** | Press `Tab` when predictive ghost text appears behind the caret; press `Alt + Down` / `Alt + Up` to cycle recommendations, or `Escape` to dismiss. |
166
+ | **Toggle Predictions** | Go to **Settings → Codex UI** and toggle the switch in the "Composer Enhancements" card. Can also be locked off wholesale across a profile by setting `config.prediction: false` in `cordis.patch.yml`. |
166
167
  | **Recall Input History** | Press `↑` / `↓` in an empty composer to cycle through past inputs submitted in the current workspace (up to 200 items). |
167
168
  | **Resize Composer Width** | Hover over either lateral border of the composer and drag the blue handles. |
168
169
  | **Switch Themes & Blur** | Navigate to **Settings → Codex UI**, choose from 7 palettes, and toggle Stock/Mica or blur presets. |
package/README.zh-CN.md CHANGED
@@ -163,6 +163,7 @@ dsh --profile web --dump-config
163
163
  | 场景 | 操作方式 |
164
164
  | :--- | :--- |
165
165
  | **采纳输入预测续写** | 打字停顿弹出高亮候选项时,按 `Tab` 键一键采纳补全;按 `Alt + ↓` / `Alt + ↑` 循环切换多条候选,按 `Esc` 退出。 |
166
+ | **启闭输入预测功能** | 打开「设置 → Codex UI」,在「输入框增强」卡片切换「智能输入预测与行内续写」开关;支持在 Profile 的 `cordis.patch.yml` 中配置 `config.prediction: false` 实现站点级统一锁定。 |
166
167
  | **找回历史输入** | 输入框为空时按键盘 `↑` / `↓` 方向键,即时召回在当前工作区提交过的历史文本(按工作区隔离存储 200 条)。 |
167
168
  | **调节输入框宽度** | 悬停至输入框左右边缘,拖拽蓝色手柄即可自定义最舒适的编写宽度。 |
168
169
  | **切换主题与质感** | 打开「设置 → Codex UI」,在「界面外观与换肤」卡片单选 7 款主题,直选原版/云母模式与材质预设。 |
package/lib/client.js CHANGED
@@ -188,6 +188,99 @@ window.__ModuleLoader__.load({
188
188
  const message = error instanceof Error ? error.message : String(error);
189
189
  return t(INSTALL_ERROR_KEYS.find(([pattern]) => pattern.test(message))?.[1] ?? "about.installFailed");
190
190
  }
191
+ //#endregion
192
+ //#region src/client/section-card-styles.ts
193
+ /**
194
+ * 设置页卡片的共享结构样式。
195
+ *
196
+ * `AboutSection` 下的每张卡片(如 `ThemeSettingsCard`、`ComposerSettingsCard`)均统一引用本模块,
197
+ * 保证单一事实源,避免重复定义与样式漂移。
198
+ */
199
+ const SECTION_CARD_CSS = `
200
+ .dcu-section-card {
201
+ box-sizing: border-box;
202
+ display: flex;
203
+ flex-direction: column;
204
+ gap: 16px;
205
+ padding: 18px 20px;
206
+ background: var(--dsw-alias-bg-layer-2, #18181b);
207
+ border: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.08));
208
+ border-radius: 12px;
209
+ margin-bottom: 16px;
210
+ }
211
+ body:not([data-ds-dark-theme]) .dcu-section-card {
212
+ background: var(--dsw-alias-bg-layer-2, #ffffff);
213
+ border-color: var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08));
214
+ }
215
+ html[data-dsh-glass] .dcu-section-card {
216
+ background: var(--dsw-alias-bg-layer-2, #18181b) !important;
217
+ backdrop-filter: none !important;
218
+ -webkit-backdrop-filter: none !important;
219
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
220
+ }
221
+ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
222
+ background: var(--dsw-alias-bg-layer-2, #ffffff) !important;
223
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
224
+ }
225
+ .dcu-section-header {
226
+ display: flex;
227
+ align-items: flex-start;
228
+ justify-content: space-between;
229
+ gap: 16px;
230
+ flex-wrap: wrap;
231
+ }
232
+ .dcu-section-title-wrap {
233
+ display: flex;
234
+ flex-direction: column;
235
+ gap: 4px;
236
+ min-width: 0;
237
+ flex: 1;
238
+ }
239
+ .dcu-section-title {
240
+ margin: 0;
241
+ font-size: 15px;
242
+ font-weight: 600;
243
+ line-height: 22px;
244
+ color: var(--dsw-alias-label-primary);
245
+ display: flex;
246
+ align-items: center;
247
+ gap: 8px;
248
+ }
249
+ .dcu-section-desc {
250
+ margin: 0;
251
+ font-size: 13px;
252
+ line-height: 18px;
253
+ color: var(--dsw-alias-label-tertiary);
254
+ }
255
+ `;
256
+ /** 设置行(左文案 + 右侧控件)。与 `.dcu-theme-row` 同构,命名独立以免互相依赖。 */
257
+ const SETTINGS_ROW_CSS = `
258
+ .dcu-settings-row {
259
+ display: flex;
260
+ align-items: center;
261
+ justify-content: space-between;
262
+ gap: 16px;
263
+ flex-wrap: wrap;
264
+ }
265
+ .dcu-settings-row-label {
266
+ display: flex;
267
+ flex-direction: column;
268
+ gap: 2px;
269
+ min-width: 0;
270
+ flex: 1;
271
+ }
272
+ .dcu-settings-row-title {
273
+ font-size: 13px;
274
+ font-weight: 600;
275
+ line-height: 18px;
276
+ color: var(--dsw-alias-label-primary);
277
+ }
278
+ .dcu-settings-row-hint {
279
+ font-size: 12px;
280
+ line-height: 17px;
281
+ color: var(--dsw-alias-label-tertiary);
282
+ }
283
+ `;
191
284
  //#endregion
192
285
  //#region src/client/theme/glass-css.gen.ts
193
286
  /**
@@ -1692,7 +1785,7 @@ window.__ModuleLoader__.load({
1692
1785
  glassPreset: "codex-ui.glass.preset",
1693
1786
  glassGlow: "codex-ui.glass.glow"
1694
1787
  });
1695
- const listeners$1 = /* @__PURE__ */ new Set();
1788
+ const listeners$2 = /* @__PURE__ */ new Set();
1696
1789
  const VALID_THEMES = [
1697
1790
  "stock",
1698
1791
  "codex-dark",
@@ -1702,25 +1795,25 @@ window.__ModuleLoader__.load({
1702
1795
  "catppuccin-frappe",
1703
1796
  "catppuccin-latte"
1704
1797
  ];
1705
- function safeGetItem(key) {
1798
+ function safeGetItem$1(key) {
1706
1799
  try {
1707
1800
  if (typeof localStorage !== "undefined") return localStorage.getItem(key);
1708
1801
  } catch {}
1709
1802
  return null;
1710
1803
  }
1711
- function safeSetItem(key, value) {
1804
+ function safeSetItem$1(key, value) {
1712
1805
  try {
1713
1806
  if (typeof localStorage !== "undefined") localStorage.setItem(key, value);
1714
1807
  } catch {}
1715
1808
  }
1716
1809
  function computeSnapshot() {
1717
- const rawTheme = safeGetItem(STORAGE_KEYS.themeOption);
1810
+ const rawTheme = safeGetItem$1(STORAGE_KEYS.themeOption);
1718
1811
  const themeOption = rawTheme && VALID_THEMES.includes(rawTheme) ? rawTheme : "stock";
1719
- const glassEnabled = safeGetItem(STORAGE_KEYS.glassEnabled) !== "false";
1720
- const glassMode = safeGetItem(STORAGE_KEYS.glassMode) === "compat" ? "compat" : "mica";
1721
- const rawPreset = safeGetItem(STORAGE_KEYS.glassPreset);
1812
+ const glassEnabled = safeGetItem$1(STORAGE_KEYS.glassEnabled) !== "false";
1813
+ const glassMode = safeGetItem$1(STORAGE_KEYS.glassMode) === "compat" ? "compat" : "mica";
1814
+ const rawPreset = safeGetItem$1(STORAGE_KEYS.glassPreset);
1722
1815
  const glassPreset = rawPreset === "clear" || rawPreset === "frosted" ? rawPreset : "standard";
1723
- const glassGlow = safeGetItem(STORAGE_KEYS.glassGlow) === "true";
1816
+ const glassGlow = safeGetItem$1(STORAGE_KEYS.glassGlow) === "true";
1724
1817
  return Object.freeze({
1725
1818
  themeOption,
1726
1819
  glassEnabled,
@@ -1749,36 +1842,36 @@ window.__ModuleLoader__.load({
1749
1842
  }
1750
1843
  function notify() {
1751
1844
  currentSnapshot = computeSnapshot();
1752
- for (const listener of listeners$1) try {
1845
+ for (const listener of listeners$2) try {
1753
1846
  listener();
1754
1847
  } catch (e) {
1755
1848
  console.warn("[codex-ui:theme] listener error:", e);
1756
1849
  }
1757
1850
  }
1758
1851
  function setThemeOption(themeOption) {
1759
- safeSetItem(STORAGE_KEYS.themeOption, themeOption);
1852
+ safeSetItem$1(STORAGE_KEYS.themeOption, themeOption);
1760
1853
  notify();
1761
1854
  }
1762
1855
  function setGlassEnabled(enabled) {
1763
- safeSetItem(STORAGE_KEYS.glassEnabled, String(enabled));
1856
+ safeSetItem$1(STORAGE_KEYS.glassEnabled, String(enabled));
1764
1857
  notify();
1765
1858
  }
1766
1859
  function setGlassMode(mode) {
1767
- safeSetItem(STORAGE_KEYS.glassMode, mode);
1860
+ safeSetItem$1(STORAGE_KEYS.glassMode, mode);
1768
1861
  notify();
1769
1862
  }
1770
1863
  function setGlassPreset(preset) {
1771
- safeSetItem(STORAGE_KEYS.glassPreset, preset);
1864
+ safeSetItem$1(STORAGE_KEYS.glassPreset, preset);
1772
1865
  notify();
1773
1866
  }
1774
1867
  function setGlassGlow(glow) {
1775
- safeSetItem(STORAGE_KEYS.glassGlow, String(glow));
1868
+ safeSetItem$1(STORAGE_KEYS.glassGlow, String(glow));
1776
1869
  notify();
1777
1870
  }
1778
1871
  function subscribeThemeSettings(listener) {
1779
- listeners$1.add(listener);
1872
+ listeners$2.add(listener);
1780
1873
  return () => {
1781
- listeners$1.delete(listener);
1874
+ listeners$2.delete(listener);
1782
1875
  };
1783
1876
  }
1784
1877
  if (typeof window !== "undefined") window.addEventListener("storage", (event) => {
@@ -2193,61 +2286,7 @@ window.__ModuleLoader__.load({
2193
2286
  }
2194
2287
  ];
2195
2288
  const stylesheet$1 = `
2196
- .dcu-section-card {
2197
- box-sizing: border-box;
2198
- display: flex;
2199
- flex-direction: column;
2200
- gap: 16px;
2201
- padding: 18px 20px;
2202
- background: var(--dsw-alias-bg-layer-2, #18181b);
2203
- border: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.08));
2204
- border-radius: 12px;
2205
- margin-bottom: 16px;
2206
- }
2207
- body:not([data-ds-dark-theme]) .dcu-section-card {
2208
- background: var(--dsw-alias-bg-layer-2, #ffffff);
2209
- border-color: var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08));
2210
- }
2211
- html[data-dsh-glass] .dcu-section-card {
2212
- background: var(--dsw-alias-bg-layer-2, #18181b) !important;
2213
- backdrop-filter: none !important;
2214
- -webkit-backdrop-filter: none !important;
2215
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
2216
- }
2217
- html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
2218
- background: var(--dsw-alias-bg-layer-2, #ffffff) !important;
2219
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
2220
- }
2221
- .dcu-section-header {
2222
- display: flex;
2223
- align-items: flex-start;
2224
- justify-content: space-between;
2225
- gap: 16px;
2226
- flex-wrap: wrap;
2227
- }
2228
- .dcu-section-title-wrap {
2229
- display: flex;
2230
- flex-direction: column;
2231
- gap: 4px;
2232
- min-width: 0;
2233
- flex: 1;
2234
- }
2235
- .dcu-section-title {
2236
- margin: 0;
2237
- font-size: 15px;
2238
- font-weight: 600;
2239
- line-height: 22px;
2240
- color: var(--dsw-alias-label-primary);
2241
- display: flex;
2242
- align-items: center;
2243
- gap: 8px;
2244
- }
2245
- .dcu-section-desc {
2246
- margin: 0;
2247
- font-size: 13px;
2248
- line-height: 18px;
2249
- color: var(--dsw-alias-label-tertiary);
2250
- }
2289
+ ${SECTION_CARD_CSS}
2251
2290
  .dcu-theme-settings {
2252
2291
  display: flex;
2253
2292
  flex-direction: column;
@@ -2551,6 +2590,159 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
2551
2590
  });
2552
2591
  }
2553
2592
  //#endregion
2593
+ //#region src/client/composer/prediction-state.ts
2594
+ /**
2595
+ * 输入预测(ghost 建议)的用户级开关。
2596
+ *
2597
+ * 设计约束:
2598
+ * - **只影响预测**,不牵连 `↑`/`↓` 历史召回、宽度手柄、新会话建议卡片;
2599
+ * - 关闭后客户端**完全不发请求**,所以不产生任何辅助模型 token 花费(不需要 Host 侧再校验一次);
2600
+ * - `hostAllowed` 来自 Host 状态端点:profile 的 `cordis.patch.yml` 给 `codex-ui-composer`
2601
+ * 配 `config: { prediction: false }` 时会被置为 `false`,此时用户开关置灰(fail-closed,
2602
+ * 站点管理员意志优先,等价于主题子插件的 `subPluginEnabled` 语义)。
2603
+ */
2604
+ const PREDICTION_STORAGE_KEY = "codex-ui.composer.prediction";
2605
+ /** 同一窗口内跨标签页同步(storage 事件在写入方自身不触发)。 */
2606
+ const PREDICTION_STORAGE_EVENT = "codex-ui:prediction-change";
2607
+ const listeners$1 = /* @__PURE__ */ new Set();
2608
+ function safeGetItem(key) {
2609
+ try {
2610
+ if (typeof localStorage !== "undefined") return localStorage.getItem(key);
2611
+ } catch {}
2612
+ return null;
2613
+ }
2614
+ function safeSetItem(key, value) {
2615
+ try {
2616
+ if (typeof localStorage !== "undefined") localStorage.setItem(key, value);
2617
+ } catch {}
2618
+ }
2619
+ function parseStored(raw) {
2620
+ if (raw === "off" || raw === "false" || raw === "0") return false;
2621
+ return true;
2622
+ }
2623
+ let subPluginEnabled = true;
2624
+ let userEnabled = parseStored(safeGetItem(PREDICTION_STORAGE_KEY));
2625
+ let hostAllowed = true;
2626
+ function snapshot() {
2627
+ return {
2628
+ subPluginEnabled,
2629
+ userEnabled,
2630
+ hostAllowed,
2631
+ enabled: subPluginEnabled && userEnabled && hostAllowed
2632
+ };
2633
+ }
2634
+ let cached = snapshot();
2635
+ function publish() {
2636
+ const next = snapshot();
2637
+ if (next.subPluginEnabled === cached.subPluginEnabled && next.userEnabled === cached.userEnabled && next.hostAllowed === cached.hostAllowed && next.enabled === cached.enabled) return;
2638
+ cached = next;
2639
+ for (const listener of [...listeners$1]) try {
2640
+ listener();
2641
+ } catch {}
2642
+ }
2643
+ /** 稳定的只读快照,可直接交给 `useSyncExternalStore`。 */
2644
+ function getPredictionSettingsState() {
2645
+ return cached;
2646
+ }
2647
+ function subscribePredictionSettings(listener) {
2648
+ listeners$1.add(listener);
2649
+ return () => listeners$1.delete(listener);
2650
+ }
2651
+ function setPredictionEnabled(enabled) {
2652
+ userEnabled = enabled;
2653
+ safeSetItem(PREDICTION_STORAGE_KEY, enabled ? "on" : "off");
2654
+ publish();
2655
+ if (typeof window !== "undefined" && typeof window.dispatchEvent === "function") try {
2656
+ window.dispatchEvent(new Event(PREDICTION_STORAGE_EVENT));
2657
+ } catch {}
2658
+ }
2659
+ /** Host 状态端点回报的配置位;缺省视为允许。 */
2660
+ function setHostPredictionAllowed(allowed) {
2661
+ hostAllowed = allowed;
2662
+ publish();
2663
+ }
2664
+ /** 标记 codex-ui-composer 子插件在 Host 侧的启用状态;未启用时设置卡片不渲染(对齐主题卡片)。 */
2665
+ function setSubPluginEnabled(enabled) {
2666
+ subPluginEnabled = enabled;
2667
+ publish();
2668
+ }
2669
+ /** 监听跨标签页与同窗口的设置变更。返回卸载函数。 */
2670
+ function observePredictionSettings() {
2671
+ if (typeof window === "undefined") return () => {};
2672
+ const onStorage = (event) => {
2673
+ if (event.key !== null && event.key !== "codex-ui.composer.prediction") return;
2674
+ userEnabled = parseStored(safeGetItem(PREDICTION_STORAGE_KEY));
2675
+ publish();
2676
+ };
2677
+ const onLocal = () => {
2678
+ userEnabled = parseStored(safeGetItem(PREDICTION_STORAGE_KEY));
2679
+ publish();
2680
+ };
2681
+ window.addEventListener("storage", onStorage);
2682
+ window.addEventListener(PREDICTION_STORAGE_EVENT, onLocal);
2683
+ return () => {
2684
+ window.removeEventListener("storage", onStorage);
2685
+ window.removeEventListener(PREDICTION_STORAGE_EVENT, onLocal);
2686
+ };
2687
+ }
2688
+ //#endregion
2689
+ //#region src/client/composer/ComposerSettingsCard.tsx
2690
+ /**
2691
+ * 输入框增强设置卡片。
2692
+ *
2693
+ * 只放预测开关:其他能力(↑/↓ 历史、宽度手柄、建议卡片)没有可调项,
2694
+ * 用不到就不渲染成灰项,遵循插件「不残留死配置」的既有约定。
2695
+ *
2696
+ * 站点级关闭(profile `cordis.patch.yml` 里 `config: { prediction: false }`)时,
2697
+ * 开关保持可见但置为关闭且禁用,并给出原因提示——比整卡消失更容易排查。
2698
+ */
2699
+ function ComposerSettingsCard({ t }) {
2700
+ const state = (0, react.useSyncExternalStore)(subscribePredictionSettings, getPredictionSettingsState, getPredictionSettingsState);
2701
+ if (!state.subPluginEnabled) return null;
2702
+ const lockedByHost = !state.hostAllowed;
2703
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2704
+ className: "dcu-section-card dcu-composer-settings",
2705
+ "aria-label": t("composer.title"),
2706
+ children: [
2707
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: SECTION_CARD_CSS + SETTINGS_ROW_CSS }),
2708
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2709
+ className: "dcu-section-header",
2710
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2711
+ className: "dcu-section-title-wrap",
2712
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
2713
+ className: "dcu-section-title",
2714
+ children: t("composer.title")
2715
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2716
+ className: "dcu-section-desc",
2717
+ children: t("composer.desc")
2718
+ })]
2719
+ })
2720
+ }),
2721
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2722
+ className: "dcu-settings-row",
2723
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2724
+ className: "dcu-settings-row-label",
2725
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2726
+ className: "dcu-settings-row-title",
2727
+ children: t("composer.prediction")
2728
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2729
+ className: "dcu-settings-row-hint",
2730
+ children: lockedByHost ? t("composer.predictionLocked") : t("composer.predictionHint")
2731
+ })]
2732
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {
2733
+ label: t("composer.prediction"),
2734
+ checked: state.enabled,
2735
+ disabled: lockedByHost,
2736
+ onChange: (checked) => {
2737
+ if (lockedByHost) return;
2738
+ setPredictionEnabled(checked);
2739
+ }
2740
+ })]
2741
+ })
2742
+ ]
2743
+ });
2744
+ }
2745
+ //#endregion
2554
2746
  //#region src/client/AboutSection.tsx
2555
2747
  const PROJECT_HOMEPAGES = Object.fromEntries(MANAGED_DEPENDENCIES.map(({ id, packageName }) => [id, id === "market" ? "https://dshmarket.com" : `https://github.com/MichengAI/${packageName.split("/")[1]}`]));
2556
2748
  const openExternal = (url) => {
@@ -2939,6 +3131,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
2939
3131
  ]
2940
3132
  }),
2941
3133
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeSettingsCard, { t }),
3134
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerSettingsCard, { t }),
2942
3135
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2943
3136
  className: "dcu-section-card dcu-card-dependencies",
2944
3137
  children: [
@@ -3238,6 +3431,11 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
3238
3431
  "sidebar.browsePlugins": "浏览更多插件",
3239
3432
  "sidebar.createPlugin": "创建你的插件",
3240
3433
  "sidebar.createPrompt": "创建一个带左侧栏入口的 DSH 插件。",
3434
+ "composer.title": "输入框增强",
3435
+ "composer.desc": "智能输入预测与行内续写;其他输入框能力(↑/↓ 历史、宽度手柄)不受影响。",
3436
+ "composer.prediction": "智能输入预测",
3437
+ "composer.predictionHint": "打字停顿时在光标后提示后续内容,按 Tab 采纳;关闭后不再发起任何请求,也不消耗模型额度。",
3438
+ "composer.predictionLocked": "已在当前 Profile 的插件配置中关闭(cordis.patch.yml → codex-ui-composer 的 prediction),此处不可开启。",
3241
3439
  "theme.title": "界面外观与换肤",
3242
3440
  "theme.desc": "定制 DeepSeek Harness 视觉风格,支持 Codex 经典配色与悬浮云母质感。",
3243
3441
  "theme.palette": "主题配色",
@@ -3427,6 +3625,11 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
3427
3625
  "sidebar.browsePlugins": "Browse other plugins",
3428
3626
  "sidebar.createPlugin": "Create your plugin",
3429
3627
  "sidebar.createPrompt": "Create a DSH plugin with a left sidebar entry.",
3628
+ "composer.title": "Composer Enhancements",
3629
+ "composer.desc": "Inline prediction and continuation for the composer; other composer features (↑/↓ history, width handles) are unaffected.",
3630
+ "composer.prediction": "Inline prediction",
3631
+ "composer.predictionHint": "Suggests what comes next at the caret after a typing pause; press Tab to accept. Turning it off stops all requests, so no model tokens are spent.",
3632
+ "composer.predictionLocked": "Disabled by this Profile's plugin config (cordis.patch.yml → codex-ui-composer prediction); it cannot be enabled here.",
3430
3633
  "theme.title": "Appearance & Themes",
3431
3634
  "theme.desc": "Customize DeepSeek Harness visual styling with Codex themes and frosted mica glass.",
3432
3635
  "theme.palette": "Theme Palette",
@@ -4187,7 +4390,7 @@ html[data-platform="darwin"] [data-shortcut-modal="settings"] > nav {
4187
4390
 
4188
4391
  .dcu-settings-back-btn,
4189
4392
  button.dcu-settings-back-btn,
4190
- [data-shortcut-modal="settings"] nav button.dcu-settings-back-btn {
4393
+ [data-shortcut-modal="settings"] > nav button.dcu-settings-back-btn {
4191
4394
  display: inline-flex !important;
4192
4395
  align-items: center !important;
4193
4396
  justify-content: center !important;
@@ -4209,7 +4412,7 @@ button.dcu-settings-back-btn,
4209
4412
 
4210
4413
  .dcu-settings-back-btn:hover,
4211
4414
  button.dcu-settings-back-btn:hover,
4212
- [data-shortcut-modal="settings"] nav button.dcu-settings-back-btn:hover {
4415
+ [data-shortcut-modal="settings"] > nav button.dcu-settings-back-btn:hover {
4213
4416
  background: var(--dsw-alias-interactive-bg-hover, rgba(255, 255, 255, 0.06)) !important;
4214
4417
  color: var(--dsw-alias-label-primary, #ffffff) !important;
4215
4418
  }
@@ -4269,7 +4472,7 @@ button.dcu-settings-back-btn:hover,
4269
4472
  }
4270
4473
 
4271
4474
  /* 导航项列表容器 */
4272
- [data-shortcut-modal="settings"] nav [class*="navList"],
4475
+ [data-shortcut-modal="settings"] > nav [class*="navList"],
4273
4476
  [data-shortcut-modal="settings"] > nav > :nth-child(2) {
4274
4477
  display: flex !important;
4275
4478
  flex-direction: column !important;
@@ -4306,7 +4509,7 @@ button.dcu-settings-back-btn:hover,
4306
4509
  }
4307
4510
 
4308
4511
  /* 导航项按钮:Codex 原生胶囊形态(Capsule) */
4309
- [data-shortcut-modal="settings"] nav button,
4512
+ [data-shortcut-modal="settings"] > nav button,
4310
4513
  [data-shortcut-modal="settings"] > nav > :nth-child(2) > button {
4311
4514
  box-sizing: border-box !important;
4312
4515
  display: flex !important;
@@ -4327,7 +4530,7 @@ button.dcu-settings-back-btn:hover,
4327
4530
  width: 100% !important;
4328
4531
  }
4329
4532
 
4330
- [data-shortcut-modal="settings"] nav button svg,
4533
+ [data-shortcut-modal="settings"] > nav button svg,
4331
4534
  [data-shortcut-modal="settings"] > nav > :nth-child(2) > button svg {
4332
4535
  width: 16px !important;
4333
4536
  height: 16px !important;
@@ -4337,21 +4540,21 @@ button.dcu-settings-back-btn:hover,
4337
4540
  transition: color 0.12s ease !important;
4338
4541
  }
4339
4542
 
4340
- [data-shortcut-modal="settings"] nav button:hover,
4543
+ [data-shortcut-modal="settings"] > nav button:hover,
4341
4544
  [data-shortcut-modal="settings"] > nav > :nth-child(2) > button:hover {
4342
4545
  background: var(--dsw-specific-sidebar-nav-item-hover, var(--dsw-alias-interactive-bg-hover, rgba(255, 255, 255, 0.05))) !important;
4343
4546
  color: var(--dsw-alias-label-primary, #ffffff) !important;
4344
4547
  }
4345
4548
 
4346
- [data-shortcut-modal="settings"] nav button:hover svg,
4549
+ [data-shortcut-modal="settings"] > nav button:hover svg,
4347
4550
  [data-shortcut-modal="settings"] > nav > :nth-child(2) > button:hover svg {
4348
4551
  color: var(--dsw-alias-label-primary, #ffffff) !important;
4349
4552
  }
4350
4553
 
4351
4554
  /* 选中菜单项:纯正 Codex 胶囊激活态(Capsule Pill) */
4352
- [data-shortcut-modal="settings"] nav button[aria-current="true"],
4353
- [data-shortcut-modal="settings"] nav button[class*="active"],
4354
- [data-shortcut-modal="settings"] nav [class*="navCell"][class*="active"],
4555
+ [data-shortcut-modal="settings"] > nav button[aria-current="true"],
4556
+ [data-shortcut-modal="settings"] > nav button[class*="active"],
4557
+ [data-shortcut-modal="settings"] > nav [class*="navCell"][class*="active"],
4355
4558
  [data-shortcut-modal="settings"] > nav > :nth-child(2) > button[aria-current="true"],
4356
4559
  [data-shortcut-modal="settings"] > nav > :nth-child(2) > button[class*="active"] {
4357
4560
  background: var(--dsw-specific-sidebar-nav-item-active, var(--dsw-alias-interactive-bg-selected, rgba(255, 255, 255, 0.10))) !important;
@@ -4359,15 +4562,15 @@ button.dcu-settings-back-btn:hover,
4359
4562
  font-weight: 500 !important;
4360
4563
  }
4361
4564
 
4362
- [data-shortcut-modal="settings"] nav button[aria-current="true"] svg,
4363
- [data-shortcut-modal="settings"] nav button[class*="active"] svg,
4364
- [data-shortcut-modal="settings"] nav [class*="navCell"][class*="active"] svg,
4565
+ [data-shortcut-modal="settings"] > nav button[aria-current="true"] svg,
4566
+ [data-shortcut-modal="settings"] > nav button[class*="active"] svg,
4567
+ [data-shortcut-modal="settings"] > nav [class*="navCell"][class*="active"] svg,
4365
4568
  [data-shortcut-modal="settings"] > nav > :nth-child(2) > button[aria-current="true"] svg,
4366
4569
  [data-shortcut-modal="settings"] > nav > :nth-child(2) > button[class*="active"] svg {
4367
4570
  color: var(--dsw-alias-label-primary, #ffffff) !important;
4368
4571
  }
4369
4572
 
4370
- [data-shortcut-modal="settings"] nav button:focus-visible,
4573
+ [data-shortcut-modal="settings"] > nav button:focus-visible,
4371
4574
  [data-shortcut-modal="settings"] > nav > :nth-child(2) > button:focus-visible {
4372
4575
  outline: 2px solid var(--dsw-alias-state-focus-ring, var(--dsw-static-deepseek-500, #4176e6)) !important;
4373
4576
  outline-offset: 1px !important;
@@ -4934,7 +5137,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
4934
5137
  max-height: 100% !important;
4935
5138
  }
4936
5139
 
4937
- [data-shortcut-modal="settings"][data-sidebar-collapsed] nav::-webkit-scrollbar,
5140
+ [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav::-webkit-scrollbar,
4938
5141
  [data-shortcut-modal="settings"][data-sidebar-collapsed] [class*="navList"]::-webkit-scrollbar {
4939
5142
  display: none !important;
4940
5143
  width: 0 !important;
@@ -5024,9 +5227,9 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
5024
5227
  }
5025
5228
 
5026
5229
  /* 导航项按钮:纯图标居中方块,对齐宿主官方首页折叠 36x36px panelRow,绝对居中无偏移 */
5027
- [data-shortcut-modal="settings"][data-sidebar-collapsed] nav button,
5230
+ [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav button,
5028
5231
  [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav > :nth-child(2) > button,
5029
- [data-shortcut-modal="settings"][data-sidebar-collapsed] nav [class*="navCell"] {
5232
+ [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav [class*="navCell"] {
5030
5233
  box-sizing: border-box !important;
5031
5234
  width: 36px !important;
5032
5235
  height: 36px !important;
@@ -5045,8 +5248,8 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
5045
5248
  }
5046
5249
 
5047
5250
  /* 仅隐藏设置菜单列表中的文字标签,绝不干涉任何图标的显示规则,100%继承展开态既定图标状态! */
5048
- [data-shortcut-modal="settings"][data-sidebar-collapsed] nav [class*="navList"] button [class*="navLabel"],
5049
- [data-shortcut-modal="settings"][data-sidebar-collapsed] nav button:not(.dcu-settings-back-btn) [class*="navLabel"] {
5251
+ [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav [class*="navList"] button [class*="navLabel"],
5252
+ [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav button:not(.dcu-settings-back-btn) [class*="navLabel"] {
5050
5253
  display: none !important;
5051
5254
  }
5052
5255
 
@@ -5077,8 +5280,8 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
5077
5280
  }
5078
5281
 
5079
5282
  /* 无论官方项目还是第三方插件,每个按钮在折叠态均保持唯一的视觉中心,不强行干涉内部已隐藏的备用 svg */
5080
- [data-shortcut-modal="settings"][data-sidebar-collapsed] nav [class*="navList"] button svg,
5081
- [data-shortcut-modal="settings"][data-sidebar-collapsed] nav [class*="navIcon"] svg {
5283
+ [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav [class*="navList"] button svg,
5284
+ [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav [class*="navIcon"] svg {
5082
5285
  margin: 0 !important;
5083
5286
  padding: 0 !important;
5084
5287
  width: 18px !important;
@@ -5390,7 +5593,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
5390
5593
  -ms-overflow-style: none !important;
5391
5594
  }
5392
5595
 
5393
- [data-shortcut-modal="settings"] nav::-webkit-scrollbar,
5596
+ [data-shortcut-modal="settings"] > nav::-webkit-scrollbar,
5394
5597
  [data-shortcut-modal="settings"] [class*="navList"]::-webkit-scrollbar {
5395
5598
  display: none !important;
5396
5599
  width: 0 !important;
@@ -5398,9 +5601,9 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
5398
5601
  }
5399
5602
 
5400
5603
  /* 导航项按钮:纯图标正方形居中卡片,尺寸统一为 36x36px 图标导轨 */
5401
- [data-shortcut-modal="settings"] nav button,
5604
+ [data-shortcut-modal="settings"] > nav button,
5402
5605
  [data-shortcut-modal="settings"] > nav > :nth-child(2) > button,
5403
- [data-shortcut-modal="settings"] nav [class*="navCell"] {
5606
+ [data-shortcut-modal="settings"] > nav [class*="navCell"] {
5404
5607
  width: 36px !important;
5405
5608
  height: 36px !important;
5406
5609
  min-width: 36px !important;
@@ -5415,14 +5618,14 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
5415
5618
  }
5416
5619
 
5417
5620
  /* 隐藏菜单项文字标签,保留居中图标,保护返回按钮 */
5418
- [data-shortcut-modal="settings"] nav [class*="navList"] button [class*="navLabel"],
5419
- [data-shortcut-modal="settings"] nav button:not(.dcu-settings-back-btn) [class*="navLabel"] {
5621
+ [data-shortcut-modal="settings"] > nav [class*="navList"] button [class*="navLabel"],
5622
+ [data-shortcut-modal="settings"] > nav button:not(.dcu-settings-back-btn) [class*="navLabel"] {
5420
5623
  display: none !important;
5421
5624
  }
5422
5625
 
5423
5626
  /* 移动端媒体查询下同样仅隐藏文字,不干涉图标 */
5424
- [data-shortcut-modal="settings"] nav [class*="navList"] button svg,
5425
- [data-shortcut-modal="settings"] nav [class*="navIcon"] svg {
5627
+ [data-shortcut-modal="settings"] > nav [class*="navList"] button svg,
5628
+ [data-shortcut-modal="settings"] > nav [class*="navIcon"] svg {
5426
5629
  margin: 0 !important;
5427
5630
  width: 18px !important;
5428
5631
  height: 18px !important;
@@ -5826,7 +6029,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
5826
6029
  * 遵循与 dshmarket / dsh-automation 一致的非侵入式属性标记与 CSS mask 伪元素标准。
5827
6030
  */
5828
6031
  const CODEX_UI_NAV_MARKER = "data-dcu-nav-icon";
5829
- const NAV_ROW_SELECTOR = "[role=\"dialog\"] nav button, [data-shortcut-modal=\"settings\"] nav button";
6032
+ const NAV_ROW_SELECTOR = "[role=\"dialog\"] > nav button, [data-shortcut-modal=\"settings\"] > nav button";
5830
6033
  const STYLE_ID$3 = "dcu-settings-nav-icon-style";
5831
6034
  /** 原生 settings.section.icon 插槽图标组件 */
5832
6035
  function CodexUiNavIcon({ size = 16 }) {
@@ -7224,17 +7427,30 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
7224
7427
  return;
7225
7428
  }
7226
7429
  }
7227
- /** 探测宿主 codex-ui-composer 子组件是否处于激活状态(遵循 fail-closed 契约) */
7228
- async function checkComposerEnabled() {
7430
+ /**
7431
+ * 读取 Host 状态:子插件是否启用,以及站点级是否允许预测。
7432
+ * 网络/解析失败一律返回“全部关闭”,避免在宿主不可达时仍然悄悄花 token。
7433
+ */
7434
+ async function fetchComposerStatus() {
7229
7435
  try {
7230
7436
  const response = await fetch(CODEX_UI_API_ENDPOINTS.composer, {
7231
7437
  headers: { Accept: "application/json" },
7232
7438
  cache: "no-store"
7233
7439
  });
7234
- if (!response.ok) return false;
7235
- return (await response.json())?.enabled === true;
7440
+ if (!response.ok) return {
7441
+ enabled: false,
7442
+ prediction: false
7443
+ };
7444
+ const data = await response.json();
7445
+ return {
7446
+ enabled: data?.enabled === true,
7447
+ prediction: data?.prediction !== false
7448
+ };
7236
7449
  } catch {
7237
- return false;
7450
+ return {
7451
+ enabled: false,
7452
+ prediction: false
7453
+ };
7238
7454
  }
7239
7455
  }
7240
7456
  /** 注入 Composer 相关增强样式(新会话建议卡片) */
@@ -7299,8 +7515,10 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
7299
7515
  }, SuggestionsDock));
7300
7516
  cleaners.push(unregisterSuggestions);
7301
7517
  function PredictionSlot(props) {
7518
+ const prediction = (0, react.useSyncExternalStore)(subscribePredictionSettings, getPredictionSettingsState, getPredictionSettingsState);
7302
7519
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerPredictionOverlay, {
7303
7520
  ...props,
7521
+ enabled: prediction.enabled,
7304
7522
  ctx,
7305
7523
  t
7306
7524
  });
@@ -7312,6 +7530,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
7312
7530
  locale: NS
7313
7531
  }, PredictionSlot));
7314
7532
  cleaners.push(unregisterPrediction);
7533
+ cleaners.push(observePredictionSettings());
7315
7534
  return () => {
7316
7535
  for (const clean of cleaners.reverse()) try {
7317
7536
  clean();
@@ -7321,9 +7540,11 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
7321
7540
  };
7322
7541
  const sync = async () => {
7323
7542
  if (disposed) return;
7324
- const enabled = await checkComposerEnabled();
7543
+ const status = await fetchComposerStatus();
7325
7544
  if (disposed) return;
7326
- if (enabled) {
7545
+ setSubPluginEnabled(status.enabled);
7546
+ setHostPredictionAllowed(status.prediction);
7547
+ if (status.enabled) {
7327
7548
  if (!cleanActive) cleanActive = activate();
7328
7549
  } else {
7329
7550
  cleanActive?.();
@@ -3,11 +3,25 @@ import { Context } from "@deepseek-ai/cordis";
3
3
  declare const name = "codex-ui-composer";
4
4
  declare const inject: string[];
5
5
  declare function isSubPluginDisabledOnDisk(id: string, homeDir?: string, ctx?: Context): boolean;
6
+ type ComposerPluginConfig = {
7
+ /**
8
+ * 是否允许智能输入预测(ghost 行内建议)。
9
+ *
10
+ * 这是**站点级**开关:置为 `false` 后,Host 不注册预测引擎,客户端状态端点回报
11
+ * `prediction: false`,设置页的用户开关随之置灰。用户级开关(客户端 localStorage)
12
+ * 只能在此为 `true` 时才生效——与主题子插件的 fail-closed 语义一致。
13
+ *
14
+ * @default true
15
+ */
16
+ prediction?: boolean;
17
+ };
18
+ /** 严格读取配置:只有显式 `false` 才关闭,其余(含未声明、类型错误)一律视为开启。 */
19
+ declare function resolvePredictionAllowed(config: ComposerPluginConfig | undefined): boolean;
6
20
  /**
7
21
  * Composer 输入框增强子组件 (Host 侧)
8
- * 1. 暴露 /api/michengai/dsh-codex-ui/composer (启停状态)
9
- * 2. 暴露 /composer-prediction 与 /composer-prediction/v2 (参考插件标准流式预测)
22
+ * 1. 暴露 /api/michengai/dsh-codex-ui/composer (启停状态 + 预测开关状态)
23
+ * 2. 暴露 /composer/prediction 与 /composer/prediction/stream (流式预测)
10
24
  */
11
- declare function apply(ctx: Context): void;
25
+ declare function apply(ctx: Context, config?: ComposerPluginConfig): void;
12
26
  //#endregion
13
- export { apply, inject, isSubPluginDisabledOnDisk, name };
27
+ export { ComposerPluginConfig, apply, inject, isSubPluginDisabledOnDisk, name, resolvePredictionAllowed };
@@ -316,7 +316,7 @@ async function runPrediction(ctx, options, cache, inflight, plan, signals, onDel
316
316
  const controller = new AbortController();
317
317
  inflight.add(controller);
318
318
  try {
319
- const result = await predict(ctx, options, plan.session, plan.mode, plan.draft, joinSignals([controller.signal, ...signals]), onDelta);
319
+ const result = await predict(ctx, options, plan.session, plan.sessionId, plan.mode, plan.draft, joinSignals([controller.signal, ...signals]), onDelta);
320
320
  if (result.items.length > 0 && !controller.signal.aborted && !signals.some((signal) => signal.aborted)) remember(cache, plan.key, { items: result.items });
321
321
  return result;
322
322
  } finally {
@@ -327,7 +327,7 @@ async function runPrediction(ctx, options, cache, inflight, plan, signals, onDel
327
327
  * Run one auxiliary model call over the transcript tail and tool activity.
328
328
  * @returns `{ items }` on success or `{ items: [], reason }` when none is usable.
329
329
  */
330
- async function predict(ctx, options, session, mode, draft, signal, onDelta) {
330
+ async function predict(ctx, options, session, sessionId, mode, draft, signal, onDelta) {
331
331
  const prompt = buildPrompt(session, options, mode, draft);
332
332
  if (prompt === null) return {
333
333
  items: [],
@@ -392,6 +392,8 @@ async function predict(ctx, options, session, mode, draft, signal, onDelta) {
392
392
  ...call.config,
393
393
  messages,
394
394
  system,
395
+ sessionId,
396
+ purpose: "composer-prediction",
395
397
  signal: deadline.signal
396
398
  })) {
397
399
  deadline.signal.throwIfAborted();
@@ -737,15 +739,21 @@ const inject = ["webServer"];
737
739
  function isSubPluginDisabledOnDisk(id, homeDir, ctx) {
738
740
  return isSubPluginDisabledOnDisk$1(id, homeDir, ctx);
739
741
  }
742
+ /** 严格读取配置:只有显式 `false` 才关闭,其余(含未声明、类型错误)一律视为开启。 */
743
+ function resolvePredictionAllowed(config) {
744
+ if (config === null || typeof config !== "object") return true;
745
+ return config.prediction !== false;
746
+ }
740
747
  /**
741
748
  * Composer 输入框增强子组件 (Host 侧)
742
- * 1. 暴露 /api/michengai/dsh-codex-ui/composer (启停状态)
743
- * 2. 暴露 /composer-prediction 与 /composer-prediction/v2 (参考插件标准流式预测)
749
+ * 1. 暴露 /api/michengai/dsh-codex-ui/composer (启停状态 + 预测开关状态)
750
+ * 2. 暴露 /composer/prediction 与 /composer/prediction/stream (流式预测)
744
751
  */
745
- function apply(ctx) {
752
+ function apply(ctx, config) {
746
753
  const statusEndpoint = CODEX_UI_API_ENDPOINTS.composer;
754
+ const predictionAllowed = resolvePredictionAllowed(config);
747
755
  ctx.effect(() => {
748
- if (isSubPluginDisabledOnDisk("codex-ui-composer", void 0, ctx)) return () => {};
756
+ if (isSubPluginDisabledOnDisk("codex-ui-composer", void 0, ctx) || !predictionAllowed) return () => {};
749
757
  apply$1(ctx);
750
758
  return () => {};
751
759
  }, "michengai-codex-ui: composer predictions engine");
@@ -761,7 +769,10 @@ function apply(ctx) {
761
769
  "content-type": "application/json; charset=utf-8",
762
770
  "cache-control": "no-store"
763
771
  });
764
- response.end(JSON.stringify({ enabled: !disabled }));
772
+ response.end(JSON.stringify({
773
+ enabled: !disabled,
774
+ prediction: predictionAllowed
775
+ }));
765
776
  }
766
777
  });
767
778
  return () => {
@@ -770,4 +781,4 @@ function apply(ctx) {
770
781
  }, "michengai-codex-ui: composer state");
771
782
  }
772
783
  //#endregion
773
- export { apply, inject, isSubPluginDisabledOnDisk, name };
784
+ export { apply, inject, isSubPluginDisabledOnDisk, name, resolvePredictionAllowed };
@@ -156,6 +156,11 @@ const zh = {
156
156
  "sidebar.browsePlugins": "浏览更多插件",
157
157
  "sidebar.createPlugin": "创建你的插件",
158
158
  "sidebar.createPrompt": "创建一个带左侧栏入口的 DSH 插件。",
159
+ "composer.title": "输入框增强",
160
+ "composer.desc": "智能输入预测与行内续写;其他输入框能力(↑/↓ 历史、宽度手柄)不受影响。",
161
+ "composer.prediction": "智能输入预测",
162
+ "composer.predictionHint": "打字停顿时在光标后提示后续内容,按 Tab 采纳;关闭后不再发起任何请求,也不消耗模型额度。",
163
+ "composer.predictionLocked": "已在当前 Profile 的插件配置中关闭(cordis.patch.yml → codex-ui-composer 的 prediction),此处不可开启。",
159
164
  "theme.title": "界面外观与换肤",
160
165
  "theme.desc": "定制 DeepSeek Harness 视觉风格,支持 Codex 经典配色与悬浮云母质感。",
161
166
  "theme.palette": "主题配色",
@@ -345,6 +350,11 @@ const en = {
345
350
  "sidebar.browsePlugins": "Browse other plugins",
346
351
  "sidebar.createPlugin": "Create your plugin",
347
352
  "sidebar.createPrompt": "Create a DSH plugin with a left sidebar entry.",
353
+ "composer.title": "Composer Enhancements",
354
+ "composer.desc": "Inline prediction and continuation for the composer; other composer features (↑/↓ history, width handles) are unaffected.",
355
+ "composer.prediction": "Inline prediction",
356
+ "composer.predictionHint": "Suggests what comes next at the caret after a typing pause; press Tab to accept. Turning it off stops all requests, so no model tokens are spent.",
357
+ "composer.predictionLocked": "Disabled by this Profile's plugin config (cordis.patch.yml → codex-ui-composer prediction); it cannot be enabled here.",
348
358
  "theme.title": "Appearance & Themes",
349
359
  "theme.desc": "Customize DeepSeek Harness visual styling with Codex themes and frosted mica glass.",
350
360
  "theme.palette": "Theme Palette",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-codex-ui",
3
- "version": "2.0.14",
3
+ "version": "2.0.16",
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": {