ugcinc 4.26.1 β†’ 4.27.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
@@ -357,6 +357,195 @@ Both operations require an organization and `content:analyze` for scoped keys.
357
357
  Errors may include `errorCode` and `retryable`. Existing scraper credit/rate safeguards
358
358
  apply. Storage/provider errors do not imply that a post or profile was deleted.
359
359
 
360
+ ## Native iMessage conversations and PNG snapshots (staged)
361
+
362
+ The native conversation API is implemented behind a rollout gate and is **not yet
363
+ enabled on the public service**. Until rollout, submission returns a retryable 503.
364
+ The existing still-image DM renderer remains available separately.
365
+
366
+ Quick reference: `client.media.renderIMessageConversation(input)` queues a video by default;
367
+ `client.media.getIMessageConversation({jobId})` polls its status.
368
+ `client.media.cancelIMessageConversation({jobId})` requests cancellation and native cleanup.
369
+ `compileIMessageConversation(input)` previews its deterministic timing plan locally.
370
+
371
+ ```ts
372
+ import {UGCClient, compileIMessageConversation, type IMessageConversationInput} from 'ugcinc';
373
+
374
+ const client = new UGCClient({apiKey: 'YOUR_API_KEY', orgId: 'YOUR_ORG_ID'});
375
+ const input = {
376
+ idempotencyKey: 'conversation-v1',
377
+ contact: {name: 'Alex'},
378
+ theme: 'dark',
379
+ statusBar: {time: '12:34', wifiBars: 3, cellularBars: 4, batteryPercent: 85},
380
+ unreadCount: 12,
381
+ timestampText: 'Today 12:34 PM',
382
+ seed: 42,
383
+ timing: {charactersPerSecond: 7, pauseBeforeMs: 500, pauseBeforeSendMs: 200, incomingTypingDurationMs: 2400},
384
+ messages: [
385
+ {sender: 'recipient', text: 'Ready?', initial: true},
386
+ {sender: 'user', text: 'On my way πŸ‘‹'},
387
+ {sender: 'recipient', text: 'See you soon!', timing: {incomingTypingDurationMs: 3200}},
388
+ ],
389
+ } satisfies IMessageConversationInput;
390
+ const plan = compileIMessageConversation(input);
391
+ const submitted = await client.media.renderIMessageConversation(input);
392
+ if (submitted.ok) {
393
+ const status = await client.media.getIMessageConversation({jobId: submitted.data.jobId});
394
+ if (status.ok && status.data.status === 'completed') console.log(status.data.url);
395
+ }
396
+ // A lossless frame from the same native scene. Omit atMs for its final frame.
397
+ const still = await client.media.renderIMessageConversation({
398
+ ...input, idempotencyKey: 'conversation-png-v1', output: {kind: 'png', atMs: 500},
399
+ });
400
+ ```
401
+
402
+ API reference:
403
+
404
+ - `POST /media/render/imessage`: authenticated organization-scoped submission.
405
+ - `POST /media/render/imessage/status`: `{jobId}`; only jobs owned by that
406
+ organization can be queried.
407
+ - `POST /media/render/imessage/cancel`: `{jobId}`; requests cancellation for an
408
+ owned job. Poll status until `cancelled` or another terminal status. A pending
409
+ request returns `cancelRequested: true`; it does not claim native cleanup has
410
+ finished. Completed jobs retain their result if cancellation arrives too late.
411
+ Scoped keys need `content:render` for all three routes.
412
+ - These return the normal `ApiResponse`. Job data includes `jobId`,
413
+ `status: pending | processing | completed | failed | cancelled`, `progress`, `fps: 60`,
414
+ `durationMs` (planned timeline duration) and `durationInFrames`. Completed jobs
415
+ include an owned HTTPS `url`, `output` settings and `contentType` (`video/mp4`
416
+ or `image/png`). Failed jobs include a safe error and retryability.
417
+ Submission does not wait for completion.
418
+ - Output uses the pinned `iphone-xs-ios18.6.2` UI, native text/emoji and native
419
+ conversation motion. Video is 60fps H264; it is not frame-interpolated.
420
+ Native frames are 1125Γ—2436; MP4 adds one background-colored column for an
421
+ even 1126-pixel codec width. This profile does not represent newer iOS designs.
422
+ - `output` defaults to `{kind: 'video'}`. `{kind: 'png', atMs: 500}` returns the
423
+ original 1125Γ—2436 native full-frame PNG bytes at that exact millisecond timestamp;
424
+ omitting `atMs` selects the final authored frame. Times outside the planned
425
+ conversation reject. PNG uses the same native scene and transitions, with no
426
+ resizing, separate text renderer or lossy video-frame extraction. For PNG jobs,
427
+ `durationInFrames` is 1 while `durationMs` still describes the authored timeline;
428
+ the renderer completes outstanding native actions privately for clean teardown.
429
+ - `contact.name` is the other person's display name/username. Optional
430
+ `contact.avatarPngBase64` is a PNG without a data-URL prefix, at most 512Γ—512
431
+ and 65536 base64 characters; the native ContactsUI component crops it. It is
432
+ an in-memory render input and does not create or save a real contact.
433
+ - `statusBar` supports `time` (H:mm/HH:mm, default `9:41`), `wifiBars` (0–3,
434
+ default 3), `cellularBars` (0–4, default 4), `wifiEnabled`/`cellularEnabled`
435
+ (default true), `batteryPercent` (0–100, default 100), `charging` and
436
+ `lowPowerMode` (default false). Capacity controls the native battery fill;
437
+ it does not turn on a numerical percentage label. These configure render
438
+ models, not the host phone's clock, network or battery settings.
439
+ - `unreadCount` (0–9999, default 0) controls the native back-button badge.
440
+ The number of conversation messages is simply `messages.length`; there is
441
+ no second message-count field to keep in sync. Optional `timestampText`
442
+ replaces native date-header text, independently of the status-bar clock.
443
+ - Provide `contact: {name}` or `group` (described below). `theme` defaults to `dark`, `keyboard` to `true`,
444
+ `fps` to `60` (the only supported rate), `seed` to `0`, and `endHoldMs` to `1500`
445
+ (350–10000). `showIncomingTyping` defaults to `true`.
446
+ - Messages require a `sender` ID (`user | recipient` for direct chats, or a group participant ID) and either nonempty `text` (up to 2000
447
+ UTF-16 code units) or `imagePngBase64`. Image captions and mixed text/image
448
+ messages are rejected. An image must be a single-frame PNG, without a data URL
449
+ prefix, at most 2048Γ—2048 and 8 MiB of base64 characters. The full request is
450
+ limited to 16 MiB; aggregate message image dimensions cannot exceed 16,777,216
451
+ pixels. Outgoing images enter the native composer before send; the plan reserves
452
+ its native attachment transition plus `pauseBeforeSendMs`. Initial and incoming
453
+ images do not open the local composer. `user` is outgoing. Optional IDs must be unique; otherwise
454
+ IDs are generated. `initial: true` supplies preexisting history and must be a
455
+ prefix. Incoming messages may override `showTyping`; their text is hidden
456
+ until arrival. Outgoing text appears in the composer.
457
+ - Outgoing messages accept `receipt: none | delivered | read` (default `none`).
458
+ Read state requires `readAt`, an ISO timestamp with timezone. Animated receipts
459
+ appear `receiptDelayMs` after arrival (0–30000, default 500); history receipts
460
+ are present initially. As in Messages, the visible receipt belongs to the
461
+ latest outgoing message; older receipts disappear when a newer one is sent.
462
+ Delayed receipts extend the render duration so they are not truncated.
463
+ - Default `timing`: `charactersPerSecond: 8` (0.5–60), `pauseBeforeMs: 450`
464
+ (0–30000), `pauseBeforeSendMs: 180` (0–10000), `punctuationPauseMs: 160`
465
+ (0–2000), `variation: 0.15` (0–0.75). Each message can override any setting.
466
+ Pauses use milliseconds. Typing speed counts complete visible grapheme clusters,
467
+ including a whole family emoji or combining-accent sequence as one character.
468
+ Variation uses the supplied seed. The plan reserves native transition completion
469
+ before starting the next message, then applies `pauseBeforeMs` before typing.
470
+ - Outgoing emoji input is represented explicitly in the authoring timeline:
471
+ open the native emoji keyboard, focus an emoji, select it, then return to the
472
+ letter keyboard when subsequent text needs it. `timing.keyboardSwitchPauseMs`
473
+ (350–10000, default 450) controls the pause after switching keyboards;
474
+ `timing.emojiSelectionDelayMs` (100–10000, default 350) controls the pause before
475
+ selecting a focused emoji. These can be overridden per message. Complete
476
+ grapheme sequences are preserved. Incoming emoji text never opens the local
477
+ keyboard. Outgoing emoji interactions require `keyboard: true`. Emoji that require
478
+ an unsupported long-press skin-tone or family picker reject instead of being
479
+ inserted through an invisible shortcut.
480
+ - Optional `timing.incomingTypingDurationMs` (0–30000) sets the exact interval
481
+ from the other person's typing indicator starting until their message arrives.
482
+ Set it globally or override it in an incoming message's `timing` (for example
483
+ 2400 globally and 3200 for a longer reply). `pauseBeforeMs` still controls when
484
+ typing starts. This replaces the incoming duration calculated from character
485
+ speed, punctuation and the pre-send pause; outgoing composer speed is unchanged.
486
+ Omit it to retain the calculated duration. Zero is supported. With
487
+ `showTyping: false`, the same response delay applies without a visible indicator.
488
+ Setting this field on an outgoing message rejects.
489
+ - `replyTo` on a message names an earlier message ID. Native thread identity,
490
+ quoted context and reply grouping are derived on the render host. Replies to
491
+ replies remain in their original thread, while the visible reply gesture targets
492
+ the exact message named by `replyTo`. For an animated local reply, the compiler
493
+ emits `reply.begin`, long-presses that message, opens its native menu, selects
494
+ **Reply**, and waits for the reply view before typing and sending inside it.
495
+ It emits `reply.end` after sending and closes the
496
+ reply view before the next local action. `pauseBeforeMs` occurs before the
497
+ gesture; the compiled `typingStartMs` records when typing actually starts after
498
+ the opening transition. Incoming replies and initial history show their reply
499
+ associations without operating the local reply controls. Animated local replies
500
+ require `keyboard: true`; incoming replies and history also work without it.
501
+ - Use `contact` for a direct chat, or `group: {name, localParticipantId,
502
+ participants: [{id, name}]}` for a group. Provide exactly one. A group has
503
+ 3–20 participants including the local participant; IDs are unique. Message
504
+ `sender` and reaction `actor` use those IDs. For direct chats they remain
505
+ `user` and `recipient`. Group names, sender labels, avatars and bubble
506
+ grouping use the native group conversation UI. Optional `group.avatarPngBase64`
507
+ and `participants[].avatarPngBase64` accept the same bounded PNG format as
508
+ `contact.avatarPngBase64`.
509
+ - `statusBar.time` controls only the clock. Top-level `timestampText` controls
510
+ the first conversation separator independently. Optional message `sentAt`
511
+ sets the actual conversation date (ISO 8601 with timezone); provide it for
512
+ every message in chronological order when used. Native date-gap rules create
513
+ later separators. A message's optional `timestampText` forces a separator
514
+ before it and sets its displayed text, such as `Today 3:10 PM`. These dates
515
+ do not affect typing speed or make the rendered video wait through the gap.
516
+ - A message's optional `reactions` array schedules reactions relative to that
517
+ message's arrival (or video start for initial history). Each entry takes an
518
+ `actor`, `delayMs` (0–60000, default 700), and either a classic `reaction:
519
+ love | like | dislike | laugh | emphasize | question` or one `emoji`.
520
+ Local actions open the native reaction picker, hold it for `menuDurationMs`
521
+ (400–10000, default 700), then select the reaction. They reserve the local
522
+ interaction timeline until dismissal completes before further typing or
523
+ another local reaction. `delayMs` is the earliest picker-open time for local
524
+ actions, and the arrival time for remote reactions. Remote reactions do not
525
+ show a local picker. Custom emoji currently work for remote participants;
526
+ local actions accept the six classic picker options. `action: remove`
527
+ selects the actor's current reaction again through the picker, and takes no
528
+ reaction/emoji value. Setting again replaces the actor's previous reaction.
529
+ At most 20 reaction events per message are accepted.
530
+ - Optional `threads: [{messageId, openAtMs, durationMs}]` opens and closes the
531
+ native expanded reply view for reading. These explicit thread views run after
532
+ the conversation and its native transitions settle; typing/sending during
533
+ these read-only views is not supported. Animated local `replyTo` messages use
534
+ their own reply-composition flow described above. Duration is 600–30000ms, at most ten views, without
535
+ overlap. The original conversation returns when the view closes.
536
+ - Maximum 30 messages, 6000 animated visible characters and a planned duration of
537
+ 120 seconds. Invalid or excessive requests reject before device use. The local
538
+ compiler exposes message arrival times, events and frame count.
539
+ - Optional `idempotencyKey` (1–128 characters) deduplicates submissions within an
540
+ organization. Reuse the same body/key to recover the same job; changing the body
541
+ returns 409. To retry a failed render, use a new key or omit it. Job ownership
542
+ records are retained for seven days.
543
+ - This authoring API currently supports text/emoji, initial history and sequential
544
+ conversations with configurable chrome, receipts, reactions and replies. Image attachments,
545
+ carrier-name/network-type selection, numerical
546
+ battery-percentage display and arbitrary timeline seeking are not accepted
547
+ by this contract. Unknown input fields reject rather than silently approximating them.
548
+
360
549
  ## Video inspection
