发布门禁、操作者归属、治理遥测与前端支撑

审批记录批准人(X-Actor 先落库再恢复执行)。设置页可配操作者署名,
随请求头发送——这是归属记录不是身份认证,界面上写明了区别。

治理遥测三件套,全部从既有事件流取材:
- 工具白名单衰减报表:授了权但从未用过的工具摆上台面,放宽可被回收
- 探索问题聚类:同一问题反复出现(≥3 次)标记为晋升候选——模板生长
  的触发器
- 轨迹→模板提取器:把探索性运行实际走过的路径确定性提取成草稿工作流
  (剪掉未走的分支、输入参数化),人审发布后才成为模板——探索层的
  价值在路径沉淀,不在单次答案

前端:口径卡节点与指标编辑器、出具契约配置、发布对话框(两级门禁、
问题列表)、试运行/正式运行双按钮、出具档位横幅(含缺数据声明与
未回指数字点名)、运行列表正式/探索徽标、运行详情版本与清单哈希、
提取模板按钮。

真模型验证闭环:周报模板 governed 发布 → formal 运行,Opus 5 正文
数字全部回指,但结尾'(约 100 字)'被校验器抓住降档——修 prompt
禁元话语而非加白名单,重发 v2 后正式档。8/8 模板回归通过。
This commit is contained in:
ThearchyHelios
2026-09-14 10:27:13 +08:00
parent 46eb674bc2
commit e905426dfe
18 changed files with 655 additions and 30 deletions
+25
View File
@@ -11,11 +11,21 @@ export class ApiError extends Error {
}
}
function actorHeader(): Record<string, string> {
try {
const actor = localStorage.getItem('agentlab_actor')
return actor ? { 'X-Actor': actor } : {}
} catch {
return {}
}
}
async function request<T>(path: string, init?: RequestInit): Promise<T> {
const res = await fetch(BASE + path, {
...init,
headers: {
...(init?.body instanceof FormData ? {} : { 'Content-Type': 'application/json' }),
...actorHeader(),
...init?.headers,
},
})
@@ -59,6 +69,9 @@ export const api = {
duplicate: (id: string) => post<Workflow>(`/workflows/${id}/duplicate`),
versions: (id: string) => get<any[]>(`/workflows/${id}/versions`),
restore: (id: string, v: number) => post<Workflow>(`/workflows/${id}/versions/${v}/restore`),
publish: (id: string, level: 'published' | 'governed', version?: number) =>
post<{ ok: boolean; level?: string; version?: number; issues: any[] }>(
`/workflows/${id}/publish`, { level, version }),
validate: (graph: GraphSpec) =>
post<{ ok: boolean; issues: ValidationIssue[] }>('/workflows/validate', { graph }),
},
@@ -75,7 +88,9 @@ export const api = {
start: (body: {
workflow_id?: string; graph?: GraphSpec; input?: Record<string, any>
memory_scope?: string; collection?: string
run_class?: 'formal' | 'exploratory'; version?: number
}) => post<Run>('/runs', body),
artifacts: (id: string) => get<any[]>(`/runs/${id}/artifacts`),
cancel: (id: string) => post<{ ok: boolean }>(`/runs/${id}/cancel`),
resume: (id: string, response: any) => post<Run>(`/runs/${id}/resume`, { response }),
events: (id: string, after = 0) => get<RunEvent[]>(`/runs/${id}/events?after=${after}`),
@@ -167,6 +182,14 @@ export const api = {
remove: (id: string) => del(`/skills/${id}`),
},
// ---- 治理 ----
governance: {
toolUsage: (workflowId: string) =>
get<any>(`/governance/tool-usage?workflow_id=${workflowId}`),
clusters: () => get<any>('/governance/exploratory-clusters'),
},
artifact: (id: string) => get<{ id: string; content: any }>(`/artifacts/${id}`),
// ---- Copilot ----
copilot: {
generate: (body: { instruction: string; base_graph?: GraphSpec | null }) =>
@@ -174,6 +197,8 @@ export const api = {
'/copilot/generate', body),
explain: (graph: GraphSpec) => post<{ explanation: string }>('/copilot/explain', { graph }),
layout: (graph: GraphSpec) => post<GraphSpec>('/copilot/layout', { graph }),
fromRun: (runId: string, name?: string) =>
post<any>('/copilot/from-run', { run_id: runId, name }),
},
}