Description
Pressing Ctrl+O (app.tools.expand) crashes with:
Error: Theme not initialized. Call initTheme() first.
at Object.get (theme.js:536)
at Object.bold (theme.js:920)
at headingStyleFn (markdown.js:209)
at Markdown.renderToken (markdown.js:213)
Root Cause
pi v0.74.0 moved from @mariozechner/pi-coding-agent to @earendil-works/pi-coding-agent. The theme is stored on a Symbol.for key:
| Package |
Symbol key |
@earendil-works/pi-coding-agent (v0.74.0) |
Symbol.for("@earendil-works/pi-coding-agent:theme") |
@mariozechner/pi-coding-agent (v0.72.1, bundled by pi-web-providers) |
Symbol.for("@mariozechner/pi-coding-agent:theme") |
When pi starts, initTheme() sets the @earendil-works slot. But pi-web-providers (v3.0.0) still bundles the old @mariozechner/pi-* packages (v0.72.1). Their markdown/TUI components read from the @mariozechner slot, which was never initialized → crash.
Steps to Reproduce
- Install
pi-web-providers v3.0.0 as an extension alongside @earendil-works/pi-coding-agent v0.74.0
- Run any tool (e.g.,
ls)
- Press Ctrl+O to expand tool output
- Crash
Workaround
Patch pi-web-providers/node_modules/@mariozechner/pi-coding-agent/dist/modes/interactive/theme/theme.js to use the same Symbol key:
-const THEME_KEY = Symbol.for("@mariozechner/pi-coding-agent:theme");
+const THEME_KEY = Symbol.for("@earendil-works/pi-coding-agent:theme");
Suggested Fix
Option A (pi side): During initTheme(), set both Symbol keys so extensions using the old namespace continue to work:
function setGlobalTheme(t) {
globalThis[Symbol.for("@earendil-works/pi-coding-agent:theme")] = t;
globalThis[Symbol.for("@mariozechner/pi-coding-agent:theme")] = t; // backward compat
}
Option B (pi-web-providers side): Update dependencies from @mariozechner/pi-* to @earendil-works/pi-* and release a new version.
Option A is a one-line fix that prevents all existing extensions from breaking during the namespace migration.
Environment
- pi:
@earendil-works/pi-coding-agent v0.74.0
- pi-web-providers: v3.0.0 (bundles
@mariozechner/pi-coding-agent v0.72.1)
- Node.js: v24.12.0
- OS: macOS
Description
Pressing Ctrl+O (
app.tools.expand) crashes with:Root Cause
pi v0.74.0 moved from
@mariozechner/pi-coding-agentto@earendil-works/pi-coding-agent. The theme is stored on aSymbol.forkey:@earendil-works/pi-coding-agent(v0.74.0)Symbol.for("@earendil-works/pi-coding-agent:theme")@mariozechner/pi-coding-agent(v0.72.1, bundled by pi-web-providers)Symbol.for("@mariozechner/pi-coding-agent:theme")When pi starts,
initTheme()sets the@earendil-worksslot. Butpi-web-providers(v3.0.0) still bundles the old@mariozechner/pi-*packages (v0.72.1). Their markdown/TUI components read from the@mariozechnerslot, which was never initialized → crash.Steps to Reproduce
pi-web-providersv3.0.0 as an extension alongside@earendil-works/pi-coding-agentv0.74.0ls)Workaround
Patch
pi-web-providers/node_modules/@mariozechner/pi-coding-agent/dist/modes/interactive/theme/theme.jsto use the same Symbol key:Suggested Fix
Option A (pi side): During
initTheme(), set both Symbol keys so extensions using the old namespace continue to work:Option B (pi-web-providers side): Update dependencies from
@mariozechner/pi-*to@earendil-works/pi-*and release a new version.Option A is a one-line fix that prevents all existing extensions from breaking during the namespace migration.
Environment
@earendil-works/pi-coding-agentv0.74.0@mariozechner/pi-coding-agentv0.72.1)