feat(server): add v2 session API endpoints (#31822)

This commit is contained in:
Dax
2026-06-11 02:55:01 +00:00
committed by GitHub
parent ff967e582c
commit 8bf0675997
11 changed files with 431 additions and 7 deletions
+123
View File
@@ -92,6 +92,7 @@ import type {
GlobalUpgradeResponses,
InstanceDisposeErrors,
InstanceDisposeResponses,
LocationRef,
LspStatusErrors,
LspStatusResponses,
McpAddErrors,
@@ -274,6 +275,8 @@ import type {
V2FsReadResponses,
V2HealthGetErrors,
V2HealthGetResponses,
V2LocationGetErrors,
V2LocationGetResponses,
V2ModelListErrors,
V2ModelListResponses,
V2PermissionRequestListErrors,
@@ -294,6 +297,10 @@ import type {
V2SessionCompactResponses,
V2SessionContextErrors,
V2SessionContextResponses,
V2SessionCreateErrors,
V2SessionCreateResponses,
V2SessionGetErrors,
V2SessionGetResponses,
V2SessionListErrors,
V2SessionListResponses,
V2SessionMessagesErrors,
@@ -304,6 +311,8 @@ import type {
V2SessionPermissionReplyResponses,
V2SessionPromptErrors,
V2SessionPromptResponses,
V2SessionQuestionListErrors,
V2SessionQuestionListResponses,
V2SessionQuestionRejectErrors,
V2SessionQuestionRejectResponses,
V2SessionQuestionReplyErrors,
@@ -5013,6 +5022,30 @@ export class Health extends HeyApiClient {
}
}
export class Location extends HeyApiClient {
/**
* Get location
*
* Resolve the requested location or the server default location.
*/
public get<ThrowOnError extends boolean = false>(
parameters?: {
location?: {
directory?: string
workspace?: string
}
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }])
return (options?.client ?? this.client).get<V2LocationGetResponses, V2LocationGetErrors, ThrowOnError>({
url: "/api/location",
...options,
...params,
})
}
}
export class Agent extends HeyApiClient {
/**
* List agents
@@ -5106,6 +5139,29 @@ export class Permission2 extends HeyApiClient {
}
export class Question2 extends HeyApiClient {
/**
* List session question requests
*
* Retrieve pending question requests owned by a session.
*/
public list<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }])
return (options?.client ?? this.client).get<
V2SessionQuestionListResponses,
V2SessionQuestionListErrors,
ThrowOnError
>({
url: "/api/session/{sessionID}/question",
...options,
...params,
})
}
/**
* Reply to pending question request
*
@@ -5225,6 +5281,68 @@ export class Session3 extends HeyApiClient {
})
}
/**
* Create session
*
* Create a session at the requested location.
*/
public create<ThrowOnError extends boolean = false>(
parameters?: {
id?: string
agent?: string
model?: {
id: string
providerID: string
variant?: string
}
location?: LocationRef
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "body", key: "id" },
{ in: "body", key: "agent" },
{ in: "body", key: "model" },
{ in: "body", key: "location" },
],
},
],
)
return (options?.client ?? this.client).post<V2SessionCreateResponses, V2SessionCreateErrors, ThrowOnError>({
url: "/api/session",
...options,
...params,
headers: {
"Content-Type": "application/json",
...options?.headers,
...params.headers,
},
})
}
/**
* Get session
*
* Retrieve a session by ID.
*/
public get<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }])
return (options?.client ?? this.client).get<V2SessionGetResponses, V2SessionGetErrors, ThrowOnError>({
url: "/api/session/{sessionID}",
...options,
...params,
})
}
/**
* Send message
*
@@ -5779,6 +5897,11 @@ export class V2 extends HeyApiClient {
return (this._health ??= new Health({ client: this.client }))
}
private _location?: Location
get location(): Location {
return (this._location ??= new Location({ client: this.client }))
}
private _agent?: Agent
get agent(): Agent {
return (this._agent ??= new Agent({ client: this.client }))