diff options
| author | Dani Bednarski <49581958+DaniBedz@users.noreply.github.com> | 2026-05-16 21:04:50 +1000 |
|---|---|---|
| committer | Tianren Dong <tianrendong.dtr@gmail.com> | 2026-05-16 13:17:06 -0400 |
| commit | 4739dce965041f72da917794b6d3122d01904f45 (patch) | |
| tree | f107fb4c39b00b04fe9a62e5ffbd192fb030b506 /extensions/chrome-profile-bridge/index.ts | |
| parent | d9f13a368e0acc9ac49e61a948d2b15ee0651d23 (diff) | |
silence startup notify + dynamic status bar
- Remove startup notification about companion extension
- Remove static 'Chrome bridge :17318' status bar entry
- Add updateChromeStatus() helper: shows green dot + 'Chrome Bridge'
only when authorized, clears otherwise
- Call from session_start, authorizeFor, revokeHandler
Diffstat (limited to 'extensions/chrome-profile-bridge/index.ts')
| -rw-r--r-- | extensions/chrome-profile-bridge/index.ts | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/extensions/chrome-profile-bridge/index.ts b/extensions/chrome-profile-bridge/index.ts index 48b726f..79b9eb2 100644 --- a/extensions/chrome-profile-bridge/index.ts +++ b/extensions/chrome-profile-bridge/index.ts @@ -486,6 +486,14 @@ export default function (pi: ExtensionAPI): void { } }; + const updateChromeStatus = (ctx: ExtensionContext): void => { + if (chromeControlAuthorized()) { + ctx.ui.setStatus("chrome", ctx.ui.theme.fg("success", "●") + " Chrome Bridge"); + } else { + ctx.ui.setStatus("chrome", undefined); + } + }; + const authorizedBridgeSend = (action: string, params: Record<string, unknown>, timeoutMs = DEFAULT_TIMEOUT_MS, signal?: AbortSignal): Promise<unknown> => { requireChromeControlAuthorized(); return bridge.send(action, params, timeoutMs, signal); @@ -507,14 +515,7 @@ export default function (pi: ExtensionAPI): void { pi.on("session_start", async (_event, ctx) => { await bridge.start(); - const status = bridge.status(); - ctx.ui.setStatus("chrome", `Chrome bridge :${DEFAULT_PORT}`); - ctx.ui.notify( - status.mode === "client" - ? `pi-chrome connected (sharing the Chrome connection an earlier pi session opened). Run /chrome authorize before using chrome_* tools.` - : `pi-chrome is ready and waiting for the Chrome companion to connect. Run /chrome onboard to install it, then /chrome authorize to allow chrome_* tools.`, - "info", - ); + updateChromeStatus(ctx); }); pi.on("session_shutdown", () => { @@ -650,6 +651,7 @@ Usage rules: } chromeAuthorizedUntil = until; ctx.ui.notify(`Chrome control authorized for ${label}.`, "info"); + updateChromeStatus(ctx); }; const parseAuthorizeArg = (arg: string): { label: string; until: number | "indefinite" } | undefined => { @@ -672,6 +674,7 @@ Usage rules: const revokeHandler = (ctx: ExtensionContext) => { chromeAuthorizedUntil = undefined; ctx.ui.notify("Chrome control locked. Run /chrome authorize to allow chrome_* tools again.", "info"); + updateChromeStatus(ctx); }; const onboardHandler = async (ctx: ExtensionContext) => { |
