@@ -12,6 +12,12 @@ function derivedMetaPath(filePath) {
1212 return filePath . endsWith ( '.jsonl' ) ? filePath . replace ( / \. j s o n l $ / , '.meta.json' ) : `${ filePath } .meta.json` ;
1313}
1414
15+ function isCodexSessionPath ( tmpHome , filePath ) {
16+ const normalized = String ( filePath || '' ) ;
17+ return normalized . startsWith ( path . join ( tmpHome , '.codex' , 'sessions' ) + path . sep )
18+ || normalized . startsWith ( path . join ( tmpHome , '.config' , 'codex' , 'sessions' ) + path . sep ) ;
19+ }
20+
1521function buildIso ( baseIso , offsetSeconds ) {
1622 return new Date ( Date . parse ( baseIso ) + ( offsetSeconds * 1000 ) ) . toISOString ( ) ;
1723}
@@ -48,10 +54,14 @@ async function convertAndAssertListed(api, tmpHome, source, target, params = {},
4854 const outPath = res . session . filePath ;
4955 assert ( fs . existsSync ( outPath ) , `derived ${ target } session file missing` ) ;
5056 assert ( fs . existsSync ( derivedMetaPath ( outPath ) ) , `derived ${ target } meta missing` ) ;
51- assert (
52- outPath . startsWith ( path . join ( tmpHome , '.codexmate' , 'sessions' , 'derived' , target ) + path . sep ) ,
53- `derived ${ target } session path should stay inside ~/.codexmate`
54- ) ;
57+ if ( target === 'codex' ) {
58+ assert ( isCodexSessionPath ( tmpHome , outPath ) , 'derived codex session path should stay inside ~/.codex or ~/.config/codex' ) ;
59+ } else {
60+ assert (
61+ outPath . startsWith ( path . join ( tmpHome , '.codexmate' , 'sessions' , 'derived' , target ) + path . sep ) ,
62+ `derived ${ target } session path should stay inside ~/.codexmate`
63+ ) ;
64+ }
5565 if ( options . assertListed !== false ) {
5666 const list = await api ( 'list-sessions' , { source : target , limit : 300 , forceRefresh : true } ) ;
5767 assert ( Array . isArray ( list . sessions ) , `list-sessions(${ target } ) missing sessions` ) ;
0 commit comments