fix(workflow): harden publishing and editor testing
Require high-risk actions to reference human confirmation outputs, filter deleted workflows from dashboard lists, and keep template metadata synchronized. Add safe browser-side debug execution for business nodes without triggering real side effects.
This commit is contained in:
@@ -7,6 +7,13 @@ import type { AIWorkflowDefinition, AIWorkflowNodeSpec } from "@/lib/api/admin"
|
||||
const MESSAGE_SOURCE = "agent-desk"
|
||||
const EMPTY_NODE_SPECS: AIWorkflowNodeSpec[] = []
|
||||
|
||||
function definitionsEqual(
|
||||
left: AIWorkflowDefinition,
|
||||
right: AIWorkflowDefinition
|
||||
) {
|
||||
return JSON.stringify(left) === JSON.stringify(right)
|
||||
}
|
||||
|
||||
type EditorMessage =
|
||||
| {
|
||||
source: typeof MESSAGE_SOURCE
|
||||
@@ -64,6 +71,10 @@ export function OfficialWorkflowEditor({
|
||||
if (event.data.type === "workflow:ready") {
|
||||
loadDocument()
|
||||
} else if (event.data.type === "workflow:change") {
|
||||
if (definitionsEqual(event.data.document, definitionRef.current)) {
|
||||
return
|
||||
}
|
||||
definitionRef.current = event.data.document
|
||||
onDefinitionChange(event.data.document)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,8 +387,8 @@ export function WorkflowWorkbench({
|
||||
if (!template) return
|
||||
setSelectedTemplate(code)
|
||||
setDefinition(structuredClone(template.definition))
|
||||
if (!name.trim()) setName(template.name)
|
||||
if (!description.trim()) setDescription(template.description)
|
||||
setName(template.name)
|
||||
setDescription(template.description)
|
||||
setDirty(true)
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user