# Purpose: - Keep a concise append-only history of meaningful product, schema, UI, and flow changes. - Add short factual entries so future work can quickly recover what has already been done. Update rule: - Make a new numbered section, and append one (or more if necessary) short bullet per meaningful completed change. - Keep entries concise and factual. - Prefer grouped summaries over noisy file-by-file notes. --- ### 0 - Genesis - init ### 1 — Foundation & Domain Logic - Rewrote CLAUDE.md to be concise (conventions only, no obvious stuff) - Rewrote README.md with project description and implementation checklist - Implemented device domain: schema (db), data/errors/repository/controller (logic pkg) - Implemented link domain: schema (db), data/errors/repository/controller (logic pkg) - Device schema: id, title, version, status, isActive, containerId, host, wsPort - Link schema: id, token (unique), status, linkedDeviceId (FK nullable to device), expiresAt, lastAccessedAt - Link controller auto-generates nanoid(12) tokens, has validate/assign/revoke flows ### 2 — Admin Dashboard CRUD - Device CRUD page at /devices — list table, create dialog, delete with confirmation, status dots, refresh - Link CRUD page at /links — list table, generate link dialog (device select + expiry), revoke, delete, copy token - Remote functions for both domains (*SQ queries, *SC commands) - View models (\*.vm.svelte.ts) with optimistic UI updates (create appends, delete filters locally) - Fixed bug: table not refreshing after create (was SvelteKit query cache — switched to optimistic local state) - Fixed bug: /links auth failure (hooks.server.ts path check matching "/link" inside "/links") ### 3 — ws-scrcpy Deployment - Created ws-scrcpy Dockerfile (dockerfiles/ws-scrcpy.Dockerfile) — clones NetrisTV/ws-scrcpy, builds, copies dist - Created apps/ws-scrcpy/config.yaml and entrypoint.sh (ADB connect + node index.js) - Resolved node-pty NAN build failure: node:25 incompatible, settled on node:22-bookworm - Deployed via Dokploy with Traefik domain routing - Networking: redroid on bridge, ws-scrcpy on dokploy overlay — connected via host bridge gateway (172.17.0.1:5555) - ws-scrcpy live and streaming redroid at iotam-ws-scrcpy.snapyra.com ### 4 — Device Detail Page - Implemented `/devices/[id]` admin detail page with metadata, refresh/open actions, and an embedded live ws-scrcpy iframe - Added a dedicated device details VM and derived the viewer URL from stored device host/wsPort data - Updated `/devices` so device entries navigate into their detail page ### 5 — README Product Flow Update - Updated the implementation plan to reflect the app-leasing model: links target a specific app on a device, front triggers orchestrator reset/launch during loading, and devices need explicit `inUse` tracking ### 6 — Admin App Leasing Model - Added `inUse` to the device schema/domain and surfaced it in the devices admin list/detail views - Extended links to store required leased app data (`appName`, `appPackage`) alongside the assigned device - Updated the admin links creation flow and listing UI so links are created against a specific device and app package ### 7 — Required Device Connection Fields - Propagated `containerId` and `wsPort` as required device fields across validation, repository create logic, and the admin device creation form to match the non-null schema ### 8 — Reused Device Edit Form - Added a shared device form component under the device domain and reused it for create/edit flows - Added manual device editing in the devices list and device detail page, including overrides for host, container ID, ws port, status, `isActive`, and `inUse` ### 9 — Supported App Link Creation - Updated admin link creation to select from `SUPPORTED_APPS` in constants instead of accepting freeform app name/package input ### 10 — Device Detail Page Layout Improvement - Restructured device detail layout: Metadata + Edit Device side-by-side in top row, Live Device Session full-width below - Iframe now uses `h-[75vh] min-h-[480px]` instead of fixed 720px height, making it fill available space - Added "Pop out" link in the Live Device Session card header for quick external access - Tightened metadata card with inline grid rows (port/in-use, created/updated) and smaller labels - Styled backtick code refs in Edit Device description with `` tags - Updated skeleton loading state to match the new two-row layout ### 11 — Merged Devices Page into Dashboard - Moved device list (table, create/edit/delete dialogs) from `/devices` into `/dashboard` — dashboard is now the devices home - Moved device detail page from `/devices/[id]` to `/dashboard/[id]` - Removed `/devices` route directory entirely - Removed "Devices" entry from `mainNavTree` sidebar navigation (was index 2) - Cleaned up unused `Smartphone` import from constants.ts - Updated detail page breadcrumbs to go Dashboard > Device instead of Dashboard > Devices > Device - Updated `goto` calls to navigate to `/dashboard/:id` instead of `/devices/:id` ### 12 — Supported Apps Catalogue - Added a normalized `supported_app` schema and matching logic domain for supported-app CRUD - Added an admin `/supported-apps` page and sidebar entry for managing the app catalogue - Refactored links to reference `supportedAppId` and load supported app labels from the catalogue instead of freeform app fields/constants ### 13 — Fixed ws-scrcpy Stream URL - Added `WS_SCRCPY_URL` constant in `constants.ts` for the static public ws-scrcpy domain - Replaced broken `normalizeViewerUrl` (which wrongly jammed ADB port into the public domain) with `buildStreamUrl` in `device-details.vm.svelte.ts` - New builder constructs the correct hash-based ws-scrcpy stream URL: `#!action=stream&udid={host}:{wsPort}&player=mse&ws=wss://.../?action=proxy-adb&remote=tcp:8886&udid={host}:{wsPort}` - Device `host` and `wsPort` are now correctly treated as internal ADB address (e.g. `172.17.0.1:5555`), not the public domain - Scrcpy server port (8886) hardcoded as constant since it's static per the ws-scrcpy architecture ### 14 — Frontend Domain Type Source-of-Truth Refactor - Refactored `apps/main/src/lib/domains/{device,link,supported-app}` to remove local duplicate data type declarations and import canonical types from `@pkg/logic/domains/*/data` - Updated device status validation in `device.remote.ts` to reuse `deviceStatusSchema` from logic instead of a duplicated local picklist - Kept only derived UI helper types (`Pick`/`Omit`) where needed for presentation and transport-shape compatibility