Documentation
¶
Overview ¶
Package orchestrator 是 conduct 的解释器内核:把一份 workflow 定义展开成确定性步骤, 逐步驱动 AI 引擎执行,串联上游产物与评测反馈,并把运行记录落盘。
移植自 Python 原型 paw_workflow.py:run_workflow(其祖本是 x-one-web 的 TS orchestrator)。 呈现(人类进度 / --json 事件)经 Observer 外置,内核只管编排与落盘。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Observer ¶
type Observer interface {
// OnExpand 报告展开后的总步数与清单;startIndex 为本次实际开跑的起始下标(Run 恒为 0,Resume 为
// trace 推断出的重入点),供人类进度区分「整趟展开」与「从中断处恢复、共剩几步」,避免把 resume
// 误显为整趟 N 步。
OnExpand(steps []workflow.ExecutionStep, startIndex int)
OnStepStart(info StepInfo) // 某步开跑前
OnStepDone(entry run.TraceEntry) // 某步落定(成功或失败),trace 已落盘
}
Observer 接收编排过程中的事件,由调用方(CLI)装成人类进度或 --json 逐步事件。
type Orchestrator ¶
type Orchestrator struct {
Store *store.Store
Engines func(name string) (engine.Engine, error)
Now func() time.Time
}
Orchestrator 编排一次运行。Engines / Now 可注入以便测试(默认解析真实引擎与真实时钟)。
func (*Orchestrator) Resume ¶ added in v0.0.2
func (o *Orchestrator) Resume(ctx context.Context, record *run.Record, trace []run.TraceEntry, obs Observer) error
Resume 从一次未完成运行的中断处续跑到终态,续写同一 runs/<id>/、run id 不变(语义即「恢复这次运行」)。 恢复源全部来自落盘:workflowSnapshot(不回读 store 里可能已被 edit/delete 的活 workflow)经 Expand 确定性还原步骤序列、trace 末条记录推断重入下标;trace 中 stepIndex<R 且末条 success 的记录回放重建 artifacts/feedback(见 replayState)。调用方(CLI)已做派生态的 fail-loud 前置校验,本方法仍对缺失 快照 / trace 与快照不一致做防御性报错,不带病续跑、不静默。