@nodaro/shared 3.54.0 → 3.54.1

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.
Files changed (55) hide show
  1. package/dist/{chunk-NEIWY6CC.cjs → chunk-6HUWQLF2.cjs} +6 -6
  2. package/dist/{chunk-NEIWY6CC.cjs.map → chunk-6HUWQLF2.cjs.map} +1 -1
  3. package/dist/{chunk-ND3IE3IB.cjs → chunk-G7IUQKRU.cjs} +17 -17
  4. package/dist/{chunk-ND3IE3IB.cjs.map → chunk-G7IUQKRU.cjs.map} +1 -1
  5. package/dist/{chunk-IB5B3EBD.js → chunk-JCNTNAZP.js} +13 -7
  6. package/dist/chunk-JCNTNAZP.js.map +1 -0
  7. package/dist/{chunk-6F6GGX2W.cjs → chunk-M7LU4NTI.cjs} +3 -2
  8. package/dist/chunk-M7LU4NTI.cjs.map +1 -0
  9. package/dist/{chunk-6UR5UE5G.js → chunk-MCIBQ5BF.js} +3 -3
  10. package/dist/{chunk-6UR5UE5G.js.map → chunk-MCIBQ5BF.js.map} +1 -1
  11. package/dist/{chunk-C4R7BTBQ.js → chunk-TADEEG5E.js} +3 -2
  12. package/dist/chunk-TADEEG5E.js.map +1 -0
  13. package/dist/{chunk-ADWIAQQS.js → chunk-UWMXMLMV.js} +3 -3
  14. package/dist/{chunk-ADWIAQQS.js.map → chunk-UWMXMLMV.js.map} +1 -1
  15. package/dist/{chunk-3GMTGX3D.cjs → chunk-WVACGZYV.cjs} +4 -4
  16. package/dist/{chunk-3GMTGX3D.cjs.map → chunk-WVACGZYV.cjs.map} +1 -1
  17. package/dist/{chunk-ANMCMSGR.cjs → chunk-YTXP4VHD.cjs} +13 -7
  18. package/dist/chunk-YTXP4VHD.cjs.map +1 -0
  19. package/dist/{chunk-NMX6HQC3.js → chunk-ZAK276QF.js} +3 -3
  20. package/dist/{chunk-NMX6HQC3.js.map → chunk-ZAK276QF.js.map} +1 -1
  21. package/dist/entries/apps.cjs +38 -38
  22. package/dist/entries/apps.js +3 -3
  23. package/dist/entries/i18n.cjs +11 -11
  24. package/dist/entries/i18n.d.cts +5 -4
  25. package/dist/entries/i18n.d.ts +5 -4
  26. package/dist/entries/i18n.js +1 -1
  27. package/dist/entries/nodes.cjs +199 -199
  28. package/dist/entries/nodes.js +3 -3
  29. package/dist/entries/video.cjs +24 -24
  30. package/dist/entries/video.d.cts +11 -10
  31. package/dist/entries/video.d.ts +11 -10
  32. package/dist/entries/video.js +1 -1
  33. package/dist/index.cjs +269 -269
  34. package/dist/index.js +5 -5
  35. package/package.json +1 -1
  36. package/src/__tests__/entry-matches-query.test.ts +34 -0
  37. package/src/__tests__/video-link-needs.test.ts +23 -4
  38. package/src/__tests__/video-link.test.ts +1 -1
  39. package/src/i18n/index.ts +6 -4
  40. package/src/i18n/style.ar.ts +1 -1
  41. package/src/i18n/style.de.ts +1 -1
  42. package/src/i18n/style.es.ts +1 -1
  43. package/src/i18n/style.fr.ts +1 -1
  44. package/src/i18n/style.he.ts +1 -1
  45. package/src/i18n/style.hi.ts +1 -1
  46. package/src/i18n/style.ja.ts +1 -1
  47. package/src/i18n/style.ko.ts +1 -1
  48. package/src/i18n/style.pt-BR.ts +1 -1
  49. package/src/i18n/style.ru.ts +1 -1
  50. package/src/i18n/style.zh-CN.ts +1 -1
  51. package/src/video-link.ts +35 -15
  52. package/dist/chunk-6F6GGX2W.cjs.map +0 -1
  53. package/dist/chunk-ANMCMSGR.cjs.map +0 -1
  54. package/dist/chunk-C4R7BTBQ.js.map +0 -1
  55. package/dist/chunk-IB5B3EBD.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/i18n/types.ts","../src/i18n/index.ts"],"names":[],"mappings":";AA6DA,IAAM,cAAA,GAAiB;AAAA,EACrB,EAAE,EAAA,EAAI,IAAA,EAAS,WAAA,EAAa,SAAA,EAAwB,YAAY,SAAA,EAAmB,SAAA,EAAW,IAAA,EAAO,GAAA,EAAK,KAAA,EAAM;AAAA,EAChH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AA,IAAI,IAAI,OAAA,IAAW,OAAO,IAAI,OAAA,KAAY,QAAA,SAAiB,GAAA,CAAI,OAAA;AAE/D,IAAA,MAAM,eAAe,CAAA,EAAG,OAAA,CAAQ,WAAA,EAAY,CAAE,QAAQ,IAAA,EAAM,GAAG,CAAC,CAAA,CAAA,EAAI,OAAO,WAAA,EAAY,CAAE,OAAA,CAAQ,IAAA,EAAM,GAAG,CAAC,CAAA,CAAA;AAC3G,IAAA,MAAM,KAAA,GAAQ,IAAI,YAAY,CAAA;AAC9B,IAAA,IAAI,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,KAAA;AAC/C,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"chunk-C4R7BTBQ.js","sourcesContent":["/**\n * i18n types and language registry for parameter-node pickers.\n *\n * Architecture:\n * - English is the canonical source — every catalog entry has its `label` and\n * `description` in English in the catalog file itself.\n * - Non-English translations live in sidecar files under\n * `packages/shared/src/i18n/<catalog>.<locale>.ts`.\n * - Each sidecar exports a `Record<id, LocalizedEntry>` keyed by entry id.\n * - Lazy-loaded per locale via dynamic import so users only download languages\n * they actually use.\n *\n * Translation rules (see picker-i18n design doc):\n * - `id` and `promptHint` are NEVER translated.\n * - `label` is translated when it's a common noun/adjective (e.g. \"Smoky Eye\"\n * → \"Ojo Ahumado\"). Proper names, brand names, model numbers, technical\n * units, and Latin/Italian/Japanese cinematography jargon stay in their\n * canonical form (e.g. Tim Walker, Sony A7III, chiaroscuro, anamorphic,\n * Y2K, ukiyo-e).\n * - `description` is translated freely, with proper nouns preserved inside.\n *\n * Search rule: pickers filter on the union of current-locale + English text,\n * so a French user typing \"soie\" finds \"Silk\" AND a French user typing \"silk\"\n * still finds it.\n */\n\n/** Canonical language code (BCP-47 or simplified two-letter). */\nexport type LocaleId =\n | \"en\"\n | \"es\"\n | \"fr\"\n | \"de\"\n | \"pt-BR\"\n | \"ru\"\n | \"hi\"\n | \"ja\"\n | \"ko\"\n | \"zh-CN\"\n | \"he\"\n | \"ar\"\n\n/** Reading direction. RTL languages need `dir=\"rtl\"` on the picker container. */\nexport type LocaleDirection = \"ltr\" | \"rtl\"\n\nexport interface LanguageDefinition {\n readonly id: LocaleId\n /** English name shown in language pickers when current locale is English. */\n readonly englishName: string\n /** Native name shown to native speakers (in their own script). */\n readonly nativeName: string\n /** Two-letter or short code displayed inside the small locale chip. */\n readonly shortCode: string\n /** Reading direction. */\n readonly dir: LocaleDirection\n}\n\n/**\n * Master language registry. Order = display order in the language picker\n * dropdown. English first as canonical default, then mainstream LTR\n * languages, then RTL languages last.\n */\nconst LANGUAGE_TABLE = [\n { id: \"en\", englishName: \"English\", nativeName: \"English\", shortCode: \"EN\", dir: \"ltr\" },\n { id: \"es\", englishName: \"Spanish\", nativeName: \"Español\", shortCode: \"ES\", dir: \"ltr\" },\n { id: \"fr\", englishName: \"French\", nativeName: \"Français\", shortCode: \"FR\", dir: \"ltr\" },\n { id: \"de\", englishName: \"German\", nativeName: \"Deutsch\", shortCode: \"DE\", dir: \"ltr\" },\n { id: \"pt-BR\", englishName: \"Portuguese (Brazil)\", nativeName: \"Português\", shortCode: \"PT\", dir: \"ltr\" },\n { id: \"ru\", englishName: \"Russian\", nativeName: \"Русский\", shortCode: \"RU\", dir: \"ltr\" },\n { id: \"hi\", englishName: \"Hindi\", nativeName: \"हिन्दी\", shortCode: \"HI\", dir: \"ltr\" },\n { id: \"ja\", englishName: \"Japanese\", nativeName: \"日本語\", shortCode: \"JA\", dir: \"ltr\" },\n { id: \"ko\", englishName: \"Korean\", nativeName: \"한국어\", shortCode: \"KO\", dir: \"ltr\" },\n { id: \"zh-CN\", englishName: \"Chinese (Simplified)\", nativeName: \"简体中文\", shortCode: \"ZH\", dir: \"ltr\" },\n { id: \"he\", englishName: \"Hebrew\", nativeName: \"עברית\", shortCode: \"HE\", dir: \"rtl\" },\n { id: \"ar\", englishName: \"Arabic\", nativeName: \"العربية\", shortCode: \"AR\", dir: \"rtl\" },\n] as const satisfies ReadonlyArray<LanguageDefinition>\n\nexport const LANGUAGES: ReadonlyArray<LanguageDefinition> = LANGUAGE_TABLE\n\n// Compile-time: the registry's ids are exactly the LocaleId union. `satisfies`\n// above rejects an id that is not a LocaleId; this rejects a LocaleId with no\n// LANGUAGES entry (the error names the missing ids). Types only: nothing is\n// emitted or exported.\ntype LocaleIdsWithoutALanguage = Exclude<LocaleId, (typeof LANGUAGE_TABLE)[number][\"id\"]>\ntype MustBeNever<T extends never> = T\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype EveryLocaleIdHasALanguage = MustBeNever<LocaleIdsWithoutALanguage>\n\nexport const LOCALE_IDS: ReadonlyArray<LocaleId> = LANGUAGES.map((l) => l.id)\nexport const NON_EN_LOCALE_IDS: ReadonlyArray<Exclude<LocaleId, \"en\">> = LANGUAGES\n .filter((l) => l.id !== \"en\")\n .map((l) => l.id) as ReadonlyArray<Exclude<LocaleId, \"en\">>\n\nconst languageById = new Map<LocaleId, LanguageDefinition>(LANGUAGES.map((l) => [l.id, l]))\n\nexport function getLanguage(id: string | undefined | null): LanguageDefinition | undefined {\n if (!id) return undefined\n return languageById.get(id as LocaleId)\n}\n\nexport function getLocaleDirection(id: string | undefined | null): LocaleDirection {\n return getLanguage(id)?.dir ?? \"ltr\"\n}\n\nexport function isRTL(id: string | undefined | null): boolean {\n return getLocaleDirection(id) === \"rtl\"\n}\n\n/**\n * A single localized entry. Either or both fields may be missing — the\n * resolver falls back to the canonical English `label` / `description` from\n * the catalog when a field is absent.\n */\nexport interface LocalizedEntry {\n readonly label?: string\n readonly description?: string\n}\n\n/** Map shape exported by every sidecar file (`<catalog>.<locale>.ts`). */\nexport type LocaleCatalogMap = Readonly<Record<string, LocalizedEntry>>\n\n/**\n * The catalogs that have i18n sidecar files. Each name corresponds to a\n * shared catalog file (e.g. \"mood\" → `packages/shared/src/mood.ts`).\n */\nexport const I18N_CATALOGS = [\n \"action-fx\",\n \"aesthetic\",\n \"animals\",\n \"atmosphere\",\n \"backdrop\",\n \"camera-format\",\n \"camera-motions\",\n \"character-fx\",\n \"character-motion\",\n \"color-look\",\n \"composition-effects\",\n \"era\",\n \"exposure-settings\",\n \"framing\",\n \"furniture\",\n \"held-prop\",\n \"instrumentation\",\n \"lens\",\n \"lighting\",\n \"loop-subject\",\n \"materials\",\n \"mood\",\n \"music-genre\",\n \"music-mood\",\n \"person\",\n \"photo-genre\",\n \"photographer\",\n \"pose\",\n \"post-process-effects\",\n \"render-quality\",\n \"seasons\",\n \"setting\",\n \"style\",\n \"styling\",\n \"temporal\",\n \"transitions\",\n \"vehicles\",\n \"voice-character\",\n \"voice-delivery\",\n \"weapons\",\n] as const\n\nexport type I18nCatalogId = (typeof I18N_CATALOGS)[number]\n","/**\n * i18n resolver + lazy loader for parameter-node picker labels/descriptions.\n *\n * Usage from a picker component:\n *\n * ```ts\n * const locale = useUserLocale() // current user-selected locale\n * await ensureLocaleCatalogLoaded(\"styling\", locale) // call once per (catalog, locale), cached\n * const localized = getLocalizedEntry(\"styling\", entry.id, locale)\n * const label = localized?.label ?? entry.label // fallback to canonical English\n * const description = localized?.description ?? entry.description\n * ```\n *\n * For search filtering, use `entryMatchesQuery(entry, locale, query)` which\n * filters across BOTH the canonical English text AND the localized text.\n */\n\nimport type { I18nCatalogId, LocaleCatalogMap, LocaleId, LocalizedEntry } from \"./types.js\"\n\nexport * from \"./types.js\"\n\n/**\n * In-memory cache of loaded locale catalogs. Key = `<catalog>:<locale>`.\n * `undefined` = never loaded; `null` = loaded but missing/empty.\n */\nconst cache = new Map<string, LocaleCatalogMap | null>()\nconst inflight = new Map<string, Promise<LocaleCatalogMap | null>>()\n\nfunction cacheKey(catalog: I18nCatalogId, locale: LocaleId): string {\n return `${catalog}:${locale}`\n}\n\n/**\n * Pack-sidecar overlay: localized strings contributed by registered catalog\n * packs (e.g. an extension pack's `sidecars.he`), keyed `<catalog>:<locale>`.\n * Consulted by `getLocalizedEntry` when the file sidecar lacks an id. Empty on\n * mainline. Populated by `@nodaro/prompts` at pack registration — the content\n * (the translated strings) lives in the pack (the deployment overlay), never\n * in this Apache package.\n */\nconst packSidecars = new Map<string, LocaleCatalogMap>()\n\nexport function registerCatalogSidecars(\n catalog: string,\n sidecars: Partial<Record<LocaleId, LocaleCatalogMap>> | undefined,\n): void {\n if (!sidecars) return\n for (const locale of Object.keys(sidecars) as LocaleId[]) {\n const map = sidecars[locale]\n if (!map) continue\n const key = `${catalog}:${locale}`\n packSidecars.set(key, { ...(packSidecars.get(key) ?? {}), ...map })\n }\n}\n\nexport function resetCatalogSidecars(): void {\n packSidecars.clear()\n}\n\n/**\n * Lazy-load a sidecar catalog. Returns `null` if the locale is `en` (no\n * sidecar — English lives in the canonical catalog file) or if no sidecar\n * file exists for that (catalog, locale) pair.\n *\n * Implementation note: the dynamic import string is constructed so that\n * Vite can statically analyze the glob and code-split each locale into its\n * own chunk. The `/* @vite-ignore *\\/` comment is required because the\n * locale variable defeats Vite's default static analysis; we accept the\n * runtime resolution and rely on the glob-discovery at module init.\n */\nexport async function ensureLocaleCatalogLoaded(\n catalog: I18nCatalogId,\n locale: LocaleId,\n): Promise<LocaleCatalogMap | null> {\n if (locale === \"en\") return null\n const key = cacheKey(catalog, locale)\n const cached = cache.get(key)\n if (cached !== undefined) return cached\n const existing = inflight.get(key)\n if (existing) return existing\n const promise = loadLocaleCatalog(catalog, locale).then(\n (map) => {\n cache.set(key, map)\n inflight.delete(key)\n return map\n },\n (err) => {\n inflight.delete(key)\n // Cache the failure as null so we don't retry forever\n cache.set(key, null)\n // Don't throw — missing sidecars are expected during gradual rollout;\n // the picker just falls back to English.\n console.warn(`[i18n] failed to load ${key}:`, err)\n return null\n },\n )\n inflight.set(key, promise)\n return promise\n}\n\n/**\n * Resolved value lookup. Reads from the in-memory cache; returns `undefined`\n * if the locale's catalog hasn't been loaded yet (caller should await\n * `ensureLocaleCatalogLoaded` first).\n */\nexport function getLocalizedEntry(\n catalog: I18nCatalogId,\n id: string,\n locale: LocaleId,\n): LocalizedEntry | undefined {\n if (locale === \"en\") return undefined\n const key = cacheKey(catalog, locale)\n const fromFile = cache.get(key)?.[id]\n if (fromFile) return fromFile\n // Fall back to a pack-registered sidecar overlay (G10). File sidecars win;\n // pack sidecars cover ids the deployment overlay added. Empty on mainline.\n return packSidecars.get(key)?.[id]\n}\n\n/**\n * Synchronous resolver that returns the best label available right now.\n * Falls back to `englishLabel` when no translation exists (or the locale\n * sidecar isn't loaded yet).\n */\nexport function resolveLabel(\n catalog: I18nCatalogId,\n id: string,\n englishLabel: string,\n locale: LocaleId,\n): string {\n if (locale === \"en\") return englishLabel\n return getLocalizedEntry(catalog, id, locale)?.label ?? englishLabel\n}\n\n/**\n * Synchronous resolver that returns the best description available now.\n * Falls back to `englishDescription` when no translation exists.\n */\nexport function resolveDescription(\n catalog: I18nCatalogId,\n id: string,\n englishDescription: string,\n locale: LocaleId,\n): string {\n if (locale === \"en\") return englishDescription\n return getLocalizedEntry(catalog, id, locale)?.description ?? englishDescription\n}\n\n/**\n * Search predicate: returns true if `query` matches either the canonical\n * English label/description or the localized label/description for the\n * current locale.\n *\n * Empty query always matches.\n */\nexport function entryMatchesQuery(\n catalog: I18nCatalogId,\n id: string,\n englishLabel: string,\n englishDescription: string,\n locale: LocaleId,\n query: string,\n): boolean {\n const q = query.trim().toLowerCase()\n if (!q) return true\n if (englishLabel.toLowerCase().includes(q)) return true\n if (englishDescription.toLowerCase().includes(q)) return true\n if (locale === \"en\") return false\n const localized = getLocalizedEntry(catalog, id, locale)\n if (!localized) return false\n if (localized.label && localized.label.toLowerCase().includes(q)) return true\n if (localized.description && localized.description.toLowerCase().includes(q)) return true\n return false\n}\n\n/**\n * Sidecar loader registry. Populated by the consuming app via\n * `registerSidecarLoaders` at startup.\n *\n * Why externalised: this package is bundled by tsup for npm publish, and\n * `tsup` does NOT expand Vite's `import.meta.glob`. Calling it from inside\n * the bundled module yields an empty loader map at runtime → all pickers\n * silently fall back to English regardless of the user's locale.\n *\n * The frontend (which is processed by Vite) owns the glob — see\n * `frontend/src/lib/i18n-bootstrap.ts`. Backend / Node tests don't need\n * picker translations and simply skip registration.\n *\n * Keys are file paths relative to `packages/shared/src/i18n/`, e.g.\n * `\"./person.ja.ts\"`.\n */\ntype SidecarModule = { default?: LocaleCatalogMap } & Record<string, unknown>\nexport type SidecarLoader = () => Promise<unknown>\n\nlet sidecarLoaders: Record<string, SidecarLoader> = {}\n\n/**\n * Register the map of locale-sidecar loaders. Call once at app startup\n * before any picker mounts.\n *\n * In Vite-processed code:\n * ```ts\n * import { registerSidecarLoaders } from \"@nodaro/shared\"\n * registerSidecarLoaders(\n * import.meta.glob(\"../../packages/shared/src/i18n/*.*.ts\"),\n * )\n * ```\n */\nexport function registerSidecarLoaders(loaders: Record<string, SidecarLoader>): void {\n sidecarLoaders = loaders\n}\n\nasync function loadLocaleCatalog(\n catalog: I18nCatalogId,\n locale: LocaleId,\n): Promise<LocaleCatalogMap | null> {\n if (locale === \"en\") return null\n // Match by suffix so the registry survives different glob roots —\n // frontend's bootstrap globs from a different relative path than\n // this file lives at, so keys look like \".../i18n/person.ja.ts\".\n const suffix = `${catalog}.${locale}.ts`\n const matchKey = Object.keys(sidecarLoaders).find((k) =>\n k.endsWith(`/${suffix}`) || k === `./${suffix}`,\n )\n const loader = matchKey ? sidecarLoaders[matchKey] : undefined\n if (!loader) return null\n try {\n const mod = (await loader()) as SidecarModule\n if (mod.default && typeof mod.default === \"object\") return mod.default\n // Fallback: convention-named export (e.g. STYLING_FR)\n const conventional = `${catalog.toUpperCase().replace(/-/g, \"_\")}_${locale.toUpperCase().replace(/-/g, \"_\")}`\n const named = mod[conventional]\n if (named && typeof named === \"object\") return named as LocaleCatalogMap\n return null\n } catch {\n return null\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/video-link.ts"],"names":[],"mappings":";AAoBO,IAAM,kBAAA,GAAqB;AAAA,EAChC,aAAA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AA;AAAA,EACA,qBAAA;AAAA,EACA,oBAAA;AAAA;AAAA;AAAA,EAGA;AACF;AASO,SAAS,wBAAA,CACd,MACA,QAAA,EACyB;AACzB,EAAA,IAAI,EAAE,YAAA,IAAgB,QAAA,CAAA,EAAW,OAAO,IAAA;AACxC,EAAA,IAAI,OAAA,CAAQ,SAAS,UAAU,CAAA,KAAM,QAAQ,IAAA,CAAK,UAAU,GAAG,OAAO,IAAA;AACtE,EAAA,MAAM,GAAA,GAA+B,EAAE,GAAG,IAAA,EAAK;AAC/C,EAAA,KAAA,MAAW,GAAA,IAAO,yBAAA,EAA2B,OAAO,GAAA,CAAI,GAAG,CAAA;AAC3D,EAAA,OAAO,GAAA;AACT","file":"chunk-IB5B3EBD.js","sourcesContent":["/**\n * The Video URL node (`youtube-video`) and the social-video import path —\n * structural vocabulary shared by the canvas, the orchestrator and the\n * download routes. Host names and a node-output rule only; no prompt content.\n *\n * ONE list, three readers:\n * - the backend's yt-dlp routes (`lib/url-validator.ts` re-exports these),\n * where the list IS the SSRF gate — yt-dlp does its own DNS + HTTP, so\n * nothing but this exact-suffix match stands between a pasted link and an\n * internal address;\n * - the editor, which decides from the same list whether a pasted link is\n * one it should download (it must never offer a host the server refuses,\n * nor sit on one the server accepts);\n * - both workflow engines, which read a node's output through\n * `resolveVideoLinkOutput`.\n *\n * ⚠️ Adding a host here ADMITS it to a server-side fetch. It is a security\n * decision, not a UI one — only fixed, reputable domains whose DNS an attacker\n * cannot control.\n */\nexport const SOCIAL_VIDEO_HOSTS = [\n \"youtube.com\", \"youtu.be\",\n \"tiktok.com\",\n \"instagram.com\",\n \"twitter.com\", \"x.com\",\n \"facebook.com\", \"fb.watch\", \"fb.com\",\n] as const\n\n/** YouTube-only subset (the metadata probe and the client ladder are YouTube-only). */\nexport const YOUTUBE_HOSTS = [\"youtube.com\", \"youtu.be\"] as const\n\n/** Instagram-only subset (the download path's proxy failover is Instagram-scoped). */\nexport const INSTAGRAM_HOSTS = [\"instagram.com\"] as const\n\nconst TIKTOK_HOSTS = [\"tiktok.com\"] as const\nconst TWITTER_HOSTS = [\"twitter.com\", \"x.com\"] as const\nconst FACEBOOK_HOSTS = [\"facebook.com\", \"fb.watch\", \"fb.com\"] as const\n\n/**\n * Exact registrable-domain match against an allowlist: the domain itself or a\n * true subdomain (`www.youtube.com`, `m.youtu.be`). A host that merely\n * CONTAINS an allowlisted name (`evilyoutube.com`, `youtube.com.attacker.example`,\n * or `netflix.com` for `x.com`) does not match.\n */\nexport function hostnameMatchesAllowlist(hostname: string, domains: readonly string[]): boolean {\n const h = hostname.toLowerCase().replace(/\\.$/, \"\") // strip FQDN trailing dot\n return domains.some((d) => {\n const dom = d.toLowerCase()\n return h === dom || h.endsWith(\".\" + dom)\n })\n}\n\n/**\n * True when the RAW link carries a character that URL parsers read differently:\n * a backslash or an ASCII control character.\n *\n * Every check in this file parses the WHATWG way (Node, the browser), where a\n * backslash in an http(s) URL is a slash — `https://tiktok.com\\@10.0.0.1/x` has\n * host `tiktok.com`. A parser that ends the authority at `/` alone reads the\n * same string as a user name at host `10.0.0.1`. The download tools are handed\n * the raw string and do their own parsing, DNS and HTTP, so a link the two\n * readings can disagree on is refused outright rather than reasoned about. Tabs\n * and newlines are dropped silently by one parser and kept by another — same\n * answer. No real video link contains any of these.\n */\nexport function hasUrlParserHazard(url: string): boolean {\n for (let i = 0; i < url.length; i++) {\n const code = url.charCodeAt(i)\n if (code === 0x5c || code <= 0x1f || code === 0x7f) return true\n }\n return false\n}\n\n/** True for an http(s) URL whose host is on the allowlist. Never throws. */\nexport function isSocialVideoUrl(url: string, domains: readonly string[] = SOCIAL_VIDEO_HOSTS): boolean {\n if (hasUrlParserHazard(url)) return false\n try {\n const parsed = new URL(url)\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") return false\n return hostnameMatchesAllowlist(parsed.hostname, domains)\n } catch {\n return false\n }\n}\n\nexport type VideoLinkPlatform = \"youtube\" | \"facebook\" | \"tiktok\" | \"instagram\" | \"twitter\" | \"unknown\"\n\n/** Which supported platform a link belongs to — by exact host, never by substring. */\nexport function detectVideoLinkPlatform(url: string): VideoLinkPlatform {\n if (isSocialVideoUrl(url, YOUTUBE_HOSTS)) return \"youtube\"\n if (isSocialVideoUrl(url, FACEBOOK_HOSTS)) return \"facebook\"\n if (isSocialVideoUrl(url, TIKTOK_HOSTS)) return \"tiktok\"\n if (isSocialVideoUrl(url, INSTAGRAM_HOSTS)) return \"instagram\"\n if (isSocialVideoUrl(url, TWITTER_HOSTS)) return \"twitter\"\n return \"unknown\"\n}\n\n/**\n * Node types that can use a Video URL node WITHOUT its downloaded file, because\n * they never read the video: `suno-cover` and `transcribe` take the node's\n * separately-fetched audio track (`downloadedAudioUrl`), `dubbing` hands the\n * page link to a provider that fetches it itself, and `content-recipe` cites the\n * post's page link on its `link` input (`videoLinkPageUrl`, both resolvers) —\n * a Video URL can reach it on no other input. A run whose only consumers of a\n * link are these must not be made to download — or to choose a part of — a\n * video nobody will look at. Structural vocabulary: it mirrors those\n * server-side readers; add a type here only together with its reader.\n */\nexport const VIDEO_LINK_TOLERANT_CONSUMER_TYPES: ReadonlySet<string> = new Set([\n \"suno-cover\",\n \"transcribe\",\n \"dubbing\",\n \"content-recipe\",\n])\n\n/**\n * The tolerant consumers that DO read something fetched from the link — the\n * separately-fetched audio track (`downloadedAudioUrl`): Transcribe and Suno\n * Cover. The rest of the tolerant set (Dubbing, Content Recipe) read only the\n * page link and need nothing fetched. A subset of the tolerant set by\n * construction (guard test).\n */\nexport const VIDEO_LINK_AUDIO_CONSUMER_TYPES: ReadonlySet<string> = new Set([\"suno-cover\", \"transcribe\"])\n\n/**\n * What a run must FETCH for a Video URL node holding a post link:\n * - `file`: some node in the run watches the video — download the video;\n * - `audio`: every reader is tolerant and at least one takes the audio track —\n * fetch the track only, never the video (and never ask for a part of it);\n * - `none`: every reader takes the page link alone — fetch nothing.\n */\nexport type VideoLinkNeed = \"file\" | \"audio\" | \"none\"\n\n/** The need of a node read by consumers of these types. No consumer reads nothing. */\nexport function videoLinkNeedOf(consumerTypes: Iterable<string>): VideoLinkNeed {\n let audio = false\n for (const type of consumerTypes) {\n if (!VIDEO_LINK_TOLERANT_CONSUMER_TYPES.has(type)) return \"file\"\n if (VIDEO_LINK_AUDIO_CONSUMER_TYPES.has(type)) audio = true\n }\n return audio ? \"audio\" : \"none\"\n}\n\n/** The node shape the graph readers need — open on purpose, both engines' nodes fit. */\nexport interface VideoLinkGraphNode {\n readonly id: string\n readonly type?: string\n readonly data?: unknown\n}\n\nexport interface VideoLinkGraphEdge {\n readonly source: string\n readonly target: string\n}\n\n/**\n * The need of every Video URL node that feeds the run, by node id — ONE reading\n * of the graph for the editor's pre-run gate, the app runner's card and the\n * server's pre-run fetch, so the three cannot disagree on what a run needs.\n *\n * `scopeIds` are the nodes about to run (`null` = every node: an app runs its\n * whole graph). The run is those nodes plus everything they read from, at any\n * depth; a link that feeds nothing in it is absent (a long video parked on the\n * canvas must never block an unrelated run). Skipped nodes are not part of the\n * run and pull nothing in.\n */\nexport function videoLinkRunNeeds(\n scopeIds: readonly string[] | null,\n nodes: readonly VideoLinkGraphNode[],\n edges: readonly VideoLinkGraphEdge[],\n): Map<string, VideoLinkNeed> {\n const byId = new Map(nodes.map((n) => [n.id, n] as const))\n const isSkipped = (id: string) => (byId.get(id)?.data as { skipped?: unknown } | undefined)?.skipped === true\n\n const sourcesOf = new Map<string, string[]>()\n for (const edge of edges) {\n const list = sourcesOf.get(edge.target)\n if (list) list.push(edge.source)\n else sourcesOf.set(edge.target, [edge.source])\n }\n\n // Everything the run touches: the nodes about to run plus all they read from.\n const inRun = new Set<string>()\n const queue = (scopeIds ?? nodes.map((n) => n.id)).filter((id) => !isSkipped(id))\n for (const id of queue) inRun.add(id)\n while (queue.length > 0) {\n const current = queue.pop()!\n for (const source of sourcesOf.get(current) ?? []) {\n if (inRun.has(source)) continue\n inRun.add(source)\n queue.push(source)\n }\n }\n\n const consumers = new Map<string, string[]>()\n for (const edge of edges) {\n if (byId.get(edge.source)?.type !== \"youtube-video\" || !inRun.has(edge.target)) continue\n const list = consumers.get(edge.source)\n const type = byId.get(edge.target)?.type ?? \"\"\n if (list) list.push(type)\n else consumers.set(edge.source, [type])\n }\n const needs = new Map<string, VideoLinkNeed>()\n for (const [id, types] of consumers) needs.set(id, videoLinkNeedOf(types))\n return needs\n}\n\n/**\n * The fields of a Video URL node's data that decide what it emits. Open-ended\n * on purpose: both engines hand over the node's whole `data` bag, and a closed\n * shape with only optional members would refuse it as having nothing in common.\n */\nexport interface VideoLinkNodeFields {\n readonly youtubeUrl?: unknown\n readonly downloadedVideoUrl?: unknown\n readonly downloadedFromUrl?: unknown\n readonly [key: string]: unknown\n}\n\nfunction trimmed(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined\n const t = value.trim()\n return t === \"\" ? undefined : t\n}\n\n/**\n * The stored file that belongs to the node's CURRENT link, or undefined.\n *\n * `downloadedFromUrl` binds a file to the link it came from. The editor clears\n * the file whenever the link is edited, but a link can also change where no\n * editor is looking — an agent or an import rewriting the workflow JSON — and\n * without the binding the node would go on emitting the PREVIOUS video, which\n * is worse than emitting none. A node saved before the field existed has no\n * binding and is trusted as it always was.\n */\nexport function videoLinkDownloadedFile(data: VideoLinkNodeFields): string | undefined {\n const file = trimmed(data.downloadedVideoUrl)\n if (!file) return undefined\n const from = trimmed(data.downloadedFromUrl)\n if (from && from !== trimmed(data.youtubeUrl)) return undefined\n return file\n}\n\n/**\n * What a Video URL node emits on its `video` handle: the downloaded file when\n * one matches the link, else the link itself. The fallback is load-bearing — a\n * DIRECT file link (`https://cdn…/clip.mp4`) is a legitimate value of the URL\n * field and is never downloaded, so it must pass through.\n */\nexport function resolveVideoLinkOutput(data: VideoLinkNodeFields): string | undefined {\n return videoLinkDownloadedFile(data) ?? trimmed(data.youtubeUrl)\n}\n\n/**\n * The page link a Video URL node was given (the post's own address), never\n * the downloaded file. Read by consumers that CITE a post rather than watch\n * it — Content Recipe's \"Source post\" input stores it as the recipe's source.\n */\nexport function videoLinkPageUrl(data: VideoLinkNodeFields): string | undefined {\n return trimmed(data.youtubeUrl)\n}\n\n/**\n * True when the node holds a social link with no file for it yet — the state\n * in which its output is a web PAGE, which no video consumer can read.\n */\nexport function videoLinkNeedsDownload(data: VideoLinkNodeFields): boolean {\n const url = trimmed(data.youtubeUrl)\n if (!url || !isSocialVideoUrl(url)) return false\n return videoLinkDownloadedFile(data) === undefined\n}\n\n// ---------------------------------------------------------------------------\n// The link as an APP INPUT (a published app, MCP `run_app`, the SDK)\n// ---------------------------------------------------------------------------\n\n/**\n * File extensions accepted as DIRECT video-file links (pathname suffix match).\n * Mirrors save-to-storage's video auto-detect set.\n */\nexport const DIRECT_VIDEO_EXTENSIONS = [\".mp4\", \".webm\", \".mov\", \".avi\"] as const\n\n/**\n * True for a DIRECT video-file link: http(s) whose PATHNAME ends in a video\n * extension — `https://cdn.nodaro.ai/uploads/videos/<id>.mp4` and any other\n * cdn-style link. Query and fragment are ignored (signed CDN links keep the\n * extension in the path); an extension that appears only in the query does\n * not qualify. Host-agnostic BY DESIGN, which is exactly why admission is not\n * sufficient on its own: the download route pre-resolves these hosts before it\n * fetches (`resolvesOnlyToPublicAddresses`), and every other reader goes\n * through the SSRF-guarded fetch.\n *\n * A link carrying a backslash or a control character is refused first\n * (`hasUrlParserHazard`): the route pre-resolves the WHATWG host, and the\n * download tool would fetch whatever host ITS parser reads.\n */\nexport function isDirectVideoFileUrl(url: string): boolean {\n if (hasUrlParserHazard(url)) return false\n try {\n const parsed = new URL(url)\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") return false\n const path = parsed.pathname.toLowerCase()\n return DIRECT_VIDEO_EXTENSIONS.some((ext) => path.endsWith(ext))\n } catch {\n return false\n }\n}\n\n/**\n * A YouTube video shorter than this downloads whole the moment the link lands;\n * a longer one (or one whose length could not be read) waits for a part to be\n * chosen. The same 4 minutes Recast and Studio use — a two-hour talk nobody\n * asked for never gets fetched by accident. One number for the canvas node, the\n * app runner's card and the server's pre-run fetch.\n */\nexport const AUTO_DOWNLOAD_MAX_SEC = 240\n\n/** YouTube's quality cap (\"up to N rows\"). Other hosts have no ladder worth capping. */\nexport const YOUTUBE_MAX_HEIGHT = 1080\n\n/** The longest link an app input accepts. A real video link is a few hundred characters. */\nexport const MAX_VIDEO_LINK_INPUT_CHARS = 2048\n\nexport type VideoLinkInputProblem = \"empty\" | \"invalid\"\n\n/**\n * The ONE rule for what a Video URL app input may hold — the canvas node's own\n * (decided 2026-10-08): a link to a supported social host (downloaded before\n * the nodes that need the file run), or any other http(s) link (passed through\n * as it is, never downloaded; the nodes that read it fetch it through the\n * SSRF-guarded fetch). The app runner's card, the run-request lock and MCP\n * `get_app_inputs` all read it, so a link the card accepts is a link the\n * server accepts, and the reverse.\n *\n * Structural only: the server layers its SSRF guard on top (`safeUrlSchema`),\n * and the card refuses a literal local / private host. A link carrying a\n * backslash or a control character is refused (`hasUrlParserHazard`).\n * `null` = fine; leading and trailing spaces are not a problem (the card trims\n * before it sends).\n */\nexport function videoLinkInputProblem(value: unknown): VideoLinkInputProblem | null {\n if (value === undefined || value === null) return \"empty\"\n if (typeof value !== \"string\") return \"invalid\"\n const link = value.trim()\n if (link === \"\") return \"empty\"\n if (link.length > MAX_VIDEO_LINK_INPUT_CHARS) return \"invalid\"\n return isSocialVideoUrl(link) || isHttpLink(link) ? null : \"invalid\"\n}\n\nfunction isHttpLink(link: string): boolean {\n if (hasUrlParserHazard(link)) return false\n try {\n const parsed = new URL(link)\n return (parsed.protocol === \"http:\" || parsed.protocol === \"https:\") && parsed.hostname !== \"\"\n } catch {\n return false\n }\n}\n\n/**\n * The fields of a Video URL node's data that belong to ONE link: the file and\n * audio track fetched from it, the progress of that fetch, and what was read\n * from the link (its id, title, picture, length). Every one of them describes\n * the link it was made for.\n *\n * A run-time override that swaps the link (`dropStaleVideoLinkFields`) drops\n * these first, because the creator's published node carries all of them and a\n * shallow merge would leave them standing under the caller's link — the audio\n * track in particular has no binding to its link (`downloadedAudioUrl` is read\n * straight off the node by Transcribe and Suno Cover), so a caller's episode\n * would be transcribed from the creator's sample. The editor's own\n * link-change reset (`CLEARED_DOWNLOAD` in `lib/video-link-ingest.ts`) is\n * guarded to be inside this list.\n */\nexport const VIDEO_LINK_DERIVED_FIELDS = [\n \"videoId\",\n \"title\",\n \"thumbnailUrl\",\n \"downloadedVideoUrl\",\n \"downloadedThumbnailUrl\",\n \"downloadedFromUrl\",\n \"downloadedSection\",\n \"downloadStatus\",\n \"downloadError\",\n \"downloadErrorCode\",\n \"downloadId\",\n \"downloadIdUrl\",\n \"downloadMode\",\n \"downloadAllowSilent\",\n \"downloadPercent\",\n \"downloadPhase\",\n \"sectionStartSec\",\n \"sectionEndSec\",\n \"needsRangeChoice\",\n \"videoDurationSec\",\n \"downloadedAudioUrl\",\n \"audioDownloadStatus\",\n \"audioDownloadError\",\n // The content rights confirmation a run's own fetch of the link is made\n // under: recorded for ONE link, so it never stands under another.\n \"rightsConfirmationId\",\n] as const\n\n/**\n * The saved Video URL node data without what belonged to its previous link,\n * when `incoming` (the run's override for the node) points it at a different\n * one. A field the override brings itself is kept (the merge applies it after\n * this). Returns the SAME object when the link is not being changed; never\n * mutates.\n */\nexport function dropStaleVideoLinkFields(\n data: Record<string, unknown>,\n incoming: Record<string, unknown>,\n): Record<string, unknown> {\n if (!(\"youtubeUrl\" in incoming)) return data\n if (trimmed(incoming.youtubeUrl) === trimmed(data.youtubeUrl)) return data\n const out: Record<string, unknown> = { ...data }\n for (const key of VIDEO_LINK_DERIVED_FIELDS) delete out[key]\n return out\n}\n"]}