Commit Graph
12 Commits
Author SHA1 Message Date
ciregenz 1fc58af88a [eric] fix subscription OAuth — direct exchange from callback page
Modified 9Router's callback page to call the exchange endpoint directly
instead of relying on postMessage/BroadcastChannel relay (which fails
in Electron where window.opener is null).

Flow: click Connect → sign in → callback page fetches pending state
from our backend → calls 9Router exchange → connection saved → done.

Backend:
- Added GET /api/subscriptions/pending/{state} with CORS for callback
- Added GET /api/subscriptions/callback as fallback
- Store pending OAuth state (codeVerifier, redirectUri) keyed by state
- redirect_uri stays on localhost:20128 (required by Anthropic)

Frontend:
- Popup window for auth URL + postMessage listener + status polling
- Works in both Electron and regular browser
2026-03-23 17:23:22 -07:00
ciregenzandClaude Opus 4.6 24ad784cd0 [eric] seamless subscription connect — no 9Router GUI needed
OAuth flow now stays entirely within OpenSwarm:
1. Click "Connect Claude" → Anthropic sign-in opens as popup
2. User signs in → 9Router's /callback catches redirect
3. postMessage sends code back to OpenSwarm window
4. OpenSwarm exchanges code via /subscriptions/exchange proxy
5. Shows "Connected ✓" — done in 3 steps, 1 app

Changes:
- nine_router.py: return real authUrl for auth_code providers
  instead of redirecting to 9Router dashboard
- nine_router.py: add exchange_oauth() proxy function
- agents.py: add POST /subscriptions/exchange endpoint
- Settings.tsx: popup + window.addEventListener('message') for
  OAuth callback, with polling fallback

Before: 8 steps across 2 apps
After: 3 steps in 1 app (click → sign in → done)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 10:52:56 -07:00
ciregenzandClaude Opus 4.6 0a907e4bac [eric] fix subscription provider IDs, handle both OAuth flows
- Fixed provider IDs to match 9Router: claude, codex, github, gemini-cli
- Handle authorization_code_pkce flow (Claude, Codex) — opens browser, polls status
- Handle device_code flow (GitHub, Qwen, Kiro) — shows code, polls for completion
- Pass code_verifier and extra_data through poll endpoint
- Fix isConnected check for 9Router's {connections: [...]} response format
- Auto-start 9Router in backend lifespan

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 21:03:07 -07:00
ciregenzandClaude Opus 4.6 50b28f7080 [eric] zero-friction subscription access via 9Router proxy
- 9Router auto-starts silently in background on app launch
- Subscription proxy endpoints: /subscriptions/status, connect, poll, models
- Per-provider subscription cards in Settings → Models (Claude, ChatGPT, Copilot, Gemini)
- Click "Connect" → browser opens for OAuth → poll until done → "Connected ✓"
- No terminal, no commands, no copy-paste — just click + browser sign-in
- 9Router manages OAuth tokens, auto-refresh, quota tracking
- Removed old NineRouterSetup terminal command UI
- Removed standalone CopilotAuthButton (merged into SubscriptionCards)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 20:49:43 -07:00
ciregenzandClaude Opus 4.6 b9b044a2e3 [eric] 9Router subscription proxy, GitHub Copilot auth, Settings restructure
Subscription access (WIP):
- 9Router integration: auto-detects if running, routes through user's subscriptions
- Fallback routing: no API key → check 9Router → use subscription
- Model ID mapping for 9Router (cc/ prefix for Claude Code models)
- GitHub Copilot OAuth device flow (copilot_auth.py, providers/copilot.py)
- Copilot auth endpoints: start-auth, poll-auth, models, disconnect

Settings restructure:
- 4 tabs: General, Models, Usage, Commands
- Models tab: Subscriptions section (9Router + Copilot) + API Keys section
- Per-provider "CONNECTED" badges
- Subscription token fields removed (Anthropic banned OAuth in third-party apps)
- 9Router auto-detection with "Check Connection" button

