/* Claude Login — drive the bundled `claude /login` OAuth flow on the host from the web UI. * * Click "Log in to Claude" → the worker opens `claude /login` in the control container, * selects the subscription account, and returns the claude.com authorization URL. That URL * is shown in an embedded frame (and as a new-tab link, since claude.com may refuse to be * framed); after authorizing, paste the code back to finish. All state lives in the store's * `claudeLogin` machine (login_start / login_submit commands). */ "use client"; import { useState } from "react"; import { useDashboard } from "@/components/store"; import { Button, Callout, Input } from "@/components/ui"; export function LoginSection() { const s = useDashboard(); const { status, url, message } = s.claudeLogin; const [code, setCode] = useState(""); const busy = status === "starting" || status === "submitting"; const awaiting = status === "awaiting" || status === "submitting"; const submit = async () => { const ok = await s.submitClaudeCode(code); if (ok) setCode(""); }; return ( <>
Claude Login
Log Claude Code in on the host so agents can run. This drives{" "} claude /login in the control container and picks the Claude account with a subscription.
{message && ( {message} )} {status === "done" ? (
) : !awaiting ? (
{status === "error" && ( )}
) : ( <>
Open login page in a new tab ↗