29 lines
723 B
TypeScript
29 lines
723 B
TypeScript
import { config } from "../config.js";
|
|
import {
|
|
getAgentModelIds,
|
|
parseAgentModelOptions,
|
|
type SupportedModel,
|
|
} from "./modelConfig.js";
|
|
|
|
export {
|
|
type AgentModelIcon,
|
|
type AgentModelOption,
|
|
type SupportedModel,
|
|
} from "./modelConfig.js";
|
|
|
|
export const agentModelOptions = parseAgentModelOptions(
|
|
config.OPENCODE_MODEL_OPTIONS,
|
|
);
|
|
|
|
export const supportedModels = getAgentModelIds(agentModelOptions);
|
|
|
|
export const isSupportedModel = (model: string): model is SupportedModel =>
|
|
supportedModels.includes(model);
|
|
|
|
export const resolveDefaultModel = (model: string): SupportedModel => {
|
|
if (!isSupportedModel(model)) {
|
|
throw new Error(`unsupported default agent model: ${model}`);
|
|
}
|
|
return model;
|
|
};
|