@vite-hub/presets 0.1.0 → 0.3.1
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/README.md +143 -25
- package/dist/babysitter/server.d.ts +53 -5
- package/dist/babysitter/server.js +2 -2
- package/dist/babysitter-C71pgjkv.js +2487 -0
- package/dist/babysitter.d.ts +191 -18
- package/dist/babysitter.js +2 -2
- package/dist/error-diagnostics-BTBW9sZx.js +725 -0
- package/dist/host-Dsi6saqi.js +724 -0
- package/dist/labeller.d.ts +42 -2
- package/dist/labeller.js +114 -33
- package/dist/{admission-DBJdt-CX.d.ts → pr-workspaces-CjX3PSqM.d.ts} +362 -78
- package/dist/server-CIgjUG63.js +11637 -0
- package/dist/workspace.js +2 -5
- package/package.json +18 -19
- package/dist/babysitter-B4D1zeYf.js +0 -715
- package/dist/host-CH0L3VC9.js +0 -438
- package/dist/server-DDmyZ98B.js +0 -6745
|
@@ -1,7 +1,260 @@
|
|
|
1
|
-
import { AgentRunActivity } from "@vite-hub/agent";
|
|
2
|
-
import { GitHubPullRequestFilter } from "@vite-hub/agent/channels";
|
|
1
|
+
import { AgentChannelDefinition, AgentRunActivity } from "@vite-hub/agent";
|
|
3
2
|
import "valibot";
|
|
4
|
-
import {
|
|
3
|
+
import { GitHubAppDelivery, GitHubAppRepository, GitHubProvider } from "@vite-hub/forge";
|
|
4
|
+
import { GitHubChannelOptions, GitHubPullRequestFilter } from "@vite-hub/agent/channels";
|
|
5
|
+
import { SqliteAgentStateExtension } from "@vite-hub/agent/state";
|
|
6
|
+
//#region src/babysitter/inbox/budgets.d.ts
|
|
7
|
+
interface ProviderBudget {
|
|
8
|
+
generation: string;
|
|
9
|
+
maxRetries: number;
|
|
10
|
+
nextAttempt: number;
|
|
11
|
+
succeededThrough: number;
|
|
12
|
+
pending: number[];
|
|
13
|
+
failures: number[];
|
|
14
|
+
resetReason?: string;
|
|
15
|
+
}
|
|
16
|
+
type ProviderAttempt = {
|
|
17
|
+
provider: string;
|
|
18
|
+
generation: string;
|
|
19
|
+
attempt: number;
|
|
20
|
+
};
|
|
21
|
+
type ProviderAttemptOutcome = "success" | "retryable-failure" | "other-failure";
|
|
22
|
+
/** New evidence that gives an exhausted head one more pass, once per head. */
|
|
23
|
+
type ProgressGrant = "conflict" | "bot-feedback";
|
|
24
|
+
/** `exhaustedAt` is when the head spent its budget. After `progressCooldownMs` it gets one more pass. */
|
|
25
|
+
interface ProgressBudget {
|
|
26
|
+
head: string;
|
|
27
|
+
limit: number;
|
|
28
|
+
count: number;
|
|
29
|
+
exhausted: boolean;
|
|
30
|
+
evidence?: string;
|
|
31
|
+
creditedEvidence: string[];
|
|
32
|
+
resetReason?: string;
|
|
33
|
+
grants?: ProgressGrant[];
|
|
34
|
+
exhaustedAt?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The host verifies progress from GitHub/provider state, never from Agent prose. `reviewDriven` marks a
|
|
38
|
+
* push whose pass had no merge conflict and no failing check outside the review checks; the host
|
|
39
|
+
* decides it from the claimed snapshot.
|
|
40
|
+
*/
|
|
41
|
+
type ProgressOutcome = {
|
|
42
|
+
kind: "no-progress";
|
|
43
|
+
} | {
|
|
44
|
+
kind: "verified";
|
|
45
|
+
evidence: string;
|
|
46
|
+
reviewDriven?: boolean;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Review-driven pushes on one PR, over its whole life. `heads` lists the heads that this worker pushed
|
|
50
|
+
* and, once the budget is spent, the heads that already got a model pass. A head outside it was moved
|
|
51
|
+
* by someone else. `minorHeads` lists the heads in a row whose automated review a pass classed with
|
|
52
|
+
* nothing above P2.
|
|
53
|
+
*/
|
|
54
|
+
interface ReviewPushBudget {
|
|
55
|
+
count: number;
|
|
56
|
+
heads: string[];
|
|
57
|
+
minorHeads?: string[];
|
|
58
|
+
}
|
|
59
|
+
/** The highest class of valid automated review finding that a pass reported for the head it started on. */
|
|
60
|
+
type AutomatedReviewClass = "P0" | "P1" | "P2" | "P3" | "none";
|
|
61
|
+
/**
|
|
62
|
+
* Model passes on one PR in the last 24 hours. `passes` holds the time each pass started the model.
|
|
63
|
+
* `human` is the generation of the last person's feedback that a pass saw. `exemptions` lists the
|
|
64
|
+
* exemptions already used, so each applies once.
|
|
65
|
+
*/
|
|
66
|
+
interface DailyPassBudget {
|
|
67
|
+
passes: number[];
|
|
68
|
+
human?: number;
|
|
69
|
+
exemptions: string[];
|
|
70
|
+
}
|
|
71
|
+
interface InboxBudgets {
|
|
72
|
+
providerRetries?: number;
|
|
73
|
+
noProgress?: number;
|
|
74
|
+
reviewPushes?: number;
|
|
75
|
+
minorReviewRounds?: number;
|
|
76
|
+
dailyPasses?: number;
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/github/checkout.d.ts
|
|
80
|
+
/** Why a persistent provider workspace was kept or emptied. */
|
|
81
|
+
type GitHubWorkspaceReuse = "warm" | "cold" | "dirty" | "missing-metadata" | (string & {});
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/github/repair.d.ts
|
|
84
|
+
interface GitHubRepairCommit {
|
|
85
|
+
message: string;
|
|
86
|
+
paths: string[];
|
|
87
|
+
/** Files where a base merge intentionally keeps the PR's version over a base change, each with the reason. */
|
|
88
|
+
baseOverrides?: Array<{
|
|
89
|
+
path: string;
|
|
90
|
+
reason: string;
|
|
91
|
+
}>;
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/github/host.d.ts
|
|
95
|
+
type GitHubHostSecret = string | {
|
|
96
|
+
unseal: () => string;
|
|
97
|
+
};
|
|
98
|
+
interface GitHubHostCredentials {
|
|
99
|
+
appId?: number | string;
|
|
100
|
+
installationId?: number | string;
|
|
101
|
+
owner?: string;
|
|
102
|
+
privateKey?: GitHubHostSecret;
|
|
103
|
+
token?: GitHubHostSecret;
|
|
104
|
+
}
|
|
105
|
+
interface GitHubHostCredentialContext {
|
|
106
|
+
/** Repository whose GitHub credentials are needed; omitted for unscoped access. */
|
|
107
|
+
repository?: string;
|
|
108
|
+
signal: AbortSignal;
|
|
109
|
+
}
|
|
110
|
+
interface GitHubHostOptions {
|
|
111
|
+
credentials: (context: GitHubHostCredentialContext) => GitHubHostCredentials | Promise<GitHubHostCredentials>;
|
|
112
|
+
/** A `fetch` for Forge requests, for tests and runtimes without a global one. */
|
|
113
|
+
fetch?: typeof fetch;
|
|
114
|
+
identity?: {
|
|
115
|
+
appId?: number;
|
|
116
|
+
email?: string;
|
|
117
|
+
login?: string;
|
|
118
|
+
};
|
|
119
|
+
maxBuffer?: number;
|
|
120
|
+
/** Forge request timeout in milliseconds. Default 60000. */
|
|
121
|
+
timeout?: number;
|
|
122
|
+
userAgent?: string;
|
|
123
|
+
/**
|
|
124
|
+
* `false` stops Forge providers from revalidating repeated GETs with `If-None-Match`. Default: on. Entries are
|
|
125
|
+
* kept per App installation, so they survive the hourly token rotation, or per token without an App.
|
|
126
|
+
*/
|
|
127
|
+
conditionalRequests?: boolean;
|
|
128
|
+
}
|
|
129
|
+
interface GitHubHostAccess {
|
|
130
|
+
/**
|
|
131
|
+
* Environment for `gh` and `git`: `GH_TOKEN`, `GITHUB_TOKEN`, and the commit identity. With a `repository`,
|
|
132
|
+
* it also has the Git credentials for that repository in `GIT_CONFIG_KEY_<n>` and `GIT_CONFIG_VALUE_<n>`.
|
|
133
|
+
*/
|
|
134
|
+
env: Record<string, string>;
|
|
135
|
+
token: string;
|
|
136
|
+
}
|
|
137
|
+
interface GitHubHostPullRequest {
|
|
138
|
+
headRef?: string;
|
|
139
|
+
headRepository?: string;
|
|
140
|
+
headSha: string;
|
|
141
|
+
number: number;
|
|
142
|
+
repository: string;
|
|
143
|
+
}
|
|
144
|
+
interface GitHubHostCheckout extends GitHubHostAccess {
|
|
145
|
+
path: string;
|
|
146
|
+
/**
|
|
147
|
+
* Restore source instruction files only before the provider injects its instructions. For the
|
|
148
|
+
* `persistent.work` directory, `reuse` keeps its ignored files when the tracked tree matches the
|
|
149
|
+
* head, and the result says whether it did. `complete` checks the whole head out into another
|
|
150
|
+
* directory the caller owns, the way the `persistent.work` directory is prepared.
|
|
151
|
+
*/
|
|
152
|
+
prepareWorkspace(target: string, options?: {
|
|
153
|
+
restoreInstructions?: boolean;
|
|
154
|
+
reuse?: boolean;
|
|
155
|
+
reason?: string;
|
|
156
|
+
complete?: boolean;
|
|
157
|
+
}): Promise<{
|
|
158
|
+
reused: boolean;
|
|
159
|
+
reason: GitHubWorkspaceReuse;
|
|
160
|
+
} | void>;
|
|
161
|
+
commitRepair(target: string, input: GitHubRepairCommit, options?: {
|
|
162
|
+
verifyDependencies?: boolean;
|
|
163
|
+
}): Promise<string>;
|
|
164
|
+
push(target?: string, options?: {
|
|
165
|
+
signal?: AbortSignal;
|
|
166
|
+
beforePush?: (head?: string) => void | Promise<void>;
|
|
167
|
+
afterPush?: (head: string) => void | Promise<void>;
|
|
168
|
+
}): Promise<string>;
|
|
169
|
+
signal: AbortSignal;
|
|
170
|
+
}
|
|
171
|
+
interface GitHubHostCheckoutOptions {
|
|
172
|
+
signal?: AbortSignal;
|
|
173
|
+
timeout?: number;
|
|
174
|
+
/**
|
|
175
|
+
* Keep the host clone in `checkout` after the callback and fetch into it next time instead of
|
|
176
|
+
* cloning. `work` is the provider workspace that `prepareWorkspace` keeps between calls.
|
|
177
|
+
*/
|
|
178
|
+
persistent?: {
|
|
179
|
+
checkout: string;
|
|
180
|
+
work: string;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
interface GitHubHostForgeOptions extends GitHubHostCheckoutOptions {
|
|
184
|
+
/** Repository whose credentials the provider uses; omitted for unscoped access. */
|
|
185
|
+
repository?: string;
|
|
186
|
+
}
|
|
187
|
+
interface GitHubHostAccessOptions extends GitHubHostCheckoutOptions {
|
|
188
|
+
fallback?: boolean;
|
|
189
|
+
refresh?: boolean;
|
|
190
|
+
/** Mint a new App installation token when the cached one expires within this many milliseconds. */
|
|
191
|
+
minLifetime?: number;
|
|
192
|
+
repository?: string;
|
|
193
|
+
}
|
|
194
|
+
/** A GitHub rate limit that the response headers of this host's Forge requests reported. */
|
|
195
|
+
interface GitHubHostRateLimit {
|
|
196
|
+
/** The GitHub rate limit resource, for example `core` or `graphql`. */
|
|
197
|
+
resource: string;
|
|
198
|
+
limit: number;
|
|
199
|
+
remaining: number;
|
|
200
|
+
resetAt: number;
|
|
201
|
+
checkedAt: number;
|
|
202
|
+
}
|
|
203
|
+
interface GitHubHost {
|
|
204
|
+
channel(options?: Omit<GitHubChannelOptions, "app">): AgentChannelDefinition;
|
|
205
|
+
/** Return the verified login configured for this host, when available. */
|
|
206
|
+
identity(): string | undefined;
|
|
207
|
+
/** Immutable GitHub App ID for managed activity ownership. */
|
|
208
|
+
appId?(): number | undefined;
|
|
209
|
+
/** Resolve credentials and Git binding for the current checkout callback. */
|
|
210
|
+
environment(): Promise<Record<string, string>>;
|
|
211
|
+
access(input?: GitHubHostAccessOptions): Promise<GitHubHostAccess>;
|
|
212
|
+
/**
|
|
213
|
+
* A `forges` GitHub provider with the repository's credentials. It has every Forge verb and `graphql()`.
|
|
214
|
+
* Create one for each operation: installation tokens expire after one hour.
|
|
215
|
+
*/
|
|
216
|
+
forge(input?: GitHubHostForgeOptions): Promise<GitHubProvider>;
|
|
217
|
+
/** The most constrained rate limit that recent Forge responses reported, or undefined before the first response. */
|
|
218
|
+
rateLimit(): GitHubHostRateLimit | undefined;
|
|
219
|
+
withPullRequestCheckout<T>(pullRequest: GitHubHostPullRequest, run: (checkout: GitHubHostCheckout) => Promise<T>, options?: GitHubHostCheckoutOptions): Promise<T>;
|
|
220
|
+
}
|
|
221
|
+
interface GitHubAppEnvironment {
|
|
222
|
+
appId: number;
|
|
223
|
+
privateKey: string;
|
|
224
|
+
/** Fixed installation of `owner`, which it needs. Repositories of other owners use `installations` or discovery. */
|
|
225
|
+
installationId?: number;
|
|
226
|
+
/** Repository owner of `installationId`. */
|
|
227
|
+
owner?: string;
|
|
228
|
+
/** Explicit installation IDs by repository owner. */
|
|
229
|
+
installations?: Record<string, number>;
|
|
230
|
+
/** Fallback token for repositories without an App installation. */
|
|
231
|
+
token?: string;
|
|
232
|
+
userAgent?: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* GitHub App credentials for `createGitHubHost()` that resolve the installation of each
|
|
236
|
+
* repository from the App, and the App's bot identity for commits. Results are cached.
|
|
237
|
+
*/
|
|
238
|
+
declare function createGitHubAppCredentials(app: GitHubAppEnvironment): {
|
|
239
|
+
credentials(context: GitHubHostCredentialContext): Promise<GitHubHostCredentials>;
|
|
240
|
+
/** Every repository that the App's installations can access. */
|
|
241
|
+
repositories: (signal?: AbortSignal) => Promise<GitHubAppRepository[]>;
|
|
242
|
+
/** Failed App webhook deliveries since `since` that no later attempt delivered, oldest first. */
|
|
243
|
+
failedDeliveries: (since: number, signal?: AbortSignal) => Promise<GitHubAppDelivery[]>;
|
|
244
|
+
/** Sends one App webhook delivery again. */
|
|
245
|
+
redeliver: (id: string, signal?: AbortSignal) => Promise<void>;
|
|
246
|
+
/** The App bot's login and noreply email, used as the commit author. */
|
|
247
|
+
identity(): Promise<{
|
|
248
|
+
appId: number;
|
|
249
|
+
login: string;
|
|
250
|
+
email: string;
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
253
|
+
declare function createGitHubHost(options: GitHubHostOptions): GitHubHost;
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/github/required-checks.d.ts
|
|
256
|
+
type GitHubRequiredCheckState = "pending" | "failed" | "passed" | "unknown";
|
|
257
|
+
//#endregion
|
|
5
258
|
//#region src/babysitter/inbox/types.d.ts
|
|
6
259
|
interface GitHubActor {
|
|
7
260
|
login?: string;
|
|
@@ -101,7 +354,8 @@ interface GitHubEvidence extends GitHubTimestamps {
|
|
|
101
354
|
commit_id?: string;
|
|
102
355
|
original_commit_id?: string;
|
|
103
356
|
commit?: {
|
|
104
|
-
|
|
357
|
+
[key: string]: unknown;
|
|
358
|
+
oid?: string;
|
|
105
359
|
} | null;
|
|
106
360
|
pull_request_review_id?: number;
|
|
107
361
|
in_reply_to_id?: number;
|
|
@@ -135,72 +389,6 @@ interface GitHubReviewThread {
|
|
|
135
389
|
resolutionObservedAt?: string;
|
|
136
390
|
}
|
|
137
391
|
//#endregion
|
|
138
|
-
//#region src/babysitter/inbox/budgets.d.ts
|
|
139
|
-
interface ProviderBudget {
|
|
140
|
-
generation: string;
|
|
141
|
-
maxRetries: number;
|
|
142
|
-
nextAttempt: number;
|
|
143
|
-
succeededThrough: number;
|
|
144
|
-
pending: number[];
|
|
145
|
-
failures: number[];
|
|
146
|
-
resetReason?: string;
|
|
147
|
-
}
|
|
148
|
-
type ProviderAttempt = {
|
|
149
|
-
provider: string;
|
|
150
|
-
generation: string;
|
|
151
|
-
attempt: number;
|
|
152
|
-
};
|
|
153
|
-
type ProviderAttemptOutcome = "success" | "retryable-failure" | "other-failure";
|
|
154
|
-
/** New evidence that gives an exhausted head one more pass, once per head. */
|
|
155
|
-
type ProgressGrant = "conflict" | "bot-feedback";
|
|
156
|
-
interface ProgressBudget {
|
|
157
|
-
head: string;
|
|
158
|
-
limit: number;
|
|
159
|
-
count: number;
|
|
160
|
-
exhausted: boolean;
|
|
161
|
-
evidence?: string;
|
|
162
|
-
creditedEvidence: string[];
|
|
163
|
-
resetReason?: string;
|
|
164
|
-
grants?: ProgressGrant[];
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* The host verifies progress from GitHub/provider state, never from Agent prose. `reviewDriven` marks a
|
|
168
|
-
* push whose pass had no merge conflict and no failing check outside the review checks; the host
|
|
169
|
-
* decides it from the claimed snapshot.
|
|
170
|
-
*/
|
|
171
|
-
type ProgressOutcome = {
|
|
172
|
-
kind: "no-progress";
|
|
173
|
-
} | {
|
|
174
|
-
kind: "verified";
|
|
175
|
-
evidence: string;
|
|
176
|
-
reviewDriven?: boolean;
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* Review-driven pushes on one PR, over its whole life. `heads` lists the heads that this worker pushed
|
|
180
|
-
* and, once the budget is spent, the heads that already got a model pass. A head outside it was moved
|
|
181
|
-
* by someone else.
|
|
182
|
-
*/
|
|
183
|
-
interface ReviewPushBudget {
|
|
184
|
-
count: number;
|
|
185
|
-
heads: string[];
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Model passes on one PR in the last 24 hours. `passes` holds the time each pass started the model.
|
|
189
|
-
* `human` is the generation of the last person's feedback that a pass saw. `exemptions` lists the
|
|
190
|
-
* exemptions already used, so each applies once.
|
|
191
|
-
*/
|
|
192
|
-
interface DailyPassBudget {
|
|
193
|
-
passes: number[];
|
|
194
|
-
human?: number;
|
|
195
|
-
exemptions: string[];
|
|
196
|
-
}
|
|
197
|
-
interface InboxBudgets {
|
|
198
|
-
providerRetries?: number;
|
|
199
|
-
noProgress?: number;
|
|
200
|
-
reviewPushes?: number;
|
|
201
|
-
dailyPasses?: number;
|
|
202
|
-
}
|
|
203
|
-
//#endregion
|
|
204
392
|
//#region src/babysitter/inbox/wait-state.d.ts
|
|
205
393
|
type PullRequestWake = {
|
|
206
394
|
kind: "checks";
|
|
@@ -233,7 +421,7 @@ type PullRequestWait = {
|
|
|
233
421
|
//#region src/babysitter/inbox/storage.d.ts
|
|
234
422
|
/**
|
|
235
423
|
* SQL access for the PR inbox. `agentState.extension("babysitter")` from
|
|
236
|
-
* `@vite-hub/agent/state
|
|
424
|
+
* `@vite-hub/agent/state` satisfies it and keeps the inbox in the Agent State database.
|
|
237
425
|
*/
|
|
238
426
|
interface PullRequestInboxStorage extends Pick<SqliteAgentStateExtension, "execute" | "tablePrefix" | "transaction"> {
|
|
239
427
|
close?: () => Promise<void>;
|
|
@@ -301,6 +489,8 @@ type Snapshot = {
|
|
|
301
489
|
heads: string[];
|
|
302
490
|
};
|
|
303
491
|
threadReopens?: Record<string, number>;
|
|
492
|
+
/** Authenticated outcome replies, including IDs used by thread-only reads. */
|
|
493
|
+
ownedReviewCommentIds?: string[];
|
|
304
494
|
hydrated: boolean;
|
|
305
495
|
refresh: boolean;
|
|
306
496
|
feedbackRefresh: boolean;
|
|
@@ -357,6 +547,8 @@ type Claim = {
|
|
|
357
547
|
runId?: string;
|
|
358
548
|
startedAt?: number;
|
|
359
549
|
activity?: AgentRunActivity;
|
|
550
|
+
/** The pass's class of the automated review of the claimed head. `finish()` records it with `budgets.minorReviewRounds`. */
|
|
551
|
+
automatedReview?: AutomatedReviewClass;
|
|
360
552
|
};
|
|
361
553
|
type DirectMergeAttempt = {
|
|
362
554
|
token: string;
|
|
@@ -366,6 +558,7 @@ type DirectMergeAttempt = {
|
|
|
366
558
|
startedAt: number;
|
|
367
559
|
asynchronous?: boolean;
|
|
368
560
|
enqueued?: boolean;
|
|
561
|
+
foldInto?: number;
|
|
369
562
|
};
|
|
370
563
|
interface PullRequestInboxOptions {
|
|
371
564
|
/** A private `node:sqlite` file. Use `storage` instead to keep the inbox in the Agent State database. */
|
|
@@ -374,12 +567,19 @@ interface PullRequestInboxOptions {
|
|
|
374
567
|
storage?: PullRequestInboxStorage;
|
|
375
568
|
/** Separates inboxes that share one storage, for example one per Agent. */
|
|
376
569
|
scope?: string;
|
|
377
|
-
repositories
|
|
570
|
+
/** The served repositories, or a function that returns the current lowercase list on each read. */
|
|
571
|
+
repositories: readonly string[] | (() => readonly string[]);
|
|
378
572
|
filter?: GitHubPullRequestFilter;
|
|
379
573
|
clock?: () => number;
|
|
380
574
|
activityAuthors?: readonly string[];
|
|
381
575
|
activityAppId?: number;
|
|
382
576
|
budgets?: InboxBudgets;
|
|
577
|
+
/** Labels that put a PR first in the claim order after main repairs. Matched case-insensitively. */
|
|
578
|
+
priorityLabels?: readonly string[];
|
|
579
|
+
/** Head branch prefix of PRs that repair the base branch. They are claimed first and never exhaust `budgets.noProgress`. */
|
|
580
|
+
mainRepairBranchPrefix?: string;
|
|
581
|
+
/** Claim a PR whose base is another open PR's branch. By default it waits until its parent merges. */
|
|
582
|
+
claimStackChildren?: boolean;
|
|
383
583
|
/**
|
|
384
584
|
* Called once per process for each stored PR row that fails validation. The inbox skips such a row
|
|
385
585
|
* in claims, summaries and wait evaluation, so one bad row cannot stop the queue or its health.
|
|
@@ -402,15 +602,18 @@ declare class PullRequestInbox {
|
|
|
402
602
|
private scope;
|
|
403
603
|
private ready?;
|
|
404
604
|
private tables;
|
|
405
|
-
private
|
|
605
|
+
private repositoryList;
|
|
406
606
|
private clock;
|
|
407
607
|
private filter?;
|
|
408
608
|
private activityAuthors;
|
|
409
609
|
private activityAppId?;
|
|
410
610
|
private budgets;
|
|
611
|
+
private priorityLabels;
|
|
612
|
+
private mainRepairBranchPrefix?;
|
|
613
|
+
private claimStackChildren;
|
|
411
614
|
private invalidRow?;
|
|
412
615
|
private reportedRows;
|
|
413
|
-
constructor({ path, storage, scope, repositories, filter, clock, budgets, activityAuthors, activityAppId, invalidRow }: PullRequestInboxOptions);
|
|
616
|
+
constructor({ path, storage, scope, repositories, filter, clock, budgets, activityAuthors, activityAppId, priorityLabels, mainRepairBranchPrefix, claimStackChildren, invalidRow }: PullRequestInboxOptions);
|
|
414
617
|
close(): Promise<void>;
|
|
415
618
|
private init;
|
|
416
619
|
private transaction;
|
|
@@ -418,9 +621,12 @@ declare class PullRequestInbox {
|
|
|
418
621
|
/** Parses one stored row. An invalid row is reported once and skipped by queue-wide reads. */
|
|
419
622
|
private parseRow;
|
|
420
623
|
private reportInvalidRow;
|
|
624
|
+
private get repositories();
|
|
421
625
|
private repositoryFilter;
|
|
422
626
|
private ownsComment;
|
|
423
627
|
private isActivityComment;
|
|
628
|
+
private isOutcomeComment;
|
|
629
|
+
private cleanReviewComments;
|
|
424
630
|
private cleanSnapshot;
|
|
425
631
|
private getIn;
|
|
426
632
|
/** A snapshot for a queue-wide scan. An invalid row is reported and skipped. */
|
|
@@ -461,8 +667,16 @@ declare class PullRequestInbox {
|
|
|
461
667
|
/** Wake and persist its release marker atomically, so restart cannot repeat the wake. */
|
|
462
668
|
wakeForWorkerRelease(observed: Snapshot, revision: string, evidenceKey: string): Promise<boolean>;
|
|
463
669
|
private directMergeKey;
|
|
464
|
-
|
|
465
|
-
|
|
670
|
+
private stackFoldKey;
|
|
671
|
+
/** The stacked pull request whose merge into this pull request's branch has an unknown outcome. */
|
|
672
|
+
private foldingChildIn;
|
|
673
|
+
foldingChild(repository: string, parent: number): Promise<number | undefined>;
|
|
674
|
+
/**
|
|
675
|
+
* Atomically records that a claim has started an irreversible merge request. With `foldInto`, the merge
|
|
676
|
+
* targets that open parent's branch. A parent with a merge in flight refuses the fold, and a parent with
|
|
677
|
+
* a fold in flight refuses its own merge, so a fold never lands on a branch that already merged.
|
|
678
|
+
*/
|
|
679
|
+
beginDirectMerge(claim: Claim, head: string, asynchronous?: boolean, foldInto?: number): Promise<boolean>;
|
|
466
680
|
directMergeAttempt(repository: string, number: number): Promise<DirectMergeAttempt | undefined>;
|
|
467
681
|
/** Preserve a final enqueued result. */
|
|
468
682
|
recordDirectMergeEnqueued(repository: string, number: number, token: string): Promise<boolean>;
|
|
@@ -476,6 +690,10 @@ declare class PullRequestInbox {
|
|
|
476
690
|
resetProgressBudget(repository: string, number: number, head: string, reason: string): Promise<boolean>;
|
|
477
691
|
private dirty;
|
|
478
692
|
private updatePr;
|
|
693
|
+
/** Whether the PR carries one of `priorityLabels`. */
|
|
694
|
+
isPriority(pr: GitHubPullRequestRecord | null | undefined): boolean;
|
|
695
|
+
/** Whether the PR's head branch starts with `mainRepairBranchPrefix`. */
|
|
696
|
+
isMainRepair(pr: GitHubPullRequestRecord | null | undefined): boolean;
|
|
479
697
|
eligible(repository: string, pr: GitHubPullRequestRecord | null): boolean;
|
|
480
698
|
seed(repository: string, value: unknown): Promise<Snapshot>;
|
|
481
699
|
ingest(id: string, event: string, value: unknown): Promise<GitHubInboxDeliveryResult>;
|
|
@@ -497,7 +715,12 @@ declare class PullRequestInbox {
|
|
|
497
715
|
* Records that a claimed pass started the model, with the exemption that let it run past
|
|
498
716
|
* `budgets.dailyPasses`. It changes no evidence, so the claim stays current.
|
|
499
717
|
*/
|
|
500
|
-
recordModelPass(claim: Claim, exemption?: string): Promise<
|
|
718
|
+
recordModelPass(claim: Claim, exemption?: string): Promise<number | false>;
|
|
719
|
+
/**
|
|
720
|
+
* Gives back the pass that `recordModelPass` counted at `at`, and its exemption, when the provider
|
|
721
|
+
* failed the pass before it did any work. It changes no evidence, so the claim stays current.
|
|
722
|
+
*/
|
|
723
|
+
releaseModelPass(claim: Claim, at: number, exemption?: string): Promise<boolean>;
|
|
501
724
|
/** Checks the durable claim fence immediately before an irreversible provider action. */
|
|
502
725
|
isClaimCurrent(claim: Claim): Promise<boolean>;
|
|
503
726
|
/**
|
|
@@ -636,4 +859,65 @@ interface BabysitterAdmissionResult {
|
|
|
636
859
|
limits: BabysitterAdmissionLimits;
|
|
637
860
|
}
|
|
638
861
|
//#endregion
|
|
639
|
-
|
|
862
|
+
//#region src/babysitter/pr-workspaces.d.ts
|
|
863
|
+
/** Keep one workspace per open PR between passes. See `BabysitterOptions.warmWorkspaces`. */
|
|
864
|
+
interface BabysitterWarmWorkspaces {
|
|
865
|
+
/**
|
|
866
|
+
* Continue the previous pass's provider thread when this pass starts in a warm workspace on the
|
|
867
|
+
* same base commit and release, after a pass that pushed or recorded a wait. Defaults to `false`.
|
|
868
|
+
*/
|
|
869
|
+
resumeThreads?: boolean;
|
|
870
|
+
/** Disk the kept workspaces may use, in GiB. Least recently used entries go first. Defaults to 60. */
|
|
871
|
+
budgetGb?: number;
|
|
872
|
+
/** Days without a pass after which a PR's workspace is removed. Defaults to 7. */
|
|
873
|
+
idleDays?: number;
|
|
874
|
+
/** Free space, in percent of the filesystem, below which least recently used entries go. Defaults to 15. */
|
|
875
|
+
minFreePercent?: number;
|
|
876
|
+
/** Minutes between sweeps of terminal, idle and over-budget entries. `0` sweeps only at startup. Defaults to 60. */
|
|
877
|
+
sweepMinutes?: number;
|
|
878
|
+
}
|
|
879
|
+
/** What a pass left in its PR workspace. The next pass decides from it whether to keep the tree. */
|
|
880
|
+
interface PullRequestWorkspaceRecord {
|
|
881
|
+
/** The head the workspace holds: the pass's push, or the head it started on. */
|
|
882
|
+
head: string;
|
|
883
|
+
/** The base commit the pass started on. */
|
|
884
|
+
base?: string;
|
|
885
|
+
/** The pass finished without an error, so its tree and installed dependencies are complete. */
|
|
886
|
+
ok: boolean;
|
|
887
|
+
/** The pass pushed or recorded a wait, so its provider thread may continue. */
|
|
888
|
+
resumable?: boolean;
|
|
889
|
+
release?: string;
|
|
890
|
+
/** The provider thread suffix the pass ran in. */
|
|
891
|
+
session?: string;
|
|
892
|
+
outcome?: string;
|
|
893
|
+
}
|
|
894
|
+
interface PullRequestWorkspaceEntry {
|
|
895
|
+
/** The trusted host clone. */
|
|
896
|
+
checkout: string;
|
|
897
|
+
/** The provider workspace, used as `driver.cwd`. */
|
|
898
|
+
work: string;
|
|
899
|
+
/** Whether a provider workspace existed before this pass. */
|
|
900
|
+
existed: boolean;
|
|
901
|
+
previous?: PullRequestWorkspaceRecord;
|
|
902
|
+
record(result: PullRequestWorkspaceRecord): Promise<void>;
|
|
903
|
+
release(): Promise<void>;
|
|
904
|
+
}
|
|
905
|
+
type PullRequestWorkspaceStatus = "open" | "terminal" | "unknown";
|
|
906
|
+
interface PullRequestWorkspaces {
|
|
907
|
+
root: string;
|
|
908
|
+
resumeThreads: boolean;
|
|
909
|
+
sweepMs: number;
|
|
910
|
+
/** Locks the PR's entry for one pass. A pass that ends without `record()` leaves a failed record. */
|
|
911
|
+
acquire(repository: string, number: number, signal?: AbortSignal): Promise<PullRequestWorkspaceEntry>;
|
|
912
|
+
/** Removes terminal, unknown and idle entries, then least recently used ones while over budget or low on disk. */
|
|
913
|
+
sweep(status: (repository: string, number: number) => Promise<PullRequestWorkspaceStatus>): Promise<{
|
|
914
|
+
removed: {
|
|
915
|
+
name: string;
|
|
916
|
+
reason: string;
|
|
917
|
+
}[];
|
|
918
|
+
keptBytes: number;
|
|
919
|
+
kept: number;
|
|
920
|
+
}>;
|
|
921
|
+
}
|
|
922
|
+
//#endregion
|
|
923
|
+
export { createGitHubAppCredentials as C, GitHubHostSecret as S, AutomatedReviewClass as T, GitHubHostCredentials as _, BabysitterAdmissionResult as a, GitHubHostPullRequest as b, PullRequestInboxStorage as c, GitHubHost as d, GitHubHostAccess as f, GitHubHostCredentialContext as g, GitHubHostCheckoutOptions as h, BabysitterAdmissionPause as i, GitHubRequiredCheckState as l, GitHubHostCheckout as m, PullRequestWorkspaces as n, PullRequestInbox as o, GitHubHostAccessOptions as p, BabysitterAdmissionOptions as r, Snapshot as s, BabysitterWarmWorkspaces as t, GitHubAppEnvironment as u, GitHubHostForgeOptions as v, createGitHubHost as w, GitHubHostRateLimit as x, GitHubHostOptions as y };
|