Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Feature] Agent 支持登录多个 Claude 官方订阅账号并手动切换,账号隔离与登录全程走 Claude Code 原生机制

Chiusa
#1,457 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust, typescript

Direzione di ricerca

Start by reading PR #1453 and rust/lithe-agent-host/src/claude_subscription.rs, then verify the macOS keychain behavior described in the issue using a temporary Claude Code configuration directory and claude auth status. Map how Agent connections, settings, and session annotations are stored before estimating the implementation. Done means accounts can be added and switched manually with isolated histories and usage snapshots, without Lithe handling credentials or automatically rotating accounts.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:ai enhancement P2 platform:cross-platform review: medium
Problem to solve / 要解决的问题

Claude Agent 现在可以使用本机 Claude Code 已登录的官方订阅(见 PR #1453),但一次只能用当前终端里登录的那一个 claude.ai 账号。有多个 Claude 订阅的用户(例如工作账号和个人账号)只能:

  1. 在终端执行 claude /logout 再 /login 换账号,然后在 Lithe 里重连 Agent;
  2. 换账号后,~/.claude 下的会话历史混在一起,Lithe 的历史列表、收藏和自定义标题也无法区分账号;
  3. 无法在 Lithe 里看到每个账号的 5 小时 / 7 天用量,只能逐个登录后查看。

影响:切换一次要离开 IDE 操作终端并重新授权,容易把对话发到错误账号;同时用户担心用非官方方式搬运或切换凭据会触发账号风控。

Proposed solution / 建议方案

在设置 → AI → Agent 管理 → Claude Agent 的供应商管理中增加「账号」列表,所有登录与隔离都交给官方 Claude Code CLI,Lithe 不读取、复制、导入或刷新任何 OAuth 凭据:

  • 账号列表:每行显示账号邮箱、套餐(如 Claude Pro)、「首选」标记,以及 5 小时与 7 天用量条和重置时间。邮箱与套餐来自 ACP 适配器推送的 _auth/status_update(适配器运行 claude auth status --json 得到)。
  • 账号隔离:每个账号对应一个独立的 Claude Code 配置目录,启动适配器时设置 CLAUDE_CONFIG_DIR。Lithe 只保存「显示名 + 目录路径 + 是否首选」,不保存任何密钥。
  • 添加另一个 Claude 账号:Lithe 新建空配置目录,在内置终端运行官方命令 CLAUDE_CONFIG_DIR=<目录> claude auth login --claudeai,浏览器授权完全走 Anthropic 官方流程。
  • 设为首选 / 切换:切换即用另一个目录重启当前项目的 Agent 连接,交互与现在切换供应商一致;正在回复、等待授权时拒绝切换。
  • 用量显示:记录每个账号最近一次从适配器 usage_update._meta["_claude/rateLimit"](Claude Code 的 rate_limit_event,含 five_hour、seven_day、utilization、resetsAt)收到的快照和时间,显示「截至 <时间>,本次未主动刷新」。不调用 Anthropic 接口,也不主动轮询。
  • 历史隔离:Lithe 的会话标注(收藏、重命名、移除)按「工作区 + Agent + 账号」分开保存,避免不同账号的历史混在一起。
  • 合规边界:只允许用户手动切换;额度耗尽时不自动轮换到其他账号,避免被视为绕过限额。

实现前需要先验证一点:在 macOS 上,不同 CLAUDE_CONFIG_DIR 的登录凭据在钥匙串中是否互不覆盖(用临时目录登录第二个账号后,只用 claude auth status 确认原账号仍保持登录,不读取凭据)。

Target platform / 目标平台

Cross-platform / 跨平台

Area / 模块

AI

Priority / 优先级

P2 / 后续考虑:目前不着急,可安排到后续版本

Alternatives considered / 已考虑的替代方案
  • 从文件导入账号(复制或导入他人或其他机器的 OAuth 凭据文件):不采用。这属于搬运凭据,最容易触发风控,也超出原生支持范围;最多支持「选择一个已存在的 Claude Code 配置目录」,Lithe 只记录路径。
  • 「Claude Code 始终登录首选账号」(改写终端默认 ~/.claude 的登录态):不采用。这需要改写 CLI 默认凭据,不是原生行为;可改为在界面提示用 CLAUDE_CONFIG_DIR=<目录> claude 在终端打开指定账号。
  • Lithe 自己调用用量接口主动刷新:不采用。这需要读取 OAuth 令牌并直接请求 Anthropic 接口,不是原生方式。
  • 单账号 + 手动在终端 logout/login:现在已经可用,但切换成本高,而且历史会混在一起。
Additional context / 补充信息
  • 依赖 PR #1453 中新增的 Claude 订阅模式(AgentAuthentication.claudeSubscription,Host 侧见 rust/lithe-agent-host/src/claude_subscription.rs)。
  • 已确认的原生能力(Claude Code 2.1.309、@agentclientprotocol/claude-agent-acp 0.81.2):CLI 支持 CLAUDE_CONFIG_DIR;适配器 initialize 时推送 _auth/status_update(已登录订阅时 kind = account,并带 plan);适配器把 rate_limit_event 转发为 usage_update._meta["_claude/rateLimit"]。
  • Anthropic 的 Agent SDK 文档说明第三方产品提供 claude.ai 登录需要事先获得批准。本功能只启动用户自己安装、自己登录的官方 Claude Code,是否对外宣传由维护者决定。
  • Windows 侧:共享 Host 已支持 Claude 订阅启动;账号列表 UI 需要在 Windows 设置页对等实现。
  • 参考界面(文字描述,原截图含个人邮箱未附上):账号卡片列表,每行为「勾选图标、邮箱、套餐标签、首选标记、5 小时与 7 天用量条、已用百分比、重置时间」,底部是「添加另一个 Claude 账号」入口。
Checklist / 提交前检查
  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
Lingua principale
TypeScript
Stelle
1.8k
Fork
151
Merge medio
13h 18m
PR unite (30g)
339

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di 1lck/Lithe-IDEA

Tutte le issue di 1lck/Lithe-IDEA

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.