@lalalic/markcut 3.2.46 → 3.2.48

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/README.md CHANGED
@@ -390,3 +390,21 @@ then supply `--itt`, `--vtt` and `--agent` (or `MARKCUT_ITT_CLI`,
390
390
  `MARKCUT_VTT_CLI` and `MARKCUT_AGENT_CLI`). See `markcut vision --help`
391
391
  and `markcut --show-clis` for the supported placeholders. Markcut does not
392
392
  choose or manage a browser/model provider.
393
+
394
+ ### Independent preview and mobile delivery
395
+
396
+ `markcut.preview` compiles immutable video revisions and exposes the player.
397
+ The MCP compiler itself does **not** send APNs notifications, manage Relay
398
+ Invocations, or change Task state. Through Neo MCP, Neo's Federation Wrapper
399
+ binds an optional Relay execution, watches compilation, and delivers the review
400
+ through Neo.app Core's loopback-only `POST /mobile/review/notify` REST API.
401
+
402
+ The terminal command `markcut preview video.md --delivery event --event-template
403
+ /path/event.json` compiles the same immutable revision, then sends its request
404
+ to that same Neo.app Core REST endpoint. Exit status is nonzero if Neo Core does
405
+ not confirm durable Inbox storage; a `review_requested` receipt confirms only
406
+ Inbox acceptance, not the person's decision. `--delivery text` similarly
407
+ mirrors a view-only mobile preview when no ChatGPT thread is bound. Neither
408
+ path embeds an APNs key or creates its own notification provider. Standalone
409
+ Markcut compilation without human-review delivery does not require Neo Mobile
410
+ or Agents Relay.
package/bin/markcut CHANGED
@@ -6,16 +6,25 @@ import { fileURLToPath } from "node:url";
6
6
  const __filename = fileURLToPath(import.meta.url);
7
7
  const __dirname = dirname(__filename);
8
8
  const root = resolve(__dirname, "..");
