ccdeck 3.81.4 → 3.82.1

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/README.md CHANGED
@@ -100,7 +100,7 @@ The deck opens on these eight pictures the first time it runs — they are the w
100
100
  | **Cost and quota, live** | Spend per model and per session, plus Claude and Codex quota windows as they refill. |
101
101
  | **Tool activity** | Which tools and commands your Claude Code and Codex agents ran on this machine, over the last day or up to 90 days: how many calls, how long they took, which ones fail. Kept on this machine and nowhere else. |
102
102
  | **Skill activity** | Which skills your agents used, whether you typed them or the agent called them, how often and when last — from its own button on the right stripe, below Tool activity. Kept on this machine and nowhere else. |
103
- | **Jira beside your agents** | Connect Jira Cloud or Jira Server / Data Center in **Settings › Integrations**, and a Jira control joins the left stripe (`I`). It opens a board's backlog laid out the way Jira's Backlog page lays it out — active sprints first, then the future ones and the backlog, in Jira's rank order, with the board's own quick filters, *Only my issues* and *Hide done* — and an issue's description, comments, attachments and sub-tasks beside the list. Browsing only reads; on a Scrum board ordered by Rank you can also drag issues, or use **Move**, to reorder them or send them to another sprint or the backlog (see [What it touches](#what-it-touches)). |
103
+ | **Jira beside your agents** | Connect Jira Cloud or Jira Server / Data Center in **Settings › Integrations**, and a Jira control joins the left stripe (`I`). It opens a board's backlog laid out the way Jira's Backlog page lays it out — active sprints first, then the future ones and the backlog, in Jira's rank order, with the board's own quick filters, *Only my issues* and *Hide done* — and an issue's description, comments, attachments and sub-tasks beside the list. Browsing only reads; from an issue's details you can add a comment or change its status, and on a Scrum board ordered by Rank you can also drag issues, or use **Move**, to reorder them or send them to another sprint or the backlog (see [What it touches](#what-it-touches)). |
104
104
  | **GitHub and GitLab beside your agents** | Connect GitHub, or GitLab.com or your own GitLab, with a personal access token in **Settings › Integrations**, and its control joins the left stripe. It opens the screens you already work through on GitLab — Branches, Merge requests (Pull requests), Pipelines (Actions) and Issues, for one project or across them — with the merge request, branch, pipeline with its jobs and the failed job's last log lines, or issue beside the list. Paste a link to open it. Read-only: it never comments, approves, merges or re-runs anything. |
105
105
  | **Double-click to inspect** | Any node opens its prompt, tool calls, token usage and timing in the side panel. A single click selects it and frames its session. |
106
106
  | **Survives restarts** | Events are appended to this platform's log directory (see `--history` below) and replayed on open. |
@@ -362,20 +362,20 @@ Each one fires the bundled `hook.js`, which POSTs the event JSON to the running
362
362
 
363
363
  **OpenAI Codex** — Codex CLI hooks do not fire reliably on Windows, so nothing is installed at all. The server tails Codex's own rollout files at `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl` and reconstructs the equivalent stream — session start, prompts, tool calls, token usage, model. No hook install, no trust prompt. Set `CODEX_HOME` to override the path.
364
364
 
365
- To use **multiple separate Codex logins**, open **Accounts → Add Codex account**, give the profile a label, and run its copied sign-in command in a terminal. Sign-in uses the official [Codex login flow](https://learn.chatgpt.com/docs/auth); each profile keeps its own login, configuration and history. Existing logins remain in place. You can also register existing homes at startup with `CCDECK_CODEX_HOMES`, a JSON array of additional absolute directories: for example, `CCDECK_CODEX_HOMES='["/home/me/.codex-work","/home/me/.codex-personal"]' npx ccdeck` on Linux.
365
+ To use **multiple separate Codex logins**, press **+** (**Add a Codex account**) on the Codex side of the Accounts panel, then **Sign in with ChatGPT**: the dialog shows a link and a one-time code, and names the account after its email. If that sign-in fails, **Copy the terminal command** gives you the same sign-in to run in a terminal. Sign-in uses the official [Codex login flow](https://learn.chatgpt.com/docs/auth); each profile keeps its own login, configuration and history. Existing logins remain in place. You can also register existing homes at startup with `CCDECK_CODEX_HOMES`, a JSON array of additional absolute directories: for example, `CCDECK_CODEX_HOMES='["/home/me/.codex-work","/home/me/.codex-personal"]' npx ccdeck` on Linux.
366
366
 
367
- **Use account** saves the default for ccdeck's Codex quota and account notifications. Selection is serialized across local processes and persists across restarts. Switching also asks supported interactive sessions opened through ccdeck terminal selection to move to that account, even with Auto-switch off. The engine waits for active tools, other turns and approvals, interrupts the current response if needed, and resumes the same conversation once. An idle conversation moves without sending a message. The managed terminal path does not cover sessions opened before installing it, explicit `CODEX_HOME` pins or unsupported commands; those can be reopened through terminal selection. Applications sharing the native daemon use the separate live connection described below. All configured profile session trees stay monitored independently of selection. Token renewal belongs to Codex. ccdeck never rotates managed-profile refresh tokens itself; system-store inspection uses the official Codex app-server, which may renew a login while reading quota. System-store account metadata depends on the installed CLI protocol and may not include a workspace ID. Native quota readings cover standard Codex limits. For a validated file-backed login, the panel also shows available rate-limit resets and their nearest expiry; additional limit families and purchased credit balances are not included in native readings.
367
+ **Switch** on a Codex account's row saves the default for ccdeck's Codex quota and account notifications. Selection is serialized across local processes and persists across restarts. Switching also asks supported interactive sessions opened through ccdeck terminal selection to move to that account, even with Auto-switch off. The engine waits for active tools, other turns and approvals, interrupts the current response if needed, and resumes the same conversation once. An idle conversation moves without sending a message. The managed terminal path does not cover sessions opened before installing it, explicit `CODEX_HOME` pins or unsupported commands; those can be reopened through terminal selection. Applications sharing the native daemon use the separate live connection described below. All configured profile session trees stay monitored independently of selection. Token renewal belongs to Codex. ccdeck never rotates managed-profile refresh tokens itself; system-store inspection uses the official Codex app-server, which may renew a login while reading quota. System-store account metadata depends on the installed CLI protocol and may not include a workspace ID. Native quota readings cover standard Codex limits. For a validated file-backed login, the panel also shows available rate-limit resets and their nearest expiry; additional limit families and purchased credit balances are not included in native readings.
368
368
 
369
- For plain `codex` commands to use this default, click **Enable terminal selection**, run the copied setup command once, then open a new terminal. Supported shells are zsh, bash and PowerShell (PowerShell 5 uses `--shell powershell5`). The installed launcher uses durable local metadata, so ccdeck can be closed. An explicit `CODEX_HOME` always takes priority. **Remove terminal selection** provides the reverse command; it removes only ccdeck's shell integration and keeps profile data. Individual launch commands remain available without terminal setup. Terminal setup applies to shell commands, not an independently launched IDE extension. Interactive switching requires a Codex CLI with the native remote transport (verified with 0.166.0). A closed rollout is moved between homes with a private source backup; credentials are never copied. An isolated home with no runtime settings (empty or containing only project trust) inherits the original CLI configuration in memory, so starting on a second login keeps the same tools and settings. Existing session settings are carried across subsequent switches. Different destination settings, conflicting rollout files or an uncertain process exit stop the transfer. Automatic quota continuation still requires Auto-switch to be enabled.
369
+ For plain `codex` commands to use this default, choose **Enable terminal selection** in the default account's **⋯** menu, run the copied setup command once, then open a new terminal. Supported shells are zsh, bash and PowerShell (PowerShell 5 uses `--shell powershell5`). The installed launcher uses durable local metadata, so ccdeck can be closed. An explicit `CODEX_HOME` always takes priority. **Remove terminal selection** provides the reverse command; it removes only ccdeck's shell integration and keeps profile data. Individual launch commands remain available without terminal setup. Terminal setup applies to shell commands, not an independently launched IDE extension. Interactive switching requires a Codex CLI with the native remote transport (verified with 0.166.0). A closed rollout is moved between homes with a private source backup; credentials are never copied. An isolated home with no runtime settings (empty or containing only project trust) inherits the original CLI configuration in memory, so starting on a second login keeps the same tools and settings. Existing session settings are carried across subsequent switches. Different destination settings, conflicting rollout files or an uncertain process exit stop the transfer. Automatic quota continuation still requires Auto-switch to be enabled.
370
370
 
371
- On Windows, switching from the original native Codex home also supports sandbox-managed folder permissions. ccdeck takes an owner-checked, pinned snapshot of access and identity tokens into memory, checks it against native Codex?s account identity, and leaves the source files and permissions unchanged. The snapshot does not include the refresh token; native Codex owns renewal. Publicly accessible files, junctions, hard links and identity mismatches are refused. Managed and imported profiles retain their private-folder requirement.
371
+ On Windows, switching from the original native Codex home also supports sandbox-managed folder permissions. ccdeck takes an owner-checked, pinned snapshot of access and identity tokens into memory, checks it against native Codex's account identity, and leaves the source files and permissions unchanged. The snapshot does not include the refresh token; native Codex owns renewal. Publicly accessible files, junctions, hard links and identity mismatches are refused. Managed and imported profiles retain their private-folder requirement.
372
372
 
373
- **Share Codex accounts** exports selected ChatGPT logins stored in `auth.json` as a code you can paste into **Import Codex accounts** on another machine, including Windows. Import creates separate profiles, keeps the current default and existing logins, and skips an exact repeated import. It transfers the login only, without configuration or conversation history. The code contains live credentials: it is encoded, not encrypted, and has no automatic expiry or ccdeck revocation. Use a trusted private channel and delete clipboard/message copies afterward. Both machines share the OAuth renewal token; renewing on one can invalidate the other copy and require signing in again. Keyring-only logins and API keys cannot be shared.
373
+ **Share Codex accounts** (**↗** in the panel's header, or **Share** in an account's **⋯**) exports selected ChatGPT logins stored in `auth.json` as a code you can paste into **+** → **Paste a share** in the Codex accounts panel on another machine, including Windows. Import creates separate profiles, keeps the current default and existing logins, and skips an exact repeated import. It transfers the login only, without configuration or conversation history. The code contains live credentials: it is encoded, not encrypted, and has no automatic expiry or ccdeck revocation. Use a trusted private channel and delete clipboard/message copies afterward. Both machines share the OAuth renewal token; renewing on one can invalidate the other copy and require signing in again. Keyring-only logins and API keys cannot be shared.
374
374
 
375
375
  On Windows, Share reports when the profile's permissions prevent export. **Secure permissions and share** is an explicit, optional repair: it gives only your Windows user access to the selected Codex folders and `auth.json`, changes inherited access for their contents, and keeps the login, settings and selected account in place. Close programs holding the login file if Windows refuses the change, and run ccdeck without administrator rights. Automatic network sync never changes folder permissions. After preparation, a paired deck can receive the selected shared login on its next round.
376
376
 
377
377
 
378
- **An already-open Codex app or IDE:** on macOS, Linux and Windows with Codex 0.166.0 or newer, **Use account** can also update the existing native shared app-server through its local control socket. Every conversation using that daemon changes together, including conversations opened before ccdeck. Their IDs, history and settings remain in place. Windows uses Codex's own `app-server proxy` to reach its AF_UNIX socket; run Codex and ccdeck as your normal Windows user. Existing unsafe permissions are rejected rather than changed.
378
+ **An already-open Codex app or IDE:** on macOS, Linux and Windows with Codex 0.166.0 or newer, **Switch** can also update the existing native shared app-server through its local control socket. Every conversation using that daemon changes together, including conversations opened before ccdeck. Their IDs, history and settings remain in place. Windows uses Codex's own `app-server proxy` to reach its AF_UNIX socket; run Codex and ccdeck as your normal Windows user. Existing unsafe permissions are rejected rather than changed.
379
379
 
380
380
  For conversations that accept direct input, ccdeck waits for observed tools and approvals, pauses responses through the native interrupt API, verifies the new login, then submits one Continue in each paused conversation. Supported subagents move with their parent: parents pause first, then the same child conversations resume before their parents. A naturally finished response stays idle.
381
381
 
@@ -403,7 +403,7 @@ What does go out is short and ordinary: a ~20-byte version check against the npm
403
403
 
404
404
  **Settings › Integrations** keeps each connection in `integrations/`, in the deck's data directory: `integrations.json` holds its name, its address and the account it signed in as, and `integrations-secrets.json`, which only you can read, holds its token. The token goes to that connection's own Jira and nowhere else — for a scoped Atlassian Cloud token, `api.atlassian.com` as well — never to the page, never into a report or a log, and never to another deck on the local network. The Jira panel reads from Jira only while it is open: when you open a board read more than five minutes ago, or press Refresh. What it reads stays in memory; only the panel's layout and filters are remembered, in this browser. Avatars and issue icons come through the deck, which sends the token only to Jira's own address. Disconnecting deletes the connection and its token.
405
405
 
406
- On a Scrum board ordered by Rank, you can drag Jira issues to reorder them or move them between active/future sprints and the backlog. Ctrl/Cmd+click toggles individual selections; Shift+click selects a visible range, and Space toggles the focused issue. Drag a selected issue to move the whole selection, or use **Move selected** (up to 50 unfinished top-level issues). **Move** provides the same action for keyboard and touch; Alt+M opens it from a focused issue. Filtering or folding rows removes hidden issues from the selection. These actions save changes in Jira using your account’s permissions; browsing does not write. Subtasks, epics and completed issues cannot be moved here, and moving does not change workflow status. Positions refer to the loaded issues, so hidden or unloaded issues keep their relative rank. A failed or interrupted move refreshes the board; check the result before trying again because Jira may have saved part of the action.
406
+ On a Scrum board ordered by Rank, you can drag Jira issues to reorder them or move them between active/future sprints and the backlog. Ctrl/Cmd+click toggles individual selections; Shift+click selects a visible range, and Space toggles the focused issue. Drag a selected issue to move the whole selection, or use **Move selected** (up to 50 top-level issues). **Move** provides the same action for keyboard and touch; Alt+M opens it from a focused issue. Filtering or folding rows removes hidden issues from the selection. In an issue's details, **Add a comment** and then **Add comment** posts a comment, and **Change status** and then **Apply** makes one of the transitions Jira offers; one marked *(open in Jira)* needs fields the deck cannot fill. These actions save changes in Jira using your account’s permissions; browsing does not write. Subtasks and epics cannot be moved here, and moving does not change workflow status. A done issue can move between sprints, but not to the backlog, where Jira hides it: change its status first. **Move** puts the issues at the end of the destination, read from Jira's full order rather than the rows on screen; dropping them on an issue's top or bottom half puts them before or after it. A failed or interrupted move refreshes the board; check the result before trying again because Jira may have saved part of the action.
407
407
 
408
408
  Jira comments, status changes and moves retain a small private write receipt in `integrations/jira-write-guard/` until the result is acknowledged. It contains connection and issue identifiers and the operation state, never comment text or tokens. This prevents accidentally repeating a write after a lost response or restart; if the result is uncertain, check Jira before acknowledging it. Native file locking coordinates writes across local processes. If the platform or data filesystem cannot provide that locking, Jira writes are unavailable while browsing remains usable. The native library is bundled with ccdeck, including its supported macOS, Windows and Linux x64/arm64 binaries.
409
409
 
@@ -427,13 +427,13 @@ Step by step: [Detect browser automation while you were away](https://ccdeck.dev
427
427
 
428
428
  ## Accounts
429
429
 
430
- The Accounts panel shows Claude accounts managed by [claude-swap](https://github.com/realiti4/claude-swap) and configured Codex profiles. With both CLIs on a machine, the Claude | Codex switch at the top of the panel chooses which you see; it changes the view, not the account in use. Codex profiles support adding accounts, isolated quota checks and a persistent default for new sessions. The Claude controls described below continue to use claude-swap.
430
+ The Accounts panel shows Claude accounts managed by [claude-swap](https://github.com/realiti4/claude-swap) and configured Codex profiles. With both CLIs on a machine, the Claude | Codex switch at the top of the panel (`A`) chooses which you see; it changes the view, not the account in use. On a deck with only Codex, the control on the stripe is **Codex accounts**, also on `A`. Codex profiles support adding accounts, isolated quota checks, a persistent default for new sessions and an **Auto-switch** of their own, shown even with one Codex account: off until you turn it on, it moves the default to another account with room once the default passes your threshold, with the same **Next account**, **Set as home** and **Hold out of rotation** as Claude's. The Claude controls described below continue to use claude-swap.
431
431
 
432
432
  **Codex continuation:** with Codex Auto-switch enabled, the updated terminal
433
433
  integration can continue a managed interactive `codex`, an explicit-ID
434
434
  `codex resume <id>`, or `codex exec --json` task on another account after a
435
435
  terminal usage-limit failure. In the default Codex account's **⋯** menu, run
436
- **Enable in terminal** again to update an older integration, then open a new
436
+ **Enable terminal selection** again to update an older integration, then open a new
437
437
  terminal. The engine transfers only the exact conversation's saved rollout.
438
438
  The global default and each account's login stay unchanged. Unknown/stale usage,
439
439
  held-out accounts and copies of the exhausted account are skipped.
@@ -484,7 +484,7 @@ A small **shield** on an account's row says that account's organization turns on
484
484
 
485
485
  **Account notifications** are four switches in **Settings › Notifications** (the gear in the topbar, or `Cmd+,`; `Ctrl+,` on Windows and Linux), each on its own and none of them tied to **Notifications while closed**: they are sent whether the deck is open or not, because nothing on the page says them. The desktop app shows them as ccdeck, without a sound.
486
486
 
487
- - **Account auto-switched**, on unless you turn it off. When Auto-switch moves Claude Code to another account, one notification says where to and, when the engine's own reading shows it, why: `Switched to work · personal@example.com reached 90%`, `Back on work · your home account` or `Switched to side · weekly limit resets in 1d 7h`, with an account's alias when it has one. A switch away from an expired login says so: `Switched to work · personal@example.com's login expired, sign in again to use it`; and when no other account is ready to take over, that is said once rather than every minute. When the account it moved to belongs to an organization the deck has seen turn telemetry on, a second line says what it sends from the next session, and where: `Acme's telemetry is on for new sessions: it sends your prompts and tool details to 192.0.2.16:4317`. A switch you make yourself is not announced: the row you pressed becomes the active one, and the shield beside its name says what its organization sends.
487
+ - **Account auto-switched**, on unless you turn it off. When Auto-switch moves Claude Code, or Codex's default, to another account, one notification says where to and, when the engine's own reading shows it, why: `Switched to work · personal@example.com reached 90%`, `Back on work · your home account` or `Switched to side · weekly limit resets in 1d 7h`, with an account's alias when it has one. A switch away from an expired login says so: `Switched to work · personal@example.com's login expired, sign in again to use it`; and when no other account is ready to take over, that is said once rather than every minute. When the account it moved to belongs to an organization the deck has seen turn telemetry on, a second line says what it sends from the next session, and where: `Acme's telemetry is on for new sessions: it sends your prompts and tool details to 192.0.2.16:4317`. A switch you make yourself is not announced: the row you pressed becomes the active one, and the shield beside its name says what its organization sends.
488
488
  - **Quota at 90% and 100%**, off until you turn it on. When a window of the Claude or Codex account you are on reaches 90%, and once more at 100%: Claude's 5-hour, 7-day and per-model windows, and every Codex window the Usage panel shows, the extra limits included — `5-hour usage reached 90% · resets in 2h 14m`. Only the account in use is watched, not every account you have stored. When reaching it is what makes Auto-switch move the account, the switch notification says it and this one is not sent, unless the switch notification is off.
489
489
  - **Quota reset**, off until you turn it on. When one of those windows that had reached 90% starts over: `5-hour window available again`. A window that never got that high resets without a word.
490
490
  - **Sessions stopped on login or limit**, on unless you turn it off. When Claude Code sessions stop on an expired login or a usage limit, one notification for all of them says how many stopped and to type `continue` in each. When the Auto-switch run that follows moves the account, the switch notification says it instead, so one incident is one notification.
@@ -545,7 +545,7 @@ A misspelled command is refused — `ccdeck acounts` suggests `accounts` and sta
545
545
 
546
546
  ## Local network
547
547
 
548
- A Claude login expires on the machine that has not used it for a while, and stays alive on the one that has. With two or three machines that is a `claude login` a week, each time on the machine you are not sitting at. **Local network** is the last section of the Claude accounts panel, and it is that chore done for you: decks on one network find each other, pair, and a login that has expired on one is copied back from another that still has it.
548
+ A Claude login expires on the machine that has not used it for a while, and stays alive on the one that has. With two or three machines that is a `claude login` a week, each time on the machine you are not sitting at. **Local network** is the row at the foot of the Accounts panel, on its Claude and Codex sides alike, and it is that chore done for you: decks on one network find each other, pair, and a login that has expired on one is copied back from another that still has it. Since 3.81.0 it lists Codex logins beside Claude's, and a paired deck adds a Codex login you tick as a Codex account of its own.
549
549
 
550
550
  Four pictures, which are also the guide the section opens from `See how it works`:
551
551
 
@@ -568,11 +568,11 @@ Four pictures, which are also the guide the section opens from `See how it works
568
568
  </tr>
569
569
  </table>
570
570
 
571
- **On each machine, in order:** open the Accounts panel (`A`) on its Claude side, open **Local network**'s settings (the sliders button), and tick the logins this machine may hand out. The section is on unless somebody switched it off. The two decks find each other over a UDP beacon on port 45317 and ask each other to pair; press `accept` where it is asked, and from then on every paired deck is asked once a minute for the ticked logins this deck is missing or has expired.
571
+ **On each machine, in order:** open the Accounts panel (`A`), press **Local network** at its foot, open its settings (the sliders button), and tick the logins this machine may hand out. The section is on unless somebody switched it off. The two decks find each other over a UDP beacon on port 45317 and ask each other to pair; press `accept` where it is asked, and from then on every paired deck is asked once a minute for the ticked logins this deck is missing or has expired.
572
572
 
573
573
  **When they do not find each other** — a VPN, a guest network, two subnets — `+` at the top of the section reaches a deck by address, or with an invite the other deck minted. An invite is the route when the machine that cannot be seen is this one.
574
574
 
575
- **What is shared, and with whom.** Nothing until you tick a login, and then only that login, and only with paired decks. A login ticked on one deck arrives on every deck paired with it: added where it is missing, repaired where it has expired, and never in place of one that still works. The deck asks the machines it finds, and a machine that is asked waits for somebody there to press `accept` unless its `Say yes to every deck that asks` switch, in the same dialog, is on. That switch starts on, so your own machines pair without a press. It also means a deck the switch pairs can add the logins ticked on it to this machine, and Auto-switch, if it is on, may later move Claude Code to one of them — so on a network you do not own, turn the switch off. What still takes a person is the tick: a paired deck is handed nothing until somebody ticks a login here. A login that arrives from a deck somebody here accepted or paired by invite is ticked here too, so this machine can repair the next one; a deck the switch paired is handed only the logins a person ticked on this deck, never the ones that were ticked by arriving, so untick and tick such a login again to hand it to those decks as well — and what a deck the switch paired brings here is not ticked here at all. What crosses the wire is the same live credential a share carries, sealed to the deck it is addressed to, so treat the pairing decision as the moment that matters. Unpairing stops future rounds; a login already copied stays where it went.
575
+ **What is shared, and with whom.** Nothing until you tick a login, and then only that login, and only with paired decks. A login ticked on one deck arrives on every deck paired with it: added where it is missing, repaired where it has expired, and never in place of one that still works. The deck asks the machines it finds, and a machine that is asked waits for somebody there to press `accept` unless its `Say yes to every deck that asks` switch, in the same dialog, is on. That switch starts on, so your own machines pair without a press. It also means a deck the switch pairs can add the logins ticked on it to this machine, and Auto-switch, if it is on, may later move Claude Code or Codex to one of them — so on a network you do not own, turn the switch off. What still takes a person is the tick: a paired deck is handed nothing until somebody ticks a login here. A login that arrives from a deck somebody here accepted or paired by invite is ticked here too, so this machine can repair the next one; a deck the switch paired is handed only the logins a person ticked on this deck, never the ones that were ticked by arriving, so untick and tick such a login again to hand it to those decks as well — and what a deck the switch paired brings here is not ticked here at all. What crosses the wire is the same live credential a share carries, sealed to the deck it is addressed to, so treat the pairing decision as the moment that matters. Unpairing stops future rounds; a login already copied stays where it went.
576
576
 
577
577
  **A ticked login goes out even while this machine is signed in to it** (since 3.48.1). That has a cost: a Claude login renews once, so two machines on one copied login race at each renewal and the one that renews second is signed out (“Login expired”). The deck does not warn just because a paired deck is on the same account; if a login does expire, its row says **Login expired** like any other. To keep the login in use on this machine, turn off **Send the login this deck is using too** in the same dialog. The dialog then marks it **in use here · not sent** when it is ticked, a paired deck reads it as **in use there** (or does not see it, while this deck hides which account it is on), and it goes out like any other ticked login as soon as this machine switches to another account; a paired deck that already holds a copy of that login, from before this machine switched to it, can still renew it first and sign this machine out. A deck updated from an earlier version starts with the switch on, whatever it showed before: only a choice made on 3.48.1 or later is kept.
578
578
 
@@ -620,7 +620,8 @@ ccdeck <command> [options] accounts, switch, usage, sessions, open — see
620
620
  Codex accounts remain available (Codex only)
621
621
  --ref <name> The ccdeck.dev page this command was copied from;
622
622
  sent once, with the first install report
623
- --uninstall Remove ccdeck's hooks from settings files, and name
623
+ --uninstall Remove ccdeck's hooks from settings files and Codex's
624
+ terminal selection from your shell profile, and name
624
625
  the files that still hold this deck's private key
625
626
  --purge With --uninstall: delete those files too
626
627
  --json With a command: one object on stdout, for scripts
@@ -757,7 +758,9 @@ npx ccdeck --uninstall
757
758
 
758
759
  Removes every hook entry ccdeck injected from `~/.claude/settings.json`, and `~/.codex/hooks.json` if present — and the login item, if this machine had one — and then stops every deck still running, with a line for each. Those two exceptions to the narrowness below are deliberate: a login item left behind would keep starting a deck whose hooks had just been removed, and a deck left running would put them back itself on its next update. A deck that cannot be stopped makes the command exit 1.
759
760
 
760
- It removes the hook entries and nothing else. The forwarder script
761
+ It also takes out the "ccdeck Codex accounts" block that **Enable terminal selection** wrote into your shell profiles, since left behind it would run `codex` through a helper that may be gone. It looks in `$ZDOTDIR/.zshrc` and `~/.zshrc`, `~/.bashrc`, `~/.bash_profile`, `~/.bash_login` and `~/.profile`, and on Windows in the PowerShell 7 and Windows PowerShell 5 profiles (`profile.ps1` under `Documents\PowerShell` and `Documents\WindowsPowerShell`, in OneDrive's Documents too), with a line for each file it cleaned. A file whose markers are incomplete is left untouched and named, and the command exits 1; once no block is left, the helper copy, `codex-terminal` in the data directory, goes too.
762
+
763
+ Apart from that block, it removes the hook entries and nothing else. The forwarder script
761
764
  (`~/.claude/agent-dag/hook.js`), the discovery directory around it, the events
762
765
  log, the deck's own state, Tool activity's history included, and the tools
763
766
  ccdeck installed for you — claude-swap, ccusage, and a `uv` binary if it had to
@@ -911,10 +914,20 @@ own quota, and, once you open Radio, the Radio Browser directory and the
911
914
  station or YouTube stream you play. [What it touches](#what-it-touches) lists all of it.
912
915
 
913
916
  **Can it interfere with what my agent does?**
914
- No. The hook it installs is a one-way forwarder: it POSTs the event, exits `0`,
917
+ Watching, no. The hook it installs is a one-way forwarder: it POSTs the event, exits `0`,
915
918
  and writes nothing to stdout — the two channels Claude Code's hook protocol
916
919
  gives a hook for allowing, denying or rewriting a tool call. It uses neither, so
917
920
  it has no way to answer at all, and a test pins both halves.
921
+ A few things you press do reach a running agent. **Switch** on a Codex account
922
+ moves supported running Codex conversations, and their subagents, to that
923
+ account: it waits for tools and approvals, may pause a reply, and sends one
924
+ Continue. **Continue** on a stopped background Claude Code session resumes it
925
+ with a prompt to carry on. On its own, ccdeck does this only where you turned it
926
+ on: with Codex Auto-switch on, a supported terminal task stopped by a usage
927
+ limit resumes on another account with one Continue, and **Continue stopped
928
+ background sessions** (**Settings › General**) presses Continue for you.
929
+ Otherwise Auto-switch only changes the account in use; running Claude Code
930
+ sessions pick it up on their next message.
918
931
 
919
932
  **Does it need an account, an API key or a config file?**
920
933
  None of the three. `npx ccdeck` and it runs.
package/bin/cli/help.js CHANGED
@@ -74,8 +74,9 @@ Options:
74
74
  --no-claude Skip Claude entirely: no hooks or claude-swap; Codex accounts remain
75
75
  --ref <name> The site page this command was copied from (first run)
76
76
  --uninstall Remove ${PRODUCT}'s hooks from ~/.claude/settings.json and
77
- ~/.codex/hooks.json, and restore any sound hooks of yours it parked.
78
- Hook entries only: the forwarder script under
77
+ ~/.codex/hooks.json and Codex's terminal selection from
78
+ your shell profile, and restore any sound hooks of yours it parked.
79
+ Otherwise nothing is deleted: the forwarder script under
79
80
  ~/.claude/agent-dag/, the deck's own state and log
80
81
  directories (\`--status\` names them), ~/.agents-deck/
81
82
  and claude-swap all stay. It NAMES the prefs.json
@@ -112,6 +112,25 @@ export async function uninstall(flags) {
112
112
  if (await hasCodexInstalled()) {
113
113
  report(await uninstallHooks({ provider: "codex" }), "Codex");
114
114
  }
115
+ // Codex's terminal selection, whether or not Codex is still installed: the
116
+ // block sits in the person's own shell profile, and with ccdeck gone the
117
+ // `codex` it defines runs a helper that may not be there any more.
118
+ {
119
+ const { removeCodexTerminalEverywhere } =
120
+ await import(pathToFileURL(join(PKG_ROOT, "src/server/codex-terminal.mjs")).href);
121
+ const terminal = await removeCodexTerminalEverywhere().catch((e) => ({
122
+ removed: [], refused: [{ path: "", why: e?.message ?? String(e) }], kept: true, helper: false,
123
+ }));
124
+ for (const rc of terminal.removed) console.log(`${PRODUCT}: Codex terminal selection removed from ${rc}`);
125
+ for (const f of terminal.refused) {
126
+ refused = true;
127
+ console.error(`${PRODUCT}: Codex terminal selection NOT removed${f.path ? ` from ${f.path}` : ""} ${gDash} ${f.why}`);
128
+ }
129
+ if (terminal.refused.length > 0) {
130
+ console.error(`${PRODUCT}: delete the block between the "ccdeck Codex accounts" lines yourself, then open a new terminal.`);
131
+ }
132
+ if (terminal.helper) console.log(`${PRODUCT}: removed the Codex terminal helper in ${terminal.directory}`);
133
+ }
115
134
  // ── THE DECKS STILL RUNNING ────────────────────────────────────────────────
116
135
  //
117
136
  // Since 3.20 the deck runs in the background, and an uninstall that left it
@@ -1 +1 @@
1
- import{u as P,j as e,b as h,a1 as Z,a2 as ee,e as V,t as I,a3 as se,g as te,a4 as ne,x as ae,a5 as ie,s as re,a6 as J,o as Q,C as le,D as ce,R as oe,i as de}from"./app-0jqgYDft.js";function he({snap:s}){const a=P();return e.jsxs("section",{className:"bw-feed",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:[a("settings.bw.feed"),e.jsx("span",{className:"bw-feed-count",children:a("settings.bw.feed.count",{count:s.log.length})})]}),e.jsx("p",{className:"bw-since bw-feed-note",children:a("settings.bw.feed.note")}),e.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:s.log.length===0?e.jsx("p",{className:"bw-note",children:a("settings.bw.feed.empty")}):s.log.map(t=>e.jsxs("div",{className:`bw-log-line ${t.level}${t.parts?"":" sys"}`,children:[e.jsx("span",{className:"bw-log-time",children:new Date(t.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),t.parts?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bw-log-browser",children:t.parts.browser}),e.jsx("span",{className:"bw-log-profile",title:t.parts.profile,children:t.parts.profile}),e.jsxs("span",{className:"bw-log-value",children:[t.parts.value,t.parts.flagged>0&&e.jsx("span",{className:"bw-log-flag",children:a("settings.bw.feed.flagged",{count:t.parts.flagged})})]})]}):e.jsx("span",{className:"bw-log-sys",children:t.text})]},`${t.atMs}-${t.level}-${t.text}`))})]})}const D=s=>`${s.host}-${s.startMs}`;function we(s){const a=t=>new Date(t).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return s.count===1||s.endMs-s.startMs<6e4?a(s.startMs):`${a(s.startMs)} → ${a(s.endMs)}`}function be(s){return new Date(s).toLocaleDateString(V(),{weekday:"short",day:"numeric",month:"short"})}function _(s,a){const t=Math.round((s.endMs-s.startMs)/6e4);return t<1?"":a("settings.bw.findings.minutes",{n:t})}function ue({snap:s,dismiss:a,refreshRef:t}){const i=P(),[l,d]=h.useState(null),o=h.useRef(new Map),n=h.useRef(null);h.useEffect(()=>{var c,u;const b=n.current;!b||s.episodes.some(g=>D(g)===b.id)||(n.current=null,Z(((c=document.activeElement)==null?void 0:c.tagName)??null)&&((u=(b.next?o.current.get(b.next):void 0)??t.current)==null||u.focus()))},[s]);const r=b=>{n.current={id:D(b),next:ee(s.episodes.map(D),D(b))},a(b)},w=h.useMemo(()=>{const b=[];for(const c of s.episodes){const u=be(c.startMs),g=b[b.length-1];g&&g.label===u?g.episodes.push(c):b.push({label:u,episodes:[c]})}return b},[s]);return e.jsxs("section",{className:"bw-findings",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:[i("settings.bw.findings"),s.episodes.length>0&&e.jsx("span",{className:"bw-feed-count",children:i("settings.bw.findings.count",{count:s.episodes.length})})]}),e.jsx("div",{className:"bw-eps",children:w.length===0?e.jsxs("div",{className:"bw-empty",children:[e.jsx("p",{className:"bw-empty-head",children:i("settings.bw.findings.none")}),e.jsx("p",{className:"bw-empty-note",children:i("settings.bw.findings.noneNote",{count:s.settings.quietMinutes})}),!s.settings.enabled&&e.jsx("p",{className:"bw-empty-note",children:i("settings.bw.findings.offNote")})]}):w.map(b=>e.jsxs("div",{className:"bw-day",children:[e.jsx("h4",{className:"bw-sec-head",children:b.label}),b.episodes.map(c=>{const u=D(c),g=l===u;return e.jsxs("div",{className:`bw-ep${g?" open":""}`,children:[e.jsxs("div",{className:"bw-ep-row",children:[e.jsxs("button",{className:"bw-ep-head",ref:p=>{p?o.current.set(u,p):o.current.delete(u)},onClick:()=>d(g?null:u),"aria-expanded":g,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:g?"▾":"▸"}),e.jsx("span",{className:"bw-ep-host",children:c.host}),e.jsxs("span",{className:"bw-ep-meta",children:[we(c),_(c,i)&&e.jsxs(e.Fragment,{children:[" · ",_(c,i)]}),c.provisional&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{title:i("settings.bw.findings.provisionalTip"),children:i("settings.bw.findings.provisional")})]})]}),e.jsx("span",{className:"bw-ep-count",children:i("settings.bw.findings.pages",{count:c.count})})]}),e.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>r(c),"aria-label":i("settings.bw.findings.dismissHost",{host:c.host}),title:i("settings.bw.findings.dismissTip"),children:"×"})]}),g&&e.jsx("ul",{className:"bw-urls",children:c.urls.map((p,x)=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-url-time",children:new Date(p.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),e.jsx("span",{className:"bw-url",children:p.url})]},`${p.url}-${p.timeMs}-${x}`))})]},u)})]},b.label))})]})}function ge(s){const a=/^#?([0-9a-f]{6})$/i.exec((s??"").trim());if(!a)return!1;const t=parseInt(a[1],16),i=[t>>16&255,t>>8&255,t&255].map(l=>{const d=l/255;return d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4)});return .2126*i[0]+.7152*i[1]+.0722*i[2]>.5}const z=1e4,me=12e3;function fe({browsers:s,findings:a,watching:t,palette:i}){const l=P(),d=h.useRef(null),o=h.useRef(null);return o.current={browsers:s,findings:a,watching:t},h.useEffect(()=>{var g;const n=d.current;if(!n)return;const r=n.getContext("2d");if(!r)return;const w=((g=window.matchMedia)==null?void 0:g.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let b=0,c=!1;const u=()=>{var U;if(c)return;const p=o.current;if(!p)return;const{browsers:x,findings:W,watching:T}=p,m=i["--accent"]||"#7dd3fc",y=i["--line"]||"#1f2229",A=i["--text-dim"]||"#6e727c",k=ge(i["--bg"]),v=k?42:26,F=k?.85:.65,R=Date.now(),C=Math.min(window.devicePixelRatio||1,2),S=n.clientWidth,$=n.clientHeight;(n.width!==S*C||n.height!==$*C)&&(n.width=S*C,n.height=$*C),r.setTransform(C,0,0,C,0,0),r.clearRect(0,0,S,$);const f=S/2,N=$/2,M=Math.min(S,$)/2-6;r.strokeStyle=y,r.lineWidth=1,r.globalAlpha=k?1:.9;for(const j of[.4,.7,1])r.beginPath(),r.arc(f,N,M*j,0,Math.PI*2),r.stroke();r.beginPath(),r.moveTo(f-M,N),r.lineTo(f+M,N),r.moveTo(f,N-M),r.lineTo(f,N+M),r.stroke(),r.globalAlpha=1;const B=(T&&!w?R%z/z:0)*Math.PI*2-Math.PI/2;if(T){const j=(U=r.createConicGradient)==null?void 0:U.call(r,B-.85,f,N);j&&(j.addColorStop(0,"transparent"),j.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${m} ${v}%, transparent)`),j.addColorStop(1,"transparent"),r.fillStyle=j,r.beginPath(),r.moveTo(f,N),r.arc(f,N,M,B-.85,B),r.closePath(),r.fill()),r.strokeStyle=m,r.globalAlpha=F,r.beginPath(),r.moveTo(f,N),r.lineTo(f+Math.cos(B)*M,N+Math.sin(B)*M),r.stroke(),r.globalAlpha=1}x.forEach((j,E)=>{const O=E/Math.max(x.length,1)*Math.PI*2-Math.PI/2,L=j.lastReadMs===null?1:Math.min(1,(R-j.lastReadMs)/12e4),q=M*(.42+L*.5),G=f+Math.cos(O)*q,K=N+Math.sin(O)*q,Y=Math.abs((B-O+Math.PI*3)%(Math.PI*2)-Math.PI),H=T?Math.max(0,1-Y/.55):0;r.beginPath(),r.arc(G,K,3+H*1.6,0,Math.PI*2),r.fillStyle=j.running?m:A,r.globalAlpha=j.running?.55+H*.45:.35,r.fill(),r.globalAlpha=1});for(const j of W){const E=(R-j.atMs)/me;if(E<0||E>1)continue;const L=Math.max(0,x.findIndex(K=>K.key===j.browser))/Math.max(x.length,1)*Math.PI*2-Math.PI/2,q=f+Math.cos(L)*M*.6,G=N+Math.sin(L)*M*.6;r.beginPath(),r.arc(q,G,4+E*22,0,Math.PI*2),r.strokeStyle=m,r.globalAlpha=(1-E)*.8,r.lineWidth=1.5,r.stroke(),r.globalAlpha=1}b=requestAnimationFrame(u)};return u(),()=>{c=!0,cancelAnimationFrame(b)}},[i]),e.jsx("canvas",{ref:d,className:"bw-radar",role:"img","aria-label":t?l("radar.watch.watching",{count:s.length}):l("radar.watch.idle")})}function xe(s,a,t){if(s===null)return null;const i=s+a-t;return i>0?i:null}function pe(s){const a=Math.ceil(s/1e3),t=Math.floor(a/60),i=a%60;return t>0?`${t}m ${i}s`:`${i}s`}function X(s){return(s??[]).filter(a=>a.installed&&a.profiles>0)}function je(s,a=I){return!Number.isFinite(s)||s<=0?a("settings.bw.logEmpty"):se(s)}function Ne(s,a){return s.map(t=>({key:t.key,name:t.name,running:t.running,visits:a.filter(i=>i.browser===t.key).reduce((i,l)=>i+l.programVisits,0)}))}function ve(s,a,t=I){if(s===null)return null;const i=Math.max(0,Math.round((a-s)/1e3));if(i<5)return t("settings.bw.ago.now");if(i<60)return t("settings.bw.ago.sec",{n:i});const l=Math.round(i/60);return l<60?t("settings.bw.ago.min",{n:l}):t("settings.bw.ago.hr",{n:Math.round(l/60)})}function ye(s,a=I){const t=s.profiles.filter(l=>l.degraded);if(t.length>0){const l=t[0],d=t.length-1;return{kind:"unreadable",text:a(d>0?"settings.bw.trouble.unreadableMore":"settings.bw.trouble.unreadable",{browser:l.name,profile:l.profile,reason:l.reason??a("settings.bw.trouble.noReason"),more:d})}}const i=X(s.browsers);return i.length===0?{kind:"no-profiles",text:a("settings.bw.trouble.noProfiles")}:i.some(l=>l.running)?null:{kind:"none-running",text:a("settings.bw.trouble.noneRunning")}}function ke({snap:s,watching:a,palette:t}){const i=P(),[l,d]=h.useState(!1),[o,n]=h.useState(()=>Date.now());h.useEffect(()=>{const w=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(w)},[]);const r=xe(s.coverage.lastHumanMs,s.coverage.quietMs,o);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:[i("settings.bw.overview"),e.jsx("button",{className:"bw-help",onClick:()=>d(w=>!w),"aria-expanded":l,"aria-label":i("settings.bw.overview.help"),children:"?"})]}),e.jsxs("div",{className:"bw-glance",children:[e.jsx(fe,{browsers:a.map(w=>{var b;return{key:w.key,name:w.name,running:w.running,lastReadMs:((b=s.profiles.find(c=>c.browser===w.key))==null?void 0:b.lastWrittenMs)??null}}),findings:s.episodes.slice(0,6).map(w=>({browser:w.browser??null,atMs:w.endMs})),watching:s.settings.enabled,palette:t}),e.jsx("ul",{className:"bw-counts",children:Ne(a,s.profiles).map(w=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-count-n",children:te(w.visits,0)}),e.jsx("span",{className:"bw-count-of",children:w.name})]},w.key))})]}),e.jsx("p",{className:"bw-since",children:i("settings.bw.overview.since")}),s.coverage.checkedMs>0&&e.jsxs("p",{className:"bw-since",children:[i("settings.bw.overview.checked",{ago:ve(s.coverage.checkedMs,o,i)??""}),s.coverage.checks>0&&e.jsxs(e.Fragment,{children:[" · ",i("settings.bw.overview.checks",{count:s.coverage.checks})]})]}),r!==null&&e.jsx("p",{className:"bw-gate",children:i("settings.bw.overview.gate",{time:pe(r)})}),l&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:i("settings.bw.key.sweep")}),e.jsx("dd",{children:i("settings.bw.key.sweepText")}),e.jsx("dt",{children:i("settings.bw.key.dot")}),e.jsx("dd",{children:i("settings.bw.key.dotText")}),e.jsx("dt",{children:i("settings.bw.key.ring")}),e.jsx("dd",{children:i("settings.bw.key.ringText")})]})]})}function Me({watching:s,rest:a}){const t=P(),[i,l]=h.useState(!1),[d,o]=h.useState(!1);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:[t("settings.bw.profiles"),e.jsx("button",{className:"bw-help",onClick:()=>l(n=>!n),"aria-expanded":i,"aria-label":t("settings.bw.profiles.help"),children:"?"})]}),i&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:t("settings.bw.key.running")}),e.jsx("dd",{children:t("settings.bw.key.runningText")}),e.jsx("dt",{children:t("settings.bw.key.connected")}),e.jsx("dd",{children:t("settings.bw.key.connectedText")})]}),e.jsx("ul",{className:"bw-profiles",children:s.map(n=>e.jsxs("li",{children:[e.jsx("span",{className:`bw-prof-dot${n.running?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-prof-name",children:n.name}),e.jsx("span",{className:"bw-prof-state",children:n.running?t("settings.bw.running"):t("settings.bw.idle")}),n.running&&n.relay.state==="live"&&e.jsx("span",{className:"bw-relay",children:t("settings.bw.relay")})]},n.key))}),a.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>o(n=>!n),"aria-expanded":d,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:d?"▾":"▸"})," ",t("settings.bw.notWatched",{count:a.length})]}),d&&e.jsx("p",{className:"bw-rest",children:t("settings.bw.notWatchedText",{names:a.map(n=>n.name).join(", ")})})]})]})}function Se({snap:s,quiet:a,setQuiet:t,save:i,access:l,setAccess:d}){const o=P();return e.jsxs("div",{className:"bw-settings",children:[e.jsxs("label",{title:o("settings.bw.quiet.tip"),children:[e.jsx("span",{children:o("settings.bw.quiet.label")}),e.jsx("select",{value:a??s.settings.quietMinutes,onChange:n=>{t(Number(n.target.value)),i({quietMinutes:Number(n.target.value)})},children:[1,5,15,30,60].map(n=>e.jsx("option",{value:n,children:o("settings.bw.minutes",{n})},n))})]}),e.jsxs("label",{children:[e.jsx("span",{children:o("settings.bw.reaction.label")}),e.jsx("select",{value:s.settings.reaction,onChange:n=>void i({reaction:n.target.value}),disabled:!s.settings.enabled,title:s.settings.enabled?o("settings.bw.reaction.hintOn"):o("settings.bw.reaction.hintOff"),children:(s.reactions??["notify"]).map(n=>e.jsx("option",{value:n,children:o(n==="notify"?"settings.bw.reaction.notify":n==="close-tab"?"settings.bw.reaction.closeTab":"settings.bw.reaction.quit")},n))})]}),e.jsxs("div",{className:"bw-settings-note",children:[e.jsxs("p",{children:[o("settings.bw.note.chrome")," ",e.jsx("strong",{children:o("settings.bw.note.usually")})]}),e.jsxs("button",{className:"bw-why",onClick:()=>d(n=>!n),"aria-expanded":l,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:l?"▾":"▸"})," ",o("settings.bw.access.toggle")]}),l&&e.jsxs("dl",{className:"bw-access",children:[e.jsx("dt",{children:o("settings.bw.access.reads")}),e.jsx("dd",{children:o("settings.bw.access.readsText",{when:new Date(s.coverage.startedMs).toLocaleString(V())})}),e.jsx("dt",{children:o("settings.bw.access.keeps")}),e.jsx("dd",{children:ne(o("settings.bw.access.keepsText",{path:"{path}",size:typeof s.coverage.logBytes=="number"?` (${je(s.coverage.logBytes)})`:""}),{path:e.jsx("code",{className:"bw-path",children:s.coverage.logPath})})}),e.jsx("dt",{children:o("settings.bw.access.sends")}),e.jsx("dd",{children:o("settings.bw.access.sendsText")}),e.jsx("dt",{children:o("settings.bw.access.never")}),e.jsx("dd",{children:o("settings.bw.access.neverText")})]})]})]})}function Pe(s,a,t){return a?{kind:"saving",word:t("settings.bw.mode.saving")}:s.settings.enabled?{kind:"on",word:t("settings.bw.mode.watching")}:{kind:"off",word:t("settings.bw.mode.paused")}}function Te({snap:s,saving:a,save:t,why:i,setWhy:l}){const d=P(),o=Pe(s,a,d);return e.jsxs("footer",{className:"bw-status",children:[e.jsx("span",{className:`bw-mode-dot${s.settings.enabled?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-mode-word",children:o.word},o.kind),e.jsx("span",{className:"bw-status-text",children:s.coverage.archived===0?s.settings.enabled?d("settings.bw.disk.none"):d("settings.bw.disk.noneOff"):d("settings.bw.disk.some",{count:s.coverage.archived})}),e.jsx("button",{className:`glyph-btn bw-gear${i?" on":""}`,onClick:()=>l(n=>!n),"aria-expanded":i,"aria-label":d("settings.bw.settings"),title:d("settings.bw.settings"),children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[e.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),e.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),e.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[e.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:d("settings.bw.switch")}),e.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":s.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"switch",onClick:()=>void t({enabled:!s.settings.enabled}),title:s.settings.enabled?d("settings.bw.switch.on"):d("settings.bw.switch.off"),children:e.jsx("span",{className:"switch-knob"})})]})]})}function Ce({relay:s}){const a=P(),[t,i]=h.useState(!1),[l,d]=h.useState(!1),o=s.killswitch.blocked?"unblock":"block",n=s.command[o],r=h.useCallback(async()=>{await ae(n.command)&&(d(!0),window.setTimeout(()=>d(!1),1600))},[n.command]),w=s.profiles.filter(c=>{var u;return(u=c.report)==null?void 0:u.present}),b=s.profiles.filter(c=>c.report===null);return e.jsxs("section",{className:"bw-sec",children:[e.jsx("h4",{className:"bw-sec-head",children:a("shell.remote.title")}),e.jsx("p",{className:`bw-rc-verdict ${s.verdict}`,role:"status",children:s.verdict==="exposed"?a("shell.remote.exposed"):s.verdict==="protected"?a("shell.remote.protected",{path:s.hostsPath}):a("shell.remote.nothing")}),s.killswitch.foreign.length>0&&e.jsxs("p",{className:"bw-rc-foreign",children:[a("shell.remote.foreign",{path:s.hostsPath}),s.killswitch.foreign.map(c=>e.jsx("code",{className:"bw-path",children:c},c))]}),e.jsxs("button",{className:"bw-why",onClick:()=>i(c=>!c),"aria-expanded":t,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",s.verdict==="protected"?a("shell.remote.undo"):a("shell.remote.reach")]}),t&&e.jsxs("div",{className:"bw-rc-body",children:[w.length>0&&e.jsx("dl",{className:"bw-key",children:w.map(c=>e.jsxs(h.Fragment,{children:[e.jsxs("dt",{children:[c.name,c.profile==="Default"?"":` · ${c.profile}`]}),e.jsxs("dd",{children:[a("shell.remote.detail",{state:c.report.enabled?a("shell.remote.enabled"):a("shell.remote.switchedOff"),scope:c.report.allUrls?a("shell.remote.allSites"):a("shell.remote.limited")}),c.report.sensitiveApis.length>0&&e.jsxs(e.Fragment,{children:[" — ",c.report.sensitiveApis.join(", ")]})]})]},`${c.browser}/${c.profile}`))}),b.length>0&&e.jsx("p",{className:"bw-rc-note",children:a("shell.remote.unreadable",{names:b.map(c=>c.name).join(", ")})}),!s.hostsRead&&e.jsx("p",{className:"bw-rc-note",children:a("shell.remote.hostsUnread",{path:s.hostsPath})}),w.some(c=>c.report.allUrls)&&e.jsx("p",{className:"bw-rc-note",children:ie(a("shell.remote.narrow"),"code",e.jsx("code",{className:"bw-path",children:"chrome://extensions"}))}),e.jsxs("div",{className:"bw-rc-cmd",children:[e.jsx("code",{children:n.command}),e.jsx("button",{className:"btn bw-rc-copy",onClick:r,children:a(l?"shell.copied":"shell.copy")})]}),e.jsx("p",{className:"bw-rc-note",children:n.note})]})]})}function Re(s){const[a,t]=h.useState(null),[i,l]=h.useState(null),[d,o]=h.useState(null),[n,r]=h.useState(!1),w=h.useRef(!1),[b,c]=h.useState(null),[u,g]=h.useState(!1),p=h.useRef(!1),x=h.useCallback(async m=>{var y,A;if(!(m&&!re(w.current))){m&&(w.current=!0,r(!0));try{const k=await fetch(`/api/browser-watch${m?"?refresh=1":""}`);if(!k.ok)throw new J(I("settings.bw.deckAnswered",{status:k.status}));const v=await k.json();t(v),p.current||c(((y=v==null?void 0:v.settings)==null?void 0:y.quietMinutes)??15),s(((A=v==null?void 0:v.settings)==null?void 0:A.enabled)===!0),l(null)}catch(k){l(Q(k,I("settings.bw.noAnswer")))}finally{m&&(w.current=!1,r(!1))}}},[s]);h.useEffect(()=>{x(!1)},[x]),h.useEffect(()=>{const m=setInterval(()=>{x(!1)},1e4);return()=>clearInterval(m)},[x]);const W=h.useCallback(async m=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:m.host,startMs:m.startMs})})}finally{await x(!1)}},[x]),T=h.useCallback(async m=>{p.current=!0,g(!0);try{const y=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(m)});if(!y.ok)throw new J(I("settings.bw.deckAnswered",{status:y.status}));await x(!1),o(null)}catch(y){o(Q(y,I("settings.bw.noAnswer")))}finally{p.current=!1,g(!1)}},[x]);return{snap:a,error:i,writeError:d,setWriteError:o,busy:n,quiet:b,setQuiet:c,saving:u,load:x,dismiss:W,save:T}}function Ae({onClose:s,onSeen:a,onWatching:t,palette:i}){const l=P(),d=le(s),o=ce(s),{snap:n,error:r,writeError:w,setWriteError:b,busy:c,quiet:u,setQuiet:g,saving:p,load:x,dismiss:W,save:T}=Re(t),[m,y]=h.useState(!1),[A,k]=h.useState(!1),v=h.useRef(null),F=h.useRef(a);F.current=a,h.useEffect(()=>()=>F.current(Date.now()),[]);const R=X(n==null?void 0:n.browsers),C=((n==null?void 0:n.browsers)??[]).filter(f=>!(f.installed&&f.profiles>0)),S=n?ye(n,l):null,$=R.reduce((f,N)=>f+N.profiles,0);return e.jsx("div",{className:"modal-backdrop",...o,role:"presentation",children:e.jsxs("div",{ref:d,className:"modal bw-modal",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[e.jsxs("header",{className:"modal-head",children:[e.jsxs("div",{className:"modal-title",children:[e.jsx("span",{className:"modal-tool-name",id:"bw-title",children:l("settings.bw.title")}),e.jsx("span",{className:"modal-tool-id",children:n?l("settings.bw.scope.profiles",{count:$}):l("settings.bw.scope.localOnly")})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{ref:v,className:"glyph-btn",onClick:()=>void x(!0),...de(c),"aria-label":l("settings.bw.reread"),title:l("settings.bw.reread"),children:c?"…":e.jsx(oe,{})}),e.jsx("button",{className:"glyph-btn",onClick:s,"aria-label":l("settings.bw.close"),title:l("settings.bw.close"),children:"×"})]})]}),e.jsxs("div",{className:"modal-body bw-body",children:[!n&&!r&&e.jsxs("div",{className:"bw-loading",children:[e.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),e.jsx("p",{children:l("settings.bw.loading")})]}),r&&e.jsx("div",{className:"bw-state",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:l("settings.bw.readFail")}),e.jsx("span",{className:"bw-row-detail",children:r})]})}),n&&S&&e.jsx("p",{className:`bw-trouble ${S.kind}`,role:"status",children:S.text}),n&&e.jsxs("div",{className:"bw-work",children:[e.jsxs("aside",{className:"bw-side",children:[e.jsx(ke,{snap:n,watching:R,palette:i}),e.jsx(Me,{watching:R,rest:C}),n.relay&&e.jsx(Ce,{relay:n.relay})]}),e.jsxs("div",{className:"bw-main",children:[e.jsx(ue,{snap:n,dismiss:W,refreshRef:v}),e.jsx(he,{snap:n})]})]}),n&&m&&e.jsx(Se,{snap:n,quiet:u,setQuiet:g,save:T,access:A,setAccess:k}),w&&e.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:l("settings.bw.saveFail")}),e.jsx("span",{className:"bw-row-detail",children:l("settings.bw.saveFailDetail",{error:w})}),e.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>b(null),"aria-label":l("settings.bw.dismiss"),title:l("settings.bw.dismiss"),children:"×"})]})}),n&&e.jsx(Te,{snap:n,saving:p,save:T,why:m,setWhy:y})]})]})})}export{Ae as default};
1
+ import{u as P,j as e,b as h,a1 as Z,a2 as ee,e as V,t as I,a3 as se,g as te,a4 as ne,x as ae,a5 as ie,s as re,a6 as J,o as Q,C as le,D as ce,R as oe,i as de}from"./app-CoVinTuS.js";function he({snap:s}){const a=P();return e.jsxs("section",{className:"bw-feed",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:[a("settings.bw.feed"),e.jsx("span",{className:"bw-feed-count",children:a("settings.bw.feed.count",{count:s.log.length})})]}),e.jsx("p",{className:"bw-since bw-feed-note",children:a("settings.bw.feed.note")}),e.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:s.log.length===0?e.jsx("p",{className:"bw-note",children:a("settings.bw.feed.empty")}):s.log.map(t=>e.jsxs("div",{className:`bw-log-line ${t.level}${t.parts?"":" sys"}`,children:[e.jsx("span",{className:"bw-log-time",children:new Date(t.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),t.parts?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bw-log-browser",children:t.parts.browser}),e.jsx("span",{className:"bw-log-profile",title:t.parts.profile,children:t.parts.profile}),e.jsxs("span",{className:"bw-log-value",children:[t.parts.value,t.parts.flagged>0&&e.jsx("span",{className:"bw-log-flag",children:a("settings.bw.feed.flagged",{count:t.parts.flagged})})]})]}):e.jsx("span",{className:"bw-log-sys",children:t.text})]},`${t.atMs}-${t.level}-${t.text}`))})]})}const D=s=>`${s.host}-${s.startMs}`;function we(s){const a=t=>new Date(t).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return s.count===1||s.endMs-s.startMs<6e4?a(s.startMs):`${a(s.startMs)} → ${a(s.endMs)}`}function be(s){return new Date(s).toLocaleDateString(V(),{weekday:"short",day:"numeric",month:"short"})}function _(s,a){const t=Math.round((s.endMs-s.startMs)/6e4);return t<1?"":a("settings.bw.findings.minutes",{n:t})}function ue({snap:s,dismiss:a,refreshRef:t}){const i=P(),[l,d]=h.useState(null),o=h.useRef(new Map),n=h.useRef(null);h.useEffect(()=>{var c,u;const b=n.current;!b||s.episodes.some(g=>D(g)===b.id)||(n.current=null,Z(((c=document.activeElement)==null?void 0:c.tagName)??null)&&((u=(b.next?o.current.get(b.next):void 0)??t.current)==null||u.focus()))},[s]);const r=b=>{n.current={id:D(b),next:ee(s.episodes.map(D),D(b))},a(b)},w=h.useMemo(()=>{const b=[];for(const c of s.episodes){const u=be(c.startMs),g=b[b.length-1];g&&g.label===u?g.episodes.push(c):b.push({label:u,episodes:[c]})}return b},[s]);return e.jsxs("section",{className:"bw-findings",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:[i("settings.bw.findings"),s.episodes.length>0&&e.jsx("span",{className:"bw-feed-count",children:i("settings.bw.findings.count",{count:s.episodes.length})})]}),e.jsx("div",{className:"bw-eps",children:w.length===0?e.jsxs("div",{className:"bw-empty",children:[e.jsx("p",{className:"bw-empty-head",children:i("settings.bw.findings.none")}),e.jsx("p",{className:"bw-empty-note",children:i("settings.bw.findings.noneNote",{count:s.settings.quietMinutes})}),!s.settings.enabled&&e.jsx("p",{className:"bw-empty-note",children:i("settings.bw.findings.offNote")})]}):w.map(b=>e.jsxs("div",{className:"bw-day",children:[e.jsx("h4",{className:"bw-sec-head",children:b.label}),b.episodes.map(c=>{const u=D(c),g=l===u;return e.jsxs("div",{className:`bw-ep${g?" open":""}`,children:[e.jsxs("div",{className:"bw-ep-row",children:[e.jsxs("button",{className:"bw-ep-head",ref:p=>{p?o.current.set(u,p):o.current.delete(u)},onClick:()=>d(g?null:u),"aria-expanded":g,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:g?"▾":"▸"}),e.jsx("span",{className:"bw-ep-host",children:c.host}),e.jsxs("span",{className:"bw-ep-meta",children:[we(c),_(c,i)&&e.jsxs(e.Fragment,{children:[" · ",_(c,i)]}),c.provisional&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{title:i("settings.bw.findings.provisionalTip"),children:i("settings.bw.findings.provisional")})]})]}),e.jsx("span",{className:"bw-ep-count",children:i("settings.bw.findings.pages",{count:c.count})})]}),e.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>r(c),"aria-label":i("settings.bw.findings.dismissHost",{host:c.host}),title:i("settings.bw.findings.dismissTip"),children:"×"})]}),g&&e.jsx("ul",{className:"bw-urls",children:c.urls.map((p,x)=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-url-time",children:new Date(p.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),e.jsx("span",{className:"bw-url",children:p.url})]},`${p.url}-${p.timeMs}-${x}`))})]},u)})]},b.label))})]})}function ge(s){const a=/^#?([0-9a-f]{6})$/i.exec((s??"").trim());if(!a)return!1;const t=parseInt(a[1],16),i=[t>>16&255,t>>8&255,t&255].map(l=>{const d=l/255;return d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4)});return .2126*i[0]+.7152*i[1]+.0722*i[2]>.5}const z=1e4,me=12e3;function fe({browsers:s,findings:a,watching:t,palette:i}){const l=P(),d=h.useRef(null),o=h.useRef(null);return o.current={browsers:s,findings:a,watching:t},h.useEffect(()=>{var g;const n=d.current;if(!n)return;const r=n.getContext("2d");if(!r)return;const w=((g=window.matchMedia)==null?void 0:g.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let b=0,c=!1;const u=()=>{var U;if(c)return;const p=o.current;if(!p)return;const{browsers:x,findings:W,watching:T}=p,m=i["--accent"]||"#7dd3fc",y=i["--line"]||"#1f2229",A=i["--text-dim"]||"#6e727c",k=ge(i["--bg"]),v=k?42:26,F=k?.85:.65,R=Date.now(),C=Math.min(window.devicePixelRatio||1,2),S=n.clientWidth,$=n.clientHeight;(n.width!==S*C||n.height!==$*C)&&(n.width=S*C,n.height=$*C),r.setTransform(C,0,0,C,0,0),r.clearRect(0,0,S,$);const f=S/2,N=$/2,M=Math.min(S,$)/2-6;r.strokeStyle=y,r.lineWidth=1,r.globalAlpha=k?1:.9;for(const j of[.4,.7,1])r.beginPath(),r.arc(f,N,M*j,0,Math.PI*2),r.stroke();r.beginPath(),r.moveTo(f-M,N),r.lineTo(f+M,N),r.moveTo(f,N-M),r.lineTo(f,N+M),r.stroke(),r.globalAlpha=1;const B=(T&&!w?R%z/z:0)*Math.PI*2-Math.PI/2;if(T){const j=(U=r.createConicGradient)==null?void 0:U.call(r,B-.85,f,N);j&&(j.addColorStop(0,"transparent"),j.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${m} ${v}%, transparent)`),j.addColorStop(1,"transparent"),r.fillStyle=j,r.beginPath(),r.moveTo(f,N),r.arc(f,N,M,B-.85,B),r.closePath(),r.fill()),r.strokeStyle=m,r.globalAlpha=F,r.beginPath(),r.moveTo(f,N),r.lineTo(f+Math.cos(B)*M,N+Math.sin(B)*M),r.stroke(),r.globalAlpha=1}x.forEach((j,E)=>{const O=E/Math.max(x.length,1)*Math.PI*2-Math.PI/2,L=j.lastReadMs===null?1:Math.min(1,(R-j.lastReadMs)/12e4),q=M*(.42+L*.5),G=f+Math.cos(O)*q,K=N+Math.sin(O)*q,Y=Math.abs((B-O+Math.PI*3)%(Math.PI*2)-Math.PI),H=T?Math.max(0,1-Y/.55):0;r.beginPath(),r.arc(G,K,3+H*1.6,0,Math.PI*2),r.fillStyle=j.running?m:A,r.globalAlpha=j.running?.55+H*.45:.35,r.fill(),r.globalAlpha=1});for(const j of W){const E=(R-j.atMs)/me;if(E<0||E>1)continue;const L=Math.max(0,x.findIndex(K=>K.key===j.browser))/Math.max(x.length,1)*Math.PI*2-Math.PI/2,q=f+Math.cos(L)*M*.6,G=N+Math.sin(L)*M*.6;r.beginPath(),r.arc(q,G,4+E*22,0,Math.PI*2),r.strokeStyle=m,r.globalAlpha=(1-E)*.8,r.lineWidth=1.5,r.stroke(),r.globalAlpha=1}b=requestAnimationFrame(u)};return u(),()=>{c=!0,cancelAnimationFrame(b)}},[i]),e.jsx("canvas",{ref:d,className:"bw-radar",role:"img","aria-label":t?l("radar.watch.watching",{count:s.length}):l("radar.watch.idle")})}function xe(s,a,t){if(s===null)return null;const i=s+a-t;return i>0?i:null}function pe(s){const a=Math.ceil(s/1e3),t=Math.floor(a/60),i=a%60;return t>0?`${t}m ${i}s`:`${i}s`}function X(s){return(s??[]).filter(a=>a.installed&&a.profiles>0)}function je(s,a=I){return!Number.isFinite(s)||s<=0?a("settings.bw.logEmpty"):se(s)}function Ne(s,a){return s.map(t=>({key:t.key,name:t.name,running:t.running,visits:a.filter(i=>i.browser===t.key).reduce((i,l)=>i+l.programVisits,0)}))}function ve(s,a,t=I){if(s===null)return null;const i=Math.max(0,Math.round((a-s)/1e3));if(i<5)return t("settings.bw.ago.now");if(i<60)return t("settings.bw.ago.sec",{n:i});const l=Math.round(i/60);return l<60?t("settings.bw.ago.min",{n:l}):t("settings.bw.ago.hr",{n:Math.round(l/60)})}function ye(s,a=I){const t=s.profiles.filter(l=>l.degraded);if(t.length>0){const l=t[0],d=t.length-1;return{kind:"unreadable",text:a(d>0?"settings.bw.trouble.unreadableMore":"settings.bw.trouble.unreadable",{browser:l.name,profile:l.profile,reason:l.reason??a("settings.bw.trouble.noReason"),more:d})}}const i=X(s.browsers);return i.length===0?{kind:"no-profiles",text:a("settings.bw.trouble.noProfiles")}:i.some(l=>l.running)?null:{kind:"none-running",text:a("settings.bw.trouble.noneRunning")}}function ke({snap:s,watching:a,palette:t}){const i=P(),[l,d]=h.useState(!1),[o,n]=h.useState(()=>Date.now());h.useEffect(()=>{const w=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(w)},[]);const r=xe(s.coverage.lastHumanMs,s.coverage.quietMs,o);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:[i("settings.bw.overview"),e.jsx("button",{className:"bw-help",onClick:()=>d(w=>!w),"aria-expanded":l,"aria-label":i("settings.bw.overview.help"),children:"?"})]}),e.jsxs("div",{className:"bw-glance",children:[e.jsx(fe,{browsers:a.map(w=>{var b;return{key:w.key,name:w.name,running:w.running,lastReadMs:((b=s.profiles.find(c=>c.browser===w.key))==null?void 0:b.lastWrittenMs)??null}}),findings:s.episodes.slice(0,6).map(w=>({browser:w.browser??null,atMs:w.endMs})),watching:s.settings.enabled,palette:t}),e.jsx("ul",{className:"bw-counts",children:Ne(a,s.profiles).map(w=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-count-n",children:te(w.visits,0)}),e.jsx("span",{className:"bw-count-of",children:w.name})]},w.key))})]}),e.jsx("p",{className:"bw-since",children:i("settings.bw.overview.since")}),s.coverage.checkedMs>0&&e.jsxs("p",{className:"bw-since",children:[i("settings.bw.overview.checked",{ago:ve(s.coverage.checkedMs,o,i)??""}),s.coverage.checks>0&&e.jsxs(e.Fragment,{children:[" · ",i("settings.bw.overview.checks",{count:s.coverage.checks})]})]}),r!==null&&e.jsx("p",{className:"bw-gate",children:i("settings.bw.overview.gate",{time:pe(r)})}),l&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:i("settings.bw.key.sweep")}),e.jsx("dd",{children:i("settings.bw.key.sweepText")}),e.jsx("dt",{children:i("settings.bw.key.dot")}),e.jsx("dd",{children:i("settings.bw.key.dotText")}),e.jsx("dt",{children:i("settings.bw.key.ring")}),e.jsx("dd",{children:i("settings.bw.key.ringText")})]})]})}function Me({watching:s,rest:a}){const t=P(),[i,l]=h.useState(!1),[d,o]=h.useState(!1);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:[t("settings.bw.profiles"),e.jsx("button",{className:"bw-help",onClick:()=>l(n=>!n),"aria-expanded":i,"aria-label":t("settings.bw.profiles.help"),children:"?"})]}),i&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:t("settings.bw.key.running")}),e.jsx("dd",{children:t("settings.bw.key.runningText")}),e.jsx("dt",{children:t("settings.bw.key.connected")}),e.jsx("dd",{children:t("settings.bw.key.connectedText")})]}),e.jsx("ul",{className:"bw-profiles",children:s.map(n=>e.jsxs("li",{children:[e.jsx("span",{className:`bw-prof-dot${n.running?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-prof-name",children:n.name}),e.jsx("span",{className:"bw-prof-state",children:n.running?t("settings.bw.running"):t("settings.bw.idle")}),n.running&&n.relay.state==="live"&&e.jsx("span",{className:"bw-relay",children:t("settings.bw.relay")})]},n.key))}),a.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>o(n=>!n),"aria-expanded":d,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:d?"▾":"▸"})," ",t("settings.bw.notWatched",{count:a.length})]}),d&&e.jsx("p",{className:"bw-rest",children:t("settings.bw.notWatchedText",{names:a.map(n=>n.name).join(", ")})})]})]})}function Se({snap:s,quiet:a,setQuiet:t,save:i,access:l,setAccess:d}){const o=P();return e.jsxs("div",{className:"bw-settings",children:[e.jsxs("label",{title:o("settings.bw.quiet.tip"),children:[e.jsx("span",{children:o("settings.bw.quiet.label")}),e.jsx("select",{value:a??s.settings.quietMinutes,onChange:n=>{t(Number(n.target.value)),i({quietMinutes:Number(n.target.value)})},children:[1,5,15,30,60].map(n=>e.jsx("option",{value:n,children:o("settings.bw.minutes",{n})},n))})]}),e.jsxs("label",{children:[e.jsx("span",{children:o("settings.bw.reaction.label")}),e.jsx("select",{value:s.settings.reaction,onChange:n=>void i({reaction:n.target.value}),disabled:!s.settings.enabled,title:s.settings.enabled?o("settings.bw.reaction.hintOn"):o("settings.bw.reaction.hintOff"),children:(s.reactions??["notify"]).map(n=>e.jsx("option",{value:n,children:o(n==="notify"?"settings.bw.reaction.notify":n==="close-tab"?"settings.bw.reaction.closeTab":"settings.bw.reaction.quit")},n))})]}),e.jsxs("div",{className:"bw-settings-note",children:[e.jsxs("p",{children:[o("settings.bw.note.chrome")," ",e.jsx("strong",{children:o("settings.bw.note.usually")})]}),e.jsxs("button",{className:"bw-why",onClick:()=>d(n=>!n),"aria-expanded":l,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:l?"▾":"▸"})," ",o("settings.bw.access.toggle")]}),l&&e.jsxs("dl",{className:"bw-access",children:[e.jsx("dt",{children:o("settings.bw.access.reads")}),e.jsx("dd",{children:o("settings.bw.access.readsText",{when:new Date(s.coverage.startedMs).toLocaleString(V())})}),e.jsx("dt",{children:o("settings.bw.access.keeps")}),e.jsx("dd",{children:ne(o("settings.bw.access.keepsText",{path:"{path}",size:typeof s.coverage.logBytes=="number"?` (${je(s.coverage.logBytes)})`:""}),{path:e.jsx("code",{className:"bw-path",children:s.coverage.logPath})})}),e.jsx("dt",{children:o("settings.bw.access.sends")}),e.jsx("dd",{children:o("settings.bw.access.sendsText")}),e.jsx("dt",{children:o("settings.bw.access.never")}),e.jsx("dd",{children:o("settings.bw.access.neverText")})]})]})]})}function Pe(s,a,t){return a?{kind:"saving",word:t("settings.bw.mode.saving")}:s.settings.enabled?{kind:"on",word:t("settings.bw.mode.watching")}:{kind:"off",word:t("settings.bw.mode.paused")}}function Te({snap:s,saving:a,save:t,why:i,setWhy:l}){const d=P(),o=Pe(s,a,d);return e.jsxs("footer",{className:"bw-status",children:[e.jsx("span",{className:`bw-mode-dot${s.settings.enabled?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-mode-word",children:o.word},o.kind),e.jsx("span",{className:"bw-status-text",children:s.coverage.archived===0?s.settings.enabled?d("settings.bw.disk.none"):d("settings.bw.disk.noneOff"):d("settings.bw.disk.some",{count:s.coverage.archived})}),e.jsx("button",{className:`glyph-btn bw-gear${i?" on":""}`,onClick:()=>l(n=>!n),"aria-expanded":i,"aria-label":d("settings.bw.settings"),title:d("settings.bw.settings"),children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[e.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),e.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),e.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[e.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:d("settings.bw.switch")}),e.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":s.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"switch",onClick:()=>void t({enabled:!s.settings.enabled}),title:s.settings.enabled?d("settings.bw.switch.on"):d("settings.bw.switch.off"),children:e.jsx("span",{className:"switch-knob"})})]})]})}function Ce({relay:s}){const a=P(),[t,i]=h.useState(!1),[l,d]=h.useState(!1),o=s.killswitch.blocked?"unblock":"block",n=s.command[o],r=h.useCallback(async()=>{await ae(n.command)&&(d(!0),window.setTimeout(()=>d(!1),1600))},[n.command]),w=s.profiles.filter(c=>{var u;return(u=c.report)==null?void 0:u.present}),b=s.profiles.filter(c=>c.report===null);return e.jsxs("section",{className:"bw-sec",children:[e.jsx("h4",{className:"bw-sec-head",children:a("shell.remote.title")}),e.jsx("p",{className:`bw-rc-verdict ${s.verdict}`,role:"status",children:s.verdict==="exposed"?a("shell.remote.exposed"):s.verdict==="protected"?a("shell.remote.protected",{path:s.hostsPath}):a("shell.remote.nothing")}),s.killswitch.foreign.length>0&&e.jsxs("p",{className:"bw-rc-foreign",children:[a("shell.remote.foreign",{path:s.hostsPath}),s.killswitch.foreign.map(c=>e.jsx("code",{className:"bw-path",children:c},c))]}),e.jsxs("button",{className:"bw-why",onClick:()=>i(c=>!c),"aria-expanded":t,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",s.verdict==="protected"?a("shell.remote.undo"):a("shell.remote.reach")]}),t&&e.jsxs("div",{className:"bw-rc-body",children:[w.length>0&&e.jsx("dl",{className:"bw-key",children:w.map(c=>e.jsxs(h.Fragment,{children:[e.jsxs("dt",{children:[c.name,c.profile==="Default"?"":` · ${c.profile}`]}),e.jsxs("dd",{children:[a("shell.remote.detail",{state:c.report.enabled?a("shell.remote.enabled"):a("shell.remote.switchedOff"),scope:c.report.allUrls?a("shell.remote.allSites"):a("shell.remote.limited")}),c.report.sensitiveApis.length>0&&e.jsxs(e.Fragment,{children:[" — ",c.report.sensitiveApis.join(", ")]})]})]},`${c.browser}/${c.profile}`))}),b.length>0&&e.jsx("p",{className:"bw-rc-note",children:a("shell.remote.unreadable",{names:b.map(c=>c.name).join(", ")})}),!s.hostsRead&&e.jsx("p",{className:"bw-rc-note",children:a("shell.remote.hostsUnread",{path:s.hostsPath})}),w.some(c=>c.report.allUrls)&&e.jsx("p",{className:"bw-rc-note",children:ie(a("shell.remote.narrow"),"code",e.jsx("code",{className:"bw-path",children:"chrome://extensions"}))}),e.jsxs("div",{className:"bw-rc-cmd",children:[e.jsx("code",{children:n.command}),e.jsx("button",{className:"btn bw-rc-copy",onClick:r,children:a(l?"shell.copied":"shell.copy")})]}),e.jsx("p",{className:"bw-rc-note",children:n.note})]})]})}function Re(s){const[a,t]=h.useState(null),[i,l]=h.useState(null),[d,o]=h.useState(null),[n,r]=h.useState(!1),w=h.useRef(!1),[b,c]=h.useState(null),[u,g]=h.useState(!1),p=h.useRef(!1),x=h.useCallback(async m=>{var y,A;if(!(m&&!re(w.current))){m&&(w.current=!0,r(!0));try{const k=await fetch(`/api/browser-watch${m?"?refresh=1":""}`);if(!k.ok)throw new J(I("settings.bw.deckAnswered",{status:k.status}));const v=await k.json();t(v),p.current||c(((y=v==null?void 0:v.settings)==null?void 0:y.quietMinutes)??15),s(((A=v==null?void 0:v.settings)==null?void 0:A.enabled)===!0),l(null)}catch(k){l(Q(k,I("settings.bw.noAnswer")))}finally{m&&(w.current=!1,r(!1))}}},[s]);h.useEffect(()=>{x(!1)},[x]),h.useEffect(()=>{const m=setInterval(()=>{x(!1)},1e4);return()=>clearInterval(m)},[x]);const W=h.useCallback(async m=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:m.host,startMs:m.startMs})})}finally{await x(!1)}},[x]),T=h.useCallback(async m=>{p.current=!0,g(!0);try{const y=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(m)});if(!y.ok)throw new J(I("settings.bw.deckAnswered",{status:y.status}));await x(!1),o(null)}catch(y){o(Q(y,I("settings.bw.noAnswer")))}finally{p.current=!1,g(!1)}},[x]);return{snap:a,error:i,writeError:d,setWriteError:o,busy:n,quiet:b,setQuiet:c,saving:u,load:x,dismiss:W,save:T}}function Ae({onClose:s,onSeen:a,onWatching:t,palette:i}){const l=P(),d=le(s),o=ce(s),{snap:n,error:r,writeError:w,setWriteError:b,busy:c,quiet:u,setQuiet:g,saving:p,load:x,dismiss:W,save:T}=Re(t),[m,y]=h.useState(!1),[A,k]=h.useState(!1),v=h.useRef(null),F=h.useRef(a);F.current=a,h.useEffect(()=>()=>F.current(Date.now()),[]);const R=X(n==null?void 0:n.browsers),C=((n==null?void 0:n.browsers)??[]).filter(f=>!(f.installed&&f.profiles>0)),S=n?ye(n,l):null,$=R.reduce((f,N)=>f+N.profiles,0);return e.jsx("div",{className:"modal-backdrop",...o,role:"presentation",children:e.jsxs("div",{ref:d,className:"modal bw-modal",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[e.jsxs("header",{className:"modal-head",children:[e.jsxs("div",{className:"modal-title",children:[e.jsx("span",{className:"modal-tool-name",id:"bw-title",children:l("settings.bw.title")}),e.jsx("span",{className:"modal-tool-id",children:n?l("settings.bw.scope.profiles",{count:$}):l("settings.bw.scope.localOnly")})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{ref:v,className:"glyph-btn",onClick:()=>void x(!0),...de(c),"aria-label":l("settings.bw.reread"),title:l("settings.bw.reread"),children:c?"…":e.jsx(oe,{})}),e.jsx("button",{className:"glyph-btn",onClick:s,"aria-label":l("settings.bw.close"),title:l("settings.bw.close"),children:"×"})]})]}),e.jsxs("div",{className:"modal-body bw-body",children:[!n&&!r&&e.jsxs("div",{className:"bw-loading",children:[e.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),e.jsx("p",{children:l("settings.bw.loading")})]}),r&&e.jsx("div",{className:"bw-state",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:l("settings.bw.readFail")}),e.jsx("span",{className:"bw-row-detail",children:r})]})}),n&&S&&e.jsx("p",{className:`bw-trouble ${S.kind}`,role:"status",children:S.text}),n&&e.jsxs("div",{className:"bw-work",children:[e.jsxs("aside",{className:"bw-side",children:[e.jsx(ke,{snap:n,watching:R,palette:i}),e.jsx(Me,{watching:R,rest:C}),n.relay&&e.jsx(Ce,{relay:n.relay})]}),e.jsxs("div",{className:"bw-main",children:[e.jsx(ue,{snap:n,dismiss:W,refreshRef:v}),e.jsx(he,{snap:n})]})]}),n&&m&&e.jsx(Se,{snap:n,quiet:u,setQuiet:g,save:T,access:A,setAccess:k}),w&&e.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:l("settings.bw.saveFail")}),e.jsx("span",{className:"bw-row-detail",children:l("settings.bw.saveFailDetail",{error:w})}),e.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>b(null),"aria-label":l("settings.bw.dismiss"),title:l("settings.bw.dismiss"),children:"×"})]})}),n&&e.jsx(Te,{snap:n,saving:p,save:T,why:m,setWhy:y})]})]})})}export{Ae as default};