opencode/packages/plugin/src/v2/effect/catalog.ts
Aiden Cline d3bdc98457 refactor(core): let plugins pin small models via catalog draft
Move copilot utility-model preference out of core selection into the
github-copilot plugin by exposing catalog.model.small set/get/remove on
the transform draft.
2026-07-12 21:21:41 -05:00

37 lines
1.3 KiB
TypeScript

import type { ModelInfo, ProviderV2Info } from "@opencode-ai/sdk/v2/types"
import type { CatalogApi } from "@opencode-ai/client/effect/api"
import type { Effect } from "effect"
import type { Transform } from "./registration.js"
export interface CatalogProviderRecord {
readonly provider: ProviderV2Info
readonly models: ReadonlyMap<string, ModelInfo>
}
export interface CatalogDraft {
readonly provider: {
list(): readonly CatalogProviderRecord[]
get(providerID: string): CatalogProviderRecord | undefined
update(providerID: string, update: (provider: ProviderV2Info) => void): void
remove(providerID: string): void
}
readonly model: {
get(providerID: string, modelID: string): ModelInfo | undefined
update(providerID: string, modelID: string, update: (model: ModelInfo) => void): void
remove(providerID: string, modelID: string): void
readonly default: {
get(): { providerID: string; modelID: string } | undefined
set(providerID: string, modelID: string): void
}
readonly small: {
get(providerID: string): string | undefined
set(providerID: string, modelID: string): void
remove(providerID: string): void
}
}
}
export interface CatalogDomain extends CatalogApi<unknown> {
readonly transform: Transform<CatalogDraft>
readonly reload: () => Effect.Effect<void>
}