/** * Builds the typed `structuredContent` for analyze results (spec §9.2, §10.1). * * One credit is one billable lens run on one photo and costs $0.01. The API * reports `usage.creditsSaved` and `usage.usd`; an older API that omits them * gets the same numbers computed here from `creditsCharged` and * `meta.cacheHit`. */ import type { AnalyzeResponse, EnrichResponse, LookupResponse } from '@phototology/sdk'; import type { AnalyzePhotoOutput, EnrichPhotoOutput, LookupPhotoOutput } from '../schemas'; /** The lenses in `modules` that bill a credit each. */ export declare function billableLenses(modules: readonly string[]): string[]; /** The lenses in `modules` that own output, so a registry entry can hold them. */ export declare function outputLenses(modules: readonly string[]): string[]; /** Dollar amount for a credit count, as a string with two decimals ("0.05"). */ export declare function usdFromCredits(n: number): string; /** The MCP resource that serves a photo's registry record. */ export declare function photoResourceUri(sha256: string): string; /** * The sha256 that names an analyzed photo. Only a live response's fingerprint * counts: the `pt_test_` sandbox answers with a placeholder (64 zeros) that * names no real photo. Otherwise the bytes the caller sent are hashed; a URL * with no live fingerprint has no name, and the result is ''. */ export declare function analyzedPhotoSha256(res: AnalyzeResponse, base64?: string): string; /** A `resource_link` content block pointing at the photo resource. */ export declare function photoResourceLink(sha256: string): { type: 'resource_link'; uri: string; name: string; mimeType: 'application/json'; }; /** * Reshape an SDK analyze response into the `analyze_photo` envelope. * * `photoSha256` names the photo (see `analyzedPhotoSha256`). When it is empty * the photo has no resource and `resource` is omitted. The fingerprint's * perceptual hashes are used only from a live response, since the sandbox's * are placeholders too. * * `id`, `meta`, `warnings` and `embedding` ride along as extra fields so * nothing the old text result carried is lost. */ export declare function toAnalyzeEnvelope(res: AnalyzeResponse, photoSha256: string): AnalyzePhotoOutput; /** * Flatten an SDK lookup response into the `lookup_photo` envelope. * * A lookup asks about one image, so `results` holds at most one entry; an * empty map (the API could not fingerprint the image) reads as a miss. * `matchType`, `photo`, `hammingDistance` and `computedHashes` pass through. * `receipts` defaults to `[]` and `credentials` appears only when the API * sends it. On a match, `resource` names the matched registry record (on a * fuzzy match that is the record's sha256, not the input's), falling back to * `knownSha256`, the hash of the bytes the caller sent; with neither it is * omitted. `meta` rides along so the request id is not lost. * * Returns the envelope and the sha256 its resource names ('' on a miss), so * the caller can add the matching resource link. */ export declare function toLookupEnvelope(res: LookupResponse, knownSha256?: string): { envelope: LookupPhotoOutput; sha256: string; }; /** * Reshape an SDK enrich response into the `enrich_photo` envelope. * * `mode` is the API's when it sends one; an API that predates the field * always wrote into the file, so bytes mean `file` and no bytes mean * `sidecar`. `imageBase64` is kept only when `keepBytes` is true (the caller * gave no `outputPath`); `savedTo` names the file the bytes were written to. * `sidecar`, `registryId`, `credentials` and `reason` pass through when the * API sends them, and `meta` rides along so the request id is not lost. */ export declare function toEnrichEnvelope(res: EnrichResponse, opts: { keepBytes: boolean; savedTo?: string; }): EnrichPhotoOutput; //# sourceMappingURL=envelope.d.ts.map