agentcut 0.0.0-stage → 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 (248) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -2
  3. package/dist/bridge.d.ts +45 -0
  4. package/dist/bridge.js +691 -0
  5. package/dist/bridge.js.map +1 -0
  6. package/dist/config.d.ts +13 -0
  7. package/dist/config.js +50 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +35 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/log.d.ts +1 -0
  13. package/dist/log.js +14 -0
  14. package/dist/log.js.map +1 -0
  15. package/dist/studio/agents/claude.d.ts +7 -0
  16. package/dist/studio/agents/claude.js +155 -0
  17. package/dist/studio/agents/claude.js.map +1 -0
  18. package/dist/studio/agents/codex.d.ts +4 -0
  19. package/dist/studio/agents/codex.js +169 -0
  20. package/dist/studio/agents/codex.js.map +1 -0
  21. package/dist/studio/agents/index.d.ts +8 -0
  22. package/dist/studio/agents/index.js +50 -0
  23. package/dist/studio/agents/index.js.map +1 -0
  24. package/dist/studio/agents/types.d.ts +131 -0
  25. package/dist/studio/agents/types.js +11 -0
  26. package/dist/studio/agents/types.js.map +1 -0
  27. package/dist/studio/bundler.d.ts +29 -0
  28. package/dist/studio/bundler.js +136 -0
  29. package/dist/studio/bundler.js.map +1 -0
  30. package/dist/studio/chat.d.ts +147 -0
  31. package/dist/studio/chat.js +681 -0
  32. package/dist/studio/chat.js.map +1 -0
  33. package/dist/studio/cli.d.ts +2 -0
  34. package/dist/studio/cli.js +194 -0
  35. package/dist/studio/cli.js.map +1 -0
  36. package/dist/studio/components.d.ts +4 -0
  37. package/dist/studio/components.js +36 -0
  38. package/dist/studio/components.js.map +1 -0
  39. package/dist/studio/host.d.ts +105 -0
  40. package/dist/studio/host.js +634 -0
  41. package/dist/studio/host.js.map +1 -0
  42. package/dist/studio/http.d.ts +21 -0
  43. package/dist/studio/http.js +240 -0
  44. package/dist/studio/http.js.map +1 -0
  45. package/dist/studio/music.d.ts +35 -0
  46. package/dist/studio/music.js +130 -0
  47. package/dist/studio/music.js.map +1 -0
  48. package/dist/studio/proc.d.ts +11 -0
  49. package/dist/studio/proc.js +69 -0
  50. package/dist/studio/proc.js.map +1 -0
  51. package/dist/studio/projects.d.ts +84 -0
  52. package/dist/studio/projects.js +369 -0
  53. package/dist/studio/projects.js.map +1 -0
  54. package/dist/studio/render.d.ts +24 -0
  55. package/dist/studio/render.js +197 -0
  56. package/dist/studio/render.js.map +1 -0
  57. package/dist/studio/reveal.d.ts +7 -0
  58. package/dist/studio/reveal.js +49 -0
  59. package/dist/studio/reveal.js.map +1 -0
  60. package/dist/studio/schema.d.ts +4152 -0
  61. package/dist/studio/schema.js +358 -0
  62. package/dist/studio/schema.js.map +1 -0
  63. package/dist/studio/tools.d.ts +2 -0
  64. package/dist/studio/tools.js +165 -0
  65. package/dist/studio/tools.js.map +1 -0
  66. package/dist/studio/voice.d.ts +150 -0
  67. package/dist/studio/voice.js +434 -0
  68. package/dist/studio/voice.js.map +1 -0
  69. package/dist/studio/workspace.d.ts +31 -0
  70. package/dist/studio/workspace.js +187 -0
  71. package/dist/studio/workspace.js.map +1 -0
  72. package/package.json +50 -4
  73. package/template/AGENTS.md +13 -0
  74. package/template/components/CATALOG.md +1306 -0
  75. package/template/components/README.md +61 -0
  76. package/template/components/STYLES.md +246 -0
  77. package/template/components/arcade-title/ArcadeTitle.tsx +860 -0
  78. package/template/components/arcade-title/meta.json +28 -0
  79. package/template/components/aurora/Aurora.tsx +63 -0
  80. package/template/components/aurora/meta.json +28 -0
  81. package/template/components/bar-wipe-title/BarWipeTitle.tsx +94 -0
  82. package/template/components/bar-wipe-title/meta.json +29 -0
  83. package/template/components/before-after/BeforeAfter.tsx +89 -0
  84. package/template/components/before-after/meta.json +233 -0
  85. package/template/components/bento-grid/BentoGrid.tsx +202 -0
  86. package/template/components/bento-grid/meta.json +25 -0
  87. package/template/components/blur-in-title/BlurInTitle.tsx +121 -0
  88. package/template/components/blur-in-title/meta.json +32 -0
  89. package/template/components/catalog.json +8730 -0
  90. package/template/components/catalog.ts +103 -0
  91. package/template/components/chat-thread/ChatThread.tsx +128 -0
  92. package/template/components/chat-thread/meta.json +24 -0
  93. package/template/components/checklist/Checklist.tsx +129 -0
  94. package/template/components/checklist/meta.json +25 -0
  95. package/template/components/confetti/Confetti.tsx +109 -0
  96. package/template/components/confetti/meta.json +28 -0
  97. package/template/components/countdown/Countdown.tsx +166 -0
  98. package/template/components/countdown/meta.json +28 -0
  99. package/template/components/cut-and-paste/CutAndPaste.tsx +654 -0
  100. package/template/components/cut-and-paste/meta.json +29 -0
  101. package/template/components/decode-text/DecodeText.tsx +97 -0
  102. package/template/components/decode-text/meta.json +29 -0
  103. package/template/components/editorial-quote/EditorialQuote.tsx +122 -0
  104. package/template/components/editorial-quote/meta.json +28 -0
  105. package/template/components/glitch-title/GlitchTitle.tsx +171 -0
  106. package/template/components/glitch-title/meta.json +32 -0
  107. package/template/components/halftone-wave/HalftoneWave.tsx +106 -0
  108. package/template/components/halftone-wave/meta.json +28 -0
  109. package/template/components/highlighter/Highlighter.tsx +142 -0
  110. package/template/components/highlighter/meta.json +28 -0
  111. package/template/components/hook-card/HookCard.tsx +552 -0
  112. package/template/components/hook-card/meta.json +304 -0
  113. package/template/components/index.ts +149 -0
  114. package/template/components/iris-wipe/IrisWipe.tsx +76 -0
  115. package/template/components/iris-wipe/meta.json +24 -0
  116. package/template/components/kinetic-poster/KineticPoster.tsx +437 -0
  117. package/template/components/kinetic-poster/meta.json +31 -0
  118. package/template/components/kinetic-punch/KineticPunch.tsx +80 -0
  119. package/template/components/kinetic-punch/meta.json +30 -0
  120. package/template/components/lava-lamp/LavaLamp.tsx +92 -0
  121. package/template/components/lava-lamp/meta.json +28 -0
  122. package/template/components/letter-cascade/LetterCascade.tsx +102 -0
  123. package/template/components/letter-cascade/meta.json +29 -0
  124. package/template/components/lib.ts +179 -0
  125. package/template/components/light-leak/LightLeakTransition.tsx +43 -0
  126. package/template/components/light-leak/meta.json +74 -0
  127. package/template/components/line-diagram/LineDiagram.tsx +205 -0
  128. package/template/components/line-diagram/meta.json +217 -0
  129. package/template/components/list-card/ListCard.tsx +104 -0
  130. package/template/components/list-card/meta.json +232 -0
  131. package/template/components/logo-sting/LogoSting.tsx +129 -0
  132. package/template/components/logo-sting/meta.json +29 -0
  133. package/template/components/looks.tsx +1447 -0
  134. package/template/components/lower-third/LowerThird.tsx +100 -0
  135. package/template/components/lower-third/meta.json +24 -0
  136. package/template/components/marquee/Marquee.tsx +100 -0
  137. package/template/components/marquee/meta.json +30 -0
  138. package/template/components/notification/Notification.tsx +115 -0
  139. package/template/components/notification/meta.json +27 -0
  140. package/template/components/outline-fill/OutlineFill.tsx +106 -0
  141. package/template/components/outline-fill/meta.json +28 -0
  142. package/template/components/panel-sweep/PanelSweep.tsx +86 -0
  143. package/template/components/panel-sweep/meta.json +25 -0
  144. package/template/components/prompt-box/PromptBox.tsx +131 -0
  145. package/template/components/prompt-box/meta.json +24 -0
  146. package/template/components/props.ts +73 -0
  147. package/template/components/quote-card/QuoteCard.tsx +71 -0
  148. package/template/components/quote-card/meta.json +216 -0
  149. package/template/components/shape-shift/ShapeShift.tsx +420 -0
  150. package/template/components/shape-shift/meta.json +31 -0
  151. package/template/components/slide-zoom-message/SlideZoomMessage.tsx +179 -0
  152. package/template/components/slide-zoom-message/meta.json +199 -0
  153. package/template/components/social-post/SocialPost.tsx +185 -0
  154. package/template/components/social-post/meta.json +30 -0
  155. package/template/components/split-flap/SplitFlap.tsx +191 -0
  156. package/template/components/split-flap/meta.json +29 -0
  157. package/template/components/spotlight-grid/SpotlightGrid.tsx +84 -0
  158. package/template/components/spotlight-grid/meta.json +25 -0
  159. package/template/components/stat-counter/StatCounter.tsx +117 -0
  160. package/template/components/stat-counter/meta.json +27 -0
  161. package/template/components/sticker-badge/StickerBadge.tsx +46 -0
  162. package/template/components/sticker-badge/meta.json +220 -0
  163. package/template/components/sticker-slam/StickerSlam.tsx +941 -0
  164. package/template/components/sticker-slam/meta.json +34 -0
  165. package/template/components/style-layer.tsx +233 -0
  166. package/template/components/styles.json +762 -0
  167. package/template/components/styles.ts +113 -0
  168. package/template/components/target-lock/TargetLock.tsx +662 -0
  169. package/template/components/target-lock/meta.json +32 -0
  170. package/template/components/text-reveal/TextReveal.tsx +99 -0
  171. package/template/components/text-reveal/meta.json +28 -0
  172. package/template/components/tile-wipe/TileWipe.tsx +75 -0
  173. package/template/components/tile-wipe/meta.json +24 -0
  174. package/template/components/type-zoom/TypeZoom.tsx +103 -0
  175. package/template/components/type-zoom/meta.json +27 -0
  176. package/template/components/types.ts +66 -0
  177. package/template/components/typewriter/Typewriter.tsx +112 -0
  178. package/template/components/typewriter/meta.json +29 -0
  179. package/template/components/word-pop/WordPop.tsx +59 -0
  180. package/template/components/word-pop/meta.json +237 -0
  181. package/template/components/word-stack/WordStack.tsx +122 -0
  182. package/template/components/word-stack/meta.json +27 -0
  183. package/template/components/word-swap/WordSwap.tsx +127 -0
  184. package/template/components/word-swap/meta.json +30 -0
  185. package/template/presets/charcoal-sketch/PROMPT.md +48 -0
  186. package/template/presets/charcoal-sketch/assets/paper/grain-0.png +0 -0
  187. package/template/presets/charcoal-sketch/assets/paper/grain-1.png +0 -0
  188. package/template/presets/charcoal-sketch/assets/paper/grain-2.png +0 -0
  189. package/template/presets/charcoal-sketch/assets/paper/sketch-paper.jpg +0 -0
  190. package/template/presets/charcoal-sketch/assets/paper/smudge.png +0 -0
  191. package/template/presets/charcoal-sketch/poster.jpg +0 -0
  192. package/template/presets/charcoal-sketch/preset.json +17 -0
  193. package/template/presets/charcoal-sketch/preview.mp4 +0 -0
  194. package/template/presets/charcoal-sketch/scenes/Grain.tsx +23 -0
  195. package/template/presets/charcoal-sketch/scenes/Paper.tsx +17 -0
  196. package/template/presets/charcoal-sketch/scenes/examples/Agents.tsx +100 -0
  197. package/template/presets/charcoal-sketch/scenes/examples/Approvals.tsx +110 -0
  198. package/template/presets/charcoal-sketch/scenes/examples/Blog.tsx +105 -0
  199. package/template/presets/charcoal-sketch/scenes/examples/EndCard.tsx +41 -0
  200. package/template/presets/charcoal-sketch/scenes/examples/Hook.tsx +130 -0
  201. package/template/presets/charcoal-sketch/scenes/examples/Ideas.tsx +92 -0
  202. package/template/presets/charcoal-sketch/scenes/examples/Posting.tsx +128 -0
  203. package/template/presets/charcoal-sketch/scenes/lib/painfix.tsx +119 -0
  204. package/template/presets/charcoal-sketch/scenes/lib/sketch.tsx +291 -0
  205. package/template/presets/charcoal-sketch/scripts/build_layers.example.py +193 -0
  206. package/template/presets/charcoal-sketch/scripts/duck_music.py +34 -0
  207. package/template/presets/charcoal-sketch/scripts/make_textures.py +93 -0
  208. package/template/presets/punk-cut-paper/PROMPT.md +37 -0
  209. package/template/presets/punk-cut-paper/assets/paper/desk-cream.jpg +0 -0
  210. package/template/presets/punk-cut-paper/assets/paper/grain-overlay.png +0 -0
  211. package/template/presets/punk-cut-paper/assets/paper/halftone-black.png +0 -0
  212. package/template/presets/punk-cut-paper/assets/paper/halftone-red.png +0 -0
  213. package/template/presets/punk-cut-paper/assets/paper/halftone-yellow.png +0 -0
  214. package/template/presets/punk-cut-paper/assets/paper/kraft.jpg +0 -0
  215. package/template/presets/punk-cut-paper/assets/paper/newsprint.jpg +0 -0
  216. package/template/presets/punk-cut-paper/assets/paper/paper-cream.jpg +0 -0
  217. package/template/presets/punk-cut-paper/assets/paper/paper-white.jpg +0 -0
  218. package/template/presets/punk-cut-paper/assets/paper/tape.png +0 -0
  219. package/template/presets/punk-cut-paper/build_layers.example.py +150 -0
  220. package/template/presets/punk-cut-paper/poster.jpg +0 -0
  221. package/template/presets/punk-cut-paper/preset.json +15 -0
  222. package/template/presets/punk-cut-paper/preview.mp4 +0 -0
  223. package/template/presets/punk-cut-paper/scenes/Backdrop.tsx +76 -0
  224. package/template/presets/punk-cut-paper/scenes/Motif.tsx +376 -0
  225. package/template/presets/punk-cut-paper/scenes/Photo.tsx +73 -0
  226. package/template/presets/punk-cut-paper/scenes/Ransom.tsx +119 -0
  227. package/template/presets/punk-cut-paper/scenes/Xerox.tsx +31 -0
  228. package/template/presets/punk-cut-paper/scenes/lib/punk.tsx +208 -0
  229. package/template/runtime/composition.tsx +920 -0
  230. package/template/runtime/helpers.tsx +228 -0
  231. package/template/runtime/index.tsx +22 -0
  232. package/template/runtime/types.ts +248 -0
  233. package/template/skill/SKILL.md +149 -0
  234. package/template/skill/references/browser-export.md +61 -0
  235. package/template/skill/references/components.md +38 -0
  236. package/template/skill/references/craft.md +53 -0
  237. package/template/skill/references/cursor.md +91 -0
  238. package/template/skill/references/footage.md +73 -0
  239. package/template/skill/references/format.md +140 -0
  240. package/template/skill/references/presets.md +56 -0
  241. package/template/skill/references/sound.md +128 -0
  242. package/template/starter/.studio/chat.json +1 -0
  243. package/template/starter/assets/.keep +0 -0
  244. package/template/starter/layers.json +46 -0
  245. package/template/starter/notes.md +4 -0
  246. package/template/starter/project.json +13 -0
  247. package/template/starter/renders/.keep +0 -0
  248. package/template/starter/scenes/Title.tsx +38 -0
