@songsid/agend 2.1.11-beta.2 → 2.1.11-beta.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.
@@ -63,6 +63,7 @@ import { LoginSession } from "./login-manager.js";
63
63
  import { tightenInstanceDirs } from "./private-dir.js";
64
64
  import { decideSlash } from "./slash-authz.js";
65
65
  import { commandSpec, decideCommand } from "./command-table.js";
66
+ import { UPDATE_COMMAND, isPrereleaseVersion, updateNoticeKey } from "./update-check.js";
66
67
  import { LoginController, LOGIN_TOKEN_RESEND_PREFIX, POST_LOGIN_RECOVERY_DEADLINE_MS } from "./login-controller.js";
67
68
  import { runBeforeDeadline } from "./deadline.js";
68
69
  import { LoginWindowLock } from "./login-window-lock.js";
@@ -1492,8 +1493,10 @@ export class FleetManager {
1492
1493
  this.beginUpdateProgress(adapter, chatId, data.channelId, messageId);
1493
1494
  }
1494
1495
  const { spawn } = await import("node:child_process");
1495
- const currentVersion = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "package.json"), "utf-8")).version ?? "";
1496
- const command = currentVersion.includes("beta") ? "agend update --beta" : "agend update";
1496
+ // Plain `agend update`: the CLI picks the channel from the version it is about to replace (a beta install
1497
+ // stays on beta). Deciding here, from the package.json next to THIS code, read a source checkout's 1.22.0 as
1498
+ // "not a beta" and sent a beta install to @latest.
1499
+ const command = UPDATE_COMMAND;
1497
1500
  const origin = `slash /update by ${adapterId}:${data.userId}`;
1498
1501
  recordInternalRequest(this.dataDir, "update", origin);
1499
1502
  const child = spawn("sh", ["-c", `sleep 2 && ${command}`], {
@@ -13961,7 +13964,8 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
13961
13964
  const currentVersion = JSON.parse(readFileSync(pkgPath, "utf-8")).version ?? "0.0.0";
13962
13965
  const latest = await npmVersion("@songsid/agend");
13963
13966
  let target = latest;
13964
- if (currentVersion.includes("-beta")) {
13967
+ // The same channel rule as `agend update` (any SemVer prerelease is on @beta): rc and alpha too.
13968
+ if (isPrereleaseVersion(currentVersion)) {
13965
13969
  // Beta users track the @beta channel (never fall back to @latest, which is
13966
13970
  // older), but should also hear when a newer STABLE ships — pick whichever
13967
13971
  // of beta/latest is the newest.
@@ -13981,7 +13985,7 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
13981
13985
  // only that same-core stable-vs-my-beta case; a higher stable core (2.0.12)
13982
13986
  // or a newer beta (2.0.11-beta.50) still notifies via semverGt below.
13983
13987
  const core = (v) => v.replace(/^v/, "").split("-")[0];
13984
- const betaSupersedesStable = currentVersion.includes("-") && !target.includes("-") && core(target) === core(currentVersion);
13988
+ const betaSupersedesStable = isPrereleaseVersion(currentVersion) && !isPrereleaseVersion(target) && core(target) === core(currentVersion);
13985
13989
  // Only notify when target is genuinely newer (semver), so a beta user on
13986
13990
  // 2.0.8-beta.16 is never told that stable 2.0.7 is "available".
13987
13991
  if (target && !betaSupersedesStable && this.semverGt(target, currentVersion)) {
@@ -13989,7 +13993,7 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
13989
13993
  if (generalId) {
13990
13994
  // No release URL — Discord's SuppressEmbeds proved unreliable and the
13991
13995
  // link preview looked bad. Version + /update instruction is enough.
13992
- this.notifyInstanceTopic(generalId, t("update.available_current", `v${target}`, `v${currentVersion}`));
13996
+ this.notifyInstanceTopic(generalId, t(updateNoticeKey(currentVersion, target), `v${target}`, `v${currentVersion}`));
13993
13997
  }
13994
13998
  }
13995
13999
  }