Repository navigation
fix: declare dsh 0.2.x compatibility so 0.2.1 installs and boots - #2
Open
helloHub1212 wants to merge 1 commit into
Open
helloHub1212 wants to merge 1 commit into
helloHub1212 wants to merge 1 commit into
Conversation
- host peers gain an explicit >=0.2.0-0 <0.3.0-0 branch; engines.dsh declared - import Context from @deepseek-ai/cordis; tests ported to execute()/result() - build/dev against the published 0.2.1 packages; compatibility docs updated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description(描述)
@deeptrial/dsh-bash-rtk@0.1.1无法安装在dsh 0.2.1-alpha.1上:harness 的安装门禁把它判为不兼容并直接拒绝,插件根本没有机会加载。
根因在「声明的兼容性元数据」,而不是运行时的执行接缝:
@deepseek-ai/dsh-app-boot的evaluatePluginCompatibility()会读取插件的peerDependencies,对其中每个
@deepseek-ai/dsh/@deepseek-ai/dsh-*条目,用当前正在运行的 dsh 版本执行semver.satisfies(runtime, range, { includePrerelease: true })校验。本插件的三个 peer 范围上限都停在<0.2.0-0,因此没有任何一个能满足0.2.1-alpha.1。dshmarket)采用同样的「预发布感知」判定,并且读的是顶层engines.dsh(或dsh.engines.dsh)加上同一批宿主 peer。本插件的package.json里这两个位置都没有声明(范围只写在非标准的
dsh.plugin.json中,而dsh 0.2.1不读取该文件),所以市场侧同样报「不兼容」。值得说明的是:0.2 并没有改动执行接缝——插件依然只覆写
resolve(),0.2 的ShellExecSpec只是多了一个
sandboxPolicy字段,而它是被原样展开透传的。Reproduction(复现步骤)
dsh 0.2.1-alpha.1(例如npx @deepseek-ai/dsh@0.2.1-alpha.1 --profile web)。dsh plugin --profile web add @deeptrial/dsh-bash-rtk@0.1.1(或通过插件市场安装)。Expected Behavior(期望行为)
插件安装成功,它的 bundle patch 正常生效;启用
bash-rtk后注册为ctx.shell。Actual Behavior(实际行为)
Environment(环境)
这个 PR 改了什么
一共三个部分;0001 + 0002 是真正的修复,0003 是构建/开发工具链的改造建议,去掉它不影响修复效果
(见文末说明)。按补丁方式提交时它们就是三个提交;如果用网页上传文件,则这三部分会落在同一个提交里。
0001 —— 声明 dsh 0.2.x 支持
0.2.x分支:… || >=0.2.0-0 <0.3.0-0(原有的
0.0.1/0.1.0/0.1.1分支一个字都没动)。package.json里新增engines.dsh: ">=0.1.0-rc.6 <0.2.0 || >=0.2.0-0 <0.3.0-0"—— 这是发现类工具真正读取的位置。
dsh.plugin.json里镜像同一范围;插件版本升到0.1.2。0002 —— 改用
@deepseek-ai/cordis并适配 0.2 的 shell 接口src/index.ts:import { Context } from 'cordis'→'@deepseek-ai/cordis'(纯类型导入,构建后会被擦除;产出的
lib/依然只 importdsh-bash-local/dsh-bash-sandbox)。tsdown.config.ts的neverBundle同步修改。tests/*:run()→execute()+result();SandboxProvider.confine()改为 async;为SandboxPolicyService注册SessionProjectionRegistry;新增一条覆盖execute()/result()契约的端到端测试。
0003 —— 构建与文档改为面向已发布的 0.2.1 包
devDependencies:把link:../deepseek-harness/...换成已发布的0.2.1-alpha.1包(外加
@deepseek-ai/cordis、schemastery、dsh-session-projection),仓库可以独立构建;同时重新生成
pnpm-lock.yaml。build:lib:host」两步,保留pnpm install --ignore-scripts+pnpm run check。engines.dsh)与开发章节。Verification(验证记录)
pnpm run check:tsc无报错、30/30 测试通过、tsdown构建成功。evaluatePluginCompatibility()(来自@deepseek-ai/dsh-app-boot),在运行时0.2.1-alpha.1下校验修复后的 manifest → 无任何不兼容 peer。用同一函数校验 0.1.1 的 manifest,则逐字复现上面的报错。
dshmarket的deriveHostCompatibility()对修复后的 manifest 返回compatible(修复前是
incompatible)。DSH_HOMEprofile(
dsh plugin --profile rtktest add …,安装被接受、无任何拒绝),关闭bash-sandbox、启用bash-rtk后启动dsh 0.2.1-alpha.1。带探针的构建确认:模块成功加载、@deepseek-ai/dsh-bash-local解析到 harness 安装目录(不存在重复实例)、
RtkSandboxBashExecutor被构造并注册为ctx.shell。dsh 0.2.1-alpha.1+rtk 0.50.0):修复后dsh plugin --profile web add能接受插件(0.1.1 会被拒绝);在 profile patch 中启用bash-rtk后,再通过 bash 工具执行命令可观察到:
git status的输出与rtk git status完全一致,而command git status与git status | cat仍走原生 git 路径(白名单守卫与复杂命令守卫都正常),git rev-parse HEAD与未包装时结果一致,失败命令仍正确上报[exit code: 128]。dsh 0.1.1-rc.2运行环境(
@deepseek-ai/cordis@4.0.1+0.1.1-rc.2的 shell 包)上验证:两个执行器都能注册、都能包装符合条件的命令(
rtk git status)、复杂命令照旧透传、通过旧版run()接口执行成功、沙箱事实正常上报。peer 范围只是新增分支,因此不存在「原本兼容的版本反而变得不兼容」的情况。
Additional Context(补充说明)
>=0.0.1-rc.1 <0.3.0会静默排除所有0.1.x/0.2.x预发布版本。而dsh的门禁与市场都用includePrerelease: true求值,这正是上面那些显式<0.x.0-0上界能够生效的原因。link:../deepseek-harness/...的开发流程与 CI,可以只回退devDependencies+pnpm-lock.yaml相关改动;保留 0001 + 0002 两部分就足以支持 0.2.1(两种组合我都验证过可以干净地应用到
main上)。