@michengai/dsh-codex-ui 2.0.13 → 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.
@@ -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.13",
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": {
@@ -96,11 +96,13 @@
96
96
  "scripts": {
97
97
  "build": "tsc --noEmit && tsdown",
98
98
  "typecheck": "tsc --noEmit",
99
- "test": "pnpm run typecheck && vitest run && tsdown && node tests/run-assertions.mjs && pnpm run test:layout",
99
+ "test": "pnpm run typecheck && vitest run && tsdown && node tests/run-assertions.mjs && pnpm run test:layout && pnpm run test:glass && pnpm run test:settings",
100
100
  "test:host": "node scripts/verify-native-settings.mjs",
101
101
  "test:layout": "node scripts/verify-new-conversation.mjs && node scripts/verify-hero-width.mjs",
102
102
  "test:compat": "node scripts/run-compat-host.mjs",
103
- "test:fallback-host": "node scripts/verify-plugin-fallback-host.mjs"
103
+ "test:fallback-host": "node scripts/verify-plugin-fallback-host.mjs",
104
+ "test:glass": "node scripts/verify-glass-material.mjs",
105
+ "test:settings": "node scripts/verify-settings-geometry.mjs"
104
106
  },
105
107
  "peerDependencies": {
106
108
  "@deepseek-ai/cordis": ">=4.0.2 <5.0.0",
@@ -121,32 +123,32 @@
121
123
  },
122
124
  "devDependencies": {
123
125
  "@deepseek-ai/cordis": "4.0.5",
124
- "@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.3",
125
- "@deepseek-ai/dsh-api-workspace-controller": "0.2.1-rc.3",
126
- "@deepseek-ai/dsh-attachment": "0.2.1-rc.3",
127
- "@deepseek-ai/dsh-client-connection": "0.2.1-rc.3",
128
- "@deepseek-ai/dsh-client-locale": "0.2.1-rc.3",
129
- "@deepseek-ai/dsh-client-store": "0.2.1-rc.3",
130
- "@deepseek-ai/dsh-client-test-runtime": "0.2.1-rc.3",
131
- "@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.3",
132
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.3",
133
- "@deepseek-ai/dsh-client-ui-input-trigger": "0.2.1-rc.3",
134
- "@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.3",
135
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.3",
136
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.3",
137
- "@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.3",
138
- "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.3",
139
- "@deepseek-ai/dsh-client-ui-settings-general": "0.2.1-rc.3",
140
- "@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.3",
141
- "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.3",
142
- "@deepseek-ai/dsh-client-ui-theme": "0.2.1-rc.3",
143
- "@deepseek-ai/dsh-client-ui-workspace": "0.2.1-rc.3",
144
- "@deepseek-ai/dsh-scope": "0.2.1-rc.3",
145
- "@deepseek-ai/dsh-session": "0.2.1-rc.3",
146
- "@deepseek-ai/dsh-subagent": "0.2.1-rc.3",
147
- "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.3",
148
- "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.3",
149
- "@deepseek-ai/dsh-workspace": "0.2.1-rc.3",
126
+ "@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.5",
127
+ "@deepseek-ai/dsh-api-workspace-controller": "0.2.1-rc.5",
128
+ "@deepseek-ai/dsh-attachment": "0.2.1-rc.5",
129
+ "@deepseek-ai/dsh-client-connection": "0.2.1-rc.5",
130
+ "@deepseek-ai/dsh-client-locale": "0.2.1-rc.5",
131
+ "@deepseek-ai/dsh-client-store": "0.2.1-rc.5",
132
+ "@deepseek-ai/dsh-client-test-runtime": "0.2.1-rc.5",
133
+ "@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.5",
134
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.5",
135
+ "@deepseek-ai/dsh-client-ui-input-trigger": "0.2.1-rc.5",
136
+ "@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.5",
137
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.5",
138
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.5",
139
+ "@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.5",
140
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.5",
141
+ "@deepseek-ai/dsh-client-ui-settings-general": "0.2.1-rc.5",
142
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.5",
143
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.5",
144
+ "@deepseek-ai/dsh-client-ui-theme": "0.2.1-rc.5",
145
+ "@deepseek-ai/dsh-client-ui-workspace": "0.2.1-rc.5",
146
+ "@deepseek-ai/dsh-scope": "0.2.1-rc.5",
147
+ "@deepseek-ai/dsh-session": "0.2.1-rc.5",
148
+ "@deepseek-ai/dsh-subagent": "0.2.1-rc.5",
149
+ "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.5",
150
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.5",
151
+ "@deepseek-ai/dsh-workspace": "0.2.1-rc.5",
150
152
  "@types/jsdom": "^30.0.0",
151
153
  "@types/node": "^26.0.0",
152
154
  "@types/react": "~18.3.1",