@blockrun/franklin 3.21.7 → 3.21.8
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/dist/tools/videogen.js +1 -44
- package/package.json +1 -1
package/dist/tools/videogen.js
CHANGED
|
@@ -28,13 +28,6 @@ import { ModelClient } from '../agent/llm.js';
|
|
|
28
28
|
import { analyzeMediaRequest, renderProposalForAskUser } from '../agent/media-router.js';
|
|
29
29
|
import { recordUsage } from '../stats/tracker.js';
|
|
30
30
|
import { findModel, estimateCostUsd } from '../gateway-models.js';
|
|
31
|
-
// BytePlus RealFace asset IDs from token360 Asset UI (after H5 verification).
|
|
32
|
-
// Format: `ta_` + alphanumeric.
|
|
33
|
-
const REAL_FACE_ASSET_ID_REGEX = /^ta_[A-Za-z0-9]+$/;
|
|
34
|
-
const REAL_FACE_MODELS = new Set([
|
|
35
|
-
'bytedance/seedance-2.0',
|
|
36
|
-
'bytedance/seedance-2.0-fast',
|
|
37
|
-
]);
|
|
38
31
|
const DEFAULT_MODEL = 'xai/grok-imagine-video';
|
|
39
32
|
const DEFAULT_DURATION = 8;
|
|
40
33
|
const PRICE_PER_SECOND_USD = 0.05;
|
|
@@ -51,33 +44,9 @@ function estimateVideoCostUsd(durationSeconds = DEFAULT_DURATION) {
|
|
|
51
44
|
function buildExecute(deps) {
|
|
52
45
|
return async function execute(input, ctx) {
|
|
53
46
|
const rawInput = input;
|
|
54
|
-
const { output_path, model, image_url, duration_seconds, contentId, aspect_ratio
|
|
47
|
+
const { output_path, model, image_url, duration_seconds, contentId, aspect_ratio } = rawInput;
|
|
55
48
|
if (!rawInput.prompt)
|
|
56
49
|
return { output: 'Error: prompt is required', isError: true };
|
|
57
|
-
// RealFace asset client-side validations (the gateway 400s on the same
|
|
58
|
-
// conditions but a local check is friendlier — and the rejected request
|
|
59
|
-
// doesn't burn an x402 round-trip).
|
|
60
|
-
if (real_face_asset_id !== undefined) {
|
|
61
|
-
if (typeof real_face_asset_id !== 'string' || !REAL_FACE_ASSET_ID_REGEX.test(real_face_asset_id)) {
|
|
62
|
-
return {
|
|
63
|
-
output: `Error: real_face_asset_id must match "ta_<alphanumeric>" (e.g. ta_abc123). Got: ${JSON.stringify(real_face_asset_id)}`,
|
|
64
|
-
isError: true,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
const chosenModel = model || DEFAULT_MODEL;
|
|
68
|
-
if (!REAL_FACE_MODELS.has(chosenModel)) {
|
|
69
|
-
return {
|
|
70
|
-
output: `Error: real_face_asset_id is only supported on Seedance 2.0 variants (${[...REAL_FACE_MODELS].join(', ')}). Current model: ${chosenModel}.`,
|
|
71
|
-
isError: true,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
if (image_url) {
|
|
75
|
-
return {
|
|
76
|
-
output: 'Error: real_face_asset_id and image_url both seed the first frame — pick one. Drop image_url to use RealFace, or drop real_face_asset_id to use the image.',
|
|
77
|
-
isError: true,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
50
|
// Resolve image_url before sending. The gateway requires a URL (http(s)
|
|
82
51
|
// or data: URI), but agents naturally pass a local file path —
|
|
83
52
|
// verified 2026-05-04 in a live session: agent passed
|
|
@@ -193,10 +162,6 @@ function buildExecute(deps) {
|
|
|
193
162
|
// value, the 400 body surfaces via 3.15.45 diagnostic so the agent
|
|
194
163
|
// can drop the param and retry.
|
|
195
164
|
...(aspect_ratio ? { aspect_ratio } : {}),
|
|
196
|
-
// RealFace (BytePlus, Seedance 2.0 only) — seeds the first frame from
|
|
197
|
-
// a real-person asset for cross-frame character consistency. Client
|
|
198
|
-
// already validated the ID + model gate above; just pass through.
|
|
199
|
-
...(real_face_asset_id ? { real_face_asset_id } : {}),
|
|
200
165
|
});
|
|
201
166
|
const headers = {
|
|
202
167
|
'Content-Type': 'application/json',
|
|
@@ -537,14 +502,6 @@ export function createVideoGenCapability(deps = {}) {
|
|
|
537
502
|
'error body surfaces — drop the param and retry.',
|
|
538
503
|
},
|
|
539
504
|
contentId: { type: 'string', description: 'Optional Content id to attach and budget against.' },
|
|
540
|
-
real_face_asset_id: {
|
|
541
|
-
type: 'string',
|
|
542
|
-
description: 'Optional BytePlus RealFace asset id (format `ta_<alphanumeric>`) for cross-frame ' +
|
|
543
|
-
'character consistency. Users get asset IDs from token360\'s Asset UI after H5 ' +
|
|
544
|
-
'verification. Seedance 2.0 variants only (bytedance/seedance-2.0, ' +
|
|
545
|
-
'bytedance/seedance-2.0-fast). Mutually exclusive with image_url — both seed the ' +
|
|
546
|
-
'first frame; pick one.',
|
|
547
|
-
},
|
|
548
505
|
},
|
|
549
506
|
required: ['prompt'],
|
|
550
507
|
},
|
package/package.json
CHANGED