/** * PromptObjectModel — direct port of Python's `signalwire.pom.pom`. * * A structured data format for composing, organizing, and rendering prompt * instructions for large language models. The Prompt Object Model provides a * tree-based representation of a prompt document composed of nested sections, * each of which can include a title, body text, bullet points, and arbitrarily * nested subsections. * * This is the lower-level building block. Most agent code uses the higher-level * {@link PomBuilder} wrapper, but `PromptObjectModel` is exposed directly so * that callers can mirror Python parity (`agent.pom` is a `PromptObjectModel`) * and load/save POMs as JSON/YAML. */ /** Plain serializable representation of a section, used for JSON/YAML and `to_dict()` exchange. */ export interface SectionData { title?: string; body?: string; bullets?: string[]; subsections?: SectionData[]; numbered?: boolean; numberedBullets?: boolean; } /** * A section in the Prompt Object Model. * * Each section contains a title, optional body text, optional bullet points, * and can have any number of nested subsections. */ export declare class Section { /** The name of the section. */ title: string | null; /** A paragraph of text associated with the section. */ body: string; /** Bullet-pointed items. */ bullets: string[]; /** Nested sections with the same structure. */ subsections: Section[]; /** Whether this section should be numbered. */ numbered: boolean | null; /** Whether bullets should be numbered instead of using bullet points. */ numberedBullets: boolean; /** * @param title Section title (null permitted only on the very first top-level section). * @param opts Keyword-style options matching Python's `body=`/`bullets=`/`numbered=`/`numberedBullets=`. */ constructor(title?: string | null, opts?: { body?: string; bullets?: string[] | null; numbered?: boolean | null; numberedBullets?: boolean; }); /** Add or replace the body text for this section. */ addBody(body: string): void; /** Add bullet points to this section (extends the existing list). */ addBullets(bullets: string[]): void; /** * Add a subsection to this section. * * @param title The title of the subsection (required — subsections must have a title). * @param opts Optional body / bullets / numbering for the subsection. * @returns The newly created Section. */ addSubsection(title: string, opts?: { body?: string; bullets?: string[] | null; numbered?: boolean; numberedBullets?: boolean; }): Section; /** Convert the section to a dictionary representation. */ toDict(): SectionData; /** * Render this section and all its subsections as markdown. * * @param level The heading level to start with (default 2 = `##`). * @param sectionNumber The current section number for numbered sections. */ renderMarkdown(level?: number, sectionNumber?: number[] | null): string; /** * Render this section and all its subsections as XML. * * @param indent The indentation level to start with (default 0). * @param sectionNumber The current section number for numbered sections. */ renderXml(indent?: number, sectionNumber?: number[] | null): string; } /** * The Prompt Object Model — a structured, serializable representation of a * full prompt document. Direct port of Python's * `signalwire.pom.pom.PromptObjectModel`. */ export declare class PromptObjectModel { /** Top-level sections in the model. */ sections: Section[]; /** Whether to print debug info during {@link renderMarkdown}. */ debug: boolean; constructor(debug?: boolean); /** * Add a top-level section to the model. * * @throws Error if a section without a title is added after the first section. */ addSection(title?: string | null, opts?: { body?: string; bullets?: string[] | string | null; numbered?: boolean | null; numberedBullets?: boolean; }): Section; /** * Find a section by its title (recursive search through all sections and subsections). * * @returns The matching Section or null if not found. */ findSection(title: string): Section | null; /** Convert the entire model to a list of dictionaries. */ toDict(): SectionData[]; /** Convert the entire model to a JSON string (pretty-printed with 2-space indent). */ toJson(): string; /** Convert the entire model to a YAML string. */ toYaml(): string; /** * Render the entire model as markdown. */ renderMarkdown(): string; /** * Render the entire model as XML. */ renderXml(): string; /** * Add another PromptObjectModel as subsections of an existing section. * * @param target Either the title of the target section, or a `Section` reference. * @param pomToAdd The model whose top-level sections will be appended as subsections. * @throws Error if `target` is a string and no section with that title is found. */ addPomAsSubsection(target: string | Section, pomToAdd: PromptObjectModel): void; /** * Create a PromptObjectModel from JSON data (string or already-parsed object). */ static fromJson(jsonData: string | unknown): PromptObjectModel; /** * Create a PromptObjectModel from YAML data (string or already-parsed object). */ static fromYaml(yamlData: string | unknown): PromptObjectModel; /** * Internal: build a PromptObjectModel from a parsed array-of-sections shape. * * Mirrors Python's `_from_dict` (despite the name, Python takes a list at * the top level — the function name is historical). */ private static _fromList; }