Connect durable canvas runtime to canonical Foundry protocol

This commit is contained in:
2026-11-07 22:53:00 +08:00
parent 10374c3696
commit 8a19909716
16 changed files with 406 additions and 19 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ export async function openProjectEngine(options: EngineOptions) {
const last = new Map<Id, Id>();
for (const record of [...previous.ledger.operations.values()].sort((a, b) => a.intent.sequence - b.intent.sequence)) if (record.phase !== 'resolved') for (const canvas of record.intent.canvasIds) last.set(canvas, record.intent.id);
const dependencies = [...new Set([...intent.dependencies, ...intent.canvasIds.flatMap(canvas => last.has(canvas) ? [last.get(canvas)!] : [])])];
const basePresence: Record<Id, 'absent' | 'exists'> = {};
const basePresence: Record<Id, 'absent' | 'exists'> = Object.create(null);
for (const change of intent.changes) if (change.kind === 'element') basePresence[change.id] = change.before ? 'exists' : 'absent'; else if (change.kind === 'field') basePresence[change.target.id] ??= 'exists';
ledger.add(freeze({ ...intent, dependencies }), basePresence);
}