工作流绘制链路加固:校验增强、悬垂引用清理与保存连续性修复

- validateFlowConstraints 增加自环/model 必选模型/孤立节点校验,onConnect 拦截自环连线
- 删除节点后主动清理其余节点指向被删节点的 valueSource,避免保存脏 DSL
- 保存成功后保留工作流 id 支持连续保存,新建回填 id,避免重复副本
- attachFormFieldValueSources 不再覆盖已有上游引用,保持引用/表单展示互斥
- form 自定义字段引入不可变 field,重命名 label 不影响下游引用

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-08-20 01:04:58 +08:00
co-authored by Claude
parent c1658380a7
commit 3cddff6df2
3 changed files with 123 additions and 8 deletions
@@ -373,7 +373,14 @@ export function attachFormFieldValueSources(params: any, fields: ExposedField[]
if (!f || typeof f.path !== 'string') continue;
const cur = resolvePath(params, f.path);
if (cur && typeof cur === 'object' && !Array.isArray(cur)) {
cur.valueSource = [{ nodeId: startNodeId, field: f.path }];
// 已有指向上游节点的真实引用时保持互斥:不覆盖为开始节点标记,避免引用丢失
const vs = cur.valueSource;
const hasRealRef = Array.isArray(vs)
? vs.some((r: any) => r && r.nodeId && r.nodeId !== startNodeId)
: !!vs && typeof vs === 'object' && vs.nodeId && vs.nodeId !== startNodeId;
if (!hasRealRef) {
cur.valueSource = [{ nodeId: startNodeId, field: f.path }];
}
}
}
}