@join-pantheon/cli 0.33.7 → 0.33.9-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/agents.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { execFileSync } from "node:child_process";
2
2
  import { createHash, randomBytes } from "node:crypto";
3
- import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, readlinkSync, renameSync, rmSync } from "node:fs";
3
+ import { accessSync, constants as fsConstants, cpSync, existsSync, statSync, lstatSync, mkdirSync, readdirSync, readFileSync, readlinkSync, renameSync, rmSync } from "node:fs";
4
4
  import { constants as osConstants, homedir, platform } from "node:os";
5
5
  import { join, dirname, isAbsolute, relative } from "node:path";
6
6
  import { copyInside, mkdirInside, writeInside } from "./safe-write.js";
@@ -134,17 +134,22 @@ const notCursorAgent = new Set();
134
134
  export const READINESS_LOOKUP_MS = 3_000;
135
135
  export function forgetMissingBinaries() {
136
136
  for (const [b, v] of binaryCache)
137
- if (!v.path)
137
+ if (!v.path || v.known)
138
138
  binaryCache.delete(b);
139
139
  }
140
140
  export function resolveBinary(backend, o = {}) {
141
141
  for (const b of backend.binaries) {
142
142
  const cached = binaryCache.get(b);
143
- if (!cached || (!cached.path && Date.now() - cached.at > NOT_FOUND_TTL_MS)) {
143
+ if (!cached || ((!cached.path || cached.known) && Date.now() - cached.at > NOT_FOUND_TTL_MS)) {
144
144
  const hit = o.lookupTimeoutMs !== undefined
145
145
  ? which(b, platform(), process.env, { login: (n) => loginShellLookup(n, loginShellRunner(o.lookupTimeoutMs)) })
146
146
  : which(b);
147
147
  let found = hit ? (platform() === "win32" ? hit : b) : null;
148
+ const known = !found && b !== "agent" ? knownUserBinary(b) : null;
149
+ if (known) {
150
+ binaryCache.set(b, { path: known, at: Date.now(), known: true });
151
+ return known;
152
+ }
148
153
  if (found && b === "agent") {
149
154
  if (notCursorAgent.has(hit))
150
155
  found = null;
@@ -343,6 +348,29 @@ export function unattendedRefusal(c, o = {}) {
343
348
  export function claudeInstallCommand(os = platform()) {
344
349
  return os === "win32" ? "irm https://claude.ai/install.ps1 | iex (in PowerShell)" : "curl -fsSL https://claude.ai/install.sh | bash";
345
350
  }
351
+ export function claudeInstallSteps(os = platform(), o = {}) {
352
+ if (os === "win32") {
353
+ return `${o.gitMissing ? "install Git for Windows first (winget install --id Git.Git -e --source winget, or download it from git-scm.com) — Claude Code needs it; then, " : ""}in PowerShell: irm https://claude.ai/install.ps1 | iex — then close PowerShell, open a new one, type claude, then /login`;
354
+ }
355
+ const window = os === "darwin" ? "a new Terminal window" : "a new terminal window";
356
+ return `${claudeInstallCommand(os)} — then open ${window}, type claude, then /login${o.short ? "" : " (if it says command not found, type ~/.local/bin/claude instead)"}`;
357
+ }
358
+ export function knownUserBinary(name, home = homedir(), os = platform()) {
359
+ if (os === "win32" || !/^[a-z][a-z0-9-]*$/.test(name))
360
+ return null;
361
+ for (const dir of [join(home, ".local", "bin"), ...(name === "claude" ? [join(home, ".claude", "local")] : [])]) {
362
+ const f = join(dir, name);
363
+ try {
364
+ if (statSync(f).isFile()) {
365
+ accessSync(f, fsConstants.X_OK);
366
+ return f;
367
+ }
368
+ }
369
+ catch { }
370
+ }
371
+ return null;
372
+ }
373
+ export const gitMissing = (os = platform()) => os === "win32" && !cliOnPath("git");
346
374
  export function unattendedReadiness(o = {}) {
347
375
  if (o.available)
348
376
  return readinessFrom(o.available, o);
@@ -411,7 +439,7 @@ function readinessFrom(given, o) {
411
439
  ok: false, code: kiro ? "kiro_only" : "no_agent", short: "Claude Code (or another agent CLI) isn't installed",
412
440
  says: `No agent on this machine can take teammates' requests while you're away: none of claude, codex, cursor-agent or copilot is installed${kiro ? " (Kiro answers only in your live sessions)" : ""}. ` +
413
441
  `The Claude desktop app alone is not enough — it puts no command-line tool here.`,
414
- fix: `Install Claude Code: ${claudeInstallCommand(os)} — then run \`claude\` once and sign in (/login). Codex (npm install -g @openai/codex), Cursor's cursor-agent or GitHub's copilot CLI work too.`,
442
+ fix: `Install Claude Code: ${claudeInstallSteps(os, { gitMissing: o.gitMissing ?? gitMissing(os) })}. Codex (npm install -g @openai/codex), Cursor's cursor-agent or GitHub's copilot CLI work too.`,
415
443
  };
416
444
  }
417
445
  let choice;
@@ -431,17 +459,17 @@ function readinessFrom(given, o) {
431
459
  return { ok: false, code: refused.cause === "not_for_unattended" ? "kiro_only" : "unsandboxed_off", ...(pinnedOff ? { pinned: true } : {}), short: `${choice.backend.label} is set to leave requests for them`, says: `Teammates' requests wait for your next session here: ${refused.says}`, fix };
432
460
  }
433
461
  if (refused || (choice.signIn && !choice.signIn.ok && !choice.signIn.unknown)) {
434
- return { ok: false, code: "not_signed_in", short: `${choice.backend.label} isn't signed in`, says: `${choice.backend.label} is installed but not signed in, so a request while you're away would fail.`,
435
- fix: SIGN_IN_CHECK[choice.backend.id].fix };
462
+ return { ok: false, code: "not_signed_in", short: `${choice.backend.label} isn't signed in`, says: `${choice.backend.label} is installed but signed out, so a request while you're away would fail.`,
463
+ fix: SIGN_IN_CHECK[choice.backend.id].fix, agent: choice.backend.id };
436
464
  }
437
465
  if (o.commandsOn && choice.backend.id === "claude-code" && os === "linux") {
438
466
  const p = (o.sandboxProbe ?? probeLinuxSandbox)();
439
467
  if (p && !p.ok) {
440
468
  const a = sandboxAdvice(p, { container: !!o.inContainer });
441
- return { ok: false, code: "sandbox_unavailable", short: "its Linux sandbox can't start", says: a.says, fix: a.fix };
469
+ return { ok: false, code: "sandbox_unavailable", short: "its Linux sandbox can't start", says: a.says, fix: a.fix, agent: choice.backend.id };
442
470
  }
443
471
  }
444
- return { ok: true, short: "", says: `${choice.backend.label} takes teammates' requests while you're away.`, fix: "" };
472
+ return { ok: true, short: "", says: `${choice.backend.label} takes teammates' requests while you're away.`, fix: "", agent: choice.backend.id, ...(choice.signIn?.unknown ? { unknown: true } : {}) };
445
473
  }
446
474
  export function describeChoice(c) {
447
475
  const head = `${c.backend.label}${c.signIn ? ` — ${c.signIn.detail}` : ""} (${c.because})`;
package/dist/board.js CHANGED
@@ -883,6 +883,9 @@ export function renderWatch(s, o = { now: Date.now() }) {
883
883
  const spaces = s.spaces ?? (s.space ? [s.space] : []);
884
884
  const multi = spaces.length > 1;
885
885
  lines.push(fit(`${B("Pantheon board")} ${termSafe(s.member ?? "")} · ${termSafe(multi ? `${spaces.length} teams` : (s.space ?? ""))} · ${s.relay_ok ? `${s.online ?? 0} of ${s.members ?? 0} online` : "relay unreachable"} · worker ${s.worker_running ? "running" : "off"}`, width + (o.color ? 8 : 0)));
886
+ if (s.agent_problem)
887
+ for (const l of wrapWords(`! ${termSafe(s.agent_problem_lead ?? "Unattended work can't run")}: ${termSafe(s.agent_problem)}`, width))
888
+ lines.push(Y(l));
886
889
  if (s.relay_ok === false || s.decisions_ok === false)
887
890
  lines.push(Y(fit(`! Could not reach: ${termSafe((s.unavailable_spaces ?? []).join(", ") || "the relay")} — what is shown may be incomplete`)));
888
891
  const items = s.items ?? [];
@@ -909,6 +912,20 @@ export function renderWatch(s, o = { now: Date.now() }) {
909
912
  lines.push("", D(fit(`updated ${stamp} · refreshes every ${BOARD_REFRESH_MS / 1000}s · r refresh · q quit · the board in a browser: pantheon board`)));
910
913
  return lines.join("\n") + "\n";
911
914
  }
915
+ function wrapWords(text, width) {
916
+ const out = [];
917
+ let line = "";
918
+ for (const w of text.split(/\s+/).filter(Boolean)) {
919
+ if (line && line.length + 1 + w.length > width) {
920
+ out.push(line);
921
+ line = "";
922
+ }
923
+ line = line ? `${line} ${w}` : w.length > width ? w.slice(0, width) : w;
924
+ }
925
+ if (line)
926
+ out.push(line);
927
+ return out;
928
+ }
912
929
  export async function watchBoard(o = {}) {
913
930
  const status = o.status ?? (async () => (await import("./tray.js")).trayStatus());
914
931
  const out = o.out ?? process.stdout;
@@ -989,6 +1006,7 @@ export function boardHtml(nonce) {
989
1006
  <div class="title"><h1>Pantheon</h1><p id="who" class="muted"></p></div>
990
1007
  <div class="bar"><span id="health" class="muted"></span><button type="button" id="refresh">Refresh</button></div>
991
1008
  </header>
1009
+ <div id="problem" class="banner problem" role="status" hidden><strong id="problem-lead"></strong> <span id="problem-text"></span></div>
992
1010
  <div id="banner" class="banner" role="alert" hidden></div>
993
1011
  <main id="board" tabindex="-1" aria-busy="true">
994
1012
  <p id="loading" class="muted">Loading your board…</p>
@@ -1060,6 +1078,7 @@ button[disabled]{opacity:.55;cursor:default}
1060
1078
  .primary{background:var(--accent);border-color:var(--accent);color:var(--accent-text)}
1061
1079
  .banner{max-width:980px;margin:12px auto 0;padding:10px 14px;border-radius:8px;background:var(--warn-bg);color:var(--warn-text)}
1062
1080
  .banner.err{background:var(--err-bg);color:var(--err-text)}
1081
+ .banner.problem{border-left:4px solid var(--warn-text);overflow-wrap:anywhere}
1063
1082
  .empty{margin:4px 0}
1064
1083
  dialog{border:1px solid var(--line);border-radius:12px;padding:0;background:var(--card);color:var(--text);width:min(760px,96vw);max-height:92vh}
1065
1084
  dialog::backdrop{background:rgba(0,0,0,.45)}
@@ -1182,7 +1201,12 @@ function render() {
1182
1201
  }
1183
1202
  const spaces = s.spaces || (s.space ? [s.space] : []);
1184
1203
  $("who").textContent = (s.member || "") + " · " + (spaces.length > 1 ? spaces.length + " teams: " + spaces.join(", ") : "team " + (s.space || ""));
1185
- $("health").textContent = (s.relay_ok ? (s.online || 0) + " of " + (s.members || 0) + " online" : "relay unreachable") + " · worker " + (s.worker_running ? "running" : "off") + (s.worker_state ? " (" + s.worker_state + ")" : "");
1204
+ // This computer can't take teammates' requests (signed out, no agent CLI): a row of its own, in full, above the lanes.
1205
+ const problem = s.agent_problem || "";
1206
+ $("problem").hidden = !problem;
1207
+ $("problem-lead").textContent = problem ? (s.agent_problem_lead || "Unattended work can't run") + ":" : "";
1208
+ $("problem-text").textContent = problem;
1209
+ $("health").textContent = (s.relay_ok ? (s.online || 0) + " of " + (s.members || 0) + " online" : "relay unreachable") + " · worker " + (s.worker_running ? "running" : "off") + (problem ? "" : s.worker_state ? " (" + s.worker_state + ")" : "");
1186
1210
  const down = (s.unavailable_spaces || []);
1187
1211
  const items = s.items || [];
1188
1212
  if (!s.relay_ok && !items.length) banner("The relay could not be reached" + (down.length ? " for " + down.join(", ") : "") + ". The board will try again in " + Math.round(refreshMs / 1000) + " seconds.", true);
@@ -238,7 +238,7 @@ function userExcludedCommands(file) {
238
238
  }
239
239
  }
240
240
  export const SECRET_FILE_GLOBS = [".env", ".env.*", "*.pem", "*.key", "*.p12", "*.pfx", "id_rsa*", "id_ed25519*", ".npmrc", ".netrc", "credentials*", "*.keystore", "service-account*.json"];
241
- const PANTHEON_HOME_ENTRIES = ["config.json", "config.json.bak", "config.json.lock", "worker-policy.json", "profile.json", "continued.json", "removed.json", "removed.json.lock", "readiness-recheck.stamp", "bin", "runtime", "ops", "run-homes", "logs", "mcp", "data"];
241
+ const PANTHEON_HOME_ENTRIES = ["config.json", "config.json.bak", "config.json.lock", "worker-policy.json", "profile.json", "continued.json", "removed.json", "removed.json.lock", "readiness-recheck.stamp", "readiness-alert.json", "readiness-alert.json.lock", "bin", "runtime", "ops", "run-homes", "logs", "mcp", "data"];
242
242
  function aroundWorktree(top, keeps, named) {
243
243
  const keep = (typeof keeps === "string" ? [keeps] : [...keeps]).map((k) => resolve(k));
244
244
  const out = [];
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import { install, launcher, installForUser, windowsRepoOverrides, agentAsksOnce
19
19
  import { Relay } from "./relay.js";
20
20
  import { runMcp } from "./mcp.js";
21
21
  import { Worker } from "./worker.js";
22
- import { DEFAULT_REMINDER_MS, ensureNativeNotifier, HumanNotifier, runNotifiers, sendDesktopNotification } from "./notifier.js";
22
+ import { DEFAULT_REMINDER_MS, ensureNativeNotifier, HumanNotifier, hudBinaryPath, runNotifiers, sendDesktopNotification } from "./notifier.js";
23
23
  import { linuxDesktopReachable } from "./notice-linux.js";
24
24
  import { desktopUnavailable, hostEnv } from "./host-env.js";
25
25
  import { commandState } from "./command-state.js";
@@ -41,10 +41,12 @@ import { pending, render as renderPending } from "./pending.js";
41
41
  import { signedRead } from "./reads.js";
42
42
  import { start as qsStart, join as qsJoin, wireUp, teamNameFor, deviceLabel, bindableFolder, startReconnects } from "./quickstart.js";
43
43
  import { recordedAgent, unattendedReadiness } from "./agents.js";
44
+ import { agentProblem, PROBLEM_LEAD } from "./readiness-alert.js";
45
+ import { stripControls } from "./notice.js";
44
46
  import { pickupEstimate } from "./pickup.js";
45
47
  import { loadPolicy, requestReadinessRecheck, unsandboxedAllowed } from "./worker-policy.js";
46
48
  import { alreadyMemberLine, askedLine, configureLines, fetchSeats, inUseLine, offerSeats, seatsForTeam, seatsToMove, startGate, RECOVER_WAITING_EXIT } from "./recover-offer.js";
47
- import { shellArg, teamNameProblem } from "./team-name.js";
49
+ import { hyphenateSpaces, shellArg, teamNameProblem } from "./team-name.js";
48
50
  import { folderRefusalHere, isTemporaryRefusal, projectFolderAnswer } from "./folder-guard.js";
49
51
  import { installService, serviceInstalled, serviceLogFile, uninstallService } from "./service.js";
50
52
  import { LEGACY_TASK_NAME, hostAlive, hostFiles, readHostState, recordedTaskName } from "./win-host.js";
@@ -1037,6 +1039,7 @@ async function fetchAct(cfg, id, budgetMs = Number.POSITIVE_INFINITY) {
1037
1039
  }
1038
1040
  return null;
1039
1041
  }
1042
+ const termSafeLine = stripControls;
1040
1043
  function workerMidRun() {
1041
1044
  try {
1042
1045
  const s = JSON.parse(readFileSync(join(CONFIG_DIR, "worker-state.json"), "utf8"));
@@ -1266,6 +1269,18 @@ function notifyFromWorker(n) {
1266
1269
  c.on("error", () => { });
1267
1270
  c.unref();
1268
1271
  }
1272
+ function workerCanAlert() {
1273
+ if (!serviceInstalled("notifier"))
1274
+ return false;
1275
+ if (process.platform === "linux") {
1276
+ if (!workerAlerts || Date.now() - workerAlerts.at > 60_000)
1277
+ workerAlerts = { at: Date.now(), ok: linuxDesktopReachable() };
1278
+ return workerAlerts.ok;
1279
+ }
1280
+ if (process.platform === "darwin")
1281
+ return existsSync(hudBinaryPath());
1282
+ return true;
1283
+ }
1269
1284
  const QUIET = new Set(["mcp", "hook", "pending", "version", "tray-status", "handle-uri", "notice-show"]);
1270
1285
  function usageFor(command, help) {
1271
1286
  const plain = help.replace(/\x1b\[[0-9;]*m/g, "").split("\n");
@@ -1499,8 +1514,14 @@ async function main() {
1499
1514
  }
1500
1515
  }
1501
1516
  }
1517
+ let createAs = flag("space");
1502
1518
  if (named && !localTeam && seatsKnown) {
1503
- const bad = teamNameProblem(named);
1519
+ const hyphened = hyphenateSpaces(named);
1520
+ if (hyphened !== named && !teamNameProblem(hyphened)) {
1521
+ console.error(D(` A team name can't have spaces, so "${named}" is created as "${hyphened}".\n`));
1522
+ createAs = hyphened;
1523
+ }
1524
+ const bad = teamNameProblem(createAs);
1504
1525
  if (bad)
1505
1526
  die(bad);
1506
1527
  }
@@ -1512,7 +1533,7 @@ async function main() {
1512
1533
  dataDir: resolveDataDir(flag("data")).dir,
1513
1534
  ttlMinutes: numFlag("ttl", 1440),
1514
1535
  reset: argv.includes("--reset"),
1515
- ...(flag("space") ? { space: flag("space") } : {}),
1536
+ ...(createAs ? { space: createAs } : {}),
1516
1537
  ...(flag("me") ? { me: flag("me") } : {}),
1517
1538
  ...(flag("relay") ? { relay: flag("relay") } : {}),
1518
1539
  ...(setupFlags.preset.wake ? { wake: setupFlags.preset.wake } : {}),
@@ -1677,10 +1698,16 @@ async function main() {
1677
1698
  }
1678
1699
  case "init": {
1679
1700
  const had = argv.includes("--reset") ? null : identity();
1680
- if (flag("space") && !flag("token")) {
1701
+ let initSpace = flag("space");
1702
+ if (initSpace && !flag("token")) {
1681
1703
  const f0 = loadAll();
1682
- if (!(f0 && findMembership(f0, flag("space")))) {
1683
- const bad = teamNameProblem(flag("space"));
1704
+ if (!(f0 && findMembership(f0, initSpace))) {
1705
+ const hyphened = hyphenateSpaces(initSpace);
1706
+ if (hyphened !== initSpace && !teamNameProblem(hyphened)) {
1707
+ console.error(D(` A team name can't have spaces, so "${initSpace}" is created as "${hyphened}".`));
1708
+ initSpace = hyphened;
1709
+ }
1710
+ const bad = teamNameProblem(initSpace);
1684
1711
  if (bad)
1685
1712
  die(bad);
1686
1713
  }
@@ -1688,7 +1715,7 @@ async function main() {
1688
1715
  const kp = had?.publicKey && had.privateKey ? { publicKey: had.publicKey, privateKey: had.privateKey } : newKeypair();
1689
1716
  const cfg = {
1690
1717
  relay: flag("relay", "ws://localhost:8787"),
1691
- space: flag("space", "team"),
1718
+ space: initSpace ?? "team",
1692
1719
  token: flag("token", randomBytes(16).toString("hex")),
1693
1720
  member: flag("me") ?? had?.member ?? process.env.USER ?? "me",
1694
1721
  publicKey: kp.publicKey,
@@ -2154,6 +2181,16 @@ async function main() {
2154
2181
  client.close();
2155
2182
  };
2156
2183
  const ts = targets();
2184
+ {
2185
+ const problem = (() => { try {
2186
+ return agentProblem(CONFIG_DIR);
2187
+ }
2188
+ catch {
2189
+ return null;
2190
+ } })();
2191
+ if (problem)
2192
+ console.log(`\x1b[33m${B(`${PROBLEM_LEAD}:`)} ${problem}\x1b[0m\n`);
2193
+ }
2157
2194
  for (const [i, c] of ts.entries()) {
2158
2195
  if (ts.length > 1)
2159
2196
  console.log(`${i ? "\n" : ""}${D("━━━ team")} ${B(c.space)} ${D(`(${i + 1} of ${ts.length}) ━━━`)}`);
@@ -2467,7 +2504,16 @@ async function main() {
2467
2504
  }
2468
2505
  if (worker.running) {
2469
2506
  console.log(` worker ${C("running")} ${runBy(worker)} pid ${worker.pid}`);
2470
- console.log(` ${D("a teammate approved on this machine (pantheon wake list) can start an agent run here")}`);
2507
+ const problem = (() => { try {
2508
+ return agentProblem(CONFIG_DIR);
2509
+ }
2510
+ catch {
2511
+ return null;
2512
+ } })();
2513
+ if (problem)
2514
+ console.log(` \x1b[33m${PROBLEM_LEAD.toLowerCase()}: ${problem}\x1b[0m`);
2515
+ else
2516
+ console.log(` ${D("a teammate approved on this machine (pantheon wake list) can start an agent run here")}`);
2471
2517
  }
2472
2518
  else {
2473
2519
  const paused = worker.managedBy === "host" && existsSync(hostFiles().disabled("worker"));
@@ -4492,10 +4538,67 @@ async function main() {
4492
4538
  if (id === "all")
4493
4539
  id = undefined;
4494
4540
  }
4541
+ if (hud?.action === "fix" && hud.fix_kind === "sign_in") {
4542
+ const { SIGN_IN_COMMANDS, signInSteps } = await import("./readiness-alert.js");
4543
+ const { agentById, resolveBinary } = await import("./agents.js");
4544
+ const b = agentById(hud.agent ?? "") ?? agentById("claude-code");
4545
+ const cmd = SIGN_IN_COMMANDS[b.id];
4546
+ console.error(`${B(`Sign in to ${b.label}`)}\n ${b.label} is signed out, so teammates' requests wait until it is signed in again.\n`);
4547
+ const bin = resolveBinary(b);
4548
+ if (!bin) {
4549
+ console.error(` ${b.label} is not installed here — pantheon doctor shows how to install it.`);
4550
+ return;
4551
+ }
4552
+ if (!process.stdin.isTTY) {
4553
+ console.error(` Open a terminal, ${signInSteps(b.id)}.`);
4554
+ return;
4555
+ }
4556
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
4557
+ let yes = false;
4558
+ try {
4559
+ yes = /^y(es)?$/i.test(((await questionOrNull(rl, `Sign in to ${b.label} now? Type y and press Enter. `)) ?? "").trim());
4560
+ }
4561
+ finally {
4562
+ rl.close();
4563
+ }
4564
+ if (!yes) {
4565
+ console.error(D(`\nNot now. To sign in later: open a terminal, ${signInSteps(b.id)}.`));
4566
+ return;
4567
+ }
4568
+ const { spawnSync } = await import("node:child_process");
4569
+ console.error(D(`\n$ ${cmd.binary} ${cmd.args.join(" ")}`));
4570
+ let r;
4571
+ try {
4572
+ const sp = agentSpawn(bin, cmd.args);
4573
+ r = spawnSync(sp.command, sp.args, { stdio: "inherit", ...sp.options });
4574
+ }
4575
+ catch (e) {
4576
+ r = { status: null, error: e };
4577
+ }
4578
+ if (r.status !== 0)
4579
+ console.error(`\nThat did not sign you in. ${b.id === "claude-code" ? "Instead: type claude, then /login." : `Instead: ${signInSteps(b.id)}.`}`);
4580
+ else
4581
+ console.error(`\n${B("Signed in.")} Pantheon checks again now; within two minutes teammates' requests run here again.`);
4582
+ requestReadinessRecheck();
4583
+ return;
4584
+ }
4585
+ if (hud?.action === "fix" && hud.fix_kind === "how") {
4586
+ const r = agentReadiness(cfg);
4587
+ if (r.ok) {
4588
+ console.error(`${B("Nothing to fix")} — ${r.says}`);
4589
+ requestReadinessRecheck();
4590
+ return;
4591
+ }
4592
+ console.error(`${B(PROBLEM_LEAD)}\n ${termSafeLine(r.says)}\n`);
4593
+ console.error(`${B("How to fix it")}\n ${termSafeLine(r.fix)}\n`);
4594
+ console.error(D("Then run pantheon doctor to check. Pantheon looks again within two minutes."));
4595
+ requestReadinessRecheck();
4596
+ return;
4597
+ }
4495
4598
  if (hud?.action === "fix") {
4496
4599
  const dir = hud.dir && existsSync(hud.dir) ? hud.dir : process.cwd();
4497
- const steps = hud.lines ?? [];
4498
- console.error(`${B("What stopped it")}\n ${hud.why ?? "(not recorded)"}\n`);
4600
+ const steps = (hud.lines ?? []).map(termSafeLine);
4601
+ console.error(`${B("What stopped it")}\n ${termSafeLine(hud.why ?? "(not recorded)")}\n`);
4499
4602
  console.error(`${B("Where")} ${dir}\n`);
4500
4603
  if (!steps.length) {
4501
4604
  console.error(D("Nothing to run from here."));
@@ -5045,6 +5148,7 @@ async function main() {
5045
5148
  notifyFromWorker(n);
5046
5149
  }
5047
5150
  catch { } },
5151
+ canAlert: workerCanAlert,
5048
5152
  }),
5049
5153
  log: (l) => console.error(l),
5050
5154
  });
@@ -5077,6 +5181,7 @@ async function main() {
5077
5181
  notifyFromWorker(n);
5078
5182
  }
5079
5183
  catch { } },
5184
+ canAlert: workerCanAlert,
5080
5185
  }),
5081
5186
  log: (l) => console.error(l),
5082
5187
  });
package/dist/doctor.js CHANGED
@@ -24,7 +24,7 @@ import { workerProc, menubarProc, notifierProc, workerFlagRunMinutes } from "./m
24
24
  import { isCatchAllDomain } from "./protocol.js";
25
25
  import { probeLinuxSandbox, sandboxDoctorRow } from "./linux-sandbox.js";
26
26
  import { removalKey, removalRefusal, removals, removalWords, teamsOf } from "./removed.js";
27
- import { agentById, chooseAgent, describeChoice, detectAvailable, folderReaderLine, unattendedRefusal, skippedSummary, SANDBOXED_FOR_UNATTENDED } from "./agents.js";
27
+ import { agentById, chooseAgent, describeChoice, detectAvailable, folderReaderLine, knownUserBinary, unattendedReadiness, unattendedRefusal, skippedSummary, SANDBOXED_FOR_UNATTENDED } from "./agents.js";
28
28
  import { loginShellLookup, npmSpawn, onPathNamed, which, whichWindows } from "./which.js";
29
29
  import { VERSION } from "./version.js";
30
30
  import { realSys, serviceInstalled, servicesUnavailable } from "./service.js";
@@ -342,10 +342,20 @@ export async function doctor(projectDir) {
342
342
  if (branch)
343
343
  add("pass", "git branch", branch);
344
344
  }
345
- const agents = ["claude", "codex", "cursor-agent", "copilot", "kiro-cli"].filter((a) => onPathNamed(a));
345
+ const agents = ["claude", "codex", "cursor-agent", "copilot", "kiro-cli"].filter((a) => onPathNamed(a) || !!knownUserBinary(a));
346
+ const workerSetUp = (() => { try {
347
+ return serviceInstalled("worker") || workerProc().running;
348
+ }
349
+ catch {
350
+ return false;
351
+ } })();
346
352
  agents.length
347
353
  ? add("pass", "agent cli", agents.join(", "), undefined, agents.join(", "))
348
- : add("warn", "agent cli", "found none of claude / codex / cursor-agent / copilot / kiro-cli on PATH", "fine if you only drive agents through a GUI (Conductor, Cursor, VS Code, the Kiro IDE), but `pantheon worker` needs a CLI to spawn", "none of claude / codex / cursor-agent / copilot / kiro-cli on PATH");
354
+ : add("warn", "agent cli", "found none of claude / codex / cursor-agent / copilot / kiro-cli on PATH", workerSetUp ? "unattended work is set up here, and it needs one — the steps are under worker agent" : "fine if you only drive agents through a GUI (Conductor, Cursor, VS Code, the Kiro IDE), but `pantheon worker` needs a CLI to spawn", "none of claude / codex / cursor-agent / copilot / kiro-cli on PATH");
355
+ if (!agents.length && workerSetUp) {
356
+ const r = unattendedReadiness({ available: [] });
357
+ add("fail", "worker agent", r.says, r.fix, "no agent CLI for runs while away");
358
+ }
349
359
  if (!inWokenRun())
350
360
  requestReadinessRecheck();
351
361
  if (agents.length) {
@@ -356,7 +366,7 @@ export async function doctor(projectDir) {
356
366
  }
357
367
  catch { }
358
368
  const choice = chooseAgent("auto", { prefer: prof.agent.primary_surface, unsandboxedOk });
359
- const line = describeChoice(choice);
369
+ const line = describeChoice(choice).replace(/\bnot signed in\b/g, "signed out");
360
370
  const bad = choice.signIn && !choice.signIn.ok && !choice.signIn.unknown;
361
371
  const fellBack = !!prof.agent.primary_surface && choice.backend.id !== prof.agent.primary_surface && agents.length > 0;
362
372
  const shareLine = `${choice.backend.label} — ${choice.signIn?.detail ?? "not checked"}${choice.skipped.length ? `; ${skippedSummary(choice)}` : ""}`;
@@ -365,7 +375,7 @@ export async function doctor(projectDir) {
365
375
  if (refused)
366
376
  add("warn", "worker agent", line, `teammates' requests wait for your next session here: ${refused}`, shareLine);
367
377
  else if (bad)
368
- add("warn", "worker agent", line, `nothing is signed in, so every woken run here fails until you sign in: ${choice.skipped.map((x) => x.why).join("; ") || "sign in to the agent CLI"}`, shareLine);
378
+ add("warn", "worker agent", line, `your agent is signed out, so every woken run here fails until you sign in again: ${choice.skipped.map((x) => x.why.replace(/\bnot signed in\b/g, "signed out")).join("; ") || "sign in to the agent CLI"}`, shareLine);
369
379
  else if (fellBack)
370
380
  add("warn", "worker agent", line, prof.agent.primary_surface === "kiro"
371
381
  ? `you chose Kiro at setup; Kiro answers in your live sessions, and runs while you're away use ${choice.backend.label}`
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import { chmodSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
2
+ import { chmodSync, lstatSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
3
3
  import { join, resolve } from "node:path";
4
4
  import { parseJsonText } from "./text-file.js";
5
5
  import { withFileLock } from "./file-lock.js";
@@ -14,7 +14,8 @@ export const PINS_FILE = "keys.json";
14
14
  export const NONCES_FILE = "nonces.json";
15
15
  export const REMOVED_FILE = "removed.json";
16
16
  export const RECHECK_FILE = "readiness-recheck.stamp";
17
- export const GUARDED_FILES = [POLICY_FILE, CONFIG_FILE, PROFILE_FILE, HUD_FILE, CONTINUED_FILE, CURSOR_FILE, PINS_FILE, NONCES_FILE, REMOVED_FILE, RECHECK_FILE];
17
+ export const READINESS_ALERT_FILE = "readiness-alert.json";
18
+ export const GUARDED_FILES = [POLICY_FILE, CONFIG_FILE, PROFILE_FILE, HUD_FILE, CONTINUED_FILE, CURSOR_FILE, PINS_FILE, NONCES_FILE, REMOVED_FILE, RECHECK_FILE, READINESS_ALERT_FILE];
18
19
  const sha = (b) => createHash("sha256").update(b).digest("hex");
19
20
  const read = (f) => { try {
20
21
  return statSync(f).isFile() ? readFileSync(f) : null;
@@ -498,9 +499,14 @@ export function restoreHome(s) {
498
499
  catch {
499
500
  writeFileSync(file, text, { mode: 0o600 });
500
501
  } };
501
- if (f.rel === RECHECK_FILE) {
502
+ if (f.rel === RECHECK_FILE || f.rel === READINESS_ALERT_FILE) {
503
+ try {
504
+ if (lstatSync(file).isSymbolicLink())
505
+ rmSync(file, { force: true });
506
+ }
507
+ catch { }
502
508
  if (f.bytes)
503
- writeFileSync(file, f.bytes, { mode: 0o600 });
509
+ writeWhole(file, f.bytes.toString("utf8"));
504
510
  else
505
511
  rmSync(file, { force: true });
506
512
  out.push({ rel: f.rel, what: f.bytes ? "reverted" : "removed", keys: [], quiet: true });
@@ -19,6 +19,7 @@ export const PANTHEON_HOME_ENTRIES = [
19
19
  { name: "removed.json", what: "the teams this machine was removed from", identity: true },
20
20
  { name: "readiness-recheck.stamp", what: "the mark that has the worker look again for an agent it can run" },
21
21
  { name: "worker-state.json", what: "the worker's last state" },
22
+ { name: "readiness-alert.json", what: "what you were told about this machine taking requests (signed out, no agent)" },
22
23
  { name: "worker-run.json", what: "the worker's record of a run in flight" },
23
24
  { name: "held-deliveries.json", what: "deliveries woken runs held until their branch was on origin (pantheon leave and uninstall name any not yet sent)" },
24
25
  { name: /^held-deliveries\.json\.corrupt-\d+$/, sample: "held-deliveries.json.corrupt-1760000000000", what: "a record of held deliveries that could not be read, set aside" },
@@ -46,7 +46,7 @@ export function toastButtons(notice, key) {
46
46
  return out;
47
47
  }
48
48
  export function toastTag(notice) {
49
- const id = notice.details?.decision ?? notice.details?.act ?? "";
49
+ const id = notice.tag ?? notice.details?.decision ?? notice.details?.act ?? "";
50
50
  return /^[A-Za-z0-9_]{1,60}$/.test(id) ? id : "";
51
51
  }
52
52
  export function toastFields(notice, key) {
package/dist/notice.js CHANGED
@@ -11,6 +11,9 @@ export const APP_TOOLS = [
11
11
  { id: "codex-app", label: "Codex app · question copied", kind: "app", bundle: "com.openai.codex" },
12
12
  { id: "vscode-app", label: "VS Code · question copied", kind: "app", bundle: "com.microsoft.VSCode" },
13
13
  ];
14
+ export function stripControls(s) {
15
+ return String(s).replace(/[\u0000-\u0009\u000b-\u001f\u007f-\u009f]/g, "");
16
+ }
14
17
  export const BUDGET = { who: 60, heading: 40, context: 70, body: 190 };
15
18
  const oneLine = (s) => s.replace(/\s+/g, " ").trim();
16
19
  export function fit(text, max) {
package/dist/notifier.js CHANGED
@@ -19,6 +19,9 @@ export const DEFAULT_REMINDER_MS = 4 * 60 * 60 * 1_000;
19
19
  export const PASSED_OVER_EVERY_MS = 3_600_000;
20
20
  export const MAX_REMINDERS = 4;
21
21
  const DAY_MS = 24 * 60 * 60 * 1_000;
22
+ export function reminderGap(n, reminderMs) {
23
+ return Math.min(reminderMs * 2 ** n, Math.max(reminderMs, DAY_MS));
24
+ }
22
25
  export function wakeAskWhat(body) {
23
26
  return /answer while you are away:\s*(.+)$/m.exec(body)?.[1]?.trim() ?? body.split("\n")[0] ?? "";
24
27
  }
@@ -33,8 +36,7 @@ export function dueHumanObligations(obligations, member, state, now, reminderMs)
33
36
  const n = state.reminded?.[o.id] ?? 0;
34
37
  if (n >= MAX_REMINDERS)
35
38
  return false;
36
- const gap = Math.min(reminderMs * 2 ** n, Math.max(reminderMs, DAY_MS));
37
- return now - last >= gap;
39
+ return now - last >= reminderGap(n, reminderMs);
38
40
  });
39
41
  }
40
42
  export function pruneNotificationState(state, obligations, member, now = Date.now()) {
package/dist/profile.js CHANGED
@@ -76,6 +76,15 @@ export function commandsChosen(file = profilePath()) {
76
76
  return undefined;
77
77
  }
78
78
  }
79
+ export function decisionAlertsOn(file = profilePath()) {
80
+ try {
81
+ const raw = JSON.parse(readFileSync(file, "utf8").replace(/^\uFEFF/, ""));
82
+ return raw?.notifications?.decisions !== false;
83
+ }
84
+ catch {
85
+ return true;
86
+ }
87
+ }
79
88
  export function loadProfile(cfg, file = profilePath()) {
80
89
  if (!existsSync(file))
81
90
  return defaultProfile(cfg);