feat: add workspace tracking to history items (#2054)

Track the current workspace path in history items to enable filtering and organization of history by workspace. This change adds the workspace property to the history schema and ensures it's saved with each history entry.
This commit is contained in:
Sam Hoang Van 2025-04-05 19:23:10 +07:00 committed by GitHub
parent 60f9221d69
commit bf648856ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 0 deletions

View file

@ -397,6 +397,7 @@ export class Cline extends EventEmitter<ClineEvents> {
cacheReads: apiMetrics.totalCacheReads,
totalCost: apiMetrics.totalCost,
size: taskDirSize,
workspace: this.cwd,
})
} catch (error) {
console.error("Failed to save cline messages:", error)

View file

@ -228,6 +228,7 @@ type GlobalSettings = {
cacheReads?: number | undefined
totalCost: number
size?: number | undefined
workspace?: string | undefined
}[]
| undefined
autoApprovalEnabled?: boolean | undefined

View file

@ -231,6 +231,7 @@ type GlobalSettings = {
cacheReads?: number | undefined
totalCost: number
size?: number | undefined
workspace?: string | undefined
}[]
| undefined
autoApprovalEnabled?: boolean | undefined

View file

@ -146,6 +146,7 @@ export const historyItemSchema = z.object({
cacheReads: z.number().optional(),
totalCost: z.number(),
size: z.number().optional(),
workspace: z.string().optional(),
})
export type HistoryItem = z.infer<typeof historyItemSchema>