// Package session provides polecat session lifecycle management. package session import ( "fmt" ) // Prefix is the common prefix for rig-level Gas Town tmux sessions. const Prefix = "gt-" // HQPrefix is the prefix for town-level services (Mayor, Deacon). const HQPrefix = "hq-" // MayorSessionName returns the session name for the Mayor agent. // One mayor per machine - multi-town requires containers/VMs for isolation. func MayorSessionName() string { return HQPrefix + "mayor" } // DeaconSessionName returns the session name for the Deacon agent. // One deacon per machine - multi-town requires containers/VMs for isolation. func DeaconSessionName() string { return HQPrefix + "deacon" } // WitnessSessionName returns the session name for a rig's Witness agent. func WitnessSessionName(rig string) string { return fmt.Sprintf("%s%s-witness", Prefix, rig) } // RefinerySessionName returns the session name for a rig's Refinery agent. func RefinerySessionName(rig string) string { return fmt.Sprintf("%s%s-refinery", Prefix, rig) } // CrewSessionName returns the session name for a crew worker in a rig. func CrewSessionName(rig, name string) string { return fmt.Sprintf("%s%s-crew-%s", Prefix, rig, name) } // PolecatSessionName returns the session name for a polecat in a rig. func PolecatSessionName(rig, name string) string { return fmt.Sprintf("%s%s-%s", Prefix, rig, name) } // BootSessionName returns the session name for the Boot watchdog. // Note: We use "gt-boot" instead of "hq-deacon-boot" to avoid tmux prefix // matching collisions. Tmux matches session names by prefix, so "hq-deacon-boot" // would match when checking for "hq-deacon", causing HasSession("hq-deacon") // to return true when only Boot is running. func BootSessionName() string { return Prefix + "boot" }