Add durable AI cancellation and undoable output application
This commit is contained in:
@@ -5,7 +5,7 @@ import type { LedgerSnapshot } from './ledger.ts';
|
||||
|
||||
/** The footprint follows ownership; geometry does not decide which canvas owns an object. */
|
||||
export function operationCanvases(intent: OperationIntent, document: Document): readonly Id[] {
|
||||
if(intent.operationType==='asset.upload')return[];
|
||||
if(intent.operationType==='asset.upload'||intent.operationType==='run.cancel')return[];
|
||||
if (intent.canvasIds?.length) return intent.canvasIds;
|
||||
const ids = new Set<Id>();
|
||||
for (const change of intent.changes) {
|
||||
@@ -30,7 +30,7 @@ export function operationCanvases(intent: OperationIntent, document: Document):
|
||||
export function replayPending(base: Document, ledger: LedgerSnapshot, registry: Registry): Document {
|
||||
let document = base;
|
||||
for (const record of [...ledger.operations.values()].sort((a, b) => a.intent.sequence - b.intent.sequence)) {
|
||||
if (record.phase === 'resolved' || record.intent.operationType!=='document.change') continue;
|
||||
if (record.phase === 'resolved' || !['document.change','run.apply'].includes(record.intent.operationType)) continue;
|
||||
for (const change of record.intent.changes) {
|
||||
if (satisfied(document, change)) continue;
|
||||
document = applyChanges(document, [change]);
|
||||
|
||||
Reference in New Issue
Block a user