codexmeter 1.0.2 → 1.0.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.
package/dist/index.html CHANGED
@@ -7,8 +7,8 @@
7
7
  <link rel="preconnect" href="https://fonts.googleapis.com" />
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
10
- <script type="module" crossorigin src="/assets/index-M87czq50.js"></script>
11
- <link rel="stylesheet" crossorigin href="/assets/index-C0qLYGUY.css">
10
+ <script type="module" crossorigin src="/assets/index-_br3iqvd.js"></script>
11
+ <link rel="stylesheet" crossorigin href="/assets/index-DhDq9dI8.css">
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexmeter",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Local telemetry dashboard for Codex CLI usage",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,6 +17,7 @@
17
17
  "scripts": {
18
18
  "dev": "node dev-runner.js",
19
19
  "build": "vite build",
20
+ "test": "node --test test/*.test.js",
20
21
  "start": "node bin/codexmeter.js",
21
22
  "preview": "npm run build && node bin/codexmeter.js",
22
23
  "prepublishOnly": "npm run build"
@@ -73,7 +73,7 @@ function buildOverview(rawSessions, groupedSessions, d7, d30) {
73
73
  d30: groupedSessions.filter(session => overlapsLowerBound(session, d30)),
74
74
  };
75
75
 
76
- const calc = (arr, groupedArr) => {
76
+ const calc = (arr, groupedArr, lowerBound = 0) => {
77
77
  let tokens = 0, cost = 0, elapsed = 0, priced = 0, exactPriced = 0, heuristicPriced = 0, unpriced = 0, timeValid = 0, enriched = 0;
78
78
  const repoSet = new Set(), modelSet = new Set();
79
79
  let earliest = Infinity, latest = -Infinity;
@@ -101,6 +101,10 @@ function buildOverview(rawSessions, groupedSessions, d7, d30) {
101
101
  }
102
102
  }
103
103
 
104
+ const boundedFrom = earliest === Infinity
105
+ ? null
106
+ : Math.max(earliest, lowerBound || 0);
107
+
104
108
  return {
105
109
  total_tokens: tokens,
106
110
  total_cost: cost,
@@ -108,7 +112,7 @@ function buildOverview(rawSessions, groupedSessions, d7, d30) {
108
112
  active_repos: repoSet.size,
109
113
  active_models: modelSet.size,
110
114
  total_elapsed_seconds: elapsed,
111
- date_range: { from: earliest === Infinity ? null : earliest, to: latest === -Infinity ? null : latest },
115
+ date_range: { from: boundedFrom, to: latest === -Infinity ? null : latest },
112
116
  coverage: {
113
117
  total: arr.length,
114
118
  thread_rows: arr.length,
@@ -124,9 +128,9 @@ function buildOverview(rawSessions, groupedSessions, d7, d30) {
124
128
  };
125
129
 
126
130
  return {
127
- total: calc(rawBuckets.total, groupedBuckets.total),
128
- d7: calc(rawBuckets.d7, groupedBuckets.d7),
129
- d30: calc(rawBuckets.d30, groupedBuckets.d30),
131
+ total: calc(rawBuckets.total, groupedBuckets.total, 0),
132
+ d7: calc(rawBuckets.d7, groupedBuckets.d7, d7),
133
+ d30: calc(rawBuckets.d30, groupedBuckets.d30, d30),
130
134
  cost_assumptions: CACHE_ASSUMPTIONS,
131
135
  };
132
136
  }
@@ -30,7 +30,7 @@ export function beginReplayCapture(replay, ingestId, bootstrapPayload) {
30
30
  replay.events.push({
31
31
  event: 'bootstrap',
32
32
  at_ms: 0,
33
- payload: clonePayload(bootstrapPayload),
33
+ payload: bootstrapPayload,
34
34
  });
35
35
  }
36
36
 
@@ -40,7 +40,7 @@ export function recordReplayEvent(replay, event, payload) {
40
40
  replay.events.push({
41
41
  event,
42
42
  at_ms: Math.max(0, Date.now() - replay.started_at_ms),
43
- payload: clonePayload(payload),
43
+ payload,
44
44
  });
45
45
  if (event === 'complete') {
46
46
  replay.active = false;