dsh-context-compression-improved 0.5.3 → 0.5.4
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/.github/workflows/ci.yml +7 -1
- package/CHANGELOG.ja.md +25 -0
- package/CHANGELOG.ko.md +24 -0
- package/CHANGELOG.md +26 -0
- package/CHANGELOG.zh.md +21 -0
- package/package.json +2 -1
- package/packages/selector/package.json +1 -1
- package/scripts/packed-install-e2e.mjs +163 -44
- package/scripts/verify-release.mjs +43 -2
package/.github/workflows/ci.yml
CHANGED
|
@@ -18,7 +18,13 @@ jobs:
|
|
|
18
18
|
version: 11.7.0
|
|
19
19
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
20
20
|
with:
|
|
21
|
-
|
|
21
|
+
# The packed E2E builds a clone of the pinned Harness tag, so this must
|
|
22
|
+
# be a Node the Harness itself validates (its CI runs 22.19 / 24.9 / 26
|
|
23
|
+
# and defaults to the latest 24). Node 24.0.0 is not one of them: on it
|
|
24
|
+
# `tsx` 4.22.4 leaves `import.meta.main` undefined, so every guarded
|
|
25
|
+
# self-execution script in that clone — including its `build` script,
|
|
26
|
+
# which the E2E depends on — exits 0 without doing anything.
|
|
27
|
+
node-version: 24.9.0
|
|
22
28
|
cache: pnpm
|
|
23
29
|
- run: pnpm install --frozen-lockfile
|
|
24
30
|
- run: pnpm lint
|
package/CHANGELOG.ja.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
> 完全な履歴(アップストリーム 0.1.0 以前を含む)は [CHANGELOG.md](CHANGELOG.md) を参照。このファイルはフォークの追加エントリーのみを翻訳したものです。 · [English](CHANGELOG.md) · [中文](CHANGELOG.zh.md) · [한국어](CHANGELOG.ko.md)
|
|
4
4
|
|
|
5
|
+
## 0.5.4 - 2026-09-20
|
|
6
|
+
|
|
7
|
+
### Fixed(修正)
|
|
8
|
+
|
|
9
|
+
- インストール面が `@deepseek-ai/schemastery` を**ランタイム依存**として宣言するようになりました。
|
|
10
|
+
パッケージ済みランタイムはこれを無条件にインポートします(`packages/selector/lib/index.js`、
|
|
11
|
+
`lib/pruner.js`、`lib/advisor-state.js` の `import z from '@deepseek-ai/schemastery'`)。しかし
|
|
12
|
+
0.5.3 はコンシューマーのインストールが読む場所のどこにも宣言していませんでした。公開用ルートマニフェストは
|
|
13
|
+
`@huggingface/tokenizers` と `js-yaml` のみを列挙し、`packages/selector/package.json` は peer として
|
|
14
|
+
列挙していましたが、自身がインストールするネストしたパッケージについてパッケージマネージャーがその宣言を
|
|
15
|
+
参照することはありません。そのため解決は、無関係なインストール済みパッケージが
|
|
16
|
+
`@deepseek-ai/schemastery` をプロファイルへ持ち上げているかどうかに依存していました。クリーン
|
|
17
|
+
インストールでは Harness インストールの共有モジュールフォールバック
|
|
18
|
+
`$DSH_HOME/profiles/node_modules` に落ち、そこにビルド済みパッケージが無いホストでは全プラグイン
|
|
19
|
+
エントリのロードが失敗し、Bundle 層なしで起動していました。両マニフェストが `3.18.2`(本リリースの
|
|
20
|
+
ビルドとテストに使用した版)に固定し、selector は負っていない peer 義務を主張しなくなりました。
|
|
21
|
+
|
|
22
|
+
### Added(追加)
|
|
23
|
+
|
|
24
|
+
- `verify:release` は、インストール面の依存をパッケージ済みランタイムファイルが実際にインポートする裸の
|
|
25
|
+
指定子から導出するようになりました(`@huggingface/tokenizers` と `js-yaml` を手で列挙する方式を廃止)。
|
|
26
|
+
同梱するものと Harness インストールが提供するものの分界は**レビュー済みリスト**で、どちらのマニフェスト
|
|
27
|
+
にも提供者が無いインポートは欠落名と共にゲートが失敗します。このゲートは未修正のマニフェストに対して
|
|
28
|
+
**陰性対照**として先に実行し、`@deepseek-ai/schemastery` で失敗することを確認しました。
|
|
29
|
+
|
|
5
30
|
## 0.5.3 - 2026-09-20
|
|
6
31
|
|
|
7
32
|
### Fixed(修正)
|
package/CHANGELOG.ko.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
> 전체 히스토리(업스트림 0.1.0 이전 포함)는 [CHANGELOG.md](CHANGELOG.md)를 참고하세요. 이 파일은 포크의 추가 항목만 번역한 것입니다. · [English](CHANGELOG.md) · [中文](CHANGELOG.zh.md) · [日本語](CHANGELOG.ja.md)
|
|
4
4
|
|
|
5
|
+
## 0.5.4 - 2026-09-20
|
|
6
|
+
|
|
7
|
+
### Fixed(수정)
|
|
8
|
+
|
|
9
|
+
- 설치 표면이 `@deepseek-ai/schemastery`를 **런타임 의존성**으로 선언합니다. 패키징된 런타임은 이를
|
|
10
|
+
무조건 임포트합니다(`packages/selector/lib/index.js`, `lib/pruner.js`, `lib/advisor-state.js`의
|
|
11
|
+
`import z from '@deepseek-ai/schemastery'`). 그런데 0.5.3은 소비자 설치가 읽는 어느 위치에도 이를
|
|
12
|
+
선언하지 않았습니다. 배포용 루트 매니페스트는 `@huggingface/tokenizers`와 `js-yaml`만 나열했고,
|
|
13
|
+
`packages/selector/package.json`은 peer로 나열했지만 자신이 설치하는 중첩 패키지에 대해 패키지
|
|
14
|
+
관리자가 그 선언을 참조하지는 않습니다. 그래서 해석 여부는 무관한 다른 설치 패키지가
|
|
15
|
+
`@deepseek-ai/schemastery`를 프로필로 끌어올려 주는지에 달려 있었습니다. 깨끗한 설치에서는 Harness
|
|
16
|
+
설치의 공유 모듈 폴백 `$DSH_HOME/profiles/node_modules`로 떨어졌고, 그 폴백에 빌드된 패키지가 없는
|
|
17
|
+
호스트에서는 모든 플러그인 엔트리 로드가 실패해 Bundle 계층 없이 기동했습니다. 이제 두 매니페스트 모두
|
|
18
|
+
`3.18.2`(이번 릴리스의 빌드와 테스트에 사용한 버전)로 고정하며, selector는 지지 않을 peer 의무를
|
|
19
|
+
주장하지 않습니다.
|
|
20
|
+
|
|
21
|
+
### Added(추가)
|
|
22
|
+
|
|
23
|
+
- `verify:release`가 설치 표면 의존성을 패키징된 런타임 파일이 실제로 임포트하는 베어 지정자에서
|
|
24
|
+
도출합니다(`@huggingface/tokenizers`와 `js-yaml`을 손으로 나열하던 방식 제거). 플러그인과 함께
|
|
25
|
+
배포되는 것과 Harness 설치가 제공하는 것의 구분은 **검토된 목록**이며, 어느 매니페스트에도 제공자가 없는
|
|
26
|
+
임포트는 누락된 이름과 함께 게이트가 실패합니다. 이 게이트는 수정 전 매니페스트에 대해 **음성 대조**로
|
|
27
|
+
먼저 실행해 `@deepseek-ai/schemastery`에서 실패함을 확인했습니다.
|
|
28
|
+
|
|
5
29
|
## 0.5.3 - 2026-09-20
|
|
6
30
|
|
|
7
31
|
### Fixed(수정)
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes use this file. The project follows semantic versioning after `0.1.0`.
|
|
4
4
|
|
|
5
|
+
## 0.5.4 - 2026-09-20
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- The install surface declares `@deepseek-ai/schemastery` as a runtime dependency. The packaged
|
|
10
|
+
runtime imports it unconditionally (`import z from '@deepseek-ai/schemastery'` in
|
|
11
|
+
`packages/selector/lib/index.js`, `lib/pruner.js` and `lib/advisor-state.js`), but 0.5.3
|
|
12
|
+
declared it nowhere a consumer install reads: the shipped root manifest listed only
|
|
13
|
+
`@huggingface/tokenizers` and `js-yaml`, and `packages/selector/package.json` listed it as a
|
|
14
|
+
peer, which no package manager consults for a nested package it installs. Resolution therefore
|
|
15
|
+
depended on an unrelated installed package hoisting `@deepseek-ai/schemastery` into the
|
|
16
|
+
profile. In a clean install the import fell through to the Harness installation's
|
|
17
|
+
shared-module fallback at `$DSH_HOME/profiles/node_modules`; where that fallback held no built
|
|
18
|
+
package, every plugin entry failed to load and the host booted without the Bundle layer. Both
|
|
19
|
+
manifests now pin `3.18.2`, the version this release is built and tested against, and the
|
|
20
|
+
selector package no longer claims a peer obligation it does not have.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- `verify:release` derives the install-surface dependencies from the bare specifiers the
|
|
25
|
+
packaged runtime files import, instead of naming `@huggingface/tokenizers` and `js-yaml` by
|
|
26
|
+
hand. Which packages ship with the plugin and which the Harness installation provides is a
|
|
27
|
+
reviewed list, and an import whose provider is in neither manifest fails the gate with the
|
|
28
|
+
missing name. The gate was added as a negative control against the unfixed manifests, where it
|
|
29
|
+
failed on `@deepseek-ai/schemastery`.
|
|
30
|
+
|
|
5
31
|
## 0.5.3 - 2026-09-20
|
|
6
32
|
|
|
7
33
|
### Fixed
|
package/CHANGELOG.zh.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
> 完整历史(含上游 0.1.0 及更早版本)见 [CHANGELOG.md](CHANGELOG.md)。本文件只翻译本 fork 的新增条目。 · [English](CHANGELOG.md) · [日本語](CHANGELOG.ja.md) · [한국어](CHANGELOG.ko.md)
|
|
4
4
|
|
|
5
|
+
## 0.5.4 - 2026-09-20
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- 安装面现在把 `@deepseek-ai/schemastery` 声明为**运行时依赖**。打包后的运行时无条件导入它
|
|
10
|
+
(`packages/selector/lib/index.js`、`lib/pruner.js`、`lib/advisor-state.js` 中的
|
|
11
|
+
`import z from '@deepseek-ai/schemastery'`),但 0.5.3 在任何"消费者安装会读取"的位置都没有声明:
|
|
12
|
+
发布用的根清单只列了 `@huggingface/tokenizers` 与 `js-yaml`,而 `packages/selector/package.json`
|
|
13
|
+
把它列为 peer——对于它自己安装的嵌套包,包管理器根本不会去读该声明。于是能否解析取决于别的已装包是否
|
|
14
|
+
恰好把 `@deepseek-ai/schemastery` 提升进 profile。干净安装时该导入会落到 Harness 安装自身的共享模块
|
|
15
|
+
回退目录 `$DSH_HOME/profiles/node_modules`;当该回退处没有已构建的包时,每个插件入口都加载失败,
|
|
16
|
+
宿主启动后就没有 Bundle 层。现在两份清单都钉死 `3.18.2`(本次发布构建与实测所用版本),selector 也
|
|
17
|
+
不再声称一个它并不承担的 peer 义务。
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- `verify:release` 改为**从打包运行时文件实际导入的裸标识符推导**安装面依赖,不再手工点名
|
|
22
|
+
`@huggingface/tokenizers` 与 `js-yaml`。哪些随插件发布、哪些由 Harness 安装提供,这份分界是一份
|
|
23
|
+
**经评审的清单**;一旦某个导入的提供方不在两份清单中,门禁就会带着缺失的包名失败。该门禁先以"未修复
|
|
24
|
+
的清单"做了**阴性对照**,当时正是在 `@deepseek-ai/schemastery` 上失败。
|
|
25
|
+
|
|
5
26
|
## 0.5.3 - 2026-09-20
|
|
6
27
|
|
|
7
28
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-context-compression-improved",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org",
|
|
6
6
|
"access": "public",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"./package.json": "./package.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@deepseek-ai/schemastery": "3.18.2",
|
|
32
33
|
"@huggingface/tokenizers": "0.1.3",
|
|
33
34
|
"js-yaml": "^4.3.2"
|
|
34
35
|
},
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"tag": "latest"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
+
"@deepseek-ai/schemastery": "3.18.2",
|
|
85
86
|
"@huggingface/tokenizers": "0.1.3",
|
|
86
87
|
"js-yaml": "^4.3.2"
|
|
87
88
|
},
|
|
@@ -108,7 +109,6 @@
|
|
|
108
109
|
"@deepseek-ai/dsh-system-prompt": ">=0.1.5-rc.2 <0.2.0-0",
|
|
109
110
|
"@deepseek-ai/dsh-token-meter": ">=0.1.5-rc.2 <0.2.0-0",
|
|
110
111
|
"@deepseek-ai/dsh-tools": ">=0.1.5-rc.2 <0.2.0-0",
|
|
111
|
-
"@deepseek-ai/schemastery": ">=3.18.1 <4",
|
|
112
112
|
"react": ">=18 <19"
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -2,7 +2,7 @@ import { createHash } from 'node:crypto'
|
|
|
2
2
|
import { spawn } from 'node:child_process'
|
|
3
3
|
import { createReadStream } from 'node:fs'
|
|
4
4
|
import { copyFile, mkdir, mkdtemp, readFile, readdir, realpath, rm, stat, writeFile } from 'node:fs/promises'
|
|
5
|
-
import { readFileSync, readdirSync } from 'node:fs'
|
|
5
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
|
6
6
|
import { createServer } from 'node:http'
|
|
7
7
|
import { createRequire } from 'node:module'
|
|
8
8
|
import { tmpdir } from 'node:os'
|
|
@@ -316,10 +316,35 @@ async function runOfficialCloneCliSmoke(referenceRoot, registry, upgradeFrom, ca
|
|
|
316
316
|
let added = false
|
|
317
317
|
const environment = { ...process.env, DSH_HOME: dshHome }
|
|
318
318
|
let lastLifecycle = { command: '(none)', code: 0, stdout: '', stderr: '' }
|
|
319
|
+
// Positive controls for the CLI invocation path (issue #2). Declared at
|
|
320
|
+
// function scope so the failure evidence can always report them, and assigned
|
|
321
|
+
// once the clone checkout exists (spawn needs `cwd: worktree` to resolve).
|
|
322
|
+
let scriptLayerControl = { code: null, stdout: '', stderr: '' }
|
|
323
|
+
let directEntryControl = { code: null, stdout: '', stderr: '' }
|
|
324
|
+
/** Path of the tiny runner that invokes the CLI's exported entry (see below). */
|
|
325
|
+
let cliRunnerPath = null
|
|
326
|
+
/**
|
|
327
|
+
* Run the clone's CLI.
|
|
328
|
+
*
|
|
329
|
+
* Measured root cause of issue #2: the pinned clone's `apps/cli/src/bin.ts`
|
|
330
|
+
* dispatches through `if (import.meta.main) { await runCli() }`, and under
|
|
331
|
+
* tsx that flag evaluates falsy — so the module loads and does NOTHING. Both
|
|
332
|
+
* `pnpm dsh …` (the clone's own `dsh` script) and a direct
|
|
333
|
+
* `node --import tsx/esm apps/cli/src/bin.ts …` therefore exit 0 with empty
|
|
334
|
+
* output, which is exactly what the two positive controls report. The leg
|
|
335
|
+
* calls the CLI's EXPORTED entry instead, with argv shaped the way the entry
|
|
336
|
+
* would see it, so the lifecycle exercises the CLI rather than the loader's
|
|
337
|
+
* handling of a self-execution guard.
|
|
338
|
+
*/
|
|
319
339
|
const dsh = async (...args) => {
|
|
320
|
-
|
|
340
|
+
if (cliRunnerPath === null) throw new Error('e2e: the CLI runner probe was not prepared')
|
|
341
|
+
const outcome = await captureOutcome(
|
|
342
|
+
process.execPath,
|
|
343
|
+
['--import', 'tsx/esm', cliRunnerPath, ...args],
|
|
344
|
+
{ cwd: worktree, env: environment },
|
|
345
|
+
)
|
|
321
346
|
lastLifecycle = {
|
|
322
|
-
command: `
|
|
347
|
+
command: `dsh ${args.join(' ')}`,
|
|
323
348
|
code: outcome.code ?? -1,
|
|
324
349
|
stdout: outcome.stdout,
|
|
325
350
|
stderr: outcome.stderr,
|
|
@@ -332,10 +357,14 @@ async function runOfficialCloneCliSmoke(referenceRoot, registry, upgradeFrom, ca
|
|
|
332
357
|
].filter(Boolean).join('\n'))
|
|
333
358
|
}
|
|
334
359
|
}
|
|
335
|
-
const dumpConfig = () => capture(
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
360
|
+
const dumpConfig = () => capture(
|
|
361
|
+
process.execPath,
|
|
362
|
+
['--import', 'tsx/esm', cliRunnerPath, '--profile', 'web', '--dump-config'],
|
|
363
|
+
{
|
|
364
|
+
cwd: worktree,
|
|
365
|
+
env: environment,
|
|
366
|
+
},
|
|
367
|
+
).then(captured => captured.stdout)
|
|
339
368
|
|
|
340
369
|
/** Installed manifest of the profile-resolved plugin package. */
|
|
341
370
|
const profilePackages = () => {
|
|
@@ -367,6 +396,9 @@ async function runOfficialCloneCliSmoke(referenceRoot, registry, upgradeFrom, ca
|
|
|
367
396
|
`last lifecycle: ${lastLifecycle.command} (exit ${String(lastLifecycle.code)})`,
|
|
368
397
|
`lifecycle stdout: ${lastLifecycle.stdout.trim()}`,
|
|
369
398
|
`lifecycle stderr: ${lastLifecycle.stderr.trim()}`,
|
|
399
|
+
// Positive controls: see the comment where they are captured (issue #2).
|
|
400
|
+
`control script-layer (pnpm dsh --version): exit ${String(scriptLayerControl.code)} out=${scriptLayerControl.stdout.trim()} err=${scriptLayerControl.stderr.trim()}`,
|
|
401
|
+
`control direct-entry (tsx bin.ts --version): exit ${String(directEntryControl.code)} out=${directEntryControl.stdout.trim()} err=${directEntryControl.stderr.trim()}`,
|
|
370
402
|
`profile dependencies: ${declared}`,
|
|
371
403
|
`profiles/web/node_modules: ${installed}`,
|
|
372
404
|
].join('\n'), { cause: error })
|
|
@@ -379,16 +411,47 @@ async function runOfficialCloneCliSmoke(referenceRoot, registry, upgradeFrom, ca
|
|
|
379
411
|
}
|
|
380
412
|
|
|
381
413
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
* client libraries below.
|
|
414
|
+
* Host-plane runtime entries of the installed package. `client.js` is
|
|
415
|
+
* excluded: it is a lazy-CJS web artifact whose requires (`react`, the
|
|
416
|
+
* ui-slot packages) the web bundler supplies, and that stack is verified
|
|
417
|
+
* from the built client libraries below.
|
|
387
418
|
*/
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
419
|
+
const HOST_PLANE_ENTRIES = ['index.js', 'pruner.js', 'advisor-state.js', 'tail-trim.js', 'invariant.js']
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Bare package names the installed package's host-plane runtime files import.
|
|
423
|
+
*
|
|
424
|
+
* The runtime directory is read off the INSTALLED manifest's own `main` rather
|
|
425
|
+
* than assumed: the tarball this gate packs is `packages/selector` (`main`
|
|
426
|
+
* `lib/index.js`), while the published root manifest points at
|
|
427
|
+
* `packages/selector/lib/index.js`. Guessing either one read the wrong tree
|
|
428
|
+
* and failed closed on an ENOENT that said nothing about the plugin.
|
|
429
|
+
*
|
|
430
|
+
* @param selectorDir - Installed directory of the plugin package.
|
|
431
|
+
* @param selectorManifest - The installed manifest, for its `main` field.
|
|
432
|
+
* @returns The package roots the host must be able to resolve.
|
|
433
|
+
*/
|
|
434
|
+
const hostPlaneRuntimeImports = async (selectorDir, selectorManifest) => {
|
|
435
|
+
const main = selectorManifest?.main
|
|
436
|
+
if (typeof main !== 'string' || main.length === 0) {
|
|
437
|
+
throw new Error(`installed package declares no main entry: ${JSON.stringify(selectorManifest?.main)}`)
|
|
438
|
+
}
|
|
439
|
+
const runtimeDir = dirname(join(selectorDir, main))
|
|
440
|
+
if (!existsSync(runtimeDir)) {
|
|
441
|
+
throw new Error(`installed package main ${main} points at a directory that is not in the tarball: ${runtimeDir}`)
|
|
442
|
+
}
|
|
443
|
+
const names = new Set()
|
|
444
|
+
for (const entry of HOST_PLANE_ENTRIES) {
|
|
445
|
+
const source = await readFile(join(runtimeDir, entry), 'utf8')
|
|
446
|
+
for (const match of source.matchAll(/(?:^|[^.\w])(?:import|export)\s[^;]*?from\s*['"]([^'"]+)['"]|(?:^|[^.\w])(?:import|require)\s*\(\s*['"]([^'"]+)['"]\s*\)/gmu)) {
|
|
447
|
+
const specifier = match[1] ?? match[2]
|
|
448
|
+
if (specifier.startsWith('.') || specifier.startsWith('node:')) continue
|
|
449
|
+
names.add(specifier.split('/').slice(0, specifier.startsWith('@') ? 2 : 1).join('/'))
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
if (names.size === 0) throw new Error('installed package exposes no host-plane runtime import to verify')
|
|
453
|
+
return names
|
|
454
|
+
}
|
|
392
455
|
|
|
393
456
|
/**
|
|
394
457
|
* Verify every web/client peer exists as a BUILT artifact resolvable from
|
|
@@ -436,37 +499,41 @@ async function runOfficialCloneCliSmoke(referenceRoot, registry, upgradeFrom, ca
|
|
|
436
499
|
}
|
|
437
500
|
|
|
438
501
|
/**
|
|
439
|
-
* Prove the plugin actually loads in the official profile: pnpm's peers
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
502
|
+
* Prove the plugin actually loads in the official profile: pnpm's peers check
|
|
503
|
+
* cannot see the healed profiles/node_modules fallback by design, so the
|
|
504
|
+
* release gate resolves and imports instead. Fail-closed parts:
|
|
505
|
+
*
|
|
506
|
+
* - every bare specifier the HOST-plane runtime files import must resolve from
|
|
507
|
+
* the profile. That set is DERIVED from the installed artifact rather than
|
|
508
|
+
* listed by hand: 0.5.3 imported `@deepseek-ai/schemastery` while declaring
|
|
509
|
+
* it in no manifest a consumer reads, and a hand-maintained whitelist plus a
|
|
510
|
+
* hand-maintained dependency list could not see it;
|
|
511
|
+
* - every declared runtime dependency must resolve (the install surface);
|
|
512
|
+
* - the node entry must import and export a callable `apply()`;
|
|
513
|
+
* - a declared peer may stay unresolved only when no host-plane file imports
|
|
514
|
+
* it — the web-host client packages are supplied by the web app, and their
|
|
515
|
+
* built libraries are verified separately below.
|
|
446
516
|
*/
|
|
447
517
|
const provePluginLoads = async () => {
|
|
448
|
-
const { profileRoot, selector } = profilePackages()
|
|
518
|
+
const { profileRoot, selectorPath, selector } = profilePackages()
|
|
449
519
|
const selectorPeers = Object.keys(selector.peerDependencies ?? {})
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
throw new Error(`web-only whitelist names a peer the selector no longer declares: ${allowed}`)
|
|
454
|
-
}
|
|
455
|
-
}
|
|
520
|
+
const selectorDependencies = Object.keys(selector.dependencies ?? {})
|
|
521
|
+
const runtimeImports = [...await hostPlaneRuntimeImports(dirname(selectorPath), selector)].sort()
|
|
522
|
+
const required = [...new Set([...runtimeImports, ...selectorDependencies])].sort()
|
|
456
523
|
const script = [
|
|
457
524
|
"const { createRequire } = require('node:module')",
|
|
458
525
|
`const requireFromProfile = createRequire(String.raw\`${join(profileRoot, 'package.json')}\`)`,
|
|
459
|
-
`for (const
|
|
460
|
-
' requireFromProfile.resolve(
|
|
526
|
+
`for (const name of ${JSON.stringify(required)}) {`,
|
|
527
|
+
' requireFromProfile.resolve(name)',
|
|
461
528
|
'}',
|
|
462
529
|
"const selectorEntry = requireFromProfile.resolve('dsh-context-compression-improved')",
|
|
463
530
|
'const plugin = require(selectorEntry)',
|
|
464
531
|
"if (typeof plugin.apply !== 'function') throw new Error('selector entry exports no apply()')",
|
|
465
|
-
|
|
532
|
+
'const unresolvedPeers = []',
|
|
466
533
|
`for (const peer of ${JSON.stringify(selectorPeers)}) {`,
|
|
467
|
-
' try { requireFromProfile.resolve(peer) } catch {
|
|
534
|
+
' try { requireFromProfile.resolve(peer) } catch { unresolvedPeers.push(peer) }',
|
|
468
535
|
'}',
|
|
469
|
-
"console.log('LOAD_OK ' + JSON.stringify(
|
|
536
|
+
"console.log('LOAD_OK ' + JSON.stringify(unresolvedPeers))",
|
|
470
537
|
].join('\n')
|
|
471
538
|
const outcome = await captureOutcome(process.execPath, ['--input-type=commonjs', '-e', script], {
|
|
472
539
|
cwd: worktree,
|
|
@@ -474,17 +541,17 @@ async function runOfficialCloneCliSmoke(referenceRoot, registry, upgradeFrom, ca
|
|
|
474
541
|
})
|
|
475
542
|
const marker = outcome.stdout.split('\n').find(line => line.startsWith('LOAD_OK'))
|
|
476
543
|
if (outcome.code !== 0 || marker === undefined) {
|
|
477
|
-
throw new Error(`official profile failed to load the plugin and its engine peers:\n${outcome.stdout}\n${outcome.stderr}`)
|
|
544
|
+
throw new Error(`official profile failed to load the plugin, its host-plane imports and its engine peers:\n${outcome.stdout}\n${outcome.stderr}`)
|
|
478
545
|
}
|
|
479
|
-
const
|
|
480
|
-
const
|
|
481
|
-
if (
|
|
482
|
-
throw new Error(`selector peers
|
|
546
|
+
const unresolvedPeers = JSON.parse(marker.slice('LOAD_OK '.length))
|
|
547
|
+
const importedWithoutProvider = unresolvedPeers.filter(peer => runtimeImports.includes(peer))
|
|
548
|
+
if (importedWithoutProvider.length > 0) {
|
|
549
|
+
throw new Error(`selector peers the host-plane runtime imports did not resolve from the profile: ${importedWithoutProvider.join(', ')}`)
|
|
483
550
|
}
|
|
484
551
|
return {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
552
|
+
hostPlaneRuntimeImports: runtimeImports,
|
|
553
|
+
installedRuntimeDependencies: selectorDependencies,
|
|
554
|
+
unresolvedSelectorPeers: unresolvedPeers,
|
|
488
555
|
builtClientPeersVerified: await proveBuiltClientPeersLoad(),
|
|
489
556
|
}
|
|
490
557
|
}
|
|
@@ -660,8 +727,60 @@ async function runOfficialCloneCliSmoke(referenceRoot, registry, upgradeFrom, ca
|
|
|
660
727
|
// dsh-base + dsh-web-app, the only bundle that mounts agent-presets and
|
|
661
728
|
// therefore the selector's preset overlay — so build both library faces
|
|
662
729
|
// AND the web frontend; the healed profiles/node_modules fallback also
|
|
663
|
-
// symlinks the CLI's own workspace packages
|
|
730
|
+
// symlinks the CLI's own workspace packages, which is why the checkout's
|
|
731
|
+
// `vendor/schemastery/lib` has to exist too.
|
|
664
732
|
await run('pnpm', ['run', 'build'], { cwd: worktree })
|
|
733
|
+
// Fail closed on the artifacts every later probe needs. Measured on the Node
|
|
734
|
+
// this workflow used to pin (24.0.0): `tsx` leaves `import.meta.main`
|
|
735
|
+
// undefined there, the clone's guarded `scripts/build.ts` exited 0 in about
|
|
736
|
+
// eight seconds having emitted nothing, and the boot probe then failed twice
|
|
737
|
+
// over — `client bundles not found; run \`pnpm run build\` before launch`
|
|
738
|
+
// from client composition, and `Cannot find module
|
|
739
|
+
// .../profiles/node_modules/@deepseek-ai/schemastery/lib/index.mjs` from the
|
|
740
|
+
// plugin, because the installation fallback resolves that name to the source
|
|
741
|
+
// checkout's `vendor/schemastery`, whose `lib` only this build produces.
|
|
742
|
+
for (const artifact of [
|
|
743
|
+
'packages/client/ui-settings/lib/client.js',
|
|
744
|
+
'vendor/schemastery/lib/index.mjs',
|
|
745
|
+
]) {
|
|
746
|
+
if (!existsSync(join(worktree, artifact))) {
|
|
747
|
+
throw new Error([
|
|
748
|
+
`official clone build produced no ${artifact}`,
|
|
749
|
+
'the clone\'s build script is `tsx scripts/build.ts`, guarded by `if (import.meta.main)`;',
|
|
750
|
+
'tsx leaves that flag undefined on Node < 24.2, so the build exits 0 without building',
|
|
751
|
+
].join(' '))
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// Positive controls (recorded, never asserted), captured HERE because the
|
|
756
|
+
// clone checkout must exist: `cwd: worktree` is what makes spawn work at
|
|
757
|
+
// all. The clone's `dsh` script is `node --import tsx/esm
|
|
758
|
+
// apps/cli/src/bin.ts`, and bin.ts' `plugin` mode ALWAYS calls runPlugin —
|
|
759
|
+
// which either initializes the profile (printing `dsh: initialized profile
|
|
760
|
+
// …`), forwards pnpm's inherited stdio, or reports a missing pnpm with exit
|
|
761
|
+
// 127. It therefore cannot exit 0 with empty output, so a silent lifecycle
|
|
762
|
+
// means the CLI never reached that mode. These two probes tell the two
|
|
763
|
+
// candidate causes apart: the package manager's script layer swallowing the
|
|
764
|
+
// invocation, versus the CLI entry itself. See issue #2.
|
|
765
|
+
scriptLayerControl = await captureOutcome('pnpm', ['dsh', '--version'], { cwd: worktree, env: environment })
|
|
766
|
+
directEntryControl = await captureOutcome(
|
|
767
|
+
process.execPath,
|
|
768
|
+
['--import', 'tsx/esm', 'apps/cli/src/bin.ts', '--version'],
|
|
769
|
+
{ cwd: worktree, env: environment },
|
|
770
|
+
)
|
|
771
|
+
// The runner the lifecycle uses. It imports the entry and calls the
|
|
772
|
+
// exported `runCli()` after shaping argv exactly as the entry would see it
|
|
773
|
+
// (`argv[1]` = the entry path), so every mode the entry supports — profile
|
|
774
|
+
// boot, plugin forwarding, config dumps, help, version — behaves as it does
|
|
775
|
+
// when the file really is the process entry point.
|
|
776
|
+
cliRunnerPath = join(temporaryRoot, 'run-cli.mjs')
|
|
777
|
+
await writeFile(cliRunnerPath, [
|
|
778
|
+
"import { pathToFileURL } from 'node:url'",
|
|
779
|
+
`const entry = ${JSON.stringify(join(worktree, 'apps/cli/src/bin.ts'))}`,
|
|
780
|
+
'process.argv = [process.argv[0], entry, ...process.argv.slice(2)]',
|
|
781
|
+
'const { runCli } = await import(pathToFileURL(entry).href)',
|
|
782
|
+
'await runCli()',
|
|
783
|
+
].join('\n'), 'utf8')
|
|
665
784
|
|
|
666
785
|
// Real lifecycle: start on the published previous release.
|
|
667
786
|
if (upgradeFrom === undefined) throw new Error('release gate requires the previous published release for the official lifecycle')
|
|
@@ -28,9 +28,50 @@ for (const specifier of ['.', './invariant', './pruner', './client']) {
|
|
|
28
28
|
if (rootPackage.dsh?.bundle?.patch !== './packages/selector/cordis.patch.yml') {
|
|
29
29
|
fail('root must declare the DSH Bundle patch of the selector package')
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
// The root manifest is the install surface: every bare specifier the packaged
|
|
32
|
+
// runtime files import must be provided by that install or by the Harness
|
|
33
|
+
// installation, and that split is REVIEWED here rather than assumed. 0.5.3
|
|
34
|
+
// imported `@deepseek-ai/schemastery` while neither manifest declared it, so the
|
|
35
|
+
// import resolved only while an unrelated package happened to hoist it into the
|
|
36
|
+
// profile; a clean install fell through to the installation's shared-module
|
|
37
|
+
// fallback and failed where that fallback had no built package. An import with
|
|
38
|
+
// no provider fails here instead of at a consumer's first boot.
|
|
39
|
+
const INSTALLATION_PROVIDED_RUNTIME = new Set([
|
|
40
|
+
'@deepseek-ai/cordis',
|
|
41
|
+
'@deepseek-ai/cordis-plugin-include',
|
|
42
|
+
'@deepseek-ai/dsh-llm',
|
|
43
|
+
'@deepseek-ai/dsh-session',
|
|
44
|
+
'@deepseek-ai/dsh-settings',
|
|
45
|
+
'@deepseek-ai/dsh-tools',
|
|
46
|
+
])
|
|
47
|
+
// The client-plane entry loads in the web bundler, which carries the client
|
|
48
|
+
// stack (`react`, the ui-slot packages); its requires are reviewed from the
|
|
49
|
+
// built artifact further down instead.
|
|
50
|
+
const HOST_PLANE_ENTRIES = [
|
|
51
|
+
'lib/advisor-state.js',
|
|
52
|
+
'lib/index.js',
|
|
53
|
+
'lib/invariant.js',
|
|
54
|
+
'lib/pruner.js',
|
|
55
|
+
'lib/tail-trim.js',
|
|
56
|
+
]
|
|
57
|
+
const RUNTIME_IMPORT = /(?:^|[^.\w])(?:import|export)\s[^;]*?from\s*['"]([^'"]+)['"]|(?:^|[^.\w])(?:import|require)\s*\(\s*['"]([^'"]+)['"]\s*\)/gmu
|
|
58
|
+
const runtimeImports = new Set()
|
|
59
|
+
for (const entry of HOST_PLANE_ENTRIES) {
|
|
60
|
+
const source = await readFile(join(root, 'packages/selector', entry), 'utf8')
|
|
61
|
+
for (const match of source.matchAll(RUNTIME_IMPORT)) {
|
|
62
|
+
const specifier = match[1] ?? match[2]
|
|
63
|
+
if (specifier.startsWith('.') || specifier.startsWith('node:')) continue
|
|
64
|
+
runtimeImports.add(specifier.split('/').slice(0, specifier.startsWith('@') ? 2 : 1).join('/'))
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (runtimeImports.size === 0) fail('the packaged runtime import scan found no bare specifier')
|
|
68
|
+
for (const dependency of [...runtimeImports].sort()) {
|
|
69
|
+
if (INSTALLATION_PROVIDED_RUNTIME.has(dependency)) continue
|
|
32
70
|
if (rootPackage.dependencies?.[dependency] === undefined) {
|
|
33
|
-
fail(`root dependencies are missing ${dependency}`)
|
|
71
|
+
fail(`root dependencies are missing ${dependency}, which the packaged runtime imports`)
|
|
72
|
+
}
|
|
73
|
+
if (selectorPackage.dependencies?.[dependency] === undefined) {
|
|
74
|
+
fail(`selector dependencies are missing ${dependency}, which the packed candidate imports`)
|
|
34
75
|
}
|
|
35
76
|
}
|
|
36
77
|
for (const specifier of ['.', './invariant', './pruner', './client']) {
|