Function: validateTemplate()
ts
function validateTemplate(
tpl: PlanTemplate,
invocable: InvocableTools,
): PlanIssue[];Defined in: src/batteries/orchestration/templates.ts:316
Validate a template against the invocable allowlist, once, at construction.
Parameters
| Parameter | Type | Description |
|---|---|---|
tpl | PlanTemplate | The template to validate. |
invocable | InvocableTools | The tier-C allowlist a staged call may invoke. |
Returns
Every blocking issue the template raises; an empty array means it is safe to register.
Remarks
Every issue returned here is a blocking refusal: a deployment whose template fails this check should fail to boot, not fail at the first instantiation months later. This is the whole point of validating over the immutable template rather than over each (mutable) instantiation.
The checks:
- Undeclared holes. A
ParamRefwhosepathdoes not name a declaredparamsentry is refused — a template cannot substitute a parameter it never declared. - Unknown tools. A
callnode naming a tool absent frominvocable.has(tool)is refused, and the message names what is available so the author can fix it. - The laundering check. A
ParamRefreaching acallnode'sargsis refused unless a node on every route to that call declares the corresponding field indeclassifies. See the module TSDoc for the honest, narrower invariant this enforces — a template cannot launder its own parameters — and why nothing more is claimed.
The route enumeration is capped at MAX_ROUTES paths. A template with more distinct simple paths than that cannot prove that every route declassifies, and is conservatively refused rather than trusted on a partial count.