Repository navigation
C-186: feat(cli): the runner uploads a render for a share; demoflow share and the MCP share_demo tool - #408
Merged
AndreyBegma merged 10 commits intoOct 27, 2026
Conversation
A render carries its scene cards as chapters in output ms (at most 100), and a project opts the MCP server into publishing share links with share.allowMcp, off by default (spec 349).
planChapters takes the plan's scene cards at their output start, after the idle map and every earlier card, so a chapter lands where the card is drawn. The FFmpeg renderer records them on every format it writes (spec 349, Decision 1).
The daemon announces features: ['share'] and answers share.prepare with the scenario's description, the render's chapters and the size of a poster it makes with FFmpeg (one JPEG frame, at most 1280 px wide, reused while newer than the render). The relay serves that poster for video.open with asset: 'poster'; an unknown asset is not-found. scenarioDescription moves to scenario-file.ts so the daemon reads descriptions the way demoflow render does.
The command resolves the run like demoflow render, finds its server id in the reported-runs index, posts /runner/shares with the device token and polls the share every second for up to ten minutes. Server refusals become exit-2 CommandErrors with their codes; an existing share is kept and printed; a failed upload exits 1. --password is asked for without echo on a terminal, else read from DEMOFLOW_SHARE_PASSWORD, and never taken as a flag value.
share_demo creates a share link for a reported run without a password, only when the run's project sets share.allowMcp: true. It waits up to 50 s for the upload and answers uploading when the runner is still at it.
…-the-runner-uploads-a-render-for
AndreyBegma
marked this pull request as ready for review
October 27, 2026 11:03
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.
Closes #349. Spec:
docs/specs/349-cli-share.md.What changed and why
The API (#347, #348) can create share links; this slice gives it something to share, through the runner, the CLI and the MCP server.
packages/core: optionalchapters({ title, atMs }, at mostMAX_CHAPTERS) onRenderOutput, so a share can show a chapter list. An optionalshare: { allowMcp }block on the project config.project-config.schema.jsonis regenerated.packages/renderer:planChapters(plan)turns the placed scene cards into chapters in output milliseconds, after idle trimming and cards. Each render inresult.jsonnow gets them; a run with no scenes gets[].apps/cli: runnerlaunches.syncsendsfeatures: ['share'], but only when the relay is on.share.prepareis routed torunner/share/prepare.ts. It finds the reported run and the render, and answersshare.preparedwith the scenario's description (read only inside the project root, cut to the API limit), the render's chapters and the poster's size. Otherwise it answersshare.error(not-found,no-render,io).runner/share/poster.tstakes one JPEG frame with FFmpeg atmin(1500, durationMs / 2), at most 1280 px wide and at most 1 MiB. The poster is cached in<runDir>/share/and reused while it is newer than the render; two shares of the same render at once make only one poster.video.openwithasset: 'poster'. An unknown asset isnot-foundwithout opening a file.scenarioDescriptionmoved tocommands/scenario-file.tsso the daemon can reuse it.apps/cli:demoflow share <runId>--format,--expires 7|30|90(default 30),--password,--json.--passwordis typed twice without echo, or read fromDEMOFLOW_SHARE_PASSWORDwhen there is no terminal. It is never a flag value.result.jsonand the run against the reported-runs index. It then waits up to 10 minutes for the upload and prints the page link, plus the file link when there is no password.share-existsanswer returns the existing link.share/publish.ts.locateRunwas extracted fromrender.ts, andsend/readJson/unexpectedare now exported fromauth/client.ts.apps/cli: MCPshare_demoshare-not-allowedunless the reported run's project root setsshare.allowMcp: true. It is also refused when there is no root or the config cannot be read.status: 'uploading'if the upload is not done; calling it again returns the same link.apps/cli/README.md: documents the command, the tool andshare.allowMcp, and corrects "videos never leave the machine".Acceptance criteria
result.jsonhaschaptersper render, one per scene card, in output ms; no scenes →[]; an oldresult.jsonstill parses. Checked bypackages/renderer/test/plan/chapters.spec.tsandbuild.spec.ts, and bypackages/core/test/run-result.spec.ts.features: ['share']. Checked byapps/cli/test/runner/connection.spec.tsanddaemon-launch.spec.ts.share.preparefor a reported mp4 run answers the description, the chapters and the poster size; the poster is a JPEG ≤ 1280 px wide. Checked byapps/cli/test/runner/share.spec.tswith real FFmpeg on mp4 and gif.not-found/no-render, and nothing outside the run is read. Checked byapps/cli/test/runner/share.spec.ts, which covers a file outside the run and a description outside the project.video.openwithasset: 'poster'streams exactly the poster file. Checked byapps/cli/test/runner/relay.spec.ts.demoflow shareagainst a fake API prints the link once the share isready; each refusal exits 2 with its code; the password is only in the request body, and--password <value>is rejected as an extra argument. Checked byapps/cli/test/commands/share.spec.ts(29 tests).share_demoanswersshare-not-allowedwithoutshare.allowMcp: trueand creates the share with it. Checked byapps/cli/test/mcp/share.spec.tsand the tool list inserver.spec.ts.project-config.schema.jsonis regenerated andshare.allowMcpis in it, with a description. Checked bypackages/core/test/json-schema.spec.ts(the committed schema matches the generated one) andproject-config.spec.ts; I did not open it in an editor.execution-plane.ymlCI covers the other two. On Linux, run serially: after mergingdevelop, core 537 passed, renderer 338 passed, apps/cli 1012 passed and 1 skipped (the macOS-onlyplutiltest).bun run checkandbun run buildpass.