@@ -7,7 +7,7 @@ const mocks = vi.hoisted(() => ({
77 exportTrajectoryForCommand : vi . fn ( ) ,
88 formatTrajectoryCommandExportSummary : vi . fn ( ) ,
99 getRuntimeConfig : vi . fn ( ) ,
10- loadSessionEntry : vi . fn ( ) ,
10+ loadSessionEntryReadOnly : vi . fn ( ) ,
1111 resolveStorePath : vi . fn ( ) ,
1212} ) ) ;
1313
@@ -19,7 +19,7 @@ vi.mock("../config/sessions/session-accessor.js", async (importOriginal) => {
1919 const actual = await importOriginal < typeof import ( "../config/sessions/session-accessor.js" ) > ( ) ;
2020 return {
2121 ...actual ,
22- loadSessionEntry : mocks . loadSessionEntry ,
22+ loadSessionEntryReadOnly : mocks . loadSessionEntryReadOnly ,
2323 } ;
2424} ) ;
2525
@@ -49,7 +49,7 @@ describe("exportTrajectoryCommand", () => {
4949 vi . clearAllMocks ( ) ;
5050 mocks . getRuntimeConfig . mockReturnValue ( { } ) ;
5151 mocks . resolveStorePath . mockReturnValue ( "/tmp/openclaw/sessions.json" ) ;
52- mocks . loadSessionEntry . mockReturnValue ( undefined ) ;
52+ mocks . loadSessionEntryReadOnly . mockReturnValue ( undefined ) ;
5353 mocks . exportTrajectoryForCommand . mockResolvedValue ( {
5454 outputDir : "/tmp/workspace/.openclaw/trajectory-exports/export" ,
5555 displayPath : ".openclaw/trajectory-exports/export" ,
@@ -101,7 +101,7 @@ describe("exportTrajectoryCommand", () => {
101101 expect ( runtime . error ) . toHaveBeenCalledWith (
102102 "Failed to decode trajectory export request: Encoded trajectory export request is invalid" ,
103103 ) ;
104- expect ( mocks . loadSessionEntry ) . not . toHaveBeenCalled ( ) ;
104+ expect ( mocks . loadSessionEntryReadOnly ) . not . toHaveBeenCalled ( ) ;
105105 expect ( runtime . exit ) . toHaveBeenCalledWith ( 1 ) ;
106106 } ,
107107 ) ;
@@ -127,7 +127,7 @@ describe("exportTrajectoryCommand", () => {
127127 expect ( mocks . resolveStorePath ) . toHaveBeenCalledWith ( "/tmp/direct-store.json" , {
128128 agentId : "main" ,
129129 } ) ;
130- expect ( mocks . loadSessionEntry ) . toHaveBeenCalledWith ( {
130+ expect ( mocks . loadSessionEntryReadOnly ) . toHaveBeenCalledWith ( {
131131 agentId : "main" ,
132132 sessionKey : "agent:main:telegram:direct:123" ,
133133 storePath : "/tmp/direct-store.json" ,
@@ -158,7 +158,7 @@ describe("exportTrajectoryCommand", () => {
158158
159159 expect ( mocks . getRuntimeConfig ) . not . toHaveBeenCalled ( ) ;
160160 expect ( mocks . resolveStorePath ) . toHaveBeenCalledWith ( store , { agentId : "work" } ) ;
161- expect ( mocks . loadSessionEntry ) . toHaveBeenCalledWith ( {
161+ expect ( mocks . loadSessionEntryReadOnly ) . toHaveBeenCalledWith ( {
162162 agentId : "work" ,
163163 sessionKey : "agent:work:telegram:direct:123" ,
164164 storePath : resolvedStore ,
@@ -183,7 +183,7 @@ describe("exportTrajectoryCommand", () => {
183183 "/tmp/openclaw/agents/{agentId}/sessions/sessions.json" ,
184184 { agentId : "work" } ,
185185 ) ;
186- expect ( mocks . loadSessionEntry ) . toHaveBeenCalledWith ( {
186+ expect ( mocks . loadSessionEntryReadOnly ) . toHaveBeenCalledWith ( {
187187 agentId : "work" ,
188188 sessionKey : "agent:work:telegram:direct:123" ,
189189 storePath : "/tmp/openclaw/agents/work/sessions/sessions.json" ,
@@ -200,7 +200,7 @@ describe("exportTrajectoryCommand", () => {
200200 await exportTrajectoryCommand ( { sessionKey : "agent:main:telegram:direct:123" } , runtime ) ;
201201
202202 expect ( mocks . resolveStorePath ) . toHaveBeenCalledWith ( undefined , { agentId : "main" } ) ;
203- expect ( mocks . loadSessionEntry ) . toHaveBeenCalledWith ( {
203+ expect ( mocks . loadSessionEntryReadOnly ) . toHaveBeenCalledWith ( {
204204 agentId : "main" ,
205205 sessionKey : "agent:main:telegram:direct:123" ,
206206 storePath : "/tmp/openclaw/sessions.json" ,
@@ -218,7 +218,7 @@ describe("exportTrajectoryCommand", () => {
218218 await exportTrajectoryCommand ( { sessionKey : "agent:main:telegram:direct:123" } , runtime ) ;
219219
220220 expect ( mocks . resolveStorePath ) . toHaveBeenCalledWith ( "" , { agentId : "main" } ) ;
221- expect ( mocks . loadSessionEntry ) . toHaveBeenCalledWith ( {
221+ expect ( mocks . loadSessionEntryReadOnly ) . toHaveBeenCalledWith ( {
222222 agentId : "main" ,
223223 sessionKey : "agent:main:telegram:direct:123" ,
224224 storePath : "/tmp/openclaw/sessions.json" ,
@@ -232,7 +232,7 @@ describe("exportTrajectoryCommand", () => {
232232 it ( "exports SQLite marker sessions without probing a transcript JSONL file" , async ( ) => {
233233 const runtime = createRuntime ( ) ;
234234 const sessionFile = "sqlite:main:session-1:/tmp/openclaw/sessions.json" ;
235- mocks . loadSessionEntry . mockReturnValue ( {
235+ mocks . loadSessionEntryReadOnly . mockReturnValue ( {
236236 sessionId : "session-1" ,
237237 sessionFile,
238238 updatedAt : 1 ,
0 commit comments