(
private projectRoot: string,
opts: { idleTimeoutMs?: number; maxIdleMs?: number; handoverFrom?: number | null; rootGoneGraceMs?: number } = {},
)
| 295 | private handoverFrom: number | null; |
| 296 | |
| 297 | constructor( |
| 298 | private projectRoot: string, |
| 299 | opts: { idleTimeoutMs?: number; maxIdleMs?: number; handoverFrom?: number | null; rootGoneGraceMs?: number } = {}, |
| 300 | ) { |
| 301 | this.socketPath = getDaemonSocketPath(projectRoot); |
| 302 | this.pidPath = getDaemonPidPath(projectRoot); |
| 303 | this.idleTimeoutMs = opts.idleTimeoutMs ?? resolveIdleTimeoutMs(); |
| 304 | this.maxIdleMs = opts.maxIdleMs ?? resolveMaxIdleMs(); |
| 305 | this.handoverFrom = opts.handoverFrom ?? null; |
| 306 | this.rootGoneGraceMs = opts.rootGoneGraceMs ?? resolveRootGoneGraceMs(); |
| 307 | // Daemon mode serves many concurrent clients on one event loop, so off-load |
| 308 | // read-tool dispatch to a worker pool — otherwise concurrent explores |
| 309 | // serialize and starve the MCP transport (clients time out). Direct mode |
| 310 | // (one stdio client) leaves the pool off; `CODEGRAPH_QUERY_POOL_SIZE=0` |
| 311 | // disables it here too. |
| 312 | this.engine = new MCPEngine({ queryPool: true }); |
| 313 | this.engine.setProjectPathHint(projectRoot); |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * Bind the socket, refresh the ownership record, kick off engine init, and |
nothing calls this directly
no test coverage detected