Archived
M3(2/5): human-tool 与 release —— 卡协议与放行门
human-tool(L3): - 三规矩机检:调用必附上下文(裸调用拒发)/ 回传即留痕 / 完成只出自放行通过 - 工单两模式 + 对话卡族的形态校验与回传校验;驳回必附意见;补全卡「没法填」旁路; 决策卡自定义收尾项必附理由;已答不得再答(只增不改) - 到达面两路(负责人 → 任务对话流;他人 → 系统消息);驳回重答 = 新卡实例、原卡闭合 - 调人预算由基座在环外强制;落地失败卡 = 执行工单的 preset release(L4): - 落地预检五项(入参 schema / 工具可用与授权 / 连接可达 / 目标预校验 / 数据冲突) - 预检全过才发验收工单,卡面即已验证的动作清单;不过即打回环内,不发卡 - 放行写合并 + 幂等落地(任务 × 意向);落地收敛才发射输出口; 受阻走落地失败卡且 emittedPorts 恒空;已成动作留存不回滚 215 个测试通过,门禁五道全绿 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
co-authored by
Claude Opus 5
parent
146e9bbfad
commit
561a2474ae
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* module: release —— 对外类型(编码规范 §10.1)。
|
||||
*
|
||||
* 放行门:草稿态 → 事实态的**唯一通道**。门归系统,启门归人(OS 10)。
|
||||
*/
|
||||
import type { ActionIntent, StaffId, TaskId } from '@contracts';
|
||||
import type {
|
||||
CriterionCheck,
|
||||
DeliverableCheck,
|
||||
LandingOutcome,
|
||||
LandingVerdict,
|
||||
PrecheckFinding,
|
||||
PrecheckItem,
|
||||
PrecheckReport,
|
||||
} from './internal/domain/precheck.ts';
|
||||
|
||||
export type {
|
||||
ActionIntent,
|
||||
CriterionCheck,
|
||||
DeliverableCheck,
|
||||
LandingOutcome,
|
||||
LandingVerdict,
|
||||
PrecheckFinding,
|
||||
PrecheckItem,
|
||||
PrecheckReport,
|
||||
};
|
||||
|
||||
export class PrecheckFailedError extends Error {
|
||||
constructor(readonly report: PrecheckReport) {
|
||||
super(`落地预检未过,不发放行卡:${report.findings.map((f) => f.message).join('; ')}`);
|
||||
this.name = 'PrecheckFailedError';
|
||||
}
|
||||
}
|
||||
|
||||
export class DeliverablesMissingError extends Error {
|
||||
constructor(readonly missing: readonly DeliverableCheck[]) {
|
||||
super(`必交付物缺一不得提交放行:${missing.map((d) => d.label).join('、')}`);
|
||||
this.name = 'DeliverablesMissingError';
|
||||
}
|
||||
}
|
||||
|
||||
export type SubmitForReleaseInput = {
|
||||
readonly taskId: TaskId;
|
||||
readonly ownerId: StaffId;
|
||||
readonly humanCallCap: number;
|
||||
readonly deliverableId: string;
|
||||
readonly title: string;
|
||||
readonly basis: ReadonlyArray<{ k: string; v: string }>;
|
||||
readonly deliverables: readonly DeliverableCheck[];
|
||||
readonly criteria: readonly CriterionCheck[];
|
||||
/** 报告可修订:AI 拟值已填的表单字段 */
|
||||
readonly fields?: ReadonlyArray<Record<string, unknown>>;
|
||||
};
|
||||
|
||||
export type SubmitOutcome = {
|
||||
readonly report: PrecheckReport;
|
||||
/** 预检全过才发卡;这里是发出的验收工单 ID */
|
||||
readonly workOrderId: string;
|
||||
};
|
||||
|
||||
export type LandInput = {
|
||||
readonly taskId: TaskId;
|
||||
readonly ownerId: StaffId;
|
||||
readonly humanCallCap: number;
|
||||
readonly selectedPorts: Readonly<Record<string, string>>;
|
||||
};
|
||||
|
||||
export type LandOutcome = {
|
||||
readonly verdict: LandingVerdict;
|
||||
/** 落地收敛后才发射的输出口 */
|
||||
readonly emittedPorts: readonly string[];
|
||||
readonly ledgerRowsMerged: number;
|
||||
/** 落地受阻时发出的落地失败卡 */
|
||||
readonly failureWorkOrderId?: string;
|
||||
};
|
||||
|
||||
export type ReleaseService = {
|
||||
/** 登记写类动作意向(入参冻结,存入草稿态) */
|
||||
registerIntent(taskId: TaskId, intent: Omit<ActionIntent, 'taskId' | 'state'>): Promise<ActionIntent>;
|
||||
listIntents(taskId: TaskId): Promise<ActionIntent[]>;
|
||||
|
||||
/** 预检 → 全过才发验收工单;不过即抛 `PrecheckFailedError`,打回环内修正 */
|
||||
submitForRelease(input: SubmitForReleaseInput): Promise<SubmitOutcome>;
|
||||
/** 只跑预检不发卡 —— 环内随时可看「还差什么」 */
|
||||
precheck(taskId: TaskId): Promise<PrecheckReport>;
|
||||
|
||||
/** 放行通过即刻落地:草稿合并 + 动作执行(附幂等键)→ 收敛才发射输出口 */
|
||||
land(input: LandInput): Promise<LandOutcome>;
|
||||
};
|
||||
Reference in New Issue
Block a user