All live sessions belonging to a workspace, oldest-spawned first.
(wsId: string)
| 143 | |
| 144 | /** All live sessions belonging to a workspace, oldest-spawned first. */ |
| 145 | liveSessionsFor(wsId: string): LiveSessionInfo[] { |
| 146 | const ids = this.byWs.get(wsId); |
| 147 | if (!ids || ids.size === 0) return []; |
| 148 | const out: LiveSessionInfo[] = []; |
| 149 | for (const id of ids) { |
| 150 | const s = this.sessions.get(id); |
| 151 | if (!s) continue; |
| 152 | const adapter = this.adapterFor.get(id); |
| 153 | out.push({ |
| 154 | id, |
| 155 | wsId: s.wsId, |
| 156 | name: s.name, |
| 157 | pid: s.pid, |
| 158 | startedAt: s.startedAt, |
| 159 | agent: adapter?.id ?? 'unknown', |
| 160 | agentSessionId: s.agentSessionId, |
| 161 | }); |
| 162 | } |
| 163 | return out; |
| 164 | } |
| 165 | |
| 166 | liveSessionCount(wsId: string): number { |
| 167 | return this.byWs.get(wsId)?.size ?? 0; |
no test coverage detected