@blockrun/franklin 3.15.86 → 3.15.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -509,25 +509,12 @@ async function runWithInkUI(agentConfig, model, workDir, version, walletInfo, on
509
509
  recordLatestSessionIfEnabled(process.cwd(), agentConfig.chain);
510
510
  }
511
511
  catch { /* telemetry is best-effort */ }
512
- // Extract learnings from the session (async, 10s timeout, never blocks exit)
513
- if (sessionHistory && sessionHistory.length >= 4) {
514
- try {
515
- const { extractLearnings } = await import('../learnings/extractor.js');
516
- const { extractBrainEntities } = await import('../brain/extract.js');
517
- const { ModelClient } = await import('../agent/llm.js');
518
- const client = new ModelClient({ apiUrl: agentConfig.apiUrl, chain: agentConfig.chain });
519
- const sid = `session-${new Date().toISOString()}`;
520
- await Promise.race([
521
- Promise.all([
522
- extractLearnings(sessionHistory, sid, client),
523
- extractBrainEntities(sessionHistory, sid, client),
524
- ]),
525
- new Promise(resolve => setTimeout(resolve, 15_000)),
526
- ]);
527
- }
528
- catch { /* extraction is best-effort */ }
512
+ // Optional post-session learning extraction. Disabled by default because any
513
+ // network-backed background promise can keep Node alive after the UI exits.
514
+ if (process.env.FRANKLIN_EXTRACT_ON_EXIT === '1') {
515
+ runExitBackgroundTasks(sessionHistory, agentConfig).catch(() => { });
529
516
  }
530
- await disconnectMcpServers();
517
+ disconnectMcpServers().catch(() => { });
531
518
  // Session summary — delta vs. snapshot at session start
532
519
  try {
533
520
  const delta = statsDelta(startSnapshot);
@@ -559,6 +546,19 @@ async function runWithInkUI(agentConfig, model, workDir, version, walletInfo, on
559
546
  }
560
547
  console.log(chalk.dim('\nGoodbye.\n'));
561
548
  }
549
+ async function runExitBackgroundTasks(sessionHistory, agentConfig) {
550
+ if (!sessionHistory || sessionHistory.length < 4)
551
+ return;
552
+ const { extractLearnings } = await import('../learnings/extractor.js');
553
+ const { extractBrainEntities } = await import('../brain/extract.js');
554
+ const { ModelClient } = await import('../agent/llm.js');
555
+ const client = new ModelClient({ apiUrl: agentConfig.apiUrl, chain: agentConfig.chain });
556
+ const sid = `session-${new Date().toISOString()}`;
557
+ await Promise.all([
558
+ extractLearnings(sessionHistory, sid, client),
559
+ extractBrainEntities(sessionHistory, sid, client),
560
+ ]);
561
+ }
562
562
  // ─── Basic readline UI (piped input) ───────────────────────────────────────
563
563
  async function runWithBasicUI(agentConfig, model, workDir, initialInput) {
564
564
  const { TerminalUI } = await import('../ui/terminal.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.15.86",
3
+ "version": "3.15.87",
4
4
  "description": "Franklin — The AI agent with a wallet. Spends USDC autonomously to get real work done. Pay per action, no subscriptions.",
5
5
  "type": "module",
6
6
  "exports": {