Repository navigation
[feat] canvas: group toolbar, group colors, and no more node locking - #415
Merged
Merged
Conversation
- Selecting a group shows its own toolbar above it: run workflow, ungroup, layout (grid / row / column, resizing the group to fit), background color, and download (all group assets as one ZIP). - Run workflow generates the group's configured nodes in reference order: a node waits for the members it references, independent nodes run concurrently, and a failure skips its downstream nodes. - Groups store an optional #rrggbb color (canvas item `color`; '' in canvas.update restores the default). Node equality includes the color so a color-only edit is saved. - The context menu no longer offers lock/unlock or layer reordering. Nodes locked in older projects are unlocked on open, parents first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CanvasPresentationUpdate.color dumped as null when unset, which changed the
fingerprint of every canvas.update recorded before the field existed. History
validation then rejected those commits and blocked the whole project
("工程提交记录缺失或损坏"). An unset color is now omitted from the dump.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clearing every lock whenever one appeared also cleared locks applied later through the API or Agent, which the editor-save and text-card browser journeys rely on. Locked nodes are now unlocked once, when the project opens, as described in the PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Workflow - A downstream step waits until the canvas shows its upstream result, so a step that uses generated text as its prompt no longer fails its precheck. - Dependencies carried through non-step nodes (subject, stack) order steps. - Submissions run one at a time through the latest render's entry point, so concurrent steps no longer overwrite each other's local configuration or use stale running state. - A project switch ends a running workflow instead of leaving it pending. - Reference-less prompt content and edit-provenance edges no longer make a node a step that will only fail. Locks - The context menu offers Unlock only when the selection is locked (by the Agent, the API, or an undo of the open-time unlock), so locks stay recoverable without exposing locking. - The open-time unlock also covers projects that open empty. - Group layout refuses to move locked members instead of failing autosave. - Actions disabled for other reasons no longer say "unlock first". Other: the color menu uses menuitemradio/aria-checked, and ZIP entry names are de-duplicated case-insensitively. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A downstream step continues only when the service adopted the upstream result and the canvas shows it; an unadopted (candidate-only or edited during the run) result or a three-minute stall fails the step instead of running downstream on stale content after a fixed wait. - Job and display waits also stop when the workspace unmounts. - Color menu items (menuitemradio) are reachable by keyboard again. - Legacy locks are released once per project in this browser instead of on every open, so later Agent or API locks survive reloads. - Run workflow and Ungroup are disabled on a locked group instead of doing nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
选中分组后,分组上方显示一条专属工具栏:运行工作流、解除编组、布局、背景色、下载。右键菜单去掉了锁定和图层顺序这两类用户难以理解的功能。
动机。 以前选中分组只能看到重命名、复制、删除,右键菜单里却有锁定/解锁、移到顶层/上移一层/下移一层/移到底层,用户不清楚这些功能的用途。锁定后分组和子节点基本都操作不了,右键菜单也弹不出来。另外,右键里的"自动排列"只移动顶层节点,对分组成员不起作用。
改动。
NodeSelectionToolbar.tsx):节点类型为分组时显示以下按钮,原来的重命名、复制、删除仍保留在右键菜单里。groupWorkflow.ts:节点要等它引用的组内成员生成成功后才开始,没有依赖关系的节点同时运行;某个节点失败,其下游节点跳过;循环引用的节点也跳过。结束时提示成功、失败、跳过的数量。为此prepareGeneration改为返回已接受的 jobId,再通过creationClient.listen等待这些任务进入终态。ungroupSelection。layoutGroup按当前阅读顺序排列分组的直接成员,并把分组缩放到刚好容纳它们。createZip),只有一个文件时直接下载。CanvasItemBase新增可选字段color(#RRGGBB),canvas.update也接受该字段,传空字符串表示恢复默认;契约文件已重新生成。CanvasNode.color经creationProjection同步到后端;storage增加校验;sameNode比较时纳入颜色,否则只改颜色的修改会被当成无变化而不保存。--cw-group-fill和--cw-group-border给分组着色。CanvasPresentationUpdate.color未设置时不参与序列化。否则"color": null会改变所有历史canvas.update命令的指纹,读取历史时整个项目会被判定为"工程提交记录缺失或损坏"而无法读写。本地部署时实际遇到过这个问题,第二个提交修复并加了回归测试。locked字段和相关规则保持不变,本 PR 只移除界面入口并迁移已有数据。Review 后的修复(第 4 个提交)
独立 review 后修复了以下问题:
promptContent或只有编辑来源连线的节点当作可运行节点。menuitemradio,并用aria-checked标出当前颜色。验证:
尚未处理(后续可另开 PR):
第二轮 review 后的修复(第 5 个提交)
menuitemradio)可以用键盘操作了(SelectionToolbarMenu的焦点和方向键之前只认menuitem)。验证:前端 941 个单测、
tsc、isolated 浏览器套件 25/25 均通过。Linked issue
Labels
type:feat、area:canvas)Test plan
本地 worktree 基于
main(bf473614),Python 3.12、Node.js 24。node --test tests/*.test.tslayoutGroup的横向/纵向/网格排列和分组尺寸;groupDescendants;工作流调度(无依赖节点并发、依赖顺序、失败后跳过下游、循环引用、步骤抛错);颜色变化算作内容变化,非法颜色被parseDocument拒绝python -m pytest tests -k "creation or canvas or contract" -qtests/test_creation_canvas_service.py::test_group_color_is_set_reset_and_validated、test_canvas_update_without_color_keeps_its_historical_fingerprintcanvas.update序列化结果与加字段前完全一致(去掉修复时该测试失败)。另用修复后的代码校验了本地一个有 500 条提交记录的真实项目,全部通过tsc --noEmit、vite buildpython -m pre_commit run --from-ref upstream/main --to-ref HEADrelease-checks.yml启动creation_server.py和 vite 后运行node scripts/run-browser-suite.mjstimeline workflow因本机 PATH 没有python而单独补跑,通过)。首次 CI 失败的editor save和canvas text Markdown依赖打开后再加的锁,第三个提交改为只在打开项目时解锁一次后均通过Evidence that it works
在本机部署的实例上,用无头 Chromium 对一个临时项目做了验证(验证后已删除该项目):
新建两个文本节点,
⌘G编组,选中分组后,上方出现「运行工作流 / 解除编组 / 布局 / 背景色 / 下载」工具栏。选择「布局 → 横向排列」后,两个成员并排,分组宽度随之变为 688px。
选择「背景色 → 蓝色」后分组着色;刷新页面后颜色仍在,后端快照中
color == "#3e63dd"。右键分组,菜单里已没有锁定和图层顺序项。
通过 API 把分组及两个子节点设为锁定后重新打开项目,三者都被自动解锁并写回(
locked == false),右键菜单正常弹出。整个过程中页面没有
pageerror。Media attached(截图稍后补充)
Provider verification
Bilingual UI
zh-CN和en-US文案同时提供。🤖 Generated with Claude Code