@michengai/dsh-codex-ui 1.1.36 → 1.1.37

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
@@ -4,7 +4,13 @@
4
4
 
5
5
  This changelog records recent releases of DSH Codex UI. Earlier changes remain available in the [Git history](https://github.com/MichengAI/dsh-codex-ui/commits/main).
6
6
 
7
- ## Unreleased
7
+ ## 1.1.37 - 2026-10-13
8
+
9
+ - Add an Add workspace button to the Projects header, reusing the official directory picker and shortcuts (#42).
10
+ - Restore the official sidebar, settings, and automatic titles when Codex UI is disabled; handle repeated toggles and delayed official UI loading without conflicting shared slots (#42).
11
+ - Improve automatic session-title generation and recovery, and remove the routine provider-takeover warning.
12
+ - Restore standard context-menu text size, use an opaque global-search background, and correct the Connectors settings order.
13
+ - Document that Codex UI and `ds-bot` are mutually exclusive full-interface skins (#43).
8
14
 
9
15
  ## 1.1.36 - 2026-10-13
10
16
 
@@ -4,7 +4,13 @@
4
4
 
5
5
  本日志记录 DSH Codex UI 的最近发布;更早的变更可查看 [Git 提交历史](https://github.com/MichengAI/dsh-codex-ui/commits/main)。
6
6
 
7
- ## 未发布
7
+ ## 1.1.37 - 2026-10-13
8
+
9
+ - 在项目区标题栏新增「添加工作区」按钮,复用官方目录选择器和快捷键(#42)。
10
+ - 停用 Codex UI 后恢复官方侧栏、设置和自动标题;修复重复启停及官方界面加载较慢时的恢复与共享槽冲突问题(#42)。
11
+ - 改善会话自动标题生成与恢复,并移除正常接管标题提供方时的警告日志。
12
+ - 恢复菜单标准字号、修正全局搜索弹窗背景和连接器设置排序。
13
+ - 明确 Codex UI 与 `ds-bot` 为互斥的完整界面皮肤,不应同时启用(#43)。
8
14
 
9
15
  ## 1.1.36 - 2026-10-13
10
16
 
package/README.md CHANGED
@@ -24,7 +24,9 @@ Working across several projects and conversations in DSH Web? DSH Codex UI helps
24
24
 
25
25
  ## Host compatibility
26
26
 
27
- This working tree explicitly declares DSH `0.1.2-rc.1`, `0.1.5-rc.1`, `0.1.5-rc.2`, `0.1.5-rc.3`, `0.1.7-rc.1`, `0.1.7-rc.2`, `0.2.0-rc.1`, `0.2.0-rc.2`、`0.2.1-alpha.2`, and `0.2.1-alpha.2`. Development dependencies are pinned to `0.2.0-rc.2`. No code references `@deepseek-ai/dsh-client-runtime`: it is not a peer, not a client inject, and no longer a development dependency now that the settings-lifecycle spec mounts the production `SlotRegistry` from the official `@deepseek-ai/dsh-client-ui-renderer/client` bundle. Isolated host checks cover `0.1.2-rc.1`, `0.1.5-rc.1`, `0.1.5-rc.2`, `0.1.5-rc.3`, `0.1.7-rc.1`, `0.1.7-rc.2`, `0.2.0-rc.1`, `0.2.0-rc.2`、`0.2.1-alpha.2`, and `0.2.1-alpha.2`.
27
+ Version `1.1.37` explicitly declares support for DSH `0.1.2-rc.1`, `0.1.5-rc.1`, `0.1.5-rc.2`, `0.1.5-rc.3`, `0.1.7-rc.1`, `0.1.7-rc.2`, `0.2.0-rc.1`, `0.2.0-rc.2`, and `0.2.1-alpha.2`. Development dependencies are pinned to `0.2.0-rc.2`. Compatibility declarations do not imply that every supported host received a fresh live test in this release.
28
+
29
+ **Do not enable Codex UI and `ds-bot` together.** Both redesign the sidebar and conversation interface, so their slot ownership and layout styles overlap. Disable or uninstall one before using the other.
28
30
 
29
31
  ## What you can do
30
32
 
@@ -140,6 +142,10 @@ Check that the installation profile matches the one running DSH Web, then restar
140
142
 
141
143
  ## Development and contributing
142
144
 
145
+ 本地交接入口:[阅读导航](docs/00-交接入口/00-阅读导航.md)。本地文档沿用既有忽略策略,不随 npm 包发布。
146
+
147
+ 真实宿主启停验收使用 `pnpm run test:fallback-host`,需设置 `DCU_DSH_BIN` 指向完整宿主 CLI;该命令在隔离 profile 验证侧栏回退,不调用模型,不属于默认 `pnpm test` 的验收范围。
148
+
143
149
  GitHub and npm both include a ready-to-run `lib`. After changing source, run `pnpm build` before committing.
144
150
 
145
151
  ### Install from source
package/README.zh-CN.md CHANGED
@@ -24,7 +24,9 @@
24
24
 
25
25
  ## 宿主兼容性
26
26
 
27
- 当前工作区已显式声明支持 DSH `0.1.2-rc.1`、`0.1.5-rc.1`、`0.1.5-rc.2`、`0.1.5-rc.3`、`0.1.7-rc.1`、`0.1.7-rc.2`、`0.2.0-rc.1`、`0.2.0-rc.2`、`0.2.1-alpha.2` 或 `0.2.1-alpha.2`。开发依赖钉在 `0.2.0-rc.2`。代码已不再引用 `@deepseek-ai/dsh-client-runtime`:它既不是 peer、也不写入客户端 inject;设置生命周期用例改用官方 `@deepseek-ai/dsh-client-ui-renderer/client` 装配包里的生产 `SlotRegistry` 后,这条开发依赖也已移除。隔离宿主检查覆盖 `0.1.2-rc.1`、`0.1.5-rc.1`、`0.1.5-rc.2`、`0.1.5-rc.3`、`0.1.7-rc.1`、`0.1.7-rc.2`、`0.2.0-rc.1`、`0.2.0-rc.2`、`0.2.1-alpha.2` 或 `0.2.1-alpha.2`。
27
+ `1.1.37` 已显式声明支持 DSH `0.1.2-rc.1`、`0.1.5-rc.1`、`0.1.5-rc.2`、`0.1.5-rc.3`、`0.1.7-rc.1`、`0.1.7-rc.2`、`0.2.0-rc.1`、`0.2.0-rc.2` 和 `0.2.1-alpha.2`。开发依赖钉在 `0.2.0-rc.2`。兼容范围声明不代表本次发布重新完成了所有宿主版本的实机测试。
28
+
29
+ **不要同时启用 Codex UI 与 `ds-bot`。** 两者都重绘侧栏与会话界面,插槽归属和布局样式高度重叠。使用其中一个前,请先停用或卸载另一个。
28
30
 
29
31
  ## 你可以用它做什么
30
32
 
@@ -140,6 +142,10 @@ dsh --profile web --dump-config
140
142
 
141
143
  ## 开发与贡献
142
144
 
145
+ 本地交接与当前架构见 [阅读导航](docs/00-交接入口/00-阅读导航.md)(`docs` 为本仓库既有本地文档,不随 npm 包发布)。
146
+
147
+ `pnpm run test:fallback-host` 使用 `DCU_DSH_BIN` 指向完整宿主 CLI,在隔离 profile 验证三轮启停和重启后的官方侧栏回退,不调用模型。`pnpm test` 不包含这项真实宿主验收;全局 renderer 用例未指定宿主时显式跳过。
148
+
143
149
  GitHub 与 npm 都包含可直接运行的 `lib`。修改源码后,提交前运行 `pnpm build`。
144
150
 
145
151
  ### 从源码安装
package/cordis.patch.yml CHANGED
@@ -1,13 +1,5 @@
1
- # 桌面端 0.2 的官方侧栏会声明同一批子插槽。两边同时登记会让本插件激活失败,
2
- # 界面仍停在官方侧栏。启用时必须停用官方侧栏和设置壳,由本插件接管。
3
- # 禁用或卸载后这些行随 bundle 一起失效,官方实现回来;列宽在客户端卸载时还原。
4
- # 标题服务同时只接受一个提供方,所以仍停用官方 session-title-llm。
5
- - id: ui-sidebar
6
- disabled: true
7
- - id: ui-settings-general
8
- disabled: true
9
- - id: session-title-llm
10
- disabled: true
1
+ # 保留官方侧栏与设置壳,仅覆盖客户端渲染,停用后自动回退。
2
+ # 标题提供方的回退单独管理。
11
3
  - insert:
12
4
  - id: michengai-codex-ui-session-title
13
5
  name: '@michengai/dsh-codex-ui/session-title'
package/lib/client.js CHANGED
@@ -365,25 +365,30 @@ window.__ModuleLoader__.load({
365
365
  * 立刻声明官方也要声明的子插槽,官方注册会抛出且不会重试,停用后官方就回不来。
366
366
  * 测试夹具没有 spec,保持同步登记。
367
367
  */
368
- function registerAfterOfficialWave(slots, slot, officialReady, register) {
368
+ function registerAfterOfficialWave(slots, slot, officialReady, register, waitForOfficial = false) {
369
369
  const face = slots;
370
370
  if (typeof face.spec !== "function") return register();
371
371
  let remove = () => {};
372
372
  let done = false;
373
373
  let off = () => {};
374
- const finish = () => {
374
+ let timer;
375
+ const finish = (timedOut = false) => {
375
376
  if (done) return;
376
377
  done = true;
378
+ if (timer !== void 0) clearTimeout(timer);
377
379
  off();
378
- remove = register();
380
+ if (timedOut) console.warn(`[michengai-codex-ui] 等待官方 '${slot}' 注册超时;仅注册自有槽,保留官方共享声明。`);
381
+ remove = register(timedOut);
379
382
  };
380
383
  if (officialReady()) return register();
381
384
  off = face.subscribe?.(slot, () => {
382
- if (officialReady()) finish();
385
+ if (officialReady()) finish(false);
383
386
  }) ?? (() => {});
384
- queueMicrotask(finish);
387
+ if (!waitForOfficial) queueMicrotask(() => finish(false));
388
+ else timer = setTimeout(() => finish(true), 3e3);
385
389
  return () => {
386
390
  done = true;
391
+ if (timer !== void 0) clearTimeout(timer);
387
392
  off();
388
393
  remove();
389
394
  };
@@ -1474,6 +1479,19 @@ window.__ModuleLoader__.load({
1474
1479
  * This source code is licensed under the ISC license.
1475
1480
  * See the LICENSE file in the root directory of this source tree.
1476
1481
  */
1482
+ const Plus = createLucideIcon("plus", [["path", {
1483
+ d: "M5 12h14",
1484
+ key: "1ays0h"
1485
+ }], ["path", {
1486
+ d: "M12 5v14",
1487
+ key: "s699le"
1488
+ }]]);
1489
+ /**
1490
+ * @license lucide-react v1.39.0 - ISC
1491
+ *
1492
+ * This source code is licensed under the ISC license.
1493
+ * See the LICENSE file in the root directory of this source tree.
1494
+ */
1477
1495
  const ScanLine = createLucideIcon("scan-line", [
1478
1496
  ["path", {
1479
1497
  d: "M3 7V5a2 2 0 0 1 2-2h2",
@@ -1975,7 +1993,6 @@ window.__ModuleLoader__.load({
1975
1993
  onSelect: onSelectAction,
1976
1994
  portal: true,
1977
1995
  dense: true,
1978
- compact: true,
1979
1996
  getAnchorRect: menuPoint === void 0 ? void 0 : () => pointerMenuRect(menuPoint.x, menuPoint.y),
1980
1997
  anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1981
1998
  type: "button",
@@ -3546,6 +3563,13 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3546
3563
  function CreateGroupIcon() {
3547
3564
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconProjectAddOutlineMedium, { size: 16 });
3548
3565
  }
3566
+ function AddWorkspaceIcon() {
3567
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Plus, {
3568
+ "aria-hidden": "true",
3569
+ size: 16,
3570
+ strokeWidth: 1.5
3571
+ });
3572
+ }
3549
3573
  /** 使用独立节点生成稳定的拖拽预览,避免浏览器把目标高亮和操作按钮截入默认快照。 */
3550
3574
  function setDragPreview(dataTransfer, title, icon) {
3551
3575
  const preview = document.createElement("div");
@@ -3746,10 +3770,23 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3746
3770
  return typeof next === "string" && next !== "" ? next : void 0;
3747
3771
  }
3748
3772
  /** 插件自有的工作区树:复刻原生层级和拖拽行为,并在每个会话菜单中增加管理操作。 */
3773
+ const noSubscription = () => () => {};
3774
+ const noBindings = () => void 0;
3775
+ const emptyShortcutRows = [];
3776
+ const noShortcuts$1 = () => emptyShortcutRows;
3749
3777
  function CodexWorkspaceBrowser(props) {
3750
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HoverShell, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodexWorkspaceTree, { ...props }) });
3751
- }
3752
- function CodexWorkspaceTree({ wide, useSessions, useSessionPendingInteraction, useSessionStatus, useWorkspaces, t, archiveSession, deleteSession, deleteWorkspace, forkSession, insertSessionBefore, insertWorkspaceBefore, moveSession, openPath, openSession, renameSession, renameWorkspace, startSession, canDeleteSession, panelActive = false }) {
3778
+ const snapshot = (0, react.useSyncExternalStore)(props.workspaceShortcuts?.subscribe ?? noSubscription, props.workspaceShortcuts?.getSnapshot ?? noBindings);
3779
+ const catalog = snapshot?.bindings?.hooks.shortcuts;
3780
+ const shortcuts = (0, react.useSyncExternalStore)(catalog?.subscribe ?? noSubscription, catalog?.getSnapshot ?? noShortcuts$1);
3781
+ const requestAddWorkspace = props.workspaceShortcuts ? snapshot?.bindings?.requestAddWorkspace : props.requestAddWorkspace;
3782
+ const addWorkspaceShortcutAria = shortcuts.find((row) => row.id === "workspace.add")?.aria ?? props.addWorkspaceShortcutAria;
3783
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HoverShell, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodexWorkspaceTree, {
3784
+ ...props,
3785
+ requestAddWorkspace,
3786
+ addWorkspaceShortcutAria
3787
+ }) });
3788
+ }
3789
+ function CodexWorkspaceTree({ wide, useSessions, useSessionPendingInteraction, useSessionStatus, useWorkspaces, t, archiveSession, deleteSession, deleteWorkspace, forkSession, insertSessionBefore, insertWorkspaceBefore, moveSession, openPath, openSession, renameSession, renameWorkspace, startSession, canDeleteSession, panelActive = false, requestAddWorkspace, addWorkspaceShortcutAria }) {
3753
3790
  const sessions = useSessions((state) => state);
3754
3791
  const now = useSharedNow();
3755
3792
  const pendingInteractions = useHostPendingInteractions(useSessionPendingInteraction, useSessionStatus);
@@ -4164,6 +4201,9 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
4164
4201
  setRenameGroupError(userErrorText(reason, t));
4165
4202
  }
4166
4203
  };
4204
+ const triggerAddWorkspace = () => {
4205
+ requestAddWorkspace?.();
4206
+ };
4167
4207
  const sectionOpen = (id) => expanded[`section:${id}`] ?? true;
4168
4208
  const toggleSection = (id) => {
4169
4209
  setExpanded((current) => ({
@@ -4511,7 +4551,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
4511
4551
  },
4512
4552
  portal: true,
4513
4553
  dense: true,
4514
- compact: true,
4515
4554
  getAnchorRect: menuAt === void 0 ? void 0 : () => pointerMenuRect(menuAt.x, menuAt.y),
4516
4555
  anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4517
4556
  type: "button",
@@ -4702,7 +4741,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
4702
4741
  },
4703
4742
  portal: true,
4704
4743
  dense: true,
4705
- compact: true,
4706
4744
  getAnchorRect: sessionMenuAt === void 0 ? void 0 : () => pointerMenuRect(sessionMenuAt.x, sessionMenuAt.y),
4707
4745
  anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4708
4746
  type: "button",
@@ -4904,7 +4942,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
4904
4942
  },
4905
4943
  portal: true,
4906
4944
  dense: true,
4907
- compact: true,
4908
4945
  anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4909
4946
  type: "button",
4910
4947
  className: "dcu-wb-more",
@@ -5341,9 +5378,9 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
5341
5378
  })
5342
5379
  })
5343
5380
  })]
5344
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5381
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5345
5382
  className: "dcu-wb-actions",
5346
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5383
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5347
5384
  type: "button",
5348
5385
  className: "dcu-wb-more",
5349
5386
  "aria-label": t("workspace.createGroup"),
@@ -5355,7 +5392,19 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
5355
5392
  setCreateGroupOpen(true);
5356
5393
  },
5357
5394
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CreateGroupIcon, {})
5358
- })
5395
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5396
+ type: "button",
5397
+ className: "dcu-wb-more",
5398
+ "aria-label": t("workspace.add"),
5399
+ title: t("workspace.add"),
5400
+ "aria-keyshortcuts": addWorkspaceShortcutAria,
5401
+ disabled: requestAddWorkspace === void 0,
5402
+ onClick: (event) => {
5403
+ event.stopPropagation();
5404
+ triggerAddWorkspace();
5405
+ },
5406
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AddWorkspaceIcon, {})
5407
+ })]
5359
5408
  })]
