@cueframe/kernel 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (432) hide show
  1. package/LICENSE +661 -0
  2. package/dist/_members/account-model/testing/conversationStoreContract.d.ts +1 -1
  3. package/dist/_members/authoring/providers/resourceApi.d.ts +1 -1
  4. package/dist/_members/authoring/transpileComponent.d.ts +1 -1
  5. package/dist/_members/cloud-import/CloudImportService.d.ts +35 -0
  6. package/dist/_members/cloud-import/ImportProvider.d.ts +73 -0
  7. package/dist/_members/cloud-import/MediaItemPreprocessor.d.ts +27 -0
  8. package/dist/_members/cloud-import/cloudConfig.d.ts +23 -0
  9. package/dist/_members/cloud-import/index.d.ts +9 -0
  10. package/dist/_members/cloud-import/multipartUpload.d.ts +12 -0
  11. package/dist/_members/composition/ops/compositionOps.d.ts +2 -1
  12. package/dist/_members/composition/ops/types.d.ts +1 -1
  13. package/dist/_members/composition/projection/behind-readiness.d.ts +127 -0
  14. package/dist/_members/composition/projection/index.d.ts +2 -0
  15. package/dist/_members/composition/projection/reframe-readiness.d.ts +156 -0
  16. package/dist/_members/composition/timeline/placement.d.ts +1 -1
  17. package/dist/_members/composition/validators/composition.d.ts +43 -26
  18. package/dist/_members/composition/validators/render.d.ts +32 -0
  19. package/dist/_members/composition-ops/index.d.ts +1 -1
  20. package/dist/_members/composition-ops/opRecorder.d.ts +1 -1
  21. package/dist/_members/convex-api/api.d.ts +5 -0
  22. package/dist/_members/convex-api/dataModel.d.ts +6 -0
  23. package/dist/_members/core/render/compositionRender.d.ts +17 -1
  24. package/dist/_members/core/render/exportSettings.d.ts +1 -1
  25. package/dist/_members/core/render/types.d.ts +31 -0
  26. package/dist/_members/mcp/curation.d.ts +1 -1
  27. package/dist/_members/plane/conformance.d.ts +1 -1
  28. package/dist/_members/render-harness/localRender.d.ts +1 -1
  29. package/dist/animate.js +828 -79187
  30. package/dist/authoring/build-tools.js +8 -11
  31. package/dist/authoring/context.js +5 -5
  32. package/dist/authoring/models.js +1 -2
  33. package/dist/authoring/prompts.js +1 -1
  34. package/dist/authoring/tools.js +7 -7
  35. package/dist/authoring/transpileComponent.js +3 -2220
  36. package/dist/authoring.js +30 -30
  37. package/dist/brand-derivation.js +1 -1
  38. package/dist/chunk-6IU2UQI5.js +107 -0
  39. package/dist/{chunk-5I7VDCAC.js → chunk-7FO3ZJ43.js} +4 -1
  40. package/dist/{chunk-N67PDTKQ.js → chunk-ABL557OT.js} +1 -1
  41. package/dist/{chunk-MC5DLSEV.js → chunk-AP6ZIVAV.js} +15 -15
  42. package/dist/{chunk-QLAQHR3L.js → chunk-AQBREB5O.js} +1 -1
  43. package/dist/{chunk-DSNG6WLU.js → chunk-AYVJXDLB.js} +1 -4
  44. package/dist/{chunk-6CMVBTTP.js → chunk-DK2ODBNT.js} +19 -9
  45. package/dist/chunk-DSMLHYJ4.js +82 -0
  46. package/dist/{chunk-BRKJKB33.js → chunk-FYZVH3MC.js} +1 -1
  47. package/dist/{chunk-MVEE6HEC.js → chunk-GA23TRNR.js} +5 -7
  48. package/dist/chunk-HCCBDJLW.js +68 -0
  49. package/dist/{chunk-JRQVPFLF.js → chunk-HY3RIEZW.js} +1 -1
  50. package/dist/{chunk-OIRUO5P7.js → chunk-JJ6XD7NG.js} +152 -2
  51. package/dist/{_members/primitives/chunk-IDAL6G3Y.js → chunk-JQMPHKLU.js} +19 -27
  52. package/dist/{chunk-G3PBH53P.js → chunk-MBCXCJOE.js} +1 -1
  53. package/dist/{chunk-UEI3NLNK.js → chunk-MHOQTPOB.js} +1 -4
  54. package/dist/{chunk-37NJ27UU.js → chunk-OCFDUCF4.js} +3 -0
  55. package/dist/{chunk-WZTTZHNR.js → chunk-OLFOPQCA.js} +12 -9
  56. package/dist/{chunk-P43IE4WB.js → chunk-P727GZVO.js} +2 -4
  57. package/dist/{chunk-52AHXNKM.js → chunk-PDYO3DOJ.js} +5 -5
  58. package/dist/{chunk-S3P5BFFL.js → chunk-PMY24FUD.js} +2 -4
  59. package/dist/{chunk-ATAF24QG.js → chunk-PODIYN2K.js} +10 -3
  60. package/dist/chunk-RF7U3SCL.js +606 -0
  61. package/dist/{chunk-JD77Y2WM.js → chunk-SW336CJP.js} +1 -4
  62. package/dist/{chunk-TULRCY6U.js → chunk-TOJEXFXL.js} +1 -1
  63. package/dist/{chunk-ELLSET2N.js → chunk-UHGSZZDI.js} +3 -6
  64. package/dist/{chunk-M3I5LMAB.js → chunk-UY4SWJVE.js} +1 -1
  65. package/dist/{chunk-6QJ3V3VS.js → chunk-YX2GSJK7.js} +1 -1
  66. package/dist/chunk-ZT7MHRQU.js +104 -0
  67. package/dist/{chunk-NV4I6GJV.js → chunk-ZWMV6DD2.js} +27 -4
  68. package/dist/cloud-import/multipart.d.ts +1 -0
  69. package/dist/cloud-import/multipart.js +8 -0
  70. package/dist/cloud-import.d.ts +1 -0
  71. package/dist/cloud-import.js +234 -0
  72. package/dist/compose/renderer.js +19 -22
  73. package/dist/compose.js +19 -22
  74. package/dist/composition/graphics-plan.js +3 -3
  75. package/dist/composition/ops.js +4 -4
  76. package/dist/composition/primitive-catalog.js +1 -1
  77. package/dist/composition/projection.js +21 -5
  78. package/dist/composition/validators.js +6 -4
  79. package/dist/composition-ops.js +15 -13
  80. package/dist/composition.js +26 -8
  81. package/dist/{context-CEAKQ5T7.js → context-YWUZDG5X.js} +5 -5
  82. package/dist/convex-api/dataModel.d.ts +1 -0
  83. package/dist/convex-api/dataModel.js +0 -0
  84. package/dist/convex-api.d.ts +1 -0
  85. package/dist/convex-api.js +8 -0
  86. package/dist/core/render.js +3 -3
  87. package/dist/core/select.js +2 -2
  88. package/dist/core.js +3 -3
  89. package/dist/errors.js +1 -1
  90. package/dist/mcp/adapter.js +2 -5
  91. package/dist/mcp/server.js +1 -2
  92. package/dist/mcp.js +2 -95
  93. package/dist/media-model/media-kind.js +9 -98
  94. package/dist/media-model/testing.js +1071 -718
  95. package/dist/nle-export/server.js +328 -130
  96. package/dist/nle-export/xml.js +5 -22799
  97. package/dist/nle-export.js +20 -22
  98. package/dist/primitives/backgrounds.js +2 -3
  99. package/dist/primitives/captions.js +4 -243
  100. package/dist/primitives/effects.js +2 -3
  101. package/dist/primitives/hero-text.js +2 -3
  102. package/dist/primitives/layouts.js +2 -3
  103. package/dist/primitives/lib/index.js +8 -10
  104. package/dist/primitives/lib/preview.js +1 -2
  105. package/dist/primitives/lib/schema.js +1 -2
  106. package/dist/primitives/lib/text/fitText.js +1 -2
  107. package/dist/primitives/lib.js +8 -10
  108. package/dist/primitives/scenes.js +1 -2
  109. package/dist/primitives/text.js +2 -3
  110. package/dist/primitives/ui-blocks.js +4 -5
  111. package/dist/primitives.js +19 -21
  112. package/package.json +125 -16
  113. package/dist/TextureLoader-UQOFUSAP.js +0 -422
  114. package/dist/VideoTexture-AQWSPIJG.js +0 -62
  115. package/dist/_members/account-model/index.js +0 -4
  116. package/dist/_members/account-model/testing/conversationStoreContract.js +0 -168
  117. package/dist/_members/account-model/testing/index.js +0 -7
  118. package/dist/_members/account-model/testing/restorePointStoreContract.js +0 -69
  119. package/dist/_members/account-model/types/index.js +0 -1
  120. package/dist/_members/account-model/validators/contextFile.js +0 -18
  121. package/dist/_members/account-model/validators/conversation.js +0 -95
  122. package/dist/_members/account-model/validators/dashboardInsight.js +0 -16
  123. package/dist/_members/account-model/validators/index.js +0 -7
  124. package/dist/_members/account-model/validators/sessionToken.js +0 -49
  125. package/dist/_members/account-model/validators/uploadToken.js +0 -16
  126. package/dist/_members/account-model/validators/userSettings.js +0 -12
  127. package/dist/_members/account-model/validators/workingComposition.js +0 -20
  128. package/dist/_members/brand-derivation/constants.js +0 -20
  129. package/dist/_members/brand-derivation/contrastSafe.js +0 -114
  130. package/dist/_members/brand-derivation/index.js +0 -1
  131. package/dist/_members/composition/audio/audioMix.js +0 -61
  132. package/dist/_members/composition/audio/index.js +0 -5
  133. package/dist/_members/composition/audio/mixStaging.js +0 -195
  134. package/dist/_members/composition/audio/musicPack.generated.js +0 -136
  135. package/dist/_members/composition/audio/musicPack.js +0 -36
  136. package/dist/_members/composition/audio/pack.generated.js +0 -603
  137. package/dist/_members/composition/audio/pack.js +0 -48
  138. package/dist/_members/composition/audio/palette.js +0 -134
  139. package/dist/_members/composition/autozoom/index.js +0 -83
  140. package/dist/_members/composition/brand-kit.js +0 -45
  141. package/dist/_members/composition/brief/contract.js +0 -209
  142. package/dist/_members/composition/color-grade.js +0 -80
  143. package/dist/_members/composition/depth.js +0 -8
  144. package/dist/_members/composition/fixtures/index.js +0 -143
  145. package/dist/_members/composition/fixtures/vaayaErrored.d.ts +0 -25
  146. package/dist/_members/composition/fixtures/vaayaErrored.js +0 -203
  147. package/dist/_members/composition/fonts.js +0 -162
  148. package/dist/_members/composition/graphics-plan/compile.js +0 -221
  149. package/dist/_members/composition/graphics-plan/index.js +0 -10
  150. package/dist/_members/composition/graphics-plan/instantiateMotif.js +0 -44
  151. package/dist/_members/composition/graphics-plan/motion.js +0 -66
  152. package/dist/_members/composition/graphics-plan/schemas.js +0 -261
  153. package/dist/_members/composition/graphics-plan/solve.js +0 -145
  154. package/dist/_members/composition/index.js +0 -5
  155. package/dist/_members/composition/invariants/clipPlacement.js +0 -69
  156. package/dist/_members/composition/invariants/composition.js +0 -28
  157. package/dist/_members/composition/invariants/errors.js +0 -10
  158. package/dist/_members/composition/invariants/etag.js +0 -38
  159. package/dist/_members/composition/invariants/ids.js +0 -33
  160. package/dist/_members/composition/invariants/index.js +0 -9
  161. package/dist/_members/composition/invariants/keyframes.js +0 -45
  162. package/dist/_members/composition/invariants/markers.js +0 -29
  163. package/dist/_members/composition/invariants/time.js +0 -20
  164. package/dist/_members/composition/invariants/tracks.js +0 -304
  165. package/dist/_members/composition/ops/compositionOps.js +0 -1056
  166. package/dist/_members/composition/ops/headlessStore.js +0 -94
  167. package/dist/_members/composition/ops/index.js +0 -4
  168. package/dist/_members/composition/ops/selectors.js +0 -118
  169. package/dist/_members/composition/ops/timeline-word.js +0 -1
  170. package/dist/_members/composition/ops/transcript.js +0 -77
  171. package/dist/_members/composition/ops/types.js +0 -16
  172. package/dist/_members/composition/primitive-catalog/catalogQuery.js +0 -150
  173. package/dist/_members/composition/primitive-catalog/disabled.js +0 -32
  174. package/dist/_members/composition/primitive-catalog/generated/meta.js +0 -15161
  175. package/dist/_members/composition/primitive-catalog/index.js +0 -46
  176. package/dist/_members/composition/primitive-catalog/paramValidation.js +0 -231
  177. package/dist/_members/composition/primitive-catalog/projection.js +0 -164
  178. package/dist/_members/composition/primitive-catalog/types.js +0 -14
  179. package/dist/_members/composition/projection/behind-placement.js +0 -62
  180. package/dist/_members/composition/projection/brandKit.js +0 -482
  181. package/dist/_members/composition/projection/cardTokens.js +0 -209
  182. package/dist/_members/composition/projection/composition-floor.js +0 -582
  183. package/dist/_members/composition/projection/cropProjection.js +0 -257
  184. package/dist/_members/composition/projection/index.js +0 -7
  185. package/dist/_members/composition/projection/occlusion-budget.js +0 -104
  186. package/dist/_members/composition/projection/safe-zones.js +0 -99
  187. package/dist/_members/composition/reframe/aspectLoss.js +0 -115
  188. package/dist/_members/composition/reframe/coverage.js +0 -62
  189. package/dist/_members/composition/reframe/derive.js +0 -73
  190. package/dist/_members/composition/reframe/index.js +0 -109
  191. package/dist/_members/composition/reframe/kenBurns.js +0 -64
  192. package/dist/_members/composition/reframe/shotScale.js +0 -176
  193. package/dist/_members/composition/reframe/trajectory.js +0 -124
  194. package/dist/_members/composition/timeline/compound.js +0 -134
  195. package/dist/_members/composition/timeline/index.js +0 -9
  196. package/dist/_members/composition/timeline/intent.js +0 -228
  197. package/dist/_members/composition/timeline/keyframes.js +0 -121
  198. package/dist/_members/composition/timeline/link.js +0 -59
  199. package/dist/_members/composition/timeline/occupancy.js +0 -36
  200. package/dist/_members/composition/timeline/placement.js +0 -74
  201. package/dist/_members/composition/timeline/plan.js +0 -31
  202. package/dist/_members/composition/timeline/resolve.js +0 -170
  203. package/dist/_members/composition/timeline/trims.js +0 -278
  204. package/dist/_members/composition/types/index.js +0 -1
  205. package/dist/_members/composition/validators/brandKit.js +0 -295
  206. package/dist/_members/composition/validators/composePlan.js +0 -113
  207. package/dist/_members/composition/validators/composition.js +0 -703
  208. package/dist/_members/composition/validators/font.js +0 -34
  209. package/dist/_members/composition/validators/graphicKinds.js +0 -30
  210. package/dist/_members/composition/validators/index.js +0 -9
  211. package/dist/_members/composition/validators/project.js +0 -29
  212. package/dist/_members/composition/validators/registry.js +0 -41
  213. package/dist/_members/composition/validators/render.js +0 -139
  214. package/dist/_members/composition/validators/session.js +0 -37
  215. package/dist/_members/composition/validators/webhook.js +0 -72
  216. package/dist/_members/composition-ops/alphaLayers.js +0 -141
  217. package/dist/_members/composition-ops/index.js +0 -637
  218. package/dist/_members/composition-ops/materializeGrid.js +0 -99
  219. package/dist/_members/composition-ops/opRecorder.js +0 -196
  220. package/dist/_members/composition-ops/recordingStore.js +0 -14
  221. package/dist/_members/composition-ops/replaceRegion.js +0 -102
  222. package/dist/_members/composition-ops/testFixtures.js +0 -19
  223. package/dist/_members/core/index.js +0 -5
  224. package/dist/_members/core/render/bookends.js +0 -53
  225. package/dist/_members/core/render/captions.js +0 -127
  226. package/dist/_members/core/render/compositionRender.js +0 -1249
  227. package/dist/_members/core/render/deriveTrajectory.js +0 -889
  228. package/dist/_members/core/render/emphasis.js +0 -16
  229. package/dist/_members/core/render/eval/cropBox.js +0 -139
  230. package/dist/_members/core/render/eval/inclusion.js +0 -96
  231. package/dist/_members/core/render/eval/index.js +0 -146
  232. package/dist/_members/core/render/eval/metrics.js +0 -94
  233. package/dist/_members/core/render/exportSettings.js +0 -65
  234. package/dist/_members/core/render/index.js +0 -20
  235. package/dist/_members/core/render/mapFaceToPerson.js +0 -73
  236. package/dist/_members/core/render/types.js +0 -8
  237. package/dist/_members/core/render/vcam/cameraPath.js +0 -248
  238. package/dist/_members/core/render/vcam/constants.js +0 -115
  239. package/dist/_members/core/render/vcam/errorCodes.js +0 -39
  240. package/dist/_members/core/render/vcam/framing.js +0 -136
  241. package/dist/_members/core/render/vcam/requiredRegion.js +0 -137
  242. package/dist/_members/core/render/vcam/shots.js +0 -53
  243. package/dist/_members/core/render/vcam/subjectSet.js +0 -388
  244. package/dist/_members/core/select/errorCodes.js +0 -38
  245. package/dist/_members/core/select/index.js +0 -26
  246. package/dist/_members/core/select/model.js +0 -18
  247. package/dist/_members/core/select/select.js +0 -244
  248. package/dist/_members/core/select/stabilize.js +0 -242
  249. package/dist/_members/core/types.js +0 -7
  250. package/dist/_members/errors/index.js +0 -1
  251. package/dist/_members/errors/registry.js +0 -560
  252. package/dist/_members/foundation/codes/index.js +0 -31
  253. package/dist/_members/foundation/index.js +0 -2
  254. package/dist/_members/foundation/primitives/index.js +0 -5
  255. package/dist/_members/mcp/adapter.js +0 -771
  256. package/dist/_members/mcp/burnedNames.js +0 -73
  257. package/dist/_members/mcp/core.js +0 -390
  258. package/dist/_members/mcp/curation.js +0 -792
  259. package/dist/_members/mcp/executor.js +0 -142
  260. package/dist/_members/mcp/format.js +0 -9
  261. package/dist/_members/mcp/generated/catalogPreviews.js +0 -95
  262. package/dist/_members/mcp/generated/harness.js +0 -81
  263. package/dist/_members/mcp/generated/operations.js +0 -131
  264. package/dist/_members/mcp/index.js +0 -50
  265. package/dist/_members/mcp/internalLoopTools.js +0 -109
  266. package/dist/_members/mcp/prompts.js +0 -45
  267. package/dist/_members/mcp/resources.js +0 -166
  268. package/dist/_members/mcp/server.js +0 -340
  269. package/dist/_members/mcp/wait.js +0 -378
  270. package/dist/_members/mcp/x402Meta.js +0 -66
  271. package/dist/_members/media-model/api.js +0 -175
  272. package/dist/_members/media-model/index.js +0 -1
  273. package/dist/_members/media-model/media-kind.js +0 -116
  274. package/dist/_members/media-model/testing/index.js +0 -1
  275. package/dist/_members/media-model/testing/mediaStoreContract.js +0 -82
  276. package/dist/_members/media-model/transcriptSearch.js +0 -70
  277. package/dist/_members/media-model/transcriptSearchCases.json +0 -79
  278. package/dist/_members/nle-export/compact-timeline.js +0 -73
  279. package/dist/_members/nle-export/compact-timeline.js.map +0 -1
  280. package/dist/_members/nle-export/composition-to-input.js +0 -147
  281. package/dist/_members/nle-export/composition-to-input.js.map +0 -1
  282. package/dist/_members/nle-export/fcpxml.js +0 -159
  283. package/dist/_members/nle-export/fcpxml.js.map +0 -1
  284. package/dist/_members/nle-export/index.js +0 -12
  285. package/dist/_members/nle-export/index.js.map +0 -1
  286. package/dist/_members/nle-export/premiere.js +0 -161
  287. package/dist/_members/nle-export/premiere.js.map +0 -1
  288. package/dist/_members/nle-export/server/index.js +0 -2
  289. package/dist/_members/nle-export/server/index.js.map +0 -1
  290. package/dist/_members/nle-export/server/pack-zip.js +0 -38
  291. package/dist/_members/nle-export/server/pack-zip.js.map +0 -1
  292. package/dist/_members/nle-export/srt.js +0 -50
  293. package/dist/_members/nle-export/srt.js.map +0 -1
  294. package/dist/_members/nle-export/types.js +0 -9
  295. package/dist/_members/nle-export/types.js.map +0 -1
  296. package/dist/_members/nle-export/xml/index.js +0 -11
  297. package/dist/_members/nle-export/xml/index.js.map +0 -1
  298. package/dist/_members/nle-export/xml-utils.js +0 -48
  299. package/dist/_members/nle-export/xml-utils.js.map +0 -1
  300. package/dist/_members/perception/activeSpeaker.js +0 -103
  301. package/dist/_members/perception/audioQuality.js +0 -76
  302. package/dist/_members/perception/energyBeat.js +0 -99
  303. package/dist/_members/perception/identityMatch.js +0 -91
  304. package/dist/_members/perception/index.js +0 -48
  305. package/dist/_members/perception/visualQuality.js +0 -95
  306. package/dist/_members/plane/conformance.js +0 -90
  307. package/dist/_members/plane/contract.js +0 -49
  308. package/dist/_members/plane/index.js +0 -16
  309. package/dist/_members/primitives/backgrounds/index.js +0 -32
  310. package/dist/_members/primitives/backgrounds/index.js.map +0 -1
  311. package/dist/_members/primitives/captions/index.js +0 -398
  312. package/dist/_members/primitives/captions/index.js.map +0 -1
  313. package/dist/_members/primitives/chunk-2LVE4UIT.js +0 -139
  314. package/dist/_members/primitives/chunk-2LVE4UIT.js.map +0 -1
  315. package/dist/_members/primitives/chunk-3IQUH6KK.js +0 -20
  316. package/dist/_members/primitives/chunk-3IQUH6KK.js.map +0 -1
  317. package/dist/_members/primitives/chunk-3OMURV6Q.js +0 -112
  318. package/dist/_members/primitives/chunk-3OMURV6Q.js.map +0 -1
  319. package/dist/_members/primitives/chunk-4IS6TMEG.js +0 -21
  320. package/dist/_members/primitives/chunk-4IS6TMEG.js.map +0 -1
  321. package/dist/_members/primitives/chunk-5MWGAEGQ.js +0 -1644
  322. package/dist/_members/primitives/chunk-5MWGAEGQ.js.map +0 -1
  323. package/dist/_members/primitives/chunk-7RRPFPQK.js +0 -15
  324. package/dist/_members/primitives/chunk-7RRPFPQK.js.map +0 -1
  325. package/dist/_members/primitives/chunk-DH5TRZK2.js +0 -125
  326. package/dist/_members/primitives/chunk-DH5TRZK2.js.map +0 -1
  327. package/dist/_members/primitives/chunk-E3KNUSFG.js +0 -2337
  328. package/dist/_members/primitives/chunk-E3KNUSFG.js.map +0 -1
  329. package/dist/_members/primitives/chunk-G2B3G4HK.js +0 -47
  330. package/dist/_members/primitives/chunk-G2B3G4HK.js.map +0 -1
  331. package/dist/_members/primitives/chunk-HFPFGZXT.js +0 -1494
  332. package/dist/_members/primitives/chunk-HFPFGZXT.js.map +0 -1
  333. package/dist/_members/primitives/chunk-HIWVFZVH.js +0 -19
  334. package/dist/_members/primitives/chunk-HIWVFZVH.js.map +0 -1
  335. package/dist/_members/primitives/chunk-IDAL6G3Y.js.map +0 -1
  336. package/dist/_members/primitives/chunk-KNC6JP5F.js +0 -34
  337. package/dist/_members/primitives/chunk-KNC6JP5F.js.map +0 -1
  338. package/dist/_members/primitives/chunk-KYRDVZST.js +0 -459
  339. package/dist/_members/primitives/chunk-KYRDVZST.js.map +0 -1
  340. package/dist/_members/primitives/chunk-LWLHS2NS.js +0 -3410
  341. package/dist/_members/primitives/chunk-LWLHS2NS.js.map +0 -1
  342. package/dist/_members/primitives/chunk-QAQ3P7DR.js +0 -8855
  343. package/dist/_members/primitives/chunk-QAQ3P7DR.js.map +0 -1
  344. package/dist/_members/primitives/chunk-ROV2ODWC.js +0 -81
  345. package/dist/_members/primitives/chunk-ROV2ODWC.js.map +0 -1
  346. package/dist/_members/primitives/chunk-TCRC2FH3.js +0 -183
  347. package/dist/_members/primitives/chunk-TCRC2FH3.js.map +0 -1
  348. package/dist/_members/primitives/chunk-US4YEDAA.js +0 -96
  349. package/dist/_members/primitives/chunk-US4YEDAA.js.map +0 -1
  350. package/dist/_members/primitives/chunk-UVKRO5ER.js +0 -13
  351. package/dist/_members/primitives/chunk-UVKRO5ER.js.map +0 -1
  352. package/dist/_members/primitives/chunk-W4EIIF2I.js +0 -10
  353. package/dist/_members/primitives/chunk-W4EIIF2I.js.map +0 -1
  354. package/dist/_members/primitives/chunk-WPGKIPCO.js +0 -3563
  355. package/dist/_members/primitives/chunk-WPGKIPCO.js.map +0 -1
  356. package/dist/_members/primitives/chunk-WZFLEGMD.js +0 -1435
  357. package/dist/_members/primitives/chunk-WZFLEGMD.js.map +0 -1
  358. package/dist/_members/primitives/chunk-XHU3WBEI.js +0 -33
  359. package/dist/_members/primitives/chunk-XHU3WBEI.js.map +0 -1
  360. package/dist/_members/primitives/chunk-YN7WTZZ7.js +0 -46
  361. package/dist/_members/primitives/chunk-YN7WTZZ7.js.map +0 -1
  362. package/dist/_members/primitives/effects/index.js +0 -30
  363. package/dist/_members/primitives/effects/index.js.map +0 -1
  364. package/dist/_members/primitives/hero-text/index.js +0 -14
  365. package/dist/_members/primitives/hero-text/index.js.map +0 -1
  366. package/dist/_members/primitives/index.js +0 -64
  367. package/dist/_members/primitives/index.js.map +0 -1
  368. package/dist/_members/primitives/layouts/index.js +0 -24
  369. package/dist/_members/primitives/layouts/index.js.map +0 -1
  370. package/dist/_members/primitives/lib/easings.js +0 -26
  371. package/dist/_members/primitives/lib/easings.js.map +0 -1
  372. package/dist/_members/primitives/lib/index.js +0 -74
  373. package/dist/_members/primitives/lib/index.js.map +0 -1
  374. package/dist/_members/primitives/lib/palette.js +0 -72
  375. package/dist/_members/primitives/lib/palette.js.map +0 -1
  376. package/dist/_members/primitives/lib/preview.js +0 -8
  377. package/dist/_members/primitives/lib/preview.js.map +0 -1
  378. package/dist/_members/primitives/lib/schema.js +0 -12
  379. package/dist/_members/primitives/lib/schema.js.map +0 -1
  380. package/dist/_members/primitives/lib/seeded-random.js +0 -14
  381. package/dist/_members/primitives/lib/seeded-random.js.map +0 -1
  382. package/dist/_members/primitives/lib/text/contrast.js +0 -12
  383. package/dist/_members/primitives/lib/text/contrast.js.map +0 -1
  384. package/dist/_members/primitives/lib/text/fill.js +0 -8
  385. package/dist/_members/primitives/lib/text/fill.js.map +0 -1
  386. package/dist/_members/primitives/lib/text/fitText.js +0 -10
  387. package/dist/_members/primitives/lib/text/fitText.js.map +0 -1
  388. package/dist/_members/primitives/lib/text/marker.js +0 -8
  389. package/dist/_members/primitives/lib/text/marker.js.map +0 -1
  390. package/dist/_members/primitives/lib/text/motion.js +0 -16
  391. package/dist/_members/primitives/lib/text/motion.js.map +0 -1
  392. package/dist/_members/primitives/lib/text/recolor.js +0 -8
  393. package/dist/_members/primitives/lib/text/recolor.js.map +0 -1
  394. package/dist/_members/primitives/lib/text/spec.js +0 -1
  395. package/dist/_members/primitives/lib/text/spec.js.map +0 -1
  396. package/dist/_members/primitives/lib/text/stage.js +0 -8
  397. package/dist/_members/primitives/lib/text/stage.js.map +0 -1
  398. package/dist/_members/primitives/lib/text/typeface.js +0 -8
  399. package/dist/_members/primitives/lib/text/typeface.js.map +0 -1
  400. package/dist/_members/primitives/lib/tokens.js +0 -24
  401. package/dist/_members/primitives/lib/tokens.js.map +0 -1
  402. package/dist/_members/primitives/lib/types.js +0 -1
  403. package/dist/_members/primitives/lib/types.js.map +0 -1
  404. package/dist/_members/primitives/params-required.json +0 -153
  405. package/dist/_members/primitives/scenes/index.js +0 -25
  406. package/dist/_members/primitives/scenes/index.js.map +0 -1
  407. package/dist/_members/primitives/subject-foreground/index.js +0 -30
  408. package/dist/_members/primitives/subject-foreground/index.js.map +0 -1
  409. package/dist/_members/primitives/text/index.js +0 -57
  410. package/dist/_members/primitives/text/index.js.map +0 -1
  411. package/dist/_members/primitives/transitions/index.js +0 -67
  412. package/dist/_members/primitives/transitions/index.js.map +0 -1
  413. package/dist/_members/primitives/ui-blocks/index.js +0 -76
  414. package/dist/_members/primitives/ui-blocks/index.js.map +0 -1
  415. package/dist/_members/primitives/version-map.json +0 -105
  416. package/dist/_members/primitives/workspace.js +0 -60
  417. package/dist/_members/primitives/workspace.js.map +0 -1
  418. package/dist/chunk-7GISRVON.js +0 -14176
  419. package/dist/chunk-DIBOJJMU.js +0 -16838
  420. package/dist/chunk-EAUSEGB7.js +0 -420
  421. package/dist/chunk-FUWJOVVK.js +0 -3633
  422. package/dist/chunk-G75E7YA4.js +0 -11883
  423. package/dist/chunk-JCZQT7K3.js +0 -3266
  424. package/dist/chunk-KF5ETMKB.js +0 -544
  425. package/dist/chunk-NDKERSXY.js +0 -1296
  426. package/dist/chunk-V43Y7IE4.js +0 -3621
  427. package/dist/chunk-VIVQHIGZ.js +0 -4319
  428. package/dist/chunk-YA3OR2KK.js +0 -249
  429. package/dist/hls-HD4C5G6W.js +0 -33000
  430. package/dist/token-RGFIT24D.js +0 -69
  431. package/dist/token-util-GPLSGYVO.js +0 -5
  432. package/dist/vision_bundle-5Y376MAR.js +0 -4084