361
550
 
362
551
  ```ts
@@ -1,4 +1,5 @@
1
- import type { ImageValue, TextValue, BooleanValue } from '../types';
1
+ import type { ImageValue, VideoValue, TextValue, BooleanValue } from '../types';
2
+ import type { IMessageConversationInput } from '../../imessage-conversation';
2
3
  import { type InputType, type OutputMode, type SelectionMode } from './types';
3
4
  /** Create DM message structure */
4
5
  export interface CreateDmMessage {
@@ -8,6 +9,7 @@ export interface CreateDmMessage {
8
9
  }
9
10
  /** Create DM inputs - optional based on inputType settings */
10
11
  export interface CreateDmNodeInputs {
12
+ conversation?: IMessageConversationInput;
11
13
  platform?: TextValue;
12
14
  'light-mode'?: BooleanValue;
13
15
  username?: TextValue;
@@ -21,12 +23,15 @@ export interface CreateDmNodeInputs {
21
23
  }
22
24
  /** Create DM has a fixed 'output' port. */
23
25
  export interface CreateDmNodeOutputs {
24
- output: ImageValue;
26
+ output: ImageValue | VideoValue;
25
27
  }
26
28
  export type DmPlatform = 'imessage' | 'instagram';
27
29
  declare const definition: import("./types").NodeDefinition<"create-dm", "generator", {
28
30
  platform: DmPlatform;
29
31
  platformInputType: InputType;
32
+ imessageRenderMode: "still" | "conversation";
33
+ imessageConversationInputType: InputType;
34
+ imessageConversation: IMessageConversationInput | undefined;
30
35
  lightMode: boolean;
31
36
  lightModeInputType: InputType;
32
37
  username: string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const imessage_conversation_1 = require("../../imessage-conversation");
3
4
  const types_1 = require("./types");
4
5
  // =============================================================================
5
6
  // Node Definition
@@ -7,8 +8,8 @@ const types_1 = require("./types");
7
8
  const definition = (0, types_1.defineNode)({
8
9
  nodeId: 'create-dm',
9
10
  label: 'Create DM',
10
- description: 'Create fake DM screenshots for iMessage or Instagram',
11
- guide: 'Renders realistic DM/conversation screenshots (iMessage or Instagram). Best for videos that simulate a conversationβ€”e.g. rizz help, dating advice, or "what would you reply" style content. Use cases: rizz help videos, conversation simulations, dating advice content. Configure platform, light/dark mode, messages, profile pic. Messages can be static or variable (from LLM). Output is an image for Image Composer or Auto Post. Supports dynamic crop to isolate specific messages.',
11
+ description: 'Create DM screenshots or native iMessage videos and snapshots',
12
+ guide: 'Still mode renders legacy iMessage or Instagram screenshots with optional dynamic cropping. Conversation mode renders a native 60fps iMessage video with visible outgoing typing, incoming typing indicators, replies, reactions, receipts and group participants. Set imessageRenderMode to conversation and provide imessageConversation using the public IMessageConversationInput schema; alternatively connect the conversation object input. Native output defaults to video; output {kind: png, atMs: 500} exports a lossless native frame at 500ms, or omit atMs for the final frame. Static native PNG settings expose an image port; dynamic conversation inputs expose image|video. It requires platform imessage with static platform selection. Legacy still mode remains unchanged.',
12
13
  type: 'generator',
13
14
  category: 'Generation',
14
15
  outputModes: ['per-input', 'single'],
@@ -16,6 +17,9 @@ const definition = (0, types_1.defineNode)({
16
17
  defaults: {
17
18
  platform: 'instagram',
18
19
  platformInputType: 'static',
20
+ imessageRenderMode: 'still',
21
+ imessageConversationInputType: 'static',
22
+ imessageConversation: undefined,
19
23
  lightMode: true,
20
24
  lightModeInputType: 'static',
21
25
  username: '',
@@ -48,7 +52,27 @@ const definition = (0, types_1.defineNode)({
48
52
  outputMode: 'per-input',
49
53
  selectionMode: null,
50
54
  },
55
+ validate: config => {
56
+ if (config.imessageRenderMode !== 'conversation')
57
+ return [];
58
+ if (config.platform !== 'imessage' || config.platformInputType === 'variable') {
59
+ return ['Conversation video mode requires iMessage with static platform selection.'];
60
+ }
61
+ if (config.imessageConversationInputType === 'variable')
62
+ return [];
63
+ const parsed = imessage_conversation_1.iMessageConversationSchema.safeParse(config.imessageConversation);
64
+ return parsed.success ? [] : parsed.error.issues.map(issue => `${issue.path.join('.')}: ${issue.message}`);
65
+ },
51
66
  computePorts: ({ config }) => {
67
+ if (config?.imessageRenderMode === 'conversation') {
68
+ return {
69
+ inputs: config.imessageConversationInputType === 'variable'
70
+ ? [{ id: 'conversation', type: 'object', isArray: false, required: true }]
71
+ : [],
72
+ outputs: [{ id: 'output', type: config.imessageConversationInputType === 'variable' ? ['image', 'video']
73
+ : config.imessageConversation?.output?.kind === 'png' ? 'image' : 'video', isArray: false, required: true }],
74
+ };
75
+ }
52
76
  const inputs = [];
53
77
  if (config?.platformInputType === 'variable') {
54
78
  inputs.push({ id: 'platform', type: 'text', isArray: false, required: true });
@@ -101,6 +101,9 @@ export declare const nodeDefinitions: {
101
101
  readonly 'create-dm': NodeDefinition<"create-dm", "generator", {
102
102
  platform: import("./create-dm").DmPlatform;
103
103
  platformInputType: import("./types").InputType;
104
+ imessageRenderMode: "still" | "conversation";
105
+ imessageConversationInputType: import("./types").InputType;
106
+ imessageConversation: import("../..").IMessageConversationInput | undefined;
104
107
  lightMode: boolean;
105
108
  lightModeInputType: import("./types").InputType;
106
109
  username: string;
@@ -333,6 +336,8 @@ export declare const nodeDefinitions: {
333
336
  __TOutputs: import("./screenshot-animation").ScreenshotAnimationNodeOutputs;
334
337
  };
335
338
  readonly 'remotion-composition': NodeDefinition<"remotion-composition", "generator", {
339
+ fps: number;
340
+ durationInFrames: number;
336
341
  width: number;
337
342
  height: number;
338
343
  source: string;
@@ -340,13 +345,11 @@ export declare const nodeDefinitions: {
340
345
  selectionMode: null;
341
346
  outputType: "video" | "image";
342
347
  inputs: {
343
- type: "number" | "boolean" | "object" | "video" | "image" | "text" | "audio";
348
+ type: "number" | "boolean" | "object" | "text" | "video" | "image" | "audio";
344
349
  id: string;
345
350
  isArray: boolean;
346
351
  required: boolean;
347
352
  }[];
348
- fps: number;
349
- durationInFrames: number;
350
353
  inputProps: Record<string, unknown>;
351
354
  }, {
352
355
  [x: string]: import("../types").PortValue | import("../types").PortValue[];
@@ -4,6 +4,8 @@ type Outputs = {
4
4
  output: VideoValue;
5
5
  };
6
6
  declare const defaults: {
7
+ fps: number;
8
+ durationInFrames: number;
7
9
  width: number;
8
10
  height: number;
9
11
  source: string;
@@ -11,16 +13,16 @@ declare const defaults: {
11
13
  selectionMode: null;
12
14
  outputType: "video" | "image";
13
15
  inputs: {
14
- type: "number" | "boolean" | "object" | "video" | "image" | "text" | "audio";
16
+ type: "number" | "boolean" | "object" | "text" | "video" | "image" | "audio";
15
17
  id: string;
16
18
  isArray: boolean;
17
19
  required: boolean;
18
20
  }[];
19
- fps: number;
20
- durationInFrames: number;
21
21
  inputProps: Record<string, unknown>;
22
22
  };
23
23
  declare const _default: import("./types").NodeDefinition<"remotion-composition", "generator", {
24
+ fps: number;
25
+ durationInFrames: number;
24
26
  width: number;
25
27
  height: number;
26
28
  source: string;
@@ -28,13 +30,11 @@ declare const _default: import("./types").NodeDefinition<"remotion-composition",
28
30
  selectionMode: null;
29
31
  outputType: "video" | "image";
30
32
  inputs: {
31
- type: "number" | "boolean" | "object" | "video" | "image" | "text" | "audio";
33
+ type: "number" | "boolean" | "object" | "text" | "video" | "image" | "audio";
32
34
  id: string;
33
35
  isArray: boolean;
34
36
  required: boolean;
35
37
  }[];
36
- fps: number;
37
- durationInFrames: number;
38
38
  inputProps: Record<string, unknown>;
39
39
  }, Inputs, Outputs, false> & {
40
40
  __TInputs: Inputs;