Merge branch 'dev' into project

This commit is contained in:
Dax Raad 2025-08-12 18:52:30 -04:00
commit 6498a4624c
214 changed files with 15146 additions and 1968 deletions

View file

@ -1,4 +1,4 @@
configured_endpoints: 34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-da1c340135c3dd6b1edb4e00e7039d2ac54d59271683a8b6ed528e51137ce41a.yml
openapi_spec_hash: 0cdd9b6273d72f5a6f484a2999ff0632
config_hash: 7581d5948150d4ef7dd7b13d0845dbeb
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-b86cf7bb8df4f60ebe8b8f51e281c8076cfdccc8554178c1b78beca4b025f0ff.yml
openapi_spec_hash: 47633b7481d91708643ea7b43fffffe6
config_hash: bd7f6435ed0c0005f373b5526c07a055

View file

@ -92,6 +92,7 @@ Response Types:
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FileSource">FileSource</a>
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Message">Message</a>
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Part">Part</a>
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ReasoningPart">ReasoningPart</a>
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SnapshotPart">SnapshotPart</a>
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#StepFinishPart">StepFinishPart</a>

View file

@ -74,9 +74,10 @@ type Config struct {
// Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
// enables automatic sharing, 'disabled' disables all sharing
Share ConfigShare `json:"share"`
// Small model to use for tasks like title generation in the
// format of provider/model
// Small model to use for tasks like title generation in the format of
// provider/model
SmallModel string `json:"small_model"`
Snapshot bool `json:"snapshot"`
// Theme name to use for the interface
Theme string `json:"theme"`
// Custom username to display in conversations instead of system username
@ -105,6 +106,7 @@ type configJSON struct {
Provider apijson.Field
Share apijson.Field
SmallModel apijson.Field
Snapshot apijson.Field
Theme apijson.Field
Username apijson.Field
raw string
@ -780,9 +782,10 @@ func (r ConfigModePlanMode) IsKnown() bool {
}
type ConfigPermission struct {
Bash ConfigPermissionBashUnion `json:"bash"`
Edit ConfigPermissionEdit `json:"edit"`
JSON configPermissionJSON `json:"-"`
Bash ConfigPermissionBashUnion `json:"bash"`
Edit ConfigPermissionEdit `json:"edit"`
Webfetch ConfigPermissionWebfetch `json:"webfetch"`
JSON configPermissionJSON `json:"-"`
}
// configPermissionJSON contains the JSON metadata for the struct
@ -790,6 +793,7 @@ type ConfigPermission struct {
type configPermissionJSON struct {
Bash apijson.Field
Edit apijson.Field
Webfetch apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@ -876,6 +880,22 @@ func (r ConfigPermissionEdit) IsKnown() bool {
return false
}
type ConfigPermissionWebfetch string
const (
ConfigPermissionWebfetchAsk ConfigPermissionWebfetch = "ask"
ConfigPermissionWebfetchAllow ConfigPermissionWebfetch = "allow"
ConfigPermissionWebfetchDeny ConfigPermissionWebfetch = "deny"
)
func (r ConfigPermissionWebfetch) IsKnown() bool {
switch r {
case ConfigPermissionWebfetchAsk, ConfigPermissionWebfetchAllow, ConfigPermissionWebfetchDeny:
return true
}
return false
}
type ConfigProvider struct {
Models map[string]ConfigProviderModel `json:"models,required"`
ID string `json:"id"`

View file

@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"
# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log &
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
# Wait for server to come online
echo -n "Waiting for server"
@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then
echo
else
npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL"
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
fi

View file

@ -43,7 +43,7 @@ elif ! prism_is_running ; then
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}"
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo
exit 1

View file

@ -66,6 +66,18 @@ func (r *SessionService) Delete(ctx context.Context, id string, opts ...option.R
return
}
// Update session properties
func (r *SessionService) Update(ctx context.Context, id string, body SessionUpdateParams, opts ...option.RequestOption) (res *Session, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("session/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
return
}
// Abort a session
func (r *SessionService) Abort(ctx context.Context, id string, opts ...option.RequestOption) (res *bool, err error) {
opts = append(r.Options[:], opts...)
@ -962,18 +974,20 @@ type Part struct {
Cost float64 `json:"cost"`
Filename string `json:"filename"`
// This field can have the runtime type of [[]string].
Files interface{} `json:"files"`
Hash string `json:"hash"`
Mime string `json:"mime"`
Name string `json:"name"`
Snapshot string `json:"snapshot"`
Files interface{} `json:"files"`
Hash string `json:"hash"`
Mime string `json:"mime"`
Name string `json:"name"`
// This field can have the runtime type of [map[string]interface{}].
ProviderMetadata interface{} `json:"providerMetadata"`
Snapshot string `json:"snapshot"`
// This field can have the runtime type of [FilePartSource], [AgentPartSource].
Source interface{} `json:"source"`
// This field can have the runtime type of [ToolPartState].
State interface{} `json:"state"`
Synthetic bool `json:"synthetic"`
Text string `json:"text"`
// This field can have the runtime type of [TextPartTime].
// This field can have the runtime type of [TextPartTime], [ReasoningPartTime].
Time interface{} `json:"time"`
// This field can have the runtime type of [StepFinishPartTokens].
Tokens interface{} `json:"tokens"`
@ -985,28 +999,29 @@ type Part struct {
// partJSON contains the JSON metadata for the struct [Part]
type partJSON struct {
ID apijson.Field
MessageID apijson.Field
SessionID apijson.Field
Type apijson.Field
CallID apijson.Field
Cost apijson.Field
Filename apijson.Field
Files apijson.Field
Hash apijson.Field
Mime apijson.Field
Name apijson.Field
Snapshot apijson.Field
Source apijson.Field
State apijson.Field
Synthetic apijson.Field
Text apijson.Field
Time apijson.Field
Tokens apijson.Field
Tool apijson.Field
URL apijson.Field
raw string
ExtraFields map[string]apijson.Field
ID apijson.Field
MessageID apijson.Field
SessionID apijson.Field
Type apijson.Field
CallID apijson.Field
Cost apijson.Field
Filename apijson.Field
Files apijson.Field
Hash apijson.Field
Mime apijson.Field
Name apijson.Field
ProviderMetadata apijson.Field
Snapshot apijson.Field
Source apijson.Field
State apijson.Field
Synthetic apijson.Field
Text apijson.Field
Time apijson.Field
Tokens apijson.Field
Tool apijson.Field
URL apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r partJSON) RawJSON() string {
@ -1025,14 +1040,16 @@ func (r *Part) UnmarshalJSON(data []byte) (err error) {
// AsUnion returns a [PartUnion] interface which you can cast to the specific types
// for more type safety.
//
// Possible runtime types of the union are [TextPart], [FilePart], [ToolPart],
// [StepStartPart], [StepFinishPart], [SnapshotPart], [PartPatchPart], [AgentPart].
// Possible runtime types of the union are [TextPart], [ReasoningPart], [FilePart],
// [ToolPart], [StepStartPart], [StepFinishPart], [SnapshotPart], [PartPatchPart],
// [AgentPart].
func (r Part) AsUnion() PartUnion {
return r.union
}
// Union satisfied by [TextPart], [FilePart], [ToolPart], [StepStartPart],
// [StepFinishPart], [SnapshotPart], [PartPatchPart] or [AgentPart].
// Union satisfied by [TextPart], [ReasoningPart], [FilePart], [ToolPart],
// [StepStartPart], [StepFinishPart], [SnapshotPart], [PartPatchPart] or
// [AgentPart].
type PartUnion interface {
implementsPart()
}
@ -1046,6 +1063,11 @@ func init() {
Type: reflect.TypeOf(TextPart{}),
DiscriminatorValue: "text",
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(ReasoningPart{}),
DiscriminatorValue: "reasoning",
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(FilePart{}),
@ -1134,6 +1156,7 @@ type PartType string
const (
PartTypeText PartType = "text"
PartTypeReasoning PartType = "reasoning"
PartTypeFile PartType = "file"
PartTypeTool PartType = "tool"
PartTypeStepStart PartType = "step-start"
@ -1145,12 +1168,83 @@ const (
func (r PartType) IsKnown() bool {
switch r {
case PartTypeText, PartTypeFile, PartTypeTool, PartTypeStepStart, PartTypeStepFinish, PartTypeSnapshot, PartTypePatch, PartTypeAgent:
case PartTypeText, PartTypeReasoning, PartTypeFile, PartTypeTool, PartTypeStepStart, PartTypeStepFinish, PartTypeSnapshot, PartTypePatch, PartTypeAgent:
return true
}
return false
}
type ReasoningPart struct {
ID string `json:"id,required"`
MessageID string `json:"messageID,required"`
SessionID string `json:"sessionID,required"`
Text string `json:"text,required"`
Type ReasoningPartType `json:"type,required"`
ProviderMetadata map[string]interface{} `json:"providerMetadata"`
Time ReasoningPartTime `json:"time"`
JSON reasoningPartJSON `json:"-"`
}
// reasoningPartJSON contains the JSON metadata for the struct [ReasoningPart]
type reasoningPartJSON struct {
ID apijson.Field
MessageID apijson.Field
SessionID apijson.Field
Text apijson.Field
Type apijson.Field
ProviderMetadata apijson.Field
Time apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ReasoningPart) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r reasoningPartJSON) RawJSON() string {
return r.raw
}
func (r ReasoningPart) implementsPart() {}
type ReasoningPartType string
const (
ReasoningPartTypeReasoning ReasoningPartType = "reasoning"
)
func (r ReasoningPartType) IsKnown() bool {
switch r {
case ReasoningPartTypeReasoning:
return true
}
return false
}
type ReasoningPartTime struct {
Start float64 `json:"start,required"`
End float64 `json:"end"`
JSON reasoningPartTimeJSON `json:"-"`
}
// reasoningPartTimeJSON contains the JSON metadata for the struct
// [ReasoningPartTime]
type reasoningPartTimeJSON struct {
Start apijson.Field
End apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ReasoningPartTime) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r reasoningPartTimeJSON) RawJSON() string {
return r.raw
}
type Session struct {
ID string `json:"id,required"`
Time SessionTime `json:"time,required"`
@ -2274,3 +2368,11 @@ type SessionSummarizeParams struct {
func (r SessionSummarizeParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type SessionUpdateParams struct {
Title param.Field[string] `json:"title"`
}
func (r SessionUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

View file

@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/sdk",
"version": "0.3.133",
"version": "0.4.40",
"type": "module",
"scripts": {
"typecheck": "tsc --noEmit"

View file

@ -12,7 +12,10 @@ await $`bun dev generate > ${dir}/openapi.json`.cwd(path.resolve(dir, "../../ope
await createClient({
input: "./openapi.json",
output: "./src/gen",
output: {
path: "./src/gen",
tsConfigPath: path.join(dir, 'tsconfig.json')
},
plugins: [
{
name: "@hey-api/typescript",

View file

@ -1,7 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts
import type { ClientOptions } from "./types.gen"
import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from "./client"
import type { ClientOptions } from "./types.gen.js"
import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from "./client/index.js"
/**
* The `createClientConfig()` function will be called on client initialization

View file

@ -1,4 +1,4 @@
import type { Client, Config, RequestOptions } from "./types"
import type { Client, Config, RequestOptions } from "./types.js"
import {
buildUrl,
createConfig,
@ -7,7 +7,7 @@ import {
mergeConfigs,
mergeHeaders,
setAuthParams,
} from "./utils"
} from "./utils.js"
type ReqInit = Omit<RequestInit, "body" | "headers"> & {
body?: any

View file

@ -1,8 +1,8 @@
export type { Auth } from "../core/auth"
export type { QuerySerializerOptions } from "../core/bodySerializer"
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer } from "../core/bodySerializer"
export { buildClientParams } from "../core/params"
export { createClient } from "./client"
export type { Auth } from "../core/auth.js"
export type { QuerySerializerOptions } from "../core/bodySerializer.js"
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer } from "../core/bodySerializer.js"
export { buildClientParams } from "../core/params.js"
export { createClient } from "./client.js"
export type {
Client,
ClientOptions,
@ -14,5 +14,5 @@ export type {
RequestResult,
ResponseStyle,
TDataShape,
} from "./types"
export { createConfig, mergeHeaders } from "./utils"
} from "./types.js"
export { createConfig, mergeHeaders } from "./utils.js"

View file

@ -1,6 +1,6 @@
import type { Auth } from "../core/auth"
import type { Client as CoreClient, Config as CoreConfig } from "../core/types"
import type { Middleware } from "./utils"
import type { Auth } from "../core/auth.js"
import type { Client as CoreClient, Config as CoreConfig } from "../core/types.js"
import type { Middleware } from "./utils.js"
export type ResponseStyle = "data" | "fields"

View file

@ -1,8 +1,8 @@
import { getAuthToken } from "../core/auth"
import type { QuerySerializer, QuerySerializerOptions } from "../core/bodySerializer"
import { jsonBodySerializer } from "../core/bodySerializer"
import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from "../core/pathSerializer"
import type { Client, ClientOptions, Config, RequestOptions } from "./types"
import { getAuthToken } from "../core/auth.js"
import type { QuerySerializer, QuerySerializerOptions } from "../core/bodySerializer.js"
import { jsonBodySerializer } from "../core/bodySerializer.js"
import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from "../core/pathSerializer.js"
import type { Client, ClientOptions, Config, RequestOptions } from "./types.js"
interface PathSerializer {
path: Record<string, unknown>

View file

@ -1,4 +1,4 @@
import type { ArrayStyle, ObjectStyle, SerializerOptions } from "./pathSerializer"
import type { ArrayStyle, ObjectStyle, SerializerOptions } from "./pathSerializer.js"
export type QuerySerializer = (query: Record<string, unknown>) => string

View file

@ -1,5 +1,5 @@
import type { Auth, AuthToken } from "./auth"
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer"
import type { Auth, AuthToken } from "./auth.js"
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.js"
export interface Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never> {
/**

View file

@ -1,6 +1,6 @@
// This file is auto-generated by @hey-api/openapi-ts
import type { Options as ClientOptions, TDataShape, Client } from "./client"
import type { Options as ClientOptions, TDataShape, Client } from "./client/index.js"
import type {
EventSubscribeData,
EventSubscribeResponses,
@ -15,10 +15,12 @@ import type {
SessionCreateData,
SessionCreateResponses,
SessionCreateErrors,
SessionGetData,
SessionGetResponses,
SessionDeleteData,
SessionDeleteResponses,
SessionGetData,
SessionGetResponses,
SessionUpdateData,
SessionUpdateResponses,
SessionInitData,
SessionInitResponses,
SessionAbortData,
@ -55,8 +57,8 @@ import type {
FileStatusResponses,
AppLogData,
AppLogResponses,
AppModesData,
AppModesResponses,
AppAgentsData,
AppAgentsResponses,
TuiAppendPromptData,
TuiAppendPromptResponses,
TuiOpenHelpData,
@ -73,8 +75,8 @@ import type {
TuiClearPromptResponses,
TuiExecuteCommandData,
TuiExecuteCommandResponses,
} from "./types.gen"
import { client as _heyApiClient } from "./client.gen"
} from "./types.gen.js"
import { client as _heyApiClient } from "./client.gen.js"
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<
TData,
@ -151,11 +153,11 @@ class App extends _HeyApiClient {
}
/**
* List all modes
* List all agents
*/
public modes<ThrowOnError extends boolean = false>(options?: Options<AppModesData, ThrowOnError>) {
return (options?.client ?? this._client).get<AppModesResponses, unknown, ThrowOnError>({
url: "/mode",
public agents<ThrowOnError extends boolean = false>(options?: Options<AppAgentsData, ThrowOnError>) {
return (options?.client ?? this._client).get<AppAgentsResponses, unknown, ThrowOnError>({
url: "/agent",
...options,
})
}
@ -204,16 +206,6 @@ class Session extends _HeyApiClient {
})
}
/**
* Get session
*/
public get<ThrowOnError extends boolean = false>(options: Options<SessionGetData, ThrowOnError>) {
return (options.client ?? this._client).get<SessionGetResponses, unknown, ThrowOnError>({
url: "/session/{sessionID}",
...options,
})
}
/**
* Delete a session and all its data
*/
@ -224,6 +216,30 @@ class Session extends _HeyApiClient {
})
}
/**
* Get session
*/
public get<ThrowOnError extends boolean = false>(options: Options<SessionGetData, ThrowOnError>) {
return (options.client ?? this._client).get<SessionGetResponses, unknown, ThrowOnError>({
url: "/session/{id}",
...options,
})
}
/**
* Update session properties
*/
public update<ThrowOnError extends boolean = false>(options: Options<SessionUpdateData, ThrowOnError>) {
return (options.client ?? this._client).patch<SessionUpdateResponses, unknown, ThrowOnError>({
url: "/session/{id}",
...options,
headers: {
"Content-Type": "application/json",
...options.headers,
},
})
}
/**
* Analyze the app and create an AGENTS.md file
*/
@ -471,7 +487,7 @@ class Tui extends _HeyApiClient {
}
/**
* Execute a TUI command (e.g. switch_mode)
* Execute a TUI command (e.g. switch_agent)
*/
public executeCommand<ThrowOnError extends boolean = false>(options?: Options<TuiExecuteCommandData, ThrowOnError>) {
return (options?.client ?? this._client).post<TuiExecuteCommandResponses, unknown, ThrowOnError>({

View file

@ -190,6 +190,9 @@ export type Part =
| ({
type: "text"
} & TextPart)
| ({
type: "reasoning"
} & ReasoningPart)
| ({
type: "file"
} & FilePart)
@ -208,6 +211,9 @@ export type Part =
| ({
type: "patch"
} & PatchPart)
| ({
type: "agent"
} & AgentPart)
export type TextPart = {
id: string
@ -222,6 +228,21 @@ export type TextPart = {
}
}
export type ReasoningPart = {
id: string
sessionID: string
messageID: string
type: string
text: string
metadata?: {
[key: string]: unknown
}
time: {
start: number
end?: number
}
}
export type FilePart = {
id: string
sessionID: string
@ -382,6 +403,19 @@ export type PatchPart = {
files: Array<string>
}
export type AgentPart = {
id: string
sessionID: string
messageID: string
type: string
name: string
source?: {
value: string
start: number
end: number
}
}
export type EventMessagePartRemoved = {
type: string
properties: {
@ -569,17 +603,19 @@ export type Config = {
*/
username?: string
/**
* Modes configuration, see https://opencode.ai/docs/modes
* @deprecated Use `agent` field instead.
*/
mode?: {
build?: ModeConfig
plan?: ModeConfig
[key: string]: ModeConfig | undefined
build?: AgentConfig
plan?: AgentConfig
[key: string]: AgentConfig | undefined
}
/**
* Modes configuration, see https://opencode.ai/docs/modes
* Agent configuration, see https://opencode.ai/docs/agent
*/
agent?: {
plan?: AgentConfig
build?: AgentConfig
general?: AgentConfig
[key: string]: AgentConfig | undefined
}
@ -593,7 +629,7 @@ export type Config = {
env?: Array<string>
id?: string
npm?: string
models: {
models?: {
[key: string]: {
id?: string
name?: string
@ -675,6 +711,7 @@ export type Config = {
| {
[key: string]: string
}
webfetch?: string
}
experimental?: {
[key: string]: unknown
@ -691,13 +728,21 @@ export type KeybindsConfig = {
*/
app_help: string
/**
* Next mode
* @deprecated use switch_agent. Next mode
*/
switch_mode: string
/**
* Previous Mode
* @deprecated use switch_agent_reverse. Previous mode
*/
switch_mode_reverse: string
/**
* Next agent
*/
switch_agent: string
/**
* Previous agent
*/
switch_agent_reverse: string
/**
* Open external editor
*/
@ -734,6 +779,10 @@ export type KeybindsConfig = {
* Toggle tool details
*/
tool_details: string
/**
* Toggle thinking blocks
*/
thinking_blocks: string
/**
* List available models
*/
@ -836,7 +885,7 @@ export type KeybindsConfig = {
app_exit: string
}
export type ModeConfig = {
export type AgentConfig = {
model?: string
temperature?: number
top_p?: number
@ -845,10 +894,39 @@ export type ModeConfig = {
[key: string]: boolean
}
disable?: boolean
}
export type AgentConfig = ModeConfig & {
description: string
/**
* Description of when to use the agent
*/
description?: string
mode?: string
permission?: {
edit?: string
bash?:
| string
| {
[key: string]: string
}
webfetch?: string
}
[key: string]:
| unknown
| string
| number
| {
[key: string]: boolean
}
| boolean
| string
| {
edit?: string
bash?:
| string
| {
[key: string]: string
}
webfetch?: string
}
| undefined
}
export type Provider = {
@ -955,6 +1033,17 @@ export type FilePartInput = {
source?: FilePartSource
}
export type AgentPartInput = {
id?: string
type: string
name: string
source?: {
value: string
start: number
end: number
}
}
export type Symbol = {
name: string
kind: number
@ -971,10 +1060,19 @@ export type File = {
status: "added" | "deleted" | "modified"
}
export type Mode = {
export type Agent = {
name: string
temperature?: number
description?: string
mode: string
topP?: number
temperature?: number
permission: {
edit: string
bash: {
[key: string]: string
}
webfetch?: string
}
model?: {
modelID: string
providerID: string
@ -983,6 +1081,9 @@ export type Mode = {
tools: {
[key: string]: boolean
}
options: {
[key: string]: unknown
}
}
export type EventSubscribeData = {
@ -1090,24 +1191,6 @@ export type SessionCreateResponses = {
export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses]
export type SessionGetData = {
body?: never
path: {
sessionID: string
}
query?: never
url: "/session/{sessionID}"
}
export type SessionGetResponses = {
/**
* Get session
*/
200: Session
}
export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses]
export type SessionDeleteData = {
body?: never
path: {
@ -1126,6 +1209,44 @@ export type SessionDeleteResponses = {
export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses]
export type SessionGetData = {
body?: never
path: {
id: string
}
query?: never
url: "/session/{id}"
}
export type SessionGetResponses = {
/**
* Get session
*/
200: Session
}
export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses]
export type SessionUpdateData = {
body?: {
title?: string
}
path: {
id: string
}
query?: never
url: "/session/{id}"
}
export type SessionUpdateResponses = {
/**
* Successfully updated session
*/
200: Session
}
export type SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses]
export type SessionInitData = {
body?: {
messageID: string
@ -1258,7 +1379,7 @@ export type SessionChatData = {
messageID?: string
providerID: string
modelID: string
mode?: string
agent?: string
system?: string
tools?: {
[key: string]: boolean
@ -1270,6 +1391,9 @@ export type SessionChatData = {
| ({
type: "file"
} & FilePartInput)
| ({
type: "agent"
} & AgentPartInput)
>
}
path: {
@ -1543,21 +1667,21 @@ export type AppLogResponses = {
export type AppLogResponse = AppLogResponses[keyof AppLogResponses]
export type AppModesData = {
export type AppAgentsData = {
body?: never
path?: never
query?: never
url: "/mode"
url: "/agent"
}
export type AppModesResponses = {
export type AppAgentsResponses = {
/**
* List of modes
* List of agents
*/
200: Array<Mode>
200: Array<Agent>
}
export type AppModesResponse = AppModesResponses[keyof AppModesResponses]
export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]
export type TuiAppendPromptData = {
body?: {

View file

@ -1,7 +1,7 @@
import { createClient } from "./gen/client/client"
import { type Config } from "./gen/client/types"
import { OpencodeClient } from "./gen/sdk.gen"
export * from "./gen/types.gen"
import { createClient } from "./gen/client/client.js"
import { type Config } from "./gen/client/types.js"
import { OpencodeClient } from "./gen/sdk.gen.js"
export * from "./gen/types.gen.js"
export function createOpencodeClient(config?: Config) {
const client = createClient(config)

View file

@ -3,9 +3,9 @@
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"module": "preserve",
"module": "nodenext",
"declaration": true,
"moduleResolution": "bundler",
"moduleResolution": "nodenext",
"lib": [
"es2022",
"dom",

View file

@ -101,6 +101,7 @@ resources:
toolPart: ToolPart
agentPart: AgentPart
agentPartInput: AgentPartInput
reasoningPart: ReasoningPart
stepStartPart: StepStartPart
stepFinishPart: StepFinishPart
snapshotPart: SnapshotPart