u
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { defineTool, ToolError } from 'libllmorbiter';
|
||||
import { getStore } from '../db/store.js';
|
||||
import { isReadOnlyDatabasePath, prepareVfs } from './vfs.js';
|
||||
import { isSkillPath } from './skill.js';
|
||||
|
||||
@@ -97,18 +96,12 @@ export function createRmTool({ googleAuthId }) {
|
||||
const vfsRoot = await prepareVfs({ googleAuthId });
|
||||
const { abs, size } = deleteVfsFile(vfsRoot, clean);
|
||||
|
||||
// Database first. If this throws, the file is still on disk — recoverable, and the row
|
||||
// still exists to describe it. Doing it the other way round would leave a blob on
|
||||
// disk that the next prepareVfs hydration would restore, silently undoing the delete.
|
||||
const store = await getStore();
|
||||
const res = await store.modelvfs.delete(googleAuthId, clean);
|
||||
|
||||
fs.unlinkSync(abs);
|
||||
|
||||
const wasSkill = isSkillPath(clean);
|
||||
const result = {
|
||||
success: true,
|
||||
deleted: res?.deleted !== false,
|
||||
deleted: true,
|
||||
filename: clean,
|
||||
size,
|
||||
message: `Deleted "${clean}" (${size} bytes). This cannot be undone.`,
|
||||
|
||||
Reference in New Issue
Block a user