@join-pantheon/cli 0.33.10 → 0.33.11-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/board.js CHANGED
@@ -11,6 +11,7 @@ import { LIMITS } from "./protocol.js";
11
11
  import { childNodeFlags } from "./managed.js";
12
12
  import { which } from "./which.js";
13
13
  import { VERSION } from "./version.js";
14
+ import { withoutAgentMarkers } from "./setup-changes.js";
14
15
  import { shellArg } from "./team-name.js";
15
16
  const HERE = dirname(fileURLToPath(import.meta.url));
16
17
  export const CLI_ENTRY = resolve(HERE, "cli.js");
@@ -18,7 +19,7 @@ export const BOARD_IDLE_MS = 30 * 60_000;
18
19
  export const BOARD_REFRESH_MS = 15_000;
19
20
  export const LANES = [
20
21
  { id: "now", title: "Needs you now", empty: "Nothing needs you right now." },
21
- { id: "handling", title: "Handling", empty: "Your agents are not working on anything for the team." },
22
+ { id: "handling", title: "Your agents are handling", empty: "Your agents are not working on anything for the team." },
22
23
  { id: "waiting", title: "Waiting", empty: "You are not waiting on anyone." },
23
24
  { id: "older", title: "Older", empty: "Nothing has been stuck for over a week." },
24
25
  ];
@@ -113,11 +114,14 @@ export function loopbackPeerUid(clientPort, boardPort, read = (p) => readFileSyn
113
114
  }
114
115
  return readable ? -1 : null;
115
116
  }
