claude-rpc 0.24.0 → 0.24.1

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.24.0",
3
+ "version": "0.24.1",
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/insights.js CHANGED
@@ -274,22 +274,26 @@ export function generateInsights(aggregate, opts = {}) {
274
274
 
275
275
  if (!C.length) return ['Not enough data yet — keep coding and check back tomorrow.'];
276
276
 
277
- // Weight + seeded jitter: headlines (≥90) reliably lead; the mid-tier rotates
278
- // so repeat runs surface a fresh mix. Default seed = clock fresh each run.
277
+ // Weighted random draw WITHOUT replacement. Weight sets how often (and how
278
+ // early) a line tends to surface, but every run is a genuinely fresh mix
279
+ // including the top line — rather than the same weight-sorted five. Default
280
+ // seed = clock → fresh each run; pass opts.seed for a deterministic order.
281
+ // Topic keeps near-duplicates (two streak lines, etc.) out of the same draw.
279
282
  const rand = rng(opts.seed != null ? opts.seed : Date.now());
280
- for (const c of C) c.score = c.w + rand() * 22;
281
- C.sort((x, y) => y.score - x.score);
282
-
283
- // Take the top `limit`, but at most one line per topic so near-duplicates
284
- // (two streak lines, peak-weekday + weekday-rhythm) never appear together.
285
283
  const limit = opts.limit ?? 5;
284
+ const pool = C.slice();
286
285
  const seen = new Set();
287
286
  const out = [];
288
- for (const c of C) {
287
+ while (out.length < limit && pool.length) {
288
+ let total = 0;
289
+ for (const c of pool) total += c.w;
290
+ let r = rand() * total;
291
+ let idx = 0;
292
+ while (idx < pool.length - 1 && (r -= pool[idx].w) > 0) idx++;
293
+ const [c] = pool.splice(idx, 1);
289
294
  if (c.topic && seen.has(c.topic)) continue;
290
295
  if (c.topic) seen.add(c.topic);
291
296
  out.push(c.text);
292
- if (out.length >= limit) break;
293
297
  }
294
298
  return out;
295
299
  }
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.24.0';
14
+ const BAKED = '0.24.1';
15
15
 
16
16
  function readPkgVersion() {
17
17
  try {