@@ -0,0 +1,228 @@
1
+ // The `agentcut` module that scenes import.
2
+ // Same animation helpers as video-studio's shared/anim.ts, plus asset URLs and
3
+ // browser-export-safe building blocks (SVG radial glows instead of CSS radial-gradient).
4
+ import { createContext, useContext, useId, type CSSProperties, type ReactNode } from "react";
5
+ import { Easing, interpolate, spring, staticFile, useRemotionEnvironment, type SpringConfig } from "remotion";
6
+ import type { StudioProject } from "./types";
7
+
8
+ export interface StudioRuntimeContextValue {
9
+ project: StudioProject;
10
+ variant: string;
11
+ width: number;
12
+ height: number;
13
+ fps: number;
14
+ assetBase: string;
15
+ libraryBase: string;
16
+ }
17
+
18
+ const runtimeState: { fps: number; assetBase: string; libraryBase: string } = {
19
+ fps: 30,
20
+ assetBase: "",
21
+ libraryBase: "",
22
+ };
23
+
24
+ /** Called by StudioComposition on every render so helpers work outside hooks too. */
25
+ export function setRuntimeState(next: { fps: number; assetBase: string; libraryBase: string }) {
26
+ runtimeState.fps = next.fps;
27
+ runtimeState.assetBase = next.assetBase;
28
+ runtimeState.libraryBase = next.libraryBase;
29
+ }
30
+
31
+ export const StudioRuntimeContext = createContext<StudioRuntimeContextValue | null>(null);
32
+
33
+ /** Project size, fps and variant for the frame being drawn. */
34
+ export function useStudio(): StudioRuntimeContextValue {
35
+ const value = useContext(StudioRuntimeContext);
36
+ if (!value) throw new Error("useStudio() must be used inside a Studio composition.");
37
+ return value;
38
+ }
39
+
40
+ /**
41
+ * Live preview vs. final pixels. The Player has to draw 30 frames a second on the page's
42
+ * main thread; captures and the export can take as long as they need. Heavy scenes (three.js,
43
+ * big canvases) should draw cheaper in the preview: lower pixel ratio, smaller shadow maps,
44
+ * redraw canvas textures less often. Captures and the export always get full quality.
45
+ */
46
+ export function usePreviewQuality() {
47
+ const env = useRemotionEnvironment();
48
+ const isPreview = env.isPlayer && !env.isRendering;
49
+ return {
50
+ isPreview,
51
+ /** For renderer.setPixelRatio() / canvas resolution. */
52
+ pixelRatio: isPreview ? 0.5 : 1,
53
+ /** For light.shadow.mapSize. */
54
+ shadowMapSize: isPreview ? 512 : 2048,
55
+ /** Redraw expensive canvas textures every Nth frame in the preview. */
56
+ textureEvery: isPreview ? 2 : 1,
57
+ };
58
+ }
59
+
60
+ /** True when the composition is drawn in a tall (9:16-like) variant. */
61
+ export function useIsVertical() {
62
+ const { width, height } = useStudio();
63
+ return height > width;
64
+ }
65
+
66
+ function joinUrl(base: string, path: string) {
67
+ if (base.startsWith("static:")) {
68
+ // Local Remotion render: files come from the render's public dir.
69
+ const prefix = base.slice("static:".length).replace(/^\/+|\/+$/g, "");
70
+ return staticFile(prefix ? `${prefix}/${path.replace(/^\/+/, "")}` : path.replace(/^\/+/, ""));
71
+ }
72
+ const cleanBase = base.replace(/\/+$/, "");
73
+ const cleanPath = path
74
+ .replace(/^\/+/, "")
75
+ .split("/")
76
+ .map((part) => encodeURIComponent(part))
77
+ .join("/");
78
+ return `${cleanBase}/${cleanPath}`;
79
+ }
80
+
81
+ /**
82
+ * Resolve a project file to a URL.
83
+ * - `assets/voice.wav` → this project's folder
84
+ * - `library:sfx/whoosh.wav` → the workspace library
85
+ * - `https://…` → unchanged
86
+ */
87
+ export function asset(src: string): string {
88
+ if (/^(https?:|data:|blob:)/i.test(src)) return src;
89
+ if (src.startsWith("library:")) {
90
+ return joinUrl(runtimeState.libraryBase, src.slice("library:".length));
91
+ }
92
+ return joinUrl(runtimeState.assetBase, src);
93
+ }
94
+
95
+ // ---------------------------------------------------------------------------
96
+ // Animation helpers (frame-based, same names as video-studio's shared/anim.ts)
97
+
98
+ export const clamp = { extrapolateLeft: "clamp", extrapolateRight: "clamp" } as const;
99
+
100
+ export const mix = (a: number, b: number, t: number) => a + (b - a) * t;
101
+
102
+ /** 0→1 progress between two frames with an easing curve (clamped). */
103
+ export const ease = (
104
+ frame: number,
105
+ from: number,
106
+ to: number,
107
+ easing: (t: number) => number = Easing.inOut(Easing.cubic),
108
+ ) => interpolate(frame, [from, Math.max(from + 0.0001, to)], [0, 1], { ...clamp, easing });
109
+
110
+ export const SPRING = {
111
+ smooth: { damping: 200 },
112
+ snappy: { damping: 20, stiffness: 200 },
113
+ bouncy: { damping: 11, stiffness: 140 },
114
+ pop: { damping: 9, stiffness: 180, mass: 0.7 },
115
+ land: { damping: 14, stiffness: 150, mass: 0.9 },
116
+ } satisfies Record<string, Partial<SpringConfig>>;
117
+
118
+ /** Spring that starts at `start` (same frame basis as `frame`), at the project's fps. */
119
+ export const sp = (
120
+ frame: number,
121
+ start: number,
122
+ config: Partial<SpringConfig> = SPRING.snappy,
123
+ durationInFrames?: number,
124
+ ) => spring({ frame: frame - start, fps: runtimeState.fps, config, durationInFrames });
125
+
126
+ /** Seconds → frames at the project's fps. */
127
+ export const sec = (seconds: number) => Math.round(seconds * runtimeState.fps);
128
+
129
+ // ---------------------------------------------------------------------------
130
+ // Browser-export-safe building blocks
131
+
132
+ export interface RadialGlowProps {
133
+ /** Center, as fractions of the box (0..1). Default 0.5 / 0.5. */
134
+ x?: number;
135
+ y?: number;
136
+ /** Radius as a fraction of the box's larger side. Default 0.6. */
137
+ radius?: number;
138
+ color: string;
139
+ /** Opacity at the center. Default 1. */
140
+ opacity?: number;
141
+ /** Where the glow reaches 0 (0..1 of the radius). Default 1. */
142
+ falloff?: number;
143
+ style?: CSSProperties;
144
+ }
145
+
146
+ /**
147
+ * A radial glow drawn with SVG. Use instead of CSS `radial-gradient`, which the
148
+ * browser export cannot draw.
149
+ */
150
+ export function RadialGlow({
151
+ x = 0.5,
152
+ y = 0.5,
153
+ radius = 0.6,
154
+ color,
155
+ opacity = 1,
156
+ falloff = 1,
157
+ style,
158
+ }: RadialGlowProps) {
159
+ const id = useId().replace(/:/g, "");
160
+ return (
161
+ <svg
162
+ width="100%"
163
+ height="100%"
164
+ viewBox="0 0 100 100"
165
+ preserveAspectRatio="none"
166
+ style={{ position: "absolute", inset: 0, width: "100%", height: "100%", ...style }}
167
+ >
168
+ <defs>
169
+ <radialGradient
170
+ id={`glow-${id}`}
171
+ cx={x * 100}
172
+ cy={y * 100}
173
+ r={radius * 100}
174
+ gradientUnits="userSpaceOnUse"
175
+ >
176
+ <stop offset="0" stopColor={color} stopOpacity={opacity} />
177
+ <stop offset={Math.max(0.01, Math.min(1, falloff))} stopColor={color} stopOpacity={0} />
178
+ </radialGradient>
179
+ </defs>
180
+ <rect x="0" y="0" width="100" height="100" fill={`url(#glow-${id})`} />
181
+ </svg>
182
+ );
183
+ }
184
+
185
+ /** Absolutely positioned box in frame fractions (0..1). */
186
+ export function FrameBox({
187
+ x = 0,
188
+ y = 0,
189
+ width = 1,
190
+ height = 1,
191
+ style,
192
+ children,
193
+ }: {
194
+ x?: number;
195
+ y?: number;
196
+ width?: number;
197
+ height?: number;
198
+ style?: CSSProperties;
199
+ children?: ReactNode;
200
+ }) {
201
+ return (
202
+ <div
203
+ style={{
204
+ position: "absolute",
205
+ left: `${x * 100}%`,
206
+ top: `${y * 100}%`,
207
+ width: `${width * 100}%`,
208
+ height: `${height * 100}%`,
209
+ ...style,
210
+ }}
211
+ >
212
+ {children}
213
+ </div>
214
+ );
215
+ }
216
+
217
+ export type {
218
+ AudioClip,
219
+ Box,
220
+ CaptionWord,
221
+ ClipAnim,
222
+ SceneProps,
223
+ StudioClip,
224
+ StudioLayers,
225
+ StudioProject,
226
+ StudioTrack,
227
+ TextStyle,
228
+ } from "./types";
@@ -0,0 +1,22 @@
1
+ // Bundle entry helpers. The helper generates one entry per project that calls
2
+ // createStudioModule() with the project's scenes.
3
+ import { createStudioComposition, type SceneRegistry } from "./composition";
4
+
5
+ export const RUNTIME_VERSION = 1;
6
+
7
+ export interface StudioModule {
8
+ runtimeVersion: number;
9
+ StudioComposition: ReturnType<typeof createStudioComposition>;
10
+ scenes: string[];
11
+ }
12
+
13
+ export function createStudioModule(scenes: SceneRegistry): StudioModule {
14
+ return {
15
+ runtimeVersion: RUNTIME_VERSION,
16
+ StudioComposition: createStudioComposition(scenes),
17
+ scenes: Object.keys(scenes).sort(),
18
+ };
19
+ }
20
+
21
+ export type { SceneRegistry } from "./composition";
22
+ export * from "./types";
@@ -0,0 +1,248 @@
1
+ // Agentcut project format (v1).
2
+ // Keep in sync with lib/studio/types.ts (repo root) and src/studio/schema.ts.
3
+
4
+ export type TrackKind = "scene" | "video" | "image" | "text" | "captions" | "audio";
5
+
6
+ export interface StudioProject {
7
+ version: 1;
8
+ name: string;
9
+ fps: number;
10
+ durationInFrames: number;
11
+ background: string;
12
+ variants: Record<string, { width: number; height: number }>;
13
+ defaultVariant: string;
14
+ /** Google Fonts specs ("Inter:400;800") or local font files. */
15
+ fonts: StudioFont[];
16
+ /** Look for the whole video (components/styles.ts): components, captions and text follow it. */
17
+ style?: string;
18
+ }
19
+
20
+ export type StudioFont = string | { family: string; src: string; weight?: string; style?: "normal" | "italic" };
21
+
22
+ export interface Box {
23
+ x: number;
24
+ y: number;
25
+ width: number;
26
+ height: number;
27
+ }
28
+
29
+ export type ClipAnimPreset =
30
+ | "fade"
31
+ | "slide-up"
32
+ | "slide-down"
33
+ | "slide-left"
34
+ | "slide-right"
35
+ | "pop"
36
+ | "scale"
37
+ | "blur"
38
+ | "none";
39
+
40
+ export interface ClipAnim {
41
+ preset: ClipAnimPreset;
42
+ frames: number;
43
+ }
44
+
45
+ export interface TextStyle {
46
+ fontFamily?: string;
47
+ fontSize?: number;
48
+ fontWeight?: number;
49
+ color?: string;
50
+ align?: "left" | "center" | "right";
51
+ lineHeight?: number;
52
+ letterSpacing?: number;
53
+ textTransform?: "none" | "uppercase" | "lowercase" | "capitalize";
54
+ shadow?: string;
55
+ }
56
+
57
+ export interface CaptionStyle {
58
+ preset?: "pop" | "karaoke" | "plain";
59
+ fontFamily?: string;
60
+ fontSize?: number;
61
+ fontWeight?: number;
62
+ color?: string;
63
+ highlight?: string;
64
+ position?: "bottom" | "center" | "top";
65
+ maxWordsPerLine?: number;
66
+ }
67
+
68
+ interface BaseClipFields {
69
+ id: string;
70
+ name?: string;
71
+ from: number;
72
+ duration: number;
73
+ enter?: ClipAnim;
74
+ exit?: ClipAnim;
75
+ opacity?: number;
76
+ note?: string;
77
+ }
78
+
79
+ export interface SceneClipFields {
80
+ /** A scene file in scenes/ ("Hook" → scenes/Hook.tsx)… */
81
+ scene?: string;
82
+ /** …or an Agentcut library component ("text-reveal"). Exactly one of the two. */
83
+ component?: string;
84
+ props?: Record<string, unknown>;
85
+ }
86
+
87
+ /** Color grade for footage. 1 = unchanged; warmth -1 (cool) … 1 (warm); hue in degrees. */
88
+ export interface ColorGrade {
89
+ brightness?: number;
90
+ contrast?: number;
91
+ saturation?: number;
92
+ warmth?: number;
93
+ hue?: number;
94
+ }
95
+
96
+ export interface VideoClipFields {
97
+ src: string;
98
+ trimStart?: number;
99
+ grade?: ColorGrade;
100
+ volume?: number;
101
+ muted?: boolean;
102
+ fit?: "cover" | "contain";
103
+ box?: Box;
104
+ /** Corner radius in px (half the short side makes a circle). */
105
+ radius?: number;
106
+ playbackRate?: number;
107
+ /** Draw the recorded mouse over this clip (Companion recordings). */
108
+ cursor?: VideoCursor;
109
+ /** "none" keeps the project style's camera moves off this clip. */
110
+ camera?: "style" | "none";
111
+ }
112
+
113
+ export interface VideoCursor {
114
+ /** `<video>.cursor.json`: path, clicks and scrolls in frames of the video file. */
115
+ src: string;
116
+ /** "hidden" draws no pointer (the video already shows one) but keeps click effects. */
117
+ style?: "classic" | "accent" | "spotlight" | "hand" | "hidden";
118
+ /** Percent of the default size (50–200). */
119
+ size?: number;
120
+ /** Ring that spreads from each click. */
121
+ clicks?: boolean;
122
+ /** 0 follows the raw path, 1 glides. */
123
+ smoothing?: number;
124
+ }
125
+
126
+ /** Contents of a `<video>.cursor.json`. */
127
+ export interface CursorTrack {
128
+ version: 1;
129
+ fps: number;
130
+ durationInFrames: number;
131
+ width?: number;
132
+ height?: number;
133
+ space: "video" | "source";
134
+ cursorInVideo: boolean;
135
+ path: [number, number | null, number | null][];
136
+ kinds: [number, string][];
137
+ clicks: { frame: number; x: number; y: number; button: string }[];
138
+ scrolls: { frame: number; x: number; y: number; dy: number }[];
139
+ }
140
+
141
+ export interface ImageClipFields {
142
+ src: string;
143
+ fit?: "cover" | "contain";
144
+ box?: Box;
145
+ radius?: number;
146
+ }
147
+
148
+ export interface TextClipFields {
149
+ text: string;
150
+ box?: Box;
151
+ style?: TextStyle;
152
+ }
153
+
154
+ export interface CaptionWord {
155
+ text: string;
156
+ from: number;
157
+ to: number;
158
+ }
159
+
160
+ export interface CaptionsClipFields {
161
+ words: CaptionWord[];
162
+ style?: CaptionStyle;
163
+ }
164
+
165
+ export interface AudioClipFields {
166
+ src: string;
167
+ volume?: number;
168
+ trimStart?: number;
169
+ fadeIn?: number;
170
+ fadeOut?: number;
171
+ loop?: boolean;
172
+ playbackRate?: number;
173
+ role?: "voice" | "music" | "sfx" | "ambience";
174
+ }
175
+
176
+ type WithVariants<T> = T & {
177
+ variants?: Record<string, Partial<Omit<T, "id">>>;
178
+ };
179
+
180
+ export type SceneClip = WithVariants<BaseClipFields & SceneClipFields>;
181
+ export type VideoClip = WithVariants<BaseClipFields & VideoClipFields>;
182
+ export type ImageClip = WithVariants<BaseClipFields & ImageClipFields>;
183
+ export type TextClip = WithVariants<BaseClipFields & TextClipFields>;
184
+ export type CaptionsClip = WithVariants<BaseClipFields & CaptionsClipFields>;
185
+ export type AudioClip = WithVariants<BaseClipFields & AudioClipFields>;
186
+
187
+ export type StudioClip =
188
+ | SceneClip
189
+ | VideoClip
190
+ | ImageClip
191
+ | TextClip
192
+ | CaptionsClip
193
+ | AudioClip;
194
+
195
+ export interface ClipByKind {
196
+ scene: SceneClip;
197
+ video: VideoClip;
198
+ image: ImageClip;
199
+ text: TextClip;
200
+ captions: CaptionsClip;
201
+ audio: AudioClip;
202
+ }
203
+
204
+ export interface StudioTrack<K extends TrackKind = TrackKind> {
205
+ id: string;
206
+ name: string;
207
+ kind: K;
208
+ hidden?: boolean;
209
+ muted?: boolean;
210
+ locked?: boolean;
211
+ volume?: number;
212
+ clips: ClipByKind[K][];
213
+ }
214
+
215
+ export interface StudioMarker {
216
+ id: string;
217
+ frame: number;
218
+ label: string;
219
+ kind?: "beat" | "cue" | "section";
220
+ }
221
+
222
+ export interface StudioLayers {
223
+ version: 1;
224
+ tracks: StudioTrack[];
225
+ markers: StudioMarker[];
226
+ }
227
+
228
+ /** Props the runtime passes to `StudioComposition`. */
229
+ export interface StudioCompositionProps extends Record<string, unknown> {
230
+ project: StudioProject;
231
+ layers: StudioLayers;
232
+ variant: string;
233
+ /** Base URL for `assets/…` paths, e.g. http://127.0.0.1:32118/studio/files/<slug> */
234
+ assetBase: string;
235
+ /** Base URL for `library:` paths, e.g. http://127.0.0.1:32118/studio/library */
236
+ libraryBase: string;
237
+ /** Linear gain applied to every audio clip (export loudness normalization). */
238
+ masterGain?: number;
239
+ }
240
+
241
+ /** Props every scene component receives (plus the clip's own `props`). */
242
+ export interface SceneProps {
243
+ clip: { id: string; from: number; duration: number };
244
+ variant: string;
245
+ width: number;
246
+ height: number;
247
+ fps: number;
248
+ }
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: agentcut
3
+ description: Use for every change in an Agentcut workspace — making or editing Remotion videos the user watches live: launch spots, promos, lyric videos, explainers, ads, social clips. Covers the project format (project.json, layers.json, scenes/*.tsx), the agentcut_* tools (status, capture, contact sheet, transcribe, analyze audio, listen, export), browser-export-safe CSS, and the house craft rules.
4
+ ---
5
+
6
+ # Agentcut
7
+
8
+ You build videos **live, in front of the user**. They watch the Agentcut page: chat on the
9
+ left, a live Remotion preview, and a timeline where every layer you add appears as a clip they can
10
+ drag, trim, retime or delete. Hand edits write back to the same files you edit. Every message comes
11
+ with a `<studio-context>` block: the active project, the variant on screen, the playhead, the selected
12
+ clips and any attached frame (open attached images with your image viewer: `Read` in Claude Code,
13
+ `view_image` in Codex). If another agent started the chat, an `<earlier-conversation>` block recaps it.
14
+
15
+ ## The project (read `references/format.md` before your first edit)
16
+
17
+ ```
18
+ projects/<slug>/
19
+ project.json fps, durationInFrames, variants (wide 1920x1080, mobile 1080x1920), fonts, background,
20
+ style (optional look for the whole video: see below)
21
+ layers.json the timeline: tracks → clips (frames!), markers
22
+ scenes/*.tsx custom visuals: one default-exported React component per file
23
+ assets/ voice, music, sfx, images, video, fonts
24
+ notes.md your cue sheet and the numbers behind sound choices
25
+ renders/ exports; never delete or overwrite
26
+ ```
27
+
28
+ - **Everything on the timeline is a clip in `layers.json`**, so the user can edit it. Never hide
29
+ sounds, images or text inside scene code when they could be clips: music, voice and every SFX are
30
+ audio clips; screenshots and logos are image clips; captions are a captions clip; overlays like
31
+ film grain or a vignette are scene clips on their own track.
32
+ - **Scenes are for what clips can't express**: rebuilt product UI, kinetic typography, diagrams,
33
+ backgrounds. A scene clip names a component (`"scene": "Hook"` → `scenes/Hook.tsx`) and passes
34
+ `props`. Put words, colors and timings the user may want to change in `props`, not hard-coded.
35
+ - **Frames are the unit** everywhere. `tracks[0]` is drawn on top. Give tracks and clips readable,
36
+ stable ids (`voice`, `music`, `sfx`, `scenes`; `hook`, `f2-card`, `sfx-whoosh-reveal`) and a
37
+ `note` on cue clips saying why they sit where they sit ("whoosh 2f before the reveal cut").
38
+ - Read `layers.json` right before editing it: the user may have changed it by hand. Keep their
39
+ edits unless asked otherwise.
40
+ - **Project styles** are whole editing presets (Voltrox, Snipwork, Doodlepad, Phosphor, Lumen, …):
41
+ look, fonts, palette, text animation, camera moves, captions and texture. Read
42
+ `.agentcut/components/STYLES.md` when the project has a `"style"`, when the user names a style
43
+ ("use the Snipwork style", "make it attention grabbing"), or when a message asks you to restyle.
44
+ Applying one = set `style` in project.json, then follow "Applying a style" there. With a style
45
+ set, leave style-driven props out of clips, and make your own scene files match its tokens.
46
+ - **Video style presets** are recipes for whole videos that aren't talking heads (music and lyric videos, …), kept in
47
+ `library/presets/<id>/` with a PROMPT.md. When a message names one, or asks to save the open video's style as a
48
+ preset, read `references/presets.md` first.
49
+
50
+ ## Loop
51
+
52
+ 1. `agentcut_status` — confirms the page is connected, which project is open, and any
53
+ build or validation errors. Use `agentcut_create_project` for a new video (it opens it).
54
+ 2. **Plan as a cue sheet** in `notes.md`: beats with frame ranges. When there's a voiceover, the voice
55
+ drives the timeline: get word timings (`agentcut_transcribe`) and cut scenes a few
56
+ frames before the word they illustrate. With music, get beats (`agentcut_analyze_audio`)
57
+ and land cuts and hits on them. Show the plan in two or three lines in chat.
58
+ 3. **Build one beat at a time** so the user sees the video grow: write the scene file, add its clip
59
+ (and its sounds) to `layers.json`, then `agentcut_status` (fix build errors at once),
60
+ then `agentcut_capture_frames` at the entrance, the settled hold, and the exit. Open the
61
+ PNGs and fix clipping, overlap, weak contrast and cramped text before moving on.
62
+ 4. **Both sizes.** Every scene works in wide and mobile (`useStudio()` / `width`, `height` props). Capture
63
+ both. Use clip `variants.mobile` overrides for boxes and text sizes.
64
+ 5. **Sound** (`references/sound.md`): voice and music first, then SFX on picture cues. You cannot hear;
65
+ never say a sound fits without `agentcut_listen_*` numbers, and write them in notes.md.
66
+ 6. **Review**: `agentcut_contact_sheet` across the whole video for each variant, and
67
+ `agentcut_listen_critique` for the mix. Fix what they show.
68
+ 7. **Hand off** in a few lines: what's where, what's easy to tweak by hand. Export only when the user
69
+ asks (`agentcut_export`); report the paths and measured loudness.
70
+
71
+ `agentcut_focus` moves the user's playhead / selects a clip when you want to show them something.
72
+
73
+ ## Browser export rules (details: `references/browser-export.md`)
74
+
75
+ The export and the captures use Remotion's web renderer, which draws a subset of CSS:
76
+ - No `z-index` (order elements back to front), no `mix-blend-mode`, `backdrop-filter`, inset shadows,
77
+ `object-position`, CSS 3D `perspective`.
78
+ - Backgrounds: `linear-gradient` only. For radial glows use `<RadialGlow>` from `agentcut`.
79
+ - `<Audio>`/`<Video>` from `@remotion/media` (never `OffthreadVideo`/`Html5Audio`), `<Img>` from remotion.
80
+ - Fonts come from `project.json` (Google specs or local files in assets/fonts).
81
+ - three.js/WebGL: create the canvas inside the effect, never `forceContextLoss()` a canvas React keeps
82
+ (see `references/browser-export.md`).
83
+ If a capture doesn't look like you intended, assume an unsupported property first.
84
+
85
+ ## House style (details: `references/craft.md`)
86
+
87
+ - Sharp motion graphics, not zoomed screenshots: rebuild product screens as live React components on
88
+ a fixed canvas and move a camera over them with transforms. Text stays sharp at every zoom.
89
+ - Springs for entrances (`sp`, `SPRING.pop/snappy/land`), eased exits, beat pulses after the drop.
90
+ - Abstract props only: no drawn hands, bodies or figure-like shapes.
91
+ - Match the look to the brand or the song; one idea per beat; generous type; strong contrast.
92
+ - Never show a Suno artist tag or other account names in a video, cover or metadata.
93
+
94
+ ## Component library (details: `references/components.md`)
95
+
96
+ Check `agentcut_components` before writing an effect: titles, lower thirds, stat counters,
97
+ prompt boxes and more are ready-made clips (`{ "component": "<id>", "props": {…} }`) the user can edit in
98
+ the inspector. Write a scene only for what the library can't do.
99
+
100
+ ## Footage from the editor (details: `references/footage.md`)
101
+
102
+ Projects with a **Footage** track came from the editor's "Send to Agentcut". Treat that video as the
103
+ user's real edit: cut silences with `trimStart` pieces, grade it with `grade`, restyle the captions, add
104
+ motion graphics above it. Never re-encode or replace the file.
105
+
106
+ Projects with **Screen** and **Camera** tracks are *raw takes*: the untouched recordings, nothing cut or
107
+ styled. You do the whole edit: cut both tracks together, keep the camera in sync, frame the screen
108
+ (zooms, layouts). Read the "Raw takes" section of `references/footage.md` before the first edit.
109
+
110
+ Screen recordings from ScreenSlick Companion come with a `<video>.cursor.json` (mouse path, clicks,
111
+ scrolls). Check `agentcut_media_info` on the video for its summary and read
112
+ `references/cursor.md`: zoom on the busiest clicks, cut idle stretches, speed up typing, and keep the
113
+ clip's `cursor` field on every piece you cut.
114
+
115
+ ## Working with the user
116
+
117
+ The user edits the same timeline by hand while you work, and points at things instead of describing
118
+ them. Every message's `<studio-context>` carries the playhead frame, the selected clips and any files they
119
+ pointed at ("The user is pointing at these project files"). "Here", "now", "this" and "at the playhead" mean
120
+ those. Do exactly what they asked with that file (place it, time it, style it), then say in one line what you
121
+ did and where (frame and time), so they can check it on the timeline. If they edited a clip you created,
122
+ keep their change.
123
+
124
+ ## Tools
125
+
126
+ Never read, print or ask for API keys (they live outside the workspace; the helper uses them).
127
+ Use the `agentcut_*` MCP tools for everything that needs the studio page. Files, the shell and scripts are fine: run
128
+ scripts from the project folder (e.g. composing music or fetching CC0 sounds, see `references/sound.md`).
129
+
130
+ | Tool | Use |
131
+ |---|---|
132
+ | `agentcut_status` | first, and after every edit (build + validation) |
133
+ | `agentcut_create_project` / `_open_project` | new video / switch project |
134
+ | `agentcut_capture_frames` | look at specific frames (same renderer as export) |
135
+ | `agentcut_contact_sheet` | stills sheet of the whole video before export |
136
+ | `agentcut_media_info` | exact durations (frames) for clips |
137
+ | `agentcut_transcribe` | word timings for voice / lyrics |
138
+ | `agentcut_voice_options` / `_generate_voice` | voice-overs with the user's own provider (see `references/sound.md`) |
139
+ | `agentcut_components` | the component library: search, then `id` for props and a ready clip |
140
+ | `agentcut_music_catalog` / `_add_catalog_music` | the Agentcut music library (200+ hosted songs) |
141
+ | `agentcut_music_options` / `_generate_music` | original songs with Lyria (the user's Gemini key); see `references/sound.md` › Music |
142
+ | `agentcut_analyze_audio` | tempo, beats, onsets, per-frame energy |
143
+ | `agentcut_listen_rank` / `_tags` / `_realness` / `_measure` | choose and check sounds |
144
+ | `agentcut_listen_critique` | review the final mix and cue sync |
145
+ | `agentcut_export` | MP4 + cover into renders/ (only when asked) |
146
+ | `agentcut_focus` | show the user a frame or clip |
147
+
148
+ Files you add for the video go in the project's `assets/` (copy them there; tools take
149
+ `assets/<file>` or `library:<path>` paths). Never edit `.agentcut/`, `CLAUDE.md` or `AGENTS.md` (managed).