|
|
@@ -1,6 +1,7 @@
|
|
|
import type { Hooks, PluginInput } from "@opencode-ai/plugin"
|
|
|
import { Installation } from "@/installation"
|
|
|
import { iife } from "@/util/iife"
|
|
|
+import { setTimeout as sleep } from "node:timers/promises"
|
|
|
|
|
|
const CLIENT_ID = "Ov23li8tweQw6odWQebz"
|
|
|
// Add a small safety buffer when polling to avoid hitting the server
|
|
|
@@ -270,7 +271,7 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
|
|
|
}
|
|
|
|
|
|
if (data.error === "authorization_pending") {
|
|
|
- await Bun.sleep(deviceData.interval * 1000 + OAUTH_POLLING_SAFETY_MARGIN_MS)
|
|
|
+ await sleep(deviceData.interval * 1000 + OAUTH_POLLING_SAFETY_MARGIN_MS)
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
@@ -286,13 +287,13 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
|
|
|
newInterval = serverInterval * 1000
|
|
|
}
|
|
|
|
|
|
- await Bun.sleep(newInterval + OAUTH_POLLING_SAFETY_MARGIN_MS)
|
|
|
+ await sleep(newInterval + OAUTH_POLLING_SAFETY_MARGIN_MS)
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
if (data.error) return { type: "failed" as const }
|
|
|
|
|
|
- await Bun.sleep(deviceData.interval * 1000 + OAUTH_POLLING_SAFETY_MARGIN_MS)
|
|
|
+ await sleep(deviceData.interval * 1000 + OAUTH_POLLING_SAFETY_MARGIN_MS)
|
|
|
continue
|
|
|
}
|
|
|
},
|