/** * Shadow Source analyzer — semantic visibility into handler bodies without touching the node model. * * Strategy: synthesize a virtual TypeScript file per handler that models the surrounding scope * (fn params, service `this`, websocket connection locals), run a single shared `ts.Program` * across all virtual files, and map diagnostics back to the original .kern source. * * Narrower v0: supports only contexts whose lowering exists in `packages/core/src/codegen/`. * Currently: `fn`, `method` (inside `service`/`repository`), and `on` (inside `websocket`). * Every other handler parent is flagged `shadow-unsupported-context` rather than modeled — * we'd rather miss diagnostics than emit confident false ones. */ import type { IRNode } from './types.js'; export interface ShadowDiagnostic { rule: string; nodeType: string; message: string; line?: number; col?: number; tsCode?: number; } export interface ShadowAnalyzeOptions { /** * Emit the real TypeScript shape for in-file declared types (interface/union/type) * into the shadow support file instead of the lossy `type X = any;` stub, so fence * bodies are checked against actual domain shapes. Default `false` (legacy any-stub * behavior). Project-wide (cross-module) resolution layers on top of this seam. */ realTypes?: boolean; /** * Project-wide resolution: imported type nodes keyed by the name they are referenced * by inside this file (the import's local/aliased name). The caller (CLI compile path) * resolves a file's KERN imports to the exported type IR and supplies them here so a * fence using `NeroOptions{registry: EngineRegistry}` is checked against the real * `@agon/core` shapes. Only honored when `realTypes` is set; in-file declarations win * on a name clash. The map need not be transitively complete — any referenced type the * map omits degrades cleanly to `any` (no false positive), so partial resolution just * means partial checking. */ importedTypeNodes?: Map; } export declare function analyzeShadow(root: IRNode, analyzeOptions?: ShadowAnalyzeOptions): Promise;