import { type GeneratedImageReceipt, type GitFileDiff, type RetainedArtifactMetadata } from "@opengeni/sdk"; export type { GeneratedImageReceipt }; /** Recover the exit code from a sandbox exec banner (`Process exited with code N`). */ export declare function sandboxCommandExitCode(out: unknown): number | null; /** * Recover the numeric exec-session id the sandbox embeds for a STILL-RUNNING * (backgrounded) process (`Process running with session ID N`). A finished * command emits `Process exited with code N` instead, which yields `null`. */ export declare function parseExecBannerSessionId(out: unknown): number | null; /** Strip the exec banner (`Chunk ID ...\n...\nOutput:\n`) down to the command's stdout. */ export declare function stripExecBanner(out: unknown): string; /** The sandbox clamped the output (token/line truncation markers in the banner). */ export declare function execTruncated(out: unknown): boolean; /** A `write_stdin` whose target PTY vanished (`write_stdin failed: session not found: N`). */ export declare function isExecSessionLostBanner(out: unknown): boolean; /** True when the exec stdout looks binary/garbled (a NUL byte or ELF magic). */ export declare function looksBinary(text: string): boolean; /** * Render unprintable control characters as caret notation (0x03 -> `^C`) so a * `write_stdin` keystroke payload reads cleanly in the row title. */ export declare function controlCaret(printable: string): string; /** One operation inside an `apply_patch_call` (a V4A file edit). */ export type ApplyPatchOperation = { /** * The V4A op kind. The three canonical values are `create_file`, * `update_file`, and `delete_file`; the open `string` tail tolerates a * forward-compatible/unknown op kind from the provider without a type error * (it falls through to the "Edited" treatment). */ type: "create_file" | "update_file" | "delete_file" | (string & {}); path: string; /** Rename target -- when present the op is a move/rename. */ moveTo?: string | null | undefined; /** The V4A hunk string (`@@ ...` lines with `+`/`-`/context prefixes). */ diff?: string | undefined; }; /** * Parse a single V4A `apply_patch` operation into the SDK's `GitFileDiff` shape * so it can flow into the SAME `DiffView` / `PierreDiff` the Files tab uses. * Throws on a hunk string it cannot structure (no `@@` anchor on an update); the * renderer catches and falls back to a raw-patch view. */ export declare function v4aToGitFileDiff(op: ApplyPatchOperation): GitFileDiff; /** * Mirror of `@openai/agents-core` freeform `*** Begin Patch` → ops. Kept here so * the timeline can render Codex function-tool apply_patch without importing the * server SDK package. */ export declare function parseFreeformApplyPatch(rawPatch: string): ApplyPatchOperation[]; /** * Normalize every apply_patch payload the Agents SDK accepts into structured * ops — hosted `{ operation }` / `{ operations }`, function-tool `{ patch }`, * `command` tuple, flat op, freeform string, or op array. */ export declare function applyPatchOps(raw: unknown): ApplyPatchOperation[]; /** Ops from provider `raw` and/or function-tool arguments (Codex path). */ export declare function applyPatchOpsFromToolItem(item: { raw: unknown; arguments: unknown; }): ApplyPatchOperation[]; /** * True when a tool item is apply_patch — hosted `raw.type === "apply_patch_call"`, * function-tool `name` `apply_patch` / `apply_patch_call`, or an MCP-prefixed * `…__apply_patch` leaf. Centralizes the rawType-or-name check. */ export declare function isApplyPatch(item: { name: string; raw: unknown; }): boolean; /** Parse tool arguments that may arrive as a JSON string or an object. */ export declare function parseToolArgs(args: unknown): Record; /** The last non-empty line of a string -- the compact "what happened" peek. */ export declare function tailPeek(text: string): string; /** * Unwrap an MCP tool result (`{ content: [{ type: "text", text }], isError? }`) * into a flat `{ text, isError }`. Non-MCP outputs pass through as their string * form. */ export declare function unwrapMcpOutput(output: unknown): { text: string; isError: boolean; }; /** * Extract a renderable `data:` URL from a computer-use screenshot output, * whatever transport produced it. The hosted `computer_call` and the * function-text mode persist a plain `data:image/...` string; the * function-image mode (codex-backed sessions) persists the STRUCTURED image * output — `{type:"image", image:{data, mediaType}}` with `data` arriving as a * number array / index map / Buffer-JSON / base64 string after event * serialization — or the agents-core normalized `input_image` content item. * Returns null when the output carries no image (so callers fall back to their * text/empty presentation). */ export declare function screenshotDataUrl(out: unknown): string | null; /** Parse the closed retained-screenshot receipt carried by new tool events. */ export declare function retainedScreenshotMetadata(out: unknown): RetainedArtifactMetadata | null; /** Parse the closed permanent generated-image receipt from native/function tools. */ export declare function generatedImageReceipt(out: unknown): GeneratedImageReceipt | null; /** * Images a tool result returned that the platform retained, plus the result * without them, so its text renders as usual. Any tool's result content can * carry these receipts in place of its image blocks. */ export declare function retainedToolResultImages(out: unknown): { images: Extract[]; output: unknown; }; export type TimelineMediaPreview = { type: "media_preview"; mediaType: string; inlineBytes: number | null; fullOutputAvailable: false; preview: string; }; /** Find the explicit non-retained inline-media fact in a tool output. */ export declare function mediaPreviewFact(out: unknown): TimelineMediaPreview | null;