@cueframe/kernel 0.2.57 → 0.2.59-rc.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.
Files changed (370) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +111 -0
  2. package/dist/_members/account-model/testing/conversationStoreContract.d.ts +3 -4
  3. package/dist/_members/account-model/testing/restorePointStoreContract.d.ts +3 -4
  4. package/dist/_members/account-model/validators/index.d.ts +0 -1
  5. package/dist/_members/animate/index.d.ts +0 -2
  6. package/dist/_members/authoring/index.d.ts +1 -1
  7. package/dist/_members/authoring/prompts/index.d.ts +0 -1
  8. package/dist/_members/authoring/resources.d.ts +2 -11
  9. package/dist/_members/cloud-import/CloudImportService.d.ts +0 -1
  10. package/dist/_members/cloud-import/index.d.ts +0 -2
  11. package/dist/_members/component-runtime/allowedImports.d.ts +6 -0
  12. package/dist/_members/component-runtime/allowedImports.d.ts.map +1 -1
  13. package/dist/_members/component-runtime/browserIdentity.d.ts +2 -12
  14. package/dist/_members/component-runtime/browserIdentity.d.ts.map +1 -1
  15. package/dist/_members/component-runtime/canonicalIdentity.d.ts +8 -1
  16. package/dist/_members/component-runtime/canonicalIdentity.d.ts.map +1 -1
  17. package/dist/_members/component-runtime/contracts.d.ts +2 -1
  18. package/dist/_members/component-runtime/contracts.d.ts.map +1 -1
  19. package/dist/_members/component-runtime/identity.d.ts +2 -3
  20. package/dist/_members/component-runtime/identity.d.ts.map +1 -1
  21. package/dist/_members/component-runtime/importPolicy.d.ts +5 -0
  22. package/dist/_members/component-runtime/importPolicy.d.ts.map +1 -1
  23. package/dist/_members/component-runtime/template/bind.d.ts +22 -0
  24. package/dist/_members/component-runtime/template/bind.d.ts.map +1 -0
  25. package/dist/_members/component-runtime/template/checks.d.ts +71 -0
  26. package/dist/_members/component-runtime/template/checks.d.ts.map +1 -0
  27. package/dist/_members/component-runtime/template/extract.d.ts +35 -0
  28. package/dist/_members/component-runtime/template/extract.d.ts.map +1 -0
  29. package/dist/_members/component-runtime/template/index.d.ts +6 -0
  30. package/dist/_members/component-runtime/template/index.d.ts.map +1 -0
  31. package/dist/_members/component-runtime/template/schema.d.ts +1581 -0
  32. package/dist/_members/component-runtime/template/schema.d.ts.map +1 -0
  33. package/dist/_members/component-runtime/template/testing/fixtures.d.ts +33 -0
  34. package/dist/_members/component-runtime/template/testing/fixtures.d.ts.map +1 -0
  35. package/dist/_members/component-runtime/template/testing/index.d.ts +3 -0
  36. package/dist/_members/component-runtime/template/testing/index.d.ts.map +1 -0
  37. package/dist/_members/component-runtime/template/testing/templateApplyContract.d.ts +53 -0
  38. package/dist/_members/component-runtime/template/testing/templateApplyContract.d.ts.map +1 -0
  39. package/dist/_members/component-runtime/testing/sourcePolicyCases.d.ts +15 -0
  40. package/dist/_members/component-runtime/testing/sourcePolicyCases.d.ts.map +1 -0
  41. package/dist/_members/component-runtime/webglProbe.d.ts.map +1 -1
  42. package/dist/_members/compose/index.d.ts +1 -1
  43. package/dist/_members/compose/primitiveRegistry.d.ts +0 -2
  44. package/dist/_members/composition/audio/audioMix.d.ts +0 -1
  45. package/dist/_members/composition/audio/mixStaging.d.ts +0 -5
  46. package/dist/_members/composition/fixtures/index.d.ts +0 -1
  47. package/dist/_members/composition/graphics-plan/index.d.ts +0 -2
  48. package/dist/_members/composition/graphics-plan/schemas.d.ts +4 -4
  49. package/dist/_members/composition/invariants/etag.d.ts +0 -1
  50. package/dist/_members/composition/invariants/index.d.ts +0 -1
  51. package/dist/_members/composition/ops/compositionOps.d.ts +0 -1
  52. package/dist/_members/composition/ops/compositionOps.shared.d.ts +6 -0
  53. package/dist/_members/composition/ops/index.d.ts +2 -1
  54. package/dist/_members/composition/primitive-catalog/index.d.ts +2 -3
  55. package/dist/_members/composition/primitive-catalog/types.d.ts +3 -1
  56. package/dist/_members/composition/projection/behind-readiness.d.ts +0 -6
  57. package/dist/_members/composition/timeline/link.d.ts +0 -4
  58. package/dist/_members/composition/timeline/plan.d.ts +0 -1
  59. package/dist/_members/composition/validators/brandKit.d.ts +11 -4
  60. package/dist/_members/composition/validators/brandKitBody.d.ts +543 -0
  61. package/dist/_members/composition/validators/cardHtml.d.ts +11 -0
  62. package/dist/_members/composition/validators/composition.d.ts +2 -5
  63. package/dist/_members/composition/validators/css-tree-subpaths.d.ts +16 -0
  64. package/dist/_members/composition/validators/index.d.ts +0 -3
  65. package/dist/_members/composition/validators/session.d.ts +3 -3
  66. package/dist/_members/composition/validators/webhook.d.ts +4 -4
  67. package/dist/_members/composition-ops/alphaLayers.d.ts +0 -5
  68. package/dist/_members/composition-ops/index.d.ts +2 -2
  69. package/dist/_members/composition-ops/opRecorder.d.ts +23 -3
  70. package/dist/_members/core/render/exportSettings.d.ts +4 -2
  71. package/dist/_members/core/render/index.d.ts +1 -1
  72. package/dist/_members/core/render/vcam/requiredRegion.d.ts +0 -1
  73. package/dist/_members/director/ai-sdk/index.d.ts +0 -1
  74. package/dist/_members/director/ai-sdk/messages.d.ts +0 -1
  75. package/dist/_members/director/domain/chat.d.ts +0 -78
  76. package/dist/_members/director/domain/index.d.ts +0 -1
  77. package/dist/_members/errors/registry.d.ts +42 -0
  78. package/dist/_members/foundation/canonical/index.d.ts +14 -0
  79. package/dist/_members/foundation/index.d.ts +1 -1
  80. package/dist/_members/foundation/primitives/index.d.ts +0 -2
  81. package/dist/_members/foundation/testing/index.d.ts +1 -0
  82. package/dist/_members/foundation/testing/knownRed.d.ts +13 -0
  83. package/dist/_members/mcp/adapter.d.ts +21 -0
  84. package/dist/_members/mcp/compositionOps.d.ts +10 -0
  85. package/dist/_members/mcp/server.d.ts +0 -2
  86. package/dist/_members/mcp/wait.d.ts +3 -1
  87. package/dist/_members/media-model/generation.d.ts +0 -25
  88. package/dist/_members/nle-export/xml-utils.d.ts +0 -8
  89. package/dist/_members/plane/conformance.d.ts +20 -0
  90. package/dist/_members/primitives/backgrounds/dynamic-grid/config.d.ts +1 -1
  91. package/dist/_members/primitives/effects/blur/config.d.ts +1 -1
  92. package/dist/_members/primitives/effects/color-grade/config.d.ts +2 -2
  93. package/dist/_members/primitives/effects/grain/config.d.ts +3 -3
  94. package/dist/_members/primitives/effects/particles/config.d.ts +2 -2
  95. package/dist/_members/primitives/effects/stage-camera/config.d.ts +6 -6
  96. package/dist/_members/primitives/effects/vignette/config.d.ts +1 -1
  97. package/dist/_members/primitives/index.d.ts +1 -11
  98. package/dist/_members/primitives/layouts/flex-layout/config.d.ts +3 -3
  99. package/dist/_members/primitives/layouts/picture-in-picture/config.d.ts +2 -2
  100. package/dist/_members/primitives/lib/index.d.ts +1 -1
  101. package/dist/_members/primitives/lib/tokens.d.ts +0 -16
  102. package/dist/_members/primitives/lib/types.d.ts +1 -1
  103. package/dist/_members/primitives/scenes/device-showcase/config.d.ts +7 -7
  104. package/dist/_members/primitives/text/cinematic-title/config.d.ts +3 -3
  105. package/dist/_members/primitives/text/karaoke/config.d.ts +1 -1
  106. package/dist/_members/primitives/text/kinetic-type/config.d.ts +3 -3
  107. package/dist/_members/primitives/text/stat-counter/config.d.ts +1 -1
  108. package/dist/_members/primitives/text/text-effect/config.d.ts +2 -2
  109. package/dist/_members/primitives/transitions/grid-pixelate-wipe/config.d.ts +1 -1
  110. package/dist/_members/primitives/ui-blocks/badge-pop/config.d.ts +3 -3
  111. package/dist/_members/primitives/ui-blocks/terminal-simulator/config.d.ts +2 -2
  112. package/dist/_members/primitives/ui-blocks/toast-notification/config.d.ts +2 -2
  113. package/dist/_members/render-harness/cardAssetAdmission.d.ts +1 -0
  114. package/dist/_members/render-harness/cardAssetAdmission.d.ts.map +1 -1
  115. package/dist/_members/render-harness/cardRender.d.ts.map +1 -1
  116. package/dist/_members/render-harness/materializeSources.d.ts.map +1 -1
  117. package/dist/_members/render-harness/mediaServer.d.ts +6 -1
  118. package/dist/_members/render-harness/mediaServer.d.ts.map +1 -1
  119. package/dist/account-model/testing.js +15 -5
  120. package/dist/account-model/validators.js +5 -7
  121. package/dist/account-model.js +5 -7
  122. package/dist/animate/preparation-facts.js +1 -1
  123. package/dist/animate.js +2 -6
  124. package/dist/authoring/composer.js +1 -1
  125. package/dist/authoring/context.js +8 -6
  126. package/dist/authoring/models/defaults.d.ts +1 -0
  127. package/dist/authoring/models/defaults.js +7 -0
  128. package/dist/authoring/models.js +5 -3
  129. package/dist/authoring/motion.d.ts +1 -0
  130. package/dist/authoring/motion.js +25 -0
  131. package/dist/authoring/prompts.js +4 -14
  132. package/dist/authoring/providers.js +1 -1
  133. package/dist/authoring/resource-routing.js +2 -2
  134. package/dist/authoring/resources.js +4 -22
  135. package/dist/authoring/scene.js +3 -2
  136. package/dist/authoring.js +662 -218
  137. package/dist/brand-derivation/constants.js +1 -1
  138. package/dist/brand-derivation.js +1 -1
  139. package/dist/{chunk-TKFLSGAS.js → chunk-25JH5QZA.js} +2 -2
  140. package/dist/{chunk-LBJ5LI5V.js → chunk-2K2GBFLU.js} +17 -8
  141. package/dist/{chunk-RAXHCRVV.js → chunk-2PAP5LO5.js} +1 -1
  142. package/dist/{chunk-JPMVNMF3.js → chunk-3HLDIIWA.js} +1 -1
  143. package/dist/{chunk-PTVTWQ4T.js → chunk-3JEUNKDK.js} +2 -2
  144. package/dist/chunk-3VWJ3H4X.js +68 -0
  145. package/dist/{chunk-S5H6GH6M.js → chunk-3Z7CN54H.js} +1 -1
  146. package/dist/{chunk-FVDFPJHT.js → chunk-46WBCUPE.js} +1 -1
  147. package/dist/chunk-4VBLQIM5.js +30 -0
  148. package/dist/{chunk-N2OZDD44.js → chunk-6HA55CRU.js} +4 -5
  149. package/dist/{chunk-WL2MLKWU.js → chunk-6HPEMDQW.js} +1 -1
  150. package/dist/chunk-6KZCXAYL.js +257 -0
  151. package/dist/{chunk-IEXAKOEX.js → chunk-6QGARSV6.js} +2 -15
  152. package/dist/{chunk-3YVIAWET.js → chunk-7II5OM7R.js} +13 -1
  153. package/dist/{chunk-VLJOIUHL.js → chunk-7PSQUTL5.js} +3 -3
  154. package/dist/{chunk-UFD4EZHM.js → chunk-AFUITAH6.js} +4 -5
  155. package/dist/{chunk-HGCYZMII.js → chunk-AK6QPX7A.js} +9 -9
  156. package/dist/{chunk-EC6VFQE6.js → chunk-BZVOCVQV.js} +1 -0
  157. package/dist/{chunk-RBWS5XHE.js → chunk-CAF7BRNE.js} +2 -2
  158. package/dist/chunk-CEO47DIE.js +199 -0
  159. package/dist/chunk-CIOUDOGN.js +12 -0
  160. package/dist/{chunk-BDFAA747.js → chunk-DCKADD5B.js} +1 -1
  161. package/dist/{chunk-7AZLFN26.js → chunk-EISHFHU5.js} +20 -20
  162. package/dist/chunk-EQH37KNZ.js +224 -0
  163. package/dist/{chunk-EXY4JJPH.js → chunk-F6PLDBAK.js} +2 -11
  164. package/dist/{chunk-DAARYRNT.js → chunk-FKSXKS35.js} +6 -6
  165. package/dist/{chunk-KBDUEU4W.js → chunk-FZB7UX44.js} +1 -1
  166. package/dist/chunk-H2ZZXISB.js +24 -0
  167. package/dist/{chunk-WSMCZRJ2.js → chunk-I2HNC4PQ.js} +1 -1
  168. package/dist/{chunk-VXGA7LQQ.js → chunk-IUJABAG2.js} +14 -10
  169. package/dist/{chunk-MZB4ZXYW.js → chunk-IVFMOHAC.js} +1 -9
  170. package/dist/{chunk-UKDBU7HM.js → chunk-JNBNDHEF.js} +3 -3
  171. package/dist/{chunk-JWMWVP64.js → chunk-KC4LNZL5.js} +4 -9
  172. package/dist/{chunk-GCQ7Z7S7.js → chunk-KKATUGRU.js} +3 -9
  173. package/dist/{chunk-Q5P5UFOP.js → chunk-KLQ53NX3.js} +13 -1
  174. package/dist/{chunk-UMXES6ED.js → chunk-LVMWPFV4.js} +1 -1
  175. package/dist/chunk-NECN7TT4.js +367 -0
  176. package/dist/{chunk-4ZE564YF.js → chunk-NM7NWXGF.js} +0 -146
  177. package/dist/{chunk-KSRFYFUZ.js → chunk-NY6EI5YW.js} +4 -4
  178. package/dist/{chunk-4PV3UYJF.js → chunk-ONSGT6UJ.js} +257 -226
  179. package/dist/{chunk-VZ7TYX6Z.js → chunk-P3EFZDM5.js} +0 -17
  180. package/dist/{chunk-BEFSJMFF.js → chunk-P6RVYHLT.js} +9 -9
  181. package/dist/{chunk-TBHSOEYK.js → chunk-PLWDYWK6.js} +4 -34
  182. package/dist/{chunk-KYRDKK2D.js → chunk-Q6CJ6HCU.js} +1 -6
  183. package/dist/{chunk-FWSJLHSV.js → chunk-R642352J.js} +1 -1
  184. package/dist/{chunk-XELS2BGA.js → chunk-R6HTIP3N.js} +1 -3
  185. package/dist/{chunk-RL5SO653.js → chunk-RQRPSSRT.js} +1 -1
  186. package/dist/chunk-RR7UBEBV.js +172 -0
  187. package/dist/{chunk-FHMTAZD4.js → chunk-RWJHZCOR.js} +1 -71
  188. package/dist/{chunk-73DQTUWY.js → chunk-TIAJMEQ4.js} +2 -22
  189. package/dist/{chunk-2ESYSVXG.js → chunk-U67V476Y.js} +2 -15
  190. package/dist/{chunk-N54EGUVM.js → chunk-U7KSOA2L.js} +4 -21
  191. package/dist/{chunk-K66NLMGX.js → chunk-UGWJC4GA.js} +62 -18
  192. package/dist/chunk-VBYINB74.js +136 -0
  193. package/dist/{chunk-W2245F6G.js → chunk-WTQRLFR2.js} +1 -1
  194. package/dist/{chunk-Z4G3VM3H.js → chunk-X2RTLS6K.js} +2 -23
  195. package/dist/chunk-XHMKPTHV.js +20 -0
  196. package/dist/{chunk-R7G2PNEZ.js → chunk-XOT2VWCO.js} +13 -28
  197. package/dist/{chunk-E63UEO5C.js → chunk-XQGQ5EFS.js} +16 -1
  198. package/dist/chunk-XR76OZKC.js +21 -0
  199. package/dist/chunk-ZCEYEIRB.js +179 -0
  200. package/dist/{chunk-IMIUHG2E.js → chunk-ZPJQ3TQL.js} +1 -3
  201. package/dist/cloud-import.js +1 -16
  202. package/dist/component-runtime/browserOptions.js +4 -3
  203. package/dist/component-runtime/contracts.js +2 -2
  204. package/dist/component-runtime/identity/browser.js +2 -17
  205. package/dist/component-runtime/identity.js +5 -7
  206. package/dist/component-runtime/importPolicy.js +3 -3
  207. package/dist/component-runtime/mediaResolution.js +1 -1
  208. package/dist/component-runtime/render.js +8 -7
  209. package/dist/component-runtime/sourceAdmission.js +3 -3
  210. package/dist/component-runtime/template/testing.d.ts +1 -0
  211. package/dist/component-runtime/template/testing.js +383 -0
  212. package/dist/component-runtime/template.d.ts +1 -0
  213. package/dist/component-runtime/template.js +251 -0
  214. package/dist/component-runtime.js +27 -28
  215. package/dist/compose.js +22 -39
  216. package/dist/composition/audio.js +4 -8
  217. package/dist/composition/brand-kit.js +1 -1
  218. package/dist/composition/brief.js +1 -1
  219. package/dist/composition/card-html.d.ts +1 -0
  220. package/dist/composition/card-html.js +15 -0
  221. package/dist/composition/depth.js +1 -1
  222. package/dist/composition/floors.js +2 -2
  223. package/dist/composition/fonts.js +1 -1
  224. package/dist/composition/graphics-plan.js +4 -44
  225. package/dist/composition/invariants.js +5 -12
  226. package/dist/composition/ops.js +7 -5
  227. package/dist/composition/primitive-catalog.js +4 -6
  228. package/dist/composition/projection.js +3 -5
  229. package/dist/composition/reframe/coverage.js +1 -1
  230. package/dist/composition/reframe/kenBurns.js +1 -1
  231. package/dist/composition/reframe/shotScale.js +1 -1
  232. package/dist/composition/reframe/trajectory.js +1 -1
  233. package/dist/composition/reframe.js +1 -1
  234. package/dist/composition/scene/budget-policy.js +1 -1
  235. package/dist/composition/scene.js +1 -1
  236. package/dist/composition/timeline.js +4 -8
  237. package/dist/composition/validators/brand-kit-body.d.ts +1 -0
  238. package/dist/composition/validators/brand-kit-body.js +18 -0
  239. package/dist/composition/validators/graphic-kinds.js +1 -1
  240. package/dist/composition/validators.js +16 -69
  241. package/dist/composition-ops.js +17 -15
  242. package/dist/composition.js +21 -83
  243. package/dist/context-7SWSVJ6Z.js +17 -0
  244. package/dist/core/render.js +13 -9
  245. package/dist/core/select.js +3 -3
  246. package/dist/core.js +9 -9
  247. package/dist/director/ai-sdk.js +7 -11
  248. package/dist/director/domain.js +9 -17
  249. package/dist/director.js +9 -21
  250. package/dist/{dist-LAJ2363K.js → dist-6FO67KVA.js} +1 -1
  251. package/dist/errors.js +2 -2
  252. package/dist/foundation/canonical.d.ts +1 -0
  253. package/dist/foundation/canonical.js +7 -0
  254. package/dist/foundation/primitives.js +4 -6
  255. package/dist/foundation/testing.d.ts +1 -0
  256. package/dist/foundation/testing.js +7 -0
  257. package/dist/foundation.js +7 -9
  258. package/dist/{magic-string.es-SDTMJBWP.js → magic-string.es-KVSW34UD.js} +1 -1
  259. package/dist/mcp/adapter.js +8 -16
  260. package/dist/mcp/composition-ops.d.ts +1 -0
  261. package/dist/mcp/composition-ops.js +11 -0
  262. package/dist/mcp/core.js +2 -2
  263. package/dist/mcp/curation.js +1 -1
  264. package/dist/mcp/executor.js +1 -1
  265. package/dist/mcp/scene-shot.js +3 -3
  266. package/dist/mcp/server.js +6 -30
  267. package/dist/mcp/wire-schema.js +13 -2
  268. package/dist/mcp.js +11 -33
  269. package/dist/media-model/generation.js +6 -8
  270. package/dist/media-model/media-kind.js +1 -1
  271. package/dist/media-model/testing.js +2 -2
  272. package/dist/media-model/transcriptSearch.js +1 -1
  273. package/dist/media-model.js +6 -8
  274. package/dist/nle-export/xml.js +1 -1
  275. package/dist/nle-export.js +2 -2
  276. package/dist/perception.js +1 -1
  277. package/dist/plane/conformance.js +8 -4
  278. package/dist/plane/contract.js +1 -1
  279. package/dist/plane.js +8 -4
  280. package/dist/primitives/backgrounds.js +3 -3
  281. package/dist/primitives/captions.js +5 -5
  282. package/dist/primitives/effects.js +4 -4
  283. package/dist/primitives/hero-text.js +4 -4
  284. package/dist/primitives/layouts.js +4 -4
  285. package/dist/primitives/lib/easings.js +1 -1
  286. package/dist/primitives/lib/frameScale.js +1 -1
  287. package/dist/primitives/lib/index.js +7 -13
  288. package/dist/primitives/lib/palette.js +2 -2
  289. package/dist/primitives/lib/preview.js +1 -1
  290. package/dist/primitives/lib/schema.js +1 -1
  291. package/dist/primitives/lib/seeded-random.js +1 -1
  292. package/dist/primitives/lib/text/contrast.js +3 -3
  293. package/dist/primitives/lib/text/fill.js +1 -1
  294. package/dist/primitives/lib/text/fitText.js +1 -1
  295. package/dist/primitives/lib/text/marker.js +1 -1
  296. package/dist/primitives/lib/text/motion.js +1 -1
  297. package/dist/primitives/lib/text/recolor.js +1 -1
  298. package/dist/primitives/lib/text/stage.js +1 -1
  299. package/dist/primitives/lib/text/typeface.js +1 -1
  300. package/dist/primitives/lib/tokens.js +4 -11
  301. package/dist/primitives/lib.js +7 -13
  302. package/dist/primitives/scenes.js +5 -5
  303. package/dist/primitives/subject-foreground.js +1 -1
  304. package/dist/primitives/text.js +4 -4
  305. package/dist/primitives/transitions.js +3 -3
  306. package/dist/primitives/ui-blocks.js +5 -5
  307. package/dist/primitives/workspace.js +1 -1
  308. package/dist/primitives.js +18 -32
  309. package/dist/render-harness/cardAssetAdmission.js +4 -4
  310. package/dist/render-harness/cardFonts.js +3 -3
  311. package/dist/render-harness/renderInputAssets.js +4 -4
  312. package/dist/render-harness.js +100 -82
  313. package/dist/src-XI5MULKD.js +71 -0
  314. package/package.json +51 -61
  315. package/dist/_members/account-model/validators/workingComposition.d.ts +0 -11
  316. package/dist/_members/animate/animations/index.d.ts +0 -9
  317. package/dist/_members/animate/easing/index.d.ts +0 -3
  318. package/dist/_members/animate/mobjects/index.d.ts +0 -4
  319. package/dist/_members/animate/scene/internal.d.ts +0 -29
  320. package/dist/_members/authoring/prompts/graphics.d.ts +0 -9
  321. package/dist/_members/cloud-import/cloudConfig.d.ts +0 -2
  322. package/dist/_members/composition/autozoom/index.d.ts +0 -25
  323. package/dist/_members/composition/graphics-plan/instantiateMotif.d.ts +0 -34
  324. package/dist/_members/composition/invariants/time.d.ts +0 -14
  325. package/dist/_members/composition/types/index.d.ts +0 -8
  326. package/dist/_members/composition/validators/font.d.ts +0 -58
  327. package/dist/_members/composition/validators/registry.d.ts +0 -79
  328. package/dist/_members/composition/validators/render.d.ts +0 -2068
  329. package/dist/_members/director/ai-sdk/chunks.d.ts +0 -14
  330. package/dist/_members/director/domain/ports.d.ts +0 -32
  331. package/dist/_members/director/testing/contract.d.ts +0 -52
  332. package/dist/_members/director/testing/index.d.ts +0 -1
  333. package/dist/_members/foundation/codes/index.d.ts +0 -10
  334. package/dist/_members/nle-export/server/index.d.ts +0 -1
  335. package/dist/_members/nle-export/server/pack-zip.d.ts +0 -6
  336. package/dist/_members/render-harness/assetRefs.d.ts +0 -26
  337. package/dist/_members/render-harness/assetRefs.d.ts.map +0 -1
  338. package/dist/_members/render-harness/remotion-runtime.d.ts +0 -87
  339. package/dist/authoring/build-tools.d.ts +0 -1
  340. package/dist/authoring/build-tools.js +0 -27
  341. package/dist/authoring/capabilities.d.ts +0 -1
  342. package/dist/authoring/capabilities.js +0 -11
  343. package/dist/authoring/pipelineTrace.d.ts +0 -1
  344. package/dist/authoring/pipelineTrace.js +0 -7
  345. package/dist/authoring/tools.d.ts +0 -1
  346. package/dist/authoring/tools.js +0 -30
  347. package/dist/chunk-AXRSCHQX.js +0 -661
  348. package/dist/chunk-DV7ZFVL4.js +0 -116
  349. package/dist/chunk-GF52TW4I.js +0 -51
  350. package/dist/chunk-JOURGVOR.js +0 -27
  351. package/dist/chunk-LBN5KQC6.js +0 -384
  352. package/dist/chunk-OSMXQV5V.js +0 -18
  353. package/dist/chunk-QDBVYZSF.js +0 -128
  354. package/dist/chunk-RERR5JLM.js +0 -197
  355. package/dist/chunk-U3JPILZS.js +0 -15
  356. package/dist/chunk-Y4HPN4BC.js +0 -364
  357. package/dist/composition/autozoom.d.ts +0 -1
  358. package/dist/composition/autozoom.js +0 -76
  359. package/dist/composition/fixtures.d.ts +0 -1
  360. package/dist/composition/fixtures.js +0 -154
  361. package/dist/composition/types.d.ts +0 -1
  362. package/dist/composition/types.js +0 -0
  363. package/dist/context-6HPUO36M.js +0 -15
  364. package/dist/director/testing.d.ts +0 -1
  365. package/dist/director/testing.js +0 -22
  366. package/dist/foundation/codes.d.ts +0 -1
  367. package/dist/foundation/codes.js +0 -7
  368. package/dist/nle-export/server.d.ts +0 -1
  369. package/dist/nle-export/server.js +0 -25856
  370. /package/dist/{chunk-FTVZF4GO.js → chunk-S432RE6G.js} +0 -0
