()
| 47 | |
| 48 | // Wait for OpenCode to "open the browser" (the shim records the URL). |
| 49 | const waitForAuthorizeUrl = async (): Promise<string> => { |
| 50 | const deadline = Date.now() + 90_000; |
| 51 | while (Date.now() < deadline) { |
| 52 | const url = home.openedUrls()[sinceIndex]; |
| 53 | if (url) return url.trim(); |
| 54 | await new Promise((tick) => setTimeout(tick, 250)); |
| 55 | } |
| 56 | throw new Error("opencode never opened an authorization URL"); |
| 57 | }; |
| 58 | |
| 59 | // The agent and the browser run concurrently: `opencode mcp auth` blocks on |
| 60 | // its localhost callback, which only fires once the browser completes the |
no outgoing calls
no test coverage detected