chore: generate

This commit is contained in:
opencode-agent[bot]
2026-02-12 04:55:00 +00:00
parent e269788a8f
commit f6e7aefa72
2 changed files with 129 additions and 45 deletions

View File

@@ -2420,6 +2420,9 @@
"type": "boolean"
}
},
"format": {
"$ref": "#/components/schemas/OutputFormat"
},
"system": {
"type": "string"
},
@@ -2796,6 +2799,9 @@
"type": "boolean"
}
},
"format": {
"$ref": "#/components/schemas/OutputFormat"
},
"system": {
"type": "string"
},
@@ -6073,6 +6079,52 @@
},
"required": ["type", "properties"]
},
"OutputFormatText": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "text"
}
},
"required": ["type"]
},
"JSONSchema": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"OutputFormatJsonSchema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "json_schema"
},
"schema": {
"$ref": "#/components/schemas/JSONSchema"
},
"retryCount": {
"default": 2,
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": ["type", "schema"]
},
"OutputFormat": {
"anyOf": [
{
"$ref": "#/components/schemas/OutputFormatText"
},
{
"$ref": "#/components/schemas/OutputFormatJsonSchema"
}
]
},
"FileDiff": {
"type": "object",
"properties": {
@@ -6120,6 +6172,9 @@
},
"required": ["created"]
},
"format": {
"$ref": "#/components/schemas/OutputFormat"
},
"summary": {
"type": "object",
"properties": {
@@ -6245,6 +6300,28 @@
},
"required": ["name", "data"]
},
"StructuredOutputError": {
"type": "object",
"properties": {
"name": {
"type": "string",
"const": "StructuredOutputError"
},
"data": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"retries": {
"type": "number"
}
},
"required": ["message", "retries"]
}
},
"required": ["name", "data"]
},
"ContextOverflowError": {
"type": "object",
"properties": {
@@ -6352,6 +6429,9 @@
{
"$ref": "#/components/schemas/MessageAbortedError"
},
{
"$ref": "#/components/schemas/StructuredOutputError"
},
{
"$ref": "#/components/schemas/ContextOverflowError"
},
@@ -6423,6 +6503,7 @@
},
"required": ["input", "output", "reasoning", "cache"]
},
"structured": {},
"variant": {
"type": "string"
},
@@ -8128,6 +8209,9 @@
{
"$ref": "#/components/schemas/MessageAbortedError"
},
{
"$ref": "#/components/schemas/StructuredOutputError"
},
{
"$ref": "#/components/schemas/ContextOverflowError"
},

View File

