feat: replace draft output bind with general bind

This commit is contained in:
lda
2026-06-28 00:38:42 +07:00 Verified
parent b96ba0f7d1
commit 955c43d808
25 changed files with 1246 additions and 138 deletions
+6 -6
View File
@@ -47,7 +47,8 @@ wf draft set-output <workspace_id> --revision <n> --step <step_id> --merge --map
wf draft branch <workspace_id> --revision <n> --step <step_id> --route ok=__end__ --route error=fail
wf draft handle <workspace_id> --revision <n> --to fail --branch lookup:error --branch transform:error
wf draft compile <workspace_id>
wf draft bind-output-to-state <workspace_id> --revision <n> --step <step_id> --output <field> --state state.<field>
wf draft bind <workspace_id> --revision <n> --step <step_id> --from local.<field> --to state.<field>
wf draft bind <workspace_id> --revision <n> --step <step_id> --from input.<field> --to local.<field>
wf draft add-step-from-capability <workspace_id> --revision <n> --step <step_id> --capability <qualified_name> --from-step <prev> --from-outcome ok --route ok=__end__ --route error=fail --input input.text=text --bind-output result=state.result
wf draft validate <workspace_id>
wf draft save <workspace_id> --artifact <artifact_id> --version <n> --title <title>
@@ -82,11 +83,10 @@ For `draft set-input` and `draft set-output`, repeated `--map` flags in one
command define the complete replacement map. If you split map edits across
multiple commands, pass `--merge` or the later command replaces the earlier map.
Prefer `draft bind-output-to-state` when a step output should write to a new
root state field. It declares the matching state schema and merges the output
binding in one revision-checked edit.
`bind-output-to-state` requires a capability-backed step with `use`; use JSON
Patch for non-capability/control draft steps.
Prefer `draft bind` when a capability step binding also needs schema
projection. Use `input/state -> local` for step inputs and `local ->
state/output` for step outputs. It requires a capability-backed step with
`use`; use JSON Patch for non-capability/control draft steps.
To add a capability step, prefer `wf draft add-step-from-capability` over raw
JSON Patch when the route, input bindings, and output-to-state bindings are
@@ -73,7 +73,7 @@ Prefer focused helpers over JSON Patch for common edits:
- `set_draft_route`
- `set_step_input_map`
- `set_step_output_map`
- `bind_output_to_state`
- `bind_draft`
- `add_step_from_capability`
- `branch_draft`
- `handle_draft`
@@ -91,7 +91,8 @@ wf draft set-output <workspace_id> --revision <n> --step <step_id> --merge --map
wf draft branch <workspace_id> --revision <n> --step <step_id> --route ok=__end__ --route error=fail
wf draft handle <workspace_id> --revision <n> --to fail --branch lookup:error --branch transform:error
wf draft compile <workspace_id>
wf draft bind-output-to-state <workspace_id> --revision <n> --step <step_id> --output <field> --state state.<field>
wf draft bind <workspace_id> --revision <n> --step <step_id> --from local.<field> --to state.<field>
wf draft bind <workspace_id> --revision <n> --step <step_id> --from input.<field> --to local.<field>
wf draft add-step-from-capability <workspace_id> --revision <n> --step <step_id> --capability <qualified_name> --from-step <prev> --from-outcome ok --route ok=__end__ --route error=fail --input input.text=text --bind-output result=state.result
```
@@ -105,18 +106,19 @@ Without `--merge`, `set-input` and `set-output` replace the whole map for that
step. Use repeated `--map` flags in one command for a complete replacement. Use
`--merge` only when adding/updating entries over multiple revisions.
- `bind_output_to_state`
- `bind_draft`
Declares one root state field from a step capability output schema and merges
`local.<output> -> state.<field>` into that step's output map. Prefer this
over manual JSON Patch when validation says a state output target is missing
from `state_schema`.
The selected step must have `use` so the helper can find the capability
output schema. It intentionally rejects non-capability/control steps instead
of guessing.
Declares a workflow input/state/output schema field from a capability local
input/output schema and merges the matching step binding. Use `input/state ->
local` for step inputs and `local -> state/output` for step outputs. Prefer
this over manual JSON Patch when validation says a target schema field is
missing. The selected step must have `use` so the helper can find the
capability schema. It intentionally rejects non-capability/control steps
instead of guessing.
```bash
wf draft bind-output-to-state <workspace_id> --revision <n> --step <step_id> --output <field> --state state.<field>
wf draft bind <workspace_id> --revision <n> --step <step_id> --from local.<field> --to state.<field>
wf draft bind <workspace_id> --revision <n> --step <step_id> --from input.<field> --to local.<field>
wf draft validate <workspace_id>
```
@@ -156,8 +158,7 @@ wf draft validate <workspace_id>
a `compiled_plan`.
Validation repair hints are product guidance. If a diagnostic suggests
`bind-output-to-state`, use it before hand-editing `state_schema` or step output
bindings.
`wf draft bind`, use it before hand-editing schemas or step bindings.
Use JSON Patch for structural edits the helpers do not cover.
@@ -18,10 +18,10 @@ validated, runnable deployment.
for common edits.
- `set-input` and `set-output` replace full maps by default; pass `--merge`
only when adding or updating one entry across a later revision.
- Before output-mapping into a new state field, declare it with
`bind-output-to-state` when it should mirror a capability output property.
It declares the matching state schema and merges the output binding in one
revision-checked edit.
- Before mapping into a new workflow input, state, or output field, prefer
`wf draft bind --from ... --to ...` when it should mirror a capability
local input/output property. It declares the matching schema and merges
the binding in one revision-checked edit.
- When adding a new capability-backed step, prefer:
```bash
wf draft add-step-from-capability ...