@fungi.computer/darkroom 0.9.2 → 0.10.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 +79 -3
- package/dist/app-media-contracts.d.ts +85 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +1 -0
- package/dist/cloudflare/provider.d.ts +4 -4
- package/dist/cloudflare/provider.js +20 -9
- package/dist/cloudflare/r2-destination.d.ts +48 -0
- package/dist/cloudflare/r2-destination.js +46 -0
- package/dist/cloudflare.d.ts +1 -0
- package/dist/cloudflare.js +1 -0
- package/dist/gateway-models.d.ts +44 -9
- package/dist/gateway-models.js +52 -20
- package/dist/index.d.ts +6 -2
- package/dist/index.js +64 -38
- package/dist/media-binding.d.ts +3 -0
- package/dist/media-content-type.d.ts +5 -0
- package/dist/media-content-type.js +49 -0
- package/dist/media-operation-owner.js +1 -2
- package/dist/media-path.d.ts +3 -0
- package/dist/media-path.js +7 -0
- package/dist/media-run-lifetime.d.ts +5 -0
- package/dist/media-run-lifetime.js +5 -0
- package/dist/model-catalog.d.ts +201 -0
- package/dist/model-catalog.js +220 -9
- package/dist/reference-read.d.ts +24 -0
- package/dist/reference-read.js +26 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +5 -5
- package/docs/api/app-media-contracts.md +43 -0
- package/docs/api/browser.md +15 -4
- package/docs/api/cloudflare.md +109 -0
- package/docs/api/index.md +292 -56
- package/docs/api/server.md +123 -52
- package/package.json +2 -2
package/docs/api/server.md
CHANGED
|
@@ -953,15 +953,12 @@ Why the host's billing owner refused to admit a new generation.
|
|
|
953
953
|
|
|
954
954
|
```ts
|
|
955
955
|
type MediaUnits = Readonly<{
|
|
956
|
-
unit:
|
|
956
|
+
unit: MediaBillingUnit;
|
|
957
957
|
units: number;
|
|
958
958
|
}>;
|
|
959
959
|
```
|
|
960
960
|
|
|
961
|
-
What one generation bills
|
|
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).
|
|
961
|
+
What one generation bills, in the unit its catalog entry names.
|
|
965
962
|
|
|
966
963
|
---
|
|
967
964
|
|
|
@@ -1584,6 +1581,19 @@ The provider cost of one exact generation request, before any billing policy.
|
|
|
1584
1581
|
|
|
1585
1582
|
---
|
|
1586
1583
|
|
|
1584
|
+
### HostReferenceSource
|
|
1585
|
+
|
|
1586
|
+
```ts
|
|
1587
|
+
type HostReferenceSource = Readonly<{
|
|
1588
|
+
size: number;
|
|
1589
|
+
bytes: () => Promise<Uint8Array>;
|
|
1590
|
+
}>;
|
|
1591
|
+
```
|
|
1592
|
+
|
|
1593
|
+
One stored reference: its size is known before its bytes are loaded.
|
|
1594
|
+
|
|
1595
|
+
---
|
|
1596
|
+
|
|
1587
1597
|
### MediaScope
|
|
1588
1598
|
|
|
1589
1599
|
```ts
|
|
@@ -1709,6 +1719,7 @@ const mediaImageBindingInputSchema: ZodObject<{
|
|
|
1709
1719
|
settings: ZodObject<{
|
|
1710
1720
|
model: ZodString;
|
|
1711
1721
|
prompt: ZodString;
|
|
1722
|
+
targetMegapixels: ZodOptional<ZodNumber>;
|
|
1712
1723
|
resolution: ZodOptional<ZodEnum<{
|
|
1713
1724
|
p480: "480p";
|
|
1714
1725
|
p720: "720p";
|
|
@@ -1812,6 +1823,7 @@ const mediaBindingGenerationSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
1812
1823
|
settings: ZodObject<{
|
|
1813
1824
|
model: ZodString;
|
|
1814
1825
|
prompt: ZodString;
|
|
1826
|
+
targetMegapixels: ZodOptional<ZodNumber>;
|
|
1815
1827
|
resolution: ZodOptional<ZodEnum<{
|
|
1816
1828
|
p480: "480p";
|
|
1817
1829
|
p720: "720p";
|
|
@@ -1916,6 +1928,7 @@ const mediaBindingCallSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
1916
1928
|
settings: ZodObject<{
|
|
1917
1929
|
model: ZodString;
|
|
1918
1930
|
prompt: ZodString;
|
|
1931
|
+
targetMegapixels: ZodOptional<...>;
|
|
1919
1932
|
resolution: ZodOptional<...>;
|
|
1920
1933
|
aspectRatio: ZodOptional<...>;
|
|
1921
1934
|
generateAudio: ZodOptional<...>;
|
|
@@ -2117,6 +2130,7 @@ const mediaRequestSchema: ZodObject<{
|
|
|
2117
2130
|
height: ZodOptional<ZodNumber>;
|
|
2118
2131
|
steps: ZodOptional<ZodNumber>;
|
|
2119
2132
|
durationSeconds: ZodOptional<ZodNumber>;
|
|
2133
|
+
targetMegapixels: ZodOptional<ZodNumber>;
|
|
2120
2134
|
voiceId: ZodOptional<ZodString>;
|
|
2121
2135
|
resolution: ZodOptional<ZodEnum<{
|
|
2122
2136
|
p480: "480p";
|
|
@@ -2177,12 +2191,24 @@ Quote the catalog defaults through the exact estimator used before dispatch.
|
|
|
2177
2191
|
|
|
2178
2192
|
#### Returns
|
|
2179
2193
|
|
|
2180
|
-
| Name
|
|
2181
|
-
|
|
|
2182
|
-
| `kind`
|
|
2183
|
-
| `basis`
|
|
2184
|
-
| `settings`
|
|
2185
|
-
| `
|
|
2194
|
+
| Name | Type | Description |
|
|
2195
|
+
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
2196
|
+
| `kind` | `"estimate"` | An indicative quote, not an admitted generation receipt. |
|
|
2197
|
+
| `basis` | `"provider-cost"` | Provider cost before the host's billing policy. |
|
|
2198
|
+
| `settings` | `object` | Catalog defaults and a one-character prompt; never references. |
|
|
2199
|
+
| `settings.model` | `string` | Catalog model identifier. |
|
|
2200
|
+
| `settings.prompt` | `string` | Trimmed generation prompt. |
|
|
2201
|
+
| `settings.width?` | `number` | Requested image width or nominal video resolution/aspect selector; absent for audio. |
|
|
2202
|
+
| `settings.height?` | `number` | Requested image height or nominal video resolution/aspect selector; absent for audio. |
|
|
2203
|
+
| `settings.steps?` | `number` | Model-specific inference steps. |
|
|
2204
|
+
| `settings.durationSeconds?` | `number` | Video and music models only: output length in whole seconds. |
|
|
2205
|
+
| `settings.targetMegapixels?` | `number` | Upscale only: the output size in megapixels. |
|
|
2206
|
+
| `settings.voiceId?` | `string` | Speech models only: the catalog voice that reads the prompt. |
|
|
2207
|
+
| `settings.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | Video resolution selector, normalized from the catalog. |
|
|
2208
|
+
| `settings.aspectRatio?` | `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"` | Requested video aspect; a first image may override it upstream. |
|
|
2209
|
+
| `settings.generateAudio?` | `boolean` | Audio selection; omitted for Seedance when its default is undocumented. |
|
|
2210
|
+
| `settings.audioReferences?` | readonly `Readonly`\<\{ `computerId`: `string`; `path`: `string`; `role?`: `"first-frame"` \| `"last-frame"` \| `"reference"`; \}\>[] | Host-authorized reference audio clips; video models declaring `audioReferences` only. |
|
|
2211
|
+
| `costMilliunits` | `number` | Estimated provider milliunits of a cent for these exact settings. |
|
|
2186
2212
|
|
|
2187
2213
|
---
|
|
2188
2214
|
|
|
@@ -2249,6 +2275,7 @@ function parseMediaBindingCall(raw):
|
|
|
2249
2275
|
settings: {
|
|
2250
2276
|
model: string;
|
|
2251
2277
|
prompt: string;
|
|
2278
|
+
targetMegapixels?: number;
|
|
2252
2279
|
resolution?: "480p" | "720p" | "768p" | "1080p" | "4k";
|
|
2253
2280
|
aspectRatio?:
|
|
2254
2281
|
"16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21";
|
|
@@ -2318,22 +2345,22 @@ Parsing and model refusal stay shared; authorization remains host-owned.
|
|
|
2318
2345
|
\| `Readonly`\<\{ `kind`: `"parsed"`; `call`: \| \{ `operation`: `"models"`;
|
|
2319
2346
|
`input`: `Record`\<`string`, `never`\>; \} \| \{ `operation`: `"generate"`;
|
|
2320
2347
|
`input`: \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`:
|
|
2321
|
-
`string`; `settings`: \{ `model`: `string`; `prompt`: `string`;
|
|
2322
|
-
`
|
|
2323
|
-
|
|
2324
|
-
`
|
|
2325
|
-
`
|
|
2326
|
-
\| `"webp"`; \} \| \{ `kind`:
|
|
2327
|
-
`
|
|
2328
|
-
`"bytedance/seedance-2.
|
|
2329
|
-
`"bytedance/seedance-2.0-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
`"
|
|
2333
|
-
`
|
|
2334
|
-
`audioReferences?`: `object`[]; \}; \} \| \{ `kind`:
|
|
2335
|
-
`string`; `libraryPath`: `string`; `settings`: \{
|
|
2336
|
-
`"elevenlabs/eleven-multilingual-v2"` \| `"elevenlabs/eleven-v3"` \|
|
|
2348
|
+
`string`; `settings`: \{ `model`: `string`; `prompt`: `string`;
|
|
2349
|
+
`targetMegapixels?`: `number`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"`
|
|
2350
|
+
\| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \|
|
|
2351
|
+
`"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `generateAudio?`: `boolean`;
|
|
2352
|
+
`references?`: `object`[]; `width`: `number`; `height`: `number`; `steps?`:
|
|
2353
|
+
`number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \| `"webp"`; \} \| \{ `kind`:
|
|
2354
|
+
`"video"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{
|
|
2355
|
+
`model`: \| `"bytedance/seedance-2.5"` \| `"bytedance/seedance-2.0"` \|
|
|
2356
|
+
`"bytedance/seedance-2.0-fast"` \| `"bytedance/seedance-2.0-mini"` \|
|
|
2357
|
+
`"google/veo-3.1"` \| `"google/veo-3.1-fast"` \| `"minimax/h3-max"`; `prompt`:
|
|
2358
|
+
`string`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \|
|
|
2359
|
+
`"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \|
|
|
2360
|
+
`"21:9"` \| `"9:21"`; `durationSeconds?`: `number`; `generateAudio?`: `boolean`;
|
|
2361
|
+
`references?`: `object`[]; `audioReferences?`: `object`[]; \}; \} \| \{ `kind`:
|
|
2362
|
+
`"audio"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{
|
|
2363
|
+
`model`: \| `"elevenlabs/eleven-multilingual-v2"` \| `"elevenlabs/eleven-v3"` \|
|
|
2337
2364
|
`"elevenlabs/music-v2"`; `prompt`: `string`; `voiceId?`: `string`;
|
|
2338
2365
|
`durationSeconds?`: `number`; \}; \}; \}; \}\> \| `Readonly`\<\{ `kind`:
|
|
2339
2366
|
`"refused"`; `result`: `JSONType`; \}\>
|
|
@@ -2350,10 +2377,10 @@ Choose the same fixed filename on both hosts without a recursive App lookup.
|
|
|
2350
2377
|
|
|
2351
2378
|
#### Parameters
|
|
2352
2379
|
|
|
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`
|
|
2380
|
+
| Parameter | Type |
|
|
2381
|
+
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
2382
|
+
| `input` | \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `targetMegapixels?`: `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`[]; `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`; \}; \} |
|
|
2383
|
+
| `computerId` | `string` |
|
|
2357
2384
|
|
|
2358
2385
|
#### Returns
|
|
2359
2386
|
|
|
@@ -2371,11 +2398,11 @@ Decode bounded service replies once for both MEDIA host bindings.
|
|
|
2371
2398
|
|
|
2372
2399
|
#### Parameters
|
|
2373
2400
|
|
|
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`
|
|
2401
|
+
| Parameter | Type |
|
|
2402
|
+
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
2403
|
+
| `input` | \| \{ `operation`: `"models"`; `input`: `Record`\<`string`, `never`\>; \} \| \{ `operation`: `"generate"`; `input`: \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `targetMegapixels?`: `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`[]; `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`; \}; \}; \} |
|
|
2404
|
+
| `computerId` | `string` |
|
|
2405
|
+
| `response` | `Response` |
|
|
2379
2406
|
|
|
2380
2407
|
#### Returns
|
|
2381
2408
|
|
|
@@ -2407,22 +2434,23 @@ way its metering does, so the number matches the charge.
|
|
|
2407
2434
|
|
|
2408
2435
|
#### Parameters
|
|
2409
2436
|
|
|
2410
|
-
| Parameter
|
|
2411
|
-
|
|
|
2412
|
-
| `raw`
|
|
2413
|
-
| `raw.model`
|
|
2414
|
-
| `raw.prompt`
|
|
2415
|
-
| `raw.width?`
|
|
2416
|
-
| `raw.height?`
|
|
2417
|
-
| `raw.steps?`
|
|
2418
|
-
| `raw.durationSeconds?`
|
|
2419
|
-
| `raw.
|
|
2420
|
-
| `raw.
|
|
2421
|
-
| `raw.
|
|
2422
|
-
| `raw.
|
|
2423
|
-
| `raw.
|
|
2424
|
-
| `raw.
|
|
2425
|
-
| `
|
|
2437
|
+
| Parameter | Type | Description |
|
|
2438
|
+
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
2439
|
+
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width?`: `number`; `height?`: `number`; `steps?`: `number`; `durationSeconds?`: `number`; `targetMegapixels?`: `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`[]; \} | - |
|
|
2440
|
+
| `raw.model` | `string` | Provider catalog model identifier. |
|
|
2441
|
+
| `raw.prompt` | `string` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2442
|
+
| `raw.width?` | `number` | Requested image width or nominal video selector; absent for audio. |
|
|
2443
|
+
| `raw.height?` | `number` | Requested image height or nominal video selector; absent for audio. |
|
|
2444
|
+
| `raw.steps?` | `number` | Model-specific inference step count. |
|
|
2445
|
+
| `raw.durationSeconds?` | `number` | Requested video or music length in whole seconds. |
|
|
2446
|
+
| `raw.targetMegapixels?` | `number` | Upscale only: the output size in megapixels, one of the model's offered sizes. |
|
|
2447
|
+
| `raw.voiceId?` | `string` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
2448
|
+
| `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | Video resolution; must match the nominal width/height selector. |
|
|
2449
|
+
| `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. |
|
|
2450
|
+
| `raw.generateAudio?` | `boolean` | Video audio selection. |
|
|
2451
|
+
| `raw.references?` | `object`[] | Host-authorized reference images. |
|
|
2452
|
+
| `raw.audioReferences?` | `object`[] | Host-authorized reference audio clips; only a model declaring `audioReferences` takes them. |
|
|
2453
|
+
| `references` | [`MediaReferenceReader`](index.md#mediareferencereader) | - |
|
|
2426
2454
|
|
|
2427
2455
|
#### Returns
|
|
2428
2456
|
|
|
@@ -2432,6 +2460,49 @@ way its metering does, so the number matches the charge.
|
|
|
2432
2460
|
|
|
2433
2461
|
---
|
|
2434
2462
|
|
|
2463
|
+
### readHostReference()
|
|
2464
|
+
|
|
2465
|
+
```ts
|
|
2466
|
+
function readHostReference(input): Promise<Uint8Array<ArrayBufferLike>>;
|
|
2467
|
+
```
|
|
2468
|
+
|
|
2469
|
+
The one owner of a host reference read's refusals. The reference must name the
|
|
2470
|
+
host's admitted destination, exist, be non-empty and fit the byte limit for its
|
|
2471
|
+
kind; anything else is a [MediaSettingsError](index.md#mediasettingserror)
|
|
2472
|
+
raised before any provider dispatch.
|
|
2473
|
+
|
|
2474
|
+
#### Parameters
|
|
2475
|
+
|
|
2476
|
+
| Parameter | Type |
|
|
2477
|
+
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2478
|
+
| `input` | `Readonly`\<\{ `reference`: [`MediaReference`](index.md#mediareference); `destinationId`: `string`; `kind`: `"image"` \| `"audio"`; `open`: (`path`) => `Promise`\<[`HostReferenceSource`](#hostreferencesource) \| `null`\>; \}\> |
|
|
2479
|
+
|
|
2480
|
+
#### Returns
|
|
2481
|
+
|
|
2482
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
2483
|
+
|
|
2484
|
+
---
|
|
2485
|
+
|
|
2486
|
+
### referenceFilename()
|
|
2487
|
+
|
|
2488
|
+
```ts
|
|
2489
|
+
function referenceFilename(reference): string;
|
|
2490
|
+
```
|
|
2491
|
+
|
|
2492
|
+
The filename sent with a multipart reference: the last path segment.
|
|
2493
|
+
|
|
2494
|
+
#### Parameters
|
|
2495
|
+
|
|
2496
|
+
| Parameter | Type |
|
|
2497
|
+
| ----------- | ------------------------------------------- |
|
|
2498
|
+
| `reference` | [`MediaReference`](index.md#mediareference) |
|
|
2499
|
+
|
|
2500
|
+
#### Returns
|
|
2501
|
+
|
|
2502
|
+
`string`
|
|
2503
|
+
|
|
2504
|
+
---
|
|
2505
|
+
|
|
2435
2506
|
### generateMedia()
|
|
2436
2507
|
|
|
2437
2508
|
```ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/darkroom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"exifreader": "4.46.0",
|
|
61
61
|
"@fungi.computer/ts-webp": "0.1.6",
|
|
62
62
|
"@xmldom/xmldom": "0.9.12",
|
|
63
|
-
"@fungi.computer/agar": "0.
|
|
63
|
+
"@fungi.computer/agar": "0.17.0",
|
|
64
64
|
"@fungi.computer/capnweb": "0.12.0-fungi.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|