peppa/openspec/changes/archive/2026-11-12-pep-13-connect-claude/proposal.md
Асель 3f55248150 PEP-13: connect Claude from the web for remote users
- Settings → Claude: Peppa runs 'claude setup-token' in tmux, shows the
  claude.com sign-in link, the user pastes the code into the form; the
  1-year token is stored encrypted on the user (users.claude_token_enc)
- Claude sessions of the owner's projects get CLAUDE_CODE_OAUTH_TOKEN;
  projects without an owner token keep using the machine login
- disconnect / reconnect; setup times out after 10 min and its tmux
  session (and scrollback with the token) is killed right after saving
- mock-claude setup-token; 2 new tests (56 e2e total, green)
- verified on prod: the button yields the real claude.com authorize URL
- OpenSpec: pep-13 archived into spec agent-credentials

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 22:06:37 +05:00

2.1 KiB
Raw Blame History

Proposal: PEP-13 — подключить Claude из веба

Задача Пеппы: PEP-13 · Цель #3 «Надёжность фабрики на живых агентах».

Why

Сессии агентов падают с authentication_failed: вход Claude CLI на Mac истёк, а PM работает удалённо и не может выполнить claude login на машине.

What Changes

  • «Настройки → Claude»: кнопка «Подключить». Пеппа запускает на Mac claude setup-token, показывает ссылку входа; пользователь открывает её на своём устройстве, вставляет код в форму Пеппы; полученный годовой токен хранится зашифрованным у пользователя.
  • Сессии Claude по проектам владельца запускаются с его токеном (CLAUDE_CODE_OAUTH_TOKEN); без токена — как сейчас (вход машины).
  • Статус подключения, дата, «Отключить». Токен нигде не показывается.

Вне scope: Codex (позже тем же способом), токены участников при шеринге (PEP-12).

Capabilities

New Capabilities

  • agent-credentials: подключение аккаунта агента (Claude) пользователем из веба и использование его в сессиях.

Modified Capabilities

Impact

packages/db (users.claude_token_enc, claude_token_set_at), packages/runner (процесс setup-token в tmux, env сессий), apps/web (Настройки), packages/testkit (mock-claude setup-token).

Решение по секретам

Хранение — как у токенов Gitea (AES-256-GCM от PEPPA_SECRET); код вводит сам пользователь, агент Пеппы его не видит. Согласовано с PM в чате.