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:
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user