@@ -1,378 +0,0 @@
1
- /**
2
- * `wait_job` — block until a long-running job reaches a terminal state, by
3
- * POLLING its status endpoint through the Executor. Unified across transports:
4
- * the same poll loop works for stdio (network) and hosted (in-process), so the
5
- * blocking-SSE path is gone (the agent only ever sees the terminal result, so
6
- * polling is functionally equivalent; `create_webhook` is the event-driven path
7
- * for fan-out). Pure + side-effect-free (clock/sleep injectable) so it unit-tests
8
- * without a server.
9
- */
10
- import { opById, buildPath, isOk, safeParse, apiErrorFrom, fmtErr } from './core.js';
11
- const defaultSleep = (ms) => new Promise((r) => setTimeout(r, ms));
12
- const defaultNow = () => Date.now();
13
- const DEFAULT_POLL_MS = 3000;
14
- function fmtTime(sec) {
15
- return `${Math.floor(sec / 60)}:${String(Math.floor(sec % 60)).padStart(2, '0')}`;
16
- }
17
- const KINDS = {
18
- render: {
19
- operationId: 'getRender',
20
- mapArg: (p, id, projectId) => (p === 'renderId' ? id : projectId),
21
- terminal: (j) => {
22
- const s = String(j?.status ?? '');
23
- if (s === 'complete' || s === 'completed') {
24
- const url = j?.outputUrl;
25
- const lines = ['Render complete.'];
26
- if (url)
27
- lines.push(`\nDownload URL: ${url}`);
28
- if (j?.outputExpiresAt)
29
- lines.push(`Expires: ${j.outputExpiresAt}`);
30
- return { ok: true, text: lines.join('\n') };
31
- }
32
- if (s === 'error' || s === 'failed' || s === 'cancelled') {
33
- const cause = j?.errorDetails ? JSON.stringify(j.errorDetails) : (j?.error ?? j?.errorCode ?? '');
34
- const lines = [`Render ${s}${cause ? `: ${cause}` : ''}.`];
35
- if (j?.errorCode)
36
- lines.push(`Code: ${j.errorCode}${j?.category ? ` (${j.category})` : ''}`);
37
- if (typeof j?.retryable === 'boolean') {
38
- lines.push(j.retryable
39
- ? 'retryable: true — transient pipeline failure; call retry_render to re-attempt.'
40
- : `retryable: false — deterministic defect${j?.category ? ` (category ${j.category})` : ''}; fix the composition before re-rendering — retry_render alone will not help.`);
41
- }
42
- return { ok: false, text: lines.join('\n') };
43
- }
44
- return null;
45
- },
46
- },
47
- compose: {
48
- operationId: 'getComposeJob',
49
- mapArg: (p, id, projectId) => (p === 'composeJobId' ? id : projectId),
50
- terminal: (j) => {
51
- const s = String(j?.status ?? '');
52
- // Client-agent checkpoint: the compose is PAUSED at a holdAt stage,
53
- // awaiting the client's decision. STOP polling and hand back to the agent
54
- // — this is a decision point, distinct from the still-running continuation
55
- // (no `stillRunning`, so the poll loop returns) and from an error. The
56
- // warm box is already released, so the run costs nothing while parked.
57
- if (s === 'awaiting_input') {
58
- // The job carries a POINTER at the durable checkpoint packet — the
59
- // artifact/stills/verdicts/quote live there, not on the job row.
60
- const cp = (j?.checkpoint ?? {});
61
- const lines = [
62
- `Compose paused (awaiting_input) at a checkpoint — stage "${cp.stage ?? '?'}" (version ${cp.version ?? '?'}), checkpointId ${cp.checkpointId ?? '?'}.`,
63
- `\n1. get_checkpoint(checkpointId: "${cp.checkpointId ?? ''}") — the packet: stage artifact, presigned storyboard stills (REVIEW THE EVIDENCE, relay stills + the money triple to your human), critic verdicts, and the quote.`,
64
- `\n2. Answer with resume(checkpointId: "${cp.checkpointId ?? ''}", body: { decision: "approve" | "revise" | "abandon" }). "revise" loops IN-JOB — add body.comments ([{anchor: {beatId}|{timecodeMs}, verdict: "approve"|"revise"|"lock", note}]) and/or body.edits (your revised artifact); the director re-presents this same gate as a new packet. "abandon" ends the run. Approve-with-comments is legal (notes record without gating). The compose stays parked (warm box released) until you resume.`,
65
- ];
66
- return { ok: true, text: lines.filter(Boolean).join('\n') };
67
- }
68
- if (s === 'complete' || s === 'completed') {
69
- const lines = ['Compose complete.'];
70
- const w = j?.winner;
71
- if (w && typeof w.candidateIndex === 'number') {
72
- lines.push(`Winner: candidate #${w.candidateIndex}`);
73
- // composite lives on the winning candidate, NOT top-level.
74
- const cand = Array.isArray(j?.candidates)
75
- ? j.candidates.find((c) => c?.index === w.candidateIndex)
76
- : undefined;
77
- if (typeof cand?.composite === 'number')
78
- lines.push(`Composite score: ${cand.composite}`);
79
- }
80
- // A job can COMPLETE below the bar (e.g. footage that cannot satisfy the
81
- // brief): say so, name the stuck criteria with the judge's critique, and
82
- // give the caller its three real moves — otherwise "complete" reads as
83
- // "accepted" and the caller ships a video the judge just told us is short.
84
- const qa = j?.qualityAssessment;
85
- if (qa?.route === 'handoff') {
86
- lines.push(`\n⚠ BELOW THE QUALITY BAR (${qa.qualityThreshold ?? '?'}) — completed, but not publish-ready.`);
87
- for (const b of qa.blockers ?? []) {
88
- lines.push(` • ${b.criterion} ${b.score}/${b.floor} (floor) — ${(b.critique ?? '').slice(0, 300)}`);
89
- }
90
- lines.push('\nYour options: fix the ROOT cause the critique names (often the source footage or the brief itself) and compose again; accept it as-is and create_render; or hand it to a human to finish.');
91
- return { ok: true, text: lines.join('\n') };
92
- }
93
- lines.push('\nThe winning composition is saved to the project. Render it with create_render.');
94
- return { ok: true, text: lines.join('\n') };
95
- }
96
- // 'error' is the legacy terminal (composeJobs.isTerminalComposeStatus
97
- // includes it for pre-contract rows) — omitting it polls a dead job to
98
- // the 30-min cap (review finding 2026-07-10, same fix as consult).
99
- if (s === 'failed' || s === 'cancelled' || s === 'error') {
100
- // Surface the row's terminal reason (sanitized `code: message` prose,
101
- // e.g. "reframe_coverage_gap: clip clip-0: uncovered [0–3s] …").
102
- // Hardcoding "Compose failed." here left the agent debugging blind
103
- // while the real reason sat unread on the row (2026-07-07 LBO run).
104
- const reason = typeof j?.error === 'string' && j.error ? `: ${j.error}` : '.';
105
- return { ok: false, text: `Compose ${s}${reason}` };
106
- }
107
- return null;
108
- },
109
- },
110
- consult: {
111
- // A consult job IS a composeJob (routes/consult.ts returns consultJobId =
112
- // composeJobId) — same detail op, different terminal: the advisory envelope
113
- // (assessment / proposals / principles / plan), never the compose kind's
114
- // "winner — render it" text. Before this kind existed, consult was a
115
- // DEAD-END: its advisoryResult was unreachable over the curated surface.
116
- operationId: 'getComposeJob',
117
- mapArg: (p, id, projectId) => (p === 'composeJobId' ? id : projectId),
118
- terminal: (j) => {
119
- const s = String(j?.status ?? '');
120
- if (s === 'complete' || s === 'completed') {
121
- const a = j?.advisoryResult;
122
- if (!a) {
123
- // Fail loud: a consult that finished without an envelope is a defect,
124
- // not a success to paper over (the worker-callback whitelist dropped
125
- // advisoryResult once before — http.ts).
126
- return {
127
- ok: false,
128
- text: 'Consult completed but the job has no advisoryResult — inspect getComposeJob for the raw row; this is a pipeline defect, not a usage error.',
129
- };
130
- }
131
- const lines = [`Consult (${a.mode ?? '?'}) complete.`];
132
- // Evidence convergence: the advisory minted a durable kind:'score'
133
- // Checkpoint — same addressable noun as gates and score_composition.
134
- if (typeof a.checkpointId === 'string') {
135
- lines.push(`Checkpoint: ${a.checkpointId} (durable advisory packet — get_checkpoint re-reads it later).`);
136
- }
137
- if (a.assessment) {
138
- for (const [criterion, v] of Object.entries(a.assessment)) {
139
- // A criterion may arrive critique-only (judge omitted the numeric
140
- // score) — dropping it would swallow the very critique the caller
141
- // paid for. Render whatever is present.
142
- if (v && (typeof v.score === 'number' || v.critique)) {
143
- const score = typeof v.score === 'number' ? String(v.score) : '—';
144
- lines.push(`- ${criterion}: ${score}${v.critique ? ` — ${v.critique}` : ''}`);
145
- }
146
- }
147
- }
148
- if (Array.isArray(a.proposals) && a.proposals.length > 0) {
149
- lines.push('\nProposals:');
150
- for (const p of a.proposals) {
151
- // selectStrategy is REQUIRED on the select body (no route default) —
152
- // teaching the short body here would 400 the agent that follows it.
153
- const adopt = typeof p.candidateIndex === 'number'
154
- ? ` — adopt via select_candidate(projectId, composeJobId, body: { candidateIndex: ${p.candidateIndex}, selectStrategy: "agent-authoritative" })`
155
- : ' (advisory only — re-author via apply_composition)';
156
- lines.push(`- ${p.label ?? '?'}: ${(p.changeSummary ?? []).join('; ')}${adopt}`);
157
- if (typeof p.candidateIndex === 'number')
158
- lines.push(` (candidateIndex: ${p.candidateIndex})`);
159
- }
160
- }
161
- if (Array.isArray(a.principles) && a.principles.length > 0) {
162
- lines.push(`\nPrinciples:\n${a.principles.map((x) => `- ${x}`).join('\n')}`);
163
- }
164
- if (a.plan !== undefined) {
165
- lines.push(`\nPlan (mode=advise — GUIDANCE to re-author from via apply_composition; it is not converted to ops):\n${JSON.stringify(a.plan, null, 2)}`);
166
- }
167
- return { ok: true, text: lines.join('\n') };
168
- }
169
- // 'error' is the legacy compose terminal (composeJobs.ts
170
- // isTerminalComposeStatus) — omitting it here polls a dead job to the
171
- // 30-min cap (review finding 2026-07-10).
172
- if (s === 'failed' || s === 'cancelled' || s === 'error') {
173
- const reason = typeof j?.error === 'string' && j.error ? `: ${j.error}` : '.';
174
- return { ok: false, text: `Consult ${s}${reason}` };
175
- }
176
- return null;
177
- },
178
- },
179
- suggestions: {
180
- operationId: 'listMediaSuggestions',
181
- mapArg: (_p, id) => id,
182
- terminal: (j) => {
183
- const s = String(j?.status ?? '');
184
- const suggestions = Array.isArray(j?.suggestions) ? j.suggestions : [];
185
- if (s === 'failed')
186
- return { ok: false, text: 'Clip-suggestion analysis failed.' };
187
- // Gate on STATUS only — never on suggestions.length, or a still-"generating"
188
- // re-analysis would return the previous run's stale suggestions as terminal.
189
- if (s === 'complete' || s === 'completed') {
190
- if (suggestions.length === 0) {
191
- return { ok: true, text: 'Analysis complete — no clip suggestions produced.' };
192
- }
193
- const lines = suggestions.map((sg) => {
194
- const dur = sg?.trim ? (sg.trim.end - sg.trim.start).toFixed(1) : '?';
195
- const t = sg?.trim ? `${fmtTime(sg.trim.start)} → ${fmtTime(sg.trim.end)} (${dur}s)` : '';
196
- const door = sg.briefId
197
- ? `\n briefId: ${sg.briefId} — compose it via compose {briefId}`
198
- : '';
199
- return `- ${sg.id}\n "${sg.title}"\n ${t} ${sg.format ?? ''} score: ${sg.score ?? ''}\n ${sg.reason ?? ''}${door}`;
200
- });
201
- const anyBrief = suggestions.some((sg) => sg.briefId);
202
- const tail = anyBrief
203
- ? '\n\nEach suggestion above was minted as a kind-\'clip\' Brief — compose {briefId} runs the Director on it (list_briefs {kind:"clip"} shows them).'
204
- : '\n\nNo Briefs were minted (this media has no project) — import it into a project and re-run suggest_briefs to get composable briefIds.';
205
- return {
206
- ok: true,
207
- text: `Analysis complete. ${suggestions.length} clip suggestion${suggestions.length !== 1 ? 's' : ''}:\n\n${lines.join('\n\n')}${tail}`,
208
- };
209
- }
210
- return null;
211
- },
212
- },
213
- verify: {
214
- // The generic jobs resource (GET /v1/jobs/{id}) — verify is its first
215
- // tenant; future job kinds reuse this parser instead of adding adapters.
216
- operationId: 'getJob',
217
- mapArg: (_p, id) => id,
218
- terminal: (j) => {
219
- const s = String(j?.status ?? '');
220
- if (s === 'succeeded') {
221
- const r = (j?.result ?? {});
222
- const lines = ['Verify complete.'];
223
- // Lane convergence: the verdicts also minted a durable kind:'score'
224
- // Checkpoint — the same addressable evidence noun the director's gates
225
- // produce (get_checkpoint / list_checkpoints reads it back).
226
- if (typeof r.checkpointId === 'string') {
227
- lines.push(`Checkpoint: ${r.checkpointId} (durable score packet — get_checkpoint to re-read the verdicts later).`);
228
- }
229
- if (typeof r.composite === 'number')
230
- lines.push(`Composite score: ${r.composite}`);
231
- if (r.perCriterion && typeof r.perCriterion === 'object') {
232
- for (const [criterion, v] of Object.entries(r.perCriterion)) {
233
- if (typeof v?.score === 'number') {
234
- lines.push(`- ${criterion}: ${v.score}${v?.critique ? ` — ${v.critique}` : ''}`);
235
- }
236
- }
237
- }
238
- // A6 lane parity: the org's OWN registered critics grade here too —
239
- // parallel channel, never part of the composite.
240
- if (Array.isArray(r.clientScores) && r.clientScores.length > 0) {
241
- lines.push('\nYour registered critics:');
242
- for (const c of r.clientScores) {
243
- const name = c.label ?? c.criticId ?? 'critic';
244
- if (c.unavailable) {
245
- lines.push(`- ${name}: unavailable (your evaluator did not answer — excluded from the gate)`);
246
- }
247
- else if (typeof c.score === 'number') {
248
- const below = typeof c.floor === 'number' && c.score < c.floor ? ' (BELOW your floor)' : '';
249
- lines.push(`- ${name}: ${c.score}${below}${c.critique ? ` — ${c.critique}` : ''}`);
250
- }
251
- }
252
- }
253
- if (typeof r.critique === 'string' && r.critique.length > 0) {
254
- lines.push(`\nWorst-first critique: ${r.critique}`);
255
- }
256
- lines.push('\nFix the lowest criterion via apply_composition, then re-verify.');
257
- return { ok: true, text: lines.join('\n') };
258
- }
259
- if (s === 'failed')
260
- return jobFailedResult('Verify', 'score_composition', j);
261
- return null;
262
- },
263
- },
264
- preview: {
265
- // Generic jobs resource — preview job (single-component still).
266
- operationId: 'getJob',
267
- mapArg: (_p, id) => id,
268
- terminal: (j) => {
269
- const s = String(j?.status ?? '');
270
- if (s === 'succeeded') {
271
- // `url` is presigned at READ time by the jobs route from the result's
272
- // durable `outputR2Key` (routes/jobs.ts) — the executor never stores a
273
- // URL that would expire inside the immortal job row.
274
- const r = (j?.result ?? {});
275
- return {
276
- ok: true,
277
- mediaUrls: r.url ? [r.url] : undefined,
278
- text: r.url
279
- ? `Preview ready.\n\nClip: ${r.url}${r.urlExpiresAt ? `\n(link valid until ${r.urlExpiresAt})` : ''}\n\nInspect it, fix the component via create_component if needed, and re-preview.`
280
- : 'Preview succeeded but returned no url — inspect GET /v1/jobs for the raw result.',
281
- };
282
- }
283
- if (s === 'failed')
284
- return jobFailedResult('Preview', 'preview_component', j);
285
- return null;
286
- },
287
- },
288
- brand_kit_extract: {
289
- // Generic jobs resource — brand-token extraction job.
290
- operationId: 'getJob',
291
- mapArg: (_p, id) => id,
292
- terminal: (j) => {
293
- const s = String(j?.status ?? '');
294
- if (s === 'succeeded') {
295
- const r = (j?.result ?? {});
296
- const colors = Array.isArray(r.colors) ? r.colors.length : 0;
297
- const fonts = Array.isArray(r.fonts) ? r.fonts.length : 0;
298
- const head = `${colors} color${colors !== 1 ? 's' : ''}, ${fonts} font${fonts !== 1 ? 's' : ''}${r.title ? ` — ${r.title}` : ''}`;
299
- return {
300
- ok: true,
301
- text: `Extraction complete: ${head}.\n\n${JSON.stringify(j?.result ?? {}, null, 2)}\n\nReview the tokens, then create_brand_kit to persist a kit. (0 tokens usually means a JS-rendered site — author the kit manually from the site's compiled CSS.)`,
302
- };
303
- }
304
- if (s === 'failed')
305
- return jobFailedResult('Brand-kit extraction', 'extract_brand_kit', j);
306
- return null;
307
- },
308
- },
309
- };
310
- /** Shared FAILED terminal for generic-job kinds: typed code + retry hint. */
311
- function jobFailedResult(label, reEnqueueTool, j) {
312
- const code = String(j?.error?.code ?? 'unknown');
313
- const msg = typeof j?.error?.message === 'string' ? j.error.message : '';
314
- const retryHint = code === 'job_timeout'
315
- ? ` The executor died mid-run and the stall sweep reaped the job — re-enqueue ${reEnqueueTool} to retry.`
316
- : '';
317
- return { ok: false, text: `${label} failed (${code})${msg ? `: ${msg}` : ''}.${retryHint}` };
318
- }
319
- /**
320
- * Poll a job's status op until terminal or the deadline. 4xx → fail loud
321
- * immediately; 5xx/transient → keep polling; 2xx non-terminal → sleep + retry.
322
- */
323
- export async function waitForJob(ex, kind, id, projectId, deadline, deps = {}) {
324
- const sleep = deps.sleep ?? defaultSleep;
325
- const now = deps.now ?? defaultNow;
326
- const pollMs = deps.pollMs ?? DEFAULT_POLL_MS;
327
- const cfg = KINDS[kind];
328
- const op = opById(cfg.operationId);
329
- let lastStatus = '';
330
- // Overshoot guard: never START an invoke (or a sleep+invoke cycle) that
331
- // would land past the deadline — the old `now() < deadline` check let a
332
- // poll beginning at deadline−1ms overshoot by the whole invoke duration,
333
- // blowing the transport budget the deadline exists to respect.
334
- const INVOKE_BUDGET_MS = deps.invokeBudgetMs ?? 2_000;
335
- // ALWAYS poll at least once: a caller with a tiny timeout (schema floor is
336
- // 1000ms, under the invoke budget) is doing a quick status check — zero
337
- // polls would return still-running for a job that already finished (or
338
- // doesn't exist), and an agent obeying the re-call hint livelocks forever.
339
- let firstPoll = true;
340
- while (firstPoll || now() + INVOKE_BUDGET_MS < deadline) {
341
- firstPoll = false;
342
- const res = await ex.invoke({
343
- method: op.method,
344
- path: buildPath(op, (p) => cfg.mapArg(p, id, projectId)),
345
- });
346
- // Fail fast on a client error (4xx) OR any error the API marks
347
- // non-retryable (`error.retryable === false`) — only genuinely transient
348
- // 5xx are worth polling. (Without this, a non-retryable 500 — e.g. a
349
- // malformed id — would poll until the full timeout.)
350
- if (!isOk(res.status)) {
351
- const j = safeParse(res.text);
352
- if ((res.status >= 400 && res.status < 500) || j?.error?.retryable === false) {
353
- return { ok: false, text: `Failed to poll ${kind} status: ${fmtErr(apiErrorFrom(res))}` };
354
- }
355
- }
356
- if (isOk(res.status)) {
357
- const json = safeParse(res.text);
358
- const t = cfg.terminal(json);
359
- if (t)
360
- return t;
361
- if (json && typeof json.status === 'string')
362
- lastStatus = json.status;
363
- }
364
- if (now() + pollMs + INVOKE_BUDGET_MS >= deadline)
365
- break;
366
- await sleep(pollMs);
367
- }
368
- // Window expired with the job still running: a CONTINUATION (success), not
369
- // an error. The job keeps executing server-side; the caller re-invokes
370
- // wait_job to keep waiting. This is what makes wait_job an honest bounded
371
- // long-poll on capped transports instead of a misleading failure.
372
- const tail = lastStatus ? ` Last status: ${lastStatus}.` : '';
373
- return {
374
- ok: true,
375
- stillRunning: true,
376
- text: `Still running — the ${kind} job continues server-side.${tail} Call wait_job again with the SAME arguments (kind="${kind}", id="${id}"${projectId ? `, projectId="${projectId}"` : ''}) to keep waiting. For event-driven fan-out, create_webhook delivers the terminal instead.`,
377
- };
378
- }
@@ -1,66 +0,0 @@
1
- /**
2
- * x402-over-MCP wire constants + helpers, VENDORED from the first-party
3
- * `@x402/mcp` package and pinned to it by `x402Meta.conformance.test.ts`.
4
- *
5
- * Why vendored instead of `import … from "@x402/mcp"`: the published `@x402/mcp`
6
- * dist is a single bundle that imports `@x402/core/client` + `/server`
7
- * (viem/Buffer) at MODULE scope, so importing even a constant drags Buffer into
8
- * the Convex V8 isolate — the exact failure `x402Facilitator.ts` is `"use node"`
9
- * to avoid. This module is plain-JSON + `btoa` only, so it is V8-safe and runs in
10
- * both the hosted (V8 isolate) and stdio (Node) transports. Same generator/runtime
11
- * split as `x402Discovery` (a Node test tracks the spec; the runtime reads plain
12
- * data). The conformance test fails if these drift from `@x402/mcp`.
13
- *
14
- * The convention (Cloudflare/Coinbase/Vercel + `@x402/mcp`): over MCP, payment
15
- * rides in the JSON-RPC `_meta` field, NOT an HTTP header — MCP is transport-
16
- * agnostic (stdio has no HTTP layer). The `PaymentPayload` / `PaymentRequired`
17
- * objects are byte-identical to CueFrame's REST v2 envelope; only the carrier
18
- * differs (`_meta` key vs `PAYMENT-SIGNATURE`/`Payment-Required` header).
19
- */
20
- /** Client → server: the signed EIP-3009 `PaymentPayload`, on the tools/call `_meta`. */
21
- export const MCP_PAYMENT_META_KEY = 'x402/payment';
22
- /** JSON-RPC error code a paid tool returns when called unpaid. */
23
- export const MCP_PAYMENT_REQUIRED_CODE = 402;
24
- /**
25
- * True iff a parsed body is a canonical x402 `PaymentRequired` challenge (has a
26
- * numeric `x402Version` and an `accepts` array) — matching the @x402/mcp client's
27
- * `isPaymentRequiredStructure`. Used to tell the REAL 402 payment challenge apart
28
- * from the OTHER errors that share HTTP 402 (billing_required,
29
- * generation_budget_exceeded, payment_invalid, …), which must surface as typed
30
- * errors, not an x402 "sign a payment" prompt.
31
- */
32
- export function isX402PaymentRequired(body) {
33
- return (!!body &&
34
- typeof body === 'object' &&
35
- typeof body.x402Version === 'number' &&
36
- Array.isArray(body.accepts));
37
- }
38
- /**
39
- * Read the client's signed payment (a `PaymentPayload` object) off a tools/call
40
- * `_meta`. Returns the raw object or null; the STRUCTURE is validated downstream
41
- * by the facilitator's EIP-3009 decode (single source of truth), so this is a
42
- * presence/shape gate only — never trust it as verified payment.
43
- */
44
- export function extractPaymentFromMeta(meta) {
45
- const p = meta?.[MCP_PAYMENT_META_KEY];
46
- return p && typeof p === 'object' ? p : null;
47
- }
48
- /**
49
- * Encode a `PaymentPayload` object into the base64 `PAYMENT-SIGNATURE` header
50
- * value the REST x402 middleware decodes (`@x402/core` `encodePaymentSignatureHeader`
51
- * = `safeBase64Encode(JSON.stringify(payload))`). `btoa`-based → V8-safe; mirrors
52
- * `@x402/core`'s own `safeBase64Encode` (which is also btoa-first). This lets an
53
- * MCP tool call forward its `_meta` payment INTO the unchanged REST verify/settle
54
- * path via the inner `app.fetch`, reusing all money-safety.
55
- */
56
- export function encodePaymentSignature(payload) {
57
- const bytes = new TextEncoder().encode(JSON.stringify(payload));
58
- let binary = '';
59
- for (let i = 0; i < bytes.length; i++)
60
- binary += String.fromCharCode(bytes[i]);
61
- return btoa(binary);
62
- }
63
- // NB: no `attachPaymentResponseToMeta` / `decodePaymentResponse` — CueFrame does
64
- // NOT emit an inline settle receipt (settle is async; the caller reads the final
65
- // outcome from x402Payments). If a synchronous-settle receipt is ever added,
66
- // re-vendor those two @x402/mcp helpers here with a conformance test.
@@ -1,175 +0,0 @@
1
- import { z } from "zod";
2
- import { zid } from "convex-helpers/server/zod3";
3
- // Phase labels for media processing. One canonical vocabulary across desktop,
4
- // Convex, and OpenAPI — no per-consumer redefinition. Superset of every stage
5
- // either side runs:
6
- // shared: idle → pending_import → pending_upload → uploading → ...
7
- // → complete | error | cancelled
8
- // desktop-local: extracting (audio extract), loading_model (whisper download),
9
- // transcribing, proxy (low-res preview transcode), embedding,
10
- // analyzing, indexing
11
- // cloud-only: generating (TTS / text-to-image), rendering (final encode)
12
- // intermediate: processing (generic in-flight when no specific stage applies)
13
- //
14
- // Legacy cloud writers that wrote 'completed'/'ready'/'failed'/'in_progress'/
15
- // 'transcoding' map onto this canonical via projectStatus() in
16
- // projections/mediaItems.ts; the data migration in PR 2 backfills them.
17
- export const MediaProcessingPhase = z.enum([
18
- "idle",
19
- "pending_import",
20
- "pending_upload",
21
- "uploading",
22
- "extracting",
23
- "loading_model",
24
- "transcribing",
25
- "proxy",
26
- "embedding",
27
- "analyzing",
28
- "indexing",
29
- "generating",
30
- "rendering",
31
- "processing",
32
- "complete",
33
- "error",
34
- "cancelled",
35
- ]);
36
- // ProxyStatus — lifecycle of the low-res preview proxy file. One canonical
37
- // enum across desktop SQLite, Convex `mediaItems.proxyStatus`, and any
38
- // OpenAPI shape that exposes proxy state.
39
- export const ProxyStatus = z.enum([
40
- "none",
41
- "generating",
42
- "ready",
43
- "failed",
44
- ]);
45
- // MediaProcessingStatus — runtime state object combining phase + progress
46
- // detail. This is the single shape every consumer (desktop, Convex storage,
47
- // OpenAPI responses) sees. Older code that referenced `MediaProcessingStatus`
48
- // as an enum should now reference `MediaProcessingPhase`; older code that
49
- // hand-defined a `{phase, percent, message, error}` object (OpenAPI, desktop
50
- // discriminated unions) should now import this.
51
- // percent/message/error are nullable AND optional — desktop construction
52
- // sites typically omit them (`{ phase: 'idle' }`), worker writes nullable
53
- // (e.g. `{ phase: 'processing', percent: 60, message: 'Transcribing', error: null }`),
54
- // OpenAPI emission preserves whichever the producer sent. Consumers tolerate
55
- // any of: present-with-value | present-with-null | omitted.
56
- export const MediaProcessingStatus = z.object({
57
- phase: MediaProcessingPhase,
58
- percent: z.number().nullable().optional(),
59
- message: z.string().nullable().optional(),
60
- error: z.string().nullable().optional(),
61
- });
62
- // MediaUnderstanding — populated by the visual/topical analysis stage.
63
- // Shape is intentionally permissive at P0; pipeline stages may extend it.
64
- export const MediaUnderstanding = z.object({
65
- summary: z.string().optional(),
66
- topics: z.array(z.string()).optional(),
67
- language: z.string().optional(),
68
- notes: z.string().optional(),
69
- extra: z.record(z.string(), z.unknown()).optional(),
70
- });
71
- // Generation — present iff MediaItem.source === 'generated'.
72
- // Provider is an open string mapping to a server-side generator registered with credentials;
73
- // new providers are additions to the generator registry, not schema migrations.
74
- export const TextToSpeechGeneration = z.object({
75
- kind: z.literal("text-to-speech"),
76
- provider: z.string().min(1),
77
- text: z.string().min(1),
78
- voice: z.string().min(1),
79
- params: z.record(z.string(), z.unknown()).optional(),
80
- });
81
- export const TextToImageGeneration = z.object({
82
- kind: z.literal("text-to-image"),
83
- provider: z.string().min(1),
84
- prompt: z.string().min(1),
85
- params: z.record(z.string(), z.unknown()).optional(),
86
- });
87
- export const ImageToVideoGeneration = z.object({
88
- kind: z.literal("image-to-video"),
89
- provider: z.string().min(1),
90
- sourceMediaId: zid("mediaItems"),
91
- prompt: z.string().optional(),
92
- params: z.record(z.string(), z.unknown()).optional(),
93
- });
94
- export const ManimGeneration = z.object({
95
- kind: z.literal("manim"),
96
- scriptId: z.string().optional(),
97
- inlineScript: z.string().optional(),
98
- params: z.record(z.string(), z.unknown()).optional(),
99
- });
100
- export const Generation = z.discriminatedUnion("kind", [
101
- TextToSpeechGeneration,
102
- TextToImageGeneration,
103
- ImageToVideoGeneration,
104
- ManimGeneration,
105
- ]);
106
- // TranscriptRef — pointer to the transcript artifact (full word-level data lives in R2,
107
- // the row carries metadata + R2 key). `ready` flips when the transcribe stage completes.
108
- export const TranscriptRef = z.object({
109
- id: z.string().min(1),
110
- ready: z.boolean(),
111
- });
112
- // Agent-perception surface (filmstrip + per-frame analysis) — populated by
113
- // the perception pipeline stage post-ingestion. Placed before MediaItem so
114
- // MediaItem's `perception` field resolves.
115
- // FrameAnalysis — analysis derived from a single sampled frame: spatial
116
- // regions (faces, primary subject, safe regions for overlay placement) and
117
- // non-spatial signals (dominant colors). Keyed by timestamp `t`.
118
- export const FrameAnalysis = z.object({
119
- t: z.number().nonnegative(),
120
- faces: z.array(z.object({
121
- bbox: z.tuple([z.number(), z.number(), z.number(), z.number()]),
122
- confidence: z.number().min(0).max(1).optional(),
123
- })).optional(),
124
- primarySubject: z.object({
125
- bbox: z.tuple([z.number(), z.number(), z.number(), z.number()]),
126
- }).optional(),
127
- safeRegions: z.array(z.object({
128
- bbox: z.tuple([z.number(), z.number(), z.number(), z.number()]),
129
- kind: z.string().optional(),
130
- })).optional(),
131
- dominantColors: z.array(z.string()).optional(),
132
- });
133
- export const Filmstrip = z.object({
134
- mediaId: zid("mediaItems"),
135
- sheetUrl: z.string().url(),
136
- frameCount: z.number().int().positive(),
137
- frameInterval: z.number().positive(),
138
- frameWidth: z.number().int().positive(),
139
- frameHeight: z.number().int().positive(),
140
- columns: z.number().int().positive(),
141
- });
142
- // Perception — bundle of pre-computed perception artifacts for a MediaItem row.
143
- // Filmstrip is the visual artifact (sprite-sheet); frameAnalysis[] is the
144
- // per-moment structured analysis. Read by agents reasoning about content
145
- // without re-decoding the source.
146
- export const Perception = z.object({
147
- mediaId: zid("mediaItems"),
148
- filmstrip: Filmstrip.optional(),
149
- frameAnalysis: z.array(FrameAnalysis).optional(),
150
- });
151
- export const MediaItem = z.object({
152
- id: zid("mediaItems"),
153
- // Track-routing kind; not in the data-model.md spec but load-bearing for
154
- // the existing storage pipeline. video/audio/image determine ingest path.
155
- kind: z.enum(["video", "audio", "image"]),
156
- filename: z.string().min(1),
157
- // Aliased per data-model.md § MediaItem — `mimeType` is the doc name; `size` is bytes.
158
- mimeType: z.string().min(1),
159
- size: z.number().int().nonnegative(),
160
- duration: z.number().nonnegative().optional(), // seconds; populated post-transcode
161
- width: z.number().int().positive().optional(),
162
- height: z.number().int().positive().optional(),
163
- fps: z.number().positive().optional(),
164
- status: MediaProcessingPhase,
165
- source: z.enum(["upload", "generated"]).optional(),
166
- generation: Generation.optional(),
167
- // Derived data populated through the pipeline
168
- transcript: TranscriptRef.optional(),
169
- mediaUnderstanding: MediaUnderstanding.optional(),
170
- perception: Perception.optional(),
171
- // Lifecycle timestamps — epoch ms (see CONVEX_ADAPTATIONS.md)
172
- createdAt: z.number(),
173
- updatedAt: z.number(),
174
- ownerOrgId: z.string().optional(),
175
- });
@@ -1 +0,0 @@
1
- export * from "./api";