mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-25 08:13:03 +00:00
口径台账:固定执行、验证审阅发布与增量重导入
- QueryCore 固定执行(K09):按已发布的不可变口径跑一次,交回类型化标量、发布/manifest 引用与逐查询证据 - 依赖闭包(K08):按选中的指标算出要拷的取数节点、要的入口字段,接进 derive / compose / metrics - SQL 模板参数完整性(K01):试跑、组合问数、派生图、运行时取数共用一套语义,缺参数在渲染前就拒 - 受限字段变更服务(K03)与口径领域边界(K01):改动打在整图深拷贝上,身份与证据归属不可改 - 版本化受控模板绑定(K04):业务口径按显式绑定落到 SQL,对不上就报 unsupported / needs_update - 验证记录(K05)与最小审阅:样例匹配不等于正式批准,审批人只从服务端身份取 - 发布依据清单(K07):发布时按不可变图物化内容寻址清单,正式用途按它判 - 增量重导入(K11)与 B/L/R 三方合并、受限自然语言修改提案(K12):只产候选,落图仍走既有写路径 - 接口与前端:口径草稿页接上字段变更、绑定状态、验证与重导入,新增 caliber-drafts / studio 检查脚本 验证:前端 tsc -b 通过。
This commit is contained in:
+462
-4
@@ -141,13 +141,23 @@ export interface LedgerField {
|
||||
has_default: boolean
|
||||
}
|
||||
|
||||
/** 看差多少(口径对账)这一项 */
|
||||
/**
|
||||
* 看差多少(口径对账)这一项。
|
||||
*
|
||||
* `available` 是**这一项当前这个人能不能真的发起**(服务端按同一份资产授权判:应用授权给到「使用」、比对等价、
|
||||
* 绑定没被遮;builder / admin / 关登录放行)。只有 available 为真的那一项才带着口径身份(workflow_id / version)——
|
||||
* 服务端不把身份给出去的那些只是**说明**,不是操作凭据,界面也就不该拿它去发请求(真发出去入口也会 403)。
|
||||
* 人读的部分(哪条查询、哪份口径、等级、差在哪、入口字段)照旧原样给。
|
||||
*/
|
||||
export interface LedgerReconcileAction {
|
||||
kind: 'reconcile'
|
||||
query: string
|
||||
caliber: string
|
||||
workflow_id: string
|
||||
version: number
|
||||
/** 能不能真的发起对账;false 时下面两样一定没有 */
|
||||
available: boolean
|
||||
/** 要对账的那一版口径:只有 available 为真时才有 */
|
||||
workflow_id?: string
|
||||
version?: number
|
||||
node_id?: string
|
||||
workflow_name?: string | null
|
||||
level_text: string
|
||||
@@ -521,6 +531,12 @@ export interface DraftMetric {
|
||||
dimensions?: string[]
|
||||
definition?: DraftDefinition
|
||||
open_questions?: string[]
|
||||
/**
|
||||
* K04 的业务字段:统计时间口径、退款处理。指标声明了它们,取数 SQL 上的受控绑定才跟着走;
|
||||
* 界面按 binding.editable_fields 的 value_labels 把机器值翻成给人看的说法,不直接显示这两个键名
|
||||
*/
|
||||
time_role?: string
|
||||
refund_rule?: string
|
||||
}
|
||||
|
||||
/** 草稿图的入口字段:发布后按这些字段收参数 */
|
||||
@@ -581,7 +597,7 @@ export interface DraftTrialQuery {
|
||||
|
||||
/** GET /api/ledger/drafts/{id}/trial:这次自动试运行的状态和每个指标的值;POST 同一个路径按填好的入口字段再发起一次 */
|
||||
export interface DraftTrialOut {
|
||||
validation?: QualityReport
|
||||
validation?: DraftTrialValidation
|
||||
run_id: string
|
||||
status: DraftTrialStatus
|
||||
metrics: DraftTrialMetric[]
|
||||
@@ -590,6 +606,39 @@ export interface DraftTrialOut {
|
||||
error?: string | null
|
||||
}
|
||||
|
||||
/**
|
||||
* 试跑响应里的 validation。它不是一份固定的质量报告:服务端按分支给不同的东西——成功时是质量结论
|
||||
* (status + checks),另并进这次试跑对应的**验证记录**一段(K05 的 record / covers_current / note);
|
||||
* stale、needs_input、running 这些分支可能只有其中一段,甚至只有 note(老服务端也可能什么都不给)。
|
||||
*
|
||||
* 所以按**联合形状**读:status 缺席就是「没有质量结论」,不能当成通过(也不写成未知通过);covers_current
|
||||
* 可能是 null(调用方没有当前依据),只有 === true 才算覆盖。质量结论自己走 QualityReport 的类型,
|
||||
* 由页面按 status 认全之后才交给质量报告那块画。
|
||||
*/
|
||||
export interface DraftTrialValidation {
|
||||
/** 这一段自己的格式版本(服务端新加的;认不得就照实当没有) */
|
||||
schema_version?: number
|
||||
/** 这一次执行是怎么结束的(succeeded / failed / running / needs_input / stale) */
|
||||
execution?: string
|
||||
status?: 'pass' | 'fail' | 'unknown'
|
||||
checks?: ValidationCheck[]
|
||||
/** 这次试运行对应的验证记录;没有就是 null(缺证据不能算验证通过) */
|
||||
record?: DraftValidationRecord | null
|
||||
/** 这条记录还覆不覆盖当前定义/绑定:只有 === true 才算覆盖,null 是判不了 */
|
||||
covers_current?: boolean | null
|
||||
/** 服务端就这一段的一句说明(例如「这次试运行还没有留下可对应的验证记录」) */
|
||||
note?: string
|
||||
}
|
||||
|
||||
/** 带独立期望试运行的那一份:指标要逐条给全卡指标,来源是三种之一 */
|
||||
export interface DraftExpectIn {
|
||||
metrics: Record<string, unknown>
|
||||
source?: DraftExpectationSource
|
||||
sample_id?: string
|
||||
sample_version?: string
|
||||
note?: string
|
||||
}
|
||||
|
||||
/** 被丢弃的条目和原因(含 SQL 痕迹、引用核对不上) */
|
||||
export interface DraftDropped {
|
||||
name: string
|
||||
@@ -646,10 +695,262 @@ export interface DraftGroup {
|
||||
metric_ids?: string[]
|
||||
}
|
||||
|
||||
/** 草稿图上能写的口径卡:多张时 PATCH 要指明改哪一张(card_id) */
|
||||
export interface DraftCardRef {
|
||||
id: string
|
||||
title: string
|
||||
}
|
||||
|
||||
/** 按字段改一处(K03):op 只有 set / remove,path 是白名单里的字段路径,位置由 metric_id 定,不用数组下标 */
|
||||
export interface DraftOperation {
|
||||
op: 'set' | 'remove'
|
||||
metric_id: string
|
||||
path: string
|
||||
/** 只有 set 才有:写 '' 是「声明成空」、数组整份设置;remove 不接受 value */
|
||||
value?: unknown
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- K04 业务绑定能力(服务端能力描述)
|
||||
|
||||
/** 一个能按字段改的业务定义:机器值 + 给人看的说法 */
|
||||
export interface DraftEditableField {
|
||||
field: string
|
||||
label: string
|
||||
values: string[]
|
||||
/** 机器值 → 界面上写的说法 */
|
||||
value_labels: Record<string, string>
|
||||
help: string
|
||||
}
|
||||
|
||||
/** 一个取数节点上「定义 vs 取数实现」的判定结果(aligned / needs_update / unsupported / not_declared) */
|
||||
export interface DraftBindingNode {
|
||||
node_id: string
|
||||
status: string
|
||||
reason: string
|
||||
/** 该做什么:none / sync / author / manual */
|
||||
fix: string
|
||||
declared: Record<string, string>
|
||||
values: Record<string, string>
|
||||
metrics: string[]
|
||||
binding_fingerprint?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/ledger/drafts/{id} 的 binding(K04):能按字段改哪些业务定义、允许值、现在的值、定义和取数实现的
|
||||
* 同步状态、不支持时的原因和该做什么。**不给模板和 SQL**;aligned 只说定义和实现同步,不等于验证通过。
|
||||
*/
|
||||
export interface DraftBinding {
|
||||
editable_fields: DraftEditableField[]
|
||||
/** 现在的业务值:字段 → 值(各取数节点里最先出现的那一个) */
|
||||
current: Record<string, string>
|
||||
status: 'aligned' | 'needs_update' | 'unsupported' | 'unbound' | string
|
||||
reason: string
|
||||
fix: string
|
||||
/** 这次判定涉及哪些指标(metric_id) */
|
||||
metrics: string[]
|
||||
checked: boolean
|
||||
/** 每条指标声明的业务值:metric_id → {字段: 值}(工作台按它算「改这一项影响哪几条指标」) */
|
||||
metric_values: Record<string, Record<string, string>>
|
||||
unsupported_reason?: string
|
||||
binding_fingerprints?: Record<string, string>
|
||||
nodes?: DraftBindingNode[]
|
||||
/** 只有变更回执里的那一段有:这一次在同一事务里把取数 SQL 也改过来了 */
|
||||
synced?: boolean
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- K05 / K06 验证与审阅
|
||||
|
||||
/**
|
||||
* 一条验证记录的状态。**没有 pass / verified 这种状态**:matched 只是「这一次和这份期望对得上」,
|
||||
* observed 是「跑了、取了数,但没有独立期望」,都不能说成验证通过(结论看 DraftValidationSummary.verdict)。
|
||||
*/
|
||||
export type DraftValidationStatus = 'matched' | 'mismatched' | 'observed' | 'unverified' | 'failed'
|
||||
|
||||
/** 期望来自哪里:人工确认 / 固定夹具 / 独立计算。不能拿当前 SQL 的结果抄一份当标准答案 */
|
||||
export type DraftExpectationSource = 'human_confirmed' | 'fixture' | 'independent_computation'
|
||||
|
||||
/** 验证总情况里的结论(服务端现算):verified 要「有独立期望对得上」且「有覆盖它的认证审阅」 */
|
||||
export type DraftValidationVerdict = 'none' | 'stale' | 'verified' | 'rejected' | 'mismatched' | 'failed' | 'observed' | 'unverified'
|
||||
|
||||
/** 这条记录上最新的一次审阅决定(认证主体、确认范围、所审依据) */
|
||||
export interface DraftValidationReview {
|
||||
id: string
|
||||
draft_id: string
|
||||
record_id: string
|
||||
workflow_id?: string | null
|
||||
decision: 'confirmed' | 'rejected' | string
|
||||
actor?: string | null
|
||||
/** 主体是不是认证过的(关登录时自报的署名是 false) */
|
||||
verified: boolean
|
||||
/** 确认范围:这份记录覆盖的指标,可以只确认其中一个子集 */
|
||||
scope: string[]
|
||||
basis?: Record<string, unknown>
|
||||
note?: string | null
|
||||
created_at?: string | null
|
||||
/** 这条决定还算不算覆盖当前定义/绑定 */
|
||||
covers_current?: boolean | null
|
||||
}
|
||||
|
||||
/** 这次运行交回的某一个指标的实际值:值、形状、行数、遮罩,以及和期望比出来的结果 */
|
||||
export interface DraftValidationActual {
|
||||
value?: unknown
|
||||
status?: string
|
||||
rendered?: string
|
||||
rows?: number | null
|
||||
masked?: boolean
|
||||
truncated?: boolean
|
||||
shape?: string | null
|
||||
shape_ok?: boolean | null
|
||||
/** 引擎记过「业务描述和取数条件的关系还没被证明」:待人工确认的缺口,不改这次比较的结论 */
|
||||
semantic_unverified?: boolean
|
||||
findings?: string[]
|
||||
/** 期望给的、对比的那个原值 */
|
||||
expected?: unknown
|
||||
/** 对得上 / 对不上 / 判不了(null) */
|
||||
ok?: boolean | null
|
||||
}
|
||||
|
||||
/** 这一次试跑对着比的独立期望 */
|
||||
export interface DraftValidationExpected {
|
||||
source: DraftExpectationSource | string
|
||||
metrics: Record<string, unknown>
|
||||
note?: string | null
|
||||
hash?: string
|
||||
}
|
||||
|
||||
/** GET /api/ledger/drafts/{id}/validations 的一条记录(只追加,不改写旧的) */
|
||||
export interface DraftValidationRecord {
|
||||
id: string
|
||||
draft_id: string
|
||||
workflow_id?: string | null
|
||||
version: number
|
||||
card_id: string
|
||||
metric_ids: string[]
|
||||
definition_hash?: string
|
||||
binding_fingerprints?: Record<string, string>
|
||||
semantic_hash?: string
|
||||
execution_hash?: string
|
||||
method: { version: number; note: string }
|
||||
sample: { id: string; version: string }
|
||||
inputs: Record<string, unknown>
|
||||
inputs_hash?: string
|
||||
/** 没有独立期望就是 null:只记 observed,不能算验证通过 */
|
||||
expected: DraftValidationExpected | null
|
||||
actual: Record<string, DraftValidationActual>
|
||||
status: DraftValidationStatus
|
||||
problems: string[]
|
||||
run_id?: string
|
||||
trial_id?: string
|
||||
actor?: string | null
|
||||
/** trial:试跑留下的;late:到终态时补记的 */
|
||||
origin?: string
|
||||
created_at?: string | null
|
||||
/** 还覆不覆盖**当前**定义/绑定(定义、取数或绑定改过就对不上了) */
|
||||
covers_current?: boolean | null
|
||||
review?: DraftValidationReview | null
|
||||
}
|
||||
|
||||
/** 一份草稿的验证总情况;verdict 才是结论 */
|
||||
export interface DraftValidationSummary {
|
||||
verdict: DraftValidationVerdict
|
||||
/** 拿来下结论的那条记录的状态;一条记录都没有时是 none。老服务端可能不给这一段 */
|
||||
status?: DraftValidationStatus | 'none'
|
||||
/** 只有 === true 才算覆盖当前定义/绑定;false 是不覆盖,缺字段是判不了 */
|
||||
covers_current?: boolean | null
|
||||
record_id?: string | null
|
||||
review?: DraftValidationReview | null
|
||||
/** 这次被确认到的指标(确认范围):确认范围要盖住这条记录的全部指标才算整张卡通过 */
|
||||
confirmed?: string[]
|
||||
/** 这条记录覆盖、但还没被确认的指标:非空就不算整张卡通过 */
|
||||
unconfirmed?: string[]
|
||||
/** 逐状态的条数;读数缺字段时按 0 显示,不猜 */
|
||||
counts?: { total?: number; covering?: number } & Record<string, number | undefined>
|
||||
reason: string
|
||||
/** 记录里哪些指标的语义说明仍待人工确认 */
|
||||
semantic_gaps?: string[]
|
||||
method?: { version: number; note: string }
|
||||
}
|
||||
|
||||
/**
|
||||
* 字段基线 B 覆盖到哪一步(K11 的按字段推进):complete 是整张卡每一格都有基线,partial 是还有没基线的格
|
||||
* 或整条没基线的指标,unknown 是读不出来。「有没有基线」看 status,**「整张是不是都有」看这里**,两件事不能混。
|
||||
*/
|
||||
export interface DraftFieldCoverage {
|
||||
status: 'complete' | 'partial' | 'unknown' | string
|
||||
/** 逐条指标覆盖了几格、缺哪些格 */
|
||||
metrics?: Record<string, { covered: number; expected: number; missing: string[] }>
|
||||
/** 整条都没有基线的指标 */
|
||||
uncovered_metric_ids?: string[]
|
||||
}
|
||||
|
||||
/** 字段基线 B 的状态:known 有可还原的接受导入值 / baseline_unknown 没有(不能拿当前内容冒充 B) */
|
||||
export interface DraftFieldBaseline {
|
||||
status: 'known' | 'baseline_unknown' | string
|
||||
reason?: string
|
||||
artifact_id?: string
|
||||
version?: number
|
||||
content_hash?: string
|
||||
card_id?: string
|
||||
workflow_id?: string
|
||||
accepted_revision?: number
|
||||
accepted_at?: string
|
||||
metric_ids?: string[]
|
||||
field_count?: number
|
||||
/** known 不等于完整:按字段推进出来的基线常常只覆盖卡上的一部分 */
|
||||
coverage?: DraftFieldCoverage
|
||||
source_snapshot_artifact_id?: string
|
||||
}
|
||||
|
||||
/** GET /api/ledger/drafts/{id}/validations:记录(新的在前)+ 总情况 + 字段基线状态 */
|
||||
export interface DraftValidationsOut {
|
||||
draft_id: string
|
||||
/** 老服务端可能不给这一段:显示时照实说读不到,不当成「有基线」 */
|
||||
field_baseline?: DraftFieldBaseline
|
||||
records: DraftValidationRecord[]
|
||||
summary: DraftValidationSummary
|
||||
method?: { version: number; note: string }
|
||||
}
|
||||
|
||||
/** PATCH 草稿(operations 那条路)回来的变更回执:改了什么、影响哪些指标、绑定同步到哪一步、旧验证怎么失效 */
|
||||
export interface DraftChangeReceipt {
|
||||
applied: boolean
|
||||
classification: 'definition' | 'display' | 'none' | string
|
||||
card: string
|
||||
metrics: string[]
|
||||
operations: { op: string; metric_id: string; path: string; changed: boolean }[]
|
||||
revision: number | null
|
||||
definition_hash: { before: string; after: string; changed: boolean }
|
||||
validation: { invalidated: boolean; scope: string; metrics: string[]; reason: string; next: string }
|
||||
binding: DraftBinding
|
||||
}
|
||||
|
||||
/** GET /api/ledger/drafts/{id}:payload 摊平在上层(documents / metrics / dropped / open_questions / alignment) */
|
||||
export interface CaliberDraft extends CaliberDraftSummary {
|
||||
job?: { status: string; attempt: number; error?: string | null; retryable: boolean }
|
||||
|
||||
/**
|
||||
* 这份草稿的权威口径卡(K02)。已接管的草稿(有取数图的)才有:图上一张可写的卡时就是它,多张时是下游契约
|
||||
* 声明的那一张;认不出来(多张又没有唯一目标)时是 null,改的时候要显式给 target.card_id
|
||||
*/
|
||||
card_id?: string | null
|
||||
/** 图上能写的口径卡,一张一条;页面上要人挑的时候用它 */
|
||||
cards?: DraftCardRef[]
|
||||
/** 客户端要带回来的基准版本(Workflow.version):PATCH 时当 expected_revision。老草稿没有图时为 null */
|
||||
revision?: number | null
|
||||
/**
|
||||
* K04 的业务绑定能力描述:能按字段改哪些业务定义、允许值、现在的值、定义和取数实现的同步状态。
|
||||
* 已接管的草稿才有;工作台照它决定展示哪些业务修改(逐资产启用)
|
||||
*/
|
||||
binding?: DraftBinding
|
||||
/** K05 的字段基线 B 状态:有可还原的接受导入值 / 无法还原(老草稿) */
|
||||
field_baseline?: DraftFieldBaseline
|
||||
/** K05 的验证总情况:结论、覆盖判断、最新一条、审阅;整条记录走 /validations */
|
||||
validation?: DraftValidationSummary
|
||||
/** 这次 PATCH 走 operations 时的变更回执(改了什么、影响指标、绑定同步到哪一步) */
|
||||
change?: DraftChangeReceipt
|
||||
/** 这一次 PATCH 和上次是同一个 request_id(已经写进去了,没有新增版本) */
|
||||
replayed?: boolean
|
||||
|
||||
documents?: DraftDocument[]
|
||||
metrics?: DraftMetric[]
|
||||
/** 草稿图的入口字段 */
|
||||
@@ -702,3 +1003,160 @@ export interface CaliberDraftAttachOut {
|
||||
/** 对不上已有指标名的那些,由人决定新建还是忽略 */
|
||||
warnings: string[]
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- K11 增量重导入(B / L / R 三方)
|
||||
|
||||
/**
|
||||
* 一格的三方状态(app/ledger/reimport.FIELD_STATES)。**能不能接受由状态定**:
|
||||
* update(无冲突更新)/ conflict(人工改过)/ new(新增候选)/ manual(没有可比基线,要人工对齐)能接受;
|
||||
* missing(这次没提取到)**不能**——漏提取不当删除,L 上的原值原样留着;unchanged 不用接受。
|
||||
*/
|
||||
export type DraftImportFieldState = 'update' | 'conflict' | 'new' | 'missing' | 'manual' | 'unchanged'
|
||||
|
||||
/** 一条候选指标(工作项)的状态:逐字段三方算出来的 + 人处置之后的 */
|
||||
export type DraftImportItemStatus = 'pending' | 'update' | 'conflict' | 'new' | 'manual' | 'unchanged'
|
||||
| 'partial' | 'accepted' | 'rejected' | 'failed'
|
||||
|
||||
/** 一格的三方:b 是上次被接受的导入值、l 是现在图上人工维护的值、r 是这次抽出来的候选 */
|
||||
export interface DraftImportField {
|
||||
path: string
|
||||
state: DraftImportFieldState | string
|
||||
b?: unknown
|
||||
l?: unknown
|
||||
r?: unknown
|
||||
b_present: boolean
|
||||
l_present: boolean
|
||||
r_present: boolean
|
||||
/** 人处置过没有:accepted / rejected / null */
|
||||
decided?: string | null
|
||||
/** 这一格现在能不能接受(和状态一一对应,界面按它禁不禁用按钮) */
|
||||
acceptable: boolean
|
||||
}
|
||||
|
||||
/** 这条候选对上了哪条指标、凭什么(名字像不像不参与,只认稳定身份和来源证据) */
|
||||
export interface DraftImportAlign {
|
||||
metric_id?: string
|
||||
/** metric_id(候选带着稳定身份)/ evidence(按来源证据)/ new(没对上)/ manual(要人指定) */
|
||||
mode?: string
|
||||
reason?: string
|
||||
evidence?: string[]
|
||||
live_evidence?: string[]
|
||||
/** 证据比对取自哪个:baseline(B 的引用)还是 live(当前图的引用) */
|
||||
basis?: string
|
||||
/** mode 是 manual 时,对上的候选有哪几条 */
|
||||
candidates?: string[]
|
||||
manual?: boolean
|
||||
/** 引用指向的段落没进这次提示:不能当出处,记下来 */
|
||||
invisible_citations?: unknown[]
|
||||
}
|
||||
|
||||
/** 一条工作项(一条候选指标):逐字段三方 + 人的处置 */
|
||||
export interface DraftImportItem {
|
||||
item_id: string
|
||||
seq: number
|
||||
/** 对齐到的图上指标;没对齐上时是空串 */
|
||||
metric_id: string
|
||||
/** 候选自己的身份(和图上无关) */
|
||||
candidate_id: string
|
||||
/** 持久对齐键(稳定身份 + 规范化的来源证据):重新抽之后还按它认同一条工作项 */
|
||||
align_key?: string
|
||||
/** 服务端标的「这条抽坏了」(引用一段没有给过模型的原文):它上面一律不能接受 */
|
||||
failed?: boolean
|
||||
name: string
|
||||
status: DraftImportItemStatus | string
|
||||
align: DraftImportAlign
|
||||
error: string
|
||||
accepted: string[]
|
||||
rejected: string[]
|
||||
applied_revision?: number | null
|
||||
fields: DraftImportField[]
|
||||
}
|
||||
|
||||
/** 一次导入里值得单独列出来的格子(冲突 / 要人工对齐 / 漏提取) */
|
||||
export interface DraftImportConflict {
|
||||
metric_id: string
|
||||
item_id: string
|
||||
seq: number
|
||||
name: string
|
||||
path: string
|
||||
state: string
|
||||
b?: unknown
|
||||
l?: unknown
|
||||
r?: unknown
|
||||
}
|
||||
|
||||
/**
|
||||
* 一次增量重导入(GET /api/ledger/drafts/{id}/imports、GET /api/ledger/imports/{run_id})。
|
||||
* **R 只是候选,不改 L**:工作项和冲突是后台抽出来的,真正落到图上的只有「接受选定字段」。
|
||||
*/
|
||||
export interface DraftImportRun {
|
||||
run_id: string
|
||||
draft_id: string
|
||||
workflow_id: string
|
||||
/** queued / running / succeeded / partial / failed / interrupted / cancelled */
|
||||
status: string
|
||||
error: string
|
||||
actor: string
|
||||
request_id: string
|
||||
created_at: string
|
||||
items_total: number
|
||||
items_decided: number
|
||||
source_snapshot?: Record<string, unknown>
|
||||
visible_chunk_ids?: string[]
|
||||
prompt_version?: number
|
||||
parse_version?: number
|
||||
model_id?: string
|
||||
items: DraftImportItem[]
|
||||
conflicts: DraftImportConflict[]
|
||||
}
|
||||
|
||||
/** POST /api/ledger/imports/{run_id}/accept:这一次落到哪一版、是不是重放(B 和 L 在同一次提交里推进) */
|
||||
export interface DraftImportAcceptOut extends DraftImportRun {
|
||||
applied: boolean
|
||||
replayed: boolean
|
||||
revision: number | null
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- K12 受限的自然语言修改(只产出提案)
|
||||
|
||||
/** 必须先问清的澄清项:含糊业务条件(要人指定取值)或没匹配到已声明的能力 */
|
||||
export interface NlChangeClarification {
|
||||
kind: 'ambiguous' | 'no_match' | 'missing' | string
|
||||
field?: string | null
|
||||
question: string
|
||||
options: { value: string; label: string }[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 一句话产出的受限修改提案:K03 同一形状的 operations + 影响摘要(preview)+ 澄清项。
|
||||
* **只读**:不落库、不新增版本;ready 为真才谈得上应用。
|
||||
*/
|
||||
export interface NlChangeProposal {
|
||||
card: string
|
||||
ready: boolean
|
||||
operations: DraftOperation[]
|
||||
metrics: string[]
|
||||
clarifications: NlChangeClarification[]
|
||||
/** changes.summary 的同一份形状(preview 为 true、persisted 为 false);服务端没给就是 null */
|
||||
preview?: (DraftChangeReceipt & { preview?: boolean; persisted?: boolean }) | null
|
||||
/** 模型自报但不作数的键(批准、审阅这类),只是照实记下来 */
|
||||
ignored_claims?: string[]
|
||||
notes?: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/ledger/drafts/{id}/change-proposal(只预览)的回:提案 + 这次没落库(applied / persisted 都是 false)。
|
||||
* POST …/nl-change 的 confirm=true 交回的是**草稿详情**(见 NlChangeOut),不是这个形状。
|
||||
*/
|
||||
export interface NlChangePreviewOut {
|
||||
draft_id: string
|
||||
workflow_id: string
|
||||
revision: number
|
||||
card: string
|
||||
proposal: NlChangeProposal
|
||||
applied?: boolean
|
||||
persisted?: boolean
|
||||
}
|
||||
|
||||
/** POST …/nl-change 的回:confirm=false 是 NlChangePreviewOut;confirm=true 是草稿详情(带这一次的 change 回执) */
|
||||
export type NlChangeOut = NlChangePreviewOut | (CaliberDraft & { replayed?: boolean })
|
||||
|
||||
Reference in New Issue
Block a user