feat(tui): wire up undo/redo and revert for V2 sessions (#34263)
This commit is contained in:
parent
cd942d0669
commit
d1d7ebc2c6
20 changed files with 478 additions and 87 deletions
|
|
@ -369,6 +369,8 @@ import type {
|
|||
V2SessionQuestionRejectResponses,
|
||||
V2SessionQuestionReplyErrors,
|
||||
V2SessionQuestionReplyResponses,
|
||||
V2SessionRenameErrors,
|
||||
V2SessionRenameResponses,
|
||||
V2SessionRevertClearErrors,
|
||||
V2SessionRevertClearResponses,
|
||||
V2SessionRevertCommitErrors,
|
||||
|
|
@ -5612,6 +5614,41 @@ export class Session3 extends HeyApiClient {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename session
|
||||
*
|
||||
* Update the session title.
|
||||
*/
|
||||
public rename<ThrowOnError extends boolean = false>(
|
||||
parameters: {
|
||||
sessionID: string
|
||||
title?: string
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "path", key: "sessionID" },
|
||||
{ in: "body", key: "title" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).post<V2SessionRenameResponses, V2SessionRenameErrors, ThrowOnError>({
|
||||
url: "/api/session/{sessionID}/rename",
|
||||
...options,
|
||||
...params,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
...params.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Send message
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ export type Event =
|
|||
| EventSessionNextAgentSwitched
|
||||
| EventSessionNextModelSwitched
|
||||
| EventSessionNextMoved
|
||||
| EventSessionNextRenamed
|
||||
| EventSessionNextPrompted
|
||||
| EventSessionNextPromptAdmitted
|
||||
| EventSessionNextContextUpdated
|
||||
|
|
@ -848,6 +849,15 @@ export type GlobalEvent = {
|
|||
subdirectory?: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
id: string
|
||||
type: "session.next.renamed"
|
||||
properties: {
|
||||
timestamp: number
|
||||
sessionID: string
|
||||
title: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
id: string
|
||||
type: "session.next.prompted"
|
||||
|
|
@ -1611,6 +1621,7 @@ export type GlobalEvent = {
|
|||
| SyncEventSessionNextAgentSwitched
|
||||
| SyncEventSessionNextModelSwitched
|
||||
| SyncEventSessionNextMoved
|
||||
| SyncEventSessionNextRenamed
|
||||
| SyncEventSessionNextPrompted
|
||||
| SyncEventSessionNextPromptAdmitted
|
||||
| SyncEventSessionNextContextUpdated
|
||||
|
|
@ -2760,6 +2771,7 @@ export type V2Event =
|
|||
| V2EventSessionNextAgentSwitched
|
||||
| V2EventSessionNextModelSwitched
|
||||
| V2EventSessionNextMoved
|
||||
| V2EventSessionNextRenamed
|
||||
| V2EventSessionNextPrompted
|
||||
| V2EventSessionNextPromptAdmitted
|
||||
| V2EventSessionNextContextUpdated
|
||||
|
|
@ -3240,6 +3252,22 @@ export type SyncEventSessionNextMoved = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SyncEventSessionNextRenamed = {
|
||||
type: "sync"
|
||||
id: string
|
||||
syncEvent: {
|
||||
type: "session.next.renamed.1"
|
||||
id: string
|
||||
seq: number
|
||||
aggregateID: string
|
||||
data: {
|
||||
timestamp: number
|
||||
sessionID: string
|
||||
title: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type SyncEventSessionNextPrompted = {
|
||||
type: "sync"
|
||||
id: string
|
||||
|
|
@ -4113,6 +4141,25 @@ export type SessionNextMoved = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SessionNextRenamed = {
|
||||
id: string
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
type: "session.next.renamed"
|
||||
durable?: {
|
||||
aggregateID: string
|
||||
seq: number | "NaN" | "Infinity" | "-Infinity"
|
||||
version: number | "NaN" | "Infinity" | "-Infinity"
|
||||
}
|
||||
location?: LocationRef
|
||||
data: {
|
||||
timestamp: number
|
||||
sessionID: string
|
||||
title: string
|
||||
}
|
||||
}
|
||||
|
||||
export type SessionNextPrompted = {
|
||||
id: string
|
||||
metadata?: {
|
||||
|
|
@ -5168,6 +5215,25 @@ export type V2EventSessionNextMoved = {
|
|||
}
|
||||
}
|
||||
|
||||
export type V2EventSessionNextRenamed = {
|
||||
id: string
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
durable?: {
|
||||
aggregateID: string
|
||||
seq: number
|
||||
version: number
|
||||
}
|
||||
location?: LocationRef
|
||||
type: "session.next.renamed"
|
||||
data: {
|
||||
timestamp: number
|
||||
sessionID: string
|
||||
title: string
|
||||
}
|
||||
}
|
||||
|
||||
export type V2EventSessionNextPrompted = {
|
||||
id: string
|
||||
metadata?: {
|
||||
|
|
@ -6836,6 +6902,16 @@ export type EventSessionNextMoved = {
|
|||
}
|
||||
}
|
||||
|
||||
export type EventSessionNextRenamed = {
|
||||
id: string
|
||||
type: "session.next.renamed"
|
||||
properties: {
|
||||
timestamp: number
|
||||
sessionID: string
|
||||
title: string
|
||||
}
|
||||
}
|
||||
|
||||
export type EventSessionNextPrompted = {
|
||||
id: string
|
||||
type: "session.next.prompted"
|
||||
|
|
@ -12105,6 +12181,43 @@ export type V2SessionSwitchModelResponses = {
|
|||
|
||||
export type V2SessionSwitchModelResponse = V2SessionSwitchModelResponses[keyof V2SessionSwitchModelResponses]
|
||||
|
||||
export type V2SessionRenameData = {
|
||||
body: {
|
||||
title: string
|
||||
}
|
||||
path: {
|
||||
sessionID: string
|
||||
}
|
||||
query?: never
|
||||
url: "/api/session/{sessionID}/rename"
|
||||
}
|
||||
|
||||
export type V2SessionRenameErrors = {
|
||||
/**
|
||||
* InvalidRequestError
|
||||
*/
|
||||
400: InvalidRequestError
|
||||
/**
|
||||
* UnauthorizedError
|
||||
*/
|
||||
401: UnauthorizedError
|
||||
/**
|
||||
* SessionNotFoundError
|
||||
*/
|
||||
404: SessionNotFoundError
|
||||
}
|
||||
|
||||
export type V2SessionRenameError = V2SessionRenameErrors[keyof V2SessionRenameErrors]
|
||||
|
||||
export type V2SessionRenameResponses = {
|
||||
/**
|
||||
* <No Content>
|
||||
*/
|
||||
204: void
|
||||
}
|
||||
|
||||
export type V2SessionRenameResponse = V2SessionRenameResponses[keyof V2SessionRenameResponses]
|
||||
|
||||
export type V2SessionPromptData = {
|
||||
body: {
|
||||
id?: string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue