feat(ai): add one-step native workflow driver for model input and bounded child tasks
This commit is contained in:
1 parent
0cd64a7450
commit
643ea06340
1 file changed
+58
@@ -103,3 +103,61 @@ We retain **p = [Locate the Agent ABI plugin](plugin.native_path(name="agent"))*
|
||||
Return *[Commit cancellation](agent_workflow_cancel(id=`id`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`))*.
|
||||
2. *
|
||||
Return *[Missing ABI plugin](json.parse(text="{\"ok\":false,\"status\":\"unavailable\"}"))*.
|
||||
|
||||
|
||||
## tick
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| id | text | required | Running workflow |
|
||||
| source_revision | text | required | Pinned source revision |
|
||||
| registry | map | None | Trusted SKILL registry |
|
||||
| model | any | None | Configured LLM |
|
||||
| session_id | text | None | Host-attested session |
|
||||
| principal_ref | text | None | Host-attested principal |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | New checkpoint state, or waiting_input for the UI |
|
||||
|
||||
Use `id`, `source_revision`, `registry`=None, `model`=None, `session_id`=None, `principal_ref`=None as the inputs for this operation.
|
||||
|
||||
Advance at most one step. Model text is a candidate, never direct
|
||||
execution. Waiting for a user returns immediately without holding a thread.
|
||||
A caller repeats tick after verified completion; UI replies use commit.
|
||||
|
||||
We retain **state = [Load the next action](next(id=`id`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`))**.
|
||||
We retain **status = [Read action status](json.get(value=`state`, key="status"))**.
|
||||
1. `status` == "waiting_model"
|
||||
We retain **step = [Read model step](json.get(value=`state`, key="step"))**.
|
||||
We retain **step_id = [Read step identifier](json.get(value=`step`, key="id"))**.
|
||||
We retain **prompt = [Read local prompt](json.get(value=`step`, key="prompt"))**.
|
||||
We retain **options = [Read allowed decisions](json.get(value=`step`, key="options"))**.
|
||||
We retain **answer = [Make a bounded choice](flow.choose(input=`prompt`, options=`options`, model=`model`))**.
|
||||
We retain **valid = [Check model decision](json.get(value=`answer`, key="ok"))**.
|
||||
1. `valid`
|
||||
We retain **chosen = [Read verified model answer](json.get(value=`answer`, key="value"))**.
|
||||
Return *[Commit the model choice](commit(id=`id`, step_id=`step_id`, response=`chosen`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`))*.
|
||||
2. *
|
||||
Return *answer*.
|
||||
2. `status` == "ready_tool"
|
||||
We retain **step = [Read tool step](json.get(value=`state`, key="step"))**.
|
||||
We retain **kind = [Read operation kind](json.get(value=`step`, key="kind"))**.
|
||||
We retain **step_id = [Read step identifier](json.get(value=`step`, key="id"))**.
|
||||
1. `kind` == "parallel"
|
||||
We retain **tasks = [Read child tasks](json.get(value=`step`, key="tasks"))**.
|
||||
We retain **report = [Run bounded parallel documents](flow.parallel(tasks=`tasks`))**.
|
||||
Return *[Commit all child outcomes](commit(id=`id`, step_id=`step_id`, response=`report`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`))*.
|
||||
2. `kind` == "skill"
|
||||
We retain **name = [Read registered skill name](json.get(value=`step`, key="skill"))**.
|
||||
We retain **out = [Run registered SKILL only](flow.enter(skill=`name`, registry=`registry`))**.
|
||||
Return *[Commit verified child result](commit(id=`id`, step_id=`step_id`, response=`out`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`))*.
|
||||
3. *
|
||||
Return *state*.
|
||||
3. `status` == "ready_return"
|
||||
We retain **step = [Read return step](json.get(value=`state`, key="step"))**.
|
||||
We retain **step_id = [Read step identifier](json.get(value=`step`, key="id"))**.
|
||||
We retain **value = [Read final value](json.get(value=`step`, key="value"))**.
|
||||
Return *[Commit the completed workflow](commit(id=`id`, step_id=`step_id`, response=`value`, source_revision=`source_revision`, session_id=`session_id`, principal_ref=`principal_ref`))*.
|
||||
4. *
|
||||
Return *state*.
|
||||
Reference in new issue
Block a user