5360
5409
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5361
5410
  className: "dcu-wb-section-body",
@@ -5547,7 +5596,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
5547
5596
  },
5548
5597
  portal: true,
5549
5598
  dense: true,
5550
- compact: true,
5551
5599
  side: "bottom",
5552
5600
  align: "start",
5553
5601
  getAnchorRect: () => headerMenu.getRect(),
@@ -6517,7 +6565,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
6517
6565
  },
6518
6566
  portal: true,
6519
6567
  dense: true,
6520
- compact: true,
6521
6568
  anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6522
6569
  type: "button",
6523
6570
  className: "dcu-wb-more",
@@ -7484,7 +7531,7 @@ html[data-platform=darwin]:not([data-fullscreen]) .dcu-root.dcu-compact{padding-
7484
7531
  @media (prefers-reduced-motion:reduce){[data-dcu-codex-sidebar-initialized],[data-dcu-codex-sidebar-initialized] [data-side="sidebar"],#root [data-dcu-codex-sidebar-initialized]:not([data-dragging]){transition:none}.dcu-root.dcu-collapsing .dcu-compact-shell{animation:none}}
7485
7532
  .dcu-native-workspaces{flex-direction:column}.dcu-native-workspaces>[data-mcp-connector-top-mount=true]{flex:none}.dcu-root .mcpConnectorLauncher,.dcu-root [data-mcp-connector-top-mount=true]{display:none!important}
7486
7533
  .dcu-dependency-notice{margin:0 10px 8px;border:1px solid var(--dcu-sidebar-border);border-radius:8px;padding:8px;color:var(--dcu-sidebar-secondary);font-size:12px;line-height:18px}
7487
- .dcu-search-scrim{position:fixed;z-index:10020;inset:0;display:flex;justify-content:center;align-items:flex-start;padding:72px 20px;background:color-mix(in srgb,#000 48%,transparent);animation:dcu-search-scrim-in 140ms ease-out}.dcu-search-dialog{width:min(560px,100%);max-height:min(640px,calc(100vh - 120px));overflow:auto;border:1px solid var(--dcu-sidebar-border);border-radius:16px;padding:10px;background:var(--dsw-specific-menu);box-shadow:var(--dsw-shadow-lv4);animation:dcu-search-dialog-in 180ms cubic-bezier(.16,1,.3,1)}@keyframes dcu-search-scrim-in{from{opacity:0}to{opacity:1}}@keyframes dcu-search-dialog-in{from{opacity:0;transform:translateY(-6px) scale(.985)}to{opacity:1}}.dcu-search-input{margin-bottom:8px}.dcu-search-section{padding:6px 0}.dcu-search-title{padding:0 8px 4px;color:var(--dcu-sidebar-tertiary);font-size:12px;font-weight:600}.dcu-search-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;width:100%;min-height:34px;border:0;border-radius:8px;padding:6px 8px;background:transparent;color:var(--dcu-sidebar-primary);font:inherit;text-align:left;cursor:pointer}.dcu-search-row:hover,.dcu-search-row[data-active=true]{background:var(--dcu-sidebar-hover)}.dcu-search-main{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dcu-search-detail{max-width:160px;overflow:hidden;color:var(--dcu-sidebar-tertiary);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.dcu-search-empty{padding:18px 8px;color:var(--dcu-sidebar-tertiary);font-size:13px}@media (prefers-reduced-motion:reduce){.dcu-expanded-shell,.dcu-root.dcu-compact .dcu-compact-shell,.dcu-foot,.dcu-search-scrim,.dcu-search-dialog,.dcu-extension-panel,.dcu-extension-leading svg{animation:none;transition:none}}
7534
+ .dcu-search-scrim{position:fixed;z-index:10020;inset:0;display:flex;justify-content:center;align-items:flex-start;padding:72px 20px;background:color-mix(in srgb,#000 60%,transparent);animation:dcu-search-scrim-in 140ms ease-out}.dcu-search-dialog{width:min(560px,100%);max-height:min(640px,calc(100vh - 120px));overflow:auto;border:1px solid var(--dcu-sidebar-border);border-radius:16px;padding:10px;background:#ffffff;box-shadow:0 16px 40px rgba(0,0,0,.24);animation:dcu-search-dialog-in 180ms cubic-bezier(.16,1,.3,1)}body[data-ds-dark-theme] .dcu-search-dialog{background:#232323;border-color:rgba(255,255,255,.08);box-shadow:0 16px 40px rgba(0,0,0,.45)}@keyframes dcu-search-scrim-in{from{opacity:0}to{opacity:1}}@keyframes dcu-search-dialog-in{from{opacity:0;transform:translateY(-6px) scale(.985)}to{opacity:1}}.dcu-search-input{margin-bottom:8px}.dcu-search-section{padding:6px 0}.dcu-search-title{padding:0 8px 4px;color:var(--dcu-sidebar-tertiary);font-size:12px;font-weight:600}.dcu-search-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;width:100%;min-height:34px;border:0;border-radius:8px;padding:6px 8px;background:transparent;color:var(--dcu-sidebar-primary);font:inherit;text-align:left;cursor:pointer}.dcu-search-row:hover,.dcu-search-row[data-active=true]{background:var(--dcu-sidebar-hover)}.dcu-search-main{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dcu-search-detail{max-width:160px;overflow:hidden;color:var(--dcu-sidebar-tertiary);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.dcu-search-empty{padding:18px 8px;color:var(--dcu-sidebar-tertiary);font-size:13px}@media (prefers-reduced-motion:reduce){.dcu-expanded-shell,.dcu-root.dcu-compact .dcu-compact-shell,.dcu-foot,.dcu-search-scrim,.dcu-search-dialog,.dcu-extension-panel,.dcu-extension-leading svg{animation:none;transition:none}}
7488
7535
  [data-conversation-scroll]{--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width) + 32px);--dsh-composer-side-clearance:24px;--dcu-composer-bg:var(--dsw-specific-input-major,#fff);--dcu-composer-shadow:0 0 0 1px #0000000a,0 2px 8px #0000000a,0 4px 80px 8px #00000006}
7489
7536
  body[data-ds-dark-theme] [data-conversation-scroll]{--dcu-composer-bg:var(--dsw-alias-bg-layer-2,#242424);--dcu-composer-shadow:inset 0 0 1px #fff3}
7490
7537
  [data-conversation-scroll] [data-composer-card]{padding-top:8px;gap:4px;border:0;border-radius:20px;background:var(--dcu-composer-bg);box-shadow:var(--dcu-composer-shadow)}
@@ -9037,6 +9084,7 @@ html[data-dcu-official-turn-navigator-supported=true] .dcu-turn-navigator,html:h
9037
9084
  const NS = "michengai.codexUi";
9038
9085
  const zh = {
9039
9086
  "workspace.addFailed": "无法添加工作区",
9087
+ "workspace.add": "添加工作区",
9040
9088
  "workspace.retry": "重试",
9041
9089
  "workspace.chooseAgain": "重新选择",
9042
9090
  "navigation.back": "后退",
@@ -9329,6 +9377,7 @@ html[data-dcu-official-turn-navigator-supported=true] .dcu-turn-navigator,html:h
9329
9377
  };
9330
9378
  const en = {
9331
9379
  "workspace.addFailed": "Could not add workspace",
9380
+ "workspace.add": "Add workspace",
9332
9381
  "workspace.retry": "Retry",
9333
9382
  "workspace.chooseAgain": "Choose again",
9334
9383
  "navigation.back": "Back",
@@ -9652,6 +9701,148 @@ html[data-dcu-official-turn-navigator-supported=true] .dcu-turn-navigator,html:h
9652
9701
  };
9653
9702
  }
9654
9703
  //#endregion
9704
+ //#region src/client/slot-mirror.tsx
9705
+ const bridges = /* @__PURE__ */ new WeakMap();
9706
+ const wrappers = /* @__PURE__ */ new WeakMap();
9707
+ /** Keep a real React component boundary and its hooks; translate only renderer-owned bindings. */
9708
+ function withSlotAliases(Component, aliases) {
9709
+ const pairs = Object.entries(aliases).sort(([a], [b]) => a.localeCompare(b));
9710
+ const signature = JSON.stringify(pairs);
9711
+ let cached = wrappers.get(Component);
9712
+ if (!cached) wrappers.set(Component, cached = /* @__PURE__ */ new Map());
9713
+ const previous = cached.get(signature);
9714
+ if (previous) return previous;
9715
+ const map = new Map(pairs);
9716
+ function SlotAliases(props) {
9717
+ const face = props;
9718
+ const renderSlot = (0, react.useMemo)(() => face.renderSlot && ((key, ...args) => face.renderSlot(map.get(key) ?? key, ...args)), [face.renderSlot]);
9719
+ const renderSlotChain = (0, react.useMemo)(() => face.renderSlotChain && ((key, ...args) => face.renderSlotChain(map.get(key) ?? key, ...args)), [face.renderSlotChain]);
9720
+ return (0, react.createElement)(Component, {
9721
+ ...props,
9722
+ ...renderSlot && { renderSlot },
9723
+ ...renderSlotChain && { renderSlotChain }
9724
+ });
9725
+ }
9726
+ cached.set(signature, SlotAliases);
9727
+ return SlotAliases;
9728
+ }
9729
+ /**
9730
+ * Mirror effective contributions into a predeclared, exclusive root-scope alias.
9731
+ * Supports single/list/keyed; chain and session scopes are deliberately rejected.
9732
+ * The parent owns the top-level alias declaration and must call the returned disposer
9733
+ * on unmount. Source declarations/entries are never changed. Children get new declarations.
9734
+ */
9735
+ function mirrorSlot(ctx, source, target) {
9736
+ const slots = ctx.slots;
9737
+ const readSpec = slots.spec.bind(slots);
9738
+ const register = slots.register.bind(slots);
9739
+ const validate = (spec) => {
9740
+ if (spec.scope !== "root" || ![
9741
+ "single",
9742
+ "list",
9743
+ "keyed"
9744
+ ].includes(spec.kind)) throw new Error("slot mirror supports only root single/list/keyed slots");
9745
+ };
9746
+ const install = (from, to, ancestors) => {
9747
+ if (from === to || ancestors.has(from)) throw new Error("recursive slot mirror");
9748
+ let graph = bridges.get(ctx);
9749
+ if (!graph) bridges.set(ctx, graph = /* @__PURE__ */ new Map());
9750
+ let cursor = from;
9751
+ while (cursor !== void 0) {
9752
+ if (cursor === to) throw new Error("recursive slot mirror");
9753
+ cursor = graph.get(cursor);
9754
+ }
9755
+ if (graph.has(to)) throw new Error(`mirror target '${to}' already has a bridge`);
9756
+ const targetSpec = readSpec(to);
9757
+ if (!targetSpec) throw new Error(`mirror target '${to}' must be declared by its parent`);
9758
+ validate(targetSpec);
9759
+ const branch = new Set(ancestors).add(from);
9760
+ const active = /* @__PURE__ */ new Map();
9761
+ let stopped = false;
9762
+ const clear = () => {
9763
+ for (const remove of active.values()) remove();
9764
+ active.clear();
9765
+ };
9766
+ graph.set(to, from);
9767
+ const stop = () => {
9768
+ if (stopped) return;
9769
+ stopped = true;
9770
+ unsubSource();
9771
+ unsubTarget();
9772
+ graph.delete(to);
9773
+ clear();
9774
+ };
9775
+ const sync = () => {
9776
+ if (stopped) return;
9777
+ if (!readSpec(to)) {
9778
+ stop();
9779
+ return;
9780
+ }
9781
+ const spec = readSpec(from);
9782
+ if (spec) {
9783
+ validate(spec);
9784
+ if (spec.kind !== targetSpec.kind) throw new Error("slot mirror kind mismatch");
9785
+ }
9786
+ const entries = slots.entriesOfSlot(from);
9787
+ for (const [entry, remove] of active) if (!entries.includes(entry)) {
9788
+ remove();
9789
+ active.delete(entry);
9790
+ }
9791
+ for (const entry of entries) {
9792
+ if (active.has(entry)) continue;
9793
+ const aliases = Object.create(null);
9794
+ const children = Object.create(null);
9795
+ for (const [child, childSpec] of Object.entries(entry.children ?? {})) {
9796
+ validate(childSpec);
9797
+ if (branch.has(child)) throw new Error("recursive slot mirror");
9798
+ const alias = `${to}.${encodeURIComponent(child)}`;
9799
+ if (readSpec(alias)) throw new Error(`mirror child alias '${alias}' is already declared`);
9800
+ aliases[child] = alias;
9801
+ children[alias] = childSpec;
9802
+ }
9803
+ const removes = [];
9804
+ try {
9805
+ removes.push(register({
9806
+ name: to,
9807
+ ...entry.options,
9808
+ inject: entry.inject,
9809
+ store: entry.store,
9810
+ locale: entry.locale,
9811
+ registrant: entry.registrant,
9812
+ ...entry.children && { children }
9813
+ }, withSlotAliases(entry.component, aliases)));
9814
+ for (const [child, alias] of Object.entries(aliases)) removes.push(install(child, alias, branch));
9815
+ active.set(entry, () => {
9816
+ for (const remove of removes.reverse()) remove();
9817
+ });
9818
+ } catch (error) {
9819
+ for (const remove of removes.reverse()) remove();
9820
+ throw error;
9821
+ }
9822
+ }
9823
+ };
9824
+ const safeSync = () => {
9825
+ try {
9826
+ sync();
9827
+ } catch (error) {
9828
+ console.warn(`[michengai-codex-ui] slot-mirror sync error on '${from}' -> '${to}':`, error);
9829
+ stop();
9830
+ }
9831
+ };
9832
+ const unsubSource = slots.subscribe(from, safeSync);
9833
+ const unsubTarget = slots.subscribe(to, safeSync);
9834
+ try {
9835
+ sync();
9836
+ } catch (error) {
9837
+ stop();
9838
+ throw error;
9839
+ }
9840
+ return stop;
9841
+ };
9842
+ const start = () => install(source, target, /* @__PURE__ */ new Set());
9843
+ return ctx.effect ? ctx.effect(start) : start();
9844
+ }
9845
+ //#endregion
9655
9846
  //#region src/client/host-open-path.ts
9656
9847
  const OPEN_IN_EXPLORER_ENDPOINT = CODEX_UI_API_ENDPOINTS.openInExplorer;
9657
9848
  /** “在资源管理器中打开”属于明确的系统动作,不应被侧边栏文件预览器接管。 */
@@ -10601,6 +10792,77 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
10601
10792
  }
10602
10793
  //#endregion
10603
10794
  //#region src/client/settings-page-registration.ts
10795
+ const shellAliases = {
10796
+ "settings.launcher": "settings.codex.launcher",
10797
+ "settings.trigger": "settings.codex.trigger",
10798
+ "settings.header": "settings.codex.header",
10799
+ "settings.action": "settings.codex.action",
10800
+ "settings.close": "settings.codex.close",
10801
+ "settings.section": "settings.codex.section",
10802
+ "settings.onboarding": "settings.codex.onboarding"
10803
+ };
10804
+ const shellAliasChildren = {
10805
+ "settings.codex.launcher": {
10806
+ kind: "single",
10807
+ scope: "root"
10808
+ },
10809
+ "settings.codex.trigger": {
10810
+ kind: "single",
10811
+ scope: "root"
10812
+ },
10813
+ "settings.codex.header": {
10814
+ kind: "single",
10815
+ scope: "root"
10816
+ },
10817
+ "settings.codex.action": {
10818
+ kind: "list",
10819
+ scope: "root"
10820
+ },
10821
+ "settings.codex.close": {
10822
+ kind: "single",
10823
+ scope: "root"
10824
+ },
10825
+ "settings.codex.section": {
10826
+ kind: "list",
10827
+ scope: "root"
10828
+ },
10829
+ "settings.codex.onboarding": {
10830
+ kind: "list",
10831
+ scope: "root"
10832
+ }
10833
+ };
10834
+ const generalAliases = {
10835
+ "settings.general.item": "settings.codex.general.item",
10836
+ "settings.general.footer": "settings.codex.general.footer"
10837
+ };
10838
+ const generalAliasChildren = {
10839
+ "settings.codex.general.item": {
10840
+ kind: "list",
10841
+ scope: "root"
10842
+ },
10843
+ "settings.codex.general.footer": {
10844
+ kind: "list",
10845
+ scope: "root"
10846
+ }
10847
+ };
10848
+ const AliasedCodexSettingsPage = withSlotAliases(CodexSettingsPage, shellAliases);
10849
+ const AliasedCodexGeneralSettings = withSlotAliases(CodexGeneralSettings, generalAliases);
10850
+ function registerMirrors(ctx, aliases, register) {
10851
+ const unregister = register();
10852
+ const mirrors = [];
10853
+ const getSpec = ctx.slots.spec;
10854
+ try {
10855
+ for (const [source, target] of Object.entries(aliases)) if (typeof getSpec === "function") mirrors.push(ctx.slots.inject(source, () => mirrorSlot({ slots: ctx.slots }, source, target)));
10856
+ } catch (error) {
10857
+ for (const dispose of mirrors.reverse()) dispose();
10858
+ unregister();
10859
+ throw error;
10860
+ }
10861
+ return () => {
10862
+ for (const dispose of mirrors.reverse()) dispose();
10863
+ unregister();
10864
+ };
10865
+ }
10604
10866
  /** 快捷键服务可能晚于本插件启动。等到它就绪后再读 catalog,避免注册时一次取值把提示永久丢掉。 */
10605
10867
  const emptyShortcuts = [];
10606
10868
  function liveShortcutCatalog(ctx) {
@@ -10654,7 +10916,7 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
10654
10916
  const spec = ctx.slots.spec;
10655
10917
  return typeof spec === "function" && spec.call(ctx.slots, name) !== void 0;
10656
10918
  };
10657
- const officialSettingsReady = () => declared("settings.launcher") || ctx.slots.entries("sidebar.settings").some((entry) => entry.component !== CodexSettingsPage);
10919
+ const officialSettingsReady = () => declared("settings.launcher");
10658
10920
  const connection = ctx.get("connection");
10659
10921
  const shortcuts = liveShortcutCatalog(ctx);
10660
10922
  const source = (name) => {
@@ -10739,51 +11001,18 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
10739
11001
  return configFormsCtx.slots.inject("settings.general.item", () => configFormsCtx.slots.register({
10740
11002
  name: "settings.general.item",
10741
11003
  id: "developer-tools",
11004
+ priority: -1,
10742
11005
  order: 15,
10743
11006
  locale: NS,
10744
11007
  inject: () => ({ developerTools })
10745
11008
  }, DeveloperToolsRow));
10746
11009
  });
10747
- const shellChildren = {
10748
- "settings.launcher": {
10749
- kind: "single",
10750
- scope: "root"
10751
- },
10752
- "settings.trigger": {
10753
- kind: "single",
10754
- scope: "root"
10755
- },
10756
- "settings.header": {
10757
- kind: "single",
10758
- scope: "root"
10759
- },
10760
- "settings.action": {
10761
- kind: "list",
10762
- scope: "root"
10763
- },
10764
- "settings.close": {
10765
- kind: "single",
10766
- scope: "root"
10767
- },
10768
- "settings.section": {
10769
- kind: "list",
10770
- scope: "root"
10771
- },
10772
- "settings.onboarding": {
10773
- kind: "list",
10774
- scope: "root"
10775
- }
10776
- };
10777
11010
  ctx.slots.inject("sidebar.settings", () => registerAfterOfficialWave(ctx.slots, "sidebar.settings", officialSettingsReady, () => {
10778
- const children = {};
10779
- if (!officialSettingsReady()) {
10780
- for (const [name, spec] of Object.entries(shellChildren)) if (!declared(name)) Object.assign(children, { [name]: spec });
10781
- }
10782
- return ctx.slots.register({
11011
+ return registerMirrors(ctx, shellAliases, () => ctx.slots.register({
10783
11012
  name: "sidebar.settings",
10784
11013
  priority: -1,
10785
11014
  locale: NS,
10786
- children,
11015
+ children: shellAliasChildren,
10787
11016
  inject: () => ({
10788
11017
  sections,
10789
11018
  onboarding,
@@ -10794,29 +11023,20 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
10794
11023
  accountLauncher: accountLauncherPresence(ctx.slots),
10795
11024
  shortcuts
10796
11025
  })
10797
- }, CodexSettingsPage);
10798
- }));
11026
+ }, AliasedCodexSettingsPage));
11027
+ }, true));
10799
11028
  ctx.slots.inject("settings.section", () => registerAfterOfficialWave(ctx.slots, "settings.section", () => declared("settings.general.item"), () => {
10800
- const children = {};
10801
- if (!declared("settings.general.item")) children["settings.general.item"] = {
10802
- kind: "list",
10803
- scope: "root"
10804
- };
10805
- if (!declared("settings.general.footer")) children["settings.general.footer"] = {
10806
- kind: "list",
10807
- scope: "root"
10808
- };
10809
- return ctx.slots.register({
11029
+ return registerMirrors(ctx, generalAliases, () => ctx.slots.register({
10810
11030
  name: "settings.section",
10811
11031
  id: "general",
10812
11032
  priority: -1,
10813
11033
  order: 0,
10814
11034
  locale: NS,
10815
11035
  label: () => t("settings.general"),
10816
- children,
11036
+ children: generalAliasChildren,
10817
11037
  inject: () => ({ items })
10818
- }, CodexGeneralSettings);
10819
- }));
11038
+ }, AliasedCodexGeneralSettings));
11039
+ }, true));
10820
11040
  }
