判据 ③ 现在从入站到 released 一路走通:步序推进 → LLM 步(密钥是占位符,
按声明降级为人兜底)→ 台账草稿层 → D1 条件跳步 → S4 工具 → S5 DMN 三分类
(LM358DR → Type A · 直接快答)→ 验收放行 → 草稿合并正式版 2 行 → 输出口
intake 发射 → 终态 released。
沿路修掉的六处,每一处都是「声明是这么写的,引擎不这么读」:
1. 人兜底卡只问一个笼统「结果」框 → 改问**这一步声明的出参字段**。
出参契约属于步、不属于执行者:同一步谁做完,落进作用域的形状都得一样。
2. 人事件的载荷是回传协议壳 `{mode,workOrderId,values}`,
引擎把整个壳当出参写 → 取 `values`。
3. 引擎作用域是 `{'域.对象': 行数组}`,而所有活动的步声明写的都是裸字段名 →
任务视图三层铺开:起单入参在底、各对象最新行的字段铺顶层、地址式整表保留。
4. 起单入参从不落库、也进不了作用域 → task 存 `input_data`,断点续跑后仍在。
5. 步出参无法声明**写哪一行** → 出参加 `key`(主键列 → 作用域路径);
六个活动包的每处出参补上键。台账几乎都有主键,不声明键就只能写无主键行。
6. `tick` 不处理 `finished`:谱走完仍按 running 一拍拍推,把预算烧到 exhausted,
把「没人裁」误报成「跑爆了」→ 放行通过则落地收敛后 released;未放行则挂起等人。
`flow.advance` 据末步验收裁决报 released —— **完成只出自放行通过**。
另两处装配缺口:
· `release.land()` 实现完整却无人调用 —— 放行后从不落地。经 LandingGateway 接上。
· `process.onTaskTerminal()` 实现完整却无人调用 —— 任务终态报不到流程层,
流就停在那个节点上,既不流转也不走失败走向。task 在 L6 不得反向依赖 L7,
这一跳由 app 缝合(延后绑定,同 container 里 TriggerMatcher 的手法)。
还有一处版本化缺陷:资产播种恒用 v1,`shouldSeedAsset` 一比就跳过 ——
只有**第一个**包版本的资产此生有效,之后装什么都跑旧的。改为播下一版;
进化管线放行出的更高版仍不被盖过;同版重复安装不再播种。
gates: tsc / eslint / depcruise(317 模块)/ api-report / 393 测试 全绿
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
65 lines
2.5 KiB
TypeScript
65 lines
2.5 KiB
TypeScript
/**
|
|
* module: activity-registry —— 本模块要外界提供的能力(编码规范 §10.1 / §5.3)。
|
|
*/
|
|
import type { ActivityManifest } from '@contracts';
|
|
import type { AssetKind, AssetVersion, IncrementState, PackageVersion, ReplayVerdict } from './internal/domain/versioning.ts';
|
|
|
|
export type Clock = { now(): Date };
|
|
export type IdGenerator = { next(): string };
|
|
|
|
export type RegistryStore = {
|
|
/** 返回是否新增了这一包版本(同版重复安装返回 false) */
|
|
savePackage(manifest: ActivityManifest, artifact: string): Promise<boolean>;
|
|
listPackages(activityId?: string): Promise<PackageVersion[]>;
|
|
manifest(activityId: string, packageVersion?: string): Promise<ActivityManifest | undefined>;
|
|
artifact(activityId: string, packageVersion: string): Promise<string | undefined>;
|
|
setEnabled(activityId: string, enabled: boolean): Promise<void>;
|
|
setState(activityId: string, version: string, state: PackageVersion['state']): Promise<void>;
|
|
enabledOf(activityId: string): Promise<boolean>;
|
|
|
|
listAssets(activityId: string): Promise<AssetVersion[]>;
|
|
saveAsset(asset: AssetVersion, body: string): Promise<void>;
|
|
setAssetEffective(activityId: string, kind: AssetKind, version: number): Promise<void>;
|
|
|
|
saveIncrement(input: {
|
|
id: string;
|
|
activityId: string;
|
|
kind: AssetKind;
|
|
diff: string;
|
|
evidenceEntryIds: readonly string[];
|
|
state: IncrementState;
|
|
createdAt: Date;
|
|
}): Promise<void>;
|
|
getIncrement(id: string): Promise<
|
|
| {
|
|
id: string;
|
|
activityId: string;
|
|
kind: AssetKind;
|
|
diff: string;
|
|
state: IncrementState;
|
|
}
|
|
| undefined
|
|
>;
|
|
setIncrementState(id: string, state: IncrementState, report?: ReplayVerdict, by?: string): Promise<void>;
|
|
};
|
|
|
|
/** 工具契约核对 —— app 注入 `toolbox`(L2):装不齐不上架 */
|
|
export type ToolContractProbe = {
|
|
assertContractsAvailable(names: readonly string[]): Promise<{ ok: boolean; missing: string[] }>;
|
|
};
|
|
|
|
/** 模型名核对 —— app 注入 `llm`(L1) */
|
|
export type ModelBindingProbe = {
|
|
assertNamesBound(names: readonly string[]): Promise<{ ok: boolean; missing: string[] }>;
|
|
};
|
|
|
|
/** 台账声明合并 —— app 注入 `ledger`(L1):安装时依声明自生长 */
|
|
export type LedgerDeclarationApplier = {
|
|
applyDeclarations(
|
|
declarations: ActivityManifest['declarations']['ledger'],
|
|
): Promise<Array<{ applied: boolean; conflicts: ReadonlyArray<{ field: string; message: string }> }>>;
|
|
};
|
|
|
|
/** 模版净化门 —— app 注入 `interaction`(L3) */
|
|
export type TemplateGuard = { isSafe(html: string): boolean };
|