ugcinc 5.4.0 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -722,76 +722,73 @@ is already rendered and can be used without submitting another render.
722
722
 
723
723
  #### Choose the renderer
724
724
 
725
- - Omit `renderer`, or use `'image-editor'`, for the existing generic matcher.
726
- Its version1 result and `surface: 'image-editor-element'` are unchanged.
727
- It fits plain-background ASCII text using the supported image-editor fonts,
728
- weight, size, spacing, line height, alignment and outline.
729
- - Use `'auto'` to allow native TikTok fallback when the generic path cannot
730
- use the reference, including photographed captions and supplied Unicode/emoji.
731
- - Use `'tiktok-native'` to request only the supported original native
732
- `tiktok-classic-ios-47` profile. It has white text, a dark outline, original
733
- text/emoji shaping and native font metrics. It does not add arbitrary font,
734
- weight or outline controls that this profile does not expose.
725
+ - Omit `renderer`, or use `'image-editor'`, to identify the caption's font from
726
+ the UGC font library and fit an Image Composer text element (version 3 result).
727
+ It handles an outlined caption (light or coloured fill, dark outline) on any
728
+ background, and plain text on a uniform background.
729
+ - Use `'auto'` to fall back to the native TikTok sticker when the library match
730
+ is unavailable; supplied Unicode/emoji text goes straight to the native path.
731
+ - Use `'tiktok-native'` to request only the native `tiktok-classic-ios-47`
732
+ profile (white text, dark outline, native text/emoji shaping).
735
733
 
736
734
  Crop coordinates are integer display-oriented source pixels, width 16–1536 and
737
735
  height 16–512. Supplied text is optional; local English OCR supplies it otherwise.
738
- Provide exact text, emoji and intended line breaks when known. Generic text is
739
- 1–160 printable ASCII characters/up to four lines. Native/auto text supports
740
- valid printable Unicode/emoji, at most 160 UTF-16 code units/up to four lines;
741
- unsupported native sequences fail explicitly rather than substituting fonts.
742
- Native paragraphs cannot be empty or space-only. Source image type/size/color
743
- constraints match color/layout analysis.
736
+ Provide exact text and intended line breaks. Image-editor text is 1–160
737
+ printable ASCII characters/up to four lines. Native/auto text supports valid
738
+ printable Unicode/emoji, at most 160 UTF-16 code units/up to four lines.
739
+
740
+ #### The font library
741
+
742
+ The library mirrors the Google Fonts catalogue (open licences): about 1,800
743
+ families, one Latin file per upright weight. The render worker refreshes it
744
+ daily, so families added to the catalogue become identifiable and renderable
745
+ without a new release. Image Composer text uses a library font through
746
+ `fontFamily` (it takes precedence over `font`); `fontWeight` picks the nearest
747
+ weight the family has. The family list is public at
748
+ `https://media.ugc.inc/owned-uploads/render/fonts/google/catalogue.json`
749
+ (`fetchFontLibraryCatalogue()` in `ugcinc/render`).
750
+
751
+ ```typescript
752
+ const element = { id: 'title', type: 'text', x: 80, y: 600, width: 920, height: 200, zIndex: 1,
753
+ text: 'Turn random food cravings', fontFamily: 'Google Sans', fontWeight: 700, fontSize: 64,
754
+ color: '#ffffff', strokeColor: '#111111', outlineWidth: 6 };
755
+ ```
744
756
 
745
757
  #### Interpret the result
746
758
 
747
759
  Check outer `ok`, the analysis job's `status`, **and** inner `result.status`.
748
760
  A completed analysis can return `unavailable`. `fitAttempted: false` or
749
- `renders: 0` means it rejected the reference before font search. Read
750
- `reasonCode` and `nextActions` instead of repeating nearly identical crop
751
- requests or downloading replacement fonts. An unavailable result is not proof
752
- that the correct font is missing.
753
-
754
- Generic version 1 results retain up to three `candidates`, each with actual
755
- image-editor `element`/`previewConfig`, `maskIoU`, `foregroundMae`, unverified
756
- font identity and `quality: 'close' | 'approximate'`. `element` is positioned in
757
- source pixels; `previewConfig` is a crop-sized image-editor configuration. The
758
- legacy mask treats differences from an estimated uniform border color as ink;
759
- it is unsuitable for photographic backgrounds. It does not infer emoji,
760
- shadows, gradients, perspective, mixed styles or custom fonts.
761
-
762
- Native version 2 uses `surface: 'native-text-sticker'`, an empty generic
763
- `candidates` array, and `nativeResult` on a fitted result:
761
+ `renders: 0` means it rejected the reference before rendering a fit. Read
762
+ `reasonCode` and `nextActions` instead of repeating nearly identical crops.
763
+
764
+ Image-editor version 3 results:
765
+
766
+ - `fontIdentification`: `family`, `weight`, `score` (0–1 letter-shape
767
+ agreement), `margin` over the next family, `status` (`identified`, or
768
+ `approximate` when the caption's font is probably in no free library, such as
769
+ a paid font, and the closest library font is returned), `topCandidates` (up to
770
+ five ranked families), the number of fonts scanned and the library snapshot.
771
+ - `candidates` (up to three families): `element` positioned in source pixels with
772
+ `fontFamily`, `fontWeight`, `fontSize`, `letterSpacing`, `lineHeight`,
773
+ `outlineWidth`, `color` and `strokeColor` fitted with the real Image Composer
774
+ renderer; a crop-sized `previewConfig`; `maskIoU` (letter-fill overlap),
775
+ `outlineIoU`, `foregroundMae`, `fontIdentity` and `quality: 'close' | 'approximate'`.
776
+
777
+ Native version 2 uses `surface: 'native-text-sticker'`, an empty `candidates`
778
+ array, and `nativeResult` on a fitted result:
764
779
 
765
780
  - `profile` and `settings`: the actual native sticker input, ready for
766
781
  `submitNativeTextStickerRenderJob`.
767
782
  - `stickerUrl`: an owned HTTPS transparent PNG generated from those settings.
768
783
  - `composition: {x, y, width, height, scale}`: its placement and displayed extent
769
- in source pixels. Native settings use points and intrinsic 3× output; apply
770
- the returned placement/scale rather than treating points as source pixels.
771
- - `maskIoU`: white-fill overlap, with separate `diagnostics.outlineIoU`;
772
- `foregroundMae` compares rendered text, outline and detected warm-color emoji
773
- against an estimated photo background. These scores are estimates, not proof
774
- of an identical font. `fontIdentity` remains `unverified`.
775
- - `diagnostics`: named mask/residual/foreground metrics, observed/expected lines,
776
- text/outline/emoji pixel counts, clipping, render count and `resampling`
777
- (`none` or `lanczos3`). Inspect these alongside the comparison.
778
-
779
- On the native path, top-level `backgroundColor` is a compatibility placeholder;
780
- it does not represent a recovered photograph color. The sticker is transparent.
784
+ in source pixels. Native settings use points and intrinsic 3× output.
785
+ - `maskIoU`, `foregroundMae` and `diagnostics` (named mask/residual metrics,
786
+ line counts, pixel counts, clipping, render count, `resampling`).
781
787
 
