fix(sandbox): ignore generated output and clean failed drafts

This commit is contained in:
xiaohan.yuan committed 2026-10-18 13:03:34 +08:00
1 parent d5512df549
commit 3be45999f7
3 files changed
+17 -7

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ import { assertActive, resolveSandboxPath, within } from './policy'
import { sandboxPathDenied } from './policy-store'
export type Snapshot = Map<string, { hash: string; size: number }>
const excludedDirectories = new Set(['.git', '.ycode', '.tmp', 'node_modules', '.venv', 'venv', '__pycache__'])
const excludedDirectories = new Set(['.git', '.ycode', '.tmp', 'node_modules', '.venv', 'venv', '__pycache__', 'out', 'dist', 'release'])
export async function regularBytes(file: string, fileLimit: number): Promise<Buffer> {
const before = await fs.lstat(file)
if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1 || before.size > fileLimit) throw new Error('快照包含链接、特殊文件或超过策略上限的文件')