Archived
终态封卷的蒸馏钩子原先「模型不可用就整次返回空」,活动记忆一条也留不下。
按「结构化部分零 LLM,叙述是视图不是事实」拆成两段:
· 先落**确定性骨架**:这一单确实发生了什么 —— 终态、几步转了人兜底、
放行被驳回几次 —— 全写在归侧条目里,不需要模型来讲。每条带证据链。
· 模型可用时在其上补模式层 / 裁决层的归纳;归纳不出来也不丢掉整次蒸馏。
实测(A1 一单):3 条 fact 候选,各带证据链。
至此 MVP 十条判据:① ② ③ ⑥ ⑦ ⑧ ⑨ ⑩ 在真实系统上端到端跑通;
④ ⑤ 的 loop 机制(CMMN 装载 / Enabled 集 / 断点判定 / 回路调人)跑通,
余下部分受限于 LLM 端点 —— loop 的 Agent 每一轮决断都要模型。
gates: tsc / eslint / depcruise(317 模块)/ api-report / 402 测试 全绿
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
43 lines
2.0 KiB
TypeScript
43 lines
2.0 KiB
TypeScript
/**
|
|
* module: flow-engine —— 对外类型(编码规范 §10.1;语义出处 AM 05)。
|
|
*
|
|
* flow 范式:步序声明运行器(四种步型、重试与兜底、事件即步条件)。
|
|
* **零临场调度** —— 运行中不得由 LLM 决定步序、跳步或兜底。
|
|
*/
|
|
import type { FlowModel, FlowStep, TaskId } from '@contracts';
|
|
import type { FailureAction, FlowIssue, FlowPosition, NextAction, StepRuntime, StepState } from './internal/domain/step-sequence.ts';
|
|
export type { FailureAction, FlowIssue, FlowModel, FlowPosition, FlowStep, NextAction, StepRuntime, StepState };
|
|
export declare class FlowDeclarationInvalidError extends Error {
|
|
readonly issues: readonly FlowIssue[];
|
|
constructor(issues: readonly FlowIssue[]);
|
|
}
|
|
/** 一次推进的结果 —— 由 task 驱动,不自转 */
|
|
export type AdvanceOutcome = {
|
|
readonly position: FlowPosition;
|
|
readonly status: 'running' | 'awaiting' | 'finished' | 'blocked';
|
|
/** awaiting 时:在等什么 */
|
|
readonly waitingFor?: {
|
|
readonly kind: 'human' | 'event' | 'time';
|
|
readonly ref: string;
|
|
readonly deadline: string;
|
|
};
|
|
/** finished 时:末步验收工单的裁决决定终态 */
|
|
readonly released?: boolean;
|
|
/** 选择组的出口选择:恰发一口,随放行一并确认 */
|
|
readonly selectedPorts?: Record<string, string>;
|
|
readonly blockedReason?: string;
|
|
};
|
|
export type FlowEngineService = {
|
|
/** 装载步序声明并校验 —— 谱必须全程可静态检查 */
|
|
load(taskId: TaskId, model: FlowModel): Promise<FlowPosition>;
|
|
position(taskId: TaskId): Promise<FlowPosition | undefined>;
|
|
/** 推进一步(或若干确定步);异步步进入 awaiting 并登记监听 */
|
|
advance(taskId: TaskId): Promise<AdvanceOutcome>;
|
|
/** 事件即步的完成条件:人事件 / 数据事件 / 时间事件到达即续跑 */
|
|
resume(taskId: TaskId, event: {
|
|
kind: 'human' | 'data' | 'time';
|
|
ref: string;
|
|
payload: Record<string, unknown>;
|
|
}): Promise<AdvanceOutcome>;
|
|
};
|