Skip to content

feat: support configuring custom daemon ports via extension dashboard#1187

Open
isanwenyu wants to merge 3 commits intojackwener:mainfrom
isanwenyu:main
Open

feat: support configuring custom daemon ports via extension dashboard#1187
isanwenyu wants to merge 3 commits intojackwener:mainfrom
isanwenyu:main

Conversation

@isanwenyu
Copy link
Copy Markdown
Contributor

Description

This PR introduces full support for configuring custom daemon ports directly from the opencli browser extension popup. This is particularly useful when users need to avoid default port (19825) collisions or run multiple isolated CLI + extension profiles seamlessly.

Changes Included

  • Extension Settings UI: Added a lightweight configuration UI inside extension/popup.html and popup.js where users can read/write the target port to chrome.storage.local.
  • Dynamic Connection Management: Refactored the background service worker connection routine (extension/src/background.ts) to resolve the genuine WebSocket and ping URLs dynamically via user-defined settings.
  • Hot-Reload Listener: Bound a new chrome.storage.onChanged listener that instantly drops the legacy WebSocket and re-establishes the connection immediately upon saving a new port.
  • Doctor CLI Diagnostics: Ensured that opencli doctor successfully prints the actively fetched daemon port dynamically from its health metrics (health.status?.port), instead of statically defaulting to 19825.
  • Test Compatibility: Supplied the appropriate storage stub mock definitions inside extension/src/background.test.ts so vitest remains fully passing.
  • Documentation Updates: Updated the documentation across README.md, README.zh-CN.md, browser-bridge.md, and troubleshooting.md highlighting the availability and mechanisms of customizing OPENCLI_DAEMON_PORT securely.

Test Plan

  • Run npm run build inside extension/ and reload it unpacked inside Chrome.
  • Verify setting the port disconnected/reconnected successfully.
  • Verify opencli doctor shows [OK] Daemon: running on port <custom-port>.
  • Verified all npx vitest run tests passed smoothly without crashing over runtime API mocks.

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.

1 participant