Repository navigation
fix: expose ./package.json in exports so dsh client scanner loads the browser half (#3043) - #3052
Merged
Merged
Conversation
…he browser half (#3043) Node's `exports` map is closed once declared, so require.resolve( "billion-context/package.json") threw ERR_PACKAGE_PATH_NOT_EXPORTED. dsh's client scanner uses that resolve to locate the package root before reading the dsh.client declaration; its catch swallows the throw, the entry drops out of the client module table, and the browser half (settings.section) never registers — the settings page vanishes while the host half keeps working. Add the "./package.json" self-mapping at BOTH writer locations of the same mechanism (the published manifest and the `bili dsh` launcher shim) and pin both with regression tests that reproduce the scanner's root-locate resolve. Fixes #3043
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3452-pr.3052.58c716fThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3052.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Owner
Author
(ai: vllm-qwen/qwen3.8-27b) PR #3052 审核完成,结论:可合并。以下是独立审核过程(不是复读 issue): 审核过程
结构化八问
行为变更披露(旧值→新值): 收工判定:满足 auto-merge gate 条件(单模块 fix、有回归测试、rebased head 绿、不碰 wire/配置/持久化/kernel、commit 带 Fixes #3043),可合并,请人工执行合并:#3052 |
Contributor
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.385-master.1851411 # this exact build
npm install -g billion-context@master # always the newest merged build
|
ranxianglei
pushed a commit
that referenced
this pull request
Oct 13, 2026
… hosts (#3077) The functional fix (exports ['./package.json']) already shipped via #3052 (commit 1851411), which also added a static manifest check and a shim probe. This PR is reduced to its one non-redundant piece: a regression test driving Node's real exports resolution of <pkg>/package.json through a node_modules symlink of the published package root - the exact path DSH Desktop's createRequire fallback takes without --expose-internals. Without the export this throws ERR_PACKAGE_PATH_NOT_EXPORTED and the client half is dropped silently.
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.
背景 / What
DSH(dsh-market 安装)的 Host 半体(压缩)工作正常,但 Harness Web GUI 的设置页完全不出现 bili 这一项。根因:
package.json的exports字段缺少./package.json映射。Node 的
exports一旦声明即为封闭——未列出的子路径一律不可访问。于是 DSH 客户端扫描器用来定位包根的require.resolve("billion-context/package.json")抛出ERR_PACKAGE_PATH_NOT_EXPORTED;该异常被上层catch { return }静默吞掉 → 客户端模块表里没有这条目 → 浏览器半体(settings.section)从不注册。已有的./dsh/package.json帮不上忙(扫描器问的是/package.json,不是/dsh/package.json)。修复 / How
在同一机制的两个写入点都补上
"./package.json": "./package.json"自映射:package.json(dsh-market 安装路径,即本 issue 报告的场景);src/launcher.ts的bili dshlauncher shim(writeDshClientShimFiles)——它写出的<dshHome>/node_modules/billion-context/package.json由同一个扫描器读取,存在完全相同的缺陷。并加两个回归测试钉住这两处:
tests/dsh-settings-ui.test.ts:断言发布清单含./package.json;tests/launcher.test.ts:在既有 shim 测试里用createRequire(home/probe.cjs).resolve("billion-context/package.json")端到端复现扫描器的包根定位(修复前该 resolve 会抛错)。影响面 / Behavior change
纯增量:只是让一个此前不可访问的子路径变得可解析,未改动任何既有可工作路径、wire/消息形状、配置面或持久化格式。唯一行为变化是
require("billion-context/package.json")从「抛ERR_PACKAGE_PATH_NOT_EXPORTED」变为「返回包根 path」——这正是期望结果。验证 / Verification
本地(已 rebase 到当前 master):
tsc --noEmit通过;定向测试tests/dsh-settings-ui.test.ts+tests/launcher.test.ts= 306 pass / 0 fail(1 个与本改动无关的环境性 skip)。全量回归与 build 交给 CI。Closes #3043