Files
dify/api/core/dify_builder/contract_schema.json
T
Charles YaoandClaude Opus 4.8 7e83264330 refactor: rename Workflow Copilot → Dify Builder
Project rename across api/ + web/: modules, symbols, routes
(/console/api/dify-builder/*), feature flag (DIFY_BUILDER_ENABLED),
Celery queue/tasks, the 7 DB tables (via migration df1b0114de40),
and regenerated contract artifacts. Behavior unchanged; 430 tests green,
ruff clean. Branch renamed feat/copilot-py-backend → dify-builder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-23 11:18:35 -07:00

1445 lines
29 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"Phase": {
"type": "string",
"enum": [
"understand",
"clarify",
"resources",
"plan",
"modify",
"test",
"review",
"publish",
"complete"
]
},
"RunStatus": {
"type": "string",
"enum": [
"thinking",
"executing",
"waiting_input",
"waiting_confirmation",
"paused",
"failed",
"complete"
]
},
"ActionKind": {
"type": "string",
"enum": [
"primary",
"secondary",
"destructive",
"automatic"
]
},
"CardKind": {
"type": "string",
"enum": [
"user",
"decision",
"notice",
"run_context",
"preflight_context",
"assistant_turn",
"plan",
"form",
"challenge",
"resource_select",
"checkpoint",
"change_set",
"test_result",
"error",
"summary",
"publish",
"build_learning"
]
},
"CanvasEvent": {
"type": "string",
"enum": [
"reset_build_canvas",
"add_start_node",
"add_knowledge_node",
"add_llm_node",
"add_output_node",
"focus_workflow",
"highlight_edit_target",
"apply_edit_plan",
"start_test_run",
"mark_test_error",
"focus_error_node",
"focus_checklist_node",
"create_checkpoint",
"apply_error_fix",
"mark_repair_applied",
"apply_preflight_fix",
"start_retest",
"mark_test_success",
"mark_review_ready",
"revert_checkpoint",
"cancel_publish",
"publish_workflow"
]
},
"ConflictPolicy": {
"type": "string",
"enum": [
"audited",
"ask"
]
},
"SkillLearningPolicy": {
"type": "string",
"enum": [
"ask",
"automatic",
"disabled"
]
},
"RecoveryClass": {
"type": "string",
"enum": [
"unchanged",
"config_only",
"structural_compatible",
"structural_invalidating"
]
},
"EntryMode": {
"type": "string",
"enum": [
"fix",
"fix_checklist",
"build",
"edit"
]
},
"Action": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"label": {
"type": "string"
},
"kind": {
"$ref": "#/$defs/ActionKind"
},
"next_state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"canvas_event": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"label",
"kind"
],
"additionalProperties": false
},
"CheckpointRef": {
"type": "object",
"properties": {
"checkpoint_id": {
"type": "string"
},
"label": {
"type": "string"
},
"created_at": {
"type": "string"
}
},
"required": [
"checkpoint_id",
"label",
"created_at"
],
"additionalProperties": false
},
"RecoveryRef": {
"type": "object",
"properties": {
"recovery_class": {
"type": "string"
},
"can_continue": {
"type": "boolean"
},
"can_restart": {
"type": "boolean"
},
"message": {
"type": "string"
}
},
"required": [
"recovery_class",
"can_continue",
"can_restart",
"message"
],
"additionalProperties": false
},
"FormField": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"label": {
"type": "string"
},
"type": {
"type": "string"
},
"options": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"key",
"label",
"type"
],
"additionalProperties": false
},
"ResourceOption": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"label": {
"type": "string"
},
"meta": {
"type": "string"
},
"kind": {
"type": "string"
},
"readiness": {
"type": "string"
}
},
"required": [
"id",
"label",
"meta",
"kind",
"readiness"
],
"additionalProperties": false
},
"ConflictPolicyOption": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"label": {
"type": "string"
},
"recommended": {
"type": "boolean"
}
},
"required": [
"id",
"label"
],
"additionalProperties": false
},
"PreflightIssue": {
"type": "object",
"properties": {
"node_id": {
"type": "string"
},
"label": {
"type": "string"
},
"kind": {
"type": "string"
}
},
"required": [
"node_id",
"label",
"kind"
],
"additionalProperties": false
},
"TraceStep": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"label": {
"type": "string"
},
"state": {
"type": "string"
},
"tone": {
"type": "string"
},
"canvas_event": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"label",
"state"
],
"additionalProperties": false
},
"Trace": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"steps": {
"type": "array",
"items": {
"$ref": "#/$defs/TraceStep"
}
}
},
"required": [
"status"
],
"additionalProperties": false
},
"TestStat": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"label": {
"type": "string"
}
},
"required": [
"value",
"label"
],
"additionalProperties": false
},
"SummaryRow": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"label",
"value"
],
"additionalProperties": false
},
"UserItem": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"required": [
"text"
],
"additionalProperties": false
},
"DecisionItem": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"required": [
"text"
],
"additionalProperties": false
},
"NoticeItem": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"tone": {
"type": "string"
}
},
"required": [
"text"
],
"additionalProperties": false
},
"RunContextCard": {
"type": "object",
"properties": {
"run_id": {
"type": "string"
},
"title": {
"type": "string"
},
"error_code": {
"type": "string"
},
"message": {
"type": "string"
},
"trace_ref": {
"type": "string"
}
},
"required": [
"run_id",
"title",
"error_code",
"message"
],
"additionalProperties": false
},
"PreflightContextCard": {
"type": "object",
"properties": {
"node_count": {
"type": "integer"
},
"issue_count": {
"type": "integer"
},
"issues": {
"type": "array",
"items": {
"$ref": "#/$defs/PreflightIssue"
}
}
},
"required": [
"node_count",
"issue_count"
],
"additionalProperties": false
},
"AssistantTurnItem": {
"type": "object",
"properties": {
"turn_id": {
"type": "string"
},
"stage_id": {
"type": "string"
},
"trace": {
"$ref": "#/$defs/Trace"
},
"reply_text": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"cards": {
"type": "array",
"items": {
"type": "string"
}
},
"card_state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"turn_id",
"stage_id",
"trace"
],
"additionalProperties": false
},
"PlanCard": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"version_tag": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"type": "string"
}
},
"subtitle": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"title",
"version_tag"
],
"additionalProperties": false
},
"FormCard": {
"type": "object",
"properties": {
"variant": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"$ref": "#/$defs/FormField"
}
},
"values": {
"type": "object"
},
"frozen": {
"type": "boolean"
}
},
"required": [
"variant"
],
"additionalProperties": false
},
"ChallengeCard": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"body": {
"type": "string"
},
"tone": {
"type": "string"
}
},
"required": [
"title",
"body"
],
"additionalProperties": false
},
"ResourceSelectCard": {
"type": "object",
"properties": {
"recommended": {
"type": "array",
"items": {
"$ref": "#/$defs/ResourceOption"
}
},
"conflict_policy_options": {
"type": "array",
"items": {
"$ref": "#/$defs/ConflictPolicyOption"
}
}
},
"required": [],
"additionalProperties": false
},
"CheckpointCard": {
"type": "object",
"properties": {
"checkpoint_id": {
"type": "string"
},
"label": {
"type": "string"
},
"created_at": {
"type": "string"
}
},
"required": [
"checkpoint_id",
"label",
"created_at"
],
"additionalProperties": false
},
"ChangeSetCard": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"changes": {
"type": "array",
"items": {
"type": "string"
}
},
"scope": {
"type": "string"
},
"full_diff_open": {
"type": "boolean"
}
},
"required": [
"count",
"changes",
"scope"
],
"additionalProperties": false
},
"TestResultCard": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"subtitle": {
"type": "string"
},
"tone": {
"type": "string"
},
"stats": {
"type": "array",
"items": {
"$ref": "#/$defs/TestStat"
}
},
"run_ids": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"title",
"subtitle",
"tone"
],
"additionalProperties": false
},
"ErrorCard": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"body": {
"type": "string"
},
"tone": {
"type": "string"
},
"node_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"title",
"body"
],
"additionalProperties": false
},
"SummaryCard": {
"type": "object",
"properties": {
"variant": {
"type": "string"
},
"title": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"items": {
"type": "array",
"items": {
"type": "string"
}
},
"rows": {
"type": "array",
"items": {
"$ref": "#/$defs/SummaryRow"
}
}
},
"required": [
"variant"
],
"additionalProperties": false
},
"PublishCard": {
"type": "object",
"properties": {
"version": {
"type": "string"
},
"badge": {
"type": "string"
}
},
"required": [
"version"
],
"additionalProperties": false
},
"BuildLearningCard": {
"type": "object",
"properties": {
"policy": {
"type": "string"
},
"state": {
"type": "string"
}
},
"required": [
"policy",
"state"
],
"additionalProperties": false
},
"GoalPayload": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"required": [
"text"
],
"additionalProperties": false
},
"EditGoalPayload": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"required": [
"text"
],
"additionalProperties": false
},
"RequirementsPayload": {
"type": "object",
"properties": {
"report_types": {
"type": "string"
},
"audience": {
"type": "string"
},
"currency": {
"type": "string"
},
"metrics": {
"type": "string"
},
"output": {
"type": "string"
},
"prefer_audited": {
"type": "boolean"
}
},
"required": [
"report_types",
"audience",
"currency",
"metrics",
"output"
],
"additionalProperties": false
},
"EditRulesPayload": {
"type": "object",
"properties": {
"risk_threshold": {
"type": "string"
},
"review_team": {
"type": "string"
},
"timeout_behavior": {
"type": "string"
},
"preserve_summary": {
"type": "boolean"
}
},
"required": [
"risk_threshold",
"review_team",
"timeout_behavior"
],
"additionalProperties": false
},
"ResourcesPayload": {
"type": "object",
"properties": {
"conflict_policy": {
"type": "string"
},
"resource_ids": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"conflict_policy"
],
"additionalProperties": false
},
"RunContextPayload": {
"type": "object",
"properties": {
"run_id": {
"type": "string"
},
"node_name": {
"type": "string"
},
"error_code": {
"type": "string"
}
},
"required": [
"run_id",
"node_name",
"error_code"
],
"additionalProperties": false
},
"CheckpointPayload": {
"type": "object",
"properties": {
"checkpoint_id": {
"type": "string"
}
},
"required": [
"checkpoint_id"
],
"additionalProperties": false
},
"TestPayload": {
"type": "object",
"properties": {
"run_ids": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [],
"additionalProperties": false
},
"PublishPayload": {
"type": "object",
"properties": {
"version": {
"type": "string"
}
},
"required": [
"version"
],
"additionalProperties": false
},
"TestdataPayload": {
"type": "object",
"properties": {
"mode": {
"type": "string"
},
"inputs": {
"anyOf": [
{
"type": "object"
},
{
"type": "null"
}
]
}
},
"required": [
"mode"
],
"additionalProperties": false
},
"ConversationItem": {
"oneOf": [
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "user"
},
"payload": {
"$ref": "#/$defs/UserItem"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "decision"
},
"payload": {
"$ref": "#/$defs/DecisionItem"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "notice"
},
"payload": {
"$ref": "#/$defs/NoticeItem"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "run_context"
},
"payload": {
"$ref": "#/$defs/RunContextCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "preflight_context"
},
"payload": {
"$ref": "#/$defs/PreflightContextCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "assistant_turn"
},
"payload": {
"$ref": "#/$defs/AssistantTurnItem"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "plan"
},
"payload": {
"$ref": "#/$defs/PlanCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "form"
},
"payload": {
"$ref": "#/$defs/FormCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "challenge"
},
"payload": {
"$ref": "#/$defs/ChallengeCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "resource_select"
},
"payload": {
"$ref": "#/$defs/ResourceSelectCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "checkpoint"
},
"payload": {
"$ref": "#/$defs/CheckpointCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "change_set"
},
"payload": {
"$ref": "#/$defs/ChangeSetCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "test_result"
},
"payload": {
"$ref": "#/$defs/TestResultCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "error"
},
"payload": {
"$ref": "#/$defs/ErrorCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "summary"
},
"payload": {
"$ref": "#/$defs/SummaryCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "publish"
},
"payload": {
"$ref": "#/$defs/PublishCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"seq": {
"type": "integer"
},
"at_version": {
"type": "integer"
},
"kind": {
"const": "build_learning"
},
"payload": {
"$ref": "#/$defs/BuildLearningCard"
}
},
"required": [
"seq",
"at_version",
"kind",
"payload"
],
"additionalProperties": false
}
]
},
"SessionView": {
"type": "object",
"properties": {
"session_id": {
"type": "string"
},
"app_id": {
"type": "string"
},
"version": {
"type": "integer"
},
"state": {
"type": "string"
},
"canvas_read_only": {
"type": "boolean"
},
"run_status": {
"$ref": "#/$defs/RunStatus"
},
"interrupted": {
"type": "boolean"
},
"conversation": {
"type": "array",
"items": {
"$ref": "#/$defs/ConversationItem"
}
},
"entry_mode": {
"$ref": "#/$defs/EntryMode"
},
"phase": {
"$ref": "#/$defs/Phase"
},
"actions": {
"type": "array",
"items": {
"$ref": "#/$defs/Action"
}
},
"checkpoint": {
"anyOf": [
{
"$ref": "#/$defs/CheckpointRef"
},
{
"type": "null"
}
]
},
"recovery": {
"anyOf": [
{
"$ref": "#/$defs/RecoveryRef"
},
{
"type": "null"
}
]
}
},
"required": [
"session_id",
"app_id",
"version",
"state",
"canvas_read_only",
"run_status",
"interrupted",
"conversation"
],
"additionalProperties": false
}
}
}