@phnx-labs/agents-cli 1.22.42 → 1.22.43
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 +72 -0
- package/README.md +1 -1
- package/dist/bin/agents +0 -0
- package/dist/bootstrap.js +25 -7
- package/dist/cli/command-registry.d.ts +0 -3
- package/dist/cli/command-registry.js +0 -8
- package/dist/commands/alias.d.ts +7 -4
- package/dist/commands/alias.js +33 -8
- package/dist/commands/auth.js +7 -3
- package/dist/commands/computer.js +20 -6
- package/dist/commands/daemon.js +1 -1
- package/dist/commands/doctor.d.ts +4 -2
- package/dist/commands/doctor.js +20 -5
- package/dist/commands/exec.js +3 -2
- package/dist/commands/feed.js +1 -30
- package/dist/commands/harness.js +3 -3
- package/dist/commands/monitors.js +1 -1
- package/dist/commands/org.js +9 -8
- package/dist/commands/profiles.js +2 -2
- package/dist/commands/routines.js +43 -25
- package/dist/commands/sessions-picker.js +124 -122
- package/dist/commands/setup.js +5 -1
- package/dist/commands/snapshot.d.ts +1 -1
- package/dist/commands/snapshot.js +4 -4
- package/dist/commands/status.d.ts +4 -2
- package/dist/commands/status.js +10 -7
- package/dist/commands/sync.d.ts +1 -0
- package/dist/commands/sync.js +29 -2
- package/dist/commands/view.js +6 -0
- package/dist/commands/webhook.js +1 -1
- package/dist/lib/accounting/rotate.d.ts +5 -3
- package/dist/lib/accounting/rotate.js +36 -7
- package/dist/lib/accounting/usage.d.ts +18 -4
- package/dist/lib/accounting/usage.js +138 -27
- package/dist/lib/agent-spec/agents.d.ts +7 -7
- package/dist/lib/agent-spec/agents.js +15 -15
- package/dist/lib/cloud/rush.d.ts +0 -15
- package/dist/lib/cloud/rush.js +0 -35
- package/dist/lib/crabbox/runtimes.d.ts +6 -2
- package/dist/lib/crabbox/runtimes.js +21 -5
- package/dist/lib/daemon/daemon.js +86 -58
- package/dist/lib/daemon/runner.d.ts +18 -1
- package/dist/lib/daemon/runner.js +105 -11
- package/dist/lib/devices/doctor-findings.js +1 -1
- package/dist/lib/devices/health-report.js +1 -1
- package/dist/lib/drift-sync.d.ts +1 -1
- package/dist/lib/drift-sync.js +2 -2
- package/dist/lib/drift.d.ts +1 -1
- package/dist/lib/exec.js +13 -3
- package/dist/lib/format.d.ts +9 -0
- package/dist/lib/format.js +16 -0
- package/dist/lib/github/pr-mergeable.d.ts +49 -0
- package/dist/lib/github/pr-mergeable.js +157 -0
- package/dist/lib/github/pr-verdict.d.ts +67 -0
- package/dist/lib/github/pr-verdict.js +72 -0
- package/dist/lib/harness/adapter.d.ts +6 -5
- package/dist/lib/hosts/passthrough.d.ts +10 -0
- package/dist/lib/hosts/passthrough.js +28 -6
- package/dist/lib/hosts/session-index.js +1 -1
- package/dist/lib/installations/shims.js +1 -1
- package/dist/lib/installations/versions.d.ts +40 -0
- package/dist/lib/installations/versions.js +57 -2
- package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
- package/dist/lib/menubar/install-menubar.js +19 -8
- package/dist/lib/monitors/config.d.ts +2 -2
- package/dist/lib/monitors/config.js +3 -2
- package/dist/lib/origin-machine.d.ts +18 -0
- package/dist/lib/origin-machine.js +34 -0
- package/dist/lib/perf/db.js +1 -1
- package/dist/lib/perf/spool.js +1 -1
- package/dist/lib/profiles.d.ts +7 -0
- package/dist/lib/profiles.js +26 -1
- package/dist/lib/sandbox.d.ts +24 -0
- package/dist/lib/sandbox.js +101 -0
- package/dist/lib/scheduling/routines.d.ts +18 -9
- package/dist/lib/scheduling/routines.js +16 -8
- package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
- package/dist/lib/secrets/agent.js +9 -1
- package/dist/lib/secrets/index.js +1 -1
- package/dist/lib/secrets/list-filter.js +1 -1
- package/dist/lib/service-manifest.d.ts +20 -0
- package/dist/lib/service-manifest.js +34 -0
- package/dist/lib/session/cloud.js +1 -1
- package/dist/lib/session/db.js +1 -1
- package/dist/lib/session/fork.js +1 -1
- package/dist/lib/session/live-metadata.js +1 -1
- package/dist/lib/session/origin-machine.d.ts +1 -18
- package/dist/lib/session/origin-machine.js +4 -34
- package/dist/lib/session/relative-time.d.ts +1 -44
- package/dist/lib/session/relative-time.js +4 -120
- package/dist/lib/session/remote-list.js +1 -1
- package/dist/lib/session/remote.js +2 -2
- package/dist/lib/session/short-id.d.ts +1 -17
- package/dist/lib/session/short-id.js +4 -20
- package/dist/lib/session/width.d.ts +1 -29
- package/dist/lib/session/width.js +4 -101
- package/dist/lib/snapshot.d.ts +2 -2
- package/dist/lib/snapshot.js +1 -1
- package/dist/lib/startup/command-registry.d.ts +4 -1
- package/dist/lib/startup/command-registry.js +11 -4
- package/dist/lib/teams/placement-probe.js +1 -1
- package/dist/lib/teams/scheduler.js +1 -1
- package/dist/lib/text/relative-time.d.ts +44 -0
- package/dist/lib/text/relative-time.js +120 -0
- package/dist/lib/text/short-id.d.ts +17 -0
- package/dist/lib/text/short-id.js +20 -0
- package/dist/lib/text/width.d.ts +29 -0
- package/dist/lib/text/width.js +101 -0
- package/dist/lib/triggers/handlers.d.ts +7 -0
- package/dist/lib/triggers/handlers.js +8 -0
- package/dist/lib/triggers/webhook.d.ts +1 -0
- package/dist/lib/triggers/webhook.js +2 -1
- package/dist/lib/view-types.d.ts +4 -0
- package/package.json +1 -1
- package/dist/commands/tickets.d.ts +0 -2
- package/dist/commands/tickets.js +0 -43
- package/dist/lib/observe-aliases.d.ts +0 -30
- package/dist/lib/observe-aliases.js +0 -38
- package/dist/lib/tickets/list.d.ts +0 -53
- package/dist/lib/tickets/list.js +0 -153
package/dist/lib/tickets/list.js
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { execFile } from 'node:child_process';
|
|
2
|
-
import { promisify } from 'node:util';
|
|
3
|
-
const run = promisify(execFile);
|
|
4
|
-
const AGENT_ASSIGNEE = /^(claude|codex|gemini|cursor|opencode|antigravity|grok|kimi|droid)$/i;
|
|
5
|
-
function assigneeKind(name) {
|
|
6
|
-
if (!name)
|
|
7
|
-
return undefined;
|
|
8
|
-
return AGENT_ASSIGNEE.test(name.trim()) ? 'agent' : 'user';
|
|
9
|
-
}
|
|
10
|
-
function imageUrls(...bodies) {
|
|
11
|
-
const urls = new Set();
|
|
12
|
-
const pattern = /!\[[^\]]*\]\(\s*(https?:\/\/[^)\s]+)|<img\b[^>]*?\bsrc\s*=\s*["'](https?:\/\/[^"']+)/gi;
|
|
13
|
-
for (const body of bodies) {
|
|
14
|
-
if (typeof body !== 'string')
|
|
15
|
-
continue;
|
|
16
|
-
let match;
|
|
17
|
-
while ((match = pattern.exec(body)))
|
|
18
|
-
urls.add(match[1] || match[2]);
|
|
19
|
-
}
|
|
20
|
-
return urls.size > 0 ? [...urls] : undefined;
|
|
21
|
-
}
|
|
22
|
-
function errorMessage(error) {
|
|
23
|
-
if (error instanceof Error)
|
|
24
|
-
return error.message;
|
|
25
|
-
return String(error);
|
|
26
|
-
}
|
|
27
|
-
async function readLinear(cwd) {
|
|
28
|
-
const { stdout } = await run('linear', ['tasks', '--json'], {
|
|
29
|
-
cwd,
|
|
30
|
-
timeout: 15_000,
|
|
31
|
-
maxBuffer: 16 * 1024 * 1024,
|
|
32
|
-
});
|
|
33
|
-
const data = JSON.parse(stdout);
|
|
34
|
-
const cycle = data?.cycle;
|
|
35
|
-
const cycleInfo = cycle?.startsAt && cycle?.endsAt
|
|
36
|
-
? { name: String(cycle.name ?? ''), startsAt: String(cycle.startsAt), endsAt: String(cycle.endsAt) }
|
|
37
|
-
: null;
|
|
38
|
-
const priority = {
|
|
39
|
-
1: 'urgent',
|
|
40
|
-
2: 'high',
|
|
41
|
-
3: 'medium',
|
|
42
|
-
4: 'low',
|
|
43
|
-
};
|
|
44
|
-
const tickets = (Array.isArray(data?.issues) ? data.issues : []).map((issue) => {
|
|
45
|
-
const labels = (issue.labels?.nodes ?? []).map((label) => String(label.name));
|
|
46
|
-
const comments = (issue.comments?.nodes ?? []).map((comment) => ({
|
|
47
|
-
body: String(comment.body ?? ''),
|
|
48
|
-
createdAt: comment.createdAt ? String(comment.createdAt) : undefined,
|
|
49
|
-
author: comment.user?.name ? String(comment.user.name) : undefined,
|
|
50
|
-
}));
|
|
51
|
-
const stateType = String(issue.state?.type ?? '');
|
|
52
|
-
const status = stateType === 'started'
|
|
53
|
-
? 'in_progress'
|
|
54
|
-
: stateType === 'completed' || stateType === 'canceled'
|
|
55
|
-
? 'done'
|
|
56
|
-
: 'todo';
|
|
57
|
-
const identifier = String(issue.identifier ?? issue.id ?? '');
|
|
58
|
-
return {
|
|
59
|
-
id: `linear:${identifier}`,
|
|
60
|
-
source: 'linear',
|
|
61
|
-
title: String(issue.title ?? ''),
|
|
62
|
-
description: issue.description ? String(issue.description) : undefined,
|
|
63
|
-
status,
|
|
64
|
-
priority: priority[Number(issue.priority)],
|
|
65
|
-
metadata: {
|
|
66
|
-
identifier,
|
|
67
|
-
url: issue.url ? String(issue.url) : undefined,
|
|
68
|
-
labels,
|
|
69
|
-
assignee: issue.assignee?.name ? String(issue.assignee.name) : undefined,
|
|
70
|
-
assigneeKind: assigneeKind(issue.assignee?.name),
|
|
71
|
-
state: issue.state?.name ? String(issue.state.name) : undefined,
|
|
72
|
-
createdAt: issue.createdAt ? String(issue.createdAt) : undefined,
|
|
73
|
-
dueDate: issue.dueDate ? String(issue.dueDate) : undefined,
|
|
74
|
-
project: issue.project?.name ? String(issue.project.name) : undefined,
|
|
75
|
-
comments,
|
|
76
|
-
images: imageUrls(issue.description, ...comments.map(comment => comment.body)),
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
return { tickets, cycleInfo };
|
|
81
|
-
}
|
|
82
|
-
async function readGithub(cwd, assignedOnly) {
|
|
83
|
-
const repo = (await run('gh', ['repo', 'view', '--json', 'nameWithOwner', '-q', '.nameWithOwner'], {
|
|
84
|
-
cwd,
|
|
85
|
-
timeout: 5_000,
|
|
86
|
-
})).stdout.trim();
|
|
87
|
-
if (!repo)
|
|
88
|
-
throw new Error('No GitHub repository resolved for this workspace.');
|
|
89
|
-
const args = [
|
|
90
|
-
'issue', 'list', '--repo', repo, '--state', 'open', '--limit', '50',
|
|
91
|
-
'--json', 'number,title,state,labels,assignees,url,body,createdAt',
|
|
92
|
-
];
|
|
93
|
-
if (assignedOnly)
|
|
94
|
-
args.push('--assignee', '@me');
|
|
95
|
-
const { stdout } = await run('gh', args, { cwd, timeout: 15_000, maxBuffer: 16 * 1024 * 1024 });
|
|
96
|
-
const issues = JSON.parse(stdout);
|
|
97
|
-
return issues.map((issue) => {
|
|
98
|
-
const assignee = issue.assignees?.[0]?.login ? String(issue.assignees[0].login) : undefined;
|
|
99
|
-
const number = Number(issue.number);
|
|
100
|
-
return {
|
|
101
|
-
id: `github:${number}`,
|
|
102
|
-
source: 'github',
|
|
103
|
-
title: String(issue.title ?? ''),
|
|
104
|
-
description: issue.body ? String(issue.body) : undefined,
|
|
105
|
-
status: String(issue.state ?? '').toLowerCase() === 'closed' ? 'done' : 'todo',
|
|
106
|
-
metadata: {
|
|
107
|
-
identifier: `#${number}`,
|
|
108
|
-
url: issue.url ? String(issue.url) : undefined,
|
|
109
|
-
labels: (issue.labels ?? []).map((label) => String(label.name)),
|
|
110
|
-
assignee,
|
|
111
|
-
assigneeKind: assigneeKind(assignee),
|
|
112
|
-
state: String(issue.state ?? '').toLowerCase(),
|
|
113
|
-
createdAt: issue.createdAt ? String(issue.createdAt) : undefined,
|
|
114
|
-
repo,
|
|
115
|
-
images: imageUrls(issue.body),
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
export async function listTickets(options) {
|
|
121
|
-
const result = {
|
|
122
|
-
tickets: [],
|
|
123
|
-
cycleInfo: null,
|
|
124
|
-
sources: {
|
|
125
|
-
linear: { available: false },
|
|
126
|
-
github: { available: false },
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
const [linear, github] = await Promise.all([
|
|
130
|
-
options.linear
|
|
131
|
-
? readLinear(options.cwd).then(value => ({ ok: true, value })).catch(error => ({ ok: false, error }))
|
|
132
|
-
: Promise.resolve(null),
|
|
133
|
-
options.github
|
|
134
|
-
? readGithub(options.cwd, options.githubAssignedOnly).then(value => ({ ok: true, value })).catch(error => ({ ok: false, error }))
|
|
135
|
-
: Promise.resolve(null),
|
|
136
|
-
]);
|
|
137
|
-
if (linear?.ok) {
|
|
138
|
-
result.sources.linear.available = true;
|
|
139
|
-
result.tickets.push(...linear.value.tickets);
|
|
140
|
-
result.cycleInfo = linear.value.cycleInfo;
|
|
141
|
-
}
|
|
142
|
-
else if (linear) {
|
|
143
|
-
result.sources.linear.error = errorMessage(linear.error);
|
|
144
|
-
}
|
|
145
|
-
if (github?.ok) {
|
|
146
|
-
result.sources.github.available = true;
|
|
147
|
-
result.tickets.push(...github.value);
|
|
148
|
-
}
|
|
149
|
-
else if (github) {
|
|
150
|
-
result.sources.github.error = errorMessage(github.error);
|
|
151
|
-
}
|
|
152
|
-
return result;
|
|
153
|
-
}
|