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>
This commit is contained in:
Sanju Sivalingam
2026-02-17 20:12:41 +05:30
parent ea707af83e
commit c395f9d83e
101 changed files with 8824 additions and 82 deletions

View File

@@ -63,6 +63,8 @@ const server = Bun.serve<WebSocketData>({
return app.fetch(req);
},
websocket: {
idleTimeout: 120,
sendPings: true,
open(ws) {
console.log(`WebSocket opened: ${ws.data.path}`);
},
@@ -73,12 +75,17 @@ const server = Bun.serve<WebSocketData>({
: new TextDecoder().decode(message);
if (ws.data.path === "/ws/device") {
handleDeviceMessage(ws, raw);
handleDeviceMessage(ws, raw).catch((err) => {
console.error(`Device message handler error: ${err}`);
});
} else if (ws.data.path === "/ws/dashboard") {
handleDashboardMessage(ws, raw);
handleDashboardMessage(ws, raw).catch((err) => {
console.error(`Dashboard message handler error: ${err}`);
});
}
},
close(ws) {
close(ws, code, reason) {
console.log(`WebSocket closed: ${ws.data.path} device=${ws.data.deviceId ?? "unknown"} code=${code} reason=${reason}`);
if (ws.data.path === "/ws/device") {
handleDeviceClose(ws);
} else if (ws.data.path === "/ws/dashboard") {