(sessionId: string, connectionId: string, wirePaths: readonly string[])
| 466 | |
| 467 | const fsWatchHandler = { |
| 468 | async add(sessionId: string, connectionId: string, wirePaths: readonly string[]) { |
| 469 | try { |
| 470 | const session = await sessionService.get(sessionId); |
| 471 | |
| 472 | const realCwd = await fspPromises.realpath(session.metadata.cwd); |
| 473 | |
| 474 | fsWatcher.bindSessionCwd(sessionId, realCwd); |
| 475 | const absPaths: string[] = []; |
| 476 | for (const p of wirePaths) { |
| 477 | const safe = await resolveSafePath(session.metadata.cwd, p); |
| 478 | absPaths.push(safe.absolute); |
| 479 | } |
| 480 | fsWatcher.addPaths(sessionId, connectionId, absPaths); |
| 481 | const watched = fsWatcher.watchedPaths(connectionId, sessionId); |
| 482 | |
| 483 | const wire = watched.map((abs) => toPosixRelativeForCwd(realCwd, abs)); |
| 484 | return { |
| 485 | ok: true as const, |
| 486 | watched_paths: wire, |
| 487 | current_count: fsWatcher.countForConnection(connectionId), |
| 488 | }; |
| 489 | } catch (error) { |
| 490 | return mapFsWatchError(error); |
| 491 | } |
| 492 | }, |
| 493 | async remove(sessionId: string, connectionId: string, wirePaths: readonly string[]) { |
| 494 | try { |
| 495 | const session = await sessionService.get(sessionId); |
nothing calls this directly
no test coverage detected