@usagefleet/cli 1.2.101 → 1.2.109

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/README.md CHANGED
@@ -58,7 +58,8 @@ shell once. `uninstall` removes both again, and self-update keeps them current.
58
58
  - **Token usage** — Claude Code (`~/.claude/projects/**/*.jsonl`), Claude
59
59
  Desktop agent-mode (Cowork) sessions, and the
60
60
  [pi](https://github.com/badlogic/pi-mono) agent (`~/.pi/agent/sessions`,
61
- Anthropic-provider records only; other providers don't touch Claude limits).
61
+ `anthropic` and `claude-bridge` provider records only; other providers don't
62
+ touch Claude limits).
62
63
  A per-file byte offset in the config file means each line is sent once;
63
64
  rotation and truncation are handled and partial lines are never sent. Delivery
64
65
  is at-least-once — the server dedups on `uuid`.
package/dist/parser.js CHANGED
@@ -21,7 +21,10 @@ function cacheCreation(u) {
21
21
  }
22
22
  /** pi agent session line: `{type:"message", id, timestamp, message:{role:"assistant",
23
23
  * provider, model, responseId, usage:{input, output, cacheRead, cacheWrite}}}`.
24
- * Only provider "anthropic" hits the user's Claude account other providers
24
+ * Only requests that land on the user's Claude subscription count: provider
25
+ * "anthropic" (pi's own client) and "claude-bridge" (the extension that routes
26
+ * through Claude Code's OAuth login, so it burns the same limits — and writes no
27
+ * responseId, so those lines key by id+timestamp). Other providers
25
28
  * (openai-codex, openrouter, …) are skipped. `output` already includes reasoning
26
29
  * tokens (totalTokens = input + output + cacheRead + cacheWrite).
27
30
  * The line carries no working directory; `sessionCwd` comes from the file's
@@ -31,7 +34,7 @@ function parsePiLine(o, sessionCwd) {
31
34
  return null;
32
35
  }
33
36
  const m = o.message;
34
- if (!m || m.role !== 'assistant' || m.provider !== 'anthropic') {
37
+ if (!m || m.role !== 'assistant' || (m.provider !== 'anthropic' && m.provider !== 'claude-bridge')) {
35
38
  return null;
36
39
  }
37
40
  const u = m.usage;
package/dist/release.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by .github/workflows/release.yml.
2
- export const RELEASE_VERSION = "1.2.101";
2
+ export const RELEASE_VERSION = "1.2.109";
package/dist/service.js CHANGED
@@ -63,20 +63,20 @@ export function looksLikeCompiledBinary(scriptPath, execPath) {
63
63
  }
64
64
  return false;
65
65
  }
66
+ function real(p) {
67
+ try {
68
+ return realpathSync(p);
69
+ }
70
+ catch {
71
+ return p;
72
+ }
73
+ }
66
74
  /** The `usagefleet` a shell would run, when that is NOT this install — e.g. the
67
75
  * standalone binary a pre-npm release left in /usr/local/bin, which sits ahead
68
76
  * of the npm prefix on most PATHs and would keep answering after an upgrade.
69
77
  * Only the first hit matters: that is the one the shell picks. */
70
78
  export function shadowingBinary(pathEnv, self) {
71
79
  const name = process.platform === 'win32' ? 'usagefleet.exe' : 'usagefleet';
72
- const real = (p) => {
73
- try {
74
- return realpathSync(p);
75
- }
76
- catch {
77
- return p;
78
- }
79
- };
80
80
  for (const dir of (pathEnv || '').split(delimiter).filter(Boolean)) {
81
81
  const candidate = join(dir, name);
82
82
  if (existsSync(candidate)) {
@@ -85,6 +85,26 @@ export function shadowingBinary(pathEnv, self) {
85
85
  }
86
86
  return null;
87
87
  }
88
+ /** The node path to bake into the service definition. `execPath` is the real
89
+ * binary, and under Homebrew that is a versioned keg
90
+ * (`/opt/homebrew/Cellar/node/26.7.0/bin/node`) which the next `brew upgrade`
91
+ * deletes. The running collector survives on its open file, but the moment it
92
+ * stops launchd can no longer spawn it (EX_CONFIG, penalty box) and the
93
+ * machine silently drops off the fleet until the next `login` — every prompt
94
+ * it sends from then on reads as unattributed. Brew keeps
95
+ * `<prefix>/opt/<formula>` pointing at the formula's current keg, so that name
96
+ * is what survives. Not verified against `execPath`: after an upgrade the two
97
+ * differ by design, and the version brew now links is the one to run. Other
98
+ * managers (nvm, fnm, asdf) keep old versions installed, so their versioned
99
+ * paths are left alone. */
100
+ export function stableNodePath(execPath) {
101
+ const keg = /^(.*)\/Cellar\/(node(?:@[^/]+)?)\/[^/]+\/bin\/node$/.exec(execPath);
102
+ if (!keg) {
103
+ return execPath;
104
+ }
105
+ const stable = join(keg[1], 'opt', keg[2], 'bin', 'node');
106
+ return existsSync(stable) ? stable : execPath;
107
+ }
88
108
  /** Program + leading args to launch `watch`. npm installs a script, so this is
89
109
  * normally an absolute node plus the global package path — both survive PATH
90
110
  * being nearly empty, which is what launchd and systemd hand the service. */
@@ -95,7 +115,7 @@ function programArgs() {
95
115
  // re-invokable script, so the service launches the executable itself.
96
116
  return [process.execPath, 'watch'];
97
117
  }
98
- return [process.execPath, script, 'watch'];
118
+ return [stableNodePath(process.execPath), script, 'watch'];
99
119
  }
100
120
  function macPlistPath() {
101
121
  return join(homedir(), 'Library', 'LaunchAgents', `${LABEL}.plist`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usagefleet/cli",
3
- "version": "1.2.101",
3
+ "version": "1.2.109",
4
4
  "description": "Tails Claude Code, Claude Desktop, and pi agent JSONL logs and reports token usage to a UsageFleet server.",
5
5
  "keywords": [
6
6
  "claude",