cloudaxe-opencode/packages/protocol/src/groups/model.ts
Simon Klee f016392368
feat(mini): migrate mini to v2 (#34895)
feat(run): migrate non-interactive prompts to V2
feat(run): route mini prompts through V2
fix(run): use current session contracts
fix(run): fix V2 prompt turns
feat(cli): add mini subcommand
feat(run): use settled execution events
fix(run): handle remote prompt file attachments
feat(run): send prompt files as attachments
feat(run): use current APIs for run state
fix(run): adopt app-node runtime deps
feat(run): track subagent sessions
feat(run): move catalogs and default model onto current APIs
2026-07-02 12:06:49 +02:00

44 lines
1.5 KiB
TypeScript

import { Model } from "@opencode-ai/schema/model"
import { Location } from "@opencode-ai/schema/location"
import { Schema } from "effect"
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
import { ServiceUnavailableError } from "../errors.js"
import { LocationQuery, locationQueryOpenApi } from "./location.js"
export const ModelGroup = HttpApiGroup.make("server.model")
.add(
HttpApiEndpoint.get("model.list", "/api/model", {
query: LocationQuery,
success: Location.response(Schema.Array(Model.Info)),
error: ServiceUnavailableError,
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(
OpenApi.annotations({
identifier: "v2.model.list",
summary: "List models",
description: "Retrieve available models ordered by release date.",
}),
),
)
.add(
HttpApiEndpoint.get("model.default", "/api/model/default", {
query: LocationQuery,
success: Location.response(Schema.UndefinedOr(Model.Info)),
error: ServiceUnavailableError,
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(
OpenApi.annotations({
identifier: "v2.model.default",
summary: "Get default model",
description: "Retrieve the model used when a session has no explicit model selection.",
}),
),
)
.annotateMerge(
OpenApi.annotations({
title: "models",
description: "Experimental model routes.",
}),
)