relay-companion 0.1.408 → 0.1.409

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/bin/relay.js CHANGED
@@ -881,9 +881,8 @@ function cmdEnv(positional = [], flags = {}) {
881
881
 
882
882
  function cmdUpdateChannel(positional = []) {
883
883
  const requested = String(positional[0] || "").trim().toLowerCase();
884
- const overridden = Boolean(process.env.RELAY_UPDATE_CHANNEL);
885
884
  if (!requested) {
886
- const source = overridden ? " (from RELAY_UPDATE_CHANNEL)" : "";
885
+ const source = process.env.RELAY_UPDATE_CHANNEL ? " (from RELAY_UPDATE_CHANNEL)" : "";
887
886
  console.log(`[relay] update channel: ${updateChannel()}${source}`);
888
887
  console.log(`[relay] switch with: relay update-channel ${UPDATE_CHANNEL_DEV} | relay update-channel ${UPDATE_CHANNEL_STAGING} | relay update-channel ${UPDATE_CHANNEL_STABLE}`);
889
888
  return;
@@ -893,18 +892,13 @@ function cmdUpdateChannel(positional = []) {
893
892
  process.exitCode = 1;
894
893
  return;
895
894
  }
896
- writeConfig({ updateChannel: requested });
897
- if (overridden) {
898
- console.log(`[relay] saved channel ${requested}, but RELAY_UPDATE_CHANNEL=${process.env.RELAY_UPDATE_CHANNEL} overrides it in this environment`);
899
- return;
900
- }
901
- if (requested === UPDATE_CHANNEL_DEV) {
902
- console.log("[relay] update channel set to dev — this machine now installs builds deliberately promoted for dev testing (usually within a minute of the daemon's next check)");
903
- } else if (requested === UPDATE_CHANNEL_STAGING) {
904
- console.log("[relay] update channel set to staging — this machine now installs production-like release candidates deliberately promoted to staging");
905
- } else {
906
- console.log("[relay] update channel set to stable — this machine keeps its current build and follows production releases from here on");
907
- }
895
+ // Release code and its server contract are one environment. Keeping these as
896
+ // independent switches allowed a dev Companion to keep calling production,
897
+ // where unreleased routes (notably Slack) correctly do not exist. Preserve
898
+ // the old command as an alias, but make the resulting state coherent.
899
+ if (requested === UPDATE_CHANNEL_DEV) return cmdEnv(["dev"]);
900
+ if (requested === UPDATE_CHANNEL_STAGING) return cmdEnv(["staging"]);
901
+ if (requested === UPDATE_CHANNEL_STABLE) return cmdEnv(["prod"]);
908
902
  }
909
903
 
910
904
  async function cmdE2eeHistoryImport(flags) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "relay-companion",
3
- "version": "0.1.408",
3
+ "version": "0.1.409",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "relay-companion",
9
- "version": "0.1.408",
9
+ "version": "0.1.409",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/claude-agent-sdk": "0.3.195",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relay-companion",
3
- "version": "0.1.408",
3
+ "version": "0.1.409",
4
4
  "description": "Install Relay for Claude Code, Cowork, and Codex, then sign in from the Relay pill.",
5
5
  "homepage": "https://sendrelays.com/get-started",
6
6
  "repository": {
package/src/config.js CHANGED
@@ -353,21 +353,33 @@ export function writeConfig(patch) {
353
353
 
354
354
  // One heal attempt per process: on a read-only or failing disk, retrying the
355
355
  // write on every apiUrl() call would add mkdir+rename to each daemon poll for
356
- // no benefit — the read-time mapping above already keeps the process correct.
357
- let attemptedLegacyApiUrlHeal = false;
356
+ // no benefit — the read-time mapping below already keeps the process correct.
357
+ const attemptedApiUrlHeals = new Set();
358
358
 
359
359
  export function apiUrl() {
360
360
  // An explicit env override is intentional (tests, staging, a local API) and
361
361
  // is never rewritten — even when it names the legacy host.
362
362
  if (process.env.RELAY_API_URL) return process.env.RELAY_API_URL;
363
- const stored = readConfig().apiUrl;
364
- const resolved = canonicalizeApiUrl(stored) || DEFAULT_API_URL;
365
- if (stored && resolved !== stored && !attemptedLegacyApiUrlHeal) {
366
- attemptedLegacyApiUrlHeal = true;
363
+ const config = readConfig();
364
+ const stored = config.apiUrl;
365
+ const canonical = canonicalizeApiUrl(stored) || DEFAULT_API_URL;
366
+ // A Companion on the dev release channel must talk to the dev API. Older
367
+ // setup instructions changed only the npm channel, leaving the persisted API
368
+ // at production. That produced a Dev Slack UI whose server returned a raw
369
+ // route_not_found. Repair only the known incoherent default/legacy pair;
370
+ // explicit local and staging origins remain valid developer choices.
371
+ const devChannel = normalizeUpdateChannel(process.env.RELAY_UPDATE_CHANNEL || config.updateChannel) === UPDATE_CHANNEL_DEV;
372
+ const resolved = devChannel && canonical === DEFAULT_API_URL ? DEFAULT_DEV_API_URL : canonical;
373
+ const healKey = `${configPath()}:${stored || "<default>"}->${resolved}`;
374
+ if (resolved !== (stored || DEFAULT_API_URL) && !attemptedApiUrlHeals.has(healKey)) {
375
+ attemptedApiUrlHeals.add(healKey);
367
376
  try {
368
- writeConfig({ apiUrl: resolved });
377
+ writeConfig({
378
+ apiUrl: resolved,
379
+ ...(resolved === DEFAULT_DEV_API_URL ? { devApiUrl: resolved } : {}),
380
+ });
369
381
  } catch {
370
- // The file keeps the legacy value; this process still uses the canonical
382
+ // The file keeps the incoherent value; this process still uses the canonical
371
383
  // URL, and the next process start retries the heal.
372
384
  }
373
385
  }