import { VISION_JUDGE } from "./contract.js"; import type { VisionEnv } from "./env.js"; import type { CallContext, CallSetup, ImageContent, Json } from "./host.js"; import { type MediaRequest } from "./media.js"; import type { CodeGlobal } from "./see.js"; /** A question as TypeSafe's API takes it. A `box` question's `image` is the index of the image it finds a thing in * (default 0), so its answer gives that image's fragment. */ export type JevQuestion = { readonly type: "choice" | "noul" | "score" | "box"; readonly instructions?: Json; readonly criteria?: Json; readonly image?: number; }; /** What the agent's code asks: the media, the questions, example images by the reference the questions write for * them, and state fields of its own beside `images`. */ export type JudgeRequest = MediaRequest & { readonly questions: Readonly>; readonly examples?: Readonly>; readonly state?: Readonly>; }; /** Jev's answers as it gives them (a box answer with `fragment` too), its model, the price (null when the port does not * know it), the receipt filed, and `kept` when this request asked nothing. */ export type JudgeAnswer = { readonly answers: Readonly>; readonly model: string; readonly costUsd: number | null; readonly receipts: readonly string[]; readonly kept?: true; }; /** `vision.judge` as a code-mode global: the contract's words and `execute`, which asks Jev typed questions about images. */ export type JudgeGlobal = CodeGlobal; /** One image a request carries: PNG or JPEG file bytes and their type. */ export type JevImage = { readonly bytes: Uint8Array; readonly mime: "image/png" | "image/jpeg"; }; /** Jev's answer to one request as the port gives it: the typed answers, the model, its tokens, and its price, null when * the port does not know it. */ export type JevResult = { readonly answers: unknown; readonly model?: string | null; readonly usage?: { readonly input_tokens: number; readonly output_tokens: number; } | null; readonly cost_usd?: number | null; }; /** Jev as the host reaches it: `judge` is the port `@parcha/agentrun-jev`'s `createJevRunner` returns, which owns the * transport, the images header and the price; `assets` maps each reference written in the state or a question to its * image. `model` is the one to ask (default `JEV_MODEL`). */ export type JevPort = { judge(params: { readonly label: string; readonly kind: string; readonly state: unknown; readonly questions: Readonly>; readonly assets?: Readonly>; readonly model?: string; readonly signal?: AbortSignal; }): Promise; readonly model?: string; }; /** One `vision.judge` call: the media and examples read and fitted to Jev's limits, one request asked once, filed and told. */ export declare function judge(input: unknown, env: VisionEnv | undefined, call: CallContext, setup: CallSetup): Promise;