feat(server): add v2 session API endpoints (#31822)
This commit is contained in:
parent
ff967e582c
commit
8bf0675997
11 changed files with 431 additions and 7 deletions
|
|
@ -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 }))
|
||||
|
|
|
|||
|
|
@ -2737,18 +2737,18 @@ export type InvalidCursorError = {
|
|||
message: string
|
||||
}
|
||||
|
||||
export type ConflictError = {
|
||||
_tag: "ConflictError"
|
||||
message: string
|
||||
resource?: string
|
||||
}
|
||||
|
||||
export type SessionNotFoundError = {
|
||||
_tag: "SessionNotFoundError"
|
||||
sessionID: string
|
||||
message: string
|
||||
}
|
||||
|
||||
export type ConflictError = {
|
||||
_tag: "ConflictError"
|
||||
message: string
|
||||
resource?: string
|
||||
}
|
||||
|
||||
export type ServiceUnavailableError = {
|
||||
_tag: "ServiceUnavailableError"
|
||||
message: string
|
||||
|
|
@ -9453,6 +9453,40 @@ export type V2HealthGetResponses = {
|
|||
|
||||
export type V2HealthGetResponse = V2HealthGetResponses[keyof V2HealthGetResponses]
|
||||
|
||||
export type V2LocationGetData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: {
|
||||
location?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
}
|
||||
}
|
||||
url: "/api/location"
|
||||
}
|
||||
|
||||
export type V2LocationGetErrors = {
|
||||
/**
|
||||
* InvalidRequestError
|
||||
*/
|
||||
400: InvalidRequestError
|
||||
/**
|
||||
* UnauthorizedError
|
||||
*/
|
||||
401: UnauthorizedError
|
||||
}
|
||||
|
||||
export type V2LocationGetError = V2LocationGetErrors[keyof V2LocationGetErrors]
|
||||
|
||||
export type V2LocationGetResponses = {
|
||||
/**
|
||||
* Location.Info
|
||||
*/
|
||||
200: LocationInfo
|
||||
}
|
||||
|
||||
export type V2LocationGetResponse = V2LocationGetResponses[keyof V2LocationGetResponses]
|
||||
|
||||
export type V2AgentListData = {
|
||||
body?: never
|
||||
path?: never
|
||||
|
|
@ -9531,6 +9565,83 @@ export type V2SessionListResponses = {
|
|||
|
||||
export type V2SessionListResponse = V2SessionListResponses[keyof V2SessionListResponses]
|
||||
|
||||
export type V2SessionCreateData = {
|
||||
body: {
|
||||
id?: string
|
||||
agent?: string
|
||||
model?: {
|
||||
id: string
|
||||
providerID: string
|
||||
variant?: string
|
||||
}
|
||||
location?: LocationRef
|
||||
}
|
||||
path?: never
|
||||
query?: never
|
||||
url: "/api/session"
|
||||
}
|
||||
|
||||
export type V2SessionCreateErrors = {
|
||||
/**
|
||||
* InvalidRequestError
|
||||
*/
|
||||
400: InvalidRequestError
|
||||
/**
|
||||
* UnauthorizedError
|
||||
*/
|
||||
401: UnauthorizedError
|
||||
}
|
||||
|
||||
export type V2SessionCreateError = V2SessionCreateErrors[keyof V2SessionCreateErrors]
|
||||
|
||||
export type V2SessionCreateResponses = {
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
200: {
|
||||
data: SessionV2Info
|
||||
}
|
||||
}
|
||||
|
||||
export type V2SessionCreateResponse = V2SessionCreateResponses[keyof V2SessionCreateResponses]
|
||||
|
||||
export type V2SessionGetData = {
|
||||
body?: never
|
||||
path: {
|
||||
sessionID: string
|
||||
}
|
||||
query?: never
|
||||
url: "/api/session/{sessionID}"
|
||||
}
|
||||
|
||||
export type V2SessionGetErrors = {
|
||||
/**
|
||||
* InvalidRequestError
|
||||
*/
|
||||
400: InvalidRequestError
|
||||
/**
|
||||
* UnauthorizedError
|
||||
*/
|
||||
401: UnauthorizedError
|
||||
/**
|
||||
* SessionNotFoundError
|
||||
*/
|
||||
404: SessionNotFoundError
|
||||
}
|
||||
|
||||
export type V2SessionGetError = V2SessionGetErrors[keyof V2SessionGetErrors]
|
||||
|
||||
export type V2SessionGetResponses = {
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
200: {
|
||||
data: SessionV2Info
|
||||
}
|
||||
}
|
||||
|
||||
export type V2SessionGetResponse = V2SessionGetResponses[keyof V2SessionGetResponses]
|
||||
|
||||
export type V2SessionPromptData = {
|
||||
body: {
|
||||
id?: string
|
||||
|
|
@ -10310,6 +10421,43 @@ export type V2QuestionRequestListResponses = {
|
|||
|
||||
export type V2QuestionRequestListResponse = V2QuestionRequestListResponses[keyof V2QuestionRequestListResponses]
|
||||
|
||||
export type V2SessionQuestionListData = {
|
||||
body?: never
|
||||
path: {
|
||||
sessionID: string
|
||||
}
|
||||
query?: never
|
||||
url: "/api/session/{sessionID}/question"
|
||||
}
|
||||
|
||||
export type V2SessionQuestionListErrors = {
|
||||
/**
|
||||
* InvalidRequestError
|
||||
*/
|
||||
400: InvalidRequestError
|
||||
/**
|
||||
* UnauthorizedError
|
||||
*/
|
||||
401: UnauthorizedError
|
||||
/**
|
||||
* SessionNotFoundError
|
||||
*/
|
||||
404: SessionNotFoundError
|
||||
}
|
||||
|
||||
export type V2SessionQuestionListError = V2SessionQuestionListErrors[keyof V2SessionQuestionListErrors]
|
||||
|
||||
export type V2SessionQuestionListResponses = {
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
200: {
|
||||
data: Array<QuestionV2Request>
|
||||
}
|
||||
}
|
||||
|
||||
export type V2SessionQuestionListResponse = V2SessionQuestionListResponses[keyof V2SessionQuestionListResponses]
|
||||
|
||||
export type V2SessionQuestionReplyData = {
|
||||
body: QuestionV2Reply
|
||||
path: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue