import { type Code } from "../template.js"; import { type Limits } from "./types.js"; export declare const SHAPES: { readonly binding: "const {{local}} = #value"; readonly call: "const {{value}} = {{tool}}({{args}})"; readonly check: "if ({{value}} is failure) {\n return failure(\"step {{id}} ({{tool}}): ${{{value}}.error}\", { step: #id, cause: {{value}} })\n}"; readonly checkPlain: "if ({{value}} is failure) {\n return failure(\"step {{id}} ({{tool}}): ${({{value}} as any).error}\", { step: #id, cause: {{value}} })\n}"; readonly letNull: "let {{value}}: {{outputType}} = null as {{outputType}}"; readonly llmThread: "thread {\n const {{reply}}: {{outputType}} = llm(#prompt{{options}})\n {{after}}\n}"; readonly guarded: "const {{value}} = guard(label: #label{{limits}}) {\n #body\n}"; readonly returnCall: "return {{tool}}({{args}})"; readonly contextText: "const {{local}} = if {{value}} is string then {{value}} else JSON.stringify({{value}})"; readonly concat: "#left + #right"; readonly local: "{{name}}"; }; export type Shape = keyof typeof SHAPES; /** The limit pieces a guard line takes, time first, each number printed as * a literal. The one place a limit becomes code, for the workflow guard * (render joins the pieces) and a step guard (lower prefixes each with `, `). */ export declare function guardArgs(limits: Limits): string[]; /** A workflow value as a literal fragment. Lifting it here, before any * `fill`, means a value shaped like a `Code` fragment is still data. */ export declare function literal(value: unknown): Code; export declare function statement(shape: Shape, names: Record, values: Record): Code; export declare function expression(shape: Shape, names: Record, values: Record): Code; /** A list literal whose items are holes named by position. */ export declare function list(items: Code[]): Code; export type RecordEntry = { key: string; value: Code; }; /** An object literal whose keys are identifiers and whose values are holes * named by position. */ export declare function record(entries: RecordEntry[]): Code;