@lalalic/markcut 3.2.61 → 3.2.63

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
@@ -135,7 +135,30 @@ Two override mechanisms:
135
135
  - **Variant-prefixed keys**: `zh-src` → `src`, `zh-jsx` → `jsx`, `zh-script` → `script`
136
136
  - **Bare variant keys**: `zh:"<h1>你好</h1>"` replaces the node's primary content key (`jsx` for components, `src` for images/video, `script` for audio)
137
137
 
138
- ### Multi-Variant Preview Server
138
+ ### Interactive NeoY Design Mode (before formal Review)
139
+
140
+ The **existing Markcut Previewer** can be opened as a standalone NeoY view
141
+ using only the mounted source `video.md`. There is no special Markcut CLI mode,
142
+ browser Session ID, revision identity, or file-watcher process.
143
+
144
+ 1. Call `markcut.preview({path: "/absolute/path/video.md", readonly: true})`.
145
+ Markcut compiles and publishes the latest player assets. For a source in an
146
+ existing NeoY file mount, the tool result includes `designUrl`, an HTTPS
147
+ link to the standalone player.
148
+ 2. Open `designUrl` in a browser. For interactive side-by-side design, call
149
+ WebHelm's **independent** `webhelm design start --url '<designUrl>'` while a
150
+ ChatGPT conversation tab is active. Markcut does not control Split View.
151
+ 3. After editing `video.md`, referenced media, or its Editor Decision sidecar,
152
+ call the same `markcut.preview` tool with `readonly: true` again. The open
153
+ page polls the published file pointer and updates **Original / variants /
154
+ Editor Decisions** in place. No user-facing Review or approval is required.
155
+ 4. Stop the WebHelm Session through WebHelm. Markcut has no browser lifecycle.
156
+
157
+ The source must be under a configured NeoY file mount. The URL uses the
158
+ existing public, read-only `/files/` transport, so mount only content suitable
159
+ for exposure at that address. This mode does not send review decisions.
160
+
161
+ ## Multi-Variant Preview Server
139
162
 
140
163
  The `preview` command accepts multiple `--variant` flags, each defining a separate compilation target. Variants are compiled **sequentially** (not in parallel) to avoid resource contention from CLI tools like whisper and ffprobe.
141
164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lalalic/markcut",
3
- "version": "3.2.61",
3
+ "version": "3.2.63",
4
4
  "description": "Markdown-to-video engine. Describe scenes in markdown, get a rendered video.",
