@fungi.computer/darkroom 0.9.2 → 0.11.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 +130 -6
- package/dist/app-media-contracts.d.ts +104 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +1 -0
- package/dist/cloudflare/provider.d.ts +5 -4
- package/dist/cloudflare/provider.js +20 -9
- package/dist/cloudflare/r2-destination.d.ts +50 -0
- package/dist/cloudflare/r2-destination.js +59 -0
- package/dist/cloudflare.d.ts +3 -2
- 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 +12 -2
- package/dist/index.js +81 -38
- package/dist/media-binding.d.ts +6 -0
- package/dist/media-content-type.d.ts +5 -0
- package/dist/media-content-type.js +49 -0
- package/dist/media-generation.js +2 -0
- package/dist/media-operation-contract.d.ts +13 -1
- package/dist/media-operation-do.d.ts +6 -0
- package/dist/media-operation-do.js +37 -2
- package/dist/media-operation-owner.d.ts +93 -5
- package/dist/media-operation-owner.js +250 -46
- package/dist/media-operation-storage.d.ts +18 -4
- package/dist/media-operation.js +30 -4
- 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/media-written.d.ts +22 -0
- package/dist/media-written.js +20 -0
- package/dist/model-catalog.d.ts +226 -0
- package/dist/model-catalog.js +254 -9
- package/dist/provenance.d.ts +5 -1
- package/dist/provenance.js +2 -1
- package/dist/reference-read.d.ts +24 -0
- package/dist/reference-read.js +26 -0
- package/dist/server.d.ts +58 -2
- package/dist/server.js +49 -5
- package/docs/api/app-media-contracts.md +49 -0
- package/docs/api/browser.md +15 -4
- package/docs/api/cloudflare.md +254 -5
- package/docs/api/index.md +346 -62
- package/docs/api/server.md +524 -66
- package/package.json +2 -2
package/docs/api/server.md
CHANGED
|
@@ -334,23 +334,31 @@ Check host namespace, request identity and inactivity before erasure.
|
|
|
334
334
|
##### erase()
|
|
335
335
|
|
|
336
336
|
```ts
|
|
337
|
-
erase(
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
erase(
|
|
338
|
+
namespace,
|
|
339
|
+
requestId,
|
|
340
|
+
policy?
|
|
341
|
+
): Promise<MediaErasure>;
|
|
340
342
|
```
|
|
341
343
|
|
|
342
|
-
Erase
|
|
344
|
+
Erase the operation and everything it retained or could still write, even
|
|
345
|
+
mid-generation. Erasure is marked first, so an attempt still running, or a lease
|
|
346
|
+
recovered later, can neither transition nor leave output behind: a write that
|
|
347
|
+
lands after the mark is deleted. The marker is never removed, so a crash cannot
|
|
348
|
+
resurrect the operation. Safe to repeat until `clear`; a repeat after a partial
|
|
349
|
+
failure resumes the cleanup.
|
|
343
350
|
|
|
344
351
|
###### Parameters
|
|
345
352
|
|
|
346
|
-
| Parameter | Type
|
|
347
|
-
| ----------- |
|
|
348
|
-
| `namespace` | `string` |
|
|
349
|
-
| `requestId` | `string` |
|
|
353
|
+
| Parameter | Type | Default value |
|
|
354
|
+
| ----------- | --------------------------------------- | ---------------- |
|
|
355
|
+
| `namespace` | `string` | `undefined` |
|
|
356
|
+
| `requestId` | `string` | `undefined` |
|
|
357
|
+
| `policy` | [`MediaErasePolicy`](#mediaerasepolicy) | `"abort-active"` |
|
|
350
358
|
|
|
351
359
|
###### Returns
|
|
352
360
|
|
|
353
|
-
`Promise
|
|
361
|
+
`Promise`\<[`MediaErasure`](#mediaerasure)\>
|
|
354
362
|
|
|
355
363
|
##### readErasure()
|
|
356
364
|
|
|
@@ -366,6 +374,76 @@ Read back empty SQL, alarm and retained output with the durable erasure marker.
|
|
|
366
374
|
|
|
367
375
|
`Promise`\<`Readonly`\<\{ `clear`: `boolean`; \}\>\>
|
|
368
376
|
|
|
377
|
+
##### retained()
|
|
378
|
+
|
|
379
|
+
```ts
|
|
380
|
+
retained(namespace, requestId): Promise<
|
|
381
|
+
| Readonly<{
|
|
382
|
+
requestId: string;
|
|
383
|
+
state: | "admitted"
|
|
384
|
+
| "estimating"
|
|
385
|
+
| "generating"
|
|
386
|
+
| "writing"
|
|
387
|
+
| "charging"
|
|
388
|
+
| "written"
|
|
389
|
+
| "succeeded"
|
|
390
|
+
| "interrupted";
|
|
391
|
+
destinationPath: string;
|
|
392
|
+
output: | Readonly<{
|
|
393
|
+
bytes: number;
|
|
394
|
+
format: string;
|
|
395
|
+
contentType: string;
|
|
396
|
+
}>
|
|
397
|
+
| null;
|
|
398
|
+
}>
|
|
399
|
+
| null>;
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
List what this operation retains: its destination path and exact provider
|
|
403
|
+
output. Null once erased.
|
|
404
|
+
|
|
405
|
+
###### Parameters
|
|
406
|
+
|
|
407
|
+
| Parameter | Type |
|
|
408
|
+
| ----------- | -------- |
|
|
409
|
+
| `namespace` | `string` |
|
|
410
|
+
| `requestId` | `string` |
|
|
411
|
+
|
|
412
|
+
###### Returns
|
|
413
|
+
|
|
414
|
+
`Promise`\< \| `Readonly`\<\{ `requestId`: `string`; `state`: \| `"admitted"` \|
|
|
415
|
+
`"estimating"` \| `"generating"` \| `"writing"` \| `"charging"` \| `"written"`
|
|
416
|
+
\| `"succeeded"` \| `"interrupted"`; `destinationPath`: `string`; `output`: \|
|
|
417
|
+
`Readonly`\<\{ `bytes`: `number`; `format`: `string`; `contentType`: `string`;
|
|
418
|
+
\}\> \| `null`; \}\> \| `null`\>
|
|
419
|
+
|
|
420
|
+
##### readRetained()
|
|
421
|
+
|
|
422
|
+
```ts
|
|
423
|
+
readRetained(namespace, requestId): Promise<
|
|
424
|
+
| Readonly<{
|
|
425
|
+
bytes: Uint8Array;
|
|
426
|
+
format: string;
|
|
427
|
+
}>
|
|
428
|
+
| null>;
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
Read back the exact retained provider bytes, before any provenance, so a host
|
|
432
|
+
can re-save a result whose destination write was lost. Null when erased or
|
|
433
|
+
nothing was retained.
|
|
434
|
+
|
|
435
|
+
###### Parameters
|
|
436
|
+
|
|
437
|
+
| Parameter | Type |
|
|
438
|
+
| ----------- | -------- |
|
|
439
|
+
| `namespace` | `string` |
|
|
440
|
+
| `requestId` | `string` |
|
|
441
|
+
|
|
442
|
+
###### Returns
|
|
443
|
+
|
|
444
|
+
`Promise`\< \| `Readonly`\<\{ `bytes`: `Uint8Array`; `format`: `string`; \}\> \|
|
|
445
|
+
`null`\>
|
|
446
|
+
|
|
369
447
|
##### admit()
|
|
370
448
|
|
|
371
449
|
```ts
|
|
@@ -646,6 +724,28 @@ A fixed-path exact-byte save is safe to retry without repeating generation.
|
|
|
646
724
|
|
|
647
725
|
[`MediaOperationProjection`](#mediaoperationprojection)
|
|
648
726
|
|
|
727
|
+
##### recordWriteIntent()
|
|
728
|
+
|
|
729
|
+
```ts
|
|
730
|
+
recordWriteIntent(leaseId, sha256): MediaOperationProjection;
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
Record the digest of the exact bytes about to be written to the destination,
|
|
734
|
+
before writing them. An erasure then knows which file this operation owns, even
|
|
735
|
+
if the process dies between the write and its record, and refuses the write once
|
|
736
|
+
erased.
|
|
737
|
+
|
|
738
|
+
###### Parameters
|
|
739
|
+
|
|
740
|
+
| Parameter | Type |
|
|
741
|
+
| --------- | -------- |
|
|
742
|
+
| `leaseId` | `string` |
|
|
743
|
+
| `sha256` | `string` |
|
|
744
|
+
|
|
745
|
+
###### Returns
|
|
746
|
+
|
|
747
|
+
[`MediaOperationProjection`](#mediaoperationprojection)
|
|
748
|
+
|
|
649
749
|
##### recordWritten()
|
|
650
750
|
|
|
651
751
|
```ts
|
|
@@ -953,15 +1053,12 @@ Why the host's billing owner refused to admit a new generation.
|
|
|
953
1053
|
|
|
954
1054
|
```ts
|
|
955
1055
|
type MediaUnits = Readonly<{
|
|
956
|
-
unit:
|
|
1056
|
+
unit: MediaBillingUnit;
|
|
957
1057
|
units: number;
|
|
958
1058
|
}>;
|
|
959
1059
|
```
|
|
960
1060
|
|
|
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).
|
|
1061
|
+
What one generation bills, in the unit its catalog entry names.
|
|
965
1062
|
|
|
966
1063
|
---
|
|
967
1064
|
|
|
@@ -1037,6 +1134,10 @@ type MediaOperation = {
|
|
|
1037
1134
|
| "recordWrittenWithoutSettlement"
|
|
1038
1135
|
| "releaseEstimate"
|
|
1039
1136
|
| "releaseWrite"
|
|
1137
|
+
| "recordWriteIntent"
|
|
1138
|
+
| "retained"
|
|
1139
|
+
| "readRetained"
|
|
1140
|
+
| "erase"
|
|
1040
1141
|
]: (
|
|
1041
1142
|
input: Parameters<MediaOperationOwner[Method]>,
|
|
1042
1143
|
) =>
|
|
@@ -1176,6 +1277,63 @@ Evidence that retained output, SQL and alarms were erased.
|
|
|
1176
1277
|
|
|
1177
1278
|
---
|
|
1178
1279
|
|
|
1280
|
+
### MediaErasePolicy
|
|
1281
|
+
|
|
1282
|
+
```ts
|
|
1283
|
+
type MediaErasePolicy = "abort-active" | "refuse-active";
|
|
1284
|
+
```
|
|
1285
|
+
|
|
1286
|
+
How `erase` treats an operation that is still generating or saving.
|
|
1287
|
+
|
|
1288
|
+
---
|
|
1289
|
+
|
|
1290
|
+
### MediaErasure
|
|
1291
|
+
|
|
1292
|
+
```ts
|
|
1293
|
+
type MediaErasure = MediaErasureReadback &
|
|
1294
|
+
Readonly<{
|
|
1295
|
+
destinationPath: string | null;
|
|
1296
|
+
writtenSha256: string | null;
|
|
1297
|
+
abandonedGeneration: boolean;
|
|
1298
|
+
}>;
|
|
1299
|
+
```
|
|
1300
|
+
|
|
1301
|
+
Result of erasing one operation: readback plus what the host may still own.
|
|
1302
|
+
|
|
1303
|
+
---
|
|
1304
|
+
|
|
1305
|
+
### MediaRetainedBytes
|
|
1306
|
+
|
|
1307
|
+
```ts
|
|
1308
|
+
type MediaRetainedBytes = Readonly<{
|
|
1309
|
+
bytes: Uint8Array;
|
|
1310
|
+
format: string;
|
|
1311
|
+
}>;
|
|
1312
|
+
```
|
|
1313
|
+
|
|
1314
|
+
Exact provider bytes an operation retained, before any provenance.
|
|
1315
|
+
|
|
1316
|
+
---
|
|
1317
|
+
|
|
1318
|
+
### MediaRetained
|
|
1319
|
+
|
|
1320
|
+
```ts
|
|
1321
|
+
type MediaRetained = Readonly<{
|
|
1322
|
+
requestId: string;
|
|
1323
|
+
state: MediaOperationState;
|
|
1324
|
+
destinationPath: string;
|
|
1325
|
+
output: Readonly<{
|
|
1326
|
+
bytes: number;
|
|
1327
|
+
format: string;
|
|
1328
|
+
contentType: string;
|
|
1329
|
+
}> | null;
|
|
1330
|
+
}>;
|
|
1331
|
+
```
|
|
1332
|
+
|
|
1333
|
+
What one operation still retains, readable by operation id.
|
|
1334
|
+
|
|
1335
|
+
---
|
|
1336
|
+
|
|
1179
1337
|
### MediaRetentionResult
|
|
1180
1338
|
|
|
1181
1339
|
```ts
|
|
@@ -1216,6 +1374,21 @@ Retained-output storage supplied by the host.
|
|
|
1216
1374
|
|
|
1217
1375
|
---
|
|
1218
1376
|
|
|
1377
|
+
### MediaErasureMarker
|
|
1378
|
+
|
|
1379
|
+
```ts
|
|
1380
|
+
type MediaErasureMarker = Readonly<{
|
|
1381
|
+
destinationPath: string | null;
|
|
1382
|
+
writtenSha256: string | null;
|
|
1383
|
+
abandonedGeneration: boolean;
|
|
1384
|
+
}>;
|
|
1385
|
+
```
|
|
1386
|
+
|
|
1387
|
+
Facts an erased operation keeps: its destination file, and whether a billing
|
|
1388
|
+
hold may be open.
|
|
1389
|
+
|
|
1390
|
+
---
|
|
1391
|
+
|
|
1219
1392
|
### MediaOperationStorage
|
|
1220
1393
|
|
|
1221
1394
|
```ts
|
|
@@ -1296,15 +1469,42 @@ Read the durable erasure marker.
|
|
|
1296
1469
|
##### markErased()
|
|
1297
1470
|
|
|
1298
1471
|
```ts
|
|
1299
|
-
markErased(): Promise<void>;
|
|
1472
|
+
markErased(marker): Promise<void>;
|
|
1300
1473
|
```
|
|
1301
1474
|
|
|
1302
|
-
Persist the durable erasure marker.
|
|
1475
|
+
Persist the durable erasure marker with the facts the host needs after erasure.
|
|
1476
|
+
Never removed: nothing may delete it.
|
|
1477
|
+
|
|
1478
|
+
###### Parameters
|
|
1479
|
+
|
|
1480
|
+
| Parameter | Type |
|
|
1481
|
+
| --------- | ------------------------------------------- |
|
|
1482
|
+
| `marker` | [`MediaErasureMarker`](#mediaerasuremarker) |
|
|
1303
1483
|
|
|
1304
1484
|
###### Returns
|
|
1305
1485
|
|
|
1306
1486
|
`Promise`\<`void`\>
|
|
1307
1487
|
|
|
1488
|
+
##### readErasureMarker()
|
|
1489
|
+
|
|
1490
|
+
```ts
|
|
1491
|
+
readErasureMarker(): Promise<
|
|
1492
|
+
| Readonly<{
|
|
1493
|
+
destinationPath: string | null;
|
|
1494
|
+
writtenSha256: string | null;
|
|
1495
|
+
abandonedGeneration: boolean;
|
|
1496
|
+
}>
|
|
1497
|
+
| null>;
|
|
1498
|
+
```
|
|
1499
|
+
|
|
1500
|
+
Read the facts kept with the marker, or null for a marker without them.
|
|
1501
|
+
|
|
1502
|
+
###### Returns
|
|
1503
|
+
|
|
1504
|
+
`Promise`\< \| `Readonly`\<\{ `destinationPath`: `string` \| `null`;
|
|
1505
|
+
`writtenSha256`: `string` \| `null`; `abandonedGeneration`: `boolean`; \}\> \|
|
|
1506
|
+
`null`\>
|
|
1507
|
+
|
|
1308
1508
|
##### listKeys()
|
|
1309
1509
|
|
|
1310
1510
|
```ts
|
|
@@ -1329,13 +1529,19 @@ Remove any scheduled background alarm.
|
|
|
1329
1529
|
|
|
1330
1530
|
`Promise`\<`void`\>
|
|
1331
1531
|
|
|
1332
|
-
#####
|
|
1532
|
+
##### deleteKeys()
|
|
1333
1533
|
|
|
1334
1534
|
```ts
|
|
1335
|
-
|
|
1535
|
+
deleteKeys(keys): Promise<void>;
|
|
1336
1536
|
```
|
|
1337
1537
|
|
|
1338
|
-
Remove
|
|
1538
|
+
Remove the named key-value entries.
|
|
1539
|
+
|
|
1540
|
+
###### Parameters
|
|
1541
|
+
|
|
1542
|
+
| Parameter | Type |
|
|
1543
|
+
| --------- | ------------------- |
|
|
1544
|
+
| `keys` | readonly `string`[] |
|
|
1339
1545
|
|
|
1340
1546
|
###### Returns
|
|
1341
1547
|
|
|
@@ -1584,6 +1790,29 @@ The provider cost of one exact generation request, before any billing policy.
|
|
|
1584
1790
|
|
|
1585
1791
|
---
|
|
1586
1792
|
|
|
1793
|
+
### MediaRemoval
|
|
1794
|
+
|
|
1795
|
+
```ts
|
|
1796
|
+
type MediaRemoval = "removed" | "absent" | "not-ours" | "kept";
|
|
1797
|
+
```
|
|
1798
|
+
|
|
1799
|
+
What a destination did when asked to delete a file this operation wrote.
|
|
1800
|
+
|
|
1801
|
+
---
|
|
1802
|
+
|
|
1803
|
+
### HostReferenceSource
|
|
1804
|
+
|
|
1805
|
+
```ts
|
|
1806
|
+
type HostReferenceSource = Readonly<{
|
|
1807
|
+
size: number;
|
|
1808
|
+
bytes: () => Promise<Uint8Array>;
|
|
1809
|
+
}>;
|
|
1810
|
+
```
|
|
1811
|
+
|
|
1812
|
+
One stored reference: its size is known before its bytes are loaded.
|
|
1813
|
+
|
|
1814
|
+
---
|
|
1815
|
+
|
|
1587
1816
|
### MediaScope
|
|
1588
1817
|
|
|
1589
1818
|
```ts
|
|
@@ -1623,9 +1852,11 @@ type MediaServiceHost = Readonly<{
|
|
|
1623
1852
|
destination: Readonly<{
|
|
1624
1853
|
authorize: (path) => Promise<void>;
|
|
1625
1854
|
write: (path, bytes) => Promise<void>;
|
|
1855
|
+
remove: (path, written) => Promise<MediaRemoval>;
|
|
1626
1856
|
readReference?: (reference, model) => Promise<MediaReferenceBytes>;
|
|
1627
1857
|
readAudioReference?: (reference) => Promise<Uint8Array>;
|
|
1628
1858
|
}>;
|
|
1859
|
+
embedPrompt?: boolean;
|
|
1629
1860
|
onFailure?: (error) => Response | undefined;
|
|
1630
1861
|
}> &
|
|
1631
1862
|
| Readonly<{
|
|
@@ -1658,6 +1889,7 @@ type MediaGenerationRequest = Readonly<{
|
|
|
1658
1889
|
path: string;
|
|
1659
1890
|
settings: Parameters<typeof validateMediaGenerationSettings>[0];
|
|
1660
1891
|
outputFormat?: z.output<typeof mediaRequestSchema>["outputFormat"];
|
|
1892
|
+
embedPrompt?: boolean;
|
|
1661
1893
|
}>;
|
|
1662
1894
|
```
|
|
1663
1895
|
|
|
@@ -1697,6 +1929,19 @@ type MediaGenerationOutcome =
|
|
|
1697
1929
|
|
|
1698
1930
|
The typed result of one generation, shared by the Hono route and the Agent path.
|
|
1699
1931
|
|
|
1932
|
+
---
|
|
1933
|
+
|
|
1934
|
+
### MediaOperationErasure
|
|
1935
|
+
|
|
1936
|
+
```ts
|
|
1937
|
+
type MediaOperationErasure = MediaErasure &
|
|
1938
|
+
Readonly<{
|
|
1939
|
+
destinationFile: MediaRemoval | null;
|
|
1940
|
+
}>;
|
|
1941
|
+
```
|
|
1942
|
+
|
|
1943
|
+
Erasure of one generation, with what happened to its destination file.
|
|
1944
|
+
|
|
1700
1945
|
## Variables
|
|
1701
1946
|
|
|
1702
1947
|
### mediaImageBindingInputSchema
|
|
@@ -1709,6 +1954,8 @@ const mediaImageBindingInputSchema: ZodObject<{
|
|
|
1709
1954
|
settings: ZodObject<{
|
|
1710
1955
|
model: ZodString;
|
|
1711
1956
|
prompt: ZodString;
|
|
1957
|
+
guidance: ZodOptional<ZodNumber>;
|
|
1958
|
+
targetMegapixels: ZodOptional<ZodNumber>;
|
|
1712
1959
|
resolution: ZodOptional<ZodEnum<{
|
|
1713
1960
|
p480: "480p";
|
|
1714
1961
|
p720: "720p";
|
|
@@ -1812,6 +2059,8 @@ const mediaBindingGenerationSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
1812
2059
|
settings: ZodObject<{
|
|
1813
2060
|
model: ZodString;
|
|
1814
2061
|
prompt: ZodString;
|
|
2062
|
+
guidance: ZodOptional<ZodNumber>;
|
|
2063
|
+
targetMegapixels: ZodOptional<ZodNumber>;
|
|
1815
2064
|
resolution: ZodOptional<ZodEnum<{
|
|
1816
2065
|
p480: "480p";
|
|
1817
2066
|
p720: "720p";
|
|
@@ -1916,6 +2165,8 @@ const mediaBindingCallSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
1916
2165
|
settings: ZodObject<{
|
|
1917
2166
|
model: ZodString;
|
|
1918
2167
|
prompt: ZodString;
|
|
2168
|
+
guidance: ZodOptional<...>;
|
|
2169
|
+
targetMegapixels: ZodOptional<...>;
|
|
1919
2170
|
resolution: ZodOptional<...>;
|
|
1920
2171
|
aspectRatio: ZodOptional<...>;
|
|
1921
2172
|
generateAudio: ZodOptional<...>;
|
|
@@ -2116,7 +2367,9 @@ const mediaRequestSchema: ZodObject<{
|
|
|
2116
2367
|
width: ZodOptional<ZodNumber>;
|
|
2117
2368
|
height: ZodOptional<ZodNumber>;
|
|
2118
2369
|
steps: ZodOptional<ZodNumber>;
|
|
2370
|
+
guidance: ZodOptional<ZodNumber>;
|
|
2119
2371
|
durationSeconds: ZodOptional<ZodNumber>;
|
|
2372
|
+
targetMegapixels: ZodOptional<ZodNumber>;
|
|
2120
2373
|
voiceId: ZodOptional<ZodString>;
|
|
2121
2374
|
resolution: ZodOptional<ZodEnum<{
|
|
2122
2375
|
p480: "480p";
|
|
@@ -2177,12 +2430,25 @@ Quote the catalog defaults through the exact estimator used before dispatch.
|
|
|
2177
2430
|
|
|
2178
2431
|
#### Returns
|
|
2179
2432
|
|
|
2180
|
-
| Name
|
|
2181
|
-
|
|
|
2182
|
-
| `kind`
|
|
2183
|
-
| `basis`
|
|
2184
|
-
| `settings`
|
|
2185
|
-
| `
|
|
2433
|
+
| Name | Type | Description |
|
|
2434
|
+
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
2435
|
+
| `kind` | `"estimate"` | An indicative quote, not an admitted generation receipt. |
|
|
2436
|
+
| `basis` | `"provider-cost"` | Provider cost before the host's billing policy. |
|
|
2437
|
+
| `settings` | `object` | Catalog defaults and a one-character prompt; never references. |
|
|
2438
|
+
| `settings.model` | `string` | Catalog model identifier. |
|
|
2439
|
+
| `settings.prompt` | `string` | Trimmed generation prompt. |
|
|
2440
|
+
| `settings.width?` | `number` | Requested image width or nominal video resolution/aspect selector; absent for audio. |
|
|
2441
|
+
| `settings.height?` | `number` | Requested image height or nominal video resolution/aspect selector; absent for audio. |
|
|
2442
|
+
| `settings.steps?` | `number` | Model-specific inference steps. |
|
|
2443
|
+
| `settings.guidance?` | `number` | Prompt guidance for models that take it; the catalog default when omitted. |
|
|
2444
|
+
| `settings.durationSeconds?` | `number` | Video and music models only: output length in whole seconds. |
|
|
2445
|
+
| `settings.targetMegapixels?` | `number` | Upscale only: the output size in megapixels. |
|
|
2446
|
+
| `settings.voiceId?` | `string` | Speech models only: the catalog voice that reads the prompt. |
|
|
2447
|
+
| `settings.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | Video resolution selector, normalized from the catalog. |
|
|
2448
|
+
| `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. |
|
|
2449
|
+
| `settings.generateAudio?` | `boolean` | Audio selection; omitted for Seedance when its default is undocumented. |
|
|
2450
|
+
| `settings.audioReferences?` | readonly `Readonly`\<\{ `computerId`: `string`; `path`: `string`; `role?`: `"first-frame"` \| `"last-frame"` \| `"reference"`; \}\>[] | Host-authorized reference audio clips; video models declaring `audioReferences` only. |
|
|
2451
|
+
| `costMilliunits` | `number` | Estimated provider milliunits of a cent for these exact settings. |
|
|
2186
2452
|
|
|
2187
2453
|
---
|
|
2188
2454
|
|
|
@@ -2249,6 +2515,8 @@ function parseMediaBindingCall(raw):
|
|
|
2249
2515
|
settings: {
|
|
2250
2516
|
model: string;
|
|
2251
2517
|
prompt: string;
|
|
2518
|
+
guidance?: number;
|
|
2519
|
+
targetMegapixels?: number;
|
|
2252
2520
|
resolution?: "480p" | "720p" | "768p" | "1080p" | "4k";
|
|
2253
2521
|
aspectRatio?:
|
|
2254
2522
|
"16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21";
|
|
@@ -2318,22 +2586,22 @@ Parsing and model refusal stay shared; authorization remains host-owned.
|
|
|
2318
2586
|
\| `Readonly`\<\{ `kind`: `"parsed"`; `call`: \| \{ `operation`: `"models"`;
|
|
2319
2587
|
`input`: `Record`\<`string`, `never`\>; \} \| \{ `operation`: `"generate"`;
|
|
2320
2588
|
`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"` \|
|
|
2589
|
+
`string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `guidance?`:
|
|
2590
|
+
`number`; `targetMegapixels?`: `number`; `resolution?`: `"480p"` \| `"720p"` \|
|
|
2591
|
+
`"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"`
|
|
2592
|
+
\| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `generateAudio?`: `boolean`;
|
|
2593
|
+
`references?`: `object`[]; `width`: `number`; `height`: `number`; `steps?`:
|
|
2594
|
+
`number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \| `"webp"`; \} \| \{ `kind`:
|
|
2595
|
+
`"video"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{
|
|
2596
|
+
`model`: \| `"bytedance/seedance-2.5"` \| `"bytedance/seedance-2.0"` \|
|
|
2597
|
+
`"bytedance/seedance-2.0-fast"` \| `"bytedance/seedance-2.0-mini"` \|
|
|
2598
|
+
`"google/veo-3.1"` \| `"google/veo-3.1-fast"` \| `"minimax/h3-max"`; `prompt`:
|
|
2599
|
+
`string`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \|
|
|
2600
|
+
`"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \|
|
|
2601
|
+
`"21:9"` \| `"9:21"`; `durationSeconds?`: `number`; `generateAudio?`: `boolean`;
|
|
2602
|
+
`references?`: `object`[]; `audioReferences?`: `object`[]; \}; \} \| \{ `kind`:
|
|
2603
|
+
`"audio"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{
|
|
2604
|
+
`model`: \| `"elevenlabs/eleven-multilingual-v2"` \| `"elevenlabs/eleven-v3"` \|
|
|
2337
2605
|
`"elevenlabs/music-v2"`; `prompt`: `string`; `voiceId?`: `string`;
|
|
2338
2606
|
`durationSeconds?`: `number`; \}; \}; \}; \}\> \| `Readonly`\<\{ `kind`:
|
|
2339
2607
|
`"refused"`; `result`: `JSONType`; \}\>
|
|
@@ -2350,10 +2618,10 @@ Choose the same fixed filename on both hosts without a recursive App lookup.
|
|
|
2350
2618
|
|
|
2351
2619
|
#### Parameters
|
|
2352
2620
|
|
|
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`
|
|
2621
|
+
| Parameter | Type |
|
|
2622
|
+
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2623
|
+
| `input` | \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `guidance?`: `number`; `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`; \}; \} |
|
|
2624
|
+
| `computerId` | `string` |
|
|
2357
2625
|
|
|
2358
2626
|
#### Returns
|
|
2359
2627
|
|
|
@@ -2371,11 +2639,11 @@ Decode bounded service replies once for both MEDIA host bindings.
|
|
|
2371
2639
|
|
|
2372
2640
|
#### Parameters
|
|
2373
2641
|
|
|
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`
|
|
2642
|
+
| Parameter | Type |
|
|
2643
|
+
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2644
|
+
| `input` | \| \{ `operation`: `"models"`; `input`: `Record`\<`string`, `never`\>; \} \| \{ `operation`: `"generate"`; `input`: \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `guidance?`: `number`; `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`; \}; \}; \} |
|
|
2645
|
+
| `computerId` | `string` |
|
|
2646
|
+
| `response` | `Response` |
|
|
2379
2647
|
|
|
2380
2648
|
#### Returns
|
|
2381
2649
|
|
|
@@ -2407,22 +2675,24 @@ way its metering does, so the number matches the charge.
|
|
|
2407
2675
|
|
|
2408
2676
|
#### Parameters
|
|
2409
2677
|
|
|
2410
|
-
| Parameter
|
|
2411
|
-
|
|
|
2412
|
-
| `raw`
|
|
2413
|
-
| `raw.model`
|
|
2414
|
-
| `raw.prompt`
|
|
2415
|
-
| `raw.width?`
|
|
2416
|
-
| `raw.height?`
|
|
2417
|
-
| `raw.steps?`
|
|
2418
|
-
| `raw.
|
|
2419
|
-
| `raw.
|
|
2420
|
-
| `raw.
|
|
2421
|
-
| `raw.
|
|
2422
|
-
| `raw.
|
|
2423
|
-
| `raw.
|
|
2424
|
-
| `raw.
|
|
2425
|
-
| `references
|
|
2678
|
+
| Parameter | Type | Description |
|
|
2679
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
2680
|
+
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width?`: `number`; `height?`: `number`; `steps?`: `number`; `guidance?`: `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`[]; \} | - |
|
|
2681
|
+
| `raw.model` | `string` | Provider catalog model identifier. |
|
|
2682
|
+
| `raw.prompt` | `string` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2683
|
+
| `raw.width?` | `number` | Requested image width or nominal video selector; absent for audio. |
|
|
2684
|
+
| `raw.height?` | `number` | Requested image height or nominal video selector; absent for audio. |
|
|
2685
|
+
| `raw.steps?` | `number` | Model-specific inference step count. |
|
|
2686
|
+
| `raw.guidance?` | `number` | Prompt guidance; models without a catalog guidance range refuse it. |
|
|
2687
|
+
| `raw.durationSeconds?` | `number` | Requested video or music length in whole seconds. |
|
|
2688
|
+
| `raw.targetMegapixels?` | `number` | Upscale only: the output size in megapixels, one of the model's offered sizes. |
|
|
2689
|
+
| `raw.voiceId?` | `string` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
2690
|
+
| `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | Video resolution; must match the nominal width/height selector. |
|
|
2691
|
+
| `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. |
|
|
2692
|
+
| `raw.generateAudio?` | `boolean` | Video audio selection. |
|
|
2693
|
+
| `raw.references?` | `object`[] | Host-authorized reference images. |
|
|
2694
|
+
| `raw.audioReferences?` | `object`[] | Host-authorized reference audio clips; only a model declaring `audioReferences` takes them. |
|
|
2695
|
+
| `references` | [`MediaReferenceReader`](index.md#mediareferencereader) | - |
|
|
2426
2696
|
|
|
2427
2697
|
#### Returns
|
|
2428
2698
|
|
|
@@ -2432,6 +2702,91 @@ way its metering does, so the number matches the charge.
|
|
|
2432
2702
|
|
|
2433
2703
|
---
|
|
2434
2704
|
|
|
2705
|
+
### mediaWrittenDigest()
|
|
2706
|
+
|
|
2707
|
+
```ts
|
|
2708
|
+
function mediaWrittenDigest(bytes): Promise<string>;
|
|
2709
|
+
```
|
|
2710
|
+
|
|
2711
|
+
Lowercase hex SHA-256 of the exact bytes written to a destination.
|
|
2712
|
+
|
|
2713
|
+
#### Parameters
|
|
2714
|
+
|
|
2715
|
+
| Parameter | Type |
|
|
2716
|
+
| --------- | ------------ |
|
|
2717
|
+
| `bytes` | `Uint8Array` |
|
|
2718
|
+
|
|
2719
|
+
#### Returns
|
|
2720
|
+
|
|
2721
|
+
`Promise`\<`string`\>
|
|
2722
|
+
|
|
2723
|
+
---
|
|
2724
|
+
|
|
2725
|
+
### removeMediaIfWritten()
|
|
2726
|
+
|
|
2727
|
+
```ts
|
|
2728
|
+
function removeMediaIfWritten(file, sha256): Promise<MediaRemoval>;
|
|
2729
|
+
```
|
|
2730
|
+
|
|
2731
|
+
Delete the file at a destination path only while it still holds the exact bytes
|
|
2732
|
+
the operation wrote, so a path reused for something else is never lost.
|
|
2733
|
+
|
|
2734
|
+
#### Parameters
|
|
2735
|
+
|
|
2736
|
+
| Parameter | Type |
|
|
2737
|
+
| --------- | ----------------------------------------------------------------------------------------------------------- |
|
|
2738
|
+
| `file` | `Readonly`\<\{ `read`: () => `Promise`\<`Uint8Array` \| `null`\>; `delete`: () => `Promise`\<`void`\>; \}\> |
|
|
2739
|
+
| `sha256` | `string` |
|
|
2740
|
+
|
|
2741
|
+
#### Returns
|
|
2742
|
+
|
|
2743
|
+
`Promise`\<[`MediaRemoval`](#mediaremoval)\>
|
|
2744
|
+
|
|
2745
|
+
---
|
|
2746
|
+
|
|
2747
|
+
### readHostReference()
|
|
2748
|
+
|
|
2749
|
+
```ts
|
|
2750
|
+
function readHostReference(input): Promise<Uint8Array<ArrayBufferLike>>;
|
|
2751
|
+
```
|
|
2752
|
+
|
|
2753
|
+
The one owner of a host reference read's refusals. The reference must name the
|
|
2754
|
+
host's admitted destination, exist, be non-empty and fit the byte limit for its
|
|
2755
|
+
kind; anything else is a [MediaSettingsError](index.md#mediasettingserror)
|
|
2756
|
+
raised before any provider dispatch.
|
|
2757
|
+
|
|
2758
|
+
#### Parameters
|
|
2759
|
+
|
|
2760
|
+
| Parameter | Type |
|
|
2761
|
+
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2762
|
+
| `input` | `Readonly`\<\{ `reference`: [`MediaReference`](index.md#mediareference); `destinationId`: `string`; `kind`: `"image"` \| `"audio"`; `open`: (`path`) => `Promise`\<[`HostReferenceSource`](#hostreferencesource) \| `null`\>; \}\> |
|
|
2763
|
+
|
|
2764
|
+
#### Returns
|
|
2765
|
+
|
|
2766
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
2767
|
+
|
|
2768
|
+
---
|
|
2769
|
+
|
|
2770
|
+
### referenceFilename()
|
|
2771
|
+
|
|
2772
|
+
```ts
|
|
2773
|
+
function referenceFilename(reference): string;
|
|
2774
|
+
```
|
|
2775
|
+
|
|
2776
|
+
The filename sent with a multipart reference: the last path segment.
|
|
2777
|
+
|
|
2778
|
+
#### Parameters
|
|
2779
|
+
|
|
2780
|
+
| Parameter | Type |
|
|
2781
|
+
| ----------- | ------------------------------------------- |
|
|
2782
|
+
| `reference` | [`MediaReference`](index.md#mediareference) |
|
|
2783
|
+
|
|
2784
|
+
#### Returns
|
|
2785
|
+
|
|
2786
|
+
`string`
|
|
2787
|
+
|
|
2788
|
+
---
|
|
2789
|
+
|
|
2435
2790
|
### generateMedia()
|
|
2436
2791
|
|
|
2437
2792
|
```ts
|
|
@@ -2455,6 +2810,109 @@ failures.
|
|
|
2455
2810
|
|
|
2456
2811
|
---
|
|
2457
2812
|
|
|
2813
|
+
### retainedMedia()
|
|
2814
|
+
|
|
2815
|
+
```ts
|
|
2816
|
+
function retainedMedia(
|
|
2817
|
+
host,
|
|
2818
|
+
requestId,
|
|
2819
|
+
): Promise<Readonly<{
|
|
2820
|
+
requestId: string;
|
|
2821
|
+
state:
|
|
2822
|
+
| "admitted"
|
|
2823
|
+
| "estimating"
|
|
2824
|
+
| "generating"
|
|
2825
|
+
| "writing"
|
|
2826
|
+
| "charging"
|
|
2827
|
+
| "written"
|
|
2828
|
+
| "succeeded"
|
|
2829
|
+
| "interrupted";
|
|
2830
|
+
destinationPath: string;
|
|
2831
|
+
output: Readonly<{
|
|
2832
|
+
bytes: number;
|
|
2833
|
+
format: string;
|
|
2834
|
+
contentType: string;
|
|
2835
|
+
}> | null;
|
|
2836
|
+
}> | null>;
|
|
2837
|
+
```
|
|
2838
|
+
|
|
2839
|
+
What one generation still retains, by its request id: where its file goes, and
|
|
2840
|
+
the exact provider bytes held for recovery, including bytes a crash left
|
|
2841
|
+
unrecorded. Null once erased. Refuses another namespace.
|
|
2842
|
+
|
|
2843
|
+
#### Parameters
|
|
2844
|
+
|
|
2845
|
+
| Parameter | Type |
|
|
2846
|
+
| ----------- | ------------------------------------------------------------------------------ |
|
|
2847
|
+
| `host` | `Pick`\<[`MediaServiceHost`](#mediaservicehost), `"operations"` \| `"scope"`\> |
|
|
2848
|
+
| `requestId` | `string` |
|
|
2849
|
+
|
|
2850
|
+
#### Returns
|
|
2851
|
+
|
|
2852
|
+
`Promise`\< \| `Readonly`\<\{ `requestId`: `string`; `state`: \| `"admitted"` \|
|
|
2853
|
+
`"estimating"` \| `"generating"` \| `"writing"` \| `"charging"` \| `"written"`
|
|
2854
|
+
\| `"succeeded"` \| `"interrupted"`; `destinationPath`: `string`; `output`: \|
|
|
2855
|
+
`Readonly`\<\{ `bytes`: `number`; `format`: `string`; `contentType`: `string`;
|
|
2856
|
+
\}\> \| `null`; \}\> \| `null`\>
|
|
2857
|
+
|
|
2858
|
+
---
|
|
2859
|
+
|
|
2860
|
+
### readRetainedMedia()
|
|
2861
|
+
|
|
2862
|
+
```ts
|
|
2863
|
+
function readRetainedMedia(
|
|
2864
|
+
host,
|
|
2865
|
+
requestId,
|
|
2866
|
+
): Promise<Readonly<{
|
|
2867
|
+
bytes: Uint8Array;
|
|
2868
|
+
format: string;
|
|
2869
|
+
}> | null>;
|
|
2870
|
+
```
|
|
2871
|
+
|
|
2872
|
+
Read back the exact provider bytes a generation retained, before any provenance,
|
|
2873
|
+
so a host can re-save a result whose destination write was lost. Null when
|
|
2874
|
+
erased or nothing was retained. Refuses another namespace.
|
|
2875
|
+
|
|
2876
|
+
#### Parameters
|
|
2877
|
+
|
|
2878
|
+
| Parameter | Type |
|
|
2879
|
+
| ----------- | ------------------------------------------------------------------------------ |
|
|
2880
|
+
| `host` | `Pick`\<[`MediaServiceHost`](#mediaservicehost), `"operations"` \| `"scope"`\> |
|
|
2881
|
+
| `requestId` | `string` |
|
|
2882
|
+
|
|
2883
|
+
#### Returns
|
|
2884
|
+
|
|
2885
|
+
`Promise`\< \| `Readonly`\<\{ `bytes`: `Uint8Array`; `format`: `string`; \}\> \|
|
|
2886
|
+
`null`\>
|
|
2887
|
+
|
|
2888
|
+
---
|
|
2889
|
+
|
|
2890
|
+
### eraseMediaOperation()
|
|
2891
|
+
|
|
2892
|
+
```ts
|
|
2893
|
+
function eraseMediaOperation(host, requestId): Promise<MediaOperationErasure>;
|
|
2894
|
+
```
|
|
2895
|
+
|
|
2896
|
+
Erase everything a generation retained or could still write: its retained
|
|
2897
|
+
output, reference copies, storage and the destination file (only while it still
|
|
2898
|
+
holds what this operation wrote). Works mid generation: the operation refuses
|
|
2899
|
+
later writes, deletes anything that lands, and its open billing hold is settled
|
|
2900
|
+
at zero units. Call again until `clear` is true; the destination facts are kept
|
|
2901
|
+
for that retry.
|
|
2902
|
+
|
|
2903
|
+
#### Parameters
|
|
2904
|
+
|
|
2905
|
+
| Parameter | Type |
|
|
2906
|
+
| ----------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
2907
|
+
| `host` | `Pick`\<[`MediaServiceHost`](#mediaservicehost), `"operations"` \| `"scope"` \| `"destination"` \| `"metering"`\> |
|
|
2908
|
+
| `requestId` | `string` |
|
|
2909
|
+
|
|
2910
|
+
#### Returns
|
|
2911
|
+
|
|
2912
|
+
`Promise`\<[`MediaOperationErasure`](#mediaoperationerasure)\>
|
|
2913
|
+
|
|
2914
|
+
---
|
|
2915
|
+
|
|
2458
2916
|
### createMediaService()
|
|
2459
2917
|
|
|
2460
2918
|
```ts
|