16 Commits

Author SHA1 Message Date
David Mann dc3211b354 fix(automation): review findings on the agents channel (from #4428's review)
- Plain `mcp` routed to a headless session runs a blocking render as a long job again
  (progress, other requests, cancellation): the long-job path uses the routed session.
- A tool's calls all go to one route, so a window closing mid-tool can't split them.
- The window's `agent_folders` answer is narrowed to the command's folders.
- A write-only session names its write folder as its read folder too.
- `file.revert` checks the open project's file against the read folders; `file.save` with
  a non-string `path` checks the open project's file against the write folders.
- Reverting (and the reload after the file changed) keeps an agent's footage limits.
- An agent request queued before the switch turned off, or the folders changed, doesn't run;
  a request with other limits waits until queued input from another scope was applied.
- Docs: several write roots need --headless. Tests: fixture cleanup, broken-pipe write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 19:38:55 +01:00
David Mann da18193a41 fix(automation): a session without a window reaches only its roots, as in every Craft app
Headless `mcp` (switch off, --headless, --autosave, project options) no longer runs
unconfined without automation roots: a direction without a root or agent folder grants
nothing, as PhotoCraft's `mcp` does and AGENTS.md rule 18 asks. `--autosave` sessions may
still read their own checkpoints to recover. The deprecated `--bridge` is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 17:06:53 +01:00
David Mann bb9cc35e18 fix(automation): review findings on agents in the open window
- The command's --automation-read-root/--automation-write-root also bind
  calls that reach the window (checked in the CLI, on top of the window's
  agent folders).
- An agent request keeps the agents channel's reply deadline: one still
  waiting in the backlog after it is not run.
- The person's --control requests run without a pending agent's gate.
- An agent's `null` params read as `{}`, other non-objects are refused, so
  a screenshot or frame can't skip the inline branch.
- The handshake reply is read up to 64 KiB.
- --when-closed launch/error without a settings folder is an error, not a
  silent headless session.
- Docs: the closed-app choice, not "headless", when EffectCraft is closed;
  the window's footage exception (#4387); the command's folders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 01:46:57 +01:00
David Mann 308381360b feat(automation): agents in the open window through the ArtCraft Launcher's switch
While the launcher's Settings > AI agents switch names EffectCraft (behind
the suite's AI-MCP flag), the window serves agents through the shared
craft_automation::agents::AgentLink (token, connection file, switch
watching) and plain `effectcraft-cli mcp` finds it on every tool call
through the shared craft_control::agents::Live: the open window while
agents may use it, otherwise a session without a window, and the
closed-app choice (launch, headless, error) when EffectCraft is closed.

- The CLI signs in with the challenge handshake; the token never crosses
  the wire and a listener that can't prove it holds it gets nothing.
- Agent requests in the window stay inside the agent folders: a command
  gate on the session (Session::command_gate) runs the same Confinement
  checks as --automation-read-root/--automation-write-root, also for the
  input an agent queues until a UI pass applied it. Screenshots and
  frames without a file come back inline.
- New `agent_folders` tool; Settings > AI Agents is the shared Agents
  page (agents.settings saves agents.json for the CLI).
- `mcp --headless`, `--when-closed`; `mcp --bridge` stays one release as a
  deprecated alias. No client configuration is written.

Closes #4383.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 01:22:27 +01:00
Andrea Zorzi a70eb03fa6 #3593: render_frame and render_preview tile times into one contact sheet (#3594)
* #3593: render_frame and render_preview tile `times` into one contact sheet

* contributors: credit andreaaazo by their GitHub profile name

* #3593: contact-sheet cells default to 320 px, sheets stay under 8000 px

With `times`, `max_side` now defaults to 320 per cell instead of 960, so
64 frames of a 16:9 comp make a 2560 x 1440 sheet instead of 7680 x 4320.
`sheet::MAX_SIDE` drops from 8192 to 7680. `labels` that isn't true or
false is a bad-arguments error, and a bridged cell keeps the time asked
for when the app's reply leaves `time` out.
2026-11-13 19:40:11 +05:30
adikshan11 45b737455a automation: a confined project can't show footage from outside the roots (#2131 F-11, "Indirect reads")
The command checks look at the paths an agent gives, but a project it opens or
imports from a read root names its own footage, which was read wherever it is
when the project rendered: render_frame returned its pixels.

Backend::confine now wraps a headless session's footage and services:
ConfinedFootage reads frames, audio, aux channels, models and vector frames
only for footage inside the read roots (problem() says why the rest shows
nothing), and ConfinedServices checks read_file, exists, stamp, list_dir and
is_dir the same way. Writes are left to the command checks.

Test: automation_roots_confine_the_footage_a_project_names covers an absolute
path, `../`, a linked file and a linked folder, each opened and imported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:16:36 +05:30
Kristian Myram b7d97c20e9 #1743: check final storage overflow destinations for queued outputs 2026-10-30 09:55:49 +01:00
Kristian Myram c5671f6569 #1830: require exporter support before skipping duplicate frames 2026-10-30 08:59:53 +01:00
Kristian Myram 615c4cdffb Render Queue: two outputs of one job never write the same file, and default names avoid the queue's other outputs
Two queue items that resolve to one output (the same comp added twice, a duplicated item) replaced
each other's file inside one job. Nothing is on disk when the job starts, so no check said anything.

- A default output name (renderQueue.add, render.preRender, comp.saveFrameAs {queue},
  file.createProxy) that another item of the queue writes, in any output module or segment, is
  numbered like a footage collision: Main.mp4, Main_1.mp4, Main_2.mp4. Sequences are compared by
  the frames they write, so two stills of one comp at different times keep their names. Names a
  caller gave and names already stored in items are never changed.
- Outputs of one job that still name the same file (explicit names, renderQueue.duplicate, output
  modules, segments) refuse the whole render before anything is written, naming both items.
  Sequences clash only on frames both write; a later item with Skip Existing Files leaves the
  earlier item's frames alone; items refused for footage take no part.

Refusing the whole render, not just the later item: which of two items should keep the file is the
user's to say, and failing only the later one would leave a half-rendered queue found after they
left. renderQueue.duplicate stays a verbatim copy so the clash is reported, not hidden.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RDvxCS8xcR28VArjzn1x7U
2026-10-30 08:04:32 +01:00
bflatastic b6d4090e4e Merge main into #2520; fold the PR's DefaultOutput into main's Lookup::QueueDefault (#2636) for renderQueue.add, render.preRender and file.createProxy, keep #2521's RUNS_SCRIPTS refusal with Vec<Lookup>, keep both tests, blender test expects no lookups, docs/mcp.md names all three
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 10:24:43 +07:00
bflatastic ad6bc0c19b Automation: a confined renderQueue.add without output needs a saved project (#2479)
On a project that was never saved, renderQueue.add without output queued
an item whose default output was the home folder, outside every
automation root (rendering it was refused, but the queue held a path the
agent may not write). While file access is confined, such an add is now
refused with a hint to give output inside a write root; a saved
project's default output (beside it) is checked when the queue renders,
as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 09:19:17 +07:00
Shuvra Basak 4cc490c8c6 MCP: list_commands and list_effects take compact: true (#2020)
Unfiltered, list_commands returns ~134 KB and list_effects ~480 KB, more
than MCP clients accept in one tool result. With `compact: true`,
list_commands (and its command_list alias) returns only each command's
id and label, and list_effects only each effect's id, name and category
(~40 KB and ~23 KB). Default output is unchanged; filter and
enabled_only still apply.
2026-10-24 21:27:40 +00:00
Claude 8fb4281632 MCP: --automation-read-root / --automation-write-root confine the agent's file access (#500)
`effectcraft-cli mcp` had no way to keep an agent's file access to a folder;
the flags were unknown options. Both now take a folder (repeatable, as in
PhotoCraft): with either given, files are read only under a read or write root
and written only under a write root (none: no writes). Defaults are unchanged.

automation::confine::Confinement checks every engine command the backend runs
(execute_command, command_run, open/save_project, each engine.batch step), in
both headless and bridge mode, before it runs: the file parameters of the
commands that read or write files must be absolute paths inside the roots
(symbolic links resolved through the longest existing ancestor, `..` refused),
as must any other absolute path in a command's parameters. Commands that write
where they aren't told are checked against the target they would write: Save /
Increment and Save the open project's file, renderQueue.render every queued
output (renderQueue.list). Scripts, Execute File, Reveal in Finder, Open Recent
by index, `$N` file-path references in a batch, render_frame/screenshot paths
outside a write root and the bridge's UI-driving tools are refused while
confined. docs/mcp.md describes it.

Test: a confined headless server opens and saves inside its roots and is refused
outside them, for a relative path, `..`, a batch step, a `$N` path, Save to a
read-only root's project, the Render Queue's default output there, a symbolic
link out of the write root, and scripts; the unconfined server still writes
anywhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiAJeFttZp83Fh7YuzAR5f
2026-10-10 22:54:57 +00:00
storybored379 8ed8a7e220 MCP: return on write errors while stdin is open; document requests during a render
Follow-ups from the #365 review:
- serve() no longer hangs when a reply cannot be written: the stdin reader thread is
  detached instead of scoped, so a failed write returns at once rather than waiting for a
  read that only ends at EOF. serve() now takes a 'static reader (serve_stdio is unchanged).
- A test pins down requests during a render: a second render is refused however it is
  started (blocking, wait: false, inside a batch), and edits apply to the project while the
  job keeps rendering its snapshot.
- docs/mcp.md: isError is true for any JSON result with failed > 0; what requests mean
  mid-render; wait: false renders are polled with renderQueue.list.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 10:26:57 -07:00
storybored379 7b632bdbc1 MCP: report render progress and handle cancellation
Keep serving during long renders, recover failed workers, and remove only files opened by the interrupted export. Cover progress, cancellation, EOF and output ownership with regression tests.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 00:20:22 -07:00
storybored379 164538fecb MCP: add core tools, annotations and resources
Add strict tool keys, resource reads and panic recovery with regression coverage. Keep existing documented tools listed.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
2026-10-09 00:09:37 -07:00