github-router 0.3.32 → 0.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-bridge/index.js +26 -11
- package/dist/browser-ext/background.js +715 -0
- package/dist/browser-ext/manifest.json +24 -0
- package/dist/main.js +47 -9
- package/dist/main.js.map +1 -1
- package/package.json +2 -2
|
@@ -3613,6 +3613,32 @@ var import_subprotocol = /* @__PURE__ */ __toESM(require_subprotocol(), 1);
|
|
|
3613
3613
|
var import_websocket = /* @__PURE__ */ __toESM(require_websocket(), 1);
|
|
3614
3614
|
var import_websocket_server = /* @__PURE__ */ __toESM(require_websocket_server(), 1);
|
|
3615
3615
|
|
|
3616
|
+
//#endregion
|
|
3617
|
+
//#region src/lib/browser-mcp/bridge-paths.ts
|
|
3618
|
+
/**
|
|
3619
|
+
* Filesystem path where the browser bridge writes its discovery file
|
|
3620
|
+
* (`{pid, port, token, startedAt}`) and where the install-check reads
|
|
3621
|
+
* it from. Used by `src/browser-bridge/index.ts` (writer) AND by
|
|
3622
|
+
* `src/lib/browser-mcp/install-check.ts` (reader).
|
|
3623
|
+
*
|
|
3624
|
+
* MUST be a single computation. Historically the bridge special-cased
|
|
3625
|
+
* win32 to `%LOCALAPPDATA%\github-router` while the install-check used
|
|
3626
|
+
* `~/.local/share/github-router` (the canonical `PATHS.APP_DIR` from
|
|
3627
|
+
* `src/lib/paths.ts`, which has no win32 branch). On Windows the
|
|
3628
|
+
* writer and reader never met, so the install-check returned
|
|
3629
|
+
* `bridge_not_running` even with a healthy bridge. Centralized here so
|
|
3630
|
+
* the regression test in `tests/browser-bridge-discovery-path.test.ts`
|
|
3631
|
+
* can pin the round-trip.
|
|
3632
|
+
*
|
|
3633
|
+
* Mirrors `PATHS.APP_DIR` from `src/lib/paths.ts` (XDG-style on every
|
|
3634
|
+
* platform). The bridge bundle pulls this file in via tsdown's
|
|
3635
|
+
* relative-import bundling; no runtime dependency on `src/lib/paths.ts`
|
|
3636
|
+
* is introduced.
|
|
3637
|
+
*/
|
|
3638
|
+
function discoveryPath() {
|
|
3639
|
+
return path.join(homedir(), ".local", "share", "github-router", "browser-mcp", "bridge.json");
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3616
3642
|
//#endregion
|
|
3617
3643
|
//#region src/browser-bridge/index.ts
|
|
3618
3644
|
try {
|
|
@@ -3620,17 +3646,6 @@ try {
|
|
|
3620
3646
|
} catch {}
|
|
3621
3647
|
const HEARTBEAT_MS = 5e3;
|
|
3622
3648
|
const HEARTBEAT_MISS_LIMIT = 3;
|
|
3623
|
-
function appDir() {
|
|
3624
|
-
if (platform() === "win32") {
|
|
3625
|
-
const local = process$1.env.LOCALAPPDATA;
|
|
3626
|
-
if (local) return path.join(local, "github-router");
|
|
3627
|
-
return path.join(homedir(), "AppData", "Local", "github-router");
|
|
3628
|
-
}
|
|
3629
|
-
return path.join(homedir(), ".local", "share", "github-router");
|
|
3630
|
-
}
|
|
3631
|
-
function discoveryPath() {
|
|
3632
|
-
return path.join(appDir(), "browser-mcp", "bridge.json");
|
|
3633
|
-
}
|
|
3634
3649
|
function writeDiscoveryFile(payload) {
|
|
3635
3650
|
const file = discoveryPath();
|
|
3636
3651
|
mkdirSync(path.dirname(file), { recursive: true });
|