export const manageMediaWorkflow = { id: "manage_media", name: "Manage Media", description: "Image upload, generation, replacement, and management.", steps: [ { step: 1, action: "Prepare or generate images", description: "Use an existing image URL/asset or generate an AI image for the content.", tool: "generate_image", critical: "generate_image uses Nano Banana AI. Existing remote image URLs can also be passed directly to upload tools." }, { step: 2, action: "Upload to record", description: "Attach images to a record's upload field.", tool: "upload_record_image", critical: "Requires: tableName, recordId, fieldName, imageUrl. The image is downloaded server-side and attached to the record." }, { step: 3, action: "List current uploads", description: "Check what's already uploaded in a field to know if replacing or adding.", tool: "list_record_uploads", critical: "Returns array of upload objects with uploadId needed for replace/delete operations." }, { step: 4, action: "Replace or delete if needed", description: "Replace an existing image or delete an upload.", tool: "replace_record_image OR delete_record_upload", critical: "Both require the uploadId from list_record_uploads. replace_record_image downloads new image and swaps it." } ], context: { upload_structure: "Upload fields store arrays of objects: [{urlPath, fileName, fileSize, mimeType, uploadDate}]. Access in Twig templates: record.field[0].urlPath | imagec(width).", image_sources: "Use existing remote image URLs, project assets, or Nano Banana AI image generation.", assets_upload: "upload_image_to_assets: uploads to website /images/ folder (not tied to a record). Accepts base64, data URI, or URL. Can resize and compress.", s3_upload: "upload_image_to_s3: uploads to Amazon S3. Returns public S3 URL. Accepts URL, local path, base64, or data URI." }, rules: [ "Table names WITHOUT 'cms_' prefix", "Primary key is 'num', never 'id'", "Upload fields are ALWAYS arrays of objects with urlPath property", "Use imagec filter for resizing: {{ path | imagec(width_in_pixels) }}" ], warnings: [ "DO NOT try to upload before creating the record — the record must exist first", "DO NOT confuse upload_record_image (attaches to record) with upload_image_to_assets (saves to /images/ folder)", "DO NOT delete uploads without confirming — the image will be removed from the live page" ], resources: [] };