Commit Graph
3184 Commits
Author SHA1 Message Date
Jason 1c52fa918d fix(providers): reread additive client state when a removal is refused
Kimi Code saves every /model pick as default_model, so the default shown
in CC Switch can go stale while the page stays open. The backend rereads
config.toml and refuses to remove the provider Kimi Code is using, but
the page kept showing the old default and an untranslated English reason.

Reread the additive app's live state after a failed removal as well as a
successful one (now including the OpenCode, OpenClaw and Hermes default
model queries), reread Kimi providers after failed edits and deletions,
and explain the two Kimi "model in use" refusals in all four locales.
2026-10-23 11:42:12 +08:00
Jason c6f85464e7 style(usage): restore the original trend chart and heatmap colors
Point --chart-usage back at --chart-1 and restore the heatmap's darkest
light-mode step (#0e7490), so the usage charts look as they did before
#8711. The separate token stays, so a later color change does not touch
the quota bars that also use --chart-1.
2026-10-23 11:21:04 +08:00
Jason 29f8bef378 fix(usage): clamp the request log page when the total shrinks
When the user sat on page 2+ and the total dropped (the "today" window
rolled over, Codex usage was rebuilt), the page index stayed out of
range. With a single page the pagination bar is hidden, leaving an
empty table with no way back. Pull the page back to the last valid one
once real (non-placeholder) data arrives.
2026-10-23 11:15:39 +08:00
Jason f4e9211a11 fix(panel): let Escape close only the topmost full-screen panel
Each FullScreenPanel adds its own keydown listener on window, and
stopPropagation does not stop other listeners on the same target, so
stacked panels (pricing -> pricing editor, edit provider -> endpoint
speed test) all closed on a single Escape. Track open panels in a
module-level stack and only let the top one react.
2026-10-23 11:15:39 +08:00
Jason 7cc3141cae style(providers): mark additive default providers in blue
The default provider in OpenCode, OpenClaw, Hermes and Kimi used a gray
card and dot. Use the same blue as an in-use switch-mode card instead,
and drop the now-unused neutral card tone.
2026-10-23 11:15:35 +08:00
Jason d6a2324196 feat(kimi): give provider cards real add/remove actions
Kimi is additive, but both card groups only offered "Switch", which
wrote the provider into config.toml and changed default_model at once,
so the Added / Available split did nothing.

- Available cards get "Add": a new add_provider_to_live_config command
  writes the provider and its models into config.toml without changing
  default_model, so they show up in Kimi's /model list. A node already in
  config.toml belongs to Kimi and is never overwritten from the archive.
- Added cards get a "Remove" button; "Set as default" (select the
  provider's model) moves into the more menu, as for OpenCode/OpenClaw.
- The provider owning default_model is marked with the gray "Default"
  status like OpenCode, and cannot be removed.
2026-10-23 11:15:35 +08:00
Jason 44e0fc9630 feat(kimi): name separate official accounts "Kimi 订阅 <nickname>"
Kimi Code shows a provider's key as its name in the model picker, so
separate accounts appeared as "kimi-code-ccs-<hash>". New separate
accounts are now keyed "Kimi 订阅 <nickname>" ("Kimi Subscription" when
CC Switch is not in Chinese), matching Kimi's own label for its default
login and limited to the characters Kimi accepts, numbered on clashes.

The credential slot and model aliases keep the stable
"kimi-code-ccs-<hash>" name, so default_model stays an ASCII key and
ownership checks are unchanged. A returning account is also recognised
by its credential slot, not only by the local identity cache. Card names
fall back to the readable key when no nickname is cached.
2026-10-23 11:15:35 +08:00
Jason c49c2be94b refactor(kimi): render Auth Center accounts with the shared account group
Kimi's account list drew its own layout (inline description, a permanent
region picker, highlighted current row, extra badges). It now uses the
same ManagedAccountsGroup as Copilot, ChatGPT, xAI and Antigravity:
help behind "?", region chosen when adding an account, "In use by Kimi"
badge, nickname and avatar, shared pending/error blocks, and a
"needs re-login" state for signed-out accounts.

The shared group gains optional per-row remove label and disabled
reason, an optional "remove all" action, and a looser device-code type.
Account action failures now toast instead of reusing the login error
block. Unused Kimi strings are removed from all locales.
2026-10-23 11:15:35 +08:00
Jason e12415b5ba refactor(providers): move OpenCode/OpenClaw set-default into the more menu
The icon-only star on added OpenCode/OpenClaw cards was hard to read and
had no selected state. "Set as default" now sits at the top of the card's
more menu, like the aggregation page; providers with several models open
a submenu to pick the default model. The card keeps only the remove
button, and the primary button no longer needs its own dropdown.
2026-10-23 11:15:35 +08:00
Jason cdd2190df2 feat(kimi): identify, remove and show quota for official accounts
Follow-up to #8726, which lets the Authorization Center hold several Kimi
official subscriptions, each with its own provider and credential slot.

Identity: after sign-in (and for logins found on disk) read /me to show
the account's nickname on its row and card. Signing in to an account that
is already listed writes back to its slot instead of adding a duplicate,
and the slot is chosen when the login completes, so a native Kimi login
made meanwhile is never overwritten. New separate slots are named from a
hash of region and user id, stable across devices. Opening the Kimi page
reads identities too, so card names carry the nickname without a visit to
the Authorization Center first.

Remove instead of sign out: a separate account is deleted together with
its provider node, models, credential and card (refused while in use);
web search/fetch pointing at it moves to Kimi's own default login. Kimi's
own login is only hidden from the list - CC Switch never logs Kimi out -
and stays hidden across Kimi's token rotations until the user signs in to
it again here. An empty list caused by that says so instead of "signed
out".

Quota: each account row and official card shows its quota. Tokens close
to expiry are refreshed under the same proper-lockfile-compatible lock
Kimi uses (mkdir <slot>.lock, 5 s stale takeover), with Kimi's revoked
token recovery. Windows, where Kimi takes no lock, only reads.

Also: re-login keeps custom fields such as custom_headers on the node;
deleting a card whose node was removed elsewhere deletes the leftover
CC Switch-owned credential; the card's switch button works for official
accounts after checking they are signed in on this machine; account rows
use the same compact layout as the other Authorization Center groups.
2026-10-23 11:15:35 +08:00
Jason e88ff5404d test(usage): scope Codex parent-cache count assertions to each test's dir
The parent_rollout_* tests asserted on the total size of the process-wide
CODEX_REPLAY_CACHES.parent_timelines map. #[serial_test::serial] only
excludes other serial tests, while non-serial tests such as
test_parse_codex_file_recognizes_branch_thread_paginated_continuation
reach load_parent_timeline (via resolve_continuation_baseline) and insert
their own entries concurrently. Under multi-threaded `cargo test` that
occasionally turned an expected count of 1 into 2; nextest's
process-per-test model hid it in CI.

Count only entries under the test's temp dir instead. Production code is
unchanged.
2026-10-23 11:15:35 +08:00
Jason 0640c6fcc7 fix(codex): never turn image input off when filling fetched model metadata
Picking a model from the fetched list fills its empty catalog fields from
known metadata (same-endpoint preset, models.dev). For a model the lookup
reported as text-only, the Codex fill wrote inputModalities ["text"].

For Codex an absent inputModalities is not "unknown = text": the backend
checks the exact text-only registry and otherwise fails open to
["text", "image"]. Writing ["text"] therefore switched image input off,
against the fill rule that modalities are only ever turned toward
"supported", and the Codex form has no control to switch it back, so
Codex kept refusing image attachments for that model.

Only fill inputModalities when the metadata includes image; otherwise
leave it absent and let the registry and fail-open default decide.

Refs #8682
2026-10-23 11:15:35 +08:00
Jason ce098caf22 fix(about): detach the shell version probe from the controlling terminal
try_get_version still ran `$SHELL -lic "<tool> --version"` via a bare
output(), so when CC Switch was launched from a terminal on Linux/WSL the
interactive shell kept the controlling tty, got stopped by SIGTTIN, and
opening Settings -> About froze the whole app.

Spawn it like resolve_path_default / login_shell_path already do: stdin
null, isolate_child_process_group (setsid) and the 10s probe deadline.
-lic is kept so PATH entries from .bashrc are still picked up; a timeout
falls back to the existing directory scan.

Fixes #3241
2026-10-23 11:15:35 +08:00
Jason 91fc2fcbf7 fix(codex): split the stack comp_hash by tool protocol
In the merged (stack) catalog every third-party row shared one comp_hash,
"cc-switch", so Codex never compacted when switching between them (#8485).
Third-party GPT rows mirror the official entry and carry
`tool_mode: "code_mode_only"`, where shell calls are recorded as the
custom tool `exec`; DeepSeek, Kimi and other rows are direct and only have
`exec_command`. After switching from a GPT row to a direct row without
compaction, the direct model copied the `exec` calls from history and
every turn failed with `unsupported call: exec`.

Group rows by tool protocol instead: a row with a tool_mode gets
"cc-switch-<tool_mode>", direct rows keep "cc-switch" so existing
sessions see no change. Switching within a group still skips compaction;
switching across groups compacts with the previous model first, which
folds the other protocol's calls into the summary. tool_mode and
supports_search_tool keep the template values, so third-party GPT rows
keep code mode. The cost is that a cross-group switch away from a
provider that is no longer usable fails to compact, as before #8485;
switching within the group or starting a new session avoids it.

Fixes #8676
2026-10-23 11:15:35 +08:00
mashiro 79ba7982aa feat(usage): restructure the usage page layout (#8711)
* feat(usage): restructure the usage page layout

- Header: one sync button that shows when it last synced, next to a settings
  button; the settings sheet now holds data sources, display and pricing.
- Scope bar: date first, app chips, and one cascading provider / model menu.
- Overview: a selectable metric strip drives the trend chart and heatmap; the
  four token parts fold into an expandable second row. Hit-rate axis starts
  near the lowest value; hourly labels are short; new terracotta chart color.
- Detail panel: tabs with counts; tables scroll sideways at natural column
  widths, pin the time / app columns, group columns with wider gaps, and
  animate rows that arrive on refresh.
- Request detail drawer: no per-row dividers, no duplicate session rows.
- Empty values show an em dash; dark-mode surfaces use one token per role.

* feat(usage): let people pick how many request logs fit on a page

The pagination bar gets a rows-per-page menu (10 / 20 / 50, default 20),
remembered on this device. It stays visible on a single page as long as
there are more rows than the smallest size, so a larger choice can still be
undone. Changing the size keeps the first visible row on screen, and the
rows it adds are not animated as newly arrived requests.

* fix(usage): polish details found in review

- New-row highlight keeps a pinned column's edge shadow instead of replacing it.
- Pinned cells only follow row hover on rows that can be clicked.
- Update a stale comment about the metric strip spacing.

* fix(usage): fix issues found in branch review

- Heatmap in hit-rate mode: a day with traffic but a 0% hit rate is now
  shaded instead of looking idle, and the tooltip shows the hit rate.
  The heatmap reuses the trend chart's hitRateOf instead of its own copy.
- Turkish: add the request log column labels and the columns menu title.
- Sync button: when auto scan is off, the tooltip says so.
- Columns menu: concurrent saves no longer drop later toggles; a failed
  save reverts only once the last save returns.
- Tab counts query only the open tab; other tabs show their cached count.
- UsageDashboard uses the shared useElementWidth instead of its own copy.
- Note the two-column limit of the pinned-column offset.

* fix(usage): keep heatmap tooltip rows on one line

The added hit-rate row made the label column wider, so the card near
the right edge wrapped values like "7640.5 万" and the label itself.

* fix(usage): shorten the auto-scan-off sync tooltip to one line

The longer sentence wrapped inside the pill-shaped tooltip and broke
mid-word.

* fix(usage): open pricing as a sub-page so its editor can be used

Pricing lived in a modal Dialog, but the add/edit pricing editor is a
FullScreenPanel portaled into #content-area. The dialog's overlay sat
above it and Radix set pointer-events: none on body while the dialog was
open, so the editor's fields and save button could not be used. Pricing
is now a FullScreenPanel too, the same pattern as other nested panels.

* fix(usage): show exact metric values in the app tooltip

The metric strip used native title attributes for the exact numbers.
Use HoverTip instead, anchored to the number and opening to the right,
so it does not cover the expanded token row. No tip while the cell
shows a placeholder.
2026-10-23 10:59:12 +08:00
funkpopo 07265bc970 feat(kimi): support multiple official accounts in Auth Center (#8726)
* feat(kimi): manage multiple official accounts in auth center

Isolate account credentials, providers and model aliases; preserve native logins and protect official OAuth nodes. Fix session image access, drop unpublished usage repair paths and the kimi-cli alias, and synchronize all four READMEs.

* fix(kimi): address account compatibility review feedback

Restore the native default credential slot for the first account, stop rewriting tool services on account switches, allow deleting profiles removed from native config, and fix official-account test fixtures and documentation.

* fix(kimi): pin OAuth endpoints to the login region

Use fixed official hosts for mainland and global sign-ins, keep existing account regions and credential slots during reauthentication, and preserve sanitized transport error causes. Add regional routing and network-error regression coverage.
2026-10-23 08:30:23 +08:00
funkpopo 7da255387f feat(kimi): add official OAuth login and provider switching (#8710) 2026-10-22 23:35:49 +08:00
funkpopo e4873bc8aa feat(kimi): add Kimi Code support (#8687)
Add Kimi Code as the 12th managed app (additive mode): native multi-provider config in ~/.kimi-code/config.toml (honors KIMI_CODE_HOME), presets derived from the Pi catalog, MCP (stdio/HTTP/SSE), Skills with native-directory protection, global prompts, session browsing/resume, and session-log usage import. Local routing and aggregation do not apply; official OAuth stays managed by Kimi Code. Schema v21 -> v22 adds enabled_kimi columns.
2026-10-22 16:50:37 +08:00
Jason cb90a2440d docs(release): add v4.0.18 release notes v4.0.18 2026-10-21 23:57:09 +08:00
Jason 4aec1aecaa chore(release): v4.0.18 2026-10-21 23:57:09 +08:00
Jason 04d0ebf568 fix(app): raise the open-file soft limit at startup on Unix
macOS GUI apps started from Finder or a login item inherit launchd's
soft RLIMIT_NOFILE of 256. The local router holds a client socket and an
upstream connection per in-flight request on top of the log, database
and config files, so a burst of parallel requests exhausted the
descriptors: accept() failed with EMFILE, upstream connects failed,
reading live-state.json failed and SQLite could not open the database.

Right after the logger is initialized, lift the soft limit to the hard
limit capped at 10240 (macOS OPEN_MAX; setrlimit rejects larger values
there). The hard limit is never touched and a limit that is already high
enough is left alone; failures are only logged.

Refs #8668
2026-10-21 23:23:26 +08:00
Jason 47ffdff8e0 fix(apps): give runtime CLI commands the login-shell PATH on Unix
When CC Switch is launched from Finder, its PATH is launchd's narrow
/usr/bin:/bin:/usr/sbin:/sbin. run_detected_tool_command_with_timeout
located the tool through a login shell but then spawned it with only the
tool's own directory prepended to that narrow PATH. An npm-installed CLI
is a `#!/usr/bin/env node` script, so when node lives in a different
directory (codex in /opt/homebrew/bin, node in /usr/local/bin) the
"Restart Codex daemon" action failed with `env: node: No such file or
directory`. The same helper runs `opencode models`.

Merge the login-shell PATH in front of the inherited PATH, as tool
install/update already does. login_shell_path now honours the caller's
deadline and spawns like resolve_path_default (stdin null, own session);
when it fails or times out the previous PATH is used unchanged.

Refs #8653
2026-10-21 23:23:26 +08:00
Jason 6226f5c468 fix(terminal): stop waiting for the launched console to close on Windows
Opening a terminal on Windows ran `cmd /C start ...` through
Command::output(). The console that `start` opens inherits the wrapper's
stdout/stderr pipe, so the pipe only reached EOF once the user closed
that window, and the command (and the open-terminal dialog) kept
spinning until then.

Point stdio at NUL and wait only for the wrapper's exit status. Launch
failures still surface through the exit code. Same approach as the
community PR #6716 by @umutcankurt, applied to the current code path.

Refs #6712
2026-10-21 23:23:26 +08:00
Dopetaiga ea8bc2c3ac fix(sessions): group a Claude session by its last /cd location (#8643) 2026-10-21 23:20:20 +08:00
cuiyf5516 e1821b5e43 fix(codex): hide reset countdown for unused quota windows (#8631) 2026-10-21 23:20:15 +08:00
Jason 132ab9cedb feat(presets): add hao.ai sponsor presets across eight apps
Add hao.ai as a full sponsor placed above Fenno: README rows and banner
in all four languages, the partner promotion copy, an inline tile icon,
and presets for Claude Code, Claude Desktop, Codex, Grok Build, OpenCode,
OpenClaw, Hermes and Pi. hao.ai serves Anthropic Messages under
/anthropic, OpenAI-compatible APIs under /v1 and xAI under /x-ai/v1, and
its catalog IDs carry a provider prefix. There is no Gemini preset since
the catalog has no Gemini models.
2026-10-21 23:14:08 +08:00
Jason 0a41250dc0 feat(presets): add DIT.ai sponsor presets across nine apps
DIT.ai (dit.ai), an AI token exchange routing each request across
competing providers, joins as a sponsor, placed directly below GrooRoute
Pro in the sponsor order (OpenModel in the Gemini file, which has no
GrooRoute preset).

- One key on api.dit.ai serves Chat Completions, Responses, Anthropic
  Messages and native Gemini (protocol docs at dit.ai/docs, catalog at
  dit.ai/models, checked 2026-10-21).
- The gateway has no Haiku 5.5 and only the dated
  claude-haiku-4-5-20251001, so Claude Code overrides the Haiku tier with
  it and Claude Desktop maps Sonnet 5.5 / Opus 5.5 / that Haiku.
- OpenCode, OpenClaw, Hermes and Pi use Anthropic Messages with Claude
  Opus 5.5 and Sonnet 5.5; Codex uses Responses with gpt-5.6-sol, Grok
  Build grok-4.7, Gemini CLI gemini-3.8-flash.
- Four-locale README sponsor rows with a banner, four-locale promo copy
  with the "ccswitch" coupon, and an inline icon from the official logo.
- Claude preset rows in the selector test go from 105 to 106.
2026-10-21 17:29:16 +08:00
Jason 8d4ec90fcb chore(presets): remove ZetaAPI sponsor and presets
ZetaAPI is no longer a sponsor; its presets go too.

- Drop the four-locale README sponsor rows and the banner.
- Remove the ZetaAPI presets from Claude Code, Claude Desktop, Codex,
  Grok Build, OpenCode, OpenClaw, Hermes and Pi.
- Remove partnerPromotion.zetaapi from every locale, Turkish included.
- Keep the zetaapi icon: existing providers saved from the preset still
  reference that icon key.
2026-10-21 17:28:05 +08:00
Jason e59252ee5b feat(presets): promote EveryAPI to a full sponsor
EveryAPI moves from the basic tier (in-app presets and website only) to
a full sponsor, placed directly below OpenModel in the sponsor order.

- Four-locale README sponsor rows with the new copy and a 1200px banner.
- The EveryAPI preset blocks in the seven preset files move below
  OpenModel so file order matches the README tables; the presets
  themselves are unchanged.
- The in-app promo copy adds "GPT from 15% of the official price" and
  folds the first top-up bonus and the "ccswitch" code into one perk,
  since they are the same offer.
2026-10-21 17:04:27 +08:00
Jason 6fabe63abb fix(agy): show Antigravity session-log rows as "Session log"
The frontend map of session placeholder names missed
"Antigravity (Session)", so the provider column showed the raw English
name and truncated it. Add the entry and a test that every placeholder
name in usage_stats.rs is translated.
2026-10-21 17:04:27 +08:00
Jason e91689f2da fix(agy): drop the Antigravity-only note on the usage page
No other app shows a pricing note above the usage tables, although
Codex, Gemini and the rest also estimate session-log amounts from API
prices. Remove the note, its locale key and the test that pinned it.
2026-10-21 17:04:27 +08:00
Jason 276eff8dce feat(agy): open all four quota windows from the card's quota column
The card keeps one line per group (Gemini, Claude/GPT) to fit, so the
5-hour and weekly windows could not both be seen anywhere on it. On
Antigravity cards the quota column is now one dropdown, like the resets
dropdown on Codex official cards, listing every window with its own
reset time. Refreshing moves to the ↻ button that appears on hover.
Other cards keep click-to-refresh.
2026-10-21 17:04:27 +08:00
Jason 997e78b565 feat(agy): show the bound account's quota on official cards
An official Antigravity card bound to an Auth Center account showed the
quota of whatever account agy was signed in with, which is a different
account until the card's terminal is opened. It now shows the bound
account's quota, shared with that account's row in the Auth Center, and
like Codex account cards it shows even when the card is not current.

Cards that follow agy's sign-in, and platforms that cannot switch
accounts, keep the signed-in quota.
2026-10-21 17:04:27 +08:00
Jason 2c63012b9e perf(agy): query the signed-in account's quota without starting agy
Official Antigravity cards asked agy's own /usage command for quota, which
starts agy and takes seven to nine seconds. On macOS the card now takes the
account agy is signed in with from the keychain, adds it to the Auth Center
if it is new, and asks Google directly with CC Switch's copy of the token,
the same way the Auth Center does (about one second).

agy's /usage is still used when the keychain holds no recognizable login,
when the user removed that account from CC Switch, and on platforms that
cannot switch accounts.
2026-10-21 17:04:27 +08:00
Jason c0490b0529 feat(agy): show each account's quota in the Auth Center
Every Antigravity row in the Auth Center now has a quota column, the
same one Copilot, ChatGPT and xAI rows use: Gemini and Claude/GPT, each
with a 5-hour and a weekly window. It is queried once when the page
opens and on the refresh button, through agy_account_quota, so accounts
agy is not signed in with show quota too. Accounts that need to sign in
again get no quota column.
2026-10-21 17:04:27 +08:00
Jason 8f9525b03d fix(agy): explain why an account is not eligible for Antigravity
Accounts that Google does not allow to use Antigravity, such as those
restricted by age, get the same 403 "You do not have a valid license,
contact your administrator" from the quota endpoint. That reads like a
CC Switch or licensing problem. On a 403 the quota query now asks
loadCodeAssist once, and when the account only has ineligible tiers it
shows Google's own reason instead.
2026-10-21 17:04:27 +08:00
Jason 5a08e230c0 feat(agy): query each Antigravity account's quota directly
The Auth Center can now show quota for every Antigravity account, not
only the one agy is signed in with. The new agy_account_quota command
calls Google's retrieveUserQuotaSummary with the account's own token, so
no switch is needed. The response carries the same buckets as agy's
/usage, and both now go through one tier builder.

The endpoint only answers clients that identify as Antigravity, so the
User-Agent is "cc-switch/<version> (antigravity)": it names CC Switch
and adds the word the server checks for. It only reads quota; it never
calls a model, warms up accounts or switches on low quota.

Tokens that expire within two minutes are refreshed first. The refreshed
token is saved only to CC Switch's copy, never to the keychain: agy keeps
refreshing its own login, and Google does not rotate the refresh token,
so both access tokens stay valid. For the account agy is using, the
keychain login is absorbed first so its newer token is used. A rejected
token triggers one forced refresh; invalid_grant marks the account as
needing sign-in again.
2026-10-21 17:04:27 +08:00
Jason 816346022b fix(pricing): price deepseek-v4.1-flash as V4.1 Flash
Third-party upstreams such as OpenCode Go, OpenRouter (deepseek/
namespace) and the Hermes presets call DeepSeek V4.1 Flash
deepseek-v4.1-flash. Pricing had no row for that id: none of the lookup
fallbacks turn it into deepseek-flash, and the prefix fallback only
matches longer ids. These requests showed "Unpriced" and were counted
at $0.

Add a deepseek-v4.1-flash row at the same official peak price as
deepseek-flash (0.3 / 1.2 / 0.006 per million). Default prices are added
again on every start, so existing installs get the row on next launch.
Requests already logged are not repriced.
2026-10-21 17:04:27 +08:00
Jason 0af8b77288 feat(agy): bind official cards to an Antigravity account
An official Antigravity card can now pick one of the Auth Center accounts
(macOS only). With an account picked, Open Terminal first switches agy's
global sign-in to it; when it is already signed in, nothing is written.
Without one, the card keeps following whatever agy is signed in with.

The binding is stored as authBinding with authProvider "agy_oauth". The
account id is the Google subject, so a card synced to another computer
works once the same account is added there; if it is missing, opening the
terminal stops with a message instead of launching under another account.
Platforms that cannot switch ignore the binding and keep it on the card.

The Open Terminal dialog says when opening will switch agy's sign-in, and
warns when agy is already running. The Auth Center counts bound cards as
users of an account, so the removal dialog lists them.
2026-10-21 17:04:27 +08:00
Jason 8627187954 feat(agy): add an Antigravity group to the Auth Center
On macOS the Auth Center now lists Antigravity accounts next to Copilot,
ChatGPT and xAI. The account agy is signed in with is tagged "In use by
agy", and "Switch agy to this account" in the row menu replaces agy's
sign-in. After switching, CC Switch checks whether agy is running and
warns that open sessions keep the old account and may write it back.

Adding an account opens Google's sign-in page in the browser. The shared
login hook treats a response without a user code as this browser flow: it
leaves the clipboard alone, polls the local result every 1.5 seconds and
cancels the backend flow so the callback port is released. The pending
block shows a "reopen sign-in page" button instead of a device code.

Removing an Antigravity account says that agy stays signed in.

The backend now records the sign-in time in seconds, which is what the
Auth Center formats.
2026-10-21 17:04:27 +08:00
Jason fdbac61c31 feat(agy): manage Antigravity official accounts in the Auth Center backend
agy keeps a single global login in the system keychain (service "gemini",
account "antigravity"). CC Switch now keeps its own copy of each account
and switches agy by writing the chosen one back into that entry.

- Sign in through the browser with agy's own OAuth client (PKCE, loopback
  callback on 127.0.0.1), requesting the same scopes agy does, so agy can
  keep refreshing the token on its own.
- Read and write the keychain through /usr/bin/security, the program the
  entry already trusts: the value goes over `security -i` stdin, `-U`
  updates in place and keeps the entry's access control, and the write is
  read back and checked.
- Before overwriting, take back the current login: refresh tokens agy
  renewed go to their account, an unknown account is added, and an
  unreadable value is stashed to agy-login-stash.json.
- Removing an account only drops CC Switch's copy; agy is never signed out.
- Exposed as the "agy_oauth" provider of the generic auth_* commands, where
  the default account is the one agy is signed in with. macOS only for now.
2026-10-21 17:04:27 +08:00
Jason 711a4127ff fix(usage): only list apps shown on the Apps page in the app filter
The usage dashboard listed every known app as a filter chip regardless of
the visibility switches on the Apps page. Filter the chips the same way the
session manager does: Claude Code stays while Claude Desktop is shown, and
the currently selected app is kept even if it has been hidden.
2026-10-21 17:04:27 +08:00
Jason 92ec18d774 docs(aggregation): correct the workaround for the exhausted-quota lock
Since route and aggregation mode keep the ChatGPT login (#8431), the
route table writes requires_openai_auth = true whenever a login is on
disk, so making a third-party card the aggregation default no longer
keeps Codex from locking the send button to Luna Reserve once the
official 5-hour quota runs out.

The guide and the 4.6 manual pages now describe the method that still
works: switch to Direct, keep "Keep official login for direct switches"
off, switch to a third-party card and fully restart Codex; switch back
to Aggregation once the quota resets. The old method is marked as no
longer working.

Refs #7962
2026-10-21 17:04:27 +08:00
funkpopoandthefool cdfdff5ee7 fix(installer): make Windows desktop shortcut optional (#8601)
Add a "Create a desktop shortcut" checkbox to the MSI install-directory page and a public CREATEDESKTOPSHORTCUT property for silent installs. Upgrades keep the current state of the desktop shortcut, and clearing the option during an upgrade removes the old one.

The desktop shortcut is now copied from the Start Menu shortcut by custom actions with Return="ignore", so a Desktop that cannot be written no longer blocks or rolls back the install.

Fixes #5667

Co-authored-by: thefool <thefoolyuzhe@gmail.com>
2026-10-21 16:41:46 +08:00
SaladDay ab5d4a12dd fix(ui): trim redundant provider and settings helper copy (#8633) 2026-10-21 16:37:31 +08:00
SaladDay c1fd26bde7 fix(ui): show compact mode-colored connection badge in header (#8634) 2026-10-21 15:17:42 +08:00
Thefool 1ef08d5e7d fix(windows): stop in-app updates from rebooting the machine (#8628)
The MSI now carries REBOOT=ReallySuppress, so Windows Installer never restarts the machine when a file is in use during an in-app update, including updates driven by older updaters. The updater also passes REBOOT=ReallySuppress, a leftover instance is closed on the updater path, and the release workflow fails if the built MSI lacks the property.

Fixes #8534
2026-10-21 15:08:23 +08:00
Jason c776fd0ebf feat(agy): trim the form hint and require a key on custom cards
The long paragraph above the Antigravity form explained a case that should
not exist: a non-official card without a key is just the official login
card again. Drop the paragraph and warn on save when a custom card has no
API key, as Gemini CLI already does. A key without an endpoint stays valid
and uses Google's default API.

The endpoint and model rules move into "?" tips next to their fields. The
card's terminal button now reads "Open Terminal with This Provider"; the
shorter "Open Terminal" label stays for the Claude Code card menu.
2026-10-21 11:31:01 +08:00
Jason 9a10e4f7a9 feat(agy): replace the enable button with Open Terminal
CC Switch can only reach the agy it starts itself: a third-party key
travels in that process's environment, so "enabling" a key card never
changed what a plain `agy` used. Antigravity cards now only launch.

- Every card's primary action is Open Terminal; there is no "in use"
  state, the official quota shows on official cards at all times, and
  any card can be deleted.
- Official cards start `agy --model=<display name>`, which applies to
  that session only. Key cards keep their private --gemini_dir.
- The real ~/.gemini/antigravity-cli/settings.json is never written any
  more: switching is refused, adding the first card, full syncs and
  deep links with enabled=true leave it alone. The only remaining write
  removes the modelProvider left behind by the #8268 preview.
- The terminal dialog and form hints no longer talk about switching.
2026-10-21 10:47:46 +08:00
Jason fb91155a5a fix(agy): accept the empty mcp_config.json agy creates on first run
agy writes a zero-byte ~/.gemini/config/mcp_config.json the first time it
starts. Parsing it as JSON failed, so enabling any MCP server for
Antigravity showed "Invalid Antigravity MCP JSON" and importing from it
failed too. Treat a blank file as having no servers.
2026-10-21 10:03:45 +08:00