9 months ago
a383860Introduce a new connect module and wire a /connect flow across CLI, TUI and server. - Add src/connect.ts: manages ~/.ai-coworker paths, read/write of connections.json (0600), masking, and an OAuth command runner with fallbacks. Supports modes: api_key, oauth, oauth_pending and helpers for CLI OAuth providers (gemini-cli, codex-cli, claude-code). - CLI: add /connect command to repl (save API key, list connections or start CLI OAuth). Uses connectProvider and shows progress/messages. - Server/protocol, session, and startServer: add connect_provider client message, AgentSession.connectProvider to run the connect flow on the server (emit results/errors back to client), and startServer dispatch handling. - TUI: remove duplicated connection logic and use shared connect utilities; delegate connect actions to server via connect_provider and update UI messages/placeholders and usage text. This centralizes connection handling, persists connection state, and enables running OAuth flows from CLI-capable providers.
Parent236d0e5