summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2026-04-08 12:56:15 -0500
committerGitHub <[email protected]>2026-04-08 12:56:15 -0500
commit039c60170dca165ad3323c3bb39b7e448fe1c7c4 (patch)
treebbb10009565e57174f92137002d6e21ab064dbd6
parentcd87d4f9d368e0e90d4809c6a87c02ef62a40636 (diff)
downloadopencode-039c60170dca165ad3323c3bb39b7e448fe1c7c4.tar.gz
opencode-039c60170dca165ad3323c3bb39b7e448fe1c7c4.zip
fix: ensure that /providers list and shell endpoints are correctly typed in sdk and openapi schema (#21543)
-rw-r--r--packages/opencode/src/server/routes/provider.ts2
-rw-r--r--packages/opencode/src/server/routes/session.ts2
-rw-r--r--packages/sdk/js/src/v2/gen/types.gen.ts68
-rw-r--r--packages/sdk/openapi.json220
4 files changed, 21 insertions, 271 deletions
diff --git a/packages/opencode/src/server/routes/provider.ts b/packages/opencode/src/server/routes/provider.ts
index 64fe34f45..59a4a686b 100644
--- a/packages/opencode/src/server/routes/provider.ts
+++ b/packages/opencode/src/server/routes/provider.ts
@@ -28,7 +28,7 @@ export const ProviderRoutes = lazy(() =>
"application/json": {
schema: resolver(
z.object({
- all: ModelsDev.Provider.array(),
+ all: Provider.Info.array(),
default: z.record(z.string(), z.string()),
connected: z.array(z.string()),
}),
diff --git a/packages/opencode/src/server/routes/session.ts b/packages/opencode/src/server/routes/session.ts
index c33c5e989..b4c13bca0 100644
--- a/packages/opencode/src/server/routes/session.ts
+++ b/packages/opencode/src/server/routes/session.ts
@@ -906,7 +906,7 @@ export const SessionRoutes = lazy(() =>
description: "Created message",
content: {
"application/json": {
- schema: resolver(MessageV2.Assistant),
+ schema: resolver(MessageV2.WithParts),
},
},
},
diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts
index 0a9aa4358..e21e093c6 100644
--- a/packages/sdk/js/src/v2/gen/types.gen.ts
+++ b/packages/sdk/js/src/v2/gen/types.gen.ts
@@ -3936,7 +3936,10 @@ export type SessionShellResponses = {
/**
* Created message
*/
- 200: AssistantMessage
+ 200: {
+ info: Message
+ parts: Array<Part>
+ }
}
export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]
@@ -4212,68 +4215,7 @@ export type ProviderListResponses = {
* List of providers
*/
200: {
- all: Array<{
- api?: string
- name: string
- env: Array<string>
- id: string
- npm?: string
- models: {
- [key: string]: {
- id: string
- name: string
- family?: string
- release_date: string
- attachment: boolean
- reasoning: boolean
- temperature: boolean
- tool_call: boolean
- interleaved?:
- | true
- | {
- field: "reasoning_content" | "reasoning_details"
- }
- cost?: {
- input: number
- output: number
- cache_read?: number
- cache_write?: number
- context_over_200k?: {
- input: number
- output: number
- cache_read?: number
- cache_write?: number
- }
- }
- limit: {
- context: number
- input?: number
- output: number
- }
- modalities?: {
- input: Array<"text" | "audio" | "image" | "video" | "pdf">
- output: Array<"text" | "audio" | "image" | "video" | "pdf">
- }
- experimental?: boolean
- status?: "alpha" | "beta" | "deprecated"
- options: {
- [key: string]: unknown
- }
- headers?: {
- [key: string]: string
- }
- provider?: {
- npm?: string
- api?: string
- }
- variants?: {
- [key: string]: {
- [key: string]: unknown
- }
- }
- }
- }
- }>
+ all: Array<Provider>
default: {
[key: string]: string
}
diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json
index 207b400a7..0f3b2c397 100644
--- a/packages/sdk/openapi.json
+++ b/packages/sdk/openapi.json
@@ -4098,7 +4098,19 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/AssistantMessage"
+ "type": "object",
+ "properties": {
+ "info": {
+ "$ref": "#/components/schemas/Message"
+ },
+ "parts": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Part"
+ }
+ }
+ },
+ "required": ["info", "parts"]
}
}
}
@@ -4790,211 +4802,7 @@
"all": {
"type": "array",
"items": {
- "type": "object",
- "properties": {
- "api": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "env": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "id": {
- "type": "string"
- },
- "npm": {
- "type": "string"
- },
- "models": {
- "type": "object",
- "propertyNames": {
- "type": "string"
- },
- "additionalProperties": {
- "type": "object",
- "properties": {
- "id": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "family": {
- "type": "string"
- },
- "release_date": {
- "type": "string"
- },
- "attachment": {
- "type": "boolean"
- },
- "reasoning": {
- "type": "boolean"
- },
- "temperature": {
- "type": "boolean"
- },
- "tool_call": {
- "type": "boolean"
- },
- "interleaved": {
- "anyOf": [
- {
- "type": "boolean",
- "const": true
- },
- {
- "type": "object",
- "properties": {
- "field": {
- "type": "string",
- "enum": ["reasoning_content", "reasoning_details"]
- }
- },
- "required": ["field"],
- "additionalProperties": false
- }
- ]
- },
- "cost": {
- "type": "object",
- "properties": {
- "input": {
- "type": "number"
- },
- "output": {
- "type": "number"
- },
- "cache_read": {
- "type": "number"
- },
- "cache_write": {
- "type": "number"
- },
- "context_over_200k": {
- "type": "object",
- "properties": {
- "input": {
- "type": "number"
- },
- "output": {
- "type": "number"
- },
- "cache_read": {
- "type": "number"
- },
- "cache_write": {
- "type": "number"
- }
- },
- "required": ["input", "output"]
- }
- },
- "required": ["input", "output"]
- },
- "limit": {
- "type": "object",
- "properties": {
- "context": {
- "type": "number"
- },
- "input": {
- "type": "number"
- },
- "output": {
- "type": "number"
- }
- },
- "required": ["context", "output"]
- },
- "modalities": {
- "type": "object",
- "properties": {
- "input": {
- "type": "array",
- "items": {
- "type": "string",
- "enum": ["text", "audio", "image", "video", "pdf"]
- }
- },
- "output": {
- "type": "array",
- "items": {
- "type": "string",
- "enum": ["text", "audio", "image", "video", "pdf"]
- }
- }
- },
- "required": ["input", "output"]
- },
- "experimental": {
- "type": "boolean"
- },
- "status": {
- "type": "string",
- "enum": ["alpha", "beta", "deprecated"]
- },
- "options": {
- "type": "object",
- "propertyNames": {
- "type": "string"
- },
- "additionalProperties": {}
- },
- "headers": {
- "type": "object",
- "propertyNames": {
- "type": "string"
- },
- "additionalProperties": {
- "type": "string"
- }
- },
- "provider": {
- "type": "object",
- "properties": {
- "npm": {
- "type": "string"
- },
- "api": {
- "type": "string"
- }
- }
- },
- "variants": {
- "type": "object",
- "propertyNames": {
- "type": "string"
- },
- "additionalProperties": {
- "type": "object",
- "propertyNames": {
- "type": "string"
- },
- "additionalProperties": {}
- }
- }
- },
- "required": [
- "id",
- "name",
- "release_date",
- "attachment",
- "reasoning",
- "temperature",
- "tool_call",
- "limit",
- "options"
- ]
- }
- }
- },
- "required": ["name", "env", "id", "models"]
+ "$ref": "#/components/schemas/Provider"
}
},
"default": {