diff --git a/slab/menubar-swift/Sources/SlabMenubar/ClaudeSession.swift b/slab/menubar-swift/Sources/SlabMenubar/ClaudeSession.swift index 669933661a..26cdd08390 100644 --- a/slab/menubar-swift/Sources/SlabMenubar/ClaudeSession.swift +++ b/slab/menubar-swift/Sources/SlabMenubar/ClaudeSession.swift @@ -105,6 +105,12 @@ struct ClaudeSession { /// The prompt rock turns this into a QR surface; everything else ignores it. var scanURL: String = "" + /// The piece this session is writing, with its extension — `balozo.mjs`. + /// Only Aesthetic Code sets it, and it names the rock: a session that is + /// holding a piece should be addressable by that piece's name rather than + /// by a second unrelated word drawn from its session id. + var piece: String = "" + /// Native provider thread id. Claude uses `sessionId`; Codex's tracked /// wrapper has its own rock id, so the watcher records the rollout id here. var providerSessionId: String = "" @@ -371,6 +377,7 @@ enum ClaudeSessionReader { session.loopboyResponse = (obj["loopboy_response"] as? String) ?? "" session.nudgeScreen = (obj["nudge_screen"] as? String) ?? "" session.scanURL = (obj["scan_url"] as? String) ?? "" + session.piece = (obj["piece"] as? String) ?? "" return session } diff --git a/slab/menubar-swift/Sources/SlabMenubar/SigilRenderer.swift b/slab/menubar-swift/Sources/SlabMenubar/SigilRenderer.swift index 40462f769c..80ef4ad44b 100644 --- a/slab/menubar-swift/Sources/SlabMenubar/SigilRenderer.swift +++ b/slab/menubar-swift/Sources/SlabMenubar/SigilRenderer.swift @@ -70,6 +70,17 @@ enum SigilRenderer { return routeName } } + // An Aesthetic Code session is holding one named piece, and that name is + // already the session's public identity: it is the slug in the address on + // the rock and the channel the piece is pushed on. Drawing a second, + // unrelated word from the session id meant the rock and the piece + // disagreed about what the session was called — you would open `balozo` + // and be handed `muzad`. The piece wins, and follows a rename. + if session.agentType == "aesthetic-code" { + let slug = (session.piece as NSString).deletingPathExtension + let clean = slug.filter { $0.isLetter || $0.isNumber || $0 == "-" || $0 == "_" } + if !clean.isEmpty { return String(clean.prefix(16)) } + } return name(forSessionId: session.sessionId) }