export declare const AGENT_SOURCE_ENTRYPOINT = "index.ts"; export declare const AGENT_SOURCE_MAX_IMPORT_DEPTH = 8; export declare const AGENT_SOURCE_MAX_MODULES_PER_CANDIDATE = 32; export declare const AGENT_SOURCE_MAX_BYTES_PER_CANDIDATE: number; export declare const AGENT_SOURCE_MAX_MODULES_PER_SCAN = 2000; export declare const AGENT_SOURCE_MAX_BYTES_PER_SCAN: number; export declare const AGENT_SOURCE_MODULE_CACHE_MAX_ENTRIES = 10000; export declare const AGENT_SOURCE_MAX_LOOKUPS_PER_CANDIDATE = 256; export declare const AGENT_SOURCE_MAX_LOOKUPS_PER_SCAN = 16000; export declare const AGENT_SOURCE_MAX_RESOLUTION_STEPS_PER_CANDIDATE = 4096; export interface AgentSourceScanLimits { maxModules: number; maxBytes: number; maxLookups: number; } interface AgentSourceDiscoveryOptions extends Partial { maxResolutionSteps?: number; /** Test seam for proving scan-wide physical metadata work is memoized. */ beforeModuleLookup?: (file: string) => Promise | void; /** Test seam for deterministic file-mutation coverage. */ beforeModuleRead?: (file: string) => Promise; /** Test seam fired only after an opened inode matches admitted metadata. */ onModuleBytesRead?: (file: string) => void; /** Test seam for proving syntax-resolution CPU work remains bounded. */ onResolutionStep?: () => void; } /** * Logical scan-wide allowance. A cache hit still charges the first encounter, * while one canonical module shared by candidate graphs charges this workspace * scan once (and each candidate's separate budget once). Caching changes I/O * cost, never which rows or completeness an unchanged scan produces. */ export declare class AgentSourceScanBudget implements AgentSourceScanLimits { readonly maxModules: number; readonly maxBytes: number; readonly maxLookups: number; modules: number; bytes: number; lookups: number; truncated: boolean; private readonly admittedModules; private readonly admittedLookups; private readonly moduleMetadata; private readonly moduleContent; constructor(limits?: Partial); canAdmit(canonicalPath: string, size: number): boolean; admit(canonicalPath: string, size: number): boolean; admitLookup(key: string): boolean; metadata(key: string, load: () => Promise): Promise; content(key: string, load: () => Promise): Promise; } type ExpressionFact = { kind: "identifier"; name: string; } | { kind: "property"; target: ExpressionFact; name: string; } | { kind: "call"; callee: ExpressionFact; position: number; declaredName: string | null; } | { kind: "normal"; } | { kind: "callable"; } | { kind: "dynamic"; }; type LocalBinding = { kind: "expression"; expression: ExpressionFact; } | { kind: "import"; moduleSpecifier: string; importedName: string; } | { kind: "namespace"; moduleSpecifier: string; } | { kind: "factory"; }; type ExportBinding = { kind: "local"; localName: string; } | { kind: "expression"; expression: ExpressionFact; } | { kind: "reexport"; moduleSpecifier: string; importedName: string; }; interface ParsedModule { readonly bindings: ReadonlyMap; readonly exports: ReadonlyMap; readonly exportStars: readonly string[]; readonly parseable: boolean; readonly unresolved: boolean; } type ModuleMetadata = { status: "missing" | "not-file" | "symlink" | "incomplete"; fingerprint: string; } | { status: "file"; lexicalPath: string; canonicalPath: string; stat: import("node:fs").Stats; fingerprint: string; }; type ModuleContent = { status: "loaded"; parsed: ParsedModule; } | { status: "incomplete"; fingerprint: string; }; /** LRU of compact syntax facts, keyed exactly by canonical path + size + mtime. */ export declare class AgentSourceModuleCache { private readonly maxEntries; private readonly entries; private readonly keyByPath; constructor(maxEntries?: number); get size(): number; clear(): void; get(canonicalPath: string, size: number, mtimeMs: number, dev: number, ino: number): ParsedModule | null; set(canonicalPath: string, size: number, mtimeMs: number, dev: number, ino: number, parsed: ParsedModule): void; } export type AgentSourceDiscoveryResult = { status: "absent" | "not-agent"; fingerprint: string; observations: readonly string[]; watchPaths: readonly string[]; modules: number; bytes: number; lookups: number; } | { status: "agent"; name: string | null; fingerprint: string; observations: readonly string[]; watchPaths: readonly string[]; modules: number; bytes: number; lookups: number; } | { status: "incomplete"; reason: "ambiguous-export" | "budget" | "invalid-source" | "unreadable-source" | "unresolved-export"; fingerprint: string; observations: readonly string[]; watchPaths: readonly string[]; modules: number; bytes: number; lookups: number; }; export declare class AgentSourceDiscovery { private readonly cache; private readonly options; constructor(cache?: AgentSourceModuleCache, options?: AgentSourceDiscoveryOptions); inspectCandidate(candidateRoot: string, scanBudget?: AgentSourceScanBudget, workspaceRoot?: string): Promise; private loadExactModule; private loadExactModuleUnmemoized; private readModuleMetadata; private readModuleContent; private loadRelativeModule; private admitResolutionStep; private collectExportedNames; private resolveAllExports; private resolveExport; private resolveImportedExport; private resolveLocal; private resolveExpression; } export {}; //# sourceMappingURL=agent-source-discovery.d.ts.map