opencode

package module
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 17 Imported by: 0

README

Opencode Go API Library

Go Reference

The Opencode Go library provides convenient access to the Opencode REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/sst/opencode-sdk-go" // imported as opencode
)

Or to pin the version:

go get -u 'github.com/sst/opencode-sdk-go@v0.16.0'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/sst/opencode-sdk-go"
)

func main() {
	client := opencode.NewClient()
	sessions, err := client.Session.List(context.TODO(), opencode.SessionListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", sessions)
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: opencode.F("hello"),

	// Explicitly send `"description": null`
	Description: opencode.Null[string](),

	Point: opencode.F(opencode.Point{
		X: opencode.Int(0),
		Y: opencode.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: opencode.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the response JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := opencode.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Session.List(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *opencode.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Session.List(context.TODO(), opencode.SessionListParams{})
if err != nil {
	var apierr *opencode.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/session": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Session.List(
	ctx,
	opencode.SessionListParams{},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as param.Field[io.Reader]. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper opencode.FileParam(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := opencode.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Session.List(
	context.TODO(),
	opencode.SessionListParams{},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
sessions, err := client.Session.List(
	context.TODO(),
	opencode.SessionListParams{},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", sessions)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]interface{}

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   opencode.F("id_xxxx"),
    Data: opencode.F(FooNewParamsData{
        FirstName: opencode.F("John"),
    }),
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := opencode.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

View Source
const MessageAbortedErrorNameMessageAbortedError = shared.MessageAbortedErrorNameMessageAbortedError

This is an alias to an internal value.

View Source
const ProviderAuthErrorNameProviderAuthError = shared.ProviderAuthErrorNameProviderAuthError

This is an alias to an internal value.

View Source
const UnknownErrorNameUnknownError = shared.UnknownErrorNameUnknownError

This is an alias to an internal value.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (OPENCODE_BASE_URL). This should be used to initialize new clients.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type Agent added in v0.2.0

type Agent struct {
	BuiltIn     bool                   `json:"builtIn,required"`
	Mode        AgentMode              `json:"mode,required"`
	Name        string                 `json:"name,required"`
	Options     map[string]interface{} `json:"options,required"`
	Permission  AgentPermission        `json:"permission,required"`
	Tools       map[string]bool        `json:"tools,required"`
	Description string                 `json:"description"`
	Model       AgentModel             `json:"model"`
	Prompt      string                 `json:"prompt"`
	Temperature float64                `json:"temperature"`
	TopP        float64                `json:"topP"`
	JSON        agentJSON              `json:"-"`
}

func (*Agent) UnmarshalJSON added in v0.2.0

func (r *Agent) UnmarshalJSON(data []byte) (err error)

type AgentListParams added in v0.5.0

type AgentListParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (AgentListParams) URLQuery added in v0.5.0

func (r AgentListParams) URLQuery() (v url.Values)

URLQuery serializes AgentListParams's query parameters as `url.Values`.

type AgentMode added in v0.2.0

type AgentMode string
const (
	AgentModeSubagent AgentMode = "subagent"
	AgentModePrimary  AgentMode = "primary"
	AgentModeAll      AgentMode = "all"
)

func (AgentMode) IsKnown added in v0.2.0

func (r AgentMode) IsKnown() bool

type AgentModel added in v0.2.0

type AgentModel struct {
	ModelID    string         `json:"modelID,required"`
	ProviderID string         `json:"providerID,required"`
	JSON       agentModelJSON `json:"-"`
}

func (*AgentModel) UnmarshalJSON added in v0.2.0

func (r *AgentModel) UnmarshalJSON(data []byte) (err error)

type AgentPart

type AgentPart struct {
	ID        string          `json:"id,required"`
	MessageID string          `json:"messageID,required"`
	Name      string          `json:"name,required"`
	SessionID string          `json:"sessionID,required"`
	Type      AgentPartType   `json:"type,required"`
	Source    AgentPartSource `json:"source"`
	JSON      agentPartJSON   `json:"-"`
}

func (*AgentPart) UnmarshalJSON

func (r *AgentPart) UnmarshalJSON(data []byte) (err error)

type AgentPartInputParam

type AgentPartInputParam struct {
	Name   param.Field[string]                    `json:"name,required"`
	Type   param.Field[AgentPartInputType]        `json:"type,required"`
	ID     param.Field[string]                    `json:"id"`
	Source param.Field[AgentPartInputSourceParam] `json:"source"`
}

func (AgentPartInputParam) MarshalJSON

func (r AgentPartInputParam) MarshalJSON() (data []byte, err error)

type AgentPartInputSourceParam

type AgentPartInputSourceParam struct {
	End   param.Field[int64]  `json:"end,required"`
	Start param.Field[int64]  `json:"start,required"`
	Value param.Field[string] `json:"value,required"`
}

func (AgentPartInputSourceParam) MarshalJSON

func (r AgentPartInputSourceParam) MarshalJSON() (data []byte, err error)

type AgentPartInputType

type AgentPartInputType string
const (
	AgentPartInputTypeAgent AgentPartInputType = "agent"
)

func (AgentPartInputType) IsKnown

func (r AgentPartInputType) IsKnown() bool

type AgentPartSource

type AgentPartSource struct {
	End   int64               `json:"end,required"`
	Start int64               `json:"start,required"`
	Value string              `json:"value,required"`
	JSON  agentPartSourceJSON `json:"-"`
}

func (*AgentPartSource) UnmarshalJSON

func (r *AgentPartSource) UnmarshalJSON(data []byte) (err error)

type AgentPartType

type AgentPartType string
const (
	AgentPartTypeAgent AgentPartType = "agent"
)

func (AgentPartType) IsKnown

func (r AgentPartType) IsKnown() bool

type AgentPermission added in v0.2.0

type AgentPermission struct {
	Bash     map[string]AgentPermissionBash `json:"bash,required"`
	Edit     AgentPermissionEdit            `json:"edit,required"`
	Webfetch AgentPermissionWebfetch        `json:"webfetch"`
	JSON     agentPermissionJSON            `json:"-"`
}

func (*AgentPermission) UnmarshalJSON added in v0.2.0

func (r *AgentPermission) UnmarshalJSON(data []byte) (err error)

type AgentPermissionBash added in v0.2.0

type AgentPermissionBash string
const (
	AgentPermissionBashAsk   AgentPermissionBash = "ask"
	AgentPermissionBashAllow AgentPermissionBash = "allow"
	AgentPermissionBashDeny  AgentPermissionBash = "deny"
)

func (AgentPermissionBash) IsKnown added in v0.2.0

func (r AgentPermissionBash) IsKnown() bool

type AgentPermissionEdit added in v0.2.0

type AgentPermissionEdit string
const (
	AgentPermissionEditAsk   AgentPermissionEdit = "ask"
	AgentPermissionEditAllow AgentPermissionEdit = "allow"
	AgentPermissionEditDeny  AgentPermissionEdit = "deny"
)

func (AgentPermissionEdit) IsKnown added in v0.2.0

func (r AgentPermissionEdit) IsKnown() bool

type AgentPermissionWebfetch added in v0.2.0

type AgentPermissionWebfetch string
const (
	AgentPermissionWebfetchAsk   AgentPermissionWebfetch = "ask"
	AgentPermissionWebfetchAllow AgentPermissionWebfetch = "allow"
	AgentPermissionWebfetchDeny  AgentPermissionWebfetch = "deny"
)

func (AgentPermissionWebfetch) IsKnown added in v0.2.0

func (r AgentPermissionWebfetch) IsKnown() bool

type AgentService added in v0.2.0

type AgentService struct {
	Options []option.RequestOption
}

AgentService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAgentService method instead.

func NewAgentService added in v0.2.0

func NewAgentService(opts ...option.RequestOption) (r *AgentService)

NewAgentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AgentService) List added in v0.2.0

func (r *AgentService) List(ctx context.Context, query AgentListParams, opts ...option.RequestOption) (res *[]Agent, err error)

List all agents

type AppLogParams added in v0.2.0

type AppLogParams struct {
	// Log level
	Level param.Field[AppLogParamsLevel] `json:"level,required"`
	// Log message
	Message param.Field[string] `json:"message,required"`
	// Service name for the log entry
	Service   param.Field[string] `json:"service,required"`
	Directory param.Field[string] `query:"directory"`
	// Additional metadata for the log entry
	Extra param.Field[map[string]interface{}] `json:"extra"`
}

func (AppLogParams) MarshalJSON added in v0.2.0

func (r AppLogParams) MarshalJSON() (data []byte, err error)

func (AppLogParams) URLQuery added in v0.5.0

func (r AppLogParams) URLQuery() (v url.Values)

URLQuery serializes AppLogParams's query parameters as `url.Values`.

type AppLogParamsLevel added in v0.2.0

type AppLogParamsLevel string

Log level

const (
	AppLogParamsLevelDebug AppLogParamsLevel = "debug"
	AppLogParamsLevelInfo  AppLogParamsLevel = "info"
	AppLogParamsLevelError AppLogParamsLevel = "error"
	AppLogParamsLevelWarn  AppLogParamsLevel = "warn"
)

func (AppLogParamsLevel) IsKnown added in v0.2.0

func (r AppLogParamsLevel) IsKnown() bool

type AppProvidersParams added in v0.5.0

type AppProvidersParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (AppProvidersParams) URLQuery added in v0.5.0

func (r AppProvidersParams) URLQuery() (v url.Values)

URLQuery serializes AppProvidersParams's query parameters as `url.Values`.

type AppProvidersResponse added in v0.2.0

type AppProvidersResponse struct {
	Default   map[string]string        `json:"default,required"`
	Providers []Provider               `json:"providers,required"`
	JSON      appProvidersResponseJSON `json:"-"`
}

func (*AppProvidersResponse) UnmarshalJSON added in v0.2.0

func (r *AppProvidersResponse) UnmarshalJSON(data []byte) (err error)

type AppService added in v0.2.0

type AppService struct {
	Options []option.RequestOption
}

AppService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAppService method instead.

func NewAppService added in v0.2.0

func NewAppService(opts ...option.RequestOption) (r *AppService)

NewAppService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AppService) Log added in v0.2.0

func (r *AppService) Log(ctx context.Context, params AppLogParams, opts ...option.RequestOption) (res *bool, err error)

Write a log entry to the server logs

func (*AppService) Providers added in v0.2.0

func (r *AppService) Providers(ctx context.Context, query AppProvidersParams, opts ...option.RequestOption) (res *AppProvidersResponse, err error)

List all providers

type AssistantMessage

type AssistantMessage struct {
	ID         string                 `json:"id,required"`
	Cost       float64                `json:"cost,required"`
	Mode       string                 `json:"mode,required"`
	ModelID    string                 `json:"modelID,required"`
	Path       AssistantMessagePath   `json:"path,required"`
	ProviderID string                 `json:"providerID,required"`
	Role       AssistantMessageRole   `json:"role,required"`
	SessionID  string                 `json:"sessionID,required"`
	System     []string               `json:"system,required"`
	Time       AssistantMessageTime   `json:"time,required"`
	Tokens     AssistantMessageTokens `json:"tokens,required"`
	Error      AssistantMessageError  `json:"error"`
	Summary    bool                   `json:"summary"`
	JSON       assistantMessageJSON   `json:"-"`
}

func (*AssistantMessage) UnmarshalJSON

func (r *AssistantMessage) UnmarshalJSON(data []byte) (err error)

type AssistantMessageError

type AssistantMessageError struct {
	// This field can have the runtime type of [shared.ProviderAuthErrorData],
	// [shared.UnknownErrorData], [interface{}], [shared.MessageAbortedErrorData].
	Data interface{}               `json:"data,required"`
	Name AssistantMessageErrorName `json:"name,required"`
	JSON assistantMessageErrorJSON `json:"-"`
	// contains filtered or unexported fields
}

func (AssistantMessageError) AsUnion

AsUnion returns a AssistantMessageErrorUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are shared.ProviderAuthError, shared.UnknownError, AssistantMessageErrorMessageOutputLengthError, shared.MessageAbortedError.

func (*AssistantMessageError) UnmarshalJSON

func (r *AssistantMessageError) UnmarshalJSON(data []byte) (err error)

type AssistantMessageErrorMessageOutputLengthError

type AssistantMessageErrorMessageOutputLengthError struct {
	Data interface{}                                       `json:"data,required"`
	Name AssistantMessageErrorMessageOutputLengthErrorName `json:"name,required"`
	JSON assistantMessageErrorMessageOutputLengthErrorJSON `json:"-"`
}

func (AssistantMessageErrorMessageOutputLengthError) ImplementsAssistantMessageError

func (r AssistantMessageErrorMessageOutputLengthError) ImplementsAssistantMessageError()

func (*AssistantMessageErrorMessageOutputLengthError) UnmarshalJSON

func (r *AssistantMessageErrorMessageOutputLengthError) UnmarshalJSON(data []byte) (err error)

type AssistantMessageErrorMessageOutputLengthErrorName

type AssistantMessageErrorMessageOutputLengthErrorName string
const (
	AssistantMessageErrorMessageOutputLengthErrorNameMessageOutputLengthError AssistantMessageErrorMessageOutputLengthErrorName = "MessageOutputLengthError"
)

func (AssistantMessageErrorMessageOutputLengthErrorName) IsKnown

type AssistantMessageErrorName

type AssistantMessageErrorName string
const (
	AssistantMessageErrorNameProviderAuthError        AssistantMessageErrorName = "ProviderAuthError"
	AssistantMessageErrorNameUnknownError             AssistantMessageErrorName = "UnknownError"
	AssistantMessageErrorNameMessageOutputLengthError AssistantMessageErrorName = "MessageOutputLengthError"
	AssistantMessageErrorNameMessageAbortedError      AssistantMessageErrorName = "MessageAbortedError"
)

func (AssistantMessageErrorName) IsKnown

func (r AssistantMessageErrorName) IsKnown() bool

type AssistantMessageErrorUnion

type AssistantMessageErrorUnion interface {
	ImplementsAssistantMessageError()
}

Union satisfied by shared.ProviderAuthError, shared.UnknownError, AssistantMessageErrorMessageOutputLengthError or shared.MessageAbortedError.

type AssistantMessagePath

type AssistantMessagePath struct {
	Cwd  string                   `json:"cwd,required"`
	Root string                   `json:"root,required"`
	JSON assistantMessagePathJSON `json:"-"`
}

func (*AssistantMessagePath) UnmarshalJSON

func (r *AssistantMessagePath) UnmarshalJSON(data []byte) (err error)

type AssistantMessageRole

type AssistantMessageRole string
const (
	AssistantMessageRoleAssistant AssistantMessageRole = "assistant"
)

func (AssistantMessageRole) IsKnown

func (r AssistantMessageRole) IsKnown() bool

type AssistantMessageTime

type AssistantMessageTime struct {
	Created   float64                  `json:"created,required"`
	Completed float64                  `json:"completed"`
	JSON      assistantMessageTimeJSON `json:"-"`
}

func (*AssistantMessageTime) UnmarshalJSON

func (r *AssistantMessageTime) UnmarshalJSON(data []byte) (err error)

type AssistantMessageTokens

type AssistantMessageTokens struct {
	Cache     AssistantMessageTokensCache `json:"cache,required"`
	Input     float64                     `json:"input,required"`
	Output    float64                     `json:"output,required"`
	Reasoning float64                     `json:"reasoning,required"`
	JSON      assistantMessageTokensJSON  `json:"-"`
}

func (*AssistantMessageTokens) UnmarshalJSON

func (r *AssistantMessageTokens) UnmarshalJSON(data []byte) (err error)

type AssistantMessageTokensCache

type AssistantMessageTokensCache struct {
	Read  float64                         `json:"read,required"`
	Write float64                         `json:"write,required"`
	JSON  assistantMessageTokensCacheJSON `json:"-"`
}

func (*AssistantMessageTokensCache) UnmarshalJSON

func (r *AssistantMessageTokensCache) UnmarshalJSON(data []byte) (err error)

type Client

type Client struct {
	Options []option.RequestOption
	Event   *EventService
	Path    *PathService
	App     *AppService
	Agent   *AgentService
	Find    *FindService
	File    *FileService
	Config  *ConfigService
	Command *CommandService
	Project *ProjectService
	Session *SessionService
	Tui     *TuiService
}

Client creates a struct with services and top level methods that help with interacting with the opencode API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r *Client)

NewClient generates a new client with the default option read from the environment (OPENCODE_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type Command

type Command struct {
	Name        string      `json:"name,required"`
	Template    string      `json:"template,required"`
	Agent       string      `json:"agent"`
	Description string      `json:"description"`
	Model       string      `json:"model"`
	Subtask     bool        `json:"subtask"`
	JSON        commandJSON `json:"-"`
}

func (*Command) UnmarshalJSON

func (r *Command) UnmarshalJSON(data []byte) (err error)

type CommandListParams added in v0.5.0

type CommandListParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (CommandListParams) URLQuery added in v0.5.0

func (r CommandListParams) URLQuery() (v url.Values)

URLQuery serializes CommandListParams's query parameters as `url.Values`.

type CommandService

type CommandService struct {
	Options []option.RequestOption
}

CommandService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCommandService method instead.

func NewCommandService

func NewCommandService(opts ...option.RequestOption) (r *CommandService)

NewCommandService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CommandService) List

func (r *CommandService) List(ctx context.Context, query CommandListParams, opts ...option.RequestOption) (res *[]Command, err error)

List all commands

type Config

type Config struct {
	// JSON schema reference for configuration validation
	Schema string `json:"$schema"`
	// Agent configuration, see https://opencode.ai/docs/agent
	Agent ConfigAgent `json:"agent"`
	// @deprecated Use 'share' field instead. Share newly created sessions
	// automatically
	Autoshare bool `json:"autoshare"`
	// Automatically update to the latest version
	Autoupdate bool `json:"autoupdate"`
	// Command configuration, see https://opencode.ai/docs/commands
	Command map[string]ConfigCommand `json:"command"`
	// Disable providers that are loaded automatically
	DisabledProviders []string                   `json:"disabled_providers"`
	Experimental      ConfigExperimental         `json:"experimental"`
	Formatter         map[string]ConfigFormatter `json:"formatter"`
	// Additional instruction files or patterns to include
	Instructions []string `json:"instructions"`
	// Custom keybind configurations
	Keybinds KeybindsConfig `json:"keybinds"`
	// @deprecated Always uses stretch layout.
	Layout ConfigLayout         `json:"layout"`
	Lsp    map[string]ConfigLsp `json:"lsp"`
	// MCP (Model Context Protocol) server configurations
	Mcp map[string]ConfigMcp `json:"mcp"`
	// @deprecated Use `agent` field instead.
	Mode ConfigMode `json:"mode"`
	// Model to use in the format of provider/model, eg anthropic/claude-2
	Model      string           `json:"model"`
	Permission ConfigPermission `json:"permission"`
	Plugin     []string         `json:"plugin"`
	// Custom provider configurations and model overrides
	Provider map[string]ConfigProvider `json:"provider"`
	// 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
	SmallModel string `json:"small_model"`
	Snapshot   bool   `json:"snapshot"`
	// Theme name to use for the interface
	Theme string          `json:"theme"`
	Tools map[string]bool `json:"tools"`
	// TUI specific settings
	Tui ConfigTui `json:"tui"`
	// Custom username to display in conversations instead of system username
	Username string        `json:"username"`
	Watcher  ConfigWatcher `json:"watcher"`
	JSON     configJSON    `json:"-"`
}

func (*Config) UnmarshalJSON

func (r *Config) UnmarshalJSON(data []byte) (err error)

type ConfigAgent

type ConfigAgent struct {
	Build       ConfigAgentBuild       `json:"build"`
	General     ConfigAgentGeneral     `json:"general"`
	Plan        ConfigAgentPlan        `json:"plan"`
	ExtraFields map[string]ConfigAgent `json:"-,extras"`
	JSON        configAgentJSON        `json:"-"`
}

Agent configuration, see https://opencode.ai/docs/agent

func (*ConfigAgent) UnmarshalJSON

func (r *ConfigAgent) UnmarshalJSON(data []byte) (err error)

type ConfigAgentBuild added in v0.2.0

type ConfigAgentBuild struct {
	// Description of when to use the agent
	Description string                     `json:"description"`
	Disable     bool                       `json:"disable"`
	Mode        ConfigAgentBuildMode       `json:"mode"`
	Model       string                     `json:"model"`
	Permission  ConfigAgentBuildPermission `json:"permission"`
	Prompt      string                     `json:"prompt"`
	Temperature float64                    `json:"temperature"`
	Tools       map[string]bool            `json:"tools"`
	TopP        float64                    `json:"top_p"`
	ExtraFields map[string]interface{}     `json:"-,extras"`
	JSON        configAgentBuildJSON       `json:"-"`
}

func (*ConfigAgentBuild) UnmarshalJSON added in v0.2.0

func (r *ConfigAgentBuild) UnmarshalJSON(data []byte) (err error)

type ConfigAgentBuildMode added in v0.2.0

type ConfigAgentBuildMode string
const (
	ConfigAgentBuildModeSubagent ConfigAgentBuildMode = "subagent"
	ConfigAgentBuildModePrimary  ConfigAgentBuildMode = "primary"
	ConfigAgentBuildModeAll      ConfigAgentBuildMode = "all"
)

func (ConfigAgentBuildMode) IsKnown added in v0.2.0

func (r ConfigAgentBuildMode) IsKnown() bool

type ConfigAgentBuildPermission added in v0.2.0

type ConfigAgentBuildPermission struct {
	Bash     ConfigAgentBuildPermissionBashUnion `json:"bash"`
	Edit     ConfigAgentBuildPermissionEdit      `json:"edit"`
	Webfetch ConfigAgentBuildPermissionWebfetch  `json:"webfetch"`
	JSON     configAgentBuildPermissionJSON      `json:"-"`
}

func (*ConfigAgentBuildPermission) UnmarshalJSON added in v0.2.0

func (r *ConfigAgentBuildPermission) UnmarshalJSON(data []byte) (err error)

type ConfigAgentBuildPermissionBashMap added in v0.2.0

type ConfigAgentBuildPermissionBashMap map[string]ConfigAgentBuildPermissionBashMapItem

type ConfigAgentBuildPermissionBashMapItem added in v0.2.0

type ConfigAgentBuildPermissionBashMapItem string
const (
	ConfigAgentBuildPermissionBashMapAsk   ConfigAgentBuildPermissionBashMapItem = "ask"
	ConfigAgentBuildPermissionBashMapAllow ConfigAgentBuildPermissionBashMapItem = "allow"
	ConfigAgentBuildPermissionBashMapDeny  ConfigAgentBuildPermissionBashMapItem = "deny"
)

func (ConfigAgentBuildPermissionBashMapItem) IsKnown added in v0.2.0

type ConfigAgentBuildPermissionBashString added in v0.2.0

type ConfigAgentBuildPermissionBashString string
const (
	ConfigAgentBuildPermissionBashStringAsk   ConfigAgentBuildPermissionBashString = "ask"
	ConfigAgentBuildPermissionBashStringAllow ConfigAgentBuildPermissionBashString = "allow"
	ConfigAgentBuildPermissionBashStringDeny  ConfigAgentBuildPermissionBashString = "deny"
)

func (ConfigAgentBuildPermissionBashString) IsKnown added in v0.2.0

type ConfigAgentBuildPermissionBashUnion added in v0.2.0

type ConfigAgentBuildPermissionBashUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by ConfigAgentBuildPermissionBashString or ConfigAgentBuildPermissionBashMap.

type ConfigAgentBuildPermissionEdit added in v0.2.0

type ConfigAgentBuildPermissionEdit string
const (
	ConfigAgentBuildPermissionEditAsk   ConfigAgentBuildPermissionEdit = "ask"
	ConfigAgentBuildPermissionEditAllow ConfigAgentBuildPermissionEdit = "allow"
	ConfigAgentBuildPermissionEditDeny  ConfigAgentBuildPermissionEdit = "deny"
)

func (ConfigAgentBuildPermissionEdit) IsKnown added in v0.2.0

type ConfigAgentBuildPermissionWebfetch added in v0.2.0

type ConfigAgentBuildPermissionWebfetch string
const (
	ConfigAgentBuildPermissionWebfetchAsk   ConfigAgentBuildPermissionWebfetch = "ask"
	ConfigAgentBuildPermissionWebfetchAllow ConfigAgentBuildPermissionWebfetch = "allow"
	ConfigAgentBuildPermissionWebfetchDeny  ConfigAgentBuildPermissionWebfetch = "deny"
)

func (ConfigAgentBuildPermissionWebfetch) IsKnown added in v0.2.0

type ConfigAgentGeneral added in v0.2.0

type ConfigAgentGeneral struct {
	// Description of when to use the agent
	Description string                       `json:"description"`
	Disable     bool                         `json:"disable"`
	Mode        ConfigAgentGeneralMode       `json:"mode"`
	Model       string                       `json:"model"`
	Permission  ConfigAgentGeneralPermission `json:"permission"`
	Prompt      string                       `json:"prompt"`
	Temperature float64                      `json:"temperature"`
	Tools       map[string]bool              `json:"tools"`
	TopP        float64                      `json:"top_p"`
	ExtraFields map[string]interface{}       `json:"-,extras"`
	JSON        configAgentGeneralJSON       `json:"-"`
}

func (*ConfigAgentGeneral) UnmarshalJSON added in v0.2.0

func (r *ConfigAgentGeneral) UnmarshalJSON(data []byte) (err error)

type ConfigAgentGeneralMode added in v0.2.0

type ConfigAgentGeneralMode string
const (
	ConfigAgentGeneralModeSubagent ConfigAgentGeneralMode = "subagent"
	ConfigAgentGeneralModePrimary  ConfigAgentGeneralMode = "primary"
	ConfigAgentGeneralModeAll      ConfigAgentGeneralMode = "all"
)

func (ConfigAgentGeneralMode) IsKnown added in v0.2.0

func (r ConfigAgentGeneralMode) IsKnown() bool

type ConfigAgentGeneralPermission added in v0.2.0

type ConfigAgentGeneralPermission struct {
	Bash     ConfigAgentGeneralPermissionBashUnion `json:"bash"`
	Edit     ConfigAgentGeneralPermissionEdit      `json:"edit"`
	Webfetch ConfigAgentGeneralPermissionWebfetch  `json:"webfetch"`
	JSON     configAgentGeneralPermissionJSON      `json:"-"`
}

func (*ConfigAgentGeneralPermission) UnmarshalJSON added in v0.2.0

func (r *ConfigAgentGeneralPermission) UnmarshalJSON(data []byte) (err error)

type ConfigAgentGeneralPermissionBashMap added in v0.2.0

type ConfigAgentGeneralPermissionBashMap map[string]ConfigAgentGeneralPermissionBashMapItem

type ConfigAgentGeneralPermissionBashMapItem added in v0.2.0

type ConfigAgentGeneralPermissionBashMapItem string
const (
	ConfigAgentGeneralPermissionBashMapAsk   ConfigAgentGeneralPermissionBashMapItem = "ask"
	ConfigAgentGeneralPermissionBashMapAllow ConfigAgentGeneralPermissionBashMapItem = "allow"
	ConfigAgentGeneralPermissionBashMapDeny  ConfigAgentGeneralPermissionBashMapItem = "deny"
)

func (ConfigAgentGeneralPermissionBashMapItem) IsKnown added in v0.2.0

type ConfigAgentGeneralPermissionBashString added in v0.2.0

type ConfigAgentGeneralPermissionBashString string
const (
	ConfigAgentGeneralPermissionBashStringAsk   ConfigAgentGeneralPermissionBashString = "ask"
	ConfigAgentGeneralPermissionBashStringAllow ConfigAgentGeneralPermissionBashString = "allow"
	ConfigAgentGeneralPermissionBashStringDeny  ConfigAgentGeneralPermissionBashString = "deny"
)

func (ConfigAgentGeneralPermissionBashString) IsKnown added in v0.2.0

type ConfigAgentGeneralPermissionBashUnion added in v0.2.0

type ConfigAgentGeneralPermissionBashUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by ConfigAgentGeneralPermissionBashString or ConfigAgentGeneralPermissionBashMap.

type ConfigAgentGeneralPermissionEdit added in v0.2.0

type ConfigAgentGeneralPermissionEdit string
const (
	ConfigAgentGeneralPermissionEditAsk   ConfigAgentGeneralPermissionEdit = "ask"
	ConfigAgentGeneralPermissionEditAllow ConfigAgentGeneralPermissionEdit = "allow"
	ConfigAgentGeneralPermissionEditDeny  ConfigAgentGeneralPermissionEdit = "deny"
)

func (ConfigAgentGeneralPermissionEdit) IsKnown added in v0.2.0

type ConfigAgentGeneralPermissionWebfetch added in v0.2.0

type ConfigAgentGeneralPermissionWebfetch string
const (
	ConfigAgentGeneralPermissionWebfetchAsk   ConfigAgentGeneralPermissionWebfetch = "ask"
	ConfigAgentGeneralPermissionWebfetchAllow ConfigAgentGeneralPermissionWebfetch = "allow"
	ConfigAgentGeneralPermissionWebfetchDeny  ConfigAgentGeneralPermissionWebfetch = "deny"
)

func (ConfigAgentGeneralPermissionWebfetch) IsKnown added in v0.2.0

type ConfigAgentPlan added in v0.2.0

type ConfigAgentPlan struct {
	// Description of when to use the agent
	Description string                    `json:"description"`
	Disable     bool                      `json:"disable"`
	Mode        ConfigAgentPlanMode       `json:"mode"`
	Model       string                    `json:"model"`
	Permission  ConfigAgentPlanPermission `json:"permission"`
	Prompt      string                    `json:"prompt"`
	Temperature float64                   `json:"temperature"`
	Tools       map[string]bool           `json:"tools"`
	TopP        float64                   `json:"top_p"`
	ExtraFields map[string]interface{}    `json:"-,extras"`
	JSON        configAgentPlanJSON       `json:"-"`
}

func (*ConfigAgentPlan) UnmarshalJSON added in v0.2.0

func (r *ConfigAgentPlan) UnmarshalJSON(data []byte) (err error)

type ConfigAgentPlanMode added in v0.2.0

type ConfigAgentPlanMode string
const (
	ConfigAgentPlanModeSubagent ConfigAgentPlanMode = "subagent"
	ConfigAgentPlanModePrimary  ConfigAgentPlanMode = "primary"
	ConfigAgentPlanModeAll      ConfigAgentPlanMode = "all"
)

func (ConfigAgentPlanMode) IsKnown added in v0.2.0

func (r ConfigAgentPlanMode) IsKnown() bool

type ConfigAgentPlanPermission added in v0.2.0

type ConfigAgentPlanPermission struct {
	Bash     ConfigAgentPlanPermissionBashUnion `json:"bash"`
	Edit     ConfigAgentPlanPermissionEdit      `json:"edit"`
	Webfetch ConfigAgentPlanPermissionWebfetch  `json:"webfetch"`
	JSON     configAgentPlanPermissionJSON      `json:"-"`
}

func (*ConfigAgentPlanPermission) UnmarshalJSON added in v0.2.0

func (r *ConfigAgentPlanPermission) UnmarshalJSON(data []byte) (err error)

type ConfigAgentPlanPermissionBashMap added in v0.2.0

type ConfigAgentPlanPermissionBashMap map[string]ConfigAgentPlanPermissionBashMapItem

type ConfigAgentPlanPermissionBashMapItem added in v0.2.0

type ConfigAgentPlanPermissionBashMapItem string
const (
	ConfigAgentPlanPermissionBashMapAsk   ConfigAgentPlanPermissionBashMapItem = "ask"
	ConfigAgentPlanPermissionBashMapAllow ConfigAgentPlanPermissionBashMapItem = "allow"
	ConfigAgentPlanPermissionBashMapDeny  ConfigAgentPlanPermissionBashMapItem = "deny"
)

func (ConfigAgentPlanPermissionBashMapItem) IsKnown added in v0.2.0

type ConfigAgentPlanPermissionBashString added in v0.2.0

type ConfigAgentPlanPermissionBashString string
const (
	ConfigAgentPlanPermissionBashStringAsk   ConfigAgentPlanPermissionBashString = "ask"
	ConfigAgentPlanPermissionBashStringAllow ConfigAgentPlanPermissionBashString = "allow"
	ConfigAgentPlanPermissionBashStringDeny  ConfigAgentPlanPermissionBashString = "deny"
)

func (ConfigAgentPlanPermissionBashString) IsKnown added in v0.2.0

type ConfigAgentPlanPermissionBashUnion added in v0.2.0

type ConfigAgentPlanPermissionBashUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by ConfigAgentPlanPermissionBashString or ConfigAgentPlanPermissionBashMap.

type ConfigAgentPlanPermissionEdit added in v0.2.0

type ConfigAgentPlanPermissionEdit string
const (
	ConfigAgentPlanPermissionEditAsk   ConfigAgentPlanPermissionEdit = "ask"
	ConfigAgentPlanPermissionEditAllow ConfigAgentPlanPermissionEdit = "allow"
	ConfigAgentPlanPermissionEditDeny  ConfigAgentPlanPermissionEdit = "deny"
)

func (ConfigAgentPlanPermissionEdit) IsKnown added in v0.2.0

func (r ConfigAgentPlanPermissionEdit) IsKnown() bool

type ConfigAgentPlanPermissionWebfetch added in v0.2.0

type ConfigAgentPlanPermissionWebfetch string
const (
	ConfigAgentPlanPermissionWebfetchAsk   ConfigAgentPlanPermissionWebfetch = "ask"
	ConfigAgentPlanPermissionWebfetchAllow ConfigAgentPlanPermissionWebfetch = "allow"
	ConfigAgentPlanPermissionWebfetchDeny  ConfigAgentPlanPermissionWebfetch = "deny"
)

func (ConfigAgentPlanPermissionWebfetch) IsKnown added in v0.2.0

type ConfigCommand

type ConfigCommand struct {
	Template    string            `json:"template,required"`
	Agent       string            `json:"agent"`
	Description string            `json:"description"`
	Model       string            `json:"model"`
	Subtask     bool              `json:"subtask"`
	JSON        configCommandJSON `json:"-"`
}

func (*ConfigCommand) UnmarshalJSON

func (r *ConfigCommand) UnmarshalJSON(data []byte) (err error)

type ConfigExperimental

type ConfigExperimental struct {
	DisablePasteSummary bool                   `json:"disable_paste_summary"`
	Hook                ConfigExperimentalHook `json:"hook"`
	JSON                configExperimentalJSON `json:"-"`
}

func (*ConfigExperimental) UnmarshalJSON

func (r *ConfigExperimental) UnmarshalJSON(data []byte) (err error)

type ConfigExperimentalHook

type ConfigExperimentalHook struct {
	FileEdited       map[string][]ConfigExperimentalHookFileEdited `json:"file_edited"`
	SessionCompleted []ConfigExperimentalHookSessionCompleted      `json:"session_completed"`
	JSON             configExperimentalHookJSON                    `json:"-"`
}

func (*ConfigExperimentalHook) UnmarshalJSON

func (r *ConfigExperimentalHook) UnmarshalJSON(data []byte) (err error)

type ConfigExperimentalHookFileEdited

type ConfigExperimentalHookFileEdited struct {
	Command     []string                             `json:"command,required"`
	Environment map[string]string                    `json:"environment"`
	JSON        configExperimentalHookFileEditedJSON `json:"-"`
}

func (*ConfigExperimentalHookFileEdited) UnmarshalJSON

func (r *ConfigExperimentalHookFileEdited) UnmarshalJSON(data []byte) (err error)

type ConfigExperimentalHookSessionCompleted

type ConfigExperimentalHookSessionCompleted struct {
	Command     []string                                   `json:"command,required"`
	Environment map[string]string                          `json:"environment"`
	JSON        configExperimentalHookSessionCompletedJSON `json:"-"`
}

func (*ConfigExperimentalHookSessionCompleted) UnmarshalJSON

func (r *ConfigExperimentalHookSessionCompleted) UnmarshalJSON(data []byte) (err error)

type ConfigFormatter

type ConfigFormatter struct {
	Command     []string            `json:"command"`
	Disabled    bool                `json:"disabled"`
	Environment map[string]string   `json:"environment"`
	Extensions  []string            `json:"extensions"`
	JSON        configFormatterJSON `json:"-"`
}

func (*ConfigFormatter) UnmarshalJSON

func (r *ConfigFormatter) UnmarshalJSON(data []byte) (err error)

type ConfigGetParams added in v0.5.0

type ConfigGetParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (ConfigGetParams) URLQuery added in v0.5.0

func (r ConfigGetParams) URLQuery() (v url.Values)

URLQuery serializes ConfigGetParams's query parameters as `url.Values`.

type ConfigLayout

type ConfigLayout string

@deprecated Always uses stretch layout.

const (
	ConfigLayoutAuto    ConfigLayout = "auto"
	ConfigLayoutStretch ConfigLayout = "stretch"
)

func (ConfigLayout) IsKnown

func (r ConfigLayout) IsKnown() bool

type ConfigLsp

type ConfigLsp struct {
	// This field can have the runtime type of [[]string].
	Command  interface{} `json:"command"`
	Disabled bool        `json:"disabled"`
	// This field can have the runtime type of [map[string]string].
	Env interface{} `json:"env"`
	// This field can have the runtime type of [[]string].
	Extensions interface{} `json:"extensions"`
	// This field can have the runtime type of [map[string]interface{}].
	Initialization interface{}   `json:"initialization"`
	JSON           configLspJSON `json:"-"`
	// contains filtered or unexported fields
}

func (ConfigLsp) AsUnion

func (r ConfigLsp) AsUnion() ConfigLspUnion

AsUnion returns a ConfigLspUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are ConfigLspDisabled, ConfigLspObject.

func (*ConfigLsp) UnmarshalJSON

func (r *ConfigLsp) UnmarshalJSON(data []byte) (err error)

type ConfigLspDisabled

type ConfigLspDisabled struct {
	Disabled ConfigLspDisabledDisabled `json:"disabled,required"`
	JSON     configLspDisabledJSON     `json:"-"`
}

func (*ConfigLspDisabled) UnmarshalJSON

func (r *ConfigLspDisabled) UnmarshalJSON(data []byte) (err error)

type ConfigLspDisabledDisabled

type ConfigLspDisabledDisabled bool
const (
	ConfigLspDisabledDisabledTrue ConfigLspDisabledDisabled = true
)

func (ConfigLspDisabledDisabled) IsKnown

func (r ConfigLspDisabledDisabled) IsKnown() bool

type ConfigLspObject

type ConfigLspObject struct {
	Command        []string               `json:"command,required"`
	Disabled       bool                   `json:"disabled"`
	Env            map[string]string      `json:"env"`
	Extensions     []string               `json:"extensions"`
	Initialization map[string]interface{} `json:"initialization"`
	JSON           configLspObjectJSON    `json:"-"`
}

func (*ConfigLspObject) UnmarshalJSON

func (r *ConfigLspObject) UnmarshalJSON(data []byte) (err error)

type ConfigLspUnion

type ConfigLspUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by ConfigLspDisabled or ConfigLspObject.

type ConfigMcp

type ConfigMcp struct {
	// Type of MCP server connection
	Type ConfigMcpType `json:"type,required"`
	// This field can have the runtime type of [[]string].
	Command interface{} `json:"command"`
	// Enable or disable the MCP server on startup
	Enabled bool `json:"enabled"`
	// This field can have the runtime type of [map[string]string].
	Environment interface{} `json:"environment"`
	// This field can have the runtime type of [map[string]string].
	Headers interface{} `json:"headers"`
	// URL of the remote MCP server
	URL  string        `json:"url"`
	JSON configMcpJSON `json:"-"`
	// contains filtered or unexported fields
}

func (ConfigMcp) AsUnion

func (r ConfigMcp) AsUnion() ConfigMcpUnion

AsUnion returns a ConfigMcpUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are McpLocalConfig, McpRemoteConfig.

func (*ConfigMcp) UnmarshalJSON

func (r *ConfigMcp) UnmarshalJSON(data []byte) (err error)

type ConfigMcpType

type ConfigMcpType string

Type of MCP server connection

const (
	ConfigMcpTypeLocal  ConfigMcpType = "local"
	ConfigMcpTypeRemote ConfigMcpType = "remote"
)

func (ConfigMcpType) IsKnown

func (r ConfigMcpType) IsKnown() bool

type ConfigMcpUnion

type ConfigMcpUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by McpLocalConfig or McpRemoteConfig.

type ConfigMode

type ConfigMode struct {
	Build       ConfigModeBuild       `json:"build"`
	Plan        ConfigModePlan        `json:"plan"`
	ExtraFields map[string]ConfigMode `json:"-,extras"`
	JSON        configModeJSON        `json:"-"`
}

@deprecated Use `agent` field instead.

func (*ConfigMode) UnmarshalJSON

func (r *ConfigMode) UnmarshalJSON(data []byte) (err error)

type ConfigModeBuild added in v0.2.0

type ConfigModeBuild struct {
	// Description of when to use the agent
	Description string                    `json:"description"`
	Disable     bool                      `json:"disable"`
	Mode        ConfigModeBuildMode       `json:"mode"`
	Model       string                    `json:"model"`
	Permission  ConfigModeBuildPermission `json:"permission"`
	Prompt      string                    `json:"prompt"`
	Temperature float64                   `json:"temperature"`
	Tools       map[string]bool           `json:"tools"`
	TopP        float64                   `json:"top_p"`
	ExtraFields map[string]interface{}    `json:"-,extras"`
	JSON        configModeBuildJSON       `json:"-"`
}

func (*ConfigModeBuild) UnmarshalJSON added in v0.2.0

func (r *ConfigModeBuild) UnmarshalJSON(data []byte) (err error)

type ConfigModeBuildMode added in v0.2.0

type ConfigModeBuildMode string
const (
	ConfigModeBuildModeSubagent ConfigModeBuildMode = "subagent"
	ConfigModeBuildModePrimary  ConfigModeBuildMode = "primary"
	ConfigModeBuildModeAll      ConfigModeBuildMode = "all"
)

func (ConfigModeBuildMode) IsKnown added in v0.2.0

func (r ConfigModeBuildMode) IsKnown() bool

type ConfigModeBuildPermission added in v0.2.0

type ConfigModeBuildPermission struct {
	Bash     ConfigModeBuildPermissionBashUnion `json:"bash"`
	Edit     ConfigModeBuildPermissionEdit      `json:"edit"`
	Webfetch ConfigModeBuildPermissionWebfetch  `json:"webfetch"`
	JSON     configModeBuildPermissionJSON      `json:"-"`
}

func (*ConfigModeBuildPermission) UnmarshalJSON added in v0.2.0

func (r *ConfigModeBuildPermission) UnmarshalJSON(data []byte) (err error)

type ConfigModeBuildPermissionBashMap added in v0.2.0

type ConfigModeBuildPermissionBashMap map[string]ConfigModeBuildPermissionBashMapItem

type ConfigModeBuildPermissionBashMapItem added in v0.2.0

type ConfigModeBuildPermissionBashMapItem string
const (
	ConfigModeBuildPermissionBashMapAsk   ConfigModeBuildPermissionBashMapItem = "ask"
	ConfigModeBuildPermissionBashMapAllow ConfigModeBuildPermissionBashMapItem = "allow"
	ConfigModeBuildPermissionBashMapDeny  ConfigModeBuildPermissionBashMapItem = "deny"
)

func (ConfigModeBuildPermissionBashMapItem) IsKnown added in v0.2.0

type ConfigModeBuildPermissionBashString added in v0.2.0

type ConfigModeBuildPermissionBashString string
const (
	ConfigModeBuildPermissionBashStringAsk   ConfigModeBuildPermissionBashString = "ask"
	ConfigModeBuildPermissionBashStringAllow ConfigModeBuildPermissionBashString = "allow"
	ConfigModeBuildPermissionBashStringDeny  ConfigModeBuildPermissionBashString = "deny"
)

func (ConfigModeBuildPermissionBashString) IsKnown added in v0.2.0

type ConfigModeBuildPermissionBashUnion added in v0.2.0

type ConfigModeBuildPermissionBashUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by ConfigModeBuildPermissionBashString or ConfigModeBuildPermissionBashMap.

type ConfigModeBuildPermissionEdit added in v0.2.0

type ConfigModeBuildPermissionEdit string
const (
	ConfigModeBuildPermissionEditAsk   ConfigModeBuildPermissionEdit = "ask"
	ConfigModeBuildPermissionEditAllow ConfigModeBuildPermissionEdit = "allow"
	ConfigModeBuildPermissionEditDeny  ConfigModeBuildPermissionEdit = "deny"
)

func (ConfigModeBuildPermissionEdit) IsKnown added in v0.2.0

func (r ConfigModeBuildPermissionEdit) IsKnown() bool

type ConfigModeBuildPermissionWebfetch added in v0.2.0

type ConfigModeBuildPermissionWebfetch string
const (
	ConfigModeBuildPermissionWebfetchAsk   ConfigModeBuildPermissionWebfetch = "ask"
	ConfigModeBuildPermissionWebfetchAllow ConfigModeBuildPermissionWebfetch = "allow"
	ConfigModeBuildPermissionWebfetchDeny  ConfigModeBuildPermissionWebfetch = "deny"
)

func (ConfigModeBuildPermissionWebfetch) IsKnown added in v0.2.0

type ConfigModePlan added in v0.2.0

type ConfigModePlan struct {
	// Description of when to use the agent
	Description string                   `json:"description"`
	Disable     bool                     `json:"disable"`
	Mode        ConfigModePlanMode       `json:"mode"`
	Model       string                   `json:"model"`
	Permission  ConfigModePlanPermission `json:"permission"`
	Prompt      string                   `json:"prompt"`
	Temperature float64                  `json:"temperature"`
	Tools       map[string]bool          `json:"tools"`
	TopP        float64                  `json:"top_p"`
	ExtraFields map[string]interface{}   `json:"-,extras"`
	JSON        configModePlanJSON       `json:"-"`
}

func (*ConfigModePlan) UnmarshalJSON added in v0.2.0

func (r *ConfigModePlan) UnmarshalJSON(data []byte) (err error)

type ConfigModePlanMode added in v0.2.0

type ConfigModePlanMode string
const (
	ConfigModePlanModeSubagent ConfigModePlanMode = "subagent"
	ConfigModePlanModePrimary  ConfigModePlanMode = "primary"
	ConfigModePlanModeAll      ConfigModePlanMode = "all"
)

func (ConfigModePlanMode) IsKnown added in v0.2.0

func (r ConfigModePlanMode) IsKnown() bool

type ConfigModePlanPermission added in v0.2.0

type ConfigModePlanPermission struct {
	Bash     ConfigModePlanPermissionBashUnion `json:"bash"`
	Edit     ConfigModePlanPermissionEdit      `json:"edit"`
	Webfetch ConfigModePlanPermissionWebfetch  `json:"webfetch"`
	JSON     configModePlanPermissionJSON      `json:"-"`
}

func (*ConfigModePlanPermission) UnmarshalJSON added in v0.2.0

func (r *ConfigModePlanPermission) UnmarshalJSON(data []byte) (err error)

type ConfigModePlanPermissionBashMap added in v0.2.0

type ConfigModePlanPermissionBashMap map[string]ConfigModePlanPermissionBashMapItem

type ConfigModePlanPermissionBashMapItem added in v0.2.0

type ConfigModePlanPermissionBashMapItem string
const (
	ConfigModePlanPermissionBashMapAsk   ConfigModePlanPermissionBashMapItem = "ask"
	ConfigModePlanPermissionBashMapAllow ConfigModePlanPermissionBashMapItem = "allow"
	ConfigModePlanPermissionBashMapDeny  ConfigModePlanPermissionBashMapItem = "deny"
)

func (ConfigModePlanPermissionBashMapItem) IsKnown added in v0.2.0

type ConfigModePlanPermissionBashString added in v0.2.0

type ConfigModePlanPermissionBashString string
const (
	ConfigModePlanPermissionBashStringAsk   ConfigModePlanPermissionBashString = "ask"
	ConfigModePlanPermissionBashStringAllow ConfigModePlanPermissionBashString = "allow"
	ConfigModePlanPermissionBashStringDeny  ConfigModePlanPermissionBashString = "deny"
)

func (ConfigModePlanPermissionBashString) IsKnown added in v0.2.0

type ConfigModePlanPermissionBashUnion added in v0.2.0

type ConfigModePlanPermissionBashUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by ConfigModePlanPermissionBashString or ConfigModePlanPermissionBashMap.

type ConfigModePlanPermissionEdit added in v0.2.0

type ConfigModePlanPermissionEdit string
const (
	ConfigModePlanPermissionEditAsk   ConfigModePlanPermissionEdit = "ask"
	ConfigModePlanPermissionEditAllow ConfigModePlanPermissionEdit = "allow"
	ConfigModePlanPermissionEditDeny  ConfigModePlanPermissionEdit = "deny"
)

func (ConfigModePlanPermissionEdit) IsKnown added in v0.2.0

func (r ConfigModePlanPermissionEdit) IsKnown() bool

type ConfigModePlanPermissionWebfetch added in v0.2.0

type ConfigModePlanPermissionWebfetch string
const (
	ConfigModePlanPermissionWebfetchAsk   ConfigModePlanPermissionWebfetch = "ask"
	ConfigModePlanPermissionWebfetchAllow ConfigModePlanPermissionWebfetch = "allow"
	ConfigModePlanPermissionWebfetchDeny  ConfigModePlanPermissionWebfetch = "deny"
)

func (ConfigModePlanPermissionWebfetch) IsKnown added in v0.2.0

type ConfigPermission

type ConfigPermission struct {
	Bash     ConfigPermissionBashUnion `json:"bash"`
	Edit     ConfigPermissionEdit      `json:"edit"`
	Webfetch ConfigPermissionWebfetch  `json:"webfetch"`
	JSON     configPermissionJSON      `json:"-"`
}

func (*ConfigPermission) UnmarshalJSON

func (r *ConfigPermission) UnmarshalJSON(data []byte) (err error)

type ConfigPermissionBashMap

type ConfigPermissionBashMap map[string]ConfigPermissionBashMapItem

type ConfigPermissionBashMapItem

type ConfigPermissionBashMapItem string
const (
	ConfigPermissionBashMapAsk   ConfigPermissionBashMapItem = "ask"
	ConfigPermissionBashMapAllow ConfigPermissionBashMapItem = "allow"
	ConfigPermissionBashMapDeny  ConfigPermissionBashMapItem = "deny"
)

func (ConfigPermissionBashMapItem) IsKnown

func (r ConfigPermissionBashMapItem) IsKnown() bool

type ConfigPermissionBashString

type ConfigPermissionBashString string
const (
	ConfigPermissionBashStringAsk   ConfigPermissionBashString = "ask"
	ConfigPermissionBashStringAllow ConfigPermissionBashString = "allow"
	ConfigPermissionBashStringDeny  ConfigPermissionBashString = "deny"
)

func (ConfigPermissionBashString) IsKnown

func (r ConfigPermissionBashString) IsKnown() bool

type ConfigPermissionBashUnion

type ConfigPermissionBashUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by ConfigPermissionBashString or ConfigPermissionBashMap.

type ConfigPermissionEdit

type ConfigPermissionEdit string
const (
	ConfigPermissionEditAsk   ConfigPermissionEdit = "ask"
	ConfigPermissionEditAllow ConfigPermissionEdit = "allow"
	ConfigPermissionEditDeny  ConfigPermissionEdit = "deny"
)

func (ConfigPermissionEdit) IsKnown

func (r ConfigPermissionEdit) IsKnown() bool

type ConfigPermissionWebfetch

type ConfigPermissionWebfetch string
const (
	ConfigPermissionWebfetchAsk   ConfigPermissionWebfetch = "ask"
	ConfigPermissionWebfetchAllow ConfigPermissionWebfetch = "allow"
	ConfigPermissionWebfetchDeny  ConfigPermissionWebfetch = "deny"
)

func (ConfigPermissionWebfetch) IsKnown

func (r ConfigPermissionWebfetch) IsKnown() bool

type ConfigProvider

type ConfigProvider struct {
	ID      string                         `json:"id"`
	API     string                         `json:"api"`
	Env     []string                       `json:"env"`
	Models  map[string]ConfigProviderModel `json:"models"`
	Name    string                         `json:"name"`
	Npm     string                         `json:"npm"`
	Options ConfigProviderOptions          `json:"options"`
	JSON    configProviderJSON             `json:"-"`
}

func (*ConfigProvider) UnmarshalJSON

func (r *ConfigProvider) UnmarshalJSON(data []byte) (err error)

type ConfigProviderModel

type ConfigProviderModel struct {
	ID           string                       `json:"id"`
	Attachment   bool                         `json:"attachment"`
	Cost         ConfigProviderModelsCost     `json:"cost"`
	Experimental bool                         `json:"experimental"`
	Limit        ConfigProviderModelsLimit    `json:"limit"`
	Name         string                       `json:"name"`
	Options      map[string]interface{}       `json:"options"`
	Provider     ConfigProviderModelsProvider `json:"provider"`
	Reasoning    bool                         `json:"reasoning"`
	ReleaseDate  string                       `json:"release_date"`
	Temperature  bool                         `json:"temperature"`
	ToolCall     bool                         `json:"tool_call"`
	JSON         configProviderModelJSON      `json:"-"`
}

func (*ConfigProviderModel) UnmarshalJSON

func (r *ConfigProviderModel) UnmarshalJSON(data []byte) (err error)

type ConfigProviderModelsCost

type ConfigProviderModelsCost struct {
	Input      float64                      `json:"input,required"`
	Output     float64                      `json:"output,required"`
	CacheRead  float64                      `json:"cache_read"`
	CacheWrite float64                      `json:"cache_write"`
	JSON       configProviderModelsCostJSON `json:"-"`
}

func (*ConfigProviderModelsCost) UnmarshalJSON

func (r *ConfigProviderModelsCost) UnmarshalJSON(data []byte) (err error)

type ConfigProviderModelsLimit

type ConfigProviderModelsLimit struct {
	Context float64                       `json:"context,required"`
	Output  float64                       `json:"output,required"`
	JSON    configProviderModelsLimitJSON `json:"-"`
}

func (*ConfigProviderModelsLimit) UnmarshalJSON

func (r *ConfigProviderModelsLimit) UnmarshalJSON(data []byte) (err error)

type ConfigProviderModelsProvider added in v0.12.0

type ConfigProviderModelsProvider struct {
	Npm  string                           `json:"npm,required"`
	JSON configProviderModelsProviderJSON `json:"-"`
}

func (*ConfigProviderModelsProvider) UnmarshalJSON added in v0.12.0

func (r *ConfigProviderModelsProvider) UnmarshalJSON(data []byte) (err error)

type ConfigProviderOptions

type ConfigProviderOptions struct {
	APIKey  string `json:"apiKey"`
	BaseURL string `json:"baseURL"`
	// Timeout in milliseconds for requests to this provider. Default is 300000 (5
	// minutes). Set to false to disable timeout.
	Timeout     ConfigProviderOptionsTimeoutUnion `json:"timeout"`
	ExtraFields map[string]interface{}            `json:"-,extras"`
	JSON        configProviderOptionsJSON         `json:"-"`
}

func (*ConfigProviderOptions) UnmarshalJSON

func (r *ConfigProviderOptions) UnmarshalJSON(data []byte) (err error)

type ConfigProviderOptionsTimeoutUnion added in v0.7.0

type ConfigProviderOptionsTimeoutUnion interface {
	ImplementsConfigProviderOptionsTimeoutUnion()
}

Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.

Union satisfied by shared.UnionInt or shared.UnionBool.

type ConfigService

type ConfigService struct {
	Options []option.RequestOption
}

ConfigService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewConfigService method instead.

func NewConfigService

func NewConfigService(opts ...option.RequestOption) (r *ConfigService)

NewConfigService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ConfigService) Get

func (r *ConfigService) Get(ctx context.Context, query ConfigGetParams, opts ...option.RequestOption) (res *Config, err error)

Get config info

type ConfigShare

type ConfigShare string

Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing

const (
	ConfigShareManual   ConfigShare = "manual"
	ConfigShareAuto     ConfigShare = "auto"
	ConfigShareDisabled ConfigShare = "disabled"
)

func (ConfigShare) IsKnown

func (r ConfigShare) IsKnown() bool

type ConfigTui

type ConfigTui struct {
	// TUI scroll speed
	ScrollSpeed float64       `json:"scroll_speed"`
	JSON        configTuiJSON `json:"-"`
}

TUI specific settings

func (*ConfigTui) UnmarshalJSON

func (r *ConfigTui) UnmarshalJSON(data []byte) (err error)

type ConfigWatcher added in v0.16.0

type ConfigWatcher struct {
	Ignore []string          `json:"ignore"`
	JSON   configWatcherJSON `json:"-"`
}

func (*ConfigWatcher) UnmarshalJSON added in v0.16.0

func (r *ConfigWatcher) UnmarshalJSON(data []byte) (err error)

type Error

type Error = apierror.Error

type EventListParams added in v0.5.0

type EventListParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (EventListParams) URLQuery added in v0.5.0

func (r EventListParams) URLQuery() (v url.Values)

URLQuery serializes EventListParams's query parameters as `url.Values`.

type EventListResponse

type EventListResponse struct {
	// This field can have the runtime type of
	// [EventListResponseEventInstallationUpdatedProperties],
	// [EventListResponseEventLspClientDiagnosticsProperties],
	// [EventListResponseEventMessageUpdatedProperties],
	// [EventListResponseEventMessageRemovedProperties],
	// [EventListResponseEventMessagePartUpdatedProperties],
	// [EventListResponseEventMessagePartRemovedProperties],
	// [EventListResponseEventSessionCompactedProperties], [Permission],
	// [EventListResponseEventPermissionRepliedProperties],
	// [EventListResponseEventFileEditedProperties],
	// [EventListResponseEventSessionIdleProperties],
	// [EventListResponseEventSessionUpdatedProperties],
	// [EventListResponseEventSessionDeletedProperties],
	// [EventListResponseEventSessionErrorProperties], [interface{}],
	// [EventListResponseEventFileWatcherUpdatedProperties],
	// [EventListResponseEventIdeInstalledProperties].
	Properties interface{}           `json:"properties,required"`
	Type       EventListResponseType `json:"type,required"`
	JSON       eventListResponseJSON `json:"-"`
	// contains filtered or unexported fields
}

func (*EventListResponse) UnmarshalJSON

func (r *EventListResponse) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventFileEdited

type EventListResponseEventFileEdited struct {
	Properties EventListResponseEventFileEditedProperties `json:"properties,required"`
	Type       EventListResponseEventFileEditedType       `json:"type,required"`
	JSON       eventListResponseEventFileEditedJSON       `json:"-"`
}

func (*EventListResponseEventFileEdited) UnmarshalJSON

func (r *EventListResponseEventFileEdited) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventFileEditedProperties

type EventListResponseEventFileEditedProperties struct {
	File string                                         `json:"file,required"`
	JSON eventListResponseEventFileEditedPropertiesJSON `json:"-"`
}

func (*EventListResponseEventFileEditedProperties) UnmarshalJSON

func (r *EventListResponseEventFileEditedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventFileEditedType

type EventListResponseEventFileEditedType string
const (
	EventListResponseEventFileEditedTypeFileEdited EventListResponseEventFileEditedType = "file.edited"
)

func (EventListResponseEventFileEditedType) IsKnown

type EventListResponseEventFileWatcherUpdated added in v0.16.0

type EventListResponseEventFileWatcherUpdated struct {
	Properties EventListResponseEventFileWatcherUpdatedProperties `json:"properties,required"`
	Type       EventListResponseEventFileWatcherUpdatedType       `json:"type,required"`
	JSON       eventListResponseEventFileWatcherUpdatedJSON       `json:"-"`
}

func (*EventListResponseEventFileWatcherUpdated) UnmarshalJSON added in v0.16.0

func (r *EventListResponseEventFileWatcherUpdated) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventFileWatcherUpdatedProperties added in v0.16.0

type EventListResponseEventFileWatcherUpdatedProperties struct {
	Event EventListResponseEventFileWatcherUpdatedPropertiesEvent `json:"event,required"`
	File  string                                                  `json:"file,required"`
	JSON  eventListResponseEventFileWatcherUpdatedPropertiesJSON  `json:"-"`
}

func (*EventListResponseEventFileWatcherUpdatedProperties) UnmarshalJSON added in v0.16.0

func (r *EventListResponseEventFileWatcherUpdatedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventFileWatcherUpdatedPropertiesEvent added in v0.16.0

type EventListResponseEventFileWatcherUpdatedPropertiesEvent string
const (
	EventListResponseEventFileWatcherUpdatedPropertiesEventAdd    EventListResponseEventFileWatcherUpdatedPropertiesEvent = "add"
	EventListResponseEventFileWatcherUpdatedPropertiesEventChange EventListResponseEventFileWatcherUpdatedPropertiesEvent = "change"
	EventListResponseEventFileWatcherUpdatedPropertiesEventUnlink EventListResponseEventFileWatcherUpdatedPropertiesEvent = "unlink"
)

func (EventListResponseEventFileWatcherUpdatedPropertiesEvent) IsKnown added in v0.16.0

type EventListResponseEventFileWatcherUpdatedType added in v0.16.0

type EventListResponseEventFileWatcherUpdatedType string
const (
	EventListResponseEventFileWatcherUpdatedTypeFileWatcherUpdated EventListResponseEventFileWatcherUpdatedType = "file.watcher.updated"
)

func (EventListResponseEventFileWatcherUpdatedType) IsKnown added in v0.16.0

type EventListResponseEventIdeInstalled added in v0.16.0

type EventListResponseEventIdeInstalled struct {
	Properties EventListResponseEventIdeInstalledProperties `json:"properties,required"`
	Type       EventListResponseEventIdeInstalledType       `json:"type,required"`
	JSON       eventListResponseEventIdeInstalledJSON       `json:"-"`
}

func (*EventListResponseEventIdeInstalled) UnmarshalJSON added in v0.16.0

func (r *EventListResponseEventIdeInstalled) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventIdeInstalledProperties added in v0.16.0

type EventListResponseEventIdeInstalledProperties struct {
	Ide  string                                           `json:"ide,required"`
	JSON eventListResponseEventIdeInstalledPropertiesJSON `json:"-"`
}

func (*EventListResponseEventIdeInstalledProperties) UnmarshalJSON added in v0.16.0

func (r *EventListResponseEventIdeInstalledProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventIdeInstalledType added in v0.16.0

type EventListResponseEventIdeInstalledType string
const (
	EventListResponseEventIdeInstalledTypeIdeInstalled EventListResponseEventIdeInstalledType = "ide.installed"
)

func (EventListResponseEventIdeInstalledType) IsKnown added in v0.16.0

type EventListResponseEventInstallationUpdated

type EventListResponseEventInstallationUpdated struct {
	Properties EventListResponseEventInstallationUpdatedProperties `json:"properties,required"`
	Type       EventListResponseEventInstallationUpdatedType       `json:"type,required"`
	JSON       eventListResponseEventInstallationUpdatedJSON       `json:"-"`
}

func (*EventListResponseEventInstallationUpdated) UnmarshalJSON

func (r *EventListResponseEventInstallationUpdated) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventInstallationUpdatedProperties

type EventListResponseEventInstallationUpdatedProperties struct {
	Version string                                                  `json:"version,required"`
	JSON    eventListResponseEventInstallationUpdatedPropertiesJSON `json:"-"`
}

func (*EventListResponseEventInstallationUpdatedProperties) UnmarshalJSON

func (r *EventListResponseEventInstallationUpdatedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventInstallationUpdatedType

type EventListResponseEventInstallationUpdatedType string
const (
	EventListResponseEventInstallationUpdatedTypeInstallationUpdated EventListResponseEventInstallationUpdatedType = "installation.updated"
)

func (EventListResponseEventInstallationUpdatedType) IsKnown

type EventListResponseEventLspClientDiagnostics

type EventListResponseEventLspClientDiagnostics struct {
	Properties EventListResponseEventLspClientDiagnosticsProperties `json:"properties,required"`
	Type       EventListResponseEventLspClientDiagnosticsType       `json:"type,required"`
	JSON       eventListResponseEventLspClientDiagnosticsJSON       `json:"-"`
}

func (*EventListResponseEventLspClientDiagnostics) UnmarshalJSON

func (r *EventListResponseEventLspClientDiagnostics) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventLspClientDiagnosticsProperties

type EventListResponseEventLspClientDiagnosticsProperties struct {
	Path     string                                                   `json:"path,required"`
	ServerID string                                                   `json:"serverID,required"`
	JSON     eventListResponseEventLspClientDiagnosticsPropertiesJSON `json:"-"`
}

func (*EventListResponseEventLspClientDiagnosticsProperties) UnmarshalJSON

func (r *EventListResponseEventLspClientDiagnosticsProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventLspClientDiagnosticsType

type EventListResponseEventLspClientDiagnosticsType string
const (
	EventListResponseEventLspClientDiagnosticsTypeLspClientDiagnostics EventListResponseEventLspClientDiagnosticsType = "lsp.client.diagnostics"
)

func (EventListResponseEventLspClientDiagnosticsType) IsKnown

type EventListResponseEventMessagePartRemoved

type EventListResponseEventMessagePartRemoved struct {
	Properties EventListResponseEventMessagePartRemovedProperties `json:"properties,required"`
	Type       EventListResponseEventMessagePartRemovedType       `json:"type,required"`
	JSON       eventListResponseEventMessagePartRemovedJSON       `json:"-"`
}

func (*EventListResponseEventMessagePartRemoved) UnmarshalJSON

func (r *EventListResponseEventMessagePartRemoved) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventMessagePartRemovedProperties

type EventListResponseEventMessagePartRemovedProperties struct {
	MessageID string                                                 `json:"messageID,required"`
	PartID    string                                                 `json:"partID,required"`
	SessionID string                                                 `json:"sessionID,required"`
	JSON      eventListResponseEventMessagePartRemovedPropertiesJSON `json:"-"`
}

func (*EventListResponseEventMessagePartRemovedProperties) UnmarshalJSON

func (r *EventListResponseEventMessagePartRemovedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventMessagePartRemovedType

type EventListResponseEventMessagePartRemovedType string
const (
	EventListResponseEventMessagePartRemovedTypeMessagePartRemoved EventListResponseEventMessagePartRemovedType = "message.part.removed"
)

func (EventListResponseEventMessagePartRemovedType) IsKnown

type EventListResponseEventMessagePartUpdated

type EventListResponseEventMessagePartUpdated struct {
	Properties EventListResponseEventMessagePartUpdatedProperties `json:"properties,required"`
	Type       EventListResponseEventMessagePartUpdatedType       `json:"type,required"`
	JSON       eventListResponseEventMessagePartUpdatedJSON       `json:"-"`
}

func (*EventListResponseEventMessagePartUpdated) UnmarshalJSON

func (r *EventListResponseEventMessagePartUpdated) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventMessagePartUpdatedProperties

type EventListResponseEventMessagePartUpdatedProperties struct {
	Part Part                                                   `json:"part,required"`
	JSON eventListResponseEventMessagePartUpdatedPropertiesJSON `json:"-"`
}

func (*EventListResponseEventMessagePartUpdatedProperties) UnmarshalJSON

func (r *EventListResponseEventMessagePartUpdatedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventMessagePartUpdatedType

type EventListResponseEventMessagePartUpdatedType string
const (
	EventListResponseEventMessagePartUpdatedTypeMessagePartUpdated EventListResponseEventMessagePartUpdatedType = "message.part.updated"
)

func (EventListResponseEventMessagePartUpdatedType) IsKnown

type EventListResponseEventMessageRemoved

type EventListResponseEventMessageRemoved struct {
	Properties EventListResponseEventMessageRemovedProperties `json:"properties,required"`
	Type       EventListResponseEventMessageRemovedType       `json:"type,required"`
	JSON       eventListResponseEventMessageRemovedJSON       `json:"-"`
}

func (*EventListResponseEventMessageRemoved) UnmarshalJSON

func (r *EventListResponseEventMessageRemoved) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventMessageRemovedProperties

type EventListResponseEventMessageRemovedProperties struct {
	MessageID string                                             `json:"messageID,required"`
	SessionID string                                             `json:"sessionID,required"`
	JSON      eventListResponseEventMessageRemovedPropertiesJSON `json:"-"`
}

func (*EventListResponseEventMessageRemovedProperties) UnmarshalJSON

func (r *EventListResponseEventMessageRemovedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventMessageRemovedType

type EventListResponseEventMessageRemovedType string
const (
	EventListResponseEventMessageRemovedTypeMessageRemoved EventListResponseEventMessageRemovedType = "message.removed"
)

func (EventListResponseEventMessageRemovedType) IsKnown

type EventListResponseEventMessageUpdated

type EventListResponseEventMessageUpdated struct {
	Properties EventListResponseEventMessageUpdatedProperties `json:"properties,required"`
	Type       EventListResponseEventMessageUpdatedType       `json:"type,required"`
	JSON       eventListResponseEventMessageUpdatedJSON       `json:"-"`
}

func (*EventListResponseEventMessageUpdated) UnmarshalJSON

func (r *EventListResponseEventMessageUpdated) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventMessageUpdatedProperties

type EventListResponseEventMessageUpdatedProperties struct {
	Info Message                                            `json:"info,required"`
	JSON eventListResponseEventMessageUpdatedPropertiesJSON `json:"-"`
}

func (*EventListResponseEventMessageUpdatedProperties) UnmarshalJSON

func (r *EventListResponseEventMessageUpdatedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventMessageUpdatedType

type EventListResponseEventMessageUpdatedType string
const (
	EventListResponseEventMessageUpdatedTypeMessageUpdated EventListResponseEventMessageUpdatedType = "message.updated"
)

func (EventListResponseEventMessageUpdatedType) IsKnown

type EventListResponseEventPermissionReplied

type EventListResponseEventPermissionReplied struct {
	Properties EventListResponseEventPermissionRepliedProperties `json:"properties,required"`
	Type       EventListResponseEventPermissionRepliedType       `json:"type,required"`
	JSON       eventListResponseEventPermissionRepliedJSON       `json:"-"`
}

func (*EventListResponseEventPermissionReplied) UnmarshalJSON

func (r *EventListResponseEventPermissionReplied) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventPermissionRepliedProperties

type EventListResponseEventPermissionRepliedProperties struct {
	PermissionID string                                                `json:"permissionID,required"`
	Response     string                                                `json:"response,required"`
	SessionID    string                                                `json:"sessionID,required"`
	JSON         eventListResponseEventPermissionRepliedPropertiesJSON `json:"-"`
}

func (*EventListResponseEventPermissionRepliedProperties) UnmarshalJSON

func (r *EventListResponseEventPermissionRepliedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventPermissionRepliedType

type EventListResponseEventPermissionRepliedType string
const (
	EventListResponseEventPermissionRepliedTypePermissionReplied EventListResponseEventPermissionRepliedType = "permission.replied"
)

func (EventListResponseEventPermissionRepliedType) IsKnown

type EventListResponseEventPermissionUpdated

type EventListResponseEventPermissionUpdated struct {
	Properties Permission                                  `json:"properties,required"`
	Type       EventListResponseEventPermissionUpdatedType `json:"type,required"`
	JSON       eventListResponseEventPermissionUpdatedJSON `json:"-"`
}

func (*EventListResponseEventPermissionUpdated) UnmarshalJSON

func (r *EventListResponseEventPermissionUpdated) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventPermissionUpdatedType

type EventListResponseEventPermissionUpdatedType string
const (
	EventListResponseEventPermissionUpdatedTypePermissionUpdated EventListResponseEventPermissionUpdatedType = "permission.updated"
)

func (EventListResponseEventPermissionUpdatedType) IsKnown

type EventListResponseEventServerConnected

type EventListResponseEventServerConnected struct {
	Properties interface{}                               `json:"properties,required"`
	Type       EventListResponseEventServerConnectedType `json:"type,required"`
	JSON       eventListResponseEventServerConnectedJSON `json:"-"`
}

func (*EventListResponseEventServerConnected) UnmarshalJSON

func (r *EventListResponseEventServerConnected) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventServerConnectedType

type EventListResponseEventServerConnectedType string
const (
	EventListResponseEventServerConnectedTypeServerConnected EventListResponseEventServerConnectedType = "server.connected"
)

func (EventListResponseEventServerConnectedType) IsKnown

type EventListResponseEventSessionCompacted added in v0.12.0

type EventListResponseEventSessionCompacted struct {
	Properties EventListResponseEventSessionCompactedProperties `json:"properties,required"`
	Type       EventListResponseEventSessionCompactedType       `json:"type,required"`
	JSON       eventListResponseEventSessionCompactedJSON       `json:"-"`
}

func (*EventListResponseEventSessionCompacted) UnmarshalJSON added in v0.12.0

func (r *EventListResponseEventSessionCompacted) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionCompactedProperties added in v0.12.0

type EventListResponseEventSessionCompactedProperties struct {
	SessionID string                                               `json:"sessionID,required"`
	JSON      eventListResponseEventSessionCompactedPropertiesJSON `json:"-"`
}

func (*EventListResponseEventSessionCompactedProperties) UnmarshalJSON added in v0.12.0

func (r *EventListResponseEventSessionCompactedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionCompactedType added in v0.12.0

type EventListResponseEventSessionCompactedType string
const (
	EventListResponseEventSessionCompactedTypeSessionCompacted EventListResponseEventSessionCompactedType = "session.compacted"
)

func (EventListResponseEventSessionCompactedType) IsKnown added in v0.12.0

type EventListResponseEventSessionDeleted

type EventListResponseEventSessionDeleted struct {
	Properties EventListResponseEventSessionDeletedProperties `json:"properties,required"`
	Type       EventListResponseEventSessionDeletedType       `json:"type,required"`
	JSON       eventListResponseEventSessionDeletedJSON       `json:"-"`
}

func (*EventListResponseEventSessionDeleted) UnmarshalJSON

func (r *EventListResponseEventSessionDeleted) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionDeletedProperties

type EventListResponseEventSessionDeletedProperties struct {
	Info Session                                            `json:"info,required"`
	JSON eventListResponseEventSessionDeletedPropertiesJSON `json:"-"`
}

func (*EventListResponseEventSessionDeletedProperties) UnmarshalJSON

func (r *EventListResponseEventSessionDeletedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionDeletedType

type EventListResponseEventSessionDeletedType string
const (
	EventListResponseEventSessionDeletedTypeSessionDeleted EventListResponseEventSessionDeletedType = "session.deleted"
)

func (EventListResponseEventSessionDeletedType) IsKnown

type EventListResponseEventSessionError

type EventListResponseEventSessionError struct {
	Properties EventListResponseEventSessionErrorProperties `json:"properties,required"`
	Type       EventListResponseEventSessionErrorType       `json:"type,required"`
	JSON       eventListResponseEventSessionErrorJSON       `json:"-"`
}

func (*EventListResponseEventSessionError) UnmarshalJSON

func (r *EventListResponseEventSessionError) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionErrorProperties

type EventListResponseEventSessionErrorProperties struct {
	Error     EventListResponseEventSessionErrorPropertiesError `json:"error"`
	SessionID string                                            `json:"sessionID"`
	JSON      eventListResponseEventSessionErrorPropertiesJSON  `json:"-"`
}

func (*EventListResponseEventSessionErrorProperties) UnmarshalJSON

func (r *EventListResponseEventSessionErrorProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionErrorPropertiesError

type EventListResponseEventSessionErrorPropertiesError struct {
	// This field can have the runtime type of [shared.ProviderAuthErrorData],
	// [shared.UnknownErrorData], [interface{}], [shared.MessageAbortedErrorData].
	Data interface{}                                           `json:"data,required"`
	Name EventListResponseEventSessionErrorPropertiesErrorName `json:"name,required"`
	JSON eventListResponseEventSessionErrorPropertiesErrorJSON `json:"-"`
	// contains filtered or unexported fields
}

func (EventListResponseEventSessionErrorPropertiesError) AsUnion

AsUnion returns a EventListResponseEventSessionErrorPropertiesErrorUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are shared.ProviderAuthError, shared.UnknownError, EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError, shared.MessageAbortedError.

func (*EventListResponseEventSessionErrorPropertiesError) UnmarshalJSON

func (r *EventListResponseEventSessionErrorPropertiesError) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError

type EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError struct {
	Data interface{}                                                                   `json:"data,required"`
	Name EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthErrorName `json:"name,required"`
	JSON eventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthErrorJSON `json:"-"`
}

func (EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError) ImplementsEventListResponseEventSessionErrorPropertiesError

func (r EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError) ImplementsEventListResponseEventSessionErrorPropertiesError()

func (*EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError) UnmarshalJSON

type EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthErrorName

type EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthErrorName string
const (
	EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthErrorNameMessageOutputLengthError EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthErrorName = "MessageOutputLengthError"
)

func (EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthErrorName) IsKnown

type EventListResponseEventSessionErrorPropertiesErrorName

type EventListResponseEventSessionErrorPropertiesErrorName string
const (
	EventListResponseEventSessionErrorPropertiesErrorNameProviderAuthError        EventListResponseEventSessionErrorPropertiesErrorName = "ProviderAuthError"
	EventListResponseEventSessionErrorPropertiesErrorNameUnknownError             EventListResponseEventSessionErrorPropertiesErrorName = "UnknownError"
	EventListResponseEventSessionErrorPropertiesErrorNameMessageOutputLengthError EventListResponseEventSessionErrorPropertiesErrorName = "MessageOutputLengthError"
	EventListResponseEventSessionErrorPropertiesErrorNameMessageAbortedError      EventListResponseEventSessionErrorPropertiesErrorName = "MessageAbortedError"
)

func (EventListResponseEventSessionErrorPropertiesErrorName) IsKnown

type EventListResponseEventSessionErrorPropertiesErrorUnion

type EventListResponseEventSessionErrorPropertiesErrorUnion interface {
	ImplementsEventListResponseEventSessionErrorPropertiesError()
}

Union satisfied by shared.ProviderAuthError, shared.UnknownError, EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError or shared.MessageAbortedError.

type EventListResponseEventSessionErrorType

type EventListResponseEventSessionErrorType string
const (
	EventListResponseEventSessionErrorTypeSessionError EventListResponseEventSessionErrorType = "session.error"
)

func (EventListResponseEventSessionErrorType) IsKnown

type EventListResponseEventSessionIdle

type EventListResponseEventSessionIdle struct {
	Properties EventListResponseEventSessionIdleProperties `json:"properties,required"`
	Type       EventListResponseEventSessionIdleType       `json:"type,required"`
	JSON       eventListResponseEventSessionIdleJSON       `json:"-"`
}

func (*EventListResponseEventSessionIdle) UnmarshalJSON

func (r *EventListResponseEventSessionIdle) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionIdleProperties

type EventListResponseEventSessionIdleProperties struct {
	SessionID string                                          `json:"sessionID,required"`
	JSON      eventListResponseEventSessionIdlePropertiesJSON `json:"-"`
}

func (*EventListResponseEventSessionIdleProperties) UnmarshalJSON

func (r *EventListResponseEventSessionIdleProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionIdleType

type EventListResponseEventSessionIdleType string
const (
	EventListResponseEventSessionIdleTypeSessionIdle EventListResponseEventSessionIdleType = "session.idle"
)

func (EventListResponseEventSessionIdleType) IsKnown

type EventListResponseEventSessionUpdated

type EventListResponseEventSessionUpdated struct {
	Properties EventListResponseEventSessionUpdatedProperties `json:"properties,required"`
	Type       EventListResponseEventSessionUpdatedType       `json:"type,required"`
	JSON       eventListResponseEventSessionUpdatedJSON       `json:"-"`
}

func (*EventListResponseEventSessionUpdated) UnmarshalJSON

func (r *EventListResponseEventSessionUpdated) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionUpdatedProperties

type EventListResponseEventSessionUpdatedProperties struct {
	Info Session                                            `json:"info,required"`
	JSON eventListResponseEventSessionUpdatedPropertiesJSON `json:"-"`
}

func (*EventListResponseEventSessionUpdatedProperties) UnmarshalJSON

func (r *EventListResponseEventSessionUpdatedProperties) UnmarshalJSON(data []byte) (err error)

type EventListResponseEventSessionUpdatedType

type EventListResponseEventSessionUpdatedType string
const (
	EventListResponseEventSessionUpdatedTypeSessionUpdated EventListResponseEventSessionUpdatedType = "session.updated"
)

func (EventListResponseEventSessionUpdatedType) IsKnown

type EventListResponseType

type EventListResponseType string
const (
	EventListResponseTypeInstallationUpdated  EventListResponseType = "installation.updated"
	EventListResponseTypeLspClientDiagnostics EventListResponseType = "lsp.client.diagnostics"
	EventListResponseTypeMessageUpdated       EventListResponseType = "message.updated"
	EventListResponseTypeMessageRemoved       EventListResponseType = "message.removed"
	EventListResponseTypeMessagePartUpdated   EventListResponseType = "message.part.updated"
	EventListResponseTypeMessagePartRemoved   EventListResponseType = "message.part.removed"
	EventListResponseTypeSessionCompacted     EventListResponseType = "session.compacted"
	EventListResponseTypePermissionUpdated    EventListResponseType = "permission.updated"
	EventListResponseTypePermissionReplied    EventListResponseType = "permission.replied"
	EventListResponseTypeFileEdited           EventListResponseType = "file.edited"
	EventListResponseTypeSessionIdle          EventListResponseType = "session.idle"
	EventListResponseTypeSessionUpdated       EventListResponseType = "session.updated"
	EventListResponseTypeSessionDeleted       EventListResponseType = "session.deleted"
	EventListResponseTypeSessionError         EventListResponseType = "session.error"
	EventListResponseTypeServerConnected      EventListResponseType = "server.connected"
	EventListResponseTypeFileWatcherUpdated   EventListResponseType = "file.watcher.updated"
	EventListResponseTypeIdeInstalled         EventListResponseType = "ide.installed"
)

func (EventListResponseType) IsKnown

func (r EventListResponseType) IsKnown() bool

type EventService

type EventService struct {
	Options []option.RequestOption
}

EventService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEventService method instead.

func NewEventService

func NewEventService(opts ...option.RequestOption) (r *EventService)

NewEventService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EventService) ListStreaming

func (r *EventService) ListStreaming(ctx context.Context, query EventListParams, opts ...option.RequestOption) (stream *ssestream.Stream[EventListResponse])

Get events

type File

type File struct {
	Added   int64      `json:"added,required"`
	Path    string     `json:"path,required"`
	Removed int64      `json:"removed,required"`
	Status  FileStatus `json:"status,required"`
	JSON    fileJSON   `json:"-"`
}

func (*File) UnmarshalJSON

func (r *File) UnmarshalJSON(data []byte) (err error)

type FileListParams

type FileListParams struct {
	Path      param.Field[string] `query:"path,required"`
	Directory param.Field[string] `query:"directory"`
}

func (FileListParams) URLQuery

func (r FileListParams) URLQuery() (v url.Values)

URLQuery serializes FileListParams's query parameters as `url.Values`.

type FileNode

type FileNode struct {
	Absolute string       `json:"absolute,required"`
	Ignored  bool         `json:"ignored,required"`
	Name     string       `json:"name,required"`
	Path     string       `json:"path,required"`
	Type     FileNodeType `json:"type,required"`
	JSON     fileNodeJSON `json:"-"`
}

func (*FileNode) UnmarshalJSON

func (r *FileNode) UnmarshalJSON(data []byte) (err error)

type FileNodeType

type FileNodeType string
const (
	FileNodeTypeFile      FileNodeType = "file"
	FileNodeTypeDirectory FileNodeType = "directory"
)

func (FileNodeType) IsKnown

func (r FileNodeType) IsKnown() bool

type FilePart

type FilePart struct {
	ID        string         `json:"id,required"`
	MessageID string         `json:"messageID,required"`
	Mime      string         `json:"mime,required"`
	SessionID string         `json:"sessionID,required"`
	Type      FilePartType   `json:"type,required"`
	URL       string         `json:"url,required"`
	Filename  string         `json:"filename"`
	Source    FilePartSource `json:"source"`
	JSON      filePartJSON   `json:"-"`
}

func (*FilePart) UnmarshalJSON

func (r *FilePart) UnmarshalJSON(data []byte) (err error)

type FilePartInputParam

type FilePartInputParam struct {
	Mime     param.Field[string]                   `json:"mime,required"`
	Type     param.Field[FilePartInputType]        `json:"type,required"`
	URL      param.Field[string]                   `json:"url,required"`
	ID       param.Field[string]                   `json:"id"`
	Filename param.Field[string]                   `json:"filename"`
	Source   param.Field[FilePartSourceUnionParam] `json:"source"`
}

func (FilePartInputParam) MarshalJSON

func (r FilePartInputParam) MarshalJSON() (data []byte, err error)

type FilePartInputType

type FilePartInputType string
const (
	FilePartInputTypeFile FilePartInputType = "file"
)

func (FilePartInputType) IsKnown

func (r FilePartInputType) IsKnown() bool

type FilePartSource

type FilePartSource struct {
	Path string             `json:"path,required"`
	Text FilePartSourceText `json:"text,required"`
	Type FilePartSourceType `json:"type,required"`
	Kind int64              `json:"kind"`
	Name string             `json:"name"`
	// This field can have the runtime type of [SymbolSourceRange].
	Range interface{}        `json:"range"`
	JSON  filePartSourceJSON `json:"-"`
	// contains filtered or unexported fields
}

func (FilePartSource) AsUnion

func (r FilePartSource) AsUnion() FilePartSourceUnion

AsUnion returns a FilePartSourceUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are FileSource, SymbolSource.

func (*FilePartSource) UnmarshalJSON

func (r *FilePartSource) UnmarshalJSON(data []byte) (err error)

type FilePartSourceParam

type FilePartSourceParam struct {
	Path  param.Field[string]                  `json:"path,required"`
	Text  param.Field[FilePartSourceTextParam] `json:"text,required"`
	Type  param.Field[FilePartSourceType]      `json:"type,required"`
	Kind  param.Field[int64]                   `json:"kind"`
	Name  param.Field[string]                  `json:"name"`
	Range param.Field[interface{}]             `json:"range"`
}

func (FilePartSourceParam) MarshalJSON

func (r FilePartSourceParam) MarshalJSON() (data []byte, err error)

type FilePartSourceText

type FilePartSourceText struct {
	End   int64                  `json:"end,required"`
	Start int64                  `json:"start,required"`
	Value string                 `json:"value,required"`
	JSON  filePartSourceTextJSON `json:"-"`
}

func (*FilePartSourceText) UnmarshalJSON

func (r *FilePartSourceText) UnmarshalJSON(data []byte) (err error)

type FilePartSourceTextParam

type FilePartSourceTextParam struct {
	End   param.Field[int64]  `json:"end,required"`
	Start param.Field[int64]  `json:"start,required"`
	Value param.Field[string] `json:"value,required"`
}

func (FilePartSourceTextParam) MarshalJSON

func (r FilePartSourceTextParam) MarshalJSON() (data []byte, err error)

type FilePartSourceType

type FilePartSourceType string
const (
	FilePartSourceTypeFile   FilePartSourceType = "file"
	FilePartSourceTypeSymbol FilePartSourceType = "symbol"
)

func (FilePartSourceType) IsKnown

func (r FilePartSourceType) IsKnown() bool

type FilePartSourceUnion

type FilePartSourceUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by FileSource or SymbolSource.

type FilePartSourceUnionParam

type FilePartSourceUnionParam interface {
	// contains filtered or unexported methods
}

Satisfied by FileSourceParam, SymbolSourceParam, FilePartSourceParam.

type FilePartType

type FilePartType string
const (
	FilePartTypeFile FilePartType = "file"
)

func (FilePartType) IsKnown

func (r FilePartType) IsKnown() bool

type FileReadParams

type FileReadParams struct {
	Path      param.Field[string] `query:"path,required"`
	Directory param.Field[string] `query:"directory"`
}

func (FileReadParams) URLQuery

func (r FileReadParams) URLQuery() (v url.Values)

URLQuery serializes FileReadParams's query parameters as `url.Values`.

type FileReadResponse

type FileReadResponse struct {
	Content string                `json:"content,required"`
	Diff    string                `json:"diff"`
	Patch   FileReadResponsePatch `json:"patch"`
	JSON    fileReadResponseJSON  `json:"-"`
}

func (*FileReadResponse) UnmarshalJSON

func (r *FileReadResponse) UnmarshalJSON(data []byte) (err error)

type FileReadResponsePatch added in v0.12.0

type FileReadResponsePatch struct {
	Hunks       []FileReadResponsePatchHunk `json:"hunks,required"`
	NewFileName string                      `json:"newFileName,required"`
	OldFileName string                      `json:"oldFileName,required"`
	Index       string                      `json:"index"`
	NewHeader   string                      `json:"newHeader"`
	OldHeader   string                      `json:"oldHeader"`
	JSON        fileReadResponsePatchJSON   `json:"-"`
}

func (*FileReadResponsePatch) UnmarshalJSON added in v0.12.0

func (r *FileReadResponsePatch) UnmarshalJSON(data []byte) (err error)

type FileReadResponsePatchHunk added in v0.12.0

type FileReadResponsePatchHunk struct {
	Lines    []string                      `json:"lines,required"`
	NewLines float64                       `json:"newLines,required"`
	NewStart float64                       `json:"newStart,required"`
	OldLines float64                       `json:"oldLines,required"`
	OldStart float64                       `json:"oldStart,required"`
	JSON     fileReadResponsePatchHunkJSON `json:"-"`
}

func (*FileReadResponsePatchHunk) UnmarshalJSON added in v0.12.0

func (r *FileReadResponsePatchHunk) UnmarshalJSON(data []byte) (err error)

type FileService

type FileService struct {
	Options []option.RequestOption
}

FileService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFileService method instead.

func NewFileService

func NewFileService(opts ...option.RequestOption) (r *FileService)

NewFileService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FileService) List

func (r *FileService) List(ctx context.Context, query FileListParams, opts ...option.RequestOption) (res *[]FileNode, err error)

List files and directories

func (*FileService) Read

func (r *FileService) Read(ctx context.Context, query FileReadParams, opts ...option.RequestOption) (res *FileReadResponse, err error)

Read a file

func (*FileService) Status

func (r *FileService) Status(ctx context.Context, query FileStatusParams, opts ...option.RequestOption) (res *[]File, err error)

Get file status

type FileSource

type FileSource struct {
	Path string             `json:"path,required"`
	Text FilePartSourceText `json:"text,required"`
	Type FileSourceType     `json:"type,required"`
	JSON fileSourceJSON     `json:"-"`
}

func (*FileSource) UnmarshalJSON

func (r *FileSource) UnmarshalJSON(data []byte) (err error)

type FileSourceParam

type FileSourceParam struct {
	Path param.Field[string]                  `json:"path,required"`
	Text param.Field[FilePartSourceTextParam] `json:"text,required"`
	Type param.Field[FileSourceType]          `json:"type,required"`
}

func (FileSourceParam) MarshalJSON

func (r FileSourceParam) MarshalJSON() (data []byte, err error)

type FileSourceType

type FileSourceType string
const (
	FileSourceTypeFile FileSourceType = "file"
)

func (FileSourceType) IsKnown

func (r FileSourceType) IsKnown() bool

type FileStatus

type FileStatus string
const (
	FileStatusAdded    FileStatus = "added"
	FileStatusDeleted  FileStatus = "deleted"
	FileStatusModified FileStatus = "modified"
)

func (FileStatus) IsKnown

func (r FileStatus) IsKnown() bool

type FileStatusParams added in v0.5.0

type FileStatusParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (FileStatusParams) URLQuery added in v0.5.0

func (r FileStatusParams) URLQuery() (v url.Values)

URLQuery serializes FileStatusParams's query parameters as `url.Values`.

type FindFilesParams

type FindFilesParams struct {
	Query     param.Field[string] `query:"query,required"`
	Directory param.Field[string] `query:"directory"`
}

func (FindFilesParams) URLQuery

func (r FindFilesParams) URLQuery() (v url.Values)

URLQuery serializes FindFilesParams's query parameters as `url.Values`.

type FindService

type FindService struct {
	Options []option.RequestOption
}

FindService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFindService method instead.

func NewFindService

func NewFindService(opts ...option.RequestOption) (r *FindService)

NewFindService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FindService) Files

func (r *FindService) Files(ctx context.Context, query FindFilesParams, opts ...option.RequestOption) (res *[]string, err error)

Find files

func (*FindService) Symbols

func (r *FindService) Symbols(ctx context.Context, query FindSymbolsParams, opts ...option.RequestOption) (res *[]Symbol, err error)

Find workspace symbols

func (*FindService) Text

func (r *FindService) Text(ctx context.Context, query FindTextParams, opts ...option.RequestOption) (res *[]FindTextResponse, err error)

Find text in files

type FindSymbolsParams

type FindSymbolsParams struct {
	Query     param.Field[string] `query:"query,required"`
	Directory param.Field[string] `query:"directory"`
}

func (FindSymbolsParams) URLQuery

func (r FindSymbolsParams) URLQuery() (v url.Values)

URLQuery serializes FindSymbolsParams's query parameters as `url.Values`.

type FindTextParams

type FindTextParams struct {
	Pattern   param.Field[string] `query:"pattern,required"`
	Directory param.Field[string] `query:"directory"`
}

func (FindTextParams) URLQuery

func (r FindTextParams) URLQuery() (v url.Values)

URLQuery serializes FindTextParams's query parameters as `url.Values`.

type FindTextResponse

type FindTextResponse struct {
	AbsoluteOffset float64                    `json:"absolute_offset,required"`
	LineNumber     float64                    `json:"line_number,required"`
	Lines          FindTextResponseLines      `json:"lines,required"`
	Path           FindTextResponsePath       `json:"path,required"`
	Submatches     []FindTextResponseSubmatch `json:"submatches,required"`
	JSON           findTextResponseJSON       `json:"-"`
}

func (*FindTextResponse) UnmarshalJSON

func (r *FindTextResponse) UnmarshalJSON(data []byte) (err error)

type FindTextResponseLines

type FindTextResponseLines struct {
	Text string                    `json:"text,required"`
	JSON findTextResponseLinesJSON `json:"-"`
}

func (*FindTextResponseLines) UnmarshalJSON

func (r *FindTextResponseLines) UnmarshalJSON(data []byte) (err error)

type FindTextResponsePath

type FindTextResponsePath struct {
	Text string                   `json:"text,required"`
	JSON findTextResponsePathJSON `json:"-"`
}

func (*FindTextResponsePath) UnmarshalJSON

func (r *FindTextResponsePath) UnmarshalJSON(data []byte) (err error)

type FindTextResponseSubmatch

type FindTextResponseSubmatch struct {
	End   float64                         `json:"end,required"`
	Match FindTextResponseSubmatchesMatch `json:"match,required"`
	Start float64                         `json:"start,required"`
	JSON  findTextResponseSubmatchJSON    `json:"-"`
}

func (*FindTextResponseSubmatch) UnmarshalJSON

func (r *FindTextResponseSubmatch) UnmarshalJSON(data []byte) (err error)

type FindTextResponseSubmatchesMatch

type FindTextResponseSubmatchesMatch struct {
	Text string                              `json:"text,required"`
	JSON findTextResponseSubmatchesMatchJSON `json:"-"`
}

func (*FindTextResponseSubmatchesMatch) UnmarshalJSON

func (r *FindTextResponseSubmatchesMatch) UnmarshalJSON(data []byte) (err error)

type KeybindsConfig

type KeybindsConfig struct {
	// Next agent
	AgentCycle string `json:"agent_cycle"`
	// Previous agent
	AgentCycleReverse string `json:"agent_cycle_reverse"`
	// List agents
	AgentList string `json:"agent_list"`
	// Exit the application
	AppExit string `json:"app_exit"`
	// Show help dialog
	AppHelp string `json:"app_help"`
	// Open external editor
	EditorOpen string `json:"editor_open"`
	// @deprecated Close file
	FileClose string `json:"file_close"`
	// @deprecated Split/unified diff
	FileDiffToggle string `json:"file_diff_toggle"`
	// @deprecated Currently not available. List files
	FileList string `json:"file_list"`
	// @deprecated Search file
	FileSearch string `json:"file_search"`
	// Clear input field
	InputClear string `json:"input_clear"`
	// Insert newline in input
	InputNewline string `json:"input_newline"`
	// Paste from clipboard
	InputPaste string `json:"input_paste"`
	// Submit input
	InputSubmit string `json:"input_submit"`
	// Leader key for keybind combinations
	Leader string `json:"leader"`
	// Copy message
	MessagesCopy string `json:"messages_copy"`
	// Navigate to first message
	MessagesFirst string `json:"messages_first"`
	// Scroll messages down by half page
	MessagesHalfPageDown string `json:"messages_half_page_down"`
	// Scroll messages up by half page
	MessagesHalfPageUp string `json:"messages_half_page_up"`
	// Navigate to last message
	MessagesLast string `json:"messages_last"`
	// @deprecated Toggle layout
	MessagesLayoutToggle string `json:"messages_layout_toggle"`
	// @deprecated Navigate to next message
	MessagesNext string `json:"messages_next"`
	// Scroll messages down by one page
	MessagesPageDown string `json:"messages_page_down"`
	// Scroll messages up by one page
	MessagesPageUp string `json:"messages_page_up"`
	// @deprecated Navigate to previous message
	MessagesPrevious string `json:"messages_previous"`
	// Redo message
	MessagesRedo string `json:"messages_redo"`
	// @deprecated use messages_undo. Revert message
	MessagesRevert string `json:"messages_revert"`
	// Undo message
	MessagesUndo string `json:"messages_undo"`
	// Next recent model
	ModelCycleRecent string `json:"model_cycle_recent"`
	// Previous recent model
	ModelCycleRecentReverse string `json:"model_cycle_recent_reverse"`
	// List available models
	ModelList string `json:"model_list"`
	// Create/update AGENTS.md
	ProjectInit string `json:"project_init"`
	// Cycle to next child session
	SessionChildCycle string `json:"session_child_cycle"`
	// Cycle to previous child session
	SessionChildCycleReverse string `json:"session_child_cycle_reverse"`
	// Compact the session
	SessionCompact string `json:"session_compact"`
	// Export session to editor
	SessionExport string `json:"session_export"`
	// Interrupt current session
	SessionInterrupt string `json:"session_interrupt"`
	// List all sessions
	SessionList string `json:"session_list"`
	// Create a new session
	SessionNew string `json:"session_new"`
	// Share current session
	SessionShare string `json:"session_share"`
	// Show session timeline
	SessionTimeline string `json:"session_timeline"`
	// Unshare current session
	SessionUnshare string `json:"session_unshare"`
	// @deprecated use agent_cycle. Next agent
	SwitchAgent string `json:"switch_agent"`
	// @deprecated use agent_cycle_reverse. Previous agent
	SwitchAgentReverse string `json:"switch_agent_reverse"`
	// @deprecated use agent_cycle. Next mode
	SwitchMode string `json:"switch_mode"`
	// @deprecated use agent_cycle_reverse. Previous mode
	SwitchModeReverse string `json:"switch_mode_reverse"`
	// List available themes
	ThemeList string `json:"theme_list"`
	// Toggle thinking blocks
	ThinkingBlocks string `json:"thinking_blocks"`
	// Toggle tool details
	ToolDetails string             `json:"tool_details"`
	JSON        keybindsConfigJSON `json:"-"`
}

Custom keybind configurations

func (*KeybindsConfig) UnmarshalJSON

func (r *KeybindsConfig) UnmarshalJSON(data []byte) (err error)

type McpLocalConfig

type McpLocalConfig struct {
	// Command and arguments to run the MCP server
	Command []string `json:"command,required"`
	// Type of MCP server connection
	Type McpLocalConfigType `json:"type,required"`
	// Enable or disable the MCP server on startup
	Enabled bool `json:"enabled"`
	// Environment variables to set when running the MCP server
	Environment map[string]string  `json:"environment"`
	JSON        mcpLocalConfigJSON `json:"-"`
}

func (*McpLocalConfig) UnmarshalJSON

func (r *McpLocalConfig) UnmarshalJSON(data []byte) (err error)

type McpLocalConfigType

type McpLocalConfigType string

Type of MCP server connection

const (
	McpLocalConfigTypeLocal McpLocalConfigType = "local"
)

func (McpLocalConfigType) IsKnown

func (r McpLocalConfigType) IsKnown() bool

type McpRemoteConfig

type McpRemoteConfig struct {
	// Type of MCP server connection
	Type McpRemoteConfigType `json:"type,required"`
	// URL of the remote MCP server
	URL string `json:"url,required"`
	// Enable or disable the MCP server on startup
	Enabled bool `json:"enabled"`
	// Headers to send with the request
	Headers map[string]string   `json:"headers"`
	JSON    mcpRemoteConfigJSON `json:"-"`
}

func (*McpRemoteConfig) UnmarshalJSON

func (r *McpRemoteConfig) UnmarshalJSON(data []byte) (err error)

type McpRemoteConfigType

type McpRemoteConfigType string

Type of MCP server connection

const (
	McpRemoteConfigTypeRemote McpRemoteConfigType = "remote"
)

func (McpRemoteConfigType) IsKnown

func (r McpRemoteConfigType) IsKnown() bool

type Message

type Message struct {
	ID        string      `json:"id,required"`
	Role      MessageRole `json:"role,required"`
	SessionID string      `json:"sessionID,required"`
	// This field can have the runtime type of [UserMessageTime],
	// [AssistantMessageTime].
	Time interface{} `json:"time,required"`
	Cost float64     `json:"cost"`
	// This field can have the runtime type of [AssistantMessageError].
	Error   interface{} `json:"error"`
	Mode    string      `json:"mode"`
	ModelID string      `json:"modelID"`
	// This field can have the runtime type of [AssistantMessagePath].
	Path       interface{} `json:"path"`
	ProviderID string      `json:"providerID"`
	Summary    bool        `json:"summary"`
	// This field can have the runtime type of [[]string].
	System interface{} `json:"system"`
	// This field can have the runtime type of [AssistantMessageTokens].
	Tokens interface{} `json:"tokens"`
	JSON   messageJSON `json:"-"`
	// contains filtered or unexported fields
}

func (Message) AsUnion

func (r Message) AsUnion() MessageUnion

AsUnion returns a MessageUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are UserMessage, AssistantMessage.

func (*Message) UnmarshalJSON

func (r *Message) UnmarshalJSON(data []byte) (err error)

type MessageAbortedError

type MessageAbortedError = shared.MessageAbortedError

This is an alias to an internal type.

type MessageAbortedErrorData added in v0.12.0

type MessageAbortedErrorData = shared.MessageAbortedErrorData

This is an alias to an internal type.

type MessageAbortedErrorName

type MessageAbortedErrorName = shared.MessageAbortedErrorName

This is an alias to an internal type.

type MessageRole

type MessageRole string
const (
	MessageRoleUser      MessageRole = "user"
	MessageRoleAssistant MessageRole = "assistant"
)

func (MessageRole) IsKnown

func (r MessageRole) IsKnown() bool

type MessageUnion

type MessageUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by UserMessage or AssistantMessage.

type Model added in v0.2.0

type Model struct {
	ID           string                 `json:"id,required"`
	Attachment   bool                   `json:"attachment,required"`
	Cost         ModelCost              `json:"cost,required"`
	Limit        ModelLimit             `json:"limit,required"`
	Name         string                 `json:"name,required"`
	Options      map[string]interface{} `json:"options,required"`
	Reasoning    bool                   `json:"reasoning,required"`
	ReleaseDate  string                 `json:"release_date,required"`
	Temperature  bool                   `json:"temperature,required"`
	ToolCall     bool                   `json:"tool_call,required"`
	Experimental bool                   `json:"experimental"`
	Provider     ModelProvider          `json:"provider"`
	JSON         modelJSON              `json:"-"`
}

func (*Model) UnmarshalJSON added in v0.2.0

func (r *Model) UnmarshalJSON(data []byte) (err error)

type ModelCost added in v0.2.0

type ModelCost struct {
	Input      float64       `json:"input,required"`
	Output     float64       `json:"output,required"`
	CacheRead  float64       `json:"cache_read"`
	CacheWrite float64       `json:"cache_write"`
	JSON       modelCostJSON `json:"-"`
}

func (*ModelCost) UnmarshalJSON added in v0.2.0

func (r *ModelCost) UnmarshalJSON(data []byte) (err error)

type ModelLimit added in v0.2.0

type ModelLimit struct {
	Context float64        `json:"context,required"`
	Output  float64        `json:"output,required"`
	JSON    modelLimitJSON `json:"-"`
}

func (*ModelLimit) UnmarshalJSON added in v0.2.0

func (r *ModelLimit) UnmarshalJSON(data []byte) (err error)

type ModelProvider added in v0.12.0

type ModelProvider struct {
	Npm  string            `json:"npm,required"`
	JSON modelProviderJSON `json:"-"`
}

func (*ModelProvider) UnmarshalJSON added in v0.12.0

func (r *ModelProvider) UnmarshalJSON(data []byte) (err error)

type Part

type Part struct {
	ID        string   `json:"id,required"`
	MessageID string   `json:"messageID,required"`
	SessionID string   `json:"sessionID,required"`
	Type      PartType `json:"type,required"`
	CallID    string   `json:"callID"`
	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"`
	// This field can have the runtime type of [map[string]interface{}].
	Metadata interface{} `json:"metadata"`
	Mime     string      `json:"mime"`
	Name     string      `json:"name"`
	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], [ReasoningPartTime].
	Time interface{} `json:"time"`
	// This field can have the runtime type of [StepFinishPartTokens].
	Tokens interface{} `json:"tokens"`
	Tool   string      `json:"tool"`
	URL    string      `json:"url"`
	JSON   partJSON    `json:"-"`
	// contains filtered or unexported fields
}

func (Part) AsUnion

func (r Part) AsUnion() PartUnion

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, ReasoningPart, FilePart, ToolPart, StepStartPart, StepFinishPart, SnapshotPart, PartPatchPart, AgentPart.

func (*Part) UnmarshalJSON

func (r *Part) UnmarshalJSON(data []byte) (err error)

type PartPatchPart

type PartPatchPart struct {
	ID        string            `json:"id,required"`
	Files     []string          `json:"files,required"`
	Hash      string            `json:"hash,required"`
	MessageID string            `json:"messageID,required"`
	SessionID string            `json:"sessionID,required"`
	Type      PartPatchPartType `json:"type,required"`
	JSON      partPatchPartJSON `json:"-"`
}

func (*PartPatchPart) UnmarshalJSON

func (r *PartPatchPart) UnmarshalJSON(data []byte) (err error)

type PartPatchPartType

type PartPatchPartType string
const (
	PartPatchPartTypePatch PartPatchPartType = "patch"
)

func (PartPatchPartType) IsKnown

func (r PartPatchPartType) IsKnown() bool

type PartType

type PartType string
const (
	PartTypeText       PartType = "text"
	PartTypeReasoning  PartType = "reasoning"
	PartTypeFile       PartType = "file"
	PartTypeTool       PartType = "tool"
	PartTypeStepStart  PartType = "step-start"
	PartTypeStepFinish PartType = "step-finish"
	PartTypeSnapshot   PartType = "snapshot"
	PartTypePatch      PartType = "patch"
	PartTypeAgent      PartType = "agent"
)

func (PartType) IsKnown

func (r PartType) IsKnown() bool

type PartUnion

type PartUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by TextPart, ReasoningPart, FilePart, ToolPart, StepStartPart, StepFinishPart, SnapshotPart, PartPatchPart or AgentPart.

type Path added in v0.5.0

type Path struct {
	Config    string   `json:"config,required"`
	Directory string   `json:"directory,required"`
	State     string   `json:"state,required"`
	Worktree  string   `json:"worktree,required"`
	JSON      pathJSON `json:"-"`
}

func (*Path) UnmarshalJSON added in v0.5.0

func (r *Path) UnmarshalJSON(data []byte) (err error)

type PathGetParams added in v0.5.0

type PathGetParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (PathGetParams) URLQuery added in v0.5.0

func (r PathGetParams) URLQuery() (v url.Values)

URLQuery serializes PathGetParams's query parameters as `url.Values`.

type PathService added in v0.5.0

type PathService struct {
	Options []option.RequestOption
}

PathService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPathService method instead.

func NewPathService added in v0.5.0

func NewPathService(opts ...option.RequestOption) (r *PathService)

NewPathService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PathService) Get added in v0.5.0

func (r *PathService) Get(ctx context.Context, query PathGetParams, opts ...option.RequestOption) (res *Path, err error)

Get the current path

type Permission

type Permission struct {
	ID        string                 `json:"id,required"`
	MessageID string                 `json:"messageID,required"`
	Metadata  map[string]interface{} `json:"metadata,required"`
	SessionID string                 `json:"sessionID,required"`
	Time      PermissionTime         `json:"time,required"`
	Title     string                 `json:"title,required"`
	Type      string                 `json:"type,required"`
	CallID    string                 `json:"callID"`
	Pattern   PermissionPatternUnion `json:"pattern"`
	JSON      permissionJSON         `json:"-"`
}

func (*Permission) UnmarshalJSON

func (r *Permission) UnmarshalJSON(data []byte) (err error)

type PermissionPatternArray added in v0.16.0

type PermissionPatternArray []string

func (PermissionPatternArray) ImplementsPermissionPatternUnion added in v0.16.0

func (r PermissionPatternArray) ImplementsPermissionPatternUnion()

type PermissionPatternUnion added in v0.16.0

type PermissionPatternUnion interface {
	ImplementsPermissionPatternUnion()
}

Union satisfied by shared.UnionString or PermissionPatternArray.

type PermissionTime

type PermissionTime struct {
	Created float64            `json:"created,required"`
	JSON    permissionTimeJSON `json:"-"`
}

func (*PermissionTime) UnmarshalJSON

func (r *PermissionTime) UnmarshalJSON(data []byte) (err error)

type Project added in v0.5.0

type Project struct {
	ID       string      `json:"id,required"`
	Time     ProjectTime `json:"time,required"`
	Worktree string      `json:"worktree,required"`
	Vcs      ProjectVcs  `json:"vcs"`
	JSON     projectJSON `json:"-"`
}

func (*Project) UnmarshalJSON added in v0.5.0

func (r *Project) UnmarshalJSON(data []byte) (err error)

type ProjectCurrentParams added in v0.7.0

type ProjectCurrentParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (ProjectCurrentParams) URLQuery added in v0.7.0

func (r ProjectCurrentParams) URLQuery() (v url.Values)

URLQuery serializes ProjectCurrentParams's query parameters as `url.Values`.

type ProjectListParams added in v0.5.0

type ProjectListParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (ProjectListParams) URLQuery added in v0.5.0

func (r ProjectListParams) URLQuery() (v url.Values)

URLQuery serializes ProjectListParams's query parameters as `url.Values`.

type ProjectService added in v0.5.0

type ProjectService struct {
	Options []option.RequestOption
}

ProjectService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectService method instead.

func NewProjectService added in v0.5.0

func NewProjectService(opts ...option.RequestOption) (r *ProjectService)

NewProjectService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ProjectService) Current added in v0.7.0

func (r *ProjectService) Current(ctx context.Context, query ProjectCurrentParams, opts ...option.RequestOption) (res *Project, err error)

Get the current project

func (*ProjectService) List added in v0.5.0

func (r *ProjectService) List(ctx context.Context, query ProjectListParams, opts ...option.RequestOption) (res *[]Project, err error)

List all projects

type ProjectTime added in v0.5.0

type ProjectTime struct {
	Created     float64         `json:"created,required"`
	Initialized float64         `json:"initialized"`
	JSON        projectTimeJSON `json:"-"`
}

func (*ProjectTime) UnmarshalJSON added in v0.5.0

func (r *ProjectTime) UnmarshalJSON(data []byte) (err error)

type ProjectVcs added in v0.5.0

type ProjectVcs string
const (
	ProjectVcsGit ProjectVcs = "git"
)

func (ProjectVcs) IsKnown added in v0.5.0

func (r ProjectVcs) IsKnown() bool

type Provider added in v0.2.0

type Provider struct {
	ID     string           `json:"id,required"`
	Env    []string         `json:"env,required"`
	Models map[string]Model `json:"models,required"`
	Name   string           `json:"name,required"`
	API    string           `json:"api"`
	Npm    string           `json:"npm"`
	JSON   providerJSON     `json:"-"`
}

func (*Provider) UnmarshalJSON added in v0.2.0

func (r *Provider) UnmarshalJSON(data []byte) (err error)

type ProviderAuthError

type ProviderAuthError = shared.ProviderAuthError

This is an alias to an internal type.

type ProviderAuthErrorData

type ProviderAuthErrorData = shared.ProviderAuthErrorData

This is an alias to an internal type.

type ProviderAuthErrorName

type ProviderAuthErrorName = shared.ProviderAuthErrorName

This is an alias to an internal type.

type ReasoningPart

type ReasoningPart struct {
	ID        string                 `json:"id,required"`
	MessageID string                 `json:"messageID,required"`
	SessionID string                 `json:"sessionID,required"`
	Text      string                 `json:"text,required"`
	Time      ReasoningPartTime      `json:"time,required"`
	Type      ReasoningPartType      `json:"type,required"`
	Metadata  map[string]interface{} `json:"metadata"`
	JSON      reasoningPartJSON      `json:"-"`
}

func (*ReasoningPart) UnmarshalJSON

func (r *ReasoningPart) UnmarshalJSON(data []byte) (err error)

type ReasoningPartTime

type ReasoningPartTime struct {
	Start float64               `json:"start,required"`
	End   float64               `json:"end"`
	JSON  reasoningPartTimeJSON `json:"-"`
}

func (*ReasoningPartTime) UnmarshalJSON

func (r *ReasoningPartTime) UnmarshalJSON(data []byte) (err error)

type ReasoningPartType

type ReasoningPartType string
const (
	ReasoningPartTypeReasoning ReasoningPartType = "reasoning"
)

func (ReasoningPartType) IsKnown

func (r ReasoningPartType) IsKnown() bool

type Session

type Session struct {
	ID        string        `json:"id,required"`
	Directory string        `json:"directory,required"`
	ProjectID string        `json:"projectID,required"`
	Time      SessionTime   `json:"time,required"`
	Title     string        `json:"title,required"`
	Version   string        `json:"version,required"`
	ParentID  string        `json:"parentID"`
	Revert    SessionRevert `json:"revert"`
	Share     SessionShare  `json:"share"`
	JSON      sessionJSON   `json:"-"`
}

func (*Session) UnmarshalJSON

func (r *Session) UnmarshalJSON(data []byte) (err error)

type SessionAbortParams added in v0.5.0

type SessionAbortParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (SessionAbortParams) URLQuery added in v0.5.0

func (r SessionAbortParams) URLQuery() (v url.Values)

URLQuery serializes SessionAbortParams's query parameters as `url.Values`.

type SessionChildrenParams added in v0.5.0

type SessionChildrenParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (SessionChildrenParams) URLQuery added in v0.5.0

func (r SessionChildrenParams) URLQuery() (v url.Values)

URLQuery serializes SessionChildrenParams's query parameters as `url.Values`.

type SessionCommandParams

type SessionCommandParams struct {
	Arguments param.Field[string] `json:"arguments,required"`
	Command   param.Field[string] `json:"command,required"`
	Directory param.Field[string] `query:"directory"`
	Agent     param.Field[string] `json:"agent"`
	MessageID param.Field[string] `json:"messageID"`
	Model     param.Field[string] `json:"model"`
}

func (SessionCommandParams) MarshalJSON

func (r SessionCommandParams) MarshalJSON() (data []byte, err error)

func (SessionCommandParams) URLQuery added in v0.5.0

func (r SessionCommandParams) URLQuery() (v url.Values)

URLQuery serializes SessionCommandParams's query parameters as `url.Values`.

type SessionCommandResponse

type SessionCommandResponse struct {
	Info  AssistantMessage           `json:"info,required"`
	Parts []Part                     `json:"parts,required"`
	JSON  sessionCommandResponseJSON `json:"-"`
}

func (*SessionCommandResponse) UnmarshalJSON

func (r *SessionCommandResponse) UnmarshalJSON(data []byte) (err error)

type SessionDeleteParams added in v0.5.0

type SessionDeleteParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (SessionDeleteParams) URLQuery added in v0.5.0

func (r SessionDeleteParams) URLQuery() (v url.Values)

URLQuery serializes SessionDeleteParams's query parameters as `url.Values`.

type SessionGetParams added in v0.5.0

type SessionGetParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (SessionGetParams) URLQuery added in v0.5.0

func (r SessionGetParams) URLQuery() (v url.Values)

URLQuery serializes SessionGetParams's query parameters as `url.Values`.

type SessionInitParams

type SessionInitParams struct {
	MessageID  param.Field[string] `json:"messageID,required"`
	ModelID    param.Field[string] `json:"modelID,required"`
	ProviderID param.Field[string] `json:"providerID,required"`
	Directory  param.Field[string] `query:"directory"`
}

func (SessionInitParams) MarshalJSON

func (r SessionInitParams) MarshalJSON() (data []byte, err error)

func (SessionInitParams) URLQuery added in v0.5.0

func (r SessionInitParams) URLQuery() (v url.Values)

URLQuery serializes SessionInitParams's query parameters as `url.Values`.

type SessionListParams added in v0.5.0

type SessionListParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (SessionListParams) URLQuery added in v0.5.0

func (r SessionListParams) URLQuery() (v url.Values)

URLQuery serializes SessionListParams's query parameters as `url.Values`.

type SessionMessageParams added in v0.5.0

type SessionMessageParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (SessionMessageParams) URLQuery added in v0.5.0

func (r SessionMessageParams) URLQuery() (v url.Values)

URLQuery serializes SessionMessageParams's query parameters as `url.Values`.

type SessionMessageResponse

type SessionMessageResponse struct {
	Info  Message                    `json:"info,required"`
	Parts []Part                     `json:"parts,required"`
	JSON  sessionMessageResponseJSON `json:"-"`
}

func (*SessionMessageResponse) UnmarshalJSON

func (r *SessionMessageResponse) UnmarshalJSON(data []byte) (err error)

type SessionMessagesParams added in v0.5.0

type SessionMessagesParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (SessionMessagesParams) URLQuery added in v0.5.0

func (r SessionMessagesParams) URLQuery() (v url.Values)

URLQuery serializes SessionMessagesParams's query parameters as `url.Values`.

type SessionMessagesResponse

type SessionMessagesResponse struct {
	Info  Message                     `json:"info,required"`
	Parts []Part                      `json:"parts,required"`
	JSON  sessionMessagesResponseJSON `json:"-"`
}

func (*SessionMessagesResponse) UnmarshalJSON

func (r *SessionMessagesResponse) UnmarshalJSON(data []byte) (err error)

type SessionNewParams

type SessionNewParams struct {
	Directory param.Field[string] `query:"directory"`
	ParentID  param.Field[string] `json:"parentID"`
	Title     param.Field[string] `json:"title"`
}

func (SessionNewParams) MarshalJSON

func (r SessionNewParams) MarshalJSON() (data []byte, err error)

func (SessionNewParams) URLQuery added in v0.5.0

func (r SessionNewParams) URLQuery() (v url.Values)

URLQuery serializes SessionNewParams's query parameters as `url.Values`.

type SessionPermissionRespondParams

type SessionPermissionRespondParams struct {
	Response  param.Field[SessionPermissionRespondParamsResponse] `json:"response,required"`
	Directory param.Field[string]                                 `query:"directory"`
}

func (SessionPermissionRespondParams) MarshalJSON

func (r SessionPermissionRespondParams) MarshalJSON() (data []byte, err error)

func (SessionPermissionRespondParams) URLQuery added in v0.5.0

func (r SessionPermissionRespondParams) URLQuery() (v url.Values)

URLQuery serializes SessionPermissionRespondParams's query parameters as `url.Values`.

type SessionPermissionRespondParamsResponse

type SessionPermissionRespondParamsResponse string
const (
	SessionPermissionRespondParamsResponseOnce   SessionPermissionRespondParamsResponse = "once"
	SessionPermissionRespondParamsResponseAlways SessionPermissionRespondParamsResponse = "always"
	SessionPermissionRespondParamsResponseReject SessionPermissionRespondParamsResponse = "reject"
)

func (SessionPermissionRespondParamsResponse) IsKnown

type SessionPermissionService

type SessionPermissionService struct {
	Options []option.RequestOption
}

SessionPermissionService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSessionPermissionService method instead.

func NewSessionPermissionService

func NewSessionPermissionService(opts ...option.RequestOption) (r *SessionPermissionService)

NewSessionPermissionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SessionPermissionService) Respond

func (r *SessionPermissionService) Respond(ctx context.Context, id string, permissionID string, params SessionPermissionRespondParams, opts ...option.RequestOption) (res *bool, err error)

Respond to a permission request

type SessionPromptParams added in v0.12.0

type SessionPromptParams struct {
	Parts     param.Field[[]SessionPromptParamsPartUnion] `json:"parts,required"`
	Directory param.Field[string]                         `query:"directory"`
	Agent     param.Field[string]                         `json:"agent"`
	MessageID param.Field[string]                         `json:"messageID"`
	Model     param.Field[SessionPromptParamsModel]       `json:"model"`
	System    param.Field[string]                         `json:"system"`
	Tools     param.Field[map[string]bool]                `json:"tools"`
}

func (SessionPromptParams) MarshalJSON added in v0.12.0

func (r SessionPromptParams) MarshalJSON() (data []byte, err error)

func (SessionPromptParams) URLQuery added in v0.14.0

func (r SessionPromptParams) URLQuery() (v url.Values)

URLQuery serializes SessionPromptParams's query parameters as `url.Values`.

type SessionPromptParamsModel added in v0.12.0

type SessionPromptParamsModel struct {
	ModelID    param.Field[string] `json:"modelID,required"`
	ProviderID param.Field[string] `json:"providerID,required"`
}

func (SessionPromptParamsModel) MarshalJSON added in v0.12.0

func (r SessionPromptParamsModel) MarshalJSON() (data []byte, err error)

type SessionPromptParamsPart added in v0.12.0

type SessionPromptParamsPart struct {
	Type      param.Field[SessionPromptParamsPartsType] `json:"type,required"`
	ID        param.Field[string]                       `json:"id"`
	Filename  param.Field[string]                       `json:"filename"`
	Mime      param.Field[string]                       `json:"mime"`
	Name      param.Field[string]                       `json:"name"`
	Source    param.Field[interface{}]                  `json:"source"`
	Synthetic param.Field[bool]                         `json:"synthetic"`
	Text      param.Field[string]                       `json:"text"`
	Time      param.Field[interface{}]                  `json:"time"`
	URL       param.Field[string]                       `json:"url"`
}

func (SessionPromptParamsPart) MarshalJSON added in v0.12.0

func (r SessionPromptParamsPart) MarshalJSON() (data []byte, err error)

type SessionPromptParamsPartUnion added in v0.12.0

type SessionPromptParamsPartUnion interface {
	// contains filtered or unexported methods
}

Satisfied by TextPartInputParam, FilePartInputParam, AgentPartInputParam, SessionPromptParamsPart.

type SessionPromptParamsPartsType added in v0.12.0

type SessionPromptParamsPartsType string
const (
	SessionPromptParamsPartsTypeText  SessionPromptParamsPartsType = "text"
	SessionPromptParamsPartsTypeFile  SessionPromptParamsPartsType = "file"
	SessionPromptParamsPartsTypeAgent SessionPromptParamsPartsType = "agent"
)

func (SessionPromptParamsPartsType) IsKnown added in v0.12.0

func (r SessionPromptParamsPartsType) IsKnown() bool

type SessionPromptResponse added in v0.12.0

type SessionPromptResponse struct {
	Info  AssistantMessage          `json:"info,required"`
	Parts []Part                    `json:"parts,required"`
	JSON  sessionPromptResponseJSON `json:"-"`
}

func (*SessionPromptResponse) UnmarshalJSON added in v0.12.0

func (r *SessionPromptResponse) UnmarshalJSON(data []byte) (err error)

type SessionRevert

type SessionRevert struct {
	MessageID string            `json:"messageID,required"`
	Diff      string            `json:"diff"`
	PartID    string            `json:"partID"`
	Snapshot  string            `json:"snapshot"`
	JSON      sessionRevertJSON `json:"-"`
}

func (*SessionRevert) UnmarshalJSON

func (r *SessionRevert) UnmarshalJSON(data []byte) (err error)

type SessionRevertParams

type SessionRevertParams struct {
	MessageID param.Field[string] `json:"messageID,required"`
	Directory param.Field[string] `query:"directory"`
	PartID    param.Field[string] `json:"partID"`
}

func (SessionRevertParams) MarshalJSON

func (r SessionRevertParams) MarshalJSON() (data []byte, err error)

func (SessionRevertParams) URLQuery added in v0.5.0

func (r SessionRevertParams) URLQuery() (v url.Values)

URLQuery serializes SessionRevertParams's query parameters as `url.Values`.

type SessionService

type SessionService struct {
	Options     []option.RequestOption
	Permissions *SessionPermissionService
}

SessionService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSessionService method instead.

func NewSessionService

func NewSessionService(opts ...option.RequestOption) (r *SessionService)

NewSessionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SessionService) Abort

func (r *SessionService) Abort(ctx context.Context, id string, body SessionAbortParams, opts ...option.RequestOption) (res *bool, err error)

Abort a session

func (*SessionService) Children

func (r *SessionService) Children(ctx context.Context, id string, query SessionChildrenParams, opts ...option.RequestOption) (res *[]Session, err error)

Get a session's children

func (*SessionService) Command

Send a new command to a session

func (*SessionService) Delete

func (r *SessionService) Delete(ctx context.Context, id string, body SessionDeleteParams, opts ...option.RequestOption) (res *bool, err error)

Delete a session and all its data

func (*SessionService) Get

func (r *SessionService) Get(ctx context.Context, id string, query SessionGetParams, opts ...option.RequestOption) (res *Session, err error)

Get session

func (*SessionService) Init

func (r *SessionService) Init(ctx context.Context, id string, params SessionInitParams, opts ...option.RequestOption) (res *bool, err error)

Analyze the app and create an AGENTS.md file

func (*SessionService) List

func (r *SessionService) List(ctx context.Context, query SessionListParams, opts ...option.RequestOption) (res *[]Session, err error)

List all sessions

func (*SessionService) Message

func (r *SessionService) Message(ctx context.Context, id string, messageID string, query SessionMessageParams, opts ...option.RequestOption) (res *SessionMessageResponse, err error)

Get a message from a session

func (*SessionService) Messages

func (r *SessionService) Messages(ctx context.Context, id string, query SessionMessagesParams, opts ...option.RequestOption) (res *[]SessionMessagesResponse, err error)

List messages for a session

func (*SessionService) New

func (r *SessionService) New(ctx context.Context, params SessionNewParams, opts ...option.RequestOption) (res *Session, err error)

Create a new session

func (*SessionService) Prompt added in v0.12.0

Create and send a new message to a session

func (*SessionService) Revert

func (r *SessionService) Revert(ctx context.Context, id string, params SessionRevertParams, opts ...option.RequestOption) (res *Session, err error)

Revert a message

func (*SessionService) Share

func (r *SessionService) Share(ctx context.Context, id string, body SessionShareParams, opts ...option.RequestOption) (res *Session, err error)

Share a session

func (*SessionService) Shell

func (r *SessionService) Shell(ctx context.Context, id string, params SessionShellParams, opts ...option.RequestOption) (res *AssistantMessage, err error)

Run a shell command

func (*SessionService) Summarize

func (r *SessionService) Summarize(ctx context.Context, id string, params SessionSummarizeParams, opts ...option.RequestOption) (res *bool, err error)

Summarize the session

func (*SessionService) Unrevert

func (r *SessionService) Unrevert(ctx context.Context, id string, body SessionUnrevertParams, opts ...option.RequestOption) (res *Session, err error)

Restore all reverted messages

func (*SessionService) Unshare

func (r *SessionService) Unshare(ctx context.Context, id string, body SessionUnshareParams, opts ...option.RequestOption) (res *Session, err error)

Unshare the session

func (*SessionService) Update

func (r *SessionService) Update(ctx context.Context, id string, params SessionUpdateParams, opts ...option.RequestOption) (res *Session, err error)

Update session properties

type SessionShare

type SessionShare struct {
	URL  string           `json:"url,required"`
	JSON sessionShareJSON `json:"-"`
}

func (*SessionShare) UnmarshalJSON

func (r *SessionShare) UnmarshalJSON(data []byte) (err error)

type SessionShareParams added in v0.5.0

type SessionShareParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (SessionShareParams) URLQuery added in v0.5.0

func (r SessionShareParams) URLQuery() (v url.Values)

URLQuery serializes SessionShareParams's query parameters as `url.Values`.

type SessionShellParams

type SessionShellParams struct {
	Agent     param.Field[string] `json:"agent,required"`
	Command   param.Field[string] `json:"command,required"`
	Directory param.Field[string] `query:"directory"`
}

func (SessionShellParams) MarshalJSON

func (r SessionShellParams) MarshalJSON() (data []byte, err error)

func (SessionShellParams) URLQuery added in v0.5.0

func (r SessionShellParams) URLQuery() (v url.Values)

URLQuery serializes SessionShellParams's query parameters as `url.Values`.

type SessionSummarizeParams

type SessionSummarizeParams struct {
	ModelID    param.Field[string] `json:"modelID,required"`
	ProviderID param.Field[string] `json:"providerID,required"`
	Directory  param.Field[string] `query:"directory"`
}

func (SessionSummarizeParams) MarshalJSON

func (r SessionSummarizeParams) MarshalJSON() (data []byte, err error)

func (SessionSummarizeParams) URLQuery added in v0.5.0

func (r SessionSummarizeParams) URLQuery() (v url.Values)

URLQuery serializes SessionSummarizeParams's query parameters as `url.Values`.

type SessionTime

type SessionTime struct {
	Created    float64         `json:"created,required"`
	Updated    float64         `json:"updated,required"`
	Compacting float64         `json:"compacting"`
	JSON       sessionTimeJSON `json:"-"`
}

func (*SessionTime) UnmarshalJSON

func (r *SessionTime) UnmarshalJSON(data []byte) (err error)

type SessionUnrevertParams added in v0.5.0

type SessionUnrevertParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (SessionUnrevertParams) URLQuery added in v0.5.0

func (r SessionUnrevertParams) URLQuery() (v url.Values)

URLQuery serializes SessionUnrevertParams's query parameters as `url.Values`.

type SessionUnshareParams added in v0.5.0

type SessionUnshareParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (SessionUnshareParams) URLQuery added in v0.5.0

func (r SessionUnshareParams) URLQuery() (v url.Values)

URLQuery serializes SessionUnshareParams's query parameters as `url.Values`.

type SessionUpdateParams

type SessionUpdateParams struct {
	Directory param.Field[string] `query:"directory"`
	Title     param.Field[string] `json:"title"`
}

func (SessionUpdateParams) MarshalJSON

func (r SessionUpdateParams) MarshalJSON() (data []byte, err error)

func (SessionUpdateParams) URLQuery added in v0.5.0

func (r SessionUpdateParams) URLQuery() (v url.Values)

URLQuery serializes SessionUpdateParams's query parameters as `url.Values`.

type SnapshotPart

type SnapshotPart struct {
	ID        string           `json:"id,required"`
	MessageID string           `json:"messageID,required"`
	SessionID string           `json:"sessionID,required"`
	Snapshot  string           `json:"snapshot,required"`
	Type      SnapshotPartType `json:"type,required"`
	JSON      snapshotPartJSON `json:"-"`
}

func (*SnapshotPart) UnmarshalJSON

func (r *SnapshotPart) UnmarshalJSON(data []byte) (err error)

type SnapshotPartType

type SnapshotPartType string
const (
	SnapshotPartTypeSnapshot SnapshotPartType = "snapshot"
)

func (SnapshotPartType) IsKnown

func (r SnapshotPartType) IsKnown() bool

type StepFinishPart

type StepFinishPart struct {
	ID        string               `json:"id,required"`
	Cost      float64              `json:"cost,required"`
	MessageID string               `json:"messageID,required"`
	SessionID string               `json:"sessionID,required"`
	Tokens    StepFinishPartTokens `json:"tokens,required"`
	Type      StepFinishPartType   `json:"type,required"`
	JSON      stepFinishPartJSON   `json:"-"`
}

func (*StepFinishPart) UnmarshalJSON

func (r *StepFinishPart) UnmarshalJSON(data []byte) (err error)

type StepFinishPartTokens

type StepFinishPartTokens struct {
	Cache     StepFinishPartTokensCache `json:"cache,required"`
	Input     float64                   `json:"input,required"`
	Output    float64                   `json:"output,required"`
	Reasoning float64                   `json:"reasoning,required"`
	JSON      stepFinishPartTokensJSON  `json:"-"`
}

func (*StepFinishPartTokens) UnmarshalJSON

func (r *StepFinishPartTokens) UnmarshalJSON(data []byte) (err error)

type StepFinishPartTokensCache

type StepFinishPartTokensCache struct {
	Read  float64                       `json:"read,required"`
	Write float64                       `json:"write,required"`
	JSON  stepFinishPartTokensCacheJSON `json:"-"`
}

func (*StepFinishPartTokensCache) UnmarshalJSON

func (r *StepFinishPartTokensCache) UnmarshalJSON(data []byte) (err error)

type StepFinishPartType

type StepFinishPartType string
const (
	StepFinishPartTypeStepFinish StepFinishPartType = "step-finish"
)

func (StepFinishPartType) IsKnown

func (r StepFinishPartType) IsKnown() bool

type StepStartPart

type StepStartPart struct {
	ID        string            `json:"id,required"`
	MessageID string            `json:"messageID,required"`
	SessionID string            `json:"sessionID,required"`
	Type      StepStartPartType `json:"type,required"`
	JSON      stepStartPartJSON `json:"-"`
}

func (*StepStartPart) UnmarshalJSON

func (r *StepStartPart) UnmarshalJSON(data []byte) (err error)

type StepStartPartType

type StepStartPartType string
const (
	StepStartPartTypeStepStart StepStartPartType = "step-start"
)

func (StepStartPartType) IsKnown

func (r StepStartPartType) IsKnown() bool

type Symbol

type Symbol struct {
	Kind     float64        `json:"kind,required"`
	Location SymbolLocation `json:"location,required"`
	Name     string         `json:"name,required"`
	JSON     symbolJSON     `json:"-"`
}

func (*Symbol) UnmarshalJSON

func (r *Symbol) UnmarshalJSON(data []byte) (err error)

type SymbolLocation

type SymbolLocation struct {
	Range SymbolLocationRange `json:"range,required"`
	Uri   string              `json:"uri,required"`
	JSON  symbolLocationJSON  `json:"-"`
}

func (*SymbolLocation) UnmarshalJSON

func (r *SymbolLocation) UnmarshalJSON(data []byte) (err error)

type SymbolLocationRange

type SymbolLocationRange struct {
	End   SymbolLocationRangeEnd   `json:"end,required"`
	Start SymbolLocationRangeStart `json:"start,required"`
	JSON  symbolLocationRangeJSON  `json:"-"`
}

func (*SymbolLocationRange) UnmarshalJSON

func (r *SymbolLocationRange) UnmarshalJSON(data []byte) (err error)

type SymbolLocationRangeEnd

type SymbolLocationRangeEnd struct {
	Character float64                    `json:"character,required"`
	Line      float64                    `json:"line,required"`
	JSON      symbolLocationRangeEndJSON `json:"-"`
}

func (*SymbolLocationRangeEnd) UnmarshalJSON

func (r *SymbolLocationRangeEnd) UnmarshalJSON(data []byte) (err error)

type SymbolLocationRangeStart

type SymbolLocationRangeStart struct {
	Character float64                      `json:"character,required"`
	Line      float64                      `json:"line,required"`
	JSON      symbolLocationRangeStartJSON `json:"-"`
}

func (*SymbolLocationRangeStart) UnmarshalJSON

func (r *SymbolLocationRangeStart) UnmarshalJSON(data []byte) (err error)

type SymbolSource

type SymbolSource struct {
	Kind  int64              `json:"kind,required"`
	Name  string             `json:"name,required"`
	Path  string             `json:"path,required"`
	Range SymbolSourceRange  `json:"range,required"`
	Text  FilePartSourceText `json:"text,required"`
	Type  SymbolSourceType   `json:"type,required"`
	JSON  symbolSourceJSON   `json:"-"`
}

func (*SymbolSource) UnmarshalJSON

func (r *SymbolSource) UnmarshalJSON(data []byte) (err error)

type SymbolSourceParam

type SymbolSourceParam struct {
	Kind  param.Field[int64]                   `json:"kind,required"`
	Name  param.Field[string]                  `json:"name,required"`
	Path  param.Field[string]                  `json:"path,required"`
	Range param.Field[SymbolSourceRangeParam]  `json:"range,required"`
	Text  param.Field[FilePartSourceTextParam] `json:"text,required"`
	Type  param.Field[SymbolSourceType]        `json:"type,required"`
}

func (SymbolSourceParam) MarshalJSON

func (r SymbolSourceParam) MarshalJSON() (data []byte, err error)

type SymbolSourceRange

type SymbolSourceRange struct {
	End   SymbolSourceRangeEnd   `json:"end,required"`
	Start SymbolSourceRangeStart `json:"start,required"`
	JSON  symbolSourceRangeJSON  `json:"-"`
}

func (*SymbolSourceRange) UnmarshalJSON

func (r *SymbolSourceRange) UnmarshalJSON(data []byte) (err error)

type SymbolSourceRangeEnd

type SymbolSourceRangeEnd struct {
	Character float64                  `json:"character,required"`
	Line      float64                  `json:"line,required"`
	JSON      symbolSourceRangeEndJSON `json:"-"`
}

func (*SymbolSourceRangeEnd) UnmarshalJSON

func (r *SymbolSourceRangeEnd) UnmarshalJSON(data []byte) (err error)

type SymbolSourceRangeEndParam

type SymbolSourceRangeEndParam struct {
	Character param.Field[float64] `json:"character,required"`
	Line      param.Field[float64] `json:"line,required"`
}

func (SymbolSourceRangeEndParam) MarshalJSON

func (r SymbolSourceRangeEndParam) MarshalJSON() (data []byte, err error)

type SymbolSourceRangeParam

type SymbolSourceRangeParam struct {
	End   param.Field[SymbolSourceRangeEndParam]   `json:"end,required"`
	Start param.Field[SymbolSourceRangeStartParam] `json:"start,required"`
}

func (SymbolSourceRangeParam) MarshalJSON

func (r SymbolSourceRangeParam) MarshalJSON() (data []byte, err error)

type SymbolSourceRangeStart

type SymbolSourceRangeStart struct {
	Character float64                    `json:"character,required"`
	Line      float64                    `json:"line,required"`
	JSON      symbolSourceRangeStartJSON `json:"-"`
}

func (*SymbolSourceRangeStart) UnmarshalJSON

func (r *SymbolSourceRangeStart) UnmarshalJSON(data []byte) (err error)

type SymbolSourceRangeStartParam

type SymbolSourceRangeStartParam struct {
	Character param.Field[float64] `json:"character,required"`
	Line      param.Field[float64] `json:"line,required"`
}

func (SymbolSourceRangeStartParam) MarshalJSON

func (r SymbolSourceRangeStartParam) MarshalJSON() (data []byte, err error)

type SymbolSourceType

type SymbolSourceType string
const (
	SymbolSourceTypeSymbol SymbolSourceType = "symbol"
)

func (SymbolSourceType) IsKnown

func (r SymbolSourceType) IsKnown() bool

type TextPart

type TextPart struct {
	ID        string       `json:"id,required"`
	MessageID string       `json:"messageID,required"`
	SessionID string       `json:"sessionID,required"`
	Text      string       `json:"text,required"`
	Type      TextPartType `json:"type,required"`
	Synthetic bool         `json:"synthetic"`
	Time      TextPartTime `json:"time"`
	JSON      textPartJSON `json:"-"`
}

func (*TextPart) UnmarshalJSON

func (r *TextPart) UnmarshalJSON(data []byte) (err error)

type TextPartInputParam

type TextPartInputParam struct {
	Text      param.Field[string]                 `json:"text,required"`
	Type      param.Field[TextPartInputType]      `json:"type,required"`
	ID        param.Field[string]                 `json:"id"`
	Synthetic param.Field[bool]                   `json:"synthetic"`
	Time      param.Field[TextPartInputTimeParam] `json:"time"`
}

func (TextPartInputParam) MarshalJSON

func (r TextPartInputParam) MarshalJSON() (data []byte, err error)

type TextPartInputTimeParam

type TextPartInputTimeParam struct {
	Start param.Field[float64] `json:"start,required"`
	End   param.Field[float64] `json:"end"`
}

func (TextPartInputTimeParam) MarshalJSON

func (r TextPartInputTimeParam) MarshalJSON() (data []byte, err error)

type TextPartInputType

type TextPartInputType string
const (
	TextPartInputTypeText TextPartInputType = "text"
)

func (TextPartInputType) IsKnown

func (r TextPartInputType) IsKnown() bool

type TextPartTime

type TextPartTime struct {
	Start float64          `json:"start,required"`
	End   float64          `json:"end"`
	JSON  textPartTimeJSON `json:"-"`
}

func (*TextPartTime) UnmarshalJSON

func (r *TextPartTime) UnmarshalJSON(data []byte) (err error)

type TextPartType

type TextPartType string
const (
	TextPartTypeText TextPartType = "text"
)

func (TextPartType) IsKnown

func (r TextPartType) IsKnown() bool

type ToolPart

type ToolPart struct {
	ID        string        `json:"id,required"`
	CallID    string        `json:"callID,required"`
	MessageID string        `json:"messageID,required"`
	SessionID string        `json:"sessionID,required"`
	State     ToolPartState `json:"state,required"`
	Tool      string        `json:"tool,required"`
	Type      ToolPartType  `json:"type,required"`
	JSON      toolPartJSON  `json:"-"`
}

func (*ToolPart) UnmarshalJSON

func (r *ToolPart) UnmarshalJSON(data []byte) (err error)

type ToolPartState

type ToolPartState struct {
	Status ToolPartStateStatus `json:"status,required"`
	Error  string              `json:"error"`
	// This field can have the runtime type of [interface{}], [map[string]interface{}].
	Input interface{} `json:"input"`
	// This field can have the runtime type of [map[string]interface{}].
	Metadata interface{} `json:"metadata"`
	Output   string      `json:"output"`
	// This field can have the runtime type of [ToolStateRunningTime],
	// [ToolStateCompletedTime], [ToolStateErrorTime].
	Time  interface{}       `json:"time"`
	Title string            `json:"title"`
	JSON  toolPartStateJSON `json:"-"`
	// contains filtered or unexported fields
}

func (ToolPartState) AsUnion

func (r ToolPartState) AsUnion() ToolPartStateUnion

AsUnion returns a ToolPartStateUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are ToolStatePending, ToolStateRunning, ToolStateCompleted, ToolStateError.

func (*ToolPartState) UnmarshalJSON

func (r *ToolPartState) UnmarshalJSON(data []byte) (err error)

type ToolPartStateStatus

type ToolPartStateStatus string
const (
	ToolPartStateStatusPending   ToolPartStateStatus = "pending"
	ToolPartStateStatusRunning   ToolPartStateStatus = "running"
	ToolPartStateStatusCompleted ToolPartStateStatus = "completed"
	ToolPartStateStatusError     ToolPartStateStatus = "error"
)

func (ToolPartStateStatus) IsKnown

func (r ToolPartStateStatus) IsKnown() bool

type ToolPartStateUnion

type ToolPartStateUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by ToolStatePending, ToolStateRunning, ToolStateCompleted or ToolStateError.

type ToolPartType

type ToolPartType string
const (
	ToolPartTypeTool ToolPartType = "tool"
)

func (ToolPartType) IsKnown

func (r ToolPartType) IsKnown() bool

type ToolStateCompleted

type ToolStateCompleted struct {
	Input    map[string]interface{}   `json:"input,required"`
	Metadata map[string]interface{}   `json:"metadata,required"`
	Output   string                   `json:"output,required"`
	Status   ToolStateCompletedStatus `json:"status,required"`
	Time     ToolStateCompletedTime   `json:"time,required"`
	Title    string                   `json:"title,required"`
	JSON     toolStateCompletedJSON   `json:"-"`
}

func (*ToolStateCompleted) UnmarshalJSON

func (r *ToolStateCompleted) UnmarshalJSON(data []byte) (err error)

type ToolStateCompletedStatus

type ToolStateCompletedStatus string
const (
	ToolStateCompletedStatusCompleted ToolStateCompletedStatus = "completed"
)

func (ToolStateCompletedStatus) IsKnown

func (r ToolStateCompletedStatus) IsKnown() bool

type ToolStateCompletedTime

type ToolStateCompletedTime struct {
	End       float64                    `json:"end,required"`
	Start     float64                    `json:"start,required"`
	Compacted float64                    `json:"compacted"`
	JSON      toolStateCompletedTimeJSON `json:"-"`
}

func (*ToolStateCompletedTime) UnmarshalJSON

func (r *ToolStateCompletedTime) UnmarshalJSON(data []byte) (err error)

type ToolStateError

type ToolStateError struct {
	Error    string                 `json:"error,required"`
	Input    map[string]interface{} `json:"input,required"`
	Status   ToolStateErrorStatus   `json:"status,required"`
	Time     ToolStateErrorTime     `json:"time,required"`
	Metadata map[string]interface{} `json:"metadata"`
	JSON     toolStateErrorJSON     `json:"-"`
}

func (*ToolStateError) UnmarshalJSON

func (r *ToolStateError) UnmarshalJSON(data []byte) (err error)

type ToolStateErrorStatus

type ToolStateErrorStatus string
const (
	ToolStateErrorStatusError ToolStateErrorStatus = "error"
)

func (ToolStateErrorStatus) IsKnown

func (r ToolStateErrorStatus) IsKnown() bool

type ToolStateErrorTime

type ToolStateErrorTime struct {
	End   float64                `json:"end,required"`
	Start float64                `json:"start,required"`
	JSON  toolStateErrorTimeJSON `json:"-"`
}

func (*ToolStateErrorTime) UnmarshalJSON

func (r *ToolStateErrorTime) UnmarshalJSON(data []byte) (err error)

type ToolStatePending

type ToolStatePending struct {
	Status ToolStatePendingStatus `json:"status,required"`
	JSON   toolStatePendingJSON   `json:"-"`
}

func (*ToolStatePending) UnmarshalJSON

func (r *ToolStatePending) UnmarshalJSON(data []byte) (err error)

type ToolStatePendingStatus

type ToolStatePendingStatus string
const (
	ToolStatePendingStatusPending ToolStatePendingStatus = "pending"
)

func (ToolStatePendingStatus) IsKnown

func (r ToolStatePendingStatus) IsKnown() bool

type ToolStateRunning

type ToolStateRunning struct {
	Input    interface{}            `json:"input,required"`
	Status   ToolStateRunningStatus `json:"status,required"`
	Time     ToolStateRunningTime   `json:"time,required"`
	Metadata map[string]interface{} `json:"metadata"`
	Title    string                 `json:"title"`
	JSON     toolStateRunningJSON   `json:"-"`
}

func (*ToolStateRunning) UnmarshalJSON

func (r *ToolStateRunning) UnmarshalJSON(data []byte) (err error)

type ToolStateRunningStatus

type ToolStateRunningStatus string
const (
	ToolStateRunningStatusRunning ToolStateRunningStatus = "running"
)

func (ToolStateRunningStatus) IsKnown

func (r ToolStateRunningStatus) IsKnown() bool

type ToolStateRunningTime

type ToolStateRunningTime struct {
	Start float64                  `json:"start,required"`
	JSON  toolStateRunningTimeJSON `json:"-"`
}

func (*ToolStateRunningTime) UnmarshalJSON

func (r *ToolStateRunningTime) UnmarshalJSON(data []byte) (err error)

type TuiAppendPromptParams

type TuiAppendPromptParams struct {
	Text      param.Field[string] `json:"text,required"`
	Directory param.Field[string] `query:"directory"`
}

func (TuiAppendPromptParams) MarshalJSON

func (r TuiAppendPromptParams) MarshalJSON() (data []byte, err error)

func (TuiAppendPromptParams) URLQuery added in v0.5.0

func (r TuiAppendPromptParams) URLQuery() (v url.Values)

URLQuery serializes TuiAppendPromptParams's query parameters as `url.Values`.

type TuiClearPromptParams added in v0.5.0

type TuiClearPromptParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (TuiClearPromptParams) URLQuery added in v0.5.0

func (r TuiClearPromptParams) URLQuery() (v url.Values)

URLQuery serializes TuiClearPromptParams's query parameters as `url.Values`.

type TuiExecuteCommandParams

type TuiExecuteCommandParams struct {
	Command   param.Field[string] `json:"command,required"`
	Directory param.Field[string] `query:"directory"`
}

func (TuiExecuteCommandParams) MarshalJSON

func (r TuiExecuteCommandParams) MarshalJSON() (data []byte, err error)

func (TuiExecuteCommandParams) URLQuery added in v0.5.0

func (r TuiExecuteCommandParams) URLQuery() (v url.Values)

URLQuery serializes TuiExecuteCommandParams's query parameters as `url.Values`.

type TuiOpenHelpParams added in v0.5.0

type TuiOpenHelpParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (TuiOpenHelpParams) URLQuery added in v0.5.0

func (r TuiOpenHelpParams) URLQuery() (v url.Values)

URLQuery serializes TuiOpenHelpParams's query parameters as `url.Values`.

type TuiOpenModelsParams added in v0.5.0

type TuiOpenModelsParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (TuiOpenModelsParams) URLQuery added in v0.5.0

func (r TuiOpenModelsParams) URLQuery() (v url.Values)

URLQuery serializes TuiOpenModelsParams's query parameters as `url.Values`.

type TuiOpenSessionsParams added in v0.5.0

type TuiOpenSessionsParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (TuiOpenSessionsParams) URLQuery added in v0.5.0

func (r TuiOpenSessionsParams) URLQuery() (v url.Values)

URLQuery serializes TuiOpenSessionsParams's query parameters as `url.Values`.

type TuiOpenThemesParams added in v0.5.0

type TuiOpenThemesParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (TuiOpenThemesParams) URLQuery added in v0.5.0

func (r TuiOpenThemesParams) URLQuery() (v url.Values)

URLQuery serializes TuiOpenThemesParams's query parameters as `url.Values`.

type TuiService

type TuiService struct {
	Options []option.RequestOption
}

TuiService contains methods and other services that help with interacting with the opencode API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTuiService method instead.

func NewTuiService

func NewTuiService(opts ...option.RequestOption) (r *TuiService)

NewTuiService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TuiService) AppendPrompt

func (r *TuiService) AppendPrompt(ctx context.Context, params TuiAppendPromptParams, opts ...option.RequestOption) (res *bool, err error)

Append prompt to the TUI

func (*TuiService) ClearPrompt

func (r *TuiService) ClearPrompt(ctx context.Context, body TuiClearPromptParams, opts ...option.RequestOption) (res *bool, err error)

Clear the prompt

func (*TuiService) ExecuteCommand

func (r *TuiService) ExecuteCommand(ctx context.Context, params TuiExecuteCommandParams, opts ...option.RequestOption) (res *bool, err error)

Execute a TUI command (e.g. agent_cycle)

func (*TuiService) OpenHelp

func (r *TuiService) OpenHelp(ctx context.Context, body TuiOpenHelpParams, opts ...option.RequestOption) (res *bool, err error)

Open the help dialog

func (*TuiService) OpenModels

func (r *TuiService) OpenModels(ctx context.Context, body TuiOpenModelsParams, opts ...option.RequestOption) (res *bool, err error)

Open the model dialog

func (*TuiService) OpenSessions

func (r *TuiService) OpenSessions(ctx context.Context, body TuiOpenSessionsParams, opts ...option.RequestOption) (res *bool, err error)

Open the session dialog

func (*TuiService) OpenThemes

func (r *TuiService) OpenThemes(ctx context.Context, body TuiOpenThemesParams, opts ...option.RequestOption) (res *bool, err error)

Open the theme dialog

func (*TuiService) ShowToast

func (r *TuiService) ShowToast(ctx context.Context, params TuiShowToastParams, opts ...option.RequestOption) (res *bool, err error)

Show a toast notification in the TUI

func (*TuiService) SubmitPrompt

func (r *TuiService) SubmitPrompt(ctx context.Context, body TuiSubmitPromptParams, opts ...option.RequestOption) (res *bool, err error)

Submit the prompt

type TuiShowToastParams

type TuiShowToastParams struct {
	Message   param.Field[string]                    `json:"message,required"`
	Variant   param.Field[TuiShowToastParamsVariant] `json:"variant,required"`
	Directory param.Field[string]                    `query:"directory"`
	Title     param.Field[string]                    `json:"title"`
}

func (TuiShowToastParams) MarshalJSON

func (r TuiShowToastParams) MarshalJSON() (data []byte, err error)

func (TuiShowToastParams) URLQuery added in v0.5.0

func (r TuiShowToastParams) URLQuery() (v url.Values)

URLQuery serializes TuiShowToastParams's query parameters as `url.Values`.

type TuiShowToastParamsVariant

type TuiShowToastParamsVariant string
const (
	TuiShowToastParamsVariantInfo    TuiShowToastParamsVariant = "info"
	TuiShowToastParamsVariantSuccess TuiShowToastParamsVariant = "success"
	TuiShowToastParamsVariantWarning TuiShowToastParamsVariant = "warning"
	TuiShowToastParamsVariantError   TuiShowToastParamsVariant = "error"
)

func (TuiShowToastParamsVariant) IsKnown

func (r TuiShowToastParamsVariant) IsKnown() bool

type TuiSubmitPromptParams added in v0.5.0

type TuiSubmitPromptParams struct {
	Directory param.Field[string] `query:"directory"`
}

func (TuiSubmitPromptParams) URLQuery added in v0.5.0

func (r TuiSubmitPromptParams) URLQuery() (v url.Values)

URLQuery serializes TuiSubmitPromptParams's query parameters as `url.Values`.

type UnknownError

type UnknownError = shared.UnknownError

This is an alias to an internal type.

type UnknownErrorData

type UnknownErrorData = shared.UnknownErrorData

This is an alias to an internal type.

type UnknownErrorName

type UnknownErrorName = shared.UnknownErrorName

This is an alias to an internal type.

type UserMessage

type UserMessage struct {
	ID        string          `json:"id,required"`
	Role      UserMessageRole `json:"role,required"`
	SessionID string          `json:"sessionID,required"`
	Time      UserMessageTime `json:"time,required"`
	JSON      userMessageJSON `json:"-"`
}

func (*UserMessage) UnmarshalJSON

func (r *UserMessage) UnmarshalJSON(data []byte) (err error)

type UserMessageRole

type UserMessageRole string
const (
	UserMessageRoleUser UserMessageRole = "user"
)

func (UserMessageRole) IsKnown

func (r UserMessageRole) IsKnown() bool

type UserMessageTime

type UserMessageTime struct {
	Created float64             `json:"created,required"`
	JSON    userMessageTimeJSON `json:"-"`
}

func (*UserMessageTime) UnmarshalJSON

func (r *UserMessageTime) UnmarshalJSON(data []byte) (err error)

Directories

Path Synopsis
packages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL