From a6e3afe048a832b22da2fec9e41b7ef991423fc5 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" Date: Sat, 13 Jun 2026 18:11:18 +0000 Subject: [PATCH] chore: generate --- .../opencode/src/plugin/snowflake-cortex.ts | 10 +++++-- packages/opencode/src/provider/provider.ts | 3 +- .../test/plugin/snowflake-cortex.test.ts | 30 ++++++++++--------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/packages/opencode/src/plugin/snowflake-cortex.ts b/packages/opencode/src/plugin/snowflake-cortex.ts index e4630d27c..d40ebb6ac 100644 --- a/packages/opencode/src/plugin/snowflake-cortex.ts +++ b/packages/opencode/src/plugin/snowflake-cortex.ts @@ -35,7 +35,11 @@ let pendingOAuth: PendingOAuth | undefined let oauthServerPort: number | undefined function normalizeAccount(input: string) { - return input.trim().replace(/^https?:\/\//, "").replace(/\.snowflakecomputing\.com\/?$/, "").replace(/\/+$/, "") + return input + .trim() + .replace(/^https?:\/\//, "") + .replace(/\.snowflakecomputing\.com\/?$/, "") + .replace(/\/+$/, "") } function generateRandomString(length: number) { @@ -456,7 +460,9 @@ export async function SnowflakeCortexAuthPlugin(_input: PluginInput): Promise { // OAuth refresh + snowflake transformations in one place. // For env/config/API-key tokens, the provider fetch applies snowflake // transformations directly. - const useOAuthHandler = oauthToken !== undefined && envToken === undefined && apiKeyToken === undefined && configToken === undefined + const useOAuthHandler = + oauthToken !== undefined && envToken === undefined && apiKeyToken === undefined && configToken === undefined if (!useOAuthHandler) { options.fetch = async (url: RequestInfo | URL, init?: RequestInit) => { if (init?.body && typeof init.body === "string") { diff --git a/packages/opencode/test/plugin/snowflake-cortex.test.ts b/packages/opencode/test/plugin/snowflake-cortex.test.ts index 5fac990d3..de5ac28c3 100644 --- a/packages/opencode/test/plugin/snowflake-cortex.test.ts +++ b/packages/opencode/test/plugin/snowflake-cortex.test.ts @@ -106,13 +106,14 @@ describe("plugin.snowflake-cortex", () => { try { const hooks = await SnowflakeCortexAuthPlugin(input) const options = await hooks.auth!.loader!( - async () => ({ - type: "oauth", - access: "access-expired", - refresh: "refresh-old", - expires: 0, - accountId: "myorg-myaccount", - }) as any, + async () => + ({ + type: "oauth", + access: "access-expired", + refresh: "refresh-old", + expires: 0, + accountId: "myorg-myaccount", + }) as any, {} as any, ) @@ -139,13 +140,14 @@ describe("plugin.snowflake-cortex", () => { const { input, getAuth, setCalls } = makeInput() const hooks = await SnowflakeCortexAuthPlugin(input) const options = await hooks.auth!.loader!( - async () => ({ - type: "oauth", - access: "access-stale", - refresh: "refresh-old", - expires: Date.now() + 60 * 60 * 1000, - accountId: "myorg-myaccount", - }) as any, + async () => + ({ + type: "oauth", + access: "access-stale", + refresh: "refresh-old", + expires: Date.now() + 60 * 60 * 1000, + accountId: "myorg-myaccount", + }) as any, {} as any, )