feat(core): expose session switching endpoints

This commit is contained in:
Dax Raad 2026-06-21 23:59:01 -04:00
commit 35b3fc85d0
7 changed files with 283 additions and 4 deletions

View file

@ -353,6 +353,10 @@ import type {
V2SessionQuestionRejectResponses,
V2SessionQuestionReplyErrors,
V2SessionQuestionReplyResponses,
V2SessionSwitchAgentErrors,
V2SessionSwitchAgentResponses,
V2SessionSwitchModelErrors,
V2SessionSwitchModelResponses,
V2SessionWaitErrors,
V2SessionWaitResponses,
V2SkillListErrors,
@ -5337,6 +5341,88 @@ export class Session3 extends HeyApiClient {
})
}
/**
* Switch session agent
*
* Switch the agent used by subsequent session activity.
*/
public switchAgent<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
agent?: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "path", key: "sessionID" },
{ in: "body", key: "agent" },
],
},
],
)
return (options?.client ?? this.client).post<
V2SessionSwitchAgentResponses,
V2SessionSwitchAgentErrors,
ThrowOnError
>({
url: "/api/session/{sessionID}/agent",
...options,
...params,
headers: {
"Content-Type": "application/json",
...options?.headers,
...params.headers,
},
})
}
/**
* Switch session model
*
* Switch the model used by subsequent session activity.
*/
public switchModel<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
model?: {
id: string
providerID: string
variant?: string
}
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "path", key: "sessionID" },
{ in: "body", key: "model" },
],
},
],
)
return (options?.client ?? this.client).post<
V2SessionSwitchModelResponses,
V2SessionSwitchModelErrors,
ThrowOnError
>({
url: "/api/session/{sessionID}/model",
...options,
...params,
headers: {
"Content-Type": "application/json",
...options?.headers,
...params.headers,
},
})
}
/**
* Send message
*

View file

@ -9521,6 +9521,84 @@ export type V2SessionGetResponses = {
export type V2SessionGetResponse = V2SessionGetResponses[keyof V2SessionGetResponses]
export type V2SessionSwitchAgentData = {
body: {
agent: string
}
path: {
sessionID: string
}
query?: never
url: "/api/session/{sessionID}/agent"
}
export type V2SessionSwitchAgentErrors = {
/**
* InvalidRequestError
*/
400: InvalidRequestError
/**
* UnauthorizedError
*/
401: UnauthorizedError
/**
* SessionNotFoundError
*/
404: SessionNotFoundError
}
export type V2SessionSwitchAgentError = V2SessionSwitchAgentErrors[keyof V2SessionSwitchAgentErrors]
export type V2SessionSwitchAgentResponses = {
/**
* <No Content>
*/
204: void
}
export type V2SessionSwitchAgentResponse = V2SessionSwitchAgentResponses[keyof V2SessionSwitchAgentResponses]
export type V2SessionSwitchModelData = {
body: {
model: {
id: string
providerID: string
variant?: string
}
}
path: {
sessionID: string
}
query?: never
url: "/api/session/{sessionID}/model"
}
export type V2SessionSwitchModelErrors = {
/**
* InvalidRequestError
*/
400: InvalidRequestError
/**
* UnauthorizedError
*/
401: UnauthorizedError
/**
* SessionNotFoundError
*/
404: SessionNotFoundError
}
export type V2SessionSwitchModelError = V2SessionSwitchModelErrors[keyof V2SessionSwitchModelErrors]
export type V2SessionSwitchModelResponses = {
/**
* <No Content>
*/
204: void
}
export type V2SessionSwitchModelResponse = V2SessionSwitchModelResponses[keyof V2SessionSwitchModelResponses]
export type V2SessionPromptData = {
body: {
id?: string