# Purpose - Keep a concise, append-only timeline of meaningful product, schema, UI, and flow changes. - Preserve enough context so future work can quickly recover what was completed. Update rule: - Append a new numbered section for meaningful completed work. - Keep entries factual and grouped; avoid file-by-file noise. --- ### 0 — Genesis - Repository initialized. ### 1 — Foundation & Core Domain Setup - Rewrote project guidance docs (`CLAUDE.md`, `README.md`) and established the implementation checklist. - Implemented initial `device` and `link` domains across DB + logic layers (`data`, `errors`, `repository`, `controller`). - Established link token lifecycle flows: create/generate, validate, assign, revoke. ### 2 — Admin CRUD + Dashboard Evolution - Built admin CRUD flows for devices and links using remote functions + VM pattern. - Added device detail experience with metadata/actions + embedded live stream viewer. - Introduced shared device form and enabled editing from both list and detail surfaces. - Merged legacy `/devices` area into `/dashboard` and moved device detail routes under `/dashboard/[id]`. - Improved details-page layout density and stream viewport behavior. ### 3 — Device/Link Model Maturation - Added device occupancy state (`inUse`) and surfaced it in admin list/detail views. - Made connection fields (`containerId`, `wsPort`) required end-to-end to match schema constraints. - Shifted link creation from freeform app data to controlled app selection. - Added normalized `supported_app` schema/domain + admin CRUD page, then refactored links to use `supportedAppId`. - Updated README flow to reflect app-leasing behavior and explicit device allocation/release expectations. ### 4 — Streaming Infrastructure & URL Correctness - Added ws-scrcpy container build/runtime setup and deployed behind Traefik. - Resolved Node/runtime/networking issues and brought redroid streaming online. - Replaced incorrect viewer URL assembly with the correct ws-scrcpy hash/proxy stream builder. - Clarified separation between internal ADB endpoint fields (`host` + `wsPort`) and public stream domain. ### 5 — Front/Orchestrator Session Lifecycle - Implemented link resolve/prepare server flow across front and orchestrator services. - Added orchestrator internal API auth + device routes + session-prepare endpoint. - Implemented session prepare behavior: allocate device, run ADB connect/force-stop/launch, release on failure. - Added atomic `allocateIfAvailable` path in logic to avoid concurrent allocation race conditions. ### 6 — Architecture Refactors (Orchestrator, Front, Frontend) - Refactored orchestrator into thin entrypoint + domain routers/services + shared core request/auth helpers. - Split low-level command execution (ADB/app-launch) from orchestration coordination responsibilities. - Refactored front app into thin entrypoint + domain service/router/core utilities. - Migrated frontend link flows into SvelteKit remote functions and aligned `FlowExecCtx` construction. - Reduced remote layer to thin entrypoints by moving link/orchestrator/domain logic into dedicated modules. ### 7 — Type Hygiene & Stability Fixes - Removed duplicated frontend domain types and reused canonical `@pkg/logic` types/schemas. - Fixed stale links refresh behavior caused by cached SvelteKit `query()` objects via explicit `query.refresh()`. - Fixed Hono status/body typing issues across front/orchestrator and excluded legacy prototype server file from TS checks. - Fixed historical `/links` auth path-matching bug and earlier device table refresh issue. ### 8 — Memory Log Condensation (Grouped) - Re-condensed timeline from many micro-numbered entries into broader milestone groups. - Restored important implementation details while keeping the log substantially shorter and easier to scan.