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

@ -349,6 +349,26 @@ export const makeSessionGroup = <I extends HttpApiMiddleware.AnyId, S>(sessionLo
}),
),
)
.add(
HttpApiEndpoint.post("session.shell", "/api/session/:sessionID/shell", {
params: { sessionID: Session.ID },
payload: Schema.Struct({
id: Event.ID.pipe(Schema.optional),
command: Schema.String,
}),
success: HttpApiSchema.NoContent,
error: SessionNotFoundError,
})
.middleware(sessionLocationMiddleware)
.annotateMerge(
OpenApi.annotations({
identifier: "v2.session.shell",
summary: "Run shell command",
description:
"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.",
}),
),
)
.add(
HttpApiEndpoint.post("session.compact", "/api/session/:sessionID/compact", {
params: { sessionID: Session.ID },