Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
".": "./dist/agent/dsh-native.js",
"./server": "./dist/agent/opencode-native.js",
"./dsh": "./dist/agent/dsh-native.js",
"./package.json": "./package.json",
"./dsh/package.json": "./package.json",
"./client": "./dist/agent/dsh-native-client.js"
},
Expand Down
2 changes: 1 addition & 1 deletion src/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2989,7 +2989,7 @@ export function writeDshClientShimFiles(shimDir: string, hostBundle: string, cli
name: "billion-context",
version,
type: "module",
exports: { ".": "./index.js", "./dsh": "./index.js", "./dsh/package.json": "./package.json", "./client": "./bundle.js" },
exports: { ".": "./index.js", "./dsh": "./index.js", "./package.json": "./package.json", "./dsh/package.json": "./package.json", "./client": "./bundle.js" },
dsh: { client: { platform: "web" } },
})}\n`,
);
Expand Down
12 changes: 12 additions & 0 deletions tests/dsh-settings-ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,18 @@ test("#2125: the manifest declares no dsh.client.inject (pre-0.2 dsh compat)", (
assert.equal(pkg.dsh?.client?.inject ?? null, null, "dsh.client.inject would break pre-0.2 dsh clients");
});

test("#3043: the published manifest exposes ./package.json so dsh's client scanner can locate the package root", () => {
const pkg = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8")) as {
exports?: Record<string, unknown>;
};
// Node's `exports` map is closed once declared — an unlisted subpath throws
// ERR_PACKAGE_PATH_NOT_EXPORTED. dsh's client scanner resolves
// "<pkg>/package.json" to find the package root before reading dsh.client;
// the self-mapping below looks redundant but is load-bearing: drop it and
// the scanner swallows the throw, so the browser half never registers.
assert.equal(pkg.exports?.["./package.json"], "./package.json");
});

test("#2448: embed face adapts the data tables to a narrow host panel (CSS pins)", () => {
// The embed iframe lives inside a dsh settings column (400-760px), not a
// browser tab — the standalone-page table floors (940px/520px + fixed
Expand Down
11 changes: 10 additions & 1 deletion tests/launcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type SymlinkKind = "dir" | "file" | "junction";
import net from "node:net";
import os from "node:os";
import path from "node:path";
import { createRequire } from "node:module";
import {
claimStartingMarker,
readStartingMarker,
Expand Down Expand Up @@ -3722,7 +3723,7 @@ test("writeDshClientShimFiles + dshPluginEntry: resolvable shim yields the bare
assert.equal(writeDshClientShimFiles(shimDir, hostBundle, clientBundle, "0.1.169"), true);
const shimPkg = JSON.parse(fs.readFileSync(path.join(shimDir, "package.json"), "utf8"));
assert.equal(shimPkg.name, "billion-context");
assert.deepEqual(shimPkg.exports, { ".": "./index.js", "./dsh": "./index.js", "./dsh/package.json": "./package.json", "./client": "./bundle.js" });
assert.deepEqual(shimPkg.exports, { ".": "./index.js", "./dsh": "./index.js", "./package.json": "./package.json", "./dsh/package.json": "./package.json", "./client": "./bundle.js" });
assert.equal(shimPkg.dsh.client.platform, "web");
// The bundles are SYMLINKS into bili's live dist — an auto-update that
// moves dist self-heals on the next launch without rewriting the shim.
Expand All @@ -3733,6 +3734,14 @@ test("writeDshClientShimFiles + dshPluginEntry: resolvable shim yields the bare
// lands on the host module itself ⇒ the bare entry.
assert.equal(dshPluginEntry(home), "billion-context");

// #3043: dsh's client scanner locates the package root via
// require.resolve("billion-context/package.json") before reading dsh.client.
// Node's closed `exports` map throws ERR_PACKAGE_PATH_NOT_EXPORTED for any
// unlisted subpath — omit "./package.json" here (as in the published pkg)
// and the scanner swallows the throw, so the browser half never registers.
const shimRequire = createRequire(path.join(home, "probe.cjs"));
assert.equal(shimRequire.resolve("billion-context/package.json"), path.join(shimDir, "package.json"));

// A shim whose root "." export points elsewhere (e.g. a real install
// whose root is the CLI entry, not the dsh host half) must NOT claim
// the bare lane: importing the root would boot the CLI inside dsh.
Expand Down
Loading