cozyclay 2.1.1 → 3.0.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 (577) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +12 -30
  3. package/bin/agent/agent-routes.mjs +40 -113
  4. package/bin/agent/agent-runner.mjs +9 -10
  5. package/bin/agent/cliproxy-provider.mjs +135 -0
  6. package/bin/agent/credential-store.mjs +30 -7
  7. package/bin/agent/pi-tools.mjs +4 -1
  8. package/bin/agent/provider-keys.mjs +32 -0
  9. package/bin/agent/provider-login.mjs +110 -0
  10. package/bin/agent/provider-routes.mjs +99 -0
  11. package/bin/agent/providers.mjs +19 -97
  12. package/bin/agent/script-tool.mjs +17 -4
  13. package/bin/agent/studio-motion-reference.mjs +23 -0
  14. package/bin/agent/studio-prompt.mjs +1 -1
  15. package/bin/agent/studio-rebase-text.mjs +32 -0
  16. package/bin/agent/studio-rebase.mjs +26 -39
  17. package/bin/agent/studio-tools.mjs +9 -28
  18. package/bin/agent/tool-arguments.mjs +49 -0
  19. package/bin/agent/turn-frames.mjs +66 -0
  20. package/bin/codex-auth.mjs +9 -2
  21. package/bin/cozyclay.mjs +10 -116
  22. package/bin/live/cli.mjs +3 -3
  23. package/bin/mcp-runtime.mjs +2 -12
  24. package/bin/package-signature.mjs +0 -4
  25. package/dist/app/index.html +7 -6
  26. package/dist/assets/EXRLoader-CvVIvGVE.js +1 -0
  27. package/dist/assets/analytics-C9sUnndd.js +1 -0
  28. package/dist/assets/app-CCh--1Hc.js +5087 -0
  29. package/dist/assets/app-f-fkV5uP.css +1 -0
  30. package/dist/assets/compile-worker-CkxiD6lH.js +5 -0
  31. package/dist/assets/fflate.module-KbGj5-H6.js +5 -0
  32. package/dist/assets/{first-shot-handoff-msLI71g1.js → first-shot-handoff-CC4xe4HM.js} +1 -1
  33. package/dist/assets/{landing-ChUvB_zL.js → landing-DjHD8u7k.js} +1 -1
  34. package/dist/assets/scene-asset-sync-Hx_FzdOH.js +20 -0
  35. package/dist/assets/scene-asset-sync-_S8NQl5B.css +1 -0
  36. package/dist/assets/workflow-C4yKH1p4.js +179 -0
  37. package/dist/cozyclay-package.json +1 -1
  38. package/dist/index.html +3 -3
  39. package/dist/sw.js +3 -6
  40. package/dist/workflow/index.html +5 -4
  41. package/mcp/LIVE-PROTOCOL.md +7 -47
  42. package/mcp/README.md +16 -26
  43. package/mcp/live-hub.mjs +6 -10
  44. package/mcp/package.json +1 -3
  45. package/mcp/tool-handlers.mjs +4 -168
  46. package/package.json +3 -22
  47. package/src/App.jsx +150 -2624
  48. package/src/agent-progress.js +79 -0
  49. package/src/agent-turn-mark.js +30 -0
  50. package/src/analytics.js +1 -19
  51. package/src/app-context.js +5 -0
  52. package/src/app-stage.jsx +2 -34
  53. package/src/asset-pane.jsx +6 -5
  54. package/src/camera-block.js +21 -0
  55. package/src/camera-direction.js +120 -0
  56. package/src/character-kind.js +3 -9
  57. package/src/command-bus.js +8 -6
  58. package/src/commands/cast.js +5 -34
  59. package/src/commands/elements/character.js +1 -1
  60. package/src/commands/elements/motion.js +1 -6
  61. package/src/commands/elements/object.js +6 -2
  62. package/src/commands/elements/shot.js +4 -1
  63. package/src/commands/elements.js +38 -14
  64. package/src/commands/index.js +3 -1
  65. package/src/commands/kits.js +37 -0
  66. package/src/commands/motion-timing.js +57 -0
  67. package/src/commands/motion.js +9 -152
  68. package/src/commands/motion3-compile.js +65 -0
  69. package/src/commands/motion3.js +207 -0
  70. package/src/commands/objects.js +6 -4
  71. package/src/commands/shot.js +49 -11
  72. package/src/commands/stage.js +14 -1
  73. package/src/commands/view.js +4 -1
  74. package/src/document-mirrors.js +42 -0
  75. package/src/document-store.js +4 -0
  76. package/src/domains/cast.js +19 -194
  77. package/src/domains/motion/motion-range-pin-rules.js +1 -1
  78. package/src/domains/motion/take-source.js +51 -0
  79. package/src/domains/motion.js +60 -1838
  80. package/src/domains/scenes.js +12 -55
  81. package/src/domains/shots.js +2 -2
  82. package/src/domains/stage.js +4 -2
  83. package/src/draft-ghost.js +46 -0
  84. package/src/draft-ghost.jsx +129 -0
  85. package/src/dualview.jsx +4 -3
  86. package/src/effects/EffectsLayer.jsx +112 -0
  87. package/src/effects/effect-meshes.js +232 -0
  88. package/src/effects/effect-record.js +103 -0
  89. package/src/effects/emitter.js +59 -0
  90. package/src/effects/simulate.js +261 -0
  91. package/src/effects/state.js +59 -0
  92. package/src/execution-telemetry.js +2 -3
  93. package/src/first-success-guide.jsx +5 -5
  94. package/src/ghost-set.js +257 -0
  95. package/src/held-object-edit.jsx +113 -0
  96. package/src/held-object-pose.js +175 -0
  97. package/src/hierarchy-model.js +1 -1
  98. package/src/hierarchy-panel.jsx +1 -1
  99. package/src/imported-mesh.jsx +103 -0
  100. package/src/kits/held.js +84 -0
  101. package/src/kits/index.js +70 -0
  102. package/src/kits/smoking.js +57 -0
  103. package/src/light-blockers.js +93 -0
  104. package/src/motion/beat-board-model.js +84 -0
  105. package/src/motion/beat-board.css +124 -0
  106. package/src/motion/beat-board.jsx +59 -0
  107. package/src/motion/center-of-mass.js +66 -0
  108. package/src/motion/fix-collisions.js +850 -0
  109. package/src/motion/physics-review.js +118 -0
  110. package/src/{ardy → motion}/physics-support.js +1 -76
  111. package/src/motion/rig-snapshot.js +22 -0
  112. package/src/motion/take-segments.jsx +140 -0
  113. package/src/{ardy → motion}/timeline-coordinates.js +0 -21
  114. package/src/{ardy → motion}/timeline.css +1 -2
  115. package/src/{ardy → motion}/timeline.jsx +42 -413
  116. package/src/motion/waypoints.js +76 -0
  117. package/src/motion3/beats.js +83 -0
  118. package/src/motion3/body.js +158 -0
  119. package/src/motion3/bones.js +47 -0
  120. package/src/motion3/carried.js +47 -0
  121. package/src/motion3/compile-job.js +75 -0
  122. package/src/motion3/compile-worker.js +10 -0
  123. package/src/motion3/compiler/anchors.js +105 -0
  124. package/src/motion3/compiler/arm-orient.js +128 -0
  125. package/src/motion3/compiler/channels.js +125 -0
  126. package/src/motion3/compiler/compile.js +205 -0
  127. package/src/motion3/compiler/gait-rhythm.js +97 -0
  128. package/src/motion3/compiler/grip.js +171 -0
  129. package/src/motion3/compiler/head-steady.js +48 -0
  130. package/src/motion3/compiler/hold.js +134 -0
  131. package/src/motion3/compiler/idle.js +113 -0
  132. package/src/motion3/compiler/limbs.js +170 -0
  133. package/src/motion3/compiler/math.js +72 -0
  134. package/src/motion3/compiler/pose.js +162 -0
  135. package/src/motion3/compiler/quat.js +49 -0
  136. package/src/motion3/compiler/skeleton.js +74 -0
  137. package/src/motion3/compiler/validate-common.js +32 -0
  138. package/src/motion3/compiler/validate-goals.js +118 -0
  139. package/src/motion3/compiler/validate-objects.js +143 -0
  140. package/src/motion3/compiler/validate-parts.js +116 -0
  141. package/src/motion3/compiler/validate.js +122 -0
  142. package/src/motion3/compiler/vocab.js +73 -0
  143. package/src/motion3/compiler/walk-pelvis.js +275 -0
  144. package/src/motion3/compiler/walk.js +207 -0
  145. package/src/motion3/compiler/wrist-clamp.js +32 -0
  146. package/src/motion3/delta.js +47 -0
  147. package/src/motion3/describe.js +174 -0
  148. package/src/motion3/docs.js +27 -0
  149. package/src/motion3/edit-carry.js +21 -0
  150. package/src/motion3/fix/ease.js +16 -0
  151. package/src/motion3/fix/ground.js +37 -0
  152. package/src/motion3/fix/index.js +52 -0
  153. package/src/motion3/fix/push.js +71 -0
  154. package/src/motion3/fix/reach.js +46 -0
  155. package/src/motion3/fix/retime.js +79 -0
  156. package/src/motion3/fix/self.js +211 -0
  157. package/src/motion3/fix/slide.js +70 -0
  158. package/src/motion3/fix/turn.js +51 -0
  159. package/src/motion3/follow.js +39 -0
  160. package/src/motion3/free-motion.js +173 -0
  161. package/src/motion3/grip-choice.js +130 -0
  162. package/src/motion3/hold-plan.js +157 -0
  163. package/src/motion3/json-patch.js +77 -0
  164. package/src/motion3/key-aim.js +105 -0
  165. package/src/motion3/key-edit.js +82 -0
  166. package/src/motion3/lenient.js +127 -0
  167. package/src/motion3/object-keys.js +236 -0
  168. package/src/motion3/object-pose.js +182 -0
  169. package/src/motion3/object-tracks.js +12 -0
  170. package/src/motion3/pipeline.js +102 -0
  171. package/src/motion3/playback.js +51 -0
  172. package/src/motion3/probes.js +91 -0
  173. package/src/motion3/qa/body-checks.js +34 -0
  174. package/src/motion3/qa/check-names.js +14 -0
  175. package/src/motion3/qa/checks.js +121 -0
  176. package/src/motion3/qa/contact-checks.js +51 -0
  177. package/src/motion3/qa/explain.js +80 -0
  178. package/src/motion3/qa/fmt.js +5 -0
  179. package/src/motion3/qa/foot-checks.js +72 -0
  180. package/src/motion3/qa/geometry.js +77 -0
  181. package/src/motion3/qa/goals.js +191 -0
  182. package/src/motion3/qa/ground.js +60 -0
  183. package/src/motion3/qa/hints-contact.js +179 -0
  184. package/src/motion3/qa/hints-goal.js +160 -0
  185. package/src/motion3/qa/hints-knee.js +24 -0
  186. package/src/motion3/qa/hints-motion.js +209 -0
  187. package/src/motion3/qa/hints-object.js +91 -0
  188. package/src/motion3/qa/index.js +42 -0
  189. package/src/motion3/qa/key-checks.js +82 -0
  190. package/src/motion3/qa/near.js +96 -0
  191. package/src/motion3/qa/object-checks.js +135 -0
  192. package/src/motion3/qa/patch.js +161 -0
  193. package/src/motion3/qa/severity.js +38 -0
  194. package/src/motion3/qa/spec-checks.js +65 -0
  195. package/src/motion3/qa/style.js +218 -0
  196. package/src/motion3/qa/wrist-checks.js +69 -0
  197. package/src/motion3/qa/wrist-obs.js +60 -0
  198. package/src/motion3/refs.js +120 -0
  199. package/src/motion3/repair-tune.js +121 -0
  200. package/src/motion3/repair.js +83 -0
  201. package/src/motion3/report.js +67 -0
  202. package/src/motion3/rigs/index.js +14 -0
  203. package/src/motion3/rigs/x-bot-tpose-body.json +1 -0
  204. package/src/motion3/rigs/x-bot-tpose.json +1 -0
  205. package/src/motion3/rigs/y-bot-tpose-body.json +1 -0
  206. package/src/motion3/rigs/y-bot-tpose.json +1 -0
  207. package/src/motion3/scene.js +60 -0
  208. package/src/motion3/schema/brief.js +89 -0
  209. package/src/motion3/schema/fields.js +44 -0
  210. package/src/motion3/schema/spec-examples.js +46 -0
  211. package/src/motion3/schema/topics.js +111 -0
  212. package/src/motion3/schema/types.js +147 -0
  213. package/src/motion3/search.js +117 -0
  214. package/src/motion3/second-hand.js +112 -0
  215. package/src/motion3/skills/basic.js +82 -0
  216. package/src/motion3/skills/book.js +76 -0
  217. package/src/motion3/skills/car.js +145 -0
  218. package/src/motion3/skills/frames-auto.js +29 -0
  219. package/src/motion3/skills/index.js +83 -0
  220. package/src/motion3/skills/info.js +65 -0
  221. package/src/motion3/skills/smoke-kit.js +109 -0
  222. package/src/motion3/skills/smoke.js +160 -0
  223. package/src/motion3/spec-store.js +59 -0
  224. package/src/motion3/take-edit.js +155 -0
  225. package/src/motion3/take.js +63 -0
  226. package/src/motion3/timeline.js +127 -0
  227. package/src/motion3/views.js +121 -0
  228. package/src/motion3/walk-plan.js +119 -0
  229. package/src/object-catalog.jsx +7 -1
  230. package/src/object-colors.js +98 -0
  231. package/src/object-gizmo-parts.js +115 -0
  232. package/src/object-gizmo.jsx +37 -122
  233. package/src/object-glow.js +139 -0
  234. package/src/object-hidden.js +33 -0
  235. package/src/object-look.js +196 -0
  236. package/src/object-size.js +10 -0
  237. package/src/object-travel.js +71 -6
  238. package/src/panels/CameraPanel.jsx +7 -7
  239. package/src/panels/HdrEnvironmentControls.jsx +59 -0
  240. package/src/panels/LightPanel.jsx +25 -4
  241. package/src/panels/ObjectLookPanel.jsx +88 -0
  242. package/src/panels/PosePanel.jsx +2 -17
  243. package/src/panels/RigControlPanel.jsx +5 -53
  244. package/src/panels/SubjectBox.jsx +4 -1
  245. package/src/panels/details.css +14 -0
  246. package/src/posestudio.jsx +4 -27
  247. package/src/project-browser.jsx +3 -4
  248. package/src/project-resources.js +18 -31
  249. package/src/project.js +13 -104
  250. package/src/props.jsx +25 -280
  251. package/src/rail-dot-drag.js +23 -0
  252. package/src/render-passes.js +10 -0
  253. package/src/resource-status.jsx +1 -0
  254. package/src/result-modal.jsx +4 -19
  255. package/src/room.jsx +20 -12
  256. package/src/scene-assets.js +8 -6
  257. package/src/scene-light-place.js +72 -0
  258. package/src/scene-lights.jsx +148 -0
  259. package/src/scene-objects.js +31 -139
  260. package/src/scenes.js +15 -105
  261. package/src/semantic-edit.js +2 -5
  262. package/src/set-pieces.jsx +183 -0
  263. package/src/settings-menu.jsx +3 -11
  264. package/src/shell/BottomDock.jsx +9 -51
  265. package/src/shell/DetailsSlot.jsx +16 -200
  266. package/src/shell/GhostsMenuGroup.jsx +74 -0
  267. package/src/shell/LibrarySlot.jsx +1 -3
  268. package/src/shell/MenuBar.jsx +3 -3
  269. package/src/shell/PreferencesDialog.jsx +15 -264
  270. package/src/shell/PreferencesSlot.jsx +2 -8
  271. package/src/shell/TopBar.jsx +5 -84
  272. package/src/shell/ViewportToolbar.jsx +10 -70
  273. package/src/shell/agent-glass.css +19 -6
  274. package/src/shell/details-selection.js +42 -0
  275. package/src/shell/ghosts-menu.css +22 -0
  276. package/src/shell/glass-regions.css +29 -3
  277. package/src/shell/preferences.css +6 -1
  278. package/src/shot-authoring.js +4 -7
  279. package/src/soft-shadows.js +37 -0
  280. package/src/stage-attach-frames.js +12 -12
  281. package/src/stage-canvas-rigs.jsx +3 -3
  282. package/src/stage-capture.jsx +42 -8
  283. package/src/stage-characters.jsx +22 -216
  284. package/src/stage-editor-gizmos.jsx +6 -6
  285. package/src/stage-environment.js +93 -0
  286. package/src/stage-hdr-builtins.js +107 -0
  287. package/src/stage-hdr-image.js +116 -0
  288. package/src/stage-hdr-library.js +70 -0
  289. package/src/stage-hdr-map.js +94 -0
  290. package/src/stage-hdr.js +130 -0
  291. package/src/stage-lighting.js +149 -0
  292. package/src/stage-occlusion.js +210 -0
  293. package/src/stage-sky.jsx +159 -0
  294. package/src/stage-startup-defaults.js +5 -9
  295. package/src/studio-actions.js +12 -14
  296. package/src/studio-agent-commands.js +19 -16
  297. package/src/studio-agent-motion.js +9 -9
  298. package/src/studio-agent-protocol.js +41 -71
  299. package/src/studio-app-binding.js +25 -45
  300. package/src/studio-asset-list.js +17 -0
  301. package/src/studio-contact-sheet.js +37 -5
  302. package/src/studio-elements.js +27 -7
  303. package/src/studio-entity-bounds.js +18 -0
  304. package/src/studio-error-codes.js +8 -0
  305. package/src/studio-export-framing.js +152 -0
  306. package/src/studio-lighting-check.js +103 -0
  307. package/src/studio-motion-visual.js +150 -0
  308. package/src/studio-schema-errors.js +80 -0
  309. package/src/studio-support-gap.js +74 -0
  310. package/src/styles.css +1 -19
  311. package/src/timeline-defaults.js +5 -0
  312. package/src/timeline-extent.js +8 -20
  313. package/src/tutorial-walk.js +17 -0
  314. package/src/ui-scrub.js +1 -1
  315. package/src/use-shot-camera-tracks.js +12 -0
  316. package/src/view-ghosts.js +97 -0
  317. package/src/view-ghosts.jsx +49 -0
  318. package/src/workflow/AgentPanel.jsx +47 -166
  319. package/src/workflow/AgentProgressCard.jsx +107 -0
  320. package/src/workflow/AgentReplyText.jsx +37 -0
  321. package/src/workflow/AgentTurnSteps.jsx +84 -0
  322. package/src/workflow/LoginPanel.jsx +140 -0
  323. package/src/workflow/WorkflowBuilder.jsx +7 -23
  324. package/src/workflow/agent-client.js +54 -51
  325. package/src/workflow/agent-panel.css +71 -1
  326. package/src/workflow/agent-progress-card.css +167 -0
  327. package/src/workflow/agent-progress-view.js +47 -0
  328. package/src/workflow/agent-turn-steps.css +113 -0
  329. package/src/workflow/agent-turn.js +191 -0
  330. package/src/workflow/login-client.js +34 -0
  331. package/src/workflow/motion-input.js +18 -31
  332. package/src/workflow/node-schema.js +1 -1
  333. package/src/workflow/reply-markdown.js +69 -0
  334. package/src/workflow/scene-asset-sync.js +8 -8
  335. package/tools/agent-session-stats.mjs +61 -0
  336. package/tools/dev-full.mjs +5 -56
  337. package/tools/eslint-baseline.json +12 -13
  338. package/tools/knip-baseline.json +0 -179
  339. package/tools/loc-baseline.json +31 -81
  340. package/tools/motion3/extract-body.mjs +103 -0
  341. package/tools/motion3/extract-rig.mjs +85 -0
  342. package/tools/process-supervisor.mjs +0 -88
  343. package/tools/run-tests.mjs +8 -124
  344. package/bin/agent/motion-runtime.mjs +0 -76
  345. package/dist/ardy/cskel27-rest.json +0 -557
  346. package/dist/assets/analytics-C9pMpW7s.js +0 -1
  347. package/dist/assets/app-B_2XB9rw.css +0 -1
  348. package/dist/assets/app-DAuvKPP8.js +0 -4920
  349. package/dist/assets/config-Bx7pYsD9.js +0 -1
  350. package/dist/assets/config-DeoFTYzb.css +0 -1
  351. package/dist/assets/demo-CvKuBgy5.js +0 -1
  352. package/dist/assets/scene-asset-sync-DKkpjKBV.js +0 -19
  353. package/dist/assets/scene-asset-sync-DjJ_cJ2R.css +0 -1
  354. package/dist/assets/ticket-BPk2Ni95.js +0 -1
  355. package/dist/assets/workflow-jJRBR94Z.js +0 -179
  356. package/dist/demo/walk-then-stop.npz +0 -0
  357. package/mcp/ardy-prompts.mjs +0 -218
  358. package/src/ardy/auto-fix-panel.css +0 -108
  359. package/src/ardy/auto-physics.js +0 -1194
  360. package/src/ardy/client.js +0 -153
  361. package/src/ardy/convert.js +0 -313
  362. package/src/ardy/cskel27-neutral.js +0 -39
  363. package/src/ardy/cskel27.js +0 -77
  364. package/src/ardy/export.js +0 -165
  365. package/src/ardy/fix-collisions.js +0 -2257
  366. package/src/ardy/foot-lock.js +0 -230
  367. package/src/ardy/motion-calibration.js +0 -118
  368. package/src/ardy/motion-edit.js +0 -213
  369. package/src/ardy/motion-url.js +0 -55
  370. package/src/ardy/mp4-duration.js +0 -102
  371. package/src/ardy/npz.js +0 -595
  372. package/src/ardy/physics-panel.css +0 -21
  373. package/src/ardy/physics-panel.jsx +0 -89
  374. package/src/ardy/physics-refine.js +0 -111
  375. package/src/ardy/physics-review.js +0 -567
  376. package/src/ardy/physics-temporal.js +0 -54
  377. package/src/ardy/platform-fit-panel.css +0 -64
  378. package/src/ardy/platform-fit-panel.jsx +0 -41
  379. package/src/ardy/platform-fit.js +0 -326
  380. package/src/ardy/playback.js +0 -711
  381. package/src/ardy/pose-pin.js +0 -97
  382. package/src/ardy/prompt-clips.js +0 -30
  383. package/src/ardy/retime.js +0 -211
  384. package/src/ardy/root-drop.js +0 -369
  385. package/src/ardy/timeline-resize.js +0 -13
  386. package/src/ardy/to-cskel27.js +0 -225
  387. package/src/ardy/trim.js +0 -33
  388. package/src/ardy/waypoints.js +0 -369
  389. package/src/ardy-bridge-contract.js +0 -281
  390. package/src/domains/motion/motion-video-capture.js +0 -664
  391. package/src/i2v-motion-client.js +0 -77
  392. package/src/i2v-motion-studio.jsx +0 -180
  393. package/src/line-edit.js +0 -1348
  394. package/src/motion/generation.js +0 -105
  395. package/src/motion-readiness-ui.jsx +0 -67
  396. package/src/motion-readiness.js +0 -40
  397. package/src/motion-resources.js +0 -177
  398. package/src/motion-store.js +0 -65
  399. package/src/motion-trail.js +0 -601
  400. package/src/multimodel-ingest.js +0 -394
  401. package/src/panels/PromptBlocksPanel.jsx +0 -444
  402. package/src/panels/VideoCapturePanel.jsx +0 -181
  403. package/src/pose-extract/browser.js +0 -42
  404. package/src/pose-extract/detector.js +0 -100
  405. package/src/pose-extract/fit.js +0 -227
  406. package/src/pose-extract/image-frame.js +0 -51
  407. package/src/pose-extract/index.js +0 -58
  408. package/src/pose-extract/keyframes.js +0 -74
  409. package/src/pose-extract/landmarks.js +0 -162
  410. package/src/pose-extract/mirror.js +0 -153
  411. package/src/pose-extract/take.js +0 -131
  412. package/src/pose-extract/video-frames.js +0 -91
  413. package/src/take-recipe.js +0 -165
  414. package/src/trail-key-conflicts.js +0 -39
  415. package/src/trail-pick.js +0 -59
  416. package/src/use-i2v-capture-modal.js +0 -15
  417. package/tools/ardy/BRIDGE.md +0 -37
  418. package/tools/ardy/GVHMR-NPZ.md +0 -68
  419. package/tools/ardy/README.md +0 -124
  420. package/tools/ardy/__pycache__/cclay_gvhmr_worker.cpython-313.pyc +0 -0
  421. package/tools/ardy/artifacts.mjs +0 -34
  422. package/tools/ardy/bridge.mjs +0 -1732
  423. package/tools/ardy/bvh-cskel27.mjs +0 -1265
  424. package/tools/ardy/cclay_constrained_generate.py +0 -561
  425. package/tools/ardy/cclay_gvhmr_worker.py +0 -264
  426. package/tools/ardy/cclay_motion_edit.py +0 -510
  427. package/tools/ardy/cclay_sequence_generate.py +0 -705
  428. package/tools/ardy/cclay_worker.py +0 -304
  429. package/tools/ardy/dump-npz.py +0 -205
  430. package/tools/ardy/extract-rest.mjs +0 -299
  431. package/tools/ardy/extract.mjs +0 -507
  432. package/tools/ardy/footage.mjs +0 -467
  433. package/tools/ardy/gvhmr-floor.mjs +0 -102
  434. package/tools/ardy/gvhmr-to-cskel27.mjs +0 -21
  435. package/tools/ardy/gvhmr_fastpath.py +0 -168
  436. package/tools/ardy/gvhmr_trajectory.py +0 -240
  437. package/tools/ardy/merge-text-encoder.py +0 -160
  438. package/tools/ardy/mocap-metrics.mjs +0 -200
  439. package/tools/ardy/mocap-quality-gate.mjs +0 -110
  440. package/tools/ardy/motion-stabilize.mjs +0 -348
  441. package/tools/ardy/npz.mjs +0 -414
  442. package/tools/ardy/pose-to-npz.mjs +0 -106
  443. package/tools/ardy/prompt-limits.mjs +0 -5
  444. package/tools/ardy/run-edit-on-box.sh +0 -73
  445. package/tools/ardy/run-local.mjs +0 -233
  446. package/tools/ardy/run-on-box.sh +0 -593
  447. package/tools/ardy/run-sequence-on-box.sh +0 -177
  448. package/tools/ardy/runners/gvhmr-worker.mjs +0 -206
  449. package/tools/ardy/runners/index.mjs +0 -18
  450. package/tools/ardy/runners/local.mjs +0 -455
  451. package/tools/ardy/runners/proc.mjs +0 -125
  452. package/tools/ardy/runners/remote.mjs +0 -252
  453. package/tools/ardy/setup-local.mjs +0 -189
  454. package/tools/ardy/setup-text-encoder-on-box.sh +0 -93
  455. package/tools/ardy/setup-text-encoder.py +0 -306
  456. package/tools/ardy/smpl-cskel27.mjs +0 -178
  457. package/tools/ardy/visual-qa.mjs +0 -196
  458. package/tools/ardy/vq-car.mjs +0 -52
  459. package/tools/bench/EXP3.md +0 -61
  460. package/tools/bench/cclay_bench_extract_incam.py +0 -125
  461. package/tools/bench/cclay_bench_extract_obs.py +0 -204
  462. package/tools/bench/cclay_bench_runner.py +0 -42
  463. package/tools/bench/cube-contact.mjs +0 -162
  464. package/tools/bench/exp3.mjs +0 -152
  465. package/tools/bench/extract-bench-lib.mjs +0 -216
  466. package/tools/bench/extract-bench.mjs +0 -302
  467. package/tools/bench/fal-generate.mjs +0 -88
  468. package/tools/bench/fit/README.md +0 -189
  469. package/tools/bench/fit/camera.mjs +0 -59
  470. package/tools/bench/fit/contact.mjs +0 -419
  471. package/tools/bench/fit/footlock.mjs +0 -234
  472. package/tools/bench/fit/motion.mjs +0 -85
  473. package/tools/bench/fit/pin.mjs +0 -27
  474. package/tools/bench/fit/remote.mjs +0 -105
  475. package/tools/bench/fit-bench.mjs +0 -126
  476. package/tools/bench/fit-sanity.mjs +0 -45
  477. package/tools/bench/metrics.mjs +0 -313
  478. package/tools/bench/obs/depth.mjs +0 -258
  479. package/tools/bench/obs/extrinsics.mjs +0 -175
  480. package/tools/bench/obs/fit_mannequin_betas.py +0 -340
  481. package/tools/bench/obs/ground.mjs +0 -294
  482. package/tools/bench/obs/heading.mjs +0 -151
  483. package/tools/bench/obs/ladder.mjs +0 -555
  484. package/tools/bench/obs/mannequin-betas.json +0 -124
  485. package/tools/bench/obs/remote.mjs +0 -83
  486. package/tools/bench/obs/rest_joints.py +0 -52
  487. package/tools/bench/obs/ybot-targets.mjs +0 -49
  488. package/tools/bench/obs-bench.mjs +0 -520
  489. package/tools/bench/score.mjs +0 -343
  490. package/tools/bench/summarize.mjs +0 -86
  491. package/tools/demo-worker/README.md +0 -137
  492. package/tools/demo-worker/api-client.mjs +0 -233
  493. package/tools/demo-worker/generate.mjs +0 -301
  494. package/tools/demo-worker/index.mjs +0 -466
  495. package/tools/demo-worker/sign-core.mjs +0 -112
  496. package/tools/demo-worker/sign.mjs +0 -161
  497. package/tools/gt-render/browser.mjs +0 -182
  498. package/tools/gt-render/camera-math.mjs +0 -276
  499. package/tools/gt-render/page.mjs +0 -267
  500. package/tools/gt-render/render.mjs +0 -514
  501. package/tools/gt-render/scene-box.mjs +0 -31
  502. package/tools/gt-render/take-transform.mjs +0 -87
  503. package/tools/kimodo/compare-seam.mjs +0 -108
  504. package/tools/kimodo/constraints.mjs +0 -244
  505. package/tools/kimodo/edit.mjs +0 -259
  506. package/tools/kimodo/effector-constraints.mjs +0 -200
  507. package/tools/kimodo/generate.mjs +0 -646
  508. package/tools/kimodo/local-output.mjs +0 -265
  509. package/tools/kimodo/measure-pose.mjs +0 -65
  510. package/tools/kimodo/measure-preserve.mjs +0 -899
  511. package/tools/kimodo/measure-waypoints.mjs +0 -55
  512. package/tools/kimodo/mlx-generate.py +0 -111
  513. package/tools/kimodo/pose-constraints.mjs +0 -248
  514. package/tools/kimodo/preserve-mask.mjs +0 -543
  515. package/tools/kimodo/read-npz.mjs +0 -189
  516. package/tools/kimodo/run-edit-on-box.mjs +0 -155
  517. package/tools/kimodo/run-sequence-on-box.mjs +0 -178
  518. package/tools/kimodo/runner.mjs +0 -284
  519. package/tools/kimodo/seam-batch.mjs +0 -77
  520. package/tools/kimodo/setup-local.mjs +0 -30
  521. package/tools/kimodo/setup-on-box.sh +0 -339
  522. package/tools/kimodo/soma77-to-cskel27.mjs +0 -305
  523. package/tools/morphgs/assets/gen_truth.py +0 -39
  524. package/tools/morphgs/assets/mesh_ori_rig.txt +0 -27
  525. package/tools/morphgs/assets/playback-check.mjs +0 -30
  526. package/tools/morphgs/demo-gate.sh +0 -26
  527. package/tools/morphgs/fbx2morphgs.mjs +0 -68
  528. package/tools/morphgs/morphgs-to-cskel27.mjs +0 -105
  529. package/tools/morphgs/patches/preprocess_src-none-mode.patch +0 -76
  530. package/tools/morphgs/setup-on-cluster.sh +0 -126
  531. package/tools/projflow/driver.py +0 -1069
  532. package/tools/projflow/generate.mjs +0 -805
  533. package/tools/projflow/hml22-to-cskel27.mjs +0 -735
  534. package/tools/projflow/line-edit-job.mjs +0 -547
  535. package/tools/projflow/replay.mjs +0 -452
  536. package/tools/projflow/runner.mjs +0 -269
  537. package/tools/projflow/service.mjs +0 -742
  538. package/tools/track/DESIGN.md +0 -513
  539. package/tools/track/backfill-provenance.mjs +0 -116
  540. package/tools/track/budget.mjs +0 -8
  541. package/tools/track/check-rig.mjs +0 -209
  542. package/tools/track/diagnostics.schema.json +0 -60
  543. package/tools/track/export-rig.mjs +0 -256
  544. package/tools/track/fallback.mjs +0 -7
  545. package/tools/track/fk-parity-fixture.mjs +0 -161
  546. package/tools/track/gate.mjs +0 -349
  547. package/tools/track/masks.mjs +0 -318
  548. package/tools/track/metrics.mjs +0 -201
  549. package/tools/track/publish-obs.mjs +0 -108
  550. package/tools/track/py/check_env.py +0 -61
  551. package/tools/track/py/eval_lr.py +0 -229
  552. package/tools/track/py/lr_viterbi.py +0 -294
  553. package/tools/track/py/masks.py +0 -405
  554. package/tools/track/py/objective.py +0 -382
  555. package/tools/track/py/rig.py +0 -508
  556. package/tools/track/py/scene.py +0 -326
  557. package/tools/track/py/test_joint_indices.py +0 -123
  558. package/tools/track/py/test_lr_viterbi.py +0 -195
  559. package/tools/track/py/test_masks.py +0 -229
  560. package/tools/track/py/test_rig.py +0 -288
  561. package/tools/track/py/test_scene.py +0 -354
  562. package/tools/track/py/test_track.py +0 -328
  563. package/tools/track/py/track.py +0 -411
  564. package/tools/track/remote.mjs +0 -140
  565. package/tools/track/rig-dump.mjs +0 -227
  566. package/tools/track/run-box-tests.mjs +0 -14
  567. package/tools/track/run-box.mjs +0 -168
  568. package/tools/track/setup-box.sh +0 -59
  569. package/tools/track/study-2d.mjs +0 -728
  570. /package/src/{ardy → motion}/collision-blockers.js +0 -0
  571. /package/src/{ardy → motion}/ground.js +0 -0
  572. /package/src/{ardy → motion}/ik-drag.js +0 -0
  573. /package/src/{ardy → motion}/ik-key-json.js +0 -0
  574. /package/src/{ardy → motion}/ik.js +0 -0
  575. /package/src/{ardy → motion}/physics-surface.js +0 -0
  576. /package/src/{ardy → motion}/playback-clock.js +0 -0
  577. /package/src/{ardy → motion}/range-pin.js +0 -0
