Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

build(viewer): refresh comparison and README motion proof

To3akaRind572b361ff45
diff --git a/docs/assets/archify-live-proof.gif b/docs/assets/archify-live-proof.gif
index 18d396b5..6d2a6f34 100644
Binary files a/docs/assets/archify-live-proof.gif and b/docs/assets/archify-live-proof.gif differ
diff --git a/docs/assets/archify-live-proof.json b/docs/assets/archify-live-proof.json
index dbf4ab91..26c68814 100644
--- a/docs/assets/archify-live-proof.json
+++ b/docs/assets/archify-live-proof.json
@@ -7,13 +7,13 @@
"fps": 10,
"frameCount": 54,
"durationSeconds": 5.4,
- "bytes": 823003,
- "sha256": "02631974ccff05d13a65cd784a859cca7f22352f3a4d53f3ef83149e266171b3",
+ "bytes": 822852,
+ "sha256": "17fd08d7a62b167f60651bafeef7eb2765e8d00fb60e2e8521b2fd7e0a856f3e",
"scenes": [
{
"id": "signal-flow",
"artifact": "docs/gallery/artifacts/agent-tool-call.workflow.html",
- "artifactSha256": "7d086f7f0af593759c56dd82e0b952bcb1a27a64f960cfc7226f905aa2d010dc",
+ "artifactSha256": "72d8efc3a8896783caee0023519d659bda63ad99fadc05ce524da24ebd143b82",
"hash": "#focus=planner&reach=downstream",
"eyebrow": "WORKFLOW · SIGNAL FLOW",
"title": "Agent Tool Call",
@@ -22,7 +22,7 @@
{
"id": "blueprint",
"artifact": "docs/gallery/artifacts/production-deployment.architecture.html",
- "artifactSha256": "46bc35a5978fd96e842104527342ccb524b0e9d5cadb1dfbc5dac38d7095bc41",
+ "artifactSha256": "54688ab28407718c1b8f76781511f92f87a7cdcb0fdae61a089bd39c65913e7e",
"hash": "#lens=backend~database",
"eyebrow": "ARCHITECTURE · BLUEPRINT",
"title": "Production Deployment",
@@ -31,7 +31,7 @@
{
"id": "classic",
"artifact": "docs/gallery/artifacts/cache-miss.sequence.html",
- "artifactSha256": "590cf92f58921658398953fbf28795cbf054053bf89c2e9f23acd0c827693a53",
+ "artifactSha256": "a94388fe099db0582aa6e3fa2bf771ad619b3ae65736de5aa020fb8ed5d13830",
"hash": "#route=web~db",
"eyebrow": "SEQUENCE · CLASSIC",
"title": "Cache Miss Request",
diff --git a/examples/checkout-platform-delta.html b/examples/checkout-platform-delta.html
index c7988f37..41c34123 100644
--- a/examples/checkout-platform-delta.html
+++ b/examples/checkout-platform-delta.html
@@ -11298,7 +11298,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
var vb = svg.viewBox.baseVal;
var scale = Math.min(1, 1280 / vb.width);
var data = serializeSvg(scale);
- var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));
function createMotionScene(root) {
var rootMatrix = root.getCTM ? root.getCTM() : null;
@@ -11450,73 +11449,99 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
var motionScene = createMotionScene(svg);
return new Promise(function (resolve, reject) {
- var backgroundImage = new Image();
- backgroundImage.onload = function () {
- var canvas = document.createElement('canvas');
- canvas.width = Math.max(2, Math.round(data.width / 2) * 2);
- canvas.height = Math.max(2, Math.round(data.height / 2) * 2);
- var ctx = canvas.getContext('2d');
- var stream = canvas.captureStream(fps);
- var mime = motionMimeType();
- var recorder;
- try {
- recorder = new MediaRecorder(stream, { mimeType: mime, videoBitsPerSecond: 6000000 });
- } catch (err) {
- URL.revokeObjectURL(sourceUrl);
- stream.getTracks().forEach(function (track) { track.stop(); });
- reject(err);
- return;
- }
- var chunks = [];
- var raf = 0;
- var stopped = false;
- var startedAt = performance.now();
- function cleanup() {
- if (stopped) return;
- stopped = true;
- cancelAnimationFrame(raf);
- URL.revokeObjectURL(sourceUrl);
- stream.getTracks().forEach(function (track) { track.stop(); });
+ var sourceUrl = null;
+ var backgroundImage = null;
+ var stream = null;
+ var recorder = null;
+ var raf = 0;
+ var durationTimer = 0;
+ var flushTimer = 0;
+ var settled = false;
+
+ function finish(error, blob) {
+ if (settled) return;
+ // 先锁定终态:停止录制和释放流可能产生晚到的编码事件。
+ settled = true;
+ cancelAnimationFrame(raf);
+ clearTimeout(durationTimer);
+ clearTimeout(flushTimer);
+ if (backgroundImage) {
+ backgroundImage.onload = null;
+ backgroundImage.onerror = null;
}
- function draw(now) {
- var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);
- drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);
- raf = requestAnimationFrame(draw);
+ if (recorder) {
+ recorder.ondataavailable = null;
+ recorder.onerror = null;
+ recorder.onstop = null;
+ try { if (recorder.state !== 'inactive') recorder.stop(); } catch (_) {}
}
- recorder.ondataavailable = function (event) {
- if (event.data && event.data.size) chunks.push(event.data);
- };
- recorder.onerror = function (event) {
- cleanup();
- reject(event.error || exportError('viewer.export.error.mediaRecorder'));
+ if (stream) stream.getTracks().forEach(function (track) { track.stop(); });
+ if (sourceUrl) URL.revokeObjectURL(sourceUrl);
+ if (blob) resolve(blob);
+ else reject(error);
+ }
+
+ try {
+ sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));
+ backgroundImage = new Image();
+ backgroundImage.onload = function () {
+ if (settled) return;
+ try {
+ var canvas = document.createElement('canvas');
+ canvas.width = Math.max(2, Math.round(data.width / 2) * 2);
+ canvas.height = Math.max(2, Math.round(data.height / 2) * 2);
+ var ctx = canvas.getContext('2d');
+ if (!ctx) throw exportError('viewer.export.error.contextUnavailable', { label: 'WebM' });
+ stream = canvas.captureStream(fps);
+ var mime = motionMimeType();
+ recorder = new MediaRecorder(stream, { mimeType: mime, videoBitsPerSecond: 6000000 });
+ var chunks = [];
+ var startedAt = performance.now();
+ function draw(now) {
+ if (settled) return;
+ try {
+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);
+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);
+ raf = requestAnimationFrame(draw);
+ } catch (error) { finish(error); }
+ }
+ recorder.ondataavailable = function (event) {
+ if (!settled && event.data && event.data.size) chunks.push(event.data);
+ };
+ recorder.onerror = function (event) {
+ finish(event.error || exportError('viewer.export.error.mediaRecorder'));
+ };
+ recorder.onstop = function () {
+ if (settled) return;
+ try {
+ var blob = new Blob(chunks, { type: recorder.mimeType || mime });
+ if (!blob.size) throw exportError('viewer.export.error.emptyWebm');
+ finish(null, blob);
+ } catch (error) { finish(error); }
+ };
+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);
+ recorder.start(250);
+ if (settled) return;
+ startedAt = performance.now();
+ raf = requestAnimationFrame(draw);
+ durationTimer = setTimeout(function () {
+ if (settled || recorder.state === 'inactive') return;
+ // 保留最佳努力的编码器 flush;失败后仍通过 stop 收集最后的片段。
+ try { recorder.requestData(); } catch (_) {}
+ if (settled) return;
+ flushTimer = setTimeout(function () {
+ if (settled) return;
+ try { if (recorder.state !== 'inactive') recorder.stop(); }
+ catch (error) { finish(error); }
+ }, 120);
+ }, duration);
+ } catch (error) { finish(error); }
};
- recorder.onstop = function () {
- cleanup();
- var blob = new Blob(chunks, { type: recorder.mimeType || mime });
- if (!blob.size) reject(exportError('viewer.export.error.emptyWebm'));
- else resolve(blob);
+ backgroundImage.onerror = function () {
+ finish(exportError('viewer.export.error.webmBackground'));
};
- drawMotionFrame(ctx, backgroundImage, motionScene, 0);
- recorder.start(250);
- startedAt = performance.now();
- raf = requestAnimationFrame(draw);
- setTimeout(function () {
- if (recorder.state === 'inactive') return;
- // Chromium normally emits the final chunk during stop(), but
- // some embedded browser shells need an explicit encoder flush
- // first. Keep the short grace window bounded and harmless for
- // browsers that already delivered timeslice chunks.
- try { recorder.requestData(); } catch (_) {}
- setTimeout(function () {
- if (recorder.state !== 'inactive') recorder.stop();
- }, 120);
- }, duration);
- };
- backgroundImage.onerror = function () {
- URL.revokeObjectURL(sourceUrl);
- reject(exportError('viewer.export.error.webmBackground'));
- };
- backgroundImage.src = sourceUrl;
+ backgroundImage.src = sourceUrl;
+ } catch (error) { finish(error); }
});
}
@@ -25352,7 +25377,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
var vb = svg.viewBox.baseVal;
var scale = Math.min(1, 1280 / vb.width);
var data = serializeSvg(scale);
- var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));
function createMotionScene(root) {
var rootMatrix = root.getCTM ? root.getCTM() : null;
@@ -25504,73 +25528,99 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
var motionScene = createMotionScene(svg);
return new Promise(function (resolve, reject) {
- var backgroundImage = new Image();
- backgroundImage.onload = function () {
- var canvas = document.createElement('canvas');
- canvas.width = Math.max(2, Math.round(data.width / 2) * 2);
- canvas.height = Math.max(2, Math.round(data.height / 2) * 2);
- var ctx = canvas.getContext('2d');
- var stream = canvas.captureStream(fps);
- var mime = motionMimeType();
- var recorder;
- try {
- recorder = new MediaRecorder(stream, { mimeType: mime, videoBitsPerSecond: 6000000 });
- } catch (err) {
- URL.revokeObjectURL(sourceUrl);
- stream.getTracks().forEach(function (track) { track.stop(); });
- reject(err);
- return;
- }
- var chunks = [];
- var raf = 0;
- var stopped = false;
- var startedAt = performance.now();
- function cleanup() {
- if (stopped) return;
- stopped = true;
- cancelAnimationFrame(raf);
- URL.revokeObjectURL(sourceUrl);
- stream.getTracks().forEach(function (track) { track.stop(); });
+ var sourceUrl = null;
+ var backgroundImage = null;
+ var stream = null;
+ var recorder = null;
+ var raf = 0;
+ var durationTimer = 0;
+ var flushTimer = 0;
+ var settled = false;
+
+ function finish(error, blob) {
+ if (settled) return;
+ // 先锁定终态:停止录制和释放流可能产生晚到的编码事件。
+ settled = true;
+ cancelAnimationFrame(raf);
+ clearTimeout(durationTimer);
+ clearTimeout(flushTimer);
+ if (backgroundImage) {
+ backgroundImage.onload = null;
+ backgroundImage.onerror = null;
}
- function draw(now) {
- var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);
- drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);
- raf = requestAnimationFrame(draw);
+ if (recorder) {
+ recorder.ondataavailable = null;
+ recorder.onerror = null;
+ recorder.onstop = null;
+ try { if (recorder.state !== 'inactive') recorder.stop(); } catch (_) {}
}
- recorder.ondataavailable = function (event) {
- if (event.data && event.data.size) chunks.push(event.data);
- };
- recorder.onerror = function (event) {
- cleanup();
- reject(event.error || exportError('viewer.export.error.mediaRecorder'));
+ if (stream) stream.getTracks().forEach(function (track) { track.stop(); });
+ if (sourceUrl) URL.revokeObjectURL(sourceUrl);
+ if (blob) resolve(blob);
+ else reject(error);
+ }
+
+ try {
+ sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));
+ backgroundImage = new Image();
+ backgroundImage.onload = function () {
+ if (settled) return;
+ try {
+ var canvas = document.createElement('canvas');
+ canvas.width = Math.max(2, Math.round(data.width / 2) * 2);
+ canvas.height = Math.max(2, Math.round(data.height / 2) * 2);
+ var ctx = canvas.getContext('2d');
+ if (!ctx) throw exportError('viewer.export.error.contextUnavailable', { label: 'WebM' });
+ stream = canvas.captureStream(fps);
+ var mime = motionMimeType();
+ recorder = new MediaRecorder(stream, { mimeType: mime, videoBitsPerSecond: 6000000 });
+ var chunks = [];
+ var startedAt = performance.now();
+ function draw(now) {
+ if (settled) return;
+ try {
+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);
+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);
+ raf = requestAnimationFrame(draw);
+ } catch (error) { finish(error); }
+ }
+ recorder.ondataavailable = function (event) {
+ if (!settled && event.data && event.data.size) chunks.push(event.data);
+ };
+ recorder.onerror = function (event) {
+ finish(event.error || exportError('viewer.export.error.mediaRecorder'));
+ };
+ recorder.onstop = function () {
+ if (settled) return;
+ try {
+ var blob = new Blob(chunks, { type: recorder.mimeType || mime });
+ if (!blob.size) throw exportError('viewer.export.error.emptyWebm');
+ finish(null, blob);
+ } catch (error) { finish(error); }
+ };
+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);
+ recorder.start(250);
+ if (settled) return;
+ startedAt = performance.now();
+ raf = requestAnimationFrame(draw);
+ durationTimer = setTimeout(function () {
+ if (settled || recorder.state === 'inactive') return;
+ // 保留最佳努力的编码器 flush;失败后仍通过 stop 收集最后的片段。
+ try { recorder.requestData(); } catch (_) {}
+ if (settled) return;
+ flushTimer = setTimeout(function () {
+ if (settled) return;
+ try { if (recorder.state !== 'inactive') recorder.stop(); }
+ catch (error) { finish(error); }
+ }, 120);
+ }, duration);
+ } catch (error) { finish(error); }
};
- recorder.onstop = function () {
- cleanup();
- var blob = new Blob(chunks, { type: recorder.mimeType || mime });
- if (!blob.size) reject(exportError('viewer.export.error.emptyWebm'));
- else resolve(blob);
+ backgroundImage.onerror = function () {
+ finish(exportError('viewer.export.error.webmBackground'));
};
- drawMotionFrame(ctx, backgroundImage, motionScene, 0);
- recorder.start(250);
- startedAt = performance.now();
- raf = requestAnimationFrame(draw);
- setTimeout(function () {
- if (recorder.state === 'inactive') return;
- // Chromium normally emits the final chunk during stop(), but
- // some embedded browser shells need an explicit encoder flush
- // first. Keep the short grace window bounded and harmless for
- // browsers that already delivered timeslice chunks.
- try { recorder.requestData(); } catch (_) {}
- setTimeout(function () {
- if (recorder.state !== 'inactive') recorder.stop();
- }, 120);
- }, duration);
- };
- backgroundImage.onerror = function () {
- URL.revokeObjectURL(sourceUrl);
- reject(exportError('viewer.export.error.webmBackground'));
- };
- backgroundImage.src = sourceUrl;
+ backgroundImage.src = sourceUrl;
+ } catch (error) { finish(error); }
});
}
diff --git a/examples/checkout-platform-delta.receipt.json b/examples/checkout-platform-delta.receipt.json
index 54f0ba18..42a12276 100644
--- a/examples/checkout-platform-delta.receipt.json
+++ b/examples/checkout-platform-delta.receipt.json
@@ -219,8 +219,8 @@
"Boundary identity is conservatively derived from kind + label."
],
"artifact": {
- "sha256": "bb6990163c18b2bc67a920f7b5a8c55a2f06ce4af5f8a039fb6e7e7897175bd4",
- "bytes": 2123905
+ "sha256": "10e48f4467363a2ed53d62691d7c00e2bd539d78e1a372b626c5c8753cd28fe2",
+ "bytes": 2126367
},
"validation": {
"checksPassed": 28,