@michengai/dsh-codex-ui 1.1.48 → 2.0.0
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 +13 -0
- package/CHANGELOG.zh-CN.md +13 -0
- package/README.md +117 -112
- package/README.zh-CN.md +117 -112
- package/assets/icon.svg +25 -0
- package/assets/screenshots/conversation-light.png +0 -0
- package/assets/screenshots/conversation.png +0 -0
- package/assets/screenshots/session-menu.png +0 -0
- package/assets/screenshots/settings-about.png +0 -0
- package/assets/screenshots/sidebar-collapsed.png +0 -0
- package/assets/screenshots/sidebar.png +0 -0
- package/cordis.patch.yml +9 -1
- package/lib/business-api-CSNUY-u5.mjs +11 -0
- package/lib/client.js +6050 -12010
- package/lib/composer-plugin.d.mts +17 -0
- package/lib/composer-plugin.mjs +41 -0
- package/lib/index.mjs +6 -1300
- package/lib/profile-resolver-BlLPRcE8.mjs +66 -0
- package/lib/session-title-plugin.d.mts +1 -1
- package/lib/session-title-plugin.mjs +111 -389
- package/lib/settings-skin-plugin.d.mts +12 -0
- package/lib/settings-skin-plugin.mjs +34 -0
- package/lib/sidebar-plugin.d.mts +17 -0
- package/lib/sidebar-plugin.mjs +43 -0
- package/lib/theme-plugin.d.mts +17 -0
- package/lib/theme-plugin.mjs +43 -0
- package/locale/composer/en.json +6 -0
- package/locale/composer/zh.json +6 -0
- package/locale/en.json +1 -1
- package/locale/settings-skin/en.json +6 -0
- package/locale/settings-skin/zh.json +6 -0
- package/locale/sidebar/en.json +6 -0
- package/locale/sidebar/zh.json +6 -0
- package/locale/theme/en.json +6 -0
- package/locale/theme/zh.json +6 -0
- package/locale/zh.json +1 -1
- package/package.json +71 -47
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { basename, isAbsolute, join, resolve } from "node:path";
|
|
4
|
+
//#region src/profile-resolver.ts
|
|
5
|
+
/**
|
|
6
|
+
* 健壮解析当前 DSH 实例的 Profile 信息:
|
|
7
|
+
* 优先级:
|
|
8
|
+
* 1. Cordis 服务 profileContext(官方运行时注入,最权威)
|
|
9
|
+
* 2. 环境变量 DSH_PROFILE_DIR
|
|
10
|
+
* 3. 命令行参数 --profile <name>
|
|
11
|
+
* 4. 环境变量 DSH_PROFILE
|
|
12
|
+
* 5. 兜底默认值 'web'
|
|
13
|
+
*/
|
|
14
|
+
function resolveCurrentProfile(ctx, customHomeDir) {
|
|
15
|
+
const homeDir = customHomeDir ?? process.env.DSH_HOME ?? join(homedir(), ".dsh");
|
|
16
|
+
let profileName;
|
|
17
|
+
let profileDir;
|
|
18
|
+
try {
|
|
19
|
+
const launched = ctx?.get?.("profileContext");
|
|
20
|
+
if (typeof launched?.name === "string" && launched.name.trim()) profileName = launched.name.trim();
|
|
21
|
+
if (typeof launched?.dir === "string" && isAbsolute(launched.dir)) profileDir = resolve(launched.dir);
|
|
22
|
+
} catch {}
|
|
23
|
+
if (!profileDir && process.env.DSH_PROFILE_DIR) try {
|
|
24
|
+
profileDir = resolve(process.env.DSH_PROFILE_DIR);
|
|
25
|
+
if (!profileName) profileName = basename(profileDir);
|
|
26
|
+
} catch {}
|
|
27
|
+
if (!profileName && typeof process !== "undefined" && Array.isArray(process.argv)) {
|
|
28
|
+
const argv = process.argv;
|
|
29
|
+
for (let i = 0; i < argv.length; i++) {
|
|
30
|
+
const arg = argv[i];
|
|
31
|
+
if (arg === "--profile" && argv[i + 1]) {
|
|
32
|
+
profileName = argv[i + 1].trim();
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
if (typeof arg === "string" && arg.startsWith("--profile=")) {
|
|
36
|
+
profileName = arg.slice(10).trim();
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (!profileName && process.env.DSH_PROFILE) profileName = process.env.DSH_PROFILE.trim();
|
|
42
|
+
if (!profileName) profileName = "web";
|
|
43
|
+
if (!profileDir) profileDir = join(homeDir, "profiles", profileName);
|
|
44
|
+
return {
|
|
45
|
+
profileName,
|
|
46
|
+
profileDir,
|
|
47
|
+
homeDir
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 严格基于当前 Profile 检查 cordis.patch.yml 中是否显式配置了 disabled: true。
|
|
52
|
+
* 杜绝跨 Profile 串读(绝不扫描非当前 Profile 的目录)。
|
|
53
|
+
*/
|
|
54
|
+
function isSubPluginDisabledOnDisk(id, homeDir, ctx) {
|
|
55
|
+
try {
|
|
56
|
+
const { profileDir } = resolveCurrentProfile(ctx, homeDir);
|
|
57
|
+
const patchPath = join(profileDir, "cordis.patch.yml");
|
|
58
|
+
if (existsSync(patchPath)) {
|
|
59
|
+
const content = readFileSync(patchPath, "utf8");
|
|
60
|
+
if (new RegExp(`id:\\s*['"]?${id}['"]?\\s*\\n\\s*disabled:\\s*true`, "m").test(content)) return true;
|
|
61
|
+
}
|
|
62
|
+
} catch {}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { isSubPluginDisabledOnDisk as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "@deepseek-ai/cordis";
|
|
2
2
|
//#region src/session-title-plugin.d.ts
|
|
3
|
-
declare const name = "
|
|
3
|
+
declare const name = "codex-ui-session-title";
|
|
4
4
|
declare const inject: string[];
|
|
5
5
|
/** Register teardown before asynchronous official-provider draining. */
|
|
6
6
|
declare function apply(ctx: Context): Promise<void>;
|