Import apps/android/src/lib/workspace-sessions.ts
This commit is contained in:
parent
1c4343844f
commit
9db17c350e
|
|
@ -0,0 +1,15 @@
|
||||||
|
import type { RemoteSession, WorkspaceView } from '../types'
|
||||||
|
|
||||||
|
/** Harness retains archived IDs in its workspace catalog for later restoration. */
|
||||||
|
export function getVisibleWorkspaceSessions(
|
||||||
|
workspace: WorkspaceView,
|
||||||
|
sessions: readonly RemoteSession[],
|
||||||
|
archivedSessionIds: readonly string[],
|
||||||
|
): RemoteSession[] {
|
||||||
|
const archived = new Set(archivedSessionIds)
|
||||||
|
const byId = new Map(sessions.map(session => [session.sessionId, session]))
|
||||||
|
return workspace.sessionIds.flatMap(id => {
|
||||||
|
const session = byId.get(id)
|
||||||
|
return session === undefined || archived.has(id) ? [] : [session]
|
||||||
|
})
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue