(
private projectRoot: string,
opts: { idleTimeoutMs?: number; maxIdleMs?: number } = {},
)
| 181 | private pidPath: string; |
| 182 | |
| 183 | constructor( |
| 184 | private projectRoot: string, |
| 185 | opts: { idleTimeoutMs?: number; maxIdleMs?: number } = {}, |
| 186 | ) { |
| 187 | this.socketPath = getDaemonSocketPath(projectRoot); |
| 188 | this.pidPath = getDaemonPidPath(projectRoot); |
| 189 | this.idleTimeoutMs = opts.idleTimeoutMs ?? resolveIdleTimeoutMs(); |
| 190 | this.maxIdleMs = opts.maxIdleMs ?? resolveMaxIdleMs(); |
| 191 | // Daemon mode serves many concurrent clients on one event loop, so off-load |
| 192 | // read-tool dispatch to a worker pool — otherwise concurrent explores |
| 193 | // serialize and starve the MCP transport (clients time out). Direct mode |
| 194 | // (one stdio client) leaves the pool off; `CODEGRAPH_QUERY_POOL_SIZE=0` |
| 195 | // disables it here too. |
| 196 | this.engine = new MCPEngine({ queryPool: true }); |
| 197 | this.engine.setProjectPathHint(projectRoot); |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Bind the socket, kick off engine init, and register signal handlers. The |
nothing calls this directly
no test coverage detected