@phnx-labs/agents-cli 1.22.127 → 1.23.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/CHANGELOG.md +108 -0
- package/README.md +15 -16
- package/dist/bootstrap.js +4 -3
- package/dist/commands/browser.js +4 -19
- package/dist/commands/cloud-transcripts.js +1 -2
- package/dist/commands/computer.d.ts +2 -6
- package/dist/commands/computer.js +12 -18
- package/dist/commands/daemon.js +70 -11
- package/dist/commands/exec.js +1 -1
- package/dist/commands/feed.js +1 -2
- package/dist/commands/focus.js +4 -1
- package/dist/commands/go.js +3 -2
- package/dist/commands/logs.js +3 -7
- package/dist/commands/menubar.js +55 -3
- package/dist/commands/projects.js +103 -40
- package/dist/commands/ps-roster.d.ts +0 -11
- package/dist/commands/ps-roster.js +3 -116
- package/dist/commands/ps.d.ts +10 -0
- package/dist/commands/ps.js +182 -1
- package/dist/commands/resume.js +1 -1
- package/dist/commands/sessions-browser.d.ts +0 -1
- package/dist/commands/sessions-browser.js +6 -23
- package/dist/commands/sessions-export.js +1 -1
- package/dist/commands/sessions-migrate.js +1 -1
- package/dist/commands/sessions-picker.d.ts +6 -32
- package/dist/commands/sessions-picker.js +81 -8
- package/dist/commands/sessions-render.js +1 -1
- package/dist/commands/sessions-resume.js +2 -2
- package/dist/commands/sessions-share.js +1 -1
- package/dist/commands/sessions-trace.js +1 -1
- package/dist/commands/sessions.d.ts +2 -176
- package/dist/commands/sessions.js +44 -1577
- package/dist/index.js +10 -11
- package/dist/lib/browser-client.d.ts +0 -21
- package/dist/lib/browser-client.js +1 -44
- package/dist/lib/computer/record.d.ts +1 -0
- package/dist/lib/computer/record.js +2 -16
- package/dist/lib/config-keys.d.ts +2 -2
- package/dist/lib/config-keys.js +8 -2
- package/dist/lib/daemon/account-state-daemon-service.d.ts +2 -2
- package/dist/lib/daemon/account-state-daemon-service.js +2 -2
- package/dist/lib/daemon/attention-notify-service.js +8 -4
- package/dist/lib/daemon/daemon.d.ts +5 -1
- package/dist/lib/daemon/daemon.js +54 -14
- package/dist/lib/daemon/diagnostics.d.ts +70 -0
- package/dist/lib/daemon/diagnostics.js +185 -0
- package/dist/lib/daemon/runner.js +3 -2
- package/dist/lib/daemon/service.d.ts +1 -1
- package/dist/lib/daemon/session-state-service.d.ts +1 -1
- package/dist/lib/daemon/session-state-service.js +2 -2
- package/dist/lib/daemon/supervisor.d.ts +8 -0
- package/dist/lib/daemon/supervisor.js +47 -6
- package/dist/lib/daemon-services.d.ts +4 -1
- package/dist/lib/daemon-services.js +36 -5
- package/dist/lib/daemon-ticks.d.ts +3 -1
- package/dist/lib/daemon-ticks.js +18 -12
- package/dist/lib/device-config.d.ts +1 -1
- package/dist/lib/device-config.js +48 -7
- package/dist/lib/feed/tool-activity.d.ts +22 -10
- package/dist/lib/feed/tool-activity.js +168 -32
- package/dist/lib/feed/tools.d.ts +55 -2
- package/dist/lib/feed/tools.js +22 -28
- package/dist/lib/feed/watch.js +12 -8
- package/dist/lib/github/open-prs.d.ts +41 -0
- package/dist/lib/github/open-prs.js +157 -0
- package/dist/lib/github/project-prs.d.ts +20 -1
- package/dist/lib/github/project-prs.js +8 -7
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/menubar/install-menubar.d.ts +23 -7
- package/dist/lib/menubar/install-menubar.js +179 -30
- package/dist/lib/menubar/resolve-version.d.ts +1 -0
- package/dist/lib/menubar/resolve-version.js +4 -2
- package/dist/lib/menubar/snapshot.d.ts +2 -0
- package/dist/lib/menubar/snapshot.js +2 -0
- package/dist/lib/menubar/update-state.d.ts +15 -0
- package/dist/lib/menubar/update-state.js +36 -0
- package/dist/lib/owner-notify.d.ts +0 -12
- package/dist/lib/owner-notify.js +1 -10
- package/dist/lib/self-heal/checks/menubar-helper.js +1 -0
- package/dist/lib/session/active.js +18 -14
- package/dist/lib/session/cloud.d.ts +0 -1
- package/dist/lib/session/cloud.js +0 -5
- package/dist/lib/session/db.d.ts +0 -64
- package/dist/lib/session/db.js +0 -116
- package/dist/lib/session/pid-registry.js +9 -6
- package/dist/lib/session/presentation.d.ts +107 -1
- package/dist/lib/session/presentation.js +543 -4
- package/dist/lib/session/remote/remote-list.d.ts +5 -36
- package/dist/lib/session/remote/remote-list.js +16 -320
- package/dist/lib/session/resume-command.d.ts +9 -0
- package/dist/lib/session/resume-command.js +107 -0
- package/dist/lib/session/selection.d.ts +102 -0
- package/dist/lib/session/selection.js +443 -0
- package/dist/lib/session/tool-index.d.ts +0 -62
- package/dist/lib/session/tool-index.js +1 -537
- package/dist/lib/sessions-client.d.ts +1 -0
- package/dist/lib/sessions-client.js +17 -1
- package/dist/lib/standalone-tools.js +2 -2
- package/dist/lib/testdata/owner-notify-api.d.ts +0 -13
- package/dist/lib/testdata/owner-notify-api.js +3 -23
- package/package.json +1 -1
- package/dist/commands/browser-sessions-picker.d.ts +0 -9
- package/dist/commands/browser-sessions-picker.js +0 -136
- package/dist/commands/computer-sessions-picker.d.ts +0 -11
- package/dist/commands/computer-sessions-picker.js +0 -90
- package/dist/commands/sessions-tail.d.ts +0 -13
- package/dist/commands/sessions-tail.js +0 -222
- package/dist/lib/browser/native-history.test-fixture.d.ts +0 -12
- package/dist/lib/browser/native-history.test-fixture.js +0 -43
- package/dist/lib/browser/paths.d.ts +0 -9
- package/dist/lib/browser/paths.js +0 -31
- package/dist/lib/browser/record.d.ts +0 -4
- package/dist/lib/browser/record.js +0 -19
- package/dist/lib/browser/sessions-list.d.ts +0 -79
- package/dist/lib/browser/sessions-list.js +0 -415
- package/dist/lib/computer/sessions-list.d.ts +0 -78
- package/dist/lib/computer/sessions-list.js +0 -372
- package/dist/lib/daemon/owner-device-delivery-service.d.ts +0 -10
- package/dist/lib/daemon/owner-device-delivery-service.js +0 -28
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import * as os from 'os';
|
|
2
|
+
import { monitorEventLoopDelay, performance } from 'perf_hooks';
|
|
3
|
+
export const LOG_LEVELS = ['DEBUG', 'INFO', 'WARN', 'ERROR'];
|
|
4
|
+
const LEVEL_RANK = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
|
|
5
|
+
export function parseLogLevel(raw) {
|
|
6
|
+
if (typeof raw !== 'string')
|
|
7
|
+
return undefined;
|
|
8
|
+
const upper = raw.trim().toUpperCase();
|
|
9
|
+
return LOG_LEVELS.includes(upper) ? upper : undefined;
|
|
10
|
+
}
|
|
11
|
+
export function levelRank(level) {
|
|
12
|
+
if (level.toUpperCase() === 'FATAL')
|
|
13
|
+
return LEVEL_RANK.ERROR;
|
|
14
|
+
return LEVEL_RANK[parseLogLevel(level) ?? 'INFO'];
|
|
15
|
+
}
|
|
16
|
+
export function levelEnabled(level, threshold) {
|
|
17
|
+
return levelRank(level) >= LEVEL_RANK[threshold];
|
|
18
|
+
}
|
|
19
|
+
const SPAN_RING_SIZE = 256;
|
|
20
|
+
const SYNC_RING_FLOOR_MS = 5;
|
|
21
|
+
const SLOW_SYNC_SPAN_MS = 250;
|
|
22
|
+
const spans = { syncRing: [], window: new Map(), log: null, slowSyncMs: SLOW_SYNC_SPAN_MS };
|
|
23
|
+
export function installSpanLog(log, opts = {}) {
|
|
24
|
+
spans.log = log;
|
|
25
|
+
spans.slowSyncMs = opts.slowSyncMs ?? SLOW_SYNC_SPAN_MS;
|
|
26
|
+
spans.syncRing = [];
|
|
27
|
+
spans.window = new Map();
|
|
28
|
+
}
|
|
29
|
+
function safeLog(level, message, fields) {
|
|
30
|
+
try {
|
|
31
|
+
spans.log?.(level, message, fields);
|
|
32
|
+
}
|
|
33
|
+
catch { }
|
|
34
|
+
}
|
|
35
|
+
function record(rec) {
|
|
36
|
+
if (!spans.log)
|
|
37
|
+
return;
|
|
38
|
+
if (rec.kind === 'sync' && rec.durMs >= SYNC_RING_FLOOR_MS) {
|
|
39
|
+
spans.syncRing.push(rec);
|
|
40
|
+
if (spans.syncRing.length > SPAN_RING_SIZE)
|
|
41
|
+
spans.syncRing.splice(0, spans.syncRing.length - SPAN_RING_SIZE);
|
|
42
|
+
}
|
|
43
|
+
const key = `${rec.kind}:${rec.name}`;
|
|
44
|
+
const agg = spans.window.get(key) ?? { name: rec.name, kind: rec.kind, count: 0, totalMs: 0, maxMs: 0 };
|
|
45
|
+
agg.count += 1;
|
|
46
|
+
agg.totalMs += rec.durMs;
|
|
47
|
+
agg.maxMs = Math.max(agg.maxMs, rec.durMs);
|
|
48
|
+
spans.window.set(key, agg);
|
|
49
|
+
const fields = { span: rec.name, kind: rec.kind, durMs: Math.round(rec.durMs), ...rec.fields };
|
|
50
|
+
if (rec.kind === 'sync' && rec.durMs >= spans.slowSyncMs) {
|
|
51
|
+
safeLog('WARN', `slow synchronous section '${rec.name}' blocked the event loop for ${Math.round(rec.durMs)}ms`, { event: 'span.slow', ...fields });
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
safeLog('DEBUG', `span '${rec.name}' ${Math.round(rec.durMs)}ms`, { event: 'span', ...fields });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function spanSync(name, fn, fields) {
|
|
58
|
+
if (!spans.log)
|
|
59
|
+
return fn();
|
|
60
|
+
const startMs = performance.now();
|
|
61
|
+
try {
|
|
62
|
+
return fn();
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
record({ name, kind: 'sync', startMs, durMs: performance.now() - startMs, fields: fields?.() });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export async function span(name, fn, fields) {
|
|
69
|
+
if (!spans.log)
|
|
70
|
+
return fn();
|
|
71
|
+
const startMs = performance.now();
|
|
72
|
+
try {
|
|
73
|
+
return await fn();
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
record({ name, kind: 'async', startMs, durMs: performance.now() - startMs, fields: fields?.() });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function syncSpansBetween(fromMs, toMs) {
|
|
80
|
+
return spans.syncRing.filter((r) => r.startMs + r.durMs >= fromMs && r.startMs <= toMs);
|
|
81
|
+
}
|
|
82
|
+
export function topSpansSinceReport(limit) {
|
|
83
|
+
return [...spans.window.values()]
|
|
84
|
+
.sort((a, b) => b.totalMs - a.totalMs)
|
|
85
|
+
.slice(0, limit)
|
|
86
|
+
.map((a) => ({ ...a, totalMs: Math.round(a.totalMs), maxMs: Math.round(a.maxMs) }));
|
|
87
|
+
}
|
|
88
|
+
function drainSpanWindow(limit) {
|
|
89
|
+
const out = topSpansSinceReport(limit);
|
|
90
|
+
spans.window = new Map();
|
|
91
|
+
return out;
|
|
92
|
+
}
|
|
93
|
+
function summarizeSpan(r) {
|
|
94
|
+
return { span: r.name, durMs: Math.round(r.durMs), ...r.fields };
|
|
95
|
+
}
|
|
96
|
+
const toMs = (ns) => Math.round(ns / 1e6);
|
|
97
|
+
export class DaemonVitals {
|
|
98
|
+
log;
|
|
99
|
+
reportMs;
|
|
100
|
+
probeMs;
|
|
101
|
+
stallMs;
|
|
102
|
+
extra;
|
|
103
|
+
histogram = null;
|
|
104
|
+
probeTimer;
|
|
105
|
+
reportTimer;
|
|
106
|
+
lastProbe = 0;
|
|
107
|
+
lastCpu = process.cpuUsage();
|
|
108
|
+
lastCpuAt = performance.now();
|
|
109
|
+
startedAt = performance.now();
|
|
110
|
+
constructor(opts) {
|
|
111
|
+
this.log = opts.log;
|
|
112
|
+
this.reportMs = opts.reportMs ?? 60_000;
|
|
113
|
+
this.probeMs = opts.probeMs ?? 250;
|
|
114
|
+
this.stallMs = opts.stallMs ?? 1_000;
|
|
115
|
+
this.extra = opts.extra;
|
|
116
|
+
}
|
|
117
|
+
start() {
|
|
118
|
+
this.histogram = monitorEventLoopDelay({ resolution: 20 });
|
|
119
|
+
this.histogram.enable();
|
|
120
|
+
this.lastProbe = performance.now();
|
|
121
|
+
this.probeTimer = setInterval(() => this.probe(), this.probeMs);
|
|
122
|
+
this.reportTimer = setInterval(() => this.report(), this.reportMs);
|
|
123
|
+
this.probeTimer.unref?.();
|
|
124
|
+
this.reportTimer.unref?.();
|
|
125
|
+
}
|
|
126
|
+
stop() {
|
|
127
|
+
if (this.probeTimer)
|
|
128
|
+
clearInterval(this.probeTimer);
|
|
129
|
+
if (this.reportTimer)
|
|
130
|
+
clearInterval(this.reportTimer);
|
|
131
|
+
this.histogram?.disable();
|
|
132
|
+
this.histogram = null;
|
|
133
|
+
}
|
|
134
|
+
snapshot() {
|
|
135
|
+
const now = performance.now();
|
|
136
|
+
const cpu = process.cpuUsage(this.lastCpu);
|
|
137
|
+
const wallUs = Math.max(1, (now - this.lastCpuAt) * 1000);
|
|
138
|
+
const mem = process.memoryUsage();
|
|
139
|
+
const h = this.histogram;
|
|
140
|
+
return {
|
|
141
|
+
uptimeS: Math.round((now - this.startedAt) / 1000),
|
|
142
|
+
loop: h ? { p50Ms: toMs(h.percentile(50)), p99Ms: toMs(h.percentile(99)), maxMs: toMs(h.max) } : { p50Ms: 0, p99Ms: 0, maxMs: 0 },
|
|
143
|
+
cpuPct: Math.round(((cpu.user + cpu.system) / wallUs) * 100),
|
|
144
|
+
rssMb: Math.round(mem.rss / 1048576),
|
|
145
|
+
heapUsedMb: Math.round(mem.heapUsed / 1048576),
|
|
146
|
+
load1: Math.round(os.loadavg()[0] * 10) / 10,
|
|
147
|
+
cores: os.availableParallelism?.() ?? os.cpus().length,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
safe(level, message, fields) {
|
|
151
|
+
try {
|
|
152
|
+
this.log(level, message, fields);
|
|
153
|
+
}
|
|
154
|
+
catch { }
|
|
155
|
+
}
|
|
156
|
+
probe() {
|
|
157
|
+
const now = performance.now();
|
|
158
|
+
const stalledMs = now - this.lastProbe - this.probeMs;
|
|
159
|
+
const from = this.lastProbe;
|
|
160
|
+
this.lastProbe = now;
|
|
161
|
+
if (stalledMs < this.stallMs)
|
|
162
|
+
return;
|
|
163
|
+
const blockers = syncSpansBetween(from, now).sort((a, b) => b.durMs - a.durMs).slice(0, 5);
|
|
164
|
+
const named = blockers.length ? blockers.map((b) => `${b.name} ${Math.round(b.durMs)}ms`).join(', ') : 'no instrumented section (uninstrumented code or the process was descheduled)';
|
|
165
|
+
this.safe('WARN', `event loop stalled ${Math.round(stalledMs)}ms; ran: ${named}`, {
|
|
166
|
+
event: 'loop.stall',
|
|
167
|
+
stalledMs: Math.round(stalledMs),
|
|
168
|
+
blockers: blockers.map(summarizeSpan),
|
|
169
|
+
load1: Math.round(os.loadavg()[0] * 10) / 10,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
report() {
|
|
173
|
+
const snap = this.snapshot();
|
|
174
|
+
const top = drainSpanWindow(8);
|
|
175
|
+
this.histogram?.reset();
|
|
176
|
+
this.lastCpu = process.cpuUsage();
|
|
177
|
+
this.lastCpuAt = performance.now();
|
|
178
|
+
this.safe('INFO', `vitals: loop p99 ${snap.loop.p99Ms}ms max ${snap.loop.maxMs}ms, cpu ${snap.cpuPct}%, rss ${snap.rssMb}MB, load ${snap.load1}/${snap.cores}`, {
|
|
179
|
+
event: 'vitals',
|
|
180
|
+
...snap,
|
|
181
|
+
topSpans: top,
|
|
182
|
+
...this.extra?.(),
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -596,12 +596,13 @@ export function claudeVersionIsAuthenticated(version) {
|
|
|
596
596
|
const binary = getBinaryPath('claude', version);
|
|
597
597
|
if (!binary)
|
|
598
598
|
return false;
|
|
599
|
-
const
|
|
599
|
+
const env = buildRoutineSpawnEnv(process.env, 'claude', version);
|
|
600
|
+
env.HOME = process.env.AGENTS_REAL_HOME || os.homedir();
|
|
600
601
|
try {
|
|
601
602
|
const raw = execFileSync(binary, ['auth', 'status', '--json'], {
|
|
602
603
|
encoding: 'utf8',
|
|
603
604
|
timeout: 5_000,
|
|
604
|
-
env
|
|
605
|
+
env,
|
|
605
606
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
606
607
|
});
|
|
607
608
|
return JSON.parse(raw).loggedIn === true;
|
|
@@ -7,7 +7,7 @@ export interface ServiceHealth {
|
|
|
7
7
|
consecutiveFailures: number;
|
|
8
8
|
}
|
|
9
9
|
export interface DaemonContext {
|
|
10
|
-
log: (level: string, message: string) => void;
|
|
10
|
+
log: (level: string, message: string, fields?: Record<string, unknown>) => void;
|
|
11
11
|
}
|
|
12
12
|
export interface DaemonService {
|
|
13
13
|
readonly id: DaemonServiceId;
|
|
@@ -9,5 +9,5 @@ export declare class SessionStateService extends BasePeriodicService {
|
|
|
9
9
|
constructor(wake: () => void);
|
|
10
10
|
protected onStart(_ctx: DaemonContext): Promise<void>;
|
|
11
11
|
protected onStop(): Promise<void>;
|
|
12
|
-
protected onTick(
|
|
12
|
+
protected onTick(ctx: DaemonContext): Promise<void>;
|
|
13
13
|
}
|
|
@@ -20,7 +20,7 @@ export class SessionStateService extends BasePeriodicService {
|
|
|
20
20
|
this.stopReaderWatch?.();
|
|
21
21
|
this.stopReaderWatch = null;
|
|
22
22
|
}
|
|
23
|
-
async onTick(
|
|
24
|
-
await runActiveSessionsWarmTick();
|
|
23
|
+
async onTick(ctx) {
|
|
24
|
+
await runActiveSessionsWarmTick({ log: ctx.log });
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { DaemonServiceId } from '../daemon-services.js';
|
|
2
2
|
import type { DaemonContext, DaemonService, ServiceHealth } from './service.js';
|
|
3
|
+
import { type LogFields } from './diagnostics.js';
|
|
3
4
|
interface ServiceSupervisorOptions {
|
|
4
5
|
lifecycleDeadlineMs?: number;
|
|
5
6
|
exit?: (code: number) => never;
|
|
7
|
+
diagnostics?: () => LogFields;
|
|
6
8
|
}
|
|
7
9
|
interface RegisterServiceOptions {
|
|
8
10
|
enabled?: boolean;
|
|
@@ -12,7 +14,12 @@ export declare class ServiceSupervisor {
|
|
|
12
14
|
private ctx;
|
|
13
15
|
private readonly lifecycleDeadlineMs;
|
|
14
16
|
private readonly exit;
|
|
17
|
+
private readonly diagnostics?;
|
|
15
18
|
constructor(opts?: ServiceSupervisorOptions);
|
|
19
|
+
inFlightTicks(now?: number): Array<{
|
|
20
|
+
service: DaemonServiceId;
|
|
21
|
+
elapsedMs: number;
|
|
22
|
+
}>;
|
|
16
23
|
private withDeadline;
|
|
17
24
|
register(service: DaemonService, options?: RegisterServiceOptions): void;
|
|
18
25
|
private clearInFlight;
|
|
@@ -31,6 +38,7 @@ export declare class ServiceSupervisor {
|
|
|
31
38
|
private scheduleTimer;
|
|
32
39
|
private runTick;
|
|
33
40
|
private recordFailure;
|
|
41
|
+
private breachSnapshot;
|
|
34
42
|
private exitForRestart;
|
|
35
43
|
private freezeTimers;
|
|
36
44
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { recordSubsystemOk, recordSubsystemError, recordSubsystemState, recordDaemonRestart } from '../daemon-health.js';
|
|
2
2
|
import { isPeriodicService } from './service.js';
|
|
3
|
+
import { syncSpansBetween } from './diagnostics.js';
|
|
4
|
+
import { performance } from 'perf_hooks';
|
|
3
5
|
const DEADLINE_EXIT_CODE = 70;
|
|
4
6
|
const DEFAULT_LIFECYCLE_DEADLINE_MS = 30_000;
|
|
5
7
|
export class ServiceSupervisor {
|
|
@@ -7,9 +9,19 @@ export class ServiceSupervisor {
|
|
|
7
9
|
ctx = null;
|
|
8
10
|
lifecycleDeadlineMs;
|
|
9
11
|
exit;
|
|
12
|
+
diagnostics;
|
|
10
13
|
constructor(opts = {}) {
|
|
11
14
|
this.lifecycleDeadlineMs = opts.lifecycleDeadlineMs ?? DEFAULT_LIFECYCLE_DEADLINE_MS;
|
|
12
15
|
this.exit = opts.exit ?? ((code) => process.exit(code));
|
|
16
|
+
this.diagnostics = opts.diagnostics;
|
|
17
|
+
}
|
|
18
|
+
inFlightTicks(now = performance.now()) {
|
|
19
|
+
const out = [];
|
|
20
|
+
for (const [id, entry] of this.registry) {
|
|
21
|
+
if (entry.inFlight && entry.tickStartedAt !== undefined)
|
|
22
|
+
out.push({ service: id, elapsedMs: Math.round(now - entry.tickStartedAt) });
|
|
23
|
+
}
|
|
24
|
+
return out.sort((a, b) => b.elapsedMs - a.elapsedMs);
|
|
13
25
|
}
|
|
14
26
|
async withDeadline(op, ms, label) {
|
|
15
27
|
let timer;
|
|
@@ -206,9 +218,12 @@ export class ServiceSupervisor {
|
|
|
206
218
|
return;
|
|
207
219
|
const periodicService = entry.service;
|
|
208
220
|
entry.inFlight = true;
|
|
221
|
+
const startedAt = performance.now();
|
|
222
|
+
entry.tickStartedAt = startedAt;
|
|
209
223
|
const controller = new AbortController();
|
|
210
224
|
entry.activeController = controller;
|
|
211
225
|
let timedOut = false;
|
|
226
|
+
ctx.log('DEBUG', `service '${id}' tick start`, { event: 'tick.start', service: id });
|
|
212
227
|
const tickPromise = periodicService.tick(ctx, controller.signal);
|
|
213
228
|
entry.activeTick = tickPromise;
|
|
214
229
|
try {
|
|
@@ -219,6 +234,14 @@ export class ServiceSupervisor {
|
|
|
219
234
|
}, periodicService.deadlineMs);
|
|
220
235
|
});
|
|
221
236
|
await Promise.race([tickPromise, deadline]);
|
|
237
|
+
const durMs = Math.round(performance.now() - startedAt);
|
|
238
|
+
const tickFields = { service: id, durMs, deadlineMs: periodicService.deadlineMs };
|
|
239
|
+
if (durMs * 2 > periodicService.deadlineMs) {
|
|
240
|
+
ctx.log('WARN', `service '${id}' tick took ${durMs}ms, over half its ${periodicService.deadlineMs}ms deadline`, { event: 'tick.slow', ...tickFields, inFlight: this.inFlightTicks() });
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
ctx.log('DEBUG', `service '${id}' tick ok in ${durMs}ms`, { event: 'tick.ok', ...tickFields });
|
|
244
|
+
}
|
|
222
245
|
entry.consecutiveFailures = 0;
|
|
223
246
|
entry.lastError = undefined;
|
|
224
247
|
entry.lastRunMs = Date.now();
|
|
@@ -228,11 +251,11 @@ export class ServiceSupervisor {
|
|
|
228
251
|
const stoppedDuringTick = this.registry.get(id)?.state === 'stopped';
|
|
229
252
|
if (timedOut && !stoppedDuringTick) {
|
|
230
253
|
controller.abort();
|
|
231
|
-
this.exitForRestart(id, err);
|
|
254
|
+
this.exitForRestart(id, err, startedAt);
|
|
232
255
|
return;
|
|
233
256
|
}
|
|
234
257
|
if (!timedOut)
|
|
235
|
-
this.recordFailure(entry, id, err);
|
|
258
|
+
this.recordFailure(entry, id, err, Math.round(performance.now() - startedAt));
|
|
236
259
|
}
|
|
237
260
|
finally {
|
|
238
261
|
if (entry.deadlineTimer) {
|
|
@@ -241,17 +264,35 @@ export class ServiceSupervisor {
|
|
|
241
264
|
}
|
|
242
265
|
entry.activeTick = undefined;
|
|
243
266
|
entry.activeController = undefined;
|
|
267
|
+
entry.tickStartedAt = undefined;
|
|
244
268
|
this.clearInFlight(entry);
|
|
245
269
|
}
|
|
246
270
|
}
|
|
247
|
-
recordFailure(entry, id, err) {
|
|
271
|
+
recordFailure(entry, id, err, durMs) {
|
|
248
272
|
const message = err instanceof Error ? err.message : String(err);
|
|
249
273
|
entry.consecutiveFailures += 1;
|
|
250
274
|
entry.lastError = message;
|
|
251
275
|
recordSubsystemError(id, message);
|
|
252
|
-
this.ctx?.log('WARN', `service '${id}' failed: ${message}
|
|
276
|
+
this.ctx?.log('WARN', `service '${id}' failed: ${message}`, {
|
|
277
|
+
event: 'tick.failed', service: id, durMs, consecutiveFailures: entry.consecutiveFailures, error: message,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
breachSnapshot(id, startedAt) {
|
|
281
|
+
const now = performance.now();
|
|
282
|
+
const blockers = startedAt === undefined ? [] : syncSpansBetween(startedAt, now)
|
|
283
|
+
.sort((a, b) => b.durMs - a.durMs)
|
|
284
|
+
.slice(0, 8)
|
|
285
|
+
.map((r) => ({ span: r.name, durMs: Math.round(r.durMs), ...r.fields }));
|
|
286
|
+
return {
|
|
287
|
+
event: 'tick.breach',
|
|
288
|
+
service: id,
|
|
289
|
+
elapsedMs: startedAt === undefined ? undefined : Math.round(now - startedAt),
|
|
290
|
+
inFlight: this.inFlightTicks(now),
|
|
291
|
+
syncSpansDuringTick: blockers,
|
|
292
|
+
...this.diagnostics?.(),
|
|
293
|
+
};
|
|
253
294
|
}
|
|
254
|
-
exitForRestart(id, err) {
|
|
295
|
+
exitForRestart(id, err, startedAt) {
|
|
255
296
|
const cause = err instanceof Error ? err.message : String(err);
|
|
256
297
|
const entry = this.registry.get(id);
|
|
257
298
|
if (entry) {
|
|
@@ -260,7 +301,7 @@ export class ServiceSupervisor {
|
|
|
260
301
|
}
|
|
261
302
|
recordSubsystemError(id, cause);
|
|
262
303
|
recordDaemonRestart(id, cause);
|
|
263
|
-
this.ctx?.log('ERROR', `service '${id}' breached its deadline (${cause}); exiting (code ${DEADLINE_EXIT_CODE}) for a supervised restart
|
|
304
|
+
this.ctx?.log('ERROR', `service '${id}' breached its deadline (${cause}); exiting (code ${DEADLINE_EXIT_CODE}) for a supervised restart`, this.breachSnapshot(id, startedAt));
|
|
264
305
|
this.freezeTimers();
|
|
265
306
|
this.exit(DEADLINE_EXIT_CODE);
|
|
266
307
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type LogLevel } from './daemon/diagnostics.js';
|
|
2
|
+
export type DaemonServiceId = 'scheduler' | 'catchup' | 'webhook-receiver' | 'self-heal' | 'self-update' | 'account-state' | 'account-auth' | 'watchdog' | 'device-probe' | 'state-dir-check' | 'session-index' | 'session-title' | 'auth-sync' | 'usage-sync' | 'daemon-heartbeat' | 'tmux-reap' | 'session-state' | 'feed-stream' | 'session-summarizer' | 'attention-notify' | 'recordings' | 'harness-update';
|
|
2
3
|
interface DaemonServiceDef {
|
|
3
4
|
id: DaemonServiceId;
|
|
4
5
|
title: string;
|
|
@@ -13,6 +14,8 @@ export interface DaemonServicesConfig {
|
|
|
13
14
|
export declare function getDaemonServicesConfigPath(): string;
|
|
14
15
|
export declare function readDaemonServicesConfig(): DaemonServicesConfig;
|
|
15
16
|
export declare function writeDaemonServicesConfig(cfg: DaemonServicesConfig): void;
|
|
17
|
+
export declare function readDaemonLogLevel(): LogLevel;
|
|
18
|
+
export declare function writeDaemonLogLevel(level: LogLevel): void;
|
|
16
19
|
export declare function isDaemonServiceEnabled(id: DaemonServiceId): boolean;
|
|
17
20
|
export declare function setDaemonServiceEnabled(id: DaemonServiceId, enabled: boolean): DaemonServicesConfig;
|
|
18
21
|
export declare function listDaemonServiceStates(): Array<DaemonServiceDef & {
|
|
@@ -3,6 +3,7 @@ import * as path from 'path';
|
|
|
3
3
|
import * as yaml from 'yaml';
|
|
4
4
|
import { getDaemonConfigDir } from './state.js';
|
|
5
5
|
import { atomicWriteFileSync } from './fs-atomic.js';
|
|
6
|
+
import { LOG_LEVELS, parseLogLevel } from './daemon/diagnostics.js';
|
|
6
7
|
export const DAEMON_SERVICES = [
|
|
7
8
|
{
|
|
8
9
|
id: 'scheduler',
|
|
@@ -89,11 +90,6 @@ export const DAEMON_SERVICES = [
|
|
|
89
90
|
title: 'Attention desktop banners',
|
|
90
91
|
description: 'Posts one actionable desktop banner per new attention item (question / permission / plan review / stall) so the macOS helper can answer it through agents feed answer (PHNX-4004).',
|
|
91
92
|
},
|
|
92
|
-
{
|
|
93
|
-
id: 'owner-device-delivery',
|
|
94
|
-
title: 'Owner iMessage delivery',
|
|
95
|
-
description: 'macOS only: every 15 s, claims the iMessage notifications your account queued for a device and sends them through Messages, then reports each result. Idle without a Phoenix session or device token (PHNX-4267).',
|
|
96
|
-
},
|
|
97
93
|
{
|
|
98
94
|
id: 'recordings',
|
|
99
95
|
title: 'CleanShot recording publisher',
|
|
@@ -168,6 +164,41 @@ export function writeDaemonServicesConfig(cfg) {
|
|
|
168
164
|
const out = yaml.stringify({ ...preserved, services }, { sortMapEntries: false });
|
|
169
165
|
atomicWriteFileSync(filePath, out, 'utf-8');
|
|
170
166
|
}
|
|
167
|
+
function readServicesConfigText() {
|
|
168
|
+
try {
|
|
169
|
+
return fs.readFileSync(getDaemonServicesConfigPath(), 'utf-8');
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
if (err.code === 'ENOENT')
|
|
173
|
+
return undefined;
|
|
174
|
+
throw err;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export function readDaemonLogLevel() {
|
|
178
|
+
const raw = readServicesConfigText();
|
|
179
|
+
if (raw === undefined)
|
|
180
|
+
return 'INFO';
|
|
181
|
+
const parsed = yaml.parse(raw);
|
|
182
|
+
if (!parsed || parsed.logLevel === undefined)
|
|
183
|
+
return 'INFO';
|
|
184
|
+
const level = parseLogLevel(parsed.logLevel);
|
|
185
|
+
if (!level)
|
|
186
|
+
throw new Error(`${getDaemonServicesConfigPath()}: logLevel '${String(parsed.logLevel)}' is not one of ${LOG_LEVELS.join(', ').toLowerCase()}`);
|
|
187
|
+
return level;
|
|
188
|
+
}
|
|
189
|
+
export function writeDaemonLogLevel(level) {
|
|
190
|
+
const dir = getDaemonConfigDir();
|
|
191
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
192
|
+
const filePath = getDaemonServicesConfigPath();
|
|
193
|
+
const raw = readServicesConfigText();
|
|
194
|
+
const parsed = raw === undefined ? null : yaml.parse(raw);
|
|
195
|
+
if (parsed !== null && (typeof parsed !== 'object' || Array.isArray(parsed))) {
|
|
196
|
+
throw new Error(`${filePath} is not a YAML mapping; fix it before setting the log level`);
|
|
197
|
+
}
|
|
198
|
+
const doc = { ...parsed };
|
|
199
|
+
doc.logLevel = level.toLowerCase();
|
|
200
|
+
atomicWriteFileSync(filePath, yaml.stringify(doc, { sortMapEntries: false }), 'utf-8');
|
|
201
|
+
}
|
|
171
202
|
export function isDaemonServiceEnabled(id) {
|
|
172
203
|
return readDaemonServicesConfig().services[id] !== false;
|
|
173
204
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DiagnosticLog } from './daemon/diagnostics.js';
|
|
1
2
|
import type { FleetStatusRow } from './fleet-status.js';
|
|
2
3
|
import { type AuthProbeRow } from './auth-health.js';
|
|
3
4
|
export { AUTH_PROBE_MAX_AGE_MS } from './auth-health.js';
|
|
@@ -16,10 +17,11 @@ export declare function refreshLocalFleetAuthState(opts?: {
|
|
|
16
17
|
authRows: import('./auth-health.js').AuthProbeRow[];
|
|
17
18
|
}>;
|
|
18
19
|
export declare function runFleetCacheWarmTick(signal?: AbortSignal): Promise<void>;
|
|
19
|
-
export declare function runUsageRefreshTick(signal?: AbortSignal): Promise<void>;
|
|
20
|
+
export declare function runUsageRefreshTick(signal?: AbortSignal, log?: DiagnosticLog): Promise<void>;
|
|
20
21
|
export declare function runActiveSessionsWarmTick(opts?: {
|
|
21
22
|
gather?: () => Promise<import('./session/active.js').ActiveSession[]>;
|
|
22
23
|
nowMs?: number;
|
|
24
|
+
log?: DiagnosticLog;
|
|
23
25
|
}): Promise<{
|
|
24
26
|
sessions: number;
|
|
25
27
|
}>;
|
package/dist/lib/daemon-ticks.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { span, spanSync } from './daemon/diagnostics.js';
|
|
1
2
|
import { AUTH_PROBE_MAX_AGE_MS, authTargetKey } from './auth-health.js';
|
|
2
3
|
export { AUTH_PROBE_MAX_AGE_MS } from './auth-health.js';
|
|
3
4
|
export function isFreshFleetAuthSnapshot(value, minimumCapturedAt) {
|
|
@@ -55,12 +56,13 @@ export async function runFleetCacheWarmTick(signal) {
|
|
|
55
56
|
const authCount = result.authRows.length;
|
|
56
57
|
console.log(`fleet cache warm: ${authCount} auth row(s) refreshed, ${row.agents.running} running agent(s) on ${row.host}`);
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
+
const noLog = () => { };
|
|
60
|
+
export async function runUsageRefreshTick(signal, log = noLog) {
|
|
59
61
|
const { runUsageRefresh, buildLocalUsageAccounts } = await import('./usage-refresh.js');
|
|
60
62
|
const { writeClaudeUsageCache, readClaudeUsageCache } = await import('./accounting/usage.js');
|
|
61
63
|
const { usageRateLimitedUntil } = await import('./usage-backoff.js');
|
|
62
64
|
const { machineId } = await import('./machine-id.js');
|
|
63
|
-
const r = await runUsageRefresh({
|
|
65
|
+
const r = await span('usage.refresh', () => runUsageRefresh({
|
|
64
66
|
listAccounts: buildLocalUsageAccounts,
|
|
65
67
|
writeUsageCache: writeClaudeUsageCache,
|
|
66
68
|
backoffUntil: (agentId, usageKey) => usageRateLimitedUntil(agentId, Date.now(), usageKey),
|
|
@@ -71,35 +73,39 @@ export async function runUsageRefreshTick(signal) {
|
|
|
71
73
|
const { publishUsageSnapshotToSharedStore } = await import('./accounting/usage-sync.js');
|
|
72
74
|
await publishUsageSnapshotToSharedStore();
|
|
73
75
|
},
|
|
74
|
-
});
|
|
76
|
+
}));
|
|
75
77
|
const { listProfiles } = await import('./profiles.js');
|
|
76
78
|
const { refreshDueByokUsage } = await import('./byok-usage.js');
|
|
77
|
-
const byok = await refreshDueByokUsage(listProfiles());
|
|
78
|
-
|
|
79
|
+
const byok = await span('usage.refresh-byok', () => refreshDueByokUsage(listProfiles()));
|
|
80
|
+
log(r.failed > 0 ? 'WARN' : 'INFO', `usage refresh: ${r.refreshed} refreshed, ${r.failed} failed, ${r.skippedNotDue} not-due, ${r.skippedBackoff} backed-off, ${r.skippedCap} capped, ${r.skippedBudget} over-budget, ${r.skippedFresh} statusline-fresh; BYOK ${byok.refreshed} refreshed, ${byok.skipped} not-due`, {
|
|
81
|
+
event: 'usage.refresh', refreshed: r.refreshed, failed: r.failed, notDue: r.skippedNotDue, backedOff: r.skippedBackoff,
|
|
82
|
+
capped: r.skippedCap, overBudget: r.skippedBudget, statuslineFresh: r.skippedFresh, byokRefreshed: byok.refreshed, byokNotDue: byok.skipped,
|
|
83
|
+
});
|
|
79
84
|
}
|
|
80
85
|
export async function runActiveSessionsWarmTick(opts = {}) {
|
|
86
|
+
const log = opts.log ?? noLog;
|
|
81
87
|
const { publishLocalActiveSessions, isActiveSessionsJournalReaderRecent } = await import('./session/session-cache.js');
|
|
82
88
|
const nowMs = opts.nowMs ?? Date.now();
|
|
83
89
|
if (!isActiveSessionsJournalReaderRecent(nowMs)) {
|
|
84
|
-
|
|
90
|
+
log('DEBUG', 'active-sessions warm: idle (no recent reader), skipping gather', { event: 'sessions.warm', skipped: 'no-reader' });
|
|
85
91
|
return { sessions: 0 };
|
|
86
92
|
}
|
|
87
93
|
const gather = opts.gather ?? (async () => {
|
|
88
94
|
const { getActiveSessions } = await import('./session/active.js');
|
|
89
95
|
return getActiveSessions({ localOnly: true });
|
|
90
96
|
});
|
|
91
|
-
const gathered = await gather();
|
|
97
|
+
const gathered = await span('sessions.warm.gather', gather, () => ({}));
|
|
92
98
|
const { runTimelinePassSync } = await import('./session/timeline-pass.js');
|
|
93
99
|
let timeline = { computed: 0, reused: 0, skipped: 0 };
|
|
94
100
|
try {
|
|
95
|
-
timeline = runTimelinePassSync({ sessions: gathered, nowMs });
|
|
101
|
+
timeline = spanSync('sessions.timeline-pass', () => runTimelinePassSync({ sessions: gathered, nowMs }), () => ({ sessions: gathered.length }));
|
|
96
102
|
}
|
|
97
103
|
catch (err) {
|
|
98
|
-
|
|
104
|
+
log('WARN', `active-sessions warm: timeline pass failed: ${err.message}`, { event: 'sessions.timeline-pass.failed', error: err.message });
|
|
99
105
|
}
|
|
100
|
-
const r = await publishLocalActiveSessions({ gather: async () => gathered, nowMs });
|
|
101
|
-
|
|
102
|
-
+ `timeline ${timeline.computed} folded, ${timeline.reused} current, ${timeline.skipped} skipped
|
|
106
|
+
const r = await span('sessions.warm.publish', () => publishLocalActiveSessions({ gather: async () => gathered, nowMs }));
|
|
107
|
+
log('DEBUG', `active-sessions warm: ${r.sessions.length} session(s) published; `
|
|
108
|
+
+ `timeline ${timeline.computed} folded, ${timeline.reused} current, ${timeline.skipped} skipped`, { event: 'sessions.warm', sessions: r.sessions.length, ...timeline });
|
|
103
109
|
return { sessions: r.sessions.length };
|
|
104
110
|
}
|
|
105
111
|
export async function runSessionIndexWarmTick() {
|
|
@@ -29,7 +29,7 @@ interface ConfigTarget {
|
|
|
29
29
|
}
|
|
30
30
|
declare const DEVICE_ROLES: readonly ["worker", "personal", "desktop"];
|
|
31
31
|
declare const AUTO_POOL_MODES: readonly ["workers", "all"];
|
|
32
|
-
export declare const MENUBAR_TABS: readonly ["home", "goals", "projects", "sessions", "inbox"];
|
|
32
|
+
export declare const MENUBAR_TABS: readonly ["home", "goals", "secrets", "projects", "github", "sessions", "inbox"];
|
|
33
33
|
export declare const MENUBAR_HOME_GOALS: readonly ["company", "week", "myWeek", "myDay"];
|
|
34
34
|
export declare function resolveMenubarTabOrder(stored: readonly string[]): string[];
|
|
35
35
|
export declare const CONFIG_KEYS: readonly ConfigKeySpec[];
|
|
@@ -14,8 +14,8 @@ const SSH_AUTH_METHODS = ['key', 'password'];
|
|
|
14
14
|
const DEVICE_ROLES = ['worker', 'personal', 'desktop'];
|
|
15
15
|
const AUTO_POOL_MODES = ['workers', 'all'];
|
|
16
16
|
const DEVICE_FORM_FACTORS = ['laptop', 'desktop', 'server', 'unknown'];
|
|
17
|
-
export const MENUBAR_TABS = ['home', 'goals', 'projects', 'sessions', 'inbox'];
|
|
18
|
-
const MENUBAR_TABS_ADDED_LATER = ['goals'];
|
|
17
|
+
export const MENUBAR_TABS = ['home', 'goals', 'secrets', 'projects', 'github', 'sessions', 'inbox'];
|
|
18
|
+
const MENUBAR_TABS_ADDED_LATER = ['goals', 'secrets', 'github'];
|
|
19
19
|
export const MENUBAR_HOME_GOALS = ['company', 'week', 'myWeek', 'myDay'];
|
|
20
20
|
export function resolveMenubarTabOrder(stored) {
|
|
21
21
|
const known = MENUBAR_TABS;
|
|
@@ -550,8 +550,8 @@ export const CONFIG_KEYS = [
|
|
|
550
550
|
type: 'string-list',
|
|
551
551
|
defaultValue: [...MENUBAR_TABS],
|
|
552
552
|
description: `AGI Menu: the order of the tab bar — every one of ${MENUBAR_TABS.join(', ')} exactly once. ` +
|
|
553
|
-
'Settings is always last and is not listed. An order saved before Goals existed may omit
|
|
554
|
-
'
|
|
553
|
+
'Settings is always last and is not listed. An order saved before Goals, Secrets or GitHub existed may omit them; ' +
|
|
554
|
+
'they read back appended. Hiding a tab is menubar.menu.hiddenTabs, not this key.',
|
|
555
555
|
validate: (v) => {
|
|
556
556
|
const tabs = v;
|
|
557
557
|
const required = MENUBAR_TABS.filter((t) => !MENUBAR_TABS_ADDED_LATER.includes(t));
|
|
@@ -561,18 +561,26 @@ export const CONFIG_KEYS = [
|
|
|
561
561
|
return ok
|
|
562
562
|
? null
|
|
563
563
|
: `menubar.menu.tabOrder must list each of ${MENUBAR_TABS.join(', ')} exactly once ` +
|
|
564
|
-
`(${MENUBAR_TABS_ADDED_LATER.join(', ')} may be left out and
|
|
564
|
+
`(${MENUBAR_TABS_ADDED_LATER.join(', ')} may be left out and are appended).`;
|
|
565
565
|
},
|
|
566
566
|
normalize: (v) => (Array.isArray(v) ? resolveMenubarTabOrder(v.map(String)) : v),
|
|
567
567
|
},
|
|
568
|
+
{
|
|
569
|
+
name: 'menubar.autoUpdate',
|
|
570
|
+
yamlKey: 'menubarAutoUpdate',
|
|
571
|
+
scope: 'user',
|
|
572
|
+
type: 'bool',
|
|
573
|
+
defaultValue: true,
|
|
574
|
+
description: 'Automatically check and install AGI Menu releases about every 12 hours while this Mac is awake.',
|
|
575
|
+
},
|
|
568
576
|
{
|
|
569
577
|
name: 'menubar.menu.hiddenTabs',
|
|
570
578
|
yamlKey: 'menubarMenuHiddenTabs',
|
|
571
579
|
scope: 'user',
|
|
572
580
|
type: 'string-list',
|
|
573
|
-
defaultValue: [],
|
|
581
|
+
defaultValue: ['secrets'],
|
|
574
582
|
description: `AGI Menu: tabs hidden from the tab bar — any of ${MENUBAR_TABS.join(', ')}, but not all of them. ` +
|
|
575
|
-
'Settings cannot be hidden. Hiding Inbox loses nothing: its requests still show on Home.',
|
|
583
|
+
'Settings cannot be hidden. Hiding Inbox loses nothing: its requests still show on Home. Secrets is hidden unless this list is set without it.',
|
|
576
584
|
validate: (v) => {
|
|
577
585
|
const tabs = v;
|
|
578
586
|
const bad = tabs.find((t) => !MENUBAR_TABS.includes(t));
|
|
@@ -585,6 +593,39 @@ export const CONFIG_KEYS = [
|
|
|
585
593
|
return null;
|
|
586
594
|
},
|
|
587
595
|
},
|
|
596
|
+
{
|
|
597
|
+
name: 'menubar.menu.githubHidden',
|
|
598
|
+
yamlKey: 'menubarMenuGithubHidden',
|
|
599
|
+
scope: 'user',
|
|
600
|
+
type: 'string-list',
|
|
601
|
+
defaultValue: [],
|
|
602
|
+
description: 'AGI Menu: what the GitHub tab leaves out — an org or account login hides all of its repos, an ' +
|
|
603
|
+
'owner/repo slug hides one repo. Unset shows every org and repo `agents projects prs --json` reads.',
|
|
604
|
+
validate: (v) => {
|
|
605
|
+
const entries = v;
|
|
606
|
+
const bad = entries.find((e) => !/^[\w.-]+(\/[\w.-]+)?$/.test(e));
|
|
607
|
+
if (bad !== undefined)
|
|
608
|
+
return `menubar.menu.githubHidden: "${bad}" is not an org login or owner/repo.`;
|
|
609
|
+
const dup = entries.find((e, i) => entries.findIndex((x) => x.toLowerCase() === e.toLowerCase()) !== i);
|
|
610
|
+
return dup === undefined ? null : `menubar.menu.githubHidden lists "${dup}" twice.`;
|
|
611
|
+
},
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
name: 'menubar.menu.githubDrafts',
|
|
615
|
+
yamlKey: 'menubarMenuGithubDrafts',
|
|
616
|
+
scope: 'user',
|
|
617
|
+
type: 'bool',
|
|
618
|
+
defaultValue: false,
|
|
619
|
+
description: 'AGI Menu: show draft pull requests on the GitHub tab (default off).',
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
name: 'menubar.menu.githubBots',
|
|
623
|
+
yamlKey: 'menubarMenuGithubBots',
|
|
624
|
+
scope: 'user',
|
|
625
|
+
type: 'bool',
|
|
626
|
+
defaultValue: false,
|
|
627
|
+
description: 'AGI Menu: show pull requests opened by bots (dependabot, CI bots) on the GitHub tab (default off).',
|
|
628
|
+
},
|
|
588
629
|
{
|
|
589
630
|
name: 'menubar.menu.groupTicketsByMilestone',
|
|
590
631
|
yamlKey: 'menubarMenuGroupTicketsByMilestone',
|