Skip to content

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


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

Class: DelegationFlow ​

Defined in: core/control-flow/dag-delegation-composite.ts:104

委托 ControlFlow:orchestrator 决定委托目标,再依次跑 specialist,最后回到 orchestrator 收尾。

委托列表来自 orchestrator 输出的 metadata.delegations(含 targetUnitId)。 完成标志为 SharedState 键 orchestrator.finalized === true。 也可由 Workflow YAML 的 flow.type: delegation 映射而来。

Implements ​

Constructors ​

Constructor ​

new DelegationFlow(orchestrator, specialists): DelegationFlow

Defined in: core/control-flow/dag-delegation-composite.ts:111

Parameters ​

orchestrator ​

WorkflowUnit

编排 / 收尾 Unit(可多次被调度)

specialists ​

Map<string, WorkflowUnit>

specialist id → Unit(id 需与 targetUnitId 对应)

Returns ​

DelegationFlow

Properties ​

type ​

readonly type: "delegation" = 'delegation'

Defined in: core/control-flow/dag-delegation-composite.ts:105

Flow 类型名。

Implementation of ​

ControlFlow.type

Methods ​

isComplete() ​

isComplete(state): boolean

Defined in: core/control-flow/dag-delegation-composite.ts:171

Parameters ​

state ​

SharedState

当前 SharedState

Returns ​

boolean

orchestrator.finalized 是否为 true

Implementation of ​

ControlFlow.isComplete


next() ​

next(state, completedUnits?): WorkflowUnit[]

Defined in: core/control-flow/dag-delegation-composite.ts:126

按 phase 调度:orchestrating → executing(队列中的 specialist)→ finalizing(再跑 orchestrator)。

Parameters ​

state ​

SharedState

当前 SharedState(可读 orchestrator.finalized)

completedUnits? ​

Set<string>

引擎侧已完成 Unit id 集合

Returns ​

WorkflowUnit[]

下一轮要执行的 Unit 列表(0 或 1 个)

Implementation of ​

ControlFlow.next


onOrchestratorOutput() ​

onOrchestratorOutput(output): void

Defined in: core/control-flow/dag-delegation-composite.ts:159

由引擎在 orchestrator 产出后调用:解析 metadata.delegations 并进入 executing。

Parameters ​

output ​

AgentOutput

orchestrator 的 AgentOutput

Returns ​

void


restore() ​

restore(cursor): void

Defined in: core/control-flow/dag-delegation-composite.ts:186

Parameters ​

cursor ​

ControlFlowCursor

先前 serialize() 的结果

Returns ​

void

Implementation of ​

ControlFlow.restore


serialize() ​

serialize(): ControlFlowCursor

Defined in: core/control-flow/dag-delegation-composite.ts:176

Returns ​

ControlFlowCursor

可写入检查点的游标(含 delegationQueue / phase)

Implementation of ​

ControlFlow.serialize

MIT Licensed