Skip to content

An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.

fix(bridge): whether this Bridge may register is read from how its own paths are spelled, not from the browsers' layout being worked out, so a Windows machine working out a Linux or macOS layout still registers

Shahriar928188b52a14
diff --git a/src/daemon/native-host.test.ts b/src/daemon/native-host.test.ts
index bfc69e5..e996747 100644
--- a/src/daemon/native-host.test.ts
+++ b/src/daemon/native-host.test.ts
@@ -199,6 +199,13 @@ describe('registersHosts', () => {
expect(registersHosts({ state: '/Users/meet/.browsentic', home: '/Users/me', env: {}, platform: 'darwin' })).toBe(false);
});
+ it('reads Windows paths as Windows paths, whichever browsers’ layout is being worked out', () => {
+ const windows = { state: 'C:\\Users\\RUNNER~1\\Temp\\t\\.browsentic', home: 'C:\\Users\\RUNNER~1\\Temp\\t', env: {} };
+ expect(registersHosts({ ...windows, platform: 'linux' })).toBe(true);
+ expect(registersHosts({ ...windows, platform: 'darwin' })).toBe(true);
+ expect(registersHosts({ ...windows, state: 'D:\\scratch\\.browsentic', platform: 'linux' })).toBe(false);
+ });
+
it('lets someone who really keeps it elsewhere say so', () => {
expect(registersHosts({ state: '/Volumes/x/.browsentic', home: '/Users/me', env: { BROWSENTIC_REGISTER_HOST: '1' }, platform: 'darwin' })).toBe(true);
});
diff --git a/src/daemon/native-host.ts b/src/daemon/native-host.ts
index 8955254..86bc5e7 100644
--- a/src/daemon/native-host.ts
+++ b/src/daemon/native-host.ts
@@ -394,14 +394,18 @@ export interface HostOptions {
* folder, a scratch BROWSENTIC_HOME above all, must not point them at its own launcher, or the user's
* browsers would wake and pair with a throwaway Bridge.
*/
-export function registersHosts({ state = stateDir, home = homedir(), env = process.env, platform = process.platform }: HostOptions = {}): boolean {
+export function registersHosts({ state = stateDir, home = homedir(), env = process.env }: HostOptions = {}): boolean {
if (env.BROWSENTIC_REGISTER_HOST === '1') return true;
- const path = platform === 'win32' ? win32 : posix;
- const fold = (value: string) => (platform === 'win32' || platform === 'darwin' ? value.toLowerCase() : value);
+ // The two are paths on this machine, whichever browsers' layout a caller is working out, so their own spelling decides.
+ const windowsPaths = WINDOWS_PATH.test(home) || WINDOWS_PATH.test(state);
+ const path = windowsPaths ? win32 : posix;
+ const fold = (value: string) => (windowsPaths || process.platform === 'darwin' ? value.toLowerCase() : value);
const inside = path.relative(fold(home), fold(state));
return !!inside && !inside.startsWith('..') && !path.isAbsolute(inside);
}
+const WINDOWS_PATH = /^(?:[A-Za-z]:[\\/]|\\\\)/;
+
const machine = ({
platform = process.platform,
home = homedir(),