Repository navigation
Add multi-user Life agent backend - #26
emilwareus wants to merge 19 commits into
Conversation
|
🚀 Preview deployed: https://addcommitpush-3otqmb356-yield-compiler.vercel.app |
Phase 0: Contract fixtures and route separation - Refactored app/ into (public) route group; neutral root layout - PostHog + Navigation moved to (public)/layout.tsx - (life) route group with private layout, login page, authenticated layout - lib/life/ module: contracts.ts (Zod schemas from Rust models), constants.ts, errors.ts, config.server.ts, formatting.ts, session.server.ts, client.server.ts, queries.server.ts, route-handlers.server.ts, auth.server.ts - Contract fixtures + validation script Phase 1: Authentication and server boundary - Scrypt password login -> bearer token check -> owner UUID verification - HMAC-SHA-256 signed HttpOnly session cookie (8h expiry) - proxy.ts gate for /life and /api/life routes - Security headers: no-store, noindex, CSP, referrer, frame-ancestors, permissions - BFF Route Handlers: memories, memories/search, memories/[id], owner, timeline, conversations, conversations/[id]/messages, conversations/[id]/turns - robots.ts + sitemap.ts exclude /life and /api/life Phase 2: Dashboard, memory, and timeline - Dashboard: recent memories, timeline entries, conversations, audit activity - Memory browse + hybrid search + filters + detail (provenance, relations, revisions) - Memory create/revise/retract actions - Precision-aware timeline with range/domain filters - Conversation list and detail with messages - Life UI components: badges, cards, forms, search, shell, timeline-rail, etc. All Life pages: dynamic = 'force-dynamic', revalidate = 0 No bearer token in client code. Server-only modules use 'server-only' import. Verified: pnpm typecheck, pnpm lint, pnpm build all pass.
- WebRTC voice client with native RTCPeerConnection + data channel - OpenAI Realtime session creation via BFF proxy (ephemeral secret only) - Strict event parser: known types only, unknown function names rejected - Per-response transcript assembler keyed by provider response ID - Citation isolation: memory IDs never leak between responses - Durable commit: only completed transcripts, never deltas - 409 conflict reconciliation via conversation message fetch - Memory tool forwarding: search_life_memory via BFF, no owner/sensitivity from function arguments - Voice UI: idle/connecting/connected/error states, live transcript, tool status, commit status, mute, end, elapsed timer - Cleanup order: mic tracks → data channel → peer connection → DELETE session - BFF routes: sessions (POST), sessions/[id] (GET/DELETE), sessions/[id]/search-memory (POST), sessions/[id]/turns (POST) - State machine tests in scripts/check-life-realtime.ts - No WebRTC-to-multipart fallback; no session.update to replace tools Verified: pnpm typecheck, pnpm lint, pnpm build all pass.
…health, contradictions, exports
Phase 4: Connectors and owner settings
- Settings page: owner profile editing (display name, timezone)
- Connector management: provider cards (GitHub/Linear/Gmail), OAuth start,
sync, job polling with SWR, failed job retry, Gmail cursor reset, revoke
- Data portability: JSON export, Markdown export, owner deletion with
exact display-name confirmation
- BFF routes: connectors start/sync/reset-cursor/revoke, jobs get/retry,
owner PUT/DELETE, export json/markdown (streaming downloads)
Phase 5: Research, health, contradictions, portability
- Research workspace: explicit query + sensitivity selector, Markdown report
+ source links + created memories, 'researched' epistemic label
- Health: table grouped by metric_code/unit, Recharts charts, manual entry
form, never combine different metrics/units in one chart
- Contradictions: list + detail with resolution form (terminal status + note)
- Reflections BFF route for dashboard reflection action
- Navigation links added to Life shell
Backend contract changes (from plan):
- Added GET /v1/contradictions/{id} endpoint + db query
- Added LIFE_FRONTEND_BASE_URL config for OAuth callback redirect
- OAuth callback now redirects to configured frontend URL instead of JSON page
- Updated API docs and deployment docs
New components: connector-card, connector-list, job-status-badge,
research-form, research-result, health-chart, health-measurement-form,
contradiction-card, contradiction-resolver, data-export, owner-deletion,
settings-form
Verified: pnpm typecheck, pnpm lint, pnpm build all pass.
|
🚀 Preview deployed: https://addcommitpush-lvtu5k0fy-yield-compiler.vercel.app |
|
🚀 Preview deployed: https://addcommitpush-r2jome9gz-yield-compiler.vercel.app |
|
🚀 Preview deployed: https://addcommitpush-nuukl3s0h-yield-compiler.vercel.app |
|
🚀 Preview deployed: https://addcommitpush-nepu79qbd-yield-compiler.vercel.app |
|
🚀 Preview deployed: https://addcommitpush-en48idyfh-yield-compiler.vercel.app |
|
🚀 Preview deployed: https://addcommitpush-15uncgiyi-yield-compiler.vercel.app |
Paste encrypted GitHub/Linear/Slack keys or IMAP app passwords, allow multiple accounts per provider, and have the Cloud Run worker enqueue due syncs every 15 minutes. Also polish Realtime voice session handling and UI. Co-authored-by: Cursor <cursoragent@cursor.com>
|
🚀 Preview deployed: https://addcommitpush-oes9inoht-yield-compiler.vercel.app |
Co-authored-by: Cursor <cursoragent@cursor.com>
|
🚀 Preview deployed: https://addcommitpush-iwgxoa2ig-yield-compiler.vercel.app |
Resolve package.json/pnpm-lock conflicts by keeping Life Pulumi and DemoHunter deps while taking main's dependency updates. Co-authored-by: Cursor <cursoragent@cursor.com>
|
🚀 Preview deployed: https://addcommitpush-e7nlq3a6p-yield-compiler.vercel.app |
Summary
lifebackend backed exclusively by PostgreSQL with pgvector and full-text searchWhy
This establishes the backend for a deeply personal AI agent that can interview a user, preserve structured and source-linked knowledge about their life, retrieve it for conversation, and ingest relevant activity without allowing users to access one another's data.
User and operator impact
Operators provision users and high-entropy API tokens manually in PostgreSQL. Application backends keep those durable tokens server-side; browser voice clients receive only short-lived OpenAI client secrets. Every durable read and write is resolved through the authenticated owner, with matching database ownership constraints.
Validation
cargo fmt --checkcargo clippy --all-targets --all-features --locked -- -D warningscargo test --all-targets --all-features --lockedagainst PostgreSQL: 19 unit tests and 2 integration tests passedgit diff --cached --checkA live OpenAI WebRTC exchange still requires a deployed API key and a voice client; the server request and event contract is documented and aligned with the Realtime API.