getaimeter 0.11.0 → 0.11.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 (3) hide show
  1. package/config.js +6 -7
  2. package/package.json +1 -1
  3. package/watcher.js +11 -0
package/config.js CHANGED
@@ -68,13 +68,12 @@ function getWatchPaths() {
68
68
  }
69
69
  if (fs.existsSync(desktopSessions)) paths.push(desktopSessions);
70
70
 
71
- // 3. OpenAI Codex CLI sessions
72
- const codexSessions = path.join(os.homedir(), '.codex', 'sessions');
73
- if (fs.existsSync(codexSessions)) paths.push(codexSessions);
74
-
75
- // Also watch ~/.codex/history.jsonl directly (Codex writes a single file)
76
- const codexHistory = path.join(os.homedir(), '.codex');
77
- if (fs.existsSync(codexHistory) && !paths.includes(codexHistory)) paths.push(codexHistory);
71
+ // 3. OpenAI Codex CLI — watch the root ~/.codex dir so findJsonlFiles recurses
72
+ // into both sessions/ (per-session UUIDs) and history.jsonl (single flat file).
73
+ // Previously both ~/.codex and ~/.codex/sessions were added separately, causing
74
+ // the same files to be discovered twice per poll cycle.
75
+ const codexDir = path.join(os.homedir(), '.codex');
76
+ if (fs.existsSync(codexDir)) paths.push(codexDir);
78
77
 
79
78
  // 4. GitHub Copilot CLI sessions
80
79
  const copilotSessions = path.join(os.homedir(), '.copilot', 'session-state');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getaimeter",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Track AI coding costs across Claude, Cursor, Codex, Copilot, and Gemini. MCP server, billing blocks, optimization recommendations.",
5
5
  "bin": {
6
6
  "aimeter": "cli.js",
package/watcher.js CHANGED
@@ -162,6 +162,17 @@ function getConversationMeta(filePath) {
162
162
  // Conversation ID = file basename without extension
163
163
  let conversationId = path.basename(filePath, '.jsonl');
164
164
 
165
+ // Copilot stores sessions as <session-UUID>/events.jsonl — all files are named
166
+ // "events.jsonl", so the basename is always "events" which collides across sessions.
167
+ // Use the parent directory UUID as the conversation ID instead.
168
+ if (conversationId === 'events') {
169
+ const parentDir = path.basename(path.dirname(filePath));
170
+ // Only override if parent looks like a UUID (avoids false positives)
171
+ if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(parentDir)) {
172
+ conversationId = parentDir;
173
+ }
174
+ }
175
+
165
176
  // For subagent files, use the parent session UUID as conversation ID
166
177
  const subagentMatch = normalized.match(/\/([^/]+)\/subagents\//);
167
178
  if (subagentMatch) {