@vite-hub/presets 0.8.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.
@@ -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-CbTDCpFn.js";
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";
@@ -1 +1 @@
1
- export { t as createBabysitterRuntime, s as createGitHubAppCredentials, c as createGitHubHost, i as isProviderRateLimit, n as pendingMergeRetryAt } from "../server-CnBPeA2q.js";
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){
@@ -1280,7 +1274,6 @@ function createGitHubPullRequestOperations(github, options) {
1280
1274
  };
1281
1275
  }
1282
1276
  // src/babysitter/approval.ts
1283
- /** Author and reviewer associations that GitHub gives to people with write access to the repository. */
1284
1277
  const writeAccess = /* @__PURE__ */ new Set([
1285
1278
  "OWNER",
1286
1279
  "MEMBER",
@@ -1288,7 +1281,6 @@ const writeAccess = /* @__PURE__ */ new Set([
1288
1281
  ]);
1289
1282
  const hasWriteAccess = (association) => writeAccess.has(String(association ?? "").toUpperCase());
1290
1283
  const reviewer = (review) => String(review.user?.login ?? review.author?.login ?? "").toLowerCase();
1291
- /** Each reviewer's latest APPROVED or CHANGES_REQUESTED review whose association claims write access, by lowercase login. */
1292
1284
  function decisiveReviews(snapshot) {
1293
1285
  const latest = /* @__PURE__ */ new Map();
1294
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 ?? "")));
@@ -1335,6 +1327,11 @@ function maintainerApproval(snapshot, head, writers) {
1335
1327
  };
1336
1328
  }
