File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ function storeSession(
118118 if ( fp ) fingerprintCache . set ( fp , state )
119119 // Shared file store (cross-proxy resume)
120120 const key = opencodeSessionId || fp
121- if ( key ) storeSharedSession ( key , claudeSessionId )
121+ if ( key ) storeSharedSession ( key , claudeSessionId , state . messageCount )
122122}
123123
124124/** Extract only the last user message (for resume — SDK already has history) */
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export interface StoredSession {
1818 claudeSessionId : string
1919 createdAt : number
2020 lastUsedAt : number
21+ messageCount : number
2122}
2223
2324const SESSION_TTL_MS = 24 * 60 * 60 * 1000 // 24 hours
@@ -73,13 +74,14 @@ export function lookupSharedSession(key: string): StoredSession | undefined {
7374 return session
7475}
7576
76- export function storeSharedSession ( key : string , claudeSessionId : string ) : void {
77+ export function storeSharedSession ( key : string , claudeSessionId : string , messageCount ?: number ) : void {
7778 const store = readStore ( )
7879 const existing = store [ key ]
7980 store [ key ] = {
8081 claudeSessionId,
8182 createdAt : existing ?. createdAt || Date . now ( ) ,
8283 lastUsedAt : Date . now ( ) ,
84+ messageCount : messageCount ?? existing ?. messageCount ?? 0 ,
8385 }
8486 writeStore ( store )
8587}
You can’t perform that action at this time.
0 commit comments