Commit Graph

35 Commits

Author SHA1 Message Date
Sanju Sivalingam
ce6d1e320b fix: handle Polar activation limit gracefully + switch checkout to command pattern
- Server: wrap licenseKeys.activate() in try/catch — if activation limit
  reached, treat as already-activated and proceed to store the key
- Web: switch activateFromCheckout from form() to command() pattern for
  programmatic invocation with proper error handling
- Activate page: auto-fires on mount, shows spinner/error states, retry button
2026-02-18 23:28:19 +05:30
Sanju Sivalingam
e9d1c863e1 fix: self-hosted useSend support + purchase-first activate UX
- Pass USESEND_BASE_URL to UseSend SDK for self-hosted instances
- Add debug logging for email sends
- Redesign activate page: prominent Purchase Now button, collapsible license key input
2026-02-18 23:08:27 +05:30
Sanju Sivalingam
9b2ca21d28 fix: address code review issues for email verification
- Use $env/dynamic/private instead of process.env (SvelteKit convention)
- Fail fast if USESEND_API_KEY is missing
- Await sendEmail with try/catch + console.error (was silently discarded)
- Fallback for user.name in email greeting
- Fix open redirect on login redirect param
2026-02-18 23:08:27 +05:30
Sanju Sivalingam
7b5685cc25 feat: add Umami analytics tracking across web app
Add centralized event tracking with consistent naming convention.
Tracks auth flows, license activation, device interactions, API key
management, settings, and navigation for conversion analysis.
2026-02-18 23:08:27 +05:30
Sanju Sivalingam
caf9862f4f feat: handle unverified login with redirect to verify-email 2026-02-18 23:08:27 +05:30
Sanju Sivalingam
8b614dac95 feat: redirect signup to verify-email page 2026-02-18 23:08:27 +05:30
Sanju Sivalingam
8783fe90a3 feat: wire email verification into better-auth config 2026-02-18 23:08:27 +05:30
Sanju Sivalingam
7125aed49f feat: add email helper module using useSend SDK 2026-02-18 23:08:27 +05:30
Sanju Sivalingam
8748e7a28b feat: add usesend-js dependency for email verification 2026-02-18 23:08:27 +05:30
Sanju Sivalingam
b34088ceb7 feat: Polar license key integration and dashboard UI improvements
- Add license activation flow: server validates/activates keys via Polar SDK
- Auto-activate from Polar checkout redirect (checkout_id in URL)
- Gate dashboard behind license activation (redirect to /activate if no plan)
- Preserve redirect URL through login flow for post-purchase activation
- Show plan status badge in sidebar and overview page
- Add account section to settings (email, plan, license key)
- Add svelte-sonner toasts with custom black theme and iconify icons
- Improve validation messages across all forms
- Update API key prefix to droidclaw_
- Add cursor pointer globally for clickable elements
- Support Polar sandbox mode via POLAR_SANDBOX env flag
2026-02-18 23:08:27 +05:30
Sanju Sivalingam
88af77ddc7 fix: configure postgres idle timeout and connection recycling for Railway
Railway proxy closes idle DB connections after ~60s, causing
CONNECTION_CLOSED errors on stale sockets. Set idle_timeout=20s and
max_lifetime=5m so postgres-js recycles connections before they die.

Also fix sendCommand to fall back to persistent device ID on reconnect.
2026-02-18 13:56:34 +05:30
Sanju Sivalingam
3bab84f611 fix(auth): use internal secret for web→server calls instead of cookie forwarding
Cookie forwarding between dash.droidclaw.ai and tunnel.droidclaw.ai was
unreliable. Now the web app passes userId + shared internal secret via
headers. Also removes debug logging from device auth and session middleware.
2026-02-18 12:40:49 +05:30
Sanju Sivalingam
22481c8834 add health endpoint to web app 2026-02-18 10:08:25 +05:30
Sanju Sivalingam
7a2a1186a2 use bun instead of node for web start script 2026-02-18 09:31:16 +05:30
Sanju Sivalingam
dbff2e1e35 add start script to web package.json for railway deploy 2026-02-18 09:30:33 +05:30
Sanju Sivalingam
e300f04e13 feat: installed apps, stop goal, auth fixes, remote commands
- Android: fetch installed apps via PackageManager, send to server on connect
- Android: add QUERY_ALL_PACKAGES permission for full app visibility
- Android: fix duplicate Intent import, increase accessibility retry window
- Android: default server URL to ws:// instead of wss://
- Server: store installed apps in device metadata JSONB
- Server: inject installed apps context into LLM prompt
- Server: preprocessor resolves app names from device's actual installed apps
- Server: add POST /goals/stop endpoint with AbortController cancellation
- Server: rewrite session middleware to direct DB token lookup
- Server: goals route fetches user's saved LLM config from DB
- Web: show installed apps in device detail Overview tab with search
- Web: add Stop button for running goals
- Web: replace API routes with remote commands (submitGoal, stopGoal)
- Web: add error display for goal submission failures
- Shared: add InstalledApp type and apps message to protocol
2026-02-17 22:50:18 +05:30
Sanju Sivalingam
fae5fd3534 fix: goals route now finds devices by persistent DB ID, not connection UUID 2026-02-17 21:22:43 +05:30
Sanju Sivalingam
5b73e89217 fix: add valibot schemas to query() functions — fixes bad request on detail page 2026-02-17 21:16:58 +05:30
Sanju Sivalingam
423cd7af01 fix: add getDevice query, fix IN clause, add error handling to getDeviceStats 2026-02-17 21:13:50 +05:30
Sanju Sivalingam
b240887b0e fix: resolve type errors in devices pages 2026-02-17 21:08:47 +05:30
Sanju Sivalingam
9de0b040dc feat: rewrite device detail page with tabbed layout (Overview/Sessions/Run)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 21:05:26 +05:30
Sanju Sivalingam
a46af1a236 feat: rewrite devices page as phone-card grid
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 21:04:18 +05:30
Sanju Sivalingam
a5bfe74384 feat: add DeviceCard.svelte phone-frame component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 21:03:25 +05:30
Sanju Sivalingam
9423ed85ff feat: add device stats query and enrich listDevices with metrics
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 21:02:07 +05:30
Sanju Sivalingam
c395f9d83e feat: add DB persistence, real-time WebSocket, goal preprocessor, and Android companion app
- Add device/session/step DB persistence in server agent loop
- Add goal preprocessor for compound goals (e.g., "open YouTube and search X")
- Add step-level logging to agent loop
- Fix dashboard WebSocket auth (direct DB token lookup instead of auth.api)
- Fix web layout to use locals.session.token instead of cookie
- Add dashboard-ws.svelte.ts WebSocket store with auto-reconnect
- Rewrite devices page with direct DB queries and real-time updates
- Add device detail page with live step display and session history
- Add Android companion app resources, themes, and screen capture consent

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 20:12:41 +05:30
Sanju Sivalingam
61461199db fix: add non-null assertion for deviceId route param
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:06:23 +05:30
Sanju Sivalingam
c659dfd8cc feat: add web Dockerfile for Railway deployment
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:46:31 +05:30
Sanju Sivalingam
84af22e4a1 feat: add goal proxy API route
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:45:52 +05:30
Sanju Sivalingam
7557481e83 feat: add devices page with goal input and step log
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:45:47 +05:30
Sanju Sivalingam
edfc91468b feat: add LLM provider settings page
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:45:44 +05:30
Sanju Sivalingam
8fc5587876 fix: use schema-based deleteKey and reactive key list refresh
- Add deleteKeySchema for proper FormData validation
- Return { deleted: true } from deleteKey for change tracking
- Use $state for keysPromise to refresh list after create/delete

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:43:46 +05:30
Sanju Sivalingam
9422e94a8e feat: add API keys management page
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:40:42 +05:30
Sanju Sivalingam
ebe82c7481 feat: add dashboard layout with navigation and auth guard
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:32:26 +05:30
Sanju Sivalingam
c0cf5039cd feat: switch SvelteKit from Cloudflare to node adapter
Deploying to Railway instead of Cloudflare, so swap
@sveltejs/adapter-cloudflare for @sveltejs/adapter-node.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:29:47 +05:30
Sanju Sivalingam
5b2a072cee feat: add apiKey plugin and new schema tables
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:11:55 +05:30