Skip to content
1 min read · 251 words

@nhtio/adk/batteries/orchestration/encoding

Encoding battery for orchestration: the reference classes the IR is built from, their @nhtio/encoder registration, and the plan digest every approval binds to.

Remarks

This module owns three things:

  1. NodeRef and ParamRef — the two CLASSES the IR uses for references and template holes. They are classes, not records with a marker field, for a reason stated in their TSDoc: a plain record can wear {kind: 'nodeRef', …} — it is an ordinary encodable record — so a marker property cannot separate a reference from a literal that merely looks like one, and a resolver keying on it would silently rewrite the literal. instanceof is unforgeable.
  2. registerOrchestrationEncodables() — the one call that makes decode() able to rebuild these classes. It MUST run before any decode().
  3. planDigest() — the canonical, LOSSLESS digest of a RawPlanView. Every approval binds to this digest, so it must never collide across semantically-different plans.

Classes

ClassDescription
NodeRefA serializable reference to another node's output — a CLASS, not a record.
ParamRefA hole in a template's staged values, substituted at instantiation. A CLASS for the same reason NodeRef is: a look-alike record must not be mistaken for a hole.

Functions

FunctionDescription
planDigestCompute the canonical, LOSSLESS digest of a RawPlanView.
registerOrchestrationEncodablesRegister NodeRef and ParamRef with the @nhtio/encoder decoder.