/** * Pure type-checking entry point for Agency source strings. * Returns diagnostics as data — never calls process.exit() or console.log(). */ import type { AgencyConfig } from "../config/config.js"; export type TypeCheckDiagnostic = { /** Stable AG#### diagnostic code — suppress one line with * `// @tc-ignore AG####`, or match on it programmatically instead of * parsing the message. */ code: string; severity: "error" | "warning"; message: string; loc?: { line: number; col: number; start: number; end: number; }; /** Structured payload of the diagnostic (the values that were rendered * into the message, e.g. `expected` / `actual` type strings). */ params: Record; }; export type TypeCheckReport = { errors: TypeCheckDiagnostic[]; warnings: TypeCheckDiagnostic[]; }; export declare function withSourcePath(source: string, sourcePath: string | undefined, fn: (syntheticPath: string) => T): T; /** `overrides` maps an absolute path to in-memory source, so `sourcePath` * may name a file that does not exist: its relative imports then resolve * against that directory without anything being written there. */ export declare function typeCheckSource(source: string, sourcePath?: string, config?: AgencyConfig, overrides?: Record): TypeCheckReport; export type EffectsByExport = Record; /** * Map each EXPORTED node/function in `source` to the transitive list of * interrupt effects it can raise. Reads the propagated map typeCheck * returns (same data raises-checking enforces — see lib/cli/policy.ts * for the precedent). Bare `interrupt(...)` sites surface as the * "unknown" sentinel — the envelope is fail-closed by design. Type * errors in `source` do not prevent extraction; parse failures throw. */ export declare function getEffectsFromSource(source: string, config?: AgencyConfig): EffectsByExport; /** * The same map, for a file that exists on disk. Prefer this whenever a real * path is available. * * The string form above cannot resolve relative imports, so their effects * never propagate and the list comes back short. That is documented * behavior for `getEffects`, but wrong for splice eligibility, where an * empty list reads as "safe to run at compile time". */ /** * Effects for a file on disk. Takes `config` for the same reason its * siblings do: this reads a REAL path, so a splice here resolves its * generator and runs it, and a caller must be able to decline. * * Test-only today — `lib/analysis/effects.test.ts`, `effectsOracle.test.ts` * and `typecheckEffects.test.ts` are the only callers, and it is not part of * the package's public API. The parameter is defaulted so those keep * working, and so the next production caller does not inherit the hole * silently. The production path that reads a real path is * `getEffectsFromSourceAt` below, which `_describe` calls with splices * refused. */ export declare function getEffectsFromFile(filePath: string, config?: AgencyConfig): EffectsByExport; /** * The same map for source text that lives at `sourcePath`, so its relative * imports resolve against that file's folder. The entry's own text is * `source`, not what is on disk. With a real path the pipeline can expand * splices, which runs their generators, so a caller holding text it does * not trust checks the imports first and passes `refuseSplices`, as * `_describe` does. */ export declare function getEffectsFromSourceAt(source: string, sourcePath: string, config?: AgencyConfig): EffectsByExport; /** * What each exported node or function of a file on disk needs from the host, * as the type checker computes it. The oracle test compares this with the * symbol table's own answer (`lib/analysis/effectsOracle.test.ts`); nothing * in production calls it. */ export declare function getCapabilitiesFromFile(filePath: string, config?: AgencyConfig): Record;