chore: generate

This commit is contained in:
opencode-agent[bot]
2026-05-13 14:47:40 +00:00
parent 766318a4cf
commit 5b5376a3fa
12 changed files with 1558 additions and 737 deletions

View File

@@ -24,7 +24,11 @@ export const AzurePlugin = PluginV2.define({
"aisdk.sdk": Effect.fn(function* (evt) { "aisdk.sdk": Effect.fn(function* (evt) {
if (evt.package !== "@ai-sdk/azure") return if (evt.package !== "@ai-sdk/azure") return
if (evt.model.providerID === ProviderV2.ID.azure) { if (evt.model.providerID === ProviderV2.ID.azure) {
if (!evt.options.resourceName && !evt.options.baseURL && (evt.model.endpoint.type !== "aisdk" || !evt.model.endpoint.url)) { if (
!evt.options.resourceName &&
!evt.options.baseURL &&
(evt.model.endpoint.type !== "aisdk" || !evt.model.endpoint.url)
) {
throw new Error( throw new Error(
"AZURE_RESOURCE_NAME is missing, set it using env var or reconnecting the azure provider and setting it", "AZURE_RESOURCE_NAME is missing, set it using env var or reconnecting the azure provider and setting it",
) )
@@ -35,11 +39,7 @@ export const AzurePlugin = PluginV2.define({
}), }),
"aisdk.language": Effect.fn(function* (evt) { "aisdk.language": Effect.fn(function* (evt) {
if (evt.model.providerID !== ProviderV2.ID.azure) return if (evt.model.providerID !== ProviderV2.ID.azure) return
evt.language = selectLanguage( evt.language = selectLanguage(evt.sdk, evt.model.apiID, Boolean(evt.options.useCompletionUrls))
evt.sdk,
evt.model.apiID,
Boolean(evt.options.useCompletionUrls),
)
}), }),
} }
}), }),
@@ -52,15 +52,12 @@ export const AzureCognitiveServicesPlugin = PluginV2.define({
"provider.update": Effect.fn(function* (evt) { "provider.update": Effect.fn(function* (evt) {
if (evt.provider.id !== ProviderV2.ID.make("azure-cognitive-services")) return if (evt.provider.id !== ProviderV2.ID.make("azure-cognitive-services")) return
const resourceName = process.env.AZURE_COGNITIVE_SERVICES_RESOURCE_NAME const resourceName = process.env.AZURE_COGNITIVE_SERVICES_RESOURCE_NAME
if (resourceName) evt.provider.options.aisdk.provider.baseURL = `https://${resourceName}.cognitiveservices.azure.com/openai` if (resourceName)
evt.provider.options.aisdk.provider.baseURL = `https://${resourceName}.cognitiveservices.azure.com/openai`
}), }),
"aisdk.language": Effect.fn(function* (evt) { "aisdk.language": Effect.fn(function* (evt) {
if (evt.model.providerID !== ProviderV2.ID.make("azure-cognitive-services")) return if (evt.model.providerID !== ProviderV2.ID.make("azure-cognitive-services")) return
evt.language = selectLanguage( evt.language = selectLanguage(evt.sdk, evt.model.apiID, Boolean(evt.options.useCompletionUrls))
evt.sdk,
evt.model.apiID,
Boolean(evt.options.useCompletionUrls),
)
}), }),
} }
}), }),

View File

@@ -32,7 +32,8 @@ export const GitLabPlugin = PluginV2.define({
}), }),
"aisdk.language": Effect.fn(function* (evt) { "aisdk.language": Effect.fn(function* (evt) {
if (evt.model.providerID !== ProviderV2.ID.gitlab) return if (evt.model.providerID !== ProviderV2.ID.gitlab) return
const featureFlags = typeof evt.options.featureFlags === "object" && evt.options.featureFlags ? evt.options.featureFlags : {} const featureFlags =
typeof evt.options.featureFlags === "object" && evt.options.featureFlags ? evt.options.featureFlags : {}
if (evt.model.apiID.startsWith("duo-workflow-")) { if (evt.model.apiID.startsWith("duo-workflow-")) {
const gitlab = yield* Effect.promise(() => import("gitlab-ai-provider")).pipe(Effect.orDie) const gitlab = yield* Effect.promise(() => import("gitlab-ai-provider")).pipe(Effect.orDie)
const workflowRef = const workflowRef =

View File

@@ -15,7 +15,13 @@ function resolveProject(options: Record<string, any>) {
} }
function resolveLocation(options: Record<string, any>) { function resolveLocation(options: Record<string, any>) {
return options.location ?? process.env.GOOGLE_VERTEX_LOCATION ?? process.env.GOOGLE_CLOUD_LOCATION ?? process.env.VERTEX_LOCATION ?? "us-central1" return (
options.location ??
process.env.GOOGLE_VERTEX_LOCATION ??
process.env.GOOGLE_CLOUD_LOCATION ??
process.env.VERTEX_LOCATION ??
"us-central1"
)
} }
function vertexEndpoint(location: string) { function vertexEndpoint(location: string) {
@@ -60,7 +66,10 @@ export const GoogleVertexPlugin = PluginV2.define({
if (evt.provider.endpoint.type === "aisdk" && evt.provider.endpoint.url) { if (evt.provider.endpoint.type === "aisdk" && evt.provider.endpoint.url) {
evt.provider.endpoint.url = replaceVertexVars(evt.provider.endpoint.url, project, location) evt.provider.endpoint.url = replaceVertexVars(evt.provider.endpoint.url, project, location)
} }
if (evt.provider.endpoint.type === "aisdk" && evt.provider.endpoint.package.includes("@ai-sdk/openai-compatible")) { if (
evt.provider.endpoint.type === "aisdk" &&
evt.provider.endpoint.package.includes("@ai-sdk/openai-compatible")
) {
evt.provider.options.aisdk.provider.fetch = authFetch(evt.provider.options.aisdk.provider.fetch) evt.provider.options.aisdk.provider.fetch = authFetch(evt.provider.options.aisdk.provider.fetch)
} }
}), }),
@@ -95,8 +104,16 @@ export const GoogleVertexAnthropicPlugin = PluginV2.define({
return { return {
"provider.update": Effect.fn(function* (evt) { "provider.update": Effect.fn(function* (evt) {
if (evt.provider.id !== ProviderV2.ID.make("google-vertex-anthropic")) return if (evt.provider.id !== ProviderV2.ID.make("google-vertex-anthropic")) return
const project = evt.provider.options.aisdk.provider.project ?? process.env.GOOGLE_CLOUD_PROJECT ?? process.env.GCP_PROJECT ?? process.env.GCLOUD_PROJECT const project =
const location = evt.provider.options.aisdk.provider.location ?? process.env.GOOGLE_CLOUD_LOCATION ?? process.env.VERTEX_LOCATION ?? "global" evt.provider.options.aisdk.provider.project ??
process.env.GOOGLE_CLOUD_PROJECT ??
process.env.GCP_PROJECT ??
process.env.GCLOUD_PROJECT
const location =
evt.provider.options.aisdk.provider.location ??
process.env.GOOGLE_CLOUD_LOCATION ??
process.env.VERTEX_LOCATION ??
"global"
if (project) evt.provider.options.aisdk.provider.project = project if (project) evt.provider.options.aisdk.provider.project = project
evt.provider.options.aisdk.provider.location = location evt.provider.options.aisdk.provider.location = location
}), }),

View File

@@ -10,7 +10,7 @@ export const OpencodePlugin = PluginV2.define({
"provider.update": Effect.fn(function* (evt) { "provider.update": Effect.fn(function* (evt) {
if (evt.provider.id !== ProviderV2.ID.opencode) return if (evt.provider.id !== ProviderV2.ID.opencode) return
hasKey = Boolean( hasKey = Boolean(
process.env.OPENCODE_API_KEY || process.env.OPENCODE_API_KEY ||
evt.provider.env.some((item) => process.env[item]) || evt.provider.env.some((item) => process.env[item]) ||
evt.provider.options.aisdk.provider.apiKey || evt.provider.options.aisdk.provider.apiKey ||
(evt.provider.enabled && evt.provider.enabled.via === "auth"), (evt.provider.enabled && evt.provider.enabled.via === "auth"),

View File

@@ -29,7 +29,11 @@ export const SapAICorePlugin = PluginV2.define({
const match = Object.keys(mod).find((name) => name.startsWith("create")) const match = Object.keys(mod).find((name) => name.startsWith("create"))
if (!match) throw new Error(`Package ${evt.package} has no provider factory export`) if (!match) throw new Error(`Package ${evt.package} has no provider factory export`)
evt.sdk = mod[match](serviceKey ? { deploymentId: process.env.AICORE_DEPLOYMENT_ID, resourceGroup: process.env.AICORE_RESOURCE_GROUP } : {}) evt.sdk = mod[match](
serviceKey
? { deploymentId: process.env.AICORE_DEPLOYMENT_ID, resourceGroup: process.env.AICORE_RESOURCE_GROUP }
: {},
)
}), }),
"aisdk.language": Effect.fn(function* (evt) { "aisdk.language": Effect.fn(function* (evt) {
if (evt.model.providerID !== ProviderV2.ID.make("sap-ai-core")) return if (evt.model.providerID !== ProviderV2.ID.make("sap-ai-core")) return

View File

@@ -11,8 +11,9 @@ function bedrockBaseURL(sdk: unknown, modelID = "anthropic.claude-sonnet-4-5") {
function bedrockFetch(sdk: unknown, modelID = "anthropic.claude-sonnet-4-5") { function bedrockFetch(sdk: unknown, modelID = "anthropic.claude-sonnet-4-5") {
const language = (sdk as { languageModel: (id: string) => unknown }).languageModel(modelID) const language = (sdk as { languageModel: (id: string) => unknown }).languageModel(modelID)
return (language as { config: { fetch: (input: Parameters<typeof fetch>[0], init?: RequestInit) => Promise<Response> } }).config return (
.fetch language as { config: { fetch: (input: Parameters<typeof fetch>[0], init?: RequestInit) => Promise<Response> } }
).config.fetch
} }
describe("AmazonBedrockPlugin", () => { describe("AmazonBedrockPlugin", () => {

View File

@@ -507,7 +507,11 @@ export type Patch = Types.DeepMutable<SyncEvent.Event<typeof Event.Updated>["dat
const db = <T>(fn: (d: Parameters<typeof Database.use>[0] extends (trx: infer D) => any ? D : never) => T) => const db = <T>(fn: (d: Parameters<typeof Database.use>[0] extends (trx: infer D) => any ? D : never) => T) =>
Effect.sync(() => Database.use(fn)) Effect.sync(() => Database.use(fn))
export const layer: Layer.Layer<Service, never, Bus.Service | Storage.Service | SyncEvent.Service | RuntimeFlags.Service> = Layer.effect( export const layer: Layer.Layer<
Service,
never,
Bus.Service | Storage.Service | SyncEvent.Service | RuntimeFlags.Service
> = Layer.effect(
Service, Service,
Effect.gen(function* () { Effect.gen(function* () {
const bus = yield* Bus.Service const bus = yield* Bus.Service
@@ -571,7 +575,9 @@ export const layer: Layer.Layer<Service, never, Bus.Service | Storage.Service |
const list = Effect.fn("Session.list")(function* (input?: ListInput) { const list = Effect.fn("Session.list")(function* (input?: ListInput) {
const ctx = yield* InstanceState.context const ctx = yield* InstanceState.context
return Array.from(listByProject({ projectID: ctx.project.id, experimentalWorkspaces: flags.experimentalWorkspaces, ...input })) return Array.from(
listByProject({ projectID: ctx.project.id, experimentalWorkspaces: flags.experimentalWorkspaces, ...input }),
)
}) })
const children = Effect.fn("Session.children")(function* (parentID: SessionID) { const children = Effect.fn("Session.children")(function* (parentID: SessionID) {

File diff suppressed because it is too large Load Diff

View File

@@ -198,6 +198,9 @@ import type {
TuiShowToastResponses, TuiShowToastResponses,
TuiSubmitPromptResponses, TuiSubmitPromptResponses,
V2ModelListResponses, V2ModelListResponses,
V2ProviderGetErrors,
V2ProviderGetResponses,
V2ProviderListResponses,
V2SessionCompactResponses, V2SessionCompactResponses,
V2SessionContextResponses, V2SessionContextResponses,
V2SessionListErrors, V2SessionListErrors,
@@ -4382,26 +4385,41 @@ export class Model extends HeyApiClient {
* *
* Retrieve available v2 models ordered by release date. * Retrieve available v2 models ordered by release date.
*/ */
public list<ThrowOnError extends boolean = false>( public list<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {
parameters?: { return (options?.client ?? this.client).get<V2ModelListResponses, unknown, ThrowOnError>({
directory?: string url: "/api/model",
workspace?: string ...options,
})
}
}
export class Provider2 extends HeyApiClient {
/**
* List v2 providers
*
* Retrieve active v2 AI providers so clients can show provider availability and configuration.
*/
public list<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {
return (options?.client ?? this.client).get<V2ProviderListResponses, unknown, ThrowOnError>({
url: "/api/provider",
...options,
})
}
/**
* Get v2 provider
*
* Retrieve a single v2 AI provider so clients can inspect its availability and endpoint settings.
*/
public get<ThrowOnError extends boolean = false>(
parameters: {
providerID: string
}, },
options?: Options<never, ThrowOnError>, options?: Options<never, ThrowOnError>,
) { ) {
const params = buildClientParams( const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "providerID" }] }])
[parameters], return (options?.client ?? this.client).get<V2ProviderGetResponses, V2ProviderGetErrors, ThrowOnError>({
[ url: "/api/provider/{providerID}",
{
args: [
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
],
},
],
)
return (options?.client ?? this.client).get<V2ModelListResponses, unknown, ThrowOnError>({
url: "/api/model",
...options, ...options,
...params, ...params,
}) })
@@ -4418,6 +4436,11 @@ export class V2 extends HeyApiClient {
get model(): Model { get model(): Model {
return (this._model ??= new Model({ client: this.client })) return (this._model ??= new Model({ client: this.client }))
} }
private _provider?: Provider2
get provider(): Provider2 {
return (this._provider ??= new Provider2({ client: this.client }))
}
} }
export class Control extends HeyApiClient { export class Control extends HeyApiClient {

View File

@@ -3380,10 +3380,14 @@ export type SessionMessage =
export type ModelV2Info = { export type ModelV2Info = {
id: string id: string
apiID: string
providerID: string providerID: string
family?: string family?: string
name: string name: string
endpoint: endpoint:
| {
type: "unknown"
}
| { | {
type: "openai/responses" type: "openai/responses"
url: string url: string
@@ -3404,6 +3408,11 @@ export type ModelV2Info = {
type: "anthropic/messages" type: "anthropic/messages"
url: string url: string
} }
| {
type: "aisdk"
package: string
url?: string
}
capabilities: { capabilities: {
tools: boolean tools: boolean
input: Array<string> input: Array<string>
@@ -3416,6 +3425,14 @@ export type ModelV2Info = {
body: { body: {
[key: string]: unknown [key: string]: unknown
} }
aisdk: {
provider: {
[key: string]: unknown
}
request: {
[key: string]: unknown
}
}
variant?: string variant?: string
} }
variants: Array<{ variants: Array<{
@@ -3426,6 +3443,14 @@ export type ModelV2Info = {
body: { body: {
[key: string]: unknown [key: string]: unknown
} }
aisdk: {
provider: {
[key: string]: unknown
}
request: {
[key: string]: unknown
}
}
}> }>
time: { time: {
released: number | "NaN" | "Infinity" | "-Infinity" | "Infinity" | "-Infinity" | "NaN" released: number | "NaN" | "Infinity" | "-Infinity" | "Infinity" | "-Infinity" | "NaN"
@@ -3443,6 +3468,7 @@ export type ModelV2Info = {
} }
}> }>
status: "alpha" | "beta" | "deprecated" | "active" status: "alpha" | "beta" | "deprecated" | "active"
enabled: boolean
limit: { limit: {
context: number context: number
input?: number input?: number
@@ -3450,6 +3476,73 @@ export type ModelV2Info = {
} }
} }
export type ProviderV2Info = {
id: string
name: string
enabled:
| false
| {
via: "env"
name: string
}
| {
via: "auth"
service: string
}
| {
via: "custom"
data: {
[key: string]: unknown
}
}
env: Array<string>
endpoint:
| {
type: "unknown"
}
| {
type: "openai/responses"
url: string
websocket?: boolean
}
| {
type: "openai/completions"
url: string
reasoning?:
| {
type: "reasoning_content"
}
| {
type: "reasoning_details"
}
}
| {
type: "anthropic/messages"
url: string
}
| {
type: "aisdk"
package: string
url?: string
}
options: {
headers: {
[key: string]: string
}
body: {
[key: string]: unknown
}
aisdk: {
provider: {
[key: string]: unknown
}
request: {
[key: string]: unknown
}
}
}
}
export type EventTuiToastShow1 = { export type EventTuiToastShow1 = {
id: string id: string
type: "tui.toast.show" type: "tui.toast.show"
@@ -6580,10 +6673,7 @@ export type V2SessionMessagesResponse2 = V2SessionMessagesResponses[keyof V2Sess
export type V2ModelListData = { export type V2ModelListData = {
body?: never body?: never
path?: never path?: never
query?: { query?: never
directory?: string
workspace?: string
}
url: "/api/model" url: "/api/model"
} }
@@ -6596,6 +6686,49 @@ export type V2ModelListResponses = {
export type V2ModelListResponse = V2ModelListResponses[keyof V2ModelListResponses] export type V2ModelListResponse = V2ModelListResponses[keyof V2ModelListResponses]
export type V2ProviderListData = {
body?: never
path?: never
query?: never
url: "/api/provider"
}
export type V2ProviderListResponses = {
/**
* Success
*/
200: Array<ProviderV2Info>
}
export type V2ProviderListResponse = V2ProviderListResponses[keyof V2ProviderListResponses]
export type V2ProviderGetData = {
body?: never
path: {
providerID: string
}
query?: never
url: "/api/provider/{providerID}"
}
export type V2ProviderGetErrors = {
/**
* NotFoundError
*/
404: NotFoundError
}
export type V2ProviderGetError = V2ProviderGetErrors[keyof V2ProviderGetErrors]
export type V2ProviderGetResponses = {
/**
* ProviderV2.Info
*/
200: ProviderV2Info
}
export type V2ProviderGetResponse = V2ProviderGetResponses[keyof V2ProviderGetResponses]
export type TuiAppendPromptData = { export type TuiAppendPromptData = {
body?: { body?: {
text: string text: string

View File

@@ -7606,6 +7606,112 @@
] ]
} }
}, },
"/api/model": {
"get": {
"tags": ["v2 models"],
"operationId": "v2.model.list",
"parameters": [],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ModelV2Info"
}
}
}
}
}
},
"description": "Retrieve available v2 models ordered by release date.",
"summary": "List v2 models",
"x-codeSamples": [
{
"lang": "js",
"source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.v2.model.list({\n ...\n})"
}
]
}
},
"/api/provider": {
"get": {
"tags": ["v2 providers"],
"operationId": "v2.provider.list",
"parameters": [],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ProviderV2Info"
}
}
}
}
}
},
"description": "Retrieve active v2 AI providers so clients can show provider availability and configuration.",
"summary": "List v2 providers",
"x-codeSamples": [
{
"lang": "js",
"source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.v2.provider.list({\n ...\n})"
}
]
}
},
"/api/provider/{providerID}": {
"get": {
"tags": ["v2 providers"],
"operationId": "v2.provider.get",
"parameters": [
{
"name": "providerID",
"in": "path",
"schema": {
"type": "string"
},
"required": true
}
],
"responses": {
"200": {
"description": "ProviderV2.Info",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProviderV2Info"
}
}
}
},
"404": {
"description": "NotFoundError",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NotFoundError"
}
}
}
}
},
"description": "Retrieve a single v2 AI provider so clients can inspect its availability and endpoint settings.",
"summary": "Get v2 provider",
"x-codeSamples": [
{
"lang": "js",
"source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.v2.provider.get({\n ...\n})"
}
]
}
},
"/tui/append-prompt": { "/tui/append-prompt": {
"post": { "post": {
"tags": ["tui"], "tags": ["tui"],
@@ -18991,6 +19097,531 @@
} }
] ]
}, },
"ModelV2Info": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"apiID": {
"type": "string"
},
"providerID": {
"type": "string"
},
"family": {
"type": "string"
},
"name": {
"type": "string"
},
"endpoint": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["unknown"]
}
},
"required": ["type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["openai/responses"]
},
"url": {
"type": "string"
},
"websocket": {
"type": "boolean"
}
},
"required": ["type", "url"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["openai/completions"]
},
"url": {
"type": "string"
},
"reasoning": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["reasoning_content"]
}
},
"required": ["type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["reasoning_details"]
}
},
"required": ["type"],
"additionalProperties": false
}
]
}
},
"required": ["type", "url"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["anthropic/messages"]
},
"url": {
"type": "string"
}
},
"required": ["type", "url"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["aisdk"]
},
"package": {
"type": "string"
},
"url": {
"type": "string"
}
},
"required": ["type", "package"],
"additionalProperties": false
}
]
},
"capabilities": {
"type": "object",
"properties": {
"tools": {
"type": "boolean"
},
"input": {
"type": "array",
"items": {
"type": "string"
}
},
"output": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["tools", "input", "output"],
"additionalProperties": false
},
"options": {
"type": "object",
"properties": {
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"body": {
"type": "object"
},
"aisdk": {
"type": "object",
"properties": {
"provider": {
"type": "object"
},
"request": {
"type": "object"
}
},
"required": ["provider", "request"],
"additionalProperties": false
},
"variant": {
"type": "string"
}
},
"required": ["headers", "body", "aisdk"],
"additionalProperties": false
},
"variants": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"body": {
"type": "object"
},
"aisdk": {
"type": "object",
"properties": {
"provider": {
"type": "object"
},
"request": {
"type": "object"
}
},
"required": ["provider", "request"],
"additionalProperties": false
}
},
"required": ["id", "headers", "body", "aisdk"],
"additionalProperties": false
}
},
"time": {
"type": "object",
"properties": {
"released": {
"anyOf": [
{
"type": "number"
},
{
"type": "string",
"enum": ["NaN"]
},
{
"type": "string",
"enum": ["Infinity"]
},
{
"type": "string",
"enum": ["-Infinity"]
},
{
"type": "string",
"enum": ["Infinity", "-Infinity", "NaN"]
}
]
}
},
"required": ["released"],
"additionalProperties": false
},
"cost": {
"type": "array",
"items": {
"type": "object",
"properties": {
"tier": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["context"]
},
"size": {
"type": "integer"
}
},
"required": ["type", "size"],
"additionalProperties": false
},
"input": {
"type": "number"
},
"output": {
"type": "number"
},
"cache": {
"type": "object",
"properties": {
"read": {
"type": "number"
},
"write": {
"type": "number"
}
},
"required": ["read", "write"],
"additionalProperties": false
}
},
"required": ["input", "output", "cache"],
"additionalProperties": false
}
},
"status": {
"type": "string",
"enum": ["alpha", "beta", "deprecated", "active"]
},
"enabled": {
"type": "boolean"
},
"limit": {
"type": "object",
"properties": {
"context": {
"type": "integer"
},
"input": {
"type": "integer"
},
"output": {
"type": "integer"
}
},
"required": ["context", "output"],
"additionalProperties": false
}
},
"required": [
"id",
"apiID",
"providerID",
"name",
"endpoint",
"capabilities",
"options",
"variants",
"time",
"cost",
"status",
"enabled",
"limit"
],
"additionalProperties": false
},
"ProviderV2Info": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"enabled": {
"anyOf": [
{
"type": "boolean",
"enum": [false]
},
{
"type": "object",
"properties": {
"via": {
"type": "string",
"enum": ["env"]
},
"name": {
"type": "string"
}
},
"required": ["via", "name"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"via": {
"type": "string",
"enum": ["auth"]
},
"service": {
"type": "string"
}
},
"required": ["via", "service"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"via": {
"type": "string",
"enum": ["custom"]
},
"data": {
"type": "object"
}
},
"required": ["via", "data"],
"additionalProperties": false
}
]
},
"env": {
"type": "array",
"items": {
"type": "string"
}
},
"endpoint": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["unknown"]
}
},
"required": ["type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["openai/responses"]
},
"url": {
"type": "string"
},
"websocket": {
"type": "boolean"
}
},
"required": ["type", "url"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["openai/completions"]
},
"url": {
"type": "string"
},
"reasoning": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["reasoning_content"]
}
},
"required": ["type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["reasoning_details"]
}
},
"required": ["type"],
"additionalProperties": false
}
]
}
},
"required": ["type", "url"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["anthropic/messages"]
},
"url": {
"type": "string"
}
},
"required": ["type", "url"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["aisdk"]
},
"package": {
"type": "string"
},
"url": {
"type": "string"
}
},
"required": ["type", "package"],
"additionalProperties": false
}
]
},
"options": {
"type": "object",
"properties": {
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"body": {
"type": "object"
},
"aisdk": {
"type": "object",
"properties": {
"provider": {
"type": "object"
},
"request": {
"type": "object"
}
},
"required": ["provider", "request"],
"additionalProperties": false
}
},
"required": ["headers", "body", "aisdk"],
"additionalProperties": false
}
},
"required": ["id", "name", "enabled", "env", "endpoint", "options"],
"additionalProperties": false
},
"EventTuiToastShow1": { "EventTuiToastShow1": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -19121,6 +19752,14 @@
"name": "v2 messages", "name": "v2 messages",
"description": "Experimental v2 message routes." "description": "Experimental v2 message routes."
}, },
{
"name": "v2 models",
"description": "Experimental v2 model routes."
},
{
"name": "v2 providers",
"description": "Experimental v2 provider routes."
},
{ {
"name": "tui", "name": "tui",
"description": "Experimental HttpApi TUI routes." "description": "Experimental HttpApi TUI routes."

View File

@@ -55,9 +55,13 @@ const UnknownEndpoint = Schema.Struct({
type: Schema.Literal("unknown"), type: Schema.Literal("unknown"),
}) })
export const Endpoint = Schema.Union([UnknownEndpoint, OpenAIResponses, OpenAICompletions, AnthropicMessages, AISDK]).pipe( export const Endpoint = Schema.Union([
Schema.toTaggedUnion("type"), UnknownEndpoint,
) OpenAIResponses,
OpenAICompletions,
AnthropicMessages,
AISDK,
]).pipe(Schema.toTaggedUnion("type"))
export type Endpoint = typeof Endpoint.Type export type Endpoint = typeof Endpoint.Type
export const Options = Schema.Struct({ export const Options = Schema.Struct({
@@ -198,7 +202,6 @@ export class Info extends Schema.Class<Info>("ModelV2.Info")({
}) })
} }
} }
``` ```
## Catalog Interface ## Catalog Interface
@@ -253,23 +256,21 @@ const available = provider.enabled && model.status !== "deprecated"
## Plugin Interface ## Plugin Interface
```ts ```ts
export type Definition<R = never> = Effect.Effect<{ export type Definition<R = never> = Effect.Effect<
readonly order: number {
readonly hooks: HookFunctions readonly order: number
}, never, R> readonly hooks: HookFunctions
},
never,
R
>
export interface Interface { export interface Interface {
readonly add: <R = never>(input: { readonly add: <R = never>(input: { id: ID; definition: Definition<R> }) => Effect.Effect<void, never, R>
id: ID
definition: Definition<R>
}) => Effect.Effect<void, never, R>
readonly remove: (id: ID) => Effect.Effect<void> readonly remove: (id: ID) => Effect.Effect<void>
readonly trigger: <Name extends keyof Hooks>( readonly trigger: <Name extends keyof Hooks>(name: Name, input: HookInput<Name>) => Effect.Effect<HookInput<Name>>
name: Name,
input: HookInput<Name>,
) => Effect.Effect<HookInput<Name>>
} }
``` ```