@nodaro/shared 1.5.0 → 1.6.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 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1368 -5033
- package/dist/index.d.ts +1368 -5033
- package/dist/index.js +58 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
- package/src/__tests__/character-mention-slug.test.ts +53 -8
- package/src/__tests__/character-picker-display-order.test.ts +68 -0
- package/src/__tests__/entity-image-handle.test.ts +22 -1
- package/src/__tests__/location-mention-slug.test.ts +32 -3
- package/src/__tests__/pipeline-chat.test.ts +2 -2
- package/src/__tests__/reference-roles.test.ts +21 -1
- package/src/character-mention-slug.ts +27 -9
- package/src/character-variant-assets.ts +61 -0
- package/src/entity-asset-types.ts +3 -0
- package/src/entity-image-handle.ts +22 -0
- package/src/index.ts +3 -0
- package/src/location-mention-slug.ts +17 -8
- package/src/pipeline-state-types.ts +1 -1
- package/src/reduce-strategy-registry.ts +2 -2
- package/src/reference-roles.ts +6 -2
- package/src/scene-node-types.ts +1 -1
- package/src/types.ts +12 -2
package/dist/index.cjs
CHANGED
|
@@ -4,8 +4,11 @@ var zod = require('zod');
|
|
|
4
4
|
|
|
5
5
|
// src/types.ts
|
|
6
6
|
var DEFAULT_LABEL_BY_SOURCE = {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
// Media references default to "ref-only" — the empty label, i.e. a bare
|
|
8
|
+
// {image:N} token that injects only "reference image A" (image) / "@image_N"
|
|
9
|
+
// (video) with no descriptive role phrase. Pick a role on the pill to change.
|
|
10
|
+
"manual": "",
|
|
11
|
+
"wired-image": "",
|
|
9
12
|
"wired-character": "person",
|
|
10
13
|
"wired-face": "face",
|
|
11
14
|
"wired-object": "object",
|
|
@@ -8565,8 +8568,11 @@ function parseCharacterMentionToken(text, _knownCharacterSlugs) {
|
|
|
8565
8568
|
}
|
|
8566
8569
|
if (parts.length === 4) {
|
|
8567
8570
|
if (!/^[a-z][a-z0-9-]*$/.test(third)) return null;
|
|
8568
|
-
if (
|
|
8569
|
-
|
|
8571
|
+
if (!/^[a-z][a-z0-9-]*$/.test(fourth)) return null;
|
|
8572
|
+
if (isUsageMode(fourth)) {
|
|
8573
|
+
return { characterSlug, imageIndex, variantSlug: third, usageMode: fourth, ...lockField };
|
|
8574
|
+
}
|
|
8575
|
+
return { characterSlug, imageIndex, variantSlug: third, usageMode: null, role: fourth, ...lockField };
|
|
8570
8576
|
}
|
|
8571
8577
|
return null;
|
|
8572
8578
|
}
|
|
@@ -8641,6 +8647,35 @@ function characterMentionableAssetArrays(data) {
|
|
|
8641
8647
|
boards: characterBoardItems(data)
|
|
8642
8648
|
};
|
|
8643
8649
|
}
|
|
8650
|
+
var CHARACTER_PICKER_DISPLAY_ORDER = [
|
|
8651
|
+
"boards",
|
|
8652
|
+
"sheets",
|
|
8653
|
+
...CHARACTER_VARIANT_ASSET_BUCKETS
|
|
8654
|
+
];
|
|
8655
|
+
function characterBucketDisplayRank(bucket) {
|
|
8656
|
+
if (bucket === void 0) return -1;
|
|
8657
|
+
const i = CHARACTER_PICKER_DISPLAY_ORDER.indexOf(bucket);
|
|
8658
|
+
return i === -1 ? CHARACTER_PICKER_DISPLAY_ORDER.length : i;
|
|
8659
|
+
}
|
|
8660
|
+
function sortCharacterEntriesForDisplay(items) {
|
|
8661
|
+
const out = [];
|
|
8662
|
+
let i = 0;
|
|
8663
|
+
while (i < items.length) {
|
|
8664
|
+
const slug = items[i].characterSlug;
|
|
8665
|
+
if (!slug) {
|
|
8666
|
+
out.push(items[i]);
|
|
8667
|
+
i++;
|
|
8668
|
+
continue;
|
|
8669
|
+
}
|
|
8670
|
+
let j = i;
|
|
8671
|
+
while (j < items.length && items[j].characterSlug === slug) j++;
|
|
8672
|
+
const run = items.slice(i, j);
|
|
8673
|
+
const ranked = run.map((it, k) => ({ it, k, r: characterBucketDisplayRank(it.bucket) })).sort((a, b) => a.r - b.r || a.k - b.k).map((x) => x.it);
|
|
8674
|
+
out.push(...ranked);
|
|
8675
|
+
i = j;
|
|
8676
|
+
}
|
|
8677
|
+
return out;
|
|
8678
|
+
}
|
|
8644
8679
|
|
|
8645
8680
|
// src/location-mention-slug.ts
|
|
8646
8681
|
var LOCATION_USAGE_MODES = [
|
|
@@ -8734,8 +8769,11 @@ function parseLocationMentionToken(text) {
|
|
|
8734
8769
|
const variant = third.slice(slashAt + 1);
|
|
8735
8770
|
if (!/^[a-z][a-z0-9-]*$/.test(bucket)) return null;
|
|
8736
8771
|
if (!/^[a-z][a-z0-9-]*$/.test(variant)) return null;
|
|
8737
|
-
if (
|
|
8738
|
-
|
|
8772
|
+
if (!/^[a-z][a-z0-9-]*$/.test(fourth)) return null;
|
|
8773
|
+
if (isLocationUsageMode(fourth)) {
|
|
8774
|
+
return { locationSlug, imageIndex, bucket, variant, usageMode: fourth, ...lockField };
|
|
8775
|
+
}
|
|
8776
|
+
return { locationSlug, imageIndex, bucket, variant, usageMode: null, role: fourth, ...lockField };
|
|
8739
8777
|
}
|
|
8740
8778
|
return null;
|
|
8741
8779
|
}
|
|
@@ -9059,7 +9097,7 @@ var ShotSpecSchema = zod.z.object({
|
|
|
9059
9097
|
// v4.1 Method 10 — parametric 3D camera path
|
|
9060
9098
|
camera_path_directive: zod.z.object({
|
|
9061
9099
|
path_kind: zod.z.enum(["orbit", "dolly", "crane", "arc", "reveal"]),
|
|
9062
|
-
parameters: zod.z.record(zod.z.unknown()).optional()
|
|
9100
|
+
parameters: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
9063
9101
|
}).optional(),
|
|
9064
9102
|
// ─── Execution state (engine writes; null on planning) ─────────────────────
|
|
9065
9103
|
// Phase 1C.1: per-shot execution state lands directly on the shot record so
|
|
@@ -9804,7 +9842,7 @@ var StageAwaitingSubGateEventSchema = zod.z.object({
|
|
|
9804
9842
|
pipelineId: zod.z.string().uuid(),
|
|
9805
9843
|
stageName: zod.z.enum(["animate_audio_edit", "scene_images"]),
|
|
9806
9844
|
subGate: SubGateNameSchema,
|
|
9807
|
-
payload: zod.z.record(zod.z.unknown()).optional()
|
|
9845
|
+
payload: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
9808
9846
|
});
|
|
9809
9847
|
var PipelineMusicReadyEventSchema = zod.z.object({
|
|
9810
9848
|
type: zod.z.literal("pipeline:music_ready"),
|
|
@@ -11060,7 +11098,10 @@ var CHARACTER_ATTACH_COLUMNS = [
|
|
|
11060
11098
|
// locations don't have an outfit dimension).
|
|
11061
11099
|
"sheets",
|
|
11062
11100
|
"detail_closeups",
|
|
11063
|
-
"outfit_variations"
|
|
11101
|
+
"outfit_variations",
|
|
11102
|
+
// Named composite reference boards (migration 250) — identity-collage
|
|
11103
|
+
// sheets auto-attached by the ffmpeg image-collage worker.
|
|
11104
|
+
"boards"
|
|
11064
11105
|
];
|
|
11065
11106
|
var CHARACTER_ASSET_VARIANTS = {
|
|
11066
11107
|
expressions: [
|
|
@@ -11658,12 +11699,15 @@ function resolveEffectiveSourceType(rawSourceType, sourceHandleId) {
|
|
|
11658
11699
|
}
|
|
11659
11700
|
return rawSourceType ?? "";
|
|
11660
11701
|
}
|
|
11702
|
+
function sourceRefKey(nodeId, sourceHandleId, rawSourceType) {
|
|
11703
|
+
return sourceHandleId === "image" && ENTITY_IMAGE_HANDLE_TYPES.has(rawSourceType ?? "") ? `${nodeId}::image` : nodeId;
|
|
11704
|
+
}
|
|
11661
11705
|
|
|
11662
11706
|
// src/reference-roles.ts
|
|
11663
11707
|
var REFERENCE_ROLE_PRESETS = {
|
|
11664
|
-
"wired-character": ["person", "face", "clothes", "hair", "pose", "expression", "style"],
|
|
11708
|
+
"wired-character": ["ref-only", "person", "face", "clothes", "hair", "pose", "expression", "style"],
|
|
11665
11709
|
"wired-face": ["face", "person", "expression", "style"],
|
|
11666
|
-
"wired-location": ["background", "atmosphere", "as-is", "empty background", "layout", "lighting", "style"],
|
|
11710
|
+
"wired-location": ["ref-only", "background", "atmosphere", "as-is", "empty background", "layout", "lighting", "style"],
|
|
11667
11711
|
"wired-object": ["object", "shape", "material", "color", "texture", "style"],
|
|
11668
11712
|
"wired-creature": ["creature", "anatomy", "markings", "pose", "color", "style"],
|
|
11669
11713
|
"wired-image": ["object", "person", "face", "clothes", "background", "style", "pose", "texture"],
|
|
@@ -11676,6 +11720,8 @@ function roleToPhrase(role, binding) {
|
|
|
11676
11720
|
const r = role.trim();
|
|
11677
11721
|
if (!r) return binding;
|
|
11678
11722
|
switch (r) {
|
|
11723
|
+
case "ref-only":
|
|
11724
|
+
return binding;
|
|
11679
11725
|
case "as-is":
|
|
11680
11726
|
return `${binding}, used as-is`;
|
|
11681
11727
|
case "empty background":
|
|
@@ -11872,6 +11918,7 @@ exports.CHARACTER_FACETS = CHARACTER_FACETS;
|
|
|
11872
11918
|
exports.CHARACTER_FACET_IDS = CHARACTER_FACET_IDS;
|
|
11873
11919
|
exports.CHARACTER_LORA_TRAINING_JOB_TYPE = CHARACTER_LORA_TRAINING_JOB_TYPE;
|
|
11874
11920
|
exports.CHARACTER_MOTION_PROVIDERS = CHARACTER_MOTION_PROVIDERS;
|
|
11921
|
+
exports.CHARACTER_PICKER_DISPLAY_ORDER = CHARACTER_PICKER_DISPLAY_ORDER;
|
|
11875
11922
|
exports.CHARACTER_REFERENCE_PHOTO_KINDS = CHARACTER_REFERENCE_PHOTO_KINDS;
|
|
11876
11923
|
exports.CHARACTER_STYLES = CHARACTER_STYLES;
|
|
11877
11924
|
exports.CHARACTER_VARIANT_ASSET_BUCKETS = CHARACTER_VARIANT_ASSET_BUCKETS;
|
|
@@ -12255,6 +12302,7 @@ exports.calculateMonetizedCost = calculateMonetizedCost;
|
|
|
12255
12302
|
exports.calculateProgress = calculateProgress;
|
|
12256
12303
|
exports.canonicalVarName = canonicalVarName;
|
|
12257
12304
|
exports.characterBoardItems = characterBoardItems;
|
|
12305
|
+
exports.characterBucketDisplayRank = characterBucketDisplayRank;
|
|
12258
12306
|
exports.characterMentionSlug = characterMentionSlug;
|
|
12259
12307
|
exports.characterMentionableAssetArrays = characterMentionableAssetArrays;
|
|
12260
12308
|
exports.characterSheetRefItems = characterSheetRefItems;
|
|
@@ -12468,7 +12516,9 @@ exports.selectListItems = selectListItems;
|
|
|
12468
12516
|
exports.selectLoraRoutingForMentions = selectLoraRoutingForMentions;
|
|
12469
12517
|
exports.selectRandom = selectRandom;
|
|
12470
12518
|
exports.settledWithLimit = settledWithLimit;
|
|
12519
|
+
exports.sortCharacterEntriesForDisplay = sortCharacterEntriesForDisplay;
|
|
12471
12520
|
exports.sortListItems = sortListItems;
|
|
12521
|
+
exports.sourceRefKey = sourceRefKey;
|
|
12472
12522
|
exports.spliceDelimitedRows = spliceDelimitedRows;
|
|
12473
12523
|
exports.splitByLoopDelimiter = splitByLoopDelimiter;
|
|
12474
12524
|
exports.splitGeneratedItems = splitGeneratedItems;
|