@michengai/dsh-codex-ui 0.2.56 → 0.2.58

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/README.md CHANGED
@@ -201,8 +201,6 @@ pnpm build
201
201
  pnpm test
202
202
  ```
203
203
 
204
- ## Documentation and license
205
-
206
- Start from the [handoff index](docs/00-交接入口/00-阅读导航.md) for project status, architecture, and iteration notes.
204
+ ## License
207
205
 
208
206
  This project is licensed under [Apache License 2.0](LICENSE). Conversation-management workflow is informed by [Semidia/dsh-session-manager](https://github.com/Semidia/dsh-session-manager), but this plugin is implemented independently through public DSH slots and services.
package/README.zh-CN.md CHANGED
@@ -201,8 +201,6 @@ pnpm build
201
201
  pnpm test
202
202
  ```
203
203
 
204
- ## 文档与许可证
205
-
206
- 项目状态、技术架构和迭代记录从[文档交接入口](docs/00-交接入口/00-阅读导航.md)开始。
204
+ ## 许可证
207
205
 
208
206
  本项目采用 [Apache License 2.0](LICENSE)。会话管理工作流参考 [Semidia/dsh-session-manager](https://github.com/Semidia/dsh-session-manager),但本插件独立通过 DSH 公开插槽和服务实现。
package/dist/client.js CHANGED
@@ -3417,9 +3417,11 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3417
3417
  });
3418
3418
  }
3419
3419
  CodexSidebar.displayName = "michengai-codex-ui";
