@michengai/dsh-codex-ui 1.1.35 → 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 +12 -1
- package/CHANGELOG.zh-CN.md +12 -1
- package/README.md +7 -1
- package/README.zh-CN.md +7 -1
- package/cordis.patch.yml +2 -10
- package/lib/client.js +444 -91
- package/lib/session-title-plugin.d.mts +2 -2
- package/lib/session-title-plugin.mjs +192 -17
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,18 @@
|
|
|
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
|
-
##
|
|
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).
|
|
14
|
+
|
|
15
|
+
## 1.1.36 - 2026-10-13
|
|
16
|
+
|
|
17
|
+
- Restored the "Show Code Workspace" (`developerTools`) setting toggle in General Settings and aligned its Switch control with native specifications (#41).
|
|
18
|
+
- Maintained a compact single-line layout for the conversation header when "Show Code Workspace" is disabled (single view without inline tabs).
|
|
8
19
|
|
|
9
20
|
## 1.1.35 - 2026-10-12
|
|
10
21
|
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -4,7 +4,18 @@
|
|
|
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)。
|
|
14
|
+
|
|
15
|
+
## 1.1.36 - 2026-10-13
|
|
16
|
+
|
|
17
|
+
- 补齐通用设置中的「显示代码工作视图」(`developerTools`) 开关,并将 Switch 控件样式与官方原生规范严格对齐(#41)。
|
|
18
|
+
- 当「显示代码工作视图」关闭(会话顶栏无页签时),会话顶部依然保持紧凑单行布局,消除开关切换时的顶栏高度跳变。
|
|
8
19
|
|
|
9
20
|
## 1.1.35 - 2026-10-12
|
|
10
21
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
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
|
-
|
|
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
|
-
|
|
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",
|
|
@@ -2530,20 +2547,26 @@ window.__ModuleLoader__.load({
|
|
|
2530
2547
|
const HEADER_SESSION_MENU_EVENT = "dcu-header-session-menu";
|
|
2531
2548
|
const CONVERSATION_HEADER_STYLE = `
|
|
2532
2549
|
header:has([data-dcu-inline-tabs]){box-sizing:border-box;display:flex;flex-wrap:nowrap;align-items:center;gap:10px;min-height:var(--dcu-header-height,34px);padding-top:calc((var(--dcu-header-height,34px) - 28px)/2);padding-bottom:calc((var(--dcu-header-height,34px) - 28px)/2);border-bottom:0}
|
|
2550
|
+
header:not(:has([data-dcu-inline-tabs])):has([class*="crumbCurrent"]){box-sizing:border-box;display:flex;flex-wrap:nowrap;align-items:center;gap:10px;min-height:var(--dcu-header-height,34px);padding-top:calc((var(--dcu-header-height,34px) - 28px)/2);padding-bottom:calc((var(--dcu-header-height,34px) - 28px)/2);border-bottom:0}
|
|
2533
2551
|
header:has([data-dcu-inline-tabs]):after{display:none;content:none}
|
|
2534
|
-
header:has([data-dcu-inline-tabs])
|
|
2535
|
-
header:has([data-dcu-inline-tabs]) [class*="
|
|
2536
|
-
header:has([data-dcu-inline-tabs]) [class*="
|
|
2552
|
+
header:not(:has([data-dcu-inline-tabs])):has([class*="crumbCurrent"]):after{display:none;content:none}
|
|
2553
|
+
header:has([data-dcu-inline-tabs]) [class*="titleRow"],header:not(:has([data-dcu-inline-tabs])):has([class*="crumbCurrent"]) [class*="titleRow"],header:has([data-dcu-inline-tabs]) [class*="titleCluster"],header:not(:has([data-dcu-inline-tabs])):has([class*="crumbCurrent"]) [class*="titleCluster"]{display:contents}
|
|
2554
|
+
header:has([data-dcu-inline-tabs]) [class*="crumbs"],header:not(:has([data-dcu-inline-tabs])):has([class*="crumbCurrent"]) [class*="crumbs"]{order:1;flex:0 1 auto;min-width:0}
|
|
2555
|
+
header:has([data-dcu-inline-tabs]) [class*="headerActions"],header:not(:has([data-dcu-inline-tabs])):has([class*="crumbCurrent"]) [class*="headerActions"]{order:2;flex:none}
|
|
2556
|
+
header:not(:has([data-dcu-inline-tabs])):has([class*="crumbCurrent"]) [class*="headerActions"]{margin-right:auto}
|
|
2537
2557
|
header [data-dcu-inline-tabs]{box-sizing:border-box;order:3;flex:none;display:flex;align-items:center;gap:0;margin:0 0 0 auto;padding:0;height:28px;position:relative;z-index:1;overflow:hidden;border:1px solid var(--dsw-alias-border-subtle,rgba(255,255,255,.12));border-radius:8px;background:var(--dsw-alias-background-secondary,rgba(255,255,255,.025))}
|
|
2538
2558
|
header:has([data-dcu-inline-tabs]) [class*="headerUtilities"]{order:4;flex:none}
|
|
2559
|
+
header:not(:has([data-dcu-inline-tabs])):has([class*="crumbCurrent"]) [class*="headerUtilities"]{order:4;flex:none}
|
|
2539
2560
|
/* 新版角落插槽被 display:contents 摊平后,需要独立排序并撤销嵌套布局的边距补偿。 */
|
|
2540
|
-
header:has([data-dcu-inline-tabs]) [data-conversation-header-corner]{order:5;flex:none;margin-left:0;margin-right:0}
|
|
2561
|
+
header:has([data-dcu-inline-tabs]) [data-conversation-header-corner],header:not(:has([data-dcu-inline-tabs])):has([class*="crumbCurrent"]) [data-conversation-header-corner]{order:5;flex:none;margin-left:0;margin-right:0}
|
|
2541
2562
|
header [data-dcu-tab-slider]{position:absolute;left:0;top:0;height:26px;border-radius:7px;background:color-mix(in srgb,var(--dsw-alias-button-info-fill,#4c8dff) 18%,transparent);pointer-events:none;z-index:0;opacity:0;transform:translateX(0);width:0;transition:transform 240ms cubic-bezier(.16,1,.3,1),width 240ms cubic-bezier(.16,1,.3,1),opacity 160ms ease}
|
|
2542
2563
|
/* 顶栏统一使用 34px 控件带:与宿主扩展常用的 top:3px + 28px 图标按钮同心。
|
|
2543
2564
|
better-sidebar 0.18.0 收起时会把开关组改到 14px(按官方 padding-top:12px 算),
|
|
2544
2565
|
这里只在紧凑顶栏存在时扣回 3px,不搬 DOM、不跟展开/收起跳动。 */
|
|
2545
2566
|
body[data-dsh-sidebar-collapsed]:has([data-dcu-inline-tabs]) [data-dsh-toggle-cluster]{top:calc(3px + env(safe-area-inset-top))}
|
|
2546
2567
|
body[data-dsh-sidebar-collapsed][data-dsh-title-bar-compat]:has([data-dcu-inline-tabs]) [data-dsh-toggle-cluster]{top:calc(var(--dsh-title-bar-strip, 40px) + 3px)}
|
|
2568
|
+
body[data-dsh-sidebar-collapsed]:has([class*="crumbCurrent"]) [data-dsh-toggle-cluster]{top:calc(3px + env(safe-area-inset-top))}
|
|
2569
|
+
body[data-dsh-sidebar-collapsed][data-dsh-title-bar-compat]:has([class*="crumbCurrent"]) [data-dsh-toggle-cluster]{top:calc(var(--dsh-title-bar-strip, 40px) + 3px)}
|
|
2547
2570
|
header [data-dcu-inline-tabs] [role=tab]{box-sizing:border-box;position:relative;z-index:1;height:26px;padding:3px 10px;margin:0;line-height:20px;color:var(--dsw-alias-label-tertiary);border:0;box-shadow:none;background:transparent;font-size:13px;white-space:nowrap}
|
|
2548
2571
|
header [data-dcu-inline-tabs] [role=tab][aria-selected=true],header [data-dcu-inline-tabs] [role=tab][data-state=active]{color:var(--dsw-alias-button-info-fill,#4c8dff);font-weight:500}
|
|
2549
2572
|
header [data-dcu-inline-tabs] [role=tab]+[role=tab]{border-left:1px solid var(--dsw-alias-border-subtle,rgba(255,255,255,.08))}
|
|
@@ -3540,6 +3563,13 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
3540
3563
|
function CreateGroupIcon() {
|
|
3541
3564
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconProjectAddOutlineMedium, { size: 16 });
|
|
3542
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
|
+
}
|
|
3543
3573
|
/** 使用独立节点生成稳定的拖拽预览,避免浏览器把目标高亮和操作按钮截入默认快照。 */
|
|
3544
3574
|
function setDragPreview(dataTransfer, title, icon) {
|
|
3545
3575
|
const preview = document.createElement("div");
|
|
@@ -3740,10 +3770,23 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
3740
3770
|
return typeof next === "string" && next !== "" ? next : void 0;
|
|
3741
3771
|
}
|
|
3742
3772
|
/** 插件自有的工作区树:复刻原生层级和拖拽行为,并在每个会话菜单中增加管理操作。 */
|
|
3773
|
+
const noSubscription = () => () => {};
|
|
3774
|
+
const noBindings = () => void 0;
|
|
3775
|
+
const emptyShortcutRows = [];
|
|
3776
|
+
const noShortcuts$1 = () => emptyShortcutRows;
|
|
3743
3777
|
function CodexWorkspaceBrowser(props) {
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
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 }) {
|
|
3747
3790
|
const sessions = useSessions((state) => state);
|
|
3748
3791
|
const now = useSharedNow();
|
|
3749
3792
|
const pendingInteractions = useHostPendingInteractions(useSessionPendingInteraction, useSessionStatus);
|
|
@@ -4158,6 +4201,9 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
4158
4201
|
setRenameGroupError(userErrorText(reason, t));
|
|
4159
4202
|
}
|
|
4160
4203
|
};
|
|
4204
|
+
const triggerAddWorkspace = () => {
|
|
4205
|
+
requestAddWorkspace?.();
|
|
4206
|
+
};
|
|
4161
4207
|
const sectionOpen = (id) => expanded[`section:${id}`] ?? true;
|
|
4162
4208
|
const toggleSection = (id) => {
|
|
4163
4209
|
setExpanded((current) => ({
|
|
@@ -4505,7 +4551,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
4505
4551
|
},
|
|
4506
4552
|
portal: true,
|
|
4507
4553
|
dense: true,
|
|
4508
|
-
compact: true,
|
|
4509
4554
|
getAnchorRect: menuAt === void 0 ? void 0 : () => pointerMenuRect(menuAt.x, menuAt.y),
|
|
4510
4555
|
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4511
4556
|
type: "button",
|
|
@@ -4696,7 +4741,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
4696
4741
|
},
|
|
4697
4742
|
portal: true,
|
|
4698
4743
|
dense: true,
|
|
4699
|
-
compact: true,
|
|
4700
4744
|
getAnchorRect: sessionMenuAt === void 0 ? void 0 : () => pointerMenuRect(sessionMenuAt.x, sessionMenuAt.y),
|
|
4701
4745
|
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4702
4746
|
type: "button",
|
|
@@ -4898,7 +4942,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
4898
4942
|
},
|
|
4899
4943
|
portal: true,
|
|
4900
4944
|
dense: true,
|
|
4901
|
-
compact: true,
|
|
4902
4945
|
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4903
4946
|
type: "button",
|
|
4904
4947
|
className: "dcu-wb-more",
|
|
@@ -5335,9 +5378,9 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
5335
5378
|
})
|
|
5336
5379
|
})
|
|
5337
5380
|
})]
|
|
5338
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.
|
|
5381
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
5339
5382
|
className: "dcu-wb-actions",
|
|
5340
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
5383
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
5341
5384
|
type: "button",
|
|
5342
5385
|
className: "dcu-wb-more",
|
|
5343
5386
|
"aria-label": t("workspace.createGroup"),
|
|
@@ -5349,7 +5392,19 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
5349
5392
|
setCreateGroupOpen(true);
|
|
5350
5393
|
},
|
|
5351
5394
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CreateGroupIcon, {})
|
|
5352
|
-
})
|
|
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
|
+
})]
|
|
5353
5408
|
})]
|
|
5354
5409
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5355
5410
|
className: "dcu-wb-section-body",
|
|
@@ -5541,7 +5596,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
5541
5596
|
},
|
|
5542
5597
|
portal: true,
|
|
5543
5598
|
dense: true,
|
|
5544
|
-
compact: true,
|
|
5545
5599
|
side: "bottom",
|
|
5546
5600
|
align: "start",
|
|
5547
5601
|
getAnchorRect: () => headerMenu.getRect(),
|
|
@@ -6511,7 +6565,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
6511
6565
|
},
|
|
6512
6566
|
portal: true,
|
|
6513
6567
|
dense: true,
|
|
6514
|
-
compact: true,
|
|
6515
6568
|
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
6516
6569
|
type: "button",
|
|
6517
6570
|
className: "dcu-wb-more",
|
|
@@ -7478,7 +7531,7 @@ html[data-platform=darwin]:not([data-fullscreen]) .dcu-root.dcu-compact{padding-
|
|
|
7478
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}}
|
|
7479
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}
|
|
7480
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}
|
|
7481
|
-
.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
|
|
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}}
|
|
7482
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}
|
|
7483
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}
|
|
7484
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)}
|
|
@@ -9031,6 +9084,7 @@ html[data-dcu-official-turn-navigator-supported=true] .dcu-turn-navigator,html:h
|
|
|
9031
9084
|
const NS = "michengai.codexUi";
|
|
9032
9085
|
const zh = {
|
|
9033
9086
|
"workspace.addFailed": "无法添加工作区",
|
|
9087
|
+
"workspace.add": "添加工作区",
|
|
9034
9088
|
"workspace.retry": "重试",
|
|
9035
9089
|
"workspace.chooseAgain": "重新选择",
|
|
9036
9090
|
"navigation.back": "后退",
|
|
@@ -9070,6 +9124,9 @@ html[data-dcu-official-turn-navigator-supported=true] .dcu-turn-navigator,html:h
|
|
|
9070
9124
|
"settings.documentDescription": "在外部编辑器中查看和编辑配置",
|
|
9071
9125
|
"settings.documentOpen": "打开",
|
|
9072
9126
|
"settings.documentOpening": "打开中…",
|
|
9127
|
+
"settings.developerTools.title": "显示代码工作视图",
|
|
9128
|
+
"settings.developerTools.description": "开启后,显示轨迹、本轮代码差异,可选择完整的 Agent 预设切换",
|
|
9129
|
+
"settings.developerTools.error": "保存失败,请重试",
|
|
9073
9130
|
"settings.openDocumentError": "无法打开配置文件",
|
|
9074
9131
|
"settings.search": "搜索设置…",
|
|
9075
9132
|
"settings.personal": "个人",
|
|
@@ -9320,6 +9377,7 @@ html[data-dcu-official-turn-navigator-supported=true] .dcu-turn-navigator,html:h
|
|
|
9320
9377
|
};
|
|
9321
9378
|
const en = {
|
|
9322
9379
|
"workspace.addFailed": "Could not add workspace",
|
|
9380
|
+
"workspace.add": "Add workspace",
|
|
9323
9381
|
"workspace.retry": "Retry",
|
|
9324
9382
|
"workspace.chooseAgain": "Choose again",
|
|
9325
9383
|
"navigation.back": "Back",
|
|
@@ -9359,6 +9417,9 @@ html[data-dcu-official-turn-navigator-supported=true] .dcu-turn-navigator,html:h
|
|
|
9359
9417
|
"settings.documentDescription": "View and edit configuration in an external editor",
|
|
9360
9418
|
"settings.documentOpen": "Open",
|
|
9361
9419
|
"settings.documentOpening": "Opening…",
|
|
9420
|
+
"settings.developerTools.title": "Show coding view",
|
|
9421
|
+
"settings.developerTools.description": "Shows trajectory, code diffs, and all Agent presets",
|
|
9422
|
+
"settings.developerTools.error": "Could not save. Please try again.",
|
|
9362
9423
|
"settings.openDocumentError": "Could not open configuration file",
|
|
9363
9424
|
"settings.search": "Search settings…",
|
|
9364
9425
|
"settings.personal": "Personal",
|
|
@@ -9640,6 +9701,148 @@ html[data-dcu-official-turn-navigator-supported=true] .dcu-turn-navigator,html:h
|
|
|
9640
9701
|
};
|
|
9641
9702
|
}
|
|
9642
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
|
|
9643
9846
|
//#region src/client/host-open-path.ts
|
|
9644
9847
|
const OPEN_IN_EXPLORER_ENDPOINT = CODEX_UI_API_ENDPOINTS.openInExplorer;
|
|
9645
9848
|
/** “在资源管理器中打开”属于明确的系统动作,不应被侧边栏文件预览器接管。 */
|
|
@@ -10006,6 +10209,17 @@ body[data-ds-dark-theme] .dcu-settings-nav{--sp-text:var(--dcu-sidebar-navigatio
|
|
|
10006
10209
|
.dcu-settings-row button{font-size:13px;border-radius:8px}
|
|
10007
10210
|
.dcu-settings-row input{max-width:100%}
|
|
10008
10211
|
.dcu-settings-document{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 0;font-size:14px;line-height:20px}
|
|
10212
|
+
.dcu-settings-developer-tools{display:flex;align-items:center;justify-content:space-between;gap:24px;width:100%;padding:12px 0;font-size:14px;line-height:20px}
|
|
10213
|
+
.dcu-settings-developer-tools-copy{min-width:0}
|
|
10214
|
+
.dcu-settings-developer-tools-title{font-size:14px;line-height:20px;font-weight:400;color:var(--sp-text)}
|
|
10215
|
+
.dcu-settings-developer-tools-description{margin-top:4px;font-size:12px;line-height:18px;color:var(--sp-muted)}
|
|
10216
|
+
.dcu-settings-developer-tools-error{margin-top:4px;font-size:12px;line-height:18px;color:#f87171}
|
|
10217
|
+
.dcu-settings-switch{box-sizing:border-box;position:relative;flex:0 0 auto;width:36px;height:20px;padding:2px;border:0;border-radius:999px;background:var(--dsw-alias-border-l3,rgba(127,127,127,.35));cursor:pointer;outline:none}
|
|
10218
|
+
.dcu-settings-switch:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#459cff);outline-offset:2px}
|
|
10219
|
+
.dcu-settings-switch[aria-checked=true]{background:var(--dsw-alias-brand-primary,#000)}
|
|
10220
|
+
.dcu-settings-switch:disabled{cursor:default;opacity:.5}
|
|
10221
|
+
.dcu-settings-switch-thumb{display:block;width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-switch-thumb,#fff);box-shadow:0 1px 2px rgba(0,0,0,.15);transition:transform 120ms ease;pointer-events:none}
|
|
10222
|
+
.dcu-settings-switch[aria-checked=true] .dcu-settings-switch-thumb{background:var(--dsw-alias-label-primary-foreground,#fff);transform:translateX(16px)}
|
|
10009
10223
|
.dcu-settings-document-copy{min-width:0}
|
|
10010
10224
|
.dcu-settings-document p{margin:4px 0 0;font-size:12px;color:var(--sp-muted);overflow-wrap:anywhere}
|
|
10011
10225
|
.dcu-settings-document button{flex:none;min-height:36px;padding:8px 16px;border:0;border-radius:8px;background:var(--sp-hover);color:var(--sp-text);font:inherit;font-size:13px;cursor:pointer;transition:background .15s}
|
|
@@ -10529,7 +10743,126 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
|
|
|
10529
10743
|
});
|
|
10530
10744
|
}
|
|
10531
10745
|
//#endregion
|
|
10746
|
+
//#region src/client/DeveloperToolsRow.tsx
|
|
10747
|
+
function DeveloperToolsRow({ developerTools, t }) {
|
|
10748
|
+
const enabled = (0, react.useSyncExternalStore)(developerTools.enabled.subscribe, developerTools.enabled.getSnapshot);
|
|
10749
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
10750
|
+
const [failed, setFailed] = (0, react.useState)(false);
|
|
10751
|
+
const toggle = (next) => {
|
|
10752
|
+
setFailed(false);
|
|
10753
|
+
setBusy(true);
|
|
10754
|
+
developerTools.setEnabled(next).catch(() => {
|
|
10755
|
+
setFailed(true);
|
|
10756
|
+
}).finally(() => {
|
|
10757
|
+
setBusy(false);
|
|
10758
|
+
});
|
|
10759
|
+
};
|
|
10760
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
10761
|
+
className: "dcu-settings-developer-tools",
|
|
10762
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
10763
|
+
className: "dcu-settings-developer-tools-copy",
|
|
10764
|
+
children: [
|
|
10765
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10766
|
+
className: "dcu-settings-developer-tools-title",
|
|
10767
|
+
children: t("settings.developerTools.title")
|
|
10768
|
+
}),
|
|
10769
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10770
|
+
className: "dcu-settings-developer-tools-description",
|
|
10771
|
+
children: t("settings.developerTools.description")
|
|
10772
|
+
}),
|
|
10773
|
+
failed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10774
|
+
className: "dcu-settings-developer-tools-error",
|
|
10775
|
+
role: "alert",
|
|
10776
|
+
children: t("settings.developerTools.error")
|
|
10777
|
+
})
|
|
10778
|
+
]
|
|
10779
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
10780
|
+
type: "button",
|
|
10781
|
+
role: "switch",
|
|
10782
|
+
"aria-checked": enabled,
|
|
10783
|
+
"aria-label": t("settings.developerTools.title"),
|
|
10784
|
+
disabled: busy,
|
|
10785
|
+
className: "dcu-settings-switch",
|
|
10786
|
+
onClick: () => {
|
|
10787
|
+
toggle(!enabled);
|
|
10788
|
+
},
|
|
10789
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "dcu-settings-switch-thumb" })
|
|
10790
|
+
})]
|
|
10791
|
+
});
|
|
10792
|
+
}
|
|
10793
|
+
//#endregion
|
|
10532
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
|
+
}
|
|
10533
10866
|
/** 快捷键服务可能晚于本插件启动。等到它就绪后再读 catalog,避免注册时一次取值把提示永久丢掉。 */
|
|
10534
10867
|
const emptyShortcuts = [];
|
|
10535
10868
|
function liveShortcutCatalog(ctx) {
|
|
@@ -10583,7 +10916,7 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
|
|
|
10583
10916
|
const spec = ctx.slots.spec;
|
|
10584
10917
|
return typeof spec === "function" && spec.call(ctx.slots, name) !== void 0;
|
|
10585
10918
|
};
|
|
10586
|
-
const officialSettingsReady = () => declared("settings.launcher")
|
|
10919
|
+
const officialSettingsReady = () => declared("settings.launcher");
|
|
10587
10920
|
const connection = ctx.get("connection");
|
|
10588
10921
|
const shortcuts = liveShortcutCatalog(ctx);
|
|
10589
10922
|
const source = (name) => {
|
|
@@ -10661,46 +10994,25 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
|
|
|
10661
10994
|
ctx.inject(["settingsScope", "remote.settings"], (settingsCtx) => {
|
|
10662
10995
|
return bindSettingsDocument(settingsCtx, settingsCtx.settingsScope);
|
|
10663
10996
|
});
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
|
|
10672
|
-
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
"settings.action": {
|
|
10678
|
-
kind: "list",
|
|
10679
|
-
scope: "root"
|
|
10680
|
-
},
|
|
10681
|
-
"settings.close": {
|
|
10682
|
-
kind: "single",
|
|
10683
|
-
scope: "root"
|
|
10684
|
-
},
|
|
10685
|
-
"settings.section": {
|
|
10686
|
-
kind: "list",
|
|
10687
|
-
scope: "root"
|
|
10688
|
-
},
|
|
10689
|
-
"settings.onboarding": {
|
|
10690
|
-
kind: "list",
|
|
10691
|
-
scope: "root"
|
|
10692
|
-
}
|
|
10693
|
-
};
|
|
10997
|
+
ctx.inject(["configForms"], (configFormsCtx) => {
|
|
10998
|
+
const configForms = configFormsCtx.configForms;
|
|
10999
|
+
if (!configForms?.developerTools) return;
|
|
11000
|
+
const developerTools = configForms.developerTools;
|
|
11001
|
+
return configFormsCtx.slots.inject("settings.general.item", () => configFormsCtx.slots.register({
|
|
11002
|
+
name: "settings.general.item",
|
|
11003
|
+
id: "developer-tools",
|
|
11004
|
+
priority: -1,
|
|
11005
|
+
order: 15,
|
|
11006
|
+
locale: NS,
|
|
11007
|
+
inject: () => ({ developerTools })
|
|
11008
|
+
}, DeveloperToolsRow));
|
|
11009
|
+
});
|
|
10694
11010
|
ctx.slots.inject("sidebar.settings", () => registerAfterOfficialWave(ctx.slots, "sidebar.settings", officialSettingsReady, () => {
|
|
10695
|
-
|
|
10696
|
-
if (!officialSettingsReady()) {
|
|
10697
|
-
for (const [name, spec] of Object.entries(shellChildren)) if (!declared(name)) Object.assign(children, { [name]: spec });
|
|
10698
|
-
}
|
|
10699
|
-
return ctx.slots.register({
|
|
11011
|
+
return registerMirrors(ctx, shellAliases, () => ctx.slots.register({
|
|
10700
11012
|
name: "sidebar.settings",
|
|
10701
11013
|
priority: -1,
|
|
10702
11014
|
locale: NS,
|
|
10703
|
-
children,
|
|
11015
|
+
children: shellAliasChildren,
|
|
10704
11016
|
inject: () => ({
|
|
10705
11017
|
sections,
|
|
10706
11018
|
onboarding,
|
|
@@ -10711,29 +11023,20 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
|
|
|
10711
11023
|
accountLauncher: accountLauncherPresence(ctx.slots),
|
|
10712
11024
|
shortcuts
|
|
10713
11025
|
})
|
|
10714
|
-
},
|
|
10715
|
-
}));
|
|
11026
|
+
}, AliasedCodexSettingsPage));
|
|
11027
|
+
}, true));
|
|
10716
11028
|
ctx.slots.inject("settings.section", () => registerAfterOfficialWave(ctx.slots, "settings.section", () => declared("settings.general.item"), () => {
|
|
10717
|
-
|
|
10718
|
-
if (!declared("settings.general.item")) children["settings.general.item"] = {
|
|
10719
|
-
kind: "list",
|
|
10720
|
-
scope: "root"
|
|
10721
|
-
};
|
|
10722
|
-
if (!declared("settings.general.footer")) children["settings.general.footer"] = {
|
|
10723
|
-
kind: "list",
|
|
10724
|
-
scope: "root"
|
|
10725
|
-
};
|
|
10726
|
-
return ctx.slots.register({
|
|
11029
|
+
return registerMirrors(ctx, generalAliases, () => ctx.slots.register({
|
|
10727
11030
|
name: "settings.section",
|
|
10728
11031
|
id: "general",
|
|
10729
11032
|
priority: -1,
|
|
10730
11033
|
order: 0,
|
|
10731
11034
|
locale: NS,
|
|
10732
11035
|
label: () => t("settings.general"),
|
|
10733
|
-
children,
|
|
11036
|
+
children: generalAliasChildren,
|
|
10734
11037
|
inject: () => ({ items })
|
|
10735
|
-
},
|
|
10736
|
-
}));
|
|
11038
|
+
}, AliasedCodexGeneralSettings));
|
|
11039
|
+
}, true));
|
|
10737
11040
|
}
|
|
10738
11041
|
//#endregion
|
|
10739
11042
|
//#region src/client/official-turn-navigator.ts
|
|
@@ -11465,10 +11768,6 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
|
|
|
11465
11768
|
}, "michengai-codex-ui: workspace shortcuts");
|
|
11466
11769
|
registerWorkspaceDirectoryFlow(ctx);
|
|
11467
11770
|
const ownSidebarChildren = {
|
|
11468
|
-
"sidebar.panellist": {
|
|
11469
|
-
kind: "list",
|
|
11470
|
-
scope: "root"
|
|
11471
|
-
},
|
|
11472
11771
|
[WORKSPACE_DIRECTORY_FLOW]: {
|
|
11473
11772
|
kind: "single",
|
|
11474
11773
|
scope: "root"
|
|
@@ -11483,6 +11782,10 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
|
|
|
11483
11782
|
}
|
|
11484
11783
|
};
|
|
11485
11784
|
const sharedSidebarChildren = {
|
|
11785
|
+
"sidebar.panellist": {
|
|
11786
|
+
kind: "list",
|
|
11787
|
+
scope: "root"
|
|
11788
|
+
},
|
|
11486
11789
|
"sidebar.workspaces": {
|
|
11487
11790
|
kind: "single",
|
|
11488
11791
|
scope: "root"
|
|
@@ -11496,20 +11799,56 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
|
|
|
11496
11799
|
scope: "root"
|
|
11497
11800
|
}
|
|
11498
11801
|
};
|
|
11499
|
-
const
|
|
11500
|
-
|
|
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) => {
|
|
11501
11834
|
const declared = (name) => {
|
|
11502
11835
|
const spec = ctx.slots.spec;
|
|
11503
11836
|
return typeof spec === "function" && spec.call(ctx.slots, name) !== void 0;
|
|
11504
11837
|
};
|
|
11505
|
-
const
|
|
11506
|
-
for (const [name, spec] of Object.entries({
|
|
11838
|
+
const allSidebarChildren = {
|
|
11507
11839
|
...sharedSidebarChildren,
|
|
11508
|
-
...ownSidebarChildren
|
|
11509
|
-
|
|
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 });
|
|
11510
11849
|
const register = (next) => {
|
|
11511
11850
|
try {
|
|
11512
|
-
|
|
11851
|
+
const unregister = ctx.slots.register({
|
|
11513
11852
|
name: "sidebar",
|
|
11514
11853
|
priority: -1,
|
|
11515
11854
|
registrant: "michengai-codex-ui",
|
|
@@ -11547,18 +11886,31 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
|
|
|
11547
11886
|
selectGlobalPanel(ctx.layout, id);
|
|
11548
11887
|
}
|
|
11549
11888
|
})
|
|
11550
|
-
},
|
|
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
|
+
};
|
|
11551
11902
|
} catch (error) {
|
|
11552
11903
|
const message = error instanceof Error ? error.message : String(error);
|
|
11553
11904
|
const conflict = /slot "([^"]+)" is already declared/.exec(message);
|
|
11554
|
-
|
|
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;
|
|
11555
11907
|
const rest = { ...next };
|
|
11556
|
-
delete rest[
|
|
11908
|
+
delete rest[conflictKey];
|
|
11557
11909
|
return register(rest);
|
|
11558
11910
|
}
|
|
11559
11911
|
};
|
|
11560
11912
|
return register(children);
|
|
11561
|
-
}));
|
|
11913
|
+
}, true));
|
|
11562
11914
|
ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
|
|
11563
11915
|
name: "conversation.session.header.utilities",
|
|
11564
11916
|
id: "turn-navigator",
|
|
@@ -11659,7 +12011,8 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
|
|
|
11659
12011
|
insertSessionBefore: (workspaceId, sessionId, beforeSessionId) => ctx.workspaces.insertSessionBefore(workspaceId, sessionId, beforeSessionId),
|
|
11660
12012
|
startSession: (workspaceId) => {
|
|
11661
12013
|
startWorkspaceSession(ctx, workspaceId);
|
|
11662
|
-
}
|
|
12014
|
+
},
|
|
12015
|
+
workspaceShortcuts
|
|
11663
12016
|
})
|
|
11664
12017
|
}, CodexWorkspaceBrowser));
|
|
11665
12018
|
ctx.effect(() => {
|
|
@@ -11678,7 +12031,7 @@ html[data-dsh-native-backdrop=mica] .dcu-settings-page,html[data-dsh-native-back
|
|
|
11678
12031
|
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
11679
12032
|
name: "settings.section",
|
|
11680
12033
|
id: "connectors",
|
|
11681
|
-
order:
|
|
12034
|
+
order: 30,
|
|
11682
12035
|
label: () => t("sidebar.connectors"),
|
|
11683
12036
|
icon: "connector",
|
|
11684
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
|
-
/**
|
|
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": "后退",
|
|
@@ -40,6 +41,9 @@ const zh = {
|
|
|
40
41
|
"settings.documentDescription": "在外部编辑器中查看和编辑配置",
|
|
41
42
|
"settings.documentOpen": "打开",
|
|
42
43
|
"settings.documentOpening": "打开中…",
|
|
44
|
+
"settings.developerTools.title": "显示代码工作视图",
|
|
45
|
+
"settings.developerTools.description": "开启后,显示轨迹、本轮代码差异,可选择完整的 Agent 预设切换",
|
|
46
|
+
"settings.developerTools.error": "保存失败,请重试",
|
|
43
47
|
"settings.openDocumentError": "无法打开配置文件",
|
|
44
48
|
"settings.search": "搜索设置…",
|
|
45
49
|
"settings.personal": "个人",
|
|
@@ -290,6 +294,7 @@ const zh = {
|
|
|
290
294
|
};
|
|
291
295
|
const en = {
|
|
292
296
|
"workspace.addFailed": "Could not add workspace",
|
|
297
|
+
"workspace.add": "Add workspace",
|
|
293
298
|
"workspace.retry": "Retry",
|
|
294
299
|
"workspace.chooseAgain": "Choose again",
|
|
295
300
|
"navigation.back": "Back",
|
|
@@ -329,6 +334,9 @@ const en = {
|
|
|
329
334
|
"settings.documentDescription": "View and edit configuration in an external editor",
|
|
330
335
|
"settings.documentOpen": "Open",
|
|
331
336
|
"settings.documentOpening": "Opening…",
|
|
337
|
+
"settings.developerTools.title": "Show coding view",
|
|
338
|
+
"settings.developerTools.description": "Shows trajectory, code diffs, and all Agent presets",
|
|
339
|
+
"settings.developerTools.error": "Could not save. Please try again.",
|
|
332
340
|
"settings.openDocumentError": "Could not open configuration file",
|
|
333
341
|
"settings.search": "Search settings…",
|
|
334
342
|
"settings.personal": "Personal",
|
|
@@ -859,27 +867,47 @@ async function generateCodexSessionTitle(llm, request, locale = "zh") {
|
|
|
859
867
|
}])}`;
|
|
860
868
|
if (Buffer.byteLength(framed, "utf8") > MAX_INPUT_BYTES) throw new Error("codex-ui session title input too large");
|
|
861
869
|
const signal = abortableSignal(request.signal);
|
|
862
|
-
const
|
|
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({
|
|
863
901
|
provider: route.provider,
|
|
864
902
|
model: route.model,
|
|
865
|
-
messages
|
|
866
|
-
id: crypto.randomUUID(),
|
|
867
|
-
role: "user",
|
|
868
|
-
content: [{
|
|
869
|
-
type: "text",
|
|
870
|
-
text: framed
|
|
871
|
-
}],
|
|
872
|
-
source: {
|
|
873
|
-
kind: "plugin",
|
|
874
|
-
plugin: "michengai-codex-ui"
|
|
875
|
-
}
|
|
876
|
-
}],
|
|
903
|
+
messages,
|
|
877
904
|
system: prompt.system,
|
|
878
905
|
maxTokens: MAX_OUTPUT_TOKENS,
|
|
879
906
|
sessionId: session.id,
|
|
880
907
|
purpose: "session-title",
|
|
881
908
|
signal
|
|
882
|
-
})
|
|
909
|
+
});
|
|
910
|
+
const raw = await collectText(chunks);
|
|
883
911
|
signal.throwIfAborted();
|
|
884
912
|
const parsed = parseTypeAndTheme(raw);
|
|
885
913
|
if (parsed === void 0) throw new Error("codex-ui session title invalid model output");
|
|
@@ -912,12 +940,159 @@ function registerSessionTitleProvider(ctx) {
|
|
|
912
940
|
}
|
|
913
941
|
}
|
|
914
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
|
|
915
1084
|
//#region src/session-title-plugin.ts
|
|
916
1085
|
const name = "michengai-codex-ui-session-title";
|
|
917
|
-
const inject = [
|
|
918
|
-
|
|
1086
|
+
const inject = [
|
|
1087
|
+
"sessionTitle",
|
|
1088
|
+
"llm",
|
|
1089
|
+
"loader"
|
|
1090
|
+
];
|
|
1091
|
+
/** Register teardown before asynchronous official-provider draining. */
|
|
919
1092
|
function apply(ctx) {
|
|
920
|
-
|
|
1093
|
+
const lifecycle = startSessionTitleLifecycle(ctx);
|
|
1094
|
+
ctx.effect(() => lifecycle.dispose, "michengai-codex-ui: session title");
|
|
1095
|
+
return lifecycle.ready;
|
|
921
1096
|
}
|
|
922
1097
|
//#endregion
|
|
923
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.
|
|
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",
|