|
|
@@ -0,0 +1,2343 @@
|
|
|
+// This file is auto-generated by @hey-api/openapi-ts
|
|
|
+
|
|
|
+import { client } from "./client.gen.js"
|
|
|
+import { buildClientParams, type Client, type Options as Options2, type TDataShape } from "./client/index.js"
|
|
|
+import type {
|
|
|
+ AgentPartInput,
|
|
|
+ AppAgentsResponses,
|
|
|
+ AppLogErrors,
|
|
|
+ AppLogResponses,
|
|
|
+ Auth as Auth2,
|
|
|
+ AuthSetErrors,
|
|
|
+ AuthSetResponses,
|
|
|
+ CommandListResponses,
|
|
|
+ Config as Config2,
|
|
|
+ ConfigGetResponses,
|
|
|
+ ConfigProvidersResponses,
|
|
|
+ ConfigUpdateErrors,
|
|
|
+ ConfigUpdateResponses,
|
|
|
+ EventSubscribeResponses,
|
|
|
+ EventTuiCommandExecute,
|
|
|
+ EventTuiPromptAppend,
|
|
|
+ EventTuiToastShow,
|
|
|
+ FileListResponses,
|
|
|
+ FilePartInput,
|
|
|
+ FileReadResponses,
|
|
|
+ FileStatusResponses,
|
|
|
+ FindFilesResponses,
|
|
|
+ FindSymbolsResponses,
|
|
|
+ FindTextResponses,
|
|
|
+ FormatterStatusResponses,
|
|
|
+ GlobalEventResponses,
|
|
|
+ InstanceDisposeResponses,
|
|
|
+ LspStatusResponses,
|
|
|
+ McpAddErrors,
|
|
|
+ McpAddResponses,
|
|
|
+ McpAuthAuthenticateErrors,
|
|
|
+ McpAuthAuthenticateResponses,
|
|
|
+ McpAuthCallbackErrors,
|
|
|
+ McpAuthCallbackResponses,
|
|
|
+ McpAuthRemoveErrors,
|
|
|
+ McpAuthRemoveResponses,
|
|
|
+ McpAuthStartErrors,
|
|
|
+ McpAuthStartResponses,
|
|
|
+ McpLocalConfig,
|
|
|
+ McpRemoteConfig,
|
|
|
+ McpStatusResponses,
|
|
|
+ PathGetResponses,
|
|
|
+ PermissionRespondErrors,
|
|
|
+ PermissionRespondResponses,
|
|
|
+ ProjectCurrentResponses,
|
|
|
+ ProjectListResponses,
|
|
|
+ ProviderAuthResponses,
|
|
|
+ ProviderListResponses,
|
|
|
+ ProviderOauthAuthorizeErrors,
|
|
|
+ ProviderOauthAuthorizeResponses,
|
|
|
+ ProviderOauthCallbackErrors,
|
|
|
+ ProviderOauthCallbackResponses,
|
|
|
+ PtyConnectErrors,
|
|
|
+ PtyConnectResponses,
|
|
|
+ PtyCreateErrors,
|
|
|
+ PtyCreateResponses,
|
|
|
+ PtyGetErrors,
|
|
|
+ PtyGetResponses,
|
|
|
+ PtyListResponses,
|
|
|
+ PtyRemoveErrors,
|
|
|
+ PtyRemoveResponses,
|
|
|
+ PtyUpdateErrors,
|
|
|
+ PtyUpdateResponses,
|
|
|
+ SessionAbortErrors,
|
|
|
+ SessionAbortResponses,
|
|
|
+ SessionChildrenErrors,
|
|
|
+ SessionChildrenResponses,
|
|
|
+ SessionCommandErrors,
|
|
|
+ SessionCommandResponses,
|
|
|
+ SessionCreateErrors,
|
|
|
+ SessionCreateResponses,
|
|
|
+ SessionDeleteErrors,
|
|
|
+ SessionDeleteResponses,
|
|
|
+ SessionDiffErrors,
|
|
|
+ SessionDiffResponses,
|
|
|
+ SessionForkResponses,
|
|
|
+ SessionGetErrors,
|
|
|
+ SessionGetResponses,
|
|
|
+ SessionInitErrors,
|
|
|
+ SessionInitResponses,
|
|
|
+ SessionListResponses,
|
|
|
+ SessionMessageErrors,
|
|
|
+ SessionMessageResponses,
|
|
|
+ SessionMessagesErrors,
|
|
|
+ SessionMessagesResponses,
|
|
|
+ SessionPromptAsyncErrors,
|
|
|
+ SessionPromptAsyncResponses,
|
|
|
+ SessionPromptErrors,
|
|
|
+ SessionPromptResponses,
|
|
|
+ SessionRevertErrors,
|
|
|
+ SessionRevertResponses,
|
|
|
+ SessionShareErrors,
|
|
|
+ SessionShareResponses,
|
|
|
+ SessionShellErrors,
|
|
|
+ SessionShellResponses,
|
|
|
+ SessionStatusErrors,
|
|
|
+ SessionStatusResponses,
|
|
|
+ SessionSummarizeErrors,
|
|
|
+ SessionSummarizeResponses,
|
|
|
+ SessionTodoErrors,
|
|
|
+ SessionTodoResponses,
|
|
|
+ SessionUnrevertErrors,
|
|
|
+ SessionUnrevertResponses,
|
|
|
+ SessionUnshareErrors,
|
|
|
+ SessionUnshareResponses,
|
|
|
+ SessionUpdateErrors,
|
|
|
+ SessionUpdateResponses,
|
|
|
+ SubtaskPartInput,
|
|
|
+ TextPartInput,
|
|
|
+ ToolIdsErrors,
|
|
|
+ ToolIdsResponses,
|
|
|
+ ToolListErrors,
|
|
|
+ ToolListResponses,
|
|
|
+ TuiAppendPromptErrors,
|
|
|
+ TuiAppendPromptResponses,
|
|
|
+ TuiClearPromptResponses,
|
|
|
+ TuiControlNextResponses,
|
|
|
+ TuiControlResponseResponses,
|
|
|
+ TuiExecuteCommandErrors,
|
|
|
+ TuiExecuteCommandResponses,
|
|
|
+ TuiOpenHelpResponses,
|
|
|
+ TuiOpenModelsResponses,
|
|
|
+ TuiOpenSessionsResponses,
|
|
|
+ TuiOpenThemesResponses,
|
|
|
+ TuiPublishErrors,
|
|
|
+ TuiPublishResponses,
|
|
|
+ TuiShowToastResponses,
|
|
|
+ TuiSubmitPromptResponses,
|
|
|
+ VcsGetResponses,
|
|
|
+} from "./types.gen.js"
|
|
|
+
|
|
|
+export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<
|
|
|
+ TData,
|
|
|
+ ThrowOnError
|
|
|
+> & {
|
|
|
+ /**
|
|
|
+ * You can provide a client instance returned by `createClient()` instead of
|
|
|
+ * individual options. This might be also useful if you want to implement a
|
|
|
+ * custom client.
|
|
|
+ */
|
|
|
+ client?: Client
|
|
|
+ /**
|
|
|
+ * You can pass arbitrary values through the `meta` object. This can be
|
|
|
+ * used to access values that aren't defined as part of the SDK function.
|
|
|
+ */
|
|
|
+ meta?: Record<string, unknown>
|
|
|
+}
|
|
|
+
|
|
|
+class HeyApiClient {
|
|
|
+ protected client: Client
|
|
|
+
|
|
|
+ constructor(args?: { client?: Client }) {
|
|
|
+ this.client = args?.client ?? client
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class HeyApiRegistry<T> {
|
|
|
+ private readonly defaultKey = "default"
|
|
|
+
|
|
|
+ private readonly instances: Map<string, T> = 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)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Global extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Get events
|
|
|
+ */
|
|
|
+ public event<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {
|
|
|
+ return (options?.client ?? this.client).sse.get<GlobalEventResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/global/event",
|
|
|
+ ...options,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Project extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * List all projects
|
|
|
+ */
|
|
|
+ public list<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<ProjectListResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/project",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the current project
|
|
|
+ */
|
|
|
+ public current<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<ProjectCurrentResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/project/current",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Pty extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * List all PTY sessions
|
|
|
+ */
|
|
|
+ public list<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<PtyListResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/pty",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create a new PTY session
|
|
|
+ */
|
|
|
+ public create<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ command?: string
|
|
|
+ args?: Array<string>
|
|
|
+ cwd?: string
|
|
|
+ title?: string
|
|
|
+ env?: {
|
|
|
+ [key: string]: string
|
|
|
+ }
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "command" },
|
|
|
+ { in: "body", key: "args" },
|
|
|
+ { in: "body", key: "cwd" },
|
|
|
+ { in: "body", key: "title" },
|
|
|
+ { in: "body", key: "env" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<PtyCreateResponses, PtyCreateErrors, ThrowOnError>({
|
|
|
+ url: "/pty",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Remove a PTY session
|
|
|
+ */
|
|
|
+ public remove<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ ptyID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "ptyID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).delete<PtyRemoveResponses, PtyRemoveErrors, ThrowOnError>({
|
|
|
+ url: "/pty/{ptyID}",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get PTY session info
|
|
|
+ */
|
|
|
+ public get<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ ptyID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "ptyID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<PtyGetResponses, PtyGetErrors, ThrowOnError>({
|
|
|
+ url: "/pty/{ptyID}",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Update PTY session
|
|
|
+ */
|
|
|
+ public update<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ ptyID: string
|
|
|
+ directory?: string
|
|
|
+ title?: string
|
|
|
+ size?: {
|
|
|
+ rows: number
|
|
|
+ cols: number
|
|
|
+ }
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "ptyID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "title" },
|
|
|
+ { in: "body", key: "size" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).put<PtyUpdateResponses, PtyUpdateErrors, ThrowOnError>({
|
|
|
+ url: "/pty/{ptyID}",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Connect to a PTY session
|
|
|
+ */
|
|
|
+ public connect<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ ptyID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "ptyID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<PtyConnectResponses, PtyConnectErrors, ThrowOnError>({
|
|
|
+ url: "/pty/{ptyID}/connect",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Config extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Get config info
|
|
|
+ */
|
|
|
+ public get<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<ConfigGetResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/config",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Update config
|
|
|
+ */
|
|
|
+ public update<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ config?: Config2
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { key: "config", map: "body" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).patch<ConfigUpdateResponses, ConfigUpdateErrors, ThrowOnError>({
|
|
|
+ url: "/config",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * List all providers
|
|
|
+ */
|
|
|
+ public providers<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<ConfigProvidersResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/config/providers",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Tool extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * List all tool IDs (including built-in and dynamically registered)
|
|
|
+ */
|
|
|
+ public ids<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<ToolIdsResponses, ToolIdsErrors, ThrowOnError>({
|
|
|
+ url: "/experimental/tool/ids",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * List tools with JSON schema parameters for a provider/model
|
|
|
+ */
|
|
|
+ public list<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ directory?: string
|
|
|
+ provider: string
|
|
|
+ model: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "query", key: "provider" },
|
|
|
+ { in: "query", key: "model" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<ToolListResponses, ToolListErrors, ThrowOnError>({
|
|
|
+ url: "/experimental/tool",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Instance extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Dispose the current instance
|
|
|
+ */
|
|
|
+ public dispose<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).post<InstanceDisposeResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/instance/dispose",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Path extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Get the current path
|
|
|
+ */
|
|
|
+ public get<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<PathGetResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/path",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Vcs extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Get VCS info for the current instance
|
|
|
+ */
|
|
|
+ public get<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<VcsGetResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/vcs",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Session extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * List all sessions
|
|
|
+ */
|
|
|
+ public list<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<SessionListResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/session",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create a new session
|
|
|
+ */
|
|
|
+ public create<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ parentID?: string
|
|
|
+ title?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "parentID" },
|
|
|
+ { in: "body", key: "title" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionCreateResponses, SessionCreateErrors, ThrowOnError>({
|
|
|
+ url: "/session",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get session status
|
|
|
+ */
|
|
|
+ public status<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<SessionStatusResponses, SessionStatusErrors, ThrowOnError>({
|
|
|
+ url: "/session/status",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Delete a session and all its data
|
|
|
+ */
|
|
|
+ public delete<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).delete<SessionDeleteResponses, SessionDeleteErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get session
|
|
|
+ */
|
|
|
+ public get<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<SessionGetResponses, SessionGetErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Update session properties
|
|
|
+ */
|
|
|
+ public update<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ title?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "title" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).patch<SessionUpdateResponses, SessionUpdateErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get a session's children
|
|
|
+ */
|
|
|
+ public children<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<SessionChildrenResponses, SessionChildrenErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/children",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the todo list for a session
|
|
|
+ */
|
|
|
+ public todo<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<SessionTodoResponses, SessionTodoErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/todo",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Analyze the app and create an AGENTS.md file
|
|
|
+ */
|
|
|
+ public init<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ modelID?: string
|
|
|
+ providerID?: string
|
|
|
+ messageID?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "modelID" },
|
|
|
+ { in: "body", key: "providerID" },
|
|
|
+ { in: "body", key: "messageID" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionInitResponses, SessionInitErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/init",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Fork an existing session at a specific message
|
|
|
+ */
|
|
|
+ public fork<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ messageID?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "messageID" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionForkResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/fork",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Abort a session
|
|
|
+ */
|
|
|
+ public abort<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionAbortResponses, SessionAbortErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/abort",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Unshare the session
|
|
|
+ */
|
|
|
+ public unshare<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).delete<SessionUnshareResponses, SessionUnshareErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/share",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Share a session
|
|
|
+ */
|
|
|
+ public share<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionShareResponses, SessionShareErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/share",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the diff for this session
|
|
|
+ */
|
|
|
+ public diff<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ messageID?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "query", key: "messageID" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<SessionDiffResponses, SessionDiffErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/diff",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Summarize the session
|
|
|
+ */
|
|
|
+ public summarize<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ providerID?: string
|
|
|
+ modelID?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "providerID" },
|
|
|
+ { in: "body", key: "modelID" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionSummarizeResponses, SessionSummarizeErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/summarize",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * List messages for a session
|
|
|
+ */
|
|
|
+ public messages<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ limit?: number
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "query", key: "limit" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<SessionMessagesResponses, SessionMessagesErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/message",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create and send a new message to a session
|
|
|
+ */
|
|
|
+ public prompt<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ messageID?: string
|
|
|
+ model?: {
|
|
|
+ providerID: string
|
|
|
+ modelID: string
|
|
|
+ }
|
|
|
+ agent?: string
|
|
|
+ noReply?: boolean
|
|
|
+ system?: string
|
|
|
+ tools?: {
|
|
|
+ [key: string]: boolean
|
|
|
+ }
|
|
|
+ parts?: Array<TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput>
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "messageID" },
|
|
|
+ { in: "body", key: "model" },
|
|
|
+ { in: "body", key: "agent" },
|
|
|
+ { in: "body", key: "noReply" },
|
|
|
+ { in: "body", key: "system" },
|
|
|
+ { in: "body", key: "tools" },
|
|
|
+ { in: "body", key: "parts" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionPromptResponses, SessionPromptErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/message",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get a message from a session
|
|
|
+ */
|
|
|
+ public message<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ messageID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "path", key: "messageID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<SessionMessageResponses, SessionMessageErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/message/{messageID}",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create and send a new message to a session, start if needed and return immediately
|
|
|
+ */
|
|
|
+ public promptAsync<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ messageID?: string
|
|
|
+ model?: {
|
|
|
+ providerID: string
|
|
|
+ modelID: string
|
|
|
+ }
|
|
|
+ agent?: string
|
|
|
+ noReply?: boolean
|
|
|
+ system?: string
|
|
|
+ tools?: {
|
|
|
+ [key: string]: boolean
|
|
|
+ }
|
|
|
+ parts?: Array<TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput>
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "messageID" },
|
|
|
+ { in: "body", key: "model" },
|
|
|
+ { in: "body", key: "agent" },
|
|
|
+ { in: "body", key: "noReply" },
|
|
|
+ { in: "body", key: "system" },
|
|
|
+ { in: "body", key: "tools" },
|
|
|
+ { in: "body", key: "parts" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionPromptAsyncResponses, SessionPromptAsyncErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/prompt_async",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Send a new command to a session
|
|
|
+ */
|
|
|
+ public command<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ messageID?: string
|
|
|
+ agent?: string
|
|
|
+ model?: string
|
|
|
+ arguments?: string
|
|
|
+ command?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "messageID" },
|
|
|
+ { in: "body", key: "agent" },
|
|
|
+ { in: "body", key: "model" },
|
|
|
+ { in: "body", key: "arguments" },
|
|
|
+ { in: "body", key: "command" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionCommandResponses, SessionCommandErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/command",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Run a shell command
|
|
|
+ */
|
|
|
+ public shell<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ agent?: string
|
|
|
+ model?: {
|
|
|
+ providerID: string
|
|
|
+ modelID: string
|
|
|
+ }
|
|
|
+ command?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "agent" },
|
|
|
+ { in: "body", key: "model" },
|
|
|
+ { in: "body", key: "command" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionShellResponses, SessionShellErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/shell",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Revert a message
|
|
|
+ */
|
|
|
+ public revert<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ messageID?: string
|
|
|
+ partID?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "messageID" },
|
|
|
+ { in: "body", key: "partID" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionRevertResponses, SessionRevertErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/revert",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Restore all reverted messages
|
|
|
+ */
|
|
|
+ public unrevert<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<SessionUnrevertResponses, SessionUnrevertErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/unrevert",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Permission extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Respond to a permission request
|
|
|
+ */
|
|
|
+ public respond<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ sessionID: string
|
|
|
+ permissionID: string
|
|
|
+ directory?: string
|
|
|
+ response?: "once" | "always" | "reject"
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "sessionID" },
|
|
|
+ { in: "path", key: "permissionID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "response" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<PermissionRespondResponses, PermissionRespondErrors, ThrowOnError>({
|
|
|
+ url: "/session/{sessionID}/permissions/{permissionID}",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Command extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * List all commands
|
|
|
+ */
|
|
|
+ public list<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<CommandListResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/command",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Oauth extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Authorize a provider using OAuth
|
|
|
+ */
|
|
|
+ public authorize<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ providerID: string
|
|
|
+ directory?: string
|
|
|
+ method?: number
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "providerID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "method" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<
|
|
|
+ ProviderOauthAuthorizeResponses,
|
|
|
+ ProviderOauthAuthorizeErrors,
|
|
|
+ ThrowOnError
|
|
|
+ >({
|
|
|
+ url: "/provider/{providerID}/oauth/authorize",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Handle OAuth callback for a provider
|
|
|
+ */
|
|
|
+ public callback<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ providerID: string
|
|
|
+ directory?: string
|
|
|
+ method?: number
|
|
|
+ code?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "providerID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "method" },
|
|
|
+ { in: "body", key: "code" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<
|
|
|
+ ProviderOauthCallbackResponses,
|
|
|
+ ProviderOauthCallbackErrors,
|
|
|
+ ThrowOnError
|
|
|
+ >({
|
|
|
+ url: "/provider/{providerID}/oauth/callback",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Provider extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * List all providers
|
|
|
+ */
|
|
|
+ public list<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<ProviderListResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/provider",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get provider authentication methods
|
|
|
+ */
|
|
|
+ public auth<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<ProviderAuthResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/provider/auth",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ oauth = new Oauth({ client: this.client })
|
|
|
+}
|
|
|
+
|
|
|
+export class Find extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Find text in files
|
|
|
+ */
|
|
|
+ public text<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ directory?: string
|
|
|
+ pattern: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "query", key: "pattern" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<FindTextResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/find",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Find files
|
|
|
+ */
|
|
|
+ public files<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ directory?: string
|
|
|
+ query: string
|
|
|
+ dirs?: "true" | "false"
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "query", key: "query" },
|
|
|
+ { in: "query", key: "dirs" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<FindFilesResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/find/file",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Find workspace symbols
|
|
|
+ */
|
|
|
+ public symbols<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ directory?: string
|
|
|
+ query: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "query", key: "query" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<FindSymbolsResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/find/symbol",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class File extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * List files and directories
|
|
|
+ */
|
|
|
+ public list<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ directory?: string
|
|
|
+ path: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "query", key: "path" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<FileListResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/file",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Read a file
|
|
|
+ */
|
|
|
+ public read<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ directory?: string
|
|
|
+ path: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "query", key: "path" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).get<FileReadResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/file/content",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get file status
|
|
|
+ */
|
|
|
+ public status<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<FileStatusResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/file/status",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class App extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Write a log entry to the server logs
|
|
|
+ */
|
|
|
+ public log<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ service?: string
|
|
|
+ level?: "debug" | "info" | "error" | "warn"
|
|
|
+ message?: string
|
|
|
+ extra?: {
|
|
|
+ [key: string]: unknown
|
|
|
+ }
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "service" },
|
|
|
+ { in: "body", key: "level" },
|
|
|
+ { in: "body", key: "message" },
|
|
|
+ { in: "body", key: "extra" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<AppLogResponses, AppLogErrors, ThrowOnError>({
|
|
|
+ url: "/log",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * List all agents
|
|
|
+ */
|
|
|
+ public agents<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<AppAgentsResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/agent",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Auth extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Remove OAuth credentials for an MCP server
|
|
|
+ */
|
|
|
+ public remove<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ name: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "name" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).delete<McpAuthRemoveResponses, McpAuthRemoveErrors, ThrowOnError>({
|
|
|
+ url: "/mcp/{name}/auth",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Start OAuth authentication flow for an MCP server
|
|
|
+ */
|
|
|
+ public start<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ name: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "name" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<McpAuthStartResponses, McpAuthStartErrors, ThrowOnError>({
|
|
|
+ url: "/mcp/{name}/auth",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Complete OAuth authentication with authorization code
|
|
|
+ */
|
|
|
+ public callback<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ name: string
|
|
|
+ directory?: string
|
|
|
+ code?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "name" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "code" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<McpAuthCallbackResponses, McpAuthCallbackErrors, ThrowOnError>({
|
|
|
+ url: "/mcp/{name}/auth/callback",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Start OAuth flow and wait for callback (opens browser)
|
|
|
+ */
|
|
|
+ public authenticate<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ name: string
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "name" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<McpAuthAuthenticateResponses, McpAuthAuthenticateErrors, ThrowOnError>(
|
|
|
+ {
|
|
|
+ url: "/mcp/{name}/auth/authenticate",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ },
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set authentication credentials
|
|
|
+ */
|
|
|
+ public set<ThrowOnError extends boolean = false>(
|
|
|
+ parameters: {
|
|
|
+ providerID: string
|
|
|
+ directory?: string
|
|
|
+ auth?: Auth2
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "path", key: "providerID" },
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { key: "auth", map: "body" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({
|
|
|
+ url: "/auth/{providerID}",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Mcp extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Get MCP server status
|
|
|
+ */
|
|
|
+ public status<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<McpStatusResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/mcp",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Add MCP server dynamically
|
|
|
+ */
|
|
|
+ public add<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ name?: string
|
|
|
+ config?: McpLocalConfig | McpRemoteConfig
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "name" },
|
|
|
+ { in: "body", key: "config" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<McpAddResponses, McpAddErrors, ThrowOnError>({
|
|
|
+ url: "/mcp",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ auth = new Auth({ client: this.client })
|
|
|
+}
|
|
|
+
|
|
|
+export class Lsp extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Get LSP server status
|
|
|
+ */
|
|
|
+ public status<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<LspStatusResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/lsp",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Formatter extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Get formatter status
|
|
|
+ */
|
|
|
+ public status<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<FormatterStatusResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/formatter",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Control extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Get the next TUI request from the queue
|
|
|
+ */
|
|
|
+ public next<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).get<TuiControlNextResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/tui/control/next",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Submit a response to the TUI request queue
|
|
|
+ */
|
|
|
+ public response<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ body?: unknown
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }, { in: "body" }] }])
|
|
|
+ return (options?.client ?? this.client).post<TuiControlResponseResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/tui/control/response",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class Tui extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Append prompt to the TUI
|
|
|
+ */
|
|
|
+ public appendPrompt<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ text?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "text" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<TuiAppendPromptResponses, TuiAppendPromptErrors, ThrowOnError>({
|
|
|
+ url: "/tui/append-prompt",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Open the help dialog
|
|
|
+ */
|
|
|
+ public openHelp<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).post<TuiOpenHelpResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/tui/open-help",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Open the session dialog
|
|
|
+ */
|
|
|
+ public openSessions<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).post<TuiOpenSessionsResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/tui/open-sessions",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Open the theme dialog
|
|
|
+ */
|
|
|
+ public openThemes<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).post<TuiOpenThemesResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/tui/open-themes",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Open the model dialog
|
|
|
+ */
|
|
|
+ public openModels<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).post<TuiOpenModelsResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/tui/open-models",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Submit the prompt
|
|
|
+ */
|
|
|
+ public submitPrompt<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).post<TuiSubmitPromptResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/tui/submit-prompt",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Clear the prompt
|
|
|
+ */
|
|
|
+ public clearPrompt<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).post<TuiClearPromptResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/tui/clear-prompt",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Execute a TUI command (e.g. agent_cycle)
|
|
|
+ */
|
|
|
+ public executeCommand<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ command?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "command" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<TuiExecuteCommandResponses, TuiExecuteCommandErrors, ThrowOnError>({
|
|
|
+ url: "/tui/execute-command",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Show a toast notification in the TUI
|
|
|
+ */
|
|
|
+ public showToast<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ title?: string
|
|
|
+ message?: string
|
|
|
+ variant?: "info" | "success" | "warning" | "error"
|
|
|
+ duration?: number
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams(
|
|
|
+ [parameters],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ args: [
|
|
|
+ { in: "query", key: "directory" },
|
|
|
+ { in: "body", key: "title" },
|
|
|
+ { in: "body", key: "message" },
|
|
|
+ { in: "body", key: "variant" },
|
|
|
+ { in: "body", key: "duration" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ return (options?.client ?? this.client).post<TuiShowToastResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/tui/show-toast",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Publish a TUI event
|
|
|
+ */
|
|
|
+ public publish<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }, { in: "body" }] }])
|
|
|
+ return (options?.client ?? this.client).post<TuiPublishResponses, TuiPublishErrors, ThrowOnError>({
|
|
|
+ url: "/tui/publish",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ ...options?.headers,
|
|
|
+ ...params.headers,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ control = new Control({ client: this.client })
|
|
|
+}
|
|
|
+
|
|
|
+export class Event extends HeyApiClient {
|
|
|
+ /**
|
|
|
+ * Get events
|
|
|
+ */
|
|
|
+ public subscribe<ThrowOnError extends boolean = false>(
|
|
|
+ parameters?: {
|
|
|
+ directory?: string
|
|
|
+ },
|
|
|
+ options?: Options<never, ThrowOnError>,
|
|
|
+ ) {
|
|
|
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
|
+ return (options?.client ?? this.client).sse.get<EventSubscribeResponses, unknown, ThrowOnError>({
|
|
|
+ url: "/event",
|
|
|
+ ...options,
|
|
|
+ ...params,
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class OpencodeClient extends HeyApiClient {
|
|
|
+ public static readonly __registry = new HeyApiRegistry<OpencodeClient>()
|
|
|
+
|
|
|
+ constructor(args?: { client?: Client; key?: string }) {
|
|
|
+ super(args)
|
|
|
+ OpencodeClient.__registry.set(this, args?.key)
|
|
|
+ }
|
|
|
+
|
|
|
+ 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 })
|
|
|
+
|
|
|
+ permission = new Permission({ 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 })
|
|
|
+}
|