import { z } from "zod"; import type { AutomationId } from "./automation.js"; import { type AppId, type ApprovalId, type IsoDateTime } from "./ids.js"; import type { ToolDescriptor } from "./tools.js"; /** * Existing-agents contract — the versioned tool-output envelopes a BYO agent * loop receives from the Vendo tool pack (same `kind: "vendo/@1"` * pattern as the MCP door's `vendo/open-in-product@1` card). A `vendo_*` tool * returns either one of these small JSON refs — which the host's chat renders * with the matching embed component — or plain data, meaning the action * executed cleanly and the agent consumes the result like any tool output. * Frozen by this file's exported shape and its tests. */ export declare const VENDO_APP_REF_KIND: "vendo/app-ref@1"; export declare const VENDO_APPROVAL_REF_KIND: "vendo/approval-ref@1"; export declare const VENDO_AUTOMATION_REF_KIND: "vendo/automation-ref@1"; /** `vendo_make` returned fast: the build was ACCEPTED and is still * streaming over the wire — the app is NOT built yet. `` mounts * it by this ref and shows live build progress, the finished app, or the build * failure itself, so the model must not claim the app is created/ready/done. * `status` is always `"building"` — a MACHINE-readable field, not prose, so a * model that skims past the tool description still cannot mistake this for a * finished, describable resource: given an envelope carrying only an appId and * a title, observed conversations narrated a fabricated, finished dashboard. * A build that terminally fails is never wrapped in this ref — * see `appRefFromReceipt` in `@vendoai/vendo`. */ export interface VendoAppRef { kind: typeof VENDO_APP_REF_KIND; appId: AppId; /** Display title for the embed's chrome while the build streams. */ title: string; /** Always "building": this envelope never means done, win or lose. */ status: "building"; } /** A guarded call parked on approval: the model sees "pending — the user must * approve in the UI"; `` resolves it in place. */ export interface VendoApprovalRef { kind: typeof VENDO_APPROVAL_REF_KIND; approvalId: ApprovalId; /** Human-readable line for the model and the embed: what is waiting. */ summary: string; } /** What `vendo_automate` returns: the record it just armed, in one line the * model and the embed both read. */ export interface VendoAutomationRef { kind: typeof VENDO_AUTOMATION_REF_KIND; automationId: AutomationId; summary: string; armed: boolean; /** Computed on read from `when` — never a stored column, and absent for * event/webhook records, which have no next run. */ nextRunAt?: IsoDateTime; } export type VendoToolEnvelope = VendoAppRef | VendoApprovalRef | VendoAutomationRef; /** Readers tolerate unknown extra fields — additive evolution stays within @1; * anything breaking bumps the kind. */ export declare const vendoAppRefSchema: z.ZodObject<{ kind: z.ZodLiteral<"vendo/app-ref@1">; appId: z.ZodString; title: z.ZodString; status: z.ZodLiteral<"building">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodLiteral<"vendo/app-ref@1">; appId: z.ZodString; title: z.ZodString; status: z.ZodLiteral<"building">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodLiteral<"vendo/app-ref@1">; appId: z.ZodString; title: z.ZodString; status: z.ZodLiteral<"building">; }, z.ZodTypeAny, "passthrough">>; export declare const vendoApprovalRefSchema: z.ZodObject<{ kind: z.ZodLiteral<"vendo/approval-ref@1">; approvalId: z.ZodString; summary: z.ZodString; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodLiteral<"vendo/approval-ref@1">; approvalId: z.ZodString; summary: z.ZodString; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodLiteral<"vendo/approval-ref@1">; approvalId: z.ZodString; summary: z.ZodString; }, z.ZodTypeAny, "passthrough">>; export declare const vendoAutomationRefSchema: z.ZodObject<{ kind: z.ZodLiteral<"vendo/automation-ref@1">; automationId: z.ZodString; summary: z.ZodString; armed: z.ZodBoolean; nextRunAt: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodLiteral<"vendo/automation-ref@1">; automationId: z.ZodString; summary: z.ZodString; armed: z.ZodBoolean; nextRunAt: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodLiteral<"vendo/automation-ref@1">; automationId: z.ZodString; summary: z.ZodString; armed: z.ZodBoolean; nextRunAt: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; export declare const vendoToolEnvelopeSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{ kind: z.ZodLiteral<"vendo/app-ref@1">; appId: z.ZodString; title: z.ZodString; status: z.ZodLiteral<"building">; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodLiteral<"vendo/app-ref@1">; appId: z.ZodString; title: z.ZodString; status: z.ZodLiteral<"building">; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodLiteral<"vendo/app-ref@1">; appId: z.ZodString; title: z.ZodString; status: z.ZodLiteral<"building">; }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{ kind: z.ZodLiteral<"vendo/approval-ref@1">; approvalId: z.ZodString; summary: z.ZodString; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodLiteral<"vendo/approval-ref@1">; approvalId: z.ZodString; summary: z.ZodString; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodLiteral<"vendo/approval-ref@1">; approvalId: z.ZodString; summary: z.ZodString; }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{ kind: z.ZodLiteral<"vendo/automation-ref@1">; automationId: z.ZodString; summary: z.ZodString; armed: z.ZodBoolean; nextRunAt: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodLiteral<"vendo/automation-ref@1">; automationId: z.ZodString; summary: z.ZodString; armed: z.ZodBoolean; nextRunAt: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodLiteral<"vendo/automation-ref@1">; automationId: z.ZodString; summary: z.ZodString; armed: z.ZodBoolean; nextRunAt: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>]>; /** The ONE producer of `vendo/approval-ref@1`, so the two venues that park a * guarded call — the tool pack in a BYO agent loop, and the MCP door — cannot * describe the same parked call two different ways. Lived in `pack.ts` until * the door needed to mint one too. * * The summary is state-free on purpose. It is minted ONCE, and * `` titles the card with it for the rest of the request's * life — so a lifecycle claim baked in here outlives the lifecycle: it read * "Awaiting user approval: …" over "Approved — ran" on every settled receipt. * The state belongs to whoever knows it at render time. */ export declare function vendoApprovalRef(approvalId: ApprovalId, descriptor: ToolDescriptor, args: unknown): VendoApprovalRef; /** The `` dispatch: give it any `vendo_*` tool output and get * the typed envelope to render, or null for plain data (and for a malformed * envelope — the tool pack is the only writer, so a bad shape is a bug there, * not something for a foreign chat surface to half-render). */ export declare function parseVendoToolEnvelope(output: unknown): VendoToolEnvelope | null;