@gabrihhh/jarvis 2.2.1 → 2.2.2

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/src/statusline.js +15 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gabrihhh/jarvis",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Claude Code terminal dashboard + semantic memory graph via Neo4j",
5
5
  "bin": {
6
6
  "jarvis": "bin/jarvis.js",
package/src/statusline.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Chalk } from 'chalk';
2
- import { readFileSync, existsSync } from 'fs';
2
+ import { readFileSync, existsSync, unlinkSync } from 'fs';
3
3
  import { join } from 'path';
4
4
  import { homedir, tmpdir } from 'os';
5
5
  import { readAllUsage, getCurrentSessionFile, readCurrentSessionUsage } from './reader.js';
@@ -38,9 +38,21 @@ function joinBoxes(...boxes) {
38
38
  boxes[0][2] + boxes.slice(1).map(b => b[2]).join('');
39
39
  }
40
40
 
41
+ const MEMORY_LOCK_STALE_MS = 5 * 60 * 1000; // 5 min — ignora locks de sessões mortas
42
+
41
43
  function isMemoryLoaded(sessionId) {
42
44
  if (!sessionId) return false;
43
- return existsSync(join(tmpdir(), `jarvis-memory-${sessionId}.lock`));
45
+ const lockPath = join(tmpdir(), `jarvis-memory-${sessionId}.lock`);
46
+ if (!existsSync(lockPath)) return false;
47
+ try {
48
+ const ts = new Date(readFileSync(lockPath, 'utf8').trim()).getTime();
49
+ if (Date.now() - ts > MEMORY_LOCK_STALE_MS) {
50
+ try { unlinkSync(lockPath); } catch { /* ignore */ }
51
+ return false;
52
+ }
53
+ unlinkSync(lockPath); // consome o lock: ícone aparece só uma vez
54
+ return true;
55
+ } catch { return false; }
44
56
  }
45
57
 
46
58
  export function renderLine() {
@@ -51,7 +63,7 @@ export function renderLine() {
51
63
  const sessionMeta = getCurrentSessionFile();
52
64
  const sessionId = sessionMeta?.sessionId;
53
65
  const loaded = isMemoryLoaded(sessionId);
54
- const loadedBox = loaded ? buildBox(' ⬡ ', GREEN, 4) : null;
66
+ const loadedBox = loaded ? buildBox(' ⬡ ', GREEN, 4) : null;
55
67
 
56
68
  const allEntries = readAllUsage();
57
69