fix session performance issue from large diffs

This commit is contained in:
Dax Raad
2025-11-04 13:32:56 -05:00
parent f9af9fc221
commit 7a7060ef15
6 changed files with 101 additions and 17 deletions

View File

@@ -55,6 +55,7 @@ import type {
SessionShareErrors,
SessionDiffData,
SessionDiffResponses,
SessionDiffErrors,
SessionSummarizeData,
SessionSummarizeResponses,
SessionSummarizeErrors,
@@ -475,12 +476,16 @@ class Session extends _HeyApiClient {
}
/**
* Get the diff that resulted from this user message
* Get the diff for this session
*/
public diff<ThrowOnError extends boolean = false>(
options: Options<SessionDiffData, ThrowOnError>,
) {
return (options.client ?? this._client).get<SessionDiffResponses, unknown, ThrowOnError>({
return (options.client ?? this._client).get<
SessionDiffResponses,
SessionDiffErrors,
ThrowOnError
>({
url: "/session/{id}/diff",
...options,
})

View File

@@ -527,7 +527,9 @@ export type Session = {
directory: string
parentID?: string
summary?: {
diffs: Array<FileDiff>
additions: number
deletions: number
diffs?: Array<FileDiff>
}
share?: {
url: string
@@ -1882,6 +1884,9 @@ export type SessionShareResponse = SessionShareResponses[keyof SessionShareRespo
export type SessionDiffData = {
body?: never
path: {
/**
* Session ID
*/
id: string
}
query?: {
@@ -1891,9 +1896,22 @@ export type SessionDiffData = {
url: "/session/{id}/diff"
}
export type SessionDiffErrors = {
/**
* Bad request
*/
400: BadRequestError
/**
* Not found
*/
404: NotFoundError
}
export type SessionDiffError = SessionDiffErrors[keyof SessionDiffErrors]
export type SessionDiffResponses = {
/**
* Successfully retrieved diff
* List of diffs
*/
200: Array<FileDiff>
}