@nodaro/shared 3.32.0 → 3.35.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/{chunk-VWGNPMJZ.cjs → chunk-24ZKPE33.cjs} +5 -5
- package/dist/{chunk-VWGNPMJZ.cjs.map → chunk-24ZKPE33.cjs.map} +1 -1
- package/dist/{chunk-CK3GK34R.js → chunk-2HIDE3QV.js} +9 -3
- package/dist/chunk-2HIDE3QV.js.map +1 -0
- package/dist/{chunk-WDIBOWAA.js → chunk-2HVFF5SS.js} +6 -6
- package/dist/chunk-2HVFF5SS.js.map +1 -0
- package/dist/{chunk-KHCBJ7KD.js → chunk-2QWNPYDG.js} +3 -3
- package/dist/{chunk-KHCBJ7KD.js.map → chunk-2QWNPYDG.js.map} +1 -1
- package/dist/{chunk-J6KHW2E5.cjs → chunk-3YG3MYDE.cjs} +153 -24
- package/dist/chunk-3YG3MYDE.cjs.map +1 -0
- package/dist/{chunk-ULXI7A6Q.cjs → chunk-5VNBQ4QK.cjs} +16 -16
- package/dist/{chunk-ULXI7A6Q.cjs.map → chunk-5VNBQ4QK.cjs.map} +1 -1
- package/dist/{chunk-5AUSSJIM.cjs → chunk-5ZCXWA7J.cjs} +232 -15
- package/dist/chunk-5ZCXWA7J.cjs.map +1 -0
- package/dist/{chunk-Z2OL5AJD.cjs → chunk-6F6GGX2W.cjs} +4 -3
- package/dist/chunk-6F6GGX2W.cjs.map +1 -0
- package/dist/{chunk-E2TGXG6X.cjs → chunk-72IFMNJE.cjs} +80 -52
- package/dist/chunk-72IFMNJE.cjs.map +1 -0
- package/dist/{chunk-NB72XWXQ.cjs → chunk-A5Z3IMSJ.cjs} +6 -6
- package/dist/{chunk-NB72XWXQ.cjs.map → chunk-A5Z3IMSJ.cjs.map} +1 -1
- package/dist/{chunk-NT6IJH4L.cjs → chunk-AGEZY4LL.cjs} +66 -47
- package/dist/chunk-AGEZY4LL.cjs.map +1 -0
- package/dist/{chunk-3CUFITU7.js → chunk-ANOQWAMU.js} +88 -54
- package/dist/chunk-ANOQWAMU.js.map +1 -0
- package/dist/{chunk-PRYE7AZQ.cjs → chunk-AWWOQH46.cjs} +7 -7
- package/dist/chunk-AWWOQH46.cjs.map +1 -0
- package/dist/{chunk-QELDJGDK.cjs → chunk-B7WJJHJS.cjs} +7 -4
- package/dist/chunk-B7WJJHJS.cjs.map +1 -0
- package/dist/{chunk-AVQK77G6.cjs → chunk-BBLE4UTG.cjs} +88 -54
- package/dist/chunk-BBLE4UTG.cjs.map +1 -0
- package/dist/{chunk-HGC5JNVA.cjs → chunk-BVVKMQKR.cjs} +9 -2
- package/dist/chunk-BVVKMQKR.cjs.map +1 -0
- package/dist/{chunk-YYV35XOS.js → chunk-C4R7BTBQ.js} +4 -3
- package/dist/chunk-C4R7BTBQ.js.map +1 -0
- package/dist/{chunk-AROWPFO2.js → chunk-ETXUOETU.js} +29 -36
- package/dist/chunk-ETXUOETU.js.map +1 -0
- package/dist/{chunk-S5DMKUWK.cjs → chunk-F4ZT5X2S.cjs} +11 -11
- package/dist/{chunk-S5DMKUWK.cjs.map → chunk-F4ZT5X2S.cjs.map} +1 -1
- package/dist/{chunk-YBPBK5KI.js → chunk-FKQJYMCO.js} +97 -23
- package/dist/chunk-FKQJYMCO.js.map +1 -0
- package/dist/{chunk-ZDFHA2EC.js → chunk-FVKCNAEQ.js} +51 -7
- package/dist/chunk-FVKCNAEQ.js.map +1 -0
- package/dist/{chunk-JSNV5O2F.cjs → chunk-GHBXS5RT.cjs} +4 -4
- package/dist/{chunk-JSNV5O2F.cjs.map → chunk-GHBXS5RT.cjs.map} +1 -1
- package/dist/{chunk-C57NEO3X.js → chunk-GKJRNIP4.js} +230 -16
- package/dist/chunk-GKJRNIP4.js.map +1 -0
- package/dist/{chunk-QNGNOU4Z.js → chunk-GRIMIJJ3.js} +3 -3
- package/dist/{chunk-QNGNOU4Z.js.map → chunk-GRIMIJJ3.js.map} +1 -1
- package/dist/{chunk-IEBZHTPE.js → chunk-GVHBHUFV.js} +34 -16
- package/dist/chunk-GVHBHUFV.js.map +1 -0
- package/dist/chunk-GZH2SIOF.cjs +99 -0
- package/dist/chunk-GZH2SIOF.cjs.map +1 -0
- package/dist/{chunk-YHRG7UOC.js → chunk-IJNQYMN7.js} +4 -4
- package/dist/{chunk-YHRG7UOC.js.map → chunk-IJNQYMN7.js.map} +1 -1
- package/dist/{chunk-JX5YZ4DH.cjs → chunk-IRUPCNW2.cjs} +49 -46
- package/dist/chunk-IRUPCNW2.cjs.map +1 -0
- package/dist/{chunk-JL4C5VJ7.cjs → chunk-J65CAOUV.cjs} +14 -2
- package/dist/chunk-J65CAOUV.cjs.map +1 -0
- package/dist/{chunk-ISJDAFKS.js → chunk-LJMNCSDG.js} +38 -15
- package/dist/chunk-LJMNCSDG.js.map +1 -0
- package/dist/{chunk-ZT77RY6R.js → chunk-MEN7VLQ5.js} +8 -5
- package/dist/chunk-MEN7VLQ5.js.map +1 -0
- package/dist/{chunk-VIWSWVAW.js → chunk-MUA5L25B.js} +125 -12
- package/dist/chunk-MUA5L25B.js.map +1 -0
- package/dist/{chunk-6IJOPRZP.cjs → chunk-NWXB4F6D.cjs} +21 -21
- package/dist/{chunk-6IJOPRZP.cjs.map → chunk-NWXB4F6D.cjs.map} +1 -1
- package/dist/{chunk-PQHS255G.js → chunk-OHSIVNJO.js} +3 -3
- package/dist/chunk-OHSIVNJO.js.map +1 -0
- package/dist/{chunk-LKAIXWK3.js → chunk-PVVO23LZ.js} +3 -3
- package/dist/{chunk-LKAIXWK3.js.map → chunk-PVVO23LZ.js.map} +1 -1
- package/dist/{chunk-XAMC4S53.js → chunk-Q4ZXDDWA.js} +3 -3
- package/dist/{chunk-XAMC4S53.js.map → chunk-Q4ZXDDWA.js.map} +1 -1
- package/dist/{chunk-EK362Q45.cjs → chunk-QIIG2QDP.cjs} +8 -8
- package/dist/{chunk-EK362Q45.cjs.map → chunk-QIIG2QDP.cjs.map} +1 -1
- package/dist/{chunk-Q4CDQ2KO.js → chunk-QXW6O56Z.js} +6 -6
- package/dist/chunk-QXW6O56Z.js.map +1 -0
- package/dist/{chunk-5PC6JBGJ.cjs → chunk-R2VF5NQG.cjs} +3 -3
- package/dist/chunk-R2VF5NQG.cjs.map +1 -0
- package/dist/{chunk-6DKDOWBL.js → chunk-RRI5YBUK.js} +6 -3
- package/dist/{chunk-QELDJGDK.cjs.map → chunk-RRI5YBUK.js.map} +1 -1
- package/dist/{chunk-RJL7RCEM.cjs → chunk-RUKFN3LJ.cjs} +6 -6
- package/dist/chunk-RUKFN3LJ.cjs.map +1 -0
- package/dist/chunk-TCBHVIMD.js +89 -0
- package/dist/chunk-TCBHVIMD.js.map +1 -0
- package/dist/{chunk-SES6GDBQ.cjs → chunk-UJJUX6NW.cjs} +59 -8
- package/dist/chunk-UJJUX6NW.cjs.map +1 -0
- package/dist/{chunk-ZRL2UFTH.cjs → chunk-V3N56Z2S.cjs} +101 -22
- package/dist/chunk-V3N56Z2S.cjs.map +1 -0
- package/dist/{chunk-Z4AZW6FY.js → chunk-W36WCZS2.js} +6 -6
- package/dist/{chunk-Z4AZW6FY.js.map → chunk-W36WCZS2.js.map} +1 -1
- package/dist/{chunk-M36G6SRP.js → chunk-WXNQMJ67.js} +14 -3
- package/dist/chunk-WXNQMJ67.js.map +1 -0
- package/dist/{chunk-O7PUQLJ3.cjs → chunk-XE5PE54B.cjs} +33 -40
- package/dist/chunk-XE5PE54B.cjs.map +1 -0
- package/dist/{chunk-LPW3XNC2.js → chunk-XJOBMAWW.js} +3 -3
- package/dist/{chunk-LPW3XNC2.js.map → chunk-XJOBMAWW.js.map} +1 -1
- package/dist/{chunk-5U7VLG43.js → chunk-XS7FI4JA.js} +3 -3
- package/dist/chunk-XS7FI4JA.js.map +1 -0
- package/dist/{chunk-O5MP52U2.cjs → chunk-YD3JA36S.cjs} +4 -4
- package/dist/{chunk-O5MP52U2.cjs.map → chunk-YD3JA36S.cjs.map} +1 -1
- package/dist/chunk-YYODFQEU.cjs +25 -0
- package/dist/chunk-YYODFQEU.cjs.map +1 -0
- package/dist/{chunk-RN3RMBJZ.js → chunk-ZXBSARZX.js} +4 -4
- package/dist/{chunk-RN3RMBJZ.js.map → chunk-ZXBSARZX.js.map} +1 -1
- package/dist/entries/apps.cjs +43 -42
- package/dist/entries/apps.d.cts +11 -2
- package/dist/entries/apps.d.ts +11 -2
- package/dist/entries/apps.js +8 -7
- package/dist/entries/catalogs.d.cts +1 -1
- package/dist/entries/catalogs.d.ts +1 -1
- package/dist/entries/credits.cjs +156 -152
- package/dist/entries/credits.d.cts +41 -10
- package/dist/entries/credits.d.ts +41 -10
- package/dist/entries/credits.js +8 -8
- package/dist/entries/edl.cjs +130 -102
- package/dist/entries/edl.d.cts +74 -3
- package/dist/entries/edl.d.ts +74 -3
- package/dist/entries/edl.js +2 -2
- package/dist/entries/entities.cjs +126 -122
- package/dist/entries/entities.d.cts +2 -2
- package/dist/entries/entities.d.ts +2 -2
- package/dist/entries/entities.js +1 -1
- package/dist/entries/i18n.cjs +11 -11
- package/dist/entries/i18n.d.cts +2 -2
- package/dist/entries/i18n.d.ts +2 -2
- package/dist/entries/i18n.js +1 -1
- package/dist/entries/llm-models.cjs +63 -43
- package/dist/entries/llm-models.d.cts +71 -4
- package/dist/entries/llm-models.d.ts +71 -4
- package/dist/entries/llm-models.js +1 -1
- package/dist/entries/media.cjs +45 -41
- package/dist/entries/media.d.cts +39 -1
- package/dist/entries/media.d.ts +39 -1
- package/dist/entries/media.js +1 -1
- package/dist/entries/model-catalog.cjs +75 -63
- package/dist/entries/model-catalog.d.cts +2 -2
- package/dist/entries/model-catalog.d.ts +2 -2
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +274 -210
- package/dist/entries/models.d.cts +3 -3
- package/dist/entries/models.d.ts +3 -3
- package/dist/entries/models.js +5 -5
- package/dist/entries/nodes.cjs +222 -201
- package/dist/entries/nodes.d.cts +48 -8
- package/dist/entries/nodes.d.ts +48 -8
- package/dist/entries/nodes.js +10 -9
- package/dist/entries/pipeline.cjs +149 -149
- package/dist/entries/pipeline.d.cts +12 -8
- package/dist/entries/pipeline.d.ts +12 -8
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/social.cjs +174 -174
- package/dist/entries/social.d.cts +13 -5
- package/dist/entries/social.d.ts +13 -5
- package/dist/entries/social.js +2 -2
- package/dist/entries/types.d.cts +1 -1
- package/dist/entries/types.d.ts +1 -1
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +115 -115
- package/dist/entries/video.d.cts +4 -3
- package/dist/entries/video.d.ts +4 -3
- package/dist/entries/video.js +4 -4
- package/dist/entries/workflow.cjs +96 -95
- package/dist/entries/workflow.d.cts +19 -20
- package/dist/entries/workflow.d.ts +19 -20
- package/dist/entries/workflow.js +2 -1
- package/dist/index.cjs +1720 -1563
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +26 -25
- package/dist/{model-catalog-flJYaa-g.d.ts → model-catalog-VIHGmQL2.d.cts} +113 -1
- package/dist/{model-catalog-flJYaa-g.d.cts → model-catalog-VIHGmQL2.d.ts} +113 -1
- package/dist/{presentation-utils-BIqiCzSA.d.cts → presentation-utils-A4i92SYo.d.cts} +3 -1
- package/dist/{presentation-utils-BdiObtwq.d.ts → presentation-utils-DjdPtM9k.d.ts} +3 -1
- package/dist/{scene-node-types-DjenYFLO.d.ts → scene-node-types-Cvbtf-0a.d.cts} +147 -6
- package/dist/{scene-node-types-DjenYFLO.d.cts → scene-node-types-Cvbtf-0a.d.ts} +147 -6
- package/dist/{types-DffyGSy5.d.ts → types-CU6SQnMS.d.cts} +0 -5
- package/dist/{types-DffyGSy5.d.cts → types-CU6SQnMS.d.ts} +0 -5
- package/dist/{types-BRlFPEru.d.cts → types-DzUBR7yr.d.cts} +8 -1
- package/dist/{types-BRlFPEru.d.ts → types-DzUBR7yr.d.ts} +8 -1
- package/package.json +1 -1
- package/src/__tests__/camera-switch-contract.test.ts +33 -1
- package/src/__tests__/character-mention-slug.test.ts +0 -8
- package/src/__tests__/effective-tier.test.ts +3 -14
- package/src/__tests__/fixtures/camera-switch-speaker-map-parity.json +178 -0
- package/src/__tests__/fixtures/root-exports.baseline.json +21 -0
- package/src/__tests__/fixtures/speaker-map-camera-ids.json +26 -0
- package/src/__tests__/gvp-supported-providers.test.ts +1 -0
- package/src/__tests__/i18n-locale-completeness.test.ts +38 -3
- package/src/__tests__/llm-models.test.ts +200 -20
- package/src/__tests__/model-makers.test.ts +76 -0
- package/src/__tests__/node-preset-extract.test.ts +10 -0
- package/src/__tests__/presentation-utils.test.ts +15 -0
- package/src/__tests__/preview-gate-use-case.test.ts +16 -1
- package/src/__tests__/private-host.test.ts +53 -0
- package/src/__tests__/producer-types.test.ts +19 -0
- package/src/__tests__/run-continuation.test.ts +4 -1
- package/src/__tests__/speaker-map-contract.test.ts +48 -0
- package/src/__tests__/unit-contract-compose.test.ts +129 -0
- package/src/__tests__/unit-contracts.test.ts +134 -0
- package/src/__tests__/use-case-types.test.ts +33 -0
- package/src/__tests__/video-collapse-parity.test.ts +10 -0
- package/src/__tests__/video-frame-slot.test.ts +85 -0
- package/src/__tests__/video-mode-aliases.test.ts +1 -0
- package/src/__tests__/video-reference-only.test.ts +117 -0
- package/src/__tests__/vidu-q4-catalog.test.ts +230 -0
- package/src/camera-switch-contract.ts +36 -2
- package/src/component-types.ts +9 -0
- package/src/credit-identifiers.ts +81 -23
- package/src/entity-asset-types.ts +13 -0
- package/src/entries/credits.ts +1 -0
- package/src/entries/edl.ts +2 -0
- package/src/entries/llm-models.ts +5 -0
- package/src/entries/media.ts +1 -0
- package/src/entries/model-catalog.ts +6 -0
- package/src/entries/models.ts +25 -0
- package/src/entries/nodes.ts +5 -1
- package/src/fan-out-rows.ts +36 -3
- package/src/generate-mask.ts +40 -0
- package/src/generated/unit-contracts.ts +58 -0
- package/src/i18n/types.ts +13 -2
- package/src/json-kinds.ts +24 -4
- package/src/llm-models.ts +184 -31
- package/src/meta-ads-scrape.ts +16 -8
- package/src/model-catalog.ts +285 -13
- package/src/model-constants.ts +260 -5
- package/src/node-default-mappings.ts +3 -0
- package/src/node-preset-extract.ts +8 -0
- package/src/pipeline-types.ts +3 -0
- package/src/presentation-utils.ts +19 -12
- package/src/preview-gate.ts +4 -2
- package/src/private-host.ts +89 -59
- package/src/producer-types.ts +19 -19
- package/src/run-continuation.ts +26 -4
- package/src/speaker-layouts.ts +8 -3
- package/src/speaker-map-contract.ts +77 -0
- package/src/unit-contract-compose.ts +55 -0
- package/src/use-case-types.ts +19 -0
- package/src/video-ui-defaults.ts +7 -5
- package/dist/chunk-3CUFITU7.js.map +0 -1
- package/dist/chunk-5AUSSJIM.cjs.map +0 -1
- package/dist/chunk-5PC6JBGJ.cjs.map +0 -1
- package/dist/chunk-5U7VLG43.js.map +0 -1
- package/dist/chunk-6DKDOWBL.js.map +0 -1
- package/dist/chunk-AROWPFO2.js.map +0 -1
- package/dist/chunk-AVQK77G6.cjs.map +0 -1
- package/dist/chunk-C57NEO3X.js.map +0 -1
- package/dist/chunk-CK3GK34R.js.map +0 -1
- package/dist/chunk-E2TGXG6X.cjs.map +0 -1
- package/dist/chunk-HGC5JNVA.cjs.map +0 -1
- package/dist/chunk-IEBZHTPE.js.map +0 -1
- package/dist/chunk-ISJDAFKS.js.map +0 -1
- package/dist/chunk-J6KHW2E5.cjs.map +0 -1
- package/dist/chunk-JL4C5VJ7.cjs.map +0 -1
- package/dist/chunk-JX5YZ4DH.cjs.map +0 -1
- package/dist/chunk-M36G6SRP.js.map +0 -1
- package/dist/chunk-NT6IJH4L.cjs.map +0 -1
- package/dist/chunk-O7PUQLJ3.cjs.map +0 -1
- package/dist/chunk-PQHS255G.js.map +0 -1
- package/dist/chunk-PRYE7AZQ.cjs.map +0 -1
- package/dist/chunk-Q4CDQ2KO.js.map +0 -1
- package/dist/chunk-RJL7RCEM.cjs.map +0 -1
- package/dist/chunk-SES6GDBQ.cjs.map +0 -1
- package/dist/chunk-VIWSWVAW.js.map +0 -1
- package/dist/chunk-WDIBOWAA.js.map +0 -1
- package/dist/chunk-WNG7HRVA.cjs +0 -25
- package/dist/chunk-WNG7HRVA.cjs.map +0 -1
- package/dist/chunk-YBPBK5KI.js.map +0 -1
- package/dist/chunk-YYV35XOS.js.map +0 -1
- package/dist/chunk-Z2OL5AJD.cjs.map +0 -1
- package/dist/chunk-ZDFHA2EC.js.map +0 -1
- package/dist/chunk-ZRL2UFTH.cjs.map +0 -1
- package/dist/chunk-ZT77RY6R.js.map +0 -1
- package/src/__tests__/__snapshots__/prompt-builder-segments.test.ts.snap +0 -65
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/llm-models.ts"],"names":[],"mappings":";AAmBO,IAAM,wBAAwB,CAAC,MAAA,EAAQ,OAAO,QAAA,EAAU,MAAA,EAAQ,SAAS,KAAK;AAG9E,IAAM,mCAAoD,IAAI,GAAA,CAAI,CAAC,OAAA,EAAS,KAAK,CAAC;AACzF,IAAM,WAAA,GAAkD,EAAE,IAAA,EAAM,CAAA,EAAG,GAAA,EAAK,CAAA,EAAG,MAAA,EAAQ,CAAA,EAAG,IAAA,EAAM,CAAA,EAAG,KAAA,EAAO,CAAA,EAAG,KAAK,CAAA,EAAE;AAiKzG,IAAM,sBAAA,GAAyB;AAG/B,SAAS,qBAAqB,KAAA,EAA4B;AAC/D,EAAA,OAAO,MAAM,oBAAA,IAAwB,sBAAA;AACvC;AAEO,IAAM,UAAA,GAAqC;AAAA,EAChD;AAAA,IACE,EAAA,EAAI,gBAAA;AAAA,IACJ,WAAA,EAAa,gBAAA;AAAA,IACb,IAAA,EAAM,uCAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,SAAA,EAAW,kBAAA;AAAA,IACX,cAAA,EAAgB,gBAAA;AAAA,IAChB,MAAA,EAAQ,QAAA;AAAA,IACR,oBAAA,EAAsB,qBAAA;AAAA,IACtB,cAAA,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AAA;AAAA,EACP,YAAA,EAAc;AAChB;AAEO,SAAS,oBAAoB,CAAA,EAAmC;AACrE,EAAA,OAAQ,yBAAA,CAAgD,SAAS,CAAC,CAAA;AACpE;AAEO,SAAS,yBAAyB,CAAA,EAAwC;AAC/E,EAAA,OAAQ,0BAAA,CAAiD,SAAS,CAAC,CAAA;AACrE;AAWO,SAAS,0BAA0B,KAAA,EAA+B;AACvE,EAAA,IAAI,KAAA,IAAS,wBAAA,CAAyB,KAAK,CAAA,EAAG,OAAO,KAAA;AACrD,EAAA,IAAI,SAAS,MAAA,CAAO,SAAA,CAAU,eAAe,IAAA,CAAK,oBAAA,EAAsB,KAAK,CAAA,EAAG;AAC9E,IAAA,OAAO,qBAAqB,KAA+B,CAAA;AAAA,EAC7D;AACA,EAAA,IAAI,KAAA,IAAS,yBAAA,CAA0B,QAAA,CAAS,KAAK,GAAG,OAAO,KAAA;AAC/D,EAAA,OAAO,4BAAA;AACT","file":"chunk-YBPBK5KI.js","sourcesContent":["/**\n * LLM Model Registry — shared between frontend and backend.\n *\n * Single source of truth for available chat/LLM models routed through KIE.ai,\n * with direct Anthropic SDK fallback for Claude models. This is the\n * NON-monetary side of the registry (model ids, capabilities, tiers,\n * feature defaults). The provider-$ per-token rate table and the\n * `calculateLlmCost` formula derived from it live in\n * `backend/src/lib/pricing/llm-cost.ts` (core, not ee/ — internal LLM cost\n * logging needs them regardless of edition). They were moved out of this\n * package (published Apache-2.0 on npm — an irrevocable grant) per the\n * 2026-07-06 public-flip IP audit, S5: \"Keep the model-id enum; strip prices\n * + measurement notes.\"\n */\n\nexport type LlmTier = \"economy\" | \"standard\" | \"premium\"\nexport type KieApiFormat = \"chat-completions\" | \"messages\" | \"responses\"\nexport type LlmVendor = \"anthropic\" | \"deepseek\" | \"google\" | \"moonshot\" | \"openai\" | \"xai\"\n\nexport const LLM_REASONING_EFFORTS = [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const\nexport type LlmReasoningEffort = (typeof LLM_REASONING_EFFORTS)[number]\n/** Levels that bill one tier up. `high` is the Claude-family server default — it never bumps. */\nexport const EFFORT_TIER_BUMP: ReadonlySet<LlmReasoningEffort> = new Set([\"xhigh\", \"max\"])\nconst EFFORT_RANK: Record<LlmReasoningEffort, number> = { none: 0, low: 1, medium: 2, high: 3, xhigh: 4, max: 5 }\n\nexport interface LlmModelDef {\n id: string\n displayName: string\n desc: string\n tier: LlmTier\n kieFormat: KieApiFormat\n /** For chat-completions: the slug prefix (e.g. \"gemini-3-flash\").\n * For messages: the model id sent in the body (e.g. \"claude-haiku-4-5-v1messages\").\n * For responses: the model id sent in the body (e.g. \"gpt-5-4\"). */\n kieSlugOrModel: string\n vendor: LlmVendor\n supportsImages: boolean\n maxOutputTokens: number\n /**\n * How this model can be forced into schema-valid structured output.\n * - \"anthropic-tool\" → forced tool_choice on the Claude wire (direct SDK\n * guaranteed; KIE's proxy re-serializes the tool call\n * as a `<tool_calls>` text tag — decoded in llm-client).\n * - \"kie-response-format\" → KIE chat-completions `response_format: json_schema`\n * (verified enforced for Gemini via KIE).\n * - \"responses-json-schema\" → KIE codex/v1/responses `text.format: json_schema`\n * (live-verified 2026-07-14 for gpt-5.4/5.5 and the\n * whole GPT-5.6 family, text AND vision inputs).\n * - undefined → no native mode; callers fall back to parse + retry.\n * Capability-driven so `llmCompleteStructured` never hardcodes provider ids.\n */\n structuredOutputMode?: \"anthropic-tool\" | \"kie-response-format\" | \"responses-json-schema\"\n /** If set, fallback to direct Anthropic SDK with this model ID when KIE.ai fails */\n directFallbackModel?: string\n /**\n * Google Gemini API model id for the DIRECT lane (generativelanguage, keyed\n * by `GEMINI_API_KEY`) — the Google-side twin of `directFallbackModel`.\n * Presence declares \"this model CAN be served straight from Google\"; absence\n * pins it to KIE forever. Stated, never derived: Google carries `-preview`\n * suffixes on unreleased models, so the id routinely differs from both `id`\n * and `kieSlugOrModel` (`gemini-3.1-pro` → `gemini-3.1-pro-preview`).\n */\n directGeminiModel?: string\n /**\n * Try the direct-vendor lane FIRST for this model, with KIE as the failure\n * fallback. Absent (while `directGeminiModel` is set) = KIE first, direct\n * only when KIE fails.\n *\n * This is a per-model COST decision, not just a routing one: the two lanes\n * bill the same model at materially different unit rates, so a model that\n * backs a high-volume default (see `LLM_FEATURE_DEFAULTS`) is usually better\n * left on whichever lane is cheaper. The rate tables for both lanes live in\n * `backend/src/lib/pricing/llm-cost.ts` — deliberately not in this package,\n * which is published to npm.\n *\n * Mutually exclusive with `preferKie` — the Claude-side half of the same\n * idea. Guarded by a registry test so the two can't both be set.\n */\n preferDirect?: true\n /** Effort levels this model accepts (ascending). Absent/empty = no effort lever, picker hidden. */\n reasoningEfforts?: readonly LlmReasoningEffort[]\n /**\n * Effort levels available on the DIRECT lane, when the vendor's own API\n * accepts more than the aggregator does. Absent = the direct lane offers the\n * same set as `reasoningEfforts`.\n *\n * This exists because `reasoningEfforts` has to stay at the KIE-safe\n * intersection — sending a level KIE rejects is a hard failure — while the\n * vendor API accepts the full ladder. Unlocking those extra levels is one of\n * the concrete things Advanced mode buys.\n */\n directReasoningEfforts?: readonly LlmReasoningEffort[]\n /** false = model rejects `temperature` (Claude 5-era, GPT-5.6). Absent = accepts. */\n supportsTemperature?: false\n /**\n * false = the model 400s on a FORCED `tool_choice` (`{ type: \"tool\" }` /\n * `{ type: \"any\" }`) — Claude Sonnet 5.5 and Opus 5.5 (vendor docs: \"not\n * supported for this model\"). Absent = forcing is accepted.\n *\n * Only meaningful with `structuredOutputMode: \"anthropic-tool\"`: such a model\n * is asked with `tool_choice: auto` plus an instruction naming the tool, and\n * the tool carries `strict: true` whenever its schema is expressible in the\n * vendor's strict subset (`anthropicStrictToolSchema` in llm-client). The\n * caller's Zod still validates every answer, so nothing the wire withholds is\n * lost. Declared per model, never matched on a model name.\n */\n supportsForcedToolChoice?: false\n /**\n * true = the model binds each thinking block to the exact conversation prefix\n * that produced it (\"preserved thinking\" — Claude Sonnet 5.5 / Opus 5.5 /\n * Haiku 5.5):\n * replaying a block after an earlier turn was edited, dropped or rebuilt is a\n * 400 on accounts the vendor enforces. A caller that trims or rebuilds stored\n * history between requests (the Workflow Copilot keeps a token budget by\n * dropping its oldest turns) must strip thinking blocks from the turns it\n * replays. Within one request's own tool loop the history only grows, so\n * blocks produced there stay valid.\n */\n conversationBoundThinking?: true\n /**\n * true = this model's reasoning effort takes effect ONLY on the vendor's own\n * API: the aggregator accepts the field and silently ignores it. Measured\n * 2026-10-08 for the Claude family on KIE — `low`, `max` and no effort gave\n * the same output length on a reasoning-heavy prompt, and no thinking block\n * ever came back, even on Sonnet 4.6 at `max`.\n *\n * So an effort-bearing call on such a model is SERVED direct, and it bills\n * as Advanced mode does — one rung up (decided 2026-10-08: \"effort =\n * Advanced\"). {@link llmServesDirect} is the one place that decides it, for\n * the credit identifier and the routing alike.\n */\n effortRequiresDirect?: true\n /** Claude-only: KIE is the preferred routing, direct Anthropic the fallback. */\n preferKie?: true\n /**\n * KIE's NON-streaming endpoint for this model is unreliable (measured);\n * `llmComplete` serves it by opening the streaming wire and collapsing it to\n * one response. Streaming responses do not reliably carry\n * `credits_consumed`, so provider cost on this path comes from the rate\n * table (`backend/src/lib/pricing/llm-cost.ts`) rather than the real charge.\n *\n * Declared per model — a per-model condition on KIE's side, like the\n * Claude-lane one behind `callKieMessagesCollapsed`. The flag says WHICH\n * model is affected, and `llm-client` reads it instead of matching model\n * names. Today only the `responses` dispatcher in `callKie` honours it (the\n * one format where the condition has been measured); a chat-completions or\n * messages model that needs the same treatment must also teach its `callKie`\n * case to read the flag — declaring it alone changes nothing there.\n */\n kieCollapseStream?: true\n /**\n * true = the model reasons even when NO thinking parameter is sent, so its\n * reasoning tokens share the `max_tokens` budget on EVERY call — not just\n * effort-bearing ones. Claude Opus 5 flipped this default (on Opus 4.8/4.7\n * and Sonnet 5, omitting `thinking` means no thinking at all).\n *\n * Consumers MUST give such a model output headroom regardless of the\n * requested effort, or reasoning silently eats a small legacy cap and the\n * answer truncates with `stop_reason: max_tokens` — a paid-for empty reply\n * (since #1588 the client fails such a call rather than return the\n * fragment, but the floor is what keeps it from happening). `deriveParams`\n * (llm-client.ts) floors to {@link reasoningOutputFloor}; the film\n * pipeline's `callLLM` — Anthropic SDK only, so only its Claude members\n * matter — floors at the default. Keep the flag in sync with the vendor's\n * documented default rather than inferring it from the model name.\n */\n thinkingDefaultOn?: true\n /**\n * The output-token cap a REASONING call on this model is floored to — the\n * room its thinking shares with the answer (`thinkingDefaultOn`, or an\n * xhigh/max effort). Absent = {@link REASONING_OUTPUT_FLOOR}; read it through\n * {@link reasoningOutputFloor}, never directly.\n *\n * Declare it ONLY where a lane serving this model is not known to accept the\n * default: the floor rides every lane the model can be served on (KIE AND its\n * direct fallback), so it has to sit at the intersection of what they take —\n * the rule `maxOutputTokens` already follows for the Gemini flash entries.\n * Never below `maxOutputTokens` (a floor under the default cap is not a\n * floor — guarded by a registry test).\n */\n reasoningOutputFloor?: number\n}\n\n/** The reasoning floor for a model that declares no lane limit of its own. */\nexport const REASONING_OUTPUT_FLOOR = 32768\n\n/** The output cap a reasoning call on `model` is floored to (see `LlmModelDef.reasoningOutputFloor`). */\nexport function reasoningOutputFloor(model: LlmModelDef): number {\n return model.reasoningOutputFloor ?? REASONING_OUTPUT_FLOOR\n}\n\nexport const LLM_MODELS: readonly LlmModelDef[] = [\n {\n id: \"gemini-3-flash\",\n displayName: \"Gemini 3 Flash\",\n desc: \"Fast and cheap, good for simple tasks\",\n tier: \"economy\",\n kieFormat: \"chat-completions\",\n kieSlugOrModel: \"gemini-3-flash\",\n vendor: \"google\",\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n maxOutputTokens: 8192,\n // KIE-first: no `preferDirect` — direct is the reliability fallback only.\n // (Per-lane rates are deliberately NOT in this published package; see\n // backend/src/lib/pricing/llm-cost.ts.)\n directGeminiModel: \"gemini-3-flash-preview\",\n // No `reasoningEfforts` at all on the KIE lane, but the vendor API accepts\n // the full minimal→high ladder (`none` maps to Google's `minimal`).\n directReasoningEfforts: [\"none\", \"low\", \"medium\", \"high\"],\n // Reasons with no thinking param sent — Google's Gemini 3 default (dynamic\n // thinking; `minimal` is its floor, never off), measured on 3.6 in #1588.\n // Floored at the KIE-safe 8192, the same intersection as `maxOutputTokens`.\n thinkingDefaultOn: true,\n reasoningOutputFloor: 8192,\n },\n {\n id: \"gemini-3.6-flash\",\n displayName: \"Gemini 3.6 Flash\",\n // Demoted 2026-09-06 alongside 3.7: superlatives belong to the CURRENT top\n // model of a family only, and 3.8 now holds that slot.\n desc: \"Fast Gemini, sharper reasoning\",\n tier: \"economy\",\n kieFormat: \"chat-completions\",\n // KIE serves Gemini 3.6 Flash on the OpenAI-compatible dialect under this\n // slug (docs.kie.ai/market/gemini/gemini-3-6-flash-openai.md) — same\n // chat-completions path shape as gemini-3-flash, different slug prefix.\n kieSlugOrModel: \"gemini-3-6-flash-openai\",\n vendor: \"google\",\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n maxOutputTokens: 8192,\n // KIE's 3.6 endpoint accepts `reasoning_effort: low | high` (thinking\n // level) — exactly the chat-completions wire mapping deriveParams sends.\n // Google's own API additionally accepts `minimal` and `medium` on this\n // model; the set stays at the KIE-safe intersection because ONE field\n // feeds both lanes and this model is KIE-first. Widen it only if/when\n // `preferDirect` is set here.\n reasoningEfforts: [\"low\", \"high\"],\n // Google's own API additionally accepts `minimal` and `medium` here —\n // live-verified 2026-07-28. Advanced mode unlocks them.\n directReasoningEfforts: [\"none\", \"low\", \"medium\", \"high\"],\n // KIE-first: this model backs 5 of the LLM_FEATURE_DEFAULTS plus the\n // video-analysis fast tier, so it carries the highest call volume of any\n // Gemini entry — the lane with the lower unit cost wins by default and\n // direct is the reliability fallback only.\n directGeminiModel: \"gemini-3.6-flash\",\n // Reasons with NO thinking param sent — measured, issue #1588: a Generate\n // Text node capped at 1,100 tokens fell back to the direct lane (KIE 500),\n // spent ~1,060 of them reasoning, and returned 120 characters cut mid-URL.\n // On the same input the KIE runs used ~500 output tokens in all, so only\n // the fallback runs broke — every other run of a 5-minute schedule.\n // Floored at 8192, NOT the default 32768: the floor rides the KIE endpoint\n // too, and 8192 is all it is known to take (see `maxOutputTokens`).\n thinkingDefaultOn: true,\n reasoningOutputFloor: 8192,\n },\n {\n id: \"gemini-3.7-flash\",\n displayName: \"Gemini 3.7 Flash\",\n // Demoted 2026-09-06 when 3.8 registered below: superlatives belong to the\n // CURRENT top model of a family only (same rule the Opus entries follow) —\n // `desc` renders in every picker, so leaving \"Newest\" on the older flash\n // steers the A/B's traffic backwards.\n desc: \"Fast Gemini, agentic-tuned\",\n tier: \"economy\",\n kieFormat: \"chat-completions\",\n // KIE serves it on the OpenAI-compatible dialect under this slug\n // (docs.kie.ai/market/gemini/gemini-3-7-flash-openai.md) — same\n // chat-completions path shape as gemini-3.6-flash.\n kieSlugOrModel: \"gemini-3-7-flash-openai\",\n vendor: \"google\",\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n // Google's own cap is 65,536, but the field feeds BOTH lanes and the KIE\n // flash endpoints cap at 8192 (the measured 3.6 posture) — stay at the\n // KIE-safe intersection, same reasoning as `reasoningEfforts` below.\n maxOutputTokens: 8192,\n // KIE's 3.7 endpoint enumerates reasoning_effort low | high (verified\n // against its OpenAPI spec 2026-08-18), identical to 3.6.\n reasoningEfforts: [\"low\", \"high\"],\n // Assumed parity with 3.6 pending a live probe on the direct lane.\n directReasoningEfforts: [\"none\", \"low\", \"medium\", \"high\"],\n directGeminiModel: \"gemini-3.7-flash\",\n // Gemini 3 default: reasons with no thinking param sent (measured on 3.6,\n // #1588). KIE-safe floor, same intersection as `maxOutputTokens`.\n thinkingDefaultOn: true,\n reasoningOutputFloor: 8192,\n },\n {\n id: \"gemini-3.8-flash\",\n displayName: \"Gemini 3.8 Flash\",\n // Inherits \"Newest\" from 3.7 (demoted above). Deliberately does NOT name\n // agentic video: that capability exists only on the direct Google lane\n // (Interactions API, not wired here) and the modality caps below withhold\n // video — a picker desc must not promise a lever this entry cannot expose.\n desc: \"Newest fast Gemini, agentic-tuned\",\n tier: \"economy\",\n kieFormat: \"chat-completions\",\n // KIE serves it on the OpenAI-compatible dialect under this slug\n // (docs.kie.ai/market/gemini/gemini-3-8-flash-openai.md) — identical\n // chat-completions path shape to gemini-3.7-flash / gemini-3.6-flash,\n // different slug prefix.\n kieSlugOrModel: \"gemini-3-8-flash-openai\",\n vendor: \"google\",\n // Live-verified 2026-09-06 on the KIE lane: `response_format: json_schema`\n // is ENFORCED (the reply came back exact-schema valid, credits_consumed\n // present) — not merely accepted-and-ignored.\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n // 16384 here, NOT the 8192 its 3.6 / 3.7 siblings sit at. Those two stay at\n // the KIE-safe intersection because nobody measured their endpoints past\n // it; 3.8's WAS measured — live-verified 2026-09-06, `max_tokens: 20000`\n // was honored for 14,892 completion tokens with finish_reason \"stop\" (no\n // truncation), so the KIE lane is not the binding constraint. 16384 keeps\n // it level with the rest of the registry's ceiling rather than at the cap.\n maxOutputTokens: 16384,\n // KIE's 3.8 endpoint enumerates reasoning_effort low | high (its doc enum),\n // and usage carries completion_tokens_details.reasoning_tokens — same\n // KIE-safe intersection as 3.6 / 3.7, because ONE field feeds both lanes\n // and this model is KIE-first.\n reasoningEfforts: [\"low\", \"high\"],\n // Google's own API accepts the full minimal→high ladder here (`none` maps\n // to `minimal`), same as 3.7. Advanced mode is what unlocks it.\n directReasoningEfforts: [\"none\", \"low\", \"medium\", \"high\"],\n // KIE-first (no `preferDirect`) — 3.7's posture exactly: the cheap lane\n // serves the A/B, direct is Advanced mode + the reliability fallback.\n directGeminiModel: \"gemini-3.8-flash\",\n // Gemini 3 default: reasons with no thinking param sent (measured on 3.6,\n // #1588). Floored at its own 16384, inside the 20000 its KIE endpoint was\n // measured to honour.\n thinkingDefaultOn: true,\n reasoningOutputFloor: 16384,\n },\n {\n id: \"claude-haiku-4.5\",\n displayName: \"Claude Haiku 4.5\",\n // Demoted 2026-10-10 when claude-haiku-5.5 registered.\n desc: \"Previous Haiku, fast economy\",\n tier: \"economy\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-haiku-4-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 8192,\n directFallbackModel: \"claude-haiku-4-5-20251001\",\n // KIE-first since 2026-10-08 (a call is priced on the lane it runs on);\n // KIE served it plain and with a tool on its streaming wire that day.\n preferKie: true,\n },\n {\n id: \"claude-haiku-5.5\",\n displayName: \"Claude Haiku 5.5\",\n desc: \"Latest Haiku, fast and low-cost with reasoning\",\n tier: \"economy\",\n kieFormat: \"messages\",\n // KIE plain id on the Claude-native messages dialect\n // (docs.kie.ai/market/claude/claude-haiku-5-5.md). Live-probed 2026-10-10\n // on the streaming wire: plain, system prompt, base64 image, a forced tool\n // and an auto + strict tool (both came back as a real tool_use block), and\n // `max_tokens: 32768` were all served.\n kieSlugOrModel: \"claude-haiku-5-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n // NO `supportsForcedToolChoice: false`, unlike Sonnet 5.5 / Opus 5.5: this\n // model ACCEPTS a forced tool_choice (probed on Anthropic's API 2026-10-10).\n // A forced call skips thinking (same usage with and without an effort), and\n // an effort-bearing structured call is already sent the auto choice.\n //\n // A thinking block is valid only while everything before it is unchanged\n // (vendor docs: the same history check the other 5.5 models run).\n conversationBoundThinking: true,\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-haiku-5-5\",\n // The first Haiku with effort levels. The vendor default is `medium`, where\n // most of the family defaults to `high`.\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores effort on this slug too — measured 2026-10-10 on a\n // reasoning-heavy prompt: none / low / max / KIE's own `thinkingFlag` gave\n // 2,076 / 1,886 / 2,223 / 1,927 output tokens and no thinking block, while\n // Anthropic's API gave 2,059 at low and 28,097 at max. An effort call runs\n // direct and bills as Advanced.\n effortRequiresDirect: true,\n // Anthropic 400s a non-default sampling value (\"`temperature` is deprecated\n // for this model\", probed 2026-10-10); KIE's proxy accepted temperature: 0.2.\n supportsTemperature: false,\n preferKie: true,\n // Adaptive thinking runs when no thinking param is sent (vendor default),\n // on BOTH lanes: a no-effort KIE call spent ~2,000 output tokens on a\n // ~350-token answer and returned no thinking block.\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-sonnet-4.6\",\n displayName: \"Claude Sonnet 4.6\",\n desc: \"Balanced quality and speed\",\n tier: \"standard\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-sonnet-4-6\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-sonnet-4-6\",\n // KIE-first since 2026-10-08 (a call is priced on the lane it runs on);\n // KIE served it plain and with a tool on its streaming wire that day.\n preferKie: true,\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n },\n {\n id: \"gpt-5.2\",\n displayName: \"GPT-5.2\",\n desc: \"Strong general purpose\",\n tier: \"standard\",\n kieFormat: \"chat-completions\",\n kieSlugOrModel: \"gpt-5-2\",\n vendor: \"openai\",\n supportsImages: true,\n maxOutputTokens: 16384,\n },\n {\n id: \"gemini-3.1-pro\",\n displayName: \"Gemini 3.1 Pro\",\n desc: \"Advanced reasoning, large context\",\n tier: \"premium\",\n kieFormat: \"chat-completions\",\n kieSlugOrModel: \"gemini-3.1-pro\",\n vendor: \"google\",\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directGeminiModel: \"gemini-3.1-pro-preview\",\n // Google documents low/medium/high for 3.1 Pro — no `minimal` tier, so\n // this ladder is deliberately shorter than the flash models'.\n directReasoningEfforts: [\"low\", \"medium\", \"high\"],\n // NO `reasoningEfforts` (the proxied ladder) ON PURPOSE, not an omission.\n // That endpoint accepts `reasoning_effort: low | high` and already DEFAULTS\n // to \"high\", so leaving it unset gets its deepest setting and a ladder here\n // would unlock nothing. The two lanes are NOT equivalent at their maxima:\n // verified 2026-07-29 on identical input, the proxy's ceiling produces\n // roughly a quarter of the reasoning tokens that the direct lane's\n // `thinkingLevel: HIGH` does, and it does not expose Google's deeper tiers\n // at all. That difference is visible in fine-detail reading (small on-screen\n // text such as a name badge), which is exactly what video-analysis casts\n // identities from — so adding an entry here would silently move analysis to\n // the shallower lane. Don't. Full comparison lives with the analysis engine.\n // KIE-first since 2026-10-08 (decided: a call is priced on the lane it runs\n // on, so the base premium price buys the KIE lane; the direct lane is\n // Advanced mode, billed `premium-direct`). It was the one direct-first\n // Gemini before. What the direct lane buys, now behind Advanced: real\n // `thinkingLevel` control, native media ingestion, and a `responseJsonSchema`\n // that honours `additionalProperties` (KIE's `response_format` silently DROPS\n // record/map-shaped fields — see the z.record rule in backend/CLAUDE.md).\n // Video-analysis is unaffected: it pins `requireLane: \"direct\"` itself.\n // Reasons with no thinking param sent on both lanes — the proxied endpoint\n // DEFAULTS to \"high\" (above), and the direct lane reasons harder still.\n // Floored at its own 16384: its KIE fallback is not known to take more.\n thinkingDefaultOn: true,\n reasoningOutputFloor: 16384,\n },\n {\n id: \"claude-opus-4.7\",\n displayName: \"Claude Opus 4.7\",\n // Superlatives belong to the CURRENT top model only — `desc` renders in every\n // model picker, so leaving \"highest quality\" on an older Opus steers\n // quality-critical work backwards (all three Opus entries bill premium, so\n // the mis-steer is invisible on the invoice).\n desc: \"Older Opus, complex tasks\",\n tier: \"premium\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-opus-4-7\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-opus-4-7\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n },\n {\n id: \"gpt-5.4\",\n displayName: \"GPT-5.4\",\n // Demoted 2026-09-06: two GPT generations have shipped above it, so\n // \"Latest\" steered the picker at the oldest premium GPT in the registry.\n desc: \"Older GPT, premium quality\",\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-5-4\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"low\", \"medium\", \"high\"],\n },\n {\n id: \"gpt-5.5\",\n displayName: \"GPT-5.5\",\n desc: \"Previous flagship GPT, deep reasoning\",\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-5-5\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n },\n {\n id: \"gpt-5.6-luna\",\n displayName: \"GPT-5.6 Luna\",\n desc: \"Fastest GPT-5.6, high-volume workloads\",\n tier: \"economy\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-5-6-luna\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n },\n {\n id: \"gpt-5.6-terra\",\n displayName: \"GPT-5.6 Terra\",\n desc: \"Balanced GPT-5.6 for production work\",\n tier: \"standard\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-5-6-terra\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n },\n {\n id: \"gpt-5.6-sol\",\n displayName: \"GPT-5.6 Sol\",\n // Demoted 2026-09-06 when gpt-6-astra registered below — \"Flagship /\n // deepest\" is the current top GPT's copy only. Worded to stay distinct\n // from gpt-5.5's \"Previous flagship GPT, deep reasoning\": all three read\n // premium on the invoice, so a stale superlative mis-steers silently.\n desc: \"Previous flagship GPT-5.6, deep reasoning\",\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-5-6-sol\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n // SERVED COLLAPSED, on the astra precedent (2026-09-17). The 2026-07-14\n // verification that KIE's non-stream responses endpoint serves the GPT-5.6\n // family reliably no longer holds: a live call — a recast continuity\n // review, ~3k tokens, `reasoning.effort: high`, `text.format: json_schema`\n // — came back `500 {\"error\":{\"type\":\"server_error\"}}` / \"Server exception,\n // please try again later\". Same endpoint family, same dialect and the same\n // signature astra was measured on (12 calls: non-stream 2/6, streaming\n // 5/6; a schema-less non-stream call 500'd too, so the lane is the trigger\n // and not the schema). ONE sighting here rather than a fresh 12-call probe\n // — the precedent is strong and the flag is cheap to reverse.\n //\n // THE COST: SSE does not reliably carry `credits_consumed`, so this model's\n // provider cost becomes the rate-table estimate instead of the billed\n // figure. That is the price of a lane that answers, and it is the same\n // trade astra already makes.\n kieCollapseStream: true,\n },\n {\n id: \"gpt-6-astra\",\n displayName: \"GPT-6 Astra\",\n desc: \"Flagship GPT-6, deepest reasoning\",\n tier: \"premium\",\n kieFormat: \"responses\",\n // KIE serves GPT-6 on the responses dialect under the OpenAI family path —\n // codex/v1/responses, which llm-client DERIVES from `vendor` (the same\n // derivation that keeps Grok on grok/v1/responses). So this field is the\n // body `model` only, not a path segment. Live-verified 2026-09-06 on the\n // streaming path (array `input`, SSE deltas), which is the ONLY path we\n // serve it on — see `kieCollapseStream` below. The non-stream reply does\n // carry `credits_consumed` (and cached_tokens/cache_write_tokens in usage)\n // on the ~1 call in 3 that returns one, but we no longer take that reply,\n // so provider cost here is the rate-table estimate.\n // KIE's codex/v1/responses injects its own Codex-agent `instructions`\n // prompt ABOVE the caller's `developer` message — observed in the\n // 2026-07-14 live probe of that endpoint, and unchanged for GPT-6. Budget\n // for it when a developer message has to dominate.\n kieSlugOrModel: \"gpt-6-astra\",\n vendor: \"openai\",\n // Live-verified 2026-09-06: `text.format: json_schema` is passed through\n // and ENFORCED — the server echoed `strict: true` and returned\n // schema-valid JSON.\n structuredOutputMode: \"responses-json-schema\",\n // text + image + file inputs per KIE's doc. No video/audio — see the\n // image-only LLM_MODALITY_CAPS row below.\n supportsImages: true,\n maxOutputTokens: 16384,\n // KIE's documented enum for this endpoint. No `none` on purpose: the\n // endpoint reasons unconditionally (see thinkingDefaultOn below), so a\n // \"none\" level would be a lie the wire silently overrides.\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\"],\n // Live-probed 2026-09-06: `temperature: 0.2` was sent and the request echo\n // stayed at 1.0 — silently IGNORED, so never send it. Same treatment as the\n // GPT-5.6 family and grok-4.6.\n supportsTemperature: false,\n // With NO reasoning param sent, the server echoed effort \"medium\" — it\n // reasons by default (2026-09-06), so reasoning tokens share `max_tokens`\n // on EVERY call, not just effort-bearing ones. Consumers must floor output\n // headroom off this flag or a premium answer truncates into a paid-for\n // empty reply.\n thinkingDefaultOn: true,\n // Measured 2026-09-06, 12 identical requests (developer + user message,\n // reasoning.effort low, text.format json_schema): `stream: false`\n // succeeded 2/6 in 4–5 s and 500'd 4/6 with\n // {\"error\":{\"type\":\"server_error\"}} after 34, 34, 35 and 64 s, while the\n // same body with `stream: true` succeeded 5/6 in the same 4–5 s. An\n // earlier non-stream probe timed out at 90 s with 0 bytes, and a\n // non-stream call WITHOUT a schema 500'd after 65 s — the schema is not\n // the trigger, the non-stream lane is. The very same endpoint serves\n // gpt-5.4/5.5/5.6 non-stream reliably (live-verified 2026-07-14), which is\n // why this is per-model and not a lane-wide flag.\n kieCollapseStream: true,\n },\n // ── GPT-6 Luna / Sol / 6.1 Sol ────────────────────────────────────────────\n // Same KIE endpoint and dialect as gpt-6-astra (codex/v1/responses; the doc\n // pages differ only in the model name). Live-probed 2026-10-08, per model:\n // `text.format` json_schema ENFORCED (echo `strict: true`, schema-valid\n // reply), `temperature: 0.2` echoed back as 1 → silently ignored, no\n // reasoning param → echo \"medium\" (reasons by default), and data-URI vision.\n // Unlike astra, the NON-stream lane served them reliably — luna 10/10 and sol\n // 10/10, 6.1 sol 8/8 at levels other than `none` (incl. 4 long structured\n // calls each, 500–1,500 output tokens) — so none of them is collapsed:\n // `credits_consumed` stays the real provider charge.\n // Their ladder is WIDER than astra's doc-enum one: `none` and `max` were each\n // sent and echoed back by the endpoint (6.1 sol excepted below).\n {\n id: \"gpt-6-luna\",\n displayName: \"GPT-6 Luna\",\n desc: \"Fastest GPT-6, high-volume workloads\",\n tier: \"economy\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-6-luna\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n thinkingDefaultOn: true,\n },\n {\n id: \"gpt-6-sol\",\n displayName: \"GPT-6 Sol\",\n desc: \"Strong GPT-6, deep reasoning at lower cost\",\n // Premium by decision (2026-10-08), not by unit cost — \"Sol\" is the\n // deep-reasoning rung of the family, and gpt-5.6-sol bills premium too.\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-6-sol\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n thinkingDefaultOn: true,\n },\n {\n id: \"gpt-6.1-sol\",\n displayName: \"GPT-6.1 Sol\",\n // Measured slow: 30–76 s for 500–1,100 output tokens (2026-10-08), roughly\n // twice gpt-6-sol on the same request — say so where the picker shows it.\n desc: \"Newest GPT-6 Sol, thorough but slower\",\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-6-1-sol\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n // NO `none`: every probe at `reasoning.effort: none` failed (502, a 120 s\n // timeout, 502, 429 — 0/4, 2026-10-08) while every other level answered,\n // and the same request at `none` succeeded on luna and sol. Clamping maps a\n // `none` request to nothing sent (Auto) rather than to a level that fails.\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n thinkingDefaultOn: true,\n },\n {\n id: \"grok-4.6\",\n displayName: \"Grok 4.6\",\n // Demoted 2026-10-08 when grok-4.7 registered — the flagship copy moved up.\n desc: \"Previous Grok, strong reasoning\",\n tier: \"standard\",\n kieFormat: \"responses\",\n // KIE serves Grok on the responses dialect under its own family path —\n // grok/v1/responses, NOT codex/v1/responses (llm-client derives the path\n // from `vendor`). Live-verified end-to-end 2026-08-18: array `input`,\n // `developer` system role, `input_image` URL vision, `text.format`\n // json_schema enforcement, SSE `response.output_text.delta` stream, and\n // `credits_consumed` actual-cost capture. (grok-4.5 was deferred 2026-07-13\n // because none of this was live; 4.6 is its activation.)\n kieSlugOrModel: \"grok-4-6\",\n vendor: \"xai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n // KIE's documented enum, each level live-verified (echoed back) 2026-08-18.\n // No `none`: the endpoint reasons unconditionally (see thinkingDefaultOn).\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\"],\n // Live-probed 2026-08-18: `temperature` is silently IGNORED (request echo\n // stays at the 0.7 default), so never send it — same treatment as GPT-5.5+.\n supportsTemperature: false,\n // Reasons with NO reasoning param sent (effort defaults to \"low\" server-side\n // — a trivial probe spent 169 of 170 output tokens on reasoning), so every\n // call needs output headroom, not just xhigh.\n thinkingDefaultOn: true,\n },\n {\n id: \"grok-4.7\",\n displayName: \"Grok 4.7\",\n desc: \"xAI flagship, strong reasoning\",\n tier: \"standard\",\n kieFormat: \"responses\",\n // Same grok/v1/responses family path and wire as grok-4.6 (the KIE doc\n // pages differ only in the model name). Live-probed 2026-10-08: non-stream\n // 6/6, `text.format` json_schema enforced, data-URI vision, SSE deltas.\n kieSlugOrModel: \"grok-4-7\",\n vendor: \"xai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n // 4.6's ladder. `none` is NOT honoured: the endpoint echoed it back as\n // \"minimal\" and still reasoned (33 of 35 output tokens), so offering it\n // would promise a lever the wire overrides.\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\"],\n // `temperature: 0.2` → echo stayed at the 0.7 default: ignored.\n supportsTemperature: false,\n // \"Capital of France\" with no reasoning param spent 310 of 311 output\n // tokens reasoning.\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-sonnet-5\",\n displayName: \"Claude Sonnet 5\",\n // Demoted 2026-10-08 when claude-sonnet-5.5 registered.\n desc: \"Previous Sonnet, near-Opus quality\",\n tier: \"standard\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-sonnet-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-sonnet-5\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n },\n {\n id: \"claude-sonnet-5.5\",\n displayName: \"Claude Sonnet 5.5\",\n desc: \"Latest Sonnet, near-Opus quality at Sonnet cost\",\n tier: \"standard\",\n kieFormat: \"messages\",\n // KIE serves it on the Claude-native messages dialect under its plain id\n // (docs.kie.ai/market/claude/claude-sonnet-5-5.md — the page is\n // claude-opus-5's with the model name swapped). Live-probed 2026-10-08 on\n // the streaming wire: plain, effort, and forced/auto+strict tool calls all\n // answered.\n kieSlugOrModel: \"claude-sonnet-5-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n // Anthropic 400s a forced tool_choice on this model. KIE's proxy happened\n // to accept one in the probe, but the direct lane is where every\n // effort-bearing and every streamed structured call goes.\n supportsForcedToolChoice: false,\n conversationBoundThinking: true,\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-sonnet-5-5\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n // Anthropic rejects non-default sampling values on this model (KIE's proxy\n // accepted temperature: 0.2 in the probe; the direct lane is the contract).\n supportsTemperature: false,\n preferKie: true,\n // Adaptive thinking runs when no thinking param is sent (vendor default).\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-opus-4.8\",\n displayName: \"Claude Opus 4.8\",\n desc: \"Previous-gen Opus, long-horizon work\",\n tier: \"premium\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-opus-4-8\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-opus-4-8\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n },\n {\n id: \"claude-opus-5\",\n displayName: \"Claude Opus 5\",\n // Demoted 2026-10-08 when claude-opus-5.5 registered.\n desc: \"Previous Opus, deep agentic reasoning\",\n tier: \"premium\",\n kieFormat: \"messages\",\n // KIE serves Opus 5 on the Claude-native messages dialect under the plain\n // id (docs.kie.ai/market/claude/claude-opus-5.md) — same path shape as\n // claude-opus-4-8 / claude-fable-5.\n kieSlugOrModel: \"claude-opus-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-opus-5\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n // Opus 5 reasons with NO thinking param sent (vendor default flipped from\n // Opus 4.8/4.7) — so every call needs output headroom, not just xhigh/max.\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-opus-5.5\",\n displayName: \"Claude Opus 5.5\",\n // Positioned as Fable-class (decided 2026-10-08: offered wherever Fable is).\n desc: \"Latest Opus, frontier-class reasoning\",\n tier: \"premium\",\n kieFormat: \"messages\",\n // KIE plain id on the messages dialect (docs.kie.ai/market/claude/\n // claude-opus-5-5 — claude-opus-5's page with the name swapped).\n // Live-probed 2026-10-08 on the streaming wire (plain + effort); the KIE\n // Claude lane was erroring for claude-opus-5 too during the tool probes.\n kieSlugOrModel: \"claude-opus-5-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n // Forced tool_choice is a 400 on this model (vendor docs) — see the field.\n supportsForcedToolChoice: false,\n conversationBoundThinking: true,\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-opus-5-5\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n // Thinking cannot be turned off on this model at all (`disabled` is a 400\n // at every effort); with no effort sent it runs adaptive at the vendor's\n // `medium` default. Nothing on our wire sends `disabled`.\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-fable-5\",\n displayName: \"Claude Fable 5\",\n desc: \"Frontier Claude above Opus, hardest problems\",\n tier: \"premium\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-fable-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-fable-5\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n // Thinking is always on (vendor docs: `disabled` is not supported), so it\n // shares the output cap on every call.\n thinkingDefaultOn: true,\n },\n // ── Moonshot / DeepSeek ───────────────────────────────────────────────────\n // Both on KIE's THIRD responses family path, openai/v1/responses (llm-client\n // derives it from `vendor`). KIE labels both pages \"Chat only — not adapted\n // for agent use\": fine for single (structured) completions, so neither may\n // back a tool-loop feature.\n {\n id: \"kimi-k3\",\n displayName: \"Kimi K3\",\n desc: \"Moonshot flagship, 1M context, careful reasoning\",\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"kimi-k3\",\n vendor: \"moonshot\",\n // Live-probed 2026-10-08: `text.format` json_schema is ENFORCED — asked to\n // answer \"no json here\" in plain prose, it returned schema-shaped JSON.\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n // KIE's documented enum. The endpoint accepted xhigh/none without error but\n // never echoes an effort back, so nothing beyond the doc is verifiable.\n reasoningEfforts: [\"low\", \"medium\", \"high\"],\n // The doc lists no `temperature` field at all.\n supportsTemperature: false,\n // \"Reasons by default\" per KIE's doc (its usage reports no reasoning-token\n // split, so this is the doc's word, not a measurement).\n thinkingDefaultOn: true,\n },\n {\n id: \"deepseek-v4.1-flash\",\n displayName: \"DeepSeek V4.1 Flash\",\n desc: \"Very cheap and fast, solid reasoning\",\n tier: \"economy\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"deepseek-v4-1-flash\",\n vendor: \"deepseek\",\n // Live-probed 2026-10-08: json_schema echoed `strict: true` and enforced.\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n // ADVISORY ONLY: KIE documents `max_output_tokens` as \"not supported … no\n // effect\" on this model (a probe sending it was accepted and ignored), so\n // neither this cap nor the reasoning floor binds its output length, and the\n // `incomplete` cap-stop signal cannot fire from our own cap.\n maxOutputTokens: 16384,\n // The endpoint takes none/minimal/low/medium/high/xhigh/max; each of none,\n // low and xhigh was echoed back. `minimal` is not in our ladder.\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // Documented \"not supported … no effect\".\n supportsTemperature: false,\n thinkingDefaultOn: true,\n },\n] as const\n\nexport const LLM_MODEL_IDS = LLM_MODELS.map((m) => m.id)\n\n/** Vision models that can return GUARANTEED structured output — the\n * describe-to-picker analyzer forces a schema over an image, so its model\n * pickers AND the backend route gate offer exactly these: Anthropic (forced\n * tool), Gemini (KIE `response_format`), and GPT responses-format models\n * (KIE `text.format` json_schema — vision+schema live-verified 2026-07-14).\n * Single source of truth so the picker, the config panel, and the route gate\n * can't drift. */\nexport const STRUCTURED_VISION_MODELS = LLM_MODELS.filter(\n (m) => m.supportsImages && m.structuredOutputMode != null,\n)\n\n/**\n * Vendor presentation order + labels for model pickers. Every LlmVendor MUST\n * appear in the order list (guarded by a registry test) so a new vendor can't\n * ship with its models silently sorted to the end of every menu unlabeled.\n * Alphabetical on purpose: stable, and no vendor-preference fights.\n */\nexport const LLM_VENDOR_ORDER: readonly LlmVendor[] = [\"anthropic\", \"deepseek\", \"google\", \"moonshot\", \"openai\", \"xai\"]\nexport const LLM_VENDOR_LABELS: Record<LlmVendor, string> = {\n anthropic: \"Anthropic\",\n deepseek: \"DeepSeek\",\n google: \"Google\",\n moonshot: \"Moonshot AI\",\n openai: \"OpenAI\",\n xai: \"xAI\",\n}\n\nconst TIER_RANK: Record<LlmTier, number> = { economy: 0, standard: 1, premium: 2 }\n\nexport interface LlmModelGroup {\n vendor: LlmVendor\n /** Display heading for the group (LLM_VENDOR_LABELS[vendor]). */\n label: string\n models: LlmModelDef[]\n}\n\n/**\n * The ONE ordering every LLM model menu renders: grouped by vendor (in\n * LLM_VENDOR_ORDER), and inside each group sorted economy → standard → premium\n * (registry order breaks ties, which keeps family generations adjacent).\n * A flat registry-order dump was genuinely hard to scan at 17 models — every\n * picker (config panel, quick strips, quick toolbar) derives from this so the\n * menus can't drift apart. Groups with no models (after `filter`) are omitted.\n */\nexport function groupLlmModelsByVendor(models: readonly LlmModelDef[] = LLM_MODELS): LlmModelGroup[] {\n const groups: LlmModelGroup[] = []\n for (const vendor of LLM_VENDOR_ORDER) {\n const members = models\n .filter((m) => m.vendor === vendor)\n .sort((a, b) => TIER_RANK[a.tier] - TIER_RANK[b.tier])\n if (members.length > 0) groups.push({ vendor, label: LLM_VENDOR_LABELS[vendor], models: members })\n }\n return groups\n}\n\n/** {@link groupLlmModelsByVendor} flattened — for menus that can't render\n * group headers (e.g. the compact node quick strips) but should still read\n * vendor-clustered and tier-ordered. */\nexport function orderedLlmModels(models: readonly LlmModelDef[] = LLM_MODELS): LlmModelDef[] {\n return groupLlmModelsByVendor(models).flatMap((g) => g.models)\n}\n\nexport type LlmFeature =\n | \"ai-writer\"\n | \"llm-chat\"\n | \"prompt-helper\"\n | \"scene-graph-ai\"\n | \"after-effects\"\n | \"motion-graphics\"\n | \"motion-graphics-lottie\"\n | \"lottie-overlay\"\n | \"3d-title\"\n // Scene3D previz authoring — generate-3d-scene AND edit-3d-scene share one\n // feature: both send the model a scene (the edit sends the WHOLE plan in) and\n // both get back structured geometry, so the token profile is the same shape.\n // The deterministic edit lane never reaches an LLM and bills the separate\n // zero-cost `3d-scene-ops` identifier instead.\n | \"3d-scene\"\n | \"image-to-text\"\n // Per-ad creative analysis on the social scraper nodes (Meta Ads first):\n // one structured vision call per ad, priced per REQUESTED ad by tier and\n // folded into the scrape's own identifier (packages/shared/meta-ads-scrape).\n | \"meta-ads-analysis\"\n | \"describe-to-picker\"\n | \"qa-check\"\n | \"generate-script\"\n | \"translate\"\n | \"image-critic\"\n // Choose Best (reduce) — the pick-best-llm strategy's judge. Its own\n // feature (not ai-writer, which it used to piggyback on) so the model\n // default and the tiered credit ids are the strategy's own.\n | \"pick-best-llm\"\n // In-app Workflow Copilot turns (backend agent loop; metered, reservation\n // ceiling under `STATIC_CREDIT_COSTS[\"workflow-copilot\"]`).\n | \"workflow-copilot\"\n // \"Steal the format\": Content Recipe (why a post worked, one structured\n // call over its analysis) and Content Ideas (recipes + brand → ideas, a\n // call per five ideas). Cloud-only; the implementation is a private plugin.\n // Ideas are priced per batch of five — see content-recipe-ideas.ts.\n | \"content-recipe\"\n | \"content-ideas\"\n\n/** Engine-dependent LlmFeature for the motion-graphics node (design §8: every credit-id site must branch on engine). */\nexport function motionGraphicsFeature(engine?: string): LlmFeature {\n return engine === \"lottie\" ? \"motion-graphics-lottie\" : \"motion-graphics\"\n}\n\n/** Feature → default model when user hasn't selected one */\nexport const LLM_FEATURE_DEFAULTS: Record<LlmFeature, string> = {\n \"ai-writer\": \"claude-sonnet-4.6\",\n \"llm-chat\": \"gemini-3.6-flash\",\n \"prompt-helper\": \"gemini-3.6-flash\",\n \"scene-graph-ai\": \"claude-sonnet-4.6\",\n \"after-effects\": \"claude-sonnet-4.6\",\n \"motion-graphics\": \"claude-sonnet-4.6\",\n \"motion-graphics-lottie\": \"claude-sonnet-4.6\",\n \"lottie-overlay\": \"claude-sonnet-4.6\",\n \"3d-title\": \"claude-sonnet-4.6\",\n \"3d-scene\": \"claude-sonnet-4.6\",\n \"image-to-text\": \"claude-sonnet-4.6\",\n // Economy on purpose: the analysis reads ONE frame + the copy per ad and\n // runs once per returned ad — volume, not depth. Must stay an image-capable\n // structured-output model (STRUCTURED_VISION_MODELS); a registry test pins it.\n \"meta-ads-analysis\": \"gemini-3.6-flash\",\n // Moved from claude-opus-5 on 2026-10-08 (decided: Opus 5.5 takes the Opus 5\n // defaults). Still an image-capable structured model — a registry test pins it.\n \"describe-to-picker\": \"claude-opus-5.5\",\n \"qa-check\": \"gemini-3.6-flash\",\n \"generate-script\": \"gemini-3.6-flash\",\n \"translate\": \"gemini-3.6-flash\",\n \"image-critic\": \"claude-sonnet-4.6\",\n \"pick-best-llm\": \"claude-sonnet-4.6\",\n \"workflow-copilot\": \"claude-sonnet-5\",\n // Both economy on purpose — measured: ten ideas in Hebrew took ~1 min here\n // and ~3.5 min (two calls) on claude-sonnet-4.6. The private plugin keeps\n // the same two defaults for API callers that omit the model.\n \"content-recipe\": \"gemini-3.6-flash\",\n \"content-ideas\": \"gemini-3.6-flash\",\n}\n\n/**\n * Feature → the reasoning effort its DEFAULT model runs at when the caller\n * sends none. Read it through {@link defaultReasoningEffort}, never directly:\n * the effort belongs to the default model, so a call on any other model must\n * not pick it up.\n */\nexport const LLM_FEATURE_DEFAULT_EFFORTS: Partial<Record<LlmFeature, LlmReasoningEffort>> = {\n // Decided 2026-10-09 from the picker bake-off v2: Opus 5.5 at `high` read\n // 4/4 portraits with the most attributes per image, ~9 s a read. Its effort\n // only takes effect on Anthropic's own API (`effortRequiresDirect`), so the\n // default analysis runs direct — and bills as such (`llmServesDirect`).\n \"describe-to-picker\": \"high\",\n}\n\n/**\n * The reasoning effort a `feature` call runs at when the caller sends none:\n * the feature's default effort ({@link LLM_FEATURE_DEFAULT_EFFORTS}), but ONLY\n * while the call runs on the feature's default model — named, or omitted\n * (`undefined` / `\"\"`) so the default model applies. A caller who picked\n * another model and no effort gets `undefined`: that model's Auto, as before.\n *\n * WHY only on the default model: the default effort is part of the default\n * model's recipe, not a global policy. Forcing `high` on a Gemini or GPT call\n * that never asked for it would change the timing of every existing workflow\n * that picked one (and, on a Claude model, its lane and its bill).\n *\n * The one place the route, the node's credit badge and its effort pickers\n * read, so what runs, what is billed and what is shown cannot disagree.\n */\nexport function defaultReasoningEffort(feature: string, modelId?: string): LlmReasoningEffort | undefined {\n const effort = LLM_FEATURE_DEFAULT_EFFORTS[feature as LlmFeature]\n if (!effort) return undefined\n if (!modelId) return effort\n return getLlmModel(modelId)?.id === LLM_FEATURE_DEFAULTS[feature as LlmFeature] ? effort : undefined\n}\n\n/**\n * Per-model multimodal input capabilities. Drives both frontend UI gating\n * and backend route-level filtering for the LLM Chat node references.\n *\n * As of 2026-05: Claude Messages API supports text + image only (no audio,\n * no video). Gemini 2/3 family supports image + video + audio natively.\n * GPT-5.x via KIE chat-completions / responses supports image only — audio\n * input requires a separate audio-capable model we don't route to today.\n */\nexport const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean; audio: boolean }> = {\n \"gemini-3-flash\": { image: true, video: true, audio: true },\n \"gemini-3.6-flash\": { image: true, video: true, audio: true },\n // gemini-3.7-flash is IMAGE-ONLY by DECISION, not omission: full video+audio\n // caps would auto-enroll it in VIDEO_ANALYSIS_LLM_MODELS (derived below) and\n // force a video-analysis tier + pricing decision that is deliberately\n // deferred while the smart-family A/B routes this model internally (#747).\n // Flip these two flags ONLY together with that VA-side decision.\n \"gemini-3.7-flash\": { image: true, video: false, audio: false },\n // gemini-3.8-flash is IMAGE-ONLY by DECISION, not omission — 3.7's rationale\n // exactly: full video+audio caps would auto-enroll it in\n // VIDEO_ANALYSIS_LLM_MODELS (derived below) and force a video-analysis tier +\n // pricing decision that stays deferred until the 3.8-vs-3.7 analysis A/B\n // concludes. Google's own 3.8 lane DOES understand video (agentic video, via\n // the Interactions API we don't wire) — which is precisely why withholding it\n // has to be a decision rather than a gap. Flip these two flags ONLY together\n // with that VA-side decision.\n \"gemini-3.8-flash\": { image: true, video: false, audio: false },\n \"gemini-3.1-pro\": { image: true, video: true, audio: true },\n \"claude-haiku-4.5\": { image: true, video: false, audio: false },\n \"claude-haiku-5.5\": { image: true, video: false, audio: false },\n \"claude-sonnet-4.6\": { image: true, video: false, audio: false },\n \"claude-opus-4.7\": { image: true, video: false, audio: false },\n \"gpt-5.2\": { image: true, video: false, audio: false },\n \"gpt-5.4\": { image: true, video: false, audio: false },\n \"gpt-5.5\": { image: true, video: false, audio: false },\n \"gpt-5.6-luna\": { image: true, video: false, audio: false },\n \"gpt-5.6-terra\": { image: true, video: false, audio: false },\n \"gpt-5.6-sol\": { image: true, video: false, audio: false },\n // KIE's GPT-6 doc lists text + image + file inputs only — no video, no audio.\n \"gpt-6-astra\": { image: true, video: false, audio: false },\n // Same KIE doc as astra: text + image + file inputs only.\n \"gpt-6-luna\": { image: true, video: false, audio: false },\n \"gpt-6-sol\": { image: true, video: false, audio: false },\n \"gpt-6.1-sol\": { image: true, video: false, audio: false },\n \"grok-4.6\": { image: true, video: false, audio: false },\n \"grok-4.7\": { image: true, video: false, audio: false },\n \"claude-sonnet-5\": { image: true, video: false, audio: false },\n \"claude-sonnet-5.5\": { image: true, video: false, audio: false },\n \"claude-opus-4.8\": { image: true, video: false, audio: false },\n \"claude-opus-5\": { image: true, video: false, audio: false },\n \"claude-opus-5.5\": { image: true, video: false, audio: false },\n \"claude-fable-5\": { image: true, video: false, audio: false },\n // KIE documents text + image input only for both.\n \"kimi-k3\": { image: true, video: false, audio: false },\n \"deepseek-v4.1-flash\": { image: true, video: false, audio: false },\n}\n\n/** Capability lookup with safe default — unknown models get image-only. */\nexport function getLlmModalityCaps(modelId: string | undefined): { image: boolean; video: boolean; audio: boolean } {\n if (!modelId) return { image: true, video: false, audio: false }\n return LLM_MODALITY_CAPS[modelId] ?? { image: true, video: false, audio: false }\n}\n\n/**\n * Dash-form aliases resolve to their canonical dot-form ids. Several wire\n * contracts carry dash forms (`PIPELINE_PINNABLE_SCRIPT_LLMS`, provider slugs,\n * configs persisted before the id scheme settled), while `LLM_MODELS` keys the\n * canonical `major.minor` form — an exact-only lookup makes every such caller\n * throw \"Unknown LLM model\" at run time. Normalizing here (instead of editing\n * the enums) keeps stored configs and published-package consumers valid.\n */\nfunction dashAliasToCanonical(id: string): string {\n return id.replace(/-(\\d+)-(\\d+)$/, \"-$1.$2\")\n}\n\nexport function getLlmModel(id: string): LlmModelDef | undefined {\n const exact = LLM_MODELS.find((m) => m.id === id)\n if (exact) return exact\n const canonical = dashAliasToCanonical(id)\n if (canonical !== id) {\n const aliased = LLM_MODELS.find((m) => m.id === canonical)\n if (aliased) return aliased\n }\n // Last resort: provider slugs double as historical aliases (e.g. the\n // dated Anthropic slugs, the `-preview`-suffixed Google ids) — accept any\n // model whose slug matches exactly, on either lane.\n return LLM_MODELS.find(\n (m) => m.kieSlugOrModel === id || m.directFallbackModel === id || m.directGeminiModel === id,\n )\n}\n\nexport function getLlmTier(id: string): LlmTier {\n return getLlmModel(id)?.tier ?? \"standard\"\n}\n\n/**\n * Effort levels this model actually accepts on the lane it will be served on.\n *\n * The two lanes do NOT offer the same ladder: the aggregator accepts a narrower\n * set than the vendor's own API does, which is one of the concrete things\n * Advanced mode buys. Kept as one lookup so the UI picker and the wire-side\n * clamp can never disagree about what's selectable.\n */\nexport function availableReasoningEfforts(\n modelId: string | undefined,\n advanced = false,\n): readonly LlmReasoningEffort[] {\n const model = getLlmModel(modelId ?? \"\")\n if (!model) return []\n if (advanced && supportsAdvancedMode(modelId)) {\n return model.directReasoningEfforts ?? model.reasoningEfforts ?? []\n }\n return model.reasoningEfforts ?? []\n}\n\n/** Highest level the model supports that is ≤ the requested level; undefined = treat as Auto. */\nexport function effectiveReasoningEffort(\n modelId: string | undefined,\n requested?: string,\n advanced = false,\n): LlmReasoningEffort | undefined {\n if (!requested || !(requested in EFFORT_RANK)) return undefined\n const levels = availableReasoningEfforts(modelId, advanced)\n if (!levels || levels.length === 0) return undefined\n const req = requested as LlmReasoningEffort\n let best: LlmReasoningEffort | undefined\n for (const l of levels) {\n if (EFFORT_RANK[l] <= EFFORT_RANK[req] && (best === undefined || EFFORT_RANK[l] > EFFORT_RANK[best])) best = l\n }\n return best\n}\n\n/**\n * Build a composite credit identifier for an LLM feature.\n * - economy tier → \"ai-writer:economy\"\n * - standard tier → \"ai-writer\" (no suffix — backward compatible)\n * - premium tier → \"ai-writer:premium\"\n * A reasoning effort of \"xhigh\" or \"max\" (after clamping to what the model\n * actually supports) bills one tier up (economy→standard, standard→premium;\n * premium stays premium). `high` is the Claude-family server default and\n * never bumps.\n */\n\n/**\n * The sampling defaults each LLM feature's route sends when Advanced mode is\n * OFF — and therefore the values its Advanced panel must seed the sliders with.\n *\n * SINGLE SOURCE because the two used to disagree: the routes hardcoded their\n * own literals while the toggle fell back to 0.7/2048, so the panel displayed\n * a temperature the run never used, and one arrow-key press on 3D Title's Max\n * Tokens silently cut its budget from 3072 to 2048 on a node that emits\n * structured JSON.\n *\n * `structuredOutput` marks the features whose prompt asks the model for JSON —\n * a high temperature measurably degrades schema adherence there, so the panel\n * warns. Absent `temperature` means the route sends none (vendor default).\n */\nexport interface LlmRouteDefaults {\n temperature?: number\n maxTokens?: number\n structuredOutput?: true\n}\n\nexport const LLM_ROUTE_DEFAULTS: Record<string, LlmRouteDefaults> = {\n \"llm-chat\": { temperature: 0.7, maxTokens: 8192 },\n \"ai-writer\": { temperature: 0.7, maxTokens: 8192 },\n \"prompt-helper\": { temperature: 0.7, maxTokens: 8192, structuredOutput: true },\n \"generate-script\": { maxTokens: 16384, structuredOutput: true },\n \"qa-check\": { maxTokens: 1024, structuredOutput: true },\n \"image-critic\": { maxTokens: 1024, structuredOutput: true },\n \"image-to-text\": { maxTokens: 1024 },\n \"describe-to-picker\": { structuredOutput: true },\n \"scene-graph-ai\": { temperature: 0.3, maxTokens: 4096, structuredOutput: true },\n \"after-effects\": { temperature: 0.3, maxTokens: 2048, structuredOutput: true },\n \"lottie-overlay\": { temperature: 0.3, maxTokens: 2048, structuredOutput: true },\n \"motion-graphics\": { temperature: 0.3, maxTokens: 2048, structuredOutput: true },\n \"motion-graphics-lottie\": { temperature: 0.3, maxTokens: 8192, structuredOutput: true },\n \"3d-title\": { temperature: 0.4, maxTokens: 3072, structuredOutput: true },\n // A 100-object plan with keyframe tracks is the biggest structured payload\n // any composer feature emits — 3072 (3d-title's cap) truncates it mid-array.\n \"3d-scene\": { temperature: 0.3, maxTokens: 8192, structuredOutput: true },\n}\n\n/** Route defaults for a feature; `{}` for an unknown one. */\nexport function llmRouteDefaults(feature: string | undefined): LlmRouteDefaults {\n return (feature && LLM_ROUTE_DEFAULTS[feature]) || {}\n}\n\n/** One step up the economy → standard → premium ladder. Premium is the ceiling. */\nfunction bumpTier(tier: LlmTier): LlmTier {\n if (tier === \"economy\") return \"standard\"\n if (tier === \"standard\") return \"premium\"\n return tier\n}\n\n/**\n * Can this model be run in Advanced mode?\n *\n * Advanced mode pins the call to the vendor's own API, which is the only lane\n * where sampling levers (`temperature`, `maxTokens`) and the full effort range\n * actually take effect. Capability-derived from the registry — a model without\n * a direct lane simply cannot offer it, so UI and routes both gate on this\n * rather than on a hand-maintained model list.\n */\nexport function supportsAdvancedMode(modelId: string | undefined): boolean {\n const model = modelId ? getLlmModel(modelId) : undefined\n return Boolean(model?.directGeminiModel || model?.directFallbackModel)\n}\n\n/** User-facing reason a model can't offer Advanced mode. Single-sourced so the\n * config panel's disabled hint and the route's 400 say the same thing. */\nexport const ADVANCED_MODE_UNAVAILABLE_REASON =\n \"Advanced mode is available on Gemini and Claude models — switch the model to enable it.\"\n\n/**\n * Is this call served on the vendor's own API — and therefore billed as such?\n *\n * The rule (decided 2026-10-08): a call is priced on the lane it runs on.\n * It runs direct when Advanced mode is on, or when it carries a reasoning\n * effort on a model whose effort only works there (`effortRequiresDirect` —\n * the Claude family). Everything else runs on the aggregator at its price,\n * falling back to the vendor's API only if the aggregator fails (at no extra\n * charge).\n *\n * The SINGLE decision both the credit identifier and the LLM client's routing\n * read, so what is billed and where it runs cannot disagree. Ignores a stale\n * `advancedMode` on a model with no direct lane, like the bump always has.\n */\nexport function llmServesDirect(\n modelId: string | undefined,\n reasoningEffort?: string,\n advancedMode?: boolean,\n): boolean {\n if (!supportsAdvancedMode(modelId)) return false\n if (advancedMode) return true\n return Boolean(\n getLlmModel(modelId!)?.effortRequiresDirect && effectiveReasoningEffort(modelId, reasoningEffort) !== undefined,\n )\n}\n\n/**\n * The credit rungs an LLM feature bills on, cheapest first. `premium-direct` is\n * reached only by a premium model served direct (decided 2026-10-08): the bump\n * for running direct moves one rung on THIS ladder, so a premium model has\n * somewhere to go. The effort bump keeps the three-rung ladder.\n */\nexport const LLM_CREDIT_RUNGS = [\"economy\", \"standard\", \"premium\", \"premium-direct\"] as const\nexport type LlmCreditRung = (typeof LLM_CREDIT_RUNGS)[number]\n\n/** The credit identifier for `feature` on one rung — the standard rung is the bare feature id. */\nexport function llmCreditIdForRung(feature: string, rung: LlmCreditRung): string {\n return rung === \"standard\" ? feature : `${feature}:${rung}`\n}\n\n/** Every credit identifier a tier-priced LLM feature can bill under, in rung order. */\nexport function llmTierCreditIds(feature: string): string[] {\n return LLM_CREDIT_RUNGS.map((rung) => llmCreditIdForRung(feature, rung))\n}\n\nexport function buildLlmCreditIdentifier(\n feature: string,\n modelId?: string,\n reasoningEffort?: string,\n advancedMode?: boolean,\n): string {\n if (!modelId) return feature\n let tier = getLlmTier(modelId)\n const eff = effectiveReasoningEffort(modelId, reasoningEffort)\n if (eff !== undefined && EFFORT_TIER_BUMP.has(eff)) tier = bumpTier(tier)\n // A call served on the vendor's own API (Advanced mode, or an effort on a\n // model whose effort only works there — llmServesDirect) bills materially\n // more per token than the aggregator. It bumps INDEPENDENTLY of the effort\n // bump — the two are separate cost levers and genuinely stack, so a\n // max-effort advanced economy call lands at premium — and on the four-rung\n // ladder, so a premium model served direct lands at `premium-direct`. A stale\n // flag on a model with no direct lane never inflates a bill.\n const rung: LlmCreditRung = llmServesDirect(modelId, reasoningEffort, advancedMode) ? bumpToDirectRung(tier) : tier\n return llmCreditIdForRung(feature, rung)\n}\n\n/** One rung up the four-rung ladder — the direct-lane bump. */\nfunction bumpToDirectRung(tier: LlmTier): LlmCreditRung {\n return tier === \"premium\" ? \"premium-direct\" : bumpTier(tier)\n}\n\n/**\n * Resolve llmModel (+ reasoningEffort, advancedMode) from raw body for the\n * creditGuard preHandler (before Zod parsing). Returns the credit identifier\n * for the given feature.\n */\nexport function resolveLlmCreditId(feature: string, body: unknown): string {\n const b = body as Record<string, unknown> | undefined\n return buildLlmCreditIdentifier(\n feature,\n b?.llmModel as string | undefined,\n b?.reasoningEffort as string | undefined,\n b?.advancedMode === true,\n )\n}\n\n/** Models capable of video-analysis: capability-derived, never hand-listed (route-enum-sync convention). */\nexport const VIDEO_ANALYSIS_LLM_MODELS: string[] = LLM_MODELS\n .filter((m) => getLlmModalityCaps(m.id).video && getLlmModalityCaps(m.id).audio)\n .map((m) => m.id)\n\n/**\n * Video-analysis quality TIERS — the ONLY analyzer identifiers exposed to users\n * (API, UI, docs). Each maps to an internal analysis model; the underlying\n * vendor/model name is never surfaced. Default is `pro`. The guard test\n * (video-analysis-pricing.test.ts) asserts every tier target is a real\n * VIDEO_ANALYSIS_LLM_MODELS member AND every such model is reachable by a tier,\n * so adding a video model forces a tier decision instead of silently leaking.\n */\nexport const VIDEO_ANALYSIS_TIERS = { fast: \"gemini-3-flash\", pro: \"gemini-3.1-pro\" } as const\nexport type VideoAnalysisModelTier = keyof typeof VIDEO_ANALYSIS_TIERS\n/**\n * Models that PREVIOUSLY backed a tier, mapped to the tier they backed.\n * They stay video+audio-capable (so they remain in VIDEO_ANALYSIS_LLM_MODELS):\n * stored raw `llmModel` values keep resolving via the passthrough in\n * `resolveVideoAnalysisModel` and keep pricing under their own credit family —\n * but no tier reaches them for NEW runs. UIs use this map to reverse a stored\n * raw id to the tier the user originally chose (video-configs fail-safe).\n * The tier guard test requires every video-capable model to be a tier target\n * OR a key here, so replacing a tier's backing model stays an explicit,\n * two-sided decision.\n */\nexport const VIDEO_ANALYSIS_LEGACY_MODELS: Record<string, VideoAnalysisModelTier> = {\n // Backed the fast tier from 2026-07 until 2026-07-29, when the economy tiers\n // moved to the cheaper lane and the older, cheaper flash. It is now the engine\n // behind the `smart` tier — but `smart` is a SENTINEL that never exposes a model\n // id, so as far as this map is concerned it no longer backs a selectable tier and\n // belongs here: stored raw `llmModel` values keep resolving and keep pricing\n // under their own credit family.\n \"gemini-3.6-flash\": \"fast\",\n}\n/**\n * MIXED tiers — advanced multi-engine analysis plans whose identifier resolves\n * to an engine-plan SENTINEL consumed by the analysis engine, never to a single\n * model id. Two variants, same price (one shared `video-analysis:mixed:*`\n * credit family): `mixed` targets maximum result quality; `mixed-fast` targets\n * run-to-run output consistency. What each plan does internally is deliberately\n * NOT published here (Apache irrevocability; only the wire vocabulary below is\n * contract — the engine lives in the private analysis plugin).\n */\nexport const VIDEO_ANALYSIS_MIXED_TIERS = [\"mixed\", \"mixed-fast\", \"smart\"] as const\nexport type VideoAnalysisMixedTier = (typeof VIDEO_ANALYSIS_MIXED_TIERS)[number]\n/**\n * `smart` is an ENGINE-PLAN sentinel like the mixed tiers — it names a plan, not a\n * model — but it is a different SHAPE of plan, and the distinction is the whole\n * reason it exists as a separate tier rather than a repricing of the others.\n *\n * The economy tiers (`fast`, `pro`, `mixed`, `mixed-fast`) run several passes on\n * the cheaper proxied transport and vote. That transport is cheaper per token and\n * additionally does no deep reasoning, which is why they cost less — and also why\n * they are less accurate. `smart` is a HYBRID plan (2026-08-03 re-plan): one\n * native-transport skeleton pass with everything turned up, blended with several\n * economy-transport donor rolls, and the merged result is always refined —\n * `selectionMode` (the `choose`/`combine` toggle the other tiers expose) does not\n * apply to `smart`; it always applies the equivalent of `combine`.\n *\n * As with the mixed sentinels, what the plan does internally is deliberately not\n * published here; only the wire vocabulary is contract.\n */\n/** UI/listing order — recommended (smart) first. */\nexport const VIDEO_ANALYSIS_TIER_ORDER = [\"smart\", \"pro\", \"fast\", \"mixed\", \"mixed-fast\"] as const\nexport type VideoAnalysisTier = (typeof VIDEO_ANALYSIS_TIER_ORDER)[number]\nexport const DEFAULT_VIDEO_ANALYSIS_TIER: VideoAnalysisTier = \"pro\"\nexport const DEFAULT_VIDEO_ANALYSIS_MODEL: string = VIDEO_ANALYSIS_TIERS[DEFAULT_VIDEO_ANALYSIS_TIER]\n/** Neutral, vendor-free display labels for the UI. */\nexport const VIDEO_ANALYSIS_TIER_LABELS: Record<VideoAnalysisTier, string> = {\n smart: \"Smart\",\n fast: \"Fast\",\n pro: \"Pro\",\n mixed: \"Mixed\",\n \"mixed-fast\": \"Mixed (consistent)\",\n}\n\nexport function isVideoAnalysisTier(v: string): v is VideoAnalysisTier {\n return (VIDEO_ANALYSIS_TIER_ORDER as readonly string[]).includes(v)\n}\n\nexport function isVideoAnalysisMixedTier(v: string): v is VideoAnalysisMixedTier {\n return (VIDEO_ANALYSIS_MIXED_TIERS as readonly string[]).includes(v)\n}\n\n/**\n * Resolve a user-supplied tier OR a raw internal model id to the analysis\n * ENGINE IDENTIFIER carried in the worker payload:\n * - model-backed tiers (\"fast\"/\"pro\") → the internal model id;\n * - mixed tiers (\"mixed\"/\"mixed-fast\") → the sentinel ITSELF (the engine\n * expands it to a multi-model roll plan);\n * - raw model ids pass through (back-compat for stored `llmModel` values);\n * - empty/unknown → the default tier's model (never an error).\n */\nexport function resolveVideoAnalysisModel(input?: string | null): string {\n if (input && isVideoAnalysisMixedTier(input)) return input\n if (input && Object.prototype.hasOwnProperty.call(VIDEO_ANALYSIS_TIERS, input)) {\n return VIDEO_ANALYSIS_TIERS[input as VideoAnalysisModelTier]\n }\n if (input && VIDEO_ANALYSIS_LLM_MODELS.includes(input)) return input\n return DEFAULT_VIDEO_ANALYSIS_MODEL\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/i18n/types.ts","../src/i18n/index.ts"],"names":[],"mappings":";AA6DO,IAAM,SAAA,GAA+C;AAAA,EAC1D,EAAE,EAAA,EAAI,IAAA,EAAS,WAAA,EAAa,SAAA,EAAwB,YAAY,SAAA,EAAmB,SAAA,EAAW,IAAA,EAAO,GAAA,EAAK,KAAA,EAAM;AAAA,EAChH,EAAE,EAAA,EAAI,IAAA,EAAS,WAAA,EAAa,SAAA,EAAwB,YAAY,YAAA,EAAmB,SAAA,EAAW,IAAA,EAAO,GAAA,EAAK,KAAA,EAAM;AAAA,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AAA,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-YYV35XOS.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 */\nexport const LANGUAGES: ReadonlyArray<LanguageDefinition> = [\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\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/i18n/types.ts","../src/i18n/index.ts"],"names":[],"mappings":";;;AA6DO,IAAM,SAAA,GAA+C;AAAA,EAC1D,EAAE,EAAA,EAAI,IAAA,EAAS,WAAA,EAAa,SAAA,EAAwB,YAAY,SAAA,EAAmB,SAAA,EAAW,IAAA,EAAO,GAAA,EAAK,KAAA,EAAM;AAAA,EAChH,EAAE,EAAA,EAAI,IAAA,EAAS,WAAA,EAAa,SAAA,EAAwB,YAAY,YAAA,EAAmB,SAAA,EAAW,IAAA,EAAO,GAAA,EAAK,KAAA,EAAM;AAAA,EAChH,EAAE,EAAA,EAAI,IAAA,EAAS,WAAA,EAAa,QAAA,EAAwB,YAAY,aAAA,EAAmB,SAAA,EAAW,IAAA,EAAO,GAAA,EAAK,KAAA,EAAM;AAAA,EAChH,EAAE,EAAA,EAAI,IAAA,EAAS,WAAA,EAAa,QAAA,EAAwB,YAAY,SAAA,EAAmB,SAAA,EAAW,IAAA,EAAO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AAC/C,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"chunk-Z2OL5AJD.cjs","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 */\nexport const LANGUAGES: ReadonlyArray<LanguageDefinition> = [\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\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/audio-crossfade-curves.ts","../src/smart-cut-windows.ts","../src/speaker-tracks.ts","../src/camera-switch-contract.ts","../src/edit-plan-contract.ts"],"names":["num"],"mappings":";;;AAkBO,IAAM,sBAAA,GAAyD;AAAA,EACpE;AAAA,IACE,EAAA,EAAI,QAAA;AAAA,IACJ,MAAA,EAAQ,KAAA;AAAA,IACR,KAAA,EAAO,QAAA;AAAA,IACP,WAAA,EAAa;AAAA,GACf;AAAA,EACA;AAAA,IACE,EAAA,EAAI,aAAA;AAAA,IACJ,MAAA,EAAQ,MAAA;AAAA,IACR,KAAA,EAAO,aAAA;AAAA,IACP,WAAA,EAAa;AAAA,GACf;AAAA,EACA;AAAA,IACE,EAAA,EAAI,QAAA;AAAA,IACJ,MAAA,EAAQ,MAAA;AAAA,IACR,KAAA,EAAO,eAAA;AAAA,IACP,WAAA,EAAa;AAAA,GACf;AAAA,EACA;AAAA,IACE,EAAA,EAAI,aAAA;AAAA,IACJ,MAAA,EAAQ,KAAA;AAAA,IACR,KAAA,EAAO,aAAA;AAAA,IACP,WAAA,EAAa;AAAA,GACf;AAAA,EACA;AAAA,IACE,EAAA,EAAI,aAAA;AAAA,IACJ,MAAA,EAAQ,KAAA;AAAA,IACR,KAAA,EAAO,aAAA;AAAA,IACP,WAAA,EAAa;AAAA;AAEjB;AAEO,IAAM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AAS,qBAAqB,UAAA,EAA8B;AACjE,EAAA,IAAI,CAAC,UAAA,IAAc,OAAO,UAAA,KAAe,UAAU,OAAO,UAAA;AAC1D,EAAA,MAAM,CAAA,GAAI,UAAA;AAEV,EAAA,IAAI,MAAM,OAAA,CAAQ,CAAA,CAAE,KAAK,CAAA,SAAU,CAAA,CAAE,KAAA;AAErC,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,CAAA,CAAE,QAAQ,CAAA,EAAG,OAAO,EAAE,OAAA,EAAS,WAAA,EAAa,QAAA,EAAU,CAAA,CAAE,QAAA,EAAS;AAEnF,EAAA,MAAM,EAAE,cAAA,EAAgB,eAAA,EAAiB,GAAG,MAAK,GAAI,CAAA;AACrD,EAAA,OAAO,IAAA;AACT","file":"chunk-ZDFHA2EC.js","sourcesContent":["/**\n * Curated subset of FFmpeg `acrossfade=curve=...` options for combine-videos\n * audio crossfades. We expose 5 well-understood presets out of the ~21 raw\n * curves FFmpeg supports; the rest are either visually indistinguishable to\n * non-audio-engineers or rarely useful in this context.\n *\n * Default `linear` matches today's behavior — adding this catalog is a pure\n * additive change for existing workflows.\n */\n\nexport interface AudioCrossfadeCurve {\n readonly id: string\n /** FFmpeg `acrossfade=curve=...` name. */\n readonly ffmpeg: string\n readonly label: string\n readonly description: string\n}\n\nexport const AUDIO_CROSSFADE_CURVES: readonly AudioCrossfadeCurve[] = [\n {\n id: \"linear\",\n ffmpeg: \"tri\",\n label: \"Linear\",\n description: \"Straight-line fade. Default; predictable but can dip in the middle for music.\",\n },\n {\n id: \"equal-power\",\n ffmpeg: \"qsin\",\n label: \"Equal Power\",\n description: \"Quarter-sine. Keeps perceived loudness roughly constant across the crossfade — best for music.\",\n },\n {\n id: \"smooth\",\n ffmpeg: \"hsin\",\n label: \"Smooth (Sine)\",\n description: \"Half-sine. Gentler than equal-power; good for dialogue and ambient.\",\n },\n {\n id: \"logarithmic\",\n ffmpeg: \"log\",\n label: \"Logarithmic\",\n description: \"Compensates for the ear's logarithmic loudness response. Long, slow tails.\",\n },\n {\n id: \"exponential\",\n ffmpeg: \"exp\",\n label: \"Exponential\",\n description: \"Sharp out / slow in (or vice versa). Punchy — good for impact moments.\",\n },\n]\n\nexport const AUDIO_CROSSFADE_CURVE_IDS: readonly string[] =\n AUDIO_CROSSFADE_CURVES.map((c) => c.id)\n\nexport const DEFAULT_AUDIO_CROSSFADE_CURVE_ID = \"linear\"\n\nconst CURVES_BY_ID: ReadonlyMap<string, AudioCrossfadeCurve> = new Map(\n AUDIO_CROSSFADE_CURVES.map((c) => [c.id, c]),\n)\n\nexport function getAudioCrossfadeCurve(id: string): AudioCrossfadeCurve | undefined {\n return CURVES_BY_ID.get(id)\n}\n\n/**\n * Resolve a curve id to its FFmpeg `acrossfade=curve=` name. Unknown ids fall\n * back to `tri` (linear) — this matches the route's Zod default so callers\n * downstream of validation never see undefined.\n */\nexport function resolveAudioCrossfadeCurve(id: string | undefined): string {\n if (!id) return \"tri\"\n return CURVES_BY_ID.get(id)?.ffmpeg ?? \"tri\"\n}\n","/**\n * Smart-cut SEARCH WINDOWS — the shared bound + clamp for the\n * `smartCutFramesPrev` / `smartCutFramesNext` of BOTH smart-cut nodes:\n * generate-video-pro (segment boundaries) and combine-videos (clip joins).\n *\n * They bound how much of each side of a boundary the engine considers when\n * it places the cut: N frames from the end of a segment and M from the start\n * of the next. Absent → the engine's own default, byte-identical to the\n * behavior before they were exposed. A boundary the engine cannot resolve\n * inside the window falls back to the fixed freeze-trims; recast pins 24/24.\n *\n * Why a shared clamp: the config panel, the canvas node (single-node Run) and\n * the orchestrator (workflow Run) are three independent writers/send paths into\n * the same route, whose Zod schema REJECTS out-of-range values (its `.min()` /\n * `.max()` are these very constants). Deriving all of them from this one\n * function means a stale, imported or hand-edited node value degrades to a\n * legal request instead of 400-ing an entire run — and the paths cannot drift\n * apart. An `<input type=\"number\" max={…}>` is not a substitute: the browser\n * does not stop a typed or pasted value from reaching React's onChange.\n */\n\n/** Widest window we accept anywhere — the UI's `max`, the clamp's ceiling and\n * `/v1/combine-videos`' own Zod `.max()` (the generate-video-pro engine route\n * itself accepts up to 48). Past this, added frames only cost search time and\n * invite a false match. */\nexport const SMART_CUT_WINDOW_MAX = 24\n/** Narrowest meaningful window — one frame each side. */\nexport const SMART_CUT_WINDOW_MIN = 1\n/** The engine's default when the field is absent. Documented here so the UI\n * can show it as the placeholder without hardcoding a second copy. */\nexport const SMART_CUT_WINDOW_DEFAULT = 8\n\n/**\n * Narrow an arbitrary node value to a legal window, or `undefined` to mean\n * \"let the engine use its default\". Non-numbers, NaN, and non-integers all\n * collapse to `undefined` rather than to a guessed number: a malformed value\n * should fall back to the proven default, not silently pick a different\n * search width than the user asked for.\n */\nexport function clampSmartCutWindow(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined\n const n = Math.round(value)\n if (n < SMART_CUT_WINDOW_MIN) return SMART_CUT_WINDOW_MIN\n if (n > SMART_CUT_WINDOW_MAX) return SMART_CUT_WINDOW_MAX\n return n\n}\n","import type { Edl, EdlSource, EdlValidation } from \"./edl.js\"\n\n/**\n * Speaker tracks — where each speaker's face is, over time, per camera.\n *\n * WHY THIS EXISTS\n * A face-tracking analysis node samples each camera an edit shows, finds the\n * faces, links them into tracks and labels each track with a speaker. Its\n * result feeds the framing rung `resolveEdlSegmentSlots` reserves for a\n * per-segment resolver (D20, edl-multicam.ts). This module is the wire shape\n * of that result plus the pure functions that read it: structural vocabulary\n * only — no detector, no linking or attribution rule, no framing or follow\n * math, no thresholds. That is why it lives in the Apache-licensed\n * `@nodaro/shared` (the public contract: the API response, the SDK type and\n * the MCP output). Every published version is an irrevocable grant, so every\n * later field is optional and additive.\n *\n * TWO SHAPES, ONE PROJECTION\n * - `SpeakerTrackSet` — the full set, boxes included. At a long multi-camera\n * edit it is megabytes of JSON, so it is stored as a JSON artifact (the\n * versioned box body), never inline in a job row or a node's data.\n * - `SpeakerTrackSetDescriptor` — what the node outputs: the same set with\n * every box removed (a `boxCount` per track instead) plus the artifact's\n * `url`, `sha256` and `bytes`. Consumers fetch the body by URL, check the\n * hash, run `normalizeSpeakerTracks` + `validateSpeakerTracks` on it, and\n * can confirm it is the body the descriptor names with\n * `describeSpeakerTracks(body, artifact)` deep-equal to the descriptor.\n *\n * CLOCK (D19)\n * Boxes are per SOURCE and on that source's own clock (`clock: \"source\"`), in\n * integer ms. A consumer maps to the master clock through the EDL source's\n * offset: `masterMs = ms + offsetMs` (`remapMsThroughEdl(edl, ms, sourceId)`).\n * Nothing here applies the offset, and nothing ever rescales a time (no\n * seconds→ms guessing — an implausible value is a validation error).\n *\n * GEOMETRY\n * Box coordinates are fractions 0..1 of `frame`: the display-oriented frame\n * (after rotation, square pixels) the producer sampled.\n *\n * SAMPLING\n * `sampledSpans` say what was looked at. No box for a track outside them means\n * \"not sampled\"; inside them it means \"no face there\". Spans are half-open\n * `[startMs, endMs)`, like EDL segments.\n */\n\nexport const SPEAKER_TRACKS_VERSION = 1 as const\n\n/** How a track got its speaker. Open: a newer producer may add a method, which\n * an older validator reports as a WARNING, never an issue. */\nexport const SPEAKER_TRACK_ATTRIBUTION_METHODS = [\"source-map\", \"region\", \"mouth-motion\", \"manual\"] as const\nexport type SpeakerTrackAttributionMethod = (typeof SPEAKER_TRACK_ATTRIBUTION_METHODS)[number]\nconst KNOWN_METHODS: ReadonlySet<string> = new Set(SPEAKER_TRACK_ATTRIBUTION_METHODS)\n\n/** Default hard cap on boxes per source. The longest edit the platform plans\n * for (180 minutes) sampled at 2 per second is 21,600 samples per source; the\n * cap leaves room for several faces in every sample. Override per call with\n * `maxBoxesPerSource`. */\nexport const SPEAKER_TRACKS_MAX_BOXES_PER_SOURCE = 100_000\n/** Default hard cap on the serialized size of a track set (UTF-8 bytes of its\n * JSON), so no consumer ever loads an unbounded body. Override per call with\n * `maxBytes`. */\nexport const SPEAKER_TRACKS_MAX_BYTES = 64 * 1024 * 1024\n\n/** One detection. `ms` on the source clock; x/y/w/h fractions 0..1 of the frame. */\nexport interface SpeakerTrackBox {\n readonly ms: number\n readonly x: number\n readonly y: number\n readonly w: number\n readonly h: number\n /** Detector confidence 0..1, when the detector reports one. */\n readonly score?: number\n}\n\nexport interface SpeakerTrackAttribution {\n /** Known: `SPEAKER_TRACK_ATTRIBUTION_METHODS`. */\n readonly method: SpeakerTrackAttributionMethod | (string & {})\n /** 0..1. */\n readonly confidence: number\n /** The transcript's own label for this speaker, kept beside the display name\n * in `speaker` so a later rename re-maps instead of orphaning the track. */\n readonly rawSpeaker?: string\n}\n\n/** What a track says about itself, without its boxes. */\nexport interface SpeakerTrackHeader {\n /** Unique in the whole set, e.g. \"wide/t3\". */\n readonly id: string\n /** A label in the edit's speaker space. Absent = unattributed. */\n readonly speaker?: string\n readonly attribution?: SpeakerTrackAttribution\n}\n\nexport interface SpeakerTrack extends SpeakerTrackHeader {\n /** Strictly increasing `ms`, each inside one of the source's `sampledSpans`. */\n readonly boxes: readonly SpeakerTrackBox[]\n}\n\nexport interface SpeakerTrackSummary extends SpeakerTrackHeader {\n readonly boxCount: number\n}\n\nexport interface SpeakerTrackSpan {\n readonly startMs: number\n /** Exclusive, > startMs. */\n readonly endMs: number\n}\n\ninterface SpeakerTrackSourceFields {\n /** `EdlSource.id` of a video source. */\n readonly sourceId: string\n /** Boxes, spans and cuts are ms on this SOURCE's own clock (D19). */\n readonly clock: \"source\"\n /** The display-oriented frame (after rotation, square pixels), in pixels, that box fractions refer to. */\n readonly frame: { readonly w: number; readonly h: number }\n /** What was sampled: sorted, non-overlapping, half-open. */\n readonly sampledSpans: readonly SpeakerTrackSpan[]\n /** Source-clock ms of detected scene changes, ascending. No track spans one. */\n readonly cuts?: readonly number[]\n}\n\nexport interface SpeakerTrackSource extends SpeakerTrackSourceFields {\n readonly tracks: readonly SpeakerTrack[]\n}\n\nexport interface SpeakerTrackSourceSummary extends SpeakerTrackSourceFields {\n readonly tracks: readonly SpeakerTrackSummary[]\n}\n\ninterface SpeakerTrackSetFields {\n readonly version: 1\n /** Samples per second the producer looked at. */\n readonly sampleFps: number\n /** Informational: which detector produced the boxes, e.g. \"example:face-detector\". */\n readonly detector: { readonly id: string; readonly version?: string }\n}\n\n/** The full set — the versioned box body, stored as a JSON artifact. */\nexport interface SpeakerTrackSet extends SpeakerTrackSetFields {\n readonly sources: readonly SpeakerTrackSource[]\n}\n\n/** What the analysis node outputs: the set without its boxes, plus where the body is. */\nexport interface SpeakerTrackSetDescriptor extends SpeakerTrackSetFields {\n readonly sources: readonly SpeakerTrackSourceSummary[]\n /** Where the `SpeakerTrackSet` body is stored. */\n readonly url: string\n /** SHA-256 of the stored body's bytes, 64 lowercase hex characters. */\n readonly sha256: string\n /** Size of the stored body in bytes. */\n readonly bytes: number\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Normalization (coerce, never reject — and never reinterpret)\n// ─────────────────────────────────────────────────────────────────────────\n\nconst isObj = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v)\nconst isNum = (v: unknown): v is number => typeof v === \"number\" && Number.isFinite(v)\nconst num = (v: unknown, fallback = 0): number => (isNum(v) ? v : fallback)\nconst str = (v: unknown): string | undefined => (typeof v === \"string\" ? v : undefined)\nconst clamp01 = (v: number): number => Math.min(1, Math.max(0, v))\n/** A readonly array field of a value that may have skipped normalization. */\nconst arr = <T,>(v: readonly T[] | undefined): readonly T[] => (Array.isArray(v) ? v : [])\n/** Integer ms; never -0 (JSON cannot carry it, so a round trip would differ). */\nconst int = (v: number): number => {\n const r = Math.round(v)\n return r === 0 ? 0 : r\n}\n\n/** One axis of a detection, cropped to the frame: the visible part of\n * `[p, p+s]` within `[0, 1]`, or undefined when none of it is visible. An\n * in-frame axis is returned untouched (so a second pass cannot drift by a\n * float ulp); an overhanging one becomes the intersection, whichever edge it\n * crosses, so its centre only ever moves toward the visible part. */\nfunction cropAxis(p: number, s: number): readonly [number, number] | undefined {\n if (!(s > 0)) return undefined\n if (p >= 0 && p + s <= 1) return [p, s]\n const lo = clamp01(p)\n const hi = clamp01(p + s)\n return hi > lo ? [lo, hi - lo] : undefined\n}\n\nfunction normalizeBox(raw: unknown): SpeakerTrackBox | undefined {\n if (!isObj(raw)) return undefined\n if (![raw.ms, raw.x, raw.y, raw.w, raw.h].every(isNum)) return undefined\n // A detection is cropped to the frame, never moved: a face at the frame edge\n // keeps only its visible part, and one entirely off-frame is dropped. This is\n // deliberately NOT `normalizeRegion`'s clamp-then-shrink (edl.ts), which is\n // fine for a region a user draws but would shift a left/top overhang and turn\n // an off-frame detection into an in-frame face.\n const xs = cropAxis(raw.x as number, raw.w as number)\n const ys = cropAxis(raw.y as number, raw.h as number)\n if (!xs || !ys) return undefined\n const [x, w] = xs\n const [y, h] = ys\n return { ms: int(raw.ms as number), x, y, w, h, ...(isNum(raw.score) ? { score: clamp01(raw.score) } : {}) }\n}\n\nfunction normalizeSpans(raw: unknown): SpeakerTrackSpan[] {\n if (!Array.isArray(raw)) return []\n const spans = raw\n .filter(isObj)\n .filter((s) => isNum(s.startMs) && isNum(s.endMs))\n .map((s) => ({ startMs: int(s.startMs as number), endMs: int(s.endMs as number) }))\n .filter((s) => s.endMs > s.startMs)\n .sort((a, b) => a.startMs - b.startMs || a.endMs - b.endMs)\n const merged: SpeakerTrackSpan[] = []\n for (const s of spans) {\n const last = merged[merged.length - 1]\n if (last && s.startMs <= last.endMs) merged[merged.length - 1] = { startMs: last.startMs, endMs: Math.max(last.endMs, s.endMs) }\n else merged.push(s)\n }\n return merged\n}\n\nfunction normalizeCuts(raw: unknown): number[] {\n if (!Array.isArray(raw)) return []\n const sorted = raw.filter(isNum).map(int).sort((a, b) => a - b)\n return sorted.filter((c, i) => i === 0 || c !== sorted[i - 1])\n}\n\nfunction normalizeAttribution(raw: unknown): SpeakerTrackAttribution | undefined {\n if (!isObj(raw)) return undefined\n const method = str(raw.method)\n if (!method) return undefined\n const rawSpeaker = str(raw.rawSpeaker)\n return { method, confidence: clamp01(num(raw.confidence)), ...(rawSpeaker ? { rawSpeaker } : {}) }\n}\n\nfunction normalizeHeader(raw: Record<string, unknown>, fallbackId: string): SpeakerTrackHeader {\n const speaker = str(raw.speaker)\n const attribution = normalizeAttribution(raw.attribution)\n return {\n id: str(raw.id) || fallbackId,\n ...(speaker ? { speaker } : {}),\n ...(attribution ? { attribution } : {}),\n }\n}\n\nfunction normalizeSetFields(o: Record<string, unknown>): SpeakerTrackSetFields {\n const detector = isObj(o.detector) ? o.detector : {}\n const detectorVersion = str(detector.version)\n return {\n // Only an ABSENT version defaults to 1. Any present value — another\n // number, \"2\", null — is kept as is so validate refuses it rather than\n // reading a newer (or broken) body as this one.\n version: (o.version === undefined ? SPEAKER_TRACKS_VERSION : o.version) as 1,\n sampleFps: num(o.sampleFps),\n detector: { id: str(detector.id) ?? \"\", ...(detectorVersion ? { version: detectorVersion } : {}) },\n }\n}\n\nfunction normalizeSources<T>(\n raw: unknown,\n track: (t: Record<string, unknown>, fallbackId: string) => T,\n): Array<SpeakerTrackSourceFields & { readonly tracks: readonly T[] }> {\n if (!Array.isArray(raw)) return []\n return raw.map((r) => {\n const s = isObj(r) ? r : {}\n const sourceId = str(s.sourceId) ?? \"\"\n const frame = isObj(s.frame) ? s.frame : {}\n const cuts = normalizeCuts(s.cuts)\n const tracks = Array.isArray(s.tracks) ? s.tracks.map((t, k) => track(isObj(t) ? t : {}, `${sourceId}/t${k + 1}`)) : []\n return {\n sourceId,\n // A clock other than \"source\" cannot be repaired: boxes on another clock\n // would land offsetMs away from their frame. Keep it for validate to refuse.\n clock: (typeof s.clock === \"string\" ? s.clock : \"source\") as \"source\",\n frame: { w: int(num(frame.w)), h: int(num(frame.h)) },\n sampledSpans: normalizeSpans(s.sampledSpans),\n tracks,\n ...(cuts.length > 0 ? { cuts } : {}),\n }\n })\n}\n\n/**\n * Coerce an unknown value into a well-formed `SpeakerTrackSet` (the box body):\n * drop unknown keys and malformed boxes, crop every box to the frame (an\n * entirely off-frame box is dropped, an overhang keeps its visible part), clamp\n * scores and confidences to 0..1, round every time to integer ms, sort each\n * track's boxes by time (box order IS time, unlike EDL segment order), sort and\n * merge sampled spans, sort and de-duplicate cuts.\n *\n * It never repairs what would change meaning: a box outside every sampled\n * span, two boxes at one instant, a track across a cut, another version or\n * another clock all survive for `validateSpeakerTracks` to report.\n */\nexport function normalizeSpeakerTracks(input: unknown): SpeakerTrackSet {\n const o = isObj(input) ? input : {}\n return {\n ...normalizeSetFields(o),\n sources: normalizeSources(o.sources, (t, fallbackId) => {\n const boxes = Array.isArray(t.boxes) ? t.boxes.map(normalizeBox).filter((b): b is SpeakerTrackBox => b !== undefined) : []\n return { ...normalizeHeader(t, fallbackId), boxes: [...boxes].sort((a, b) => a.ms - b.ms) }\n }),\n }\n}\n\n/** Coerce an unknown value into a `SpeakerTrackSetDescriptor`, by the same rules\n * as `normalizeSpeakerTracks`; a missing or broken `boxCount` becomes 0. */\nexport function normalizeSpeakerTrackSetDescriptor(input: unknown): SpeakerTrackSetDescriptor {\n const o = isObj(input) ? input : {}\n return {\n ...normalizeSetFields(o),\n sources: normalizeSources(o.sources, (t, fallbackId) => ({\n ...normalizeHeader(t, fallbackId),\n boxCount: Math.max(0, int(num(t.boxCount))),\n })),\n url: str(o.url) ?? \"\",\n sha256: str(o.sha256) ?? \"\",\n bytes: int(num(o.bytes)),\n }\n}\n\n/** The descriptor of a (normalized) set stored at `artifact.url`: every box\n * removed, a `boxCount` per track. Pure; the caller hashes and stores the body. */\nexport function describeSpeakerTracks(\n set: SpeakerTrackSet,\n artifact: { readonly url: string; readonly sha256: string; readonly bytes: number },\n): SpeakerTrackSetDescriptor {\n return {\n version: set.version,\n sampleFps: set.sampleFps,\n detector: { ...set.detector },\n sources: set.sources.map((s) => ({\n sourceId: s.sourceId,\n clock: s.clock,\n frame: { ...s.frame },\n sampledSpans: s.sampledSpans.map((sp) => ({ ...sp })),\n tracks: s.tracks.map((t) => ({\n id: t.id,\n ...(t.speaker !== undefined ? { speaker: t.speaker } : {}),\n ...(t.attribution ? { attribution: { ...t.attribution } } : {}),\n boxCount: t.boxes.length,\n })),\n ...(s.cuts && s.cuts.length > 0 ? { cuts: [...s.cuts] } : {}),\n })),\n url: artifact.url,\n sha256: artifact.sha256,\n bytes: artifact.bytes,\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// The edit's speaker space\n// ─────────────────────────────────────────────────────────────────────────\n\n/** The speaker labels an edit uses: the union of `sources[].speakers`,\n * `segments[].speaker` and `segments[].layout.slots[].speaker`, over every EDL\n * given (a clip pack), sorted by code unit. Tracks must be labelled in this\n * space, or no track ever matches a segment's speaker. */\nexport function edlSpeakerSpace(edl: Edl | readonly Edl[]): string[] {\n const out = new Set<string>()\n const add = (v: unknown) => {\n if (typeof v === \"string\" && v) out.add(v)\n }\n for (const e of edlList(edl)) {\n for (const s of Array.isArray(e.sources) ? e.sources : []) {\n for (const sp of Array.isArray(s?.speakers) ? s.speakers : []) add(sp)\n }\n for (const seg of Array.isArray(e.segments) ? e.segments : []) {\n add(seg?.speaker)\n for (const slot of Array.isArray(seg?.layout?.slots) ? seg.layout!.slots! : []) add(slot?.speaker)\n }\n }\n return [...out].sort()\n}\n\nfunction edlList(edl: Edl | readonly Edl[] | undefined): readonly Edl[] {\n if (!edl) return []\n const all: readonly unknown[] = Array.isArray(edl) ? edl : [edl]\n return all.filter((e): e is Edl => isObj(e))\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Validation\n// ─────────────────────────────────────────────────────────────────────────\n\nexport interface SpeakerTracksValidateOptions {\n /** The edit the tracks are for — one EDL, or every clip of a pack. When given,\n * every source must resolve to one of its video sources, and attributed\n * speakers must be in its speaker space (`edlSpeakerSpace`). */\n readonly edl?: Edl | readonly Edl[]\n /** Default `SPEAKER_TRACKS_MAX_BOXES_PER_SOURCE`. */\n readonly maxBoxesPerSource?: number\n /** Default `SPEAKER_TRACKS_MAX_BYTES`. */\n readonly maxBytes?: number\n /** `validateSpeakerTracks` only: the body's known size in bytes (e.g. the\n * fetched length), so a large body is not serialized again to measure it. */\n readonly serializedBytes?: number\n}\n\nconst SHA256_HEX = /^[0-9a-f]{64}$/\n\ntype Findings = { issues: string[]; warnings: string[] }\n\n/** The rules shared by the body and the descriptor. `perTrack` adds the body's\n * box rules and returns the track's box count. */\nfunction validateCommon<T extends SpeakerTrackHeader>(\n set: SpeakerTrackSetFields & { readonly sources: ReadonlyArray<SpeakerTrackSourceFields & { readonly tracks: readonly T[] }> },\n opts: SpeakerTracksValidateOptions,\n perTrack: (track: T, source: SpeakerTrackSourceFields, f: Findings) => number,\n): Findings {\n const f: Findings = { issues: [], warnings: [] }\n const { issues, warnings } = f\n const sources = arr(set.sources)\n const maxBoxes = opts.maxBoxesPerSource ?? SPEAKER_TRACKS_MAX_BOXES_PER_SOURCE\n\n if (set.version !== SPEAKER_TRACKS_VERSION) issues.push(`version must be ${SPEAKER_TRACKS_VERSION}`)\n if (!(isNum(set.sampleFps) && set.sampleFps > 0)) issues.push(\"sampleFps must be a finite number > 0\")\n\n const edls = edlList(opts.edl)\n const edlSources = new Map<string, EdlSource>()\n for (const e of edls) {\n for (const s of Array.isArray(e.sources) ? e.sources : []) {\n if (s && typeof s.id === \"string\" && !edlSources.has(s.id)) edlSources.set(s.id, s)\n }\n }\n\n const sourceIds = new Set<string>()\n const trackIds = new Set<string>()\n sources.forEach((s, i) => {\n const sid = s.sourceId\n const at = `source \"${sid}\"`\n if (!sid) issues.push(`source[${i}]: sourceId is empty`)\n else if (sourceIds.has(sid)) issues.push(`duplicate source id \"${sid}\"`)\n sourceIds.add(sid)\n if (sid && edls.length > 0) {\n const es = edlSources.get(sid)\n if (!es) issues.push(`${at}: not a source of the EDL`)\n else if (es.kind !== \"video\") issues.push(`${at}: the EDL source is kind:\"${es.kind}\", tracks need a video source`)\n }\n if (s.clock !== \"source\") issues.push(`${at}: clock must be \"source\"`)\n if (!(isObj(s.frame) && isNum(s.frame.w) && isNum(s.frame.h) && s.frame.w > 0 && s.frame.h > 0)) {\n issues.push(`${at}: frame w/h must be positive`)\n }\n\n const spans = arr<SpeakerTrackSpan>(s.sampledSpans)\n spans.forEach((sp, j) => {\n const startMs: unknown = sp?.startMs\n const endMs: unknown = sp?.endMs\n if (!(isNum(startMs) && isNum(endMs) && endMs > startMs)) {\n issues.push(`${at}: sampledSpans[${j}] [${startMs},${endMs}) is not positive`)\n return\n }\n if (!(Number.isInteger(startMs) && Number.isInteger(endMs))) issues.push(`${at}: sampledSpans[${j}] [${startMs},${endMs}) is not integer ms`)\n if (startMs < 0) issues.push(`${at}: sampledSpans[${j}] starts before 0`)\n const prevEnd: unknown = spans[j - 1]?.endMs\n if (j > 0 && isNum(prevEnd) && startMs < prevEnd) {\n issues.push(`${at}: sampledSpans must be sorted and non-overlapping (span ${j})`)\n }\n })\n\n const cuts = s.cuts\n if (cuts !== undefined) {\n const okCuts = Array.isArray(cuts) && cuts.every((c, k) => Number.isInteger(c) && c >= 0 && (k === 0 || c > cuts[k - 1]))\n if (!okCuts) issues.push(`${at}: cuts must be ascending non-negative ms`)\n }\n\n let boxes = 0\n const tracks = arr<T>(s.tracks)\n tracks.forEach((t, k) => {\n if (!t?.id) issues.push(`${at} track[${k}]: id is empty`)\n else if (trackIds.has(t.id)) issues.push(`duplicate track id \"${t.id}\"`)\n if (t?.id) trackIds.add(t.id)\n const a = t?.attribution\n if (a) {\n if (!(isNum(a.confidence) && a.confidence >= 0 && a.confidence <= 1)) {\n issues.push(`track \"${t.id}\": attribution.confidence=${a.confidence} out of 0..1`)\n }\n if (!KNOWN_METHODS.has(a.method)) {\n warnings.push(`track \"${t.id}\": unknown attribution method \"${a.method}\" (known: ${SPEAKER_TRACK_ATTRIBUTION_METHODS.join(\", \")})`)\n }\n }\n boxes += perTrack(t, s, f)\n })\n if (boxes > maxBoxes) issues.push(`${at}: ${boxes} boxes is over the cap of ${maxBoxes}`)\n })\n\n // The speaker name space: labels from the raw transcript against an edit\n // that uses display names (or the reverse) match nothing, and every slot\n // would silently fall back to static framing.\n if (edls.length > 0) {\n const space = edlSpeakerSpace(edls)\n const attributed = sources.flatMap((s) => (Array.isArray(s.tracks) ? s.tracks : [])).filter((t) => !!t?.speaker)\n if (space.length > 0 && attributed.length > 0) {\n const inSpace = new Set(space)\n const matches = (t: T) => inSpace.has(t.speaker!) || (!!t.attribution?.rawSpeaker && inSpace.has(t.attribution.rawSpeaker))\n if (!attributed.some(matches)) {\n const labels = [...new Set(attributed.map((t) => t.speaker!))].sort()\n issues.push(\n `no tracked speaker is in the edit's speaker set: the tracks are labelled ${labels.map((l) => `\"${l}\"`).join(\", \")}` +\n ` and the edit uses ${space.map((l) => `\"${l}\"`).join(\", \")} — wire Speaker Frames to the same transcript as Camera Switch`,\n )\n } else {\n for (const t of attributed) {\n if (!matches(t)) warnings.push(`track \"${t.id}\": speaker \"${t.speaker}\" is not in the edit's speaker set`)\n }\n }\n }\n }\n return f\n}\n\n/** Per-box findings listed per track and rule before the rest are summarized\n * in one line, and the most issues a validation lists before one truncation\n * line. A systematic producer bug (a clock off by `offsetMs`, say) puts EVERY\n * box out of span; the refusal must stay readable wherever it is shown. */\nconst BOX_FINDINGS_PER_RULE = 5\nconst MAX_LISTED_FINDINGS = 100\n\n/** A per-box finding: the rule (what the per-track summary line counts, as\n * \"N more boxes <rule>\") and the message for one box. */\ntype BoxFinding = readonly [rule: string, message: string]\n\nfunction boxIssues(b: SpeakerTrackBox, at: string): BoxFinding[] {\n const out: BoxFinding[] = []\n for (const k of [\"x\", \"y\", \"w\", \"h\"] as const) {\n const v = b?.[k]\n if (!isNum(v) || v < 0 || v > 1) out.push([`with ${k} out of 0..1`, `${at}: ${k}=${v} out of 0..1`])\n }\n if (out.length > 0) return out\n // The same edge tolerance as validateEdl's regions, so the two never disagree.\n if (b.w <= 0 || b.h <= 0) out.push([\"with a non-positive w/h\", `${at}: non-positive w/h`])\n if (b.x + b.w > 1 + 1e-9) out.push([\"extending past the right edge\", `${at}: extends past the right edge (x+w>1)`])\n if (b.y + b.h > 1 + 1e-9) out.push([\"extending past the bottom edge\", `${at}: extends past the bottom edge (y+h>1)`])\n if (b.score !== undefined && !(isNum(b.score) && b.score >= 0 && b.score <= 1)) out.push([\"with a score out of 0..1\", `${at}: score=${b.score} out of 0..1`])\n return out\n}\n\n/** Cap a findings list at `MAX_LISTED_FINDINGS`, ending in one line that counts\n * the rest. Never empties a non-empty list, so `ok` is unchanged. */\nfunction capListed(list: readonly string[], noun: \"issues\" | \"warnings\"): string[] {\n if (list.length <= MAX_LISTED_FINDINGS) return [...list]\n return [...list.slice(0, MAX_LISTED_FINDINGS), `${list.length - MAX_LISTED_FINDINGS} more ${noun} not listed`]\n}\n\n/** Is `ms` inside one of `spans` (sorted, half-open)? Binary search. */\nfunction inSpans(spans: readonly SpeakerTrackSpan[], ms: number): boolean {\n let lo = 0\n let hi = spans.length - 1\n while (lo <= hi) {\n const mid = (lo + hi) >> 1\n const sp = spans[mid]\n if (ms < sp.startMs) hi = mid - 1\n else if (ms >= sp.endMs) lo = mid + 1\n else return true\n }\n return false\n}\n\n/**\n * Structural validation of a track set (the box body). Normalization is\n * `normalizeSpeakerTracks`'s job; this reports what is still wrong after it.\n * Issues are facts intrinsic to the set (or to the set against the EDL);\n * warnings are judgements an older validator must not turn into a refusal\n * (an unknown attribution method, one stray speaker label).\n *\n * Rules: version; a positive sample rate; unique source ids that resolve to\n * the EDL's video sources; the source clock; a positive frame; sorted,\n * non-overlapping, positive, integer-ms spans; ascending integer cuts; unique\n * track ids; every box in-frame, at an integer ms, strictly after the previous\n * one and inside a sampled span; no track across a cut; the speaker name\n * space; the box and byte caps.\n *\n * The listing is bounded: per track, the first few boxes breaking each rule\n * are listed and the rest counted in one line; past a fixed total, one line\n * counts the issues (or warnings) not listed. `ok` counts every finding.\n */\nexport function validateSpeakerTracks(set: SpeakerTrackSet, opts: SpeakerTracksValidateOptions = {}): EdlValidation {\n const safe = isObj(set) ? set : ({} as SpeakerTrackSet)\n const f = validateCommon(safe, opts, (t, source, { issues }) => {\n const boxes = Array.isArray(t?.boxes) ? t.boxes : []\n const spans = Array.isArray(source.sampledSpans) ? source.sampledSpans : []\n let first = Infinity\n let last = -Infinity\n // The first few findings of each rule are listed; the rest are counted.\n const seen = new Map<string, number>()\n const report = ([rule, message]: BoxFinding) => {\n const n = (seen.get(rule) ?? 0) + 1\n seen.set(rule, n)\n if (n <= BOX_FINDINGS_PER_RULE) issues.push(message)\n }\n const outside = `outside every sampled span of source \"${source.sourceId}\"`\n boxes.forEach((b, j) => {\n const at = `track \"${t.id}\" box[${j}]`\n boxIssues(b, at).forEach(report)\n if (!isNum(b?.ms)) {\n report([\"whose ms is not a number\", `${at}: ms is not a number`])\n return\n }\n if (!Number.isInteger(b.ms)) report([\"whose ms is not an integer\", `${at}: ms ${b.ms} is not an integer`])\n const prev = boxes[j - 1]?.ms\n if (j > 0 && isNum(prev) && !(b.ms > prev)) report([\"not after the previous box\", `${at}: ms ${b.ms} is not after the previous box (${prev})`])\n if (!inSpans(spans, b.ms)) report([outside, `${at}: ms ${b.ms} is ${outside}`])\n first = Math.min(first, b.ms)\n last = Math.max(last, b.ms)\n })\n for (const [rule, n] of seen) {\n if (n > BOX_FINDINGS_PER_RULE) issues.push(`track \"${t.id}\": ${n - BOX_FINDINGS_PER_RULE} more boxes ${rule}`)\n }\n const cut = (Array.isArray(source.cuts) ? source.cuts : []).find((c) => first < c && c <= last)\n if (cut !== undefined) issues.push(`track \"${t.id}\": spans the cut at ${cut} ms (boxes ${first}..${last})`)\n return boxes.length\n })\n const maxBytes = opts.maxBytes ?? SPEAKER_TRACKS_MAX_BYTES\n const bytes = opts.serializedBytes ?? new TextEncoder().encode(JSON.stringify(safe)).length\n if (bytes > maxBytes) f.issues.push(`the track set is ${bytes} bytes, over the cap of ${maxBytes}`)\n return { ok: f.issues.length === 0, issues: capListed(f.issues, \"issues\"), warnings: capListed(f.warnings, \"warnings\") }\n}\n\n/**\n * Structural validation of a descriptor (the node's output): the same rules as\n * `validateSpeakerTracks` minus the per-box ones (it has no boxes; `boxCount`\n * feeds the per-source cap), plus a non-empty `url`, a well-formed `sha256`\n * and a positive `bytes` within the byte cap.\n */\nexport function validateSpeakerTrackSetDescriptor(\n d: SpeakerTrackSetDescriptor,\n opts: Omit<SpeakerTracksValidateOptions, \"serializedBytes\"> = {},\n): EdlValidation {\n const safe = isObj(d) ? d : ({} as SpeakerTrackSetDescriptor)\n const f = validateCommon(safe, opts, (t, _source, { issues }) => {\n if (!(Number.isInteger(t?.boxCount) && t.boxCount >= 0)) {\n issues.push(`track \"${t?.id}\": boxCount must be a non-negative integer`)\n return 0\n }\n return t.boxCount\n })\n if (!(typeof safe.url === \"string\" && safe.url.trim())) f.issues.push(\"url is empty\")\n if (!(typeof safe.sha256 === \"string\" && SHA256_HEX.test(safe.sha256))) f.issues.push(\"sha256 must be 64 lowercase hex characters\")\n const maxBytes = opts.maxBytes ?? SPEAKER_TRACKS_MAX_BYTES\n if (!(Number.isInteger(safe.bytes) && safe.bytes > 0)) f.issues.push(\"bytes must be a positive integer\")\n else if (safe.bytes > maxBytes) f.issues.push(`the track set is ${safe.bytes} bytes, over the cap of ${maxBytes}`)\n return { ok: f.issues.length === 0, issues: capListed(f.issues, \"issues\"), warnings: capListed(f.warnings, \"warnings\") }\n}\n","/**\n * camera-switch (podcast B5, decided 2026-10-03) — the structural pieces every\n * caller shares: the canvas engines, the editor, MCP and the SDK. WHO is on\n * screen is decided by the Cloud plugin; these only read the inputs it needs\n * and pre-fill the speaker table. Pure, no I/O.\n */\nimport { normalizeTranscript } from \"./edl.js\"\n\n/** The settings and their decided defaults (the plugin holds its own copy, D13). */\nexport const CAMERA_SWITCH_DEFAULTS = Object.freeze({\n /** The shortest shot; a shorter turn (an interjection) holds the shot. */\n minShotMs: 2_500,\n /** Cut this long before the new speaker starts. */\n leadMs: 200,\n /** With a `wide` camera: break to it after this long on one camera. */\n maxShotMs: 20_000,\n /** With a `wide` camera: every N-th cut goes to the wide (0 = off). */\n wideEvery: 0,\n /** Overlapping speech → a side-by-side / stacked layout hint. */\n layoutHints: false,\n})\n\n/** The flat credit id and price (decided 2026-10-03). */\nexport const CAMERA_SWITCH_CREDIT_ID = \"camera-switch\"\n\nconst parseMaybe = (raw: unknown): unknown => {\n if (typeof raw !== \"string\") return raw\n try { return JSON.parse(raw) } catch { return undefined }\n}\n\n/** Distinct speaker labels of a transcript (an object or its JSON string), in\n * order of first appearance in time. Read through `normalizeTranscript`\n * (decided 2026-10-08) — the Cloud plugin's reading — so a broken word (no\n * usable time) names no speaker here either; a zero-width word is a point\n * and does. Empty → camera-switch refuses before charging. */\nexport function transcriptSpeakerLabels(transcript: unknown): string[] {\n const parsed = parseMaybe(transcript)\n if (!parsed || typeof parsed !== \"object\") return []\n const seen = new Set<string>()\n for (const w of normalizeTranscript(parsed).words) {\n if (w.speaker && !seen.has(w.speaker)) seen.add(w.speaker)\n }\n return [...seen]\n}\n\n/** The cameras a speaker can be given: an EDL's video sources in order,\n * without the `wide` / `screen` angles (those are not anyone's close-up). */\nexport function cameraSwitchCameras(edl: unknown): Array<{ id: string; role?: string }> {\n const sources = (parseMaybe(edl) as { sources?: unknown } | null | undefined)?.sources\n if (!Array.isArray(sources)) return []\n return sources\n .filter((s): s is { id: string; kind?: string; role?: string } => !!s && typeof (s as { id?: unknown }).id === \"string\")\n .filter((s) => s.kind !== \"audio\" && s.role !== \"wide\" && s.role !== \"screen\" && s.role !== \"master-audio\")\n .map((s) => ({ id: s.id, ...(s.role ? { role: s.role } : {}) }))\n}\n\n/** The settings' accepted ranges — exactly the Cloud route's (it answers 400\n * outside them), so every caller clamps to the same numbers before sending. */\nexport const CAMERA_SWITCH_BOUNDS = Object.freeze({\n minShotMs: Object.freeze({ min: 500, max: 60_000 }),\n leadMs: Object.freeze({ min: 0, max: 5_000 }),\n maxShotMs: Object.freeze({ min: 0, max: 600_000 }),\n wideEvery: Object.freeze({ min: 0, max: 20 }),\n})\n\n/** The longest display name a speaker can be given. */\nexport const CAMERA_SWITCH_NAME_MAX = 80\n\nexport type CameraSwitchNumericSetting = keyof typeof CAMERA_SWITCH_BOUNDS\n\n/** A setting as a whole number inside its range; undefined when unset. */\nexport function clampCameraSwitchSetting(key: CameraSwitchNumericSetting, value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined\n const { min, max } = CAMERA_SWITCH_BOUNDS[key]\n return Math.min(max, Math.max(min, Math.round(value)))\n}\n\n/** Display names trimmed, empty ones dropped, each cut to\n * `CAMERA_SWITCH_NAME_MAX` characters. */\nexport function cleanSpeakerNames(raw: unknown): Record<string, string> {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return {}\n const out: Record<string, string> = {}\n for (const [label, name] of Object.entries(raw as Record<string, unknown>)) {\n const trimmed = typeof name === \"string\" ? name.trim() : \"\"\n if (label && trimmed) out[label] = trimmed.slice(0, CAMERA_SWITCH_NAME_MAX)\n }\n return out\n}\n\n/** Why camera-switch would refuse this edit (the route's 400 `invalid_edl`),\n * or null. One edit (an object or its JSON string) on the master clock, with\n * sources and at least one segment of numeric inMs < outMs; a clip SET is\n * refused — on the canvas each clip fans out to its own run. */\nexport function cameraSwitchEdlProblem(edl: unknown): string | null {\n const v = parseMaybe(edl) as Record<string, unknown> | null | undefined\n if (!v || typeof v !== \"object\" || Array.isArray(v)) return \"camera-switch: `edl` must be one edit (an EDL object).\"\n if (Array.isArray(v.clips)) return \"camera-switch: `edl` is a clip set — pass one clip's EDL (a clip set fans out one run per clip on the canvas).\"\n if (!Array.isArray(v.sources) || !Array.isArray(v.segments)) return \"camera-switch: `edl` needs `sources` and `segments`.\"\n if (v.segments.length === 0) return \"camera-switch: `edl` has no segments.\"\n const num = (x: unknown) => (typeof x === \"number\" && Number.isFinite(x) ? x : undefined)\n for (const [i, row] of (v.segments as unknown[]).entries()) {\n const seg = row as { inMs?: unknown; outMs?: unknown } | null\n const inMs = num(seg?.inMs), outMs = num(seg?.outMs)\n if (inMs === undefined || outMs === undefined || !(outMs > inMs)) return `camera-switch: segment ${i} needs a numeric inMs < outMs.`\n }\n if (v.clock === \"output\") return \"camera-switch: the edit must be on the master clock (an edit-plan EDL), not a rendered output's.\"\n return null\n}\n\n/** The speaker table pre-filled by order (decided 2026-10-03): speaker 1 →\n * camera 1, speaker 2 → camera 2 … A speaker past the last camera stays\n * unmapped (the wide shows them, else any camera with picture). `existing`\n * entries are kept as the person set them — an explicit `\"\"` means \"no\n * camera of their own\" and is SENT as `\"\"`, so it also beats a source whose\n * `speakers` list names them. */\nexport function defaultSpeakerMap(\n labels: readonly string[],\n cameraIds: readonly string[],\n existing: Readonly<Record<string, string>> = {},\n): Record<string, string> {\n const out: Record<string, string> = {}\n labels.forEach((label, i) => {\n if (Object.prototype.hasOwnProperty.call(existing, label)) {\n const kept = existing[label]\n if (typeof kept === \"string\") out[label] = kept\n return\n }\n if (i < cameraIds.length) out[label] = cameraIds[i]!\n })\n return out\n}\n\n/** What a Camera Switch node sends besides its two inputs — ONE funnel for the\n * canvas executor and the orchestrator, so both send the same clamped\n * settings and the same pre-filled speaker table. */\nexport interface CameraSwitchNodeSettings {\n readonly speakerMap?: Readonly<Record<string, string>>\n readonly speakerNames?: Readonly<Record<string, string>>\n readonly minShotMs?: number\n readonly leadMs?: number\n readonly maxShotMs?: number\n readonly wideEvery?: number\n readonly layoutHints?: boolean\n}\nexport function cameraSwitchSettingsPayload(\n data: CameraSwitchNodeSettings,\n edl: unknown,\n transcript: unknown,\n): {\n speakerMap: Record<string, string>\n speakerNames: Record<string, string>\n minShotMs?: number\n leadMs?: number\n maxShotMs?: number\n wideEvery?: number\n layoutHints: boolean\n} {\n const existing = data.speakerMap && typeof data.speakerMap === \"object\" ? data.speakerMap : {}\n const out: ReturnType<typeof cameraSwitchSettingsPayload> = {\n speakerMap: defaultSpeakerMap(transcriptSpeakerLabels(transcript), cameraSwitchCameras(edl).map((c) => c.id), existing),\n speakerNames: cleanSpeakerNames(data.speakerNames),\n layoutHints: data.layoutHints === true,\n }\n for (const key of Object.keys(CAMERA_SWITCH_BOUNDS) as CameraSwitchNumericSetting[]) {\n const v = clampCameraSwitchSetting(key, data[key])\n if (v !== undefined) out[key] = v\n }\n return out\n}\n","/**\n * The edit-plan node's credit-id scheme and output unwrap — split out of\n * `edl.ts` (which keeps the EDL shape itself) so that module stays within the\n * file-size cap. Re-exported from the package index, so importers of\n * `@nodaro/shared` are unaffected.\n */\nimport { EDL_VERSION } from \"./edl.js\"\n\n// ─────────────────────────────────────────────────────────────────────────\n// edit-plan credit-id scheme (STRUCTURE only — the per-mode/tier/bucket credit\n// VALUES live app-side in backend/ee/billing/credits.ts + migration 432, since\n// they are probe-set placeholders and the DB row wins at runtime). Lives HERE\n// so BOTH core payload-builder and ee credits.ts read one id builder — core\n// may not import ee (check-ee-imports), the same reason buildVideoAnalysisCreditId\n// is shared. Mirrors the plugin's own (D13-local) pricing.ts scheme.\n// ─────────────────────────────────────────────────────────────────────────\n\n/** `trailer` (Track D1): one short teaser EDL built from the strongest moments,\n * priced like `clips` (the per-minute rate plus the clips flat). */\nexport type EditPlanMode = \"tighten\" | \"clips\" | \"chapters\" | \"trailer\"\nexport type EditPlanTier = \"economy\" | \"standard\" | \"premium\"\nexport const EDIT_PLAN_MODES: readonly EditPlanMode[] = [\"tighten\", \"clips\", \"chapters\", \"trailer\"]\nexport const EDIT_PLAN_TIERS: readonly EditPlanTier[] = [\"economy\", \"standard\", \"premium\"]\n/** The coarse duration ladder (MINUTES) a probed source duration rounds UP to;\n * the composite credit id carries the bucket. 4 modes × 3 tiers × 6 buckets =\n * 72 composites (+ the bare `edit-plan`). */\nexport const EDIT_PLAN_BUCKET_MINUTES: readonly number[] = [15, 30, 60, 90, 120, 180]\n/** Hard duration cap (design §7.4). */\nexport const EDIT_PLAN_MAX_MINUTES = 180\n/** `clips` mode: how many clips a plan returns when the caller names no count,\n * and the most it may be asked for. One source for the credit estimate, the\n * orchestrated payload clamp and the request schema. */\nexport const EDIT_PLAN_DEFAULT_CLIP_COUNT = 8\nexport const EDIT_PLAN_MAX_CLIP_COUNT = 50\n\n/** Clamp a requested clip count into `[1, EDIT_PLAN_MAX_CLIP_COUNT]`; `undefined`\n * for anything that is not a positive number (the planner then uses its default). */\nexport function clampEditPlanClipCount(count: unknown): number | undefined {\n if (typeof count !== \"number\" || !Number.isFinite(count) || count <= 0) return undefined\n return Math.min(EDIT_PLAN_MAX_CLIP_COUNT, Math.max(1, Math.floor(count)))\n}\n/** The bare estimator / DB-down fallback id. */\nexport const EDIT_PLAN_BASE_CREDIT_ID = \"edit-plan\"\n\n/** Round a source duration (seconds) UP to the smallest covering ladder bucket\n * (capped at the max), in minutes. `undefined` / non-finite → the ceiling\n * bucket (the safe over-reserve direction). */\nexport function editPlanBucketMinutes(durationSec: number | undefined): number {\n const secs = typeof durationSec === \"number\" && Number.isFinite(durationSec) ? durationSec : EDIT_PLAN_MAX_MINUTES * 60\n const mins = Math.max(1, Math.ceil(secs / 60))\n const capped = Math.min(mins, EDIT_PLAN_MAX_MINUTES)\n for (const b of EDIT_PLAN_BUCKET_MINUTES) if (capped <= b) return b\n return EDIT_PLAN_BUCKET_MINUTES[EDIT_PLAN_BUCKET_MINUTES.length - 1]!\n}\n\n/** `edit-plan:<mode>:<tier>:<bucket>m`. `durationSec` undefined → the ceiling\n * bucket. Single source of truth for the composite id shape. */\nexport function buildEditPlanCreditId(mode: EditPlanMode, tier: EditPlanTier, durationSec?: number): string {\n return editPlanMinutesCreditId(mode, tier, editPlanBucketMinutes(durationSec))\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Per started minute (decided 2026-10-07). A plugin that declares\n// `supports().editPlanPerMinute` reserves `edit-plan:<mode>:<tier>:<N>m` with\n// N = the started minutes of the source (1..180), priced flat + rate × N from\n// ONE rate row and ONE flat row per mode × tier. The step ids above have the\n// same shape (N = a step), so one parser reads both, and the plugin's money\n// gate (`:(\\d+)m$`) accepts both.\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Started minutes of a source (seconds): ceil(sec / 60), at least 1, capped at\n * the maximum. `undefined` / non-finite → the maximum (over-reserve direction). */\nexport function editPlanStartedMinutes(durationSec: number | undefined): number {\n const secs = typeof durationSec === \"number\" && Number.isFinite(durationSec) ? durationSec : EDIT_PLAN_MAX_MINUTES * 60\n return Math.min(EDIT_PLAN_MAX_MINUTES, Math.max(1, Math.ceil(secs / 60)))\n}\n\n/** `edit-plan:<mode>:<tier>:<N>m` for N minutes (a started-minute count or a step). */\nexport function editPlanMinutesCreditId(mode: EditPlanMode, tier: EditPlanTier, minutes: number): string {\n return `edit-plan:${mode}:${tier}:${minutes}m`\n}\n\n/** The id a run of this mode/tier on a source of `durationSec` reserves: per\n * started minute when the plugin charges that way (`perMinute`), else the step\n * the length rounds up to. An unknown length → the 180-minute maximum either way. */\nexport function editPlanReserveCreditId(\n mode: EditPlanMode,\n tier: EditPlanTier,\n durationSec: number | undefined,\n perMinute: boolean,\n): string {\n return perMinute\n ? editPlanMinutesCreditId(mode, tier, editPlanStartedMinutes(durationSec))\n : buildEditPlanCreditId(mode, tier, durationSec)\n}\n\n/** The rate row: credits per started source minute for a mode/tier. Never reserved. */\nexport function editPlanRateCreditId(mode: EditPlanMode, tier: EditPlanTier): string {\n return `edit-plan:${mode}:${tier}:per-minute`\n}\n\n/** The flat row: credits once per plan for a mode/tier (0 for tighten and chapters). Never reserved. */\nexport function editPlanFlatCreditId(mode: EditPlanMode, tier: EditPlanTier): string {\n return `edit-plan:${mode}:${tier}:flat`\n}\n\n/** The mode, tier and minutes of an `edit-plan:<mode>:<tier>:<N>m` id (1 ≤ N ≤\n * the maximum), or `undefined` for anything else (the bare id, a rate or flat\n * row, an unknown mode or tier). */\nexport function parseEditPlanMinutesCreditId(\n id: string,\n): { mode: EditPlanMode; tier: EditPlanTier; minutes: number } | undefined {\n const m = /^edit-plan:([a-z]+):([a-z]+):(\\d+)m$/.exec(id)\n if (!m) return undefined\n const mode = parseEditPlanMode(m[1])\n const tier = (EDIT_PLAN_TIERS as readonly string[]).includes(m[2]!) ? (m[2] as EditPlanTier) : undefined\n const minutes = Number(m[3])\n if (!mode || !tier || !Number.isInteger(minutes) || minutes < 1 || minutes > EDIT_PLAN_MAX_MINUTES) return undefined\n return { mode, tier, minutes }\n}\n\n/** flat + rate × N, rounded up, at least 1 credit — what an\n * `edit-plan:<mode>:<tier>:<N>m` id costs from its two rows (the plugin's formula). */\nexport function editPlanMinutesBaseCredits(flat: number, rate: number, minutes: number): number {\n return Math.max(1, Math.ceil(flat + rate * minutes))\n}\n\n/** Narrow an arbitrary value to a known edit-plan mode, defaulting to \"tighten\".\n * For display and estimates only: anything that DISPATCHES a plan must use\n * {@link parseEditPlanMode} and refuse an unknown mode, or that mode is planned\n * (and charged) as tighten. */\nexport function asEditPlanMode(v: unknown): EditPlanMode {\n return parseEditPlanMode(v) ?? \"tighten\"\n}\n\n/** The strict sibling of {@link asEditPlanMode}: the mode when `v` is exactly a\n * known edit-plan mode, otherwise `undefined` — never a substitute. */\nexport function parseEditPlanMode(v: unknown): EditPlanMode | undefined {\n return typeof v === \"string\" && (EDIT_PLAN_MODES as readonly string[]).includes(v) ? (v as EditPlanMode) : undefined\n}\n\n/** Narrow an arbitrary value to a known edit-plan tier, defaulting to \"standard\". */\nexport function asEditPlanTier(v: unknown): EditPlanTier {\n return v === \"economy\" || v === \"premium\" ? v : \"standard\"\n}\n\n/**\n * Unwrap an `edit-plan` job's `output_data` into the value stored on the node's\n * `data.generatedJson`, which every output extractor then reads. This is the ONE\n * place the modes are normalized (the same rule on both engines and every\n * result-application site, so audit-dag parity can't drift):\n * - `clips` → the BARE `Edl[]` (T5: the `list` fan-out reads `Array.isArray`\n * on `generatedJson`; each element becomes one JSON-stringified\n * item a downstream `edl` input `normalizeEdl`-parses).\n * - `chapters` → the `{ version, chapters }` object.\n * - `tighten` / `trailer` → the `Edl` object at top level.\n *\n * The cloud relay object-spreads `output_data` and adds `viaNodaroCloud: true`;\n * that key (and any other bookkeeping) is stripped here. The unwrap lives HERE —\n * NEVER in `output_data` — because a bare array written into `output_data` would\n * be corrupted into numeric keys by the relay's object-spread (see `EdlClipSet`).\n */\nexport function unwrapEditPlanOutput(outputData: unknown): unknown {\n if (!outputData || typeof outputData !== \"object\") return outputData\n const o = outputData as Record<string, unknown>\n // clips: EdlClipSet { version, clips: Edl[] } → the bare Edl[].\n if (Array.isArray(o.clips)) return o.clips\n // chapters: { version, chapters: [...] } → the object, minus bookkeeping.\n if (Array.isArray(o.chapters)) return { version: EDL_VERSION, chapters: o.chapters }\n // tighten / trailer: the Edl object at top level → drop the relay's viaNodaroCloud.\n const { viaNodaroCloud: _viaNodaroCloud, ...rest } = o\n return rest\n}\n"]}
|