Browse Source

tweak: bake in the aws and google auth pkgs (#14241)

Aiden Cline 1 month ago
parent
commit
308e500832
3 changed files with 9 additions and 5 deletions
  1. 4 0
      bun.lock
  2. 2 0
      packages/opencode/package.json
  3. 3 5
      packages/opencode/src/provider/provider.ts

File diff suppressed because it is too large
+ 4 - 0
bun.lock


+ 2 - 0
packages/opencode/package.json

@@ -55,6 +55,7 @@
     "@actions/core": "1.11.1",
     "@actions/github": "6.0.1",
     "@agentclientprotocol/sdk": "0.14.1",
+    "@aws-sdk/credential-providers": "3.993.0",
     "@ai-sdk/amazon-bedrock": "3.0.79",
     "@ai-sdk/anthropic": "2.0.62",
     "@ai-sdk/azure": "2.0.91",
@@ -107,6 +108,7 @@
     "drizzle-orm": "1.0.0-beta.12-a5629fb",
     "fuzzysort": "3.1.0",
     "gray-matter": "4.0.3",
+    "google-auth-library": "10.5.0",
     "hono": "catalog:",
     "hono-openapi": "catalog:",
     "ignore": "7.0.5",

+ 3 - 5
packages/opencode/src/provider/provider.ts

@@ -39,6 +39,8 @@ import { createTogetherAI } from "@ai-sdk/togetherai"
 import { createPerplexity } from "@ai-sdk/perplexity"
 import { createVercel } from "@ai-sdk/vercel"
 import { createGitLab, VERSION as GITLAB_PROVIDER_VERSION } from "@gitlab/gitlab-ai-provider"
+import { fromNodeProviderChain } from "@aws-sdk/credential-providers"
+import { GoogleAuth } from "google-auth-library"
 import { ProviderTransform } from "./transform"
 import { Installation } from "../installation"
 
@@ -251,8 +253,6 @@ export namespace Provider {
       // Only use credential chain if no bearer token exists
       // Bearer token takes precedence over credential chain (profiles, access keys, IAM roles, web identity tokens)
       if (!awsBearerToken) {
-        const { fromNodeProviderChain } = await import(await BunProc.install("@aws-sdk/credential-providers"))
-
         // Build credential provider options (only pass profile if specified)
         const credentialProviderOptions = profile ? { profile } : {}
 
@@ -395,11 +395,9 @@ export namespace Provider {
           project,
           location,
           fetch: async (input: RequestInfo | URL, init?: RequestInit) => {
-            const { GoogleAuth } = await import(await BunProc.install("google-auth-library"))
             const auth = new GoogleAuth()
             const client = await auth.getApplicationDefault()
-            const credentials = await client.credential
-            const token = await credentials.getAccessToken()
+            const token = await client.credential.getAccessToken()
 
             const headers = new Headers(init?.headers)
             headers.set("Authorization", `Bearer ${token.token}`)

Some files were not shown because too many files changed in this diff