@fungi.computer/darkroom 0.1.0 → 0.2.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.
@@ -28,10 +28,10 @@ new MediaExecutionError(stage, options?): MediaExecutionError;
28
28
 
29
29
  ###### Parameters
30
30
 
31
- | Parameter | Type | Description |
32
- | ---------- | ----------------------------------------- | ------------------------------------------- |
33
- | `stage` | [`MediaFailureStage`](#mediafailurestage) | Execution stage where the failure occurred. |
34
- | `options?` | `ErrorOptions` | - |
31
+ | Parameter | Type | Description |
32
+ | ---------- | ----------------------------------------------------------- | ------------------------------------------- |
33
+ | `stage` | [`MediaFailureStage`](#mediafailurestage) | Execution stage where the failure occurred. |
34
+ | `options?` | [`MediaExecutionErrorOptions`](#mediaexecutionerroroptions) | - |
35
35
 
36
36
  ###### Returns
37
37
 
@@ -45,6 +45,14 @@ Error.constructor;
45
45
 
46
46
  #### Properties
47
47
 
48
+ ##### provider
49
+
50
+ ```ts
51
+ readonly provider: MediaProviderDiagnostic | undefined;
52
+ ```
53
+
54
+ Safe provider facts only; the original cause remains private.
55
+
48
56
  ##### stage
49
57
 
50
58
  ```ts
@@ -150,7 +158,12 @@ read():
150
158
  | "succeeded"
151
159
  | "interrupted";
152
160
  spentFailure: "output_format_mismatch" | null;
153
- providerRefusal: "safety_filter_refused" | null;
161
+ providerFailure: | Readonly<{
162
+ stage: "provider" | "normalization";
163
+ safetyRefused: boolean;
164
+ provider?: MediaProviderDiagnostic;
165
+ }>
166
+ | null;
154
167
  estimatedCostMilliunits: number | null;
155
168
  image: | {
156
169
  bytes: number;
@@ -179,11 +192,12 @@ erasure.
179
192
  `string`; `owner`: `string`; `state`: \| `"admitted"` \| `"estimating"` \|
180
193
  `"generating"` \| `"writing"` \| `"charging"` \| `"written"` \| `"succeeded"` \|
181
194
  `"interrupted"`; `spentFailure`: `"output_format_mismatch"` \| `null`;
182
- `providerRefusal`: `"safety_filter_refused"` \| `null`;
183
- `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`: `number`;
184
- `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`: `string`;
185
- `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \} \| `null`;
186
- `createdAt`: `number`; `updatedAt`: `number`; \}\> \| `null`
195
+ `providerFailure`: \| `Readonly`\<\{ `stage`: `"provider"` \| `"normalization"`;
196
+ `safetyRefused`: `boolean`; `provider?`: `MediaProviderDiagnostic`; \}\> \|
197
+ `null`; `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`:
198
+ `number`; `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`:
199
+ `string`; `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \}
200
+ \| `null`; `createdAt`: `number`; `updatedAt`: `number`; \}\> \| `null`
187
201
 
188
202
  ##### preflightErasure()
189
203
 
@@ -311,7 +325,12 @@ recordEstimate(leaseId, costMilliunits): Readonly<{
311
325
  | "succeeded"
312
326
  | "interrupted";
313
327
  spentFailure: "output_format_mismatch" | null;
314
- providerRefusal: "safety_filter_refused" | null;
328
+ providerFailure: | Readonly<{
329
+ stage: "provider" | "normalization";
330
+ safetyRefused: boolean;
331
+ provider?: MediaProviderDiagnostic;
332
+ }>
333
+ | null;
315
334
  estimatedCostMilliunits: number | null;
316
335
  image: | {
317
336
  bytes: number;
@@ -345,11 +364,12 @@ Pin the admitted price and begin the generation lease.
345
364
  `string`; `owner`: `string`; `state`: \| `"admitted"` \| `"estimating"` \|
346
365
  `"generating"` \| `"writing"` \| `"charging"` \| `"written"` \| `"succeeded"` \|
347
366
  `"interrupted"`; `spentFailure`: `"output_format_mismatch"` \| `null`;
348
- `providerRefusal`: `"safety_filter_refused"` \| `null`;
349
- `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`: `number`;
350
- `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`: `string`;
351
- `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \} \| `null`;
352
- `createdAt`: `number`; `updatedAt`: `number`; \}\>
367
+ `providerFailure`: \| `Readonly`\<\{ `stage`: `"provider"` \| `"normalization"`;
368
+ `safetyRefused`: `boolean`; `provider?`: `MediaProviderDiagnostic`; \}\> \|
369
+ `null`; `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`:
370
+ `number`; `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`:
371
+ `string`; `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \}
372
+ \| `null`; `createdAt`: `number`; `updatedAt`: `number`; \}\>
353
373
 
354
374
  ##### dispatchInBackground()
355
375
 
@@ -368,7 +388,12 @@ dispatchInBackground(leaseId, references): Promise<Readonly<{
368
388
  | "succeeded"
369
389
  | "interrupted";
370
390
  spentFailure: "output_format_mismatch" | null;
371
- providerRefusal: "safety_filter_refused" | null;
391
+ providerFailure: | Readonly<{
392
+ stage: "provider" | "normalization";
393
+ safetyRefused: boolean;
394
+ provider?: MediaProviderDiagnostic;
395
+ }>
396
+ | null;
372
397
  estimatedCostMilliunits: number | null;
373
398
  image: | {
374
399
  bytes: number;
@@ -404,11 +429,13 @@ output, and releases the lease so a later retry saves and charges it.
404
429
  `namespace`: `string`; `owner`: `string`; `state`: \| `"admitted"` \|
405
430
  `"estimating"` \| `"generating"` \| `"writing"` \| `"charging"` \| `"written"`
406
431
  \| `"succeeded"` \| `"interrupted"`; `spentFailure`: `"output_format_mismatch"`
407
- \| `null`; `providerRefusal`: `"safety_filter_refused"` \| `null`;
408
- `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`: `number`;
409
- `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`: `string`;
410
- `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \} \| `null`;
411
- `createdAt`: `number`; `updatedAt`: `number`; \}\>\>
432
+ \| `null`; `providerFailure`: \| `Readonly`\<\{ `stage`: `"provider"` \|
433
+ `"normalization"`; `safetyRefused`: `boolean`; `provider?`:
434
+ `MediaProviderDiagnostic`; \}\> \| `null`; `estimatedCostMilliunits`: `number`
435
+ \| `null`; `image`: \| \{ `bytes`: `number`; `format`: `string`; \} \| `null`;
436
+ `result`: \| \{ `generationId`: `string`; `bytes`: `number`; `format`: `string`;
437
+ `costMilliunits`: `number`; \} \| `null`; `createdAt`: `number`; `updatedAt`:
438
+ `number`; \}\>\>
412
439
 
