From 8d71e435082869f3b95c8de3856c24e67106f35a Mon Sep 17 00:00:00 2001 From: starptech Date: Thu, 21 May 2026 13:26:38 +0200 Subject: [PATCH] Update existing types and rename structured output fields in SDK docs --- .../structured-output-integration.test.ts | 6 +- .../test/session/structured-output.test.ts | 6 +- packages/sdk/js/script/build.ts | 51 + packages/sdk/js/src/gen/client.gen.ts | 16 +- packages/sdk/js/src/gen/client/client.gen.ts | 143 +- packages/sdk/js/src/gen/client/index.ts | 2 +- packages/sdk/js/src/gen/client/types.gen.ts | 32 +- packages/sdk/js/src/gen/client/utils.gen.ts | 86 +- .../sdk/js/src/gen/core/bodySerializer.gen.ts | 14 +- packages/sdk/js/src/gen/core/params.gen.ts | 43 +- .../js/src/gen/core/serverSentEvents.gen.ts | 33 +- packages/sdk/js/src/gen/core/types.gen.ts | 19 +- packages/sdk/js/src/gen/core/utils.gen.ts | 30 +- packages/sdk/js/src/gen/sdk.gen.ts | 2418 ++++-- packages/sdk/js/src/gen/types.gen.ts | 7684 ++++++++++++----- packages/web/src/content/docs/ar/sdk.mdx | 8 +- packages/web/src/content/docs/bs/sdk.mdx | 8 +- packages/web/src/content/docs/da/sdk.mdx | 8 +- packages/web/src/content/docs/de/sdk.mdx | 8 +- packages/web/src/content/docs/es/sdk.mdx | 8 +- packages/web/src/content/docs/fr/sdk.mdx | 8 +- packages/web/src/content/docs/it/sdk.mdx | 8 +- packages/web/src/content/docs/ja/sdk.mdx | 8 +- packages/web/src/content/docs/ko/sdk.mdx | 8 +- packages/web/src/content/docs/nb/sdk.mdx | 8 +- packages/web/src/content/docs/pl/sdk.mdx | 6 +- packages/web/src/content/docs/pt-br/sdk.mdx | 8 +- packages/web/src/content/docs/ru/sdk.mdx | 8 +- packages/web/src/content/docs/sdk.mdx | 8 +- packages/web/src/content/docs/th/sdk.mdx | 8 +- packages/web/src/content/docs/tr/sdk.mdx | 8 +- packages/web/src/content/docs/zh-cn/sdk.mdx | 8 +- packages/web/src/content/docs/zh-tw/sdk.mdx | 8 +- 33 files changed, 7610 insertions(+), 3115 deletions(-) diff --git a/packages/opencode/test/session/structured-output-integration.test.ts b/packages/opencode/test/session/structured-output-integration.test.ts index 125c63c0f9..da7badc617 100644 --- a/packages/opencode/test/session/structured-output-integration.test.ts +++ b/packages/opencode/test/session/structured-output-integration.test.ts @@ -130,7 +130,7 @@ describe("StructuredOutput Integration", () => { ) live( - "works with text outputFormat (default)", + "works with text format (default)", () => Effect.gen(function* () { const prompt = yield* SessionPrompt.Service @@ -168,7 +168,7 @@ describe("StructuredOutput Integration", () => { ) live( - "stores outputFormat on user message", + "stores format on user message", () => Effect.gen(function* () { const prompt = yield* SessionPrompt.Service @@ -200,7 +200,7 @@ describe("StructuredOutput Integration", () => { const messages = yield* sessions.messages({ sessionID: session.id }) const userMessage = messages.find((m) => m.info.role === "user") - // Verify outputFormat was stored on user message + // Verify format was stored on user message expect(userMessage).toBeDefined() if (userMessage?.info.role === "user") { expect(userMessage.info.format).toBeDefined() diff --git a/packages/opencode/test/session/structured-output.test.ts b/packages/opencode/test/session/structured-output.test.ts index 806c574834..d43b8b85a0 100644 --- a/packages/opencode/test/session/structured-output.test.ts +++ b/packages/opencode/test/session/structured-output.test.ts @@ -99,7 +99,7 @@ describe("structured-output.StructuredOutputError", () => { }) describe("structured-output.UserMessage", () => { - test("user message accepts outputFormat", () => { + test("user message accepts format", () => { const result = decodeUser({ id: MessageID.ascending(), sessionID: SessionID.descending(), @@ -107,7 +107,7 @@ describe("structured-output.UserMessage", () => { time: { created: Date.now() }, agent: "default", model: { providerID: "anthropic", modelID: "claude-3" }, - outputFormat: { + format: { type: "json_schema", schema: { type: "object" }, }, @@ -115,7 +115,7 @@ describe("structured-output.UserMessage", () => { expect(Exit.isSuccess(result)).toBe(true) }) - test("user message works without outputFormat (optional)", () => { + test("user message works without format (optional)", () => { const result = decodeUser({ id: MessageID.ascending(), sessionID: SessionID.descending(), diff --git a/packages/sdk/js/script/build.ts b/packages/sdk/js/script/build.ts index b3f74a1bf6..ae489a8a54 100755 --- a/packages/sdk/js/script/build.ts +++ b/packages/sdk/js/script/build.ts @@ -12,6 +12,33 @@ import { createClient } from "@hey-api/openapi-ts" const opencode = path.resolve(dir, "../../opencode") await $`bun dev generate > ${dir}/openapi.json`.cwd(opencode) +await Bun.write(path.join(dir, "openapi-legacy.json"), JSON.stringify(legacyOpenApi(await Bun.file("openapi.json").json()))) + +await createClient({ + input: "./openapi-legacy.json", + output: { + path: "./src/gen", + tsConfigPath: path.join(dir, "tsconfig.json"), + clean: true, + }, + plugins: [ + { + name: "@hey-api/typescript", + exportFromIndex: false, + }, + { + name: "@hey-api/sdk", + instance: "OpencodeClient", + exportFromIndex: false, + auth: false, + }, + { + name: "@hey-api/client-fetch", + exportFromIndex: false, + baseUrl: "http://localhost:4096", + }, + ], +}) await createClient({ input: "./openapi.json", @@ -45,3 +72,27 @@ await $`bun prettier --write src/v2` await $`rm -rf dist` await $`bun tsc` await $`rm openapi.json` +await $`rm openapi-legacy.json` + +type OpenApiSpec = { + paths: Record }>> +} + +function legacyOpenApi(input: OpenApiSpec) { + const spec = structuredClone(input) + spec.paths = Object.fromEntries( + Object.entries(spec.paths) + .filter(([route]) => route !== "/api" && !route.startsWith("/api/")) + .map(([route, item]) => [route.replaceAll("{sessionID}", "{id}"), renameLegacyPathParameters(item)]), + ) + return spec +} + +function renameLegacyPathParameters(item: OpenApiSpec["paths"][string]) { + for (const operation of Object.values(item)) { + for (const parameter of operation.parameters ?? []) { + if (parameter.in === "path" && parameter.name === "sessionID") parameter.name = "id" + } + } + return item +} diff --git a/packages/sdk/js/src/gen/client.gen.ts b/packages/sdk/js/src/gen/client.gen.ts index e7cdb292c6..0c110eca39 100644 --- a/packages/sdk/js/src/gen/client.gen.ts +++ b/packages/sdk/js/src/gen/client.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ClientOptions } from "./types.gen.js" -import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from "./client/index.js" +import { type ClientOptions, type Config, createClient, createConfig } from "./client/index.js" +import type { ClientOptions as ClientOptions2 } from "./types.gen.js" /** * The `createClientConfig()` function will be called on client initialization @@ -11,12 +11,8 @@ import { type Config, type ClientOptions as DefaultClientOptions, createClient, * `setConfig()`. This is useful for example if you're using Next.js * to ensure your client always has the correct values. */ -export type CreateClientConfig = ( - override?: Config, -) => Config & T> +export type CreateClientConfig = ( + override?: Config, +) => Config & T> -export const client = createClient( - createConfig({ - baseUrl: "http://localhost:4096", - }), -) +export const client = createClient(createConfig({ baseUrl: "http://localhost:4096" })) diff --git a/packages/sdk/js/src/gen/client/client.gen.ts b/packages/sdk/js/src/gen/client/client.gen.ts index 34a8d0bece..627e98ec42 100644 --- a/packages/sdk/js/src/gen/client/client.gen.ts +++ b/packages/sdk/js/src/gen/client/client.gen.ts @@ -1,6 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts import { createSseClient } from "../core/serverSentEvents.gen.js" +import type { HttpMethod } from "../core/types.gen.js" +import { getValidRequestBody } from "../core/utils.gen.js" import type { Client, Config, RequestOptions, ResolvedRequestOptions } from "./types.gen.js" import { buildUrl, @@ -49,12 +51,12 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts) } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body) } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === "") { + if (opts.body === undefined || opts.serializedBody === "") { opts.headers.delete("Content-Type") } @@ -69,12 +71,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: "follow", ...opts, - body: opts.serializedBody, + body: getValidRequestBody(opts), } let request = new Request(url, requestInit) - for (const fn of interceptors.request._fns) { + for (const fn of interceptors.request.fns) { if (fn) { request = await fn(request, opts) } @@ -83,9 +85,37 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch! - let response = await _fetch(request) + let response: Response - for (const fn of interceptors.response._fns) { + try { + response = await _fetch(request) + } catch (error) { + // Handle fetch exceptions (AbortError, network errors, etc.) + let finalError = error + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, undefined as any, request, opts)) as unknown + } + } + + finalError = finalError || ({} as unknown) + + if (opts.throwOnError) { + throw finalError + } + + // Return error response + return opts.responseStyle === "data" + ? undefined + : { + error: finalError, + request, + response: undefined as any, + } + } + + for (const fn of interceptors.response.fns) { if (fn) { response = await fn(response, request, opts) } @@ -97,27 +127,51 @@ export const createClient = (config: Config = {}): Client => { } if (response.ok) { + const parseAs = + (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json" + if (response.status === 204 || response.headers.get("Content-Length") === "0") { + let emptyData: any + switch (parseAs) { + case "arrayBuffer": + case "blob": + case "text": + emptyData = await response[parseAs]() + break + case "formData": + emptyData = new FormData() + break + case "stream": + emptyData = response.body + break + case "json": + default: + emptyData = {} + break + } return opts.responseStyle === "data" - ? {} + ? emptyData : { - data: {}, + data: emptyData, ...result, } } - const parseAs = - (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json" - let data: any switch (parseAs) { case "arrayBuffer": case "blob": case "formData": - case "json": case "text": data = await response[parseAs]() break + case "json": { + // Some servers return 200 with no Content-Length and empty body. + // response.json() would throw; read as text and parse if non-empty. + const text = await response.text() + data = text ? JSON.parse(text) : {} + break + } case "stream": return opts.responseStyle === "data" ? response.body @@ -157,7 +211,7 @@ export const createClient = (config: Config = {}): Client => { const error = jsonError ?? textError let finalError = error - for (const fn of interceptors.error._fns) { + for (const fn of interceptors.error.fns) { if (fn) { finalError = (await fn(error, response, request, opts)) as string } @@ -178,35 +232,54 @@ export const createClient = (config: Config = {}): Client => { } } - const makeMethod = (method: Required["method"]) => { - const fn = (options: RequestOptions) => request({ ...options, method }) - fn.sse = async (options: RequestOptions) => { - const { opts, url } = await beforeRequest(options) - return createSseClient({ - ...opts, - body: opts.body as BodyInit | null | undefined, - headers: opts.headers as unknown as Record, - method, - url, - }) - } - return fn + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }) + + const makeSseFn = (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options) + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + onRequest: async (url, init) => { + let request = new Request(url, init) + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts) + } + } + return request + }, + serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined, + url, + }) } return { buildUrl, - connect: makeMethod("CONNECT"), - delete: makeMethod("DELETE"), - get: makeMethod("GET"), + connect: makeMethodFn("CONNECT"), + delete: makeMethodFn("DELETE"), + get: makeMethodFn("GET"), getConfig, - head: makeMethod("HEAD"), + head: makeMethodFn("HEAD"), interceptors, - options: makeMethod("OPTIONS"), - patch: makeMethod("PATCH"), - post: makeMethod("POST"), - put: makeMethod("PUT"), + options: makeMethodFn("OPTIONS"), + patch: makeMethodFn("PATCH"), + post: makeMethodFn("POST"), + put: makeMethodFn("PUT"), request, setConfig, - trace: makeMethod("TRACE"), + sse: { + connect: makeSseFn("CONNECT"), + delete: makeSseFn("DELETE"), + get: makeSseFn("GET"), + head: makeSseFn("HEAD"), + options: makeSseFn("OPTIONS"), + patch: makeSseFn("PATCH"), + post: makeSseFn("POST"), + put: makeSseFn("PUT"), + trace: makeSseFn("TRACE"), + }, + trace: makeMethodFn("TRACE"), } as Client } diff --git a/packages/sdk/js/src/gen/client/index.ts b/packages/sdk/js/src/gen/client/index.ts index 06f21e3d80..0af63f3300 100644 --- a/packages/sdk/js/src/gen/client/index.ts +++ b/packages/sdk/js/src/gen/client/index.ts @@ -8,6 +8,7 @@ export { urlSearchParamsBodySerializer, } from "../core/bodySerializer.gen.js" export { buildClientParams } from "../core/params.gen.js" +export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen.js" export { createClient } from "./client.gen.js" export type { Client, @@ -15,7 +16,6 @@ export type { Config, CreateClientConfig, Options, - OptionsLegacyParser, RequestOptions, RequestResult, ResolvedRequestOptions, diff --git a/packages/sdk/js/src/gen/client/types.gen.ts b/packages/sdk/js/src/gen/client/types.gen.ts index db8e544cfd..e053aa4066 100644 --- a/packages/sdk/js/src/gen/client/types.gen.ts +++ b/packages/sdk/js/src/gen/client/types.gen.ts @@ -20,7 +20,7 @@ export interface Config * * @default globalThis.fetch */ - fetch?: (request: Request) => ReturnType + fetch?: typeof fetch /** * Please don't use the Fetch client for Next.js applications. The `next` * options won't have any effect. @@ -128,7 +128,7 @@ export interface ClientOptions { throwOnError?: boolean } -type MethodFnBase = < +type MethodFn = < TData = unknown, TError = unknown, ThrowOnError extends boolean = false, @@ -137,7 +137,7 @@ type MethodFnBase = < options: Omit, "method">, ) => RequestResult -type MethodFnServerSentEvents = < +type SseFn = < TData = unknown, TError = unknown, ThrowOnError extends boolean = false, @@ -146,10 +146,6 @@ type MethodFnServerSentEvents = < options: Omit, "method">, ) => Promise> -type MethodFn = MethodFnBase & { - sse: MethodFnServerSentEvents -} - type RequestFn = < TData = unknown, TError = unknown, @@ -168,10 +164,10 @@ type BuildUrlFn = < url: string }, >( - options: Pick & Options, + options: TData & Options, ) => string -export type Client = CoreClient & { +export type Client = CoreClient & { interceptors: Middleware } @@ -203,20 +199,4 @@ export type Options< TResponse = unknown, TResponseStyle extends ResponseStyle = "fields", > = OmitKeys, "body" | "path" | "query" | "url"> & - Omit - -export type OptionsLegacyParser< - TData = unknown, - ThrowOnError extends boolean = boolean, - TResponseStyle extends ResponseStyle = "fields", -> = TData extends { body?: any } - ? TData extends { headers?: any } - ? OmitKeys, "body" | "headers" | "url"> & TData - : OmitKeys, "body" | "url"> & - TData & - Pick, "headers"> - : TData extends { headers?: any } - ? OmitKeys, "headers" | "url"> & - TData & - Pick, "body"> - : OmitKeys, "url"> & TData + ([TData] extends [never] ? unknown : Omit) diff --git a/packages/sdk/js/src/gen/client/utils.gen.ts b/packages/sdk/js/src/gen/client/utils.gen.ts index 209bfbe8e6..3b1dfb7871 100644 --- a/packages/sdk/js/src/gen/client/utils.gen.ts +++ b/packages/sdk/js/src/gen/client/utils.gen.ts @@ -7,7 +7,7 @@ import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } fr import { getUrl } from "../core/utils.gen.js" import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen.js" -export const createQuerySerializer = ({ allowReserved, array, object }: QuerySerializerOptions = {}) => { +export const createQuerySerializer = ({ parameters = {}, ...args }: QuerySerializerOptions = {}) => { const querySerializer = (queryParams: T) => { const search: string[] = [] if (queryParams && typeof queryParams === "object") { @@ -18,29 +18,31 @@ export const createQuerySerializer = ({ allowReserved, array, objec continue } + const options = parameters[name] || args + if (Array.isArray(value)) { const serializedArray = serializeArrayParam({ - allowReserved, + allowReserved: options.allowReserved, explode: true, name, style: "form", value, - ...array, + ...options.array, }) if (serializedArray) search.push(serializedArray) } else if (typeof value === "object") { const serializedObject = serializeObjectParam({ - allowReserved, + allowReserved: options.allowReserved, explode: true, name, style: "deepObject", value: value as Record, - ...object, + ...options.object, }) if (serializedObject) search.push(serializedObject) } else { const serializedPrimitive = serializePrimitiveParam({ - allowReserved, + allowReserved: options.allowReserved, name, value: value as string, }) @@ -162,14 +164,22 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config } +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = [] + headers.forEach((value, key) => { + entries.push([key, value]) + }) + return entries +} + export const mergeHeaders = (...headers: Array["headers"] | undefined>): Headers => { const mergedHeaders = new Headers() for (const header of headers) { - if (!header || typeof header !== "object") { + if (!header) { continue } - const iterator = header instanceof Headers ? header.entries() : Object.entries(header) + const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header) for (const [key, value] of iterator) { if (value === null) { @@ -200,61 +210,53 @@ type ReqInterceptor = (request: Req, options: Options) => Req | Pr type ResInterceptor = (response: Res, request: Req, options: Options) => Res | Promise class Interceptors { - _fns: (Interceptor | null)[] + fns: Array = [] - constructor() { - this._fns = [] + clear(): void { + this.fns = [] } - clear() { - this._fns = [] + eject(id: number | Interceptor): void { + const index = this.getInterceptorIndex(id) + if (this.fns[index]) { + this.fns[index] = null + } + } + + exists(id: number | Interceptor): boolean { + const index = this.getInterceptorIndex(id) + return Boolean(this.fns[index]) } getInterceptorIndex(id: number | Interceptor): number { if (typeof id === "number") { - return this._fns[id] ? id : -1 - } else { - return this._fns.indexOf(id) + return this.fns[id] ? id : -1 } - } - exists(id: number | Interceptor) { - const index = this.getInterceptorIndex(id) - return !!this._fns[index] + return this.fns.indexOf(id) } - eject(id: number | Interceptor) { + update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { const index = this.getInterceptorIndex(id) - if (this._fns[index]) { - this._fns[index] = null - } - } - - update(id: number | Interceptor, fn: Interceptor) { - const index = this.getInterceptorIndex(id) - if (this._fns[index]) { - this._fns[index] = fn + if (this.fns[index]) { + this.fns[index] = fn return id - } else { - return false } + return false } - use(fn: Interceptor) { - this._fns = [...this._fns, fn] - return this._fns.length - 1 + use(fn: Interceptor): number { + this.fns.push(fn) + return this.fns.length - 1 } } -// `createInterceptors()` response, meant for external use as it does not -// expose internals export interface Middleware { - error: Pick>, "eject" | "use"> - request: Pick>, "eject" | "use"> - response: Pick>, "eject" | "use"> + error: Interceptors> + request: Interceptors> + response: Interceptors> } -// do not add `Middleware` as return type so we can use _fns internally -export const createInterceptors = () => ({ +export const createInterceptors = (): Middleware => ({ error: new Interceptors>(), request: new Interceptors>(), response: new Interceptors>(), diff --git a/packages/sdk/js/src/gen/core/bodySerializer.gen.ts b/packages/sdk/js/src/gen/core/bodySerializer.gen.ts index 0660616052..9678fb08ec 100644 --- a/packages/sdk/js/src/gen/core/bodySerializer.gen.ts +++ b/packages/sdk/js/src/gen/core/bodySerializer.gen.ts @@ -6,10 +6,18 @@ export type QuerySerializer = (query: Record) => string export type BodySerializer = (body: any) => any -export interface QuerySerializerOptions { +type QuerySerializerOptionsObject = { allowReserved?: boolean - array?: SerializerOptions - object?: SerializerOptions + array?: Partial> + object?: Partial> +} + +export type QuerySerializerOptions = QuerySerializerOptionsObject & { + /** + * Per-parameter serialization overrides. When provided, these settings + * override the global array/object settings for specific parameter names. + */ + parameters?: Record } const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { diff --git a/packages/sdk/js/src/gen/core/params.gen.ts b/packages/sdk/js/src/gen/core/params.gen.ts index 68ad1a778e..6e9d0b9add 100644 --- a/packages/sdk/js/src/gen/core/params.gen.ts +++ b/packages/sdk/js/src/gen/core/params.gen.ts @@ -23,6 +23,17 @@ export type Field = key?: string map?: string } + | { + /** + * Field name. This is the name we want the user to see and use. + */ + key: string + /** + * Field mapped name. This is the name we want to use in the request. + * If `in` is omitted, `map` aliases `key` to the transport layer. + */ + map: Slot + } export interface Fields { allowExtra?: Partial> @@ -41,10 +52,14 @@ const extraPrefixes = Object.entries(extraPrefixesMap) type KeyMap = Map< string, - { - in: Slot - map?: string - } + | { + in: Slot + map?: string + } + | { + in?: never + map: Slot + } > const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { @@ -60,6 +75,10 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { map: config.map, }) } + } else if ("key" in config) { + map.set(config.key, { + map: config.map, + }) } else if (config.args) { buildKeyMap(config.args, map) } @@ -108,7 +127,9 @@ export const buildClientParams = (args: ReadonlyArray, fields: FieldsCo if (config.key) { const field = map.get(config.key)! const name = field.map || config.key - ;(params[field.in] as Record)[name] = arg + if (field.in) { + ;(params[field.in] as Record)[name] = arg + } } else { params.body = arg } @@ -117,16 +138,20 @@ export const buildClientParams = (args: ReadonlyArray, fields: FieldsCo const field = map.get(key) if (field) { - const name = field.map || key - ;(params[field.in] as Record)[name] = value + if (field.in) { + const name = field.map || key + ;(params[field.in] as Record)[name] = value + } else { + params[field.map] = value + } } else { const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)) if (extra) { const [prefix, slot] = extra ;(params[slot] as Record)[key.slice(prefix.length)] = value - } else { - for (const [slot, allowed] of Object.entries(config.allowExtra ?? {})) { + } else if ("allowExtra" in config && config.allowExtra) { + for (const [slot, allowed] of Object.entries(config.allowExtra)) { if (allowed) { ;(params[slot as Slot] as Record)[key] = value break diff --git a/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts b/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts index ffc4f16dc1..056a812593 100644 --- a/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts +++ b/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts @@ -4,6 +4,17 @@ import type { Config } from "./types.gen.js" export type ServerSentEventsOptions = Omit & Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise /** * Callback invoked when a network or parsing error occurs during streaming. * @@ -21,6 +32,7 @@ export type ServerSentEventsOptions = Omit) => void + serializedBody?: RequestInit["body"] /** * Default retry delay in milliseconds. * @@ -64,6 +76,7 @@ export type ServerSentEventsResult({ + onRequest, onSseError, onSseEvent, responseTransformer, @@ -99,7 +112,21 @@ export const createSseClient = ({ } try { - const response = await fetch(url, { ...options, headers, signal }) + const requestInit: RequestInit = { + redirect: "follow", + ...options, + body: options.serializedBody, + headers, + signal, + } + let request = new Request(url, requestInit) + if (onRequest) { + request = await onRequest(url, requestInit) + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch + const response = await _fetch(request) if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`) @@ -111,7 +138,7 @@ export const createSseClient = ({ const abortHandler = () => { try { - void reader.cancel() + reader.cancel() } catch { // noop } @@ -124,6 +151,8 @@ export const createSseClient = ({ const { done, value } = await reader.read() if (done) break buffer += value + // Normalize line endings: CRLF -> LF, then CR -> LF + buffer = buffer.replace(/\r\n/g, "\n").replace(/\r/g, "\n") const chunks = buffer.split("\n\n") buffer = chunks.pop() ?? "" diff --git a/packages/sdk/js/src/gen/core/types.gen.ts b/packages/sdk/js/src/gen/core/types.gen.ts index 16408b2d09..bfa77b8acd 100644 --- a/packages/sdk/js/src/gen/core/types.gen.ts +++ b/packages/sdk/js/src/gen/core/types.gen.ts @@ -3,24 +3,19 @@ import type { Auth, AuthToken } from "./auth.gen.js" import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.gen.js" -export interface Client { +export type HttpMethod = "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace" + +export type Client = { /** * Returns the final request URL. */ buildUrl: BuildUrlFn - connect: MethodFn - delete: MethodFn - get: MethodFn getConfig: () => Config - head: MethodFn - options: MethodFn - patch: MethodFn - post: MethodFn - put: MethodFn request: RequestFn setConfig: (config: Config) => Config - trace: MethodFn -} +} & { + [K in HttpMethod]: MethodFn +} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }) export interface Config { /** @@ -47,7 +42,7 @@ export interface Config { * * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} */ - method?: "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" + method?: Uppercase /** * A function for serializing request query parameters. By default, arrays * will be exploded in form style, objects will be exploded in deepObject diff --git a/packages/sdk/js/src/gen/core/utils.gen.ts b/packages/sdk/js/src/gen/core/utils.gen.ts index be18c608a5..8a45f72698 100644 --- a/packages/sdk/js/src/gen/core/utils.gen.ts +++ b/packages/sdk/js/src/gen/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from "./bodySerializer.gen.js" +import type { BodySerializer, QuerySerializer } from "./bodySerializer.gen.js" import { type ArraySeparatorStyle, serializeArrayParam, @@ -107,3 +107,31 @@ export const getUrl = ({ } return url } + +export function getValidRequestBody(options: { + body?: unknown + bodySerializer?: BodySerializer | null + serializedBody?: unknown +}) { + const hasBody = options.body !== undefined + const isSerializedBody = hasBody && options.bodySerializer + + if (isSerializedBody) { + if ("serializedBody" in options) { + const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== "" + + return hasSerializedBody ? options.serializedBody : null + } + + // not all clients implement a serializedBody property (i.e. client-axios) + return options.body !== "" ? options.body : null + } + + // plain/text body + if (hasBody) { + return options.body + } + + // no body was provided + return undefined +} diff --git a/packages/sdk/js/src/gen/sdk.gen.ts b/packages/sdk/js/src/gen/sdk.gen.ts index 5e3e67e1c0..6b38f50073 100644 --- a/packages/sdk/js/src/gen/sdk.gen.ts +++ b/packages/sdk/js/src/gen/sdk.gen.ts @@ -1,209 +1,322 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Options as ClientOptions, TDataShape, Client } from "./client/index.js" +import { client } from "./client.gen.js" +import type { Client, Options as Options2, TDataShape } from "./client/index.js" import type { - GlobalEventData, - GlobalEventResponses, - ProjectListData, - ProjectListResponses, - ProjectCurrentData, - ProjectCurrentResponses, - PtyListData, - PtyListResponses, - PtyCreateData, - PtyCreateResponses, - PtyCreateErrors, - PtyRemoveData, - PtyRemoveResponses, - PtyRemoveErrors, - PtyGetData, - PtyGetResponses, - PtyGetErrors, - PtyUpdateData, - PtyUpdateResponses, - PtyUpdateErrors, - PtyConnectData, - PtyConnectResponses, - PtyConnectErrors, - ConfigGetData, - ConfigGetResponses, - ConfigUpdateData, - ConfigUpdateResponses, - ConfigUpdateErrors, - ToolIdsData, - ToolIdsResponses, - ToolIdsErrors, - ToolListData, - ToolListResponses, - ToolListErrors, - InstanceDisposeData, - InstanceDisposeResponses, - PathGetData, - PathGetResponses, - VcsGetData, - VcsGetResponses, - SessionListData, - SessionListResponses, - SessionCreateData, - SessionCreateResponses, - SessionCreateErrors, - SessionStatusData, - SessionStatusResponses, - SessionStatusErrors, - SessionDeleteData, - SessionDeleteResponses, - SessionDeleteErrors, - SessionGetData, - SessionGetResponses, - SessionGetErrors, - SessionUpdateData, - SessionUpdateResponses, - SessionUpdateErrors, - SessionChildrenData, - SessionChildrenResponses, - SessionChildrenErrors, - SessionTodoData, - SessionTodoResponses, - SessionTodoErrors, - SessionInitData, - SessionInitResponses, - SessionInitErrors, - SessionForkData, - SessionForkResponses, - SessionAbortData, - SessionAbortResponses, - SessionAbortErrors, - SessionUnshareData, - SessionUnshareResponses, - SessionUnshareErrors, - SessionShareData, - SessionShareResponses, - SessionShareErrors, - SessionDiffData, - SessionDiffResponses, - SessionDiffErrors, - SessionSummarizeData, - SessionSummarizeResponses, - SessionSummarizeErrors, - SessionMessagesData, - SessionMessagesResponses, - SessionMessagesErrors, - SessionPromptData, - SessionPromptResponses, - SessionPromptErrors, - SessionMessageData, - SessionMessageResponses, - SessionMessageErrors, - SessionPromptAsyncData, - SessionPromptAsyncResponses, - SessionPromptAsyncErrors, - SessionCommandData, - SessionCommandResponses, - SessionCommandErrors, - SessionShellData, - SessionShellResponses, - SessionShellErrors, - SessionRevertData, - SessionRevertResponses, - SessionRevertErrors, - SessionUnrevertData, - SessionUnrevertResponses, - SessionUnrevertErrors, - PostSessionIdPermissionsPermissionIdData, - PostSessionIdPermissionsPermissionIdResponses, - PostSessionIdPermissionsPermissionIdErrors, + AppAgentsData, + AppAgentsResponses, + AppLogData, + AppLogErrors, + AppLogResponses, + AppSkillsData, + AppSkillsResponses, + AuthRemoveData, + AuthRemoveErrors, + AuthRemoveResponses, + AuthSetData, + AuthSetErrors, + AuthSetResponses, CommandListData, CommandListResponses, + ConfigGetData, + ConfigGetResponses, ConfigProvidersData, ConfigProvidersResponses, - ProviderListData, - ProviderListResponses, - ProviderAuthData, - ProviderAuthResponses, - ProviderOauthAuthorizeData, - ProviderOauthAuthorizeResponses, - ProviderOauthAuthorizeErrors, - ProviderOauthCallbackData, - ProviderOauthCallbackResponses, - ProviderOauthCallbackErrors, - FindTextData, - FindTextResponses, - FindFilesData, - FindFilesResponses, - FindSymbolsData, - FindSymbolsResponses, + ConfigUpdateData, + ConfigUpdateErrors, + ConfigUpdateResponses, + EventSubscribeData, + EventSubscribeResponses, + ExperimentalConsoleGetData, + ExperimentalConsoleGetErrors, + ExperimentalConsoleGetResponses, + ExperimentalConsoleListOrgsData, + ExperimentalConsoleListOrgsErrors, + ExperimentalConsoleListOrgsResponses, + ExperimentalConsoleSwitchOrgData, + ExperimentalConsoleSwitchOrgResponses, + ExperimentalResourceListData, + ExperimentalResourceListResponses, + ExperimentalSessionListData, + ExperimentalSessionListResponses, + ExperimentalWorkspaceAdapterListData, + ExperimentalWorkspaceAdapterListResponses, + ExperimentalWorkspaceCreateData, + ExperimentalWorkspaceCreateErrors, + ExperimentalWorkspaceCreateResponses, + ExperimentalWorkspaceListData, + ExperimentalWorkspaceListResponses, + ExperimentalWorkspaceRemoveData, + ExperimentalWorkspaceRemoveErrors, + ExperimentalWorkspaceRemoveResponses, + ExperimentalWorkspaceStatusData, + ExperimentalWorkspaceStatusResponses, + ExperimentalWorkspaceSyncListData, + ExperimentalWorkspaceSyncListResponses, + ExperimentalWorkspaceWarpData, + ExperimentalWorkspaceWarpErrors, + ExperimentalWorkspaceWarpResponses, FileListData, FileListResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, - AppLogData, - AppLogResponses, - AppLogErrors, - AppAgentsData, - AppAgentsResponses, - McpStatusData, - McpStatusResponses, + FindFilesData, + FindFilesResponses, + FindSymbolsData, + FindSymbolsResponses, + FindTextData, + FindTextResponses, + FormatterStatusData, + FormatterStatusResponses, + GlobalConfigGetData, + GlobalConfigGetResponses, + GlobalConfigUpdateData, + GlobalConfigUpdateErrors, + GlobalConfigUpdateResponses, + GlobalDisposeData, + GlobalDisposeResponses, + GlobalEventData, + GlobalEventResponses, + GlobalHealthData, + GlobalHealthResponses, + GlobalUpgradeData, + GlobalUpgradeErrors, + GlobalUpgradeResponses, + InstanceDisposeData, + InstanceDisposeResponses, + LspStatusData, + LspStatusResponses, McpAddData, - McpAddResponses, McpAddErrors, - McpAuthRemoveData, - McpAuthRemoveResponses, - McpAuthRemoveErrors, - McpAuthStartData, - McpAuthStartResponses, - McpAuthStartErrors, - McpAuthCallbackData, - McpAuthCallbackResponses, - McpAuthCallbackErrors, + McpAddResponses, McpAuthAuthenticateData, - McpAuthAuthenticateResponses, McpAuthAuthenticateErrors, + McpAuthAuthenticateResponses, + McpAuthCallbackData, + McpAuthCallbackErrors, + McpAuthCallbackResponses, + McpAuthRemoveData, + McpAuthRemoveErrors, + McpAuthRemoveResponses, + McpAuthStartData, + McpAuthStartErrors, + McpAuthStartResponses, McpConnectData, McpConnectResponses, McpDisconnectData, McpDisconnectResponses, - LspStatusData, - LspStatusResponses, - FormatterStatusData, - FormatterStatusResponses, + McpStatusData, + McpStatusResponses, + PartDeleteData, + PartDeleteErrors, + PartDeleteResponses, + PartUpdateData, + PartUpdateErrors, + PartUpdateResponses, + PathGetData, + PathGetResponses, + PermissionListData, + PermissionListResponses, + PermissionReplyData, + PermissionReplyErrors, + PermissionReplyResponses, + PermissionRespondData, + PermissionRespondErrors, + PermissionRespondResponses, + ProjectCurrentData, + ProjectCurrentResponses, + ProjectInitGitData, + ProjectInitGitResponses, + ProjectListData, + ProjectListResponses, + ProjectUpdateData, + ProjectUpdateErrors, + ProjectUpdateResponses, + ProviderAuthData, + ProviderAuthResponses, + ProviderListData, + ProviderListResponses, + ProviderOauthAuthorizeData, + ProviderOauthAuthorizeErrors, + ProviderOauthAuthorizeResponses, + ProviderOauthCallbackData, + ProviderOauthCallbackErrors, + ProviderOauthCallbackResponses, + PtyConnectData, + PtyConnectErrors, + PtyConnectResponses, + PtyConnectTokenData, + PtyConnectTokenErrors, + PtyConnectTokenResponses, + PtyCreateData, + PtyCreateErrors, + PtyCreateResponses, + PtyGetData, + PtyGetErrors, + PtyGetResponses, + PtyListData, + PtyListResponses, + PtyRemoveData, + PtyRemoveErrors, + PtyRemoveResponses, + PtyShellsData, + PtyShellsResponses, + PtyUpdateData, + PtyUpdateErrors, + PtyUpdateResponses, + QuestionListData, + QuestionListResponses, + QuestionRejectData, + QuestionRejectErrors, + QuestionRejectResponses, + QuestionReplyData, + QuestionReplyErrors, + QuestionReplyResponses, + SessionAbortData, + SessionAbortErrors, + SessionAbortResponses, + SessionChildrenData, + SessionChildrenErrors, + SessionChildrenResponses, + SessionCommandData, + SessionCommandErrors, + SessionCommandResponses, + SessionCreateData, + SessionCreateErrors, + SessionCreateResponses, + SessionDeleteData, + SessionDeleteErrors, + SessionDeleteMessageData, + SessionDeleteMessageErrors, + SessionDeleteMessageResponses, + SessionDeleteResponses, + SessionDiffData, + SessionDiffResponses, + SessionForkData, + SessionForkErrors, + SessionForkResponses, + SessionGetData, + SessionGetErrors, + SessionGetResponses, + SessionInitData, + SessionInitErrors, + SessionInitResponses, + SessionListData, + SessionListResponses, + SessionMessageData, + SessionMessageErrors, + SessionMessageResponses, + SessionMessagesData, + SessionMessagesErrors, + SessionMessagesResponses, + SessionPromptAsyncData, + SessionPromptAsyncErrors, + SessionPromptAsyncResponses, + SessionPromptData, + SessionPromptErrors, + SessionPromptResponses, + SessionRevertData, + SessionRevertErrors, + SessionRevertResponses, + SessionShareData, + SessionShareErrors, + SessionShareResponses, + SessionShellData, + SessionShellErrors, + SessionShellResponses, + SessionStatusData, + SessionStatusErrors, + SessionStatusResponses, + SessionSummarizeData, + SessionSummarizeErrors, + SessionSummarizeResponses, + SessionTodoData, + SessionTodoErrors, + SessionTodoResponses, + SessionUnrevertData, + SessionUnrevertErrors, + SessionUnrevertResponses, + SessionUnshareData, + SessionUnshareErrors, + SessionUnshareResponses, + SessionUpdateData, + SessionUpdateErrors, + SessionUpdateResponses, + SyncHistoryListData, + SyncHistoryListErrors, + SyncHistoryListResponses, + SyncReplayData, + SyncReplayErrors, + SyncReplayResponses, + SyncStartData, + SyncStartResponses, + SyncStealData, + SyncStealErrors, + SyncStealResponses, + ToolIdsData, + ToolIdsErrors, + ToolIdsResponses, + ToolListData, + ToolListErrors, + ToolListResponses, TuiAppendPromptData, - TuiAppendPromptResponses, TuiAppendPromptErrors, - TuiOpenHelpData, - TuiOpenHelpResponses, - TuiOpenSessionsData, - TuiOpenSessionsResponses, - TuiOpenThemesData, - TuiOpenThemesResponses, - TuiOpenModelsData, - TuiOpenModelsResponses, - TuiSubmitPromptData, - TuiSubmitPromptResponses, + TuiAppendPromptResponses, TuiClearPromptData, TuiClearPromptResponses, - TuiExecuteCommandData, - TuiExecuteCommandResponses, - TuiExecuteCommandErrors, - TuiShowToastData, - TuiShowToastResponses, - TuiPublishData, - TuiPublishResponses, - TuiPublishErrors, TuiControlNextData, TuiControlNextResponses, TuiControlResponseData, TuiControlResponseResponses, - AuthSetData, - AuthSetResponses, - AuthSetErrors, - EventSubscribeData, - EventSubscribeResponses, + TuiExecuteCommandData, + TuiExecuteCommandErrors, + TuiExecuteCommandResponses, + TuiOpenHelpData, + TuiOpenHelpResponses, + TuiOpenModelsData, + TuiOpenModelsResponses, + TuiOpenSessionsData, + TuiOpenSessionsResponses, + TuiOpenThemesData, + TuiOpenThemesResponses, + TuiPublishData, + TuiPublishErrors, + TuiPublishResponses, + TuiSelectSessionData, + TuiSelectSessionErrors, + TuiSelectSessionResponses, + TuiShowToastData, + TuiShowToastResponses, + TuiSubmitPromptData, + TuiSubmitPromptResponses, + VcsApplyData, + VcsApplyErrors, + VcsApplyResponses, + VcsDiffData, + VcsDiffRawData, + VcsDiffRawResponses, + VcsDiffResponses, + VcsGetData, + VcsGetResponses, + VcsStatusData, + VcsStatusResponses, + WorktreeCreateData, + WorktreeCreateErrors, + WorktreeCreateResponses, + WorktreeListData, + WorktreeListErrors, + WorktreeListResponses, + WorktreeRemoveData, + WorktreeRemoveErrors, + WorktreeRemoveResponses, + WorktreeResetData, + WorktreeResetErrors, + WorktreeResetResponses, } from "./types.gen.js" -import { client as _heyApiClient } from "./client.gen.js" -export type Options = ClientOptions< +export type Options = Options2< TData, ThrowOnError > & { @@ -220,67 +333,71 @@ export type Options } -class _HeyApiClient { - protected _client: Client = _heyApiClient +class HeyApiClient { + protected client: Client constructor(args?: { client?: Client }) { - if (args?.client) { - this._client = args.client + this.client = args?.client ?? client + } +} + +class HeyApiRegistry { + private readonly defaultKey = "default" + + private readonly instances: Map = new Map() + + get(key?: string): T { + const instance = this.instances.get(key ?? this.defaultKey) + if (!instance) { + throw new Error(`No SDK client found. Create one with "new OpencodeClient()" to fix this error.`) } + return instance + } + + set(value: T, key?: string): void { + this.instances.set(key ?? this.defaultKey, value) } } -class Global extends _HeyApiClient { +export class Auth extends HeyApiClient { /** - * Get events + * Remove auth credentials + * + * Remove authentication credentials */ - public event(options?: Options) { - return (options?.client ?? this._client).get.sse({ - url: "/global/event", + public remove(options: Options) { + return (options.client ?? this.client).delete({ + url: "/auth/{providerID}", ...options, }) } + + /** + * Set auth credentials + * + * Set authentication credentials + */ + public set(options: Options) { + return (options.client ?? this.client).put({ + url: "/auth/{providerID}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } } -class Project extends _HeyApiClient { +export class App extends HeyApiClient { /** - * List all projects + * Write log + * + * Write a log entry to the server logs with specified level and metadata. */ - public list(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/project", - ...options, - }) - } - - /** - * Get the current project - */ - public current(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/project/current", - ...options, - }) - } -} - -class Pty extends _HeyApiClient { - /** - * List all PTY sessions - */ - public list(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/pty", - ...options, - }) - } - - /** - * Create a new PTY session - */ - public create(options?: Options) { - return (options?.client ?? this._client).post({ - url: "/pty", + public log(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/log", ...options, headers: { "Content-Type": "application/json", @@ -290,31 +407,716 @@ class Pty extends _HeyApiClient { } /** - * Remove a PTY session + * List agents + * + * Get a list of all available AI agents in the OpenCode system. */ - public remove(options: Options) { - return (options.client ?? this._client).delete({ - url: "/pty/{id}", + public agents(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/agent", ...options, }) } /** - * Get PTY session info + * List skills + * + * Get a list of all available skills in the OpenCode system. */ - public get(options: Options) { - return (options.client ?? this._client).get({ - url: "/pty/{id}", + public skills(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/skill", + ...options, + }) + } +} + +export class Config extends HeyApiClient { + /** + * Get global configuration + * + * Retrieve the current global OpenCode configuration settings and preferences. + */ + public get(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/global/config", ...options, }) } /** - * Update PTY session + * Update global configuration + * + * Update global OpenCode configuration settings and preferences. */ - public update(options: Options) { - return (options.client ?? this._client).put({ - url: "/pty/{id}", + public update(options?: Options) { + return (options?.client ?? this.client).patch({ + url: "/global/config", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } +} + +export class Global extends HeyApiClient { + /** + * Get health + * + * Get health information about the OpenCode server. + */ + public health(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/global/health", + ...options, + }) + } + + /** + * Get global events + * + * Subscribe to global events from the OpenCode system using server-sent events. + */ + public event(options?: Options) { + return (options?.client ?? this.client).sse.get({ + url: "/global/event", + ...options, + }) + } + + /** + * Dispose instance + * + * Clean up and dispose all OpenCode instances, releasing all resources. + */ + public dispose(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/global/dispose", + ...options, + }) + } + + /** + * Upgrade opencode + * + * Upgrade opencode to the specified version or latest if not specified. + */ + public upgrade(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/global/upgrade", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } + + private _config?: Config + get config(): Config { + return (this._config ??= new Config({ client: this.client })) + } +} + +export class Event extends HeyApiClient { + /** + * Subscribe to events + * + * Get events + */ + public subscribe(options?: Options) { + return (options?.client ?? this.client).sse.get({ + url: "/event", + ...options, + }) + } +} + +export class Config2 extends HeyApiClient { + /** + * Get configuration + * + * Retrieve the current OpenCode configuration settings and preferences. + */ + public get(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/config", + ...options, + }) + } + + /** + * Update configuration + * + * Update OpenCode configuration settings and preferences. + */ + public update(options?: Options) { + return (options?.client ?? this.client).patch({ + url: "/config", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } + + /** + * List config providers + * + * Get a list of all configured AI providers and their default models. + */ + public providers(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/config/providers", + ...options, + }) + } +} + +export class Console extends HeyApiClient { + /** + * Get active Console provider metadata + * + * Get the active Console org name and the set of provider IDs managed by that Console org. + */ + public get(options?: Options) { + return (options?.client ?? this.client).get< + ExperimentalConsoleGetResponses, + ExperimentalConsoleGetErrors, + ThrowOnError + >({ url: "/experimental/console", ...options }) + } + + /** + * List switchable Console orgs + * + * Get the available Console orgs across logged-in accounts, including the current active org. + */ + public listOrgs( + options?: Options, + ) { + return (options?.client ?? this.client).get< + ExperimentalConsoleListOrgsResponses, + ExperimentalConsoleListOrgsErrors, + ThrowOnError + >({ url: "/experimental/console/orgs", ...options }) + } + + /** + * Switch active Console org + * + * Persist a new active Console account/org selection for the current local OpenCode state. + */ + public switchOrg( + options?: Options, + ) { + return (options?.client ?? this.client).post({ + url: "/experimental/console/switch", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } +} + +export class Session extends HeyApiClient { + /** + * List sessions + * + * Get a list of all OpenCode sessions across projects, sorted by most recently updated. Archived sessions are excluded by default. + */ + public list(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/experimental/session", + ...options, + }) + } +} + +export class Resource extends HeyApiClient { + /** + * Get MCP resources + * + * Get all available MCP resources from connected servers. Optionally filter by name. + */ + public list(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/experimental/resource", + ...options, + }) + } +} + +export class Adapter extends HeyApiClient { + /** + * List workspace adapters + * + * List all available workspace adapters for the current project. + */ + public list( + options?: Options, + ) { + return (options?.client ?? this.client).get({ + url: "/experimental/workspace/adapter", + ...options, + }) + } +} + +export class Workspace extends HeyApiClient { + /** + * List workspaces + * + * List all workspaces. + */ + public list(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/experimental/workspace", + ...options, + }) + } + + /** + * Create workspace + * + * Create a workspace for the current project. + */ + public create( + options?: Options, + ) { + return (options?.client ?? this.client).post< + ExperimentalWorkspaceCreateResponses, + ExperimentalWorkspaceCreateErrors, + ThrowOnError + >({ + url: "/experimental/workspace", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } + + /** + * Sync workspace list + * + * Register missing workspaces returned by workspace adapters. + */ + public syncList( + options?: Options, + ) { + return (options?.client ?? this.client).post({ + url: "/experimental/workspace/sync-list", + ...options, + }) + } + + /** + * Workspace status + * + * Get connection status for workspaces in the current project. + */ + public status( + options?: Options, + ) { + return (options?.client ?? this.client).get({ + url: "/experimental/workspace/status", + ...options, + }) + } + + /** + * Remove workspace + * + * Remove an existing workspace. + */ + public remove(options: Options) { + return (options.client ?? this.client).delete< + ExperimentalWorkspaceRemoveResponses, + ExperimentalWorkspaceRemoveErrors, + ThrowOnError + >({ url: "/experimental/workspace/{id}", ...options }) + } + + /** + * Warp session into workspace + * + * Move a session's sync history into the target workspace, or detach it to the local project. + */ + public warp(options?: Options) { + return (options?.client ?? this.client).post< + ExperimentalWorkspaceWarpResponses, + ExperimentalWorkspaceWarpErrors, + ThrowOnError + >({ + url: "/experimental/workspace/warp", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } + + private _adapter?: Adapter + get adapter(): Adapter { + return (this._adapter ??= new Adapter({ client: this.client })) + } +} + +export class Experimental extends HeyApiClient { + private _console?: Console + get console(): Console { + return (this._console ??= new Console({ client: this.client })) + } + + private _session?: Session + get session(): Session { + return (this._session ??= new Session({ client: this.client })) + } + + private _resource?: Resource + get resource(): Resource { + return (this._resource ??= new Resource({ client: this.client })) + } + + private _workspace?: Workspace + get workspace(): Workspace { + return (this._workspace ??= new Workspace({ client: this.client })) + } +} + +export class Tool extends HeyApiClient { + /** + * List tools + * + * Get a list of available tools with their JSON schema parameters for a specific provider and model combination. + */ + public list(options: Options) { + return (options.client ?? this.client).get({ + url: "/experimental/tool", + ...options, + }) + } + + /** + * List tool IDs + * + * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools. + */ + public ids(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/experimental/tool/ids", + ...options, + }) + } +} + +export class Worktree extends HeyApiClient { + /** + * Remove worktree + * + * Remove a git worktree and delete its branch. + */ + public remove(options?: Options) { + return (options?.client ?? this.client).delete({ + url: "/experimental/worktree", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } + + /** + * List worktrees + * + * List all sandbox worktrees for the current project. + */ + public list(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/experimental/worktree", + ...options, + }) + } + + /** + * Create worktree + * + * Create a new git worktree for the current project and run any configured startup scripts. + */ + public create(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/experimental/worktree", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } + + /** + * Reset worktree + * + * Reset a worktree branch to the primary default branch. + */ + public reset(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/experimental/worktree/reset", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } +} + +export class Find extends HeyApiClient { + /** + * Find text + * + * Search for text patterns across files in the project using ripgrep. + */ + public text(options: Options) { + return (options.client ?? this.client).get({ url: "/find", ...options }) + } + + /** + * Find files + * + * Search for files or directories by name or pattern in the project directory. + */ + public files(options: Options) { + return (options.client ?? this.client).get({ + url: "/find/file", + ...options, + }) + } + + /** + * Find symbols + * + * Search for workspace symbols like functions, classes, and variables using LSP. + */ + public symbols(options: Options) { + return (options.client ?? this.client).get({ + url: "/find/symbol", + ...options, + }) + } +} + +export class File extends HeyApiClient { + /** + * List files + * + * List files and directories in a specified path. + */ + public list(options: Options) { + return (options.client ?? this.client).get({ url: "/file", ...options }) + } + + /** + * Read file + * + * Read the content of a specified file. + */ + public read(options: Options) { + return (options.client ?? this.client).get({ + url: "/file/content", + ...options, + }) + } + + /** + * Get file status + * + * Get the git status of all files in the project. + */ + public status(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/file/status", + ...options, + }) + } +} + +export class Instance extends HeyApiClient { + /** + * Dispose instance + * + * Clean up and dispose the current OpenCode instance, releasing all resources. + */ + public dispose(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/instance/dispose", + ...options, + }) + } +} + +export class Path extends HeyApiClient { + /** + * Get paths + * + * Retrieve the current working directory and related path information for the OpenCode instance. + */ + public get(options?: Options) { + return (options?.client ?? this.client).get({ url: "/path", ...options }) + } +} + +export class Diff extends HeyApiClient { + /** + * Get raw VCS diff + * + * Retrieve a raw patch for current uncommitted changes. + */ + public raw(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/vcs/diff/raw", + ...options, + }) + } +} + +export class Vcs extends HeyApiClient { + /** + * Get VCS info + * + * Retrieve version control system (VCS) information for the current project, such as git branch. + */ + public get(options?: Options) { + return (options?.client ?? this.client).get({ url: "/vcs", ...options }) + } + + /** + * Get VCS status + * + * Retrieve changed files in the current working tree without patches. + */ + public status(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/vcs/status", + ...options, + }) + } + + /** + * Get VCS diff + * + * Retrieve the current git diff for the working tree or against the default branch. + */ + public diff(options: Options) { + return (options.client ?? this.client).get({ + url: "/vcs/diff", + ...options, + }) + } + + /** + * Apply VCS patch + * + * Apply a raw patch to the current working tree. + */ + public apply(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/vcs/apply", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } + + private _diff?: Diff + get diff2(): Diff { + return (this._diff ??= new Diff({ client: this.client })) + } +} + +export class Command extends HeyApiClient { + /** + * List commands + * + * Get a list of all available commands in the OpenCode system. + */ + public list(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/command", + ...options, + }) + } +} + +export class Lsp extends HeyApiClient { + /** + * Get LSP status + * + * Get LSP server status + */ + public status(options?: Options) { + return (options?.client ?? this.client).get({ url: "/lsp", ...options }) + } +} + +export class Formatter extends HeyApiClient { + /** + * Get formatter status + * + * Get formatter status + */ + public status(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/formatter", + ...options, + }) + } +} + +export class Auth2 extends HeyApiClient { + /** + * Remove MCP OAuth + * + * Remove OAuth credentials for an MCP server. + */ + public remove(options: Options) { + return (options.client ?? this.client).delete({ + url: "/mcp/{name}/auth", + ...options, + }) + } + + /** + * Start MCP OAuth + * + * Start OAuth authentication flow for a Model Context Protocol (MCP) server. + */ + public start(options: Options) { + return (options.client ?? this.client).post({ + url: "/mcp/{name}/auth", + ...options, + }) + } + + /** + * Complete MCP OAuth + * + * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code. + */ + public callback(options: Options) { + return (options.client ?? this.client).post({ + url: "/mcp/{name}/auth/callback", ...options, headers: { "Content-Type": "application/json", @@ -324,33 +1126,36 @@ class Pty extends _HeyApiClient { } /** - * Connect to a PTY session + * Authenticate MCP OAuth + * + * Start OAuth flow and wait for callback (opens browser). */ - public connect(options: Options) { - return (options.client ?? this._client).get({ - url: "/pty/{id}/connect", + public authenticate(options: Options) { + return (options.client ?? this.client).post({ + url: "/mcp/{name}/auth/authenticate", ...options, }) } } -class Config extends _HeyApiClient { +export class Mcp extends HeyApiClient { /** - * Get config info + * Get MCP status + * + * Get the status of all Model Context Protocol (MCP) servers. */ - public get(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/config", - ...options, - }) + public status(options?: Options) { + return (options?.client ?? this.client).get({ url: "/mcp", ...options }) } /** - * Update config + * Add MCP server + * + * Dynamically add a new Model Context Protocol (MCP) server to the system. */ - public update(options?: Options) { - return (options?.client ?? this._client).patch({ - url: "/config", + public add(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/mcp", ...options, headers: { "Content-Type": "application/json", @@ -360,90 +1165,371 @@ class Config extends _HeyApiClient { } /** - * List all providers + * Connect an MCP server. */ - public providers(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/config/providers", + public connect(options: Options) { + return (options.client ?? this.client).post({ + url: "/mcp/{name}/connect", + ...options, + }) + } + + /** + * Disconnect an MCP server. + */ + public disconnect(options: Options) { + return (options.client ?? this.client).post({ + url: "/mcp/{name}/disconnect", + ...options, + }) + } + + private _auth?: Auth2 + get auth(): Auth2 { + return (this._auth ??= new Auth2({ client: this.client })) + } +} + +export class Project extends HeyApiClient { + /** + * List all projects + * + * Get a list of projects that have been opened with OpenCode. + */ + public list(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/project", + ...options, + }) + } + + /** + * Get current project + * + * Retrieve the currently active project that OpenCode is working with. + */ + public current(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/project/current", + ...options, + }) + } + + /** + * Initialize git repository + * + * Create a git repository for the current project and return the refreshed project info. + */ + public initGit(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/project/git/init", + ...options, + }) + } + + /** + * Update project + * + * Update project properties such as name, icon, and commands. + */ + public update(options: Options) { + return (options.client ?? this.client).patch({ + url: "/project/{projectID}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } +} + +export class Pty extends HeyApiClient { + /** + * List available shells + * + * Get a list of available shells on the system. + */ + public shells(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/pty/shells", + ...options, + }) + } + + /** + * List PTY sessions + * + * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode. + */ + public list(options?: Options) { + return (options?.client ?? this.client).get({ url: "/pty", ...options }) + } + + /** + * Create PTY session + * + * Create a new pseudo-terminal (PTY) session for running shell commands and processes. + */ + public create(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/pty", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } + + /** + * Remove PTY session + * + * Remove and terminate a specific pseudo-terminal (PTY) session. + */ + public remove(options: Options) { + return (options.client ?? this.client).delete({ + url: "/pty/{ptyID}", + ...options, + }) + } + + /** + * Get PTY session + * + * Retrieve detailed information about a specific pseudo-terminal (PTY) session. + */ + public get(options: Options) { + return (options.client ?? this.client).get({ + url: "/pty/{ptyID}", + ...options, + }) + } + + /** + * Update PTY session + * + * Update properties of an existing pseudo-terminal (PTY) session. + */ + public update(options: Options) { + return (options.client ?? this.client).put({ + url: "/pty/{ptyID}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } + + /** + * Create PTY WebSocket token + * + * Create a short-lived ticket for opening a PTY WebSocket connection. + */ + public connectToken(options: Options) { + return (options.client ?? this.client).post({ + url: "/pty/{ptyID}/connect-token", + ...options, + }) + } + + /** + * Connect to PTY session + * + * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time. + */ + public connect(options: Options) { + return (options.client ?? this.client).get({ + url: "/pty/{ptyID}/connect", ...options, }) } } -class Tool extends _HeyApiClient { +export class Question extends HeyApiClient { /** - * List all tool IDs (including built-in and dynamically registered) + * List pending questions + * + * Get all pending question requests across all sessions. */ - public ids(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/experimental/tool/ids", + public list(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/question", ...options, }) } /** - * List tools with JSON schema parameters for a provider/model + * Reply to question request + * + * Provide answers to a question request from the AI assistant. */ - public list(options: Options) { - return (options.client ?? this._client).get({ - url: "/experimental/tool", + public reply(options: Options) { + return (options.client ?? this.client).post({ + url: "/question/{requestID}/reply", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } + + /** + * Reject question request + * + * Reject a question request from the AI assistant. + */ + public reject(options: Options) { + return (options.client ?? this.client).post({ + url: "/question/{requestID}/reject", ...options, }) } } -class Instance extends _HeyApiClient { +export class Permission extends HeyApiClient { /** - * Dispose the current instance + * List pending permissions + * + * Get all pending permission requests across all sessions. */ - public dispose(options?: Options) { - return (options?.client ?? this._client).post({ - url: "/instance/dispose", + public list(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/permission", ...options, }) } + + /** + * Respond to permission request + * + * Approve or deny a permission request from the AI assistant. + */ + public reply(options: Options) { + return (options.client ?? this.client).post({ + url: "/permission/{requestID}/reply", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } + + /** + * Respond to permission + * + * Approve or deny a permission request from the AI assistant. + * + * @deprecated + */ + public respond(options: Options) { + return (options.client ?? this.client).post({ + url: "/session/{id}/permissions/{permissionID}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } } -class Path extends _HeyApiClient { +export class Oauth extends HeyApiClient { /** - * Get the current path + * Start OAuth authorization + * + * Start the OAuth authorization flow for a provider. */ - public get(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/path", + public authorize(options: Options) { + return (options.client ?? this.client).post< + ProviderOauthAuthorizeResponses, + ProviderOauthAuthorizeErrors, + ThrowOnError + >({ + url: "/provider/{providerID}/oauth/authorize", ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } + + /** + * Handle OAuth callback + * + * Handle the OAuth callback from a provider after user authorization. + */ + public callback(options: Options) { + return (options.client ?? this.client).post< + ProviderOauthCallbackResponses, + ProviderOauthCallbackErrors, + ThrowOnError + >({ + url: "/provider/{providerID}/oauth/callback", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, }) } } -class Vcs extends _HeyApiClient { +export class Provider extends HeyApiClient { /** - * Get VCS info for the current instance + * List providers + * + * Get a list of all available AI providers, including both available and connected ones. */ - public get(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/vcs", + public list(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/provider", ...options, }) } + + /** + * Get provider auth methods + * + * Retrieve available authentication methods for all AI providers. + */ + public auth(options?: Options) { + return (options?.client ?? this.client).get({ + url: "/provider/auth", + ...options, + }) + } + + private _oauth?: Oauth + get oauth(): Oauth { + return (this._oauth ??= new Oauth({ client: this.client })) + } } -class Session extends _HeyApiClient { +export class Session2 extends HeyApiClient { /** - * List all sessions + * List sessions + * + * Get a list of all OpenCode sessions, sorted by most recently updated. */ public list(options?: Options) { - return (options?.client ?? this._client).get({ + return (options?.client ?? this.client).get({ url: "/session", ...options, }) } /** - * Create a new session + * Create session + * + * Create a new OpenCode session for interacting with AI assistants and managing conversations. */ public create(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/session", ...options, headers: { @@ -455,19 +1541,23 @@ class Session extends _HeyApiClient { /** * Get session status + * + * Retrieve the current status of all sessions, including active, idle, and completed states. */ public status(options?: Options) { - return (options?.client ?? this._client).get({ + return (options?.client ?? this.client).get({ url: "/session/status", ...options, }) } /** - * Delete a session and all its data + * Delete session + * + * Delete a session and permanently remove all associated data, including messages and history. */ public delete(options: Options) { - return (options.client ?? this._client).delete({ + return (options.client ?? this.client).delete({ url: "/session/{id}", ...options, }) @@ -475,19 +1565,23 @@ class Session extends _HeyApiClient { /** * Get session + * + * Retrieve detailed information about a specific OpenCode session. */ public get(options: Options) { - return (options.client ?? this._client).get({ + return (options.client ?? this.client).get({ url: "/session/{id}", ...options, }) } /** - * Update session properties + * Update session + * + * Update properties of an existing session, such as title or other metadata. */ public update(options: Options) { - return (options.client ?? this._client).patch({ + return (options.client ?? this.client).patch({ url: "/session/{id}", ...options, headers: { @@ -498,31 +1592,61 @@ class Session extends _HeyApiClient { } /** - * Get a session's children + * Get session children + * + * Retrieve all child sessions that were forked from the specified parent session. */ public children(options: Options) { - return (options.client ?? this._client).get({ + return (options.client ?? this.client).get({ url: "/session/{id}/children", ...options, }) } /** - * Get the todo list for a session + * Get session todos + * + * Retrieve the todo list associated with a specific session, showing tasks and action items. */ public todo(options: Options) { - return (options.client ?? this._client).get({ + return (options.client ?? this.client).get({ url: "/session/{id}/todo", ...options, }) } /** - * Analyze the app and create an AGENTS.md file + * Get message diff + * + * Get the file changes (diff) that resulted from a specific user message in the session. */ - public init(options: Options) { - return (options.client ?? this._client).post({ - url: "/session/{id}/init", + public diff(options: Options) { + return (options.client ?? this.client).get({ + url: "/session/{id}/diff", + ...options, + }) + } + + /** + * Get session messages + * + * Retrieve all messages in a session, including user prompts and AI responses. + */ + public messages(options: Options) { + return (options.client ?? this.client).get({ + url: "/session/{id}/message", + ...options, + }) + } + + /** + * Send message + * + * Create and send a new message to a session, streaming the AI response. + */ + public prompt(options: Options) { + return (options.client ?? this.client).post({ + url: "/session/{id}/message", ...options, headers: { "Content-Type": "application/json", @@ -532,10 +1656,37 @@ class Session extends _HeyApiClient { } /** - * Fork an existing session at a specific message + * Delete message + * + * Permanently delete a specific message and all of its parts from a session without reverting file changes. + */ + public deleteMessage(options: Options) { + return (options.client ?? this.client).delete< + SessionDeleteMessageResponses, + SessionDeleteMessageErrors, + ThrowOnError + >({ url: "/session/{id}/message/{messageID}", ...options }) + } + + /** + * Get message + * + * Retrieve a specific message from a session by its message ID. + */ + public message(options: Options) { + return (options.client ?? this.client).get({ + url: "/session/{id}/message/{messageID}", + ...options, + }) + } + + /** + * Fork session + * + * Create a new session by forking an existing session at a specific message point. */ public fork(options: Options) { - return (options.client ?? this._client).post({ + return (options.client ?? this.client).post({ url: "/session/{id}/fork", ...options, headers: { @@ -546,50 +1697,64 @@ class Session extends _HeyApiClient { } /** - * Abort a session + * Abort session + * + * Abort an active session and stop any ongoing AI processing or command execution. */ public abort(options: Options) { - return (options.client ?? this._client).post({ + return (options.client ?? this.client).post({ url: "/session/{id}/abort", ...options, }) } /** - * Unshare the session + * Initialize session + * + * Analyze the current application and create an AGENTS.md file with project-specific agent configurations. + */ + public init(options: Options) { + return (options.client ?? this.client).post({ + url: "/session/{id}/init", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } + + /** + * Unshare session + * + * Remove the shareable link for a session, making it private again. */ public unshare(options: Options) { - return (options.client ?? this._client).delete({ + return (options.client ?? this.client).delete({ url: "/session/{id}/share", ...options, }) } /** - * Share a session + * Share session + * + * Create a shareable link for a session, allowing others to view the conversation. */ public share(options: Options) { - return (options.client ?? this._client).post({ + return (options.client ?? this.client).post({ url: "/session/{id}/share", ...options, }) } /** - * Get the diff for this session - */ - public diff(options: Options) { - return (options.client ?? this._client).get({ - url: "/session/{id}/diff", - ...options, - }) - } - - /** - * Summarize the session + * Summarize session + * + * Generate a concise summary of the session using AI compaction to preserve key information. */ public summarize(options: Options) { - return (options.client ?? this._client).post({ + return (options.client ?? this.client).post({ url: "/session/{id}/summarize", ...options, headers: { @@ -600,44 +1765,12 @@ class Session extends _HeyApiClient { } /** - * List messages for a session - */ - public messages(options: Options) { - return (options.client ?? this._client).get({ - url: "/session/{id}/message", - ...options, - }) - } - - /** - * Create and send a new message to a session - */ - public prompt(options: Options) { - return (options.client ?? this._client).post({ - url: "/session/{id}/message", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }) - } - - /** - * Get a message from a session - */ - public message(options: Options) { - return (options.client ?? this._client).get({ - url: "/session/{id}/message/{messageID}", - ...options, - }) - } - - /** - * Create and send a new message to a session, start if needed and return immediately + * Send async message + * + * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately. */ public promptAsync(options: Options) { - return (options.client ?? this._client).post({ + return (options.client ?? this.client).post({ url: "/session/{id}/prompt_async", ...options, headers: { @@ -648,10 +1781,12 @@ class Session extends _HeyApiClient { } /** - * Send a new command to a session + * Send command + * + * Send a new command to a session for execution by the AI assistant. */ public command(options: Options) { - return (options.client ?? this._client).post({ + return (options.client ?? this.client).post({ url: "/session/{id}/command", ...options, headers: { @@ -662,10 +1797,12 @@ class Session extends _HeyApiClient { } /** - * Run a shell command + * Run shell command + * + * Execute a shell command within the session context and return the AI's response. */ public shell(options: Options) { - return (options.client ?? this._client).post({ + return (options.client ?? this.client).post({ url: "/session/{id}/shell", ...options, headers: { @@ -676,10 +1813,12 @@ class Session extends _HeyApiClient { } /** - * Revert a message + * Revert message + * + * Revert a specific message in a session, undoing its effects and restoring the previous state. */ public revert(options: Options) { - return (options.client ?? this._client).post({ + return (options.client ?? this.client).post({ url: "/session/{id}/revert", ...options, headers: { @@ -690,57 +1829,35 @@ class Session extends _HeyApiClient { } /** - * Restore all reverted messages + * Restore reverted messages + * + * Restore all previously reverted messages in a session. */ public unrevert(options: Options) { - return (options.client ?? this._client).post({ + return (options.client ?? this.client).post({ url: "/session/{id}/unrevert", ...options, }) } } -class Command extends _HeyApiClient { +export class Part extends HeyApiClient { /** - * List all commands + * Delete a part from a message. */ - public list(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/command", + public delete(options: Options) { + return (options.client ?? this.client).delete({ + url: "/session/{id}/message/{messageID}/part/{partID}", ...options, }) } -} - -class Oauth extends _HeyApiClient { - /** - * Authorize a provider using OAuth - */ - public authorize(options: Options) { - return (options.client ?? this._client).post< - ProviderOauthAuthorizeResponses, - ProviderOauthAuthorizeErrors, - ThrowOnError - >({ - url: "/provider/{id}/oauth/authorize", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }) - } /** - * Handle OAuth callback for a provider + * Update a part in a message. */ - public callback(options: Options) { - return (options.client ?? this._client).post< - ProviderOauthCallbackResponses, - ProviderOauthCallbackErrors, - ThrowOnError - >({ - url: "/provider/{id}/oauth/callback", + public update(options: Options) { + return (options.client ?? this.client).patch({ + url: "/session/{id}/message/{messageID}/part/{partID}", ...options, headers: { "Content-Type": "application/json", @@ -750,100 +1867,45 @@ class Oauth extends _HeyApiClient { } } -class Provider extends _HeyApiClient { +export class History extends HeyApiClient { /** - * List all providers + * List sync events + * + * List sync events for all aggregates. Keys are aggregate IDs the client already knows about, values are the last known sequence ID. Events with seq > value are returned for those aggregates. Aggregates not listed in the input get their full history. */ - public list(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/provider", - ...options, - }) - } - - /** - * Get provider authentication methods - */ - public auth(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/provider/auth", - ...options, - }) - } - oauth = new Oauth({ client: this._client }) -} - -class Find extends _HeyApiClient { - /** - * Find text in files - */ - public text(options: Options) { - return (options.client ?? this._client).get({ - url: "/find", - ...options, - }) - } - - /** - * Find files - */ - public files(options: Options) { - return (options.client ?? this._client).get({ - url: "/find/file", - ...options, - }) - } - - /** - * Find workspace symbols - */ - public symbols(options: Options) { - return (options.client ?? this._client).get({ - url: "/find/symbol", + public list(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/sync/history", ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, }) } } -class File extends _HeyApiClient { +export class Sync extends HeyApiClient { /** - * List files and directories + * Start workspace sync + * + * Start sync loops for workspaces in the current project that have active sessions. */ - public list(options: Options) { - return (options.client ?? this._client).get({ - url: "/file", + public start(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/sync/start", ...options, }) } /** - * Read a file + * Replay sync events + * + * Validate and replay a complete sync event history. */ - public read(options: Options) { - return (options.client ?? this._client).get({ - url: "/file/content", - ...options, - }) - } - - /** - * Get file status - */ - public status(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/file/status", - ...options, - }) - } -} - -class App extends _HeyApiClient { - /** - * Write a log entry to the server logs - */ - public log(options?: Options) { - return (options?.client ?? this._client).post({ - url: "/log", + public replay(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/sync/replay", ...options, headers: { "Content-Type": "application/json", @@ -853,95 +1915,13 @@ class App extends _HeyApiClient { } /** - * List all agents + * Steal session into workspace + * + * Update a session to belong to the current workspace through the sync event system. */ - public agents(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/agent", - ...options, - }) - } -} - -class Auth extends _HeyApiClient { - /** - * Remove OAuth credentials for an MCP server - */ - public remove(options: Options) { - return (options.client ?? this._client).delete({ - url: "/mcp/{name}/auth", - ...options, - }) - } - - /** - * Start OAuth authentication flow for an MCP server - */ - public start(options: Options) { - return (options.client ?? this._client).post({ - url: "/mcp/{name}/auth", - ...options, - }) - } - - /** - * Complete OAuth authentication with authorization code - */ - public callback(options: Options) { - return (options.client ?? this._client).post({ - url: "/mcp/{name}/auth/callback", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }) - } - - /** - * Start OAuth flow and wait for callback (opens browser) - */ - public authenticate(options: Options) { - return (options.client ?? this._client).post( - { - url: "/mcp/{name}/auth/authenticate", - ...options, - }, - ) - } - - /** - * Set authentication credentials - */ - public set(options: Options) { - return (options.client ?? this._client).put({ - url: "/auth/{id}", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }) - } -} - -class Mcp extends _HeyApiClient { - /** - * Get MCP server status - */ - public status(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/mcp", - ...options, - }) - } - - /** - * Add MCP server dynamically - */ - public add(options?: Options) { - return (options?.client ?? this._client).post({ - url: "/mcp", + public steal(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/sync/steal", ...options, headers: { "Content-Type": "application/json", @@ -950,69 +1930,32 @@ class Mcp extends _HeyApiClient { }) } - /** - * Connect an MCP server - */ - public connect(options: Options) { - return (options.client ?? this._client).post({ - url: "/mcp/{name}/connect", - ...options, - }) - } - - /** - * Disconnect an MCP server - */ - public disconnect(options: Options) { - return (options.client ?? this._client).post({ - url: "/mcp/{name}/disconnect", - ...options, - }) - } - - auth = new Auth({ client: this._client }) -} - -class Lsp extends _HeyApiClient { - /** - * Get LSP server status - */ - public status(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/lsp", - ...options, - }) + private _history?: History + get history(): History { + return (this._history ??= new History({ client: this.client })) } } -class Formatter extends _HeyApiClient { +export class Control extends HeyApiClient { /** - * Get formatter status - */ - public status(options?: Options) { - return (options?.client ?? this._client).get({ - url: "/formatter", - ...options, - }) - } -} - -class Control extends _HeyApiClient { - /** - * Get the next TUI request from the queue + * Get next TUI request + * + * Retrieve the next TUI request from the queue for processing. */ public next(options?: Options) { - return (options?.client ?? this._client).get({ + return (options?.client ?? this.client).get({ url: "/tui/control/next", ...options, }) } /** - * Submit a response to the TUI request queue + * Submit TUI response + * + * Submit a response to the TUI request queue to complete a pending request. */ public response(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/control/response", ...options, headers: { @@ -1023,12 +1966,14 @@ class Control extends _HeyApiClient { } } -class Tui extends _HeyApiClient { +export class Tui extends HeyApiClient { /** - * Append prompt to the TUI + * Append TUI prompt + * + * Append prompt to the TUI. */ public appendPrompt(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/append-prompt", ...options, headers: { @@ -1039,70 +1984,84 @@ class Tui extends _HeyApiClient { } /** - * Open the help dialog + * Open help dialog + * + * Open the help dialog in the TUI to display user assistance information. */ public openHelp(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/open-help", ...options, }) } /** - * Open the session dialog + * Open sessions dialog + * + * Open the session dialog. */ public openSessions(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/open-sessions", ...options, }) } /** - * Open the theme dialog + * Open themes dialog + * + * Open the theme dialog. */ public openThemes(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/open-themes", ...options, }) } /** - * Open the model dialog + * Open models dialog + * + * Open the model dialog. */ public openModels(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/open-models", ...options, }) } /** - * Submit the prompt + * Submit TUI prompt + * + * Submit the prompt. */ public submitPrompt(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/submit-prompt", ...options, }) } /** - * Clear the prompt + * Clear TUI prompt + * + * Clear the prompt. */ public clearPrompt(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/clear-prompt", ...options, }) } /** - * Execute a TUI command (e.g. agent_cycle) + * Execute TUI command + * + * Execute a TUI command. */ public executeCommand(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/execute-command", ...options, headers: { @@ -1113,10 +2072,12 @@ class Tui extends _HeyApiClient { } /** - * Show a toast notification in the TUI + * Show TUI toast + * + * Show a toast notification in the TUI. */ public showToast(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/show-toast", ...options, headers: { @@ -1127,10 +2088,12 @@ class Tui extends _HeyApiClient { } /** - * Publish a TUI event + * Publish TUI event + * + * Publish a TUI event. */ public publish(options?: Options) { - return (options?.client ?? this._client).post({ + return (options?.client ?? this.client).post({ url: "/tui/publish", ...options, headers: { @@ -1139,59 +2102,164 @@ class Tui extends _HeyApiClient { }, }) } - control = new Control({ client: this._client }) -} -class Event extends _HeyApiClient { /** - * Get events + * Select session + * + * Navigate the TUI to display the specified session. */ - public subscribe(options?: Options) { - return (options?.client ?? this._client).get.sse({ - url: "/event", - ...options, - }) - } -} - -export class OpencodeClient extends _HeyApiClient { - /** - * Respond to a permission request - */ - public postSessionIdPermissionsPermissionId( - options: Options, - ) { - return (options.client ?? this._client).post< - PostSessionIdPermissionsPermissionIdResponses, - PostSessionIdPermissionsPermissionIdErrors, - ThrowOnError - >({ - url: "/session/{id}/permissions/{permissionID}", + public selectSession(options?: Options) { + return (options?.client ?? this.client).post({ + url: "/tui/select-session", ...options, headers: { "Content-Type": "application/json", - ...options.headers, + ...options?.headers, }, }) } - global = new Global({ client: this._client }) - project = new Project({ client: this._client }) - pty = new Pty({ client: this._client }) - config = new Config({ client: this._client }) - tool = new Tool({ client: this._client }) - instance = new Instance({ client: this._client }) - path = new Path({ client: this._client }) - vcs = new Vcs({ client: this._client }) - session = new Session({ client: this._client }) - command = new Command({ client: this._client }) - provider = new Provider({ client: this._client }) - find = new Find({ client: this._client }) - file = new File({ client: this._client }) - app = new App({ client: this._client }) - mcp = new Mcp({ client: this._client }) - lsp = new Lsp({ client: this._client }) - formatter = new Formatter({ client: this._client }) - tui = new Tui({ client: this._client }) - auth = new Auth({ client: this._client }) - event = new Event({ client: this._client }) + + private _control?: Control + get control(): Control { + return (this._control ??= new Control({ client: this.client })) + } +} + +export class OpencodeClient extends HeyApiClient { + public static readonly __registry = new HeyApiRegistry() + + constructor(args?: { client?: Client; key?: string }) { + super(args) + OpencodeClient.__registry.set(this, args?.key) + } + + private _auth?: Auth + get auth(): Auth { + return (this._auth ??= new Auth({ client: this.client })) + } + + private _app?: App + get app(): App { + return (this._app ??= new App({ client: this.client })) + } + + private _global?: Global + get global(): Global { + return (this._global ??= new Global({ client: this.client })) + } + + private _event?: Event + get event(): Event { + return (this._event ??= new Event({ client: this.client })) + } + + private _config?: Config2 + get config(): Config2 { + return (this._config ??= new Config2({ client: this.client })) + } + + private _experimental?: Experimental + get experimental(): Experimental { + return (this._experimental ??= new Experimental({ client: this.client })) + } + + private _tool?: Tool + get tool(): Tool { + return (this._tool ??= new Tool({ client: this.client })) + } + + private _worktree?: Worktree + get worktree(): Worktree { + return (this._worktree ??= new Worktree({ client: this.client })) + } + + private _find?: Find + get find(): Find { + return (this._find ??= new Find({ client: this.client })) + } + + private _file?: File + get file(): File { + return (this._file ??= new File({ client: this.client })) + } + + private _instance?: Instance + get instance(): Instance { + return (this._instance ??= new Instance({ client: this.client })) + } + + private _path?: Path + get path(): Path { + return (this._path ??= new Path({ client: this.client })) + } + + private _vcs?: Vcs + get vcs(): Vcs { + return (this._vcs ??= new Vcs({ client: this.client })) + } + + private _command?: Command + get command(): Command { + return (this._command ??= new Command({ client: this.client })) + } + + private _lsp?: Lsp + get lsp(): Lsp { + return (this._lsp ??= new Lsp({ client: this.client })) + } + + private _formatter?: Formatter + get formatter(): Formatter { + return (this._formatter ??= new Formatter({ client: this.client })) + } + + private _mcp?: Mcp + get mcp(): Mcp { + return (this._mcp ??= new Mcp({ client: this.client })) + } + + private _project?: Project + get project(): Project { + return (this._project ??= new Project({ client: this.client })) + } + + private _pty?: Pty + get pty(): Pty { + return (this._pty ??= new Pty({ client: this.client })) + } + + private _question?: Question + get question(): Question { + return (this._question ??= new Question({ client: this.client })) + } + + private _permission?: Permission + get permission(): Permission { + return (this._permission ??= new Permission({ client: this.client })) + } + + private _provider?: Provider + get provider(): Provider { + return (this._provider ??= new Provider({ client: this.client })) + } + + private _session?: Session2 + get session(): Session2 { + return (this._session ??= new Session2({ client: this.client })) + } + + private _part?: Part + get part(): Part { + return (this._part ??= new Part({ client: this.client })) + } + + private _sync?: Sync + get sync(): Sync { + return (this._sync ??= new Sync({ client: this.client })) + } + + private _tui?: Tui + get tui(): Tui { + return (this._tui ??= new Tui({ client: this.client })) + } } diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts index 5e4fd89061..12929a9c53 100644 --- a/packages/sdk/js/src/gen/types.gen.ts +++ b/packages/sdk/js/src/gen/types.gen.ts @@ -1,72 +1,191 @@ // This file is auto-generated by @hey-api/openapi-ts -export type EventServerInstanceDisposed = { - type: "server.instance.disposed" - properties: { - directory: string +export type ClientOptions = { + baseUrl: `${string}://${string}` | (string & {}) +} + +export type Event = + | EventTuiPromptAppend + | EventTuiCommandExecute + | EventTuiToastShow1 + | EventTuiSessionSelect + | EventServerConnected + | EventGlobalDisposed + | EventServerInstanceDisposed + | EventFileEdited + | EventFileWatcherUpdated + | EventLspClientDiagnostics + | EventLspUpdated + | EventMessagePartDelta + | EventPermissionAsked + | EventPermissionReplied + | EventSessionDiff + | EventSessionError + | EventQuestionAsked + | EventQuestionReplied + | EventQuestionRejected + | EventTodoUpdated + | EventSessionStatus + | EventSessionIdle + | EventMcpToolsChanged + | EventMcpBrowserOpenFailed + | EventCommandExecuted + | EventProjectUpdated + | EventSessionCompacted + | EventVcsBranchUpdated + | EventWorkspaceReady + | EventWorkspaceFailed + | EventWorkspaceStatus + | EventWorktreeReady + | EventWorktreeFailed + | EventPtyCreated + | EventPtyUpdated + | EventPtyExited + | EventPtyDeleted + | EventInstallationUpdated + | EventInstallationUpdateAvailable + | EventMessageUpdated + | EventMessageRemoved + | EventMessagePartUpdated + | EventMessagePartRemoved + | EventSessionCreated + | EventSessionUpdated + | EventSessionDeleted + | EventSessionNextAgentSwitched + | EventSessionNextModelSwitched + | EventSessionNextPrompted + | EventSessionNextSynthetic + | EventSessionNextShellStarted + | EventSessionNextShellEnded + | EventSessionNextStepStarted + | EventSessionNextStepEnded + | EventSessionNextStepFailed + | EventSessionNextTextStarted + | EventSessionNextTextDelta + | EventSessionNextTextEnded + | EventSessionNextReasoningStarted + | EventSessionNextReasoningDelta + | EventSessionNextReasoningEnded + | EventSessionNextToolInputStarted + | EventSessionNextToolInputDelta + | EventSessionNextToolInputEnded + | EventSessionNextToolCalled + | EventSessionNextToolProgress + | EventSessionNextToolSuccess + | EventSessionNextToolFailed + | EventSessionNextRetried + | EventSessionNextCompactionStarted + | EventSessionNextCompactionDelta + | EventSessionNextCompactionEnded + | EventCatalogModelUpdated + +export type OAuth = { + type: "oauth" + refresh: string + access: string + expires: number + accountId?: string + enterpriseUrl?: string +} + +export type ApiAuth = { + type: "api" + key: string + metadata?: { + [key: string]: string } } -export type EventInstallationUpdated = { - type: "installation.updated" +export type WellKnownAuth = { + type: "wellknown" + key: string + token: string +} + +export type Auth = OAuth | ApiAuth | WellKnownAuth + +export type EffectHttpApiErrorBadRequest = { + _tag: "BadRequest" +} + +export type EventTuiPromptAppend = { + id: string + type: "tui.prompt.append" properties: { - version: string + text: string } } -export type EventInstallationUpdateAvailable = { - type: "installation.update-available" +export type EventTuiCommandExecute = { + id: string + type: "tui.command.execute" properties: { - version: string + command: + | "session.list" + | "session.new" + | "session.share" + | "session.interrupt" + | "session.compact" + | "session.page.up" + | "session.page.down" + | "session.line.up" + | "session.line.down" + | "session.half.page.up" + | "session.half.page.down" + | "session.first" + | "session.last" + | "prompt.clear" + | "prompt.submit" + | "agent.cycle" + | string } } -export type EventLspClientDiagnostics = { - type: "lsp.client.diagnostics" +export type EventTuiToastShow = { + id: string + type: "tui.toast.show" properties: { - serverID: string - path: string + title?: string + message: string + variant: "info" | "success" | "warning" | "error" + duration?: number } } -export type EventLspUpdated = { - type: "lsp.updated" +export type EventTuiSessionSelect = { + id: string + type: "tui.session.select" properties: { - [key: string]: unknown + /** + * Session ID to navigate to + */ + sessionID: string } } -export type FileDiff = { - file: string - before: string - after: string - additions: number - deletions: number -} - -export type UserMessage = { +export type PermissionRequest = { id: string sessionID: string - role: "user" - time: { - created: number + permission: string + patterns: Array + metadata: { + [key: string]: unknown } - summary?: { - title?: string - body?: string - diffs: Array - } - agent: string - model: { - providerID: string - modelID: string - } - system?: string - tools?: { - [key: string]: boolean + always: Array + tool?: { + messageID: string + callID: string } } +export type SnapshotFileDiff = { + file?: string + patch?: string + additions: number + deletions: number + status?: "added" | "deleted" | "modified" +} + export type ProviderAuthError = { name: "ProviderAuthError" data: { @@ -96,6 +215,22 @@ export type MessageAbortedError = { } } +export type StructuredOutputError = { + name: "StructuredOutputError" + data: { + message: string + retries: number + } +} + +export type ContextOverflowError = { + name: "ContextOverflowError" + data: { + message: string + responseBody?: string + } +} + export type ApiError = { name: "APIError" data: { @@ -106,6 +241,177 @@ export type ApiError = { [key: string]: string } responseBody?: string + metadata?: { + [key: string]: string + } + } +} + +export type QuestionOption = { + /** + * Display text (1-5 words, concise) + */ + label: string + /** + * Explanation of choice + */ + description: string +} + +export type QuestionInfo = { + /** + * Complete question + */ + question: string + /** + * Very short label (max 30 chars) + */ + header: string + /** + * Available choices + */ + options: Array + multiple?: boolean + custom?: boolean +} + +export type QuestionTool = { + messageID: string + callID: string +} + +export type QuestionRequest = { + id: string + sessionID: string + /** + * Questions to ask + */ + questions: Array + tool?: QuestionTool +} + +export type QuestionAnswer = Array + +export type QuestionReplied = { + sessionID: string + requestID: string + answers: Array +} + +export type QuestionRejected = { + sessionID: string + requestID: string +} + +export type Todo = { + /** + * Brief description of the task + */ + content: string + /** + * Current status of the task: pending, in_progress, completed, cancelled + */ + status: string + /** + * Priority level of the task: high, medium, low + */ + priority: string +} + +export type SessionStatus = + | { + type: "idle" + } + | { + type: "retry" + attempt: number + message: string + action?: { + reason: string + provider: string + title: string + message: string + label: string + link?: string + } + next: number + } + | { + type: "busy" + } + +export type Project = { + id: string + worktree: string + vcs?: "git" + name?: string + icon?: { + url?: string + override?: string + color?: string + } + commands?: { + /** + * Startup script to run when creating a new workspace (worktree) + */ + start?: string + } + time: { + created: number + updated: number + initialized?: number + } + sandboxes: Array +} + +export type Pty = { + id: string + title: string + command: string + args: Array + cwd: string + status: "running" | "exited" + pid: number +} + +export type OutputFormatText = { + type: "text" +} + +export type JsonSchema = { + [key: string]: unknown +} + +export type OutputFormatJsonSchema = { + type: "json_schema" + schema: JsonSchema + retryCount?: number +} + +export type OutputFormat = OutputFormatText | OutputFormatJsonSchema + +export type UserMessage = { + id: string + sessionID: string + role: "user" + time: { + created: number + } + format?: OutputFormat + summary?: { + title?: string + body?: string + diffs: Array + } + agent: string + model: { + providerID: string + modelID: string + variant?: string + } + system?: string + tools?: { + [key: string]: boolean } } @@ -117,11 +423,19 @@ export type AssistantMessage = { created: number completed?: number } - error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError + error?: + | ProviderAuthError + | UnknownError + | MessageOutputLengthError + | MessageAbortedError + | StructuredOutputError + | ContextOverflowError + | ApiError parentID: string modelID: string providerID: string mode: string + agent: string path: { cwd: string root: string @@ -129,6 +443,7 @@ export type AssistantMessage = { summary?: boolean cost: number tokens: { + total?: number input: number output: number reasoning: number @@ -137,26 +452,13 @@ export type AssistantMessage = { write: number } } + structured?: unknown + variant?: string finish?: string } export type Message = UserMessage | AssistantMessage -export type EventMessageUpdated = { - type: "message.updated" - properties: { - info: Message - } -} - -export type EventMessageRemoved = { - type: "message.removed" - properties: { - sessionID: string - messageID: string - } -} - export type TextPart = { id: string sessionID: string @@ -174,6 +476,21 @@ export type TextPart = { } } +export type SubtaskPart = { + id: string + sessionID: string + messageID: string + type: "subtask" + prompt: string + description: string + agent: string + model?: { + providerID: string + modelID: string + } + command?: string +} + export type ReasoningPart = { id: string sessionID: string @@ -221,7 +538,14 @@ export type SymbolSource = { kind: number } -export type FilePartSource = FileSource | SymbolSource +export type ResourceSource = { + text: FilePartSourceText + type: "resource" + clientName: string + uri: string +} + +export type FilePartSource = FileSource | SymbolSource | ResourceSource export type FilePart = { id: string @@ -321,6 +645,7 @@ export type StepFinishPart = { snapshot?: string cost: number tokens: { + total?: number input: number output: number reasoning: number @@ -379,19 +704,13 @@ export type CompactionPart = { messageID: string type: "compaction" auto: boolean + overflow?: boolean + tail_start_id?: string } export type Part = | TextPart - | { - id: string - sessionID: string - messageID: string - type: "subtask" - prompt: string - description: string - agent: string - } + | SubtaskPart | ReasoningPart | FilePart | ToolPart @@ -403,154 +722,58 @@ export type Part = | RetryPart | CompactionPart -export type EventMessagePartUpdated = { - type: "message.part.updated" - properties: { - part: Part - delta?: string - } +export type PermissionAction = "allow" | "deny" | "ask" + +export type PermissionRule = { + permission: string + pattern: string + action: PermissionAction } -export type EventMessagePartRemoved = { - type: "message.part.removed" - properties: { - sessionID: string - messageID: string - partID: string - } -} - -export type Permission = { - id: string - type: string - pattern?: string | Array - sessionID: string - messageID: string - callID?: string - title: string - metadata: { - [key: string]: unknown - } - time: { - created: number - } -} - -export type EventPermissionUpdated = { - type: "permission.updated" - properties: Permission -} - -export type EventPermissionReplied = { - type: "permission.replied" - properties: { - sessionID: string - permissionID: string - response: string - } -} - -export type SessionStatus = - | { - type: "idle" - } - | { - type: "retry" - attempt: number - message: string - next: number - } - | { - type: "busy" - } - -export type EventSessionStatus = { - type: "session.status" - properties: { - sessionID: string - status: SessionStatus - } -} - -export type EventSessionIdle = { - type: "session.idle" - properties: { - sessionID: string - } -} - -export type EventSessionCompacted = { - type: "session.compacted" - properties: { - sessionID: string - } -} - -export type EventFileEdited = { - type: "file.edited" - properties: { - file: string - } -} - -export type Todo = { - /** - * Brief description of the task - */ - content: string - /** - * Current status of the task: pending, in_progress, completed, cancelled - */ - status: string - /** - * Priority level of the task: high, medium, low - */ - priority: string - /** - * Unique identifier for the todo item - */ - id: string -} - -export type EventTodoUpdated = { - type: "todo.updated" - properties: { - sessionID: string - todos: Array - } -} - -export type EventCommandExecuted = { - type: "command.executed" - properties: { - name: string - sessionID: string - arguments: string - messageID: string - } -} +export type PermissionRuleset = Array export type Session = { id: string + slug: string projectID: string + workspaceID?: string directory: string + path?: string parentID?: string summary?: { additions: number deletions: number files: number - diffs?: Array + diffs?: Array + } + cost?: number + tokens?: { + input: number + output: number + reasoning: number + cache: { + read: number + write: number + } } share?: { url: string } title: string + agent?: string + model?: { + id: string + providerID: string + variant?: string + } version: string time: { created: number updated: number compacting?: number + archived?: number } + permission?: PermissionRuleset revert?: { messageID: string partID?: string @@ -559,421 +782,196 @@ export type Session = { } } -export type EventSessionCreated = { - type: "session.created" - properties: { - info: Session - } +export type Prompt = { + text: string + files?: Array + agents?: Array + references?: Array } -export type EventSessionUpdated = { - type: "session.updated" - properties: { - info: Session - } -} - -export type EventSessionDeleted = { - type: "session.deleted" - properties: { - info: Session - } -} - -export type EventSessionDiff = { - type: "session.diff" - properties: { - sessionID: string - diff: Array - } -} - -export type EventSessionError = { - type: "session.error" - properties: { - sessionID?: string - error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError - } -} - -export type EventFileWatcherUpdated = { - type: "file.watcher.updated" - properties: { - file: string - event: "add" | "change" | "unlink" - } -} - -export type EventVcsBranchUpdated = { - type: "vcs.branch.updated" - properties: { - branch?: string - } -} - -export type EventTuiPromptAppend = { - type: "tui.prompt.append" - properties: { - text: string - } -} - -export type EventTuiCommandExecute = { - type: "tui.command.execute" - properties: { - command: - | ( - | "session.list" - | "session.new" - | "session.share" - | "session.interrupt" - | "session.compact" - | "session.page.up" - | "session.page.down" - | "session.half.page.up" - | "session.half.page.down" - | "session.first" - | "session.last" - | "prompt.clear" - | "prompt.submit" - | "agent.cycle" - ) - | string - } -} - -export type EventTuiToastShow = { - type: "tui.toast.show" - properties: { - title?: string - message: string - variant: "info" | "success" | "warning" | "error" - /** - * Duration in milliseconds - */ - duration?: number - } -} - -export type Pty = { - id: string - title: string - command: string - args: Array - cwd: string - status: "running" | "exited" - pid: number -} - -export type EventPtyCreated = { - type: "pty.created" - properties: { - info: Pty - } -} - -export type EventPtyUpdated = { - type: "pty.updated" - properties: { - info: Pty - } -} - -export type EventPtyExited = { - type: "pty.exited" - properties: { - id: string - exitCode: number - } -} - -export type EventPtyDeleted = { - type: "pty.deleted" - properties: { - id: string - } -} - -export type EventServerConnected = { - type: "server.connected" - properties: { - [key: string]: unknown - } -} - -export type Event = - | EventServerInstanceDisposed - | EventInstallationUpdated - | EventInstallationUpdateAvailable - | EventLspClientDiagnostics - | EventLspUpdated - | EventMessageUpdated - | EventMessageRemoved - | EventMessagePartUpdated - | EventMessagePartRemoved - | EventPermissionUpdated - | EventPermissionReplied - | EventSessionStatus - | EventSessionIdle - | EventSessionCompacted - | EventFileEdited - | EventTodoUpdated - | EventCommandExecuted - | EventSessionCreated - | EventSessionUpdated - | EventSessionDeleted - | EventSessionDiff - | EventSessionError - | EventFileWatcherUpdated - | EventVcsBranchUpdated - | EventTuiPromptAppend - | EventTuiCommandExecute - | EventTuiToastShow - | EventPtyCreated - | EventPtyUpdated - | EventPtyExited - | EventPtyDeleted - | EventServerConnected - export type GlobalEvent = { directory: string - payload: Event -} - -export type Project = { - id: string - worktree: string - vcsDir?: string - vcs?: "git" - time: { - created: number - initialized?: number - } -} - -export type BadRequestError = { - name: "BadRequest" - data: { - message: string - kind?: "Params" | "Headers" | "Query" | "Body" | "Payload" - } -} - -export type NotFoundError = { - name: "NotFoundError" - data: { - message: string - } + project?: string + workspace?: string + payload: + | EventTuiPromptAppend + | EventTuiCommandExecute + | EventTuiToastShow + | EventTuiSessionSelect + | EventServerConnected + | EventGlobalDisposed + | EventServerInstanceDisposed + | EventFileEdited + | EventFileWatcherUpdated + | EventLspClientDiagnostics + | EventLspUpdated + | EventMessagePartDelta + | EventPermissionAsked + | EventPermissionReplied + | EventSessionDiff + | EventSessionError + | EventQuestionAsked + | EventQuestionReplied + | EventQuestionRejected + | EventTodoUpdated + | EventSessionStatus + | EventSessionIdle + | EventMcpToolsChanged + | EventMcpBrowserOpenFailed + | EventCommandExecuted + | EventProjectUpdated + | EventSessionCompacted + | EventVcsBranchUpdated + | EventWorkspaceReady + | EventWorkspaceFailed + | EventWorkspaceStatus + | EventWorktreeReady + | EventWorktreeFailed + | EventPtyCreated + | EventPtyUpdated + | EventPtyExited + | EventPtyDeleted + | EventInstallationUpdated + | EventInstallationUpdateAvailable + | EventMessageUpdated + | EventMessageRemoved + | EventMessagePartUpdated + | EventMessagePartRemoved + | EventSessionCreated + | EventSessionUpdated + | EventSessionDeleted + | EventSessionNextAgentSwitched + | EventSessionNextModelSwitched + | EventSessionNextPrompted + | EventSessionNextSynthetic + | EventSessionNextShellStarted + | EventSessionNextShellEnded + | EventSessionNextStepStarted + | EventSessionNextStepEnded + | EventSessionNextStepFailed + | EventSessionNextTextStarted + | EventSessionNextTextDelta + | EventSessionNextTextEnded + | EventSessionNextReasoningStarted + | EventSessionNextReasoningDelta + | EventSessionNextReasoningEnded + | EventSessionNextToolInputStarted + | EventSessionNextToolInputDelta + | EventSessionNextToolInputEnded + | EventSessionNextToolCalled + | EventSessionNextToolProgress + | EventSessionNextToolSuccess + | EventSessionNextToolFailed + | EventSessionNextRetried + | EventSessionNextCompactionStarted + | EventSessionNextCompactionDelta + | EventSessionNextCompactionEnded + | EventCatalogModelUpdated + | SyncEventMessageUpdated + | SyncEventMessageRemoved + | SyncEventMessagePartUpdated + | SyncEventMessagePartRemoved + | SyncEventSessionCreated + | SyncEventSessionUpdated + | SyncEventSessionDeleted + | SyncEventSessionNextAgentSwitched + | SyncEventSessionNextModelSwitched + | SyncEventSessionNextPrompted + | SyncEventSessionNextSynthetic + | SyncEventSessionNextShellStarted + | SyncEventSessionNextShellEnded + | SyncEventSessionNextStepStarted + | SyncEventSessionNextStepEnded + | SyncEventSessionNextStepFailed + | SyncEventSessionNextTextStarted + | SyncEventSessionNextTextDelta + | SyncEventSessionNextTextEnded + | SyncEventSessionNextReasoningStarted + | SyncEventSessionNextReasoningDelta + | SyncEventSessionNextReasoningEnded + | SyncEventSessionNextToolInputStarted + | SyncEventSessionNextToolInputDelta + | SyncEventSessionNextToolInputEnded + | SyncEventSessionNextToolCalled + | SyncEventSessionNextToolProgress + | SyncEventSessionNextToolSuccess + | SyncEventSessionNextToolFailed + | SyncEventSessionNextRetried + | SyncEventSessionNextCompactionStarted + | SyncEventSessionNextCompactionDelta + | SyncEventSessionNextCompactionEnded } /** - * Custom keybind configurations + * Log level */ -export type KeybindsConfig = { - /** - * Leader key for keybind combinations - */ - leader?: string - /** - * Exit the application - */ - app_exit?: string - /** - * Open external editor - */ - editor_open?: string - /** - * List available themes - */ - theme_list?: string - /** - * Toggle sidebar - */ - sidebar_toggle?: string - /** - * Toggle session scrollbar - */ - scrollbar_toggle?: string - /** - * Toggle username visibility - */ - username_toggle?: string - /** - * View status - */ - status_view?: string - /** - * Export session to editor - */ - session_export?: string - /** - * Create a new session - */ - session_new?: string - /** - * List all sessions - */ - session_list?: string - /** - * Show session timeline - */ - session_timeline?: string - /** - * Share current session - */ - session_share?: string - /** - * Unshare current session - */ - session_unshare?: string - /** - * Interrupt current session - */ - session_interrupt?: string - /** - * Compact the session - */ - session_compact?: string - /** - * Scroll messages up by one page - */ - messages_page_up?: string - /** - * Scroll messages down by one page - */ - messages_page_down?: string - /** - * Scroll messages up by one line - */ - messages_line_up?: string - /** - * Scroll messages down by one line - */ - messages_line_down?: string - /** - * Scroll messages up by half page - */ - messages_half_page_up?: string - /** - * Scroll messages down by half page - */ - messages_half_page_down?: string - /** - * Navigate to first message - */ - messages_first?: string - /** - * Navigate to last message - */ - messages_last?: string - /** - * Navigate to next message - */ - messages_next?: string - /** - * Navigate to previous message - */ - messages_previous?: string - /** - * Navigate to last user message - */ - messages_last_user?: string - /** - * Copy message - */ - messages_copy?: string - /** - * Undo message - */ - messages_undo?: string - /** - * Redo message - */ - messages_redo?: string - /** - * Toggle code block concealment in messages - */ - messages_toggle_conceal?: string - /** - * Toggle tool details visibility - */ - tool_details?: string - /** - * List available models - */ - model_list?: string - /** - * Next recently used model - */ - model_cycle_recent?: string - /** - * Previous recently used model - */ - model_cycle_recent_reverse?: string - /** - * List available commands - */ - command_list?: string - /** - * List agents - */ - agent_list?: string - /** - * Next agent - */ - agent_cycle?: string - /** - * Previous agent - */ - agent_cycle_reverse?: string - /** - * Clear input field - */ - input_clear?: string - /** - * Forward delete - */ - input_forward_delete?: string - /** - * Paste from clipboard - */ - input_paste?: string - /** - * Submit input - */ - input_submit?: string - /** - * Insert newline in input - */ - input_newline?: string - /** - * Previous history item - */ - history_previous?: string - /** - * Next history item - */ - history_next?: string - /** - * Next child session - */ - session_child_cycle?: string - /** - * Previous child session - */ - session_child_cycle_reverse?: string - /** - * Suspend terminal - */ - terminal_suspend?: string - /** - * Toggle terminal title - */ - terminal_title_toggle?: string +export type LogLevel = "DEBUG" | "INFO" | "WARN" | "ERROR" + +/** + * Server configuration for opencode serve and web commands + */ +export type ServerConfig = { + port?: number + hostname?: string + mdns?: boolean + mdnsDomain?: string + cors?: Array } +export type ReferenceConfigEntry = + | string + | { + /** + * Git repository URL, host/path reference, or GitHub owner/repo shorthand + */ + repository: string + branch?: string + } + | { + /** + * Absolute path, ~/ path, or workspace-relative path to a local reference directory + */ + path: string + } + +export type ReferenceConfig = { + [key: string]: ReferenceConfigEntry +} + +export type PermissionActionConfig = "ask" | "allow" | "deny" + +export type PermissionObjectConfig = { + [key: string]: PermissionActionConfig +} + +export type PermissionRuleConfig = PermissionActionConfig | PermissionObjectConfig + +export type PermissionConfig = + | PermissionActionConfig + | { + read?: PermissionRuleConfig + edit?: PermissionRuleConfig + glob?: PermissionRuleConfig + grep?: PermissionRuleConfig + list?: PermissionRuleConfig + bash?: PermissionRuleConfig + task?: PermissionRuleConfig + external_directory?: PermissionRuleConfig + todowrite?: PermissionActionConfig + question?: PermissionActionConfig + webfetch?: PermissionActionConfig + websearch?: PermissionActionConfig + repo_clone?: PermissionRuleConfig + repo_overview?: PermissionRuleConfig + lsp?: PermissionRuleConfig + doom_loop?: PermissionActionConfig + skill?: PermissionRuleConfig + [key: string]: PermissionRuleConfig | PermissionActionConfig | undefined + } + export type AgentConfig = { model?: string + variant?: string temperature?: number top_p?: number prompt?: string @@ -981,30 +979,19 @@ export type AgentConfig = { [key: string]: boolean } disable?: boolean - /** - * Description of when to use the agent - */ description?: string mode?: "subagent" | "primary" | "all" - /** - * Hex color code for the agent (e.g., #FF5733) - */ - color?: string - /** - * Maximum number of agentic iterations before forcing text-only response - */ - maxSteps?: number - permission?: { - edit?: "ask" | "allow" | "deny" - bash?: - | ("ask" | "allow" | "deny") - | { - [key: string]: "ask" | "allow" | "deny" - } - webfetch?: "ask" | "allow" | "deny" - doom_loop?: "ask" | "allow" | "deny" - external_directory?: "ask" | "allow" | "deny" + hidden?: boolean + options?: { + [key: string]: unknown } + /** + * Hex color code (e.g., #FF5733) or theme color (e.g., primary) + */ + color?: string | "primary" | "secondary" | "accent" | "success" | "warning" | "error" | "info" + steps?: number + maxSteps?: number + permission?: PermissionConfig [key: string]: | unknown | string @@ -1013,19 +1000,22 @@ export type AgentConfig = { [key: string]: boolean } | boolean - | ("subagent" | "primary" | "all") - | number + | "subagent" + | "primary" + | "all" | { - edit?: "ask" | "allow" | "deny" - bash?: - | ("ask" | "allow" | "deny") - | { - [key: string]: "ask" | "allow" | "deny" - } - webfetch?: "ask" | "allow" | "deny" - doom_loop?: "ask" | "allow" | "deny" - external_directory?: "ask" | "allow" | "deny" + [key: string]: unknown } + | string + | "primary" + | "secondary" + | "accent" + | "success" + | "warning" + | "error" + | "info" + | number + | PermissionConfig | undefined } @@ -1035,15 +1025,35 @@ export type ProviderConfig = { env?: Array id?: string npm?: string + whitelist?: Array + blacklist?: Array + options?: { + apiKey?: string + baseURL?: string + enterpriseUrl?: string + setCacheKey?: boolean + /** + * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. + */ + timeout?: number | false + chunkTimeout?: number + [key: string]: unknown | string | boolean | number | false | number | undefined + } models?: { [key: string]: { id?: string name?: string + family?: string release_date?: string attachment?: boolean reasoning?: boolean temperature?: boolean tool_call?: boolean + interleaved?: + | true + | { + field: "reasoning_content" | "reasoning_details" + } cost?: { input: number output: number @@ -1058,6 +1068,7 @@ export type ProviderConfig = { } limit?: { context: number + input?: number output: number } modalities?: { @@ -1066,36 +1077,27 @@ export type ProviderConfig = { } experimental?: boolean status?: "alpha" | "beta" | "deprecated" | "active" + provider?: { + npm?: string + api?: string + } options?: { [key: string]: unknown } headers?: { [key: string]: string } - provider?: { - npm: string + /** + * Variant-specific configuration + */ + variants?: { + [key: string]: { + disabled?: boolean + [key: string]: unknown | boolean | undefined + } } } } - whitelist?: Array - blacklist?: Array - options?: { - apiKey?: string - baseURL?: string - /** - * GitHub Enterprise URL for copilot authentication - */ - enterpriseUrl?: string - /** - * Enable promptCacheKey for this provider (default false) - */ - setCacheKey?: boolean - /** - * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. - */ - timeout?: number | false - [key: string]: unknown | string | boolean | (number | false) | undefined - } } export type McpLocalConfig = { @@ -1107,35 +1109,18 @@ export type McpLocalConfig = { * Command and arguments to run the MCP server */ command: Array - /** - * Environment variables to set when running the MCP server - */ environment?: { [key: string]: string } - /** - * Enable or disable the MCP server on startup - */ enabled?: boolean - /** - * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. - */ timeout?: number } export type McpOAuthConfig = { - /** - * OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted. - */ clientId?: string - /** - * OAuth client secret (if required by the authorization server) - */ clientSecret?: string - /** - * OAuth scopes to request during authorization - */ scope?: string + redirectUri?: string } export type McpRemoteConfig = { @@ -1147,13 +1132,7 @@ export type McpRemoteConfig = { * URL of the remote MCP server */ url: string - /** - * Enable or disable the MCP server on startup - */ enabled?: boolean - /** - * Headers to send with the request - */ headers?: { [key: string]: string } @@ -1161,9 +1140,6 @@ export type McpRemoteConfig = { * OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection. */ oauth?: McpOAuthConfig | false - /** - * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. - */ timeout?: number } @@ -1172,45 +1148,22 @@ export type McpRemoteConfig = { */ export type LayoutConfig = "auto" | "stretch" +export type ImageAttachmentConfig = { + auto_resize?: boolean + max_width?: number + max_height?: number + max_base64_bytes?: number +} + +export type AttachmentConfig = { + image?: ImageAttachmentConfig +} + export type Config = { - /** - * JSON schema reference for configuration validation - */ $schema?: string - /** - * Theme name to use for the interface - */ - theme?: string - keybinds?: KeybindsConfig - /** - * Log level - */ - logLevel?: "DEBUG" | "INFO" | "WARN" | "ERROR" - /** - * TUI specific settings - */ - tui?: { - /** - * TUI scroll speed - */ - scroll_speed?: number - /** - * Scroll acceleration settings - */ - scroll_acceleration?: { - /** - * Enable scroll acceleration - */ - enabled: boolean - } - /** - * Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column - */ - diff_style?: "auto" | "stacked" - } - /** - * Command configuration, see https://opencode.ai/docs/commands - */ + shell?: string + logLevel?: LogLevel + server?: ServerConfig command?: { [key: string]: { template: string @@ -1220,75 +1173,68 @@ export type Config = { subtask?: boolean } } + skills?: { + paths?: Array + urls?: Array + } + reference?: ReferenceConfig watcher?: { ignore?: Array } - plugin?: Array snapshot?: boolean - /** - * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing - */ + plugin?: Array< + | string + | [ + string, + { + [key: string]: unknown + }, + ] + > share?: "manual" | "auto" | "disabled" - /** - * @deprecated Use 'share' field instead. Share newly created sessions automatically - */ autoshare?: boolean /** * Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications */ autoupdate?: boolean | "notify" - /** - * Disable providers that are loaded automatically - */ disabled_providers?: Array - /** - * When set, ONLY these providers will be enabled. All other providers will be ignored - */ enabled_providers?: Array - /** - * Model to use in the format of provider/model, eg anthropic/claude-2 - */ model?: string - /** - * Small model to use for tasks like title generation in the format of provider/model - */ small_model?: string - /** - * Custom username to display in conversations instead of system username - */ + default_agent?: string username?: string - /** - * @deprecated Use `agent` field instead. - */ mode?: { build?: AgentConfig plan?: AgentConfig [key: string]: AgentConfig | undefined } - /** - * Agent configuration, see https://opencode.ai/docs/agent - */ agent?: { plan?: AgentConfig build?: AgentConfig general?: AgentConfig explore?: AgentConfig + scout?: AgentConfig + title?: AgentConfig + summary?: AgentConfig + compaction?: AgentConfig [key: string]: AgentConfig | undefined } - /** - * Custom provider configurations and model overrides - */ provider?: { [key: string]: ProviderConfig } - /** - * MCP (Model Context Protocol) server configurations - */ mcp?: { - [key: string]: McpLocalConfig | McpRemoteConfig + [key: string]: + | McpLocalConfig + | McpRemoteConfig + | { + enabled: boolean + } } + /** + * Enable or configure formatters. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides. + */ formatter?: - | false + | boolean | { [key: string]: { disabled?: boolean @@ -1299,8 +1245,11 @@ export type Config = { extensions?: Array } } + /** + * Enable or configure LSP servers. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides. + */ lsp?: - | false + | boolean | { [key: string]: | { @@ -1318,141 +1267,37 @@ export type Config = { } } } - /** - * Additional instruction files or patterns to include - */ instructions?: Array layout?: LayoutConfig - permission?: { - edit?: "ask" | "allow" | "deny" - bash?: - | ("ask" | "allow" | "deny") - | { - [key: string]: "ask" | "allow" | "deny" - } - webfetch?: "ask" | "allow" | "deny" - doom_loop?: "ask" | "allow" | "deny" - external_directory?: "ask" | "allow" | "deny" - } + permission?: PermissionConfig tools?: { [key: string]: boolean } + attachment?: AttachmentConfig enterprise?: { - /** - * Enterprise URL - */ url?: string } + tool_output?: { + max_lines?: number + max_bytes?: number + } + compaction?: { + auto?: boolean + prune?: boolean + tail_turns?: number + preserve_recent_tokens?: number + reserved?: number + } experimental?: { - hook?: { - file_edited?: { - [key: string]: Array<{ - command: Array - environment?: { - [key: string]: string - } - }> - } - session_completed?: Array<{ - command: Array - environment?: { - [key: string]: string - } - }> - } - /** - * Number of retries for chat completions on failure - */ - chatMaxRetries?: number disable_paste_summary?: boolean - /** - * Enable the batch tool - */ batch_tool?: boolean - /** - * Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag) - */ openTelemetry?: boolean - /** - * Tools that should only be available to primary agents. - */ primary_tools?: Array + continue_loop_on_deny?: boolean + mcp_timeout?: number } } -export type ToolIds = Array - -export type ToolListItem = { - id: string - description: string - parameters: unknown -} - -export type ToolList = Array - -export type Path = { - state: string - config: string - worktree: string - directory: string -} - -export type VcsInfo = { - branch: string -} - -export type TextPartInput = { - id?: string - type: "text" - text: string - synthetic?: boolean - ignored?: boolean - time?: { - start: number - end?: number - } - metadata?: { - [key: string]: unknown - } -} - -export type FilePartInput = { - id?: string - type: "file" - mime: string - filename?: string - url: string - source?: FilePartSource -} - -export type AgentPartInput = { - id?: string - type: "agent" - name: string - source?: { - value: string - start: number - end: number - } -} - -export type SubtaskPartInput = { - id?: string - type: "subtask" - prompt: string - description: string - agent: string -} - -export type Command = { - name: string - description?: string - agent?: string - model?: string - template: string - subtask?: boolean -} - export type Model = { id: string providerID: string @@ -1462,6 +1307,7 @@ export type Model = { npm: string } name: string + family?: string capabilities: { temperature: boolean reasoning: boolean @@ -1481,6 +1327,11 @@ export type Model = { video: boolean pdf: boolean } + interleaved: + | boolean + | { + field: "reasoning_content" | "reasoning_details" + } } cost: { input: number @@ -1489,6 +1340,18 @@ export type Model = { read: number write: number } + tiers?: Array<{ + input: number + output: number + cache: { + read: number + write: number + } + tier: { + type: "context" + size: number + } + }> experimentalOver200K?: { input: number output: number @@ -1500,6 +1363,7 @@ export type Model = { } limit: { context: number + input?: number output: number } status: "alpha" | "beta" | "deprecated" | "active" @@ -1509,6 +1373,12 @@ export type Model = { headers: { [key: string]: string } + release_date: string + variants?: { + [key: string]: { + [key: string]: unknown + } + } } export type Provider = { @@ -1525,15 +1395,125 @@ export type Provider = { } } -export type ProviderAuthMethod = { - type: "oauth" | "api" - label: string +export type ConsoleState = { + consoleManagedProviders: Array + activeOrgName?: string + switchableOrgCount: number } -export type ProviderAuthAuthorization = { - url: string - method: "auto" | "code" - instructions: string +export type EffectHttpApiErrorInternalServerError = { + _tag: "InternalServerError" +} + +export type ToolListItem = { + id: string + description: string + parameters: unknown +} + +export type ToolList = Array + +export type ToolIds = Array + +export type WorktreeError = { + name: + | "WorktreeNotGitError" + | "WorktreeNameGenerationFailedError" + | "WorktreeCreateFailedError" + | "WorktreeStartCommandFailedError" + | "WorktreeRemoveFailedError" + | "WorktreeResetFailedError" + | "WorktreeListFailedError" + data: { + message: string + } +} + +export type WorktreeCreateInput = { + name?: string + /** + * Additional startup script to run after the project's start command + */ + startCommand?: string +} + +export type Worktree = { + name: string + branch?: string + directory: string +} + +export type WorktreeRemoveInput = { + directory: string +} + +export type WorktreeResetInput = { + directory: string +} + +export type ProjectSummary = { + id: string + name?: string + worktree: string +} + +export type GlobalSession = { + id: string + slug: string + projectID: string + workspaceID?: string + directory: string + path?: string + parentID?: string + summary?: { + additions: number + deletions: number + files: number + diffs?: Array + } + cost?: number + tokens?: { + input: number + output: number + reasoning: number + cache: { + read: number + write: number + } + } + share?: { + url: string + } + title: string + agent?: string + model?: { + id: string + providerID: string + variant?: string + } + version: string + time: { + created: number + updated: number + compacting?: number + archived?: number + } + permission?: PermissionRuleset + revert?: { + messageID: string + partID?: string + snapshot?: string + diff?: string + } + project: ProjectSummary | null +} + +export type McpResource = { + name: string + uri: string + description?: string + mimeType?: string + client: string } export type Symbol = { @@ -1582,35 +1562,86 @@ export type File = { status: "added" | "deleted" | "modified" } +export type Path = { + home: string + state: string + config: string + worktree: string + directory: string +} + +export type VcsInfo = { + branch?: string + default_branch?: string +} + +export type VcsFileStatus = { + file: string + additions: number + deletions: number + status: "added" | "deleted" | "modified" +} + +export type VcsFileDiff = { + file: string + patch?: string + additions: number + deletions: number + status?: "added" | "deleted" | "modified" +} + +export type VcsApplyError = { + name: "VcsApplyError" + data: { + message: string + reason: "non-git" | "not-clean" + } +} + +export type Command = { + name: string + description?: string + agent?: string + model?: string + source?: "command" | "mcp" | "skill" + template: string + subtask?: boolean + hints: Array +} + export type Agent = { name: string description?: string mode: "subagent" | "primary" | "all" - builtIn: boolean + native?: boolean + hidden?: boolean topP?: number temperature?: number color?: string - permission: { - edit: "ask" | "allow" | "deny" - bash: { - [key: string]: "ask" | "allow" | "deny" - } - webfetch?: "ask" | "allow" | "deny" - doom_loop?: "ask" | "allow" | "deny" - external_directory?: "ask" | "allow" | "deny" - } + permission: PermissionRuleset model?: { modelID: string providerID: string } + variant?: string prompt?: string - tools: { - [key: string]: boolean - } options: { [key: string]: unknown } - maxSteps?: number + steps?: number +} + +export type LspStatus = { + id: string + name: string + root: string + status: "connected" | "error" +} + +export type FormatterStatus = { + name: string + extensions: Array + enabled: boolean } export type McpStatusConnected = { @@ -1642,42 +1673,2123 @@ export type McpStatus = | McpStatusNeedsAuth | McpStatusNeedsClientRegistration -export type LspStatus = { +export type McpUnsupportedOAuthError = { + error: string +} + +export type NotFoundError = { + name: "NotFoundError" + data: { + message: string + } +} + +export type EffectHttpApiErrorForbidden = { + _tag: "Forbidden" +} + +export type ProviderAuthMethod = { + type: "oauth" | "api" + label: string + prompts?: Array< + | { + type: "text" + key: string + message: string + placeholder?: string + when?: { + key: string + op: "eq" | "neq" + value: string + } + } + | { + type: "select" + key: string + message: string + options: Array<{ + label: string + value: string + hint?: string + }> + when?: { + key: string + op: "eq" | "neq" + value: string + } + } + > +} + +export type ProviderAuthAuthorization = { + url: string + method: "auto" | "code" + instructions: string +} + +export type ProviderAuthError1 = { + name: + | "BadRequest" + | "ProviderAuthOauthMissing" + | "ProviderAuthOauthCodeMissing" + | "ProviderAuthOauthCallbackFailed" + | "ProviderAuthValidationFailed" + data: { + providerID?: string + field?: string + message?: string + kind?: string + } +} + +export type TextPartInput = { + id?: string + type: "text" + text: string + synthetic?: boolean + ignored?: boolean + time?: { + start: number + end?: number + } + metadata?: { + [key: string]: unknown + } +} + +export type FilePartInput = { + id?: string + type: "file" + mime: string + filename?: string + url: string + source?: FilePartSource +} + +export type AgentPartInput = { + id?: string + type: "agent" + name: string + source?: { + value: string + start: number + end: number + } +} + +export type SubtaskPartInput = { + id?: string + type: "subtask" + prompt: string + description: string + agent: string + model?: { + providerID: string + modelID: string + } + command?: string +} + +export type V2SessionsResponse = { + items: Array + cursor: { + previous?: string + next?: string + } +} + +export type V2SessionMessagesResponse = { + items: Array + cursor: { + previous?: string + next?: string + } +} + +export type EventTuiPromptAppend2 = { + type: "tui.prompt.append" + properties: { + text: string + } +} + +export type EventTuiCommandExecute2 = { + type: "tui.command.execute" + properties: { + command: + | "session.list" + | "session.new" + | "session.share" + | "session.interrupt" + | "session.compact" + | "session.page.up" + | "session.page.down" + | "session.line.up" + | "session.line.down" + | "session.half.page.up" + | "session.half.page.down" + | "session.first" + | "session.last" + | "prompt.clear" + | "prompt.submit" + | "agent.cycle" + | string + } +} + +export type EventTuiToastShow2 = { + type: "tui.toast.show" + properties: { + title?: string + message: string + variant: "info" | "success" | "warning" | "error" + duration?: number + } +} + +export type EventTuiSessionSelect2 = { + type: "tui.session.select" + properties: { + /** + * Session ID to navigate to + */ + sessionID: string + } +} + +export type Workspace = { id: string + type: string name: string - root: string - status: "connected" | "error" + branch?: string | null + directory?: string | null + extra?: unknown | null + projectID: string + timeUsed: number | "NaN" | "Infinity" | "-Infinity" | "Infinity" | "-Infinity" | "NaN" } -export type FormatterStatus = { +export type WorkspaceWarpError = { + name: "WorkspaceWarpError" + data: { + message: string + } +} + +export type SyncEventMessageUpdated = { + type: "sync" + name: "message.updated.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + sessionID: string + info: Message + } +} + +export type SyncEventMessageRemoved = { + type: "sync" + name: "message.removed.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + sessionID: string + messageID: string + } +} + +export type SyncEventMessagePartUpdated = { + type: "sync" + name: "message.part.updated.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + sessionID: string + part: Part + time: number + } +} + +export type SyncEventMessagePartRemoved = { + type: "sync" + name: "message.part.removed.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + sessionID: string + messageID: string + partID: string + } +} + +export type SyncEventSessionCreated = { + type: "sync" + name: "session.created.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + sessionID: string + info: Session + } +} + +export type SyncEventSessionUpdated = { + type: "sync" + name: "session.updated.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + sessionID: string + info: { + id?: string | null + slug?: string | null + projectID?: string | null + workspaceID?: string | null + directory?: string | null + path?: string | null + parentID?: string | null + summary?: { + additions: number + deletions: number + files: number + diffs?: Array + } | null + cost?: number | null + tokens?: { + input: number + output: number + reasoning: number + cache: { + read: number + write: number + } + } | null + share?: { + url?: string | null + } + title?: string | null + agent?: string | null + model?: { + id: string + providerID: string + variant?: string + } | null + version?: string | null + time?: { + created?: number | null + updated?: number | null + compacting?: number | null + archived?: number | null + } + permission?: PermissionRuleset | null + revert?: { + messageID: string + partID?: string + snapshot?: string + diff?: string + } | null + } + } +} + +export type SyncEventSessionDeleted = { + type: "sync" + name: "session.deleted.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + sessionID: string + info: Session + } +} + +export type SyncEventSessionNextAgentSwitched = { + type: "sync" + name: "session.next.agent.switched.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + agent: string + } +} + +export type SyncEventSessionNextModelSwitched = { + type: "sync" + name: "session.next.model.switched.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + model: { + id: string + providerID: string + variant: string + } + } +} + +export type SyncEventSessionNextPrompted = { + type: "sync" + name: "session.next.prompted.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + prompt: Prompt + } +} + +export type SyncEventSessionNextSynthetic = { + type: "sync" + name: "session.next.synthetic.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + text: string + } +} + +export type SyncEventSessionNextShellStarted = { + type: "sync" + name: "session.next.shell.started.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + callID: string + command: string + } +} + +export type SyncEventSessionNextShellEnded = { + type: "sync" + name: "session.next.shell.ended.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + callID: string + output: string + } +} + +export type SyncEventSessionNextStepStarted = { + type: "sync" + name: "session.next.step.started.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + agent: string + model: { + id: string + providerID: string + variant: string + } + snapshot?: string + } +} + +export type SyncEventSessionNextStepEnded = { + type: "sync" + name: "session.next.step.ended.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + finish: string + cost: number + tokens: { + input: number + output: number + reasoning: number + cache: { + read: number + write: number + } + } + snapshot?: string + } +} + +export type SyncEventSessionNextStepFailed = { + type: "sync" + name: "session.next.step.failed.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + error: SessionErrorUnknown + } +} + +export type SyncEventSessionNextTextStarted = { + type: "sync" + name: "session.next.text.started.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + } +} + +export type SyncEventSessionNextTextDelta = { + type: "sync" + name: "session.next.text.delta.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + delta: string + } +} + +export type SyncEventSessionNextTextEnded = { + type: "sync" + name: "session.next.text.ended.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + text: string + } +} + +export type SyncEventSessionNextReasoningStarted = { + type: "sync" + name: "session.next.reasoning.started.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + reasoningID: string + } +} + +export type SyncEventSessionNextReasoningDelta = { + type: "sync" + name: "session.next.reasoning.delta.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + reasoningID: string + delta: string + } +} + +export type SyncEventSessionNextReasoningEnded = { + type: "sync" + name: "session.next.reasoning.ended.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + reasoningID: string + text: string + } +} + +export type SyncEventSessionNextToolInputStarted = { + type: "sync" + name: "session.next.tool.input.started.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + callID: string + name: string + } +} + +export type SyncEventSessionNextToolInputDelta = { + type: "sync" + name: "session.next.tool.input.delta.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + callID: string + delta: string + } +} + +export type SyncEventSessionNextToolInputEnded = { + type: "sync" + name: "session.next.tool.input.ended.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + callID: string + text: string + } +} + +export type SyncEventSessionNextToolCalled = { + type: "sync" + name: "session.next.tool.called.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + callID: string + tool: string + input: { + [key: string]: unknown + } + provider: { + executed: boolean + metadata?: { + [key: string]: unknown + } + } + } +} + +export type SyncEventSessionNextToolProgress = { + type: "sync" + name: "session.next.tool.progress.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + callID: string + structured: { + [key: string]: unknown + } + content: Array + } +} + +export type SyncEventSessionNextToolSuccess = { + type: "sync" + name: "session.next.tool.success.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + callID: string + structured: { + [key: string]: unknown + } + content: Array + provider: { + executed: boolean + metadata?: { + [key: string]: unknown + } + } + } +} + +export type SyncEventSessionNextToolFailed = { + type: "sync" + name: "session.next.tool.failed.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + callID: string + error: SessionErrorUnknown + provider: { + executed: boolean + metadata?: { + [key: string]: unknown + } + } + } +} + +export type SyncEventSessionNextRetried = { + type: "sync" + name: "session.next.retried.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + attempt: number + error: SessionNextRetryError + } +} + +export type SyncEventSessionNextCompactionStarted = { + type: "sync" + name: "session.next.compaction.started.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + reason: "auto" | "manual" + } +} + +export type SyncEventSessionNextCompactionDelta = { + type: "sync" + name: "session.next.compaction.delta.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + text: string + } +} + +export type SyncEventSessionNextCompactionEnded = { + type: "sync" + name: "session.next.compaction.ended.1" + id: string + seq: number + aggregateID: "sessionID" + data: { + timestamp: number + sessionID: string + text: string + include?: string + } +} + +export type EventServerConnected = { + id: string + type: "server.connected" + properties: { + [key: string]: unknown + } +} + +export type EventGlobalDisposed = { + id: string + type: "global.disposed" + properties: { + [key: string]: unknown + } +} + +export type EventServerInstanceDisposed = { + id: string + type: "server.instance.disposed" + properties: { + directory: string + } +} + +export type EventFileEdited = { + id: string + type: "file.edited" + properties: { + file: string + } +} + +export type EventFileWatcherUpdated = { + id: string + type: "file.watcher.updated" + properties: { + file: string + event: "add" | "change" | "unlink" + } +} + +export type EventLspClientDiagnostics = { + id: string + type: "lsp.client.diagnostics" + properties: { + serverID: string + path: string + } +} + +export type EventLspUpdated = { + id: string + type: "lsp.updated" + properties: { + [key: string]: unknown + } +} + +export type EventMessagePartDelta = { + id: string + type: "message.part.delta" + properties: { + sessionID: string + messageID: string + partID: string + field: string + delta: string + } +} + +export type EventPermissionAsked = { + id: string + type: "permission.asked" + properties: PermissionRequest +} + +export type EventPermissionReplied = { + id: string + type: "permission.replied" + properties: { + sessionID: string + requestID: string + reply: "once" | "always" | "reject" + } +} + +export type EventSessionDiff = { + id: string + type: "session.diff" + properties: { + sessionID: string + diff: Array + } +} + +export type EventSessionError = { + id: string + type: "session.error" + properties: { + sessionID?: string + error?: + | ProviderAuthError + | UnknownError + | MessageOutputLengthError + | MessageAbortedError + | StructuredOutputError + | ContextOverflowError + | ApiError + } +} + +export type EventQuestionAsked = { + id: string + type: "question.asked" + properties: QuestionRequest +} + +export type EventQuestionReplied = { + id: string + type: "question.replied" + properties: QuestionReplied +} + +export type EventQuestionRejected = { + id: string + type: "question.rejected" + properties: QuestionRejected +} + +export type EventTodoUpdated = { + id: string + type: "todo.updated" + properties: { + sessionID: string + todos: Array + } +} + +export type EventSessionStatus = { + id: string + type: "session.status" + properties: { + sessionID: string + status: SessionStatus + } +} + +export type EventSessionIdle = { + id: string + type: "session.idle" + properties: { + sessionID: string + } +} + +export type EventMcpToolsChanged = { + id: string + type: "mcp.tools.changed" + properties: { + server: string + } +} + +export type EventMcpBrowserOpenFailed = { + id: string + type: "mcp.browser.open.failed" + properties: { + mcpName: string + url: string + } +} + +export type EventCommandExecuted = { + id: string + type: "command.executed" + properties: { + name: string + sessionID: string + arguments: string + messageID: string + } +} + +export type EventProjectUpdated = { + id: string + type: "project.updated" + properties: Project +} + +export type EventSessionCompacted = { + id: string + type: "session.compacted" + properties: { + sessionID: string + } +} + +export type EventVcsBranchUpdated = { + id: string + type: "vcs.branch.updated" + properties: { + branch?: string + } +} + +export type EventWorkspaceReady = { + id: string + type: "workspace.ready" + properties: { + name: string + } +} + +export type EventWorkspaceFailed = { + id: string + type: "workspace.failed" + properties: { + message: string + } +} + +export type EventWorkspaceStatus = { + id: string + type: "workspace.status" + properties: { + workspaceID: string + status: "connected" | "connecting" | "disconnected" | "error" + } +} + +export type EventWorktreeReady = { + id: string + type: "worktree.ready" + properties: { + name: string + branch?: string + } +} + +export type EventWorktreeFailed = { + id: string + type: "worktree.failed" + properties: { + message: string + } +} + +export type EventPtyCreated = { + id: string + type: "pty.created" + properties: { + info: Pty + } +} + +export type EventPtyUpdated = { + id: string + type: "pty.updated" + properties: { + info: Pty + } +} + +export type EventPtyExited = { + id: string + type: "pty.exited" + properties: { + id: string + exitCode: number + } +} + +export type EventPtyDeleted = { + id: string + type: "pty.deleted" + properties: { + id: string + } +} + +export type EventInstallationUpdated = { + id: string + type: "installation.updated" + properties: { + version: string + } +} + +export type EventInstallationUpdateAvailable = { + id: string + type: "installation.update-available" + properties: { + version: string + } +} + +export type EventMessageUpdated = { + id: string + type: "message.updated" + properties: { + sessionID: string + info: Message + } +} + +export type EventMessageRemoved = { + id: string + type: "message.removed" + properties: { + sessionID: string + messageID: string + } +} + +export type EventMessagePartUpdated = { + id: string + type: "message.part.updated" + properties: { + sessionID: string + part: Part + time: number + } +} + +export type EventMessagePartRemoved = { + id: string + type: "message.part.removed" + properties: { + sessionID: string + messageID: string + partID: string + } +} + +export type EventSessionCreated = { + id: string + type: "session.created" + properties: { + sessionID: string + info: Session + } +} + +export type EventSessionUpdated = { + id: string + type: "session.updated" + properties: { + sessionID: string + info: Session + } +} + +export type EventSessionDeleted = { + id: string + type: "session.deleted" + properties: { + sessionID: string + info: Session + } +} + +export type EventSessionNextAgentSwitched = { + id: string + type: "session.next.agent.switched" + properties: { + timestamp: number + sessionID: string + agent: string + } +} + +export type EventSessionNextModelSwitched = { + id: string + type: "session.next.model.switched" + properties: { + timestamp: number + sessionID: string + model: { + id: string + providerID: string + variant: string + } + } +} + +export type PromptSource = { + start: number + end: number + text: string +} + +export type PromptFileAttachment = { + uri: string + mime: string + name?: string + description?: string + source?: PromptSource +} + +export type PromptAgentAttachment = { name: string - extensions: Array - enabled: boolean + source?: PromptSource } -export type OAuth = { - type: "oauth" - refresh: string - access: string - expires: number - enterpriseUrl?: string +export type PromptReferenceAttachment = { + name: string + kind: "local" | "git" | "invalid" + uri?: string + repository?: string + branch?: string + target?: string + targetUri?: string + problem?: string + source?: PromptSource } -export type ApiAuth = { - type: "api" - key: string +export type EventSessionNextPrompted = { + id: string + type: "session.next.prompted" + properties: { + timestamp: number + sessionID: string + prompt: Prompt + } +} + +export type EventSessionNextSynthetic = { + id: string + type: "session.next.synthetic" + properties: { + timestamp: number + sessionID: string + text: string + } +} + +export type EventSessionNextShellStarted = { + id: string + type: "session.next.shell.started" + properties: { + timestamp: number + sessionID: string + callID: string + command: string + } +} + +export type EventSessionNextShellEnded = { + id: string + type: "session.next.shell.ended" + properties: { + timestamp: number + sessionID: string + callID: string + output: string + } +} + +export type EventSessionNextStepStarted = { + id: string + type: "session.next.step.started" + properties: { + timestamp: number + sessionID: string + agent: string + model: { + id: string + providerID: string + variant: string + } + snapshot?: string + } +} + +export type EventSessionNextStepEnded = { + id: string + type: "session.next.step.ended" + properties: { + timestamp: number + sessionID: string + finish: string + cost: number + tokens: { + input: number + output: number + reasoning: number + cache: { + read: number + write: number + } + } + snapshot?: string + } +} + +export type SessionErrorUnknown = { + type: "unknown" + message: string +} + +export type EventSessionNextStepFailed = { + id: string + type: "session.next.step.failed" + properties: { + timestamp: number + sessionID: string + error: SessionErrorUnknown + } +} + +export type EventSessionNextTextStarted = { + id: string + type: "session.next.text.started" + properties: { + timestamp: number + sessionID: string + } +} + +export type EventSessionNextTextDelta = { + id: string + type: "session.next.text.delta" + properties: { + timestamp: number + sessionID: string + delta: string + } +} + +export type EventSessionNextTextEnded = { + id: string + type: "session.next.text.ended" + properties: { + timestamp: number + sessionID: string + text: string + } +} + +export type EventSessionNextReasoningStarted = { + id: string + type: "session.next.reasoning.started" + properties: { + timestamp: number + sessionID: string + reasoningID: string + } +} + +export type EventSessionNextReasoningDelta = { + id: string + type: "session.next.reasoning.delta" + properties: { + timestamp: number + sessionID: string + reasoningID: string + delta: string + } +} + +export type EventSessionNextReasoningEnded = { + id: string + type: "session.next.reasoning.ended" + properties: { + timestamp: number + sessionID: string + reasoningID: string + text: string + } +} + +export type EventSessionNextToolInputStarted = { + id: string + type: "session.next.tool.input.started" + properties: { + timestamp: number + sessionID: string + callID: string + name: string + } +} + +export type EventSessionNextToolInputDelta = { + id: string + type: "session.next.tool.input.delta" + properties: { + timestamp: number + sessionID: string + callID: string + delta: string + } +} + +export type EventSessionNextToolInputEnded = { + id: string + type: "session.next.tool.input.ended" + properties: { + timestamp: number + sessionID: string + callID: string + text: string + } +} + +export type EventSessionNextToolCalled = { + id: string + type: "session.next.tool.called" + properties: { + timestamp: number + sessionID: string + callID: string + tool: string + input: { + [key: string]: unknown + } + provider: { + executed: boolean + metadata?: { + [key: string]: unknown + } + } + } +} + +export type ToolTextContent = { + type: "text" + text: string +} + +export type ToolFileContent = { + type: "file" + uri: string + mime: string + name?: string +} + +export type EventSessionNextToolProgress = { + id: string + type: "session.next.tool.progress" + properties: { + timestamp: number + sessionID: string + callID: string + structured: { + [key: string]: unknown + } + content: Array + } +} + +export type EventSessionNextToolSuccess = { + id: string + type: "session.next.tool.success" + properties: { + timestamp: number + sessionID: string + callID: string + structured: { + [key: string]: unknown + } + content: Array + provider: { + executed: boolean + metadata?: { + [key: string]: unknown + } + } + } +} + +export type EventSessionNextToolFailed = { + id: string + type: "session.next.tool.failed" + properties: { + timestamp: number + sessionID: string + callID: string + error: SessionErrorUnknown + provider: { + executed: boolean + metadata?: { + [key: string]: unknown + } + } + } +} + +export type SessionNextRetryError = { + message: string + statusCode?: number + isRetryable: boolean + responseHeaders?: { + [key: string]: string + } + responseBody?: string metadata?: { [key: string]: string } } -export type WellKnownAuth = { - type: "wellknown" - key: string - token: string +export type EventSessionNextRetried = { + id: string + type: "session.next.retried" + properties: { + timestamp: number + sessionID: string + attempt: number + error: SessionNextRetryError + } } -export type Auth = OAuth | ApiAuth | WellKnownAuth +export type EventSessionNextCompactionStarted = { + id: string + type: "session.next.compaction.started" + properties: { + timestamp: number + sessionID: string + reason: "auto" | "manual" + } +} + +export type EventSessionNextCompactionDelta = { + id: string + type: "session.next.compaction.delta" + properties: { + timestamp: number + sessionID: string + text: string + } +} + +export type EventSessionNextCompactionEnded = { + id: string + type: "session.next.compaction.ended" + properties: { + timestamp: number + sessionID: string + text: string + include?: string + } +} + +export type ModelV2Info = { + id: string + apiID: string + providerID: string + family?: string + name: string + endpoint: + | { + type: "unknown" + } + | { + type: "openai/responses" + url: string + websocket?: boolean + } + | { + type: "openai/completions" + url: string + reasoning?: + | { + type: "reasoning_content" + } + | { + type: "reasoning_details" + } + } + | { + type: "anthropic/messages" + url: string + } + | { + type: "aisdk" + package: string + url?: string + } + capabilities: { + tools: boolean + input: Array + output: Array + } + options: { + headers: { + [key: string]: string + } + body: { + [key: string]: unknown + } + aisdk: { + provider: { + [key: string]: unknown + } + request: { + [key: string]: unknown + } + } + variant?: string + } + variants: Array<{ + id: string + headers: { + [key: string]: string + } + body: { + [key: string]: unknown + } + aisdk: { + provider: { + [key: string]: unknown + } + request: { + [key: string]: unknown + } + } + }> + time: { + released: number | "NaN" | "Infinity" | "-Infinity" | "Infinity" | "-Infinity" | "NaN" + } + cost: Array<{ + tier?: { + type: "context" + size: number + } + input: number + output: number + cache: { + read: number + write: number + } + }> + status: "alpha" | "beta" | "deprecated" | "active" + enabled: boolean + limit: { + context: number + input?: number + output: number + } +} + +export type EventCatalogModelUpdated = { + id: string + type: "catalog.model.updated" + properties: { + model: ModelV2Info + } +} + +export type SessionInfo = { + id: string + parentID?: string + projectID: string + workspaceID?: string + path?: string + agent?: string + model?: { + id: string + providerID: string + variant: string + } + cost: number + tokens: { + input: number + output: number + reasoning: number + cache: { + read: number + write: number + } + } + time: { + created: number + updated: number + archived?: number + } + title: string +} + +export type SessionDelivery = "immediate" | "deferred" + +export type SessionMessageAgentSwitched = { + id: string + metadata?: { + [key: string]: unknown + } + time: { + created: number + } + type: "agent-switched" + agent: string +} + +export type SessionMessageModelSwitched = { + id: string + metadata?: { + [key: string]: unknown + } + time: { + created: number + } + type: "model-switched" + model: { + id: string + providerID: string + variant: string + } +} + +export type SessionMessageUser = { + id: string + metadata?: { + [key: string]: unknown + } + time: { + created: number + } + text: string + files?: Array + agents?: Array + references?: Array + type: "user" +} + +export type SessionMessageSynthetic = { + id: string + metadata?: { + [key: string]: unknown + } + time: { + created: number + } + sessionID: string + text: string + type: "synthetic" +} + +export type SessionMessageShell = { + id: string + metadata?: { + [key: string]: unknown + } + time: { + created: number + completed?: number + } + type: "shell" + callID: string + command: string + output: string +} + +export type SessionMessageAssistantText = { + type: "text" + text: string +} + +export type SessionMessageAssistantReasoning = { + type: "reasoning" + id: string + text: string +} + +export type SessionMessageToolStatePending = { + status: "pending" + input: string +} + +export type SessionMessageToolStateRunning = { + status: "running" + input: { + [key: string]: unknown + } + structured: { + [key: string]: unknown + } + content: Array +} + +export type SessionMessageToolStateCompleted = { + status: "completed" + input: { + [key: string]: unknown + } + attachments?: Array + content: Array + structured: { + [key: string]: unknown + } +} + +export type SessionMessageToolStateError = { + status: "error" + input: { + [key: string]: unknown + } + content: Array + structured: { + [key: string]: unknown + } + error: SessionErrorUnknown +} + +export type SessionMessageAssistantTool = { + type: "tool" + id: string + name: string + provider?: { + executed: boolean + metadata?: { + [key: string]: unknown + } + } + state: + | SessionMessageToolStatePending + | SessionMessageToolStateRunning + | SessionMessageToolStateCompleted + | SessionMessageToolStateError + time: { + created: number + ran?: number + completed?: number + pruned?: number + } +} + +export type SessionMessageAssistant = { + id: string + metadata?: { + [key: string]: unknown + } + time: { + created: number + completed?: number + } + type: "assistant" + agent: string + model: { + id: string + providerID: string + variant: string + } + content: Array + snapshot?: { + start?: string + end?: string + } + finish?: string + cost?: number + tokens?: { + input: number + output: number + reasoning: number + cache: { + read: number + write: number + } + } + error?: SessionErrorUnknown +} + +export type SessionMessageCompaction = { + type: "compaction" + reason: "auto" | "manual" + summary: string + include?: string + id: string + metadata?: { + [key: string]: unknown + } + time: { + created: number + } +} + +export type SessionMessage = + | SessionMessageAgentSwitched + | SessionMessageModelSwitched + | SessionMessageUser + | SessionMessageSynthetic + | SessionMessageShell + | SessionMessageAssistant + | SessionMessageCompaction + +export type ProviderV2Info = { + id: string + name: string + enabled: + | false + | { + via: "env" + name: string + } + | { + via: "auth" + service: string + } + | { + via: "custom" + data: { + [key: string]: unknown + } + } + env: Array + endpoint: + | { + type: "unknown" + } + | { + type: "openai/responses" + url: string + websocket?: boolean + } + | { + type: "openai/completions" + url: string + reasoning?: + | { + type: "reasoning_content" + } + | { + type: "reasoning_details" + } + } + | { + type: "anthropic/messages" + url: string + } + | { + type: "aisdk" + package: string + url?: string + } + options: { + headers: { + [key: string]: string + } + body: { + [key: string]: unknown + } + aisdk: { + provider: { + [key: string]: unknown + } + request: { + [key: string]: unknown + } + } + } +} + +export type EventTuiToastShow1 = { + id: string + type: "tui.toast.show" + properties: { + title?: string + message: string + variant: "info" | "success" | "warning" | "error" + duration?: number + } +} + +export type ModelV2Info1 = { + id: string + apiID: string + providerID: string + family?: string + name: string + endpoint: + | { + type: "unknown" + } + | { + type: "openai/responses" + url: string + websocket?: boolean + } + | { + type: "openai/completions" + url: string + reasoning?: + | { + type: "reasoning_content" + } + | { + type: "reasoning_details" + } + } + | { + type: "anthropic/messages" + url: string + } + | { + type: "aisdk" + package: string + url?: string + } + capabilities: { + tools: boolean + input: Array + output: Array + } + options: { + headers: { + [key: string]: string + } + body: { + [key: string]: unknown + } + aisdk: { + provider: { + [key: string]: unknown + } + request: { + [key: string]: unknown + } + } + variant?: string + } + variants: Array<{ + id: string + headers: { + [key: string]: string + } + body: { + [key: string]: unknown + } + aisdk: { + provider: { + [key: string]: unknown + } + request: { + [key: string]: unknown + } + } + }> + time: { + released: number | "NaN" | "Infinity" | "-Infinity" + } + cost: Array<{ + tier?: { + type: "context" + size: number + } + input: number + output: number + cache: { + read: number + write: number + } + }> + status: "alpha" | "beta" | "deprecated" | "active" + enabled: boolean + limit: { + context: number + input?: number + output: number + } +} + +export type BadRequestError = { + name: "BadRequest" + data: { + message: string + kind?: "Params" | "Headers" | "Query" | "Body" | "Payload" + } +} + +export type AuthRemoveData = { + body?: never + path: { + providerID: string + } + query?: never + url: "/auth/{providerID}" +} + +export type AuthRemoveErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type AuthRemoveError = AuthRemoveErrors[keyof AuthRemoveErrors] + +export type AuthRemoveResponses = { + /** + * Successfully removed authentication credentials + */ + 200: boolean +} + +export type AuthRemoveResponse = AuthRemoveResponses[keyof AuthRemoveResponses] + +export type AuthSetData = { + body?: Auth + path: { + providerID: string + } + query?: never + url: "/auth/{providerID}" +} + +export type AuthSetErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type AuthSetError = AuthSetErrors[keyof AuthSetErrors] + +export type AuthSetResponses = { + /** + * Successfully set authentication credentials + */ + 200: boolean +} + +export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses] + +export type AppLogData = { + body?: { + /** + * Service name for the log entry + */ + service: string + /** + * Log level + */ + level: "debug" | "info" | "error" | "warn" + /** + * Log message + */ + message: string + extra?: { + [key: string]: unknown + } + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/log" +} + +export type AppLogErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type AppLogError = AppLogErrors[keyof AppLogErrors] + +export type AppLogResponses = { + /** + * Log entry written successfully + */ + 200: boolean +} + +export type AppLogResponse = AppLogResponses[keyof AppLogResponses] + +export type GlobalHealthData = { + body?: never + path?: never + query?: never + url: "/global/health" +} + +export type GlobalHealthResponses = { + /** + * Health information + */ + 200: { + healthy: true + version: string + } +} + +export type GlobalHealthResponse = GlobalHealthResponses[keyof GlobalHealthResponses] export type GlobalEventData = { body?: never @@ -1695,222 +3807,123 @@ export type GlobalEventResponses = { export type GlobalEventResponse = GlobalEventResponses[keyof GlobalEventResponses] -export type ProjectListData = { +export type GlobalConfigGetData = { body?: never path?: never - query?: { - directory?: string - } - url: "/project" + query?: never + url: "/global/config" } -export type ProjectListResponses = { +export type GlobalConfigGetResponses = { /** - * List of projects + * Get global config info */ - 200: Array + 200: Config } -export type ProjectListResponse = ProjectListResponses[keyof ProjectListResponses] +export type GlobalConfigGetResponse = GlobalConfigGetResponses[keyof GlobalConfigGetResponses] -export type ProjectCurrentData = { - body?: never +export type GlobalConfigUpdateData = { + body?: Config path?: never - query?: { - directory?: string - } - url: "/project/current" + query?: never + url: "/global/config" } -export type ProjectCurrentResponses = { - /** - * Current project - */ - 200: Project -} - -export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses] - -export type PtyListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/pty" -} - -export type PtyListResponses = { - /** - * List of sessions - */ - 200: Array -} - -export type PtyListResponse = PtyListResponses[keyof PtyListResponses] - -export type PtyCreateData = { - body?: { - command?: string - args?: Array - cwd?: string - title?: string - env?: { - [key: string]: string - } - } - path?: never - query?: { - directory?: string - } - url: "/pty" -} - -export type PtyCreateErrors = { +export type GlobalConfigUpdateErrors = { /** * Bad request */ 400: BadRequestError } -export type PtyCreateError = PtyCreateErrors[keyof PtyCreateErrors] +export type GlobalConfigUpdateError = GlobalConfigUpdateErrors[keyof GlobalConfigUpdateErrors] -export type PtyCreateResponses = { +export type GlobalConfigUpdateResponses = { /** - * Created session + * Successfully updated global config */ - 200: Pty + 200: Config } -export type PtyCreateResponse = PtyCreateResponses[keyof PtyCreateResponses] +export type GlobalConfigUpdateResponse = GlobalConfigUpdateResponses[keyof GlobalConfigUpdateResponses] -export type PtyRemoveData = { +export type GlobalDisposeData = { body?: never - path: { - id: string - } - query?: { - directory?: string - } - url: "/pty/{id}" + path?: never + query?: never + url: "/global/dispose" } -export type PtyRemoveErrors = { +export type GlobalDisposeResponses = { /** - * Not found - */ - 404: NotFoundError -} - -export type PtyRemoveError = PtyRemoveErrors[keyof PtyRemoveErrors] - -export type PtyRemoveResponses = { - /** - * Session removed + * Global disposed */ 200: boolean } -export type PtyRemoveResponse = PtyRemoveResponses[keyof PtyRemoveResponses] +export type GlobalDisposeResponse = GlobalDisposeResponses[keyof GlobalDisposeResponses] -export type PtyGetData = { - body?: never - path: { - id: string - } - query?: { - directory?: string - } - url: "/pty/{id}" -} - -export type PtyGetErrors = { - /** - * Not found - */ - 404: NotFoundError -} - -export type PtyGetError = PtyGetErrors[keyof PtyGetErrors] - -export type PtyGetResponses = { - /** - * Session info - */ - 200: Pty -} - -export type PtyGetResponse = PtyGetResponses[keyof PtyGetResponses] - -export type PtyUpdateData = { +export type GlobalUpgradeData = { body?: { - title?: string - size?: { - rows: number - cols: number - } + target?: string } - path: { - id: string - } - query?: { - directory?: string - } - url: "/pty/{id}" + path?: never + query?: never + url: "/global/upgrade" } -export type PtyUpdateErrors = { +export type GlobalUpgradeErrors = { /** * Bad request */ 400: BadRequestError } -export type PtyUpdateError = PtyUpdateErrors[keyof PtyUpdateErrors] +export type GlobalUpgradeError = GlobalUpgradeErrors[keyof GlobalUpgradeErrors] -export type PtyUpdateResponses = { +export type GlobalUpgradeResponses = { /** - * Updated session + * Upgrade result */ - 200: Pty + 200: + | { + success: true + version: string + } + | { + success: false + error: string + } } -export type PtyUpdateResponse = PtyUpdateResponses[keyof PtyUpdateResponses] +export type GlobalUpgradeResponse = GlobalUpgradeResponses[keyof GlobalUpgradeResponses] -export type PtyConnectData = { +export type EventSubscribeData = { body?: never - path: { - id: string - } + path?: never query?: { directory?: string + workspace?: string } - url: "/pty/{id}/connect" + url: "/event" } -export type PtyConnectErrors = { +export type EventSubscribeResponses = { /** - * Not found + * Event stream */ - 404: NotFoundError + 200: Event } -export type PtyConnectError = PtyConnectErrors[keyof PtyConnectErrors] - -export type PtyConnectResponses = { - /** - * Connected session - */ - 200: boolean -} - -export type PtyConnectResponse = PtyConnectResponses[keyof PtyConnectResponses] +export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses] export type ConfigGetData = { body?: never path?: never query?: { directory?: string + workspace?: string } url: "/config" } @@ -1929,6 +3942,7 @@ export type ConfigUpdateData = { path?: never query?: { directory?: string + workspace?: string } url: "/config" } @@ -1951,38 +3965,126 @@ export type ConfigUpdateResponses = { export type ConfigUpdateResponse = ConfigUpdateResponses[keyof ConfigUpdateResponses] -export type ToolIdsData = { +export type ConfigProvidersData = { body?: never path?: never query?: { directory?: string + workspace?: string } - url: "/experimental/tool/ids" + url: "/config/providers" } -export type ToolIdsErrors = { +export type ConfigProvidersResponses = { /** - * Bad request + * List of providers */ - 400: BadRequestError + 200: { + providers: Array + default: { + [key: string]: string + } + } } -export type ToolIdsError = ToolIdsErrors[keyof ToolIdsErrors] +export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses] -export type ToolIdsResponses = { +export type ExperimentalConsoleGetData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/console" +} + +export type ExperimentalConsoleGetErrors = { /** - * Tool IDs + * InternalServerError */ - 200: ToolIds + 500: EffectHttpApiErrorInternalServerError } -export type ToolIdsResponse = ToolIdsResponses[keyof ToolIdsResponses] +export type ExperimentalConsoleGetError = ExperimentalConsoleGetErrors[keyof ExperimentalConsoleGetErrors] + +export type ExperimentalConsoleGetResponses = { + /** + * Active Console provider metadata + */ + 200: ConsoleState +} + +export type ExperimentalConsoleGetResponse = ExperimentalConsoleGetResponses[keyof ExperimentalConsoleGetResponses] + +export type ExperimentalConsoleListOrgsData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/console/orgs" +} + +export type ExperimentalConsoleListOrgsErrors = { + /** + * InternalServerError + */ + 500: EffectHttpApiErrorInternalServerError +} + +export type ExperimentalConsoleListOrgsError = + ExperimentalConsoleListOrgsErrors[keyof ExperimentalConsoleListOrgsErrors] + +export type ExperimentalConsoleListOrgsResponses = { + /** + * Switchable Console orgs + */ + 200: { + orgs: Array<{ + accountID: string + accountEmail: string + accountUrl: string + orgID: string + orgName: string + active: boolean + }> + } +} + +export type ExperimentalConsoleListOrgsResponse = + ExperimentalConsoleListOrgsResponses[keyof ExperimentalConsoleListOrgsResponses] + +export type ExperimentalConsoleSwitchOrgData = { + body?: { + accountID: string + orgID: string + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/console/switch" +} + +export type ExperimentalConsoleSwitchOrgResponses = { + /** + * Switch success + */ + 200: boolean +} + +export type ExperimentalConsoleSwitchOrgResponse = + ExperimentalConsoleSwitchOrgResponses[keyof ExperimentalConsoleSwitchOrgResponses] export type ToolListData = { body?: never path?: never query: { directory?: string + workspace?: string provider: string model: string } @@ -2007,1139 +4109,199 @@ export type ToolListResponses = { export type ToolListResponse = ToolListResponses[keyof ToolListResponses] -export type InstanceDisposeData = { +export type ToolIdsData = { body?: never path?: never query?: { directory?: string + workspace?: string } - url: "/instance/dispose" + url: "/experimental/tool/ids" } -export type InstanceDisposeResponses = { +export type ToolIdsErrors = { /** - * Instance disposed + * Bad request + */ + 400: BadRequestError +} + +export type ToolIdsError = ToolIdsErrors[keyof ToolIdsErrors] + +export type ToolIdsResponses = { + /** + * Tool IDs + */ + 200: ToolIds +} + +export type ToolIdsResponse = ToolIdsResponses[keyof ToolIdsResponses] + +export type WorktreeRemoveData = { + body?: WorktreeRemoveInput + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/worktree" +} + +export type WorktreeRemoveErrors = { + /** + * WorktreeError + */ + 400: WorktreeError +} + +export type WorktreeRemoveError = WorktreeRemoveErrors[keyof WorktreeRemoveErrors] + +export type WorktreeRemoveResponses = { + /** + * Worktree removed */ 200: boolean } -export type InstanceDisposeResponse = InstanceDisposeResponses[keyof InstanceDisposeResponses] +export type WorktreeRemoveResponse = WorktreeRemoveResponses[keyof WorktreeRemoveResponses] -export type PathGetData = { +export type WorktreeListData = { body?: never path?: never query?: { directory?: string + workspace?: string } - url: "/path" + url: "/experimental/worktree" } -export type PathGetResponses = { +export type WorktreeListErrors = { /** - * Path + * WorktreeError */ - 200: Path + 400: WorktreeError } -export type PathGetResponse = PathGetResponses[keyof PathGetResponses] +export type WorktreeListError = WorktreeListErrors[keyof WorktreeListErrors] -export type VcsGetData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/vcs" -} - -export type VcsGetResponses = { +export type WorktreeListResponses = { /** - * VCS info + * List of worktree directories */ - 200: VcsInfo + 200: Array } -export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses] +export type WorktreeListResponse = WorktreeListResponses[keyof WorktreeListResponses] -export type SessionListData = { +export type WorktreeCreateData = { + body?: WorktreeCreateInput + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/worktree" +} + +export type WorktreeCreateErrors = { + /** + * WorktreeError + */ + 400: WorktreeError +} + +export type WorktreeCreateError = WorktreeCreateErrors[keyof WorktreeCreateErrors] + +export type WorktreeCreateResponses = { + /** + * Worktree created + */ + 200: Worktree +} + +export type WorktreeCreateResponse = WorktreeCreateResponses[keyof WorktreeCreateResponses] + +export type WorktreeResetData = { + body?: WorktreeResetInput + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/worktree/reset" +} + +export type WorktreeResetErrors = { + /** + * WorktreeError + */ + 400: WorktreeError +} + +export type WorktreeResetError = WorktreeResetErrors[keyof WorktreeResetErrors] + +export type WorktreeResetResponses = { + /** + * Worktree reset + */ + 200: boolean +} + +export type WorktreeResetResponse = WorktreeResetResponses[keyof WorktreeResetResponses] + +export type ExperimentalSessionListData = { body?: never path?: never query?: { directory?: string + workspace?: string + roots?: boolean | "true" | "false" + start?: number + cursor?: number + search?: string + limit?: number + archived?: boolean | "true" | "false" } - url: "/session" + url: "/experimental/session" } -export type SessionListResponses = { +export type ExperimentalSessionListResponses = { /** * List of sessions */ - 200: Array + 200: Array } -export type SessionListResponse = SessionListResponses[keyof SessionListResponses] +export type ExperimentalSessionListResponse = ExperimentalSessionListResponses[keyof ExperimentalSessionListResponses] -export type SessionCreateData = { - body?: { - parentID?: string - title?: string - } - path?: never - query?: { - directory?: string - } - url: "/session" -} - -export type SessionCreateErrors = { - /** - * Bad request - */ - 400: BadRequestError -} - -export type SessionCreateError = SessionCreateErrors[keyof SessionCreateErrors] - -export type SessionCreateResponses = { - /** - * Successfully created session - */ - 200: Session -} - -export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses] - -export type SessionStatusData = { +export type ExperimentalResourceListData = { body?: never path?: never query?: { directory?: string + workspace?: string } - url: "/session/status" + url: "/experimental/resource" } -export type SessionStatusErrors = { +export type ExperimentalResourceListResponses = { /** - * Bad request - */ - 400: BadRequestError -} - -export type SessionStatusError = SessionStatusErrors[keyof SessionStatusErrors] - -export type SessionStatusResponses = { - /** - * Get session status + * MCP resources */ 200: { - [key: string]: SessionStatus + [key: string]: McpResource } } -export type SessionStatusResponse = SessionStatusResponses[keyof SessionStatusResponses] - -export type SessionDeleteData = { - body?: never - path: { - id: string - } - query?: { - directory?: string - } - url: "/session/{id}" -} - -export type SessionDeleteErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionDeleteError = SessionDeleteErrors[keyof SessionDeleteErrors] - -export type SessionDeleteResponses = { - /** - * Successfully deleted session - */ - 200: boolean -} - -export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses] - -export type SessionGetData = { - body?: never - path: { - id: string - } - query?: { - directory?: string - } - url: "/session/{id}" -} - -export type SessionGetErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionGetError = SessionGetErrors[keyof SessionGetErrors] - -export type SessionGetResponses = { - /** - * Get session - */ - 200: Session -} - -export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses] - -export type SessionUpdateData = { - body?: { - title?: string - } - path: { - id: string - } - query?: { - directory?: string - } - url: "/session/{id}" -} - -export type SessionUpdateErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionUpdateError = SessionUpdateErrors[keyof SessionUpdateErrors] - -export type SessionUpdateResponses = { - /** - * Successfully updated session - */ - 200: Session -} - -export type SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses] - -export type SessionChildrenData = { - body?: never - path: { - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/children" -} - -export type SessionChildrenErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionChildrenError = SessionChildrenErrors[keyof SessionChildrenErrors] - -export type SessionChildrenResponses = { - /** - * List of children - */ - 200: Array -} - -export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses] - -export type SessionTodoData = { - body?: never - path: { - /** - * Session ID - */ - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/todo" -} - -export type SessionTodoErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionTodoError = SessionTodoErrors[keyof SessionTodoErrors] - -export type SessionTodoResponses = { - /** - * Todo list - */ - 200: Array -} - -export type SessionTodoResponse = SessionTodoResponses[keyof SessionTodoResponses] - -export type SessionInitData = { - body?: { - modelID: string - providerID: string - messageID: string - } - path: { - /** - * Session ID - */ - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/init" -} - -export type SessionInitErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionInitError = SessionInitErrors[keyof SessionInitErrors] - -export type SessionInitResponses = { - /** - * 200 - */ - 200: boolean -} - -export type SessionInitResponse = SessionInitResponses[keyof SessionInitResponses] - -export type SessionForkData = { - body?: { - messageID?: string - } - path: { - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/fork" -} - -export type SessionForkResponses = { - /** - * 200 - */ - 200: Session -} - -export type SessionForkResponse = SessionForkResponses[keyof SessionForkResponses] - -export type SessionAbortData = { - body?: never - path: { - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/abort" -} - -export type SessionAbortErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionAbortError = SessionAbortErrors[keyof SessionAbortErrors] - -export type SessionAbortResponses = { - /** - * Aborted session - */ - 200: boolean -} - -export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortResponses] - -export type SessionUnshareData = { - body?: never - path: { - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/share" -} - -export type SessionUnshareErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionUnshareError = SessionUnshareErrors[keyof SessionUnshareErrors] - -export type SessionUnshareResponses = { - /** - * Successfully unshared session - */ - 200: Session -} - -export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshareResponses] - -export type SessionShareData = { - body?: never - path: { - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/share" -} - -export type SessionShareErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionShareError = SessionShareErrors[keyof SessionShareErrors] - -export type SessionShareResponses = { - /** - * Successfully shared session - */ - 200: Session -} - -export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses] - -export type SessionDiffData = { - body?: never - path: { - /** - * Session ID - */ - id: string - } - query?: { - directory?: string - messageID?: string - } - url: "/session/{id}/diff" -} - -export type SessionDiffErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionDiffError = SessionDiffErrors[keyof SessionDiffErrors] - -export type SessionDiffResponses = { - /** - * List of diffs - */ - 200: Array -} - -export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses] - -export type SessionSummarizeData = { - body?: { - providerID: string - modelID: string - } - path: { - /** - * Session ID - */ - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/summarize" -} - -export type SessionSummarizeErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionSummarizeError = SessionSummarizeErrors[keyof SessionSummarizeErrors] - -export type SessionSummarizeResponses = { - /** - * Summarized session - */ - 200: boolean -} - -export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses] - -export type SessionMessagesData = { - body?: never - path: { - /** - * Session ID - */ - id: string - } - query?: { - directory?: string - limit?: number - } - url: "/session/{id}/message" -} - -export type SessionMessagesErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionMessagesError = SessionMessagesErrors[keyof SessionMessagesErrors] - -export type SessionMessagesResponses = { - /** - * List of messages - */ - 200: Array<{ - info: Message - parts: Array - }> -} - -export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses] - -export type SessionPromptData = { - body?: { - messageID?: string - model?: { - providerID: string - modelID: string - } - agent?: string - noReply?: boolean - system?: string - tools?: { - [key: string]: boolean - } - parts: Array - } - path: { - /** - * Session ID - */ - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/message" -} - -export type SessionPromptErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionPromptError = SessionPromptErrors[keyof SessionPromptErrors] - -export type SessionPromptResponses = { - /** - * Created message - */ - 200: { - info: AssistantMessage - parts: Array - } -} - -export type SessionPromptResponse = SessionPromptResponses[keyof SessionPromptResponses] - -export type SessionMessageData = { - body?: never - path: { - /** - * Session ID - */ - id: string - /** - * Message ID - */ - messageID: string - } - query?: { - directory?: string - } - url: "/session/{id}/message/{messageID}" -} - -export type SessionMessageErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionMessageError = SessionMessageErrors[keyof SessionMessageErrors] - -export type SessionMessageResponses = { - /** - * Message - */ - 200: { - info: Message - parts: Array - } -} - -export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses] - -export type SessionPromptAsyncData = { - body?: { - messageID?: string - model?: { - providerID: string - modelID: string - } - agent?: string - noReply?: boolean - system?: string - tools?: { - [key: string]: boolean - } - parts: Array - } - path: { - /** - * Session ID - */ - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/prompt_async" -} - -export type SessionPromptAsyncErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionPromptAsyncError = SessionPromptAsyncErrors[keyof SessionPromptAsyncErrors] - -export type SessionPromptAsyncResponses = { - /** - * Prompt accepted - */ - 204: void -} - -export type SessionPromptAsyncResponse = SessionPromptAsyncResponses[keyof SessionPromptAsyncResponses] - -export type SessionCommandData = { - body?: { - messageID?: string - agent?: string - model?: string - arguments: string - command: string - } - path: { - /** - * Session ID - */ - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/command" -} - -export type SessionCommandErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionCommandError = SessionCommandErrors[keyof SessionCommandErrors] - -export type SessionCommandResponses = { - /** - * Created message - */ - 200: { - info: AssistantMessage - parts: Array - } -} - -export type SessionCommandResponse = SessionCommandResponses[keyof SessionCommandResponses] - -export type SessionShellData = { - body?: { - agent: string - model?: { - providerID: string - modelID: string - } - command: string - } - path: { - /** - * Session ID - */ - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/shell" -} - -export type SessionShellErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionShellError = SessionShellErrors[keyof SessionShellErrors] - -export type SessionShellResponses = { - /** - * Created message - */ - 200: AssistantMessage -} - -export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses] - -export type SessionRevertData = { - body?: { - messageID: string - partID?: string - } - path: { - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/revert" -} - -export type SessionRevertErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionRevertError = SessionRevertErrors[keyof SessionRevertErrors] - -export type SessionRevertResponses = { - /** - * Updated session - */ - 200: Session -} - -export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertResponses] - -export type SessionUnrevertData = { - body?: never - path: { - id: string - } - query?: { - directory?: string - } - url: "/session/{id}/unrevert" -} - -export type SessionUnrevertErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type SessionUnrevertError = SessionUnrevertErrors[keyof SessionUnrevertErrors] - -export type SessionUnrevertResponses = { - /** - * Updated session - */ - 200: Session -} - -export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses] - -export type PostSessionIdPermissionsPermissionIdData = { - body?: { - response: "once" | "always" | "reject" - } - path: { - id: string - permissionID: string - } - query?: { - directory?: string - } - url: "/session/{id}/permissions/{permissionID}" -} - -export type PostSessionIdPermissionsPermissionIdErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} - -export type PostSessionIdPermissionsPermissionIdError = - PostSessionIdPermissionsPermissionIdErrors[keyof PostSessionIdPermissionsPermissionIdErrors] - -export type PostSessionIdPermissionsPermissionIdResponses = { - /** - * Permission processed successfully - */ - 200: boolean -} - -export type PostSessionIdPermissionsPermissionIdResponse = - PostSessionIdPermissionsPermissionIdResponses[keyof PostSessionIdPermissionsPermissionIdResponses] - -export type CommandListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/command" -} - -export type CommandListResponses = { - /** - * List of commands - */ - 200: Array -} - -export type CommandListResponse = CommandListResponses[keyof CommandListResponses] - -export type ConfigProvidersData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/config/providers" -} - -export type ConfigProvidersResponses = { - /** - * List of providers - */ - 200: { - providers: Array - default: { - [key: string]: string - } - } -} - -export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses] - -export type ProviderListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/provider" -} - -export type ProviderListResponses = { - /** - * List of providers - */ - 200: { - all: Array<{ - api?: string - name: string - env: Array - id: string - npm?: string - models: { - [key: string]: { - id: string - name: string - release_date: string - attachment: boolean - reasoning: boolean - temperature: boolean - tool_call: boolean - cost?: { - input: number - output: number - cache_read?: number - cache_write?: number - context_over_200k?: { - input: number - output: number - cache_read?: number - cache_write?: number - } - } - limit: { - context: number - output: number - } - modalities?: { - input: Array<"text" | "audio" | "image" | "video" | "pdf"> - output: Array<"text" | "audio" | "image" | "video" | "pdf"> - } - experimental?: boolean - status?: "alpha" | "beta" | "deprecated" | "active" - options: { - [key: string]: unknown - } - headers?: { - [key: string]: string - } - provider?: { - npm: string - } - } - } - }> - default: { - [key: string]: string - } - connected: Array - } -} - -export type ProviderListResponse = ProviderListResponses[keyof ProviderListResponses] - -export type ProviderAuthData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/provider/auth" -} - -export type ProviderAuthResponses = { - /** - * Provider auth methods - */ - 200: { - [key: string]: Array - } -} - -export type ProviderAuthResponse = ProviderAuthResponses[keyof ProviderAuthResponses] - -export type ProviderOauthAuthorizeData = { - body?: { - /** - * Auth method index - */ - method: number - } - path: { - /** - * Provider ID - */ - id: string - } - query?: { - directory?: string - } - url: "/provider/{id}/oauth/authorize" -} - -export type ProviderOauthAuthorizeErrors = { - /** - * Bad request - */ - 400: BadRequestError -} - -export type ProviderOauthAuthorizeError = ProviderOauthAuthorizeErrors[keyof ProviderOauthAuthorizeErrors] - -export type ProviderOauthAuthorizeResponses = { - /** - * Authorization URL and method - */ - 200: ProviderAuthAuthorization -} - -export type ProviderOauthAuthorizeResponse = ProviderOauthAuthorizeResponses[keyof ProviderOauthAuthorizeResponses] - -export type ProviderOauthCallbackData = { - body?: { - /** - * Auth method index - */ - method: number - /** - * OAuth authorization code - */ - code?: string - } - path: { - /** - * Provider ID - */ - id: string - } - query?: { - directory?: string - } - url: "/provider/{id}/oauth/callback" -} - -export type ProviderOauthCallbackErrors = { - /** - * Bad request - */ - 400: BadRequestError -} - -export type ProviderOauthCallbackError = ProviderOauthCallbackErrors[keyof ProviderOauthCallbackErrors] - -export type ProviderOauthCallbackResponses = { - /** - * OAuth callback processed successfully - */ - 200: boolean -} - -export type ProviderOauthCallbackResponse = ProviderOauthCallbackResponses[keyof ProviderOauthCallbackResponses] +export type ExperimentalResourceListResponse = + ExperimentalResourceListResponses[keyof ExperimentalResourceListResponses] export type FindTextData = { body?: never path?: never query: { directory?: string + workspace?: string pattern: string } url: "/find" @@ -3175,8 +4337,11 @@ export type FindFilesData = { path?: never query: { directory?: string + workspace?: string query: string dirs?: "true" | "false" + type?: "file" | "directory" + limit?: number } url: "/find/file" } @@ -3195,6 +4360,7 @@ export type FindSymbolsData = { path?: never query: { directory?: string + workspace?: string query: string } url: "/find/symbol" @@ -3214,6 +4380,7 @@ export type FileListData = { path?: never query: { directory?: string + workspace?: string path: string } url: "/file" @@ -3233,6 +4400,7 @@ export type FileReadData = { path?: never query: { directory?: string + workspace?: string path: string } url: "/file/content" @@ -3252,6 +4420,7 @@ export type FileStatusData = { path?: never query?: { directory?: string + workspace?: string } url: "/file/status" } @@ -3265,57 +4434,178 @@ export type FileStatusResponses = { export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses] -export type AppLogData = { - body?: { - /** - * Service name for the log entry - */ - service: string - /** - * Log level - */ - level: "debug" | "info" | "error" | "warn" - /** - * Log message - */ - message: string - /** - * Additional metadata for the log entry - */ - extra?: { - [key: string]: unknown - } - } +export type InstanceDisposeData = { + body?: never path?: never query?: { directory?: string + workspace?: string } - url: "/log" + url: "/instance/dispose" } -export type AppLogErrors = { +export type InstanceDisposeResponses = { /** - * Bad request - */ - 400: BadRequestError -} - -export type AppLogError = AppLogErrors[keyof AppLogErrors] - -export type AppLogResponses = { - /** - * Log entry written successfully + * Instance disposed */ 200: boolean } -export type AppLogResponse = AppLogResponses[keyof AppLogResponses] +export type InstanceDisposeResponse = InstanceDisposeResponses[keyof InstanceDisposeResponses] + +export type PathGetData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/path" +} + +export type PathGetResponses = { + /** + * Path + */ + 200: Path +} + +export type PathGetResponse = PathGetResponses[keyof PathGetResponses] + +export type VcsGetData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/vcs" +} + +export type VcsGetResponses = { + /** + * VCS info + */ + 200: VcsInfo +} + +export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses] + +export type VcsStatusData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/vcs/status" +} + +export type VcsStatusResponses = { + /** + * VCS status + */ + 200: Array +} + +export type VcsStatusResponse = VcsStatusResponses[keyof VcsStatusResponses] + +export type VcsDiffData = { + body?: never + path?: never + query: { + directory?: string + workspace?: string + mode: "git" | "branch" + } + url: "/vcs/diff" +} + +export type VcsDiffResponses = { + /** + * VCS diff + */ + 200: Array +} + +export type VcsDiffResponse = VcsDiffResponses[keyof VcsDiffResponses] + +export type VcsDiffRawData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/vcs/diff/raw" +} + +export type VcsDiffRawResponses = { + /** + * Raw VCS diff + */ + 200: string +} + +export type VcsDiffRawResponse = VcsDiffRawResponses[keyof VcsDiffRawResponses] + +export type VcsApplyData = { + body?: { + patch: string + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/vcs/apply" +} + +export type VcsApplyErrors = { + /** + * VcsApplyError + */ + 400: VcsApplyError +} + +export type VcsApplyError2 = VcsApplyErrors[keyof VcsApplyErrors] + +export type VcsApplyResponses = { + /** + * VCS patch applied + */ + 200: { + applied: boolean + } +} + +export type VcsApplyResponse = VcsApplyResponses[keyof VcsApplyResponses] + +export type CommandListData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/command" +} + +export type CommandListResponses = { + /** + * List of commands + */ + 200: Array +} + +export type CommandListResponse = CommandListResponses[keyof CommandListResponses] export type AppAgentsData = { body?: never path?: never query?: { directory?: string + workspace?: string } url: "/agent" } @@ -3329,11 +4619,74 @@ export type AppAgentsResponses = { export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses] +export type AppSkillsData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/skill" +} + +export type AppSkillsResponses = { + /** + * List of skills + */ + 200: Array<{ + name: string + description?: string + location: string + content: string + }> +} + +export type AppSkillsResponse = AppSkillsResponses[keyof AppSkillsResponses] + +export type LspStatusData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/lsp" +} + +export type LspStatusResponses = { + /** + * LSP server status + */ + 200: Array +} + +export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses] + +export type FormatterStatusData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/formatter" +} + +export type FormatterStatusResponses = { + /** + * Formatter status + */ + 200: Array +} + +export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses] + export type McpStatusData = { body?: never path?: never query?: { directory?: string + workspace?: string } url: "/mcp" } @@ -3357,6 +4710,7 @@ export type McpAddData = { path?: never query?: { directory?: string + workspace?: string } url: "/mcp" } @@ -3388,6 +4742,7 @@ export type McpAuthRemoveData = { } query?: { directory?: string + workspace?: string } url: "/mcp/{name}/auth" } @@ -3419,15 +4774,16 @@ export type McpAuthStartData = { } query?: { directory?: string + workspace?: string } url: "/mcp/{name}/auth" } export type McpAuthStartErrors = { /** - * Bad request + * McpUnsupportedOAuthError */ - 400: BadRequestError + 400: McpUnsupportedOAuthError /** * Not found */ @@ -3441,10 +4797,8 @@ export type McpAuthStartResponses = { * OAuth flow started */ 200: { - /** - * URL to open in browser for authorization - */ authorizationUrl: string + oauthState: string } } @@ -3452,9 +4806,6 @@ export type McpAuthStartResponse = McpAuthStartResponses[keyof McpAuthStartRespo export type McpAuthCallbackData = { body?: { - /** - * Authorization code from OAuth callback - */ code: string } path: { @@ -3462,6 +4813,7 @@ export type McpAuthCallbackData = { } query?: { directory?: string + workspace?: string } url: "/mcp/{name}/auth/callback" } @@ -3495,15 +4847,16 @@ export type McpAuthAuthenticateData = { } query?: { directory?: string + workspace?: string } url: "/mcp/{name}/auth/authenticate" } export type McpAuthAuthenticateErrors = { /** - * Bad request + * McpUnsupportedOAuthError */ - 400: BadRequestError + 400: McpUnsupportedOAuthError /** * Not found */ @@ -3528,6 +4881,7 @@ export type McpConnectData = { } query?: { directory?: string + workspace?: string } url: "/mcp/{name}/connect" } @@ -3548,6 +4902,7 @@ export type McpDisconnectData = { } query?: { directory?: string + workspace?: string } url: "/mcp/{name}/disconnect" } @@ -3561,41 +4916,1710 @@ export type McpDisconnectResponses = { export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses] -export type LspStatusData = { +export type ProjectListData = { body?: never path?: never query?: { directory?: string + workspace?: string } - url: "/lsp" + url: "/project" } -export type LspStatusResponses = { +export type ProjectListResponses = { /** - * LSP server status + * List of projects */ - 200: Array + 200: Array } -export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses] +export type ProjectListResponse = ProjectListResponses[keyof ProjectListResponses] -export type FormatterStatusData = { +export type ProjectCurrentData = { body?: never path?: never query?: { directory?: string + workspace?: string } - url: "/formatter" + url: "/project/current" } -export type FormatterStatusResponses = { +export type ProjectCurrentResponses = { /** - * Formatter status + * Current project information */ - 200: Array + 200: Project } -export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses] +export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses] + +export type ProjectInitGitData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/project/git/init" +} + +export type ProjectInitGitResponses = { + /** + * Project information after git initialization + */ + 200: Project +} + +export type ProjectInitGitResponse = ProjectInitGitResponses[keyof ProjectInitGitResponses] + +export type ProjectUpdateData = { + body?: { + name?: string + icon?: { + url?: string + override?: string + color?: string + } + commands?: { + /** + * Startup script to run when creating a new workspace (worktree) + */ + start?: string + } + } + path: { + projectID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/project/{projectID}" +} + +export type ProjectUpdateErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * Not found + */ + 404: NotFoundError +} + +export type ProjectUpdateError = ProjectUpdateErrors[keyof ProjectUpdateErrors] + +export type ProjectUpdateResponses = { + /** + * Updated project information + */ + 200: Project +} + +export type ProjectUpdateResponse = ProjectUpdateResponses[keyof ProjectUpdateResponses] + +export type PtyShellsData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/pty/shells" +} + +export type PtyShellsResponses = { + /** + * List of shells + */ + 200: Array<{ + path: string + name: string + acceptable: boolean + }> +} + +export type PtyShellsResponse = PtyShellsResponses[keyof PtyShellsResponses] + +export type PtyListData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/pty" +} + +export type PtyListResponses = { + /** + * List of sessions + */ + 200: Array +} + +export type PtyListResponse = PtyListResponses[keyof PtyListResponses] + +export type PtyCreateData = { + body?: { + command?: string + args?: Array + cwd?: string + title?: string + env?: { + [key: string]: string + } + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/pty" +} + +export type PtyCreateErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type PtyCreateError = PtyCreateErrors[keyof PtyCreateErrors] + +export type PtyCreateResponses = { + /** + * Created session + */ + 200: Pty +} + +export type PtyCreateResponse = PtyCreateResponses[keyof PtyCreateResponses] + +export type PtyRemoveData = { + body?: never + path: { + ptyID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/pty/{ptyID}" +} + +export type PtyRemoveErrors = { + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type PtyRemoveError = PtyRemoveErrors[keyof PtyRemoveErrors] + +export type PtyRemoveResponses = { + /** + * Session removed + */ + 200: boolean +} + +export type PtyRemoveResponse = PtyRemoveResponses[keyof PtyRemoveResponses] + +export type PtyGetData = { + body?: never + path: { + ptyID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/pty/{ptyID}" +} + +export type PtyGetErrors = { + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type PtyGetError = PtyGetErrors[keyof PtyGetErrors] + +export type PtyGetResponses = { + /** + * Session info + */ + 200: Pty +} + +export type PtyGetResponse = PtyGetResponses[keyof PtyGetResponses] + +export type PtyUpdateData = { + body?: { + title?: string + size?: { + rows: number + cols: number + } + } + path: { + ptyID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/pty/{ptyID}" +} + +export type PtyUpdateErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type PtyUpdateError = PtyUpdateErrors[keyof PtyUpdateErrors] + +export type PtyUpdateResponses = { + /** + * Updated session + */ + 200: Pty +} + +export type PtyUpdateResponse = PtyUpdateResponses[keyof PtyUpdateResponses] + +export type PtyConnectTokenData = { + body?: never + path: { + ptyID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/pty/{ptyID}/connect-token" +} + +export type PtyConnectTokenErrors = { + /** + * Forbidden + */ + 403: EffectHttpApiErrorForbidden + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type PtyConnectTokenError = PtyConnectTokenErrors[keyof PtyConnectTokenErrors] + +export type PtyConnectTokenResponses = { + /** + * WebSocket connect token + */ + 200: { + ticket: string + expires_in: number + } +} + +export type PtyConnectTokenResponse = PtyConnectTokenResponses[keyof PtyConnectTokenResponses] + +export type QuestionListData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/question" +} + +export type QuestionListResponses = { + /** + * List of pending questions + */ + 200: Array +} + +export type QuestionListResponse = QuestionListResponses[keyof QuestionListResponses] + +export type QuestionReplyData = { + body?: { + /** + * User answers in order of questions (each answer is an array of selected labels) + */ + answers: Array + } + path: { + requestID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/question/{requestID}/reply" +} + +export type QuestionReplyErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * Not found + */ + 404: NotFoundError +} + +export type QuestionReplyError = QuestionReplyErrors[keyof QuestionReplyErrors] + +export type QuestionReplyResponses = { + /** + * Question answered successfully + */ + 200: boolean +} + +export type QuestionReplyResponse = QuestionReplyResponses[keyof QuestionReplyResponses] + +export type QuestionRejectData = { + body?: never + path: { + requestID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/question/{requestID}/reject" +} + +export type QuestionRejectErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * Not found + */ + 404: NotFoundError +} + +export type QuestionRejectError = QuestionRejectErrors[keyof QuestionRejectErrors] + +export type QuestionRejectResponses = { + /** + * Question rejected successfully + */ + 200: boolean +} + +export type QuestionRejectResponse = QuestionRejectResponses[keyof QuestionRejectResponses] + +export type PermissionListData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/permission" +} + +export type PermissionListResponses = { + /** + * List of pending permissions + */ + 200: Array +} + +export type PermissionListResponse = PermissionListResponses[keyof PermissionListResponses] + +export type PermissionReplyData = { + body?: { + reply: "once" | "always" | "reject" + message?: string + } + path: { + requestID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/permission/{requestID}/reply" +} + +export type PermissionReplyErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * Not found + */ + 404: NotFoundError +} + +export type PermissionReplyError = PermissionReplyErrors[keyof PermissionReplyErrors] + +export type PermissionReplyResponses = { + /** + * Permission processed successfully + */ + 200: boolean +} + +export type PermissionReplyResponse = PermissionReplyResponses[keyof PermissionReplyResponses] + +export type ProviderListData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/provider" +} + +export type ProviderListResponses = { + /** + * List of providers + */ + 200: { + all: Array + default: { + [key: string]: string + } + connected: Array + } +} + +export type ProviderListResponse = ProviderListResponses[keyof ProviderListResponses] + +export type ProviderAuthData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/provider/auth" +} + +export type ProviderAuthResponses = { + /** + * Provider auth methods + */ + 200: { + [key: string]: Array + } +} + +export type ProviderAuthResponse = ProviderAuthResponses[keyof ProviderAuthResponses] + +export type ProviderOauthAuthorizeData = { + body?: { + /** + * Auth method index + */ + method: number + inputs?: { + [key: string]: string + } + } + path: { + providerID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/provider/{providerID}/oauth/authorize" +} + +export type ProviderOauthAuthorizeErrors = { + /** + * ProviderAuthError + */ + 400: ProviderAuthError1 +} + +export type ProviderOauthAuthorizeError = ProviderOauthAuthorizeErrors[keyof ProviderOauthAuthorizeErrors] + +export type ProviderOauthAuthorizeResponses = { + /** + * Authorization URL and method + */ + 200: ProviderAuthAuthorization +} + +export type ProviderOauthAuthorizeResponse = ProviderOauthAuthorizeResponses[keyof ProviderOauthAuthorizeResponses] + +export type ProviderOauthCallbackData = { + body?: { + /** + * Auth method index + */ + method: number + code?: string + } + path: { + providerID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/provider/{providerID}/oauth/callback" +} + +export type ProviderOauthCallbackErrors = { + /** + * ProviderAuthError + */ + 400: ProviderAuthError1 +} + +export type ProviderOauthCallbackError = ProviderOauthCallbackErrors[keyof ProviderOauthCallbackErrors] + +export type ProviderOauthCallbackResponses = { + /** + * OAuth callback processed successfully + */ + 200: boolean +} + +export type ProviderOauthCallbackResponse = ProviderOauthCallbackResponses[keyof ProviderOauthCallbackResponses] + +export type SessionListData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + scope?: "project" + path?: string + roots?: boolean | "true" | "false" + start?: number + search?: string + limit?: number + } + url: "/session" +} + +export type SessionListResponses = { + /** + * List of sessions + */ + 200: Array +} + +export type SessionListResponse = SessionListResponses[keyof SessionListResponses] + +export type SessionCreateData = { + body?: { + parentID?: string + title?: string + agent?: string + model?: { + id: string + providerID: string + variant?: string + } + permission?: PermissionRuleset + workspaceID?: string + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/session" +} + +export type SessionCreateErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type SessionCreateError = SessionCreateErrors[keyof SessionCreateErrors] + +export type SessionCreateResponses = { + /** + * Successfully created session + */ + 200: Session +} + +export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses] + +export type SessionStatusData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/session/status" +} + +export type SessionStatusErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type SessionStatusError = SessionStatusErrors[keyof SessionStatusErrors] + +export type SessionStatusResponses = { + /** + * Get session status + */ + 200: { + [key: string]: SessionStatus + } +} + +export type SessionStatusResponse = SessionStatusResponses[keyof SessionStatusResponses] + +export type SessionDeleteData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}" +} + +export type SessionDeleteErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionDeleteError = SessionDeleteErrors[keyof SessionDeleteErrors] + +export type SessionDeleteResponses = { + /** + * Successfully deleted session + */ + 200: boolean +} + +export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses] + +export type SessionGetData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}" +} + +export type SessionGetErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionGetError = SessionGetErrors[keyof SessionGetErrors] + +export type SessionGetResponses = { + /** + * Get session + */ + 200: Session +} + +export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses] + +export type SessionUpdateData = { + body?: { + title?: string + permission?: PermissionRuleset + time?: { + archived?: number + } + } + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}" +} + +export type SessionUpdateErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionUpdateError = SessionUpdateErrors[keyof SessionUpdateErrors] + +export type SessionUpdateResponses = { + /** + * Successfully updated session + */ + 200: Session +} + +export type SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses] + +export type SessionChildrenData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/children" +} + +export type SessionChildrenErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionChildrenError = SessionChildrenErrors[keyof SessionChildrenErrors] + +export type SessionChildrenResponses = { + /** + * List of children + */ + 200: Array +} + +export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses] + +export type SessionTodoData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/todo" +} + +export type SessionTodoErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionTodoError = SessionTodoErrors[keyof SessionTodoErrors] + +export type SessionTodoResponses = { + /** + * Todo list + */ + 200: Array +} + +export type SessionTodoResponse = SessionTodoResponses[keyof SessionTodoResponses] + +export type SessionDiffData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + messageID?: string + } + url: "/session/{id}/diff" +} + +export type SessionDiffResponses = { + /** + * Successfully retrieved diff + */ + 200: Array +} + +export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses] + +export type SessionMessagesData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + limit?: number + before?: string + } + url: "/session/{id}/message" +} + +export type SessionMessagesErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionMessagesError = SessionMessagesErrors[keyof SessionMessagesErrors] + +export type SessionMessagesResponses = { + /** + * List of messages + */ + 200: Array<{ + info: Message + parts: Array + }> +} + +export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses] + +export type SessionPromptData = { + body?: { + messageID?: string + model?: { + providerID: string + modelID: string + } + agent?: string + noReply?: boolean + tools?: { + [key: string]: boolean + } + format?: OutputFormat + system?: string + variant?: string + parts: Array + } + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/message" +} + +export type SessionPromptErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionPromptError = SessionPromptErrors[keyof SessionPromptErrors] + +export type SessionPromptResponses = { + /** + * Created message + */ + 200: { + info: AssistantMessage + parts: Array + } +} + +export type SessionPromptResponse = SessionPromptResponses[keyof SessionPromptResponses] + +export type SessionDeleteMessageData = { + body?: never + path: { + id: string + messageID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/message/{messageID}" +} + +export type SessionDeleteMessageErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionDeleteMessageError = SessionDeleteMessageErrors[keyof SessionDeleteMessageErrors] + +export type SessionDeleteMessageResponses = { + /** + * Successfully deleted message + */ + 200: boolean +} + +export type SessionDeleteMessageResponse = SessionDeleteMessageResponses[keyof SessionDeleteMessageResponses] + +export type SessionMessageData = { + body?: never + path: { + id: string + messageID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/message/{messageID}" +} + +export type SessionMessageErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionMessageError = SessionMessageErrors[keyof SessionMessageErrors] + +export type SessionMessageResponses = { + /** + * Message + */ + 200: { + info: Message + parts: Array + } +} + +export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses] + +export type SessionForkData = { + body?: { + messageID?: string + } + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/fork" +} + +export type SessionForkErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionForkError = SessionForkErrors[keyof SessionForkErrors] + +export type SessionForkResponses = { + /** + * 200 + */ + 200: Session +} + +export type SessionForkResponse = SessionForkResponses[keyof SessionForkResponses] + +export type SessionAbortData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/abort" +} + +export type SessionAbortErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type SessionAbortError = SessionAbortErrors[keyof SessionAbortErrors] + +export type SessionAbortResponses = { + /** + * Aborted session + */ + 200: boolean +} + +export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortResponses] + +export type SessionInitData = { + body?: { + modelID: string + providerID: string + messageID: string + } + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/init" +} + +export type SessionInitErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionInitError = SessionInitErrors[keyof SessionInitErrors] + +export type SessionInitResponses = { + /** + * 200 + */ + 200: boolean +} + +export type SessionInitResponse = SessionInitResponses[keyof SessionInitResponses] + +export type SessionUnshareData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/share" +} + +export type SessionUnshareErrors = { + /** + * NotFoundError + */ + 404: NotFoundError + /** + * InternalServerError + */ + 500: EffectHttpApiErrorInternalServerError +} + +export type SessionUnshareError = SessionUnshareErrors[keyof SessionUnshareErrors] + +export type SessionUnshareResponses = { + /** + * Successfully unshared session + */ + 200: Session +} + +export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshareResponses] + +export type SessionShareData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/share" +} + +export type SessionShareErrors = { + /** + * NotFoundError + */ + 404: NotFoundError + /** + * InternalServerError + */ + 500: EffectHttpApiErrorInternalServerError +} + +export type SessionShareError = SessionShareErrors[keyof SessionShareErrors] + +export type SessionShareResponses = { + /** + * Successfully shared session + */ + 200: Session +} + +export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses] + +export type SessionSummarizeData = { + body?: { + providerID: string + modelID: string + auto?: boolean + } + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/summarize" +} + +export type SessionSummarizeErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionSummarizeError = SessionSummarizeErrors[keyof SessionSummarizeErrors] + +export type SessionSummarizeResponses = { + /** + * Summarized session + */ + 200: boolean +} + +export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses] + +export type SessionPromptAsyncData = { + body?: { + messageID?: string + model?: { + providerID: string + modelID: string + } + agent?: string + noReply?: boolean + tools?: { + [key: string]: boolean + } + format?: OutputFormat + system?: string + variant?: string + parts: Array + } + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/prompt_async" +} + +export type SessionPromptAsyncErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionPromptAsyncError = SessionPromptAsyncErrors[keyof SessionPromptAsyncErrors] + +export type SessionPromptAsyncResponses = { + /** + * Prompt accepted + */ + 204: void +} + +export type SessionPromptAsyncResponse = SessionPromptAsyncResponses[keyof SessionPromptAsyncResponses] + +export type SessionCommandData = { + body?: { + messageID?: string + agent?: string + model?: string + arguments: string + command: string + variant?: string + parts?: Array<{ + id?: string + type: "file" + mime: string + filename?: string + url: string + source?: FilePartSource + }> + } + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/command" +} + +export type SessionCommandErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionCommandError = SessionCommandErrors[keyof SessionCommandErrors] + +export type SessionCommandResponses = { + /** + * Created message + */ + 200: { + info: AssistantMessage + parts: Array + } +} + +export type SessionCommandResponse = SessionCommandResponses[keyof SessionCommandResponses] + +export type SessionShellData = { + body?: { + messageID?: string + agent: string + model?: { + providerID: string + modelID: string + } + command: string + } + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/shell" +} + +export type SessionShellErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionShellError = SessionShellErrors[keyof SessionShellErrors] + +export type SessionShellResponses = { + /** + * Created message + */ + 200: { + info: Message + parts: Array + } +} + +export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses] + +export type SessionRevertData = { + body?: { + messageID: string + partID?: string + } + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/revert" +} + +export type SessionRevertErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionRevertError = SessionRevertErrors[keyof SessionRevertErrors] + +export type SessionRevertResponses = { + /** + * Updated session + */ + 200: Session +} + +export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertResponses] + +export type SessionUnrevertData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/unrevert" +} + +export type SessionUnrevertErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type SessionUnrevertError = SessionUnrevertErrors[keyof SessionUnrevertErrors] + +export type SessionUnrevertResponses = { + /** + * Updated session + */ + 200: Session +} + +export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses] + +export type PermissionRespondData = { + body?: { + response: "once" | "always" | "reject" + } + path: { + id: string + permissionID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/permissions/{permissionID}" +} + +export type PermissionRespondErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type PermissionRespondError = PermissionRespondErrors[keyof PermissionRespondErrors] + +export type PermissionRespondResponses = { + /** + * Permission processed successfully + */ + 200: boolean +} + +export type PermissionRespondResponse = PermissionRespondResponses[keyof PermissionRespondResponses] + +export type PartDeleteData = { + body?: never + path: { + id: string + messageID: string + partID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/message/{messageID}/part/{partID}" +} + +export type PartDeleteErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type PartDeleteError = PartDeleteErrors[keyof PartDeleteErrors] + +export type PartDeleteResponses = { + /** + * Successfully deleted part + */ + 200: boolean +} + +export type PartDeleteResponse = PartDeleteResponses[keyof PartDeleteResponses] + +export type PartUpdateData = { + body?: Part + path: { + id: string + messageID: string + partID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/session/{id}/message/{messageID}/part/{partID}" +} + +export type PartUpdateErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type PartUpdateError = PartUpdateErrors[keyof PartUpdateErrors] + +export type PartUpdateResponses = { + /** + * Successfully updated part + */ + 200: Part +} + +export type PartUpdateResponse = PartUpdateResponses[keyof PartUpdateResponses] + +export type SyncStartData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/sync/start" +} + +export type SyncStartResponses = { + /** + * Workspace sync started + */ + 200: boolean +} + +export type SyncStartResponse = SyncStartResponses[keyof SyncStartResponses] + +export type SyncReplayData = { + body?: { + directory: string + events: Array<{ + id: string + aggregateID: string + seq: number + type: string + data: { + [key: string]: unknown + } + }> + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/sync/replay" +} + +export type SyncReplayErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type SyncReplayError = SyncReplayErrors[keyof SyncReplayErrors] + +export type SyncReplayResponses = { + /** + * Replayed sync events + */ + 200: { + sessionID: string + } +} + +export type SyncReplayResponse = SyncReplayResponses[keyof SyncReplayResponses] + +export type SyncStealData = { + body?: { + sessionID: string + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/sync/steal" +} + +export type SyncStealErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type SyncStealError = SyncStealErrors[keyof SyncStealErrors] + +export type SyncStealResponses = { + /** + * Session stolen into workspace + */ + 200: { + sessionID: string + } +} + +export type SyncStealResponse = SyncStealResponses[keyof SyncStealResponses] + +export type SyncHistoryListData = { + body?: { + [key: string]: number + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/sync/history" +} + +export type SyncHistoryListErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type SyncHistoryListError = SyncHistoryListErrors[keyof SyncHistoryListErrors] + +export type SyncHistoryListResponses = { + /** + * Sync events + */ + 200: Array<{ + id: string + aggregate_id: string + seq: number + type: string + data: { + [key: string]: unknown + } + }> +} + +export type SyncHistoryListResponse = SyncHistoryListResponses[keyof SyncHistoryListResponses] export type TuiAppendPromptData = { body?: { @@ -3604,6 +6628,7 @@ export type TuiAppendPromptData = { path?: never query?: { directory?: string + workspace?: string } url: "/tui/append-prompt" } @@ -3631,6 +6656,7 @@ export type TuiOpenHelpData = { path?: never query?: { directory?: string + workspace?: string } url: "/tui/open-help" } @@ -3649,6 +6675,7 @@ export type TuiOpenSessionsData = { path?: never query?: { directory?: string + workspace?: string } url: "/tui/open-sessions" } @@ -3667,6 +6694,7 @@ export type TuiOpenThemesData = { path?: never query?: { directory?: string + workspace?: string } url: "/tui/open-themes" } @@ -3685,6 +6713,7 @@ export type TuiOpenModelsData = { path?: never query?: { directory?: string + workspace?: string } url: "/tui/open-models" } @@ -3703,6 +6732,7 @@ export type TuiSubmitPromptData = { path?: never query?: { directory?: string + workspace?: string } url: "/tui/submit-prompt" } @@ -3721,6 +6751,7 @@ export type TuiClearPromptData = { path?: never query?: { directory?: string + workspace?: string } url: "/tui/clear-prompt" } @@ -3741,6 +6772,7 @@ export type TuiExecuteCommandData = { path?: never query?: { directory?: string + workspace?: string } url: "/tui/execute-command" } @@ -3768,14 +6800,12 @@ export type TuiShowToastData = { title?: string message: string variant: "info" | "success" | "warning" | "error" - /** - * Duration in milliseconds - */ duration?: number } path?: never query?: { directory?: string + workspace?: string } url: "/tui/show-toast" } @@ -3790,10 +6820,11 @@ export type TuiShowToastResponses = { export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses] export type TuiPublishData = { - body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow + body?: EventTuiPromptAppend2 | EventTuiCommandExecute2 | EventTuiToastShow2 | EventTuiSessionSelect2 path?: never query?: { directory?: string + workspace?: string } url: "/tui/publish" } @@ -3816,11 +6847,49 @@ export type TuiPublishResponses = { export type TuiPublishResponse = TuiPublishResponses[keyof TuiPublishResponses] +export type TuiSelectSessionData = { + body?: { + /** + * Session ID to navigate to + */ + sessionID: string + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/tui/select-session" +} + +export type TuiSelectSessionErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * NotFoundError + */ + 404: NotFoundError +} + +export type TuiSelectSessionError = TuiSelectSessionErrors[keyof TuiSelectSessionErrors] + +export type TuiSelectSessionResponses = { + /** + * Session selected successfully + */ + 200: boolean +} + +export type TuiSelectSessionResponse = TuiSelectSessionResponses[keyof TuiSelectSessionResponses] + export type TuiControlNextData = { body?: never path?: never query?: { directory?: string + workspace?: string } url: "/tui/control/next" } @@ -3842,6 +6911,7 @@ export type TuiControlResponseData = { path?: never query?: { directory?: string + workspace?: string } url: "/tui/control/response" } @@ -3855,53 +6925,223 @@ export type TuiControlResponseResponses = { export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiControlResponseResponses] -export type AuthSetData = { - body?: Auth - path: { - id: string - } +export type ExperimentalWorkspaceAdapterListData = { + body?: never + path?: never query?: { directory?: string + workspace?: string } - url: "/auth/{id}" + url: "/experimental/workspace/adapter" } -export type AuthSetErrors = { +export type ExperimentalWorkspaceAdapterListResponses = { + /** + * Workspace adapters + */ + 200: Array<{ + type: string + name: string + description: string + }> +} + +export type ExperimentalWorkspaceAdapterListResponse = + ExperimentalWorkspaceAdapterListResponses[keyof ExperimentalWorkspaceAdapterListResponses] + +export type ExperimentalWorkspaceListData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace" +} + +export type ExperimentalWorkspaceListResponses = { + /** + * Workspaces + */ + 200: Array +} + +export type ExperimentalWorkspaceListResponse = + ExperimentalWorkspaceListResponses[keyof ExperimentalWorkspaceListResponses] + +export type ExperimentalWorkspaceCreateData = { + body?: { + id?: string + type: string + branch?: string | null + extra?: unknown | null + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace" +} + +export type ExperimentalWorkspaceCreateErrors = { /** * Bad request */ 400: BadRequestError } -export type AuthSetError = AuthSetErrors[keyof AuthSetErrors] +export type ExperimentalWorkspaceCreateError = + ExperimentalWorkspaceCreateErrors[keyof ExperimentalWorkspaceCreateErrors] -export type AuthSetResponses = { +export type ExperimentalWorkspaceCreateResponses = { /** - * Successfully set authentication credentials + * Workspace created */ - 200: boolean + 200: Workspace } -export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses] +export type ExperimentalWorkspaceCreateResponse = + ExperimentalWorkspaceCreateResponses[keyof ExperimentalWorkspaceCreateResponses] -export type EventSubscribeData = { +export type ExperimentalWorkspaceSyncListData = { body?: never path?: never query?: { directory?: string + workspace?: string } - url: "/event" + url: "/experimental/workspace/sync-list" } -export type EventSubscribeResponses = { +export type ExperimentalWorkspaceSyncListResponses = { /** - * Event stream + * Workspace list synced */ - 200: Event + 204: void } -export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses] +export type ExperimentalWorkspaceSyncListResponse = + ExperimentalWorkspaceSyncListResponses[keyof ExperimentalWorkspaceSyncListResponses] -export type ClientOptions = { - baseUrl: `${string}://${string}` | (string & {}) +export type ExperimentalWorkspaceStatusData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace/status" } + +export type ExperimentalWorkspaceStatusResponses = { + /** + * Workspace status + */ + 200: Array<{ + workspaceID: string + status: "connected" | "connecting" | "disconnected" | "error" + }> +} + +export type ExperimentalWorkspaceStatusResponse = + ExperimentalWorkspaceStatusResponses[keyof ExperimentalWorkspaceStatusResponses] + +export type ExperimentalWorkspaceRemoveData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace/{id}" +} + +export type ExperimentalWorkspaceRemoveErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type ExperimentalWorkspaceRemoveError = + ExperimentalWorkspaceRemoveErrors[keyof ExperimentalWorkspaceRemoveErrors] + +export type ExperimentalWorkspaceRemoveResponses = { + /** + * Workspace removed + */ + 200: Workspace +} + +export type ExperimentalWorkspaceRemoveResponse = + ExperimentalWorkspaceRemoveResponses[keyof ExperimentalWorkspaceRemoveResponses] + +export type ExperimentalWorkspaceWarpData = { + body?: { + id: string | null + sessionID: string + copyChanges?: boolean + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace/warp" +} + +export type ExperimentalWorkspaceWarpErrors = { + /** + * WorkspaceWarpError | VcsApplyError + */ + 400: WorkspaceWarpError | VcsApplyError +} + +export type ExperimentalWorkspaceWarpError = ExperimentalWorkspaceWarpErrors[keyof ExperimentalWorkspaceWarpErrors] + +export type ExperimentalWorkspaceWarpResponses = { + /** + * Session warped + */ + 204: void +} + +export type ExperimentalWorkspaceWarpResponse = + ExperimentalWorkspaceWarpResponses[keyof ExperimentalWorkspaceWarpResponses] + +export type PtyConnectData = { + body?: never + path: { + ptyID: string + } + query?: { + directory?: string + workspace?: string + } + url: "/pty/{ptyID}/connect" +} + +export type PtyConnectErrors = { + /** + * Forbidden + */ + 403: EffectHttpApiErrorForbidden + /** + * Not found + */ + 404: NotFoundError +} + +export type PtyConnectError = PtyConnectErrors[keyof PtyConnectErrors] + +export type PtyConnectResponses = { + /** + * Connected session + */ + 200: boolean +} + +export type PtyConnectResponse = PtyConnectResponses[keyof PtyConnectResponses] diff --git a/packages/web/src/content/docs/ar/sdk.mdx b/packages/web/src/content/docs/ar/sdk.mdx index bae101acf0..f54cb4c87a 100644 --- a/packages/web/src/content/docs/ar/sdk.mdx +++ b/packages/web/src/content/docs/ar/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ console.log(result.data.info.structured_output) ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | تلخيص جلسة | يعيد `boolean` | | `session.messages({ path })` | سرد الرسائل في جلسة | يعيد `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | جلب تفاصيل الرسالة | يعيد `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | إرسال رسالة مطالبة | `body.noReply: true` يعيد UserMessage (للسياق فقط). الافتراضي يعيد AssistantMessage مع استجابة AI. يدعم `body.outputFormat` من أجل [المخرجات المنظمة](#المخرجات-المنظمة) | +| `session.prompt({ path, body })` | إرسال رسالة مطالبة | `body.noReply: true` يعيد UserMessage (للسياق فقط). الافتراضي يعيد AssistantMessage مع استجابة AI. يدعم `body.format` من أجل [المخرجات المنظمة](#المخرجات-المنظمة) | | `session.command({ path, body })` | إرسال أمر إلى الجلسة | يعيد `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | تشغيل أمر shell | يعيد AssistantMessage | | `session.revert({ path, body })` | التراجع عن رسالة | يعيد Session | diff --git a/packages/web/src/content/docs/bs/sdk.mdx b/packages/web/src/content/docs/bs/sdk.mdx index cc9c2b3bf4..50f8d009bc 100644 --- a/packages/web/src/content/docs/bs/sdk.mdx +++ b/packages/web/src/content/docs/bs/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ Ako model ne uspije proizvesti validan strukturirani izlaz nakon svih ponovnih p ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Summarize session | Returns `boolean` | | `session.messages({ path })` | List messages in a session | Returns `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | Get message details | Returns `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | Send prompt message | `body.noReply: true` returns UserMessage (context only). Default returns AssistantMessage with AI response. Supports `body.outputFormat` for [structured output](#strukturirani-izlaz) | +| `session.prompt({ path, body })` | Send prompt message | `body.noReply: true` returns UserMessage (context only). Default returns AssistantMessage with AI response. Supports `body.format` for [structured output](#strukturirani-izlaz) | | `session.command({ path, body })` | Send command to session | Returns `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | Run a shell command | Returns AssistantMessage | | `session.revert({ path, body })` | Revert a message | Returns Session | diff --git a/packages/web/src/content/docs/da/sdk.mdx b/packages/web/src/content/docs/da/sdk.mdx index cde874d5a2..1ceb23cea4 100644 --- a/packages/web/src/content/docs/da/sdk.mdx +++ b/packages/web/src/content/docs/da/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ Hvis modellen ikke formår at producere gyldigt struktureret output efter alle f ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Oppsummer sessionen | Returnerer `boolean` | | `session.messages({ path })` | Liste meldinger i en session | Returnerer `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | Få meldingsdetaljer | Returnerer `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | Send melding | `body.noReply: true` returnerer UserMessage (kun kontekst). Standard returnerer AssistantMessage med AI svar. Understøtter `body.outputFormat` for [struktureret output](#struktureret-output) | +| `session.prompt({ path, body })` | Send melding | `body.noReply: true` returnerer UserMessage (kun kontekst). Standard returnerer AssistantMessage med AI svar. Understøtter `body.format` for [struktureret output](#struktureret-output) | | `session.command({ path, body })` | Send kommando til session | Returnerer `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | Kjør en shell-kommando | Returnerer AssistantMessage | | `session.revert({ path, body })` | Tilbakestill en melding | Returnerer Session | diff --git a/packages/web/src/content/docs/de/sdk.mdx b/packages/web/src/content/docs/de/sdk.mdx index 22e70071d6..52a22de212 100644 --- a/packages/web/src/content/docs/de/sdk.mdx +++ b/packages/web/src/content/docs/de/sdk.mdx @@ -150,7 +150,7 @@ const result = await client.session.prompt({ }) // Zugriff auf die strukturierte Ausgabe -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -177,8 +177,8 @@ Wenn das Modell nach allen Wiederholungen keine valide strukturierte Ausgabe lie ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Strukturierte Ausgabe fehlgeschlagen:", result.data.info.error.message) - console.error("Versuche:", result.data.info.error.retries) + console.error("Strukturierte Ausgabe fehlgeschlagen:", result.data.info.error.data.message) + console.error("Versuche:", result.data.info.error.data.retries) } ``` @@ -315,7 +315,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Fasst Session zusammen | Gibt `boolean` zurueck | | `session.messages({ path })` | Listet Nachrichten einer Session | Gibt `{ info: `Message`, parts: `Part[]`}[]` zurueck | | `session.message({ path })` | Ruft Nachrichtendetails ab | Gibt `{ info: `Message`, parts: `Part[]`}` zurueck | -| `session.prompt({ path, body })` | Sendet Prompt-Nachricht | `body.noReply: true` gibt UserMessage (nur Kontext) zurueck. Standard gibt AssistantMessage mit AI-Antwort zurueck. Unterstuetzt `body.outputFormat` fuer [strukturierte Ausgabe](#structured-output) | +| `session.prompt({ path, body })` | Sendet Prompt-Nachricht | `body.noReply: true` gibt UserMessage (nur Kontext) zurueck. Standard gibt AssistantMessage mit AI-Antwort zurueck. Unterstuetzt `body.format` fuer [strukturierte Ausgabe](#structured-output) | | `session.command({ path, body })` | Sendet Befehl an Session | Gibt `{ info: `AssistantMessage`, parts: `Part[]`}` zurueck | | `session.shell({ path, body })` | Fuehrt Shell-Befehl aus | Gibt AssistantMessage zurueck | | `session.revert({ path, body })` | Setzt Nachricht zurueck | Gibt Session zurueck | diff --git a/packages/web/src/content/docs/es/sdk.mdx b/packages/web/src/content/docs/es/sdk.mdx index d75149cde8..ac15ebe188 100644 --- a/packages/web/src/content/docs/es/sdk.mdx +++ b/packages/web/src/content/docs/es/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ Si el modelo no logra producir una salida estructurada válida después de todos ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Resumir sesión | Devuelve `boolean` | | `session.messages({ path })` | Listar mensajes en una sesión | Devuelve `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | Obtener detalles del mensaje | Devuelve `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | Enviar mensaje rápido | `body.noReply: true` devuelve UserMessage (solo contexto). El valor predeterminado devuelve AssistantMessage con respuesta de IA. Admite `body.outputFormat` para [salida estructurada](#salida-estructurada) | +| `session.prompt({ path, body })` | Enviar mensaje rápido | `body.noReply: true` devuelve UserMessage (solo contexto). El valor predeterminado devuelve AssistantMessage con respuesta de IA. Admite `body.format` para [salida estructurada](#salida-estructurada) | | `session.command({ path, body })` | Enviar comando a la sesión | Devuelve `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | Ejecute un comando de shell | Devuelve AssistantMessage | | `session.revert({ path, body })` | Revertir un mensaje | Devuelve Session | diff --git a/packages/web/src/content/docs/fr/sdk.mdx b/packages/web/src/content/docs/fr/sdk.mdx index ee3a2dc49c..4b8f528ed0 100644 --- a/packages/web/src/content/docs/fr/sdk.mdx +++ b/packages/web/src/content/docs/fr/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ Si le modèle ne parvient pas à produire une sortie structurée valide après t ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Résumer la séance | Renvoie `boolean` | | `session.messages({ path })` | Liste des messages dans une session | Renvoie `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | Obtenir les détails du message | Renvoie `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | Envoyer un message d'invite | `body.noReply: true` renvoie UserMessage (contexte uniquement). La valeur par défaut renvoie AssistantMessage avec réponse IA. Prend en charge `body.outputFormat` pour [sortie structurée](#structured-output) | +| `session.prompt({ path, body })` | Envoyer un message d'invite | `body.noReply: true` renvoie UserMessage (contexte uniquement). La valeur par défaut renvoie AssistantMessage avec réponse IA. Prend en charge `body.format` pour [sortie structurée](#structured-output) | | `session.command({ path, body })` | Envoyer la commande à la session | Renvoie `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | Exécuter une commande shell | Renvoie AssistantMessage | | `session.revert({ path, body })` | Rétablir un message | Renvoie Session | diff --git a/packages/web/src/content/docs/it/sdk.mdx b/packages/web/src/content/docs/it/sdk.mdx index 2941bfb24c..c3d23b88ac 100644 --- a/packages/web/src/content/docs/it/sdk.mdx +++ b/packages/web/src/content/docs/it/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ Se il modello non riesce a produrre un output strutturato valido dopo tutti i te ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Riassume la sessione | Returns `boolean` | | `session.messages({ path })` | Elenca i messaggi della sessione | Returns `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | Ottieni dettagli di un messaggio | Returns `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | Invia un prompt | `body.noReply: true` returns UserMessage (solo contesto). Di default ritorna AssistantMessage con risposta AI. Supporta `body.outputFormat` per [output strutturato](#output-strutturato) | +| `session.prompt({ path, body })` | Invia un prompt | `body.noReply: true` returns UserMessage (solo contesto). Di default ritorna AssistantMessage con risposta AI. Supporta `body.format` per [output strutturato](#output-strutturato) | | `session.command({ path, body })` | Invia un comando alla sessione | Returns `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | Esegue un comando shell | Returns AssistantMessage | | `session.revert({ path, body })` | Ripristina un messaggio | Returns Session | diff --git a/packages/web/src/content/docs/ja/sdk.mdx b/packages/web/src/content/docs/ja/sdk.mdx index 5afaeb4a13..be2d464b0d 100644 --- a/packages/web/src/content/docs/ja/sdk.mdx +++ b/packages/web/src/content/docs/ja/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ console.log(result.data.info.structured_output) ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | セッションを要約する | 戻り値 `boolean` | | `session.messages({ path })` | セッション内のメッセージをリストする | 戻り値 `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | メッセージの詳細を取得する | 戻り値 `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | プロンプトメッセージを送信する | `body.noReply: true` は UserMessage (コンテキストのみ) を返します。デフォルトでは、AI 応答を含む AssistantMessage を返します。[構造化出力](#構造化出力) のための `body.outputFormat` をサポートします。 | +| `session.prompt({ path, body })` | プロンプトメッセージを送信する | `body.noReply: true` は UserMessage (コンテキストのみ) を返します。デフォルトでは、AI 応答を含む AssistantMessage を返します。[構造化出力](#構造化出力) のための `body.format` をサポートします。 | | `session.command({ path, body })` | コマンドをセッションに送信 | 戻り値 `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | シェルコマンドを実行する | 戻り値 AssistantMessage | | `session.revert({ path, body })` | メッセージを元に戻す | 戻り値 Session | diff --git a/packages/web/src/content/docs/ko/sdk.mdx b/packages/web/src/content/docs/ko/sdk.mdx index a5d12d1ab0..d8d7fb7a3d 100644 --- a/packages/web/src/content/docs/ko/sdk.mdx +++ b/packages/web/src/content/docs/ko/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ console.log(result.data.info.structured_output) ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | 세션 요약 | 반품 `boolean` | | `session.messages({ path })` | 세션의 메시지 목록 | `{ info: `Message`, parts: `Part`}[]` | | `session.message({ path })` | 메시지 상세정보 | 반품 `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | prompt 메시지 보내기 | `body.noReply: true`는 UserMessage(컨텍스트 전용)를 반환합니다. 기본값은 AI 응답과 함께 AssistantMessage를 반환합니다. [구조화된 출력](#구조화된-출력)을 위한 `body.outputFormat`을 지원합니다 | +| `session.prompt({ path, body })` | prompt 메시지 보내기 | `body.noReply: true`는 UserMessage(컨텍스트 전용)를 반환합니다. 기본값은 AI 응답과 함께 AssistantMessage를 반환합니다. [구조화된 출력](#구조화된-출력)을 위한 `body.format`을 지원합니다 | | `session.command({ path, body })` | 세션으로 명령을 전송 | `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | shell 명령을 실행 | AssistantMessage | | `session.revert({ path, body })` | 메시지 다시 변환 | Session | diff --git a/packages/web/src/content/docs/nb/sdk.mdx b/packages/web/src/content/docs/nb/sdk.mdx index a947094476..c36c79dade 100644 --- a/packages/web/src/content/docs/nb/sdk.mdx +++ b/packages/web/src/content/docs/nb/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ Hvis modellen ikke klarer å produsere gyldig strukturert utdata etter alle fors ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Oppsummer økten | Returnerer `boolean` | | `session.messages({ path })` | List meldinger i en økt | Returnerer `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | Hent meldingsdetaljer | Returnerer `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | Send melding | `body.noReply: true` returnerer UserMessage (kun kontekst). Standard returnerer AssistantMessage med AI svar. Støtter `body.outputFormat` for [strukturert utdata](#strukturert-utdata) | +| `session.prompt({ path, body })` | Send melding | `body.noReply: true` returnerer UserMessage (kun kontekst). Standard returnerer AssistantMessage med AI svar. Støtter `body.format` for [strukturert utdata](#strukturert-utdata) | | `session.command({ path, body })` | Send kommando til økt | Returnerer `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | Kjør en shell-kommando | Returnerer AssistantMessage | | `session.revert({ path, body })` | Tilbakestill en melding | Returnerer Session | diff --git a/packages/web/src/content/docs/pl/sdk.mdx b/packages/web/src/content/docs/pl/sdk.mdx index 40099713ef..889d86d327 100644 --- a/packages/web/src/content/docs/pl/sdk.mdx +++ b/packages/web/src/content/docs/pl/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ Jeśli model nie wygeneruje prawidłowych ustrukturyzowanych danych wyjściowych ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` diff --git a/packages/web/src/content/docs/pt-br/sdk.mdx b/packages/web/src/content/docs/pt-br/sdk.mdx index 7fd765e4c1..0483074c82 100644 --- a/packages/web/src/content/docs/pt-br/sdk.mdx +++ b/packages/web/src/content/docs/pt-br/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Acessar a saída estruturada -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ Se o modelo falhar em produzir uma saída estruturada válida após todas as ten ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Resumir sessão | Retorna `boolean` | | `session.messages({ path })` | Listar mensagens em uma sessão | Retorna `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | Obter detalhes da mensagem | Retorna `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | Enviar mensagem de prompt | `body.noReply: true` retorna UserMessage (apenas contexto). O padrão retorna AssistantMessage com resposta da AI. Suporta `body.outputFormat` para [saída estruturada](#saída-estruturada) | +| `session.prompt({ path, body })` | Enviar mensagem de prompt | `body.noReply: true` retorna UserMessage (apenas contexto). O padrão retorna AssistantMessage com resposta da AI. Suporta `body.format` para [saída estruturada](#saída-estruturada) | | `session.command({ path, body })` | Enviar comando para a sessão | Retorna `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | Executar um comando shell | Retorna AssistantMessage | | `session.revert({ path, body })` | Reverter uma mensagem | Retorna Session | diff --git a/packages/web/src/content/docs/ru/sdk.mdx b/packages/web/src/content/docs/ru/sdk.mdx index 0afdea1b6f..d2e9b34be1 100644 --- a/packages/web/src/content/docs/ru/sdk.mdx +++ b/packages/web/src/content/docs/ru/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ console.log(result.data.info.structured_output) ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Summarize session | Returns `boolean` | | `session.messages({ path })` | List messages in a session | Returns `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | Get message details | Returns `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | Send prompt message | `body.noReply: true` возвращает UserMessage (только контекст). По умолчанию возвращает AssistantMessage с ответом ИИ. Поддерживает `body.outputFormat` для [структурированного вывода](#структурированный-вывод) | +| `session.prompt({ path, body })` | Send prompt message | `body.noReply: true` возвращает UserMessage (только контекст). По умолчанию возвращает AssistantMessage с ответом ИИ. Поддерживает `body.format` для [структурированного вывода](#структурированный-вывод) | | `session.command({ path, body })` | Send command to session | Returns `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | Run a shell command | Returns AssistantMessage | | `session.revert({ path, body })` | Revert a message | Returns Session | diff --git a/packages/web/src/content/docs/sdk.mdx b/packages/web/src/content/docs/sdk.mdx index 24546213be..5d132fb689 100644 --- a/packages/web/src/content/docs/sdk.mdx +++ b/packages/web/src/content/docs/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ If the model fails to produce valid structured output after all retries, the res ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Summarize session | Returns `boolean` | | `session.messages({ path })` | List messages in a session | Returns `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | Get message details | Returns `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | Send prompt message | `body.noReply: true` returns UserMessage (context only). Default returns AssistantMessage with AI response. Supports `body.outputFormat` for [structured output](#structured-output) | +| `session.prompt({ path, body })` | Send prompt message | `body.noReply: true` returns UserMessage (context only). Default returns AssistantMessage with AI response. Supports `body.format` for [structured output](#structured-output) | | `session.command({ path, body })` | Send command to session | Returns `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | Run a shell command | Returns AssistantMessage | | `session.revert({ path, body })` | Revert a message | Returns Session | diff --git a/packages/web/src/content/docs/th/sdk.mdx b/packages/web/src/content/docs/th/sdk.mdx index 3454b57667..d0eab55a47 100644 --- a/packages/web/src/content/docs/th/sdk.mdx +++ b/packages/web/src/content/docs/th/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ console.log(result.data.info.structured_output) ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | สรุปเซสชัน | ส่งคืน `boolean` | | `session.messages({ path })` | แสดงรายการข้อความในเซสชัน | ส่งคืน `{ info: `ข้อความ`, parts: `ส่วน[]`}[]` | | `session.message({ path })` | รับรายละเอียดข้อความ | ส่งคืน `{ info: `ข้อความ`, parts: `ส่วน[]`}` | -| `session.prompt({ path, body })` | ส่งข้อความแจ้ง | `body.noReply: true` ส่งคืน UserMessage (บริบทเท่านั้น) ค่าเริ่มต้นส่งคืน AssistantMessage พร้อมการตอบสนองของ AI รองรับ `body.outputFormat` สำหรับ [ผลลัพธ์แบบมีโครงสร้าง](#ผลลัพธ์แบบมีโครงสร้าง) | +| `session.prompt({ path, body })` | ส่งข้อความแจ้ง | `body.noReply: true` ส่งคืน UserMessage (บริบทเท่านั้น) ค่าเริ่มต้นส่งคืน AssistantMessage พร้อมการตอบสนองของ AI รองรับ `body.format` สำหรับ [ผลลัพธ์แบบมีโครงสร้าง](#ผลลัพธ์แบบมีโครงสร้าง) | | `session.command({ path, body })` | ส่งคำสั่งไปยังเซสชั่น | ส่งคืน `{ info: `AssistantMessage`, parts: `ส่วน[]`}` | | `session.shell({ path, body })` | รันคำสั่ง shell | ส่งคืน AssistantMessage | | `session.revert({ path, body })` | คืนค่าข้อความ | ส่งคืน เซสชัน | diff --git a/packages/web/src/content/docs/tr/sdk.mdx b/packages/web/src/content/docs/tr/sdk.mdx index 44c910b1cb..7abb09872e 100644 --- a/packages/web/src/content/docs/tr/sdk.mdx +++ b/packages/web/src/content/docs/tr/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Yapılandırılmış çıktıya erişin -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ Model, tüm yeniden denemelerden sonra geçerli bir yapılandırılmış çıkt ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Yapılandırılmış çıktı üretilemedi:", result.data.info.error.message) - console.error("Denemeler:", result.data.info.error.retries) + console.error("Yapılandırılmış çıktı üretilemedi:", result.data.info.error.data.message) + console.error("Denemeler:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | Oturumu özetle | `boolean` döndürür | | `session.messages({ path })` | Oturumdaki mesajları listele | `{ info: `Message`, parts: `Part[]`}[]` döndürür | | `session.message({ path })` | Mesaj ayrıntılarını al | `{ info: `Message`, parts: `Part[]`}` döndürür | -| `session.prompt({ path, body })` | İstem mesajı gönder | `body.noReply: true` UserMessage (yalnızca bağlam) döndürür. Varsayılan olarak AI yanıtıyla AssistantMessage döndürür. [yapılandırılmış çıktı](#yapılandırılmış-çıktı) için `body.outputFormat` destekler | +| `session.prompt({ path, body })` | İstem mesajı gönder | `body.noReply: true` UserMessage (yalnızca bağlam) döndürür. Varsayılan olarak AI yanıtıyla AssistantMessage döndürür. [yapılandırılmış çıktı](#yapılandırılmış-çıktı) için `body.format` destekler | | `session.command({ path, body })` | Oturuma komut gönder | `{ info: `AssistantMessage`, parts: `Part[]`}` döndürür | | `session.shell({ path, body })` | Bir kabuk komutu çalıştır | AssistantMessage döndürür | | `session.revert({ path, body })` | Bir mesajı geri al | Session döndürür | diff --git a/packages/web/src/content/docs/zh-cn/sdk.mdx b/packages/web/src/content/docs/zh-cn/sdk.mdx index 121e423d10..cee505dfad 100644 --- a/packages/web/src/content/docs/zh-cn/sdk.mdx +++ b/packages/web/src/content/docs/zh-cn/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ console.log(result.data.info.structured_output) ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | 总结会话 | 返回 `boolean` | | `session.messages({ path })` | 列出会话中的消息 | 返回 `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | 获取消息详情 | 返回 `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | 发送提示词消息 | `body.noReply: true` 返回 UserMessage(仅注入上下文)。默认返回带有 AI 响应的 AssistantMessage。支持通过 `body.outputFormat` 使用[结构化输出](#结构化输出) | +| `session.prompt({ path, body })` | 发送提示词消息 | `body.noReply: true` 返回 UserMessage(仅注入上下文)。默认返回带有 AI 响应的 AssistantMessage。支持通过 `body.format` 使用[结构化输出](#结构化输出) | | `session.command({ path, body })` | 向会话发送命令 | 返回 `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | 执行 shell 命令 | 返回 AssistantMessage | | `session.revert({ path, body })` | 撤回消息 | 返回 Session | diff --git a/packages/web/src/content/docs/zh-tw/sdk.mdx b/packages/web/src/content/docs/zh-tw/sdk.mdx index 2ed216d8b9..9c2654d99c 100644 --- a/packages/web/src/content/docs/zh-tw/sdk.mdx +++ b/packages/web/src/content/docs/zh-tw/sdk.mdx @@ -148,7 +148,7 @@ const result = await client.session.prompt({ }) // Access the structured output -console.log(result.data.info.structured_output) +console.log(result.data.info.structured) // { company: "Anthropic", founded: 2021, products: ["Claude", "Claude API"] } ``` @@ -175,8 +175,8 @@ console.log(result.data.info.structured_output) ```typescript if (result.data.info.error?.name === "StructuredOutputError") { - console.error("Failed to produce structured output:", result.data.info.error.message) - console.error("Attempts:", result.data.info.error.retries) + console.error("Failed to produce structured output:", result.data.info.error.data.message) + console.error("Attempts:", result.data.info.error.data.retries) } ``` @@ -313,7 +313,7 @@ const { providers, default: defaults } = await client.config.providers() | `session.summarize({ path, body })` | 摘要工作階段 | 回傳 `boolean` | | `session.messages({ path })` | 列出工作階段中的訊息 | 回傳 `{ info: `Message`, parts: `Part[]`}[]` | | `session.message({ path })` | 取得訊息詳情 | 回傳 `{ info: `Message`, parts: `Part[]`}` | -| `session.prompt({ path, body })` | 傳送提示訊息 | `body.noReply: true` 回傳 UserMessage(僅注入上下文)。預設回傳帶有 AI 回應的 AssistantMessage。支援透過 `body.outputFormat` 使用[結構化輸出](#結構化輸出) | +| `session.prompt({ path, body })` | 傳送提示訊息 | `body.noReply: true` 回傳 UserMessage(僅注入上下文)。預設回傳帶有 AI 回應的 AssistantMessage。支援透過 `body.format` 使用[結構化輸出](#結構化輸出) | | `session.command({ path, body })` | 向工作階段傳送指令 | 回傳 `{ info: `AssistantMessage`, parts: `Part[]`}` | | `session.shell({ path, body })` | 執行 shell 指令 | 回傳 AssistantMessage | | `session.revert({ path, body })` | 還原訊息 | 回傳 Session |