Skip to content

feat(browser): add configurable daemon port for multi-Chrome-profile support#1090

Open
chenbojian wants to merge 3 commits intojackwener:mainfrom
chenbojian:feat/multi-profile-port-config
Open

feat(browser): add configurable daemon port for multi-Chrome-profile support#1090
chenbojian wants to merge 3 commits intojackwener:mainfrom
chenbojian:feat/multi-profile-port-config

Conversation

@chenbojian
Copy link
Copy Markdown

Summary

Closes #1089

When multiple Chrome profiles each have the OpenCLI extension installed, they all connect to localhost:19825, and the daemon's single extensionWs global means the last profile to connect "wins". This PR adds per-profile daemon port configuration so each profile can target a separate daemon process.

Changes

  • extension/manifest.json: Add storage permission for chrome.storage.local
  • extension/src/background.ts: Read daemon port from chrome.storage.local on startup (default 19825); listen for storage.onChanged to reconnect when port is updated; include port in popup status response
  • extension/popup.html + popup.js: Add daemon port input field with save button; show current port in status display
  • extension/src/background.test.ts: Add chrome.storage mock to createChromeMock()

No changes needed in

  • src/daemon.ts — already supports OPENCLI_DAEMON_PORT env var
  • src/browser/daemon-client.ts — already supports OPENCLI_DAEMON_PORT env var
  • extension/src/protocol.ts — default constants still used as fallback

Test plan

  • Load extension with no storage config — should connect to localhost:19825 as before (zero-config default unchanged)
  • Open popup, set port to 19826, save — extension should disconnect and reconnect to new port
  • Start two daemons on different ports, configure two Chrome profiles with different ports — both connect independently
  • Enter invalid port (e.g., 999, 70000) — validation prevents save
  • All existing tests pass (npx vitest run — 22 passed, 1 pre-existing skip)

…support

Allow each Chrome profile to connect its extension to a different daemon
port, so multiple profiles can run simultaneously without connection conflicts.
Doctor output and error messages were hardcoded to show DEFAULT_DAEMON_PORT
(19825) even when OPENCLI_DAEMON_PORT was set to a different value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Support multiple Chrome profiles for Browser Bridge

1 participant