mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-24 06:45:22 +00:00
core: cleanup from simplify review
- Remove unused AccountRepoError import from service.ts - Replace Bun.sleep with setTimeout in providers.ts - Parallelize Account.config() + Account.token() in config startup
This commit is contained in:
@@ -14,7 +14,6 @@ import {
|
||||
AccessToken,
|
||||
Account,
|
||||
AccountID,
|
||||
AccountRepoError,
|
||||
AccountServiceError,
|
||||
Login,
|
||||
Org,
|
||||
|
||||
@@ -33,7 +33,7 @@ async function handlePluginAuth(plugin: { auth: PluginAuth }, provider: string):
|
||||
}
|
||||
const method = plugin.auth.methods[index]
|
||||
|
||||
await Bun.sleep(10)
|
||||
await new Promise((r) => setTimeout(r, 10))
|
||||
const inputs: Record<string, string> = {}
|
||||
if (method.prompts) {
|
||||
for (const prompt of method.prompts) {
|
||||
|
||||
@@ -178,8 +178,10 @@ export namespace Config {
|
||||
const active = Account.active()
|
||||
if (active?.active_org_id) {
|
||||
try {
|
||||
const config = await Account.config(active.id, active.active_org_id)
|
||||
const token = await Account.token(active.id)
|
||||
const [config, token] = await Promise.all([
|
||||
Account.config(active.id, active.active_org_id),
|
||||
Account.token(active.id),
|
||||
])
|
||||
if (token) {
|
||||
process.env["OPENCODE_CONSOLE_TOKEN"] = token
|
||||
Env.set("OPENCODE_CONSOLE_TOKEN", token)
|
||||
|
||||
Reference in New Issue
Block a user