@phnx-labs/agents-cli 1.23.19 → 1.23.21
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 +29 -0
- package/README.md +1 -1
- package/dist/commands/exec.js +1 -1
- package/dist/lib/accounting/account-pool-collect.d.ts +2 -2
- package/dist/lib/accounting/account-pool-collect.js +4 -4
- package/dist/lib/accounting/account-pool.d.ts +1 -1
- package/dist/lib/accounting/account-pool.js +3 -1
- package/dist/lib/github/open-prs.d.ts +0 -2
- package/dist/lib/github/open-prs.js +17 -35
- package/dist/lib/github/project-prs.d.ts +5 -0
- package/dist/lib/github/project-prs.js +73 -32
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/session/recovery.d.ts +1 -1
- package/dist/lib/session/recovery.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.23.21
|
|
4
|
+
|
|
5
|
+
- **`agents projects prs` reads open PRs in one GraphQL query per repository or owner.**
|
|
6
|
+
The project read and the all-orgs read behind AGI Menu's GitHub tab used to read each
|
|
7
|
+
open PR three more times (`pulls/{n}`, check-runs, status), one `gh` process per call.
|
|
8
|
+
Each page of 100 PRs now carries the head, merge state and check rollup for 2 GraphQL
|
|
9
|
+
points. Measured on one Mac with 1.23.19: a 101-PR project read took 43.8 s, 20.7
|
|
10
|
+
CPU-seconds and 304 `gh` processes; the all-orgs read of 201 PRs took 76.6 s, 32.0
|
|
11
|
+
CPU-seconds and 527 processes. The JSON fields and the newest-first order are
|
|
12
|
+
unchanged. One tradeoff: if the shared GraphQL budget is exhausted, a repository's
|
|
13
|
+
list fails (`error`, `partial`) instead of showing PRs without CI. Source: `cli/src/lib/github/project-prs.ts`,
|
|
14
|
+
`cli/src/lib/github/open-prs.ts`.
|
|
15
|
+
|
|
16
|
+
- **AGI Menu 1.18.1.** The menubar floor moves to 1.18.1: Home's pull requests and the GitHub tab draw their last list at once after a relaunch, the menu-bar badge is redrawn only when it changes, and the snapshot poll runs every 15 minutes while the menu is closed. Source: `cli/src/lib/helper-versions.ts`.
|
|
17
|
+
|
|
18
|
+
## 1.23.20
|
|
19
|
+
|
|
20
|
+
- **Balanced and available rotation never pick an API-key account (owner decision 2026-10-12).**
|
|
21
|
+
A provider account whose credential is an `api-key` or `bearer-token` (OpenRouter,
|
|
22
|
+
an Anthropic or OpenAI API key, LiteLLM, a proxy) bills per token, yet it joined the
|
|
23
|
+
automatic pool beside subscription logins (RUSH-3182). For example, `agents run claude`
|
|
24
|
+
could land on `openrouter-primary` and run Claude through OpenRouter at API prices.
|
|
25
|
+
Only a `setup-token` provider account now joins the pool, beside native logins.
|
|
26
|
+
An api-key account still runs when named: `--account <name>`, a binding, or
|
|
27
|
+
`agents accounts default`. A harness whose only accounts are API keys gets no
|
|
28
|
+
automatic pick from them.
|
|
29
|
+
Source: `cli/src/lib/accounting/account-pool.ts`, `cli/src/lib/accounting/account-pool.test.ts`,
|
|
30
|
+
`cli/src/lib/accounting/account-pool-collect.test.ts`.
|
|
31
|
+
|
|
3
32
|
## 1.23.19
|
|
4
33
|
|
|
5
34
|
- **`agents projects prs <project> --json` carries `mergeable` and `mergeableState` (PHNX-4326).**
|
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ agents run claude@ # pick the device for this run
|
|
|
213
213
|
agents run claude#@ # pick the account, then the device
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
`--strategy balanced` spreads work across available versions of the same agent -- useful when you have multiple accounts and want to avoid burning through one. When a Claude run reports a session limit, agents-cli records the stated reset time, shows `session-limited` in `agents view`, and excludes that account until the reset. When every account is rate-limited, the run exits nonzero naming each excluded account and the earliest window reset (use `--strategy pinned` to force a rate-limited default) -- it never launches into an exhausted account. A logged-out default is never forced: unpinned dispatch picks a signed-in version on the execution device instead of dying on a credential-less default home.
|
|
216
|
+
`--strategy balanced` spreads work across available versions of the same agent -- useful when you have multiple accounts and want to avoid burning through one. It picks only subscription logins and setup-tokens; an API-key account (OpenRouter, an Anthropic or OpenAI key) bills per token, so it runs only when you name it with `--account`. When a Claude run reports a session limit, agents-cli records the stated reset time, shows `session-limited` in `agents view`, and excludes that account until the reset. When every account is rate-limited, the run exits nonzero naming each excluded account and the earliest window reset (use `--strategy pinned` to force a rate-limited default) -- it never launches into an exhausted account. A logged-out default is never forced: unpinned dispatch picks a signed-in version on the execution device instead of dying on a credential-less default home.
|
|
217
217
|
|
|
218
218
|
### Don't care which harness? `agents run auto`
|
|
219
219
|
|
package/dist/commands/exec.js
CHANGED
|
@@ -605,7 +605,7 @@ ${formatModeSupportTable().split('\n').map((line) => ` ${line}`).join('\n
|
|
|
605
605
|
given. --cloud is mutually exclusive with --device/--lease and with
|
|
606
606
|
local-run flags (--loop, --resume, --secrets, --terminal, …).
|
|
607
607
|
|
|
608
|
-
Resume: --resume <id> resolves full IDs locally first, then fleet-wide, and recovers on the source device with its cwd/mode. Resume preserves the conversation account and uses the installed binary; starting a new conversation from archived context requires an explicit choice. With auto as the agent (agents run auto --resume <id>) the harness is inferred from the session; a named agent must match it. A bare --resume opens the session picker for the last 30 days of this project (up to 200 rows); --all widens it to every directory and lifts the 30d window, --teams adds team-spawned sessions, --since <time> and -n/--limit <n> set the window and row cap. These four only filter the picker: they are refused next to --resume <id> or without --resume.
|
|
608
|
+
Resume: --resume <id> resolves full IDs locally first, then fleet-wide, and recovers on the source device with its cwd/mode. Resume preserves the conversation account (an API-key account only when named with --account; otherwise it continues on a subscription account) and uses the installed binary; starting a new conversation from archived context requires an explicit choice. With auto as the agent (agents run auto --resume <id>) the harness is inferred from the session; a named agent must match it. A bare --resume opens the session picker for the last 30 days of this project (up to 200 rows); --all widens it to every directory and lifts the 30d window, --teams adds team-spawned sessions, --since <time> and -n/--limit <n> set the window and row cap. These four only filter the picker: they are refused next to --resume <id> or without --resume.
|
|
609
609
|
|
|
610
610
|
Passthrough: everything after -- is forwarded verbatim to the underlying agent CLI.
|
|
611
611
|
agents run kimi -- --plan --some-native-flag value
|
|
@@ -6,5 +6,5 @@ export interface RunCandidateInputs {
|
|
|
6
6
|
records: RegistryAccountRecord[];
|
|
7
7
|
runVersion: string | undefined;
|
|
8
8
|
}
|
|
9
|
-
export declare function foldRegistryCandidates(agent: AgentId, inputs: RunCandidateInputs): RotateCandidate[];
|
|
10
|
-
export declare function collectRunCandidatesForRun(agent: AgentId): Promise<RotateCandidate[]>;
|
|
9
|
+
export declare function foldRegistryCandidates(agent: AgentId, inputs: RunCandidateInputs, includeKeyed?: boolean): RotateCandidate[];
|
|
10
|
+
export declare function collectRunCandidatesForRun(agent: AgentId, includeKeyed?: boolean): Promise<RotateCandidate[]>;
|
|
@@ -15,12 +15,12 @@ function localRegistryRecords() {
|
|
|
15
15
|
throw err;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
export function foldRegistryCandidates(agent, inputs) {
|
|
18
|
+
export function foldRegistryCandidates(agent, inputs, includeKeyed = false) {
|
|
19
19
|
const { native, records, runVersion } = inputs;
|
|
20
20
|
if (!runVersion)
|
|
21
21
|
return native;
|
|
22
22
|
const seen = new Set(native.filter((c) => c.accountKey).map((c) => c.accountKey));
|
|
23
|
-
const extra = registryPoolCandidates(records, agent)
|
|
23
|
+
const extra = registryPoolCandidates(records, agent, includeKeyed)
|
|
24
24
|
.filter((r) => !seen.has(r.accountKey))
|
|
25
25
|
.map((r) => ({
|
|
26
26
|
agent,
|
|
@@ -42,8 +42,8 @@ export function foldRegistryCandidates(agent, inputs) {
|
|
|
42
42
|
}));
|
|
43
43
|
return [...native, ...extra];
|
|
44
44
|
}
|
|
45
|
-
export async function collectRunCandidatesForRun(agent) {
|
|
45
|
+
export async function collectRunCandidatesForRun(agent, includeKeyed = false) {
|
|
46
46
|
const native = await collectRunCandidates(agent);
|
|
47
47
|
const runVersion = getGlobalDefault(agent) ?? listInstalledVersions(agent)[0];
|
|
48
|
-
return foldRegistryCandidates(agent, { native, records: localRegistryRecords(), runVersion });
|
|
48
|
+
return foldRegistryCandidates(agent, { native, records: localRegistryRecords(), runVersion }, includeKeyed);
|
|
49
49
|
}
|
|
@@ -16,5 +16,5 @@ interface RegistryAccountInput {
|
|
|
16
16
|
auth: AccountAuthKind;
|
|
17
17
|
secretPresent: boolean;
|
|
18
18
|
}
|
|
19
|
-
export declare function registryPoolCandidates(records: RegistryAccountRecord[], agent: AgentId): RegistryAccountInput[];
|
|
19
|
+
export declare function registryPoolCandidates(records: RegistryAccountRecord[], agent: AgentId, includeKeyed?: boolean): RegistryAccountInput[];
|
|
20
20
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { providerAuthenticatesHarness } from '../account-provider-registry.js';
|
|
2
|
-
export function registryPoolCandidates(records, agent) {
|
|
2
|
+
export function registryPoolCandidates(records, agent, includeKeyed = false) {
|
|
3
3
|
const out = [];
|
|
4
4
|
for (const r of records) {
|
|
5
|
+
if (r.auth !== 'setup-token' && !includeKeyed)
|
|
6
|
+
continue;
|
|
5
7
|
if (!providerAuthenticatesHarness(r.provider, r.auth, agent))
|
|
6
8
|
continue;
|
|
7
9
|
out.push({
|
|
@@ -30,8 +30,6 @@ export interface OpenPrsOptions {
|
|
|
30
30
|
owners?: string[];
|
|
31
31
|
repo?: string;
|
|
32
32
|
number?: number;
|
|
33
|
-
cacheDir?: string;
|
|
34
|
-
nowMs?: number;
|
|
35
33
|
}
|
|
36
34
|
export declare const SEARCH_RESULT_CAP = 1000;
|
|
37
35
|
export declare function listViewerOwners(viewer: string | null, gh?: GhExec): Promise<string[]>;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { ghExec, canonicalizeRepo, projectRepoSlugs } from './pr-mergeable.js';
|
|
2
|
-
import { CiErrors,
|
|
3
|
-
import { getCacheDir } from '../state.js';
|
|
2
|
+
import { CiErrors, PR_NODE_FIELDS, enrichPr, fetchOnePr, fetchViewer, ghFailure, prFromNode, readRepoMergeAbility, } from './project-prs.js';
|
|
4
3
|
const NEEDS_ME_RANK = { review: 0, failing: 1, conflicts: 2 };
|
|
5
4
|
export const SEARCH_RESULT_CAP = 1000;
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
5
|
+
const SEARCH_QUERY = `query($q: String!, $endCursor: String) {
|
|
6
|
+
search(query: $q, type: ISSUE, first: 100, after: $endCursor) {
|
|
7
|
+
pageInfo { hasNextPage endCursor }
|
|
8
|
+
nodes { ... on PullRequest { ${PR_NODE_FIELDS} } }
|
|
9
|
+
}
|
|
10
|
+
}`;
|
|
13
11
|
async function searchOpenPrs(qualifier, gh) {
|
|
14
|
-
const q = encodeURIComponent(`is:pr is:open archived:false ${qualifier}`);
|
|
15
12
|
const out = await gh([
|
|
16
|
-
'api',
|
|
13
|
+
'api', 'graphql', '--paginate',
|
|
14
|
+
'-f', `q=is:pr is:open archived:false sort:updated-desc ${qualifier}`, '-f', `query=${SEARCH_QUERY}`,
|
|
15
|
+
'--jq', '.data.search.nodes[] | select(.number)',
|
|
17
16
|
]);
|
|
18
|
-
return
|
|
17
|
+
return out.split('\n').filter((l) => l.trim()).map((l) => prFromNode(JSON.parse(l)));
|
|
19
18
|
}
|
|
20
19
|
export async function listViewerOwners(viewer, gh = ghExec) {
|
|
21
20
|
const orgs = (await gh(['api', 'user/orgs', '--paginate', '--cache', '1h', '--jq', '.[].login']))
|
|
@@ -113,39 +112,22 @@ export async function buildOpenPrs(defs, opts = {}, gh = ghExec) {
|
|
|
113
112
|
prs.set(pr.number, pr);
|
|
114
113
|
bySlug.set(slug, prs);
|
|
115
114
|
}
|
|
116
|
-
const cacheDir = opts.cacheDir ?? getCacheDir();
|
|
117
|
-
const rollups = new KeyedCache(cacheDir, 'project-pr-ci.json', '@', isCachedRollup);
|
|
118
|
-
const nowMs = opts.nowMs ?? Date.now();
|
|
119
115
|
const projects = await projectMap;
|
|
120
|
-
const
|
|
121
|
-
for (const slug of bySlug.keys())
|
|
122
|
-
readers.set(slug, { slug, gh, rollups, errors: new CiErrors(), nowMs, reads: new Map() });
|
|
116
|
+
const errors = new Map([...bySlug.keys()].map((slug) => [slug, new CiErrors()]));
|
|
123
117
|
const merges = new Map([...bySlug.keys()].map((slug) => [slug, readRepoMergeAbility(slug, gh).catch((err) => {
|
|
124
|
-
|
|
118
|
+
errors.get(slug).record(err);
|
|
125
119
|
return null;
|
|
126
120
|
})]));
|
|
127
|
-
const listed = [...bySlug].flatMap(([slug, prs]) => [...prs.values()].map((pr) => ({ slug, pr })));
|
|
128
|
-
const read = await mapBounded(listed, 8, async ({ slug, pr: row }) => {
|
|
129
|
-
const ci = readers.get(slug);
|
|
130
|
-
let pr = row;
|
|
131
|
-
try {
|
|
132
|
-
pr = await fetchOnePr(slug, row.number, gh, '60s');
|
|
133
|
-
}
|
|
134
|
-
catch (err) {
|
|
135
|
-
ci.errors.record(err);
|
|
136
|
-
}
|
|
137
|
-
const ciSummary = await readCi(ci, pr.headSha || null);
|
|
138
|
-
return { slug, pr: withNeeds({ ...pr, ...ciSummary }, viewer, requested.has(key(slug, pr.number))) };
|
|
139
|
-
});
|
|
140
121
|
const repositories = await Promise.all([...bySlug.keys()].map(async (slug) => ({
|
|
141
122
|
slug,
|
|
142
123
|
projects: projects.get(slug.toLowerCase()) ?? [],
|
|
143
124
|
merge: await merges.get(slug),
|
|
144
|
-
pullRequests:
|
|
145
|
-
|
|
125
|
+
pullRequests: [...bySlug.get(slug).values()]
|
|
126
|
+
.map((pr) => withNeeds(pr, viewer, requested.has(key(slug, pr.number))))
|
|
127
|
+
.sort(compareOpenPrs),
|
|
128
|
+
ciError: errors.get(slug).message,
|
|
146
129
|
})));
|
|
147
130
|
repositories.sort(compareRepos);
|
|
148
|
-
rollups.save();
|
|
149
131
|
const owners = ownerReads.map((r) => r.owner);
|
|
150
132
|
return {
|
|
151
133
|
viewer,
|
|
@@ -94,6 +94,11 @@ export interface ProjectPrsOptions {
|
|
|
94
94
|
number?: number;
|
|
95
95
|
}
|
|
96
96
|
export declare function rowToProjectPr(row: Record<string, unknown>): ProjectPr;
|
|
97
|
+
export declare const PR_NODE_FIELDS = "\n number title url isDraft state createdAt updatedAt body\n author { __typename login avatarUrl }\n repository { nameWithOwner }\n headRefName baseRefName headRefOid mergeable mergeStateStatus\n autoMergeRequest { enabledBy { login } mergeMethod }\n commits(last: 1) { nodes { commit { statusCheckRollup { state contexts(first: 100) { pageInfo { hasNextPage } nodes {\n __typename\n ... on CheckRun { name status conclusion detailsUrl }\n ... on StatusContext { context state targetUrl }\n } } } } } }";
|
|
98
|
+
export declare function prFromNode(node: Record<string, unknown>): {
|
|
99
|
+
slug: string;
|
|
100
|
+
pr: ProjectPr;
|
|
101
|
+
};
|
|
97
102
|
export declare function listOpenPrs(repo: string, gh?: GhExec): Promise<ProjectPr[]>;
|
|
98
103
|
export declare function fetchOnePr(repo: string, number: number, gh?: GhExec, cache?: string): Promise<ProjectPr>;
|
|
99
104
|
export declare function fetchReviewAndHead(repo: string, number: number, gh?: GhExec): Promise<{
|
|
@@ -50,16 +50,75 @@ export function rowToProjectPr(row) {
|
|
|
50
50
|
: null,
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
+
export const PR_NODE_FIELDS = `
|
|
54
|
+
number title url isDraft state createdAt updatedAt body
|
|
55
|
+
author { __typename login avatarUrl }
|
|
56
|
+
repository { nameWithOwner }
|
|
57
|
+
headRefName baseRefName headRefOid mergeable mergeStateStatus
|
|
58
|
+
autoMergeRequest { enabledBy { login } mergeMethod }
|
|
59
|
+
commits(last: 1) { nodes { commit { statusCheckRollup { state contexts(first: 100) { pageInfo { hasNextPage } nodes {
|
|
60
|
+
__typename
|
|
61
|
+
... on CheckRun { name status conclusion detailsUrl }
|
|
62
|
+
... on StatusContext { context state targetUrl }
|
|
63
|
+
} } } } } }`;
|
|
64
|
+
const OPEN_PRS_QUERY = `query($owner: String!, $name: String!, $endCursor: String) {
|
|
65
|
+
repository(owner: $owner, name: $name) {
|
|
66
|
+
pullRequests(states: OPEN, first: 100, after: $endCursor, orderBy: {field: CREATED_AT, direction: DESC}) {
|
|
67
|
+
pageInfo { hasNextPage endCursor }
|
|
68
|
+
nodes { ${PR_NODE_FIELDS} }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}`;
|
|
72
|
+
const MERGEABLE = { MERGEABLE: true, CONFLICTING: false };
|
|
73
|
+
function rollupFromContexts(contexts) {
|
|
74
|
+
const byName = new Map();
|
|
75
|
+
for (const c of contexts) {
|
|
76
|
+
if (c.__typename !== 'StatusContext')
|
|
77
|
+
continue;
|
|
78
|
+
const name = String(c.context ?? '');
|
|
79
|
+
if (!byName.has(name))
|
|
80
|
+
byName.set(name, { name, state: String(c.state ?? ''), link: String(c.targetUrl ?? '') });
|
|
81
|
+
}
|
|
82
|
+
for (const c of contexts) {
|
|
83
|
+
if (c.__typename !== 'CheckRun')
|
|
84
|
+
continue;
|
|
85
|
+
const name = String(c.name ?? '');
|
|
86
|
+
byName.set(name, { name, status: String(c.status ?? ''), conclusion: String(c.conclusion ?? ''), link: String(c.detailsUrl ?? '') });
|
|
87
|
+
}
|
|
88
|
+
return [...byName.values()];
|
|
89
|
+
}
|
|
90
|
+
export function prFromNode(node) {
|
|
91
|
+
const rec = (v) => (isRecord(v) ? v : {});
|
|
92
|
+
const author = rec(node.author);
|
|
93
|
+
const auto = isRecord(node.autoMergeRequest) ? node.autoMergeRequest : null;
|
|
94
|
+
const commits = rec(node.commits).nodes;
|
|
95
|
+
const commit = rec(rec(Array.isArray(commits) ? commits[0] : null).commit);
|
|
96
|
+
const rollup = rec(commit.statusCheckRollup);
|
|
97
|
+
const contexts = rec(rollup.contexts).nodes;
|
|
98
|
+
const truncated = rec(rec(rollup.contexts).pageInfo).hasNextPage === true;
|
|
99
|
+
const pr = rowToProjectPr({
|
|
100
|
+
...node,
|
|
101
|
+
login: `${author.login ?? ''}${author.__typename === 'Bot' ? '[bot]' : ''}`,
|
|
102
|
+
avatarUrl: author.avatarUrl ?? '',
|
|
103
|
+
headSha: node.headRefOid ?? '',
|
|
104
|
+
mergeable: MERGEABLE[String(node.mergeable)] ?? null,
|
|
105
|
+
mergeableState: typeof node.mergeStateStatus === 'string' ? node.mergeStateStatus.toLowerCase() : null,
|
|
106
|
+
autoMerge: auto ? { enabledBy: rec(auto.enabledBy).login ?? '', method: String(auto.mergeMethod ?? '').toLowerCase() } : null,
|
|
107
|
+
});
|
|
108
|
+
const items = rollupFromContexts(Array.isArray(contexts) ? contexts.filter(isRecord) : []);
|
|
109
|
+
const ci = { ...ciFromRollupItems(items) };
|
|
110
|
+
if (truncated && typeof rollup.state === 'string')
|
|
111
|
+
ci.ciState = rollup.state;
|
|
112
|
+
return { slug: String(rec(node.repository).nameWithOwner ?? ''), pr: { ...pr, ...ci } };
|
|
113
|
+
}
|
|
53
114
|
export async function listOpenPrs(repo, gh = ghExec) {
|
|
115
|
+
const [owner, name] = repo.split('/');
|
|
54
116
|
const out = await gh([
|
|
55
|
-
'api',
|
|
56
|
-
`
|
|
57
|
-
'--
|
|
58
|
-
'--cache', '60s',
|
|
59
|
-
'--jq',
|
|
60
|
-
`.[] | ${PR_JQ}`,
|
|
117
|
+
'api', 'graphql', '--paginate',
|
|
118
|
+
'-f', `owner=${owner}`, '-f', `name=${name}`, '-f', `query=${OPEN_PRS_QUERY}`,
|
|
119
|
+
'--jq', '.data.repository.pullRequests.nodes[]',
|
|
61
120
|
]);
|
|
62
|
-
return parseNdjson(out).map(
|
|
121
|
+
return parseNdjson(out).map((node) => prFromNode(node).pr);
|
|
63
122
|
}
|
|
64
123
|
export async function fetchOnePr(repo, number, gh = ghExec, cache) {
|
|
65
124
|
const out = await gh(['api', `repos/${repo}/pulls/${number}`, ...(cache ? ['--cache', cache] : []), '--jq', PR_JQ]);
|
|
@@ -270,16 +329,6 @@ export async function listRecentlyMerged(repo, sinceMs, gh = ghExec) {
|
|
|
270
329
|
}));
|
|
271
330
|
return { merged, truncated };
|
|
272
331
|
}
|
|
273
|
-
async function readMergeState(slug, number, gh, errors) {
|
|
274
|
-
try {
|
|
275
|
-
const { mergeable, mergeableState } = await fetchOnePr(slug, number, gh, '60s');
|
|
276
|
-
return { mergeable, mergeableState };
|
|
277
|
-
}
|
|
278
|
-
catch (err) {
|
|
279
|
-
errors.record(err);
|
|
280
|
-
return {};
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
332
|
async function readMergedDetail(slug, number, gh, details, errors) {
|
|
284
333
|
const hit = details.get(slug, number);
|
|
285
334
|
if (hit)
|
|
@@ -463,20 +512,13 @@ export async function buildProjectPrs(def, opts = {}, gh = ghExec, peers = [], c
|
|
|
463
512
|
? withMergesSince(tag, mergedListed ? merged.map((m) => m.pr) : null, { sinceMs, truncated: mergedRead?.truncated ?? false, base: defaultBranch?.name ?? null })
|
|
464
513
|
: null;
|
|
465
514
|
merged = merged.slice(0, MERGED_LIMIT);
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
readMergedDetail(slug, m.pr.number, gh, details, errors),
|
|
474
|
-
readCi(ci, m.pr.mergeCommitSha),
|
|
475
|
-
]);
|
|
476
|
-
return { ...m.pr, ...(detail ?? {}), ...mergeCi };
|
|
477
|
-
}),
|
|
478
|
-
]);
|
|
479
|
-
pullRequests = pullRequests.map((pr, i) => ({ ...pr, ...openCi[i] }));
|
|
515
|
+
const recentlyMerged = await mapBounded(merged, 8, async (m) => {
|
|
516
|
+
const [detail, mergeCi] = await Promise.all([
|
|
517
|
+
readMergedDetail(slug, m.pr.number, gh, details, errors),
|
|
518
|
+
readCi(ci, m.pr.mergeCommitSha),
|
|
519
|
+
]);
|
|
520
|
+
return { ...m.pr, ...(detail ?? {}), ...mergeCi };
|
|
521
|
+
});
|
|
480
522
|
const { merge, error: mergeError } = await mergeRead;
|
|
481
523
|
if (mergeError !== null)
|
|
482
524
|
errors.record(mergeError);
|
|
@@ -484,7 +526,6 @@ export async function buildProjectPrs(def, opts = {}, gh = ghExec, peers = [], c
|
|
|
484
526
|
details.prune(slug, new Set(mergedListed.map((m) => String(m.pr.number))));
|
|
485
527
|
if (defaultBranch) {
|
|
486
528
|
rollups.prune(slug, new Set([
|
|
487
|
-
...listed.map((pr) => pr.headSha),
|
|
488
529
|
...mergedListed.flatMap((m) => (m.pr.mergeCommitSha ? [m.pr.mergeCommitSha] : [])),
|
|
489
530
|
defaultBranch.sha,
|
|
490
531
|
]));
|
|
@@ -51,6 +51,6 @@ export declare function inspectNativeResumeSession(session: SessionMeta, version
|
|
|
51
51
|
export declare function resolveSessionRecoveryFromCandidates(session: SessionMeta, candidates: RotateCandidate[], supportsNative?: (agent: AgentId, version?: string) => boolean, nativeInspection?: NativeResumeInspection, options?: SessionRecoverySelection): SessionRecoveryTarget;
|
|
52
52
|
export declare function sessionTranscriptReadable(session: SessionMeta): boolean;
|
|
53
53
|
export declare function assertRecoverableTranscript(session: SessionMeta): void;
|
|
54
|
-
export declare function resolveSessionRecovery(session: SessionMeta, collect?: (agent: AgentId) => Promise<RotateCandidate[]>, options?: SessionRecoverySelection): Promise<SessionRecoveryTarget>;
|
|
54
|
+
export declare function resolveSessionRecovery(session: SessionMeta, collect?: (agent: AgentId, includeKeyed?: boolean) => Promise<RotateCandidate[]>, options?: SessionRecoverySelection): Promise<SessionRecoveryTarget>;
|
|
55
55
|
export declare function sessionRecoveryRunArgs(session: Pick<SessionMeta, 'id'>): string[];
|
|
56
56
|
export {};
|
|
@@ -331,7 +331,7 @@ export async function resolveSessionRecovery(session, collect = collectRunCandid
|
|
|
331
331
|
const installation = resolveManagedInstallation(agent);
|
|
332
332
|
if (!installation)
|
|
333
333
|
throw new SessionRecoveryError(`No managed ${agent} installation is available. Install it with: agents add ${agent}`);
|
|
334
|
-
return resolveSessionRecoveryFromCandidates(session, await collect(agent), undefined, undefined, {
|
|
334
|
+
return resolveSessionRecoveryFromCandidates(session, await collect(agent, Boolean(options.account?.trim())), undefined, undefined, {
|
|
335
335
|
...options, executableVersion: installation.label,
|
|
336
336
|
});
|
|
337
337
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phnx-labs/agents-cli",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.21",
|
|
4
4
|
"description": "One CLI for all your AI coding agents - versions, config, cloud dispatch, sessions, and teams (now with first-class Grok Build CLI support)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|