@aiplumber/session-recall 1.9.2 → 1.9.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/session-recall +27 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiplumber/session-recall",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
4
4
  "description": "Pull context from previous Claude Code sessions. Sessions end, context resets - this tool lets you continue where you left off.",
5
5
  "bin": {
6
6
  "session-recall": "./session-recall"
package/session-recall CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const VERSION = '1.9.2';
3
+ const VERSION = '1.9.4';
4
4
 
5
5
  const fs = require('fs');
6
6
  const path = require('path');
@@ -1336,9 +1336,33 @@ async function cmdLast(arg1, arg2, opts) {
1336
1336
 
1337
1337
  // Handle --compactions mode: show last N compaction phases instead of sessions
1338
1338
  if (opts.compactionPhases) {
1339
- const session = selected[0]; // Use only the most recent session
1339
+ let session = selected[0]; // Use only the most recent session
1340
1340
  // Use pre-scanned markers if available (for large files), otherwise scan now
1341
- const compactions = session.compactionMarkers || scanCompactionMarkers(session.msgs);
1341
+ let compactions = session.compactionMarkers || scanCompactionMarkers(session.msgs);
1342
+
1343
+ // If no compactions in current session, check previous session (new session fallback)
1344
+ // Use allSessions not inactiveSessions - recently compacted sessions may still be "active"
1345
+ if (compactions.length === 0 && allSessions.length > 1) {
1346
+ const prevSession = allSessions[1];
1347
+ // Load previous session if not already loaded
1348
+ if (!prevSession.msgs) {
1349
+ const stats = fs.statSync(prevSession.filePath);
1350
+ const sizeMB = stats.size / (1024 * 1024);
1351
+ if (sizeMB > 100) {
1352
+ prevSession.compactionMarkers = await streamScanCompactions(prevSession.filePath);
1353
+ prevSession.msgs = await streamReadJsonl(prevSession.filePath);
1354
+ } else {
1355
+ prevSession.msgs = readJsonl(prevSession.filePath);
1356
+ }
1357
+ }
1358
+ const prevCompactions = prevSession.compactionMarkers || scanCompactionMarkers(prevSession.msgs);
1359
+ if (prevCompactions.length > 0) {
1360
+ console.log('[session-recall v' + VERSION + '] No compactions in current session - using previous session');
1361
+ console.log('---');
1362
+ session = prevSession;
1363
+ compactions = prevCompactions;
1364
+ }
1365
+ }
1342
1366
 
1343
1367
  if (compactions.length === 0) {
1344
1368
  console.log('[session-recall v' + VERSION + '] No compaction events found - showing full session as single phase');