package/dist/authoring.js CHANGED
@@ -4,64 +4,58 @@ import {
4
4
  hasSceneOp,
5
5
  isSceneOp,
6
6
  materializeSceneOpsCore
7
- } from "./chunk-N2OZDD44.js";
8
- import {
9
- ZERO_USAGE,
10
- buildDirectorTools,
11
- buildPlannerTools,
12
- buildToolsFromSchemas,
13
- extractProviderError
14
- } from "./chunk-RERR5JLM.js";
15
- import {
16
- COMPOSE_MOTION_TOOLS,
17
- COMPOSE_MOTION_VERIFY_TOOLS,
18
- COMPOSE_PLANNER_REPAIR_TOOLS,
19
- COMPOSE_PLANNER_TOOLS,
20
- COMPOSE_ROLE_TOOLS,
21
- COMPOSE_ROLE_TOOL_NAMES,
22
- dispatchComposeRoleTool
23
- } from "./chunk-LBN5KQC6.js";
24
- import {
25
- AgentFixableCaptureError,
26
- getExcludedTools
27
- } from "./chunk-JOURGVOR.js";
7
+ } from "./chunk-6HA55CRU.js";
28
8
  import {
29
9
  buildDirectorContext
30
- } from "./chunk-UMXES6ED.js";
10
+ } from "./chunk-LVMWPFV4.js";
31
11
  import {
32
12
  buildFastModel,
33
13
  buildModel,
34
14
  makeLangfuseFetch
35
- } from "./chunk-GCQ7Z7S7.js";
15
+ } from "./chunk-KKATUGRU.js";
16
+ import "./chunk-CIOUDOGN.js";
36
17
  import {
37
- PipelineTrace
38
- } from "./chunk-GF52TW4I.js";
18
+ MOTION_PRESETS,
19
+ MotionPresetError,
20
+ generateMotionShell,
21
+ hasMotionPresetOp,
22
+ isMotionPresetOp,
23
+ materializeMotionPresetOpsCore,
24
+ resolveMotionPresetCard
25
+ } from "./chunk-RR7UBEBV.js";
39
26
  import {
40
- CODE_GEN_FEW_SHOT_EXAMPLES,
41
- COMPONENT_CONTRACT,
42
- DESIGN_QUALITY_RULES,
43
27
  EVALUATOR_PROMPT,
44
28
  PLANNING_INSTRUCTIONS,
45
- TOOLKIT_REFERENCE,
46
29
  buildExecutionTask,
47
30
  buildPlannerUserMessage,
48
- formatPlanSteps,
49
- initCodeGenPrompts
50
- } from "./chunk-Y4HPN4BC.js";
51
- import "./chunk-7AZLFN26.js";
52
- import "./chunk-LBJ5LI5V.js";
53
- import "./chunk-AXRSCHQX.js";
54
- import "./chunk-UFD4EZHM.js";
31
+ formatPlanSteps
32
+ } from "./chunk-VBYINB74.js";
33
+ import {
34
+ canonicalJson
35
+ } from "./chunk-XHMKPTHV.js";
36
+ import {
37
+ getPrimitiveSubtextParam,
38
+ getPrimitiveTextParam
39
+ } from "./chunk-EISHFHU5.js";
40
+ import {
41
+ selectAllOverlays
42
+ } from "./chunk-2K2GBFLU.js";
43
+ import {
44
+ ComposePlan
45
+ } from "./chunk-ZCEYEIRB.js";
46
+ import "./chunk-6KZCXAYL.js";
47
+ import {
48
+ OverlayClipSource
49
+ } from "./chunk-AFUITAH6.js";
55
50
  import "./chunk-WPZKOVYF.js";
