A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
SessionBoard: each session behind a pill, and when one pops out
NikitaBulichev60289ece6dd5
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 0e50ff77..517263af 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -36,6 +36,9 @@ jobs:- name: Test question queuerun: bash scripts/test-question-queue.sh+ - name: Test the session board (sessions behind a pill, popping out, places)+ run: bash scripts/test-session-board.sh+- name: Test session titles in the relayrun: python3 scripts/test-session-title.pydiff --git a/NotchBuddy/Sources/App/SessionBoard.swift b/NotchBuddy/Sources/App/SessionBoard.swiftnew file mode 100644index 00000000..30152206--- /dev/null+++ b/NotchBuddy/Sources/App/SessionBoard.swift@@ -0,0 +1,264 @@+import Foundation++// MARK: - SessionBoard+// What each session behind a pill shows: its title, state, steps and last message.+//+// A pill belongs to a client (VS Code, the Claude app, Codex…), and every session of that+// client lands on it (PillSessionRegistry). The board keeps each session apart, so the pill+// can show one session at a time, whole: the most urgent one, else the one active last, held+// for a few seconds so the pill does not flip between busy sessions. Open, the card lists+// them all. A session that starts waiting for a permission or an answer while it shares the+// pill pops out into a pill of its own ("<pill>#2"…) and folds back once it is answered.+//+// Pure value: HookServer owns it and changes it on the main actor only.++struct BoardSession: Equatable, Sendable {+ var title: String+ /// The id the session's hook events carry ("unknown" for one that sends none).+ var rawSession: String+ var state: BotState = .idle+ var steps: [String] = []+ var finalLine: String? = nil+ var lastActive: Date+ /// When its last turn finished or failed: for a moment that is what its pill shows.+ var endedAt: Date? = nil++ mutating func appendStep(_ step: String) {+ steps.append(step)+ if steps.count > SessionBoard.maxSteps { steps.removeFirst(steps.count - SessionBoard.maxSteps) }+ }+}++struct SessionBoard: Sendable {+ static let maxSteps = 20+ /// A finished turn shows on its pill this long, ahead of a sibling still working.+ static let finishMoment: TimeInterval = 5.2+ /// A failed turn shows on its pill this long, ahead of a sibling still working.+ static let errorMoment: TimeInterval = 30+ /// A pill keeps showing a session this long before an equally urgent one may take over.+ static let minHold: TimeInterval = 6+ /// A popped-out session stays out this long at least, so a quick answer does not flash it.+ static let minPopOut: TimeInterval = 3+ /// A sibling silent for this long (a terminal killed without SessionEnd, say) does not make+ /// a waiting session pop out: there is nobody else to keep the client's pill for.+ static let siblingQuiet: TimeInterval = 30 * 60++ private struct PopOut: Equatable, Sendable {+ var number: Int+ var since: Date+ }++ private struct Pill: Sendable {+ /// Sessions in the order they first came.+ var order: [String] = []+ var sessions: [String: BoardSession] = [:]+ var shown: String? = nil+ var shownSince: Date = .distantPast+ var popped: [String: PopOut] = [:]+ }++ private var pills: [String: Pill] = [:]++ static func poppedPillId(_ pill: String, number: Int) -> String { "\(pill)#\(number)" }++ // MARK: Recording++ /// Applies `change` to `session` behind `pill`, adding the session on first sight. A+ /// non-empty `title` renames it; every update counts as activity.+ mutating func update(pill: String, session: String, rawSession: String, title: String,+ now: Date, _ change: (inout BoardSession) -> Void = { _ in }) {+ var p = pills[pill] ?? Pill()+ if p.sessions[session] == nil { p.order.append(session) }+ var s = p.sessions[session] ?? BoardSession(title: title, rawSession: rawSession, lastActive: now)+ if !title.isEmpty { s.title = title }+ s.rawSession = rawSession+ s.lastActive = now+ change(&s)+ p.sessions[session] = s+ pills[pill] = p+ }++ /// Changes `session` without counting it as activity (a timer, not an event). No-op if unknown.+ mutating func amend(pill: String, session: String, _ change: (inout BoardSession) -> Void) {+ guard var s = pills[pill]?.sessions[session] else { return }+ change(&s)+ pills[pill]?.sessions[session] = s+ }++ func session(pill: String, session: String) -> BoardSession? { pills[pill]?.sessions[session] }++ func sessionCount(pill: String) -> Int { pills[pill]?.order.count ?? 0 }++ /// Drops a session that ended. Returns the pill it had popped out into, if any.+ @discardableResult+ mutating func remove(pill: String, session: String) -> String? {+ guard var p = pills[pill] else { return nil }+ p.order.removeAll { $0 == session }+ p.sessions.removeValue(forKey: session)+ let popped = p.popped.removeValue(forKey: session).map { Self.poppedPillId(pill, number: $0.number) }+ if p.shown == session { p.shown = nil }+ pills[pill] = p.order.isEmpty ? nil : p+ return popped+ }++ /// Drops the sessions of `pill` that `isLive` says are gone (silent for hours, so the+ /// registry let them go). Returns the pills they had popped out into.+ mutating func keep(pill: String, where isLive: (BoardSession) -> Bool) -> [String] {+ guard let p = pills[pill] else { return [] }+ return p.order.filter { !isLive(p.sessions[$0]!) }.compactMap { remove(pill: pill, session: $0) }+ }++ // MARK: What the pill shows++ /// Lower is more urgent: waiting for you, a turn that just failed, one that just finished,+ /// work in progress, an older finish, idle.+ static func rank(_ s: BoardSession, waiting: Bool, now: Date) -> Int {+ if waiting { return 0 }+ let since = s.endedAt.map { now.timeIntervalSince($0) } ?? .infinity+ switch s.state {+ case .error: return since < errorMoment ? 1 : 4+ case .finished: return since < finishMoment ? 2 : 4+ case .idle, .sleeping, .dizzy: return 5+ default: return 3 // working, thinking, searching, ratelimit, question, approval+ }+ }++ /// The session `pill` shows, among those not popped out: the most urgent, then the one+ /// active last. The one shown keeps the pill `minHold` unless a more urgent one comes.+ /// `waiting` holds the sessions waiting for an answer.+ mutating func shown(pill: String, waiting: Set<String>, now: Date) -> String? {+ guard var p = pills[pill] else { return nil }+ let candidates = p.order.filter { p.popped[$0] == nil }+ func rank(_ id: String) -> Int { Self.rank(p.sessions[id]!, waiting: waiting.contains(id), now: now) }+ guard var best = candidates.first else { return nil }+ for id in candidates.dropFirst() {+ let (r, b) = (rank(id), rank(best))+ if r < b || (r == b && p.sessions[id]!.lastActive > p.sessions[best]!.lastActive) { best = id }+ }+ if let current = p.shown, current != best, candidates.contains(current),+ rank(current) <= rank(best), now.timeIntervalSince(p.shownSince) < Self.minHold {+ return current+ }+ if p.shown != best {+ p.shown = best+ p.shownSince = now+ pills[pill] = p+ }+ return best+ }++ /// The sessions still in `pill` (not popped out), in the order they came, for the open+ /// card. Empty when only one is: the card then shows that session as it always has.+ func lines(pill: String) -> [(session: String, value: BoardSession)] {+ guard let p = pills[pill] else { return [] }+ let inside = p.order.filter { p.popped[$0] == nil }+ guard inside.count > 1 else { return [] }+ return inside.map { ($0, p.sessions[$0]!) }+ }++ // MARK: Popping out++ /// Pops `session` out into a pill of its own when it starts waiting while another session,+ /// not popped out and active lately, shares the pill. Returns that pill, nil when the+ /// session stays (it is alone).+ mutating func popOut(pill: String, session: String, now: Date) -> String? {+ guard var p = pills[pill], p.sessions[session] != nil else { return nil }+ if let out = p.popped[session] { return Self.poppedPillId(pill, number: out.number) }+ guard p.order.contains(where: {+ $0 != session && p.popped[$0] == nil+ && now.timeIntervalSince(p.sessions[$0]!.lastActive) < Self.siblingQuiet+ }) else { return nil }+ let taken = Set(p.popped.values.map(\.number))+ let number = (2...).first { !taken.contains($0) }!+ p.popped[session] = PopOut(number: number, since: now)+ if p.shown == session { p.shown = nil }+ pills[pill] = p+ return Self.poppedPillId(pill, number: number)+ }++ func poppedPill(pill: String, session: String) -> String? {+ pills[pill]?.popped[session].map { Self.poppedPillId(pill, number: $0.number) }+ }++ /// The sessions popped out of `pill`, oldest out first, with their pills.+ func poppedOut(pill: String) -> [(session: String, pill: String)] {+ guard let p = pills[pill] else { return [] }+ return p.popped.sorted { ($0.value.since, $0.value.number) < ($1.value.since, $1.value.number) }+ .map { ($0.key, Self.poppedPillId(pill, number: $0.value.number)) }+ }++ /// Folds back into `pill` the popped-out sessions that no longer wait, once out for+ /// `minPopOut`, and all of them when no session is left in the pill. Returns the pills+ /// folded, and when to look again for the ones that must stay out a little longer.+ mutating func fold(pill: String, waiting: Set<String>, now: Date) -> (folded: [String], recheck: Date?) {+ guard var p = pills[pill], !p.popped.isEmpty else { return ([], nil) }+ let emptyInside = !p.order.contains { p.popped[$0] == nil }+ var folded: [String] = []+ var recheck: Date? = nil+ for (session, out) in p.popped.sorted(by: { $0.value.number < $1.value.number }) {+ let due = out.since.addingTimeInterval(Self.minPopOut)+ if emptyInside || (!waiting.contains(session) && now >= due) {+ p.popped.removeValue(forKey: session)+ folded.append(Self.poppedPillId(pill, number: out.number))+ } else if !waiting.contains(session) {+ recheck = min(recheck ?? due, due)+ }+ }+ pills[pill] = p+ return (folded, recheck)+ }++ // MARK: The places beside the focused pill++ enum Slot: Equatable, Sendable {+ case pill(String)+ /// Waiting pills with no place left: "+N", N being their count; a tap shows the first.+ case waiting([String])++ var id: String {+ switch self {+ case .pill(let id): return id+ case .waiting: return "waiting-stack"+ }+ }+ }++ struct Cell: Equatable, Sendable {+ var id: String+ var state: BotState+ /// A session popped out of its client's pill (it waits for you).+ var poppedOut: Bool+ }++ /// Fills the places beside the focused pill. Pills keep the order they have; a waiting one+ /// (popped out, or a pill waiting itself) that would not show takes a free place, else the+ /// place of the last idle pill, else of the last finished one, the one waiting longest+ /// first. Working and waiting pills keep theirs. When waiting pills are left over, the last+ /// place becomes "+N" for them and for the newest one that had a place: the ones waiting+ /// longest stay in sight.+ static func slots(_ cells: [Cell], places: Int = 4) -> [Slot] {+ func waits(_ c: Cell) -> Bool { c.poppedOut || c.state == .approval || c.state == .question }+ let inPlace = cells.filter { !$0.poppedOut }+ var visible = Array(inPlace.prefix(places))+ let queue = cells.filter(\.poppedOut) + inPlace.dropFirst(places).filter(waits)+ var placed: [String] = []+ var left: [String] = []+ for c in queue {+ if visible.count < places {+ visible.append(c)+ placed.append(c.id)+ } else if let i = visible.lastIndex(where: { !waits($0) && [.idle, .sleeping].contains($0.state) })+ ?? visible.lastIndex(where: { !waits($0) && $0.state == .finished }) {+ visible[i] = c+ placed.append(c.id)+ } else {+ left.append(c.id)+ }+ }+ guard !left.isEmpty, !visible.isEmpty else { return visible.map { Slot.pill($0.id) } }+ // The stack takes one place: the newest waiting pill's (it joins the stack), else the last.+ let newest = placed.last.flatMap { id in visible.firstIndex { $0.id == id } }+ let covered = visible.remove(at: newest ?? visible.count - 1)+ return visible.map { Slot.pill($0.id) } + [.waiting((waits(covered) ? [covered.id] : []) + left)]+ }+}diff --git a/scripts/test-session-board.sh b/scripts/test-session-board.shnew file mode 100755index 00000000..256d3060--- /dev/null+++ b/scripts/test-session-board.sh@@ -0,0 +1,8 @@+#!/usr/bin/env bash+set -euo pipefail+cd "$(dirname "$0")/.."+TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/coucou-session-board.XXXXXX")"+trap 'rm -rf "$TEST_DIR"' EXIT+swiftc -swift-version 6 -strict-concurrency=complete \+ NotchBuddy/Sources/App/SessionBoard.swift tests/SessionBoardTests.swift -o "$TEST_DIR/session-board-tests"+"$TEST_DIR/session-board-tests"diff --git a/tests/SessionBoardTests.swift b/tests/SessionBoardTests.swiftnew file mode 100644index 00000000..a130acc0--- /dev/null+++ b/tests/SessionBoardTests.swift@@ -0,0 +1,191 @@+import Foundation++// The real BotState lives in Sources/CoucouKit/IslandTypes.swift.+enum BotState: String, CaseIterable {+ case idle, working, thinking, searching+ case approval, question, error, finished+ case ratelimit, sleeping, dizzy+}++@main+enum SessionBoardTests {+ static let t0 = Date(timeIntervalSince1970: 1_000_000)+ static func at(_ s: TimeInterval) -> Date { t0.addingTimeInterval(s) }++ static func main() {+ sessions()+ shownSession()+ popOuts()+ places()+ print("SessionBoard tests: all passed")+ }++ static func sessions() {+ var b = SessionBoard()+ b.update(pill: "vs", session: "a", rawSession: "a", title: "Report", now: at(0)) { $0.state = .thinking }+ b.update(pill: "vs", session: "a", rawSession: "a", title: "", now: at(1)) { $0.appendStep("ls") }+ let a = b.session(pill: "vs", session: "a")!+ precondition(a.title == "Report" && a.state == .thinking && a.steps == ["ls"] && a.lastActive == at(1))+ // Steps are capped, oldest go first+ for i in 0..<30 { b.update(pill: "vs", session: "a", rawSession: "a", title: "", now: at(2)) { $0.appendStep("s\(i)") } }+ precondition(b.session(pill: "vs", session: "a")!.steps.count == SessionBoard.maxSteps)+ precondition(b.session(pill: "vs", session: "a")!.steps.last == "s29")+ // A timer's change is not activity+ b.amend(pill: "vs", session: "a") { $0.state = .idle }+ precondition(b.session(pill: "vs", session: "a")!.lastActive == at(2))+ b.amend(pill: "vs", session: "nobody") { $0.state = .error }+ precondition(b.session(pill: "vs", session: "nobody") == nil)+ // Removal+ precondition(b.sessionCount(pill: "vs") == 1 && b.remove(pill: "vs", session: "a") == nil && b.sessionCount(pill: "vs") == 0)+ // Sessions the registry let go leave the board, with the pill they popped out into+ b.update(pill: "vs", session: "x", rawSession: "x", title: "X", now: at(0))+ b.update(pill: "vs", session: "y", rawSession: "y", title: "Y", now: at(0))+ b.update(pill: "vs", session: "z", rawSession: "z", title: "Z", now: at(0))+ _ = b.popOut(pill: "vs", session: "y", now: at(0))+ precondition(b.keep(pill: "vs") { $0.rawSession == "x" } == ["vs#2"] && b.sessionCount(pill: "vs") == 1)+ }++ static func shownSession() {+ var b = SessionBoard()+ func set(_ s: String, _ state: BotState, _ t: TimeInterval, ended: TimeInterval? = nil) {+ b.update(pill: "vs", session: s, rawSession: s, title: s.uppercased(), now: at(t)) {+ $0.state = state+ if let ended { $0.endedAt = at(ended) }+ }+ }+ set("a", .working, 0)+ precondition(b.shown(pill: "vs", waiting: [], now: at(0)) == "a")+ precondition(b.lines(pill: "vs").isEmpty) // one session: no list++ // B works too and is more recent, but A keeps the pill for minHold+ set("b", .working, 1)+ precondition(b.shown(pill: "vs", waiting: [], now: at(1)) == "a")+ precondition(b.shown(pill: "vs", waiting: [], now: at(SessionBoard.minHold - 0.1)) == "a")+ // …then the one active last takes it+ precondition(b.shown(pill: "vs", waiting: [], now: at(SessionBoard.minHold + 0.1)) == "b")+ precondition(b.lines(pill: "vs").map(\.session) == ["a", "b"]) // in the order they came++ // A finishing outranks B working, at once and only for the finish moment+ set("a", .finished, 8, ended: 8)+ precondition(b.shown(pill: "vs", waiting: [], now: at(8)) == "a")+ set("b", .working, 9)+ precondition(b.shown(pill: "vs", waiting: [], now: at(9)) == "a")+ precondition(b.shown(pill: "vs", waiting: [], now: at(8 + SessionBoard.finishMoment + 0.1)) == "b")++ // A failure stays in front for the error moment+ set("a", .error, 20, ended: 20)+ precondition(b.shown(pill: "vs", waiting: [], now: at(21)) == "a")+ precondition(b.shown(pill: "vs", waiting: [], now: at(20 + SessionBoard.errorMoment + 0.1)) == "b")++ // A session waiting for you comes first (while it stays in the pill)+ set("c", .idle, 60)+ precondition(b.shown(pill: "vs", waiting: ["c"], now: at(61)) == "c")+ precondition(SessionBoard.rank(b.session(pill: "vs", session: "c")!, waiting: true, now: at(61)) == 0)++ // Ranks+ let s = BoardSession(title: "", rawSession: "", state: .idle, lastActive: at(0))+ var w = s; w.state = .thinking+ precondition(SessionBoard.rank(w, waiting: false, now: at(0)) == 3)+ precondition(SessionBoard.rank(s, waiting: false, now: at(0)) == 5)+ var f = s; f.state = .finished; f.endedAt = at(0)+ precondition(SessionBoard.rank(f, waiting: false, now: at(1)) == 2)+ precondition(SessionBoard.rank(f, waiting: false, now: at(100)) == 4)+ }++ static func popOuts() {+ var b = SessionBoard()+ b.update(pill: "vs", session: "a", rawSession: "a", title: "A", now: at(0)) { $0.state = .working }+ // Alone in its pill: a waiting session stays there+ precondition(b.popOut(pill: "vs", session: "a", now: at(1)) == nil)+ b.update(pill: "vs", session: "b", rawSession: "b", title: "B", now: at(1)) { $0.state = .working }+ b.update(pill: "vs", session: "c", rawSession: "c", title: "C", now: at(1)) { $0.state = .working }+ // Sharing it: out into "<pill>#2", then "#3"; asking again keeps the same pill+ precondition(b.popOut(pill: "vs", session: "b", now: at(2)) == "vs#2")+ precondition(b.popOut(pill: "vs", session: "b", now: at(3)) == "vs#2")+ precondition(b.popOut(pill: "vs", session: "c", now: at(3)) == "vs#3")+ precondition(b.poppedPill(pill: "vs", session: "c") == "vs#3")+ precondition(b.poppedOut(pill: "vs").map(\.pill) == ["vs#2", "vs#3"])+ // The last session left inside never pops out: the client pill always shows one+ precondition(b.popOut(pill: "vs", session: "a", now: at(4)) == nil)+ // Nor does one whose sibling has been silent for long (killed without SessionEnd)+ var quiet = SessionBoard()+ quiet.update(pill: "vs", session: "old", rawSession: "old", title: "Old", now: at(0))+ quiet.update(pill: "vs", session: "new", rawSession: "new", title: "New", now: at(SessionBoard.siblingQuiet + 1))+ precondition(quiet.popOut(pill: "vs", session: "new", now: at(SessionBoard.siblingQuiet + 1)) == nil)+ // Popped-out sessions are not the pill's, nor in its list+ precondition(b.shown(pill: "vs", waiting: ["b", "c"], now: at(4)) == "a")+ precondition(b.lines(pill: "vs").isEmpty)++ // Still waiting: stays out. Answered: stays minPopOut, then folds+ var r = b.fold(pill: "vs", waiting: ["b", "c"], now: at(10))+ precondition(r.folded.isEmpty && r.recheck == nil)+ r = b.fold(pill: "vs", waiting: ["c"], now: at(10)) // b out since 2: due at 5+ precondition(r.folded == ["vs#2"] && r.recheck == nil)+ precondition(b.popOut(pill: "vs", session: "b", now: at(11)) == "vs#2") // number 2 free again+ r = b.fold(pill: "vs", waiting: ["c"], now: at(12)) // b just out again: due at 14+ precondition(r.folded.isEmpty && r.recheck == at(11 + SessionBoard.minPopOut))+ r = b.fold(pill: "vs", waiting: ["c"], now: at(14))+ precondition(r.folded == ["vs#2"])+ precondition(b.lines(pill: "vs").map(\.session) == ["a", "b"])++ // A popped-out session that ends takes its pill down with it+ precondition(b.remove(pill: "vs", session: "c") == "vs#3")+ // When nobody is left inside, every popped-out session folds back at once+ _ = b.popOut(pill: "vs", session: "b", now: at(20))+ b.remove(pill: "vs", session: "a")+ r = b.fold(pill: "vs", waiting: ["b"], now: at(20))+ precondition(r.folded == ["vs#2"] && b.poppedOut(pill: "vs").isEmpty)+ }++ static func places() {+ typealias C = SessionBoard.Cell+ func ids(_ slots: [SessionBoard.Slot]) -> [String] {+ slots.map { slot -> String in+ switch slot {+ case .pill(let id): return id+ case .waiting(let ids): return "+\(ids.count):" + ids.joined(separator: ",")+ }+ }+ }+ // As today when nothing waits: the first 4 others, in order+ let plain = (1...6).map { C(id: "p\($0)", state: .working, poppedOut: false) }+ precondition(ids(SessionBoard.slots(plain)) == ["p1", "p2", "p3", "p4"])++ // 3 clients + 2 questions. The first question is on the card (the focused pill), the+ // second popped-out pill takes the free place.+ let threeClients = [C(id: "vscode", state: .working, poppedOut: false),+ C(id: "desktop", state: .working, poppedOut: false),+ C(id: "codex", state: .working, poppedOut: false),+ C(id: "desktop#2", state: .question, poppedOut: true)]+ precondition(ids(SessionBoard.slots(threeClients)) == ["vscode", "desktop", "codex", "desktop#2"])++ // 5 waiting sessions (the first on the card, 4 more): free place, then the idle pill's,+ // then the finished one's; the newest two share the "+2" stack, the ones waiting+ // longest stay in sight. Working pills stay.+ let five = [C(id: "vscode", state: .working, poppedOut: false),+ C(id: "codex", state: .idle, poppedOut: false),+ C(id: "desktop", state: .finished, poppedOut: false),+ C(id: "vscode#3", state: .approval, poppedOut: true),+ C(id: "vscode#4", state: .question, poppedOut: true),+ C(id: "vscode#5", state: .question, poppedOut: true),+ C(id: "vscode#6", state: .approval, poppedOut: true)]+ precondition(ids(SessionBoard.slots(five)) == ["vscode", "vscode#4", "vscode#3", "+2:vscode#5,vscode#6"],+ "\(ids(SessionBoard.slots(five)))")++ // A client with three sessions, one asking: it is on the card; the client pill (the+ // other two) and the rest keep their places.+ let oneAsks = [C(id: "vscode", state: .working, poppedOut: false),+ C(id: "github", state: .idle, poppedOut: false)]+ precondition(ids(SessionBoard.slots(oneAsks)) == ["vscode", "github"])++ // A pill that waits itself (a lone session) beyond the first 4 comes in like a popped one+ let late = (1...4).map { C(id: "w\($0)", state: .working, poppedOut: false) }+ + [C(id: "i5", state: .idle, poppedOut: false), C(id: "q6", state: .question, poppedOut: false)]+ precondition(ids(SessionBoard.slots(late)) == ["w1", "w2", "w3", "+1:q6"])+ let lateIdle = [C(id: "w1", state: .working, poppedOut: false), C(id: "i2", state: .idle, poppedOut: false),+ C(id: "w3", state: .working, poppedOut: false), C(id: "w4", state: .working, poppedOut: false),+ C(id: "q5", state: .question, poppedOut: false)]+ precondition(ids(SessionBoard.slots(lateIdle)) == ["w1", "q5", "w3", "w4"])+ precondition(SessionBoard.slots([]).isEmpty)+ }+}