chore: merge dev into v2 (#36770)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: usrnk1 <7547651+usrnk1@users.noreply.github.com> Co-authored-by: Aarav Sareen <96787824+arvsrn@users.noreply.github.com> Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com> Co-authored-by: Brendan Allan <git@brendonovich.dev> Co-authored-by: Kit Langton <kit.langton@gmail.com> Co-authored-by: James Long <longster@gmail.com> Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com> Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Jay <53023+jayair@users.noreply.github.com> Co-authored-by: Simon Klee <hello@simonklee.dk> Co-authored-by: Jay <air@live.ca> Co-authored-by: Jack <jack@anoma.ly> Co-authored-by: David Hill <1879069+iamdavidhill@users.noreply.github.com> Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com> Co-authored-by: opencode <opencode@sst.dev> Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: James Long <jlongster@users.noreply.github.com> Co-authored-by: Dustin Deus <deusdustin@gmail.com> Co-authored-by: 冯基魁 <56265583+fengjikui@users.noreply.github.com> Co-authored-by: Frank <frank@anoma.ly> Co-authored-by: Aiden Cline <rekram1-node@users.noreply.github.com> Co-authored-by: Victor Navarro <vn4varro@gmail.com> Co-authored-by: Dax Raad <d@ironbay.co> Co-authored-by: Dax <mail@thdxr.com> Co-authored-by: Nabs <nabil@instafork.com> Co-authored-by: Vladimir Glafirov <vglafirov@gitlab.com> Co-authored-by: AidenGeunGeun <eastlandwyvern@gmail.com> Co-authored-by: Mark <geraint0923@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
26e27c7a7f
commit
634386fe0f
@@ -348,6 +348,18 @@ const layer: Layer.Layer<Service, never, AccountRepo.Service | HttpClient.HttpCl
|
||||
return yield* fetchOrgs(account.url, accessToken)
|
||||
})
|
||||
|
||||
const remove = Effect.fn("Account.remove")(function* (accountID: AccountID) {
|
||||
const active = yield* repo.active()
|
||||
yield* repo.remove(accountID)
|
||||
if (Option.isNone(active) || active.value.id !== accountID) return
|
||||
|
||||
const next = (yield* orgsByAccount()).flatMap((group) =>
|
||||
group.orgs.map((org) => ({ accountID: group.account.id, orgID: org.id })),
|
||||
)[0]
|
||||
if (!next) return
|
||||
yield* repo.use(next.accountID, Option.some(next.orgID))
|
||||
})
|
||||
|
||||
const config = Effect.fn("Account.config")(function* (accountID: AccountID, orgID: OrgID) {
|
||||
const resolved = yield* resolveAccess(accountID)
|
||||
if (Option.isNone(resolved)) return Option.none()
|
||||
@@ -445,7 +457,7 @@ const layer: Layer.Layer<Service, never, AccountRepo.Service | HttpClient.HttpCl
|
||||
activeOrg,
|
||||
list: repo.list,
|
||||
orgsByAccount,
|
||||
remove: repo.remove,
|
||||
remove,
|
||||
use: repo.use,
|
||||
orgs,
|
||||
config,
|
||||
|
||||
@@ -283,8 +283,10 @@ export async function CodexAuthPlugin(input: PluginInput, options: CodexAuthPlug
|
||||
return Object.fromEntries(
|
||||
Object.entries(provider.models)
|
||||
.filter(([, model]) => {
|
||||
if (model.options.reasoningMode === "pro") return false
|
||||
if (ALLOWED_MODELS.has(model.api.id)) return true
|
||||
if (DISALLOWED_MODELS.has(model.api.id)) return false
|
||||
if (model.api.id === "gpt-5.6") return false
|
||||
const match = model.api.id.match(/^gpt-(\d+\.\d+)/)
|
||||
return match ? parseFloat(match[1]) > 5.4 : false
|
||||
})
|
||||
@@ -416,6 +418,7 @@ export async function CodexAuthPlugin(input: PluginInput, options: CodexAuthPlug
|
||||
|
||||
const requestInit = {
|
||||
...init,
|
||||
body: init?.body,
|
||||
headers,
|
||||
}
|
||||
if (websocketFetch && parsed.pathname.endsWith("/responses")) return websocketFetch(url, requestInit)
|
||||
|
||||
@@ -1266,6 +1266,14 @@ export function fromModelsDevProvider(provider: ModelsDev.Provider): Info {
|
||||
// @ts-expect-error dead V1 expects raw model IDs inside normalized ModelsDev data.
|
||||
const id = `${model.id}-${mode}`
|
||||
const base = fromModelsDevModel(provider, model)
|
||||
const providerOptions = (
|
||||
opts as {
|
||||
readonly provider?: {
|
||||
readonly body?: Record<string, unknown>
|
||||
readonly headers?: Record<string, string>
|
||||
}
|
||||
}
|
||||
).provider
|
||||
models[id] = {
|
||||
...base,
|
||||
id: ModelV2.ID.make(id),
|
||||
@@ -1273,18 +1281,8 @@ export function fromModelsDevProvider(provider: ModelsDev.Provider): Info {
|
||||
name: `${model.name} ${mode[0].toUpperCase()}${mode.slice(1)}`,
|
||||
// @ts-expect-error dead V1 expects raw mode costs inside normalized ModelsDev data.
|
||||
cost: opts.cost ? mergeDeep(base.cost, cost(opts.cost)) : base.cost,
|
||||
// @ts-expect-error dead V1 expects raw mode provider bodies inside normalized ModelsDev data.
|
||||
options: opts.provider?.body
|
||||
? Object.fromEntries(
|
||||
// @ts-expect-error dead V1 expects raw mode provider bodies inside normalized ModelsDev data.
|
||||
Object.entries(opts.provider.body).map(([k, v]) => [
|
||||
k.replace(/_([a-z])/g, (_, c) => c.toUpperCase()),
|
||||
v,
|
||||
]),
|
||||
)
|
||||
: base.options,
|
||||
// @ts-expect-error dead V1 expects raw mode headers inside normalized ModelsDev data.
|
||||
headers: opts.provider?.headers ?? base.headers,
|
||||
options: modeOptions(base, providerOptions?.body),
|
||||
headers: providerOptions?.headers ?? base.headers,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1298,6 +1296,17 @@ export function fromModelsDevProvider(provider: ModelsDev.Provider): Info {
|
||||
}
|
||||
}
|
||||
|
||||
function modeOptions(model: Model, body: Record<string, unknown> | undefined) {
|
||||
if (!body) return model.options
|
||||
const options = Object.fromEntries(
|
||||
Object.entries(body).map(([key, value]) => [key.replace(/_([a-z])/g, (_, char) => char.toUpperCase()), value]),
|
||||
)
|
||||
const reasoning = body.reasoning
|
||||
if (model.api.npm !== "@ai-sdk/openai" || !isRecord(reasoning) || typeof reasoning.mode !== "string") return options
|
||||
const { reasoning: _, ...rest } = options
|
||||
return { ...rest, reasoningMode: reasoning.mode }
|
||||
}
|
||||
|
||||
function modelSuggestions(provider: Info | undefined, modelID: ModelV2.ID, enableExperimentalModels: boolean) {
|
||||
const available = provider
|
||||
? Object.keys(provider.models).filter((id) => {
|
||||
|
||||
@@ -761,7 +761,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
||||
}
|
||||
|
||||
case "@ai-sdk/gateway":
|
||||
if (model.id.includes("anthropic")) {
|
||||
if (model.api.id.includes("anthropic")) {
|
||||
if (adaptiveEfforts) {
|
||||
return Object.fromEntries(
|
||||
adaptiveEfforts.map((effort) => [
|
||||
@@ -794,8 +794,8 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
||||
},
|
||||
}
|
||||
}
|
||||
if (model.id.includes("google")) {
|
||||
if (id.includes("2.5")) {
|
||||
if (model.api.id.includes("google")) {
|
||||
if (model.api.id.includes("2.5")) {
|
||||
return {
|
||||
high: {
|
||||
thinkingConfig: {
|
||||
@@ -806,7 +806,7 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
||||
max: {
|
||||
thinkingConfig: {
|
||||
includeThoughts: true,
|
||||
thinkingBudget: googleThinkingBudgetMax(id),
|
||||
thinkingBudget: googleThinkingBudgetMax(model.api.id.toLowerCase()),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1104,7 +1104,8 @@ export function options(input: {
|
||||
input.model.providerID === "openai" ||
|
||||
input.model.api.npm === "@ai-sdk/openai" ||
|
||||
input.model.api.npm === "@ai-sdk/github-copilot" ||
|
||||
input.model.api.npm === "@ai-sdk/amazon-bedrock/mantle"
|
||||
input.model.api.npm === "@ai-sdk/amazon-bedrock/mantle" ||
|
||||
input.model.api.npm === "@ai-sdk/xai"
|
||||
) {
|
||||
result["store"] = false
|
||||
}
|
||||
@@ -1259,7 +1260,8 @@ export function smallOptions(model: Provider.Model) {
|
||||
if (
|
||||
model.providerID === "openai" ||
|
||||
model.api.npm === "@ai-sdk/openai" ||
|
||||
model.api.npm === "@ai-sdk/github-copilot"
|
||||
model.api.npm === "@ai-sdk/github-copilot" ||
|
||||
model.api.npm === "@ai-sdk/xai"
|
||||
) {
|
||||
const base = { store: false }
|
||||
return mergeDeep(base, small)
|
||||
|
||||
Reference in New Issue
Block a user