@vite-hub/presets 0.7.0 → 0.9.0
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/babysitter/server.d.ts +2 -3
- package/dist/babysitter/server.js +1 -1
- package/dist/{babysitter-SWX5zXIM.js → babysitter-DuE_HaHk.js} +26 -32
- package/dist/babysitter.d.ts +8 -2
- package/dist/babysitter.js +1 -1
- package/dist/{host-1nLqi8HQ.js → host-C829xI7L.js} +4 -15
- package/dist/labeller.js +0 -1
- package/dist/{pr-workspaces-DfBICt8N.d.ts → pr-workspaces-CifuNuYg.d.ts} +7 -4
- package/dist/{server-CWLmnhPQ.js → server-BsVudCg4.js} +288 -237
- package/package.json +8 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as createGitHubAppCredentials, S as GitHubHostSecret, _ as GitHubHostCredentials, a as BabysitterAdmissionResult, b as GitHubHostPullRequest, c as PullRequestInboxStorage, d as GitHubHost, f as GitHubHostAccess, g as GitHubHostCredentialContext, h as GitHubHostCheckoutOptions, m as GitHubHostCheckout, n as PullRequestWorkspaces, o as PullRequestInbox, p as GitHubHostAccessOptions, u as GitHubAppEnvironment, v as GitHubHostForgeOptions, w as createGitHubHost, x as GitHubHostRateLimit, y as GitHubHostOptions } from "../pr-workspaces-
|
|
1
|
+
import { C as createGitHubAppCredentials, S as GitHubHostSecret, _ as GitHubHostCredentials, a as BabysitterAdmissionResult, b as GitHubHostPullRequest, c as PullRequestInboxStorage, d as GitHubHost, f as GitHubHostAccess, g as GitHubHostCredentialContext, h as GitHubHostCheckoutOptions, m as GitHubHostCheckout, n as PullRequestWorkspaces, o as PullRequestInbox, p as GitHubHostAccessOptions, u as GitHubAppEnvironment, v as GitHubHostForgeOptions, w as createGitHubHost, x as GitHubHostRateLimit, y as GitHubHostOptions } from "../pr-workspaces-CifuNuYg.js";
|
|
2
2
|
import { AgentInput } from "@vite-hub/agent";
|
|
3
3
|
import { GitHubAppRepository } from "@vite-hub/forge";
|
|
4
4
|
import { ProcessReconcilerRunContext } from "@vite-hub/runtime/internal/node";
|
|
@@ -17,6 +17,7 @@ interface BabysitterRepositories {
|
|
|
17
17
|
*/
|
|
18
18
|
observe(event: string, payload: unknown): boolean;
|
|
19
19
|
}
|
|
20
|
+
export declare function isProviderRateLimit(error: unknown): boolean;
|
|
20
21
|
export interface BabysitterRuntimeOptions {
|
|
21
22
|
agent: AgentInput;
|
|
22
23
|
/** Discovered Agent name for per-Agent public URLs. Defaults to the definition name. */
|
|
@@ -79,8 +80,6 @@ export interface BabysitterRuntimeOptions {
|
|
|
79
80
|
* A fixed 30-second poll can run for hours on a request that GitHub never settles.
|
|
80
81
|
*/
|
|
81
82
|
export declare function pendingMergeRetryAt(startedAt: number, now: number): number;
|
|
82
|
-
/** Provider quota and rate-limit failures. Cancellation is never a rate limit. */
|
|
83
|
-
export declare function isProviderRateLimit(error: unknown): boolean;
|
|
84
83
|
/**
|
|
85
84
|
* Whether the reconcile loop still makes progress, for the health route. `stalled`: the last reconcile
|
|
86
85
|
* waited longer than `stallMs` and was stopped. `silent`: no reconcile finished for `stallMs` plus one
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as createBabysitterRuntime, s as createGitHubAppCredentials, c as createGitHubHost,
|
|
1
|
+
export { t as createBabysitterRuntime, s as createGitHubAppCredentials, c as createGitHubHost, i as isProviderRateLimit, n as pendingMergeRetryAt } from "../server-BsVudCg4.js";
|
|
@@ -263,7 +263,6 @@ function createBabysitterCheckRuns(options) {
|
|
|
263
263
|
} };
|
|
264
264
|
}
|
|
265
265
|
// src/github/ci-logs.ts
|
|
266
|
-
/** The newest characters a compacted job log keeps. A checkout that lists every branch reaches 40 MB. */
|
|
267
266
|
const compactLimit = 4e6;
|
|
268
267
|
const maxRangeLines = 1e3;
|
|
269
268
|
/** Strips color codes, raw or in the visible `^[` form, and fetch branch listings, then keeps the tail. */
|
|
@@ -612,10 +611,6 @@ function loginRules(rules) {
|
|
|
612
611
|
...rules.deny ? { deny: rules.deny.map(githubLoginKey) } : {}
|
|
613
612
|
};
|
|
614
613
|
}
|
|
615
|
-
/**
|
|
616
|
-
* `author` and `authorAssociation` select the PR's author together: a PR passes when it matches
|
|
617
|
-
* either allow list, and a match on either deny list rejects it. With one of them set, it works alone.
|
|
618
|
-
*/
|
|
619
614
|
function authorMatches(value, filter) {
|
|
620
615
|
const author = filter?.author;
|
|
621
616
|
const association = filter?.authorAssociation;
|
|
@@ -739,7 +734,6 @@ function isReviewThreadOutcome(value) {
|
|
|
739
734
|
function reviewerLabeledSevere(body) {
|
|
740
735
|
return typeof body === "string" && /^[\s*_]*(?:<sub>\s*)*(?:!\[)?P[01]\b/i.test(body);
|
|
741
736
|
}
|
|
742
|
-
/** A declined reason that names its finding P0 or P1, as the outcome instructions ask ("P1: ..."). */
|
|
743
737
|
const severeDeclineReason = /^[\s*_]*P[01]\b/i;
|
|
744
738
|
const snapshotQuery = `query PullRequestOperationSnapshot($owner:String!,$name:String!,$number:Int!){
|
|
745
739
|
repository(owner:$owner,name:$name){
|
|
@@ -1244,7 +1238,11 @@ function createGitHubPullRequestOperations(github, options) {
|
|
|
1244
1238
|
if ((await snapshot()).pullRequest.body !== current.pullRequest.body) throw presetsErrorDiagnostics.PRESETS_PULL_REQUEST_BODY_CHANGED();
|
|
1245
1239
|
}
|
|
1246
1240
|
const { provider, pullRequest } = await forge();
|
|
1247
|
-
|
|
1241
|
+
const send = async () => {
|
|
1242
|
+
await provider.threads.update(pullRequest, update, { signal });
|
|
1243
|
+
};
|
|
1244
|
+
if (options.sendMetadata) await options.sendMetadata(update, send);
|
|
1245
|
+
else await send();
|
|
1248
1246
|
},
|
|
1249
1247
|
async checkDependencies() {
|
|
1250
1248
|
return await options.checkDependencies?.() ?? {
|
|
@@ -1276,7 +1274,6 @@ function createGitHubPullRequestOperations(github, options) {
|
|
|
1276
1274
|
};
|
|
1277
1275
|
}
|
|
1278
1276
|
// src/babysitter/approval.ts
|
|
1279
|
-
/** Author and reviewer associations that GitHub gives to people with write access to the repository. */
|
|
1280
1277
|
const writeAccess = /* @__PURE__ */ new Set([
|
|
1281
1278
|
"OWNER",
|
|
1282
1279
|
"MEMBER",
|
|
@@ -1284,7 +1281,6 @@ const writeAccess = /* @__PURE__ */ new Set([
|
|
|
1284
1281
|
]);
|
|
1285
1282
|
const hasWriteAccess = (association) => writeAccess.has(String(association ?? "").toUpperCase());
|
|
1286
1283
|
const reviewer = (review) => String(review.user?.login ?? review.author?.login ?? "").toLowerCase();
|
|
1287
|
-
/** Each reviewer's latest APPROVED or CHANGES_REQUESTED review whose association claims write access, by lowercase login. */
|
|
1288
1284
|
function decisiveReviews(snapshot) {
|
|
1289
1285
|
const latest = /* @__PURE__ */ new Map();
|
|
1290
1286
|
const decisive = Object.values(snapshot.reviews).filter((review) => !review.deleted && hasWriteAccess(review.author_association ?? review.authorAssociation) && ["APPROVED", "CHANGES_REQUESTED"].includes(String(review.state ?? "").toUpperCase())).sort((a, b) => String(a.submitted_at ?? a.submittedAt ?? "").localeCompare(String(b.submitted_at ?? b.submittedAt ?? "")));
|
|
@@ -1331,6 +1327,11 @@ function maintainerApproval(snapshot, head, writers) {
|
|
|
1331
1327
|
};
|
|
1332
1328
|
}
|
|
1333
1329
|
// src/babysitter/merge.ts
|
|
1330
|
+
const conventionalTitle = /^(?:build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(?:\([^()\s][^()]*\))?!?: (?!\p{Lu})\S/u;
|
|
1331
|
+
/** Whether a PR title is a conventional commit: `type(scope): summary`, lowercase after the colon, `!` for a breaking change. */
|
|
1332
|
+
function isConventionalTitle(title) {
|
|
1333
|
+
return hasRuntimeType(title, "string") && conventionalTitle.test(title);
|
|
1334
|
+
}
|
|
1334
1335
|
const failing = /* @__PURE__ */ new Set([
|
|
1335
1336
|
"failure",
|
|
1336
1337
|
"error",
|
|
@@ -1366,10 +1367,6 @@ const botAuthor = isAutomatedFeedback;
|
|
|
1366
1367
|
function hasHumanComment(thread, workerAuthors = /* @__PURE__ */ new Set()) {
|
|
1367
1368
|
return (Array.isArray(thread.comments) ? thread.comments : thread.comments?.nodes ?? []).some((comment) => !comment.deleted && !isAutomatedFeedback(comment) && !hasGitHubLogin(workerAuthors, feedbackAuthor(comment)));
|
|
1368
1369
|
}
|
|
1369
|
-
/**
|
|
1370
|
-
* Feedback that never needs a model assessment: deleted items, the worker's own items, configured
|
|
1371
|
-
* authors, items without a body and configured no-findings verdicts. Requested changes always count.
|
|
1372
|
-
*/
|
|
1373
1370
|
function ignoredFeedback(value, policy) {
|
|
1374
1371
|
if (value.deleted) return true;
|
|
1375
1372
|
if (policy.automatedReviewSettled && botAuthor(value) && (policy.severeReviewSettled || !reviewerLabeledSevere(value.body))) return true;
|
|
@@ -1379,7 +1376,6 @@ function ignoredFeedback(value, policy) {
|
|
|
1379
1376
|
const body = String(value.body ?? "").trim();
|
|
1380
1377
|
return !body || (policy.noFindingsReviews ?? []).some((prefix) => body.startsWith(prefix));
|
|
1381
1378
|
}
|
|
1382
|
-
/** Bot issue comments are activity panels that bots edit in place. Without `botBodies`, their identity is the evidence. */
|
|
1383
1379
|
function feedback(values, policy, botBodies = true) {
|
|
1384
1380
|
return Object.entries(values).filter(([, value]) => !ignoredFeedback(value, policy)).sort(([left], [right]) => left.localeCompare(right)).map(([id, value]) => ({
|
|
1385
1381
|
id,
|
|
@@ -1391,11 +1387,6 @@ function feedback(values, policy, botBodies = true) {
|
|
|
1391
1387
|
line: value.line
|
|
1392
1388
|
}));
|
|
1393
1389
|
}
|
|
1394
|
-
/**
|
|
1395
|
-
* The base branch an assessment applies to. Its commit is left out: the base advances with every
|
|
1396
|
-
* merge, and conflicts and required checks already gate the merge, so a moving base must not reopen
|
|
1397
|
-
* every review. `legacy` reproduces the identities stored before this change, which still match.
|
|
1398
|
-
*/
|
|
1399
1390
|
function mergeTarget(snapshot, legacy = false) {
|
|
1400
1391
|
const base = snapshot.pr?.base;
|
|
1401
1392
|
if (!base) return base;
|
|
@@ -1411,6 +1402,9 @@ function mergeTarget(snapshot, legacy = false) {
|
|
|
1411
1402
|
}
|
|
1412
1403
|
/** Assessment is bound to full feedback bodies and failed check evidence, never prose heuristics. */
|
|
1413
1404
|
function mergeReviewEvidenceKey(snapshot, policy = {}, legacy = false) {
|
|
1405
|
+
return reviewEvidenceKey(snapshot, policy, legacy, true);
|
|
1406
|
+
}
|
|
1407
|
+
function reviewEvidenceKey(snapshot, policy, legacy, includeThreadAuthors) {
|
|
1414
1408
|
const head = snapshot.pr?.head?.sha;
|
|
1415
1409
|
const failures = [...Object.values(snapshot.checks), ...Object.values(snapshot.statuses)].filter((value) => !value.deleted && (value.head_sha ?? value.sha) === head && !isBabysitterCheckRun(value) && failing.has(String(value.conclusion ?? value.state).toLowerCase())).map((value) => ({
|
|
1416
1410
|
id: value.id ?? value.context,
|
|
@@ -1427,7 +1421,7 @@ function mergeReviewEvidenceKey(snapshot, policy = {}, legacy = false) {
|
|
|
1427
1421
|
comments: (Array.isArray(thread.comments) ? thread.comments : thread.comments?.nodes ?? []).filter((comment) => !comment.deleted).map((comment) => ({
|
|
1428
1422
|
id: comment.node_id ?? comment.id,
|
|
1429
1423
|
body: comment.body,
|
|
1430
|
-
user: comment.user ?? comment.author,
|
|
1424
|
+
user: includeThreadAuthors ? comment.user ?? comment.author : void 0,
|
|
1431
1425
|
commit: comment.commit_id ?? comment.commit?.oid
|
|
1432
1426
|
}))
|
|
1433
1427
|
})).sort((left, right) => String(left.id).localeCompare(String(right.id)));
|
|
@@ -1446,9 +1440,9 @@ function mergeReviewEvidenceKey(snapshot, policy = {}, legacy = false) {
|
|
|
1446
1440
|
failures
|
|
1447
1441
|
})).digest("hex");
|
|
1448
1442
|
}
|
|
1449
|
-
/** Whether a stored evidence key covers this snapshot, including
|
|
1443
|
+
/** Whether a stored evidence key covers this snapshot, including keys with the base commit or without thread authors. */
|
|
1450
1444
|
function matchesMergeReviewEvidence(key, snapshot, policy = {}) {
|
|
1451
|
-
return hasRuntimeType(key, "string") && (key === mergeReviewEvidenceKey(snapshot, policy) || key === mergeReviewEvidenceKey(snapshot, policy, true));
|
|
1445
|
+
return hasRuntimeType(key, "string") && (key === mergeReviewEvidenceKey(snapshot, policy) || key === mergeReviewEvidenceKey(snapshot, policy, true) || key === reviewEvidenceKey(snapshot, policy, false, false) || key === reviewEvidenceKey(snapshot, policy, true, false));
|
|
1452
1446
|
}
|
|
1453
1447
|
/**
|
|
1454
1448
|
* Identities of the feedback items that need an assessment. An explicit assessment covers
|
|
@@ -1479,7 +1473,6 @@ function feedbackFingerprints(snapshot, policy = {}, legacy = false) {
|
|
|
1479
1473
|
function approvedIfOutside(input) {
|
|
1480
1474
|
return approvedIfOutsideGate(input, /* @__PURE__ */ new Set());
|
|
1481
1475
|
}
|
|
1482
|
-
/** A login with `[bot]` for a bot account, so a user cannot pass as a trusted bot of the same name. */
|
|
1483
1476
|
function accountLogin(user) {
|
|
1484
1477
|
const login = String(user?.login ?? "").trim().toLowerCase();
|
|
1485
1478
|
if (!login) return "";
|
|
@@ -1525,6 +1518,10 @@ function resolveBabysitterMerge(merge) {
|
|
|
1525
1518
|
option: "merge.foldStacks",
|
|
1526
1519
|
expected: "a boolean"
|
|
1527
1520
|
});
|
|
1521
|
+
if (merge.conventionalTitles !== void 0 && !hasRuntimeType(merge.conventionalTitles, "boolean")) throw presetsErrorDiagnostics.PRESETS_BABYSITTER_OPTION_INVALID({
|
|
1522
|
+
option: "merge.conventionalTitles",
|
|
1523
|
+
expected: "a boolean"
|
|
1524
|
+
});
|
|
1528
1525
|
const builtIn = merge.ready === void 0 || merge.ready === "approved-if-outside";
|
|
1529
1526
|
if (trusted?.length && !builtIn) throw presetsErrorDiagnostics.PRESETS_BABYSITTER_OPTION_INVALID({
|
|
1530
1527
|
option: "merge.trustedAuthors",
|
|
@@ -1563,7 +1560,8 @@ function resolveBabysitterMerge(merge) {
|
|
|
1563
1560
|
...ready ? { ready } : {},
|
|
1564
1561
|
...drafts?.length ? { markDraftsReady: new Set(drafts.map((login) => login.trim().toLowerCase())) } : {},
|
|
1565
1562
|
...bypassInheritedChecks.size ? { bypassInheritedChecks } : {},
|
|
1566
|
-
...forkHeadBranches.size ? { forkHeadBranches } : {}
|
|
1563
|
+
...forkHeadBranches.size ? { forkHeadBranches } : {},
|
|
1564
|
+
...merge.conventionalTitles === true ? { conventionalTitles: true } : {}
|
|
1567
1565
|
};
|
|
1568
1566
|
}
|
|
1569
1567
|
throw presetsErrorDiagnostics.PRESETS_BABYSITTER_OPTION_INVALID({
|
|
@@ -1621,6 +1619,7 @@ function directMergeReadiness(snapshot, requiredChecks, assessment = {}) {
|
|
|
1621
1619
|
const head = pr?.head?.sha;
|
|
1622
1620
|
if (!pr || String(pr.state).toLowerCase() !== "open" || !head) return no("not an open pull request");
|
|
1623
1621
|
if (pr.draft) return no("draft");
|
|
1622
|
+
if (assessment.conventionalTitles && !isConventionalTitle(pr.title)) return no("the title is not a conventional commit");
|
|
1624
1623
|
if (requiredChecks !== "passed") return no(`required checks ${requiredChecks}`);
|
|
1625
1624
|
const evidence = snapshotCheckEvidence(snapshot);
|
|
1626
1625
|
evidence.checkRuns = evidence.checkRuns.filter((check) => !assessment.inheritedCheckIds?.has(check.id));
|
|
@@ -1654,6 +1653,7 @@ function liveMergeReadiness(live, head, reviewPolicy = {}) {
|
|
|
1654
1653
|
if (String(live.state).toLowerCase() !== "open") return no("pull request is no longer open");
|
|
1655
1654
|
if (liveHead !== head) return no("head changed");
|
|
1656
1655
|
if (live.draft === true) return no("draft");
|
|
1656
|
+
if (reviewPolicy.conventionalTitles && !isConventionalTitle(live.title)) return no("the title is not a conventional commit");
|
|
1657
1657
|
if (live.mergeable === false) return no("merge conflict");
|
|
1658
1658
|
const reviewDecision = String(live.reviewDecision ?? "").toUpperCase();
|
|
1659
1659
|
if (reviewDecision === "CHANGES_REQUESTED" || reviewDecision === "REVIEW_REQUIRED") {
|
|
@@ -1826,7 +1826,6 @@ async function readInvocationInputTokens(invocations, since, signal) {
|
|
|
1826
1826
|
function babysitterModelAdmission(accepting, snapshot) {
|
|
1827
1827
|
return accepting && !(snapshot.progressBudget?.exhausted && snapshot.progressBudget.head === snapshot.pr?.head?.sha);
|
|
1828
1828
|
}
|
|
1829
|
-
/** Sums the cached per-invocation maxima for a budget window. */
|
|
1830
1829
|
function sumInvocationInputTokens(usage, since) {
|
|
1831
1830
|
let total = 0;
|
|
1832
1831
|
for (const entry of usage.values()) if (entry.updatedAt >= since) total += entry.tokens;
|
|
@@ -1931,7 +1930,6 @@ function validWarmWorkspaces(value) {
|
|
|
1931
1930
|
"sweepMinutes"
|
|
1932
1931
|
].every(nonNegative) && (value.minFreePercent === void 0 || value.minFreePercent <= 100);
|
|
1933
1932
|
}
|
|
1934
|
-
/** `owner+name+number`: GitHub names never contain `+`, so an entry name maps back to one PR. */
|
|
1935
1933
|
function entryName(repository, number) {
|
|
1936
1934
|
if (!/^[\w.-]+\/[\w.-]+$/.test(repository) || !Number.isSafeInteger(number) || number < 1) throw invariantError("the Babysitter inbox claims only pull requests of owner/name repositories");
|
|
1937
1935
|
return `${repository.toLowerCase().replace("/", "+")}+${number}`;
|
|
@@ -2004,7 +2002,6 @@ async function writeRecord(directory, record) {
|
|
|
2004
2002
|
await writeFile(temporary, JSON.stringify(record));
|
|
2005
2003
|
await rename(temporary, path);
|
|
2006
2004
|
}
|
|
2007
|
-
/** Disk use of a directory, counting hard-linked files once, on its own filesystem. */
|
|
2008
2005
|
async function diskUsage(directory) {
|
|
2009
2006
|
const { stdout } = await exec("du", [
|
|
2010
2007
|
"-sk",
|
|
@@ -2309,7 +2306,7 @@ function validMainRepair(mainRepair) {
|
|
|
2309
2306
|
return names(workflows, /\S/) && (repositories === void 0 || names(repositories, /^[\w.-]+\/[\w.-]+$/)) && (stuckJobMinutes === void 0 || stuckJobMinutes === false || Number.isSafeInteger(stuckJobMinutes) && Number(stuckJobMinutes) >= 1);
|
|
2310
2307
|
}
|
|
2311
2308
|
const babysitterHost = { async create(context) {
|
|
2312
|
-
const { createBabysitterProcessHost } = await import("./host-
|
|
2309
|
+
const { createBabysitterProcessHost } = await import("./host-C829xI7L.js");
|
|
2313
2310
|
return await createBabysitterProcessHost(context);
|
|
2314
2311
|
} };
|
|
2315
2312
|
function plainSecret(value) {
|
|
@@ -2377,20 +2374,17 @@ function validAuthorAssociationRules(rules) {
|
|
|
2377
2374
|
if (!isRuntimeRecord(rules) || Array.isArray(rules)) return false;
|
|
2378
2375
|
return [rules.allow, rules.deny].every((list) => list === void 0 || Array.isArray(list) && list.every((value) => githubAuthorAssociations.includes(value)));
|
|
2379
2376
|
}
|
|
2380
|
-
/** Deployment preview bots. They post status panels that they edit in place, never review findings. */
|
|
2381
2377
|
const previewBots = [
|
|
2382
2378
|
"pkg-pr-new[bot]",
|
|
2383
2379
|
"vercel[bot]",
|
|
2384
2380
|
"cloudflare-workers-and-pages[bot]",
|
|
2385
2381
|
"netlify[bot]"
|
|
2386
2382
|
];
|
|
2387
|
-
/** Authors that a filter without `author` or `authorAssociation` rules selects: people with write access. */
|
|
2388
2383
|
const defaultAuthorAssociations = [
|
|
2389
2384
|
"OWNER",
|
|
2390
2385
|
"MEMBER",
|
|
2391
2386
|
"COLLABORATOR"
|
|
2392
2387
|
];
|
|
2393
|
-
/** The label that pauses a PR when neither `lifecycle.labels` nor `filter.labels` is configured. */
|
|
2394
2388
|
const defaultSkipLabel = "babysitter:skip";
|
|
2395
2389
|
/**
|
|
2396
2390
|
* Combines explicit lifecycle labels with the shared GitHub PR filter. A filter without author rules
|
|
@@ -2582,4 +2576,4 @@ const babysitter = defineAgent({
|
|
|
2582
2576
|
}), babysitterHost);
|
|
2583
2577
|
}
|
|
2584
2578
|
});
|
|
2585
|
-
export {
|
|
2579
|
+
export { reviewerLabeledSevere as A, isBabysitterCheckRun as B, snapshotCheckEvidence as C, isReviewThreadOutcome as D, createGitHubPullRequestOperations as E, actionLocation as F, failed as I, hydrateFailedCiEvidence as L, invariantError as M, hasGitHubLogin as N, normalizeGitHubMentionAllowlist as O, matchesBabysitterPullRequestFilter as P, newestCheckRun as R, resolveBabysitterMerge as S, maintainerApproval as T, createBabysitterPassResultSchema as V, isAutomatedFeedback as _, isBabysitterPlacementCapacityError as a, matchesMergeReviewEvidence as b, workspaceDecision as c, resolveBabysitterAdmissionLimits as d, sharedBabysitterRead as f, headChecksUnreported as g, hasHumanComment as h, BabysitterPlacementCapacityError as i, invariant as j, reviewThreadOutcomes as k, babysitterModelAdmission as l, feedbackFingerprints as m, babysitterPassResultSchema as n, createPullRequestWorkspaces as o, directMergeReadiness as p, resolveBabysitterLifecycleFilter as r, providerSessionDecision as s, babysitter as t, createBabysitterAdmission as u, isConventionalTitle as v, approvalReviewers as w, mergeReviewEvidenceKey as x, liveMergeReadiness as y, createBabysitterCheckRuns as z };
|
package/dist/babysitter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as AutomatedReviewClass, i as BabysitterAdmissionPause, l as GitHubRequiredCheckState, r as BabysitterAdmissionOptions, s as Snapshot, t as BabysitterWarmWorkspaces } from "./pr-workspaces-
|
|
1
|
+
import { T as AutomatedReviewClass, i as BabysitterAdmissionPause, l as GitHubRequiredCheckState, r as BabysitterAdmissionOptions, s as Snapshot, t as BabysitterWarmWorkspaces } from "./pr-workspaces-CifuNuYg.js";
|
|
2
2
|
import { AgentDefinition, AgentInvocationContextValues, AgentInvoker, AgentRuntimeConfig, AgentSandboxDefinition, BuiltInAgentDriverName, ConfiguredAgentDefinition } from "@vite-hub/agent";
|
|
3
3
|
import { GitHubPullRequestFilter } from "@vite-hub/agent/channels";
|
|
4
4
|
import { Diagnostic } from "nostics";
|
|
@@ -85,6 +85,13 @@ type BabysitterMerge = false | "auto" | "direct" | {
|
|
|
85
85
|
* open pull request in the same repository, so the stack lands with the parent. Default `true`.
|
|
86
86
|
*/
|
|
87
87
|
foldStacks?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Merge only a pull request whose title is a conventional commit, such as `fix(ui): keep the row`.
|
|
90
|
+
* A pull request with another title gets a pass that renames it. A squash merge also uses the
|
|
91
|
+
* title as the commit title, so a pull request with one commit lands its title, not its commit
|
|
92
|
+
* message. Default `false`.
|
|
93
|
+
*/
|
|
94
|
+
conventionalTitles?: boolean;
|
|
88
95
|
};
|
|
89
96
|
/**
|
|
90
97
|
* Opens a pull request that repairs the default branch when one of its watched workflows fails. PR
|
|
@@ -407,7 +414,6 @@ export interface BabysitterPassResult {
|
|
|
407
414
|
automatedReview?: AutomatedReviewClass;
|
|
408
415
|
}
|
|
409
416
|
export declare const babysitterPassResultSchema: ReturnType<typeof createBabysitterPassResultSchema>;
|
|
410
|
-
/** A repair workflow. Connections, provider settings and host resources stay in the application. */
|
|
411
417
|
type BabysitterDefinition = AgentDefinition<AgentRuntimeConfig, unknown, AgentInvoker, AgentInvocationContextValues, BabysitterPassResult> & {
|
|
412
418
|
reviewChecks: string[];
|
|
413
419
|
noFindingsReviews: string[];
|
package/dist/babysitter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as BabysitterPlacementCapacityError, t as babysitter, n as babysitterPassResultSchema, r as resolveBabysitterLifecycleFilter } from "./babysitter-
|
|
1
|
+
export { i as BabysitterPlacementCapacityError, t as babysitter, n as babysitterPassResultSchema, r as resolveBabysitterLifecycleFilter } from "./babysitter-DuE_HaHk.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as isRuntimeRecord, n as hasRuntimeType, t as presetsErrorDiagnostics } from "./error-diagnostics-ba9TWgh5.js";
|
|
2
|
-
import { a as budgetParks, c as createGitHubHost,
|
|
3
|
-
import { d as resolveBabysitterAdmissionLimits, f as sharedBabysitterRead, o as createPullRequestWorkspaces, r as resolveBabysitterLifecycleFilter, u as createBabysitterAdmission } from "./babysitter-
|
|
2
|
+
import { a as budgetParks, c as createGitHubHost, o as pullRequestThreadId, r as babysitterQueueHealth, s as createGitHubAppCredentials, t as createBabysitterRuntime } from "./server-BsVudCg4.js";
|
|
3
|
+
import { d as resolveBabysitterAdmissionLimits, f as sharedBabysitterRead, o as createPullRequestWorkspaces, r as resolveBabysitterLifecycleFilter, u as createBabysitterAdmission } from "./babysitter-DuE_HaHk.js";
|
|
4
4
|
import { defineAgent } from "@vite-hub/agent";
|
|
5
5
|
import { forgeErrorStatus, githubInstallationRouting } from "@vite-hub/forge";
|
|
6
6
|
import { channelEnv } from "@vite-hub/agent/channels";
|
|
@@ -185,7 +185,6 @@ function createBabysitterPreflight(install, checkCommand = async (program, probe
|
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
// src/babysitter/repositories.ts
|
|
188
|
-
/** How long the installation repository list stays fresh without an installation webhook. */
|
|
189
188
|
const installationRepositoriesTtlMs = 6e5;
|
|
190
189
|
const repositoryName = /^[\w.-]+\/[\w.-]+$/;
|
|
191
190
|
function lowercaseNames(values) {
|
|
@@ -254,12 +253,6 @@ function babysitterRepositories(filter, read, { ttlMs = installationRepositories
|
|
|
254
253
|
};
|
|
255
254
|
}
|
|
256
255
|
// src/babysitter/webhook-redelivery.ts
|
|
257
|
-
/**
|
|
258
|
-
* Progress events that a later event of the same run replaces. A lost `check_run.created` or
|
|
259
|
-
* `workflow_run.in_progress` changes nothing once its `completed` event arrives, and change detection
|
|
260
|
-
* reads running checks anyway. They are most of the failed deliveries, and sending them first delays
|
|
261
|
-
* the `completed` events that let a green PR merge.
|
|
262
|
-
*/
|
|
263
256
|
const superseded = /* @__PURE__ */ new Set([
|
|
264
257
|
"check_run.created",
|
|
265
258
|
"check_run.rerequested",
|
|
@@ -271,7 +264,6 @@ const superseded = /* @__PURE__ */ new Set([
|
|
|
271
264
|
"workflow_job.in_progress",
|
|
272
265
|
"workflow_job.waiting"
|
|
273
266
|
]);
|
|
274
|
-
/** Lower sends first: results and PR state before comments and the rest. */
|
|
275
267
|
function priority(name) {
|
|
276
268
|
if (name.endsWith(".completed") || name === "status") return 0;
|
|
277
269
|
if (name.startsWith("pull_request.") || name.startsWith("pull_request_review") || name === "push") return 1;
|
|
@@ -293,9 +285,7 @@ function createWebhookRedelivery(options) {
|
|
|
293
285
|
const sent = /* @__PURE__ */ new Map();
|
|
294
286
|
let watermark;
|
|
295
287
|
let running = false;
|
|
296
|
-
return {
|
|
297
|
-
/** Redelivers the failed deliveries since the last sweep. Returns how many it sent. */
|
|
298
|
-
async sweep(signal) {
|
|
288
|
+
return { async sweep(signal) {
|
|
299
289
|
if (running) return 0;
|
|
300
290
|
running = true;
|
|
301
291
|
const start = now();
|
|
@@ -354,7 +344,6 @@ function envString(value) {
|
|
|
354
344
|
if (hasRuntimeType(plain, "number")) return String(plain);
|
|
355
345
|
return hasRuntimeType(plain, "string") && plain.trim() ? plain.trim() : void 0;
|
|
356
346
|
}
|
|
357
|
-
/** Accept PEM secrets from systemd and dotenv files that encode newlines as `\\n`. */
|
|
358
347
|
function normalizePrivateKey(value) {
|
|
359
348
|
return value?.replace(/\\n/g, "\n");
|
|
360
349
|
}
|
|
@@ -508,7 +497,7 @@ async function createBabysitterProcessHost(context) {
|
|
|
508
497
|
run: async (reason, run, accepting) => await runtime?.reconcile(reason, run, accepting)
|
|
509
498
|
});
|
|
510
499
|
const preflight = createBabysitterPreflight(agent.options.install ?? true);
|
|
511
|
-
const buildRevision = "
|
|
500
|
+
const buildRevision = "4db4e0330c76cfb71d77dc83de506eac3b90993c4fd38754b88d9c2b1cad11c9";
|
|
512
501
|
const admission = createBabysitterAdmission({
|
|
513
502
|
invocations: host.invocations,
|
|
514
503
|
limits: resolveBabysitterAdmissionLimits(agent.options.admission),
|
package/dist/labeller.js
CHANGED
|
@@ -237,7 +237,6 @@ const labeller = defineAgent({
|
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
|
-
/** Gmail's largest search page. A later run finds the rest. */
|
|
241
240
|
const cleanupLimit = 500;
|
|
242
241
|
const trashConcurrency = 5;
|
|
243
242
|
const messageList = v.object({ messages: v.optional(v.array(v.object({ id: v.string() }))) });
|
|
@@ -259,13 +259,9 @@ interface GitHubAppEnvironment {
|
|
|
259
259
|
*/
|
|
260
260
|
declare function createGitHubAppCredentials(app: GitHubAppEnvironment): {
|
|
261
261
|
credentials(context: GitHubHostCredentialContext): Promise<GitHubHostCredentials>;
|
|
262
|
-
/** Every repository that the App's installations can access. */
|
|
263
262
|
repositories: (signal?: AbortSignal) => Promise<GitHubAppRepository[]>;
|
|
264
|
-
/** Failed App webhook deliveries since `since` that no later attempt delivered, oldest first. */
|
|
265
263
|
failedDeliveries: (since: number, signal?: AbortSignal) => Promise<GitHubAppDelivery[]>;
|
|
266
|
-
/** Sends one App webhook delivery again. */
|
|
267
264
|
redeliver: (id: string, signal?: AbortSignal) => Promise<void>;
|
|
268
|
-
/** The App bot's login and noreply email, used as the commit author. */
|
|
269
265
|
identity(): Promise<Required<GitHubHostIdentity>>;
|
|
270
266
|
};
|
|
271
267
|
declare function createGitHubHost(options: GitHubHostOptions): GitHubHost;
|
|
@@ -471,6 +467,8 @@ interface StatusDelivery {
|
|
|
471
467
|
interface HostHead {
|
|
472
468
|
head: string;
|
|
473
469
|
parent: string;
|
|
470
|
+
/** A pass pushed this head. A base update that the host asked GitHub for has no flag. */
|
|
471
|
+
repair?: true;
|
|
474
472
|
}
|
|
475
473
|
type Snapshot = {
|
|
476
474
|
repository: string;
|
|
@@ -493,6 +491,10 @@ type Snapshot = {
|
|
|
493
491
|
dailyPassBudget?: DailyPassBudget;
|
|
494
492
|
/** Generation of the last human comment or review. A wait rejected before it stays free. */
|
|
495
493
|
humanFeedbackGeneration?: number;
|
|
494
|
+
metadataEdits?: Partial<Record<"title" | "body", {
|
|
495
|
+
generation: number;
|
|
496
|
+
externalGeneration: number;
|
|
497
|
+
}>>;
|
|
496
498
|
recoveryHead?: string;
|
|
497
499
|
sourcePushHead?: string;
|
|
498
500
|
sourcePushHeads?: string[];
|
|
@@ -783,6 +785,7 @@ declare class PullRequestInbox {
|
|
|
783
785
|
* `budgets.dailyPasses`. It changes no evidence, so the claim stays current.
|
|
784
786
|
*/
|
|
785
787
|
recordModelPass(claim: Claim, exemption?: string): Promise<number | false>;
|
|
788
|
+
recordModelPass(claim: Claim, exemption?: string, observed?: Pick<Snapshot, "generation" | "revision">): Promise<number | false | "changed">;
|
|
786
789
|
/**
|
|
787
790
|
* Gives back the pass that `recordModelPass` counted at `at`, and its exemption, when the provider
|
|
788
791
|
* failed the pass before it did any work. It changes no evidence, so the claim stays current.
|