@join-pantheon/cli 0.35.0 → 0.35.1-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/agent-outage.js +165 -35
  2. package/dist/agent-token.js +5 -3
  3. package/dist/agents.js +6 -4
  4. package/dist/approvals-list.js +87 -0
  5. package/dist/board.js +491 -88
  6. package/dist/brief.js +17 -0
  7. package/dist/cli.js +687 -95
  8. package/dist/client.js +159 -19
  9. package/dist/config.js +3 -2
  10. package/dist/continued.js +56 -1
  11. package/dist/decision-ui.js +5 -3
  12. package/dist/doctor.js +84 -16
  13. package/dist/file-lock.js +40 -5
  14. package/dist/flow-stats.js +18 -1
  15. package/dist/home-guard.js +336 -54
  16. package/dist/home-safety.js +2 -0
  17. package/dist/hud-queue.js +91 -0
  18. package/dist/install.js +15 -1
  19. package/dist/mcp-instructions.js +67 -28
  20. package/dist/mcp.js +129 -24
  21. package/dist/notice-linux.js +15 -4
  22. package/dist/notice-windows.js +2 -2
  23. package/dist/notifier.js +2 -1
  24. package/dist/notify.js +28 -9
  25. package/dist/open-in.js +4 -3
  26. package/dist/pickup.js +17 -0
  27. package/dist/plain.js +139 -3
  28. package/dist/profile.js +12 -8
  29. package/dist/protocol.js +1 -1
  30. package/dist/question-goal.js +74 -0
  31. package/dist/readiness-alert.js +24 -3
  32. package/dist/refusal.js +2 -2
  33. package/dist/relay.js +143 -28
  34. package/dist/removed.js +4 -4
  35. package/dist/run-control.js +4 -3
  36. package/dist/run-failure.js +67 -10
  37. package/dist/setup-changes.js +7 -6
  38. package/dist/signed-out.js +144 -21
  39. package/dist/spend.js +5 -4
  40. package/dist/tray.js +24 -6
  41. package/dist/update-check.js +2 -1
  42. package/dist/uri-handler.js +10 -2
  43. package/dist/which.js +2 -0
  44. package/dist/worker-policy.js +212 -10
  45. package/dist/worker.js +942 -133
  46. package/dist/worklist.js +31 -1
  47. package/helper/macos/main.swift +42 -3
  48. package/helper/macos/menubar.swift +482 -87
  49. package/helper/macos/prebuilt/manifest.json +5 -5
  50. package/helper/macos/prebuilt/pantheon-hud +0 -0
  51. package/helper/macos/prebuilt/pantheon-tray +0 -0
  52. package/package.json +1 -1
@@ -1,34 +1,124 @@
1
- import { readFileSync, renameSync, statSync, writeFileSync, mkdirSync } from "node:fs";
1
+ import { createHash, randomBytes } from "node:crypto";
2
+ import { renameSync, statSync, writeFileSync, mkdirSync } from "node:fs";
2
3
  import { homedir } from "node:os";
3
4
  import { join } from "node:path";
4
5
  import { CONFIG_DIR } from "./config.js";
5
- import { claudeTokenStamp } from "./agent-token.js";
6
+ import { claudeTokenForRun, claudeTokenStamp } from "./agent-token.js";
6
7
  import { trustWrite } from "./home-guard.js";
7
- import { ownWords } from "./agent-outage.js";
8
- export const SIGNED_OUT_RE = /please run \/login|login expired|not logged in\b|invalid api key|oauth token (?:has )?expired|oauth token refresh failed|failed to authenticate|api error: 401\b|oauth access token is invalid|run `?(?:codex|cursor-agent) login`?/i;
8
+ import { isSet, refusalOf, SIGNIN_REFUSED } from "./agent-outage.js";
9
+ import { RECHECK_FILE } from "./home-guard.js";
10
+ import { readStateText } from "./file-lock.js";
9
11
  export const SIGNED_OUT_RETRY_MS = 3_600_000;
10
12
  export const SIGNED_OUT_MAX_RETRY_MS = 8 * 3_600_000;
11
- const TAIL_LINES = 5;
12
13
  export const SIGNED_OUT_AGENTS = ["claude-code", "codex", "cursor", "copilot"];
