claude-rpc 0.15.5 → 0.15.6

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.15.5",
3
+ "version": "0.15.6",
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/cli.js CHANGED
@@ -29,7 +29,7 @@ import { VERSION } from './version.js';
29
29
  import { fail, tailLines, heat, sparkline, fmtDelta, topPercentile, EX_USER_ERROR, EX_BAD_STATE, EX_SYS_ERROR } from './ui.js';
30
30
  import { randomUUID } from 'node:crypto';
31
31
  import { createInterface } from 'node:readline';
32
- import { basename } from 'node:path';
32
+ import { basename, join } from 'node:path';
33
33
 
34
34
  const cmd = process.argv[2];
35
35
 
@@ -1849,14 +1849,33 @@ const packagedDefault = IS_PACKAGED && !cmd;
1849
1849
  try {
1850
1850
  if (IS_NPX) {
1851
1851
  // Our own tree is npm's throwaway _npx cache; launch from the global
1852
- // install setup just promoted to, via the PATH-resolved bin.
1852
+ // install setup just promoted to. The global copy must be resolved
1853
+ // EXPLICITLY (npm root -g): inside an npx run, PATH has the _npx
1854
+ // cache's .bin first, so a bare `claude-rpc` resolves right back
1855
+ // into the cache we're escaping. And it must be spawned as a direct
1856
+ // `node <script>` child — a shell+shim chain (cmd → .cmd → node)
1857
+ // only hides the FIRST hop's window; the detached cmd loses its
1858
+ // console, the grandchild node allocates a fresh one, and Windows 11
1859
+ // pops it as a visible Windows Terminal window whose closure kills
1860
+ // the daemon.
1853
1861
  if (!daemonPid()) {
1854
- const child = spawn('claude-rpc', ['daemon'], {
1862
+ let script = null;
1863
+ try {
1864
+ const r = spawnSync('npm', ['root', '-g'], {
1865
+ encoding: 'utf8', timeout: 8000, windowsHide: true,
1866
+ shell: process.platform === 'win32', // npm is npm.cmd on Windows
1867
+ });
1868
+ const root = (r.stdout || '').trim();
1869
+ const candidate = root && join(root, 'claude-rpc', 'src', 'daemon.js');
1870
+ if (candidate && existsSync(candidate)) script = candidate;
1871
+ } catch { /* npm unavailable → fall back below */ }
1872
+ // Fallback: run from this (npx) tree. Still invisible — only the
1873
+ // npx-cache-eviction caveat remains, healed by the next setup.
1874
+ const child = spawn(process.execPath, [script || DAEMON_SCRIPT], {
1855
1875
  detached: true, stdio: 'ignore', windowsHide: true,
1856
- shell: process.platform === 'win32',
1857
1876
  });
1858
1877
  child.unref();
1859
- console.log(` ${c.green}✓${c.reset} ${'daemon launched'.padEnd(16)}${c.dim}log ${shortPath(LOG_PATH)}${c.reset}`);
1878
+ console.log(` ${c.green}✓${c.reset} ${'daemon launched'.padEnd(16)}${c.dim}pid ${c.reset}${c.cyan}${child.pid}${c.reset}${c.dim} · log ${shortPath(LOG_PATH)}${c.reset}`);
1860
1879
  } else {
1861
1880
  console.log(` ${c.cyan}·${c.reset} ${'daemon running'.padEnd(16)}${c.dim}pid ${daemonPid()}${c.reset}`);
1862
1881
  }
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.15.5';
14
+ const BAKED = '0.15.6';
15
15
 
16
16
  function readPkgVersion() {
17
17
  try {