@atolis-hq/wake 0.4.41 → 0.4.42
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/src/bootstrap/version.js +1 -1
- package/dist/src/integrations/github/application/inbound-watch-gate-signals.js +4 -6
- package/dist/src/integrations/github/infrastructure/client-reads.d.ts +1 -0
- package/dist/src/integrations/github/infrastructure/client-reads.js +16 -0
- package/dist/src/integrations/github/infrastructure/client.js +5 -1
- package/dist/src/orchestration/application/request-child.js +3 -4
- package/package.json +1 -1
|
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
|
|
|
124
124
|
return `g${headHash.slice(0, 7)}`;
|
|
125
125
|
return '0.1.0-dev';
|
|
126
126
|
}
|
|
127
|
-
export const wakeVersion = "v0.4.
|
|
127
|
+
export const wakeVersion = "v0.4.42";
|
|
128
128
|
/** The registry-installable version used by packaged sandbox images. */
|
|
129
129
|
export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
|
|
@@ -35,9 +35,7 @@ function extractMarker(body) {
|
|
|
35
35
|
function translateOutcome(outcome) {
|
|
36
36
|
if (outcome === 'DONE')
|
|
37
37
|
return ActivityOutcomeKind.Done;
|
|
38
|
-
|
|
39
|
-
return ActivityOutcomeKind.Rejected;
|
|
40
|
-
return null;
|
|
38
|
+
return ActivityOutcomeKind.Rejected;
|
|
41
39
|
}
|
|
42
40
|
export async function applyWatchGateVerdictSignal(input) {
|
|
43
41
|
const { event, runs, orchestration } = input;
|
|
@@ -47,8 +45,6 @@ export async function applyWatchGateVerdictSignal(input) {
|
|
|
47
45
|
if (marker === null)
|
|
48
46
|
return;
|
|
49
47
|
const outcome = translateOutcome(marker.outcome);
|
|
50
|
-
if (outcome === null)
|
|
51
|
-
return;
|
|
52
48
|
const verdict = await verifyWatchGateVerdict({ marker, outcome, runs, orchestration });
|
|
53
49
|
if (verdict === null)
|
|
54
50
|
return;
|
|
@@ -66,7 +62,9 @@ async function verifyWatchGateVerdict(input) {
|
|
|
66
62
|
const run = (await runs.load(runId(marker.runId))).view;
|
|
67
63
|
if (run === null)
|
|
68
64
|
return null;
|
|
69
|
-
if (run.status !== RunStatus.Succeeded ||
|
|
65
|
+
if (run.status !== RunStatus.Succeeded ||
|
|
66
|
+
run.outcome === undefined ||
|
|
67
|
+
translateOutcome(run.outcome.kind.toUpperCase()) !== outcome)
|
|
70
68
|
return null;
|
|
71
69
|
const workflows = await orchestration.listAll();
|
|
72
70
|
const child = workflows.find((workflow) => workflow.workflowInstanceId === run.workflowInstanceId);
|
|
@@ -3,6 +3,7 @@ import { PullRequestState } from '../../../activities/index.js';
|
|
|
3
3
|
import type { GitHubIssueQueryFilters } from '../contracts/issue-query.js';
|
|
4
4
|
import type { GitHubIssueCommentPayload, GitHubIssuePayload } from '../contracts/payloads.js';
|
|
5
5
|
import type { createEtagCache } from './etag-cache.js';
|
|
6
|
+
export declare function findIssueCommentByMarker(octokit: Octokit, owner: string, repo: string, issueNumber: number, marker: string): Promise<string | null>;
|
|
6
7
|
export declare function listIssues(octokit: Octokit, cache: ReturnType<typeof createEtagCache>, owner: string, repo: string, maxResults: number, options?: {
|
|
7
8
|
readonly since?: string;
|
|
8
9
|
readonly filters?: GitHubIssueQueryFilters;
|
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
import { PullRequestState } from '../../../activities/index.js';
|
|
3
3
|
import { GitHubListState } from '../contracts/vocabulary.js';
|
|
4
4
|
import { fetchPaginatedWithEtag, fetchWithEtag } from './etag-cache.js';
|
|
5
|
+
export async function findIssueCommentByMarker(octokit, owner, repo, issueNumber, marker) {
|
|
6
|
+
for await (const page of octokit.paginate.iterator(octokit.rest.issues.listComments, {
|
|
7
|
+
owner,
|
|
8
|
+
repo,
|
|
9
|
+
issue_number: issueNumber,
|
|
10
|
+
per_page: 100,
|
|
11
|
+
})) {
|
|
12
|
+
const comment = page.data.find((value) => value.body?.includes(marker));
|
|
13
|
+
if (comment !== undefined) {
|
|
14
|
+
if (!Number.isSafeInteger(comment.id) || comment.id <= 0)
|
|
15
|
+
throw new Error('GitHub comment marker lookup returned an invalid comment id');
|
|
16
|
+
return String(comment.id);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
5
21
|
export function listIssues(octokit, cache, owner, repo, maxResults, options = {}) {
|
|
6
22
|
const { since, filters = {} } = options;
|
|
7
23
|
return fetchPaginatedWithEtag({
|
|
@@ -2,8 +2,9 @@ import { Octokit } from '@octokit/rest';
|
|
|
2
2
|
import { MergeMethod, ProviderPermission, PullRequestState } from '../../../activities/index.js';
|
|
3
3
|
import { GitHubOutboundAction } from '../contracts/vocabulary.js';
|
|
4
4
|
import { createBoundedGitHubFetch } from './bounded-fetch.js';
|
|
5
|
-
import { branch, getCombinedStatusForRef, getIssueLabels, getPullRequest, listCheckRunsForRef, listIssueComments, listIssues, listPullRequestFiles, listPullRequests, listReviewComments, listReviews, } from './client-reads.js';
|
|
5
|
+
import { branch, findIssueCommentByMarker, getCombinedStatusForRef, getIssueLabels, getPullRequest, listCheckRunsForRef, listIssueComments, listIssues, listPullRequestFiles, listPullRequests, listReviewComments, listReviews, } from './client-reads.js';
|
|
6
6
|
import { createEtagCache } from './etag-cache.js';
|
|
7
|
+
/* eslint-disable max-lines */
|
|
7
8
|
// Octokit's request-log plugin reports every non-2xx response through this
|
|
8
9
|
// callback, including the expected 304 responses produced by conditional ETag
|
|
9
10
|
// reads. Keep those cache hits quiet, but retain a small, safe operator signal
|
|
@@ -169,6 +170,9 @@ async function deliver(octokit, command) {
|
|
|
169
170
|
const issueNumber = command.issue_number ?? command.pull_number;
|
|
170
171
|
if (issueNumber === undefined)
|
|
171
172
|
throw new Error('GitHub comment requires an issue or pull request');
|
|
173
|
+
const existingCommentId = await findIssueCommentByMarker(octokit, command.owner, command.repo, issueNumber, marker);
|
|
174
|
+
if (existingCommentId !== null)
|
|
175
|
+
return existingCommentId;
|
|
172
176
|
const response = await octokit.rest.issues.createComment({
|
|
173
177
|
owner: command.owner,
|
|
174
178
|
repo: command.repo,
|
|
@@ -177,8 +177,7 @@ function watchIdsFor(wait) {
|
|
|
177
177
|
function watchGateVerdictOutcome(parent, child) {
|
|
178
178
|
if (parent.waitingFor?.signalKind !== WatchGateVerdictSignal)
|
|
179
179
|
return undefined;
|
|
180
|
-
return child.lastOutcome?.kind === ActivityOutcomeKind.Done
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
: undefined;
|
|
180
|
+
return child.lastOutcome?.kind === ActivityOutcomeKind.Done
|
|
181
|
+
? ActivityOutcomeKind.Done
|
|
182
|
+
: ActivityOutcomeKind.Rejected;
|
|
184
183
|
}
|