WuYongJie 1b6425b552 feat(desktop): connect native Pi sessions with scoped rules and recovery
Track the fixed PhotoCraft source baseline with the existing native client integration. Use the actual Pi SDK for normal sends, durable session recovery, demand-loaded enterprise rules and checked undoable canvas tools. Retain request identities and never resend unknown inference. Include local packaging and real-call acceptance evidence.
2026-10-22 10:49:58 +08:00

9 lines
482 B
JavaScript

import fs from 'node:fs/promises';
import path from 'node:path';
import os from 'node:os';
export async function cleanup(dir) {
const resolved = await fs.realpath(dir), temp = await fs.realpath(os.tmpdir());
if (path.dirname(resolved).toLowerCase() !== temp.toLowerCase() || !/^(jiansun-pi-|pi-json-sdk-|pi-length-|pi-recovery-)/.test(path.basename(resolved))) throw Error('拒绝清理非本测试创建的目录');
await fs.rm(resolved, { recursive: true, force: true });
}