






















@@ -387,44 +387,49 @@ export class MemoryIndexManager extends MemoryManagerEmbeddingOps implements Mem
387387}
388388this.sources = new Set(effectiveSettings.sources);
389389this.db = this.openDatabase();
390-this.providerKey = this.computeProviderKey();
391-this.cache = {
392-enabled: effectiveSettings.cache.enabled,
393-maxEntries: effectiveSettings.cache.maxEntries,
394-};
395-this.fts = { enabled: effectiveSettings.query.hybrid.enabled, available: false };
396-this.ensureSchema();
397-this.vector = {
398-enabled: effectiveSettings.store.vector.enabled,
399-available: null,
400-extensionPath: effectiveSettings.store.vector.extensionPath,
401-};
402-const meta = this.readMeta();
403-if (meta?.vectorDims) {
404-this.vector.dims = meta.vectorDims;
405-}
406-const initialIndexIdentity = this.resolveCurrentIndexIdentityState({
407- meta,
408-providerKeyKnown: Boolean(params.providerResult),
409-});
410-this.indexIdentityState = initialIndexIdentity;
411-this.indexIdentityDirty =
412-initialIndexIdentity.status === "mismatched" ||
413-(initialIndexIdentity.status === "missing" && this.sources.has("memory"));
414-const transient = params.purpose === "status" || params.purpose === "cli";
415-if (!transient) {
416-this.ensureWatcher();
417-this.ensureSessionListener();
418-this.ensureIntervalSync();
419-}
420-this.dirty = resolveInitialMemoryDirty({
421-hasMemorySource: this.sources.has("memory"),
422-statusOnly: params.purpose === "status",
423-hasIndexedMeta: Boolean(meta),
424-});
425-this.batch = this.resolveBatchConfig();
426-if (!transient) {
427-this.ensureSessionStartupCatchup();
390+try {
391+this.providerKey = this.computeProviderKey();
392+this.cache = {
393+enabled: effectiveSettings.cache.enabled,
394+maxEntries: effectiveSettings.cache.maxEntries,
395+};
396+this.fts = { enabled: effectiveSettings.query.hybrid.enabled, available: false };
397+this.ensureSchema();
398+this.vector = {
399+enabled: effectiveSettings.store.vector.enabled,
400+available: null,
401+extensionPath: effectiveSettings.store.vector.extensionPath,
402+};
403+const meta = this.readMeta();
404+if (meta?.vectorDims) {
405+this.vector.dims = meta.vectorDims;
406+}
407+const initialIndexIdentity = this.resolveCurrentIndexIdentityState({
408+ meta,
409+providerKeyKnown: Boolean(params.providerResult),
410+});
411+this.indexIdentityState = initialIndexIdentity;
412+this.indexIdentityDirty =
413+initialIndexIdentity.status === "mismatched" ||
414+(initialIndexIdentity.status === "missing" && this.sources.has("memory"));
415+const transient = params.purpose === "status" || params.purpose === "cli";
416+if (!transient) {
417+this.ensureWatcher();
418+this.ensureSessionListener();
419+this.ensureIntervalSync();
420+}
421+this.dirty = resolveInitialMemoryDirty({
422+hasMemorySource: this.sources.has("memory"),
423+statusOnly: params.purpose === "status",
424+hasIndexedMeta: Boolean(meta),
425+});
426+this.batch = this.resolveBatchConfig();
427+if (!transient) {
428+this.ensureSessionStartupCatchup();
429+}
430+} catch (err) {
431+closeMemoryDatabase(this.db);
432+throw err;
428433}
429434}
430435此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。