cavi-ai
GitHub ↗

Exports and receipts

photoshop_export and illustrator_export write a file from an owned copy and a receipt beside it.

ParameterMeaning
session_id*The owned copy
destination*A new path in an existing folder. Photoshop: .png. Illustrator: .png or .svg.
kindIllustrator only: png or svg. Default svg. Photoshop always writes PNG and has no kind.
usagecolor (default) or data

What each combination does

ToolkindusageBehavior
photoshop_exportPNGcolorThe document must be 8 or 16 bit RGB with a profile. A duplicate is converted to sRGB and saved as a non-interlaced PNG. The document is not changed.
photoshop_exportPNGdataRGB or grayscale, 8 or 16 bit. The duplicate is saved without a colour profile and the PNG's colour chunks are removed, so values are not reinterpreted.
illustrator_exportsvgcolorOne artboard, sRGB document, RGB. Text is outlined, raster images are embedded, and the SVG is checked to be self-contained.
illustrator_exportpngcolor or dataOne artboard, RGB. PNG24 at 100 percent, with transparency. color also requires an sRGB document.

SVG with data is refused.

Checks on the file

The PNG is parsed after export: its signature, chunk checksums, header and end chunk must be valid and its depth 8 or 16 bit. A colour export without an sRGB or ICC declaration gets an sRGB declaration added; the pixel data is not rewritten. A SVG with a script, foreignObject, event handler, entity declaration, stylesheet instruction or an external reference is rejected. Any failure is an unknown outcome, because the application already ran.

The file is staged in a hidden folder next to the destination, then linked to the destination, so an existing file is never replaced.

Result and receipt

The result is the mutation result (session_id, operation_id, document, copy, source_sha256, retry_safe) with these fields added:

FieldMeaning
document.export_profileThe profile the export was converted to, or null for data and SVG.
document.export_pathThe native path the application wrote.
artifactpath, sha256, bytes, plus what was checked. A PNG adds width, height, bit_depth, removed_color_chunks, srgb and usage. An SVG adds usage, srgb and self_contained.
native_export_sha256The hash of the file as the application wrote it. It differs from artifact.sha256 when the server added or removed colour chunks.
visual_acceptanceunreviewed. Nothing has compared the picture to what you intended.
receiptpath, sha256 and bytes of the receipt file.

The receipt file is <destination>.receipt.json, for example out/hero.png.receipt.json. It holds the same result, without the receipt field. It is created exclusively and is never overwritten.

A pipeline that takes the export should read the receipt, check the artifact.sha256 against the file and treat visual_acceptance as open. See Handoffs.