Gamelayer - #587
Conversation
Ports the lingbot demo web assets from the pre-v2 tree (integrations/lingbot/lingbot/webrtc/web/) into the v2 application layout at integrations_v2/lingbot/apps/cam2v/web/, and ships them via package-data so they install with the package. Adds plain venv+pip setup.sh (no uv) and run.sh, which drives the v2 CLI (flashdreams-run-v2) since the v1 runner and RUNNER_CONFIGS were removed in the v2 refactor. run.sh exposes LIGHT/WIDTH/HEIGHT/FPS to reduce the generated frame size and rate; there is no encoder choice to make because v2 serving hands raw frames to aiortc's software encoder. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds IWebUiProvider to api_v2. An application implementing it returns a web root, a scene, a first frame, and the result of one page submission, and the v2 WebRTC server gains five routes for that run: GET /request_session index.html from the web root GET /<file> any other file in it, resolved inside GET /api/session/initial_scene the scene, verbatim as JSON GET /api/session/first_frame the first frame, or 404 POST /api/session/input one submission, answered with the scene Serving stays generic: it copies the scene into a JSON response and hands the decoded request body back without inspecting either. JSON, form and multipart bodies arrive as one flat mapping, uploads as bytes, and a ValueError becomes a 400. Applications without the protocol are untouched -- every route 404s, and the wiring is a single isinstance check. Lingbot is the first implementation, restoring its scene presets, live text events and HUD on v2. Text events swap the rollout's text context through the app-supplied generate_step hook, which runs on the model thread between chunks, so no shared code changes and there is no mid-step race. Picking a preset asks the runtime for a new session, because a rollout cannot swap the frame it was initialized from, and a scene naming an image that cannot seed one is reported rather than skipped. The runner also says why a run ended. A run that stops without a word is indistinguishable from a crash to whoever is watching the server, and a client can end one by sending a close event. 63 CPU tests (20 serving, 43 scene rules); verified end to end on a GB300. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Greptile SummaryThe PR adds an application-owned browser UI protocol to runtime-v2 and implements it for Lingbot.
Confidence Score: 3/5The PR does not appear safe to merge because installed Lingbot packages still lack required UI files and concurrent scene access remains unsynchronized. Installed-wheel launches still resolve the browser page from package files that are not declared as package data, while HTTP handlers continue mutating shared scene state without synchronizing concurrent readers and model activity. Files Needing Attention: integrations_v2/lingbot/pyproject.toml and integrations_v2/lingbot/apps/cam2v/adapter.py Important Files Changed
Sequence DiagramsequenceDiagram
participant B as Browser
participant S as WebRTC server
participant A as IWebUiProvider
participant M as Model/UI loops
B->>S: GET /request_session
S-->>B: Application index.html
B->>S: GET /api/session/initial_scene
S->>A: initial_scene()
A-->>S: Scene mapping
S-->>B: JSON scene
B->>S: POST /api/session/input
S->>A: apply_session_input(payload)
A->>M: Queue prompt or replacement session
A-->>S: Updated scene
S-->>B: JSON scene
Reviews (2): Last reviewed commit: "Merge branch 'NVIDIA:main' into gamelaye..." | Re-trigger Greptile |
| "lingbot.apps.cam2v" = [ | ||
| "web/adapter.css", | ||
| "web/adapter.js", | ||
| "web/scene_presets.json", | ||
| "web/assets/*.jpg", | ||
| "web/assets/sources/*.json", | ||
| ] |
There was a problem hiding this comment.
Package omits required UI assets
When Lingbot runs from an installed wheel, this package-data list excludes index.html, request_session.js, and request_session.css, causing /request_session or its required assets to return 404 instead of loading the application UI.
Knowledge Base Used: Packaging and launch configuration
| scene = self._require_scene() | ||
| before = (scene.image_bytes, scene.image_url) | ||
| prompt = scene.apply(payload) |
There was a problem hiding this comment.
Serve an application's own browser UI from the v2 runtime
Adds
IWebUiProvidertoapi_v2. An application implementing it returns a webroot, a scene, a first frame, and the result of one page submission, and the v2
WebRTC server gains five routes for that run:
GET /request_sessionindex.htmlfrom the application's web rootGET /<file>GET /api/session/initial_sceneGET /api/session/first_framePOST /api/session/inputServing stays generic: it copies the scene into a JSON response and hands the
decoded request body back without inspecting either. JSON, form and multipart
bodies arrive as one flat mapping, uploads as
bytes, and aValueErrorbecomesa 400. Applications without the protocol are untouched — every route 404s, and
the wiring is a single
isinstancecheck.Lingbot is the first implementation, restoring its scene presets, live text
events and HUD on v2. Its page takes
?manual(skip auto-connect),?preset=(open on a scene) and
?director(environment events instead of player ones).63 CPU tests (20 serving, 43 scene rules)
