ScuttleBot
ui: stable nick colors — strip session hash suffix before color hashing Agents get a new nick suffix on every relay restart (e.g. 87d771ed → 415b7e12). Strip the hex suffix so color is based on the agent base name (claude-scuttlebot) and stays consistent across sessions.
Commit
dc1fa0ea0a991d98a3d6b2dff05e6ecfbb9bacac4e7f17cbef25be8b3ee0964f
Parent
3fc248398e62b41…
1 file changed
+4
-1
+4
-1
| --- internal/api/ui/index.html | ||
| +++ internal/api/ui/index.html | ||
| @@ -1879,12 +1879,15 @@ | ||
| 1879 | 1879 | }).join(''); |
| 1880 | 1880 | } |
| 1881 | 1881 | // Nick colors — deterministic hash over a palette |
| 1882 | 1882 | const NICK_PALETTE = ['#58a6ff','#3fb950','#ffa657','#d2a8ff','#56d364','#79c0ff','#ff7b72','#a5d6ff','#f0883e','#39d353']; |
| 1883 | 1883 | function nickColor(nick) { |
| 1884 | + // Strip session hash suffix (e.g. claude-scuttlebot-87d771ed → claude-scuttlebot) | |
| 1885 | + // so the same agent keeps a stable color across relay restarts. | |
| 1886 | + const base = nick.replace(/-[0-9a-f]{6,}$/i, ''); | |
| 1884 | 1887 | let h = 0; |
| 1885 | - for (let i = 0; i < nick.length; i++) h = (h * 31 + nick.charCodeAt(i)) & 0xffff; | |
| 1888 | + for (let i = 0; i < base.length; i++) h = (h * 31 + base.charCodeAt(i)) & 0xffff; | |
| 1886 | 1889 | return NICK_PALETTE[h % NICK_PALETTE.length]; |
| 1887 | 1890 | } |
| 1888 | 1891 | |
| 1889 | 1892 | let _lastMsgNick = null, _lastMsgAt = 0; |
| 1890 | 1893 | const GROUP_MS = 5 * 60 * 1000; |
| 1891 | 1894 |
| --- internal/api/ui/index.html | |
| +++ internal/api/ui/index.html | |
| @@ -1879,12 +1879,15 @@ | |
| 1879 | }).join(''); |
| 1880 | } |
| 1881 | // Nick colors — deterministic hash over a palette |
| 1882 | const NICK_PALETTE = ['#58a6ff','#3fb950','#ffa657','#d2a8ff','#56d364','#79c0ff','#ff7b72','#a5d6ff','#f0883e','#39d353']; |
| 1883 | function nickColor(nick) { |
| 1884 | let h = 0; |
| 1885 | for (let i = 0; i < nick.length; i++) h = (h * 31 + nick.charCodeAt(i)) & 0xffff; |
| 1886 | return NICK_PALETTE[h % NICK_PALETTE.length]; |
| 1887 | } |
| 1888 | |
| 1889 | let _lastMsgNick = null, _lastMsgAt = 0; |
| 1890 | const GROUP_MS = 5 * 60 * 1000; |
| 1891 |
| --- internal/api/ui/index.html | |
| +++ internal/api/ui/index.html | |
| @@ -1879,12 +1879,15 @@ | |
| 1879 | }).join(''); |
| 1880 | } |
| 1881 | // Nick colors — deterministic hash over a palette |
| 1882 | const NICK_PALETTE = ['#58a6ff','#3fb950','#ffa657','#d2a8ff','#56d364','#79c0ff','#ff7b72','#a5d6ff','#f0883e','#39d353']; |
| 1883 | function nickColor(nick) { |
| 1884 | // Strip session hash suffix (e.g. claude-scuttlebot-87d771ed → claude-scuttlebot) |
| 1885 | // so the same agent keeps a stable color across relay restarts. |
| 1886 | const base = nick.replace(/-[0-9a-f]{6,}$/i, ''); |
| 1887 | let h = 0; |
| 1888 | for (let i = 0; i < base.length; i++) h = (h * 31 + base.charCodeAt(i)) & 0xffff; |
| 1889 | return NICK_PALETTE[h % NICK_PALETTE.length]; |
| 1890 | } |
| 1891 | |
| 1892 | let _lastMsgNick = null, _lastMsgAt = 0; |
| 1893 | const GROUP_MS = 5 * 60 * 1000; |
| 1894 |