@sentry/junior-github 0.274.0 → 0.276.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/index.js CHANGED
@@ -59,7 +59,7 @@ import {
59
59
  readGrantPermissions,
60
60
  requireEnv,
61
61
  resolveUserAccount
62
- } from "./chunk-EALXNZGU.js";
62
+ } from "./chunk-PCWKGWHE.js";
63
63
 
64
64
  // src/tool-support/attribution.ts
65
65
  var GITHUB_REQUEST_ATTRIBUTION_START = "<!-- junior-request-attribution:start -->";
@@ -202,7 +202,7 @@ var inputSchema = z.object({
202
202
  ).describe(
203
203
  "Optional destination directory under the sandbox root. Defaults to repos/{name}."
204
204
  ).optional(),
205
- allowAdHoc: z.boolean().optional().describe(
205
+ allow_ad_hoc: z.boolean().optional().describe(
206
206
  "Set true in the default Sandbox to keep an intentional ad-hoc checkout when matching Workspaces exist. Prefer switchWorkspace; the checkout is already present after a successful switch."
207
207
  )
208
208
  }).strict();
@@ -230,11 +230,11 @@ function workspaceRequiredError(repoId, workspaces) {
230
230
  const names = quotedNames(workspaces);
231
231
  if (workspaces.length === 1) {
232
232
  return new PluginToolInputError(
233
- `Repository ${repoId} is part of Workspace ${names}. Call switchWorkspace with that name; the checkout is already present after the switch. Pass allowAdHoc=true only for an intentional ad-hoc checkout.`
233
+ `Repository ${repoId} is part of Workspace ${names}. Call switchWorkspace with that name; the checkout is already present after the switch. Pass allow_ad_hoc=true only for an intentional ad-hoc checkout.`
234
234
  );
235
235
  }
236
236
  return new PluginToolInputError(
237
- `Repository ${repoId} is part of Workspaces ${names}. Call switchWorkspace with one of those names; the checkout is already present after the switch. Pass allowAdHoc=true only for an intentional ad-hoc checkout.`
237
+ `Repository ${repoId} is part of Workspaces ${names}. Call switchWorkspace with one of those names; the checkout is already present after the switch. Pass allow_ad_hoc=true only for an intentional ad-hoc checkout.`
238
238
  );
239
239
  }
240
240
  function workspaceAvailableNote(repoId, active, workspaces) {
@@ -281,10 +281,10 @@ function createGitHubCloneRepositoryTool(ctx) {
281
281
  openWorldHint: true,
282
282
  readOnlyHint: true
283
283
  },
284
- description: "Clone a GitHub repository into the sandbox as an ad-hoc checkout. The destination must not already exist. In the default Sandbox, a matching Workspace is a tool input error: call switchWorkspace instead, or pass allowAdHoc=true for an intentional ad-hoc checkout. Inside a Workspace, the clone proceeds and the result notes matching Workspaces.",
284
+ description: "Clone a GitHub repository into the sandbox as an ad-hoc checkout. The destination must not already exist. In the default Sandbox, a matching Workspace is a tool input error: call switchWorkspace instead, or pass allow_ad_hoc=true for an intentional ad-hoc checkout. Inside a Workspace, the clone proceeds and the result notes matching Workspaces.",
285
285
  describeProposal(input) {
286
286
  const directory = typeof input.directory === "string" && input.directory.length > 0 ? input.directory : void 0;
287
- const adHoc = input.allowAdHoc === true ? " as an intentional ad-hoc checkout" : "";
287
+ const adHoc = input.allow_ad_hoc === true ? " as an intentional ad-hoc checkout" : "";
288
288
  return directory ? `Shallow-clone ${input.repo} into the local sandbox at ${directory}${adHoc} for inspection (no GitHub mutation).` : `Shallow-clone ${input.repo} into the local sandbox${adHoc} for inspection (no GitHub mutation).`;
289
289
  },
290
290
  executionMode: "sequential",
@@ -309,7 +309,7 @@ function createGitHubCloneRepositoryTool(ctx) {
309
309
  error: error instanceof Error ? error.message : String(error)
310
310
  });
311
311
  }
