@michengai/dsh-codex-ui 1.1.16 → 1.1.18
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 +45 -0
- package/CHANGELOG.zh-CN.md +45 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/lib/client.js +150 -327
- package/lib/index.mjs +3 -57
- package/lib/session-title-plugin.mjs +0 -14
- package/package.json +44 -39
- package/assets/usage-frame.html +0 -1
- package/lib/usage-frame.css +0 -1
- package/lib/usage-frame.js +0 -496
package/lib/index.mjs
CHANGED
|
@@ -1,37 +1,11 @@
|
|
|
1
1
|
import { apply as apply$1 } from "@deepseek-ai/dsh-client-ui-settings-general";
|
|
2
|
-
import { lstat, mkdir, open, readFile, readdir, realpath, rename, rm, unlink, writeFile } from "node:fs/promises";
|
|
3
|
-
import { basename, dirname, isAbsolute, join, relative, resolve, sep, win32 } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
2
|
import { spawn } from "node:child_process";
|
|
6
3
|
import { existsSync } from "node:fs";
|
|
4
|
+
import { lstat, mkdir, open, readFile, readdir, realpath, rename, rm, unlink, writeFile } from "node:fs/promises";
|
|
7
5
|
import { homedir } from "node:os";
|
|
6
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep, win32 } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
9
|
-
//#region src/usage-frame/contract.ts
|
|
10
|
-
/** 同源费用承载页与宿主之间的最小能力桥;不暴露 Context 或远程服务全集。 */
|
|
11
|
-
const USAGE_FRAME_PATH = "/api/dsh-codex-ui/usage/frame";
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/usage-frame-routes.ts
|
|
14
|
-
/** 提供经过宿主认证的同源费用承载资源;只读取固定文件,不代理计费 API。 */
|
|
15
|
-
const USAGE_FRAME_ROUTES = [
|
|
16
|
-
USAGE_FRAME_PATH,
|
|
17
|
-
`${USAGE_FRAME_PATH}.js`,
|
|
18
|
-
`${USAGE_FRAME_PATH}.css`,
|
|
19
|
-
"/api/dsh-codex-ui/usage/plugin.js"
|
|
20
|
-
];
|
|
21
|
-
async function usageFrameAsset(path, profileDir) {
|
|
22
|
-
const file = {
|
|
23
|
-
[USAGE_FRAME_PATH]: ["text/html; charset=utf-8", fileURLToPath(new URL("../assets/usage-frame.html", import.meta.url))],
|
|
24
|
-
[`${USAGE_FRAME_PATH}.js`]: ["text/javascript; charset=utf-8", fileURLToPath(new URL("./usage-frame.js", import.meta.url))],
|
|
25
|
-
[`${USAGE_FRAME_PATH}.css`]: ["text/css; charset=utf-8", fileURLToPath(new URL("./usage-frame.css", import.meta.url))],
|
|
26
|
-
"/api/dsh-codex-ui/usage/plugin.js": ["text/javascript; charset=utf-8", resolve(profileDir, "node_modules", "@kenz1117", "dsh-ui-usage-billing", "lib", "client.js")]
|
|
27
|
-
}[path];
|
|
28
|
-
if (!file) throw new Error("未知费用资源");
|
|
29
|
-
return {
|
|
30
|
-
contentType: file[0],
|
|
31
|
-
body: await readFile(file[1], "utf8")
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
9
|
//#region src/business-api.ts
|
|
36
10
|
const CODEX_UI_API_BASE = "/api/dsh-codex-ui";
|
|
37
11
|
const CODEX_UI_API_ENDPOINTS = Object.freeze({
|
|
@@ -1987,34 +1961,6 @@ function sessionMoveAuthenticationError(status, error) {
|
|
|
1987
1961
|
function apply(ctx) {
|
|
1988
1962
|
apply$1(ctx);
|
|
1989
1963
|
const host = hostServices(ctx);
|
|
1990
|
-
ctx.effect(() => {
|
|
1991
|
-
const disposers = USAGE_FRAME_ROUTES.map((path) => host.webServer.register({
|
|
1992
|
-
kind: "exact",
|
|
1993
|
-
path,
|
|
1994
|
-
handler: async (request, response) => {
|
|
1995
|
-
if (!authenticateBusinessRequest(ctx, request, response)) return;
|
|
1996
|
-
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
1997
|
-
response.writeHead(405);
|
|
1998
|
-
response.end();
|
|
1999
|
-
return;
|
|
2000
|
-
}
|
|
2001
|
-
try {
|
|
2002
|
-
const asset = await usageFrameAsset(path, resolveDependencyRuntime(ctx).profileDir);
|
|
2003
|
-
response.writeHead(200, {
|
|
2004
|
-
"content-type": asset.contentType,
|
|
2005
|
-
"cache-control": "no-store",
|
|
2006
|
-
"x-content-type-options": "nosniff",
|
|
2007
|
-
"content-security-policy": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self'; frame-ancestors 'self'"
|
|
2008
|
-
});
|
|
2009
|
-
response.end(request.method === "HEAD" ? void 0 : asset.body);
|
|
2010
|
-
} catch {
|
|
2011
|
-
response.writeHead(404, { "content-type": "text/plain; charset=utf-8" });
|
|
2012
|
-
response.end("费用插件或承载资源不可用。");
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
}));
|
|
2016
|
-
return () => disposers.forEach((dispose) => dispose());
|
|
2017
|
-
}, "michengai-codex-ui: usage frame");
|
|
2018
1964
|
ctx.effect(() => {
|
|
2019
1965
|
const foregroundExplorer = new ForegroundExplorer();
|
|
2020
1966
|
foregroundExplorer.warmup().catch((error) => ctx.logger.warn("foreground explorer warmup failed: %s", error));
|
|
@@ -27,13 +27,6 @@ const zh = {
|
|
|
27
27
|
"home.fix.prompt1": "我遇到了一个问题。先问我复现步骤、预期和实际表现,再定位根因并修复。",
|
|
28
28
|
"home.fix.task2": "修复失败的测试",
|
|
29
29
|
"home.fix.prompt2": "请运行当前项目适用的测试,定位失败根因并做最小修复,保留有效的回归覆盖。",
|
|
30
|
-
"usage.title": "使用统计",
|
|
31
|
-
"usage.loading": "正在加载费用面板…",
|
|
32
|
-
"usage.failed": "费用面板暂时无法嵌入,可重试或打开原弹窗。",
|
|
33
|
-
"usage.closed": "费用面板已关闭。",
|
|
34
|
-
"usage.reopen": "重新打开费用面板",
|
|
35
|
-
"usage.retry": "重试",
|
|
36
|
-
"usage.original": "打开原弹窗",
|
|
37
30
|
"settings.title": "设置",
|
|
38
31
|
"settings.back": "返回应用",
|
|
39
32
|
"settings.openDocument": "打开配置文件",
|
|
@@ -318,13 +311,6 @@ const en = {
|
|
|
318
311
|
"home.fix.prompt1": "Help me fix a bug. First ask for reproduction steps, expected behavior, and actual behavior.",
|
|
319
312
|
"home.fix.task2": "Fix failing tests",
|
|
320
313
|
"home.fix.prompt2": "Run the applicable project tests, identify failure causes, and make minimal fixes with meaningful regression coverage.",
|
|
321
|
-
"usage.title": "Usage statistics",
|
|
322
|
-
"usage.loading": "Loading billing dashboard…",
|
|
323
|
-
"usage.failed": "The embedded dashboard is unavailable. Retry or open the original dialog.",
|
|
324
|
-
"usage.closed": "The billing dashboard is closed.",
|
|
325
|
-
"usage.reopen": "Reopen billing dashboard",
|
|
326
|
-
"usage.retry": "Retry",
|
|
327
|
-
"usage.original": "Open original dialog",
|
|
328
314
|
"settings.title": "Settings",
|
|
329
315
|
"settings.back": "Back to app",
|
|
330
316
|
"settings.openDocument": "Open configuration file",
|
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.18",
|
|
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": {
|
|
@@ -65,57 +65,62 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
|
-
"build": "tsc --noEmit && tsdown
|
|
68
|
+
"build": "tsc --noEmit && tsdown",
|
|
69
69
|
"typecheck": "tsc --noEmit",
|
|
70
|
-
"test": "pnpm run typecheck && vitest run && tsdown && node
|
|
70
|
+
"test": "pnpm run typecheck && vitest run && tsdown && node tests/run-assertions.mjs && pnpm run test:layout",
|
|
71
71
|
"test:host": "node scripts/verify-settings-exit.mjs",
|
|
72
72
|
"test:settings-backdrop": "node scripts/verify-settings-backdrop.mjs",
|
|
73
|
-
"test:layout": "node scripts/verify-workspace-drop-layout.mjs --run && node scripts/verify-sidebar-transition.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-
|
|
73
|
+
"test:layout": "node scripts/verify-workspace-drop-layout.mjs --run && node scripts/verify-sidebar-transition.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-upstream-style-regressions.mjs",
|
|
74
74
|
"test:compat": "node scripts/run-compat-host.mjs"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@deepseek-ai/cordis": ">=4.0.2 <5.0.0",
|
|
78
|
-
"@deepseek-ai/dsh-client-connection": ">=0.1.2-rc.1 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
79
|
-
"@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
78
|
+
"@deepseek-ai/dsh-client-connection": ">=0.1.2-rc.1 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
79
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
80
80
|
"@deepseek-ai/dsh-client-runtime": ">=0.1.0-rc.5 <0.2.0 || 0.1.1-rc.2",
|
|
81
|
-
"@deepseek-ai/dsh-client-ui-conversation": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
82
|
-
"@deepseek-ai/dsh-client-ui-input-trigger": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
83
|
-
"@deepseek-ai/dsh-client-ui-layout": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
84
|
-
"@deepseek-ai/dsh-client-ui-primitives": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
85
|
-
"@deepseek-ai/dsh-client-ui-settings": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
86
|
-
"@deepseek-ai/dsh-client-ui-settings-general": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
87
|
-
"@deepseek-ai/dsh-client-ui-sidebar": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
88
|
-
"@deepseek-ai/dsh-client-ui-slots": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
89
|
-
"@deepseek-ai/dsh-client-ui-workspace": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.
|
|
81
|
+
"@deepseek-ai/dsh-client-ui-conversation": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
82
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
83
|
+
"@deepseek-ai/dsh-client-ui-layout": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
84
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
85
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
86
|
+
"@deepseek-ai/dsh-client-ui-settings-general": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
87
|
+
"@deepseek-ai/dsh-client-ui-sidebar": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
88
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
89
|
+
"@deepseek-ai/dsh-client-ui-workspace": ">=0.1.0-rc.5 <0.2.0 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1",
|
|
90
90
|
"react": "^18.2.0",
|
|
91
91
|
"react-dom": "^18.2.0"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@deepseek-ai/cordis": "4.0.
|
|
95
|
-
"@deepseek-ai/dsh-api-session-controller": "0.1.
|
|
96
|
-
"@deepseek-ai/dsh-api-workspace-controller": "0.1.
|
|
97
|
-
"@deepseek-ai/dsh-attachment": "0.1.
|
|
98
|
-
"@deepseek-ai/dsh-client-connection": "0.1.
|
|
99
|
-
"@deepseek-ai/dsh-client-locale": "0.1.
|
|
94
|
+
"@deepseek-ai/cordis": "4.0.4",
|
|
95
|
+
"@deepseek-ai/dsh-api-session-controller": "0.1.7-rc.2",
|
|
96
|
+
"@deepseek-ai/dsh-api-workspace-controller": "0.1.7-rc.2",
|
|
97
|
+
"@deepseek-ai/dsh-attachment": "0.1.7-rc.2",
|
|
98
|
+
"@deepseek-ai/dsh-client-connection": "0.1.7-rc.2",
|
|
99
|
+
"@deepseek-ai/dsh-client-locale": "0.1.7-rc.2",
|
|
100
100
|
"@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
|
|
101
|
-
"@deepseek-ai/dsh-client-store": "0.1.
|
|
102
|
-
"@deepseek-ai/dsh-client-test-runtime": "0.1.
|
|
103
|
-
"@deepseek-ai/dsh-client-ui-chat": "0.1.
|
|
104
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.1.
|
|
105
|
-
"@deepseek-ai/dsh-client-ui-input-trigger": "0.1.
|
|
106
|
-
"@deepseek-ai/dsh-client-ui-layout": "0.1.
|
|
107
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.1.
|
|
108
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.1.
|
|
109
|
-
"@deepseek-ai/dsh-client-ui-session": "0.1.
|
|
110
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.1.
|
|
111
|
-
"@deepseek-ai/dsh-client-ui-settings-general": "0.1.
|
|
112
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "0.1.
|
|
113
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.1.
|
|
114
|
-
"@deepseek-ai/dsh-client-ui-workspace": "0.1.
|
|
115
|
-
"@deepseek-ai/dsh-session": "0.1.
|
|
116
|
-
"@deepseek-ai/dsh-
|
|
117
|
-
"@deepseek-ai/dsh-
|
|
118
|
-
"@deepseek-ai/dsh-
|
|
101
|
+
"@deepseek-ai/dsh-client-store": "0.1.7-rc.2",
|
|
102
|
+
"@deepseek-ai/dsh-client-test-runtime": "0.1.7-rc.2",
|
|
103
|
+
"@deepseek-ai/dsh-client-ui-chat": "0.1.7-rc.2",
|
|
104
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.1.7-rc.2",
|
|
105
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": "0.1.7-rc.2",
|
|
106
|
+
"@deepseek-ai/dsh-client-ui-layout": "0.1.7-rc.2",
|
|
107
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.1.7-rc.2",
|
|
108
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.7-rc.2",
|
|
109
|
+
"@deepseek-ai/dsh-client-ui-session": "0.1.7-rc.2",
|
|
110
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.7-rc.2",
|
|
111
|
+
"@deepseek-ai/dsh-client-ui-settings-general": "0.1.7-rc.2",
|
|
112
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "0.1.7-rc.2",
|
|
113
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.7-rc.2",
|
|
114
|
+
"@deepseek-ai/dsh-client-ui-workspace": "0.1.7-rc.2",
|
|
115
|
+
"@deepseek-ai/dsh-session": "0.1.7-rc.2",
|
|
116
|
+
"@deepseek-ai/dsh-scope": "0.1.7-rc.2",
|
|
117
|
+
"@deepseek-ai/dsh-subagent": "0.1.7-rc.2",
|
|
118
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.7-rc.2",
|
|
119
|
+
"@deepseek-ai/dsh-util-workspace-path": "0.1.7-rc.2",
|
|
120
|
+
"@deepseek-ai/dsh-workspace": "0.1.7-rc.2",
|
|
121
|
+
"diff": "^9.0.0",
|
|
122
|
+
"shiki": "^4.3.1",
|
|
123
|
+
"simple-icons": "16.31.0",
|
|
119
124
|
"@types/jsdom": "^30.0.0",
|
|
120
125
|
"@types/node": "^26.0.0",
|
|
121
126
|
"@types/react": "~18.3.1",
|
package/assets/usage-frame.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!doctype html><html lang="zh-CN"><meta charset="utf-8"><title>使用统计</title><link rel="stylesheet" href="/api/dsh-codex-ui/usage/frame.css"><style>:root{font-family:system-ui,sans-serif;color-scheme:light;--dsw-alias-bg-base:#fff;--dsw-alias-bg-layer-1:#fff;--dsw-alias-bg-layer-2:#f5f5f5;--dsw-alias-bg-layer-3:#eee;--dsw-alias-label-primary:#262626;--dsw-alias-label-secondary:#666;--dsw-alias-label-tertiary:#888;--dsw-alias-label-caption:#888;--dsw-alias-border-l1:#ddd;--dsw-alias-border-l2:#ddd;--dsw-alias-interactive-bg-hover:#eee;--dsw-static-blue-500:#368af5}body[data-ds-dark-theme]{color-scheme:dark;--dsw-alias-bg-base:#181818;--dsw-alias-bg-layer-1:#181818;--dsw-alias-bg-layer-2:#242424;--dsw-alias-bg-layer-3:#303030;--dsw-alias-label-primary:#ddd;--dsw-alias-label-secondary:#aaa;--dsw-alias-label-tertiary:#888;--dsw-alias-label-caption:#888;--dsw-alias-border-l1:#363636;--dsw-alias-border-l2:#363636;--dsw-alias-interactive-bg-hover:#303030}html,body{margin:0;width:100%;height:100%;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}*{box-sizing:border-box}#billing-root{display:none}.dsh-billing-modal{position:fixed!important;inset:0!important;transform:none!important;width:100%!important;max-width:none!important;height:100%!important;max-height:none!important;margin:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;animation:none!important;background:var(--dsw-alias-bg-base)!important}.dsh-billing-modal [data-testid="billing-dashboard"]{height:100%;max-height:none}.dsh-billing-modal [data-testid="billing-dashboard-head"] h2{display:none}.dsh-billing-modal [data-testid="billing-dashboard"]>div:nth-last-child(2){min-height:0;flex:1}div[role=presentation]:has(>.dsh-billing-modal)>div[aria-hidden=true]:first-child{display:none!important}</style><body><div id="billing-root"></div><script src="/api/dsh-codex-ui/usage/frame.js"></script></body></html>
|