stillmade-sdk 0.1.42 → 0.1.44

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 (262) hide show
  1. package/.stillmade/sdk-baseline.json +6 -8
  2. package/AGENTS.md +15 -10
  3. package/FRAME_VIEWS.md +113 -0
  4. package/INTERFACE_DESIGN.md +62 -22
  5. package/MOBILE_UI.md +4 -2
  6. package/MODULES.md +152 -6
  7. package/PASTE_TO_LLM.md +35 -25
  8. package/README.md +3 -2
  9. package/SDK.md +994 -550
  10. package/UI_AESTHETIC.md +22 -2
  11. package/blocks/generate/package.js +1 -0
  12. package/blocks/generate/versions/1.0.0/package.js +463 -0
  13. package/docs/build/audio-to-editor.md +36 -0
  14. package/docs/build/block-builder-contract.md +150 -0
  15. package/docs/build/comfyui.md +227 -0
  16. package/docs/build/concepts.md +40 -0
  17. package/docs/build/context.md +159 -0
  18. package/docs/build/cookbook.md +57 -0
  19. package/docs/build/custom-interface.md +617 -0
  20. package/docs/build/data-types.md +83 -0
  21. package/docs/build/frame-views.md +259 -0
  22. package/docs/build/generate-media.md +59 -0
  23. package/docs/build/github-applications.md +314 -0
  24. package/docs/build/hosted-images.md +214 -0
  25. package/docs/build/hosted-music.md +39 -0
  26. package/docs/build/hosted-speech.md +157 -0
  27. package/docs/build/hosted-text.md +246 -0
  28. package/docs/build/image-description.md +49 -0
  29. package/docs/build/interface-design.md +343 -0
  30. package/docs/build/javascript.md +63 -0
  31. package/docs/build/local-preview.md +61 -0
  32. package/docs/build/media-analysis.md +27 -0
  33. package/docs/build/media.md +400 -0
  34. package/docs/build/mobile-ui.md +106 -0
  35. package/docs/build/modules.md +487 -0
  36. package/docs/build/original-blocks.md +70 -0
  37. package/docs/build/outside-apis.md +128 -0
  38. package/docs/build/production-context-templates.md +12 -0
  39. package/docs/build/project-storage.md +94 -0
  40. package/docs/build/quickstart.md +48 -0
  41. package/docs/build/recipes.md +103 -0
  42. package/docs/build/script-handoff.md +45 -0
  43. package/docs/build/script-writer.md +34 -0
  44. package/docs/build/state.md +223 -0
  45. package/docs/build/testing.md +112 -0
  46. package/docs/build/timeline-edits.md +116 -0
  47. package/docs/build/timeline-proposals.md +76 -0
  48. package/docs/build/transcription.md +59 -0
  49. package/docs/build/triggers.md +59 -0
  50. package/docs/build/tutorial.md +52 -0
  51. package/docs/build/typescript.md +34 -0
  52. package/docs/build/video-generation.md +61 -0
  53. package/docs/build/web-reading.md +37 -0
  54. package/docs/build/with-your-ai.md +27 -0
  55. package/docs/changelog.md +9 -0
  56. package/docs/creators.md +21 -0
  57. package/docs/distribute/discovery.md +43 -0
  58. package/docs/distribute/imports.md +58 -0
  59. package/docs/distribute/publishing.md +29 -0
  60. package/docs/distribute/sdk-versions.md +36 -0
  61. package/docs/distribute/selling.md +14 -0
  62. package/docs/distribute/teams.md +60 -0
  63. package/docs/distribute/versioning.md +28 -0
  64. package/docs/examples.md +23 -0
  65. package/docs/gallery.md +26 -0
  66. package/docs/index.md +50 -0
  67. package/docs/native-mcp.md +307 -0
  68. package/docs/project-types/automation.md +43 -0
  69. package/docs/project-types/batches.md +50 -0
  70. package/docs/project-types/build.md +42 -0
  71. package/docs/project-types/completion.md +15 -0
  72. package/docs/project-types/conditions.md +21 -0
  73. package/docs/project-types/hosted-review.md +115 -0
  74. package/docs/project-types/onboarding.md +75 -0
  75. package/docs/project-types/running.md +309 -0
  76. package/docs/project-types/testing.md +72 -0
  77. package/docs/reference/application-artifacts.md +87 -0
  78. package/docs/reference/authoring-guide.md +134 -0
  79. package/docs/reference/browser-applications.md +267 -0
  80. package/docs/reference/capabilities.md +45 -0
  81. package/docs/reference/cli.md +71 -0
  82. package/docs/reference/connection-api.md +59 -0
  83. package/docs/reference/cooperative-jobs.md +13 -0
  84. package/docs/reference/desktop-capabilities.md +172 -0
  85. package/docs/reference/desktop-execution.md +77 -0
  86. package/docs/reference/errors.md +233 -0
  87. package/docs/reference/execution.md +800 -0
  88. package/docs/reference/first-party-blocks.md +40 -0
  89. package/docs/reference/generation-models.md +59 -0
  90. package/docs/reference/limits.md +306 -0
  91. package/docs/reference/manifest-kinds-controls.md +36 -0
  92. package/docs/reference/manifest.md +181 -0
  93. package/docs/reference/operations.md +36 -0
  94. package/docs/reference/package-jobs.md +35 -0
  95. package/docs/reference/parity.md +55 -0
  96. package/docs/reference/permissions.md +86 -0
  97. package/docs/reference/ports.md +26 -0
  98. package/docs/reference/types.md +268 -0
  99. package/docs/reference/universal-resolver.md +303 -0
  100. package/docs/reference/view-bridge.md +60 -0
  101. package/docs/reference/view-rules.md +15 -0
  102. package/docs/reference/workspace-sync.md +25 -0
  103. package/docs/sdk.md +34 -0
  104. package/docs/tools/block-remix.md +211 -0
  105. package/docs/tools/llm.md +2213 -0
  106. package/docs/tools/repository-adaptation.md +613 -0
  107. package/examples/check-clip.stillmade.json +4 -1
  108. package/examples/generate-video.stillmade.json +6 -2
  109. package/examples/research-topic.stillmade.json +5 -1
  110. package/examples/text-workflow.stillmade.json +3 -32
  111. package/examples/timeline-polish.stillmade.json +11 -3
  112. package/examples/transcribe-audio.stillmade.json +11 -3
  113. package/package.json +1 -1
  114. package/packages/block-cli/cli.js +13 -6
  115. package/packages/block-cli/dev-host/assets/host.js +76 -38
  116. package/packages/block-cli/dev-host/assets/index.css +1 -1
  117. package/packages/block-cli/format.js +1 -1
  118. package/packages/block-cli/templates.js +31 -13
  119. package/packages/block-cli/type-packages.js +119 -0
  120. package/packages/block-platform/block-readiness.js +5 -0
  121. package/packages/block-platform/canvas.js +2 -1
  122. package/packages/block-platform/catalog.js +27 -48
  123. package/packages/block-platform/native-host-inventory.js +0 -226
  124. package/packages/block-platform/plain-descriptions.js +1 -25
  125. package/packages/block-platform/project-type-starters.js +13 -53
  126. package/packages/block-platform/script-handoff.js +2 -4
  127. package/packages/block-platform/type-workspace.js +2 -0
  128. package/packages/block-sdk/appearance.js +3 -1
  129. package/packages/block-sdk/block-tier.js +1 -1
  130. package/packages/block-sdk/builder-contract.js +10 -8
  131. package/packages/block-sdk/capabilities.js +1 -1
  132. package/packages/block-sdk/contracts.js +6 -2
  133. package/packages/block-sdk/first-party-identities.js +1 -84
  134. package/packages/block-sdk/first-party-packages.js +3 -85
  135. package/packages/block-sdk/generation-catalog.js +15 -3
  136. package/packages/block-sdk/index.d.ts +2 -1
  137. package/packages/block-sdk/media-analysis-example.js +1 -1
  138. package/packages/block-sdk/mock-host.js +7 -1
  139. package/packages/block-sdk/module-host-calls.js +35 -10
  140. package/packages/block-sdk/module-hosted.js +15 -2
  141. package/packages/block-sdk/module-media-access.js +71 -0
  142. package/packages/block-sdk/module-node.js +1 -1
  143. package/packages/block-sdk/portable-media-actions.js +1 -1
  144. package/packages/block-sdk/runtime.js +1 -1
  145. package/packages/block-sdk/timeline-proposal-example.js +1 -1
  146. package/packages/block-sdk/transcription-example.js +1 -1
  147. package/packages/block-sdk/video-generation-example.js +1 -1
  148. package/packages/block-sdk/view-bridge.js +4 -1
  149. package/packages/block-sdk/view-design.js +17 -14
  150. package/packages/block-sdk/web-example.js +1 -1
  151. package/packages/design-system/block-kit.css +48 -12
  152. package/packages/design-system/block-kit.html +3 -2
  153. package/blocks/mcp-motion-planner/versions/1.1.0/package.js +0 -97
  154. package/blocks/motion-designer/versions/1.0.1/package.js +0 -173318
  155. package/blocks/motion-designer/versions/1.0.2/package.js +0 -173318
  156. package/blocks/motion-frame-review/versions/1.1.1/package.js +0 -465
  157. package/blocks/motion-frame-review/versions/1.1.2/package.snapshot.js +0 -572
  158. package/blocks/narration/package.js +0 -1
  159. package/blocks/narration/versions/1.0.0/package.js +0 -221
  160. package/blocks/narration/versions/1.0.1/package.js +0 -221
  161. package/blocks/native/sm.animated-scene/versions/2.0.0/package.js +0 -475
  162. package/blocks/native/sm.animated-scene/versions/2.1.0/package.js +0 -498
  163. package/blocks/native/sm.animated-scene/versions/2.2.0/package.js +0 -524
  164. package/blocks/native/sm.animated-scene/versions/2.3.0/package.js +0 -618
  165. package/blocks/native/sm.animated-scene/versions/2.3.1/package.js +0 -618
  166. package/blocks/native/sm.animated-scene/versions/2.3.2/package.js +0 -723
  167. package/blocks/native/sm.animated-scene/versions/2.3.3/package.js +0 -723
  168. package/blocks/native/sm.animated-scene/versions/2.3.4/package.js +0 -676
  169. package/blocks/native/sm.animated-scene/versions/2.3.5/package.js +0 -693
  170. package/blocks/native/sm.animated-scene/versions/2.3.6/package.js +0 -700
  171. package/blocks/native/sm.animated-scene/versions/2.3.7/package.js +0 -747
  172. package/blocks/native/sm.animated-scene/versions/2.3.8/package.js +0 -769
  173. package/blocks/native/sm.animated-scene/versions/2.3.9/package.js +0 -769
  174. package/blocks/native/sm.animated-scene-assistant/versions/1.0.0/package.js +0 -183
  175. package/blocks/native/sm.blueprint/versions/2.0.0/package.js +0 -358
  176. package/blocks/native/sm.blueprint/versions/2.1.0/package.js +0 -358
  177. package/blocks/native/sm.blueprint/versions/2.1.1/package.js +0 -358
  178. package/blocks/native/sm.blueprint/versions/2.1.2/package.js +0 -358
  179. package/blocks/native/sm.blueprint/versions/2.1.3/package.js +0 -381
  180. package/blocks/native/sm.blueprint/versions/2.1.4/package.js +0 -381
  181. package/blocks/native/sm.blueprint/versions/2.1.5/package.js +0 -339
  182. package/blocks/native/sm.blueprint/versions/2.1.6/package.js +0 -356
  183. package/blocks/native/sm.blueprint/versions/2.1.7/package.js +0 -363
  184. package/blocks/native/sm.blueprint/versions/2.1.8/package.js +0 -410
  185. package/blocks/native/sm.blueprint/versions/2.1.9/package.js +0 -422
  186. package/blocks/native/sm.blueprint-assistant/versions/1.0.0/package.js +0 -172
  187. package/blocks/native/sm.chat/versions/2.0.0/package.js +0 -144
  188. package/blocks/native/sm.chat/versions/2.0.1/package.js +0 -97
  189. package/blocks/native/sm.chat/versions/2.0.2/package.js +0 -100
  190. package/blocks/native/sm.chat/versions/2.0.3/package.js +0 -100
  191. package/blocks/native/sm.continue-if/versions/1.0.0/package.js +0 -168
  192. package/blocks/native/sm.describe-media/versions/2.0.0/package.js +0 -153
  193. package/blocks/native/sm.describe-media/versions/2.0.1/package.js +0 -156
  194. package/blocks/native/sm.describe-media/versions/2.1.0/package.js +0 -140
  195. package/blocks/native/sm.image-editor/versions/2.0.0/package.js +0 -183
  196. package/blocks/native/sm.image-editor/versions/2.0.1/package.js +0 -190
  197. package/blocks/native/sm.new-items/versions/1.0.0/package.js +0 -191
  198. package/blocks/native/sm.pick-photos/versions/1.0.0/package.js +0 -334
  199. package/blocks/native/sm.quality-audit/versions/1.0.0/package.js +0 -192
  200. package/blocks/native/sm.quality-audit/versions/1.0.1/package.js +0 -192
  201. package/blocks/native/sm.quality-audit/versions/1.0.2/package.js +0 -195
  202. package/blocks/native/sm.research/versions/2.0.0/package.js +0 -175
  203. package/blocks/native/sm.research/versions/2.0.1/package.js +0 -184
  204. package/blocks/native/sm.research/versions/2.0.2/package.js +0 -187
  205. package/blocks/native/sm.script/versions/2.0.0/package.js +0 -144
  206. package/blocks/native/sm.script/versions/2.1.0/package.js +0 -144
  207. package/blocks/native/sm.script/versions/2.1.1/package.js +0 -144
  208. package/blocks/native/sm.script/versions/2.1.2/package.js +0 -105
  209. package/blocks/native/sm.script/versions/2.1.3/package.js +0 -152
  210. package/blocks/native/sm.script/versions/2.1.4/package.js +0 -156
  211. package/blocks/native/sm.script/versions/2.1.5/package.js +0 -156
  212. package/blocks/native/sm.shot-plan/versions/2.0.0/package.js +0 -301
  213. package/blocks/native/sm.shot-plan/versions/2.1.0/package.js +0 -528
  214. package/blocks/native/sm.shot-plan/versions/2.1.1/package.js +0 -528
  215. package/blocks/native/sm.shot-plan/versions/2.1.2/package.js +0 -528
  216. package/blocks/native/sm.shot-plan/versions/2.1.3/package.js +0 -536
  217. package/blocks/native/sm.shot-plan/versions/2.2.0/package.js +0 -800
  218. package/blocks/native/sm.shot-plan/versions/2.2.1/package.js +0 -920
  219. package/blocks/native/sm.shot-plan-assistant/versions/1.0.0/package.js +0 -173
  220. package/blocks/native/sm.stock-search/versions/2.0.0/package.js +0 -174
  221. package/blocks/native/sm.thumbnail/versions/2.0.0/package.js +0 -137
  222. package/blocks/native/sm.thumbnail/versions/2.0.1/package.js +0 -140
  223. package/blocks/native/sm.transcribe/versions/2.0.0/package.js +0 -163
  224. package/blocks/native/sm.transcribe/versions/2.0.1/package.js +0 -168
  225. package/blocks/native/sm.whiteboard-assistant/versions/1.0.0/package.js +0 -175
  226. package/blocks/native/sm.youtube/versions/2.0.0/package.js +0 -217
  227. package/blocks/occasion-story/package.js +0 -1
  228. package/blocks/occasion-story/versions/1.0.0/package.js +0 -1658
  229. package/blocks/occasion-story/versions/1.0.1/package.js +0 -1699
  230. package/blocks/occasion-story/versions/1.0.2/package.js +0 -1682
  231. package/blocks/photo-reel-composer/versions/1.0.0/package.js +0 -3043
  232. package/blocks/photo-reel-composer/versions/1.0.1/package.js +0 -3026
  233. package/blocks/photo-reel-composer/versions/1.0.2/package.js +0 -4149
  234. package/blocks/product-ad-variants/versions/1.0.0/package.js +0 -2911
  235. package/blocks/product-launch-director/versions/1.0.0/package.js +0 -103
  236. package/blocks/release-visuals/package.js +0 -1
  237. package/blocks/release-visuals/versions/1.0.0/package.js +0 -1492
  238. package/blocks/release-visuals/versions/1.0.1/package.js +0 -1517
  239. package/blocks/release-visuals/versions/1.0.2/package.js +0 -1500
  240. package/blocks/screen-recorder/package.js +0 -1
  241. package/blocks/screen-recorder/versions/1.0.0/package.js +0 -223
  242. package/blocks/screen-recorder/versions/1.0.1/package.js +0 -223
  243. package/blocks/short-form-finish/package.js +0 -1
  244. package/blocks/short-form-finish/versions/1.0.0/package.js +0 -1043
  245. package/blocks/short-form-finish/versions/1.0.1/package.js +0 -1043
  246. package/blocks/short-form-finish/versions/1.0.2/package.js +0 -1043
  247. package/blocks/short-form-finish/versions/1.0.3/package.js +0 -1026
  248. package/examples/saas-product-launch-reviewed-source.stillmade.json +0 -383
  249. package/examples/saas-product-launch.stillmade.json +0 -304
  250. package/packages/block-platform/dealer-inventory-video-project-type.js +0 -38
  251. package/packages/block-platform/first-revenue-project-types.js +0 -46
  252. package/packages/block-platform/fixture-starters.js +0 -13
  253. package/packages/block-platform/launch-project-source.js +0 -10
  254. package/packages/block-platform/launch-project.js +0 -30
  255. package/packages/block-platform/motion-project-types.js +0 -55
  256. package/packages/block-platform/motion-starters.js +0 -14
  257. package/packages/block-platform/product-ad-variants-project-type.js +0 -30
  258. package/packages/block-platform/product-launch-updated.js +0 -90
  259. package/packages/block-platform/revenue-review-project-types.js +0 -36
  260. package/packages/block-platform/revenue-review-starters.js +0 -13
  261. package/packages/block-platform/script-writer.js +0 -29
  262. package/packages/block-platform/website-source-block.js +0 -14
@@ -1,528 +0,0 @@
1
- // Generated by scripts/build-owned-blocks.mjs. Edit the owned source files.
2
- export default {
3
- "manifest": {
4
- "schemaVersion": 1,
5
- "sdkVersion": "0.1.0",
6
- "id": "sm.shot-plan",
7
- "version": "2.1.1",
8
- "name": "Shots",
9
- "description": "Build a timed shot plan from the current narration, then review and edit narration, visual direction, framing, duration, fulfillment, motion, statements, order, and retained custom fields.",
10
- "kind": "workspace",
11
- "runtime": "javascript",
12
- "entry": "src/run.js",
13
- "license": "MIT",
14
- "provenance": {
15
- "notice": "Original source (authorship declared by the packager)\nLicense: MIT\nChanges: Original implementation declared by the packager; no reused repository or dependency code.\nFiles: LICENSE, src/run.js, src/view.json\n\nMIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
16
- "portableSources": [
17
- {
18
- "kind": "original",
19
- "license": "MIT",
20
- "paths": [
21
- "LICENSE",
22
- "src/run.js",
23
- "src/view.json"
24
- ],
25
- "evidence": [
26
- "upstream/0/LICENSE",
27
- "upstream/0/src/run.js",
28
- "upstream/0/src/view.json"
29
- ],
30
- "changes": "Original implementation declared by the packager; no reused repository or dependency code."
31
- }
32
- ]
33
- },
34
- "inputs": {
35
- "shotPlan": {
36
- "type": "shot-plan",
37
- "context": "shotPlan",
38
- "primary": true,
39
- "required": false,
40
- "default": {
41
- "schemaVersion": 1,
42
- "shots": []
43
- },
44
- "description": "The complete current shot plan. Unknown fields and saved media identities are retained."
45
- },
46
- "transcript": {
47
- "type": "transcript",
48
- "context": "transcript",
49
- "required": false,
50
- "default": {
51
- "schemaVersion": 1,
52
- "text": "",
53
- "words": []
54
- },
55
- "description": "Current narration words and timings used to build an initial plan when the project has no shots."
56
- },
57
- "script": {
58
- "type": "script",
59
- "context": "script",
60
- "required": false,
61
- "default": {
62
- "schemaVersion": 1,
63
- "text": ""
64
- },
65
- "description": "Current narration text used when word timings are unavailable."
66
- },
67
- "updatedShotPlan": {
68
- "type": "shot-plan",
69
- "required": false,
70
- "default": {
71
- "schemaVersion": 1,
72
- "shots": []
73
- },
74
- "description": "The complete edited plan prepared in this workspace."
75
- },
76
- "commit": {
77
- "type": "boolean",
78
- "default": false,
79
- "description": "Prepare the edited plan for StillMade review and Apply."
80
- }
81
- },
82
- "outputs": {
83
- "shotPlan": {
84
- "type": "shot-plan",
85
- "primary": true,
86
- "role": "production_shot_plan",
87
- "description": "The complete edited shot plan for the next Step."
88
- },
89
- "edit": {
90
- "type": "workspace-edit",
91
- "description": "An exact before/after Shots change reviewed before it updates the project."
92
- }
93
- },
94
- "permissions": {
95
- "project": [
96
- "context.shotPlan.read",
97
- "context.transcript.read",
98
- "context.script.read",
99
- "workspace.shotPlan.propose"
100
- ],
101
- "network": [],
102
- "filesystem": [],
103
- "secrets": []
104
- },
105
- "ui": [],
106
- "platforms": {
107
- "phone": {
108
- "supported": true
109
- },
110
- "browser": {
111
- "supported": true
112
- },
113
- "desktop": {
114
- "supported": true
115
- }
116
- }
117
- },
118
- "code": "const copy = value => JSON.parse(JSON.stringify(value));\nconst words = Array.isArray(input.transcript?.words) ? input.transcript.words : [];\nconst scriptText = String(input.transcript?.text || input.script?.text || (typeof input.script==='string'?input.script:'')).trim();\nconst timed = word => ({text:String(word?.text || word?.word || '').trim(),start:Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000,end:Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000});\nconst make = (text,start,end,index) => ({id:`shot-${index+1}-${Math.max(0,Math.round(start*1000))}`,voiceoverText:text,shotDescription:text?`Show a clear visual for: ${text}`:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\nconst fromWords = () => {const clean=words.map(timed).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start);const groups=[];let group=[];clean.forEach(word=>{group.push(word);const duration=word.end-group[0].start,punctuation=/[.!?]$/.test(word.text);if((punctuation&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[];}});if(group.length)groups.push(group);return groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group[group.length-1].end,index));};\nconst fromScript = () => {const parts=(scriptText.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return parts.map((text,index)=>{const duration=Math.max(2,Math.round(text.split(/\\s+/).length/2.5*10)/10),shot=make(text,cursor,cursor+duration,index);cursor+=duration;return shot;});};\nconst generated = () => ({schemaVersion:1,shots:words.length?fromWords():fromScript()});\nconst source = copy(input.shotPlan || {schemaVersion:1,shots:[]});\nconst fallback = !source.shots?.length ? generated() : source;\nconst candidate = input.commit ? copy(input.updatedShotPlan) : copy(fallback);\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1 || !Array.isArray(candidate.shots)) throw new Error('Keep the complete version 1 shot plan.');\nif (candidate.shots.length > 2000 || !candidate.shots.every(shot => shot && !Array.isArray(shot) && typeof shot.id === 'string' && shot.id.length > 0 && shot.id.length <= 200) || new Set(candidate.shots.map(shot => shot.id)).size !== candidate.shots.length) throw new Error('Shots need up to 2,000 distinct retained IDs.');\nreturn {shotPlan:candidate,edit:{schemaVersion:1,title:`Update ${candidate.shots.length} planned shot${candidate.shots.length===1?'':'s'}`,field:'shotPlan',before:source,after:candidate}};\n",
119
- "view": {
120
- "html": "<main class=\"shots-workspace\">\n <header><div><small>Production workspace</small><h1>Shots</h1><p id=\"summary\">Loading the shot plan…</p></div><div class=\"actions\"><button id=\"build\" type=\"button\" class=\"secondary\">Build from narration</button><button id=\"reset\" type=\"button\" class=\"secondary\">Reset changes</button><button id=\"add\" type=\"button\" class=\"secondary\">Add shot</button><button id=\"save\" type=\"button\" data-stillmade-action=\"run\">Review changes</button></div></header>\n <output id=\"status\" role=\"status\" aria-live=\"polite\"></output>\n <section id=\"shots\" class=\"shots\" aria-label=\"Planned shots\"></section>\n <details><summary>Complete shot-plan data</summary><p>Every field is retained. Use this editor for custom fields not shown on the cards.</p><label for=\"raw\">Complete shot-plan JSON</label><textarea id=\"raw\" class=\"raw\" spellcheck=\"false\"></textarea><button id=\"applyRaw\" type=\"button\" class=\"secondary\">Apply JSON to workspace</button></details>\n</main>\n",
121
- "css": ".shots-workspace{max-width:1100px;margin:0 auto;padding:8px;color:var(--fg)}header,.actions,.card-head,.row,.order{display:flex;align-items:center;gap:10px;flex-wrap:wrap}header{justify-content:space-between;margin-bottom:14px}header h1{margin:2px 0}header p,header small,details p,output{color:var(--fg-muted)}\n.shots{display:grid;gap:12px}.card,details{padding:16px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}.card-head{justify-content:space-between}.card h2{margin:0;font-size:18px}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}label{display:grid;gap:5px;margin:8px 0;font-size:13px;font-weight:600}input,textarea,select{width:100%;background:var(--bg)}textarea{min-height:82px;resize:vertical}.wide{grid-column:1/-1}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}.raw{min-height:340px;font-family:var(--font-mono);font-size:12px}output{display:block;min-height:24px;margin:8px 2px}.order button{min-width:44px}.empty{padding:28px;text-align:center;border:1px dashed var(--border-tok);border-radius:var(--r-3);color:var(--fg-muted)}\n@media(max-width:760px){.shots-workspace{padding:0}.grid{grid-template-columns:1fr}.actions{width:100%}.actions button{flex:1}.card,details{padding:12px}}\n",
122
- "javascript": "const status=document.getElementById('status'),summary=document.getElementById('summary'),raw=document.getElementById('raw'),save=document.getElementById('save'),build=document.getElementById('build');\nlet source={schemaVersion:1,shots:[]},draft={schemaVersion:1,shots:[]},transcript={schemaVersion:1,text:'',words:[]},script={schemaVersion:1,text:''},busy=false,revision=0;\nconst clone=value=>JSON.parse(JSON.stringify(value));\nconst text=value=>value===undefined||value===null?'':String(value);\nconst wordStart=word=>Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000;\nconst wordEnd=word=>Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000;\nconst make=(line,start,end,index)=>({id:'shot-'+String(index+1)+'-'+String(Math.max(0,Math.round(start*1000))),voiceoverText:line,shotDescription:line?'Show a clear visual for: '+line:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\nconst plan=()=>{const words=Array.isArray(transcript.words)?transcript.words.map(word=>({text:text(word?.text||word?.word).trim(),start:wordStart(word),end:wordEnd(word)})).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start):[];if(words.length){const groups=[];let group=[];words.forEach(word=>{group.push(word);const duration=word.end-group[0].start;if((/[.!?]$/.test(word.text)&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[]}});if(group.length)groups.push(group);return {schemaVersion:1,shots:groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group.at(-1).end,index))}}const narration=text(transcript.text||script.text||(typeof script==='string'?script:'')).trim(),parts=(narration.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return {schemaVersion:1,shots:parts.map((line,index)=>{const duration=Math.max(2,Math.round(line.split(/\\s+/).length/2.5*10)/10),shot=make(line,cursor,cursor+duration,index);cursor+=duration;return shot})}};\nconst field=(label,action,value,type='text',wide=false)=>({tag:'label',className:wide?'wide':'',children:[{tag:'span',text:label},type==='textarea'?{tag:'textarea',action,value:text(value),disabled:busy,label}:{tag:'input',type,action,value:Number.isFinite(value)?value:text(value),disabled:busy,label}]});\nconst choice=(label,action,value,options)=>({tag:'label',children:[{tag:'span',text:label},{tag:'select',action,value:text(value),disabled:busy,label,children:options.map(option=>({tag:'option',text:option,value:option}))}]});\nconst shotCard=(shot,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h2',text:'Shot '+String(index+1)+' · '+(text(shot.shotDescription)||text(shot.title)||shot.id)},{tag:'div',className:'order',children:[{tag:'button',action:'up:'+String(index),text:'↑',className:'secondary',disabled:busy||index===0,label:'Move shot up'},{tag:'button',action:'down:'+String(index),text:'↓',className:'secondary',disabled:busy||index===draft.shots.length-1,label:'Move shot down'},{tag:'button',action:'remove:'+String(index),text:'Remove',className:'danger',disabled:busy}]}]},{tag:'div',className:'grid',children:[field('Narration','narration:'+String(index),shot.voiceoverText,'textarea',true),field('Visual direction','description:'+String(index),shot.shotDescription||shot.description,'textarea',true),choice('Framing','size:'+String(index),shot.shotSize||'Medium',['Wide','Medium','Close','Extreme Close']),choice('Purpose','type:'+String(index),shot.shotType||'Story',['Story','Coverage Wide','Coverage Medium','Cutaway','Insert','Movement','Transition']),field('Screen time (seconds)','duration:'+String(index),shot.estimatedScreenTime,'number'),choice('Fulfillment','fulfillment:'+String(index),shot.fulfillment||'video',['video','imageMotion']),choice('Motion','motion:'+String(index),shot.motionEffect||'Ken Burns',['Ken Burns','Pan Left','Pan Right','Push In','Pull Out','Tilt Up','Tilt Down','Drift','Locked Frame']),choice('Motion speed','speed:'+String(index),shot.motionSpeed||'Slow',['Slow','Medium','Fast']),{tag:'label',children:[{tag:'span',text:'Full-screen statement'},{tag:'input',type:'checkbox',action:'statement:'+String(index),checked:!!shot.statement,disabled:busy,label:'Full-screen statement'}]},field('Statement reveal','reveal:'+String(index),shot.statementReveal||'words')]}]});\nconst ensure=()=>{if(!draft||Array.isArray(draft)||draft.schemaVersion!==1)draft={schemaVersion:1,shots:[]};if(!Array.isArray(draft.shots))draft.shots=[]};\nconst draw=()=>{ensure();StillMade.render('shots',draft.shots.length?draft.shots.map(shotCard):[{tag:'p',className:'empty',text:'No shots yet. Build from narration or add the first shot.'}]);raw.value=JSON.stringify(draft,null,2);summary.textContent=String(draft.shots.length)+' planned shot'+(draft.shots.length===1?'':'s');save.disabled=busy;build.disabled=busy||!(transcript.words?.length||text(transcript.text||script.text||(typeof script==='string'?script:'')).trim());document.getElementById('reset').disabled=busy;document.getElementById('add').disabled=busy};\nconst changed=message=>{revision+=1;raw.value=JSON.stringify(draft,null,2);status.textContent=message||'Changes are local until you choose Review changes.'};\nStillMade.onAction(event=>{if(busy)return;ensure();const parts=event.action.split(':'),kind=parts[0],index=Number(parts[1]),shot=draft.shots.find((item,position)=>position===index);if(kind==='remove'){draft.shots=draft.shots.filter((item,position)=>position!==index);changed();draw();return}if(kind==='up'||kind==='down'){const target=index+(kind==='up'?-1:1);if(target>=0&&target<draft.shots.length){draft.shots=draft.shots.map((item,position)=>position===index?draft.shots.find((candidate,candidatePosition)=>candidatePosition===target):position===target?shot:item);changed('Shot order updated.');draw()}return}if(!shot)return;if(kind==='narration')shot.voiceoverText=event.value;if(kind==='description')shot.shotDescription=event.value;if(kind==='size')shot.shotSize=event.value;if(kind==='type')shot.shotType=event.value;if(kind==='duration'){shot.estimatedScreenTime=Number(event.value);shot.generationLength=Math.min(15,Number(event.value)+2)}if(kind==='fulfillment'){shot.fulfillment=event.value;shot.fulfillmentSetBy='user'}if(kind==='motion')shot.motionEffect=event.value;if(kind==='speed')shot.motionSpeed=event.value;if(kind==='statement'){shot.statement=event.checked;shot.statementSetBy='user'}if(kind==='reveal')shot.statementReveal=event.value;changed()});\nbuild.addEventListener('click',()=>{if(!busy){draft=plan();changed('Built a local draft from the current narration. Review every visual direction before applying.');draw()}});\ndocument.getElementById('add').addEventListener('click',()=>{if(busy)return;ensure();const id='portable-shot-'+String(revision+1)+'-'+String(draft.shots.length+1);draft.shots=[...draft.shots,{id,voiceoverText:'',shotDescription:'',shotSize:'Medium',shotType:'Story',estimatedScreenTime:3,generationLength:5,fulfillment:'video'}];changed();draw()});\ndocument.getElementById('applyRaw').addEventListener('click',()=>{if(busy)return;try{const value=JSON.parse(raw.value);if(!value||Array.isArray(value)||value.schemaVersion!==1||!Array.isArray(value.shots))throw Error('Shot-plan JSON must be a version 1 object with shots.');draft=clone(value);changed();draw();status.textContent='Complete shot-plan data applied to this workspace.'}catch(error){status.textContent=error.message}});\ndocument.getElementById('reset').addEventListener('click',()=>{if(!busy){draft=clone(source);revision+=1;draw();status.textContent='Changes reset to the current project shot plan.'}});\nsave.addEventListener('click',async()=>{if(busy)return;const started=revision;busy=true;draw();status.textContent='Checking the complete shot plan…';try{const result=await StillMade.run({shotPlan:source,transcript,script,updatedShotPlan:draft,commit:true});draft=clone(result.shotPlan);if(started===revision)status.textContent='Shots are ready below. Review the before and after, then choose Apply.'}catch(error){status.textContent=error.message||'The shot plan could not be prepared.'}finally{busy=false;draw()}});\nStillMade.onInput(values=>{source=clone(values.shotPlan||{schemaVersion:1,shots:[]});transcript=clone(values.transcript||{schemaVersion:1,text:'',words:[]});script=clone(values.script||{schemaVersion:1,text:''});draft=source.shots?.length?clone(source):plan();revision+=1;draw();status.textContent=draft.shots.length&&!source.shots?.length?'Built a starting plan from the current narration. Review it before applying.':'Edit any shot. Every unshown project field is retained.'});\n"
123
- },
124
- "tests": [
125
- {
126
- "name": "builds timed shots from narration when the project has no plan",
127
- "input": {
128
- "shotPlan": {
129
- "schemaVersion": 1,
130
- "shots": []
131
- },
132
- "transcript": {
133
- "schemaVersion": 1,
134
- "text": "Open with the city. Then show the product.",
135
- "words": [
136
- {
137
- "text": "Open",
138
- "start": 0,
139
- "end": 0.5
140
- },
141
- {
142
- "text": "with",
143
- "start": 0.5,
144
- "end": 1
145
- },
146
- {
147
- "text": "the",
148
- "start": 1,
149
- "end": 1.3
150
- },
151
- {
152
- "text": "city.",
153
- "start": 1.3,
154
- "end": 3
155
- },
156
- {
157
- "text": "Then",
158
- "start": 3,
159
- "end": 3.5
160
- },
161
- {
162
- "text": "show",
163
- "start": 3.5,
164
- "end": 4
165
- },
166
- {
167
- "text": "the",
168
- "start": 4,
169
- "end": 4.3
170
- },
171
- {
172
- "text": "product.",
173
- "start": 4.3,
174
- "end": 7
175
- }
176
- ]
177
- },
178
- "script": {
179
- "schemaVersion": 1,
180
- "text": "Open with the city. Then show the product."
181
- },
182
- "updatedShotPlan": {
183
- "schemaVersion": 1,
184
- "shots": []
185
- },
186
- "commit": false
187
- },
188
- "expected": {
189
- "shotPlan": {
190
- "schemaVersion": 1,
191
- "shots": [
192
- {
193
- "id": "shot-1-0",
194
- "voiceoverText": "Open with the city.",
195
- "shotDescription": "Show a clear visual for: Open with the city.",
196
- "startTime": 0,
197
- "endTime": 3,
198
- "estimatedScreenTime": 3,
199
- "generationLength": 5,
200
- "shotSize": "Wide",
201
- "shotType": "Story",
202
- "fulfillment": "video"
203
- },
204
- {
205
- "id": "shot-2-3000",
206
- "voiceoverText": "Then show the product.",
207
- "shotDescription": "Show a clear visual for: Then show the product.",
208
- "startTime": 3,
209
- "endTime": 7,
210
- "estimatedScreenTime": 4,
211
- "generationLength": 6,
212
- "shotSize": "Medium",
213
- "shotType": "Story",
214
- "fulfillment": "video"
215
- }
216
- ]
217
- },
218
- "edit": {
219
- "schemaVersion": 1,
220
- "title": "Update 2 planned shots",
221
- "field": "shotPlan",
222
- "before": {
223
- "schemaVersion": 1,
224
- "shots": []
225
- },
226
- "after": {
227
- "schemaVersion": 1,
228
- "shots": [
229
- {
230
- "id": "shot-1-0",
231
- "voiceoverText": "Open with the city.",
232
- "shotDescription": "Show a clear visual for: Open with the city.",
233
- "startTime": 0,
234
- "endTime": 3,
235
- "estimatedScreenTime": 3,
236
- "generationLength": 5,
237
- "shotSize": "Wide",
238
- "shotType": "Story",
239
- "fulfillment": "video"
240
- },
241
- {
242
- "id": "shot-2-3000",
243
- "voiceoverText": "Then show the product.",
244
- "shotDescription": "Show a clear visual for: Then show the product.",
245
- "startTime": 3,
246
- "endTime": 7,
247
- "estimatedScreenTime": 4,
248
- "generationLength": 6,
249
- "shotSize": "Medium",
250
- "shotType": "Story",
251
- "fulfillment": "video"
252
- }
253
- ]
254
- }
255
- }
256
- }
257
- },
258
- {
259
- "name": "commits the complete edited plan without losing media or custom data",
260
- "input": {
261
- "shotPlan": {
262
- "schemaVersion": 1,
263
- "shots": [
264
- {
265
- "id": "opening",
266
- "voiceoverText": "Keep narration",
267
- "selectedImage": {
268
- "assetId": "image-1",
269
- "versionId": "v1"
270
- },
271
- "custom": {
272
- "approved": true
273
- }
274
- }
275
- ]
276
- },
277
- "transcript": {
278
- "schemaVersion": 1,
279
- "text": "Keep narration",
280
- "words": []
281
- },
282
- "script": {
283
- "schemaVersion": 1,
284
- "text": "Keep narration"
285
- },
286
- "updatedShotPlan": {
287
- "schemaVersion": 1,
288
- "shots": [
289
- {
290
- "id": "opening",
291
- "voiceoverText": "Keep narration",
292
- "shotDescription": "A better opening",
293
- "selectedImage": {
294
- "assetId": "image-1",
295
- "versionId": "v2"
296
- },
297
- "custom": {
298
- "approved": true
299
- }
300
- }
301
- ]
302
- },
303
- "commit": true
304
- },
305
- "expected": {
306
- "shotPlan": {
307
- "schemaVersion": 1,
308
- "shots": [
309
- {
310
- "id": "opening",
311
- "voiceoverText": "Keep narration",
312
- "shotDescription": "A better opening",
313
- "selectedImage": {
314
- "assetId": "image-1",
315
- "versionId": "v2"
316
- },
317
- "custom": {
318
- "approved": true
319
- }
320
- }
321
- ]
322
- },
323
- "edit": {
324
- "schemaVersion": 1,
325
- "title": "Update 1 planned shot",
326
- "field": "shotPlan",
327
- "before": {
328
- "schemaVersion": 1,
329
- "shots": [
330
- {
331
- "id": "opening",
332
- "voiceoverText": "Keep narration",
333
- "selectedImage": {
334
- "assetId": "image-1",
335
- "versionId": "v1"
336
- },
337
- "custom": {
338
- "approved": true
339
- }
340
- }
341
- ]
342
- },
343
- "after": {
344
- "schemaVersion": 1,
345
- "shots": [
346
- {
347
- "id": "opening",
348
- "voiceoverText": "Keep narration",
349
- "shotDescription": "A better opening",
350
- "selectedImage": {
351
- "assetId": "image-1",
352
- "versionId": "v2"
353
- },
354
- "custom": {
355
- "approved": true
356
- }
357
- }
358
- ]
359
- }
360
- }
361
- }
362
- },
363
- {
364
- "name": "estimates timing from script sentences when word timings are unavailable",
365
- "input": {
366
- "shotPlan": {
367
- "schemaVersion": 1,
368
- "shots": []
369
- },
370
- "transcript": {
371
- "schemaVersion": 1,
372
- "text": "First beat. Second beat here!",
373
- "words": []
374
- },
375
- "script": {
376
- "schemaVersion": 1,
377
- "text": ""
378
- },
379
- "updatedShotPlan": {
380
- "schemaVersion": 1,
381
- "shots": []
382
- },
383
- "commit": false
384
- },
385
- "expected": {
386
- "shotPlan": {
387
- "schemaVersion": 1,
388
- "shots": [
389
- {
390
- "id": "shot-1-0",
391
- "voiceoverText": "First beat.",
392
- "shotDescription": "Show a clear visual for: First beat.",
393
- "startTime": 0,
394
- "endTime": 2,
395
- "estimatedScreenTime": 2,
396
- "generationLength": 4,
397
- "shotSize": "Wide",
398
- "shotType": "Story",
399
- "fulfillment": "video"
400
- },
401
- {
402
- "id": "shot-2-2000",
403
- "voiceoverText": "Second beat here!",
404
- "shotDescription": "Show a clear visual for: Second beat here!",
405
- "startTime": 2,
406
- "endTime": 4,
407
- "estimatedScreenTime": 2,
408
- "generationLength": 4,
409
- "shotSize": "Medium",
410
- "shotType": "Story",
411
- "fulfillment": "video"
412
- }
413
- ]
414
- },
415
- "edit": {
416
- "schemaVersion": 1,
417
- "title": "Update 2 planned shots",
418
- "field": "shotPlan",
419
- "before": {
420
- "schemaVersion": 1,
421
- "shots": []
422
- },
423
- "after": {
424
- "schemaVersion": 1,
425
- "shots": [
426
- {
427
- "id": "shot-1-0",
428
- "voiceoverText": "First beat.",
429
- "shotDescription": "Show a clear visual for: First beat.",
430
- "startTime": 0,
431
- "endTime": 2,
432
- "estimatedScreenTime": 2,
433
- "generationLength": 4,
434
- "shotSize": "Wide",
435
- "shotType": "Story",
436
- "fulfillment": "video"
437
- },
438
- {
439
- "id": "shot-2-2000",
440
- "voiceoverText": "Second beat here!",
441
- "shotDescription": "Show a clear visual for: Second beat here!",
442
- "startTime": 2,
443
- "endTime": 4,
444
- "estimatedScreenTime": 2,
445
- "generationLength": 4,
446
- "shotSize": "Medium",
447
- "shotType": "Story",
448
- "fulfillment": "video"
449
- }
450
- ]
451
- }
452
- }
453
- }
454
- },
455
- {
456
- "name": "keeps an empty project empty without treating document objects as narration",
457
- "input": {
458
- "shotPlan": {
459
- "schemaVersion": 1,
460
- "shots": []
461
- },
462
- "transcript": {
463
- "schemaVersion": 1,
464
- "text": "",
465
- "words": []
466
- },
467
- "script": {
468
- "schemaVersion": 1,
469
- "text": ""
470
- },
471
- "updatedShotPlan": {
472
- "schemaVersion": 1,
473
- "shots": []
474
- },
475
- "commit": false
476
- },
477
- "expected": {
478
- "shotPlan": {
479
- "schemaVersion": 1,
480
- "shots": []
481
- },
482
- "edit": {
483
- "schemaVersion": 1,
484
- "title": "Update 0 planned shots",
485
- "field": "shotPlan",
486
- "before": {
487
- "schemaVersion": 1,
488
- "shots": []
489
- },
490
- "after": {
491
- "schemaVersion": 1,
492
- "shots": []
493
- }
494
- }
495
- }
496
- }
497
- ],
498
- "portable": {
499
- "format": "stillmade-block/1",
500
- "dependencies": [],
501
- "sources": [
502
- {
503
- "kind": "original",
504
- "license": "MIT",
505
- "paths": [
506
- "LICENSE",
507
- "src/run.js",
508
- "src/view.json"
509
- ],
510
- "evidence": [
511
- "upstream/0/LICENSE",
512
- "upstream/0/src/run.js",
513
- "upstream/0/src/view.json"
514
- ],
515
- "changes": "Original implementation declared by the packager; no reused repository or dependency code."
516
- }
517
- ],
518
- "files": {
519
- "upstream/0/LICENSE": "MIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
520
- "upstream/0/src/run.js": "const copy = value => JSON.parse(JSON.stringify(value));\nconst words = Array.isArray(input.transcript?.words) ? input.transcript.words : [];\nconst scriptText = String(input.transcript?.text || input.script?.text || (typeof input.script==='string'?input.script:'')).trim();\nconst timed = word => ({text:String(word?.text || word?.word || '').trim(),start:Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000,end:Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000});\nconst make = (text,start,end,index) => ({id:`shot-${index+1}-${Math.max(0,Math.round(start*1000))}`,voiceoverText:text,shotDescription:text?`Show a clear visual for: ${text}`:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\nconst fromWords = () => {const clean=words.map(timed).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start);const groups=[];let group=[];clean.forEach(word=>{group.push(word);const duration=word.end-group[0].start,punctuation=/[.!?]$/.test(word.text);if((punctuation&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[];}});if(group.length)groups.push(group);return groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group[group.length-1].end,index));};\nconst fromScript = () => {const parts=(scriptText.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return parts.map((text,index)=>{const duration=Math.max(2,Math.round(text.split(/\\s+/).length/2.5*10)/10),shot=make(text,cursor,cursor+duration,index);cursor+=duration;return shot;});};\nconst generated = () => ({schemaVersion:1,shots:words.length?fromWords():fromScript()});\nconst source = copy(input.shotPlan || {schemaVersion:1,shots:[]});\nconst fallback = !source.shots?.length ? generated() : source;\nconst candidate = input.commit ? copy(input.updatedShotPlan) : copy(fallback);\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1 || !Array.isArray(candidate.shots)) throw new Error('Keep the complete version 1 shot plan.');\nif (candidate.shots.length > 2000 || !candidate.shots.every(shot => shot && !Array.isArray(shot) && typeof shot.id === 'string' && shot.id.length > 0 && shot.id.length <= 200) || new Set(candidate.shots.map(shot => shot.id)).size !== candidate.shots.length) throw new Error('Shots need up to 2,000 distinct retained IDs.');\nreturn {shotPlan:candidate,edit:{schemaVersion:1,title:`Update ${candidate.shots.length} planned shot${candidate.shots.length===1?'':'s'}`,field:'shotPlan',before:source,after:candidate}};\n",
521
- "upstream/0/src/view.json": "{\n \"html\": \"<main class=\\\"shots-workspace\\\">\\n <header><div><small>Production workspace</small><h1>Shots</h1><p id=\\\"summary\\\">Loading the shot plan…</p></div><div class=\\\"actions\\\"><button id=\\\"build\\\" type=\\\"button\\\" class=\\\"secondary\\\">Build from narration</button><button id=\\\"reset\\\" type=\\\"button\\\" class=\\\"secondary\\\">Reset changes</button><button id=\\\"add\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add shot</button><button id=\\\"save\\\" type=\\\"button\\\" data-stillmade-action=\\\"run\\\">Review changes</button></div></header>\\n <output id=\\\"status\\\" role=\\\"status\\\" aria-live=\\\"polite\\\"></output>\\n <section id=\\\"shots\\\" class=\\\"shots\\\" aria-label=\\\"Planned shots\\\"></section>\\n <details><summary>Complete shot-plan data</summary><p>Every field is retained. Use this editor for custom fields not shown on the cards.</p><label for=\\\"raw\\\">Complete shot-plan JSON</label><textarea id=\\\"raw\\\" class=\\\"raw\\\" spellcheck=\\\"false\\\"></textarea><button id=\\\"applyRaw\\\" type=\\\"button\\\" class=\\\"secondary\\\">Apply JSON to workspace</button></details>\\n</main>\\n\",\n \"css\": \".shots-workspace{max-width:1100px;margin:0 auto;padding:8px;color:var(--fg)}header,.actions,.card-head,.row,.order{display:flex;align-items:center;gap:10px;flex-wrap:wrap}header{justify-content:space-between;margin-bottom:14px}header h1{margin:2px 0}header p,header small,details p,output{color:var(--fg-muted)}\\n.shots{display:grid;gap:12px}.card,details{padding:16px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}.card-head{justify-content:space-between}.card h2{margin:0;font-size:18px}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}label{display:grid;gap:5px;margin:8px 0;font-size:13px;font-weight:600}input,textarea,select{width:100%;background:var(--bg)}textarea{min-height:82px;resize:vertical}.wide{grid-column:1/-1}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}.raw{min-height:340px;font-family:var(--font-mono);font-size:12px}output{display:block;min-height:24px;margin:8px 2px}.order button{min-width:44px}.empty{padding:28px;text-align:center;border:1px dashed var(--border-tok);border-radius:var(--r-3);color:var(--fg-muted)}\\n@media(max-width:760px){.shots-workspace{padding:0}.grid{grid-template-columns:1fr}.actions{width:100%}.actions button{flex:1}.card,details{padding:12px}}\\n\",\n \"javascript\": \"const status=document.getElementById('status'),summary=document.getElementById('summary'),raw=document.getElementById('raw'),save=document.getElementById('save'),build=document.getElementById('build');\\nlet source={schemaVersion:1,shots:[]},draft={schemaVersion:1,shots:[]},transcript={schemaVersion:1,text:'',words:[]},script={schemaVersion:1,text:''},busy=false,revision=0;\\nconst clone=value=>JSON.parse(JSON.stringify(value));\\nconst text=value=>value===undefined||value===null?'':String(value);\\nconst wordStart=word=>Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000;\\nconst wordEnd=word=>Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000;\\nconst make=(line,start,end,index)=>({id:'shot-'+String(index+1)+'-'+String(Math.max(0,Math.round(start*1000))),voiceoverText:line,shotDescription:line?'Show a clear visual for: '+line:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\\nconst plan=()=>{const words=Array.isArray(transcript.words)?transcript.words.map(word=>({text:text(word?.text||word?.word).trim(),start:wordStart(word),end:wordEnd(word)})).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start):[];if(words.length){const groups=[];let group=[];words.forEach(word=>{group.push(word);const duration=word.end-group[0].start;if((/[.!?]$/.test(word.text)&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[]}});if(group.length)groups.push(group);return {schemaVersion:1,shots:groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group.at(-1).end,index))}}const narration=text(transcript.text||script.text||(typeof script==='string'?script:'')).trim(),parts=(narration.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return {schemaVersion:1,shots:parts.map((line,index)=>{const duration=Math.max(2,Math.round(line.split(/\\\\s+/).length/2.5*10)/10),shot=make(line,cursor,cursor+duration,index);cursor+=duration;return shot})}};\\nconst field=(label,action,value,type='text',wide=false)=>({tag:'label',className:wide?'wide':'',children:[{tag:'span',text:label},type==='textarea'?{tag:'textarea',action,value:text(value),disabled:busy,label}:{tag:'input',type,action,value:Number.isFinite(value)?value:text(value),disabled:busy,label}]});\\nconst choice=(label,action,value,options)=>({tag:'label',children:[{tag:'span',text:label},{tag:'select',action,value:text(value),disabled:busy,label,children:options.map(option=>({tag:'option',text:option,value:option}))}]});\\nconst shotCard=(shot,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h2',text:'Shot '+String(index+1)+' · '+(text(shot.shotDescription)||text(shot.title)||shot.id)},{tag:'div',className:'order',children:[{tag:'button',action:'up:'+String(index),text:'↑',className:'secondary',disabled:busy||index===0,label:'Move shot up'},{tag:'button',action:'down:'+String(index),text:'↓',className:'secondary',disabled:busy||index===draft.shots.length-1,label:'Move shot down'},{tag:'button',action:'remove:'+String(index),text:'Remove',className:'danger',disabled:busy}]}]},{tag:'div',className:'grid',children:[field('Narration','narration:'+String(index),shot.voiceoverText,'textarea',true),field('Visual direction','description:'+String(index),shot.shotDescription||shot.description,'textarea',true),choice('Framing','size:'+String(index),shot.shotSize||'Medium',['Wide','Medium','Close','Extreme Close']),choice('Purpose','type:'+String(index),shot.shotType||'Story',['Story','Coverage Wide','Coverage Medium','Cutaway','Insert','Movement','Transition']),field('Screen time (seconds)','duration:'+String(index),shot.estimatedScreenTime,'number'),choice('Fulfillment','fulfillment:'+String(index),shot.fulfillment||'video',['video','imageMotion']),choice('Motion','motion:'+String(index),shot.motionEffect||'Ken Burns',['Ken Burns','Pan Left','Pan Right','Push In','Pull Out','Tilt Up','Tilt Down','Drift','Locked Frame']),choice('Motion speed','speed:'+String(index),shot.motionSpeed||'Slow',['Slow','Medium','Fast']),{tag:'label',children:[{tag:'span',text:'Full-screen statement'},{tag:'input',type:'checkbox',action:'statement:'+String(index),checked:!!shot.statement,disabled:busy,label:'Full-screen statement'}]},field('Statement reveal','reveal:'+String(index),shot.statementReveal||'words')]}]});\\nconst ensure=()=>{if(!draft||Array.isArray(draft)||draft.schemaVersion!==1)draft={schemaVersion:1,shots:[]};if(!Array.isArray(draft.shots))draft.shots=[]};\\nconst draw=()=>{ensure();StillMade.render('shots',draft.shots.length?draft.shots.map(shotCard):[{tag:'p',className:'empty',text:'No shots yet. Build from narration or add the first shot.'}]);raw.value=JSON.stringify(draft,null,2);summary.textContent=String(draft.shots.length)+' planned shot'+(draft.shots.length===1?'':'s');save.disabled=busy;build.disabled=busy||!(transcript.words?.length||text(transcript.text||script.text||(typeof script==='string'?script:'')).trim());document.getElementById('reset').disabled=busy;document.getElementById('add').disabled=busy};\\nconst changed=message=>{revision+=1;raw.value=JSON.stringify(draft,null,2);status.textContent=message||'Changes are local until you choose Review changes.'};\\nStillMade.onAction(event=>{if(busy)return;ensure();const parts=event.action.split(':'),kind=parts[0],index=Number(parts[1]),shot=draft.shots.find((item,position)=>position===index);if(kind==='remove'){draft.shots=draft.shots.filter((item,position)=>position!==index);changed();draw();return}if(kind==='up'||kind==='down'){const target=index+(kind==='up'?-1:1);if(target>=0&&target<draft.shots.length){draft.shots=draft.shots.map((item,position)=>position===index?draft.shots.find((candidate,candidatePosition)=>candidatePosition===target):position===target?shot:item);changed('Shot order updated.');draw()}return}if(!shot)return;if(kind==='narration')shot.voiceoverText=event.value;if(kind==='description')shot.shotDescription=event.value;if(kind==='size')shot.shotSize=event.value;if(kind==='type')shot.shotType=event.value;if(kind==='duration'){shot.estimatedScreenTime=Number(event.value);shot.generationLength=Math.min(15,Number(event.value)+2)}if(kind==='fulfillment'){shot.fulfillment=event.value;shot.fulfillmentSetBy='user'}if(kind==='motion')shot.motionEffect=event.value;if(kind==='speed')shot.motionSpeed=event.value;if(kind==='statement'){shot.statement=event.checked;shot.statementSetBy='user'}if(kind==='reveal')shot.statementReveal=event.value;changed()});\\nbuild.addEventListener('click',()=>{if(!busy){draft=plan();changed('Built a local draft from the current narration. Review every visual direction before applying.');draw()}});\\ndocument.getElementById('add').addEventListener('click',()=>{if(busy)return;ensure();const id='portable-shot-'+String(revision+1)+'-'+String(draft.shots.length+1);draft.shots=[...draft.shots,{id,voiceoverText:'',shotDescription:'',shotSize:'Medium',shotType:'Story',estimatedScreenTime:3,generationLength:5,fulfillment:'video'}];changed();draw()});\\ndocument.getElementById('applyRaw').addEventListener('click',()=>{if(busy)return;try{const value=JSON.parse(raw.value);if(!value||Array.isArray(value)||value.schemaVersion!==1||!Array.isArray(value.shots))throw Error('Shot-plan JSON must be a version 1 object with shots.');draft=clone(value);changed();draw();status.textContent='Complete shot-plan data applied to this workspace.'}catch(error){status.textContent=error.message}});\\ndocument.getElementById('reset').addEventListener('click',()=>{if(!busy){draft=clone(source);revision+=1;draw();status.textContent='Changes reset to the current project shot plan.'}});\\nsave.addEventListener('click',async()=>{if(busy)return;const started=revision;busy=true;draw();status.textContent='Checking the complete shot plan…';try{const result=await StillMade.run({shotPlan:source,transcript,script,updatedShotPlan:draft,commit:true});draft=clone(result.shotPlan);if(started===revision)status.textContent='Shots are ready below. Review the before and after, then choose Apply.'}catch(error){status.textContent=error.message||'The shot plan could not be prepared.'}finally{busy=false;draw()}});\\nStillMade.onInput(values=>{source=clone(values.shotPlan||{schemaVersion:1,shots:[]});transcript=clone(values.transcript||{schemaVersion:1,text:'',words:[]});script=clone(values.script||{schemaVersion:1,text:''});draft=source.shots?.length?clone(source):plan();revision+=1;draw();status.textContent=draft.shots.length&&!source.shots?.length?'Built a starting plan from the current narration. Review it before applying.':'Edit any shot. Every unshown project field is retained.'});\\n\"\n}"
522
- },
523
- "lineage": {
524
- "parents": [],
525
- "changes": "Packaged original Block source for StillMade."
526
- }
527
- }
528
- };