@phnx-labs/agents-cli 1.23.27 → 1.23.29
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 +8 -0
- package/README.md +33 -82
- package/dist/bootstrap.js +0 -17
- package/dist/cli/command-registry.js +0 -2
- package/dist/commands/cloud.js +0 -58
- package/dist/commands/config.js +0 -4
- package/dist/commands/daemon-index.js +1 -1
- package/dist/commands/daemon.js +14 -63
- package/dist/commands/doctor.js +0 -12
- package/dist/commands/events.js +1 -1
- package/dist/commands/feed.d.ts +1 -3
- package/dist/commands/feed.js +1 -6
- package/dist/commands/fleet-capture.js +2 -4
- package/dist/commands/focus.d.ts +0 -1
- package/dist/commands/focus.js +2 -4
- package/dist/commands/inspect.d.ts +1 -19
- package/dist/commands/inspect.js +8 -474
- package/dist/commands/mine.js +1 -1
- package/dist/commands/prune.js +2 -64
- package/dist/commands/ps-roster.d.ts +0 -4
- package/dist/commands/ps-roster.js +2 -30
- package/dist/commands/ps.js +1 -4
- package/dist/commands/repo.d.ts +1 -1
- package/dist/commands/repo.js +4 -4
- package/dist/commands/sessions-browser.d.ts +0 -2
- package/dist/commands/sessions-browser.js +2 -32
- package/dist/commands/sessions-optimize.js +3 -4
- package/dist/commands/setup-mine.js +0 -1
- package/dist/commands/ssh.js +8 -9
- package/dist/commands/sync.js +1 -1
- package/dist/commands/update.js +2 -2
- package/dist/commands/watchdog.js +3 -4
- package/dist/lib/accounting/rotate.d.ts +0 -2
- package/dist/lib/accounting/rotate.js +1 -4
- package/dist/lib/agent-spec/agents.d.ts +0 -1
- package/dist/lib/agent-spec/agents.js +0 -8
- package/dist/lib/auth-health.d.ts +0 -1
- package/dist/lib/auth-health.js +0 -3
- package/dist/lib/cli-entry.d.ts +0 -1
- package/dist/lib/cli-entry.js +0 -36
- package/dist/lib/cloud/types.d.ts +0 -2
- package/dist/lib/config-keys.d.ts +1 -1
- package/dist/lib/config-keys.js +1 -4
- package/dist/lib/daemon/daemon.d.ts +0 -4
- package/dist/lib/daemon/daemon.js +6 -202
- package/dist/lib/daemon/heartbeat-service.d.ts +1 -1
- package/dist/lib/daemon/heartbeat-service.js +1 -8
- package/dist/lib/daemon-services.d.ts +1 -1
- package/dist/lib/daemon-services.js +1 -11
- package/dist/lib/device-config.d.ts +0 -2
- package/dist/lib/device-config.js +4 -22
- package/dist/lib/devices/config-migration.js +1 -3
- package/dist/lib/exec.d.ts +2 -5
- package/dist/lib/exec.js +18 -18
- package/dist/lib/factory/snapshot.d.ts +0 -5
- package/dist/lib/factory/snapshot.js +1 -28
- package/dist/lib/feed/events.d.ts +1 -11
- package/dist/lib/feed/events.js +0 -20
- package/dist/lib/feed/feed.d.ts +0 -2
- package/dist/lib/feed-outcome.d.ts +0 -2
- package/dist/lib/feed-outcome.js +0 -5
- package/dist/lib/fleet/capture.d.ts +0 -1
- package/dist/lib/fleet/capture.js +0 -3
- package/dist/lib/fleet/manifest.js +0 -6
- package/dist/lib/fleet/types.d.ts +0 -1
- package/dist/lib/harness/adapter.d.ts +0 -7
- package/dist/lib/harness/adapters/claude.js +0 -18
- package/dist/lib/harness/adapters/codex.js +0 -10
- package/dist/lib/harness/adapters/cursor.js +0 -11
- package/dist/lib/harness/adapters/kimi.js +0 -3
- package/dist/lib/harness/adapters/muse.js +0 -11
- package/dist/lib/harness/index.d.ts +1 -1
- package/dist/lib/harness/index.js +0 -2
- package/dist/lib/hosts/passthrough.js +2 -10
- package/dist/lib/hosts/ready.d.ts +0 -4
- package/dist/lib/hosts/ready.js +0 -9
- package/dist/lib/hosts/reconcile.d.ts +0 -1
- package/dist/lib/hosts/reconcile.js +0 -8
- package/dist/lib/installations/migrate.d.ts +0 -2
- package/dist/lib/installations/migrate.js +0 -145
- package/dist/lib/loop.js +1 -2
- package/dist/lib/menubar/snapshot.d.ts +0 -1
- package/dist/lib/menubar/snapshot.js +1 -4
- package/dist/lib/placement.d.ts +1 -2
- package/dist/lib/placement.js +4 -24
- package/dist/lib/profiles.d.ts +0 -1
- package/dist/lib/profiles.js +0 -6
- package/dist/lib/projects.js +15 -17
- package/dist/lib/session/active.d.ts +1 -3
- package/dist/lib/session/active.js +0 -4
- package/dist/lib/session/db.d.ts +0 -1
- package/dist/lib/session/db.js +4 -8
- package/dist/lib/session/discover.d.ts +0 -1
- package/dist/lib/session/discover.js +3 -128
- package/dist/lib/session/live-metadata.js +0 -2
- package/dist/lib/session/presentation.d.ts +0 -1
- package/dist/lib/session/presentation.js +3 -8
- package/dist/lib/session/selection.d.ts +0 -2
- package/dist/lib/session/selection.js +2 -12
- package/dist/lib/staleness/detectors/commands.d.ts +1 -1
- package/dist/lib/staleness/detectors/hooks.d.ts +1 -1
- package/dist/lib/staleness/detectors/mcp.d.ts +1 -1
- package/dist/lib/staleness/detectors/permissions.d.ts +1 -1
- package/dist/lib/staleness/detectors/plugins.d.ts +1 -1
- package/dist/lib/staleness/detectors/rules.d.ts +1 -1
- package/dist/lib/staleness/detectors/skills.d.ts +1 -1
- package/dist/lib/staleness/detectors/subagents.d.ts +1 -1
- package/dist/lib/staleness/detectors/workflows.d.ts +1 -1
- package/dist/lib/staleness/writers/commands.d.ts +1 -1
- package/dist/lib/staleness/writers/hooks.d.ts +1 -1
- package/dist/lib/staleness/writers/mcp.d.ts +1 -1
- package/dist/lib/staleness/writers/permissions.d.ts +1 -1
- package/dist/lib/staleness/writers/plugins.d.ts +1 -1
- package/dist/lib/staleness/writers/rules.d.ts +1 -1
- package/dist/lib/staleness/writers/skills.d.ts +1 -1
- package/dist/lib/staleness/writers/subagents.d.ts +1 -1
- package/dist/lib/staleness/writers/workflows.d.ts +1 -1
- package/dist/lib/startup/command-registry.js +5 -2
- package/dist/lib/state.d.ts +0 -3
- package/dist/lib/state.js +2 -25
- package/dist/lib/types.d.ts +0 -1
- package/dist/lib/watchdog/runner.d.ts +0 -2
- package/dist/lib/watchdog/runner.js +0 -2
- package/package.json +1 -1
- package/scripts/postinstall.js +2 -2
- package/dist/commands/routines.d.ts +0 -14
- package/dist/commands/routines.js +0 -2149
- package/dist/commands/routines.test-fixture.d.ts +0 -52
- package/dist/commands/routines.test-fixture.js +0 -254
- package/dist/lib/catchup.d.ts +0 -19
- package/dist/lib/catchup.js +0 -83
- package/dist/lib/daemon/catchup-service.d.ts +0 -18
- package/dist/lib/daemon/catchup-service.js +0 -21
- package/dist/lib/daemon/runner.d.ts +0 -91
- package/dist/lib/daemon/runner.js +0 -1927
- package/dist/lib/harness/adapters/droid.d.ts +0 -2
- package/dist/lib/harness/adapters/droid.js +0 -14
- package/dist/lib/overdue.d.ts +0 -9
- package/dist/lib/overdue.js +0 -74
- package/dist/lib/routine-activation.d.ts +0 -13
- package/dist/lib/routine-activation.js +0 -117
- package/dist/lib/routine-context.d.ts +0 -59
- package/dist/lib/routine-context.js +0 -181
- package/dist/lib/routine-notify-owner.d.ts +0 -4
- package/dist/lib/routine-notify-owner.js +0 -49
- package/dist/lib/routine-notify.d.ts +0 -17
- package/dist/lib/routine-notify.js +0 -138
- package/dist/lib/routine-process-cleanup.d.ts +0 -9
- package/dist/lib/routine-process-cleanup.js +0 -81
- package/dist/lib/routine-readiness.d.ts +0 -31
- package/dist/lib/routine-readiness.js +0 -256
- package/dist/lib/routines-format.d.ts +0 -7
- package/dist/lib/routines-format.js +0 -127
- package/dist/lib/routines-placement.d.ts +0 -16
- package/dist/lib/routines-placement.js +0 -60
- package/dist/lib/routines-project.d.ts +0 -49
- package/dist/lib/routines-project.js +0 -306
- package/dist/lib/sandbox.d.ts +0 -15
- package/dist/lib/sandbox.js +0 -309
- package/dist/lib/scheduler.d.ts +0 -23
- package/dist/lib/scheduler.js +0 -106
- package/dist/lib/scheduling/routines.d.ts +0 -264
- package/dist/lib/scheduling/routines.js +0 -1292
- package/dist/lib/triggers/webhook.d.ts +0 -26
- package/dist/lib/triggers/webhook.js +0 -181
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { JobConfig, RunMeta } from '../scheduling/routines.js';
|
|
2
|
-
export type WebhookSource = 'github' | 'linear';
|
|
3
|
-
export interface IncomingWebhook {
|
|
4
|
-
source: WebhookSource;
|
|
5
|
-
event: string;
|
|
6
|
-
payload: Record<string, unknown>;
|
|
7
|
-
}
|
|
8
|
-
export declare function webhookRepo(payload: Record<string, unknown>): string | null;
|
|
9
|
-
export declare function webhookBranches(event: string, payload: Record<string, unknown>): string[];
|
|
10
|
-
export declare function linearAction(payload: Record<string, unknown>): string | null;
|
|
11
|
-
export declare function linearTeamKey(payload: Record<string, unknown>): string | null;
|
|
12
|
-
export declare function linearLabels(payload: Record<string, unknown>): string[];
|
|
13
|
-
export declare function githubAction(payload: Record<string, unknown>): string | null;
|
|
14
|
-
export declare function githubLabels(payload: Record<string, unknown>): string[];
|
|
15
|
-
export declare function jobMatchesWebhook(job: JobConfig, webhook: IncomingWebhook): boolean;
|
|
16
|
-
export declare function matchJobsToWebhook(jobs: JobConfig[], webhook: IncomingWebhook): JobConfig[];
|
|
17
|
-
export interface FireWebhookOptions {
|
|
18
|
-
jobs?: JobConfig[];
|
|
19
|
-
dispatch?: (config: JobConfig) => Promise<RunMeta>;
|
|
20
|
-
}
|
|
21
|
-
interface FiredJob {
|
|
22
|
-
jobName: string;
|
|
23
|
-
runId: string;
|
|
24
|
-
}
|
|
25
|
-
export declare function fireWebhookJobs(webhook: IncomingWebhook, options?: FireWebhookOptions): Promise<FiredJob[]>;
|
|
26
|
-
export {};
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { jobRunsOnThisDevice, listJobs } from '../scheduling/routines.js';
|
|
2
|
-
import { executeJobDetached } from '../daemon/runner.js';
|
|
3
|
-
import { emit } from '../feed/events.js';
|
|
4
|
-
export function webhookRepo(payload) {
|
|
5
|
-
const repo = payload?.repository;
|
|
6
|
-
const fullName = repo?.full_name;
|
|
7
|
-
return typeof fullName === 'string' && fullName.length > 0 ? fullName : null;
|
|
8
|
-
}
|
|
9
|
-
function shortRef(ref) {
|
|
10
|
-
return ref.replace(/^refs\/(heads|tags)\//, '');
|
|
11
|
-
}
|
|
12
|
-
export function webhookBranches(event, payload) {
|
|
13
|
-
const branches = new Set();
|
|
14
|
-
const add = (v) => {
|
|
15
|
-
if (typeof v === 'string' && v.length > 0)
|
|
16
|
-
branches.add(shortRef(v));
|
|
17
|
-
};
|
|
18
|
-
switch (event) {
|
|
19
|
-
case 'push':
|
|
20
|
-
add(payload.ref);
|
|
21
|
-
break;
|
|
22
|
-
case 'pull_request': {
|
|
23
|
-
const pr = payload.pull_request;
|
|
24
|
-
add(pr?.base?.ref);
|
|
25
|
-
add(pr?.head?.ref);
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
case 'workflow_run': {
|
|
29
|
-
const run = payload.workflow_run;
|
|
30
|
-
add(run?.head_branch);
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
default:
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
return [...branches];
|
|
37
|
-
}
|
|
38
|
-
export function linearAction(payload) {
|
|
39
|
-
return typeof payload.action === 'string' ? payload.action : null;
|
|
40
|
-
}
|
|
41
|
-
export function linearTeamKey(payload) {
|
|
42
|
-
const data = payload.data;
|
|
43
|
-
const identifier = data?.identifier;
|
|
44
|
-
if (typeof identifier === 'string') {
|
|
45
|
-
const match = /^([A-Z][A-Z0-9]*)-\d+$/.exec(identifier);
|
|
46
|
-
if (match)
|
|
47
|
-
return match[1];
|
|
48
|
-
}
|
|
49
|
-
const team = data?.team;
|
|
50
|
-
return typeof team?.key === 'string' ? team.key : null;
|
|
51
|
-
}
|
|
52
|
-
export function linearLabels(payload) {
|
|
53
|
-
const data = payload.data;
|
|
54
|
-
const labels = Array.isArray(data?.labels) ? data?.labels : [];
|
|
55
|
-
return labels
|
|
56
|
-
.map((n) => n.name)
|
|
57
|
-
.filter((n) => typeof n === 'string' && n.length > 0);
|
|
58
|
-
}
|
|
59
|
-
export function githubAction(payload) {
|
|
60
|
-
return typeof payload.action === 'string' ? payload.action : null;
|
|
61
|
-
}
|
|
62
|
-
export function githubLabels(payload) {
|
|
63
|
-
const names = new Set();
|
|
64
|
-
const add = (value) => {
|
|
65
|
-
if (typeof value === 'string' && value.length > 0)
|
|
66
|
-
names.add(value);
|
|
67
|
-
};
|
|
68
|
-
const deliveryLabel = payload.label;
|
|
69
|
-
add(deliveryLabel?.name);
|
|
70
|
-
const pr = payload.pull_request;
|
|
71
|
-
const prLabels = Array.isArray(pr?.labels) ? pr.labels : [];
|
|
72
|
-
for (const label of prLabels) {
|
|
73
|
-
add(label.name);
|
|
74
|
-
}
|
|
75
|
-
const issue = payload.issue;
|
|
76
|
-
const issueLabels = Array.isArray(issue?.labels) ? issue.labels : [];
|
|
77
|
-
for (const label of issueLabels) {
|
|
78
|
-
add(label.name);
|
|
79
|
-
}
|
|
80
|
-
return [...names];
|
|
81
|
-
}
|
|
82
|
-
function githubTriggerMatches(trigger, webhook) {
|
|
83
|
-
if (webhook.source !== 'github')
|
|
84
|
-
return false;
|
|
85
|
-
if (trigger.event !== webhook.event)
|
|
86
|
-
return false;
|
|
87
|
-
if (trigger.action && githubAction(webhook.payload) !== trigger.action)
|
|
88
|
-
return false;
|
|
89
|
-
if (trigger.repo) {
|
|
90
|
-
const repo = webhookRepo(webhook.payload);
|
|
91
|
-
if (!repo || repo.toLowerCase() !== trigger.repo.toLowerCase())
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
if (trigger.branch) {
|
|
95
|
-
const branches = webhookBranches(webhook.event, webhook.payload);
|
|
96
|
-
if (!branches.some((b) => b === trigger.branch))
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
if (trigger.label) {
|
|
100
|
-
const expected = trigger.label.toLowerCase();
|
|
101
|
-
if (!githubLabels(webhook.payload).some((name) => name.toLowerCase() === expected))
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
function linearTriggerMatches(trigger, webhook) {
|
|
107
|
-
if (webhook.source !== 'linear')
|
|
108
|
-
return false;
|
|
109
|
-
if (trigger.event !== webhook.event)
|
|
110
|
-
return false;
|
|
111
|
-
if (trigger.action && linearAction(webhook.payload) !== trigger.action)
|
|
112
|
-
return false;
|
|
113
|
-
if (trigger.teamKey && linearTeamKey(webhook.payload) !== trigger.teamKey)
|
|
114
|
-
return false;
|
|
115
|
-
if (trigger.label) {
|
|
116
|
-
const expected = trigger.label.toLowerCase();
|
|
117
|
-
if (!linearLabels(webhook.payload).some((name) => name.toLowerCase() === expected))
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
if (trigger.stateTo) {
|
|
121
|
-
const data = webhook.payload.data;
|
|
122
|
-
const current = data?.state?.name;
|
|
123
|
-
if (current !== trigger.stateTo)
|
|
124
|
-
return false;
|
|
125
|
-
const updatedTo = webhook.payload.updatedFrom;
|
|
126
|
-
if (!updatedTo || (updatedTo.state === undefined && updatedTo.stateId === undefined))
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
if (trigger.stateFrom) {
|
|
130
|
-
const updatedFrom = webhook.payload.updatedFrom;
|
|
131
|
-
const previous = updatedFrom?.state?.name;
|
|
132
|
-
if (previous !== trigger.stateFrom)
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
export function jobMatchesWebhook(job, webhook) {
|
|
138
|
-
const trigger = job.trigger;
|
|
139
|
-
if (!trigger)
|
|
140
|
-
return false;
|
|
141
|
-
if (trigger.type === 'github_event')
|
|
142
|
-
return githubTriggerMatches(trigger, webhook);
|
|
143
|
-
if (trigger.type === 'linear_event')
|
|
144
|
-
return linearTriggerMatches(trigger, webhook);
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
export function matchJobsToWebhook(jobs, webhook) {
|
|
148
|
-
return jobs.filter((job) => job.enabled !== false && jobRunsOnThisDevice(job) && jobMatchesWebhook(job, webhook));
|
|
149
|
-
}
|
|
150
|
-
class WebhookDispatchError extends Error {
|
|
151
|
-
fired;
|
|
152
|
-
failures;
|
|
153
|
-
constructor(message, fired, failures) {
|
|
154
|
-
super(message);
|
|
155
|
-
this.fired = fired;
|
|
156
|
-
this.failures = failures;
|
|
157
|
-
this.name = 'WebhookDispatchError';
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
export async function fireWebhookJobs(webhook, options = {}) {
|
|
161
|
-
const jobs = options.jobs ?? listJobs();
|
|
162
|
-
const dispatch = options.dispatch ?? executeJobDetached;
|
|
163
|
-
const matched = matchJobsToWebhook(jobs, webhook);
|
|
164
|
-
const fired = [];
|
|
165
|
-
const failures = [];
|
|
166
|
-
for (const job of matched) {
|
|
167
|
-
emit('webhook.matched', { source: webhook.source, event: webhook.event, jobName: job.name });
|
|
168
|
-
try {
|
|
169
|
-
const meta = await dispatch(job);
|
|
170
|
-
const firedJob = { jobName: job.name, runId: meta.runId };
|
|
171
|
-
fired.push(firedJob);
|
|
172
|
-
}
|
|
173
|
-
catch (err) {
|
|
174
|
-
failures.push({ jobName: job.name, error: err });
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (failures.length > 0) {
|
|
178
|
-
throw new WebhookDispatchError(`failed to dispatch ${failures.length} webhook routine(s): ${failures.map((f) => f.jobName).join(', ')}`, fired, failures);
|
|
179
|
-
}
|
|
180
|
-
return fired;
|
|
181
|
-
}
|