@sagentlab/navarch-runtime 0.1.28 → 0.1.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/dist/github-pr.cjs +8 -2
- package/package.json +1 -1
package/dist/github-pr.cjs
CHANGED
|
@@ -41,9 +41,11 @@ function matchingPullRequestUrl(body, repository, matchesHead) {
|
|
|
41
41
|
const candidate = matches.find((pullRequest) => pullRequest.state === "open") ?? matches[0];
|
|
42
42
|
return typeof candidate?.html_url === "string" ? candidate.html_url : null;
|
|
43
43
|
}
|
|
44
|
-
async function fetchPullRequests(url, headers, fetchImpl) {
|
|
44
|
+
async function fetchPullRequests(url, headers, fetchImpl, options = {}) {
|
|
45
45
|
const response = await fetchImpl(url, { headers });
|
|
46
46
|
if (!response.ok) {
|
|
47
|
+
if (options.emptyStatuses?.includes(response.status))
|
|
48
|
+
return [];
|
|
47
49
|
throw new Error(`GitHub pull request lookup failed with HTTP ${response.status}`);
|
|
48
50
|
}
|
|
49
51
|
return response.json();
|
|
@@ -87,7 +89,11 @@ async function findHeadBranchPullRequestUrl(options) {
|
|
|
87
89
|
return branchMatch;
|
|
88
90
|
const commitUrl = new URL(`https://api.github.com/repos/${encodeURIComponent(owner)}/${encodeURIComponent(name)}/commits/${normalizedHeadSha}/pulls`);
|
|
89
91
|
commitUrl.searchParams.set("per_page", "10");
|
|
90
|
-
return matchingPullRequestUrl(
|
|
92
|
+
return matchingPullRequestUrl(
|
|
93
|
+
// GitHub answers 422 ("No commit found for SHA") when the local head was
|
|
94
|
+
// never pushed -- the normal case for sessions that end without a PR, so
|
|
95
|
+
// it means "no evidence", not a lookup failure.
|
|
96
|
+
await fetchPullRequests(commitUrl, headers, fetchImpl, { emptyStatuses: [404, 422] }), normalizedRepository, (candidate) => typeof candidate.head?.sha === "string" &&
|
|
91
97
|
candidate.head.sha.toLowerCase() === normalizedHeadSha);
|
|
92
98
|
}
|
|
93
99
|
function isPullRequestUrlForRepository(value, repository) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sagentlab/navarch-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"description": "Navarch machine-side session manager: claims delivery tasks and runs them through Claude Code, Codex, Gemini, or OpenCode.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|