dsh-cabinet-mode 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,43 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.1.5] - 2026-11-03
6
+
7
+ ### Fixed
8
+
9
+ - **The market-index refresh no longer races npm propagation.** The index job now
10
+ waits for the just-published version to appear in the registry packument
11
+ (`MARKET_EXPECT_VERSION`, polled every 15 s for up to 10 min) instead of
12
+ regenerating from a stale, partially propagated packument.
13
+ - **Registry reads bypass stale caches.** Every fetch sends
14
+ `cache-control: no-cache` and `pragma: no-cache`, and the packument URL carries a
15
+ one-shot `?t=` cache-buster.
16
+ - **The index can no longer shrink silently.** Before writing, the generator
17
+ compares its version set with the currently published index and refuses to
18
+ replace a larger index with a smaller one (for example while the registry lags),
19
+ unless `MARKET_ALLOW_SHRINK=1` is set. The manual `Market index` workflow exposes
20
+ this as the `allow_shrink` dispatch input for a legitimate shrink after
21
+ `npm deprecate` or unpublish.
22
+ - **Prerelease tags no longer refresh the index.** The release workflow skips the
23
+ market-index job for tags containing `-`: the index rules exclude prereleases, so
24
+ a refresh would only fail with a false "no installable versions" error, and a
25
+ prerelease must not touch the stable index.
26
+ - Removed the ineffective `package-manager-cache: false` input from
27
+ `actions/setup-node` in the release workflow.
28
+
29
+ ### Context
30
+
31
+ - `dsh-cabinet-mode@0.1.4` was published to npm on 2026-11-03 by the
32
+ tag-triggered Trusted Publishing (OIDC) flow, with a provenance attestation on
33
+ sigstore, and its GitHub Release was created. The market-index job that follows
34
+ the publish failed twice because the registry still served a packument containing
35
+ only the `0.0.0-stage` placeholder; this release fixes that chain and is the
36
+ first end-to-end run of tag → npm publish → automatic index refresh.
37
+ - The first OIDC publish, the GitHub Release, the generated `market-index` branch,
38
+ parsing the index, and installing from the npm spec were exercised while
39
+ handling 0.1.4; a real install/update in the DSH plugin market GUI remains
40
+ unverified.
41
+
5
42
  ## [0.1.4] - 2026-11-03
6
43
 
7
44
  ### Added
package/README.md CHANGED
@@ -61,7 +61,7 @@ If any step fails, show the exact error and stop. Do not retry more than once.
61
61
  ## Manual install (3 lines)
62
62
 
63
63
  ```sh
64
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.4/dsh-cabinet-mode-0.1.4.tgz
64
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.5/dsh-cabinet-mode-0.1.5.tgz
65
65
  # fully quit and restart DeepSeek Harness
66
66
  # New session -> mode picker -> 内阁模式
67
67
  ```
@@ -85,7 +85,7 @@ commands work on Linux and macOS.
85
85
  > `dsh-cabinet-mode` in `dsh.profile.bundles`):
86
86
  >
87
87
  > ```sh
88
- > node "<DeepSeek Harness install>\resources\runtime\primary-runtime\dependencies\pnpm\bin\pnpm.mjs" --dir "%USERPROFILE%\.dsh\profiles\desktop" add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.4/dsh-cabinet-mode-0.1.4.tgz
88
+ > node "<DeepSeek Harness install>\resources\runtime\primary-runtime\dependencies\pnpm\bin\pnpm.mjs" --dir "%USERPROFILE%\.dsh\profiles\desktop" add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.5/dsh-cabinet-mode-0.1.5.tgz
89
89
  > ```
90
90
  >
91
91
  > Back up the profile's `package.json` / `pnpm-lock.yaml` first.
@@ -125,16 +125,21 @@ The index is regenerated from the npm registry after every tagged release and on
125
125
  lists published, non-deprecated stable versions; do not edit the `market-index`
126
126
  branch by hand.
127
127
 
128
- > **First release ordering:** `dsh-cabinet-mode` 0.1.4 is the first version intended
129
- > for npm. Until that publish succeeds the package is absent from
130
- > `registry.npmjs.org` and the index URL returns 404 — expected, not an install bug.
131
- > The release workflow publishes to npm first and refreshes the index only after it.
132
-
133
- **Not verified:** the exact market UI labels and click path in your DSH build, and a
134
- real market install/update — 0.1.4 had not been published yet when this was written.
135
- The `dsh-cabinet-mode@<version>` install spec is what the format-1 reader
136
- (`@deepseek-ai/dsh-plugin-market-index@0.2.1-rc.5`, `marketInstallTarget`) returns
137
- for an npm source; that function was executed locally, the UI was not.
128
+ > **Release status (2026-11-03):** `dsh-cabinet-mode@0.1.4` is published on
129
+ > `registry.npmjs.org` — the first release, published by the tag-triggered OIDC
130
+ > workflow with a provenance attestation on sigstore — and the `market-index`
131
+ > branch has been generated from it. The registry also carries a placeholder
132
+ > `0.0.0-stage` prerelease, which the index intentionally does not list. The first
133
+ > OIDC publish, the GitHub Release, the `market-index` branch, parsing the generated
134
+ > index, and installing from the npm spec have all been exercised while handling
135
+ > this release.
136
+ >
137
+ > **Not verified:** the exact plugin-market UI labels and click path in your DSH
138
+ > build, a real install/update in that GUI, and the full tag → publish → automatic
139
+ > index refresh chain; 0.1.5 is the first run of that chain. The
140
+ > `dsh-cabinet-mode@<version>` install spec is what the format-1 reader
141
+ > (`@deepseek-ai/dsh-plugin-market-index@0.2.1-rc.5`, `marketInstallTarget`) returns
142
+ > for an npm source; that function was executed locally, the UI was not.
138
143
 
139
144
  ## Upgrade
140
145
 
@@ -145,7 +150,7 @@ the same install command with the new version URL (or pick the new `.tgz` in the
145
150
  plugin page), then fully quit and restart DeepSeek Harness:
146
151
 
147
152
  ```sh
148
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.4/dsh-cabinet-mode-0.1.4.tgz
153
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.5/dsh-cabinet-mode-0.1.5.tgz
149
154
  ```
150
155
 
151
156
  `dsh plugin --profile desktop list` should report the new version. Upgrades were
@@ -192,7 +197,7 @@ on DSH 0.2.1-rc.5.
192
197
  |---|---|---|---|---|
193
198
  | **A. DSH plugin manager** (recommended): plugin page "Add plugin -> local directory/package", or `dsh plugin --profile <profile> add <absolute path / .tgz / release URL>` | ✅ tested locally on 2026-10-29: local-directory install **and GitHub Release asset URL install**; `dsh plugin --profile desktop list` = 3 packages; composition check passed | ⚙️ code-level inference, **not tested on this machine** | ⚙️ code-level inference, **not tested on this machine** | Pure YAML bundle: no build, no dependencies, no OS-specific code. See [docs/cross-platform.md](docs/cross-platform.md). |
194
199
  | **B. Fallback node scripts** (no plugin manager): `node scripts/install.mjs --profile <profile>` then `--apply`; writes the profile `cordis.patch.yml` | ✅ scripts tested on Windows (dry-run + temp copies) | ⚙️ code-level inference, **not tested** | ⚙️ code-level inference, **not tested** | Same file layout on all platforms: `<DSH_HOME>/profiles/<profile>/cordis.patch.yml`. |
