diff options
| author | Agando <roduccomm@gmail.com> | 2026-06-06 06:00:27 +0200 |
|---|---|---|
| committer | Agando <roduccomm@gmail.com> | 2026-06-06 06:00:27 +0200 |
| commit | ccc7d9956559d2195e20345e7a794662b52cd403 (patch) | |
| tree | 757354fbfec5c75b4577b2cb620d5ab1582e19b1 /modules/core/virtual-fs.js | |
| parent | b538577cd0a4292e4cd4ca1c9f9829fc7e133caa (diff) | |
auto: 2026-06-06_06:00 changes
Diffstat (limited to 'modules/core/virtual-fs.js')
| -rw-r--r-- | modules/core/virtual-fs.js | 32 |
1 files changed, 31 insertions, 1 deletions
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); } |