| 54 | } |
| 55 | |
| 56 | const cloneModel = (model: ModelsDev.Provider["models"][string]) => { |
| 57 | const cloned = structuredClone(model) |
| 58 | const { experimental, ...rest } = cloned |
| 59 | // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- The config schema accepts the same model shape except object-valued experimental metadata. |
| 60 | if (typeof experimental === "boolean") { |
| 61 | // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- The fixture model already matches config input when experimental is boolean. |
| 62 | return cloned as NonNullable<NonNullable<ConfigV1.Info["provider"]>[string]["models"]>[string] |
| 63 | } |
| 64 | // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- Dropping non-boolean experimental metadata makes the fixture model match config input. |
| 65 | return rest as NonNullable<NonNullable<ConfigV1.Info["provider"]>[string]["models"]>[string] |
| 66 | } |
| 67 | |
| 68 | const envValue = (...names: string[]) => names.map((name) => process.env[name]).find(Boolean) |
| 69 | const decodeAuth = Schema.decodeUnknownOption(Auth.Info) |