videobook 0.3.0 → 0.3.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.
- package/CHANGELOG.md +73 -0
- package/dist/asset-media-projection.js +161 -0
- package/dist/command-reference.js +3 -1
- package/dist/diagnostics.js +1 -1
- package/dist/generation-reference-mentions.js +19 -0
- package/dist/goal-plan-v3.js +11 -1
- package/dist/goal-plan.js +1 -1
- package/dist/goal-store.js +2 -2
- package/dist/har-capture.js +36 -3
- package/dist/jobs/_image-edit-adapter.js +2 -0
- package/dist/jobs/assess-media-probes.js +94 -0
- package/dist/jobs/complete-provider-task.js +2 -5
- package/dist/jobs/generate-media.js +3 -2
- package/dist/jobs/image-subjects.js +2 -0
- package/dist/jobs/kie-paygate.js +3 -3
- package/dist/jobs/register-all.js +2 -0
- package/dist/jobs/run-notebook.js +16 -1
- package/dist/library-asset-projection.js +141 -0
- package/dist/lightning-defaults.js +4 -4
- package/dist/media/catalog.js +8 -2
- package/dist/media/descriptor.js +7 -4
- package/dist/media/frontier-gaps.js +0 -1
- package/dist/media/har-endpoint.js +25 -0
- package/dist/media/json-schema.js +3 -0
- package/dist/media/preferred-defaults.js +161 -0
- package/dist/media/prompt-dialects.js +9 -1
- package/dist/media-library.js +158 -153
- package/dist/notebook-sticky-settings.js +60 -0
- package/dist/tools/reconcile-project-work.js +34 -181
- package/dist/tools/videobook-domain.js +16 -1
- package/dist/usage-providers.js +3 -3
- package/package.json +15 -15
- package/ui/assets/{alive-captions-Cj8C1tCN.js → alive-captions-CnLK22ED.js} +1 -1
- package/ui/assets/confirm-bodies-BaalBxp1.js +1 -0
- package/ui/assets/{fullscreen-DyEncSdm.js → fullscreen-DTJQJ6dX.js} +1 -1
- package/ui/assets/{goal-ui-BdFeoSWh.js → goal-ui-CN-kZTEO.js} +1 -1
- package/ui/assets/index-CTPstLYq.css +1 -0
- package/ui/assets/index-Dp81yChE.js +37 -0
- package/ui/assets/inspector-jeyma7HL.js +1 -0
- package/ui/assets/{jobs-ui-BudI4w0r.js → jobs-ui-D6S3LJ4j.js} +1 -1
- package/ui/assets/{music-video-CT4C55ok.js → music-video-CDqr0X6G.js} +1 -1
- package/ui/assets/{ui-mq0uIS5P.css → ui-BBM3YCY6.css} +1 -1
- package/ui/assets/ui-Cqs1-YNg.js +2 -0
- package/ui/assets/vendor-BWf-WCsY.js +19 -0
- package/ui/assets/{vendor-flow-nqTFQmTh.js → vendor-flow-DPvi8ynA.js} +1 -1
- package/ui/assets/vendor-icons-D3KrGMJY.js +1 -0
- package/ui/assets/{vendor-mcp-D_C3EZPv.js → vendor-mcp-BSR9acpG.js} +2 -2
- package/ui/assets/videobook-b9VODNOA.js +21 -0
- package/ui/index.html +14 -14
- package/ui/assets/confirm-bodies-BxWXwDf0.js +0 -1
- package/ui/assets/index-DWfR79lA.css +0 -1
- package/ui/assets/index-QZ8lbemN.js +0 -37
- package/ui/assets/inspector-BC6xWkJU.js +0 -1
- package/ui/assets/ui-z5r-p0K9.js +0 -2
- package/ui/assets/vendor-D8XcMav4.js +0 -19
- package/ui/assets/vendor-icons-CGqhCIXV.js +0 -1
- package/ui/assets/videobook-CsW453sb.js +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,79 @@ and the package uses [Semantic Versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.3.1] - 2026-10-25
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- KIE Kling 4.0 reference-to-video and keyframe-to-video, 3 to 30 seconds at
|
|
14
|
+
720p or 1080p. Reference-to-video takes up to ten images and five videos,
|
|
15
|
+
and generates from the prompt alone when none are connected. Keyframe-to-video
|
|
16
|
+
takes a first frame, up to eight middle keyframes and a last frame, as many
|
|
17
|
+
as the duration allows. Prompts name connected media the way Kling 4.0 does:
|
|
18
|
+
`@image_1`, `@video_1`, `@first_frame`, `@keyframe_1` and `@last_frame`.
|
|
19
|
+
- KIE PixVerse V6 Max text-to-video and image-to-video, 1 to 15 seconds at
|
|
20
|
+
360p to 1080p, with optional generated audio and a seed. Image-to-video
|
|
21
|
+
follows the image's aspect ratio.
|
|
22
|
+
- KIE OmniHuman 2.0, which animates one image to a driving audio track at 720p
|
|
23
|
+
for as long as the audio runs, with an optional prompt of up to 300
|
|
24
|
+
characters. KIE's watermark stays on by default (`enable_watermark`).
|
|
25
|
+
- The KIE Grok Imagine Video 1.5 preview, the KIE Grok Imagine endpoint that
|
|
26
|
+
takes first and last frames, a loop image (`loop_url`) and up to four timed
|
|
27
|
+
`keyframes`. It shares the Grok Imagine Video 1.5 image-to-video frontier
|
|
28
|
+
ranking. Kling 4.0, PixVerse V6 Max and OmniHuman 2.0 are on no top-10 board
|
|
29
|
+
and appear in the unranked group.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- Upgrade all `@apicity/*` dependencies to 0.18.1, which prices the new KIE
|
|
34
|
+
models. Its endpoint catalog now lists fal `v1.queue.status` and
|
|
35
|
+
`v1.queue.result`, with the other fal SDK methods written as method
|
|
36
|
+
shorthand, so `apicity har report` from `@apicity/cli` 0.18.1 can resolve the
|
|
37
|
+
fal polling captures Videobook writes. The requests sent to fal are
|
|
38
|
+
unchanged.
|
|
39
|
+
- Image and video models default to a 12-second duration (or the nearest
|
|
40
|
+
allowed length), a 9:16 aspect ratio and their highest resolution, quality
|
|
41
|
+
and bitrate. Each notebook remembers the last duration, aspect ratio,
|
|
42
|
+
resolution and quality a cell used, and applies them to new cells and model
|
|
43
|
+
switches. Goals saved before this change keep their 2K scene; new goals use
|
|
44
|
+
4K.
|
|
45
|
+
- On desktop, Settings shows AI providers in one column and accounts, storage
|
|
46
|
+
and diagnostics in another; on phones the columns stack behind section jump
|
|
47
|
+
buttons. The chat input stays a plain bar on Settings.
|
|
48
|
+
- The Library opens from an Assets button in the notebook toolbar instead of
|
|
49
|
+
the header, and Arrange is renamed Clean.
|
|
50
|
+
- Library browsing pages assets before building their rows and no longer runs
|
|
51
|
+
ffprobe while listing; proxy checks and duration backfills run as background
|
|
52
|
+
jobs.
|
|
53
|
+
- A Post can take its published link without being saved to iPhone or Dropbox
|
|
54
|
+
first.
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- HAR captures of KIE's nested Veo and Suno SDK calls are named by their
|
|
59
|
+
apicity catalog dot paths, such as `api.v1.veo.generate` and
|
|
60
|
+
`api.v1.generate.sounds`, instead of their SDK paths, so `apicity har report`
|
|
61
|
+
resolves them. Sub-provider prefixes that are URL segments stay:
|
|
62
|
+
`kie.claude.post.v1.messages` is named `claude.v1.messages`.
|
|
63
|
+
- A generation that fails before reaching its provider, such as a request the
|
|
64
|
+
schema refuses, is captured under the provider's catalog endpoint, and fal,
|
|
65
|
+
Alibaba and KIE file uploads are captured as `storage.upload.initiate`,
|
|
66
|
+
`api.v1.uploads` and `api.fileStreamUpload`, so `apicity har report` resolves
|
|
67
|
+
them.
|
|
68
|
+
- A notebook generation whose provider fails after accepting the request now
|
|
69
|
+
marks its plan failed with the provider error. `list_notebook_generation_plans`
|
|
70
|
+
and the Jobs screen kept reporting such plans as awaiting output.
|
|
71
|
+
- v3 goals saved with a 2K scene load again and keep that resolution when they
|
|
72
|
+
are edited, approved or retried.
|
|
73
|
+
- Image subject edits check the provider key before uploading the source image,
|
|
74
|
+
so a missing or placeholder key no longer sends the image to a public file
|
|
75
|
+
host for a request that cannot run.
|
|
76
|
+
- Settings loads when the page opens on it, or when it opens before the MCP
|
|
77
|
+
connection is ready.
|
|
78
|
+
- The multyculty workflow and video poster recovery tests no longer time out on
|
|
79
|
+
loaded hosts, and the chat-composer browser test no longer reads the runner's
|
|
80
|
+
`.env` or provider keys and matches the ranked model picker.
|
|
81
|
+
|
|
9
82
|
## [0.3.0] - 2026-10-24
|
|
10
83
|
|
|
11
84
|
### Added
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { findAudioFile, findPrimaryMediaFile, findVideoFile } from "videobook-engine";
|
|
3
|
+
import { logger } from "./logger.js";
|
|
4
|
+
import { queue } from "./queue.js";
|
|
5
|
+
import { scheduleMediaDurationBackfill, scheduleVideoProxyAssessment, } from "./jobs/assess-media-probes.js";
|
|
6
|
+
import { videoProxyAssessmentMatches, videoProxyMetadataMatches, } from "./video-proxy.js";
|
|
7
|
+
export const PARTIAL_DOWNLOAD_RE = /\.(mp4|mov)\.part$/i;
|
|
8
|
+
const DURATION_PROBE_EXT_RE = /\.(mp4|mov|webm|mkv|mp3|wav|m4a|aac|ogg|flac)$/i;
|
|
9
|
+
const IMAGE_FILE_RE = /\.(jpg|jpeg|png|webp|gif)$/i;
|
|
10
|
+
export function findAssetMediaFile(files, asset) {
|
|
11
|
+
return asset.kind === "audio"
|
|
12
|
+
? findAudioFile(files, asset.kind)
|
|
13
|
+
: asset.kind === "video"
|
|
14
|
+
? findVideoFile(files.filter((file) => file.name !== "proxy.mp4"))
|
|
15
|
+
: findPrimaryMediaFile(files, asset.kind);
|
|
16
|
+
}
|
|
17
|
+
// Content fingerprint for cache-busting media URLs. Pure function of the
|
|
18
|
+
// manifest tuples; partial downloads are excluded because their size grows on
|
|
19
|
+
// every poll while no served URL points at them.
|
|
20
|
+
function computeAssetFingerprint(files) {
|
|
21
|
+
const settled = files.filter((f) => !PARTIAL_DOWNLOAD_RE.test(f.name));
|
|
22
|
+
if (settled.length === 0)
|
|
23
|
+
return "";
|
|
24
|
+
const sorted = [...settled].sort((a, b) => a.name.localeCompare(b.name));
|
|
25
|
+
const hash = createHash("sha1");
|
|
26
|
+
for (const f of sorted) {
|
|
27
|
+
hash.update(f.name);
|
|
28
|
+
hash.update("\0");
|
|
29
|
+
hash.update(String(f.sizeBytes ?? 0));
|
|
30
|
+
hash.update("\0");
|
|
31
|
+
hash.update(f.objectHash);
|
|
32
|
+
hash.update("\0");
|
|
33
|
+
}
|
|
34
|
+
return hash.digest("hex").slice(0, 12);
|
|
35
|
+
}
|
|
36
|
+
export function indexByArtifactId(rows) {
|
|
37
|
+
const map = new Map();
|
|
38
|
+
for (const row of rows)
|
|
39
|
+
map.set(row.artifactId, row);
|
|
40
|
+
return map;
|
|
41
|
+
}
|
|
42
|
+
export function groupByArtifactId(rows) {
|
|
43
|
+
const map = new Map();
|
|
44
|
+
for (const row of rows) {
|
|
45
|
+
const list = map.get(row.artifactId);
|
|
46
|
+
if (list)
|
|
47
|
+
list.push(row);
|
|
48
|
+
else
|
|
49
|
+
map.set(row.artifactId, [row]);
|
|
50
|
+
}
|
|
51
|
+
return map;
|
|
52
|
+
}
|
|
53
|
+
function streamSeconds(stream) {
|
|
54
|
+
return stream.durationTicks * stream.timeBase.numerator / stream.timeBase.denominator;
|
|
55
|
+
}
|
|
56
|
+
export function assetStreamProfile(streams, meta) {
|
|
57
|
+
const videoStream = streams.find((stream) => stream.kind === "video" && stream.video);
|
|
58
|
+
const audioStream = streams.find((stream) => stream.kind === "audio" && stream.audio);
|
|
59
|
+
const frameRate = videoStream?.video?.averageFrameRate
|
|
60
|
+
?? videoStream?.video?.nominalFrameRate;
|
|
61
|
+
const streamDuration = videoStream ? streamSeconds(videoStream) : 0;
|
|
62
|
+
const metadataDuration = Number(meta?.duration);
|
|
63
|
+
const sourceDuration = streamDuration > 0
|
|
64
|
+
? streamDuration
|
|
65
|
+
: Number.isFinite(metadataDuration) ? metadataDuration : 0;
|
|
66
|
+
const sourceProfile = sourceDuration > 0
|
|
67
|
+
? {
|
|
68
|
+
videoDuration: sourceDuration,
|
|
69
|
+
avgFps: frameRate ? frameRate.numerator / frameRate.denominator : null,
|
|
70
|
+
hasAudio: audioStream !== undefined || meta?.hasAudio === true,
|
|
71
|
+
}
|
|
72
|
+
: null;
|
|
73
|
+
return { videoStream, audioStream, frameRate, sourceProfile };
|
|
74
|
+
}
|
|
75
|
+
function isActiveWork(work) {
|
|
76
|
+
return work !== null && (work.status === "pending" || work.status === "working");
|
|
77
|
+
}
|
|
78
|
+
export function servedVideoProxyFile(input) {
|
|
79
|
+
if (input.artifact.kind !== "video" || !input.mediaFile)
|
|
80
|
+
return null;
|
|
81
|
+
const proxyFile = input.files.find((file) => file.name === "proxy.mp4");
|
|
82
|
+
if (!proxyFile)
|
|
83
|
+
return null;
|
|
84
|
+
const metadata = input.proxyMetadata;
|
|
85
|
+
if (metadata.ok && videoProxyMetadataMatches(metadata.value, input.mediaFile, proxyFile)) {
|
|
86
|
+
return proxyFile;
|
|
87
|
+
}
|
|
88
|
+
const assessed = metadata.ok
|
|
89
|
+
&& videoProxyAssessmentMatches(metadata.value, input.mediaFile, proxyFile);
|
|
90
|
+
if (!assessed && !isActiveWork(input.work) && input.sourceProfile) {
|
|
91
|
+
scheduleVideoProxyAssessment({
|
|
92
|
+
bookId: input.bookId,
|
|
93
|
+
artifactId: input.artifact.artifactId,
|
|
94
|
+
sourceFile: input.mediaFile,
|
|
95
|
+
proxyFile,
|
|
96
|
+
sourceProfile: input.sourceProfile,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
export function assetDuration(input) {
|
|
102
|
+
const stored = input.meta?.duration;
|
|
103
|
+
if (typeof stored === "number")
|
|
104
|
+
return stored;
|
|
105
|
+
const stream = input.profile.videoStream ?? input.profile.audioStream;
|
|
106
|
+
const measured = stream ? streamSeconds(stream) : 0;
|
|
107
|
+
if (measured > 0)
|
|
108
|
+
return measured;
|
|
109
|
+
if (input.meta && input.mediaFile && DURATION_PROBE_EXT_RE.test(input.mediaFile.name)) {
|
|
110
|
+
scheduleMediaDurationBackfill({
|
|
111
|
+
bookId: input.bookId,
|
|
112
|
+
artifactId: input.artifactId,
|
|
113
|
+
mediaFile: input.mediaFile,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
function mediaCacheBust(kind, files, mediaFile) {
|
|
119
|
+
if (kind === "video" || kind === "image") {
|
|
120
|
+
const fingerprint = computeAssetFingerprint(files);
|
|
121
|
+
return fingerprint ? `?v=${fingerprint}` : "";
|
|
122
|
+
}
|
|
123
|
+
const mediaHash = mediaFile?.objectHash;
|
|
124
|
+
return mediaHash ? `?v=${mediaHash.slice(0, 12)}` : "";
|
|
125
|
+
}
|
|
126
|
+
export function assetMediaUrls(input) {
|
|
127
|
+
const { artifact, files } = input;
|
|
128
|
+
const base = `/files/${input.bookId}/${artifact.artifactId}`;
|
|
129
|
+
const cacheBust = mediaCacheBust(artifact.kind, files, input.mediaFile);
|
|
130
|
+
const characterImage = artifact.kind === "character"
|
|
131
|
+
? files.find((file) => IMAGE_FILE_RE.test(file.name)) ?? null
|
|
132
|
+
: null;
|
|
133
|
+
const served = characterImage ?? input.proxyFile ?? input.mediaFile;
|
|
134
|
+
const media_url = served ? `${base}/${served.name}${cacheBust}` : null;
|
|
135
|
+
if (characterImage)
|
|
136
|
+
return { media_url, thumbnail_url: media_url };
|
|
137
|
+
const hasThumbnail = files.some((file) => file.name === "original.jpg");
|
|
138
|
+
const thumbnail_url = hasThumbnail
|
|
139
|
+
? `${base}/original.jpg${cacheBust}`
|
|
140
|
+
: artifact.kind === "image" ? media_url : null;
|
|
141
|
+
return { media_url, thumbnail_url };
|
|
142
|
+
}
|
|
143
|
+
export async function scheduleMissingVideoPoster(engine, input) {
|
|
144
|
+
const { artifact, mediaFile } = input;
|
|
145
|
+
if (artifact.kind !== "video" || input.status !== "ready" || !mediaFile)
|
|
146
|
+
return;
|
|
147
|
+
if (input.files.some((file) => file.name === "original.jpg"))
|
|
148
|
+
return;
|
|
149
|
+
const recovery = await engine.metadata.artifacts.read(artifact.artifactId, "poster-recovery");
|
|
150
|
+
if (recovery.ok && recovery.value.failed && recovery.value.sourceHash === mediaFile.objectHash)
|
|
151
|
+
return;
|
|
152
|
+
void queue.enqueue(`extract-video-poster-${input.bookId}-${artifact.artifactId}-${mediaFile.objectHash}`, {
|
|
153
|
+
type: "extract_video_poster",
|
|
154
|
+
bookId: input.bookId,
|
|
155
|
+
posterArtifactId: artifact.artifactId,
|
|
156
|
+
sourceFilename: mediaFile.name,
|
|
157
|
+
sourceHash: mediaFile.objectHash,
|
|
158
|
+
}).catch((error) => {
|
|
159
|
+
logger.error("poster-enqueue-failed", { assetId: artifact.artifactId, error });
|
|
160
|
+
});
|
|
161
|
+
}
|
|
@@ -90,7 +90,7 @@ export function renderGenerationModels() {
|
|
|
90
90
|
|
|
91
91
|
Generated by \`npm run docs:commands\` from the media catalog (\`server/src/media/catalog.ts\`). Call \`generate_image\`, \`generate_video\` or \`generate_audio\` with one of these model ids; \`list_generation_models\` returns the same list with every option, enum, range and default read from the apicity schemas.
|
|
92
92
|
|
|
93
|
-
Image and video pickers rank exact catalog endpoints using the committed top-10 snapshots in @apicity/cost 0.
|
|
93
|
+
Image and video pickers rank exact catalog endpoints using the committed top-10 snapshots in @apicity/cost 0.18.1, originally sourced from Artificial Analysis. No leaderboard is fetched at runtime. Rankings are per operation: t2i, i2i, t2v, i2v, v2v, and r2v (derived from the text/image-to-video boards). Each ranked option shows rank, Elo, and a bundled price label; prices are indicative ranges, not a quote for the selected settings.
|
|
94
94
|
|
|
95
95
|
Configured frontier models appear first; other models retain their existing order in a separate group. Providers without credentials are marked unavailable. Saved selections and defaults stay unchanged. Catalog variants on a frontier board are included even if previously hidden; non-frontier hidden variants remain hidden. A model version or lite variant never inherits another endpoint's score.
|
|
96
96
|
|
|
@@ -98,6 +98,8 @@ Kling 4 supports text, frames, references and video editing; it appears in the u
|
|
|
98
98
|
|
|
99
99
|
HeyGen Avatar 3 and 4 digital twins are text-to-video with a stock avatar (Abigail Office Front) and voice (Ivy); the prompt is the spoken script. Avatar 5 uses the SDK defaults Abigail Sofa Front and Warm Pro Narrator. Avatar 4 image-to-video animates an image with the script and defaults to Ivy. Connected audio overrides speech synthesis. Video Agent v2 and v3 accept a production prompt. HeyGen lipsync, translation, filler-word removal, HeyGen Voice TTS and Ideogram vector endpoints are outside this catalog addition.
|
|
100
100
|
|
|
101
|
+
Kie Kling 4.0 reference-to-video and keyframe-to-video, PixVerse V6 Max text-to-video and image-to-video, and OmniHuman 2.0 are on no top-10 board, so they appear in the unranked group. Kling 4.0 prompts name connected media as Kling 4.0 documents them: \`@image_1\` and \`@video_1\` for references, \`@first_frame\`, \`@keyframe_1\` and \`@last_frame\` for frames; with no media connected, both endpoints generate from the prompt alone. PixVerse V6 Max image-to-video follows the image's aspect ratio. OmniHuman 2.0 renders as long as its driving audio. The Kie Grok Imagine Video 1.5 preview takes first and last frames, a loop image (\`loop_url\`) and up to four timed \`keyframes\`, and shares the Grok Imagine Video 1.5 image-to-video ranking.
|
|
102
|
+
|
|
101
103
|
Top-10 coverage policy: every registry endpoint must map exactly to a catalog entry or appear in the known gaps below. Models with no provider endpoint in the registry: ${unmapped.join(", ")}. Catalog gaps do not imply provider API support is missing; adding those endpoints is separate work.
|
|
102
104
|
|
|
103
105
|
| Known endpoint gap | Reason |
|
package/dist/diagnostics.js
CHANGED
|
@@ -14,7 +14,7 @@ const EVENTS = [
|
|
|
14
14
|
"process-video-enqueue-failed", "waveform-write-failed", "timeline-reencode",
|
|
15
15
|
"pad-video-started", "video-analysis-failed", "description-truncated",
|
|
16
16
|
"description-cache-failed", "watermark-placement-fallback", "waveform-enqueue-failed",
|
|
17
|
-
"poster-enqueue-failed",
|
|
17
|
+
"poster-enqueue-failed", "proxy-assessment-enqueue-failed", "duration-backfill-enqueue-failed",
|
|
18
18
|
"watermark-probe-fallback", "generation-error-clear-failed", "timeline-orientation-failed",
|
|
19
19
|
"generation-cost-estimate", "job-error", "semantic-index-deferred",
|
|
20
20
|
"tag-asset-failed", "voice-session-closed", "alive-captions-regions-failed",
|
|
@@ -65,6 +65,25 @@ export function rewriteSeedanceAssetMentions(prompt, refs) {
|
|
|
65
65
|
}
|
|
66
66
|
return replaceNotebookMentions(prompt, replacements);
|
|
67
67
|
}
|
|
68
|
+
function numberedMentions(refs, marker) {
|
|
69
|
+
return refMentionEntries(refs).map(({ ref, index }) => ({
|
|
70
|
+
reference: ref,
|
|
71
|
+
replacement: `@${marker}_${index + 1}`,
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
export function rewriteKling4ReferenceMentions(prompt, imageRefs, videoRefs) {
|
|
75
|
+
return replaceNotebookMentions(prompt, [
|
|
76
|
+
...numberedMentions(imageRefs, "image"),
|
|
77
|
+
...numberedMentions(videoRefs, "video"),
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
export function rewriteKling4FrameMentions(prompt, frames) {
|
|
81
|
+
return replaceNotebookMentions(prompt, [
|
|
82
|
+
...frames.first.slice(0, 1).map((reference) => ({ reference, replacement: "@first_frame" })),
|
|
83
|
+
...numberedMentions(frames.keyframes, "keyframe"),
|
|
84
|
+
...frames.last.slice(0, 1).map((reference) => ({ reference, replacement: "@last_frame" })),
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
68
87
|
export function rewriteViduReferenceMentions(prompt, imageRefs, audioRefs) {
|
|
69
88
|
return replaceNotebookMentions(prompt, [
|
|
70
89
|
...refMentionEntries(imageRefs).map(({ ref, index }) => ({
|
package/dist/goal-plan-v3.js
CHANGED
|
@@ -4,6 +4,8 @@ import { goalPromptWords } from "./goal-prompt-budget.js";
|
|
|
4
4
|
import { LIGHTNING_COLD_OPEN_SECONDS, LIGHTNING_SCENE_ASPECT_RATIO, LIGHTNING_SCENE_MODEL, LIGHTNING_SCENE_OUTPUT_FORMAT, LIGHTNING_SCENE_PROMPT_WORDS, LIGHTNING_SCENE_RESOLUTION, LIGHTNING_VIDEO_DURATION_SECONDS, LIGHTNING_VIDEO_GENERATE_AUDIO, LIGHTNING_VIDEO_OUTPUT_FORMAT, LIGHTNING_VIDEO_PROMPT_WORDS, LIGHTNING_VIDEO_RESOLUTION, LIGHTNING_VIDEO_MODEL, LIGHTNING_WATERMARK_PROFILE, preservedPrompt, } from "./lightning-defaults.js";
|
|
5
5
|
const IMAGE_LIMIT = 30;
|
|
6
6
|
const VIDEO_LIMIT = 10;
|
|
7
|
+
const LEGACY_SCENE_RESOLUTION = "2K";
|
|
8
|
+
const SCENE_RESOLUTIONS = [LEGACY_SCENE_RESOLUTION, "4K"];
|
|
7
9
|
export const goalMediaRefSchema = z.object({
|
|
8
10
|
kind: z.enum(["image", "video"]),
|
|
9
11
|
artifactId: z.string().min(1),
|
|
@@ -22,7 +24,7 @@ export const goalPlanV3Schema = z.object({
|
|
|
22
24
|
tool: z.literal("generate_image"),
|
|
23
25
|
model: z.literal(LIGHTNING_SCENE_MODEL),
|
|
24
26
|
aspectRatio: z.enum(["16:9", "9:16", "1:1"]),
|
|
25
|
-
resolution: z.
|
|
27
|
+
resolution: z.enum(SCENE_RESOLUTIONS),
|
|
26
28
|
outputFormat: z.literal(LIGHTNING_SCENE_OUTPUT_FORMAT),
|
|
27
29
|
imageRefs: z.array(goalMediaRefSchema).max(IMAGE_LIMIT),
|
|
28
30
|
}).strict(),
|
|
@@ -59,6 +61,14 @@ export const goalPlanV3Schema = z.object({
|
|
|
59
61
|
}).strict(),
|
|
60
62
|
}).strict(),
|
|
61
63
|
}).strict();
|
|
64
|
+
function withLegacySceneResolution(plan) {
|
|
65
|
+
if (typeof plan !== "object" || plan === null || !("version" in plan) || plan.version !== 3)
|
|
66
|
+
return plan;
|
|
67
|
+
if (!("scene" in plan) || typeof plan.scene !== "object" || plan.scene === null || "resolution" in plan.scene)
|
|
68
|
+
return plan;
|
|
69
|
+
return { ...plan, scene: { ...plan.scene, resolution: LEGACY_SCENE_RESOLUTION } };
|
|
70
|
+
}
|
|
71
|
+
export const savedGoalPlanV3Schema = z.preprocess(withLegacySceneResolution, goalPlanV3Schema);
|
|
62
72
|
export function isGoalPlanV3(plan) {
|
|
63
73
|
return plan?.version === 3;
|
|
64
74
|
}
|
package/dist/goal-plan.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { LIGHTNING_VIDEO_MODEL } from "./lightning-defaults.js";
|
|
3
3
|
import { GOAL_PROMPT_BUDGET, goalPromptWords } from "./goal-prompt-budget.js";
|
|
4
4
|
import { GOAL_STYLE_IDS, goalStyleFragment, resolveGoalStyleOptions } from "./goal-styles.js";
|
|
5
|
-
export { compileGoalV3Approval, compileGoalV3Steps, goalMediaRefSchema, goalPlanV3Schema, isGoalPlanV3, refreshGoalPlanV3 } from "./goal-plan-v3.js";
|
|
5
|
+
export { compileGoalV3Approval, compileGoalV3Steps, goalMediaRefSchema, goalPlanV3Schema, isGoalPlanV3, refreshGoalPlanV3, savedGoalPlanV3Schema } from "./goal-plan-v3.js";
|
|
6
6
|
export { GOAL_PROMPT_BUDGET, goalPromptWords } from "./goal-prompt-budget.js";
|
|
7
7
|
export const GOAL_VIDEO_TOOL = "generate_video";
|
|
8
8
|
export const GOAL_VIDEO_MODEL = LIGHTNING_VIDEO_MODEL;
|
package/dist/goal-store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { firstEmptyNotebookGridSlot, notebookOccupiedSlots } from "videobook-engine/notebook-grid";
|
|
3
|
-
import { goalMediaRefSchema, goalPlanSchema,
|
|
3
|
+
import { goalMediaRefSchema, goalPlanSchema, goalStyleSchema, legacyGoalPlanSchema, savedGoalPlanV3Schema } from "./goal-plan.js";
|
|
4
4
|
import { mutateNotebook } from "./notebook-mutations.js";
|
|
5
5
|
import { arrangeGoalNotebook } from "./notebook-goal-layout.js";
|
|
6
6
|
const KEY = "application.goals.v2";
|
|
@@ -68,7 +68,7 @@ function mediaFrom(value) {
|
|
|
68
68
|
}
|
|
69
69
|
export function goalContent(cell) {
|
|
70
70
|
const inputs = cell.inputs ?? {};
|
|
71
|
-
const plan = z.union([
|
|
71
|
+
const plan = z.union([savedGoalPlanV3Schema, goalPlanSchema, legacyGoalPlanSchema]).safeParse(inputs.plan);
|
|
72
72
|
const requestedStyle = goalStyleSchema.safeParse(inputs.requestedStyle);
|
|
73
73
|
const media = mediaFrom(inputs.media);
|
|
74
74
|
return {
|
package/dist/har-capture.js
CHANGED
|
@@ -4,6 +4,7 @@ import { createHarCapture } from "@apicity/har";
|
|
|
4
4
|
import { currentBookContext } from "./book-context.js";
|
|
5
5
|
import { harDirectory, readHarSettings } from "./har-settings.js";
|
|
6
6
|
import { logger } from "./logger.js";
|
|
7
|
+
const localFailures = new AsyncLocalStorage();
|
|
7
8
|
const pending = new Set();
|
|
8
9
|
let maintenance = Promise.resolve();
|
|
9
10
|
export async function maintainHarCaptures(operation) {
|
|
@@ -51,11 +52,36 @@ export async function withHarCapture(meta, operation, base = globalThis.fetch, c
|
|
|
51
52
|
try {
|
|
52
53
|
return await runCapture(meta, operation, base, context);
|
|
53
54
|
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
localFailures.getStore()?.add(error);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
54
59
|
finally {
|
|
55
60
|
finish();
|
|
56
61
|
pending.delete(finished);
|
|
57
62
|
}
|
|
58
63
|
}
|
|
64
|
+
export async function withHarLocalFailure(meta, operation) {
|
|
65
|
+
const failures = localFailures.getStore() ?? new Set();
|
|
66
|
+
return localFailures.run(failures, async () => {
|
|
67
|
+
try {
|
|
68
|
+
return await operation();
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const seen = new Set();
|
|
72
|
+
let cause = error;
|
|
73
|
+
while (!seen.has(cause)) {
|
|
74
|
+
if (failures.has(cause))
|
|
75
|
+
throw error;
|
|
76
|
+
seen.add(cause);
|
|
77
|
+
if (!(cause instanceof Error) || cause.cause === undefined)
|
|
78
|
+
break;
|
|
79
|
+
cause = cause.cause;
|
|
80
|
+
}
|
|
81
|
+
return withHarCapture(meta, () => { throw error; });
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
59
85
|
async function runCapture(meta, operation, base, context) {
|
|
60
86
|
const settings = await readHarSettings();
|
|
61
87
|
if (settings.mode === "off")
|
|
@@ -99,8 +125,15 @@ async function runCapture(meta, operation, base, context) {
|
|
|
99
125
|
}
|
|
100
126
|
}
|
|
101
127
|
const HTTP_METHODS = new Set(["get", "post", "put", "patch", "delete", "head", "options"]);
|
|
102
|
-
|
|
103
|
-
|
|
128
|
+
const SDK_ONLY_NAMESPACES = new Map([["kie", new Set(["veo", "suno"])]]);
|
|
129
|
+
function endpointDotPath(provider, path) {
|
|
130
|
+
const [head = "", next = ""] = path;
|
|
131
|
+
if (path.length > 1 && HTTP_METHODS.has(head))
|
|
132
|
+
return path.slice(1).join(".");
|
|
133
|
+
if (path.length < 3 || !HTTP_METHODS.has(next))
|
|
134
|
+
return path.join(".");
|
|
135
|
+
const rest = path.slice(2);
|
|
136
|
+
return (SDK_ONLY_NAMESPACES.get(provider)?.has(head) ? rest : [head, ...rest]).join(".");
|
|
104
137
|
}
|
|
105
138
|
const providerCalls = new WeakMap();
|
|
106
139
|
export function withProviderCall(provider, meta, operation) {
|
|
@@ -119,7 +152,7 @@ export function capturedProvider(provider, factory, base = globalThis.fetch) {
|
|
|
119
152
|
function wrap(target, path) {
|
|
120
153
|
return new Proxy(target, {
|
|
121
154
|
apply(fn, receiver, args) {
|
|
122
|
-
return withHarCapture({ provider, endpoint: endpointDotPath(path), input: args.length === 1 ? args[0] : args }, (fetch) => transports.run(fetch, () => Reflect.apply(fn, receiver, args)), base);
|
|
155
|
+
return withHarCapture({ provider, endpoint: endpointDotPath(provider, path), input: args.length === 1 ? args[0] : args }, (fetch) => transports.run(fetch, () => Reflect.apply(fn, receiver, args)), base);
|
|
123
156
|
},
|
|
124
157
|
get(object, property, receiver) {
|
|
125
158
|
const value = Reflect.get(object, property, receiver);
|
|
@@ -99,6 +99,7 @@ function kieImageEditAdapter(model, build) {
|
|
|
99
99
|
});
|
|
100
100
|
return {
|
|
101
101
|
id: model.apiId,
|
|
102
|
+
envKey: "KIE_API_KEY",
|
|
102
103
|
uploadAsset: (engine, artifactId, filename) => uploadAssetToKie(engine, artifactId, filename),
|
|
103
104
|
buildSemanticRequest: (input) => buildRequest({ ...input, imageUrls: [input.imageUrls[0]] }),
|
|
104
105
|
buildRegionRequest: buildRequest,
|
|
@@ -166,6 +167,7 @@ function falImageEditAdapter(model) {
|
|
|
166
167
|
const buildRequest = (input) => toProviderRequest(model.apiId, catalogEditRequest(model, input));
|
|
167
168
|
return {
|
|
168
169
|
id: model.apiId,
|
|
170
|
+
envKey: "FAL_API_KEY",
|
|
169
171
|
uploadAsset: (engine, artifactId, filename) => uploadAssetToFal(engine, artifactId, filename),
|
|
170
172
|
buildSemanticRequest: (input) => buildRequest({ ...input, imageUrls: [input.imageUrls[0]] }),
|
|
171
173
|
buildRegionRequest: buildRequest,
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { probeVideo } from "../ffmpeg.js";
|
|
3
|
+
import { logger } from "../logger.js";
|
|
4
|
+
import { queue, registerJobHandler } from "../queue.js";
|
|
5
|
+
import { invalidVideoProxyMetadata, probeStoredVideoFile, videoProxyAssessmentMatches, videoProxyMetadata, videoProxyValidationError, } from "../video-proxy.js";
|
|
6
|
+
const PROXY_FILENAME = "proxy.mp4";
|
|
7
|
+
export function scheduleVideoProxyAssessment(input) {
|
|
8
|
+
const jobId = `assess-video-proxy-${input.bookId}-${input.artifactId}-${input.proxyFile.objectHash}`;
|
|
9
|
+
void queue.enqueue(jobId, {
|
|
10
|
+
type: "assess_video_proxy",
|
|
11
|
+
bookId: input.bookId,
|
|
12
|
+
proxyAssetId: input.artifactId,
|
|
13
|
+
sourceFilename: input.sourceFile.name,
|
|
14
|
+
sourceHash: input.sourceFile.objectHash,
|
|
15
|
+
proxyHash: input.proxyFile.objectHash,
|
|
16
|
+
sourceProfile: input.sourceProfile,
|
|
17
|
+
}).catch((error) => {
|
|
18
|
+
logger.error("proxy-assessment-enqueue-failed", { assetId: input.artifactId, error });
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function scheduleMediaDurationBackfill(input) {
|
|
22
|
+
const jobId = `backfill-media-duration-${input.bookId}-${input.artifactId}-${input.mediaFile.objectHash}`;
|
|
23
|
+
void queue.enqueue(jobId, {
|
|
24
|
+
type: "backfill_media_duration",
|
|
25
|
+
bookId: input.bookId,
|
|
26
|
+
durationAssetId: input.artifactId,
|
|
27
|
+
mediaFilename: input.mediaFile.name,
|
|
28
|
+
mediaHash: input.mediaFile.objectHash,
|
|
29
|
+
}).catch((error) => {
|
|
30
|
+
logger.error("duration-backfill-enqueue-failed", { assetId: input.artifactId, error });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async function currentFile(engine, artifactId, name, objectHash) {
|
|
34
|
+
const manifest = await engine.files.manifest(artifactId);
|
|
35
|
+
if (!manifest.ok)
|
|
36
|
+
return null;
|
|
37
|
+
return manifest.value.files.find((file) => file.name === name && file.objectHash === objectHash) ?? null;
|
|
38
|
+
}
|
|
39
|
+
export async function assessStoredVideoProxy(engine, assetId, sourceFile, proxyFile, sourceProfile) {
|
|
40
|
+
let assessment;
|
|
41
|
+
try {
|
|
42
|
+
const proxy = await probeStoredVideoFile(engine, assetId, proxyFile.name);
|
|
43
|
+
const error = videoProxyValidationError(sourceProfile, proxy);
|
|
44
|
+
assessment = error
|
|
45
|
+
? invalidVideoProxyMetadata(sourceFile, proxyFile, error)
|
|
46
|
+
: videoProxyMetadata(sourceFile, proxyFile, proxy);
|
|
47
|
+
}
|
|
48
|
+
catch (cause) {
|
|
49
|
+
const error = cause instanceof Error ? cause.message : String(cause);
|
|
50
|
+
assessment = invalidVideoProxyMetadata(sourceFile, proxyFile, error);
|
|
51
|
+
}
|
|
52
|
+
await engine.metadata.artifacts.write(assetId, "proxy", assessment);
|
|
53
|
+
return assessment.valid;
|
|
54
|
+
}
|
|
55
|
+
async function runVideoProxyAssessment(engine, payload) {
|
|
56
|
+
const { proxyAssetId } = payload;
|
|
57
|
+
const sourceFile = await currentFile(engine, proxyAssetId, payload.sourceFilename, payload.sourceHash);
|
|
58
|
+
const proxyFile = await currentFile(engine, proxyAssetId, PROXY_FILENAME, payload.proxyHash);
|
|
59
|
+
if (!sourceFile || !proxyFile)
|
|
60
|
+
return { skipped: true };
|
|
61
|
+
const existing = await engine.metadata.artifacts.read(proxyAssetId, "proxy");
|
|
62
|
+
if (existing.ok && videoProxyAssessmentMatches(existing.value, sourceFile, proxyFile)) {
|
|
63
|
+
return { skipped: true };
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
valid: await assessStoredVideoProxy(engine, proxyAssetId, sourceFile, proxyFile, payload.sourceProfile),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
async function runMediaDurationBackfill(engine, payload, signal) {
|
|
70
|
+
const { durationAssetId } = payload;
|
|
71
|
+
const metadata = await engine.metadata.artifacts.read(durationAssetId, "original");
|
|
72
|
+
if (!metadata.ok || typeof metadata.value.duration === "number")
|
|
73
|
+
return { skipped: true };
|
|
74
|
+
if (!await currentFile(engine, durationAssetId, payload.mediaFilename, payload.mediaHash)) {
|
|
75
|
+
return { skipped: true };
|
|
76
|
+
}
|
|
77
|
+
const dir = await engine.workspaces.resolveArtifact(durationAssetId);
|
|
78
|
+
if (!dir.ok)
|
|
79
|
+
throw new Error(`backfill_media_duration: ${dir.error.message}`);
|
|
80
|
+
const probe = await probeVideo(join(dir.value, payload.mediaFilename), { signal });
|
|
81
|
+
if (!Number.isFinite(probe.duration) || probe.duration <= 0)
|
|
82
|
+
return { skipped: true };
|
|
83
|
+
const written = await engine.metadata.artifacts.write(durationAssetId, "original", {
|
|
84
|
+
...metadata.value,
|
|
85
|
+
duration: probe.duration,
|
|
86
|
+
});
|
|
87
|
+
if (!written.ok)
|
|
88
|
+
throw new Error(written.error.message);
|
|
89
|
+
return { duration: probe.duration };
|
|
90
|
+
}
|
|
91
|
+
export function registerAssessMediaProbeJobs(engine) {
|
|
92
|
+
registerJobHandler("assess_video_proxy", async (payload) => runVideoProxyAssessment(engine, payload));
|
|
93
|
+
registerJobHandler("backfill_media_duration", async (payload, { signal }) => runMediaDurationBackfill(engine, payload, signal));
|
|
94
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { withHarCapture } from "../har-capture.js";
|
|
2
1
|
import { join } from "node:path";
|
|
3
2
|
import { tmpdir } from "node:os";
|
|
4
3
|
import { writeFile, unlink, readFile as readFsFile } from "node:fs/promises";
|
|
@@ -48,9 +47,7 @@ async function reclaimFailedCompletion(engine, task, ctx) {
|
|
|
48
47
|
return lease.ownerId;
|
|
49
48
|
}
|
|
50
49
|
export function registerCompleteProviderTaskJob(engine) {
|
|
51
|
-
registerJobHandler("complete_kie_task", async (payload, ctx) =>
|
|
52
|
-
provider: String(payload.taskType).split("_")[0] ?? "unknown", endpoint: "generation.complete", input: payload,
|
|
53
|
-
}, async () => {
|
|
50
|
+
registerJobHandler("complete_kie_task", async (payload, ctx) => {
|
|
54
51
|
const { taskId, taskType, assetId, bookId, meta, resultUrls, resultObject, } = payload;
|
|
55
52
|
// Pattern C: inherit the provider lease via getOwner, abort if the row
|
|
56
53
|
// already terminated, and register the lease so the wrapper's catch path
|
|
@@ -128,7 +125,7 @@ export function registerCompleteProviderTaskJob(engine) {
|
|
|
128
125
|
clearInterval(heartbeat);
|
|
129
126
|
await engine.jobs.locks.release(assetDir);
|
|
130
127
|
}
|
|
131
|
-
}
|
|
128
|
+
});
|
|
132
129
|
}
|
|
133
130
|
async function mediaOutputs(taskType, taskId, urls) {
|
|
134
131
|
if (taskType === MEDIA_TASK_TYPES.machgen)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { withHarLocalFailure } from "../har-capture.js";
|
|
2
|
+
import { generationHarEndpoint } from "../media/har-endpoint.js";
|
|
2
3
|
import { withBookContext } from "../book-context.js";
|
|
3
4
|
import { isSeedanceEdit } from "../media/seedance-edit.js";
|
|
4
5
|
import { registerJobHandler } from "../queue.js";
|
|
@@ -87,7 +88,7 @@ async function generateMedia(engine, job, ctx) {
|
|
|
87
88
|
}
|
|
88
89
|
export async function runGenerateMedia(engine, job, ctx) {
|
|
89
90
|
return withBookContext({ bookId: job.bookId, engine, operation: "generate_media", artifactId: job.assetId,
|
|
90
|
-
attemptId: job.generationId ?? job.assetId, runId: job.runId, model: job.model }, () =>
|
|
91
|
+
attemptId: job.generationId ?? job.assetId, runId: job.runId, model: job.model }, () => withHarLocalFailure({ provider: resolveModel(job.model).provider, endpoint: generationHarEndpoint(resolveModel(job.model)), input: job }, () => generateMedia(engine, job, ctx)));
|
|
91
92
|
}
|
|
92
93
|
export function registerGenerateMediaJob(engine) {
|
|
93
94
|
registerJobHandler("generate_media", (payload, ctx) => runGenerateMedia(engine, payload, ctx));
|
|
@@ -4,6 +4,7 @@ import sharp from "sharp";
|
|
|
4
4
|
import { KIE_RESULT_TIMEOUT_MS, kieProvider, parseResultUrls, waitForKieResult, } from "./_kie-poll.js";
|
|
5
5
|
import { GROK_EXACT_MASK_ADAPTER_ID, imageEditAdapter, IMAGE_EDIT_ADAPTERS, } from "./_image-edit-adapter.js";
|
|
6
6
|
import { DEFAULT_IMAGE_EDIT_MODEL_ID } from "../image-edit-models.js";
|
|
7
|
+
import { requireApiKey } from "../api-key.js";
|
|
7
8
|
import { compositeImageRegionEdit, imageRegionEditPrompt } from "../image-region-edit.js";
|
|
8
9
|
import { IMAGE_SUBJECT_MAP_VERSION, applyGrokSegmentsToSubjects, composeImageSubjectRemoval, exactEditMaskIndexes, grokMaskIndex, parseGrokSegmentMapResult, persistSeedreamSubjectLayers, readImageSubjectMapRecord, resolveImageSubjectSource, writeCurrentImageSubjectAnalysisRecord, } from "../image-subject-map.js";
|
|
9
10
|
import { enqueueSearchIndex } from "./enqueue-search-index.js";
|
|
@@ -534,6 +535,7 @@ export async function previewImageSubjectEditRequest(engine, payload, imageUrls)
|
|
|
534
535
|
: adapter.buildSemanticRequest(input);
|
|
535
536
|
}
|
|
536
537
|
async function runAdapterImageSubjectEdit(engine, payload, adapter, route, prepared, sourceFilename, signal) {
|
|
538
|
+
requireApiKey(adapter.envKey);
|
|
537
539
|
const stored = await readStoredImageSubjectEditTask(engine, payload.imageAssetId);
|
|
538
540
|
const storedMatch = stored?.adapterId === adapter.id ? stored : null;
|
|
539
541
|
let request = storedMatch?.request ?? null;
|
package/dist/jobs/kie-paygate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { withHarLocalFailure } from "../har-capture.js";
|
|
2
2
|
import { createKie } from "../usage-providers.js";
|
|
3
3
|
import { submitMediaJob } from "../usage-providers.js";
|
|
4
4
|
import { mintOtp } from "@apicity/cost";
|
|
@@ -177,8 +177,8 @@ async function submitQueuedKieTaskInner(engine, task) {
|
|
|
177
177
|
return writeResult.value.task;
|
|
178
178
|
}
|
|
179
179
|
export async function submitKieTask(engine, ctx, args) {
|
|
180
|
-
return
|
|
180
|
+
return withHarLocalFailure({ provider: "kie", endpoint: "api.v1.jobs.createTask", input: args.request }, () => submitKieTaskInner(engine, ctx, args));
|
|
181
181
|
}
|
|
182
182
|
export async function submitQueuedKieTask(engine, task) {
|
|
183
|
-
return
|
|
183
|
+
return withHarLocalFailure({ provider: "kie", endpoint: "api.v1.jobs.createTask", input: task }, () => submitQueuedKieTaskInner(engine, task));
|
|
184
184
|
}
|
|
@@ -38,6 +38,7 @@ import { registerLabelMusicSectionsJob } from "./label-music-sections.js";
|
|
|
38
38
|
import { registerEditingMomentsJob } from "./analyze-editing-moments.js";
|
|
39
39
|
import { registerExtractWaveformJob } from "./extract-waveform.js";
|
|
40
40
|
import { registerExtractVideoPosterJob } from "./extract-video-poster.js";
|
|
41
|
+
import { registerAssessMediaProbeJobs } from "./assess-media-probes.js";
|
|
41
42
|
import { registerReplaceVideoAudioJob } from "./replace-video-audio.js";
|
|
42
43
|
import { registerSpliceVideoJob } from "./splice-video.js";
|
|
43
44
|
import { registerSmoothSceneConcatJob } from "./smooth-scene-concat.js";
|
|
@@ -109,6 +110,7 @@ export function registerAllJobHandlers(engine, books = bookManager) {
|
|
|
109
110
|
registerExtractAudioJob(engine);
|
|
110
111
|
registerExtractWaveformJob(engine);
|
|
111
112
|
registerExtractVideoPosterJob(engine);
|
|
113
|
+
registerAssessMediaProbeJobs(engine);
|
|
112
114
|
registerAnalyzeMusicJob(engine);
|
|
113
115
|
registerPlanGoalJob(engine);
|
|
114
116
|
registerAssembleGoalJob(engine);
|