Connect durable canvas runtime to canonical Foundry protocol
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user