@fungi.computer/darkroom 0.9.1 → 0.9.2

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 CHANGED
@@ -396,30 +396,34 @@ and Veo checked 2026-10-11, MiniMax H3 Max checked 2026-10-14. They run through
396
396
  Workers `AI.run` with unprefixed IDs. Cloudflare's Workers AI `@cf/` catalog
397
397
  does not supply these video IDs.
398
398
 
399
- | Model | Resolution | Duration | Reference modes | Provider USD / output second |
400
- | --------------------------------------------------------------------------------------------- | ------------------------ | ---------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------- |
401
- | [Seedance 2.0](https://developers.cloudflare.com/ai/models/bytedance/seedance-2.0/) | 480p / 720p / 1080p / 4k | integers 4–12; default 5 | first frame; first + last; 1–4 reference images except at 1080p | .07 / .15 / .37 / .78 |
402
- | [Seedance 2.0 Fast](https://developers.cloudflare.com/ai/models/bytedance/seedance-2.0-fast/) | 480p / 720p | integers 4–12; default 5 | first frame; first + last; 1–4 reference images | .06 / .12 |
403
- | [Seedance 2.0 Mini](https://developers.cloudflare.com/ai/models/bytedance/seedance-2.0-mini/) | 480p / 720p | integers 4–12; default 5 | first frame; first + last; 1–4 reference images | .04 / .09 |
404
- | [Veo 3.1](https://developers.cloudflare.com/ai/models/google/veo-3.1/) | 720p / 1080p | exactly 4 / 6 / 8; default 6 | one first image | .20 silent / .40 audio at either resolution |
405
- | [Veo 3.1 Fast](https://developers.cloudflare.com/ai/models/google/veo-3.1-fast/) | 720p / 1080p | exactly 4 / 6 / 8; default 6 | one first image | 720p .08 silent / .10 audio; 1080p .10 silent / .12 audio |
406
- | [MiniMax H3 Max](https://developers.cloudflare.com/ai/models/minimax/h3-max/) | 480p / 768p | integers 5–15; default 5 | first frame; first + last; 1–4 reference images, either resolution | .05 / .08 (no documented audio surcharge) |
407
-
408
- Seedance and Veo default to 720p and 16:9; MiniMax H3 Max defaults to 768p and
409
- 16:9. Seedance aspects are 16:9, 4:3, 1:1, 3:4, 9:16, 21:9, and 9:21, with fixed
410
- 24 FPS. Veo aspects are 16:9, 9:16 and 1:1. MiniMax H3 Max aspects are 16:9,
411
- 4:3, 1:1, 3:4, 9:16 and 21:9 (no 9:21; its documented `adaptive` selector, which
399
+ | Model | Resolution | Duration | Reference modes | Provider USD / output second |
400
+ | --------------------------------------------------------------------------------------------- | ------------------------ | ---------------------------- | ---------------------------------------------------------------------------------------- | --------------------------------------------------------- |
401
+ | Seedance 2.5 (`bytedance/seedance-2.5`) | 480p / 720p | integers 4–30; default 5 | first frame; first + last; 1–30 reference images, plus up to 10 audio clips (30 s total) | .10 / .23 |
402
+ | [Seedance 2.0](https://developers.cloudflare.com/ai/models/bytedance/seedance-2.0/) | 480p / 720p / 1080p / 4k | integers 4–12; default 5 | first frame; first + last; 1–4 reference images except at 1080p | .07 / .15 / .37 / .78 |
403
+ | [Seedance 2.0 Fast](https://developers.cloudflare.com/ai/models/bytedance/seedance-2.0-fast/) | 480p / 720p | integers 4–12; default 5 | first frame; first + last; 1–4 reference images | .06 / .12 |
404
+ | [Seedance 2.0 Mini](https://developers.cloudflare.com/ai/models/bytedance/seedance-2.0-mini/) | 480p / 720p | integers 4–12; default 5 | first frame; first + last; 1–4 reference images | .04 / .09 |
405
+ | [Veo 3.1](https://developers.cloudflare.com/ai/models/google/veo-3.1/) | 720p / 1080p | exactly 4 / 6 / 8; default 6 | one first image | .20 silent / .40 audio at either resolution |
406
+ | [Veo 3.1 Fast](https://developers.cloudflare.com/ai/models/google/veo-3.1-fast/) | 720p / 1080p | exactly 4 / 6 / 8; default 6 | one first image | 720p .08 silent / .10 audio; 1080p .10 silent / .12 audio |
407
+ | [MiniMax H3 Max](https://developers.cloudflare.com/ai/models/minimax/h3-max/) | 480p / 768p | integers 5–15; default 5 | first frame; first + last; 1–4 reference images, either resolution | .05 / .08 (no documented audio surcharge) |
408
+
409
+ Seedance 2.5's limits come from its Cloudflare input schema and its prices from
410
+ the Cloudflare dashboard (supplied 2026-11-13). Seedance and Veo default to 720p
411
+ and 16:9; MiniMax H3 Max defaults to 768p and 16:9. Seedance aspects are 16:9,
412
+ 4:3, 1:1, 3:4, 9:16, 21:9, and 9:21 (Seedance 2.5 has no 9:21), with fixed 24
413
+ FPS. Veo aspects are 16:9, 9:16 and 1:1. MiniMax H3 Max aspects are 16:9, 4:3,
414
+ 1:1, 3:4, 9:16 and 21:9 (no 9:21; its documented `adaptive` selector, which
412
415
  follows the input image's own aspect instead of a fixed box, has no nominal
413
- pixel size and is not exposed by this catalog). Seedance prompts are at most
414
- 2,000 characters; Veo uses Darkroom's retained 2,048-character host limit
415
- because the provider page states no prompt maximum; MiniMax H3 Max's own limit
416
- is 7,000 but Darkroom's 2,048-character host cap binds first. Paths are trimmed,
417
- nonblank and at most 4,096 characters; references are bounded at four overall
418
- and refined per model (MiniMax H3 Max's own page documents up to nine, which
419
- this four-reference host ceiling cannot reach). Last frame requires exactly one
420
- first frame. Frame mode cannot mix with reference-image mode. Seedance's first
421
- image can override the requested aspect; returned width/height are nominal
422
- selectors, not measured MP4 dimensions.
416
+ pixel size and is not exposed by this catalog). Seedance 2.0 prompts are at most
417
+ 10,000 characters and Seedance 2.5 prompts 25,000; Veo uses Darkroom's retained
418
+ 2,048-character host limit because the provider page states no prompt maximum;
419
+ MiniMax H3 Max's own limit is 7,000 but Darkroom's 2,048-character host cap
420
+ binds first. Paths are trimmed, nonblank and at most 4,096 characters;
421
+ references are bounded at 30 overall and refined per model (MiniMax H3 Max's own
422
+ page documents up to nine, which the catalog's four-reference limit for it
423
+ cannot reach). Last frame requires exactly one first frame. Frame mode cannot
424
+ mix with reference-image mode. Seedance's first image can override the requested
425
+ aspect; returned width/height are nominal selectors, not measured MP4
426
+ dimensions.
423
427
 
424
428
  Veo audio defaults to true and is always explicit in the provider request and
425
429
  quote. Seedance leaves `generate_audio` unset when `generateAudio` is omitted,
@@ -432,11 +436,11 @@ estimator read the catalog prices: 1 USD = 100,000 milliunits, 1 cent = 1,000.
432
436
  `mediaUnits` returns `{unit: "video_second", units: durationSeconds}`. The host
433
437
  still owns admission, settlement, markup and refusal copy.
434
438
 
435
- Reference limits follow the explicit Seedance parameter section's four-image
436
- grammar; its overview's larger counts remain unsupported. Veo 4k pricing does
437
- not establish a supported 4k input, and Seedance 2.5's duration grammar remains
438
- unverified. Video/audio references and undocumented options are refused, never
439
- silently dropped. Seedance frames and references become data URIs; Veo's
439
+ Seedance 2.0 reference limits follow the explicit Seedance parameter section's
440
+ four-image grammar; its overview's larger counts remain unsupported. Seedance
441
+ 2.5 takes up to 30 reference images. Veo 4k pricing does not establish a
442
+ supported 4k input. Video/audio references and undocumented options are refused,
443
+ never silently dropped. Seedance frames and references become data URIs; Veo's
440
444
  `image_input` is plain base64; MiniMax H3 Max's are data URIs inside a
441
445
  multimodal `content[]` array (`{type: "image_url", image_url: {url}, role}`),
442
446
  alongside the leading `{type: "text", text: prompt}` entry — a different
@@ -5,6 +5,8 @@ import { z } from "zod";
5
5
  import { reportCatchFailure } from "./failure.js";
6
6
  import { MediaExecutionError, MediaSafetyFilterRefusal, mediaFailureStageSchema, } from "./execution-error.js";
7
7
  import { mediaProviderDiagnosticWireSchema, } from "@fungi.computer/agar/errors";
8
+ /** Safely inside the 15-minute alarm wall-clock limit that would kill the call. */
9
+ const backgroundProviderTimeoutMs = 12 * 60_000;
8
10
  const providerFailureSchema = z.strictObject({
9
11
  stage: mediaFailureStageSchema.extract(["provider", "normalization"]),
10
12
  safetyRefused: z.boolean(),
@@ -721,7 +723,20 @@ export class MediaOperationOwner {
721
723
  return;
722
724
  if (row.dispatched_at !== null) {
723
725
  // A previous alarm dispatched and then died: never call the provider
724
- // again. Recovery (claim) retains any committed output after the lease.
726
+ // again. No output was retained (the state is still generating), so end
727
+ // the operation now rather than leaving every poll pending until the
728
+ // lease lapses.
729
+ reportCatchFailure("media-operation-alarm-retry", new Error("Background media alarm died after dispatch"));
730
+ try {
731
+ this.interruptGeneration(leaseId, {
732
+ stage: "provider",
733
+ safetyRefused: false,
734
+ });
735
+ }
736
+ catch (cause) {
737
+ reportCatchFailure("media-operation-interrupt", cause);
738
+ /* A recovery claim already ended this lease. */
739
+ }
725
740
  return;
726
741
  }
727
742
  this.ctx.storage.sql.exec("UPDATE hub_media_operation SET dispatched_at=? WHERE singleton=1", Date.now());
@@ -752,7 +767,26 @@ export class MediaOperationOwner {
752
767
  }));
753
768
  // The captured request includes destination authority; providers receive settings only.
754
769
  const settings = validateMediaGenerationSettings(mediaGenerationSettingsSchema.strip().parse(record.input), this.catalogue());
755
- output = await provider(settings, references, undefined, record.input.outputFormat, audioReferences);
770
+ const controller = new AbortController();
771
+ let timer;
772
+ const timedOut = new Promise((_resolve, reject) => {
773
+ timer = setTimeout(() => {
774
+ const timeout = new MediaExecutionError("provider", {
775
+ cause: new Error("Background media provider timed out"),
776
+ });
777
+ controller.abort(timeout);
778
+ reject(timeout);
779
+ }, backgroundProviderTimeoutMs);
780
+ });
781
+ try {
782
+ output = await Promise.race([
783
+ provider(settings, references, controller.signal, record.input.outputFormat, audioReferences),
784
+ timedOut,
785
+ ]);
786
+ }
787
+ finally {
788
+ clearTimeout(timer);
789
+ }
756
790
  }
757
791
  catch (cause) {
758
792
  reportCatchFailure("media-operation-provider", cause);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/darkroom",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
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",