fix: use resolved ipc dirs for recovery flow

This commit is contained in:
Eyejoker
2026-03-23 07:18:47 +09:00
parent 9def49f7fb
commit f5eae07657
6 changed files with 35 additions and 13 deletions

View File

@@ -29,7 +29,11 @@ function assertValidRuntimeSegment(segment: string, label: string): void {
if (!RUNTIME_SEGMENT_PATTERN.test(segment)) {
throw new Error(`Invalid ${label} "${segment}"`);
}
if (segment.includes('/') || segment.includes('\\') || segment.includes('..')) {
if (
segment.includes('/') ||
segment.includes('\\') ||
segment.includes('..')
) {
throw new Error(`Invalid ${label} "${segment}"`);
}
}
@@ -76,7 +80,10 @@ export function resolveTaskRuntimeIpcPath(
return ipcPath;
}
export function resolveTaskSessionsPath(folder: string, taskId: string): string {
export function resolveTaskSessionsPath(
folder: string,
taskId: string,
): string {
assertValidGroupFolder(folder);
assertValidRuntimeSegment(taskId, 'task ID');
const sessionsBaseDir = path.resolve(DATA_DIR, 'sessions');