diff options
Diffstat (limited to 'packages/sdk/js/src')
| -rw-r--r-- | packages/sdk/js/src/gen/sdk.gen.ts | 31 | ||||
| -rw-r--r-- | packages/sdk/js/src/gen/types.gen.ts | 62 |
2 files changed, 93 insertions, 0 deletions
diff --git a/packages/sdk/js/src/gen/sdk.gen.ts b/packages/sdk/js/src/gen/sdk.gen.ts index b5e055408..b00216b83 100644 --- a/packages/sdk/js/src/gen/sdk.gen.ts +++ b/packages/sdk/js/src/gen/sdk.gen.ts @@ -39,6 +39,8 @@ import type { SessionChatResponses, SessionMessageData, SessionMessageResponses, + SessionCommandData, + SessionCommandResponses, SessionShellData, SessionShellResponses, SessionRevertData, @@ -47,6 +49,8 @@ import type { SessionUnrevertResponses, PostSessionByIdPermissionsByPermissionIdData, PostSessionByIdPermissionsByPermissionIdResponses, + CommandListData, + CommandListResponses, ConfigProvidersData, ConfigProvidersResponses, FindTextData, @@ -356,6 +360,20 @@ class Session extends _HeyApiClient { } /** + * Send a new command to a session + */ + public command<ThrowOnError extends boolean = false>(options: Options<SessionCommandData, ThrowOnError>) { + return (options.client ?? this._client).post<SessionCommandResponses, unknown, ThrowOnError>({ + url: "/session/{id}/command", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } + + /** * Run a shell command */ public shell<ThrowOnError extends boolean = false>(options: Options<SessionShellData, ThrowOnError>) { @@ -394,6 +412,18 @@ class Session extends _HeyApiClient { } } +class Command extends _HeyApiClient { + /** + * List all commands + */ + public list<ThrowOnError extends boolean = false>(options?: Options<CommandListData, ThrowOnError>) { + return (options?.client ?? this._client).get<CommandListResponses, unknown, ThrowOnError>({ + url: "/command", + ...options, + }) + } +} + class Find extends _HeyApiClient { /** * Find text in files @@ -592,6 +622,7 @@ export class OpencodeClient extends _HeyApiClient { app = new App({ client: this._client }) config = new Config({ client: this._client }) session = new Session({ client: this._client }) + command = new Command({ client: this._client }) find = new Find({ client: this._client }) file = new File({ client: this._client }) tui = new Tui({ client: this._client }) diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts index 9919dc419..8e9662ad5 100644 --- a/packages/sdk/js/src/gen/types.gen.ts +++ b/packages/sdk/js/src/gen/types.gen.ts @@ -585,6 +585,14 @@ export type Config = { */ scroll_speed: number } + command?: { + [key: string]: { + template: string + description?: string + agent?: string + model?: string + } + } plugin?: Array<string> snapshot?: boolean /** @@ -1110,6 +1118,14 @@ export type AgentPartInput = { } } +export type Command = { + name: string + description?: string + agent?: string + model?: string + template: string +} + export type Symbol = { name: string kind: number @@ -1563,6 +1579,36 @@ export type SessionMessageResponses = { export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses] +export type SessionCommandData = { + body?: { + messageID?: string + agent?: string + model?: string + arguments: string + command: string + } + path: { + /** + * Session ID + */ + id: string + } + query?: never + url: "/session/{id}/command" +} + +export type SessionCommandResponses = { + /** + * Created message + */ + 200: { + info: AssistantMessage + parts: Array<Part> + } +} + +export type SessionCommandResponse = SessionCommandResponses[keyof SessionCommandResponses] + export type SessionShellData = { body?: { agent: string @@ -1648,6 +1694,22 @@ export type PostSessionByIdPermissionsByPermissionIdResponses = { export type PostSessionByIdPermissionsByPermissionIdResponse = PostSessionByIdPermissionsByPermissionIdResponses[keyof PostSessionByIdPermissionsByPermissionIdResponses] +export type CommandListData = { + body?: never + path?: never + query?: never + url: "/command" +} + +export type CommandListResponses = { + /** + * List of commands + */ + 200: Array<Command> +} + +export type CommandListResponse = CommandListResponses[keyof CommandListResponses] + export type ConfigProvidersData = { body?: never path?: never |