3420
- //#endregion
3421
- //#region src/dependencies.ts
3422
3420
  const MANAGED_DEPENDENCIES = [
3421
+ {
3422
+ id: "suite",
3423
+ packageName: "@michengai/dsh-codex-suite"
3424
+ },
3423
3425
  {
3424
3426
  id: "ui",
3425
3427
  packageName: "@michengai/dsh-codex-ui"
@@ -3780,7 +3782,7 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3780
3782
  "about.feature.conversation": "保留原生消息、工具调用、输入、权限和模型选择,仅调整容器视觉",
3781
3783
  "about.feature.navigator": "当前会话提供轮次缩略导航,可快速跳转至每一次用户提问",
3782
3784
  "about.dependencies": "配套管理插件",
3783
- "about.dependenciesDescription": "可在此检查并更新本插件,以及专家、技能、归档、IM、定时任务和第三方插件市场;点击安装会从 npm 下载并写入当前 Web profile。",
3785
+ "about.dependenciesDescription": "可先安装 Codex 套件一键装齐配套插件,也可单独检查并更新专家、技能、归档、IM、定时任务和第三方插件市场。",
3784
3786
  "about.loading": "正在读取依赖安装状态…",
3785
3787
  "about.statusFailed": "暂时无法读取依赖安装状态。",
3786
3788
  "about.installed": "已安装",
@@ -3791,6 +3793,7 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3791
3793
  "about.installing": "安装中",
3792
3794
  "about.installFailed": "依赖安装失败,请稍后重试。",
3793
3795
  "about.restartRequired": "依赖安装完成。请重启 DSH Web 服务以加载新插件。",
3796
+ "about.dependency.suite": "Codex 套件",
3794
3797
  "about.dependency.ui": "Codex UI",
3795
3798
  "about.dependency.experts": "专家管理",
3796
3799
  "about.dependency.skills": "技能管理",
@@ -3901,7 +3904,7 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3901
3904
  "about.feature.conversation": "Keeps native messages, tool calls, composer, permissions, and model selection while refining the container visuals",
3902
3905
  "about.feature.navigator": "Navigate directly to each user prompt with the current conversation turn navigator",
3903
3906
  "about.dependencies": "Companion management plugins",
3904
- "about.dependenciesDescription": "Check and update this plugin here, along with the expert, skill, archive, IM, scheduled-task, and third-party marketplace companions. Installation downloads from npm and writes to the current Web profile.",
3907
+ "about.dependenciesDescription": "Install the Codex suite to get all companion plugins at once, or check and update the expert, skill, archive, IM, scheduled-task, and marketplace plugins individually.",
3905
3908
  "about.loading": "Loading dependency status…",
3906
3909
  "about.statusFailed": "Dependency status is temporarily unavailable.",
3907
3910
  "about.installed": "Installed",
@@ -3912,6 +3915,7 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3912
3915
  "about.installing": "Installing",
3913
3916
  "about.installFailed": "Dependency installation failed. Try again later.",
3914
3917
  "about.restartRequired": "Installation is complete. Restart DSH Web to load the new plugin.",
3918
+ "about.dependency.suite": "Codex suite",
3915
3919
  "about.dependency.ui": "Codex UI",
3916
3920
  "about.dependency.experts": "Expert management",
3917
3921
  "about.dependency.skills": "Skill management",
package/dist/index.mjs CHANGED
@@ -4,7 +4,20 @@ import { homedir } from "node:os";
4
4
  import { resolve } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  //#region src/dependencies.ts
7
+ const SUITE_PACKAGE = "@michengai/dsh-codex-suite";
8
+ const SUITE_MEMBER_PACKAGES = [
9
+ "@michengai/dsh-codex-ui",
10
+ "@michengai/dsh-agency-agents",
11
+ "@michengai/dsh-skills-manager",
12
+ "@michengai/dsh-archive-manager",
13
+ "@michengai/dsh-im-connect",
14
+ "@michengai/dsh-automation"
15
+ ];
7
16
  const MANAGED_DEPENDENCIES = [
17
+ {
18
+ id: "suite",
19
+ packageName: SUITE_PACKAGE
20
+ },
8
21
  {
9
22
  id: "ui",
10
23
  packageName: "@michengai/dsh-codex-ui"
@@ -43,14 +56,28 @@ function profileDirectory() {
43
56
  if (process.env.DSH_PROFILE_DIR !== void 0) return process.env.DSH_PROFILE_DIR;
44
57
  return resolve(homedir(), ".dsh", "profiles", "web");
45
58
  }
46
- async function profileManifest() {
59
+ async function declaredPluginNames() {
47
60
  try {
48
- return JSON.parse(await readFile(resolve(profileDirectory(), "package.json"), "utf8"));
61
+ const manifest = JSON.parse(await readFile(resolve(profileDirectory(), "package.json"), "utf8"));
62
+ return Object.keys({
63
+ ...manifest.devDependencies,
64
+ ...manifest.dependencies
65
+ });
49
66
  } catch (error) {
50
- if (error.code === "ENOENT") return {};
67
+ if (error.code === "ENOENT") return [];
51
68
  throw error;
52
69
  }
53
70
  }
71
+ /** 安装套件前卸掉已单独安装的子插件,避免两套 patch 重复注册同一 id。 */
72
+ function pluginsToRemoveBeforeInstall(declared, installing) {
73
+ if (installing !== "@michengai/dsh-codex-suite") return [];
74
+ return SUITE_MEMBER_PACKAGES.filter((name) => declared.includes(name));
75
+ }
76
+ /** 已装套件时,子插件的安装/更新改走套件,避免再写入一份 bundle。 */
77
+ function resolveDshPluginTarget(installing, declared) {
78
+ if (installing !== "@michengai/dsh-codex-suite" && SUITE_MEMBER_PACKAGES.includes(installing) && declared.includes("@michengai/dsh-codex-suite")) return SUITE_PACKAGE;
79
+ return installing;
80
+ }
54
81
  async function installedPackageVersion(packageName) {
55
82
  try {
56
83
  const manifest = JSON.parse(await readFile(resolve(profileDirectory(), "node_modules", ...packageName.split("/"), "package.json"), "utf8"));
@@ -60,6 +87,10 @@ async function installedPackageVersion(packageName) {
60
87
  throw error;
61
88
  }
62
89
  }
90
+ /** 以 node_modules 实际版本为准;套件嵌套安装没有写进顶层 dependencies,也算已安装。 */
91
+ function isManagedPackageInstalled(input) {
92
+ return input.installedVersion !== void 0 && input.installedVersion !== "";
93
+ }
63
94
  /** npm latest 查询缓存有效期:避免每次打开“关于”页都打 7 个 registry 请求。 */
64
95
  const LATEST_CACHE_TTL_MS = 3e5;
65
96
  const latestCache = /* @__PURE__ */ new Map();
@@ -133,15 +164,9 @@ function newerVersion(installed, latest) {
133
164
  }
134
165
  /** 返回 Web profile 中固定管理插件的实际安装版本与 npm latest 状态。 */
135
166
  async function dependencyStatuses() {
136
- const manifest = await profileManifest();
137
167
  return Promise.all(MANAGED_DEPENDENCIES.map(async (dependency) => {
138
- if ((manifest.dependencies?.[dependency.packageName] ?? manifest.devDependencies?.[dependency.packageName]) === void 0) return {
139
- ...dependency,
140
- installed: false,
141
- updateAvailable: false
142
- };
143
168
  const version = await installedPackageVersion(dependency.packageName);
144
- if (version === void 0) return {
169
+ if (!isManagedPackageInstalled({ installedVersion: version })) return {
145
170
  ...dependency,
146
171
  installed: false,
147
172
  updateAvailable: false
@@ -228,14 +253,20 @@ async function installDependencyLocked(id) {
228
253
  if (dependency === void 0) throw new Error("不支持安装该依赖。");
229
254
  const latestVersion = await npmLatestVersion(dependency.packageName);
230
255
  if (latestVersion === void 0) throw new Error("无法获取 npm 最新版本,请检查网络或 npm registry 后重试。");
231
- await ensureLatestReleaseAllowed(dependency.packageName, latestVersion);
256
+ const declared = await declaredPluginNames();
257
+ const target = resolveDshPluginTarget(dependency.packageName, declared);
258
+ const targetVersion = target === dependency.packageName ? latestVersion : await npmLatestVersion(target);
259
+ if (targetVersion === void 0) throw new Error("无法获取 npm 最新版本,请检查网络或 npm registry 后重试。");
260
+ const remove = pluginsToRemoveBeforeInstall(declared, target);
261
+ if (remove.length > 0) await runDshPlugin(["remove", ...remove]);
262
+ await ensureLatestReleaseAllowed(target, targetVersion);
232
263
  await runDshPlugin([
233
264
  "add",
234
- `${dependency.packageName}@${latestVersion}`,
265
+ `${target}@${targetVersion}`,
235
266
  "--registry=https://registry.npmjs.org/"
236
267
  ]);
237
- const installed = await installedPackageVersion(dependency.packageName);
238
- if (installed !== latestVersion) throw new Error(`已请求 ${dependency.packageName}@${latestVersion},但当前仍是 ${installed ?? "未安装"}。请先停止 DSH Web 后再更新。`);
268
+ const installed = await installedPackageVersion(target);
269
+ if (installed !== targetVersion) throw new Error(`已请求 ${target}@${targetVersion},但当前仍是 ${installed ?? "未安装"}。请先停止 DSH Web 后再更新。`);
239
270
  return dependencyStatuses();
240
271
  }
241
272
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-codex-ui",
3
- "version": "0.2.56",
3
+ "version": "0.2.58",
4
4
  "description": "以 Codex 风格重构 DSH Web 侧栏的独立客户端插件",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {