/** * @module koi-runner-payloads * * Post-processes raw LLM reply payloads before delivery: strips stray * HEARTBEAT_OK tokens from non-heartbeat replies, applies reply-threading * (replyToId), parses inline directives (media URLs, reply tags), and * filters out duplicates already sent via the messaging tool. * * Key export: {@link buildReplyPayloads} */ import type { ReplyToMode } from "../../config/types.js"; import type { OriginatingChannelType } from "../templating.js"; import type { ReplyPayload } from "../types.js"; import { type BlockReplyPipeline } from "./block-reply-pipeline.js"; import { shouldSuppressMessagingToolReplies } from "./reply-payloads.js"; /** * Tools whose successful execution counts as *evidence* the model actually * checked something instead of answering from stale training memory. The * factual-verification gate requires at least one of these in the run for a * claim-shaped reply to be delivered with confidence. */ export declare const FACTUAL_RETRIEVER_TOOLS: Set; /** * Cheap shape-detector for "this reply is making a factual claim about * something external/current" — the class of answer that embarrassed us in * prod when it was produced from memory. Deliberately conservative: it only * fires on explicit verifier/verdict markers ("the answer is", "yes it can", * "no, it can't", "confirmed", "checked", "source", "according to") or * questions-turned-declarations about current state, never on casual chat. */ export declare function isClaimShapedReply(text: string): boolean; export declare function hasRetrieverEvidence(toolNamesUsed: readonly string[] | undefined): boolean; export declare function buildReplyPayloads(params: { payloads: ReplyPayload[]; isHeartbeat: boolean; didLogHeartbeatStrip: boolean; blockStreamingEnabled: boolean; blockReplyPipeline: BlockReplyPipeline | null; /** Payload keys sent directly (not via pipeline) during tool flush. */ directlySentBlockKeys?: Set; replyToMode: ReplyToMode; replyToChannel?: OriginatingChannelType; currentMessageId?: string; messageProvider?: string; messagingToolSentTexts?: string[]; messagingToolSentTargets?: Parameters[0]["messagingToolSentTargets"]; originatingTo?: string; accountId?: string; /** Names of tools executed during this run; consumed by the factual gate. */ toolNamesUsed?: readonly string[]; }): { replyPayloads: ReplyPayload[]; didLogHeartbeatStrip: boolean; };