pull/5216/head
Dax Raad 2025-12-07 18:58:10 -05:00
parent 9672a7b056
commit 11840191f8
14 changed files with 601 additions and 779 deletions

View File

@ -1045,7 +1045,7 @@ function UserMessage(props: {
</box>
</Show>
<text fg={theme.textMuted}>
{ctx.usernameVisible() ? `${sync.data.config.username ?? "You"}` : "You"}
{ctx.usernameVisible() ? `${sync.data.config.username ?? "You "}` : "You "}
<Show
when={queued()}
fallback={

View File

@ -12,31 +12,6 @@ await $`bun dev generate > ${dir}/openapi.json`.cwd(path.resolve(dir, "../../ope
await $`rm -rf src/gen`
await createClient({
input: "./openapi.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",
output: {

View File

@ -1,7 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts
import { type ClientOptions, type Config, createClient, createConfig } from "./client/index.js"
import type { ClientOptions as ClientOptions2 } from "./types.gen.js"
import type { ClientOptions } from "./types.gen.js"
import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from "./client/index.js"
/**
* The `createClientConfig()` function will be called on client initialization
@ -11,8 +11,12 @@ import type { ClientOptions as ClientOptions2 } from "./types.gen.js"
* `setConfig()`. This is useful for example if you're using Next.js
* to ensure your client always has the correct values.
*/
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (
override?: Config<ClientOptions & T>,
) => Config<Required<ClientOptions> & T>
export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (
override?: Config<DefaultClientOptions & T>,
) => Config<Required<DefaultClientOptions> & T>
export const client = createClient(createConfig<ClientOptions2>({ baseUrl: "http://localhost:4096" }))
export const client = createClient(
createConfig<ClientOptions>({
baseUrl: "http://localhost:4096",
}),
)

View File

@ -1,8 +1,6 @@
// 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,
@ -51,12 +49,12 @@ export const createClient = (config: Config = {}): Client => {
await opts.requestValidator(opts)
}
if (opts.body !== undefined && opts.bodySerializer) {
if (opts.body && opts.bodySerializer) {
opts.serializedBody = opts.bodySerializer(opts.body)
}
// remove Content-Type header if body is empty to avoid sending invalid requests
if (opts.body === undefined || opts.serializedBody === "") {
if (opts.serializedBody === undefined || opts.serializedBody === "") {
opts.headers.delete("Content-Type")
}
@ -71,12 +69,12 @@ export const createClient = (config: Config = {}): Client => {
const requestInit: ReqInit = {
redirect: "follow",
...opts,
body: getValidRequestBody(opts),
body: opts.serializedBody,
}
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)
}
@ -85,37 +83,9 @@ 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: Response
let response = await _fetch(request)
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) {
for (const fn of interceptors.response._fns) {
if (fn) {
response = await fn(response, request, opts)
}
@ -127,36 +97,18 @@ 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: emptyData,
data: {},
...result,
}
}
const parseAs =
(opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json"
let data: any
switch (parseAs) {
case "arrayBuffer":
@ -205,7 +157,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
}
@ -226,53 +178,35 @@ export const createClient = (config: Config = {}): Client => {
}
}
const makeMethodFn = (method: Uppercase<HttpMethod>) => (options: RequestOptions) => request({ ...options, method })
const makeSseFn = (method: Uppercase<HttpMethod>) => 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<string, string>,
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
},
url,
})
const makeMethod = (method: Required<Config>["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<string, string>,
method,
url,
})
}
return fn
}
return {
buildUrl,
connect: makeMethodFn("CONNECT"),
delete: makeMethodFn("DELETE"),
get: makeMethodFn("GET"),
connect: makeMethod("CONNECT"),
delete: makeMethod("DELETE"),
get: makeMethod("GET"),
getConfig,
head: makeMethodFn("HEAD"),
head: makeMethod("HEAD"),
interceptors,
options: makeMethodFn("OPTIONS"),
patch: makeMethodFn("PATCH"),
post: makeMethodFn("POST"),
put: makeMethodFn("PUT"),
options: makeMethod("OPTIONS"),
patch: makeMethod("PATCH"),
post: makeMethod("POST"),
put: makeMethod("PUT"),
request,
setConfig,
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"),
trace: makeMethod("TRACE"),
} as Client
}

View File

@ -8,7 +8,6 @@ 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,
@ -16,6 +15,7 @@ export type {
Config,
CreateClientConfig,
Options,
OptionsLegacyParser,
RequestOptions,
RequestResult,
ResolvedRequestOptions,

View File

@ -20,7 +20,7 @@ export interface Config<T extends ClientOptions = ClientOptions>
*
* @default globalThis.fetch
*/
fetch?: typeof fetch
fetch?: (request: Request) => ReturnType<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 MethodFn = <
type MethodFnBase = <
TData = unknown,
TError = unknown,
ThrowOnError extends boolean = false,
@ -137,7 +137,7 @@ type MethodFn = <
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">,
) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>
type SseFn = <
type MethodFnServerSentEvents = <
TData = unknown,
TError = unknown,
ThrowOnError extends boolean = false,
@ -146,6 +146,10 @@ type SseFn = <
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">,
) => Promise<ServerSentEventsResult<TData, TError>>
type MethodFn = MethodFnBase & {
sse: MethodFnServerSentEvents
}
type RequestFn = <
TData = unknown,
TError = unknown,
@ -164,10 +168,10 @@ type BuildUrlFn = <
url: string
},
>(
options: TData & Options<TData>,
options: Pick<TData, "url"> & Options<TData>,
) => string
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn> & {
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>
}
@ -199,4 +203,20 @@ export type Options<
TResponse = unknown,
TResponseStyle extends ResponseStyle = "fields",
> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, "body" | "path" | "query" | "url"> &
([TData] extends [never] ? unknown : Omit<TData, "url">)
Omit<TData, "url">
export type OptionsLegacyParser<
TData = unknown,
ThrowOnError extends boolean = boolean,
TResponseStyle extends ResponseStyle = "fields",
> = TData extends { body?: any }
? TData extends { headers?: any }
? OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body" | "headers" | "url"> & TData
: OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body" | "url"> &
TData &
Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "headers">
: TData extends { headers?: any }
? OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "headers" | "url"> &
TData &
Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body">
: OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "url"> & TData

