feat(core): add durable compaction barrier (#35371)
This commit is contained in:
parent
bd947658bb
commit
04b673432c
39 changed files with 1486 additions and 396 deletions
|
|
@ -448,6 +448,8 @@ import type {
|
|||
V2ShellOutputResponses,
|
||||
V2ShellRemoveErrors,
|
||||
V2ShellRemoveResponses,
|
||||
V2ShellTimeoutErrors,
|
||||
V2ShellTimeoutResponses,
|
||||
V2SkillListErrors,
|
||||
V2SkillListResponses,
|
||||
V2VcsDiffErrors,
|
||||
|
|
@ -6305,19 +6307,35 @@ export class Session3 extends HeyApiClient {
|
|||
/**
|
||||
* Compact session
|
||||
*
|
||||
* Compact a session conversation.
|
||||
* Queue a durable session compaction request.
|
||||
*/
|
||||
public compact<ThrowOnError extends boolean = false>(
|
||||
parameters: {
|
||||
sessionID: string
|
||||
id?: string | null
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }])
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "path", key: "sessionID" },
|
||||
{ in: "body", key: "id" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).post<V2SessionCompactResponses, V2SessionCompactErrors, ThrowOnError>({
|
||||
url: "/api/session/{sessionID}/compact",
|
||||
...options,
|
||||
...params,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
...params.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -7787,6 +7805,46 @@ export class Shell extends HeyApiClient {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Update shell timeout
|
||||
*
|
||||
* Replace a running shell command's timeout from now, or clear it with zero.
|
||||
*/
|
||||
public timeout<ThrowOnError extends boolean = false>(
|
||||
parameters: {
|
||||
id: string
|
||||
location?: {
|
||||
directory?: string | null
|
||||
workspace?: string | null
|
||||
} | null
|
||||
timeout?: number
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "path", key: "id" },
|
||||
{ in: "query", key: "location" },
|
||||
{ in: "body", key: "timeout" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).patch<V2ShellTimeoutResponses, V2ShellTimeoutErrors, ThrowOnError>({
|
||||
url: "/api/shell/{id}/timeout",
|
||||
...options,
|
||||
...params,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
...params.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Read shell output
|
||||
*
|
||||
|
|
|
|||
|
|
@ -50,9 +50,11 @@ export type Event =
|
|||
| EventSessionToolSuccess
|
||||
| EventSessionToolFailed
|
||||
| EventSessionRetryScheduled
|
||||
| EventSessionCompactionAdmitted
|
||||
| EventSessionCompactionStarted
|
||||
| EventSessionCompactionDelta
|
||||
| EventSessionCompactionEnded
|
||||
| EventSessionCompactionFailed
|
||||
| EventSessionRevertStaged
|
||||
| EventSessionRevertCleared
|
||||
| EventSessionRevertCommitted
|
||||
|
|
@ -1200,6 +1202,14 @@ export type GlobalEvent = {
|
|||
error: SessionStructuredError
|
||||
}
|
||||
}
|
||||
| {
|
||||
id: string
|
||||
type: "session.compaction.admitted"
|
||||
properties: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
id: string
|
||||
type: "session.compaction.started"
|
||||
|
|
@ -1226,6 +1236,13 @@ export type GlobalEvent = {
|
|||
recent: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
id: string
|
||||
type: "session.compaction.failed"
|
||||
properties: {
|
||||
sessionID: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
id: string
|
||||
type: "session.revert.staged"
|
||||
|
|
@ -1772,8 +1789,10 @@ export type GlobalEvent = {
|
|||
| SyncEventSessionToolSuccess
|
||||
| SyncEventSessionToolFailed
|
||||
| SyncEventSessionRetryScheduled
|
||||
| SyncEventSessionCompactionAdmitted
|
||||
| SyncEventSessionCompactionStarted
|
||||
| SyncEventSessionCompactionEnded
|
||||
| SyncEventSessionCompactionFailed
|
||||
| SyncEventSessionRevertStaged
|
||||
| SyncEventSessionRevertCleared
|
||||
| SyncEventSessionRevertCommitted
|
||||
|
|
@ -2940,8 +2959,10 @@ export type SessionDurableEvent =
|
|||
| SessionToolSuccess
|
||||
| SessionToolFailed
|
||||
| SessionRetryScheduled
|
||||
| SessionCompactionAdmitted
|
||||
| SessionCompactionStarted
|
||||
| SessionCompactionEnded
|
||||
| SessionCompactionFailed
|
||||
| SessionRevertStaged
|
||||
| SessionRevertCleared
|
||||
| SessionRevertCommitted
|
||||
|
|
@ -3087,9 +3108,11 @@ export type V2Event =
|
|||
| SessionToolSuccess
|
||||
| SessionToolFailed
|
||||
| SessionRetryScheduled
|
||||
| SessionCompactionAdmitted
|
||||
| SessionCompactionStarted
|
||||
| SessionCompactionDelta
|
||||
| SessionCompactionEnded
|
||||
| SessionCompactionFailed
|
||||
| SessionRevertStaged
|
||||
| SessionRevertCleared
|
||||
| SessionRevertCommitted
|
||||
|
|
@ -4168,6 +4191,21 @@ export type SyncEventSessionRetryScheduled = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SyncEventSessionCompactionAdmitted = {
|
||||
type: "sync"
|
||||
id: string
|
||||
syncEvent: {
|
||||
type: "session.compaction.admitted.1"
|
||||
id: string
|
||||
seq: number
|
||||
aggregateID: string
|
||||
data: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type SyncEventSessionCompactionStarted = {
|
||||
type: "sync"
|
||||
id: string
|
||||
|
|
@ -4200,6 +4238,20 @@ export type SyncEventSessionCompactionEnded = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SyncEventSessionCompactionFailed = {
|
||||
type: "sync"
|
||||
id: string
|
||||
syncEvent: {
|
||||
type: "session.compaction.failed.1"
|
||||
id: string
|
||||
seq: number
|
||||
aggregateID: string
|
||||
data: {
|
||||
sessionID: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type SyncEventSessionRevertStaged = {
|
||||
type: "sync"
|
||||
id: string
|
||||
|
|
@ -4374,6 +4426,15 @@ export type SessionInputAdmitted = {
|
|||
promotedSeq?: number
|
||||
}
|
||||
|
||||
export type SessionInputCompaction = {
|
||||
type: "compaction"
|
||||
admittedSeq: number
|
||||
id: string
|
||||
sessionID: string
|
||||
timeCreated: number
|
||||
handledSeq?: number
|
||||
}
|
||||
|
||||
export type SessionMessageAgentSelected = {
|
||||
id: string
|
||||
metadata?: {
|
||||
|
|
@ -4590,6 +4651,7 @@ export type SessionMessageAssistant = {
|
|||
|
||||
export type SessionMessageCompaction = {
|
||||
type: "compaction"
|
||||
status: "queued" | "running" | "completed" | "failed"
|
||||
reason: "auto" | "manual"
|
||||
summary: string
|
||||
recent: string
|
||||
|
|
@ -5278,6 +5340,25 @@ export type SessionRetryScheduled = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SessionCompactionAdmitted = {
|
||||
id: string
|
||||
created: number
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
type: "session.compaction.admitted"
|
||||
durable: {
|
||||
aggregateID: string
|
||||
seq: number
|
||||
version: number
|
||||
}
|
||||
location?: LocationRef
|
||||
data: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
}
|
||||
}
|
||||
|
||||
export type SessionCompactionStarted = {
|
||||
id: string
|
||||
created: number
|
||||
|
|
@ -5318,6 +5399,24 @@ export type SessionCompactionEnded = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SessionCompactionFailed = {
|
||||
id: string
|
||||
created: number
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
type: "session.compaction.failed"
|
||||
durable: {
|
||||
aggregateID: string
|
||||
seq: number
|
||||
version: number
|
||||
}
|
||||
location?: LocationRef
|
||||
data: {
|
||||
sessionID: string
|
||||
}
|
||||
}
|
||||
|
||||
export type SessionRevertStaged = {
|
||||
id: string
|
||||
created: number
|
||||
|
|
@ -7247,6 +7346,15 @@ export type EventSessionRetryScheduled = {
|
|||
}
|
||||
}
|
||||
|
||||
export type EventSessionCompactionAdmitted = {
|
||||
id: string
|
||||
type: "session.compaction.admitted"
|
||||
properties: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
}
|
||||
}
|
||||
|
||||
export type EventSessionCompactionStarted = {
|
||||
id: string
|
||||
type: "session.compaction.started"
|
||||
|
|
@ -7276,6 +7384,14 @@ export type EventSessionCompactionEnded = {
|
|||
}
|
||||
}
|
||||
|
||||
export type EventSessionCompactionFailed = {
|
||||
id: string
|
||||
type: "session.compaction.failed"
|
||||
properties: {
|
||||
sessionID: string
|
||||
}
|
||||
}
|
||||
|
||||
export type EventSessionRevertStaged = {
|
||||
id: string
|
||||
type: "session.revert.staged"
|
||||
|
|
@ -8439,9 +8555,11 @@ export type V2EventV2 =
|
|||
| SessionToolSuccessV2
|
||||
| SessionToolFailedV2
|
||||
| SessionRetryScheduledV2
|
||||
| SessionCompactionAdmittedV2
|
||||
| SessionCompactionStartedV2
|
||||
| SessionCompactionDeltaV2
|
||||
| SessionCompactionEndedV2
|
||||
| SessionCompactionFailedV2
|
||||
| SessionRevertStagedV2
|
||||
| SessionRevertClearedV2
|
||||
| SessionRevertCommittedV2
|
||||
|
|
@ -8583,6 +8701,15 @@ export type SessionInputAdmittedV2 = {
|
|||
promotedSeq?: number
|
||||
}
|
||||
|
||||
export type SessionInputCompactionV2 = {
|
||||
type: "compaction"
|
||||
admittedSeq: number
|
||||
id: string
|
||||
sessionID: string
|
||||
timeCreated: number
|
||||
handledSeq?: number
|
||||
}
|
||||
|
||||
export type SessionMessageAgentSelectedV2 = {
|
||||
id: string
|
||||
metadata?: {
|
||||
|
|
@ -8721,6 +8848,7 @@ export type SessionMessageAssistantV2 = {
|
|||
|
||||
export type SessionMessageCompactionV2 = {
|
||||
type: "compaction"
|
||||
status: "queued" | "running" | "completed" | "failed"
|
||||
reason: "auto" | "manual"
|
||||
summary: string
|
||||
recent: string
|
||||
|
|
@ -9416,6 +9544,25 @@ export type SessionRetryScheduledV2 = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SessionCompactionAdmittedV2 = {
|
||||
id: string
|
||||
created: number
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
type: "session.compaction.admitted"
|
||||
durable: {
|
||||
aggregateID: string
|
||||
seq: number
|
||||
version: number
|
||||
}
|
||||
location?: LocationRefV2
|
||||
data: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
}
|
||||
}
|
||||
|
||||
export type SessionCompactionStartedV2 = {
|
||||
id: string
|
||||
created: number
|
||||
|
|
@ -9456,6 +9603,24 @@ export type SessionCompactionEndedV2 = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SessionCompactionFailedV2 = {
|
||||
id: string
|
||||
created: number
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
type: "session.compaction.failed"
|
||||
durable: {
|
||||
aggregateID: string
|
||||
seq: number
|
||||
version: number
|
||||
}
|
||||
location?: LocationRefV2
|
||||
data: {
|
||||
sessionID: string
|
||||
}
|
||||
}
|
||||
|
||||
export type SessionRevertStagedV2 = {
|
||||
id: string
|
||||
created: number
|
||||
|
|
@ -15426,7 +15591,9 @@ export type V2SessionShellResponses = {
|
|||
export type V2SessionShellResponse = V2SessionShellResponses[keyof V2SessionShellResponses]
|
||||
|
||||
export type V2SessionCompactData = {
|
||||
body?: never
|
||||
body: {
|
||||
id?: string | null
|
||||
}
|
||||
path: {
|
||||
sessionID: string
|
||||
}
|
||||
|
|
@ -15448,26 +15615,20 @@ export type V2SessionCompactErrors = {
|
|||
*/
|
||||
404: SessionNotFoundError
|
||||
/**
|
||||
* SessionBusyError
|
||||
* ConflictError
|
||||
*/
|
||||
409: SessionBusyError
|
||||
/**
|
||||
* UnknownError
|
||||
*/
|
||||
500: UnknownErrorV2
|
||||
/**
|
||||
* ServiceUnavailableError
|
||||
*/
|
||||
503: ServiceUnavailableErrorV2
|
||||
409: ConflictErrorV2
|
||||
}
|
||||
|
||||
export type V2SessionCompactError = V2SessionCompactErrors[keyof V2SessionCompactErrors]
|
||||
|
||||
export type V2SessionCompactResponses = {
|
||||
/**
|
||||
* <No Content>
|
||||
* Success
|
||||
*/
|
||||
204: void
|
||||
200: {
|
||||
data: SessionInputCompactionV2
|
||||
}
|
||||
}
|
||||
|
||||
export type V2SessionCompactResponse = V2SessionCompactResponses[keyof V2SessionCompactResponses]
|
||||
|
|
@ -17796,7 +17957,7 @@ export type V2ShellCreateData = {
|
|||
body: {
|
||||
command: string
|
||||
cwd?: string
|
||||
timeout?: number
|
||||
timeout: number
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
|
@ -17919,6 +18080,51 @@ export type V2ShellGetResponses = {
|
|||
|
||||
export type V2ShellGetResponse = V2ShellGetResponses[keyof V2ShellGetResponses]
|
||||
|
||||
export type V2ShellTimeoutData = {
|
||||
body: {
|
||||
timeout: number
|
||||
}
|
||||
path: {
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
location?: {
|
||||
directory?: string | null
|
||||
workspace?: string | null
|
||||
} | null
|
||||
}
|
||||
url: "/api/shell/{id}/timeout"
|
||||
}
|
||||
|
||||
export type V2ShellTimeoutErrors = {
|
||||
/**
|
||||
* InvalidRequestError
|
||||
*/
|
||||
400: InvalidRequestErrorV2
|
||||
/**
|
||||
* UnauthorizedError
|
||||
*/
|
||||
401: UnauthorizedError
|
||||
/**
|
||||
* ShellNotFoundError
|
||||
*/
|
||||
404: ShellNotFoundError
|
||||
}
|
||||
|
||||
export type V2ShellTimeoutError = V2ShellTimeoutErrors[keyof V2ShellTimeoutErrors]
|
||||
|
||||
export type V2ShellTimeoutResponses = {
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
200: {
|
||||
location: LocationInfoV2
|
||||
data: ShellV2
|
||||
}
|
||||
}
|
||||
|
||||
export type V2ShellTimeoutResponse = V2ShellTimeoutResponses[keyof V2ShellTimeoutResponses]
|
||||
|
||||
export type V2ShellOutputData = {
|
||||
body?: never
|
||||
path: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue