Lines 95-135typescript
95 const mutedProviderBadge = theme.fg("muted", `[${selectedModel.provider}]`);
96 const accentProviderBadge = theme.fg("accent", `[${selectedModel.provider}]`);
98 for (const child of getListChildren(target)) {
99 if (!isTextLike(child)) continue;
100 const text = child.text;
101 if (typeof text !== "string") continue;
102 if (!text.includes(selectedModelText) || !text.includes(mutedProviderBadge)) continue;
103 child.setText?.(text.replace(mutedProviderBadge, accentProviderBadge));
108async function resolvePiDistDir(): Promise<string> {
109 const codingAgentEntry = fileURLToPath(import.meta.resolve("@earendil-works/pi-coding-agent"));
110 return dirname(codingAgentEntry);
113async function loadThemeModule(): Promise<ThemeModule> {
114 const distDir = await resolvePiDistDir();
115 const themePath = pathToFileURL(join(distDir, "modes/interactive/theme/theme.js")).href;
116 const themeModule = (await import(themePath)) as ThemeModule;
117 return themeModule;
MediumDynamic Require
Package source references dynamic require/import behavior.
src/model-selector-provider-badge.tsView on unpkg · L115 121 * Sets whether the selected model row should accent its provider badge.
123export function setHighlightSelectedModelProvider(enabled: boolean): void {
124 getUiTweaksPatchState().highlightSelectedModelProvider = enabled;
128 * Installs an idempotent patch that highlights the selected model row's provider badge.
130export async function installModelSelectorProviderBadgePatch(
131 prototype: ModelSelectorProviderBadgeTarget = ModelSelectorComponent.prototype as unknown as ModelSelectorProviderBadgeTarget,
132 providedTheme?: ThemeInstance,
135 let theme = providedTheme;