1337
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
+ }
1338
1335
  const failing = /* @__PURE__ */ new Set([
1339
1336
  "failure",
1340
1337
  "error",
@@ -1370,10 +1367,6 @@ const botAuthor = isAutomatedFeedback;
1370
1367
  function hasHumanComment(thread, workerAuthors = /* @__PURE__ */ new Set()) {
1371
1368
  return (Array.isArray(thread.comments) ? thread.comments : thread.comments?.nodes ?? []).some((comment) => !comment.deleted && !isAutomatedFeedback(comment) && !hasGitHubLogin(workerAuthors, feedbackAuthor(comment)));
1372
1369
  }
1373
- /**
1374
- * Feedback that never needs a model assessment: deleted items, the worker's own items, configured
1375
- * authors, items without a body and configured no-findings verdicts. Requested changes always count.
1376
- */
1377
1370
  function ignoredFeedback(value, policy) {
1378
1371
  if (value.deleted) return true;
1379
1372
  if (policy.automatedReviewSettled && botAuthor(value) && (policy.severeReviewSettled || !reviewerLabeledSevere(value.body))) return true;
@@ -1383,7 +1376,6 @@ function ignoredFeedback(value, policy) {
1383
1376
  const body = String(value.body ?? "").trim();
1384
1377
  return !body || (policy.noFindingsReviews ?? []).some((prefix) => body.startsWith(prefix));
1385
1378
  }
1386
- /** Bot issue comments are activity panels that bots edit in place. Without `botBodies`, their identity is the evidence. */
1387
1379
  function feedback(values, policy, botBodies = true) {
1388
1380
  return Object.entries(values).filter(([, value]) => !ignoredFeedback(value, policy)).sort(([left], [right]) => left.localeCompare(right)).map(([id, value]) => ({
1389
1381
  id,
@@ -1395,11 +1387,6 @@ function feedback(values, policy, botBodies = true) {
1395
1387
  line: value.line
1396
1388
  }));
1397
1389
  }
1398
- /**
1399
- * The base branch an assessment applies to. Its commit is left out: the base advances with every
1400
- * merge, and conflicts and required checks already gate the merge, so a moving base must not reopen
1401
- * every review. `legacy` reproduces the identities stored before this change, which still match.
1402
- */
1403
1390
  function mergeTarget(snapshot, legacy = false) {
1404
1391
  const base = snapshot.pr?.base;
1405
1392
  if (!base) return base;
@@ -1486,7 +1473,6 @@ function feedbackFingerprints(snapshot, policy = {}, legacy = false) {
1486
1473
  function approvedIfOutside(input) {
1487
1474
  return approvedIfOutsideGate(input, /* @__PURE__ */ new Set());
1488
1475
  }
1489
- /** A login with `[bot]` for a bot account, so a user cannot pass as a trusted bot of the same name. */
1490
1476
  function accountLogin(user) {
1491
1477
  const login = String(user?.login ?? "").trim().toLowerCase();
1492
1478
  if (!login) return "";
@@ -1532,6 +1518,10 @@ function resolveBabysitterMerge(merge) {
1532
1518
  option: "merge.foldStacks",
1533
1519
  expected: "a boolean"
1534
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
+ });
1535
1525
  const builtIn = merge.ready === void 0 || merge.ready === "approved-if-outside";
1536
1526
  if (trusted?.length && !builtIn) throw presetsErrorDiagnostics.PRESETS_BABYSITTER_OPTION_INVALID({
1537
1527
  option: "merge.trustedAuthors",
@@ -1570,7 +1560,8 @@ function resolveBabysitterMerge(merge) {
1570
1560
  ...ready ? { ready } : {},
1571
1561
  ...drafts?.length ? { markDraftsReady: new Set(drafts.map((login) => login.trim().toLowerCase())) } : {},
1572
1562
  ...bypassInheritedChecks.size ? { bypassInheritedChecks } : {},
1573
- ...forkHeadBranches.size ? { forkHeadBranches } : {}
1563
+ ...forkHeadBranches.size ? { forkHeadBranches } : {},
1564
+ ...merge.conventionalTitles === true ? { conventionalTitles: true } : {}
1574
1565
  };
1575
1566
  }
1576
1567
  throw presetsErrorDiagnostics.PRESETS_BABYSITTER_OPTION_INVALID({
@@ -1628,6 +1619,7 @@ function directMergeReadiness(snapshot, requiredChecks, assessment = {}) {
1628
1619
  const head = pr?.head?.sha;
1629
1620
  if (!pr || String(pr.state).toLowerCase() !== "open" || !head) return no("not an open pull request");
1630
1621
  if (pr.draft) return no("draft");
1622
+ if (assessment.conventionalTitles && !isConventionalTitle(pr.title)) return no("the title is not a conventional commit");
1631
1623
  if (requiredChecks !== "passed") return no(`required checks ${requiredChecks}`);
1632
1624
  const evidence = snapshotCheckEvidence(snapshot);
1633
1625
  evidence.checkRuns = evidence.checkRuns.filter((check) => !assessment.inheritedCheckIds?.has(check.id));
@@ -1661,6 +1653,7 @@ function liveMergeReadiness(live, head, reviewPolicy = {}) {
1661
1653
  if (String(live.state).toLowerCase() !== "open") return no("pull request is no longer open");
1662
1654
  if (liveHead !== head) return no("head changed");
1663
1655
  if (live.draft === true) return no("draft");
1656
+ if (reviewPolicy.conventionalTitles && !isConventionalTitle(live.title)) return no("the title is not a conventional commit");
1664
1657
  if (live.mergeable === false) return no("merge conflict");
1665
1658
  const reviewDecision = String(live.reviewDecision ?? "").toUpperCase();
1666
1659
  if (reviewDecision === "CHANGES_REQUESTED" || reviewDecision === "REVIEW_REQUIRED") {
@@ -1833,7 +1826,6 @@ async function readInvocationInputTokens(invocations, since, signal) {
1833
1826
  function babysitterModelAdmission(accepting, snapshot) {
1834
1827
  return accepting && !(snapshot.progressBudget?.exhausted && snapshot.progressBudget.head === snapshot.pr?.head?.sha);
1835
1828
  }
1836
- /** Sums the cached per-invocation maxima for a budget window. */
1837
1829
  function sumInvocationInputTokens(usage, since) {
1838
1830
  let total = 0;
1839
1831
  for (const entry of usage.values()) if (entry.updatedAt >= since) total += entry.tokens;
@@ -1938,7 +1930,6 @@ function validWarmWorkspaces(value) {
1938
1930
  "sweepMinutes"
1939
1931
  ].every(nonNegative) && (value.minFreePercent === void 0 || value.minFreePercent <= 100);
1940
1932
  }
1941
- /** `owner+name+number`: GitHub names never contain `+`, so an entry name maps back to one PR. */
1942
1933
  function entryName(repository, number) {
1943
1934
  if (!/^[\w.-]+\/[\w.-]+$/.test(repository) || !Number.isSafeInteger(number) || number < 1) throw invariantError("the Babysitter inbox claims only pull requests of owner/name repositories");
1944
1935
  return `${repository.toLowerCase().replace("/", "+")}+${number}`;
@@ -2011,7 +2002,6 @@ async function writeRecord(directory, record) {
2011
2002
  await writeFile(temporary, JSON.stringify(record));
2012
2003
  await rename(temporary, path);
2013
2004
  }
2014
- /** Disk use of a directory, counting hard-linked files once, on its own filesystem. */
2015
2005
  async function diskUsage(directory) {
2016
2006
  const { stdout } = await exec("du", [
2017
2007
  "-sk",
@@ -2316,7 +2306,7 @@ function validMainRepair(mainRepair) {
2316
2306
  return names(workflows, /\S/) && (repositories === void 0 || names(repositories, /^[\w.-]+\/[\w.-]+$/)) && (stuckJobMinutes === void 0 || stuckJobMinutes === false || Number.isSafeInteger(stuckJobMinutes) && Number(stuckJobMinutes) >= 1);
2317
2307
  }
2318
2308
  const babysitterHost = { async create(context) {
2319
- const { createBabysitterProcessHost } = await import("./host-Dq3z2dW8.js");
2309
+ const { createBabysitterProcessHost } = await import("./host-C829xI7L.js");
2320
2310
  return await createBabysitterProcessHost(context);
2321
2311
  } };
2322
2312
  function plainSecret(value) {
@@ -2384,20 +2374,17 @@ function validAuthorAssociationRules(rules) {
2384
2374
  if (!isRuntimeRecord(rules) || Array.isArray(rules)) return false;
2385
2375
  return [rules.allow, rules.deny].every((list) => list === void 0 || Array.isArray(list) && list.every((value) => githubAuthorAssociations.includes(value)));
2386
2376
  }
2387
- /** Deployment preview bots. They post status panels that they edit in place, never review findings. */
2388
2377
  const previewBots = [
2389
2378
  "pkg-pr-new[bot]",
2390
2379
  "vercel[bot]",
2391
2380
  "cloudflare-workers-and-pages[bot]",
2392
2381
  "netlify[bot]"
2393
2382
  ];
2394
- /** Authors that a filter without `author` or `authorAssociation` rules selects: people with write access. */
2395
2383
  const defaultAuthorAssociations = [
2396
2384
  "OWNER",
2397
2385
  "MEMBER",
2398
2386
  "COLLABORATOR"
2399
2387
  ];
2400
- /** The label that pauses a PR when neither `lifecycle.labels` nor `filter.labels` is configured. */
2401
2388
  const defaultSkipLabel = "babysitter:skip";
2402
2389
  /**
2403
2390
  * Combines explicit lifecycle labels with the shared GitHub PR filter. A filter without author rules
@@ -2589,4 +2576,4 @@ const babysitter = defineAgent({
2589
2576
  }), babysitterHost);
2590
2577
  }
2591
2578
  });
2592
- export { invariant as A, createBabysitterPassResultSchema as B, approvalReviewers as C, normalizeGitHubMentionAllowlist as D, isReviewThreadOutcome as E, failed as F, hydrateFailedCiEvidence as I, newestCheckRun as L, hasGitHubLogin as M, matchesBabysitterPullRequestFilter as N, reviewThreadOutcomes as O, actionLocation as P, createBabysitterCheckRuns as R, snapshotCheckEvidence as S, createGitHubPullRequestOperations as T, isAutomatedFeedback as _, isBabysitterPlacementCapacityError as a, mergeReviewEvidenceKey as b, workspaceDecision as c, resolveBabysitterAdmissionLimits as d, sharedBabysitterRead as f, headChecksUnreported as g, hasHumanComment as h, BabysitterPlacementCapacityError as i, invariantError as j, reviewerLabeledSevere 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, liveMergeReadiness as v, maintainerApproval as w, resolveBabysitterMerge as x, matchesMergeReviewEvidence as y, isBabysitterCheckRun as z };
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 };
@@ -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-CbTDCpFn.js";
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[];
@@ -1 +1 @@
1
- export { i as BabysitterPlacementCapacityError, t as babysitter, n as babysitterPassResultSchema, r as resolveBabysitterLifecycleFilter } from "./babysitter-C92vTLpo.js";
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, o as pullRequestThreadId, r as babysitterQueueHealth, s as createGitHubAppCredentials, t as createBabysitterRuntime } from "./server-CnBPeA2q.js";
3
- import { d as resolveBabysitterAdmissionLimits, f as sharedBabysitterRead, o as createPullRequestWorkspaces, r as resolveBabysitterLifecycleFilter, u as createBabysitterAdmission } from "./babysitter-C92vTLpo.js";
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 = "7fd99b60ad33356545ce233e0675580c666313fbf3f50e93db479920a1ba9fad";
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;
@@ -1,5 +1,5 @@
1
1
  import { a as isRuntimeString, i as isRuntimeRecord, n as hasRuntimeType, r as isRuntimeNumber, t as presetsErrorDiagnostics } from "./error-diagnostics-ba9TWgh5.js";
2
- import { A as invariant, B as createBabysitterPassResultSchema, C as approvalReviewers, D as normalizeGitHubMentionAllowlist, E as isReviewThreadOutcome, F as failed$1, I as hydrateFailedCiEvidence, L as newestCheckRun, M as hasGitHubLogin, N as matchesBabysitterPullRequestFilter, O as reviewThreadOutcomes, P as actionLocation, R as createBabysitterCheckRuns, S as snapshotCheckEvidence, T as createGitHubPullRequestOperations, _ as isAutomatedFeedback, a as isBabysitterPlacementCapacityError, b as mergeReviewEvidenceKey, c as workspaceDecision, g as headChecksUnreported, h as hasHumanComment, j as invariantError, k as reviewerLabeledSevere, l as babysitterModelAdmission, m as feedbackFingerprints, p as directMergeReadiness, r as resolveBabysitterLifecycleFilter, s as providerSessionDecision, v as liveMergeReadiness, w as maintainerApproval, x as resolveBabysitterMerge, y as matchesMergeReviewEvidence, z as isBabysitterCheckRun } from "./babysitter-C92vTLpo.js";
2
+ import { A as reviewerLabeledSevere, B as isBabysitterCheckRun, C as snapshotCheckEvidence, D as isReviewThreadOutcome, E as createGitHubPullRequestOperations, F as actionLocation, I as failed$1, L as hydrateFailedCiEvidence, M as invariantError, N as hasGitHubLogin, O as normalizeGitHubMentionAllowlist, P as matchesBabysitterPullRequestFilter, R as newestCheckRun, S as resolveBabysitterMerge, T as maintainerApproval, V as createBabysitterPassResultSchema, _ as isAutomatedFeedback, a as isBabysitterPlacementCapacityError, b as matchesMergeReviewEvidence, c as workspaceDecision, g as headChecksUnreported, h as hasHumanComment, j as invariant, k as reviewThreadOutcomes, l as babysitterModelAdmission, m as feedbackFingerprints, p as directMergeReadiness, r as resolveBabysitterLifecycleFilter, s as providerSessionDecision, v as isConventionalTitle, w as approvalReviewers, x as mergeReviewEvidenceKey, y as liveMergeReadiness, z as createBabysitterCheckRuns } from "./babysitter-DuE_HaHk.js";
3
3
  import { activeProviderSandbox, agentInvocationId, agentSettings, createMessage, defineAgent, defineCapability, publishAgentActivity, recordProviderCheckout, runAgent, withoutForgeAccess } from "@vite-hub/agent";
4
4
  import { createHash, randomUUID } from "node:crypto";
5
5
  import { resolvePublicUrl } from "@vite-hub/runtime";
@@ -21,7 +21,6 @@ import { resolveRuntimeValue } from "@vite-hub/runtime/internal/context";
21
21
  import { resolveRegisteredWorkspaceDefinition } from "@vite-hub/workspace/runtime";
22
22
  // src/github/checkout.ts
23
23
  const exec$6 = promisify(execFile);
24
- /** Credentials belong to the host. Never carry saved clone authentication into a worker. */
25
24
  async function sanitizeProviderGitConfig(git, destination) {
26
25
  const sensitive = (key) => /^credential\.|^include(?:if)?(?:[.:].*)?\.path$|^core\.(?:askpass|sshcommand|hookspath|worktree)$|^sendemail\.(?:.*\.)?smtppass$|^imap\.pass$|^gitcvs\.dbpass$|^http\..*extraheader$|^http\.extraheader$|^http\.(?:.*\.)?(?:proxy|cookiefile|sslkey(?:type|passwordprotected)?|sslcert(?:type|passwordprotected)?|proxysslkey|proxysslcert|proxysslcertpasswordprotected)$/i.test(key) || /^remote\..*\.proxy$/i.test(key);
27
26
  const sanitize = async (scope) => {
@@ -69,7 +68,6 @@ async function sanitizeProviderGitConfig(git, destination) {
69
68
  await sanitize("--local");
70
69
  await sanitize("--worktree");
71
70
  }
72
- /** Resolves a prepared host clone and a provider workspace that neither contains the other. */
73
71
  async function separateCheckouts(checkout, target) {
74
72
  const source = await realpath(checkout);
75
73
  const destination = await realpath(target);
@@ -1120,13 +1118,11 @@ function createGitHubInstallSlots({ concurrency = 1, queueTimeoutMs = 12e4 } = {
1120
1118
  } };
1121
1119
  }
1122
1120
  const defaultInstallSlots = createGitHubInstallSlots();
1123
- /** Repository scripts, pnpmfile hooks and package-manager self-management never run on the host. */
1124
1121
  const pnpmProtectedFlags = [
1125
1122
  "--ignore-scripts",
1126
1123
  "--ignore-pnpmfile",
1127
1124
  "--config.manage-package-manager-versions=false"
1128
1125
  ];
1129
- /** Host environment for package managers: no host credentials and no repository-selected Corepack behavior. */
1130
1126
  async function packageManagerEnvironment(target) {
1131
1127
  const home = join(target, ".git", "vitehub-install-home");
1132
1128
  await mkdir(home, { recursive: true });
@@ -1144,7 +1140,6 @@ async function packageManagerEnvironment(target) {
1144
1140
  COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"
1145
1141
  };
1146
1142
  }
1147
- /** Corepack must not execute a PR-supplied URL, devEngines override or yarnPath. Select an official version. */
1148
1143
  async function packageManagerVersion(source) {
1149
1144
  const { packageManager } = v.parse(manifest, await exists$1(join(source, "package.json")) ? JSON.parse(await readFile(join(source, "package.json"), "utf8")) : {});
1150
1145
  return (name, fallback) => {
@@ -1555,11 +1550,6 @@ async function resolveGitHubMergeConflicts(target, git, options = {}) {
1555
1550
  ...lockfile ? { lockfile } : {}
1556
1551
  };
1557
1552
  }
1558
- /**
1559
- * Regeneration resolves dependencies the base lockfile never listed. pnpm 7 and older run the `prepare`
1560
- * script of a Git-hosted dependency even with --ignore-scripts, so only pnpm 9 or newer, or the host's
1561
- * default when package.json selects none, may resolve on the host.
1562
- */
1563
1553
  async function scriptSafePnpm(target) {
1564
1554
  let manifest;
1565
1555
  try {
@@ -1572,7 +1562,6 @@ async function scriptSafePnpm(target) {
1572
1562
  const major = typeof packageManager === "string" ? /^pnpm@(\d+)\./.exec(packageManager)?.[1] : void 0;
1573
1563
  return major !== void 0 && Number(major) >= 9;
1574
1564
  }
1575
- /** Files that pnpm reads as dependency inputs. While one is conflicted, the lockfile cannot be regenerated. */
1576
1565
  function dependencyInput(path) {
1577
1566
  return [
1578
1567
  "package.json",
@@ -1582,7 +1571,6 @@ function dependencyInput(path) {
1582
1571
  ".pnpmfile.mjs"
1583
1572
  ].includes(basename(path)) || path.startsWith("patches/");
1584
1573
  }
1585
- /** Prose where two sides adding text at the same place can both be kept. Code never qualifies. */
1586
1574
  function unionDocument(path) {
1587
1575
  return /^docs\/.+\.md$/.test(path) || /^packages\/[^/]+\/README\.md$/.test(path);
1588
1576
  }
@@ -1593,7 +1581,6 @@ const markers = {
1593
1581
  split: "=".repeat(markerSize),
1594
1582
  theirs: `${">".repeat(markerSize)} theirs`
1595
1583
  };
1596
- /** Keep both sides of every conflict hunk whose merge-base side is empty: base text first, then the PR's. */
1597
1584
  async function unionAdditions(git, entry, sides) {
1598
1585
  const markerLines = new Set(Object.values(markers));
1599
1586
  if (sides.some((side) => side.includes("\r") || side.split("\n").some((line) => markerLines.has(line)))) return void 0;
@@ -1644,7 +1631,6 @@ async function unionAdditions(git, entry, sides) {
1644
1631
  const plain = (block) => block.kind === "plain" && block.components === 0;
1645
1632
  const tableRow = (line) => line !== void 0 && /(?:^|[^\\])\|/.test(line);
1646
1633
  const content = (line) => line.replace(/^(?:\s*>)+/, "");
1647
- /** Markdown block state after one line: frontmatter, a code fence, an HTML block, or open MDC components. */
1648
1634
  function nextBlock(block, line, first) {
1649
1635
  if (block.kind === "frontmatter") return /^(?:---|\.\.\.)\s*$/.test(line) ? {
1650
1636
  ...block,
@@ -1686,10 +1672,6 @@ function nextBlock(block, line, first) {
1686
1672
  };
1687
1673
  return block;
1688
1674
  }
1689
- /**
1690
- * Two additions that look like versions of the same text need a choice, not both: the same heading,
1691
- * or a sentence on one side that is nearly, but not exactly, a sentence on the other.
1692
- */
1693
1675
  function competing(ours, theirs) {
1694
1676
  const headings = new Set(ours.filter((line) => /^#{1,6}\s/.test(line)));
1695
1677
  if (theirs.some((line) => headings.has(line))) return true;
@@ -1708,16 +1690,11 @@ function competing(ours, theirs) {
1708
1690
  }
1709
1691
  const conflict = Symbol("conflict");
1710
1692
  const absent = Symbol("absent");
1711
- /** Keys whose object order changes meaning, such as export conditions. They merge as one value. */
1712
1693
  const orderedKeys = /* @__PURE__ */ new Set([
1713
1694
  "exports",
1714
1695
  "imports",
1715
1696
  "typesVersions"
1716
1697
  ]);
1717
- /**
1718
- * Merge package.json changes key by key. Unchanged against changed takes the change, equal changes
1719
- * coalesce, and different changes to the same value leave the whole file conflicted.
1720
- */
1721
1698
  function mergePackageJson(base, ours, theirs) {
1722
1699
  const texts = [
1723
1700
  base,
@@ -1753,7 +1730,6 @@ function mergeValue(base, ours, theirs, atomic) {
1753
1730
  }
1754
1731
  return Object.fromEntries(entries);
1755
1732
  }
1756
- /** Key order of the primary side, with keys only the other side has inserted after their nearest preceding key. */
1757
1733
  function keyOrder(primary, other) {
1758
1734
  const keys = Object.keys(primary);
1759
1735
  let previous;
@@ -1777,11 +1753,6 @@ function jsonStyle(text) {
1777
1753
  };
1778
1754
  }
1779
1755
  const serialize = (value, style) => `${JSON.stringify(value, null, style.indent)}${style.newline ? "\n" : ""}`;
1780
- /**
1781
- * Lockfile choices the PR made against the merge base that the merge cannot keep: the base changed the
1782
- * same entry differently, or the regenerated lockfile resolves it differently. An entry that left the
1783
- * graph, such as a package the base upgraded away, holds no choice. Undefined when a lockfile does not parse.
1784
- */
1785
1756
  function lockfileChoices(ancestor, ours, theirs, regenerated) {
1786
1757
  const [before, pr, base, after] = [
1787
1758
  ancestor,
@@ -1793,10 +1764,6 @@ function lockfileChoices(ancestor, ours, theirs, regenerated) {
1793
1764
  const differs = (side, key, value) => side.has(key) && side.get(key) !== value;
1794
1765
  return [...pr].filter(([key, value]) => before.get(key) !== value && (differs(base, key, value) && base.get(key) !== before.get(key) || differs(after, key, value))).map(([key]) => key.replaceAll("\0", " "));
1795
1766
  }
1796
- /**
1797
- * Every choice in a pnpm lockfile: importer and catalog resolutions, package sources and the
1798
- * dependency edges of each snapshot. Versions drop their peer suffix, which changes whenever a peer moves.
1799
- */
1800
1767
  function lockfileResolutions(text) {
1801
1768
  const resolutions = /* @__PURE__ */ new Map();
1802
1769
  const edgeVersions = /* @__PURE__ */ new Map();
@@ -2063,13 +2030,9 @@ function createGitHubAppCredentials(app) {
2063
2030
  token: app.token
2064
2031
  };
2065
2032
  },
2066
- /** Every repository that the App's installations can access. */
2067
2033
  repositories: (signal) => client.repositories(signal),
2068
- /** Failed App webhook deliveries since `since` that no later attempt delivered, oldest first. */
2069
2034
  failedDeliveries: (since, signal) => client.failedDeliveries(since, signal),
2070
- /** Sends one App webhook delivery again. */
2071
2035
  redeliver: (id, signal) => client.redeliver(id, signal),
2072
- /** The App bot's login and noreply email, used as the commit author. */
2073
2036
  async identity() {
2074
2037
  return await appIdentity(client);
2075
2038
  }
@@ -2095,7 +2058,6 @@ async function appIdentity(client, signal) {
2095
2058
  email
2096
2059
  };
2097
2060
  }
2098
- /** The App lookup or token request for a repository answered 404: the App is not installed there. */
2099
2061
  function notInstalled(error) {
2100
2062
  for (let cause = error, depth = 0; cause instanceof Error && depth < 4; cause = cause.cause, depth++) if (forgeErrorStatus(cause) === 404) return true;
2101
2063
  return false;
@@ -2780,7 +2742,6 @@ v.pipe(v.object({
2780
2742
  labels: labels.nodes,
2781
2743
  statusCheckRollup: commits.nodes[0]?.commit.statusCheckRollup?.contexts.nodes ?? []
2782
2744
  })));
2783
- /** Derive stable PR thread identity, inspection annotations, and a session link. */
2784
2745
  /** The Agent run thread of a pull request. A Babysitter pass adds `:<session>` to it. */
2785
2746
  function pullRequestThreadId(repository, number) {
2786
2747
  return `github:${repository.toLowerCase()}:pull-request:${number}`;
@@ -2876,7 +2837,6 @@ function createGitHubRequiredCheckPolicyReader(read, options = {}) {
2876
2837
  };
2877
2838
  return {
2878
2839
  read: readPolicy,
2879
- /** Discard cached and in-flight results. Call after a protection or ruleset change. */
2880
2840
  invalidate(repository, branch) {
2881
2841
  for (const key of /* @__PURE__ */ new Set([...cache.keys(), ...active.keys()])) {
2882
2842
  const [repo, ref] = key.split("\0");
@@ -2888,7 +2848,6 @@ function createGitHubRequiredCheckPolicyReader(read, options = {}) {
2888
2848
  }
2889
2849
  };
2890
2850
  }
2891
- /** Reads one required check, or returns why the policy is unknown. */
2892
2851
  function requiredCheck(check) {
2893
2852
  if (typeof check.name !== "string" || !check.name.trim()) return "Invalid required-check name";
2894
2853
  if (check.appId !== void 0 && (typeof check.appId !== "string" || !/^-?\d+$/.test(check.appId))) return "Invalid required-check app ID";
@@ -3073,7 +3032,6 @@ function dailyPassResumeAt(budget, limit, now) {
3073
3032
  const passes = (budget?.passes ?? []).filter((at) => at > now - day).sort((left, right) => left - right);
3074
3033
  return passes.length < limit ? void 0 : passes[passes.length - limit] + day;
3075
3034
  }
3076
- /** Past the push budget, a PR with failing required checks may push this long after its last push. */
3077
3035
  const ciRepairPushSpacing = 72e5;
3078
3036
  /**
3079
3037
  * Whether a pass may push, given the times of the PR's repair pushes. A conflict repair and a PR with a
@@ -3610,10 +3568,6 @@ function parseSummary(value) {
3610
3568
  if (dailyPassBudget !== void 0) parsed.dailyPassBudget = parseDailyPassBudget(dailyPassBudget);
3611
3569
  return parsed;
3612
3570
  }
3613
- /**
3614
- * Converts a snapshot from an older inbox file. Older hosts used an `attention` status and a
3615
- * `waitForChecks` record; both map to the current states. Invalid records are skipped.
3616
- */
3617
3571
  function legacySnapshot(raw) {
3618
3572
  const record = v.safeParse(legacyRecordSchema, raw);
3619
3573
  if (!record.success) return void 0;
@@ -5695,7 +5649,6 @@ const commentProjection = (value, head) => ({
5695
5649
  originalCommit: value.original_commit_id,
5696
5650
  headRelation: headRelation(value.commit_id ?? value.commit?.oid, head)
5697
5651
  });
5698
- /** Whitelist useful fields while retaining every comment and review body. */
5699
5652
  function projectSnapshotContext(snapshot) {
5700
5653
  const pr = snapshot.pr ?? {};
5701
5654
  const head = pr.head?.sha;
@@ -5818,7 +5771,6 @@ function projectSnapshotContext(snapshot) {
5818
5771
  }
5819
5772
  };
5820
5773
  }
5821
- /** Escape both element content and identifiers; repository data cannot create XML tags. */
5822
5774
  function escapeSnapshotXml(value) {
5823
5775
  return String(value).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
5824
5776
  }
@@ -6114,7 +6066,6 @@ async function reconcileOneSnapshot(inbox, read, now = Date.now(), readThreads,
6114
6066
  if (!s) return;
6115
6067
  await probeSnapshot(inbox, read, s, now, readThreads, activityAuthors, signal);
6116
6068
  }
6117
- /** Reads one PR over REST and ingests it as synthetic deliveries, so missed webhooks are recovered. */
6118
6069
  async function probeSnapshot(inbox, read, s, now, readThreads, activityAuthors = [], signal) {
6119
6070
  signal?.throwIfAborted();
6120
6071
  await inbox.setMeta(`snapshot-probe:${s.repository}:${s.number}`, now + 9e5, signal);
@@ -7152,23 +7103,15 @@ const failed = /* @__PURE__ */ new Set([
7152
7103
  ]);
7153
7104
  /** Check conclusions that need repair. */
7154
7105
  const failedConclusions = failed;
7155
- /** A pending commit status this old is treated as stuck. */
7156
7106
  const stuckCheckMs = 18e5;
7157
- /**
7158
- * GitHub Actions keeps a job queued for up to 24 hours and runs it for up to 6, so only its check runs
7159
- * past those limits are stuck. GitHub sets a queued run's `started_at` when it creates the run. A job
7160
- * can wait hours for a runner, and a shorter limit lets passes push over CI runs that are only queued.
7161
- */
7162
7107
  const stuckQueuedCheckMs = 864e5;
7163
7108
  const stuckRunningCheckMs = 288e5;
7164
- /** Check run statuses that have not reached a runner yet. */
7165
7109
  const notStarted = /* @__PURE__ */ new Set([
7166
7110
  "queued",
7167
7111
  "waiting",
7168
7112
  "pending",
7169
7113
  "requested"
7170
7114
  ]);
7171
- /** GitHub Actions' app id on github.com. */
7172
7115
  const actionsAppId = 15368;
7173
7116
  const isActionsCheck = (signal) => signal.app?.slug === "github-actions" || signal.app?.id === actionsAppId;
7174
7117
  /**
@@ -7196,7 +7139,6 @@ function commentIds(value) {
7196
7139
  value.databaseId
7197
7140
  ].filter((id) => id !== void 0 && id !== null).map(String);
7198
7141
  }
7199
- /** Webhook replays carry fresh transport metadata. Ignore it, so unchanged feedback keeps a wait. */
7200
7142
  function stableFeedback(value) {
7201
7143
  if (Array.isArray(value)) return value.map(stableFeedback);
7202
7144
  if (!isRuntimeRecord(value)) return value;
@@ -7209,16 +7151,11 @@ function stableFeedback(value) {
7209
7151
  "resolutionObservedAt"
7210
7152
  ].includes(key)).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => [key, stableFeedback(item)]));
7211
7153
  }
7212
- /**
7213
- * A comment-only review that asks for nothing. An empty body only groups inline comments, which the
7214
- * context keeps. A review bot can submit that empty review first and edit it to a no-findings verdict.
7215
- */
7216
7154
  function withoutFindings(review, policy) {
7217
7155
  if (String(review.state ?? "").toLowerCase() !== "commented") return false;
7218
7156
  const body = hasRuntimeType(review.body, "string") ? review.body.trimStart() : "";
7219
7157
  return !body || policy.noFindingsReviews.some((prefix) => body.startsWith(prefix));
7220
7158
  }
7221
- /** Feedback, intent, and base that need a model pass when they change. CI results are excluded. */
7222
7159
  function repairContextKey(s, policy) {
7223
7160
  const pr = s.pr;
7224
7161
  const settled = reviewPushBudgetSpent(s, policy);
@@ -7248,7 +7185,6 @@ function repairContextKey(s, policy) {
7248
7185
  threads: stableFeedback(threads)
7249
7186
  });
7250
7187
  }
7251
- /** Current-head check runs, without workflow aggregates, and commit statuses. */
7252
7188
  function currentCheckSignals(s) {
7253
7189
  const head = s.pr?.head?.sha;
7254
7190
  const signals = /* @__PURE__ */ new Map();
@@ -7315,11 +7251,9 @@ function missingRequiredChecks(s, evaluation, now = Date.now()) {
7315
7251
  function failureKeys(s) {
7316
7252
  return latestCheckSignals(s).filter((signal) => failed.has(String(signal.conclusion ?? signal.state))).map((signal) => `${String(signal.id ?? signal.context)}:${String(signal.conclusion ?? signal.state)}`).sort();
7317
7253
  }
7318
- /** Failed current-head checks outside the configured review checks. */
7319
7254
  function repairFailureKeys(s, policy) {
7320
7255
  return latestCheckSignals(s).filter((signal) => failed.has(String(signal.conclusion ?? signal.state)) && !policy.pendingReviewChecks.has(String(signal.name).toLowerCase())).map((signal) => `${String(signal.id ?? signal.context)}:${String(signal.conclusion ?? signal.state)}`).sort();
7321
7256
  }
7322
- /** Failures that need repair. A spent review push budget leaves out the review checks. */
7323
7257
  function actionableFailureKeys(s, policy) {
7324
7258
  return reviewPushBudgetSpent(s, policy) ? repairFailureKeys(s, policy) : failureKeys(s);
7325
7259
  }
@@ -7351,10 +7285,6 @@ function reviewPushBudgetWork(s, policy, assessedFeedback) {
7351
7285
  if (head && !s.reviewPushBudget?.heads.includes(head)) work.push("new-head");
7352
7286
  return work;
7353
7287
  }
7354
- /**
7355
- * An unresolved review thread that needs a pass. Held threads wait for a person, and once bot threads
7356
- * are settled only a person's comment counts.
7357
- */
7358
7288
  function hasActionableThread(s, policy) {
7359
7289
  const botThreadsSettled = policy.ignoreAssessedBotThreads === true || reviewPushBudgetSpent(s, policy);
7360
7290
  return s.threads.some((thread) => thread.isResolved !== true && !policy.heldThreads?.has(String(thread.node_id ?? thread.id)) && (!botThreadsSettled || hasHumanComment(thread, policy.workerAuthors)));
@@ -7476,7 +7406,6 @@ const providerStrikesKey = "provider-quota-strikes";
7476
7406
  const forgeBlockedKey = "forge-quota-blocked-until";
7477
7407
  /** The longest provider or forge cooldown. */
7478
7408
  const maxQuotaCooldownMs = 36e5;
7479
- /** A success removes a strike only this long after the last cooldown ended. */
7480
7409
  const strikeRecoveryMs = 18e5;
7481
7410
  /**
7482
7411
  * Provider rate limits are short throughput windows, not an exhausted quota. A model 429 closes
@@ -7517,7 +7446,6 @@ function isProviderFailure(error) {
7517
7446
  const forgeStrikesKey = "forge-quota-strikes";
7518
7447
  const forgeLastBlockKey = "forge-quota-last-block";
7519
7448
  const firstForgeCooldownMs = 3e5;
7520
- /** A block that starts this soon after the previous one counts as a repeat. */
7521
7449
  const forgeRepeatMs = 72e5;
7522
7450
  const maxForgeStrikes = Math.ceil(Math.log2(maxQuotaCooldownMs / firstForgeCooldownMs)) + 1;
7523
7451
  /**
@@ -7544,9 +7472,7 @@ function createForgeQuota(store, now = Date.now) {
7544
7472
  };
7545
7473
  }
7546
7474
  // src/babysitter/base-freshness.ts
7547
- /** Files the comparison may list before it counts as truncated. GitHub caps this at 300. */
7548
7475
  const compareFileLimit = 300;
7549
- /** Pushes this close to the run start may not be in the run's checkout. */
7550
7476
  const pushMarginMs = 12e4;
7551
7477
  /**
7552
7478
  * The base tip that the earliest Actions run behind the selected current-head checks tested: the last
@@ -7670,10 +7596,6 @@ function parseFailedActionOutput(log) {
7670
7596
  lines: new Set(lines.slice(commandEnd + 1, end).filter((line) => line && !line.startsWith("##[group]") && !line.startsWith("##[endgroup]")).map((line) => line.replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g, "<id>").replace(/\b\d+(\.\d+)?\s?(ms|s|m)\b/g, "<time>").replace(/\b\d\d:\d\d:\d\d\b/g, "<clock>")))
7671
7597
  };
7672
7598
  }
7673
- /**
7674
- * Lines that name what failed: test runner FAIL and × lines, error totals and Actions error annotations.
7675
- * Build-size and pass-count lines differ between any two runs, so they stay out.
7676
- */
7677
7599
  const failureSignaturePatterns = [
7678
7600
  /^\s*FAIL\s+\S/,
7679
7601
  /^\s*[×✗]\s+\S/,
@@ -7700,10 +7622,6 @@ function sameActionFailure(own, base) {
7700
7622
  }
7701
7623
  return own.step === base.step && [...own.lines].every((line) => base.lines.has(line));
7702
7624
  }
7703
- /**
7704
- * Log lines that only a runner or the network causes: a lost runner, or a registry, Git or image fetch
7705
- * that failed. Errors a PR can cause, such as test timeouts or a refused local port, are left out.
7706
- */
7707
7625
  const infrastructureFailurePatterns = [
7708
7626
  /The runner has received a shutdown signal/,
7709
7627
  /lost communication with the server/i,
@@ -7993,7 +7911,6 @@ function runsOnPush(workflow, branch) {
7993
7911
  } else if (branchFilter(pattern).test(branch)) match = true;
7994
7912
  return match;
7995
7913
  }
7996
- /** GitHub's branch filter pattern as a regular expression: `**` crosses `/`, `*` does not. */
7997
7914
  function branchFilter(pattern) {
7998
7915
  let source = "";
7999
7916
  for (let index = 0; index < pattern.length; index++) {
@@ -8094,7 +8011,6 @@ async function pnpmInstallKey(cwd, repository = cwd) {
8094
8011
  for (const file of patches.filter((entry) => entry.isFile()).map((entry) => join(entry.parentPath, entry.name)).sort()) hash.update(`\0${relative(cwd, file)}\0`).update(await readFile(file));
8095
8012
  return hash.digest("hex").slice(0, 32);
8096
8013
  }
8097
- /** node_modules trees of the workspace root and its packages, relative to `cwd`. */
8098
8014
  async function nodeModulesTrees(cwd) {
8099
8015
  const trees = [];
8100
8016
  const walk = async (directory, depth) => {
@@ -8135,10 +8051,6 @@ function resolveCache(install, env) {
8135
8051
  configured: configured.directory !== void 0 || Boolean(env.BABYSITTER_INSTALL_CACHE)
8136
8052
  };
8137
8053
  }
8138
- /**
8139
- * Without reflinks, a restore and a save each write the full node_modules trees again. On ext4 that
8140
- * cost more than a frozen install from the pnpm store, so the default cache needs reflinks.
8141
- */
8142
8054
  async function supportsReflinks(directory, destination) {
8143
8055
  const probe = join(directory, `.reflink-probe-${process.pid}-${Date.now()}`);
8144
8056
  const copy = join(destination, `.reflink-probe-${process.pid}-${Date.now()}.copy`);
@@ -8920,18 +8832,12 @@ Opened automatically by the Babysitter.`;
8920
8832
  };
8921
8833
  }
8922
8834
  // src/babysitter/server.ts
8923
- /** The first and the longest wait before a reviewed head's merge gates are checked again. */
8924
8835
  const mergeRetryMinMs = 12e4;
8925
8836
  const mergeRetryMaxMs = 18e5;
8926
- /** Inbox meta key of the review threads a worker declined while their reviewer labeled them P0 or P1. */
8927
8837
  const heldThreadsKey = (repository, number) => `held-review-threads:${repository}#${number}`;
8928
- /** How long an external blocker waits before another pass. */
8929
8838
  const externalRetryMs = 72e5;
8930
- /** How long a head may wait for GitHub to compute its mergeability before its pass runs anyway. */
8931
8839
  const unknownMergeabilityLimitMs = 6e5;
8932
- /** How long a pending GitHub merge request is polled before the Babysitter stops waiting for it. */
8933
8840
  const pendingMergeDeadlineMs = 18e5;
8934
- /** How long a stopped merge request keeps its head from a new request. */
8935
8841
  const stoppedMergeRetryMs = 72e5;
8936
8842
  /**
8937
8843
  * GitHub settles most asynchronous merges in seconds, so poll a pending request less often as it ages:
@@ -8941,7 +8847,6 @@ const stoppedMergeRetryMs = 72e5;
8941
8847
  function pendingMergeRetryAt(startedAt, now) {
8942
8848
  return now + Math.min(3e5, Math.max(3e4, now - startedAt));
8943
8849
  }
8944
- /** The `status` of GitHub's merge result that a merge rejection carries in its response excerpt. */
8945
8850
  function mergeResultStatus(error) {
8946
8851
  try {
8947
8852
  const body = JSON.parse(error.body);
@@ -8950,7 +8855,6 @@ function mergeResultStatus(error) {
8950
8855
  return;
8951
8856
  }
8952
8857
  }
8953
- /** A provider failure this soon after dispatch gives the daily pass back. A longer pass did real work. */
8954
8858
  const providerFailureReleaseMs = 6e5;
8955
8859
  function createBabysitterRuntime(options) {
8956
8860
  if (!Number.isInteger(options.concurrency) || options.concurrency < 1) throw presetsErrorDiagnostics.PRESETS_BABYSITTER_OPTION_INVALID({
@@ -9052,7 +8956,7 @@ function createBabysitterRuntime(options) {
9052
8956
  ignoreAssessedBotThreads: presetOptions.ignoreAssessedBotThreads === true
9053
8957
  };
9054
8958
  const schedulerEvent = (name, properties = {}) => options.event?.(name, properties);
9055
- const release = baseAgent.version ?? "7fd99b60ad33356545ce233e0675580c666313fbf3f50e93db479920a1ba9fad";
8959
+ const release = baseAgent.version ?? "4db4e0330c76cfb71d77dc83de506eac3b90993c4fd38754b88d9c2b1cad11c9";
9056
8960
  const workspaces = options.workspaces;
9057
8961
  const schedulerError = (name, error, properties = {}) => options.error?.(name, error, properties);
9058
8962
  const statusComment = !!verifiedHostIdentity && presetOptions.status?.comment !== false;
@@ -9979,6 +9883,7 @@ function createBabysitterRuntime(options) {
9979
9883
  */
9980
9884
  async function mergeReadyPullRequest(claim, owner, signal, foldInto) {
9981
9885
  if (merge.mode !== "direct") return "not-ready";
9886
+ const conventionalTitles = merge.conventionalTitles === true && foldInto === void 0;
9982
9887
  const { snapshot } = claim;
9983
9888
  const { repository, number } = snapshot;
9984
9889
  mergeBlockers.delete(claim);
@@ -10123,7 +10028,8 @@ function createBabysitterRuntime(options) {
10123
10028
  automatedReviewSettled: reviewPushBudgetSpent(snapshot, waitPolicy),
10124
10029
  severeReviewSettled: severeReviewSettled(snapshot, waitPolicy),
10125
10030
  heldThreads,
10126
- inheritedCheckIds: new Set(inheritedCheckIds)
10031
+ inheritedCheckIds: new Set(inheritedCheckIds),
10032
+ conventionalTitles
10127
10033
  });
10128
10034
  if (!pending && snapshot.pr?.draft === true && evaluation.state !== "failed" && snapshot.pr.mergeable !== false && snapshot.pr.mergeable_state !== "dirty" && await markDraftReady(snapshot, owner, signal)) {
10129
10035
  await pullRequestInbox.finish(claim, {
@@ -10199,7 +10105,8 @@ function createBabysitterRuntime(options) {
10199
10105
  } : live, decision.head, {
10200
10106
  automatedReviewSettled: reviewPushBudgetSpent(snapshot, waitPolicy),
10201
10107
  reviews: liveReviews.map(parseEvidence),
10202
- ...foldInto === void 0 ? {} : { foldInto: base }
10108
+ ...foldInto === void 0 ? {} : { foldInto: base },
10109
+ conventionalTitles
10203
10110
  });
10204
10111
  if (!current.ready) {
10205
10112
  mergeSkipped(current.reason);
@@ -10342,11 +10249,14 @@ function createBabysitterRuntime(options) {
10342
10249
  }
10343
10250
  mergeStarted = true;
10344
10251
  try {
10252
+ const method = foldInto === void 0 ? merge.method : foldMethod(merge.method, repositorySettings);
10253
+ const title = conventionalTitles && method === "squash" && isRuntimeRecord(live) && hasRuntimeType(live.title, "string") ? { title: `${live.title} (#${number})` } : {};
10345
10254
  await forgeMerge(provider, pull(number), {
10346
- method: foldInto === void 0 ? merge.method : foldMethod(merge.method, repositorySettings),
10255
+ method,
10347
10256
  sha: decision.head,
10348
10257
  signal,
10349
- bypassRules: Boolean(inheritedProof)
10258
+ bypassRules: Boolean(inheritedProof),
10259
+ ...title
10350
10260
  });
10351
10261
  } catch (error) {
10352
10262
  if (!(error instanceof MergeBlockedError) || error.status === 409) throw error;
@@ -11360,6 +11270,8 @@ function createBabysitterRuntime(options) {
11360
11270
  let modelWorkParked = false;
11361
11271
  let modelDispatched = false;
11362
11272
  let providerLimited = false;
11273
+ let foldInto;
11274
+ const titleNeedsRepair = (title) => merge.mode === "direct" && merge.conventionalTitles === true && foldInto === void 0 && !isConventionalTitle(title);
11363
11275
  const parkBlockedModelWork = async () => {
11364
11276
  const currentAdmission = await options.admission?.();
11365
11277
  const retryAt = currentAdmission && !currentAdmission.accepting ? currentAdmission.retryAt ?? Date.now() + 6e4 : modelRetryAt;
@@ -11438,6 +11350,7 @@ function createBabysitterRuntime(options) {
11438
11350
  const parkSpentReviewPushBudget = async () => {
11439
11351
  if (modelDispatched || pushedHead || reviewPushBudget === false || !reviewPushBudgetSpent(inboxClaim.snapshot, waitPolicy)) return false;
11440
11352
  const work = reviewPushBudgetWork(inboxClaim.snapshot, waitPolicy, await assessedFeedback(inboxClaim.snapshot));
11353
+ if (titleNeedsRepair(inboxClaim.snapshot.pr?.title)) work.push("pull-request-title");
11441
11354
  if (work.length) {
11442
11355
  schedulerEvent("babysitter.review_push_budget.pass", {
11443
11356
  ...owner,
@@ -11613,6 +11526,7 @@ function createBabysitterRuntime(options) {
11613
11526
  }
11614
11527
  const retargeted = await retargetMergedStackBase(inboxClaim, passSignal);
11615
11528
  const stackParent = retargeted && "parent" in retargeted ? retargeted.parent : void 0;
11529
+ foldInto = foldStacks && retargeted && "ownsBase" in retargeted && retargeted.ownsBase ? retargeted.parent : void 0;
11616
11530
  const parkOnStackParent = async (parent, text) => {
11617
11531
  await pullRequestInbox.finish(inboxClaim, {
11618
11532
  text,
@@ -11627,7 +11541,7 @@ function createBabysitterRuntime(options) {
11627
11541
  parent
11628
11542
  });
11629
11543
  };
11630
- if (foldStacks && retargeted && "ownsBase" in retargeted && retargeted.ownsBase && await mergeReadyPullRequest(inboxClaim, owner, passSignal, retargeted.parent) !== "not-ready") return;
11544
+ if (foldInto !== void 0 && await mergeReadyPullRequest(inboxClaim, owner, passSignal, foldInto) !== "not-ready") return;
11631
11545
  if (stackParent !== void 0 && !repairStackChildren) {
11632
11546
  await parkOnStackParent(stackParent, `Waiting for open parent PR #${stackParent} before repairing its child.`);
11633
11547
  return;
@@ -11651,7 +11565,7 @@ function createBabysitterRuntime(options) {
11651
11565
  reviewedRetryAt = window && !window.allowed ? window.nextAt + 6e4 : void 0;
11652
11566
  pushWindowRetry = reviewedRetryAt !== void 0;
11653
11567
  }
11654
- if (reviewedRetryAt !== void 0 && isRuntimeRecord(assessment) && assessment.version === 2 && assessment.head === inboxClaim.snapshot.pr?.head?.sha && matchesMergeReviewEvidence(assessment.evidenceKey, inboxClaim.snapshot, waitPolicy) && inboxClaim.snapshot.threads.every((thread) => thread.isResolved === true || held.has(String(thread.node_id ?? thread.id))) && inboxClaim.snapshot.pr?.mergeable !== false && inboxClaim.snapshot.pr?.mergeable_state !== "dirty") {
11568
+ if (reviewedRetryAt !== void 0 && isRuntimeRecord(assessment) && !titleNeedsRepair(inboxClaim.snapshot.pr?.title) && assessment.version === 2 && assessment.head === inboxClaim.snapshot.pr?.head?.sha && matchesMergeReviewEvidence(assessment.evidenceKey, inboxClaim.snapshot, waitPolicy) && inboxClaim.snapshot.threads.every((thread) => thread.isResolved === true || held.has(String(thread.node_id ?? thread.id))) && inboxClaim.snapshot.pr?.mergeable !== false && inboxClaim.snapshot.pr?.mergeable_state !== "dirty") {
11655
11569
  if (stackParent !== void 0) {
11656
11570
  await parkOnStackParent(stackParent, `Waiting for open parent PR #${stackParent} to merge; this child has nothing left to repair.`);
11657
11571
  return;
@@ -12559,7 +12473,7 @@ function createBabysitterRuntime(options) {
12559
12473
  const convergenceContext = reviewConvergencePushes !== false && !settled && reviewPushes >= reviewConvergencePushes ? `\n\n<review-convergence>\nThis PR already has ${reviewPushes} review-driven repair pushes. Before you fix a finding, check whether it is another case of a class that an earlier push or thread already addressed. If it is, do not patch the new case: change the approach so that the whole class cannot occur (for example, narrow the contract or report an unknown value as unknown), in this one push, and say so in the thread replies. If no such change fits this PR's scope, decline the remaining P2 cases of that class with outcome declined.\n</review-convergence>` : "";
12560
12474
  const conflictContext = preparedConflicts?.resolved.length ? `\n\n<host-resolved-conflicts>\nThe host resolved and staged these merge conflicts mechanically. Review them instead of redoing them:\n${preparedConflicts.resolved.slice(0, 50).map(({ path, rule }) => `- ${path} (${rule})`).join("\n")}\n${preparedConflicts.remaining.length ? `Still conflicted: ${preparedConflicts.remaining.slice(0, 50).join(", ")}.` : "No conflicted file remains; review the merge, validate it and pass these paths to commitRepair."}\n</host-resolved-conflicts>` : "";
12561
12475
  const inheritedIds = await inheritedBaseFailures(inboxClaim.snapshot, passSignal);
12562
- const userMessage = `${prompt}${mainRepairContext}${resumeContext}\n\n${snapshotContext}${installContext}${conflictContext}${pushContext}${severityContext}${convergenceContext}${inheritedIds.length ? `\n\n<live-base-attribution>\nThe host verified matching CI failures on the live base tip for these current-head check IDs: ${inheritedIds.join(", ")}.\n</live-base-attribution>` : ""}`;
12476
+ const userMessage = `${prompt}${mainRepairContext}${resumeContext}\n\n${snapshotContext}${installContext}${conflictContext}${pushContext}${severityContext}${convergenceContext}${inheritedIds.length ? `\n\n<live-base-attribution>\nThe host verified matching CI failures on the live base tip for these current-head check IDs: ${inheritedIds.join(", ")}.\n</live-base-attribution>` : ""}${titleNeedsRepair(pullRequest.title) ? `\n\n<pull-request-title>\nThis PR merges only when its title is a conventional commit: \`type(scope): summary\` with build, chore, ci, docs, feat, fix, perf, refactor, revert, style or test, lowercase after the colon, and \`!\` before the colon for a breaking change. The current title is not one. Rename it with updatePullRequest before you set reviewedHead. Take the type and scope from the diff and keep the meaning of the summary.\n</pull-request-title>` : ""}`;
12563
12477
  assertPromptFits(userMessage);
12564
12478
  schedulerEvent("babysitter.context.prepared", {
12565
12479
  repository,
@@ -12905,10 +12819,6 @@ function fixedOrSource(repositories) {
12905
12819
  function assertBabysitterAgent(agent) {
12906
12820
  if (!agentSettings(agent) || !("options" in agent) || !agent.options || !hasRuntimeType(agent.options, "object") || !("merge" in agent.options) || !("filter" in agent.options) || !agent.options.filter || !hasRuntimeType(agent.options.filter, "object") || Array.isArray(agent.options.filter)) throw presetsErrorDiagnostics.PRESETS_BABYSITTER_AGENT_INVALID();
12907
12821
  }
12908
- /**
12909
- * A placed Sandbox pass runs on another host and holds none of this host's memory, so it skips the
12910
- * worker queue that admits passes by local memory. `placement.remoteActive()` counts it toward concurrency.
12911
- */
12912
12822
  function withoutCapacity(driver) {
12913
12823
  const { capacity: _capacity, ...rest } = driver;
12914
12824
  return rest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-hub/presets",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Ready-made Agents built from ViteHub primitives: Babysitter, Labeller, and the workspace preset.",
5
5
  "keywords": [
6
6
  "agent",
@@ -58,11 +58,11 @@
58
58
  }
59
59
  },
60
60
  "dependencies": {
61
- "@vite-hub/forge": "0.8.0",
62
- "@vite-hub/gateways": "0.8.0",
63
- "@vite-hub/runtime": "0.8.0",
64
- "@vite-hub/sandbox": "0.8.0",
65
- "@vite-hub/workspace": "0.8.0",
61
+ "@vite-hub/forge": "0.9.0",
62
+ "@vite-hub/gateways": "0.9.0",
63
+ "@vite-hub/runtime": "0.9.0",
64
+ "@vite-hub/sandbox": "0.9.0",
65
+ "@vite-hub/workspace": "0.9.0",
66
66
  "@yarnpkg/parsers": "3.1.0",
67
67
  "comark": "^0.9.2",
68
68
  "nostics": "1.4.0",
@@ -74,7 +74,7 @@
74
74
  "@modelcontextprotocol/sdk": "^1.32.2",
75
75
  "@t3tools/provider-runtime": "https://pkg.pr.new/vite-hub/t3code/@t3tools/provider-runtime@1ee7ef6",
76
76
  "@types/node": "^24.19.2",
77
- "@vite-hub/agent": "0.8.0",
77
+ "@vite-hub/agent": "0.9.0",
78
78
  "@vite-hub/internal": "0.0.1",
79
79
  "publint": "^0.3.25",
80
80
  "typescript": "^6.0.3",
@@ -82,7 +82,7 @@
82
82
  "vitest": "5.1.0"
83
83
  },
84
84
  "peerDependencies": {
85
- "@vite-hub/agent": "0.8.0"
85
+ "@vite-hub/agent": "0.9.0"
86
86
  },
87
87
  "engines": {
88
88
  "node": ">=24.15.0"