claude-rpc 0.13.3 → 0.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-rpc",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "description": "Discord Rich Presence for Claude Code — live model, project, tokens, and lifetime stats driven by Claude Code's hook system.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/community.js CHANGED
@@ -53,6 +53,15 @@ export function osFamily() {
53
53
  return 'linux';
54
54
  }
55
55
 
56
+ // Per-report caps. These mirror the worker's validateReport limits — the
57
+ // client CLAMPS each delta to them so a large first-time backfill (a heavy
58
+ // user's whole lifetime total on the very first report) STREAMS over multiple
59
+ // flushes instead of being rejected. Without this, anyone with >5B lifetime
60
+ // tokens would 400 forever (the cursor never advances on a rejected report) and
61
+ // be silently dropped from the community totals.
62
+ const MAX_REPORT_SESSIONS = 100_000;
63
+ const MAX_REPORT_TOKENS = 5_000_000_000;
64
+
56
65
  // Pure: given an aggregate and a cursor, produce the next payload. The
57
66
  // worker's validateReport must accept this shape; if you add a field
58
67
  // here, add it there too.
@@ -64,8 +73,8 @@ export function buildPayload(aggregate, cursor, { instanceId, now = Date.now() }
64
73
  + (aggregate?.cacheWriteTokens || 0);
65
74
  return {
66
75
  instanceId,
67
- sessionsDelta: Math.max(0, sessions - (cursor.sessions || 0)),
68
- tokensDelta: Math.max(0, tokens - (cursor.tokens || 0)),
76
+ sessionsDelta: Math.min(MAX_REPORT_SESSIONS, Math.max(0, sessions - (cursor.sessions || 0))),
77
+ tokensDelta: Math.min(MAX_REPORT_TOKENS, Math.max(0, tokens - (cursor.tokens || 0))),
69
78
  version: VERSION,
70
79
  osFamily: osFamily(),
71
80
  ts: now,
package/src/version.js CHANGED
@@ -11,7 +11,7 @@ import { readFileSync } from 'node:fs';
11
11
  import { join } from 'node:path';
12
12
  import { ROOT } from './paths.js';
13
13
 
14
- const BAKED = '0.13.3';
14
+ const BAKED = '0.13.4';
15
15
 
16
16
  function readPkgVersion() {
17
17
  try {