import type { MaterializedResultRef, SessionMessageSnapshot } from "../types.ts"; import type { TaskLifecycleDeps } from "../core/lifecycle-shared.ts"; /** * Get materialized result for a task. * Checks: task.result cache → lazy backward-compat fetch → orphaned sidecar → expired/not_found. */ export declare function getResult(d: TaskLifecycleDeps, taskId: string): Promise<{ kind: "ok" | "expired" | "not_found" | "fetch_error"; text: string; resultText: string; hadFence: boolean; totalChars: number; error?: string; }>; /** * Materialize a task's output by fetching session messages and writing a sidecar file. */ export declare function materializeResult(d: TaskLifecycleDeps, taskId: string): Promise; /** * Extract the final assistant answer from session messages, * starting from the given boundary index. * * Walks messages from `boundary` forward and returns the text of the LAST * assistant message that carries a non-empty text part. Messages whose parts * are only tool/reasoning content (no text) are ignored, so tool-result echo * that some adapters (e.g. Pi) misclassify as assistant text does not pollute * the answer. * * The returned text is the raw message text — any ```result fence inside it * is preserved verbatim, so the caller's existing `extractResultBlock` pass * still extracts the fence from the final answer. * * Returns `null` when no assistant message carries text; the caller falls * back to the legacy full-concatenation behavior in that case. */ export declare function extractFinalAssistantText(messages: readonly SessionMessageSnapshot[], boundary: number): string | null; /** * Build the assistant output text from session messages, * starting from the given boundary index. * * Uses the LAST assistant message that carries a non-empty text part, so * intermediate tool-result echo (misclassified as assistant text by some * adapters) never pollutes the result. Falls back to concatenating all * assistant text parts only when no assistant text exists at all. */ export declare function buildAssistantText(messages: readonly SessionMessageSnapshot[], boundary: number): string; /** * Materialize result for a completed task and notify the parent. * Only adds to notifyOutbox for final notifications (remainingTasks === 0). */ export declare function materializeAndNotify(d: TaskLifecycleDeps, taskId: string): Promise; //# sourceMappingURL=result-materializer.d.ts.map