@fungi.computer/darkroom 0.7.0 → 0.8.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.
Files changed (36) hide show
  1. package/README.md +49 -0
  2. package/dist/app-media-contracts.d.ts +103 -12
  3. package/dist/audio-providers/elevenlabs.d.ts +40 -0
  4. package/dist/audio-providers/elevenlabs.js +69 -0
  5. package/dist/audio-reference-types.d.ts +28 -0
  6. package/dist/audio-reference-types.js +16 -0
  7. package/dist/audio-references.d.ts +14 -0
  8. package/dist/audio-references.js +69 -0
  9. package/dist/cloudflare/provider.d.ts +6 -4
  10. package/dist/cloudflare/provider.js +37 -19
  11. package/dist/gateway-models.d.ts +12 -8
  12. package/dist/gateway-models.js +38 -17
  13. package/dist/index.d.ts +70 -15
  14. package/dist/index.js +118 -7
  15. package/dist/media-binding.d.ts +60 -7
  16. package/dist/media-binding.js +41 -19
  17. package/dist/media-generation.js +12 -3
  18. package/dist/media-operation-contract.d.ts +7 -3
  19. package/dist/media-operation-contract.js +6 -4
  20. package/dist/media-operation-owner.d.ts +2 -2
  21. package/dist/media-operation-owner.js +48 -6
  22. package/dist/media-operation.js +4 -2
  23. package/dist/model-catalog.d.ts +169 -4
  24. package/dist/model-catalog.js +180 -4
  25. package/dist/server.d.ts +14 -7
  26. package/dist/server.js +9 -4
  27. package/dist/video-providers/reference-encoding.d.ts +7 -2
  28. package/dist/video-providers/reference-encoding.js +14 -3
  29. package/dist/video-providers/types.d.ts +2 -2
  30. package/dist/video-providers/unified.d.ts +1 -0
  31. package/dist/video-providers/unified.js +4 -2
  32. package/docs/api/app-media-contracts.md +46 -10
  33. package/docs/api/cloudflare.md +3 -3
  34. package/docs/api/index.md +598 -84
  35. package/docs/api/server.md +129 -62
  36. package/package.json +3 -2
@@ -487,7 +487,11 @@ Pin the admitted price and begin the generation lease.
487
487
  ##### dispatchInBackground()
488
488
 
489
489
  ```ts
490
- dispatchInBackground(leaseId, references): Promise<Readonly<{
490
+ dispatchInBackground(
491
+ leaseId,
492
+ references,
493
+ audioReferences
494
+ ): Promise<Readonly<{
491
495
  operationId: string;
492
496
  requestId: string;
493
497
  namespace: string;
@@ -531,10 +535,11 @@ output, and releases the lease so a later retry saves and charges it.
531
535
 
532
536
  ###### Parameters
533
537
 
534
- | Parameter | Type |
535
- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
536
- | `leaseId` | `string` |
537
- | `references` | readonly `Readonly`\<\{ `bytes`: `Uint8Array`; `format`: [`ImageFormat`](index.md#imageformat); `width`: `number`; `height`: `number`; `filename?`: `string`; \}\>[] |
538
+ | Parameter | Type |
539
+ | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
540
+ | `leaseId` | `string` |
541
+ | `references` | readonly `Readonly`\<\{ `bytes`: `Uint8Array`; `format`: [`ImageFormat`](index.md#imageformat); `width`: `number`; `height`: `number`; `filename?`: `string`; \}\>[] |
542
+ | `audioReferences` | readonly `Readonly`\<\{ `bytes`: `Uint8Array`; `mimeType`: [`AudioReferenceMimeType`](index.md#audioreferencemimetype); `durationSeconds`: `number`; `filename?`: `string`; \}\>[] |
538
543
 
539
544
  ###### Returns
540
545
 
@@ -948,12 +953,15 @@ Why the host's billing owner refused to admit a new generation.
948
953
 
949
954
  ```ts
950
955
  type MediaUnits = Readonly<{
951
- unit: "image" | "video_second";
956
+ unit: "image" | "video_second" | "audio_second" | "audio_character_block";
952
957
  units: number;
953
958
  }>;
