()
| 321 | } |
| 322 | |
| 323 | async close(): Promise<void> { |
| 324 | try { |
| 325 | await Promise.allSettled( |
| 326 | Array.from(this.readyAgents(), async (agent) => agent.cron?.stop()), |
| 327 | ); |
| 328 | await this.cancelActiveTurnsOnClose(); |
| 329 | await this.stopBackgroundTasksOnExit(); |
| 330 | await this.flushMetadata(); |
| 331 | await this.triggerSessionEnd('exit'); |
| 332 | } finally { |
| 333 | try { |
| 334 | await this.mcp.shutdown(); |
| 335 | } finally { |
| 336 | await this.logHandle?.close(); |
| 337 | } |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | async closeForReload(): Promise<void> { |
| 342 | try { |
no test coverage detected