/** * 契约七件(编码规范 §8.1;语义出处 OS 4.1,AM 01)。 * * 契约是活动对调用方暴露的全部真相,也是对 Agent 机制的全部授权; * 两种范式同一契约格式 —— 这是「统一套执行契约」的锚点。 * 契约必须在活动启动前冻结;运行中不得变更 —— 变更即新版本。 * * ADR-003:**声明层 = JSON Schema 2020-12 子集**(活动声明是运行时数据,可 diff 可版本), * 代码层 = zod。本文件用 zod 描述「声明的形状」,声明里的 schema 字段本身是 JSON Schema。 */ import { z } from 'zod'; /** JSON Schema 2020-12 子集的运行时形态 —— 由 ajv 校验,不在编译期展开 */ export declare const jsonSchemaSchema: z.ZodRecord; export type JsonSchema = z.infer; export declare const contractInputSchema: z.ZodObject<{ data: z.ZodRecord; messageAllowed: z.ZodDefault; messageHint: z.ZodOptional; }, z.core.$strip>; export type ContractInput = z.infer; export declare const outputPortSchema: z.ZodObject<{ name: z.ZodString; payload: z.ZodRecord; description: z.ZodOptional; }, z.core.$strip>; export type OutputPort = z.infer; export declare const outputPortsSchema: z.ZodObject<{ mandatory: z.ZodDefault; description: z.ZodOptional; }, z.core.$strip>>>; selective: z.ZodDefault; description: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>>; }, z.core.$strip>; export type OutputPorts = z.infer; export declare const requiredDeliverableSchema: z.ZodObject<{ key: z.ZodString; label: z.ZodString; schema: z.ZodOptional>; }, z.core.$strip>; export type RequiredDeliverable = z.infer; export declare const acceptanceCriterionSchema: z.ZodObject<{ key: z.ZodString; label: z.ZodString; level: z.ZodEnum<{ L1: "L1"; L2: "L2"; L3: "L3"; L4: "L4"; L5: "L5"; }>; predicate: z.ZodOptional; modelRef: z.ZodOptional; }, z.core.$strip>; export type AcceptanceCriterion = z.infer; export declare const prohibitionSchema: z.ZodObject<{ key: z.ZodString; statement: z.ZodString; }, z.core.$strip>; export type Prohibition = z.infer; export declare const authorizationBoundarySchema: z.ZodObject<{ discretion: z.ZodDefault>>; preauthorizedActions: z.ZodDefault; }, z.core.$strip>>>; humanCallBudget: z.ZodNumber; }, z.core.$strip>; export type AuthorizationBoundary = z.infer; /** 预算四类上限 —— 由基座在环外强制,不得由活动代码自查自守(AM 10.1) */ export declare const budgetCapsSchema: z.ZodObject<{ steps: z.ZodNumber; tokens: z.ZodNumber; activeMinutes: z.ZodNumber; humanCalls: z.ZodNumber; }, z.core.$strip>; export type BudgetCaps = z.infer; export declare const resourceDeclarationSchema: z.ZodObject<{ tools: z.ZodDefault; }, z.core.$strip>>>; skills: z.ZodDefault>>; models: z.ZodDefault>; roles: z.ZodDefault>; budget: z.ZodObject<{ steps: z.ZodNumber; tokens: z.ZodNumber; activeMinutes: z.ZodNumber; humanCalls: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>; export type ResourceDeclaration = z.infer; export declare const sevenPartContractSchema: z.ZodObject<{ activityId: z.core.$ZodBranded; version: z.ZodString; input: z.ZodObject<{ data: z.ZodRecord; messageAllowed: z.ZodDefault; messageHint: z.ZodOptional; }, z.core.$strip>; output: z.ZodObject<{ mandatory: z.ZodDefault; description: z.ZodOptional; }, z.core.$strip>>>; selective: z.ZodDefault; description: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>>; }, z.core.$strip>; requiredDeliverables: z.ZodDefault>; }, z.core.$strip>>>; acceptanceCriteria: z.ZodDefault; predicate: z.ZodOptional; modelRef: z.ZodOptional; }, z.core.$strip>>>; prohibitions: z.ZodDefault>>; authorization: z.ZodObject<{ discretion: z.ZodDefault>>; preauthorizedActions: z.ZodDefault; }, z.core.$strip>>>; humanCallBudget: z.ZodNumber; }, z.core.$strip>; resources: z.ZodObject<{ tools: z.ZodDefault; }, z.core.$strip>>>; skills: z.ZodDefault>>; models: z.ZodDefault>; roles: z.ZodDefault>; budget: z.ZodObject<{ steps: z.ZodNumber; tokens: z.ZodNumber; activeMinutes: z.ZodNumber; humanCalls: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>; export type SevenPartContract = z.infer; /** * 完成时的发射集合 = 全部必发口 + 每个选择组各一口(AM 1.2)。 * 纯函数,前后端同源:前端预演、后端裁决。 */ export declare function emissionPortNames(ports: OutputPorts, selected: Readonly>): string[]; /** 选择组必须恰选一口 —— 未选或选了组外的口即非法 */ export declare function validateSelection(ports: OutputPorts, selected: Readonly>): string[]; /** 验收等级不得谎报:L4 不得标注为 L1–L3;生成者不得自评(AM 12.1) */ export declare function machineCheckable(criterion: AcceptanceCriterion): boolean;