Skip to content

Gamelayer - #587

Open
3a1b2c3 wants to merge 4 commits into
NVIDIA:mainfrom
3a1b2c3:gamelayer
Open

Gamelayer#587
3a1b2c3 wants to merge 4 commits into
NVIDIA:mainfrom
3a1b2c3:gamelayer

Conversation

@3a1b2c3

@3a1b2c3 3a1b2c3 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Serve an application's own browser UI from the v2 runtime

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:

Route Serves
GET /request_session index.html from the application's web root
GET /<file> any other file in that web root, resolved inside it only
GET /api/session/initial_scene the application's scene, verbatim as JSON
GET /api/session/first_frame the session's first frame, or 404 when there is none
POST /api/session/input one page submission, answered with the resulting 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. 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)
image

katrinbschmid and others added 3 commits September 4, 2026 12:17
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>
@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds an application-owned browser UI protocol to runtime-v2 and implements it for Lingbot.

  • Adds generic WebRTC routes for application assets, initial scenes, first frames, and session input.
  • Adds Lingbot scene presets, uploads, text events, HUD behavior, documentation, and CPU tests.
  • Wires IWebUiProvider applications into the WebRTC client-window lifecycle.

Confidence Score: 3/5

The 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

Filename Overview
flashdreams/flashdreams/runtime_v2/serving/webrtc_server.py Adds generic application UI routing, asset containment, request decoding, and scene/frame endpoints.
flashdreams/flashdreams/api_v2/web_ui.py Defines the runtime-checkable application protocol for browser UI assets and scene operations.
integrations_v2/lingbot/apps/cam2v/adapter.py Implements Lingbot’s web UI provider and live scene updates, while the previously reported shared-state synchronization defect remains.
integrations_v2/lingbot/apps/cam2v/scene.py Restores scene presets, prompt and event updates, image selection, and serialized page state.
integrations_v2/lingbot/pyproject.toml Adds package-data declarations, but the previously reported required UI asset omissions remain.
flashdreams/test_v2/test_webrtc_web_ui.py Exercises application route registration, request decoding, asset containment, first-frame behavior, and errors.

Sequence Diagram

sequenceDiagram
    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
Loading

Reviews (2): Last reviewed commit: "Merge branch 'NVIDIA:main' into gamelaye..." | Re-trigger Greptile

Comment on lines +63 to +69
"lingbot.apps.cam2v" = [
"web/adapter.css",
"web/adapter.js",
"web/scene_presets.json",
"web/assets/*.jpg",
"web/assets/sources/*.json",
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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

Comment on lines +327 to +329
scene = self._require_scene()
before = (scene.image_bytes, scene.image_url)
prompt = scene.apply(payload)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Scene mutations are not synchronized

If scene requests overlap each other or model generation, HTTP workers mutate the shared SceneState while other threads read it, causing responses and rollout conditioning to combine inconsistent prompt, event, or image state.

Knowledge Base Used:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants