@michengai/dsh-codex-ui 2.4.2 → 2.4.4
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 +21 -0
- package/CHANGELOG.zh-CN.md +21 -0
- package/lib/client.js +77 -16
- package/lib/composer-plugin.mjs +4 -0
- package/lib/desktop-menu-plugin.mjs +1 -0
- package/lib/index.d.mts +12 -1
- package/lib/index.mjs +64 -10
- package/lib/settings-skin-plugin.mjs +1 -0
- package/lib/sidebar-plugin.mjs +1 -0
- package/lib/theme-plugin.mjs +1 -0
- package/package.json +28 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.4.4] - 2026-11-24
|
|
4
|
+
|
|
5
|
+
- **Full Compatibility with DeepSeek Harness 0.2.3 Series**:
|
|
6
|
+
- Upgraded core compatibility baseline to seamlessly support DeepSeek Harness 0.2.3 and Cordis 4.2.0 runtime;
|
|
7
|
+
- Fixed an issue where custom dragged input width on new conversations did not consistently inherit across session transitions, ensuring width preferences stay seamlessly applied;
|
|
8
|
+
- Fixed an issue where background status probes and composer prediction completions could be blocked under strict host network admission policies, ensuring instant ghost suggestions.
|
|
9
|
+
- **Enhanced Modular Sidebar and Menu Compatibility**:
|
|
10
|
+
- Fully adapted to the latest modular sidebar accordion expansion, ensuring additional panel items open and switch cleanly;
|
|
11
|
+
- Refined input suggestion menu padding and attachment thumbnail spacing across light/dark themes and responsive viewports for consistent visual aesthetics.
|
|
12
|
+
|
|
13
|
+
## [2.4.3] - 2026-11-22
|
|
14
|
+
|
|
15
|
+
- **Improve Prediction Ghost Text Visibility and Layering (Issue #110)**:
|
|
16
|
+
- Fixed an issue where prediction suggestions could be obscured by card backgrounds or input containers, ensuring ghost completions remain clearly legible.
|
|
17
|
+
- **Fix Network Requests and Error Logs When Composer Feature is Disabled (Issue #112)**:
|
|
18
|
+
- Fixed an issue where disabling input composer enhancements in settings caused background probes to repeatedly log 404 errors;
|
|
19
|
+
- Probes now cleanly detect disabled state and halt unnecessary polling, keeping developer tools and network traffic clean.
|
|
20
|
+
- **Enhance Coexistence Compatibility with Third-Party Plugins on Hero Page (Issue #111)**:
|
|
21
|
+
- Fixed an issue where running alongside third-party workspace enhancement plugins could trigger conflicts and prevent hero components from rendering;
|
|
22
|
+
- Improved interface extension tolerance so workspace selection and search remain smooth and stable when multiple plugins are active.
|
|
23
|
+
|
|
3
24
|
## [2.4.2] - 2026-11-21
|
|
4
25
|
|
|
5
26
|
- **Fix Prediction Candidates Display and Control Text Filtering with Reasoning Models (Issue #108, PR #109)**:
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [2.4.4] - 2026-11-24
|
|
4
|
+
|
|
5
|
+
- **全面适配 DeepSeek Harness 0.2.3 最新版本**:
|
|
6
|
+
- 深度兼容 DeepSeek Harness 0.2.3(含 Cordis 4.2.0)最新版本,全面支持最新宿主的生命周期与路由架构,保障界面各项功能稳定流畅;
|
|
7
|
+
- 解决最新宿主下新建对话时输入框拖拽宽度可能无法正确继承的问题,确保左右拖拽调整的宽度在新建页与已有会话中无缝同步生效;
|
|
8
|
+
- 解决最新宿主网络安全鉴权策略更新后,插件探活与智能预测请求可能遭遇未授权拦截的问题,保证输入补全提示稳定即时响应。
|
|
9
|
+
- **优化侧边栏新版本兼容与交互体验**:
|
|
10
|
+
- 全面兼容最新宿主侧边栏的折叠收纳手风琴机制,支持在侧边栏扩展更多面板时平滑展开与切换;
|
|
11
|
+
- 优化深浅主题及移动端视口下建议菜单与附件缩略图的排版间距,保证视觉呼吸感与一致性。
|
|
12
|
+
|
|
13
|
+
## [2.4.3] - 2026-11-22
|
|
14
|
+
|
|
15
|
+
- **提升输入预测幽灵建议文本的层级显示效果(Issue #110)**:
|
|
16
|
+
- 修复了在部分界面卡片或复杂背景下输入预测幽灵建议文本被底层遮挡的问题,保证智能补全提示始终清晰完整可见。
|
|
17
|
+
- **修复输入框增强功能停用时的网络异常与日志报错(Issue #112)**:
|
|
18
|
+
- 修复了在设置中停用输入框增强后,系统仍会在后台探测并持续产生 404 错误的问题;
|
|
19
|
+
- 优化探活行为,停用状态下直接返回关闭状态并停止不必要的后台请求,保持控制台与网络记录干净无杂音。
|
|
20
|
+
- **增强欢迎页项目选择器与第三方插件的共存兼容性(Issue #111)**:
|
|
21
|
+
- 修复了同时启用包含工作区增强的第三方插件(如部分侧栏与文件夹分类插件)时,欢迎页项目选择器可能发生冲突导致界面加载异常的问题;
|
|
22
|
+
- 提升了界面扩展槽位的容错与兼容能力,确保多插件共存时欢迎页各项操作与搜索功能稳定流畅运行。
|
|
23
|
+
|
|
3
24
|
## [2.4.2] - 2026-11-21
|
|
4
25
|
|
|
5
26
|
- **修复输入预测在推理模型下的候选生成与显示异常(Issue #108、PR #109)**:
|
package/lib/client.js
CHANGED
|
@@ -9940,6 +9940,34 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
9940
9940
|
};
|
|
9941
9941
|
}
|
|
9942
9942
|
//#endregion
|
|
9943
|
+
//#region src/client/composer/slot-safety.ts
|
|
9944
|
+
/**
|
|
9945
|
+
* 安全注册 single slot:
|
|
9946
|
+
* 1. 当遇到同 priority 碰撞报错(例如被第三方插件占用)时,自动递减 priority 至更低档位重试:
|
|
9947
|
+
* 既规避同 priority 冲突崩溃,又在 DSH single slot 机制中以更低数值优先胜出渲染(lowest renders);
|
|
9948
|
+
* 2. 超过最大重试次数或发生不可恢复异常时安全降级,打印警告并返回 no-op 清理函数,
|
|
9949
|
+
* 确保绝不抛出未捕获异常阻塞插件后续生命周期的加载。
|
|
9950
|
+
*/
|
|
9951
|
+
function registerSingleSlotSafely(slots, options, component, maxRetries = 5) {
|
|
9952
|
+
let priority = options.priority ?? 0;
|
|
9953
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) try {
|
|
9954
|
+
return slots.register({
|
|
9955
|
+
...options,
|
|
9956
|
+
priority
|
|
9957
|
+
}, component);
|
|
9958
|
+
} catch (err) {
|
|
9959
|
+
if ((err instanceof Error ? err.message : String(err)).includes("already has a registration at priority") && attempt < maxRetries) {
|
|
9960
|
+
const nextPriority = priority - 1;
|
|
9961
|
+
console.info(`[codex-ui] single slot "${options.name}" already occupied at priority ${priority}, fallback to priority ${nextPriority} to win registration`);
|
|
9962
|
+
priority = nextPriority;
|
|
9963
|
+
continue;
|
|
9964
|
+
}
|
|
9965
|
+
console.warn(`[codex-ui] Failed to register single slot "${options.name}":`, err);
|
|
9966
|
+
return () => {};
|
|
9967
|
+
}
|
|
9968
|
+
return () => {};
|
|
9969
|
+
}
|
|
9970
|
+
//#endregion
|
|
9943
9971
|
//#region src/client/composer/input-history.ts
|
|
9944
9972
|
const HISTORY_KEY = "michengai.codex-ui.input-history.v1";
|
|
9945
9973
|
const LEGACY_HISTORY_KEY = "michengai.btw.history.v1";
|
|
@@ -10759,13 +10787,15 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
10759
10787
|
}
|
|
10760
10788
|
for (const root of document.querySelectorAll("[data-phase=hero]")) {
|
|
10761
10789
|
if (mounted.has(root) || !root.querySelector("[data-conversation-scroll]")) continue;
|
|
10790
|
+
const body = root.querySelector("[class*=\"_body\"]");
|
|
10762
10791
|
const clamp = (value) => Math.min(Math.max(640, value), Math.max(640, root.clientWidth - 176));
|
|
10763
10792
|
const current = () => {
|
|
10764
|
-
const raw = getComputedStyle(root).getPropertyValue("--dsh-chat-user-width") || getComputedStyle(root).getPropertyValue("--dsh-chat-content-width");
|
|
10793
|
+
const raw = body?.style.getPropertyValue("--dsh-chat-user-width") || getComputedStyle(root).getPropertyValue("--dsh-chat-user-width") || getComputedStyle(root).getPropertyValue("--dsh-chat-content-width");
|
|
10765
10794
|
return clamp(parseFloat(raw) || 640);
|
|
10766
10795
|
};
|
|
10767
10796
|
const publish = (width, save) => {
|
|
10768
10797
|
const value = clamp(width);
|
|
10798
|
+
body?.style.setProperty("--dsh-chat-user-width", `${value}px`);
|
|
10769
10799
|
root.style.setProperty("--dsh-chat-user-width", `${value}px`);
|
|
10770
10800
|
root.style.setProperty("--dsh-chat-content-width", `${value}px`);
|
|
10771
10801
|
if (save) try {
|
|
@@ -10775,6 +10805,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
10775
10805
|
}
|
|
10776
10806
|
};
|
|
10777
10807
|
const initialWidth = current();
|
|
10808
|
+
body?.style.setProperty("--dsh-chat-user-width", `${initialWidth}px`);
|
|
10778
10809
|
root.style.setProperty("--dsh-chat-user-width", `${initialWidth}px`);
|
|
10779
10810
|
root.style.setProperty("--dsh-chat-content-width", `${initialWidth}px`);
|
|
10780
10811
|
const handles = ["left", "right"].map((side) => {
|
|
@@ -11071,7 +11102,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11071
11102
|
whiteSpace: "nowrap",
|
|
11072
11103
|
pointerEvents: "none",
|
|
11073
11104
|
userSelect: "none",
|
|
11074
|
-
zIndex:
|
|
11105
|
+
zIndex: 8
|
|
11075
11106
|
};
|
|
11076
11107
|
/** The continuation ghost hugs its text and sits where the caret is. */
|
|
11077
11108
|
const CONTINUE_GHOST_STYLE = {
|
|
@@ -11079,7 +11110,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11079
11110
|
gap: "6px",
|
|
11080
11111
|
padding: "0 4px",
|
|
11081
11112
|
borderRadius: "4px",
|
|
11082
|
-
zIndex:
|
|
11113
|
+
zIndex: 9
|
|
11083
11114
|
};
|
|
11084
11115
|
const TEXT_STYLE = {
|
|
11085
11116
|
flex: "1 1 auto",
|
|
@@ -11735,6 +11766,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11735
11766
|
/** 新建页底部输入布局;保留宿主节点、插槽与 active 会话底部信息。 */
|
|
11736
11767
|
const NEW_CONVERSATION_STYLE = `
|
|
11737
11768
|
[data-phase=hero]:has([data-conversation-scroll]){container:dcu-new-conversation / inline-size}
|
|
11769
|
+
[data-phase=hero] [class*="_body"]{--dsh-chat-user-width:inherit}
|
|
11738
11770
|
[data-phase=hero] [data-conversation-scroll][class]{--dsh-composer-side-clearance:16px;justify-content:flex-start;scrollbar-gutter:stable both-edges}
|
|
11739
11771
|
[data-phase=hero] [data-composer-seat]{flex:1 0 auto;min-height:100%}
|
|
11740
11772
|
[data-phase=hero] [data-composer-seat]>:has([class*="_composerHero"]){display:flex;flex:1;flex-direction:column}
|
|
@@ -11795,6 +11827,9 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11795
11827
|
/**
|
|
11796
11828
|
* 读取 Host 状态:子插件是否启用,以及站点级是否允许预测。
|
|
11797
11829
|
* 网络/解析失败一律返回“全部关闭”,避免在宿主不可达时仍然悄悄花 token。
|
|
11830
|
+
*
|
|
11831
|
+
* `explicitlyDisabled` 区分两种关闭:宿主明确回答 `{ enabled: false }`(子插件被停用)
|
|
11832
|
+
* 与端点不存在/不可达(404、网关未就绪)。前者不再重试,后者允许冷启有界退避。
|
|
11798
11833
|
*/
|
|
11799
11834
|
async function fetchComposerStatus() {
|
|
11800
11835
|
try {
|
|
@@ -11804,17 +11839,20 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11804
11839
|
});
|
|
11805
11840
|
if (!response.ok) return {
|
|
11806
11841
|
enabled: false,
|
|
11807
|
-
prediction: false
|
|
11842
|
+
prediction: false,
|
|
11843
|
+
explicitlyDisabled: false
|
|
11808
11844
|
};
|
|
11809
11845
|
const data = await response.json();
|
|
11810
11846
|
return {
|
|
11811
11847
|
enabled: data?.enabled === true,
|
|
11812
|
-
prediction: data?.prediction !== false
|
|
11848
|
+
prediction: data?.prediction !== false,
|
|
11849
|
+
explicitlyDisabled: data?.enabled === false
|
|
11813
11850
|
};
|
|
11814
11851
|
} catch {
|
|
11815
11852
|
return {
|
|
11816
11853
|
enabled: false,
|
|
11817
|
-
prediction: false
|
|
11854
|
+
prediction: false,
|
|
11855
|
+
explicitlyDisabled: false
|
|
11818
11856
|
};
|
|
11819
11857
|
}
|
|
11820
11858
|
}
|
|
@@ -11897,7 +11935,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11897
11935
|
...pickerInjected
|
|
11898
11936
|
});
|
|
11899
11937
|
}
|
|
11900
|
-
const unregisterWorkspacePicker = ctx.slots.inject("conversation.hero.workspace", () => ctx.slots
|
|
11938
|
+
const unregisterWorkspacePicker = ctx.slots.inject("conversation.hero.workspace", () => registerSingleSlotSafely(ctx.slots, {
|
|
11901
11939
|
name: "conversation.hero.workspace",
|
|
11902
11940
|
priority: -100,
|
|
11903
11941
|
locale: NS
|
|
@@ -11930,21 +11968,47 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11930
11968
|
if (typeof document !== "undefined") document.querySelectorAll("[data-dcu-width-handle]").forEach((el) => el.remove());
|
|
11931
11969
|
};
|
|
11932
11970
|
};
|
|
11933
|
-
|
|
11971
|
+
let retryTimer;
|
|
11972
|
+
let startupRetryCount = 0;
|
|
11973
|
+
const MAX_STARTUP_RETRIES = 3;
|
|
11974
|
+
const clearRetry = () => {
|
|
11975
|
+
if (retryTimer !== void 0) {
|
|
11976
|
+
clearTimeout(retryTimer);
|
|
11977
|
+
retryTimer = void 0;
|
|
11978
|
+
}
|
|
11979
|
+
};
|
|
11980
|
+
const sync = async (allowStartupRetry = false) => {
|
|
11934
11981
|
if (disposed) return;
|
|
11935
11982
|
const status = await fetchComposerStatus();
|
|
11936
11983
|
if (disposed) return;
|
|
11937
11984
|
setSubPluginEnabled(status.enabled);
|
|
11938
11985
|
setHostPredictionAllowed(status.prediction);
|
|
11939
11986
|
if (status.enabled) {
|
|
11987
|
+
clearRetry();
|
|
11988
|
+
startupRetryCount = 0;
|
|
11940
11989
|
if (!cleanActive) cleanActive = activate();
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11990
|
+
return;
|
|
11991
|
+
}
|
|
11992
|
+
cleanActive?.();
|
|
11993
|
+
cleanActive = void 0;
|
|
11994
|
+
if (status.explicitlyDisabled) {
|
|
11995
|
+
clearRetry();
|
|
11996
|
+
return;
|
|
11944
11997
|
}
|
|
11998
|
+
if (allowStartupRetry && startupRetryCount < MAX_STARTUP_RETRIES) {
|
|
11999
|
+
startupRetryCount += 1;
|
|
12000
|
+
const delay = startupRetryCount * 1e3;
|
|
12001
|
+
clearRetry();
|
|
12002
|
+
retryTimer = setTimeout(() => {
|
|
12003
|
+
retryTimer = void 0;
|
|
12004
|
+
if (!disposed) sync(true);
|
|
12005
|
+
}, delay);
|
|
12006
|
+
return;
|
|
12007
|
+
}
|
|
12008
|
+
clearRetry();
|
|
11945
12009
|
};
|
|
11946
12010
|
cleanActive = activate();
|
|
11947
|
-
sync();
|
|
12011
|
+
sync(true);
|
|
11948
12012
|
const onFocus = () => {
|
|
11949
12013
|
sync();
|
|
11950
12014
|
};
|
|
@@ -11966,14 +12030,11 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11966
12030
|
subtree: true
|
|
11967
12031
|
});
|
|
11968
12032
|
}
|
|
11969
|
-
const pollTimer = setInterval(() => {
|
|
11970
|
-
if (typeof document !== "undefined" && document.visibilityState === "visible") sync();
|
|
11971
|
-
}, 15e3);
|
|
11972
12033
|
return () => {
|
|
11973
12034
|
disposed = true;
|
|
11974
12035
|
if (typeof window !== "undefined") window.removeEventListener("focus", onFocus);
|
|
11975
12036
|
observer?.disconnect();
|
|
11976
|
-
|
|
12037
|
+
clearRetry();
|
|
11977
12038
|
cleanActive?.();
|
|
11978
12039
|
cleanActive = void 0;
|
|
11979
12040
|
};
|
package/lib/composer-plugin.mjs
CHANGED
|
@@ -95,6 +95,7 @@ function apply$1(ctx, config) {
|
|
|
95
95
|
return ws.register({
|
|
96
96
|
kind: "exact",
|
|
97
97
|
path: ENDPOINT,
|
|
98
|
+
auth: "anonymous",
|
|
98
99
|
handler: (request, response) => serveJson(ctx, options, cache, inflight, request, response)
|
|
99
100
|
});
|
|
100
101
|
});
|
|
@@ -104,6 +105,7 @@ function apply$1(ctx, config) {
|
|
|
104
105
|
return ws.register({
|
|
105
106
|
kind: "exact",
|
|
106
107
|
path: STREAM_ENDPOINT,
|
|
108
|
+
auth: "anonymous",
|
|
107
109
|
handler: (request, response) => serveStream(ctx, options, cache, inflight, request, response)
|
|
108
110
|
});
|
|
109
111
|
});
|
|
@@ -885,6 +887,7 @@ function apply(ctx, config) {
|
|
|
885
887
|
const disposeStatus = webServer.register({
|
|
886
888
|
kind: "exact",
|
|
887
889
|
path: statusEndpoint,
|
|
890
|
+
auth: "anonymous",
|
|
888
891
|
handler: (_request, response) => {
|
|
889
892
|
const disabled = isSubPluginDisabledOnDisk("codex-ui-composer", void 0, ctx);
|
|
890
893
|
response.writeHead(200, {
|
|
@@ -900,6 +903,7 @@ function apply(ctx, config) {
|
|
|
900
903
|
const disposeModels = webServer.register({
|
|
901
904
|
kind: "exact",
|
|
902
905
|
path: CODEX_UI_API_ENDPOINTS.composerModels,
|
|
906
|
+
auth: "anonymous",
|
|
903
907
|
handler: async (_request, response) => {
|
|
904
908
|
try {
|
|
905
909
|
const providers = await collectModelCatalog(ctx);
|
package/lib/index.d.mts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { Context } from "@deepseek-ai/cordis";
|
|
2
2
|
//#region src/index.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* composer 子插件被停用时,由主插件补一个只读状态兜底端点。
|
|
5
|
+
*
|
|
6
|
+
* 客户端以「探活 → 启停输入框增强」驱动 UI:子插件在 cordis.patch.yml 里被停用后,
|
|
7
|
+
* 它自己注册的 `/composer` 端点随之消失,探活只能拿到 404,DevTools 里就会持续报错。
|
|
8
|
+
* 这里在磁盘配置确认停用时接管同一路径,返回 `enabled: false`,客户端据此立即收敛。
|
|
9
|
+
* 子插件启用时不注册,避免与 composer 子插件的同名路由冲突(同一时刻只应有一个注册者)。
|
|
10
|
+
*
|
|
11
|
+
* @returns 路由注销函数;未注册时返回 undefined。
|
|
12
|
+
*/
|
|
13
|
+
declare function registerComposerStatusFallback(ctx: Context): (() => void) | undefined;
|
|
3
14
|
type HostRequest = {
|
|
4
15
|
method?: string;
|
|
5
16
|
url?: string;
|
|
@@ -15,4 +26,4 @@ declare const inject: string[];
|
|
|
15
26
|
/** 提供不泄露地址、命令和凭证的连接器目录。 */
|
|
16
27
|
declare function apply(ctx: Context): void;
|
|
17
28
|
//#endregion
|
|
18
|
-
export { RequestBodyTooLargeError, apply, inject, publicDependencyError, readRequestBody };
|
|
29
|
+
export { RequestBodyTooLargeError, apply, inject, publicDependencyError, readRequestBody, registerComposerStatusFallback };
|
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as resolveCurrentProfile, r as CODEX_UI_API_ENDPOINTS } from "./profile-resolver-DSHfL3KW.mjs";
|
|
1
|
+
import { n as resolveCurrentProfile, r as CODEX_UI_API_ENDPOINTS, t as isSubPluginDisabledOnDisk } from "./profile-resolver-DSHfL3KW.mjs";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import { homedir } from "node:os";
|
|
@@ -659,6 +659,42 @@ function writeSectionsDocument(ctx, document) {
|
|
|
659
659
|
//#endregion
|
|
660
660
|
//#region src/index.ts
|
|
661
661
|
const dependenciesEndpoint = CODEX_UI_API_ENDPOINTS.dependencies;
|
|
662
|
+
/**
|
|
663
|
+
* composer 子插件被停用时,由主插件补一个只读状态兜底端点。
|
|
664
|
+
*
|
|
665
|
+
* 客户端以「探活 → 启停输入框增强」驱动 UI:子插件在 cordis.patch.yml 里被停用后,
|
|
666
|
+
* 它自己注册的 `/composer` 端点随之消失,探活只能拿到 404,DevTools 里就会持续报错。
|
|
667
|
+
* 这里在磁盘配置确认停用时接管同一路径,返回 `enabled: false`,客户端据此立即收敛。
|
|
668
|
+
* 子插件启用时不注册,避免与 composer 子插件的同名路由冲突(同一时刻只应有一个注册者)。
|
|
669
|
+
*
|
|
670
|
+
* @returns 路由注销函数;未注册时返回 undefined。
|
|
671
|
+
*/
|
|
672
|
+
function registerComposerStatusFallback(ctx) {
|
|
673
|
+
if (!isSubPluginDisabledOnDisk("codex-ui-composer", void 0, ctx)) return void 0;
|
|
674
|
+
return hostServices(ctx).webServer.register({
|
|
675
|
+
kind: "exact",
|
|
676
|
+
path: CODEX_UI_API_ENDPOINTS.composer,
|
|
677
|
+
auth: "anonymous",
|
|
678
|
+
handler: async (request, response) => {
|
|
679
|
+
if (request.method && request.method !== "GET") {
|
|
680
|
+
response.writeHead(405, {
|
|
681
|
+
"content-type": "application/json; charset=utf-8",
|
|
682
|
+
"cache-control": "no-store"
|
|
683
|
+
});
|
|
684
|
+
response.end(JSON.stringify({ error: "Method Not Allowed" }));
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
response.writeHead(200, {
|
|
688
|
+
"content-type": "application/json; charset=utf-8",
|
|
689
|
+
"cache-control": "no-store"
|
|
690
|
+
});
|
|
691
|
+
response.end(JSON.stringify({
|
|
692
|
+
enabled: false,
|
|
693
|
+
prediction: false
|
|
694
|
+
}));
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
}
|
|
662
698
|
function headerValue(headers, name) {
|
|
663
699
|
const value = headers[name];
|
|
664
700
|
if (typeof value === "string") return value;
|
|
@@ -691,7 +727,8 @@ async function readRequestBody(request, maxBytes = 32768) {
|
|
|
691
727
|
* 必须在读取请求体及执行副作用前调用;不得将 undefined 以外的拒绝结果当作放行。
|
|
692
728
|
* 发布包信任边界由 tests/business-rest-auth.assert.ts 的真实宿主契约用例验证。
|
|
693
729
|
*/
|
|
694
|
-
function authenticateBusinessRequest(ctx, request, response, errorBody = (_status, message) => ({ error: message })) {
|
|
730
|
+
function authenticateBusinessRequest(ctx, request, response, errorBody = (_status, message) => ({ error: message }), peer) {
|
|
731
|
+
if (peer) return true;
|
|
695
732
|
const reject = (status, message) => {
|
|
696
733
|
response.writeHead(status, {
|
|
697
734
|
"content-type": "application/json; charset=utf-8",
|
|
@@ -702,11 +739,20 @@ function authenticateBusinessRequest(ctx, request, response, errorBody = (_statu
|
|
|
702
739
|
};
|
|
703
740
|
try {
|
|
704
741
|
const connection = ctx.get("connection");
|
|
705
|
-
if (typeof connection
|
|
706
|
-
ctx.logger.warn("Codex UI 业务 REST 认证不可用:缺少 connection
|
|
742
|
+
if (!connection || typeof connection.requestRejection !== "function" && typeof connection.admit !== "function") {
|
|
743
|
+
ctx.logger.warn("Codex UI 业务 REST 认证不可用:缺少 connection 认证接口。");
|
|
707
744
|
return reject(503, "宿主认证服务暂不可用。");
|
|
708
745
|
}
|
|
709
|
-
|
|
746
|
+
let rejection;
|
|
747
|
+
if (typeof connection.admit === "function") {
|
|
748
|
+
const admission = connection.admit(request);
|
|
749
|
+
if (admission && typeof admission === "object") {
|
|
750
|
+
if ("rejection" in admission) {
|
|
751
|
+
const status = admission.rejection;
|
|
752
|
+
rejection = status === 503 ? 403 : status;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
} else if (typeof connection.requestRejection === "function") rejection = connection.requestRejection(request);
|
|
710
756
|
if (rejection !== void 0) return reject(rejection, rejection === 401 ? "请先登录 DSH。" : "已拒绝不可信或跨站请求。");
|
|
711
757
|
return true;
|
|
712
758
|
} catch (error) {
|
|
@@ -729,12 +775,19 @@ function apply(ctx) {
|
|
|
729
775
|
noteHostInstallState(event);
|
|
730
776
|
});
|
|
731
777
|
}, "codex-ui: host plugin-manager install state");
|
|
778
|
+
ctx.effect(() => {
|
|
779
|
+
const disposeFallback = registerComposerStatusFallback(ctx);
|
|
780
|
+
return () => {
|
|
781
|
+
disposeFallback?.();
|
|
782
|
+
};
|
|
783
|
+
}, "michengai-codex-ui: composer status fallback");
|
|
732
784
|
ctx.effect(() => {
|
|
733
785
|
const disposeDependencies = host.webServer.register({
|
|
734
786
|
kind: "exact",
|
|
735
787
|
path: dependenciesEndpoint,
|
|
736
|
-
|
|
737
|
-
|
|
788
|
+
auth: "anonymous",
|
|
789
|
+
handler: async (request, response, peer) => {
|
|
790
|
+
if (!authenticateBusinessRequest(ctx, request, response, void 0, peer)) return;
|
|
738
791
|
const url = new URL(request.url ?? "/", "http://localhost");
|
|
739
792
|
try {
|
|
740
793
|
if (request.method === "GET") {
|
|
@@ -811,8 +864,9 @@ function apply(ctx) {
|
|
|
811
864
|
const disposeSections = host.webServer.register({
|
|
812
865
|
kind: "exact",
|
|
813
866
|
path: CODEX_UI_API_ENDPOINTS.sections,
|
|
814
|
-
|
|
815
|
-
|
|
867
|
+
auth: "anonymous",
|
|
868
|
+
handler: async (request, response, peer) => {
|
|
869
|
+
if (!authenticateBusinessRequest(ctx, request, response, void 0, peer)) return;
|
|
816
870
|
const json = (status, body) => {
|
|
817
871
|
response.writeHead(status, {
|
|
818
872
|
"content-type": "application/json; charset=utf-8",
|
|
@@ -872,4 +926,4 @@ function apply(ctx) {
|
|
|
872
926
|
}, "michengai-codex-ui: catalogs");
|
|
873
927
|
}
|
|
874
928
|
//#endregion
|
|
875
|
-
export { RequestBodyTooLargeError, apply, inject, publicDependencyError, readRequestBody };
|
|
929
|
+
export { RequestBodyTooLargeError, apply, inject, publicDependencyError, readRequestBody, registerComposerStatusFallback };
|
|
@@ -15,6 +15,7 @@ function apply(ctx) {
|
|
|
15
15
|
const dispose = webServer.register({
|
|
16
16
|
kind: "exact",
|
|
17
17
|
path: endpoint,
|
|
18
|
+
auth: "anonymous",
|
|
18
19
|
handler: (_request, response) => {
|
|
19
20
|
const disabled = isSubPluginDisabledOnDisk("codex-ui-settings-skin", void 0, ctx);
|
|
20
21
|
response.writeHead(200, {
|
package/lib/sidebar-plugin.mjs
CHANGED
|
@@ -24,6 +24,7 @@ function apply(ctx) {
|
|
|
24
24
|
const dispose = webServer.register({
|
|
25
25
|
kind: "exact",
|
|
26
26
|
path: endpoint,
|
|
27
|
+
auth: "anonymous",
|
|
27
28
|
handler: (_request, response) => {
|
|
28
29
|
const disabled = isSubPluginDisabledOnDisk(SUB_PLUGIN_ID, void 0, ctx);
|
|
29
30
|
response.writeHead(200, {
|
package/lib/theme-plugin.mjs
CHANGED
|
@@ -24,6 +24,7 @@ function apply(ctx) {
|
|
|
24
24
|
const dispose = webServer.register({
|
|
25
25
|
kind: "exact",
|
|
26
26
|
path: endpoint,
|
|
27
|
+
auth: "anonymous",
|
|
27
28
|
handler: (_request, response) => {
|
|
28
29
|
const disabled = isSubPluginDisabledOnDisk(SUB_PLUGIN_ID, void 0, ctx);
|
|
29
30
|
response.writeHead(200, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michengai/dsh-codex-ui",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
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": {
|
|
@@ -153,33 +153,33 @@
|
|
|
153
153
|
"react-dom": "^18.2.0"
|
|
154
154
|
},
|
|
155
155
|
"devDependencies": {
|
|
156
|
-
"@deepseek-ai/cordis": "4.
|
|
157
|
-
"@deepseek-ai/dsh-api-session-controller": "0.2.
|
|
158
|
-
"@deepseek-ai/dsh-api-workspace-controller": "0.2.
|
|
159
|
-
"@deepseek-ai/dsh-attachment": "0.2.
|
|
160
|
-
"@deepseek-ai/dsh-client-connection": "0.2.
|
|
161
|
-
"@deepseek-ai/dsh-client-locale": "0.2.
|
|
162
|
-
"@deepseek-ai/dsh-client-store": "0.2.
|
|
163
|
-
"@deepseek-ai/dsh-client-test-runtime": "0.2.
|
|
164
|
-
"@deepseek-ai/dsh-client-ui-chat": "0.2.
|
|
165
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.2.
|
|
166
|
-
"@deepseek-ai/dsh-client-ui-input-trigger": "0.2.
|
|
167
|
-
"@deepseek-ai/dsh-client-ui-layout": "0.2.
|
|
168
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.2.
|
|
169
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.2.
|
|
170
|
-
"@deepseek-ai/dsh-client-ui-session": "0.2.
|
|
171
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.2.
|
|
172
|
-
"@deepseek-ai/dsh-client-ui-settings-general": "0.2.
|
|
173
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "0.2.
|
|
174
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.2.
|
|
175
|
-
"@deepseek-ai/dsh-client-ui-theme": "0.2.
|
|
176
|
-
"@deepseek-ai/dsh-client-ui-workspace": "0.2.
|
|
177
|
-
"@deepseek-ai/dsh-scope": "0.2.
|
|
178
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
179
|
-
"@deepseek-ai/dsh-subagent": "0.2.
|
|
180
|
-
"@deepseek-ai/dsh-typert-protocol": "0.2.
|
|
181
|
-
"@deepseek-ai/dsh-util-workspace-path": "0.2.
|
|
182
|
-
"@deepseek-ai/dsh-workspace": "0.2.
|
|
156
|
+
"@deepseek-ai/cordis": "4.2.0-alpha.1",
|
|
157
|
+
"@deepseek-ai/dsh-api-session-controller": "0.2.3-alpha.2",
|
|
158
|
+
"@deepseek-ai/dsh-api-workspace-controller": "0.2.3-alpha.2",
|
|
159
|
+
"@deepseek-ai/dsh-attachment": "0.2.3-alpha.2",
|
|
160
|
+
"@deepseek-ai/dsh-client-connection": "0.2.3-alpha.2",
|
|
161
|
+
"@deepseek-ai/dsh-client-locale": "0.2.3-alpha.2",
|
|
162
|
+
"@deepseek-ai/dsh-client-store": "0.2.3-alpha.2",
|
|
163
|
+
"@deepseek-ai/dsh-client-test-runtime": "0.2.3-alpha.2",
|
|
164
|
+
"@deepseek-ai/dsh-client-ui-chat": "0.2.3-alpha.2",
|
|
165
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.2.3-alpha.2",
|
|
166
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": "0.2.3-alpha.2",
|
|
167
|
+
"@deepseek-ai/dsh-client-ui-layout": "0.2.3-alpha.2",
|
|
168
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.3-alpha.2",
|
|
169
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.3-alpha.2",
|
|
170
|
+
"@deepseek-ai/dsh-client-ui-session": "0.2.3-alpha.2",
|
|
171
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.3-alpha.2",
|
|
172
|
+
"@deepseek-ai/dsh-client-ui-settings-general": "0.2.3-alpha.2",
|
|
173
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "0.2.3-alpha.2",
|
|
174
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.3-alpha.2",
|
|
175
|
+
"@deepseek-ai/dsh-client-ui-theme": "0.2.3-alpha.2",
|
|
176
|
+
"@deepseek-ai/dsh-client-ui-workspace": "0.2.3-alpha.2",
|
|
177
|
+
"@deepseek-ai/dsh-scope": "0.2.3-alpha.2",
|
|
178
|
+
"@deepseek-ai/dsh-session": "0.2.3-alpha.2",
|
|
179
|
+
"@deepseek-ai/dsh-subagent": "0.2.3-alpha.2",
|
|
180
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.3-alpha.2",
|
|
181
|
+
"@deepseek-ai/dsh-util-workspace-path": "0.2.3-alpha.2",
|
|
182
|
+
"@deepseek-ai/dsh-workspace": "0.2.3-alpha.2",
|
|
183
183
|
"@types/jsdom": "^30.0.0",
|
|
184
184
|
"@types/node": "^26.0.0",
|
|
185
185
|
"@types/react": "~18.3.1",
|