From 2997f495dbb6245b726b76d6451e79edd2e98785 Mon Sep 17 00:00:00 2001 From: drakezhang Date: Fri, 28 Aug 2026 21:28:06 +0800 Subject: [PATCH] fix(dsh-plugin): use the published package name as the Cordis id dsh 0.1.0-rc.8 imports and registers the client bundle by export const name, so a leftover dsh-plugin-browserskill id fails to load the 0.1.1 web UI. Co-authored-by: Cursor --- packages/dsh-plugin-browserskill/README.md | 5 +-- packages/dsh-plugin-browserskill/package.json | 4 +++ packages/dsh-plugin-browserskill/src/index.ts | 2 +- .../tests/plugin-id.test.ts | 32 +++++++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 packages/dsh-plugin-browserskill/tests/plugin-id.test.ts diff --git a/packages/dsh-plugin-browserskill/README.md b/packages/dsh-plugin-browserskill/README.md index 771f4288..d7096d95 100644 --- a/packages/dsh-plugin-browserskill/README.md +++ b/packages/dsh-plugin-browserskill/README.md @@ -198,8 +198,9 @@ pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin build # tsdown -> lib/ ## Publishing The GitHub Actions workflow **Release dsh plugin** publishes this package to npm -as `@wxg-prc-cpg/browser-skill-dsh-plugin`. The Cordis plugin id stays -`dsh-plugin-browserskill`. +as `@wxg-prc-cpg/browser-skill-dsh-plugin`. The Cordis plugin id, client +bundle registration, and `cordis.patch.yml` name are the same specifier so +dsh can import and materialize the plugin without a ModuleLoader id mismatch. Trigger it by pushing a tag that matches `package.json`'s `version`: diff --git a/packages/dsh-plugin-browserskill/package.json b/packages/dsh-plugin-browserskill/package.json index be8a1945..b1ebf92a 100644 --- a/packages/dsh-plugin-browserskill/package.json +++ b/packages/dsh-plugin-browserskill/package.json @@ -50,6 +50,10 @@ "@deepseek-ai/dsh-client-runtime", "@deepseek-ai/dsh-client-ui-tool", "@deepseek-ai/dsh-client-ui-layout" + ], + "external": [ + "@deepseek-ai/dsh-client-ui-attachment", + "@deepseek-ai/dsh-client-ui-primitives" ] } }, diff --git a/packages/dsh-plugin-browserskill/src/index.ts b/packages/dsh-plugin-browserskill/src/index.ts index 721e5724..93a15dae 100644 --- a/packages/dsh-plugin-browserskill/src/index.ts +++ b/packages/dsh-plugin-browserskill/src/index.ts @@ -22,7 +22,7 @@ import { SessionRegistry } from "./sessions"; import { armAgentScopedBskSkill, registerBskSkill } from "./skill"; import { type PluginConfig, registerTools } from "./tools"; -export const name = "dsh-plugin-browserskill"; +export const name = "@wxg-prc-cpg/browser-skill-dsh-plugin"; export const inject = ["tools"]; /** Runtime configuration schema (validated and defaulted by Cordis). */ diff --git a/packages/dsh-plugin-browserskill/tests/plugin-id.test.ts b/packages/dsh-plugin-browserskill/tests/plugin-id.test.ts new file mode 100644 index 00000000..9368093c --- /dev/null +++ b/packages/dsh-plugin-browserskill/tests/plugin-id.test.ts @@ -0,0 +1,32 @@ +// dsh 0.1 keys the client graph and Node import by `export const name`. +// That string must stay identical to the published package name (and therefore +// the client.cjs __ModuleLoader__ id, which tsdown reads from package.json). + +import { readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { describe, expect, it } from "vitest"; +import { name } from "../src/index"; + +const pkg = JSON.parse( + readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "package.json"), "utf8"), +) as { + name: string; + dsh: { client: { external?: string[] } }; +}; + +describe("plugin identity", () => { + it("uses the published package name as the Cordis plugin id", () => { + expect(name).toBe("@wxg-prc-cpg/browser-skill-dsh-plugin"); + expect(name).toBe(pkg.name); + }); + + it("declares client require()s so dsh arrives them before materialize", () => { + expect(pkg.dsh.client.external).toEqual( + expect.arrayContaining([ + "@deepseek-ai/dsh-client-ui-attachment", + "@deepseek-ai/dsh-client-ui-primitives", + ]), + ); + }); +});