Description
I am trying the default sdk session prompt and i am getting a type issue when trying to pass a structured output format schema, the execution however works fine, it is just a type issue.
here is my code, nothing special here :
import { createOpencodeClient } from "@opencode-ai/sdk";
const start = async () => {
const opencodeClient = createOpencodeClient({
baseUrl: "http://localhost:4096",
});
const session = await opencodeClient.session.create();
const result = await opencodeClient.session.prompt({
path: { id: session.data?.id! },
body: {
parts: [
{ type: "text", text: "Research Anthropic and provide company info" },
],
format: {
type: "json_schema",
schema: {
type: "object",
properties: {
company: { type: "string", description: "Company name" },
founded: { type: "number", description: "Year founded" },
products: {
type: "array",
items: { type: "string" },
description: "Main products",
},
},
required: ["company", "founded"],
},
},
},
});
};
from the generated types, format is not there
// @opencode-ai/sdk/dist/gen/types.gen.d.ts
export type SessionPromptData = {
body?: {
messageID?: string;
model?: {
providerID: string;
modelID: string;
};
agent?: string;
noReply?: boolean;
system?: string;
tools?: {
[key: string]: boolean;
};
parts: Array<TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput>;
};
path: {
/**
* Session ID
*/
id: string;
};
query?: {
directory?: string;
};
url: "/session/{id}/message";
};
Plugins
No response
OpenCode version
No response
Steps to reproduce
- Try pasting this code above into your ide,
the version i am using is : "@opencode-ai/sdk": "^1.14.41"
Screenshot and/or share link
No response
Operating System
macOS 15
Terminal
No response
Description
I am trying the default sdk session prompt and i am getting a type issue when trying to pass a structured output format schema, the execution however works fine, it is just a type issue.
here is my code, nothing special here :
from the generated types, format is not there
Plugins
No response
OpenCode version
No response
Steps to reproduce
the version i am using is :
"@opencode-ai/sdk": "^1.14.41"Screenshot and/or share link
No response
Operating System
macOS 15
Terminal
No response