Provider routing:
- create_provider() checks subscription tokens → API keys → 9Router fallback
- validate_credentials() allows through if 9Router is running
- 9Router model ID mapping (sonnet → cc/claude-sonnet-4-6)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 20:46:26 -07:00
ciregenzandClaude Opus 4.6 b6f45e8412 [eric] multi-provider agent loop, PostHog analytics, settings overhaul
Multi-provider support (WIP - not fully tested):
- Owned agent loop replacing claude_agent_sdk (agent_loop.py, mcp_client.py)
- Provider adapters: Anthropic (native), OpenAI-compat (any endpoint), Gemini (native + schema cleaning)
- 19 models across 9 providers (Anthropic, OpenAI, Google, xAI, Meta, DeepSeek, Mistral, Qwen, Cohere)
- OpenRouter integration for 300+ models via single API key
- Builtin tool reimplementations (Read, Write, Edit, Glob, Grep, Bash, WebSearch, WebFetch, AskUserQuestion)
- Standalone MCP client manager (stdio/sse/http)
- Frontend: grouped model dropdown, provider selection, dynamic context windows

Analytics (tested):
- PostHog integration as single analytics source
- Tracks: app.opened, session.started/completed, tool.called, tool.approval_resolved, error.occurred
- Rich session data: user messages, assistant messages, session titles, tools used, MCP servers, task categories
- PostHog dashboard with 14 insights created via API
- Usage stats in Settings (Usage tab) with pixel-art bars

Settings (tested):
- 4 tabs: General, Models, Usage, Commands
- Model Providers tab with OpenRouter (recommended), Anthropic, OpenAI, Google key fields
- "Get key" links for each provider
- Usage tab with session/cost/tool stats + analytics opt-in toggle
- analytics_opt_in defaults to true, installation_id auto-generated

Merged haik/updates-v1 (tested):
- Sub-agent spawning, chat branching, browser control improvements
- Settings: auto_select_mode, expand_new_chats, auto_reveal_sub_agents, dev_mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 13:50:21 -07:00
haikdc 9943ccafd5 [Haik]: (Agent browser render size matches that of user browser spawn) (queing messages) (chat loading bubble fix) (tethers to sub agents and branches are now permament and inputs are swapped to a continue chat button) (auto focus for everything) (history card position fix when redeployed) (dashboard persistance fixed) (non browser link clicks open in the in app browser now) (chat message tooltips for copy, branching, and editing / swapping between edited messages) 2026-03-18 23:45:54 -07:00
haikdc a1138a1782 [Haik]: (ability to resume chats if force end early) (agent selection actually works as advertised) (browser control/creation tool isolation) (in dev mode can see the action input schema) 2026-03-18 14:19:42 -07:00
haikdc a6a2c68115 [Haik]: ckpt, (view sidebar clicks fixed) (view back button removed) (backspace/delete to remove items from dash) (copy/paste items in dash) (Swapping between branches in chat) (Per message tool tips in chat) (chat branching support and some cool ahhh anims) (auto deselect items on toolbar collapse) (if exit selection mode, items get deselected) (item selections only populate focused chat input as context instead of all chat inputs) (swapped right and left mouse clicks to match that of other softwares) 2026-03-18 07:40:02 -07:00
haikdc 6f02daff2d [Haik]: (Browser actions shown in agent card output) (User can have item selection turned on by default in settings) (most browser related functionality works - altho spotify is tricky) (mcp discovery in prod shld worke now?) 2026-03-17 01:48:50 -07:00
haikdc 1632b5c9e5 [Haik]: ckpt, (Fixed view create duplication bug) (Views auto save) (MCP is star sorted by default) (reload issues in dash fixed) (electron app made) 2026-03-15 00:09:04 -07:00
haikdc 23621306a1 [Haik]: and so it begins 2026-03-13 12:09:25 -07:00