0
Fork 0
mirror of https://github.com/zeronsh/comet.git synced 2026-11-16 18:57:19 +00:00
comet/crates/rpc
Wing 3d07f58d60 Providers: API keys, Claude for Pi, cards like Claude Code's, Hermes fixes
Per-provider agents (Pi, OpenCode, Hermes) now look and act like every
other agent's card, take API keys in the app, and behave across devices.

Card: the same rows, rules and "In use" as Claude Code's and Codex's — a
provider's accounts together, each provider with its own one in use, the
plan line saying whose ("ChatGPT Plus", "OpenRouter · API key ···a1b2") —
and every add row at the foot (Add ChatGPT / Claude / GitHub Copilot
account, Add API key). No section chrome, no CLI hints. "Switch to this
account" only on a switchable row not in use; a refused switch says why
in a toast instead of doing nothing.

API keys: "Add API key" opens a dialog (provider select with each
provider's mark, masked key field with its placeholder shape shown plain,
optional name, Save disabled until typed, spinner and locked inputs while
the provider checks the key, the provider's refusal under the field).
Stored as each agent's CLI stores it: Pi's auth.json api_key entry,
OpenCode 1.x's api entry (OpenCode 2.x keeps keys in its own database:
refused with what to do, and a warning on the list), Hermes through
`hermes auth add <provider> --type api-key` with the key on stdin in a
session without a terminal. Keys are named (default "<Provider>
···<last4>", renamable from the row's menu; a name holding any of the key
is refused). The key is never logged, never in an error or the snapshot,
never on argv or in a child's environment, files 0600, and
AddAgentApiKey is local IPC only (refused, never forwarded, when it names
another device; refused by the relay host if a peer sends one).

Claude for Pi: Pi's own Claude Pro/Max sign-in, saved as pi saves it, a
fresh grant, swapped under pi's lock; a switch keeps a refresh the agent
made since the last list (single-use refresh tokens). OpenCode has no
Claude sign-in (verified in 2.1.2): refused with the API-key alternative.

Hermes: lists only pool entries Hermes itself uses (its
_pool_entry_is_explicit: device_code, loopback_pkce, hermes_pkce,
manual[:*], env:<VAR> while the variable holds a key) — a borrowed
gh_cli Copilot token is no longer offered.

Also: provider marks (one mono set), Select options with marks, Dialog
confirm `disabled`, TextField draws a password's placeholder unmasked,
Groq/Mistral dropped from key providers (no marks in the set).

Tests: engine agent_accounts 118 (keys stored/refused/never shown or
logged/stdin-only/0600, OpenCode 2.x refusal, names and rename, two keys
one provider, Pi Claude local and for another device, rotation kept,
Hermes explicit-only); device_routing remote per-provider list/switch,
provider refusal routed, remote key refused with no relay frame and no
file holding it; rpc routing asserts; app Rust and UI tests updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
History 2026-11-13 13:52:59 -07:00
..
examples Relay: old clients no longer hold a chat or an account back 2026-11-09 00:46:21 -07:00
src Providers: API keys, Claude for Pi, cards like Claude Code's, Hermes fixes 2026-11-13 13:52:59 -07:00
tests Chats reach long chats on other devices (#1307) 2026-11-09 06:28:32 -07:00
Cargo.toml Zeron Cloud, provider switching, and the phone model picker (#966) 2026-10-22 03:18:13 -07:00