From 0397c375acea763d3110163b045d259155ba2341 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Mon, 21 Sep 2026 01:18:53 +0800 Subject: feat(viewer): stream live pipeline GLBs into the browser viewport Protocol: RunSnapshot gains CompletedSteps (accumulated from checkpoint artifact paths, reset on start) so the frontend can tell when real pipeline geometry exists. New coordinator method StepArtifact plus GET /api/artifacts/steps serves steps/*.glb while a run is active (any lifecycle status), traversal-guarded and .glb-only, so stages appear without waiting for run completion. Frontend: GLTFLoader loads the latest completed step into the viewport group as soon as its checkpoint lands over SSE; replay placeholder frames render only while no step artifacts exist. ?freeze=1 query param stops rotation for deterministic screenshot verification. Three.js r160 and GLTFLoader (with BufferGeometryUtils) are vendored under public/ vendor with an import map and a window.THREE shim, replacing the CDN UMD script; the ~1.4MB vendored three.js files are third-party dependencies (MIT), not project assets. Tests: store accumulation of completed artifact paths; steps endpoint serves GLB during an active run, rejects traversal, 404s missing files. Verified: dotnet build Debug+Release clean, 42/42 tests pass, Fable compile clean, release server smoke serves index/vendor/steps endpoint. --- src/SomhairlesDream.Server/ArtifactRunCoordinator.fs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/SomhairlesDream.Server/ArtifactRunCoordinator.fs') diff --git a/src/SomhairlesDream.Server/ArtifactRunCoordinator.fs b/src/SomhairlesDream.Server/ArtifactRunCoordinator.fs index 78d5dee..dbf87df 100644 --- a/src/SomhairlesDream.Server/ArtifactRunCoordinator.fs +++ b/src/SomhairlesDream.Server/ArtifactRunCoordinator.fs @@ -139,3 +139,18 @@ type ArtifactRunCoordinator( | Error message -> Error(InvalidArtifactPath message) | Ok path when not (File.Exists(path)) -> Error ArtifactNotFound | Ok path -> Ok path + + member _.StepArtifact(projectId: string, runId: string, relativePath: string) : Result = + match registry.TryFind(projectId, runId) with + | None -> Error RunNotFound + | Some _ -> + let directory = runDirectory projectId runId + + match safeArtifactPath directory relativePath with + | Error message -> Error(InvalidArtifactPath message) + | Ok path when not (path.EndsWith(".glb", StringComparison.OrdinalIgnoreCase)) -> + Error(InvalidArtifactPath "step artifacts must be .glb files") + | Ok path when not (path.StartsWith(Path.Combine(directory, "steps") + string Path.DirectorySeparatorChar, StringComparison.Ordinal)) -> + Error(InvalidArtifactPath "step artifacts must live under steps/") + | Ok path when not (File.Exists(path)) -> Error ArtifactNotFound + | Ok path -> Ok path -- cgit v1.2.3