feat(core): implement V2 session.shell (#35183)

This commit is contained in:
James Long 2026-07-03 12:19:09 -04:00 committed by GitHub
commit bd8d858bf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 412 additions and 150 deletions

View file

@ -422,6 +422,8 @@ import type {
V2SessionRevertCommitResponses,
V2SessionRevertStageErrors,
V2SessionRevertStageResponses,
V2SessionShellErrors,
V2SessionShellResponses,
V2SessionSkillErrors,
V2SessionSkillResponses,
V2SessionSwitchAgentErrors,
@ -6240,6 +6242,43 @@ export class Session3 extends HeyApiClient {
})
}
/**
* Run shell command
*
* Execute one shell command in the session's working directory. Emits a shell.started event before execution and a shell.ended event with the merged output after.
*/
public shell<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
id?: string | null
command?: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "path", key: "sessionID" },
{ in: "body", key: "id" },
{ in: "body", key: "command" },
],
},
],
)
return (options?.client ?? this.client).post<V2SessionShellResponses, V2SessionShellErrors, ThrowOnError>({
url: "/api/session/{sessionID}/shell",
...options,
...params,
headers: {
"Content-Type": "application/json",
...options?.headers,
...params.headers,
},
})
}
/**
* Compact session
*

View file

@ -16686,6 +16686,44 @@ export type V2SessionSyntheticResponses = {
export type V2SessionSyntheticResponse = V2SessionSyntheticResponses[keyof V2SessionSyntheticResponses]
export type V2SessionShellData = {
body: {
id?: string | null
command: string
}
path: {
sessionID: string
}
query?: never
url: "/api/session/{sessionID}/shell"
}
export type V2SessionShellErrors = {
/**
* InvalidRequestError
*/
400: InvalidRequestErrorV2
/**
* UnauthorizedError
*/
401: UnauthorizedErrorV2
/**
* SessionNotFoundError
*/
404: SessionNotFoundErrorV2
}
export type V2SessionShellError = V2SessionShellErrors[keyof V2SessionShellErrors]
export type V2SessionShellResponses = {
/**
* <No Content>
*/
204: void
}
export type V2SessionShellResponse = V2SessionShellResponses[keyof V2SessionShellResponses]
export type V2SessionCompactData = {
body?: never
path: {