@lalalic/markcut 3.2.34 → 3.2.36
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/AGENTS.md +17 -302
- package/README.md +9 -0
- package/docs/developer-reference.md +311 -0
- package/package.json +1 -1
- package/skills/markcut/SKILL.md +56 -107
- package/skills/markcut/docs/markdown-descriptive.md +2 -2
- package/skills/markcut/evals/README.md +29 -0
- package/skills/markcut/evals/cases.json +227 -0
- package/skills/markcut/evals/check.mjs +80 -0
- package/skills/markcut/evals/check.selftest.mjs +48 -0
- package/skills/markcut/evals/run-codex.mjs +87 -0
- package/skills/markcut/references/mcp-preview-lifecycle.md +14 -0
- package/skills/markcut/references/preview-troubleshooting.md +21 -49
- package/skills/markcut/review.md +52 -465
- package/src/config.mjs +3 -1
- package/src/render/cli.mjs +5 -2
- package/src/render/validate-assets.mjs +19 -0
- package/src/vision/cli.mjs +79 -28
- package/src/vision/vision_prompts.md +5 -3
- package/tests/validate-assets.test.ts +26 -0
- package/tests/vision-generic-vtt-hooks.test.ts +77 -0
- package/tests/vitest.publish.config.ts +1 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/** Behavioral eval runner for Codex with an existing locally authenticated provider. */
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { mkdirSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { tmpdir } from 'node:os';
|
|
6
|
+
import { dirname, join, resolve } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const root = resolve(here, '..');
|
|
11
|
+
const cases = JSON.parse(readFileSync(join(here, 'cases.json'), 'utf8'));
|
|
12
|
+
const args = process.argv.slice(2);
|
|
13
|
+
let model = 'openrouter/free', provider = 'openrouter', batchSize = 1;
|
|
14
|
+
for (let i = 0; i < args.length; i++) {
|
|
15
|
+
if (args[i] === '--model' && args[i + 1]) model = args[++i];
|
|
16
|
+
else if (args[i] === '--provider' && args[i + 1]) provider = args[++i];
|
|
17
|
+
else if (args[i] === '--batch-size' && args[i + 1]) batchSize = Number(args[++i]);
|
|
18
|
+
else { console.error(`Unsupported option ${args[i]}. Usage: node run-codex.mjs [--provider openrouter] [--model openrouter/free] [--batch-size 1]`); process.exit(2); }
|
|
19
|
+
}
|
|
20
|
+
if (!/^[a-z][a-z0-9_-]*$/.test(provider) || !/^[\w./:-]+$/.test(model) || !Number.isInteger(batchSize) || batchSize < 1 || batchSize > cases.length) {
|
|
21
|
+
console.error('Invalid provider, model, or batch size'); process.exit(2);
|
|
22
|
+
}
|
|
23
|
+
const output = mkdtempSync(join(tmpdir(), 'markcut-skill-codex-eval-'));
|
|
24
|
+
const skill = readFileSync(join(root, 'SKILL.md'), 'utf8');
|
|
25
|
+
const decisions = [];
|
|
26
|
+
const run = {model, provider, batchSize, evidenceDir: output, batches: [], strictJsonFormat: true};
|
|
27
|
+
const promptIntro = `You are an agent using a Markcut Skill for a capability-decision test. This is a dry run. DO NOT execute tools, edit files, create videos or assert that tasks were completed. Use ONLY the Skill below as the behavioral contract.\n\nFor EACH independent user request, return one decision.\n\nFields:\n- id: exact request ID.\n- action: the IMMEDIATE next action, one of vision, author, storyboard, native_preview, mcp_review, render, verify, repair, report. After changes_requested, edit video.md BEFORE verifying; do not infer the edit happened. If asked a yes/no question, answer via report without executing anything.\n- authority: source_media (observations and physical assets), selected_video_template (creative/style defaults for new video), or video_md (current video source/edit/review revision/render).\n- completion_gates: zero or more checks needed BEFORE CLAIMING the user's entire requested goal complete: verify, real_playback, human_review. Gates are NOT the immediate next action. For a playable or moving-map result, real_playback matters; for explicit human review/approval, a real human must review the CURRENT revision. Do not require human_review for an ordinary MP4 render. For a factual answer about a setting, no playback is required.\n- reason: a short explanation of the action and important boundary.\n\nReturn ONLY syntactically valid JSON (no Markdown code fences, no text outside JSON), matching the requested JSON schema.\n\nMARKCUT SKILL:\n${skill}\n\nUSER REQUESTS:\n`;
|
|
28
|
+
function schema(size) {
|
|
29
|
+
return {type:'array',minItems:size,maxItems:size,items:{type:'object',additionalProperties:false,properties:{
|
|
30
|
+
id:{type:'string'}, action:{type:'string',enum:['vision','author','storyboard','native_preview','mcp_review','render','verify','repair','report']},
|
|
31
|
+
authority:{type:'string',enum:['source_media','selected_video_template','video_md']},
|
|
32
|
+
completion_gates:{type:'array',uniqueItems:true,items:{type:'string',enum:['verify','real_playback','human_review']}},
|
|
33
|
+
reason:{type:'string'},
|
|
34
|
+
},required:['id','action','authority','completion_gates','reason']}};
|
|
35
|
+
}
|
|
36
|
+
console.log(`Target: codex/${provider}/${model}; artifacts: ${output}; cases=${cases.length}; batch-size=${batchSize}`);
|
|
37
|
+
for (let offset = 0; offset < cases.length; offset += batchSize) {
|
|
38
|
+
const selected = cases.slice(offset, offset+batchSize);
|
|
39
|
+
const batchDir = join(output, `batch-${String(1+offset/batchSize).padStart(2,'0')}`);
|
|
40
|
+
mkdirSync(batchDir);
|
|
41
|
+
const prompt = promptIntro + JSON.stringify(selected.map(({id,request})=>({id,request})), null, 2) + '\n';
|
|
42
|
+
const schemaFile = join(batchDir,'schema.json');
|
|
43
|
+
const responseFile = join(batchDir,'raw-response.txt');
|
|
44
|
+
writeFileSync(join(batchDir,'prompt.txt'),prompt);
|
|
45
|
+
writeFileSync(schemaFile,JSON.stringify(schema(selected.length),null,2));
|
|
46
|
+
const cmd=['exec','--ephemeral','--skip-git-repo-check','--ignore-rules','-s','read-only','-C',batchDir,
|
|
47
|
+
'-c',`model_provider="${provider}"`,'-m',model,'-c','model_reasoning_effort="low"',
|
|
48
|
+
'--json','--output-schema',schemaFile,'--output-last-message',responseFile,'-'];
|
|
49
|
+
const result=spawnSync('codex',cmd,{cwd:batchDir,input:prompt,encoding:'utf8',timeout:150_000,maxBuffer:12_000_000});
|
|
50
|
+
writeFileSync(join(batchDir,'codex-events.jsonl'),result.stdout??'');
|
|
51
|
+
writeFileSync(join(batchDir,'codex-stderr.txt'),result.stderr??'');
|
|
52
|
+
const meta={index:1+offset/batchSize,cases:selected.map(c=>c.id),exitCode:result.status,error:result.error?.message??null,
|
|
53
|
+
modelMetadataWarning:(result.stdout??'').includes('Model metadata for'),strictJsonFormat:true};
|
|
54
|
+
run.batches.push(meta);
|
|
55
|
+
writeFileSync(join(output,'run.json'),JSON.stringify(run,null,2));
|
|
56
|
+
if (result.status!==0) {console.error(`FAIL Codex batch ${meta.index} exit=${result.status} ${result.error?.message??(result.stderr??'').slice(-450)}`);process.exit(1);}
|
|
57
|
+
const raw=readFileSync(responseFile,'utf8');
|
|
58
|
+
let response;
|
|
59
|
+
try {response=JSON.parse(raw);} catch(error) {
|
|
60
|
+
meta.strictJsonFormat=false; run.strictJsonFormat=false;
|
|
61
|
+
const match=raw.trim().match(/^```(?:json)?\s*\n([\s\S]*?)\n```$/);
|
|
62
|
+
if (!match) {console.error(`FAIL batch ${meta.index}: ${error.message}; not one complete JSON fence`);process.exit(1);}
|
|
63
|
+
try {response=JSON.parse(match[1]);} catch(inner) {console.error(`FAIL batch ${meta.index}: invalid JSON inside fence: ${inner.message}`);process.exit(1);}
|
|
64
|
+
}
|
|
65
|
+
if (!Array.isArray(response)) {
|
|
66
|
+
// One request may naturally produce one JSON object even when Codex ignores
|
|
67
|
+
// the array output schema. Keep this as a recorded schema violation.
|
|
68
|
+
if (selected.length === 1 && response && typeof response === 'object' && response.id === selected[0].id) {
|
|
69
|
+
response = [response];
|
|
70
|
+
meta.strictJsonFormat = false;
|
|
71
|
+
run.strictJsonFormat = false;
|
|
72
|
+
} else {console.error(`FAIL batch ${meta.index}: output is not an array`);process.exit(1);}
|
|
73
|
+
}
|
|
74
|
+
writeFileSync(join(batchDir,'normalized-responses.json'),JSON.stringify(response,null,2)+'\n');
|
|
75
|
+
writeFileSync(join(output,'run.json'),JSON.stringify(run,null,2));
|
|
76
|
+
decisions.push(...response);
|
|
77
|
+
console.log(`Batch ${meta.index}: ${response.length} decisions; strict JSON: ${meta.strictJsonFormat?'yes':'NO (fenced)'}`);
|
|
78
|
+
}
|
|
79
|
+
const combined=join(output,'responses.json');
|
|
80
|
+
writeFileSync(combined,JSON.stringify(decisions,null,2)+'\n');
|
|
81
|
+
const scoring=spawnSync(process.execPath,[join(here,'check.mjs'),combined],{encoding:'utf8',maxBuffer:4_000_000});
|
|
82
|
+
writeFileSync(join(output,'score.txt'),(scoring.stdout??'')+(scoring.stderr??''));
|
|
83
|
+
process.stdout.write(scoring.stdout??'');
|
|
84
|
+
process.stderr.write(scoring.stderr??'');
|
|
85
|
+
if (!run.strictJsonFormat) console.log('FORMAT WARNING: at least one batch ignored the output schema (fences or singleton object) (raw output preserved).');
|
|
86
|
+
if (run.batches.some(b=>b.modelMetadataWarning)) console.log('Codex warning: missing model metadata; fallback metadata was used.');
|
|
87
|
+
process.exit(scoring.status??1);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# ChatGPT MCP review: external behavior contract
|
|
2
|
+
|
|
3
|
+
The `markcut.preview({path})` tool accepts an absolute Markcut `.md` path or a supported NeoY mounted HTTPS Markdown URL. This tool is for **interactive viewing and human review** inside ChatGPT, not for parsing unrelated Markdown or editing the supplied file. A `relay` correlation object is optional; use it only when the task already belongs to Agents Relay.
|
|
4
|
+
|
|
5
|
+
The tool starts compilation and publication of an immutable video revision. The returned operation or player resource can precede successful compilation. The hosted player may show stages before the video is playable. Record the revision/content hash when ready; validate in the actual hosted player.
|
|
6
|
+
|
|
7
|
+
Human review behavior:
|
|
8
|
+
|
|
9
|
+
- Draft comments may belong to a scene or a playback timestamp; submitting feedback sends `decision: changes_requested` with context. The agent edits the **original Markcut Markdown** and calls `markcut.preview` again for a new revision.
|
|
10
|
+
- An explicit `decision: approved` is tied to the reviewed content hash/revision. Never apply it to a changed source file. Unsaved comments are not an approval.
|
|
11
|
+
- Earlier preview revisions are read-only after supersession. Failed compilation does not invalidate previously successful revisions, but does not authorize approval of an unrendered new one.
|
|
12
|
+
- Browser TTS is a **preview playback option**, not an authoritative representation of the voice used in rendered MP4. Confirm the final file's audio independently.
|
|
13
|
+
|
|
14
|
+
For implementation-specific caching, publishing and iframe internals, developers can consult the Markcut repository `docs/mcp-static-preview.md`. Such internals are not mandatory context for ordinary video authoring.
|
|
@@ -1,58 +1,30 @@
|
|
|
1
|
-
# Markcut
|
|
1
|
+
# Markcut preview: diagnose by evidence
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Load only for a failed or uncertain native preview, map scene, audio/subtitle playback, MCP compilation, or hosted ChatGPT player. Read the target project's applicable rules and, for browser automation, the separately discovered WebHelm Skill. Never confuse a successful CLI parse or published resource with successfully watched video.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Three independent gates
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. **Native player:** `npx @lalalic/markcut preview /absolute/path/video.md --no-browser --port <free-port>`; use `webhelm session start --url http://localhost:<free-port>/` in the managed Chrome and inspect actual scene frames, controls, maps, audio and captions. Do not use the Remotion Studio UI as evidence of native Markcut preview.
|
|
8
|
+
2. **MCP compilation:** invoke Neo's `markcut.preview({path})` on the **same** source document. Record compilation state, resolved revision/content hash and published resources, or the exact compiler failure. The MCP tool returns asynchronously; a queued operation is not a completed preview.
|
|
9
|
+
3. **Hosted ChatGPT player:** open the actual embedded video player, then play, pause and seek representative scenes, verify video frames and audible music/voice, and inspect subtitles and map movement. If the iframe did not load, report `hosted_player_unavailable`, not a media or mapping failure.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
Use WebHelm's supported CLI help and paired `session start` / `session exec` / `session stop` workflow; release only task-owned sessions. For long inspections, maintain the session heartbeat. Refresh/inspect the captured DOM after navigation; never infer playback from metadata alone.
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
node src/render/cli.mjs preview <project-repo>/vlog/runs/<run>/video.md --port=3014 --no-browser
|
|
13
|
+
## Symptom → investigation
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
| Symptom | Check |
|
|
16
|
+
|---|---|
|
|
17
|
+
| Blank scene or black narration tail | Scene timing, generated image/video duration, `isBackground` for one full-length visual; inspect first/last frames. |
|
|
18
|
+
| Asset 404/empty frame | `markcut verify`, source-relative paths, asset publication, media response status, actual decoded frame. |
|
|
19
|
+
| Frozen animation | Tab visibility/throttling, render readiness, timeline clock; bring owned tab to foreground and retest. |
|
|
20
|
+
| Silent BGM or speech | Response status, decoded audio, playback paused/muted, browser AudioContext state, advancing frames, and nonzero analyzer samples/listen when available. Browser TTS should retain BGM and environmental audio. |
|
|
21
|
+
| Missing captions or wrong words | Current script, generated audio, VTT cue timing, actual displayed subtitles. |
|
|
22
|
+
| Map missing or poorly framed | Real tiles/polyline, actual camera center/zoom, relevant Maps/Routes API error, GPS/waypoint values; for `map view:route`, omitted zoom should auto-fit. |
|
|
23
|
+
| Hosted iframe differs from native | Inspect the hosted iframe and its real console/network errors, resource version and CSP restrictions; native success is not hosted success. |
|
|
24
|
+
| Review controls stale | Compare active published revision/hash and current review message; superseded revisions cannot authorize new approval. |
|
|
15
25
|
|
|
16
|
-
|
|
26
|
+
Sanitize screenshots/logs: never expose access tokens, map API keys, cookies, private GPS or private media URLs. Treat HTTP 200 or a decoded audio buffer as necessary but not sufficient evidence of effective playback. An inferred road route is not proof of recorded GPS movement.
|
|
17
27
|
|
|
18
|
-
|
|
28
|
+
## Recovery, verification and cleanup
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Install a console capture **before navigating**, then check after the relevant scene loads:
|
|
23
|
-
|
|
24
|
-
cdp("Page.addScriptToEvaluateOnNewDocument", source="""
|
|
25
|
-
window.__markcutErrors=[];
|
|
26
|
-
for(const level of ['error','warn']) {
|
|
27
|
-
const original=console[level];
|
|
28
|
-
console[level]=function(...args) {
|
|
29
|
-
window.__markcutErrors.push({level,message:args.map(String).join(' ')});
|
|
30
|
-
return original.apply(this,args);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
""")
|
|
34
|
-
goto_url("http://localhost:3014/")
|
|
35
|
-
print(js("window.__markcutErrors"))
|
|
36
|
-
|
|
37
|
-
Save these Python statements in a file and use webhelm session exec <id> --code-file <path> when quoting is difficult. For DevTools/Network use cdp() and sanitized resource entries; **never print Google key= query values**, access tokens, private coordinates or cookies.
|
|
38
|
-
|
|
39
|
-
Observed signatures:
|
|
40
|
-
- ApiNotActivatedMapError: confirm API key's Google Cloud project, enable Maps JavaScript API on that project; inspect billing/referrer permissions based on evidence.
|
|
41
|
-
- Legacy Directions Service not enabled + DIRECTIONS_ROUTE REQUEST_DENIED: modernize from DirectionsService to google.maps.routes.Route.computeRoutes and enable Routes API for the owning Cloud project. Routes API may incur costs. Check ComputeRoutes RPC status **and** actual rendered path. Cache identical requests across Remotion seek/remount to reduce bills.
|
|
42
|
-
- DirectionsService deprecated or Remotion license warning alone is not the root cause. HTTP 200 and a static image do not prove an animated route.
|
|
43
|
-
|
|
44
|
-
## MCP tool and fresh ChatGPT thread/turn
|
|
45
|
-
|
|
46
|
-
Only after native preview passes, call the **actual NeoY markcut.preview** on that same absolute run video.md. Confirm returned resource URI/player version, revision/content hash, scene duration, map props, audio/VTT. This is a **compilation/resource gate**, not hosted-player approval.
|
|
47
|
-
|
|
48
|
-
For fresh MCP verification, when available use the NeoY chatgpt.thread capability (synchronous platform CLI), record verified thread ID and URL; an existing thread can use chatgpt.turn when suitable. Tell the new thread to call markcut.preview, **describe the image and play/seek 6–12 seconds in its own embedded player**, report errors, and **not approve**. Use a new thread for stale preview resource/cache, iframe isolation, or version testing. A thread still generating or displaying "Connection interrupted" may not have mounted the MCP App. Never claim map failure when only a DIL iframe exists: record "hosted iframe not instantiated" and retry/reload conservatively.
|
|
49
|
-
|
|
50
|
-
Open the resulting ChatGPT URL in an **exclusive Browser Workspace session**. Confirm iframe[title="Markcut Preview"], not just localhost. Via cdp("Target.getTargets") identify the web-sandbox.oaiusercontent.com **iframe target**. The actual Markcut DOM can be in that target's nested same-origin about:blank iframe. Use js(expression,target_id=<iframe-target>) to inspect nestedFrame.contentDocument, its body, buttons, .gm-style, map tiles, VTT/audio and errors. Do not bypass cross-origin protections. Observe actual picture at 6–9 and 9–12 seconds, and real pause/seek, not just DOM metadata. Never click Approve or Request changes for a diagnostic.
|
|
51
|
-
|
|
52
|
-
Capture nested iframe Console errors and Network failure statuses. Inspect effective outer sandbox response/host CSP as well as nested document: no CSP meta in about:blank **does not** prove Google Maps is allowed.
|
|
53
|
-
|
|
54
|
-
**2026-10-15 observed MCP-only failure:** native player showed Google tiles and Route.computeRoutes HTTP 200, whereas fresh hosted iframe Console repeatedly said "The Google Maps JavaScript API failed to load. Error: The Google Maps JavaScript API could not load." At ~6–7s it showed zero map nodes/tiles and repeated Maps JS requests. The exact CSP/network rejection was **not proven**. Do not mark MCP fixed because native passes.
|
|
55
|
-
|
|
56
|
-
## Verification evidence and cleanup
|
|
57
|
-
|
|
58
|
-
Record native / MCP compiler / hosted iframe as independent PASS/FAIL/UNKNOWN gates in the run's qa.md. Include UTC/local timestamp, commit/build version, thread ID, session ID, source video.md, scene time range, screenshots, sanitized errors/status, tests, unresolved blockers. Keep private GPS and keys out of logs and public mounts. After a fix rebuild Markcut native player and MCP bundle, verify deployed resource/version, repeat browser checks in a fresh thread if cache persists. Relay still owns task review/completion and approval is separate. Always webhelm session stop <id>, close exclusive tabs, and stop only your debug process.
|
|
30
|
+
Fix the failing layer, then repeat **that** gate and any downstream gates it affects. For MCP player/server code changes, rebuild the relevant bundle and reload **only** its provider via the supported Neo provider controls; never restart the entire Neo MCP app as a shortcut. Keep the previous successful preview revision available. On compilation or host failure, report the failed gate, revision, scene/time and sanitized evidence; do not silently claim approval or completed delivery. Stop owned preview servers and WebHelm sessions after inspection.
|