The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
fix(client-runtime): CamelCase account names get distinct badge initials (#35343)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Eightsheet committed
Nov 19, 2026 at 20:35 UTC
3c08684f1deb7aa19e2a6440161d2e600ae215f8
2 files changed
+15
-7
packages/client-runtime/src/state/providerInstanceDisplay.test.ts
+6
-1
@@ -12,13 +12,18 @@ const codex = ProviderDriverKind.make("codex");
12
const acpRegistry = ProviderDriverKind.make("acpRegistry");
13
14
describe("providerInstanceInitials", () => {
15
- it("treats punctuation as a word break but keeps apostrophes between letters", () => {
15
+ it("treats punctuation and camel-case humps as word breaks but keeps apostrophes between letters", () => {
16
expect(providerInstanceInitials("Codex (hub)")).toBe("CH");
17
expect(providerInstanceInitials("work_codex")).toBe("WC");
18
expect(providerInstanceInitials("Theo's Codex")).toBe("TC");
19
expect(providerInstanceInitials("Codex 'hub'")).toBe("CH");
20
expect(providerInstanceInitials("‘hub’")).toBe("HU");
21
expect(providerInstanceInitials("(hub)")).toBe("HU");
22
+ expect(providerInstanceInitials("ClaudeProx")).toBe("CP");
23
+ expect(providerInstanceInitials("ClaudeAPI")).toBe("CA");
24
+ expect(providerInstanceInitials("API")).toBe("AP");
25
+ expect(providerInstanceInitials("ClaudeProx Work")).toBe("CW");
26
+ expect(providerInstanceInitials("(ClaudeProx)")).toBe("CP");
27
});
28
29
it("keeps an emoji whole instead of splitting its surrogate pair", () => {
packages/client-runtime/src/state/providerInstanceDisplay.ts
+9
-6
@@ -29,12 +29,15 @@ export function resolveProviderInstanceDisplayName(
29
export function providerInstanceInitials(label: string): string {
30
// Punctuation separates words so "Codex (hub)" reads CH, not C(. An apostrophe
31
// inside a word stays ("Theo's Codex" is TC); a quoting one does not
32
- // ("Codex 'hub'" is CH).
33
- const words = label
34
- .replace(/[^\P{P}'’]+/gu, " ")
35
- .split(/\s+/u)
36
- .map((word) => word.replace(/^['’]+|['’]+$/gu, ""))
37
- .filter(Boolean);
32
+ // ("Codex 'hub'" is CH). A single camel-case word splits at its humps, so
33
+ // "ClaudeProx" is CP, but "ClaudeProx Work" keeps its own words and is CW.
34
+ const toWords = (text: string) =>
35
+ text
36
+ .split(/\s+/u)
37
+ .map((word) => word.replace(/^['’]+|['’]+$/gu, ""))
38
+ .filter(Boolean);
39
+ let words = toWords(label.replace(/[^\P{P}'’]+/gu, " "));
40
+ if (words.length === 1) words = toWords(words[0]!.replace(/(\p{Ll})(\p{Lu})/gu, "$1 $2"));
41
if (words.length === 0) return "";
42
if (words.length === 1) return Array.from(words[0]!).slice(0, 2).join("").toUpperCase();
43
return words