三面拆分④:驾驶舱首页 —— 度量改接 report 真八指标,纠正率/DMN 不再恒为 0

治理台原先调 memory 的五指标版,还把 submissions/corrections/judgements
硬塞 0 —— 仪表在说谎。八指标本就在 report 里算好,这里接上,与工作台汇报同源同口径。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
2026-07-27 21:08:42 +08:00
co-authored by Claude Fable 5
parent bb6760d7a4
commit 9fce0fdaa0
11 changed files with 292 additions and 127 deletions
+12 -9
View File
@@ -9,6 +9,7 @@ import { positionIdSchema, staffIdSchema, taskIdSchema } from '../id.ts';
import { closureReportSchema, processPackageSchema, triggerConfigSchema } from '../process-package.ts';
import { controlSemanticSchema, taskRuntimeStateSchema, terminalStateSchema, workflowStateSchema } from '../terminal.ts';
import { paradigmSchema } from '../manifest.ts';
import { reportMetricsSchema, reportPeriodSchema } from './workbench.ts';
/* ── 员工管理 ─────────────────────────────────────────────────────────── */
@@ -393,18 +394,20 @@ export const govWorkflowRoute = {
/* ── 记忆管理 · 度量仪表 ──────────────────────────────────────────────── */
/** 自主率与纠正率**成对读**,复合为有效自主率 —— 单看自主率会奖励「猛冲后返工」 */
/**
* 度量八指标(OS 8.3)—— 运营驾驶舱的仪表读数。
*
* 出参直接复用 `reportMetricsSchema`:**与工作台汇报同源同口径**。
* 治理台若另算一套,同一个组织会读出两个自主率 —— 那时候争的就不是数,是谁的表准。
* 自主率与纠正率**成对读**,复合为有效自主率 —— 单看自主率会奖励「猛冲后返工」。
*/
export const govMetricsRoute = {
method: 'GET',
path: '/api/gov/metrics',
output: z.object({
autonomy: z.number(),
correction: z.number(),
effectiveAutonomy: z.number(),
interruption: z.number(),
dmnCoverage: z.number(),
taskCount: z.number().int(),
}),
/** 统计窗口 —— 不传按月;驾驶舱可切日/周/月/年 */
query: z.object({ period: reportPeriodSchema.optional() }),
/** `period` 原样回声:客户端不传时,由它知道服务端用的是哪个窗口 */
output: reportMetricsSchema.extend({ taskCount: z.number().int(), period: reportPeriodSchema }),
} as const satisfies RouteContract;
/* ── 出参类型:契约自己命名,消费方不再 `z.infer` ──────────────────────── */