import { M as MeliClient } from './client-CQBMd2Qk.js'; import { z } from 'zod'; /** Operations the HITL gate covers. Stable identifiers — host code can * switch on these to render different UIs ("you're about to defend claim * X with N evidences" vs "you're about to change the price of Y"). */ type HitlOpKind = "create_item" | "update_item_price_or_stock" | "pause_item" | "close_item" | "relist_item" | "answer_question" | "defend_claim" | "opt_in_promotion" | "blacklist_asker"; /** Common envelope across all op kinds. Tool implementations wrap their * inputs into this shape before invoking the gate. */ interface HitlContext { kind: TKind; /** Stable identifier for the resource being mutated (item id, claim id, * question id, etc.) so the host UI can render a recognizable target. */ resourceId: string | number; /** Human-readable summary the host can show the user without parsing the * raw input. Always Spanish — these go in front of Argentine sellers. */ summary: string; /** Raw inputs the tool received, for advanced UIs that want to render a * diff or full preview. Don't rely on the shape — it's per-op. */ input: unknown; /** Best-effort severity hint. Hosts can use this to decide whether to * block + ask vs auto-approve via threshold rules. */ severity: "low" | "medium" | "high"; } /** * Decision returned from the host's HITL callback. * * - `{ approve: true }` — proceed with the operation. * - `{ approve: false, reason }` — abort. The tool returns * `{ ok: false, code: "hitl_rejected" }`. * - `{ approve: true, override: { ... } }` — proceed BUT replace the * tool's inputs (e.g., user * hand-edited the answer text * before approving). */ type HitlDecision = { approve: true; override?: Record; } | { approve: false; reason?: string; }; /** Sync or async — hosts often need to render a UI + await a click. */ type RequireConfirmation = (context: HitlContext) => HitlDecision | Promise; /** * Auto-approve hook. Lets the host run a fast policy decision before * popping a UI dialog. Examples: * - "any update under 5% price delta auto-approves" * - "any answer under 200 chars auto-approves" * - "create_item never auto-approves; always ask" */ type AutoApprovePolicy = (context: HitlContext) => boolean | Promise; /** Default policy — never auto-approves. Forces every irreversible op * through the user. Hosts override via `meliTools(client, { hitl })`. */ declare const denyAllAutoApprove: AutoApprovePolicy; /** Combined HITL configuration the AI-SDK toolset accepts. */ interface HitlConfig { /** Required. Called to gate every op the auto-approve policy didn't pass. */ requireConfirmation: RequireConfirmation; /** Optional. Bypasses `requireConfirmation` when it returns true. */ autoApprove?: AutoApprovePolicy; } /** Internal helper used by the AI-SDK tool wrappers. Returns the (possibly * overridden) inputs if the op is approved, or throws `HitlRejectedError` * if rejected. */ declare class HitlRejectedError extends Error { readonly context: HitlContext; readonly reason?: string | undefined; readonly code = "hitl_rejected"; constructor(context: HitlContext, reason?: string | undefined); } /** Severity classifier. Used by tool wrappers when building the context. */ declare function classifyHitlSeverity(kind: HitlOpKind): HitlContext["severity"]; declare const ShipmentStatus: z.ZodEnum<{ cancelled: "cancelled"; pending: "pending"; handling: "handling"; ready_to_ship: "ready_to_ship"; shipped: "shipped"; delivered: "delivered"; not_delivered: "not_delivered"; returned: "returned"; }>; type ShipmentStatus = z.infer; declare const ShipmentMode: z.ZodEnum<{ custom: "custom"; not_specified: "not_specified"; me1: "me1"; me2: "me2"; }>; type ShipmentMode = z.infer; declare const ShipmentLogisticType: z.ZodEnum<{ default: "default"; self_service: "self_service"; cross_docking: "cross_docking"; xd_drop_off: "xd_drop_off"; fulfillment: "fulfillment"; drop_off: "drop_off"; }>; type ShipmentLogisticType = z.infer; declare const ShipmentItem: z.ZodObject<{ id: z.ZodString; description: z.ZodOptional; quantity: z.ZodOptional; }, z.core.$strip>; type ShipmentItem = z.infer; declare const ShipmentReceiverAddress: z.ZodObject<{ id: z.ZodOptional; address_line: z.ZodOptional; street_name: z.ZodOptional; street_number: z.ZodOptional>; comment: z.ZodOptional>; zip_code: z.ZodOptional; city: z.ZodOptional; name: z.ZodOptional; }, z.core.$strip>>; state: z.ZodOptional; name: z.ZodOptional; }, z.core.$strip>>; country: z.ZodOptional; name: z.ZodOptional; }, z.core.$strip>>; receiver_name: z.ZodOptional>; receiver_phone: z.ZodOptional>; latitude: z.ZodOptional>; longitude: z.ZodOptional>; }, z.core.$strip>; type ShipmentReceiverAddress = z.infer; declare const Shipment: z.ZodObject<{ id: z.ZodNumber; status: z.ZodEnum<{ cancelled: "cancelled"; pending: "pending"; handling: "handling"; ready_to_ship: "ready_to_ship"; shipped: "shipped"; delivered: "delivered"; not_delivered: "not_delivered"; returned: "returned"; }>; substatus: z.ZodOptional>; mode: z.ZodOptional>; logistic_type: z.ZodOptional>; date_created: z.ZodString; last_updated: z.ZodOptional; tracking_number: z.ZodOptional>; tracking_method: z.ZodOptional>; service_id: z.ZodOptional>; base_cost: z.ZodOptional>; declared_value: z.ZodOptional>; origin: z.ZodOptional; sender_id: z.ZodOptional; shipping_address: z.ZodOptional; address_line: z.ZodOptional; street_name: z.ZodOptional; street_number: z.ZodOptional>; comment: z.ZodOptional>; zip_code: z.ZodOptional; city: z.ZodOptional; name: z.ZodOptional; }, z.core.$strip>>; state: z.ZodOptional; name: z.ZodOptional; }, z.core.$strip>>; country: z.ZodOptional; name: z.ZodOptional; }, z.core.$strip>>; receiver_name: z.ZodOptional>; receiver_phone: z.ZodOptional>; latitude: z.ZodOptional>; longitude: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>>; destination: z.ZodOptional; address_line: z.ZodOptional; street_name: z.ZodOptional; street_number: z.ZodOptional>; comment: z.ZodOptional>; zip_code: z.ZodOptional; city: z.ZodOptional; name: z.ZodOptional; }, z.core.$strip>>; state: z.ZodOptional; name: z.ZodOptional; }, z.core.$strip>>; country: z.ZodOptional; name: z.ZodOptional; }, z.core.$strip>>; receiver_name: z.ZodOptional>; receiver_phone: z.ZodOptional>; latitude: z.ZodOptional>; longitude: z.ZodOptional>; }, z.core.$strip>>; type: z.ZodOptional; receiver_id: z.ZodOptional; }, z.core.$strip>>; shipping_items: z.ZodOptional; quantity: z.ZodOptional; }, z.core.$strip>>>; cost: z.ZodOptional>; estimated_delivery_time: z.ZodOptional>; time_from: z.ZodOptional>; time_to: z.ZodOptional>; }, z.core.$strip>>; estimated_handling_limit: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; type Shipment = z.infer; declare const ShipmentHistoryEntry: z.ZodObject<{ status: z.ZodOptional>; substatus: z.ZodOptional>; date: z.ZodString; comment: z.ZodOptional>; }, z.core.$strip>; type ShipmentHistoryEntry = z.infer; declare const LabelFormat: z.ZodEnum<{ pdf: "pdf"; zpl: "zpl"; }>; type LabelFormat = z.infer; declare const ShippingOption: z.ZodObject<{ id: z.ZodOptional; name: z.ZodString; cost: z.ZodNumber; currency_id: z.ZodString; estimated_delivery_time: z.ZodOptional>; handling_time: z.ZodOptional; time_from: z.ZodOptional; time_to: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; display: z.ZodOptional; }, z.core.$strip>; type ShippingOption = z.infer; declare function getShipment(client: MeliClient, shipmentId: number): Promise; declare function getShipmentHistory(client: MeliClient, shipmentId: number): Promise; interface FetchLabelsInput { shipmentIds: number[]; format: LabelFormat; } /** * Fetch shipment labels as a Blob. Caller decides what to do (save to disk, * stream to user, attach to email). * * Goes through the same auth + rate-limit + retry + telemetry plumbing as * the rest of the client (via `client.fetchRaw`) — labels never get a * silent unauthenticated request and aren't excluded from per-seller rate * limiting. * * NOTE: labels invalidate after 7 days — re-fetch close to ship time. */ declare function fetchLabelsBlob(client: MeliClient, input: FetchLabelsInput): Promise; declare const ShippingOptionsResponse: z.ZodObject<{ options: z.ZodArray; name: z.ZodString; cost: z.ZodNumber; currency_id: z.ZodString; estimated_delivery_time: z.ZodOptional>; handling_time: z.ZodOptional; time_from: z.ZodOptional; time_to: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; display: z.ZodOptional; }, z.core.$strip>>; destination: z.ZodOptional; zip_code: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type ShippingOptionsResponse = z.infer; declare function getShippingOptions(client: MeliClient, itemId: string, options?: { zipCode?: string; quantity?: number; }): Promise; type shipments_FetchLabelsInput = FetchLabelsInput; type shipments_LabelFormat = LabelFormat; type shipments_ShippingOptionsResponse = ShippingOptionsResponse; declare const shipments_fetchLabelsBlob: typeof fetchLabelsBlob; declare const shipments_getShipment: typeof getShipment; declare const shipments_getShipmentHistory: typeof getShipmentHistory; declare const shipments_getShippingOptions: typeof getShippingOptions; declare namespace shipments { export { type shipments_FetchLabelsInput as FetchLabelsInput, type shipments_LabelFormat as LabelFormat, LabelFormat as LabelFormatType, type shipments_ShippingOptionsResponse as ShippingOptionsResponse, shipments_fetchLabelsBlob as fetchLabelsBlob, shipments_getShipment as getShipment, shipments_getShipmentHistory as getShipmentHistory, shipments_getShippingOptions as getShippingOptions }; } export { type AutoApprovePolicy as A, type FetchLabelsInput as F, type HitlConfig as H, LabelFormat as L, type RequireConfirmation as R, Shipment as S, type HitlContext as a, type HitlDecision as b, type HitlOpKind as c, HitlRejectedError as d, ShipmentHistoryEntry as e, ShipmentItem as f, ShipmentLogisticType as g, ShipmentMode as h, ShipmentReceiverAddress as i, ShipmentStatus as j, ShippingOption as k, ShippingOptionsResponse as l, classifyHitlSeverity as m, denyAllAutoApprove as n, fetchLabelsBlob as o, getShipment as p, getShipmentHistory as q, getShippingOptions as r, shipments as s };