getaimeter 0.7.8 → 0.8.0

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/package.json +1 -1
  2. package/tray.ps1 +9 -4
  3. package/watcher.js +18 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getaimeter",
3
- "version": "0.7.8",
3
+ "version": "0.8.0",
4
4
  "description": "Track AI coding costs across Claude, Cursor, Codex, and Gemini. Optimization recommendations that cut costs by 30%.",
5
5
  "bin": {
6
6
  "aimeter": "cli.js"
package/tray.ps1 CHANGED
@@ -55,10 +55,15 @@ $dashboard.Add_Click({ Start-Process "https://getaimeter.com/dashboard" })
55
55
  $logs = $menu.Items.Add("View Logs")
56
56
  $viewerScript = Join-Path (Split-Path $MyInvocation.MyCommand.Path) 'log-viewer.ps1'
57
57
  $logs.Add_Click({
58
- $vbsCmd = "CreateObject(""WScript.Shell"").Run ""powershell -NoProfile -ExecutionPolicy Bypass -STA -WindowStyle Hidden -File """"$viewerScript"""" -LogPath """"$LogPath"""""", 0, False"
59
- $tempVbs = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'aimeter-logviewer.vbs')
60
- [System.IO.File]::WriteAllText($tempVbs, $vbsCmd)
61
- Start-Process 'wscript' -ArgumentList @($tempVbs) -WindowStyle Hidden
58
+ # Launch log viewer directly via PowerShell avoids VBS quoting issues with paths containing spaces
59
+ Start-Process "powershell" -ArgumentList @(
60
+ "-NoProfile",
61
+ "-ExecutionPolicy", "Bypass",
62
+ "-STA",
63
+ "-WindowStyle", "Hidden",
64
+ "-File", $viewerScript,
65
+ "-LogPath", $LogPath
66
+ ) -WindowStyle Hidden
62
67
  })
63
68
 
64
69
  $menu.Items.Add("-")
package/watcher.js CHANGED
@@ -75,8 +75,24 @@ function detectSource(filePath) {
75
75
  return 'gemini_cli';
76
76
  }
77
77
  if (normalized.includes('.codex/') || normalized.includes('/codex/')) {
78
- _sourceCache.set(filePath, 'codex_cli');
79
- return 'codex_cli';
78
+ // Codex sessions may come from CLI or VS Code extension.
79
+ // Read session_meta to check originator/source field.
80
+ let codexSource = 'codex_cli';
81
+ try {
82
+ const fd = fs.openSync(filePath, 'r');
83
+ const buf = Buffer.alloc(Math.min(2048, fs.fstatSync(fd).size));
84
+ fs.readSync(fd, buf, 0, buf.length, 0);
85
+ fs.closeSync(fd);
86
+ const firstLine = buf.toString('utf8').split('\n')[0];
87
+ const meta = JSON.parse(firstLine);
88
+ if (meta.type === 'session_meta' && meta.payload) {
89
+ if (meta.payload.source === 'vscode' || meta.payload.originator === 'codex_vscode') {
90
+ codexSource = 'codex_vscode';
91
+ }
92
+ }
93
+ } catch {}
94
+ _sourceCache.set(filePath, codexSource);
95
+ return codexSource;
80
96
  }
81
97
  if (normalized.includes('/Cursor/') || normalized.includes('/cursor/') || normalized.includes('.cursor/')) {
82
98
  _sourceCache.set(filePath, 'cursor');