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,422 +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.blueprint",
7
- "version": "2.1.9",
8
- "name": "Blueprint",
9
- "description": "Edit, structure, lock, and review assisted changes to the complete production Blueprint before exact save and downstream handoff with bounded saved revision and collaborator context with exact project media-library browsing and trusted previews.",
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
- "blueprint": {
36
- "type": "bible",
37
- "context": "blueprint",
38
- "primary": true,
39
- "required": false,
40
- "default": {
41
- "schemaVersion": 1
42
- },
43
- "description": "The complete current project blueprint. Unknown and future fields are retained unchanged.",
44
- "semantic": "production_blueprint"
45
- },
46
- "updatedBlueprint": {
47
- "type": "bible",
48
- "required": false,
49
- "default": {
50
- "schemaVersion": 1
51
- },
52
- "description": "The complete edited blueprint prepared by this Block's workspace.",
53
- "semantic": "production_blueprint"
54
- },
55
- "commit": {
56
- "type": "boolean",
57
- "default": false,
58
- "description": "Prepare the edited document for StillMade review and Apply.",
59
- "semantic": "apply_changes",
60
- "required": false
61
- },
62
- "assistantEdit": {
63
- "type": "workspace-edit",
64
- "required": false,
65
- "description": "An exact Blueprint proposal from a connected workspace.propose assistant Block. It remains reviewable before local adoption and final Apply.",
66
- "semantic": "workspace_edit"
67
- },
68
- "versions": {
69
- "type": "metadata[]",
70
- "context": "versions",
71
- "required": false,
72
- "description": "Host-backed saved revision records for this exact project workspace.",
73
- "semantic": "revision_history"
74
- },
75
- "presence": {
76
- "type": "metadata[]",
77
- "required": false,
78
- "description": "Bounded collaborator presence supplied through a declared connection or host project context.",
79
- "semantic": "collaborator_presence"
80
- },
81
- "assets": {
82
- "type": "asset[]",
83
- "context": "assets",
84
- "required": false,
85
- "description": "Exact stored project media versions available for bounded browsing and local attachment.",
86
- "semantic": "project_media"
87
- }
88
- },
89
- "outputs": {
90
- "blueprint": {
91
- "type": "bible",
92
- "primary": true,
93
- "role": "production_blueprint",
94
- "description": "The complete edited blueprint for the next Step.",
95
- "semantic": "production_blueprint"
96
- },
97
- "edit": {
98
- "type": "workspace-edit",
99
- "description": "An exact before/after Blueprint change reviewed before it updates the project.",
100
- "semantic": "workspace_edit"
101
- },
102
- "shotPlan": {
103
- "type": "shot-plan",
104
- "role": "shot_plan_handoff",
105
- "description": "A deterministic Shots document derived from the edited Blueprint scenes and shot lists for a downstream Shots or Animated Scene Step.",
106
- "semantic": "shot_plan_handoff"
107
- },
108
- "revision": {
109
- "type": "metadata",
110
- "description": "A deterministic revision event for durable host storage and collaboration propagation.",
111
- "required": false,
112
- "semantic": "revision_event"
113
- }
114
- },
115
- "permissions": {
116
- "project": [
117
- "context.blueprint.read",
118
- "workspace.blueprint.propose",
119
- "context.versions.read",
120
- "context.assets.read"
121
- ],
122
- "network": [],
123
- "filesystem": [],
124
- "secrets": []
125
- },
126
- "ui": [],
127
- "platforms": {
128
- "phone": {
129
- "supported": true
130
- },
131
- "browser": {
132
- "supported": true
133
- },
134
- "desktop": {
135
- "supported": true
136
- }
137
- }
138
- },
139
- "code": "const copy = value => JSON.parse(JSON.stringify(value));\nconst source = copy(input.blueprint || {schemaVersion: 1});\nconst candidate = input.commit ? copy(input.updatedBlueprint) : copy(source);\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1) {\n throw new Error('Keep the complete version 1 Blueprint document.');\n}\nconst title = typeof candidate.title === 'string' && candidate.title.trim()\n ? `Update Blueprint: ${candidate.title.trim().slice(0, 160)}`\n : 'Update production Blueprint';\nconst seconds = value => {\n const number = Number(value);\n if (Number.isFinite(number) && number > 0) return number;\n const match = String(value || '').match(/\\d+(?:\\.\\d+)?/);\n return match ? Math.max(.001, Number(match[0])) : 4;\n};\nlet cursor = 0;\nconst shots = [];\nfor (const [sceneIndex, scene] of (Array.isArray(candidate.scenes) ? candidate.scenes : []).entries()) {\n const narration = (Array.isArray(candidate.voiceover) ? candidate.voiceover : []).find(line => line?.sceneId && line.sceneId === scene?.id)?.text || '';\n for (const [shotIndex, sourceShot] of (Array.isArray(scene?.shotList) ? scene.shotList : []).entries()) {\n const shot = copy(sourceShot || {});\n const start = Number.isFinite(Number(shot.startTime)) ? Number(shot.startTime) : cursor;\n const duration = Number.isFinite(Number(shot.endTime)) && Number(shot.endTime) > start\n ? Number(shot.endTime) - start\n : seconds(shot.intendedDuration || shot.generationLength);\n const end = start + duration;\n shots.push({...shot,id:String(shot.id || `scene-${sceneIndex + 1}-shot-${shotIndex + 1}`),sceneId:String(scene?.id || scene?.sceneId || `scene-${sceneIndex + 1}`),sceneTitle:String(scene?.title || ''),startTime:start,endTime:end,voiceoverText:String(shot.voiceoverText || narration)});\n cursor = Math.max(cursor, end);\n }\n}\nconst outputs = {\n blueprint: candidate,\n shotPlan: {schemaVersion: 1, shots},\n edit: {schemaVersion: 1, title, field: 'blueprint', before: source, after: candidate}\n};\nif(Array.isArray(input.versions)||Array.isArray(input.presence))outputs.revision={schemaVersion:1,scope:'blueprint',baseRevision:(Array.isArray(input.versions)?input.versions:[]).slice(0,200).reduce((highest,item)=>Math.max(highest,Number(item&&item.revision)||0),0),committed:!!input.commit,changed:JSON.stringify(source)!==JSON.stringify(candidate),paths:JSON.stringify(source)===JSON.stringify(candidate)?[]:['blueprint']};\nreturn outputs;\n",
140
- "view": {
141
- "html": "<main class=\"blueprint-workspace\">\n <header>\n <div><small>Production workspace</small><h1>Blueprint</h1></div>\n <div class=\"actions\"><button id=\"undo\" type=\"button\" class=\"secondary\">Undo</button><button id=\"redo\" type=\"button\" class=\"secondary\">Redo</button><button id=\"tidy\" type=\"button\" class=\"secondary\">Tidy structure</button><button id=\"lock\" type=\"button\" class=\"secondary\">Lock editing</button><button id=\"discard\" type=\"button\" class=\"secondary\">Discard local draft and load shared</button><button id=\"reset\" type=\"button\" class=\"secondary\">Reset changes</button><button id=\"save\" type=\"button\" data-stillmade-action=\"run\">Review changes</button></div>\n </header>\n <output id=\"status\" role=\"status\" aria-live=\"polite\">Loading the project Blueprint…</output>\n <section><h2>Saved revisions and collaborators</h2><div id=\"workspaceSync\"></div></section>\n <section><h2>Project media library</h2><p>Browse exact stored image versions supplied by the host.</p><div id=\"mediaLibrary\"></div><img id=\"libraryPreview\" alt=\"Trusted project media preview\" hidden></section>\n <section><div class=\"section-title\"><h2>Assistant proposal</h2><button id=\"applyAssistant\" type=\"button\" class=\"secondary\">Adopt proposal in shared draft</button></div><div id=\"assistantProposal\"></div></section>\n <section class=\"handoff\"><h2>Shots handoff</h2><p id=\"handoffSummary\">Scene shot lists become a typed Shots document for the next Step.</p><button id=\"prepareShots\" type=\"button\" class=\"secondary\">Prepare Shots handoff</button></section>\n\n <section>\n <h2>Project overview</h2>\n <div class=\"grid two\">\n <label>Title<input id=\"title\" type=\"text\"></label>\n <label>Video type<input id=\"videoType\" type=\"text\"></label>\n <label>Target length<input id=\"targetLength\" type=\"text\"></label>\n <label>Tone<input id=\"tone\" type=\"text\"></label>\n <label>Aspect ratio<input id=\"aspectRatio\" type=\"text\"></label>\n </div>\n <label>Description<textarea id=\"description\"></textarea></label>\n <label>Extra information<textarea id=\"extraInfo\"></textarea></label>\n </section>\n\n <section>\n <h2>Emotional arc</h2>\n <div class=\"grid two\">\n <label>Beginning<textarea id=\"arcBeginning\"></textarea></label>\n <label>Escalation<textarea id=\"arcEscalation\"></textarea></label>\n <label>Climax<textarea id=\"arcClimax\"></textarea></label>\n <label>Resolution<textarea id=\"arcResolution\"></textarea></label>\n </div>\n </section>\n\n <section>\n <h2>Visual style guide</h2>\n <div class=\"grid two\">\n <label>Color palette<textarea id=\"styleColor\"></textarea></label>\n <label>Lighting tone<textarea id=\"styleLighting\"></textarea></label>\n <label>Camera language<textarea id=\"styleCamera\"></textarea></label>\n <label>Overall aesthetic<textarea id=\"styleAesthetic\"></textarea></label>\n </div>\n </section>\n\n <section><div class=\"section-title\"><h2>Voiceover</h2><button id=\"addVoiceover\" type=\"button\" class=\"secondary\">Add narration</button></div><div id=\"voiceover\" class=\"cards\"></div></section>\n <section><div class=\"section-title\"><h2>Characters</h2><button id=\"addCharacter\" type=\"button\" class=\"secondary\">Add character</button></div><div id=\"characters\" class=\"cards\"></div></section>\n <section><div class=\"section-title\"><h2>Locations</h2><button id=\"addLocation\" type=\"button\" class=\"secondary\">Add location</button></div><div id=\"locations\" class=\"cards\"></div></section>\n <section><div class=\"section-title\"><h2>Scenes and shots</h2><button id=\"addScene\" type=\"button\" class=\"secondary\">Add scene</button></div><div id=\"scenes\" class=\"cards\"></div></section>\n\n <details id=\"advanced\"><summary>Complete Blueprint data</summary><p>All fields are retained. Edit this JSON for fields a custom Blueprint adds beyond the standard workspace.</p><label for=\"raw\">Complete Blueprint 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",
142
- "css": ".blueprint-workspace{width:100%;min-width:0;margin:0;padding:8px;color:var(--fg)}\nheader,.section-title,.actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}header{justify-content:space-between;margin-bottom:14px}header h1{margin:2px 0}header small,output,p{color:var(--fg-muted)}\nsection,details{margin:14px 0;padding:16px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}\nh2{margin:0 0 12px;font-size:22px}.section-title{justify-content:space-between}.section-title h2{margin:0}\n.grid{display:grid;gap:12px}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}label{display:grid;gap:6px;margin:10px 0;font-size:13px;font-weight:600}textarea{min-height:88px;resize:vertical}input,textarea{width:100%;background:var(--bg)}\n.cards{display:grid;gap:12px}.card{padding:14px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg)}.card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.card h3{margin:0;font-size:16px}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}\n.shot-list{display:grid;gap:10px;margin-top:12px}.shot{padding:12px;border-left:3px solid var(--border-strong);background:var(--bg-elev-1)}.shot .grid{margin-top:4px}button,input,textarea,summary{min-height:44px}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.55}\n.raw{min-height:320px;font-family:var(--font-mono);font-size:12px}summary{font-weight:700}output{display:block;min-height:24px;margin:8px 2px}\n@media(max-width:680px){.blueprint-workspace{padding:0}.grid.two{grid-template-columns:1fr}section,details{padding:12px}.actions{width:100%}.actions button{flex:1}}\n",
143
- "javascript": "const fields = {\n title: document.getElementById('title'), description: document.getElementById('description'), videoType: document.getElementById('videoType'),\n targetLength: document.getElementById('targetLength'), tone: document.getElementById('tone'), aspectRatio: document.getElementById('aspectRatio'), extraInfo: document.getElementById('extraInfo')\n};\nconst arc = {beginning:document.getElementById('arcBeginning'),escalation:document.getElementById('arcEscalation'),climax:document.getElementById('arcClimax'),resolution:document.getElementById('arcResolution')};\nconst visual = {colorPalette:document.getElementById('styleColor'),lightingTone:document.getElementById('styleLighting'),cameraLanguage:document.getElementById('styleCamera'),overallAesthetic:document.getElementById('styleAesthetic')};\nconst status = document.getElementById('status'), raw = document.getElementById('raw'), save = document.getElementById('save');\nlet shared={state:{},outputs:{},canEdit:false},canEdit=false,failed=false,pending=0,queuedBase=null,draftBase=null,initialized=false,localLocked=false,notice='',rawEditing=false,rawPending=0,rawQueued=null,rawBefore=null,rawFlight=null,lockQueued=false;\nconst identities=[],pages=[];\nconst pageFor=group=>{let page=pages.find(item=>item.group===group);if(!page){page={group,page:0};pages.push(page);}return page;};\nconst keyFor=(group,item)=>{const id=group+':'+item.id;let key=identities.indexOf(id);if(key<0){identities.push(id);key=identities.length-1;}return key;};\nconst stableControlId=action=>{const value=JSON.stringify(action.split(':').map((part,index)=>index?(identities.at(Number(part))||part):part));const a=value.split('').reduce((hash,char)=>Math.imul(hash^char.charCodeAt(0),16777619),2166136261)>>>0,b=value.split('').reduce((hash,char)=>Math.imul(hash^char.charCodeAt(0),2246822519),3266489917)>>>0;return 'blueprint-'+a.toString(36)+'-'+b.toString(36);};\nconst member=(group,items,key)=>items.find(item=>identities.at(key)===group+':'+item.id);\nconst list=(group,items,render,size=8)=>{\n const slot=pageFor(group),pageKey=pages.indexOf(slot),page=Math.min(slot.page,Math.max(0,Math.ceil(items.length/size)-1));slot.page=page;\n const tree=items.slice(page*size,page*size+size).map(item=>render(item,keyFor(group,item)));\n if(items.length>size)tree.push({tag:'div',className:'row',children:[{tag:'button',action:'page-back:'+String(pageKey),text:'Previous',disabled:page===0},{tag:'span',text:'Page '+String(page+1)+' of '+String(Math.ceil(items.length/size))},{tag:'button',action:'page-next:'+String(pageKey),text:'Next',disabled:(page+1)*size>=items.length}]});\n return tree;\n};\nlet source = {schemaVersion:1}, draft = {schemaVersion:1}, busy = false, dirty = false, locked=false, revision = 0, revisions=[], revisionIndex=-1, assistantEdit=null,mediaAssets=[];\nconst clone = value => JSON.parse(JSON.stringify(value));\nconst text = value => Array.isArray(value) ? value.join(', ') : value === undefined || value === null ? '' : String(value);\nconst control = (label,action,value,multiline=true) => ({tag:'label',text:undefined,children:[{tag:'span',text:label},multiline?{tag:'textarea',id:stableControlId(action),action,value:text(value),disabled:busy||locked,label}:{tag:'input',id:stableControlId(action),type:'text',action,value:text(value),disabled:busy||locked,label}]});\nconst remove = (action,label) => ({tag:'button',action,text:label,className:'danger',disabled:busy||locked});\nconst card = (title,children,action) => ({tag:'article',id:stableControlId(action),className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:title},remove(action,'Remove')]},...children]});\nconst actionButton = (action,label) => ({tag:'button',action,text:label,className:'secondary',disabled:busy||locked});\nconst nextId = prefix => prefix+'-'+String(Date.now())+'-'+Math.random().toString(36).slice(2);\nconst shotCard = (shot,sceneIndex,shotIndex) => ({tag:'article',id:stableControlId('shot-card:'+sceneIndex+':'+shotIndex),className:'shot',children:[\n {tag:'div',className:'card-head',children:[{tag:'h3',text:text(shot.id)||'Shot '+String(shotIndex+1)},remove('remove-shot:'+String(sceneIndex)+':'+String(shotIndex),'Remove shot')]},\n {tag:'div',className:'grid two',children:[control('Shot ID','shot-id:'+sceneIndex+':'+shotIndex,shot.id,false),control('Type','shot-type:'+sceneIndex+':'+shotIndex,shot.type,false),control('Camera size','shot-size:'+sceneIndex+':'+shotIndex,shot.cameraSize,false),control('Camera angle','shot-angle:'+sceneIndex+':'+shotIndex,shot.cameraAngle,false),control('Camera movement','shot-movement:'+sceneIndex+':'+shotIndex,shot.cameraMovement || shot.movement,false),control('Duration','shot-duration:'+sceneIndex+':'+shotIndex,shot.intendedDuration,false),control('Generation length','shot-generation:'+sceneIndex+':'+shotIndex,shot.generationLength,false),control('Fulfillment','shot-fulfillment:'+sceneIndex+':'+shotIndex,shot.fulfillmentType,false)]},\n control('Description','shot-description:'+sceneIndex+':'+shotIndex,shot.description),control('Image prompt','shot-image:'+sceneIndex+':'+shotIndex,shot.imagePromptReadable),control('Video prompt','shot-video:'+sceneIndex+':'+shotIndex,shot.videoPromptReadable)\n]});\nconst ensure = () => {\n if(!draft.emotionalArc || Array.isArray(draft.emotionalArc)) draft.emotionalArc={};\n if(!draft.visualStyleGuide || Array.isArray(draft.visualStyleGuide)) draft.visualStyleGuide=clone(draft.visualStyle && !Array.isArray(draft.visualStyle) ? draft.visualStyle : {});\n if(!Array.isArray(draft.voiceover)) draft.voiceover=[];\n if(!Array.isArray(draft.characters)) draft.characters=[];\n if(!Array.isArray(draft.locations)) draft.locations=[];\n if(!Array.isArray(draft.scenes)) draft.scenes=[];\n const identify=(items,prefix)=>{const used=items.map(item=>item.id).filter(Boolean);items.forEach((item,index)=>{if(!item.id){item.id=items.map((entry,offset)=>prefix+'-missing-'+String(index)+'-'+String(offset)).concat(prefix+'-missing-'+String(index)+'-'+String(items.length)).find(id=>!used.includes(id));used.push(item.id);}});};\n identify(draft.voiceover,'voice');identify(draft.characters,'character');identify(draft.locations,'location');identify(draft.scenes,'scene');draft.scenes.forEach(scene=>{if(!Array.isArray(scene.shotList))scene.shotList=[];identify(scene.shotList,scene.id+'-shot');});\n};\nconst draw = () => {\n ensure();locked=localLocked||!canEdit||failed;\n fields.title.value=text(draft.title);fields.description.value=text(draft.description);fields.videoType.value=text(draft.videoType);fields.targetLength.value=text(draft.targetLength);fields.tone.value=text(draft.tone);fields.aspectRatio.value=text(draft.aspectRatio);fields.extraInfo.value=text(draft.extraInfo);\n arc.beginning.value=text(draft.emotionalArc.beginning);arc.escalation.value=text(draft.emotionalArc.escalation);arc.climax.value=text(draft.emotionalArc.climax);arc.resolution.value=text(draft.emotionalArc.resolution);\n visual.colorPalette.value=text(draft.visualStyleGuide.colorPalette);visual.lightingTone.value=text(draft.visualStyleGuide.lightingTone);visual.cameraLanguage.value=text(draft.visualStyleGuide.cameraLanguage);visual.overallAesthetic.value=text(draft.visualStyleGuide.overallAesthetic || draft.visualStyleGuide.aesthetic);\n StillMade.render('voiceover',list('voiceover',draft.voiceover,(line,index)=>card(text(line.sceneId)||'Voiceover '+String(index+1),[control('Scene ID','voiceover-scene:'+String(index),line.sceneId,false),control('Speaker','voiceover-speaker:'+String(index),line.characterSpeaking,false),control('Narration','voiceover:'+String(index),line.text)],'remove-voiceover:'+String(index))));\n StillMade.render('characters',list('characters',draft.characters,(item,index)=>card(text(item.name)||'Character '+String(index+1),[control('Name','character-name:'+String(index),item.name,false),control('Role','character-role:'+String(index),item.role,false),control('Physical description','character-physical:'+String(index),item.physicalDescription),control('Personality','character-personality:'+String(index),item.personality),control('Notes','character-notes:'+String(index),item.notes)],'remove-character:'+String(index))));\n StillMade.render('locations',list('locations',draft.locations,(item,index)=>card(text(item.name)||'Location '+String(index+1),[control('Name','location-name:'+String(index),item.name,false),control('Time of day','location-time:'+String(index),item.timeOfDay,false),control('Visual description','location-visual:'+String(index),item.visualDescription),control('Atmosphere','location-atmosphere:'+String(index),item.atmosphere || item.emotionalAtmosphere)],'remove-location:'+String(index))));\n StillMade.render('scenes',list('scenes',draft.scenes,(item,index)=>card(text(item.title)||'Scene '+text(item.sceneNumber || index+1),[control('Scene number','scene-number:'+String(index),item.sceneNumber,false),control('Title','scene-title:'+String(index),item.title,false),control('Time of day','scene-time:'+String(index),item.timeOfDay,false),control('Emotional tone','scene-tone:'+String(index),item.emotionalTone,false),control('What happens','scene-action:'+String(index),item.whatHappens || item.action),control('Key visual moment','scene-visual:'+String(index),item.keyVisualMoment),control('Characters','scene-characters:'+String(index),item.charactersPresent),{tag:'div',className:'card-head',children:[{tag:'h3',text:String(item.shotList.length)+' shots'},actionButton('add-shot:'+String(index),'Add shot')]},{tag:'div',className:'shot-list',children:list('shots-'+item.id,item.shotList,(shot,shotIndex)=>shotCard(shot,index,shotIndex),4)}], 'remove-scene:'+String(index)),2));\n StillMade.render('assistantProposal',assistantEdit?[{tag:'p',text:text(assistantEdit.title||'Blueprint proposal')},{tag:'p',text:assistantEdit.field==='blueprint'?'Ready for shared draft review. Adopt it here, then use Review changes before applying to the project.':'This proposal targets another workspace and cannot be applied here.'}]:[{tag:'p',text:'Connect a Blueprint Assistant workspace proposal to review assisted changes here.'}]);if(!rawEditing)raw.value=JSON.stringify(draft,null,2);const lock=document.getElementById('lock');lock.disabled=busy||!canEdit||failed||lockQueued;lock.textContent=localLocked?'Unlock editing':'Lock editing';document.querySelectorAll('input,textarea,select,button').forEach(node=>{if(node!==lock&&!node.closest('#voiceover,#characters,#locations,#scenes'))node.disabled=busy||locked});document.getElementById('undo').disabled=busy||locked||revisionIndex<=0;document.getElementById('redo').disabled=busy||locked||revisionIndex>=revisions.length-1;save.disabled=busy||locked||pending>0||!!queuedBase||rawEditing;document.getElementById('prepareShots').disabled=save.disabled;document.getElementById('discard').disabled=busy||pending>0||rawPending||!canEdit;raw.disabled=busy||!canEdit;document.getElementById('applyRaw').disabled=busy||locked||pending>0||!!queuedBase||rawPending||!!rawQueued;\n};\nconst condition=(state,key)=>Object.hasOwn(state,key)?{exists:true,value:clone(key==='blueprint'?state.blueprint:key==='rawDraft'?state.rawDraft:state.editingLocked)}:{exists:false};\nconst receive=value=>{\n shared=value;canEdit=value.canEdit;if(!lockQueued)localLocked=!!value.state.editingLocked;\n if(value.state.blueprint)initialized=true;\n if(!pending&&!queuedBase&&!failed){\n const next=clone(value.state.blueprint||draft);if(JSON.stringify(next)!==JSON.stringify(draft)){revisions=[clone(next)];revisionIndex=0;}\n draft=next;ensure();draftBase=clone(draft);dirty=JSON.stringify(draft)!==JSON.stringify(source);\n }\n if(!rawPending&&!rawQueued&&!failed){rawFlight=null;rawEditing=!!value.state.rawDraft;if(rawEditing)raw.value=value.state.rawDraft.text;}\n draw();\n document.getElementById('handoffSummary').textContent=value.outputs.shotPlan?String(value.outputs.shotPlan.shots.length)+' shared shots are ready for a connected Step.':'Scene shot lists become a typed Shots document for the next Step.';\n if(!busy&&!pending&&!queuedBase&&!failed){notice=value.outputs.edit?'A shared Blueprint proposal is ready below. Review before applying.':'Working drafts are shared. Project changes still require Review and Apply.';status.textContent=notice;}\n};\nconst failedEdit=error=>{failed=true;notice=error.message+' Your local draft is retained. Copy it before discarding and loading the shared draft.';status.textContent=notice;draw();};\nconst publishDraft=async()=>{\n if(failed)throw Error(notice);const before=queuedBase;if(!before)return;queuedBase=null;\n const next=clone(draft),exists=initialized;initialized=true;draftBase=clone(next);pending+=1;draw();\n try{await StillMade.updateShared({blueprint:next},{blueprint:exists?{exists:true,value:before}:{exists:false}},{merge:true});}\n catch(error){failedEdit(error);throw error;}\n finally{pending-=1;if(!pending&&!queuedBase&&!failed)receive(StillMade.getShared());else draw();}\n};\nconst publishRaw=async()=>{\n if(failed)throw Error(notice);if(!rawQueued)return;const next=rawQueued.value,before=rawBefore;rawQueued=null;rawPending+=1;rawFlight={exists:true,value:clone(next)};draw();\n try{await StillMade.updateShared({rawDraft:next},{rawDraft:before});}\n catch(error){failedEdit(error);throw error;}\n finally{rawPending-=1;if(!rawQueued&&!failed)receive(StillMade.getShared());else draw();}\n};\nconst queueRaw=value=>{if(!rawQueued)rawBefore=rawPending?rawFlight:condition(StillMade.getShared().state,'rawDraft');rawQueued={value};StillMade.scheduleSharedEdit('blueprintRaw',publishRaw);};\nconst clearRaw=()=>{rawEditing=false;queueRaw(null);};\nraw.addEventListener('input',()=>{\n if(busy||!canEdit||failed)return;\n const base=rawEditing?(rawQueued?.value?.base||rawFlight?.value?.base||shared.state.rawDraft?.base||clone(draft)):clone(draft);\n rawEditing=true;queueRaw({text:raw.value,base});save.disabled=true;document.getElementById('applyRaw').disabled=true;\n});\ndocument.getElementById('discard').addEventListener('click',()=>{\n if(busy||pending||rawPending||!canEdit)return;\n StillMade.scheduleSharedEdit('blueprint',async()=>{\n const latest=StillMade.getShared(),values={blueprint:latest.state.blueprint||source,rawDraft:latest.state.rawDraft||null,editingLocked:!!latest.state.editingLocked},before={blueprint:condition(latest.state,'blueprint'),rawDraft:condition(latest.state,'rawDraft'),editingLocked:condition(latest.state,'editingLocked')};\n try{await StillMade.updateShared(values,before);failed=false;queuedBase=null;rawQueued=null;notice='Loaded the shared draft.';receive(StillMade.getShared());}\n catch(error){failedEdit(error);throw error;}\n });\n // Replace failed scheduled callbacks too; recovery never silently retries them.\n StillMade.scheduleSharedEdit('blueprintRaw',()=>{});\n StillMade.scheduleSharedEdit('blueprintLock',()=>{});\n});\nconst changed = () => {if(busy||locked)return;ensure();if(!queuedBase)queuedBase=draftBase||clone(source);dirty=true;revision+=1;const encoded=JSON.stringify(draft);if(JSON.stringify(revisions.find((item,position)=>position===revisionIndex))!==encoded){revisions=revisions.slice(0,revisionIndex+1);revisions.push(clone(draft));if(revisions.length>50)revisions.shift();revisionIndex=revisions.length-1}notice='Sharing the working draft. Review changes before applying to the project.';status.textContent=notice;if(!rawEditing)raw.value=JSON.stringify(draft,null,2);save.disabled=true;StillMade.scheduleSharedEdit('blueprint',publishDraft)};\nfields.title.addEventListener('input',()=>{if(busy||locked)return;draft.title=fields.title.value;changed()});fields.description.addEventListener('input',()=>{if(busy||locked)return;draft.description=fields.description.value;changed()});fields.videoType.addEventListener('input',()=>{if(busy||locked)return;draft.videoType=fields.videoType.value;changed()});fields.targetLength.addEventListener('input',()=>{if(busy||locked)return;draft.targetLength=fields.targetLength.value;changed()});fields.tone.addEventListener('input',()=>{if(busy||locked)return;draft.tone=fields.tone.value;changed()});fields.aspectRatio.addEventListener('input',()=>{if(busy||locked)return;draft.aspectRatio=fields.aspectRatio.value;changed()});fields.extraInfo.addEventListener('input',()=>{if(busy||locked)return;draft.extraInfo=fields.extraInfo.value;changed()});\narc.beginning.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.emotionalArc.beginning=arc.beginning.value;changed()});arc.escalation.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.emotionalArc.escalation=arc.escalation.value;changed()});arc.climax.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.emotionalArc.climax=arc.climax.value;changed()});arc.resolution.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.emotionalArc.resolution=arc.resolution.value;changed()});\nvisual.colorPalette.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.visualStyleGuide.colorPalette=visual.colorPalette.value;changed()});visual.lightingTone.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.visualStyleGuide.lightingTone=visual.lightingTone.value;changed()});visual.cameraLanguage.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.visualStyleGuide.cameraLanguage=visual.cameraLanguage.value;changed()});visual.overallAesthetic.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.visualStyleGuide.overallAesthetic=visual.overallAesthetic.value;changed()});\nStillMade.onAction(event=>{\n if(event.action.startsWith('page-')){const split=event.action.indexOf(':'),group=event.action.slice(split+1);const slot=pages.at(Number(group));if(!slot)return;slot.page=Math.max(0,slot.page+(event.action.startsWith('page-next:')?1:-1));draw();return;}if(event.action.startsWith('library-')||busy||locked)return;const parts=event.action.split(':'),index=Number(parts[1]),kind=parts[0];ensure();\n const character=member('characters',draft.characters,index),place=member('locations',draft.locations,index),scene=member('scenes',draft.scenes,index),voice=member('voiceover',draft.voiceover,index);\n if(kind==='voiceover'&&voice)voice.text=event.value;if(kind==='voiceover-scene'&&voice)voice.sceneId=event.value;if(kind==='voiceover-speaker'&&voice)voice.characterSpeaking=event.value;\n if(kind==='character-name'&&character)character.name=event.value;if(kind==='character-role'&&character)character.role=event.value;if(kind==='character-physical'&&character)character.physicalDescription=event.value;if(kind==='character-personality'&&character)character.personality=event.value;if(kind==='character-notes'&&character)character.notes=event.value;\n if(kind==='location-name'&&place)place.name=event.value;if(kind==='location-time'&&place)place.timeOfDay=event.value;if(kind==='location-visual'&&place)place.visualDescription=event.value;if(kind==='location-atmosphere'&&place)place.atmosphere=event.value;\n if(kind==='scene-number'&&scene)scene.sceneNumber=event.value;if(kind==='scene-title'&&scene)scene.title=event.value;if(kind==='scene-time'&&scene)scene.timeOfDay=event.value;if(kind==='scene-tone'&&scene)scene.emotionalTone=event.value;if(kind==='scene-action'&&scene)scene.whatHappens=event.value;if(kind==='scene-visual'&&scene)scene.keyVisualMoment=event.value;if(kind==='scene-characters'&&scene)scene.charactersPresent=event.value.split(',').map(value=>value.trim()).filter(Boolean);\n const shotIndex=Number(parts[2]),shot=scene && member('shots-'+scene.id,scene.shotList,shotIndex);\n if(kind==='shot-id'&&shot)shot.id=event.value;if(kind==='shot-type'&&shot)shot.type=event.value;if(kind==='shot-size'&&shot)shot.cameraSize=event.value;if(kind==='shot-angle'&&shot)shot.cameraAngle=event.value;if(kind==='shot-movement'&&shot)shot.cameraMovement=event.value;if(kind==='shot-duration'&&shot)shot.intendedDuration=event.value;if(kind==='shot-generation'&&shot)shot.generationLength=event.value;if(kind==='shot-fulfillment'&&shot)shot.fulfillmentType=event.value;if(kind==='shot-description'&&shot)shot.description=event.value;if(kind==='shot-image'&&shot)shot.imagePromptReadable=event.value;if(kind==='shot-video'&&shot)shot.videoPromptReadable=event.value;\n if(kind==='add-shot'&&scene)scene.shotList=[...scene.shotList,{id:nextId('shot',scene.shotList),type:'',description:'',cameraSize:'',cameraAngle:'',cameraMovement:'',intendedDuration:'',generationLength:'',fulfillmentType:'',imagePromptReadable:'',videoPromptReadable:''}];\n if(kind==='remove-shot'&&scene)scene.shotList=scene.shotList.filter(item=>item!==shot);if(kind==='remove-voiceover')draft.voiceover=draft.voiceover.filter(item=>item!==voice);if(kind==='remove-character')draft.characters=draft.characters.filter(item=>item!==character);if(kind==='remove-location')draft.locations=draft.locations.filter(item=>item!==place);if(kind==='remove-scene')draft.scenes=draft.scenes.filter(item=>item!==scene);\n changed();if(kind.startsWith('remove-')||kind==='add-shot')draw();\n});\ndocument.getElementById('addVoiceover').addEventListener('click',()=>{if(!busy&&!locked){ensure();draft.voiceover=[...draft.voiceover,{id:nextId('voice'),sceneId:'scene-'+String(draft.voiceover.length+1),characterSpeaking:'',text:''}];changed();draw()}});\ndocument.getElementById('addCharacter').addEventListener('click',()=>{if(!busy&&!locked){ensure();draft.characters=[...draft.characters,{id:nextId('character',draft.characters),name:'New character',role:'',physicalDescription:'',personality:'',notes:''}];changed();draw()}});\ndocument.getElementById('addLocation').addEventListener('click',()=>{if(!busy&&!locked){ensure();draft.locations=[...draft.locations,{id:nextId('location',draft.locations),name:'New location',timeOfDay:'',visualDescription:'',atmosphere:''}];changed();draw()}});\ndocument.getElementById('addScene').addEventListener('click',()=>{if(!busy&&!locked){ensure();draft.scenes=[...draft.scenes,{id:nextId('scene',draft.scenes),sceneNumber:draft.scenes.length+1,title:'New scene',timeOfDay:'',emotionalTone:'',whatHappens:'',keyVisualMoment:'',charactersPresent:[],shotList:[]}];changed();draw()}});\ndocument.getElementById('applyRaw').addEventListener('click',()=>{if(busy||locked||pending||queuedBase||rawPending||rawQueued)return;try{const value=JSON.parse(raw.value);if(!value||Array.isArray(value)||value.schemaVersion!==1)throw Error('Blueprint JSON must be a version 1 object.');queuedBase=clone(shared.state.rawDraft?.base||draftBase||draft);draft=clone(value);changed();clearRaw();draw();status.textContent='Complete Blueprint data is being shared.'}catch(error){status.textContent=error.message}});\ndocument.getElementById('reset').addEventListener('click',()=>{if(!busy&&!locked){draft=clone(source);changed();draw();status.textContent='Sharing a reset to the current project Blueprint.'}});\nsave.addEventListener('click',async()=>{if(busy||locked||pending||queuedBase||rawEditing)return;const started=revision;busy=true;draw();status.textContent='Checking the complete Blueprint…';try{const result=await StillMade.run({blueprint:source,updatedBlueprint:dirty?draft:source,commit:true});if(started===revision)status.textContent='Blueprint is ready below. Review the before and after, then choose Apply.';/* Saved output is observed independently; never replace a newer working draft. */}catch(error){status.textContent=error.message||'The Blueprint could not be prepared.'}finally{busy=false;draw()}});\nconst renderMediaLibrary=()=>StillMade.render('mediaLibrary',mediaAssets.length?mediaAssets.slice(0,50).map((asset,index)=>({tag:'article',className:'card',children:[{tag:'strong',text:text(asset.title||asset.name||asset.assetId)+' · '+text(asset.versionId)},{tag:'div',className:'row',children:[{tag:'button',action:'library-preview:'+String(index),text:'Preview',className:'secondary'},{tag:'button',action:'library-attach:'+String(index),text:'Add reference',className:'secondary'}]}]})):[{tag:'p',text:'No stored project images are available.'}]);\nconst renderWorkspaceSync=(versions,presence)=>{const saved=Array.isArray(versions)?versions.slice(0,20):[],people=Array.isArray(presence)?presence.slice(0,20):[];StillMade.render('workspaceSync',[{tag:'p',text:saved.length?String(saved.length)+' saved revision'+(saved.length===1?'':'s')+' available.':'No saved revisions yet.'},{tag:'ul',children:saved.map((item,index)=>({tag:'li',text:text(item.title||item.label||item.id||'Revision '+String(index+1))+' · '+text(item.createdAt||item.updatedAt||item.date||'Saved')}))},{tag:'p',text:people.length?String(people.length)+' collaborator'+(people.length===1?'':'s')+' active or recently active.':'No collaborator presence available.'},{tag:'ul',children:people.map((item,index)=>({tag:'li',text:text(item.name||item.displayName||item.id||'Collaborator '+String(index+1))+(item.editing?' · editing '+text(item.editing):'' )}))}])};\nStillMade.onShared(receive);\nStillMade.onInput(values=>{mediaAssets=(Array.isArray(values.assets)?values.assets:[]).filter(asset=>asset&&asset.kind==='image'&&asset.url).slice(0,50);renderMediaLibrary();source=clone(values.blueprint||{schemaVersion:1});if(!initialized&&!pending&&!queuedBase&&!failed){draft=clone(source);ensure();draftBase=clone(draft);revisions=[clone(draft)];revisionIndex=0;}assistantEdit=values.assistantEdit?clone(values.assistantEdit):null;revision+=1;receive(StillMade.getShared());renderWorkspaceSync(values.versions,values.presence);});\n\ndocument.getElementById('prepareShots').addEventListener('click',async()=>{if(busy||locked||pending||queuedBase||rawEditing)return;busy=true;draw();status.textContent='Preparing the exact shot sequence…';try{const result=await StillMade.run({blueprint:source,updatedBlueprint:draft,commit:true});document.getElementById('handoffSummary').textContent=String(result.shotPlan.shots.length)+' shots are ready for a connected Shots or Animated Scene Step.';status.textContent='Shots handoff is ready below. Review Blueprint changes before Apply.'}catch(error){status.textContent=error.message||'The Shots handoff could not be prepared.'}finally{busy=false;draw()}});\n\nconst restoreHistory=index=>{if(busy||locked||index<0||index>=revisions.length)return;revisionIndex=index;draft=clone(revisions.find((item,position)=>position===index));changed();draw();status.textContent='Sharing restored Blueprint revision '+String(index+1)+' of '+String(revisions.length)+'.'};document.getElementById('undo').addEventListener('click',()=>restoreHistory(revisionIndex-1));document.getElementById('redo').addEventListener('click',()=>restoreHistory(revisionIndex+1));document.getElementById('lock').addEventListener('click',()=>{if(busy||!canEdit||failed||lockQueued)return;localLocked=!localLocked;const value=localLocked,before=condition(shared.state,'editingLocked');lockQueued=true;draw();StillMade.scheduleSharedEdit('blueprintLock',async()=>{try{await StillMade.updateShared({editingLocked:value},{editingLocked:before});}catch(error){failedEdit(error);throw error;}finally{lockQueued=false;receive(StillMade.getShared());}});});document.getElementById('tidy').addEventListener('click',()=>{if(busy||locked)return;const tidy=value=>typeof value==='string'?value.trim().replace(/\\s+/g,' '):value;draft={...draft,title:tidy(draft.title),description:tidy(draft.description),videoType:tidy(draft.videoType),targetLength:tidy(draft.targetLength),tone:tidy(draft.tone),aspectRatio:tidy(draft.aspectRatio),extraInfo:tidy(draft.extraInfo)};ensure();draft.voiceover=draft.voiceover.map((item,index)=>({...item,sceneId:tidy(item.sceneId)||'scene-'+String(index+1),characterSpeaking:tidy(item.characterSpeaking),text:tidy(item.text)}));draft.characters=draft.characters.map((item,index)=>({...item,id:item.id||'character-'+String(index+1),name:tidy(item.name),role:tidy(item.role),physicalDescription:tidy(item.physicalDescription),personality:tidy(item.personality),notes:tidy(item.notes)}));draft.locations=draft.locations.map((item,index)=>({...item,id:item.id||'location-'+String(index+1),name:tidy(item.name),timeOfDay:tidy(item.timeOfDay),visualDescription:tidy(item.visualDescription),atmosphere:tidy(item.atmosphere)}));draft.scenes=draft.scenes.map((scene,index)=>({...scene,id:scene.id||'scene-'+String(index+1),title:tidy(scene.title),whatHappens:tidy(scene.whatHappens),keyVisualMoment:tidy(scene.keyVisualMoment),shotList:scene.shotList.map((shot,shotIndex)=>({...shot,id:shot.id||'scene-'+String(index+1)+'-shot-'+String(shotIndex+1),description:tidy(shot.description),imagePromptReadable:tidy(shot.imagePromptReadable),videoPromptReadable:tidy(shot.videoPromptReadable)}))}));changed();draw();status.textContent='Structure assistant trimmed standard text and filled missing stable IDs. Undo is available.'});\n\ndocument.getElementById('applyAssistant').addEventListener('click',()=>{if(busy||locked||!assistantEdit)return;if(assistantEdit.field!=='blueprint'||JSON.stringify(assistantEdit.before)!==JSON.stringify(source)){status.textContent='Assistant proposal is stale or targets another workspace. Request a new proposal from the current Blueprint.';return}draft=clone(assistantEdit.after);changed();draw();status.textContent='Assistant proposal is being shared. Review the fields, then choose Review changes.'});\n\nStillMade.onAction(async event=>{if(!event.action.startsWith('library-')||busy||locked)return;const parts=event.action.split(':'),asset=mediaAssets.find((item,index)=>index===Number(parts[1]));if(!asset)return;if(parts[0]==='library-preview'){try{const preview=await StillMade.previewImage(asset),image=document.getElementById('libraryPreview');image.src=preview.url;image.hidden=false;status.textContent='Showing a trusted preview of the exact stored version.'}catch(error){status.textContent=error.message||'Preview unavailable.'}return}if(!Array.isArray(draft.mediaReferences))draft.mediaReferences=[];if(!draft.mediaReferences.some(item=>item.assetId===asset.assetId&&item.versionId===asset.versionId))draft.mediaReferences=[...draft.mediaReferences,clone(asset)];changed();status.textContent='Exact stored media reference added to the Blueprint.'});\n"
144
- },
145
- "tests": [
146
- {
147
- "name": "Retain the complete existing Blueprint without edits",
148
- "input": {
149
- "blueprint": {
150
- "schemaVersion": 1,
151
- "title": "Keep me",
152
- "characters": [
153
- {
154
- "id": "hero",
155
- "name": "Ari",
156
- "portrait": {
157
- "assetId": "portrait-1",
158
- "versionId": "v3"
159
- }
160
- }
161
- ],
162
- "customWorkflow": {
163
- "keep": true
164
- }
165
- },
166
- "updatedBlueprint": {
167
- "schemaVersion": 1
168
- },
169
- "commit": false
170
- },
171
- "expected": {
172
- "blueprint": {
173
- "schemaVersion": 1,
174
- "title": "Keep me",
175
- "characters": [
176
- {
177
- "id": "hero",
178
- "name": "Ari",
179
- "portrait": {
180
- "assetId": "portrait-1",
181
- "versionId": "v3"
182
- }
183
- }
184
- ],
185
- "customWorkflow": {
186
- "keep": true
187
- }
188
- },
189
- "shotPlan": {
190
- "schemaVersion": 1,
191
- "shots": []
192
- },
193
- "edit": {
194
- "schemaVersion": 1,
195
- "title": "Update Blueprint: Keep me",
196
- "field": "blueprint",
197
- "before": {
198
- "schemaVersion": 1,
199
- "title": "Keep me",
200
- "characters": [
201
- {
202
- "id": "hero",
203
- "name": "Ari",
204
- "portrait": {
205
- "assetId": "portrait-1",
206
- "versionId": "v3"
207
- }
208
- }
209
- ],
210
- "customWorkflow": {
211
- "keep": true
212
- }
213
- },
214
- "after": {
215
- "schemaVersion": 1,
216
- "title": "Keep me",
217
- "characters": [
218
- {
219
- "id": "hero",
220
- "name": "Ari",
221
- "portrait": {
222
- "assetId": "portrait-1",
223
- "versionId": "v3"
224
- }
225
- }
226
- ],
227
- "customWorkflow": {
228
- "keep": true
229
- }
230
- }
231
- }
232
- }
233
- },
234
- {
235
- "name": "Prepare one complete exact Blueprint update",
236
- "input": {
237
- "blueprint": {
238
- "schemaVersion": 1,
239
- "title": "Original",
240
- "characters": [
241
- {
242
- "id": "hero",
243
- "name": "Ari",
244
- "portrait": {
245
- "assetId": "portrait-1",
246
- "versionId": "v3"
247
- }
248
- }
249
- ],
250
- "scenes": [
251
- {
252
- "id": "scene-1",
253
- "title": "Opening",
254
- "shotList": [
255
- {
256
- "id": "shot-1",
257
- "prompt": "Keep this"
258
- }
259
- ]
260
- }
261
- ]
262
- },
263
- "updatedBlueprint": {
264
- "schemaVersion": 1,
265
- "title": "Revised",
266
- "characters": [
267
- {
268
- "id": "hero",
269
- "name": "Ari",
270
- "portrait": {
271
- "assetId": "portrait-1",
272
- "versionId": "v3"
273
- }
274
- }
275
- ],
276
- "scenes": [
277
- {
278
- "id": "scene-1",
279
- "title": "New opening",
280
- "shotList": [
281
- {
282
- "id": "shot-1",
283
- "prompt": "Keep this"
284
- }
285
- ]
286
- }
287
- ]
288
- },
289
- "commit": true
290
- },
291
- "expected": {
292
- "blueprint": {
293
- "schemaVersion": 1,
294
- "title": "Revised",
295
- "characters": [
296
- {
297
- "id": "hero",
298
- "name": "Ari",
299
- "portrait": {
300
- "assetId": "portrait-1",
301
- "versionId": "v3"
302
- }
303
- }
304
- ],
305
- "scenes": [
306
- {
307
- "id": "scene-1",
308
- "title": "New opening",
309
- "shotList": [
310
- {
311
- "id": "shot-1",
312
- "prompt": "Keep this"
313
- }
314
- ]
315
- }
316
- ]
317
- },
318
- "shotPlan": {
319
- "schemaVersion": 1,
320
- "shots": [
321
- {
322
- "id": "shot-1",
323
- "prompt": "Keep this",
324
- "sceneId": "scene-1",
325
- "sceneTitle": "New opening",
326
- "startTime": 0,
327
- "endTime": 4,
328
- "voiceoverText": ""
329
- }
330
- ]
331
- },
332
- "edit": {
333
- "schemaVersion": 1,
334
- "title": "Update Blueprint: Revised",
335
- "field": "blueprint",
336
- "before": {
337
- "schemaVersion": 1,
338
- "title": "Original",
339
- "characters": [
340
- {
341
- "id": "hero",
342
- "name": "Ari",
343
- "portrait": {
344
- "assetId": "portrait-1",
345
- "versionId": "v3"
346
- }
347
- }
348
- ],
349
- "scenes": [
350
- {
351
- "id": "scene-1",
352
- "title": "Opening",
353
- "shotList": [
354
- {
355
- "id": "shot-1",
356
- "prompt": "Keep this"
357
- }
358
- ]
359
- }
360
- ]
361
- },
362
- "after": {
363
- "schemaVersion": 1,
364
- "title": "Revised",
365
- "characters": [
366
- {
367
- "id": "hero",
368
- "name": "Ari",
369
- "portrait": {
370
- "assetId": "portrait-1",
371
- "versionId": "v3"
372
- }
373
- }
374
- ],
375
- "scenes": [
376
- {
377
- "id": "scene-1",
378
- "title": "New opening",
379
- "shotList": [
380
- {
381
- "id": "shot-1",
382
- "prompt": "Keep this"
383
- }
384
- ]
385
- }
386
- ]
387
- }
388
- }
389
- }
390
- }
391
- ],
392
- "portable": {
393
- "format": "stillmade-block/1",
394
- "dependencies": [],
395
- "sources": [
396
- {
397
- "kind": "original",
398
- "license": "MIT",
399
- "paths": [
400
- "LICENSE",
401
- "src/run.js",
402
- "src/view.json"
403
- ],
404
- "evidence": [
405
- "upstream/0/LICENSE",
406
- "upstream/0/src/run.js",
407
- "upstream/0/src/view.json"
408
- ],
409
- "changes": "Original implementation declared by the packager; no reused repository or dependency code."
410
- }
411
- ],
412
- "files": {
413
- "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",
414
- "upstream/0/src/run.js": "const copy = value => JSON.parse(JSON.stringify(value));\nconst source = copy(input.blueprint || {schemaVersion: 1});\nconst candidate = input.commit ? copy(input.updatedBlueprint) : copy(source);\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1) {\n throw new Error('Keep the complete version 1 Blueprint document.');\n}\nconst title = typeof candidate.title === 'string' && candidate.title.trim()\n ? `Update Blueprint: ${candidate.title.trim().slice(0, 160)}`\n : 'Update production Blueprint';\nconst seconds = value => {\n const number = Number(value);\n if (Number.isFinite(number) && number > 0) return number;\n const match = String(value || '').match(/\\d+(?:\\.\\d+)?/);\n return match ? Math.max(.001, Number(match[0])) : 4;\n};\nlet cursor = 0;\nconst shots = [];\nfor (const [sceneIndex, scene] of (Array.isArray(candidate.scenes) ? candidate.scenes : []).entries()) {\n const narration = (Array.isArray(candidate.voiceover) ? candidate.voiceover : []).find(line => line?.sceneId && line.sceneId === scene?.id)?.text || '';\n for (const [shotIndex, sourceShot] of (Array.isArray(scene?.shotList) ? scene.shotList : []).entries()) {\n const shot = copy(sourceShot || {});\n const start = Number.isFinite(Number(shot.startTime)) ? Number(shot.startTime) : cursor;\n const duration = Number.isFinite(Number(shot.endTime)) && Number(shot.endTime) > start\n ? Number(shot.endTime) - start\n : seconds(shot.intendedDuration || shot.generationLength);\n const end = start + duration;\n shots.push({...shot,id:String(shot.id || `scene-${sceneIndex + 1}-shot-${shotIndex + 1}`),sceneId:String(scene?.id || scene?.sceneId || `scene-${sceneIndex + 1}`),sceneTitle:String(scene?.title || ''),startTime:start,endTime:end,voiceoverText:String(shot.voiceoverText || narration)});\n cursor = Math.max(cursor, end);\n }\n}\nconst outputs = {\n blueprint: candidate,\n shotPlan: {schemaVersion: 1, shots},\n edit: {schemaVersion: 1, title, field: 'blueprint', before: source, after: candidate}\n};\nif(Array.isArray(input.versions)||Array.isArray(input.presence))outputs.revision={schemaVersion:1,scope:'blueprint',baseRevision:(Array.isArray(input.versions)?input.versions:[]).slice(0,200).reduce((highest,item)=>Math.max(highest,Number(item&&item.revision)||0),0),committed:!!input.commit,changed:JSON.stringify(source)!==JSON.stringify(candidate),paths:JSON.stringify(source)===JSON.stringify(candidate)?[]:['blueprint']};\nreturn outputs;\n",
415
- "upstream/0/src/view.json": "{\n \"html\": \"<main class=\\\"blueprint-workspace\\\">\\n <header>\\n <div><small>Production workspace</small><h1>Blueprint</h1></div>\\n <div class=\\\"actions\\\"><button id=\\\"undo\\\" type=\\\"button\\\" class=\\\"secondary\\\">Undo</button><button id=\\\"redo\\\" type=\\\"button\\\" class=\\\"secondary\\\">Redo</button><button id=\\\"tidy\\\" type=\\\"button\\\" class=\\\"secondary\\\">Tidy structure</button><button id=\\\"lock\\\" type=\\\"button\\\" class=\\\"secondary\\\">Lock editing</button><button id=\\\"discard\\\" type=\\\"button\\\" class=\\\"secondary\\\">Discard local draft and load shared</button><button id=\\\"reset\\\" type=\\\"button\\\" class=\\\"secondary\\\">Reset changes</button><button id=\\\"save\\\" type=\\\"button\\\" data-stillmade-action=\\\"run\\\">Review changes</button></div>\\n </header>\\n <output id=\\\"status\\\" role=\\\"status\\\" aria-live=\\\"polite\\\">Loading the project Blueprint…</output>\\n <section><h2>Saved revisions and collaborators</h2><div id=\\\"workspaceSync\\\"></div></section>\\n <section><h2>Project media library</h2><p>Browse exact stored image versions supplied by the host.</p><div id=\\\"mediaLibrary\\\"></div><img id=\\\"libraryPreview\\\" alt=\\\"Trusted project media preview\\\" hidden></section>\\n <section><div class=\\\"section-title\\\"><h2>Assistant proposal</h2><button id=\\\"applyAssistant\\\" type=\\\"button\\\" class=\\\"secondary\\\">Adopt proposal in shared draft</button></div><div id=\\\"assistantProposal\\\"></div></section>\\n <section class=\\\"handoff\\\"><h2>Shots handoff</h2><p id=\\\"handoffSummary\\\">Scene shot lists become a typed Shots document for the next Step.</p><button id=\\\"prepareShots\\\" type=\\\"button\\\" class=\\\"secondary\\\">Prepare Shots handoff</button></section>\\n\\n <section>\\n <h2>Project overview</h2>\\n <div class=\\\"grid two\\\">\\n <label>Title<input id=\\\"title\\\" type=\\\"text\\\"></label>\\n <label>Video type<input id=\\\"videoType\\\" type=\\\"text\\\"></label>\\n <label>Target length<input id=\\\"targetLength\\\" type=\\\"text\\\"></label>\\n <label>Tone<input id=\\\"tone\\\" type=\\\"text\\\"></label>\\n <label>Aspect ratio<input id=\\\"aspectRatio\\\" type=\\\"text\\\"></label>\\n </div>\\n <label>Description<textarea id=\\\"description\\\"></textarea></label>\\n <label>Extra information<textarea id=\\\"extraInfo\\\"></textarea></label>\\n </section>\\n\\n <section>\\n <h2>Emotional arc</h2>\\n <div class=\\\"grid two\\\">\\n <label>Beginning<textarea id=\\\"arcBeginning\\\"></textarea></label>\\n <label>Escalation<textarea id=\\\"arcEscalation\\\"></textarea></label>\\n <label>Climax<textarea id=\\\"arcClimax\\\"></textarea></label>\\n <label>Resolution<textarea id=\\\"arcResolution\\\"></textarea></label>\\n </div>\\n </section>\\n\\n <section>\\n <h2>Visual style guide</h2>\\n <div class=\\\"grid two\\\">\\n <label>Color palette<textarea id=\\\"styleColor\\\"></textarea></label>\\n <label>Lighting tone<textarea id=\\\"styleLighting\\\"></textarea></label>\\n <label>Camera language<textarea id=\\\"styleCamera\\\"></textarea></label>\\n <label>Overall aesthetic<textarea id=\\\"styleAesthetic\\\"></textarea></label>\\n </div>\\n </section>\\n\\n <section><div class=\\\"section-title\\\"><h2>Voiceover</h2><button id=\\\"addVoiceover\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add narration</button></div><div id=\\\"voiceover\\\" class=\\\"cards\\\"></div></section>\\n <section><div class=\\\"section-title\\\"><h2>Characters</h2><button id=\\\"addCharacter\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add character</button></div><div id=\\\"characters\\\" class=\\\"cards\\\"></div></section>\\n <section><div class=\\\"section-title\\\"><h2>Locations</h2><button id=\\\"addLocation\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add location</button></div><div id=\\\"locations\\\" class=\\\"cards\\\"></div></section>\\n <section><div class=\\\"section-title\\\"><h2>Scenes and shots</h2><button id=\\\"addScene\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add scene</button></div><div id=\\\"scenes\\\" class=\\\"cards\\\"></div></section>\\n\\n <details id=\\\"advanced\\\"><summary>Complete Blueprint data</summary><p>All fields are retained. Edit this JSON for fields a custom Blueprint adds beyond the standard workspace.</p><label for=\\\"raw\\\">Complete Blueprint 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\": \".blueprint-workspace{width:100%;min-width:0;margin:0;padding:8px;color:var(--fg)}\\nheader,.section-title,.actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}header{justify-content:space-between;margin-bottom:14px}header h1{margin:2px 0}header small,output,p{color:var(--fg-muted)}\\nsection,details{margin:14px 0;padding:16px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}\\nh2{margin:0 0 12px;font-size:22px}.section-title{justify-content:space-between}.section-title h2{margin:0}\\n.grid{display:grid;gap:12px}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}label{display:grid;gap:6px;margin:10px 0;font-size:13px;font-weight:600}textarea{min-height:88px;resize:vertical}input,textarea{width:100%;background:var(--bg)}\\n.cards{display:grid;gap:12px}.card{padding:14px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg)}.card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.card h3{margin:0;font-size:16px}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}\\n.shot-list{display:grid;gap:10px;margin-top:12px}.shot{padding:12px;border-left:3px solid var(--border-strong);background:var(--bg-elev-1)}.shot .grid{margin-top:4px}button,input,textarea,summary{min-height:44px}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.55}\\n.raw{min-height:320px;font-family:var(--font-mono);font-size:12px}summary{font-weight:700}output{display:block;min-height:24px;margin:8px 2px}\\n@media(max-width:680px){.blueprint-workspace{padding:0}.grid.two{grid-template-columns:1fr}section,details{padding:12px}.actions{width:100%}.actions button{flex:1}}\\n\",\n \"javascript\": \"const fields = {\\n title: document.getElementById('title'), description: document.getElementById('description'), videoType: document.getElementById('videoType'),\\n targetLength: document.getElementById('targetLength'), tone: document.getElementById('tone'), aspectRatio: document.getElementById('aspectRatio'), extraInfo: document.getElementById('extraInfo')\\n};\\nconst arc = {beginning:document.getElementById('arcBeginning'),escalation:document.getElementById('arcEscalation'),climax:document.getElementById('arcClimax'),resolution:document.getElementById('arcResolution')};\\nconst visual = {colorPalette:document.getElementById('styleColor'),lightingTone:document.getElementById('styleLighting'),cameraLanguage:document.getElementById('styleCamera'),overallAesthetic:document.getElementById('styleAesthetic')};\\nconst status = document.getElementById('status'), raw = document.getElementById('raw'), save = document.getElementById('save');\\nlet shared={state:{},outputs:{},canEdit:false},canEdit=false,failed=false,pending=0,queuedBase=null,draftBase=null,initialized=false,localLocked=false,notice='',rawEditing=false,rawPending=0,rawQueued=null,rawBefore=null,rawFlight=null,lockQueued=false;\\nconst identities=[],pages=[];\\nconst pageFor=group=>{let page=pages.find(item=>item.group===group);if(!page){page={group,page:0};pages.push(page);}return page;};\\nconst keyFor=(group,item)=>{const id=group+':'+item.id;let key=identities.indexOf(id);if(key<0){identities.push(id);key=identities.length-1;}return key;};\\nconst stableControlId=action=>{const value=JSON.stringify(action.split(':').map((part,index)=>index?(identities.at(Number(part))||part):part));const a=value.split('').reduce((hash,char)=>Math.imul(hash^char.charCodeAt(0),16777619),2166136261)>>>0,b=value.split('').reduce((hash,char)=>Math.imul(hash^char.charCodeAt(0),2246822519),3266489917)>>>0;return 'blueprint-'+a.toString(36)+'-'+b.toString(36);};\\nconst member=(group,items,key)=>items.find(item=>identities.at(key)===group+':'+item.id);\\nconst list=(group,items,render,size=8)=>{\\n const slot=pageFor(group),pageKey=pages.indexOf(slot),page=Math.min(slot.page,Math.max(0,Math.ceil(items.length/size)-1));slot.page=page;\\n const tree=items.slice(page*size,page*size+size).map(item=>render(item,keyFor(group,item)));\\n if(items.length>size)tree.push({tag:'div',className:'row',children:[{tag:'button',action:'page-back:'+String(pageKey),text:'Previous',disabled:page===0},{tag:'span',text:'Page '+String(page+1)+' of '+String(Math.ceil(items.length/size))},{tag:'button',action:'page-next:'+String(pageKey),text:'Next',disabled:(page+1)*size>=items.length}]});\\n return tree;\\n};\\nlet source = {schemaVersion:1}, draft = {schemaVersion:1}, busy = false, dirty = false, locked=false, revision = 0, revisions=[], revisionIndex=-1, assistantEdit=null,mediaAssets=[];\\nconst clone = value => JSON.parse(JSON.stringify(value));\\nconst text = value => Array.isArray(value) ? value.join(', ') : value === undefined || value === null ? '' : String(value);\\nconst control = (label,action,value,multiline=true) => ({tag:'label',text:undefined,children:[{tag:'span',text:label},multiline?{tag:'textarea',id:stableControlId(action),action,value:text(value),disabled:busy||locked,label}:{tag:'input',id:stableControlId(action),type:'text',action,value:text(value),disabled:busy||locked,label}]});\\nconst remove = (action,label) => ({tag:'button',action,text:label,className:'danger',disabled:busy||locked});\\nconst card = (title,children,action) => ({tag:'article',id:stableControlId(action),className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:title},remove(action,'Remove')]},...children]});\\nconst actionButton = (action,label) => ({tag:'button',action,text:label,className:'secondary',disabled:busy||locked});\\nconst nextId = prefix => prefix+'-'+String(Date.now())+'-'+Math.random().toString(36).slice(2);\\nconst shotCard = (shot,sceneIndex,shotIndex) => ({tag:'article',id:stableControlId('shot-card:'+sceneIndex+':'+shotIndex),className:'shot',children:[\\n {tag:'div',className:'card-head',children:[{tag:'h3',text:text(shot.id)||'Shot '+String(shotIndex+1)},remove('remove-shot:'+String(sceneIndex)+':'+String(shotIndex),'Remove shot')]},\\n {tag:'div',className:'grid two',children:[control('Shot ID','shot-id:'+sceneIndex+':'+shotIndex,shot.id,false),control('Type','shot-type:'+sceneIndex+':'+shotIndex,shot.type,false),control('Camera size','shot-size:'+sceneIndex+':'+shotIndex,shot.cameraSize,false),control('Camera angle','shot-angle:'+sceneIndex+':'+shotIndex,shot.cameraAngle,false),control('Camera movement','shot-movement:'+sceneIndex+':'+shotIndex,shot.cameraMovement || shot.movement,false),control('Duration','shot-duration:'+sceneIndex+':'+shotIndex,shot.intendedDuration,false),control('Generation length','shot-generation:'+sceneIndex+':'+shotIndex,shot.generationLength,false),control('Fulfillment','shot-fulfillment:'+sceneIndex+':'+shotIndex,shot.fulfillmentType,false)]},\\n control('Description','shot-description:'+sceneIndex+':'+shotIndex,shot.description),control('Image prompt','shot-image:'+sceneIndex+':'+shotIndex,shot.imagePromptReadable),control('Video prompt','shot-video:'+sceneIndex+':'+shotIndex,shot.videoPromptReadable)\\n]});\\nconst ensure = () => {\\n if(!draft.emotionalArc || Array.isArray(draft.emotionalArc)) draft.emotionalArc={};\\n if(!draft.visualStyleGuide || Array.isArray(draft.visualStyleGuide)) draft.visualStyleGuide=clone(draft.visualStyle && !Array.isArray(draft.visualStyle) ? draft.visualStyle : {});\\n if(!Array.isArray(draft.voiceover)) draft.voiceover=[];\\n if(!Array.isArray(draft.characters)) draft.characters=[];\\n if(!Array.isArray(draft.locations)) draft.locations=[];\\n if(!Array.isArray(draft.scenes)) draft.scenes=[];\\n const identify=(items,prefix)=>{const used=items.map(item=>item.id).filter(Boolean);items.forEach((item,index)=>{if(!item.id){item.id=items.map((entry,offset)=>prefix+'-missing-'+String(index)+'-'+String(offset)).concat(prefix+'-missing-'+String(index)+'-'+String(items.length)).find(id=>!used.includes(id));used.push(item.id);}});};\\n identify(draft.voiceover,'voice');identify(draft.characters,'character');identify(draft.locations,'location');identify(draft.scenes,'scene');draft.scenes.forEach(scene=>{if(!Array.isArray(scene.shotList))scene.shotList=[];identify(scene.shotList,scene.id+'-shot');});\\n};\\nconst draw = () => {\\n ensure();locked=localLocked||!canEdit||failed;\\n fields.title.value=text(draft.title);fields.description.value=text(draft.description);fields.videoType.value=text(draft.videoType);fields.targetLength.value=text(draft.targetLength);fields.tone.value=text(draft.tone);fields.aspectRatio.value=text(draft.aspectRatio);fields.extraInfo.value=text(draft.extraInfo);\\n arc.beginning.value=text(draft.emotionalArc.beginning);arc.escalation.value=text(draft.emotionalArc.escalation);arc.climax.value=text(draft.emotionalArc.climax);arc.resolution.value=text(draft.emotionalArc.resolution);\\n visual.colorPalette.value=text(draft.visualStyleGuide.colorPalette);visual.lightingTone.value=text(draft.visualStyleGuide.lightingTone);visual.cameraLanguage.value=text(draft.visualStyleGuide.cameraLanguage);visual.overallAesthetic.value=text(draft.visualStyleGuide.overallAesthetic || draft.visualStyleGuide.aesthetic);\\n StillMade.render('voiceover',list('voiceover',draft.voiceover,(line,index)=>card(text(line.sceneId)||'Voiceover '+String(index+1),[control('Scene ID','voiceover-scene:'+String(index),line.sceneId,false),control('Speaker','voiceover-speaker:'+String(index),line.characterSpeaking,false),control('Narration','voiceover:'+String(index),line.text)],'remove-voiceover:'+String(index))));\\n StillMade.render('characters',list('characters',draft.characters,(item,index)=>card(text(item.name)||'Character '+String(index+1),[control('Name','character-name:'+String(index),item.name,false),control('Role','character-role:'+String(index),item.role,false),control('Physical description','character-physical:'+String(index),item.physicalDescription),control('Personality','character-personality:'+String(index),item.personality),control('Notes','character-notes:'+String(index),item.notes)],'remove-character:'+String(index))));\\n StillMade.render('locations',list('locations',draft.locations,(item,index)=>card(text(item.name)||'Location '+String(index+1),[control('Name','location-name:'+String(index),item.name,false),control('Time of day','location-time:'+String(index),item.timeOfDay,false),control('Visual description','location-visual:'+String(index),item.visualDescription),control('Atmosphere','location-atmosphere:'+String(index),item.atmosphere || item.emotionalAtmosphere)],'remove-location:'+String(index))));\\n StillMade.render('scenes',list('scenes',draft.scenes,(item,index)=>card(text(item.title)||'Scene '+text(item.sceneNumber || index+1),[control('Scene number','scene-number:'+String(index),item.sceneNumber,false),control('Title','scene-title:'+String(index),item.title,false),control('Time of day','scene-time:'+String(index),item.timeOfDay,false),control('Emotional tone','scene-tone:'+String(index),item.emotionalTone,false),control('What happens','scene-action:'+String(index),item.whatHappens || item.action),control('Key visual moment','scene-visual:'+String(index),item.keyVisualMoment),control('Characters','scene-characters:'+String(index),item.charactersPresent),{tag:'div',className:'card-head',children:[{tag:'h3',text:String(item.shotList.length)+' shots'},actionButton('add-shot:'+String(index),'Add shot')]},{tag:'div',className:'shot-list',children:list('shots-'+item.id,item.shotList,(shot,shotIndex)=>shotCard(shot,index,shotIndex),4)}], 'remove-scene:'+String(index)),2));\\n StillMade.render('assistantProposal',assistantEdit?[{tag:'p',text:text(assistantEdit.title||'Blueprint proposal')},{tag:'p',text:assistantEdit.field==='blueprint'?'Ready for shared draft review. Adopt it here, then use Review changes before applying to the project.':'This proposal targets another workspace and cannot be applied here.'}]:[{tag:'p',text:'Connect a Blueprint Assistant workspace proposal to review assisted changes here.'}]);if(!rawEditing)raw.value=JSON.stringify(draft,null,2);const lock=document.getElementById('lock');lock.disabled=busy||!canEdit||failed||lockQueued;lock.textContent=localLocked?'Unlock editing':'Lock editing';document.querySelectorAll('input,textarea,select,button').forEach(node=>{if(node!==lock&&!node.closest('#voiceover,#characters,#locations,#scenes'))node.disabled=busy||locked});document.getElementById('undo').disabled=busy||locked||revisionIndex<=0;document.getElementById('redo').disabled=busy||locked||revisionIndex>=revisions.length-1;save.disabled=busy||locked||pending>0||!!queuedBase||rawEditing;document.getElementById('prepareShots').disabled=save.disabled;document.getElementById('discard').disabled=busy||pending>0||rawPending||!canEdit;raw.disabled=busy||!canEdit;document.getElementById('applyRaw').disabled=busy||locked||pending>0||!!queuedBase||rawPending||!!rawQueued;\\n};\\nconst condition=(state,key)=>Object.hasOwn(state,key)?{exists:true,value:clone(key==='blueprint'?state.blueprint:key==='rawDraft'?state.rawDraft:state.editingLocked)}:{exists:false};\\nconst receive=value=>{\\n shared=value;canEdit=value.canEdit;if(!lockQueued)localLocked=!!value.state.editingLocked;\\n if(value.state.blueprint)initialized=true;\\n if(!pending&&!queuedBase&&!failed){\\n const next=clone(value.state.blueprint||draft);if(JSON.stringify(next)!==JSON.stringify(draft)){revisions=[clone(next)];revisionIndex=0;}\\n draft=next;ensure();draftBase=clone(draft);dirty=JSON.stringify(draft)!==JSON.stringify(source);\\n }\\n if(!rawPending&&!rawQueued&&!failed){rawFlight=null;rawEditing=!!value.state.rawDraft;if(rawEditing)raw.value=value.state.rawDraft.text;}\\n draw();\\n document.getElementById('handoffSummary').textContent=value.outputs.shotPlan?String(value.outputs.shotPlan.shots.length)+' shared shots are ready for a connected Step.':'Scene shot lists become a typed Shots document for the next Step.';\\n if(!busy&&!pending&&!queuedBase&&!failed){notice=value.outputs.edit?'A shared Blueprint proposal is ready below. Review before applying.':'Working drafts are shared. Project changes still require Review and Apply.';status.textContent=notice;}\\n};\\nconst failedEdit=error=>{failed=true;notice=error.message+' Your local draft is retained. Copy it before discarding and loading the shared draft.';status.textContent=notice;draw();};\\nconst publishDraft=async()=>{\\n if(failed)throw Error(notice);const before=queuedBase;if(!before)return;queuedBase=null;\\n const next=clone(draft),exists=initialized;initialized=true;draftBase=clone(next);pending+=1;draw();\\n try{await StillMade.updateShared({blueprint:next},{blueprint:exists?{exists:true,value:before}:{exists:false}},{merge:true});}\\n catch(error){failedEdit(error);throw error;}\\n finally{pending-=1;if(!pending&&!queuedBase&&!failed)receive(StillMade.getShared());else draw();}\\n};\\nconst publishRaw=async()=>{\\n if(failed)throw Error(notice);if(!rawQueued)return;const next=rawQueued.value,before=rawBefore;rawQueued=null;rawPending+=1;rawFlight={exists:true,value:clone(next)};draw();\\n try{await StillMade.updateShared({rawDraft:next},{rawDraft:before});}\\n catch(error){failedEdit(error);throw error;}\\n finally{rawPending-=1;if(!rawQueued&&!failed)receive(StillMade.getShared());else draw();}\\n};\\nconst queueRaw=value=>{if(!rawQueued)rawBefore=rawPending?rawFlight:condition(StillMade.getShared().state,'rawDraft');rawQueued={value};StillMade.scheduleSharedEdit('blueprintRaw',publishRaw);};\\nconst clearRaw=()=>{rawEditing=false;queueRaw(null);};\\nraw.addEventListener('input',()=>{\\n if(busy||!canEdit||failed)return;\\n const base=rawEditing?(rawQueued?.value?.base||rawFlight?.value?.base||shared.state.rawDraft?.base||clone(draft)):clone(draft);\\n rawEditing=true;queueRaw({text:raw.value,base});save.disabled=true;document.getElementById('applyRaw').disabled=true;\\n});\\ndocument.getElementById('discard').addEventListener('click',()=>{\\n if(busy||pending||rawPending||!canEdit)return;\\n StillMade.scheduleSharedEdit('blueprint',async()=>{\\n const latest=StillMade.getShared(),values={blueprint:latest.state.blueprint||source,rawDraft:latest.state.rawDraft||null,editingLocked:!!latest.state.editingLocked},before={blueprint:condition(latest.state,'blueprint'),rawDraft:condition(latest.state,'rawDraft'),editingLocked:condition(latest.state,'editingLocked')};\\n try{await StillMade.updateShared(values,before);failed=false;queuedBase=null;rawQueued=null;notice='Loaded the shared draft.';receive(StillMade.getShared());}\\n catch(error){failedEdit(error);throw error;}\\n });\\n // Replace failed scheduled callbacks too; recovery never silently retries them.\\n StillMade.scheduleSharedEdit('blueprintRaw',()=>{});\\n StillMade.scheduleSharedEdit('blueprintLock',()=>{});\\n});\\nconst changed = () => {if(busy||locked)return;ensure();if(!queuedBase)queuedBase=draftBase||clone(source);dirty=true;revision+=1;const encoded=JSON.stringify(draft);if(JSON.stringify(revisions.find((item,position)=>position===revisionIndex))!==encoded){revisions=revisions.slice(0,revisionIndex+1);revisions.push(clone(draft));if(revisions.length>50)revisions.shift();revisionIndex=revisions.length-1}notice='Sharing the working draft. Review changes before applying to the project.';status.textContent=notice;if(!rawEditing)raw.value=JSON.stringify(draft,null,2);save.disabled=true;StillMade.scheduleSharedEdit('blueprint',publishDraft)};\\nfields.title.addEventListener('input',()=>{if(busy||locked)return;draft.title=fields.title.value;changed()});fields.description.addEventListener('input',()=>{if(busy||locked)return;draft.description=fields.description.value;changed()});fields.videoType.addEventListener('input',()=>{if(busy||locked)return;draft.videoType=fields.videoType.value;changed()});fields.targetLength.addEventListener('input',()=>{if(busy||locked)return;draft.targetLength=fields.targetLength.value;changed()});fields.tone.addEventListener('input',()=>{if(busy||locked)return;draft.tone=fields.tone.value;changed()});fields.aspectRatio.addEventListener('input',()=>{if(busy||locked)return;draft.aspectRatio=fields.aspectRatio.value;changed()});fields.extraInfo.addEventListener('input',()=>{if(busy||locked)return;draft.extraInfo=fields.extraInfo.value;changed()});\\narc.beginning.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.emotionalArc.beginning=arc.beginning.value;changed()});arc.escalation.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.emotionalArc.escalation=arc.escalation.value;changed()});arc.climax.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.emotionalArc.climax=arc.climax.value;changed()});arc.resolution.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.emotionalArc.resolution=arc.resolution.value;changed()});\\nvisual.colorPalette.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.visualStyleGuide.colorPalette=visual.colorPalette.value;changed()});visual.lightingTone.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.visualStyleGuide.lightingTone=visual.lightingTone.value;changed()});visual.cameraLanguage.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.visualStyleGuide.cameraLanguage=visual.cameraLanguage.value;changed()});visual.overallAesthetic.addEventListener('input',()=>{if(busy||locked)return;ensure();draft.visualStyleGuide.overallAesthetic=visual.overallAesthetic.value;changed()});\\nStillMade.onAction(event=>{\\n if(event.action.startsWith('page-')){const split=event.action.indexOf(':'),group=event.action.slice(split+1);const slot=pages.at(Number(group));if(!slot)return;slot.page=Math.max(0,slot.page+(event.action.startsWith('page-next:')?1:-1));draw();return;}if(event.action.startsWith('library-')||busy||locked)return;const parts=event.action.split(':'),index=Number(parts[1]),kind=parts[0];ensure();\\n const character=member('characters',draft.characters,index),place=member('locations',draft.locations,index),scene=member('scenes',draft.scenes,index),voice=member('voiceover',draft.voiceover,index);\\n if(kind==='voiceover'&&voice)voice.text=event.value;if(kind==='voiceover-scene'&&voice)voice.sceneId=event.value;if(kind==='voiceover-speaker'&&voice)voice.characterSpeaking=event.value;\\n if(kind==='character-name'&&character)character.name=event.value;if(kind==='character-role'&&character)character.role=event.value;if(kind==='character-physical'&&character)character.physicalDescription=event.value;if(kind==='character-personality'&&character)character.personality=event.value;if(kind==='character-notes'&&character)character.notes=event.value;\\n if(kind==='location-name'&&place)place.name=event.value;if(kind==='location-time'&&place)place.timeOfDay=event.value;if(kind==='location-visual'&&place)place.visualDescription=event.value;if(kind==='location-atmosphere'&&place)place.atmosphere=event.value;\\n if(kind==='scene-number'&&scene)scene.sceneNumber=event.value;if(kind==='scene-title'&&scene)scene.title=event.value;if(kind==='scene-time'&&scene)scene.timeOfDay=event.value;if(kind==='scene-tone'&&scene)scene.emotionalTone=event.value;if(kind==='scene-action'&&scene)scene.whatHappens=event.value;if(kind==='scene-visual'&&scene)scene.keyVisualMoment=event.value;if(kind==='scene-characters'&&scene)scene.charactersPresent=event.value.split(',').map(value=>value.trim()).filter(Boolean);\\n const shotIndex=Number(parts[2]),shot=scene && member('shots-'+scene.id,scene.shotList,shotIndex);\\n if(kind==='shot-id'&&shot)shot.id=event.value;if(kind==='shot-type'&&shot)shot.type=event.value;if(kind==='shot-size'&&shot)shot.cameraSize=event.value;if(kind==='shot-angle'&&shot)shot.cameraAngle=event.value;if(kind==='shot-movement'&&shot)shot.cameraMovement=event.value;if(kind==='shot-duration'&&shot)shot.intendedDuration=event.value;if(kind==='shot-generation'&&shot)shot.generationLength=event.value;if(kind==='shot-fulfillment'&&shot)shot.fulfillmentType=event.value;if(kind==='shot-description'&&shot)shot.description=event.value;if(kind==='shot-image'&&shot)shot.imagePromptReadable=event.value;if(kind==='shot-video'&&shot)shot.videoPromptReadable=event.value;\\n if(kind==='add-shot'&&scene)scene.shotList=[...scene.shotList,{id:nextId('shot',scene.shotList),type:'',description:'',cameraSize:'',cameraAngle:'',cameraMovement:'',intendedDuration:'',generationLength:'',fulfillmentType:'',imagePromptReadable:'',videoPromptReadable:''}];\\n if(kind==='remove-shot'&&scene)scene.shotList=scene.shotList.filter(item=>item!==shot);if(kind==='remove-voiceover')draft.voiceover=draft.voiceover.filter(item=>item!==voice);if(kind==='remove-character')draft.characters=draft.characters.filter(item=>item!==character);if(kind==='remove-location')draft.locations=draft.locations.filter(item=>item!==place);if(kind==='remove-scene')draft.scenes=draft.scenes.filter(item=>item!==scene);\\n changed();if(kind.startsWith('remove-')||kind==='add-shot')draw();\\n});\\ndocument.getElementById('addVoiceover').addEventListener('click',()=>{if(!busy&&!locked){ensure();draft.voiceover=[...draft.voiceover,{id:nextId('voice'),sceneId:'scene-'+String(draft.voiceover.length+1),characterSpeaking:'',text:''}];changed();draw()}});\\ndocument.getElementById('addCharacter').addEventListener('click',()=>{if(!busy&&!locked){ensure();draft.characters=[...draft.characters,{id:nextId('character',draft.characters),name:'New character',role:'',physicalDescription:'',personality:'',notes:''}];changed();draw()}});\\ndocument.getElementById('addLocation').addEventListener('click',()=>{if(!busy&&!locked){ensure();draft.locations=[...draft.locations,{id:nextId('location',draft.locations),name:'New location',timeOfDay:'',visualDescription:'',atmosphere:''}];changed();draw()}});\\ndocument.getElementById('addScene').addEventListener('click',()=>{if(!busy&&!locked){ensure();draft.scenes=[...draft.scenes,{id:nextId('scene',draft.scenes),sceneNumber:draft.scenes.length+1,title:'New scene',timeOfDay:'',emotionalTone:'',whatHappens:'',keyVisualMoment:'',charactersPresent:[],shotList:[]}];changed();draw()}});\\ndocument.getElementById('applyRaw').addEventListener('click',()=>{if(busy||locked||pending||queuedBase||rawPending||rawQueued)return;try{const value=JSON.parse(raw.value);if(!value||Array.isArray(value)||value.schemaVersion!==1)throw Error('Blueprint JSON must be a version 1 object.');queuedBase=clone(shared.state.rawDraft?.base||draftBase||draft);draft=clone(value);changed();clearRaw();draw();status.textContent='Complete Blueprint data is being shared.'}catch(error){status.textContent=error.message}});\\ndocument.getElementById('reset').addEventListener('click',()=>{if(!busy&&!locked){draft=clone(source);changed();draw();status.textContent='Sharing a reset to the current project Blueprint.'}});\\nsave.addEventListener('click',async()=>{if(busy||locked||pending||queuedBase||rawEditing)return;const started=revision;busy=true;draw();status.textContent='Checking the complete Blueprint…';try{const result=await StillMade.run({blueprint:source,updatedBlueprint:dirty?draft:source,commit:true});if(started===revision)status.textContent='Blueprint is ready below. Review the before and after, then choose Apply.';/* Saved output is observed independently; never replace a newer working draft. */}catch(error){status.textContent=error.message||'The Blueprint could not be prepared.'}finally{busy=false;draw()}});\\nconst renderMediaLibrary=()=>StillMade.render('mediaLibrary',mediaAssets.length?mediaAssets.slice(0,50).map((asset,index)=>({tag:'article',className:'card',children:[{tag:'strong',text:text(asset.title||asset.name||asset.assetId)+' · '+text(asset.versionId)},{tag:'div',className:'row',children:[{tag:'button',action:'library-preview:'+String(index),text:'Preview',className:'secondary'},{tag:'button',action:'library-attach:'+String(index),text:'Add reference',className:'secondary'}]}]})):[{tag:'p',text:'No stored project images are available.'}]);\\nconst renderWorkspaceSync=(versions,presence)=>{const saved=Array.isArray(versions)?versions.slice(0,20):[],people=Array.isArray(presence)?presence.slice(0,20):[];StillMade.render('workspaceSync',[{tag:'p',text:saved.length?String(saved.length)+' saved revision'+(saved.length===1?'':'s')+' available.':'No saved revisions yet.'},{tag:'ul',children:saved.map((item,index)=>({tag:'li',text:text(item.title||item.label||item.id||'Revision '+String(index+1))+' · '+text(item.createdAt||item.updatedAt||item.date||'Saved')}))},{tag:'p',text:people.length?String(people.length)+' collaborator'+(people.length===1?'':'s')+' active or recently active.':'No collaborator presence available.'},{tag:'ul',children:people.map((item,index)=>({tag:'li',text:text(item.name||item.displayName||item.id||'Collaborator '+String(index+1))+(item.editing?' · editing '+text(item.editing):'' )}))}])};\\nStillMade.onShared(receive);\\nStillMade.onInput(values=>{mediaAssets=(Array.isArray(values.assets)?values.assets:[]).filter(asset=>asset&&asset.kind==='image'&&asset.url).slice(0,50);renderMediaLibrary();source=clone(values.blueprint||{schemaVersion:1});if(!initialized&&!pending&&!queuedBase&&!failed){draft=clone(source);ensure();draftBase=clone(draft);revisions=[clone(draft)];revisionIndex=0;}assistantEdit=values.assistantEdit?clone(values.assistantEdit):null;revision+=1;receive(StillMade.getShared());renderWorkspaceSync(values.versions,values.presence);});\\n\\ndocument.getElementById('prepareShots').addEventListener('click',async()=>{if(busy||locked||pending||queuedBase||rawEditing)return;busy=true;draw();status.textContent='Preparing the exact shot sequence…';try{const result=await StillMade.run({blueprint:source,updatedBlueprint:draft,commit:true});document.getElementById('handoffSummary').textContent=String(result.shotPlan.shots.length)+' shots are ready for a connected Shots or Animated Scene Step.';status.textContent='Shots handoff is ready below. Review Blueprint changes before Apply.'}catch(error){status.textContent=error.message||'The Shots handoff could not be prepared.'}finally{busy=false;draw()}});\\n\\nconst restoreHistory=index=>{if(busy||locked||index<0||index>=revisions.length)return;revisionIndex=index;draft=clone(revisions.find((item,position)=>position===index));changed();draw();status.textContent='Sharing restored Blueprint revision '+String(index+1)+' of '+String(revisions.length)+'.'};document.getElementById('undo').addEventListener('click',()=>restoreHistory(revisionIndex-1));document.getElementById('redo').addEventListener('click',()=>restoreHistory(revisionIndex+1));document.getElementById('lock').addEventListener('click',()=>{if(busy||!canEdit||failed||lockQueued)return;localLocked=!localLocked;const value=localLocked,before=condition(shared.state,'editingLocked');lockQueued=true;draw();StillMade.scheduleSharedEdit('blueprintLock',async()=>{try{await StillMade.updateShared({editingLocked:value},{editingLocked:before});}catch(error){failedEdit(error);throw error;}finally{lockQueued=false;receive(StillMade.getShared());}});});document.getElementById('tidy').addEventListener('click',()=>{if(busy||locked)return;const tidy=value=>typeof value==='string'?value.trim().replace(/\\\\s+/g,' '):value;draft={...draft,title:tidy(draft.title),description:tidy(draft.description),videoType:tidy(draft.videoType),targetLength:tidy(draft.targetLength),tone:tidy(draft.tone),aspectRatio:tidy(draft.aspectRatio),extraInfo:tidy(draft.extraInfo)};ensure();draft.voiceover=draft.voiceover.map((item,index)=>({...item,sceneId:tidy(item.sceneId)||'scene-'+String(index+1),characterSpeaking:tidy(item.characterSpeaking),text:tidy(item.text)}));draft.characters=draft.characters.map((item,index)=>({...item,id:item.id||'character-'+String(index+1),name:tidy(item.name),role:tidy(item.role),physicalDescription:tidy(item.physicalDescription),personality:tidy(item.personality),notes:tidy(item.notes)}));draft.locations=draft.locations.map((item,index)=>({...item,id:item.id||'location-'+String(index+1),name:tidy(item.name),timeOfDay:tidy(item.timeOfDay),visualDescription:tidy(item.visualDescription),atmosphere:tidy(item.atmosphere)}));draft.scenes=draft.scenes.map((scene,index)=>({...scene,id:scene.id||'scene-'+String(index+1),title:tidy(scene.title),whatHappens:tidy(scene.whatHappens),keyVisualMoment:tidy(scene.keyVisualMoment),shotList:scene.shotList.map((shot,shotIndex)=>({...shot,id:shot.id||'scene-'+String(index+1)+'-shot-'+String(shotIndex+1),description:tidy(shot.description),imagePromptReadable:tidy(shot.imagePromptReadable),videoPromptReadable:tidy(shot.videoPromptReadable)}))}));changed();draw();status.textContent='Structure assistant trimmed standard text and filled missing stable IDs. Undo is available.'});\\n\\ndocument.getElementById('applyAssistant').addEventListener('click',()=>{if(busy||locked||!assistantEdit)return;if(assistantEdit.field!=='blueprint'||JSON.stringify(assistantEdit.before)!==JSON.stringify(source)){status.textContent='Assistant proposal is stale or targets another workspace. Request a new proposal from the current Blueprint.';return}draft=clone(assistantEdit.after);changed();draw();status.textContent='Assistant proposal is being shared. Review the fields, then choose Review changes.'});\\n\\nStillMade.onAction(async event=>{if(!event.action.startsWith('library-')||busy||locked)return;const parts=event.action.split(':'),asset=mediaAssets.find((item,index)=>index===Number(parts[1]));if(!asset)return;if(parts[0]==='library-preview'){try{const preview=await StillMade.previewImage(asset),image=document.getElementById('libraryPreview');image.src=preview.url;image.hidden=false;status.textContent='Showing a trusted preview of the exact stored version.'}catch(error){status.textContent=error.message||'Preview unavailable.'}return}if(!Array.isArray(draft.mediaReferences))draft.mediaReferences=[];if(!draft.mediaReferences.some(item=>item.assetId===asset.assetId&&item.versionId===asset.versionId))draft.mediaReferences=[...draft.mediaReferences,clone(asset)];changed();status.textContent='Exact stored media reference added to the Blueprint.'});\\n\"\n}"
416
- },
417
- "lineage": {
418
- "parents": [],
419
- "changes": "Packaged original Block source for StillMade."
420
- }
421
- }
422
- };