@nhtio/adk/batteries/orchestration/render
Prose projection of a plan — the review surface an operator reads at the approval gate, and the re-consumption surface a model reads for a plan it did not author.
Remarks
There is NO dry run in this design. This prose IS the review surface, and that is what makes the operator view load-bearing rather than cosmetic: an operator who approves a plan they cannot fully see is the failure this replaces. So for audience: 'operator' with view: 'as_planned', brevity is NOT a virtue — every side effect with its tool and arguments, every authority claim, every condition with its exact predicate, in traversal order, with branch structure legible.
Arguments at approval time are STAGED, NOT RESOLVED, and the renderer says which. A NodeRef resolves from the OutputTable, which only exists during a run; approval happens before any run and there is no dry run to populate it. So a literal argument renders as its value, and a NodeRef renders as its PROVENANCE — never as a fabricated value, never silently as though it were known. The operator is approving what the plan will do with whatever its sources produce, and the AUTHORITY CLAIM is the bound on that — which IS fully known at approval time. The as_executed view is where arguments appear resolved, because by then they are.
The operator view is a SEPARATE DISPLAY PROJECTION, not the execution payload: no model-written free text rendered as if it were fact, no raw machine identifiers where a human-readable label exists. The model view (audience: 'model') is the inverse: exact identifiers, the same surface forms a model would cite back, so a model can re-consume a plan it did not author without a paraphrase hop.
Properties:
- DETERMINISTIC. Same plan + same options ⇒ byte-identical output. The traversal order is fixed (entry-first, then graph order, with branch structure rendered by handle), value formatting is total, and nothing reads a clock, a store, or a global.
- TOTAL. Every node kind renders. The node-kind switch is exhaustiveness-checked with
const exhaustive: never = kind, so a new node kind cannot silently render as nothing.
It is NOT reversible — there is no prose parser, and render(parse(s)) === s is not promised, because parse does not exist. The renderer is a one-way display projection.
Type Aliases
| Type Alias | Description |
|---|---|
| RenderPlanOptions | Options for renderPlan. |
Functions
| Function | Description |
|---|---|
| renderPlan | Render a plan as prose — the review surface an operator reads at the approval gate, or the re-consumption surface a model reads for a plan it did not author. |