Compare commits

...

1 Commits

Author SHA1 Message Date
Dax Raad 25f6b1a2db fix(core): mark models.dev env providers as integrations 2026-07-09 21:58:57 +00:00
2 changed files with 36 additions and 1 deletions
+4 -1
View File
@@ -26,7 +26,10 @@ export const ModelsDevPlugin = define({
})
yield* ctx.catalog.transform((catalog) => {
for (const provider of loaded.data) {
catalog.provider.update(provider.info.id, (draft) => Object.assign(draft, provider.info))
catalog.provider.update(provider.info.id, (draft) => {
Object.assign(draft, provider.info)
if (provider.environment.length > 0) draft.integrationID = provider.info.id
})
for (const model of provider.models) {
catalog.model.update(provider.info.id, model.id, (draft) => Object.assign(draft, model))
}
@@ -236,6 +236,38 @@ describe("ModelsDevPlugin", () => {
),
)
it.effect("marks environment-backed source providers with integration identity", () =>
Effect.gen(function* () {
const integrations = yield* Integration.Service
const catalog = yield* Catalog.Service
const providerID = ProviderV2.ID.make("env-provider")
const models = ModelsDev.Service.of({
get: () =>
Effect.succeed([
{
info: {
id: providerID,
name: "Env Provider",
package: ProviderV2.aisdk("@ai-sdk/openai-compatible"),
},
environment: ["ENV_PROVIDER_API_KEY"],
models: [],
},
] satisfies readonly ModelsDev.Snapshot[]),
refresh: () => Effect.void,
})
yield* ModelsDevPlugin.effect(
host({
catalog: catalogHost(catalog),
integration: integrationHost(integrations),
}),
).pipe(Effect.provideService(ModelsDev.Service, models))
expect((yield* catalog.provider.get(providerID))?.integrationID).toBe(Integration.ID.make(providerID))
}),
)
it.effect("converts reasoning options into settings variants", () =>
Effect.acquireUseRelease(
Effect.sync(() => {