195
- | **Plugin market** (index source): see [Install from the plugin market](#install-from-the-plugin-market) | ❌ **not tested** (0.1.4 was not published at the time of writing) | ❌ **not tested** | ❌ **not tested** | Same npm bundle install through DSH's plugin market; requires the npm publish and the `market-index` branch to exist first. |
200
+ | **Plugin market** (index source): see [Install from the plugin market](#install-from-the-plugin-market) | ❌ **GUI install not tested** (npm publish + index are live as of 2026-11-03) | ❌ **not tested** | ❌ **not tested** | Same npm bundle install through DSH's plugin market; the npm publish and the `market-index` branch now exist. |
196
201
 
197
202
  **Method A and Method B are mutually exclusive.** Both create the preset
198
203
  declaration `config.id: cabinet`. Installing both makes the preset id appear
@@ -313,9 +318,9 @@ long-lived npm token — creates the GitHub Release, and then refreshes the
313
318
  `market-index` branch that the plugin market reads.
314
319
 
315
320
  ```sh
316
- # package.json version and the matching CHANGELOG section must both be 0.1.4
317
- git tag v0.1.4
318
- git push origin v0.1.4
321
+ # package.json version and the matching CHANGELOG section must both be 0.1.5
322
+ git tag v0.1.5
323
+ git push origin v0.1.5
319
324
  ```
320
325
 
321
326
  One-time setup on npmjs.com (a maintainer action; it cannot be done from this
@@ -378,10 +383,11 @@ These were **not** tested on this machine and must not be presented as verified:
378
383
  - Whether `config.id` syntax rules reject unusual ids (this id is `cabinet`).
379
384
  - HMR behavior for preset declarations, and private-registry/proxied tarball
380
385
  installs.
381
- - **The npm Trusted Publishing flow and the plugin market.** The release workflow
382
- has not run yet, so no version has been published to npm, the `market-index`
383
- branch does not exist yet, and no real plugin-market install or update has been
384
- performed.
386
+ - **The plugin market in real use.** The npm publish, the GitHub Release, the
387
+ `market-index` branch, parsing the index and installing from the npm spec were
388
+ exercised for 0.1.4 (2026-11-03), but no real install or update has been performed
389
+ in the DSH plugin-market GUI, and 0.1.5 is the first run of the whole
390
+ tag → publish → automatic index refresh chain.
385
391
 
386
392
  ## Known limitations
387
393
 
package/README.zh.md CHANGED
@@ -49,7 +49,7 @@
49
49
  ## 手动安装(3 行)
50
50
 
51
51
  ```sh
52
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.4/dsh-cabinet-mode-0.1.4.tgz
52
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.5/dsh-cabinet-mode-0.1.5.tgz
53
53
  # 完全退出并重启 DeepSeek Harness
54
54
  # 新建任务 -> 模式选择器 -> 内阁模式
55
55
  ```
@@ -70,7 +70,7 @@ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/re
70
70
  > `dsh.profile.bundles` 里保留了 `dsh-cabinet-mode`:
71
71
  >
72
72
  > ```sh
73
- > node "<DeepSeek Harness 安装目录>\resources\runtime\primary-runtime\dependencies\pnpm\bin\pnpm.mjs" --dir "%USERPROFILE%\.dsh\profiles\desktop" add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.4/dsh-cabinet-mode-0.1.4.tgz
73
+ > node "<DeepSeek Harness 安装目录>\resources\runtime\primary-runtime\dependencies\pnpm\bin\pnpm.mjs" --dir "%USERPROFILE%\.dsh\profiles\desktop" add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.5/dsh-cabinet-mode-0.1.5.tgz
74
74
  > ```
75
75
  >
76
76
  > 操作前先备份该 profile 的 `package.json` / `pnpm-lock.yaml`。
@@ -92,16 +92,16 @@ https://raw.githubusercontent.com/luodaoyi/dsh-cabinet-mode/market-index/marketp
92
92
 
93
93
  索引在每次 tag 发布后由 npm registry 重新生成,只列出已发布、未弃用的稳定版本;不要手工编辑 `market-index` 分支。
94
94
 
95
- > **首版发布顺序:** `dsh-cabinet-mode` 0.1.4 是首个计划发布到 npm 的版本。在该次发布成功前,`registry.npmjs.org` 上还没有这个包,索引 URL 会返回 404——这是预期现象,不是安装故障。发布工作流先发布 npm,成功后才刷新索引。
96
-
97
- **未验证:** 你所用 DSH 版本的市场界面文案与点击路径,以及真实的市场安装/更新——写这段时 0.1.4 尚未发布。上面的 `dsh-cabinet-mode@<版本>` 安装 spec 是格式 1 读取器(`@deepseek-ai/dsh-plugin-market-index@0.2.1-rc.5` 的 `marketInstallTarget`)对 npm 源返回的结果;该函数已在本机执行,界面未实测。
95
+ > **发布状态(2026-11-03):** `dsh-cabinet-mode@0.1.4` 已发布到 `registry.npmjs.org`——首版,由 tag 触发的 OIDC 流程发布,provenance 已上 sigstore——并且 `market-index` 分支已由它生成。registry 上另有占位版本 `0.0.0-stage`(预发布,索引不列)。首次 OIDC 发布、GitHub Release、`market-index` 分支、索引解析、按 npm spec 安装这五项已在处置本次发布时实测。
96
+ >
97
+ > **未验证:** 你所用 DSH 版本的插件市场界面文案与点击路径、该 GUI 里的真实安装/更新,以及 tag → 发布 → 自动刷新索引的全链路;0.1.5 是该链路第一次完整运行。上面的 `dsh-cabinet-mode@<版本>` 安装 spec 是格式 1 读取器(`@deepseek-ai/dsh-plugin-market-index@0.2.1-rc.5` 的 `marketInstallTarget`)对 npm 源返回的结果;该函数已在本机执行,界面未实测。
98
98
 
99
99
  ## 升级
100
100
 
101
101
  若通过插件市场安装:刷新市场,先在**已安装**页卸载旧版本,再从**插件市场**安装新版本,然后重启——没有 tgz URL 要换,也没有一键更新。否则用同一条安装命令换新版本 URL(或在插件页选新 `.tgz`),然后完全退出并重启 DeepSeek Harness:
102
102
 
103
103
  ```sh
104
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.4/dsh-cabinet-mode-0.1.4.tgz
104
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.5/dsh-cabinet-mode-0.1.5.tgz
105
105
  ```
106
106
 
107
107
  `dsh plugin --profile desktop list` 应显示新版本。升级已在 Windows 实测:
@@ -141,7 +141,7 @@ v0.1.2 → v0.1.3 走内嵌 pnpm(DSH 0.2.1-rc.5)。
141
141
  |---|---|---|---|---|
142
142
  | **A. DSH 插件管理器**(推荐):插件页「添加插件 → 本地目录/包」,或 `dsh plugin --profile <profile> add <绝对路径 / .tgz / release URL>` | ✅ 2026-10-29 本机实测:本地目录安装与 **GitHub Release 资产 URL 安装**均成功;`dsh plugin --profile desktop list` = 3 packages;合成校验通过 | ⚙️ 代码级推断,**未在本机实测** | ⚙️ 代码级推断,**未在本机实测** | 纯 YAML bundle:无构建、无依赖、无 OS 专用代码。见 [docs/cross-platform.md](docs/cross-platform.md)。 |
143
143
  | **B. 回退 node 脚本**(无插件管理器时):`node scripts/install.mjs --profile <profile>` 演练后 `--apply`,写入 profile 的 `cordis.patch.yml` | ✅ 脚本已在 Windows 实测(演练 + 临时副本) | ⚙️ 代码级推断,**未实测** | ⚙️ 代码级推断,**未实测** | 三平台同一路径:`<DSH_HOME>/profiles/<profile>/cordis.patch.yml`。 |
144
- | **插件市场**(索引源):见 [从插件市场安装](#从插件市场安装索引源) | ❌ **未实测**(写作时 0.1.4 尚未发布) | ❌ **未实测** | ❌ **未实测** | 通过 DSH 插件市场安装同一个 npm bundle;前提是 npm 已发布且 `market-index` 分支已存在。 |
144
+ | **插件市场**(索引源):见 [从插件市场安装](#从插件市场安装索引源) | ❌ **GUI 安装未实测**(npm 与索引已于 2026-11-03 上线) | ❌ **未实测** | ❌ **未实测** | 通过 DSH 插件市场安装同一个 npm bundle;npm 发布与 `market-index` 分支均已存在。 |
145
145
 
146
146
  **方式 A 与方式 B 二选一,不可叠加。** 两种方式都会声明 `config.id: cabinet`;同时装会让 preset id 重复,声明加载失败。切换前先卸载旧方式。插件市场安装的是与方式 A 相同的 bundle,同样受这条互斥约束。
147
147
 
@@ -204,9 +204,9 @@ node scripts/verify.mjs # 仓库校验 + dsh 合成
204
204
  推送版本 tag 会触发 `.github/workflows/release.yml`:校验工作树 → 打包 tarball → 用 **Trusted Publishing(OIDC)** 发布到 npm(不使用长期 npm token)→ 创建 GitHub Release → 刷新插件市场读取的 `market-index` 分支。
205
205
 
206
206
  ```sh
207
- # package.json 版本与 CHANGELOG 对应章节都必须是 0.1.4
208
- git tag v0.1.4
209
- git push origin v0.1.4
207
+ # package.json 版本与 CHANGELOG 对应章节都必须是 0.1.5
208
+ git tag v0.1.5
209
+ git push origin v0.1.5
210
210
  ```
211
211
 
212
212
  npmjs.com 侧的一次性配置(维护者在网页上完成,无法从本仓库完成)。为该包添加 GitHub Actions trusted publisher:
@@ -239,7 +239,7 @@ npmjs.com 侧的一次性配置(维护者在网页上完成,无法从本仓
239
239
  - DSH 升级后已装 bundle 或回退 patch 是否保留。
240
240
  - `config.id` 语法校验规则(本 id 为 `cabinet`,仅小写字母)。
241
241
  - preset 声明的 HMR 热生效、私有源/代理下的 tgz 安装。
242
- - **npm Trusted Publishing 全流程与插件市场。** 发布工作流尚未运行过:还没有任何版本发布到 npm,`market-index` 分支尚不存在,真实的市场安装/更新也未执行。
242
+ - **插件市场的真实使用。** npm 发布、GitHub Release、`market-index` 分支、索引解析、按 npm spec 安装这五项已在 0.1.4(2026-11-03)处置过程中实测;但 DSH 插件市场 GUI 里的真实安装/更新未执行,tag → 发布 → 自动刷新索引的完整链路以 0.1.5 为首次运行。
243
243
 
244
244
  ## 已知限制
245
245
 
@@ -20,7 +20,7 @@
20
20
  | 10 | 安装后生效 | 重启 Host → 新会话可选 | 同 | 同 | `P/dsh-plugin-manager/README.zh.md:14,73`;`P/dsh-plugin-manager/lib/index.js:2381` | Windows 已实测真实 `add`(2026-10-29,本地目录与 Release 资产 URL;`dsh plugin --profile desktop list` = 3 packages、bundles 写入);重启后新会话出现模式未实测,后段代码级 |
21
21
  | 11 | 是否需要 postinstall / build | 否(纯 YAML) | 否 | 否 | `P/dsh-plugin-manager/lib/types/build-approval.js:1,7-10`;README.zh:64 | 代码级 |
22
22
  | 12 | GitHub Release `.tgz` 直接安装 | 实测可用(Release 资产 URL 直装,2026-10-29) | 同 | 同 | `P/dsh-plugin-manager/lib/types/install-spec.js:16-17,62-76`;`pnpm add <tarball url>`(本机 `dsh plugin ... add --help` 实跑输出含 `<tarball url>`) | Windows 实测 + pnpm 帮助实测;Linux/macOS 代码级 |
23
- | 13 | npm 发布与插件市场索引 | `release.yml` 走 OIDC Trusted Publishing(未实跑) | 同 | 同 | `.github/workflows/release.yml`、`scripts/market-index.mjs`;npm 官方文档 Trusted publishing;`@deepseek-ai/dsh-plugin-market-index@0.2.1-rc.5` `lib/index.js:32-36,209-225,280-318` | 代码级 + 本机格式读取器实跑;npm 发布与索引分支均未实跑 |
23
+ | 13 | npm 发布与插件市场索引 | `release.yml` 走 OIDC Trusted Publishing(v0.1.4 已实跑) | 同 | 同 | `.github/workflows/release.yml`、`scripts/market-index.mjs`;npm 官方文档 Trusted publishing;`@deepseek-ai/dsh-plugin-market-index@0.2.1-rc.5` `lib/index.js:32-36,209-225,280-318` | v0.1.4 OIDC 发布、GitHub Release 与 `market-index` 分支已实跑;首个索引 job 因传播延迟失败,0.1.5 验证自动刷新链路 |
24
24
 
25
25
  > 附加(不属于平台列):本包不声明 DSH 版本门禁(`package.json` 无 `engines.dsh`/DSH `peerDependencies`,`scripts/verify.mjs` 版本检查仅信息性 WARN);本文所有结论以 DSH 0.2.1-rc.3 实测为参照,其他 DSH 版本若内置插件集合不同,需按该版本 `presets/standard.patch.yml` 调整插件行——**未做多版本实测**。
26
26
 
@@ -118,8 +118,9 @@ async function runDesktopCli(runtimeDir, supportDir) {
118
118
  dsh plugin --profile web add https://github.com/<owner>/<repo>/releases/download/v<ver>/dsh-cabinet-mode-<ver>.tgz
119
119
  ```
120
120
  (Linux/macOS 未实测;私仓/代理/认证未验证。)本地文件须用**绝对路径**(`install-spec.js:63-65` 明确拒绝相对路径)。
121
- - **npm 发布(0.1.4 起的发布通道,未实跑)**:
121
+ - **npm 发布(0.1.4 起已实跑,0.1.5 起加固发布链路)**:
122
122
  - **通道**:推送 `v*` tag → `.github/workflows/release.yml` 校验并打包 → `npm publish --access public`(npm Trusted Publishing / OIDC,`id-token: write`,不使用 `NPM_TOKEN` 或任何长期 token)→ 创建 GitHub Release → `market-index` job 重新生成索引并强制推送孤儿分支 `market-index`(`marketplace.json` + `icon.svg` + README)。索引不放在 `main`;**`main` 目前未启用分支保护规则**(2026-11-03 实测:`gh api repos/luodaoyi/dsh-cabinet-mode/rulesets` 返回空数组,`branches/main/protection` 返回 404「Branch not protected」),CI 只在 push/PR 时校验。
123
+ - **首次实跑结果(2026-11-03)**:tag `v0.1.4` 触发 OIDC 发布成功(npm 上 `0.1.4`,`_npmUser=GitHub Actions`、trustedPublisher 为 `github`,provenance 在 sigstore),GitHub Release 与 `market-index` 分支已生成;但紧随的 market-index job 因 registry 传播延迟(packument 只返回 `0.0.0-stage`)连续失败两次。0.1.5 起:抓取加 `cache-control`/`pragma: no-cache` 与 packument `?t=` cache-buster;索引 job 用 `MARKET_EXPECT_VERSION` 轮询等待目标版本出现(默认 15 s 间隔、10 min 超时);写盘前比对已发布索引并拒绝变小(`MARKET_ALLOW_SHRINK=1` 放行,手动 `Market index` 工作流暴露 `allow_shrink` 输入);预发布 tag 不触发索引 job。
123
124
  - **npm 侧外部前置**(维护者在 npmjs.com 完成):trusted publisher 指向 GitHub 仓库 `luodaoyi/dsh-cabinet-mode`、workflow 文件名 `release.yml`(含扩展名,文件必须在 `.github/workflows/` 内且发布步骤留在该文件);新建配置须在 **2 天内**完成首次成功发布,否则失效需删除重建;2026-09-03 后创建的配置默认只允许 `npm stage publish`,**必须显式勾选 `npm publish`**。来源:npm 官方文档 Trusted publishing(https://docs.npmjs.com/trusted-publishers)。
124
125
  - **工具版本**:Trusted Publishing 要求 npm CLI ≥ 11.5.1、Node ≥ 22.14.0;工作流用 setup-node 的 Node 24(满足)。`npm whoami` 不能用于验证 trusted publishing 权限(npm 文档明确说明)。
125
126
  - **索引格式(format 1)**:由 `scripts/market-index.mjs` 从 npm registry 生成,规则以 `@deepseek-ai/dsh-plugin-market-index@0.2.1-rc.5` 为准——`format: 1`、`title.en` 必填、`publishTimestamp` 为整数秒、精确 SemVer 且同插件内唯一;**读取器自己会按 SemVer 归一排序**(`lib/index.js:248` 用 `semver.rcompare`),降序只是本仓库生成器的自检策略(`scripts/market-index.mjs:219-224`),不是读取器强制;跳过 prerelease 与 deprecated 同样是生成器策略,读取器不拒绝它们;`engines.dsh` **可选**(本包不声明,条目省略);`icon` 支持 https URL 或相对索引 URL 的引用,**32 KiB 上限只约束 `data:` 内联图标**(边界实测:32 KiB 放行、33 KiB 抛 `must not exceed 32 KiB of decoded bytes`),`./icon.svg` 这类相对路径按索引 URL(https)解析,不受该上限约束。读取器 `marketInstallTarget()` 对 npm 源返回 `dsh-cabinet-mode@<version>` + `registry: https://registry.npmjs.org`(本机实跑读取器核对)。
@@ -127,7 +128,7 @@ async function runDesktopCli(runtimeDir, supportDir) {
127
128
  - bundle 身份:`dsh.bundle.patch` 指向 `cordis.patch.yml`(字符串或有序数组)。这是插件管理器识别「组合包层」的充要字段(`P/dsh-plugin-manager/lib/index.js:313,335-337`);缺它只会被当作普通依赖安装。
128
129
  - `files` 必须包含 `cordis.patch.yml`(npm 打包白名单)。
129
130
  - 兼容性:若要声明版本门,优先只写 `engines.dsh`(单一声明即决定,`P/dsh-app-boot/lib/index.js:280-284`);**不要**逐个声明 `@deepseek-ai/dsh-*` 的 `peerDependencies` 精确版本——否则会被逐包校验(`:286-304`),跨平台/跨补丁版本容易误判(本机已见 rc.2 插件在 rc.3 被警告的先例)。**本仓库的既定产品决定是不声明 `engines.dsh`(0.1.1 起),索引条目因此不写 `engines`**;这不影响 format 1 合法性。
130
- - **现状对照(本仓库 `package.json`)**:`name`/`version`(0.1.4)/`private: false`/`files` 含 `cordis.patch.yml`/`dsh.bundle.patch`/`repository`(`git+https://github.com/luodaoyi/dsh-cabinet-mode.git`,无 query/fragment,匹配 trusted publisher 的仓库)均在;未声明 `peerDependencies` 与 `engines.dsh`,因此 DSH 兼容性判定不触发(`P/dsh-app-boot/lib/index.js:280-304`);未声明 `os`/`cpu`。发布链路已写入 `.github/workflows/release.yml`(**未实跑**)。
131
+ - **现状对照(本仓库 `package.json`)**:`name`/`version`(0.1.5)/`private: false`/`files` 含 `cordis.patch.yml`/`dsh.bundle.patch`/`repository`(`git+https://github.com/luodaoyi/dsh-cabinet-mode.git`,无 query/fragment,匹配 trusted publisher 的仓库)均在;未声明 `peerDependencies` 与 `engines.dsh`,因此 DSH 兼容性判定不触发(`P/dsh-app-boot/lib/index.js:280-304`);未声明 `os`/`cpu`。发布链路已由 `v0.1.4` 实跑成功(首个 market-index job 的传播延迟失败已在 0.1.5 修复)。
131
132
  - 不要声明 `os`/`cpu` 限制字段;纯 YAML 无平台二进制。
132
133
  - 可选元数据:`description`、`icon`(相对路径,须位于包内,`P/dsh-app-boot/lib/index.js:2074-2097`)、`locale/*.json`(`P/dsh-app-boot/lib/index.js:574` 附近)。
133
134
  - **桌面端**:`dsh plugin --profile desktop add` 在 Desktop 载体下可用(Windows 实测 `list`、`add --help` exit 0;`P/dsh-desktop-host/lib/cli.js:97` 的 `manageDesktopProfile: true` 是放行来源)。Windows 已实测本地目录与 Release 资产 URL 两种真实安装(2026-10-29,`dsh plugin --profile desktop list` = 3 packages);重启后新会话出现内阁模式仍未实测。
@@ -151,7 +152,7 @@ async function runDesktopCli(runtimeDir, supportDir) {
151
152
  4. ~~GitHub Release `.tgz` URL 的真实安装~~ → **Windows 已实测**(Release 资产 URL 直装成功,2026-10-29);Linux/macOS 未实测。
152
153
  5. ~~真实 `dsh plugin --profile desktop add <bundle>` 安装~~ → **Windows 已实测**(本地目录与 Release URL 两种方式,`list` = 3 packages、bundles 写入,2026-10-29);重启后新会话出现内阁模式仍未实测。
153
154
  6. Linux / macOS 上对 `<本仓库 cordis.patch.yml>` 执行 `dsh --profile web --patch ... --dump-config` 的组合校验(Windows 已实跑 exit 0)。
154
- 7. npm Trusted Publishing 首次发布、`market-index` 分支发布、以及插件市场里的真实安装/更新:均未实跑(0.1.4 尚未发布,索引分支不存在)。`dsh-cabinet-mode@<version>` 安装 spec 仅由本机执行格式读取器核对。
155
+ 7. ~~npm Trusted Publishing 首次发布、`market-index` 分支发布~~ → **2026-11-03 已实跑**(v0.1.4 OIDC 发布成功、GitHub Release 与 `market-index` 分支已生成;首个索引 job 因传播延迟失败,0.1.5 修复)。仍未实跑:DSH 插件市场 GUI 里的真实安装/更新,以及 tag → npm 发布 → 自动刷新索引的全链路(0.1.5 首发验证)。`dsh-cabinet-mode@<version>` 安装 spec 仅由本机执行格式读取器核对。
155
156
  8. HMR 开启时 preset 声明的热生效(仅代码级阅读 README 与注册表语义,未实跑)。
156
157
  9. 私有仓库/代理/认证下的 tgz 安装。
157
158
 
@@ -184,7 +185,7 @@ async function runDesktopCli(runtimeDir, supportDir) {
184
185
  | `docs/research/market-index-research.md:15,223,229-235,249` | 市场更新链路:无原地升级、`semver.gt`、无定时检查、10 分钟缓存 |
185
186
  | `docs/research/market-index-research.md:255-289` | `engines.dsh` 运行时判定、三处硬拦、`includePrerelease`、`~0.2.1` 陷阱 |
186
187
  | `docs/research/market-index-research.md:94-116` | icon 32 KiB 仅限 `data:`;包内 `icon` 256 KiB、必须相对路径 |
187
- | `.github/workflows/release.yml`、`scripts/market-index.mjs`、`scripts/publish-market-index.sh` | OIDC 发布、索引生成与索引分支发布(未实跑) |
188
+ | `.github/workflows/release.yml`、`scripts/market-index.mjs`、`scripts/publish-market-index.sh` | OIDC 发布、索引生成与索引分支发布(v0.1.4 已实跑;自动刷新链路 0.1.5 验证) |
188
189
  | 实跑:`> node scripts/market-index.mjs`(`MARKET_REGISTRY_MANIFEST` 指向 fixture 文件)→ 生成 `marketplace.json`;`> node scripts/market-index.mjs --check`(`MARKET_INDEX_URL` 指向本地索引文件)→ 一致 exit 0,篡改后 exit 1 | Windows 本机实测:离线生成与 `--check`(无网络、无依赖) |
189
190
 
190
191
  > README 引用锚点:`docs/cross-platform.md#结论矩阵`、`docs/cross-platform.md#未在本机实测清单`、`docs/cross-platform.md#依据索引`。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cabinet-mode",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Cabinet Mode (内阁模式) for DeepSeek Harness: a declarative DSH bundle that adds a dual-identity Lead/teammate agent preset for the Great Ming Research Bureau cabinet team.",
5
5
  "license": "MIT",
6
6
  "icon": "./icon.svg",
@@ -28,8 +28,15 @@
28
28
  //
29
29
  // Ordering: the npm package must exist before an index can list it. The release
30
30
  // workflow publishes `dsh-cabinet-mode` to npm first and regenerates the index
31
- // only afterwards, so running this script before the first publish fails with
32
- // the registry's 404 — that is expected.
31
+ // only afterwards. npm may keep serving an older packument (for example a
32
+ // placeholder version only) for a few minutes after the publish, so the release
33
+ // job sets MARKET_EXPECT_VERSION and this script polls the registry until the
34
+ // pushed version is listed.
35
+ //
36
+ // Registry fetches send `cache-control: no-cache` / `pragma: no-cache` and carry a
37
+ // one-shot `?t=` cache-buster. Before writing, the script compares the generated
38
+ // version set with the currently published index and refuses to replace a larger
39
+ // index with a smaller one unless MARKET_ALLOW_SHRINK=1 is set.
33
40
  //
34
41
  // Usage:
35
42
  // node scripts/market-index.mjs # write marketplace.json
@@ -40,9 +47,15 @@
40
47
  // MARKET_REGISTRY_MANIFEST a registry metadata JSON file; when set, read this file
41
48
  // instead of fetching the registry
42
49
  // MARKET_INDEX_URL published index URL, or a local path / file: URL; used by
43
- // --check and to document where the index is served
44
- // (default the raw.githubusercontent URL above)
50
+ // --check, by the rollback guard, and to document where
51
+ // the index is served (default the raw.githubusercontent URL above)
45
52
  // MARKET_INDEX_OUT generated file (default marketplace.json)
53
+ // MARKET_EXPECT_VERSION wait until this exact version is listed (the release
54
+ // job passes the pushed tag's version)
55
+ // MARKET_EXPECT_INTERVAL_MS poll interval while waiting (default 15000)
56
+ // MARKET_EXPECT_TIMEOUT_MS maximum wait while waiting (default 600000)
57
+ // MARKET_ALLOW_SHRINK set to 1 to allow the generated index to drop versions
58
+ // the published index still lists (default: refuse)
46
59
 
47
60
  import assert from 'node:assert/strict';
48
61
  import { readFileSync, writeFileSync } from 'node:fs';
@@ -59,6 +72,19 @@ const registryBase = (process.env.MARKET_REGISTRY_BASE ?? REGISTRY).replace(/\/+
59
72
  const manifestLocation = process.env.MARKET_REGISTRY_MANIFEST;
60
73
  const indexUrl = process.env.MARKET_INDEX_URL ?? PUBLISHED_URL;
61
74
  const outputPath = process.env.MARKET_INDEX_OUT ?? 'marketplace.json';
75
+ const expectVersion = (process.env.MARKET_EXPECT_VERSION ?? '').trim();
76
+ const allowShrink = process.env.MARKET_ALLOW_SHRINK === '1';
77
+
78
+ function positiveIntegerEnv(name, fallback) {
79
+ const raw = process.env[name];
80
+ if (raw === undefined || raw.trim() === '') return fallback;
81
+ const value = Number(raw);
82
+ assert.ok(Number.isInteger(value) && value > 0, `${name} must be a positive integer: ${raw}`);
83
+ return value;
84
+ }
85
+
86
+ const expectIntervalMs = positiveIntegerEnv('MARKET_EXPECT_INTERVAL_MS', 15000);
87
+ const expectTimeoutMs = positiveIntegerEnv('MARKET_EXPECT_TIMEOUT_MS', 600000);
62
88
 
63
89
  function isHttpUrl(value) {
64
90
  try {
@@ -78,6 +104,26 @@ function readLocation(location) {
78
104
  }
79
105
  }
80
106
 
107
+ async function readPublishedIndexForGuard() {
108
+ try {
109
+ const text = isHttpUrl(indexUrl) ? await fetchText(indexUrl) : readLocation(indexUrl);
110
+ return JSON.parse(text);
111
+ } catch (error) {
112
+ // First release (no branch yet), an unpublished URL, or a network failure:
113
+ // the guard is best-effort and must not block the very first index publish.
114
+ console.log(`rollback guard skipped: cannot read the published index at ${indexUrl} (${error.message})`);
115
+ return null;
116
+ }
117
+ }
118
+
119
+ function publishedVersions(indexDocument) {
120
+ const plugin = indexDocument?.plugins?.find((entry) => entry?.name === MANIFEST.name);
121
+ if (plugin === undefined || !Array.isArray(plugin.versions)) return [];
122
+ return plugin.versions
123
+ .map((entry) => entry?.version)
124
+ .filter((version) => typeof version === 'string');
125
+ }
126
+
81
127
  assert.ok(isHttpUrl(registryBase), `MARKET_REGISTRY_BASE must be an absolute http(s) URL: ${registryBase}`);
82
128
  assert.ok(
83
129
  isHttpUrl(indexUrl) || indexUrl.startsWith('file:') || !indexUrl.includes('://'),
@@ -94,21 +140,28 @@ function compareSemver(left, right) {
94
140
  }
95
141
 
96
142
  async function fetchText(url, accept) {
143
+ const headers = { 'cache-control': 'no-cache', pragma: 'no-cache' };
144
+ if (accept) headers.accept = accept;
97
145
  const response = await fetch(url, {
98
- headers: accept ? { accept } : {},
146
+ headers,
99
147
  signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
100
148
  });
101
149
  if (!response.ok) throw new Error(`${url} answered ${response.status}`);
102
150
  return response.text();
103
151
  }
104
152
 
105
- let registryManifest;
106
- if (manifestLocation !== undefined && manifestLocation !== '') {
107
- registryManifest = JSON.parse(readLocation(manifestLocation));
108
- } else {
109
- const registryPath = `${registryBase}/${encodeURIComponent(MANIFEST.name).replace(/^%40/, '@')}`;
153
+ function registryPackumentUrl() {
154
+ // The registry ignores unknown query parameters; the one-shot value defeats a
155
+ // stale CDN or proxy entry for a packument that just changed.
156
+ return `${registryBase}/${encodeURIComponent(MANIFEST.name).replace(/^%40/, '@')}?t=${Date.now()}`;
157
+ }
158
+
159
+ async function loadRegistryManifest() {
160
+ if (manifestLocation !== undefined && manifestLocation !== '') {
161
+ return JSON.parse(readLocation(manifestLocation));
162
+ }
110
163
  try {
111
- registryManifest = JSON.parse(await fetchText(registryPath, 'application/json'));
164
+ return JSON.parse(await fetchText(registryPackumentUrl(), 'application/json'));
112
165
  } catch (error) {
113
166
  throw new Error(
114
167
  `${error.message}\n` +
@@ -118,6 +171,33 @@ if (manifestLocation !== undefined && manifestLocation !== '') {
118
171
  }
119
172
  }
120
173
 
174
+ const waitStartedAt = Date.now();
175
+ let registryManifest = await loadRegistryManifest();
176
+ if (expectVersion !== '') {
177
+ // The generator indexes `time` entries, so wait for both halves of the record:
178
+ // a packument can briefly list the version before its publish time lands.
179
+ const hasVersion = (manifest) =>
180
+ Boolean(manifest.versions?.[expectVersion]) && typeof manifest.time?.[expectVersion] === 'string';
181
+ while (!hasVersion(registryManifest)) {
182
+ const elapsed = Date.now() - waitStartedAt;
183
+ const seen = Object.keys(registryManifest.versions ?? {}).join(', ') || '(none)';
184
+ const remaining = expectTimeoutMs - elapsed;
185
+ if (remaining <= 0) {
186
+ throw new Error(
187
+ `registry did not list ${MANIFEST.name}@${expectVersion} after waiting ${elapsed} ms ` +
188
+ `(timeout ${expectTimeoutMs} ms); last seen versions: ${seen}`,
189
+ );
190
+ }
191
+ console.log(
192
+ `waiting for ${MANIFEST.name}@${expectVersion} in the registry ` +
193
+ `(${elapsed} ms elapsed; last seen: ${seen})`,
194
+ );
195
+ await new Promise((resolve) => setTimeout(resolve, Math.min(expectIntervalMs, remaining)));
196
+ registryManifest = await loadRegistryManifest();
197
+ }
198
+ console.log(`registry lists ${MANIFEST.name}@${expectVersion} after ${Date.now() - waitStartedAt} ms`);
199
+ }
200
+
121
201
  const published = Object.entries(registryManifest.time ?? {})
122
202
  .filter(([version]) => version !== 'created' && version !== 'modified')
123
203
  .map(([version, time]) => ({ version, time }));
@@ -234,6 +314,21 @@ if (process.argv.includes('--check')) {
234
314
  assert.equal(remote, body, `the published index at ${indexUrl} is stale; refresh the market-index branch`);
235
315
  console.log(`published index matches the registry: ${summary}`);
236
316
  } else {
317
+ // Rollback guard: the registry can lag behind the already-published index (CDN or
318
+ // propagation), and writing that smaller index would make DSH forget released
319
+ // versions and offer a downgrade. Refuse unless explicitly allowed.
320
+ const publishedIndex = await readPublishedIndexForGuard();
321
+ if (publishedIndex !== null) {
322
+ const generated = new Set(versions.map((entry) => entry.version));
323
+ const missing = publishedVersions(publishedIndex).filter((version) => !generated.has(version));
324
+ if (missing.length > 0) {
325
+ const message =
326
+ `registry is behind the published index at ${indexUrl}: ${missing.join(', ')} ` +
327
+ 'would disappear from the generated index; refusing to overwrite the index with a smaller one';
328
+ if (!allowShrink) throw new Error(`${message} (set MARKET_ALLOW_SHRINK=1 to override)`);
329
+ console.log(`warning: ${message} (MARKET_ALLOW_SHRINK=1)`);
330
+ }
331
+ }
237
332
  writeFileSync(outputPath, body);
238
333
  console.log(`Wrote ${outputPath}: ${summary}`);
239
334
  console.log(`Publish URL: ${PUBLISHED_URL} (the release workflow force-pushes this file to the market-index branch)`);