33import {
44 listSessionEntries as listAccessorSessionEntries ,
55 loadSessionEntry ,
6+ patchSessionEntry as patchAccessorSessionEntry ,
67 replaceSessionEntry ,
78 updateSessionEntry ,
89} from "../config/sessions/session-accessor.js" ;
@@ -28,6 +29,18 @@ type SessionStoreEntryUpdate = (
2829 entry : SessionEntry ,
2930) => Promise < Partial < SessionEntry > | null > | Partial < SessionEntry > | null ;
3031
32+ type SessionStoreEntryPatch = (
33+ entry : SessionEntry ,
34+ context : { existingEntry ?: SessionEntry } ,
35+ ) => Promise < Partial < SessionEntry > | null > | Partial < SessionEntry > | null ;
36+
37+ type PatchSessionEntryParams = SessionStoreReadParams & {
38+ fallbackEntry ?: SessionEntry ;
39+ preserveActivity ?: boolean ;
40+ replaceEntry ?: boolean ;
41+ update : SessionStoreEntryPatch ;
42+ } ;
43+
3144type UpdateSessionStoreEntryParams = {
3245 storePath : string ;
3346 sessionKey : string ;
@@ -70,6 +83,27 @@ export function listSessionEntries(
7083 } ) ;
7184}
7285
86+ /** Patches one session entry through the accessor seam. */
87+ export async function patchSessionEntry (
88+ params : PatchSessionEntryParams ,
89+ ) : Promise < SessionEntry | null > {
90+ return await patchAccessorSessionEntry (
91+ {
92+ agentId : params . agentId ,
93+ env : params . env ,
94+ hydrateSkillPromptRefs : params . hydrateSkillPromptRefs ,
95+ sessionKey : params . sessionKey ,
96+ storePath : params . storePath ,
97+ } ,
98+ params . update ,
99+ {
100+ fallbackEntry : params . fallbackEntry ,
101+ preserveActivity : params . preserveActivity ,
102+ replaceEntry : params . replaceEntry ,
103+ } ,
104+ ) ;
105+ }
106+
73107/** Updates an existing session entry through the accessor seam. */
74108export async function updateSessionStoreEntry (
75109 params : UpdateSessionStoreEntryParams ,
@@ -114,7 +148,6 @@ export { resolveGroupSessionKey } from "../config/sessions/group.js";
114148export { canonicalizeMainSessionAlias } from "../config/sessions/main-session.js" ;
115149export {
116150 clearSessionStoreCacheForTest ,
117- patchSessionEntry ,
118151 readSessionUpdatedAt ,
119152 recordSessionMetaFromInbound ,
120153 saveSessionStore ,
0 commit comments