{ "meta": { "project": "graphlemon", "version": "v1.7.0", "effective_date": "2026-07-30", "owner": "bboonnee", "changelog_v1.7.0": "新增 PH5 自举能力:deployment/deploy_health_signal 实体,bug_record.root_cause_category 新增 core_engine,c_deploy_supervisor_* 五个控制操作,c_org_loop_route 的 core_engine 路由分支,p_deploy_supervisor_blue_green 流程,REQ-15。Deploy Supervisor 与架构文档既有的 Supervisor(调度子 Agent)概念不同,见 docs/supervisor-auto-rollback-design.md 命名说明" }, "model_contract": [ { "entity": "project", "owner": "control-plane", "purpose": "目标项目=独立代码空间,架构文档第13节", "fields": [ {"name": "project_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "name", "type": "string", "nullable": false, "constraints": []}, {"name": "target_folder_path", "type": "string", "nullable": false, "constraints": ["unique"], "index": "unique"}, {"name": "has_git_repo", "type": "boolean", "nullable": false, "constraints": []}, {"name": "graphlemon_subdir_initialized", "type": "boolean", "nullable": false, "constraints": []}, {"name": "status", "type": "varchar(20)", "nullable": false, "constraints": ["enum:active|archived"]}, {"name": "created_at", "type": "timestamp", "nullable": false, "constraints": []} ] }, { "entity": "org_graph_definition", "owner": "graph-engine", "purpose": "Org Graph 静态定义,人工维护", "fields": [ {"name": "graph_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "version", "type": "string", "nullable": false, "constraints": ["git_ref"]}, {"name": "nodes", "type": "json", "nullable": false, "constraints": []}, {"name": "edges", "type": "json", "nullable": false, "constraints": []}, {"name": "file_path", "type": "string", "nullable": false, "constraints": []}, {"name": "status", "type": "varchar(20)", "nullable": false, "constraints": ["enum:draft|active|deprecated"]} ] }, { "entity": "task", "owner": "graph-engine", "purpose": "任务队列条目,替代飞书 Base", "fields": [ {"name": "task_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "project_id", "type": "string", "nullable": false, "constraints": ["fk:project.project_id", "idx"], "index": "idx"}, {"name": "goal_text", "type": "text", "nullable": false, "constraints": []}, {"name": "task_type", "type": "varchar(20)", "nullable": false, "constraints": ["enum:goal|bug_fix"]}, {"name": "origin_ref", "type": "string", "nullable": true, "constraints": ["fk:bug_record.bug_id"]}, {"name": "created_via", "type": "varchar(20)", "nullable": false, "constraints": ["enum:api|human_console"], "default": "api"}, {"name": "status", "type": "varchar(30)", "nullable": false, "constraints": ["idx"], "index": "idx"}, {"name": "route", "type": "varchar(20)", "nullable": true, "constraints": ["enum:fast_lane|full_replan"]}, {"name": "loop_round", "type": "int", "nullable": false, "constraints": [">=0"], "default": 0}, {"name": "blocked_reason", "type": "string", "nullable": true, "constraints": []}, {"name": "assigned_org_node", "type": "varchar(20)", "nullable": false, "constraints": ["enum:planner|coder|validator", "idx"], "index": "idx"}, {"name": "created_at", "type": "timestamp", "nullable": false, "constraints": []}, {"name": "updated_at", "type": "timestamp", "nullable": false, "constraints": []} ] }, { "entity": "work_graph_run", "owner": "graph-engine", "purpose": "Org Agent 针对 task 的一次 Work Graph 执行实例", "fields": [ {"name": "run_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "task_id", "type": "string", "nullable": false, "constraints": ["fk:task.task_id"]}, {"name": "org_node", "type": "varchar(20)", "nullable": false, "constraints": ["enum:planner|coder|validator"]}, {"name": "graph_manifest", "type": "json", "nullable": false, "constraints": []}, {"name": "orchestration_script_ref", "type": "string", "nullable": true, "constraints": []}, {"name": "status", "type": "varchar(20)", "nullable": false, "constraints": ["enum:planning|running|merging|verifying|reflecting|blocked|done|failed"]}, {"name": "started_at", "type": "timestamp", "nullable": true, "constraints": []}, {"name": "completed_at", "type": "timestamp", "nullable": true, "constraints": []}, {"name": "result_artifact_refs", "type": "json", "nullable": true, "constraints": []} ] }, { "entity": "work_node_execution", "owner": "graph-engine", "purpose": "Work Graph 内每个节点的执行记录与契约校验", "fields": [ {"name": "node_exec_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "run_id", "type": "string", "nullable": false, "constraints": ["fk:work_graph_run.run_id"]}, {"name": "node_id", "type": "string", "nullable": false, "constraints": []}, {"name": "subagent_type", "type": "string", "nullable": false, "constraints": []}, {"name": "skill_ref", "type": "string", "nullable": false, "constraints": ["fk:skill.skill_id"]}, {"name": "input_schema_ref", "type": "string", "nullable": false, "constraints": []}, {"name": "output_schema_ref", "type": "string", "nullable": false, "constraints": []}, {"name": "input_payload", "type": "json", "nullable": false, "constraints": []}, {"name": "output_payload", "type": "json", "nullable": true, "constraints": []}, {"name": "model_tier", "type": "varchar(20)", "nullable": false, "constraints": ["enum:cheap|standard|premium"], "default": "standard"}, {"name": "status", "type": "varchar(20)", "nullable": false, "constraints": ["enum:pending|running|reflecting|retrying|waiting_for_quota|blocked|done|failed"]}, {"name": "retry_count", "type": "int", "nullable": false, "constraints": [">=0"], "default": 0}, {"name": "reflection_notes", "type": "json", "nullable": true, "constraints": []}, {"name": "git_worktree_ref", "type": "string", "nullable": true, "constraints": []}, {"name": "quota_wait_started_at", "type": "timestamp", "nullable": true, "constraints": []}, {"name": "quota_limit_type", "type": "varchar(10)", "nullable": true, "constraints": ["enum:session|weekly|opus"]} ] }, { "entity": "artifact", "owner": "graph-engine", "purpose": "BRD/PRD/SDD/Benchmark/BugRecord 等结构化产物,版本化不可变", "fields": [ {"name": "artifact_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "artifact_type", "type": "varchar(20)", "nullable": false, "constraints": ["enum:brd|prd|sdd|benchmark|bug_record|code_diff|test_report"]}, {"name": "task_id", "type": "string", "nullable": false, "constraints": ["fk:task.task_id"]}, {"name": "produced_by_run_id", "type": "string", "nullable": false, "constraints": ["fk:work_graph_run.run_id"]}, {"name": "file_path", "type": "string", "nullable": false, "constraints": []}, {"name": "git_commit_sha", "type": "string", "nullable": false, "constraints": []}, {"name": "depends_on_artifact_ids", "type": "json", "nullable": true, "constraints": []}, {"name": "validation_status", "type": "varchar(20)", "nullable": false, "constraints": ["enum:pending|passed|failed"], "default": "pending"}, {"name": "created_at", "type": "timestamp", "nullable": false, "constraints": []} ] }, { "entity": "bug_record", "owner": "validator", "purpose": "结构化问题记录与根因归属,来源可为 Validator 自动生成或人工反馈", "fields": [ {"name": "bug_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "task_id", "type": "string", "nullable": true, "constraints": ["fk:task.task_id"]}, {"name": "source", "type": "varchar(20)", "nullable": false, "constraints": ["enum:validator|human"]}, {"name": "reported_by", "type": "string", "nullable": true, "constraints": []}, {"name": "description", "type": "text", "nullable": false, "constraints": []}, {"name": "repro_steps", "type": "text", "nullable": true, "constraints": []}, {"name": "root_cause_category", "type": "varchar(20)", "nullable": true, "constraints": ["enum:planning|coder|skill_defect|core_engine"]}, {"name": "root_cause_detail", "type": "text", "nullable": true, "constraints": []}, {"name": "related_artifact_ids", "type": "json", "nullable": true, "constraints": []}, {"name": "suggested_route", "type": "varchar(20)", "nullable": true, "constraints": ["enum:fast_lane|full_replan"]}, {"name": "skill_iteration_suggestion_id", "type": "string", "nullable": true, "constraints": ["fk:skill_iteration.iteration_id"]}, {"name": "status", "type": "varchar(20)", "nullable": false, "constraints": ["enum:open|triaging|routed|resolved"]} ] }, { "entity": "skill", "owner": "graph-engine", "purpose": "Skill 库条目,Git 版本化", "fields": [ {"name": "skill_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "owner_org_node", "type": "varchar(20)", "nullable": false, "constraints": ["enum:planner|coder|validator"]}, {"name": "file_path", "type": "string", "nullable": false, "constraints": []}, {"name": "current_git_commit_sha", "type": "string", "nullable": false, "constraints": []}, {"name": "source", "type": "varchar(20)", "nullable": false, "constraints": ["enum:migrated_from_hermes|new|auto_iterated"]}, {"name": "migrated_from_profile", "type": "varchar(20)", "nullable": true, "constraints": ["enum:code|planning|qa"]}, {"name": "status", "type": "varchar(20)", "nullable": false, "constraints": ["enum:active|archived"]} ] }, { "entity": "skill_iteration", "owner": "graph-engine", "purpose": "Skill 自主迭代的变更记录,每条对应一次独立 Git 提交", "fields": [ {"name": "iteration_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "skill_id", "type": "string", "nullable": false, "constraints": ["fk:skill.skill_id"]}, {"name": "triggered_by_bug_id", "type": "string", "nullable": false, "constraints": ["fk:bug_record.bug_id"]}, {"name": "before_git_commit_sha", "type": "string", "nullable": false, "constraints": []}, {"name": "after_git_commit_sha", "type": "string", "nullable": false, "constraints": []}, {"name": "change_summary", "type": "text", "nullable": false, "constraints": []}, {"name": "applied_at", "type": "timestamp", "nullable": false, "constraints": []}, {"name": "rollback_of_iteration_id", "type": "string", "nullable": true, "constraints": ["fk:skill_iteration.iteration_id"]} ] }, { "entity": "agent_profile", "owner": "graph-engine", "purpose": "Org Agent 人设与运行契约文件元数据", "fields": [ {"name": "org_node", "type": "varchar(20)", "nullable": false, "constraints": ["pk", "enum:planner|coder|validator"]}, {"name": "soul_file_path", "type": "string", "nullable": false, "constraints": []}, {"name": "agents_file_path", "type": "string", "nullable": true, "constraints": []}, {"name": "migrated_from_profile", "type": "varchar(20)", "nullable": false, "constraints": ["enum:code|planning|qa"]}, {"name": "current_git_commit_sha", "type": "string", "nullable": false, "constraints": []} ] }, { "entity": "budget_guardrail_config", "owner": "graph-engine", "purpose": "预算/额度护栏配置,手工配置层", "fields": [ {"name": "config_id", "type": "string", "nullable": false, "constraints": ["pk"], "default": "default"}, {"name": "scope", "type": "varchar(20)", "nullable": false, "constraints": ["enum:global|per_task|per_day"]}, {"name": "limit_type", "type": "varchar(20)", "nullable": false, "constraints": ["enum:token_count|call_count"]}, {"name": "limit_value", "type": "int", "nullable": false, "constraints": [">0"]}, {"name": "current_usage", "type": "int", "nullable": false, "constraints": [">=0"], "default": 0}, {"name": "on_exceed_action", "type": "varchar(30)", "nullable": false, "constraints": [], "default": "pause_and_notify"}, {"name": "updated_by", "type": "string", "nullable": false, "constraints": []}, {"name": "updated_at", "type": "timestamp", "nullable": false, "constraints": []} ] }, { "entity": "org_concurrency_config", "owner": "graph-engine", "purpose": "多 Goal 并发数配置,MVP 默认 1", "fields": [ {"name": "config_id", "type": "string", "nullable": false, "constraints": ["pk"], "default": "default"}, {"name": "max_concurrent_goals", "type": "int", "nullable": false, "constraints": ["range:1-50"], "default": 1}, {"name": "updated_by", "type": "string", "nullable": false, "constraints": []}, {"name": "updated_at", "type": "timestamp", "nullable": false, "constraints": []} ] }, { "entity": "execution_event", "owner": "control-plane", "purpose": "实时看板的唯一数据源,append-only 事件流", "fields": [ {"name": "event_id", "type": "string", "nullable": false, "constraints": ["pk", "sortable"]}, {"name": "project_id", "type": "string", "nullable": false, "constraints": ["fk:project.project_id", "idx"], "index": "idx"}, {"name": "task_id", "type": "string", "nullable": true, "constraints": ["fk:task.task_id", "idx"], "index": "idx"}, {"name": "run_id", "type": "string", "nullable": true, "constraints": ["fk:work_graph_run.run_id"]}, {"name": "node_exec_id", "type": "string", "nullable": true, "constraints": ["fk:work_node_execution.node_exec_id"]}, {"name": "event_type", "type": "varchar(30)", "nullable": false, "constraints": ["enum:task_status_changed|node_status_changed|artifact_created|bug_recorded|loop_routed|budget_updated|skill_iterated|log_appended|quota_wait_started"]}, {"name": "payload", "type": "json", "nullable": false, "constraints": []}, {"name": "created_at", "type": "timestamp", "nullable": false, "constraints": ["idx"], "index": "idx"} ] }, { "entity": "execution_log_file", "owner": "control-plane", "purpose": "Work Node 原始执行日志本地落盘记录,架构文档13.1决策4", "fields": [ {"name": "log_file_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "node_exec_id", "type": "string", "nullable": false, "constraints": ["fk:work_node_execution.node_exec_id", "unique"], "index": "unique"}, {"name": "project_id", "type": "string", "nullable": false, "constraints": ["fk:project.project_id", "idx"], "index": "idx"}, {"name": "file_path", "type": "string", "nullable": false, "constraints": []}, {"name": "format", "type": "varchar(20)", "nullable": false, "constraints": ["enum:jsonl|raw_text"]}, {"name": "size_bytes", "type": "int", "nullable": false, "constraints": [">=0"], "default": 0}, {"name": "status", "type": "varchar(20)", "nullable": false, "constraints": ["enum:active|closed|purged"]}, {"name": "created_at", "type": "timestamp", "nullable": false, "constraints": []}, {"name": "purged_at", "type": "timestamp", "nullable": true, "constraints": []} ] }, { "entity": "log_retention_config", "owner": "control-plane", "purpose": "日志清理策略配置", "fields": [ {"name": "config_id", "type": "string", "nullable": false, "constraints": ["pk"], "default": "default"}, {"name": "retention_days", "type": "int", "nullable": false, "constraints": [">0"], "default": 14}, {"name": "max_total_size_mb", "type": "int", "nullable": true, "constraints": [">0"]}, {"name": "updated_by", "type": "string", "nullable": false, "constraints": []}, {"name": "updated_at", "type": "timestamp", "nullable": false, "constraints": []} ] }, { "entity": "deployment", "owner": "deploy-supervisor", "purpose": "PH5 新增(2026-07-30):Deploy Supervisor 对 graphlemon 自身(self-target)执行一次蓝绿部署的记录,见 docs/supervisor-auto-rollback-design.md。不要与架构文档里的 Supervisor(调度子 Agent)概念混淆", "fields": [ {"name": "deployment_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "git_commit_hash", "type": "string", "nullable": false, "constraints": []}, {"name": "previous_commit_hash", "type": "string", "nullable": false, "constraints": []}, {"name": "status", "type": "varchar(30)", "nullable": false, "constraints": ["enum:staged|candidate_starting|health_check_running|health_check_passed|health_check_failed|cutover_in_progress|live|monitoring|anomaly_detected|rollback_in_progress|rolled_back|rollback_failed|blocked_pending_human|monitoring_window_clean|finalized"]}, {"name": "candidate_port", "type": "int", "nullable": true, "constraints": []}, {"name": "candidate_db_path", "type": "string", "nullable": true, "constraints": []}, {"name": "started_at", "type": "timestamp", "nullable": true, "constraints": []}, {"name": "cutover_at", "type": "timestamp", "nullable": true, "constraints": []}, {"name": "monitoring_closed_at", "type": "timestamp", "nullable": true, "constraints": []}, {"name": "rollback_at", "type": "timestamp", "nullable": true, "constraints": []}, {"name": "rollback_reason", "type": "string", "nullable": true, "constraints": []}, {"name": "previous_instance_dir", "type": "string", "nullable": false, "constraints": []} ] }, { "entity": "deploy_health_signal", "owner": "deploy-supervisor", "purpose": "PH5 新增(2026-07-30):deployment 生命周期内每次健康检查/监控采样记录,全部确定性判断,不涉及 LLM", "fields": [ {"name": "signal_id", "type": "string", "nullable": false, "constraints": ["pk"]}, {"name": "deployment_id", "type": "string", "nullable": false, "constraints": ["fk:deployment.deployment_id"]}, {"name": "sampled_at", "type": "timestamp", "nullable": false, "constraints": []}, {"name": "signal_type", "type": "varchar(30)", "nullable": false, "constraints": ["enum:process_alive|http_health|canary_task|validator_approval_rate"]}, {"name": "status", "type": "varchar(10)", "nullable": false, "constraints": ["enum:ok|degraded|fail"]}, {"name": "detail", "type": "string", "nullable": true, "constraints": []} ] } ], "view_contract": [ { "view_id": "v_project_setup", "route": "/setup", "fields": [ {"name": "folder_path", "visible_when": "all", "validation": ["required"], "required": true}, {"name": "project_name", "visible_when": "all", "validation": [], "required": false} ], "events": [ {"event": "click_pick_folder", "target_controller_id": "c_pick_folder", "payload": {}}, {"event": "submit_create", "target_controller_id": "c_project_create", "payload": {"target_folder_path": "string", "name": "string", "init_git_if_missing": "boolean"}} ] }, { "view_id": "v_dashboard", "route": "/", "fields": [], "events": [ {"event": "click_propose_goal", "target_controller_id": "c_task_create", "payload": {}}, {"event": "click_report_bug", "target_controller_id": "c_bug_report_create", "payload": {}}, {"event": "click_task_card", "target_controller_id": "c_task_get", "payload": {"task_id": "string"}} ] }, { "view_id": "v_goal_composer", "route": "/goals/new", "fields": [ {"name": "goal_text", "visible_when": "all", "validation": ["required", "maxLen:4000"], "required": true} ], "events": [ {"event": "submit_create", "target_controller_id": "c_task_create", "payload": {"goal_text": "string", "created_via": "human_console"}} ] }, { "view_id": "v_bug_feedback", "route": "/bugs/new", "fields": [ {"name": "description", "visible_when": "all", "validation": ["required"], "required": true}, {"name": "repro_steps", "visible_when": "all", "validation": [], "required": false}, {"name": "related_task_id", "visible_when": "all", "validation": [], "required": false} ], "events": [ {"event": "submit_create", "target_controller_id": "c_bug_report_create", "payload": {"description": "string", "repro_steps": "string", "related_task_id": "string"}} ] }, { "view_id": "v_artifact_browser", "route": "/artifacts", "fields": [ {"name": "artifact_type_filter", "visible_when": "all", "validation": [], "required": false}, {"name": "task_id_filter", "visible_when": "all", "validation": [], "required": false} ], "events": [ {"event": "click_row", "target_controller_id": "c_artifact_get", "payload": {"artifact_id": "string"}} ] }, { "view_id": "v_skill_library", "route": "/skills", "fields": [], "events": [ {"event": "click_skill", "target_controller_id": "c_skill_diff", "payload": {"skill_id": "string"}} ] }, { "view_id": "v_task_board", "route": "/tasks", "fields": [ {"name": "keyword", "visible_when": "all", "validation": ["maxLen:128"], "required": false}, {"name": "status_filter", "visible_when": "all", "validation": [], "required": false}, {"name": "org_node_filter", "visible_when": "all", "validation": [], "required": false} ], "events": [ {"event": "click_row", "target_controller_id": "c_task_get", "payload": {"task_id": "string"}}, {"event": "click_search", "target_controller_id": "c_task_list", "payload": {"filters": ["keyword", "status_filter", "org_node_filter"]}} ] }, { "view_id": "v_task_detail", "route": "/tasks/:task_id", "fields": [ {"name": "task_id", "visible_when": "all", "validation": ["required"], "required": true} ], "events": [ {"event": "click_artifact_link", "target_controller_id": "c_artifact_get", "payload": {"artifact_id": "string"}}, {"event": "click_view_raw_log", "target_controller_id": "c_execution_log_get", "payload": {"node_exec_id": "string"}}, {"event": "click_retry", "target_controller_id": "c_org_loop_route", "payload": {"task_id": "string", "action": "manual_resume"}} ] }, { "view_id": "v_log_viewer", "route": "embedded", "fields": [ {"name": "node_exec_id", "visible_when": "all", "validation": ["required"], "required": true} ], "events": [ {"event": "toggle_auto_scroll", "target_controller_id": "none", "payload": {}}, {"event": "click_download", "target_controller_id": "c_execution_log_get", "payload": {"node_exec_id": "string", "download": true}} ] }, { "view_id": "v_log_retention_settings", "route": "/settings/log-retention", "fields": [ {"name": "retention_days", "visible_when": "all", "validation": [">0"], "required": true}, {"name": "max_total_size_mb", "visible_when": "all", "validation": [">0"], "required": false} ], "events": [ {"event": "submit_save", "target_controller_id": "c_log_retention_config_update", "payload": {"retention_days": "int", "max_total_size_mb": "int"}} ] }, { "view_id": "v_concurrency_settings", "route": "/settings/concurrency", "fields": [ {"name": "max_concurrent_goals", "visible_when": "all", "validation": ["range:1-50"], "required": true} ], "events": [ {"event": "submit_save", "target_controller_id": "c_concurrency_config_update", "payload": {"max_concurrent_goals": "int"}} ] }, { "view_id": "v_budget_settings", "route": "/settings/budget", "fields": [ {"name": "scope", "visible_when": "all", "validation": ["required"], "required": true}, {"name": "limit_type", "visible_when": "all", "validation": ["required"], "required": true}, {"name": "limit_value", "visible_when": "all", "validation": [">0"], "required": true} ], "events": [ {"event": "submit_save", "target_controller_id": "c_budget_config_update", "payload": {"scope": "string", "limit_type": "string", "limit_value": "int"}} ] }, { "view_id": "v_skill_audit_log", "route": "/skills/:skill_id/audit", "fields": [ {"name": "skill_id", "visible_when": "all", "validation": ["required"], "required": true} ], "events": [ {"event": "click_diff", "target_controller_id": "c_skill_diff", "payload": {"before": "string", "after": "string"}}, {"event": "click_rollback", "target_controller_id": "c_skill_rollback", "payload": {"iteration_id": "string"}} ] }, { "view_id": "v_graph_visualizer", "route": "embedded", "fields": [ {"name": "run_id", "visible_when": "task_has_active_run", "validation": [], "required": false} ], "events": [ {"event": "hover_node", "target_controller_id": "c_work_node_get", "payload": {"node_exec_id": "string"}} ] }, { "view_id": "v_deployment_status", "route": "embedded", "fields": [ {"name": "deployment_id", "visible_when": "self_target_deployment_active", "validation": [], "required": false} ], "events": [ {"event": "click_deployment_card", "target_controller_id": "c_deploy_supervisor_monitor", "payload": {"deployment_id": "string"}} ] } ], "controller_contract": [ { "operation_id": "c_pick_folder", "method": "POST", "path": "/api/system/pick-folder", "auth": "system_internal", "input": {}, "output": {"selected_path": "string|null"}, "idempotent": false, "errors": [ {"code": "DIALOG_UNAVAILABLE", "retryable": false, "description": "后端所在环境不支持原生文件夹对话框,前端应回退到手动路径输入"} ] }, { "operation_id": "c_project_create", "method": "POST", "path": "/api/projects", "auth": "system_internal", "input": {"target_folder_path": "string(required)", "name": "string(optional)", "init_git_if_missing": "boolean(required)"}, "output": {"project_id": "string", "has_git_repo": "boolean", "graphlemon_subdir_initialized": "boolean"}, "idempotent": true, "errors": [ {"code": "PATH_NOT_FOUND", "retryable": false, "description": "文件夹不存在"}, {"code": "PATH_NOT_WRITABLE", "retryable": false, "description": "无写权限"}, {"code": "GIT_INIT_DECLINED", "retryable": false, "description": "非 Git 仓库且用户未确认初始化"} ] }, { "operation_id": "c_project_get", "method": "GET", "path": "/api/projects/:project_id", "auth": "system_internal", "input": {"path": {"project_id": "string(required)"}}, "output": {"project": "object"}, "idempotent": true, "errors": [ {"code": "NOT_FOUND", "retryable": false, "description": "project_id 不存在"} ] }, { "operation_id": "c_project_list", "method": "GET", "path": "/api/projects", "auth": "system_internal", "input": {}, "output": {"items": "array"}, "idempotent": true, "errors": [] }, { "operation_id": "c_task_create", "method": "POST", "path": "/api/tasks", "auth": "system_internal", "input": {"project_id": "string(required)", "goal_text": "string(required)", "task_type": "enum(goal)", "created_via": "enum(api|human_console)"}, "output": {"task_id": "string", "status": "queued"}, "idempotent": false, "errors": [ {"code": "INVALID_PARAM", "retryable": false, "description": "goal_text 为空或 project_id 不存在"} ] }, { "operation_id": "c_bug_report_create", "method": "POST", "path": "/api/bug-reports", "auth": "system_internal", "input": {"description": "string(required)", "repro_steps": "string(optional)", "related_task_id": "string(optional)"}, "output": {"bug_id": "string", "status": "open"}, "idempotent": false, "errors": [ {"code": "INVALID_PARAM", "retryable": false, "description": "description 为空"} ] }, { "operation_id": "c_ws_subscribe", "method": "GET", "path": "/api/ws/projects/:project_id", "auth": "system_internal", "input": {"query": {"project_id": "string(required)", "task_id": "string(optional)"}}, "output": {"stream": "execution_event[]"}, "idempotent": false, "errors": [ {"code": "PROJECT_NOT_FOUND", "retryable": false, "description": "订阅的 project_id 不存在,拒绝建立连接"} ] }, { "operation_id": "c_task_list", "method": "GET", "path": "/api/tasks", "auth": "system_internal", "input": {"query": {"status": "string(optional)", "org_node": "string(optional)", "keyword": "string(optional)"}}, "output": {"items": "array", "total": "int"}, "idempotent": true, "errors": [] }, { "operation_id": "c_task_get", "method": "GET", "path": "/api/tasks/:task_id", "auth": "system_internal", "input": {"path": {"task_id": "string(required)"}}, "output": {"task": "object", "artifacts": "array", "bug_records": "array"}, "idempotent": true, "errors": [ {"code": "NOT_FOUND", "retryable": false, "description": "task_id 不存在"} ] }, { "operation_id": "c_org_node_trigger", "method": "POST", "path": "/api/org-nodes/:org_node/trigger", "auth": "system_internal", "input": {"task_id": "string(required)"}, "output": {"run_id": "string", "status": "string"}, "idempotent": false, "errors": [ {"code": "TASK_NOT_READY", "retryable": true, "description": "上游依赖 Artifact 未就绪"}, {"code": "CONCURRENCY_LIMIT_REACHED", "retryable": true, "description": "超过 max_concurrent_goals"}, {"code": "USAGE_LIMIT_REACHED", "retryable": true, "description": "Claude Code plan 额度耗尽(session/weekly/opus),走退避轮询等待重试,非立即重试,见 p_usage_limit_wait"} ] }, { "operation_id": "c_work_graph_plan", "method": "POST", "path": "/api/work-graph/plan", "auth": "system_internal", "input": {"task_id": "string(required)", "org_node": "string(required)"}, "output": {"run_id": "string", "graph_manifest": "object"}, "idempotent": false, "errors": [ {"code": "PLANNING_FAILED", "retryable": true, "description": "Work Graph 规划失败"} ] }, { "operation_id": "c_work_graph_execute", "method": "POST", "path": "/api/work-graph/:run_id/execute", "auth": "system_internal", "input": {"run_id": "string(required)"}, "output": {"status": "string", "result_artifact_refs": "array"}, "idempotent": false, "errors": [ {"code": "NODE_CONTRACT_VIOLATION", "retryable": true, "description": "节点输出未通过 schema 校验"}, {"code": "BUDGET_EXCEEDED", "retryable": false, "description": "预算护栏拦截"}, {"code": "CLASSIFIER_BLOCKED", "retryable": false, "description": "auto mode 分类器连续拦截 3 次或累计 20 次,-p 非交互模式下无人可确认,进程直接中止"} ] }, { "operation_id": "c_work_node_run", "method": "POST", "path": "internal://work-node/run", "auth": "system_internal", "input": {"node_exec_id": "string(required)", "input_payload": "object", "input_schema_ref": "string"}, "output": {"output_payload": "object"}, "idempotent": false, "errors": [ {"code": "SCHEMA_VALIDATION_FAILED", "retryable": true, "description": "输出未通过 output_schema_ref 校验"}, {"code": "USAGE_LIMIT_REACHED", "retryable": true, "description": "Claude Code plan 额度耗尽,退避轮询等待重试,见 p_usage_limit_wait"} ] }, { "operation_id": "c_execution_log_get", "method": "GET", "path": "/api/work-nodes/:node_exec_id/log", "auth": "system_internal", "input": {"path": {"node_exec_id": "string(required)"}, "query": {"offset": "int(optional)", "limit": "int(optional)", "download": "boolean(optional)"}}, "output": {"content": "string", "format": "string", "total_size_bytes": "int", "status": "string"}, "idempotent": true, "errors": [ {"code": "LOG_NOT_FOUND", "retryable": false, "description": "node_exec_id 不存在对应日志记录"}, {"code": "LOG_PURGED", "retryable": false, "description": "日志已被定时清理任务删除"} ] }, { "operation_id": "c_ws_log_tail", "method": "GET", "path": "/api/ws/work-nodes/:node_exec_id/log", "auth": "system_internal", "input": {"path": {"node_exec_id": "string(required)"}}, "output": {"stream": "log_chunk[]"}, "idempotent": false, "errors": [ {"code": "NODE_EXEC_NOT_FOUND", "retryable": false, "description": "node_exec_id 不存在"} ] }, { "operation_id": "c_log_retention_config_update", "method": "PUT", "path": "/api/settings/log-retention", "auth": "system_internal", "input": {"retention_days": "int(required, >0)", "max_total_size_mb": "int(optional)"}, "output": {"config": "object"}, "idempotent": true, "errors": [ {"code": "INVALID_PARAM", "retryable": false, "description": "retention_days<=0"} ] }, { "operation_id": "c_artifact_write", "method": "POST", "path": "/api/artifacts", "auth": "system_internal", "input": {"artifact_type": "string(required)", "task_id": "string(required)", "produced_by_run_id": "string(required)", "file_path": "string(required)", "content": "string(required)", "depends_on_artifact_ids": "array(optional)"}, "output": {"artifact_id": "string", "git_commit_sha": "string"}, "idempotent": false, "errors": [ {"code": "GIT_COMMIT_FAILED", "retryable": true, "description": "Git 提交失败"} ] }, { "operation_id": "c_artifact_get", "method": "GET", "path": "/api/artifacts/:artifact_id", "auth": "system_internal", "input": {"path": {"artifact_id": "string(required)"}}, "output": {"artifact": "object"}, "idempotent": true, "errors": [ {"code": "NOT_FOUND", "retryable": false, "description": "artifact_id 不存在"} ] }, { "operation_id": "c_skill_update", "method": "POST", "path": "/api/skills/:skill_id/update", "auth": "system_internal", "input": {"skill_id": "string(required)", "triggered_by_bug_id": "string(required)", "new_content": "string(required)", "change_summary": "string(required)"}, "output": {"iteration_id": "string", "after_git_commit_sha": "string"}, "idempotent": false, "errors": [ {"code": "MISSING_TRIGGER_REF", "retryable": false, "description": "triggered_by_bug_id 缺失,不允许无来源变更"} ] }, { "operation_id": "c_skill_rollback", "method": "POST", "path": "/api/skills/:skill_id/rollback", "auth": "system_internal", "input": {"iteration_id": "string(required)"}, "output": {"new_iteration_id": "string"}, "idempotent": false, "errors": [ {"code": "ITERATION_NOT_FOUND", "retryable": false, "description": "iteration_id 不存在"} ] }, { "operation_id": "c_skill_diff", "method": "GET", "path": "/api/skills/diff", "auth": "system_internal", "input": {"query": {"before": "string(required)", "after": "string(required)"}}, "output": {"diff_text": "string"}, "idempotent": true, "errors": [] }, { "operation_id": "c_bug_record_create", "method": "POST", "path": "/api/bug-records", "auth": "system_internal", "input": {"task_id": "string(required)", "description": "string(required)", "repro_steps": "string(required)", "root_cause_category": "enum(required)", "root_cause_detail": "string(required)", "related_artifact_ids": "array(required)", "suggested_route": "enum(required)"}, "output": {"bug_id": "string"}, "idempotent": false, "errors": [ {"code": "INVALID_ROOT_CAUSE_CATEGORY", "retryable": false, "description": "未落在 planning|coder|skill_defect|core_engine 四类之一(core_engine 为 2026-07-30 新增,见 01-M bug_record 实体)"} ] }, { "operation_id": "c_org_loop_route", "method": "POST", "path": "/api/tasks/:task_id/route", "auth": "system_internal", "input": {"task_id": "string(required)", "decided_route": "enum(fast_lane|full_replan|manual_resume)"}, "output": {"task_id": "string", "new_status": "string", "new_assigned_org_node": "string"}, "idempotent": false, "errors": [ {"code": "LOOP_LIMIT_REACHED", "retryable": false, "description": "loop_round 已达上限,仅接受 manual_resume"} ] }, { "operation_id": "c_work_node_get", "method": "GET", "path": "/api/work-nodes/:node_exec_id", "auth": "system_internal", "input": {"path": {"node_exec_id": "string(required)"}}, "output": {"node": "object"}, "idempotent": true, "errors": [ {"code": "NOT_FOUND", "retryable": false, "description": "node_exec_id 不存在"} ] }, { "operation_id": "c_budget_check", "method": "POST", "path": "internal://budget/check", "auth": "system_internal", "input": {"scope": "string(required)", "estimated_usage": "int(required)"}, "output": {"allowed": "boolean", "remaining_quota": "int"}, "idempotent": true, "errors": [ {"code": "BUDGET_EXCEEDED", "retryable": false, "description": "超出配置额度"} ] }, { "operation_id": "c_concurrency_config_update", "method": "PUT", "path": "/api/settings/concurrency", "auth": "system_internal", "input": {"max_concurrent_goals": "int(required, range:1-50)"}, "output": {"config": "object"}, "idempotent": true, "errors": [ {"code": "INVALID_PARAM", "retryable": false, "description": "数值超出范围"} ] }, { "operation_id": "c_budget_config_update", "method": "PUT", "path": "/api/settings/budget", "auth": "system_internal", "input": {"scope": "string(required)", "limit_type": "string(required)", "limit_value": "int(required, >0)"}, "output": {"config": "object"}, "idempotent": true, "errors": [ {"code": "INVALID_PARAM", "retryable": false, "description": "数值超出范围"} ] }, { "operation_id": "c_deploy_supervisor_stage", "method": "POST", "path": "internal://deploy-supervisor/stage", "auth": "system_internal", "input": {"git_commit_hash": "string(required)"}, "output": {"deployment_id": "string", "status": "staged"}, "idempotent": false, "errors": [ {"code": "CHECKOUT_FAILED", "retryable": false, "description": "全新目录 checkout 失败(如磁盘空间不足),转 blocked_pending_human"} ] }, { "operation_id": "c_deploy_supervisor_health_check", "method": "POST", "path": "internal://deploy-supervisor/health-check", "auth": "system_internal", "input": {"deployment_id": "string(required)"}, "output": {"status": "string", "signals": "deploy_health_signal[]"}, "idempotent": true, "errors": [ {"code": "HEALTH_CHECK_TIMEOUT", "retryable": false, "description": "process_alive/http_health/canary_task 任一超时,直接判定该项 fail,进入回滚路径 A,不重试"} ] }, { "operation_id": "c_deploy_supervisor_cutover", "method": "POST", "path": "internal://deploy-supervisor/cutover", "auth": "system_internal", "input": {"deployment_id": "string(required)"}, "output": {"status": "live", "cutover_at": "timestamp"}, "idempotent": false, "errors": [ {"code": "CUTOVER_FAILED", "retryable": false, "description": "候选进程未能正确绑定生产端口/生产库,转 blocked_pending_human"} ] }, { "operation_id": "c_deploy_supervisor_monitor", "method": "POST", "path": "internal://deploy-supervisor/monitor", "auth": "system_internal", "input": {"deployment_id": "string(required)"}, "output": {"status": "string", "latest_signal": "object"}, "idempotent": true, "errors": [] }, { "operation_id": "c_deploy_supervisor_rollback", "method": "POST", "path": "internal://deploy-supervisor/rollback", "auth": "system_internal", "input": {"deployment_id": "string(required)", "rollback_reason": "string(required)"}, "output": {"status": "string"}, "idempotent": false, "errors": [ {"code": "ROLLBACK_FAILED", "retryable": false, "description": "previous_instance_dir 也无法启动,或 git revert 冲突,转 blocked_pending_human,blocked_reason=rollback_failed;这是唯一保留的人工介入点,触发条件严格限定为自动恢复机制本身失效,不是代码判断谁对谁错"} ] } ], "process_contract": [ { "flow_id": "p_org_task_lifecycle", "start_state": "queued", "end_state": "done", "transitions": [ {"from": "queued", "to": "planning_brd_prd_sdd", "trigger": "c_org_node_trigger(planner)", "action": "c_work_graph_plan+c_work_graph_execute", "guard": "concurrency_ok", "error_state": "blocked_pending_human", "retry_max": 0}, {"from": "planning_brd_prd_sdd", "to": "coding", "trigger": "planner_work_graph_done", "action": "c_org_node_trigger(coder)", "guard": "artifacts_validated", "error_state": "planning_failed", "retry_max": 2}, {"from": "planning_failed", "to": "planning_brd_prd_sdd", "trigger": "retry", "action": "replan", "guard": "retry_count<2", "error_state": "blocked_pending_human"}, {"from": "coding", "to": "validating", "trigger": "coder_work_graph_done", "action": "c_org_node_trigger(validator)", "guard": "self_test_passed", "error_state": "coding_failed", "retry_max": 2}, {"from": "coding_failed", "to": "coding", "trigger": "retry", "action": "recode", "guard": "retry_count<2", "error_state": "blocked_pending_human"}, {"from": "validating", "to": "done", "trigger": "validator_pass", "action": "close_task", "error_state": ""}, {"from": "validating", "to": "routed_fast_lane", "trigger": "validator_fail", "action": "c_bug_record_create+c_org_loop_route(fast_lane)", "guard": "loop_round<3", "error_state": "blocked_pending_human"}, {"from": "validating", "to": "routed_full_replan", "trigger": "validator_fail", "action": "c_bug_record_create+c_org_loop_route(full_replan)", "guard": "loop_round<3", "error_state": "blocked_pending_human"}, {"from": "routed_fast_lane", "to": "coding", "trigger": "route_applied", "action": "loop_round+=1", "error_state": ""}, {"from": "routed_full_replan", "to": "planning_brd_prd_sdd", "trigger": "route_applied", "action": "loop_round+=1", "error_state": ""}, {"from": "blocked_pending_human", "to": "resumed_prior_state", "trigger": "c_org_loop_route(manual_resume)", "action": "manual_resume", "error_state": ""} ] }, { "flow_id": "p_work_graph_execution", "start_state": "planning", "end_state": "done", "transitions": [ {"from": "planning", "to": "running", "trigger": "plan_ready", "action": "c_work_graph_execute", "guard": "manifest_passes_antipattern_gate", "error_state": "failed"}, {"from": "running", "to": "merging", "trigger": "fanout_nodes_settled", "action": "fanin_edge", "error_state": "failed"}, {"from": "merging", "to": "verifying", "trigger": "fanin_done", "action": "node_verification", "error_state": "failed"}, {"from": "verifying", "to": "done", "trigger": "verify_passed", "action": "c_artifact_write", "error_state": ""}, {"from": "verifying", "to": "reflecting", "trigger": "verify_failed", "action": "record_gap", "guard": "retry_count