/** * recordImageAsset — wire an ImageGen result into a Content piece's budget. * * The ImageGen tool closes the loop between spending USDC and tracking it * against a content project. When the agent generates a hero image for a * piece of content, this helper: * 1. Estimates the USD cost from model + size (see image-pricing.ts). * 2. Calls ContentLibrary.addAsset, which enforces the per-piece budget. * 3. Returns a structured decision so the caller (imagegen.ts) can format * a human-readable summary without swallowing budget refusals. * * This lives in `content/` on purpose — it's content-bookkeeping logic that * happens to be triggered from the ImageGen tool, not an ImageGen detail. */ import type { ContentLibrary } from './library.js'; export interface RecordImageAssetInput { contentId: string; imagePath: string; model: string; size: string; /** * Authoritative per-image USD cost resolved by the caller (e.g. from the * live gateway catalog). When omitted, falls back to the static estimate * table — which returns 0 for models it doesn't list, so callers spending * real USDC on a paid model MUST pass this or the spend bypasses the * content budget cap. */ costUsd?: number; } export type RecordImageDecision = { ok: true; costUsd: number; spentUsd: number; } | { ok: false; reason: string; }; /** * Pre-flight budget check. Run this BEFORE hitting the image-generation * endpoint so the agent doesn't spend real USDC on a fill it then can't * book against the content's budget. Returns `{ ok: true }` when the * estimated cost fits; `{ ok: false, reason }` when it doesn't or the * content doesn't exist. Non-mutating. */ export declare function checkImageBudget(library: ContentLibrary, contentId: string, model: string, size: string, count?: number, costUsdOverride?: number): { ok: true; } | { ok: false; reason: string; }; export declare function recordImageAsset(library: ContentLibrary, input: RecordImageAssetInput): RecordImageDecision;