fix: refresh artifact API when upgrading a live SQLite host

This commit is contained in:
Agent Workbench Dev
2026-10-30 09:12:49 +08:00
parent 5921b8efdc
commit 6bc3ce442d
27 changed files with 2232 additions and 203 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import { randomUUID, createHash } from 'node:crypto';
export const APP_VERSION = '1.10.0';
export const APP_VERSION = '1.10.1';
export function executionEnvironment() {
const windows = process.platform === 'win32';
+7 -1
View File
@@ -3,6 +3,7 @@ import fs from 'node:fs';
import { Provider } from './provider.mjs';
import { Runtime } from './runtime.mjs';
import { Store, atomicJson, readJson } from './store.mjs';
import { ArtifactStore } from '../core/storage/artifact-store.mjs';
import { createRequestHandler, createSessionPublisher } from './app.mjs';
import { APP_VERSION } from './diagnostics.mjs';
@@ -28,7 +29,12 @@ export function installUpgrade(context, { appDirectory, updateServiceInfo = true
Object.setPrototypeOf(provider, Provider.prototype);
Object.setPrototypeOf(runtime, Runtime.prototype);
runtime.appDirectory = root; runtime.checks = null; runtime.deliveries = null; runtime.codeIndex = null; runtime.changeSets = null; runtime.contextPlans = null; runtime.workspaces = null; runtime.research = null; runtime.engines = null; runtime.browser = null;
store.ensureStorage(); store.claimRuntime();
store.ensureStorage();
// A SQLite host can retain an artifact object from an earlier bundle.
// Reopen the same blobs through the new API without mutating that object;
// oldStoreProperties restores it if installing this handler fails.
store.artifactStore = new ArtifactStore(store.directory);
store.claimRuntime();
store.removeAllListeners('update'); store.on('update', createSessionPublisher(clients));
server.removeAllListeners('request'); server.on('request', handler);
server.prependOnceListener('close', closeStorage);