DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

shuqingyang666 /

shuqingyang666/dsh-github-adapted

Verified

Adapted build of @perrylink/dsh-github 0.7.15 for DeepSeek Harness 0.2.0-rc.2 — classic-script client registration (upstream #12/#13, fix PR #14)

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@6539ff22

dsh-github DSH 0.2 适配版

@perrylink/dsh-github 0.7.15 在 DeepSeek Harness 0.2.0-rc.2 上的适配构建。 上游仓库:PerryLink/dsh-github(Apache-2.0)。

English

问题

上游 0.7.15 发布的 lib/client.js 是 tsc 编译的 ESM 输出(带顶层 import)。 DSH 0.2.0-rc.2 的 client-modules 系统把插件 client 条目作为经典脚本执行 (合并 combo URL,经典 <script> 语义),顶层 import 直接 SyntaxError, 导致整个 application boot batch 解析失败:

Error: web boot: 1 entry did not activate
@perrylink/dsh-github: import failed (see console for the import error)

Uncaught SyntaxError: Cannot use import statement outside a module

桌面端连续崩溃两次后,宿主会自动把插件从 bundles 摘掉才恢复启动。

上游对应 issue:#12、 #13; 修复 PR:#14(撰写本文时尚未合并发布)。

适配原理

从宿主 0.2.0-rc.2 代码确认的 client 契约:

  • client.js 是经典脚本,执行时调用 window.__ModuleLoader__.load({ id, factory }) 自注册;
  • factory(require) 返回 module.exports,require 可解析宿主 seed 模块表 (react、react-dom、@deepseek-ai/dsh-client-ui-primitives、 @deepseek-ai/dsh-client-ui-slots、@deepseek-ai/dsh-client-ui-dockkit 等);
  • 启动图(boot graph)row 的 inject/external 来自插件 package.json 的 dsh.client 声明,无需改动。

因此只需把 ESM client 用 esbuild 打成 CJS(external 上述两个依赖), 再包一层注册壳(与宿主里其他经典 client 的形态一致):

(() => {
  try {
    window.__ModuleLoader__.load({
      id: "@perrylink/dsh-github",
      factory: (require) => {
        var module = { exports: {} };
        var exports = module.exports;
        /* esbuild CJS bundle */
        return module.exports;
      }
    });
  } catch (err) {
    console.warn("[dsh-github] client bootstrap failed:", err);
  }
})();

插件其余部分(cordis 服务半、15 个工具、斜杠命令)在 0.2.0-rc.2 上可直接工作,无需改动。

安装

本仓库根目录本身就是一个可安装的插件包(dsh-github-adapted),推荐 git 通道直装:

dsh plugin --profile desktop add github:shuqingyang666/dsh-github-adapted
# 或 web profile
dsh plugin --profile web add github:shuqingyang666/dsh-github-adapted

也可以用仓库内的 tarball 产物:

dsh plugin --profile desktop add ./dist/dsh-github-adapted-0.7.15-dsh2.tgz

重启宿主(或刷新页面)后生效。

注意:适配包名是 dsh-github-adapted(cordis 服务 id 仍是 dsh-github,Plugins 页卡片不变)。 与官方 @perrylink/dsh-github 二选一安装,避免同一服务注册两次。

从源码构建

依赖:Python 3.8+、pnpm(pnpm dlx esbuild)、node(验证脚本)。

# 1. 取上游 npm 包
pnpm pack @perrylink/dsh-github@0.7.15 --pack-destination .

# 2. 构建(解包 → esbuild CJS → 包注册壳 → 组装到仓库根目录 lib/,
#    同步改写 package.json / cordis.patch.yml 的包名绑定,并重打包 dist/)
python scripts/build.py perrylink-dsh-github-0.7.15.tgz

# 3. 验证
node scripts/verify-client.mjs lib/client.js

scripts/verify-served.py 用于对运行中的 profile 做实机验证(拉取宿主实际下发的 client 脚本并跑同样的契约测试):

dsh --profile web --no-open --port 34199        # 另一个终端
export DSH_WEB_BASE=http://127.0.0.1:34199
export DSH_WEB_TOKEN=<启动输出里的 ?token=... 值>
python scripts/verify-served.py

验证覆盖

  • node --check:经典脚本解析(ESM 顶层 import 会在此失败)
  • VM 契约测试(verify-client.mjs):模拟宿主的 __ModuleLoader__ 队列外观, 断言注册 id、factory(require) 返回值形态(cordis 插件的 inject + apply)
  • 实机验证:0.2.0-rc.2 web profile 启动无崩溃、插件进入启动编排图、 宿主下发的脚本字节与适配构建一致且通过同样的契约测试

上游发布后回归官方版

PR #14 合并并发布后,直接覆盖安装官方包即可:

dsh plugin --profile desktop add @perrylink/dsh-github

English

Upstream 0.7.15 ships lib/client.js as tsc ESM output (top-level import). DeepSeek Harness 0.2.0-rc.2 executes plugin client entries as classic scripts, so the import statement is a SyntaxError that fails the whole application boot batch ("web boot: 1 entry did not activate").

This repo rebuilds the client as a classic script that self-registers through window.__ModuleLoader__.load({ id, factory }) — the form the 0.2.0 client-modules system consumes — and rewrites the upstream package with only that file changed (dsh-github-adapted 0.7.15-dsh2). The repo root IS the installable plugin. Everything else (cordis host half, tools, commands) works on 0.2.0-rc.2 unchanged.

Install: dsh plugin --profile desktop add github:shuqingyang666/dsh-github-adapted. Build: see the Chinese section above (scripts/build.py).

License

Apache-2.0,基于 PerryLink/dsh-github 0.7.15 修改,仅替换 lib/client.js 并提升版本号,详见 NOTICE。

—/ 5

No ratings yet

Verified DSH bundle

Commit 6539ff22da84

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout