feat: complete WorkBuddy parity and Windows release workflow
This commit is contained in:
1 parent
143516b3a8
commit
d5512df549
434 files changed
+54977
-1854
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { rm } from 'node:fs/promises'
|
||||
import { join, relative, resolve, sep } from 'node:path'
|
||||
|
||||
/** Encoded identity is one path component even for imported/untrusted session identifiers. */
|
||||
export function subagentSessionDirectory(userData: string, sessionId: string): string {
|
||||
return join(userData, 'subagent-sessions', 'session-' + Buffer.from(sessionId).toString('base64url'))
|
||||
}
|
||||
export async function removeSubagentTranscripts(userData: string, sessionId: string): Promise<void> {
|
||||
const base = resolve(userData, 'subagent-sessions')
|
||||
const target = resolve(subagentSessionDirectory(userData, sessionId))
|
||||
const child = relative(base, target)
|
||||
if (!child.startsWith('session-') || child.includes(sep) || child === 'session-') throw new Error('无效的子智能体记录目录')
|
||||
await rm(target, { recursive: true, force: true })
|
||||
}
|
||||
Reference in new issue
Block a user