Skip to content

uni-flow 公开 API(中文注解)


uni-flow 公开 API(中文注解) / MessageBus

Interface: MessageBus

Defined in: core/types.ts:154

工作流消息总线:发布、订阅与历史查询。

Properties

deliveryGuarantee

readonly deliveryGuarantee: "at-least-once" | "exactly-once"

Defined in: core/types.ts:164

投递保证语义。

Methods

history()

history(filter?): WorkflowMessage[]

Defined in: core/types.ts:162

查询历史消息。

Parameters

filter?

Partial<{ since: number; sourceUnitId: string; targetUnitId: string; type: "delegation" | "unit-output" | "steering" | "followup" | "broadcast" | "state-update" | "checkpoint" | "policy-violation" | "hitl-request" | "hitl-response" | "cost-update"; until: number; }>

Returns

WorkflowMessage[]


publish()

publish(message): void

Defined in: core/types.ts:156

异步派发消息(不阻塞调用方等待 handler)。

Parameters

message

WorkflowMessage

Returns

void


publishSync()

publishSync(message): Promise<void>

Defined in: core/types.ts:158

同步等待所有匹配 handler 完成。

Parameters

message

WorkflowMessage

Returns

Promise<void>


subscribe()

subscribe(filter, handler): Unsubscribe

Defined in: core/types.ts:160

按过滤条件订阅;返回取消函数。

Parameters

filter

MessageFilter

handler

MessageHandler

Returns

Unsubscribe

MIT Licensed