@join-pantheon/cli 0.36.0-rc.1 → 0.37.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/README.md +21 -35
- package/dist/accounts.js +90 -0
- package/dist/agent-check.js +115 -0
- package/dist/agents.js +1 -0
- package/dist/cli.js +294 -58
- package/dist/email-templates.js +18 -8
- package/dist/email.js +11 -10
- package/dist/finish-line.js +1 -1
- package/dist/flag-signin.js +305 -0
- package/dist/home-safety.js +2 -0
- package/dist/identity.js +19 -0
- package/dist/invites-sent.js +65 -0
- package/dist/managed.js +11 -26
- package/dist/mcp.js +21 -4
- package/dist/notice.js +15 -0
- package/dist/notifier.js +45 -1
- package/dist/onboard-copy.js +217 -0
- package/dist/profile.js +3 -1
- package/dist/protocol.js +10 -0
- package/dist/quickstart.js +4 -2
- package/dist/relay.js +195 -10
- package/dist/roster-file.js +1 -0
- package/dist/setup-guide.js +41 -7
- package/helper/macos/prebuilt/manifest.json +1 -1
- package/installer/install.ps1 +5 -2
- package/installer/install.sh +6 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -18,49 +18,35 @@ Nobody switches tools. Nothing leaves your machine except messages.
|
|
|
18
18
|
└─────────────────┘ └──────────────────┘ └─────────────────────┘
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
<!-- getting-started:start (generated from src/onboard-copy.ts — npm run gen:copy) -->
|
|
22
|
+
## Getting started
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Or run it without installing at all:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npx @join-pantheon/cli # guided sign-in; it tells you what to run next
|
|
32
|
-
```
|
|
24
|
+
Paste one line into a terminal on your own computer. It brings its own Node.js,
|
|
25
|
+
needs no admin rights, asks for your email and a 6-digit code, creates your team
|
|
26
|
+
and connects the coding agents it finds.
|
|
33
27
|
|
|
34
|
-
|
|
28
|
+
Mac or Linux (Terminal):
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
pantheon signup --email you@work.com --username you # get a 6-digit code by email
|
|
38
|
-
pantheon verify 123456 # confirm it
|
|
39
|
-
```
|
|
30
|
+
curl -fsSL https://relay.joinpantheon.network/install.sh | sh -s -- start
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
across every space on the hosted relay. A second machine joins the same account
|
|
43
|
-
with `pantheon login --email you@work.com`. See your devices and sign any of them
|
|
44
|
-
out with `pantheon sessions`; every identity and membership event is in `pantheon
|
|
45
|
-
audit`. (Self-hosting or on a LAN/tailnet? Accounts are optional there — skip
|
|
46
|
-
signing up and point `start` at your own relay: `pantheon start --relay ws://<host>:8787`.)
|
|
32
|
+
Windows (Command Prompt or PowerShell):
|
|
47
33
|
|
|
48
|
-
|
|
34
|
+
powershell -NoProfile -Command "Set-Item Env:PANTHEON_ARGS 'start'; irm https://relay.joinpantheon.network/install.ps1 | iex"
|
|
49
35
|
|
|
50
|
-
|
|
51
|
-
pantheon
|
|
52
|
-
|
|
36
|
+
With Node.js 22.13 or newer: `npm install -g @join-pantheon/cli` then `pantheon start`.
|
|
37
|
+
Invited to a team? Use the line in your invite (`pantheon join <invite>`).
|
|
38
|
+
Then `pantheon invite` gives you a block to forward to each teammate.
|
|
53
39
|
|
|
54
|
-
|
|
40
|
+
What it changes:
|
|
55
41
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
- Installs Pantheon in your home folder (~/.pantheon), with its own Node.js. No admin rights.
|
|
43
|
+
- Adds Pantheon to the coding agents it finds (Claude Code, Codex, Cursor, GitHub Copilot, Kiro) and pre-approves Pantheon's own tools there, so your agent is not asked each time it uses one.
|
|
44
|
+
- Starts a background helper when you log in. By default a teammate's request can start your agent while you're away: it works in a separate copy of the repo and delivers on its own branch for you to review, and in a repo it may run your tests, commit and push that branch. Claude Code's runs are sandboxed; Codex, Cursor and Copilot runs are not.
|
|
45
|
+
- Shows desktop alerts for the decisions that are yours (and a menu bar on a Mac).
|
|
46
|
+
- Change any of it later with `pantheon setup`, or remove it all with `pantheon uninstall`.
|
|
47
|
+
<!-- getting-started:end -->
|
|
59
48
|
|
|
60
|
-
|
|
61
|
-
`https://www.joinpantheon.network/join/acme#C1qhJfdHBaPjuG3jF48vcqrP`. Pasted into a chat it
|
|
62
|
-
unfurls with the team's name and hands the recipient the line for their agent. The token stays in the
|
|
63
|
-
URL fragment, which browsers never send to any server. `pantheon join` accepts either form.
|
|
49
|
+
### What start and join set up
|
|
64
50
|
|
|
65
51
|
Signed in, `pantheon start` puts your space on the hosted relay, so that link works from any
|
|
66
52
|
network — no tunnel, no VPN. The space is named after the folder you run it from (your repo,
|
|
@@ -77,7 +63,7 @@ That's it — one command each sets up the **whole machine**: a relay and space
|
|
|
77
63
|
every Conductor window, nothing to commit), the wake-up hook so an agent finishes what a peer is
|
|
78
64
|
waiting for, the **worker** so the machine answers the team even while its human is away (on by
|
|
79
65
|
default when run inside a git repo; `--no-worker` opts out), native decision alerts, and the menu bar. Each command
|
|
80
|
-
ends with
|
|
66
|
+
ends with "You're ready" or a short list of what is left, after a short guided setup on a terminal: two questions — your
|
|
81
67
|
name and your role — and one screen of defaults to keep or change: your teammates can hand work to
|
|
82
68
|
your machine while you are away, that work runs your tests and commits to its own branch so it
|
|
83
69
|
arrives ready to review, whichever agent you use (Claude Code, Codex, Cursor or Copilot) answers
|
package/dist/accounts.js
CHANGED
|
@@ -42,6 +42,23 @@ export const VIEWER_SESSION_MAX_MS = 7 * 86_400_000;
|
|
|
42
42
|
export const ADMIN_SESSION_MS = 12 * 3_600_000;
|
|
43
43
|
const newId = (p) => `${p}_${randomBytes(9).toString("base64url")}`;
|
|
44
44
|
const sha = (s) => createHash("sha256").update(s).digest("hex");
|
|
45
|
+
export const LINK_WRONG_PER_HOUR = 3;
|
|
46
|
+
export const LINK_WORDS = ("acorn amber anchor apple arrow aspen atlas autumn badge bagel bamboo banjo barley basil beacon beaver " +
|
|
47
|
+
"berry bison blanket blossom bonfire bramble breeze brick bridge brook bubble bucket buffalo bugle butter cabin " +
|
|
48
|
+
"cactus camel candle canoe canyon carbon carrot castle cedar cello chalk cherry chess cider cinder citrus clover " +
|
|
49
|
+
"cobalt cocoa comet compass copper coral cotton coyote crane crayon cricket crystal cuckoo cypress daisy delta " +
|
|
50
|
+
"denim desert dingo dolphin domino dragon drum dune eagle easel echo ember emerald falcon fennel fern ferry " +
|
|
51
|
+
"fiddle fig finch fjord flame flint forest fossil fox galaxy garden garnet gecko geyser ginger glacier globe " +
|
|
52
|
+
"goose granite grape gravel guitar gull hammer harbor harp hazel heron hickory honey hornet husky iris island " +
|
|
53
|
+
"ivory jade jasmine jelly juniper kayak kettle kiwi koala lagoon lantern lark lava lemon lilac lily linen " +
|
|
54
|
+
"lizard llama lobster locket lotus lunar lynx magnet mango maple marble meadow melon meteor mint mitten mocha " +
|
|
55
|
+
"monsoon moose mosaic moss muffin nectar nickel nutmeg oasis ocean olive onyx orbit orchid otter owl oyster " +
|
|
56
|
+
"paddle panda papaya parrot pebble pecan pelican pepper piano pickle pine pistachio planet plum pollen pony poppy " +
|
|
57
|
+
"prairie prism puffin pumpkin quartz quill rabbit radar radish raven reef ribbon river robin rocket rose ruby " +
|
|
58
|
+
"saddle saffron salmon sandal sapphire satin scarf seal sequoia shell sierra silver sloth snowflake sparrow spruce " +
|
|
59
|
+
"squid star stork summit sunset swan tango teapot thistle thunder tiger timber toast topaz tornado trout tulip " +
|
|
60
|
+
"tundra turnip turtle umbrella valley velvet violet volcano waffle walnut walrus willow wombat yarrow yeti zebra " +
|
|
61
|
+
"zephyr zinnia badger dove peach vanilla").split(" ");
|
|
45
62
|
export function normalizeEmail(email) {
|
|
46
63
|
return email.trim().toLowerCase();
|
|
47
64
|
}
|
|
@@ -133,6 +150,17 @@ export class Accounts {
|
|
|
133
150
|
created_at INTEGER NOT NULL,
|
|
134
151
|
PRIMARY KEY (email, pending_pubkey)
|
|
135
152
|
);
|
|
153
|
+
CREATE TABLE IF NOT EXISTS link_confirms (
|
|
154
|
+
token_hash TEXT PRIMARY KEY,
|
|
155
|
+
email TEXT NOT NULL,
|
|
156
|
+
pending_pubkey TEXT NOT NULL,
|
|
157
|
+
words TEXT NOT NULL,
|
|
158
|
+
label TEXT,
|
|
159
|
+
ip TEXT,
|
|
160
|
+
expires_at INTEGER NOT NULL,
|
|
161
|
+
created_at INTEGER NOT NULL,
|
|
162
|
+
voided INTEGER NOT NULL DEFAULT 0
|
|
163
|
+
);
|
|
136
164
|
CREATE TABLE IF NOT EXISTS verify_failures (
|
|
137
165
|
email TEXT PRIMARY KEY,
|
|
138
166
|
window_start INTEGER NOT NULL,
|
|
@@ -408,6 +436,10 @@ export class Accounts {
|
|
|
408
436
|
this.noteFail(netId, t);
|
|
409
437
|
return { ok: false, reason: "bad_code", tries_left: Math.max(0, MAX_ATTEMPTS - v.attempts - 1) };
|
|
410
438
|
}
|
|
439
|
+
return this.completeVerification(e, v, ip, keyId);
|
|
440
|
+
}
|
|
441
|
+
completeVerification(e, v, ip, keyId) {
|
|
442
|
+
const where = "email = ? AND pending_pubkey = ?";
|
|
411
443
|
const run = this.db.prepare.bind(this.db);
|
|
412
444
|
this.db.exec("BEGIN");
|
|
413
445
|
try {
|
|
@@ -433,6 +465,10 @@ export class Accounts {
|
|
|
433
465
|
}
|
|
434
466
|
else {
|
|
435
467
|
account = this.accountByEmail(e);
|
|
468
|
+
if (!account || account.status !== "active") {
|
|
469
|
+
this.db.exec("ROLLBACK");
|
|
470
|
+
return { ok: false, reason: "suspended" };
|
|
471
|
+
}
|
|
436
472
|
}
|
|
437
473
|
const device = this.bindDevice(account.id, v.pending_pubkey, v.pending_label ?? "a device");
|
|
438
474
|
const session = this.openSession(account.id, device.id, "", ip);
|
|
@@ -443,6 +479,10 @@ export class Accounts {
|
|
|
443
479
|
run("DELETE FROM verifications_by_device WHERE email = ? AND purpose != 'viewer'").run(e);
|
|
444
480
|
else
|
|
445
481
|
run(`DELETE FROM verifications_by_device WHERE ${where}`).run(e, v.pending_pubkey);
|
|
482
|
+
if (v.purpose === "signup")
|
|
483
|
+
run("DELETE FROM link_confirms WHERE email = ?").run(e);
|
|
484
|
+
else
|
|
485
|
+
run(`DELETE FROM link_confirms WHERE ${where}`).run(e, v.pending_pubkey);
|
|
446
486
|
run("DELETE FROM verify_failures WHERE email = ?").run(keyId);
|
|
447
487
|
this.db.exec("COMMIT");
|
|
448
488
|
this.audit({ actor_account: account.id, event: v.purpose === "signup" ? "email_verified" : "login", target: device.fingerprint, ip });
|
|
@@ -453,6 +493,54 @@ export class Accounts {
|
|
|
453
493
|
throw err;
|
|
454
494
|
}
|
|
455
495
|
}
|
|
496
|
+
startLink(email, pubkey, o) {
|
|
497
|
+
const e = normalizeEmail(email);
|
|
498
|
+
const v = this.db.prepare("SELECT expires_at FROM verifications_by_device WHERE email = ? AND pending_pubkey = ? AND purpose != 'viewer'").get(e, pubkey);
|
|
499
|
+
if (!v)
|
|
500
|
+
return null;
|
|
501
|
+
const token = randomBytes(16).toString("base64url");
|
|
502
|
+
const words = `${LINK_WORDS[randomInt(0, LINK_WORDS.length)]} ${LINK_WORDS[randomInt(0, LINK_WORDS.length)]}`;
|
|
503
|
+
this.db.prepare("DELETE FROM link_confirms WHERE email = ? AND pending_pubkey = ?").run(e, pubkey);
|
|
504
|
+
this.db.prepare("INSERT INTO link_confirms (token_hash, email, pending_pubkey, words, label, ip, expires_at, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")
|
|
505
|
+
.run(sha(token), e, pubkey, words, o.label.slice(0, 60), o.ip, v.expires_at, now());
|
|
506
|
+
return { token, words };
|
|
507
|
+
}
|
|
508
|
+
linkInfo(token) {
|
|
509
|
+
const r = this.db.prepare("SELECT * FROM link_confirms WHERE token_hash = ?").get(sha(token));
|
|
510
|
+
if (!r || r.voided || now() > r.expires_at)
|
|
511
|
+
return null;
|
|
512
|
+
return { label: r.label ?? "a device", ip: r.ip ?? "", created_at: r.created_at, email: r.email };
|
|
513
|
+
}
|
|
514
|
+
confirmLink(token, typed, ip) {
|
|
515
|
+
const r = this.db.prepare("SELECT * FROM link_confirms WHERE token_hash = ?").get(sha(token));
|
|
516
|
+
if (!r || r.voided || now() > r.expires_at)
|
|
517
|
+
return { ok: false, reason: "no_link" };
|
|
518
|
+
const words = typed.toLowerCase().replace(/[^a-z]+/g, " ").trim();
|
|
519
|
+
if (!/^[a-z]+ [a-z]+$/.test(words))
|
|
520
|
+
return { ok: false, reason: "empty" };
|
|
521
|
+
const lockId = `link:${r.email}`;
|
|
522
|
+
if (this.failsOf(lockId) >= LINK_WRONG_PER_HOUR)
|
|
523
|
+
return { ok: false, reason: "links_locked" };
|
|
524
|
+
const want = Buffer.from(sha(r.words)), got = Buffer.from(sha(words));
|
|
525
|
+
if (!(want.length === got.length && timingSafeEqual(want, got))) {
|
|
526
|
+
this.db.prepare("UPDATE link_confirms SET voided = 1 WHERE token_hash = ?").run(r.token_hash);
|
|
527
|
+
this.noteFail(lockId);
|
|
528
|
+
return { ok: false, reason: "wrong_words" };
|
|
529
|
+
}
|
|
530
|
+
const v = this.db.prepare("SELECT * FROM verifications_by_device WHERE email = ? AND pending_pubkey = ? AND purpose != 'viewer'").get(r.email, r.pending_pubkey);
|
|
531
|
+
if (!v || now() > v.expires_at)
|
|
532
|
+
return { ok: false, reason: "no_link" };
|
|
533
|
+
if (this.deviceOfOtherAccount(r.email, r.pending_pubkey))
|
|
534
|
+
return { ok: false, reason: "device_other_account" };
|
|
535
|
+
return this.completeVerification(r.email, v, ip, `key:${r.email}|${r.pending_pubkey}`);
|
|
536
|
+
}
|
|
537
|
+
pendingFor(pubkey) {
|
|
538
|
+
return !!this.db.prepare("SELECT 1 FROM verifications_by_device WHERE pending_pubkey = ? AND purpose != 'viewer' AND expires_at > ?").get(pubkey, now());
|
|
539
|
+
}
|
|
540
|
+
signedInDevice(pubkey) {
|
|
541
|
+
const d = this.deviceByPubkey(pubkey);
|
|
542
|
+
return d ? this.accountById(d.account_id) : null;
|
|
543
|
+
}
|
|
456
544
|
deviceOfOtherAccount(email, pubkey) {
|
|
457
545
|
const dev = this.deviceByPubkey(pubkey);
|
|
458
546
|
if (!dev)
|
|
@@ -543,6 +631,7 @@ export class Accounts {
|
|
|
543
631
|
try {
|
|
544
632
|
this.db.prepare("UPDATE spaces SET owner_deleted_at = ? WHERE owner_account = ?").run(now(), accountId);
|
|
545
633
|
this.db.prepare("DELETE FROM accounts WHERE id = ?").run(accountId);
|
|
634
|
+
this.db.prepare("DELETE FROM link_confirms WHERE email = ?").run(acct.email);
|
|
546
635
|
this.db.exec("COMMIT");
|
|
547
636
|
}
|
|
548
637
|
catch (e) {
|
|
@@ -888,6 +977,7 @@ export class Accounts {
|
|
|
888
977
|
const sCut = now() - sessionDays * 86_400_000;
|
|
889
978
|
this.db.prepare("DELETE FROM sessions WHERE ended_at IS NOT NULL AND ended_at < ?").run(now() - 7 * 86_400_000);
|
|
890
979
|
const s = this.db.prepare("DELETE FROM sessions WHERE last_seen < ?").run(sCut);
|
|
980
|
+
this.db.prepare("DELETE FROM link_confirms WHERE expires_at < ? OR voided = 1").run(now());
|
|
891
981
|
let a = { changes: 0 };
|
|
892
982
|
if (auditDays > 0)
|
|
893
983
|
a = this.db.prepare("DELETE FROM audit WHERE ts < ?").run(now() - auditDays * 86_400_000);
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
3
|
+
import { mkdirSync, mkdtempSync, rmSync } from "node:fs";
|
|
4
|
+
import { homedir, tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { agentById, headlessSpawn, materializeSpawnFiles, resolveBinary } from "./agents.js";
|
|
7
|
+
import { claudeTokenForRun } from "./agent-token.js";
|
|
8
|
+
import { detectClaudeFeatures } from "./claude-confine.js";
|
|
9
|
+
import { CONFIG_DIR } from "./config.js";
|
|
10
|
+
import { proxyEnvFor } from "./network.js";
|
|
11
|
+
import { agentSpawn } from "./which.js";
|
|
12
|
+
import { agentBaseEnv } from "./worker.js";
|
|
13
|
+
export const CHECK_TIMEOUT_MS = 60_000;
|
|
14
|
+
export const CHECK_PROMPT = "This is Pantheon's setup check. Call the pantheon_status tool once, then reply with exactly the text it returned and nothing else.";
|
|
15
|
+
function runIt(s, cwd, timeoutMs) {
|
|
16
|
+
return new Promise((resolve) => {
|
|
17
|
+
let out = "", timedOut = false, done = false;
|
|
18
|
+
const finish = (code) => { if (done)
|
|
19
|
+
return; done = true; clearTimeout(t); clearTimeout(grace); unhook?.(); resolve({ out, code, timedOut }); };
|
|
20
|
+
let unhook;
|
|
21
|
+
const win = process.platform === "win32";
|
|
22
|
+
const env = { ...agentBaseEnv(process.env, proxyEnvFor()), ...s.env };
|
|
23
|
+
let sp;
|
|
24
|
+
try {
|
|
25
|
+
sp = agentSpawn(s.command, s.args);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
out = e.message;
|
|
29
|
+
finish(null);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const p = spawn(sp.command, sp.args, { cwd, env, stdio: ["ignore", "pipe", "pipe"], windowsHide: true, detached: !win, ...sp.options });
|
|
33
|
+
const cap = (d) => { if (out.length < 200_000)
|
|
34
|
+
out += d.toString(); };
|
|
35
|
+
p.stdout?.on("data", cap);
|
|
36
|
+
p.stderr?.on("data", cap);
|
|
37
|
+
let grace;
|
|
38
|
+
const kill = () => {
|
|
39
|
+
try {
|
|
40
|
+
if (win && p.pid)
|
|
41
|
+
spawnSync("taskkill", ["/T", "/F", "/PID", String(p.pid)], { windowsHide: true });
|
|
42
|
+
else if (p.pid)
|
|
43
|
+
process.kill(-p.pid, "SIGKILL");
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
try {
|
|
47
|
+
p.kill("SIGKILL");
|
|
48
|
+
}
|
|
49
|
+
catch { }
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const t = setTimeout(() => { timedOut = true; kill(); grace = setTimeout(() => finish(null), 2_000); }, timeoutMs);
|
|
53
|
+
const onSignal = (sig) => { kill(); process.off("exit", onExit); process.exit(sig === "SIGINT" ? 130 : 143); };
|
|
54
|
+
const onExit = () => kill();
|
|
55
|
+
const onInt = () => onSignal("SIGINT"), onTerm = () => onSignal("SIGTERM");
|
|
56
|
+
process.once("SIGINT", onInt);
|
|
57
|
+
process.once("SIGTERM", onTerm);
|
|
58
|
+
process.once("exit", onExit);
|
|
59
|
+
unhook = () => { process.off("SIGINT", onInt); process.off("SIGTERM", onTerm); process.off("exit", onExit); };
|
|
60
|
+
p.on("error", (e) => { out += `\n${e.message}`; finish(null); });
|
|
61
|
+
p.on("exit", (code) => { grace = setTimeout(() => { kill(); finish(code); }, 1_000); });
|
|
62
|
+
p.on("close", (code) => finish(code));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export async function checkAgent(cfg, deps) {
|
|
66
|
+
const now = deps.now ?? Date.now;
|
|
67
|
+
const r = deps.readiness();
|
|
68
|
+
if (!r.ok || !r.agent)
|
|
69
|
+
return { ok: false, agent: r.agent ?? null, says: r.says || "No agent here can take teammates' requests while you're away.", fix: r.fix || "pantheon doctor says why" };
|
|
70
|
+
const backend = agentById(r.agent);
|
|
71
|
+
const binary = backend ? (deps.binary ?? resolveBinary)(backend) : null;
|
|
72
|
+
if (!backend || !binary)
|
|
73
|
+
return { ok: false, agent: r.agent, says: `${backend?.label ?? r.agent} was not found on this machine.`, fix: r.fix || "install it, then run: pantheon check" };
|
|
74
|
+
const word = randomBytes(9).toString("hex");
|
|
75
|
+
const dir = mkdtempSync(join(tmpdir(), "pantheon-check-"));
|
|
76
|
+
const cleanup = () => { try {
|
|
77
|
+
rmSync(dir, { recursive: true, force: true });
|
|
78
|
+
}
|
|
79
|
+
catch { } };
|
|
80
|
+
process.once("exit", cleanup);
|
|
81
|
+
const work = join(dir, "work"), runHome = join(dir, "home");
|
|
82
|
+
mkdirSync(work, { mode: 0o700 });
|
|
83
|
+
mkdirSync(runHome, { mode: 0o700 });
|
|
84
|
+
const t0 = now();
|
|
85
|
+
try {
|
|
86
|
+
const token = backend.id === "claude-code" ? claudeTokenForRun() : null;
|
|
87
|
+
const features = backend.id === "claude-code" ? (deps.claudeFeatures ?? detectClaudeFeatures)(binary) : null;
|
|
88
|
+
const home = homedir();
|
|
89
|
+
const s = headlessSpawn({
|
|
90
|
+
backend, binary, prompt: CHECK_PROMPT, worktree: work, cfg, branch: "pantheon-check", allowBash: false, selfTest: word, runHome,
|
|
91
|
+
...(token ? { claudeToken: token } : {}),
|
|
92
|
+
...(features ? { claude: { features, pantheonHome: CONFIG_DIR, home, userSettings: join(home, ".claude", "settings.json") } } : {}),
|
|
93
|
+
});
|
|
94
|
+
materializeSpawnFiles(work, s, runHome);
|
|
95
|
+
const res = await (deps.run ?? runIt)(s, work, deps.timeoutMs ?? CHECK_TIMEOUT_MS);
|
|
96
|
+
const seconds = Math.max(1, Math.round((now() - t0) / 1000));
|
|
97
|
+
if (res.out.includes(word))
|
|
98
|
+
return { ok: true, agent: backend.label, seconds };
|
|
99
|
+
const tail = res.out.trim().split("\n").slice(-3).join(" ").slice(0, 300);
|
|
100
|
+
if (res.timedOut)
|
|
101
|
+
return { ok: false, agent: backend.label, seconds, says: `${backend.label} did not answer within ${Math.round((deps.timeoutMs ?? CHECK_TIMEOUT_MS) / 1000)} seconds.`, fix: "run pantheon check again; if it repeats, pantheon doctor" };
|
|
102
|
+
if (/log ?in|sign ?in|authenticat|unauthori[sz]ed|credential|api key/i.test(res.out)) {
|
|
103
|
+
return { ok: false, agent: backend.label, seconds, says: `${backend.label} is not signed in for runs without you.`, fix: r.fix || `sign ${backend.label} in, then run: pantheon check` };
|
|
104
|
+
}
|
|
105
|
+
return { ok: false, agent: backend.label, seconds, says: `${backend.label} ran but did not reach Pantheon's tools${tail ? ` (it said: ${tail})` : ""}.`, fix: "pantheon doctor — then pantheon check again" };
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
return { ok: false, agent: backend.label, says: `${backend.label} could not be started: ${e.message.split("\n")[0]}`, fix: "pantheon doctor" };
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
process.off("exit", cleanup);
|
|
112
|
+
cleanup();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=agent-check.js.map
|
package/dist/agents.js
CHANGED
|
@@ -683,6 +683,7 @@ export function headlessSpawn(opts) {
|
|
|
683
683
|
...(opts.base ? { PANTHEON_BASE: opts.base } : {}),
|
|
684
684
|
...(opts.goal ? { PANTHEON_GOAL: opts.goal } : {}),
|
|
685
685
|
...(home ? { PANTHEON_HOME: home } : {}),
|
|
686
|
+
...(opts.selfTest ? { PANTHEON_MCP_SELFTEST: opts.selfTest } : {}),
|
|
686
687
|
};
|
|
687
688
|
if (opts.backend.id === "claude-code") {
|
|
688
689
|
const mcpCfg = join(opts.worktree, ".pantheon-mcp.json");
|