954
959
  ```
955
960
 
956
- What one generation bills: whole images, or seconds of video.
961
+ What one generation bills: whole images, seconds of video or music, or blocks of
962
+ [AUDIO\_CHARACTER\_BLOCK](index.md#audio_character_block) speech characters (so
963
+ a per-character provider rate is marked up once per block, not rounded up per
964
+ character).
957
965
 
958
966
  ---
959
967
 
@@ -1616,6 +1624,7 @@ type MediaServiceHost = Readonly<{
1616
1624
  authorize: (path) => Promise<void>;
1617
1625
  write: (path, bytes) => Promise<void>;
1618
1626
  readReference?: (reference, model) => Promise<MediaReferenceBytes>;
1627
+ readAudioReference?: (reference) => Promise<Uint8Array>;
1619
1628
  }>;
1620
1629
  onFailure?: (error) => Response | undefined;
1621
1630
  }> &
@@ -1665,10 +1674,10 @@ type MediaGenerationOutcome =
1665
1674
  path: string;
1666
1675
  bytes: number;
1667
1676
  costMilliunits: number;
1668
- format: "png" | "jpeg" | "gif" | "webp" | "mp4";
1669
- height: number;
1677
+ format: "png" | "jpeg" | "gif" | "webp" | "mp4" | "mp3";
1678
+ height?: number;
1670
1679
  model: string;
1671
- width: number;
1680
+ width?: number;
1672
1681
  }>
1673
1682
  | Readonly<{
1674
1683
  kind: "pending";
@@ -1700,8 +1709,6 @@ const mediaImageBindingInputSchema: ZodObject<{
1700
1709
  settings: ZodObject<{
1701
1710
  model: ZodString;
1702
1711
  prompt: ZodString;
1703
- width: ZodNumber;
1704
- height: ZodNumber;
1705
1712
  resolution: ZodOptional<ZodEnum<{
1706
1713
  p480: "480p";
1707
1714
  p720: "720p";
@@ -1728,6 +1735,8 @@ const mediaImageBindingInputSchema: ZodObject<{
1728
1735
  reference: ...;
1729
1736
  }>>;
1730
1737
  }, $strict>>>;
1738
+ width: ZodNumber;
1739
+ height: ZodNumber;
1731
1740
  steps: ZodOptional<ZodNumber>;
1732
1741
  }, $strict>;
1733
1742
  outputFormat: ZodOptional<ZodEnum<{
@@ -1782,6 +1791,9 @@ const mediaVideoBindingInputSchema: ZodObject<{
1782
1791
  path: ZodString;
1783
1792
  role: ZodEnum<...>;
1784
1793
  }, $strict>>>>;
1794
+ audioReferences: ZodOptional<ZodArray<ZodLazy<ZodObject<{
1795
+ path: ZodString;
1796
+ }, $strict>>>>;
1785
1797
  }, $strict>>;
1786
1798
  }, $strict>;
1787
1799
  ```
