claude-rpc 1.4.1 → 1.4.3

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/SECURITY.md CHANGED
@@ -218,6 +218,23 @@ non-interactive setups are never asked. There is no private identity tier:
218
218
  the only way claude-rpc ever learns a GitHub identity is this same public,
219
219
  consented profile flow.
220
220
 
221
+ **Background retry of a consented verification (v1.4.3).** Answering **y**
222
+ (or running `profile verify`) records a local `profile.verifyPending` marker
223
+ before any network step. If the server can't confirm the verification right
224
+ then, the daemon retries the *same* gist flow in the background after its
225
+ profile flush — backing off from 30 minutes to 12 hours, reusing one proof
226
+ gist rather than publishing new ones, and going quiet after 14 days (the
227
+ marker keeps `gaveUpAt`; `profile verify` restarts it). It only ever proves the
228
+ GitHub login you connected: if the `gh` CLI is logged out or has switched to a
229
+ different account, it waits and sends nothing. `profile off` pauses it;
230
+ `link` or a successful verify clears it. Upgrading from 1.4.0–1.4.2 infers the
231
+ marker only for installs whose config shows setup's yes-path (asked, a GitHub
232
+ login stored, publishing on, never verified) — the installs whose connect
233
+ failed during the 2026-08-20 → 09-11 server outage. The retry adds two
234
+ optional fields to `/verify/check` — `resumed: true` and `pendingSince` (the
235
+ local consent timestamp) — which the worker uses only to back-date an
236
+ internal, non-public `verifiedAt` stamp.
237
+
221
238
  **Claude Wrapped (opt-in one-shot, never automatic).** `claude-rpc wrapped
222
239
  --publish` publishes a year-in-review blob under your profile handle to
223
240
  `<endpoint>/wrapped`, rendered at `claude-rpc.com/wrapped/<handle>`. It never
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-rpc",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
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",
@@ -31,7 +31,7 @@
31
31
  "prep:dashboard": "node ./scripts/prep-dashboard.js",
32
32
  "dist:mac": "npm run build:exe && npm run prep:dashboard && npm --prefix dashboard run dist:mac",
33
33
  "dist:win": "npm run build:exe && npm run prep:dashboard && npm --prefix dashboard run dist:win",
34
- "test": "node --test test/*.test.js",
34
+ "test": "node ./scripts/run-tests.mjs",
35
35
  "lint": "eslint src test vscode-extension",
36
36
  "format": "prettier --write \"src/**/*.js\" \"test/**/*.js\"",
37
37
  "format:check": "prettier --check \"src/**/*.js\" \"test/**/*.js\"",
