@skyphusion-labs/vivijure-core 0.9.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/LICENSE +661 -0
- package/README.md +87 -0
- package/dist/audio-routing.d.ts +2 -0
- package/dist/audio-routing.d.ts.map +1 -0
- package/dist/audio-routing.js +4 -0
- package/dist/audio-routing.js.map +1 -0
- package/dist/audio-stage.d.ts +4 -0
- package/dist/audio-stage.d.ts.map +1 -0
- package/dist/audio-stage.js +25 -0
- package/dist/audio-stage.js.map +1 -0
- package/dist/beat-analyze.d.ts +22 -0
- package/dist/beat-analyze.d.ts.map +1 -0
- package/dist/beat-analyze.js +111 -0
- package/dist/beat-analyze.js.map +1 -0
- package/dist/beat-sync-types.d.ts +33 -0
- package/dist/beat-sync-types.d.ts.map +1 -0
- package/dist/beat-sync-types.js +4 -0
- package/dist/beat-sync-types.js.map +1 -0
- package/dist/bundle-assembler.d.ts +54 -0
- package/dist/bundle-assembler.d.ts.map +1 -0
- package/dist/bundle-assembler.js +376 -0
- package/dist/bundle-assembler.js.map +1 -0
- package/dist/bundle-durations.d.ts +5 -0
- package/dist/bundle-durations.d.ts.map +1 -0
- package/dist/bundle-durations.js +68 -0
- package/dist/bundle-durations.js.map +1 -0
- package/dist/bundle-storyboard.d.ts +11 -0
- package/dist/bundle-storyboard.d.ts.map +1 -0
- package/dist/bundle-storyboard.js +82 -0
- package/dist/bundle-storyboard.js.map +1 -0
- package/dist/captions.d.ts +25 -0
- package/dist/captions.d.ts.map +1 -0
- package/dist/captions.js +56 -0
- package/dist/captions.js.map +1 -0
- package/dist/cast-db.d.ts +61 -0
- package/dist/cast-db.d.ts.map +1 -0
- package/dist/cast-db.js +324 -0
- package/dist/cast-db.js.map +1 -0
- package/dist/cast-lora-train.d.ts +18 -0
- package/dist/cast-lora-train.d.ts.map +1 -0
- package/dist/cast-lora-train.js +215 -0
- package/dist/cast-lora-train.js.map +1 -0
- package/dist/cast-loras.d.ts +21 -0
- package/dist/cast-loras.d.ts.map +1 -0
- package/dist/cast-loras.js +69 -0
- package/dist/cast-loras.js.map +1 -0
- package/dist/clip-content-validate.d.ts +43 -0
- package/dist/clip-content-validate.d.ts.map +1 -0
- package/dist/clip-content-validate.js +115 -0
- package/dist/clip-content-validate.js.map +1 -0
- package/dist/clip-job-model.d.ts +42 -0
- package/dist/clip-job-model.d.ts.map +1 -0
- package/dist/clip-job-model.js +8 -0
- package/dist/clip-job-model.js.map +1 -0
- package/dist/clip-validate.d.ts +33 -0
- package/dist/clip-validate.d.ts.map +1 -0
- package/dist/clip-validate.js +247 -0
- package/dist/clip-validate.js.map +1 -0
- package/dist/d1-retry.d.ts +20 -0
- package/dist/d1-retry.d.ts.map +1 -0
- package/dist/d1-retry.js +67 -0
- package/dist/d1-retry.js.map +1 -0
- package/dist/db-env.d.ts +6 -0
- package/dist/db-env.d.ts.map +1 -0
- package/dist/db-env.js +2 -0
- package/dist/db-env.js.map +1 -0
- package/dist/dialogue-lines.d.ts +23 -0
- package/dist/dialogue-lines.d.ts.map +1 -0
- package/dist/dialogue-lines.js +84 -0
- package/dist/dialogue-lines.js.map +1 -0
- package/dist/film-advance-lease.d.ts +9 -0
- package/dist/film-advance-lease.d.ts.map +1 -0
- package/dist/film-advance-lease.js +19 -0
- package/dist/film-advance-lease.js.map +1 -0
- package/dist/film-model.d.ts +415 -0
- package/dist/film-model.d.ts.map +1 -0
- package/dist/film-model.js +541 -0
- package/dist/film-model.js.map +1 -0
- package/dist/film-orchestrator.d.ts +216 -0
- package/dist/film-orchestrator.d.ts.map +1 -0
- package/dist/film-orchestrator.js +2204 -0
- package/dist/film-orchestrator.js.map +1 -0
- package/dist/film-render-bridge.d.ts +26 -0
- package/dist/film-render-bridge.d.ts.map +1 -0
- package/dist/film-render-bridge.js +176 -0
- package/dist/film-render-bridge.js.map +1 -0
- package/dist/finish-hash.d.ts +10 -0
- package/dist/finish-hash.d.ts.map +1 -0
- package/dist/finish-hash.js +60 -0
- package/dist/finish-hash.js.map +1 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/key-safety.d.ts +5 -0
- package/dist/key-safety.d.ts.map +1 -0
- package/dist/key-safety.js +23 -0
- package/dist/key-safety.js.map +1 -0
- package/dist/lora-bundle.d.ts +19 -0
- package/dist/lora-bundle.d.ts.map +1 -0
- package/dist/lora-bundle.js +75 -0
- package/dist/lora-bundle.js.map +1 -0
- package/dist/lora-keys.d.ts +2 -0
- package/dist/lora-keys.d.ts.map +1 -0
- package/dist/lora-keys.js +4 -0
- package/dist/lora-keys.js.map +1 -0
- package/dist/modules/conformance.d.ts +58 -0
- package/dist/modules/conformance.d.ts.map +1 -0
- package/dist/modules/conformance.js +369 -0
- package/dist/modules/conformance.js.map +1 -0
- package/dist/modules/manifest-validate.d.ts +5 -0
- package/dist/modules/manifest-validate.d.ts.map +1 -0
- package/dist/modules/manifest-validate.js +60 -0
- package/dist/modules/manifest-validate.js.map +1 -0
- package/dist/modules/registry.d.ts +184 -0
- package/dist/modules/registry.d.ts.map +1 -0
- package/dist/modules/registry.js +653 -0
- package/dist/modules/registry.js.map +1 -0
- package/dist/modules/render-pipeline.d.ts +38 -0
- package/dist/modules/render-pipeline.d.ts.map +1 -0
- package/dist/modules/render-pipeline.js +40 -0
- package/dist/modules/render-pipeline.js.map +1 -0
- package/dist/modules/types.d.ts +544 -0
- package/dist/modules/types.d.ts.map +1 -0
- package/dist/modules/types.js +57 -0
- package/dist/modules/types.js.map +1 -0
- package/dist/operator-config.d.ts +20 -0
- package/dist/operator-config.d.ts.map +1 -0
- package/dist/operator-config.js +85 -0
- package/dist/operator-config.js.map +1 -0
- package/dist/output-extract.d.ts +8 -0
- package/dist/output-extract.d.ts.map +1 -0
- package/dist/output-extract.js +129 -0
- package/dist/output-extract.js.map +1 -0
- package/dist/planner-prompt.d.ts +12 -0
- package/dist/planner-prompt.d.ts.map +1 -0
- package/dist/planner-prompt.js +337 -0
- package/dist/planner-prompt.js.map +1 -0
- package/dist/planner-yaml.d.ts +15 -0
- package/dist/planner-yaml.d.ts.map +1 -0
- package/dist/planner-yaml.js +157 -0
- package/dist/planner-yaml.js.map +1 -0
- package/dist/platform/fetcher.d.ts +3 -0
- package/dist/platform/fetcher.d.ts.map +1 -0
- package/dist/platform/fetcher.js +7 -0
- package/dist/platform/fetcher.js.map +1 -0
- package/dist/platform/index.d.ts +6 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +5 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/object-store-r2.d.ts +26 -0
- package/dist/platform/object-store-r2.d.ts.map +1 -0
- package/dist/platform/object-store-r2.js +74 -0
- package/dist/platform/object-store-r2.js.map +1 -0
- package/dist/platform/orchestrator-context.d.ts +20 -0
- package/dist/platform/orchestrator-context.d.ts.map +1 -0
- package/dist/platform/orchestrator-context.js +28 -0
- package/dist/platform/orchestrator-context.js.map +1 -0
- package/dist/platform/r2-types.d.ts +41 -0
- package/dist/platform/r2-types.d.ts.map +1 -0
- package/dist/platform/r2-types.js +3 -0
- package/dist/platform/r2-types.js.map +1 -0
- package/dist/platform/types.d.ts +90 -0
- package/dist/platform/types.d.ts.map +1 -0
- package/dist/platform/types.js +23 -0
- package/dist/platform/types.js.map +1 -0
- package/dist/preflight.d.ts +57 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/preflight.js +243 -0
- package/dist/preflight.js.map +1 -0
- package/dist/presign.d.ts +5 -0
- package/dist/presign.d.ts.map +1 -0
- package/dist/presign.js +24 -0
- package/dist/presign.js.map +1 -0
- package/dist/public-id.d.ts +8 -0
- package/dist/public-id.d.ts.map +1 -0
- package/dist/public-id.js +25 -0
- package/dist/public-id.js.map +1 -0
- package/dist/render-adopt.d.ts +3 -0
- package/dist/render-adopt.d.ts.map +1 -0
- package/dist/render-adopt.js +92 -0
- package/dist/render-adopt.js.map +1 -0
- package/dist/render-log.d.ts +25 -0
- package/dist/render-log.d.ts.map +1 -0
- package/dist/render-log.js +139 -0
- package/dist/render-log.js.map +1 -0
- package/dist/render-module-config.d.ts +28 -0
- package/dist/render-module-config.d.ts.map +1 -0
- package/dist/render-module-config.js +124 -0
- package/dist/render-module-config.js.map +1 -0
- package/dist/render-mux.d.ts +18 -0
- package/dist/render-mux.d.ts.map +1 -0
- package/dist/render-mux.js +69 -0
- package/dist/render-mux.js.map +1 -0
- package/dist/render-orchestrator.d.ts +71 -0
- package/dist/render-orchestrator.d.ts.map +1 -0
- package/dist/render-orchestrator.js +376 -0
- package/dist/render-orchestrator.js.map +1 -0
- package/dist/render-sweep.d.ts +5 -0
- package/dist/render-sweep.d.ts.map +1 -0
- package/dist/render-sweep.js +62 -0
- package/dist/render-sweep.js.map +1 -0
- package/dist/renders-db.d.ts +129 -0
- package/dist/renders-db.d.ts.map +1 -0
- package/dist/renders-db.js +752 -0
- package/dist/renders-db.js.map +1 -0
- package/dist/runpod-submit.d.ts +151 -0
- package/dist/runpod-submit.d.ts.map +1 -0
- package/dist/runpod-submit.js +469 -0
- package/dist/runpod-submit.js.map +1 -0
- package/dist/runpod-types.d.ts +2 -0
- package/dist/runpod-types.d.ts.map +1 -0
- package/dist/runpod-types.js +4 -0
- package/dist/runpod-types.js.map +1 -0
- package/dist/scatter-notify.d.ts +4 -0
- package/dist/scatter-notify.d.ts.map +1 -0
- package/dist/scatter-notify.js +43 -0
- package/dist/scatter-notify.js.map +1 -0
- package/dist/scatter-orchestrator-types.d.ts +56 -0
- package/dist/scatter-orchestrator-types.d.ts.map +1 -0
- package/dist/scatter-orchestrator-types.js +3 -0
- package/dist/scatter-orchestrator-types.js.map +1 -0
- package/dist/scatter-orchestrator.d.ts +70 -0
- package/dist/scatter-orchestrator.d.ts.map +1 -0
- package/dist/scatter-orchestrator.js +614 -0
- package/dist/scatter-orchestrator.js.map +1 -0
- package/dist/scatter.d.ts +35 -0
- package/dist/scatter.d.ts.map +1 -0
- package/dist/scatter.js +171 -0
- package/dist/scatter.js.map +1 -0
- package/dist/secret-store.d.ts +5 -0
- package/dist/secret-store.d.ts.map +1 -0
- package/dist/secret-store.js +19 -0
- package/dist/secret-store.js.map +1 -0
- package/dist/shot-durations-parse.d.ts +3 -0
- package/dist/shot-durations-parse.d.ts.map +1 -0
- package/dist/shot-durations-parse.js +43 -0
- package/dist/shot-durations-parse.js.map +1 -0
- package/dist/srt.d.ts +11 -0
- package/dist/srt.d.ts.map +1 -0
- package/dist/srt.js +54 -0
- package/dist/srt.js.map +1 -0
- package/dist/storyboard-ids.d.ts +2 -0
- package/dist/storyboard-ids.d.ts.map +1 -0
- package/dist/storyboard-ids.js +12 -0
- package/dist/storyboard-ids.js.map +1 -0
- package/dist/storyboard-projects-db.d.ts +31 -0
- package/dist/storyboard-projects-db.d.ts.map +1 -0
- package/dist/storyboard-projects-db.js +153 -0
- package/dist/storyboard-projects-db.js.map +1 -0
- package/dist/storyboard-validate.d.ts +72 -0
- package/dist/storyboard-validate.d.ts.map +1 -0
- package/dist/storyboard-validate.js +595 -0
- package/dist/storyboard-validate.js.map +1 -0
- package/dist/structured-events.d.ts +6 -0
- package/dist/structured-events.d.ts.map +1 -0
- package/dist/structured-events.js +15 -0
- package/dist/structured-events.js.map +1 -0
- package/dist/tar.d.ts +9 -0
- package/dist/tar.d.ts.map +1 -0
- package/dist/tar.js +151 -0
- package/dist/tar.js.map +1 -0
- package/dist/voices.d.ts +12 -0
- package/dist/voices.d.ts.map +1 -0
- package/dist/voices.js +37 -0
- package/dist/voices.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
// RunPod serverless submit / poll helpers (v0.32.0).
|
|
2
|
+
//
|
|
3
|
+
// Pure URL + payload builders + response normalizer plus a thin dispatcher
|
|
4
|
+
// that calls fetch. The dispatcher is not unit-tested (it would require
|
|
5
|
+
// mocking the fetch global); the pure helpers are tested in their own file
|
|
6
|
+
// and the dispatcher mirrors them. Reuses the project's "no zod / ajv at
|
|
7
|
+
// runtime, hand-authored types" convention from src/env.ts.
|
|
8
|
+
//
|
|
9
|
+
// The vivijure-serverless GPU worker is a RunPod queue-based endpoint. The
|
|
10
|
+
// job input shape is fixed in rp_handler.py:
|
|
11
|
+
//
|
|
12
|
+
// { "project": "<name>", "bundle_key": "bundles/<name>.tar.gz",
|
|
13
|
+
// "quality_tier": "draft|standard|final",
|
|
14
|
+
// "render_overrides": { "keyframe": {...}, "i2v": {...}, "lora": {...} } }
|
|
15
|
+
//
|
|
16
|
+
// RunPod wraps this in `{ "input": {...} }` on submit. Polling returns an
|
|
17
|
+
// envelope { id, status, output?, error?, executionTime?, delayTime? }.
|
|
18
|
+
import { secretValue } from "./secret-store.js";
|
|
19
|
+
// Quality tier normalizer / validator (v0.156.3). The render tiers are keyframe (a
|
|
20
|
+
// separate keyframesOnly flag) plus three real generation tiers the pod's `for_tier`
|
|
21
|
+
// genuinely distinguishes: draft (4-step distilled), standard (8-step keyframe + 20-step
|
|
22
|
+
// EasyCache i2v, the middle), and final (30-step keyframe + 40-step MixCache i2v). v0.156.1
|
|
23
|
+
// wrongly dropped standard on the belief for_tier only branched draft/final; it does not
|
|
24
|
+
// (config.py KeyframeConfig.for_tier and I2VConfig.for_tier each branch all three), so
|
|
25
|
+
// standard is restored here. Returns undefined for an invalid tier the caller should hear about.
|
|
26
|
+
export function coerceQualityTier(t) {
|
|
27
|
+
if (t === "draft")
|
|
28
|
+
return "draft";
|
|
29
|
+
if (t === "standard")
|
|
30
|
+
return "standard";
|
|
31
|
+
if (t === "final")
|
|
32
|
+
return "final";
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const RUNPOD_BASE = "https://api.runpod.ai";
|
|
36
|
+
// Bundle key shape (mirrors bundle-assembler.assembleBundle's output):
|
|
37
|
+
// bundles/<projectName>.tar.gz
|
|
38
|
+
// Extracts <projectName> for the rp_handler `project` field when the caller
|
|
39
|
+
// did not provide one explicitly. Falls back to the full bundleKey when the
|
|
40
|
+
// shape does not match, which lets a caller stage a custom-keyed bundle
|
|
41
|
+
// outside the assembler and still submit it.
|
|
42
|
+
export function deriveProjectFromBundleKey(bundleKey) {
|
|
43
|
+
const m = bundleKey.match(/^bundles\/(.+)\.tar\.gz$/);
|
|
44
|
+
if (m)
|
|
45
|
+
return m[1];
|
|
46
|
+
return bundleKey;
|
|
47
|
+
}
|
|
48
|
+
export function buildSubmitPayload(args) {
|
|
49
|
+
const project = args.project && args.project.trim().length > 0
|
|
50
|
+
? args.project.trim()
|
|
51
|
+
: deriveProjectFromBundleKey(args.bundleKey);
|
|
52
|
+
const input = {
|
|
53
|
+
project,
|
|
54
|
+
bundle_key: args.bundleKey,
|
|
55
|
+
quality_tier: args.qualityTier ?? "final",
|
|
56
|
+
};
|
|
57
|
+
// v0.160.0: keyframes-only is a first-class action (Action.PREVIEW), not a
|
|
58
|
+
// render_overrides.keyframes_only flag the backend has to remember to read.
|
|
59
|
+
// The retired vivijure-serverless honored the flag; the clean-room backend
|
|
60
|
+
// dispatches on `action` only, so the flag was a dead passenger and every
|
|
61
|
+
// preview ran the full train -> keyframes -> i2v -> MP4 path.
|
|
62
|
+
if (args.keyframesOnly)
|
|
63
|
+
input.action = "preview";
|
|
64
|
+
const ro = normalizeRenderOverrides(args.renderOverrides);
|
|
65
|
+
if (ro)
|
|
66
|
+
input.render_overrides = ro;
|
|
67
|
+
// v0.52.0: pass through the audio bed key. Already-empty values stay
|
|
68
|
+
// off the wire so 0.4.10 and earlier workers (which ignore unknown
|
|
69
|
+
// fields anyway) see no diff.
|
|
70
|
+
if (typeof args.audioKey === "string" && args.audioKey.length > 0) {
|
|
71
|
+
input.audio_key = args.audioKey;
|
|
72
|
+
}
|
|
73
|
+
// v0.68.0 hot-fix: buildSubmitPayload was missing the pretrained_loras
|
|
74
|
+
// pass-through that buildFinalizePayload already had. That meant the
|
|
75
|
+
// v0.58.0 castLoras feature populated the route's response envelope
|
|
76
|
+
// (pretrainedSlots) but the wire body never carried the actual
|
|
77
|
+
// {slot: r2_key} map, so the GPU never staged the LoRAs and Stage 1
|
|
78
|
+
// re-trained from scratch every time. Identified during the post-
|
|
79
|
+
// 0.4.16 smoke-test investigation - we were chasing
|
|
80
|
+
// _stage_pretrained_loras silently failing on the GPU when the bug
|
|
81
|
+
// was that the field never reached it.
|
|
82
|
+
if (args.pretrainedLoras && Object.keys(args.pretrainedLoras).length > 0) {
|
|
83
|
+
input.pretrained_loras = { ...args.pretrainedLoras };
|
|
84
|
+
}
|
|
85
|
+
// v0.161.0: subset render for a scatter shard. Same empty-array-is-undefined
|
|
86
|
+
// semantic as finalize: an empty list means "the full storyboard".
|
|
87
|
+
if (Array.isArray(args.processShotIds) && args.processShotIds.length > 0) {
|
|
88
|
+
input.process_shot_ids = [...args.processShotIds];
|
|
89
|
+
}
|
|
90
|
+
return { input };
|
|
91
|
+
}
|
|
92
|
+
// v0.42.0: pure builder for the finalize RunPod payload. Action gates
|
|
93
|
+
// the GPU dispatcher into the Wan-I2V-only + assemble branch (no
|
|
94
|
+
// fresh SDXL). Identical wire fields to buildSubmitPayload otherwise.
|
|
95
|
+
export function buildFinalizePayload(args) {
|
|
96
|
+
const input = {
|
|
97
|
+
action: "finalize",
|
|
98
|
+
project: args.project,
|
|
99
|
+
bundle_key: args.bundleKey,
|
|
100
|
+
quality_tier: args.qualityTier ?? "final",
|
|
101
|
+
};
|
|
102
|
+
const ro = normalizeRenderOverrides(args.renderOverrides);
|
|
103
|
+
if (ro)
|
|
104
|
+
input.render_overrides = ro;
|
|
105
|
+
// v0.45.0: only include the shot list when there is at least one
|
|
106
|
+
// shot to process. An empty array stripped to undefined means "run
|
|
107
|
+
// the full all-scenes flow" on the GPU side; that matches the
|
|
108
|
+
// semantic the Worker route surfaces ("if nothing is locked, run
|
|
109
|
+
// everything").
|
|
110
|
+
if (Array.isArray(args.processShotIds) && args.processShotIds.length > 0) {
|
|
111
|
+
input.process_shot_ids = [...args.processShotIds];
|
|
112
|
+
}
|
|
113
|
+
// v0.52.0: same audio_key passthrough as buildSubmitPayload.
|
|
114
|
+
if (typeof args.audioKey === "string" && args.audioKey.length > 0) {
|
|
115
|
+
input.audio_key = args.audioKey;
|
|
116
|
+
}
|
|
117
|
+
if (args.pretrainedLoras && Object.keys(args.pretrainedLoras).length > 0) {
|
|
118
|
+
input.pretrained_loras = { ...args.pretrainedLoras };
|
|
119
|
+
}
|
|
120
|
+
return { input };
|
|
121
|
+
}
|
|
122
|
+
// v0.57.0: pure builder for the standalone LoRA training payload.
|
|
123
|
+
// Same wire shape as the render/finalize/regen actions; the GPU
|
|
124
|
+
// dispatcher routes on the `action` field.
|
|
125
|
+
export function buildTrainLoraPayload(args) {
|
|
126
|
+
const input = {
|
|
127
|
+
action: "train_lora",
|
|
128
|
+
project: args.project,
|
|
129
|
+
bundle_key: args.bundleKey,
|
|
130
|
+
};
|
|
131
|
+
const ro = normalizeRenderOverrides(args.renderOverrides);
|
|
132
|
+
if (ro)
|
|
133
|
+
input.render_overrides = ro;
|
|
134
|
+
return { input };
|
|
135
|
+
}
|
|
136
|
+
// The namespaced render-override contract the clean-room vivijure-backend reads
|
|
137
|
+
// (config.py RenderConfig.from_request): a { keyframe, i2v, lora } object layered
|
|
138
|
+
// over the quality-tier baseline, plus the one routing flag the backend reads off
|
|
139
|
+
// the raw overrides dict (finish_offloaded; keyframes-only is the `preview` action
|
|
140
|
+
// now). Anything outside these
|
|
141
|
+
// known sections / flags is DROPPED here -- the planner historically sent ~24
|
|
142
|
+
// vivijure-serverless *_overrides blocks (multi_character, wan_diffusion, ...) that
|
|
143
|
+
// the clean-room backend never reads, so every advanced knob was silently lost
|
|
144
|
+
// (the contract-completeness audit, ~/vivijure-audit-F-contract.md). Sections pass
|
|
145
|
+
// through verbatim (keyframe nests multi_char); the pod re-clamps every value, so a
|
|
146
|
+
// stray key wastes no GPU. Advanced users now send the namespaced shape directly
|
|
147
|
+
// (docs/render-api.md).
|
|
148
|
+
const _OVERRIDE_SECTIONS = ["keyframe", "i2v", "lora"];
|
|
149
|
+
// v0.160.0: keyframes_only is no longer a wire flag -- it is the `preview` action
|
|
150
|
+
// now (buildSubmitPayload sets input.action). finish_offloaded stays the one
|
|
151
|
+
// routing flag the backend reads off the raw overrides dict.
|
|
152
|
+
const _OVERRIDE_FLAGS = ["finish_offloaded"];
|
|
153
|
+
export function normalizeRenderOverrides(raw) {
|
|
154
|
+
const out = {};
|
|
155
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
156
|
+
const r = raw;
|
|
157
|
+
for (const sec of _OVERRIDE_SECTIONS) {
|
|
158
|
+
const v = r[sec];
|
|
159
|
+
if (v && typeof v === "object" && !Array.isArray(v))
|
|
160
|
+
out[sec] = v;
|
|
161
|
+
}
|
|
162
|
+
for (const f of _OVERRIDE_FLAGS) {
|
|
163
|
+
if (typeof r[f] === "boolean")
|
|
164
|
+
out[f] = r[f];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
168
|
+
}
|
|
169
|
+
// v0.41.0: pure builder for the per-shot regen RunPod payload. Mirrors
|
|
170
|
+
// buildSubmitPayload's shape so the dispatcher can use the same fetch
|
|
171
|
+
// surface. The GPU side dispatches by `action` and ignores fields
|
|
172
|
+
// irrelevant to its branch.
|
|
173
|
+
export function buildRegenShotPayload(args) {
|
|
174
|
+
const input = {
|
|
175
|
+
action: "regen_shot",
|
|
176
|
+
project: args.project,
|
|
177
|
+
bundle_key: args.bundleKey,
|
|
178
|
+
process_shot_ids: [args.shotId],
|
|
179
|
+
};
|
|
180
|
+
return { input };
|
|
181
|
+
}
|
|
182
|
+
export function buildSubmitUrl(endpointId) {
|
|
183
|
+
return `${RUNPOD_BASE}/v2/${endpointId}/run`;
|
|
184
|
+
}
|
|
185
|
+
export function buildStatusUrl(endpointId, jobId) {
|
|
186
|
+
return `${RUNPOD_BASE}/v2/${endpointId}/status/${jobId}`;
|
|
187
|
+
}
|
|
188
|
+
export function buildCancelUrl(endpointId, jobId) {
|
|
189
|
+
return `${RUNPOD_BASE}/v2/${endpointId}/cancel/${jobId}`;
|
|
190
|
+
}
|
|
191
|
+
// Validate a job id at the route boundary so a malformed id does not
|
|
192
|
+
// produce a RunPod 404 we have to translate back. RunPod ids are
|
|
193
|
+
// alphanumeric with hyphens / underscores; the cap is generous since the
|
|
194
|
+
// platform has not published an exact format.
|
|
195
|
+
const JOB_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
196
|
+
export function isValidJobId(jobId) {
|
|
197
|
+
return JOB_ID_RE.test(jobId);
|
|
198
|
+
}
|
|
199
|
+
// Map RunPod's envelope to RunpodJobView. Tolerates missing fields and
|
|
200
|
+
// surfaces unknown status strings via `statusRaw`. Does not throw; the
|
|
201
|
+
// dispatcher decides how to translate transport errors to HTTP semantics.
|
|
202
|
+
export function normalizeRunpodResponse(raw) {
|
|
203
|
+
if (!raw || typeof raw !== "object")
|
|
204
|
+
return null;
|
|
205
|
+
const r = raw;
|
|
206
|
+
const jobId = typeof r.id === "string" ? r.id : "";
|
|
207
|
+
const statusRaw = typeof r.status === "string" ? r.status : "";
|
|
208
|
+
if (!jobId || !statusRaw)
|
|
209
|
+
return null;
|
|
210
|
+
const knownStatuses = [
|
|
211
|
+
"IN_QUEUE",
|
|
212
|
+
"IN_PROGRESS",
|
|
213
|
+
"COMPLETED",
|
|
214
|
+
"FAILED",
|
|
215
|
+
"CANCELLED",
|
|
216
|
+
"TIMED_OUT",
|
|
217
|
+
];
|
|
218
|
+
const status = knownStatuses.includes(statusRaw)
|
|
219
|
+
? statusRaw
|
|
220
|
+
: "IN_PROGRESS"; // best-effort: keep the UI polling on unknown states
|
|
221
|
+
const view = { jobId, status, statusRaw };
|
|
222
|
+
if (r.output !== undefined)
|
|
223
|
+
view.output = r.output;
|
|
224
|
+
if (typeof r.error === "string" && r.error.length > 0)
|
|
225
|
+
view.error = r.error;
|
|
226
|
+
if (typeof r.executionTime === "number")
|
|
227
|
+
view.executionTimeMs = r.executionTime;
|
|
228
|
+
if (typeof r.delayTime === "number")
|
|
229
|
+
view.delayTimeMs = r.delayTime;
|
|
230
|
+
return view;
|
|
231
|
+
}
|
|
232
|
+
// ---------- Shared RunPod transport (retry + timeout) ----------
|
|
233
|
+
//
|
|
234
|
+
// All six RunPod call-sites (the four submitters + cancel + poll) used to be
|
|
235
|
+
// byte-identical fetch dispatchers differing only in method/payload and an
|
|
236
|
+
// error prefix -- exactly the copy-paste surface the v0.68.0 pretrained_loras
|
|
237
|
+
// divergence slipped through (issue #13). They share ONE transport now, so a
|
|
238
|
+
// reliability fix lands in a single place instead of six.
|
|
239
|
+
//
|
|
240
|
+
// Reliability: a transient failure (network error, per-attempt timeout, 429,
|
|
241
|
+
// or 5xx) is retried with bounded, jittered exponential backoff; a terminal
|
|
242
|
+
// 4xx is never retried (a malformed request will not get better). Each attempt
|
|
243
|
+
// is bounded by AbortSignal.timeout so a hung call cannot burn the Worker
|
|
244
|
+
// subrequest budget. Otherwise behavior is identical to the old per-call
|
|
245
|
+
// dispatchers: never throws, returns the normalized view or { ok:false, ... }.
|
|
246
|
+
// Default tunables. Three attempts total (two retries); 250ms base backoff
|
|
247
|
+
// doubling per attempt with full jitter; 30s per-attempt timeout.
|
|
248
|
+
const RUNPOD_MAX_ATTEMPTS = 3;
|
|
249
|
+
const RUNPOD_BACKOFF_BASE_MS = 250;
|
|
250
|
+
const RUNPOD_TIMEOUT_MS = 30_000;
|
|
251
|
+
// 429 (rate limited) and 5xx (server error) are worth retrying; everything
|
|
252
|
+
// else (4xx) is the caller's fault and will not improve on retry.
|
|
253
|
+
function isTransientStatus(status) {
|
|
254
|
+
return status === 429 || status >= 500;
|
|
255
|
+
}
|
|
256
|
+
const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
257
|
+
// Exponential backoff with full jitter: a random point in [0, base * 2^(n-1)]
|
|
258
|
+
// for 1-based attempt n. Full jitter de-synchronizes a herd of retrying
|
|
259
|
+
// Workers better than a fixed delay.
|
|
260
|
+
function backoffDelayMs(attempt, baseMs, random) {
|
|
261
|
+
const ceil = baseMs * 2 ** (attempt - 1);
|
|
262
|
+
return Math.floor(random() * ceil);
|
|
263
|
+
}
|
|
264
|
+
// The one transport every RunPod call goes through. Never throws: an env-config
|
|
265
|
+
// miss, a network/timeout error, a non-JSON body, or an HTTP error all come
|
|
266
|
+
// back as { ok:false, error, status? } for the route to translate. Retries a
|
|
267
|
+
// transient failure up to maxAttempts with jittered backoff; returns a terminal
|
|
268
|
+
// 4xx immediately.
|
|
269
|
+
export async function runpodRequest(env, spec, opts = {}) {
|
|
270
|
+
const apiKey = await secretValue(env.RUNPOD_API_KEY);
|
|
271
|
+
if (!apiKey) {
|
|
272
|
+
return {
|
|
273
|
+
ok: false,
|
|
274
|
+
error: "RUNPOD_API_KEY must be set on the Worker (Secrets Store binding or npx wrangler secret put)",
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
278
|
+
const sleep = opts.sleep ?? defaultSleep;
|
|
279
|
+
const random = opts.random ?? Math.random;
|
|
280
|
+
const maxAttempts = opts.maxAttempts ?? RUNPOD_MAX_ATTEMPTS;
|
|
281
|
+
const backoffBaseMs = opts.backoffBaseMs ?? RUNPOD_BACKOFF_BASE_MS;
|
|
282
|
+
const timeoutMs = opts.timeoutMs ?? RUNPOD_TIMEOUT_MS;
|
|
283
|
+
const headers = {
|
|
284
|
+
authorization: `Bearer ${apiKey}`,
|
|
285
|
+
};
|
|
286
|
+
if (spec.body !== undefined)
|
|
287
|
+
headers["content-type"] = "application/json";
|
|
288
|
+
// Carried across attempts so a final transient HTTP failure surfaces the
|
|
289
|
+
// status the route maps to an HTTP code (not just a bare message).
|
|
290
|
+
let lastTransientError = `RunPod ${spec.label} failed`;
|
|
291
|
+
let lastTransientStatus;
|
|
292
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
293
|
+
let resp;
|
|
294
|
+
try {
|
|
295
|
+
resp = await fetchImpl(spec.url, {
|
|
296
|
+
method: spec.method,
|
|
297
|
+
headers,
|
|
298
|
+
body: spec.body,
|
|
299
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
catch (err) {
|
|
303
|
+
// Network error or a per-attempt timeout (AbortSignal fires a
|
|
304
|
+
// TimeoutError) -- both transient.
|
|
305
|
+
const m = err instanceof Error ? err.message : String(err);
|
|
306
|
+
lastTransientError = `RunPod ${spec.label} network error: ${m}`;
|
|
307
|
+
lastTransientStatus = undefined;
|
|
308
|
+
if (attempt < maxAttempts) {
|
|
309
|
+
await sleep(backoffDelayMs(attempt, backoffBaseMs, random));
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
return { ok: false, error: lastTransientError };
|
|
313
|
+
}
|
|
314
|
+
// Retry a transient HTTP status (when attempts remain) without reading the
|
|
315
|
+
// body. On the final attempt fall through so the real error envelope is
|
|
316
|
+
// parsed and returned.
|
|
317
|
+
if (!resp.ok && isTransientStatus(resp.status) && attempt < maxAttempts) {
|
|
318
|
+
lastTransientError = `RunPod ${spec.label} failed: HTTP ${resp.status}`;
|
|
319
|
+
lastTransientStatus = resp.status;
|
|
320
|
+
await sleep(backoffDelayMs(attempt, backoffBaseMs, random));
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
let raw;
|
|
324
|
+
try {
|
|
325
|
+
raw = await resp.json();
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
const text = await resp.text().catch(() => "");
|
|
329
|
+
return {
|
|
330
|
+
ok: false,
|
|
331
|
+
error: `RunPod ${spec.label} returned non-JSON (status ${resp.status}): ${text.slice(0, 300)}`,
|
|
332
|
+
status: resp.status,
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
if (!resp.ok) {
|
|
336
|
+
const errStr = raw && typeof raw === "object" && "error" in raw
|
|
337
|
+
? String(raw.error)
|
|
338
|
+
: `HTTP ${resp.status}`;
|
|
339
|
+
return { ok: false, error: `RunPod ${spec.label} failed: ${errStr}`, status: resp.status };
|
|
340
|
+
}
|
|
341
|
+
const view = normalizeRunpodResponse(raw);
|
|
342
|
+
if (!view) {
|
|
343
|
+
return { ok: false, error: `RunPod ${spec.label} returned an unrecognized envelope` };
|
|
344
|
+
}
|
|
345
|
+
return { ok: true, view };
|
|
346
|
+
}
|
|
347
|
+
// Unreachable in practice (the loop always returns on its last iteration);
|
|
348
|
+
// present to satisfy the compiler and as a defensive fallback.
|
|
349
|
+
return { ok: false, error: lastTransientError, status: lastTransientStatus };
|
|
350
|
+
}
|
|
351
|
+
// A missing RUNPOD_ENDPOINT_ID is a fail-closed config error, surfaced in the SAME { ok:false }
|
|
352
|
+
// shape as the transport RUNPOD_API_KEY guard so a route translates one contract. #238.
|
|
353
|
+
function runpodMissingEndpoint() {
|
|
354
|
+
return {
|
|
355
|
+
ok: false,
|
|
356
|
+
error: "RUNPOD_ENDPOINT_ID must be set on the Worker (Secrets Store binding or npx wrangler secret put)",
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
// Submit a job to the vivijure-serverless RunPod endpoint. Returns the
|
|
360
|
+
// normalized view or a transport error. Does not throw on HTTP 4xx / 5xx; the
|
|
361
|
+
// caller decides how to translate to a Worker response. Optional opts inject a
|
|
362
|
+
// mock transport in tests.
|
|
363
|
+
export async function submitRenderJob(env, args, opts) {
|
|
364
|
+
const endpointId = await secretValue(env.RUNPOD_ENDPOINT_ID);
|
|
365
|
+
if (!endpointId)
|
|
366
|
+
return runpodMissingEndpoint();
|
|
367
|
+
return runpodRequest(env, {
|
|
368
|
+
method: "POST",
|
|
369
|
+
url: buildSubmitUrl(endpointId),
|
|
370
|
+
body: JSON.stringify(buildSubmitPayload(args)),
|
|
371
|
+
label: "submit",
|
|
372
|
+
}, opts);
|
|
373
|
+
}
|
|
374
|
+
// v0.42.0: submit a finalize job. Same transport contract as submitRenderJob.
|
|
375
|
+
export async function submitFinalizeJob(env, args, opts) {
|
|
376
|
+
const endpointId = await secretValue(env.RUNPOD_ENDPOINT_ID);
|
|
377
|
+
if (!endpointId)
|
|
378
|
+
return runpodMissingEndpoint();
|
|
379
|
+
return runpodRequest(env, {
|
|
380
|
+
method: "POST",
|
|
381
|
+
url: buildSubmitUrl(endpointId),
|
|
382
|
+
body: JSON.stringify(buildFinalizePayload(args)),
|
|
383
|
+
label: "finalize submit",
|
|
384
|
+
}, opts);
|
|
385
|
+
}
|
|
386
|
+
// v0.41.0: submit a per-shot regen job. Hits the same /v2/<endpointId>/run;
|
|
387
|
+
// the GPU side dispatches by action.
|
|
388
|
+
export async function submitRegenShotJob(env, args, opts) {
|
|
389
|
+
const endpointId = await secretValue(env.RUNPOD_ENDPOINT_ID);
|
|
390
|
+
if (!endpointId)
|
|
391
|
+
return runpodMissingEndpoint();
|
|
392
|
+
return runpodRequest(env, {
|
|
393
|
+
method: "POST",
|
|
394
|
+
url: buildSubmitUrl(endpointId),
|
|
395
|
+
body: JSON.stringify(buildRegenShotPayload(args)),
|
|
396
|
+
label: "regen submit",
|
|
397
|
+
}, opts);
|
|
398
|
+
}
|
|
399
|
+
// v0.57.0: submit a standalone LoRA training job. Differs only in the payload
|
|
400
|
+
// builder.
|
|
401
|
+
export async function submitTrainLoraJob(env, args, opts) {
|
|
402
|
+
const endpointId = await secretValue(env.RUNPOD_ENDPOINT_ID);
|
|
403
|
+
if (!endpointId)
|
|
404
|
+
return runpodMissingEndpoint();
|
|
405
|
+
return runpodRequest(env, {
|
|
406
|
+
method: "POST",
|
|
407
|
+
url: buildSubmitUrl(endpointId),
|
|
408
|
+
body: JSON.stringify(buildTrainLoraPayload(args)),
|
|
409
|
+
label: "train-lora submit",
|
|
410
|
+
}, opts);
|
|
411
|
+
}
|
|
412
|
+
// Cancel one job. RunPod's cancel endpoint is POST /v2/<id>/cancel/<job>; we
|
|
413
|
+
// expose it under our DELETE /api/storyboard/render/<jobId> route. Calling
|
|
414
|
+
// cancel on a job that is already terminal (or never existed) returns RunPod's
|
|
415
|
+
// error envelope, which we surface verbatim.
|
|
416
|
+
export async function cancelRenderJob(env, jobId, opts) {
|
|
417
|
+
const endpointId = await secretValue(env.RUNPOD_ENDPOINT_ID);
|
|
418
|
+
if (!endpointId)
|
|
419
|
+
return runpodMissingEndpoint();
|
|
420
|
+
return runpodRequest(env, {
|
|
421
|
+
method: "POST",
|
|
422
|
+
url: buildCancelUrl(endpointId, jobId),
|
|
423
|
+
label: "cancel",
|
|
424
|
+
}, opts);
|
|
425
|
+
}
|
|
426
|
+
// Poll one job's status.
|
|
427
|
+
export async function pollRenderJob(env, jobId, opts) {
|
|
428
|
+
const endpointId = await secretValue(env.RUNPOD_ENDPOINT_ID);
|
|
429
|
+
if (!endpointId)
|
|
430
|
+
return runpodMissingEndpoint();
|
|
431
|
+
return runpodRequest(env, {
|
|
432
|
+
method: "GET",
|
|
433
|
+
url: buildStatusUrl(endpointId, jobId),
|
|
434
|
+
label: "poll",
|
|
435
|
+
}, opts);
|
|
436
|
+
}
|
|
437
|
+
// Pod returns snake_case; normalize to the camelCase Worker shape. Returns
|
|
438
|
+
// null on a shape that is not a recognizable beat plan (no valid `mode`).
|
|
439
|
+
export function parseAudioBeatPlan(raw) {
|
|
440
|
+
if (!raw || typeof raw !== "object")
|
|
441
|
+
return null;
|
|
442
|
+
const r = raw;
|
|
443
|
+
const mode = r.mode === "beat" || r.mode === "duration" ? r.mode : null;
|
|
444
|
+
if (!mode)
|
|
445
|
+
return null;
|
|
446
|
+
return {
|
|
447
|
+
mode,
|
|
448
|
+
audioKey: String(r.audio_key ?? ""),
|
|
449
|
+
durationSeconds: Number(r.duration_seconds ?? 0),
|
|
450
|
+
bpm: typeof r.bpm === "number" ? r.bpm : undefined,
|
|
451
|
+
beatCount: typeof r.beat_count === "number" ? r.beat_count : undefined,
|
|
452
|
+
suggestedShots: Number(r.suggested_shots ?? 0),
|
|
453
|
+
clipSeconds: Number(r.clip_seconds ?? 0),
|
|
454
|
+
filmSeconds: Number(r.film_seconds ?? 0),
|
|
455
|
+
remainderSeconds: Number(r.remainder_seconds ?? 0),
|
|
456
|
+
timedScenes: Array.isArray(r.timed_scenes)
|
|
457
|
+
? r.timed_scenes
|
|
458
|
+
.filter((s) => !!s && typeof s === "object")
|
|
459
|
+
.map((s) => ({
|
|
460
|
+
index: Number(s.index ?? 0),
|
|
461
|
+
start: Number(s.start ?? 0),
|
|
462
|
+
end: Number(s.end ?? 0),
|
|
463
|
+
targetSeconds: Number(s.target_seconds ?? 0),
|
|
464
|
+
}))
|
|
465
|
+
: [],
|
|
466
|
+
note: String(r.note ?? ""),
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
//# sourceMappingURL=runpod-submit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runpod-submit.js","sourceRoot":"","sources":["../src/runpod-submit.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,2EAA2E;AAC3E,wEAAwE;AACxE,2EAA2E;AAC3E,yEAAyE;AACzE,4DAA4D;AAC5D,EAAE;AACF,2EAA2E;AAC3E,6CAA6C;AAC7C,EAAE;AACF,kEAAkE;AAClE,8CAA8C;AAC9C,+EAA+E;AAC/E,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AAGxE,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAEzE,mFAAmF;AACnF,qFAAqF;AACrF,yFAAyF;AACzF,4FAA4F;AAC5F,yFAAyF;AACzF,uFAAuF;AACvF,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAAC,CAAU;IAC1C,IAAI,CAAC,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IAClC,IAAI,CAAC,KAAK,UAAU;QAAE,OAAO,UAAU,CAAC;IACxC,IAAI,CAAC,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IAClC,OAAO,SAAS,CAAC;AACnB,CAAC;AAmKD,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,uEAAuE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sources":["../src/runpod-types.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,8DAA8D;AAE9D,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scatter-notify.d.ts","sourceRoot":"","sources":["../src/scatter-notify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oCAAoC,CAAC;AAK9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAGlE,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCnF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Best-effort notify on scatter gather completion (mirrors film-orchestrator fireNotify).
|
|
2
|
+
import { discoverModules, invokeModule, resolveFetcher, servingForHook, validateConfig } from "./modules/registry.js";
|
|
3
|
+
import { loadInstallConfig } from "./operator-config.js";
|
|
4
|
+
import { presignR2Get, FILM_DOWNLOAD_TTL_SECONDS } from "./presign.js";
|
|
5
|
+
export async function fireNotifyForScatter(env, job) {
|
|
6
|
+
if (!job.film_key)
|
|
7
|
+
return;
|
|
8
|
+
try {
|
|
9
|
+
const envRec = env;
|
|
10
|
+
const notifiers = servingForHook(await discoverModules(envRec), "notify");
|
|
11
|
+
if (!notifiers.length)
|
|
12
|
+
return;
|
|
13
|
+
const download_url = await presignR2Get(env, job.film_key, FILM_DOWNLOAD_TTL_SECONDS);
|
|
14
|
+
const input = {
|
|
15
|
+
event: "render.complete",
|
|
16
|
+
film_id: job.scatter_id,
|
|
17
|
+
project: job.project,
|
|
18
|
+
download_url,
|
|
19
|
+
};
|
|
20
|
+
const context = { project: job.project, job_id: job.scatter_id };
|
|
21
|
+
for (const m of notifiers) {
|
|
22
|
+
const fetcher = resolveFetcher(envRec, m.binding);
|
|
23
|
+
if (!fetcher)
|
|
24
|
+
continue;
|
|
25
|
+
try {
|
|
26
|
+
// Inject the operator-set install-config (e.g. notify-email's notify_email recipient) as the
|
|
27
|
+
// user config, then clamp through the contract; render-scope fields stay at their defaults.
|
|
28
|
+
const installConfig = await loadInstallConfig(env, m.name, m.config_schema);
|
|
29
|
+
await invokeModule(fetcher, {
|
|
30
|
+
hook: "notify",
|
|
31
|
+
input,
|
|
32
|
+
config: validateConfig(m.config_schema ?? {}, installConfig),
|
|
33
|
+
context,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch { /* best-effort */ }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.warn(`scatter notify failed for ${job.scatter_id}: ${e.message}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=scatter-notify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scatter-notify.js","sourceRoot":"","sources":["../src/scatter-notify.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAG1F,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAIvE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,GAAQ,EAAE,GAAe;IAClE,IAAI,CAAC,GAAG,CAAC,QAAQ;QAAE,OAAO;IAC1B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,GAAyC,CAAC;QACzD,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,eAAe,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC1E,IAAI,CAAC,SAAS,CAAC,MAAM;YAAE,OAAO;QAC9B,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,yBAAyB,CAAC,CAAC;QACtF,MAAM,KAAK,GAAgB;YACzB,KAAK,EAAE,iBAAiB;YACxB,OAAO,EAAE,GAAG,CAAC,UAAU;YACvB,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,YAAY;SACb,CAAC;QACF,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;QACjE,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;YAC1B,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;YAClD,IAAI,CAAC,OAAO;gBAAE,SAAS;YACvB,IAAI,CAAC;gBACH,6FAA6F;gBAC7F,4FAA4F;gBAC5F,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC;gBAC5E,MAAM,YAAY,CAA4B,OAAO,EAAE;oBACrD,IAAI,EAAE,QAAQ;oBACd,KAAK;oBACL,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,aAAa,IAAI,EAAE,EAAE,aAAa,CAAC;oBAC5D,OAAO;iBACR,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,6BAA6B,GAAG,CAAC,UAAU,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface ScatterJob {
|
|
2
|
+
scatter_id: string;
|
|
3
|
+
project: string;
|
|
4
|
+
bundle_key: string;
|
|
5
|
+
quality_tier: "draft" | "standard" | "final";
|
|
6
|
+
expected_shot_ids: string[];
|
|
7
|
+
actual_clip_durations?: Record<string, number>;
|
|
8
|
+
shard_film_ids: string[];
|
|
9
|
+
shard_shots: string[][];
|
|
10
|
+
motion_backend?: string;
|
|
11
|
+
audio_key?: string;
|
|
12
|
+
has_dialogue?: boolean;
|
|
13
|
+
scenes?: {
|
|
14
|
+
shot_id: string;
|
|
15
|
+
prompt: string;
|
|
16
|
+
seconds: number;
|
|
17
|
+
}[];
|
|
18
|
+
dialogue_lines?: {
|
|
19
|
+
shot_id: string;
|
|
20
|
+
text: string;
|
|
21
|
+
voice_id?: string;
|
|
22
|
+
}[];
|
|
23
|
+
film_titles?: {
|
|
24
|
+
title?: {
|
|
25
|
+
text: string;
|
|
26
|
+
subtitle?: string;
|
|
27
|
+
};
|
|
28
|
+
credits?: {
|
|
29
|
+
lines: string[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
film_finish_config?: Record<string, Record<string, unknown>>;
|
|
33
|
+
film_finish?: {
|
|
34
|
+
applied: string[];
|
|
35
|
+
adopted?: string[];
|
|
36
|
+
errors: string[];
|
|
37
|
+
steps?: string[];
|
|
38
|
+
degraded?: string;
|
|
39
|
+
sidecar_key?: string;
|
|
40
|
+
};
|
|
41
|
+
film_finish_dispatched?: Record<string, number>;
|
|
42
|
+
film_finish_polls?: Record<string, string>;
|
|
43
|
+
film_finish_prepend?: Record<string, number>;
|
|
44
|
+
film_finish_attempts?: Record<string, number>;
|
|
45
|
+
project_id?: number | null;
|
|
46
|
+
render_overrides?: Record<string, unknown>;
|
|
47
|
+
phase: "shards" | "gather" | "mux" | "done" | "failed";
|
|
48
|
+
film_key?: string;
|
|
49
|
+
silent_film_key?: string;
|
|
50
|
+
mux_output_key?: string;
|
|
51
|
+
assemble_attempts?: number;
|
|
52
|
+
error?: string;
|
|
53
|
+
created_at: number;
|
|
54
|
+
cancelled?: boolean;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=scatter-orchestrator-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scatter-orchestrator-types.d.ts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