@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.
- package/dist/commands/start.js +18 -18
- package/package.json +1 -1
package/dist/commands/start.js
CHANGED
|
@@ -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
|
-
//
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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
|
-
|
|
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