MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / sessionWithDaemon

Function sessionWithDaemon

__tests__/daemon-older-version.test.ts:500–511  ·  view source on GitHub ↗

A session of `install` attached to a daemon of its own, which owns the project.

(install: string, version: string, env: NodeJS.ProcessEnv = {})

Source from the content-addressed store, hash-verified

498
499 /** A session of `install` attached to a daemon of its own, which owns the project. */
500 async function sessionWithDaemon(install: string, version: string, env: NodeJS.ProcessEnv = {}): Promise<{ session: Session; pid: number }> {
501 const session = startSession(install, env);
502 await waitFor(() => attachedLine(session), 20000, `the ${version} session to attach`);
503 // Attached means listening, not initialized: let the engine open the
504 // database before anything stops this daemon.
505 await status(session, 2, `a ${version} tool call`);
506 const lock = daemonLock();
507 expect(lock).toMatchObject({ version });
508 expect(writerLock()).toMatchObject({ pid: lock.pid, mode: 'daemon' });
509 daemonPids.add(lock.pid);
510 return { session, pid: lock.pid };
511 }
512
513 /** A daemon process for the project, started the way a launcher starts one. */
514 function startDaemon(env: NodeJS.ProcessEnv): { child: ChildProcessWithoutNullStreams; log: string[] } {

Callers 1

Calls 7

attachedLineFunction · 0.85
daemonLockFunction · 0.85
writerLockFunction · 0.85
startSessionFunction · 0.70
waitForFunction · 0.70
statusFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected