@dst-justin/relay 2.2.2 → 2.2.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.
Files changed (3) hide show
  1. package/README.md +5 -1
  2. package/package.json +1 -1
  3. package/relay +7 -2
package/README.md CHANGED
@@ -223,7 +223,11 @@ Sessions live in `~/.claude/projects/` and are shared across all accounts — af
223
223
 
224
224
  ## Changelog
225
225
 
226
- ### v2.2.2 — 2026-06-28
226
+ ### v2.2.4 — 2026-07-04
227
+ - Fix: `relay switch` from another terminal no longer gets clobbered by a concurrent `relay list` / `!relay` menu run. Root cause: `try_refresh()` in the parallel usage-fetch used a stale snapshot of the current account, causing it to write the old account's refreshed token back to keychain and undo the switch. Now reads `CURRENT_FILE` freshly at write time.
228
+ - Active sessions pick up an account switch on the next message without restarting
229
+
230
+ ### v2.2.3 — 2026-06-28
227
231
  - Fix OAuth token refresh: use correct endpoint (`/v1/oauth/token`), required `client_id`, and `anthropic-version: oauth-2025-04-20` header — `relay refresh-all` now works
228
232
 
229
233
  ### v2.2.0 — 2026-06-28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dst-justin/relay",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "description": "Multi-account switcher for Claude Code — instant credential swap across macOS, Linux, and Windows",
5
5
  "bin": {
6
6
  "relay": "./relay.js"
package/relay CHANGED
@@ -203,7 +203,12 @@ def try_refresh(name, cred_path):
203
203
  content = json.dumps(d)
204
204
  with open(cred_path, 'w') as f: f.write(content)
205
205
  os.chmod(cred_path, 0o600)
206
- if name == current:
206
+ # Re-read CURRENT_FILE freshly — do_switch() may have fired during the
207
+ # parallel fetch, making the captured `current` arg stale. Writing
208
+ # keychain with a stale current would clobber a concurrent account switch.
209
+ current_file = os.path.join(relay_dir, 'current')
210
+ live_current = open(current_file).read().strip() if os.path.exists(current_file) else ''
211
+ if name == live_current:
207
212
  update_live_creds(content)
208
213
  return oauth['accessToken']
209
214
  except Exception:
@@ -362,7 +367,7 @@ do_switch() {
362
367
 
363
368
  local email; email=$(get_meta_email "${name}")
364
369
  printf "\n ${GR}${B}✓ switched → %s${R} ${D}%s${R}\n" "${name}" "${email}"
365
- printf " ${D}Restart claude to apply. Resume last session: ${CY}claude -c${R}\n\n"
370
+ printf " ${D}Active sessions pick up the switch on next message. New session: ${CY}claude -c${R}\n\n"
366
371
 
367
372
  # ponytail: sentinel lets autoswitch daemon skip this account until threshold hit
368
373
  printf '{"account":"%s","ts":%s}' "${name}" "$(date +%s)" > "${RELAY_DIR}/manual_switch"