/** * Static EffectIR validation: kinds, refs, labels, mutating-path overlap. * Pure — no I/O. */ import { type PathRef } from "../resources/schema.ts"; import { type EffectDecl, type EffectIR, type EffectKind, type SecretRef, type ServiceRef } from "./types.ts"; export interface EffectValidationIssue { severity: "error" | "warning"; code: string; message: string; effectId?: string; pathA?: string; pathB?: string; } export interface EffectValidationResult { ok: boolean; issues: EffectValidationIssue[]; } type ValidEffectRecord = Record & { id: string; kind: EffectKind; }; /** Extract portable relative path string from a PathRef for overlap checks. */ export declare function pathRefRelativeKey(pathRef: PathRef): string | undefined; /** * True if path A is the same as, a parent of, or a child of path B * (portable `/` paths, no `..`). */ export declare function pathsOverlap(a: string, b: string): boolean; /** * Validate an EffectIR bag: shape, labels, target/kind consistency, overlap. */ export declare function validateEffectIR(ir: EffectIR | { effects?: unknown; }): EffectValidationResult; export interface EffectFlowPhaseLike { id?: unknown; effects?: unknown; dependsOn?: unknown; from?: unknown; type?: unknown; def?: unknown; use?: unknown; final?: unknown; } export interface ComposedEffectFlowLike { name?: unknown; phases?: readonly EffectFlowPhaseLike[]; } interface LabeledEffect { label: string; effect: ValidEffectRecord; } interface PhaseEffectSummary { sources: LabeledEffect[]; sinks: LabeledEffect[]; } export interface ComposedEffectFlowOptions { resolveFlow?: (name: string) => ComposedEffectFlowLike | undefined; /** * Static gates (validateTaskflow / verifyTaskflow / FlowIR translate+compile) * run without a flow store, so a `flow{use: }` child they cannot load * degrades to the unknown-boundary summary (secret source + public sink). * Legal saved-subflow compositions — e.g. a benign child followed by a * declared write — then hard-fail even though the runtime, which resolves * the name through `loadFlow`, accepts them. When this option is set, an * unresolved `use` still emits the conservative unknown-boundary taint but * reports it as advisory warnings (codes `unresolved-flow-use` / * `unresolved-flow-use-taint`) instead of errors. Runtime admission (with * `resolveFlow`) remains the authoritative fail-closed gate for real * violations. Dynamic inline `def` boundaries are unaffected — they stay * hard-tainted by design. */ downgradeUnresolvedUse?: boolean; } /** * Conservative DAG-wide label flow. Every source reachable through a phase's * dependencies may influence that phase's sinks, including through unlabeled * intermediate phases. This is a pure static check; conditional branches are * intentionally not used to declassify data. */ export declare function validateEffectFlow(phases: readonly EffectFlowPhaseLike[], dependencyIds?: (phase: EffectFlowPhaseLike) => readonly string[], phaseSummaries?: ReadonlyMap): EffectValidationResult; /** * Validate label flow across nested flow/expand boundaries. Child sources are * summarized onto the parent node and child sinks receive the parent's * dependency-reachable sources. Unresolved saved/dynamic children expose a * maximally confidential source and public sink until runtime resolution. * With {@link ComposedEffectFlowOptions.downgradeUnresolvedUse} set (static * gates without a flow loader), unresolvable `flow{use}` boundaries report as * advisory warnings instead of errors; runtime admission stays authoritative. */ export declare function validateComposedEffectFlow(flow: ComposedEffectFlowLike, options?: ComposedEffectFlowOptions): EffectValidationResult; /** Type guard for a well-formed SecretRef (no material). */ export declare function isSecretRef(v: unknown): v is SecretRef; /** Type guard for ServiceRef. */ export declare function isServiceRef(v: unknown): v is ServiceRef; /** Collect mutating path keys from effects (static literals only). */ export declare function collectMutatingPathKeys(effects: EffectDecl[]): Array<{ effectId: string; pathKey: string; }>; export {}; //# sourceMappingURL=validate.d.ts.map