23 lines
1.0 KiB
TypeScript
23 lines
1.0 KiB
TypeScript
/**
|
||
* 客户端与服务端共享的契约(架构设计第 2 节)。
|
||
*
|
||
* 只放类型与模式定义,不引入运行时依赖:这一层被所有包依赖,任何依赖都会变成全局耦合。
|
||
* 引擎差异不在这里体现——引擎事件经适配层转成下面的平台事件,界面对引擎无感。
|
||
*/
|
||
|
||
/** 能力标识,形如 `aps.schedule.preview`。命名与描述规范见 docs/spec/capability-description.md */
|
||
export type CapabilityId = string;
|
||
|
||
/** 执行回执:所有能力调用的统一返回(架构设计 4.2) */
|
||
export interface ExecutionReceipt {
|
||
executionId: string;
|
||
status: 'accepted' | 'succeeded' | 'failed' | 'pending-confirmation';
|
||
result?: unknown;
|
||
errorKind?: string;
|
||
}
|
||
|
||
/** 平台事件:唯一面向客户端的事件形态(实施设计 1.7 定义事件模型) */
|
||
export type PlatformEvent =
|
||
| { type: 'message.delta'; sessionId: string; text: string }
|
||
| { type: 'tool.call'; sessionId: string; capabilityId: CapabilityId }
|
||
| { type: 'receipt'; sessionId: string; receipt: ExecutionReceipt }; |