Skip to content

Commit fd3af32

Browse files
committed
fix(ui): improve terminal paste and exit UX
1 parent e16dce6 commit fd3af32

4 files changed

Lines changed: 336 additions & 19 deletions

File tree

src/agent/loop.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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.

src/agent/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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

src/commands/start.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)