From ccc7d9956559d2195e20345e7a794662b52cd403 Mon Sep 17 00:00:00 2001 From: Agando Date: Sat, 6 Jun 2026 06:00:27 +0200 Subject: auto: 2026-06-06_06:00 changes --- modules/core/virtual-fs.js | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'modules/core/virtual-fs.js') diff --git a/modules/core/virtual-fs.js b/modules/core/virtual-fs.js index 3ab25b1..59ab18b 100644 --- a/modules/core/virtual-fs.js +++ b/modules/core/virtual-fs.js @@ -520,15 +520,25 @@ class VirtualFileSystem { checkpoint(name) { if (!name) name = new Date().toISOString(); const createdAt = new Date().toISOString(); + // Strip system dirs to avoid fractal bloat — snapshots/sessions/trash + // don't belong inside a checkpoint of user data + const root = JSON.parse(JSON.stringify(this.root)); + if (root && root.content) { + delete root.content['_snapshots']; + delete root.content['_sessions']; + delete root.content['.trash']; + } const data = { version: 1, createdAt, - root: JSON.parse(JSON.stringify(this.root)), + root, currentPath: [...this.currentPath] }; if (!this.readDir('/_snapshots')) { this.mkdirRecursive('/_snapshots'); } + // Strip _snapshots from the serialized data too (redundant safety) + data.root = root; this.fsWriteJSON('/_snapshots/checkpoint-' + name + '.json', data); this.saveToStorage(); // Auto-manage: keep max 10 checkpoints, delete oldest @@ -568,6 +578,26 @@ class VirtualFileSystem { } return false; } + // Reset VFS — wipes everything, removes localStorage keys + reset() { + this.root = { type: 'dir', content: {} }; + this.currentPath = []; + this._conceptCache = null; + try { + localStorage.removeItem('webx11_filesystem_v2'); + localStorage.removeItem('webx11_filesystem'); + } catch (e) {} + return true; + } + // Empty trash — permanently delete all trashed files + emptyTrash() { + if (this.root.content['.trash']) { + delete this.root.content['.trash']; + this.saveToStorage(); + return true; + } + return false; + } // Old-compat aliases for agent tools and SkillsModule read(path) { return this.readFile(path); } write(path, content) { return this.writeFile(path, content); } -- cgit v1.2.3