import type { PortableType, PortSchema } from "../behavior.js"; type TS = typeof import("typescript"); type TsNode = import("typescript").Node; type TsChecker = import("typescript").TypeChecker; /** Dynamic-import the OPTIONAL PEER `typescript`. Absent → a loud, actionable error (a `.ts` --from module * needs the TS compiler; a consumer authoring TS already has it, or can pass a prebuilt `.js`/`.mjs`). */ export declare function loadTypeScript(fromPath: string): Promise; /** The behavior source the AST reader lowers: a file PATH (CLI `--from`), or an IN-MEMORY `{ source }` * (a programmatic consumer / test). Both are the SAME reader — only the input face differs (#193). */ export type BehaviorSource = string | { readonly source: string; readonly fileName?: string; }; /** The RUNNING module tree of this package (`/src` under strip-types, `/dist` at runtime) — the * SSoT for "was this symbol DECLARED by behavior-contracts?". Both build-time readers judge BC symbols by * declaration site, never by name: the marker/builder check (`bcExportNameOf`, ts-compile.ts) and the * declared-type check ({@link isBcAuthoringType}, this file). */ export declare const BC_MODULE_ROOT: string; /** The ts.Program/checker every build-time TS reader shares (one place declares the compiler options). * Accepts a file path OR an in-memory `{ source }` — the latter is served by a thin CompilerHost overlay * (only the virtual file is in-memory; lib + `behavior-contracts` resolution delegate to disk). */ export declare function createBehaviorProgram(ts: TS, input: BehaviorSource): { program: import("typescript").Program; checker: TsChecker; sourceFile: import("typescript").SourceFile; }; /** * Natural-argument form (#191): each method PARAMETER = one named input port (param name → port name, * param type → PortSchema) via {@link tsTypeToPortSchema}. An optional param (`x?: T`) carries * `required:false`. */ export declare function extractMethodPorts(ts: TS, checker: TsChecker, method: import("typescript").MethodDeclaration | import("typescript").FunctionLikeDeclaration, where: string): Record; /** * The behavior's DECLARED OUTPUT CONTRACT: a `@behavior` method's RETURN TYPE ANNOTATION as a * PortableType (native-ts-authoring.md §5.1 "戻り値型 → 出力 port 型"), or `undefined` when the method * declares none. The compile pipeline reconciles it with the type derived from the body's terminal node * (`outputContract`, lowering.ts) — the declaration is the contract, the derivation verifies it. * * Read from the ANNOTATION NODE, never from the checker's inferred signature return type: a behavior * body is a graph description whose `@leaf` calls return placeholder values, so an inferred return type * would be the placeholder's, not a declaration — BC honors declarations only (consumer-interface.md C3). * The conversion goes through the SAME converter as every other type read ({@link portableFromTypeNode}), * so a return type outside the portable vocabulary fails closed identically (bare `number` → `UNMAPPABLE_TS_TYPE`). */ export declare function extractMethodReturnType(ts: TS, checker: TsChecker, method: import("typescript").MethodDeclaration, where: string): PortableType | undefined; /** * `@leaf static` method signature → the leaf's PortableType meta (#191): each param → an input port * PortableType, the return type → cardinality + element output type (`T[]` → many / `T` → one). Reuses * {@link tsTypeToPortable} (the same converter). The consumer builds a CatalogEntry from this via the * shared `catalogEntryFromLeaf` — no second catalog-derivation path. * * #210: the meta also carries whether this handler is ASYNC — and that fact comes from the SAME unwrap * (#211) that makes the async spelling lower to the sync twin's IR: the leaf is async exactly when its * declared return type WAS a `Promise` that {@link awaitedType} unwrapped (an `async` method infers * `Promise` too, so both spellings are read by one rule). The declaration is the SSoT — there is no * second place (no build flag, no re-listing of component names) where async-ness is stated. */ export declare function extractLeafMeta(ts: TS, checker: TsChecker, method: import("typescript").MethodDeclaration, where: string): { cardinality: "one" | "many"; ports: Record; output: PortableType; async: boolean; }; /** Depth-first search for a class declaration named `name`. */ export declare function findClass(ts: TS, root: TsNode, name: string): import("typescript").ClassDeclaration | undefined; /** Convert a TS type ANNOTATION node → PortableType via the SAME converter used for arg / `@leaf` return * types ({@link tsTypeToPortable}). The seam the AST reader uses to read a binding's declared type * (`const x: T = `) as that node's outType (#193 — replaces the standalone `as(node, …)` builder). * Same reject discipline (bare `number` → `UNMAPPABLE_TS_TYPE`, etc.); a `WireValue` here declares the * opaque-wire passthrough, whose legality is decided at the single node-type rule site (lowering.ts). */ export declare function portableFromTypeNode(ts: TS, checker: TsChecker, typeNode: import("typescript").TypeNode, where: string): PortableType; /** The map-SOURCE element type as a PortableType: the element type of an array-typed `over` expression. * The AST reader uses it to derive an `into`-map's augmented element type (source element ⊕ the leaf * result under the into key) from the TS types alone — no annotation needed, since the source shape is * already typed. Rejects a non-array source. Same converter/discipline as arg / return / binding types. */ export declare function mapSourceElemType(ts: TS, checker: TsChecker, overExpr: TsNode, where: string): PortableType; export {}; //# sourceMappingURL=ts-extract.d.ts.map