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 +8 -14
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/config.js +20 -8
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 =
|
|
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
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
if (requested ===
|
|
902
|
-
|
|
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) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "relay-companion",
|
|
3
|
-
"version": "0.1.
|
|
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.
|
|
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
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
|
|
357
|
-
|
|
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
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
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({
|
|
377
|
+
writeConfig({
|
|
378
|
+
apiUrl: resolved,
|
|
379
|
+
...(resolved === DEFAULT_DEV_API_URL ? { devApiUrl: resolved } : {}),
|
|
380
|
+
});
|
|
369
381
|
} catch {
|
|
370
|
-
// The file keeps the
|
|
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
|
}
|