合入 W3-b 口径账本闭环:caliber_from.nodes 改名映射;问数据的助手 use_caliber 选用已发布口径(服务端确定性内联实例化);按口径正式出具(自动只给问数据的答案)与口径对账;认证队列、固化成口径草稿、发布后补比;账本统计补上对账与认证转化;使用者的原始运行记录只给问数据的运行

This commit is contained in:
ThearchyHelios
2026-10-16 18:45:45 +08:00
34 changed files with 3985 additions and 100 deletions
+14
View File
@@ -4552,10 +4552,24 @@ export const LEDGER_TEXT = {
/** 副标题:比对在封存之后;事后补比、打开时按需比的另写一句 */
sub: '封存后比对,不在封存范围内',
retro: '按现在的口径回看',
/** 从问数据固化出的口径发布之后,对来源运行补比的那一次(服务端 trigger=certified) */
certified: '按之后发布的口径回看',
/** 标签的四种、认法的两种(第 4 波的证据面板、轮次摘要用同一套) */
kind: { caliber: '来自口径', related: '相关口径', reasoning: '这次的推理', unknown: '没有比对' },
how: { independent: '等价已证明', composed: '助手选用' },
level: { governed: '受管', published: '已发布' },
/**
* 问数据的助手选用已发布口径(use_caliber,服务端 ledger/compose.py 按那一版生成取数节点和口径卡):过程里照实写一行。
* 拒收的(参数不对、版本不对……)同样一行,写服务端给的原因
*/
use: {
title: (name: string, version: number | null, level: string) =>
`选用口径「${name}」${version != null ? ` v${version}` : ''}${level ? `(${level})` : ''}`,
detail: (fetches: number, card: string, metrics: string) =>
`按这一版生成取数节点 ${formatNumber(fetches)} 个和口径卡「${card}」${metrics ? `,用到的指标:${metrics}` : ''}`,
refused: '没有选用口径',
status: '正在选用口径…',
},
}
/**
+21 -1
View File
@@ -2412,7 +2412,8 @@ export function decodeRun(events: RunEvent[], final?: RunFinal, opts?: DecodeOpt
id: `lm-${seq}`, seq, kind: 'note', status: 'done', code: 'ledger_matched',
level: typeof counts.skipped === 'number' && counts.skipped > 0 ? 'warn' : 'info',
title: LEDGER_TEXT.timeline(counts),
sub: [LEDGER_TEXT.sub, retro ? LEDGER_TEXT.retro : ''].filter(Boolean).join(' · '),
sub: [LEDGER_TEXT.sub, d.trigger === 'certified' ? LEDGER_TEXT.certified : retro ? LEDGER_TEXT.retro : '']
.filter(Boolean).join(' · '),
})
break
}
@@ -3623,6 +3624,25 @@ export function decodeCopilot(ops: CopilotOp[], opts?: {
.join('\n') })
break
}
case 'use_caliber': {
// 问数据的助手选用已发布口径(服务端 ledger/compose.py):取数节点和口径卡由服务端按那一版生成,不另转 add_node,
// 这里一行说清选用了哪一版、生成了几个节点;拒收的照实写原因(原因同样交回了模型去改)
const r = op.result && typeof op.result === 'object' ? op.result : null
if (r?.status === 'ok') {
nodeCount += num(r.nodes) ?? 0
const metrics = Array.isArray(r.metrics) ? r.metrics.map((m: any) => String(m?.name ?? m?.id ?? '')).filter(Boolean) : []
add({ id: `uc-${i}`, seq: i, kind: 'node', status: 'done', code: 'use_caliber',
title: clip(LEDGER_TEXT.use.title(String(r.workflow_name ?? r.workflow_id ?? ''), num(r.version) ?? null,
String(r.level_text ?? ''))),
detail: LEDGER_TEXT.use.detail(Array.isArray(r.fetches) ? r.fetches.length : 0, String(r.card ?? r.card_id ?? ''),
metrics.join('、')),
...(r.card_id ? { nodeId: String(r.card_id) } : {}) })
} else if (r?.status === 'refused') {
add({ id: `uc-${i}`, seq: i, kind: 'note', status: 'done', level: 'warn', code: 'use_caliber_refused',
title: LEDGER_TEXT.use.refused, detail: String(r.reason ?? '') || undefined })
}
break
}
case 'plan':
add({ id: `cp-${i}`, seq: i, kind: 'note', status: 'done',
title: clip(String(op.summary ?? '已完成规划'), 120) })
+5 -1
View File
@@ -2,7 +2,7 @@ import { create } from 'zustand'
import { ApiError, api, streamCopilot, streamRun } from '../api/client'
import type { CopilotOp, FixKind, RunFinal } from '../run/decode'
import { copilotContext, copilotLook, decodeRun, looksOf } from '../run/decode'
import { CHAT_BLUEPRINT_TEXT, LOOK_TEXT, REJECTED_TEXT } from '../lib/terms'
import { CHAT_BLUEPRINT_TEXT, LEDGER_TEXT, LOOK_TEXT, REJECTED_TEXT } from '../lib/terms'
import type { LookEvent } from '../typesApp'
import { errorMessage, humanizeError, isNetworkError } from '../lib/errors'
import { guardReview, hasEvidence } from '../lib/evidence'
@@ -1492,6 +1492,10 @@ function plan(flow: Flow, args: PlanArgs) {
status: `正在生成工作流…(${t.ops.filter((o) => o.op === 'add_node').length} 步)`,
}))
break
case 'use_caliber':
// 助手选用了一份已发布口径(取数节点和口径卡由服务端生成,过程里那一行由 decodeCopilot 写)
patch(() => ({ phase: 'building', status: LEDGER_TEXT.use.status }))
break
case 'done':
patch(() => ({ explanation: op.explanation ?? '' }))
break