Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

Add provider /connect flow and storage

9 months ago

a383860
Authored
mweinbach2/8/2026, 2:48:52 PM
Introduce 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

11 files changed
  • src/cli/repl.ts+68−1
  • src/connect.ts+350−0
  • src/server/protocol.ts+9−0
  • src/server/session.ts+60−0
  • src/server/startServer.ts+12−1
  • src/tui/index.tsx+47−127
  • test/connect.test.ts+170−0
  • test/protocol.test.ts+83−0
test/repl.test.ts
+14
−1
  • test/server.connect.test.ts+188−0
  • test/session.test.ts+256−2