312
- if (workspaces.length > 0 && !active && input.allowAdHoc !== true) {
312
+ if (workspaces.length > 0 && !active && input.allow_ad_hoc !== true) {
313
313
  throw workspaceRequiredError(repoId, workspaces);
314
314
  }
315
315
  const otherWorkspaces = workspaces.filter(
@@ -984,7 +984,7 @@ import { z as z4 } from "zod";
984
984
  var commitShaSchema = z4.string().regex(/^[0-9a-f]{40}$/i);
985
985
  var inputSchema2 = z4.object({
986
986
  repo: z4.string().describe('Repository in "owner/name" format.'),
987
- commitSha: commitShaSchema.describe(
987
+ commit_sha: commitShaSchema.describe(
988
988
  "Full 40-character Git commit SHA recorded by the deployment."
989
989
  ),
990
990
  environment: z4.string().trim().min(1).describe(
@@ -992,28 +992,28 @@ var inputSchema2 = z4.object({
992
992
  ).optional()
993
993
  }).strict();
994
994
  var statusSchema = z4.object({
995
- createdAt: z4.string(),
995
+ created_at: z4.string(),
996
996
  creator: z4.string().nullable(),
997
997
  description: z4.string().nullable(),
998
- environmentUrl: z4.string().nullable(),
998
+ environment_url: z4.string().nullable(),
999
999
  id: z4.number(),
1000
- logUrl: z4.string().nullable(),
1000
+ log_url: z4.string().nullable(),
1001
1001
  state: z4.string()
1002
1002
  }).strict();
1003
1003
  var deploymentSchema = z4.object({
1004
- createdAt: z4.string(),
1004
+ created_at: z4.string(),
1005
1005
  creator: z4.string().nullable(),
1006
1006
  description: z4.string().nullable(),
1007
1007
  environment: z4.string(),
1008
1008
  id: z4.number(),
1009
- latestStatus: statusSchema.nullable(),
1009
+ latest_status: statusSchema.nullable(),
1010
1010
  ref: z4.string(),
1011
1011
  sha: commitShaSchema,
1012
- updatedAt: z4.string(),
1012
+ updated_at: z4.string(),
1013
1013
  url: z4.string()
1014
1014
  }).strict();
1015
1015
  var deploymentSourceSchema = z4.object({
1016
- commitSha: commitShaSchema,
1016
+ commit_sha: commitShaSchema,
1017
1017
  deployment: deploymentSchema.nullable(),
1018
1018
  environment: z4.string().nullable(),
1019
1019
  repo: z4.string(),
@@ -1084,7 +1084,7 @@ function createGitHubGetDeploymentTool(ctx) {
1084
1084
  outputSchema: outputSchema2,
1085
1085
  async execute(input) {
1086
1086
  const repo = parseRepo3(input.repo);
1087
- const commitSha = input.commitSha.toLowerCase();
1087
+ const commitSha = input.commit_sha.toLowerCase();
1088
1088
  const deploymentsUrl = new URL(repositoryUrl(repo, "deployments"));
1089
1089
  deploymentsUrl.searchParams.set("sha", commitSha);
1090
1090
  if (input.environment) {
@@ -1135,23 +1135,23 @@ function createGitHubGetDeploymentTool(ctx) {
1135
1135
  }
1136
1136
  const providerStatus = z4.array(providerStatusSchema).parse(statusesBody)[0];
1137
1137
  deployment = {
1138
- createdAt: providerDeployment.created_at,
1138
+ created_at: providerDeployment.created_at,
1139
1139
  creator: providerDeployment.creator?.login ?? null,
1140
1140
  description: providerDeployment.description,
1141
1141
  environment: providerDeployment.environment,
1142
1142
  id: providerDeployment.id,
1143
- latestStatus: providerStatus ? {
1144
- createdAt: providerStatus.created_at,
1143
+ latest_status: providerStatus ? {
1144
+ created_at: providerStatus.created_at,
1145
1145
  creator: providerStatus.creator?.login ?? null,
1146
1146
  description: providerStatus.description ?? null,
1147
- environmentUrl: providerStatus.environment_url ?? null,
1147
+ environment_url: providerStatus.environment_url ?? null,
1148
1148
  id: providerStatus.id,
1149
- logUrl: providerStatus.log_url ?? null,
1149
+ log_url: providerStatus.log_url ?? null,
1150
1150
  state: providerStatus.state
1151
1151
  } : null,
1152
1152
  ref: providerDeployment.ref,
1153
1153
  sha: providerDeployment.sha.toLowerCase(),
1154
- updatedAt: providerDeployment.updated_at,
1154
+ updated_at: providerDeployment.updated_at,
1155
1155
  url: `https://github.com/${repo.ref}/deployments`
1156
1156
  };
1157
1157
  }
@@ -1162,7 +1162,7 @@ function createGitHubGetDeploymentTool(ctx) {
1162
1162
  repo: repo.ref
1163
1163
  });
1164
1164
  const data = {
1165
- commitSha,
1165
+ commit_sha: commitSha,
1166
1166
  deployment,
1167
1167
  environment: input.environment ?? null,
1168
1168
  repo: repo.ref,
@@ -1188,7 +1188,7 @@ import {
1188
1188
  } from "@sentry/junior-plugin-api";
1189
1189
  import { Type as Type2 } from "@sinclair/typebox";
1190
1190
  import { Value as Value2 } from "@sinclair/typebox/value";
1191
- import { z as z6 } from "zod";
1191
+ import { z as z7 } from "zod";
1192
1192
 
1193
1193
  // src/pull-request-requesters/store.ts
1194
1194
  import { and, asc, eq, inArray, lt } from "drizzle-orm";
@@ -1374,6 +1374,120 @@ async function listGitHubPullRequestOpeners(db, input) {
1374
1374
  return openers;
1375
1375
  }
1376
1376
 
1377
+ // src/tools/stack-pull-request.ts
1378
+ import { z as z6 } from "zod";
1379
+ var MAX_STACK_DEPTH = 10;
1380
+ var GITHUB_HEADERS = {
1381
+ Accept: "application/vnd.github+json",
1382
+ "X-GitHub-Api-Version": "2026-03-10"
1383
+ };
1384
+ var stackTargetSchema = z6.object({
1385
+ number: z6.number().int().positive(),
1386
+ head: z6.object({
1387
+ repo: z6.object({ full_name: z6.string().min(1) }).nullable()
1388
+ }),
1389
+ base: z6.object({
1390
+ ref: z6.string().min(1),
1391
+ repo: z6.object({
1392
+ default_branch: z6.string().min(1),
1393
+ full_name: z6.string().min(1)
1394
+ })
1395
+ })
1396
+ });
1397
+ var openPullRequestsSchema = z6.array(
1398
+ z6.object({
1399
+ number: z6.number().int().positive(),
1400
+ base: z6.object({ ref: z6.string().min(1) })
1401
+ })
1402
+ );
1403
+ var stackSchema = z6.object({
1404
+ number: z6.number().int().positive(),
1405
+ pull_requests: z6.array(z6.object({ number: z6.number().int().positive() }))
1406
+ });
1407
+ async function stackGitHubPullRequest(ctx, target) {
1408
+ const repo = target.base.repo.full_name;
1409
+ if (target.base.ref === target.base.repo.default_branch || target.head.repo?.full_name !== repo) {
1410
+ return void 0;
1411
+ }
1412
+ const [owner, name] = repo.split("/");
1413
+ const api = `https://api.github.com/repos/${encodeURIComponent(owner)}/${encodeURIComponent(name)}`;
1414
+ const github = async (operation, url, schema, body) => {
1415
+ const response = await ctx.egress.fetch({
1416
+ provider: "github",
1417
+ operation,
1418
+ request: new Request(url, {
1419
+ method: body === void 0 ? "GET" : "POST",
1420
+ headers: body === void 0 ? GITHUB_HEADERS : { ...GITHUB_HEADERS, "Content-Type": "application/json" },
1421
+ ...body === void 0 ? void 0 : { body: JSON.stringify(body) }
1422
+ })
1423
+ });
1424
+ if (!response.ok) {
1425
+ ctx.log.warn("github.pull_request.stack_after_create.rejected", {
1426
+ number: target.number,
1427
+ operation,
1428
+ repo,
1429
+ status: response.status
1430
+ });
1431
+ return void 0;
1432
+ }
1433
+ return schema.parse(await response.json());
1434
+ };
1435
+ const result = (stack) => ({
1436
+ number: stack.number,
1437
+ pull_requests: stack.pull_requests.map((pullRequest) => pullRequest.number)
1438
+ });
1439
+ try {
1440
+ const chain = [target.number];
1441
+ let branch = target.base.ref;
1442
+ for (let depth = 0; depth < MAX_STACK_DEPTH; depth += 1) {
1443
+ const parents = await github(
1444
+ "github.pull.list",
1445
+ `${api}/pulls?state=open&per_page=2&head=${encodeURIComponent(`${owner}:${branch}`)}`,
1446
+ openPullRequestsSchema
1447
+ );
1448
+ if (!parents) return void 0;
1449
+ if (parents.length !== 1) break;
1450
+ const parent = parents[0];
1451
+ const stacks = await github(
1452
+ "github.stack.read",
1453
+ `${api}/stacks?pull_request=${parent.number}`,
1454
+ z6.array(stackSchema)
1455
+ );
1456
+ if (!stacks) return void 0;
1457
+ const stack = stacks[0];
1458
+ if (stack) {
1459
+ if (stack.pull_requests.at(-1)?.number !== parent.number) {
1460
+ return void 0;
1461
+ }
1462
+ const added = await github(
1463
+ "github.stack.add",
1464
+ `${api}/stacks/${stack.number}/add`,
1465
+ stackSchema,
1466
+ { pull_requests: chain }
1467
+ );
1468
+ return added && result(added);
1469
+ }
1470
+ chain.unshift(parent.number);
1471
+ branch = parent.base.ref;
1472
+ }
1473
+ if (chain.length < 2) return void 0;
1474
+ const created = await github(
1475
+ "github.stack.create",
1476
+ `${api}/stacks`,
1477
+ stackSchema,
1478
+ { pull_requests: chain }
1479
+ );
1480
+ return created && result(created);
1481
+ } catch (error) {
1482
+ ctx.log.warn("github.pull_request.stack_after_create.failed", {
1483
+ error: error instanceof Error ? error.message : String(error),
1484
+ number: target.number,
1485
+ repo
1486
+ });
1487
+ return void 0;
1488
+ }
1489
+ }
1490
+
1377
1491
  // src/tools/create-pull-request.ts
1378
1492
  var GITHUB_PULL_REQUEST_CREATE_IDEMPOTENCY_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
1379
1493
  var GITHUB_PULL_REQUEST_CREATE_LOCK_TTL_MS = 6e4;
@@ -1412,15 +1526,15 @@ var createPullRequestInputSchema = Type2.Object(
1412
1526
  },
1413
1527
  { additionalProperties: false }
1414
1528
  );
1415
- var createPullRequestToolInputSchema = z6.object({
1416
- repo: z6.string().describe('Repository in "owner/name" format.'),
1417
- title: z6.string().describe("Pull request title."),
1418
- head: z6.string().describe("Head branch or owner:branch ref."),
1419
- base: z6.string().describe("Base branch."),
1420
- body: z6.string().describe(
1529
+ var createPullRequestToolInputSchema = z7.object({
1530
+ repo: z7.string().describe('Repository in "owner/name" format.'),
1531
+ title: z7.string().describe("Pull request title."),
1532
+ head: z7.string().describe("Head branch or owner:branch ref."),
1533
+ base: z7.string().describe("Base branch."),
1534
+ body: z7.string().describe(
1421
1535
  "Pull request body. The runtime appends the conversation footer."
1422
1536
  ).optional(),
1423
- draft: z6.boolean().describe("Whether to open the pull request as a draft.").optional()
1537
+ draft: z7.boolean().describe("Whether to open the pull request as a draft.").optional()
1424
1538
  }).strict();
1425
1539
  var createPullRequestStateSchema = Type2.Union([
1426
1540
  Type2.Object(
@@ -1445,15 +1559,16 @@ var createPullRequestStateSchema = Type2.Union([
1445
1559
  { additionalProperties: false }
1446
1560
  )
1447
1561
  ]);
1448
- var gitHubPullRequestDataSchema = z6.object({
1449
- number: z6.number(),
1450
- url: z6.string(),
1562
+ var gitHubPullRequestDataSchema = z7.object({
1563
+ number: z7.number(),
1564
+ url: z7.string(),
1565
+ stack: z7.object({ number: z7.number(), pull_requests: z7.array(z7.number()) }).optional(),
1451
1566
  subscribable: subscribableResourceSchema3.optional(),
1452
1567
  subscription: watchResultSchema.optional()
1453
1568
  });
1454
1569
  var gitHubPullRequestOutputSchema = pluginToolOutputSchema4.merge(
1455
1570
  gitHubPullRequestDataSchema.extend({
1456
- target: z6.literal("createPullRequest")
1571
+ target: z7.literal("createPullRequest")
1457
1572
  })
1458
1573
  );
1459
1574
  function parseCreatePullRequestInput(input) {
@@ -1599,10 +1714,14 @@ async function createGitHubPullRequest(ctx, request) {
1599
1714
  "GitHub pull request creation returned an invalid response."
1600
1715
  );
1601
1716
  }
1717
+ const stackTarget = stackTargetSchema.safeParse(parsed);
1602
1718
  return {
1603
- ...githubObjectFacts("code_change", parsed),
1604
- number: pullRequest.number,
1605
- url: pullRequest.html_url
1719
+ result: {
1720
+ ...githubObjectFacts("code_change", parsed),
1721
+ number: pullRequest.number,
1722
+ url: pullRequest.html_url
1723
+ },
1724
+ ...stackTarget.success ? { stackTarget: stackTarget.data } : void 0
1606
1725
  };
1607
1726
  }
1608
1727
  async function recordOpener(ctx, input, state, requester) {
@@ -1667,7 +1786,7 @@ function gitHubPullRequestToolResult(input, result, canSubscribe, omitSuggestedE
1667
1786
  ...subscribable ? { subscribable } : void 0
1668
1787
  };
1669
1788
  }
1670
- async function gitHubPullRequestStructuredResult(ctx, input, result, subscriptionConfig) {
1789
+ async function gitHubPullRequestStructuredResult(ctx, input, result, subscriptionConfig, stack) {
1671
1790
  const base = gitHubPullRequestToolResult(
1672
1791
  input,
1673
1792
  result,
@@ -1690,7 +1809,8 @@ async function gitHubPullRequestStructuredResult(ctx, input, result, subscriptio
1690
1809
  return {
1691
1810
  objectAnnotations,
1692
1811
  target: "createPullRequest",
1693
- ...base
1812
+ ...base,
1813
+ ...stack ? { stack } : void 0
1694
1814
  };
1695
1815
  }
1696
1816
  const watch = gitHubPullRequestCreateWatch(subscriptionConfig);
@@ -1709,6 +1829,7 @@ async function gitHubPullRequestStructuredResult(ctx, input, result, subscriptio
1709
1829
  objectAnnotations,
1710
1830
  target: "createPullRequest",
1711
1831
  ...data,
1832
+ ...stack ? { stack } : void 0,
1712
1833
  subscription
1713
1834
  };
1714
1835
  } catch (error) {
@@ -1720,7 +1841,8 @@ async function gitHubPullRequestStructuredResult(ctx, input, result, subscriptio
1720
1841
  return {
1721
1842
  objectAnnotations,
1722
1843
  target: "createPullRequest",
1723
- ...base
1844
+ ...base,
1845
+ ...stack ? { stack } : void 0
1724
1846
  };
1725
1847
  }
1726
1848
  }
@@ -1794,8 +1916,12 @@ function createGitHubPullRequestTool(ctx, subscriptionConfig) {
1794
1916
  GITHUB_PULL_REQUEST_CREATE_IDEMPOTENCY_TTL_MS
1795
1917
  );
1796
1918
  let result;
1919
+ let stackTarget;
1797
1920
  try {
1798
- result = await createGitHubPullRequest(ctx, request);
1921
+ ({ result, stackTarget } = await createGitHubPullRequest(
1922
+ ctx,
1923
+ request
1924
+ ));
1799
1925
  } catch (error) {
1800
1926
  if (isEgressAuthRequired2(error) || isDefinitiveGitHubPullRequestCreateRejection(error)) {
1801
1927
  await ctx.state.delete(key);
@@ -1824,11 +1950,13 @@ function createGitHubPullRequestTool(ctx, subscriptionConfig) {
1824
1950
  identityId
1825
1951
  });
1826
1952
  await assignPullRequestRequester(ctx, parsedInput, result, requester);
1953
+ const stack = stackTarget ? await stackGitHubPullRequest(ctx, stackTarget) : void 0;
1827
1954
  return await gitHubPullRequestStructuredResult(
1828
1955
  ctx,
1829
1956
  parsedInput,
1830
1957
  result,
1831
- subscriptionConfig
1958
+ subscriptionConfig,
1959
+ stack
1832
1960
  );
1833
1961
  }
1834
1962
  );
@@ -1842,28 +1970,28 @@ import {
1842
1970
  PluginToolInputError as PluginToolInputError6,
1843
1971
  pluginToolOutputSchema as pluginToolOutputSchema5
1844
1972
  } from "@sentry/junior-plugin-api";
1845
- import { z as z7 } from "zod";
1973
+ import { z as z8 } from "zod";
1846
1974
  import { subscribableResourceSchema as subscribableResourceSchema4 } from "@sentry/junior-plugin-api";
1847
- var commitShaSchema2 = z7.string().regex(/^[0-9a-f]{40}$/i);
1848
- var inputSchema3 = z7.object({
1849
- repo: z7.string().describe('Repository in "owner/name" format.'),
1850
- number: z7.number().int().positive().describe("Pull request number.")
1975
+ var commitShaSchema2 = z8.string().regex(/^[0-9a-f]{40}$/i);
1976
+ var inputSchema3 = z8.object({
1977
+ repo: z8.string().describe('Repository in "owner/name" format.'),
1978
+ number: z8.number().int().positive().describe("Pull request number.")
1851
1979
  }).strict();
1852
- var pullRequestSchema = z7.object({
1853
- base: z7.string(),
1854
- draft: z7.boolean(),
1855
- head: z7.string(),
1856
- headSha: commitShaSchema2,
1857
- merged: z7.boolean(),
1858
- number: z7.number(),
1859
- state: z7.string(),
1980
+ var pullRequestSchema = z8.object({
1981
+ base: z8.string(),
1982
+ draft: z8.boolean(),
1983
+ head: z8.string(),
1984
+ head_sha: commitShaSchema2,
1985
+ merged: z8.boolean(),
1986
+ number: z8.number(),
1987
+ state: z8.string(),
1860
1988
  subscribable: subscribableResourceSchema4.optional(),
1861
- title: z7.string(),
1862
- url: z7.string()
1989
+ title: z8.string(),
1990
+ url: z8.string()
1863
1991
  });
1864
1992
  var outputSchema3 = pluginToolOutputSchema5.merge(
1865
1993
  pullRequestSchema.extend({
1866
- target: z7.literal("getPullRequest")
1994
+ target: z8.literal("getPullRequest")
1867
1995
  })
1868
1996
  );
1869
1997
  function parseRepo5(value) {
@@ -1916,15 +2044,15 @@ function createGitHubGetPullRequestTool(ctx) {
1916
2044
  }
1917
2045
  throw new Error(message);
1918
2046
  }
1919
- const providerResult = z7.object({
1920
- base: z7.object({ ref: z7.string() }),
1921
- draft: z7.boolean(),
1922
- head: z7.object({ ref: z7.string(), sha: commitShaSchema2 }),
1923
- html_url: z7.string(),
1924
- merged: z7.boolean().optional().default(false),
1925
- number: z7.number(),
1926
- state: z7.string(),
1927
- title: z7.string()
2047
+ const providerResult = z8.object({
2048
+ base: z8.object({ ref: z8.string() }),
2049
+ draft: z8.boolean(),
2050
+ head: z8.object({ ref: z8.string(), sha: commitShaSchema2 }),
2051
+ html_url: z8.string(),
2052
+ merged: z8.boolean().optional().default(false),
2053
+ number: z8.number(),
2054
+ state: z8.string(),
2055
+ title: z8.string()
1928
2056
  }).parse(parsed);
1929
2057
  const subscribable = gitHubPullRequestSubscribable({
1930
2058
  canSubscribe: ctx.events.canSubscribe,
@@ -1935,7 +2063,7 @@ function createGitHubGetPullRequestTool(ctx) {
1935
2063
  base: providerResult.base.ref,
1936
2064
  draft: providerResult.draft,
1937
2065
  head: providerResult.head.ref,
1938
- headSha: providerResult.head.sha.toLowerCase(),
2066
+ head_sha: providerResult.head.sha.toLowerCase(),
1939
2067
  merged: providerResult.merged,
1940
2068
  number: providerResult.number,
1941
2069
  state: providerResult.state,
@@ -1969,45 +2097,45 @@ import {
1969
2097
  pluginToolOutputSchema as pluginToolOutputSchema6,
1970
2098
  subscribableResourceSchema as subscribableResourceSchema5
1971
2099
  } from "@sentry/junior-plugin-api";
1972
- import { z as z8 } from "zod";
1973
- var inputSchema4 = z8.object({
1974
- repo: z8.string().describe('Repository in "owner/name" format.'),
1975
- tag: z8.string().trim().min(1).describe(
2100
+ import { z as z9 } from "zod";
2101
+ var inputSchema4 = z9.object({
2102
+ repo: z9.string().describe('Repository in "owner/name" format.'),
2103
+ tag: z9.string().trim().min(1).describe(
1976
2104
  "Optional release tag name. Omit to inspect and watch every published release in the repository."
1977
2105
  ).optional()
1978
2106
  }).strict();
1979
- var releaseSchema = z8.object({
1980
- createdAt: z8.string(),
1981
- draft: z8.boolean(),
1982
- htmlUrl: z8.string(),
1983
- id: z8.number(),
1984
- name: z8.string().nullable(),
1985
- prerelease: z8.boolean(),
1986
- publishedAt: z8.string().nullable(),
1987
- tagName: z8.string(),
1988
- targetCommitish: z8.string()
2107
+ var releaseSchema = z9.object({
2108
+ created_at: z9.string(),
2109
+ draft: z9.boolean(),
2110
+ html_url: z9.string(),
2111
+ id: z9.number(),
2112
+ name: z9.string().nullable(),
2113
+ prerelease: z9.boolean(),
2114
+ published_at: z9.string().nullable(),
2115
+ tag_name: z9.string(),
2116
+ target_commitish: z9.string()
1989
2117
  }).strict();
1990
- var releaseSourceSchema = z8.object({
2118
+ var releaseSourceSchema = z9.object({
1991
2119
  release: releaseSchema.nullable(),
1992
- repo: z8.string(),
2120
+ repo: z9.string(),
1993
2121
  subscribable: subscribableResourceSchema5.optional(),
1994
- tag: z8.string().nullable()
2122
+ tag: z9.string().nullable()
1995
2123
  }).strict();
1996
2124
  var outputSchema4 = pluginToolOutputSchema6.merge(
1997
2125
  releaseSourceSchema.extend({
1998
- target: z8.literal("getRelease")
2126
+ target: z9.literal("getRelease")
1999
2127
  })
2000
2128
  );
2001
- var providerReleaseSchema = z8.object({
2002
- created_at: z8.string(),
2003
- draft: z8.boolean(),
2004
- html_url: z8.string(),
2005
- id: z8.number(),
2006
- name: z8.string().nullable(),
2007
- prerelease: z8.boolean(),
2008
- published_at: z8.string().nullable(),
2009
- tag_name: z8.string(),
2010
- target_commitish: z8.string()
2129
+ var providerReleaseSchema = z9.object({
2130
+ created_at: z9.string(),
2131
+ draft: z9.boolean(),
2132
+ html_url: z9.string(),
2133
+ id: z9.number(),
2134
+ name: z9.string().nullable(),
2135
+ prerelease: z9.boolean(),
2136
+ published_at: z9.string().nullable(),
2137
+ tag_name: z9.string(),
2138
+ target_commitish: z9.string()
2011
2139
  }).passthrough();
2012
2140
  function parseRepo6(value) {
2013
2141
  const parts = value.split("/").map((part) => part.trim());
@@ -2030,15 +2158,15 @@ function repositoryUrl2(repo, path) {
2030
2158
  }
2031
2159
  function mapRelease(providerRelease) {
2032
2160
  return {
2033
- createdAt: providerRelease.created_at,
2161
+ created_at: providerRelease.created_at,
2034
2162
  draft: providerRelease.draft,
2035
- htmlUrl: providerRelease.html_url,
2163
+ html_url: providerRelease.html_url,
2036
2164
  id: providerRelease.id,
2037
2165
  name: providerRelease.name,
2038
2166
  prerelease: providerRelease.prerelease,
2039
- publishedAt: providerRelease.published_at,
2040
- tagName: providerRelease.tag_name,
2041
- targetCommitish: providerRelease.target_commitish
2167
+ published_at: providerRelease.published_at,
2168
+ tag_name: providerRelease.tag_name,
2169
+ target_commitish: providerRelease.target_commitish
2042
2170
  };
2043
2171
  }
2044
2172
  function createGitHubGetReleaseTool(ctx) {
@@ -2126,21 +2254,21 @@ import {
2126
2254
  pluginToolOutputSchema as pluginToolOutputSchema7,
2127
2255
  subscribableResourceSchema as subscribableResourceSchema6
2128
2256
  } from "@sentry/junior-plugin-api";
2129
- import { z as z9 } from "zod";
2130
- var inputSchema5 = z9.object({
2131
- repo: z9.string().describe('Repository in "owner/name" format.')
2257
+ import { z as z10 } from "zod";
2258
+ var inputSchema5 = z10.object({
2259
+ repo: z10.string().describe('Repository in "owner/name" format.')
2132
2260
  }).strict();
2133
- var repositorySchema = z9.object({
2134
- defaultBranch: z9.string(),
2135
- description: z9.string().nullable(),
2136
- fullName: z9.string(),
2137
- private: z9.boolean(),
2261
+ var repositorySchema = z10.object({
2262
+ default_branch: z10.string(),
2263
+ description: z10.string().nullable(),
2264
+ full_name: z10.string(),
2265
+ private: z10.boolean(),
2138
2266
  subscribable: subscribableResourceSchema6.optional(),
2139
- url: z9.string()
2267
+ url: z10.string()
2140
2268
  });
2141
2269
  var outputSchema5 = pluginToolOutputSchema7.merge(
2142
2270
  repositorySchema.extend({
2143
- target: z9.literal("getRepository")
2271
+ target: z10.literal("getRepository")
2144
2272
  })
2145
2273
  );
2146
2274
  function parseRepo7(value) {
@@ -2191,21 +2319,21 @@ function createGitHubGetRepositoryTool(ctx) {
2191
2319
  `GitHub repository lookup failed with HTTP ${response.status}`
2192
2320
  );
2193
2321
  }
2194
- const providerResult = z9.object({
2195
- default_branch: z9.string(),
2196
- description: z9.string().nullable(),
2197
- full_name: z9.string(),
2198
- html_url: z9.string(),
2199
- private: z9.boolean()
2322
+ const providerResult = z10.object({
2323
+ default_branch: z10.string(),
2324
+ description: z10.string().nullable(),
2325
+ full_name: z10.string(),
2326
+ html_url: z10.string(),
2327
+ private: z10.boolean()
2200
2328
  }).parse(parsed);
2201
2329
  const subscribable = gitHubRepositorySubscribable({
2202
2330
  canSubscribe: ctx.events.canSubscribe,
2203
2331
  repo: providerResult.full_name
2204
2332
  });
2205
2333
  const data = {
2206
- defaultBranch: providerResult.default_branch,
2334
+ default_branch: providerResult.default_branch,
2207
2335
  description: providerResult.description,
2208
- fullName: providerResult.full_name,
2336
+ full_name: providerResult.full_name,
2209
2337
  private: providerResult.private,
2210
2338
  ...subscribable ? { subscribable } : void 0,
2211
2339
  url: providerResult.html_url
@@ -2225,30 +2353,30 @@ import {
2225
2353
  pluginToolOutputSchema as pluginToolOutputSchema8,
2226
2354
  subscribableResourceSchema as subscribableResourceSchema7
2227
2355
  } from "@sentry/junior-plugin-api";
2228
- import { z as z10 } from "zod";
2229
- var inputSchema6 = z10.object({
2230
- repo: z10.string().describe('Repository in "owner/name" format.'),
2231
- number: z10.number().int().positive().describe("Issue number."),
2232
- title: z10.string().trim().min(1).optional().describe("Replacement issue title."),
2233
- body: z10.string().optional().describe(
2356
+ import { z as z11 } from "zod";
2357
+ var inputSchema6 = z11.object({
2358
+ repo: z11.string().describe('Repository in "owner/name" format.'),
2359
+ number: z11.number().int().positive().describe("Issue number."),
2360
+ title: z11.string().trim().min(1).optional().describe("Replacement issue title."),
2361
+ body: z11.string().optional().describe(
2234
2362
  "Replacement issue body. The runtime appends requester attribution and the conversation footer."
2235
2363
  ),
2236
- state: z10.enum(["open", "closed"]).optional().describe("Replacement issue state.")
2364
+ state: z11.enum(["open", "closed"]).optional().describe("Replacement issue state.")
2237
2365
  }).strict().refine(
2238
2366
  ({ title, body, state }) => title !== void 0 || body !== void 0 || state !== void 0,
2239
2367
  { message: "At least one issue field must be provided." }
2240
2368
  );
2241
- var issueSchema = z10.object({
2242
- body: z10.string().nullable(),
2243
- number: z10.number(),
2244
- state: z10.string(),
2369
+ var issueSchema = z11.object({
2370
+ body: z11.string().nullable(),
2371
+ number: z11.number(),
2372
+ state: z11.string(),
2245
2373
  subscribable: subscribableResourceSchema7.optional(),
2246
- title: z10.string(),
2247
- url: z10.string()
2374
+ title: z11.string(),
2375
+ url: z11.string()
2248
2376
  });
2249
2377
  var outputSchema6 = pluginToolOutputSchema8.merge(
2250
2378
  issueSchema.extend({
2251
- target: z10.literal("updateIssue")
2379
+ target: z11.literal("updateIssue")
2252
2380
  })
2253
2381
  );
2254
2382
  function nonEmptyString4(value, name) {
@@ -2336,12 +2464,12 @@ function createGitHubUpdateIssueTool(ctx) {
2336
2464
  `GitHub issue update failed with HTTP ${response.status}: ${githubApiErrorMessage3(parsed)}`
2337
2465
  );
2338
2466
  }
2339
- const providerResult = z10.object({
2340
- body: z10.string().nullable().optional().default(null),
2341
- html_url: z10.string(),
2342
- number: z10.number(),
2343
- state: z10.string(),
2344
- title: z10.string()
2467
+ const providerResult = z11.object({
2468
+ body: z11.string().nullable().optional().default(null),
2469
+ html_url: z11.string(),
2470
+ number: z11.number(),
2471
+ state: z11.string(),
2472
+ title: z11.string()
2345
2473
  }).parse(parsed);
2346
2474
  const subscribable = gitHubIssueSubscribable({
2347
2475
  canSubscribe: ctx.events.canSubscribe,
@@ -2378,18 +2506,18 @@ import {
2378
2506
  PluginToolInputError as PluginToolInputError10,
2379
2507
  pluginToolOutputSchema as pluginToolOutputSchema9
2380
2508
  } from "@sentry/junior-plugin-api";
2381
- import { z as z11 } from "zod";
2509
+ import { z as z12 } from "zod";
2382
2510
  import { subscribableResourceSchema as subscribableResourceSchema8 } from "@sentry/junior-plugin-api";
2383
- var inputSchema7 = z11.object({
2384
- repo: z11.string().describe('Repository in "owner/name" format.'),
2385
- number: z11.number().int().positive().describe("Pull request number."),
2386
- title: z11.string().trim().min(1).optional().describe("Replacement pull request title."),
2387
- body: z11.string().optional().describe(
2511
+ var inputSchema7 = z12.object({
2512
+ repo: z12.string().describe('Repository in "owner/name" format.'),
2513
+ number: z12.number().int().positive().describe("Pull request number."),
2514
+ title: z12.string().trim().min(1).optional().describe("Replacement pull request title."),
2515
+ body: z12.string().optional().describe(
2388
2516
  "Replacement pull request body. The runtime appends requester attribution and the conversation footer."
2389
2517
  ),
2390
- base: z11.string().trim().min(1).optional().describe("Replacement base branch."),
2391
- state: z11.enum(["open", "closed"]).optional().describe("Replacement pull request state."),
2392
- draft: z11.boolean().optional().describe(
2518
+ base: z12.string().trim().min(1).optional().describe("Replacement base branch."),
2519
+ state: z12.enum(["open", "closed"]).optional().describe("Replacement pull request state."),
2520
+ draft: z12.boolean().optional().describe(
2393
2521
  "Set false to mark a draft pull request ready for review, or true to convert it back to a draft."
2394
2522
  )
2395
2523
  }).strict().refine(
@@ -2404,27 +2532,27 @@ var CONVERT_TO_DRAFT = {
2404
2532
  operationName: "ConvertPullRequestToDraft",
2405
2533
  query: "mutation ConvertPullRequestToDraft($id: ID!) { result: convertPullRequestToDraft(input: {pullRequestId: $id}) { pullRequest { isDraft } } }"
2406
2534
  };
2407
- var draftMutationResponseSchema = z11.object({
2408
- data: z11.object({
2409
- result: z11.object({ pullRequest: z11.object({ isDraft: z11.boolean() }) })
2535
+ var draftMutationResponseSchema = z12.object({
2536
+ data: z12.object({
2537
+ result: z12.object({ pullRequest: z12.object({ isDraft: z12.boolean() }) })
2410
2538
  })
2411
2539
  });
2412
- var graphqlErrorsSchema = z11.object({
2413
- errors: z11.array(z11.object({ message: z11.string() })).min(1)
2540
+ var graphqlErrorsSchema = z12.object({
2541
+ errors: z12.array(z12.object({ message: z12.string() })).min(1)
2414
2542
  });
2415
- var pullRequestSchema2 = z11.object({
2416
- base: z11.string(),
2417
- body: z11.string().nullable(),
2418
- draft: z11.boolean(),
2419
- number: z11.number(),
2420
- state: z11.string(),
2543
+ var pullRequestSchema2 = z12.object({
2544
+ base: z12.string(),
2545
+ body: z12.string().nullable(),
2546
+ draft: z12.boolean(),
2547
+ number: z12.number(),
2548
+ state: z12.string(),
2421
2549
  subscribable: subscribableResourceSchema8.optional(),
2422
- title: z11.string(),
2423
- url: z11.string()
2550
+ title: z12.string(),
2551
+ url: z12.string()
2424
2552
  });
2425
2553
  var outputSchema7 = pluginToolOutputSchema9.merge(
2426
2554
  pullRequestSchema2.extend({
2427
- target: z11.literal("updatePullRequest")
2555
+ target: z12.literal("updatePullRequest")
2428
2556
  })
2429
2557
  );
2430
2558
  function nonEmptyString5(value, name) {
@@ -2540,16 +2668,16 @@ function createGitHubUpdatePullRequestTool(ctx) {
2540
2668
  `GitHub pull request update failed with HTTP ${response.status}: ${githubApiErrorMessage4(parsed)}`
2541
2669
  );
2542
2670
  }
2543
- const providerResult = z11.object({
2544
- base: z11.object({ ref: z11.string() }),
2545
- body: z11.string().nullable().optional().default(null),
2546
- draft: z11.boolean(),
2547
- html_url: z11.string(),
2548
- merged: z11.boolean(),
2549
- node_id: z11.string().optional(),
2550
- number: z11.number(),
2551
- state: z11.string(),
2552
- title: z11.string()
2671
+ const providerResult = z12.object({
2672
+ base: z12.object({ ref: z12.string() }),
2673
+ body: z12.string().nullable().optional().default(null),
2674
+ draft: z12.boolean(),
2675
+ html_url: z12.string(),
2676
+ merged: z12.boolean(),
2677
+ node_id: z12.string().optional(),
2678
+ number: z12.number(),
2679
+ state: z12.string(),
2680
+ title: z12.string()
2553
2681
  }).parse(parsed);
2554
2682
  if (update.draft !== void 0 && update.draft !== providerResult.draft) {
2555
2683
  if (!providerResult.node_id) {
@@ -2614,7 +2742,7 @@ import {
2614
2742
  PluginToolInputError as PluginToolInputError11,
2615
2743
  pluginToolOutputSchema as pluginToolOutputSchema10
2616
2744
  } from "@sentry/junior-plugin-api";
2617
- import { z as z12 } from "zod";
2745
+ import { z as z13 } from "zod";
2618
2746
  var STATUS_TO_REACTION_CONTENT = {
2619
2747
  reviewing: "eyes",
2620
2748
  addressed: "+1",
@@ -2623,24 +2751,24 @@ var STATUS_TO_REACTION_CONTENT = {
2623
2751
  var FEEDBACK_REACTION_CONTENTS = new Set(
2624
2752
  Object.values(STATUS_TO_REACTION_CONTENT)
2625
2753
  );
2626
- var inputSchema8 = z12.object({
2627
- repo: z12.string().describe('Repository in "owner/name" format.'),
2628
- commentKind: z12.enum(["conversation", "review"]).describe(
2754
+ var inputSchema8 = z13.object({
2755
+ repo: z13.string().describe('Repository in "owner/name" format.'),
2756
+ comment_kind: z13.enum(["conversation", "review"]).describe(
2629
2757
  'Comment kind: "conversation" for a pull request conversation comment, "review" for an inline review comment.'
2630
2758
  ),
2631
- commentId: z12.number().int().positive().describe(
2759
+ comment_id: z13.number().int().positive().describe(
2632
2760
  "GitHub comment id (conversation comment id or inline review comment id)."
2633
2761
  ),
2634
- status: z12.enum(["addressed", "declined"]).describe(
2762
+ status: z13.enum(["addressed", "declined"]).describe(
2635
2763
  "Feedback outcome. Maps to a reaction: addressed -> +1, declined -> -1."
2636
2764
  )
2637
2765
  }).strict();
2638
2766
  var outputSchema8 = pluginToolOutputSchema10.extend({
2639
- target: z12.literal("updatePullRequestFeedback"),
2640
- repo: z12.string(),
2641
- commentId: z12.number(),
2642
- status: z12.enum(["addressed", "declined"]),
2643
- reactionId: z12.number()
2767
+ target: z13.literal("updatePullRequestFeedback"),
2768
+ repo: z13.string(),
2769
+ comment_id: z13.number(),
2770
+ status: z13.enum(["addressed", "declined"]),
2771
+ reaction_id: z13.number()
2644
2772
  });
2645
2773
  function parseRepo10(value) {
2646
2774
  const parts = value.split("/").map((part) => part.trim());
@@ -2675,10 +2803,10 @@ function githubError(payload) {
2675
2803
  }
2676
2804
  return "GitHub request failed";
2677
2805
  }
2678
- var reactionSchema = z12.object({
2679
- id: z12.number(),
2680
- content: z12.string(),
2681
- user: z12.object({ id: z12.number() }).nullable()
2806
+ var reactionSchema = z13.object({
2807
+ id: z13.number(),
2808
+ content: z13.string(),
2809
+ user: z13.object({ id: z13.number() }).nullable()
2682
2810
  });
2683
2811
  async function assertBotAuthoredPullRequest(egress, input) {
2684
2812
  const headers = {
@@ -2699,9 +2827,9 @@ async function assertBotAuthoredPullRequest(egress, input) {
2699
2827
  if (commentResponse.status === 404) throw new PluginToolInputError11(message);
2700
2828
  throw new Error(message);
2701
2829
  }
2702
- const comment = z12.object({
2703
- issue_url: z12.string().optional(),
2704
- pull_request_url: z12.string().optional()
2830
+ const comment = z13.object({
2831
+ issue_url: z13.string().optional(),
2832
+ pull_request_url: z13.string().optional()
2705
2833
  }).safeParse(commentPayload);
2706
2834
  const parentUrl = comment.success ? input.commentKind === "conversation" ? comment.data.issue_url : comment.data.pull_request_url : void 0;
2707
2835
  const number = /\/(?:issues|pulls)\/(\d+)$/.exec(parentUrl ?? "")?.[1];
@@ -2722,7 +2850,7 @@ async function assertBotAuthoredPullRequest(egress, input) {
2722
2850
  `GitHub pull request lookup failed with HTTP ${pullResponse.status}: ${githubError(pullPayload)}`
2723
2851
  );
2724
2852
  }
2725
- const pull = z12.object({ user: z12.object({ id: z12.number() }).nullable() }).safeParse(pullPayload);
2853
+ const pull = z13.object({ user: z13.object({ id: z13.number() }).nullable() }).safeParse(pullPayload);
2726
2854
  if (!pullResponse.ok || !pull.success || pull.data.user?.id !== input.botUserId) {
2727
2855
  throw new PluginToolInputError11(
2728
2856
  "This bot can only set feedback status on comments on pull requests it authored."
@@ -2740,7 +2868,7 @@ function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
2740
2868
  openWorldHint: true,
2741
2869
  readOnlyHint: false
2742
2870
  },
2743
- description: "Set your outcome reaction on GitHub pull request feedback: addressed (+1) or declined (-1). Use the commentId and commentKind from the event after acting on the feedback. Replaces only your prior status reaction on that comment. Only works on pull requests the bot authored.",
2871
+ description: "Set your outcome reaction on GitHub pull request feedback: addressed (+1) or declined (-1). Use the comment_id and comment_kind from the event after acting on the feedback. Replaces only your prior status reaction on that comment. Only works on pull requests the bot authored.",
2744
2872
  exposure: "direct",
2745
2873
  inputSchema: inputSchema8,
2746
2874
  outputSchema: outputSchema8,
@@ -2752,7 +2880,11 @@ function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
2752
2880
  { cause: parsedInput.error }
2753
2881
  );
2754
2882
  }
2755
- const { commentId, commentKind, status } = parsedInput.data;
2883
+ const {
2884
+ comment_id: commentId,
2885
+ comment_kind: commentKind,
2886
+ status
2887
+ } = parsedInput.data;
2756
2888
  const repo = parseRepo10(parsedInput.data.repo);
2757
2889
  const botUserId = botUserIdFromEmail(botEmail);
2758
2890
  if (botUserId === void 0) {
@@ -2785,7 +2917,7 @@ function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
2785
2917
  `GitHub reaction lookup failed with HTTP ${listResponse.status}: ${githubError(listPayload)}`
2786
2918
  );
2787
2919
  }
2788
- const botReactions = z12.array(reactionSchema).parse(listPayload).filter(
2920
+ const botReactions = z13.array(reactionSchema).parse(listPayload).filter(
2789
2921
  (reaction) => reaction.user?.id === botUserId && FEEDBACK_REACTION_CONTENTS.has(reaction.content)
2790
2922
  );
2791
2923
  const existing = botReactions.find(
@@ -2811,9 +2943,9 @@ function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
2811
2943
  return {
2812
2944
  target: "updatePullRequestFeedback",
2813
2945
  repo: repo.ref,
2814
- commentId,
2946
+ comment_id: commentId,
2815
2947
  status,
2816
- reactionId: existing.id
2948
+ reaction_id: existing.id
2817
2949
  };
2818
2950
  }
2819
2951
  const createResponse = await ctx.egress.fetch({
@@ -2838,9 +2970,9 @@ function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
2838
2970
  return {
2839
2971
  target: "updatePullRequestFeedback",
2840
2972
  repo: repo.ref,
2841
- commentId,
2973
+ comment_id: commentId,
2842
2974
  status,
2843
- reactionId: created.id
2975
+ reaction_id: created.id
2844
2976
  };
2845
2977
  }
2846
2978
  });
@@ -2852,21 +2984,21 @@ import {
2852
2984
  PluginToolInputError as PluginToolInputError12,
2853
2985
  pluginToolOutputSchema as pluginToolOutputSchema11
2854
2986
  } from "@sentry/junior-plugin-api";
2855
- import { z as z13 } from "zod";
2856
- var inputSchema9 = z13.object({
2857
- repo: z13.string().describe(
2987
+ import { z as z14 } from "zod";
2988
+ var inputSchema9 = z14.object({
2989
+ repo: z14.string().describe(
2858
2990
  'Repository in "owner/name" format. Required because GraphQL has no repo path.'
2859
2991
  ),
2860
- threadId: z13.string().trim().min(1).describe(
2861
- "GitHub pull request review thread node ID (the same `threadId` / `id` variable used by `gh api graphql` resolveReviewThread)."
2992
+ thread_id: z14.string().trim().min(1).describe(
2993
+ "GitHub pull request review thread node ID (the `threadId` / `id` variable used by `gh api graphql` resolveReviewThread)."
2862
2994
  )
2863
2995
  }).strict();
2864
2996
  var outputSchema9 = pluginToolOutputSchema11.extend({
2865
- target: z13.literal("resolvePullRequestReviewThread"),
2866
- repo: z13.string(),
2867
- number: z13.number(),
2868
- threadId: z13.string(),
2869
- resolved: z13.boolean()
2997
+ target: z14.literal("resolvePullRequestReviewThread"),
2998
+ repo: z14.string(),
2999
+ number: z14.number(),
3000
+ thread_id: z14.string(),
3001
+ resolved: z14.boolean()
2870
3002
  });
2871
3003
  function parseRepo11(value) {
2872
3004
  const parts = value.split("/").map((part) => part.trim());
@@ -2942,7 +3074,7 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
2942
3074
  body: JSON.stringify({
2943
3075
  operationName: "ReviewThreadOwnership",
2944
3076
  query,
2945
- variables: { threadId: parsedInput.data.threadId }
3077
+ variables: { threadId: parsedInput.data.thread_id }
2946
3078
  })
2947
3079
  })
2948
3080
  });
@@ -2952,18 +3084,18 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
2952
3084
  `GitHub review thread lookup failed with HTTP ${lookupResponse.status}: ${githubError2(lookupPayload)}`
2953
3085
  );
2954
3086
  }
2955
- const threadNodeSchema = z13.object({
2956
- id: z13.string(),
2957
- isResolved: z13.boolean(),
2958
- pullRequest: z13.object({
2959
- author: z13.object({ databaseId: z13.number().optional() }).passthrough().nullable(),
2960
- number: z13.number(),
2961
- repository: z13.object({ nameWithOwner: z13.string() }).passthrough()
3087
+ const threadNodeSchema = z14.object({
3088
+ id: z14.string(),
3089
+ isResolved: z14.boolean(),
3090
+ pullRequest: z14.object({
3091
+ author: z14.object({ databaseId: z14.number().optional() }).passthrough().nullable(),
3092
+ number: z14.number(),
3093
+ repository: z14.object({ nameWithOwner: z14.string() }).passthrough()
2962
3094
  }).passthrough()
2963
3095
  }).passthrough();
2964
- const lookupResultSchema = z13.object({
2965
- data: z13.object({
2966
- node: z13.unknown().nullable().optional()
3096
+ const lookupResultSchema = z14.object({
3097
+ data: z14.object({
3098
+ node: z14.unknown().nullable().optional()
2967
3099
  }).passthrough()
2968
3100
  }).passthrough();
2969
3101
  const lookupResult = lookupResultSchema.safeParse(lookupPayload);
@@ -2985,7 +3117,7 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
2985
3117
  target: "resolvePullRequestReviewThread",
2986
3118
  repo: repo.ref,
2987
3119
  number: pullRequest.number,
2988
- threadId: thread.id,
3120
+ thread_id: thread.id,
2989
3121
  resolved: true
2990
3122
  };
2991
3123
  }
@@ -3013,10 +3145,10 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
3013
3145
  `GitHub review thread resolution failed with HTTP ${resolveResponse.status}: ${githubError2(resolvePayload)}`
3014
3146
  );
3015
3147
  }
3016
- const resolveResultSchema = z13.object({
3017
- data: z13.object({
3018
- resolveReviewThread: z13.object({
3019
- thread: z13.object({ id: z13.string(), isResolved: z13.boolean() }).passthrough()
3148
+ const resolveResultSchema = z14.object({
3149
+ data: z14.object({
3150
+ resolveReviewThread: z14.object({
3151
+ thread: z14.object({ id: z14.string(), isResolved: z14.boolean() }).passthrough()
3020
3152
  }).passthrough()
3021
3153
  }).passthrough()
3022
3154
  }).passthrough();
@@ -3035,7 +3167,7 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
3035
3167
  target: "resolvePullRequestReviewThread",
3036
3168
  repo: repo.ref,
3037
3169
  number: pullRequest.number,
3038
- threadId: resolved.id,
3170
+ thread_id: resolved.id,
3039
3171
  resolved: true
3040
3172
  };
3041
3173
  }
@@ -3048,32 +3180,32 @@ import {
3048
3180
  PluginToolInputError as PluginToolInputError13,
3049
3181
  pluginToolOutputSchema as pluginToolOutputSchema12
3050
3182
  } from "@sentry/junior-plugin-api";
3051
- import { z as z14 } from "zod";
3052
- var reviewCommentSchema = z14.object({
3053
- path: z14.string().trim().min(1).describe("File path in the pull request."),
3054
- body: z14.string().trim().min(1).describe("Inline review comment."),
3055
- line: z14.number().int().positive().describe("Line in the pull request diff."),
3056
- side: z14.enum(["LEFT", "RIGHT"]).describe("Side of the pull request diff."),
3057
- startLine: z14.number().int().positive().optional().describe("First line of a multi-line comment."),
3058
- startSide: z14.enum(["LEFT", "RIGHT"]).optional().describe("First side of a multi-line comment.")
3183
+ import { z as z15 } from "zod";
3184
+ var reviewCommentSchema = z15.object({
3185
+ path: z15.string().trim().min(1).describe("File path in the pull request."),
3186
+ body: z15.string().trim().min(1).describe("Inline review comment."),
3187
+ line: z15.number().int().positive().describe("Line in the pull request diff."),
3188
+ side: z15.enum(["LEFT", "RIGHT"]).describe("Side of the pull request diff."),
3189
+ start_line: z15.number().int().positive().optional().describe("First line of a multi-line comment."),
3190
+ start_side: z15.enum(["LEFT", "RIGHT"]).optional().describe("First side of a multi-line comment.")
3059
3191
  }).strict().refine(
3060
- ({ startLine, startSide }) => startLine === void 0 === (startSide === void 0),
3061
- { message: "startLine and startSide must be provided together." }
3192
+ ({ start_line, start_side }) => start_line === void 0 === (start_side === void 0),
3193
+ { message: "start_line and start_side must be provided together." }
3062
3194
  );
3063
- var inputSchema10 = z14.object({
3064
- repo: z14.string().describe('Repository in "owner/name" format.'),
3065
- number: z14.number().int().positive().describe("Pull request number."),
3066
- event: z14.enum(["COMMENT", "REQUEST_CHANGES"]).describe("Review result. You cannot approve pull requests."),
3067
- body: z14.string().trim().min(1).describe("Review summary."),
3068
- comments: z14.array(reviewCommentSchema).optional().describe("Optional inline review comments.")
3195
+ var inputSchema10 = z15.object({
3196
+ repo: z15.string().describe('Repository in "owner/name" format.'),
3197
+ number: z15.number().int().positive().describe("Pull request number."),
3198
+ event: z15.enum(["COMMENT", "REQUEST_CHANGES"]).describe("Review result. You cannot approve pull requests."),
3199
+ body: z15.string().trim().min(1).describe("Review summary."),
3200
+ comments: z15.array(reviewCommentSchema).optional().describe("Optional inline review comments.")
3069
3201
  }).strict();
3070
3202
  var outputSchema10 = pluginToolOutputSchema12.extend({
3071
- target: z14.literal("submitPullRequestReview"),
3072
- repo: z14.string(),
3073
- number: z14.number(),
3074
- reviewId: z14.number(),
3075
- state: z14.string(),
3076
- url: z14.string()
3203
+ target: z15.literal("submitPullRequestReview"),
3204
+ repo: z15.string(),
3205
+ number: z15.number(),
3206
+ review_id: z15.number(),
3207
+ state: z15.string(),
3208
+ url: z15.string()
3077
3209
  });
3078
3210
  function parseRepo12(value) {
3079
3211
  const parts = value.split("/").map((part) => part.trim());
@@ -3125,8 +3257,8 @@ function createGitHubSubmitPullRequestReviewTool(egress) {
3125
3257
  body: comment.body,
3126
3258
  line: comment.line,
3127
3259
  side: comment.side,
3128
- ...comment.startLine !== void 0 ? { start_line: comment.startLine } : void 0,
3129
- ...comment.startSide !== void 0 ? { start_side: comment.startSide } : void 0
3260
+ ...comment.start_line !== void 0 ? { start_line: comment.start_line } : void 0,
3261
+ ...comment.start_side !== void 0 ? { start_side: comment.start_side } : void 0
3130
3262
  }));
3131
3263
  const response = await egress.fetch({
3132
3264
  provider: "github",
@@ -3152,12 +3284,12 @@ function createGitHubSubmitPullRequestReviewTool(egress) {
3152
3284
  if (!response.ok) {
3153
3285
  throwReviewError(response.status, parsed);
3154
3286
  }
3155
- const providerResult = z14.object({ id: z14.number(), html_url: z14.string(), state: z14.string() }).parse(parsed);
3287
+ const providerResult = z15.object({ id: z15.number(), html_url: z15.string(), state: z15.string() }).parse(parsed);
3156
3288
  return {
3157
3289
  target: "submitPullRequestReview",
3158
3290
  repo: repo.ref,
3159
3291
  number: review.number,
3160
- reviewId: providerResult.id,
3292
+ review_id: providerResult.id,
3161
3293
  state: providerResult.state,
3162
3294
  url: providerResult.html_url
3163
3295
  };
@@ -3193,26 +3325,26 @@ function createGitHubTools(ctx, botEmail, pullRequestSubscription) {
3193
3325
 
3194
3326
  // src/webhooks/handler.ts
3195
3327
  import { createHmac, timingSafeEqual } from "crypto";
3196
- import { z as z24 } from "zod";
3328
+ import { z as z25 } from "zod";
3197
3329
 
3198
3330
  // src/issue-outcomes/store.ts
3199
3331
  import { and as and2, eq as eq2, lte, sql as sql2 } from "drizzle-orm";
3200
- import { z as z15 } from "zod";
3201
- var githubIssueOutcomeInputSchema = z15.object({
3202
- candidateOwned: z15.boolean(),
3203
- closedAt: z15.date().optional(),
3204
- issueId: z15.string().min(1),
3205
- number: z15.number().int().positive(),
3206
- openedAt: z15.date(),
3207
- repositoryFullName: z15.string().min(1),
3208
- repositoryId: z15.string().min(1),
3332
+ import { z as z16 } from "zod";
3333
+ var githubIssueOutcomeInputSchema = z16.object({
3334
+ candidateOwned: z16.boolean(),
3335
+ closedAt: z16.date().optional(),
3336
+ issueId: z16.string().min(1),
3337
+ number: z16.number().int().positive(),
3338
+ openedAt: z16.date(),
3339
+ repositoryFullName: z16.string().min(1),
3340
+ repositoryId: z16.string().min(1),
3209
3341
  state: githubIssueStateSchema,
3210
3342
  stateReason: githubIssueStateReasonSchema.optional(),
3211
- updatedAt: z15.date()
3343
+ updatedAt: z16.date()
3212
3344
  }).strict();
3213
- var githubIssueConversationsInputSchema = z15.object({
3214
- conversationIds: z15.array(z15.string().min(1)).min(1),
3215
- issueId: z15.string().min(1)
3345
+ var githubIssueConversationsInputSchema = z16.object({
3346
+ conversationIds: z16.array(z16.string().min(1)).min(1),
3347
+ issueId: z16.string().min(1)
3216
3348
  }).strict();
3217
3349
  function projectionValues(input) {
3218
3350
  return {
@@ -3276,33 +3408,33 @@ async function recordGitHubIssueConversations(db, input) {
3276
3408
 
3277
3409
  // src/pull-request-outcomes/store.ts
3278
3410
  import { and as and3, eq as eq3, lte as lte2, ne, sql as sql3 } from "drizzle-orm";
3279
- import { z as z16 } from "zod";
3280
- var githubPullRequestOutcomeInputSchema = z16.object({
3281
- candidateOwned: z16.boolean(),
3282
- closedAt: z16.date().optional(),
3411
+ import { z as z17 } from "zod";
3412
+ var githubPullRequestOutcomeInputSchema = z17.object({
3413
+ candidateOwned: z17.boolean(),
3414
+ closedAt: z17.date().optional(),
3283
3415
  commitComposition: githubPullRequestCommitCompositionSchema.optional(),
3284
- mergedAt: z16.date().optional(),
3285
- number: z16.number().int().positive(),
3286
- openedAt: z16.date(),
3287
- pullRequestId: z16.string().min(1),
3288
- repositoryFullName: z16.string().min(1),
3289
- repositoryId: z16.string().min(1),
3416
+ mergedAt: z17.date().optional(),
3417
+ number: z17.number().int().positive(),
3418
+ openedAt: z17.date(),
3419
+ pullRequestId: z17.string().min(1),
3420
+ repositoryFullName: z17.string().min(1),
3421
+ repositoryId: z17.string().min(1),
3290
3422
  state: githubPullRequestStateSchema,
3291
- title: z16.string().min(1).optional(),
3292
- updatedAt: z16.date()
3423
+ title: z17.string().min(1).optional(),
3424
+ updatedAt: z17.date()
3293
3425
  }).strict();
3294
- var githubPullRequestConversationsInputSchema = z16.object({
3295
- conversationIds: z16.array(z16.string().min(1)).min(1),
3296
- pullRequestId: z16.string().min(1)
3426
+ var githubPullRequestConversationsInputSchema = z17.object({
3427
+ conversationIds: z17.array(z17.string().min(1)).min(1),
3428
+ pullRequestId: z17.string().min(1)
3297
3429
  }).strict();
3298
- var githubPullRequestLinkedIssuesInputSchema = z16.object({
3299
- linkedIssues: z16.array(
3300
- z16.object({
3301
- number: z16.number().int().positive(),
3302
- repositoryFullName: z16.string().min(1)
3430
+ var githubPullRequestLinkedIssuesInputSchema = z17.object({
3431
+ linkedIssues: z17.array(
3432
+ z17.object({
3433
+ number: z17.number().int().positive(),
3434
+ repositoryFullName: z17.string().min(1)
3303
3435
  }).strict()
3304
3436
  ).min(1),
3305
- pullRequestId: z16.string().min(1)
3437
+ pullRequestId: z17.string().min(1)
3306
3438
  }).strict();
3307
3439
  function projectionValues2(input) {
3308
3440
  return {
@@ -3505,39 +3637,39 @@ async function releaseGitHubPullRequestReadySync(db, target, claim) {
3505
3637
  }
3506
3638
 
3507
3639
  // src/webhooks/issue-outcome.ts
3508
- import { z as z17 } from "zod";
3509
- var canonicalIssueOutcomeSchema = z17.object({
3510
- action: z17.enum(["opened", "closed", "reopened"]),
3511
- issue: z17.object({
3512
- body: z17.string().nullable().optional(),
3513
- closed_at: z17.string().nullable().optional(),
3514
- created_at: z17.string(),
3515
- id: z17.number().int().positive(),
3516
- number: z17.number().int().positive(),
3640
+ import { z as z18 } from "zod";
3641
+ var canonicalIssueOutcomeSchema = z18.object({
3642
+ action: z18.enum(["opened", "closed", "reopened"]),
3643
+ issue: z18.object({
3644
+ body: z18.string().nullable().optional(),
3645
+ closed_at: z18.string().nullable().optional(),
3646
+ created_at: z18.string(),
3647
+ id: z18.number().int().positive(),
3648
+ number: z18.number().int().positive(),
3517
3649
  state_reason: githubIssueStateReasonSchema.nullable().optional(),
3518
- updated_at: z17.string(),
3519
- user: z17.object({ login: z17.string().min(1) }).strict()
3650
+ updated_at: z18.string(),
3651
+ user: z18.object({ login: z18.string().min(1) }).strict()
3520
3652
  }).strict(),
3521
- repository: z17.object({
3522
- full_name: z17.string().min(1),
3523
- id: z17.number().int().positive()
3653
+ repository: z18.object({
3654
+ full_name: z18.string().min(1),
3655
+ id: z18.number().int().positive()
3524
3656
  }).strict()
3525
3657
  }).strict();
3526
- var issueOutcomeSchema = z17.object({
3527
- action: z17.enum(["opened", "closed", "reopened"]),
3528
- issue: z17.object({
3529
- body: z17.string().nullable().optional(),
3530
- closed_at: z17.string().nullable().optional(),
3531
- created_at: z17.string(),
3532
- id: z17.number().int().positive(),
3533
- number: z17.number().int().positive(),
3658
+ var issueOutcomeSchema = z18.object({
3659
+ action: z18.enum(["opened", "closed", "reopened"]),
3660
+ issue: z18.object({
3661
+ body: z18.string().nullable().optional(),
3662
+ closed_at: z18.string().nullable().optional(),
3663
+ created_at: z18.string(),
3664
+ id: z18.number().int().positive(),
3665
+ number: z18.number().int().positive(),
3534
3666
  state_reason: githubIssueStateReasonSchema.nullable().optional(),
3535
- updated_at: z17.string(),
3536
- user: z17.object({ login: z17.string().min(1) }).passthrough()
3667
+ updated_at: z18.string(),
3668
+ user: z18.object({ login: z18.string().min(1) }).passthrough()
3537
3669
  }).passthrough(),
3538
- repository: z17.object({
3539
- full_name: z17.string().min(1),
3540
- id: z17.number().int().positive()
3670
+ repository: z18.object({
3671
+ full_name: z18.string().min(1),
3672
+ id: z18.number().int().positive()
3541
3673
  }).passthrough()
3542
3674
  }).passthrough().transform(
3543
3675
  (provider) => canonicalIssueOutcomeSchema.parse({
@@ -3558,7 +3690,7 @@ var issueOutcomeSchema = z17.object({
3558
3690
  }
3559
3691
  })
3560
3692
  );
3561
- var issueLifecycleActionSchema = z17.object({ action: z17.string() }).passthrough();
3693
+ var issueLifecycleActionSchema = z18.object({ action: z18.string() }).passthrough();
3562
3694
  function timestamp2(value) {
3563
3695
  if (!value) return void 0;
3564
3696
  const parsed = new Date(value);
@@ -3602,21 +3734,21 @@ function normalizeGitHubIssueOutcome(args) {
3602
3734
  updatedAt
3603
3735
  };
3604
3736
  }
3605
- var canonicalIssueConversationSchema = z17.object({
3606
- issue: z17.object({
3607
- body: z17.string().nullable().optional(),
3608
- id: z17.number().int().positive(),
3609
- user: z17.object({ login: z17.string().min(1) }).strict()
3737
+ var canonicalIssueConversationSchema = z18.object({
3738
+ issue: z18.object({
3739
+ body: z18.string().nullable().optional(),
3740
+ id: z18.number().int().positive(),
3741
+ user: z18.object({ login: z18.string().min(1) }).strict()
3610
3742
  }).strict(),
3611
- sender: z17.object({ login: z17.string().min(1) }).strict().optional()
3743
+ sender: z18.object({ login: z18.string().min(1) }).strict().optional()
3612
3744
  }).strict();
3613
- var issueConversationSchema = z17.object({
3614
- issue: z17.object({
3615
- body: z17.string().nullable().optional(),
3616
- id: z17.number().int().positive(),
3617
- user: z17.object({ login: z17.string().min(1) }).passthrough()
3745
+ var issueConversationSchema = z18.object({
3746
+ issue: z18.object({
3747
+ body: z18.string().nullable().optional(),
3748
+ id: z18.number().int().positive(),
3749
+ user: z18.object({ login: z18.string().min(1) }).passthrough()
3618
3750
  }).passthrough(),
3619
- sender: z17.object({ login: z17.string().min(1) }).passthrough().optional()
3751
+ sender: z18.object({ login: z18.string().min(1) }).passthrough().optional()
3620
3752
  }).passthrough().transform(
3621
3753
  (provider) => canonicalIssueConversationSchema.parse({
3622
3754
  issue: {
@@ -3643,43 +3775,43 @@ function normalizeGitHubIssueConversations(args) {
3643
3775
  }
3644
3776
 
3645
3777
  // src/webhooks/pull-request-outcome.ts
3646
- import { z as z18 } from "zod";
3647
- var canonicalPullRequestOutcomeSchema = z18.object({
3648
- action: z18.enum(["opened", "closed", "reopened"]),
3649
- pull_request: z18.object({
3650
- body: z18.string().nullable().optional(),
3651
- closed_at: z18.string().nullable().optional(),
3652
- created_at: z18.string(),
3653
- id: z18.number().int().positive(),
3654
- merged: z18.boolean(),
3655
- merged_at: z18.string().nullable().optional(),
3656
- number: z18.number().int().positive(),
3657
- title: z18.string().min(1).optional(),
3658
- updated_at: z18.string(),
3659
- user: z18.object({ login: z18.string().min(1) }).strict()
3778
+ import { z as z19 } from "zod";
3779
+ var canonicalPullRequestOutcomeSchema = z19.object({
3780
+ action: z19.enum(["opened", "closed", "reopened"]),
3781
+ pull_request: z19.object({
3782
+ body: z19.string().nullable().optional(),
3783
+ closed_at: z19.string().nullable().optional(),
3784
+ created_at: z19.string(),
3785
+ id: z19.number().int().positive(),
3786
+ merged: z19.boolean(),
3787
+ merged_at: z19.string().nullable().optional(),
3788
+ number: z19.number().int().positive(),
3789
+ title: z19.string().min(1).optional(),
3790
+ updated_at: z19.string(),
3791
+ user: z19.object({ login: z19.string().min(1) }).strict()
3660
3792
  }).strict(),
3661
- repository: z18.object({
3662
- full_name: z18.string().min(1),
3663
- id: z18.number().int().positive()
3793
+ repository: z19.object({
3794
+ full_name: z19.string().min(1),
3795
+ id: z19.number().int().positive()
3664
3796
  }).strict()
3665
3797
  }).strict();
3666
- var pullRequestOutcomeSchema = z18.object({
3667
- action: z18.enum(["opened", "closed", "reopened"]),
3668
- pull_request: z18.object({
3669
- body: z18.string().nullable().optional(),
3670
- closed_at: z18.string().nullable().optional(),
3671
- created_at: z18.string(),
3672
- id: z18.number().int().positive(),
3673
- merged: z18.boolean(),
3674
- merged_at: z18.string().nullable().optional(),
3675
- number: z18.number().int().positive(),
3676
- title: z18.string().min(1).optional(),
3677
- updated_at: z18.string(),
3678
- user: z18.object({ login: z18.string().min(1) }).passthrough()
3798
+ var pullRequestOutcomeSchema = z19.object({
3799
+ action: z19.enum(["opened", "closed", "reopened"]),
3800
+ pull_request: z19.object({
3801
+ body: z19.string().nullable().optional(),
3802
+ closed_at: z19.string().nullable().optional(),
3803
+ created_at: z19.string(),
3804
+ id: z19.number().int().positive(),
3805
+ merged: z19.boolean(),
3806
+ merged_at: z19.string().nullable().optional(),
3807
+ number: z19.number().int().positive(),
3808
+ title: z19.string().min(1).optional(),
3809
+ updated_at: z19.string(),
3810
+ user: z19.object({ login: z19.string().min(1) }).passthrough()
3679
3811
  }).passthrough(),
3680
- repository: z18.object({
3681
- full_name: z18.string().min(1),
3682
- id: z18.number().int().positive()
3812
+ repository: z19.object({
3813
+ full_name: z19.string().min(1),
3814
+ id: z19.number().int().positive()
3683
3815
  }).passthrough()
3684
3816
  }).passthrough().transform(
3685
3817
  (provider) => canonicalPullRequestOutcomeSchema.parse({
@@ -3702,24 +3834,24 @@ var pullRequestOutcomeSchema = z18.object({
3702
3834
  }
3703
3835
  })
3704
3836
  );
3705
- var pullRequestLifecycleActionSchema = z18.object({ action: z18.string() }).passthrough();
3706
- var canonicalPullRequestConversationSchema = z18.object({
3707
- pull_request: z18.object({
3708
- body: z18.string().nullable().optional(),
3709
- id: z18.number().int().positive(),
3710
- user: z18.object({ login: z18.string().min(1) }).strict()
3837
+ var pullRequestLifecycleActionSchema = z19.object({ action: z19.string() }).passthrough();
3838
+ var canonicalPullRequestConversationSchema = z19.object({
3839
+ pull_request: z19.object({
3840
+ body: z19.string().nullable().optional(),
3841
+ id: z19.number().int().positive(),
3842
+ user: z19.object({ login: z19.string().min(1) }).strict()
3711
3843
  }).strict(),
3712
- repository: z18.object({ full_name: z18.string().min(1) }).strict(),
3713
- sender: z18.object({ login: z18.string().min(1) }).strict()
3844
+ repository: z19.object({ full_name: z19.string().min(1) }).strict(),
3845
+ sender: z19.object({ login: z19.string().min(1) }).strict()
3714
3846
  }).strict();
3715
- var pullRequestConversationSchema = z18.object({
3716
- pull_request: z18.object({
3717
- body: z18.string().nullable().optional(),
3718
- id: z18.number().int().positive(),
3719
- user: z18.object({ login: z18.string().min(1) }).passthrough()
3847
+ var pullRequestConversationSchema = z19.object({
3848
+ pull_request: z19.object({
3849
+ body: z19.string().nullable().optional(),
3850
+ id: z19.number().int().positive(),
3851
+ user: z19.object({ login: z19.string().min(1) }).passthrough()
3720
3852
  }).passthrough(),
3721
- repository: z18.object({ full_name: z18.string().min(1) }).passthrough(),
3722
- sender: z18.object({ login: z18.string().min(1) }).passthrough()
3853
+ repository: z19.object({ full_name: z19.string().min(1) }).passthrough(),
3854
+ sender: z19.object({ login: z19.string().min(1) }).passthrough()
3723
3855
  }).passthrough().transform(
3724
3856
  (provider) => canonicalPullRequestConversationSchema.parse({
3725
3857
  pull_request: {
@@ -3806,20 +3938,20 @@ function normalizeGitHubPullRequestLinkedIssues(args) {
3806
3938
  }
3807
3939
 
3808
3940
  // src/webhooks/merge-conflict.ts
3809
- import { z as z19 } from "zod";
3941
+ import { z as z20 } from "zod";
3810
3942
  var EVENT_TYPE = "pull_request.merge_conflict";
3811
3943
  var CLOSED_EVENT_TYPES = /* @__PURE__ */ new Set([
3812
3944
  "pull_request.closed_unmerged",
3813
3945
  "pull_request.merged"
3814
3946
  ]);
3815
- var pullRequestSchema3 = z19.object({
3816
- base: z19.object({ ref: z19.string().min(1) }),
3817
- number: z19.number().int().positive().optional(),
3818
- head: z19.object({ sha: z19.string().min(1) }),
3819
- html_url: z19.string().min(1).optional(),
3820
- mergeable: z19.boolean().nullable().optional(),
3821
- mergeable_state: z19.string().optional(),
3822
- state: z19.string()
3947
+ var pullRequestSchema3 = z20.object({
3948
+ base: z20.object({ ref: z20.string().min(1) }),
3949
+ number: z20.number().int().positive().optional(),
3950
+ head: z20.object({ sha: z20.string().min(1) }),
3951
+ html_url: z20.string().min(1).optional(),
3952
+ mergeable: z20.boolean().nullable().optional(),
3953
+ mergeable_state: z20.string().optional(),
3954
+ state: z20.string()
3823
3955
  });
3824
3956
  function gitHubMergeConflictEvents(input) {
3825
3957
  const { conflict } = input;
@@ -3859,7 +3991,7 @@ async function hasMatch(hasMatchEvent, ref) {
3859
3991
  return false;
3860
3992
  }
3861
3993
  function deliveredPullRequest(payload, ref) {
3862
- const parsed = z19.object({ pull_request: pullRequestSchema3 }).safeParse(payload);
3994
+ const parsed = z20.object({ pull_request: pullRequestSchema3 }).safeParse(payload);
3863
3995
  const pullRequest = parsed.success ? parsed.data.pull_request : void 0;
3864
3996
  return pullRequest?.number === ref.number && typeof pullRequest.mergeable === "boolean" ? pullRequest : void 0;
3865
3997
  }
@@ -3897,10 +4029,10 @@ async function loadGitHubMergeConflictEvents(args) {
3897
4029
  }
3898
4030
 
3899
4031
  // src/webhooks/pull-request-ready.ts
3900
- import { z as z21 } from "zod";
4032
+ import { z as z22 } from "zod";
3901
4033
 
3902
4034
  // src/webhooks/installation-requests.ts
3903
- import { z as z20 } from "zod";
4035
+ import { z as z21 } from "zod";
3904
4036
  function splitRepository(fullName, label) {
3905
4037
  const [owner, name, ...extra] = fullName.split("/");
3906
4038
  if (!owner || !name || extra.length > 0) {
@@ -3961,9 +4093,9 @@ async function markPullRequestFeedbackReviewing(env, target) {
3961
4093
  }
3962
4094
  );
3963
4095
  }
3964
- var repositoryPermissionSchema = z20.object({
3965
- permission: z20.string().min(1),
3966
- role_name: z20.string().optional()
4096
+ var repositoryPermissionSchema = z21.object({
4097
+ permission: z21.string().min(1),
4098
+ role_name: z21.string().optional()
3967
4099
  });
3968
4100
  var REPOSITORY_ROLE_TTL_MS = 10 * 60 * 1e3;
3969
4101
  async function loadRepositoryRole(env, cache, target) {
@@ -3993,18 +4125,18 @@ async function loadRepositoryRole(env, cache, target) {
3993
4125
  }
3994
4126
  );
3995
4127
  }
3996
- var pullRequestSchema4 = z20.object({
3997
- draft: z20.boolean().optional(),
3998
- html_url: z20.string().url(),
3999
- mergeable_state: z20.string().nullable().optional(),
4000
- merged: z20.boolean(),
4001
- state: z20.enum(["open", "closed"]),
4002
- title: z20.string()
4128
+ var pullRequestSchema4 = z21.object({
4129
+ draft: z21.boolean().optional(),
4130
+ html_url: z21.string().url(),
4131
+ mergeable_state: z21.string().nullable().optional(),
4132
+ merged: z21.boolean(),
4133
+ state: z21.enum(["open", "closed"]),
4134
+ title: z21.string()
4003
4135
  });
4004
- var reviewsSchema = z20.array(
4005
- z20.object({
4006
- state: z20.string(),
4007
- user: z20.object({ login: z20.string() }).nullable()
4136
+ var reviewsSchema = z21.array(
4137
+ z21.object({
4138
+ state: z21.string(),
4139
+ user: z21.object({ login: z21.string() }).nullable()
4008
4140
  })
4009
4141
  );
4010
4142
  async function loadPullRequestMergeState(env, pullRequest) {
@@ -4069,10 +4201,10 @@ var READY_ACTIONS = {
4069
4201
  ]),
4070
4202
  pull_request_review: /* @__PURE__ */ new Set(["dismissed", "submitted"])
4071
4203
  };
4072
- var pullRequestWebhookSchema = z21.object({
4073
- action: z21.string(),
4074
- pull_request: z21.object({ number: z21.number().int().positive() }),
4075
- repository: z21.object({ full_name: z21.string().min(1) })
4204
+ var pullRequestWebhookSchema = z22.object({
4205
+ action: z22.string(),
4206
+ pull_request: z22.object({ number: z22.number().int().positive() }),
4207
+ repository: z22.object({ full_name: z22.string().min(1) })
4076
4208
  });
4077
4209
  function pullRequestReadyTargets(eventName, body) {
4078
4210
  if (eventName === "check_suite") return checkSuitePullRequests(body);
@@ -4167,7 +4299,7 @@ async function syncGitHubPullRequestReadyNotices(args) {
4167
4299
  }
4168
4300
 
4169
4301
  // src/webhooks/pull-request-match-data.ts
4170
- import { z as z22 } from "zod";
4302
+ import { z as z23 } from "zod";
4171
4303
  var LOOKUPS_BY_MATCH_KEY = {
4172
4304
  authors: ["authors"],
4173
4305
  openerEmail: ["opener"],
@@ -4175,16 +4307,16 @@ var LOOKUPS_BY_MATCH_KEY = {
4175
4307
  openerUsername: ["opener"]
4176
4308
  };
4177
4309
  var ALL_LOOKUPS = ["authors", "opener", "openerRole"];
4178
- var lookupDataSchema = z22.object({
4179
- authors: z22.array(z22.string().min(1)).min(1).optional(),
4180
- openerRole: z22.string().min(1).optional(),
4181
- openerUsername: z22.string().min(1).optional()
4310
+ var lookupDataSchema = z23.object({
4311
+ authors: z23.array(z23.string().min(1)).min(1).optional(),
4312
+ openerRole: z23.string().min(1).optional(),
4313
+ openerUsername: z23.string().min(1).optional()
4182
4314
  }).strict();
4183
4315
  function lookupData(input) {
4184
4316
  return lookupDataSchema.parse(definedValues(input));
4185
4317
  }
4186
- var webhookSchema = z22.object({
4187
- repository: z22.object({ full_name: z22.string().min(1) })
4318
+ var webhookSchema = z23.object({
4319
+ repository: z23.object({ full_name: z23.string().min(1) })
4188
4320
  });
4189
4321
  function pullRequestNumbers(events) {
4190
4322
  const numbers = /* @__PURE__ */ new Map();
@@ -4327,7 +4459,7 @@ async function withGitHubPullRequestMatchData(args) {
4327
4459
  }
4328
4460
 
4329
4461
  // src/webhooks/pull-request-people.ts
4330
- import { z as z23 } from "zod";
4462
+ import { z as z24 } from "zod";
4331
4463
  var PEOPLE_EVENTS = /* @__PURE__ */ new Set([
4332
4464
  "pull_request.review.approved",
4333
4465
  "pull_request.merged"
@@ -4337,18 +4469,18 @@ var PAGE_SIZE = 100;
4337
4469
  var MAX_PAGES = 3;
4338
4470
  var CO_AUTHOR_TRAILER = /^co-authored-by:[^<\n]*<([^>\s]+@[^>\s]+)>\s*$/gim;
4339
4471
  var GITHUB_NOREPLY_EMAIL = /^(?:\d+\+)?(?<login>[^@+]+)@users\.noreply\.github\.com$/i;
4340
- var webhookSchema2 = z23.object({
4341
- pull_request: z23.object({
4342
- assignees: z23.array(z23.object({ login: z23.string().min(1) })).nullish(),
4343
- number: z23.number(),
4344
- user: z23.object({ login: z23.string().min(1) }).nullish()
4472
+ var webhookSchema2 = z24.object({
4473
+ pull_request: z24.object({
4474
+ assignees: z24.array(z24.object({ login: z24.string().min(1) })).nullish(),
4475
+ number: z24.number(),
4476
+ user: z24.object({ login: z24.string().min(1) }).nullish()
4345
4477
  }),
4346
- repository: z23.object({ full_name: z23.string().min(1) })
4478
+ repository: z24.object({ full_name: z24.string().min(1) })
4347
4479
  });
4348
- var commitPageSchema = z23.array(
4349
- z23.object({
4350
- author: z23.object({ login: z23.string().min(1) }).nullish(),
4351
- commit: z23.object({ message: z23.string() })
4480
+ var commitPageSchema = z24.array(
4481
+ z24.object({
4482
+ author: z24.object({ login: z24.string().min(1) }).nullish(),
4483
+ commit: z24.object({ message: z24.string() })
4352
4484
  })
4353
4485
  );
4354
4486
  function shareCommitPages(load) {
@@ -4493,10 +4625,10 @@ function webhookInstallationId(body) {
4493
4625
  }
4494
4626
  return parseInstallationId(installation.id);
4495
4627
  }
4496
- var feedbackTargetSchema = z24.object({
4497
- commentId: z24.number(),
4498
- commentKind: z24.enum(["conversation", "review"]),
4499
- repo: z24.string().min(1)
4628
+ var feedbackTargetSchema = z25.object({
4629
+ commentId: z25.number(),
4630
+ commentKind: z25.enum(["conversation", "review"]),
4631
+ repo: z25.string().min(1)
4500
4632
  });
4501
4633
  function pullRequestFeedbackTarget(events) {
4502
4634
  const event = events.find(
@@ -4761,19 +4893,35 @@ function gitHubEventDeclarations(pullRequestGuidance) {
4761
4893
  return declarations;
4762
4894
  }
4763
4895
 
4896
+ // src/events/resource-url.ts
4897
+ function gitHubResourceUrl(input) {
4898
+ if (input.resourceType === "repository") {
4899
+ return `https://github.com/${input.identifier}`;
4900
+ }
4901
+ const [repo, number] = input.identifier.split("#");
4902
+ if (!repo || !number) return void 0;
4903
+ if (input.resourceType === "pull_request") {
4904
+ return `https://github.com/${repo}/pull/${number}`;
4905
+ }
4906
+ if (input.resourceType === "issue") {
4907
+ return `https://github.com/${repo}/issues/${number}`;
4908
+ }
4909
+ return void 0;
4910
+ }
4911
+
4764
4912
  // src/pull-request-outcomes/commit-composition.ts
4765
- import { z as z25 } from "zod";
4766
- var canonicalCommitSchema = z25.object({
4767
- authorEmail: z25.string().nullable(),
4768
- authorLogin: z25.string().nullable()
4913
+ import { z as z26 } from "zod";
4914
+ var canonicalCommitSchema = z26.object({
4915
+ authorEmail: z26.string().nullable(),
4916
+ authorLogin: z26.string().nullable()
4769
4917
  }).strict();
4770
- var providerCommitSchema = z25.object({
4771
- author: z25.object({ login: z25.string() }).passthrough().nullable(),
4772
- commit: z25.object({
4773
- author: z25.object({ email: z25.string() }).passthrough().nullable()
4918
+ var providerCommitSchema = z26.object({
4919
+ author: z26.object({ login: z26.string() }).passthrough().nullable(),
4920
+ commit: z26.object({
4921
+ author: z26.object({ email: z26.string() }).passthrough().nullable()
4774
4922
  }).passthrough()
4775
4923
  }).passthrough();
4776
- var commitPageSchema2 = z25.array(providerCommitSchema).transform(
4924
+ var commitPageSchema2 = z26.array(providerCommitSchema).transform(
4777
4925
  (commits) => commits.map(
4778
4926
  (commit) => canonicalCommitSchema.parse({
4779
4927
  authorEmail: commit.commit.author?.email ?? null,
@@ -6142,7 +6290,8 @@ function githubPlugin(options = {}) {
6142
6290
  gitHubPullRequestEventGuidance(options.pullRequestEvents?.guidance)
6143
6291
  ),
6144
6292
  isEnabled: () => Boolean(readEnv("GITHUB_WEBHOOK_SECRET")),
6145
- normalizeIdentifier: (identifier) => identifier.toLowerCase()
6293
+ normalizeIdentifier: (identifier) => identifier.toLowerCase(),
6294
+ resourceUrl: gitHubResourceUrl
6146
6295
  },
6147
6296
  manifest: {
6148
6297
  name: "github",