fix(coding-agent): re-exported relocated catalog symbols from legacy pi-ai shim

`calculateCost`, `modelsAreEqual`, and `getBundledProviders` moved from the
`@oh-my-pi/pi-ai` barrel to `@oh-my-pi/pi-catalog/models` in the catalog
split (1b9d9d0851). The legacy-extension pi-ai root shim already bridged
`getBundledModel`/`getBundledModels` back under their old `getModel`/
`getModels` names but never re-exported the other relocated symbols, so any
legacy extension importing `calculateCost` from `@oh-my-pi/pi-ai` failed
plugin validation at install time with `Export named 'calculateCost' not
found in module '.../legacy-pi-ai-shim.ts'`.

Bridge all three symbols through the shim so pre-split legacy extensions
load again. Add regression tests that load fixtures importing
`calculateCost`, `modelsAreEqual`, and `getBundledProviders` from
`@oh-my-pi/pi-ai` and assert identity against the catalog implementations.

Fixes #4584
This commit is contained in:
roboomp
2026-07-05 02:03:41 +00:00
parent 38565c58cb
commit 5203fce696
3 changed files with 57 additions and 5 deletions
@@ -19,7 +19,13 @@
* `types.ts` via the `export *` below — pi-ai still exports both as types,
* only the runtime `Type` builder and `StringEnum()` helper were removed.
*/
import { getBundledModel, getBundledModels } from "@oh-my-pi/pi-catalog/models";
import {
calculateCost,
getBundledModel,
getBundledModels,
getBundledProviders,
modelsAreEqual,
} from "@oh-my-pi/pi-catalog/models";
import { type TSchema, Type } from "./typebox";
export interface StringEnumOptions<T extends string> {
@@ -66,8 +72,15 @@ export function StringEnum<T extends string | number>(
}
export * from "@oh-my-pi/pi-ai";
export { Type };
/** Compatibility aliases for renamed catalog functions */
/**
* Compatibility re-exports for catalog symbols that pi-ai historically exposed
* from its own barrel prior to the `refactor(catalog)!: split model catalog
* from pi-ai` change. Legacy extensions still import these from the pi-ai
* root, so the shim bridges them through to their new home in
* `@oh-my-pi/pi-catalog/models`. `getModel`/`getModels` are the historical
* pi-ai names for `getBundledModel`/`getBundledModels`; the remaining symbols
* kept their names across the move.
*/
export { calculateCost, getBundledProviders, modelsAreEqual, Type };
export const getModel = getBundledModel;
export const getModels = getBundledModels;