/** * Static DAG verification — zero-token structural analysis. * * Runs *before* any agent is spawned. Catches dead-end phases, unreachable * paths, gate exhaustion, budget overflow, and reference integrity issues * purely through graph algorithms on the DAG — no LLM required. * * Caller-supplied `TaskflowVerifier`s may also run, after the built-in * detectors; they are pure by contract (no I/O, no LLM) — see TaskflowVerifier. */ import type { Phase } from "./schema.ts"; import type { ComposedEffectFlowLike } from "./effects/validate.ts"; export type IssueCategory = "dead-end" | "unreachable" | "gate-exhaustion" | "budget-overflow" | "concurrency" | "ref-integrity" | "guard-contradiction" | "contract" | "effects" | "plugin"; export interface VerificationIssue { /** Affected phase id, if applicable. */ phaseId?: string; message: string; severity: "error" | "warning"; category: IssueCategory; /** Name of the verifier that produced this issue. Undefined for the built-in * structural detectors; set to the verifier's `name` on every issue emitted * by a caller-supplied verifier (category "plugin"). */ source?: string; } export interface VerificationResult { ok: boolean; issues: VerificationIssue[]; } /** A lightweight Taskflow shape for verification (accepts parsed Phase[] + name). */ export interface VerifiableFlow { name: string; phases: Phase[]; budget?: { maxUSD?: number; maxTokens?: number; }; concurrency?: number; } /** A single finding from a caller-supplied verifier. The engine stamps * `category: "plugin"` and `source: `; a verifier only supplies * what it actually knows — where, what, and how bad. */ export interface VerifierIssue { /** Affected phase id, if applicable. */ phaseId?: string; message: string; severity: "error" | "warning"; } /** A caller-supplied, zero-token static check plugged into `verifyTaskflow`. * * A verifier runs AFTER the built-in structural detectors, against the SAME * sanitized flow, and its issues merge into the single `VerificationResult`. * A verifier MUST be a pure function — no I/O, no LLM, zero tokens — matching * this module's "no I/O" contract. A throwing or malformed verifier is * fail-closed: normalized into a single `error`/`plugin` issue naming the * verifier, and the remaining verifiers still run. */ export interface TaskflowVerifier { /** Stable, human-readable name. Attributes every issue the verifier emits * (VerificationIssue.source) and appears in the fail-closed error message. */ name: string; /** Inspect the sanitized flow and return zero or more findings. Should not * throw on well-formed input — if it cannot decide, return no issue. */ verify: (flow: VerifiableFlow) => VerifierIssue[]; } /** Options for {@link verifyTaskflow}. */ export interface VerifyOptions { /** Caller-supplied verifiers. Run after the built-in detectors, in array * order, against the same sanitized flow; built-in issues always come first. */ verifiers?: TaskflowVerifier[]; /** Optional saved-flow loader used to resolve `flow{use}` children during * effect label-flow verification. When provided, resolved children are * checked with their real effects; children the loader cannot resolve * degrade to advisory warnings (the runtime loader remains authoritative). */ resolveFlow?: (name: string) => ComposedEffectFlowLike | undefined; } /** * Run all static verification passes against a parsed taskflow. * * Returns issues found; `ok === true` means no errors (warnings are ok). * The built-in detectors are pure (no I/O, no LLM, zero tokens); caller-supplied * verifiers run after them and are pure by contract (see TaskflowVerifier). */ export declare function verifyTaskflow(flow: VerifiableFlow, options?: VerifyOptions): VerificationResult; /** Format verifier-origin issues into attributed message strings: the verifier * `source` (its name) is prefixed when present, else the bare message. Shared by * `pluginVerifierErrors` (the no-spend gate) and the imperative inline-def * preflight in runtime.ts, so the attribution format lives in one place. */ export declare function formatPluginIssueMessages(issues: VerificationIssue[]): string[]; /** Run only the caller-supplied verifiers against `flow` and return the messages * of any error-severity plugin issues (prefixed with the verifier `source` when * attributed), or `null` when there are none (or no verifiers registered). This * is the no-spend gate called at every child-flow dispatch site so a host's * trusted verifiers block spend uniformly across the imperative and event-kernel * engines — see `runNested` (event kernel) and the top-level preflight in * `executeTaskflow`. Pure, zero-token, fail-closed internally; it never throws. */ export declare function pluginVerifierErrors(flow: VerifiableFlow, verifiers: TaskflowVerifier[] | undefined): string[] | null; //# sourceMappingURL=verify.d.ts.map