UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

43 lines (42 loc) • 3.42 kB
/** * The run's accounts of a tool's media and binary content it could not hand the model as content. The loop's * post-execution half admits every media block an executed call's result carries (`admitToolResultMedia`, the last step * of `finalizeToolOutcome`) and hands each call's refusals here once (`tool_result.media_refused`, operator); an MCP * call or resource read whose server sent binary content that is not media the model reads hands what became of it here * once (`tool_result.media_persisted`, operator). The lines that stand in the result are already there, so these * seats only word the account and deliver it on the deployment's notice sink. The details carry closed-set words, * counts, the call's identity, a media type only when it can be one, and the ref each piece is kept under in the run's * tool-result store — or why it is not (with the store's own error text for the operator) — never the bytes. */ import { type EngineNotice } from "../engine-notice.js"; import { type ToolResultMediaRefusal } from "../image-admission.js"; import type { ImageDownsampler } from "../image-downsample.js"; import type { McpBinaryKept } from "../mcp.js"; /** The run's attribution pair, as every per-run notice carries it. */ export interface ToolResultMediaSeatIds { sessionId: string; runId: string; } export declare function toolResultMediaRefusedSeat(onNotice: ((notice: EngineNotice) => void) | undefined, ids: ToolResultMediaSeatIds): (info: { toolName: string; toolCallId: string; refused: readonly ToolResultMediaRefusal[]; }) => void; /** * The run's account of an MCP server's binary content (`tool_result.media_persisted`, operator): once per call or resource * read that carried any — an audio block, a resource blob the result does not carry as a media block (a type outside the media * admission's sets; a pdf for a model that reads no document; every blob a resource read returns). The model read a line naming * each piece's ref (or why it was not kept) instead of the bytes. The sentence is made of the counts: the kept half only when * something was kept, the not-kept half only when something was not, with each reason in words. The detail carries the server, the * call, and per piece its size, its media type when it can be one, and the ref — or why it was not kept (`limit` for `over_limit`; * the store's words, `saveError`, whenever the store threw — its bound refusal as well as any other throw). * `offloadStore`: whether the run has an offload store (the seat's `store`), which tells the two causes of `no_byte_store` apart. */ export declare function mcpBinaryKeptSeat(onNotice: ((notice: EngineNotice) => void) | undefined, ids: ToolResultMediaSeatIds, offloadStore: boolean): (info: McpBinaryKept) => void; /** * The run's one account of an image that goes to the model unprocessed over `IMAGE_ADMISSION.soft.targetBytes` * (`config.image_processor_unavailable`, operator): said ONCE per run, at the first such image wherever it entered — a * tool's result (the tool-result seat), the task's images or a person's attachment (the leg). The detail carries the * image's decoded size and the target — never the bytes. */ export declare function imageUnprocessedSeat(onNotice: ((notice: EngineNotice) => void) | undefined, seat: ImageDownsampler | false | undefined, ids: ToolResultMediaSeatIds): (bytes: number) => void;