feat(contracts): auto 配方契约 —— 确定的活由引擎按声明做,五个动词四种地址

配方是数据不是代码(ADR-004:不执行包代码即知包为何物),装进来可静态审、可回放。
只声明真实现了的那几式;嵌套两层封顶,没实现的形状 zod 当场拒。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LKMZDwMbyKzjw6Hembwvet
This commit is contained in:
xcs
2026-08-29 03:04:56 +08:00
co-authored by Claude Opus 5
parent 04234d2fda
commit 16fe8ba71b
9 changed files with 385 additions and 0 deletions
+9
View File
@@ -7,6 +7,7 @@
*/
import { z } from 'zod';
import { activityIdSchema, skillIdSchema } from './id.ts';
import { autoRecipeSchema } from './auto-recipe.ts';
import { jsonSchemaSchema, sevenPartContractSchema } from './contract7.ts';
import { listenerSpecSchema } from './envelope.ts';
import { objectDeclarationSchema } from './ledger.ts';
@@ -191,6 +192,14 @@ export const planStepSchema = z.object({
*/
/* 可选:老活动一个字都不用改(`writes`/`reads` 用 default([]) 是历史,这里不跟 —— 加默认值会逼六个包全改) */
humanWrites: z.array(z.string()).optional(),
/**
* **这一步系统按声明自己做**(2026-08-29,ADR-014 / spec §5)。
*
* 引擎在这一步的每一拍拍首跑配方:发了卡就收拍(零 token);没发卡且这一步没有 `guide`
* 就重求 `doneWhen` 收步;有 `guide` 的照常问模型(半 auto)。
* **老活动一个字不用改** —— 不写就是不写,不是缺件。
*/
auto: autoRecipeSchema.optional(),
});
export type PlanStep = z.infer<typeof planStepSchema>;