소스 검색

chore: generate

opencode-agent[bot] 1 개월 전
부모
커밋
4f982ddb94
2개의 변경된 파일9개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 1
      packages/opencode/src/mcp/index.ts
  2. 7 5
      packages/opencode/test/mcp/oauth-auto-connect.test.ts

+ 2 - 1
packages/opencode/src/mcp/index.ts

@@ -401,7 +401,8 @@ export namespace MCP {
           // but may also throw plain Errors when auth() fails internally
           // (e.g. during discovery, registration, or state generation).
           // When an authProvider is attached, treat both cases as auth-related.
-          const isAuthError = error instanceof UnauthorizedError || (authProvider && lastError.message.includes("OAuth"))
+          const isAuthError =
+            error instanceof UnauthorizedError || (authProvider && lastError.message.includes("OAuth"))
           if (isAuthError) {
             log.info("mcp server requires authentication", { key, transport: name })
 

+ 7 - 5
packages/opencode/test/mcp/oauth-auto-connect.test.ts

@@ -22,11 +22,13 @@ let simulateAuthFlow = true
 // Mock the transport constructors to simulate OAuth auto-auth on 401
 mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
   StreamableHTTPClientTransport: class MockStreamableHTTP {
-    authProvider: {
-      state?: () => Promise<string>
-      redirectToAuthorization?: (url: URL) => Promise<void>
-      saveCodeVerifier?: (v: string) => Promise<void>
-    } | undefined
+    authProvider:
+      | {
+          state?: () => Promise<string>
+          redirectToAuthorization?: (url: URL) => Promise<void>
+          saveCodeVerifier?: (v: string) => Promise<void>
+        }
+      | undefined
     constructor(url: URL, options?: { authProvider?: unknown }) {
       this.authProvider = options?.authProvider as typeof this.authProvider
       transportCalls.push({