UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

404 lines (403 loc) • 30.6 kB
/** * The USER-ATTACHMENT SEAT — the one road a file the user hands the model takes: * * the host declares it on the objective (`TaskSpec.userAttachments`) → the engine screens the declaration at the * door → after the UserPromptSubmit hook lets the objective through, the engine reads a path entry with the Read * tool's own read (`ModelFileReader.readForModel`) under the run's synthetic-Read judge, or takes the host's bytes → * it mints ONE message per attachment that trails the human message: an engine note whose marked blocks hold only * static sentences and whose data (the name or path, then the contents or the refusal) sits between them → the * message's delivery record (`UserMessage.attachment`) is the one source of "what was delivered". * * This module owns the three steps no other module may repeat: the screen (`screenUserAttachments`), the mint * (`readUserAttachments` → the frame seeds, the `human_input` projection and the pending commits) and the settlement * (`createAttachmentDelivery`: a read's effects commit when its frame reaches the transcript, keyed by * `(inputId, ordinal)` — never at read time, never by text). * * The frame, per attachment (blocks in order): * <system-reminder mark="…">\n<opening sentence>\n</system-reminder>\n — static, the attachment's number only * Path: "<declared path>"\n or Name: "<name>"\n — data (lossless quoted label) * <data blocks> — the file's own blocks / the refusal * \n\n<system-reminder mark="…">\n<note sentence>\n</system-reminder> — one per engine note, static * \n\n<system-reminder mark="…">\nEnd of attachment <n>.\n</system-reminder> * Every marked block after data opens after a blank line (`MARKED_BLOCK_AFTER_DATA`): the completions lanes join a * message's text blocks with no separator. */ import type { ImageContent, Model, TextContent, UserAttachmentObservation, UserAttachmentSupply, UserMessageAttachment } from "../internal/llm.js"; import type { ExtensionRequester, HumanInputAttachment } from "./task-event.js"; import { type ModelFileReader, type ReadNote } from "../tools/fs/fs-read.js"; import { type ImageDownsampler } from "./image-downsample.js"; import type { SyntheticReadJudge } from "./synthetic-read-verdict.js"; import { type ReminderDisclosureCounts } from "./reminder-disclosure.js"; import { type AgentMessage } from "../internal/harness.js"; import { type ReadEntry } from "../tools/fs/safety.js"; import { type CopyProjectionInput } from "./request-copy-projection.js"; import type { ContextWindowOverlay } from "./context-settings.js"; import { type LegModBus } from "./mods/stations.js"; import { type ToolRoster } from "./tool-roster.js"; /** At most this many attachments on one objective. */ export declare const USER_ATTACHMENTS_MAX = 20; /** The longest path or name an entry may carry (the platform path limit). */ export declare const USER_ATTACHMENT_LABEL_MAX = 4096; /** What the engine found an attachment to be (an output, never declared): the Read lanes, a directory, host bytes. */ export declare const USER_ATTACHMENT_KINDS: readonly ["text", "notebook", "image", "pdf", "directory", "client_text", "client_image"]; /** Who held the bytes — the entry's arm. */ export declare const USER_ATTACHMENT_SUPPLIES: readonly ["path", "content_text", "content_image"]; /** What reached the model of an attachment's contents — the Read layer's own outcome words, the same frozen array. */ export declare const USER_ATTACHMENT_OUTCOMES: readonly ["attached", "partial", "not_attached"]; /** * Why an attachment's contents were not attached, as the engine's own frame states it: the one table the frame's notes * (each word is a note with a static sentence) and the attachment record's `reason` ({@link HumanInputAttachment.reason} — * `human_input.attachments[]`, `compacted.restoreOutcomes[]`) both read. `rule_denied` is one word for every step that finds a * permission rule refusing the read: the synthetic-Read judge's deny and a deny row of the read-deny table at the path's * resolution. `too_large` is one word for every frame whose contents did not fit the share its origin bounds * ({@link fitContentsInOrder}): a person's path attachment past the room its first request had left, a compaction restore's file * over its per-file or total share — the frame names the file and the size of what was read, no part of it. `read_failed` is three * steps' word: the file or directory could not be opened, a directory could not be listed, a compaction restore's judgment or read * threw (the error is in the frame's data, bounded), or a compaction restore's Read refused a file the environment will not open * (a file it finds gone: the same word a person's attachment of that file says — {@link refusedRestore}). A read that RETURNS its * failure as a refusal — the bytes of an opened file fail to read — is a read refusal given as data and carries no word: the Read * layer gives it no machine card to read one off. A refusal with none of these words (a read refusal given as data that no rule * made — the path's resolution refused it, outside the roots say —, an extension's decline, a host image that did not admit) * carries no reason. */ export declare const ATTACHMENT_REFUSAL_REASONS: readonly ["cannot_bind", "rule_denied", "approval_required", "admission_unknown", "target_moved", "too_large", "read_failed"]; export type AttachmentRefusalReason = (typeof ATTACHMENT_REFUSAL_REASONS)[number]; /** * The seat's capability descriptor — what a host reads to decide, per attachment, whether to declare it here: its kind * is in `kinds` and its arm in `supplies` ⇒ declare it on the objective; otherwise (a kind this seat does not carry, or * an engine without the descriptor) the host carries it some other way. `entries`: the objective only — a steer carries * no attachments (they go with the next objective). */ export declare const USER_ATTACHMENT_SEAT: Readonly<{ entries: readonly ["objective"]; kinds: readonly ["text", "notebook", "image", "pdf", "directory", "client_text", "client_image"]; supplies: readonly ["path", "content_text", "content_image"]; limits: Readonly<{ maxEntries: 20; maxRenderedTextChars: number; }>; }>; /** One declaration as the door captured it: the caller's object read once, members copied. */ export type ScreenedUserAttachment = { readonly supply: "path"; readonly path: string; readonly lines?: { readonly start: number; readonly end?: number; }; } | { readonly supply: "content_text"; readonly name: string; readonly text: string; readonly startLine: number; readonly rendered: string; } | { readonly supply: "content_image"; readonly name: string; readonly data: string; readonly mimeType: string; }; /** * The field a refusal names, as one value: `path` is the field path the sentence opens with, and `index` the attachment's * position in the seat (0-based, the `[i]` of that path) — present exactly when the sentence names one attachment; a refusal of * the seat as a whole (not a list, too many, a resume, the window) has no index. Built only by {@link SEAT_REF} / * {@link entryRef} / {@link memberRef}, so the index and the path can never name two attachments. */ export interface UserAttachmentFieldRef { readonly path: string; readonly index?: number; } /** * What a `config.user_attachment_invalid` refusal asks its caller to change — `detail.reason`, on every refusal of the code: * `invalid_value` — the entry (or the seat's list) as written: fix it; `no_workspace` — a `path` entry on a run with no workspace to * read it from: send the bytes as a `text` / `image` entry, or run where there is a workspace; `resume_leg` — a durable resume sends * no new human message, so it carries none: declare them on a new objective; `over_window` — what the engine cannot shed from the * objective's first request (the objective with every frame the engine puts ahead of it, the host's own bytes, each `path` entry * named without its contents, and the task-root instruction files the request holds) does not fit one request on the run's model * beside its fixed prompt: attach fewer or smaller parts. A `path` entry whose contents do not fit is not a refusal: it is named, not * sent (`too_large`, {@link fitObjectiveToWindow}) — unless it is such an instruction file, which is never named. */ export declare const USER_ATTACHMENT_INVALID_REASONS: readonly ["invalid_value", "no_workspace", "resume_leg", "over_window"]; export type UserAttachmentInvalidReason = (typeof USER_ATTACHMENT_INVALID_REASONS)[number]; /** A refusal's `detail`: the field it names ({@link UserAttachmentFieldRef}) and what the caller has to change. */ export interface UserAttachmentRefusalDetail extends UserAttachmentFieldRef { readonly reason: UserAttachmentInvalidReason; } /** The door's refusal: one code, the field named first in the sentence and again in `detail`, with its reason. */ export declare function userAttachmentRefusal(at: UserAttachmentFieldRef, reason: UserAttachmentInvalidReason, problem: string): Error & { code: "config.user_attachment_invalid"; detail: UserAttachmentRefusalDetail; }; /** * The door: screen the seat's value (synchronous; the caller's object is read once, member by member, before the * first await of the run). `undefined` / an empty array ⇒ no attachments. `resumeLeg`: a durable resume mints no new * human message, so any entry there is refused. Throws `config.user_attachment_invalid` naming the field. */ export declare function screenUserAttachments(seat: unknown, opts: { resumeLeg: boolean; }): readonly ScreenedUserAttachment[] | undefined; /** Does an attachment the engine reads by path stand among them (the run has to read it from a workspace)? */ export declare function userAttachmentsNeedWorkspace(screened: readonly ScreenedUserAttachment[] | undefined): boolean; /** A path entry on a run with no workspace: there is nothing the engine could read it from. */ export declare function refuseUserAttachmentPathsWithoutWorkspace(screened: readonly ScreenedUserAttachment[] | undefined): void; /** One declared attachment as the UserPromptSubmit hook sees it (`UserPromptSubmitContext.userAttachments`). */ export interface UserAttachmentDeclaration { /** 1-based position among the objective's attachments. */ readonly ordinal: number; /** Who holds the bytes: `path` (the engine reads it), `content_text` / `content_image` (the host sent them). */ readonly supply: UserAttachmentSupply; readonly path?: string; readonly name?: string; /** A host entry's size in bytes (text as UTF-8, an image decoded). */ readonly bytes?: number; } /** The UserPromptSubmit hook's view of the declarations. */ export declare function userAttachmentDeclarations(screened: readonly ScreenedUserAttachment[]): readonly UserAttachmentDeclaration[]; /** * The host images' byte admission — the one function an image the Read tool serves passes, with the run's processor. * Asynchronous (it decodes), run on the captured values before any attachment is read or delivered. Throws * `config.user_attachment_invalid`. */ export declare function admitUserAttachmentImages(screened: readonly ScreenedUserAttachment[], processor: ImageDownsampler | "none"): Promise<ReadonlyMap<number, ImageContent>>; /** The file tools a frame's sentences may send the model to: the ones the run's roster mounts. A sentence never names a tool the * run cannot call — on a run without it, the sentence says what was not shown and that this run cannot read it. */ export interface FrameFileTools { readonly read: boolean; readonly grep: boolean; } /** The run's {@link FrameFileTools}, read off its roster by the one reading of a mounted tool (`toolCallFaceOf`, aliases resolved). */ export declare function frameFileToolsOf(roster: ToolRoster | undefined): FrameFileTools; /** The posture the task root's instruction frame asks of the model: the project's standing context is background it * already knows (a small model shown the content alone stays project-aware but passive on an open-ended turn). */ export declare const PROJECT_CONTEXT_POSTURE = "Treat it as background you ALREADY know: when the user greets you or asks something open-ended, orient your reply to THIS project \u2014 name it and engage with its specifics rather than asking what project this is."; /** The owner an instruction frame's opening reminder names (its `It is <owner word> …` sentence, as {@link instructionFramingClause} * minted it); none where the opening names no owner word. */ export declare function instructionFrameOwnerOf(opening: string): InstructionOwner | undefined; /** The transmission an attachment frame is (the read-state entry its delivery records carries it): when the frame leaves * the request — a trim drops it — the entry retires with it. One spelling for the mint and every remover; an instruction * file's frame spells its origin's word in place of {@link FRAME_TRANSMISSION_PREFIX}, so a witness says on itself that the * engine's load, not an access, delivered the body. */ export declare function attachmentTransmissionId(a: Pick<UserMessageAttachment, "inputId" | "ordinal" | "origin">): string; /** Did an instruction file's frame — of either layer — deliver the body this read-state entry stands for? Read off the entry's * newest witness ({@link ReadEntry.witnesses}, oldest first): the delivery that last carried the body decides, so a Read of * the file since makes it the conversation's own access, and the lane's frame decides again once that Read's copy leaves. */ export declare function isInstructionLaneEntry(e: Pick<ReadEntry, "witnesses">): boolean; /** The transmission a message is, when it can carry a read: an attachment frame (its spelling above), a tool result (its * call id) — the read-state entry its delivery recorded carries it. */ export declare function messageTransmission(m: AgentMessage): string | undefined; /** The transmissions a request-view drop took out: those of `view`'s messages that no message of `kept` still carries (a * reused call id kept elsewhere is not gone). The guard trim retires the read-state entries they delivered (the edit * gate then asks for a fresh read); a later read of the same file is a transmission of its own and stays. */ export declare function droppedTransmissions(view: ReadonlyArray<AgentMessage>, kept: ReadonlyArray<AgentMessage>): string[]; /** One minted frame: the trailing message's seed, and the commit its delivery owes (absent ⇒ nothing to commit). */ export interface MintedAttachmentFrame { readonly seed: { readonly content: ReadonlyArray<TextContent | ImageContent>; readonly attachment: UserMessageAttachment; }; readonly commit?: () => void; /** The extension a `prompt.mention` outcome names as this attachment's refuser ({@link HumanInputAttachment.declinedBy}, which * {@link humanInputAttachmentsOf} projects it into). Not part of the transcript record: the `human_input` frame is built from the * frames this run just minted. */ readonly declinedBy?: ExtensionRequester; } export interface ReadUserAttachmentsInput { screened: readonly ScreenedUserAttachment[]; /** The human input the attachments belong to (minted before the frames and the event, shared by both). */ inputId: string; /** The leg's one file reader (absent on a run without a workspace — then only host entries exist). */ reader: ModelFileReader | undefined; /** The run's synthetic-Read judge. */ judge: SyntheticReadJudge; /** The admitted host images, by ordinal. */ images: ReadonlyMap<number, ImageContent>; mark: string | undefined; counts: ReminderDisclosureCounts | undefined; signal: AbortSignal; /** The leg's bus, where `prompt.mention` is raised for each attachment (absent ⇒ none is raised), and the delegated * leg's id its events carry. */ mentions?: { readonly bus: LegModBus; readonly agentId?: string; }; /** The file tools the run's roster mounts ({@link frameFileToolsOf}) — what the frames' sentences may send the model to. Absent * on a mint outside a Runner: every tool a sentence names is taken as mounted. */ fileTools?: FrameFileTools; } /** * Read every declared attachment and mint its frame. Side-effect free toward the run: nothing is committed here — each * frame carries the commit its delivery owes, run only when the frame is in the transcript. */ export declare function readUserAttachments(input: ReadUserAttachmentsInput): Promise<MintedAttachmentFrame[]>; /** The git status frame the first request's guard protects: inside the objective's message (its engine prefix), on the * image form as its own engine message queued ahead of it (`standalone`), or — the snapshot unchanged since an earlier * run — the carrier already in the session view; `substitute` is its one degraded rendering. */ export interface ObjectiveGitFrame { readonly wrapped: string; readonly standalone: boolean; readonly substitute?: { readonly find: string; readonly replace: string; }; } /** The first request as the objective lane holds it once every pre-append gate has passed: the session view the request * starts from (its compaction summaries are part of every request), the objective's message exactly as it will be sent * (every frame the engine puts ahead of the person's words, its images, its engine-prefix length), the git frame it * carries, and the objective's attachment frames. `named`: per frame, in the same order, the frame it becomes when its * contents do not fit ({@link namedOnly}) — present for a `path` entry with contents to shed, absent for a frame with * nothing to shed (the host's bytes, a refusal, a file the request carries anyway). `trailing`: the engine frames the * request carries after the attachment frames (the instruction files the leg's first load owes), given the canonical keys * the kept attachment frames carry (a file an attachment carries is not loaded beside it) — read without loading anything. * `protectedTexts`: the engine frame texts the request guard holds wherever their newest carrier is (the permission * posture's). `overheadTokens`: the fixed prompt (system prompt and tool schemas) every request carries beside its * messages (`Prepared.promptOverheadTokens`, the count the request guard reads); absent ⇒ 0. `copies`: what the request's * copy projection renders with beyond the view (the session's reminder mark, the leg's seeded files), as the guard's. */ export interface ObjectiveRequest { readonly history: readonly AgentMessage[]; readonly objective: AgentMessage; readonly git?: ObjectiveGitFrame; readonly frames: readonly MintedAttachmentFrame[]; readonly named?: ReadonlyArray<MintedAttachmentFrame | undefined>; readonly trailing?: (keys: readonly string[]) => readonly MintedAttachmentFrame[]; readonly protectedTexts?: readonly string[]; readonly overheadTokens?: number; readonly copies?: Pick<CopyProjectionInput, "mark" | "seeded">; } /** * The window check: the request build's own verdict on the first request, read before that request exists — and the * frames the first request then carries. The request guard sends a request whose count (`estimateContextTokens`, * billed-anchored; the fixed prompt in it where no usage report holds the rows) is under its line as it is. Over it, the * request's irreducible core — the summaries, the objective and its frames, the engine frames it holds beside them * ({@link heldEngineFrames}) — is the admission's to judge, and it asks two questions of its own, predicting none of the * guard's later reliefs. The same functions answer them here over the view the first request will be (the session view, a * standalone git frame, the objective's message, its frames, the instruction files the leg's first load owes after them). * - A request under the line, or over it with a core that fits with no relief — measured alone, within the line with the * git frame full, and within the room the guard's sizing leaves the rows (`rowsRoom(line, requestSizingOf(…))`) — carries * every frame as minted (byte for byte). * - Otherwise the frames take the one contents share ({@link fitContentsInOrder}): each `path` entry with contents keeps * them, in declared order, while the core with them still fits so; it is otherwise named, not sent (`too_large`). * - Only when what cannot be shed — the objective, the frames around it (those ahead of it, the instruction files after the * attachments), the host's bytes, every `path` entry named — is over the line even with the git frame's shrink (the one * relief that is said, `onError`, `degraded`) is the whole objective refused (`over_window`): a core over the line has no * honest request. * The check runs where the core first exists whole — after the reads (a path entry's size is known only once it is read) * and after the frames the engine puts ahead of the objective — and before anything is appended, sent or committed, so the * account the run then publishes is true by construction. A model with no declared window has no line (`guardBudget` * answers +∞ and the guard does not engage either), so nothing is shed or refused for it. */ export declare function fitObjectiveToWindow(request: ObjectiveRequest, model: Model, overlay: ContextWindowOverlay | undefined): MintedAttachmentFrame[]; /** The objective as the lane hands it over once its message is whole: the exact text it is sent with (every frame the * engine puts ahead of the person's words included), how many images ride it, and a reader of the live overlay over the * model's window declarations (the same seat the request guard reads). The overlay is a GETTER because it is read when * the frames exist, not when the call is made: the reads are asynchronous and a deployment may swap its window * declarations meanwhile, as it may before any request. */ export interface ObjectiveWindowInput { readonly text: string; /** How many leading characters of `text` the engine wrote — the message's `enginePrefixChars`. */ readonly prefixChars: number; readonly images: number; readonly git?: ObjectiveGitFrame; readonly overlay: () => ContextWindowOverlay | undefined; } /** The objective lane's read: once the UserPromptSubmit hook let the objective through (a blocked objective reads * nothing and is held by nothing), once every frame the engine puts ahead of the objective is composed, and before the * pre-call gate, which prices the frames (`chars`). Names the objective input the request guard's trim holds * (`prepared.requestCoreRef.objective`: the text and this id, which the frames carry — read by the guard only once a * request is built). Fits the frames to the first request's window, over the session view the turn will start from * ({@link fitObjectiveToWindow}: a `path` entry whose contents do not fit is named, not sent; the whole objective is refused * only when what cannot be shed does not fit) — the frames returned are the ones the run delivers. Commits nothing. * `imageSeat` is the run's image processor seat (`RunnerDeps.imageProcessor`): the host images are admitted with it (a path's * image is read by the reader, with the same seat), and the first image of the frames sent unprocessed over the soft target is * told to `prepared.imageUnprocessed` — after the window check, so a refused objective tells of nothing sent. */ export declare function readObjectiveAttachments(prepared: Pick<import("./runner/contracts.js").Prepared, "userAttachments" | "modelFileReader" | "syntheticReadVerdict" | "reminderMark" | "reminderDisclosureCounts" | "abortController" | "harness" | "session" | "modBus" | "hookIdentity" | "imageUnprocessed" | "requestCoreRef" | "nestedMemory" | "postureFrameRef" | "promptOverheadTokens" | "seededCopies" | "toolRoster">, inputId: string, blocked: boolean, objective: ObjectiveWindowInput, imageSeat: ImageDownsampler | false | undefined): Promise<{ frames: MintedAttachmentFrame[]; chars: number; }>; /** What a compaction's restore reads with: the leg's one file reader (the Read tool's) and the run's synthetic-Read judge. * What became of each file is its frame's record — the `compacted` frame's `restoreOutcomes`. */ export interface CompactionRestoreSeat { readonly reader: ModelFileReader; readonly judge: SyntheticReadJudge; readonly mark: string | undefined; readonly counts: ReminderDisclosureCounts | undefined; readonly signal: AbortSignal; /** The file tools the run's roster mounts at the restore ({@link frameFileToolsOf}); absent outside a Runner — every one taken as mounted. */ readonly fileTools?: () => FrameFileTools; } /** One restore: the files to re-read (most recent first) and its bounds. */ export interface CompactionRestoreRequest { readonly candidates: readonly string[]; readonly maxFiles: number; /** What one file may deliver, in its own characters (before the Read's line numbers); an image the estimator's fixed * weight × `charsPerToken`. A file over it, or whose frame would send more of its contents (line numbers included) * than what is left of `totalChars`, is named, not sent. */ readonly perFileChars: number; readonly totalChars: number; readonly charsPerToken: number; } /** The synthetic-Read judge's probe face for the restore (probe id `compaction-restore-visibility-probe`). */ export declare const COMPACTION_RESTORE_PROBE_FACE = "compaction-restore"; /** * Re-read the files a compaction restores and mint their frames — each a Read on the model's behalf ({@link readRestored}); * the frame is the attachment seat's own and carries the file's contents. Whether a request sends them is the request's * own projection (`request-copy-projection.ts`): a restore frame of contents the request already carries — a copy in the * kept tail, the leg's seeded file — is rendered as that copy's repeat there. A file over its share is a frame that names * it and says it is too large (no part of its contents; `too_large`, the one contents share {@link fitContentsInOrder}); a * refused file is a frame with the reason. Side-effect free toward the run: each frame carries the commit its delivery owes. */ export declare function readCompactionRestore(seat: CompactionRestoreSeat, req: CompactionRestoreRequest): Promise<MintedAttachmentFrame[]>; /** Which level an instruction file belongs to: a root's own (the session's instructions — the task root's, an additional * working directory's) or one below the task root. */ export type InstructionLayer = "root" | "nested"; /** Whose text an instruction frame carries: `repository` — a file of the workspace, or a deployment's text of a directory above the * task root; `deployment` — a user's or an organization's text the deployment holds; `local` — the user's private file of a project * (not checked in), from the workspace or held by the deployment. */ export declare const INSTRUCTION_OWNERS: readonly ["repository", "deployment", "local"]; export type InstructionOwner = (typeof INSTRUCTION_OWNERS)[number]; /** One instruction file (of a root's own level, or of an accessed directory) or a text the deployment supplied (of the root * layer, or a rule for an accessed path), as the instruction-file lane read and cut it: the text the model is shown, the cut's * own note, and — for a file — the read-state entry its delivery records (`record`, handed the frame's transmission when the * frame is in the transcript). `withdraws`: the frame withdraws the file or text delivered earlier (no data; a file's record * deletes its entry). `included`: the file was loaded through an `@` include — its owner is its includer's, its frame DATA. */ export interface NestedMemoryRead { readonly supply: "path" | "content_text"; readonly owner: InstructionOwner; readonly included?: true; readonly layer: InstructionLayer; readonly label: string; readonly text: string; readonly cut?: Extract<ReadNote, { kind: "partial_page" | "partial_chars"; }>; readonly observation?: UserAttachmentObservation; readonly withdraws?: true; readonly record: (transmission: string) => void; } /** Mint the frames of one load — attachment frames of origin `project_instructions` (the root layer: a file of a root's own * level, a deployment's text for the task) or `nested_memory` (a file below it, a deployment's rule), one per file or text, * under one input id; each frame's commit records what its read owes once the frame is in the transcript. A withdrawal * carries no data. */ export declare function mintInstructionFrames(reads: readonly NestedMemoryRead[], seat: { readonly reader: ModelFileReader | undefined; readonly mark: string | undefined; readonly counts: ReminderDisclosureCounts | undefined; readonly fileTools?: FrameFileTools; }): { inputId: string; frames: MintedAttachmentFrame[]; }; /** The attachment records of minted frames — the one projection both frames that introduce attachments read: a person's on * `human_input.attachments`, a compaction restore's on `compacted.restoreOutcomes`. */ export declare function humanInputAttachmentsOf(frames: readonly MintedAttachmentFrame[]): HumanInputAttachment[]; /** * The run's pending attachment commits, keyed by `(inputId, ordinal)`. A frame's commit runs exactly once, when the * harness reports that frame in the transcript; a frame that never got there (a refused pre-call budget, an abort, a * failed append) commits nothing — its entry is simply never settled. */ export interface AttachmentDelivery { /** Stage the minted frames of one input — called only once every gate before the append has passed. */ stage(inputId: string, frames: readonly MintedAttachmentFrame[]): void; /** The frame `(inputId, ordinal)` is in the transcript: run its commit (once) and forget it. */ settle(inputId: string, ordinal: number): void; } export declare function createAttachmentDelivery(): AttachmentDelivery;