permaura 1.3.36 → 1.3.38

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/bin/cli.mjs +10 -3
  2. package/bin/lib.mjs +11 -0
  3. package/package.json +1 -1
package/bin/cli.mjs CHANGED
@@ -24,9 +24,9 @@ import { spawn, spawnSync } from "node:child_process";
24
24
  import {
25
25
  platformKey,
26
26
  binaryFilename,
27
- compareVersions,
28
27
  sweepOldBinaries,
29
28
  swapBinaryIntoPlace,
29
+ upgradePlan,
30
30
  verifyDetachedSignatureAny,
31
31
  } from "./lib.mjs";
32
32
 
@@ -393,8 +393,12 @@ async function ensureBinary({ noUpgrade, force }) {
393
393
  }
394
394
 
395
395
  const latest = manifest.version;
396
- const needsUpdate = force || !haveBinary || !have || compareVersions(have, latest) < 0;
397
- if (!needsUpdate) {
396
+ const plan = upgradePlan({ installed: have, latest, haveBinary, force });
397
+ if (plan === "older") {
398
+ warn(`The release manifest names ${latest}, older than the installed ${have}. Keeping ${have}: the launcher never installs an older gateway.`);
399
+ return have;
400
+ }
401
+ if (plan === "current") {
398
402
  ok(noUpgrade ? `Using cached gateway ${have} (upgrade check skipped).` : `Gateway ${have} is up to date.`);
399
403
  return have;
400
404
  }
@@ -609,6 +613,9 @@ async function main() {
609
613
  console.log(
610
614
  `\nAdd it in the console → Settings → Gateways:\n URL: http://${ADDR}\n Token: ${token}`,
611
615
  );
616
+ console.log(
617
+ C.dim(" That is the gateway's operator token. Never give it to an agent: each agent gets its own from Agents → Connect agent."),
618
+ );
612
619
  }
613
620
 
614
621
  console.log(C.dim("\nGateway is running. Press Ctrl-C to stop."));
package/bin/lib.mjs CHANGED
@@ -113,6 +113,17 @@ export function compareVersions(a, b) {
113
113
  return comparePreRelease(preA, preB);
114
114
  }
115
115
 
116
+ /**
117
+ * What to do with the version a verified manifest names: `"install"` it, leave the `"current"` binary, or refuse it as `"older"`.
118
+ *
119
+ * Never older than what is installed, the explicit `upgrade` included: manifests carry no expiry or sequence number, so an old manifest with a genuine signature is exactly what a rollback would serve. `force` only reinstalls the same version, as a repair.
120
+ */
121
+ export function upgradePlan({ installed, latest, haveBinary, force = false }) {
122
+ if (haveBinary && installed && compareVersions(latest, installed) < 0) return "older";
123
+ if (force || !haveBinary || !installed || compareVersions(installed, latest) < 0) return "install";
124
+ return "current";
125
+ }
126
+
116
127
  /**
117
128
  * Semver §11.4 precedence for the pre-release part, over equal numeric cores.
118
129
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "permaura",
3
- "version": "1.3.36",
3
+ "version": "1.3.38",
4
4
  "description": "Run the Permaura gateway with one command. Give your AI agents permission, not keys. `npm i -g permaura` then `permaura start --pair <code>` installs the gateway, starts it, and connects it to your permaura.com account.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",