@join-pantheon/cli 0.34.0-rc.1 → 0.34.1-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/admin-founder.js +179 -0
- package/dist/admin-pages.js +249 -116
- package/dist/admin-ui.js +149 -73
- package/dist/board.js +30 -3
- package/dist/claude-confine.js +3 -2
- package/dist/cli.js +75 -5
- package/dist/client.js +31 -3
- package/dist/config.js +21 -0
- package/dist/conn-report.js +148 -0
- package/dist/doctor.js +13 -0
- package/dist/flow-stats.js +21 -18
- package/dist/founder-stats.js +203 -0
- package/dist/goal-flow.js +218 -0
- package/dist/home-safety.js +2 -0
- package/dist/machine.js +95 -2
- package/dist/mcp.js +6 -0
- package/dist/notifier.js +166 -101
- package/dist/power.js +66 -0
- package/dist/readiness-alert.js +16 -3
- package/dist/relay.js +303 -23
- package/dist/spend.js +24 -1
- package/dist/status-engine.js +222 -0
- package/dist/status-nudge.js +34 -0
- package/dist/tray.js +57 -7
- package/dist/viewer-pages.js +36 -29
- package/dist/win-host.js +79 -7
- package/dist/worker.js +17 -8
- package/helper/macos/main.swift +45 -12
- package/helper/macos/menubar.swift +409 -67
- package/helper/macos/prebuilt/manifest.json +6 -6
- package/helper/macos/prebuilt/pantheon-hud +0 -0
- package/helper/macos/prebuilt/pantheon-tray +0 -0
- package/helper/windows/pantheon-tray.ps1 +216 -15
- package/package.json +1 -1
package/dist/notifier.js
CHANGED
|
@@ -16,6 +16,9 @@ import { wakeAlerted } from "./continued.js";
|
|
|
16
16
|
import { cliOnPath, detectAvailable } from "./agents.js";
|
|
17
17
|
import { CLAUDE_APP_TOOL, chosenOpenIn, claudeAppPresent, effectiveOpenIn } from "./open-in.js";
|
|
18
18
|
import { whichPantheon } from "./service.js";
|
|
19
|
+
import { powerNow } from "./power.js";
|
|
20
|
+
import { obligationSignature, StatusNudger } from "./status-nudge.js";
|
|
21
|
+
import { clientState, ConnectionReport } from "./conn-report.js";
|
|
19
22
|
import { removalFor, removalHolds, removalRefusal, removalWords, removedLine, removedNotice, takeTold } from "./removed.js";
|
|
20
23
|
export const DEFAULT_REMINDER_MS = 4 * 60 * 60 * 1_000;
|
|
21
24
|
export const PASSED_OVER_EVERY_MS = 3_600_000;
|
|
@@ -84,7 +87,7 @@ export function ensureNativeNotifier(home = CONFIG_DIR, deps = {}) {
|
|
|
84
87
|
}
|
|
85
88
|
export function notifierStale(home = CONFIG_DIR) { return helperStale(hudBinaryPath(home), hudSourcePath()); }
|
|
86
89
|
export { requireDeveloperTools } from "./helpers-build.js";
|
|
87
|
-
export function
|
|
90
|
+
export function installedCliTools() {
|
|
88
91
|
const seen = new Set();
|
|
89
92
|
const out = [];
|
|
90
93
|
for (const { backend } of detectAvailable()) {
|
|
@@ -96,6 +99,42 @@ export function installedTools() {
|
|
|
96
99
|
}
|
|
97
100
|
if (cliOnPath("grok") && !seen.has("grok"))
|
|
98
101
|
out.push({ id: "grok", label: TOOL_LABELS["grok"], kind: "cli" });
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
export class CliToolsSnapshot {
|
|
105
|
+
o;
|
|
106
|
+
tools = null;
|
|
107
|
+
timer = null;
|
|
108
|
+
constructor(o = {}) {
|
|
109
|
+
this.o = o;
|
|
110
|
+
}
|
|
111
|
+
get() {
|
|
112
|
+
if (!this.tools)
|
|
113
|
+
this.look();
|
|
114
|
+
return this.tools;
|
|
115
|
+
}
|
|
116
|
+
start() {
|
|
117
|
+
if (this.timer)
|
|
118
|
+
return;
|
|
119
|
+
const every = this.o.everyMs?.() ?? CLI_TOOLS_EVERY_MS.ac;
|
|
120
|
+
this.timer = setTimeout(() => { this.timer = null; this.look(); this.start(); }, every);
|
|
121
|
+
this.timer.unref?.();
|
|
122
|
+
}
|
|
123
|
+
stop() { if (this.timer)
|
|
124
|
+
clearTimeout(this.timer); this.timer = null; }
|
|
125
|
+
look() {
|
|
126
|
+
try {
|
|
127
|
+
this.tools = (this.o.lookup ?? installedCliTools)();
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
this.tools ??= [];
|
|
131
|
+
this.o.log?.(`! could not list the agent CLIs: ${e.message.split("\n")[0]}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
export const CLI_TOOLS_EVERY_MS = { ac: 10 * 60_000, battery: 30 * 60_000 };
|
|
136
|
+
export function installedTools(cli = installedCliTools()) {
|
|
137
|
+
const out = [...cli];
|
|
99
138
|
if (platform() === "darwin") {
|
|
100
139
|
const APP_PATHS = {
|
|
101
140
|
"cursor-app": ["/Applications/Cursor.app", join(homedir(), "Applications", "Cursor.app")],
|
|
@@ -206,129 +245,155 @@ export class HumanNotifier {
|
|
|
206
245
|
if (this.stopped)
|
|
207
246
|
return;
|
|
208
247
|
const client = new PantheonClient(this.cfg, undefined, { role: "cli" });
|
|
209
|
-
|
|
248
|
+
const nudger = this.opts.nudger ?? new StatusNudger();
|
|
249
|
+
const report = new ConnectionReport({ role: "notifier", space: this.cfg.space });
|
|
250
|
+
report.observe("down");
|
|
251
|
+
client.onChange = () => { nudger.observe(obligationSignature(client.obligations, client.connected)); report.observe(clientState(client)); };
|
|
252
|
+
try {
|
|
253
|
+
await client.connect();
|
|
254
|
+
}
|
|
255
|
+
catch (e) {
|
|
256
|
+
client.close();
|
|
257
|
+
report.close();
|
|
258
|
+
throw e;
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
await this.serve(client);
|
|
262
|
+
}
|
|
263
|
+
finally {
|
|
264
|
+
client.close();
|
|
265
|
+
report.close();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
async serve(client) {
|
|
210
269
|
const stateFile = this.opts.stateFile ?? join(CONFIG_DIR, "notifier-state.json");
|
|
211
270
|
const now = this.opts.now ?? Date.now;
|
|
212
271
|
const send = this.opts.send ?? sendDesktopNotification;
|
|
213
272
|
const pollMs = this.opts.pollMs ?? 5_000;
|
|
214
273
|
let state = readState(stateFile);
|
|
274
|
+
const cliTools = this.opts.cliTools ?? new CliToolsSnapshot({ everyMs: () => CLI_TOOLS_EVERY_MS[powerNow()], log: this.opts.log });
|
|
275
|
+
cliTools.start();
|
|
215
276
|
this.opts.log(`notifier online as ${this.cfg.member}`);
|
|
216
277
|
this.opts.log(` reminders after ${Math.round(this.opts.reminderMs / 60_000)} minutes, then doubling to daily, ${MAX_REMINDERS} at most — after that a decision waits on pantheon brief and the menu bar`);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
removedSaid
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
else if (!client.removedFrom)
|
|
231
|
-
removedSaid = false;
|
|
232
|
-
const pruned = pruneNotificationState(state, client.obligations, this.cfg.member, now());
|
|
233
|
-
let dirty = JSON.stringify(pruned) !== JSON.stringify(state);
|
|
234
|
-
state = pruned;
|
|
235
|
-
const profile = loadProfile(this.cfg);
|
|
236
|
-
const prefs = profile.notifications ?? { decisions: true, deliveries: false, worker_done: false };
|
|
237
|
-
const due = prefs.decisions
|
|
238
|
-
? dueHumanObligations(client.obligations, this.cfg.member, state, now(), this.opts.reminderMs)
|
|
239
|
-
: [];
|
|
240
|
-
const tools = installedTools();
|
|
241
|
-
const peerOf = (from) => from ? { member: from, agent: client.roster.find((m) => m.id === from)?.agent } : undefined;
|
|
242
|
-
const withLabel = (n) => {
|
|
243
|
-
const labelled = this.opts.label ? { ...n, context: n.context ? `${this.opts.label} · ${n.context}` : this.opts.label } : n;
|
|
244
|
-
return { ...labelled, space: this.cfg.space };
|
|
245
|
-
};
|
|
246
|
-
let asks = {};
|
|
247
|
-
try {
|
|
248
|
-
asks = this.opts.wakeAsks ? this.opts.wakeAsks() : loadPolicy().wakeAsks ?? {};
|
|
249
|
-
}
|
|
250
|
-
catch {
|
|
251
|
-
asks = {};
|
|
252
|
-
}
|
|
253
|
-
for (const obligation of due) {
|
|
254
|
-
const isReminder = state.notified_at[obligation.id] !== undefined;
|
|
255
|
-
const act = client.seenAct(obligation.ref);
|
|
256
|
-
if (neverAlerts(act)) {
|
|
257
|
-
state.notified_at[obligation.id] = now();
|
|
258
|
-
dirty = true;
|
|
259
|
-
continue;
|
|
278
|
+
try {
|
|
279
|
+
let removedSaid = false;
|
|
280
|
+
while (!this.stopped) {
|
|
281
|
+
if (client.removedFrom && !removedSaid) {
|
|
282
|
+
removedSaid = true;
|
|
283
|
+
const team = { space: this.cfg.space, spaceId: this.cfg.spaceId ?? null, relay: this.cfg.relay, member: this.cfg.member };
|
|
284
|
+
const r = removalWords(team, client.removedFrom.by);
|
|
285
|
+
this.opts.log(`! ${removedLine(r)}`);
|
|
286
|
+
try {
|
|
287
|
+
if (takeTold(team))
|
|
288
|
+
await send(removedNotice(r));
|
|
289
|
+
}
|
|
290
|
+
catch { }
|
|
260
291
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
292
|
+
else if (!client.removedFrom)
|
|
293
|
+
removedSaid = false;
|
|
294
|
+
const pruned = pruneNotificationState(state, client.obligations, this.cfg.member, now());
|
|
295
|
+
let dirty = JSON.stringify(pruned) !== JSON.stringify(state);
|
|
296
|
+
state = pruned;
|
|
297
|
+
const profile = loadProfile(this.cfg);
|
|
298
|
+
const prefs = profile.notifications ?? { decisions: true, deliveries: false, worker_done: false };
|
|
299
|
+
const due = prefs.decisions
|
|
300
|
+
? dueHumanObligations(client.obligations, this.cfg.member, state, now(), this.opts.reminderMs)
|
|
301
|
+
: [];
|
|
302
|
+
const tools = installedTools(cliTools.get());
|
|
303
|
+
const peerOf = (from) => from ? { member: from, agent: client.roster.find((m) => m.id === from)?.agent } : undefined;
|
|
304
|
+
const withLabel = (n) => {
|
|
305
|
+
const labelled = this.opts.label ? { ...n, context: n.context ? `${this.opts.label} · ${n.context}` : this.opts.label } : n;
|
|
306
|
+
return { ...labelled, space: this.cfg.space };
|
|
307
|
+
};
|
|
308
|
+
let asks = {};
|
|
309
|
+
try {
|
|
310
|
+
asks = this.opts.wakeAsks ? this.opts.wakeAsks() : loadPolicy().wakeAsks ?? {};
|
|
264
311
|
}
|
|
265
312
|
catch {
|
|
266
|
-
|
|
267
|
-
} };
|
|
268
|
-
if (wake && !isReminder && workerSaid(wake)) {
|
|
269
|
-
state.notified_at[obligation.id] = now();
|
|
270
|
-
dirty = true;
|
|
271
|
-
this.opts.log(`> ${obligation.id}: the worker alerted this one itself (may ${wake.member} start work here)`);
|
|
272
|
-
continue;
|
|
273
|
-
}
|
|
274
|
-
const notice = wake
|
|
275
|
-
? withLabel(composeWakeAsk({ member: wake.member, what: wakeAskWhat(act?.body ?? obligation.body), space: this.opts.label ? "" : this.cfg.space, focus: obligation.ref, mac: platform() === "darwin" }))
|
|
276
|
-
: withLabel(composeDecision(obligation, act, obligation.goal ? client.goals.get(obligation.goal) : undefined, peerOf(act?.from), { tools, preferred: preferredTool(profile, tools), now: now(), member: this.cfg.member }));
|
|
277
|
-
const ok = await send(notice);
|
|
278
|
-
if (ok) {
|
|
279
|
-
state.notified_at[obligation.id] = now();
|
|
280
|
-
if (isReminder)
|
|
281
|
-
state.reminded = { ...(state.reminded ?? {}), [obligation.id]: (state.reminded?.[obligation.id] ?? 0) + 1 };
|
|
282
|
-
dirty = true;
|
|
283
|
-
this.opts.log(`> ${isReminder ? `reminder ${state.reminded[obligation.id]}/${MAX_REMINDERS}` : "notified"} for ${obligation.id} (${oneLine(obligation.body, 100)})`);
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
this.opts.log(`! could not show a desktop notification for ${obligation.id}`);
|
|
313
|
+
asks = {};
|
|
287
314
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if (!passedOverNotice(r, this.cfg.member) || state.notified_at[`act:${r.id}`])
|
|
315
|
+
for (const obligation of due) {
|
|
316
|
+
const isReminder = state.notified_at[obligation.id] !== undefined;
|
|
317
|
+
const act = client.seenAct(obligation.ref);
|
|
318
|
+
if (neverAlerts(act)) {
|
|
319
|
+
state.notified_at[obligation.id] = now();
|
|
320
|
+
dirty = true;
|
|
295
321
|
continue;
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
322
|
+
}
|
|
323
|
+
const wake = asks[obligation.ref];
|
|
324
|
+
const workerSaid = (w) => { try {
|
|
325
|
+
return this.opts.wakeAlerted ? this.opts.wakeAlerted(w, obligation.ref) : wakeAlerted(w.team, w.member, obligation.ref);
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
return false;
|
|
329
|
+
} };
|
|
330
|
+
if (wake && !isReminder && workerSaid(wake)) {
|
|
331
|
+
state.notified_at[obligation.id] = now();
|
|
332
|
+
dirty = true;
|
|
333
|
+
this.opts.log(`> ${obligation.id}: the worker alerted this one itself (may ${wake.member} start work here)`);
|
|
303
334
|
continue;
|
|
304
335
|
}
|
|
305
|
-
const
|
|
306
|
-
|
|
336
|
+
const notice = wake
|
|
337
|
+
? withLabel(composeWakeAsk({ member: wake.member, what: wakeAskWhat(act?.body ?? obligation.body), space: this.opts.label ? "" : this.cfg.space, focus: obligation.ref, mac: platform() === "darwin" }))
|
|
338
|
+
: withLabel(composeDecision(obligation, act, obligation.goal ? client.goals.get(obligation.goal) : undefined, peerOf(act?.from), { tools, preferred: preferredTool(profile, tools), now: now(), member: this.cfg.member }));
|
|
339
|
+
const ok = await send(notice);
|
|
307
340
|
if (ok) {
|
|
308
|
-
state.notified_at[
|
|
309
|
-
|
|
341
|
+
state.notified_at[obligation.id] = now();
|
|
342
|
+
if (isReminder)
|
|
343
|
+
state.reminded = { ...(state.reminded ?? {}), [obligation.id]: (state.reminded?.[obligation.id] ?? 0) + 1 };
|
|
344
|
+
dirty = true;
|
|
345
|
+
this.opts.log(`> ${isReminder ? `reminder ${state.reminded[obligation.id]}/${MAX_REMINDERS}` : "notified"} for ${obligation.id} (${oneLine(obligation.body, 100)})`);
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
this.opts.log(`! could not show a desktop notification for ${obligation.id}`);
|
|
310
349
|
}
|
|
311
|
-
writeState(stateFile, state);
|
|
312
350
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
if (!forMe)
|
|
321
|
-
continue;
|
|
322
|
-
const ok = await send(withLabel(composeDelivery(r, goal, peerOf(r.from), { tools, preferred: preferredTool(profile, tools), now: now() })));
|
|
323
|
-
if (ok) {
|
|
351
|
+
if (dirty || !existsSync(stateFile))
|
|
352
|
+
writeState(stateFile, state);
|
|
353
|
+
const arrived = await client.next(pollMs);
|
|
354
|
+
if (prefs.decisions) {
|
|
355
|
+
for (const r of arrived) {
|
|
356
|
+
if (!passedOverNotice(r, this.cfg.member) || state.notified_at[`act:${r.id}`])
|
|
357
|
+
continue;
|
|
324
358
|
state.notified_at[`act:${r.id}`] = now();
|
|
359
|
+
const g = r.meta?.goal;
|
|
360
|
+
const key = `act:passed:${typeof g === "string" ? g : r.ref ?? r.id}`;
|
|
361
|
+
const last = state.notified_at[key];
|
|
362
|
+
if (last !== undefined && now() - last < PASSED_OVER_EVERY_MS) {
|
|
363
|
+
this.opts.log(`> passed over again on ${key.slice("act:passed:".length)} — said within the hour, not alerted`);
|
|
364
|
+
writeState(stateFile, state);
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
const focus = client.obligations.find((o) => o.ref === r.ref)?.id;
|
|
368
|
+
const ok = await send(withLabel(composePassedOver(r, focus, now())));
|
|
369
|
+
if (ok) {
|
|
370
|
+
state.notified_at[key] = now();
|
|
371
|
+
this.opts.log(`> passed-over alert for ${r.ref ?? r.id}`);
|
|
372
|
+
}
|
|
325
373
|
writeState(stateFile, state);
|
|
326
|
-
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
if (prefs.deliveries) {
|
|
377
|
+
for (const r of arrived) {
|
|
378
|
+
if (r.act !== "DELIVERED" || neverAlerts(r) || r.from === this.cfg.member || state.notified_at[`act:${r.id}`])
|
|
379
|
+
continue;
|
|
380
|
+
const goal = r.goal ? client.goals.get(r.goal) : undefined;
|
|
381
|
+
const forMe = r.to?.length ? r.to.includes(this.cfg.member) : (goal?.members.includes(this.cfg.member) ?? false);
|
|
382
|
+
if (!forMe)
|
|
383
|
+
continue;
|
|
384
|
+
const ok = await send(withLabel(composeDelivery(r, goal, peerOf(r.from), { tools, preferred: preferredTool(profile, tools), now: now() })));
|
|
385
|
+
if (ok) {
|
|
386
|
+
state.notified_at[`act:${r.id}`] = now();
|
|
387
|
+
writeState(stateFile, state);
|
|
388
|
+
this.opts.log(`> delivery alert for ${r.id} from ${r.from}`);
|
|
389
|
+
}
|
|
327
390
|
}
|
|
328
391
|
}
|
|
329
392
|
}
|
|
330
393
|
}
|
|
331
|
-
|
|
394
|
+
finally {
|
|
395
|
+
cliTools.stop();
|
|
396
|
+
}
|
|
332
397
|
}
|
|
333
398
|
}
|
|
334
399
|
export async function runNotifiers(teams, o) {
|
package/dist/power.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { platform } from "node:os";
|
|
5
|
+
export const POLL_MS = { ac: 15_000, battery: 60_000 };
|
|
6
|
+
export function powerFromSys(dir = "/sys/class/power_supply") {
|
|
7
|
+
let names;
|
|
8
|
+
try {
|
|
9
|
+
names = readdirSync(dir);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return "ac";
|
|
13
|
+
}
|
|
14
|
+
const read = (n, f) => { try {
|
|
15
|
+
return readFileSync(join(dir, n, f), "utf8").trim();
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return "";
|
|
19
|
+
} };
|
|
20
|
+
let mainsOnline = false, discharging = false;
|
|
21
|
+
for (const n of names.slice(0, 32)) {
|
|
22
|
+
const type = read(n, "type");
|
|
23
|
+
if (type === "Mains" || type === "USB" || type === "USB_C" || type === "USB_PD") {
|
|
24
|
+
if (read(n, "online") === "1")
|
|
25
|
+
mainsOnline = true;
|
|
26
|
+
}
|
|
27
|
+
else if (type === "Battery") {
|
|
28
|
+
if (read(n, "scope") === "Device")
|
|
29
|
+
continue;
|
|
30
|
+
if (read(n, "status") === "Discharging")
|
|
31
|
+
discharging = true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (mainsOnline)
|
|
35
|
+
return "ac";
|
|
36
|
+
return discharging ? "battery" : "ac";
|
|
37
|
+
}
|
|
38
|
+
export function powerFromPmset(out, lowPower = false) {
|
|
39
|
+
if (lowPower)
|
|
40
|
+
return "battery";
|
|
41
|
+
return /drawing from 'Battery Power'/i.test(out) ? "battery" : "ac";
|
|
42
|
+
}
|
|
43
|
+
let cached = null;
|
|
44
|
+
let asking = false;
|
|
45
|
+
export function powerNow(o = {}) {
|
|
46
|
+
const plat = o.platform ?? platform();
|
|
47
|
+
const now = o.now ?? Date.now();
|
|
48
|
+
if (plat === "linux") {
|
|
49
|
+
if (!cached || now - cached.at > 60_000)
|
|
50
|
+
cached = { at: now, power: powerFromSys(o.sysDir) };
|
|
51
|
+
return cached.power;
|
|
52
|
+
}
|
|
53
|
+
if (plat === "darwin") {
|
|
54
|
+
if ((!cached || now - cached.at > 120_000) && !asking) {
|
|
55
|
+
asking = true;
|
|
56
|
+
execFile("/usr/bin/pmset", ["-g", "ps"], { timeout: 5_000 }, (err, out) => {
|
|
57
|
+
asking = false;
|
|
58
|
+
cached = { at: Date.now(), power: err ? (cached?.power ?? "ac") : powerFromPmset(String(out)) };
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return cached?.power ?? "ac";
|
|
62
|
+
}
|
|
63
|
+
return "ac";
|
|
64
|
+
}
|
|
65
|
+
export function resetPowerCache() { cached = null; asking = false; }
|
|
66
|
+
//# sourceMappingURL=power.js.map
|
package/dist/readiness-alert.js
CHANGED
|
@@ -80,7 +80,9 @@ export function composeReadinessAlert(code, agent, o = {}) {
|
|
|
80
80
|
return {
|
|
81
81
|
...base,
|
|
82
82
|
heading: "Your agent is signed out",
|
|
83
|
-
body: fit(
|
|
83
|
+
body: fit(os === "win32"
|
|
84
|
+
? `${label(a)} is signed out, so teammates' requests wait. ${openShell(os)}, ${signInSteps(a)}.`
|
|
85
|
+
: `${label(a)} is signed out, so teammates' requests are waiting. Click Sign in — it takes a minute.`, BUDGET.body),
|
|
84
86
|
...button({ label: "Sign in", kind: "sign_in", agent: a, dir: o.signInDir ?? homedir(), lines: [SIGN_IN_LINE[a]], why: `${label(a)} is signed out, so teammates' requests wait` }),
|
|
85
87
|
};
|
|
86
88
|
}
|
|
@@ -430,6 +432,10 @@ export function forgetReadinessTeam(home, teams) {
|
|
|
430
432
|
}
|
|
431
433
|
export function forgetReadinessAlerts() { byHome.clear(); }
|
|
432
434
|
export function agentProblem(home, now = Date.now(), os = platform()) {
|
|
435
|
+
const first = stuckReading(home, now);
|
|
436
|
+
return first ? problemLine(first.code, first.agent, os) : null;
|
|
437
|
+
}
|
|
438
|
+
function stuckReading(home, now) {
|
|
433
439
|
let text = null;
|
|
434
440
|
try {
|
|
435
441
|
text = readStateFile(join(home, READINESS_ALERT_FILE));
|
|
@@ -439,7 +445,14 @@ export function agentProblem(home, now = Date.now(), os = platform()) {
|
|
|
439
445
|
}
|
|
440
446
|
const s = parseState(text, now);
|
|
441
447
|
const stuck = Object.keys(s.teams).sort().map((k) => s.teams[k].confirmed).filter((v) => !!v && now - v.at < FRESH_MS && !v.ok && !!v.code && PERSON_CODES.has(v.code));
|
|
442
|
-
|
|
443
|
-
|
|
448
|
+
return (s.told && stuck.find((v) => keyOf(v) === keyOf(s.told))) || stuck[0] || null;
|
|
449
|
+
}
|
|
450
|
+
export function agentProblemFix(home, now = Date.now()) {
|
|
451
|
+
const first = stuckReading(home, now);
|
|
452
|
+
if (!first)
|
|
453
|
+
return null;
|
|
454
|
+
if (first.code === "not_signed_in")
|
|
455
|
+
return { kind: "sign_in", label: "Sign in", agent: first.agent ?? "claude-code" };
|
|
456
|
+
return { kind: "how", label: "Show me how", ...(first.agent ? { agent: first.agent } : {}) };
|
|
444
457
|
}
|
|
445
458
|
//# sourceMappingURL=readiness-alert.js.map
|