(state, force = false)
| 977 | const live = await readLiveSessionStatus(client, sessionID, directory) |
| 978 | if (live?.type) return live.type === "idle" |
| 979 | |
| 980 | const cached = sessionStatuses.get(sessionID) |
| 981 | const seenAt = sessionStatusSeenAt.get(sessionID) || 0 |
| 982 | return cached === "idle" && seenAt > (active.startedAt || 0) |
| 983 | } |
| 984 | |
| 985 | async function readLiveSessionStatus(client, sessionID, directory) { |
| 986 | const argsList = [] |
| 987 | if (directory) argsList.push({ query: { directory } }, { directory }, { workspace: directory }) |
| 988 | argsList.push({}) |
| 989 | for (const args of argsList) { |
| 990 | try { |
| 991 | const result = await client.session.status(args) |
| 992 | const error = sdkError(result) |
| 993 | if (error) continue |
no test coverage detected