View File

@ -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 = <T = unknown>({ parameters = {}, ...args }: QuerySerializerOptions = {}) => {
export const createQuerySerializer = <T = unknown>({ allowReserved, array, object }: QuerySerializerOptions = {}) => {
const querySerializer = (queryParams: T) => {
const search: string[] = []
if (queryParams && typeof queryParams === "object") {
@ -18,31 +18,29 @@ export const createQuerySerializer = <T = unknown>({ parameters = {}, ...args }:
continue
}
const options = parameters[name] || args
if (Array.isArray(value)) {
const serializedArray = serializeArrayParam({
allowReserved: options.allowReserved,
allowReserved,
explode: true,
name,
style: "form",
value,
...options.array,
...array,
})
if (serializedArray) search.push(serializedArray)
} else if (typeof value === "object") {
const serializedObject = serializeObjectParam({
allowReserved: options.allowReserved,
allowReserved,
explode: true,
name,
style: "deepObject",
value: value as Record<string, unknown>,
...options.object,
...object,
})
if (serializedObject) search.push(serializedObject)
} else {
const serializedPrimitive = serializePrimitiveParam({
allowReserved: options.allowReserved,
allowReserved,
name,
value: value as string,
})
@ -164,22 +162,14 @@ 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<Required<Config>["headers"] | undefined>): Headers => {
const mergedHeaders = new Headers()
for (const header of headers) {
if (!header) {
if (!header || typeof header !== "object") {
continue
}
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header)
const iterator = header instanceof Headers ? header.entries() : Object.entries(header)
for (const [key, value] of iterator) {
if (value === null) {
@ -210,53 +200,61 @@ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Pr
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>
class Interceptors<Interceptor> {
fns: Array<Interceptor | null> = []
_fns: (Interceptor | null)[]
clear(): void {
this.fns = []
constructor() {
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])
clear() {
this._fns = []
}
getInterceptorIndex(id: number | Interceptor): number {
if (typeof id === "number") {
return this.fns[id] ? id : -1
return this._fns[id] ? id : -1
} else {
return this._fns.indexOf(id)
}
return this.fns.indexOf(id)
}
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false {
exists(id: number | Interceptor) {
const index = this.getInterceptorIndex(id)
if (this.fns[index]) {
this.fns[index] = fn
return id
return !!this._fns[index]
}
eject(id: number | Interceptor) {
const index = this.getInterceptorIndex(id)
if (this._fns[index]) {
this._fns[index] = null
}
return false
}
use(fn: Interceptor): number {
this.fns.push(fn)
return this.fns.length - 1
update(id: number | Interceptor, fn: Interceptor) {
const index = this.getInterceptorIndex(id)
if (this._fns[index]) {
this._fns[index] = fn
return id
} else {
return false
}
}
use(fn: Interceptor) {
this._fns = [...this._fns, fn]
return this._fns.length - 1
}
}
// `createInterceptors()` response, meant for external use as it does not
// expose internals
export interface Middleware<Req, Res, Err, Options> {
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>
request: Interceptors<ReqInterceptor<Req, Options>>
response: Interceptors<ResInterceptor<Res, Req, Options>>
error: Pick<Interceptors<ErrInterceptor<Err, Res, Req, Options>>, "eject" | "use">
request: Pick<Interceptors<ReqInterceptor<Req, Options>>, "eject" | "use">
response: Pick<Interceptors<ResInterceptor<Res, Req, Options>>, "eject" | "use">
}
export const createInterceptors = <Req, Res, Err, Options>(): Middleware<Req, Res, Err, Options> => ({
// do not add `Middleware` as return type so we can use _fns internally
export const createInterceptors = <Req, Res, Err, Options>() => ({
error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),
request: new Interceptors<ReqInterceptor<Req, Options>>(),
response: new Interceptors<ResInterceptor<Res, Req, Options>>(),

View File

@ -6,18 +6,10 @@ export type QuerySerializer = (query: Record<string, unknown>) => string
export type BodySerializer = (body: any) => any
type QuerySerializerOptionsObject = {
export interface QuerySerializerOptions {
allowReserved?: boolean
array?: Partial<SerializerOptions<ArrayStyle>>
object?: Partial<SerializerOptions<ObjectStyle>>
}
export type QuerySerializerOptions = QuerySerializerOptionsObject & {
/**
* Per-parameter serialization overrides. When provided, these settings
* override the global array/object settings for specific parameter names.
*/
parameters?: Record<string, QuerySerializerOptionsObject>
array?: SerializerOptions<ArrayStyle>
object?: SerializerOptions<ObjectStyle>
}
const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => {

View File

@ -23,17 +23,6 @@ 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<Record<Slot, boolean>>
@ -52,14 +41,10 @@ const extraPrefixes = Object.entries(extraPrefixesMap)
type KeyMap = Map<
string,
| {
in: Slot
map?: string
}
| {
in?: never
map: Slot
}
{
in: Slot
map?: string
}
>
const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
@ -75,10 +60,6 @@ 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)
}
@ -127,9 +108,7 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
if (config.key) {
const field = map.get(config.key)!
const name = field.map || config.key
if (field.in) {
;(params[field.in] as Record<string, unknown>)[name] = arg
}
;(params[field.in] as Record<string, unknown>)[name] = arg
} else {
params.body = arg
}
@ -138,20 +117,16 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
const field = map.get(key)
if (field) {
if (field.in) {
const name = field.map || key
;(params[field.in] as Record<string, unknown>)[name] = value
} else {
params[field.map] = value
}
const name = field.map || key
;(params[field.in] as Record<string, unknown>)[name] = value
} else {
const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix))
if (extra) {
const [prefix, slot] = extra
;(params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value
} else if ("allowExtra" in config && config.allowExtra) {
for (const [slot, allowed] of Object.entries(config.allowExtra)) {
} else {
for (const [slot, allowed] of Object.entries(config.allowExtra ?? {})) {
if (allowed) {
;(params[slot as Slot] as Record<string, unknown>)[key] = value
break

View File

@ -4,17 +4,6 @@ import type { Config } from "./types.gen.js"
export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, "method"> &
Pick<Config, "method" | "responseTransformer" | "responseValidator"> & {
/**
* 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<Request>
/**
* Callback invoked when a network or parsing error occurs during streaming.
*
@ -32,7 +21,6 @@ export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, "method
* @returns Nothing (void).
*/
onSseEvent?: (event: StreamEvent<TData>) => void
serializedBody?: RequestInit["body"]
/**
* Default retry delay in milliseconds.
*
@ -76,7 +64,6 @@ export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unkn
}
export const createSseClient = <TData = unknown>({
onRequest,
onSseError,
onSseEvent,
responseTransformer,
@ -112,21 +99,7 @@ export const createSseClient = <TData = unknown>({
}
try {
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)
const response = await fetch(url, { ...options, headers, signal })
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`)

View File

@ -3,19 +3,24 @@
import type { Auth, AuthToken } from "./auth.gen.js"
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.gen.js"
export type HttpMethod = "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace"
export type Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
export interface Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never> {
/**
* 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
} & {
[K in HttpMethod]: MethodFn
} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } })
trace: MethodFn
}
export interface Config {
/**
@ -42,7 +47,7 @@ export interface Config {
*
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
*/
method?: Uppercase<HttpMethod>
method?: "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE"
/**
* A function for serializing request query parameters. By default, arrays
* will be exploded in form style, objects will be exploded in deepObject

View File

@ -1,6 +1,6 @@
// This file is auto-generated by @hey-api/openapi-ts
import type { BodySerializer, QuerySerializer } from "./bodySerializer.gen.js"
import type { QuerySerializer } from "./bodySerializer.gen.js"
import {
type ArraySeparatorStyle,
serializeArrayParam,
@ -107,31 +107,3 @@ 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
}

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,5 @@
// This file is auto-generated by @hey-api/openapi-ts
export type ClientOptions = {
baseUrl: `${string}://${string}` | (string & {})
}
export type EventServerInstanceDisposed = {
type: "server.instance.disposed"
properties: {
@ -626,20 +622,22 @@ 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"
| (
| "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
}
}
@ -979,9 +977,7 @@ export type AgentConfig = {
permission?: {
edit?: "ask" | "allow" | "deny"
bash?:
| "ask"
| "allow"
| "deny"
| ("ask" | "allow" | "deny")
| {
[key: string]: "ask" | "allow" | "deny"
}
@ -997,17 +993,12 @@ export type AgentConfig = {
[key: string]: boolean
}
| boolean
| "subagent"
| "primary"
| "all"
| string
| ("subagent" | "primary" | "all")
| number
| {
edit?: "ask" | "allow" | "deny"
bash?:
| "ask"
| "allow"
| "deny"
| ("ask" | "allow" | "deny")
| {
[key: string]: "ask" | "allow" | "deny"
}
@ -1083,7 +1074,7 @@ export type ProviderConfig = {
* 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
[key: string]: unknown | string | boolean | (number | false) | undefined
}
}
@ -1311,9 +1302,7 @@ export type Config = {
permission?: {
edit?: "ask" | "allow" | "deny"
bash?:
| "ask"
| "allow"
| "deny"
| ("ask" | "allow" | "deny")
| {
[key: string]: "ask" | "allow" | "deny"
}
@ -1771,12 +1760,12 @@ export type PtyCreateResponse = PtyCreateResponses[keyof PtyCreateResponses]
export type PtyRemoveData = {
body?: never
path: {
ptyID: string
id: string
}
query?: {
directory?: string
}
url: "/pty/{ptyID}"
url: "/pty/{id}"
}
export type PtyRemoveErrors = {
@ -1800,12 +1789,12 @@ export type PtyRemoveResponse = PtyRemoveResponses[keyof PtyRemoveResponses]
export type PtyGetData = {
body?: never
path: {
ptyID: string
id: string
}
query?: {
directory?: string
}
url: "/pty/{ptyID}"
url: "/pty/{id}"
}
export type PtyGetErrors = {
@ -1835,12 +1824,12 @@ export type PtyUpdateData = {
}
}
path: {
ptyID: string
id: string
}
query?: {
directory?: string
}
url: "/pty/{ptyID}"
url: "/pty/{id}"
}
export type PtyUpdateErrors = {
@ -1864,12 +1853,12 @@ export type PtyUpdateResponse = PtyUpdateResponses[keyof PtyUpdateResponses]
export type PtyConnectData = {
body?: never
path: {
ptyID: string
id: string
}
query?: {
directory?: string
}
url: "/pty/{ptyID}/connect"
url: "/pty/{id}/connect"
}
export type PtyConnectErrors = {
@ -2125,12 +2114,12 @@ export type SessionStatusResponse = SessionStatusResponses[keyof SessionStatusRe
export type SessionDeleteData = {
body?: never
path: {
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}"
url: "/session/{id}"
}
export type SessionDeleteErrors = {
@ -2158,12 +2147,12 @@ export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteRe
export type SessionGetData = {
body?: never
path: {
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}"
url: "/session/{id}"
}
export type SessionGetErrors = {
@ -2193,12 +2182,12 @@ export type SessionUpdateData = {
title?: string
}
path: {
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}"
url: "/session/{id}"
}
export type SessionUpdateErrors = {
@ -2226,12 +2215,12 @@ export type SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateRe
export type SessionChildrenData = {
body?: never
path: {
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/children"
url: "/session/{id}/children"
}
export type SessionChildrenErrors = {
@ -2262,12 +2251,12 @@ export type SessionTodoData = {
/**
* Session ID
*/
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/todo"
url: "/session/{id}/todo"
}
export type SessionTodoErrors = {
@ -2302,12 +2291,12 @@ export type SessionInitData = {
/**
* Session ID
*/
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/init"
url: "/session/{id}/init"
}
export type SessionInitErrors = {
@ -2337,12 +2326,12 @@ export type SessionForkData = {
messageID?: string
}
path: {
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/fork"
url: "/session/{id}/fork"
}
export type SessionForkResponses = {
@ -2357,12 +2346,12 @@ export type SessionForkResponse = SessionForkResponses[keyof SessionForkResponse
export type SessionAbortData = {
body?: never
path: {
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/abort"
url: "/session/{id}/abort"
}
export type SessionAbortErrors = {
@ -2390,12 +2379,12 @@ export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortRespo
export type SessionUnshareData = {
body?: never
path: {
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/share"
url: "/session/{id}/share"
}
export type SessionUnshareErrors = {
@ -2423,12 +2412,12 @@ export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshar
export type SessionShareData = {
body?: never
path: {
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/share"
url: "/session/{id}/share"
}
export type SessionShareErrors = {
@ -2459,13 +2448,13 @@ export type SessionDiffData = {
/**
* Session ID
*/
sessionID: string
id: string
}
query?: {
directory?: string
messageID?: string
}
url: "/session/{sessionID}/diff"
url: "/session/{id}/diff"
}
export type SessionDiffErrors = {
@ -2499,12 +2488,12 @@ export type SessionSummarizeData = {
/**
* Session ID
*/
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/summarize"
url: "/session/{id}/summarize"
}
export type SessionSummarizeErrors = {
@ -2535,13 +2524,13 @@ export type SessionMessagesData = {
/**
* Session ID
*/
sessionID: string
id: string
}
query?: {
directory?: string
limit?: number
}
url: "/session/{sessionID}/message"
url: "/session/{id}/message"
}
export type SessionMessagesErrors = {
@ -2588,12 +2577,12 @@ export type SessionPromptData = {
/**
* Session ID
*/
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/message"
url: "/session/{id}/message"
}
export type SessionPromptErrors = {
@ -2627,7 +2616,7 @@ export type SessionMessageData = {
/**
* Session ID
*/
sessionID: string
id: string
/**
* Message ID
*/
@ -2636,7 +2625,7 @@ export type SessionMessageData = {
query?: {
directory?: string
}
url: "/session/{sessionID}/message/{messageID}"
url: "/session/{id}/message/{messageID}"
}
export type SessionMessageErrors = {
@ -2683,12 +2672,12 @@ export type SessionPromptAsyncData = {
/**
* Session ID
*/
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/prompt_async"
url: "/session/{id}/prompt_async"
}
export type SessionPromptAsyncErrors = {
@ -2725,12 +2714,12 @@ export type SessionCommandData = {
/**
* Session ID
*/
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/command"
url: "/session/{id}/command"
}
export type SessionCommandErrors = {
@ -2771,12 +2760,12 @@ export type SessionShellData = {
/**
* Session ID
*/
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/shell"
url: "/session/{id}/shell"
}
export type SessionShellErrors = {
@ -2807,12 +2796,12 @@ export type SessionRevertData = {
partID?: string
}
path: {
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/revert"
url: "/session/{id}/revert"
}
export type SessionRevertErrors = {
@ -2840,12 +2829,12 @@ export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertRe
export type SessionUnrevertData = {
body?: never
path: {
sessionID: string
id: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/unrevert"
url: "/session/{id}/unrevert"
}
export type SessionUnrevertErrors = {
@ -2870,21 +2859,21 @@ export type SessionUnrevertResponses = {
export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]
export type PermissionRespondData = {
export type PostSessionIdPermissionsPermissionIdData = {
body?: {
response: "once" | "always" | "reject"
}
path: {
sessionID: string
id: string
permissionID: string
}
query?: {
directory?: string
}
url: "/session/{sessionID}/permissions/{permissionID}"
url: "/session/{id}/permissions/{permissionID}"
}
export type PermissionRespondErrors = {
export type PostSessionIdPermissionsPermissionIdErrors = {
/**
* Bad request
*/
@ -2895,16 +2884,18 @@ export type PermissionRespondErrors = {
404: NotFoundError
}
export type PermissionRespondError = PermissionRespondErrors[keyof PermissionRespondErrors]
export type PostSessionIdPermissionsPermissionIdError =
PostSessionIdPermissionsPermissionIdErrors[keyof PostSessionIdPermissionsPermissionIdErrors]
export type PermissionRespondResponses = {
export type PostSessionIdPermissionsPermissionIdResponses = {
/**
* Permission processed successfully
*/
200: boolean
}
export type PermissionRespondResponse = PermissionRespondResponses[keyof PermissionRespondResponses]
export type PostSessionIdPermissionsPermissionIdResponse =
PostSessionIdPermissionsPermissionIdResponses[keyof PostSessionIdPermissionsPermissionIdResponses]
export type CommandListData = {
body?: never
@ -3050,12 +3041,12 @@ export type ProviderOauthAuthorizeData = {
/**
* Provider ID
*/
providerID: string
id: string
}
query?: {
directory?: string
}
url: "/provider/{providerID}/oauth/authorize"
url: "/provider/{id}/oauth/authorize"
}
export type ProviderOauthAuthorizeErrors = {
@ -3091,12 +3082,12 @@ export type ProviderOauthCallbackData = {
/**
* Provider ID
*/
providerID: string
id: string
}
query?: {
directory?: string
}
url: "/provider/{providerID}/oauth/callback"
url: "/provider/{id}/oauth/callback"
}
export type ProviderOauthCallbackErrors = {
@ -3800,12 +3791,12 @@ export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiCo
export type AuthSetData = {
body?: Auth
path: {
providerID: string
id: string
}
query?: {
directory?: string
}
url: "/auth/{providerID}"
url: "/auth/{id}"
}
export type AuthSetErrors = {
@ -3843,3 +3834,7 @@ export type EventSubscribeResponses = {
}
export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]
export type ClientOptions = {
baseUrl: `${string}://${string}` | (string & {})
}