@@ -127,24 +127,24 @@ You can request structured JSON output from the model by specifying an `outputFo
const result = await client.session.prompt({
path: { id: sessionId },
body: {
parts: [{ type: 'text', text: 'Research Anthropic and provide company info' }],
parts: [{ type: "text", text: "Research Anthropic and provide company info" }],
outputFormat: {
type: 'json_schema',
type: "json_schema",
schema: {
type: 'object',
type: "object",
properties: {
company: { type: 'string', description: 'Company name' },
founded: { type: 'number', description: 'Year founded' },
company: { type: "string", description: "Company name" },
founded: { type: "number", description: "Year founded" },
products: {
type: 'array',
items: { type: 'string' },
description: 'Main products'
}
type: "array",
items: { type: "string" },
description: "Main products",
},
},
required: ['company', 'founded']
}
}
}
required: ["company", "founded"],
},
},
},
})
// Access the structured output
@@ -154,29 +154,29 @@ console.log(result.data.info.structured_output)
### Output Format Types
| Type | Description |
|------|-------------|
| `text` | Default. Standard text response (no structured output) |
| `json_schema` | Returns validated JSON matching the provided schema |
| Type | Description |
| ------------- | ------------------------------------------------------ |
| `text` | Default. Standard text response (no structured output) |
| `json_schema` | Returns validated JSON matching the provided schema |
### JSON Schema Format
When using `type: 'json_schema'`, provide:
| Field | Type | Description |
|-------|------|-------------|
| `type` | `'json_schema'` | Required. Specifies JSON schema mode |
| `schema` | `object` | Required. JSON Schema object defining the output structure |
| `retryCount` | `number` | Optional. Number of validation retries (default: 2) |
| Field | Type | Description |
| ------------ | --------------- | ---------------------------------------------------------- |
| `type` | `'json_schema'` | Required. Specifies JSON schema mode |
| `schema` | `object` | Required. JSON Schema object defining the output structure |
| `retryCount` | `number` | Optional. Number of validation retries (default: 2) |
### Error Handling
If the model fails to produce valid structured output after all retries, the response will include a `StructuredOutputError`:
```typescript
if (result.data.info.error?.name === 'StructuredOutputError') {
console.error('Failed to produce structured output:', result.data.info.error.message)
console.error('Attempts:', result.data.info.error.retries)
if (result.data.info.error?.name === "StructuredOutputError") {
console.error("Failed to produce structured output:", result.data.info.error.message)
console.error("Attempts:", result.data.info.error.retries)
}
```
@@ -298,27 +298,27 @@ const { providers, default: defaults } = await client.config.providers()
### Sessions
| Method | Description | Notes |
| ---------------------------------------------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `session.list()` | List sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
| `session.get({ path })` | Get session | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.children({ path })` | List child sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
| `session.create({ body })` | Create session | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.delete({ path })` | Delete session | Returns `boolean` |
| `session.update({ path, body })` | Update session properties | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.init({ path, body })` | Analyze app and create `AGENTS.md` | Returns `boolean` |
| `session.abort({ path })` | Abort a running session | Returns `boolean` |
| `session.share({ path })` | Share session | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.unshare({ path })` | Unshare session | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.summarize({ path, body })` | Summarize session | Returns `boolean` |
| `session.messages({ path })` | List messages in a session | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}[]` |
| `session.message({ path })` | Get message details | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
| Method | Description | Notes |
| ---------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `session.list()` | List sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
| `session.get({ path })` | Get session | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.children({ path })` | List child sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
| `session.create({ body })` | Create session | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.delete({ path })` | Delete session | Returns `boolean` |
| `session.update({ path, body })` | Update session properties | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.init({ path, body })` | Analyze app and create `AGENTS.md` | Returns `boolean` |
| `session.abort({ path })` | Abort a running session | Returns `boolean` |
| `session.share({ path })` | Share session | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.unshare({ path })` | Unshare session | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.summarize({ path, body })` | Summarize session | Returns `boolean` |
| `session.messages({ path })` | List messages in a session | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}[]` |
| `session.message({ path })` | Get message details | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
| `session.prompt({ path, body })` | Send prompt message | `body.noReply: true` returns UserMessage (context only). Default returns <a href={typesUrl}><code>AssistantMessage</code></a> with AI response. Supports `body.outputFormat` for [structured output](#structured-output) |
| `session.command({ path, body })` | Send command to session | Returns `{ info: `<a href={typesUrl}><code>AssistantMessage</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
| `session.shell({ path, body })` | Run a shell command | Returns <a href={typesUrl}><code>AssistantMessage</code></a> |
| `session.revert({ path, body })` | Revert a message | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.unrevert({ path })` | Restore reverted messages | Returns <a href={typesUrl}><code>Session</code></a> |
| `postSessionByIdPermissionsByPermissionId({ path, body })` | Respond to a permission request | Returns `boolean` |
| `session.command({ path, body })` | Send command to session | Returns `{ info: `<a href={typesUrl}><code>AssistantMessage</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
| `session.shell({ path, body })` | Run a shell command | Returns <a href={typesUrl}><code>AssistantMessage</code></a> |
| `session.revert({ path, body })` | Revert a message | Returns <a href={typesUrl}><code>Session</code></a> |
| `session.unrevert({ path })` | Restore reverted messages | Returns <a href={typesUrl}><code>Session</code></a> |
| `postSessionByIdPermissionsByPermissionId({ path, body })` | Respond to a permission request | Returns `boolean` |
---