tokmon 0.8.2 → 0.9.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 (2) hide show
  1. package/dist/cli.js +9 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -96,6 +96,7 @@ async function parseFile(path, since) {
96
96
  const u = obj.message.usage;
97
97
  entries.push({
98
98
  ts,
99
+ msgId: obj.message.id ?? "",
99
100
  model: obj.message.model ?? "unknown",
100
101
  cost: costOf(obj.message.model ?? "", u),
101
102
  input: u.input_tokens ?? 0,
@@ -138,7 +139,14 @@ async function loadEntries(since) {
138
139
  }
139
140
  }));
140
141
  }
141
- return chunks.flat();
142
+ const all = chunks.flat();
143
+ const seenIds = /* @__PURE__ */ new Set();
144
+ return all.filter((e) => {
145
+ if (!e.msgId) return true;
146
+ if (seenIds.has(e.msgId)) return false;
147
+ seenIds.add(e.msgId);
148
+ return true;
149
+ });
142
150
  }
143
151
  function sum(entries) {
144
152
  let cost = 0, tokens2 = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokmon",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "Terminal dashboard for Claude Code usage and costs",
5
5
  "type": "module",
6
6
  "bin": {