agentlytics 0.2.0 → 0.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/editors/codex.js +25 -15
  2. package/package.json +1 -1
package/editors/codex.js CHANGED
@@ -5,17 +5,25 @@ const os = require('os');
5
5
  const name = 'codex';
6
6
  const DEFAULT_CODEX_HOME = path.join(os.homedir(), '.codex');
7
7
  const SESSION_SUBDIR = 'sessions';
8
+ const ARCHIVED_SESSION_SUBDIR = 'archived_sessions';
8
9
  const MAX_TOOL_RESULT_PREVIEW = 500;
9
10
 
10
11
  function getChats() {
11
- const sessionsDir = getSessionsDir();
12
- if (!fs.existsSync(sessionsDir)) return [];
13
-
12
+ const dirs = [getSessionsDir(), getArchivedSessionsDir()];
13
+ const seen = new Set();
14
14
  const chats = [];
15
- for (const filePath of walkJsonlFiles(sessionsDir)) {
16
- const chat = readChatMetadata(filePath);
17
- if (chat) chats.push(chat);
15
+
16
+ for (const dir of dirs) {
17
+ if (!fs.existsSync(dir)) continue;
18
+ for (const filePath of walkJsonlFiles(dir)) {
19
+ const chat = readChatMetadata(filePath);
20
+ if (!chat) continue;
21
+ if (seen.has(chat.composerId)) continue;
22
+ seen.add(chat.composerId);
23
+ chats.push(chat);
24
+ }
18
25
  }
26
+
19
27
  return chats;
20
28
  }
21
29
 
@@ -25,11 +33,18 @@ function getMessages(chat) {
25
33
  return parseSessionMessages(filePath);
26
34
  }
27
35
 
28
- function getSessionsDir() {
29
- const codexHome = process.env.CODEX_HOME && process.env.CODEX_HOME.trim()
36
+ function getCodexHome() {
37
+ return process.env.CODEX_HOME && process.env.CODEX_HOME.trim()
30
38
  ? path.resolve(process.env.CODEX_HOME.trim())
31
39
  : DEFAULT_CODEX_HOME;
32
- return path.join(codexHome, SESSION_SUBDIR);
40
+ }
41
+
42
+ function getSessionsDir() {
43
+ return path.join(getCodexHome(), SESSION_SUBDIR);
44
+ }
45
+
46
+ function getArchivedSessionsDir() {
47
+ return path.join(getCodexHome(), ARCHIVED_SESSION_SUBDIR);
33
48
  }
34
49
 
35
50
  function walkJsonlFiles(dir) {
@@ -442,12 +457,7 @@ function safeParseJson(value) {
442
457
  // ============================================================
443
458
 
444
459
  function getCodexAuth() {
445
- const authPath = path.join(
446
- process.env.CODEX_HOME && process.env.CODEX_HOME.trim()
447
- ? path.resolve(process.env.CODEX_HOME.trim())
448
- : DEFAULT_CODEX_HOME,
449
- 'auth.json'
450
- );
460
+ const authPath = path.join(getCodexHome(), 'auth.json');
451
461
  try {
452
462
  return JSON.parse(fs.readFileSync(authPath, 'utf-8'));
453
463
  } catch { return null; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentlytics",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Comprehensive analytics dashboard for AI coding agents — Cursor, Windsurf, Claude Code, VS Code Copilot, Zed, Antigravity, OpenCode, Command Code",
5
5
  "main": "index.js",
6
6
  "bin": {