10821
11041
  //#endregion
10822
11042
  //#region src/client/official-turn-navigator.ts
@@ -11548,10 +11768,6 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
11548
11768
  }, "michengai-codex-ui: workspace shortcuts");
11549
11769
  registerWorkspaceDirectoryFlow(ctx);
11550
11770
  const ownSidebarChildren = {
11551
- "sidebar.panellist": {
11552
- kind: "list",
11553
- scope: "root"
11554
- },
11555
11771
  [WORKSPACE_DIRECTORY_FLOW]: {
11556
11772
  kind: "single",
11557
11773
  scope: "root"
@@ -11566,6 +11782,10 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
11566
11782
  }
11567
11783
  };
11568
11784
  const sharedSidebarChildren = {
11785
+ "sidebar.panellist": {
11786
+ kind: "list",
11787
+ scope: "root"
11788
+ },
11569
11789
  "sidebar.workspaces": {
11570
11790
  kind: "single",
11571
11791
  scope: "root"
@@ -11579,20 +11799,56 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
11579
11799
  scope: "root"
11580
11800
  }
11581
11801
  };
11582
- const officialSidebarReady = () => ctx.slots.entries("sidebar").some((entry) => entry.component !== CodexSidebar);
11583
- ctx.slots.inject("sidebar", () => registerAfterOfficialWave(ctx.slots, "sidebar", officialSidebarReady, () => {
11802
+ const sidebarSlotAliases = {
11803
+ "sidebar.panellist": "sidebar.codex.panellist",
11804
+ "sidebar.workspaces": "sidebar.codex.workspaces",
11805
+ "sidebar.schedule": "sidebar.codex.schedule",
11806
+ "sidebar.settings": "sidebar.codex.settings",
11807
+ "sidebar.footer.action": "sidebar.codex.footer.action"
11808
+ };
11809
+ const sidebarAliasChildren = {
11810
+ "sidebar.codex.panellist": {
11811
+ kind: "list",
11812
+ scope: "root"
11813
+ },
11814
+ "sidebar.codex.workspaces": {
11815
+ kind: "single",
11816
+ scope: "root"
11817
+ },
11818
+ "sidebar.codex.schedule": {
11819
+ kind: "single",
11820
+ scope: "root"
11821
+ },
11822
+ "sidebar.codex.settings": {
11823
+ kind: "single",
11824
+ scope: "root"
11825
+ },
11826
+ "sidebar.codex.footer.action": {
11827
+ kind: "list",
11828
+ scope: "root"
11829
+ }
11830
+ };
11831
+ const aliasedSidebar = withSlotAliases(CodexSidebar, sidebarSlotAliases);
11832
+ const officialSidebarReady = () => ctx.slots.spec?.("sidebar.workspaces") !== void 0;
11833
+ ctx.slots.inject("sidebar", () => registerAfterOfficialWave(ctx.slots, "sidebar", officialSidebarReady, (timedOut = false) => {
11584
11834
  const declared = (name) => {
11585
11835
  const spec = ctx.slots.spec;
11586
11836
  return typeof spec === "function" && spec.call(ctx.slots, name) !== void 0;
11587
11837
  };
11588
- const children = {};
11589
- for (const [name, spec] of Object.entries({
11838
+ const allSidebarChildren = {
11590
11839
  ...sharedSidebarChildren,
11591
- ...ownSidebarChildren
11592
- })) if (!declared(name)) children[name] = spec;
11840
+ ...ownSidebarChildren,
11841
+ ...sidebarAliasChildren
11842
+ };
11843
+ const children = {};
11844
+ const candidates = timedOut ? {
11845
+ ...ownSidebarChildren,
11846
+ ...sidebarAliasChildren
11847
+ } : allSidebarChildren;
11848
+ for (const [name, spec] of Object.entries(candidates)) if (!declared(name)) Object.assign(children, { [name]: spec });
11593
11849
  const register = (next) => {
11594
11850
  try {
11595
- return ctx.slots.register({
11851
+ const unregister = ctx.slots.register({
11596
11852
  name: "sidebar",
11597
11853
  priority: -1,
11598
11854
  registrant: "michengai-codex-ui",
@@ -11630,18 +11886,31 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
11630
11886
  selectGlobalPanel(ctx.layout, id);
11631
11887
  }
11632
11888
  })
11633
- }, CodexSidebar);
11889
+ }, aliasedSidebar);
11890
+ const mirrors = [];
11891
+ try {
11892
+ for (const [source, target] of Object.entries(sidebarSlotAliases)) if (typeof ctx.slots.spec === "function") mirrors.push(ctx.slots.inject(source, () => mirrorSlot({ slots: ctx.slots }, source, target)));
11893
+ } catch (error) {
11894
+ for (const dispose of mirrors.reverse()) dispose();
11895
+ unregister();
11896
+ throw error;
11897
+ }
11898
+ return () => {
11899
+ for (const dispose of mirrors.reverse()) dispose();
11900
+ unregister();
11901
+ };
11634
11902
  } catch (error) {
11635
11903
  const message = error instanceof Error ? error.message : String(error);
11636
11904
  const conflict = /slot "([^"]+)" is already declared/.exec(message);
11637
- if (conflict === null || next[conflict[1]] === void 0) throw error;
11905
+ const conflictKey = conflict === null ? void 0 : Object.keys(next).find((key) => key === conflict[1]);
11906
+ if (conflictKey === void 0 || next[conflictKey] === void 0) throw error;
11638
11907
  const rest = { ...next };
11639
- delete rest[conflict[1]];
11908
+ delete rest[conflictKey];
11640
11909
  return register(rest);
11641
11910
  }
11642
11911
  };
11643
11912
  return register(children);
11644
- }));
11913
+ }, true));
11645
11914
  ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
