@join-pantheon/cli 0.35.3 → 0.36.0-rc.1

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/dist/profile.js CHANGED
@@ -59,6 +59,9 @@ export function reservedDomains(profile) {
59
59
  export function wakeMode(profile) {
60
60
  return profile.agent.wake_default ?? "anyone";
61
61
  }
62
+ export function setupChosen(profile) {
63
+ return profile.agent.wake_default !== undefined && profile.agent.setup_confirmed !== false;
64
+ }
62
65
  export function wakeChosen(file = profilePath()) {
63
66
  try {
64
67
  const v = JSON.parse(readStateText(file)).agent?.wake_default;
package/dist/protocol.js CHANGED
@@ -56,6 +56,11 @@ export const LIMITS = {
56
56
  watchPollMs: 2_000,
57
57
  ledgerKeepRecent: 5_000,
58
58
  ledgerKeepPresence: 1_000,
59
+ sessionsPerMember: 48,
60
+ replayStepBytes: 256 * 1024,
61
+ replayHighWater: 1024 * 1024,
62
+ replayStallMs: 60_000,
63
+ socketBufferMax: 32 * 1024 * 1024,
59
64
  ledgerCompactEveryMs: 10 * 60 * 1_000,
60
65
  activityFreshMs: 5 * 60 * 1_000,
61
66
  accountFreshMs: 10 * 60 * 1_000,
package/dist/relay.js CHANGED
@@ -184,6 +184,9 @@ export function sameOriginRequest(req) {
184
184
  .map((h) => h.split(",").pop().trim().toLowerCase());
185
185
  return own.includes(host);
186
186
  }
187
+ export function normalHost(h) {
188
+ return h.trim().toLowerCase().replace(/:(443|80)$/, "");
189
+ }
187
190
  function fullMessage(rec, goalTitles) {
188
191
  const meta = (rec.meta ?? {});
189
192
  const kv = [["Message ID", rec.id]];
@@ -753,6 +756,11 @@ export class Relay {
753
756
  spaceIdleEvictMs: opts.spaceLimits?.spaceIdleEvictMs ?? envNum("PANTHEON_SPACE_IDLE_EVICT_MS") ?? LIMITS.spaceIdleEvictMs,
754
757
  spaceJunkDeleteMs: opts.spaceLimits?.spaceJunkDeleteMs ?? LIMITS.spaceJunkDeleteMs,
755
758
  spaceMinAgeMs: opts.spaceLimits?.spaceMinAgeMs ?? LIMITS.spaceMinAgeMs,
759
+ sessionsPerMember: opts.spaceLimits?.sessionsPerMember ?? LIMITS.sessionsPerMember,
760
+ replayStepBytes: opts.spaceLimits?.replayStepBytes ?? LIMITS.replayStepBytes,
761
+ replayHighWater: opts.spaceLimits?.replayHighWater ?? LIMITS.replayHighWater,
762
+ replayStallMs: opts.spaceLimits?.replayStallMs ?? LIMITS.replayStallMs,
763
+ socketBufferMax: opts.spaceLimits?.socketBufferMax ?? LIMITS.socketBufferMax,
756
764
  };
757
765
  this.rotateOnRemove = opts.rotateOnRemove ?? process.env.PANTHEON_ROTATE_ON_REMOVE === "1";
758
766
  {
@@ -890,6 +898,15 @@ export class Relay {
890
898
  const al = new Allowlist(this.dataDir, safe);
891
899
  return !al.hasToken && (!al.empty || ledger > 0);
892
900
  }
901
+ ownName() {
902
+ try {
903
+ const b = publicBase(null);
904
+ return b ? normalHost(new URL(b).host) : null;
905
+ }
906
+ catch {
907
+ return null;
908
+ }
909
+ }
893
910
  onHttp(req, res) {
894
911
  const url = new URL(req.url ?? "/", "http://x");
895
912
  const ip = clientIp(req);
@@ -1378,9 +1395,13 @@ export class Relay {
1378
1395
  const member = sp?.allow.get(who.account.username);
1379
1396
  if (!sp || !member?.admitted)
1380
1397
  return this.json(res, 403, { error: "you are not a member of that space" });
1398
+ const seatSince = member.moved?.at ?? member.first_seen;
1399
+ if (who.account.created_at > seatSince && !A.wasDeviceOf(who.account.id, fingerprint(member.publicKey), Date.now())) {
1400
+ return this.json(res, 403, { error: `the seat "${who.account.username}" in that space was taken before this account existed, with a key it has never held — the team's founder can retire it (pantheon admit ${who.account.username} --forget) and invite you` });
1401
+ }
1381
1402
  return this.json(res, 200, { audit: A.auditLog({ space, sinceMs: numOr(url.searchParams.get("since")), limit: 1000 }) });
1382
1403
  }
1383
- const mine = A.auditLog({ limit: 2000 }).filter((r) => r.actor_account === who.account.id || r.target === who.account.username);
1404
+ const mine = A.auditLog({ limit: 2000 }).filter((r) => r.actor_account === who.account.id || (r.target === who.account.username && r.ts >= who.account.created_at));
1384
1405
  return this.json(res, 200, { audit: mine });
1385
1406
  }
1386
1407
  return this.json(res, 404, { error: "not found" });
@@ -1403,6 +1424,9 @@ export class Relay {
1403
1424
  }
1404
1425
  if (!verifyAccount(pubkey, method, path, params, ts, sig))
1405
1426
  return null;
1427
+ const own = params.aud !== undefined ? this.ownName() : null;
1428
+ if (own && normalHost(params.aud) !== own)
1429
+ return null;
1406
1430
  const device = A.deviceByPubkey(pubkey);
1407
1431
  if (!device)
1408
1432
  return null;
@@ -4679,6 +4703,18 @@ pantheon start</code></pre>
4679
4703
  }
4680
4704
  catch { }
4681
4705
  }
4706
+ for (const [id, s] of me.sessions) {
4707
+ if (me.sessions.size <= this.limits.sessionsPerMember)
4708
+ break;
4709
+ if (id === sessionId)
4710
+ continue;
4711
+ me.sessions.delete(id);
4712
+ this.log(`[${sp.name}] ${me.id} has over ${this.limits.sessionsPerMember} connections open: the oldest was closed`);
4713
+ try {
4714
+ s.ws.close(1008, "TOO_MANY_SESSIONS");
4715
+ }
4716
+ catch { }
4717
+ }
4682
4718
  if (prior && prior !== sessionId && !me.sessions.has(prior)) {
4683
4719
  let moved = 0;
4684
4720
  for (const o of sp.obligations.values()) {
@@ -4716,19 +4752,8 @@ pantheon start</code></pre>
4716
4752
  mine.wantsToken = true;
4717
4753
  }
4718
4754
  let from = m.from_seq && m.from_seq > 0 ? m.from_seq : sp.ledger.head;
4719
- for (let page = sp.ledger.since(from); page.length; page = sp.ledger.since(from)) {
4720
- for (const r of page) {
4721
- this.send(ws, { t: "act", act: r });
4722
- if (!quiet && r.seq > me.delivered_seq)
4723
- me.delivered_seq = r.seq;
4724
- }
4725
- from = page[page.length - 1].seq;
4726
- }
4727
- if (versionBelow(m.pkg, "0.30.0")) {
4728
- const why = this.unsignedRefusal(sp.name, sp.allow, "current");
4729
- if (why)
4730
- this.send(ws, { t: "act", act: this.upgradeAct(sp.name, sp.ledger.head, null, why) });
4731
- }
4755
+ const refusal = versionBelow(m.pkg, "0.30.0") ? this.unsignedRefusal(sp.name, sp.allow, "current") : null;
4756
+ this.catchUp(sp, me, ws, from, quiet, refusal ? () => { this.send(ws, { t: "act", act: this.upgradeAct(sp.name, sp.ledger.head, null, refusal) }); } : null);
4732
4757
  if (firstSession && m.role !== "cli") {
4733
4758
  this.commit(sp, { from: me.id, act: "JOIN", body: `${me.display} online (${me.agent})`, to: null, goal: null, ref: null });
4734
4759
  }
@@ -6532,16 +6557,76 @@ pantheon start</code></pre>
6532
6557
  ...(e.moved ? { moved: e.moved } : {}),
6533
6558
  }));
6534
6559
  }
6560
+ catchingUp = new WeakSet();
6561
+ catchUp(sp, me, ws, from, quiet, done, waited = 0, moved = false) {
6562
+ if (ws.readyState !== 1) {
6563
+ this.catchingUp.delete(ws);
6564
+ return;
6565
+ }
6566
+ this.catchingUp.add(ws);
6567
+ const POLL = 25;
6568
+ const behind = sp.ledger.since(from, 1).length > 0;
6569
+ if (behind && (ws.bufferedAmount > this.limits.replayHighWater || (sp.outbox?.length ?? 0) > 0)) {
6570
+ if (waited >= this.limits.replayStallMs) {
6571
+ this.log(`[${sp.name}] ${me.id}: a connection took none of its catch-up for ${Math.round(waited / 1000)} s — closed; it resumes on reconnect`);
6572
+ this.catchingUp.delete(ws);
6573
+ try {
6574
+ ws.close(1013, "CATCH_UP_STALLED");
6575
+ }
6576
+ catch { }
6577
+ return;
6578
+ }
6579
+ setTimeout(() => this.catchUp(sp, me, ws, from, quiet, done, waited + POLL, moved), POLL).unref?.();
6580
+ return;
6581
+ }
6582
+ let sent = 0;
6583
+ for (let page = sp.ledger.since(from); page.length; page = sp.ledger.since(from)) {
6584
+ for (const r of page) {
6585
+ sent += this.send(ws, { t: "act", act: r });
6586
+ if (!quiet && r.seq > me.delivered_seq) {
6587
+ me.delivered_seq = r.seq;
6588
+ moved = true;
6589
+ }
6590
+ from = r.seq;
6591
+ if (sent >= this.limits.replayStepBytes) {
6592
+ setTimeout(() => this.catchUp(sp, me, ws, from, quiet, done, 0, moved), 0).unref?.();
6593
+ return;
6594
+ }
6595
+ }
6596
+ }
6597
+ this.out(sp, () => {
6598
+ this.catchingUp.delete(ws);
6599
+ done?.();
6600
+ if (moved)
6601
+ this.broadcast(sp, () => ({ t: "roster", roster: this.roster(sp), now: Date.now() }));
6602
+ });
6603
+ }
6535
6604
  send(ws, msg) {
6536
6605
  const sp = this.spaceOf.get(ws);
6537
6606
  const payload = JSON.stringify(msg);
6538
- const run = () => { if (ws.readyState === 1)
6539
- ws.send(payload); };
6540
- if (!sp)
6541
- return run();
6607
+ const run = () => this.write(ws, payload);
6608
+ if (!sp) {
6609
+ run();
6610
+ return Buffer.byteLength(payload);
6611
+ }
6542
6612
  const instead = msg.t === "ack" && msg.cid ? { cid: msg.cid } : msg.t === "welcome" ? {} : null;
6543
6613
  const message = msg.t === "welcome" ? "the relay's disk is refusing writes, so it cannot let you in right now — reconnect in a moment" : STORAGE_HELD;
6544
6614
  this.out(sp, run, instead ? { ws, payload: JSON.stringify({ t: "error", code: "STORAGE", message, ...instead }), hangUp: msg.t === "welcome" } : undefined);
6615
+ return Buffer.byteLength(payload);
6616
+ }
6617
+ write(ws, payload) {
6618
+ if (ws.readyState !== 1)
6619
+ return false;
6620
+ if (ws.bufferedAmount > this.limits.socketBufferMax) {
6621
+ this.log(`! a connection with ${Math.round(ws.bufferedAmount / 1024 / 1024)} MB unread was cut off`);
6622
+ try {
6623
+ ws.terminate();
6624
+ }
6625
+ catch { }
6626
+ return false;
6627
+ }
6628
+ ws.send(payload);
6629
+ return true;
6545
6630
  }
6546
6631
  broadcast(sp, msg) {
6547
6632
  this.out(sp, () => {
@@ -6550,12 +6635,12 @@ pantheon start</code></pre>
6550
6635
  const seq = m.t === "act" ? m.act.seq : null;
6551
6636
  for (const mem of sp.members.values()) {
6552
6637
  let reached = false;
6553
- for (const s of mem.sessions.values())
6554
- if (s.ws.readyState === 1) {
6555
- s.ws.send(payload);
6556
- if (!s.quiet)
6557
- reached = true;
6558
- }
6638
+ for (const s of mem.sessions.values()) {
6639
+ if (seq !== null && this.catchingUp.has(s.ws))
6640
+ continue;
6641
+ if (this.write(s.ws, payload) && !s.quiet)
6642
+ reached = true;
6643
+ }
6559
6644
  if (reached && seq !== null && seq > mem.delivered_seq)
6560
6645
  mem.delivered_seq = seq;
6561
6646
  }
@@ -250,7 +250,7 @@ export class Allowlist {
250
250
  if (inv.used_by && inv.used_by === member && prior?.admitted && prior.publicKey === publicKey)
251
251
  return { ok: true, entry: prior };
252
252
  if (inv.used_by)
253
- return { ok: false, why: `that invite was already used by "${inv.used_by}" — ask for a fresh one` };
253
+ return { ok: false, why: "that invite was already used — ask for a fresh one" };
254
254
  if (Date.now() > inv.expires_at)
255
255
  return { ok: false, why: inv.recovery_for ? "that recovery link has expired — run pantheon recover again on the new machine" : "that invite has expired — ask for a fresh one" };
256
256
  if (inv.recovery_for) {
@@ -468,7 +468,7 @@ export async function runGuide(io, ctx, deps = {}, preset = {}) {
468
468
  next = {
469
469
  ...next,
470
470
  ...(ovKey ? { spaces: { ...next.spaces, [ovKey]: { ...next.spaces[ovKey], authority } } } : { authority }),
471
- agent: { ...next.agent, wake_enabled: a.wake !== "no", wake_default: a.wake, allow_bash: a.commands, approval: a.approval },
471
+ agent: { ...withoutKey(next.agent, "setup_confirmed"), wake_enabled: a.wake !== "no", wake_default: a.wake, allow_bash: a.commands, approval: a.approval },
472
472
  notifications: {
473
473
  decisions: a.notifications !== "none",
474
474
  deliveries: a.notifications === "deliveries" || a.notifications === "worker",
@@ -757,4 +757,8 @@ export function terminalIO(rl, out) {
757
757
  },
758
758
  };
759
759
  }
760
+ function withoutKey(o, key) {
761
+ const { [key]: _gone, ...rest } = o;
762
+ return rest;
763
+ }
760
764
  //# sourceMappingURL=setup-guide.js.map
package/dist/upgrade.js CHANGED
@@ -25,7 +25,7 @@ export const PKG_NAME = "@join-pantheon/cli";
25
25
  export function npmInstallArgs(version, managed = managedLayout()) {
26
26
  const P = /\.exe$/i.test(managed?.node ?? "") ? win32 : posix;
27
27
  const own = managed ? ["--prefix", managed.nodeDir, "--cache", P.join(managed.root, "runtime", "npm-cache"), "--fetch-timeout=60000", "--fetch-retries=2"] : [];
28
- return ["install", "-g", ...own, `${PKG_NAME}@${version ?? "latest"}`, "--no-audit", "--no-fund"];
28
+ return ["install", "-g", ...own, `${PKG_NAME}@${version ?? "latest"}`, "--ignore-scripts", "--no-audit", "--no-fund"];
29
29
  }
30
30
  export function npmFailed(spec, e, managed, os = process.platform, relay) {
31
31
  const first = String(e?.message ?? e).split("\n")[0];
@@ -389,7 +389,7 @@ export function stagedManagedUpgrade(m, spec, io = realSwapIo(m)) {
389
389
  catch { }
390
390
  }
391
391
  io.npm(["install", "-g", "--prefix", staging, "--cache", P.join(runtime, "npm-cache"), "--fetch-timeout=60000", "--fetch-retries=2",
392
- `${PKG_NAME}@${spec}`, "--no-audit", "--no-fund", "--loglevel=error"]);
392
+ `${PKG_NAME}@${spec}`, "--ignore-scripts", "--no-audit", "--no-fund", "--loglevel=error"]);
393
393
  let version = "";
394
394
  try {
395
395
  version = JSON.parse(io.read(P.join(stagedPkg, "package.json"))).version ?? "";
package/dist/worker.js CHANGED
@@ -695,6 +695,67 @@ pantheon_mass_check() {
695
695
  return 0
696
696
  }
697
697
  `;
698
+ export const PUSHED_SECRET_RE = "(AKIA[0-9A-Z]{16}|gh[pousr]_[A-Za-z0-9]{36}|github_pat_[A-Za-z0-9_]{60,}|npm_[A-Za-z0-9]{36}|xox[abprs]-[A-Za-z0-9-]{10,}|sk-ant-[A-Za-z0-9_-]{20,}|sk-proj-[A-Za-z0-9_-]{20,}|sk_live_[0-9A-Za-z]{24,})";
699
+ const PLACEHOLDER_RE = /(.)\1{5}|example|1234567|abcdef/i;
700
+ export class PushedSecretScan {
701
+ re = new RegExp(PUSHED_SECRET_RE, "g");
702
+ file = "";
703
+ files = [];
704
+ line(l) {
705
+ if (l.startsWith("+++ ")) {
706
+ this.file = l.replace(/^\+\+\+ (b\/)?/, "");
707
+ return;
708
+ }
709
+ if (!l.startsWith("+"))
710
+ return;
711
+ for (const m of l.matchAll(this.re)) {
712
+ if (!PLACEHOLDER_RE.test(m[1]) && !this.files.includes(this.file))
713
+ this.files.push(this.file);
714
+ }
715
+ }
716
+ }
717
+ export function pushedSecrets(patch) {
718
+ const scan = new PushedSecretScan();
719
+ for (const l of patch.split("\n"))
720
+ scan.line(l);
721
+ return scan.files;
722
+ }
723
+ export function pushSecretScan(cwd, ref, timeoutMs = FETCH_TIMEOUT_MS) {
724
+ const args = ["log", "-p", "--no-color", "--format=", ref, "--not", "--remotes"];
725
+ const argv = safeGitArgs(cwd, args);
726
+ return new Promise((res) => {
727
+ let child;
728
+ try {
729
+ child = procSpawn("git", argv, { cwd, env: gitCallEnv(args, gitEnv(process.env, proxyEnvFor(), cwd)), windowsHide: true, stdio: ["ignore", "pipe", "ignore"] });
730
+ }
731
+ catch {
732
+ res(null);
733
+ return;
734
+ }
735
+ const scan = new PushedSecretScan();
736
+ let rest = "";
737
+ child.stdout?.on("data", (b) => {
738
+ const lines = (rest + b.toString()).split("\n");
739
+ rest = lines.pop() ?? "";
740
+ for (const l of lines)
741
+ scan.line(l);
742
+ });
743
+ const timer = setTimeout(() => { child.kill("SIGKILL"); res(null); }, timeoutMs);
744
+ child.on("error", () => { clearTimeout(timer); res(null); });
745
+ child.on("close", (code) => { clearTimeout(timer); if (rest)
746
+ scan.line(rest); res(code === 0 ? scan.files : null); });
747
+ });
748
+ }
749
+ const SECRET_CHECK = `
750
+ pantheon_secret_check() {
751
+ hit=$(git log -p --no-color --format= "$1" --not --remotes 2>/dev/null | grep -E '^\\+' | grep -v '^+++' | grep -Eo '${PUSHED_SECRET_RE}' | grep -v '\\(.\\)\\1\\{5\\}' | grep -Eiv 'example|1234567|abcdef' | head -n 1)
752
+ if [ -n "$hit" ]; then
753
+ echo "pantheon: refusing to push — a commit on it adds what looks like a live credential (it starts $(printf '%s' "$hit" | cut -c1-8)…). Nothing was pushed. Take it out of the commits, or say so and let your person push it themselves." >&2
754
+ return 1
755
+ fi
756
+ return 0
757
+ }
758
+ `;
698
759
  const PRE_COMMIT = `#!/bin/sh
699
760
  # Pantheon: a woken run may not commit the deletion of most of the repo.
700
761
  ${MASS_CHECK}
@@ -704,8 +765,10 @@ exit 0
704
765
  `;
705
766
  const PRE_PUSH = `#!/bin/sh
706
767
  # Pantheon: a woken run pushes its own branch and nothing else — never another
707
- # branch (HEAD:main), never a deletion — and not the deletion of most of the repo.
768
+ # branch (HEAD:main), never a deletion — and not the deletion of most of the repo,
769
+ # nor a live credential.
708
770
  ${MASS_CHECK}
771
+ ${SECRET_CHECK}
709
772
  input=$(cat)
710
773
  printf '%s\\n' "$input" | while read -r lref lsha rref rsha; do
711
774
  [ -z "$lsha" ] && continue
@@ -714,6 +777,7 @@ printf '%s\\n' "$input" | while read -r lref lsha rref rsha; do
714
777
  fi
715
778
  case "$lsha" in 0000000*) echo "pantheon: a woken run may not delete a branch on the remote" >&2; exit 1;; esac
716
779
  pantheon_mass_check "$lsha" push pushed || exit 1
780
+ pantheon_secret_check "$lsha" || exit 1
717
781
  done || exit 1
718
782
  if [ -n "$PANTHEON_ORIG_HOOKS" ] && [ -x "$PANTHEON_ORIG_HOOKS/pre-push" ]; then printf '%s\\n' "$input" | "$PANTHEON_ORIG_HOOKS/pre-push" "$@"; exit $?; fi
719
783
  exit 0
@@ -4682,6 +4746,15 @@ export class Worker {
4682
4746
  async pushRunBranch(worktree, br, commit) {
4683
4747
  if (!validBase(br) || (await gitOut(worktree, ["merge-base", "--is-ancestor", commit, `refs/heads/${br}`])) === null)
4684
4748
  return false;
4749
+ const secrets = await pushSecretScan(worktree, `refs/heads/${br}`);
4750
+ if (secrets === null) {
4751
+ this.opts.log(`! not pushing ${br}: git could not show what it would push, so it was not checked for credentials — your person can push it themselves`);
4752
+ return false;
4753
+ }
4754
+ if (secrets.length) {
4755
+ this.opts.log(`! not pushing ${br}: it adds what looks like a live credential in ${secrets.join(", ")} — your person can check it and push it themselves`);
4756
+ return false;
4757
+ }
4685
4758
  const r = await gitOut(worktree, ["push", "--quiet", "origin", `refs/heads/${br}:refs/heads/${br}`], FETCH_TIMEOUT_MS);
4686
4759
  return r !== null && await onRemote(worktree, br, commit);
4687
4760
  }
@@ -5781,7 +5854,7 @@ export class Worker {
5781
5854
  choice = this.opts.wakeChoice === "unset" ? undefined : this.opts.wakeChoice;
5782
5855
  else {
5783
5856
  fromProfile = true;
5784
- choice = profile.agent.wake_default;
5857
+ choice = profile.agent.setup_confirmed === false ? undefined : profile.agent.wake_default;
5785
5858
  if (choice === undefined && this.joinedBefore030())
5786
5859
  choice = "unset-before-0.30";
5787
5860
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "format": 1,
3
- "built_at": "2026-10-26T18:29:59.588Z",
4
- "swiftc": "Apple Swift version 6.3.3 (swiftlang-6.3.3.1.3 clang-2100.1.1.101)",
3
+ "built_at": "2026-11-03T08:00:00.108Z",
4
+ "swiftc": "Apple Swift version 6.4.2 (swiftlang-6.4.2.1.9 clang-2100.4.1.1)",
5
5
  "helpers": {
6
6
  "pantheon-tray": {
7
7
  "source": "menubar.swift",
8
8
  "source_sha256": "b9beaac4b0a4fd58267c58343044742f356ffe709af85ae84f16a43e989dd897",
9
- "sha256": "28436afa6d1f58d91598e0df79fbc4365fe08fa9425738b9ccfaa2c7b98cb380",
9
+ "sha256": "1a26ea31f9ebc65fa814b696f11c5dbb398a1313d4a983b1eafdb60ee6429f5d",
10
10
  "archs": [
11
11
  "arm64",
12
12
  "x86_64"
@@ -17,7 +17,7 @@
17
17
  "pantheon-hud": {
18
18
  "source": "main.swift",
19
19
  "source_sha256": "4976c00b5d4bd0d8c509d2d284d9c6e2d70a1b3db952de5f11108dfff4951a82",
20
- "sha256": "a106f1ac2619d1797e19eae04aa24bb8ee3172e98a8e0e19bece61f055741dda",
20
+ "sha256": "4f41cf800c322ef947945ca7905bbae5faaa9d344594428dbdb09bb4ab20d734",
21
21
  "archs": [
22
22
  "arm64",
23
23
  "x86_64"
Binary file
Binary file
@@ -709,7 +709,8 @@ function Install-Pantheon {
709
709
  Resolve-PantheonSaid $State
710
710
  $said = if (Test-Path -LiteralPath $errFile) { [IO.File]::ReadAllText($errFile) } else { '' }
711
711
  if ($said) { [Console]::Error.Write($said) }
712
- if ($State.code -ne 0 -and $said -match 'sign in first|NOT_SIGNED_IN' -and $Arguments[0] -in @('join', 'start')) {
712
+ # 10: pantheon after 0.35.3 says "sign in first" by its exit code; older ones only in words.
713
+ if (($State.code -eq 10 -or ($State.code -ne 0 -and $said -match 'sign in first|NOT_SIGNED_IN')) -and $Arguments[0] -in @('join', 'start')) {
713
714
  $pantheonHome = if ($env:PANTHEON_HOME) { $env:PANTHEON_HOME } else { Join-Path ([Environment]::GetFolderPath('UserProfile')) '.pantheon' }
714
715
  $signedIn = $false
715
716
  try { $signedIn = [bool]((Get-Content -LiteralPath (Join-Path $pantheonHome 'config.json') -Raw | ConvertFrom-Json).account) } catch { $signedIn = $false }
@@ -717,7 +718,11 @@ function Install-Pantheon {
717
718
  # By the launcher's full path, as typed in PowerShell: whatever runs it
718
719
  # next (an agent's shell, a window opened before this install) may not
719
720
  # have the new PATH yet.
720
- $show = Format-PantheonCommand $launcher $Arguments 'powershell'
721
+ # Never the invite itself: this output ends up in agents' transcripts and CI
722
+ # logs, and the invite is a key to the team. The person has it where they got it.
723
+ $shown = @($Arguments)
724
+ if ($Arguments[0] -eq 'join' -and $shown.Count -ge 2) { $shown[1] = '<your invite link>' }
725
+ $show = Format-PantheonCommand $launcher $shown 'powershell'
721
726
  $what = if ($Arguments[0] -eq 'join') { 'joining' } else { 'creating your team' }
722
727
  Say ''
723
728
  Say "Pantheon is installed. To finish $what, open PowerShell and run: $show"
@@ -1068,7 +1073,7 @@ function Install-Pantheon {
1068
1073
  # which is what a TLS-inspecting company proxy needs.
1069
1074
  $env:Path = "$nodeDir;$env:Path"
1070
1075
  $npmArgs = $ca + @($npmCli, 'install', '-g', '--prefix', $nodeDir, '--cache', (Join-Path $runtime 'npm-cache'),
1071
- $spec, '--no-audit', '--no-fund', '--loglevel=error', '--fetch-timeout=60000', '--fetch-retries=2')
1076
+ $spec, '--ignore-scripts', '--no-audit', '--no-fund', '--loglevel=error', '--fetch-timeout=60000', '--fetch-retries=2')
1072
1077
  $code = Invoke-Logged $nodeExe $npmArgs $log
1073
1078
  if ($code -ne 0) {
1074
1079
  $why = (Get-Content -LiteralPath $log | Where-Object { $_ -match '^npm (error|ERR!) ' } | Select-Object -First 2 | ForEach-Object { $_ -replace '^npm (error|ERR!) ', '' }) -join '; '
@@ -413,10 +413,12 @@ else
413
413
  # NPM_CONFIG_PREFIX cannot send the package elsewhere; and the cache is
414
414
  # Pantheon's own, so a ~/.npm left root-owned by an old `sudo npm` cannot
415
415
  # fail it with EACCES. $ca (above) trusts the same certificates curl just
416
- # did, which is what a TLS-inspecting company proxy needs.
416
+ # did, which is what a TLS-inspecting company proxy needs. --ignore-scripts:
417
+ # nothing in Pantheon's tree needs an install script, so none runs, whatever a
418
+ # dependency's next version adds (deep review, 21 Oct).
417
419
  if ! PATH="$NODE_DIR/bin:$PATH" "$NODE" ${ca:+"$ca"} "$NODE_DIR/lib/node_modules/npm/bin/npm-cli.js" install -g \
418
420
  --prefix "$NODE_DIR" --cache "$RUNTIME/npm-cache" \
419
- "$spec" --no-audit --no-fund --loglevel=error --fetch-timeout=60000 --fetch-retries=2 >"$LOG" 2>&1; then
421
+ "$spec" --ignore-scripts --no-audit --no-fund --loglevel=error --fetch-timeout=60000 --fetch-retries=2 >"$LOG" 2>&1; then
420
422
  # npm's first two error lines (`code E404`, `404 Not Found - GET ...`) say why.
421
423
  why=$(grep -E '^npm (error|ERR!) ' "$LOG" | head -n 2 | sed -e 's/^npm error //' -e 's/^npm ERR! //' | tr '\n' ';' | sed 's/;$//; s/;/; /g' || true)
422
424
  [ -n "$why" ] || why=$(grep -m 1 -i 'error' "$LOG" || true)
@@ -764,10 +766,11 @@ fi
764
766
  #
765
767
  # What it cannot do here is sign in. On the hosted relay (or one of a team's
766
768
  # own that verifies email) join and start then stop at once, before anything
767
- # is changed, with "sign in first" (or the relay's NOT_SIGNED_IN). When that is
768
- # how it ended, and config.json still has no account, the last line says the
769
- # one thing to do. Any other failure (a mistyped link, an expired invite) keeps
770
- # pantheon's own words as the last line, since a terminal would not fix it.
769
+ # is changed, with "sign in first" (or the relay's NOT_SIGNED_IN), and exit 10 in
770
+ # releases after 0.35.3. When that is how it ended, and config.json still has no account, the
771
+ # last line says the one thing to do. Any other failure (a mistyped link, an
772
+ # expired invite) keeps pantheon's own words as the last line, since a terminal
773
+ # would not fix it. pantheon's exit code is passed on unchanged (but 3).
771
774
  code=0
772
775
  said=$(mktemp 2>/dev/null || true)
773
776
  if [ -n "$said" ]; then
@@ -777,15 +780,22 @@ if [ -n "$said" ]; then
777
780
  else
778
781
  "$LAUNCHER" "$@" </dev/null || code=$?
779
782
  fi
780
- if [ "$code" -ne 0 ] && [ -n "$said" ] && grep -qE 'sign in first|NOT_SIGNED_IN' "$said" 2>/dev/null; then
783
+ if [ "$code" -eq 10 ] || { [ "$code" -ne 0 ] && [ -n "$said" ] && grep -qE 'sign in first|NOT_SIGNED_IN' "$said" 2>/dev/null; }; then
781
784
  case "$1" in
782
785
  join | start)
783
786
  cfg="${PANTHEON_HOME:-$HOME/.pantheon}/config.json"
784
787
  if ! "$NODE" -e 'try { process.exit(JSON.parse(require("fs").readFileSync(process.argv[1], "utf8")).account ? 0 : 1) } catch { process.exit(1) }' "$cfg" 2>/dev/null; then
785
788
  # By its full path: whatever runs it next (an agent's shell, a terminal
786
789
  # opened before this install) may not have the new PATH yet.
790
+ # The invite (join's second word) is never printed again: this output
791
+ # ends up in agents' transcripts and CI logs, and the invite is a key to
792
+ # the team. The person has it where they got it. The rest is as typed.
787
793
  line=$(shown "$LAUNCHER")
788
- for a in "$@"; do line="$line $(shown "$a")"; done
794
+ n=0
795
+ for a in "$@"; do
796
+ n=$((n + 1))
797
+ if [ "$1" = join ] && [ "$n" -eq 2 ]; then line="$line '<your invite link>'"; else line="$line $(shown "$a")"; fi
798
+ done
789
799
  if [ "$1" = join ]; then what="joining"; else what="creating your team"; fi
790
800
  printf '\nPantheon is installed. To finish %s, open a terminal and run: %s\n' "$what" "$line" >&2
791
801
  fi