mini: move frontend into tui package (#37754)

This commit is contained in:
Simon Klee 2026-07-19 14:12:22 +02:00 committed by GitHub
commit c50554d907
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
80 changed files with 2365 additions and 1488 deletions

View file

@ -0,0 +1,22 @@
import type { OpenCodeClient } from "@opencode-ai/client/promise"
// Location plugins initialize asynchronously, so explicit model selection must
// wait for that exact model before prompt admission. The execution path owns
// the authoritative error if readiness times out.
export async function waitForCatalogReady(input: {
sdk: OpenCodeClient
directory: string
workspace?: string
model: { providerID: string; modelID: string }
timeoutMs?: number
}) {
const deadline = Date.now() + (input.timeoutMs ?? 5_000)
while (Date.now() < deadline) {
const models = await input.sdk.model
.list({ location: { directory: input.directory, workspace: input.workspace } })
.then((result) => result.data)
.catch(() => undefined)
if (models?.some((model) => model.providerID === input.model.providerID && model.id === input.model.modelID)) return
await new Promise((resolve) => setTimeout(resolve, 25))
}
}