Repository navigation
Conversation
Electron's asar-backed fs answers stat(path, { bigint: true }) with a
number-mode Stats object for paths inside app.asar. The cordis preset
declares its skill root at app.asar/node_modules/.../dsh-agent-preset/skills,
so dsh-fs-local's probe()/probeNoFollow() mixed a bigint mask with a number
and threw "Cannot mix BigInt and other types". The skill registry then
dropped the whole filesystem provider and every local skill disappeared
(dataelement#696).
Patch both probe paths to normalize the mode with BigInt() before masking.
Real Node stats are unchanged; an asar number-mode stat no longer throws.
The official DSH repository does not accept external pull requests right
now, so this stays a desktop compatibility patch. Remove it once the
bundled Harness version fixes probe()/probeNoFollow().
|
补充验证:根因已定位到 Electron 版本差异(见 issue #696 最新评论)——本补丁是 Electron 43 下 |
rahul05ranjan
left a comment
There was a problem hiding this comment.
Verified the failure mode: Electron's asar layer returns a number-mode Stats for in-archive paths, and info.mode & 511n throws Cannot mix BigInt and other types, so the probe — and with it the whole filesystem skill provider — silently disappeared. Wrapping in BigInt(...) at both probe sites is the minimal correct fix.
The tests are doing double duty the right way: asserting the patched shape is still present in node_modules (so a lost postinstall or a Harness upgrade that reverts the patch fails loudly) and asserting the shipped patch file matches the pinned 0.2.0-rc.2 version. The extracted-expression test documenting that both stat shapes pass once normalized is the right level of paranoia.
Two thoughts:
- The patch is pinned by version in its filename; when the Harness moves past rc.2 (or the package lands the fix upstream) patch-apply will fail the install. The second test catches it after the fact, but it's worth a heads-up wherever dependency bumps get reviewed so whoever touches
dsh-fs-localfirst checks whether the patch is still needed. BigInt(mode)on a number is only safe for integral values; stat modes are always integral, so no concern in practice.
|
Thanks. Good catch on the pin, and you're right that it's worth writing down. I'd keep this patch on our side rather than upstream's: Checked it hasn't gone stale either: 0.2.1-rc.1 and 0.2.1-rc.2 ship the same On naming: the whole bundled harness is pinned to 0.2.0-rc.2 here (220 packages, no |
Problem
Fixes the empty skill catalog on the packaged desktop (#696).
Electron's asar-backed
fsanswersstat(path, { bigint: true })with a number-modeStatsfor paths insideapp.asar. Thecordispreset declares its skill root atapp.asar/node_modules/@deepseek-ai/dsh-agent-preset/skills, so@deepseek-ai/dsh-fs-localprobes it throughctx.fsand computes:That throws inside
listSkillRootEntriesFromFileSystem; the skill registry drops the wholefilesystemprovider, and every local skill (including$DSH_HOME/skills) disappears.Change
patches/@deepseek-ai+dsh-fs-local+0.2.0-rc.2.patch— normalize the mode before masking in bothprobe()andprobeNoFollow():Number(BigInt(info.mode) & 0o777n). A real Node stat stays a bigint; an asar number-mode stat no longer throws.test/fs-local-asar-stats-patch.test.ts— regression test: assertspostinstallapplied the patch (noinfo.mode & 511nleft, exactly two normalized sites), the patch file still targets the pinned version, and the normalized expression accepts bothnumberandbigintmodes.Patch bookkeeping (per
patches/AGENTS.md)@deepseek-ai/dsh-fs-local@0.2.0-rc.2(pinned inpackage.json)deepseek-ai/deepseek-harnessdoes not accept external pull requests at the moment, so this stays a desktop compatibility patchtest/fs-local-asar-stats-patch.test.ts(fails ifpostinstalldrops the patch, or a Harness upgrade changes the probe shape without re-validation)dsh-fs-localships aprobe()/probeNoFollow()that handles number-mode stats (check the publishedlib/index.jsafter a Harness upgrade)Verification
patch-packageagainst a pristine@deepseek-ai/dsh-fs-local@0.2.0-rc.2install;npx patch-packageapplies cleanly on a fresh install.lib/index.jscontains twoNumber(BigInt(info.mode) & 511n)sites and zeroNumber(info.mode & 511n)sites.permissionBits(0o100644)andpermissionBits(0o100644n)→0o644.npm ci+postinstallre-applies it.Known limitation
versionOf()still composesmtimeNs/ctimeNsasundefinedfor asar paths. The preset skill directory is read-only, so that only weakens the version token, not behavior; out of scope for this fix.