import { AgencyNode, FunctionParameter, VariableType } from "../types.js"; import type { SourceLocation } from "../types/base.js"; import type { BlockType } from "../types/typeHints.js"; import { TypeCheckerContext } from "./types.js"; import { Scope } from "./scope.js"; /** * Look up the parameter list for a callable name across local defs, graph * nodes, and imported functions — the resolution order used at every call * site that needs to inspect a callee's signature. */ export declare function getParamsForNodeOrFunc(name: string, ctx: TypeCheckerContext): FunctionParameter[] | undefined; /** * If the named callable's last parameter is `blockType`, return that signature * — the slot a trailing/inline block fills. Returns undefined for callables * whose block param is untyped, `any`, or absent (block bodies in those cases * keep their literal annotations and aren't checked against a contract). */ export declare function getBlockSlot(name: string, ctx: TypeCheckerContext): BlockType | undefined; /** True when `t` is the `any` type. A type predicate so the false branch * narrows to the non-`any` variants at call sites. */ export declare function isAnyType(t: VariableType): t is VariableType & { type: "primitiveType"; value: "any"; }; /** * Returns true when the parameter's declared type cannot be filled in by an * LLM through a JSON schema — i.e. it is (or contains) a function type. * * Single source of truth used by: * - the tool-position binding validator (lib/typeChecker/toolBlockBinding.ts) * - the tool schema generator (lib/backends/typescriptBuilder.ts :: buildToolDefinition) * - the runtime backstop (validateToolForLLM) * * Rules: * - A `blockType` (Agency's "(X) => Y") is function-typed. * - A `unionType` is function-typed if *any* arm is function-typed. * (Conservative — see docs/superpowers/specs/2026-06-03 §"Out of scope".) * - A variadic param `...xs: T[]` is function-typed iff the element type * `T` is function-typed (the LLM cannot fill an array of functions). * - `any` is NOT function-typed (accepted limitation; see spec §2 "any-typed * parameters"). */ export declare function isFunctionTyped(param: FunctionParameter): boolean; /** * Static half of the failure-propagation rule (spec: * docs/superpowers/specs/2026-07-08-failure-propagation-design.md). * Returns true when the parameter's declared type accepts Result values: * `Result`/`Result<...>`, explicit `any`, or a union containing either. * * Unannotated params return false — the strict rule. For a variadic * `...xs: T[]` the ELEMENT type decides, matching how the runtime checks * each gathered element. `typeAliasVariable` returns false (v1: aliases * are not resolved here; an alias of Result trips the runtime check and * the error message teaches the inline annotation). * * Emitted into FuncParam.acceptsResult by the typescript builder; consumed * by checkFailureArgs (lib/runtime/failurePropagation.ts). */ export declare function paramAcceptsFailure(param: FunctionParameter): boolean; /** * Check mode (top-down): verify that an expression is compatible with expectedType. * Shared by scopes.ts (assignment checking) and checker.ts (return type checking). */ export declare function checkType(expr: AgencyNode, expectedType: VariableType, scope: Scope, context: string, ctx: TypeCheckerContext, fallbackLoc?: SourceLocation): void; /** * The single "X is not assignable to Y" diagnostic construction site. No-op * when `actual` is `any` or already assignable to `expected`; otherwise pushes * the standard assignability error. Shared by `checkType` (assignment / return * checking) and the expression-match `matchExprSource` check in scopes.ts so * neither hand-rolls the message. */ export declare function emitAssignabilityError(actual: VariableType, expected: VariableType, loc: SourceLocation | undefined, context: string, ctx: TypeCheckerContext): void; /** * Check an `if` / `while` condition. Conditions must be `boolean`, EXCEPT an * optional (`T | null`) is accepted as a presence test. The runtime evaluates * conditions with JS truthiness, so `if (x)` only licenses narrowing `x` to * non-null in the THEN-branch (a falsy `x` may be `""`/`0`/`false` as well as * `null`, so the else-branch is not narrowed — see narrowing.ts). Synthesizes * the condition once (no double-report) and mirrors `checkType`'s "(condition)" * diagnostic. */ export declare function checkConditionType(condition: AgencyNode, scope: Scope, ctx: TypeCheckerContext): void; /** * When an object literal meets an object-typed target, every key must * correspond to a declared property. Mirrors TypeScript's excess-property * check; without it, typos like `modle:` slip through structural * assignability. Splat entries are dynamic and skipped. */ export declare function checkExcessObjectProperties(literal: AgencyNode & { type: "agencyObject"; }, expectedType: VariableType, context: string, ctx: TypeCheckerContext): void;