11646
11915
  name: "conversation.session.header.utilities",
11647
11916
  id: "turn-navigator",
@@ -11742,7 +12011,8 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
11742
12011
  insertSessionBefore: (workspaceId, sessionId, beforeSessionId) => ctx.workspaces.insertSessionBefore(workspaceId, sessionId, beforeSessionId),
11743
12012
  startSession: (workspaceId) => {
11744
12013
  startWorkspaceSession(ctx, workspaceId);
11745
- }
12014
+ },
12015
+ workspaceShortcuts
11746
12016
  })
11747
12017
  }, CodexWorkspaceBrowser));
11748
12018
  ctx.effect(() => {
@@ -11761,7 +12031,7 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
11761
12031
  ctx.slots.inject("settings.section", () => ctx.slots.register({
11762
12032
  name: "settings.section",
11763
12033
  id: "connectors",
11764
- order: 17,
12034
+ order: 30,
11765
12035
  label: () => t("sidebar.connectors"),
11766
12036
  icon: "connector",
11767
12037
  inject: () => ({
@@ -2,7 +2,7 @@ import { Context } from "@deepseek-ai/cordis";
2
2
  //#region src/session-title-plugin.d.ts
3
3
  declare const name = "michengai-codex-ui-session-title";
4
4
  declare const inject: string[];
5
- /** 独立挂到官方 session-title-llm 同级,等标题服务和模型服务就绪后再占 first-prompt 位。 */
6
- declare function apply(ctx: Context): void;
5
+ /** Register teardown before asynchronous official-provider draining. */
6
+ declare function apply(ctx: Context): Promise<void>;
7
7
  //#endregion
8
8
  export { apply, inject, name };
@@ -1,6 +1,7 @@
1
1
  //#region src/client/locales.ts
2
2
  const zh = {
3
3
  "workspace.addFailed": "无法添加工作区",
4
+ "workspace.add": "添加工作区",
4
5
  "workspace.retry": "重试",
5
6
  "workspace.chooseAgain": "重新选择",
6
7
  "navigation.back": "后退",
@@ -293,6 +294,7 @@ const zh = {
293
294
  };
294
295
  const en = {
295
296
  "workspace.addFailed": "Could not add workspace",
297
+ "workspace.add": "Add workspace",
296
298
  "workspace.retry": "Retry",
297
299
  "workspace.chooseAgain": "Choose again",
298
300
  "navigation.back": "Back",
@@ -865,27 +867,47 @@ async function generateCodexSessionTitle(llm, request, locale = "zh") {
865
867
  }])}`;
866
868
  if (Buffer.byteLength(framed, "utf8") > MAX_INPUT_BYTES) throw new Error("codex-ui session title input too large");
867
869
  const signal = abortableSignal(request.signal);
868
- const raw = await collectText(llm.stream({
870
+ const messages = [{
871
+ id: crypto.randomUUID(),
872
+ role: "user",
873
+ content: [{
874
+ type: "text",
875
+ text: framed
876
+ }],
877
+ source: {
878
+ kind: "plugin",
879
+ plugin: "michengai-codex-ui"
880
+ }
881
+ }];
882
+ let chunks;
883
+ if (typeof llm.prepareCall === "function") {
884
+ const call = await llm.prepareCall({
885
+ provider: route.provider,
886
+ model: route.model,
887
+ maxTokens: MAX_OUTPUT_TOKENS
888
+ }, signal, (controls, model) => ({
889
+ ...controls,
890
+ ...model.reasoning?.efforts?.[0]?.id !== void 0 ? { reasoningEffort: model.reasoning.efforts[0].id } : {}
891
+ }));
892
+ chunks = call.stream({
893
+ ...call.config,
894
+ messages,
895
+ system: prompt.system,
896
+ sessionId: session.id,
897
+ purpose: "session-title",
898
+ signal
899
+ });
900
+ } else chunks = llm.stream({
869
901
  provider: route.provider,
870
902
  model: route.model,
871
- messages: [{
872
- id: crypto.randomUUID(),
873
- role: "user",
874
- content: [{
875
- type: "text",
876
- text: framed
877
- }],
878
- source: {
879
- kind: "plugin",
880
- plugin: "michengai-codex-ui"
881
- }
882
- }],
903
+ messages,
883
904
  system: prompt.system,
884
905
  maxTokens: MAX_OUTPUT_TOKENS,
885
906
  sessionId: session.id,
886
907
  purpose: "session-title",
887
908
  signal
888
- }));
909
+ });
910
+ const raw = await collectText(chunks);
889
911
  signal.throwIfAborted();
890
912
  const parsed = parseTypeAndTheme(raw);
891
913
  if (parsed === void 0) throw new Error("codex-ui session title invalid model output");
@@ -918,12 +940,159 @@ function registerSessionTitleProvider(ctx) {
918
940
  }
919
941
  }
920
942
  //#endregion
943
+ //#region src/session-title-lifecycle.ts
944
+ const OFFICIAL_TARGETS = [{
945
+ id: "session-title-llm",
946
+ name: "@deepseek-ai/dsh-session-title-first-prompt-llm"
947
+ }, {
948
+ id: "optional-session-title-all-prompts",
949
+ name: "@deepseek-ai/dsh-session-title-all-prompts-llm"
950
+ }];
951
+ function isOfficialTarget(options) {
952
+ if (!options) return false;
953
+ return OFFICIAL_TARGETS.some((t) => t.id === options.id && t.name === options.name);
954
+ }
955
+ const guardRegistry = /* @__PURE__ */ new WeakMap();
956
+ function silenceOfficialProvider(host, shouldSilence) {
957
+ const sessionTitle = host.get?.("sessionTitle");
958
+ if (!sessionTitle || typeof sessionTitle.register !== "function") return void 0;
959
+ const target = Object.getPrototypeOf(sessionTitle);
960
+ if (typeof target?.register !== "function") return void 0;
961
+ let state = guardRegistry.get(target);
962
+ if (!state) {
963
+ state = {
964
+ original: target.register,
965
+ activeGuards: /* @__PURE__ */ new Set()
966
+ };
967
+ target.register = function(provider) {
968
+ const candidate = provider;
969
+ if (candidate && candidate.id !== "michengai-codex-ui-session-title") {
970
+ if ([...state.activeGuards].some((g) => g.shouldSilence())) return () => {};
971
+ }
972
+ return state.original.apply(this, arguments);
973
+ };
974
+ guardRegistry.set(target, state);
975
+ }
976
+ const guardHandle = { shouldSilence };
977
+ state.activeGuards.add(guardHandle);
978
+ let released = false;
979
+ return () => {
980
+ if (released) return;
981
+ released = true;
982
+ state.activeGuards.delete(guardHandle);
983
+ if (state.activeGuards.size === 0) {
984
+ target.register = state.original;
985
+ guardRegistry.delete(target);
986
+ }
987
+ };
988
+ }
989
+ const transitions = /* @__PURE__ */ new WeakMap();
990
+ function serialize(key, work) {
991
+ const previous = transitions.get(key);
992
+ const next = previous ? previous.catch(() => {}).then(work) : work();
993
+ transitions.set(key, next);
994
+ return next;
995
+ }
996
+ /** 不主动调用 loader.update 写盘;共享 options 仍可能被其他配置写入持久化。 */
997
+ function startSessionTitleLifecycle(host) {
998
+ let cancelled = false;
999
+ let provider;
1000
+ let restore;
1001
+ let silencing = false;
1002
+ const restoreGuard = silenceOfficialProvider(host, () => silencing);
1003
+ const loader = host.loader;
1004
+ const candidates = typeof loader?.entries === "function" ? [...loader.entries()].filter((entry) => isOfficialTarget(entry.options)) : [];
1005
+ const key = candidates.length === 1 ? candidates[0] : host;
1006
+ const ready = serialize(key, async () => {
1007
+ if (typeof loader?.entries !== "function") return;
1008
+ {
1009
+ const matches = [...loader.entries()].filter((entry) => isOfficialTarget(entry.options));
1010
+ const enabledMatches = matches.filter((entry) => !entry.disabled);
1011
+ if (enabledMatches.length === 1) {
1012
+ const entry = enabledMatches[0];
1013
+ if (typeof entry.update !== "function" || typeof entry.fiber?.dispose !== "function") return;
1014
+ const options = entry.options;
1015
+ const original = options.disabled;
1016
+ const fiber = entry.fiber;
1017
+ const ownsDisabledState = () => [...loader.entries()].includes(entry) && entry.options === options && options.disabled === true;
1018
+ const ownsEntry = () => ownsDisabledState() && isOfficialTarget(options);
1019
+ restore = async () => {
1020
+ if (!ownsDisabledState()) return;
1021
+ silencing = false;
1022
+ await entry.update({ disabled: original ?? null });
1023
+ };
1024
+ try {
1025
+ await entry.update({ disabled: true });
1026
+ } catch (error) {
1027
+ if (ownsDisabledState()) {
1028
+ await fiber.dispose();
1029
+ await restore();
1030
+ }
1031
+ restore = void 0;
1032
+ throw error;
1033
+ }
1034
+ await fiber.dispose();
1035
+ if (!ownsEntry()) {
1036
+ await restore();
1037
+ restore = void 0;
1038
+ return;
1039
+ }
1040
+ } else if (matches.length > 0 && enabledMatches.length === 0) {
1041
+ console.warn("[michengai-codex-ui] all official session title targets are already disabled; skipping takeover.");
1042
+ return;
1043
+ } else if (matches.length > 1) {
1044
+ console.warn("[michengai-codex-ui] multiple official session title targets found; skipping takeover.");
1045
+ return;
1046
+ }
1047
+ }
1048
+ if (!cancelled) {
1049
+ provider = registerSessionTitleProvider(host);
1050
+ if (provider) silencing = true;
1051
+ }
1052
+ if (!provider) {
1053
+ await restore?.();
1054
+ restore = void 0;
1055
+ }
1056
+ });
1057
+ let disposal;
1058
+ return {
1059
+ ready,
1060
+ dispose: () => {
1061
+ cancelled = true;
1062
+ silencing = false;
1063
+ const sessionTitle = host.get?.("sessionTitle");
1064
+ if (sessionTitle?.registration?.provider?.id === "michengai-codex-ui-session-title") sessionTitle.registration.closing = true;
1065
+ return disposal ??= serialize(key, async () => {
1066
+ try {
1067
+ await ready.catch(() => {});
1068
+ await provider?.();
1069
+ provider = void 0;
1070
+ if (sessionTitle?.registration?.provider?.id === "michengai-codex-ui-session-title" && sessionTitle.registration?.closing) delete sessionTitle.registration;
1071
+ } finally {
1072
+ restoreGuard?.();
1073
+ try {
1074
+ await restore?.();
1075
+ } finally {
1076
+ restore = void 0;
1077
+ }
1078
+ }
1079
+ });
1080
+ }
1081
+ };
1082
+ }
1083
+ //#endregion
921
1084
  //#region src/session-title-plugin.ts
922
1085
  const name = "michengai-codex-ui-session-title";
923
- const inject = ["sessionTitle", "llm"];
924
- /** 独立挂到官方 session-title-llm 同级,等标题服务和模型服务就绪后再占 first-prompt 位。 */
1086
+ const inject = [
1087
+ "sessionTitle",
1088
+ "llm",
1089
+ "loader"
1090
+ ];
1091
+ /** Register teardown before asynchronous official-provider draining. */
925
1092
  function apply(ctx) {
926
- ctx.effect(() => registerSessionTitleProvider(ctx) ?? (() => {}), "michengai-codex-ui: session title");
1093
+ const lifecycle = startSessionTitleLifecycle(ctx);
1094
+ ctx.effect(() => lifecycle.dispose, "michengai-codex-ui: session title");
1095
+ return lifecycle.ready;
927
1096
  }
928
1097
  //#endregion
929
1098
  export { apply, inject, name };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-codex-ui",
3
- "version": "1.1.36",
3
+ "version": "1.1.37",
4
4
  "description": "DSH Codex UI — 为 DeepSeek Harness Web 提供 Codex 风格侧栏、工作区会话树、全局搜索和轮次导航 · A Codex-style sidebar, workspace session tree, global search, and turn navigation for DSH Web",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -73,7 +73,8 @@
73
73
  "test:host": "node scripts/verify-settings-exit.mjs",
74
74
  "test:settings-backdrop": "node scripts/verify-settings-backdrop.mjs",
75
75
  "test:layout": "node scripts/verify-workspace-drop-layout.mjs --run && node scripts/verify-sidebar-transition.mjs && node scripts/verify-sidebar-expand-control.mjs && node scripts/verify-sidebar-titlebar.mjs && node scripts/verify-composer-style.mjs && node scripts/verify-new-conversation.mjs && node scripts/verify-composer-tools.mjs && node scripts/verify-hero-width.mjs && node scripts/verify-settings-backdrop.mjs && node scripts/verify-settings-geometry.mjs && node scripts/verify-upstream-style-regressions.mjs",
76
- "test:compat": "node scripts/run-compat-host.mjs"
76
+ "test:compat": "node scripts/run-compat-host.mjs",
77
+ "test:fallback-host": "node scripts/verify-plugin-fallback-host.mjs"
77
78
  },
78
79
  "peerDependencies": {
79
80
  "@deepseek-ai/cordis": ">=4.0.2 <5.0.0",