mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-24 08:12:00 +00:00
运行分级与版本钉死:formal/exploratory、方法卡钉版、口径升版被迫处置
formal 运行的全部语义就一条规则:必须引用一个不可变的已发布 WorkflowVersion(按 graph_hash 钉住);传裸 graph 的运行自动是 exploratory。发布后改图不影响已发布版本——formal 永远执行快照。 子图节点支持 workflow_version 钉版,这就是方法卡的机制核心: 钉住后上游改方法卡不会让口径悄悄漂移。钉住的方法卡出现新版本时, formal 启动被拒,除非节点已声明 upgrade_policy(recompute 回算 / dual 双印 / incomparable 标注不可比,无默认值);已声明的升版 以 caliber.upgrade 事件记入流水。 发布端点带两级门禁:published 只拦基础错误,governed 额外过治理 lint(禁 supervisor、方法卡必须钉版、agent 不得关闭全部审批、 output 必须声明出具契约)。X-Actor 记录发布人与运行发起人。
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
from app.core import artifact_store
|
||||
|
||||
router = APIRouter(prefix="/api/artifacts", tags=["artifacts"])
|
||||
|
||||
_MAX_INLINE = 2 * 1024 * 1024
|
||||
|
||||
|
||||
@router.get("/{artifact_id}")
|
||||
async def get_artifact(artifact_id: str) -> dict[str, Any]:
|
||||
"""按内容哈希取回一个工件。取回时会复验哈希——内容不可变是这层的全部承诺。"""
|
||||
try:
|
||||
content = artifact_store.load(artifact_id)
|
||||
except ValueError as e:
|
||||
# 哈希对不上:明确报给调用方,这正是工件库存在的意义
|
||||
raise HTTPException(409, str(e)) from e
|
||||
if content is None:
|
||||
raise HTTPException(404, "工件不存在")
|
||||
return {"id": artifact_id, "content": content}
|
||||
Reference in New Issue
Block a user