diff --git a/apps/memos-local-plugin/CHANGELOG.md b/apps/memos-local-plugin/CHANGELOG.md index 996768a3e..2ea8075b7 100644 --- a/apps/memos-local-plugin/CHANGELOG.md +++ b/apps/memos-local-plugin/CHANGELOG.md @@ -5,6 +5,17 @@ for the full per-commit history use `git log` or the GitHub releases page. ## Index +- Unreleased — Pin the packaged tsx runtime to the validated 4.21.0 so + fresh DSH profile installs retain the reviewed esbuild 0.27.7 build policy. + Verified a source-tarball installation and a real local-model memory + write/recall/tool-search round trip on DSH 0.2.2-rc.5. + +- Unreleased — Admit the five validated DSH `0.2.2-rc.1` through + `0.2.2-rc.5` versions explicitly. Pin their fixtures to Cordis `4.1.0` + with matching session codecs and validate plugin/host Cordis peers. + Other unvalidated previews remain excluded from npm peer support. These + changes have not been published to npm. Related PRs: #2614 and #2632. + - Unreleased — Admit DSH `0.1.7-rc.2`, `0.2.0-rc.2`, and `0.2.1-rc.2/rc.3` through explicit, bounded optional peer ranges; retain the `2.0.21` V4 producer-owned message sources. Stop importing the moved `JsonValue` type diff --git a/apps/memos-local-plugin/adapters/deepseek-harness/COMPATIBILITY.md b/apps/memos-local-plugin/adapters/deepseek-harness/COMPATIBILITY.md index 6f92acd37..3cd0dc781 100644 --- a/apps/memos-local-plugin/adapters/deepseek-harness/COMPATIBILITY.md +++ b/apps/memos-local-plugin/adapters/deepseek-harness/COMPATIBILITY.md @@ -4,6 +4,140 @@ Validated on 2026-10-29, macOS arm64, Node.js 25.1.0, npm 11.6.2, pnpm 10.21.0. Scope: the local plugin; the Cloud plugin is separate. Related: MemOS issue #2520 and PR #2541. +## DSH 0.2.2-rc.1 through rc.5 validation — 2026-11-19 + +This update incorporates PR #2614 in PR #2632 and was tested on macOS arm64, +Node.js 25.1.0, and npm 11.6.2. All five published 0.2.2 release candidates +are now explicitly admitted by the six optional host-service peers. + +The intermediate-version regressions first failed in six places. npm's +default peer checks rejected rc.2, rc.3 and rc.4, and their fixtures selected +Cordis ~4.0.5 and the 0.2.1-rc.3 session codec. Each of these hosts requires +Cordis ~4.1.0. The overrides table now pins all five 0.2.2 fixtures to Cordis +4.1.0 with each host's matching codec. The fixture also checks plugin and +host Cordis peer requirements. Runtime adapter changes were unnecessary +after these dependency-selection fixes. + +The peer declarations list rc.1, rc.2, rc.3, rc.4 and rc.5 individually. +The package regression continues to reject rc.6, stable 0.2.2 and 0.3.x +under npm's default semver evaluation. + +Verification output: + +```text +make format: All checks passed! / 642 files left unchanged +npm test: Test Files 192 passed (192) + Tests 1669 passed | 3 skipped (1672) +pytest apps/memos-local-plugin/tests/python -q: 143 passed in 5.64s +npm run lint: passed +npm run build:package: passed +npm run lock:check: SQLite 13.0.3 lock metadata verified +npm run test:dsh-compat -- 0.2.2-rc.2 0.2.2-rc.3 0.2.2-rc.4: + PASS all 3 DSH versions +npm run test:dsh-compat: PASS all 10 DSH versions +``` + +All ten real host stacks passed type checking, a production TypeScript +build, and 71 adapter tests each. The matrix covers 0.1.0-rc.6, 0.1.7-rc.2, +0.2.0-rc.2, 0.2.1-rc.2, 0.2.1-rc.3, and every release from 0.2.2-rc.1 +through 0.2.2-rc.5. The matching host packages were fetched from npm. +Existing non-host build tools and unchanged native bindings were reused. + +The first matrix attempts were interrupted by npm/Node registry connection +timeouts. The successful runs used an explicit temporary Undici proxy +dispatcher for the machine's system HTTPS proxy, with loopback traffic +bypassing it. No proxy dependency was added to the plugin. + +The official rc.5 loader uses semver includePrerelease enabled. A real +dump-config comparison showed that the older >=0.2.1-rc.2 <0.2.2 comparator +already admits rc.5 at startup. The explicit prerelease declarations address +npm's default peer-evaluation mismatch. + +### Real Web startup checks + +Official DSH CLI packages were installed separately with lifecycle scripts +disabled. An npm-packed local plugin runtime was loaded into fresh Web +profiles with synthetic local settings, telemetry disabled, and +failOnStartupError enabled. + +| DSH version | API/build/71 adapter tests | Actual macOS Web startup | +| --- | --- | --- | +| 0.2.2-rc.1 | Passed | Unverified | +| 0.2.2-rc.2 | Passed | Passed | +| 0.2.2-rc.3 | Passed | Passed | +| 0.2.2-rc.4 | Passed | Passed | +| 0.2.2-rc.5 | Passed | Passed in the initial rc.5 validation | + +For rc.2, rc.3 and rc.4, the composed profile contained the MemOS row with no +version exemption. Actual startup created SQLite storage and returned HTTP +200 from the Viewer health endpoint with agent deepseek-harness. SIGINT +stopped each Web process with exit code 130. The prior rc.5 smoke produced +the same results. + +### Fresh installation and real local-model round trip + +A fresh official DSH 0.2.2-rc.5 CLI was installed using npm with normal +dependency lifecycle scripts. The branch source was built and packed with +npm pack, including its prepack build. The local tarball retained the +branch's package version 2.0.16-beta.1 and was identified by its branch +contents rather than an npm release tag. + +The first actual installer run failed with ERR_PNPM_IGNORED_BUILDS for +esbuild@0.28.2. The tarball's tsx range ^4.21.0 resolved to 4.23.15 under +pnpm, which ignores the tarball's npm lock. A failing regression reproduced +the manifest/validated-version mismatch. Pinning tsx to the already locked +4.21.0, with both lock importers synchronized, resolved the installation +failure while retaining the existing reviewed script policy. + +The rebuilt source tarball was installed into a second fresh DSH home using +the official Unix installer and an isolated pnpm 11.7.0. Actual installed +versions were tsx 4.21.0, esbuild 0.27.7, better-sqlite3 13.0.3 and +onnxruntime-node 1.24.3. The installer's SQLite write/read probe and bundled +ONNX CPU backend probe both passed. + +A real Ollama-backed headless test used existing local qwen2.5:0.5b and +nomic-embed-text models. The MemOS auxiliary LLM calls used DSH's host-model +bridge, and the embedding endpoint produced 768-dimensional embeddings. +For the small local model, the test profile retained the MemOS tools and +disabled unrelated tool providers. The initial full-tool profile exceeded +Ollama's 4096-token context and produced off-topic answers, so that run was +not used as evidence of answer correctness. + +The successful test created a fresh memory directory and separate DSH +sessions/processes for each prompt: + +1. Store the synthetic fact that Project Orchid-Z91 uses port 47381. + The model replied SAVED and the first trace was persisted. +2. Restart DSH into a new session and ask for the project's port without + supplying the number. The model answered Project Orchid-Z91 port 47381. +3. Ask the model to call memos_search. The real tool call completed, returned + the two earlier memories, and the final answer included port 47381. + +The compressed V4 session logs confirmed a producer-owned MemOS recall +message containing memos_context and the correct port in the second and +third sessions. SQLite had three persisted traces with embedding vectors, +and PRAGMA integrity_check returned ok. Each successful headless turn +exited 0 and its lightweight capture reported warnings=0. Ollama's server +log also recorded HTTP 500 responses during auxiliary activity, while +these turns and captures completed successfully. + +The headless --json stdout also includes MemOS core log lines. This test +parsed the JSON event lines separately and preserved the complete output. +Strict NDJSON-only stdout is an outstanding integration limitation. + +These tests used package-manager-installed dependency trees and synthetic +local inputs. The temporary Ollama server was stopped after validation. + +### Remaining verification and release scope + +Cloud-provider authenticated conversations, packaged Desktop applications +on macOS, Windows and Linux, live model downloads, and production-profile +upgrades remain unverified. Fresh installation was exercised on macOS with +DSH rc.5, Node.js 25.1.0 and pnpm 11.7.0. Other platform/runtime installation +combinations and full-tool agent answer quality remain unverified. +The Cloud plugin and other DSH previews are outside this validation. +These source changes have not been published to npm. + ## Diagnosis The local plugin's six optional host-service peers excluded DSH 0.2.x. diff --git a/apps/memos-local-plugin/adapters/deepseek-harness/README.md b/apps/memos-local-plugin/adapters/deepseek-harness/README.md index 0c44a47bb..d23b84e8c 100644 --- a/apps/memos-local-plugin/adapters/deepseek-harness/README.md +++ b/apps/memos-local-plugin/adapters/deepseek-harness/README.md @@ -10,8 +10,9 @@ modifying the DSH repository. > DeepSeek Harness is currently a developer preview. The development API stack > is pinned to `0.2.1-rc.3`. The compatibility matrix compiles, builds, and tests > this adapter against the published `0.1.0-rc.6`, `0.1.7-rc.2`, `0.2.0-rc.2`, -> `0.2.1-rc.2`, and `0.2.1-rc.3` packages. These are API/contract checks, not a -> substitute for validating each packaged Desktop/Web/CLI release. +> `0.2.1-rc.2`, `0.2.1-rc.3`, and the five `0.2.2-rc.1` through +> `0.2.2-rc.5` releases. +> Validate the packaged Desktop/Web/CLI release as well as these API checks. ## How it works @@ -622,6 +623,7 @@ For the compatibility matrix, run: npm run test:dsh-compat # Or select a specific published API stack: npm run test:dsh-compat -- 0.2.1-rc.3 +npm run test:dsh-compat -- 0.2.2-rc.5 ``` The script needs npm registry access. It installs each real host peer graph in @@ -638,15 +640,26 @@ The six optional DSH service peers intentionally declare separate prerelease lines: ```text ->=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 +>=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5 ``` npm semver only admits a prerelease when a comparator explicitly names its `major.minor.patch` tuple. Simply changing `<0.2.0` to `<0.3.0` would still -exclude `0.2.1-rc.3`. Unvalidated `0.2.2` and `0.3.x` remain excluded. +exclude `0.2.1-rc.3`. The five tested `0.2.2-rc.1` through `0.2.2-rc.5` +versions are admitted explicitly. Other unvalidated `0.2.2` releases and +`0.3.x` remain excluded by npm's default evaluation. All five new fixtures +pin Cordis `4.1.0` and their matching V3-to-V4 codec. The matrix +checks that Cordis satisfies the plugin and each host service peer range. +Earlier fixtures retain their original host dependencies. The former `0.1.0-rc.5` API baseline is no longer advertised: its core packages are unavailable from npm, so it cannot be revalidated by this matrix. +DSH `0.2.2-rc.5` evaluates startup compatibility with +`includePrerelease: true`. Its loader also accepts `0.2.2-rc.5` under the +older `>=0.2.1-rc.2 <0.2.2` comparator. npm's default peer evaluation still +excludes that prerelease, so the explicit declaration above is needed for +package-manager compatibility. Check both installation and runtime startup. + There are two independent checks to distinguish: - **Startup: bundle skipped as incompatible.** Plugin `2.0.20` and `2.0.21` @@ -663,6 +676,12 @@ can overwrite those patches. A successful `allow-version` exemption alone does not verify runtime compatibility. Until this change is released, installing npm `2.0.21` still leaves the startup version restriction in place. +When the host reaches Hugging Face through `HTTPS_PROXY`, launch Node with +`NODE_USE_ENV_PROXY=1` so its `fetch` uses that proxy. On a slow first model +download, set `embedding.local.loadTimeoutMs` in the MemOS `config.yaml` to a +larger value; this setting affects model loading, not the bounded foreground +recall timeout. + ## Known limitations 1. **Developer-preview compatibility.** The supported prerelease lines and diff --git a/apps/memos-local-plugin/package-lock.json b/apps/memos-local-plugin/package-lock.json index 7cc00eeac..414d2c4e9 100644 --- a/apps/memos-local-plugin/package-lock.json +++ b/apps/memos-local-plugin/package-lock.json @@ -15,7 +15,7 @@ "@sinclair/typebox": "^0.34.48", "better-sqlite3": "13.0.3", "preact": "^10.29.1", - "tsx": "^4.21.0", + "tsx": "4.21.0", "uuid": "^10.0.0", "yaml": "^2.6.0" }, @@ -45,12 +45,12 @@ }, "peerDependencies": { "@deepseek-ai/cordis": "^4.0.1", - "@deepseek-ai/dsh-agent": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", - "@deepseek-ai/dsh-llm": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", - "@deepseek-ai/dsh-session": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", - "@deepseek-ai/dsh-system-prompt": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", - "@deepseek-ai/dsh-timeout": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", - "@deepseek-ai/dsh-tools": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", + "@deepseek-ai/dsh-agent": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", + "@deepseek-ai/dsh-llm": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", + "@deepseek-ai/dsh-session": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", + "@deepseek-ai/dsh-system-prompt": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", + "@deepseek-ai/dsh-timeout": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", + "@deepseek-ai/dsh-tools": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", "@deepseek-ai/schemastery": "^3.18.1" }, "peerDependenciesMeta": { diff --git a/apps/memos-local-plugin/package.json b/apps/memos-local-plugin/package.json index b0d879531..f812704dc 100644 --- a/apps/memos-local-plugin/package.json +++ b/apps/memos-local-plugin/package.json @@ -102,18 +102,18 @@ "@sinclair/typebox": "^0.34.48", "better-sqlite3": "13.0.3", "preact": "^10.29.1", - "tsx": "^4.21.0", + "tsx": "4.21.0", "uuid": "^10.0.0", "yaml": "^2.6.0" }, "peerDependencies": { "@deepseek-ai/cordis": "^4.0.1", - "@deepseek-ai/dsh-agent": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", - "@deepseek-ai/dsh-llm": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", - "@deepseek-ai/dsh-session": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", - "@deepseek-ai/dsh-system-prompt": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", - "@deepseek-ai/dsh-timeout": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", - "@deepseek-ai/dsh-tools": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2", + "@deepseek-ai/dsh-agent": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", + "@deepseek-ai/dsh-llm": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", + "@deepseek-ai/dsh-session": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", + "@deepseek-ai/dsh-system-prompt": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", + "@deepseek-ai/dsh-timeout": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", + "@deepseek-ai/dsh-tools": ">=0.1.0-rc.6 <0.2.0 || >=0.1.7-rc.2 <0.1.8 || >=0.2.0-rc.2 <0.2.1 || >=0.2.1-rc.2 <0.2.2 || 0.2.2-rc.1 || 0.2.2-rc.2 || 0.2.2-rc.3 || 0.2.2-rc.4 || 0.2.2-rc.5", "@deepseek-ai/schemastery": "^3.18.1" }, "peerDependenciesMeta": { diff --git a/apps/memos-local-plugin/pnpm-lock.yaml b/apps/memos-local-plugin/pnpm-lock.yaml index 31affb09c..0ef60c43f 100644 --- a/apps/memos-local-plugin/pnpm-lock.yaml +++ b/apps/memos-local-plugin/pnpm-lock.yaml @@ -24,7 +24,7 @@ importers: specifier: ^10.29.1 version: 10.29.1 tsx: - specifier: ^4.21.0 + specifier: 4.21.0 version: 4.21.0 uuid: specifier: ^10.0.0 diff --git a/apps/memos-local-plugin/scripts/check-dsh-compatibility.mjs b/apps/memos-local-plugin/scripts/check-dsh-compatibility.mjs index 34bfd00d1..4079f9470 100644 --- a/apps/memos-local-plugin/scripts/check-dsh-compatibility.mjs +++ b/apps/memos-local-plugin/scripts/check-dsh-compatibility.mjs @@ -3,15 +3,25 @@ import { tmpdir } from "node:os"; import { dirname, join, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { spawnSync } from "node:child_process"; +import { satisfies } from "semver"; // Install each real host API in isolation; never rewrite the checkout's dependencies // or use a customer's DSH profile, credentials, or session data. const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); const manifest = JSON.parse(await readFile(join(root, "package.json"), "utf8")); +// Keep newer host fixtures on their matching codec and an exact Cordis build. +const hostOverrides = { + "0.2.2-rc.1": { cordis: "4.1.0" }, + "0.2.2-rc.2": { cordis: "4.1.0" }, + "0.2.2-rc.3": { cordis: "4.1.0" }, + "0.2.2-rc.4": { cordis: "4.1.0" }, + "0.2.2-rc.5": { cordis: "4.1.0" }, +}; const versions = process.argv.slice(2); if (!versions.length) versions.push( "0.1.0-rc.6", "0.1.7-rc.2", "0.2.0-rc.2", "0.2.1-rc.2", "0.2.1-rc.3", + "0.2.2-rc.1", "0.2.2-rc.2", "0.2.2-rc.3", "0.2.2-rc.4", "0.2.2-rc.5", ); if (versions.some((version) => !/^\d+\.\d+\.\d+(?:-rc\.\d+)?$/.test(version))) { throw new Error("Expected explicit DSH versions, e.g. 0.2.1-rc.3"); @@ -26,15 +36,25 @@ function run(command, args, cwd) { } for (const version of versions) { + const override = hostOverrides[version]; const fixture = join(matrix, version); await mkdir(fixture); const devDependencies = Object.fromEntries( Object.entries(manifest.devDependencies) .filter(([name]) => name.startsWith("@deepseek-ai/")) .map(([name, value]) => [name, - name.startsWith("@deepseek-ai/dsh-") && name !== "@deepseek-ai/dsh-session-format-v3-to-v4" + name.startsWith("@deepseek-ai/dsh-") && + (name !== "@deepseek-ai/dsh-session-format-v3-to-v4" || override) ? version : value]), ); + if (override) { + devDependencies["@deepseek-ai/cordis"] = override.cordis; + } + const cordisVersion = devDependencies["@deepseek-ai/cordis"]; + const pluginCordis = manifest.peerDependencies["@deepseek-ai/cordis"]; + if (override && !satisfies(cordisVersion, pluginCordis)) { + throw new Error(`Cordis ${cordisVersion} does not satisfy plugin peer ${pluginCordis}`); + } // Early DSH previews used caret peers. Letting npm choose their latest // prerelease mixes rc.6 and rc.8, so pin the entire host peer closure. const inspected = new Set(); @@ -49,6 +69,12 @@ for (const version of versions) { })); const next = new Set(); for (const pkg of metadata) { + const hostCordis = pkg.peerDependencies?.["@deepseek-ai/cordis"]; + if (override && hostCordis && !satisfies(cordisVersion, hostCordis)) { + throw new Error( + `Cordis ${cordisVersion} does not satisfy ${pkg.name}@${version} peer ${hostCordis}`, + ); + } for (const name of Object.keys({ ...pkg.dependencies, ...pkg.peerDependencies })) { if (!name.startsWith("@deepseek-ai/dsh-") || name === "@deepseek-ai/dsh-session-format-v3-to-v4") continue; devDependencies[name] = version; diff --git a/apps/memos-local-plugin/tests/unit/adapters/deepseek-harness-package.test.ts b/apps/memos-local-plugin/tests/unit/adapters/deepseek-harness-package.test.ts index dd1f08dd6..c9d24ae8a 100644 --- a/apps/memos-local-plugin/tests/unit/adapters/deepseek-harness-package.test.ts +++ b/apps/memos-local-plugin/tests/unit/adapters/deepseek-harness-package.test.ts @@ -12,7 +12,7 @@ const { satisfies } = createRequire(import.meta.url)("semver") as { const hostServices = ["agent", "llm", "session", "system-prompt", "timeout", "tools"]; describe("DeepSeek Harness bundle package", () => { - it.each(["0.1.0-rc.6", "0.1.7-rc.2", "0.2.0-rc.2", "0.2.1-rc.2", "0.2.1-rc.3"])( + it.each(["0.1.0-rc.6", "0.1.7-rc.2", "0.2.0-rc.2", "0.2.1-rc.2", "0.2.1-rc.3", "0.2.2-rc.1", "0.2.2-rc.2", "0.2.2-rc.3", "0.2.2-rc.4", "0.2.2-rc.5"])( "admits the supported host %s without a version exemption", async (version) => { const pkg = JSON.parse(await readFile(resolve(root, "package.json"), "utf8")); @@ -24,7 +24,7 @@ describe("DeepSeek Harness bundle package", () => { }, ); - it.each(["0.1.0-rc.5", "0.2.2-rc.1", "0.2.2", "0.3.0-rc.1", "0.3.0"])( + it.each(["0.1.0-rc.5", "0.2.2-rc.6", "0.2.2", "0.3.0-rc.1", "0.3.0"])( "does not admit the unvalidated host %s", async (version) => { const pkg = JSON.parse(await readFile(resolve(root, "package.json"), "utf8")); diff --git a/apps/memos-local-plugin/tests/unit/install/production-peer-deps.test.ts b/apps/memos-local-plugin/tests/unit/install/production-peer-deps.test.ts index efee481b0..84216b8b9 100644 --- a/apps/memos-local-plugin/tests/unit/install/production-peer-deps.test.ts +++ b/apps/memos-local-plugin/tests/unit/install/production-peer-deps.test.ts @@ -6,6 +6,13 @@ import { describe, expect, it } from "vitest"; const repoRoot = path.resolve(__dirname, "../../.."); describe("production dependency staging", () => { + it("pins the packaged runtime transpiler to its validated lock version", () => { + const pkg = JSON.parse(readFileSync(path.join(repoRoot, "package.json"), "utf8")); + const lock = JSON.parse(readFileSync(path.join(repoRoot, "package-lock.json"), "utf8")); + // DSH resolves a published tarball with pnpm, which does not use its npm lock. + expect(pkg.dependencies.tsx).toBe(lock.packages["node_modules/tsx"].version); + }); + it("ignores development-only peer conflicts in the Unix installer", () => { const source = readFileSync(path.join(repoRoot, "install.sh"), "utf8"); const installCommand = source diff --git a/apps/memos-local-plugin/tests/unit/scripts/check-dsh-compatibility.test.ts b/apps/memos-local-plugin/tests/unit/scripts/check-dsh-compatibility.test.ts new file mode 100644 index 000000000..0a9bdb4ca --- /dev/null +++ b/apps/memos-local-plugin/tests/unit/scripts/check-dsh-compatibility.test.ts @@ -0,0 +1,87 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; + +const manifest = { + devDependencies: { + "@deepseek-ai/cordis": "~4.0.5", + "@deepseek-ai/dsh-agent": "0.2.1-rc.3", + "@deepseek-ai/dsh-session-format-v3-to-v4": "0.2.1-rc.3", + }, + peerDependencies: { "@deepseek-ai/cordis": "^4.0.1" }, +}; +let writtenManifest: { devDependencies: Record } | undefined; +let hostCordis: string | undefined; +const originalArgv = process.argv; + +beforeEach(() => { + vi.resetModules(); + writtenManifest = undefined; + hostCordis = "~4.1.0"; + manifest.peerDependencies["@deepseek-ai/cordis"] = "^4.0.1"; + process.argv = [process.execPath, "check-dsh-compatibility.mjs", "0.2.2-rc.5"]; + vi.doMock("node:fs/promises", () => ({ + readFile: vi.fn(async () => JSON.stringify(manifest)), + mkdtemp: vi.fn(async () => "/tmp/memos-matrix-test"), + mkdir: vi.fn(async () => {}), + readdir: vi.fn(async () => []), + symlink: vi.fn(async () => {}), + cp: vi.fn(async () => {}), + writeFile: vi.fn(async (_path: string, data: string) => { + writtenManifest = JSON.parse(data); + }), + })); + vi.doMock("node:child_process", () => ({ + spawnSync: vi.fn(() => ({ status: 0 })), + })); + vi.stubGlobal("fetch", vi.fn(async (url: string) => ({ + ok: true, + json: async () => ({ + name: decodeURIComponent(new URL(url).pathname.slice(1)).replace(/\/0\.2\.2-rc\.\d+$/, ""), + peerDependencies: hostCordis ? { "@deepseek-ai/cordis": hostCordis } : undefined, + }), + }))); + vi.spyOn(console, "log").mockImplementation(() => {}); +}); + +afterEach(() => { + process.argv = originalArgv; + vi.doUnmock("node:fs/promises"); + vi.doUnmock("node:child_process"); + vi.unstubAllGlobals(); + vi.restoreAllMocks(); + vi.resetModules(); +}); + +describe("DSH compatibility fixture dependency selection", () => { + it.each(["0.2.2-rc.1", "0.2.2-rc.2", "0.2.2-rc.3", "0.2.2-rc.4", "0.2.2-rc.5"])( + "pins %s Cordis and the matching session codec", + async (version) => { + process.argv[2] = version; + await import("../../../scripts/check-dsh-compatibility.mjs"); + expect(writtenManifest?.devDependencies).toMatchObject({ + "@deepseek-ai/cordis": "4.1.0", + "@deepseek-ai/dsh-agent": version, + "@deepseek-ai/dsh-session-format-v3-to-v4": version, + }); + }, + ); + + it("handles metadata without optional peer dependencies", async () => { + hostCordis = undefined; + await import("../../../scripts/check-dsh-compatibility.mjs"); + expect(writtenManifest?.devDependencies["@deepseek-ai/cordis"]).toBe("4.1.0"); + }); + + it("rejects a Cordis version outside the host service peer range", async () => { + hostCordis = "^5.0.0"; + await expect(import("../../../scripts/check-dsh-compatibility.mjs")) + .rejects.toThrow("does not satisfy @deepseek-ai/dsh-agent@0.2.2-rc.5 peer ^5.0.0"); + expect(writtenManifest).toBeUndefined(); + }); + + it("rejects a Cordis version outside the plugin peer range", async () => { + manifest.peerDependencies["@deepseek-ai/cordis"] = "^5.0.0"; + await expect(import("../../../scripts/check-dsh-compatibility.mjs")) + .rejects.toThrow("does not satisfy plugin peer ^5.0.0"); + expect(writtenManifest).toBeUndefined(); + }); +});