dsh-cabinet-mode 0.1.4 → 0.1.6

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,61 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.1.6] - 2026-11-03
6
+
7
+ ### Fixed
8
+
9
+ - **The rollback guard reads a fresh baseline.** It now requests the published
10
+ index with a one-shot `?t=` cache-buster; without it, a five-minute-stale
11
+ `raw.githubusercontent.com` copy could let a lagging registry shrink the index.
12
+ (Dalisi verification §13, D-12.)
13
+ - **A missing published index is no longer confused with an unreadable one.** Only a
14
+ `404`/`ENOENT` is treated as "first release, nothing to protect"; any other read
15
+ or parse failure aborts the refresh instead of silently skipping the guard, unless
16
+ `MARKET_ALLOW_SHRINK=1` is set. (Dalisi verification §13, D-13.)
17
+ - `--check` reads the published index through the same cache-buster, so a stale CDN
18
+ copy can no longer fake a match or a mismatch.
19
+
20
+ These fixes ship in `0.1.6`; `0.1.5`'s tarball still contains the earlier script.
21
+ They only affect the maintainer-side index refresh, not installing the bundle.
22
+
23
+ ## [0.1.5] - 2026-11-03
24
+
25
+ ### Fixed
26
+
27
+ - **The market-index refresh no longer races npm propagation.** The index job now
28
+ waits for the just-published version to appear in the registry packument
29
+ (`MARKET_EXPECT_VERSION`, polled every 15 s for up to 10 min) instead of
30
+ regenerating from a stale, partially propagated packument.
31
+ - **Registry reads bypass stale caches.** Every fetch sends
32
+ `cache-control: no-cache` and `pragma: no-cache`, and the packument URL carries a
33
+ one-shot `?t=` cache-buster.
34
+ - **The index can no longer shrink silently.** Before writing, the generator
35
+ compares its version set with the currently published index and refuses to
36
+ replace a larger index with a smaller one (for example while the registry lags),
37
+ unless `MARKET_ALLOW_SHRINK=1` is set. The manual `Market index` workflow exposes
38
+ this as the `allow_shrink` dispatch input for a legitimate shrink after
39
+ `npm deprecate` or unpublish.
40
+ - **Prerelease tags no longer refresh the index.** The release workflow skips the
41
+ market-index job for tags containing `-`: the index rules exclude prereleases, so
42
+ a refresh would only fail with a false "no installable versions" error, and a
43
+ prerelease must not touch the stable index.
44
+ - Removed the ineffective `package-manager-cache: false` input from
45
+ `actions/setup-node` in the release workflow.
46
+
47
+ ### Context
48
+
49
+ - `dsh-cabinet-mode@0.1.4` was published to npm on 2026-11-03 by the
50
+ tag-triggered Trusted Publishing (OIDC) flow, with a provenance attestation on
51
+ sigstore, and its GitHub Release was created. The market-index job that follows
52
+ the publish failed twice because the registry still served a packument containing
53
+ only the `0.0.0-stage` placeholder; this release fixes that chain and is the
54
+ first end-to-end run of tag → npm publish → automatic index refresh.
55
+ - The first OIDC publish, the GitHub Release, the generated `market-index` branch,
56
+ parsing the index, and installing from the npm spec were exercised while
57
+ handling 0.1.4; a real install/update in the DSH plugin market GUI remains
58
+ unverified.
59
+
5
60
  ## [0.1.4] - 2026-11-03
6
61
 
7
62
  ### 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.6/dsh-cabinet-mode-0.1.6.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.6/dsh-cabinet-mode-0.1.6.tgz
89
89
  > ```
90
90
  >
91
91
  > Back up the profile's `package.json` / `pnpm-lock.yaml` first.
@@ -125,16 +125,19 @@ 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` and `0.1.5` are published
129
+ > on `registry.npmjs.org` by the tag-triggered OIDC workflow, each with a provenance
130
+ > attestation on sigstore, and the `market-index` branch is refreshed automatically
131
+ > after every publish. The v0.1.5 run of tag → publish → GitHub Release → index
132
+ > refresh succeeded end to end (GitHub Actions run 41657224370), and the index now
133
+ > lists 0.1.5 and 0.1.4. The registry also carries a placeholder `0.0.0-stage`
134
+ > prerelease, which the index intentionally does not list.
135
+ >
136
+ > **Not verified:** the exact plugin-market UI labels and click path in your DSH
137
+ > build, and a real install/update in that GUI. The
138
+ > `dsh-cabinet-mode@<version>` install spec is what the format-1 reader
139
+ > (`@deepseek-ai/dsh-plugin-market-index@0.2.1-rc.5`, `marketInstallTarget`) returns
140
+ > for an npm source; that function was executed locally, the UI was not.
138
141
 
