From 25f6b1a2dbfae3f8fc91e51302eea9c1f1153f4d Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Thu, 9 Jul 2026 21:58:57 +0000 Subject: [PATCH] fix(core): mark models.dev env providers as integrations --- packages/core/src/plugin/models-dev.ts | 5 ++- packages/core/test/plugin/models-dev.test.ts | 32 ++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/packages/core/src/plugin/models-dev.ts b/packages/core/src/plugin/models-dev.ts index 3d2957e1ba..3c272e6c56 100644 --- a/packages/core/src/plugin/models-dev.ts +++ b/packages/core/src/plugin/models-dev.ts @@ -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)) } diff --git a/packages/core/test/plugin/models-dev.test.ts b/packages/core/test/plugin/models-dev.test.ts index bb8e460d73..387ac65463 100644 --- a/packages/core/test/plugin/models-dev.test.ts +++ b/packages/core/test/plugin/models-dev.test.ts @@ -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(() => {