(
private projectRoot: string,
opts: { idleTimeoutMs?: number; maxIdleMs?: number; handoverFrom?: number | null } = {},
)
| 226 | private handoverFrom: number | null; |
| 227 | |
| 228 | constructor( |
| 229 | private projectRoot: string, |
| 230 | opts: { idleTimeoutMs?: number; maxIdleMs?: number; handoverFrom?: number | null } = {}, |
| 231 | ) { |
| 232 | this.socketPath = getDaemonSocketPath(projectRoot); |
| 233 | this.pidPath = getDaemonPidPath(projectRoot); |
| 234 | this.idleTimeoutMs = opts.idleTimeoutMs ?? resolveIdleTimeoutMs(); |
| 235 | this.maxIdleMs = opts.maxIdleMs ?? resolveMaxIdleMs(); |
| 236 | this.handoverFrom = opts.handoverFrom ?? null; |
| 237 | // Daemon mode serves many concurrent clients on one event loop, so off-load |
| 238 | // read-tool dispatch to a worker pool — otherwise concurrent explores |
| 239 | // serialize and starve the MCP transport (clients time out). Direct mode |
| 240 | // (one stdio client) leaves the pool off; `CODEGRAPH_QUERY_POOL_SIZE=0` |
| 241 | // disables it here too. |
| 242 | this.engine = new MCPEngine({ queryPool: true }); |
| 243 | this.engine.setProjectPathHint(projectRoot); |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Bind the socket, refresh the ownership record, kick off engine init, and |
nothing calls this directly
no test coverage detected