139
142
  ## Upgrade
140
143
 
@@ -145,7 +148,7 @@ the same install command with the new version URL (or pick the new `.tgz` in the
145
148
  plugin page), then fully quit and restart DeepSeek Harness:
146
149
 
147
150
  ```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
151
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.1.6/dsh-cabinet-mode-0.1.6.tgz
149
152
  ```
150
153
 
151
154
  `dsh plugin --profile desktop list` should report the new version. Upgrades were
@@ -192,7 +195,7 @@ on DSH 0.2.1-rc.5.
192
195
  |---|---|---|---|---|
193
196
  | **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
197
  | **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. |
198
+ | **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
199
 
197
200
  **Method A and Method B are mutually exclusive.** Both create the preset
198
201
  declaration `config.id: cabinet`. Installing both makes the preset id appear
@@ -313,9 +316,9 @@ long-lived npm token — creates the GitHub Release, and then refreshes the
313
316
  `market-index` branch that the plugin market reads.
314
317
 
315
318
  ```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
319
+ # package.json version and the matching CHANGELOG section must both be 0.1.6
320
+ git tag v0.1.6
321
+ git push origin v0.1.6
319
322
  ```
320
323
 
321
324
  One-time setup on npmjs.com (a maintainer action; it cannot be done from this
@@ -378,10 +381,11 @@ These were **not** tested on this machine and must not be presented as verified:
378
381
  - Whether `config.id` syntax rules reject unusual ids (this id is `cabinet`).
379
382
  - HMR behavior for preset declarations, and private-registry/proxied tarball
380
383
  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.
384
+ - **The plugin market in real use.** Parsing the published index, resolving the npm
385
+ install spec and installing `dsh-cabinet-mode@0.1.5` into a throwaway profile were
386
+ exercised locally, and the full tag → publish → automatic index refresh chain runs
387
+ in CI (v0.1.5, run 41657224370), but no install or update has been performed in
388
+ the DSH plugin-market GUI itself.
385
389
 
386
390
  ## Known limitations
387
391
 
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.6/dsh-cabinet-mode-0.1.6.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.6/dsh-cabinet-mode-0.1.6.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` 与 `0.1.5` 已由 tag 触发的 OIDC 流程发布到 `registry.npmjs.org`,两者都带 sigstore provenance;`market-index` 分支在每次发布后自动刷新。v0.1.5 的 tag → 发布 → GitHub Release → 刷新索引全链路已端到端成功(GitHub Actions run 41657224370),索引现列出 0.1.5 与 0.1.4。registry 上另有占位版本 `0.0.0-stage`(预发布,索引不列)。
96
+ >
97
+ > **未验证:** 你所用 DSH 版本的插件市场界面文案与点击路径,以及该 GUI 里的真实安装/更新。上面的 `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.6/dsh-cabinet-mode-0.1.6.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.6
208
+ git tag v0.1.6
209
+ git push origin v0.1.6
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 安装 spec 解析、把 `dsh-cabinet-mode@0.1.5` 装进一次性 profile 都已在本机执行;tag → 发布 → 自动刷新索引全链路已在 CI 跑通(v0.1.5,run 41657224370);但 DSH 插件市场 GUI 里的真实安装/更新仍未执行。
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/v0.1.5 已实跑) | 同 | 同 | `.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` 分支已实跑;v0.1.5 的全链路(tag → 发布 → 自动刷新索引)已成功(run 41657224370) |
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.6)/`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` 分支发布、tag → npm 发布 → 自动刷新索引全链路~~ → **2026-11-03 已实跑**(v0.1.4 OIDC 发布成功;v0.1.5 全链路成功,run 41657224370,索引 job 等到 registry 出现目标版本后强推分支)。仍未实跑:DSH 插件市场 GUI 里的真实安装/更新。`dsh-cabinet-mode@<version>` 安装 spec 由本机执行格式读取器核对,并按该 spec 把 0.1.5 装进一次性 profile 验证过。
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.6",
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 {
@@ -74,10 +100,46 @@ function readLocation(location) {
74
100
  try {
75
101
  return readFileSync(path, 'utf8');
76
102
  } catch (error) {
77
- throw new Error(`cannot read ${path}: ${error.code ?? error.message}`);
103
+ // Keep the code: the rollback guard distinguishes "no baseline yet" (ENOENT)
104
+ // from "the baseline exists but cannot be read".
105
+ const wrapped = new Error(`cannot read ${path}: ${error.code ?? error.message}`);
106
+ wrapped.code = error.code;
107
+ throw wrapped;
108
+ }
109
+ }
110
+
111
+ async function readPublishedIndexForGuard() {
112
+ try {
113
+ // Cache-buster: raw.githubusercontent serves the branch copy with a 5-minute
114
+ // max-age, and a stale baseline would let a lagging registry shrink the index.
115
+ const location = isHttpUrl(indexUrl) ? withCacheBuster(indexUrl) : indexUrl;
116
+ const text = isHttpUrl(location) ? await fetchText(location) : readLocation(location);
117
+ return JSON.parse(text);
118
+ } catch (error) {
119
+ if (error?.status === 404 || error?.code === 'ENOENT') {
120
+ // First release (no branch yet): there is nothing to protect.
121
+ console.log(`rollback guard skipped: the published index does not exist yet (${error.message})`);
122
+ return null;
123
+ }
124
+ // Anything else (network failure, unreadable baseline, unparsable JSON) is a
125
+ // real problem: publishing now could replace a newer index with a smaller one.
126
+ const message =
127
+ `cannot read the published index at ${indexUrl} (${error.message}); refusing to publish ` +
128
+ 'without the rollback check';
129
+ if (!allowShrink) throw new Error(`${message} (set MARKET_ALLOW_SHRINK=1 to override)`);
130
+ console.log(`warning: ${message} (MARKET_ALLOW_SHRINK=1)`);
131
+ return null;
78
132
  }
79
133
  }
80
134
 
135
+ function publishedVersions(indexDocument) {
136
+ const plugin = indexDocument?.plugins?.find((entry) => entry?.name === MANIFEST.name);
137
+ if (plugin === undefined || !Array.isArray(plugin.versions)) return [];
138
+ return plugin.versions
139
+ .map((entry) => entry?.version)
140
+ .filter((version) => typeof version === 'string');
141
+ }
142
+
81
143
  assert.ok(isHttpUrl(registryBase), `MARKET_REGISTRY_BASE must be an absolute http(s) URL: ${registryBase}`);
82
144
  assert.ok(
83
145
  isHttpUrl(indexUrl) || indexUrl.startsWith('file:') || !indexUrl.includes('://'),
@@ -94,21 +156,39 @@ function compareSemver(left, right) {
94
156
  }
95
157
 
96
158
  async function fetchText(url, accept) {
159
+ const headers = { 'cache-control': 'no-cache', pragma: 'no-cache' };
160
+ if (accept) headers.accept = accept;
97
161
  const response = await fetch(url, {
98
- headers: accept ? { accept } : {},
162
+ headers,
99
163
  signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
100
164
  });
101
- if (!response.ok) throw new Error(`${url} answered ${response.status}`);
165
+ if (!response.ok) {
166
+ const error = new Error(`${url} answered ${response.status}`);
167
+ error.status = response.status;
168
+ throw error;
169
+ }
102
170
  return response.text();
103
171
  }
104
172
 
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/, '@')}`;
173
+ function withCacheBuster(url) {
174
+ // Any origin in this script (registry, raw.githubusercontent) serves a cached copy
175
+ // for minutes; an unknown query parameter gives the request its own cache key.
176
+ const separator = url.includes('?') ? '&' : '?';
177
+ return `${url}${separator}t=${Date.now()}`;
178
+ }
179
+
180
+ function registryPackumentUrl() {
181
+ // The registry ignores unknown query parameters; the one-shot value defeats a
182
+ // stale CDN or proxy entry for a packument that just changed.
183
+ return `${registryBase}/${encodeURIComponent(MANIFEST.name).replace(/^%40/, '@')}?t=${Date.now()}`;
184
+ }
185
+
186
+ async function loadRegistryManifest() {
187
+ if (manifestLocation !== undefined && manifestLocation !== '') {
188
+ return JSON.parse(readLocation(manifestLocation));
189
+ }
110
190
  try {
111
- registryManifest = JSON.parse(await fetchText(registryPath, 'application/json'));
191
+ return JSON.parse(await fetchText(registryPackumentUrl(), 'application/json'));
112
192
  } catch (error) {
113
193
  throw new Error(
114
194
  `${error.message}\n` +
@@ -118,6 +198,33 @@ if (manifestLocation !== undefined && manifestLocation !== '') {
118
198
  }
119
199
  }
120
200
 
201
+ const waitStartedAt = Date.now();
202
+ let registryManifest = await loadRegistryManifest();
203
+ if (expectVersion !== '') {
204
+ // The generator indexes `time` entries, so wait for both halves of the record:
205
+ // a packument can briefly list the version before its publish time lands.
206
+ const hasVersion = (manifest) =>
207
+ Boolean(manifest.versions?.[expectVersion]) && typeof manifest.time?.[expectVersion] === 'string';
208
+ while (!hasVersion(registryManifest)) {
209
+ const elapsed = Date.now() - waitStartedAt;
210
+ const seen = Object.keys(registryManifest.versions ?? {}).join(', ') || '(none)';
211
+ const remaining = expectTimeoutMs - elapsed;
212
+ if (remaining <= 0) {
213
+ throw new Error(
214
+ `registry did not list ${MANIFEST.name}@${expectVersion} after waiting ${elapsed} ms ` +
215
+ `(timeout ${expectTimeoutMs} ms); last seen versions: ${seen}`,
216
+ );
217
+ }
218
+ console.log(
219
+ `waiting for ${MANIFEST.name}@${expectVersion} in the registry ` +
220
+ `(${elapsed} ms elapsed; last seen: ${seen})`,
221
+ );
222
+ await new Promise((resolve) => setTimeout(resolve, Math.min(expectIntervalMs, remaining)));
223
+ registryManifest = await loadRegistryManifest();
224
+ }
225
+ console.log(`registry lists ${MANIFEST.name}@${expectVersion} after ${Date.now() - waitStartedAt} ms`);
226
+ }
227
+
121
228
  const published = Object.entries(registryManifest.time ?? {})
122
229
  .filter(([version]) => version !== 'created' && version !== 'modified')
123
230
  .map(([version, time]) => ({ version, time }));
@@ -230,10 +337,25 @@ const summary = `${versions.length} version(s)${skipped.length ? `; skipped: ${s
230
337
  if (process.argv.includes('--check')) {
231
338
  // Compare with the published copy so a stale index is visible: the registry moved
232
339
  // ahead of the branch, or the market-index job never ran after a release.
233
- const remote = isHttpUrl(indexUrl) ? await fetchText(indexUrl) : readLocation(indexUrl);
340
+ const remote = isHttpUrl(indexUrl) ? await fetchText(withCacheBuster(indexUrl)) : readLocation(indexUrl);
234
341
  assert.equal(remote, body, `the published index at ${indexUrl} is stale; refresh the market-index branch`);
235
342
  console.log(`published index matches the registry: ${summary}`);
236
343
  } else {
344
+ // Rollback guard: the registry can lag behind the already-published index (CDN or
345
+ // propagation), and writing that smaller index would make DSH forget released
346
+ // versions and offer a downgrade. Refuse unless explicitly allowed.
347
+ const publishedIndex = await readPublishedIndexForGuard();
348
+ if (publishedIndex !== null) {
349
+ const generated = new Set(versions.map((entry) => entry.version));
350
+ const missing = publishedVersions(publishedIndex).filter((version) => !generated.has(version));
351
+ if (missing.length > 0) {
352
+ const message =
353
+ `registry is behind the published index at ${indexUrl}: ${missing.join(', ')} ` +
354
+ 'would disappear from the generated index; refusing to overwrite the index with a smaller one';
355
+ if (!allowShrink) throw new Error(`${message} (set MARKET_ALLOW_SHRINK=1 to override)`);
356
+ console.log(`warning: ${message} (MARKET_ALLOW_SHRINK=1)`);
357
+ }
358
+ }
237
359
  writeFileSync(outputPath, body);
238
360
  console.log(`Wrote ${outputPath}: ${summary}`);
239
361
  console.log(`Publish URL: ${PUBLISHED_URL} (the release workflow force-pushes this file to the market-index branch)`);