stillmade-sdk 0.1.3 → 0.1.5
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.
- package/.claude/settings.json +15 -0
- package/.cursor/hooks.json +11 -0
- package/.gitignore +2 -0
- package/.stillmade/sdk-baseline.json +65 -0
- package/AGENTS.md +29 -7
- package/AGENT_CONTROL.md +2 -1
- package/BROWSER_APPLICATIONS.md +128 -3
- package/GITHUB_APPLICATIONS.md +184 -1
- package/NATIVE_APPLICATION_ADAPTATION.md +565 -0
- package/NATIVE_MCP.md +3 -2
- package/PASTE_TO_LLM.md +29 -10
- package/PORTABLE.md +5 -4
- package/REMIX.md +16 -10
- package/SDK.md +511 -46
- package/UI_AESTHETIC.md +37 -6
- package/api-index.json +90 -0
- package/blocks/connected-app/versions/{1.2.0 → 1.5.0}/task-selection.js +5 -3
- package/blocks/connected-app/versions/{1.4.0 → 1.5.0}/view.js +4 -2
- package/blocks/native/sm.ai-decide/versions/1.0.0/package.js +149 -0
- package/blocks/native/sm.ai-write/versions/1.0.0/package.js +147 -0
- package/blocks/native/sm.connect-app/versions/1.0.0/package.js +55 -0
- package/blocks/native/sm.contact-fields/versions/1.0.0/package.js +197 -0
- package/blocks/native/sm.continue-if/versions/1.0.0/package.js +168 -0
- package/blocks/native/sm.generate-image/versions/2.1.0/package.js +101 -0
- package/blocks/native/sm.meta-creative/versions/1.0.0/package.js +206 -0
- package/blocks/native/sm.new-items/versions/1.0.0/package.js +191 -0
- package/blocks/native/sm.voiceover/versions/2.1.5/package.js +179 -0
- package/blocks/native/sm.voiceover/versions/2.1.6/package.js +179 -0
- package/blocks/native/sm.when/versions/1.0.0/package.js +129 -0
- package/blocks/native/sm.write-summary/versions/1.0.0/package.js +133 -0
- package/blocks/occasion-story/package.js +1 -1
- package/blocks/occasion-story/versions/1.0.2/package.js +1682 -0
- package/blocks/photo-reel-composer/versions/1.0.1/package.js +3026 -0
- package/blocks/release-visuals/package.js +1 -1
- package/blocks/release-visuals/versions/1.0.2/package.js +1500 -0
- package/blocks/short-form-finish/package.js +1 -1
- package/blocks/short-form-finish/versions/1.0.3/package.js +1026 -0
- package/examples/original-photo-editor.stillmade-block +0 -0
- package/examples/portable-regexp.stillmade-block +0 -0
- package/package.json +1 -1
- package/packages/block-cli/cli.js +16 -1
- package/packages/block-cli/format.js +2 -0
- package/packages/block-cli/ready-gate.js +164 -0
- package/packages/block-platform/block-readiness.js +3 -2
- package/packages/block-platform/canvas.js +1 -1
- package/packages/block-platform/catalog.js +6 -4
- package/packages/block-platform/chat-requirements.js +8 -3
- package/packages/block-platform/collaboration.js +5 -5
- package/packages/block-platform/first-revenue-project-types.js +2 -2
- package/packages/block-platform/flow-inspection.js +2 -2
- package/packages/block-platform/native-application-validation-context.js +20 -0
- package/packages/block-platform/plain-descriptions.js +67 -0
- package/packages/block-platform/product-ad-variants-project-type.js +6 -3
- package/packages/block-platform/project-context.js +4 -4
- package/packages/block-platform/project-type-composer.js +21 -12
- package/packages/block-platform/project-type-draft.js +2 -2
- package/packages/block-platform/project-type-recommendations.js +1 -1
- package/packages/block-platform/project-types.js +9 -4
- package/packages/block-platform/revenue-review-project-types.js +6 -5
- package/packages/block-platform/segment-runner.js +35 -11
- package/packages/block-platform/step-groups.js +78 -0
- package/packages/block-platform/steps.js +12 -8
- package/packages/block-platform/type-workspace.js +4 -4
- package/packages/block-platform/workflow-loop.js +4 -0
- package/packages/block-platform/workspace-input-readset.js +18 -4
- package/packages/block-sdk/admission.js +5 -17
- package/packages/block-sdk/agent-inputs.js +2 -0
- package/packages/block-sdk/agent-inspection.js +4 -2
- package/packages/block-sdk/browser-application-artifacts.js +1 -1
- package/packages/block-sdk/browser-application-execution.d.ts +2 -2
- package/packages/block-sdk/browser-application-execution.js +30 -12
- package/packages/block-sdk/browser-application-guest.d.ts +2 -0
- package/packages/block-sdk/browser-application-guest.js +16 -9
- package/packages/block-sdk/browser-application.d.ts +12 -4
- package/packages/block-sdk/browser-application.js +27 -13
- package/packages/block-sdk/builder-contract.js +25 -17
- package/packages/block-sdk/capabilities.js +38 -19
- package/packages/block-sdk/connected-app.js +26 -6
- package/packages/block-sdk/connection-adapters.js +19 -2
- package/packages/block-sdk/contracts-core.js +8 -0
- package/packages/block-sdk/contracts.js +9 -5
- package/packages/block-sdk/document-drafts.js +7 -1
- package/packages/block-sdk/document-store-binding.js +2 -1
- package/packages/block-sdk/file-bundle.js +4 -1
- package/packages/block-sdk/first-party-packages.js +18 -2
- package/packages/block-sdk/generation-catalog.js +3 -2
- package/packages/block-sdk/index.d.ts +20 -1
- package/packages/block-sdk/index.js +1 -0
- package/packages/block-sdk/native-application-package.d.ts +22 -0
- package/packages/block-sdk/native-application-package.js +77 -0
- package/packages/block-sdk/native_adapter.py +76 -0
- package/packages/block-sdk/package.json +1 -0
- package/packages/block-sdk/pipeline-runtime-host.d.ts +2 -0
- package/packages/block-sdk/project-flow-contract.js +2 -0
- package/packages/block-sdk/remix-policy.js +3 -1
- package/packages/block-sdk/resolver-admission.js +17 -0
- package/packages/block-sdk/runtime.js +4 -1
- package/packages/block-sdk/schema-fields.js +34 -2
- package/packages/block-sdk/semantic-relationships.js +14 -0
- package/packages/block-sdk/shared-controls.js +3 -1
- package/packages/block-sdk/shared-view.js +6 -1
- package/packages/block-sdk/source-rights.js +6 -5
- package/packages/block-sdk/testing.js +3 -0
- package/packages/design-system/theme.css +12 -3
|
@@ -0,0 +1,206 @@
|
|
|
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.meta-creative",
|
|
7
|
+
"version": "1.0.0",
|
|
8
|
+
"name": "Meta ad creative",
|
|
9
|
+
"description": "Turn an image uploaded to Meta Ads and your ad copy into the creative details Meta needs to create an ad creative: image, primary text, link, button and Facebook Page.",
|
|
10
|
+
"kind": "task",
|
|
11
|
+
"runtime": "javascript",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"provenance": {
|
|
14
|
+
"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\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",
|
|
15
|
+
"portableSources": [
|
|
16
|
+
{
|
|
17
|
+
"kind": "original",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"paths": [
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"src/run.js"
|
|
22
|
+
],
|
|
23
|
+
"evidence": [
|
|
24
|
+
"upstream/0/LICENSE",
|
|
25
|
+
"upstream/0/src/run.js"
|
|
26
|
+
],
|
|
27
|
+
"changes": "Original implementation declared by the packager; no reused repository or dependency code."
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"inputs": {
|
|
32
|
+
"upload": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"primary": true,
|
|
35
|
+
"semantic": "external_data",
|
|
36
|
+
"schema": "object",
|
|
37
|
+
"required": true,
|
|
38
|
+
"description": "The result of Meta Ads · Upload ad image, which contains the image hash."
|
|
39
|
+
},
|
|
40
|
+
"message": {
|
|
41
|
+
"type": "text",
|
|
42
|
+
"semantic": "ad_primary_text",
|
|
43
|
+
"required": true,
|
|
44
|
+
"description": "The primary text people see above the image."
|
|
45
|
+
},
|
|
46
|
+
"website_url": {
|
|
47
|
+
"type": "text",
|
|
48
|
+
"semantic": "ad_destination_url",
|
|
49
|
+
"required": true,
|
|
50
|
+
"description": "Where the ad sends people."
|
|
51
|
+
},
|
|
52
|
+
"page_id": {
|
|
53
|
+
"type": "text",
|
|
54
|
+
"semantic": "facebook_page_id",
|
|
55
|
+
"required": true,
|
|
56
|
+
"description": "The Facebook Page that runs the ad."
|
|
57
|
+
},
|
|
58
|
+
"call_to_action": {
|
|
59
|
+
"type": "text",
|
|
60
|
+
"semantic": "ad_call_to_action",
|
|
61
|
+
"required": false,
|
|
62
|
+
"default": "LEARN_MORE",
|
|
63
|
+
"description": "The button on the ad."
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"outputs": {
|
|
67
|
+
"creative": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"primary": true,
|
|
70
|
+
"semantic": "meta_ad_creative",
|
|
71
|
+
"schema": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"message": "string",
|
|
74
|
+
"page_id": "string",
|
|
75
|
+
"image_hash": "string",
|
|
76
|
+
"website_url": "string",
|
|
77
|
+
"call_to_action": "string",
|
|
78
|
+
"video_id": "string?",
|
|
79
|
+
"image_url": "string?",
|
|
80
|
+
"carousel_cards": "json?",
|
|
81
|
+
"destination_type": "string?"
|
|
82
|
+
},
|
|
83
|
+
"description": "Creative details for Meta Ads · Create ad creative."
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"permissions": {
|
|
87
|
+
"project": []
|
|
88
|
+
},
|
|
89
|
+
"ui": [
|
|
90
|
+
{
|
|
91
|
+
"port": "upload",
|
|
92
|
+
"control": "text"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"port": "message",
|
|
96
|
+
"control": "text"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"port": "website_url",
|
|
100
|
+
"control": "text"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"port": "page_id",
|
|
104
|
+
"control": "text"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"port": "call_to_action",
|
|
108
|
+
"control": "select",
|
|
109
|
+
"options": [
|
|
110
|
+
"LEARN_MORE",
|
|
111
|
+
"SHOP_NOW",
|
|
112
|
+
"SIGN_UP",
|
|
113
|
+
"BOOK_NOW",
|
|
114
|
+
"CONTACT_US",
|
|
115
|
+
"GET_OFFER",
|
|
116
|
+
"DOWNLOAD",
|
|
117
|
+
"NO_BUTTON"
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
"code": "// Meta returns {images: {<file name>: {hash, url}}}; some tools wrap it in data.\nconst findHash = (value, depth) => {\n if (!value || typeof value !== 'object' || depth > 5) return '';\n if (typeof value.hash === 'string' && value.hash) return value.hash;\n if (typeof value.image_hash === 'string' && value.image_hash) return value.image_hash;\n for (const key of Object.keys(value)) { const found = findHash(value[key], depth + 1); if (found) return found; }\n return '';\n};\nconst hash = findHash(input.upload, 0);\nif (!hash) throw new Error('The upload result has no image hash. Upload the image to Meta Ads first.');\nreturn { creative: { type: 'IMAGE', message: input.message.trim(), page_id: input.page_id.trim(), image_hash: hash, website_url: input.website_url.trim(), call_to_action: input.call_to_action || 'LEARN_MORE' } };\n",
|
|
123
|
+
"tests": [
|
|
124
|
+
{
|
|
125
|
+
"name": "Builds an image creative from the upload",
|
|
126
|
+
"input": {
|
|
127
|
+
"upload": {
|
|
128
|
+
"images": {
|
|
129
|
+
"ad.png": {
|
|
130
|
+
"hash": "abc123",
|
|
131
|
+
"url": "https://example.com/ad.png"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"message": "New linen shirts are in.",
|
|
136
|
+
"website_url": "https://example.com/shirts",
|
|
137
|
+
"page_id": "1234",
|
|
138
|
+
"call_to_action": "SHOP_NOW"
|
|
139
|
+
},
|
|
140
|
+
"expected": {
|
|
141
|
+
"creative": {
|
|
142
|
+
"type": "IMAGE",
|
|
143
|
+
"message": "New linen shirts are in.",
|
|
144
|
+
"page_id": "1234",
|
|
145
|
+
"image_hash": "abc123",
|
|
146
|
+
"website_url": "https://example.com/shirts",
|
|
147
|
+
"call_to_action": "SHOP_NOW"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"name": "Finds the hash inside a wrapped result and defaults the button",
|
|
153
|
+
"input": {
|
|
154
|
+
"upload": {
|
|
155
|
+
"data": {
|
|
156
|
+
"images": {
|
|
157
|
+
"x.png": {
|
|
158
|
+
"hash": "zz9"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"message": " Book a call ",
|
|
164
|
+
"website_url": "https://example.com",
|
|
165
|
+
"page_id": "55"
|
|
166
|
+
},
|
|
167
|
+
"expected": {
|
|
168
|
+
"creative": {
|
|
169
|
+
"type": "IMAGE",
|
|
170
|
+
"message": "Book a call",
|
|
171
|
+
"page_id": "55",
|
|
172
|
+
"image_hash": "zz9",
|
|
173
|
+
"website_url": "https://example.com",
|
|
174
|
+
"call_to_action": "LEARN_MORE"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"portable": {
|
|
180
|
+
"format": "stillmade-block/1",
|
|
181
|
+
"dependencies": [],
|
|
182
|
+
"sources": [
|
|
183
|
+
{
|
|
184
|
+
"kind": "original",
|
|
185
|
+
"license": "MIT",
|
|
186
|
+
"paths": [
|
|
187
|
+
"LICENSE",
|
|
188
|
+
"src/run.js"
|
|
189
|
+
],
|
|
190
|
+
"evidence": [
|
|
191
|
+
"upstream/0/LICENSE",
|
|
192
|
+
"upstream/0/src/run.js"
|
|
193
|
+
],
|
|
194
|
+
"changes": "Original implementation declared by the packager; no reused repository or dependency code."
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"files": {
|
|
198
|
+
"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",
|
|
199
|
+
"upstream/0/src/run.js": "// Meta returns {images: {<file name>: {hash, url}}}; some tools wrap it in data.\nconst findHash = (value, depth) => {\n if (!value || typeof value !== 'object' || depth > 5) return '';\n if (typeof value.hash === 'string' && value.hash) return value.hash;\n if (typeof value.image_hash === 'string' && value.image_hash) return value.image_hash;\n for (const key of Object.keys(value)) { const found = findHash(value[key], depth + 1); if (found) return found; }\n return '';\n};\nconst hash = findHash(input.upload, 0);\nif (!hash) throw new Error('The upload result has no image hash. Upload the image to Meta Ads first.');\nreturn { creative: { type: 'IMAGE', message: input.message.trim(), page_id: input.page_id.trim(), image_hash: hash, website_url: input.website_url.trim(), call_to_action: input.call_to_action || 'LEARN_MORE' } };\n"
|
|
200
|
+
},
|
|
201
|
+
"lineage": {
|
|
202
|
+
"parents": [],
|
|
203
|
+
"changes": "Packaged original Block source for StillMade."
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
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.new-items",
|
|
7
|
+
"version": "1.0.0",
|
|
8
|
+
"name": "Only new items",
|
|
9
|
+
"description": "Pass on one item an app returned that this automation has not handled yet, such as a new lead, order or message. It remembers what it has already passed on, so the same item is never handled twice; when nothing is new, the run stops here.",
|
|
10
|
+
"kind": "task",
|
|
11
|
+
"runtime": "javascript",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"provenance": {
|
|
14
|
+
"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\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",
|
|
15
|
+
"portableSources": [
|
|
16
|
+
{
|
|
17
|
+
"kind": "original",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"paths": [
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"src/run.js"
|
|
22
|
+
],
|
|
23
|
+
"evidence": [
|
|
24
|
+
"upstream/0/LICENSE",
|
|
25
|
+
"upstream/0/src/run.js"
|
|
26
|
+
],
|
|
27
|
+
"changes": "Original implementation declared by the packager; no reused repository or dependency code."
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"inputs": {
|
|
32
|
+
"items": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"primary": true,
|
|
35
|
+
"semantic": "external_data",
|
|
36
|
+
"required": true,
|
|
37
|
+
"description": "An app's result that contains a list, for example Meta Ads leads or Shopify orders.",
|
|
38
|
+
"schema": "object"
|
|
39
|
+
},
|
|
40
|
+
"id_field": {
|
|
41
|
+
"type": "text",
|
|
42
|
+
"default": "id",
|
|
43
|
+
"required": false,
|
|
44
|
+
"description": "The field that identifies each item. Most apps use id.",
|
|
45
|
+
"semantic": "item_id_field"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"outputs": {
|
|
49
|
+
"item": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"primary": true,
|
|
52
|
+
"semantic": "external_data",
|
|
53
|
+
"required": false,
|
|
54
|
+
"description": "The oldest item not handled yet. Missing when there is nothing new.",
|
|
55
|
+
"schema": "object"
|
|
56
|
+
},
|
|
57
|
+
"waiting": {
|
|
58
|
+
"type": "integer",
|
|
59
|
+
"required": false,
|
|
60
|
+
"description": "How many more new items are waiting for the next runs.",
|
|
61
|
+
"semantic": "pending_item_count"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"permissions": {
|
|
65
|
+
"project": [
|
|
66
|
+
"state.step"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"state": {
|
|
70
|
+
"scope": "step",
|
|
71
|
+
"version": 1,
|
|
72
|
+
"initial": {
|
|
73
|
+
"seen": []
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"ui": [
|
|
77
|
+
{
|
|
78
|
+
"port": "items",
|
|
79
|
+
"control": "text"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"port": "id_field",
|
|
83
|
+
"control": "text"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"code": "const findList = (value, depth) => {\n if (Array.isArray(value)) return value;\n if (!value || typeof value !== 'object' || depth > 3) return null;\n for (const key of ['data', 'items', 'results', 'records', 'leads', 'orders', 'messages', 'rows', 'value']) {\n const found = findList(value[key], depth + 1);\n if (found) return found;\n }\n for (const key of Object.keys(value)) {\n if (Array.isArray(value[key])) return value[key];\n }\n for (const key of Object.keys(value)) {\n const found = findList(value[key], depth + 1);\n if (found) return found;\n }\n return null;\n};\nconst field = (input.id_field || 'id').trim() || 'id';\nconst list = (findList(input.items, 0) || []).filter(item => item && typeof item === 'object' && !Array.isArray(item));\nconst keyOf = item => item[field] === undefined || item[field] === null ? JSON.stringify(item) : String(item[field]);\nconst seen = new Set(state.seen);\n// Apps usually list newest first; handle the oldest new item first.\nconst fresh = list.filter(item => !seen.has(keyOf(item))).reverse();\nif (!fresh.length) return {};\nstate.seen = [...state.seen, keyOf(fresh[0])].slice(-2000);\nreturn { item: fresh[0], waiting: fresh.length - 1 };\n",
|
|
88
|
+
"tests": [
|
|
89
|
+
{
|
|
90
|
+
"name": "Passes the oldest new lead",
|
|
91
|
+
"input": {
|
|
92
|
+
"items": {
|
|
93
|
+
"data": [
|
|
94
|
+
{
|
|
95
|
+
"id": "3",
|
|
96
|
+
"name": "Cara"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": "2",
|
|
100
|
+
"name": "Ben"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "1",
|
|
104
|
+
"name": "Ana"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"state": {
|
|
110
|
+
"version": 1,
|
|
111
|
+
"value": {
|
|
112
|
+
"seen": [
|
|
113
|
+
"1"
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"expected": {
|
|
118
|
+
"item": {
|
|
119
|
+
"id": "2",
|
|
120
|
+
"name": "Ben"
|
|
121
|
+
},
|
|
122
|
+
"waiting": 1
|
|
123
|
+
},
|
|
124
|
+
"expectedState": {
|
|
125
|
+
"version": 1,
|
|
126
|
+
"value": {
|
|
127
|
+
"seen": [
|
|
128
|
+
"1",
|
|
129
|
+
"2"
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "Stops when nothing is new",
|
|
136
|
+
"input": {
|
|
137
|
+
"items": {
|
|
138
|
+
"data": [
|
|
139
|
+
{
|
|
140
|
+
"id": "1"
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"state": {
|
|
146
|
+
"version": 1,
|
|
147
|
+
"value": {
|
|
148
|
+
"seen": [
|
|
149
|
+
"1"
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"expected": {},
|
|
154
|
+
"expectedState": {
|
|
155
|
+
"version": 1,
|
|
156
|
+
"value": {
|
|
157
|
+
"seen": [
|
|
158
|
+
"1"
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
"portable": {
|
|
165
|
+
"format": "stillmade-block/1",
|
|
166
|
+
"dependencies": [],
|
|
167
|
+
"sources": [
|
|
168
|
+
{
|
|
169
|
+
"kind": "original",
|
|
170
|
+
"license": "MIT",
|
|
171
|
+
"paths": [
|
|
172
|
+
"LICENSE",
|
|
173
|
+
"src/run.js"
|
|
174
|
+
],
|
|
175
|
+
"evidence": [
|
|
176
|
+
"upstream/0/LICENSE",
|
|
177
|
+
"upstream/0/src/run.js"
|
|
178
|
+
],
|
|
179
|
+
"changes": "Original implementation declared by the packager; no reused repository or dependency code."
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"files": {
|
|
183
|
+
"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",
|
|
184
|
+
"upstream/0/src/run.js": "const findList = (value, depth) => {\n if (Array.isArray(value)) return value;\n if (!value || typeof value !== 'object' || depth > 3) return null;\n for (const key of ['data', 'items', 'results', 'records', 'leads', 'orders', 'messages', 'rows', 'value']) {\n const found = findList(value[key], depth + 1);\n if (found) return found;\n }\n for (const key of Object.keys(value)) {\n if (Array.isArray(value[key])) return value[key];\n }\n for (const key of Object.keys(value)) {\n const found = findList(value[key], depth + 1);\n if (found) return found;\n }\n return null;\n};\nconst field = (input.id_field || 'id').trim() || 'id';\nconst list = (findList(input.items, 0) || []).filter(item => item && typeof item === 'object' && !Array.isArray(item));\nconst keyOf = item => item[field] === undefined || item[field] === null ? JSON.stringify(item) : String(item[field]);\nconst seen = new Set(state.seen);\n// Apps usually list newest first; handle the oldest new item first.\nconst fresh = list.filter(item => !seen.has(keyOf(item))).reverse();\nif (!fresh.length) return {};\nstate.seen = [...state.seen, keyOf(fresh[0])].slice(-2000);\nreturn { item: fresh[0], waiting: fresh.length - 1 };\n"
|
|
185
|
+
},
|
|
186
|
+
"lineage": {
|
|
187
|
+
"parents": [],
|
|
188
|
+
"changes": "Packaged original Block source for StillMade."
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// Generated immutable package data.
|
|
2
|
+
export default {
|
|
3
|
+
"manifest": {
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"sdkVersion": "0.1.0",
|
|
6
|
+
"id": "sm.voiceover",
|
|
7
|
+
"version": "2.1.5",
|
|
8
|
+
"name": "Voiceover",
|
|
9
|
+
"description": "Turn your words into a spoken voiceover. Hear each voice first, then play or download the audio.",
|
|
10
|
+
"kind": "workspace",
|
|
11
|
+
"runtime": "capability",
|
|
12
|
+
"entry": "src/capability.json",
|
|
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/capability.json, 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/capability.json",
|
|
23
|
+
"src/view.json"
|
|
24
|
+
],
|
|
25
|
+
"evidence": [
|
|
26
|
+
"upstream/0/LICENSE",
|
|
27
|
+
"upstream/0/src/capability.json",
|
|
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
|
+
"input": {
|
|
36
|
+
"type": "script",
|
|
37
|
+
"primary": true,
|
|
38
|
+
"role": "narration_script",
|
|
39
|
+
"description": "The words the voice says.",
|
|
40
|
+
"semantic": "narration_script",
|
|
41
|
+
"required": false
|
|
42
|
+
},
|
|
43
|
+
"take": {
|
|
44
|
+
"type": "audio",
|
|
45
|
+
"required": false,
|
|
46
|
+
"description": "Your own recording or audio file, used instead of a generated voice.",
|
|
47
|
+
"semantic": "narration_audio"
|
|
48
|
+
},
|
|
49
|
+
"library": {
|
|
50
|
+
"type": "asset[]",
|
|
51
|
+
"context": "assets",
|
|
52
|
+
"required": false,
|
|
53
|
+
"description": "Audio saved in this project.",
|
|
54
|
+
"semantic": "project_media"
|
|
55
|
+
},
|
|
56
|
+
"timing": {
|
|
57
|
+
"type": "transcript",
|
|
58
|
+
"context": "transcript",
|
|
59
|
+
"required": false,
|
|
60
|
+
"description": "Word timings for this project, when it has them.",
|
|
61
|
+
"semantic": "timed_transcript"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"outputs": {
|
|
65
|
+
"output": {
|
|
66
|
+
"type": "audio",
|
|
67
|
+
"primary": true,
|
|
68
|
+
"role": "narration_audio",
|
|
69
|
+
"description": "The voiceover audio.",
|
|
70
|
+
"semantic": "narration_audio"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"permissions": {
|
|
74
|
+
"project": [
|
|
75
|
+
"context.assets.read",
|
|
76
|
+
"context.transcript.read",
|
|
77
|
+
"asset.read"
|
|
78
|
+
],
|
|
79
|
+
"capabilities": [
|
|
80
|
+
"audio.speech"
|
|
81
|
+
],
|
|
82
|
+
"network": [],
|
|
83
|
+
"filesystem": [],
|
|
84
|
+
"secrets": [],
|
|
85
|
+
"desktop": [
|
|
86
|
+
"microphone.capture"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"ui": [
|
|
90
|
+
{
|
|
91
|
+
"port": "input",
|
|
92
|
+
"control": "text"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"capability": {
|
|
97
|
+
"schemaVersion": 1,
|
|
98
|
+
"operation": "audio.speech",
|
|
99
|
+
"text": {
|
|
100
|
+
"$input": "input"
|
|
101
|
+
},
|
|
102
|
+
"output": "output"
|
|
103
|
+
},
|
|
104
|
+
"view": {
|
|
105
|
+
"html": "<main class=\"voiceover\">\n <header class=\"voiceover-heading\"><div><h1>Voiceover</h1><p>Write what the voice should say, generate it, then play or download it.</p></div><output id=\"length\">0 words · about 0:00</output></header>\n <section class=\"voiceover-layout\">\n <div class=\"script-panel\">\n <label for=\"script\">What the voice says</label>\n <textarea id=\"script\" rows=\"8\" maxlength=\"3800\" placeholder=\"Type or paste the words to speak…\"></textarea>\n <div class=\"script-meta\"><span id=\"characters\">0 / 3,800 characters</span><button id=\"restore\" type=\"button\" disabled>Reset text</button></div>\n <button id=\"generate\" data-stillmade-action=\"run\" type=\"button\" class=\"primary\" disabled>Generate voiceover</button>\n <p class=\"note\">You see the voice and the cost before anything is generated.</p>\n <details class=\"source-card\"><summary>Use your own audio instead</summary><p>Upload a file above this panel, then use it here. Recording needs the StillMade desktop app.</p><div class=\"button-row\"><button id=\"use-import\" type=\"button\" disabled>Use uploaded audio</button><button id=\"start-record\" type=\"button\">Record with microphone</button><button id=\"stop-record\" type=\"button\" disabled>Stop and use recording</button><button id=\"cancel-record\" type=\"button\" disabled>Cancel</button></div></details>\n <section class=\"source-card\" id=\"library-card\" hidden><h2>Audio in this project</h2><div id=\"library\"><p>No audio saved in this project yet.</p></div></section>\n <section class=\"source-card\" id=\"timing-card\" hidden><h2>Word timing</h2><p id=\"timing\">This project has no word timings yet.</p></section>\n </div>\n <aside class=\"take-panel\" aria-label=\"Your voiceover\">\n <h2>Your voiceover</h2><div class=\"take-empty\" id=\"take-empty\"><strong>Nothing yet</strong><p>Generate it, or use your own audio.</p></div>\n <div class=\"take-ready\" id=\"take-ready\" hidden><audio id=\"audio\" controls></audio><dl><div><dt>From</dt><dd id=\"source\">—</dd></div><div><dt>Length</dt><dd id=\"duration\">—</dd></div></dl><p>Download it from the Result below.</p></div>\n <p id=\"status\" role=\"status\" aria-live=\"polite\">Write what the voice should say to begin.</p>\n </aside>\n </section>\n</main>\n",
|
|
106
|
+
"css": ".voiceover{box-sizing:border-box;min-height:100%;padding:24px;color:var(--fg);background:var(--bg);font-family:var(--font-body)}.voiceover-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:24px;border-bottom:1px solid var(--border-tok);padding-bottom:18px}.voiceover h1{margin:3px 0 8px;font-family:var(--font-display);font-size:38px;font-style:italic;font-weight:200}.voiceover h2{margin:0 0 6px;font-size:16px}.voiceover p{color:var(--fg-muted);line-height:1.5}.voiceover small{display:block;color:var(--fg-subtle);font-size:12px}.voiceover output{color:var(--fg-subtle);font-size:12px}.voiceover-layout{display:grid;grid-template-columns:minmax(320px,1.4fr) minmax(250px,.8fr);gap:28px}.voiceover label{display:block;margin:0 0 8px;font-size:13px;font-weight:650}.voiceover textarea{box-sizing:border-box;width:100%;resize:vertical;padding:14px;border:1px solid var(--border-tok);border-radius:var(--r-3);color:var(--fg);background:var(--bg-elev-1);font:inherit;line-height:1.65}.voiceover button{min-height:44px;padding:10px 16px;border:1px solid var(--border-strong);border-radius:999px;color:var(--fg);background:var(--bg);font:inherit;cursor:pointer}.voiceover button:disabled{opacity:.45;cursor:default}.voiceover .primary{width:100%;margin-top:18px;color:var(--bg);background:var(--fg)}.voiceover button:focus-visible,.voiceover textarea:focus-visible,.voiceover audio:focus-visible{outline:2px solid var(--signal);outline-offset:2px}.script-meta,.button-row,.library-row{display:flex;align-items:center;gap:10px}.script-meta{justify-content:space-between;margin-top:8px;color:var(--fg-subtle);font-size:12px}.script-meta button{padding:6px 12px}.note{margin:9px 0;font-size:12px}.source-card{margin-top:16px;padding:14px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}.source-card p{margin:4px 0 10px;font-size:12px}.source-card summary{min-height:24px;font-size:14px;font-weight:600;cursor:pointer}.source-card[hidden]{display:none}.take-panel h2{margin:0}.button-row{flex-wrap:wrap}.library-row{justify-content:space-between;padding:9px 0;border-top:1px solid var(--divider)}.library-row div{min-width:0}.library-row strong{display:block}.take-panel{min-width:0;padding:18px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}.take-empty{margin-top:28px;padding:22px 0;text-align:center}.take-ready{margin-top:20px}.take-ready audio{width:100%}.take-ready dl{display:grid;gap:8px;margin:18px 0}.take-ready dl div{display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid var(--divider);padding-bottom:8px}.take-ready dt{color:var(--fg-muted)}.take-ready dd{margin:0;text-align:right}#status{min-height:24px;margin:20px 0 0}@media(max-width:720px){.voiceover{padding:16px}.voiceover-heading{align-items:flex-start;flex-direction:column}.voiceover-layout{grid-template-columns:minmax(0,1fr);gap:18px}}@media(max-width:430px){.button-row{display:grid;grid-template-columns:1fr}.button-row button{width:100%}}\n",
|
|
107
|
+
"javascript": "const script=document.getElementById('script');\nconst generate=document.getElementById('generate');\nconst restore=document.getElementById('restore');\nconst status=document.getElementById('status');\nconst length=document.getElementById('length');\nconst characters=document.getElementById('characters');\nconst takeEmpty=document.getElementById('take-empty');\nconst takeReady=document.getElementById('take-ready');\nconst audio=document.getElementById('audio');\nconst duration=document.getElementById('duration');\nconst source=document.getElementById('source');\nconst useImport=document.getElementById('use-import');\nconst startRecord=document.getElementById('start-record');\nconst stopRecord=document.getElementById('stop-record');\nconst cancelRecord=document.getElementById('cancel-record');\nconst timing=document.getElementById('timing');\nconst timingCard=document.getElementById('timing-card');\nconst libraryCard=document.getElementById('library-card');\nlet canEdit=false;let previewTask=null;let takeKey='';let takeRevision=0;\nStillMade.bindShared('script','script');\nlet connected='';let busy=false;let revision=0;let imported=null;let library=[];let previewUrl='';let recording=false;\nconst scriptText=value=>value&&typeof value.text==='string'?value.text:'';\nconst clock=seconds=>{const total=Math.max(0,Math.round(Number(seconds)||0));return String(Math.floor(total/60))+':'+String(total%60).padStart(2,'0');};\nconst update=()=>{const text=script.value;const words=text.trim()?text.trim().split(/\\s+/).length:0;characters.textContent=String(text.length)+' / 3,800 characters';length.textContent=String(words)+(words===1?' word':' words')+' · about '+clock(words/2.5);generate.disabled=busy||!canEdit||!text.trim()||text.length>3800;restore.disabled=busy||!canEdit||text===connected;useImport.disabled=busy||!canEdit||!imported;startRecord.disabled=busy||!canEdit||recording;stopRecord.disabled=busy||!canEdit||!recording;cancelRecord.disabled=busy||!recording;};\nconst clearTake=()=>{\n if(previewUrl)StillMade.releaseMedia(previewUrl);\n previewUrl='';audio.removeAttribute('src');takeReady.hidden=true;takeEmpty.hidden=false;\n source.textContent='—';duration.textContent='—';\n};\nconst showTake=async(take,started,previous)=>{\n try{\n if(previous)await previous;\n if(started!==takeRevision||!take)return;\n const preview=await StillMade.previewMedia(take);\n if(started!==takeRevision){StillMade.releaseMedia(preview.url);return;}\n clearTake();previewUrl=preview.url;audio.src=preview.url;\n source.textContent=take.label||'Generated voiceover';\n duration.textContent=take.duration?clock(take.duration):'Saved audio';\n takeEmpty.hidden=true;takeReady.hidden=false;\n }catch(error){if(started===takeRevision)status.textContent=error.message||'This audio could not be played here.';}\n};\nconst syncTake=take=>{\n const next=take&&take.kind==='audio'&&typeof take.url==='string'?take:null;\n const key=JSON.stringify(next);if(key===takeKey)return;\n takeKey=key;takeRevision+=1;clearTake();previewTask=showTake(next,takeRevision,previewTask);\n};\nconst choose=async(take,label)=>{if(busy||!canEdit)return;busy=true;update();status.textContent='Saving your choice…';try{const result=await StillMade.useOutput({output:take});if(StillMade.getShared().localOnly)syncTake(result.output);status.textContent='Done. This audio is now the Step’s result.';}catch(error){status.textContent=error.message||'That audio could not be used.';}finally{busy=false;update();}};\nconst renderLibrary=()=>{libraryCard.hidden=!library.length;StillMade.render('library',library.length?library.map((take,index)=>({tag:'article',className:'library-row',children:[{tag:'div',children:[{tag:'strong',text:take.label||'Saved audio '+String(index+1)},{tag:'small',text:'Saved in this project'}]},{tag:'button',action:'library:'+String(index),text:'Use this',disabled:busy||!canEdit}]})):[{tag:'p',text:'No audio saved in this project yet.'}]);};\nStillMade.onAction(event=>{if(!canEdit||!event.action.startsWith('library:'))return;const index=Number(event.action.split(':')[1]);const take=library.find((item,position)=>position===index);if(take&&!busy)choose(take,take.label||'Project library');});\nStillMade.onInput(values=>{connected=scriptText(values.input);revision+=1;StillMade.setSharedDefaults({script:connected});imported=values.take&&values.take.kind==='audio'?values.take:null;library=Array.isArray(values.library)?values.library.filter(item=>item&&item.kind==='audio').slice(0,40):[];const words=values.timing&&Array.isArray(values.timing.words)?values.timing.words:[];timingCard.hidden=!words.length;timing.textContent=words.length?String(words.length)+' timed words · '+clock(words.at(-1).endMs/1000)+' total':'This project has no word timings yet.';renderLibrary();status.textContent=script.value.trim()?'Ready to generate.':'Write what the voice should say to begin.';update();});\nscript.addEventListener('input',update);\nrestore.addEventListener('click',async()=>{if(busy||!canEdit)return;try{await StillMade.updateShared({script:connected});status.textContent=connected?'Text reset.':'There is no earlier text to go back to.';}catch(error){status.textContent=error.message;}update();});\nuseImport.addEventListener('click',()=>{if(imported&&!busy)choose(imported,'Imported audio');});\nstartRecord.addEventListener('click',async()=>{if(busy||!canEdit||recording)return;busy=true;update();try{await StillMade.desktop('record.start',{kind:'microphone'});recording=true;status.textContent='Recording. Press Stop when you are done.';}catch(error){status.textContent=error.message;}finally{busy=false;update();}});\nstopRecord.addEventListener('click',async()=>{if(busy||!canEdit||!recording)return;busy=true;update();try{const saved=await StillMade.desktop('record.stop');recording=false;busy=false;await choose(saved.asset,'Microphone recording');}catch(error){status.textContent=error.message;busy=false;update();}});\ncancelRecord.addEventListener('click',async()=>{if(busy||!recording)return;busy=true;update();try{await StillMade.desktop('record.cancel');recording=false;status.textContent='Recording cancelled.';}catch(error){status.textContent=error.message;}finally{busy=false;update();}});\ngenerate.addEventListener('click',async()=>{if(busy||!canEdit)return;const text=script.value.trim();if(!text){status.textContent='Write what the voice should say first.';return;}if(text.length>3800){status.textContent='Shorten the text to 3,800 characters first.';return;}const started=revision;busy=true;update();status.textContent='Check the voice and cost to continue.';try{const result=await StillMade.run({input:{schemaVersion:1,text}});const take=result.output;if(!take||take.kind!=='audio'||typeof take.url!=='string')throw Error('No audio came back.');if(StillMade.getShared().localOnly)syncTake(take);status.textContent=started===revision?'Your voiceover is ready. Play it here, or download it from the Result below.':'Your voiceover is ready. It uses the text from when you pressed Generate.';}catch(error){status.textContent=error.message||'The voiceover could not be generated.';}finally{busy=false;update();}});\nStillMade.onShared(shared=>{canEdit=shared.canEdit;syncTake(shared.outputs.output);update();renderLibrary();});\nupdate();\n"
|
|
108
|
+
},
|
|
109
|
+
"tests": [
|
|
110
|
+
{
|
|
111
|
+
"name": "Short narration",
|
|
112
|
+
"input": {
|
|
113
|
+
"input": {
|
|
114
|
+
"schemaVersion": 1,
|
|
115
|
+
"text": "The lighthouse kept watch as the storm crossed the bay."
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"expectations": {
|
|
119
|
+
"output": {
|
|
120
|
+
"kind": "audio",
|
|
121
|
+
"format": "wav",
|
|
122
|
+
"minDuration": 0.1,
|
|
123
|
+
"maxDuration": 30,
|
|
124
|
+
"minBytes": 46,
|
|
125
|
+
"maxBytes": 1500000
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "Maximum practical narration",
|
|
131
|
+
"input": {
|
|
132
|
+
"input": {
|
|
133
|
+
"schemaVersion": 1,
|
|
134
|
+
"text": "Morning arrived quietly. By noon, the town square was full of music. The narration remains reviewed, bounded, and ready for a replacement take."
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"expectations": {
|
|
138
|
+
"output": {
|
|
139
|
+
"kind": "audio",
|
|
140
|
+
"format": "wav",
|
|
141
|
+
"minDuration": 0.1,
|
|
142
|
+
"maxDuration": 45,
|
|
143
|
+
"minBytes": 46,
|
|
144
|
+
"maxBytes": 2200000
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"portable": {
|
|
150
|
+
"format": "stillmade-block/1",
|
|
151
|
+
"dependencies": [],
|
|
152
|
+
"sources": [
|
|
153
|
+
{
|
|
154
|
+
"kind": "original",
|
|
155
|
+
"license": "MIT",
|
|
156
|
+
"paths": [
|
|
157
|
+
"LICENSE",
|
|
158
|
+
"src/capability.json",
|
|
159
|
+
"src/view.json"
|
|
160
|
+
],
|
|
161
|
+
"evidence": [
|
|
162
|
+
"upstream/0/LICENSE",
|
|
163
|
+
"upstream/0/src/capability.json",
|
|
164
|
+
"upstream/0/src/view.json"
|
|
165
|
+
],
|
|
166
|
+
"changes": "Original implementation declared by the packager; no reused repository or dependency code."
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
"files": {
|
|
170
|
+
"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",
|
|
171
|
+
"upstream/0/src/capability.json": "{\n \"schemaVersion\": 1,\n \"operation\": \"audio.speech\",\n \"text\": {\n \"$input\": \"input\"\n },\n \"output\": \"output\"\n}",
|
|
172
|
+
"upstream/0/src/view.json": "{\n \"html\": \"<main class=\\\"voiceover\\\">\\n <header class=\\\"voiceover-heading\\\"><div><h1>Voiceover</h1><p>Write what the voice should say, generate it, then play or download it.</p></div><output id=\\\"length\\\">0 words · about 0:00</output></header>\\n <section class=\\\"voiceover-layout\\\">\\n <div class=\\\"script-panel\\\">\\n <label for=\\\"script\\\">What the voice says</label>\\n <textarea id=\\\"script\\\" rows=\\\"8\\\" maxlength=\\\"3800\\\" placeholder=\\\"Type or paste the words to speak…\\\"></textarea>\\n <div class=\\\"script-meta\\\"><span id=\\\"characters\\\">0 / 3,800 characters</span><button id=\\\"restore\\\" type=\\\"button\\\" disabled>Reset text</button></div>\\n <button id=\\\"generate\\\" data-stillmade-action=\\\"run\\\" type=\\\"button\\\" class=\\\"primary\\\" disabled>Generate voiceover</button>\\n <p class=\\\"note\\\">You see the voice and the cost before anything is generated.</p>\\n <details class=\\\"source-card\\\"><summary>Use your own audio instead</summary><p>Upload a file above this panel, then use it here. Recording needs the StillMade desktop app.</p><div class=\\\"button-row\\\"><button id=\\\"use-import\\\" type=\\\"button\\\" disabled>Use uploaded audio</button><button id=\\\"start-record\\\" type=\\\"button\\\">Record with microphone</button><button id=\\\"stop-record\\\" type=\\\"button\\\" disabled>Stop and use recording</button><button id=\\\"cancel-record\\\" type=\\\"button\\\" disabled>Cancel</button></div></details>\\n <section class=\\\"source-card\\\" id=\\\"library-card\\\" hidden><h2>Audio in this project</h2><div id=\\\"library\\\"><p>No audio saved in this project yet.</p></div></section>\\n <section class=\\\"source-card\\\" id=\\\"timing-card\\\" hidden><h2>Word timing</h2><p id=\\\"timing\\\">This project has no word timings yet.</p></section>\\n </div>\\n <aside class=\\\"take-panel\\\" aria-label=\\\"Your voiceover\\\">\\n <h2>Your voiceover</h2><div class=\\\"take-empty\\\" id=\\\"take-empty\\\"><strong>Nothing yet</strong><p>Generate it, or use your own audio.</p></div>\\n <div class=\\\"take-ready\\\" id=\\\"take-ready\\\" hidden><audio id=\\\"audio\\\" controls></audio><dl><div><dt>From</dt><dd id=\\\"source\\\">—</dd></div><div><dt>Length</dt><dd id=\\\"duration\\\">—</dd></div></dl><p>Download it from the Result below.</p></div>\\n <p id=\\\"status\\\" role=\\\"status\\\" aria-live=\\\"polite\\\">Write what the voice should say to begin.</p>\\n </aside>\\n </section>\\n</main>\\n\",\n \"css\": \".voiceover{box-sizing:border-box;min-height:100%;padding:24px;color:var(--fg);background:var(--bg);font-family:var(--font-body)}.voiceover-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:24px;border-bottom:1px solid var(--border-tok);padding-bottom:18px}.voiceover h1{margin:3px 0 8px;font-family:var(--font-display);font-size:38px;font-style:italic;font-weight:200}.voiceover h2{margin:0 0 6px;font-size:16px}.voiceover p{color:var(--fg-muted);line-height:1.5}.voiceover small{display:block;color:var(--fg-subtle);font-size:12px}.voiceover output{color:var(--fg-subtle);font-size:12px}.voiceover-layout{display:grid;grid-template-columns:minmax(320px,1.4fr) minmax(250px,.8fr);gap:28px}.voiceover label{display:block;margin:0 0 8px;font-size:13px;font-weight:650}.voiceover textarea{box-sizing:border-box;width:100%;resize:vertical;padding:14px;border:1px solid var(--border-tok);border-radius:var(--r-3);color:var(--fg);background:var(--bg-elev-1);font:inherit;line-height:1.65}.voiceover button{min-height:44px;padding:10px 16px;border:1px solid var(--border-strong);border-radius:999px;color:var(--fg);background:var(--bg);font:inherit;cursor:pointer}.voiceover button:disabled{opacity:.45;cursor:default}.voiceover .primary{width:100%;margin-top:18px;color:var(--bg);background:var(--fg)}.voiceover button:focus-visible,.voiceover textarea:focus-visible,.voiceover audio:focus-visible{outline:2px solid var(--signal);outline-offset:2px}.script-meta,.button-row,.library-row{display:flex;align-items:center;gap:10px}.script-meta{justify-content:space-between;margin-top:8px;color:var(--fg-subtle);font-size:12px}.script-meta button{padding:6px 12px}.note{margin:9px 0;font-size:12px}.source-card{margin-top:16px;padding:14px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}.source-card p{margin:4px 0 10px;font-size:12px}.source-card summary{min-height:24px;font-size:14px;font-weight:600;cursor:pointer}.source-card[hidden]{display:none}.take-panel h2{margin:0}.button-row{flex-wrap:wrap}.library-row{justify-content:space-between;padding:9px 0;border-top:1px solid var(--divider)}.library-row div{min-width:0}.library-row strong{display:block}.take-panel{min-width:0;padding:18px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}.take-empty{margin-top:28px;padding:22px 0;text-align:center}.take-ready{margin-top:20px}.take-ready audio{width:100%}.take-ready dl{display:grid;gap:8px;margin:18px 0}.take-ready dl div{display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid var(--divider);padding-bottom:8px}.take-ready dt{color:var(--fg-muted)}.take-ready dd{margin:0;text-align:right}#status{min-height:24px;margin:20px 0 0}@media(max-width:720px){.voiceover{padding:16px}.voiceover-heading{align-items:flex-start;flex-direction:column}.voiceover-layout{grid-template-columns:minmax(0,1fr);gap:18px}}@media(max-width:430px){.button-row{display:grid;grid-template-columns:1fr}.button-row button{width:100%}}\\n\",\n \"javascript\": \"const script=document.getElementById('script');\\nconst generate=document.getElementById('generate');\\nconst restore=document.getElementById('restore');\\nconst status=document.getElementById('status');\\nconst length=document.getElementById('length');\\nconst characters=document.getElementById('characters');\\nconst takeEmpty=document.getElementById('take-empty');\\nconst takeReady=document.getElementById('take-ready');\\nconst audio=document.getElementById('audio');\\nconst duration=document.getElementById('duration');\\nconst source=document.getElementById('source');\\nconst useImport=document.getElementById('use-import');\\nconst startRecord=document.getElementById('start-record');\\nconst stopRecord=document.getElementById('stop-record');\\nconst cancelRecord=document.getElementById('cancel-record');\\nconst timing=document.getElementById('timing');\\nconst timingCard=document.getElementById('timing-card');\\nconst libraryCard=document.getElementById('library-card');\\nlet canEdit=false;let previewTask=null;let takeKey='';let takeRevision=0;\\nStillMade.bindShared('script','script');\\nlet connected='';let busy=false;let revision=0;let imported=null;let library=[];let previewUrl='';let recording=false;\\nconst scriptText=value=>value&&typeof value.text==='string'?value.text:'';\\nconst clock=seconds=>{const total=Math.max(0,Math.round(Number(seconds)||0));return String(Math.floor(total/60))+':'+String(total%60).padStart(2,'0');};\\nconst update=()=>{const text=script.value;const words=text.trim()?text.trim().split(/\\\\s+/).length:0;characters.textContent=String(text.length)+' / 3,800 characters';length.textContent=String(words)+(words===1?' word':' words')+' · about '+clock(words/2.5);generate.disabled=busy||!canEdit||!text.trim()||text.length>3800;restore.disabled=busy||!canEdit||text===connected;useImport.disabled=busy||!canEdit||!imported;startRecord.disabled=busy||!canEdit||recording;stopRecord.disabled=busy||!canEdit||!recording;cancelRecord.disabled=busy||!recording;};\\nconst clearTake=()=>{\\n if(previewUrl)StillMade.releaseMedia(previewUrl);\\n previewUrl='';audio.removeAttribute('src');takeReady.hidden=true;takeEmpty.hidden=false;\\n source.textContent='—';duration.textContent='—';\\n};\\nconst showTake=async(take,started,previous)=>{\\n try{\\n if(previous)await previous;\\n if(started!==takeRevision||!take)return;\\n const preview=await StillMade.previewMedia(take);\\n if(started!==takeRevision){StillMade.releaseMedia(preview.url);return;}\\n clearTake();previewUrl=preview.url;audio.src=preview.url;\\n source.textContent=take.label||'Generated voiceover';\\n duration.textContent=take.duration?clock(take.duration):'Saved audio';\\n takeEmpty.hidden=true;takeReady.hidden=false;\\n }catch(error){if(started===takeRevision)status.textContent=error.message||'This audio could not be played here.';}\\n};\\nconst syncTake=take=>{\\n const next=take&&take.kind==='audio'&&typeof take.url==='string'?take:null;\\n const key=JSON.stringify(next);if(key===takeKey)return;\\n takeKey=key;takeRevision+=1;clearTake();previewTask=showTake(next,takeRevision,previewTask);\\n};\\nconst choose=async(take,label)=>{if(busy||!canEdit)return;busy=true;update();status.textContent='Saving your choice…';try{const result=await StillMade.useOutput({output:take});if(StillMade.getShared().localOnly)syncTake(result.output);status.textContent='Done. This audio is now the Step’s result.';}catch(error){status.textContent=error.message||'That audio could not be used.';}finally{busy=false;update();}};\\nconst renderLibrary=()=>{libraryCard.hidden=!library.length;StillMade.render('library',library.length?library.map((take,index)=>({tag:'article',className:'library-row',children:[{tag:'div',children:[{tag:'strong',text:take.label||'Saved audio '+String(index+1)},{tag:'small',text:'Saved in this project'}]},{tag:'button',action:'library:'+String(index),text:'Use this',disabled:busy||!canEdit}]})):[{tag:'p',text:'No audio saved in this project yet.'}]);};\\nStillMade.onAction(event=>{if(!canEdit||!event.action.startsWith('library:'))return;const index=Number(event.action.split(':')[1]);const take=library.find((item,position)=>position===index);if(take&&!busy)choose(take,take.label||'Project library');});\\nStillMade.onInput(values=>{connected=scriptText(values.input);revision+=1;StillMade.setSharedDefaults({script:connected});imported=values.take&&values.take.kind==='audio'?values.take:null;library=Array.isArray(values.library)?values.library.filter(item=>item&&item.kind==='audio').slice(0,40):[];const words=values.timing&&Array.isArray(values.timing.words)?values.timing.words:[];timingCard.hidden=!words.length;timing.textContent=words.length?String(words.length)+' timed words · '+clock(words.at(-1).endMs/1000)+' total':'This project has no word timings yet.';renderLibrary();status.textContent=script.value.trim()?'Ready to generate.':'Write what the voice should say to begin.';update();});\\nscript.addEventListener('input',update);\\nrestore.addEventListener('click',async()=>{if(busy||!canEdit)return;try{await StillMade.updateShared({script:connected});status.textContent=connected?'Text reset.':'There is no earlier text to go back to.';}catch(error){status.textContent=error.message;}update();});\\nuseImport.addEventListener('click',()=>{if(imported&&!busy)choose(imported,'Imported audio');});\\nstartRecord.addEventListener('click',async()=>{if(busy||!canEdit||recording)return;busy=true;update();try{await StillMade.desktop('record.start',{kind:'microphone'});recording=true;status.textContent='Recording. Press Stop when you are done.';}catch(error){status.textContent=error.message;}finally{busy=false;update();}});\\nstopRecord.addEventListener('click',async()=>{if(busy||!canEdit||!recording)return;busy=true;update();try{const saved=await StillMade.desktop('record.stop');recording=false;busy=false;await choose(saved.asset,'Microphone recording');}catch(error){status.textContent=error.message;busy=false;update();}});\\ncancelRecord.addEventListener('click',async()=>{if(busy||!recording)return;busy=true;update();try{await StillMade.desktop('record.cancel');recording=false;status.textContent='Recording cancelled.';}catch(error){status.textContent=error.message;}finally{busy=false;update();}});\\ngenerate.addEventListener('click',async()=>{if(busy||!canEdit)return;const text=script.value.trim();if(!text){status.textContent='Write what the voice should say first.';return;}if(text.length>3800){status.textContent='Shorten the text to 3,800 characters first.';return;}const started=revision;busy=true;update();status.textContent='Check the voice and cost to continue.';try{const result=await StillMade.run({input:{schemaVersion:1,text}});const take=result.output;if(!take||take.kind!=='audio'||typeof take.url!=='string')throw Error('No audio came back.');if(StillMade.getShared().localOnly)syncTake(take);status.textContent=started===revision?'Your voiceover is ready. Play it here, or download it from the Result below.':'Your voiceover is ready. It uses the text from when you pressed Generate.';}catch(error){status.textContent=error.message||'The voiceover could not be generated.';}finally{busy=false;update();}});\\nStillMade.onShared(shared=>{canEdit=shared.canEdit;syncTake(shared.outputs.output);update();renderLibrary();});\\nupdate();\\n\"\n}"
|
|
173
|
+
},
|
|
174
|
+
"lineage": {
|
|
175
|
+
"parents": [],
|
|
176
|
+
"changes": "Packaged original Block source for StillMade."
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|