(payload: { sid: string; time: number })
| 357 | } |
| 358 | |
| 359 | handleSessionEnd(payload: { sid: string; time: number }): void { |
| 360 | const t = clampAliveTime(payload.time) ?? Date.now() |
| 361 | |
| 362 | const session = this.sessions.get(payload.sid) ?? this.refreshSession(payload.sid) |
| 363 | if (!session) return |
| 364 | |
| 365 | if (!session.active && !session.thinking) { |
| 366 | return |
| 367 | } |
| 368 | |
| 369 | session.active = false |
| 370 | session.thinking = false |
| 371 | session.thinkingAt = t |
| 372 | session.backgroundTaskCount = 0 |
| 373 | this.pendingThinkingUntilBySessionId.delete(session.id) |
| 374 | |
| 375 | this.publisher.emit({ |
| 376 | type: 'session-updated', |
| 377 | sessionId: session.id, |
| 378 | data: { active: false, thinking: false, backgroundTaskCount: 0 } satisfies SessionPatch |
| 379 | }) |
| 380 | } |
| 381 | |
| 382 | expireInactive(now: number = Date.now()): string[] { |
| 383 | const sessionTimeoutMs = 30_000 |
nothing calls this directly
no test coverage detected