117
+ export function boardChildEnv(env) {
118
+ return { ...withoutAgentMarkers(env), NO_COLOR: "1" };
119
+ }
116
120
  export function runCli(args, timeoutMs, env = process.env) {
117
121
  return new Promise((done) => {
118
122
  let out = "", err = "";
119
123
  const child = spawn(process.execPath, [...childNodeFlags(), CLI_ENTRY, ...args], {
120
- stdio: ["ignore", "pipe", "pipe"], windowsHide: true, env: { ...env, NO_COLOR: "1" },
124
+ stdio: ["ignore", "pipe", "pipe"], windowsHide: true, env: boardChildEnv(env),
121
125
  });
122
126
  const t = setTimeout(() => { try {
123
127
  child.kill();
@@ -198,6 +202,9 @@ export function explainOutcome(r, nonce) {
198
202
  return { ok: true, message: "Done — it is no longer waiting on you." };
199
203
  if (r.code === 0 && /no longer waiting on you/.test(err))
200
204
  return { ok: true, message: "It was already settled — it is no longer waiting on you." };
205
+ const stopped = /^(Stopping your agent's run — .*|it's yours now: .*|your agent won't pick it up again.*|approved — .*|kept as it is — .*)$/m.exec(out);
206
+ if (r.code === 0 && stopped)
207
+ return { ok: true, message: stopped[1].replace(/^./, (c) => c.toUpperCase()) };
201
208
  if (r.code === 0)
202
209
  return { ok: true, message: "Done." };
203
210
  const last = err.split("\n").map((l) => l.trim()).filter((l) => l && !/^pantheon \d|update available|upgrade/i.test(l)).at(-1);
@@ -227,6 +234,16 @@ export function hudActionFor(op, item) {
227
234
  if (item.kind !== "decision" || !item.wake || !item.ref)
228
235
  return { error: "only a teammate waiting on your approval can be approved or declined here" };
229
236
  return { action: "wake", allow: op.op === "wake-allow", member: item.wake, decision: item.id, act: item.ref, ...space };
237
+ case "change-approve":
238
+ case "change-keep":
239
+ if (item.kind !== "change")
240
+ return { error: "only a change to your setup can be approved or kept here" };
241
+ return { action: "change", change: item.id, answer: op.op === "change-approve" ? "approve" : "keep", by: "board" };
242
+ case "takeover":
243
+ case "stop":
244
+ if (!item.run)
245
+ return { error: "only work your agent is handling can be taken over or stopped" };
246
+ return { action: "run", ref: item.run.ref, run: op.op, ...space };
230
247
  case "open":
231
248
  return { action: "open", prompt: item.prompt, ...space, ...goal, ...(item.kind === "decision" ? { decision: item.id } : {}) };
232
249
  }
@@ -254,6 +271,10 @@ export function parseBoardAction(raw) {
254
271
  case "open": return only([]) ? { op: "open", id, ...sp } : null;
255
272
  case "wake-allow":
256
273
  case "wake-deny": return only([]) ? { op: v.op, id, ...sp } : null;
274
+ case "takeover":
275
+ case "stop": return only([]) ? { op: v.op, id, ...sp } : null;
276
+ case "change-approve":
277
+ case "change-keep": return only([]) && /^c_[0-9a-f]{8}$/.test(id) ? { op: v.op, id, ...sp } : null;
257
278
  case "choose":
258
279
  return only(["index"]) && Number.isInteger(v.index) && v.index >= 0 && v.index < 10
259
280
  ? { op: "choose", id, ...sp, index: v.index } : null;
@@ -698,7 +719,7 @@ export function terminalCommand(home, actionId, os = platform(), env = process.e
698
719
  if (!/^[0-9a-f]{16,64}$/.test(actionId))
699
720
  return { error: "not an action id" };
700
721
  const argv = [node, ...childNodeFlags(), entry, "explain", "--queued", "--only-action", "--action-id", actionId];
701
- const opts = { detached: true, stdio: "ignore", env };
722
+ const opts = { detached: true, stdio: "ignore", env: withoutAgentMarkers(env) };
702
723
  if (os === "darwin") {
703
724
  const file = join(home, "bin", "pantheon-board-explain.command");
704
725
  const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
@@ -1043,7 +1064,7 @@ ${LANES.map((l) => ` <section class="lane lane-${l.id}" aria-labelledby="h-${l.
1043
1064
  <div id="d-body" class="body"></div>
1044
1065
  <div id="d-options" class="choices" role="group" aria-label="Answer with one of its options" hidden></div>
1045
1066
  <div id="d-choices" class="choices" role="group" aria-label="One-click answers" hidden></div>
1046
- <div class="reply">
1067
+ <div class="reply" id="d-reply">
1047
1068
  <label for="d-kind">Reply as</label>
1048
1069
  <select id="d-kind"></select>
1049
1070
  <label for="d-text" class="sr">Your words</label>
@@ -1272,15 +1293,23 @@ function row(item, card) {
1272
1293
  const meta = el("p", "meta");
1273
1294
  meta.append(el("span", "", [item.who, ago(item.when)].filter(Boolean).join(" · ")));
1274
1295
  if (multi() && item.space) meta.append(el("span", "chip", item.space));
1275
- if (item.kind === "decision") meta.append(el("span", "chip", "your decision"));
1296
+ if (item.kind === "change") meta.append(el("span", "chip", "your setup"));
1297
+ else if (item.kind === "decision") meta.append(el("span", "chip", "your decision"));
1276
1298
  else if (item.kind === "owed") meta.append(el("span", "chip", item.promise ? "your agent promised" : "your side owes"));
1277
1299
  else meta.append(el("span", "chip", item.decider ? item.decider + " decides" : "waiting on " + item.who));
1278
1300
  li.append(meta);
1279
1301
  if (item.context) li.append(el("p", "ctx", "For: " + item.context));
1280
1302
  // When a teammate's agent will pick it up (#69): so a wait does not read as broken.
1281
1303
  if (item.pickup) li.append(el("p", "ctx", item.pickup));
1304
+ // One the worker will not take: why, and that it is the person's.
1305
+ if (item.declined) li.append(el("p", "ctx", "Your worker can't take this (" + item.declined + ") — it's yours"));
1282
1306
  const acts = el("div", "actions");
1283
- if (card && item.wake) {
1307
+ if (card && item.kind === "change") {
1308
+ // Review shows what each change would do, in full, before Approve is offered.
1309
+ acts.append(tag(button("Review", () => openDetail(item), "primary"), item, "review"));
1310
+ li.append(acts);
1311
+ return li;
1312
+ } else if (card && item.wake) {
1284
1313
  // A teammate waiting on this person's approval: Approve / Just this once /
1285
1314
  // Decline, and no "Mark done" — that would settle the question unanswered.
1286
1315
  wakeButtons(item).forEach((b) => acts.append(b));
@@ -1291,6 +1320,11 @@ function row(item, card) {
1291
1320
  acts.append(tag(button("Reply…", () => openDetail(item, true)), item, "reply"));
1292
1321
  acts.append(tag(button("Explain in " + surface(), (ev) => act({ op: "open", id: item.id, space: item.space }, ev.currentTarget)), item, "explain"));
1293
1322
  } else {
1323
+ // Under "Your agents are handling": the person can take the request back, or stop the work.
1324
+ if (item.run) {
1325
+ acts.append(tag(button("Take over", (ev) => act({ op: "takeover", id: item.id, space: item.space }, ev.currentTarget)), item, "takeover"));
1326
+ acts.append(tag(button("Stop", (ev) => act({ op: "stop", id: item.id, space: item.space }, ev.currentTarget)), item, "stop"));
1327
+ }
1294
1328
  acts.append(tag(button("Details", () => openDetail(item)), item, "details"));
1295
1329
  }
1296
1330
  acts.append(tag(button("Copy the question", () => copy(item.prompt)), item, "copy"));
@@ -1338,6 +1372,7 @@ async function act(body, btn, okText) {
1338
1372
  }
1339
1373
 
1340
1374
  function ownerLine(item) {
1375
+ if (item.kind === "change") return "Your agent asked to change your setup. Nothing changes until you approve it.";
1341
1376
  if (item.kind === "decision") return "Yours to decide.";
1342
1377
  if (item.decider) return item.decider + "'s to decide. You can add a note or ask back.";
1343
1378
  if (item.kind === "owed") return "Your agent owes this. You can add a note or ask back.";
@@ -1375,6 +1410,18 @@ async function openDetail(item, focusReply) {
1375
1410
  setStatus("");
1376
1411
  $("d-retract").hidden = true;
1377
1412
  const actions = $("d-actions"); actions.replaceChildren();
1413
+ // A change to this person's setup: everything it would do is shown above, then Approve or Keep as is.
1414
+ $("d-reply").hidden = item.kind === "change";
1415
+ if (item.kind === "change") {
1416
+ blocks($("d-body"), (item.detail || "").split("\\n\\n").map((t) => ({ kind: "para", text: t })));
1417
+ ch.append(button("Approve", (ev) => act({ op: "change-approve", id: item.id }, ev.currentTarget).then((r) => { if (r && r.ok) d.close(); })));
1418
+ ch.append(button("Keep as is", (ev) => act({ op: "change-keep", id: item.id }, ev.currentTarget).then((r) => { if (r && r.ok) d.close(); })));
1419
+ ch.hidden = false;
1420
+ $("d-thread").hidden = true; $("d-thread").replaceChildren();
1421
+ if (!d.open) d.showModal();
1422
+ $("d-close").focus();
1423
+ return;
1424
+ }
1378
1425
  if (item.kind === "decision" && !item.wake) actions.append(button("Mark done", (ev) => act({ op: "done", id: item.id, space: item.space }, ev.currentTarget).then((r) => { if (r && r.ok) d.close(); })));
1379
1426
  actions.append(button("Explain in " + surface(), (ev) => act({ op: "open", id: item.id, space: item.space }, ev.currentTarget)));
1380
1427
  if (item.goal && item.space) actions.append(button("Show the thread", () => thread(item)));
@@ -6,6 +6,8 @@ import { homedir, platform, tmpdir } from "node:os";
6
6
  import { basename, dirname, isAbsolute, join, posix, relative, resolve, sep, win32 } from "node:path";
7
7
  import { expectedLauncher, windowsManagedRoots } from "./managed.js";
8
8
  import { agentSpawn } from "./which.js";
9
+ import { PANTHEON_HOME_ENTRIES as HOME_INVENTORY } from "./home-safety.js";
10
+ import { RUN_GUARD_TMP } from "./home-guard.js";
9
11
  export const NO_CLAUDE_FEATURES = { version: null, permissionPrompts: false, settings: false, settingSources: false, disallowedTools: false };
10
12
  export function parseClaudeHelp(help, version = null) {
11
13
  return {
@@ -238,7 +240,12 @@ function userExcludedCommands(file) {
238
240
  }
239
241
  }
240
242
  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", "readiness-alert.json", "readiness-alert.json.lock", "bin", "runtime", "ops", "run-homes", "logs", "mcp", "data"];
243
+ const PANTHEON_HOME_ENTRIES = [...new Set([
244
+ "config.json", "config.json.bak", "config.json.lock", "worker-policy.json", "profile.json", "setup-changes.log", "setup-pending.json", "run-control.json", "worker-declined.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",
245
+ RUN_GUARD_TMP,
246
+ ...HOME_INVENTORY.map((e) => e.name).filter((n) => typeof n === "string"),
247
+ ])];
248
+ const HOME_FILE_NAMES = new Set([RUN_GUARD_TMP, ...HOME_INVENTORY.filter((e) => !e.dir && typeof e.name === "string").map((e) => e.name)]);
242
249
  function aroundWorktree(top, keeps, named) {
243
250
  const keep = (typeof keeps === "string" ? [keeps] : [...keeps]).map((k) => resolve(k));
244
251
  const out = [];
@@ -255,7 +262,7 @@ function aroundWorktree(top, keeps, named) {
255
262
  return statSync(join(level, n)).isDirectory();
256
263
  }
257
264
  catch {
258
- return !n.includes(".");
265
+ return HOME_FILE_NAMES.has(n) ? false : !n.includes(".");
259
266
  } };
260
267
  for (const n of new Set([...names, ...(isTop ? named : [])]))
261
268
  if (!nexts.has(n))