Separate cooperative copy planning from durable checkpoint cadence

This commit is contained in:
2026-11-10 19:28:10 +08:00
parent 8958d835b9
commit 64ed8fe57a
5 changed files with 48 additions and 4 deletions
@@ -41,6 +41,7 @@ export function createDuplicatePlanner(document:Document,registry:Registry,selec
function allocate(id:Id,kind:'elements'|'canvases'){const map=suppliedMapping?.[kind],value=map&&Object.hasOwn(map,id)?map[id]:idFactory();if(typeof value!=='string'||!value||used.has(value))throw fault('duplicate_identity',[value]);used.add(value);return value;}
return Object.freeze({
ready():boolean{return !sourceChecks&&state.phase==='emit'&&state.emitted===0;},
progress(){return Object.freeze({phase:state.phase,steps:state.steps,allocated:state.elementIds.length+state.canvasIds.length});},
checkpoint():DuplicateCheckpoint{return freeze(clone(state));},
step():boolean{
if(sourceChecks){if(sourceChecks.next().done)sourceChecks=undefined;return false;}