413
440
  ##### alarm()
414
441
 
@@ -425,17 +452,17 @@ Run a background generation once; a retried alarm never redispatches.
425
452
  ##### interruptGeneration()
426
453
 
427
454
  ```ts
428
- interruptGeneration(leaseId, refusalInput?): MediaOperationProjection;
455
+ interruptGeneration(leaseId, failureInput?): MediaOperationProjection;
429
456
  ```
430
457
 
431
458
  An aborted in-flight provider call is terminal for this request ID.
432
459
 
433
460
  ###### Parameters
434
461
 
435
- | Parameter | Type |
436
- | --------------- | ------------------------- |
437
- | `leaseId` | `string` |
438
- | `refusalInput?` | `"safety_filter_refused"` |
462
+ | Parameter | Type |
463
+ | --------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
464
+ | `leaseId` | `string` |
465
+ | `failureInput?` | `Readonly`\<\{ `stage`: `"provider"` \| `"normalization"`; `safetyRefused`: `boolean`; `provider?`: `MediaProviderDiagnostic`; \}\> |
439
466
 
440
467
  ###### Returns
441
468
 
@@ -522,7 +549,12 @@ recordWritten(
522
549
  | "succeeded"
523
550
  | "interrupted";
524
551
  spentFailure: "output_format_mismatch" | null;
525
- providerRefusal: "safety_filter_refused" | null;
552
+ providerFailure: | Readonly<{
553
+ stage: "provider" | "normalization";
554
+ safetyRefused: boolean;
555
+ provider?: MediaProviderDiagnostic;
556
+ }>
557
+ | null;
526
558
  estimatedCostMilliunits: number | null;
527
559
  image: | {
528
560
  bytes: number;
@@ -559,11 +591,12 @@ Record a destination write and move to idempotent settlement.
559
591
  `string`; `owner`: `string`; `state`: \| `"admitted"` \| `"estimating"` \|
560
592
  `"generating"` \| `"writing"` \| `"charging"` \| `"written"` \| `"succeeded"` \|
561
593
  `"interrupted"`; `spentFailure`: `"output_format_mismatch"` \| `null`;
562
- `providerRefusal`: `"safety_filter_refused"` \| `null`;
563
- `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`: `number`;
564
- `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`: `string`;
565
- `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \} \| `null`;
566
- `createdAt`: `number`; `updatedAt`: `number`; \}\>
594
+ `providerFailure`: \| `Readonly`\<\{ `stage`: `"provider"` \| `"normalization"`;
595
+ `safetyRefused`: `boolean`; `provider?`: `MediaProviderDiagnostic`; \}\> \|
596
+ `null`; `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`:
597
+ `number`; `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`:
598
+ `string`; `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \}
599
+ \| `null`; `createdAt`: `number`; `updatedAt`: `number`; \}\>
567
600
 