9
- if (process.argv[2] === "preview" && process.argv.includes("--delivery")) {
10
- const index=process.argv.indexOf("--delivery");
11
- if (process.argv[index+1] !== "event") {
12
- console.error("CLI review delivery supports only --delivery event; omit --delivery for the native preview.");
13
- process.exit(1);
9
+ if (process.argv[2] === "preview") {
10
+ const argv=process.argv.slice(2);
11
+ const optionIndex=argv.indexOf("--delivery");
12
+ const explicit=optionIndex>=0;
13
+ const delivery=explicit ? argv[optionIndex+1] : "text";
14
+ if(explicit && delivery!=="text" && delivery!=="event"){
15
+ console.error("Preview delivery must be text or event.");process.exit(1);
16
+ }
17
+ // Markdown previews compile independently; Neo owns optional mobile review delivery.
18
+ // JSON previews retain their existing local-only renderer.
19
+ const markdown=argv[1]?.toLowerCase().endsWith('.md');
20
+ if(explicit || markdown){
21
+ const eventArgs=explicit ? argv : ['preview',argv[1],'--delivery','text'];
22
+ const entry=resolve(root,'src','mcp','mobile-review-cli.mjs');
23
+ const deliveryResult=spawnSync(process.execPath,[entry,...eventArgs],{stdio:'inherit'});
24
+ if(deliveryResult.error)console.error(deliveryResult.error.message);
25
+ if(deliveryResult.status!==0)process.exit(deliveryResult.status??1);
26
+ if(explicit)process.exit(0);
14
27
  }
15
- const entry=resolve(root,"src","mcp","mobile-review-cli.mjs");
16
- const result=spawnSync(process.execPath,[entry,...process.argv.slice(2)],{stdio:"inherit"});
17
- if(result.error)console.error(result.error.message);
18
- process.exit(result.status??1);
19
28
  }
20
29
  if (process.argv[2] === "queue") {
21
30
  const result = spawnSync(process.execPath, [resolve(root, "src", "queue-worker.mjs"), ...process.argv.slice(3)], { stdio: "inherit" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lalalic/markcut",
3
- "version": "3.2.46",
3
+ "version": "3.2.48",
4
4
  "description": "Markdown-to-video engine. Describe scenes in markdown, get a rendered video.",
5
5
  "bin": {
6
6
  "markcut": "bin/markcut"
@@ -3,17 +3,26 @@ return `
3
3
  const feedback=document.getElementById('feedback'),status=document.getElementById('status'),pathLabel=document.getElementById('path-label');
4
4
  let nextId=0,identity=null,busy=false,expectedPath=null,activePath=null,activeRelay=null,activeReview={delivery:"text"},expectedDelivery="text",submittedRevision=null,submission=null;
5
5
  const comments=[];
6
- let currentScene={sceneId:null,sceneName:null,sceneStart:0,timeSeconds:0},selectedId=null,nextCommentId=0;
6
+ let currentScene={sceneId:null,sceneName:null,sceneStart:0,timeSeconds:0},selectedId=0,nextCommentId=0;
7
7
  const mode=document.getElementById('comment-mode');
8
8
  const sceneKey=c=>String(c?.sceneName||c?.sceneId||'Overall');
9
+ function updateDeliveryMode(){
10
+ const el=document.getElementById('review-delivery-mode');
11
+ if(!el)return;
12
+ // Never claim a bound Event destination until the authoritative provider
13
+ // result actually supplies the authenticated event template.
14
+ const bound=activeReview?.delivery==='event'&&Boolean(activeReview.eventTemplate);
15
+ el.textContent=bound?'Event mode':expectedDelivery==='event'?'Event mode · unavailable':'Text mode';
16
+ el.title=bound?'Review decisions publish via the bound Events provider':
17
+ expectedDelivery==='event'?'Waiting for authenticated event delivery configuration':
18
+ 'Review decisions are sent as messages in this conversation';
19
+ }
9
20
  function allComments(){
10
21
  return comments.filter(x=>x.text.trim()).map(({scope,text,context})=>({scope,text:text.trim(),playbackContext:context}));
11
22
  }
12
23
  function redrawComments(){
13
24
  const names=[...new Set(comments.filter(x=>x.text.trim()&&x.scope!=='overall').map(x=>sceneKey(x.context)))];
14
25
  window.dispatchEvent(new CustomEvent('markcut:comments-change',{detail:{sceneNames:names}}));
15
- const count=document.getElementById('comment-count');
16
- if(count)count.textContent=comments.length+' comment'+(comments.length===1?'':'s');
17
26
  const remove=document.getElementById('remove-spot');
18
27
  if(remove)remove.disabled=selectedId===null||selectedId===0;
19
28
  const overall=selectedId===0||comments.some(x=>x.id===selectedId&&x.scope==='overall');
@@ -23,7 +32,7 @@ function redrawComments(){
23
32
  window.dispatchEvent(new CustomEvent('markcut:spots-change',{detail:{spots}}));
24
33
  }
25
34
  function clearComments(){
26
- comments.length=0;selectedId=null;currentScene={sceneId:null,sceneName:null,sceneStart:0,timeSeconds:0};feedback.value='';mode.value='spot';redrawComments();
35
+ comments.length=0;selectedId=0;currentScene={sceneId:null,sceneName:null,sceneStart:0,timeSeconds:0};feedback.value='';mode.value='spot';redrawComments();
27
36
  }
28
37
  window.addEventListener('markcut:scene-change',event=>{currentScene={...(event.detail||{})};});
29
38
  function autoSaveBeforeSwitch(){
@@ -66,19 +75,27 @@ document.getElementById('remove-spot').onclick=()=>{
66
75
  selectedId=null;feedback.value='';
67
76
  redrawComments();
68
77
  };
69
- document.getElementById('save-spot').onclick=()=>{
70
- const value=feedback.value.trim(),scope=(selectedId===0||comments.some(x=>x.id===selectedId&&x.scope==='overall'))?'overall':mode.value;
71
- if(!value){status.textContent='Write a comment first.';return;}
78
+ function saveDraft({fallbackOverall=false}={}){
79
+ const value=feedback.value.trim();
80
+ if(!value){status.textContent='Write a comment first.';return false;}
81
+ let scope=(selectedId===0||comments.some(x=>x.id===selectedId&&x.scope==='overall'))?'overall':mode.value;
72
82
  const live=window.__markcutPlaybackContext||currentScene;
73
- if(scope!=='overall'&&!live.sceneId&&!live.sceneName){status.textContent='Choose a scene first.';return;}
83
+ if(scope!=='overall'&&!live.sceneId&&!live.sceneName){
84
+ if(!fallbackOverall){status.textContent='Choose a scene first.';return false;}
85
+ scope='overall';
86
+ }
74
87
  const context=scope==='overall'?{sceneId:null,sceneName:null,timeSeconds:0}:
75
88
  {...live,timeSeconds:scope==='scene'?(Number(live.sceneStart)||0):(Number(live.timeSeconds)||0)};
76
- if(selectedId!==null&&selectedId!==0){
77
- const note=comments.find(x=>x.id===selectedId);
78
- if(note){note.text=value;note.scope=scope;note.context=context;}
79
- }else comments.push({id:++nextCommentId,scope,text:value,context});
80
- selectedId=null;feedback.value='';status.textContent='';redrawComments();
81
- };
89
+ const existing=comments.find(x=>x.id===selectedId) ||
90
+ (selectedId===0?comments.find(x=>x.scope==='overall'):null);
91
+ const saved=existing||{id:++nextCommentId,scope,text:value,context};
92
+ if(existing){existing.text=value;existing.scope=scope;existing.context=context;}
93
+ else comments.push(saved);
94
+ selectedId=scope==='overall'?saved.id:null;
95
+ feedback.value='';status.textContent='';redrawComments();
96
+ return true;
97
+ }
98
+ document.getElementById('save-spot').onclick=()=>saveDraft({fallbackOverall:true});
82
99
  const pending=new Map();
83
100
  const resultsByPath=new Map();
84
101
  let fallbackGeneration=0;
@@ -113,6 +130,7 @@ function applyToolInput(params){
113
130
  if(typeof input.path!=='string')return;
114
131
  expectedPath=input.path;
115
132
  expectedDelivery=input.review?.delivery==='event'?'event':'text';
133
+ updateDeliveryMode();
116
134
  // The selection has no authority to change delivery; only the compiled
117
135
  // operation result supplies the provider-bound review configuration.
118
136
  loadRemoteScenes(expectedPath);
@@ -120,7 +138,7 @@ function applyToolInput(params){
120
138
  const cached=resultsByPath.get(expectedPath);
121
139
  if(cached){if(cached.operationUrl)trackOperation(cached);else renderRevision(cached);return;}
122
140
  if(window.__markcutRevision?.path!==expectedPath && window.__markcutRevision?.requestedPath!==expectedPath){
123
- identity=null;activeReview={delivery:"text"};
141
+ identity=null;activeReview={delivery:"text"};updateDeliveryMode();
124
142
  window.__markcutRevision=null;
125
143
  window.dispatchEvent(new CustomEvent('markcut:revision',{detail:null}));
126
144
  pathLabel.textContent=expectedPath;
@@ -183,10 +201,6 @@ async function trackOperation(data){
183
201
  if(progress.state==='ready'&&progress.result){
184
202
  await renderRevision({...progress.result,requestedPath:data.requestedPath||data.path,
185
203
  requestId:progress.result.requestId||data.requestId,review:progress.result.review||data.review,relay:data.relay});
186
- if(progress.mobileDelivery?.stored===false)
187
- status.textContent='iPhone Preview delivery failed: '+(progress.mobileDelivery.error||'unknown error');
188
- else if(progress.mobileDelivery?.stored===true&&progress.mobileDelivery.accepted===false)
189
- status.textContent='Preview saved on Neo Master; APNs notification not confirmed. Open Neo on iPhone to sync.';
190
204
  return;
191
205
  }
192
206
  if(progress.state==='failed'){reviewReadonly(true,'Compilation failed: '+progress.error);return;}
@@ -228,6 +242,7 @@ async function renderRevision(data){
228
242
  if(!data.compiled&&!data.compiledUrl){status.textContent='Compiled scenes unavailable';return;}
229
243
  identity={requestId:data.requestId||data.operationId||data.revisionId,previewId:data.id,revisionId:data.revisionId,contentHash:data.contentHash};
230
244
  activeReview=data.review||{delivery:'text'};
245
+ updateDeliveryMode();
231
246
  activePath=data.requestedPath||data.path||expectedPath||null;
232
247
  activeRelay=data.relay||null;
233
248
  if(submittedRevision!==data.revisionId){busy=false;submittedRevision=null;submission=null;}
@@ -283,7 +298,14 @@ async function submit(decision){
283
298
  if(document.getElementById(decision==='approved'?'approve':'changes').disabled){
284
299
  status.textContent='Review disabled for this revision or delivery configuration.';return;
285
300
  }
286
- if(feedback.value.trim()&&(selectedId===null||comments.find(x=>x.id===selectedId)?.text!==feedback.value.trim())){status.textContent='Add or remove the current comment before submitting.';return;}
301
+ // The submission button must save a draft, not silently require a second '+' action.
302
+ if(feedback.value.trim()){
303
+ if(decision==='approved'){
304
+ status.textContent='You have draft feedback. Submit feedback or clear it before approving.';
305
+ return;
306
+ }
307
+ if(!saveDraft({fallbackOverall:true}))return;
308
+ }
287
309
  const preparedComments=allComments();
288
310
  if(decision==='changes_requested'&&!preparedComments.length){status.textContent='Feedback is required.';return;}
289
311
  if(decision==='approved'&&preparedComments.length){status.textContent='Submit or remove draft comments before approval.';return;}
@@ -319,6 +341,8 @@ async function submit(decision){
319
341
  }
320
342
  document.getElementById('approve').onclick=()=>submit('approved');
321
343
  document.getElementById('changes').onclick=()=>submit('changes_requested');
344
+ redrawComments();
345
+ updateDeliveryMode();
322
346
  initialize();
323
347
  `;
324
348
  }
@@ -27,7 +27,7 @@ export function writeOperation(id,data){
27
27
  writeFileSync(temp,JSON.stringify(data),{mode:0o644});
28
28
  renameSync(temp,join(folder,id+".json"));
29
29
  }
30
- export function startCompileOperation(path,relay,review={delivery:"text"},mobileOptions={}){
30
+ export function startCompileOperation(path,relay,review={delivery:"text"}){
31
31
  const valid=validateMarkdownPath(resolvePreviewPath(path));
32
32
  if(!statSync(valid).isFile())throw new Error("Preview source must be a Markdown file");
33
33
  const input=fingerprintInputs(valid);
@@ -36,7 +36,7 @@ export function startCompileOperation(path,relay,review={delivery:"text"},mobile
36
36
  const id=randomUUID(),startedAt=Date.now();
37
37
  writeOperation(id,{id,state:"compiling",stage:"queued",startedAt,requestedPath:path});
38
38
  const worker=fileURLToPath(new URL("./compile-worker.mjs",import.meta.url));
39
- const child=spawn(process.execPath,[worker,id,valid,path,JSON.stringify(relay||null),sourceHash,JSON.stringify(review),JSON.stringify(mobileOptions)],{detached:true,stdio:"ignore"});
39
+ const child=spawn(process.execPath,[worker,id,valid,path,JSON.stringify(relay||null),sourceHash,JSON.stringify(review)],{detached:true,stdio:"ignore"});
40
40
  child.on("error",e=>{
41
41
  writeOperation(id,{id,state:"failed",stage:"failed",startedAt,requestedPath:path,error:e.message});
42
42
  });
@@ -3,11 +3,9 @@ import {ensureVideoPreview} from "./preview.mjs";
3
3
  import {publishPreviewRevision} from "./remote-assets.mjs";
4
4
  import {writeOperation} from "./compile-operation.mjs";
5
5
  import {fingerprintInputs} from "./source-fingerprint.mjs";
6
- import {buildPhoneReviewRequest,sendMasterReviewRequest} from "./phone-notification.mjs";
7
- const [id,path,requestedPath,relayText,sourceHash,reviewText,mobileOptionsText]=process.argv.slice(2);
6
+ const [id,path,requestedPath,relayText,sourceHash,reviewText]=process.argv.slice(2);
8
7
  const startedAt=Date.now();
9
8
  const review=JSON.parse(reviewText||'{"delivery":"text"}');
10
- const mobileOptions=JSON.parse(mobileOptionsText||"{}");
11
9
  function update(stage){writeOperation(id,{id,state:"compiling",stage,startedAt,updatedAt:Date.now(),requestedPath});}
12
10
  try{
13
11
  update("resolving-and-compiling");
@@ -17,25 +15,11 @@ try{
17
15
  const result=await ensureVideoPreview(path,{onProgress:update});
18
16
  update("publishing");
19
17
  publishPreviewRevision(requestedPath,{...result,requestedPath});
20
- update("notifying-iphone");
21
- let mobileDelivery;
22
- try{
23
- const request=buildPhoneReviewRequest(id,{...result,requestedPath},review,mobileOptions);
24
- mobileDelivery=await sendMasterReviewRequest(request);
25
- }catch(error){
26
- mobileDelivery={stored:false,error:String(error?.message||error)};
27
- }
28
- // A compiled video is not a delivered Preview. Never silently claim success
29
- // if the canonical Master inbox could not persist the mobile request.
30
- if(mobileDelivery.stored!==true){
31
- writeOperation(id,{id,state:"failed",stage:"mobile-delivery",startedAt,updatedAt:Date.now(),
32
- requestedPath,error:mobileDelivery.error||"Neo Master could not persist review request"});
33
- process.exitCode=1;
34
- }else{
35
- writeOperation(id,{id,state:"ready",stage:"complete",startedAt,updatedAt:Date.now(),requestedPath,
36
- mobileDelivery,result:{...result,requestedPath,requestId:id,review,relay:JSON.parse(relayText)}});
37
- }
18
+ // Markcut is a pure preview provider. The Neo MCP wrapper owns mobile delivery.
19
+ writeOperation(id,{id,state:"ready",stage:"complete",startedAt,updatedAt:Date.now(),requestedPath,
20
+ result:{...result,requestedPath,requestId:id,review,relay:JSON.parse(relayText)}});
21
+
38
22
  }catch(e){
39
- writeOperation(id,{id,state:"failed",stage:"failed",startedAt,updatedAt:Date.now(),requestedPath,error:e?.message||String(e)});
23
+ writeOperation(id,{id,state:"failed",stage:"failed",startedAt,updatedAt:Date.now(),requestedPath,review,relay:JSON.parse(relayText||"null"),error:e?.message||String(e)});
40
24
  process.exitCode=1;
41
25
  }
@@ -1,33 +1,82 @@
1
1
  #!/usr/bin/env node
2
- /** Codex/terminal human-review bridge. The phone publishes the caller-owned Event after Submit. */
3
- import {readFileSync} from 'node:fs';
4
- import {join,resolve} from 'node:path';
2
+ /** Standalone terminal preview compiler. Notification is owned by the Neo MCP wrapper. */
3
+ import {readFileSync,existsSync} from 'node:fs';
4
+ import {join,resolve,basename} from 'node:path';
5
+ import {homedir} from 'node:os';
5
6
  import {pathToFileURL} from 'node:url';
6
7
  import {normalizeReviewConfig} from './review-delivery.mjs';
7
8
 
8
9
  const delay = ms => new Promise(done => setTimeout(done,ms));
9
- const UUID = /^[a-f0-9-]{36}$/i;
10
10
 
11
11
  export function parseEventPreviewOptions(argv) {
12
12
  if (argv[0] !== 'preview' || !argv[1] || argv[1].startsWith('--')) throw new Error('Usage: markcut preview <file.md> --delivery event --event-template <file.json>');
13
- const allowed=new Set(['--delivery','--event-template','--title','--group-id','--group-title','--request-id','--timeout-ms']);
13
+ const allowed=new Set(['--delivery','--event-template','--timeout-ms']);
14
14
  const options={file:resolve(argv[1])};
15
15
  for(let i=2;i<argv.length;i+=2){
16
16
  const flag=argv[i],value=argv[i+1];
17
17
  if(!allowed.has(flag) || !value || value.startsWith('--'))throw new Error('Missing or unsupported preview event flag: '+flag);
18
- const key={'--delivery':'delivery','--event-template':'eventTemplatePath','--title':'title','--group-id':'groupId','--group-title':'groupTitle','--request-id':'requestId','--timeout-ms':'timeoutMs'}[flag];
18
+ const key={'--delivery':'delivery','--event-template':'eventTemplatePath','--timeout-ms':'timeoutMs'}[flag];
19
19
  if(Object.hasOwn(options,key))throw new Error('Duplicate flag: '+flag);
20
20
  options[key]=value;
21
21
  }
22
22
  if(!['text','event'].includes(options.delivery) || (options.delivery==='event')!==Boolean(options.eventTemplatePath))
23
23
  throw new Error('Event delivery requires --event-template; Text delivery must omit it');
24
- if(options.requestId && !UUID.test(options.requestId))throw new Error('--request-id must be a UUID');
25
24
  const limit=options.timeoutMs===undefined ? 300000 : Number(options.timeoutMs);
26
25
  if(!Number.isSafeInteger(limit) || limit<1000 || limit>1800000)throw new Error('--timeout-ms must be 1000..1800000');
27
26
  options.timeoutMs=limit;
28
27
  return options;
29
28
  }
30
29
 
30
+ // The compiler stays platform-neutral. The explicit CLI review workflow
31
+ // delivers to Neo.app's authenticated local Core REST boundary, never APNs or
32
+ // the Agent-facing MCP tool surface. Inability to persist the inbox is fatal.
33
+ export function neoReviewEndpoint(override=process.env.NEO_REVIEW_NOTIFY_URL,
34
+ deploymentFile=join(homedir(),'Library','Application Support','NeoY','deployment.json')){
35
+ let url;
36
+ if(override)url=new URL(override);
37
+ else{
38
+ let port=6767;
39
+ if(existsSync(deploymentFile)){
40
+ const config=JSON.parse(readFileSync(deploymentFile,'utf8'));
41
+ if(Number.isInteger(config.mcpPort)&&config.mcpPort>0&&config.mcpPort<=65535)port=config.mcpPort;
42
+ }
43
+ url=new URL('http://127.0.0.1:'+port+'/mobile/review/notify');
44
+ }
45
+ if(url.protocol!=='http:'||!['localhost','127.0.0.1'].includes(url.hostname)||
46
+ url.pathname!=='/mobile/review/notify'||url.search||url.hash||url.username||url.password)
47
+ throw Error('Neo Review delivery must use the local REST notify endpoint');
48
+ return url.href;
49
+ }
50
+ export function buildReviewRequest(options,config,state,operationId){
51
+ const data=state?.result;
52
+ if(!data||typeof data.contentHash!=='string'||typeof data.revisionId!=='string'||
53
+ !data.contentHash.match(/^[a-f0-9]{64}$/)||!data.revisionId)
54
+ throw Error('Compiled Preview has no immutable revision identity');
55
+ const request={id:operationId,contentHash:data.contentHash,revisionId:data.revisionId,
56
+ previewId:data.id,title:basename(options.file,'.md'),delivery:config.delivery};
57
+ if(config.delivery==='event'){
58
+ const fixed=config.eventTemplate.data.interactive;
59
+ request.eventTemplate=config.eventTemplate;
60
+ request.jobId=fixed.jobId;
61
+ request.groupId=`job/${fixed.jobId}/task/${fixed.taskId}`;
62
+ }else request.groupId=options.file;
63
+ return request;
64
+ }
65
+ export async function submitNeoReview(request,{fetchImpl=fetch,url=neoReviewEndpoint()}={}){
66
+ const destination=new URL(url);
67
+ if(destination.protocol!=='http:'||!['127.0.0.1','localhost'].includes(destination.hostname)||
68
+ destination.pathname!=='/mobile/review/notify'||destination.search||destination.hash)
69
+ throw Error('Refusing a nonlocal Neo Review notification destination');
70
+ const response=await fetchImpl(destination.href,{method:'POST',
71
+ headers:{'Content-Type':'application/json','Accept':'application/json'},
72
+ body:JSON.stringify(request),signal:AbortSignal.timeout(55000),redirect:'error'});
73
+ if(!response.ok)throw Error('Neo Review REST rejected delivery: HTTP '+response.status);
74
+ const receipt=await response.json();
75
+ if(receipt?.stored!==true||receipt.requestId!==request.id)
76
+ throw Error('Neo Review Core did not acknowledge durable Inbox storage');
77
+ return receipt;
78
+ }
79
+
31
80
  export async function runMobilePreview(argv){
32
81
  const opts=parseEventPreviewOptions(argv);
33
82
  const config=opts.delivery==='event' ? normalizeReviewConfig({delivery:'event',
@@ -35,7 +84,7 @@ export async function runMobilePreview(argv){
35
84
  const [{startCompileOperation},{EXPORT_ROOT}]=await Promise.all([
36
85
  import('./compile-operation.mjs'),import('./remote-assets.mjs'),
37
86
  ]);
38
- const operation=startCompileOperation(opts.file,undefined,config,opts);
87
+ const operation=startCompileOperation(opts.file,undefined,config);
39
88
  const stateFile=join(EXPORT_ROOT,'operations',operation.operationId+'.json');
40
89
  let state;
41
90
  const until=Date.now()+opts.timeoutMs;
@@ -46,18 +95,17 @@ export async function runMobilePreview(argv){
46
95
  await delay(300);
47
96
  }
48
97
  if(state?.state!=='ready')throw new Error('Preview compile timed out; operation '+operation.operationId);
49
- const receipt=state.mobileDelivery;
50
- if(receipt?.stored!==true)throw new Error('Master review delivery failed: '+(receipt?.error||'no durable receipt'));
51
- return {stored:true,apnsAccepted:receipt.accepted===true,duplicate:receipt.duplicate===true,
52
- status:'review_requested',operationId:operation.operationId,requestId:receipt.requestId,
98
+ const request=buildReviewRequest(opts,config,state,operation.operationId);
99
+ const receipt=await submitNeoReview(request);
100
+ return {status:'review_requested',operationId:operation.operationId,requestId:request.id,
53
101
  contentHash:state.result.contentHash,revisionId:state.result.revisionId,
54
102
  ...(config.delivery==='event' ? {jobId:config.eventTemplate.data.interactive.jobId} : {}),
55
- delivery:config.delivery,destination:'Neo Master/Neo Mobile'};
103
+ delivery:config.delivery,notification:receipt.accepted?'apns_submitted':'inbox_stored'};
56
104
  }
57
105
 
58
106
  if(process.argv[1] && import.meta.url===pathToFileURL(resolve(process.argv[1])).href){
59
107
  runMobilePreview(process.argv.slice(2)).then(result=>console.log(JSON.stringify(result))).catch(error=>{
60
- console.error('Markcut mobile event preview failed: '+(error?.message||error));
108
+ console.error('Markcut preview compilation failed: '+(error?.message||error));
61
109
  process.exitCode=1;
62
110
  });
63
111
  }
@@ -9,10 +9,11 @@ import { externalizePreviewMedia, publicOrigin, resolveMountedFile, resolvePrevi
9
9
  import {fingerprintInputs} from "./source-fingerprint.mjs";
10
10
 
11
11
  export const TOOL_NAME = "markcut.preview";
12
- export const RESOURCE_URI = "ui://markcut/video-preview-v44.html";
12
+ export const RESOURCE_URI = "ui://markcut/video-preview-v45.html";
13
13
  const PREVIEW_VERSION = RESOURCE_URI.match(/video-preview-(v\d+)/)?.[1] ?? "unknown";
14
14
  // Legacy entrypoints remain registered, but serve the current implementation.
15
15
  export const LEGACY_RESOURCE_URIS = [
16
+ "ui://markcut/video-preview-v44.html",
16
17
  "ui://markcut/video-preview-v3.html",
17
18
  "ui://markcut/video-preview-v4.html",
18
19
  "ui://markcut/video-preview-v5.html",
@@ -276,14 +277,12 @@ export function buildPreviewHtml() {
276
277
  // from terminating the embedding script tag or leaking source into the DOM.
277
278
  return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
278
279
  <title>Markcut</title>
279
- <style>body{font:14px system-ui;margin:0;background:#fff;color:#17202a}main{padding:12px;max-width:960px;margin:auto}h1{font-size:17px}.path{font-size:12px;overflow-wrap:anywhere}.transport{display:flex;align-items:center;gap:10px;padding:12px 0}.transport input{flex:1;min-width:50px}button{cursor:pointer;padding:8px;border-radius:6px;border:1px solid #a8a8a8}#approve{background:#198038;color:white}#changes{background:#c72b29;color:white}#comment-entry{display:flex;align-items:center;gap:6px;margin:5px 0}#feedback{flex:1;min-width:0;box-sizing:border-box;height:34px;padding:6px 9px;border:1px solid #b5bdc8;border-radius:6px}#comment-mode{max-width:102px;height:34px;border:1px solid #b5bdc8;border-radius:6px;background:white}#save-spot,#remove-spot{width:34px;height:34px;padding:0;font-size:19px}#comment-count{white-space:nowrap}#comment-entry button:disabled{opacity:.4;cursor:default}.review-actions{display:flex;justify-content:space-between;align-items:center;width:100%;gap:16px}.review-actions button{min-width:110px}#remotion-canvas{background:#090b12}#status{padding:8px 0}#status:empty{display:none}#scene-thumbnails{display:flex;gap:7px;overflow-x:auto;padding:12px 2px;scrollbar-width:thin} .scene-pill{flex-shrink:0;padding:7px 11px;border:1px solid #d4dbe4;border-radius:9px;cursor:pointer;background:#f5f7fa;color:#475569;font-size:12px;white-space:nowrap} .scene-pill.active{background:#e7f0ff;color:#125ea2;border-color:#408bd7} .scene-pill.commented{border-color:#cc8b12;background:#fff4d6;color:#764900;font-weight:650} .scene-pill.commented::after{content:' •';color:#ad5b00} #comment-list{display:grid;gap:4px;margin:8px 0} #comment-list>div{display:flex;gap:8px} #comment-list button:first-child{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis} #comment-target,#comment-count{font-size:12px;color:#526071;margin:8px 0}</style></head>
280
+ <style>body{font:14px system-ui;margin:0;background:#fff;color:#17202a}main{padding:12px;max-width:960px;margin:auto}h1{font-size:17px}.path{font-size:12px;overflow-wrap:anywhere}.transport{display:flex;align-items:center;gap:10px;padding:12px 0}.transport input{flex:1;min-width:50px}button{cursor:pointer;padding:8px;border-radius:6px;border:1px solid #a8a8a8}#approve{background:#198038;color:white}#changes{background:#c72b29;color:white}#comment-entry{display:flex;align-items:center;gap:6px;margin:5px 0}#feedback{flex:1;min-width:0;box-sizing:border-box;height:34px;padding:6px 9px;border:1px solid #b5bdc8;border-radius:6px}#comment-mode{max-width:102px;height:34px;border:1px solid #b5bdc8;border-radius:6px;background:white}#save-spot,#remove-spot{width:34px;height:34px;padding:0;font-size:19px}#comment-entry button:disabled{opacity:.4;cursor:default}.review-actions{display:flex;justify-content:space-between;align-items:center;width:100%;gap:16px}.review-actions button{min-width:110px}#remotion-canvas{background:#090b12}#status{flex:1;min-width:0;font-size:12px;color:#526071;text-align:center;overflow-wrap:anywhere}#status:empty{display:none}#scene-thumbnails{display:flex;gap:7px;overflow-x:auto;padding:12px 2px;scrollbar-width:thin} .scene-pill{flex-shrink:0;padding:7px 11px;border:1px solid #d4dbe4;border-radius:9px;cursor:pointer;background:#f5f7fa;color:#475569;font-size:12px;white-space:nowrap} .scene-pill.active{background:#e7f0ff;color:#125ea2;border-color:#408bd7} .scene-pill.commented{border-color:#cc8b12;background:#fff4d6;color:#764900;font-weight:650} .scene-pill.commented::after{content:' •';color:#ad5b00} #comment-list{display:grid;gap:4px;margin:8px 0} #comment-list>div{display:flex;gap:8px} #comment-list button:first-child{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis} #comment-target{font-size:12px;color:#526071;margin:8px 0}</style></head>
280
281
  <style>.comment-marker{position:absolute;top:50%;transform:translate(-50%,-50%);width:20px;height:20px;min-width:20px;padding:0;border:0;border-radius:50%;background:transparent;z-index:10;cursor:pointer;touch-action:none}.comment-marker::after{content:'';display:block;width:14px;height:14px;border-radius:50%;margin:auto;background:#f59e0b;border:2px solid white;box-sizing:border-box}.comment-marker.scope-scene::after{background:#3b82f6}.comment-marker.scope-overall{left:-28px!important}.comment-marker.scope-overall::after{background:#8b5cf6}.comment-marker.scope-overall.placeholder::after{background:transparent;border-color:#8b5cf6}.comment-marker.selected::after,.comment-marker:focus-visible::after{outline:2px solid #2563eb;outline-offset:2px}.comment-marker:hover::after{transform:scale(1.2)}</style>
281
282
  <style>#comment-entry{position:relative;display:block}#feedback{display:block;width:100%;height:auto;min-height:76px;max-height:240px;field-sizing:content;resize:none;padding:9px 112px 32px 9px;font:inherit}#comment-tools{position:absolute;bottom:6px;right:8px;display:flex;align-items:center;gap:2px;background:white}#comment-tools>*{width:30px;height:28px;padding:0;border:0;background:transparent;color:#526071;font:inherit;text-align:center}#comment-tools button{font-size:20px}#comment-tools>*:focus-visible{outline:2px solid #408bd7;outline-offset:-2px}#comment-mode{width:70px;max-width:none;font-size:12px;font-weight:650;text-align:center;text-align-last:center;line-height:28px}#comment-mode:has(option[value=spot]:checked){color:#b45309}#comment-mode:has(option[value=scene]:checked){color:#2563eb}#overall-mode{width:70px;height:28px;line-height:28px;text-align:center;font-size:12px;font-weight:650;color:#7c3aed}</style>
282
- <body><main><header style="display:flex;justify-content:space-between;align-items:center"><h1>Markcut · <span id="video-md-version">video</span></h1><div style="display:flex;align-items:center;gap:14px;margin-left:auto"><span id="header-tts"></span><span id="player-version" style="font-size:12px;color:#667">${PREVIEW_VERSION}</span></div></header><div class="path" id="path-label" hidden></div><div id="interactive-ui" hidden><div id="remotion-root"></div>
283
+ <body><main><header style="display:flex;justify-content:space-between;align-items:center"><h1>Markcut · <span id="video-md-version">video</span></h1><div style="display:flex;align-items:center;gap:14px;margin-left:auto"><span id="header-tts"></span><span id="review-delivery-mode" aria-label="Review delivery mode" style="font-size:12px;color:#526071;white-space:nowrap">Text mode</span><span id="player-version" style="font-size:12px;color:#667">${PREVIEW_VERSION}</span></div></header><div class="path" id="path-label" hidden></div><div id="interactive-ui" hidden><div id="remotion-root"></div>
283
284
  <div id="comment-entry"><textarea id="feedback" rows="3" aria-label="Feedback" placeholder="Add a comment…"></textarea><div id="comment-tools"><select id="comment-mode" aria-label="Comment scope" title="Comment scope"><option value="spot" style="color:#b45309">Spot</option><option value="scene" style="color:#2563eb">Scene</option></select><span id="overall-mode" hidden>Overall</span><button id="save-spot" type="button" title="Add or update comment" aria-label="Add or update comment">+</button><button id="remove-spot" type="button" title="Remove selected comment" aria-label="Remove selected comment" disabled>−</button></div></div>
284
- <div style="display:flex;justify-content:flex-end"><span id="comment-count" aria-live="polite">0 comments</span></div>
285
- <div id="status" role="status">Starting preview…</div>
286
- <div class="review-actions"><button id="changes">Submit all feedback</button><button id="approve">Approve</button></div></div></main>
285
+ <div class="review-actions"><button id="changes">Submit feedback</button><span id="status" role="status">Starting preview…</span><button id="approve">Approve</button></div></div></main>
287
286
  <script src="${playerScriptUrl}"></script>
288
287
  <script>${buildPreviewBridgeScript().replaceAll("__MARKCUT_ORIGIN__",JSON.stringify(publicOrigin()))}</script></body></html>`;
289
288
  }