@@ -44,8 +44,7 @@ import {
44
44
  import { playgroundSceneUrl, fetchSceneProject } from "../playground.js";
45
45
  import { openAssetDb, referencedAssetIds, getAsset, putAsset } from "../scene-assets.js";
46
46
  import { internWorkflowOutputs, workflowOutputRefs, resolveWorkflowOutputs } from "../workflow/workflow-resources.js";
47
- import { encodeMotionResource } from "../motion-resources.js";
48
- import { openMotionDb, putMotion, sweepMotions } from "../motion-store.js";
47
+
49
48
  import { resourceManifest } from "../project-resources.js";
50
49
  import { isKo, ko } from "../locale.js";
51
50
  import { track, bucketCount, bucketProjectAge, startExportAttempt } from "../analytics.js";
@@ -54,7 +53,7 @@ import { DEFAULT_WORKSPACE_LAYOUT, DEFAULT_DURATION_S, TIMELINE_FPS } from "../a
54
53
  import { saveCustomPoses } from "../poses.js";
55
54
  import { readShotAuthoringDocument } from "../shot-authoring.js";
56
55
  import { initialShots } from "../cuts.js";
57
- import { createIkState } from "../ardy/ik.js";
56
+ import { createIkState } from "../motion/ik.js";
58
57
 
59
58
  // The scene list and project identity share one history. Dirty is derived from
60
59
  // the saved checkpoint, not an authored edit, and has its own non-history slice.
@@ -238,56 +237,17 @@ export function useScenes(appContext) {
238
237
  return JSON.stringify(createProjectDocument(projectDocumentInput(name)));
239
238
  }
240
239
 
241
- async function collectProjectSerialized(name) {
240
+ async function collectProjectSerialized(name) {
242
241
  const input = projectDocumentInput(name);
243
- const scenesDocument = {
244
- ...input.scenesDocument,
245
- scenes: input.scenesDocument.scenes.map((scene) => ({
246
- ...scene,
247
- stage: scene.stage
248
- ? {
249
- ...scene.stage,
250
- characters: (scene.stage.characters ?? []).map((character) => ({
251
- ...character,
252
- motionRef: character.motionRef ? { ...character.motionRef } : character.motionRef,
253
- })),
254
- }
255
- : scene.stage,
256
- })),
257
- };
242
+ const scenesDocument = input.scenesDocument;
258
243
  const db = await openAssetDb();
259
244
  try {
260
245
  const ids = [...referencedAssetIds(scenesDocument.scenes)];
261
246
  const assets = await Promise.all(ids.map((id) => getAsset(db, id)));
262
247
  const workflowResult = await internWorkflowOutputs(input.workflow);
263
- const referencedMotionIds = new Set(
264
- scenesDocument.scenes.flatMap((scene) => (scene.stage?.characters ?? [])
265
- .map((character) => character.motionRef?.motionId?.toLowerCase())
266
- .filter(Boolean)),
267
- );
268
- const motions = [...appContext.shared.projectMotionsRef.current.entries()]
269
- .filter(([id]) => referencedMotionIds.has(id))
270
- .map(([, record]) => record);
271
- const motionCache = new Map();
272
- for (const record of motions) motionCache.set(record.motionId.toLowerCase(), record);
273
- for (const scene of scenesDocument.scenes) for (const character of scene.stage?.characters ?? []) {
274
- const clip = appContext.shared.motionFullRef.current.get(character.id);
275
- if (!clip?.sourceBytes) continue;
276
- let record = appContext.shared.motionEncodingCacheRef.current.get(clip.sourceBytes);
277
- if (!record) {
278
- record = await encodeMotionResource(clip.sourceBytes, { prompt: character.motionRef?.prompt, sourceUrl: character.motionRef?.url });
279
- appContext.shared.motionEncodingCacheRef.current.set(clip.sourceBytes, record);
280
- }
281
- const cached = motionCache.get(record.motionId) ?? record;
282
- motionCache.set(record.motionId, cached);
283
- if (!motions.includes(cached)) motions.push(cached);
284
- appContext.shared.projectMotionsRef.current.set(record.motionId.toLowerCase(), cached);
285
- character.motionRef = { ...(character.motionRef || {}), motionId: cached.motionId };
286
- }
287
- try { const motionDb = await openMotionDb(); await Promise.all(motions.map((record) => putMotion(motionDb, record))); motionDb.close(); } catch (error) { console.warn("[cozyclay] could not cache motions", error); }
288
248
  const allAssets = [...assets.filter(Boolean), ...workflowResult.assets];
289
- const nextInput = { ...input, scenesDocument, workflow: workflowResult.graph, assets: allAssets, motions };
290
- const manifest = resourceManifest({ scenesDocument: nextInput.scenesDocument, workflow: nextInput.workflow, poseLibrary: nextInput.customPoses, assets: allAssets, motions, workflowOutputRefs });
249
+ const nextInput = { ...input, scenesDocument, workflow: workflowResult.graph, assets: allAssets };
250
+ const manifest = resourceManifest({ scenesDocument: nextInput.scenesDocument, workflow: nextInput.workflow, poseLibrary: nextInput.customPoses, assets: allAssets, workflowOutputRefs });
291
251
  setProjectManifest(manifest);
292
252
  if (manifest.missing.length) {
293
253
  const error = new Error("Project has missing resources");
@@ -445,10 +405,8 @@ export function useScenes(appContext) {
445
405
  appContext.shared.setTutorialSeedPending(false);
446
406
  appContext.shared.setCameraTutorialHandoff(null);
447
407
  appContext.shared.exportShotIdRef.current = null;
448
- appContext.shared.projectMotionsRef.current = new Map((project.motions ?? []).map((record) => [record.motionId?.toLowerCase(), record]).filter(([id]) => id));
449
408
  const source = project.scenesDocument;
450
- openMotionDb().then(async (db) => { try { await Promise.all([...appContext.shared.projectMotionsRef.current.values()].map((record) => putMotion(db, record))); const ids = new Set((source?.scenes ?? []).flatMap((scene) => (scene.stage?.characters ?? []).map((character) => character.motionRef?.motionId?.toLowerCase()).filter(Boolean))); await sweepMotions(db, ids); } finally { db.close(); } }).catch(() => {});
451
- // A project FILE carries its own scene document and never passes the
409
+ // A project FILE carries its own scene document and never passes the
452
410
  // storage reader, so the 20 fps → 24 fps clock migration is applied here
453
411
  // too — otherwise an older .cozyclay would open a sixth too fast.
454
412
  const doc = migrateToCurrentScenes(source);
@@ -470,7 +428,7 @@ export function useScenes(appContext) {
470
428
  // Whatever document this is, it is no longer the scene the tutorial opened
471
429
  // for itself; startCameraTutorial re-arms the flag after its own open.
472
430
  appContext.shared.tutorialStarterRef.current = false;
473
- setProjectManifest(resourceManifest({ scenesDocument: doc, workflow: resolvedWorkflow, poseLibrary: mergedCustomPoses, assets: project.assets ?? [], motions: appContext.shared.projectMotionsRef.current, workflowOutputRefs }));
431
+ setProjectManifest(resourceManifest({ scenesDocument: doc, workflow: resolvedWorkflow, poseLibrary: mergedCustomPoses, assets: project.assets ?? [], workflowOutputRefs }));
474
432
  track("project:opened", { age_bucket: bucketProjectAge(Date.now() - (project.savedAt ?? Date.now())) });
475
433
  }
476
434
 
@@ -586,7 +544,6 @@ export function useScenes(appContext) {
586
544
  setProjectNameDialog(null);
587
545
  const fresh = createSceneDocument(ko("SCENE 01", "씬 01"));
588
546
  storeWorkflowGraph(createWorkflowGraph());
589
- appContext.shared.projectMotionsRef.current = new Map();
590
547
  appContext.shared.motionFullRef.current.clear();
591
548
  domain.replaceDocument(fresh.scenes, fresh.activeSceneId, name, previsMode);
592
549
  persistScenes(fresh.scenes, fresh.activeSceneId);
@@ -660,16 +617,16 @@ export function useScenes(appContext) {
660
617
  // The motion-layer buffer reloads from the scene's first character.
661
618
  const firstLayer = stage.characters[0]?.layer;
662
619
  appContext.shared.setWaypoints(firstLayer?.waypoints ?? shotState.waypoints ?? []);
663
- appContext.shared.setPromptClips(firstLayer?.promptClips?.map((clip) => ({ ...clip })) ?? []);
664
- // Takes belong to the room being left; restoreMotionRefs re-fetches the
620
+
621
+ // Takes belong to the room being left; the motion layers load the
665
622
  // incoming scene's, and a stale full take must never survive the switch.
666
623
  appContext.shared.motionFullRef.current.clear();
667
- appContext.shared.setSelectedPromptId(null);
624
+
668
625
  appContext.shared.ikStatesRef.current.clear();
669
626
  appContext.shared.ikStateRef.current = createIkState();
670
627
  appContext.shared.loadedLayerCharRef.current = stage.characters[0]?.id ?? null;
671
628
  appContext.shared.setActiveCharacterId(stage.characters[0]?.id ?? null);
672
- appContext.shared.restoreMotionRefs(stage.characters);
629
+
673
630
  appContext.shared.setTlFrame(0);
674
631
  appContext.shared.setMovePlaying(false);
675
632
  appContext.shared.manualCameraOverrideRef.current = false;
@@ -381,7 +381,7 @@ export function useShots(appContext) {
381
381
  function clampShotRailRanges() {}
382
382
  const extentInputs = useRef(null);
383
383
  function syncTimelineExtent() {
384
- const inputs = [appContext.shared.characters, appContext.shared.activeChar.id, appContext.shared.motion, appContext.shared.promptClips, appContext.shared.multiModelFootage?.frames];
384
+ const inputs = [appContext.shared.characters, appContext.shared.activeChar.id, appContext.shared.motion];
385
385
  // App also re-runs this effect when shot history publishes. Only new
386
386
  // content can request a new extent; replaying it after Undo would replace
387
387
  // the restored entry and destroy Redo. Shot writes already clamp ranges.
@@ -402,7 +402,7 @@ export function useShots(appContext) {
402
402
  const target = shotId ? shots.find(entry => entry.id === shotId) : shots[atPlayhead >= 0 ? atPlayhead : 0] ?? null;
403
403
  if (shotId && !target) return null;
404
404
  let exportShots = shots;
405
- if (target && target.cameraKeys.length === 0 && !shotId && scope !== 'timeline') {
405
+ if (target && target.cameraKeys.length === 0 && (target.camera?.mode ?? 'keys') === 'keys' && !shotId && scope !== 'timeline') {
406
406
  appContext.bus.run('shot.addKey', { shotId: target.id, frame: target.startFrame });
407
407
  exportShots = appContext.storeDomain('shot').read();
408
408
  }
@@ -2,7 +2,7 @@ import { useContext, useEffect, useRef, useState } from 'react';
2
2
  import { AppContext } from '../app-context.js';
3
3
  import { createSceneStageStore } from '../store/scene-stage.js';
4
4
  import { useDocumentDomain } from '../store/use-document-store.js';
5
- import { createKeyLight } from '../scenes.js';
5
+ import { createKeyLight } from '../stage-lighting.js';
6
6
  import { shotAspectRatio } from '../shot.js';
7
7
  import { normalizeStage } from '../commands/stage.js';
8
8
 
@@ -70,7 +70,9 @@ export function useStageTransaction() {
70
70
  }
71
71
 
72
72
  export function useStage(appContext) {
73
- const [domain] = useState(() => createStageDomain(appContext));
73
+ // One stage owner: StrictMode runs this initializer twice, and a second domain would leave App
74
+ // rendering (and mirroring into the saved scene) a stage no command writes.
75
+ const [domain] = useState(() => appContext.storeDomain('stage') ?? createStageDomain(appContext));
74
76
  const stage = useDocumentDomain(domain.documentStore, 'stage');
75
77
  const [preset, setPreset] = useState('medium');
76
78
  const gesture = useRef(null);
@@ -0,0 +1,46 @@
1
+ // The agent's latest motion draft as one translucent figure in the working views, so the user sees the motion
2
+ // take shape while the agent works (agent-progress.js publishes every motion.compile, installed or not). This
3
+ // module holds the pure choices: whether the ghost shows, at what opacity and frame (its own loop at the take's
4
+ // rate from the moment the draft arrived, whatever the timeline does), what its label says, and the viewer's
5
+ // on/off setting (transient like the View menu: never saved, never undone). draft-ghost.jsx draws it on
6
+ // GIZMO_LAYER, so captures, contact sheets and exports never see it.
7
+ import { useSyncExternalStore } from "react";
8
+ import { ko } from "./locale.js";
9
+
10
+ /** Teal: apart from the onion skin's blue (before) and orange (after). */
11
+ export const DRAFT_GHOST_COLOR = "#2fc79a";
12
+ export const DRAFT_GHOST_OPACITY = 0.42;
13
+ /** An installed draft fades out over this long from its arrival: the real take plays now. */
14
+ export const DRAFT_GHOST_FADE_MS = 1200;
15
+ const HIDDEN = Object.freeze({ shown: false, opacity: 0, frame: 0 });
16
+
17
+ /**
18
+ * draftGhostState(draft, now) -> { shown, opacity, frame }: a draft whose take is a take v3 shows at
19
+ * DRAFT_GHOST_OPACITY while it is not installed; an installed one fades out over DRAFT_GHOST_FADE_MS.
20
+ * frame loops over the take at its fps from draft.at (ms, as now).
21
+ */
22
+ export function draftGhostState(draft, now) {
23
+ const take = draft?.take;
24
+ if (take?.schema !== "cozyclay.take.v3" || !(take.frameCount > 0)) return HIDDEN;
25
+ const age = Math.max(0, now - (draft.at ?? now)), fps = take.fps > 0 ? take.fps : 24;
26
+ const opacity = draft.installed ? DRAFT_GHOST_OPACITY * (1 - age / DRAFT_GHOST_FADE_MS) : DRAFT_GHOST_OPACITY;
27
+ if (!(opacity > 0.01)) return HIDDEN;
28
+ return { shown: true, opacity: +opacity.toFixed(3), frame: Math.floor((age / 1000) * fps) % take.frameCount };
29
+ }
30
+
31
+ /** "Draft 3 · QA 31" ("초안 3 · QA 31"). */
32
+ export const draftLabel = draft => `${ko("Draft", "초안")} ${draft?.n ?? 0} · QA ${draft?.qa?.total ?? 0}`;
33
+
34
+ let shown = true;
35
+ const listeners = new Set();
36
+ /** Whether the viewer wants the draft ghost (default on). */
37
+ export const draftGhostShown = () => shown;
38
+ export function setDraftGhostShown(value) {
39
+ const next = !!value;
40
+ if (next === shown) return shown;
41
+ shown = next;
42
+ for (const listener of [...listeners]) listener();
43
+ return shown;
44
+ }
45
+ const subscribe = listener => { listeners.add(listener); return () => listeners.delete(listener); };
46
+ export const useDraftGhostShown = () => useSyncExternalStore(subscribe, draftGhostShown, draftGhostShown);
@@ -0,0 +1,129 @@
1
+ // The agent's latest motion draft in the working views (draft-ghost.js decides what shows): one GhostSet slot
2
+ // of the drafting character's rig, posed from the draft take on its own loop, the records that take moves
3
+ // riding along, and a label over its head ("Draft 3 · QA 31"). Everything sits on GIZMO_LAYER: the shot
4
+ // preview card, PlayView, captures, contact sheets and exports never draw it, and it takes no ray. The canvas
5
+ // may render on demand, so a shown ghost asks for frames at the take's rate.
6
+ import { useEffect, useMemo, useSyncExternalStore } from "react";
7
+ import * as THREE from "three";
8
+ import { useFrame, useThree } from "@react-three/fiber";
9
+ import { GIZMO_LAYER } from "./dualview.jsx";
10
+ import { GhostSet, takeTracks } from "./ghost-set.js";
11
+ import { latestDraft, progressVersion, subscribeProgress } from "./agent-progress.js";
12
+ import { DRAFT_GHOST_COLOR, DRAFT_GHOST_OPACITY, draftGhostState, draftLabel, useDraftGhostShown } from "./draft-ghost.js";
13
+
14
+ // Kit parts can mount a frame after the take changes (view-ghosts.jsx does the same).
15
+ const SOURCE_PASSES = 3;
16
+ // Metres above the head joint; the label's height as a share of the view (sizeAttenuation off).
17
+ const LABEL_LIFT = 0.3, LABEL_VIEW_HEIGHT = 0.042, LABEL_PX = { w: 512, h: 96 };
18
+ const noRay = () => {};
19
+ const headBones = new WeakMap();
20
+
21
+ /** The ghost rig's head bone, found once per rig. */
22
+ function headOf(rig) {
23
+ if (!headBones.has(rig)) {
24
+ let head = null;
25
+ // "mixamorigHead" or "mixamorig:Head": the first depth-first one is the control bone playback.js poses
26
+ rig.traverse(node => { if (!head && node.isBone && /Head$/.test(node.name)) head = node; });
27
+ headBones.set(rig, head);
28
+ }
29
+ return headBones.get(rig);
30
+ }
31
+
32
+ /** A screen-sized label sprite on GIZMO_LAYER, drawn over everything, never picked. */
33
+ function makeLabel() {
34
+ const canvas = document.createElement("canvas");
35
+ Object.assign(canvas, { width: LABEL_PX.w, height: LABEL_PX.h });
36
+ const texture = new THREE.CanvasTexture(canvas);
37
+ texture.colorSpace = THREE.SRGBColorSpace;
38
+ const sprite = new THREE.Sprite(new THREE.SpriteMaterial({ map: texture, transparent: true, depthTest: false, depthWrite: false, sizeAttenuation: false, toneMapped: false }));
39
+ sprite.center.set(0.5, 0);
40
+ sprite.renderOrder = 1000;
41
+ sprite.layers.set(GIZMO_LAYER);
42
+ sprite.raycast = noRay;
43
+ sprite.userData = { canvas, texture, text: null };
44
+ return sprite;
45
+ }
46
+
47
+ /** Paint `text` as a rounded tag (teal edge; green dot once QA is clean) and size the sprite to it. */
48
+ function paintLabel(sprite, text, clean) {
49
+ const { canvas, texture } = sprite.userData;
50
+ if (sprite.userData.text === `${text}|${clean}`) return;
51
+ sprite.userData.text = `${text}|${clean}`;
52
+ const g = canvas.getContext("2d"), font = "600 44px system-ui, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif";
53
+ g.font = font;
54
+ const pad = 26, dot = 34, width = Math.min(LABEL_PX.w - 4, Math.ceil(g.measureText(text).width) + pad * 2 + dot);
55
+ g.clearRect(0, 0, canvas.width, canvas.height);
56
+ g.fillStyle = "rgba(16, 24, 28, 0.82)";
57
+ g.strokeStyle = DRAFT_GHOST_COLOR;
58
+ g.lineWidth = 4;
59
+ g.beginPath();
60
+ g.roundRect((LABEL_PX.w - width) / 2, 8, width, LABEL_PX.h - 16, 30);
61
+ g.fill();
62
+ g.stroke();
63
+ g.fillStyle = clean ? "#46d36f" : DRAFT_GHOST_COLOR;
64
+ g.beginPath();
65
+ g.arc((LABEL_PX.w - width) / 2 + pad + 8, LABEL_PX.h / 2, 9, 0, Math.PI * 2);
66
+ g.fill();
67
+ g.fillStyle = "#eef6f3";
68
+ g.font = font;
69
+ g.textBaseline = "middle";
70
+ g.fillText(text, (LABEL_PX.w - width) / 2 + pad + dot, LABEL_PX.h / 2 + 2);
71
+ texture.needsUpdate = true;
72
+ sprite.scale.set(LABEL_VIEW_HEIGHT * (LABEL_PX.w / LABEL_PX.h), LABEL_VIEW_HEIGHT, 1);
73
+ }
74
+
75
+ /** One viewport frame of the draft ghost: pose the slot at the draft's own clock, tint it, and set the label over its head. */
76
+ function frameDraft({ set, label, draft, rig, scene, objects, propTake }) {
77
+ const state = draft ? draftGhostState(draft, Date.now()) : null;
78
+ const on = !!state?.shown && !!rig?.parent;
79
+ label.visible = on;
80
+ if (typeof window !== "undefined") window.__cozyclayDraftGhost = { set, label, draft, state, on };
81
+ if (!set.show(on)) return;
82
+ set.setRig(rig);
83
+ set.syncSources(scene, objects, draft.take, SOURCE_PASSES);
84
+ rig.parent.updateWorldMatrix(true, false);
85
+ set.update({ entries: [{ f: state.frame, side: "after", rank: 1 }], take: draft.take, placement: rig.parent.matrixWorld, propTake, objects, count: 1 });
86
+ const slot = set.slots[0];
87
+ slot.material.color.set(DRAFT_GHOST_COLOR).multiplyScalar(1.15);
88
+ slot.material.opacity = state.opacity;
89
+ const head = headOf(slot.rig);
90
+ if (!head) return;
91
+ set.object.updateMatrixWorld(true);
92
+ head.getWorldPosition(label.position);
93
+ label.position.y += LABEL_LIFT;
94
+ label.material.opacity = Math.min(1, state.opacity / DRAFT_GHOST_OPACITY);
95
+ }
96
+
97
+ /** rigs: live rigs by character id; objects: the authored records (carried ones ride along). */
98
+ export function DraftGhost({ rigs, objects }) {
99
+ const version = useSyncExternalStore(subscribeProgress, progressVersion, progressVersion);
100
+ const draft = useMemo(() => latestDraft(), [version]); // eslint-disable-line react-hooks/exhaustive-deps
101
+ const wanted = useDraftGhostShown();
102
+ const scene = useThree(state => state.scene), invalidate = useThree(state => state.invalidate);
103
+ const set = useMemo(() => new GhostSet({ layer: GIZMO_LAYER }), []);
104
+ const label = useMemo(() => makeLabel(), []);
105
+ const rig = draft ? rigs?.[draft.characterId] ?? null : null;
106
+ const active = wanted && !!rig && !!draft?.take;
107
+ const propTake = useMemo(() => (draft?.take ? { frameCount: draft.take.frameCount, fps: draft.take.fps, objectTracks: takeTracks(draft.take) } : null), [draft]);
108
+ useEffect(() => {
109
+ if (!active) return undefined;
110
+ scene.add(set.object);
111
+ set.object.add(label);
112
+ return () => { set.object.remove(label); scene.remove(set.object); };
113
+ }, [active, scene, set, label]);
114
+ useEffect(() => () => {
115
+ set.dispose();
116
+ label.material.dispose();
117
+ label.userData.texture.dispose();
118
+ }, [set, label]);
119
+ useEffect(() => { if (draft) paintLabel(label, draftLabel(draft), draft.qa?.total === 0); }, [draft, label]);
120
+ // A shown ghost moves on its own clock: ask for frames at the take's rate, and one more once it is gone.
121
+ useEffect(() => {
122
+ invalidate();
123
+ if (!active) return undefined;
124
+ const timer = setInterval(() => { if (draftGhostState(draft, Date.now()).shown || set.object.visible) invalidate(); }, 1000 / (draft.take.fps || 24));
125
+ return () => clearInterval(timer);
126
+ }, [active, draft, set, invalidate]);
127
+ useFrame(() => frameDraft({ set, label, draft: active ? draft : null, rig, scene, objects, propTake }));
128
+ return null;
129
+ }
package/src/dualview.jsx CHANGED
@@ -100,7 +100,7 @@ const EDGE_FRAGMENT = `
100
100
  float depthLine = smoothstep(0.055, 0.16, depthEdge);
101
101
  float normalLine = smoothstep(0.7, 1.7, normalEdge);
102
102
  float edge = max(depthLine * foregroundOwner, normalLine * 0.68);
103
- gl_FragColor = vec4(edgeColor, edge * 0.76 * distanceFade);
103
+ gl_FragColor = vec4(edgeColor, edge * 0.38 * distanceFade);
104
104
  }
105
105
  `;
106
106
 
@@ -349,10 +349,11 @@ export function DualRender({ stageRef, mainRef, insetRef, shotPreviewRef, shotCa
349
349
  // grazing angle its depth runs away fast enough that the depth
350
350
  // kernel inked the whole far floor as a dark band under the
351
351
  // horizon. Without it in the prepass, figures still outline
352
- // against the cleared depth behind them.
352
+ // against the cleared depth behind them. A glow halo (beautyOnly)
353
+ // is light, not a surface: it takes no ink either.
353
354
  const cutouts = [];
354
355
  scene.traverse((node) => {
355
- if ((node.userData?.cutoutTexture !== undefined || node.userData?.noInk) && node.visible) {
356
+ if ((node.userData?.cutoutTexture !== undefined || node.userData?.noInk || node.userData?.beautyOnly) && node.visible) {
356
357
  cutouts.push(node);
357
358
  node.visible = false;
358
359
  }
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Effects in the set: the particles and trails of every effect record, plus
3
+ * the editor-only marker that lets an emitter be picked and moved.
4
+ *
5
+ * Particles live in WORLD space under SetProps, not under the emitter's own
6
+ * group: a puff already in the air keeps drifting when its emitter moves on
7
+ * or is hidden (an exhale ends, a cigarette goes back in the pocket). They
8
+ * are placed imperatively from the frame ref, like a prop, and registered in
9
+ * the props registry, so the recorder's "place every prop now" pass redraws
10
+ * them for the frame it is about to capture.
11
+ */
12
+ import { useEffect, useMemo, useRef } from "react";
13
+ import { useFrame } from "@react-three/fiber";
14
+ import * as THREE from "three";
15
+ import { GIZMO_LAYER } from "../dualview.jsx";
16
+ import { createEffectMeshes } from "./effect-meshes.js";
17
+ import { effectSceneOf, publishEffectScene } from "./state.js";
18
+
19
+ /** The props-registry key the effects pass is filed under (never an object id). */
20
+ const EFFECTS_ENTRY = Symbol("effects");
21
+ const MARKER_COLOR = "#7fd4f0";
22
+ const onGizmoLayer = (node) => {
23
+ if (node) node.layers.set(GIZMO_LAYER);
24
+ };
25
+
26
+ /**
27
+ * An emitter's viewport presence, editor furniture like an Empty's cross:
28
+ * a small diamond with an arrow up its local +Y (where particles are thrown)
29
+ * or, for a trail, a bar along local Y as wide as the ribbon. On GIZMO_LAYER,
30
+ * so no shot, capture or export ever draws it, with an invisible pick volume.
31
+ */
32
+ export function EffectMarker({ object }) {
33
+ const trail = object.effect?.preset === "trail";
34
+ const half = trail ? Math.max(0.05, (object.effect?.width ?? 0.5) / 2) : 0.06;
35
+ const lines = useMemo(() => {
36
+ const d = 0.05;
37
+ const diamond = [[d, 0, 0], [0, d, 0], [0, d, 0], [-d, 0, 0], [-d, 0, 0], [0, -d, 0], [0, -d, 0], [d, 0, 0],
38
+ [0, 0, d], [0, d, 0], [0, d, 0], [0, 0, -d], [0, 0, -d], [0, -d, 0], [0, -d, 0], [0, 0, d]];
39
+ const marks = trail
40
+ ? [[0, -half, 0], [0, half, 0], [-0.03, -half, 0], [0.03, -half, 0], [-0.03, half, 0], [0.03, half, 0]]
41
+ : [[0, d, 0], [0, 0.16, 0], [0, 0.16, 0], [0.025, 0.12, 0], [0, 0.16, 0], [-0.025, 0.12, 0]];
42
+ const geometry = new THREE.BufferGeometry();
43
+ geometry.setAttribute("position", new THREE.Float32BufferAttribute([...diamond, ...marks].flat(), 3));
44
+ return geometry;
45
+ }, [trail, half]);
46
+ useEffect(() => () => lines.dispose(), [lines]);
47
+ return (
48
+ <group userData={{ effectMarker: true }}>
49
+ <lineSegments ref={onGizmoLayer} geometry={lines} renderOrder={997} frustumCulled={false}>
50
+ <lineBasicMaterial color={MARKER_COLOR} depthTest={false} depthWrite={false} transparent opacity={0.95} />
51
+ </lineSegments>
52
+ <mesh ref={onGizmoLayer} visible={false} userData={{ emptyPick: true }}>
53
+ <sphereGeometry args={[0.08, 12, 8]} />
54
+ <meshBasicMaterial />
55
+ </mesh>
56
+ </group>
57
+ );
58
+ }
59
+
60
+ /** A record pinned to a bone emits from where the bone is now: its prop is
61
+ * placed first, then its world matrix read back from the props registry. */
62
+ const liveWorld = (registryRef) => (id, out) => {
63
+ const entry = registryRef?.current?.get(id);
64
+ if (!entry) return null;
65
+ entry.place();
66
+ return entry.world(out);
67
+ };
68
+
69
+ /**
70
+ * Every effect record's particles at the frame in `frameRef`. `objects` are
71
+ * the AUTHORED records (a take can hide an emitter at the current frame while
72
+ * its smoke is still in the air); `registryRef` is SetProps' placement
73
+ * registry, which the recorder's sync pass walks.
74
+ */
75
+ export function EffectsLayer({ objects, frameRef = null, take = null, registryRef = null, fadeOpacity = null }) {
76
+ const base = useMemo(() => effectSceneOf(objects), [objects]);
77
+ const any = base.records.length > 0;
78
+ const meshes = useMemo(() => (any ? createEffectMeshes() : null), [any]);
79
+ useEffect(() => () => meshes?.dispose(), [meshes]);
80
+ const live = useMemo(() => liveWorld(registryRef), [registryRef]);
81
+ const scene = useMemo(() => ({ ...base, take: take ?? {}, live }), [base, take, live]);
82
+ const drawnRef = useRef(null);
83
+ const place = () => {
84
+ if (!meshes) return;
85
+ const frame = frameRef?.current ?? 0, opacity = fadeOpacity ?? 1;
86
+ const key = [frame, scene, opacity];
87
+ const attached = scene.records.some((record) => record.attach);
88
+ if (!attached && drawnRef.current?.every((value, i) => value === key[i])) return;
89
+ drawnRef.current = key;
90
+ meshes.update(scene, frame, opacity);
91
+ };
92
+ useFrame(place);
93
+ useEffect(() => {
94
+ publishEffectScene(() => scene);
95
+ return () => publishEffectScene(null);
96
+ }, [scene]);
97
+ // Re-filed every render, so the recorder's pass runs this render's
98
+ // placement and runs it after every prop (an attached emitter reads one).
99
+ useEffect(() => {
100
+ const registry = registryRef?.current;
101
+ if (!registry || !meshes) return undefined;
102
+ registry.set(EFFECTS_ENTRY, { place, world: () => null });
103
+ return () => { registry.delete(EFFECTS_ENTRY); };
104
+ });
105
+ if (!meshes) return null;
106
+ return (
107
+ <>
108
+ <primitive object={meshes.particles} />
109
+ <primitive object={meshes.ribbons} />
110
+ </>
111
+ );
112
+ }