@join-pantheon/cli 0.33.9 → 0.33.10-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/accounts.js +8 -0
- package/dist/board.js +38 -3
- package/dist/cli.js +99 -25
- package/dist/client.js +13 -2
- package/dist/config.js +17 -0
- package/dist/doctor.js +8 -4
- package/dist/forget-team.js +106 -0
- package/dist/notifier.js +1 -1
- package/dist/readiness-alert.js +27 -0
- package/dist/reads.js +9 -2
- package/dist/relay.js +402 -71
- package/dist/removed.js +63 -7
- package/dist/roster-file.js +15 -2
- package/dist/tray.js +86 -40
- package/dist/worker-fleet.js +1 -1
- package/helper/macos/menubar.swift +39 -3
- package/helper/macos/prebuilt/manifest.json +4 -4
- package/helper/macos/prebuilt/pantheon-hud +0 -0
- package/helper/macos/prebuilt/pantheon-tray +0 -0
- package/helper/windows/pantheon-tray.ps1 +58 -1
- package/package.json +1 -1
package/dist/removed.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdirSync, readFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
|
-
import { CONFIG_DIR } from "./config.js";
|
|
3
|
+
import { CONFIG_DIR, legacySpaceId } from "./config.js";
|
|
4
|
+
import { shellArg } from "./team-name.js";
|
|
4
5
|
import { withFileLock } from "./file-lock.js";
|
|
5
6
|
import { writeWhole } from "./pins.js";
|
|
6
7
|
import { trustWrite } from "./home-guard.js";
|
|
@@ -29,9 +30,12 @@ function readAll(home) {
|
|
|
29
30
|
if (!r || typeof r !== "object" || typeof r.name !== "string" || typeof r.at !== "number" || typeof r.last !== "number")
|
|
30
31
|
continue;
|
|
31
32
|
const by = safeMemberName(r.by);
|
|
33
|
+
const g = r.gone;
|
|
34
|
+
const gone = g && typeof g === "object" && (g.kind === "deleted" || g.kind === "removed") && typeof g.at === "number"
|
|
35
|
+
? { kind: g.kind, at: g.at, ...(safeMemberName(g.by) ? { by: safeMemberName(g.by) } : {}) } : null;
|
|
32
36
|
out[k] = { team: k, name: r.name.slice(0, 120), member: String(r.member ?? "").slice(0, 48), relay: String(r.relay ?? "").slice(0, 300), at: r.at, last: r.last,
|
|
33
37
|
knocks: typeof r.knocks === "number" && Number.isInteger(r.knocks) && r.knocks > 0 ? Math.min(r.knocks, 64) : 1,
|
|
34
|
-
...(by ? { by } : {}), ...(typeof r.told === "number" ? { told: r.told } : {}) };
|
|
38
|
+
...(by ? { by } : {}), ...(typeof r.told === "number" ? { told: r.told } : {}), ...(gone ? { gone } : {}) };
|
|
35
39
|
}
|
|
36
40
|
return out;
|
|
37
41
|
}
|
|
@@ -68,24 +72,67 @@ export function removalFor(t, home) {
|
|
|
68
72
|
const r = all[removalKey(t)] ?? (t.spaceId ? all[`${t.relay}|${t.space}`] : undefined) ?? null;
|
|
69
73
|
return r && r.member === t.member ? r : null;
|
|
70
74
|
}
|
|
71
|
-
export
|
|
75
|
+
export const teamRef = (t) => t.spaceId || legacySpaceId(t.relay, t.space);
|
|
76
|
+
export const leaveCommand = (t) => `pantheon leave ${shellArg(teamRef(t))}`;
|
|
77
|
+
export function removalWords(t, by, kind) {
|
|
72
78
|
const b = safeMemberName(by);
|
|
73
|
-
return { name: t.space, member: t.member, ...(b ? { by: b } : {}) }
|
|
79
|
+
return { name: t.space, member: t.member, ...(b ? { by: b } : {}), ...(kind === "deleted" ? { deleted: true } : {}),
|
|
80
|
+
leave: t.relay !== undefined ? leaveCommand({ space: t.space, spaceId: t.spaceId ?? null, relay: t.relay }) : `pantheon leave ${shellArg(t.space)}` };
|
|
74
81
|
}
|
|
75
82
|
export function removalHoldMs(r) {
|
|
76
83
|
return Math.min(REMOVED_FIRST_MS * 2 ** Math.max(0, Math.min(r.knocks, 20) - 1), REMOVED_MAX_MS);
|
|
77
84
|
}
|
|
78
85
|
export function removalHolds(r, now = Date.now()) {
|
|
86
|
+
if (r?.gone?.kind === "deleted")
|
|
87
|
+
return true;
|
|
79
88
|
return !!r && now - r.last < removalHoldMs(r) && r.last <= now + 60_000;
|
|
80
89
|
}
|
|
90
|
+
export function goneOf(t, home) {
|
|
91
|
+
let r = null;
|
|
92
|
+
try {
|
|
93
|
+
r = removalFor(t, home);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
if (!r || r.relay !== t.relay)
|
|
99
|
+
return null;
|
|
100
|
+
return r.gone?.kind === "deleted" ? r.gone : { kind: "removed", at: r.at, ...(r.by ? { by: r.by } : {}) };
|
|
101
|
+
}
|
|
102
|
+
export function recordGone(t, g, home, now = Date.now()) {
|
|
103
|
+
return update(home, (all) => {
|
|
104
|
+
const k = removalKey(t);
|
|
105
|
+
const was = all[k];
|
|
106
|
+
const by = safeMemberName(g.by ?? undefined);
|
|
107
|
+
const at = typeof g.at === "number" && Number.isFinite(g.at) && g.at > 0 && g.at <= now + 60_000 ? g.at : now;
|
|
108
|
+
if (was?.gone?.kind === "deleted" && was.member === t.member && was.relay === t.relay)
|
|
109
|
+
return { changed: false, out: was };
|
|
110
|
+
const r = { team: k, name: t.space, member: t.member, relay: t.relay, at: now, last: now, knocks: 1, ...(by ? { by } : {}),
|
|
111
|
+
gone: { kind: "deleted", at, ...(by ? { by } : {}) } };
|
|
112
|
+
all[k] = r;
|
|
113
|
+
return { changed: true, out: r };
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export function goneLine(name, g) {
|
|
117
|
+
const by = safeMemberName(g.by);
|
|
118
|
+
if (g.kind === "removed")
|
|
119
|
+
return `You were removed from ${name}${by ? ` by ${by}` : ""}`;
|
|
120
|
+
return `${name} was deleted${by === "operator" ? " by the relay operator" : by ? ` by ${by}` : ""} on ${localDay(g.at)}`;
|
|
121
|
+
}
|
|
122
|
+
export const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
123
|
+
export const localDay = (at) => { const d = new Date(at); return `${d.getDate()} ${MONTHS[d.getMonth()]}`; };
|
|
124
|
+
export const localStamp = (at) => { const d = new Date(at); return `${localDay(at)}, ${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`; };
|
|
125
|
+
export const restateDeletedWhen = (text, at) => text.replace(/ on \d{1,2} [A-Z][a-z]{2,3}, \d\d:\d\d UTC/, ` on ${localStamp(at)}`);
|
|
81
126
|
export function recordRemoval(t, by, home, now = Date.now()) {
|
|
82
127
|
return update(home, (all) => {
|
|
83
128
|
const k = removalKey(t);
|
|
84
129
|
const was = all[k];
|
|
85
130
|
const knocks = !was ? 1 : now - was.last >= REMOVED_FIRST_MS - 60_000 ? Math.min(was.knocks + 1, 64) : was.knocks;
|
|
86
131
|
const who = safeMemberName(by) ?? (was?.member === t.member ? was?.by : undefined);
|
|
87
|
-
const
|
|
88
|
-
|
|
132
|
+
const at = was?.member === t.member ? was.at : now;
|
|
133
|
+
const r = { team: k, name: t.space, member: t.member, relay: t.relay, at, last: now, knocks: was?.member === t.member ? knocks : 1,
|
|
134
|
+
...(who ? { by: who } : {}), ...(was?.member === t.member && was?.told ? { told: was.told } : {}),
|
|
135
|
+
gone: { kind: "removed", at, ...(who ? { by: who } : {}) } };
|
|
89
136
|
all[k] = r;
|
|
90
137
|
return { changed: true, out: r };
|
|
91
138
|
});
|
|
@@ -118,11 +165,20 @@ export function takeTold(t, home, now = Date.now()) {
|
|
|
118
165
|
});
|
|
119
166
|
}
|
|
120
167
|
export function removedLine(r) {
|
|
168
|
+
const leave = r.leave ?? `pantheon leave ${shellArg(r.name)}`;
|
|
169
|
+
if (r.deleted)
|
|
170
|
+
return `"${r.name}" was deleted${r.by === "operator" ? " by the relay operator" : r.by ? ` by ${r.by}` : ""} — it no longer exists on the relay, and this machine stopped connecting to it. To remove it from this computer: ${leave}`;
|
|
121
171
|
return `you (${r.member}) were removed from "${r.name}"${r.by ? ` by ${r.by}` : ""}. This machine has stopped connecting to it (it checks now and then, at most every 6 hours). ` +
|
|
122
172
|
`To come back you need a new invite from someone in "${r.name}" (pantheon join <invite>), or for a member to let you back in (pantheon admit ${r.member}). ` +
|
|
123
|
-
`To forget the team here:
|
|
173
|
+
`To forget the team here: ${leave}`;
|
|
124
174
|
}
|
|
125
175
|
export function removedNotice(r) {
|
|
176
|
+
if (r.deleted)
|
|
177
|
+
return {
|
|
178
|
+
kind: "worker", who: "Pantheon", context: r.name, ttl: 0, sound: false,
|
|
179
|
+
heading: `${r.name} was deleted`,
|
|
180
|
+
body: `${r.by === "operator" ? "The relay operator" : r.by ?? "Its founder"} deleted "${r.name}", so no requests or alerts come from it. To remove it from this computer: ${r.leave ?? `pantheon leave ${shellArg(r.name)}`}`,
|
|
181
|
+
};
|
|
126
182
|
return {
|
|
127
183
|
kind: "worker", who: "Pantheon", context: r.name, ttl: 0, sound: false,
|
|
128
184
|
heading: `You were removed from ${r.name}`,
|
package/dist/roster-file.js
CHANGED
|
@@ -24,6 +24,7 @@ export class Allowlist {
|
|
|
24
24
|
invites = new Map();
|
|
25
25
|
tokenHash = null;
|
|
26
26
|
retiredHashes = [];
|
|
27
|
+
droppedHashes = [];
|
|
27
28
|
removedAt = null;
|
|
28
29
|
id = null;
|
|
29
30
|
founderName = null;
|
|
@@ -71,11 +72,14 @@ export class Allowlist {
|
|
|
71
72
|
this.tokenHash = doc.tokenHash ?? null;
|
|
72
73
|
if ("retiredTokenHashes" in doc && Array.isArray(doc.retiredTokenHashes))
|
|
73
74
|
this.retiredHashes = doc.retiredTokenHashes.filter((h) => typeof h === "string");
|
|
75
|
+
const dropped = raw.droppedTokenHashes;
|
|
76
|
+
if (Array.isArray(dropped))
|
|
77
|
+
this.droppedHashes = dropped.filter((h) => typeof h === "string");
|
|
74
78
|
if ("removed_at" in doc && typeof doc.removed_at === "number")
|
|
75
79
|
this.removedAt = doc.removed_at;
|
|
76
80
|
if (legacyRemoval && this.removedAt === null)
|
|
77
81
|
this.removedAt = Date.now();
|
|
78
|
-
const known = new Set(["members", "invites", "tokenHash", "retiredTokenHashes", "removed_at", "id", "name", "repos", "founder", "founder_guessed", "recoveries"]);
|
|
82
|
+
const known = new Set(["members", "invites", "tokenHash", "retiredTokenHashes", "droppedTokenHashes", "removed_at", "id", "name", "repos", "founder", "founder_guessed", "recoveries"]);
|
|
79
83
|
if (Array.isArray(doc.recoveries)) {
|
|
80
84
|
for (const r of doc.recoveries) {
|
|
81
85
|
if (r && typeof r.member === "string" && typeof r.pubkey === "string" && typeof r.due_at === "number")
|
|
@@ -133,6 +137,7 @@ export class Allowlist {
|
|
|
133
137
|
invites: [...this.invites.values()],
|
|
134
138
|
...(this.tokenHash ? { tokenHash: this.tokenHash } : {}),
|
|
135
139
|
...(this.retiredHashes.length ? { retiredTokenHashes: this.retiredHashes } : {}),
|
|
140
|
+
...(this.droppedHashes.length ? { droppedTokenHashes: this.droppedHashes } : {}),
|
|
136
141
|
...(this.removedAt !== null ? { removed_at: this.removedAt } : {}),
|
|
137
142
|
...(this.repos.size ? { repos: [...this.repos.values()] } : {}),
|
|
138
143
|
...(this.recoveries.size ? { recoveries: [...this.recoveries.values()] } : {}),
|
|
@@ -194,12 +199,20 @@ export class Allowlist {
|
|
|
194
199
|
tokenHashes() {
|
|
195
200
|
return [...(this.tokenHash ? [this.tokenHash] : []), ...this.retiredHashes];
|
|
196
201
|
}
|
|
202
|
+
everyTokenHash() {
|
|
203
|
+
return [...new Set([...this.tokenHashes(), ...this.droppedHashes])];
|
|
204
|
+
}
|
|
205
|
+
static DROPPED_KEPT = 10_000;
|
|
197
206
|
static RETIRED_KEPT = 64;
|
|
198
207
|
rotateToken(next) {
|
|
199
208
|
if (this.tokenHash) {
|
|
200
209
|
this.retiredHashes.push(this.tokenHash);
|
|
201
|
-
if (this.retiredHashes.length > Allowlist.RETIRED_KEPT)
|
|
210
|
+
if (this.retiredHashes.length > Allowlist.RETIRED_KEPT) {
|
|
211
|
+
this.droppedHashes.push(...this.retiredHashes.slice(0, -Allowlist.RETIRED_KEPT));
|
|
212
|
+
if (this.droppedHashes.length > Allowlist.DROPPED_KEPT)
|
|
213
|
+
this.droppedHashes = this.droppedHashes.slice(-Allowlist.DROPPED_KEPT);
|
|
202
214
|
this.retiredHashes = this.retiredHashes.slice(-Allowlist.RETIRED_KEPT);
|
|
215
|
+
}
|
|
203
216
|
}
|
|
204
217
|
this.tokenHash = hashToken(next);
|
|
205
218
|
for (const i of this.invites.values())
|
package/dist/tray.js
CHANGED
|
@@ -11,7 +11,7 @@ import { plistPath, serviceInstalled, whichPantheon } from "./service.js";
|
|
|
11
11
|
import { VERSION } from "./version.js";
|
|
12
12
|
import { LIMITS } from "./protocol.js";
|
|
13
13
|
import { signedRead } from "./reads.js";
|
|
14
|
-
import { clearRemoval, recordRemoval, removalFor, removalHolds, removalRefusal } from "./removed.js";
|
|
14
|
+
import { clearRemoval, goneLine, goneOf, recordGone, recordRemoval, removalFor, removalHolds, removalRefusal, REMOVED_CHECK_MS, teamRef } from "./removed.js";
|
|
15
15
|
import { pickupEstimate } from "./pickup.js";
|
|
16
16
|
import { allDecisionsPrompt, decisionPrompt, decisionTitle, owedPrompt, stripCeremony, tidyIds, tidyLead, waitingPrompt, workerSummary } from "./decision-ui.js";
|
|
17
17
|
import { loadProfile, SURFACE_BUNDLE_IDS } from "./profile.js";
|
|
@@ -144,22 +144,28 @@ async function signedObligations(cfg, removed = null) {
|
|
|
144
144
|
try {
|
|
145
145
|
const res = await signedRead(cfg, "/obligations", {}, { timeoutMs: LIMITS.pendingTimeoutMs });
|
|
146
146
|
let refusedAsRemoved = false;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
147
|
+
let gone;
|
|
148
|
+
const team = { space: cfg.space, spaceId: cfg.spaceId ?? null, relay: cfg.relay, member: cfg.member };
|
|
149
|
+
try {
|
|
150
|
+
if (res.status === 403) {
|
|
151
|
+
const why = await res.clone().json().catch(() => null);
|
|
152
|
+
if (why?.code === "REVOKED") {
|
|
153
|
+
refusedAsRemoved = true;
|
|
154
|
+
const r = recordRemoval(team, removalRefusal(`REVOKED: ${why.error ?? ""} Only a member`)?.by ?? removed?.by);
|
|
155
|
+
gone = r.gone;
|
|
156
156
|
}
|
|
157
|
-
else if (res.ok)
|
|
158
|
-
clearRemoval(team);
|
|
159
157
|
}
|
|
160
|
-
|
|
158
|
+
else if (res.status === 410 && cfg.spaceId) {
|
|
159
|
+
const why = await res.clone().json().catch(() => null);
|
|
160
|
+
if (why?.gone === "deleted" && typeof why.space_id === "string" && why.space_id === cfg.spaceId) {
|
|
161
|
+
gone = recordGone(team, { by: typeof why.by === "string" ? why.by : null, ...(typeof why.at === "number" ? { at: why.at } : {}) }).gone;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else if (res.ok && removed)
|
|
165
|
+
clearRemoval(team);
|
|
161
166
|
}
|
|
162
|
-
|
|
167
|
+
catch { }
|
|
168
|
+
return { body: res.ok ? await res.json() : null, refusedAsRemoved, ...(gone ? { gone } : {}) };
|
|
163
169
|
}
|
|
164
170
|
catch {
|
|
165
171
|
return { body: null, refusedAsRemoved: false };
|
|
@@ -168,19 +174,21 @@ async function signedObligations(cfg, removed = null) {
|
|
|
168
174
|
export async function trayStatus(cfg = load(), f = loadAll()) {
|
|
169
175
|
const ms = Object.values(f?.spaces ?? {});
|
|
170
176
|
if (f && ms.length > 1) {
|
|
171
|
-
const parts = await Promise.all(ms.map((m) => trayStatusOne(configFor(f, m, null))));
|
|
172
|
-
const
|
|
173
|
-
if (!
|
|
177
|
+
const parts = await Promise.all(ms.map((m) => trayStatusOne(configFor(f, m, null), m.id)));
|
|
178
|
+
const all = parts.filter((p) => p.configured);
|
|
179
|
+
if (!all.length)
|
|
174
180
|
return parts[0];
|
|
175
|
-
const
|
|
181
|
+
const ok = all.filter((p) => !p.gone_spaces?.length);
|
|
182
|
+
const [first] = (ok.length ? ok : all);
|
|
176
183
|
return {
|
|
177
184
|
...first,
|
|
178
|
-
space: ok.map((p) => p.space).join(" · "),
|
|
185
|
+
space: ok.length ? ok.map((p) => p.space).join(" · ") : NO_ACTIVE_TEAMS,
|
|
179
186
|
spaces: ok.map((p) => p.space),
|
|
180
187
|
relay_ok: ok.every((p) => p.relay_ok),
|
|
181
188
|
decisions_ok: ok.every((p) => p.decisions_ok),
|
|
182
189
|
unavailable_spaces: ok.flatMap((p) => p.unavailable_spaces ?? []),
|
|
183
|
-
removed_spaces:
|
|
190
|
+
removed_spaces: all.flatMap((p) => p.removed_spaces ?? []),
|
|
191
|
+
gone_spaces: all.flatMap((p) => p.gone_spaces ?? []),
|
|
184
192
|
online: ok.reduce((n, p) => n + (p.online ?? 0), 0),
|
|
185
193
|
members: ok.reduce((n, p) => n + (p.members ?? 0), 0),
|
|
186
194
|
decisions: ok.flatMap((p) => (p.decisions ?? []).map((d) => ({ ...d, body: `[${p.space}] ${d.body}` }))),
|
|
@@ -190,23 +198,32 @@ export async function trayStatus(cfg = load(), f = loadAll()) {
|
|
|
190
198
|
waiting_count: ok.reduce((n, p) => n + (p.waiting_count ?? 0), 0),
|
|
191
199
|
};
|
|
192
200
|
}
|
|
193
|
-
|
|
201
|
+
const only = ms.length === 1 ? ms[0] : undefined;
|
|
202
|
+
return trayStatusOne(cfg, only && cfg && (only.id === cfg.spaceId || only.name === cfg.space) ? only.id : undefined);
|
|
194
203
|
}
|
|
195
|
-
|
|
204
|
+
export const NO_ACTIVE_TEAMS = "No active teams";
|
|
205
|
+
async function trayStatusOne(cfg, membershipId) {
|
|
196
206
|
if (!cfg)
|
|
197
207
|
return { configured: false, version: VERSION };
|
|
198
208
|
const base = cfg.relay.replace(/^ws/, "http").replace(/\/+$/, "");
|
|
209
|
+
const team = { space: cfg.space, spaceId: cfg.spaceId ?? null, relay: cfg.relay, member: cfg.member };
|
|
199
210
|
const record = (() => { try {
|
|
200
|
-
return removalFor(
|
|
211
|
+
return removalFor(team);
|
|
201
212
|
}
|
|
202
213
|
catch {
|
|
203
214
|
return null;
|
|
204
215
|
} })();
|
|
205
216
|
const removed = removalHolds(record);
|
|
217
|
+
const known = goneOf(team);
|
|
218
|
+
const recheck = !!record && known?.kind === "removed" && Date.now() - record.last >= REMOVED_CHECK_MS;
|
|
219
|
+
if (known && (known.kind === "deleted" || (removed && !recheck)))
|
|
220
|
+
return goneStatus(cfg, known, membershipId);
|
|
206
221
|
const [health, probe] = await Promise.all([
|
|
207
222
|
getJson(`${base}/health?space=${encodeURIComponent(cfg.space)}`),
|
|
208
|
-
|
|
223
|
+
signedObligations(cfg, record),
|
|
209
224
|
]);
|
|
225
|
+
if (probe.gone)
|
|
226
|
+
return goneStatus(cfg, probe.gone, membershipId);
|
|
210
227
|
const obligations = probe.body;
|
|
211
228
|
const rosterRaw = obligations?.roster;
|
|
212
229
|
const roster = Array.isArray(rosterRaw) ? rosterRaw : null;
|
|
@@ -259,16 +276,6 @@ async function trayStatusOne(cfg) {
|
|
|
259
276
|
];
|
|
260
277
|
const workerRunning = workerProc().running;
|
|
261
278
|
const board = arrangeBoard(items, { now: Date.now(), workerRunning });
|
|
262
|
-
const profile = loadProfile(cfg);
|
|
263
|
-
const surface = profile.agent.primary_surface;
|
|
264
|
-
const surfaceName = surface === "claude-code" ? "Claude" : surface === "cursor" ? "Cursor" : surface === "copilot" ? "Copilot" : surface === "kiro" ? "Kiro" : "Codex";
|
|
265
|
-
const rawWorkerState = workerState();
|
|
266
|
-
const problem = (() => { try {
|
|
267
|
-
return agentProblem(CONFIG_DIR);
|
|
268
|
-
}
|
|
269
|
-
catch {
|
|
270
|
-
return null;
|
|
271
|
-
} })();
|
|
272
279
|
return {
|
|
273
280
|
configured: true,
|
|
274
281
|
version: VERSION,
|
|
@@ -279,9 +286,29 @@ async function trayStatusOne(cfg) {
|
|
|
279
286
|
relay_ok: !!space,
|
|
280
287
|
decisions_ok: decisionsOk,
|
|
281
288
|
unavailable_spaces: !space || !decisionsOk ? [cfg.space] : [],
|
|
282
|
-
|
|
289
|
+
gone_spaces: [],
|
|
283
290
|
online: space?.online ?? 0,
|
|
284
291
|
members: space?.members ?? 0,
|
|
292
|
+
...machineFields(cfg, workerRunning),
|
|
293
|
+
decisions_prompt: allDecisionsPrompt(decisions.length),
|
|
294
|
+
decisions,
|
|
295
|
+
items: board,
|
|
296
|
+
owed_count: owed.length,
|
|
297
|
+
waiting_count: waiting.length,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function machineFields(cfg, workerRunning = workerProc().running) {
|
|
301
|
+
const profile = loadProfile(cfg);
|
|
302
|
+
const surface = profile.agent.primary_surface;
|
|
303
|
+
const surfaceName = surface === "claude-code" ? "Claude" : surface === "cursor" ? "Cursor" : surface === "copilot" ? "Copilot" : surface === "kiro" ? "Kiro" : "Codex";
|
|
304
|
+
const rawWorkerState = workerState();
|
|
305
|
+
const problem = (() => { try {
|
|
306
|
+
return agentProblem(CONFIG_DIR);
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
return null;
|
|
310
|
+
} })();
|
|
311
|
+
return {
|
|
285
312
|
worker_running: workerRunning,
|
|
286
313
|
worker_installed: serviceInstalled("worker"),
|
|
287
314
|
worker_plist: plistPath("worker"),
|
|
@@ -290,11 +317,30 @@ async function trayStatusOne(cfg) {
|
|
|
290
317
|
...(problem ? { agent_problem: problem, agent_problem_lead: PROBLEM_LEAD, worker_state: `${PROBLEM_LEAD}: ${problem}` } : rawWorkerState ? { worker_state: workerSummary(rawWorkerState) } : {}),
|
|
291
318
|
surface_name: surfaceName,
|
|
292
319
|
surface_bundle_id: SURFACE_BUNDLE_IDS[surface],
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function goneStatus(cfg, g, membershipId) {
|
|
323
|
+
const team = { space: cfg.space, spaceId: cfg.spaceId ?? null, relay: cfg.relay };
|
|
324
|
+
return {
|
|
325
|
+
configured: true,
|
|
326
|
+
version: VERSION,
|
|
327
|
+
space: NO_ACTIVE_TEAMS,
|
|
328
|
+
spaces: [],
|
|
329
|
+
member: cfg.member,
|
|
330
|
+
relay: cfg.relay,
|
|
331
|
+
relay_ok: true,
|
|
332
|
+
decisions_ok: true,
|
|
333
|
+
unavailable_spaces: [],
|
|
334
|
+
...(g.kind === "removed" ? { removed_spaces: [cfg.space] } : {}),
|
|
335
|
+
gone_spaces: [{ space: membershipId ?? teamRef(team), name: cfg.space, kind: g.kind, ...(g.by ? { by: g.by } : {}), at: g.at, line: goneLine(cfg.space, g) }],
|
|
336
|
+
online: 0,
|
|
337
|
+
members: 0,
|
|
338
|
+
...machineFields(cfg),
|
|
339
|
+
decisions_prompt: allDecisionsPrompt(0),
|
|
340
|
+
decisions: [],
|
|
341
|
+
items: [],
|
|
342
|
+
owed_count: 0,
|
|
343
|
+
waiting_count: 0,
|
|
298
344
|
};
|
|
299
345
|
}
|
|
300
346
|
//# sourceMappingURL=tray.js.map
|
package/dist/worker-fleet.js
CHANGED
|
@@ -109,7 +109,7 @@ export class WorkerFleet {
|
|
|
109
109
|
}
|
|
110
110
|
if (!this.removedSaid.has(r.team)) {
|
|
111
111
|
this.removedSaid.add(r.team);
|
|
112
|
-
const words = removalWords(team, r.by);
|
|
112
|
+
const words = removalWords(team, r.by, r.gone?.kind);
|
|
113
113
|
this.opts.log(`fleet: [${cfg.space}] ${removedLine(words)}`);
|
|
114
114
|
try {
|
|
115
115
|
if (this.opts.notify && takeTold(team))
|
|
@@ -80,6 +80,8 @@ struct TrayState {
|
|
|
80
80
|
var items: [Item] = []
|
|
81
81
|
/// every team this machine is in, joined order; more than one and the board is drawn per team
|
|
82
82
|
var spaces: [String] = []
|
|
83
|
+
/// teams gone for this machine (deleted, or this person removed): the line to show, and the id `pantheon leave <id> --yes` takes
|
|
84
|
+
var gone: [(space: String, line: String)] = []
|
|
83
85
|
var version = ""
|
|
84
86
|
}
|
|
85
87
|
|
|
@@ -194,6 +196,9 @@ func fetchState() -> TrayState {
|
|
|
194
196
|
s.surfaceBundleID = j["surface_bundle_id"] as? String ?? ""
|
|
195
197
|
s.decisionsPrompt = j["decisions_prompt"] as? String ?? ""
|
|
196
198
|
s.spaces = j["spaces"] as? [String] ?? []
|
|
199
|
+
for g in (j["gone_spaces"] as? [[String: Any]] ?? []) {
|
|
200
|
+
if let space = g["space"] as? String, let line = g["line"] as? String, !space.isEmpty, !line.isEmpty { s.gone.append((space: space, line: line)) }
|
|
201
|
+
}
|
|
197
202
|
for i in (j["items"] as? [[String: Any]] ?? []) {
|
|
198
203
|
s.items.append(Item(
|
|
199
204
|
id: i["id"] as? String ?? "",
|
|
@@ -706,7 +711,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
|
|
|
706
711
|
// Everything the board draws from, not just which ids: a row moving lane (out
|
|
707
712
|
// of the worker's window), a new repeat, a claim, or a Later coming due all
|
|
708
713
|
// change what an open board must show.
|
|
709
|
-
"\(state.items.map { "\($0.id):\($0.effectiveLane):\($0.claimed):\($0.context)" }.joined(separator: ","))|\(Later.active().keys.sorted().joined(separator: ","))|\(state.decisions.count)|\(state.online)|\(state.members)|\(state.workerRunning)|\(state.relayOk)|\(state.agentProblem)|\(actionError ?? "")|\(workerAction ?? "")"
|
|
714
|
+
"\(state.items.map { "\($0.id):\($0.effectiveLane):\($0.claimed):\($0.context)" }.joined(separator: ","))|\(Later.active().keys.sorted().joined(separator: ","))|\(state.decisions.count)|\(state.online)|\(state.members)|\(state.workerRunning)|\(state.relayOk)|\(state.gone.map { $0.space }.joined(separator: ","))|\(state.agentProblem)|\(actionError ?? "")|\(workerAction ?? "")"
|
|
710
715
|
}
|
|
711
716
|
|
|
712
717
|
@objc private func iconClicked(_ sender: Any?) {
|
|
@@ -847,8 +852,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
|
|
|
847
852
|
// Short: the warning row below says what and why; the heading must leave the status text its room.
|
|
848
853
|
let need = cards.isEmpty ? (problem.isEmpty ? "Nothing needs you" : AppDelegate.problemHeading) : "\(cards.count) need\(cards.count == 1 ? "s" : "") you"
|
|
849
854
|
let where_ = multi ? "\(state.spaces.count) teams" : state.space
|
|
850
|
-
|
|
855
|
+
// Every team gone: "alex · No active teams", not "0 of 0 online".
|
|
856
|
+
let noTeams = state.spaces.isEmpty && !state.gone.isEmpty
|
|
857
|
+
rows.append(HeaderView(lead: need, rest: "\(state.member) · \(where_)" + (noTeams ? "" : " · " + (state.relayOk ? "\(state.online) of \(state.members) online" : "connection unavailable")), width: w))
|
|
851
858
|
if !problem.isEmpty { rows.append(WarningView(lead: state.agentProblemLead, line: problem, width: w)) }
|
|
859
|
+
// A team gone for this computer: said plainly, never as "could not reach" — one click removes it.
|
|
860
|
+
for g in state.gone { act("\(g.line) · Remove from this computer", "") { [weak self] in self?.forgetTeam(g.space, g.line) } }
|
|
852
861
|
if !state.relayOk { note("Could not reach: \(state.unavailableSpaces.joined(separator: ", "))") }
|
|
853
862
|
if !state.decisionsOk { note("Some of this could not be checked — the list may be incomplete") }
|
|
854
863
|
sep()
|
|
@@ -1025,9 +1034,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
|
|
|
1025
1034
|
let summary = NSMenuItem(title: state.member, action: nil, keyEquivalent: "")
|
|
1026
1035
|
summary.isEnabled = false
|
|
1027
1036
|
summary.view = HeaderView(lead: cards.isEmpty ? (state.agentProblem.isEmpty ? "Nothing needs you" : AppDelegate.problemHeading) : "\(cards.count) need\(cards.count == 1 ? "s" : "") you",
|
|
1028
|
-
rest: "\(state.member) · " + (multi ? "\(state.spaces.count) teams" : state.space) + " · " + (state.relayOk ? "\(state.online) of \(state.members) online" : "connection unavailable"),
|
|
1037
|
+
rest: "\(state.member) · " + (multi ? "\(state.spaces.count) teams" : state.space) + (state.spaces.isEmpty && !state.gone.isEmpty ? "" : " · " + (state.relayOk ? "\(state.online) of \(state.members) online" : "connection unavailable")),
|
|
1029
1038
|
width: RowView.rowWidth)
|
|
1030
1039
|
menu.addItem(summary)
|
|
1040
|
+
for g in state.gone {
|
|
1041
|
+
let mi = makeItem("\(g.line) · Remove from this computer", #selector(forgetGoneItem(_:)))
|
|
1042
|
+
mi.representedObject = [g.space, g.line]
|
|
1043
|
+
menu.addItem(mi)
|
|
1044
|
+
}
|
|
1031
1045
|
if !state.relayOk { info("Could not reach: \(state.unavailableSpaces.joined(separator: ", "))") }
|
|
1032
1046
|
if !state.decisionsOk { info("Some of this could not be checked — the list may be incomplete") }
|
|
1033
1047
|
menu.addItem(.separator())
|
|
@@ -1899,6 +1913,28 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
|
|
|
1899
1913
|
return mi
|
|
1900
1914
|
}
|
|
1901
1915
|
|
|
1916
|
+
@objc private func forgetGoneItem(_ sender: NSMenuItem) {
|
|
1917
|
+
guard let pair = sender.representedObject as? [String], pair.count == 2 else { return }
|
|
1918
|
+
forgetTeam(pair[0], pair[1])
|
|
1919
|
+
}
|
|
1920
|
+
/// "Remove from this computer": `pantheon leave <id> --yes --if-gone` for a team the relay said is gone —
|
|
1921
|
+
/// asked of the relay again first, so a team let back in meanwhile is never removed.
|
|
1922
|
+
private func forgetTeam(_ space: String, _ line: String) {
|
|
1923
|
+
guard workerAction == nil else { return }
|
|
1924
|
+
workerAction = "Removing a team from this computer…"
|
|
1925
|
+
actionError = nil
|
|
1926
|
+
paint()
|
|
1927
|
+
if let menu = item.menu { menuNeedsUpdate(menu) }
|
|
1928
|
+
DispatchQueue.global().async {
|
|
1929
|
+
let result = run(pantheonBin, ["leave", space, "--yes", "--if-gone"], timeout: 60)
|
|
1930
|
+
DispatchQueue.main.async {
|
|
1931
|
+
self.workerAction = nil
|
|
1932
|
+
if result?.code != 0 { self.reportFailure("Could not remove it from this computer — it may be live again. Open status in Terminal to see.") }
|
|
1933
|
+
self.refresh()
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1902
1938
|
private func changeWorker(_ title: String, path: String, args: [String]) {
|
|
1903
1939
|
guard workerAction == nil else { return }
|
|
1904
1940
|
workerAction = title
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"format": 1,
|
|
3
|
-
"built_at": "2026-10-
|
|
3
|
+
"built_at": "2026-10-13T22:11:23.149Z",
|
|
4
4
|
"swiftc": "Apple Swift version 6.3.3 (swiftlang-6.3.3.1.3 clang-2100.1.1.101)",
|
|
5
5
|
"helpers": {
|
|
6
6
|
"pantheon-tray": {
|
|
7
7
|
"source": "menubar.swift",
|
|
8
|
-
"source_sha256": "
|
|
9
|
-
"sha256": "
|
|
8
|
+
"source_sha256": "9bf57ddc5d356fafb0bafe0f214f5ef2cbba66b03b9cd1370016ce282e47c1ac",
|
|
9
|
+
"sha256": "c73c1f1ae8ed6932dc0aee6c63f3d50457f6eb493b8d0a49f77022c779e32b2d",
|
|
10
10
|
"archs": [
|
|
11
11
|
"arm64",
|
|
12
12
|
"x86_64"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"pantheon-hud": {
|
|
18
18
|
"source": "main.swift",
|
|
19
19
|
"source_sha256": "d3e4b3df9442901ffc5eb95d4679fe08e428f0f67b1f3f86d68ed7ea036de691",
|
|
20
|
-
"sha256": "
|
|
20
|
+
"sha256": "f855bac430e21a63b94917170ef5fe7adb46cdd37441f5aa7a84168a45062f6c",
|
|
21
21
|
"archs": [
|
|
22
22
|
"arm64",
|
|
23
23
|
"x86_64"
|
|
Binary file
|
|
Binary file
|
|
@@ -93,6 +93,10 @@ $global:PT = @{
|
|
|
93
93
|
# like the macOS tray, two misses keep what was last known; the third is shown.
|
|
94
94
|
checkTimeout = 20; missesTolerated = 2
|
|
95
95
|
misses = 0; check = $null; board = $null; nextCheck = (Get-Date); quit = $false
|
|
96
|
+
# "Remove from this computer" runs under way, by team id: one at a time each, and how each ended is said.
|
|
97
|
+
leaving = @{}
|
|
98
|
+
# The most gone teams drawn in the menu; the rest are one line (the board lists them all).
|
|
99
|
+
goneShown = 10
|
|
96
100
|
logDir = (Join-Path $PantheonHome 'logs')
|
|
97
101
|
hostDir = (Join-Path $PantheonHome 'host')
|
|
98
102
|
noticeDir = (Join-Path (Join-Path $PantheonHome 'host') 'notices')
|
|
@@ -106,7 +110,7 @@ $global:PT = @{
|
|
|
106
110
|
dash = [string][char]0x2014; dot = [string][char]0x00B7; ellipsis = [string][char]0x2026
|
|
107
111
|
state = @{
|
|
108
112
|
loaded = $false; reachable = $false; configured = $false; relayOk = $false; decisionsOk = $true
|
|
109
|
-
member = ''; space = ''; spaces = @(); need = 0; workerRunning = $false; workerInstalled = $false; agentProblem = ''; agentProblemLead = ''
|
|
113
|
+
member = ''; space = ''; spaces = @(); need = 0; workerRunning = $false; workerInstalled = $false; agentProblem = ''; agentProblemLead = ''; gone = @()
|
|
110
114
|
}
|
|
111
115
|
icons = @{}
|
|
112
116
|
}
|
|
@@ -433,6 +437,12 @@ function global:Read-Status([string]$json) {
|
|
|
433
437
|
# Why this computer cannot take requests, with the fix (signed out, no agent CLI): the heading, the icon and a menu line say it.
|
|
434
438
|
agentProblem = $(if ($j.agent_problem -is [string]) { $p = ([string]$j.agent_problem) -replace '[\x00-\x1f\x7f-\x9f\u200e\u200f\u202a-\u202e\u2066-\u2069]', ''; if ($p.Length -gt 200) { $p.Substring(0, 199) + $PT.ellipsis } else { $p } } else { '' })
|
|
435
439
|
agentProblemLead = $(if ($j.agent_problem_lead) { [string]$j.agent_problem_lead } else { "Unattended work can't run" })
|
|
440
|
+
# Teams gone for this computer (deleted, or this person removed): a line each, and the id `pantheon leave <id> --yes` takes.
|
|
441
|
+
# tray-status leaves them out of relay_ok, so one gone team never marks the whole machine unreachable.
|
|
442
|
+
gone = @(@($j.gone_spaces) | Where-Object { $null -ne $_ -and $_.space -is [string] -and $_.line -is [string] -and $_.space } | ForEach-Object {
|
|
443
|
+
$l = ([string]$_.line) -replace '[\x00-\x1f\x7f-\x9f\u200e\u200f\u202a-\u202e\u2066-\u2069]', ''
|
|
444
|
+
@{ space = [string]$_.space; line = $(if ($l.Length -gt 160) { $l.Substring(0, 159) + $PT.ellipsis } else { $l }) }
|
|
445
|
+
})
|
|
436
446
|
}
|
|
437
447
|
}
|
|
438
448
|
|
|
@@ -656,6 +666,49 @@ function global:Add-MenuItem([string]$text, [scriptblock]$onClick, [bool]$bold =
|
|
|
656
666
|
[void]$PT.menu.Items.Add($item)
|
|
657
667
|
}
|
|
658
668
|
|
|
669
|
+
# Menu text: WinForms reads "&" as the next letter's shortcut, so a name with one ("R&D") lost it.
|
|
670
|
+
function global:ConvertTo-MenuText([string]$text) { return $text.Replace('&', '&&') }
|
|
671
|
+
|
|
672
|
+
# "Remove from this computer": `pantheon leave <id> --yes --if-gone` (the relay is asked
|
|
673
|
+
# again first, so a team let back in is never removed). A second click while one runs
|
|
674
|
+
# for the team does nothing; how it ended is said (Watch-Leaving).
|
|
675
|
+
function global:Start-Leave([string]$space, [string]$line) {
|
|
676
|
+
if (-not $space -or $PT.leaving.ContainsKey($space)) { return }
|
|
677
|
+
try {
|
|
678
|
+
$p = [System.Diagnostics.Process]::Start((New-PantheonStart @('leave', $space, '--yes', '--if-gone') $false))
|
|
679
|
+
$PT.leaving[$space] = @{ process = $p; line = $line }
|
|
680
|
+
Write-TrayLog ('remove ' + $space + ': started')
|
|
681
|
+
} catch {
|
|
682
|
+
Write-TrayLog ('remove ' + $space + ' failed: ' + $_.Exception.Message)
|
|
683
|
+
Show-LeaveFailed $line
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
function global:Show-LeaveFailed([string]$line) {
|
|
687
|
+
try { $PT.tray.ShowBalloonTip(15000, 'Pantheon', ('Could not remove it from this computer: ' + $line + '. It may be live again ' + $PT.dash + ' open Status to see.'), [System.Windows.Forms.ToolTipIcon]::Warning) } catch { }
|
|
688
|
+
}
|
|
689
|
+
function global:Watch-Leaving {
|
|
690
|
+
foreach ($space in @($PT.leaving.Keys)) {
|
|
691
|
+
$l = $PT.leaving[$space]
|
|
692
|
+
if (-not $l.process.HasExited) { continue }
|
|
693
|
+
$code = $l.process.ExitCode
|
|
694
|
+
$l.process.Dispose()
|
|
695
|
+
$PT.leaving.Remove($space)
|
|
696
|
+
Write-TrayLog ('remove ' + $space + ': exit ' + $code)
|
|
697
|
+
if ($code -ne 0) { Show-LeaveFailed $l.line }
|
|
698
|
+
$PT.nextCheck = Get-Date
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
# A team gone for this computer: its line, and a click removes it (the id rides on the item's Name, the line on its Tag).
|
|
703
|
+
function global:Add-GoneItem([string]$text, [string]$space, [string]$line) {
|
|
704
|
+
$item = New-Object System.Windows.Forms.ToolStripMenuItem (ConvertTo-MenuText $text)
|
|
705
|
+
$item.Name = $space
|
|
706
|
+
$item.Tag = $line
|
|
707
|
+
$item.Enabled = -not $PT.leaving.ContainsKey($space)
|
|
708
|
+
$item.add_Click({ param($s, $e) try { $s.Enabled = $false; Start-Leave ([string]$s.Name) ([string]$s.Tag) } catch { Write-TrayLog ('menu: ' + $_.Exception.Message) } })
|
|
709
|
+
[void]$PT.menu.Items.Add($item)
|
|
710
|
+
}
|
|
711
|
+
|
|
659
712
|
function global:Build-Menu {
|
|
660
713
|
$menu = $PT.menu
|
|
661
714
|
$s = $PT.state
|
|
@@ -669,6 +722,9 @@ function global:Build-Menu {
|
|
|
669
722
|
# Not greyed out: a click opens status, which says it in full with the fix.
|
|
670
723
|
# The heading already says it cannot run (when nothing else needs you): the row says why, and the fix.
|
|
671
724
|
if ($s.agentProblem) { Add-MenuItem $(if ($s.need -eq 0) { $s.agentProblem } else { $s.agentProblemLead + ': ' + $s.agentProblem }) { Open-PantheonConsole 'Pantheon status' 'status' } $true }
|
|
725
|
+
$gone = @($s.gone)
|
|
726
|
+
foreach ($g in ($gone | Select-Object -First $PT.goneShown)) { Add-GoneItem ($g.line + ' ' + $PT.dot + ' Remove from this computer') $g.space $g.line }
|
|
727
|
+
if ($gone.Count -gt $PT.goneShown) { Add-MenuItem ('and ' + ($gone.Count - $PT.goneShown) + ' more gone ' + $PT.dash + ' Open board') { Open-Board } }
|
|
672
728
|
[void]$menu.Items.Add((New-Object System.Windows.Forms.ToolStripSeparator))
|
|
673
729
|
Add-MenuItem 'Open board' { Open-Board } $true
|
|
674
730
|
[void]$menu.Items.Add((New-Object System.Windows.Forms.ToolStripSeparator))
|
|
@@ -733,6 +789,7 @@ $PT.timer.add_Tick({
|
|
|
733
789
|
if ($PT.notices) { Show-QueuedNotices }
|
|
734
790
|
Watch-Check
|
|
735
791
|
Watch-Board
|
|
792
|
+
Watch-Leaving
|
|
736
793
|
if ($null -eq $PT.check -and (Get-Date) -ge $PT.nextCheck) {
|
|
737
794
|
$PT.nextCheck = (Get-Date).AddSeconds($PT.poll)
|
|
738
795
|
Start-Check
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@join-pantheon/cli",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.10-rc.1",
|
|
4
4
|
"description": "Let your coding agent collaborate directly with your teammates' agents — ask, agree an interface, and deliver, without a human relaying messages.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|