feat(server): add layer-separation generator task

Introduce the `layer-separation` generator (edit-elements node action)
that splits a source image into a clean background layer, foreground
image artifacts with bounding boxes, and editable text render data.

- New layer_separation.go builds the separated result and artifacts
- SubmitGeneratorTask routes layer-separation and move-object via a
  switch; standalone task completion + polling support
- Extend artifact metadata with BBox and GeneratorName across the
  domain, API types, mapper, .api schema, and API.md
- edit-elements gets a transparent manual-frame placeholder holding the
  separated foreground images and text layers beside the original

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-09 12:26:43 +08:00
parent 676e1c4c67
commit 039d166972
9 changed files with 1523 additions and 36 deletions
+19
View File
@@ -238,6 +238,25 @@ Returns the updated project, the assistant message, and generated nodes.
The generation path uses the configured design agent runner. The default is the `sky-valley/pi` Go agent adapter, with local desktop/MCP agent behavior disabled.
## Generator Tasks
`POST /api/generator/tasks`
```json
{
"cid": "client-request-id",
"project_id": "project-id",
"generator_name": "layer-separation",
"input_args": {
"image_url": "https://cdn.example.com/source.png"
}
}
```
`layer-separation` returns a task id that can be polled with `GET /api/generator/tasks?task_id=<id>&project_id=<project-id>`. Completed tasks return a clean background image, foreground image artifacts with `bbox`, and a `text_render_data` artifact for editable text reconstruction.
The canvas `edit-elements` node action uses the same separation path but writes the separated result beside the original image. The original image remains unchanged; the clean background is a bottom image layer, and a transparent frame above it holds the separated foreground images and editable text layers.
## Chat History Replay
`GET /api/projects/:id/history`