@nodaro/shared 3.24.0 → 3.26.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 +1086 -257
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +531 -97
- package/dist/index.d.ts +531 -97
- package/dist/index.js +1034 -258
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/condition-variables.test.ts +12 -0
- package/src/__tests__/content-recipe-ideas.test.ts +9 -4
- package/src/__tests__/credit-identifiers.test.ts +31 -6
- package/src/__tests__/dialogue-capabilities.test.ts +3 -2
- package/src/__tests__/edit-plan-minute-ids.test.ts +82 -0
- package/src/__tests__/image-model-roles.test.ts +57 -0
- package/src/__tests__/image-ref-limit.test.ts +1 -0
- package/src/__tests__/json-kinds.test.ts +179 -0
- package/src/__tests__/llm-models.test.ts +136 -37
- package/src/__tests__/lone-media-url.test.ts +78 -0
- package/src/__tests__/presentation-utils.test.ts +1 -0
- package/src/__tests__/preview-gate.test.ts +2 -2
- package/src/__tests__/pricing-default-duration.test.ts +56 -15
- package/src/__tests__/private-host.test.ts +24 -0
- package/src/__tests__/prompt-length-limits.test.ts +2 -0
- package/src/__tests__/render-nodes.test.ts +22 -3
- package/src/__tests__/tts-capabilities.test.ts +61 -1
- package/src/__tests__/video-link-input.test.ts +148 -0
- package/src/__tests__/video-link-needs.test.ts +67 -0
- package/src/__tests__/video-request-normalize.test.ts +18 -3
- package/src/condition-variables.ts +3 -1
- package/src/content-recipe-ideas.ts +5 -2
- package/src/credit-identifiers.ts +48 -37
- package/src/edit-plan-contract.ts +67 -1
- package/src/fan-out-rows.ts +2 -2
- package/src/image-model-roles.ts +62 -0
- package/src/index.ts +59 -1
- package/src/json-kinds.ts +188 -0
- package/src/llm-models.ts +348 -23
- package/src/lone-media-url.ts +57 -0
- package/src/model-catalog.ts +160 -13
- package/src/model-constants.ts +79 -43
- package/src/node-default-mappings.ts +4 -0
- package/src/pipeline-types.ts +13 -2
- package/src/presentation-utils.ts +8 -1
- package/src/private-host.ts +91 -0
- package/src/producer-types.ts +3 -0
- package/src/render-nodes.ts +12 -1
- package/src/scene-node-types.ts +17 -5
- package/src/settings-input.ts +2 -1
- package/src/social-post-readers.ts +37 -0
- package/src/video-link.ts +238 -0
- package/src/voices.ts +16 -9
package/src/index.ts
CHANGED
|
@@ -186,6 +186,8 @@ export {
|
|
|
186
186
|
applyDefaultVideoSelection,
|
|
187
187
|
PRICING_DEFAULT_DURATION_SEC,
|
|
188
188
|
pricedOutputDurationSec,
|
|
189
|
+
snapToNearestDuration,
|
|
190
|
+
videoDefaultDurationSec,
|
|
189
191
|
supportsAutoVideoDuration,
|
|
190
192
|
maxVideoDurationSec,
|
|
191
193
|
PRICING_DEFAULT_RESOLUTION,
|
|
@@ -299,6 +301,7 @@ export {
|
|
|
299
301
|
buildMotionCreditModelIdentifier,
|
|
300
302
|
speedRampCreditId,
|
|
301
303
|
applyEdlCreditId,
|
|
304
|
+
speakerViewCreditId,
|
|
302
305
|
sunoCreditType,
|
|
303
306
|
SUNO_VERSION_CREDIT_KEYS,
|
|
304
307
|
SUNO_VERSION_PRICED_OPERATIONS,
|
|
@@ -407,6 +410,11 @@ export {
|
|
|
407
410
|
buildLlmCreditIdentifier,
|
|
408
411
|
resolveLlmCreditId,
|
|
409
412
|
supportsAdvancedMode,
|
|
413
|
+
llmServesDirect,
|
|
414
|
+
LLM_CREDIT_RUNGS,
|
|
415
|
+
type LlmCreditRung,
|
|
416
|
+
llmCreditIdForRung,
|
|
417
|
+
llmTierCreditIds,
|
|
410
418
|
availableReasoningEfforts,
|
|
411
419
|
LLM_ROUTE_DEFAULTS,
|
|
412
420
|
llmRouteDefaults,
|
|
@@ -763,6 +771,17 @@ export {
|
|
|
763
771
|
type RenderClockSource,
|
|
764
772
|
type RenderJsonKind,
|
|
765
773
|
} from "./render-nodes.js"
|
|
774
|
+
export {
|
|
775
|
+
declaredJsonOutput,
|
|
776
|
+
declaredJsonOutputRows,
|
|
777
|
+
jsonOutputKind,
|
|
778
|
+
jsonInputKind,
|
|
779
|
+
jsonKindMismatch,
|
|
780
|
+
jsonKindMismatchMessage,
|
|
781
|
+
type JsonKind,
|
|
782
|
+
type JsonKindMismatch,
|
|
783
|
+
type JsonOutputDeclaration,
|
|
784
|
+
} from "./json-kinds.js"
|
|
766
785
|
export {
|
|
767
786
|
PREVIEW_RENDER_NODE_TYPES,
|
|
768
787
|
PREVIEW_REVIEW_REQUIRED,
|
|
@@ -997,6 +1016,23 @@ export {
|
|
|
997
1016
|
type SavedPostsLookupResult,
|
|
998
1017
|
} from "./saved-posts.js"
|
|
999
1018
|
|
|
1019
|
+
// Read Inspiration / Read Competitor: the post readers (emit posts the way Social Search does).
|
|
1020
|
+
export {
|
|
1021
|
+
INSPIRATION_READ_NODE_TYPE,
|
|
1022
|
+
COMPETITOR_READ_NODE_TYPE,
|
|
1023
|
+
SOCIAL_POST_READER_NODE_TYPES,
|
|
1024
|
+
isSocialPostReaderNodeType,
|
|
1025
|
+
SOCIAL_READ_LIMIT_MAX,
|
|
1026
|
+
SOCIAL_READ_DEFAULT_LIMIT,
|
|
1027
|
+
SOCIAL_READ_WINDOW_HOURS_MAX,
|
|
1028
|
+
SOCIAL_READ_WINDOW_DAYS_MAX,
|
|
1029
|
+
SOCIAL_READ_PERIODS,
|
|
1030
|
+
COMPETITOR_READ_ROLES,
|
|
1031
|
+
SOCIAL_READ_DAY_PATTERN,
|
|
1032
|
+
type SocialReadPeriod,
|
|
1033
|
+
type CompetitorReadRole,
|
|
1034
|
+
} from "./social-post-readers.js"
|
|
1035
|
+
|
|
1000
1036
|
export {
|
|
1001
1037
|
COLLECTION_NAME_MAX,
|
|
1002
1038
|
COLLECTION_DESCRIPTION_MAX,
|
|
@@ -1305,6 +1341,13 @@ export {
|
|
|
1305
1341
|
// Per-model safety-filter retry/fallback policy (derives from
|
|
1306
1342
|
// `ModelCatalogEntry.safetyFilter` above).
|
|
1307
1343
|
export { safetyRetryPolicy } from "./safety-retry-policy.js"
|
|
1344
|
+
export {
|
|
1345
|
+
IMAGE_MODEL_ROLE_DEFAULTS,
|
|
1346
|
+
IMAGE_MODEL_RATIO_FALLBACKS,
|
|
1347
|
+
defaultImageModel,
|
|
1348
|
+
imageModelDrawsRatio,
|
|
1349
|
+
} from "./image-model-roles.js"
|
|
1350
|
+
export type { ImageModelRole } from "./image-model-roles.js"
|
|
1308
1351
|
export type { SafetyRetryPolicy } from "./safety-retry-policy.js"
|
|
1309
1352
|
|
|
1310
1353
|
export {
|
|
@@ -1536,14 +1579,23 @@ export {
|
|
|
1536
1579
|
|
|
1537
1580
|
export * from "./fan-out-meta.js"
|
|
1538
1581
|
|
|
1582
|
+
export { loneMediaUrlKind, isLoneMediaLinkSource } from "./lone-media-url.js"
|
|
1583
|
+
export type { LoneMediaUrlKind } from "./lone-media-url.js"
|
|
1539
1584
|
export { SUNO_TRACK_SOURCE_TYPES } from "./suno-track-sources.js"
|
|
1540
1585
|
|
|
1586
|
+
export { isPrivateOrReservedIP, isLocalOrPrivateHostname } from "./private-host.js"
|
|
1587
|
+
|
|
1541
1588
|
// --- Video URL node + social-video import (host allowlist, node output rule) ---
|
|
1542
1589
|
export {
|
|
1543
1590
|
SOCIAL_VIDEO_HOSTS,
|
|
1544
1591
|
YOUTUBE_HOSTS,
|
|
1545
1592
|
INSTAGRAM_HOSTS,
|
|
1546
1593
|
VIDEO_LINK_TOLERANT_CONSUMER_TYPES,
|
|
1594
|
+
VIDEO_LINK_AUDIO_CONSUMER_TYPES,
|
|
1595
|
+
videoLinkNeedOf,
|
|
1596
|
+
videoLinkRunNeeds,
|
|
1597
|
+
AUTO_DOWNLOAD_MAX_SEC,
|
|
1598
|
+
YOUTUBE_MAX_HEIGHT,
|
|
1547
1599
|
hostnameMatchesAllowlist,
|
|
1548
1600
|
hasUrlParserHazard,
|
|
1549
1601
|
isSocialVideoUrl,
|
|
@@ -1552,8 +1604,14 @@ export {
|
|
|
1552
1604
|
resolveVideoLinkOutput,
|
|
1553
1605
|
videoLinkPageUrl,
|
|
1554
1606
|
videoLinkNeedsDownload,
|
|
1607
|
+
DIRECT_VIDEO_EXTENSIONS,
|
|
1608
|
+
MAX_VIDEO_LINK_INPUT_CHARS,
|
|
1609
|
+
VIDEO_LINK_DERIVED_FIELDS,
|
|
1610
|
+
isDirectVideoFileUrl,
|
|
1611
|
+
videoLinkInputProblem,
|
|
1612
|
+
dropStaleVideoLinkFields,
|
|
1555
1613
|
} from "./video-link.js"
|
|
1556
|
-
export type { VideoLinkPlatform, VideoLinkNodeFields } from "./video-link.js"
|
|
1614
|
+
export type { VideoLinkPlatform, VideoLinkNodeFields, VideoLinkInputProblem, VideoLinkNeed, VideoLinkGraphNode, VideoLinkGraphEdge } from "./video-link.js"
|
|
1557
1615
|
|
|
1558
1616
|
export {
|
|
1559
1617
|
VOICE_CHANGER_MODELS,
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a JSON pip CARRIES — the handle typing behind "an EDL is not a
|
|
3
|
+
* transcript" (decided 2026-10-07) and its reverse, "a transcript is not an
|
|
4
|
+
* EDL" (decided 2026-10-08).
|
|
5
|
+
*
|
|
6
|
+
* Every JSON output colours the same "look" data pip, so a validator that sees
|
|
7
|
+
* only the source NODE type cannot tell Edit Plan's edit list from a
|
|
8
|
+
* Transcribe's transcript. Wired into Add Captions' Transcript input, the edit
|
|
9
|
+
* list is accepted at connect time and only fails (or captions nothing) at run
|
|
10
|
+
* time. This module is the one place that knows the difference, read by the
|
|
11
|
+
* canvas validators and the server's edge normalization alike (MCP workflow
|
|
12
|
+
* writes, the REST delta lane, the Copilot).
|
|
13
|
+
*
|
|
14
|
+
* Output kinds are DATA, never a list of node names:
|
|
15
|
+
* - a render node's `json` pip answers its registry `jsonKind`
|
|
16
|
+
* (`RENDER_NODE_TYPES`), so a render registered later — Speaker View, whose
|
|
17
|
+
* json is an EDL — is covered by its own registry entry;
|
|
18
|
+
* - the other JSON producers declare a kind per output pip in
|
|
19
|
+
* `JSON_OUTPUT_KINDS` below. EVERY node with a JSON output declares one
|
|
20
|
+
* (decided 2026-10-08): `transcript`, `edl`, or `other` for JSON that is
|
|
21
|
+
* neither (a scrape, an analysis, a collection). `other` is a positive
|
|
22
|
+
* statement, not a gap — it connects exactly as an undeclared pip always
|
|
23
|
+
* has. A guard test enumerates the node definitions' JSON pips and fails
|
|
24
|
+
* on one with no declaration, so a new JSON node cannot ship unclassified
|
|
25
|
+
* and a Transcript producer cannot slip past the EDL/Transcript block.
|
|
26
|
+
* Input kinds follow the platform's handle vocabulary: a `transcript` pip
|
|
27
|
+
* expects a Transcript, an `edl` pip an EDL.
|
|
28
|
+
*/
|
|
29
|
+
import { RENDER_NODE_TYPES, type RenderNodeDescriptor } from "./render-nodes.js"
|
|
30
|
+
|
|
31
|
+
/** The two JSON shapes the platform's handle vocabulary tells apart. */
|
|
32
|
+
export type JsonKind = "transcript" | "edl"
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* What a JSON output pip DECLARES: one of the two kinds, or `other` — JSON that
|
|
36
|
+
* is neither a Transcript nor an EDL. Only `JsonKind` ever takes part in a
|
|
37
|
+
* connection check; `other` records that the pip was classified.
|
|
38
|
+
*/
|
|
39
|
+
export type JsonOutputDeclaration = JsonKind | "other"
|
|
40
|
+
|
|
41
|
+
interface JsonOutputs {
|
|
42
|
+
/** The pip an edge with no `sourceHandle` reads — absent when that read is not JSON (Text to Dialogue's is its audio). */
|
|
43
|
+
readonly primary?: string
|
|
44
|
+
readonly pips: Readonly<Record<string, JsonOutputDeclaration>>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** JSON outputs of the nodes that are not renders: pip id → what it carries. */
|
|
48
|
+
const JSON_OUTPUT_KINDS: Readonly<Record<string, JsonOutputs>> = Object.freeze({
|
|
49
|
+
// Edit Plan: the plan on `edl` — a Tighten EDL, a clip set (`Edl[]`) or a chapter list.
|
|
50
|
+
"edit-plan": { primary: "edl", pips: { edl: "edl" } },
|
|
51
|
+
// Transcribe: its json is the normalized Transcript (its `text` pip is plain text, no kind).
|
|
52
|
+
transcribe: { primary: "json", pips: { json: "transcript" } },
|
|
53
|
+
// Camera Switch: the switched edit and the renamed (still a Transcript) transcript.
|
|
54
|
+
"camera-switch": { primary: "edl", pips: { edl: "edl", transcript: "transcript" } },
|
|
55
|
+
// Text to Dialogue: the Transcript built from the model's own word timings (its default read is the audio).
|
|
56
|
+
"text-to-dialogue": { pips: { json: "transcript" } },
|
|
57
|
+
|
|
58
|
+
// ── JSON that is neither a Transcript nor an EDL (decided 2026-10-08) ──
|
|
59
|
+
// Forced Alignment: `{ alignment: [{ word, start, end }] }` in seconds — a word list, not a Transcript.
|
|
60
|
+
"forced-alignment": { primary: "data", pips: { data: "other" } },
|
|
61
|
+
// Video Analysis / Video Audit: the canonical analysis result (an audit IS an analysis).
|
|
62
|
+
"video-analysis": { primary: "json", pips: { json: "other" } },
|
|
63
|
+
"video-audit": { primary: "json", pips: { json: "other" } },
|
|
64
|
+
// Silence Detect: `{ version, ranges, durationMs }`. Audio Sync: `{ version, reference, offsets, notes }`.
|
|
65
|
+
"silence-detect": { primary: "json", pips: { json: "other" } },
|
|
66
|
+
"audio-sync": { primary: "json", pips: { json: "other" } },
|
|
67
|
+
// Scrapers and searches: the scraped page / ad array / post list.
|
|
68
|
+
"web-scrape": { primary: "json", pips: { json: "other" } },
|
|
69
|
+
"meta-ads-scrape": { primary: "json", pips: { json: "other" } },
|
|
70
|
+
"instagram-scrape": { primary: "json", pips: { json: "other" } },
|
|
71
|
+
"social-search": { primary: "json", pips: { json: "other" } },
|
|
72
|
+
"telegram-channel-feed": { primary: "json", pips: { json: "other" } },
|
|
73
|
+
// Content Recipe: the recipe's structured result.
|
|
74
|
+
"content-recipe": { primary: "json", pips: { json: "other" } },
|
|
75
|
+
// Collections and libraries: the stored rows, whatever the user keeps in them.
|
|
76
|
+
"collection-read": { primary: "json", pips: { json: "other" } },
|
|
77
|
+
"collection-write": { primary: "json", pips: { json: "other" } },
|
|
78
|
+
"inspiration-read": { primary: "json", pips: { json: "other" } },
|
|
79
|
+
"competitor-read": { primary: "json", pips: { json: "other" } },
|
|
80
|
+
// Describe to Picker: the picker values read off an image.
|
|
81
|
+
"describe-to-picker": { primary: "picker-json", pips: { "picker-json": "other" } },
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
/** The pip a render's order reads/writes its json on. */
|
|
85
|
+
const RENDER_JSON_PIP = "json"
|
|
86
|
+
|
|
87
|
+
/** The input pips whose kind is fixed by the handle vocabulary. */
|
|
88
|
+
const JSON_INPUT_KINDS: Readonly<Record<string, JsonKind>> = Object.freeze({
|
|
89
|
+
transcript: "transcript",
|
|
90
|
+
edl: "edl",
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const own = <T>(table: Readonly<Record<string, T>>, key: string): T | undefined =>
|
|
94
|
+
Object.hasOwn(table, key) ? table[key] : undefined
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* What the JSON output `sourceHandle` of a node of `nodeType` DECLARES —
|
|
98
|
+
* `transcript`, `edl`, `other` — or `undefined` when the pip is not declared at
|
|
99
|
+
* all (a non-JSON pip, an unknown handle, an unregistered node). `renders` is
|
|
100
|
+
* the render-node registry (injectable for tests). The guard test reads this to
|
|
101
|
+
* prove every JSON pip is classified.
|
|
102
|
+
*/
|
|
103
|
+
export function declaredJsonOutput(
|
|
104
|
+
nodeType: string | null | undefined,
|
|
105
|
+
sourceHandle: string | null | undefined,
|
|
106
|
+
renders: Readonly<Record<string, RenderNodeDescriptor>> = RENDER_NODE_TYPES,
|
|
107
|
+
): JsonOutputDeclaration | undefined {
|
|
108
|
+
if (typeof nodeType !== "string") return undefined
|
|
109
|
+
const render = own(renders, nodeType)
|
|
110
|
+
if (render) return (sourceHandle ?? RENDER_JSON_PIP) === RENDER_JSON_PIP ? render.jsonKind : undefined
|
|
111
|
+
const outputs = own(JSON_OUTPUT_KINDS, nodeType)
|
|
112
|
+
if (!outputs) return undefined
|
|
113
|
+
const pip = sourceHandle ?? outputs.primary
|
|
114
|
+
return typeof pip === "string" ? own(outputs.pips, pip) : undefined
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** The declared JSON output pips of the non-render nodes, as `[nodeType, pipId, declaration]` rows. */
|
|
118
|
+
export function declaredJsonOutputRows(): ReadonlyArray<readonly [string, string, JsonOutputDeclaration]> {
|
|
119
|
+
return Object.entries(JSON_OUTPUT_KINDS).flatMap(([type, o]) =>
|
|
120
|
+
Object.entries(o.pips).map(([pip, kind]) => [type, pip, kind] as const),
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* What the JSON output `sourceHandle` of a node of `nodeType` carries, or
|
|
126
|
+
* `undefined` when it is not known to carry one of the two kinds (anything
|
|
127
|
+
* declared `other`, a non-JSON pip, anything unregistered).
|
|
128
|
+
*/
|
|
129
|
+
export function jsonOutputKind(
|
|
130
|
+
nodeType: string | null | undefined,
|
|
131
|
+
sourceHandle: string | null | undefined,
|
|
132
|
+
renders: Readonly<Record<string, RenderNodeDescriptor>> = RENDER_NODE_TYPES,
|
|
133
|
+
): JsonKind | undefined {
|
|
134
|
+
const declared = declaredJsonOutput(nodeType, sourceHandle, renders)
|
|
135
|
+
return declared === "other" ? undefined : declared
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** What the JSON input `targetHandle` of a node expects, or `undefined`. */
|
|
139
|
+
export function jsonInputKind(
|
|
140
|
+
_nodeType: string | null | undefined,
|
|
141
|
+
targetHandle: string | null | undefined,
|
|
142
|
+
): JsonKind | undefined {
|
|
143
|
+
return typeof targetHandle === "string" ? own(JSON_INPUT_KINDS, targetHandle) : undefined
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface JsonKindMismatch {
|
|
147
|
+
readonly output: JsonKind
|
|
148
|
+
readonly input: JsonKind
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The connections this blocks: a JSON output of one kind wired into an input of
|
|
153
|
+
* the other (decided 2026-10-07 / 2026-10-08) — an EDL into a Transcript input
|
|
154
|
+
* and a Transcript into an EDL input. Both directions read the same two
|
|
155
|
+
* tables. `null` for every other pair — including pairs it cannot classify,
|
|
156
|
+
* which keep today's behaviour.
|
|
157
|
+
*/
|
|
158
|
+
export function jsonKindMismatch(
|
|
159
|
+
sourceType: string | null | undefined,
|
|
160
|
+
sourceHandle: string | null | undefined,
|
|
161
|
+
targetType: string | null | undefined,
|
|
162
|
+
targetHandle: string | null | undefined,
|
|
163
|
+
renders: Readonly<Record<string, RenderNodeDescriptor>> = RENDER_NODE_TYPES,
|
|
164
|
+
): JsonKindMismatch | null {
|
|
165
|
+
const input = jsonInputKind(targetType, targetHandle)
|
|
166
|
+
if (!input) return null
|
|
167
|
+
const output = jsonOutputKind(sourceType, sourceHandle, renders)
|
|
168
|
+
return output && output !== input ? { output, input } : null
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** The sentence a rejected connection is explained with. */
|
|
172
|
+
export function jsonKindMismatchMessage(
|
|
173
|
+
mismatch: JsonKindMismatch,
|
|
174
|
+
labels: { readonly sourceLabel?: string; readonly targetLabel?: string } = {},
|
|
175
|
+
): string {
|
|
176
|
+
const source = labels.sourceLabel ?? "This output"
|
|
177
|
+
const target = labels.targetLabel ?? "this node"
|
|
178
|
+
if (mismatch.output === "transcript") {
|
|
179
|
+
return (
|
|
180
|
+
`${source} outputs a transcript, not an edit list (EDL), so it cannot feed the EDL input of ${target}. ` +
|
|
181
|
+
`Wire an Edit Plan's or Camera Switch's edl there instead.`
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
return (
|
|
185
|
+
`${source} outputs an edit list (EDL), not a transcript, so it cannot feed the Transcript input of ${target}. ` +
|
|
186
|
+
`Wire a Transcribe node's json (or Apply EDL's or Camera Switch's transcript) there instead.`
|
|
187
|
+
)
|
|
188
|
+
}
|