568
601
  ##### recordWrittenWithoutSettlement()
569
602
 
@@ -586,7 +619,12 @@ recordWrittenWithoutSettlement(
586
619
  | "succeeded"
587
620
  | "interrupted";
588
621
  spentFailure: "output_format_mismatch" | null;
589
- providerRefusal: "safety_filter_refused" | null;
622
+ providerFailure: | Readonly<{
623
+ stage: "provider" | "normalization";
624
+ safetyRefused: boolean;
625
+ provider?: MediaProviderDiagnostic;
626
+ }>
627
+ | null;
590
628
  estimatedCostMilliunits: number | null;
591
629
  image: | {
592
630
  bytes: number;
@@ -625,11 +663,12 @@ repeats provider generation.
625
663
  `string`; `owner`: `string`; `state`: \| `"admitted"` \| `"estimating"` \|
626
664
  `"generating"` \| `"writing"` \| `"charging"` \| `"written"` \| `"succeeded"` \|
627
665
  `"interrupted"`; `spentFailure`: `"output_format_mismatch"` \| `null`;
628
- `providerRefusal`: `"safety_filter_refused"` \| `null`;
629
- `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`: `number`;
630
- `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`: `string`;
631
- `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \} \| `null`;
632
- `createdAt`: `number`; `updatedAt`: `number`; \}\>
666
+ `providerFailure`: \| `Readonly`\<\{ `stage`: `"provider"` \| `"normalization"`;
667
+ `safetyRefused`: `boolean`; `provider?`: `MediaProviderDiagnostic`; \}\> \|
668
+ `null`; `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`:
669
+ `number`; `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`:
670
+ `string`; `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \}
671
+ \| `null`; `createdAt`: `number`; `updatedAt`: `number`; \}\>
633
672
 
634
673
  ##### recordSucceeded()
635
674
 
