{"schemaVersion":1,"id":"recommended.stillmade-short-form-finish","version":"1.0.0","name":"Short-form Finish workflow","description":"An editable production workflow using Short-form Finish v1.0.0.","stages":[{"id":"main","blockId":"stillmade.short-form-finish","version":"1.0.0","label":"Short-form Finish"}],"connections":[],"packages":[{"manifest":{"schemaVersion":1,"sdkVersion":"0.1.0","id":"stillmade.short-form-finish","version":"1.0.0","name":"Short-form Finish","description":"Turn selected source footage and reviewed subtitles into an editable captioned short with original speech and approved copy.","kind":"task","runtime":"javascript","entry":"src/run.js","license":"MIT","inputs":{"assets":{"type":"asset[]","primary":true,"default":[],"required":true,"semantic":"legacy.asset-list.assets","sources":["upstream","user"],"description":"One saved video with measured dimensions and duration."},"music":{"type":"asset[]","default":[],"semantic":"legacy.asset-list.assets","sources":["user"],"description":"Optional licensed audio file covering the full output. Low background level under speech.","required":false},"audioMode":{"type":"text","default":"original","description":"Original sound, or silent footage for a product demonstration only.","semantic":"stillmade.short_form.audiomode","sources":["user","default"],"required":false},"speechVolume":{"type":"number","default":100,"min":25,"max":200,"description":"Original sound volume percent. Review the result for clipping or distortion.","semantic":"stillmade.short_form.speechvolume","sources":["user","default"],"required":false},"purpose":{"type":"text","default":"talking-head","description":"Talking-head, testimonial, or product demonstration.","semantic":"stillmade.short_form.purpose","sources":["user","default"],"required":false},"cuts":{"type":"text","default":"","description":"Optional source selections, one seconds range per line (for example 0-18.5). Blank uses the first 60 seconds. Finish at complete phrase boundaries.","semantic":"stillmade.short_form.cuts","sources":["user","default"],"required":false},"subtitles":{"type":"text","default":"","description":"Reviewed SRT subtitles using ORIGINAL source timestamps. Paste text from a caption file. Transcription is not performed by this Block.","semantic":"stillmade.short_form.subtitles","sources":["user","default"],"required":false},"title":{"type":"text","default":"","description":"Exact approved opening hook, up to 64 characters.","semantic":"stillmade.short_form.title","sources":["user","default"],"required":false},"byline":{"type":"text","default":"","description":"Exact speaker or product label, up to 64 characters.","semantic":"stillmade.short_form.byline","sources":["user","default"],"required":false},"cta":{"type":"text","default":"","description":"Optional approved closing call to action, up to 64 characters.","semantic":"stillmade.short_form.cta","sources":["user","default"],"required":false},"disclosure":{"type":"text","default":"","description":"Optional source credit or demo disclosure, up to 100 characters.","semantic":"stillmade.short_form.disclosure","sources":["user","default"],"required":false},"captionStyle":{"type":"text","default":"Clean","description":"Clean or Emphasis caption treatment.","semantic":"stillmade.short_form.captionstyle","sources":["user","default"],"required":false},"aspect":{"type":"text","default":"9:16","description":"Output frame shape.","semantic":"stillmade.short_form.aspect","sources":["user","default"],"required":false},"fit":{"type":"text","default":"contain","description":"Preserve the whole frame or crop to fill. Review faces after cropping.","semantic":"stillmade.short_form.fit","sources":["user","default"],"required":false},"cropX":{"type":"number","default":0,"min":-100,"max":100,"description":"Manual horizontal framing adjustment in editor preview units.","semantic":"stillmade.short_form.cropx","sources":["user","default"],"required":false},"rightsConfirmed":{"type":"boolean","default":false,"required":true,"sources":["user"],"description":"I have permission to use the source footage and approved statements.","semantic":"stillmade.short_form.rightsconfirmed"}},"outputs":{"timeline":{"type":"timeline","primary":true,"semantic":"legacy.timeline.updatededitor","description":"Editable source cuts, original speech, phrase captions and approved titles."},"review":{"type":"json","semantic":"stillmade.short_form.review","description":"Source selections, caption count and human review requirements.","schema":{"schemaVersion":"integer","state":"string","humanApproved":"boolean","purpose":"string","durationSec":"number","source":{"assetId":"string","versionId":"string"},"cuts":[{"from":"number","to":"number"}],"subtitleCount":"integer","providerCalls":"integer","warnings":"string[]"}}},"permissions":{"project":["asset.read"],"network":[],"filesystem":[],"secrets":[]},"ui":[{"port":"audioMode","control":"select","options":["original","silent"]},{"port":"speechVolume","control":"slider","min":25,"max":200,"step":5},{"port":"purpose","control":"select","options":["talking-head","testimonial","product-demo"]},{"port":"captionStyle","control":"select","options":["Clean","Emphasis"]},{"port":"aspect","control":"select","options":["9:16","1:1","16:9"]},{"port":"fit","control":"select","options":["contain","cover"]},{"port":"cropX","control":"slider","min":-100,"max":100,"step":1}],"platforms":{"phone":{"supported":true},"browser":{"supported":true},"desktop":{"supported":true}},"provenance":{"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) <year> <copyright holders>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and \nassociated documentation files (the \"Software\"), to deal in the Software without restriction, including \nwithout limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell \ncopies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the \nfollowing conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial \nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT \nLIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO \nEVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER \nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE \nUSE OR OTHER DEALINGS IN THE SOFTWARE.\n","portableSources":[{"kind":"original","license":"MIT","paths":["LICENSE","src/run.js"],"evidence":["upstream/0/LICENSE","upstream/0/src/run.js"],"changes":"Original implementation declared by the packager; no reused repository or dependency code."}]},"semantics":[{"name":"stillmade.short_form.audiomode","description":"Original sound, or silent footage for a product demonstration only.","parents":[]},{"name":"stillmade.short_form.speechvolume","description":"Original sound volume percent. Review the result for clipping or distortion.","parents":[]},{"name":"stillmade.short_form.purpose","description":"Talking-head, testimonial, or product demonstration.","parents":[]},{"name":"stillmade.short_form.cuts","description":"Optional source selections, one seconds range per line (for example 0-18.5). Blank uses the first 60 seconds. Finish at complete phrase boundaries.","parents":[]},{"name":"stillmade.short_form.subtitles","description":"Reviewed SRT subtitles using ORIGINAL source timestamps. Paste text from a caption file. Transcription is not performed by this Block.","parents":[]},{"name":"stillmade.short_form.title","description":"Exact approved opening hook, up to 64 characters.","parents":[]},{"name":"stillmade.short_form.byline","description":"Exact speaker or product label, up to 64 characters.","parents":[]},{"name":"stillmade.short_form.cta","description":"Optional approved closing call to action, up to 64 characters.","parents":[]},{"name":"stillmade.short_form.disclosure","description":"Optional source credit or demo disclosure, up to 100 characters.","parents":[]},{"name":"stillmade.short_form.captionstyle","description":"Clean or Emphasis caption treatment.","parents":[]},{"name":"stillmade.short_form.aspect","description":"Output frame shape.","parents":[]},{"name":"stillmade.short_form.fit","description":"Preserve the whole frame or crop to fill. Review faces after cropping.","parents":[]},{"name":"stillmade.short_form.cropx","description":"Manual horizontal framing adjustment in editor preview units.","parents":[]},{"name":"stillmade.short_form.rightsconfirmed","description":"I have permission to use the source footage and approved statements.","parents":[]},{"name":"stillmade.short_form.review","description":"Source selections, caption count and human review requirements.","parents":[]}]},"code":"// Owned, deterministic editing implementation. No I/O, model or host imports.\nconst copy = value => JSON.parse(JSON.stringify(value));\nconst check = (ok, message) => { if (!ok) throw Error(message); };\nconst round = n => Math.round(n * 1000000) / 1000000;\nconst text = (value, name, max = 80) => {\n check(typeof value === 'string' && value.length <= max && !/[\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]/.test(value), name + ' must be short plain text.');\n return value.trim();\n};\nconst assets = input.assets;\ncheck(Array.isArray(assets) && assets.length === 1, 'Choose one original video.');\nconst source = assets[0];\ncheck(source.kind === 'video' && typeof source.assetId === 'string' && source.assetId && typeof source.versionId === 'string' && source.versionId, 'The video needs its exact saved asset and version.');\ncheck(typeof source.url === 'string' && /^(https:\\/\\/|http:\\/\\/(localhost|127\\.0\\.0\\.1)(:\\d+)?\\/|\\/api\\/media\\/|sm-media:|blob:)/.test(source.url) && !/^https?:\\/\\/[^/?#]*@/.test(source.url), 'Use a saved media reference.');\ncheck(Number.isFinite(source.duration) && source.duration > 0 && Number.isFinite(source.width) && source.width > 0 && Number.isFinite(source.height) && source.height > 0, 'Upload the original video again to measure its duration and dimensions.');\ncheck(input.rightsConfirmed === true, 'Confirm permission to use this video and the exact supplied statements.');\nconst purpose = input.purpose || 'talking-head';\ncheck(['talking-head', 'testimonial', 'product-demo'].includes(purpose), 'Choose a supported production job.');\nconst title = text(input.title || '', 'Opening title', 64);\nconst byline = text(input.byline || '', 'Speaker or product label', 64);\nconst cta = text(input.cta || '', 'Closing call to action', 64);\nconst disclosure = text(input.disclosure || '', 'Disclosure', 100);\nconst aspect = input.aspect || '9:16';\ncheck(['9:16','1:1','16:9'].includes(aspect), 'Choose a supported frame shape.');\nconst style = input.captionStyle || 'Clean';\ncheck(['Clean','Emphasis'].includes(style), 'Choose Clean or Emphasis captions.');\nconst fit = input.fit || 'contain';\ncheck(['contain','cover'].includes(fit), 'Choose full frame or crop to fill.');\nconst cropX = input.cropX === undefined ? 0 : input.cropX;\ncheck(Number.isFinite(cropX) && Math.abs(cropX) <= 100, 'Horizontal framing must be from -100 to 100.');\n// Each selected source interval stays in supplied order. We never invent a\n// quote, remove a qualifying word, or silently select a supposedly viral moment.\nconst rawCuts = (input.cuts || '').trim();\ncheck(rawCuts.length <= 1200, 'Use up to 12 source selections.');\nconst cuts = rawCuts ? rawCuts.split(/\\n/).filter(line => line.trim()).map(line => {\n const match = line.trim().match(/^(\\d+(?:\\.\\d+)?)\\s*[-,]\\s*(\\d+(?:\\.\\d+)?)$/);\n check(match, 'Use one source range per line, in seconds: 0-18.5');\n return {from:Number(match[1]),to:Number(match[2])};\n}) : [{from:0,to:Math.min(source.duration,60)}];\ncheck(cuts.length > 0 && cuts.length <= 12, 'Choose 1–12 source selections.');\nfor (const cut of cuts) check(cut.to > cut.from && cut.from >= 0 && cut.to <= source.duration + .02, 'A selected range falls outside the source video.');\nconst duration = round(cuts.reduce((n,c) => n+c.to-c.from,0));\ncheck(duration >= 5 && duration <= 90, 'The finished clip must be 5–90 seconds.');\nconst srt = input.subtitles || '';\ncheck(typeof srt === 'string' && srt.length <= 60000, 'Supply an SRT transcript, up to 60,000 characters.');\nconst time = stamp => { const m = stamp.match(/^(\\d{1,2}):(\\d{2}):(\\d{2})[,.](\\d{3})$/); check(m && +m[2]<60 && +m[3]<60, 'Invalid subtitle timestamp.'); return +m[1]*3600 + +m[2]*60 + +m[3] + +m[4]/1000; };\nlet cues = [];\nif (srt.trim()) cues = srt.replace(/^\\uFEFF/,'').replace(/\\r/g,'').trim().split(/\\n\\s*\\n/).map(chunk => {\n const lines = chunk.split('\\n'); if (/^\\d+$/.test(lines[0].trim())) lines.shift();\n const timing = lines.shift().trim().match(/^(\\S+)\\s+-->\\s+(\\S+)$/);\n check(timing && lines.length, 'Each subtitle needs a start, end and spoken text.');\n const start = time(timing[1]), end = time(timing[2]);\n check(end > start && end <= source.duration+.05, 'Subtitle timing falls outside the source.');\n const value = text(lines.join(' ').replace(/\\s+/g,' '), 'Subtitle', 180);\n check(value && !/<[^>]*>/.test(value), 'Use plain subtitle text without markup.');\n return {start,end,text:value};\n});\ncheck(cues.length <= 500, 'Select a transcript with at most 500 captions.');\nfor(let i=1;i<cues.length;i++) check(cues[i].start >= cues[i-1].end-.02, 'Subtitle cues must be ordered and must not overlap.');\ncheck(purpose === 'product-demo' || cues.length > 0, 'Paste reviewed SRT subtitles for this clip. Automatic transcription is a separate approved service.');\nconst audioMode=input.audioMode||'original';\ncheck(['original','silent'].includes(audioMode), 'Choose original sound or silent footage.');\ncheck(audioMode==='original'||purpose==='product-demo','Keep the original speaker’s voice for captioned speech and customer stories.');\nconst speechVolume=input.speechVolume===undefined?100:input.speechVolume;\ncheck(Number.isFinite(speechVolume)&&speechVolume>=25&&speechVolume<=200,'Source volume must be 25–200 percent. Listen for distortion.');\nconst music=input.music||[];\ncheck(Array.isArray(music)&&music.length<=1,'Choose at most one music file.');\nif(music.length){const m=music[0];check(m.kind==='audio'&&typeof m.assetId==='string'&&m.assetId&&typeof m.versionId==='string'&&m.versionId&&typeof m.url==='string'&&/^(https:\\/\\/|http:\\/\\/(localhost|127\\.0\\.0\\.1)(:\\d+)?\\/|\\/api\\/media\\/|sm-media:|blob:)/.test(m.url)&&!/^https?:\\/\\/[^/?#]*@/.test(m.url)&&Number.isFinite(m.duration)&&m.duration>=duration,'Choose a saved, rights-cleared music file long enough for the full clip.');}\nconst clips=[], audioItems=[], captions=[], overlays=[];\nlet cursor=0;\ncuts.forEach((cut,index)=>{\n const length=round(cut.to-cut.from), id='selection-'+(index+1);\n clips.push({id,kind:'video',trackId:'video',asset:copy(source),assetId:source.assetId,versionId:source.versionId,url:source.url,title:source.name||'Original video',start:round(cursor),duration:length,trimStart:cut.from,speed:1,volume:0,transform:{fit,scale:1,x:cropX,y:0,rotation:0,opacity:1},motion:{type:'none'},transition:{type:'Cut',duration:0}});\n // Dedicated source audio: editing and rendering use the same trimmed interval,\n // and muted visual clips prevent a second embedded copy at normal export.\n if(audioMode==='original')audioItems.push({id:id+'-sound',trackId:'speech',asset:copy(source),assetId:source.assetId,versionId:source.versionId,url:source.url,title:'Original speech',start:round(cursor),duration:length,sourceOffset:cut.from,trimStart:cut.from,volume:speechVolume,rate:1,fadeIn:0,fadeOut:0});\n for (const cue of cues) {\n  const from=Math.max(cut.from,cue.start),to=Math.min(cut.to,cue.end);\n  if(to<=from)continue;\n  // A cut inside a subtitle changes what the words mean. Require reviewed\n  // boundaries rather than show an entire quote over a partial source phrase.\n  check(cue.start >= cut.from-.05 && cue.end <= cut.to+.05, 'A cut splits a subtitle. Move the cut to a phrase boundary or revise the transcript.');\n  captions.push({id:'caption-'+captions.length,trackId:'captions',type:'text',text:cue.text,start:round(cursor+from-cut.from),end:round(cursor+to-cut.from),font:'Hanken Grotesk',size:aspect==='9:16'?15:21,color:style==='Emphasis'?'#F7F0DB':'#FFFFFF',background:'#0A0A0A',backgroundOpacity:75,backgroundPadding:5,backgroundRadius:3,width:.82,x:50,y:76,position:'center',animation:style==='Emphasis'?'pop':'none',animIn:.12,animOut:0});\n }\n cursor += length;\n});\nif(music.length){const m=music[0];audioItems.push({id:'music-bed',trackId:'music',asset:copy(m),assetId:m.assetId,versionId:m.versionId,url:m.url,title:m.name||'Music',start:0,duration,sourceOffset:0,trimStart:0,volume:audioMode==='original'?12:65,rate:1,fadeIn:.3,fadeOut:.8});}\nconst addText=(id,value,start,end,y,size)=>{if(value)overlays.push({id,trackId:'copy',type:'text',text:value,start,end,font:'Hanken Grotesk',size,color:'#F7F0DB',background:'#0A0A0A',backgroundOpacity:80,backgroundPadding:5,width:.82,x:50,y,position:'center',animation:'fade',animIn:.2,animOut:.15});};\naddText('opening',title,0,Math.min(3,duration),16,aspect==='9:16'?16:22);\naddText('byline',byline,0,Math.min(5,duration),90,7);\naddText('cta',cta,Math.max(0,duration-3),duration,17,14);\naddText('disclosure',disclosure,0,duration,95,5.5);\nconst timeline={schemaVersion:1,activeTimelineId:'short-form',name:title||'Captioned clip',aspect,aspectRatio:aspect,previewH:369,backgroundColor:'#0A0A0A',tracks:[{id:'video',type:'video',label:'Source selections'},{id:'speech',type:'audio',label:'Original speech'},{id:'music',type:'audio',label:'Music'},{id:'captions',type:'caption',label:'Reviewed subtitles'},{id:'copy',type:'text',label:'Approved copy'}],trackOrder:['video','speech','music','captions','copy'],clips,audioItems,captions,textOverlays:overlays,stickers:[],effects:[],audio:copy(audioItems),overlays:copy([...captions,...overlays]),targetDuration:duration,exportSettings:{aspect,fps:30,resolution:'1080p',quality:'high'}};\nreturn {timeline,review:{schemaVersion:1,state:'needs-human-review',humanApproved:false,purpose,durationSec:duration,source:{assetId:source.assetId,versionId:source.versionId},cuts:copy(cuts),subtitleCount:captions.length,providerCalls:0,warnings:['Watch and listen to the entire export. Confirm every caption against the actual speech and preserve the speaker’s meaning.',...(fit==='cover'?['Crop-to-fill can hide faces or demonstrations. Review framing at every cut.']:[]),'SRT provides phrase timing. No word-level alignment or automatic transcription is claimed.']}};\n","tests":[{"name":"Preserve original speech and reviewed source captions","input":{"assets":[{"kind":"video","assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","width":1080,"height":1920,"duration":12}],"purpose":"talking-head","cuts":"0-12","subtitles":"1\n00:00:00,000 --> 00:00:04,000\nThis is the original sentence.\n\n2\n00:00:04,000 --> 00:00:12,000\nKeep the complete thought in the clip.","title":"An approved hook","rightsConfirmed":true},"expected":{"timeline":{"schemaVersion":1,"activeTimelineId":"short-form","name":"An approved hook","aspect":"9:16","aspectRatio":"9:16","previewH":369,"backgroundColor":"#0A0A0A","tracks":[{"id":"video","type":"video","label":"Source selections"},{"id":"speech","type":"audio","label":"Original speech"},{"id":"music","type":"audio","label":"Music"},{"id":"captions","type":"caption","label":"Reviewed subtitles"},{"id":"copy","type":"text","label":"Approved copy"}],"trackOrder":["video","speech","music","captions","copy"],"clips":[{"id":"selection-1","kind":"video","trackId":"video","asset":{"kind":"video","assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","width":1080,"height":1920,"duration":12},"assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","title":"Original video","start":0,"duration":12,"trimStart":0,"speed":1,"volume":0,"transform":{"fit":"contain","scale":1,"x":0,"y":0,"rotation":0,"opacity":1},"motion":{"type":"none"},"transition":{"type":"Cut","duration":0}}],"audioItems":[{"id":"selection-1-sound","trackId":"speech","asset":{"kind":"video","assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","width":1080,"height":1920,"duration":12},"assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","title":"Original speech","start":0,"duration":12,"sourceOffset":0,"trimStart":0,"volume":100,"rate":1,"fadeIn":0,"fadeOut":0}],"captions":[{"id":"caption-0","trackId":"captions","type":"text","text":"This is the original sentence.","start":0,"end":4,"font":"Hanken Grotesk","size":15,"color":"#FFFFFF","background":"#0A0A0A","backgroundOpacity":75,"backgroundPadding":5,"backgroundRadius":3,"width":0.82,"x":50,"y":76,"position":"center","animation":"none","animIn":0.12,"animOut":0},{"id":"caption-1","trackId":"captions","type":"text","text":"Keep the complete thought in the clip.","start":4,"end":12,"font":"Hanken Grotesk","size":15,"color":"#FFFFFF","background":"#0A0A0A","backgroundOpacity":75,"backgroundPadding":5,"backgroundRadius":3,"width":0.82,"x":50,"y":76,"position":"center","animation":"none","animIn":0.12,"animOut":0}],"textOverlays":[{"id":"opening","trackId":"copy","type":"text","text":"An approved hook","start":0,"end":3,"font":"Hanken Grotesk","size":16,"color":"#F7F0DB","background":"#0A0A0A","backgroundOpacity":80,"backgroundPadding":5,"width":0.82,"x":50,"y":16,"position":"center","animation":"fade","animIn":0.2,"animOut":0.15}],"stickers":[],"effects":[],"audio":[{"id":"selection-1-sound","trackId":"speech","asset":{"kind":"video","assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","width":1080,"height":1920,"duration":12},"assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","title":"Original speech","start":0,"duration":12,"sourceOffset":0,"trimStart":0,"volume":100,"rate":1,"fadeIn":0,"fadeOut":0}],"overlays":[{"id":"caption-0","trackId":"captions","type":"text","text":"This is the original sentence.","start":0,"end":4,"font":"Hanken Grotesk","size":15,"color":"#FFFFFF","background":"#0A0A0A","backgroundOpacity":75,"backgroundPadding":5,"backgroundRadius":3,"width":0.82,"x":50,"y":76,"position":"center","animation":"none","animIn":0.12,"animOut":0},{"id":"caption-1","trackId":"captions","type":"text","text":"Keep the complete thought in the clip.","start":4,"end":12,"font":"Hanken Grotesk","size":15,"color":"#FFFFFF","background":"#0A0A0A","backgroundOpacity":75,"backgroundPadding":5,"backgroundRadius":3,"width":0.82,"x":50,"y":76,"position":"center","animation":"none","animIn":0.12,"animOut":0},{"id":"opening","trackId":"copy","type":"text","text":"An approved hook","start":0,"end":3,"font":"Hanken Grotesk","size":16,"color":"#F7F0DB","background":"#0A0A0A","backgroundOpacity":80,"backgroundPadding":5,"width":0.82,"x":50,"y":16,"position":"center","animation":"fade","animIn":0.2,"animOut":0.15}],"targetDuration":12,"exportSettings":{"aspect":"9:16","fps":30,"resolution":"1080p","quality":"high"}},"review":{"schemaVersion":1,"state":"needs-human-review","humanApproved":false,"purpose":"talking-head","durationSec":12,"source":{"assetId":"approved-video","versionId":"v1"},"cuts":[{"from":0,"to":12}],"subtitleCount":2,"providerCalls":0,"warnings":["Watch and listen to the entire export. Confirm every caption against the actual speech and preserve the speaker’s meaning.","SRT provides phrase timing. No word-level alignment or automatic transcription is claimed."]}}},{"name":"Rebase selected phrases without changing their words","input":{"assets":[{"kind":"video","assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","width":1080,"height":1920,"duration":12}],"purpose":"talking-head","cuts":"4-12","subtitles":"1\n00:00:00,000 --> 00:00:04,000\nThis is the original sentence.\n\n2\n00:00:04,000 --> 00:00:12,000\nKeep the complete thought in the clip.","title":"An approved hook","rightsConfirmed":true},"expected":{"timeline":{"schemaVersion":1,"activeTimelineId":"short-form","name":"An approved hook","aspect":"9:16","aspectRatio":"9:16","previewH":369,"backgroundColor":"#0A0A0A","tracks":[{"id":"video","type":"video","label":"Source selections"},{"id":"speech","type":"audio","label":"Original speech"},{"id":"music","type":"audio","label":"Music"},{"id":"captions","type":"caption","label":"Reviewed subtitles"},{"id":"copy","type":"text","label":"Approved copy"}],"trackOrder":["video","speech","music","captions","copy"],"clips":[{"id":"selection-1","kind":"video","trackId":"video","asset":{"kind":"video","assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","width":1080,"height":1920,"duration":12},"assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","title":"Original video","start":0,"duration":8,"trimStart":4,"speed":1,"volume":0,"transform":{"fit":"contain","scale":1,"x":0,"y":0,"rotation":0,"opacity":1},"motion":{"type":"none"},"transition":{"type":"Cut","duration":0}}],"audioItems":[{"id":"selection-1-sound","trackId":"speech","asset":{"kind":"video","assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","width":1080,"height":1920,"duration":12},"assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","title":"Original speech","start":0,"duration":8,"sourceOffset":4,"trimStart":4,"volume":100,"rate":1,"fadeIn":0,"fadeOut":0}],"captions":[{"id":"caption-0","trackId":"captions","type":"text","text":"Keep the complete thought in the clip.","start":0,"end":8,"font":"Hanken Grotesk","size":15,"color":"#FFFFFF","background":"#0A0A0A","backgroundOpacity":75,"backgroundPadding":5,"backgroundRadius":3,"width":0.82,"x":50,"y":76,"position":"center","animation":"none","animIn":0.12,"animOut":0}],"textOverlays":[{"id":"opening","trackId":"copy","type":"text","text":"An approved hook","start":0,"end":3,"font":"Hanken Grotesk","size":16,"color":"#F7F0DB","background":"#0A0A0A","backgroundOpacity":80,"backgroundPadding":5,"width":0.82,"x":50,"y":16,"position":"center","animation":"fade","animIn":0.2,"animOut":0.15}],"stickers":[],"effects":[],"audio":[{"id":"selection-1-sound","trackId":"speech","asset":{"kind":"video","assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","width":1080,"height":1920,"duration":12},"assetId":"approved-video","versionId":"v1","url":"https://media.example/approved.mp4","title":"Original speech","start":0,"duration":8,"sourceOffset":4,"trimStart":4,"volume":100,"rate":1,"fadeIn":0,"fadeOut":0}],"overlays":[{"id":"caption-0","trackId":"captions","type":"text","text":"Keep the complete thought in the clip.","start":0,"end":8,"font":"Hanken Grotesk","size":15,"color":"#FFFFFF","background":"#0A0A0A","backgroundOpacity":75,"backgroundPadding":5,"backgroundRadius":3,"width":0.82,"x":50,"y":76,"position":"center","animation":"none","animIn":0.12,"animOut":0},{"id":"opening","trackId":"copy","type":"text","text":"An approved hook","start":0,"end":3,"font":"Hanken Grotesk","size":16,"color":"#F7F0DB","background":"#0A0A0A","backgroundOpacity":80,"backgroundPadding":5,"width":0.82,"x":50,"y":16,"position":"center","animation":"fade","animIn":0.2,"animOut":0.15}],"targetDuration":8,"exportSettings":{"aspect":"9:16","fps":30,"resolution":"1080p","quality":"high"}},"review":{"schemaVersion":1,"state":"needs-human-review","humanApproved":false,"purpose":"talking-head","durationSec":8,"source":{"assetId":"approved-video","versionId":"v1"},"cuts":[{"from":4,"to":12}],"subtitleCount":1,"providerCalls":0,"warnings":["Watch and listen to the entire export. Confirm every caption against the actual speech and preserve the speaker’s meaning.","SRT provides phrase timing. No word-level alignment or automatic transcription is claimed."]}}}],"portable":{"format":"stillmade-block/1","dependencies":[],"sources":[{"kind":"original","license":"MIT","paths":["LICENSE","src/run.js"],"evidence":["upstream/0/LICENSE","upstream/0/src/run.js"],"changes":"Original implementation declared by the packager; no reused repository or dependency code."}],"files":{"upstream/0/LICENSE":"MIT License\n\nCopyright (c) <year> <copyright holders>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and \nassociated documentation files (the \"Software\"), to deal in the Software without restriction, including \nwithout limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell \ncopies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the \nfollowing conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial \nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT \nLIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO \nEVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER \nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE \nUSE OR OTHER DEALINGS IN THE SOFTWARE.\n","upstream/0/src/run.js":"// Owned, deterministic editing implementation. No I/O, model or host imports.\nconst copy = value => JSON.parse(JSON.stringify(value));\nconst check = (ok, message) => { if (!ok) throw Error(message); };\nconst round = n => Math.round(n * 1000000) / 1000000;\nconst text = (value, name, max = 80) => {\n check(typeof value === 'string' && value.length <= max && !/[\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]/.test(value), name + ' must be short plain text.');\n return value.trim();\n};\nconst assets = input.assets;\ncheck(Array.isArray(assets) && assets.length === 1, 'Choose one original video.');\nconst source = assets[0];\ncheck(source.kind === 'video' && typeof source.assetId === 'string' && source.assetId && typeof source.versionId === 'string' && source.versionId, 'The video needs its exact saved asset and version.');\ncheck(typeof source.url === 'string' && /^(https:\\/\\/|http:\\/\\/(localhost|127\\.0\\.0\\.1)(:\\d+)?\\/|\\/api\\/media\\/|sm-media:|blob:)/.test(source.url) && !/^https?:\\/\\/[^/?#]*@/.test(source.url), 'Use a saved media reference.');\ncheck(Number.isFinite(source.duration) && source.duration > 0 && Number.isFinite(source.width) && source.width > 0 && Number.isFinite(source.height) && source.height > 0, 'Upload the original video again to measure its duration and dimensions.');\ncheck(input.rightsConfirmed === true, 'Confirm permission to use this video and the exact supplied statements.');\nconst purpose = input.purpose || 'talking-head';\ncheck(['talking-head', 'testimonial', 'product-demo'].includes(purpose), 'Choose a supported production job.');\nconst title = text(input.title || '', 'Opening title', 64);\nconst byline = text(input.byline || '', 'Speaker or product label', 64);\nconst cta = text(input.cta || '', 'Closing call to action', 64);\nconst disclosure = text(input.disclosure || '', 'Disclosure', 100);\nconst aspect = input.aspect || '9:16';\ncheck(['9:16','1:1','16:9'].includes(aspect), 'Choose a supported frame shape.');\nconst style = input.captionStyle || 'Clean';\ncheck(['Clean','Emphasis'].includes(style), 'Choose Clean or Emphasis captions.');\nconst fit = input.fit || 'contain';\ncheck(['contain','cover'].includes(fit), 'Choose full frame or crop to fill.');\nconst cropX = input.cropX === undefined ? 0 : input.cropX;\ncheck(Number.isFinite(cropX) && Math.abs(cropX) <= 100, 'Horizontal framing must be from -100 to 100.');\n// Each selected source interval stays in supplied order. We never invent a\n// quote, remove a qualifying word, or silently select a supposedly viral moment.\nconst rawCuts = (input.cuts || '').trim();\ncheck(rawCuts.length <= 1200, 'Use up to 12 source selections.');\nconst cuts = rawCuts ? rawCuts.split(/\\n/).filter(line => line.trim()).map(line => {\n const match = line.trim().match(/^(\\d+(?:\\.\\d+)?)\\s*[-,]\\s*(\\d+(?:\\.\\d+)?)$/);\n check(match, 'Use one source range per line, in seconds: 0-18.5');\n return {from:Number(match[1]),to:Number(match[2])};\n}) : [{from:0,to:Math.min(source.duration,60)}];\ncheck(cuts.length > 0 && cuts.length <= 12, 'Choose 1–12 source selections.');\nfor (const cut of cuts) check(cut.to > cut.from && cut.from >= 0 && cut.to <= source.duration + .02, 'A selected range falls outside the source video.');\nconst duration = round(cuts.reduce((n,c) => n+c.to-c.from,0));\ncheck(duration >= 5 && duration <= 90, 'The finished clip must be 5–90 seconds.');\nconst srt = input.subtitles || '';\ncheck(typeof srt === 'string' && srt.length <= 60000, 'Supply an SRT transcript, up to 60,000 characters.');\nconst time = stamp => { const m = stamp.match(/^(\\d{1,2}):(\\d{2}):(\\d{2})[,.](\\d{3})$/); check(m && +m[2]<60 && +m[3]<60, 'Invalid subtitle timestamp.'); return +m[1]*3600 + +m[2]*60 + +m[3] + +m[4]/1000; };\nlet cues = [];\nif (srt.trim()) cues = srt.replace(/^\\uFEFF/,'').replace(/\\r/g,'').trim().split(/\\n\\s*\\n/).map(chunk => {\n const lines = chunk.split('\\n'); if (/^\\d+$/.test(lines[0].trim())) lines.shift();\n const timing = lines.shift().trim().match(/^(\\S+)\\s+-->\\s+(\\S+)$/);\n check(timing && lines.length, 'Each subtitle needs a start, end and spoken text.');\n const start = time(timing[1]), end = time(timing[2]);\n check(end > start && end <= source.duration+.05, 'Subtitle timing falls outside the source.');\n const value = text(lines.join(' ').replace(/\\s+/g,' '), 'Subtitle', 180);\n check(value && !/<[^>]*>/.test(value), 'Use plain subtitle text without markup.');\n return {start,end,text:value};\n});\ncheck(cues.length <= 500, 'Select a transcript with at most 500 captions.');\nfor(let i=1;i<cues.length;i++) check(cues[i].start >= cues[i-1].end-.02, 'Subtitle cues must be ordered and must not overlap.');\ncheck(purpose === 'product-demo' || cues.length > 0, 'Paste reviewed SRT subtitles for this clip. Automatic transcription is a separate approved service.');\nconst audioMode=input.audioMode||'original';\ncheck(['original','silent'].includes(audioMode), 'Choose original sound or silent footage.');\ncheck(audioMode==='original'||purpose==='product-demo','Keep the original speaker’s voice for captioned speech and customer stories.');\nconst speechVolume=input.speechVolume===undefined?100:input.speechVolume;\ncheck(Number.isFinite(speechVolume)&&speechVolume>=25&&speechVolume<=200,'Source volume must be 25–200 percent. Listen for distortion.');\nconst music=input.music||[];\ncheck(Array.isArray(music)&&music.length<=1,'Choose at most one music file.');\nif(music.length){const m=music[0];check(m.kind==='audio'&&typeof m.assetId==='string'&&m.assetId&&typeof m.versionId==='string'&&m.versionId&&typeof m.url==='string'&&/^(https:\\/\\/|http:\\/\\/(localhost|127\\.0\\.0\\.1)(:\\d+)?\\/|\\/api\\/media\\/|sm-media:|blob:)/.test(m.url)&&!/^https?:\\/\\/[^/?#]*@/.test(m.url)&&Number.isFinite(m.duration)&&m.duration>=duration,'Choose a saved, rights-cleared music file long enough for the full clip.');}\nconst clips=[], audioItems=[], captions=[], overlays=[];\nlet cursor=0;\ncuts.forEach((cut,index)=>{\n const length=round(cut.to-cut.from), id='selection-'+(index+1);\n clips.push({id,kind:'video',trackId:'video',asset:copy(source),assetId:source.assetId,versionId:source.versionId,url:source.url,title:source.name||'Original video',start:round(cursor),duration:length,trimStart:cut.from,speed:1,volume:0,transform:{fit,scale:1,x:cropX,y:0,rotation:0,opacity:1},motion:{type:'none'},transition:{type:'Cut',duration:0}});\n // Dedicated source audio: editing and rendering use the same trimmed interval,\n // and muted visual clips prevent a second embedded copy at normal export.\n if(audioMode==='original')audioItems.push({id:id+'-sound',trackId:'speech',asset:copy(source),assetId:source.assetId,versionId:source.versionId,url:source.url,title:'Original speech',start:round(cursor),duration:length,sourceOffset:cut.from,trimStart:cut.from,volume:speechVolume,rate:1,fadeIn:0,fadeOut:0});\n for (const cue of cues) {\n  const from=Math.max(cut.from,cue.start),to=Math.min(cut.to,cue.end);\n  if(to<=from)continue;\n  // A cut inside a subtitle changes what the words mean. Require reviewed\n  // boundaries rather than show an entire quote over a partial source phrase.\n  check(cue.start >= cut.from-.05 && cue.end <= cut.to+.05, 'A cut splits a subtitle. Move the cut to a phrase boundary or revise the transcript.');\n  captions.push({id:'caption-'+captions.length,trackId:'captions',type:'text',text:cue.text,start:round(cursor+from-cut.from),end:round(cursor+to-cut.from),font:'Hanken Grotesk',size:aspect==='9:16'?15:21,color:style==='Emphasis'?'#F7F0DB':'#FFFFFF',background:'#0A0A0A',backgroundOpacity:75,backgroundPadding:5,backgroundRadius:3,width:.82,x:50,y:76,position:'center',animation:style==='Emphasis'?'pop':'none',animIn:.12,animOut:0});\n }\n cursor += length;\n});\nif(music.length){const m=music[0];audioItems.push({id:'music-bed',trackId:'music',asset:copy(m),assetId:m.assetId,versionId:m.versionId,url:m.url,title:m.name||'Music',start:0,duration,sourceOffset:0,trimStart:0,volume:audioMode==='original'?12:65,rate:1,fadeIn:.3,fadeOut:.8});}\nconst addText=(id,value,start,end,y,size)=>{if(value)overlays.push({id,trackId:'copy',type:'text',text:value,start,end,font:'Hanken Grotesk',size,color:'#F7F0DB',background:'#0A0A0A',backgroundOpacity:80,backgroundPadding:5,width:.82,x:50,y,position:'center',animation:'fade',animIn:.2,animOut:.15});};\naddText('opening',title,0,Math.min(3,duration),16,aspect==='9:16'?16:22);\naddText('byline',byline,0,Math.min(5,duration),90,7);\naddText('cta',cta,Math.max(0,duration-3),duration,17,14);\naddText('disclosure',disclosure,0,duration,95,5.5);\nconst timeline={schemaVersion:1,activeTimelineId:'short-form',name:title||'Captioned clip',aspect,aspectRatio:aspect,previewH:369,backgroundColor:'#0A0A0A',tracks:[{id:'video',type:'video',label:'Source selections'},{id:'speech',type:'audio',label:'Original speech'},{id:'music',type:'audio',label:'Music'},{id:'captions',type:'caption',label:'Reviewed subtitles'},{id:'copy',type:'text',label:'Approved copy'}],trackOrder:['video','speech','music','captions','copy'],clips,audioItems,captions,textOverlays:overlays,stickers:[],effects:[],audio:copy(audioItems),overlays:copy([...captions,...overlays]),targetDuration:duration,exportSettings:{aspect,fps:30,resolution:'1080p',quality:'high'}};\nreturn {timeline,review:{schemaVersion:1,state:'needs-human-review',humanApproved:false,purpose,durationSec:duration,source:{assetId:source.assetId,versionId:source.versionId},cuts:copy(cuts),subtitleCount:captions.length,providerCalls:0,warnings:['Watch and listen to the entire export. Confirm every caption against the actual speech and preserve the speaker’s meaning.',...(fit==='cover'?['Crop-to-fill can hide faces or demonstrations. Review framing at every cut.']:[]),'SRT provides phrase timing. No word-level alignment or automatic transcription is claimed.']}};\n"},"lineage":{"parents":[],"changes":"Packaged original Block source for StillMade."}}}],"license":"MIT"}