Add public demo application contracts - #454
Open
jarcherNV wants to merge 33 commits into
Open
Conversation
Introduce the flashdreams.demo facade for application-facing demo protocols and thin adapters over the existing runtime demo stack. Cover the Phase 1 contract shape with focused CPU tests.
Contributor
Greptile SummaryThe PR introduces the public demo application contracts and adapters, migrates text-to-video integrations to application entry points, and strengthens runner and WebRTC lifecycle cleanup.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Sequence DiagramsequenceDiagram
participant CLI
participant Runner
participant Application
participant Host as RuntimeHost
participant Session
participant IO as IOHandler
CLI->>Runner: run()
Runner->>Application: init(launch_args)
Runner->>Host: register application close hook
Host->>Application: create_session()
Application-->>Host: ApplicationSession
Host->>Session: init()
loop generation
Session->>Session: next_step_requirements()
Runner->>IO: next_window(requirements)
Runner->>Session: step(model_input)
Runner->>IO: emit_chunk(result)
end
Runner->>Session: close()
Runner->>IO: close()
Runner->>Host: dispatch Application.close()
Runner->>Host: close owned host
Reviews (25): Last reviewed commit: "Clean up WebRTC distributed state on sta..." | Re-trigger Greptile |
Expose flashdreams.demo.Runner as an application-facing wrapper over the existing shared demo session helpers. Adapt public Application and IOHandler objects into the runtime demo stack while preserving RuntimeHost worker affinity, StepPipeline execution, metrics, output decisions, and cleanup. Cover direct sync and async Runner usage with focused CPU tests.
Add application-level cleanup to the public demo contract and make DemoAdapterApplication close every runtime it creates. Reject unsupported launch args instead of silently dropping them, and cover repeated session creation and cleanup with focused CPU tests.
Introduce public replay, native-window, and WebRTC IO factory shapes under flashdreams.demo. Keep WebRTC server-shaped so handlers are produced per connection, and move the Runner IO run-mode adapter into the shared factory module. Cover factory-produced replay handlers, metric forwarding, native factory shape, and WebRTC server callback behavior with focused CPU tests.
Add the public DemoApplication app base and route replay launches through the public replay IO factory plus Runner. Keep the old runtime demo app import as a compatibility shim. Expose a server-shaped callback adapter for existing WebRTC serving code, and update OmniDreams and LingBot demo apps to use the new app-base IO selection hook instead of prepare_webrtc/serve_webrtc. Repoint non-benchmark finite flashdreams-run launches at the public replay Runner helper. Add CPU tests for app-base replay selection, server-shaped selection, and the adapter-backed Runner path.
Make Runner own Application.close() explicitly instead of relying on owned host cleanup to reach it. Application cleanup now runs through the host worker for both owned and externally supplied hosts, and is attempted even when context cleanup raises. Add focused sync and async coverage for external-host cleanup and cleanup failure paths.
Make cleanup note handling type-checker friendly and update the fake public demo session to satisfy the runtime session protocol through a test adapter.
Add InputName and central input state decoders for public demo IO handlers. ReplayIOHandler now exposes get_user_input_state as a deterministic view over the current UserInputWindow, including keyboard state, snapshot-backed state, and legacy key_* compatibility. Add fake CPU tests for provider access, pull/window parity, and named state lookup through the public API.
Bind adapter-prepared replay inputs and source schemas onto ReplayIOHandler before shared runtime validation. This lets DemoAdapterApplication replay commands advertise provider-required raw user input schemas, including the OmniDreams Ludus keyboard event schema. Add CPU coverage for replay IO schema propagation.
Add a small T2VApplication/defaults facade and route T2V mp4/null launches through the public Runner and replay IO handler. This moves the batch T2V demo onto the application API while preserving the existing WebRTC serving path. Update focused T2V tests to assert public runner wiring.
Derive legacy t2v_demo backend metadata and preset selection from the integration-owned application and runner configs. Add a neutral helper for building T2V model configs from runner configs, and keep the old t2v runner bridge working while deleting the app-local backends.py and presets.py copies.
Reject closed external hosts before app initialization, avoid direct runner-thread application cleanup when worker dispatch is unavailable, and preserve primary async run failures when cancellation arrives during cleanup.
jarcherNV
force-pushed
the
dev/jarcher/basicdemo
branch
from
August 13, 2026 11:17
e2b6f6b to
aa69c9b
Compare
Add finite-mode application launch support to the central CLI for discovered flashdreams.applications entry points. Route direct mp4 and null launches through the current public demo Application/Runner API, while keeping the existing t2v runner bridge for compatibility.
Route discovered application slugs through the shared WebRTC serving path for direct flashdreams-run app launches. Move T2V WebRTC resources into the neutral T2V shell and keep the legacy t2v_demo package until the new WebRTC path is remotely validated.
Ensure direct public WebRTC app launches close the created runtime when startup fails before aiohttp owns shutdown. Route failure cleanup through the WebRTC manager and RuntimeHost path, preserving the original startup error, and add CPU coverage for the cleanup behavior.
Register `wan21-t2v` and `fastvideo-causal-wan22-t2v` under the `flashdreams.applications` entry-point group so both models launch directly from `flashdreams-run` alongside the existing three T2V apps. Each integration gains a `t2v/` subpackage wrapping its existing runner config, plus the `flashdreams-t2v` workspace dependency. No shell changes were needed: wan22 is autoregressive like the existing streaming apps, and wan21 T2V is single-step, which `model_config_from_runner` already covers via its `total_blocks` fallback of 1. Restore the T2V README, lost with `apps/t2v_demo`, documenting the five slugs, the three launch modes, and the scenario and output overrides.
Ensure public runner cleanup still invokes Application.close() when an externally supplied RuntimeHost has already stopped accepting dispatched work. Add sync and async regression coverage for the closed-host fallback so application-owned runtimes are not orphaned.
Make BaseWebRTCSessionManager.shutdown attempt every owned cleanup step even when active-session shutdown fails. Preserve the first cleanup error while recording later failures as notes, and add regression coverage that shared RuntimeHost cleanup still runs after session and context close failures.
Do not call Application.close() directly when an external RuntimeHost is already closed before runner cleanup can dispatch onto the model worker. Report the invalid lifecycle instead, preserving the worker-affinity boundary required for model/runtime cleanup. Update sync and async runner tests to cover the closed-host failure path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce the flashdreams.demo facade for application-facing demo protocols and thin adapters over the existing runtime demo stack. Cover the Phase 1 contract shape with focused CPU tests.