@@ -0,0 +1,46 @@
1
+ // Windows can transiently refuse a rename onto an existing path — EPERM (or
2
+ // occasionally EBUSY/EACCES) — while something else briefly holds a handle
3
+ // on the destination: AV/Search-Indexer scans, or (confirmed live in CI) a
4
+ // directory being watched via fs.watch/ReadDirectoryChangesW, which every
5
+ // file this guards (state.json, the scan cache, aggregate.json) sits under.
6
+ // POSIX rename() is atomic and doesn't contend like this, so this is a
7
+ // no-op there. The lock is held single-digit milliseconds; a handful of
8
+ // immediate retries clears it without changing behavior anywhere else.
9
+ import { renameSync } from 'node:fs';
10
+
11
+ const RETRY_CODES = new Set(['EPERM', 'EBUSY', 'EACCES']);
12
+ const MAX_ATTEMPTS = 5;
13
+ const RETRY_DELAY_MS = 20;
14
+
15
+ // Blocks the calling thread synchronously — the standard dependency-free way
16
+ // to sleep inside a sync call. Best-effort: if SharedArrayBuffer is ever
17
+ // unavailable, the retry loop just spins with no delay instead of failing.
18
+ function sleepSync(ms) {
19
+ try {
20
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
21
+ } catch {
22
+ /* no SharedArrayBuffer — retry immediately instead */
23
+ }
24
+ }
25
+
26
+ // Drop-in for fs.renameSync that tolerates Windows' transient rename locks.
27
+ // `platform`/`rename`/`sleep` are injectable so the retry loop is testable
28
+ // without a real Windows filesystem.
29
+ export function renameSyncRetry(src, dest, {
30
+ platform = process.platform,
31
+ rename = renameSync,
32
+ sleep = sleepSync,
33
+ } = {}) {
34
+ if (platform !== 'win32') return rename(src, dest);
35
+ let lastErr;
36
+ for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
37
+ try {
38
+ return rename(src, dest);
39
+ } catch (e) {
40
+ lastErr = e;
41
+ if (!RETRY_CODES.has(e.code)) throw e;
42
+ sleep(RETRY_DELAY_MS);
43
+ }
44
+ }
45
+ throw lastErr;
46
+ }
package/src/cli.js CHANGED
@@ -1680,8 +1680,9 @@ async function doLink(argv) {
1680
1680
  // local handle or an explicit enabled:false is always respected.
1681
1681
  const userCfg = readJson(CONFIG_PATH, {});
1682
1682
  const prevProfile = userCfg.profile || {};
1683
+ const { verifyPending: _linked, ...prevRest } = prevProfile; // a link completes any pending gist verification
1683
1684
  userCfg.profile = {
1684
- ...prevProfile,
1685
+ ...prevRest,
1685
1686
  githubUser: r.json.githubUser,
1686
1687
  verified: true,
1687
1688
  ...(prevProfile.handle ? {} : { handle: r.json.handle }),
@@ -1902,6 +1903,10 @@ function profileStatus() {
1902
1903
  // for terminals with no browser nearby.
1903
1904
  if (!steps[2].done) {
1904
1905
  lines.push('');
1906
+ const vp = p.verifyPending;
1907
+ if (vp && typeof vp === 'object' && !vp.gaveUpAt) {
1908
+ lines.push(`${c.yellow}…${c.reset} ${c.dim}a GitHub verification you started is pending — the daemon retries it automatically${vp.lastError ? ` (last: ${vp.lastError})` : ''}${c.reset}`);
1909
+ }
1905
1910
  lines.push(`${c.dim}the code comes from${c.reset} ${c.cyan}claude-rpc link${c.reset} ${c.dim}on a machine you already verified${c.reset}`);
1906
1911
  lines.push(`${c.dim}first machine? log in at${c.reset} ${c.cyan}${LINK_PAGE}${c.reset} ${c.dim}— or no browser:${c.reset} ${c.cyan}claude-rpc profile verify${c.reset}`);
1907
1912
  }
@@ -2003,19 +2008,21 @@ async function profilePublish() {
2003
2008
 
2004
2009
  // The gist-verification dance shared by `profile verify` and setup's optional
2005
2010
  // GitHub-connect question: worker token → public proof gist → worker check →
2006
- // persist the verified identity locally. Prints its own progress lines (they
2007
- // read the same in both contexts) and returns { ok, who } on success. It never
2008
- // exits: hard failures come back as { ok: false, fatal: {label, hint, code} }
2009
- // so profileVerify can fail() loudly while setup — where the whole step is
2010
- // optional — shrugs and finishes the install.
2011
+ // persist the verified identity locally (core in src/verify.js, shared with the
2012
+ // daemon's background resume). Prints its own progress lines (they read the
2013
+ // same in both contexts) and returns { ok, who } on success. It never exits:
2014
+ // hard failures come back as { ok: false, fatal: {label, hint, code} } so
2015
+ // profileVerify can fail() loudly while setup — where the whole step is
2016
+ // optional — shrugs and finishes the install. Callers record consent
2017
+ // (withVerifyIntent) first, so a failure here leaves a pending marker the
2018
+ // daemon keeps retrying.
2011
2019
  async function gistVerifyDance(cfg) {
2012
2020
  const profile = cfg.profile || {};
2013
2021
  const community = cfg.community || {};
2014
2022
  if (!community.instanceId) {
2015
2023
  return { ok: false, fatal: { label: 'enable the profile first', hint: 'claude-rpc profile on', code: EX_BAD_STATE } };
2016
2024
  }
2017
- const endpoint = (community.endpoint || '').replace(/\/+$/, '');
2018
- if (!endpoint) {
2025
+ if (!(community.endpoint || '').replace(/\/+$/, '')) {
2019
2026
  return { ok: false, fatal: {
2020
2027
  label: 'no community endpoint configured',
2021
2028
  hint: 'config.json is missing community.endpoint — re-run `claude-rpc setup` to restore the default',
@@ -2023,67 +2030,57 @@ async function gistVerifyDance(cfg) {
2023
2030
  } };
2024
2031
  }
2025
2032
 
2026
- const post = async (path, body) => {
2027
- const res = await fetch(endpoint + path, {
2028
- method: 'POST',
2029
- headers: { 'Content-Type': 'application/json' },
2030
- body: JSON.stringify(body),
2031
- });
2032
- return { status: res.status, json: await res.json().catch(() => ({})) };
2033
- };
2034
-
2035
- try {
2036
- // Make sure the profile row exists server-side before we verify it, so
2037
- // verification works regardless of whether `profile publish` was run first.
2038
- if (lb.profileIsPublishable(profile)) {
2033
+ // Make sure the profile row exists server-side before we verify it, so
2034
+ // verification works regardless of whether `profile publish` was run first.
2035
+ if (lb.profileIsPublishable(profile)) {
2036
+ try {
2039
2037
  const { flushProfile } = await import('./community.js');
2040
2038
  await flushProfile(cfg);
2039
+ } catch { /* the check below reports a missing row */ }
2040
+ }
2041
+ const { runGistVerify, markVerifiedLocally, updateUserConfig } = await import('./verify.js');
2042
+ const pending = readJson(CONFIG_PATH, {}).profile?.verifyPending;
2043
+ const r = await runGistVerify(cfg, {
2044
+ onStep: (msg) => console.log(` ${c.dim}${msg}…${c.reset}`),
2045
+ gistId: pending?.gistId || null,
2046
+ pendingSince: pending?.since ?? null,
2047
+ resumed: !!pending,
2048
+ });
2049
+ if (r.ok) {
2050
+ const who = r.githubUser;
2051
+ markVerifiedLocally(who);
2052
+ console.log(` ${c.green}✓${c.reset} verified as ${c.cyan}@${who}${c.reset} — you'll show the ✓ on the board`);
2053
+ if (who && profile.githubUser && who.toLowerCase() !== profile.githubUser.toLowerCase()) {
2054
+ console.log(` ${c.dim}(your gist is owned by @${who}, so the profile now uses that account)${c.reset}`);
2041
2055
  }
2042
- console.log(` ${c.dim}requesting a verification token…${c.reset}`);
2043
- const start = await post('/verify/start', { instanceId: community.instanceId, githubUser: profile.githubUser || null });
2044
- if (!start.json?.token) {
2045
- return { ok: false, fatal: { label: `verify/start failed: ${start.json?.error || start.status}`, code: EX_SYS_ERROR } };
2046
- }
2047
- const token = start.json.token;
2048
-
2049
- const { publishGistFile } = await import('./gist.js');
2050
- console.log(` ${c.dim}publishing a public proof gist…${c.reset}`);
2051
- const gist = await publishGistFile({
2052
- svg: `claude-rpc leaderboard verification\n${token}\n`,
2053
- filename: 'claude-rpc-verify.txt',
2054
- description: 'claude-rpc profile verification',
2055
- isPublic: true,
2056
+ return { ok: true, who };
2057
+ }
2058
+ // Remember the proof gist so a retry (ours or the daemon's) edits it
2059
+ // instead of publishing another one.
2060
+ if (r.gistId) {
2061
+ updateUserConfig((u) => {
2062
+ if (!u.profile?.verifyPending) return false;
2063
+ u.profile.verifyPending = { ...u.profile.verifyPending, gistId: r.gistId };
2056
2064
  });
2057
-
2058
- // Hand the worker the gist ID so it fetches that gist directly (no
2059
- // gist-list lag) and reads the real owner — instant, and the owner becomes
2060
- // the verified identity regardless of what --github was set to.
2061
- console.log(` ${c.dim}confirming with the server…${c.reset}`);
2062
- const check = await post('/verify/check', { instanceId: community.instanceId, gistId: gist.id });
2063
- if (check.json?.verified) {
2064
- const who = check.json.githubUser || gist.owner || profile.githubUser;
2065
- // Persist the authoritative owner + a local verified marker so the
2066
- // profile checklist and future publishes match what got verified.
2067
- const userCfg = readJson(CONFIG_PATH, {});
2068
- userCfg.profile = { ...(userCfg.profile || {}), ...(who ? { githubUser: who } : {}), verified: true };
2069
- writeUserConfig(userCfg);
2070
- console.log(` ${c.green}✓${c.reset} verified as ${c.cyan}@${who}${c.reset} — you'll show the ✓ on the board`);
2071
- if (who && profile.githubUser && who.toLowerCase() !== profile.githubUser.toLowerCase()) {
2072
- console.log(` ${c.dim}(your gist is owned by @${who}, so the profile now uses that account)${c.reset}`);
2073
- }
2074
- return { ok: true, who };
2075
- }
2065
+ }
2066
+ if (r.stage === 'check' && r.status >= 400 && r.status < 500) {
2076
2067
  // Soft outcome (matches historical behavior): the message tells the user
2077
2068
  // how to finish, and the process still exits 0.
2078
- console.log(` ${c.yellow}!${c.reset} not confirmed: ${check.json?.error || check.status}`);
2069
+ console.log(` ${c.yellow}!${c.reset} not confirmed: ${r.error}`);
2079
2070
  console.log(` ${c.dim}↳ make sure the gist is public, then re-run ${c.reset}${c.cyan}claude-rpc profile verify${c.reset}`);
2080
2071
  return { ok: false };
2081
- } catch (e) {
2072
+ }
2073
+ if (r.stage === 'gist') {
2082
2074
  return { ok: false, fatal: {
2083
- label: `verification failed: ${e.message}`,
2075
+ label: `verification failed: ${r.error}`,
2084
2076
  hint: 'needs `gh` logged in or GH_TOKEN with gist scope', code: EX_SYS_ERROR,
2085
2077
  } };
2086
2078
  }
2079
+ return { ok: false, fatal: {
2080
+ label: `${r.stage === 'start' ? 'verify/start' : 'verify/check'} failed: ${r.error}`,
2081
+ hint: 'the server may be having trouble — the daemon retries this automatically in the background',
2082
+ code: EX_SYS_ERROR,
2083
+ } };
2087
2084
  }
2088
2085
 
2089
2086
  // GitHub verification: ask the worker for a one-time token, publish it in a
@@ -2097,7 +2094,12 @@ async function profileVerify() {
2097
2094
  if (!cfg.profile?.githubUser) {
2098
2095
  console.log(` ${c.dim}no --github set — your verified identity will be the account that owns the proof gist${c.reset}`);
2099
2096
  }
2100
- const r = await gistVerifyDance(cfg);
2097
+ if (cfg.community?.instanceId) {
2098
+ // Consent to verify; if the server can't finish it now, the daemon retries.
2099
+ const { withVerifyIntent } = await import('./verify.js');
2100
+ writeUserConfig(withVerifyIntent(readJson(CONFIG_PATH, {})));
2101
+ }
2102
+ const r = await gistVerifyDance(loadConfig());
2101
2103
  if (r.fatal) return fail(r.fatal.label, { hint: r.fatal.hint || '', code: r.fatal.code });
2102
2104
  }
2103
2105
 
@@ -2149,8 +2151,12 @@ async function setupGhConnect() {
2149
2151
  console.log(` ${c.yellow}!${c.reset} couldn't derive a handle from @${login} — run ${c.cyan}claude-rpc profile set --handle <you>${c.reset} then ${c.cyan}claude-rpc profile verify${c.reset}`);
2150
2152
  return;
2151
2153
  }
2154
+ // The y above is consent to the whole flow, so record it before any network
2155
+ // step: if the server can't finish it now, the daemon retries in the
2156
+ // background (src/verify.js) instead of the install sitting unverified.
2152
2157
  userCfg.profile = { ...userCfg.profile, handle, githubUser: login, enabled: true };
2153
- writeUserConfig(userCfg);
2158
+ const { withVerifyIntent } = await import('./verify.js');
2159
+ writeUserConfig(withVerifyIntent(userCfg));
2154
2160
  console.log(` ${c.dim}connecting as ${c.reset}${c.cyan}@${login}${c.reset}${c.dim} — handle ${c.reset}${c.cyan}${handle}${c.reset}`);
2155
2161
 
2156
2162
  // A fresh install has no aggregate yet; publish real totals, not zeros.
@@ -2164,7 +2170,7 @@ async function setupGhConnect() {
2164
2170
  console.log(` ${c.green}✓${c.reset} you're live at ${c.cyan}https://claude-rpc.com/u/${encodeURIComponent(handle)}${c.reset}`);
2165
2171
  } else {
2166
2172
  if (r.fatal) console.log(` ${c.yellow}!${c.reset} ${r.fatal.label}`);
2167
- console.log(` ${c.dim}↳ setup itself is done — retry with ${c.reset}${c.cyan}claude-rpc profile verify${c.reset}`);
2173
+ console.log(` ${c.dim}↳ setup itself is done — the daemon keeps retrying this in the background, or run ${c.reset}${c.cyan}claude-rpc profile verify${c.reset}`);
2168
2174
  }
2169
2175
  }
2170
2176
 
package/src/daemon.js CHANGED
@@ -943,6 +943,13 @@ async function runCommunityFlush() {
943
943
  } else if (!pr.ok && pr.reason !== 'rate-limited' && pr.reason !== 'disabled') {
944
944
  log(`profile: ${pr.reason}${pr.error ? ' (' + pr.error + ')' : ''}`);
945
945
  }
946
+ // A GitHub connect the user said yes to but the server never confirmed
947
+ // (e.g. the Aug–Sep 2026 KV write-cap outage) — finish it now that the
948
+ // row just published. Self-scheduling and a no-op without a pending marker.
949
+ if (pr.ok && config.profile?.verifyPending) {
950
+ const { resumePendingVerify } = await import('./verify.js');
951
+ await resumePendingVerify(config, { log });
952
+ }
946
953
  }
947
954
  } catch (e) {
948
955
  log('community/profile flush threw:', e.message);
@@ -184,29 +184,46 @@ export class Client extends EventEmitter {
184
184
  this._decode = null;
185
185
  }
186
186
 
187
+ // Try one candidate path; resolves the connected socket, or null on
188
+ // error/timeout. Never rejects — callers race/sequence these freely.
189
+ _tryConnect(p) {
190
+ return new Promise((resolve) => {
191
+ const s = net.createConnection(p);
192
+ let timer = null;
193
+ const cleanup = () => {
194
+ clearTimeout(timer);
195
+ s.removeListener('connect', onOk);
196
+ s.removeListener('error', onErr);
197
+ };
198
+ const onErr = () => { cleanup(); resolve(null); };
199
+ const onOk = () => { cleanup(); resolve(s); };
200
+ // A peer that accepts then stalls would otherwise never settle this
201
+ // candidate and block the rest each discovery cycle (and leak the fd).
202
+ timer = setTimeout(() => { cleanup(); s.destroy(); resolve(null); }, SOCKET_CONNECT_TIMEOUT_MS);
203
+ if (typeof timer === 'object' && 'unref' in timer) timer.unref();
204
+ s.once('connect', onOk);
205
+ s.once('error', onErr);
206
+ });
207
+ }
208
+
187
209
  async _openSocket() {
188
210
  const paths = this._pathList ?? candidatePaths();
189
- for (const p of paths) {
190
- const socket = await new Promise((resolve) => {
191
- const s = net.createConnection(p);
192
- let timer = null;
193
- const cleanup = () => {
194
- clearTimeout(timer);
195
- s.removeListener('connect', onOk);
196
- s.removeListener('error', onErr);
197
- };
198
- const onErr = () => { cleanup(); resolve(null); };
199
- const onOk = () => { cleanup(); resolve(s); };
200
- // A peer that accepts then stalls would otherwise never settle this
201
- // candidate and block the rest each discovery cycle (and leak the fd).
202
- timer = setTimeout(() => { cleanup(); s.destroy(); resolve(null); }, SOCKET_CONNECT_TIMEOUT_MS);
203
- if (typeof timer === 'object' && 'unref' in timer) timer.unref();
204
- s.once('connect', onOk);
205
- s.once('error', onErr);
206
- });
207
- if (socket) return socket;
208
- }
209
- return null;
211
+ // Race every candidate concurrently rather than trying them one at a
212
+ // time. On posix this list is already existence-filtered (usually just
213
+ // one path), so it barely matters — but on Windows all 10 named-pipe
214
+ // paths are probed unconditionally (no existence pre-check is possible),
215
+ // so a sequential loop pays up to 10× SOCKET_CONNECT_TIMEOUT_MS in the
216
+ // worst case (Discord not running). Racing caps discovery at one timeout
217
+ // regardless of candidate count. `Promise.all` (not `race`) so a losing
218
+ // socket can still be found and destroyed rather than leaked, and so the
219
+ // winner is picked by path order — preserving "prefer discord-ipc-0" even
220
+ // when more than one candidate accepts (e.g. a bridge alongside real
221
+ // Discord).
222
+ const sockets = await Promise.all(paths.map((p) => this._tryConnect(p)));
223
+ const winner = sockets.findIndex((s) => s !== null);
224
+ if (winner === -1) return null;
225
+ sockets.forEach((s, i) => { if (s && i !== winner) { try { s.destroy(); } catch { /* already gone */ } } });
226
+ return sockets[winner];
210
227
  }
211
228
 
212
229
  // Connect, handshake, and resolve once Discord sends READY (which also
package/src/gist.js CHANGED
@@ -26,12 +26,17 @@ const WIN = process.platform === 'win32';
26
26
  function ghQuote(a) {
27
27
  return /[\s"]/.test(a) ? `"${String(a).replace(/"/g, '""')}"` : a;
28
28
  }
29
+ // gh can block on a network stall or a locked keyring, and the daemon now
30
+ // calls it too (background verification resume) — a spawnSync with no timeout
31
+ // would freeze its event loop, so every call is capped. A timeout surfaces as
32
+ // a non-zero/null status, which every caller already treats as failure.
33
+ const GH_TIMEOUT_MS = 30_000;
29
34
  function gh(args, opts = {}) {
30
35
  // windowsHide so the gh.exe/cmd shim doesn't flash a console window on
31
36
  // Windows (shell:true routes through cmd.exe; hide that too). No-op elsewhere.
32
37
  return WIN
33
- ? spawnSync('gh', args.map(ghQuote), { ...opts, shell: true, windowsHide: true })
34
- : spawnSync('gh', args, { ...opts, windowsHide: true });
38
+ ? spawnSync('gh', args.map(ghQuote), { timeout: GH_TIMEOUT_MS, ...opts, shell: true, windowsHide: true })
39
+ : spawnSync('gh', args, { timeout: GH_TIMEOUT_MS, ...opts, windowsHide: true });
35
40
  }
36
41
 
37
42
  // Bare fetch has no total timeout; a stalled GitHub endpoint would hang the
package/src/install.js CHANGED
@@ -20,6 +20,7 @@ import {
20
20
  import { DEFAULT_CONFIG } from './default-config.js';
21
21
  import { VERSION } from './version.js';
22
22
  import { c, SYM_OK, SYM_WARN, SYM_FAIL, SYM_INFO, hintLine } from './ui.js';
23
+ import { inferLegacyVerifyIntent } from './verify.js';
23
24
 
24
25
  const STARTUP_KEY = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';
25
26
  const STARTUP_VALUE = 'ClaudeRPC';
@@ -200,6 +201,20 @@ export function launchdPlist({ exe, args }) {
200
201
  ].join('\n');
201
202
  }
202
203
 
204
+ // Windows Run-key command + windowless .vbs shim content — pure, exported so
205
+ // they're unit-testable without touching reg.exe/wscript or the real
206
+ // filesystem (mirrors launchdPlist/systemdUnit above).
207
+ export function windowsRunCommand({ exe, args }) {
208
+ return [exe, ...args].map((p) => `"${p}"`).join(' ');
209
+ }
210
+
211
+ export function windowsVbsShim({ exe, args }) {
212
+ // In a VBS string literal a doubled quote is an escaped quote, so each
213
+ // `""x""` below reaches the shell as `"x"`.
214
+ const vbsCmd = [exe, ...args].map((p) => `""${p}""`).join(' ');
215
+ return `CreateObject("WScript.Shell").Run "${vbsCmd}", 0, False\r\n`;
216
+ }
217
+
203
218
  export function systemdUnit({ exe, args }) {
204
219
  const execStart = [exe, ...args].map((a) => `"${a}"`).join(' '); // quote each token (paths with spaces)
205
220
  return [
@@ -289,13 +304,10 @@ export async function addStartupEntry(exePath) {
289
304
  // a Run entry of `"node.exe" daemon` (no script path) and login-autostart
290
305
  // silently launched nothing.
291
306
  const launch = daemonLaunch(exePath);
292
- let runCmd = [launch.exe, ...launch.args].map((p) => `"${p}"`).join(' ');
307
+ let runCmd = windowsRunCommand(launch);
293
308
  try {
294
309
  mkdirSync(CANONICAL_INSTALL_DIR, { recursive: true });
295
- // In a VBS string literal a doubled quote is an escaped quote, so each
296
- // `""x""` below reaches the shell as `"x"`.
297
- const vbsCmd = [launch.exe, ...launch.args].map((p) => `""${p}""`).join(' ');
298
- writeFileSync(STARTUP_VBS, `CreateObject("WScript.Shell").Run "${vbsCmd}", 0, False\r\n`);
310
+ writeFileSync(STARTUP_VBS, windowsVbsShim(launch));
299
311
  runCmd = `wscript.exe "${STARTUP_VBS}"`;
300
312
  } catch { /* couldn't write the shim — fall back to the direct (windowed) entry */ }
301
313
  await regCommand([
@@ -523,6 +535,17 @@ export function migrateConfig({ silent = false } = {}) {
523
535
  added.push('presence.byStatus.thinking.state');
524
536
  }
525
537
 
538
+ // v1.4.3: setup's "connect GitHub?" y could die on a server error (the
539
+ // 2026-08-20 → 09-11 KV write-cap outage 500'd /verify/start most of every
540
+ // day) and was never asked again. 1.4.0–1.4.2 recorded no intent, so infer
541
+ // it from the yes-path's footprint; the daemon then finishes the verification
542
+ // in the background (src/verify.js). Undated — the worker back-dates to the
543
+ // profile's first successful write instead.
544
+ if (inferLegacyVerifyIntent(cfg.profile)) {
545
+ cfg.profile.verifyPending = { since: null };
546
+ added.push('profile.verifyPending (resume GitHub connect)');
547
+ }
548
+
526
549
  // v0.7: community.enabled flipped to true in DEFAULT_CONFIG. For users
527
550
  // upgrading from a version without a community block, we must NOT
528
551
  // silently turn telemetry on — write an explicit `enabled: false` so
package/src/notify.js CHANGED
@@ -29,9 +29,9 @@ export function sanitizeLabel(s) {
29
29
  * @param {string} [body] - Notification body text.
30
30
  * @returns {boolean} true if a notifier was spawned, false on failure.
31
31
  */
32
- export function desktopNotify(title, body = '', { spawn: spawnFn = spawn } = {}) {
32
+ export function desktopNotify(title, body = '', { spawn: spawnFn = spawn, platform: platformFn = platform } = {}) {
33
33
  try {
34
- const p = platform();
34
+ const p = platformFn();
35
35
  // A missing notifier binary (e.g. no `notify-send`) makes spawn emit an
36
36
  // async 'error' event — with no listener that surfaces as an UNCAUGHT
37
37
  // exception that the sync try/catch below can't stop, which would crash
@@ -45,10 +45,17 @@ export function desktopNotify(title, body = '', { spawn: spawnFn = spawn } = {})
45
45
  const script = `display notification ${JSON.stringify(body)} with title ${JSON.stringify(title)}`;
46
46
  swallow(spawnFn('osascript', ['-e', script], { stdio: 'ignore', detached: true }));
47
47
  } else if (p === 'win32') {
48
+ // ShowBalloonTip is async — it returns as soon as the toast is queued,
49
+ // not once it's rendered. Without holding the process open, PowerShell
50
+ // reaches end-of-script and exits immediately after, tearing down the
51
+ // NotifyIcon before Windows ever draws the balloon, so it silently
52
+ // never appears. Sleep past the tip's own 5s display window before
53
+ // disposing, so the process outlives what it just asked for.
48
54
  const script = `Add-Type -AssemblyName System.Windows.Forms;`
49
55
  + `$n=New-Object System.Windows.Forms.NotifyIcon;`
50
56
  + `$n.Icon=[System.Drawing.SystemIcons]::Information;$n.Visible=$true;`
51
- + `$n.ShowBalloonTip(5000, ${JSON.stringify(title)}, ${JSON.stringify(body)}, 'Info')`;
57
+ + `$n.ShowBalloonTip(5000, ${JSON.stringify(title)}, ${JSON.stringify(body)}, 'Info');`
58
+ + `Start-Sleep -Seconds 6;$n.Dispose()`;
52
59
  swallow(spawnFn('powershell', ['-NoProfile', '-NonInteractive', '-Command', script], { stdio: 'ignore', detached: true, windowsHide: true }));
53
60
  } else {
54
61
  swallow(spawnFn('notify-send', ['-a', 'Claude Code', title, body], { stdio: 'ignore', detached: true }));
package/src/scanner.js CHANGED
@@ -1,10 +1,11 @@
1
- import { readdirSync, readFileSync, statSync, existsSync, writeFileSync, mkdirSync, renameSync, openSync, readSync, closeSync, realpathSync } from 'node:fs';
1
+ import { readdirSync, readFileSync, statSync, existsSync, writeFileSync, mkdirSync, openSync, readSync, closeSync, realpathSync } from 'node:fs';
2
2
  import { join, dirname, basename } from 'node:path';
3
3
  import { homedir } from 'node:os';
4
4
  import { CLAUDE_PROJECTS, SCAN_CACHE_PATH, AGGREGATE_PATH, DATA_DIR, EVENTS_LOG_PATH } from './paths.js';
5
5
  import { languageOf } from './languages.js';
6
6
  import { costFor, pricingKeyFor } from './pricing.js';
7
7
  import { classifyShip } from './ships.js';
8
+ import { renameSyncRetry } from './atomic-rename.js';
8
9
 
9
10
  // Bumping this forces a full re-parse on next scan. Increment whenever the
10
11
  // per-transcript summary schema changes in a way old caches can't satisfy.
@@ -783,7 +784,7 @@ function writeCache(cache) {
783
784
  // rename land a half-written file (or ENOENT the other's rename).
784
785
  const tmp = `${SCAN_CACHE_PATH}.${process.pid}.tmp`;
785
786
  writeFileSync(tmp, JSON.stringify(cache));
786
- renameSync(tmp, SCAN_CACHE_PATH);
787
+ renameSyncRetry(tmp, SCAN_CACHE_PATH);
787
788
  }
788
789
 
789
790
  // Per-day notification counts come from a hook-side append log, since
@@ -818,7 +819,7 @@ function writeAggregate(agg) {
818
819
  ensureDataDir();
819
820
  const tmp = `${AGGREGATE_PATH}.${process.pid}.tmp`;
820
821
  writeFileSync(tmp, JSON.stringify(agg, null, 2));
821
- renameSync(tmp, AGGREGATE_PATH);
822
+ renameSyncRetry(tmp, AGGREGATE_PATH);
822
823
  }
823
824
 
824
825
  export function readAggregate() {
package/src/server/sse.js CHANGED
@@ -3,9 +3,10 @@
3
3
  // Replaces the old 2-second poll. Two debounced fs.watch handles, one
4
4
  // shared client set.
5
5
 
6
- import { watch } from 'node:fs';
6
+ import { watch, existsSync, statSync } from 'node:fs';
7
7
  import { dirname, basename } from 'node:path';
8
8
  import { STATE_PATH, AGGREGATE_PATH } from '../paths.js';
9
+ import { pollDecision, pollIntervalMs } from '../watch-poll.js';
9
10
 
10
11
  export const sseClients = new Set();
11
12
 
@@ -60,14 +61,51 @@ export function watchFile(filePath, callback) {
60
61
  }
61
62
  }
62
63
 
64
+ function statMtime(filePath) {
65
+ try {
66
+ return existsSync(filePath) ? statSync(filePath).mtimeMs : undefined;
67
+ } catch {
68
+ return undefined; // mid-rename; a later observation records it
69
+ }
70
+ }
71
+
63
72
  export function watchSources() {
64
- let stTimer = null, agTimer = null;
65
- watchFile(STATE_PATH, () => {
66
- clearTimeout(stTimer);
67
- stTimer = setTimeout(() => broadcast({ type: 'state' }), 200);
68
- });
69
- watchFile(AGGREGATE_PATH, () => {
70
- clearTimeout(agTimer);
71
- agTimer = setTimeout(() => broadcast({ type: 'aggregate' }), 200);
72
- });
73
+ const targets = [
74
+ { path: STATE_PATH, type: 'state' },
75
+ { path: AGGREGATE_PATH, type: 'aggregate' },
76
+ ];
77
+
78
+ // Last mtime we've reacted to, per target. Updated by BOTH the watcher and
79
+ // the poll fallback below, so a change one path already handled resolves
80
+ // to a no-op for the other instead of a duplicate broadcast — same shared-
81
+ // baseline trick the daemon's own watchFiles() uses.
82
+ const lastMtime = new Map();
83
+ const debounceTimers = new Map();
84
+ const recordMtime = (t) => {
85
+ const m = statMtime(t.path);
86
+ if (m !== undefined) lastMtime.set(t.path, m);
87
+ };
88
+ targets.forEach(recordMtime); // seed baselines before watching starts
89
+
90
+ const fire = (t) => {
91
+ recordMtime(t); // record before the debounced broadcast so a re-entrant tick can't double-fire
92
+ clearTimeout(debounceTimers.get(t.path));
93
+ debounceTimers.set(t.path, setTimeout(() => broadcast({ type: t.type }), 200));
94
+ };
95
+
96
+ for (const t of targets) watchFile(t.path, () => fire(t));
97
+
98
+ // Mtime-poll fallback. fs.watch drops atomic-rename events on Windows (see
99
+ // watch-poll.js), and unlike the daemon this watcher previously had no
100
+ // backstop at all — a missed event left the dashboard silently stale until
101
+ // some unrelated broadcast happened to fire. Same cadence as the daemon's
102
+ // fallback: fast on Windows, lazy on macOS/Linux.
103
+ setInterval(() => {
104
+ for (const t of targets) {
105
+ const cur = statMtime(t.path);
106
+ const decision = pollDecision(lastMtime.get(t.path), cur);
107
+ if (decision === 'seed') lastMtime.set(t.path, cur);
108
+ else if (decision === 'fire') fire(t);
109
+ }
110
+ }, pollIntervalMs());
73
111
  }
package/src/state.js CHANGED
@@ -3,7 +3,6 @@ import {
3
3
  mkdirSync,
4
4
  readFileSync,
5
5
  writeFileSync,
6
- renameSync,
7
6
  openSync,
8
7
  closeSync,
9
8
  unlinkSync,
@@ -14,6 +13,7 @@ import {
14
13
  import { basename, join } from 'node:path';
15
14
  import { STATE_PATH, STATE_DIR } from './paths.js';
16
15
  import { pickActiveSession } from './presence.js';
16
+ import { renameSyncRetry } from './atomic-rename.js';
17
17
 
18
18
  const DEFAULT_STATE = {
19
19
  sessionStart: null,
@@ -190,7 +190,7 @@ export function writeState(next, sessionId) {
190
190
  // atomic-rename guarantee intact even on the best-effort lockless path.
191
191
  const tmp = `${path}.${process.pid}.tmp`;
192
192
  writeFileSync(tmp, JSON.stringify(next, null, 2));
193
- renameSync(tmp, path);
193
+ renameSyncRetry(tmp, path);
194
194
  }
195
195
 
196
196
  // Best-effort sweep of orphaned per-pid tmp files (`state.json.<pid>.tmp`) left
package/src/verify.js ADDED
@@ -0,0 +1,239 @@
1
+ // GitHub gist verification — the core shared by `profile verify` and setup's
2
+ // "connect GitHub?" question (both interactive, in cli.js) and by the daemon's
3
+ // background resume of a verification that didn't go through.
4
+ //
5
+ // Why the resume exists: from 2026-08-20 to 2026-09-11 the worker's KV write
6
+ // quota ran out by ~05:00 UTC every day, so /verify/start 500'd for anyone who
7
+ // answered "y" later in the day. Setup asks exactly once, so those installs sat
8
+ // unverified for good while their daemons kept publishing an unverified row.
9
+ // Consent is now recorded locally as `profile.verifyPending`, and the daemon
10
+ // finishes the same flow the user already agreed to once the server answers.
11
+
12
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
13
+ import { dirname } from 'node:path';
14
+ import { CONFIG_PATH } from './paths.js';
15
+ import { renameSyncRetry } from './atomic-rename.js';
16
+ import { normalizeGithubUser, profileIsPublishable } from './leaderboard.js';
17
+
18
+ const FETCH_TIMEOUT_MS = 10_000;
19
+ export const PROOF_FILENAME = 'claude-rpc-verify.txt';
20
+
21
+ // Daemon retry schedule: 30 min doubling up to a 12 h ceiling, for 14 days
22
+ // from the first background attempt — long enough to outlast a multi-day
23
+ // outage (this one ran three weeks, but writes came back for a few hours
24
+ // every night), short enough that a permanently broken setup goes quiet.
25
+ export const RESUME_BASE_MS = 30 * 60_000;
26
+ export const RESUME_MAX_MS = 12 * 3_600_000;
27
+ export const RESUME_WINDOW_MS = 14 * 86_400_000;
28
+
29
+ export function resumeBackoffMs(attempts) {
30
+ return Math.min(RESUME_MAX_MS, RESUME_BASE_MS * 2 ** Math.max(0, attempts - 1));
31
+ }
32
+
33
+ // 1.4.0–1.4.2 recorded no intent, but setup's yes-path leaves a footprint no
34
+ // other flow does on its own: asked + publishing on + a GitHub login stored +
35
+ // never verified. migrateConfig turns that into an explicit (undated) pending
36
+ // marker once; a marker that exists in any state is never re-inferred.
37
+ export function inferLegacyVerifyIntent(profile) {
38
+ const p = profile || {};
39
+ return !!(p.ghConnectAsked && p.enabled === true && normalizeGithubUser(p.githubUser)
40
+ && !p.verified && !p.verifyPending);
41
+ }
42
+
43
+ // Record (or refresh) consent to verify on a raw user-config object. Keeps the
44
+ // earliest consent time and any proof gist, but restarts the retry budget —
45
+ // the user just asked again, so a previous give-up no longer applies.
46
+ export function withVerifyIntent(userCfg, now = Date.now()) {
47
+ const profile = userCfg.profile || {};
48
+ const prev = profile.verifyPending && typeof profile.verifyPending === 'object' ? profile.verifyPending : {};
49
+ const since = Number.isFinite(prev.since) ? Math.min(prev.since, now) : now;
50
+ userCfg.profile = {
51
+ ...profile,
52
+ verifyPending: { since, ...(prev.gistId ? { gistId: prev.gistId } : {}) },
53
+ };
54
+ return userCfg;
55
+ }
56
+
57
+ // Should the daemon try a background verification now? { go } or { go:false, why }.
58
+ export function resumeDecision(profile, now = Date.now()) {
59
+ const p = profile || {};
60
+ const vp = p.verifyPending;
61
+ if (!vp || typeof vp !== 'object') return { go: false, why: 'none' };
62
+ if (p.verified) return { go: false, why: 'verified' };
63
+ if (vp.gaveUpAt) return { go: false, why: 'gave-up' };
64
+ // Publishing turned off (or no handle) → the row this would verify isn't
65
+ // being kept; wait rather than burn the retry window.
66
+ if (!profileIsPublishable(p)) return { go: false, why: 'profile-off' };
67
+ if (vp.firstTryAt && now - vp.firstTryAt > RESUME_WINDOW_MS) return { go: false, why: 'expired' };
68
+ if (vp.nextAt && now < vp.nextAt) return { go: false, why: 'backoff' };
69
+ return { go: true };
70
+ }
71
+
72
+ // One pass of the dance: worker token → public proof gist → worker check.
73
+ // Never throws and never prints (onStep narrates for the CLI). Returns
74
+ // { ok: true, githubUser, merged, handle, gistId }
75
+ // { ok: false, stage: 'config'|'start'|'gist'|'check', status, error, gistId }
76
+ // `gistId` reuses the proof gist of an earlier attempt (edited, not
77
+ // re-created). `resumed` + `pendingSince` tell the worker this completes an
78
+ // earlier consent so it can back-date the verification to it.
79
+ export async function runGistVerify(cfg, {
80
+ fetchImpl = globalThis.fetch,
81
+ publish = null,
82
+ onStep = () => {},
83
+ gistId = null,
84
+ pendingSince = null,
85
+ resumed = false,
86
+ } = {}) {
87
+ const instanceId = cfg?.community?.instanceId;
88
+ const endpoint = (cfg?.community?.endpoint || '').replace(/\/+$/, '');
89
+ if (!instanceId) return { ok: false, stage: 'config', status: 0, error: 'no-instance-id' };
90
+ if (!endpoint) return { ok: false, stage: 'config', status: 0, error: 'no-endpoint' };
91
+
92
+ const post = async (path, body) => {
93
+ try {
94
+ const res = await fetchImpl(endpoint + path, {
95
+ method: 'POST',
96
+ headers: { 'Content-Type': 'application/json' },
97
+ body: JSON.stringify(body),
98
+ signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
99
+ });
100
+ return { status: res.status, json: await res.json().catch(() => ({})) };
101
+ } catch (e) {
102
+ return { status: 0, json: { error: e.message } };
103
+ }
104
+ };
105
+ const errOf = (r) => r.json?.error || (r.status ? `http-${r.status}` : 'network');
106
+
107
+ onStep('requesting a verification token');
108
+ const start = await post('/verify/start', { instanceId, githubUser: cfg.profile?.githubUser || null });
109
+ if (!start.json?.token) return { ok: false, stage: 'start', status: start.status, error: errOf(start), gistId };
110
+
111
+ onStep('publishing a public proof gist');
112
+ let gist;
113
+ try {
114
+ const pub = publish || (await import('./gist.js')).publishGistFile;
115
+ const content = `claude-rpc leaderboard verification\n${start.json.token}\n`;
116
+ const fresh = () => pub({ svg: content, filename: PROOF_FILENAME, description: 'claude-rpc profile verification', isPublic: true });
117
+ if (gistId) {
118
+ // A deleted or foreign gist can't be edited; fall back to a new one.
119
+ try { gist = await pub({ svg: content, filename: PROOF_FILENAME, gistId }); }
120
+ catch { gist = await fresh(); }
121
+ } else {
122
+ gist = await fresh();
123
+ }
124
+ } catch (e) {
125
+ return { ok: false, stage: 'gist', status: 0, error: e.message, gistId };
126
+ }
127
+
128
+ // The worker fetches THAT gist by id (no gist-list lag) and takes its real
129
+ // owner as the verified identity.
130
+ onStep('confirming with the server');
131
+ const check = await post('/verify/check', {
132
+ instanceId,
133
+ gistId: gist.id,
134
+ ...(resumed ? { resumed: true } : {}),
135
+ ...(Number.isFinite(pendingSince) ? { pendingSince } : {}),
136
+ });
137
+ if (!check.json?.verified) return { ok: false, stage: 'check', status: check.status, error: errOf(check), gistId: gist.id };
138
+ return {
139
+ ok: true,
140
+ githubUser: check.json.githubUser || gist.owner || cfg.profile?.githubUser || null,
141
+ merged: !!check.json.merged,
142
+ handle: check.json.handle || null,
143
+ gistId: gist.id,
144
+ };
145
+ }
146
+
147
+ // Read-modify-write the raw user config (never the defaults-merged view), via
148
+ // tmp + rename so the daemon's config watcher can't read a half-written file.
149
+ // `mutate` returns false to skip the write.
150
+ export function updateUserConfig(mutate, { path = CONFIG_PATH } = {}) {
151
+ let cfg = {};
152
+ if (existsSync(path)) {
153
+ try { cfg = JSON.parse(readFileSync(path, 'utf8')); } catch { return false; } // unreadable → don't clobber it
154
+ }
155
+ if (!cfg || typeof cfg !== 'object') return false;
156
+ if (mutate(cfg) === false) return false;
157
+ mkdirSync(dirname(path), { recursive: true });
158
+ const tmp = `${path}.${process.pid}.tmp`;
159
+ writeFileSync(tmp, JSON.stringify(cfg, null, 2) + '\n');
160
+ renameSyncRetry(tmp, path);
161
+ return true;
162
+ }
163
+
164
+ // Persist a confirmed verification locally: authoritative login + verified
165
+ // marker, pending intent cleared.
166
+ export function markVerifiedLocally(githubUser, { path = CONFIG_PATH } = {}) {
167
+ return updateUserConfig((cfg) => {
168
+ const { verifyPending: _done, ...rest } = cfg.profile || {};
169
+ cfg.profile = { ...rest, ...(githubUser ? { githubUser } : {}), verified: true };
170
+ }, { path });
171
+ }
172
+
173
+ // Merge fields into an existing pending marker; no-op if it's gone (another
174
+ // process verified or cleared it meanwhile).
175
+ function patchPending(fields, path) {
176
+ return updateUserConfig((cfg) => {
177
+ const vp = cfg.profile?.verifyPending;
178
+ if (!vp || typeof vp !== 'object' || cfg.profile.verified) return false;
179
+ cfg.profile.verifyPending = { ...vp, ...fields };
180
+ }, { path });
181
+ }
182
+
183
+ // Daemon entry point — called after a successful profile flush, so the row
184
+ // being verified exists. At most one attempt per call; the schedule lives in
185
+ // the pending marker itself. Returns { attempted, ok?, why? }.
186
+ export async function resumePendingVerify(config, {
187
+ log = () => {},
188
+ now = Date.now,
189
+ ghLoginImpl = null,
190
+ fetchImpl = globalThis.fetch,
191
+ publish = null,
192
+ configPath = CONFIG_PATH,
193
+ } = {}) {
194
+ // The schedule and outcome live on disk and the daemon's in-memory config
195
+ // only catches up via its file watcher — read the marker fresh so a missed
196
+ // watch event can't re-run an attempt inside its backoff (or after success).
197
+ let disk = {};
198
+ try { disk = existsSync(configPath) ? JSON.parse(readFileSync(configPath, 'utf8')) : {}; } catch { /* fall back to memory */ }
199
+ const profile = { ...(config?.profile || {}), ...(disk?.profile || {}) };
200
+ if (disk?.profile) profile.verifyPending = disk.profile.verifyPending; // cleared on disk = cleared
201
+ const t = now();
202
+ const decision = resumeDecision(profile, t);
203
+ if (!decision.go) {
204
+ if (decision.why === 'expired') {
205
+ patchPending({ gaveUpAt: t }, configPath);
206
+ log('profile: gave up retrying GitHub verification after 14 days — run `claude-rpc profile verify` to try again');
207
+ }
208
+ return { attempted: false, why: decision.why };
209
+ }
210
+ const vp = profile.verifyPending;
211
+
212
+ // The gist owner becomes the verified identity, so only ever prove the
213
+ // account the user connected: if gh has since been switched to another
214
+ // account, wait instead of verifying that one.
215
+ const want = normalizeGithubUser(profile.githubUser);
216
+ let have = null;
217
+ try { have = normalizeGithubUser((ghLoginImpl || (await import('./gist.js')).ghLogin)()); } catch { /* treated as logged out */ }
218
+ let r;
219
+ if (!have) r = { ok: false, stage: 'gh', error: 'gh CLI missing or logged out' };
220
+ else if (want && want.toLowerCase() !== have.toLowerCase()) r = { ok: false, stage: 'gh', error: `gh is logged in as @${have}, not @${want}` };
221
+ else r = await runGistVerify({ ...config, profile }, { fetchImpl, publish, gistId: vp.gistId || null, pendingSince: vp.since ?? null, resumed: true });
222
+
223
+ if (r.ok) {
224
+ markVerifiedLocally(r.githubUser, { path: configPath });
225
+ log(`profile: finished the GitHub verification that didn't go through earlier — verified as @${r.githubUser}${r.merged ? ` (merged into @${r.handle})` : ''}`);
226
+ return { attempted: true, ok: true };
227
+ }
228
+ const attempts = (vp.attempts || 0) + 1;
229
+ const wait = resumeBackoffMs(attempts);
230
+ patchPending({
231
+ attempts,
232
+ firstTryAt: vp.firstTryAt || t,
233
+ nextAt: t + wait,
234
+ lastError: `${r.stage}: ${r.error}`.slice(0, 200),
235
+ ...(r.gistId ? { gistId: r.gistId } : {}),
236
+ }, configPath);
237
+ log(`profile: GitHub verification retry ${attempts} failed (${r.stage}: ${r.error}) — next try in ${Math.round(wait / 60_000)} min`);
238
+ return { attempted: true, ok: false, stage: r.stage };
239
+ }
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 = '1.4.1';
14
+ const BAKED = '1.4.3';
15
15
 
16
16
  function readPkgVersion() {
17
17
  try {