import { TypeCheckReport } from "../compiler/compile.js"; import { type Root } from "../host/node/nodeFiles.js"; import type { NamedExportBody } from "../types.js"; import { type ParsedInterrupt } from "../testFormat/schema.js"; import type { AgencyProgram, AgencyNode } from "../types.js"; import type { TrustedModules } from "../compiler/trustedModules.js"; type CompiledProgramValue = { moduleId: string; code: string; modules?: Record; entryPath?: string; /** The absolute compiled paths of the trusted modules this program * loads, sorted; empty when it loads none. Shown in the `std::run` * interrupt, and checked to exist before the fork. */ trustedModules: string[]; }; /** `compile` with a trusted-modules list. Only std::workflow passes a * non-empty one (`_compileTrusted` in lib/stdlib/workflow/index.ts); the * public `compile` passes `[]`. See docs/dev/runtime/trusted-modules.md. */ export declare function compileWithTrustedModules(source: string, dir: string, strict: boolean, trustedModules: TrustedModules[]): CompiledProgramValue; export declare function _compile(source: string, dir?: string, strict?: boolean): CompiledProgramValue; export declare function resolveInSandbox(dir: string, filename: string, sandbox?: (dir: string) => Root): string; export declare function _compileFile(dir: string, filename: string): CompiledProgramValue; /** The trusted compiled files a program loads, for the `std::run` * interrupt. A program compiled before trusted modules existed, or a * hand-built value, has none. */ export declare function _programTrustedModules(compiled: { trustedModules?: unknown; }): string[]; /** The current process's subprocess nesting depth (0 = root). Backs the * `depth` field in std::run gate interrupt data — `run()` reports the * PROSPECTIVE child depth as `_subprocessDepth() + 1` so handlers can * reject by depth. Also readable from TS via `agency.ctx().subprocessDepth`. */ export declare function _subprocessDepth(): number; export declare function _typecheck(source: string, dir?: string, strict?: boolean): TypeCheckReport; /** `typecheck` with a trusted-modules list, which only the strict import * check reads. Only std::workflow passes a non-empty one. */ export declare function typecheckWithTrustedModules(source: string, dir: string, strict: boolean, trustedModules: TrustedModules[]): TypeCheckReport; export declare function _getEffects(source: string): Record; export type ExportKind = "def" | "node" | "type" | "const" | "reexport"; /** One parameter of an exported def or node. `type` and `default` are * Agency text, printed the way the signature prints them, and null when * absent. `description` is the text of the docstring's `@param` entry. */ export type ExportParam = { name: string; type: string | null; default: string | null; description: string | null; }; export type ExportInfo = { name: string; kind: ExportKind; signature: string; /** The declared return type of a def or node, else null. */ returnType: string | null; /** True when a def or node returns a `Result`, with aliases resolved. */ returnsResult: boolean; docstring: string | null; effects: string[]; destructive: boolean; idempotent: boolean; handoff: boolean; /** The module path this export was re-exported from, else null. */ reexportedFrom: string | null; /** Each parameter of a def or node. Empty for every other kind, and for * a re-export that cannot be read from a source string. */ params: ExportParam[]; }; export type ModuleInfo = { description: string | null; exports: ExportInfo[]; }; /** One ExportInfo per EXPORTED top-level def, node, type alias, const, * and re-exported name, in source order. Effects come from the same * transitive analysis as _getEffects, sentinel included. Re-exports * from std:: modules resolve by describing the source module; other * re-exports (relative paths cannot resolve from a bare source string) * come back as thin "reexport" entries whose effects carry the * "unknown" sentinel — never a silent omission. */ export declare function _describe(source: string, dir?: string, filename?: string): ModuleInfo; /** `describe` with a trusted-modules list, so a trusted module's imports of * TypeScript do not refuse it. Only std::workflow and the `agency workflow` * commands pass a non-empty one. */ export declare function describeWithTrustedModules(source: string, dir: string, filename: string, trustedModules: TrustedModules[]): ModuleInfo; export declare function parseDescribedProgram(source: string): AgencyProgram; /** The local names this module exposes for names the source module hides * — under the local alias, since that is what the next module out asks * for. Exported for tests: a re-export chain deep enough to exercise it * cannot be built from the stdlib as it stands. */ export declare function reExportedHiddenNames(body: NamedExportBody, innerHidden: string[]): string[]; export declare function _typecheckFile(dir: string, filename: string): TypeCheckReport; export declare function _parseAST(source: string): AgencyProgram; export declare function _writeAST(ast: AgencyProgram, dir: string, filename: string, overwrite: boolean): Promise; export declare function _format(source: string): string; export declare function _formatFile(dir: string, filename: string): boolean; export type WalkASTVisit = { node: AgencyNode; ancestors: AgencyNode[]; }; export declare function _walkAST(ast: AgencyProgram): { clone: AgencyProgram; visits: WalkASTVisit[]; }; export declare function _getNodesOfType(source: string, types: string[]): AgencyNode[]; export declare function _filterImports(source: string, allowedPackages: string[], excludedPackages: string[], allowKinds: string[], excludeKinds: string[]): { source: string; filtered: boolean; }; /** Deterministic text for a run failure carried into case feedback: the * message, followed by the failure's data as stable JSON when it has any. */ export declare function _failureFeedback(message: string, data: Record): string; /** "" = pass; otherwise the failing diff. Backs std::agency's test(): * the one exact-match verdict shared with the CLI runner. */ export declare function _exactVerdictFeedback(actual: unknown, expected: unknown): string; export type TestFileCaseWire = { node: string; args: Record; expected: unknown; interrupts: ParsedInterrupt[]; wallClock?: number; description?: string; }; export type ParsedTestFileWire = { sourceFile: string; defaultTimeoutMs?: number; cases: TestFileCaseWire[]; }; /** Reads and validates a sandbox-profile .test.json. Every case is * converted up front, so a bad file is a whole-call failure before * test() can launch anything. An escaping filename is refused by * resolveInSandbox BEFORE any read. */ export declare function _readTestFileSandbox(dir: string, filename: string): ParsedTestFileWire; export {};