mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
zod v4
This commit is contained in:
parent
20ea77d567
commit
c031d1f1b8
39 changed files with 1031 additions and 390 deletions
4
bun.lock
4
bun.lock
|
|
@ -115,7 +115,7 @@
|
|||
"diff": "8.0.2",
|
||||
"gray-matter": "4.0.3",
|
||||
"hono": "catalog:",
|
||||
"hono-openapi": "1.0.6",
|
||||
"hono-openapi": "1.0.7",
|
||||
"ignore": "7.0.5",
|
||||
"jsonc-parser": "3.3.1",
|
||||
"minimatch": "10.0.3",
|
||||
|
|
@ -1763,7 +1763,7 @@
|
|||
|
||||
"hono": ["hono@4.7.10", "", {}, "sha512-QkACju9MiN59CKSY5JsGZCYmPZkA6sIW6OFCUp7qDjZu6S6KHtJHhAc9Uy9mV9F8PJ1/HQ3ybZF2yjCa/73fvQ=="],
|
||||
|
||||
"hono-openapi": ["hono-openapi@1.0.6", "", { "peerDependencies": { "@hono/standard-validator": "^0.1.2", "@standard-community/standard-json": "^0.3.1", "@standard-community/standard-openapi": "^0.2.3", "@types/json-schema": "^7.0.15", "hono": "^4.8.3", "openapi-types": "^12.1.3" }, "optionalPeers": ["@hono/standard-validator", "hono"] }, "sha512-xNxpB9RcyPKAmH/yQMFeEEo6ugbFKaIrCEhaEqsPdVQjx+RFu5+VhNY6Q7+pzQiI+fb/0h/ug4hIu728Mpd5xw=="],
|
||||
"hono-openapi": ["hono-openapi@1.0.7", "", { "peerDependencies": { "@hono/standard-validator": "^0.1.2", "@standard-community/standard-json": "^0.3.1", "@standard-community/standard-openapi": "^0.2.4", "@types/json-schema": "^7.0.15", "hono": "^4.8.3", "openapi-types": "^12.1.3" }, "optionalPeers": ["@hono/standard-validator", "hono"] }, "sha512-rMn+nn4/HMisyi549L3zT7WCmVvmpiKsyt790GcGfqvJf9mJfhq6txw09l0IhSBxpJpA0pXVKxFijcsnGfshUA=="],
|
||||
|
||||
"hookable": ["hookable@5.5.3", "", {}, "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ=="],
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
"diff": "8.0.2",
|
||||
"gray-matter": "4.0.3",
|
||||
"hono": "catalog:",
|
||||
"hono-openapi": "1.0.6",
|
||||
"hono-openapi": "1.0.7",
|
||||
"ignore": "7.0.5",
|
||||
"jsonc-parser": "3.3.1",
|
||||
"minimatch": "10.0.3",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { ModelMessage } from "ai"
|
||||
import { unique } from "remeda"
|
||||
import type { JSONSchema } from "zod/v4/core"
|
||||
|
||||
export namespace ProviderTransform {
|
||||
function normalizeToolCallIds(msgs: ModelMessage[]): ModelMessage[] {
|
||||
|
|
@ -112,4 +113,27 @@ export namespace ProviderTransform {
|
|||
}
|
||||
return outputLimit
|
||||
}
|
||||
|
||||
export function schema(providerID: string, _modelID: string, schema: JSONSchema.BaseSchema) {
|
||||
if (["openai", "azure"].includes(providerID)) {
|
||||
if (schema.type === "object" && schema.properties) {
|
||||
for (const [key, value] of Object.entries(schema.properties)) {
|
||||
if (schema.required?.includes(key)) continue
|
||||
schema.properties[key] = {
|
||||
anyOf: [
|
||||
value as JSONSchema.JSONSchema,
|
||||
{
|
||||
type: "null",
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (providerID === "google") {
|
||||
}
|
||||
|
||||
return schema
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import {
|
|||
type StreamTextResult,
|
||||
LoadAPIKeyError,
|
||||
stepCountIs,
|
||||
jsonSchema,
|
||||
} from "ai"
|
||||
import { SessionCompaction } from "./compaction"
|
||||
import { Instance } from "../project/instance"
|
||||
|
|
@ -393,10 +394,11 @@ export namespace SessionPrompt {
|
|||
)
|
||||
for (const item of await ToolRegistry.tools(input.providerID, input.modelID)) {
|
||||
if (Wildcard.all(item.id, enabledTools) === false) continue
|
||||
const schema = ProviderTransform.schema(input.providerID, input.modelID, z.toJSONSchema(item.parameters))
|
||||
tools[item.id] = tool({
|
||||
id: item.id as any,
|
||||
description: item.description,
|
||||
inputSchema: item.parameters as z.core.$ZodType,
|
||||
inputSchema: jsonSchema(schema as any),
|
||||
async execute(args, options) {
|
||||
await Plugin.trigger(
|
||||
"tool.execute.before",
|
||||
|
|
|
|||
|
|
@ -124,35 +124,13 @@ export namespace ToolRegistry {
|
|||
return allTools().map((t) => t.id)
|
||||
}
|
||||
|
||||
export async function tools(providerID: string, _modelID: string) {
|
||||
export async function tools(_providerID: string, _modelID: string) {
|
||||
const result = await Promise.all(
|
||||
allTools().map(async (t) => ({
|
||||
id: t.id,
|
||||
...(await t.init()),
|
||||
})),
|
||||
)
|
||||
|
||||
if (providerID === "openai") {
|
||||
return result.map((t) => ({
|
||||
...t,
|
||||
parameters: optionalToNullable(t.parameters as unknown as z.ZodTypeAny),
|
||||
}))
|
||||
}
|
||||
|
||||
if (providerID === "azure") {
|
||||
return result.map((t) => ({
|
||||
...t,
|
||||
parameters: optionalToNullable(t.parameters as unknown as z.ZodTypeAny),
|
||||
}))
|
||||
}
|
||||
|
||||
if (providerID === "google") {
|
||||
return result.map((t) => ({
|
||||
...t,
|
||||
parameters: sanitizeGeminiParameters(t.parameters as unknown as z.ZodTypeAny),
|
||||
}))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
@ -179,22 +157,14 @@ export namespace ToolRegistry {
|
|||
return result
|
||||
}
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
function sanitizeGeminiParameters(schema: z.ZodTypeAny, visited = new Set<z.ZodTypeAny>()): z.ZodTypeAny {
|
||||
=======
|
||||
function sanitizeGeminiParameters(schema: z.ZodType, visited = new Set()): z.ZodType {
|
||||
>>>>>>> Stashed changes
|
||||
if (!schema || visited.has(schema)) {
|
||||
return schema
|
||||
}
|
||||
visited.add(schema)
|
||||
|
||||
if (schema instanceof z.ZodDefault) {
|
||||
<<<<<<< Updated upstream
|
||||
const innerSchema = schema._def.innerType
|
||||
=======
|
||||
const innerSchema = schema.unwrap()
|
||||
>>>>>>> Stashed changes
|
||||
// Handle Gemini's incompatibility with `default` on `anyOf` (unions).
|
||||
if (innerSchema instanceof z.ZodUnion) {
|
||||
// The schema was `z.union(...).default(...)`, which is not allowed.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { StandardSchemaV1 } from "@standard-schema/spec"
|
||||
import z from "zod/v4"
|
||||
|
||||
export namespace Tool {
|
||||
interface Metadata {
|
||||
|
|
@ -13,13 +13,13 @@ export namespace Tool {
|
|||
extra?: { [key: string]: any }
|
||||
metadata(input: { title?: string; metadata?: M }): void
|
||||
}
|
||||
export interface Info<Parameters extends StandardSchemaV1 = StandardSchemaV1, M extends Metadata = Metadata> {
|
||||
export interface Info<Parameters extends z.ZodType = z.ZodType, M extends Metadata = Metadata> {
|
||||
id: string
|
||||
init: () => Promise<{
|
||||
description: string
|
||||
parameters: Parameters
|
||||
execute(
|
||||
args: StandardSchemaV1.InferOutput<Parameters>,
|
||||
args: z.infer<Parameters>,
|
||||
ctx: Context,
|
||||
): Promise<{
|
||||
title: string
|
||||
|
|
@ -29,7 +29,7 @@ export namespace Tool {
|
|||
}>
|
||||
}
|
||||
|
||||
export function define<Parameters extends StandardSchemaV1, Result extends Metadata>(
|
||||
export function define<Parameters extends z.ZodType, Result extends Metadata>(
|
||||
id: string,
|
||||
init: Info<Parameters, Result>["init"] | Awaited<ReturnType<Info<Parameters, Result>["init"]>>,
|
||||
): Info<Parameters, Result> {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
".": "0.11.0"
|
||||
".": "0.13.0"
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
configured_endpoints: 43
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-d1a2891c87707259c57fd32c028d77d7c393b231aa416bffe9b2823827d8a223.yml
|
||||
openapi_spec_hash: ffbe4c04e3ac5c84a1ee93a6afb8e1a1
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-2e754dafcad0636137256cef499b2bcd72cf17de08f44ec03c3589b2a05341a2.yml
|
||||
openapi_spec_hash: 2d3cf84d3033068ce6c07386411527ef
|
||||
config_hash: 026ef000d34bf2f930e7b41e77d2d3ff
|
||||
|
|
|
|||
|
|
@ -1,5 +1,21 @@
|
|||
# Changelog
|
||||
|
||||
## 0.13.0 (2025-09-14)
|
||||
|
||||
Full Changelog: [v0.12.0...v0.13.0](https://github.com/sst/opencode-sdk-go/compare/v0.12.0...v0.13.0)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([80da4fb](https://github.com/sst/opencode-sdk-go/commit/80da4fb4ea9c6afb51a7e7135d9f5560ce6f2a6c))
|
||||
|
||||
## 0.12.0 (2025-09-14)
|
||||
|
||||
Full Changelog: [v0.11.0...v0.12.0](https://github.com/sst/opencode-sdk-go/compare/v0.11.0...v0.12.0)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([7e3808b](https://github.com/sst/opencode-sdk-go/commit/7e3808ba349dc653174b32b48a1120c18d2975c2))
|
||||
|
||||
## 0.11.0 (2025-09-14)
|
||||
|
||||
Full Changelog: [v0.10.0...v0.11.0](https://github.com/sst/opencode-sdk-go/compare/v0.10.0...v0.11.0)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Or to pin the version:
|
|||
<!-- x-release-please-start-version -->
|
||||
|
||||
```sh
|
||||
go get -u 'github.com/sst/opencode-sdk-go@v0.11.0'
|
||||
go get -u 'github.com/sst/opencode-sdk-go@v0.13.0'
|
||||
```
|
||||
|
||||
<!-- x-release-please-end -->
|
||||
|
|
@ -49,7 +49,7 @@ import (
|
|||
|
||||
func main() {
|
||||
client := opencode.NewClient()
|
||||
sessions, err := client.Session.List(context.TODO())
|
||||
sessions, err := client.Session.List(context.TODO(), opencode.SessionListParams{})
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ When the API returns a non-success status code, we return an error with type
|
|||
To handle errors, we recommend that you use the `errors.As` pattern:
|
||||
|
||||
```go
|
||||
_, err := client.Session.List(context.TODO())
|
||||
_, err := client.Session.List(context.TODO(), opencode.SessionListParams{})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -198,6 +198,7 @@ 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),
|
||||
)
|
||||
|
|
@ -231,7 +232,11 @@ client := opencode.NewClient(
|
|||
)
|
||||
|
||||
// Override per-request:
|
||||
client.Session.List(context.TODO(), option.WithMaxRetries(5))
|
||||
client.Session.List(
|
||||
context.TODO(),
|
||||
opencode.SessionListParams{},
|
||||
option.WithMaxRetries(5),
|
||||
)
|
||||
```
|
||||
|
||||
### Accessing raw response data (e.g. response headers)
|
||||
|
|
@ -242,7 +247,11 @@ you need to examine response headers, status codes, or other details.
|
|||
```go
|
||||
// Create a variable to store the HTTP response
|
||||
var response *http.Response
|
||||
sessions, err := client.Session.List(context.TODO(), option.WithResponseInto(&response))
|
||||
sessions, err := client.Session.List(
|
||||
context.TODO(),
|
||||
opencode.SessionListParams{},
|
||||
option.WithResponseInto(&response),
|
||||
)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@ package opencode
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/sst/opencode-sdk-go/internal/apijson"
|
||||
"github.com/sst/opencode-sdk-go/internal/apiquery"
|
||||
"github.com/sst/opencode-sdk-go/internal/param"
|
||||
"github.com/sst/opencode-sdk-go/internal/requestconfig"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
|
@ -31,10 +34,10 @@ func NewAgentService(opts ...option.RequestOption) (r *AgentService) {
|
|||
}
|
||||
|
||||
// List all agents
|
||||
func (r *AgentService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Agent, err error) {
|
||||
func (r *AgentService) List(ctx context.Context, query AgentListParams, opts ...option.RequestOption) (res *[]Agent, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "agent"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -187,3 +190,15 @@ func (r *AgentModel) UnmarshalJSON(data []byte) (err error) {
|
|||
func (r agentModelJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type AgentListParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [AgentListParams]'s query parameters as `url.Values`.
|
||||
func (r AgentListParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
func TestAgentList(t *testing.T) {
|
||||
func TestAgentListWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -25,7 +25,9 @@ func TestAgentList(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Agent.List(context.TODO())
|
||||
_, err := client.Agent.List(context.TODO(), opencode.AgentListParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Response Types:
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="get /event">client.Event.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#EventService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#EventListResponse">EventListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /event">client.Event.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#EventService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#EventListParams">EventListParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#EventListResponse">EventListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# Path
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ Response Types:
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="get /path">client.Path.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#PathService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Path">Path</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /path">client.Path.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#PathService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#PathGetParams">PathGetParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Path">Path</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# App
|
||||
|
||||
|
|
@ -34,8 +34,8 @@ Response Types:
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="post /log">client.App.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AppService.Log">Log</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AppLogParams">AppLogParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /config/providers">client.App.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AppService.Providers">Providers</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AppProvidersResponse">AppProvidersResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /log">client.App.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AppService.Log">Log</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AppLogParams">AppLogParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /config/providers">client.App.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AppService.Providers">Providers</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AppProvidersParams">AppProvidersParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AppProvidersResponse">AppProvidersResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# Agent
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ Response Types:
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="get /agent">client.Agent.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AgentService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Agent">Agent</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /agent">client.Agent.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AgentService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AgentListParams">AgentListParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Agent">Agent</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# Find
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ Methods:
|
|||
|
||||
- <code title="get /file">client.File.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FileService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FileListParams">FileListParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FileNode">FileNode</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /file/content">client.File.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FileService.Read">Read</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FileReadParams">FileReadParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FileReadResponse">FileReadResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /file/status">client.File.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FileService.Status">Status</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#File">File</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /file/status">client.File.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FileService.Status">Status</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FileStatusParams">FileStatusParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#File">File</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# Config
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ Response Types:
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="get /config">client.Config.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ConfigService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Config">Config</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /config">client.Config.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ConfigService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ConfigGetParams">ConfigGetParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Config">Config</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# Command
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ Response Types:
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="get /command">client.Command.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#CommandService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Command">Command</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /command">client.Command.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#CommandService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#CommandListParams">CommandListParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Command">Command</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# Project
|
||||
|
||||
|
|
@ -105,8 +105,8 @@ Response Types:
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="get /project">client.Project.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ProjectService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Project">Project</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /project/current">client.Project.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ProjectService.Current">Current</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Project">Project</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /project">client.Project.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ProjectService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ProjectListParams">ProjectListParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Project">Project</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /project/current">client.Project.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ProjectService.Current">Current</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ProjectCurrentParams">ProjectCurrentParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Project">Project</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# Session
|
||||
|
||||
|
|
@ -151,23 +151,23 @@ Response Types:
|
|||
Methods:
|
||||
|
||||
- <code title="post /session">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionNewParams">SessionNewParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="patch /session/{id}">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Update">Update</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionUpdateParams">SessionUpdateParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /session">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="delete /session/{id}">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/abort">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Abort">Abort</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /session/{id}/children">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Children">Children</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/command">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Command">Command</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionCommandParams">SessionCommandParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionCommandResponse">SessionCommandResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /session/{id}">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/init">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Init">Init</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionInitParams">SessionInitParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /session/{id}/message/{messageID}">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Message">Message</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, messageID <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionMessageResponse">SessionMessageResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /session/{id}/message">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Messages">Messages</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionMessagesResponse">SessionMessagesResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/message">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Prompt">Prompt</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionPromptParams">SessionPromptParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionPromptResponse">SessionPromptResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/revert">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Revert">Revert</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionRevertParams">SessionRevertParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/share">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Share">Share</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/shell">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Shell">Shell</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionShellParams">SessionShellParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AssistantMessage">AssistantMessage</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/summarize">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Summarize">Summarize</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionSummarizeParams">SessionSummarizeParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/unrevert">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Unrevert">Unrevert</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="delete /session/{id}/share">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Unshare">Unshare</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="patch /session/{id}">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Update">Update</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionUpdateParams">SessionUpdateParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /session">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionListParams">SessionListParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="delete /session/{id}">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionDeleteParams">SessionDeleteParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/abort">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Abort">Abort</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionAbortParams">SessionAbortParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /session/{id}/children">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Children">Children</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionChildrenParams">SessionChildrenParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/command">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Command">Command</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionCommandParams">SessionCommandParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionCommandResponse">SessionCommandResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /session/{id}">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionGetParams">SessionGetParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/init">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Init">Init</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionInitParams">SessionInitParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /session/{id}/message/{messageID}">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Message">Message</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, messageID <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionMessageParams">SessionMessageParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionMessageResponse">SessionMessageResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="get /session/{id}/message">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Messages">Messages</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionMessagesParams">SessionMessagesParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionMessagesResponse">SessionMessagesResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/message">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Prompt">Prompt</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionPromptParams">SessionPromptParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionPromptResponse">SessionPromptResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/revert">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Revert">Revert</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionRevertParams">SessionRevertParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/share">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Share">Share</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionShareParams">SessionShareParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/shell">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Shell">Shell</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionShellParams">SessionShellParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AssistantMessage">AssistantMessage</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/summarize">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Summarize">Summarize</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionSummarizeParams">SessionSummarizeParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/unrevert">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Unrevert">Unrevert</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionUnrevertParams">SessionUnrevertParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="delete /session/{id}/share">client.Session.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionService.Unshare">Unshare</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionUnshareParams">SessionUnshareParams</a>) (<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Session">Session</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
## Permissions
|
||||
|
||||
|
|
@ -177,18 +177,18 @@ Response Types:
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="post /session/{id}/permissions/{permissionID}">client.Session.Permissions.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionPermissionService.Respond">Respond</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, permissionID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionPermissionRespondParams">SessionPermissionRespondParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /session/{id}/permissions/{permissionID}">client.Session.Permissions.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionPermissionService.Respond">Respond</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, permissionID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#SessionPermissionRespondParams">SessionPermissionRespondParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# Tui
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /tui/append-prompt">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.AppendPrompt">AppendPrompt</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiAppendPromptParams">TuiAppendPromptParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/clear-prompt">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.ClearPrompt">ClearPrompt</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/execute-command">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.ExecuteCommand">ExecuteCommand</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiExecuteCommandParams">TuiExecuteCommandParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/open-help">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.OpenHelp">OpenHelp</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/open-models">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.OpenModels">OpenModels</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/open-sessions">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.OpenSessions">OpenSessions</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/open-themes">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.OpenThemes">OpenThemes</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/show-toast">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.ShowToast">ShowToast</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiShowToastParams">TuiShowToastParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/submit-prompt">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.SubmitPrompt">SubmitPrompt</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/append-prompt">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.AppendPrompt">AppendPrompt</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiAppendPromptParams">TuiAppendPromptParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/clear-prompt">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.ClearPrompt">ClearPrompt</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiClearPromptParams">TuiClearPromptParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/execute-command">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.ExecuteCommand">ExecuteCommand</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiExecuteCommandParams">TuiExecuteCommandParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/open-help">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.OpenHelp">OpenHelp</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiOpenHelpParams">TuiOpenHelpParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/open-models">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.OpenModels">OpenModels</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiOpenModelsParams">TuiOpenModelsParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/open-sessions">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.OpenSessions">OpenSessions</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiOpenSessionsParams">TuiOpenSessionsParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/open-themes">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.OpenThemes">OpenThemes</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiOpenThemesParams">TuiOpenThemesParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/show-toast">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.ShowToast">ShowToast</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiShowToastParams">TuiShowToastParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
- <code title="post /tui/submit-prompt">client.Tui.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiService.SubmitPrompt">SubmitPrompt</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TuiSubmitPromptParams">TuiSubmitPromptParams</a>) (<a href="https://pkg.go.dev/builtin#bool">bool</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@ package opencode
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/sst/opencode-sdk-go/internal/apijson"
|
||||
"github.com/sst/opencode-sdk-go/internal/apiquery"
|
||||
"github.com/sst/opencode-sdk-go/internal/param"
|
||||
"github.com/sst/opencode-sdk-go/internal/requestconfig"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
|
|
@ -32,18 +34,18 @@ func NewAppService(opts ...option.RequestOption) (r *AppService) {
|
|||
}
|
||||
|
||||
// Write a log entry to the server logs
|
||||
func (r *AppService) Log(ctx context.Context, body AppLogParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *AppService) Log(ctx context.Context, params AppLogParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "log"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// List all providers
|
||||
func (r *AppService) Providers(ctx context.Context, opts ...option.RequestOption) (res *AppProvidersResponse, err error) {
|
||||
func (r *AppService) Providers(ctx context.Context, query AppProvidersParams, opts ...option.RequestOption) (res *AppProvidersResponse, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "config/providers"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -216,7 +218,8 @@ type AppLogParams struct {
|
|||
// Log message
|
||||
Message param.Field[string] `json:"message,required"`
|
||||
// Service name for the log entry
|
||||
Service param.Field[string] `json:"service,required"`
|
||||
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"`
|
||||
}
|
||||
|
|
@ -225,6 +228,14 @@ func (r AppLogParams) MarshalJSON() (data []byte, err error) {
|
|||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [AppLogParams]'s query parameters as `url.Values`.
|
||||
func (r AppLogParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
// Log level
|
||||
type AppLogParamsLevel string
|
||||
|
||||
|
|
@ -242,3 +253,15 @@ func (r AppLogParamsLevel) IsKnown() bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type AppProvidersParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [AppProvidersParams]'s query parameters as `url.Values`.
|
||||
func (r AppProvidersParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,10 @@ func TestAppLogWithOptionalParams(t *testing.T) {
|
|||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.App.Log(context.TODO(), opencode.AppLogParams{
|
||||
Level: opencode.F(opencode.AppLogParamsLevelDebug),
|
||||
Message: opencode.F("message"),
|
||||
Service: opencode.F("service"),
|
||||
Level: opencode.F(opencode.AppLogParamsLevelDebug),
|
||||
Message: opencode.F("message"),
|
||||
Service: opencode.F("service"),
|
||||
Directory: opencode.F("directory"),
|
||||
Extra: opencode.F(map[string]interface{}{
|
||||
"foo": "bar",
|
||||
}),
|
||||
|
|
@ -42,7 +43,7 @@ func TestAppLogWithOptionalParams(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestAppProviders(t *testing.T) {
|
||||
func TestAppProvidersWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -54,7 +55,9 @@ func TestAppProviders(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.App.Providers(context.TODO())
|
||||
_, err := client.App.Providers(context.TODO(), opencode.AppProvidersParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ func TestUserAgentHeader(t *testing.T) {
|
|||
},
|
||||
}),
|
||||
)
|
||||
client.Session.List(context.Background())
|
||||
client.Session.List(context.Background(), opencode.SessionListParams{})
|
||||
if userAgent != fmt.Sprintf("Opencode/Go %s", internal.PackageVersion) {
|
||||
t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent)
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ func TestRetryAfter(t *testing.T) {
|
|||
},
|
||||
}),
|
||||
)
|
||||
_, err := client.Session.List(context.Background())
|
||||
_, err := client.Session.List(context.Background(), opencode.SessionListParams{})
|
||||
if err == nil {
|
||||
t.Error("Expected there to be a cancel error")
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
|
|||
}),
|
||||
option.WithHeaderDel("X-Stainless-Retry-Count"),
|
||||
)
|
||||
_, err := client.Session.List(context.Background())
|
||||
_, err := client.Session.List(context.Background(), opencode.SessionListParams{})
|
||||
if err == nil {
|
||||
t.Error("Expected there to be a cancel error")
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
|
|||
}),
|
||||
option.WithHeader("X-Stainless-Retry-Count", "42"),
|
||||
)
|
||||
_, err := client.Session.List(context.Background())
|
||||
_, err := client.Session.List(context.Background(), opencode.SessionListParams{})
|
||||
if err == nil {
|
||||
t.Error("Expected there to be a cancel error")
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ func TestRetryAfterMs(t *testing.T) {
|
|||
},
|
||||
}),
|
||||
)
|
||||
_, err := client.Session.List(context.Background())
|
||||
_, err := client.Session.List(context.Background(), opencode.SessionListParams{})
|
||||
if err == nil {
|
||||
t.Error("Expected there to be a cancel error")
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ func TestContextCancel(t *testing.T) {
|
|||
)
|
||||
cancelCtx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
_, err := client.Session.List(cancelCtx)
|
||||
_, err := client.Session.List(cancelCtx, opencode.SessionListParams{})
|
||||
if err == nil {
|
||||
t.Error("Expected there to be a cancel error")
|
||||
}
|
||||
|
|
@ -193,7 +193,7 @@ func TestContextCancelDelay(t *testing.T) {
|
|||
)
|
||||
cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond)
|
||||
defer cancel()
|
||||
_, err := client.Session.List(cancelCtx)
|
||||
_, err := client.Session.List(cancelCtx, opencode.SessionListParams{})
|
||||
if err == nil {
|
||||
t.Error("expected there to be a cancel error")
|
||||
}
|
||||
|
|
@ -218,7 +218,7 @@ func TestContextDeadline(t *testing.T) {
|
|||
},
|
||||
}),
|
||||
)
|
||||
_, err := client.Session.List(deadlineCtx)
|
||||
_, err := client.Session.List(deadlineCtx, opencode.SessionListParams{})
|
||||
if err == nil {
|
||||
t.Error("expected there to be a deadline error")
|
||||
}
|
||||
|
|
@ -262,7 +262,7 @@ func TestContextDeadlineStreaming(t *testing.T) {
|
|||
},
|
||||
}),
|
||||
)
|
||||
stream := client.Event.ListStreaming(deadlineCtx)
|
||||
stream := client.Event.ListStreaming(deadlineCtx, opencode.EventListParams{})
|
||||
for stream.Next() {
|
||||
_ = stream.Current()
|
||||
}
|
||||
|
|
@ -306,7 +306,11 @@ func TestContextDeadlineStreamingWithRequestTimeout(t *testing.T) {
|
|||
},
|
||||
}),
|
||||
)
|
||||
stream := client.Event.ListStreaming(context.Background(), option.WithRequestTimeout((100 * time.Millisecond)))
|
||||
stream := client.Event.ListStreaming(
|
||||
context.Background(),
|
||||
opencode.EventListParams{},
|
||||
option.WithRequestTimeout((100 * time.Millisecond)),
|
||||
)
|
||||
for stream.Next() {
|
||||
_ = stream.Current()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@ package opencode
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/sst/opencode-sdk-go/internal/apijson"
|
||||
"github.com/sst/opencode-sdk-go/internal/apiquery"
|
||||
"github.com/sst/opencode-sdk-go/internal/param"
|
||||
"github.com/sst/opencode-sdk-go/internal/requestconfig"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
|
@ -31,10 +34,10 @@ func NewCommandService(opts ...option.RequestOption) (r *CommandService) {
|
|||
}
|
||||
|
||||
// List all commands
|
||||
func (r *CommandService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Command, err error) {
|
||||
func (r *CommandService) List(ctx context.Context, query CommandListParams, opts ...option.RequestOption) (res *[]Command, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "command"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -67,3 +70,15 @@ func (r *Command) UnmarshalJSON(data []byte) (err error) {
|
|||
func (r commandJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type CommandListParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [CommandListParams]'s query parameters as `url.Values`.
|
||||
func (r CommandListParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
func TestCommandList(t *testing.T) {
|
||||
func TestCommandListWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -25,7 +25,9 @@ func TestCommandList(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Command.List(context.TODO())
|
||||
_, err := client.Command.List(context.TODO(), opencode.CommandListParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,12 @@ package opencode
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"reflect"
|
||||
|
||||
"github.com/sst/opencode-sdk-go/internal/apijson"
|
||||
"github.com/sst/opencode-sdk-go/internal/apiquery"
|
||||
"github.com/sst/opencode-sdk-go/internal/param"
|
||||
"github.com/sst/opencode-sdk-go/internal/requestconfig"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
"github.com/sst/opencode-sdk-go/shared"
|
||||
|
|
@ -34,10 +37,10 @@ func NewConfigService(opts ...option.RequestOption) (r *ConfigService) {
|
|||
}
|
||||
|
||||
// Get config info
|
||||
func (r *ConfigService) Get(ctx context.Context, opts ...option.RequestOption) (res *Config, err error) {
|
||||
func (r *ConfigService) Get(ctx context.Context, query ConfigGetParams, opts ...option.RequestOption) (res *Config, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "config"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -2028,3 +2031,15 @@ func (r McpRemoteConfigType) IsKnown() bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ConfigGetParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [ConfigGetParams]'s query parameters as `url.Values`.
|
||||
func (r ConfigGetParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
func TestConfigGet(t *testing.T) {
|
||||
func TestConfigGetWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -25,7 +25,9 @@ func TestConfigGet(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Config.Get(context.TODO())
|
||||
_, err := client.Config.Get(context.TODO(), opencode.ConfigGetParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,12 @@ package opencode
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"reflect"
|
||||
|
||||
"github.com/sst/opencode-sdk-go/internal/apijson"
|
||||
"github.com/sst/opencode-sdk-go/internal/apiquery"
|
||||
"github.com/sst/opencode-sdk-go/internal/param"
|
||||
"github.com/sst/opencode-sdk-go/internal/requestconfig"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
"github.com/sst/opencode-sdk-go/packages/ssestream"
|
||||
|
|
@ -35,7 +38,7 @@ func NewEventService(opts ...option.RequestOption) (r *EventService) {
|
|||
}
|
||||
|
||||
// Get events
|
||||
func (r *EventService) ListStreaming(ctx context.Context, opts ...option.RequestOption) (stream *ssestream.Stream[EventListResponse]) {
|
||||
func (r *EventService) ListStreaming(ctx context.Context, query EventListParams, opts ...option.RequestOption) (stream *ssestream.Stream[EventListResponse]) {
|
||||
var (
|
||||
raw *http.Response
|
||||
err error
|
||||
|
|
@ -43,7 +46,7 @@ func (r *EventService) ListStreaming(ctx context.Context, opts ...option.Request
|
|||
opts = append(r.Options[:], opts...)
|
||||
opts = append([]option.RequestOption{option.WithHeader("Accept", "text/event-stream")}, opts...)
|
||||
path := "event"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &raw, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &raw, opts...)
|
||||
return ssestream.NewStream[EventListResponse](ssestream.NewDecoder(raw), err)
|
||||
}
|
||||
|
||||
|
|
@ -1220,3 +1223,15 @@ func (r EventListResponseType) IsKnown() bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type EventListParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [EventListParams]'s query parameters as `url.Values`.
|
||||
func (r EventListParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ func (r *FileService) Read(ctx context.Context, query FileReadParams, opts ...op
|
|||
}
|
||||
|
||||
// Get file status
|
||||
func (r *FileService) Status(ctx context.Context, opts ...option.RequestOption) (res *[]File, err error) {
|
||||
func (r *FileService) Status(ctx context.Context, query FileStatusParams, opts ...option.RequestOption) (res *[]File, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "file/status"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -228,7 +228,8 @@ func (r fileReadResponsePatchHunkJSON) RawJSON() string {
|
|||
}
|
||||
|
||||
type FileListParams struct {
|
||||
Path param.Field[string] `query:"path,required"`
|
||||
Path param.Field[string] `query:"path,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [FileListParams]'s query parameters as `url.Values`.
|
||||
|
|
@ -240,7 +241,8 @@ func (r FileListParams) URLQuery() (v url.Values) {
|
|||
}
|
||||
|
||||
type FileReadParams struct {
|
||||
Path param.Field[string] `query:"path,required"`
|
||||
Path param.Field[string] `query:"path,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [FileReadParams]'s query parameters as `url.Values`.
|
||||
|
|
@ -250,3 +252,15 @@ func (r FileReadParams) URLQuery() (v url.Values) {
|
|||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type FileStatusParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [FileStatusParams]'s query parameters as `url.Values`.
|
||||
func (r FileStatusParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
func TestFileList(t *testing.T) {
|
||||
func TestFileListWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -26,7 +26,8 @@ func TestFileList(t *testing.T) {
|
|||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.File.List(context.TODO(), opencode.FileListParams{
|
||||
Path: opencode.F("path"),
|
||||
Path: opencode.F("path"),
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
|
|
@ -37,7 +38,7 @@ func TestFileList(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestFileRead(t *testing.T) {
|
||||
func TestFileReadWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -50,7 +51,8 @@ func TestFileRead(t *testing.T) {
|
|||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.File.Read(context.TODO(), opencode.FileReadParams{
|
||||
Path: opencode.F("path"),
|
||||
Path: opencode.F("path"),
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
|
|
@ -61,7 +63,7 @@ func TestFileRead(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestFileStatus(t *testing.T) {
|
||||
func TestFileStatusWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -73,7 +75,9 @@ func TestFileStatus(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.File.Status(context.TODO())
|
||||
_, err := client.File.Status(context.TODO(), opencode.FileStatusParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
|
|||
|
|
@ -290,7 +290,8 @@ func (r findTextResponseSubmatchesMatchJSON) RawJSON() string {
|
|||
}
|
||||
|
||||
type FindFilesParams struct {
|
||||
Query param.Field[string] `query:"query,required"`
|
||||
Query param.Field[string] `query:"query,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [FindFilesParams]'s query parameters as `url.Values`.
|
||||
|
|
@ -302,7 +303,8 @@ func (r FindFilesParams) URLQuery() (v url.Values) {
|
|||
}
|
||||
|
||||
type FindSymbolsParams struct {
|
||||
Query param.Field[string] `query:"query,required"`
|
||||
Query param.Field[string] `query:"query,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [FindSymbolsParams]'s query parameters as `url.Values`.
|
||||
|
|
@ -314,7 +316,8 @@ func (r FindSymbolsParams) URLQuery() (v url.Values) {
|
|||
}
|
||||
|
||||
type FindTextParams struct {
|
||||
Pattern param.Field[string] `query:"pattern,required"`
|
||||
Pattern param.Field[string] `query:"pattern,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [FindTextParams]'s query parameters as `url.Values`.
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
func TestFindFiles(t *testing.T) {
|
||||
func TestFindFilesWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -26,7 +26,8 @@ func TestFindFiles(t *testing.T) {
|
|||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Find.Files(context.TODO(), opencode.FindFilesParams{
|
||||
Query: opencode.F("query"),
|
||||
Query: opencode.F("query"),
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
|
|
@ -37,7 +38,7 @@ func TestFindFiles(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestFindSymbols(t *testing.T) {
|
||||
func TestFindSymbolsWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -50,7 +51,8 @@ func TestFindSymbols(t *testing.T) {
|
|||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Find.Symbols(context.TODO(), opencode.FindSymbolsParams{
|
||||
Query: opencode.F("query"),
|
||||
Query: opencode.F("query"),
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
|
|
@ -61,7 +63,7 @@ func TestFindSymbols(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestFindText(t *testing.T) {
|
||||
func TestFindTextWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -74,7 +76,8 @@ func TestFindText(t *testing.T) {
|
|||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Find.Text(context.TODO(), opencode.FindTextParams{
|
||||
Pattern: opencode.F("pattern"),
|
||||
Pattern: opencode.F("pattern"),
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
package internal
|
||||
|
||||
const PackageVersion = "0.11.0" // x-release-please-version
|
||||
const PackageVersion = "0.13.0" // x-release-please-version
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@ package opencode
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/sst/opencode-sdk-go/internal/apijson"
|
||||
"github.com/sst/opencode-sdk-go/internal/apiquery"
|
||||
"github.com/sst/opencode-sdk-go/internal/param"
|
||||
"github.com/sst/opencode-sdk-go/internal/requestconfig"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
|
@ -31,10 +34,10 @@ func NewPathService(opts ...option.RequestOption) (r *PathService) {
|
|||
}
|
||||
|
||||
// Get the current path
|
||||
func (r *PathService) Get(ctx context.Context, opts ...option.RequestOption) (res *Path, err error) {
|
||||
func (r *PathService) Get(ctx context.Context, query PathGetParams, opts ...option.RequestOption) (res *Path, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "path"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -63,3 +66,15 @@ func (r *Path) UnmarshalJSON(data []byte) (err error) {
|
|||
func (r pathJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type PathGetParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [PathGetParams]'s query parameters as `url.Values`.
|
||||
func (r PathGetParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
func TestPathGet(t *testing.T) {
|
||||
func TestPathGetWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -25,7 +25,9 @@ func TestPathGet(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Path.Get(context.TODO())
|
||||
_, err := client.Path.Get(context.TODO(), opencode.PathGetParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@ package opencode
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/sst/opencode-sdk-go/internal/apijson"
|
||||
"github.com/sst/opencode-sdk-go/internal/apiquery"
|
||||
"github.com/sst/opencode-sdk-go/internal/param"
|
||||
"github.com/sst/opencode-sdk-go/internal/requestconfig"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
|
@ -31,18 +34,18 @@ func NewProjectService(opts ...option.RequestOption) (r *ProjectService) {
|
|||
}
|
||||
|
||||
// List all projects
|
||||
func (r *ProjectService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Project, err error) {
|
||||
func (r *ProjectService) List(ctx context.Context, query ProjectListParams, opts ...option.RequestOption) (res *[]Project, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "project"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Get the current project
|
||||
func (r *ProjectService) Current(ctx context.Context, opts ...option.RequestOption) (res *Project, err error) {
|
||||
func (r *ProjectService) Current(ctx context.Context, query ProjectCurrentParams, opts ...option.RequestOption) (res *Project, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "project/current"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -107,3 +110,27 @@ func (r ProjectVcs) IsKnown() bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ProjectListParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [ProjectListParams]'s query parameters as `url.Values`.
|
||||
func (r ProjectListParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type ProjectCurrentParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [ProjectCurrentParams]'s query parameters as `url.Values`.
|
||||
func (r ProjectCurrentParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
func TestProjectList(t *testing.T) {
|
||||
func TestProjectListWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -25,7 +25,9 @@ func TestProjectList(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Project.List(context.TODO())
|
||||
_, err := client.Project.List(context.TODO(), opencode.ProjectListParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -35,7 +37,7 @@ func TestProjectList(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestProjectCurrent(t *testing.T) {
|
||||
func TestProjectCurrentWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -47,7 +49,9 @@ func TestProjectCurrent(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Project.Current(context.TODO())
|
||||
_, err := client.Project.Current(context.TODO(), opencode.ProjectCurrentParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
|
|||
|
|
@ -49,99 +49,99 @@ func (r *SessionService) New(ctx context.Context, params SessionNewParams, opts
|
|||
}
|
||||
|
||||
// Update session properties
|
||||
func (r *SessionService) Update(ctx context.Context, id string, body SessionUpdateParams, opts ...option.RequestOption) (res *Session, err error) {
|
||||
func (r *SessionService) Update(ctx context.Context, id string, params SessionUpdateParams, opts ...option.RequestOption) (res *Session, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// List all sessions
|
||||
func (r *SessionService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Session, err error) {
|
||||
func (r *SessionService) List(ctx context.Context, query SessionListParams, opts ...option.RequestOption) (res *[]Session, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "session"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete a session and all its data
|
||||
func (r *SessionService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *SessionService) Delete(ctx context.Context, id string, body SessionDeleteParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Abort a session
|
||||
func (r *SessionService) Abort(ctx context.Context, id string, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *SessionService) Abort(ctx context.Context, id string, body SessionAbortParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/abort", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Get a session's children
|
||||
func (r *SessionService) Children(ctx context.Context, id string, opts ...option.RequestOption) (res *[]Session, err error) {
|
||||
func (r *SessionService) Children(ctx context.Context, id string, query SessionChildrenParams, opts ...option.RequestOption) (res *[]Session, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/children", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Send a new command to a session
|
||||
func (r *SessionService) Command(ctx context.Context, id string, body SessionCommandParams, opts ...option.RequestOption) (res *SessionCommandResponse, err error) {
|
||||
func (r *SessionService) Command(ctx context.Context, id string, params SessionCommandParams, opts ...option.RequestOption) (res *SessionCommandResponse, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/command", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Get session
|
||||
func (r *SessionService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Session, err error) {
|
||||
func (r *SessionService) Get(ctx context.Context, id string, query SessionGetParams, opts ...option.RequestOption) (res *Session, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Analyze the app and create an AGENTS.md file
|
||||
func (r *SessionService) Init(ctx context.Context, id string, body SessionInitParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *SessionService) Init(ctx context.Context, id string, params SessionInitParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/init", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Get a message from a session
|
||||
func (r *SessionService) Message(ctx context.Context, id string, messageID string, opts ...option.RequestOption) (res *SessionMessageResponse, err error) {
|
||||
func (r *SessionService) Message(ctx context.Context, id string, messageID string, query SessionMessageParams, opts ...option.RequestOption) (res *SessionMessageResponse, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
|
|
@ -152,103 +152,103 @@ func (r *SessionService) Message(ctx context.Context, id string, messageID strin
|
|||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/message/%s", id, messageID)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// List messages for a session
|
||||
func (r *SessionService) Messages(ctx context.Context, id string, opts ...option.RequestOption) (res *[]SessionMessagesResponse, err error) {
|
||||
func (r *SessionService) Messages(ctx context.Context, id string, query SessionMessagesParams, opts ...option.RequestOption) (res *[]SessionMessagesResponse, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/message", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Create and send a new message to a session
|
||||
func (r *SessionService) Prompt(ctx context.Context, id string, body SessionPromptParams, opts ...option.RequestOption) (res *SessionPromptResponse, err error) {
|
||||
func (r *SessionService) Prompt(ctx context.Context, id string, params SessionPromptParams, opts ...option.RequestOption) (res *SessionPromptResponse, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/message", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Revert a message
|
||||
func (r *SessionService) Revert(ctx context.Context, id string, body SessionRevertParams, opts ...option.RequestOption) (res *Session, err error) {
|
||||
func (r *SessionService) Revert(ctx context.Context, id string, params SessionRevertParams, opts ...option.RequestOption) (res *Session, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/revert", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Share a session
|
||||
func (r *SessionService) Share(ctx context.Context, id string, opts ...option.RequestOption) (res *Session, err error) {
|
||||
func (r *SessionService) Share(ctx context.Context, id string, body SessionShareParams, opts ...option.RequestOption) (res *Session, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/share", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Run a shell command
|
||||
func (r *SessionService) Shell(ctx context.Context, id string, body SessionShellParams, opts ...option.RequestOption) (res *AssistantMessage, err error) {
|
||||
func (r *SessionService) Shell(ctx context.Context, id string, params SessionShellParams, opts ...option.RequestOption) (res *AssistantMessage, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/shell", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Summarize the session
|
||||
func (r *SessionService) Summarize(ctx context.Context, id string, body SessionSummarizeParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *SessionService) Summarize(ctx context.Context, id string, params SessionSummarizeParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/summarize", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Restore all reverted messages
|
||||
func (r *SessionService) Unrevert(ctx context.Context, id string, opts ...option.RequestOption) (res *Session, err error) {
|
||||
func (r *SessionService) Unrevert(ctx context.Context, id string, body SessionUnrevertParams, opts ...option.RequestOption) (res *Session, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/unrevert", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Unshare the session
|
||||
func (r *SessionService) Unshare(ctx context.Context, id string, opts ...option.RequestOption) (res *Session, err error) {
|
||||
func (r *SessionService) Unshare(ctx context.Context, id string, body SessionUnshareParams, opts ...option.RequestOption) (res *Session, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/share", id)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -2372,7 +2372,7 @@ func (r sessionPromptResponseJSON) RawJSON() string {
|
|||
}
|
||||
|
||||
type SessionNewParams struct {
|
||||
Directory param.Field[string] `query:"directory,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
ParentID param.Field[string] `json:"parentID"`
|
||||
Title param.Field[string] `json:"title"`
|
||||
}
|
||||
|
|
@ -2390,16 +2390,74 @@ func (r SessionNewParams) URLQuery() (v url.Values) {
|
|||
}
|
||||
|
||||
type SessionUpdateParams struct {
|
||||
Title param.Field[string] `json:"title"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
Title param.Field[string] `json:"title"`
|
||||
}
|
||||
|
||||
func (r SessionUpdateParams) MarshalJSON() (data []byte, err error) {
|
||||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionUpdateParams]'s query parameters as `url.Values`.
|
||||
func (r SessionUpdateParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionListParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionListParams]'s query parameters as `url.Values`.
|
||||
func (r SessionListParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionDeleteParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionDeleteParams]'s query parameters as `url.Values`.
|
||||
func (r SessionDeleteParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionAbortParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionAbortParams]'s query parameters as `url.Values`.
|
||||
func (r SessionAbortParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionChildrenParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionChildrenParams]'s query parameters as `url.Values`.
|
||||
func (r SessionChildrenParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
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"`
|
||||
|
|
@ -2409,18 +2467,72 @@ func (r SessionCommandParams) MarshalJSON() (data []byte, err error) {
|
|||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionCommandParams]'s query parameters as `url.Values`.
|
||||
func (r SessionCommandParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionGetParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionGetParams]'s query parameters as `url.Values`.
|
||||
func (r SessionGetParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
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 (r SessionInitParams) MarshalJSON() (data []byte, err error) {
|
||||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionInitParams]'s query parameters as `url.Values`.
|
||||
func (r SessionInitParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionMessageParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionMessageParams]'s query parameters as `url.Values`.
|
||||
func (r SessionMessageParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionMessagesParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionMessagesParams]'s query parameters as `url.Values`.
|
||||
func (r SessionMessagesParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
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"`
|
||||
|
|
@ -2432,6 +2544,14 @@ func (r SessionPromptParams) MarshalJSON() (data []byte, err error) {
|
|||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionPromptParams]'s query parameters as `url.Values`.
|
||||
func (r SessionPromptParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionPromptParamsPart struct {
|
||||
Type param.Field[SessionPromptParamsPartsType] `json:"type,required"`
|
||||
ID param.Field[string] `json:"id"`
|
||||
|
|
@ -2484,6 +2604,7 @@ func (r SessionPromptParamsModel) MarshalJSON() (data []byte, err error) {
|
|||
|
||||
type SessionRevertParams struct {
|
||||
MessageID param.Field[string] `json:"messageID,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
PartID param.Field[string] `json:"partID"`
|
||||
}
|
||||
|
||||
|
|
@ -2491,20 +2612,82 @@ func (r SessionRevertParams) MarshalJSON() (data []byte, err error) {
|
|||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionRevertParams]'s query parameters as `url.Values`.
|
||||
func (r SessionRevertParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionShareParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionShareParams]'s query parameters as `url.Values`.
|
||||
func (r SessionShareParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionShellParams struct {
|
||||
Agent param.Field[string] `json:"agent,required"`
|
||||
Command param.Field[string] `json:"command,required"`
|
||||
Agent param.Field[string] `json:"agent,required"`
|
||||
Command param.Field[string] `json:"command,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
func (r SessionShellParams) MarshalJSON() (data []byte, err error) {
|
||||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionShellParams]'s query parameters as `url.Values`.
|
||||
func (r SessionShellParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionSummarizeParams struct {
|
||||
ModelID param.Field[string] `json:"modelID,required"`
|
||||
ProviderID param.Field[string] `json:"providerID,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
func (r SessionSummarizeParams) MarshalJSON() (data []byte, err error) {
|
||||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionSummarizeParams]'s query parameters as `url.Values`.
|
||||
func (r SessionSummarizeParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionUnrevertParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionUnrevertParams]'s query parameters as `url.Values`.
|
||||
func (r SessionUnrevertParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionUnshareParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionUnshareParams]'s query parameters as `url.Values`.
|
||||
func (r SessionUnshareParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ func TestSessionUpdateWithOptionalParams(t *testing.T) {
|
|||
context.TODO(),
|
||||
"id",
|
||||
opencode.SessionUpdateParams{
|
||||
Title: opencode.F("title"),
|
||||
Directory: opencode.F("directory"),
|
||||
Title: opencode.F("title"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
|
@ -67,7 +68,7 @@ func TestSessionUpdateWithOptionalParams(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionList(t *testing.T) {
|
||||
func TestSessionListWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -79,7 +80,9 @@ func TestSessionList(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Session.List(context.TODO())
|
||||
_, err := client.Session.List(context.TODO(), opencode.SessionListParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -89,7 +92,7 @@ func TestSessionList(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionDelete(t *testing.T) {
|
||||
func TestSessionDeleteWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -101,7 +104,13 @@ func TestSessionDelete(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Session.Delete(context.TODO(), "id")
|
||||
_, err := client.Session.Delete(
|
||||
context.TODO(),
|
||||
"id",
|
||||
opencode.SessionDeleteParams{
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -111,7 +120,7 @@ func TestSessionDelete(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionAbort(t *testing.T) {
|
||||
func TestSessionAbortWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -123,7 +132,13 @@ func TestSessionAbort(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Session.Abort(context.TODO(), "id")
|
||||
_, err := client.Session.Abort(
|
||||
context.TODO(),
|
||||
"id",
|
||||
opencode.SessionAbortParams{
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -133,7 +148,7 @@ func TestSessionAbort(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionChildren(t *testing.T) {
|
||||
func TestSessionChildrenWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -145,7 +160,13 @@ func TestSessionChildren(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Session.Children(context.TODO(), "id")
|
||||
_, err := client.Session.Children(
|
||||
context.TODO(),
|
||||
"id",
|
||||
opencode.SessionChildrenParams{
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -173,6 +194,7 @@ func TestSessionCommandWithOptionalParams(t *testing.T) {
|
|||
opencode.SessionCommandParams{
|
||||
Arguments: opencode.F("arguments"),
|
||||
Command: opencode.F("command"),
|
||||
Directory: opencode.F("directory"),
|
||||
Agent: opencode.F("agent"),
|
||||
MessageID: opencode.F("msgJ!"),
|
||||
Model: opencode.F("model"),
|
||||
|
|
@ -187,7 +209,7 @@ func TestSessionCommandWithOptionalParams(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionGet(t *testing.T) {
|
||||
func TestSessionGetWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -199,7 +221,13 @@ func TestSessionGet(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Session.Get(context.TODO(), "id")
|
||||
_, err := client.Session.Get(
|
||||
context.TODO(),
|
||||
"id",
|
||||
opencode.SessionGetParams{
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -209,7 +237,7 @@ func TestSessionGet(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionInit(t *testing.T) {
|
||||
func TestSessionInitWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -228,6 +256,7 @@ func TestSessionInit(t *testing.T) {
|
|||
MessageID: opencode.F("messageID"),
|
||||
ModelID: opencode.F("modelID"),
|
||||
ProviderID: opencode.F("providerID"),
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
|
@ -239,7 +268,7 @@ func TestSessionInit(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionMessage(t *testing.T) {
|
||||
func TestSessionMessageWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -255,6 +284,9 @@ func TestSessionMessage(t *testing.T) {
|
|||
context.TODO(),
|
||||
"id",
|
||||
"messageID",
|
||||
opencode.SessionMessageParams{
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
|
|
@ -265,7 +297,7 @@ func TestSessionMessage(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionMessages(t *testing.T) {
|
||||
func TestSessionMessagesWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -277,7 +309,13 @@ func TestSessionMessages(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Session.Messages(context.TODO(), "id")
|
||||
_, err := client.Session.Messages(
|
||||
context.TODO(),
|
||||
"id",
|
||||
opencode.SessionMessagesParams{
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -313,6 +351,7 @@ func TestSessionPromptWithOptionalParams(t *testing.T) {
|
|||
End: opencode.F(0.000000),
|
||||
}),
|
||||
}}),
|
||||
Directory: opencode.F("directory"),
|
||||
Agent: opencode.F("agent"),
|
||||
MessageID: opencode.F("msgJ!"),
|
||||
Model: opencode.F(opencode.SessionPromptParamsModel{
|
||||
|
|
@ -351,6 +390,7 @@ func TestSessionRevertWithOptionalParams(t *testing.T) {
|
|||
"id",
|
||||
opencode.SessionRevertParams{
|
||||
MessageID: opencode.F("msgJ!"),
|
||||
Directory: opencode.F("directory"),
|
||||
PartID: opencode.F("prtJ!"),
|
||||
},
|
||||
)
|
||||
|
|
@ -363,7 +403,7 @@ func TestSessionRevertWithOptionalParams(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionShare(t *testing.T) {
|
||||
func TestSessionShareWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -375,7 +415,13 @@ func TestSessionShare(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Session.Share(context.TODO(), "id")
|
||||
_, err := client.Session.Share(
|
||||
context.TODO(),
|
||||
"id",
|
||||
opencode.SessionShareParams{
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -385,7 +431,7 @@ func TestSessionShare(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionShell(t *testing.T) {
|
||||
func TestSessionShellWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -401,8 +447,9 @@ func TestSessionShell(t *testing.T) {
|
|||
context.TODO(),
|
||||
"id",
|
||||
opencode.SessionShellParams{
|
||||
Agent: opencode.F("agent"),
|
||||
Command: opencode.F("command"),
|
||||
Agent: opencode.F("agent"),
|
||||
Command: opencode.F("command"),
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
|
@ -414,7 +461,7 @@ func TestSessionShell(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionSummarize(t *testing.T) {
|
||||
func TestSessionSummarizeWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -432,6 +479,7 @@ func TestSessionSummarize(t *testing.T) {
|
|||
opencode.SessionSummarizeParams{
|
||||
ModelID: opencode.F("modelID"),
|
||||
ProviderID: opencode.F("providerID"),
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
|
@ -443,7 +491,7 @@ func TestSessionSummarize(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionUnrevert(t *testing.T) {
|
||||
func TestSessionUnrevertWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -455,7 +503,13 @@ func TestSessionUnrevert(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Session.Unrevert(context.TODO(), "id")
|
||||
_, err := client.Session.Unrevert(
|
||||
context.TODO(),
|
||||
"id",
|
||||
opencode.SessionUnrevertParams{
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -465,7 +519,7 @@ func TestSessionUnrevert(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSessionUnshare(t *testing.T) {
|
||||
func TestSessionUnshareWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -477,7 +531,13 @@ func TestSessionUnshare(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Session.Unshare(context.TODO(), "id")
|
||||
_, err := client.Session.Unshare(
|
||||
context.TODO(),
|
||||
"id",
|
||||
opencode.SessionUnshareParams{
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/sst/opencode-sdk-go/internal/apijson"
|
||||
"github.com/sst/opencode-sdk-go/internal/apiquery"
|
||||
"github.com/sst/opencode-sdk-go/internal/param"
|
||||
"github.com/sst/opencode-sdk-go/internal/requestconfig"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
|
|
@ -34,7 +36,7 @@ func NewSessionPermissionService(opts ...option.RequestOption) (r *SessionPermis
|
|||
}
|
||||
|
||||
// Respond to a permission request
|
||||
func (r *SessionPermissionService) Respond(ctx context.Context, id string, permissionID string, body SessionPermissionRespondParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *SessionPermissionService) Respond(ctx context.Context, id string, permissionID string, params SessionPermissionRespondParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
if id == "" {
|
||||
err = errors.New("missing required id parameter")
|
||||
|
|
@ -45,7 +47,7 @@ func (r *SessionPermissionService) Respond(ctx context.Context, id string, permi
|
|||
return
|
||||
}
|
||||
path := fmt.Sprintf("session/%s/permissions/%s", id, permissionID)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -106,13 +108,23 @@ func (r permissionTimeJSON) RawJSON() string {
|
|||
}
|
||||
|
||||
type SessionPermissionRespondParams struct {
|
||||
Response param.Field[SessionPermissionRespondParamsResponse] `json:"response,required"`
|
||||
Response param.Field[SessionPermissionRespondParamsResponse] `json:"response,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
func (r SessionPermissionRespondParams) MarshalJSON() (data []byte, err error) {
|
||||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [SessionPermissionRespondParams]'s query parameters as
|
||||
// `url.Values`.
|
||||
func (r SessionPermissionRespondParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type SessionPermissionRespondParamsResponse string
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
func TestSessionPermissionRespond(t *testing.T) {
|
||||
func TestSessionPermissionRespondWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -30,7 +30,8 @@ func TestSessionPermissionRespond(t *testing.T) {
|
|||
"id",
|
||||
"permissionID",
|
||||
opencode.SessionPermissionRespondParams{
|
||||
Response: opencode.F(opencode.SessionPermissionRespondParamsResponseOnce),
|
||||
Response: opencode.F(opencode.SessionPermissionRespondParamsResponseOnce),
|
||||
Directory: opencode.F("directory"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@ package opencode
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/sst/opencode-sdk-go/internal/apijson"
|
||||
"github.com/sst/opencode-sdk-go/internal/apiquery"
|
||||
"github.com/sst/opencode-sdk-go/internal/param"
|
||||
"github.com/sst/opencode-sdk-go/internal/requestconfig"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
|
|
@ -32,103 +34,191 @@ func NewTuiService(opts ...option.RequestOption) (r *TuiService) {
|
|||
}
|
||||
|
||||
// Append prompt to the TUI
|
||||
func (r *TuiService) AppendPrompt(ctx context.Context, body TuiAppendPromptParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *TuiService) AppendPrompt(ctx context.Context, params TuiAppendPromptParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/append-prompt"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Clear the prompt
|
||||
func (r *TuiService) ClearPrompt(ctx context.Context, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *TuiService) ClearPrompt(ctx context.Context, body TuiClearPromptParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/clear-prompt"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Execute a TUI command (e.g. agent_cycle)
|
||||
func (r *TuiService) ExecuteCommand(ctx context.Context, body TuiExecuteCommandParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *TuiService) ExecuteCommand(ctx context.Context, params TuiExecuteCommandParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/execute-command"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Open the help dialog
|
||||
func (r *TuiService) OpenHelp(ctx context.Context, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *TuiService) OpenHelp(ctx context.Context, body TuiOpenHelpParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/open-help"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Open the model dialog
|
||||
func (r *TuiService) OpenModels(ctx context.Context, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/open-models"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Open the session dialog
|
||||
func (r *TuiService) OpenSessions(ctx context.Context, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/open-sessions"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Open the theme dialog
|
||||
func (r *TuiService) OpenThemes(ctx context.Context, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/open-themes"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Show a toast notification in the TUI
|
||||
func (r *TuiService) ShowToast(ctx context.Context, body TuiShowToastParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/show-toast"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Open the model dialog
|
||||
func (r *TuiService) OpenModels(ctx context.Context, body TuiOpenModelsParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/open-models"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Open the session dialog
|
||||
func (r *TuiService) OpenSessions(ctx context.Context, body TuiOpenSessionsParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/open-sessions"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Open the theme dialog
|
||||
func (r *TuiService) OpenThemes(ctx context.Context, body TuiOpenThemesParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/open-themes"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Show a toast notification in the TUI
|
||||
func (r *TuiService) ShowToast(ctx context.Context, params TuiShowToastParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/show-toast"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
// Submit the prompt
|
||||
func (r *TuiService) SubmitPrompt(ctx context.Context, opts ...option.RequestOption) (res *bool, err error) {
|
||||
func (r *TuiService) SubmitPrompt(ctx context.Context, body TuiSubmitPromptParams, opts ...option.RequestOption) (res *bool, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "tui/submit-prompt"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
type TuiAppendPromptParams struct {
|
||||
Text param.Field[string] `json:"text,required"`
|
||||
Text param.Field[string] `json:"text,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
func (r TuiAppendPromptParams) MarshalJSON() (data []byte, err error) {
|
||||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [TuiAppendPromptParams]'s query parameters as `url.Values`.
|
||||
func (r TuiAppendPromptParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type TuiClearPromptParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [TuiClearPromptParams]'s query parameters as `url.Values`.
|
||||
func (r TuiClearPromptParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type TuiExecuteCommandParams struct {
|
||||
Command param.Field[string] `json:"command,required"`
|
||||
Command param.Field[string] `json:"command,required"`
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
func (r TuiExecuteCommandParams) MarshalJSON() (data []byte, err error) {
|
||||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [TuiExecuteCommandParams]'s query parameters as
|
||||
// `url.Values`.
|
||||
func (r TuiExecuteCommandParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type TuiOpenHelpParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [TuiOpenHelpParams]'s query parameters as `url.Values`.
|
||||
func (r TuiOpenHelpParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type TuiOpenModelsParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [TuiOpenModelsParams]'s query parameters as `url.Values`.
|
||||
func (r TuiOpenModelsParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type TuiOpenSessionsParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [TuiOpenSessionsParams]'s query parameters as `url.Values`.
|
||||
func (r TuiOpenSessionsParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type TuiOpenThemesParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [TuiOpenThemesParams]'s query parameters as `url.Values`.
|
||||
func (r TuiOpenThemesParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type TuiShowToastParams struct {
|
||||
Message param.Field[string] `json:"message,required"`
|
||||
Variant param.Field[TuiShowToastParamsVariant] `json:"variant,required"`
|
||||
Title param.Field[string] `json:"title"`
|
||||
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 (r TuiShowToastParams) MarshalJSON() (data []byte, err error) {
|
||||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// URLQuery serializes [TuiShowToastParams]'s query parameters as `url.Values`.
|
||||
func (r TuiShowToastParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
||||
type TuiShowToastParamsVariant string
|
||||
|
||||
const (
|
||||
|
|
@ -145,3 +235,15 @@ func (r TuiShowToastParamsVariant) IsKnown() bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type TuiSubmitPromptParams struct {
|
||||
Directory param.Field[string] `query:"directory"`
|
||||
}
|
||||
|
||||
// URLQuery serializes [TuiSubmitPromptParams]'s query parameters as `url.Values`.
|
||||
func (r TuiSubmitPromptParams) URLQuery() (v url.Values) {
|
||||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
|
||||
ArrayFormat: apiquery.ArrayQueryFormatComma,
|
||||
NestedFormat: apiquery.NestedQueryFormatBrackets,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
func TestTuiAppendPrompt(t *testing.T) {
|
||||
func TestTuiAppendPromptWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -26,7 +26,8 @@ func TestTuiAppendPrompt(t *testing.T) {
|
|||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Tui.AppendPrompt(context.TODO(), opencode.TuiAppendPromptParams{
|
||||
Text: opencode.F("text"),
|
||||
Text: opencode.F("text"),
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
|
|
@ -37,7 +38,7 @@ func TestTuiAppendPrompt(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTuiClearPrompt(t *testing.T) {
|
||||
func TestTuiClearPromptWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -49,7 +50,9 @@ func TestTuiClearPrompt(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Tui.ClearPrompt(context.TODO())
|
||||
_, err := client.Tui.ClearPrompt(context.TODO(), opencode.TuiClearPromptParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -59,7 +62,7 @@ func TestTuiClearPrompt(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTuiExecuteCommand(t *testing.T) {
|
||||
func TestTuiExecuteCommandWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -72,7 +75,8 @@ func TestTuiExecuteCommand(t *testing.T) {
|
|||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Tui.ExecuteCommand(context.TODO(), opencode.TuiExecuteCommandParams{
|
||||
Command: opencode.F("command"),
|
||||
Command: opencode.F("command"),
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
|
|
@ -83,7 +87,7 @@ func TestTuiExecuteCommand(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTuiOpenHelp(t *testing.T) {
|
||||
func TestTuiOpenHelpWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -95,7 +99,9 @@ func TestTuiOpenHelp(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Tui.OpenHelp(context.TODO())
|
||||
_, err := client.Tui.OpenHelp(context.TODO(), opencode.TuiOpenHelpParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -105,7 +111,7 @@ func TestTuiOpenHelp(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTuiOpenModels(t *testing.T) {
|
||||
func TestTuiOpenModelsWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -117,7 +123,9 @@ func TestTuiOpenModels(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Tui.OpenModels(context.TODO())
|
||||
_, err := client.Tui.OpenModels(context.TODO(), opencode.TuiOpenModelsParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -127,7 +135,7 @@ func TestTuiOpenModels(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTuiOpenSessions(t *testing.T) {
|
||||
func TestTuiOpenSessionsWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -139,7 +147,9 @@ func TestTuiOpenSessions(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Tui.OpenSessions(context.TODO())
|
||||
_, err := client.Tui.OpenSessions(context.TODO(), opencode.TuiOpenSessionsParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -149,7 +159,7 @@ func TestTuiOpenSessions(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTuiOpenThemes(t *testing.T) {
|
||||
func TestTuiOpenThemesWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -161,7 +171,9 @@ func TestTuiOpenThemes(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Tui.OpenThemes(context.TODO())
|
||||
_, err := client.Tui.OpenThemes(context.TODO(), opencode.TuiOpenThemesParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
@ -184,9 +196,10 @@ func TestTuiShowToastWithOptionalParams(t *testing.T) {
|
|||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Tui.ShowToast(context.TODO(), opencode.TuiShowToastParams{
|
||||
Message: opencode.F("message"),
|
||||
Variant: opencode.F(opencode.TuiShowToastParamsVariantInfo),
|
||||
Title: opencode.F("title"),
|
||||
Message: opencode.F("message"),
|
||||
Variant: opencode.F(opencode.TuiShowToastParamsVariantInfo),
|
||||
Directory: opencode.F("directory"),
|
||||
Title: opencode.F("title"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
|
|
@ -197,7 +210,7 @@ func TestTuiShowToastWithOptionalParams(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTuiSubmitPrompt(t *testing.T) {
|
||||
func TestTuiSubmitPromptWithOptionalParams(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
|
|
@ -209,7 +222,9 @@ func TestTuiSubmitPrompt(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Tui.SubmitPrompt(context.TODO())
|
||||
_, err := client.Tui.SubmitPrompt(context.TODO(), opencode.TuiSubmitPromptParams{
|
||||
Directory: opencode.F("directory"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func TestUsage(t *testing.T) {
|
|||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
sessions, err := client.Session.List(context.TODO())
|
||||
sessions, err := client.Session.List(context.TODO(), opencode.SessionListParams{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import type {
|
|||
ToolRegisterData,
|
||||
ToolRegisterResponses,
|
||||
ToolRegisterErrors,
|
||||
ToolIdsData,
|
||||
ToolIdsResponses,
|
||||
ToolIdsErrors,
|
||||
ToolListData,
|
||||
ToolListResponses,
|
||||
ToolListErrors,
|
||||
|
|
@ -98,9 +101,6 @@ import type {
|
|||
AuthSetData,
|
||||
AuthSetResponses,
|
||||
AuthSetErrors,
|
||||
ToolIdsData,
|
||||
ToolIdsResponses,
|
||||
ToolIdsErrors,
|
||||
} from "./types.gen.js"
|
||||
import { client as _heyApiClient } from "./client.gen.js"
|
||||
|
||||
|
|
@ -191,17 +191,27 @@ class Tool extends _HeyApiClient {
|
|||
/**
|
||||
* Register a new HTTP callback tool
|
||||
*/
|
||||
public register<ThrowOnError extends boolean = false>(options: Options<ToolRegisterData, ThrowOnError>) {
|
||||
return (options.client ?? this._client).post<ToolRegisterResponses, ToolRegisterErrors, ThrowOnError>({
|
||||
public register<ThrowOnError extends boolean = false>(options?: Options<ToolRegisterData, ThrowOnError>) {
|
||||
return (options?.client ?? this._client).post<ToolRegisterResponses, ToolRegisterErrors, ThrowOnError>({
|
||||
url: "/experimental/tool/register",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options.headers,
|
||||
...options?.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List all tool IDs (including built-in and dynamically registered)
|
||||
*/
|
||||
public ids<ThrowOnError extends boolean = false>(options?: Options<ToolIdsData, ThrowOnError>) {
|
||||
return (options?.client ?? this._client).get<ToolIdsResponses, ToolIdsErrors, ThrowOnError>({
|
||||
url: "/experimental/tool/ids",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List tools with JSON schema parameters for a provider/model
|
||||
*/
|
||||
|
|
@ -211,16 +221,6 @@ class Tool extends _HeyApiClient {
|
|||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List all tool IDs (including built-in and dynamically registered)
|
||||
*/
|
||||
public ids<ThrowOnError extends boolean = false>(options: Options<ToolIdsData, ThrowOnError>) {
|
||||
return (options.client ?? this._client).get<ToolIdsResponses, ToolIdsErrors, ThrowOnError>({
|
||||
url: "/experimental/tool/ids",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
class Path extends _HeyApiClient {
|
||||
|
|
@ -249,13 +249,13 @@ class Session extends _HeyApiClient {
|
|||
/**
|
||||
* Create a new session
|
||||
*/
|
||||
public create<ThrowOnError extends boolean = false>(options: Options<SessionCreateData, ThrowOnError>) {
|
||||
return (options.client ?? this._client).post<SessionCreateResponses, SessionCreateErrors, ThrowOnError>({
|
||||
public create<ThrowOnError extends boolean = false>(options?: Options<SessionCreateData, ThrowOnError>) {
|
||||
return (options?.client ?? this._client).post<SessionCreateResponses, SessionCreateErrors, ThrowOnError>({
|
||||
url: "/session",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options.headers,
|
||||
...options?.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -935,6 +935,12 @@ export type Config = {
|
|||
}
|
||||
}
|
||||
|
||||
export type _Error = {
|
||||
data: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type HttpParamSpec = {
|
||||
type: "string" | "number" | "boolean" | "array"
|
||||
description?: string
|
||||
|
|
@ -957,6 +963,16 @@ export type HttpToolRegistration = {
|
|||
}
|
||||
}
|
||||
|
||||
export type ToolIds = Array<string>
|
||||
|
||||
export type ToolListItem = {
|
||||
id: string
|
||||
description: string
|
||||
parameters: unknown
|
||||
}
|
||||
|
||||
export type ToolList = Array<ToolListItem>
|
||||
|
||||
export type Path = {
|
||||
state: string
|
||||
config: string
|
||||
|
|
@ -1132,26 +1148,12 @@ export type WellKnownAuth = {
|
|||
|
||||
export type Auth = OAuth | ApiAuth | WellKnownAuth
|
||||
|
||||
export type _Error = {
|
||||
data: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type ToolIds = Array<string>
|
||||
|
||||
export type ToolListItem = {
|
||||
id: string
|
||||
description: string
|
||||
parameters: unknown
|
||||
}
|
||||
|
||||
export type ToolList = Array<ToolListItem>
|
||||
|
||||
export type ProjectListData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/project"
|
||||
}
|
||||
|
||||
|
|
@ -1167,7 +1169,9 @@ export type ProjectListResponse = ProjectListResponses[keyof ProjectListResponse
|
|||
export type ProjectCurrentData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/project/current"
|
||||
}
|
||||
|
||||
|
|
@ -1183,7 +1187,9 @@ export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurren
|
|||
export type EventSubscribeData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/event"
|
||||
}
|
||||
|
||||
|
|
@ -1199,7 +1205,9 @@ export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscrib
|
|||
export type ConfigGetData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/config"
|
||||
}
|
||||
|
||||
|
|
@ -1215,8 +1223,8 @@ export type ConfigGetResponse = ConfigGetResponses[keyof ConfigGetResponses]
|
|||
export type ToolRegisterData = {
|
||||
body?: HttpToolRegistration
|
||||
path?: never
|
||||
query: {
|
||||
directory: string
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/experimental/tool/register"
|
||||
}
|
||||
|
|
@ -1239,11 +1247,38 @@ export type ToolRegisterResponses = {
|
|||
|
||||
export type ToolRegisterResponse = ToolRegisterResponses[keyof ToolRegisterResponses]
|
||||
|
||||
export type ToolIdsData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/experimental/tool/ids"
|
||||
}
|
||||
|
||||
export type ToolIdsErrors = {
|
||||
/**
|
||||
* Bad request
|
||||
*/
|
||||
400: _Error
|
||||
}
|
||||
|
||||
export type ToolIdsError = ToolIdsErrors[keyof ToolIdsErrors]
|
||||
|
||||
export type ToolIdsResponses = {
|
||||
/**
|
||||
* Tool IDs
|
||||
*/
|
||||
200: ToolIds
|
||||
}
|
||||
|
||||
export type ToolIdsResponse = ToolIdsResponses[keyof ToolIdsResponses]
|
||||
|
||||
export type ToolListData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
directory: string
|
||||
directory?: string
|
||||
provider: string
|
||||
model: string
|
||||
}
|
||||
|
|
@ -1271,7 +1306,9 @@ export type ToolListResponse = ToolListResponses[keyof ToolListResponses]
|
|||
export type PathGetData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/path"
|
||||
}
|
||||
|
||||
|
|
@ -1287,7 +1324,9 @@ export type PathGetResponse = PathGetResponses[keyof PathGetResponses]
|
|||
export type SessionListData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session"
|
||||
}
|
||||
|
||||
|
|
@ -1306,8 +1345,8 @@ export type SessionCreateData = {
|
|||
title?: string
|
||||
}
|
||||
path?: never
|
||||
query: {
|
||||
directory: string
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session"
|
||||
}
|
||||
|
|
@ -1335,7 +1374,9 @@ export type SessionDeleteData = {
|
|||
path: {
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}"
|
||||
}
|
||||
|
||||
|
|
@ -1353,7 +1394,9 @@ export type SessionGetData = {
|
|||
path: {
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}"
|
||||
}
|
||||
|
||||
|
|
@ -1373,7 +1416,9 @@ export type SessionUpdateData = {
|
|||
path: {
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}"
|
||||
}
|
||||
|
||||
|
|
@ -1391,7 +1436,9 @@ export type SessionChildrenData = {
|
|||
path: {
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/children"
|
||||
}
|
||||
|
||||
|
|
@ -1416,7 +1463,9 @@ export type SessionInitData = {
|
|||
*/
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/init"
|
||||
}
|
||||
|
||||
|
|
@ -1434,7 +1483,9 @@ export type SessionAbortData = {
|
|||
path: {
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/abort"
|
||||
}
|
||||
|
||||
|
|
@ -1452,7 +1503,9 @@ export type SessionUnshareData = {
|
|||
path: {
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/share"
|
||||
}
|
||||
|
||||
|
|
@ -1470,7 +1523,9 @@ export type SessionShareData = {
|
|||
path: {
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/share"
|
||||
}
|
||||
|
||||
|
|
@ -1494,7 +1549,9 @@ export type SessionSummarizeData = {
|
|||
*/
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/summarize"
|
||||
}
|
||||
|
||||
|
|
@ -1515,7 +1572,9 @@ export type SessionMessagesData = {
|
|||
*/
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/message"
|
||||
}
|
||||
|
||||
|
|
@ -1551,7 +1610,9 @@ export type SessionPromptData = {
|
|||
*/
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/message"
|
||||
}
|
||||
|
||||
|
|
@ -1579,7 +1640,9 @@ export type SessionMessageData = {
|
|||
*/
|
||||
messageID: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/message/{messageID}"
|
||||
}
|
||||
|
||||
|
|
@ -1609,7 +1672,9 @@ export type SessionCommandData = {
|
|||
*/
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/command"
|
||||
}
|
||||
|
||||
|
|
@ -1636,7 +1701,9 @@ export type SessionShellData = {
|
|||
*/
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/shell"
|
||||
}
|
||||
|
||||
|
|
@ -1657,7 +1724,9 @@ export type SessionRevertData = {
|
|||
path: {
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/revert"
|
||||
}
|
||||
|
||||
|
|
@ -1675,7 +1744,9 @@ export type SessionUnrevertData = {
|
|||
path: {
|
||||
id: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/unrevert"
|
||||
}
|
||||
|
||||
|
|
@ -1696,7 +1767,9 @@ export type PostSessionIdPermissionsPermissionIdData = {
|
|||
id: string
|
||||
permissionID: string
|
||||
}
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{id}/permissions/{permissionID}"
|
||||
}
|
||||
|
||||
|
|
@ -1713,7 +1786,9 @@ export type PostSessionIdPermissionsPermissionIdResponse =
|
|||
export type CommandListData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/command"
|
||||
}
|
||||
|
||||
|
|
@ -1729,7 +1804,9 @@ export type CommandListResponse = CommandListResponses[keyof CommandListResponse
|
|||
export type ConfigProvidersData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/config/providers"
|
||||
}
|
||||
|
||||
|
|
@ -1751,6 +1828,7 @@ export type FindTextData = {
|
|||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
directory?: string
|
||||
pattern: string
|
||||
}
|
||||
url: "/find"
|
||||
|
|
@ -1785,6 +1863,7 @@ export type FindFilesData = {
|
|||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
directory?: string
|
||||
query: string
|
||||
}
|
||||
url: "/find/file"
|
||||
|
|
@ -1803,6 +1882,7 @@ export type FindSymbolsData = {
|
|||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
directory?: string
|
||||
query: string
|
||||
}
|
||||
url: "/find/symbol"
|
||||
|
|
@ -1821,6 +1901,7 @@ export type FileListData = {
|
|||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
directory?: string
|
||||
path: string
|
||||
}
|
||||
url: "/file"
|
||||
|
|
@ -1839,6 +1920,7 @@ export type FileReadData = {
|
|||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
directory?: string
|
||||
path: string
|
||||
}
|
||||
url: "/file/content"
|
||||
|
|
@ -1856,7 +1938,9 @@ export type FileReadResponse = FileReadResponses[keyof FileReadResponses]
|
|||
export type FileStatusData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/file/status"
|
||||
}
|
||||
|
||||
|
|
@ -1891,7 +1975,9 @@ export type AppLogData = {
|
|||
}
|
||||
}
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/log"
|
||||
}
|
||||
|
||||
|
|
@ -1907,7 +1993,9 @@ export type AppLogResponse = AppLogResponses[keyof AppLogResponses]
|
|||
export type AppAgentsData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/agent"
|
||||
}
|
||||
|
||||
|
|
@ -1925,7 +2013,9 @@ export type TuiAppendPromptData = {
|
|||
text: string
|
||||
}
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/tui/append-prompt"
|
||||
}
|
||||
|
||||
|
|
@ -1941,7 +2031,9 @@ export type TuiAppendPromptResponse = TuiAppendPromptResponses[keyof TuiAppendPr
|
|||
export type TuiOpenHelpData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/tui/open-help"
|
||||
}
|
||||
|
||||
|
|
@ -1957,7 +2049,9 @@ export type TuiOpenHelpResponse = TuiOpenHelpResponses[keyof TuiOpenHelpResponse
|
|||
export type TuiOpenSessionsData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/tui/open-sessions"
|
||||
}
|
||||
|
||||
|
|
@ -1973,7 +2067,9 @@ export type TuiOpenSessionsResponse = TuiOpenSessionsResponses[keyof TuiOpenSess
|
|||
export type TuiOpenThemesData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/tui/open-themes"
|
||||
}
|
||||
|
||||
|
|
@ -1989,7 +2085,9 @@ export type TuiOpenThemesResponse = TuiOpenThemesResponses[keyof TuiOpenThemesRe
|
|||
export type TuiOpenModelsData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/tui/open-models"
|
||||
}
|
||||
|
||||
|
|
@ -2005,7 +2103,9 @@ export type TuiOpenModelsResponse = TuiOpenModelsResponses[keyof TuiOpenModelsRe
|
|||
export type TuiSubmitPromptData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/tui/submit-prompt"
|
||||
}
|
||||
|
||||
|
|
@ -2021,7 +2121,9 @@ export type TuiSubmitPromptResponse = TuiSubmitPromptResponses[keyof TuiSubmitPr
|
|||
export type TuiClearPromptData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/tui/clear-prompt"
|
||||
}
|
||||
|
||||
|
|
@ -2039,7 +2141,9 @@ export type TuiExecuteCommandData = {
|
|||
command: string
|
||||
}
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/tui/execute-command"
|
||||
}
|
||||
|
||||
|
|
@ -2059,7 +2163,9 @@ export type TuiShowToastData = {
|
|||
variant: "info" | "success" | "warning" | "error"
|
||||
}
|
||||
path?: never
|
||||
query?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/tui/show-toast"
|
||||
}
|
||||
|
||||
|
|
@ -2077,8 +2183,8 @@ export type AuthSetData = {
|
|||
path: {
|
||||
id: string
|
||||
}
|
||||
query: {
|
||||
directory: string
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/auth/{id}"
|
||||
}
|
||||
|
|
@ -2101,33 +2207,6 @@ export type AuthSetResponses = {
|
|||
|
||||
export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses]
|
||||
|
||||
export type ToolIdsData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
directory: string
|
||||
}
|
||||
url: "/experimental/tool/ids"
|
||||
}
|
||||
|
||||
export type ToolIdsErrors = {
|
||||
/**
|
||||
* Bad request
|
||||
*/
|
||||
400: _Error
|
||||
}
|
||||
|
||||
export type ToolIdsError = ToolIdsErrors[keyof ToolIdsErrors]
|
||||
|
||||
export type ToolIdsResponses = {
|
||||
/**
|
||||
* Tool IDs
|
||||
*/
|
||||
200: ToolIds
|
||||
}
|
||||
|
||||
export type ToolIdsResponse = ToolIdsResponses[keyof ToolIdsResponses]
|
||||
|
||||
export type ClientOptions = {
|
||||
baseUrl: `${string}://${string}` | (string & {})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue