From 133fe41cd5fb0ec3dc03a90e58526408297878fd Mon Sep 17 00:00:00 2001 From: Dax Date: Fri, 22 Aug 2025 17:04:28 -0400 Subject: slash commands (#2157) Co-authored-by: adamdotdevin <2363879+adamdottv@users.noreply.github.com> --- packages/sdk/js/src/gen/sdk.gen.ts | 31 ++++++++++++++++++ packages/sdk/js/src/gen/types.gen.ts | 62 ++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) (limited to 'packages/sdk/js/src') 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, @@ -355,6 +359,20 @@ class Session extends _HeyApiClient { }) } + /** + * Send a new command to a session + */ + public command(options: Options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/command", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } + /** * Run a shell command */ @@ -394,6 +412,18 @@ class Session extends _HeyApiClient { } } +class Command extends _HeyApiClient { + /** + * List all commands + */ + public list(options?: Options) { + return (options?.client ?? this._client).get({ + 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 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 + } +} + +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 +} + +export type CommandListResponse = CommandListResponses[keyof CommandListResponses] + export type ConfigProvidersData = { body?: never path?: never -- cgit v1.2.3