/** * The two statelog events a prompt writes, and the redaction every logged * message goes through. `_runPrompt` in prompt.ts calls these; they live * here so prompt.ts holds the tool loop and not the log format. */ import * as smoltalk from "smoltalk"; import type { PromptResult, UserContentInput } from "smoltalk"; import type { Run } from "./asyncContext.js"; import type { ProviderUsageKind } from "./invocationUsage.js"; import type { MessageThread } from "./state/messageThread.js"; import type { Tool } from "./prompt.js"; import type { DecisionLog } from "../statelog/wireTypes.js"; /** Deep copy of a thread's messages with attachment payloads (base64 / data * URIs) redacted, for statelog. Uses `toJSON()` — the same plain shape * `JSON.stringify` would emit — so wire consumers like * `wireAccessors.userMessageOf` keep working. Redaction only shortens base64 * string values, so the result is still structurally `MessageJSON[]`. */ export declare function redactMessagesForLog(messages: MessageThread): smoltalk.MessageJSON[]; /** A thread's redacted messages for statelog, each carrying its debug * label (from `llm(label:)` / `userMessage(msg, label:)`) as a top-level * `label` when it has one. The message's `metadata` is runtime * bookkeeping and is left out of the dump. `redactAttachments` is 1:1 * over an array, so index `i` is message `i`; a test pins that through * the redaction path with a real attachment. * * Unlabeled messages carry no `label` key, so logs for label-free * programs stay byte-identical. */ export declare function withMessageLabels(messages: MessageThread): (smoltalk.MessageJSON & { label?: string; })[]; /** A prompt with attachment payloads redacted, preserving its string-or-array * shape, for statelog / hook data. */ export declare function redactPromptForLog(p: string | UserContentInput): string | UserContentInput; export declare function emitPromptStart({ run, messages, tools, responseFormat, clientConfig, callLabel, usageKind, }: { run: Run; messages: MessageThread; tools: Tool[]; responseFormat?: any; clientConfig: Partial; /** This call's `llm(label:)` debug tag, or null. Observability only. */ callLabel?: string | null; usageKind: ProviderUsageKind; }): void; /** The `promptCompletion` event: the redacted thread with its labels, the * completion, the usage and cost, and for a decision model what it was * sent and what it answered. */ export declare function emitPromptCompletion({ run, messages, completion, projectedUsage, modelName, timeTaken, tools, responseFormat, stream, usageKind, decision, }: { run: Run; messages: MessageThread; completion: PromptResult; projectedUsage: PromptResult["usage"]; modelName: unknown; timeTaken: number; tools: Tool[]; responseFormat?: any; stream: boolean; usageKind: ProviderUsageKind; decision?: DecisionLog; }): void;