mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-15 00:31:58 +00:00
下一轮第 1 波的契约骨架:运行加 end_reason(人工驳回 / 手动停止),定时任务加目标种类和 id、触发记录加评测 id(定时只有一套),运行来源登记 eval、ledger_issue、reconcile、recall(都只能由服务端写);迁移只加不改
This commit is contained in:
@@ -239,6 +239,12 @@ _COLUMN_MIGRATIONS: list[tuple[str, str, str]] = [
|
||||
("apps", "scope", "VARCHAR(20) DEFAULT 'shared'"),
|
||||
("apps", "owner", "VARCHAR(100)"),
|
||||
("apps", "blueprint_id", "VARCHAR(32)"),
|
||||
# 下一轮(docs/design/next-round/00-总方案.md X4、X9):运行为什么结束在 cancelled;定时的目标种类和 id;
|
||||
# 定时触发建的那次评测。存量行:end_reason 为空,target_kind 是 workflow(target_id 由 scheduler 按 workflow_id 读)
|
||||
("runs", "end_reason", "VARCHAR(20)"),
|
||||
("schedules", "target_kind", "VARCHAR(20) DEFAULT 'workflow'"),
|
||||
("schedules", "target_id", "VARCHAR(32)"),
|
||||
("schedule_fires", "eval_run_id", "VARCHAR(32)"),
|
||||
]
|
||||
|
||||
#: 迁移补上的列要建的索引:(索引名, 表, 列或多列)。create_all 不碰已有的表,表上新列的索引也就不会建。
|
||||
|
||||
@@ -654,6 +654,9 @@ class Run(Base, TimestampMixin):
|
||||
input: Mapped[dict[str, Any]] = mapped_column(default=dict)
|
||||
output: Mapped[dict[str, Any]] = mapped_column(default=dict)
|
||||
error: Mapped[str | None] = mapped_column(Text, default=None)
|
||||
# 运行为什么结束在 cancelled(docs/design/next-round/00-总方案.md X9):rejected 人工驳回、stopped 手动停止。
|
||||
# 其余终态、加这一列之前的运行为空
|
||||
end_reason: Mapped[str | None] = mapped_column(String(20), default=None)
|
||||
usage: Mapped[dict[str, Any]] = mapped_column(default=dict) # tokens / cost / 各节点耗时
|
||||
started_at: Mapped[datetime | None] = mapped_column(default=None)
|
||||
finished_at: Mapped[datetime | None] = mapped_column(default=None)
|
||||
@@ -975,6 +978,12 @@ class Schedule(Base, TimestampMixin):
|
||||
|
||||
id: Mapped[str] = mapped_column(String(32), primary_key=True, default=new_id)
|
||||
name: Mapped[str] = mapped_column(String(200), default="")
|
||||
# 定时的目标(next-round X4,定时只有一套):workflow 发起工作流运行;eval_suite 跑一次评测题集;
|
||||
# source_maintenance 维护一个数据源(探查、剖析、取值观察)。加这一列之前的任务都是 workflow
|
||||
target_kind: Mapped[str] = mapped_column(String(20), default="workflow")
|
||||
# 目标的 id:workflow 时同 workflow_id;其余两种是题集 id、数据源 id
|
||||
target_id: Mapped[str | None] = mapped_column(String(32), default=None, index=True)
|
||||
# 非空(老表的约束,只加不改的迁移放宽不了):目标不是工作流时存空串,读写都经 scheduler/service 里的一处封装
|
||||
workflow_id: Mapped[str] = mapped_column(String(32), index=True)
|
||||
# 保存时的工作流名。工作流还在时接口给它现在的名字,删掉之后才用这一份
|
||||
workflow_name: Mapped[str] = mapped_column(String(200), default="")
|
||||
@@ -1020,6 +1029,8 @@ class ScheduleFire(Base):
|
||||
# started | skipped_overlap | skipped_misfire | failed_to_start
|
||||
status: Mapped[str] = mapped_column(String(30), default="started")
|
||||
run_id: Mapped[str | None] = mapped_column(String(32), default=None, index=True)
|
||||
# 目标是评测题集时,这一次触发建的那次评测(target_kind=eval_suite,next-round X4)
|
||||
eval_run_id: Mapped[str | None] = mapped_column(String(32), default=None)
|
||||
reason: Mapped[str | None] = mapped_column(Text, default=None)
|
||||
# 渲染后的输入,就是交给运行的那一份
|
||||
inputs: Mapped[dict[str, Any]] = mapped_column(default=dict)
|
||||
|
||||
@@ -24,6 +24,11 @@ ORIGIN_KINDS = (
|
||||
"api", # 直接调接口,没说是哪
|
||||
"trial", # 蓝图的试运行(探索运行,docs/design/normal-user-apps.md N4)
|
||||
"personal_app", # 个人应用的刷新(探索运行,N7)
|
||||
# 下一轮(docs/design/next-round/00-总方案.md X1):都只能由服务端写
|
||||
"eval", # 评测:作答和算期望的运行(探索运行)
|
||||
"ledger_issue", # 问数据的答案按已治理口径正式出具(正式运行)
|
||||
"reconcile", # 口径对账:这次的取数和口径在同一份数据上各算一次(探索运行)
|
||||
"recall", # 口径召回:新旧两版口径在同一份数据上各算一次(探索运行)
|
||||
)
|
||||
|
||||
#: 客户端在 POST /api/runs 里能声明的来源
|
||||
|
||||
@@ -5114,6 +5114,10 @@ export const ORIGIN_LABEL: Record<OriginKind, string> = {
|
||||
api: '接口',
|
||||
trial: '蓝图试运行',
|
||||
personal_app: '个人应用刷新',
|
||||
eval: '评测',
|
||||
ledger_issue: '按口径正式出具',
|
||||
reconcile: '口径对账',
|
||||
recall: '口径召回',
|
||||
}
|
||||
|
||||
export const ORIGIN_TEXT = {
|
||||
|
||||
@@ -703,6 +703,7 @@ export interface NotifyChannelRow {
|
||||
export type OriginKind =
|
||||
| 'chat' | 'canvas' | 'launcher' | 'schedule' | 'app_entry' | 'app_view' | 'app_backfill' | 'hook' | 'api'
|
||||
| 'trial' | 'personal_app'
|
||||
| 'eval' | 'ledger_issue' | 'reconcile' | 'recall'
|
||||
|
||||
/** 查看的对象。caliber 是已发布口径卡上的指标(蓝图助手复用口径时看,服务端 look/calibers.py) */
|
||||
export interface LookObject {
|
||||
|
||||
Reference in New Issue
Block a user