Type Alias: TokenizableEvaluator
type TokenizableEvaluator = (ctx?: DispatchContext) => string;Defined in: src/lib/classes/tokenizable.ts:28
A DYNAMIC Tokenizable value: a function evaluated at prompt-ASSEMBLY time with the live dispatch context, so the wrapped content computes itself coherent with the dispatch it ships in (e.g. a citation instruction that adapts to whether the answer tool survived the subtractive-pass shed).
Parameters
| Parameter | Type |
|---|---|
ctx? | DispatchContext |
Returns
string
Remarks
The context is OPTIONAL: the same Tokenizable is also read outside any dispatch (token measurement, serialization, plain string coercion). The evaluator MUST therefore handle ctx === undefined and return a string for EVERY input — that no-ctx branch IS its fallback. It must never throw and must never return a non-string; either violation raises @nhtio/adk!E_TOKENIZABLE_EVALUATOR_INVALID (loud — a mis-authored evaluator must not silently coerce garbage into the prompt). Keep evaluators serializer-friendly (capture only module-level refs or values passed as explicit bindings, NOT live per-turn state) so a dynamic Tokenizable round-trips its evaluator and stays dynamic across encode/decode.