/** * design/98 ยง2.4 (S8b) โ€” STATIC, NON-EVAL extraction of a workflow script's `export const meta = {...}`. * * ๐Ÿ”ด The meta block is parsed as PURE DATA by a small recursive-descent reader that NEVER executes the * script (no `vm`, no `eval`, no `Function`) โ€” evaluating untrusted source to read its metadata would itself * be the injection surface. The reader accepts ONLY literal values (string / number / boolean / null / array * / plain object) and REJECTS anything that could carry behavior or pollute a prototype: * - identifier values (a variable reference), function calls, template literals, spreads, computed keys, * method shorthand, getters/setters; * - the dangerous keys `__proto__` / `constructor` / `prototype` (prototype-pollution guard). * Any violation throws {@link WorkflowScriptError} so the `run_workflow` tool can hand the LLM a structured * "fix your meta" error BEFORE the (hard) sandbox ever runs the body. */ import type { WorkflowMeta } from "./workflow-script-runner.js"; /** Thrown when an LLM-authored workflow script is malformed at the static layer (bad meta, oversized source, * a forbidden construct). Carries a `code` so the tool can return a structured error the model can act on. */ export declare class WorkflowScriptError extends Error { readonly code = "workflow.script_error"; constructor(message: string); } /** * Statically extract + validate a workflow script's `export const meta`. Returns a typed {@link WorkflowMeta} * (name + description required, both strings; `phases`/`whenToUse` optional). NEVER executes the script. * @throws {WorkflowScriptError} on a missing/malformed/non-literal meta. */ export declare function parseWorkflowMeta(source: string): WorkflowMeta; /** Replace every string literal (incl. template text, recursing into `${โ€ฆ}` code) and comment with spaces. */ export declare function stripStringsAndComments(src: string): string; /** CC `wxl` semantics: a `Date.now` / `Math.random` member access, or an ARGLESS `new Date()`, anywhere in the * body's CODE (strings/comments stripped) โ€” each silently busts the resume prefix cache. */ export declare function workflowScriptReadsClockOrRandom(body: string): boolean; /** * Parse the meta AND return the script BODY with the `export const meta = {...}` declaration removed โ€” for a * runner that compiles the remaining body as an async function (the meta is DATA, parsed statically; only the * body is ever executed). An optional trailing `;` after the declaration is trimmed. */ export declare function splitWorkflowMeta(source: string): { meta: WorkflowMeta; body: string; }; //# sourceMappingURL=workflow-meta.d.ts.map