MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / add

Function add

packages/server/src/start.ts:468–492  ·  view source on GitHub ↗
(sessionId: string, connectionId: string, wirePaths: readonly string[])

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 9

resolveSafePathFunction · 0.90
toPosixRelativeForCwdFunction · 0.85
mapFsWatchErrorFunction · 0.85
bindSessionCwdMethod · 0.80
getMethod · 0.65
addPathsMethod · 0.65
watchedPathsMethod · 0.65
countForConnectionMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected