fix(coding-agent): share theme across package scopes

closes #4333
This commit is contained in:
Mario Zechner
2026-05-10 18:12:40 +02:00
parent f6b6b1f052
commit f8d0fa67dc
2 changed files with 3 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
### Fixed
- Fixed theme sharing across package scopes so extensions do not crash with `Theme not initialized` ([#4333](https://github.com/earendil-works/pi/issues/4333)).
- Fixed keybinding hints to show Option instead of Alt on macOS ([#4289](https://github.com/earendil-works/pi/issues/4289)).
- Fixed the interactive update notification to render the changelog as an OSC 8 hyperlink when the terminal supports hyperlinks ([#4280](https://github.com/earendil-works/pi/issues/4280)).

View File

@@ -658,6 +658,7 @@ function getDefaultTheme(): string {
// Use globalThis to share theme across module loaders (tsx + jiti in dev mode)
const THEME_KEY = Symbol.for("@earendil-works/pi-coding-agent:theme");
const THEME_KEY_OLD = Symbol.for("@mariozechner/pi-coding-agent:theme");
// Export theme as a getter that reads from globalThis
// This ensures all module instances (tsx, jiti) see the same theme
@@ -671,6 +672,7 @@ export const theme: Theme = new Proxy({} as Theme, {
function setGlobalTheme(t: Theme): void {
(globalThis as Record<symbol, Theme>)[THEME_KEY] = t;
(globalThis as Record<symbol, Theme>)[THEME_KEY_OLD] = t;
}
let currentThemeName: string | undefined;