Add runtime revision and workflow detail fields
This commit is contained in:
@@ -111,6 +111,7 @@ class SwarmCreateResponse(BaseModel):
|
||||
"""Compatibility response model for sub-mode runtime creation."""
|
||||
deployment_id: Optional[str] = None
|
||||
swarm_id: str
|
||||
mode: Optional[str] = None
|
||||
status: str
|
||||
agents: List[SwarmAgentInfo]
|
||||
created_at: datetime
|
||||
|
||||
+11
-2
@@ -3,11 +3,13 @@
|
||||
import json
|
||||
import mimetypes
|
||||
import uuid
|
||||
from copy import deepcopy
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Dict, Any
|
||||
from fastapi import APIRouter, Depends, HTTPException, BackgroundTasks, Request
|
||||
from fastapi.responses import FileResponse, Response
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy.orm.attributes import flag_modified
|
||||
|
||||
from database import (
|
||||
get_db, Swarm, SwarmAgent, SwarmMessage,
|
||||
@@ -391,6 +393,7 @@ async def create_swarm(
|
||||
return SwarmCreateResponse(
|
||||
deployment_id=swarm_id,
|
||||
swarm_id=swarm_id,
|
||||
mode="sub_agile",
|
||||
status=project_runtime_run_status(swarm.status),
|
||||
agents=agent_infos,
|
||||
created_at=swarm.created_at,
|
||||
@@ -808,7 +811,7 @@ def apply_runtime_artifact_edit(db: Session, swarm_id: str, request: ArtifactEdi
|
||||
if not swarm:
|
||||
raise HTTPException(status_code=404, detail="Runtime deployment not found")
|
||||
|
||||
artifacts = list(swarm.artifacts or [])
|
||||
artifacts = deepcopy(list(swarm.artifacts or []))
|
||||
artifact = next((artifact for artifact in artifacts if artifact.get("artifact_id") == request.artifact_id), None)
|
||||
if not artifact:
|
||||
raise HTTPException(status_code=404, detail="ARTIFACT_REVISION_NOT_FOUND")
|
||||
@@ -839,6 +842,7 @@ def apply_runtime_artifact_edit(db: Session, swarm_id: str, request: ArtifactEdi
|
||||
)
|
||||
artifact["metadata"] = metadata
|
||||
swarm.artifacts = artifacts
|
||||
flag_modified(swarm, "artifacts")
|
||||
swarm.updated_at = datetime.utcnow()
|
||||
db.commit()
|
||||
|
||||
@@ -869,8 +873,13 @@ async def receive_swarm_artifact_edit(
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""Accept an accepted project revision forwarded by Manager."""
|
||||
response = apply_runtime_artifact_edit(db, swarm_id, request)
|
||||
swarm = db.query(Swarm).filter(Swarm.swarm_id == swarm_id).first()
|
||||
try:
|
||||
response = apply_runtime_artifact_edit(db, swarm_id, request)
|
||||
except HTTPException as exc:
|
||||
if swarm and exc.status_code == 409:
|
||||
await _emit_artifact_edit_event(swarm, request, "artifact.local_edit_conflict")
|
||||
raise
|
||||
if swarm:
|
||||
await _emit_artifact_edit_event(swarm, request, "artifact.local_edit_applied")
|
||||
return response
|
||||
|
||||
@@ -31,7 +31,7 @@ spec:
|
||||
|
||||
containers:
|
||||
- name: agent-manager
|
||||
image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260603104215-arm64
|
||||
image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260603110450-arm64
|
||||
imagePullPolicy: Always
|
||||
|
||||
ports:
|
||||
|
||||
@@ -22,7 +22,7 @@ spec:
|
||||
- name: acr-secret
|
||||
containers:
|
||||
- name: agent-manager
|
||||
image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260603104215-arm64
|
||||
image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260603110450-arm64
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ spec:
|
||||
- name: acr-secret
|
||||
containers:
|
||||
- name: agent-manager
|
||||
image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260603104215-arm64
|
||||
image: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v2-runtime-20260603110450-arm64
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
|
||||
@@ -104,3 +104,4 @@ def test_runtime_rich_workflow_contract_is_present():
|
||||
callbacks_source = _read("api/agnet/callbacks.py")
|
||||
assert "artifact.local_edit_applied" in callbacks_source
|
||||
assert '"project_folder"' in callbacks_source
|
||||
assert "mode: Optional[str] = None" in swarm_models_source
|
||||
|
||||
Reference in New Issue
Block a user