@fungi.computer/darkroom 0.0.0-stage → 0.0.1

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 (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +315 -2
  3. package/dist/app-media-contracts.d.ts +499 -0
  4. package/dist/app-media-contracts.js +98 -0
  5. package/dist/browser-failure.d.ts +40 -0
  6. package/dist/browser-failure.js +39 -0
  7. package/dist/browser.d.ts +2 -0
  8. package/dist/browser.js +1 -0
  9. package/dist/cloudflare/provider.d.ts +13 -0
  10. package/dist/cloudflare/provider.js +140 -0
  11. package/dist/cloudflare/reference-images.d.ts +42 -0
  12. package/dist/cloudflare/reference-images.js +102 -0
  13. package/dist/cloudflare.d.ts +6 -0
  14. package/dist/cloudflare.js +4 -0
  15. package/dist/cost-estimate.d.ts +22 -0
  16. package/dist/cost-estimate.js +76 -0
  17. package/dist/effect.d.ts +2 -0
  18. package/dist/effect.js +2 -0
  19. package/dist/execution-error.d.ts +54 -0
  20. package/dist/execution-error.js +62 -0
  21. package/dist/failure.d.ts +2 -0
  22. package/dist/failure.js +8 -0
  23. package/dist/gateway-models.d.ts +23 -0
  24. package/dist/gateway-models.js +77 -0
  25. package/dist/gateway-wire.d.ts +16 -0
  26. package/dist/gateway-wire.js +22 -0
  27. package/dist/index.d.ts +361 -0
  28. package/dist/index.js +611 -0
  29. package/dist/media-binding.d.ts +291 -0
  30. package/dist/media-binding.js +146 -0
  31. package/dist/media-generation.d.ts +10 -0
  32. package/dist/media-generation.js +110 -0
  33. package/dist/media-operation-contract.d.ts +104 -0
  34. package/dist/media-operation-contract.js +29 -0
  35. package/dist/media-operation-do.d.ts +55 -0
  36. package/dist/media-operation-do.js +105 -0
  37. package/dist/media-operation-owner.d.ts +301 -0
  38. package/dist/media-operation-owner.js +903 -0
  39. package/dist/media-operation-storage.d.ts +81 -0
  40. package/dist/media-operation-storage.js +1 -0
  41. package/dist/media-operation.d.ts +33 -0
  42. package/dist/media-operation.js +230 -0
  43. package/dist/model-catalog.d.ts +456 -0
  44. package/dist/model-catalog.js +565 -0
  45. package/dist/neurons.d.ts +4 -0
  46. package/dist/neurons.js +4 -0
  47. package/dist/provenance-bytes.d.ts +3 -0
  48. package/dist/provenance-bytes.js +15 -0
  49. package/dist/provenance-export.d.ts +23 -0
  50. package/dist/provenance-export.js +103 -0
  51. package/dist/provenance-jpeg.d.ts +3 -0
  52. package/dist/provenance-jpeg.js +76 -0
  53. package/dist/provenance-png.d.ts +1 -0
  54. package/dist/provenance-png.js +21 -0
  55. package/dist/provenance-xmp.d.ts +2 -0
  56. package/dist/provenance-xmp.js +54 -0
  57. package/dist/provenance.d.ts +20 -0
  58. package/dist/provenance.js +58 -0
  59. package/dist/server.d.ts +158 -0
  60. package/dist/server.js +207 -0
  61. package/dist/video-providers/index.d.ts +14 -0
  62. package/dist/video-providers/index.js +14 -0
  63. package/dist/video-providers/minimax.d.ts +25 -0
  64. package/dist/video-providers/minimax.js +63 -0
  65. package/dist/video-providers/reference-encoding.d.ts +4 -0
  66. package/dist/video-providers/reference-encoding.js +11 -0
  67. package/dist/video-providers/types.d.ts +28 -0
  68. package/dist/video-providers/types.js +1 -0
  69. package/dist/video-providers/unified.d.ts +18 -0
  70. package/dist/video-providers/unified.js +52 -0
  71. package/docs/api/README.md +16 -0
  72. package/docs/api/app-media-contracts.md +507 -0
  73. package/docs/api/browser.md +126 -0
  74. package/docs/api/cloudflare.md +678 -0
  75. package/docs/api/effect.md +39 -0
  76. package/docs/api/index.md +1775 -0
  77. package/docs/api/modules.md +19 -0
  78. package/docs/api/provenance-export.md +114 -0
  79. package/docs/api/server.md +1672 -0
  80. package/package.json +110 -3
@@ -0,0 +1,507 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/darkroom**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/darkroom](modules.md) / app-media-contracts
8
+
9
+ # app-media-contracts
10
+
11
+ ## Variables
12
+
13
+ ### mediaModelsSchema
14
+
15
+ ```ts
16
+ const mediaModelsSchema: ZodArray<ZodReadonly<ZodObject<{
17
+ id: ZodString;
18
+ label: ZodString;
19
+ kind: ZodEnum<{
20
+ image: "image";
21
+ video: "video";
22
+ }>;
23
+ tier: ZodEnum<{
24
+ draft: "draft";
25
+ balanced: "balanced";
26
+ premium: "premium";
27
+ max: "max";
28
+ }>;
29
+ outputFormats: ZodReadonly<ZodArray<ZodEnum<{
30
+ png: "png";
31
+ jpeg: "jpeg";
32
+ webp: "webp";
33
+ }>>>;
34
+ input: ZodReadonly<ZodObject<{
35
+ transport: ZodEnum<{
36
+ json: "json";
37
+ multipart: "multipart";
38
+ }>;
39
+ dimensions: ZodEnum<{
40
+ none: "none";
41
+ own: "own";
42
+ }>;
43
+ maxDimension: ZodNullable<ZodNumber>;
44
+ defaultWidth: ZodNumber;
45
+ defaultHeight: ZodNumber;
46
+ steps: ZodEnum<{
47
+ steps: "steps";
48
+ num_steps: "num_steps";
49
+ fixed: "fixed";
50
+ }>;
51
+ maxSteps: ZodNullable<ZodNumber>;
52
+ defaultSteps: ZodNullable<ZodNumber>;
53
+ referenceField: ZodNullable<ZodString>;
54
+ maxReferences: ZodNumber;
55
+ }, $strict>>;
56
+ sizes: ZodNullable<ZodReadonly<ZodArray<ZodString>>>;
57
+ video: ZodNullable<ZodReadonly<ZodObject<{
58
+ minSeconds: ZodNumber;
59
+ maxSeconds: ZodNumber;
60
+ defaultSeconds: ZodNumber;
61
+ durations: ZodReadonly<ZodArray<ZodNumber>>;
62
+ provider: ZodEnum<{
63
+ seedance: "seedance";
64
+ veo: "veo";
65
+ }>;
66
+ formats: ZodReadonly<ZodArray<ZodReadonly<...>>>;
67
+ defaultResolution: ZodEnum<{
68
+ p480: "480p";
69
+ p720: "720p";
70
+ p1080: "1080p";
71
+ p4k: "4k";
72
+ }>;
73
+ defaultAspectRatio: ZodEnum<{
74
+ wide: "16:9";
75
+ landscape: "4:3";
76
+ square: "1:1";
77
+ portrait: "3:4";
78
+ tall: "9:16";
79
+ ultrawide: "21:9";
80
+ ultratall: "9:21";
81
+ }>;
82
+ defaultGenerateAudio: ZodNullable<ZodBoolean>;
83
+ maxPromptLength: ZodNumber;
84
+ referenceRoles: ZodReadonly<ZodArray<ZodEnum<...>>>;
85
+ maxReferenceImages: ZodNumber;
86
+ referenceResolutions: ZodReadonly<ZodArray<ZodEnum<...>>>;
87
+ prices: ZodReadonly<ZodArray<ZodReadonly<...>>>;
88
+ }, $strict>>>;
89
+ }, $strict>>>;
90
+ ```
91
+
92
+ Bounded catalog decoded by the App media broker before host filtering.
93
+
94
+ ---
95
+
96
+ ### destinationSchema
97
+
98
+ ```ts
99
+ const destinationSchema: ZodObject<
100
+ {
101
+ computerId: ZodString;
102
+ path: ZodString;
103
+ },
104
+ $strict
105
+ >;
106
+ ```
107
+
108
+ An absolute output path on the Computer admitted by the App host.
109
+
110
+ ---
111
+
112
+ ### appMediaGenerationResultSchema
113
+
114
+ ```ts
115
+ const appMediaGenerationResultSchema: ZodObject<
116
+ {
117
+ destination: ZodObject<
118
+ {
119
+ computerId: ZodString;
120
+ path: ZodString;
121
+ },
122
+ $strict
123
+ >;
124
+ bytes: ZodNumber;
125
+ costMilliunits: ZodNumber;
126
+ format: ZodEnum<{
127
+ png: "png";
128
+ jpeg: "jpeg";
129
+ gif: "gif";
130
+ webp: "webp";
131
+ mp4: "mp4";
132
+ }>;
133
+ height: ZodNumber;
134
+ model: ZodString;
135
+ width: ZodNumber;
136
+ },
137
+ $strict
138
+ >;
139
+ ```
140
+
141
+ Completed App generation output, with its admitted Computer destination.
142
+
143
+ ---
144
+
145
+ ### appMediaAdmissionErrorSchema
146
+
147
+ ```ts
148
+ const appMediaAdmissionErrorSchema: ZodObject<
149
+ {
150
+ error: ZodEnum<{
151
+ revoked: "revoked";
152
+ not_granted: "not_granted";
153
+ grantor_lost_authority: "grantor_lost_authority";
154
+ unavailable: "unavailable";
155
+ }>;
156
+ },
157
+ $strict
158
+ >;
159
+ ```
160
+
161
+ Authority refusals emitted by Media admission before a host call.
162
+
163
+ ---
164
+
165
+ ### appMediaBudgetRefusalSchema
166
+
167
+ ```ts
168
+ const appMediaBudgetRefusalSchema: ZodObject<
169
+ {
170
+ error: ZodLiteral<"attachment_budget_exceeded">;
171
+ kind: ZodLiteral<"media">;
172
+ retryAfterMs: ZodNumber;
173
+ },
174
+ $strict
175
+ >;
176
+ ```
177
+
178
+ Attachment budget refusal emitted by the Media reservation owner.
179
+
180
+ ---
181
+
182
+ ### appMediaAdmissionRefusalSchema
183
+
184
+ ```ts
185
+ const appMediaAdmissionRefusalSchema: ZodUnion<
186
+ readonly [
187
+ ZodObject<
188
+ {
189
+ error: ZodEnum<{
190
+ revoked: "revoked";
191
+ not_granted: "not_granted";
192
+ grantor_lost_authority: "grantor_lost_authority";
193
+ unavailable: "unavailable";
194
+ }>;
195
+ },
196
+ $strict
197
+ >,
198
+ ZodObject<
199
+ {
200
+ error: ZodLiteral<"attachment_budget_exceeded">;
201
+ kind: ZodLiteral<"media">;
202
+ retryAfterMs: ZodNumber;
203
+ },
204
+ $strict
205
+ >,
206
+ ]
207
+ >;
208
+ ```
209
+
210
+ Existing Media admission refusals, without an admitted selector or callable.
211
+
212
+ ---
213
+
214
+ ### appMediaBrokerErrorSchema
215
+
216
+ ```ts
217
+ const appMediaBrokerErrorSchema: ZodObject<
218
+ {
219
+ error: ZodEnum<{
220
+ revoked: "revoked";
221
+ not_granted: "not_granted";
222
+ grantor_lost_authority: "grantor_lost_authority";
223
+ unavailable: "unavailable";
224
+ invalid: "invalid";
225
+ too_large: "too_large";
226
+ }>;
227
+ },
228
+ $strict
229
+ >;
230
+ ```
231
+
232
+ Admission errors plus invalid/oversized inputs emitted directly by the broker.
233
+
234
+ ---
235
+
236
+ ### agentAppMediaLibraryFailureSchema
237
+
238
+ ```ts
239
+ const agentAppMediaLibraryFailureSchema: ZodObject<
240
+ {
241
+ error: ZodLiteral<"library_unavailable">;
242
+ message: ZodString;
243
+ },
244
+ $strict
245
+ >;
246
+ ```
247
+
248
+ Missing-library refusal decoded and returned by the App media broker.
249
+
250
+ ---
251
+
252
+ ### appMediaBrokerFailureSchema
253
+
254
+ ```ts
255
+ const appMediaBrokerFailureSchema: ZodObject<{
256
+ error: ZodEnum<{
257
+ CAPABILITY_DENIED: "CAPABILITY_DENIED";
258
+ INSUFFICIENT_CREDIT: "INSUFFICIENT_CREDIT";
259
+ HOST_FAILURE: "HOST_FAILURE";
260
+ INVALID_ARGUMENT: "INVALID_ARGUMENT";
261
+ SAFETY_FILTER_REFUSED: "SAFETY_FILTER_REFUSED";
262
+ }>;
263
+ message: ZodString;
264
+ stage: ZodEnum<{
265
+ admission: "admission";
266
+ generation-authorization: "generation-authorization";
267
+ settings: "settings";
268
+ estimate: "estimate";
269
+ billing: "billing";
270
+ operation: "operation";
271
+ provider: "provider";
272
+ normalization: "normalization";
273
+ artifact: "artifact";
274
+ destination-authorization: "destination-authorization";
275
+ destination-write: "destination-write";
276
+ }>;
277
+ retryable: ZodBoolean;
278
+ }, $strict>;
279
+ ```
280
+
281
+ Broker projection of an HTTP failure: code becomes error and error becomes
282
+ message.
283
+
284
+ ---
285
+
286
+ ### appMediaRefusalSchema
287
+
288
+ ```ts
289
+ const appMediaRefusalSchema: ZodUnion<readonly [ZodObject<{
290
+ error: ZodEnum<{
291
+ revoked: "revoked";
292
+ not_granted: "not_granted";
293
+ grantor_lost_authority: "grantor_lost_authority";
294
+ unavailable: "unavailable";
295
+ invalid: "invalid";
296
+ too_large: "too_large";
297
+ }>;
298
+ }, $strict>, ZodObject<{
299
+ error: ZodLiteral<"attachment_budget_exceeded">;
300
+ kind: ZodLiteral<"media">;
301
+ retryAfterMs: ZodNumber;
302
+ }, $strict>, ZodObject<{
303
+ error: ZodLiteral<"library_unavailable">;
304
+ message: ZodString;
305
+ }, $strict>, ZodObject<{
306
+ error: ZodEnum<{
307
+ CAPABILITY_DENIED: "CAPABILITY_DENIED";
308
+ INSUFFICIENT_CREDIT: "INSUFFICIENT_CREDIT";
309
+ HOST_FAILURE: "HOST_FAILURE";
310
+ INVALID_ARGUMENT: "INVALID_ARGUMENT";
311
+ SAFETY_FILTER_REFUSED: "SAFETY_FILTER_REFUSED";
312
+ }>;
313
+ message: ZodString;
314
+ stage: ZodEnum<{
315
+ admission: "admission";
316
+ generation-authorization: "generation-authorization";
317
+ settings: "settings";
318
+ estimate: "estimate";
319
+ billing: "billing";
320
+ operation: "operation";
321
+ provider: "provider";
322
+ normalization: "normalization";
323
+ artifact: "artifact";
324
+ destination-authorization: "destination-authorization";
325
+ destination-write: "destination-write";
326
+ }>;
327
+ retryable: ZodBoolean;
328
+ }, $strict>]>;
329
+ ```
330
+
331
+ Refusal payloads emitted by the App media broker, separate from transport
332
+ errors.
333
+
334
+ ---
335
+
336
+ ### appMediaModelsOutcomeSchema
337
+
338
+ ```ts
339
+ const appMediaModelsOutcomeSchema: ZodUnion<readonly [ZodArray<ZodReadonly<ZodObject<{
340
+ id: ZodString;
341
+ label: ZodString;
342
+ kind: ZodEnum<{
343
+ image: "image";
344
+ video: "video";
345
+ }>;
346
+ tier: ZodEnum<{
347
+ draft: "draft";
348
+ balanced: "balanced";
349
+ premium: "premium";
350
+ max: "max";
351
+ }>;
352
+ outputFormats: ZodReadonly<ZodArray<ZodEnum<{
353
+ png: "png";
354
+ jpeg: "jpeg";
355
+ webp: "webp";
356
+ }>>>;
357
+ input: ZodReadonly<ZodObject<{
358
+ transport: ZodEnum<{
359
+ json: ...;
360
+ multipart: ...;
361
+ }>;
362
+ dimensions: ZodEnum<{
363
+ none: ...;
364
+ own: ...;
365
+ }>;
366
+ maxDimension: ZodNullable<ZodNumber>;
367
+ defaultWidth: ZodNumber;
368
+ defaultHeight: ZodNumber;
369
+ steps: ZodEnum<{
370
+ steps: ...;
371
+ num_steps: ...;
372
+ fixed: ...;
373
+ }>;
374
+ maxSteps: ZodNullable<ZodNumber>;
375
+ defaultSteps: ZodNullable<ZodNumber>;
376
+ referenceField: ZodNullable<ZodString>;
377
+ maxReferences: ZodNumber;
378
+ }, $strict>>;
379
+ sizes: ZodNullable<ZodReadonly<ZodArray<ZodString>>>;
380
+ video: ZodNullable<ZodReadonly<ZodObject<{
381
+ minSeconds: ZodNumber;
382
+ maxSeconds: ZodNumber;
383
+ defaultSeconds: ZodNumber;
384
+ durations: ZodReadonly<...>;
385
+ provider: ZodEnum<...>;
386
+ formats: ZodReadonly<...>;
387
+ defaultResolution: ZodEnum<...>;
388
+ defaultAspectRatio: ZodEnum<...>;
389
+ defaultGenerateAudio: ZodNullable<...>;
390
+ maxPromptLength: ZodNumber;
391
+ referenceRoles: ZodReadonly<...>;
392
+ maxReferenceImages: ZodNumber;
393
+ referenceResolutions: ZodReadonly<...>;
394
+ prices: ZodReadonly<...>;
395
+ }, $strict>>>;
396
+ }, $strict>>>, ZodUnion<readonly [ZodObject<{
397
+ error: ZodEnum<{
398
+ revoked: "revoked";
399
+ not_granted: "not_granted";
400
+ grantor_lost_authority: "grantor_lost_authority";
401
+ unavailable: "unavailable";
402
+ invalid: "invalid";
403
+ too_large: "too_large";
404
+ }>;
405
+ }, $strict>, ZodObject<{
406
+ error: ZodLiteral<"attachment_budget_exceeded">;
407
+ kind: ZodLiteral<"media">;
408
+ retryAfterMs: ZodNumber;
409
+ }, $strict>, ZodObject<{
410
+ error: ZodLiteral<"library_unavailable">;
411
+ message: ZodString;
412
+ }, $strict>, ZodObject<{
413
+ error: ZodEnum<{
414
+ CAPABILITY_DENIED: "CAPABILITY_DENIED";
415
+ INSUFFICIENT_CREDIT: "INSUFFICIENT_CREDIT";
416
+ HOST_FAILURE: "HOST_FAILURE";
417
+ INVALID_ARGUMENT: "INVALID_ARGUMENT";
418
+ SAFETY_FILTER_REFUSED: "SAFETY_FILTER_REFUSED";
419
+ }>;
420
+ message: ZodString;
421
+ stage: ZodEnum<{
422
+ admission: "admission";
423
+ generation-authorization: "generation-authorization";
424
+ settings: "settings";
425
+ estimate: "estimate";
426
+ billing: "billing";
427
+ operation: "operation";
428
+ provider: "provider";
429
+ normalization: "normalization";
430
+ artifact: "artifact";
431
+ destination-authorization: "destination-authorization";
432
+ destination-write: "destination-write";
433
+ }>;
434
+ retryable: ZodBoolean;
435
+ }, $strict>]>]>;
436
+ ```
437
+
438
+ Model-list payload or an existing broker refusal.
439
+
440
+ ---
441
+
442
+ ### appMediaGenerationOutcomeSchema
443
+
444
+ ```ts
445
+ const appMediaGenerationOutcomeSchema: ZodUnion<readonly [ZodObject<{
446
+ destination: ZodObject<{
447
+ computerId: ZodString;
448
+ path: ZodString;
449
+ }, $strict>;
450
+ bytes: ZodNumber;
451
+ costMilliunits: ZodNumber;
452
+ format: ZodEnum<{
453
+ png: "png";
454
+ jpeg: "jpeg";
455
+ gif: "gif";
456
+ webp: "webp";
457
+ mp4: "mp4";
458
+ }>;
459
+ height: ZodNumber;
460
+ model: ZodString;
461
+ width: ZodNumber;
462
+ }, $strict>, ZodObject<{
463
+ kind: ZodLiteral<"pending">;
464
+ retryAfterMs: ZodNumber;
465
+ }, $strict>, ZodUnion<readonly [ZodObject<{
466
+ error: ZodEnum<{
467
+ revoked: "revoked";
468
+ not_granted: "not_granted";
469
+ grantor_lost_authority: "grantor_lost_authority";
470
+ unavailable: "unavailable";
471
+ invalid: "invalid";
472
+ too_large: "too_large";
473
+ }>;
474
+ }, $strict>, ZodObject<{
475
+ error: ZodLiteral<"attachment_budget_exceeded">;
476
+ kind: ZodLiteral<"media">;
477
+ retryAfterMs: ZodNumber;
478
+ }, $strict>, ZodObject<{
479
+ error: ZodLiteral<"library_unavailable">;
480
+ message: ZodString;
481
+ }, $strict>, ZodObject<{
482
+ error: ZodEnum<{
483
+ CAPABILITY_DENIED: "CAPABILITY_DENIED";
484
+ INSUFFICIENT_CREDIT: "INSUFFICIENT_CREDIT";
485
+ HOST_FAILURE: "HOST_FAILURE";
486
+ INVALID_ARGUMENT: "INVALID_ARGUMENT";
487
+ SAFETY_FILTER_REFUSED: "SAFETY_FILTER_REFUSED";
488
+ }>;
489
+ message: ZodString;
490
+ stage: ZodEnum<{
491
+ admission: "admission";
492
+ generation-authorization: "generation-authorization";
493
+ settings: "settings";
494
+ estimate: "estimate";
495
+ billing: "billing";
496
+ operation: "operation";
497
+ provider: "provider";
498
+ normalization: "normalization";
499
+ artifact: "artifact";
500
+ destination-authorization: "destination-authorization";
501
+ destination-write: "destination-write";
502
+ }>;
503
+ retryable: ZodBoolean;
504
+ }, $strict>]>]>;
505
+ ```
506
+
507
+ Completed generation, Agar polling result, or an existing broker refusal.
@@ -0,0 +1,126 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/darkroom**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/darkroom](modules.md) / browser
8
+
9
+ # browser
10
+
11
+ ## Type Aliases
12
+
13
+ ### MediaGenerationDiagnostic
14
+
15
+ ```ts
16
+ type MediaGenerationDiagnostic = (operation, cause, details?) => void;
17
+ ```
18
+
19
+ Host diagnostic sink; generation errors and retry truth remain transport-owned.
20
+
21
+ #### Parameters
22
+
23
+ | Parameter | Type |
24
+ | ----------- | ----------------------------------------------------------------------------------- |
25
+ | `operation` | \| `"app_media_pending_response_unavailable"` \| `"media_failure_body_read_failed"` |
26
+ | `cause` | `unknown` |
27
+ | `details?` | `Readonly`\<\{ `status`: `number`; \}\> |
28
+
29
+ #### Returns
30
+
31
+ `void`
32
+
33
+ ---
34
+
35
+ ### MediaFailure
36
+
37
+ ```ts
38
+ type MediaFailure = z.output<typeof mediaFailureSchema>;
39
+ ```
40
+
41
+ Sanitized Media failure carried from the authenticated host to Agar.
42
+
43
+ ## Variables
44
+
45
+ ### mediaFailureSchema
46
+
47
+ ```ts
48
+ const mediaFailureSchema: ZodObject<{
49
+ error: ZodString;
50
+ stage: ZodEnum<{
51
+ admission: "admission";
52
+ generation-authorization: "generation-authorization";
53
+ settings: "settings";
54
+ estimate: "estimate";
55
+ billing: "billing";
56
+ operation: "operation";
57
+ provider: "provider";
58
+ normalization: "normalization";
59
+ artifact: "artifact";
60
+ destination-authorization: "destination-authorization";
61
+ destination-write: "destination-write";
62
+ }>;
63
+ code: ZodEnum<{
64
+ CAPABILITY_DENIED: "CAPABILITY_DENIED";
65
+ INSUFFICIENT_CREDIT: "INSUFFICIENT_CREDIT";
66
+ HOST_FAILURE: "HOST_FAILURE";
67
+ INVALID_ARGUMENT: "INVALID_ARGUMENT";
68
+ SAFETY_FILTER_REFUSED: "SAFETY_FILTER_REFUSED";
69
+ }>;
70
+ retryable: ZodBoolean;
71
+ }, $strict>;
72
+ ```
73
+
74
+ Sanitized HTTP refusal emitted by a Media host and decoded at the browser
75
+ boundary.
76
+
77
+ ## Functions
78
+
79
+ ### readMediaFailure()
80
+
81
+ ```ts
82
+ function readMediaFailure(
83
+ response,
84
+ diagnostic?,
85
+ ): Promise<{
86
+ error: string;
87
+ stage:
88
+ | "provider"
89
+ | "admission"
90
+ | "generation-authorization"
91
+ | "settings"
92
+ | "estimate"
93
+ | "billing"
94
+ | "operation"
95
+ | "normalization"
96
+ | "artifact"
97
+ | "destination-authorization"
98
+ | "destination-write";
99
+ code:
100
+ | "CAPABILITY_DENIED"
101
+ | "INSUFFICIENT_CREDIT"
102
+ | "HOST_FAILURE"
103
+ | "INVALID_ARGUMENT"
104
+ | "SAFETY_FILTER_REFUSED";
105
+ retryable: boolean;
106
+ } | null>;
107
+ ```
108
+
109
+ Read and decode one Media host failure at the browser HTTP boundary.
110
+
111
+ #### Parameters
112
+
113
+ | Parameter | Type | Default value |
114
+ | ------------ | --------------------------------------------------------- | -------------------- |
115
+ | `response` | `Response` | `undefined` |
116
+ | `diagnostic` | [`MediaGenerationDiagnostic`](#mediagenerationdiagnostic) | `reportCatchFailure` |
117
+
118
+ #### Returns
119
+
120
+ `Promise`\< \| \{ `error`: `string`; `stage`: \| `"provider"` \| `"admission"`
121
+ \| `"generation-authorization"` \| `"settings"` \| `"estimate"` \| `"billing"`
122
+ \| `"operation"` \| `"normalization"` \| `"artifact"` \|
123
+ `"destination-authorization"` \| `"destination-write"`; `code`: \|
124
+ `"CAPABILITY_DENIED"` \| `"INSUFFICIENT_CREDIT"` \| `"HOST_FAILURE"` \|
125
+ `"INVALID_ARGUMENT"` \| `"SAFETY_FILTER_REFUSED"`; `retryable`: `boolean`; \} \|
126
+ `null`\>