@@ -648,7 +687,12 @@ recordSucceeded(leaseId, resultInput): Readonly<{
648
687
  | "succeeded"
649
688
  | "interrupted";
650
689
  spentFailure: "output_format_mismatch" | null;
651
- providerRefusal: "safety_filter_refused" | null;
690
+ providerFailure: | Readonly<{
691
+ stage: "provider" | "normalization";
692
+ safetyRefused: boolean;
693
+ provider?: MediaProviderDiagnostic;
694
+ }>
695
+ | null;
652
696
  estimatedCostMilliunits: number | null;
653
697
  image: | {
654
698
  bytes: number;
@@ -686,11 +730,12 @@ Commit the settled receipt after verifying the saved output and admitted price.
686
730
  `string`; `owner`: `string`; `state`: \| `"admitted"` \| `"estimating"` \|
687
731
  `"generating"` \| `"writing"` \| `"charging"` \| `"written"` \| `"succeeded"` \|
688
732
  `"interrupted"`; `spentFailure`: `"output_format_mismatch"` \| `null`;
689
- `providerRefusal`: `"safety_filter_refused"` \| `null`;
690
- `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`: `number`;
691
- `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`: `string`;
692
- `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \} \| `null`;
693
- `createdAt`: `number`; `updatedAt`: `number`; \}\>
733
+ `providerFailure`: \| `Readonly`\<\{ `stage`: `"provider"` \| `"normalization"`;
734
+ `safetyRefused`: `boolean`; `provider?`: `MediaProviderDiagnostic`; \}\> \|
735
+ `null`; `estimatedCostMilliunits`: `number` \| `null`; `image`: \| \{ `bytes`:
736
+ `number`; `format`: `string`; \} \| `null`; `result`: \| \{ `generationId`:
737
+ `string`; `bytes`: `number`; `format`: `string`; `costMilliunits`: `number`; \}
738
+ \| `null`; `createdAt`: `number`; `updatedAt`: `number`; \}\>
694
739
 
695
740
  ##### releaseEstimate()
696
741
 
@@ -725,6 +770,22 @@ Execution stage at which a generation failed.
725
770
 
726
771
  ---
727
772
 
773
+ ### MediaExecutionErrorOptions
774
+
775
+ ```ts
776
+ type MediaExecutionErrorOptions = ErrorOptions & object;
777
+ ```
778
+
779
+ Private cause plus an independently decoded, safe provider diagnostic.
780
+
781
+ #### Type Declaration
782
+
783
+ | Name | Type | Description |
784
+ | ----------- | ------------------------- | ------------------------------------------------------------------- |
785
+ | `provider?` | `MediaProviderDiagnostic` | Safe provider facts, when the failure came from provider transport. |
786
+
787
+ ---
788
+
728
789
  ### MediaBillingRefusalCode
729
790
 
730
791
  ```ts
@@ -749,6 +810,41 @@ What one generation bills: whole images, or seconds of video.
749
810
 
750
811
  ---
751
812
 
813
+ ### MediaBindingGeneration
814
+
815
+ ```ts
816
+ type MediaBindingGeneration = z.output<typeof mediaBindingGenerationSchema>;
817
+ ```
818
+
819
+ Parsed generation command consumed by either host.
820
+
821
+ ---
822
+
823
+ ### MediaBindingCall
824
+
825
+ ```ts
826
+ type MediaBindingCall = z.output<typeof mediaBindingCallSchema>;
827
+ ```
828
+
829
+ Parsed call consumed by host admission and transport.
830
+
831
+ ---
832
+
833
+ ### MediaBindingRequest
834
+
835
+ ```ts
836
+ type MediaBindingRequest = Readonly<{
837
+ path: string;
838
+ settings: MediaGenerationSettings;
839
+ outputFormat?: z.output<typeof mediaRequestedImageFormatSchema>;
840
+ }>;
841
+ ```
842
+
843
+ Relative service input after the host attaches its trusted Computer to
844
+ references.
845
+
846
+ ---
847
+
752
848
  ### MediaMetering
753
849
 
754
850
  ```ts
@@ -861,7 +957,11 @@ type MediaOperationProjection = Readonly<{
861
957
  owner: string;
862
958
  state: MediaOperationState;
863
959
  spentFailure: "output_format_mismatch" | null;
864
- providerRefusal: "safety_filter_refused" | null;
960
+ providerFailure: Readonly<{
961
+ stage: Extract<MediaFailureStage, "provider" | "normalization">;
962
+ safetyRefused: boolean;
963
+ provider?: MediaProviderDiagnostic;
964
+ }> | null;
865
965
  estimatedCostMilliunits: number | null;
866
966
  image: MediaImage | null;
867
967
  result: MediaOperationResult | null;
@@ -1424,6 +1524,253 @@ The typed result of one generation, shared by the Hono route and the Agent path.
1424
1524
 
1425
1525
  ## Variables
1426
1526
 
1527
+ ### mediaImageBindingInputSchema
1528
+
1529
+ ```ts
1530
+ const mediaImageBindingInputSchema: ZodObject<{
1531
+ kind: ZodLiteral<"image">;
1532
+ requestId: ZodLazy<ZodString>;
1533
+ libraryPath: ZodString & ZodType<string, string, $ZodTypeInternals<string, string>>;
1534
+ settings: ZodObject<{
1535
+ model: ZodString;
1536
+ prompt: ZodString;
1537
+ width: ZodNumber;
1538
+ height: ZodNumber;
1539
+ resolution: ZodOptional<ZodEnum<{
1540
+ p480: "480p";
1541
+ p720: "720p";
1542
+ p768: "768p";
1543
+ p1080: "1080p";
1544
+ p4k: "4k";
1545
+ }>>;
1546
+ aspectRatio: ZodOptional<ZodEnum<{
1547
+ wide: "16:9";
1548
+ landscape: "4:3";
1549
+ square: "1:1";
1550
+ portrait: "3:4";
1551
+ tall: "9:16";
1552
+ ultrawide: "21:9";
1553
+ ultratall: "9:21";
1554
+ }>>;
1555
+ generateAudio: ZodOptional<ZodBoolean>;
1556
+ references: ZodOptional<ZodArray<ZodObject<{
1557
+ path: ZodString;
1558
+ role: ZodOptional<ZodEnum<{
1559
+ first: ...;
1560
+ last: ...;
1561
+ reference: ...;
1562
+ }>>;
1563
+ }, $strict>>>;
1564
+ steps: ZodOptional<ZodNumber>;
1565
+ }, $strict>;
1566
+ outputFormat: ZodOptional<ZodEnum<{
1567
+ png: "png";
1568
+ jpeg: "jpeg";
1569
+ webp: "webp";
1570
+ }>>;
1571
+ }, $strict>;
1572
+ ```
1573
+
1574
+ Image settings and path references crossing a scoped MEDIA binding.
1575
+
1576
+ ---
1577
+
1578
+ ### mediaVideoBindingInputSchema
1579
+
1580
+ ```ts
1581
+ const mediaVideoBindingInputSchema: ZodObject<{
1582
+ kind: ZodLiteral<"video">;
1583
+ requestId: ZodLazy<ZodString>;
1584
+ libraryPath: ZodString & ZodType<string, string, $ZodTypeInternals<string, string>>;
1585
+ settings: ZodLazy<ZodObject<{
1586
+ model: ZodEnum<{
1587
+ seedance: "bytedance/seedance-2.0";
1588
+ seedanceFast: "bytedance/seedance-2.0-fast";
1589
+ seedanceMini: "bytedance/seedance-2.0-mini";
1590
+ veo: "google/veo-3.1";
1591
+ veoFast: "google/veo-3.1-fast";
1592
+ minimaxH3Max: "minimax/h3-max";
1593
+ }>;
1594
+ prompt: ZodString;
1595
+ resolution: ZodOptional<ZodEnum<{
1596
+ p480: "480p";
1597
+ p720: "720p";
1598
+ p768: "768p";
1599
+ p1080: "1080p";
1600
+ p4k: "4k";
1601
+ }>>;
1602
+ aspectRatio: ZodOptional<ZodEnum<{
1603
+ wide: "16:9";
1604
+ landscape: "4:3";
1605
+ square: "1:1";
1606
+ portrait: "3:4";
1607
+ tall: "9:16";
1608
+ ultrawide: "21:9";
1609
+ ultratall: "9:21";
1610
+ }>>;
1611
+ durationSeconds: ZodOptional<ZodNumber>;
1612
+ generateAudio: ZodOptional<ZodBoolean>;
1613
+ references: ZodOptional<ZodArray<ZodLazy<ZodObject<{
1614
+ path: ZodString;
1615
+ role: ZodEnum<...>;
1616
+ }, $strict>>>>;
1617
+ }, $strict>>;
1618
+ }, $strict>;
1619
+ ```
1620
+
1621
+ Video settings and path references crossing the same scoped binding.
1622
+
1623
+ ---
1624
+
1625
+ ### mediaBindingGenerationSchema
1626
+
1627
+ ```ts
1628
+ const mediaBindingGenerationSchema: ZodDiscriminatedUnion<[ZodObject<{
1629
+ kind: ZodLiteral<"image">;
1630
+ requestId: ZodLazy<ZodString>;
1631
+ libraryPath: ZodString & ZodType<string, string, $ZodTypeInternals<string, string>>;
1632
+ settings: ZodObject<{
1633
+ model: ZodString;
1634
+ prompt: ZodString;
1635
+ width: ZodNumber;
1636
+ height: ZodNumber;
1637
+ resolution: ZodOptional<ZodEnum<{
1638
+ p480: "480p";
1639
+ p720: "720p";
1640
+ p768: "768p";
1641
+ p1080: "1080p";
1642
+ p4k: "4k";
1643
+ }>>;
1644
+ aspectRatio: ZodOptional<ZodEnum<{
1645
+ wide: "16:9";
1646
+ landscape: "4:3";
1647
+ square: "1:1";
1648
+ portrait: "3:4";
1649
+ tall: "9:16";
1650
+ ultrawide: "21:9";
1651
+ ultratall: "9:21";
1652
+ }>>;
1653
+ generateAudio: ZodOptional<ZodBoolean>;
1654
+ references: ZodOptional<ZodArray<ZodObject<{
1655
+ path: ZodString;
1656
+ role: ZodOptional<...>;
1657
+ }, $strict>>>;
1658
+ steps: ZodOptional<ZodNumber>;
1659
+ }, $strict>;
1660
+ outputFormat: ZodOptional<ZodEnum<{
1661
+ png: "png";
1662
+ jpeg: "jpeg";
1663
+ webp: "webp";
1664
+ }>>;
1665
+ }, $strict>, ZodObject<{
1666
+ kind: ZodLiteral<"video">;
1667
+ requestId: ZodLazy<ZodString>;
1668
+ libraryPath: ZodString & ZodType<string, string, $ZodTypeInternals<string, string>>;
1669
+ settings: ZodLazy<ZodObject<{
1670
+ model: ZodEnum<{
1671
+ seedance: "bytedance/seedance-2.0";
1672
+ seedanceFast: "bytedance/seedance-2.0-fast";
1673
+ seedanceMini: "bytedance/seedance-2.0-mini";
1674
+ veo: "google/veo-3.1";
1675
+ veoFast: "google/veo-3.1-fast";
1676
+ minimaxH3Max: "minimax/h3-max";
1677
+ }>;
1678
+ prompt: ZodString;
1679
+ resolution: ZodOptional<ZodEnum<{
1680
+ p480: "480p";
1681
+ p720: "720p";
1682
+ p768: "768p";
1683
+ p1080: "1080p";
1684
+ p4k: "4k";
1685
+ }>>;
1686
+ aspectRatio: ZodOptional<ZodEnum<{
1687
+ wide: "16:9";
1688
+ landscape: "4:3";
1689
+ square: "1:1";
1690
+ portrait: "3:4";
1691
+ tall: "9:16";
1692
+ ultrawide: "21:9";
1693
+ ultratall: "9:21";
1694
+ }>>;
1695
+ durationSeconds: ZodOptional<ZodNumber>;
1696
+ generateAudio: ZodOptional<ZodBoolean>;
1697
+ references: ZodOptional<ZodArray<ZodLazy<ZodObject<..., ...>>>>;
1698
+ }, $strict>>;
1699
+ }, $strict>], "kind">;
1700
+ ```
1701
+
1702
+ One generation identity, including the App-owned folder captured for replay.
1703
+
1704
+ ---
1705
+
1706
+ ### mediaBindingCallSchema
1707
+
1708
+ ```ts
1709
+ const mediaBindingCallSchema: ZodDiscriminatedUnion<[ZodObject<{
1710
+ operation: ZodLiteral<"models">;
1711
+ input: ZodObject<{
1712
+ }, $strict>;
1713
+ }, $strict>, ZodObject<{
1714
+ operation: ZodLiteral<"generate">;
1715
+ input: ZodDiscriminatedUnion<[ZodObject<{
1716
+ kind: ZodLiteral<"image">;
1717
+ requestId: ZodLazy<ZodString>;
1718
+ libraryPath: ZodString & ZodType<string, string, $ZodTypeInternals<..., ...>>;
1719
+ settings: ZodObject<{
1720
+ model: ZodString;
1721
+ prompt: ZodString;
1722
+ width: ZodNumber;
1723
+ height: ZodNumber;
1724
+ resolution: ZodOptional<...>;
1725
+ aspectRatio: ZodOptional<...>;
1726
+ generateAudio: ZodOptional<...>;
1727
+ references: ZodOptional<...>;
1728
+ steps: ZodOptional<...>;
1729
+ }, $strict>;
1730
+ outputFormat: ZodOptional<ZodEnum<{
1731
+ png: ...;
1732
+ jpeg: ...;
1733
+ webp: ...;
1734
+ }>>;
1735
+ }, $strict>, ZodObject<{
1736
+ kind: ZodLiteral<"video">;
1737
+ requestId: ZodLazy<ZodString>;
1738
+ libraryPath: ZodString & ZodType<string, string, $ZodTypeInternals<..., ...>>;
1739
+ settings: ZodLazy<ZodObject<{
1740
+ model: ...;
1741
+ prompt: ...;
1742
+ resolution: ...;
1743
+ aspectRatio: ...;
1744
+ durationSeconds: ...;
1745
+ generateAudio: ...;
1746
+ references: ...;
1747
+ }, $strict>>;
1748
+ }, $strict>], "kind">;
1749
+ }, $strict>], "operation">;
1750
+ ```
1751
+
1752
+ Maintained MEDIA method grammar; guest input carries no principal or Computer.
1753
+
1754
+ ---
1755
+
1756
+ ### mediaPendingSchema
1757
+
1758
+ ```ts
1759
+ const mediaPendingSchema: ZodLazy<
1760
+ ZodObject<
1761
+ {
1762
+ status: ZodLiteral<"pending">;
1763
+ retryAfterSeconds: ZodNumber;
1764
+ },
1765
+ $strict
1766
+ >
1767
+ >;
1768
+ ```
1769
+
1770
+ Background-generation reply emitted by the durable service.
1771
+
1772
+ ---
1773
+
1427
1774
  ### mediaResultSchema
1428
1775
 
1429
1776
  ```ts
@@ -1454,19 +1801,21 @@ Decode a completed generation, destination path and estimated or settled price.
1454
1801
  ### mediaOperationDestinationSchema
1455
1802
 
1456
1803
  ```ts
1457
- const mediaOperationDestinationSchema: ZodObject<
1458
- {
1459
- computerId: ZodString;
1460
- path: ZodString;
1461
- outputFormat: ZodOptional<
1462
- ZodEnum<{
1463
- png: "png";
1464
- jpeg: "jpeg";
1465
- webp: "webp";
1466
- }>
1467
- >;
1468
- },
1469
- $strict
1804
+ const mediaOperationDestinationSchema: ZodLazy<
1805
+ ZodObject<
1806
+ {
1807
+ computerId: ZodString;
1808
+ path: ZodString;
1809
+ outputFormat: ZodOptional<
1810
+ ZodEnum<{
1811
+ png: "png";
1812
+ jpeg: "jpeg";
1813
+ webp: "webp";
1814
+ }>
1815
+ >;
1816
+ },
1817
+ $strict
1818
+ >
1470
1819
  >;
1471
1820
  ```
1472
1821
 
@@ -1512,12 +1861,14 @@ Decode durable generation, save and settlement states.
1512
1861
  ### mediaImageSchema
1513
1862
 
1514
1863
  ```ts
1515
- const mediaImageSchema: ZodObject<
1516
- {
1517
- bytes: ZodNumber;
1518
- format: ZodString;
1519
- },
1520
- $strict
1864
+ const mediaImageSchema: ZodLazy<
1865
+ ZodObject<
1866
+ {
1867
+ bytes: ZodNumber;
1868
+ format: ZodString;
1869
+ },
1870
+ $strict
1871
+ >
1521
1872
  >;
1522
1873
  ```
1523
1874
 
@@ -1528,14 +1879,16 @@ Decode retained or saved output size and encoding.
1528
1879
  ### mediaOperationResultSchema
1529
1880
 
1530
1881
  ```ts
1531
- const mediaOperationResultSchema: ZodObject<
1532
- {
1533
- generationId: ZodString;
1534
- bytes: ZodNumber;
1535
- format: ZodString;
1536
- costMilliunits: ZodNumber;
1537
- },
1538
- $strict
1882
+ const mediaOperationResultSchema: ZodLazy<
1883
+ ZodObject<
1884
+ {
1885
+ generationId: ZodString;
1886
+ bytes: ZodNumber;
1887
+ format: ZodString;
1888
+ costMilliunits: ZodNumber;
1889
+ },
1890
+ $strict
1891
+ >
1539
1892
  >;
1540
1893
  ```
1541
1894
 
@@ -1558,6 +1911,7 @@ const mediaRequestSchema: ZodObject<{
1558
1911
  resolution: ZodOptional<ZodEnum<{
1559
1912
  p480: "480p";
1560
1913
  p720: "720p";
1914
+ p768: "768p";
1561
1915
  p1080: "1080p";
1562
1916
  p4k: "4k";
1563
1917
  }>>;
@@ -1591,22 +1945,6 @@ const mediaRequestSchema: ZodObject<{
1591
1945
 
1592
1946
  Decode relative service generation input. Identity comes from the host.
1593
1947
 
1594
- ---
1595
-
1596
- ### mediaPendingSchema
1597
-
1598
- ```ts
1599
- const mediaPendingSchema: ZodObject<
1600
- {
1601
- status: ZodLiteral<"pending">;
1602
- retryAfterSeconds: ZodNumber;
1603
- },
1604
- $strict
1605
- >;
1606
- ```
1607
-
1608
- A background (video) generation in progress; retry the same request id.
1609
-
1610
1948
  ## Functions
1611
1949
 
1612
1950
  ### mediaUnits()
@@ -1629,6 +1967,140 @@ Billing units for validated settings; video bills its requested length.
1629
1967
 
1630
1968
  ---
1631
1969
 
1970
+ ### parseMediaBindingCall()
1971
+
1972
+ ```ts
1973
+ function parseMediaBindingCall(raw):
1974
+ | Readonly<{
1975
+ kind: "parsed";
1976
+ call:
1977
+ | {
1978
+ operation: "models";
1979
+ input: Record<string, never>;
1980
+ }
1981
+ | {
1982
+ operation: "generate";
1983
+ input:
1984
+ | {
1985
+ kind: "image";
1986
+ requestId: string;
1987
+ libraryPath: string;
1988
+ settings: {
1989
+ model: string;
1990
+ prompt: string;
1991
+ width: number;
1992
+ height: number;
1993
+ resolution?: "480p" | "720p" | "768p" | "1080p" | "4k";
1994
+ aspectRatio?:
1995
+ "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21";
1996
+ generateAudio?: boolean;
1997
+ references?: object[];
1998
+ steps?: number;
1999
+ };
2000
+ outputFormat?: "png" | "jpeg" | "webp";
2001
+ }
2002
+ | {
2003
+ kind: "video";
2004
+ requestId: string;
2005
+ libraryPath: string;
2006
+ settings: {
2007
+ model:
2008
+ | "bytedance/seedance-2.0"
2009
+ | "bytedance/seedance-2.0-fast"
2010
+ | "bytedance/seedance-2.0-mini"
2011
+ | "google/veo-3.1"
2012
+ | "google/veo-3.1-fast"
2013
+ | "minimax/h3-max";
2014
+ prompt: string;
2015
+ resolution?: "480p" | "720p" | "768p" | "1080p" | "4k";
2016
+ aspectRatio?:
2017
+ "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21";
2018
+ durationSeconds?: number;
2019
+ generateAudio?: boolean;
2020
+ references?: object[];
2021
+ };
2022
+ };
2023
+ };
2024
+ }>
2025
+ | Readonly<{
2026
+ kind: "refused";
2027
+ result: JSONType;
2028
+ }>;
2029
+ ```
2030
+
2031
+ Parsing and model refusal stay shared; authorization remains host-owned.
2032
+
2033
+ #### Parameters
2034
+
2035
+ | Parameter | Type |
2036
+ | --------- | ---------- |
2037
+ | `raw` | `JSONType` |
2038
+
2039
+ #### Returns
2040
+
2041
+ \| `Readonly`\<\{ `kind`: `"parsed"`; `call`: \| \{ `operation`: `"models"`;
2042
+ `input`: `Record`\<`string`, `never`\>; \} \| \{ `operation`: `"generate"`;
2043
+ `input`: \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`:
2044
+ `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `width`:
2045
+ `number`; `height`: `number`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \|
2046
+ `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"`
2047
+ \| `"9:16"` \| `"21:9"` \| `"9:21"`; `generateAudio?`: `boolean`; `references?`:
2048
+ `object`[]; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \|
2049
+ `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`:
2050
+ `string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.0"` \|
2051
+ `"bytedance/seedance-2.0-fast"` \| `"bytedance/seedance-2.0-mini"` \|
2052
+ `"google/veo-3.1"` \| `"google/veo-3.1-fast"` \| `"minimax/h3-max"`; `prompt`:
2053
+ `string`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \|
2054
+ `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \|
2055
+ `"21:9"` \| `"9:21"`; `durationSeconds?`: `number`; `generateAudio?`: `boolean`;
2056
+ `references?`: `object`[]; \}; \}; \}; \}\> \| `Readonly`\<\{ `kind`:
2057
+ `"refused"`; `result`: `JSONType`; \}\>
2058
+
2059
+ ---
2060
+
2061
+ ### mediaBindingRequest()
2062
+
2063
+ ```ts
2064
+ function mediaBindingRequest(input, computerId): MediaBindingRequest;
2065
+ ```
2066
+
2067
+ Choose the same fixed filename on both hosts without a recursive App lookup.
2068
+
2069
+ #### Parameters
2070
+
2071
+ | Parameter | Type |
2072
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2073
+ | `input` | \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `width`: `number`; `height`: `number`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `generateAudio?`: `boolean`; `references?`: `object`[]; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \| `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.0"` \| `"bytedance/seedance-2.0-fast"` \| `"bytedance/seedance-2.0-mini"` \| `"google/veo-3.1"` \| `"google/veo-3.1-fast"` \| `"minimax/h3-max"`; `prompt`: `string`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `durationSeconds?`: `number`; `generateAudio?`: `boolean`; `references?`: `object`[]; \}; \} |
2074
+ | `computerId` | `string` |
2075
+
2076
+ #### Returns
2077
+
2078
+ [`MediaBindingRequest`](#mediabindingrequest)
2079
+
2080
+ ---
2081
+
2082
+ ### readMediaBindingReply()
2083
+
2084
+ ```ts
2085
+ function readMediaBindingReply(input, computerId, response): Promise<JSONType>;
2086
+ ```
2087
+
2088
+ Decode bounded service replies once for both MEDIA host bindings.
2089
+
2090
+ #### Parameters
2091
+
2092
+ | Parameter | Type |
2093
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2094
+ | `input` | \| \{ `operation`: `"models"`; `input`: `Record`\<`string`, `never`\>; \} \| \{ `operation`: `"generate"`; `input`: \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `width`: `number`; `height`: `number`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `generateAudio?`: `boolean`; `references?`: `object`[]; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \| `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.0"` \| `"bytedance/seedance-2.0-fast"` \| `"bytedance/seedance-2.0-mini"` \| `"google/veo-3.1"` \| `"google/veo-3.1-fast"` \| `"minimax/h3-max"`; `prompt`: `string`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `durationSeconds?`: `number`; `generateAudio?`: `boolean`; `references?`: `object`[]; \}; \}; \} |
2095
+ | `computerId` | `string` |
2096
+ | `response` | `Response` |
2097
+
2098
+ #### Returns
2099
+
2100
+ `Promise`\<`JSONType`\>
2101
+
2102
+ ---
2103
+
1632
2104
  ### generateMedia()
1633
2105
 
1634
2106
  ```ts