@@ -1800,8 +1812,6 @@ const mediaBindingGenerationSchema: ZodDiscriminatedUnion<[ZodObject<{
1800
1812
  settings: ZodObject<{
1801
1813
  model: ZodString;
1802
1814
  prompt: ZodString;
1803
- width: ZodNumber;
1804
- height: ZodNumber;
1805
1815
  resolution: ZodOptional<ZodEnum<{
1806
1816
  p480: "480p";
1807
1817
  p720: "720p";
@@ -1824,6 +1834,8 @@ const mediaBindingGenerationSchema: ZodDiscriminatedUnion<[ZodObject<{
1824
1834
  path: ZodString;
1825
1835
  role: ZodOptional<...>;
1826
1836
  }, $strict>>>;
1837
+ width: ZodNumber;
1838
+ height: ZodNumber;
1827
1839
  steps: ZodOptional<ZodNumber>;
1828
1840
  }, $strict>;
1829
1841
  outputFormat: ZodOptional<ZodEnum<{
@@ -1865,6 +1877,21 @@ const mediaBindingGenerationSchema: ZodDiscriminatedUnion<[ZodObject<{
1865
1877
  durationSeconds: ZodOptional<ZodNumber>;
1866
1878
  generateAudio: ZodOptional<ZodBoolean>;
1867
1879
  references: ZodOptional<ZodArray<ZodLazy<ZodObject<..., ...>>>>;
1880
+ audioReferences: ZodOptional<ZodArray<ZodLazy<ZodObject<..., ...>>>>;
1881
+ }, $strict>>;
1882
+ }, $strict>, ZodObject<{
1883
+ kind: ZodLiteral<"audio">;
1884
+ requestId: ZodLazy<ZodString>;
1885
+ libraryPath: ZodString & ZodType<string, string, $ZodTypeInternals<string, string>>;
1886
+ settings: ZodLazy<ZodObject<{
1887
+ model: ZodEnum<{
1888
+ multilingual: "elevenlabs/eleven-multilingual-v2";
1889
+ v3: "elevenlabs/eleven-v3";
1890
+ music: "elevenlabs/music-v2";
1891
+ }>;
1892
+ prompt: ZodString;
1893
+ voiceId: ZodOptional<ZodString>;
1894
+ durationSeconds: ZodOptional<ZodNumber>;
1868
1895
  }, $strict>>;
1869
1896
  }, $strict>], "kind">;
1870
1897
  ```
@@ -1889,12 +1916,12 @@ const mediaBindingCallSchema: ZodDiscriminatedUnion<[ZodObject<{
1889
1916
  settings: ZodObject<{
1890
1917
  model: ZodString;
1891
1918
  prompt: ZodString;
1892
- width: ZodNumber;
1893
- height: ZodNumber;
1894
1919
  resolution: ZodOptional<...>;
1895
1920
  aspectRatio: ZodOptional<...>;
1896
1921
  generateAudio: ZodOptional<...>;
1897
1922
  references: ZodOptional<...>;
1923
+ width: ZodNumber;
1924
+ height: ZodNumber;
1898
1925
  steps: ZodOptional<...>;
1899
1926
  }, $strict>;
1900
1927
  outputFormat: ZodOptional<ZodEnum<{
@@ -1914,6 +1941,17 @@ const mediaBindingCallSchema: ZodDiscriminatedUnion<[ZodObject<{
1914
1941
  durationSeconds: ...;
1915
1942
  generateAudio: ...;
1916
1943
  references: ...;
1944
+ audioReferences: ...;
1945
+ }, $strict>>;
1946
+ }, $strict>, ZodObject<{
1947
+ kind: ZodLiteral<"audio">;
1948
+ requestId: ZodLazy<ZodString>;
1949
+ libraryPath: ZodString & ZodType<string, string, $ZodTypeInternals<..., ...>>;
1950
+ settings: ZodLazy<ZodObject<{
1951
+ model: ...;
1952
+ prompt: ...;
1953
+ voiceId: ...;
1954
+ durationSeconds: ...;
1917
1955
  }, $strict>>;
1918
1956
  }, $strict>], "kind">;
1919
1957
  }, $strict>], "operation">;
@@ -1955,10 +1993,11 @@ const mediaResultSchema: ZodObject<
1955
1993
  gif: "gif";
1956
1994
  webp: "webp";
1957
1995
  mp4: "mp4";
1996
+ mp3: "mp3";
1958
1997
  }>;
1959
- height: ZodNumber;
1998
+ height: ZodOptional<ZodNumber>;
1960
1999
  model: ZodString;
1961
- width: ZodNumber;
2000
+ width: ZodOptional<ZodNumber>;
1962
2001
  },
1963
2002
  $strict
1964
2003
  >;
@@ -2074,10 +2113,11 @@ const mediaRequestSchema: ZodObject<{
2074
2113
  settings: ZodObject<{
2075
2114
  model: ZodString;
2076
2115
  prompt: ZodString;
2077
- width: ZodNumber;
2078
- height: ZodNumber;
2116
+ width: ZodOptional<ZodNumber>;
2117
+ height: ZodOptional<ZodNumber>;
2079
2118
  steps: ZodOptional<ZodNumber>;
2080
2119
  durationSeconds: ZodOptional<ZodNumber>;
2120
+ voiceId: ZodOptional<ZodString>;
2081
2121
  resolution: ZodOptional<ZodEnum<{
2082
2122
  p480: "480p";
2083
2123
  p720: "720p";
@@ -2104,6 +2144,10 @@ const mediaRequestSchema: ZodObject<{
2104
2144
  reference: ...;
2105
2145
  }>>;
2106
2146
  }, $strict>>>;
2147
+ audioReferences: ZodOptional<ZodArray<ZodObject<{
2148
+ computerId: ZodString;
2149
+ path: ZodString;
2150
+ }, $strict>>>;
2107
2151
  }, $strict>;
2108
2152
  outputFormat: ZodOptional<ZodEnum<{
2109
2153
  png: "png";
@@ -2133,12 +2177,12 @@ Quote the catalog defaults through the exact estimator used before dispatch.
2133
2177
 
2134
2178
  #### Returns
2135
2179
 
2136
- | Name | Type | Description |
2137
- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
2138
- | `kind` | `"estimate"` | An indicative quote, not an admitted generation receipt. |
2139
- | `basis` | `"provider-cost"` | Provider cost before the host's billing policy. |
2140
- | `settings` | `Readonly`\<\{ `model`: `string`; `prompt`: `string`; `width`: `number`; `height`: `number`; `steps?`: `number`; `durationSeconds?`: `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?`: readonly `Readonly`\<\{ `computerId`: `string`; `path`: `string`; `role?`: `"first-frame"` \| `"last-frame"` \| `"reference"`; \}\>[]; \}\> | Catalog defaults, a one-character prompt and no references. |
2141
- | `costMilliunits` | `number` | Estimated provider milliunits of a cent for these exact settings. |
2180
+ | Name | Type | Description |
2181
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- |
2182
+ | `kind` | `"estimate"` | An indicative quote, not an admitted generation receipt. |
2183
+ | `basis` | `"provider-cost"` | Provider cost before the host's billing policy. |
2184
+ | `settings` | `Readonly`\<\{ `model`: `string`; `prompt`: `string`; `width?`: `number`; `height?`: `number`; `steps?`: `number`; `durationSeconds?`: `number`; `voiceId?`: `string`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `generateAudio?`: `boolean`; `references?`: readonly `Readonly`\<\{ `computerId`: `string`; `path`: `string`; `role?`: `"first-frame"` \| `"last-frame"` \| `"reference"`; \}\>[]; `audioReferences?`: readonly `Readonly`\<\{ `computerId`: `string`; `path`: `string`; `role?`: `"first-frame"` \| `"last-frame"` \| `"reference"`; \}\>[]; \}\> | Catalog defaults, a one-character prompt and no references. |
2185
+ | `costMilliunits` | `number` | Estimated provider milliunits of a cent for these exact settings. |
2142
2186
 
2143
2187
  ---
2144
2188
 
@@ -2205,13 +2249,13 @@ function parseMediaBindingCall(raw):
2205
2249
  settings: {
2206
2250
  model: string;
2207
2251
  prompt: string;
2208
- width: number;
2209
- height: number;
2210
2252
  resolution?: "480p" | "720p" | "768p" | "1080p" | "4k";
2211
2253
  aspectRatio?:
2212
2254
  "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21";
2213
2255
  generateAudio?: boolean;
2214
2256
  references?: object[];
2257
+ width: number;
2258
+ height: number;
2215
2259
  steps?: number;
2216
2260
  };
2217
2261
  outputFormat?: "png" | "jpeg" | "webp";
@@ -2236,6 +2280,21 @@ function parseMediaBindingCall(raw):
2236
2280
  durationSeconds?: number;
2237
2281
  generateAudio?: boolean;
2238
2282
  references?: object[];
2283
+ audioReferences?: object[];
2284
+ };
2285
+ }
2286
+ | {
2287
+ kind: "audio";
2288
+ requestId: string;
2289
+ libraryPath: string;
2290
+ settings: {
2291
+ model:
2292
+ | "elevenlabs/eleven-multilingual-v2"
2293
+ | "elevenlabs/eleven-v3"
2294
+ | "elevenlabs/music-v2";
2295
+ prompt: string;
2296
+ voiceId?: string;
2297
+ durationSeconds?: number;
2239
2298
  };
2240
2299
  };
2241
2300
  };
@@ -2259,20 +2318,25 @@ Parsing and model refusal stay shared; authorization remains host-owned.
2259
2318
  \| `Readonly`\<\{ `kind`: `"parsed"`; `call`: \| \{ `operation`: `"models"`;
2260
2319
  `input`: `Record`\<`string`, `never`\>; \} \| \{ `operation`: `"generate"`;
2261
2320
  `input`: \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`:
2262
- `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `width`:
2263
- `number`; `height`: `number`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \|
2264
- `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"`
2265
- \| `"9:16"` \| `"21:9"` \| `"9:21"`; `generateAudio?`: `boolean`; `references?`:
2266
- `object`[]; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \|
2267
- `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`:
2321
+ `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `resolution?`:
2322
+ `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`:
2323
+ `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`;
2324
+ `generateAudio?`: `boolean`; `references?`: `object`[]; `width`: `number`;
2325
+ `height`: `number`; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"`
2326
+ \| `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`:
2268
2327
  `string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.5"` \|
2269
2328
  `"bytedance/seedance-2.0"` \| `"bytedance/seedance-2.0-fast"` \|
2270
2329
  `"bytedance/seedance-2.0-mini"` \| `"google/veo-3.1"` \| `"google/veo-3.1-fast"`
2271
2330
  \| `"minimax/h3-max"`; `prompt`: `string`; `resolution?`: `"480p"` \| `"720p"`
2272
2331
  \| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \|
2273
2332
  `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `durationSeconds?`:
2274
- `number`; `generateAudio?`: `boolean`; `references?`: `object`[]; \}; \}; \};
2275
- \}\> \| `Readonly`\<\{ `kind`: `"refused"`; `result`: `JSONType`; \}\>
2333
+ `number`; `generateAudio?`: `boolean`; `references?`: `object`[];
2334
+ `audioReferences?`: `object`[]; \}; \} \| \{ `kind`: `"audio"`; `requestId`:
2335
+ `string`; `libraryPath`: `string`; `settings`: \{ `model`: \|
2336
+ `"elevenlabs/eleven-multilingual-v2"` \| `"elevenlabs/eleven-v3"` \|
2337
+ `"elevenlabs/music-v2"`; `prompt`: `string`; `voiceId?`: `string`;
2338
+ `durationSeconds?`: `number`; \}; \}; \}; \}\> \| `Readonly`\<\{ `kind`:
2339
+ `"refused"`; `result`: `JSONType`; \}\>
2276
2340
 
2277
2341
  ---
2278
2342
 
@@ -2286,10 +2350,10 @@ Choose the same fixed filename on both hosts without a recursive App lookup.
2286
2350
 
2287
2351
  #### Parameters
2288
2352
 
2289
- | Parameter | Type |
2290
- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2291
- | `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.5"` \| `"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`[]; \}; \} |
2292
- | `computerId` | `string` |
2353
+ | Parameter | Type |
2354
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2355
+ | `input` | \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `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`[]; `width`: `number`; `height`: `number`; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \| `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.5"` \| `"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`[]; `audioReferences?`: `object`[]; \}; \} \| \{ `kind`: `"audio"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: \| `"elevenlabs/eleven-multilingual-v2"` \| `"elevenlabs/eleven-v3"` \| `"elevenlabs/music-v2"`; `prompt`: `string`; `voiceId?`: `string`; `durationSeconds?`: `number`; \}; \} |
2356
+ | `computerId` | `string` |
2293
2357
 
2294
2358
  #### Returns
2295
2359
 
@@ -2307,11 +2371,11 @@ Decode bounded service replies once for both MEDIA host bindings.
2307
2371
 
2308
2372
  #### Parameters
2309
2373
 
2310
- | Parameter | Type |
2311
- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2312
- | `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.5"` \| `"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`[]; \}; \}; \} |
2313
- | `computerId` | `string` |
2314
- | `response` | `Response` |
2374
+ | Parameter | Type |
2375
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2376
+ | `input` | \| \{ `operation`: `"models"`; `input`: `Record`\<`string`, `never`\>; \} \| \{ `operation`: `"generate"`; `input`: \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `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`[]; `width`: `number`; `height`: `number`; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \| `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.5"` \| `"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`[]; `audioReferences?`: `object`[]; \}; \} \| \{ `kind`: `"audio"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: \| `"elevenlabs/eleven-multilingual-v2"` \| `"elevenlabs/eleven-v3"` \| `"elevenlabs/music-v2"`; `prompt`: `string`; `voiceId?`: `string`; `durationSeconds?`: `number`; \}; \}; \} |
2377
+ | `computerId` | `string` |
2378
+ | `response` | `Response` |
2315
2379
 
2316
2380
  #### Returns
2317
2381
 
@@ -2328,7 +2392,7 @@ function quoteMediaGeneration(
2328
2392
  ): Promise<
2329
2393
  Readonly<
2330
2394
  Readonly<{
2331
- unit: "image" | "video_second";
2395
+ unit: "image" | "video_second" | "audio_second" | "audio_character_block";
2332
2396
  units: number;
2333
2397
  }> &
2334
2398
  object
@@ -2343,25 +2407,28 @@ way its metering does, so the number matches the charge.
2343
2407
 
2344
2408
  #### Parameters
2345
2409
 
2346
- | Parameter | Type | Description |
2347
- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
2348
- | `raw` | \{ `model`: `string`; `prompt`: `string`; `width`: `number`; `height`: `number`; `steps?`: `number`; `durationSeconds?`: `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`[]; \} | - |
2349
- | `raw.model` | `string` | Provider catalog model identifier. |
2350
- | `raw.prompt` | `string` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
2351
- | `raw.width` | `number` | Requested image width or nominal video selector, not decoded MP4 dimensions. |
2352
- | `raw.height` | `number` | Requested image height or nominal video selector, not decoded MP4 dimensions. |
2353
- | `raw.steps?` | `number` | Model-specific inference step count. |
2354
- | `raw.durationSeconds?` | `number` | Requested video length in whole seconds. |
2355
- | `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | Video resolution; must match the nominal width/height selector. |
2356
- | `raw.aspectRatio?` | `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"` | Video aspect; must match the nominal width/height selector. |
2357
- | `raw.generateAudio?` | `boolean` | Video audio selection. |
2358
- | `raw.references?` | `object`[] | Host-authorized reference images. |
2359
- | `references` | [`MediaReferenceReader`](index.md#mediareferencereader) | - |
2410
+ | Parameter | Type | Description |
2411
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
2412
+ | `raw` | \{ `model`: `string`; `prompt`: `string`; `width?`: `number`; `height?`: `number`; `steps?`: `number`; `durationSeconds?`: `number`; `voiceId?`: `string`; `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`[]; `audioReferences?`: `object`[]; \} | - |
2413
+ | `raw.model` | `string` | Provider catalog model identifier. |
2414
+ | `raw.prompt` | `string` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
2415
+ | `raw.width?` | `number` | Requested image width or nominal video selector; absent for audio. |
2416
+ | `raw.height?` | `number` | Requested image height or nominal video selector; absent for audio. |
2417
+ | `raw.steps?` | `number` | Model-specific inference step count. |
2418
+ | `raw.durationSeconds?` | `number` | Requested video or music length in whole seconds. |
2419
+ | `raw.voiceId?` | `string` | Speech models only: a premade voice from the catalog; the default when omitted. |
2420
+ | `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | Video resolution; must match the nominal width/height selector. |
2421
+ | `raw.aspectRatio?` | `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"` | Video aspect; must match the nominal width/height selector. |
2422
+ | `raw.generateAudio?` | `boolean` | Video audio selection. |
2423
+ | `raw.references?` | `object`[] | Host-authorized reference images. |
2424
+ | `raw.audioReferences?` | `object`[] | Host-authorized reference audio clips; only a model declaring `audioReferences` takes them. |
2425
+ | `references` | [`MediaReferenceReader`](index.md#mediareferencereader) | - |
2360
2426
 
2361
2427
  #### Returns
2362
2428
 
2363
- `Promise`\<`Readonly`\<`Readonly`\<\{ `unit`: `"image"` \| `"video_second"`;
2364
- `units`: `number`; \}\> & `object`\>\>
2429
+ `Promise`\<`Readonly`\<`Readonly`\<\{ `unit`: `"image"` \| `"video_second"` \|
2430
+ `"audio_second"` \| `"audio_character_block"`; `units`: `number`; \}\> &
2431
+ `object`\>\>
2365
2432
 
2366
2433
  ---
2367
2434
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/darkroom",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Media generation, durable output retention and provenance with host-owned authority and billing",
6
6
  "type": "module",
@@ -55,11 +55,12 @@
55
55
  "png-chunks-extract": "1.0.0",
56
56
  "png-chunks-encode": "1.0.0",
57
57
  "node-webpmux": "3.2.1",
58
+ "music-metadata": "12.3.3",
58
59
  "xmlbuilder2": "4.0.3",
59
60
  "exifreader": "4.46.0",
60
61
  "@fungi.computer/ts-webp": "0.1.6",
61
62
  "@xmldom/xmldom": "0.9.12",
62
- "@fungi.computer/agar": "0.13.0",
63
+ "@fungi.computer/agar": "0.14.0",
63
64
  "@fungi.computer/capnweb": "0.12.0-fungi.0"
64
65
  },
65
66
  "devDependencies": {