feat: release 1.5.7 - per-clip workflows, runtime budgets, media-path guards

Three reported issues:

#66: the Video stage workflow picker was keyed by scene id, so choosing a
workflow for one clip overwrote every sibling clip. It is now keyed by clip
id, hydrates each clip's persisted choice, autosaves both
clips.workflow_id and form_workflow_id, and Generate One / Generate All
resolve the workflow per clip (a scene can mix image->video and
video->video extend across its clips).

#64: a 30-second ask could produce a 1:51 script - prompts carried no
per-scene scale and the duration rescale could only grow. Prompts now
state the total seconds and a per-scene budget, and the rescale may shrink
(floor 0.5) so over-written boards pull toward the target; content itself
is never edited.

#67: a hand-written directory path (e.g. ComfyUI's input dir) reached
ComfyUI and died as an opaque Errno 21. prepare_media_inputs now rejects
directory / missing local files before queueing with a node-naming error,
and the agent's run_workflow validates media input_values at call time.
Bare Comfy-side names pass untouched.

534 backend tests pass; svelte-check clean.
This commit is contained in:
Benjiyaya
2026-09-24 02:26:47 +08:00
parent 7551ba9d88
commit d2240b9c5a
12 changed files with 453 additions and 43 deletions
@@ -817,6 +817,34 @@ async def t_run_workflow(ctx: ToolContext, args: dict[str, Any]) -> dict[str, An
extra = {str(k): v for k, v in iv.items()}
inputs = parse_dynamic_inputs(wf_json) if wf_json else []
# Issue #67: reject directory / missing-file paths the model hand-writes
# into media-role inputs (e.g. ComfyUI's .../input dir) at CALL time, not
# as a failed job later. Bare/relative names may resolve on the Comfy side
# and pass; only local-looking absolute/qualified paths are checked.
media_node_ids = {
str(inp["nodeId"])
for inp in inputs
if inp.get("kind") in ("image", "image_url", "audio", "video")
}
for nid in media_node_ids:
v = extra.get(nid)
if not isinstance(v, str) or v.startswith(("http://", "https://")):
continue
p = Path(v)
if p.is_absolute() or "/" in v or "\\" in v:
if p.is_dir():
return {
"ok": False,
"error": f"input_values[{nid}] '{v}' is a directory — pass a media FILE path.",
}
if not p.exists():
return {
"ok": False,
"error": (
f"input_values[{nid}] file not found locally: '{v}'. Reference a "
"project asset path or attach the file in chat instead."
),
}
if args.get("width") is not None:
for inp in inputs:
if input_has_role(inp, "width"):