5
5
  "bin": {
6
6
  "markcut": "bin/markcut"
@@ -59,9 +59,10 @@ Asset paths are relative to the Markdown document. A `prompt` without `src` asks
59
59
  ## Preview, review, and finish
60
60
 
61
61
  1. **Structure gate:** `npx @lalalic/markcut verify video.md`, then `npx @lalalic/markcut preview video.md --storyboard` when rapid scene review is useful. Storyboard placeholders do not verify generated media or final audio.
62
- 2. **Playback gate:** `npx @lalalic/markcut preview video.md`. Play and seek representative scenes; check black tails, media loading, narration, BGM, subtitles, route movement, and timing. For browser failures, load [Preview Troubleshooting](references/preview-troubleshooting.md) on demand.
63
- 3. **Human review gate:** Use Neo's `markcut.preview({path: "/absolute/path/video.md"})` when the user wants to review the hosted ChatGPT video player. For playback only, use `readonly:true` instead; do not supply `review`. This is **not** the CLI preview. Managed requests correlate through `review.relay`, not a top-level `relay` field. The tool compiles/publishes a revision for playback; it does not rewrite the source. Comments with `decision: changes_requested` require editing that Markdown and calling `markcut.preview` again. `decision: approved` applies **only** to the identified revision/content hash; never apply an old approval to changed content. Follow [Review Contract](review.md) for actual video assessment.
64
- 4. **Codex / terminal human-review gate:** `npx @lalalic/markcut preview /absolute/video.md --delivery event --event-template /absolute/relay-event.json` on Neo Master. The Event Template must match Relay's canonical `task.interactive_decision` Contract (`type`, `source`, `data.interactive.{jobId,taskId,executionId}` only, without review-result fields). The CLI reuses the MCP compiler, publishes immutable preview assets, persists the review request on Neo Master and dispatches an APNs notification through the existing Neo Mobile provider. Exit receipt `review_requested` confirms only **durable wrapper delivery storage**, not that the phone has acquired it; human decisions arrive asynchronously on Events Bus. The phone need not be online. APNs delivery is best-effort; Neo Mobile synchronizes persisted requests on foreground. There is no automatic text fallback. Do not claim approval or Relay worker continuation from the receipt. For retries with an uncertain phone acknowledgment, pass a stable `--request-id UUID`. See [Codex/mobile review CLI](references/mobile-event-preview-cli.md).
62
+ 2. **Interactive design before Review:** Call `markcut.preview({path:"/absolute/video.md",readonly:true})` to compile/publish. When its result has `designUrl`, use WebHelm's independent `design start --url <designUrl>` action to show the existing player beside the active ChatGPT conversation. After editing `video.md` or its EDL, call the same readonly preview tool again; the open NeoY player refreshes automatically on publication. End the WebHelm Session separately when finished. No `markcut --design` CLI, Review approval, or Markcut-managed WebHelm lifecycle.
63
+ 3. **Playback gate:** `npx @lalalic/markcut preview video.md`. Play and seek representative scenes; check black tails, media loading, narration, BGM, subtitles, route movement, and timing. For browser failures, load [Preview Troubleshooting](references/preview-troubleshooting.md) on demand.
64
+ 4. **Human review gate:** Use Neo's `markcut.preview({path: "/absolute/path/video.md"})` when the user wants to review the hosted ChatGPT video player. For playback only, use `readonly:true` instead; do not supply `review`. This is **not** the CLI preview. Managed requests correlate through `review.relay`, not a top-level `relay` field. The tool compiles/publishes a revision for playback; it does not rewrite the source. Comments with `decision: changes_requested` require editing that Markdown and calling `markcut.preview` again. `decision: approved` applies **only** to the identified revision/content hash; never apply an old approval to changed content. Follow [Review Contract](review.md) for actual video assessment.
65
+ 5. **Codex / terminal human-review gate:** `npx @lalalic/markcut preview /absolute/video.md --delivery event --event-template /absolute/relay-event.json` on Neo Master. The Event Template must match Relay's canonical `task.interactive_decision` Contract (`type`, `source`, `data.interactive.{jobId,taskId,executionId}` only, without review-result fields). The CLI reuses the MCP compiler, publishes immutable preview assets, persists the review request on Neo Master and dispatches an APNs notification through the existing Neo Mobile provider. Exit receipt `review_requested` confirms only **durable wrapper delivery storage**, not that the phone has acquired it; human decisions arrive asynchronously on Events Bus. The phone need not be online. APNs delivery is best-effort; Neo Mobile synchronizes persisted requests on foreground. There is no automatic text fallback. Do not claim approval or Relay worker continuation from the receipt. For retries with an uncertain phone acknowledgment, pass a stable `--request-id UUID`. See [Codex/mobile review CLI](references/mobile-event-preview-cli.md).
65
66
  5. **Delivery gate:** `npx @lalalic/markcut render video.md --output out/video.mp4`. Confirm the MP4 exists and examine playback, including the final audio and subtitles. A valid Markdown file, compile success, or hosted-player resource alone is not proof of a finished video.
66
67
 
67
68
  If the user asks only for a script or structure, stop at the requested stage. Do not trigger expensive generation or claim final video delivery without a requested rendered artifact. A project-specific agent owns its own editorial or approval decisions; Markcut supplies authoring, playback and revision capabilities.
@@ -2,6 +2,9 @@ export function buildPreviewBridgeScript() {
2
2
  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,activeReview={delivery:"text"},expectedDelivery="text",expectedReadonly=false,submittedRevision=null,submission=null;
5
+ const standaloneDesign=typeof location!=='undefined' && location.pathname.endsWith('/_neoy/markcut/design.html');
6
+ if(standaloneDesign){window.__markcutDesignMode=true;document.body.classList.add('markcut-design-mode');}
7
+
5
8
  const comments=[];
6
9
  let questions=[],questionAnswers={};
7
10
  const isQuestionMode=()=>activeReview?.mode==='questions';
@@ -257,7 +260,7 @@ function reviewReadonly(readonly,message){
257
260
  }
258
261
  async function renderRevision(data){
259
262
  const generation=++renderGeneration;
260
- if(identity?.revisionId&&identity.revisionId!==data.revisionId)clearComments();
263
+ if(!standaloneDesign&&identity?.revisionId&&identity.revisionId!==data.revisionId)clearComments();
261
264
  if(data.path){pathLabel.textContent=data.path;showVideoName(data.path,data.title||data.videoTitle);}
262
265
  if(!data.compiled&&!data.compiledUrl){status.textContent='Compiled scenes unavailable';return;}
263
266
  identity={requestId:data.requestId||data.operationId||data.revisionId,previewId:data.id,revisionId:data.revisionId,contentHash:data.contentHash};
@@ -336,7 +339,7 @@ async function initialize(){
336
339
  catch(e){status.textContent=e.message||'MCP initialization failed';}
337
340
  }
338
341
  async function submit(decision){
339
- if(busy||isViewOnly())return;
342
+ if(standaloneDesign||busy||isViewOnly())return;
340
343
  if(document.getElementById(isQuestionMode()?'questions-submit':(decision==='approved'?'approve':'changes')).disabled){
341
344
  status.textContent='Review disabled for this revision or delivery configuration.';return;
342
345
  }
@@ -386,6 +389,46 @@ document.getElementById('approve').onclick=()=>submit('approved');
386
389
  document.getElementById('changes').onclick=()=>submit('changes_requested');
387
390
  redrawComments();
388
391
  updateDeliveryMode();
389
- initialize();
392
+ if(standaloneDesign){
393
+ // Agent reads draft notes via WebHelm in the shared tab; design notes are
394
+ // never published as a review or sent to an MCP host.
395
+ window.__markcutDesignNotes=()=>allComments();
396
+ const rawPath=new URLSearchParams(location.search).get('path');
397
+ // The browser can only address a public, mounted Markdown file. Never
398
+ // expose a local absolute path, accept another origin, or query _neoy assets.
399
+ if(!rawPath || !/^\\/files\\/(?!_neoy\\/)[A-Za-z0-9_-]+\\/(?:[^/?#]+\\/)*[^/?#]+\\.md$/i.test(rawPath) ||
400
+ rawPath.split('/').some(part=>part==='.'||part==='..'||part.startsWith('.'))){
401
+ status.textContent='Invalid design path: use a mounted /files/<mount>/video.md URL.';
402
+ } else {
403
+ expectedPath=rawPath;
404
+ showVideoName(rawPath);
405
+ status.textContent='Waiting for Markcut compilation…';
406
+ const digestPromise=crypto.subtle.digest('SHA-256',new TextEncoder().encode(rawPath))
407
+ .then(bytes=>Array.from(new Uint8Array(bytes),x=>x.toString(16).padStart(2,'0')).join(''));
408
+ let loading=false;
409
+ async function refreshDesign(){
410
+ if(loading)return;
411
+ loading=true;
412
+ try{
413
+ const hash=await digestPromise;
414
+ const url=__MARKCUT_ORIGIN__+'/files/_neoy/markcut/revisions/'+hash+'.json?time='+Date.now();
415
+ const response=await fetch(url,{cache:'no-store'});
416
+ if(!response.ok){if(!identity)status.textContent='Waiting for Markcut compilation…';return;}
417
+ const data=await response.json();
418
+ if(data.requestedPath!==rawPath || !data.compiledUrl || typeof data.contentHash!=='string')return;
419
+ const changed=!identity || identity.contentHash!==data.contentHash ||
420
+ window.__markcutRevision?.edlCompiledUrl!==data.edlCompiledUrl;
421
+ if(changed){
422
+ // Preserve player context while React's existing player reloads its tree.
423
+ window.__markcutDesignRestoreTime=Number(window.__markcutPlaybackContext?.timeSeconds)||0;
424
+ await renderRevision({...data,review:{delivery:'text',readonly:true}});
425
+ }
426
+ }catch(error){status.textContent='Preview refresh failed: '+String(error?.message||error);}
427
+ finally{loading=false;}
428
+ }
429
+ refreshDesign();
430
+ window.setInterval(refreshDesign,2500);
431
+ }
432
+ } else initialize();
390
433
  `;
391
434
  }
@@ -0,0 +1,29 @@
1
+ // NeoY hosts the existing Markcut player as a standalone read-only document
2
+ // view. Browser split and session lifecycles belong to WebHelm, not Markcut.
3
+ import {readFileSync,writeFileSync,mkdirSync,renameSync} from 'node:fs';
4
+ import {join} from 'node:path';
5
+ import {EXPORT_ROOT,publicOrigin,resolveMountedFile} from './remote-assets.mjs';
6
+ import {buildPreviewHtml} from './preview.mjs';
7
+
8
+ export function designViewerUrl(path,origin=publicOrigin(),mount=resolveMountedFile){
9
+ const mounted=mount(path,origin);
10
+ if(!mounted)return null;
11
+ const url=new URL(mounted);
12
+ if(url.origin!==origin || url.search || url.hash ||
13
+ !/^\/files\/(?!_neoy\/)[a-zA-Z0-9_-]+\/(?:[^/?#]+\/)*[^/?#]+\.md$/i.test(url.pathname) ||
14
+ url.pathname.split('/').some(part=>part==='.'||part==='..'||part.startsWith('.')))
15
+ throw Error('Design source must be a mounted Markdown file');
16
+ return origin+'/files/_neoy/markcut/design.html?path='+encodeURIComponent(url.pathname);
17
+ }
18
+
19
+ // The published HTML and MCP iframe share exactly one React player and bridge.
20
+ // Publish once on provider startup; compiling does not own a browser process.
21
+ export function publishDesignViewer({root=EXPORT_ROOT,html=buildPreviewHtml()}={}){
22
+ mkdirSync(root,{recursive:true});
23
+ const target=join(root,'design.html');
24
+ try{if(readFileSync(target,'utf8')===html)return target;}catch{}
25
+ const temp=target+'.'+process.pid+'.tmp';
26
+ writeFileSync(temp,html,{mode:0o644});
27
+ renameSync(temp,target);
28
+ return target;
29
+ }
@@ -13,7 +13,7 @@ export const TOOL_NAME = "markcut.preview";
13
13
  // One source of truth for preview resources. Every historical version (and
14
14
  // the versionless alias) serves the same current UI and player bundle.
15
15
  // Increment the version only to bypass clients that cache an already-open UI.
16
- export const PREVIEW_VERSION_NUMBER = 55;
16
+ export const PREVIEW_VERSION_NUMBER = 56;
17
17
  export const RESOURCE_URI = `ui://markcut/video-preview-v${PREVIEW_VERSION_NUMBER}.html`;
18
18
  export const STABLE_RESOURCE_URI = "ui://markcut/video-preview.html";
19
19
  const PREVIEW_VERSION = `v${PREVIEW_VERSION_NUMBER}`;
@@ -325,6 +325,8 @@ export function buildPreviewHtml() {
325
325
  <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>
326
326
  <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>
327
327
  <style>${readFileSync(resolve(moduleDir,'preview-mobile.css'),'utf8').replace(/\/\*[\s\S]*?\*\//g,'')}</style>
328
+ <style>body.markcut-design-mode #approve,body.markcut-design-mode #changes,body.markcut-design-mode #questions-submit{display:none!important}
329
+ body.markcut-design-mode .review-actions{justify-content:center}body.markcut-design-mode #status{font-weight:500}</style>
328
330
  </head><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="markcut-video-selector-slot"></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>
329
331
  <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>
330
332
  <div class="review-actions"><button id="questions-submit" type="button" hidden>Submit</button><button id="changes">Submit feedback</button><span id="status" role="status">Starting preview…</span><button id="approve">Approve</button></div></div></main>