Add quiescent canonical recovery sessions without rewriting requests

This commit is contained in:
2026-11-08 01:41:23 +08:00
parent 0c7fae6e32
commit a0417b4811
11 changed files with 276 additions and 20 deletions
+6
View File
@@ -114,6 +114,12 @@ export function createFoundryPersistence(options: { workspaceId: Id; rootId: Id;
}
return Object.freeze({
supportsRequest: (request: FrozenRequest) => request.protocolVersion === 2,
async read(signal: AbortSignal) {
const loaded=await loadFoundryModel(options.transport,options.workspaceId,options.rootId,options.registry,signal);
if(loaded.status!=='ready')throw fault('canonical_migration_required');
if(loaded.document.projectId!==options.rootId)throw fault('project_mismatch');
return loaded;
},
compile(intent: OperationIntent, requestId: Id, snapshot: EngineSnapshot) {
if (snapshot.document.projectId !== options.rootId || !uuid.test(intent.id) || !uuid.test(requestId) || intent.operationType !== 'document.change' || intent.operationSchemaVersion !== 1) throw fault('operation_interpreter_unavailable');
const canvasIds = [...new Set(intent.canvasIds)].sort(), expectedVersions: Record<Id, number> = {};