@nodaro/shared 1.13.1 → 1.14.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/dist/index.cjs +61 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -2
- package/dist/index.d.ts +82 -2
- package/dist/index.js +54 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/gvp-supported-providers.test.ts +31 -0
- package/src/__tests__/video-analysis.test.ts +83 -0
- package/src/index.ts +2 -0
- package/src/model-constants.ts +16 -0
- package/src/social-post.ts +6 -1
- package/src/video-analysis.ts +79 -0
package/dist/index.cjs
CHANGED
|
@@ -2857,6 +2857,10 @@ var SEEDANCE_2_PROVIDERS = /* @__PURE__ */ new Set([
|
|
|
2857
2857
|
function isSeedance2Provider(provider) {
|
|
2858
2858
|
return !!provider && SEEDANCE_2_PROVIDERS.has(provider);
|
|
2859
2859
|
}
|
|
2860
|
+
var GVP_SUPPORTED_PROVIDERS = ["seedance-2", "seedance-2-fast"];
|
|
2861
|
+
function isGvpSupportedProvider(provider) {
|
|
2862
|
+
return !!provider && GVP_SUPPORTED_PROVIDERS.includes(provider);
|
|
2863
|
+
}
|
|
2860
2864
|
function defaultVideoAspectRatio(provider) {
|
|
2861
2865
|
return isSeedance2Provider(provider) ? "adaptive" : "16:9";
|
|
2862
2866
|
}
|
|
@@ -7023,7 +7027,8 @@ var SOCIAL_POST_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
|
7023
7027
|
"linkedin-post",
|
|
7024
7028
|
"x-post",
|
|
7025
7029
|
"facebook-post",
|
|
7026
|
-
"telegram-post"
|
|
7030
|
+
"telegram-post",
|
|
7031
|
+
"publish-social"
|
|
7027
7032
|
]);
|
|
7028
7033
|
var INSTAGRAM_CAROUSEL_MIN_ITEMS = 2;
|
|
7029
7034
|
var INSTAGRAM_CAROUSEL_MAX_ITEMS = 10;
|
|
@@ -12069,12 +12074,32 @@ function sanitizeRole(raw) {
|
|
|
12069
12074
|
var VIDEO_ANALYSIS_MAX_SCENE_SEC = 8;
|
|
12070
12075
|
var VIDEO_ANALYSIS_ENTITY_SOURCES = ["wired-character", "wired-object", "wired-location", "wired-creature"];
|
|
12071
12076
|
var SLOT_TOKEN_RE = /\{slot:([a-z0-9-]+)\}/g;
|
|
12077
|
+
var VIDEO_ANALYSIS_VARIATION_SLUGS = ["dream", "flashback", "disguise", "costume", "transformation", "era", "alt-1", "alt-2"];
|
|
12078
|
+
var VIDEO_ANALYSIS_MAX_VARIATIONS = 4;
|
|
12079
|
+
var VIDEO_ANALYSIS_DEFAULT_VARIATION = "default";
|
|
12080
|
+
var slotVariationSchema = zod.z.object({
|
|
12081
|
+
variationId: zod.z.string().min(1).regex(/^[a-z0-9-]+$/).refine((id) => id !== VIDEO_ANALYSIS_DEFAULT_VARIATION, { message: `"${VIDEO_ANALYSIS_DEFAULT_VARIATION}" is reserved for the slot's canonical look` }),
|
|
12082
|
+
label: zod.z.string().min(1),
|
|
12083
|
+
/** Full STANDALONE casting-sheet look restating the slot's invariant identity
|
|
12084
|
+
* core (face, build, age) — the manifest substitutes it wholesale, so a
|
|
12085
|
+
* wardrobe-only delta would silently delete identity from the prompt. */
|
|
12086
|
+
description: zod.z.string().min(1),
|
|
12087
|
+
/** Per-variation identity reference (auto-cast frame or user sheet). In the
|
|
12088
|
+
* schema from day one: every strip-mode round-trip must carry it. */
|
|
12089
|
+
refImageUrl: zod.z.string().url().optional()
|
|
12090
|
+
});
|
|
12072
12091
|
var entitySlotSchema = zod.z.object({
|
|
12073
12092
|
slotId: zod.z.string().min(1).regex(/^[a-z0-9-]+$/),
|
|
12074
12093
|
label: zod.z.string().min(1),
|
|
12075
12094
|
source: zod.z.enum(VIDEO_ANALYSIS_ENTITY_SOURCES),
|
|
12076
12095
|
role: zod.z.string().min(1),
|
|
12077
|
-
description: zod.z.string().min(1)
|
|
12096
|
+
description: zod.z.string().min(1),
|
|
12097
|
+
/** Auto-cast visual reference — a hosted frame from the analyzed footage
|
|
12098
|
+
* where this entity is clearly visible. Optional/additive: producers may
|
|
12099
|
+
* omit it; consumers use it as an identity reference for recreation. */
|
|
12100
|
+
refImageUrl: zod.z.string().url().optional(),
|
|
12101
|
+
/** NON-default looks only; present only when at least one exists. */
|
|
12102
|
+
variations: zod.z.array(slotVariationSchema).max(VIDEO_ANALYSIS_MAX_VARIATIONS).optional()
|
|
12078
12103
|
});
|
|
12079
12104
|
var audioLayerSchema = zod.z.object({
|
|
12080
12105
|
mode: zod.z.enum(["speech", "music", "sfx"]),
|
|
@@ -12090,7 +12115,12 @@ var windowSceneBase = zod.z.object({
|
|
|
12090
12115
|
visual: zod.z.string().min(1),
|
|
12091
12116
|
transitionOut: zod.z.enum(["cut", "fade", "wipe", "whip"]).optional(),
|
|
12092
12117
|
// Array of concurrent layers (music + speech + sfx together); [] = silence.
|
|
12093
|
-
audio: zod.z.array(audioLayerSchema)
|
|
12118
|
+
audio: zod.z.array(audioLayerSchema),
|
|
12119
|
+
/** slotId → variationId for slots wearing a NON-default look in this scene
|
|
12120
|
+
* (only slots referenced in the scene; absent key ⇒ the default look).
|
|
12121
|
+
* Rides windowSceneBase so BOTH the window layer and analyzedSceneSchema
|
|
12122
|
+
* inherit it — the out-of-band binding channel (no in-text markers, D6). */
|
|
12123
|
+
slotVariations: zod.z.record(zod.z.string(), zod.z.string()).optional()
|
|
12094
12124
|
});
|
|
12095
12125
|
var windowSceneSchema = windowSceneBase.refine((s) => s.endSec > s.startSec, { message: "endSec must be > startSec" });
|
|
12096
12126
|
var windowAnalysisSchema = zod.z.object({
|
|
@@ -12133,6 +12163,26 @@ function unwrapUnresolvedTokens(text, validIds) {
|
|
|
12133
12163
|
});
|
|
12134
12164
|
return { text: out, unresolved };
|
|
12135
12165
|
}
|
|
12166
|
+
function rewriteSceneBindings(sv, slotRenames, variationRenames) {
|
|
12167
|
+
if (!sv) return void 0;
|
|
12168
|
+
const out = {};
|
|
12169
|
+
for (const [slotId, variationId] of Object.entries(sv)) {
|
|
12170
|
+
const newSlot = slotRenames[slotId] ?? slotId;
|
|
12171
|
+
out[newSlot] = variationRenames?.[newSlot]?.[variationId] ?? variationId;
|
|
12172
|
+
}
|
|
12173
|
+
return out;
|
|
12174
|
+
}
|
|
12175
|
+
function dropUnknownBindings(sv, validBySlot) {
|
|
12176
|
+
if (!sv) return { dropped: [] };
|
|
12177
|
+
const kept = {};
|
|
12178
|
+
const dropped = [];
|
|
12179
|
+
for (const [slotId, variationId] of Object.entries(sv)) {
|
|
12180
|
+
const valid = validBySlot.get(slotId);
|
|
12181
|
+
if (valid && (variationId === VIDEO_ANALYSIS_DEFAULT_VARIATION || valid.has(variationId))) kept[slotId] = variationId;
|
|
12182
|
+
else dropped.push({ slotId, variationId });
|
|
12183
|
+
}
|
|
12184
|
+
return { kept: Object.keys(kept).length > 0 ? kept : void 0, dropped };
|
|
12185
|
+
}
|
|
12136
12186
|
function renderAnalyzedScene(scene, slots, castMap) {
|
|
12137
12187
|
const byId = new Map(slots.map((s) => [s.slotId, s]));
|
|
12138
12188
|
return scene.visual.replace(SLOT_TOKEN_RE, (_whole, id) => castMap?.[id] ?? byId.get(id)?.description ?? id);
|
|
@@ -12335,6 +12385,7 @@ exports.GENERATE_TEXT_DELIMITER = GENERATE_TEXT_DELIMITER;
|
|
|
12335
12385
|
exports.GLOBAL_MAX_DURATION_SECONDS = GLOBAL_MAX_DURATION_SECONDS;
|
|
12336
12386
|
exports.GROUP_HANDLE_PREFIX = GROUP_HANDLE_PREFIX;
|
|
12337
12387
|
exports.GUIDANCE_SCALE_SUPPORT = GUIDANCE_SCALE_SUPPORT;
|
|
12388
|
+
exports.GVP_SUPPORTED_PROVIDERS = GVP_SUPPORTED_PROVIDERS;
|
|
12338
12389
|
exports.GenerateMotionInputSchema = GenerateMotionInputSchema;
|
|
12339
12390
|
exports.GenerateMotionResultSchema = GenerateMotionResultSchema;
|
|
12340
12391
|
exports.HANDLE_PORT_SEPARATOR = HANDLE_PORT_SEPARATOR;
|
|
@@ -12559,16 +12610,19 @@ exports.VEHICLE_SUBCATEGORY_LABELS = VEHICLE_SUBCATEGORY_LABELS;
|
|
|
12559
12610
|
exports.VEHICLE_SUBCATEGORY_ORDER = VEHICLE_SUBCATEGORY_ORDER;
|
|
12560
12611
|
exports.VEO_PROVIDERS = VEO_PROVIDERS;
|
|
12561
12612
|
exports.VIDEO_ANALYSIS_BUCKET_CREDITS = VIDEO_ANALYSIS_BUCKET_CREDITS;
|
|
12613
|
+
exports.VIDEO_ANALYSIS_DEFAULT_VARIATION = VIDEO_ANALYSIS_DEFAULT_VARIATION;
|
|
12562
12614
|
exports.VIDEO_ANALYSIS_DURATION_BUCKETS = VIDEO_ANALYSIS_DURATION_BUCKETS;
|
|
12563
12615
|
exports.VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC = VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC;
|
|
12564
12616
|
exports.VIDEO_ANALYSIS_ENTITY_SOURCES = VIDEO_ANALYSIS_ENTITY_SOURCES;
|
|
12565
12617
|
exports.VIDEO_ANALYSIS_LLM_MODELS = VIDEO_ANALYSIS_LLM_MODELS;
|
|
12566
12618
|
exports.VIDEO_ANALYSIS_MAX_DURATION_SEC = VIDEO_ANALYSIS_MAX_DURATION_SEC;
|
|
12567
12619
|
exports.VIDEO_ANALYSIS_MAX_SCENE_SEC = VIDEO_ANALYSIS_MAX_SCENE_SEC;
|
|
12620
|
+
exports.VIDEO_ANALYSIS_MAX_VARIATIONS = VIDEO_ANALYSIS_MAX_VARIATIONS;
|
|
12568
12621
|
exports.VIDEO_ANALYSIS_MIXED_TIERS = VIDEO_ANALYSIS_MIXED_TIERS;
|
|
12569
12622
|
exports.VIDEO_ANALYSIS_TIERS = VIDEO_ANALYSIS_TIERS;
|
|
12570
12623
|
exports.VIDEO_ANALYSIS_TIER_LABELS = VIDEO_ANALYSIS_TIER_LABELS;
|
|
12571
12624
|
exports.VIDEO_ANALYSIS_TIER_ORDER = VIDEO_ANALYSIS_TIER_ORDER;
|
|
12625
|
+
exports.VIDEO_ANALYSIS_VARIATION_SLUGS = VIDEO_ANALYSIS_VARIATION_SLUGS;
|
|
12572
12626
|
exports.VIDEO_ANALYSIS_WINDOW = VIDEO_ANALYSIS_WINDOW;
|
|
12573
12627
|
exports.VIDEO_AUDIO_CAPABILITY = VIDEO_AUDIO_CAPABILITY;
|
|
12574
12628
|
exports.VIDEO_CLIP_CREDITS = VIDEO_CLIP_CREDITS;
|
|
@@ -12665,6 +12719,7 @@ exports.deriveSlotRefs = deriveSlotRefs;
|
|
|
12665
12719
|
exports.describeEdgeBehavior = describeEdgeBehavior;
|
|
12666
12720
|
exports.describeMaskRegion = describeMaskRegion;
|
|
12667
12721
|
exports.describeSlotControl = describeSlotControl;
|
|
12722
|
+
exports.dropUnknownBindings = dropUnknownBindings;
|
|
12668
12723
|
exports.durationsByMode = durationsByMode;
|
|
12669
12724
|
exports.effectiveReasoningEffort = effectiveReasoningEffort;
|
|
12670
12725
|
exports.encodeProviderItem = encodeProviderItem;
|
|
@@ -12752,6 +12807,7 @@ exports.isCollectInEdge = isCollectInEdge;
|
|
|
12752
12807
|
exports.isDefaultSelectorConfig = isDefaultSelectorConfig;
|
|
12753
12808
|
exports.isExpandedClone = isExpandedClone;
|
|
12754
12809
|
exports.isFlux2Model = isFlux2Model;
|
|
12810
|
+
exports.isGvpSupportedProvider = isGvpSupportedProvider;
|
|
12755
12811
|
exports.isHandleInputWired = isHandleInputWired;
|
|
12756
12812
|
exports.isKineticCaptionStyle = isKineticCaptionStyle;
|
|
12757
12813
|
exports.isLocationUsageMode = isLocationUsageMode;
|
|
@@ -12845,6 +12901,7 @@ exports.resolveSwitchXCreditId = resolveSwitchXCreditId;
|
|
|
12845
12901
|
exports.resolveVideoAnalysisModel = resolveVideoAnalysisModel;
|
|
12846
12902
|
exports.resolveVideoProviderForMode = resolveVideoProviderForMode;
|
|
12847
12903
|
exports.resolveXfadeName = resolveXfadeName;
|
|
12904
|
+
exports.rewriteSceneBindings = rewriteSceneBindings;
|
|
12848
12905
|
exports.rewriteSlotTokens = rewriteSlotTokens;
|
|
12849
12906
|
exports.rgbaArrayToHex = rgbaArrayToHex;
|
|
12850
12907
|
exports.roleToPhrase = roleToPhrase;
|
|
@@ -12859,6 +12916,7 @@ exports.selectListItems = selectListItems;
|
|
|
12859
12916
|
exports.selectLoraRoutingForMentions = selectLoraRoutingForMentions;
|
|
12860
12917
|
exports.selectRandom = selectRandom;
|
|
12861
12918
|
exports.settledWithLimit = settledWithLimit;
|
|
12919
|
+
exports.slotVariationSchema = slotVariationSchema;
|
|
12862
12920
|
exports.sortCharacterEntriesForDisplay = sortCharacterEntriesForDisplay;
|
|
12863
12921
|
exports.sortListItems = sortListItems;
|
|
12864
12922
|
exports.sourceRefKey = sourceRefKey;
|