From f306f2700b56af42e99147b0b6e5347323acce89 Mon Sep 17 00:00:00 2001 From: elipitc Date: Tue, 2 Jun 2026 00:09:40 +0800 Subject: [PATCH] Sync sub-mode runtime semantics and k8s release --- api/swarm/orchestrator.py | 4 ++ api/swarm/router.py | 2 + docs/HEICODE_SUB_MODE_RUNTIME_INTEGRATION.md | 62 +++++++++++++++++++- k8s/agent-manager-deployment.yaml | 2 +- k8s/deployment-with-kubeconfig.yaml | 2 +- k8s/deployment.yaml | 2 +- 6 files changed, 68 insertions(+), 6 deletions(-) diff --git a/api/swarm/orchestrator.py b/api/swarm/orchestrator.py index 591c77d..a5fc0d3 100644 --- a/api/swarm/orchestrator.py +++ b/api/swarm/orchestrator.py @@ -1081,6 +1081,8 @@ class SwarmOrchestrator: "agent_role": role, "runtime_deployment_id": self.swarm_id, "summary_only": False, + "artifact_layout": "single_file_content", + "primary_read_path": "content", } if stored: metadata.update( @@ -1167,6 +1169,8 @@ class SwarmOrchestrator: "agent_count": len(agents), "synthesized": True, "summary_only": True, + "artifact_layout": "single_file_content", + "primary_read_path": "content", } if stored: metadata.update( diff --git a/api/swarm/router.py b/api/swarm/router.py index d896f82..941fb02 100644 --- a/api/swarm/router.py +++ b/api/swarm/router.py @@ -110,6 +110,8 @@ def _synthesized_artifacts_for_swarm(db: Session, swarm: Swarm) -> list[Dict[str "runtime_deployment_id": swarm.swarm_id, "synthesized": True, "summary_only": True, + "artifact_layout": "single_file_content", + "primary_read_path": "content", "agent_count": len(agents), "content_hash": stored.content_hash if stored else None, "download_path": runtime_artifact_download_path(swarm.swarm_id, artifact_id), diff --git a/docs/HEICODE_SUB_MODE_RUNTIME_INTEGRATION.md b/docs/HEICODE_SUB_MODE_RUNTIME_INTEGRATION.md index c56e7d8..7e9790f 100644 --- a/docs/HEICODE_SUB_MODE_RUNTIME_INTEGRATION.md +++ b/docs/HEICODE_SUB_MODE_RUNTIME_INTEGRATION.md @@ -318,14 +318,26 @@ POST /api/agnet/callbacks/swarm-events Manager 不应将 `summary_only=true` 的 artifact 作为代码任务 `completed` 的充分条件。 -### 7.3 project_folder artifact(推荐扩展) +### 7.3 project_folder artifact(结构性代码强制要求) -对于结构性代码交付,统一方案推荐优先使用: +对于结构性代码交付,统一方案要求优先使用: ```text artifact_type = project_folder ``` +适用范围: + +- 前后端项目 +- 多文件项目 +- 可部署项目 +- 包含 frontend/backend/docs/deploy 等目录的结构性代码任务 + +约束: + +- `code_patch` / `document` 仅适用于单文件、小型补丁或兼容任务 +- 对于结构性代码任务,Runtime 不应长期只返回单一 `content` 正文作为主要交付形式 + 推荐形态: ```json @@ -345,7 +357,37 @@ artifact_type = project_folder } ``` -当前仓库尚未将 `project_folder` 作为默认真实产物类型,但后续扩展建议以此为主,而不是长期停留在单正文 `content` 下载模式。 +当前仓库现状说明: + +- 当前实现仍以 `single_file_content` 作为主要真实产物形态 +- 结构性代码任务尚未默认落成 `project_folder` +- 这属于当前实现缺口,不应被视为最终统一协议目标 + +接入方应按以下原则理解: + +- 当前 `content` 路径仍可用于兼容读取单文件/摘要类产物 +- 未来结构性代码交付应升级为 `project_folder + manifest/archive/files` + +### 7.4 project_folder 读取路径 + +对于 `project_folder` 类型 artifact,主读取路径应是: + +```text +manifest_uri +archive_uri +files/{path} +``` + +推荐读取顺序: + +1. 先读 `manifest_uri` 获取项目文件树和 revision 信息 +2. 按需通过 `files/{path}` 读取单文件 +3. 需要整体下载时通过 `archive_uri` + +`content` 接口定位: + +- `content` 仅作为 `code_patch` / `document` / `single_file_content` 的兼容读取方式 +- `project_folder` 不应依赖单一 `content` 接口作为主读取方式 ## 8. 本地修改与 artifact revision(推荐扩展) @@ -379,6 +421,20 @@ POST /api/agent/sub-agile/deployments/{deployment_id}/artifact-edits } ``` +后续建议补齐的 revision 细节: + +- `base_project_revision` +- `base_content_hash` +- `ARTIFACT_REVISION_CONFLICT` +- `artifact.local_edit_applied` +- `artifact.local_edit_reviewed` +- `artifact.local_edit_rejected` + +推荐边界: + +- Manager 负责 revision / conflict 判定 +- Runtime 通过 `manifest/archive/files` 读取指定 accepted revision + ## 9. 云部署生命周期(推荐扩展) 统一方案中,云部署不应由客户端直传云密钥并直接驱动 Runtime。 diff --git a/k8s/agent-manager-deployment.yaml b/k8s/agent-manager-deployment.yaml index caf62b3..d9b69a4 100644 --- a/k8s/agent-manager-deployment.yaml +++ b/k8s/agent-manager-deployment.yaml @@ -31,7 +31,7 @@ spec: containers: - name: agent-manager - image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260601225417-arm64 + image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260601235948-arm64 imagePullPolicy: Always ports: diff --git a/k8s/deployment-with-kubeconfig.yaml b/k8s/deployment-with-kubeconfig.yaml index a3ff689..0abaf75 100755 --- a/k8s/deployment-with-kubeconfig.yaml +++ b/k8s/deployment-with-kubeconfig.yaml @@ -22,7 +22,7 @@ spec: - name: acr-secret containers: - name: agent-manager - image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260601225417-arm64 + image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260601235948-arm64 imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 33103c5..e594249 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -20,7 +20,7 @@ spec: - name: acr-secret containers: - name: agent-manager - image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260601225417-arm64 + image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260601235948-arm64 imagePullPolicy: Always ports: - containerPort: 8000