56
51
  import "./chunk-B7J5UUUV.js";
57
- import "./chunk-KYRDKK2D.js";
58
- import "./chunk-MZB4ZXYW.js";
59
- import {
60
- cssLayoutVars
61
- } from "./chunk-DKBFAQCW.js";
52
+ import "./chunk-EQH37KNZ.js";
53
+ import "./chunk-Q6CJ6HCU.js";
62
54
  import "./chunk-WREYUH2E.js";
55
+ import "./chunk-IVFMOHAC.js";
56
+ import "./chunk-DKBFAQCW.js";
63
57
  import "./chunk-ILO4NEZ3.js";
64
- import "./chunk-E63UEO5C.js";
58
+ import "./chunk-XQGQ5EFS.js";
65
59
  import "./chunk-7PA7FGLD.js";
66
60
  import "./chunk-VG2ND6PX.js";
67
61
  import {
@@ -70,11 +64,522 @@ import {
70
64
  } from "./chunk-CL5Y6V6K.js";
71
65
  import "./chunk-2L7PYYJK.js";
72
66
  import "./chunk-OOL7ZUG7.js";
73
- import "./chunk-2ESYSVXG.js";
67
+ import "./chunk-U67V476Y.js";
74
68
 
75
69
  // ../authoring/src/agent.ts
76
70
  import { ToolLoopAgent, generateText, isStepCount } from "ai";
77
71
 
72
+ // ../authoring/src/capabilities.ts
73
+ var AgentFixableCaptureError = class extends Error {
74
+ agentFixable = true;
75
+ constructor(message) {
76
+ super(message);
77
+ this.name = "AgentFixableCaptureError";
78
+ }
79
+ };
80
+ var CAPABILITY_GATED_TOOLS = Object.freeze({
81
+ capture_frames: "capture",
82
+ score_composition: "verify",
83
+ apply_motion_preset: "motionPreset",
84
+ search_library: "resources"
85
+ });
86
+ function getExcludedTools(capabilities) {
87
+ const ex = /* @__PURE__ */ new Set();
88
+ for (const [tool2, cap] of Object.entries(CAPABILITY_GATED_TOOLS)) {
89
+ if (!capabilities[cap]) ex.add(tool2);
90
+ }
91
+ return ex;
92
+ }
93
+
94
+ // ../authoring/src/agent/buildTools.ts
95
+ import { tool } from "ai";
96
+
97
+ // ../authoring/src/tools/toolSets.ts
98
+ var COMPOSE_PLANNER_TOOLS = [
99
+ "get_context",
100
+ "get_word_timings",
101
+ "search_library",
102
+ "capture_frames",
103
+ "submit_compose_plan"
104
+ ];
105
+ var COMPOSE_PLANNER_REPAIR_TOOLS = [
106
+ "get_context",
107
+ "get_word_timings",
108
+ "search_library",
109
+ "capture_frames",
110
+ "amend_compose_plan"
111
+ ];
112
+ var COMPOSE_MOTION_TOOLS = [
113
+ "get_context",
114
+ "get_word_timings",
115
+ "inspect_overlay",
116
+ "capture_frames",
117
+ "update_overlay",
118
+ "apply_motion_preset",
119
+ "score_composition"
120
+ ];
121
+ var COMPOSE_MOTION_VERIFY_TOOLS = COMPOSE_MOTION_TOOLS.filter(
122
+ (t) => t !== "update_overlay" && t !== "apply_motion_preset"
123
+ );
124
+
125
+ // ../authoring/src/tools/composeRoleTools.ts
126
+ import { z } from "zod";
127
+ function overlayViews(capabilities) {
128
+ return selectAllOverlays(capabilities.composition.getState().composition).flatMap(
129
+ (o) => o.source.kind === "overlay" ? [{
130
+ id: o.id,
131
+ template: o.source.primitiveId,
132
+ startTime: o.startTime,
133
+ duration: o.duration,
134
+ params: { ...o.source.params }
135
+ }] : []
136
+ );
137
+ }
138
+ var COMPOSE_ROLE_TOOLS = Object.freeze({
139
+ get_context: {
140
+ name: "get_context",
141
+ description: "Get current project state: transcript with word-level timings, clips on timeline, overlays, brand kit, imported assets, playhead time, timeline duration, and FPS. Always call this first.",
142
+ schema: z.object({}),
143
+ metadata: { label: "Get Context" },
144
+ handler: async (_args, capabilities) => {
145
+ const { buildDirectorContext: buildDirectorContext2 } = await import("./context-7SWSVJ6Z.js");
146
+ return buildDirectorContext2(capabilities);
147
+ }
148
+ },
149
+ get_word_timings: {
150
+ name: "get_word_timings",
151
+ description: "Get precise word-level timestamps for a section of the transcript. Call this BEFORE you name a cut range, so the range lands on real word boundaries instead of a rounded guess. On the library page, pass poolItemId to read a specific media item.",
152
+ schema: z.object({
153
+ startTime: z.coerce.number().min(0).describe("Start of time range in seconds"),
154
+ endTime: z.coerce.number().min(0).describe("End of time range in seconds"),
155
+ poolItemId: z.string().optional().describe("Pool item ID to read. If omitted, reads the current timeline transcript.")
156
+ }),
157
+ metadata: { label: "Get Word Timings" },
158
+ inputExamples: [{ input: { startTime: 12, endTime: 15 } }],
159
+ handler: async (args, capabilities) => {
160
+ const startTime = args.startTime;
161
+ const endTime = args.endTime;
162
+ if (endTime <= startTime) {
163
+ return { error: `Invalid range: endTime (${endTime}) must be greater than startTime (${startTime})` };
164
+ }
165
+ return capabilities.transcript.getWordTimings(startTime, endTime);
166
+ }
167
+ },
168
+ inspect_overlay: {
169
+ name: "inspect_overlay",
170
+ description: "Retrieve the full details of an existing overlay, including its JSX source code. Use this to inspect fonts, colors, animations, or any implementation detail of a placed overlay.",
171
+ schema: z.object({
172
+ id: z.string().describe("The ID of the overlay to inspect")
173
+ }),
174
+ metadata: { label: "Inspect Overlay" },
175
+ strict: true,
176
+ handler: async (args, capabilities) => {
177
+ const overlay = overlayViews(capabilities).find((o) => o.id === args.id);
178
+ if (!overlay) return { error: `Overlay ${args.id} not found` };
179
+ const lines = [
180
+ `Overlay ${overlay.id}:`,
181
+ ` template: ${overlay.template}`,
182
+ ` startTime: ${overlay.startTime}s`,
183
+ ` duration: ${overlay.duration}s`,
184
+ ` text: "${overlay.params.text}"`
185
+ ];
186
+ if (overlay.params.subtext) lines.push(` subtext: "${overlay.params.subtext}"`);
187
+ if (overlay.params.position) lines.push(` position: ${overlay.params.position}`);
188
+ if (overlay.params.accentColor) lines.push(` accentColor: ${overlay.params.accentColor}`);
189
+ if (overlay.params.transition) lines.push(` transition: ${overlay.params.transition}`);
190
+ if (overlay.params.sequenceGroup) lines.push(` sequenceGroup: ${overlay.params.sequenceGroup}`);
191
+ if (overlay.params.jsxSource) {
192
+ lines.push(`
193
+ Source code:
194
+ ${overlay.params.jsxSource}`);
195
+ } else {
196
+ lines.push(`
197
+ (No custom source code \u2014 uses built-in template rendering)`);
198
+ }
199
+ return lines.join("\n");
200
+ }
201
+ },
202
+ update_overlay: {
203
+ name: "update_overlay",
204
+ description: "Update properties of an existing motion graphic overlay. Only include the fields you want to change. Provide authored jsxSource to re-generate a custom component.",
205
+ schema: z.object({
206
+ id: z.string().min(1).describe("The overlay clip ID (a UUID). Use the exact id inspect_overlay reports \u2014 never fabricate IDs."),
207
+ startTime: z.coerce.number().min(0).optional().describe("New start time in seconds"),
208
+ duration: z.coerce.number().min(0.5).max(60).optional().describe("New duration in seconds"),
209
+ text: z.string().min(1).max(200).optional().describe("New primary text"),
210
+ subtext: z.string().max(200).optional().describe("New secondary text"),
211
+ position: z.string().optional().transform((v) => {
212
+ if (!v) return v;
213
+ const match = v.match(/(left|center|right)/i);
214
+ return match ? match[1].toLowerCase() : "center";
215
+ }),
216
+ accentColor: z.string().regex(/^#[0-9a-fA-F]{3,8}$/, "Must be a hex color (e.g., #D4AF37)").optional().describe("New accent color as hex"),
217
+ textColor: z.string().regex(/^#[0-9a-fA-F]{3,8}$/, "Must be a hex color").optional().describe("New text color as hex"),
218
+ fontFamily: z.string().optional().describe("New font family"),
219
+ backgroundColor: z.string().regex(/^#[0-9a-fA-F]{3,8}$/, "Must be a hex color").optional().describe("New background color as hex"),
220
+ jsxSource: z.string().max(5e4).optional().describe("New canonical TSX module source for the overlay"),
221
+ transition: z.enum(["fade", "slide", "wipe", "none"]).optional().describe("New transition type"),
222
+ sequenceGroup: z.string().optional().describe("New sequence group ID"),
223
+ primitiveId: z.string().optional().describe(
224
+ 'Switch the overlay to a different primitive component ID (e.g. "lower-third", "heroText"). Omit to keep the current primitive.'
225
+ ),
226
+ params: z.record(z.string(), z.unknown()).optional().describe(
227
+ "Per-primitive params bag to merge over the overlay\u2019s existing params. Only the keys you set change; existing params are preserved."
228
+ ),
229
+ zPlane: OverlayClipSource.shape.zPlane.describe(
230
+ 'Depth plane. "front" renders over the video; "behind-subject" renders UNDER the subject cut-out (the launch-video hero-text look). Omit to keep the overlay\u2019s current plane.'
231
+ ),
232
+ parallax: OverlayClipSource.shape.parallax.describe(
233
+ "Depth parallax for a behind-subject overlay (differential motion vs the camera; 0 locks to the scene). Omit to keep the current value."
234
+ ),
235
+ anchor: z.object({
236
+ x: z.number().min(0).max(1).describe("Horizontal anchor, source-normalized [0,1]."),
237
+ y: z.number().min(0).max(1).describe("Vertical anchor, source-normalized [0,1].")
238
+ }).optional().describe(
239
+ "Durable scene-space anchor for a behind-subject overlay. Omit to keep the system-placed (or previously set) anchor."
240
+ )
241
+ }),
242
+ metadata: { label: "Update Overlay" },
243
+ inputExamples: [
244
+ { input: { id: "abc-123", text: "Updated Title", accentColor: "#6366f1" } },
245
+ { input: { id: "def-456", startTime: 10, duration: 5, jsxSource: "export default function..." } },
246
+ { input: { id: "ghi-789", zPlane: "behind-subject", anchor: { x: 0.5, y: 0.4 }, parallax: 0.1 } }
247
+ ],
248
+ handler: async (args, capabilities) => {
249
+ const composition = capabilities.composition.getState().composition;
250
+ const allOverlays = selectAllOverlays(composition);
251
+ const existingClip = allOverlays.find((o) => o.id === args.id);
252
+ if (!existingClip || existingClip.source.kind !== "overlay") {
253
+ const valid = allOverlays.filter((o) => o.source.kind === "overlay").map((o) => `'${o.id}'`);
254
+ return {
255
+ error: `Overlay ${args.id} not found. ` + (valid.length > 0 ? `Overlay clip ids in this composition: ${valid.join(", ")}.` : `This composition has no overlay clips.`)
256
+ };
257
+ }
258
+ const existingSource = existingClip.source;
259
+ const updates = {};
260
+ if (args.startTime != null) updates.startTime = args.startTime;
261
+ if (args.duration != null) updates.duration = args.duration;
262
+ const existingTemplate = existingSource.primitiveId;
263
+ if (args.text != null && existingTemplate) {
264
+ if (getPrimitiveTextParam(existingTemplate) === null) {
265
+ return { error: `Overlay template "${existingTemplate}" does not accept a text payload.` };
266
+ }
267
+ }
268
+ if (args.subtext != null && existingTemplate) {
269
+ if (getPrimitiveSubtextParam(existingTemplate) === null) {
270
+ return { error: `Overlay template "${existingTemplate}" does not accept a subtext payload.` };
271
+ }
272
+ }
273
+ const newParams = {
274
+ ...existingSource.params,
275
+ ...args.params ?? {}
276
+ };
277
+ if (args.text != null) newParams.text = args.text;
278
+ if (args.subtext != null) newParams.subtext = args.subtext;
279
+ if (args.accentColor != null) newParams.accentColor = args.accentColor;
280
+ if (args.textColor != null) newParams.textColor = args.textColor;
281
+ if (args.backgroundColor != null) newParams.backgroundColor = args.backgroundColor;
282
+ if (args.fontFamily != null) newParams.fontFamily = args.fontFamily;
283
+ if (args.position != null) newParams.position = args.position;
284
+ if (args.transition != null) newParams.transition = args.transition;
285
+ if (args.sequenceGroup != null) newParams.sequenceGroup = args.sequenceGroup;
286
+ const jsxSource = args.jsxSource;
287
+ let primitiveId = args.primitiveId ?? existingTemplate;
288
+ if (jsxSource) {
289
+ newParams.jsxSource = jsxSource;
290
+ newParams.componentManifest ??= {
291
+ version: 2,
292
+ assets: {},
293
+ graphics: { api: "canvas2d", required: true, accelerationPreference: "software-allowed" },
294
+ alphaPolicy: "requires-transparency"
295
+ };
296
+ primitiveId = "custom";
297
+ }
298
+ const newSource = { ...existingSource, primitiveId, params: newParams };
299
+ if (args.zPlane != null) newSource.zPlane = args.zPlane;
300
+ if (args.parallax != null) newSource.parallax = args.parallax;
301
+ if (args.anchor != null) {
302
+ const a = args.anchor;
303
+ newSource.anchor = { space: "scene", x: a.x, y: a.y };
304
+ }
305
+ updates.source = newSource;
306
+ capabilities.composition.updateOverlay(args.id, updates);
307
+ return { success: true, message: `Updated overlay ${args.id}` };
308
+ }
309
+ },
310
+ capture_frames: {
311
+ name: "capture_frames",
312
+ description: "Capture rendered video frames at specific frame numbers for visual verification. Returns base64 JPEG images. Call this after creating/updating overlays to verify they look correct.",
313
+ schema: z.object({
314
+ frames: z.array(z.coerce.number().int().min(0)).min(1).max(4).describe("Frame numbers to capture (max 4)")
315
+ }),
316
+ metadata: { label: "Capture Frames", imageResponse: true, dedupExempt: true },
317
+ handler: async (args, capabilities) => {
318
+ if (!capabilities.capture) return { error: "Frame capture not available." };
319
+ const MAX_RETRIES = 2;
320
+ let lastErr;
321
+ for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
322
+ try {
323
+ if (attempt > 0) {
324
+ console.info("[compose-role-tools] Retrying capture_frames", {
325
+ attempt,
326
+ cause: lastErr instanceof Error ? lastErr.message.slice(0, 300) : String(lastErr).slice(0, 300)
327
+ });
328
+ await new Promise((r) => setTimeout(r, 500 * attempt));
329
+ }
330
+ return await capabilities.capture.captureFrames(args.frames);
331
+ } catch (err) {
332
+ if (err instanceof AgentFixableCaptureError) return { error: err.message };
333
+ lastErr = err;
334
+ }
335
+ }
336
+ return {
337
+ error: `capture_frames failed after ${MAX_RETRIES + 1} attempts: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}. You are now BLIND \u2014 you cannot see what you are authoring. Do not keep editing on guesswork; this run will be failed.`
338
+ };
339
+ }
340
+ },
341
+ score_composition: {
342
+ name: "score_composition",
343
+ description: "Score the CURRENT composition against the CueFrame quality rubric (editorial, spatial, brand, caption). Renders the meaningful beats, runs the vision judge, and returns per-criterion scores (0\u201310) plus the single weakest criterion to fix next. This is your OBJECTIVE check on whether the cut is good enough \u2014 use it instead of judging from your own eyes. Call it before finalizing, and after a fix to confirm the score moved.",
344
+ schema: z.object({}),
345
+ metadata: { label: "Score Composition", dedupExempt: true },
346
+ toModelOutput: (result) => ({ type: "text", value: result.slice(0, 1200) }),
347
+ handler: async (_args, capabilities) => {
348
+ if (!capabilities.verify) return { error: "Composition scoring not available." };
349
+ return await capabilities.verify.verify();
350
+ }
351
+ },
352
+ apply_motion_preset: {
353
+ name: "apply_motion_preset",
354
+ description: "Apply a vetted motion preset to a STATIC card clip: the approved layout is carried verbatim; only entrance/hold/exit animate. Presets: fade-up (calm default) | slide-in-left | slide-in-right (directional) | scale-pop (punchy stat) | stagger-reveal (enumerations \u2014 needs a [data-stagger] container in the markup). Library overlays already animate \u2014 tune their params/timing with update_overlay instead; custom components already carry their authored motion.",
355
+ schema: z.object({
356
+ clipId: z.string().min(1).describe("The card clip to animate (its id in the working composition)."),
357
+ preset: z.enum(["fade-up", "slide-in-left", "slide-in-right", "scale-pop", "stagger-reveal"]),
358
+ enterMs: z.number().int().min(80).max(1200).optional().describe("Entrance duration; default 300."),
359
+ exitMs: z.number().int().min(80).max(1200).optional().describe("Exit duration (completes at clip end); default 300."),
360
+ staggerMs: z.number().int().min(40).max(400).optional().describe("stagger-reveal only: per-child delay; default 120.")
361
+ }),
362
+ metadata: { label: "Apply Motion Preset", dedupExempt: true },
363
+ handler: async (args, capabilities) => {
364
+ if (!capabilities.motionPreset) return { error: "Motion presets not available." };
365
+ return await capabilities.motionPreset.apply(
366
+ args
367
+ );
368
+ }
369
+ },
370
+ search_library: {
371
+ name: "search_library",
372
+ description: 'Search across all media in the library. Combines transcript text search (fast, exact match) with semantic scene search (CLIP text-to-image similarity). Use for questions like "find clips about pricing" or "find scenes with mountains".',
373
+ schema: z.object({
374
+ query: z.string().min(1).describe("Search query \u2014 a word/phrase or a visual concept")
375
+ }),
376
+ metadata: { label: "Search Library" },
377
+ inputExamples: [{ input: { query: "pricing discussion" } }],
378
+ handler: async (args, capabilities) => {
379
+ const searchFn = capabilities.resources?.searchLibrary;
380
+ if (!searchFn) return { error: "Library search not available. Configure a resource provider." };
381
+ try {
382
+ const results = await searchFn(args.query);
383
+ if (!Array.isArray(results)) {
384
+ return {
385
+ error: `Library search returned ${results === null ? "null" : typeof results}, not the candidate array this lane expects. The compose capability contract is an array of {mediaId, kind, provider, query, \u2026} \u2014 see composeCapabilities.ts.`
386
+ };
387
+ }
388
+ const candidates = results;
389
+ if (candidates.length === 0) return "No enrichment candidates available for this clip.";
390
+ const lines = [
391
+ `Enrichment candidate pool (${candidates.length} item${candidates.length === 1 ? "" : "s"}, pre-curated by upstream relevance gate):`
392
+ ];
393
+ for (const c of candidates) {
394
+ const score = typeof c.relevanceScore === "number" ? ` (${c.relevanceScore.toFixed(1)}/10)` : "";
395
+ const dim = c.width && c.height ? ` ${c.width}x${c.height}` : "";
396
+ const dur = c.duration ? `${c.duration.toFixed(1)}s` : "?s";
397
+ const reason = c.relevanceReason ? `
398
+ \u2192 ${c.relevanceReason}` : "";
399
+ lines.push(` [${c.mediaId}] ${c.kind}/${c.provider}: "${c.query}" ${dur}${dim}${score}${reason}`);
400
+ }
401
+ return lines.join("\n");
402
+ } catch (err) {
403
+ return { error: `Library search failed: ${err instanceof Error ? err.message : String(err)}` };
404
+ }
405
+ }
406
+ },
407
+ submit_compose_plan: {
408
+ name: "submit_compose_plan",
409
+ description: "Submit the FULL compose plan \u2014 framing per beat (frame or trim), pacing cuts, caption style intent, asset requests (resolved from the pool), graphics/hero beats, markers. Call exactly once at the end of planning. The plan is validated and then LOCKED for execution.",
410
+ schema: ComposePlan,
411
+ metadata: { label: "Submit Compose Plan" },
412
+ strict: true,
413
+ handler: async (args, capabilities) => {
414
+ if (!capabilities.planSink) {
415
+ return { error: "submit_compose_plan is only available in the planning phase." };
416
+ }
417
+ capabilities.planSink.submit(args);
418
+ return "Plan received. Planning phase complete \u2014 stop here.";
419
+ }
420
+ },
421
+ amend_compose_plan: {
422
+ name: "amend_compose_plan",
423
+ description: "REPAIR the current plan with targeted ops \u2014 you CANNOT resubmit the whole plan in repair mode. Emit ONLY ops for the sections the errors name; every other section is preserved by the system exactly as-is. Ops: framing.set/cuts.set/captions.set/markers.set (replace that whole section), graphics.add|update|remove and assets.add|update|remove (address ONE element by its exact id \u2014 ids are stable addresses; never invent or renumber them). One logical fix per op.",
424
+ schema: z.object({
425
+ ops: z.array(z.object({ type: z.string().min(1) }).passthrough()).min(1).max(20).describe(
426
+ "Amendment ops. The worker validates each op against the canonical PlanOp union and rejects the whole batch on any invalid op (atomic)."
427
+ )
428
+ }),
429
+ metadata: { label: "Amend Compose Plan" },
430
+ handler: async (args, capabilities) => {
431
+ if (!capabilities.planSink) {
432
+ return { error: "amend_compose_plan is only available in the planning phase." };
433
+ }
434
+ capabilities.planSink.submit({ __planOps: args.ops });
435
+ return "Amendment ops received. Repair round complete \u2014 stop here.";
436
+ }
437
+ }
438
+ });
439
+ var COMPOSE_ROLE_TOOL_NAMES = Object.keys(COMPOSE_ROLE_TOOLS);
440
+ async function dispatchComposeRoleTool(toolName, args, capabilities, opts) {
441
+ const entry = COMPOSE_ROLE_TOOLS[toolName];
442
+ if (!entry) {
443
+ return {
444
+ error: `Unknown tool: ${toolName}. This lane serves ${COMPOSE_ROLE_TOOL_NAMES.join(", ")} \u2014 every other verb moved to the curated /v1 surface.`
445
+ };
446
+ }
447
+ const result = entry.schema.safeParse(args);
448
+ if (!result.success) {
449
+ const issues = result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ");
450
+ return { error: `Invalid tool arguments: ${issues}` };
451
+ }
452
+ return entry.handler(result.data, capabilities, opts);
453
+ }
454
+
455
+ // ../authoring/src/agent/buildTools.ts
456
+ function formatToolResult(name, result) {
457
+ if (!COMPOSE_ROLE_TOOLS[name]?.metadata.imageResponse) {
458
+ return typeof result === "string" ? result : JSON.stringify(result);
459
+ }
460
+ if (Array.isArray(result)) {
461
+ const images = result;
462
+ return {
463
+ type: "content",
464
+ value: images.map((b64) => ({
465
+ type: "image-data",
466
+ mediaType: "image/jpeg",
467
+ data: b64
468
+ }))
469
+ };
470
+ }
471
+ return typeof result === "string" ? result : JSON.stringify(result);
472
+ }
473
+ var DEDUP_MAX = 3;
474
+ function makeCallKey(name, args) {
475
+ return `${name}:${canonicalJson(args)}`;
476
+ }
477
+ var APPROVAL_TIMEOUT_MS = 2 * 60 * 1e3;
478
+ function buildToolsFromSchemas(params) {
479
+ const capabilities = params.capabilities;
480
+ const toolOpts = {
481
+ ...params.toolOptions ?? {},
482
+ ...params.cachedContext ? { cachedContext: params.cachedContext } : {},
483
+ onProgress: params.onProgress
484
+ };
485
+ const recentCalls = /* @__PURE__ */ new Map();
486
+ const tools = {};
487
+ for (const [name, schema] of Object.entries(COMPOSE_ROLE_TOOLS)) {
488
+ if (params.allowedTools && !params.allowedTools.includes(name)) continue;
489
+ const meta = schema.metadata;
490
+ const needsApproval = params.approvalRequired?.has(name) ?? false;
491
+ tools[name] = tool({
492
+ description: schema.description,
493
+ inputSchema: schema.schema,
494
+ execute: async (args) => {
495
+ const toolCallId = `tc_${crypto.randomUUID().slice(0, 8)}`;
496
+ if (!meta.dedupExempt) {
497
+ const callKey = makeCallKey(name, args);
498
+ const callCount = (recentCalls.get(callKey) ?? 0) + 1;
499
+ recentCalls.set(callKey, callCount);
500
+ if (callCount >= DEDUP_MAX) {
501
+ const msg = `Tool "${name}" called ${callCount} times with identical arguments. This looks like a loop \u2014 try a different approach or different arguments.`;
502
+ params.onProgress({
503
+ type: "tool-result",
504
+ agent: "router",
505
+ toolName: name,
506
+ success: false,
507
+ message: msg,
508
+ toolCallId,
509
+ timestamp: Date.now()
510
+ });
511
+ return JSON.stringify({ error: msg });
512
+ }
513
+ }
514
+ params.onProgress({
515
+ type: "tool-call",
516
+ agent: "router",
517
+ toolName: name,
518
+ args,
519
+ toolCallId,
520
+ timestamp: Date.now()
521
+ });
522
+ if (needsApproval && params.requestApproval) {
523
+ const approved = await Promise.race([
524
+ params.requestApproval(toolCallId, name, args),
525
+ new Promise(
526
+ (resolve) => setTimeout(() => resolve(false), APPROVAL_TIMEOUT_MS)
527
+ )
528
+ ]);
529
+ if (!approved) {
530
+ const msg = "User denied this tool call (or approval timed out).";
531
+ params.onProgress({
532
+ type: "tool-result",
533
+ agent: "router",
534
+ toolName: name,
535
+ success: false,
536
+ message: msg,
537
+ toolCallId,
538
+ timestamp: Date.now()
539
+ });
540
+ return JSON.stringify({ error: msg });
541
+ }
542
+ }
543
+ try {
544
+ const result = await dispatchComposeRoleTool(name, args, capabilities, toolOpts);
545
+ params.onProgress({
546
+ type: "tool-result",
547
+ agent: "router",
548
+ toolName: name,
549
+ success: true,
550
+ message: typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200),
551
+ toolCallId,
552
+ timestamp: Date.now()
553
+ });
554
+ return result;
555
+ } catch (err) {
556
+ const errMsg = err instanceof Error ? err.message : String(err);
557
+ params.onProgress({
558
+ type: "tool-result",
559
+ agent: "router",
560
+ toolName: name,
561
+ success: false,
562
+ message: errMsg,
563
+ toolCallId,
564
+ timestamp: Date.now()
565
+ });
566
+ return JSON.stringify({ error: errMsg });
567
+ }
568
+ },
569
+ toModelOutput: ({ output }) => {
570
+ const formatted = formatToolResult(name, output);
571
+ return typeof formatted === "string" ? { type: "text", value: formatted } : formatted;
572
+ }
573
+ });
574
+ }
575
+ return tools;
576
+ }
577
+ var buildDirectorTools = buildToolsFromSchemas;
578
+ var buildPlannerTools = (p) => {
579
+ const { toolNames = COMPOSE_PLANNER_TOOLS, ...rest } = p;
580
+ return buildToolsFromSchemas({ ...rest, allowedTools: [...toolNames] });
581
+ };
582
+
78
583
  // ../authoring/src/agent/contextManagement.ts
79
584
  import { pruneMessages } from "ai";
80
585
  var EVICTED_IMAGE_STUB = "[capture still evicted to save context \u2014 the frame was seen and acted on; re-capture ONLY if you must re-verify pixels]";
@@ -157,16 +662,71 @@ var cachePrepareStep = ({ model, messages }) => ({
157
662
  messages: isAnthropicModel(model) ? addCacheControlToLastMessage(messages) : messages
158
663
  });
159
664
 
665
+ // ../authoring/src/agent/errors.ts
666
+ import { APICallError, TypeValidationError } from "ai";
667
+ var BODY_EXCERPT = 200;
668
+ function providerMessage(responseBody) {
669
+ if (!responseBody) return void 0;
670
+ try {
671
+ const body = JSON.parse(responseBody);
672
+ const msg = body?.error?.message ?? body?.message;
673
+ return msg == null ? void 0 : String(msg);
674
+ } catch {
675
+ return void 0;
676
+ }
677
+ }
678
+ function bodyExcerpt(responseBody) {
679
+ const trimmed = responseBody?.trim();
680
+ if (!trimmed) return void 0;
681
+ return trimmed.replace(/\s+/g, " ").slice(0, BODY_EXCERPT);
682
+ }
683
+ function extractProviderError(err) {
684
+ if (APICallError.isInstance(err)) {
685
+ const status = err.statusCode;
686
+ if (status === 401 || status === 403) {
687
+ return "Authentication failed. Check your API key or gateway configuration in Settings.";
688
+ }
689
+ if (status === 429) {
690
+ return "API rate limit or quota exceeded. Try again later.";
691
+ }
692
+ const detail = providerMessage(err.responseBody);
693
+ if (status === 413 || status === 400) {
694
+ if (detail) return detail.slice(0, 200);
695
+ }
696
+ const where = status === void 0 ? "" : ` (HTTP ${status})`;
697
+ const evidence = detail ?? bodyExcerpt(err.responseBody);
698
+ return (evidence ? `${err.message}${where}: ${evidence}` : `${err.message}${where}`).slice(
699
+ 0,
700
+ 300
701
+ );
702
+ }
703
+ if (TypeValidationError.isInstance(err)) {
704
+ return "Invalid response from AI provider. The provider may be misconfigured or unavailable.";
705
+ }
706
+ const raw = err instanceof Error ? err.message : String(err);
707
+ if (raw.includes("API key not valid")) {
708
+ return "API key not valid. Check your gateway or provider configuration in Settings.";
709
+ }
710
+ return raw.slice(0, 300);
711
+ }
712
+ var ZERO_USAGE = {
713
+ inputTokens: 0,
714
+ outputTokens: 0,
715
+ totalTokens: 0,
716
+ inputTokenDetails: { noCacheTokens: void 0, cacheReadTokens: void 0, cacheWriteTokens: void 0 },
717
+ outputTokenDetails: { textTokens: void 0, reasoningTokens: void 0 }
718
+ };
719
+
160
720
  // ../authoring/src/evaluate.ts
161
721
  import { generateObject } from "ai";
162
- import { z } from "zod";
163
- var CriterionResultSchema = z.object({
164
- name: z.string(),
165
- passed: z.boolean(),
166
- feedback: z.string().optional()
722
+ import { z as z2 } from "zod";
723
+ var CriterionResultSchema = z2.object({
724
+ name: z2.string(),
725
+ passed: z2.boolean(),
726
+ feedback: z2.string().optional()
167
727
  });
168
- var CriteriaEvaluationSchema = z.object({
169
- criteria: z.array(CriterionResultSchema)
728
+ var CriteriaEvaluationSchema = z2.object({
729
+ criteria: z2.array(CriterionResultSchema)
170
730
  });
171
731
  var CRITERIA_EVALUATOR_PROMPT = `You are a strict QA evaluator. For each criterion you are given, determine whether the work passes or fails.
172
732
 
@@ -238,11 +798,11 @@ Above are ${frames.length} captured frames. Use them to evaluate visual criteria
238
798
 
239
799
  // ../authoring/src/evaluator.ts
240
800
  import { generateObject as generateObject2 } from "ai";
241
- import { z as z2 } from "zod";
242
- var EvaluationSchema = z2.object({
243
- scores: z2.record(z2.string(), z2.number()),
244
- critique: z2.string(),
245
- evidence: z2.array(z2.string())
801
+ import { z as z3 } from "zod";
802
+ var EvaluationSchema = z3.object({
803
+ scores: z3.record(z3.string(), z3.number()),
804
+ critique: z3.string(),
805
+ evidence: z3.array(z3.string())
246
806
  });
247
807
  var TIMELINE_RUBRIC = {
248
808
  dimensions: [
@@ -944,7 +1504,7 @@ ${body}`;
944
1504
 
945
1505
  // ../authoring/src/decomposer.ts
946
1506
  import { generateObject as generateObject3 } from "ai";
947
- import { z as z3 } from "zod";
1507
+ import { z as z4 } from "zod";
948
1508
 
949
1509
  // ../authoring/src/prompts/decomposerPrompt.ts
950
1510
  var DECOMPOSER_PROMPT = `You decompose video editing tasks into sequential phases.
@@ -977,13 +1537,13 @@ OUTPUT FORMAT (JSON only, no markdown):
977
1537
  Set evaluationPasses to 1 for timeline edits and scene compositions, 3 for artifacts (content gets more critique passes).`;
978
1538
 
979
1539
  // ../authoring/src/decomposer.ts
980
- var PhaseSchema = z3.object({
981
- phases: z3.array(z3.object({
982
- name: z3.string(),
983
- output: z3.enum(["timeline_edit", "artifact", "scene_composition"]).default("timeline_edit"),
984
- description: z3.string(),
985
- verificationCriteria: z3.array(z3.string()).default([]),
986
- evaluationPasses: z3.number().default(1)
1540
+ var PhaseSchema = z4.object({
1541
+ phases: z4.array(z4.object({
1542
+ name: z4.string(),
1543
+ output: z4.enum(["timeline_edit", "artifact", "scene_composition"]).default("timeline_edit"),
1544
+ description: z4.string(),
1545
+ verificationCriteria: z4.array(z4.string()).default([]),
1546
+ evaluationPasses: z4.number().default(1)
987
1547
  }))
988
1548
  });
989
1549
  var COMPLEX_KEYWORDS = /\b(workflow|produce|post-?produce|podcast|episode|batch|multi|series|sequence|blog|show.?notes|thumbnail|description)\b/i;
@@ -1027,177 +1587,63 @@ ${context}`,
1027
1587
  }
1028
1588
  }
1029
1589
 
1030
- // ../authoring/src/motion/shell.ts
1031
- var MOTION_PRESETS = [
1032
- "fade-up",
1033
- "slide-in-left",
1034
- "slide-in-right",
1035
- "scale-pop",
1036
- "stagger-reveal"
1037
- ];
1038
- var PRESET_FROM = {
1039
- "fade-up": { dx: 0, dy: 24, scale: 1 },
1040
- "slide-in-left": { dx: -48, dy: 0, scale: 1 },
1041
- "slide-in-right": { dx: 48, dy: 0, scale: 1 },
1042
- "scale-pop": { dx: 0, dy: 0, scale: 0.92 },
1043
- "stagger-reveal": { dx: 0, dy: 12, scale: 1 }
1044
- };
1045
- var PRESET_SUSTAIN = {
1046
- "fade-up": { dx: 0, dy: -6, scale: 0.012 },
1047
- "slide-in-left": { dx: 14, dy: 0, scale: 8e-3 },
1048
- "slide-in-right": { dx: -14, dy: 0, scale: 8e-3 },
1049
- "scale-pop": { dx: 0, dy: -4, scale: 0.012 },
1050
- "stagger-reveal": { dx: 0, dy: -4, scale: 0.01 }
1590
+ // ../authoring/src/pipelineTrace.ts
1591
+ var DEFAULT_LOGGER = {
1592
+ info: (msg, data) => console.info(`[pipeline-trace] ${msg}`, ...data ? [data] : []),
1593
+ warn: (msg, data) => console.warn(`[pipeline-trace] ${msg}`, ...data ? [data] : []),
1594
+ error: (msg, data) => console.error(`[pipeline-trace] ${msg}`, ...data ? [data] : []),
1595
+ debug: (msg, data) => console.debug(`[pipeline-trace] ${msg}`, ...data ? [data] : [])
1051
1596
  };
1052
- var POP_WOBBLE = { amp: 8e-3, tau: 0.45, hz: 1.8 };
1053
- var STAGGER_BREATHE = { amp: 2, periodS: 3.4, phase: 0.9 };
1054
- var MAX_STAGGER_CHILDREN = 8;
1055
- function generateMotionShell(cardHtml, opts) {
1056
- if (!cardHtml.trim()) throw new Error("generateMotionShell: empty card markup");
1057
- const enterMs = opts.enterMs ?? 300;
1058
- const exitMs = opts.exitMs ?? 300;
1059
- const staggerMs = opts.staggerMs ?? 120;
1060
- const from = PRESET_FROM[opts.preset];
1061
- if (!from) throw new Error(`generateMotionShell: unknown preset '${opts.preset}'`);
1062
- const sustain = PRESET_SUSTAIN[opts.preset];
1063
- const tokenVars = cssLayoutVars(opts.tokens, void 0);
1064
- const staggerBlock = opts.preset === "stagger-reveal" ? `
1065
- const staggerF = Math.max(1, Math.round((${staggerMs} / 1000) * fps));
1066
- const staggerRules = Array.from({ length: ${MAX_STAGGER_CHILDREN} }, (_, i) => {
1067
- const s = enterF + i * staggerF;
1068
- const o = interpolate(frame, [s, s + enterF], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' });
1069
- const breathe = ${STAGGER_BREATHE.amp} * Math.sin((tSec / ${STAGGER_BREATHE.periodS}) * Math.PI * 2 + i * ${STAGGER_BREATHE.phase});
1070
- return '[data-stagger] > *:nth-child(' + (i + 1) + ') { opacity: ' + o + '; translate: 0 ' + breathe.toFixed(3) + 'px; }';
1071
- }).join('\\n');` : "";
1072
- const staggerStyleEl = opts.preset === "stagger-reveal" ? `<style>{staggerRules}</style>` : "";
1073
- return `// generated by @cueframe/authoring generateMotionShell \u2014 preset: ${opts.preset}
1074
- import { Easing, interpolate, useCurrentFrame, useVideoConfig } from 'remotion';
1075
-
1076
- export default function CardMotionShell({ durationInFrames, params }) {
1077
- const frame = useCurrentFrame();
1078
- const { fps } = useVideoConfig();
1079
- const CARD_HTML = ${JSON.stringify(cardHtml)};
1080
- const enterF = Math.max(1, Math.round((${enterMs} / 1000) * fps));
1081
- const exitF = Math.max(1, Math.round((${exitMs} / 1000) * fps));
1082
- const enter = interpolate(frame, [0, enterF], [0, 1],
1083
- { easing: Easing.out(Easing.cubic), extrapolateLeft: 'clamp', extrapolateRight: 'clamp' });
1084
- const exit = interpolate(frame,
1085
- [Math.max(enterF + 1, durationInFrames - exitF), durationInFrames], [1, 0],
1086
- { easing: Easing.in(Easing.cubic), extrapolateLeft: 'clamp', extrapolateRight: 'clamp' });
1087
- const opacity = Math.min(enter, exit);
1088
- const hold = interpolate(frame, [enterF, durationInFrames], [0, 1],
1089
- { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' });
1090
- const tSec = Math.max(0, frame - enterF) / fps;
1091
- const wobble = ${opts.preset === "scale-pop" ? `${POP_WOBBLE.amp} * Math.exp(-tSec / ${POP_WOBBLE.tau}) * Math.sin(tSec * Math.PI * 2 * ${POP_WOBBLE.hz})` : "0"};
1092
- const dx = ${from.dx} * (1 - enter) + ${sustain.dx} * hold;
1093
- const dy = ${from.dy} * (1 - enter) + ${sustain.dy} * hold;
1094
- const scale = ${from.scale} + (1 - ${from.scale}) * enter + ${sustain.scale} * hold + wobble;${staggerBlock}
1095
- const TOKEN_VARS = ${JSON.stringify(tokenVars)};
1096
- return (
1097
- <div style={{ position: 'absolute', inset: 0, ...TOKEN_VARS,
1098
- opacity, transform: 'translate(' + dx + 'px,' + dy + 'px) scale(' + scale + ')' }}>
1099
- ${staggerStyleEl}<div style={{ width: '100%', height: '100%' }}
1100
- dangerouslySetInnerHTML={{ __html: CARD_HTML }} />
1101
- </div>
1102
- );
1103
- }
1104
- `;
1105
- }
1106
-
1107
- // ../authoring/src/motion/applyMotionPreset.ts
1108
- var MotionPresetError = class extends Error {
1109
- constructor(code, message, opIndex) {
1110
- super(message);
1111
- this.code = code;
1112
- this.opIndex = opIndex;
1113
- this.name = "MotionPresetError";
1597
+ var PipelineTrace = class {
1598
+ t0 = performance.now();
1599
+ openSpans = /* @__PURE__ */ new Map();
1600
+ spans = [];
1601
+ toolCallCount = 0;
1602
+ log;
1603
+ constructor(logger) {
1604
+ this.log = logger ?? DEFAULT_LOGGER;
1114
1605
  }
1115
- code;
1116
- opIndex;
1117
- };
1118
- function resolveMotionPresetCard(composition, input) {
1119
- if (!MOTION_PRESETS.includes(input.preset)) {
1120
- throw new MotionPresetError(
1121
- "motion_preset_unknown",
1122
- `unknown motion preset '${input.preset}' \u2014 pick one of: ${MOTION_PRESETS.join(", ")}`
1123
- );
1606
+ start(name) {
1607
+ this.openSpans.set(name, performance.now());
1124
1608
  }
1125
- const tracks = composition.tracks ?? [];
1126
- const sourced = tracks.flatMap((t) => t?.contents ?? []).filter((c) => !!c && typeof c === "object" && "source" in c && "id" in c);
1127
- const clip = sourced.find((c) => c.id === input.clipId);
1128
- if (!clip) {
1129
- const cards = sourced.filter((c) => c.source.kind === "card").map((c) => `'${c.id}'`);
1130
- throw new MotionPresetError(
1131
- "motion_preset_target_invalid",
1132
- `applyMotionPreset: no clip '${input.clipId}' in the composition. ` + (cards.length > 0 ? `Static card clip ids present: ${cards.join(", ")}.` : `No static card clips remain (already shelled or none authored).`)
1133
- );
1609
+ end(name) {
1610
+ const startMs = this.openSpans.get(name);
1611
+ if (startMs === void 0) return;
1612
+ this.openSpans.delete(name);
1613
+ this.spans.push({ name, startMs, endMs: performance.now() });
1134
1614
  }
1135
- if (clip.source.kind !== "card" || !clip.source.html) {
1136
- throw new MotionPresetError(
1137
- "motion_preset_target_invalid",
1138
- `applyMotionPreset targets only static card clips \u2014 clip '${input.clipId}' is '${clip.source.kind}'. Library overlays already move (update them directly); components already carry their authored motion.`
1139
- );
1615
+ recordToolCall() {
1616
+ this.toolCallCount++;
1140
1617
  }
1141
- return {
1142
- cardHtml: clip.source.html,
1143
- ...clip.source.tokens !== void 0 ? { tokens: clip.source.tokens } : {},
1144
- ...clip.source.zPlane !== void 0 ? { zPlane: clip.source.zPlane } : {}
1145
- };
1146
- }
1147
-
1148
- // ../authoring/src/motion/materializeMotionPresetOps.ts
1149
- var isMotionPresetOp = (op) => !!op && typeof op === "object" && op.type === "applyMotionPreset";
1150
- var hasMotionPresetOp = (ops) => ops.some(isMotionPresetOp);
1151
- async function materializeMotionPresetOpsCore(composition, ops, deps) {
1152
- const out = [];
1153
- let current = composition;
1154
- for (let i = 0; i < ops.length; i++) {
1155
- const op = ops[i];
1156
- if (!isMotionPresetOp(op)) {
1157
- out.push(op);
1158
- if (deps.apply) current = deps.apply(current, op);
1159
- continue;
1618
+ summary() {
1619
+ const totalMs = performance.now() - this.t0;
1620
+ const accounted = this.spans.reduce((sum, s) => sum + (s.endMs - s.startMs), 0);
1621
+ const unaccounted = totalMs - accounted;
1622
+ this.log.info(`Pipeline trace: ${Math.round(totalMs)}ms total, ${this.toolCallCount} tool calls`, {
1623
+ totalMs: Math.round(totalMs),
1624
+ toolCalls: this.toolCallCount
1625
+ });
1626
+ for (const span of this.spans) {
1627
+ const dur = span.endMs - span.startMs;
1628
+ const pct = totalMs > 0 ? (dur / totalMs * 100).toFixed(0) : "0";
1629
+ this.log.info(` ${span.name.padEnd(24)} ${dur.toFixed(0).padStart(6)}ms ${pct.padStart(3)}%`);
1160
1630
  }
1161
- let card;
1162
- try {
1163
- card = resolveMotionPresetCard(current, { clipId: op.clipId, preset: op.preset });
1164
- } catch (err) {
1165
- if (err instanceof MotionPresetError) err.opIndex = i;
1166
- throw err;
1631
+ if (unaccounted > 50) {
1632
+ const pct = (unaccounted / totalMs * 100).toFixed(0);
1633
+ this.log.info(` ${"(unaccounted)".padEnd(24)} ${unaccounted.toFixed(0).padStart(6)}ms ${pct.padStart(3)}%`);
1167
1634
  }
1168
- const componentId = `motion-shell-${op.clipId}`;
1169
- const tsxSource = generateMotionShell(card.cardHtml, {
1170
- preset: op.preset,
1171
- ...op.params?.enterMs !== void 0 ? { enterMs: op.params.enterMs } : {},
1172
- ...op.params?.exitMs !== void 0 ? { exitMs: op.params.exitMs } : {},
1173
- ...op.params?.staggerMs !== void 0 ? { staggerMs: op.params.staggerMs } : {},
1174
- ...card.tokens !== void 0 ? { tokens: card.tokens } : {}
1175
- });
1176
- const materialized = await deps.sink({
1177
- componentId,
1178
- clipId: op.clipId,
1179
- preset: op.preset,
1180
- tsxSource,
1181
- ...card.zPlane !== void 0 ? { zPlane: card.zPlane } : {}
1182
- });
1183
- out.push(materialized);
1184
- if (deps.apply) current = deps.apply(current, materialized);
1185
1635
  }
1186
- return out;
1187
- }
1636
+ };
1188
1637
  export {
1189
1638
  ARTIFACT_RUBRIC,
1190
1639
  Agent,
1191
1640
  AgentFixableCaptureError,
1192
- CODE_GEN_FEW_SHOT_EXAMPLES,
1193
- COMPONENT_CONTRACT,
1194
1641
  COMPOSE_MOTION_TOOLS,
1195
1642
  COMPOSE_MOTION_VERIFY_TOOLS,
1196
1643
  COMPOSE_PLANNER_REPAIR_TOOLS,
1197
1644
  COMPOSE_PLANNER_TOOLS,
1198
1645
  COMPOSE_ROLE_TOOLS,
1199
1646
  COMPOSE_ROLE_TOOL_NAMES,
1200
- DESIGN_QUALITY_RULES,
1201
1647
  EVALUATOR_PROMPT,
1202
1648
  MOTION_PRESETS,
1203
1649
  MotionPresetError,
@@ -1205,7 +1651,6 @@ export {
1205
1651
  PipelineTrace as RequestTrace,
1206
1652
  SceneAuthoringError,
1207
1653
  TIMELINE_RUBRIC,
1208
- TOOLKIT_REFERENCE,
1209
1654
  ZERO_USAGE,
1210
1655
  buildDirectorContext as buildAgentContext,
1211
1656
  buildDirectorContext,
@@ -1232,7 +1677,6 @@ export {
1232
1677
  getExcludedTools,
1233
1678
  hasMotionPresetOp,
1234
1679
  hasSceneOp,
1235
- initCodeGenPrompts,
1236
1680
  isMotionPresetOp,
1237
1681
  isSceneOp,
1238
1682
  isSceneShotClip,