feat(core): flatten provider config and load native packages (#35563)

Co-authored-by: Dax Raad <d@ironbay.co>
This commit is contained in:
Shoubhit Dash
2026-07-06 16:18:56 -04:00
committed by GitHub
co-authored by Dax Raad
parent d603eed5a1
commit e57d9ca390
107 changed files with 2596 additions and 1987 deletions
@@ -54,7 +54,8 @@ describe("DynamicProviderPlugin", () => {
const result = yield* aisdk.runSDK({
model: ModelV2.Info.make({
...ModelV2.Info.empty(ProviderV2.ID.make("custom"), ModelV2.ID.make("test-model")),
api: { id: ModelV2.ID.make("test-model"), type: "aisdk", package: fixtureProvider },
modelID: ModelV2.ID.make("test-model"),
package: ProviderV2.aisdk(fixtureProvider),
}),
package: fixtureProvider,
options: { name: "custom", marker: "dynamic" },
@@ -72,7 +73,8 @@ describe("DynamicProviderPlugin", () => {
const result = yield* aisdk.runSDK({
model: ModelV2.Info.make({
...ModelV2.Info.empty(ProviderV2.ID.make("custom"), ModelV2.ID.make("test-model")),
api: { id: ModelV2.ID.make("test-model"), type: "aisdk", package: fixtureProvider },
modelID: ModelV2.ID.make("test-model"),
package: ProviderV2.aisdk(fixtureProvider),
}),
package: fixtureProvider,
options: { name: "custom", marker: "dynamic" },
@@ -89,7 +91,8 @@ describe("DynamicProviderPlugin", () => {
const result = yield* aisdk.runSDK({
model: ModelV2.Info.make({
...ModelV2.Info.empty(ProviderV2.ID.make("custom-provider"), ModelV2.ID.make("test-model")),
api: { id: ModelV2.ID.make("test-model"), type: "aisdk", package: fixtureProvider },
modelID: ModelV2.ID.make("test-model"),
package: ProviderV2.aisdk(fixtureProvider),
}),
package: fixtureProvider,
options: { name: "custom-provider", marker: "dynamic" },
@@ -105,7 +108,8 @@ describe("DynamicProviderPlugin", () => {
const result = yield* aisdk.runSDK({
model: ModelV2.Info.make({
...ModelV2.Info.empty(ProviderV2.ID.make("npm-provider"), ModelV2.ID.make("test-model")),
api: { id: ModelV2.ID.make("test-model"), type: "aisdk", package: "fixture-provider" },
modelID: ModelV2.ID.make("test-model"),
package: "aisdk:fixture-provider",
}),
package: "fixture-provider",
options: { name: "npm-provider", marker: "npm" },
@@ -122,7 +126,8 @@ describe("DynamicProviderPlugin", () => {
.language(
ModelV2.Info.make({
...ModelV2.Info.empty(ProviderV2.ID.make("missing-entrypoint"), ModelV2.ID.make("alias")),
api: { id: ModelV2.ID.make("alias"), type: "aisdk", package: "fixture-provider" },
modelID: ModelV2.ID.make("alias"),
package: "aisdk:fixture-provider",
}),
)
.pipe(Effect.exit)
@@ -139,7 +144,8 @@ describe("DynamicProviderPlugin", () => {
.language(
ModelV2.Info.make({
...ModelV2.Info.empty(ProviderV2.ID.make("bad-import"), ModelV2.ID.make("alias")),
api: { id: ModelV2.ID.make("alias"), type: "aisdk", package: "file:///missing/provider-factory.js" },
modelID: ModelV2.ID.make("alias"),
package: "aisdk:file:///missing/provider-factory.js",
}),
)
.pipe(Effect.exit)
@@ -158,7 +164,8 @@ describe("DynamicProviderPlugin", () => {
.language(
ModelV2.Info.make({
...ModelV2.Info.empty(ProviderV2.ID.make("missing-factory"), ModelV2.ID.make("alias")),
api: { id: ModelV2.ID.make("alias"), type: "aisdk", package: "fixture-provider" },
modelID: ModelV2.ID.make("alias"),
package: "aisdk:fixture-provider",
}),
)
.pipe(Effect.exit)
@@ -167,7 +174,7 @@ describe("DynamicProviderPlugin", () => {
}),
)
itWithAISDK.effect("uses the model api.id for the default language model", () =>
itWithAISDK.effect("uses the model modelID for the default language model", () =>
Effect.gen(function* () {
const plugin = yield* PluginV2.Service
const aisdk = yield* AISDK.Service
@@ -175,7 +182,8 @@ describe("DynamicProviderPlugin", () => {
const language = yield* aisdk.language(
ModelV2.Info.make({
...ModelV2.Info.empty(ProviderV2.ID.make("custom"), ModelV2.ID.make("alias")),
api: { id: ModelV2.ID.make("test-model-api"), type: "aisdk", package: fixtureProvider },
modelID: ModelV2.ID.make("test-model-api"),
package: ProviderV2.aisdk(fixtureProvider),
}),
)
expect(language).toMatchObject({ modelID: "test-model-api", options: { name: "custom" } })