From f612b191fcc705ad9948c06bd486274dc1dbaee5 Mon Sep 17 00:00:00 2001 From: Research Assistant Date: Fri, 15 May 2026 23:38:01 +0800 Subject: [PATCH] feat: async snapshot refresh after heavy operations complete --- paperforge/plugin/main.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/paperforge/plugin/main.js b/paperforge/plugin/main.js index 44078148..3bb1131b 100644 --- a/paperforge/plugin/main.js +++ b/paperforge/plugin/main.js @@ -2734,6 +2734,7 @@ class PaperForgeSettingTab extends PluginSettingTab { } // Refresh status regardless this._memoryStatusText = memoryState.getMemoryStatusText(vp); + this._refreshSnapshots(vp); } }); }; @@ -2774,11 +2775,29 @@ class PaperForgeSettingTab extends PluginSettingTab { this._lastSyncTime = new Date().toLocaleTimeString(); this.plugin._lastSyncTime = this._lastSyncTime; } - this.display(); // re-render + this.display(); + this._refreshSnapshots(vp); } }); } + _refreshSnapshots(vp) { + const py = memoryState.getCachedPython(vp, this.plugin.settings); + const { execFile } = require('node:child_process'); + const args = [...py.extraArgs, '-m', 'paperforge', '--vault', vp, 'runtime-health', '--json']; + + this._refreshPending = true; + + execFile(py.path, args, { cwd: vp, timeout: 30000, windowsHide: true }, + (err, stdout, stderr) => { + this._refreshPending = false; + this._memoryStatusText = memoryState.getMemoryStatusText(vp); + this._embedStatusText = memoryState.getVectorStatusText(vp); + this.display(); + } + ); + } + _renderFeaturesTab(containerEl) { // --- Section: Skills --- containerEl.createEl('h3', { text: 'Skills' }); @@ -3443,6 +3462,7 @@ class PaperForgeSettingTab extends PluginSettingTab { } this._embedStderr = ''; this.display(); + this._refreshSnapshots(vp); } });