fix(core): keep explicit native package api through catalog merge

The catalog treated any native model api with empty settings and no url as
a placeholder inheriting the provider api, which stomped plugin-assigned
native packages (ChatGPT codex retargeting) back to aisdk. A native api
carrying a package is explicitly targeted and now survives projection.
This commit is contained in:
Kit Langton 2026-07-03 14:35:48 -04:00
commit 781165c884
2 changed files with 40 additions and 1 deletions

View file

@ -77,7 +77,12 @@ const layer = Layer.effect(
const projectModel = (model: ModelV2.Info, provider: ProviderV2.Info) => {
const api =
model.api.type === "native" && !model.api.url && Object.keys(model.api.settings).length === 0
// A native api with a package is explicitly targeted; only package-less,
// settings-less native apis are placeholders that inherit the provider api.
model.api.type === "native" &&
model.api.package === undefined &&
!model.api.url &&
Object.keys(model.api.settings).length === 0
? { ...provider.api, id: model.api.id }
: model.api.type === "aisdk" && provider.api.type === "aisdk" && !model.api.url
? { ...model.api, url: provider.api.url, settings: { ...provider.api.settings, ...model.api.settings } }