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:
Kit Langton
2026-03-10 10:56:16 -04:00
parent 531ba1dd69
commit 0a05161da6
3 changed files with 5 additions and 4 deletions

View File

@@ -14,7 +14,6 @@ import {
AccessToken,
Account,
AccountID,
AccountRepoError,
AccountServiceError,
Login,
Org,

View File

@@ -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) {

View File

@@ -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)