Step 5 corrected: internal plan_json widget is the only safe paste surface - ComfyUI frontend dynamic-prompt serializer strips braces from dynamicPrompts:true widgets at queue time (Extra data fingerprint = quoted first key length; probe calibration included)

This commit is contained in:
Z User 2026-10-30 22:40:34 +00:00
parent bb72baaa3a
commit 99c3e89beb
2 changed files with 69 additions and 30 deletions

View File

@ -243,15 +243,21 @@ three six-section shots: exactly the shape the single-pass system prompt emits (
file: `h3_agent_workflow_examples/plan.json`). file: `h3_agent_workflow_examples/plan.json`).
**7. Render the multi-clip video.** Paste the full contents of `plan.json` into the **7. Render the multi-clip video.** Paste the full contents of `plan.json` into the
Production Plan node's forced STRING input `plan_json_input` and queue **once**. The node Production Plan node's **internal `plan_json` widget** and queue **once** — that widget
renders each shot as its own clip and chains the clips through the H3 context loop — is the one paste surface the pack declares `"dynamicPrompts": False`, so the frontend
scene 2 continues from scene 1's final frames, scene 3 from scene 2's — producing ONE dynamic-prompt serializer cannot strip the JSON's braces. Disconnect `plan_json_input`
continuous multi-clip video: 685 delivered frames ≈ 28.5 s at 24 fps (every scene after first (a non-empty connected socket silently overrides the widget), select all, delete,
the first loses ~1 second to the fixed overlap trim that stitches the clips together). paste, queue. The node renders each shot as its own clip and chains the clips through
The `plan_json_input` field must hold exactly this one JSON object — first character `{`, the H3 context loop — scene 2 continues from scene 1's final frames, scene 3 from scene
last character `}`, nothing before or after. If ComfyUI reports 2's — producing ONE continuous multi-clip video: 685 delivered frames ≈ 28.5 s at 24 fps
`H3 Chain Plan JSON is invalid: Extra data: …`, the field picked up extra text: clear it (every scene after the first loses ~1 second to the fixed overlap trim that stitches the
completely and paste once. clips together). The widget must hold exactly this one JSON object — first character
`{`, last character `}`, nothing before or after. If ComfyUI reports
`H3 Chain Plan JSON is invalid: Extra data: line 1 column 16 (char 15)`, the paste went
through a `dynamicPrompts: true` surface (prompt-typed widgets, third-party string nodes
with dynamic prompts) and the frontend ate the braces — the parsed head is just the
plan's quoted first key (`"prompt_prefix"` = 15 chars). Never paste a plan into a
prompt-typed node.
Want scene 2 different? Just tell the agent "rewrite scene 2, keep everything else": it Want scene 2 different? Just tell the agent "rewrite scene 2, keep everything else": it
rewrites only `scene_02.json`, re-validates it, and re-merges — refreshing `plan.json` rewrites only `scene_02.json`, re-validates it, and re-merges — refreshing `plan.json`
@ -274,10 +280,18 @@ Smoke test with the shipped examples:
### Wiring the result ### Wiring the result
Paste the full contents of `plan.json` into the Plan node's forced STRING input Paste the full contents of `plan.json` into the Plan node's internal **`plan_json`**
**`plan_json_input`** (a non-empty connected value overrides the visual editor's plan for widget — declared `"dynamicPrompts": False` in the pack source, the one surface where
that run) and queue once — the node's context loop turns the multi-shot plan into one ComfyUI's frontend dynamic-prompt serializer (which resolves `{a|b}` groups and strips
multi-clip video by itself; no per-scene renders, no editor stitching. Resolution, braces in `dynamicPrompts: true` widgets at queue time) cannot touch the JSON.
Disconnect `plan_json_input` first (a non-empty connected value silently overrides the
widget for that run), select all, delete, paste, and queue once — the node's context
loop turns the multi-shot plan into one multi-clip video by itself; no per-scene
renders, no editor stitching. The `plan_json_input` socket stays for programmatic
delivery (an LLM story director node producing the plan at execution time); a hand
paste through a string node is safe only if that node provably leaves braces alone —
probe it with `{"shots":[{"id":"probe","prompt":["test card"]}]}`:
`Extra data: line 1 column 8 (char 7)` means the node eats braces. Resolution,
context length, audio mode, and `base_seed` stay on the node's own widgets (the JSON context length, audio mode, and `base_seed` stay on the node's own widgets (the JSON
cannot set them; default canvas is 960×544 — set width/height widgets and wire the cannot set them; default canvas is 960×544 — set width/height widgets and wire the
width/height outputs into the conditioning node and sampler latent to avoid square width/height outputs into the conditioning node and sampler latent to avoid square

View File

@ -181,24 +181,49 @@ failure is reported as `H3 Chain Plan JSON is invalid: <detail>`. If the effecti
string were exactly the delivered `plan.json` bytes, this parse cannot fail; a string were exactly the delivered `plan.json` bytes, this parse cannot fail; a
reported error always means the field content differs from the file. reported error always means the field content differs from the file.
Deliver through the external socket, which the visual editor cannot corrupt: add a **Paste into the node's internal `plan_json` widget — the only safe hand-paste
multiline STRING node, paste the full contents of `plan.json` into it, wire it into surface.** Both Plan nodes declare it `"dynamicPrompts": False` in the pack source
`plan_json_input`, and queue ONCE. Prefer the single-line variant of the plan file (`chain_nodes.py`), on purpose: ComfyUI's frontend resolves `{option|option}`
(`json.dumps(..., separators=(',', ':'), ensure_ascii=True)` — one line, pure ASCII) dynamic-prompt groups in any widget declared `dynamicPrompts: true` at queue time,
so no newline handling, leftover default demo plan, or editor re-serialization can and a plan JSON is dense with braces (the 3-shot example plan carries 5, the
touch the paste. The internal `plan_json` Raw JSON widget is the fragile path: it 12-shot plan 14). One pass of the frontend serializer strips them, and the node
ships with a two-shot demo plan as its default, the visual scene editor serializes then reports for a byte-perfect copy:
its own edits over it, and a connected `plan_json_input` OVERRIDES it at queue time
(an internal paste into an overridden widget is silently ignored). If that widget is
used anyway: disconnect `plan_json_input` first, select all, delete, confirm the
widget is empty, paste once.
Either way the effective plan string must contain EXACTLY the one JSON object: first H3 Chain Plan JSON is invalid: Extra data: line 1 column 16 (char 15)
character `{`, last character `}`, nothing before or after. If ComfyUI still reports
`H3 Chain Plan JSON is invalid: Extra data: line N column M`, the effective string The parsed head is exactly the plan's quoted first key — `"prompt_prefix"` is 15
holds more than the single JSON object — leftover demo or earlier plan text ahead of characters, so column = length of the quoted first key + 1. That fingerprint means
the paste, or a duplicated fragment of it. The `line N column M` points at the first a dynamic-prompt surface ate the braces; it reproduces on perfect pastes, pipes or
byte of the leftover; ask the user for that exact error text when diagnosing. no pipes, and is NOT a copy mistake. The pack's own prompt-typed widgets (e.g.
`MiniMaxH3TaggedReferenceToVideo`'s `prompt`, `dynamicPrompts: True`) and any
third-party string or prompt node with dynamic prompts enabled are all such
surfaces. Never paste a plan into one, and never wire one into `plan_json_input`.
Internal-widget procedure: disconnect `plan_json_input` first (a non-empty
connected socket silently overrides the widget at queue time), select all, delete,
confirm the widget is empty, paste the full plan, and queue ONCE — before the
visual editor re-serializes anything over it. Prefer the single-line variant of the
plan file (`json.dumps(..., separators=(',', ':'), ensure_ascii=True)` — one line,
pure ASCII) so no newline handling can touch the paste. The widget ships with a
two-shot demo plan as its default: the pasted plan must still contain EXACTLY the
one JSON object, first character `{`, last character `}`, nothing before or after.
The `plan_json_input` socket is for programmatic delivery — an LLM story director
or other node producing the plan at execution time; socket values flow node-to-node
and skip frontend widget serialization. A hand paste may use the socket only when
the source is a string primitive that provably leaves braces alone. Verify any
surface with one 100-byte probe pasted where the plan would go, then queue:
{"shots":[{"id":"probe","prompt":["static test card, one red cube on white"]}]}
A rendered one-shot test card means the surface is clean; `Extra data: line 1
column 8 (char 7)` (`"shots"` is 7 characters) means it eats braces — deliver
through the internal widget instead.
A leftover demo or earlier plan AHEAD of the paste also reports `Extra data`, but
only after the whole leftover object parses — its `char N` is far larger than the
plan's first key length. Read the reported `char N` against the first key to tell
brace-eating and leftover-text apart; ask the user for the exact error text.
The node renders each shot as its own clip and chains the clips through The node renders each shot as its own clip and chains the clips through
the H3 context loop — scene 2 continues from scene 1's final frames, scene 3 from scene the H3 context loop — scene 2 continues from scene 1's final frames, scene 3 from scene