import type { PortDef, PromptContextBlock, PromptDocument } from './types'; /** * Build a fresh `PromptDocument` from a raw task string. * Middlewares receive this from the engine and push context blocks onto * `contexts`. `task` is the user's original prompt and should not be * rewritten by middlewares (translation middlewares are the rare exception). */ export declare function promptDocumentFromString(task: string): PromptDocument; /** * Serialize a `PromptDocument` to the default string form consumed by * drivers that read `task.prompt` instead of `ctx.promptDoc`. * * Format: * * [] * * * [] * * * * * Each context block is separated from the next (and from `task`) by a * single blank line. No implicit `[Task]` header is emitted — that framing * is the driver's responsibility (e.g. opencode's `agent_profile` wrapping). * Emitting one here would compose incorrectly with any driver that also * adds a `[Task]` header, producing a double header that some models * (observed with `opencode/big-pickle`) misread as a cut-off message. */ export declare function serializePromptDocument(doc: PromptDocument): string; /** * Helper for middlewares: return a new document with the given block * appended to `contexts`, preserving immutability of `doc`. */ export declare function appendContext(doc: PromptDocument, block: PromptContextBlock): PromptDocument; /** * Helper: return a new document with the given block PREPENDED. The * engine uses this to place port-related context blocks (`[Inputs]`, * `[Output Format]`) at the top of the document so middlewares that * assemble retrieval context against the task's inputs see them. */ export declare function prependContext(doc: PromptDocument, block: PromptContextBlock): PromptDocument; /** * Build an `[Inputs]` context block from a map of resolved port inputs. * Each input is rendered on its own line as `name: ` with an * optional trailing `# ` comment so the model has both the * value and the reason it matters. * * The block is *only* useful for AI tasks; command tasks consume inputs * through `{{inputs.X}}` substitution in their command line and do not * need this context. * * Returns null when there are no inputs to render — callers can forward * that nullish value to `prependContext` via an `if (block)` check so * empty-input tasks don't grow a noise block in their prompt. */ export declare function renderInputsBlock(inputsDecl: readonly PortDef[] | undefined, values: Readonly>): PromptContextBlock | null; /** * Build an `[Output Format]` context block from a task's declared output * ports. The block instructs the model to emit a final-line JSON object * matching the declared schema so `extractTaskOutputs` can pick it up * without fragile heuristics. Returns null when the task declares no * outputs. * * The instruction is deliberately short and explicit — a terse "emit * this object as JSON on the final line" beats a long schema dump * because shorter prompts compose better with downstream middlewares. */ export declare function renderOutputSchemaBlock(outputsDecl: readonly PortDef[] | undefined): PromptContextBlock | null; //# sourceMappingURL=prompt-doc.d.ts.map