782
788
  Both paths return an owned reference/render/difference preview and manifest,
783
- source hashes, warnings, render metadata and counts. Font identity remains
784
- `unverified`: neither equal line widths nor the availability of a TikTok font
785
- proves the original font or exact rasterization. Transparent source pixels are
786
- composited over white for analysis. Compression, background separation and
787
- resizing may leave residuals; inspect the actual-resolution comparison before
788
- calling a fit accurate. Do not paste extracted caption pixels onto a changed
789
- background; use the clean rendered sticker.
790
-
791
- Matching runs locally within bounded render/job budgets. The existing native
792
- renderer and image-editor bundle are reused without new font downloads, SAM,
793
- or hosted inference. The native path targets white text with dark outlines;
794
- other caption styles may remain approximations or unavailable.
789
+ source hashes, warnings and render counts. Scores compare shapes; inspect the
790
+ comparison before calling a fit exact. Do not paste extracted caption pixels
791
+ onto a changed background.
795
792
 
796
793
  ## Agent media inspection and content workflows
797
794
 
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.contentSkillFiles = void 0;
4
4
  // Generated by scripts/build-skills.cjs; edit skills/** instead.
5
5
  exports.contentSkillFiles = {
6
- "media/SKILL.md": "---\nname: media\ndescription: Acquire TikTok and Instagram posts and inspect images, video and audio with UGC Inc tools. Use for reference analysis, OCR, frames, scenes, transcription, colors, layout, text-style fitting, or media-library management.\nallowed-tools: Bash, Read\n---\n\nUse the installed UGC Inc CLI:\n\n```bash\nnpx ugcinc --list\nnpx ugcinc <tool_name> '<json_params>'\n```\n\nCredentials come from `UGC_API_KEY` or existing UGC configuration. Use the user's\norganization and a key with `content:analyze` for acquisition/analysis. If using\nan admin key, pass the authorized `orgId` in the JSON parameters. Do not print\ncredentials, copy an administrator key to another user's machine, or change\norganizations to bypass a denial. Confirm access with one small tool call.\nIf credentials already live in an app env file, set `UGC_ENV_FILE` to that file's\npath so the CLI reads the existing key without duplicating its contents. Set\n`UGC_ORG_ID` in that file or the process environment to scope calls to the user's\norganization; an explicit JSON `orgId` takes priority.\n\nRead [references/tools.md](references/tools.md) for request shapes, result fields\nand limits. The CLI lists names/descriptions; the reference explains parameters.\n\n## Choose the input and tools\n\nStart from the analysis action; use the shipped tool before looking for local model packages.\n\n| Need | Tool |\n| --- | --- |\n| Spoken words and approximate timing | `transcribe_audio` |\n| Loudness, silence and volume over time | `measure_audio_levels` |\n| On-screen text and when it appears | `read_video_text` |\n| Scene boundaries | `detect_scenes` |\n| Review frames/contact sheet | `extract_frames` |\n| Text, colours or supplied boxes in a still | `read_image_text`, `sample_colors`, `measure_layout` |\n\nFor local media, use the existing owned-upload path described below, then pass its URL.\nNormal file probes and quick local inspection remain useful. Missing local Whisper is\nnot a reason to abandon transcription or install another speech stack when UGC provides it.\nIf a supported service is unavailable, retain its error/job and use the workspace's operator\nhandoff; do not quietly replace it or guess the missing result.\n\n- A profile URL: `list_profile_posts` discovers a bounded page; follow its cursor\n only as needed. Listing does not download media or guarantee complete history.\n- A post URL: `download_social_post` ingests its ordered assets into owned media.\n Use returned asset URLs for analysis; the TikTok/Instagram HTML URL is not a\n video file. Check complete/partial/failed status and failed assets.\n- A direct media URL: use the corresponding inspection tool directly.\n- Video: `detect_scenes`, `extract_frames`, `read_video_text`; audio tools accept\n video too. Inspect multiple moments, including changes near the beginning/end.\n- Image: `read_image_text`, `sample_colors`, `measure_layout` using supplied\n boxes/masks, and `match_text_style` for a specified text crop.\n- Audio: `transcribe_audio` and `measure_audio_levels`.\n\nThe SDK/CLI waits for processing automatically. Check both the outer response's\n`ok` and the returned job's `status`. Analysis is usable when\n`data.status === \"completed\"`; its content is `data.result`. If still pending or\nprocessing, keep its job ID and use `get_media_analysis` rather than resubmitting.\nUse bounded retries for retryable failures; report persistent errors/partial\ncoverage. A zero process exit code alone does not establish API success.\n\n## Interpret evidence accurately\n\n- Coordinates are display-oriented source pixels; times are source-relative\n milliseconds. Use returned decoded timestamps, dimensions and coverage.\n- OCR is English, may miss stylized text, and can be empty on unreadable input.\n `fast` video OCR leaves uninspected intervals. `frame_scan` is bounded and\n cannot inspect an arbitrarily long clip in one request.\n- Speech timestamps are estimates; speaker labels/forced alignment are absent.\n A transcript does not establish music, emotion, delivery or sound effects.\n Matching waveform envelopes or correlation supports timing similarity, not identical\n words or correct voice quality. Compare transcripts for wording, and distinguish measured\n loudness from subjective listening. If you cannot listen, say so and leave that verdict open.\n The first word timestamp is not proof of silence before that word; use audio levels to\n establish silence. Model confidence scores are not a guarantee that wording is correct.\n- Color sampling measures decoded sRGB pixels, not guaranteed design hex values.\n Layout measurement does not detect objects or recover original layer files.\n- For text over photographic backgrounds, call `match_text_style` with\n `renderer: \"auto\"` or `\"tiktok-native\"` and exact text/line breaks when known.\n Native results include Unicode/emoji and a clean transparent sticker using\n the supported native TikTok profile. Omitted renderer keeps the older\n ASCII/plain-background image-editor path. Inspect `surface`/version and use\n `nativeResult` or generic `candidates` accordingly.\n- A completed matching job can return inner `status: \"unavailable\"`. Check\n `reasonCode`, `fitAttempted`, `renders` and `nextActions`. Zero renders means\n no font fit was attempted: do not spend repeated calls on similar rejected\n crops or download replacement fonts. Font identity stays unverified; compare\n text/outline residuals and the preview before calling any result accurate.\n Equal line widths or matching positions alone do not prove identical text.\n- SAM/object segmentation, automatic overlay detection, element/mask tracking,\n motion measurement, extraction, media comparison/alignment and semantic search\n are not available through this tool set. Do not invent those calls or install\n SAM. Existing OCR text tracks remain available.\n\n## Review and share media\n\nOpen returned image/contact-sheet previews and review the relevant sequence.\nWhen the agent runtime can consume audio/video, use it. Otherwise use the\navailable transcript, audio preview and level measurements and explicitly state\nwhat was not listened to or inspected. Do not claim to have watched/listened\nbecause an analysis request succeeded.\n\nShare only verified browser-accessible HTTPS artifacts. Fetch without auth and\ncheck status, content type and decoding; for video also check byte-range support.\nUse the returned owned-media URLs. Local paths, localhost/private addresses and\nexpiring upstream CDN links are not deliverable previews. If an artifact needs\nuploading, use the supported owned storage path; do not claim a file is hosted\nbecause a media record was created for an arbitrary URL.\n\nFor building a reusable content format, use the `content-automation` skill.\n\nFor native iMessage render jobs use the `imessage` skill and its separate\nsubmit/status/cancel tools. They require `content:render`, not `content:analyze`,\nand are not media-analysis jobs.\n",
7
- "media/references/tools.md": "# UGC media tool requests and results\n\nRun `npx ugcinc TOOL 'JSON'`. Shell quoting varies on Windows; if the shell\nchanges the JSON, use a small Node script with `UGCClient` and its `media`\nmethods instead of repeatedly sending malformed requests. For example:\n\n```js\nconst { UGCClient } = require('ugcinc');\nconst client = new UGCClient({\n apiKey: process.env.UGC_API_KEY,\n orgId: process.env.UGC_ORG_ID,\n});\n// Use admin:true only with an authorized administrator credential.\n```\n\nRequest URLs must be HTTPS. Analysis source URLs must not contain credentials\nor fragments. Image operations support still PNG/JPEG/WebP, at most4096pixels\nper side; the shared download limit is100MiB. Geometry must fit the actual\ndisplay-oriented source. Respect more restrictive operation limits below.\n\n## Acquisition\n\n| CLI tool / SDK method | Parameters | Result |\n| --- | --- | --- |\n| `list_profile_posts` / `media.listProfilePosts` | `{url, limit?, cursor?}`; TikTok/Instagram profile; limit1–50 | `data.posts`, profile metadata, continuation cursor. Follow the actual returned cursor, not a fabricated page number. |\n| `download_social_post` / `media.downloadSocialPost` | `{url}`; canonical TikTok/Instagram post URL | `data.status`, `assets[]` in order, `failedAssets[]`, `manifestUrl`, post/sound metadata. Each asset has `url`, `mediaId`, dimensions, type, duration, audio presence and hash. Repeat the same URL to resume retryable partial imports. |\n\nEmbedded video audio remains attached. Photo assets have no embedded soundtrack;\nsound attribution does not mean audio bytes were downloaded. Preserve sound\nID/link separately; never replace a post excerpt with the full sound-page track\nand call them identical. Partial imports are not a complete carousel.\n\n## Analysis\n\nThese return `{ok, data:{jobId,status,operation,result?,error?}}`. Use the completed\n`data.result` fields listed below. Failure can occur after successful submission.\n\n| CLI tool / SDK method | Parameters | Result content |\n| --- | --- | --- |\n| `extract_frames` / `media.extractFrames` | `{url,timestampsMs:[0,1500,3000],selection:\"nearest\",contactSheet:true}` OR `{url,range:{startMs,endMs,intervalMs}}`; choose exactly one selector, at most48samples | `frames[]` with requested/decoded time, source PTS, dimensions and URL; optional `contactSheet` with individual frame links; source metadata. |\n| `detect_scenes` / `media.detectScenes` | `{url}` | `scenes[]` with start/end milliseconds, frame indexes, source PTS; no split MP4 exports. |\n| `read_image_text` / `media.readImageText` | `{url}` | `regions[]` with text/rawText, polygons/boxes/confidence; inferred `lines[]`/reading order; `previewUrl`. |\n| `read_video_text` / `media.readVideoText` | `{url,mode:\"fast\",intervalMs:1000,range?:{startMs,endMs}}` OR `{url,mode:\"frame_scan\",range?:{startMs,endMs}}` | `frames[]`, text `tracks[]` with observations/positions; explicit `coverage.inspected` and `uninspected`. Maximum240inspected frames and120seconds per request. `intervalMs` only applies to fast mode. |\n| `transcribe_audio` / `media.transcribeAudio` | `{url,range?:{startMs,endMs},language?:\"auto\",timing?:\"word\",channel?:0}` | `status`, `text`, timed `segments[]` and estimated words, warnings, `audioPreviewUrl`. Range at most120seconds; timing `word` or `segment`; optional channel0/1. Empty/no-audio/no-speech states are distinct. |\n| `measure_audio_levels` / `media.measureAudioLevels` | `{url,range?:{startMs,endMs},windowMs?:100,silenceThresholdDbfs?:-50}` | Native-channel RMS/sample peaks, loudness timeline/LUFS, silence, possible clipping, `previewUrl`. Windows20–5000ms, threshold−100to−10dBFS, range at most120seconds. |\n| `sample_colors` / `media.sampleColors` | `{url,maxColors?:8,point?:{x,y},box?:{x,y,width,height},mask?}`; choose at most one selection | Observed RGBA point or palette/proportions, omitted mass, declared color policy, `previewUrl`. Palette1–32colors. |\n| `measure_layout` / `media.measureLayout` | `{url,elements:[{id,box:{x,y,width,height}}]}`; each element may instead have `mask` | Margins, centers, spacing/alignment deltas, intersections/IoU and `previewUrl`.1–32unique IDs. Boxes are supplied, not automatically detected. |\n| `match_text_style` / `media.matchTextStyle` | `{url,box:{x,y,width,height},text?,renderer?}`; integer crop 16–1536 wide, 16–512 high. `renderer: auto` allows native fallback; `tiktok-native` requests the native profile. Omitted renderer keeps legacy image-editor behavior. Supply exact text and line breaks when available. | `status`, `reasonCode`, `fitAttempted`, `nextActions`, comparison and warnings. Generic v1 returns `candidates` with image-editor `element`/`previewConfig`. Native v2 returns `nativeResult` with actual native `settings`, clean transparent `stickerUrl`, source-pixel `composition`, masked residuals and diagnostics; `candidates` is empty. Native/auto accept Unicode/emoji, up to 160 UTF-16 code units/four lines; generic remains ASCII/plain-background only. Original font identity is unverified. |\n| `get_media_analysis` / `media.getMediaAnalysis` | `{jobId}` | Current status/result in the current organization; use when automatic waiting returned pending/processing. |\n\nBoxes are half-open source-pixel rectangles. For masks used by colors/layout:\n`{width,height,counts}` uses row-major binary RLE, alternating background then\nforeground. Counts must sum to width×height. This is not COCO's column-major\nconvention. Supply only masks you actually have; automatic segmentation is off.\n\n## Text matching decisions\n\nFor photographed TikTok captions, use `renderer: \"auto\"` or `\"tiktok-native\"`\nand supply the exact caption, including emoji and intended line breaks. The\nnative candidate uses the supported `tiktok-classic-ios-47` profile: white text,\ndark outline, original native shaping and emoji. This does not imply every\nTikTok caption uses that profile. Unsupported styles remain unavailable or\nexplicit approximations; no new font download or hosted model is required.\n\nCheck all three levels: outer response `ok`, analysis job `status`, and inner\nmatching `result.status`. A completed analysis can legitimately return\n`unavailable`. If `fitAttempted` is false or `renders` is zero, no font candidate\nwas tested. Read `reasonCode` and `nextActions`; do not keep resubmitting nearly\nthe same crop after a background/segmentation rejection. Keep the source frame\nand failure for a tool repair rather than claiming a missing font.\n\nUse `surface` and result version to choose the output. Generic image-editor\nresults retain `candidates[].element` and `previewConfig`. Native results use\n`nativeResult.settings` with the native sticker renderer, or directly reuse\n`nativeResult.stickerUrl`. Its `composition` positions the clean PNG in source\npixels; native settings themselves use points and produce 3× pixels. Do not\npaste extracted source-caption pixels onto a changed background. Compare the\nreturned fit/difference preview and residuals; matching a line width or locating\nits top-left corner does not establish correct glyphs, spacing or emoji.\n\n## Existing media library\n\n- `list_media({ids?,tag?})`, `list_social_audio({ids?,tag?})`.\n- `create_media_from_urls({urls,names?,tag?,sourceIds?,useName?})` registers URLs;\n it does not turn an inaccessible local file into a public upload.\n- `import_text({texts:[{content,name?,tag?}]})`.\n- `create_social_audio({url,tag?})` imports social audio separately; do not use it\n as proof of the exact soundtrack/mix/offset in a downloaded reference video.\n- `delete_media({ids})` removes media/storage; only use when deletion is requested.\n",
8
- "content-automation/SKILL.md": "---\nname: content-automation\ndescription: Turn reference social posts or a rough content idea into a reusable UGC Inc workflow, with editable inputs and reviewed visual/audio output. Use for developing and validating content formats rather than scheduling existing finished posts.\nallowed-tools: Bash, Read\n---\n\nBuild the format the user wants and collaborate at the level they requested.\nWhen they want to discuss, compare or review a specific artifact, do that before\nmaking additional format decisions. Keep questions concise and ask only when a\nmissing answer prevents useful work. Do not impose a new per-video reference input\nwhen the user wants a fixed reusable visual format.\n\nUse the `media` skill for acquisition/inspection and the `automations` skill for\ncurrent workflow tool calls. Read [references/build-review.md](references/build-review.md)\nwhen constructing or reviewing a workflow. Use only shipped tools/nodes discovered\nthrough `npx ugcinc --list`, `list_node_types` and `get_node_type`.\n\n## Understand and specify the format\n\nAcquire a bounded set of real references and inspect full frames and changes over\ntime, including audio using available modalities. A contact sheet or transcript\nalone cannot establish all animation/pacing/music details. State uninspected\nparts instead of claiming playback. Distinguish reusable formats from variants;\nseveral posts may use the same structure with different assets, copy or timing.\n\nWrite a compact spec: what the viewer sees first, the sequence/reveal, required\ninputs, reusable assets/components, changing copy, audio source/timing and final\naction/CTA if required by this format. Separate measured facts from inference\nand user choices. Share a verified HTTPS reference/preview when the user needs\nto identify the parts they want changed.\n\nClassify assets by replacement behavior. A recognizable Mii, Wojak or other exact\nmeme image may need a static asset; an ordinary or newly generated face need not\nbe static just because it looks meme-like. Preserve a headshot's identity across\nvariants when requested, while making intended differences visibly meaningful.\n\n## Build reusable production behavior\n\nSeparate layout, data/assets and motion. Expose the inputs a normal run needs:\nasset pools/overrides, text pools, contact/destination, duration/timing and seed\nwhere appropriate. Keep canonical outputs independent of an operator's laptop.\nImplement procedural animations as reusable components rendered on demand;\ndo not substitute one pre-rendered clip when each run should vary. Randomness\nmust respect the intended visual roles and remain replayable from saved inputs.\n\nReuse existing nodes/compositions and actual public schemas. Analysis tools are\navailable as CLI/SDK operations; do not assume every one is a workflow node.\nValidate the graph before executing. Prefer a reviewable output over publishing\nor enabling recurring runs unless the user authorized those actions.\n\n## Make the content work\n\n- Keep the hierarchy clear: readable hook, focal content, then the intended CTA.\n Give characters/subjects enough visual weight; align visible content within\n its section instead of trusting transparent image bounds alone.\n- Measure margins, spacing, text wrapping and overlap. Check at phone viewing\n size, not only on a large canvas. Keep important text away from platform UI;\n inspect the relevant target presentation rather than assuming universal margins.\n- Use sampled reference colors and real render previews. Judge font, stroke,\n kerning, line height and emoji spacing together. Treat text-style fitting as a\n measured candidate, not proof of an exact font or pixel-perfect output.\n- Match the reference post's actual audio excerpt, mix, start and duration when\n requested. Preserve attribution separately. Empty transcription can mean music\n or unrecognized speech, not silence. Keep visual reveals and audio timing coherent.\n- Keep required CTA/contact copy present and legible across every requested\n variant. Use the user's actual destination/formatting, not a number copied from\n an old example. Vary copy intentionally without altering the required action.\n- Test with real content and multiple asset/copy lengths. A composition that\n works with one face or one short headline is not a validated reusable format.\n Inspect early, changing and final states; a still cannot certify a full video.\n\n## Deliver and describe the boundary\n\nProvide the workflow, its normal inputs, replayable example parameters, verified\nHTTPS previews, and any observed visual/audio limits. For videos verify decoding,\nduration/dimensions/audio and byte-range playback; images need correct content\ntype and decoding. Do not use local/localhost/private URLs as deliverables.\n\nSAM and automatic segmentation/overlay tracking are deferred. Use supplied\nassets, user-supplied boxes/masks or honest visual analysis; do not claim recovered\nsource layers or automatic clean cutouts. If the runtime cannot inspect a media\nmodality, record that limit and do not certify the uninspected property.\n\nFor text-message formats, use the `imessage` skill and native Create DM for both\nPNG and video. Generate dialogue as structured authoring data, compile pacing,\nand review native output before combining with reaction footage, audio or CTA.\n",
6
+ "media/SKILL.md": "---\nname: media\ndescription: Acquire TikTok and Instagram posts and inspect images, video and audio with UGC Inc tools. Use for reference analysis, OCR, frames, scenes, transcription, colors, layout, text-style fitting, or media-library management.\nallowed-tools: Bash, Read\n---\n\nUse the installed UGC Inc CLI:\n\n```bash\nnpx ugcinc --list\nnpx ugcinc <tool_name> '<json_params>'\n```\n\nCredentials come from `UGC_API_KEY` or existing UGC configuration. Use the user's\norganization and a key with `content:analyze` for acquisition/analysis. If using\nan admin key, pass the authorized `orgId` in the JSON parameters. Do not print\ncredentials, copy an administrator key to another user's machine, or change\norganizations to bypass a denial. Confirm access with one small tool call.\nIf credentials already live in an app env file, set `UGC_ENV_FILE` to that file's\npath so the CLI reads the existing key without duplicating its contents. Set\n`UGC_ORG_ID` in that file or the process environment to scope calls to the user's\norganization; an explicit JSON `orgId` takes priority.\n\nRead [references/tools.md](references/tools.md) for request shapes, result fields\nand limits. The CLI lists names/descriptions; the reference explains parameters.\n\n## Choose the input and tools\n\nStart from the analysis action; use the shipped tool before looking for local model packages.\n\n| Need | Tool |\n| --- | --- |\n| Spoken words and approximate timing | `transcribe_audio` |\n| Loudness, silence and volume over time | `measure_audio_levels` |\n| On-screen text and when it appears | `read_video_text` |\n| Scene boundaries | `detect_scenes` |\n| Review frames/contact sheet | `extract_frames` |\n| Text, colours or supplied boxes in a still | `read_image_text`, `sample_colors`, `measure_layout` |\n\nFor local media, use the existing owned-upload path described below, then pass its URL.\nNormal file probes and quick local inspection remain useful. Missing local Whisper is\nnot a reason to abandon transcription or install another speech stack when UGC provides it.\nIf a supported service is unavailable, retain its error/job and use the workspace's operator\nhandoff; do not quietly replace it or guess the missing result.\n\n- A profile URL: `list_profile_posts` discovers a bounded page; follow its cursor\n only as needed. Listing does not download media or guarantee complete history.\n- A post URL: `download_social_post` ingests its ordered assets into owned media.\n Use returned asset URLs for analysis; the TikTok/Instagram HTML URL is not a\n video file. Check complete/partial/failed status and failed assets.\n- A direct media URL: use the corresponding inspection tool directly.\n- Video: `detect_scenes`, `extract_frames`, `read_video_text`; audio tools accept\n video too. Inspect multiple moments, including changes near the beginning/end.\n- Image: `read_image_text`, `sample_colors`, `measure_layout` using supplied\n boxes/masks, and `match_text_style` for a specified text crop.\n- Audio: `transcribe_audio` and `measure_audio_levels`.\n\nThe SDK/CLI waits for processing automatically. Check both the outer response's\n`ok` and the returned job's `status`. Analysis is usable when\n`data.status === \"completed\"`; its content is `data.result`. If still pending or\nprocessing, keep its job ID and use `get_media_analysis` rather than resubmitting.\nUse bounded retries for retryable failures; report persistent errors/partial\ncoverage. A zero process exit code alone does not establish API success.\n\n## Interpret evidence accurately\n\n- Coordinates are display-oriented source pixels; times are source-relative\n milliseconds. Use returned decoded timestamps, dimensions and coverage.\n- OCR is English, may miss stylized text, and can be empty on unreadable input.\n `fast` video OCR leaves uninspected intervals. `frame_scan` is bounded and\n cannot inspect an arbitrarily long clip in one request.\n- Speech timestamps are estimates; speaker labels/forced alignment are absent.\n A transcript does not establish music, emotion, delivery or sound effects.\n Matching waveform envelopes or correlation supports timing similarity, not identical\n words or correct voice quality. Compare transcripts for wording, and distinguish measured\n loudness from subjective listening. If you cannot listen, say so and leave that verdict open.\n The first word timestamp is not proof of silence before that word; use audio levels to\n establish silence. Model confidence scores are not a guarantee that wording is correct.\n- Color sampling measures decoded sRGB pixels, not guaranteed design hex values.\n Layout measurement does not detect objects or recover original layer files.\n- To copy a caption's font, call `match_text_style` with exact text and line\n breaks (default renderer). It identifies the font from the UGC font library\n (Google Fonts catalogue, refreshed daily) for outlined captions on photos and\n plain text on uniform backgrounds, and returns an Image Composer element with\n `fontFamily` and fitted styling. `fontIdentification.status: approximate`\n means the original font is not in the library; the closest one is returned.\n Use `renderer: \"tiktok-native\"` for emoji captions.\n- A completed matching job can return inner `status: \"unavailable\"`. Check\n `reasonCode`, `fitAttempted`, `renders` and `nextActions`; do not spend\n repeated calls on similar rejected crops. Compare `maskIoU` and the preview\n before calling a result exact.\n- SAM/object segmentation, automatic overlay detection, element/mask tracking,\n motion measurement, extraction, media comparison/alignment and semantic search\n are not available through this tool set. Do not invent those calls or install\n SAM. Existing OCR text tracks remain available.\n\n## Review and share media\n\nOpen returned image/contact-sheet previews and review the relevant sequence.\nWhen the agent runtime can consume audio/video, use it. Otherwise use the\navailable transcript, audio preview and level measurements and explicitly state\nwhat was not listened to or inspected. Do not claim to have watched/listened\nbecause an analysis request succeeded.\n\nShare only verified browser-accessible HTTPS artifacts. Fetch without auth and\ncheck status, content type and decoding; for video also check byte-range support.\nUse the returned owned-media URLs. Local paths, localhost/private addresses and\nexpiring upstream CDN links are not deliverable previews. If an artifact needs\nuploading, use the supported owned storage path; do not claim a file is hosted\nbecause a media record was created for an arbitrary URL.\n\nFor building a reusable content format, use the `content-automation` skill.\n\nFor native iMessage render jobs use the `imessage` skill and its separate\nsubmit/status/cancel tools. They require `content:render`, not `content:analyze`,\nand are not media-analysis jobs.\n",
7
+ "media/references/tools.md": "# UGC media tool requests and results\n\nRun `npx ugcinc TOOL 'JSON'`. Shell quoting varies on Windows; if the shell\nchanges the JSON, use a small Node script with `UGCClient` and its `media`\nmethods instead of repeatedly sending malformed requests. For example:\n\n```js\nconst { UGCClient } = require('ugcinc');\nconst client = new UGCClient({\n apiKey: process.env.UGC_API_KEY,\n orgId: process.env.UGC_ORG_ID,\n});\n// Use admin:true only with an authorized administrator credential.\n```\n\nRequest URLs must be HTTPS. Analysis source URLs must not contain credentials\nor fragments. Image operations support still PNG/JPEG/WebP, at most4096pixels\nper side; the shared download limit is100MiB. Geometry must fit the actual\ndisplay-oriented source. Respect more restrictive operation limits below.\n\n## Acquisition\n\n| CLI tool / SDK method | Parameters | Result |\n| --- | --- | --- |\n| `list_profile_posts` / `media.listProfilePosts` | `{url, limit?, cursor?}`; TikTok/Instagram profile; limit1–50 | `data.posts`, profile metadata, continuation cursor. Follow the actual returned cursor, not a fabricated page number. |\n| `download_social_post` / `media.downloadSocialPost` | `{url}`; canonical TikTok/Instagram post URL | `data.status`, `assets[]` in order, `failedAssets[]`, `manifestUrl`, post/sound metadata. Each asset has `url`, `mediaId`, dimensions, type, duration, audio presence and hash. Repeat the same URL to resume retryable partial imports. |\n\nEmbedded video audio remains attached. Photo assets have no embedded soundtrack;\nsound attribution does not mean audio bytes were downloaded. Preserve sound\nID/link separately; never replace a post excerpt with the full sound-page track\nand call them identical. Partial imports are not a complete carousel.\n\n## Analysis\n\nThese return `{ok, data:{jobId,status,operation,result?,error?}}`. Use the completed\n`data.result` fields listed below. Failure can occur after successful submission.\n\n| CLI tool / SDK method | Parameters | Result content |\n| --- | --- | --- |\n| `extract_frames` / `media.extractFrames` | `{url,timestampsMs:[0,1500,3000],selection:\"nearest\",contactSheet:true}` OR `{url,range:{startMs,endMs,intervalMs}}`; choose exactly one selector, at most48samples | `frames[]` with requested/decoded time, source PTS, dimensions and URL; optional `contactSheet` with individual frame links; source metadata. |\n| `detect_scenes` / `media.detectScenes` | `{url}` | `scenes[]` with start/end milliseconds, frame indexes, source PTS; no split MP4 exports. |\n| `read_image_text` / `media.readImageText` | `{url}` | `regions[]` with text/rawText, polygons/boxes/confidence; inferred `lines[]`/reading order; `previewUrl`. |\n| `read_video_text` / `media.readVideoText` | `{url,mode:\"fast\",intervalMs:1000,range?:{startMs,endMs}}` OR `{url,mode:\"frame_scan\",range?:{startMs,endMs}}` | `frames[]`, text `tracks[]` with observations/positions; explicit `coverage.inspected` and `uninspected`. Maximum240inspected frames and120seconds per request. `intervalMs` only applies to fast mode. |\n| `transcribe_audio` / `media.transcribeAudio` | `{url,range?:{startMs,endMs},language?:\"auto\",timing?:\"word\",channel?:0}` | `status`, `text`, timed `segments[]` and estimated words, warnings, `audioPreviewUrl`. Range at most120seconds; timing `word` or `segment`; optional channel0/1. Empty/no-audio/no-speech states are distinct. |\n| `measure_audio_levels` / `media.measureAudioLevels` | `{url,range?:{startMs,endMs},windowMs?:100,silenceThresholdDbfs?:-50}` | Native-channel RMS/sample peaks, loudness timeline/LUFS, silence, possible clipping, `previewUrl`. Windows20–5000ms, threshold−100to−10dBFS, range at most120seconds. |\n| `sample_colors` / `media.sampleColors` | `{url,maxColors?:8,point?:{x,y},box?:{x,y,width,height},mask?}`; choose at most one selection | Observed RGBA point or palette/proportions, omitted mass, declared color policy, `previewUrl`. Palette1–32colors. |\n| `measure_layout` / `media.measureLayout` | `{url,elements:[{id,box:{x,y,width,height}}]}`; each element may instead have `mask` | Margins, centers, spacing/alignment deltas, intersections/IoU and `previewUrl`.1–32unique IDs. Boxes are supplied, not automatically detected. |\n| `match_text_style` / `media.matchTextStyle` | `{url,box:{x,y,width,height},text?,renderer?}`; integer crop 16–1536 wide, 16–512 high. Omitted renderer (`image-editor`) identifies the font from the UGC font library and fits an Image Composer text element; `auto` adds the native TikTok sticker as fallback (and uses it for emoji text); `tiktok-native` requests only the native profile. Supply exact text and line breaks. | `status`, `reasonCode`, `fitAttempted`, `nextActions`, comparison and warnings. Image-editor v3 returns `fontIdentification` (`family`, `weight`, `score`, `margin`, `status: identified|approximate`, ranked `topCandidates`) and up to 3 `candidates` whose `element` uses `fontFamily` (a library family) with fitted size, weight, spacing, line height, outline and colours. Native v2 returns `nativeResult` with native `settings`, a transparent `stickerUrl`, source-pixel `composition` and diagnostics; `candidates` is empty. Image-editor text is printable ASCII; native/auto accept Unicode/emoji, up to 160 UTF-16 code units/four lines. |\n| `get_media_analysis` / `media.getMediaAnalysis` | `{jobId}` | Current status/result in the current organization; use when automatic waiting returned pending/processing. |\n\nBoxes are half-open source-pixel rectangles. For masks used by colors/layout:\n`{width,height,counts}` uses row-major binary RLE, alternating background then\nforeground. Counts must sum to width×height. This is not COCO's column-major\nconvention. Supply only masks you actually have; automatic segmentation is off.\n\n## Text matching decisions\n\nTo copy a caption's font, call `match_text_style` with the default renderer\nand the exact text with its line breaks. The tool compares the caption's letter\nshapes with every font in the UGC font library (the Google Fonts catalogue,\nabout 1,800 families; refreshed daily, so new families become available without\na release). It works for an outlined caption (light or coloured fill, dark\noutline) on any background and for plain text on a uniform background.\n\nRead `fontIdentification`: `status: identified` names the library family and\nweight; `approximate` means the caption's font is probably not in any free\nlibrary (for example a paid font), so the closest library font is returned.\n`topCandidates` ranks the next best families; `equivalentFamilies` lists\nfamilies whose Latin letters are identical. Use `candidates[0].element`\ndirectly in an Image Composer: it carries `fontFamily`, `fontWeight`, size,\nletter spacing, line height, outline width and colours fitted with the real\nrenderer. Check `maskIoU` and the preview before calling a fit exact.\n\nFor emoji captions use `renderer: \"tiktok-native\"` (native TikTok sticker).\n\nCheck all three levels: outer response `ok`, analysis job `status`, and inner\nmatching `result.status`. A completed analysis can legitimately return\n`unavailable`. If `fitAttempted` is false or `renders` is zero, no fit was\nrendered. Read `reasonCode` and `nextActions` (for example\n`TEXT_EVIDENCE_CLIPPED`: include the whole caption with a margin;\n`AMBIGUOUS_TEXT_EVIDENCE`: supply the exact line breaks); do not keep\nresubmitting nearly the same crop.\n\nDo not paste extracted source-caption pixels onto a changed background.\n\n## Existing media library\n\n- `list_media({ids?,tag?})`, `list_social_audio({ids?,tag?})`.\n- `create_media_from_urls({urls,names?,tag?,sourceIds?,useName?})` registers URLs;\n it does not turn an inaccessible local file into a public upload.\n- `import_text({texts:[{content,name?,tag?}]})`.\n- `create_social_audio({url,tag?})` imports social audio separately; do not use it\n as proof of the exact soundtrack/mix/offset in a downloaded reference video.\n- `delete_media({ids})` removes media/storage; only use when deletion is requested.\n",
8
+ "content-automation/SKILL.md": "---\nname: content-automation\ndescription: Turn reference social posts or a rough content idea into a reusable UGC Inc workflow, with editable inputs and reviewed visual/audio output. Use for developing and validating content formats rather than scheduling existing finished posts.\nallowed-tools: Bash, Read\n---\n\nBuild the format the user wants and collaborate at the level they requested.\nWhen they want to discuss, compare or review a specific artifact, do that before\nmaking additional format decisions. Keep questions concise and ask only when a\nmissing answer prevents useful work. Do not impose a new per-video reference input\nwhen the user wants a fixed reusable visual format.\n\nUse the `media` skill for acquisition/inspection and the `automations` skill for\ncurrent workflow tool calls. Read [references/build-review.md](references/build-review.md)\nwhen constructing or reviewing a workflow. Use only shipped tools/nodes discovered\nthrough `npx ugcinc --list`, `list_node_types` and `get_node_type`.\n\n## Understand and specify the format\n\nAcquire a bounded set of real references and inspect full frames and changes over\ntime, including audio using available modalities. A contact sheet or transcript\nalone cannot establish all animation/pacing/music details. State uninspected\nparts instead of claiming playback. Distinguish reusable formats from variants;\nseveral posts may use the same structure with different assets, copy or timing.\n\nWrite a compact spec: what the viewer sees first, the sequence/reveal, required\ninputs, reusable assets/components, changing copy, audio source/timing and final\naction/CTA if required by this format. Separate measured facts from inference\nand user choices. Share a verified HTTPS reference/preview when the user needs\nto identify the parts they want changed.\n\nClassify assets by replacement behavior. A recognizable Mii, Wojak or other exact\nmeme image may need a static asset; an ordinary or newly generated face need not\nbe static just because it looks meme-like. Preserve a headshot's identity across\nvariants when requested, while making intended differences visibly meaningful.\n\n## Build reusable production behavior\n\nSeparate layout, data/assets and motion. Expose the inputs a normal run needs:\nasset pools/overrides, text pools, contact/destination, duration/timing and seed\nwhere appropriate. Keep canonical outputs independent of an operator's laptop.\nImplement procedural animations as reusable components rendered on demand;\ndo not substitute one pre-rendered clip when each run should vary. Randomness\nmust respect the intended visual roles and remain replayable from saved inputs.\n\nReuse existing nodes/compositions and actual public schemas. Analysis tools are\navailable as CLI/SDK operations; do not assume every one is a workflow node.\nValidate the graph before executing. Prefer a reviewable output over publishing\nor enabling recurring runs unless the user authorized those actions.\n\n## Make the content work\n\n- Keep the hierarchy clear: readable hook, focal content, then the intended CTA.\n Give characters/subjects enough visual weight; align visible content within\n its section instead of trusting transparent image bounds alone.\n- Measure margins, spacing, text wrapping and overlap. Check at phone viewing\n size, not only on a large canvas. Keep important text away from platform UI;\n inspect the relevant target presentation rather than assuming universal margins.\n- Use sampled reference colors and real render previews. Judge font, stroke,\n kerning, line height and emoji spacing together. To reuse a reference\n caption's font, take `match_text_style`'s identified library font\n (`fontFamily` in Image Composer text); when it reports `approximate`, the\n reference font is not in the library and the result is the closest match.\n- Match the reference post's actual audio excerpt, mix, start and duration when\n requested. Preserve attribution separately. Empty transcription can mean music\n or unrecognized speech, not silence. Keep visual reveals and audio timing coherent.\n- Keep required CTA/contact copy present and legible across every requested\n variant. Use the user's actual destination/formatting, not a number copied from\n an old example. Vary copy intentionally without altering the required action.\n- Test with real content and multiple asset/copy lengths. A composition that\n works with one face or one short headline is not a validated reusable format.\n Inspect early, changing and final states; a still cannot certify a full video.\n\n## Deliver and describe the boundary\n\nProvide the workflow, its normal inputs, replayable example parameters, verified\nHTTPS previews, and any observed visual/audio limits. For videos verify decoding,\nduration/dimensions/audio and byte-range playback; images need correct content\ntype and decoding. Do not use local/localhost/private URLs as deliverables.\n\nSAM and automatic segmentation/overlay tracking are deferred. Use supplied\nassets, user-supplied boxes/masks or honest visual analysis; do not claim recovered\nsource layers or automatic clean cutouts. If the runtime cannot inspect a media\nmodality, record that limit and do not certify the uninspected property.\n\nFor text-message formats, use the `imessage` skill and native Create DM for both\nPNG and video. Generate dialogue as structured authoring data, compile pacing,\nand review native output before combining with reaction footage, audio or CTA.\n",
9
9
  "content-automation/references/build-review.md": "# Construct and review a reusable workflow\n\n## Discover the real interface\n\n`npx ugcinc list_node_types '{}'` lists current node metadata.\nUse `get_node_type '{\"nodeType\":\"...\"}'` for the nodes you choose and read the\nbundled `automations` skill for current tool parameters. These tools still need\na configured CLI key even when their own operation is local.\n\nConnections live on the target node, not a separate edges array:\n\n```json\n{\n \"nodes\": [\n {\n \"id\": \"target\",\n \"type\": \"node-type-from-discovery\",\n \"config\": {},\n \"inputs\": {\n \"actual-input-port\": {\n \"sourceNodeId\": \"source\",\n \"sourceOutputId\": \"actual-output-port\"\n }\n }\n }\n ]\n}\n```\n\nUse actual IDs/configuration returned by discovery, not these placeholders.\nConfigure dynamic interfaces before wiring them. Re-check ports after config\nchanges. Current validation requires a terminal outcome; inspect pass-through,\nsave-to-media and posting nodes to choose the intended behavior. Publishing is\nnot required just to make a reviewable workflow output.\n\nFor reusable sub-workflows, configure their input/output contracts explicitly\nand inspect the Compose Workflow node's actual schema. For custom Remotion,\ninspect `remotion-composition`; use its supported composition/props/import\ncontract. Do not invent an upload/register API or rely on arbitrary packages.\n\nValidate using `validate_workflow` with the shape described by the installed\nautomation skill/tool. Execute only the intended single test scope, inspect its\nstatus/output, and retain resolved inputs and seed. Saving a template or receiving\na run ID alone does not prove the output renders correctly.\n\n## Review a representative run\n\nCheck the viewer's actual sequence: hook visibility, subject size, changing state,\ntext wrapping/CTA, transitions and finish. Compare the full frame before zooming\ninto details. Inspect multiple points around animation/text changes. Re-test a\nlonger caption and a different asset where those vary in normal runs.\n\nDistinguish observed pixels/timestamps from estimates. Examples: sRGB sampling\ndoes not recover design colors from compression, transcript word timestamps are\nestimated, sampled OCR leaves gaps, and bounding boxes are not exact ink bounds.\nManually supplied boxes are allowed; describe how they were determined.\n\nPreserve both soundtrack bytes and source attribution. Check whether music is\nembedded or only attributed, whether the output repeats/truncates it, and whether\nvisual changes coincide with the intended moments. Do not invent beat detection,\naudio separation, universal media comparison or other unavailable tools.\n\nWhen revising content, name the concrete issue and inspect the changed output.\nKeep reusable parameters instead of baking a correction into one reference\nimage. Report remaining defects plainly; avoid calling a draft production-ready\nbased only on successful API execution.\n",
10
10
  "imessage/SKILL.md": "---\nname: imessage\ndescription: Create native iMessage conversation PNGs and videos, or wire messaging scenes into UGC Inc workflows. Use for synthetic text-message content, typing, replies, reactions, receipts, avatars and image attachments.\nallowed-tools: Bash, Read\n---\n\nUse the native service for every iMessage image and video. The old Remotion\ncomposition and iMessage player are removed. Instagram DM remains a separate\nscreenshot implementation. These are synthetic renders, never real messages.\n\nRead the current [authoring guide](https://docs.ugc.inc/guides/imessage-conversations.md)\nand [field contract](https://docs.ugc.inc/data-structures/imessage-conversation.md)\nfor optional appearance, group, reply/reaction and timing fields.\n\n## Author and inspect pacing\n\nGive the conversation one concrete situation, a readable opening, useful replies\nand a clear payoff. Preserve the user's requested tone and product capabilities;\nrendering success does not establish that the dialogue is good. Use stable IDs,\n`sender: \"user\"` for the phone owner and `\"recipient\"` for the other person\n(or declared group participant IDs). Give each bubble one thought. Separate\ncontent generation from reusable appearance/pacing settings.\n\n`compile_imessage_conversation` accepts the authoring JSON and returns duration,\ntyping/arrival schedule and events without submitting a render. Inspect the total\nlength and important pauses; adjust authoring timing before rendering. A long\nconversation at default typing speed may exceed the 120-second limit. Do not\nsubmit the compiled plan to the render endpoint.\n\nFor a populated still, mark all messages `initial: true` and use\n`output: {\"kind\":\"png\"}`. For an animated scene, put only existing history first\nwith `initial:true`; later messages animate. `output:{\"kind\":\"png\",\"atMs\":500}`\nrenders that native moment losslessly. Video defaults to 60fps. Emoji are complete\nUnicode graphemes and local typing uses the native keyboard.\n\n## Render and handle jobs\n\nUse existing UGC credentials/org; restricted keys need `content:render`.\n`render_imessage_conversation` submits authoring JSON and immediately returns a\njob. Check outer `ok`, save `data.jobId`, and poll `get_imessage_conversation`\nwith `{jobId}` until completed/failed/cancelled. Only completed output has a URL.\nUse a bounded polling deadline; on timeout retain the job instead of duplicating\nit. `cancel_imessage_conversation` requests cancellation; keep polling to terminal.\nThese jobs do not use `get_media_analysis`.\n\nAn idempotency key reuses identical input within the org; changing input needs a\nnew key. Status records are retained seven days. Report safe returned errors and\nretryability. Use the SDK methods when shell JSON quoting is awkward.\n\nImage bodies accept exactly one `text`, `imagePngBase64`, or public HTTPS\n`imageUrl`. Contact/group/participant avatars accept a PNG payload or `avatarUrl`.\nThe service resolves URL images; do not make agents build base64 blobs. Avatar\nconversion fits96px, attachment conversion fits2048px; media/request budgets\nstill apply. A document-name string is text, not an actual file attachment;\nrender a deliberate PNG asset if the format calls for an image of a document.\n\n## Workflow integration\n\nDiscover `create-dm` with `get_node_type`. Configure:\n\n```json\n{\n \"platform\": \"imessage\",\n \"platformInputType\": \"static\",\n \"imessageRenderMode\": \"conversation\",\n \"imessageOutputType\": \"video\",\n \"imessageConversationInputType\": \"variable\"\n}\n```\n\nConnect the full authoring object to `conversation`. The output port is `output`;\n`imessageOutputType:\"image\"` fixes an image port, `\"video\"` fixes a video port.\nA variable input declaring the opposite output kind rejects. Static settings use\n`imessageConversation`. For a direct-chat avatar, set `profilePicInputType` to\n`variable` and connect `profile-pic`. To replace an image message, set\n`imageAttachmentInputType` to `variable`, set `imessageAttachmentMessageId` to the\ntarget ID and connect `image-attachment`. Input images retain normal `{url}` shape.\n\nSaved screenshot nodes retain their existing connections and resolve to native\npopulated PNGs. Custom bubble colors, message-based cropping and free-text legacy\nread receipts need explicit correction; do not silently discard them. Use native\nmessage receipt/readAt fields or downstream composition as appropriate.\n\nValidate the graph before running. Feed video into Video Composer alongside the\nreaction clip, soundtrack and required CTA; feed PNG into an image workflow.\nEnd with Save to Media or a Pass-Through output for review. Do not add posting\nor recurrence without authorization. Use the automations skill for graph details.\n\n## Review boundaries\n\nInspect PNGs and opening/changing/final video states at phone viewing size.\nUse the compiled schedule to choose moments around typing, arrival and payoff;\ncheck scrolling, emoji, attachments and end hold. Native video is1126×2436 with\none codec-padding column; PNG is1125×2436. Composite deliberately into the target\ncanvas. Audio is added separately; inspect the final mixed video's actual audio.\n\nThe profile is iPhone XS/iOS18.6.2, not the newest iOS UI. Full-screen/bubble-send\neffects, arbitrary fonts/coordinates and custom native dimensions/fps are absent.\nSeeded timing is repeatable, but independent reaction pixels can differ. Do not\npromise universal pixel parity. Share only decoded, verified public HTTPS previews,\nincluding video Range support. Describe uninspected playback/audio honestly.\n"
11
11
  };