/** * P — Prompt composition namespace. * * Factory methods returning composable prompt sections. * Compose with .add() (union) or .pipe() (chain). * Section order: role → context → task → constraint → format → example. * * Usage: * agent.instruct( * P.role("Senior analyst") * .add(P.task("Analyze the data")) * .add(P.constraint("Be concise", "Use tables")) * ) */ import type { State } from "../core/types.js"; /** A composable prompt section descriptor. */ export declare class PTransform { readonly section: string; readonly text: string; readonly children: PTransform[]; readonly meta: Record; constructor(section: string, text: string, children?: PTransform[], meta?: Record); /** Compose: add another section. */ add(other: PTransform): PTransform; /** Pipe: transform the rendered output. */ pipe(other: PTransform): PTransform; /** Render the full prompt string with sections ordered canonically. */ render(state?: State): string; /** Compute a fingerprint for caching. */ fingerprint(): string; toString(): string; /** Collect all leaf sections recursively. */ private _collectSections; /** Render a single section block. */ private _renderSingle; } /** * P namespace — prompt composition factories. * * All 19 methods from the Python P namespace. */ export declare class P { /** Agent persona / role. */ static role(text: string): PTransform; /** Background context. */ static context(text: string): PTransform; /** Primary objective / task. */ static task(text: string): PTransform; /** Constraints and rules (multiple strings → bullet list). */ static constraint(...rules: string[]): PTransform; /** Output format specification. */ static format(text: string): PTransform; /** Few-shot example (freeform or structured). */ static example(opts: { text?: string; input?: string; output?: string; }): PTransform; /** Custom named section. */ static section(name: string, text: string): PTransform; /** Conditional block inclusion. */ static when(predicate: (state: State) => boolean, block: PTransform): PTransform; /** Read keys from state and format as context. */ static fromState(...keys: string[]): PTransform; /** * Template with {key}, {key?} (optional), and {ns:key} placeholders. * Resolved at runtime from agent state. */ static template(text: string): PTransform; /** Override section ordering. */ static reorder(...sectionNames: string[]): PTransform; /** Keep only named sections (filter others). */ static only(...sectionNames: string[]): PTransform; /** Remove named sections. */ static without(...sectionNames: string[]): PTransform; /** LLM-compress verbose prompts. */ static compress(opts?: { maxTokens?: number; }): PTransform; /** Adapt tone/complexity for audience. */ static adapt(audience: string): PTransform; /** Wrap block in defensive scaffolding. */ static scaffolded(block: PTransform, opts?: { preamble?: string; postamble?: string; }): PTransform; /** Attach version metadata + fingerprint. */ static versioned(block: PTransform, tag?: string): PTransform; /** Inject A2UI component catalog schema into prompt. */ static uiSchema(opts?: { catalog?: string; examples?: boolean; }): PTransform; } //# sourceMappingURL=prompt.d.ts.map