@michengai/dsh-codex-ui 2.4.4 → 2.4.6
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 +16 -0
- package/CHANGELOG.zh-CN.md +16 -0
- package/README.de.md +1 -1
- package/README.en.md +1 -1
- package/README.es.md +1 -1
- package/README.fr.md +1 -1
- package/README.ja.md +1 -1
- package/README.md +2 -2
- package/README.pt.md +1 -1
- package/README.ru.md +1 -1
- package/README.zh-CN.md +2 -2
- package/lib/client.js +142 -29
- package/lib/composer-plugin.mjs +72 -27
- package/lib/host-services-k-J3TuxA.mjs +25 -0
- package/lib/index.d.mts +41 -1
- package/lib/index.mjs +23 -22
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.4.6] - 2026-11-25
|
|
4
|
+
|
|
5
|
+
- **Adaptive Auto-Hiding for Unused Default Workspace Section (Issue #114)**:
|
|
6
|
+
- In the plain flat view (no pinned projects and no custom sections), all built-in "Pinned" and "Projects" headers hide themselves so the sidebar falls back to the host's native flat list;
|
|
7
|
+
- In section mode, the default "Projects" header hides when it has no workspaces, freeing the vertical space it used to take up.
|
|
8
|
+
- **Isolate Floating Mica Theme Styles from Third-Party Cards and Action Tooltips (Issue #113)**:
|
|
9
|
+
- Prevented conversation header styles from spilling over into inline plugin headers (such as squad and fleet status cards), avoiding layout distortion or layering conflicts;
|
|
10
|
+
- Restored high-contrast dark backgrounds and crisp white text for conversation action tooltips (copy, branch, etc.), ensuring legibility against glass backgrounds.
|
|
11
|
+
|
|
12
|
+
## [2.4.5] - 2026-11-25
|
|
13
|
+
|
|
14
|
+
- **Improve Workspace Section Recovery and Real-Time Synchronization**:
|
|
15
|
+
- Enhanced workspace section loading to automatically restore existing section headers upon mid-session login or credential refresh without requiring a page reload;
|
|
16
|
+
- Refined the automatic save mechanism when quickly rearranging workspace sections, ensuring the newest order and membership always persist reliably;
|
|
17
|
+
- Strengthened coordination with the latest host connection authentication services for consistent stability across host environments.
|
|
18
|
+
|
|
3
19
|
## [2.4.4] - 2026-11-24
|
|
4
20
|
|
|
5
21
|
- **Full Compatibility with DeepSeek Harness 0.2.3 Series**:
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [2.4.6] - 2026-11-25
|
|
4
|
+
|
|
5
|
+
- **优化工作区分区展示与自适应隐身逻辑(Issue #114)**:
|
|
6
|
+
- 纯平铺模式(既没有置顶项目、也没有自定义分区)下,内置的「置顶」「项目」标题行全部隐身,工作区列表直接按宿主原生平铺展示;
|
|
7
|
+
- 分区模式下,未添加项目的默认「项目」分区标题行自动隐身,不再白占侧栏顶部空间;
|
|
8
|
+
- **修复云母毛玻璃主题下的第三方插件卡片与操作提示样式冲突(Issue #113)**:
|
|
9
|
+
- 修复第三方编队等插件的内容流顶栏卡片被误套用浮动顶栏样式导致的排版变形与层级遮挡问题;
|
|
10
|
+
- 修复会话底部操作栏(复制、分支等)鼠标悬停提示气泡背景色透明导致的文字看不清问题,恢复清晰统一的深色悬浮提示效果。
|
|
11
|
+
|
|
12
|
+
## [2.4.5] - 2026-11-25
|
|
13
|
+
|
|
14
|
+
- **工作区分区恢复与实时同步体验优化**:
|
|
15
|
+
- 优化工作区分区加载机制,会话中途登录或授权刷新后自动恢复已有分区列表,无需手动刷新页面;
|
|
16
|
+
- 优化快速连续拖拽调整工作区分组时的自动保存机制,确保最新调整的分组归属始终完整保存不遗漏;
|
|
17
|
+
- 增强与宿主最新连接鉴权机制的协同,提升在各类宿主环境下的运行稳定性。
|
|
18
|
+
|
|
3
19
|
## [2.4.4] - 2026-11-24
|
|
4
20
|
|
|
5
21
|
- **全面适配 DeepSeek Harness 0.2.3 最新版本**:
|
package/README.de.md
CHANGED
|
@@ -142,7 +142,7 @@ Direkte Aktionen an jeder Konversation: Anheften, Umbenennen, Als ungelesen/gele
|
|
|
142
142
|
## Host-Kompatibilität
|
|
143
143
|
|
|
144
144
|
* **Unterstützte Generationen**: Vollständige DeepSeek Harness `0.2.x`-Reihe (`>=0.2.2-rc.1 <0.3.0-0`);
|
|
145
|
-
* **Geprüfte Builds**: Alle `0.2.2` Release Candidates (`0.2.2-rc.1`–`0.2.2-rc.5`);
|
|
145
|
+
* **Geprüfte Builds**: Alle `0.2.2` Release Candidates (`0.2.2-rc.1`–`0.2.2-rc.5`) übernehmen die Prüfung aus 2.4.4; `0.2.3` (`0.2.3-alpha.2`) ist mit dem aktuellen Authentifizierungs-Fix geprüft;
|
|
146
146
|
* **Laufzeit-Anforderungen**: Node.js `^22.19.0 || >=24.0.0`, pnpm `^11.0.0`.
|
|
147
147
|
|
|
148
148
|
> ⚠️ **Wichtiger Hinweis**: Aktivieren Sie Codex UI und `ds-bot` nicht gleichzeitig, da beide Modifikationen an der Seitenleiste vornehmen.
|
package/README.en.md
CHANGED
|
@@ -147,7 +147,7 @@ Quick actions directly on session rows: Pin, Rename, Unread marker, Archive, For
|
|
|
147
147
|
## Host Compatibility
|
|
148
148
|
|
|
149
149
|
* **Supported Generations**: Full DeepSeek Harness `0.2.x` line (`>=0.2.2-rc.1 <0.3.0-0`);
|
|
150
|
-
* **Verified Builds**:
|
|
150
|
+
* **Verified Builds**: Every `0.2.2` RC (`0.2.2-rc.1`–`0.2.2-rc.5`) carries over the verification from 2.4.4; `0.2.3` (`0.2.3-alpha.2`) is verified with the current authentication fix;
|
|
151
151
|
* **Runtime Requirements**: Node.js `^22.19.0 || >=24.0.0`, pnpm `^11.0.0`.
|
|
152
152
|
|
|
153
153
|
> ⚠️ **Notice**: Do not enable Codex UI and `ds-bot` concurrently. Both redesign sidebar and session slots with overlapping layout mechanics. Disable or uninstall one before enabling the other.
|
package/README.es.md
CHANGED
|
@@ -142,7 +142,7 @@ Acciones inmediatas en cada conversación: Fijar, Renombrar, Marcar como no leí
|
|
|
142
142
|
## Compatibilidad del Host
|
|
143
143
|
|
|
144
144
|
* **Versiones Soportadas**: Familia DeepSeek Harness `0.2.x` (`>=0.2.2-rc.1 <0.3.0-0`);
|
|
145
|
-
* **Compilaciones Verificadas**: Todos los RC de `0.2.2` (`0.2.2-rc.1`–`0.2.2-rc.5`);
|
|
145
|
+
* **Compilaciones Verificadas**: Todos los RC de `0.2.2` (`0.2.2-rc.1`–`0.2.2-rc.5`) mantienen la verificación de 2.4.4; `0.2.3` (`0.2.3-alpha.2`) está verificado con la corrección de autenticación actual;
|
|
146
146
|
* **Requisitos de Entorno**: Node.js `^22.19.0 || >=24.0.0`, pnpm `^11.0.0`.
|
|
147
147
|
|
|
148
148
|
> ⚠️ **Aviso**: No active simultáneamente Codex UI y `ds-bot`. Ambos rediseñan ranuras de la barra lateral con mecánicas que pueden solaparse.
|
package/README.fr.md
CHANGED
|
@@ -142,7 +142,7 @@ Actions rapides sur chaque session : Épingler, Renommer, Marquer non lu/lu, Arc
|
|
|
142
142
|
## Compatibilité avec l'Hôte
|
|
143
143
|
|
|
144
144
|
* **Générations Prises en Charge** : Famille DeepSeek Harness `0.2.x` (`>=0.2.2-rc.1 <0.3.0-0`) ;
|
|
145
|
-
* **Versions Validées** : Toutes les versions RC de `0.2.2` (`0.2.2-rc.1`–`0.2.2-rc.5`) ;
|
|
145
|
+
* **Versions Validées** : Toutes les versions RC de `0.2.2` (`0.2.2-rc.1`–`0.2.2-rc.5`) reprennent la validation de 2.4.4 ; `0.2.3` (`0.2.3-alpha.2`) est validé avec le correctif d'authentification actuel ;
|
|
146
146
|
* **Prérequis d'Exécution** : Node.js `^22.19.0 || >=24.0.0`, pnpm `^11.0.0`.
|
|
147
147
|
|
|
148
148
|
> ⚠️ **Attention** : N'activez pas simultanément Codex UI et `ds-bot`. Les deux extensions modifient les emplacements de la barre latérale avec des risques d'interférence.
|
package/README.ja.md
CHANGED
|
@@ -142,7 +142,7 @@ Ambient Ground の拡散光グラデーションを採用した Codex Light 配
|
|
|
142
142
|
## ホスト互換性
|
|
143
143
|
|
|
144
144
|
* **サポート対象世代**:DeepSeek Harness `0.2.x` 全系(`>=0.2.2-rc.1 <0.3.0-0`);
|
|
145
|
-
* **検証済みビルド**:すべての `0.2.2` RC(`0.2.2-rc.1`~`0.2.2-rc.5
|
|
145
|
+
* **検証済みビルド**:すべての `0.2.2` RC(`0.2.2-rc.1`~`0.2.2-rc.5`)は 2.4.4 の検証結果を引き継ぎ、`0.2.3`(`0.2.3-alpha.2`)は現在の認証修正で検証済みです;
|
|
146
146
|
* **実行要件**:Node.js `^22.19.0 || >=24.0.0`、pnpm `^11.0.0`。
|
|
147
147
|
|
|
148
148
|
> ⚠️ **注意事項**:Codex UI と `ds-bot` を同時に有効化しないでください。サイドバーやセッションスロットの再設計が競合します。一方を有効にする前に、もう一方を無効化またはアンインストールしてください。
|
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
## 宿主兼容性
|
|
148
148
|
|
|
149
149
|
* **支持范围**:DeepSeek Harness `0.2.x` 全系列(`>=0.2.2-rc.1 <0.3.0-0`);
|
|
150
|
-
*
|
|
150
|
+
* **实测验证**:`0.2.2` RC 全系列(`0.2.2-rc.1`~`0.2.2-rc.5`)沿用 2.4.4 的实测结论,`0.2.3`(`0.2.3-alpha.2`)为当前认证修复后的实测版本;
|
|
151
151
|
* **环境要求**:Node.js `^22.19.0 || >=24.0.0`,pnpm `^11.0.0`。
|
|
152
152
|
|
|
153
153
|
> ⚠️ **互斥提示**:请勿同时启用 Codex UI 与 `ds-bot`。两者均重塑侧栏与主会话插槽,功能重叠。启用前请先停用或卸载另一个。
|
|
@@ -192,7 +192,7 @@ dsh --profile web --dump-config
|
|
|
192
192
|
| **调节输入框宽度** | 悬停至输入框左右边缘,拖拽蓝色手柄即可自定义最舒适的编写宽度。 |
|
|
193
193
|
| **切换主题与质感** | 打开「设置 → Codex UI」,在「界面外观与换肤」卡片单选 14 款主题,直选原版/云母模式与材质预设。 |
|
|
194
194
|
| **调整侧栏图标顺序** | 鼠标按住展开侧栏中的任意插件条目拖拽上下移动,蓝线指示放置位置,支持拖入/拖出「更多」手风琴。 |
|
|
195
|
-
| **从分区直接添加工作区** |
|
|
195
|
+
| **从分区直接添加工作区** | 在分区模式下,悬停或键盘聚焦到任意侧栏分区(「置顶」、「项目」或自定义分区)标题,点击右侧 `···` 旁的「添加工作区」图标(随宿主目录选择能力显隐),新建的工作区会自动归入该分区并展开。 |
|
|
196
196
|
| **在欢迎页搜索并切换项目** | 点击新建会话页的工作区胶囊即可直接输入,按项目名或路径即时过滤;`↑` / `↓` 移动、`Enter` 选中、`Esc` 关闭。当前项目行尾带对勾,同名项目附带最短区分路径;底部「新建项目」只在宿主提供系统目录对话框时出现(远程连接 / SSH 启动的宿主会自动隐藏)。 |
|
|
197
197
|
| **折叠/收起侧边栏** | 点击侧栏顶部折叠按钮;收缩后自动切换为 56px 原生导轨,单手盲点所有功能图标。 |
|
|
198
198
|
| **生态插件批量更新** | 在「设置 → Codex UI」底部「配套管理插件」卡片,点击「全部更新」自动安装最新配套依赖。 |
|
package/README.pt.md
CHANGED
|
@@ -142,7 +142,7 @@ Ações imediatas na lista de conversas: Fixar, Renomear, Marcar como não lido/
|
|
|
142
142
|
## Compatibilidade com o Host
|
|
143
143
|
|
|
144
144
|
* **Gerações Suportadas**: Linha completa DeepSeek Harness `0.2.x` (`>=0.2.2-rc.1 <0.3.0-0`);
|
|
145
|
-
* **Compilações Verificadas**: Todas as versões Release Candidate `0.2.2` (`0.2.2-rc.1`–`0.2.2-rc.5`);
|
|
145
|
+
* **Compilações Verificadas**: Todas as versões Release Candidate `0.2.2` (`0.2.2-rc.1`–`0.2.2-rc.5`) mantêm a verificação do 2.4.4; `0.2.3` (`0.2.3-alpha.2`) está verificado com a correção de autenticação atual;
|
|
146
146
|
* **Requisitos de Execução**: Node.js `^22.19.0 || >=24.0.0`, pnpm `^11.0.0`.
|
|
147
147
|
|
|
148
148
|
> ⚠️ **Aviso**: Não habilite o Codex UI e o `ds-bot` simultaneamente, pois ambos alteram os slots da barra lateral com potenciais conflitos.
|
package/README.ru.md
CHANGED
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
## Совместимость с хостом
|
|
143
143
|
|
|
144
144
|
* **Поддерживаемые поколения**: Семейство DeepSeek Harness `0.2.x` (`>=0.2.2-rc.1 <0.3.0-0`);
|
|
145
|
-
* **Проверенные сборки**: Все релиз-кандидаты `0.2.2` (`0.2.2-rc.1`–`0.2.2-rc.5`);
|
|
145
|
+
* **Проверенные сборки**: Все релиз-кандидаты `0.2.2` (`0.2.2-rc.1`–`0.2.2-rc.5`) сохраняют результат проверки из 2.4.4; `0.2.3` (`0.2.3-alpha.2`) проверен с текущим исправлением аутентификации;
|
|
146
146
|
* **Требования к окружению**: Node.js `^22.19.0 || >=24.0.0`, pnpm `^11.0.0`.
|
|
147
147
|
|
|
148
148
|
> ⚠️ **Предупреждение**: Не включайте одновременно Codex UI и `ds-bot`, так как они оба модифицируют боковую панель.
|
package/README.zh-CN.md
CHANGED
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
## 宿主兼容性
|
|
148
148
|
|
|
149
149
|
* **支持范围**:DeepSeek Harness `0.2.x` 全系列(`>=0.2.2-rc.1 <0.3.0-0`);
|
|
150
|
-
*
|
|
150
|
+
* **实测验证**:`0.2.2` RC 全系列(`0.2.2-rc.1`~`0.2.2-rc.5`)沿用 2.4.4 的实测结论,`0.2.3`(`0.2.3-alpha.2`)为当前认证修复后的实测版本;
|
|
151
151
|
* **环境要求**:Node.js `^22.19.0 || >=24.0.0`,pnpm `^11.0.0`。
|
|
152
152
|
|
|
153
153
|
> ⚠️ **互斥提示**:请勿同时启用 Codex UI 与 `ds-bot`。两者均重塑侧栏与主会话插槽,功能重叠。启用前请先停用或卸载另一个。
|
|
@@ -192,7 +192,7 @@ dsh --profile web --dump-config
|
|
|
192
192
|
| **调节输入框宽度** | 悬停至输入框左右边缘,拖拽蓝色手柄即可自定义最舒适的编写宽度。 |
|
|
193
193
|
| **切换主题与质感** | 打开「设置 → Codex UI」,在「界面外观与换肤」卡片单选 14 款主题,直选原版/云母模式与材质预设。 |
|
|
194
194
|
| **调整侧栏图标顺序** | 鼠标按住展开侧栏中的任意插件条目拖拽上下移动,蓝线指示放置位置,支持拖入/拖出「更多」手风琴。 |
|
|
195
|
-
| **从分区直接添加工作区** |
|
|
195
|
+
| **从分区直接添加工作区** | 在分区模式下,悬停或键盘聚焦到任意侧栏分区(「置顶」、「项目」或自定义分区)标题,点击右侧 `···` 旁的「添加工作区」图标(随宿主目录选择能力显隐),新建的工作区会自动归入该分区并展开。 |
|
|
196
196
|
| **在欢迎页搜索并切换项目** | 点击新建会话页的工作区胶囊即可直接输入,按项目名或路径即时过滤;`↑` / `↓` 移动、`Enter` 选中、`Esc` 关闭。当前项目行尾带对勾,同名项目附带最短区分路径;底部「新建项目」只在宿主提供系统目录对话框时出现(远程连接 / SSH 启动的宿主会自动隐藏)。 |
|
|
197
197
|
| **折叠/收起侧边栏** | 点击侧栏顶部折叠按钮;收缩后自动切换为 56px 原生导轨,单手盲点所有功能图标。 |
|
|
198
198
|
| **生态插件批量更新** | 在「设置 → Codex UI」底部「配套管理插件」卡片,点击「全部更新」自动安装最新配套依赖。 |
|
package/lib/client.js
CHANGED
|
@@ -443,7 +443,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
443
443
|
const GLASS_FLOAT_ATTRIBUTE = "data-dsh-glass-float";
|
|
444
444
|
const GLASS_COMPAT_ATTRIBUTE = "data-dsh-glass-compat";
|
|
445
445
|
const STYLE_TAG_ID = "dsh-codex-ui-glass-style";
|
|
446
|
-
const GLASS_COMPOSER_CSS = GLASS_CSS_TEXT.replaceAll("[data-dsh-glass-float] [data-composer-card]:before", "[data-dsh-glass-float] [data-composer-card] > [data-dcu-glass-composer-surface]").replaceAll("[data-dsh-glass-compat] [data-composer-card]:before", "[data-dsh-glass-compat] [data-composer-card] > [data-dcu-glass-composer-surface]");
|
|
446
|
+
const GLASS_COMPOSER_CSS = GLASS_CSS_TEXT.replaceAll("[data-dsh-glass-float] [data-composer-card]:before", "[data-dsh-glass-float] [data-composer-card] > [data-dcu-glass-composer-surface]").replaceAll("[data-dsh-glass-compat] [data-composer-card]:before", "[data-dsh-glass-compat] [data-composer-card] > [data-dcu-glass-composer-surface]").replaceAll("[data-dsh-glass-float] [data-phase=active] header", "[data-dsh-glass-float] [data-phase=active] header:not(.lc-pulse-header):not([class*=\"lc-\"])").replaceAll("[data-dsh-glass-float] [data-phase] header:not([class*=headerBlank])", "[data-dsh-glass-float] [data-phase] header:not([class*=headerBlank]):not(.lc-pulse-header):not([class*=\"lc-\"])").replaceAll("[data-dsh-glass-frame][data-sidebar-collapsed] [data-phase] header:not([class*=headerBlank])", "[data-dsh-glass-frame][data-sidebar-collapsed] [data-phase] header:not([class*=headerBlank]):not(.lc-pulse-header):not([class*=\"lc-\"])").replaceAll("[data-dsh-glass-float] [data-conversation-scroll] [class*=bubble]", "[data-dsh-glass-float] [data-conversation-scroll] [class*=bubble]:not([role=tooltip]):not([class*=tooltip])");
|
|
447
447
|
/** 玻璃层追加样式(拼在生成 CSS 之后,同特异性下后者胜出);导出以便契约测试断言 */
|
|
448
448
|
const GLASS_EXTRA_CSS = `
|
|
449
449
|
/* 插件页顶栏色差彻底消除:静止与滚动吸顶均保持底板透明,与全局背景底色与渐变自然融为一体;吸顶时呈现纯净磨砂与细线悬浮效果 */
|
|
@@ -497,11 +497,54 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
497
497
|
这正是「还是透」的真因:兜底模糊一直在,只是被 mask 变成惰性。
|
|
498
498
|
因此顶部遮挡改为与对标插件一致的做法:不给滚动容器加遮罩,只把顶栏自己的磨砂设为下限值,
|
|
499
499
|
让从顶栏背后穿过的正文被磨砂化开。 */
|
|
500
|
-
[data-dsh-glass-float] [data-phase] header:not([class*="headerBlank"]) {
|
|
500
|
+
[data-dsh-glass-float] [data-phase] header:not([class*="headerBlank"]):not(.lc-pulse-header):not([class*="lc-"]) {
|
|
501
501
|
backdrop-filter: blur(max(var(--dsh-glass-blur, 12px), 12px)) !important;
|
|
502
502
|
-webkit-backdrop-filter: blur(max(var(--dsh-glass-blur, 12px), 12px)) !important;
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
+
/* 防御 dsh-context 编队卡片样式污染(Issue #113):
|
|
506
|
+
.lc-pulse-header 属于编队内容流内部卡片,严禁继承宿主会话顶栏的浮动排版
|
|
507
|
+
(100% 宽 + 居中最大宽 + 卡片描边 + 20px 圆角 + z-index:8 的高层级定位)。
|
|
508
|
+
这里只把浮动顶栏注入的「定位与尺寸」回正为卡片自己的流式布局,让它在向上滚动时
|
|
509
|
+
从真正的宿主顶栏下方平滑穿过;圆角、背景、边框、阴影等第三方视觉属性一律不碰。
|
|
510
|
+
实测依据(dsh-context 已装产物):该插件内部只有这一个 <header>(class=lc-pulse-header),
|
|
511
|
+
顶栏规则原本会同时套上 width:100% / 居中 max-width / 卡片描边 / 20px 圆角 / z-index:8;
|
|
512
|
+
它还用自己的 ::after 画一条 2px 渐变底线,所以「header:after{display:none}」那条兄弟规则
|
|
513
|
+
也必须一起排除(当前靠目标串子串重叠顺带命中,用例已锁死,别改成更精确的写法)。
|
|
514
|
+
注 1:lc- 是 dsh-context 插件的类名前缀契约;第三条选择器用子串匹配覆盖
|
|
515
|
+
「外层包了一层 lc- 卡片、header 在里面」的嵌套形状。当前 dsh-context 只有上面那一个
|
|
516
|
+
header,所以它今天与第一条选择器命中同一个节点,属于结构变化时的兜底;
|
|
517
|
+
代价是它也会命中任何 lc- 容器内的 header,改动前先与 dsh-context 的实际 DOM 对一遍。
|
|
518
|
+
注 2:此重置仅限定在云母浮动模式([data-dsh-glass-float]),平铺(compat)模式下
|
|
519
|
+
不存在这些顶栏规则,绝不越界。 */
|
|
520
|
+
[data-dsh-glass-float] header.lc-pulse-header,
|
|
521
|
+
[data-dsh-glass-float] header[class*="lc-pulse-"],
|
|
522
|
+
[data-dsh-glass-float] [class*="lc-"] header {
|
|
523
|
+
position: relative !important;
|
|
524
|
+
z-index: 1 !important;
|
|
525
|
+
width: auto !important;
|
|
526
|
+
max-width: none !important;
|
|
527
|
+
margin: 0 !important;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/* 防御会话操作栏 Tooltip 气泡样式污染(Issue #113):
|
|
531
|
+
对话下方功能控件(复制、分支等)的 Tooltip 气泡挂载在会话滚动流内部,
|
|
532
|
+
严禁被 [class*=bubble] 污染为亮色透明背景导致的白底白字;
|
|
533
|
+
严格维持宿主规范的深色底板、纯白文字与统一 8px 圆角(对齐基线预设,仅限浮动模式)。 */
|
|
534
|
+
[data-dsh-glass-float] [role="tooltip"],
|
|
535
|
+
[data-dsh-glass-float] [class*="bubble"][role="tooltip"] {
|
|
536
|
+
background: var(--dsw-alias-tooltip-bg, #1e1e24) !important;
|
|
537
|
+
color: var(--dsw-alias-tooltip-label, #ffffff) !important;
|
|
538
|
+
border: none !important;
|
|
539
|
+
border-radius: var(--dsw-radius-md, 8px) !important;
|
|
540
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
|
|
541
|
+
backdrop-filter: none !important;
|
|
542
|
+
-webkit-backdrop-filter: none !important;
|
|
543
|
+
}
|
|
544
|
+
[data-dsh-glass-float] [role="tooltip"] * {
|
|
545
|
+
color: inherit !important;
|
|
546
|
+
}
|
|
547
|
+
|
|
505
548
|
/* 对齐平铺风格(Compat)防漏字规范:将云母输入框卡片底色提升为高遮蔽度的 card-raised,
|
|
506
549
|
并锁定至少 12px 高斯磨砂,将底层滚动的历史文字彻底化开为淡淡的柔和色块,杜绝锐利笔画穿透叠字 */
|
|
507
550
|
[data-dsh-glass-float] [data-composer-card] > [data-dcu-glass-composer-surface] {
|
|
@@ -10787,7 +10830,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
10787
10830
|
}
|
|
10788
10831
|
for (const root of document.querySelectorAll("[data-phase=hero]")) {
|
|
10789
10832
|
if (mounted.has(root) || !root.querySelector("[data-conversation-scroll]")) continue;
|
|
10790
|
-
const body = root.querySelector("[class*=\"_body\"]");
|
|
10833
|
+
const body = root.querySelector("[class*=\"_body\"]:has([data-conversation-scroll])") ?? root.querySelector("[class*=\"_body\"]");
|
|
10791
10834
|
const clamp = (value) => Math.min(Math.max(640, value), Math.max(640, root.clientWidth - 176));
|
|
10792
10835
|
const current = () => {
|
|
10793
10836
|
const raw = body?.style.getPropertyValue("--dsh-chat-user-width") || getComputedStyle(root).getPropertyValue("--dsh-chat-user-width") || getComputedStyle(root).getPropertyValue("--dsh-chat-content-width");
|
|
@@ -11338,7 +11381,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11338
11381
|
const cycleRef = react.default.useRef(null);
|
|
11339
11382
|
const currentRef = react.default.useRef("");
|
|
11340
11383
|
const request = react.default.useCallback(async (mode, draftText) => {
|
|
11341
|
-
if (sessionId
|
|
11384
|
+
if (!sessionId || typeof sessionId !== "string" || !sessionId.trim()) return;
|
|
11342
11385
|
if (typeof document !== "undefined" && document.hidden) return;
|
|
11343
11386
|
abortRef.current?.abort();
|
|
11344
11387
|
const controller = new AbortController();
|
|
@@ -13669,19 +13712,32 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
13669
13712
|
} else for (let index = 0; index < desired.length; index += 1) if (order[index] !== desired[index]) move(desired[index], order[index]);
|
|
13670
13713
|
return moves;
|
|
13671
13714
|
}
|
|
13715
|
+
//#endregion
|
|
13716
|
+
//#region src/client/sidebar/sections/store.ts
|
|
13717
|
+
/**
|
|
13718
|
+
* 工作区分区的客户端存取层。
|
|
13719
|
+
*
|
|
13720
|
+
* 分区结构与成员归属存在**宿主**(`/api/michengai/dsh-codex-ui/sections`),
|
|
13721
|
+
* 浏览器只用 localStorage 记折叠、展开这类视图偏好——与 Codex 的分层一致
|
|
13722
|
+
* (宿主 DB 存 `thread_sections` / `thread_section_id`,Electron atom state 存折叠与顺序偏好)。
|
|
13723
|
+
*/
|
|
13724
|
+
/** 保留失败状态,让侧栏区分访问被拒绝和宿主暂时不可用。 */
|
|
13725
|
+
var SectionsLoadError = class extends Error {
|
|
13726
|
+
status;
|
|
13727
|
+
constructor(status) {
|
|
13728
|
+
super(`Sections store unavailable: HTTP ${status}`);
|
|
13729
|
+
this.status = status;
|
|
13730
|
+
}
|
|
13731
|
+
};
|
|
13672
13732
|
let transport = {
|
|
13673
13733
|
async load() {
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
return text.trim() === "" ? null : text;
|
|
13682
|
-
} catch {
|
|
13683
|
-
return null;
|
|
13684
|
-
}
|
|
13734
|
+
const response = await fetch(CODEX_UI_API_ENDPOINTS.sections, {
|
|
13735
|
+
credentials: "same-origin",
|
|
13736
|
+
headers: { accept: "application/json" }
|
|
13737
|
+
});
|
|
13738
|
+
if (!response.ok) throw new SectionsLoadError(response.status);
|
|
13739
|
+
const text = await response.text();
|
|
13740
|
+
return text.trim() === "" ? null : text;
|
|
13685
13741
|
},
|
|
13686
13742
|
async save(body) {
|
|
13687
13743
|
try {
|
|
@@ -13699,7 +13755,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
13699
13755
|
/**
|
|
13700
13756
|
* 读取宿主里的分区文档。
|
|
13701
13757
|
*
|
|
13702
|
-
* @returns 原始 JSON
|
|
13758
|
+
* @returns 原始 JSON 文本;仅成功读取空内容时返回 `null`,读取失败时抛出异常。
|
|
13703
13759
|
*/
|
|
13704
13760
|
async function loadSectionsDocument() {
|
|
13705
13761
|
return transport.load();
|
|
@@ -13707,14 +13763,16 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
13707
13763
|
let pending;
|
|
13708
13764
|
let timer;
|
|
13709
13765
|
let inFlight;
|
|
13766
|
+
let retried = false;
|
|
13710
13767
|
async function flush() {
|
|
13711
13768
|
const body = pending;
|
|
13712
13769
|
pending = void 0;
|
|
13713
13770
|
if (body === void 0) return;
|
|
13714
|
-
if (!await transport.save(body) && pending === void 0) {
|
|
13771
|
+
if (!await transport.save(body) && !retried && pending === void 0) {
|
|
13772
|
+
retried = true;
|
|
13715
13773
|
pending = body;
|
|
13716
13774
|
scheduleSave();
|
|
13717
|
-
}
|
|
13775
|
+
} else retried = false;
|
|
13718
13776
|
}
|
|
13719
13777
|
/** 立刻把待写内容发出去(切换页面、卸载时使用)。 */
|
|
13720
13778
|
async function flushSectionsSave() {
|
|
@@ -13730,7 +13788,10 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
13730
13788
|
if (timer !== void 0) window.clearTimeout(timer);
|
|
13731
13789
|
timer = window.setTimeout(() => {
|
|
13732
13790
|
timer = void 0;
|
|
13733
|
-
if (inFlight !== void 0)
|
|
13791
|
+
if (inFlight !== void 0) {
|
|
13792
|
+
if (pending !== void 0) scheduleSave();
|
|
13793
|
+
return;
|
|
13794
|
+
}
|
|
13734
13795
|
inFlight = flush().finally(() => {
|
|
13735
13796
|
inFlight = void 0;
|
|
13736
13797
|
});
|
|
@@ -13743,6 +13804,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
13743
13804
|
*/
|
|
13744
13805
|
function scheduleSectionsSave(body) {
|
|
13745
13806
|
pending = body;
|
|
13807
|
+
retried = false;
|
|
13746
13808
|
scheduleSave();
|
|
13747
13809
|
}
|
|
13748
13810
|
//#endregion
|
|
@@ -14317,19 +14379,53 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
14317
14379
|
}
|
|
14318
14380
|
};
|
|
14319
14381
|
const domOrder = () => collectProjectBlocks(list ?? document, list).map((block) => block.workspaceId);
|
|
14382
|
+
let hostReloadAttempts = 0;
|
|
14383
|
+
const MAX_HOST_RELOAD_ATTEMPTS = 5;
|
|
14384
|
+
/** 登录 / 权限态可能在会话中途变化:401 时低频再试几次,避免「登录后分区永久消失」。 */
|
|
14385
|
+
let authReloadAttempts = 0;
|
|
14386
|
+
const MAX_AUTH_RELOAD_ATTEMPTS = 3;
|
|
14387
|
+
const AUTH_RELOAD_DELAY = 2e4;
|
|
14320
14388
|
/**
|
|
14321
14389
|
* 从宿主导入分区文档。
|
|
14322
14390
|
*
|
|
14323
|
-
*
|
|
14391
|
+
* 宿主返回 200 且内容为空(首次运行)时按默认结构启动:只有「置顶 + 项目」两个内置分区,
|
|
14324
14392
|
* 首次同步会把宿主现有工作区顺序采纳进「项目」,与以前的全新安装行为一致。
|
|
14393
|
+
* 若宿主未就绪抛出异常(503、网络错误等):不标记 sectionsLoaded,不触发 persist() 存盘,
|
|
14394
|
+
* 避免启动竞态下用空结构冲掉用户已有的真实分区,并在指数退避(最多 5 次)后安排恢复尝试。
|
|
14395
|
+
* 401 另走一条低频重试(最多 3 次、间隔 20s),覆盖「登录态在会话中途变化」的场景;
|
|
14396
|
+
* 403 / 404 这类不会自行恢复的客户端状态直接放弃,由页面重新挂载时再加载。
|
|
14325
14397
|
*/
|
|
14326
14398
|
async function loadStateFromHost() {
|
|
14327
14399
|
let raw = null;
|
|
14328
14400
|
try {
|
|
14329
14401
|
raw = await loadSectionsDocument();
|
|
14330
|
-
} catch {
|
|
14331
|
-
|
|
14402
|
+
} catch (error) {
|
|
14403
|
+
const status = error instanceof SectionsLoadError ? error.status : 0;
|
|
14404
|
+
if (status === 401) {
|
|
14405
|
+
if (!disposed && !sectionsLoaded) {
|
|
14406
|
+
if (authReloadAttempts < MAX_AUTH_RELOAD_ATTEMPTS) {
|
|
14407
|
+
authReloadAttempts++;
|
|
14408
|
+
window.setTimeout(() => {
|
|
14409
|
+
if (!disposed && !sectionsLoaded) loadStateFromHost();
|
|
14410
|
+
}, AUTH_RELOAD_DELAY);
|
|
14411
|
+
} else console.warn("[Codex UI] 工作区分区需要登录后才能加载,已停止自动重试。");
|
|
14412
|
+
}
|
|
14413
|
+
return;
|
|
14414
|
+
}
|
|
14415
|
+
if (status !== 0 && status < 500) return;
|
|
14416
|
+
if (!disposed && !sectionsLoaded) {
|
|
14417
|
+
hostReloadAttempts++;
|
|
14418
|
+
if (hostReloadAttempts <= MAX_HOST_RELOAD_ATTEMPTS) {
|
|
14419
|
+
const delay = Math.min(2e3 * Math.pow(2, hostReloadAttempts - 1), 3e4);
|
|
14420
|
+
window.setTimeout(() => {
|
|
14421
|
+
if (!disposed && !sectionsLoaded) loadStateFromHost();
|
|
14422
|
+
}, delay);
|
|
14423
|
+
} else console.warn("[Codex UI] 工作区分区宿主连接持续不可用,已停止后台恢复重试。");
|
|
14424
|
+
}
|
|
14425
|
+
return;
|
|
14332
14426
|
}
|
|
14427
|
+
hostReloadAttempts = 0;
|
|
14428
|
+
authReloadAttempts = 0;
|
|
14333
14429
|
state = normalizeSections(parseSections(raw) ?? { sections: [] });
|
|
14334
14430
|
committedState = state;
|
|
14335
14431
|
sectionsLoaded = true;
|
|
@@ -14554,13 +14650,15 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
14554
14650
|
/** 把标题按分区顺序放到各自第一个分组块前面;空分区贴着下一个分区显示。 */
|
|
14555
14651
|
function placeHeaders(blocks, layoutState = state) {
|
|
14556
14652
|
if (blocks.length === 0) {
|
|
14557
|
-
const
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
|
|
14653
|
+
for (const builtinId of [PINNED_SECTION_ID, DEFAULT_SECTION_ID]) {
|
|
14654
|
+
const stale = headers.get(builtinId);
|
|
14655
|
+
if (stale !== void 0) {
|
|
14656
|
+
stale.remove();
|
|
14657
|
+
headers.delete(builtinId);
|
|
14658
|
+
if (collapsed[builtinId] === true) {
|
|
14659
|
+
delete collapsed[builtinId];
|
|
14660
|
+
persistCollapsed();
|
|
14661
|
+
}
|
|
14564
14662
|
}
|
|
14565
14663
|
}
|
|
14566
14664
|
return;
|
|
@@ -14571,6 +14669,9 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
14571
14669
|
const ungrouped = Array.from(list?.querySelectorAll("[data-row-key=\"workspace:\"]") ?? []).map((row) => row instanceof HTMLElement ? blockOf(row, list) : null).find((block) => block !== null);
|
|
14572
14670
|
const byId = new Map(blocks.map((item) => [item.workspaceId, item.block]));
|
|
14573
14671
|
const visibleById = relocatingIds.size === 0 ? byId : new Map(blocks.filter((item) => !relocatingIds.has(item.workspaceId)).map((item) => [item.workspaceId, item.block]));
|
|
14672
|
+
const hasCustomSections = layoutState.sections.some((s) => !isBuiltinSection(s.id));
|
|
14673
|
+
const hasPinnedItems = (layoutState.sections.find((s) => s.id === "pinned")?.ids.length ?? 0) > 0;
|
|
14674
|
+
const isPartitioned = hasCustomSections || hasPinnedItems;
|
|
14574
14675
|
let reference = ungrouped ?? null;
|
|
14575
14676
|
for (let index = layoutState.sections.length - 1; index >= 0; index -= 1) {
|
|
14576
14677
|
const section = layoutState.sections[index];
|
|
@@ -14588,6 +14689,18 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
14588
14689
|
}
|
|
14589
14690
|
continue;
|
|
14590
14691
|
}
|
|
14692
|
+
if (section.id === "default" && (!isPartitioned || section.ids.length === 0)) {
|
|
14693
|
+
const stale = headers.get(DEFAULT_SECTION_ID);
|
|
14694
|
+
if (stale !== void 0) {
|
|
14695
|
+
stale.remove();
|
|
14696
|
+
headers.delete(DEFAULT_SECTION_ID);
|
|
14697
|
+
if (collapsed["default"] === true) {
|
|
14698
|
+
delete collapsed[DEFAULT_SECTION_ID];
|
|
14699
|
+
persistCollapsed();
|
|
14700
|
+
}
|
|
14701
|
+
}
|
|
14702
|
+
continue;
|
|
14703
|
+
}
|
|
14591
14704
|
const header = ensureHeader(section.id, section.name);
|
|
14592
14705
|
if (header.parentElement !== target || nextStructuralSibling(header) !== reference) target.insertBefore(header, reference);
|
|
14593
14706
|
reference = header;
|
package/lib/composer-plugin.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { r as CODEX_UI_API_ENDPOINTS, t as isSubPluginDisabledOnDisk$1 } from "./profile-resolver-DSHfL3KW.mjs";
|
|
2
|
+
import { t as captureScopedConnection } from "./host-services-k-J3TuxA.mjs";
|
|
2
3
|
//#region src/composer-prediction-format.ts
|
|
3
4
|
const PREDICTION_CUES = {
|
|
4
5
|
next: "Predict the user's next message.",
|
|
@@ -83,6 +84,24 @@ function apply$1(ctx, config) {
|
|
|
83
84
|
const options = resolveOptions(config);
|
|
84
85
|
const cache = /* @__PURE__ */ new Map();
|
|
85
86
|
const inflight = /* @__PURE__ */ new Set();
|
|
87
|
+
let injectedSessions;
|
|
88
|
+
if (typeof ctx.inject === "function") try {
|
|
89
|
+
ctx.inject(["sessions"], (sessCtx) => {
|
|
90
|
+
injectedSessions = sessCtx.sessions ?? (typeof sessCtx.get === "function" ? sessCtx.get("sessions") : void 0);
|
|
91
|
+
if (typeof sessCtx.on === "function") sessCtx.on("dispose", () => {
|
|
92
|
+
injectedSessions = void 0;
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
} catch {}
|
|
96
|
+
const scopedConnection = captureScopedConnection(ctx);
|
|
97
|
+
const servicesFallback = {
|
|
98
|
+
get sessions() {
|
|
99
|
+
return injectedSessions;
|
|
100
|
+
},
|
|
101
|
+
get connection() {
|
|
102
|
+
return scopedConnection();
|
|
103
|
+
}
|
|
104
|
+
};
|
|
86
105
|
const getWebServer = () => ctx.webServer ?? ctx.get?.("webServer");
|
|
87
106
|
ctx.effect(() => () => {
|
|
88
107
|
for (const controller of inflight) controller.abort();
|
|
@@ -96,7 +115,7 @@ function apply$1(ctx, config) {
|
|
|
96
115
|
kind: "exact",
|
|
97
116
|
path: ENDPOINT,
|
|
98
117
|
auth: "anonymous",
|
|
99
|
-
handler: (request, response) => serveJson(ctx, options, cache, inflight, request, response)
|
|
118
|
+
handler: (request, response) => serveJson(ctx, options, cache, inflight, request, response, servicesFallback)
|
|
100
119
|
});
|
|
101
120
|
});
|
|
102
121
|
ctx.effect(() => {
|
|
@@ -106,7 +125,7 @@ function apply$1(ctx, config) {
|
|
|
106
125
|
kind: "exact",
|
|
107
126
|
path: STREAM_ENDPOINT,
|
|
108
127
|
auth: "anonymous",
|
|
109
|
-
handler: (request, response) => serveStream(ctx, options, cache, inflight, request, response)
|
|
128
|
+
handler: (request, response) => serveStream(ctx, options, cache, inflight, request, response, servicesFallback)
|
|
110
129
|
});
|
|
111
130
|
});
|
|
112
131
|
}
|
|
@@ -133,9 +152,9 @@ function resolveOptions(config) {
|
|
|
133
152
|
function textOption(value, maximum) {
|
|
134
153
|
return typeof value === "string" && value.length <= maximum ? value.trim() : "";
|
|
135
154
|
}
|
|
136
|
-
async function serveJson(ctx, options, cache, inflight, request, response) {
|
|
155
|
+
async function serveJson(ctx, options, cache, inflight, request, response, servicesFallback) {
|
|
137
156
|
try {
|
|
138
|
-
const plan = await planRequest(ctx, request, response);
|
|
157
|
+
const plan = await planRequest(ctx, request, response, servicesFallback);
|
|
139
158
|
if (plan === null) return;
|
|
140
159
|
if (plan.error !== void 0) {
|
|
141
160
|
respond(response, plan.status, {
|
|
@@ -165,16 +184,18 @@ async function serveJson(ctx, options, cache, inflight, request, response) {
|
|
|
165
184
|
});
|
|
166
185
|
}
|
|
167
186
|
} catch (error) {
|
|
168
|
-
|
|
187
|
+
const reason = describeError(error);
|
|
188
|
+
ctx.logger?.warn?.("[Codex UI] 预测处理异常:%s", reason);
|
|
189
|
+
respond(response, 200, {
|
|
169
190
|
suggestion: null,
|
|
170
191
|
suggestions: [],
|
|
171
|
-
reason
|
|
192
|
+
reason
|
|
172
193
|
});
|
|
173
194
|
}
|
|
174
195
|
}
|
|
175
|
-
async function serveStream(ctx, options, cache, inflight, request, response) {
|
|
196
|
+
async function serveStream(ctx, options, cache, inflight, request, response, servicesFallback) {
|
|
176
197
|
try {
|
|
177
|
-
const plan = await planRequest(ctx, request, response);
|
|
198
|
+
const plan = await planRequest(ctx, request, response, servicesFallback);
|
|
178
199
|
if (plan === null) return;
|
|
179
200
|
if (plan.error !== void 0) {
|
|
180
201
|
respond(response, plan.status, {
|
|
@@ -217,24 +238,31 @@ async function serveStream(ctx, options, cache, inflight, request, response) {
|
|
|
217
238
|
closeStream(response);
|
|
218
239
|
}
|
|
219
240
|
} catch (error) {
|
|
241
|
+
const reason = describeError(error);
|
|
242
|
+
ctx.logger?.warn?.("[Codex UI] 预测流处理异常:%s", reason);
|
|
220
243
|
if (response.headersSent === true) closeStream(response);
|
|
221
|
-
else respond(response,
|
|
244
|
+
else respond(response, 200, {
|
|
222
245
|
suggestion: null,
|
|
223
246
|
suggestions: [],
|
|
224
|
-
reason
|
|
247
|
+
reason
|
|
225
248
|
});
|
|
226
249
|
}
|
|
227
250
|
}
|
|
228
|
-
function getService(ctx, name) {
|
|
251
|
+
function getService(ctx, name, fallback) {
|
|
229
252
|
try {
|
|
230
253
|
if (typeof ctx?.get === "function") {
|
|
231
254
|
const svc = ctx.get(name);
|
|
232
255
|
if (svc !== void 0) return svc;
|
|
233
256
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
257
|
+
} catch {}
|
|
258
|
+
try {
|
|
259
|
+
const reflectSvc = ctx?.reflect?.get?.(name, false);
|
|
260
|
+
if (reflectSvc !== void 0) return reflectSvc;
|
|
261
|
+
} catch {}
|
|
262
|
+
try {
|
|
263
|
+
if (ctx?.[name] !== void 0) return ctx[name];
|
|
264
|
+
} catch {}
|
|
265
|
+
return fallback;
|
|
238
266
|
}
|
|
239
267
|
/** Short, safe reason text for a client that only displays nothing. */
|
|
240
268
|
function describeError(error) {
|
|
@@ -245,14 +273,28 @@ function describeError(error) {
|
|
|
245
273
|
* Read and validate one request body, resolving the live Session it names.
|
|
246
274
|
* @returns `null` when the response was already written, a plan, or an error.
|
|
247
275
|
*/
|
|
248
|
-
async function planRequest(ctx, request, response) {
|
|
249
|
-
const connection = getService(ctx, "connection");
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
276
|
+
async function planRequest(ctx, request, response, servicesFallback) {
|
|
277
|
+
const connection = servicesFallback?.connection ?? getService(ctx, "connection");
|
|
278
|
+
let admission;
|
|
279
|
+
try {
|
|
280
|
+
admission = connection?.admit?.(request);
|
|
281
|
+
} catch (error) {
|
|
282
|
+
ctx.logger?.warn?.("[Codex UI] 预测请求认证异常:%s", describeError(error));
|
|
283
|
+
return {
|
|
284
|
+
status: 503,
|
|
285
|
+
error: "authentication-unavailable"
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
if (!admission || admission.rejection === 503) return {
|
|
289
|
+
status: 503,
|
|
290
|
+
error: "authentication-unavailable"
|
|
291
|
+
};
|
|
292
|
+
if (admission.rejection === 401) return {
|
|
293
|
+
status: 401,
|
|
294
|
+
error: "unauthorized"
|
|
254
295
|
};
|
|
255
|
-
|
|
296
|
+
const peer = admission.peer;
|
|
297
|
+
if (admission.rejection !== void 0 || peer?.principal?.kind !== "owner") return {
|
|
256
298
|
status: 403,
|
|
257
299
|
error: "forbidden"
|
|
258
300
|
};
|
|
@@ -290,11 +332,14 @@ async function planRequest(ctx, request, response) {
|
|
|
290
332
|
status: 400,
|
|
291
333
|
error: "missing-session"
|
|
292
334
|
};
|
|
293
|
-
const sessions = getService(ctx, "sessions");
|
|
294
|
-
if (!sessions || typeof sessions.get !== "function")
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
335
|
+
const sessions = getService(ctx, "sessions", servicesFallback?.sessions);
|
|
336
|
+
if (!sessions || typeof sessions.get !== "function") {
|
|
337
|
+
ctx.logger?.warn?.("[Codex UI] 预测请求跳过:未找到有效的 sessions 服务。");
|
|
338
|
+
return {
|
|
339
|
+
status: 200,
|
|
340
|
+
error: "no-sessions-service"
|
|
341
|
+
};
|
|
342
|
+
}
|
|
298
343
|
const session = sessions.get(sessionId);
|
|
299
344
|
if (session === void 0) return {
|
|
300
345
|
status: 200,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/host-services.ts
|
|
2
|
+
/** 新宿主的 admit 会访问关联认证服务;仅此子作用域依赖它,旧宿主不受启动门控。 */
|
|
3
|
+
function captureScopedConnection(ctx) {
|
|
4
|
+
let connection;
|
|
5
|
+
ctx.inject?.(["connection", "connection.authentication"], (authCtx) => {
|
|
6
|
+
authCtx.effect(() => {
|
|
7
|
+
connection = authCtx.get("connection");
|
|
8
|
+
return () => {
|
|
9
|
+
connection = void 0;
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
return () => connection;
|
|
14
|
+
}
|
|
15
|
+
function requireService(ctx, key, method) {
|
|
16
|
+
const service = ctx.get(key);
|
|
17
|
+
if (service === null || typeof service !== "object" || typeof service[method] !== "function") throw new Error(`michengai-codex-ui 需要宿主服务 “${key}.${String(method)}”`);
|
|
18
|
+
return service;
|
|
19
|
+
}
|
|
20
|
+
/** 在唯一的宿主边界校验服务能力;宿主 API 变更时立即失败,不会静默返回 503。 */
|
|
21
|
+
function hostServices(ctx) {
|
|
22
|
+
return { webServer: requireService(ctx, "webServer", "register") };
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { hostServices as n, captureScopedConnection as t };
|
package/lib/index.d.mts
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
//#region src/host-services.d.ts
|
|
3
|
+
type HttpRequest = {
|
|
4
|
+
method?: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
/** Node 原生请求头(小写键名),用于跨站请求判定。 */
|
|
7
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
8
|
+
[Symbol.asyncIterator]?: () => AsyncIterator<Uint8Array | string>;
|
|
9
|
+
};
|
|
10
|
+
type ConnectionServiceLike = {
|
|
11
|
+
requestRejection?: (request: {
|
|
12
|
+
headers?: HttpRequest['headers'];
|
|
13
|
+
}) => 401 | 403 | undefined;
|
|
14
|
+
admit?: (request: {
|
|
15
|
+
headers?: HttpRequest['headers'];
|
|
16
|
+
}) => {
|
|
17
|
+
rejection?: 401 | 403 | 503;
|
|
18
|
+
peer?: unknown;
|
|
19
|
+
} | undefined;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
2
22
|
//#region src/index.d.ts
|
|
3
23
|
/**
|
|
4
24
|
* composer 子插件被停用时,由主插件补一个只读状态兜底端点。
|
|
@@ -22,8 +42,28 @@ declare function publicDependencyError(error: unknown): string;
|
|
|
22
42
|
declare class RequestBodyTooLargeError extends Error {}
|
|
23
43
|
/** 有界读取 Node HTTP body;偏好接口只接受很小的 JSON。 */
|
|
24
44
|
declare function readRequestBody(request: HostRequest, maxBytes?: number): Promise<string>;
|
|
45
|
+
type HostResponse = {
|
|
46
|
+
writeHead(status: number, headers?: Record<string, string>): void;
|
|
47
|
+
end(body?: string): void;
|
|
48
|
+
};
|
|
49
|
+
type AuthenticationStatus = 401 | 403 | 503;
|
|
50
|
+
type AuthenticationErrorBody = (status: AuthenticationStatus, message: string) => Record<string, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* 解析可用于校验业务请求的连接服务。
|
|
53
|
+
*
|
|
54
|
+
* @internal 仅供用例直接验收宿主契约,不属于本包的公开 API。
|
|
55
|
+
*/
|
|
56
|
+
declare function resolveConnectionService(ctx: Context, injectedConn?: ConnectionServiceLike): ConnectionServiceLike | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* 所有业务 REST 依赖 connection >=0.1.2-rc.1 的 Host/Origin/Fetch Metadata 与登录检查。
|
|
59
|
+
* 必须在读取请求体及执行副作用前调用;不得将 undefined 以外的拒绝结果当作放行。
|
|
60
|
+
* 发布包信任边界由 tests/business-rest-auth.assert.ts 的真实宿主契约用例验证。
|
|
61
|
+
*
|
|
62
|
+
* @internal 仅供用例直接验收宿主契约,不属于本包的公开 API。
|
|
63
|
+
*/
|
|
64
|
+
declare function authenticateBusinessRequest(ctx: Context, request: HostRequest, response: HostResponse, errorBody?: AuthenticationErrorBody, peer?: unknown, localConnection?: ConnectionServiceLike): boolean;
|
|
25
65
|
declare const inject: string[];
|
|
26
66
|
/** 提供不泄露地址、命令和凭证的连接器目录。 */
|
|
27
67
|
declare function apply(ctx: Context): void;
|
|
28
68
|
//#endregion
|
|
29
|
-
export { RequestBodyTooLargeError, apply, inject, publicDependencyError, readRequestBody, registerComposerStatusFallback };
|
|
69
|
+
export { type ConnectionServiceLike, RequestBodyTooLargeError, apply, authenticateBusinessRequest, inject, publicDependencyError, readRequestBody, registerComposerStatusFallback, resolveConnectionService };
|
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { n as resolveCurrentProfile, r as CODEX_UI_API_ENDPOINTS, t as isSubPluginDisabledOnDisk } from "./profile-resolver-DSHfL3KW.mjs";
|
|
2
|
+
import { n as hostServices, t as captureScopedConnection } from "./host-services-k-J3TuxA.mjs";
|
|
2
3
|
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
4
|
import { readFile } from "node:fs/promises";
|
|
4
5
|
import { homedir } from "node:os";
|
|
@@ -544,17 +545,6 @@ async function installDependenciesLocked(ids, runtime) {
|
|
|
544
545
|
}
|
|
545
546
|
}
|
|
546
547
|
//#endregion
|
|
547
|
-
//#region src/host-services.ts
|
|
548
|
-
function requireService(ctx, key, method) {
|
|
549
|
-
const service = ctx.get(key);
|
|
550
|
-
if (service === null || typeof service !== "object" || typeof service[method] !== "function") throw new Error(`michengai-codex-ui 需要宿主服务 “${key}.${String(method)}”`);
|
|
551
|
-
return service;
|
|
552
|
-
}
|
|
553
|
-
/** 在唯一的宿主边界校验服务能力;宿主 API 变更时立即失败,不会静默返回 503。 */
|
|
554
|
-
function hostServices(ctx) {
|
|
555
|
-
return { webServer: requireService(ctx, "webServer", "register") };
|
|
556
|
-
}
|
|
557
|
-
//#endregion
|
|
558
548
|
//#region src/sections-store.ts
|
|
559
549
|
/**
|
|
560
550
|
* 工作区分区的宿主侧存储。
|
|
@@ -723,11 +713,23 @@ async function readRequestBody(request, maxBytes = 32768) {
|
|
|
723
713
|
return Buffer.concat(chunks).toString("utf8");
|
|
724
714
|
}
|
|
725
715
|
/**
|
|
716
|
+
* 解析可用于校验业务请求的连接服务。
|
|
717
|
+
*
|
|
718
|
+
* @internal 仅供用例直接验收宿主契约,不属于本包的公开 API。
|
|
719
|
+
*/
|
|
720
|
+
function resolveConnectionService(ctx, injectedConn) {
|
|
721
|
+
if (injectedConn && (typeof injectedConn.admit === "function" || typeof injectedConn.requestRejection === "function")) return injectedConn;
|
|
722
|
+
const connection = ctx.get?.("connection");
|
|
723
|
+
if (connection && (typeof connection.admit === "function" || typeof connection.requestRejection === "function")) return connection;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
726
|
* 所有业务 REST 依赖 connection >=0.1.2-rc.1 的 Host/Origin/Fetch Metadata 与登录检查。
|
|
727
727
|
* 必须在读取请求体及执行副作用前调用;不得将 undefined 以外的拒绝结果当作放行。
|
|
728
728
|
* 发布包信任边界由 tests/business-rest-auth.assert.ts 的真实宿主契约用例验证。
|
|
729
|
+
*
|
|
730
|
+
* @internal 仅供用例直接验收宿主契约,不属于本包的公开 API。
|
|
729
731
|
*/
|
|
730
|
-
function authenticateBusinessRequest(ctx, request, response, errorBody = (_status, message) => ({ error: message }), peer) {
|
|
732
|
+
function authenticateBusinessRequest(ctx, request, response, errorBody = (_status, message) => ({ error: message }), peer, localConnection) {
|
|
731
733
|
if (peer) return true;
|
|
732
734
|
const reject = (status, message) => {
|
|
733
735
|
response.writeHead(status, {
|
|
@@ -738,7 +740,7 @@ function authenticateBusinessRequest(ctx, request, response, errorBody = (_statu
|
|
|
738
740
|
return false;
|
|
739
741
|
};
|
|
740
742
|
try {
|
|
741
|
-
const connection = ctx
|
|
743
|
+
const connection = resolveConnectionService(ctx, localConnection);
|
|
742
744
|
if (!connection || typeof connection.requestRejection !== "function" && typeof connection.admit !== "function") {
|
|
743
745
|
ctx.logger.warn("Codex UI 业务 REST 认证不可用:缺少 connection 认证接口。");
|
|
744
746
|
return reject(503, "宿主认证服务暂不可用。");
|
|
@@ -747,13 +749,11 @@ function authenticateBusinessRequest(ctx, request, response, errorBody = (_statu
|
|
|
747
749
|
if (typeof connection.admit === "function") {
|
|
748
750
|
const admission = connection.admit(request);
|
|
749
751
|
if (admission && typeof admission === "object") {
|
|
750
|
-
if ("rejection" in admission)
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
}
|
|
754
|
-
}
|
|
752
|
+
if ("rejection" in admission && admission.rejection !== void 0) rejection = admission.rejection;
|
|
753
|
+
else if (!("peer" in admission) || !admission.peer) rejection = 403;
|
|
754
|
+
} else rejection = 503;
|
|
755
755
|
} else if (typeof connection.requestRejection === "function") rejection = connection.requestRejection(request);
|
|
756
|
-
if (rejection !== void 0) return reject(rejection, rejection === 401 ? "请先登录 DSH。" : "已拒绝不可信或跨站请求。");
|
|
756
|
+
if (rejection !== void 0) return reject(rejection, rejection === 401 ? "请先登录 DSH。" : rejection === 503 ? "宿主认证服务暂不可用。" : "已拒绝不可信或跨站请求。");
|
|
757
757
|
return true;
|
|
758
758
|
} catch (error) {
|
|
759
759
|
const reason = error instanceof Error ? `${error.name}: ${error.message}` : typeof error;
|
|
@@ -768,6 +768,7 @@ const inject = [
|
|
|
768
768
|
];
|
|
769
769
|
/** 提供不泄露地址、命令和凭证的连接器目录。 */
|
|
770
770
|
function apply(ctx) {
|
|
771
|
+
const scopedConnection = captureScopedConnection(ctx);
|
|
771
772
|
const host = hostServices(ctx);
|
|
772
773
|
ctx.effect(() => {
|
|
773
774
|
if (typeof ctx.on !== "function") return () => {};
|
|
@@ -787,7 +788,7 @@ function apply(ctx) {
|
|
|
787
788
|
path: dependenciesEndpoint,
|
|
788
789
|
auth: "anonymous",
|
|
789
790
|
handler: async (request, response, peer) => {
|
|
790
|
-
if (!authenticateBusinessRequest(ctx, request, response, void 0, peer)) return;
|
|
791
|
+
if (!authenticateBusinessRequest(ctx, request, response, void 0, peer, scopedConnection())) return;
|
|
791
792
|
const url = new URL(request.url ?? "/", "http://localhost");
|
|
792
793
|
try {
|
|
793
794
|
if (request.method === "GET") {
|
|
@@ -866,7 +867,7 @@ function apply(ctx) {
|
|
|
866
867
|
path: CODEX_UI_API_ENDPOINTS.sections,
|
|
867
868
|
auth: "anonymous",
|
|
868
869
|
handler: async (request, response, peer) => {
|
|
869
|
-
if (!authenticateBusinessRequest(ctx, request, response, void 0, peer)) return;
|
|
870
|
+
if (!authenticateBusinessRequest(ctx, request, response, void 0, peer, scopedConnection())) return;
|
|
870
871
|
const json = (status, body) => {
|
|
871
872
|
response.writeHead(status, {
|
|
872
873
|
"content-type": "application/json; charset=utf-8",
|
|
@@ -926,4 +927,4 @@ function apply(ctx) {
|
|
|
926
927
|
}, "michengai-codex-ui: catalogs");
|
|
927
928
|
}
|
|
928
929
|
//#endregion
|
|
929
|
-
export { RequestBodyTooLargeError, apply, inject, publicDependencyError, readRequestBody, registerComposerStatusFallback };
|
|
930
|
+
export { RequestBodyTooLargeError, apply, authenticateBusinessRequest, inject, publicDependencyError, readRequestBody, registerComposerStatusFallback, resolveConnectionService };
|
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.6",
|
|
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": {
|