/** * 统一事件标准(编码规范 §8.1;语义出处 OS 06)。 * * 系统向活动只以统一信封抛四类事件;一条事件流,三级消费(任务监听 / 触发器 / 消息)。 * 投递五诺(先持久后投递 / 同任务按序 / 至少一次 + 幂等 / 处理有回执 / 扇出与幂等) * 是 `event` 模块的实现承诺,不在本文件表达 —— 本文件只定信封的形状。 */ import { z } from 'zod'; export declare const EVENT_TYPES: readonly ["data", "time", "human", "control"]; export declare const eventTypeSchema: z.ZodEnum<{ human: "human"; data: "data"; time: "time"; control: "control"; }>; export type EventType = z.infer; export declare const EVENT_TYPE_LABEL: Readonly>; /** 消费目标四类(OS 6.1):任务 / 触发器 / 工作流 / 消息收件岗位 */ export declare const eventTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"task">; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"trigger">; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"workflow">; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"message-position">; id: z.core.$ZodBranded; }, z.core.$strip>], "kind">; export type EventTarget = z.infer; /** 起因:数据对象 / 卡 ID / 定时器 ID —— 「这条事件是被什么激起的」 */ export declare const eventCauseSchema: z.ZodObject<{ kind: z.ZodEnum<{ "ledger-write": "ledger-write"; "card-reply": "card-reply"; timer: "timer"; inbound: "inbound"; governance: "governance"; engine: "engine"; }>; ref: z.ZodString; }, z.core.$strip>; export type EventCause = z.infer; export declare const EVENT_SOURCES: readonly ["channel", "engine", "desk", "governance"]; export declare const eventSourceKindSchema: z.ZodEnum<{ governance: "governance"; engine: "engine"; channel: "channel"; desk: "desk"; }>; export type EventSourceKind = z.infer; export declare const eventSourceSchema: z.ZodObject<{ kind: z.ZodEnum<{ governance: "governance"; engine: "engine"; channel: "channel"; desk: "desk"; }>; channelId: z.ZodOptional>; detail: z.ZodOptional; }, z.core.$strip>; export type EventSource = z.infer; /** 载荷:schema 化内容 + 原件指针(如邮件原文的存档地址) */ export declare const eventPayloadSchema: z.ZodObject<{ data: z.ZodRecord; originRef: z.ZodOptional; }, z.core.$strip>; export type EventPayload = z.infer; export declare const envelopeSchema: z.ZodObject<{ id: z.core.$ZodBranded; type: z.ZodEnum<{ human: "human"; data: "data"; time: "time"; control: "control"; }>; correlation: z.ZodObject<{ target: z.ZodOptional; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"trigger">; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"workflow">; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"message-position">; id: z.core.$ZodBranded; }, z.core.$strip>], "kind">>; cause: z.ZodObject<{ kind: z.ZodEnum<{ "ledger-write": "ledger-write"; "card-reply": "card-reply"; timer: "timer"; inbound: "inbound"; governance: "governance"; engine: "engine"; }>; ref: z.ZodString; }, z.core.$strip>; keys: z.ZodDefault>; }, z.core.$strip>; payload: z.ZodObject<{ data: z.ZodRecord; originRef: z.ZodOptional; }, z.core.$strip>; occurredAt: z.ZodISODateTime; source: z.ZodObject<{ kind: z.ZodEnum<{ governance: "governance"; engine: "engine"; channel: "channel"; desk: "desk"; }>; channelId: z.ZodOptional>; detail: z.ZodOptional; }, z.core.$strip>; trace: z.ZodObject<{ storeRef: z.ZodString; taskMemoryRef: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; export type Envelope = z.infer; /** * 尚未落存储的信封草稿 —— `publish` 的入参。 * * `target` 在此**可空**:原始事件未必知道自己该被谁消费。归属解析(6.2)与三级消费判定 * (任务监听 / 触发器 / 消息兜底,6.3)由 `event` 模块完成,并为每个命中目标生成一份 * 独立投递 —— 投递出去的信封「关联 = 单目标」,这正是扇出与幂等承诺的形态。 * `storeRef` 由 event adapter 落库时补。 */ export declare const envelopeDraftSchema: z.ZodObject<{ type: z.ZodEnum<{ human: "human"; data: "data"; time: "time"; control: "control"; }>; payload: z.ZodObject<{ data: z.ZodRecord; originRef: z.ZodOptional; }, z.core.$strip>; source: z.ZodObject<{ kind: z.ZodEnum<{ governance: "governance"; engine: "engine"; channel: "channel"; desk: "desk"; }>; channelId: z.ZodOptional>; detail: z.ZodOptional; }, z.core.$strip>; correlation: z.ZodObject<{ target: z.ZodOptional; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"trigger">; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"workflow">; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"message-position">; id: z.core.$ZodBranded; }, z.core.$strip>], "kind">>; cause: z.ZodObject<{ kind: z.ZodEnum<{ "ledger-write": "ledger-write"; "card-reply": "card-reply"; timer: "timer"; inbound: "inbound"; governance: "governance"; engine: "engine"; }>; ref: z.ZodString; }, z.core.$strip>; keys: z.ZodDefault>; }, z.core.$strip>; occurredAt: z.ZodISODateTime; id: z.ZodOptional>; }, z.core.$strip>; export type EnvelopeDraft = z.infer; /** 控制事件载荷:三语义 + 发起人 */ export declare const controlPayloadSchema: z.ZodObject<{ semantic: z.ZodEnum<{ pause: "pause"; halt: "halt"; terminate: "terminate"; }>; reason: z.ZodOptional; issuedBy: z.ZodString; }, z.core.$strip>; export type ControlPayload = z.infer; /** 时间事件载荷:哪个监听 / 定时器到点 */ export declare const timePayloadSchema: z.ZodObject<{ listenerId: z.ZodOptional>; timerRef: z.ZodString; escalation: z.ZodOptional>; }, z.core.$strip>; export type TimePayload = z.infer; /** 数据事件载荷:域.对象.主键 的正式版写入 —— 草稿写不抛事件(OS 09) */ export declare const dataPayloadSchema: z.ZodObject<{ domain: z.ZodString; object: z.ZodString; primaryKey: z.ZodRecord>; changed: z.ZodDefault>; operation: z.ZodEnum<{ insert: "insert"; update: "update"; delete: "delete"; }>; }, z.core.$strip>; export type DataPayload = z.infer; /** * 处理语义:loop 事件即观察 / flow 事件即步的完成条件。 * 这是**引擎层**的区分,交互层不可见(编码规范 §9 双层边界)。 */ export declare const LISTENER_SEMANTICS: readonly ["observe", "complete-step"]; export declare const listenerSemanticSchema: z.ZodEnum<{ observe: "observe"; "complete-step": "complete-step"; }>; export type ListenerSemantic = z.infer; export declare const listenerSpecSchema: z.ZodObject<{ origin: z.ZodEnum<{ static: "static"; dynamic: "dynamic"; }>; eventType: z.ZodEnum<{ human: "human"; data: "data"; time: "time"; control: "control"; }>; keyFilter: z.ZodDefault>; condition: z.ZodOptional; semantic: z.ZodEnum<{ observe: "observe"; "complete-step": "complete-step"; }>; deadline: z.ZodString; escalation: z.ZodDefault>>; }, z.core.$strip>; export type ListenerSpec = z.infer; export declare const registeredListenerSchema: z.ZodObject<{ origin: z.ZodEnum<{ static: "static"; dynamic: "dynamic"; }>; eventType: z.ZodEnum<{ human: "human"; data: "data"; time: "time"; control: "control"; }>; keyFilter: z.ZodDefault>; condition: z.ZodOptional; semantic: z.ZodEnum<{ observe: "observe"; "complete-step": "complete-step"; }>; deadline: z.ZodString; escalation: z.ZodDefault>>; id: z.core.$ZodBranded; taskId: z.core.$ZodBranded; registeredAt: z.ZodISODateTime; expiresAt: z.ZodISODateTime; state: z.ZodEnum<{ armed: "armed"; fired: "fired"; expired: "expired"; cancelled: "cancelled"; }>; }, z.core.$strip>; export type RegisteredListener = z.infer; export declare const deliverySchema: z.ZodObject<{ id: z.core.$ZodBranded; eventId: z.core.$ZodBranded; target: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"task">; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"trigger">; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"workflow">; id: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"message-position">; id: z.core.$ZodBranded; }, z.core.$strip>], "kind">; attempt: z.ZodNumber; state: z.ZodEnum<{ pending: "pending"; delivered: "delivered"; failed: "failed"; "dead-letter": "dead-letter"; }>; lastError: z.ZodOptional; }, z.core.$strip>; export type Delivery = z.infer; /** 匹配次序确定、逐级短路:① 线程精确 ② 关联键命中监听 ③ 地址 + 时间窗 */ export declare const OWNERSHIP_RULES: readonly ["thread", "listener-key", "address-window"]; export declare const ownershipRuleSchema: z.ZodEnum<{ thread: "thread"; "listener-key": "listener-key"; "address-window": "address-window"; }>; export type OwnershipRule = z.infer; export declare const ownershipResolutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ outcome: z.ZodLiteral<"owned">; rule: z.ZodEnum<{ thread: "thread"; "listener-key": "listener-key"; "address-window": "address-window"; }>; taskId: z.core.$ZodBranded; }, z.core.$strip>, z.ZodObject<{ outcome: z.ZodLiteral<"unowned">; reason: z.ZodEnum<{ "no-match": "no-match"; ambiguous: "ambiguous"; "extract-failed": "extract-failed"; }>; fallbackPosition: z.ZodOptional>; }, z.core.$strip>], "outcome">; export type OwnershipResolution = z.infer;