feat: hub client, login command, hub sync + heartbeat#50
Merged
Conversation
- Auth module: read/write/delete ~/.agentage/auth.json with Supabase session - OAuth callback server: temporary Express on random port, exchanges code via @supabase/supabase-js, 120s timeout - Hub client: REST client for hub API (register, heartbeat, deregister, getMachines, getAgents) with Supabase JWT auth headers - Hub sync: register → heartbeat loop (30s) → reconnection with exponential backoff (1s → 30s max). Processes pending commands. - Reconnection module: generic exponential backoff with reset on success - Login command: --hub flag (default agentage.io), fetches supabaseUrl + anonKey from hub health endpoint, opens browser for OAuth, --token escape hatch for headless/CI - Status command: shows hub connection state, URL, user email - Daemon entry: initializes hub sync on startup if auth.json exists, graceful hub disconnect on shutdown - Health endpoint: includes hubConnected, hubUrl, userEmail - 129 tests passing (7 new: auth read/write/delete, reconnection)
|
🎉 PR Validation ✅ PASSED Commit: Checks:
Ready to merge! ✨ 🔗 View workflow run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Daemon-side hub integration — login, registration, heartbeat, and reconnection.
~/.agentage/auth.jsonstoring Supabase session (access_token + refresh_token), user info, hub URL + machineId@supabase/supabase-js. 120s timeout. Falls back to printing URL for headless environments.agentage login --hub <url>fetchessupabaseUrl+supabaseAnonKeyfrom hub's/api/health, opens browser for OAuth.--tokenescape hatch for headless/CI.auth.jsonexists, graceful disconnect on shutdownhubConnected,hubUrl,userEmailNew dependency
@supabase/supabase-js— OAuth code exchange, token refresh, auth state managementTest plan
npm run verifypasses (type-check + lint + format + 129 tests + build)