13
14
  const FILE = "signed-out.json";
15
+ export const SIGN_IN_VARS = {
16
+ "claude-code": ["ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"],
17
+ codex: ["CODEX_API_KEY"],
18
+ cursor: ["CURSOR_API_KEY", "CURSOR_AUTH_TOKEN"],
19
+ copilot: ["COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"],
20
+ };
21
+ export const HINT_DEBOUNCE_MS = 3 * 60_000;
22
+ export const HINT_GAP_MAX_MS = 15 * 60_000;
23
+ export const SETTINGS_RETRY_MS = 15 * 60_000;
24
+ export const SETTINGS_MAX_RETRY_MS = 60 * 60_000;
14
25
  const mtime = (p) => { try {
15
26
  return String(statSync(p).mtimeMs);
16
27
  }
17
28
  catch {
18
29
  return "-";
19
30
  } };
20
- export function signInSignature(agent, o = {}) {
31
+ const set = (v) => (v && v.trim() ? v : undefined);
32
+ export function signInFiles(agent, o = {}) {
21
33
  const h = o.userHome ?? homedir();
22
- if (agent === "claude-code")
23
- return [mtime(join(h, ".claude", ".credentials.json")), mtime(join(h, ".claude.json")), claudeTokenStamp(o.pantheonHome ?? CONFIG_DIR)].join("|");
34
+ const env = o.env ?? process.env;
35
+ const plat = o.platform ?? process.platform;
36
+ const appData = set(env.APPDATA) ?? join(h, "AppData", "Roaming");
37
+ const xdg = set(env.XDG_CONFIG_HOME);
38
+ if (agent === "claude-code") {
39
+ const dir = set(env.CLAUDE_CONFIG_DIR);
40
+ return {
41
+ cred: [mtime(join(dir ?? join(h, ".claude"), ".credentials.json")), claudeTokenStamp(o.pantheonHome ?? CONFIG_DIR)].join("|"),
42
+ hint: mtime(dir ? join(dir, ".claude.json") : join(h, ".claude.json")),
43
+ };
44
+ }
24
45
  if (agent === "codex")
25
- return mtime(join(h, ".codex", "auth.json"));
26
- return "";
46
+ return { cred: mtime(join(set(env.CODEX_HOME) ?? join(h, ".codex"), "auth.json")), hint: "" };
47
+ if (agent === "cursor") {
48
+ const auth = plat === "win32" ? join(appData, "Cursor", "auth.json")
49
+ : plat === "darwin" ? join(h, ".cursor", "auth.json")
50
+ : join(xdg ?? join(h, ".config"), "cursor", "auth.json");
51
+ const cfg = set(env.CURSOR_CONFIG_DIR) ?? (xdg ? join(xdg, "cursor") : join(h, ".cursor"));
52
+ return { cred: mtime(auth), hint: mtime(join(cfg, "cli-config.json")) };
53
+ }
54
+ if (agent === "copilot") {
55
+ const gh = set(env.GH_CONFIG_DIR) ?? (plat === "win32" ? join(appData, "GitHub CLI") : join(xdg ?? join(h, ".config"), "gh"));
56
+ return { cred: mtime(join(gh, "hosts.yml")), hint: mtime(join(set(env.COPILOT_HOME) ?? join(h, ".copilot"), "config.json")) };
57
+ }
58
+ return { cred: "", hint: "" };
59
+ }
60
+ export function signInVarsSig(agent, env, pantheonHome, only) {
61
+ const all = SIGN_IN_VARS[agent] ?? [];
62
+ const at = only ? all.indexOf(only) : -1;
63
+ const set = (only ? (at >= 0 ? all.slice(0, at + 1) : [only]) : all).filter((k) => isSet(env[k]));
64
+ if (!set.length)
65
+ return "";
66
+ const h = createHash("sha256").update(salt(pantheonHome));
67
+ for (const k of set)
68
+ h.update(`\0${k}=${env[k]}`);
69
+ return h.digest("hex").slice(0, 16);
70
+ }
71
+ function salt(home) {
72
+ const f = join(home, "signed-out.salt");
73
+ try {
74
+ const v = readStateText(f).trim();
75
+ if (/^[0-9a-f]{64}$/.test(v))
76
+ return v;
77
+ }
78
+ catch { }
79
+ const v = randomBytes(32).toString("hex");
80
+ try {
81
+ mkdirSync(home, { recursive: true, mode: 0o700 });
82
+ writeFileSync(f, v + "\n", { mode: 0o600 });
83
+ trustWrite(f);
84
+ }
85
+ catch { }
86
+ return v;
87
+ }
88
+ function basisSig(agent, basis, o, home) {
89
+ if (basis === "token")
90
+ return claudeTokenStamp(home);
91
+ if (basis === "var" || basis === "settings")
92
+ return "";
93
+ return signInFiles(agent, o).cred;
94
+ }
95
+ function basisHint(agent, basis, o) {
96
+ if (basis === "var" || basis === "token")
97
+ return undefined;
98
+ if (basis === "settings") {
99
+ const dir = set((o.env ?? process.env).CLAUDE_CONFIG_DIR) ?? join(o.userHome ?? homedir(), ".claude");
100
+ return mtime(join(dir, "settings.json"));
101
+ }
102
+ return signInFiles(agent, o).hint || undefined;
103
+ }
104
+ export function claudeSettingsAuth(o = {}) {
105
+ const dir = set((o.env ?? process.env).CLAUDE_CONFIG_DIR) ?? join(o.userHome ?? homedir(), ".claude");
106
+ try {
107
+ const j = JSON.parse(readStateText(join(dir, "settings.json")));
108
+ const env = j.env && typeof j.env === "object" ? j.env : {};
109
+ return { env: SIGN_IN_VARS["claude-code"].filter((k) => typeof env[k] === "string" && isSet(env[k])), apiKeyHelper: typeof j.apiKeyHelper === "string" && j.apiKeyHelper.trim() !== "" };
110
+ }
111
+ catch {
112
+ return { env: [], apiKeyHelper: false };
113
+ }
114
+ }
115
+ export function signInSignature(agent, o = {}) {
116
+ return signInFiles(agent, o).cred;
27
117
  }
28
118
  const file = (home) => join(home, FILE);
29
119
  function read(home) {
30
120
  try {
31
- const j = JSON.parse(readFileSync(file(home), "utf8"));
121
+ const j = JSON.parse(readStateText(file(home)));
32
122
  return j && typeof j === "object" ? j : {};
33
123
  }
34
124
  catch {
@@ -45,18 +135,28 @@ function write(home, m) {
45
135
  }
46
136
  catch { }
47
137
  }
48
- export const retryAfter = (m) => Math.min(SIGNED_OUT_RETRY_MS * 2 ** Math.max(0, m.tries ?? 0), SIGNED_OUT_MAX_RETRY_MS);
138
+ export const retryAfter = (m) => m.basis === "settings" ? Math.min(SETTINGS_RETRY_MS * 2 ** Math.max(0, m.tries ?? 0), SETTINGS_MAX_RETRY_MS) : Math.min(SIGNED_OUT_RETRY_MS * 2 ** Math.max(0, m.tries ?? 0), SIGNED_OUT_MAX_RETRY_MS);
49
139
  export function markSignedOut(agent, output, o = {}) {
50
- const tail = output.split("\n").map((l) => l.trim()).filter(Boolean).slice(-TAIL_LINES);
51
- const line = tail.find((l) => ownWords(l, SIGNED_OUT_RE));
52
- if (!line)
140
+ const refused = refusalOf(agent, output, SIGNIN_REFUSED, o.env, agent === "claude-code" && o.env ? claudeSettingsAuth(o) : undefined);
141
+ if (!refused)
53
142
  return false;
143
+ const line = refused.line;
54
144
  const home = o.pantheonHome ?? CONFIG_DIR;
55
145
  const m = read(home);
56
- const sig = signInSignature(agent, o);
146
+ const tokenUsed = agent === "claude-code" && (o.env ? claudeTokenForRun(home, o.env) !== null : claudeTokenStamp(home) !== "");
147
+ const varUsed = refused.env && !refused.settings ? refused.env : undefined;
148
+ const basis = varUsed ? "var" : refused.settings ? "settings" : tokenUsed ? "token" : undefined;
149
+ const via = varUsed ?? (refused.settings ? refused.env : undefined);
150
+ const sig = basisSig(agent, basis, o, home);
151
+ const hint = basisHint(agent, basis, o);
152
+ const envSig = o.env && basis !== "settings" ? signInVarsSig(agent, o.env, home, basis === "var" ? varUsed : undefined) : undefined;
57
153
  const prev = m[agent];
58
- const tries = prev && prev.sig === sig ? (prev.tries ?? 0) + 1 : 0;
59
- m[agent] = { at: o.now ?? Date.now(), sig, says: line.slice(0, 160), ...(tries ? { tries } : {}) };
154
+ const same = !!prev && prev.basis === basis && prev.via === via && prev.sig === sig && (envSig === undefined || prev.envSig === undefined || prev.envSig === envSig);
155
+ const hintLed = same && prev.at === 0 && prev.lifted === "hint";
156
+ const tries = same ? (prev.tries ?? 0) + (prev.at === 0 && prev.lifted !== "hint" && prev.lifted !== "now" ? 1 : 0) : 0;
157
+ const hintAt = same ? prev.hintAt : undefined;
158
+ const hintGap = !same ? undefined : hintLed ? Math.min((prev.hintGap ?? HINT_DEBOUNCE_MS) * 2, HINT_GAP_MAX_MS) : prev.hintGap;
159
+ m[agent] = { at: o.now ?? Date.now(), sig, says: line.slice(0, 160), ...(tries ? { tries } : {}), ...(hint ? { hint } : {}), ...(envSig !== undefined ? { envSig } : {}), ...(hintAt ? { hintAt } : {}), ...(hintGap ? { hintGap } : {}), ...(via ? { via } : {}), ...(basis ? { basis } : {}), ...(refused.helper ? { helper: true } : {}) };
60
160
  write(home, m);
61
161
  return true;
62
162
  }
@@ -67,17 +167,40 @@ export function signedOutNow(agent, o = {}) {
67
167
  if (!mark || typeof mark.at !== "number" || mark.at === 0)
68
168
  return null;
69
169
  const now = o.now ?? Date.now();
70
- const changed = signInSignature(agent, o) !== mark.sig;
170
+ const varsChanged = !!o.env && mark.basis !== "settings" && mark.envSig !== undefined && signInVarsSig(agent, o.env, home, mark.basis === "var" ? mark.via : undefined) !== mark.envSig;
171
+ const signedIn = basisSig(agent, mark.basis, o, home) !== mark.sig || varsChanged;
172
+ const hint = basisHint(agent, mark.basis, o);
173
+ const gap = Math.min(mark.hintGap ?? HINT_DEBOUNCE_MS, HINT_GAP_MAX_MS);
174
+ const hinted = hint !== undefined && mark.hint !== undefined && hint !== mark.hint && (mark.hintAt === undefined || now - mark.hintAt >= gap || now < mark.hintAt);
71
175
  const due = now - mark.at >= retryAfter(mark) || now < mark.at;
72
- if (!changed && !due)
176
+ const asked = (() => { try {
177
+ const t = statSync(join(home, RECHECK_FILE)).mtimeMs;
178
+ return t > mark.at && t <= now + 1_000;
179
+ }
180
+ catch {
181
+ return false;
182
+ } })();
183
+ if (!signedIn && !hinted && !due && !asked)
73
184
  return mark;
74
185
  if (o.lift) {
75
186
  const { tries: _t, ...rest } = mark;
76
- m[agent] = changed ? { ...rest, at: 0 } : { ...mark, at: 0 };
187
+ const { hintGap: _g, ...fresh } = rest;
188
+ m[agent] = signedIn ? { ...fresh, at: 0, lifted: "signin" } : due ? { ...mark, at: 0, lifted: "due" } : asked ? { ...mark, at: 0, lifted: "now" } : { ...mark, at: 0, lifted: "hint", hintAt: now };
77
189
  write(home, m);
78
190
  }
79
191
  return null;
80
192
  }
193
+ export function signedOutVia(agent, o = {}) {
194
+ const v = read(o.pantheonHome ?? CONFIG_DIR)[agent]?.via;
195
+ return typeof v === "string" && /^[A-Z][A-Z0-9_]{1,40}$/.test(v) ? v : null;
196
+ }
197
+ export function signedOutRefusal(agent, o = {}) {
198
+ const m = read(o.pantheonHome ?? CONFIG_DIR)[agent];
199
+ if (!m || typeof m.says !== "string")
200
+ return null;
201
+ const env = signedOutVia(agent, o);
202
+ return { line: m.says, ...(env ? { env } : {}), ...(m.basis === "settings" ? { settings: true } : {}), ...(m.helper ? { helper: true } : {}), ...(m.basis === "token" ? { savedToken: true } : {}) };
203
+ }
81
204
  export function signedOutChecking(agent, o = {}) {
82
205
  const mark = read(o.pantheonHome ?? CONFIG_DIR)[agent];
83
206
  return mark && mark.at === 0 ? mark : null;
package/dist/spend.js CHANGED
@@ -1,4 +1,5 @@
1
- import { readFileSync, renameSync, rmSync, writeFileSync, mkdirSync } from "node:fs";
1
+ import { renameSync, rmSync, writeFileSync, mkdirSync } from "node:fs";
2
+ import { readStateText } from "./file-lock.js";
2
3
  import { randomBytes } from "node:crypto";
3
4
  import { dirname, join } from "node:path";
4
5
  import { CONFIG_DIR } from "./config.js";
@@ -8,7 +9,7 @@ function bookPath(home) {
8
9
  function read(home) {
9
10
  let text;
10
11
  try {
11
- text = readFileSync(bookPath(home), "utf8");
12
+ text = readStateText(bookPath(home));
12
13
  }
13
14
  catch (e) {
14
15
  if (e.code === "ENOENT")
@@ -65,7 +66,7 @@ export function finishRun(id, end, home) {
65
66
  b.runs[i] = { ...was, ...end, ...(typeof was.at === "number" && was.at <= end.at ? { started_at: was.started_at ?? was.at } : {}) };
66
67
  write(b, home);
67
68
  }
68
- export function closeStartedRun(id, summary, fallback, home) {
69
+ export function closeStartedRun(id, summary, fallback, home, ok = false) {
69
70
  const b = read(home);
70
71
  if (b.broken)
71
72
  return;
@@ -77,7 +78,7 @@ export function closeStartedRun(id, summary, fallback, home) {
77
78
  if (!b.runs[i].started)
78
79
  return;
79
80
  const { started: _s, ...was } = b.runs[i];
80
- b.runs[i] = { ...was, ok: false, summary };
81
+ b.runs[i] = { ...was, ok, summary };
81
82
  write(b, home);
82
83
  }
83
84
  export function runsToday(own, o = {}) {
package/dist/tray.js CHANGED
@@ -1,4 +1,5 @@
1
- import { effectiveMode, loadPolicy } from "./worker-policy.js";
1
+ import { effectiveMode, loadPolicy, safetyNotesLine } from "./worker-policy.js";
2
+ import { loadPersistedGuard } from "./home-guard.js";
2
3
  import { askedByName, changeLabel, consequence, loadPending } from "./setup-changes.js";
3
4
  import { buildUri, uriKey } from "./uri-handler.js";
4
5
  import { stopFor } from "./run-control.js";
@@ -16,7 +17,7 @@ import { VERSION } from "./version.js";
16
17
  import { LIMITS } from "./protocol.js";
17
18
  import { signedRead } from "./reads.js";
18
19
  import { clearRemoval, goneLine, goneOf, recordGone, recordRemoval, removalFor, removalHolds, removalRefusal, REMOVED_CHECK_MS, teamRef } from "./removed.js";
19
- import { pickupEstimate } from "./pickup.js";
20
+ import { awaitingDecision, pickupEstimate } from "./pickup.js";
20
21
  import { allDecisionsPrompt, decisionPrompt, decisionTitle, owedPrompt, stripCeremony, tidyIds, tidyLead, waitingPrompt, workerSummary } from "./decision-ui.js";
21
22
  import { loadProfile, SURFACE_BUNDLE_IDS } from "./profile.js";
22
23
  import { agentProblem, agentProblemFix, PROBLEM_LEAD } from "./readiness-alert.js";
@@ -348,6 +349,8 @@ async function trayStatusOne(cfg, membershipId) {
348
349
  return {};
349
350
  } })() : {};
350
351
  const waiting = all.filter((o) => o.owner !== cfg.member && o.owner !== `human:${cfg.member}`);
352
+ const wakeAskedOf = (who, ref) => !!ref && all.some((h) => h.owner === `human:${who}` && h.about === ref &&
353
+ new RegExp(`\\bLet ${cfg.member.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")} start work on this machine while you are away\\?`).test(h.body));
351
354
  const items = [
352
355
  ...mineHuman.map((o) => {
353
356
  const from = senderOf(o);
@@ -369,7 +372,7 @@ async function trayStatusOne(cfg, membershipId) {
369
372
  const who = o.owner.replace(/^human:/, "");
370
373
  const r0 = row(o, "waiting", who, waitingPrompt(who, decisionTitle(o.body), o.goal));
371
374
  const r = roster && !o.owner.startsWith("human:") && o.kind !== "DELIVER"
372
- ? { ...r0, pickup: pickupEstimate(roster.find((m) => m.id === who) ?? { id: who, sessions: [] }, { now: relayNow, about: { ref: o.ref ?? null, goal: o.goal ?? null }, ...(myMayWake !== undefined ? { mayWake: myMayWake } : {}) }).says }
375
+ ? { ...r0, pickup: pickupEstimate(roster.find((m) => m.id === who) ?? { id: who, sessions: [] }, { now: relayNow, about: { ref: o.ref ?? null, goal: o.goal ?? null }, claimedBy: o.claimed_by ?? null, wakeAsked: wakeAskedOf(who, o.ref), deciding: awaitingDecision(all, { owner: who, ref: o.ref ?? null, goal: o.goal ?? null, ...(o.created_at !== undefined ? { created_at: o.created_at } : {}) }), ...(myMayWake !== undefined ? { mayWake: myMayWake } : {}) }).says }
373
376
  : r0;
374
377
  return o.owner.startsWith("human:")
375
378
  ? { ...r, title: `${who} decides: ${r.title}`, headline: `${who} decides: ${r.headline}`, decider: who }
@@ -432,20 +435,35 @@ function machineFields(cfg, workerRunning = running("worker")) {
432
435
  } })();
433
436
  const surfaceName = openIn === "app" ? "Claude app" : surface === "claude-code" ? "Claude" : surface === "cursor" ? "Cursor" : surface === "copilot" ? "Copilot" : surface === "kiro" ? "Kiro" : "Codex";
434
437
  const rawWorkerState = workerState();
435
- const problem = (() => { try {
438
+ const agentIssue = (() => { try {
436
439
  return agentProblem(CONFIG_DIR);
437
440
  }
438
441
  catch {
439
442
  return null;
440
443
  } })();
444
+ const held = agentIssue ? null : (() => { try {
445
+ const p = loadPersistedGuard(CONFIG_DIR)?.pending;
446
+ return p?.length ? `a teammate's request locked ${p.join(", ")} while it ran, so Pantheon could not put back what it changed — make ${p.length === 1 ? "it" : "them"} writable again (pantheon doctor says how)` : null;
447
+ }
448
+ catch {
449
+ return null;
450
+ } })();
451
+ const safety = agentIssue || held ? null : (() => { try {
452
+ return safetyNotesLine(CONFIG_DIR);
453
+ }
454
+ catch {
455
+ return null;
456
+ } })();
457
+ const problem = agentIssue ?? held ?? safety;
458
+ const lead = agentIssue ? PROBLEM_LEAD : held ? "Unattended runs are on hold" : "A safety warning could not reach your board";
441
459
  return {
442
460
  worker_running: workerRunning,
443
461
  worker_installed: serviceInstalled("worker"),
444
462
  worker_plist: plistPath("worker"),
445
463
  notifier_running: running("notifier"),
446
464
  hook_on: agentHookStates().length > 0,
447
- ...(problem ? { agent_problem: problem, agent_problem_lead: PROBLEM_LEAD, worker_state: `${PROBLEM_LEAD}: ${problem}` } : rawWorkerState ? { worker_state: workerSummary(rawWorkerState) } : {}),
448
- ...(problem ? (() => { try {
465
+ ...(problem ? { agent_problem: problem, agent_problem_lead: lead, worker_state: `${lead}: ${problem}` } : rawWorkerState ? { worker_state: workerSummary(rawWorkerState) } : {}),
466
+ ...(agentIssue ? (() => { try {
449
467
  const fix = agentProblemFix(CONFIG_DIR);
450
468
  return fix ? { agent_problem_fix: fix } : {};
451
469
  }
@@ -20,7 +20,7 @@ export function updateStatus(deps) {
20
20
  if (cache && deps.now() - cache.checkedAt < deps.throttleMs) {
21
21
  return { behind: cache.behind, refreshed: false, latest: cache.latest };
22
22
  }
23
- if (process.env["PANTHEON_NO_UPDATE_CHECK"])
23
+ if (deps.optedOut?.())
24
24
  return { behind: cache?.behind ?? 0, refreshed: false, latest: cache?.latest };
25
25
  if (deps.isGit()) {
26
26
  try {
@@ -57,6 +57,7 @@ const cachePath = (home) => join(home ?? CONFIG_DIR, "update-check.json");
57
57
  export function defaultDeps(home) {
58
58
  return {
59
59
  now: () => Date.now(),
60
+ optedOut: () => !!process.env["PANTHEON_NO_UPDATE_CHECK"],
60
61
  throttleMs: 6 * 60 * 60 * 1000,
61
62
  readCache: () => {
62
63
  try {
@@ -5,7 +5,7 @@ import { join, win32 } from "node:path";
5
5
  export const URI_SCHEME = "pantheon";
6
6
  export const URI_HOSTS = ["board", "done", "explain", "details", "change", "work", "changes"];
7
7
  const FORMS = {
8
- board: { required: [], optional: ["focus"] },
8
+ board: { required: [], optional: ["focus", "space"] },
9
9
  done: { required: ["decision", "k"], optional: ["act", "space"] },
10
10
  explain: { required: ["decision", "k"], optional: ["act", "space"] },
11
11
  details: { required: ["act", "k"], optional: ["decision", "space"] },
@@ -219,7 +219,7 @@ export async function handleUri(args, d) {
219
219
  if (d.openBoard) {
220
220
  let ok = false;
221
221
  try {
222
- ok = await d.openBoard(p.params.focus);
222
+ ok = await d.openBoard(p.params.focus, p.params.focus ? p.params.space : undefined);
223
223
  }
224
224
  catch {
225
225
  ok = false;
@@ -250,6 +250,14 @@ export async function handleUri(args, d) {
250
250
  await d.pause();
251
251
  return code;
252
252
  }
253
+ export function outcomeLines(out) {
254
+ return out.split("\n").filter((l) => l.trim() && !/^action [0-9a-f]+$/.test(l.trim())).map((l) => {
255
+ const m = /^(unconfirmed|not sent): ?(.*)$/.exec(l.trim());
256
+ if (!m)
257
+ return l;
258
+ return m[1] === "unconfirmed" ? `Not confirmed — check the thread.\n ${m[2]}` : `Not sent — ${m[2]}`;
259
+ });
260
+ }
253
261
  export const PROTOCOL_KEY = "HKCU\\Software\\Classes\\pantheon";
254
262
  export const COMMAND_KEY = `${PROTOCOL_KEY}\\shell\\open\\command`;
255
263
  export const PANTHEON_AUMID = "JoinPantheon.Pantheon";
package/dist/which.js CHANGED
@@ -117,6 +117,8 @@ export function parseLoginAnswer(out, mark) {
117
117
  return { found, path };
118
118
  }
119
119
  function runLoginShell(script, args, timeoutMs = 15_000) {
120
+ if (process.env["PANTHEON_LOGIN_SHELL"] === "off")
121
+ throw new Error("login-shell lookups are off (PANTHEON_LOGIN_SHELL=off)");
120
122
  try {
121
123
  return execFileSync("sh", ["-lc", script, "sh", ...args], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: timeoutMs, killSignal: "SIGKILL", env: loginShellEnv() });
122
124
  }