File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -629,6 +629,7 @@ export async function interactiveSession(
629629
630630 // Session persistence — reuse existing session ID when resuming, else create new
631631 const sessionId = config . resumeSessionId || createSessionId ( ) ;
632+ config . onSessionStart ?.( sessionId ) ;
632633 let turnCount = 0 ;
633634
634635 // Resume: hydrate history from the saved JSONL transcript.
Original file line number Diff line number Diff line change @@ -199,6 +199,8 @@ export interface AgentConfig {
199199 baseModel ?: string ;
200200 /** Resume an existing session by ID — loads prior history and keeps appending to the same JSONL */
201201 resumeSessionId ?: string ;
202+ /** Notify callers of the concrete session ID once created/resolved. */
203+ onSessionStart ?: ( sessionId : string ) => void ;
202204 /**
203205 * Optional channel tag persisted to SessionMeta. Lets non-CLI drivers
204206 * (Telegram bot, Discord bot, future ingresses) find their own sessions
Original file line number Diff line number Diff line change @@ -484,6 +484,8 @@ async function runWithInkUI(
484484 agentConfig . onAskUser = ( question , options ) =>
485485 ui . requestAskUser ( question , options ) ;
486486 agentConfig . onModelChange = ( model ) => ui . updateModel ( model ) ;
487+ let activeSessionId = agentConfig . resumeSessionId ;
488+ agentConfig . onSessionStart = ( sessionId ) => { activeSessionId = sessionId ; } ;
487489
488490 // Wire up background balance fetch to UI
489491 onBalanceReady ?.( ( bal ) => ui . updateBalance ( bal ) ) ;
@@ -562,6 +564,21 @@ async function runWithInkUI(
562564 }
563565 } catch { /* stats unavailable */ }
564566
567+ let savedSessionId : string | undefined ;
568+ if ( activeSessionId ) {
569+ try {
570+ const { loadSessionMeta } = await import ( '../session/storage.js' ) ;
571+ const meta = loadSessionMeta ( activeSessionId ) ;
572+ if ( ( meta ?. messageCount ?? 0 ) > 0 ) savedSessionId = activeSessionId ;
573+ } catch { /* session hint is best-effort */ }
574+ }
575+
576+ if ( savedSessionId ) {
577+ console . log ( chalk . dim ( `\n Session: ${ savedSessionId } ` ) ) ;
578+ console . log ( chalk . dim ( ` Resume: franklin --resume ${ savedSessionId } ` ) ) ;
579+ console . log ( chalk . dim ( ' Latest: franklin --continue' ) ) ;
580+ }
581+
565582 console . log ( chalk . dim ( '\nGoodbye.\n' ) ) ;
566583}
567584
You can’t perform that action at this time.
0 commit comments