import type { ModelMessage } from "ai"; import type { DeliverPayload, SessionAuthContext } from "#channel/types.js"; import type { StepInput } from "#harness/types.js"; /** * Merges two {@link StepInput} values into one. * * Used by the harness to coalesce deferred step input with the current * turn's input, and by the execution layer after calling `onDeliver` * for each queued delivery payload. */ export declare function coalesceTurnInputs(a: StepInput, b: StepInput): StepInput; /** * Extracts the final visible assistant text from model response messages. * * Prefers text extracted from the last assistant message that contains visible * text. Falls back to the raw `text` property from the AI SDK result when no * assistant message contains text. Returns `null` when neither source contains * text. */ export declare function resolveAssistantStepText(messages: readonly ModelMessage[], fallback: string | undefined): string | null; /** * Structural shape of the workflow `DeliverHookPayload`. Using a * structural type keeps this helper decoupled from the concrete * runtime type. */ interface DeliverLike { readonly auth?: SessionAuthContext | null; readonly kind: "deliver"; readonly payloads: readonly DeliverPayload[]; } /** * Coalesces an array of deliver-like items into a single item by * collecting all payloads and keeping the most recent auth value. * * Used by the workflow runtime to batch follow-up deliveries that * arrived while a turn or subagent delegation was in progress. Each * payload is later passed to `onDeliver` individually so channel- * specific fields are never lost. */ export declare function coalesceDeliveries(items: readonly T[]): T; export {};