@nodaro/shared 1.13.1 → 1.15.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 +72 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -2
- package/dist/index.d.ts +87 -2
- package/dist/index.js +65 -5
- 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 +100 -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 +89 -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({
|
|
@@ -12114,7 +12144,17 @@ var videoAnalysisResultSchema = zod.z.object({
|
|
|
12114
12144
|
language: zod.z.string().optional()
|
|
12115
12145
|
}),
|
|
12116
12146
|
slots: zod.z.array(entitySlotSchema),
|
|
12117
|
-
scenes: zod.z.array(analyzedSceneSchema).min(1)
|
|
12147
|
+
scenes: zod.z.array(analyzedSceneSchema).min(1),
|
|
12148
|
+
/** CAST VARIATIONS (§4 cap handling): looks the analyzer's merge FOLDED into
|
|
12149
|
+
* the default at VIDEO_ANALYSIS_MAX_VARIATIONS — recorded, never silent. In
|
|
12150
|
+
* the wire schema so strip-mode consumers (the recast client's validated
|
|
12151
|
+
* blueprint view) keep it: the §6 "folded into default look" note is the
|
|
12152
|
+
* user's only pre-pay defense against a wrong split. */
|
|
12153
|
+
variationFolds: zod.z.array(zod.z.object({
|
|
12154
|
+
slotId: zod.z.string(),
|
|
12155
|
+
variationId: zod.z.string(),
|
|
12156
|
+
label: zod.z.string()
|
|
12157
|
+
})).optional()
|
|
12118
12158
|
});
|
|
12119
12159
|
function deriveSlotRefs(visual) {
|
|
12120
12160
|
const out = [];
|
|
@@ -12133,6 +12173,26 @@ function unwrapUnresolvedTokens(text, validIds) {
|
|
|
12133
12173
|
});
|
|
12134
12174
|
return { text: out, unresolved };
|
|
12135
12175
|
}
|
|
12176
|
+
function rewriteSceneBindings(sv, slotRenames, variationRenames) {
|
|
12177
|
+
if (!sv) return void 0;
|
|
12178
|
+
const out = {};
|
|
12179
|
+
for (const [slotId, variationId] of Object.entries(sv)) {
|
|
12180
|
+
const newSlot = slotRenames[slotId] ?? slotId;
|
|
12181
|
+
out[newSlot] = variationRenames?.[newSlot]?.[variationId] ?? variationId;
|
|
12182
|
+
}
|
|
12183
|
+
return out;
|
|
12184
|
+
}
|
|
12185
|
+
function dropUnknownBindings(sv, validBySlot) {
|
|
12186
|
+
if (!sv) return { dropped: [] };
|
|
12187
|
+
const kept = {};
|
|
12188
|
+
const dropped = [];
|
|
12189
|
+
for (const [slotId, variationId] of Object.entries(sv)) {
|
|
12190
|
+
const valid = validBySlot.get(slotId);
|
|
12191
|
+
if (valid && (variationId === VIDEO_ANALYSIS_DEFAULT_VARIATION || valid.has(variationId))) kept[slotId] = variationId;
|
|
12192
|
+
else dropped.push({ slotId, variationId });
|
|
12193
|
+
}
|
|
12194
|
+
return { kept: Object.keys(kept).length > 0 ? kept : void 0, dropped };
|
|
12195
|
+
}
|
|
12136
12196
|
function renderAnalyzedScene(scene, slots, castMap) {
|
|
12137
12197
|
const byId = new Map(slots.map((s) => [s.slotId, s]));
|
|
12138
12198
|
return scene.visual.replace(SLOT_TOKEN_RE, (_whole, id) => castMap?.[id] ?? byId.get(id)?.description ?? id);
|
|
@@ -12335,6 +12395,7 @@ exports.GENERATE_TEXT_DELIMITER = GENERATE_TEXT_DELIMITER;
|
|
|
12335
12395
|
exports.GLOBAL_MAX_DURATION_SECONDS = GLOBAL_MAX_DURATION_SECONDS;
|
|
12336
12396
|
exports.GROUP_HANDLE_PREFIX = GROUP_HANDLE_PREFIX;
|
|
12337
12397
|
exports.GUIDANCE_SCALE_SUPPORT = GUIDANCE_SCALE_SUPPORT;
|
|
12398
|
+
exports.GVP_SUPPORTED_PROVIDERS = GVP_SUPPORTED_PROVIDERS;
|
|
12338
12399
|
exports.GenerateMotionInputSchema = GenerateMotionInputSchema;
|
|
12339
12400
|
exports.GenerateMotionResultSchema = GenerateMotionResultSchema;
|
|
12340
12401
|
exports.HANDLE_PORT_SEPARATOR = HANDLE_PORT_SEPARATOR;
|
|
@@ -12559,16 +12620,19 @@ exports.VEHICLE_SUBCATEGORY_LABELS = VEHICLE_SUBCATEGORY_LABELS;
|
|
|
12559
12620
|
exports.VEHICLE_SUBCATEGORY_ORDER = VEHICLE_SUBCATEGORY_ORDER;
|
|
12560
12621
|
exports.VEO_PROVIDERS = VEO_PROVIDERS;
|
|
12561
12622
|
exports.VIDEO_ANALYSIS_BUCKET_CREDITS = VIDEO_ANALYSIS_BUCKET_CREDITS;
|
|
12623
|
+
exports.VIDEO_ANALYSIS_DEFAULT_VARIATION = VIDEO_ANALYSIS_DEFAULT_VARIATION;
|
|
12562
12624
|
exports.VIDEO_ANALYSIS_DURATION_BUCKETS = VIDEO_ANALYSIS_DURATION_BUCKETS;
|
|
12563
12625
|
exports.VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC = VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC;
|
|
12564
12626
|
exports.VIDEO_ANALYSIS_ENTITY_SOURCES = VIDEO_ANALYSIS_ENTITY_SOURCES;
|
|
12565
12627
|
exports.VIDEO_ANALYSIS_LLM_MODELS = VIDEO_ANALYSIS_LLM_MODELS;
|
|
12566
12628
|
exports.VIDEO_ANALYSIS_MAX_DURATION_SEC = VIDEO_ANALYSIS_MAX_DURATION_SEC;
|
|
12567
12629
|
exports.VIDEO_ANALYSIS_MAX_SCENE_SEC = VIDEO_ANALYSIS_MAX_SCENE_SEC;
|
|
12630
|
+
exports.VIDEO_ANALYSIS_MAX_VARIATIONS = VIDEO_ANALYSIS_MAX_VARIATIONS;
|
|
12568
12631
|
exports.VIDEO_ANALYSIS_MIXED_TIERS = VIDEO_ANALYSIS_MIXED_TIERS;
|
|
12569
12632
|
exports.VIDEO_ANALYSIS_TIERS = VIDEO_ANALYSIS_TIERS;
|
|
12570
12633
|
exports.VIDEO_ANALYSIS_TIER_LABELS = VIDEO_ANALYSIS_TIER_LABELS;
|
|
12571
12634
|
exports.VIDEO_ANALYSIS_TIER_ORDER = VIDEO_ANALYSIS_TIER_ORDER;
|
|
12635
|
+
exports.VIDEO_ANALYSIS_VARIATION_SLUGS = VIDEO_ANALYSIS_VARIATION_SLUGS;
|
|
12572
12636
|
exports.VIDEO_ANALYSIS_WINDOW = VIDEO_ANALYSIS_WINDOW;
|
|
12573
12637
|
exports.VIDEO_AUDIO_CAPABILITY = VIDEO_AUDIO_CAPABILITY;
|
|
12574
12638
|
exports.VIDEO_CLIP_CREDITS = VIDEO_CLIP_CREDITS;
|
|
@@ -12665,6 +12729,7 @@ exports.deriveSlotRefs = deriveSlotRefs;
|
|
|
12665
12729
|
exports.describeEdgeBehavior = describeEdgeBehavior;
|
|
12666
12730
|
exports.describeMaskRegion = describeMaskRegion;
|
|
12667
12731
|
exports.describeSlotControl = describeSlotControl;
|
|
12732
|
+
exports.dropUnknownBindings = dropUnknownBindings;
|
|
12668
12733
|
exports.durationsByMode = durationsByMode;
|
|
12669
12734
|
exports.effectiveReasoningEffort = effectiveReasoningEffort;
|
|
12670
12735
|
exports.encodeProviderItem = encodeProviderItem;
|
|
@@ -12752,6 +12817,7 @@ exports.isCollectInEdge = isCollectInEdge;
|
|
|
12752
12817
|
exports.isDefaultSelectorConfig = isDefaultSelectorConfig;
|
|
12753
12818
|
exports.isExpandedClone = isExpandedClone;
|
|
12754
12819
|
exports.isFlux2Model = isFlux2Model;
|
|
12820
|
+
exports.isGvpSupportedProvider = isGvpSupportedProvider;
|
|
12755
12821
|
exports.isHandleInputWired = isHandleInputWired;
|
|
12756
12822
|
exports.isKineticCaptionStyle = isKineticCaptionStyle;
|
|
12757
12823
|
exports.isLocationUsageMode = isLocationUsageMode;
|
|
@@ -12845,6 +12911,7 @@ exports.resolveSwitchXCreditId = resolveSwitchXCreditId;
|
|
|
12845
12911
|
exports.resolveVideoAnalysisModel = resolveVideoAnalysisModel;
|
|
12846
12912
|
exports.resolveVideoProviderForMode = resolveVideoProviderForMode;
|
|
12847
12913
|
exports.resolveXfadeName = resolveXfadeName;
|
|
12914
|
+
exports.rewriteSceneBindings = rewriteSceneBindings;
|
|
12848
12915
|
exports.rewriteSlotTokens = rewriteSlotTokens;
|
|
12849
12916
|
exports.rgbaArrayToHex = rgbaArrayToHex;
|
|
12850
12917
|
exports.roleToPhrase = roleToPhrase;
|
|
@@ -12859,6 +12926,7 @@ exports.selectListItems = selectListItems;
|
|
|
12859
12926
|
exports.selectLoraRoutingForMentions = selectLoraRoutingForMentions;
|
|
12860
12927
|
exports.selectRandom = selectRandom;
|
|
12861
12928
|
exports.settledWithLimit = settledWithLimit;
|
|
12929
|
+
exports.slotVariationSchema = slotVariationSchema;
|
|
12862
12930
|
exports.sortCharacterEntriesForDisplay = sortCharacterEntriesForDisplay;
|
|
12863
12931
|
exports.sortListItems = sortListItems;
|
|
12864
12932
|
exports.sourceRefKey = sourceRefKey;
|