@sentry/junior-github 0.225.0 → 0.227.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
@@ -237,6 +237,50 @@ function createGitHubCloneRepositoryTool(ctx) {
237
237
  });
238
238
  }
239
239
 
240
+ // src/object-facts.ts
241
+ import { z as z2 } from "zod";
242
+ var person = z2.object({ login: z2.string() });
243
+ var responseSchema = z2.object({
244
+ user: person.nullable().optional(),
245
+ requested_reviewers: z2.array(person).optional(),
246
+ assignees: z2.array(person).optional(),
247
+ labels: z2.array(z2.union([z2.string(), z2.object({ name: z2.string() })])).optional(),
248
+ head: z2.object({ ref: z2.string() }).optional(),
249
+ base: z2.object({ ref: z2.string() }).optional(),
250
+ mergeable: z2.boolean().nullable().optional(),
251
+ changed_files: z2.number().int().nonnegative().optional(),
252
+ additions: z2.number().int().nonnegative().optional(),
253
+ deletions: z2.number().int().nonnegative().optional(),
254
+ updated_at: z2.iso.datetime({ offset: true }).optional()
255
+ });
256
+ var short = (value) => {
257
+ const text2 = value?.trim();
258
+ return text2 ? text2.length > 64 ? `${text2.slice(0, 63)}\u2026` : text2 : void 0;
259
+ };
260
+ function githubObjectFacts(type, response) {
261
+ const data = responseSchema.parse(response);
262
+ return {
263
+ sourceUpdatedAt: data.updated_at,
264
+ facts: type === "code_change" ? {
265
+ type,
266
+ author: short(data.user?.login),
267
+ reviewers: data.requested_reviewers?.slice(0, 5).map((user) => short(user.login)).filter(Boolean),
268
+ sourceBranch: short(data.head?.ref),
269
+ targetBranch: short(data.base?.ref),
270
+ mergeable: data.mergeable ?? void 0,
271
+ changedFiles: data.changed_files,
272
+ additions: data.additions,
273
+ deletions: data.deletions
274
+ } : {
275
+ type,
276
+ assignees: data.assignees?.slice(0, 5).map((user) => short(user.login)).filter(Boolean),
277
+ labels: data.labels?.slice(0, 5).map(
278
+ (label) => short(typeof label === "string" ? label : label.name)
279
+ ).filter(Boolean)
280
+ }
281
+ };
282
+ }
283
+
240
284
  // src/annotations.ts
241
285
  var STATUS_ICON = {
242
286
  warning: "triangle-alert",
@@ -288,7 +332,10 @@ function githubObjectAnnotation(input) {
288
332
  title: input.title.slice(0, 512),
289
333
  url: input.url,
290
334
  objectType: input.objectType,
291
- status: input.status
335
+ status: input.status,
336
+ displayType: input.objectType === "code_change" ? "Pull request" : "Issue",
337
+ facts: input.facts,
338
+ sourceUpdatedAt: input.sourceUpdatedAt
292
339
  };
293
340
  }
294
341
  async function updateGitHubAnnotation(store, input) {
@@ -317,6 +364,7 @@ async function updateGitHubAnnotation(store, input) {
317
364
 
318
365
  // src/tools/create-issue.ts
319
366
  import {
367
+ objectFactsSchema,
320
368
  definePluginTool as definePluginTool2,
321
369
  EgressAuthRequired,
322
370
  PluginToolInputError as PluginToolInputError3,
@@ -325,7 +373,7 @@ import {
325
373
  } from "@sentry/junior-plugin-api";
326
374
  import { Type } from "@sinclair/typebox";
327
375
  import { Value } from "@sinclair/typebox/value";
328
- import { z as z2 } from "zod";
376
+ import { z as z3 } from "zod";
329
377
 
330
378
  // src/tools/footer.ts
331
379
  import { PluginToolInputError as PluginToolInputError2 } from "@sentry/junior-plugin-api";
@@ -563,11 +611,11 @@ var createIssueInputSchema = Type.Object(
563
611
  },
564
612
  { additionalProperties: false }
565
613
  );
566
- var createIssueToolInputSchema = z2.object({
567
- repo: z2.string().describe('Repository in "owner/name" format.'),
568
- title: z2.string().describe("Issue title."),
569
- body: z2.string().describe("Issue body. The runtime appends the conversation footer.").optional(),
570
- labels: z2.array(z2.string()).describe("Labels to apply to the issue.").optional()
614
+ var createIssueToolInputSchema = z3.object({
615
+ repo: z3.string().describe('Repository in "owner/name" format.'),
616
+ title: z3.string().describe("Issue title."),
617
+ body: z3.string().describe("Issue body. The runtime appends the conversation footer.").optional(),
618
+ labels: z3.array(z3.string()).describe("Labels to apply to the issue.").optional()
571
619
  }).strict();
572
620
  var createIssueStateSchema = Type.Union([
573
621
  Type.Object(
@@ -575,6 +623,8 @@ var createIssueStateSchema = Type.Union([
575
623
  createdAtMs: Type.Number(),
576
624
  input: Type.Optional(createIssueInputSchema),
577
625
  number: Type.Number(),
626
+ facts: Type.Optional(Type.Unknown()),
627
+ sourceUpdatedAt: Type.Optional(Type.String()),
578
628
  status: Type.Literal("completed"),
579
629
  url: Type.String()
580
630
  },
@@ -589,14 +639,14 @@ var createIssueStateSchema = Type.Union([
589
639
  { additionalProperties: false }
590
640
  )
591
641
  ]);
592
- var gitHubIssueDataSchema = z2.object({
593
- number: z2.number(),
642
+ var gitHubIssueDataSchema = z3.object({
643
+ number: z3.number(),
594
644
  subscribable: subscribableResourceSchema.optional(),
595
- url: z2.string()
645
+ url: z3.string()
596
646
  });
597
647
  var gitHubIssueOutputSchema = pluginToolOutputSchema2.merge(
598
648
  gitHubIssueDataSchema.extend({
599
- target: z2.literal("createIssue")
649
+ target: z3.literal("createIssue")
600
650
  })
601
651
  );
602
652
  function gitHubIssueToolResult(input, result, canSubscribe) {
@@ -605,10 +655,16 @@ function gitHubIssueToolResult(input, result, canSubscribe) {
605
655
  number: result.number,
606
656
  repo: `${repo.owner}/${repo.name}`
607
657
  }) : void 0;
608
- const data = { ...result, ...subscribable ? { subscribable } : void 0 };
658
+ const data = {
659
+ number: result.number,
660
+ url: result.url,
661
+ ...subscribable ? { subscribable } : void 0
662
+ };
609
663
  return {
610
664
  objectAnnotations: [
611
665
  githubObjectAnnotation({
666
+ facts: result.facts,
667
+ sourceUpdatedAt: result.sourceUpdatedAt,
612
668
  repo: input.repo,
613
669
  number: result.number,
614
670
  title: input.title,
@@ -743,6 +799,7 @@ async function createGitHubIssue(ctx, request) {
743
799
  throw new Error("GitHub issue creation returned an invalid response.");
744
800
  }
745
801
  return {
802
+ ...githubObjectFacts("task", parsed),
746
803
  number: issue.number,
747
804
  url: issue.html_url
748
805
  };
@@ -774,6 +831,8 @@ function createGitHubIssueTool(ctx) {
774
831
  if (state?.status === "completed") {
775
832
  const completedInput = state.input ?? parsedInput;
776
833
  const completedResult = {
834
+ facts: state.facts === void 0 ? void 0 : objectFactsSchema.parse(state.facts),
835
+ sourceUpdatedAt: state.sourceUpdatedAt,
777
836
  number: state.number,
778
837
  url: state.url
779
838
  };
@@ -843,69 +902,69 @@ import {
843
902
  pluginToolOutputSchema as pluginToolOutputSchema3,
844
903
  subscribableResourceSchema as subscribableResourceSchema2
845
904
  } from "@sentry/junior-plugin-api";
846
- import { z as z3 } from "zod";
847
- var commitShaSchema = z3.string().regex(/^[0-9a-f]{40}$/i);
848
- var inputSchema2 = z3.object({
849
- repo: z3.string().describe('Repository in "owner/name" format.'),
905
+ import { z as z4 } from "zod";
906
+ var commitShaSchema = z4.string().regex(/^[0-9a-f]{40}$/i);
907
+ var inputSchema2 = z4.object({
908
+ repo: z4.string().describe('Repository in "owner/name" format.'),
850
909
  commitSha: commitShaSchema.describe(
851
910
  "Full 40-character Git commit SHA recorded by the deployment."
852
911
  ),
853
- environment: z3.string().trim().min(1).describe(
912
+ environment: z4.string().trim().min(1).describe(
854
913
  'Optional GitHub deployment environment, such as "Production". Omit to inspect and watch deployments for the commit across environments.'
855
914
  ).optional()
856
915
  }).strict();
857
- var statusSchema = z3.object({
858
- createdAt: z3.string(),
859
- creator: z3.string().nullable(),
860
- description: z3.string().nullable(),
861
- environmentUrl: z3.string().nullable(),
862
- id: z3.number(),
863
- logUrl: z3.string().nullable(),
864
- state: z3.string()
916
+ var statusSchema = z4.object({
917
+ createdAt: z4.string(),
918
+ creator: z4.string().nullable(),
919
+ description: z4.string().nullable(),
920
+ environmentUrl: z4.string().nullable(),
921
+ id: z4.number(),
922
+ logUrl: z4.string().nullable(),
923
+ state: z4.string()
865
924
  }).strict();
866
- var deploymentSchema = z3.object({
867
- createdAt: z3.string(),
868
- creator: z3.string().nullable(),
869
- description: z3.string().nullable(),
870
- environment: z3.string(),
871
- id: z3.number(),
925
+ var deploymentSchema = z4.object({
926
+ createdAt: z4.string(),
927
+ creator: z4.string().nullable(),
928
+ description: z4.string().nullable(),
929
+ environment: z4.string(),
930
+ id: z4.number(),
872
931
  latestStatus: statusSchema.nullable(),
873
- ref: z3.string(),
932
+ ref: z4.string(),
874
933
  sha: commitShaSchema,
875
- updatedAt: z3.string(),
876
- url: z3.string()
934
+ updatedAt: z4.string(),
935
+ url: z4.string()
877
936
  }).strict();
878
- var deploymentSourceSchema = z3.object({
937
+ var deploymentSourceSchema = z4.object({
879
938
  commitSha: commitShaSchema,
880
939
  deployment: deploymentSchema.nullable(),
881
- environment: z3.string().nullable(),
882
- repo: z3.string(),
940
+ environment: z4.string().nullable(),
941
+ repo: z4.string(),
883
942
  subscribable: subscribableResourceSchema2.optional()
884
943
  }).strict();
885
944
  var outputSchema2 = pluginToolOutputSchema3.merge(
886
945
  deploymentSourceSchema.extend({
887
- target: z3.literal("getDeployment")
946
+ target: z4.literal("getDeployment")
888
947
  })
889
948
  );
890
- var providerCreatorSchema = z3.object({ login: z3.string() }).passthrough().nullable();
891
- var providerDeploymentSchema = z3.object({
892
- created_at: z3.string(),
949
+ var providerCreatorSchema = z4.object({ login: z4.string() }).passthrough().nullable();
950
+ var providerDeploymentSchema = z4.object({
951
+ created_at: z4.string(),
893
952
  creator: providerCreatorSchema,
894
- description: z3.string().nullable(),
895
- environment: z3.string(),
896
- id: z3.number(),
897
- ref: z3.string(),
953
+ description: z4.string().nullable(),
954
+ environment: z4.string(),
955
+ id: z4.number(),
956
+ ref: z4.string(),
898
957
  sha: commitShaSchema,
899
- updated_at: z3.string()
958
+ updated_at: z4.string()
900
959
  }).passthrough();
901
- var providerStatusSchema = z3.object({
902
- created_at: z3.string(),
960
+ var providerStatusSchema = z4.object({
961
+ created_at: z4.string(),
903
962
  creator: providerCreatorSchema,
904
- description: z3.string().nullable().optional(),
905
- environment_url: z3.string().nullable().optional(),
906
- id: z3.number(),
907
- log_url: z3.string().nullable().optional(),
908
- state: z3.string()
963
+ description: z4.string().nullable().optional(),
964
+ environment_url: z4.string().nullable().optional(),
965
+ id: z4.number(),
966
+ log_url: z4.string().nullable().optional(),
967
+ state: z4.string()
909
968
  }).passthrough();
910
969
  function parseRepo3(value) {
911
970
  const parts = value.split("/").map((part) => part.trim());
@@ -972,7 +1031,7 @@ function createGitHubGetDeploymentTool(ctx) {
972
1031
  deploymentsBody
973
1032
  );
974
1033
  }
975
- const providerDeployment = z3.array(providerDeploymentSchema).parse(deploymentsBody)[0];
1034
+ const providerDeployment = z4.array(providerDeploymentSchema).parse(deploymentsBody)[0];
976
1035
  let deployment = null;
977
1036
  if (providerDeployment) {
978
1037
  const statusesResponse = await ctx.egress.fetch({
@@ -996,7 +1055,7 @@ function createGitHubGetDeploymentTool(ctx) {
996
1055
  statusesBody
997
1056
  );
998
1057
  }
999
- const providerStatus = z3.array(providerStatusSchema).parse(statusesBody)[0];
1058
+ const providerStatus = z4.array(providerStatusSchema).parse(statusesBody)[0];
1000
1059
  deployment = {
1001
1060
  createdAt: providerDeployment.created_at,
1002
1061
  creator: providerDeployment.creator?.login ?? null,
@@ -1040,6 +1099,7 @@ function createGitHubGetDeploymentTool(ctx) {
1040
1099
 
1041
1100
  // src/tools/create-pull-request.ts
1042
1101
  import {
1102
+ objectFactsSchema as objectFactsSchema2,
1043
1103
  definePluginTool as definePluginTool4,
1044
1104
  EgressAuthRequired as EgressAuthRequired2,
1045
1105
  PluginToolInputError as PluginToolInputError5,
@@ -1049,7 +1109,7 @@ import {
1049
1109
  } from "@sentry/junior-plugin-api";
1050
1110
  import { Type as Type2 } from "@sinclair/typebox";
1051
1111
  import { Value as Value2 } from "@sinclair/typebox/value";
1052
- import { z as z4 } from "zod";
1112
+ import { z as z5 } from "zod";
1053
1113
  var GITHUB_PULL_REQUEST_CREATE_IDEMPOTENCY_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
1054
1114
  var GITHUB_PULL_REQUEST_CREATE_LOCK_TTL_MS = 6e4;
1055
1115
  var GitHubPullRequestCreateRejectedError = class extends Error {
@@ -1087,15 +1147,15 @@ var createPullRequestInputSchema = Type2.Object(
1087
1147
  },
1088
1148
  { additionalProperties: false }
1089
1149
  );
1090
- var createPullRequestToolInputSchema = z4.object({
1091
- repo: z4.string().describe('Repository in "owner/name" format.'),
1092
- title: z4.string().describe("Pull request title."),
1093
- head: z4.string().describe("Head branch or owner:branch ref."),
1094
- base: z4.string().describe("Base branch."),
1095
- body: z4.string().describe(
1150
+ var createPullRequestToolInputSchema = z5.object({
1151
+ repo: z5.string().describe('Repository in "owner/name" format.'),
1152
+ title: z5.string().describe("Pull request title."),
1153
+ head: z5.string().describe("Head branch or owner:branch ref."),
1154
+ base: z5.string().describe("Base branch."),
1155
+ body: z5.string().describe(
1096
1156
  "Pull request body. The runtime appends the conversation footer."
1097
1157
  ).optional(),
1098
- draft: z4.boolean().describe("Whether to open the pull request as a draft.").optional()
1158
+ draft: z5.boolean().describe("Whether to open the pull request as a draft.").optional()
1099
1159
  }).strict();
1100
1160
  var createPullRequestStateSchema = Type2.Union([
1101
1161
  Type2.Object(
@@ -1103,6 +1163,8 @@ var createPullRequestStateSchema = Type2.Union([
1103
1163
  createdAtMs: Type2.Number(),
1104
1164
  input: Type2.Optional(createPullRequestInputSchema),
1105
1165
  number: Type2.Number(),
1166
+ facts: Type2.Optional(Type2.Unknown()),
1167
+ sourceUpdatedAt: Type2.Optional(Type2.String()),
1106
1168
  status: Type2.Literal("completed"),
1107
1169
  url: Type2.String()
1108
1170
  },
@@ -1117,15 +1179,15 @@ var createPullRequestStateSchema = Type2.Union([
1117
1179
  { additionalProperties: false }
1118
1180
  )
1119
1181
  ]);
1120
- var gitHubPullRequestDataSchema = z4.object({
1121
- number: z4.number(),
1122
- url: z4.string(),
1182
+ var gitHubPullRequestDataSchema = z5.object({
1183
+ number: z5.number(),
1184
+ url: z5.string(),
1123
1185
  subscribable: subscribableResourceSchema3.optional(),
1124
1186
  subscription: watchResultSchema.optional()
1125
1187
  });
1126
1188
  var gitHubPullRequestOutputSchema = pluginToolOutputSchema4.merge(
1127
1189
  gitHubPullRequestDataSchema.extend({
1128
- target: z4.literal("createPullRequest")
1190
+ target: z5.literal("createPullRequest")
1129
1191
  })
1130
1192
  );
1131
1193
  function parseCreatePullRequestInput(input) {
@@ -1272,6 +1334,7 @@ async function createGitHubPullRequest(ctx, request) {
1272
1334
  );
1273
1335
  }
1274
1336
  return {
1337
+ ...githubObjectFacts("code_change", parsed),
1275
1338
  number: pullRequest.number,
1276
1339
  url: pullRequest.html_url
1277
1340
  };
@@ -1283,7 +1346,11 @@ function gitHubPullRequestToolResult(input, result, canSubscribe, omitSuggestedE
1283
1346
  repo: `${repo.owner}/${repo.name}`,
1284
1347
  ...omitSuggestedEvents ? { omitSuggestedEvents } : void 0
1285
1348
  }) : void 0;
1286
- return { ...result, ...subscribable ? { subscribable } : void 0 };
1349
+ return {
1350
+ number: result.number,
1351
+ url: result.url,
1352
+ ...subscribable ? { subscribable } : void 0
1353
+ };
1287
1354
  }
1288
1355
  async function gitHubPullRequestStructuredResult(ctx, input, result, subscriptionConfig) {
1289
1356
  const base = gitHubPullRequestToolResult(
@@ -1293,6 +1360,8 @@ async function gitHubPullRequestStructuredResult(ctx, input, result, subscriptio
1293
1360
  );
1294
1361
  const objectAnnotations = [
1295
1362
  githubObjectAnnotation({
1363
+ facts: result.facts,
1364
+ sourceUpdatedAt: result.sourceUpdatedAt,
1296
1365
  repo: input.repo,
1297
1366
  number: result.number,
1298
1367
  title: input.title,
@@ -1367,6 +1436,8 @@ function createGitHubPullRequestTool(ctx, subscriptionConfig) {
1367
1436
  if (state?.status === "completed") {
1368
1437
  const completedInput = state.input ?? parsedInput;
1369
1438
  const completedResult = {
1439
+ facts: state.facts === void 0 ? void 0 : objectFactsSchema2.parse(state.facts),
1440
+ sourceUpdatedAt: state.sourceUpdatedAt,
1370
1441
  number: state.number,
1371
1442
  url: state.url
1372
1443
  };
@@ -1437,28 +1508,28 @@ import {
1437
1508
  PluginToolInputError as PluginToolInputError6,
1438
1509
  pluginToolOutputSchema as pluginToolOutputSchema5
1439
1510
  } from "@sentry/junior-plugin-api";
1440
- import { z as z5 } from "zod";
1511
+ import { z as z6 } from "zod";
1441
1512
  import { subscribableResourceSchema as subscribableResourceSchema4 } from "@sentry/junior-plugin-api";
1442
- var commitShaSchema2 = z5.string().regex(/^[0-9a-f]{40}$/i);
1443
- var inputSchema3 = z5.object({
1444
- repo: z5.string().describe('Repository in "owner/name" format.'),
1445
- number: z5.number().int().positive().describe("Pull request number.")
1513
+ var commitShaSchema2 = z6.string().regex(/^[0-9a-f]{40}$/i);
1514
+ var inputSchema3 = z6.object({
1515
+ repo: z6.string().describe('Repository in "owner/name" format.'),
1516
+ number: z6.number().int().positive().describe("Pull request number.")
1446
1517
  }).strict();
1447
- var pullRequestSchema = z5.object({
1448
- base: z5.string(),
1449
- draft: z5.boolean(),
1450
- head: z5.string(),
1518
+ var pullRequestSchema = z6.object({
1519
+ base: z6.string(),
1520
+ draft: z6.boolean(),
1521
+ head: z6.string(),
1451
1522
  headSha: commitShaSchema2,
1452
- merged: z5.boolean(),
1453
- number: z5.number(),
1454
- state: z5.string(),
1523
+ merged: z6.boolean(),
1524
+ number: z6.number(),
1525
+ state: z6.string(),
1455
1526
  subscribable: subscribableResourceSchema4.optional(),
1456
- title: z5.string(),
1457
- url: z5.string()
1527
+ title: z6.string(),
1528
+ url: z6.string()
1458
1529
  });
1459
1530
  var outputSchema3 = pluginToolOutputSchema5.merge(
1460
1531
  pullRequestSchema.extend({
1461
- target: z5.literal("getPullRequest")
1532
+ target: z6.literal("getPullRequest")
1462
1533
  })
1463
1534
  );
1464
1535
  function parseRepo5(value) {
@@ -1511,15 +1582,15 @@ function createGitHubGetPullRequestTool(ctx) {
1511
1582
  }
1512
1583
  throw new Error(message);
1513
1584
  }
1514
- const providerResult = z5.object({
1515
- base: z5.object({ ref: z5.string() }),
1516
- draft: z5.boolean(),
1517
- head: z5.object({ ref: z5.string(), sha: commitShaSchema2 }),
1518
- html_url: z5.string(),
1519
- merged: z5.boolean().optional().default(false),
1520
- number: z5.number(),
1521
- state: z5.string(),
1522
- title: z5.string()
1585
+ const providerResult = z6.object({
1586
+ base: z6.object({ ref: z6.string() }),
1587
+ draft: z6.boolean(),
1588
+ head: z6.object({ ref: z6.string(), sha: commitShaSchema2 }),
1589
+ html_url: z6.string(),
1590
+ merged: z6.boolean().optional().default(false),
1591
+ number: z6.number(),
1592
+ state: z6.string(),
1593
+ title: z6.string()
1523
1594
  }).parse(parsed);
1524
1595
  const subscribable = ctx.events.canSubscribe ? gitHubPullRequestSubscribable({
1525
1596
  number: providerResult.number,
@@ -1538,6 +1609,17 @@ function createGitHubGetPullRequestTool(ctx) {
1538
1609
  url: providerResult.html_url
1539
1610
  };
1540
1611
  return {
1612
+ objectAnnotations: [
1613
+ githubObjectAnnotation({
1614
+ repo: repo.ref,
1615
+ number: data.number,
1616
+ title: data.title,
1617
+ url: data.url,
1618
+ objectType: "code_change",
1619
+ status: data.merged ? "merged" : data.state === "open" && data.draft ? "draft" : data.state,
1620
+ ...githubObjectFacts("code_change", parsed)
1621
+ })
1622
+ ],
1541
1623
  target: "getPullRequest",
1542
1624
  ...data
1543
1625
  };
@@ -1552,45 +1634,45 @@ import {
1552
1634
  pluginToolOutputSchema as pluginToolOutputSchema6,
1553
1635
  subscribableResourceSchema as subscribableResourceSchema5
1554
1636
  } from "@sentry/junior-plugin-api";
1555
- import { z as z6 } from "zod";
1556
- var inputSchema4 = z6.object({
1557
- repo: z6.string().describe('Repository in "owner/name" format.'),
1558
- tag: z6.string().trim().min(1).describe(
1637
+ import { z as z7 } from "zod";
1638
+ var inputSchema4 = z7.object({
1639
+ repo: z7.string().describe('Repository in "owner/name" format.'),
1640
+ tag: z7.string().trim().min(1).describe(
1559
1641
  "Optional release tag name. Omit to inspect and watch every published release in the repository."
1560
1642
  ).optional()
1561
1643
  }).strict();
1562
- var releaseSchema = z6.object({
1563
- createdAt: z6.string(),
1564
- draft: z6.boolean(),
1565
- htmlUrl: z6.string(),
1566
- id: z6.number(),
1567
- name: z6.string().nullable(),
1568
- prerelease: z6.boolean(),
1569
- publishedAt: z6.string().nullable(),
1570
- tagName: z6.string(),
1571
- targetCommitish: z6.string()
1644
+ var releaseSchema = z7.object({
1645
+ createdAt: z7.string(),
1646
+ draft: z7.boolean(),
1647
+ htmlUrl: z7.string(),
1648
+ id: z7.number(),
1649
+ name: z7.string().nullable(),
1650
+ prerelease: z7.boolean(),
1651
+ publishedAt: z7.string().nullable(),
1652
+ tagName: z7.string(),
1653
+ targetCommitish: z7.string()
1572
1654
  }).strict();
1573
- var releaseSourceSchema = z6.object({
1655
+ var releaseSourceSchema = z7.object({
1574
1656
  release: releaseSchema.nullable(),
1575
- repo: z6.string(),
1657
+ repo: z7.string(),
1576
1658
  subscribable: subscribableResourceSchema5.optional(),
1577
- tag: z6.string().nullable()
1659
+ tag: z7.string().nullable()
1578
1660
  }).strict();
1579
1661
  var outputSchema4 = pluginToolOutputSchema6.merge(
1580
1662
  releaseSourceSchema.extend({
1581
- target: z6.literal("getRelease")
1663
+ target: z7.literal("getRelease")
1582
1664
  })
1583
1665
  );
1584
- var providerReleaseSchema = z6.object({
1585
- created_at: z6.string(),
1586
- draft: z6.boolean(),
1587
- html_url: z6.string(),
1588
- id: z6.number(),
1589
- name: z6.string().nullable(),
1590
- prerelease: z6.boolean(),
1591
- published_at: z6.string().nullable(),
1592
- tag_name: z6.string(),
1593
- target_commitish: z6.string()
1666
+ var providerReleaseSchema = z7.object({
1667
+ created_at: z7.string(),
1668
+ draft: z7.boolean(),
1669
+ html_url: z7.string(),
1670
+ id: z7.number(),
1671
+ name: z7.string().nullable(),
1672
+ prerelease: z7.boolean(),
1673
+ published_at: z7.string().nullable(),
1674
+ tag_name: z7.string(),
1675
+ target_commitish: z7.string()
1594
1676
  }).passthrough();
1595
1677
  function parseRepo6(value) {
1596
1678
  const parts = value.split("/").map((part) => part.trim());
@@ -1708,21 +1790,21 @@ import {
1708
1790
  pluginToolOutputSchema as pluginToolOutputSchema7,
1709
1791
  subscribableResourceSchema as subscribableResourceSchema6
1710
1792
  } from "@sentry/junior-plugin-api";
1711
- import { z as z7 } from "zod";
1712
- var inputSchema5 = z7.object({
1713
- repo: z7.string().describe('Repository in "owner/name" format.')
1793
+ import { z as z8 } from "zod";
1794
+ var inputSchema5 = z8.object({
1795
+ repo: z8.string().describe('Repository in "owner/name" format.')
1714
1796
  }).strict();
1715
- var repositorySchema = z7.object({
1716
- defaultBranch: z7.string(),
1717
- description: z7.string().nullable(),
1718
- fullName: z7.string(),
1719
- private: z7.boolean(),
1797
+ var repositorySchema = z8.object({
1798
+ defaultBranch: z8.string(),
1799
+ description: z8.string().nullable(),
1800
+ fullName: z8.string(),
1801
+ private: z8.boolean(),
1720
1802
  subscribable: subscribableResourceSchema6.optional(),
1721
- url: z7.string()
1803
+ url: z8.string()
1722
1804
  });
1723
1805
  var outputSchema5 = pluginToolOutputSchema7.merge(
1724
1806
  repositorySchema.extend({
1725
- target: z7.literal("getRepository")
1807
+ target: z8.literal("getRepository")
1726
1808
  })
1727
1809
  );
1728
1810
  function parseRepo7(value) {
@@ -1773,12 +1855,12 @@ function createGitHubGetRepositoryTool(ctx) {
1773
1855
  `GitHub repository lookup failed with HTTP ${response.status}`
1774
1856
  );
1775
1857
  }
1776
- const providerResult = z7.object({
1777
- default_branch: z7.string(),
1778
- description: z7.string().nullable(),
1779
- full_name: z7.string(),
1780
- html_url: z7.string(),
1781
- private: z7.boolean()
1858
+ const providerResult = z8.object({
1859
+ default_branch: z8.string(),
1860
+ description: z8.string().nullable(),
1861
+ full_name: z8.string(),
1862
+ html_url: z8.string(),
1863
+ private: z8.boolean()
1782
1864
  }).parse(parsed);
1783
1865
  const subscribable = ctx.events.canSubscribe ? gitHubRepositorySubscribable({
1784
1866
  repo: providerResult.full_name
@@ -1806,30 +1888,30 @@ import {
1806
1888
  pluginToolOutputSchema as pluginToolOutputSchema8,
1807
1889
  subscribableResourceSchema as subscribableResourceSchema7
1808
1890
  } from "@sentry/junior-plugin-api";
1809
- import { z as z8 } from "zod";
1810
- var inputSchema6 = z8.object({
1811
- repo: z8.string().describe('Repository in "owner/name" format.'),
1812
- number: z8.number().int().positive().describe("Issue number."),
1813
- title: z8.string().trim().min(1).optional().describe("Replacement issue title."),
1814
- body: z8.string().optional().describe(
1891
+ import { z as z9 } from "zod";
1892
+ var inputSchema6 = z9.object({
1893
+ repo: z9.string().describe('Repository in "owner/name" format.'),
1894
+ number: z9.number().int().positive().describe("Issue number."),
1895
+ title: z9.string().trim().min(1).optional().describe("Replacement issue title."),
1896
+ body: z9.string().optional().describe(
1815
1897
  "Replacement issue body. The runtime appends requester attribution and the conversation footer."
1816
1898
  ),
1817
- state: z8.enum(["open", "closed"]).optional().describe("Replacement issue state.")
1899
+ state: z9.enum(["open", "closed"]).optional().describe("Replacement issue state.")
1818
1900
  }).strict().refine(
1819
1901
  ({ title, body, state }) => title !== void 0 || body !== void 0 || state !== void 0,
1820
1902
  { message: "At least one issue field must be provided." }
1821
1903
  );
1822
- var issueSchema = z8.object({
1823
- body: z8.string().nullable(),
1824
- number: z8.number(),
1825
- state: z8.string(),
1904
+ var issueSchema = z9.object({
1905
+ body: z9.string().nullable(),
1906
+ number: z9.number(),
1907
+ state: z9.string(),
1826
1908
  subscribable: subscribableResourceSchema7.optional(),
1827
- title: z8.string(),
1828
- url: z8.string()
1909
+ title: z9.string(),
1910
+ url: z9.string()
1829
1911
  });
1830
1912
  var outputSchema6 = pluginToolOutputSchema8.merge(
1831
1913
  issueSchema.extend({
1832
- target: z8.literal("updateIssue")
1914
+ target: z9.literal("updateIssue")
1833
1915
  })
1834
1916
  );
1835
1917
  function nonEmptyString4(value, name) {
@@ -1913,12 +1995,12 @@ function createGitHubUpdateIssueTool(ctx) {
1913
1995
  `GitHub issue update failed with HTTP ${response.status}: ${githubApiErrorMessage3(parsed)}`
1914
1996
  );
1915
1997
  }
1916
- const providerResult = z8.object({
1917
- body: z8.string().nullable().optional().default(null),
1918
- html_url: z8.string(),
1919
- number: z8.number(),
1920
- state: z8.string(),
1921
- title: z8.string()
1998
+ const providerResult = z9.object({
1999
+ body: z9.string().nullable().optional().default(null),
2000
+ html_url: z9.string(),
2001
+ number: z9.number(),
2002
+ state: z9.string(),
2003
+ title: z9.string()
1922
2004
  }).parse(parsed);
1923
2005
  const subscribable = ctx.events.canSubscribe ? gitHubIssueSubscribable({
1924
2006
  number: providerResult.number,
@@ -1927,6 +2009,7 @@ function createGitHubUpdateIssueTool(ctx) {
1927
2009
  return {
1928
2010
  objectAnnotations: [
1929
2011
  githubObjectAnnotation({
2012
+ ...githubObjectFacts("task", parsed),
1930
2013
  repo: repo.ref,
1931
2014
  number: providerResult.number,
1932
2015
  title: providerResult.title,
@@ -1953,34 +2036,34 @@ import {
1953
2036
  PluginToolInputError as PluginToolInputError10,
1954
2037
  pluginToolOutputSchema as pluginToolOutputSchema9
1955
2038
  } from "@sentry/junior-plugin-api";
1956
- import { z as z9 } from "zod";
2039
+ import { z as z10 } from "zod";
1957
2040
  import { subscribableResourceSchema as subscribableResourceSchema8 } from "@sentry/junior-plugin-api";
1958
- var inputSchema7 = z9.object({
1959
- repo: z9.string().describe('Repository in "owner/name" format.'),
1960
- number: z9.number().int().positive().describe("Pull request number."),
1961
- title: z9.string().trim().min(1).optional().describe("Replacement pull request title."),
1962
- body: z9.string().optional().describe(
2041
+ var inputSchema7 = z10.object({
2042
+ repo: z10.string().describe('Repository in "owner/name" format.'),
2043
+ number: z10.number().int().positive().describe("Pull request number."),
2044
+ title: z10.string().trim().min(1).optional().describe("Replacement pull request title."),
2045
+ body: z10.string().optional().describe(
1963
2046
  "Replacement pull request body. The runtime appends requester attribution and the conversation footer."
1964
2047
  ),
1965
- base: z9.string().trim().min(1).optional().describe("Replacement base branch."),
1966
- state: z9.enum(["open", "closed"]).optional().describe("Replacement pull request state.")
2048
+ base: z10.string().trim().min(1).optional().describe("Replacement base branch."),
2049
+ state: z10.enum(["open", "closed"]).optional().describe("Replacement pull request state.")
1967
2050
  }).strict().refine(
1968
2051
  ({ title, body, base, state }) => title !== void 0 || body !== void 0 || base !== void 0 || state !== void 0,
1969
2052
  { message: "At least one pull request field must be provided." }
1970
2053
  );
1971
- var pullRequestSchema2 = z9.object({
1972
- base: z9.string(),
1973
- body: z9.string().nullable(),
1974
- draft: z9.boolean(),
1975
- number: z9.number(),
1976
- state: z9.string(),
2054
+ var pullRequestSchema2 = z10.object({
2055
+ base: z10.string(),
2056
+ body: z10.string().nullable(),
2057
+ draft: z10.boolean(),
2058
+ number: z10.number(),
2059
+ state: z10.string(),
1977
2060
  subscribable: subscribableResourceSchema8.optional(),
1978
- title: z9.string(),
1979
- url: z9.string()
2061
+ title: z10.string(),
2062
+ url: z10.string()
1980
2063
  });
1981
2064
  var outputSchema7 = pluginToolOutputSchema9.merge(
1982
2065
  pullRequestSchema2.extend({
1983
- target: z9.literal("updatePullRequest")
2066
+ target: z10.literal("updatePullRequest")
1984
2067
  })
1985
2068
  );
1986
2069
  function nonEmptyString5(value, name) {
@@ -2068,15 +2151,15 @@ function createGitHubUpdatePullRequestTool(ctx) {
2068
2151
  `GitHub pull request update failed with HTTP ${response.status}: ${githubApiErrorMessage4(parsed)}`
2069
2152
  );
2070
2153
  }
2071
- const providerResult = z9.object({
2072
- base: z9.object({ ref: z9.string() }),
2073
- body: z9.string().nullable().optional().default(null),
2074
- draft: z9.boolean(),
2075
- html_url: z9.string(),
2076
- merged: z9.boolean(),
2077
- number: z9.number(),
2078
- state: z9.string(),
2079
- title: z9.string()
2154
+ const providerResult = z10.object({
2155
+ base: z10.object({ ref: z10.string() }),
2156
+ body: z10.string().nullable().optional().default(null),
2157
+ draft: z10.boolean(),
2158
+ html_url: z10.string(),
2159
+ merged: z10.boolean(),
2160
+ number: z10.number(),
2161
+ state: z10.string(),
2162
+ title: z10.string()
2080
2163
  }).parse(parsed);
2081
2164
  const subscribable = ctx.events.canSubscribe ? gitHubPullRequestSubscribable({
2082
2165
  number: providerResult.number,
@@ -2095,6 +2178,7 @@ function createGitHubUpdatePullRequestTool(ctx) {
2095
2178
  return {
2096
2179
  objectAnnotations: [
2097
2180
  githubObjectAnnotation({
2181
+ ...githubObjectFacts("code_change", parsed),
2098
2182
  repo: repo.ref,
2099
2183
  number: providerResult.number,
2100
2184
  title: providerResult.title,
@@ -2116,7 +2200,7 @@ import {
2116
2200
  PluginToolInputError as PluginToolInputError11,
2117
2201
  pluginToolOutputSchema as pluginToolOutputSchema10
2118
2202
  } from "@sentry/junior-plugin-api";
2119
- import { z as z10 } from "zod";
2203
+ import { z as z11 } from "zod";
2120
2204
 
2121
2205
  // src/webhooks/ownership.ts
2122
2206
  var GITHUB_BOT_NOREPLY_EMAIL = /^(?<userId>[1-9]\d*)\+(?<login>[^@]+\[bot\])@users\.noreply\.github\.com$/i;
@@ -2144,24 +2228,24 @@ var STATUS_TO_REACTION_CONTENT = {
2144
2228
  var FEEDBACK_REACTION_CONTENTS = new Set(
2145
2229
  Object.values(STATUS_TO_REACTION_CONTENT)
2146
2230
  );
2147
- var inputSchema8 = z10.object({
2148
- repo: z10.string().describe('Repository in "owner/name" format.'),
2149
- commentKind: z10.enum(["conversation", "review"]).describe(
2231
+ var inputSchema8 = z11.object({
2232
+ repo: z11.string().describe('Repository in "owner/name" format.'),
2233
+ commentKind: z11.enum(["conversation", "review"]).describe(
2150
2234
  'Comment kind: "conversation" for a pull request conversation comment, "review" for an inline review comment.'
2151
2235
  ),
2152
- commentId: z10.number().int().positive().describe(
2236
+ commentId: z11.number().int().positive().describe(
2153
2237
  "GitHub comment id (conversation comment id or inline review comment id)."
2154
2238
  ),
2155
- status: z10.enum(["addressed", "declined"]).describe(
2239
+ status: z11.enum(["addressed", "declined"]).describe(
2156
2240
  "Feedback outcome. Maps to a reaction: addressed -> +1, declined -> -1."
2157
2241
  )
2158
2242
  }).strict();
2159
2243
  var outputSchema8 = pluginToolOutputSchema10.extend({
2160
- target: z10.literal("updatePullRequestFeedback"),
2161
- repo: z10.string(),
2162
- commentId: z10.number(),
2163
- status: z10.enum(["addressed", "declined"]),
2164
- reactionId: z10.number()
2244
+ target: z11.literal("updatePullRequestFeedback"),
2245
+ repo: z11.string(),
2246
+ commentId: z11.number(),
2247
+ status: z11.enum(["addressed", "declined"]),
2248
+ reactionId: z11.number()
2165
2249
  });
2166
2250
  function parseRepo10(value) {
2167
2251
  const parts = value.split("/").map((part) => part.trim());
@@ -2193,10 +2277,10 @@ function githubError(payload) {
2193
2277
  }
2194
2278
  return "GitHub request failed";
2195
2279
  }
2196
- var reactionSchema = z10.object({
2197
- id: z10.number(),
2198
- content: z10.string(),
2199
- user: z10.object({ id: z10.number() }).nullable()
2280
+ var reactionSchema = z11.object({
2281
+ id: z11.number(),
2282
+ content: z11.string(),
2283
+ user: z11.object({ id: z11.number() }).nullable()
2200
2284
  });
2201
2285
  function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
2202
2286
  return definePluginTool10({
@@ -2244,7 +2328,7 @@ function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
2244
2328
  `GitHub reaction lookup failed with HTTP ${listResponse.status}: ${githubError(listPayload)}`
2245
2329
  );
2246
2330
  }
2247
- const botReactions = z10.array(reactionSchema).parse(listPayload).filter(
2331
+ const botReactions = z11.array(reactionSchema).parse(listPayload).filter(
2248
2332
  (reaction) => reaction.user?.id === botUserId && FEEDBACK_REACTION_CONTENTS.has(reaction.content)
2249
2333
  );
2250
2334
  const existing = botReactions.find(
@@ -2311,21 +2395,21 @@ import {
2311
2395
  PluginToolInputError as PluginToolInputError12,
2312
2396
  pluginToolOutputSchema as pluginToolOutputSchema11
2313
2397
  } from "@sentry/junior-plugin-api";
2314
- import { z as z11 } from "zod";
2315
- var inputSchema9 = z11.object({
2316
- repo: z11.string().describe(
2398
+ import { z as z12 } from "zod";
2399
+ var inputSchema9 = z12.object({
2400
+ repo: z12.string().describe(
2317
2401
  'Repository in "owner/name" format. Required because GraphQL has no repo path.'
2318
2402
  ),
2319
- threadId: z11.string().trim().min(1).describe(
2403
+ threadId: z12.string().trim().min(1).describe(
2320
2404
  "GitHub pull request review thread node ID (the same `threadId` / `id` variable used by `gh api graphql` resolveReviewThread)."
2321
2405
  )
2322
2406
  }).strict();
2323
2407
  var outputSchema9 = pluginToolOutputSchema11.extend({
2324
- target: z11.literal("resolvePullRequestReviewThread"),
2325
- repo: z11.string(),
2326
- number: z11.number(),
2327
- threadId: z11.string(),
2328
- resolved: z11.boolean()
2408
+ target: z12.literal("resolvePullRequestReviewThread"),
2409
+ repo: z12.string(),
2410
+ number: z12.number(),
2411
+ threadId: z12.string(),
2412
+ resolved: z12.boolean()
2329
2413
  });
2330
2414
  function parseRepo11(value) {
2331
2415
  const parts = value.split("/").map((part) => part.trim());
@@ -2407,18 +2491,18 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
2407
2491
  `GitHub review thread lookup failed with HTTP ${lookupResponse.status}: ${githubError2(lookupPayload)}`
2408
2492
  );
2409
2493
  }
2410
- const threadNodeSchema = z11.object({
2411
- id: z11.string(),
2412
- isResolved: z11.boolean(),
2413
- pullRequest: z11.object({
2414
- author: z11.object({ databaseId: z11.number().optional() }).passthrough().nullable(),
2415
- number: z11.number(),
2416
- repository: z11.object({ nameWithOwner: z11.string() }).passthrough()
2494
+ const threadNodeSchema = z12.object({
2495
+ id: z12.string(),
2496
+ isResolved: z12.boolean(),
2497
+ pullRequest: z12.object({
2498
+ author: z12.object({ databaseId: z12.number().optional() }).passthrough().nullable(),
2499
+ number: z12.number(),
2500
+ repository: z12.object({ nameWithOwner: z12.string() }).passthrough()
2417
2501
  }).passthrough()
2418
2502
  }).passthrough();
2419
- const lookupResultSchema = z11.object({
2420
- data: z11.object({
2421
- node: z11.unknown().nullable().optional()
2503
+ const lookupResultSchema = z12.object({
2504
+ data: z12.object({
2505
+ node: z12.unknown().nullable().optional()
2422
2506
  }).passthrough()
2423
2507
  }).passthrough();
2424
2508
  const lookupResult = lookupResultSchema.safeParse(lookupPayload);
@@ -2468,10 +2552,10 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
2468
2552
  `GitHub review thread resolution failed with HTTP ${resolveResponse.status}: ${githubError2(resolvePayload)}`
2469
2553
  );
2470
2554
  }
2471
- const resolveResultSchema = z11.object({
2472
- data: z11.object({
2473
- resolveReviewThread: z11.object({
2474
- thread: z11.object({ id: z11.string(), isResolved: z11.boolean() }).passthrough()
2555
+ const resolveResultSchema = z12.object({
2556
+ data: z12.object({
2557
+ resolveReviewThread: z12.object({
2558
+ thread: z12.object({ id: z12.string(), isResolved: z12.boolean() }).passthrough()
2475
2559
  }).passthrough()
2476
2560
  }).passthrough()
2477
2561
  }).passthrough();
@@ -2503,32 +2587,32 @@ import {
2503
2587
  PluginToolInputError as PluginToolInputError13,
2504
2588
  pluginToolOutputSchema as pluginToolOutputSchema12
2505
2589
  } from "@sentry/junior-plugin-api";
2506
- import { z as z12 } from "zod";
2507
- var reviewCommentSchema = z12.object({
2508
- path: z12.string().trim().min(1).describe("File path in the pull request."),
2509
- body: z12.string().trim().min(1).describe("Inline review comment."),
2510
- line: z12.number().int().positive().describe("Line in the pull request diff."),
2511
- side: z12.enum(["LEFT", "RIGHT"]).describe("Side of the pull request diff."),
2512
- startLine: z12.number().int().positive().optional().describe("First line of a multi-line comment."),
2513
- startSide: z12.enum(["LEFT", "RIGHT"]).optional().describe("First side of a multi-line comment.")
2590
+ import { z as z13 } from "zod";
2591
+ var reviewCommentSchema = z13.object({
2592
+ path: z13.string().trim().min(1).describe("File path in the pull request."),
2593
+ body: z13.string().trim().min(1).describe("Inline review comment."),
2594
+ line: z13.number().int().positive().describe("Line in the pull request diff."),
2595
+ side: z13.enum(["LEFT", "RIGHT"]).describe("Side of the pull request diff."),
2596
+ startLine: z13.number().int().positive().optional().describe("First line of a multi-line comment."),
2597
+ startSide: z13.enum(["LEFT", "RIGHT"]).optional().describe("First side of a multi-line comment.")
2514
2598
  }).strict().refine(
2515
2599
  ({ startLine, startSide }) => startLine === void 0 === (startSide === void 0),
2516
2600
  { message: "startLine and startSide must be provided together." }
2517
2601
  );
2518
- var inputSchema10 = z12.object({
2519
- repo: z12.string().describe('Repository in "owner/name" format.'),
2520
- number: z12.number().int().positive().describe("Pull request number."),
2521
- event: z12.enum(["COMMENT", "REQUEST_CHANGES"]).describe("Review result. Junior cannot approve pull requests."),
2522
- body: z12.string().trim().min(1).describe("Review summary."),
2523
- comments: z12.array(reviewCommentSchema).optional().describe("Optional inline review comments.")
2602
+ var inputSchema10 = z13.object({
2603
+ repo: z13.string().describe('Repository in "owner/name" format.'),
2604
+ number: z13.number().int().positive().describe("Pull request number."),
2605
+ event: z13.enum(["COMMENT", "REQUEST_CHANGES"]).describe("Review result. Junior cannot approve pull requests."),
2606
+ body: z13.string().trim().min(1).describe("Review summary."),
2607
+ comments: z13.array(reviewCommentSchema).optional().describe("Optional inline review comments.")
2524
2608
  }).strict();
2525
2609
  var outputSchema10 = pluginToolOutputSchema12.extend({
2526
- target: z12.literal("submitPullRequestReview"),
2527
- repo: z12.string(),
2528
- number: z12.number(),
2529
- reviewId: z12.number(),
2530
- state: z12.string(),
2531
- url: z12.string()
2610
+ target: z13.literal("submitPullRequestReview"),
2611
+ repo: z13.string(),
2612
+ number: z13.number(),
2613
+ reviewId: z13.number(),
2614
+ state: z13.string(),
2615
+ url: z13.string()
2532
2616
  });
2533
2617
  function parseRepo12(value) {
2534
2618
  const parts = value.split("/").map((part) => part.trim());
@@ -2607,7 +2691,7 @@ function createGitHubSubmitPullRequestReviewTool(egress) {
2607
2691
  if (!response.ok) {
2608
2692
  throwReviewError(response.status, parsed);
2609
2693
  }
2610
- const providerResult = z12.object({ id: z12.number(), html_url: z12.string(), state: z12.string() }).parse(parsed);
2694
+ const providerResult = z13.object({ id: z13.number(), html_url: z13.string(), state: z13.string() }).parse(parsed);
2611
2695
  return {
2612
2696
  target: "submitPullRequestReview",
2613
2697
  repo: repo.ref,
@@ -2651,7 +2735,7 @@ import { createHmac, timingSafeEqual } from "crypto";
2651
2735
 
2652
2736
  // src/issue-outcomes/store.ts
2653
2737
  import { and, eq, lte, sql as sql2 } from "drizzle-orm";
2654
- import { z as z14 } from "zod";
2738
+ import { z as z15 } from "zod";
2655
2739
 
2656
2740
  // src/db/schema.ts
2657
2741
  import { sql } from "drizzle-orm";
@@ -2663,18 +2747,18 @@ import {
2663
2747
  text,
2664
2748
  timestamp
2665
2749
  } from "drizzle-orm/pg-core";
2666
- import { z as z13 } from "zod";
2667
- var githubPullRequestStateSchema = z13.enum([
2750
+ import { z as z14 } from "zod";
2751
+ var githubPullRequestStateSchema = z14.enum([
2668
2752
  "closed_unmerged",
2669
2753
  "merged",
2670
2754
  "open"
2671
2755
  ]);
2672
- var githubPullRequestCommitCompositionSchema = z13.enum([
2756
+ var githubPullRequestCommitCompositionSchema = z14.enum([
2673
2757
  "junior_only",
2674
2758
  "mixed"
2675
2759
  ]);
2676
- var githubIssueStateSchema = z13.enum(["closed", "open"]);
2677
- var githubIssueStateReasonSchema = z13.enum([
2760
+ var githubIssueStateSchema = z14.enum(["closed", "open"]);
2761
+ var githubIssueStateReasonSchema = z14.enum([
2678
2762
  "completed",
2679
2763
  "duplicate",
2680
2764
  "not_planned",
@@ -2744,21 +2828,21 @@ var juniorGitHubPullRequestIssues = pgTable(
2744
2828
  );
2745
2829
 
2746
2830
  // src/issue-outcomes/store.ts
2747
- var githubIssueOutcomeInputSchema = z14.object({
2748
- candidateOwned: z14.boolean(),
2749
- closedAt: z14.date().optional(),
2750
- issueId: z14.string().min(1),
2751
- number: z14.number().int().positive(),
2752
- openedAt: z14.date(),
2753
- repositoryFullName: z14.string().min(1),
2754
- repositoryId: z14.string().min(1),
2831
+ var githubIssueOutcomeInputSchema = z15.object({
2832
+ candidateOwned: z15.boolean(),
2833
+ closedAt: z15.date().optional(),
2834
+ issueId: z15.string().min(1),
2835
+ number: z15.number().int().positive(),
2836
+ openedAt: z15.date(),
2837
+ repositoryFullName: z15.string().min(1),
2838
+ repositoryId: z15.string().min(1),
2755
2839
  state: githubIssueStateSchema,
2756
2840
  stateReason: githubIssueStateReasonSchema.optional(),
2757
- updatedAt: z14.date()
2841
+ updatedAt: z15.date()
2758
2842
  }).strict();
2759
- var githubIssueConversationsInputSchema = z14.object({
2760
- conversationIds: z14.array(z14.string().min(1)).min(1),
2761
- issueId: z14.string().min(1)
2843
+ var githubIssueConversationsInputSchema = z15.object({
2844
+ conversationIds: z15.array(z15.string().min(1)).min(1),
2845
+ issueId: z15.string().min(1)
2762
2846
  }).strict();
2763
2847
  function projectionValues(input) {
2764
2848
  return {
@@ -2822,33 +2906,33 @@ async function recordGitHubIssueConversations(db, input) {
2822
2906
 
2823
2907
  // src/pull-request-outcomes/store.ts
2824
2908
  import { and as and2, eq as eq2, lte as lte2, ne, sql as sql3 } from "drizzle-orm";
2825
- import { z as z15 } from "zod";
2826
- var githubPullRequestOutcomeInputSchema = z15.object({
2827
- candidateOwned: z15.boolean(),
2828
- closedAt: z15.date().optional(),
2909
+ import { z as z16 } from "zod";
2910
+ var githubPullRequestOutcomeInputSchema = z16.object({
2911
+ candidateOwned: z16.boolean(),
2912
+ closedAt: z16.date().optional(),
2829
2913
  commitComposition: githubPullRequestCommitCompositionSchema.optional(),
2830
- mergedAt: z15.date().optional(),
2831
- number: z15.number().int().positive(),
2832
- openedAt: z15.date(),
2833
- pullRequestId: z15.string().min(1),
2834
- repositoryFullName: z15.string().min(1),
2835
- repositoryId: z15.string().min(1),
2914
+ mergedAt: z16.date().optional(),
2915
+ number: z16.number().int().positive(),
2916
+ openedAt: z16.date(),
2917
+ pullRequestId: z16.string().min(1),
2918
+ repositoryFullName: z16.string().min(1),
2919
+ repositoryId: z16.string().min(1),
2836
2920
  state: githubPullRequestStateSchema,
2837
- title: z15.string().min(1).optional(),
2838
- updatedAt: z15.date()
2921
+ title: z16.string().min(1).optional(),
2922
+ updatedAt: z16.date()
2839
2923
  }).strict();
2840
- var githubPullRequestConversationsInputSchema = z15.object({
2841
- conversationIds: z15.array(z15.string().min(1)).min(1),
2842
- pullRequestId: z15.string().min(1)
2924
+ var githubPullRequestConversationsInputSchema = z16.object({
2925
+ conversationIds: z16.array(z16.string().min(1)).min(1),
2926
+ pullRequestId: z16.string().min(1)
2843
2927
  }).strict();
2844
- var githubPullRequestLinkedIssuesInputSchema = z15.object({
2845
- linkedIssues: z15.array(
2846
- z15.object({
2847
- number: z15.number().int().positive(),
2848
- repositoryFullName: z15.string().min(1)
2928
+ var githubPullRequestLinkedIssuesInputSchema = z16.object({
2929
+ linkedIssues: z16.array(
2930
+ z16.object({
2931
+ number: z16.number().int().positive(),
2932
+ repositoryFullName: z16.string().min(1)
2849
2933
  }).strict()
2850
2934
  ).min(1),
2851
- pullRequestId: z15.string().min(1)
2935
+ pullRequestId: z16.string().min(1)
2852
2936
  }).strict();
2853
2937
  function projectionValues2(input) {
2854
2938
  return {
@@ -3013,39 +3097,39 @@ async function recordGitHubPullRequestLinkedIssues(db, input) {
3013
3097
  }
3014
3098
 
3015
3099
  // src/webhooks/issue-outcome.ts
3016
- import { z as z16 } from "zod";
3017
- var canonicalIssueOutcomeSchema = z16.object({
3018
- action: z16.enum(["opened", "closed", "reopened"]),
3019
- issue: z16.object({
3020
- body: z16.string().nullable().optional(),
3021
- closed_at: z16.string().nullable().optional(),
3022
- created_at: z16.string(),
3023
- id: z16.number().int().positive(),
3024
- number: z16.number().int().positive(),
3100
+ import { z as z17 } from "zod";
3101
+ var canonicalIssueOutcomeSchema = z17.object({
3102
+ action: z17.enum(["opened", "closed", "reopened"]),
3103
+ issue: z17.object({
3104
+ body: z17.string().nullable().optional(),
3105
+ closed_at: z17.string().nullable().optional(),
3106
+ created_at: z17.string(),
3107
+ id: z17.number().int().positive(),
3108
+ number: z17.number().int().positive(),
3025
3109
  state_reason: githubIssueStateReasonSchema.nullable().optional(),
3026
- updated_at: z16.string(),
3027
- user: z16.object({ login: z16.string().min(1) }).strict()
3110
+ updated_at: z17.string(),
3111
+ user: z17.object({ login: z17.string().min(1) }).strict()
3028
3112
  }).strict(),
3029
- repository: z16.object({
3030
- full_name: z16.string().min(1),
3031
- id: z16.number().int().positive()
3113
+ repository: z17.object({
3114
+ full_name: z17.string().min(1),
3115
+ id: z17.number().int().positive()
3032
3116
  }).strict()
3033
3117
  }).strict();
3034
- var issueOutcomeSchema = z16.object({
3035
- action: z16.enum(["opened", "closed", "reopened"]),
3036
- issue: z16.object({
3037
- body: z16.string().nullable().optional(),
3038
- closed_at: z16.string().nullable().optional(),
3039
- created_at: z16.string(),
3040
- id: z16.number().int().positive(),
3041
- number: z16.number().int().positive(),
3118
+ var issueOutcomeSchema = z17.object({
3119
+ action: z17.enum(["opened", "closed", "reopened"]),
3120
+ issue: z17.object({
3121
+ body: z17.string().nullable().optional(),
3122
+ closed_at: z17.string().nullable().optional(),
3123
+ created_at: z17.string(),
3124
+ id: z17.number().int().positive(),
3125
+ number: z17.number().int().positive(),
3042
3126
  state_reason: githubIssueStateReasonSchema.nullable().optional(),
3043
- updated_at: z16.string(),
3044
- user: z16.object({ login: z16.string().min(1) }).passthrough()
3127
+ updated_at: z17.string(),
3128
+ user: z17.object({ login: z17.string().min(1) }).passthrough()
3045
3129
  }).passthrough(),
3046
- repository: z16.object({
3047
- full_name: z16.string().min(1),
3048
- id: z16.number().int().positive()
3130
+ repository: z17.object({
3131
+ full_name: z17.string().min(1),
3132
+ id: z17.number().int().positive()
3049
3133
  }).passthrough()
3050
3134
  }).passthrough().transform(
3051
3135
  (provider) => canonicalIssueOutcomeSchema.parse({
@@ -3066,7 +3150,7 @@ var issueOutcomeSchema = z16.object({
3066
3150
  }
3067
3151
  })
3068
3152
  );
3069
- var issueLifecycleActionSchema = z16.object({ action: z16.string() }).passthrough();
3153
+ var issueLifecycleActionSchema = z17.object({ action: z17.string() }).passthrough();
3070
3154
  function timestamp2(value) {
3071
3155
  if (!value) return void 0;
3072
3156
  const parsed = new Date(value);
@@ -3112,21 +3196,21 @@ function normalizeGitHubIssueOutcome(args) {
3112
3196
  updatedAt
3113
3197
  };
3114
3198
  }
3115
- var canonicalIssueConversationSchema = z16.object({
3116
- issue: z16.object({
3117
- body: z16.string().nullable().optional(),
3118
- id: z16.number().int().positive(),
3119
- user: z16.object({ login: z16.string().min(1) }).strict()
3199
+ var canonicalIssueConversationSchema = z17.object({
3200
+ issue: z17.object({
3201
+ body: z17.string().nullable().optional(),
3202
+ id: z17.number().int().positive(),
3203
+ user: z17.object({ login: z17.string().min(1) }).strict()
3120
3204
  }).strict(),
3121
- sender: z16.object({ login: z16.string().min(1) }).strict().optional()
3205
+ sender: z17.object({ login: z17.string().min(1) }).strict().optional()
3122
3206
  }).strict();
3123
- var issueConversationSchema = z16.object({
3124
- issue: z16.object({
3125
- body: z16.string().nullable().optional(),
3126
- id: z16.number().int().positive(),
3127
- user: z16.object({ login: z16.string().min(1) }).passthrough()
3207
+ var issueConversationSchema = z17.object({
3208
+ issue: z17.object({
3209
+ body: z17.string().nullable().optional(),
3210
+ id: z17.number().int().positive(),
3211
+ user: z17.object({ login: z17.string().min(1) }).passthrough()
3128
3212
  }).passthrough(),
3129
- sender: z16.object({ login: z16.string().min(1) }).passthrough().optional()
3213
+ sender: z17.object({ login: z17.string().min(1) }).passthrough().optional()
3130
3214
  }).passthrough().transform(
3131
3215
  (provider) => canonicalIssueConversationSchema.parse({
3132
3216
  issue: {
@@ -3153,43 +3237,43 @@ function normalizeGitHubIssueConversations(args) {
3153
3237
  }
3154
3238
 
3155
3239
  // src/webhooks/pull-request-outcome.ts
3156
- import { z as z17 } from "zod";
3157
- var canonicalPullRequestOutcomeSchema = z17.object({
3158
- action: z17.enum(["opened", "closed", "reopened"]),
3159
- pull_request: z17.object({
3160
- body: z17.string().nullable().optional(),
3161
- closed_at: z17.string().nullable().optional(),
3162
- created_at: z17.string(),
3163
- id: z17.number().int().positive(),
3164
- merged: z17.boolean(),
3165
- merged_at: z17.string().nullable().optional(),
3166
- number: z17.number().int().positive(),
3167
- title: z17.string().min(1).optional(),
3168
- updated_at: z17.string(),
3169
- user: z17.object({ login: z17.string().min(1) }).strict()
3240
+ import { z as z18 } from "zod";
3241
+ var canonicalPullRequestOutcomeSchema = z18.object({
3242
+ action: z18.enum(["opened", "closed", "reopened"]),
3243
+ pull_request: z18.object({
3244
+ body: z18.string().nullable().optional(),
3245
+ closed_at: z18.string().nullable().optional(),
3246
+ created_at: z18.string(),
3247
+ id: z18.number().int().positive(),
3248
+ merged: z18.boolean(),
3249
+ merged_at: z18.string().nullable().optional(),
3250
+ number: z18.number().int().positive(),
3251
+ title: z18.string().min(1).optional(),
3252
+ updated_at: z18.string(),
3253
+ user: z18.object({ login: z18.string().min(1) }).strict()
3170
3254
  }).strict(),
3171
- repository: z17.object({
3172
- full_name: z17.string().min(1),
3173
- id: z17.number().int().positive()
3255
+ repository: z18.object({
3256
+ full_name: z18.string().min(1),
3257
+ id: z18.number().int().positive()
3174
3258
  }).strict()
3175
3259
  }).strict();
3176
- var pullRequestOutcomeSchema = z17.object({
3177
- action: z17.enum(["opened", "closed", "reopened"]),
3178
- pull_request: z17.object({
3179
- body: z17.string().nullable().optional(),
3180
- closed_at: z17.string().nullable().optional(),
3181
- created_at: z17.string(),
3182
- id: z17.number().int().positive(),
3183
- merged: z17.boolean(),
3184
- merged_at: z17.string().nullable().optional(),
3185
- number: z17.number().int().positive(),
3186
- title: z17.string().min(1).optional(),
3187
- updated_at: z17.string(),
3188
- user: z17.object({ login: z17.string().min(1) }).passthrough()
3260
+ var pullRequestOutcomeSchema = z18.object({
3261
+ action: z18.enum(["opened", "closed", "reopened"]),
3262
+ pull_request: z18.object({
3263
+ body: z18.string().nullable().optional(),
3264
+ closed_at: z18.string().nullable().optional(),
3265
+ created_at: z18.string(),
3266
+ id: z18.number().int().positive(),
3267
+ merged: z18.boolean(),
3268
+ merged_at: z18.string().nullable().optional(),
3269
+ number: z18.number().int().positive(),
3270
+ title: z18.string().min(1).optional(),
3271
+ updated_at: z18.string(),
3272
+ user: z18.object({ login: z18.string().min(1) }).passthrough()
3189
3273
  }).passthrough(),
3190
- repository: z17.object({
3191
- full_name: z17.string().min(1),
3192
- id: z17.number().int().positive()
3274
+ repository: z18.object({
3275
+ full_name: z18.string().min(1),
3276
+ id: z18.number().int().positive()
3193
3277
  }).passthrough()
3194
3278
  }).passthrough().transform(
3195
3279
  (provider) => canonicalPullRequestOutcomeSchema.parse({
@@ -3212,24 +3296,24 @@ var pullRequestOutcomeSchema = z17.object({
3212
3296
  }
3213
3297
  })
3214
3298
  );
3215
- var pullRequestLifecycleActionSchema = z17.object({ action: z17.string() }).passthrough();
3216
- var canonicalPullRequestConversationSchema = z17.object({
3217
- pull_request: z17.object({
3218
- body: z17.string().nullable().optional(),
3219
- id: z17.number().int().positive(),
3220
- user: z17.object({ login: z17.string().min(1) }).strict()
3299
+ var pullRequestLifecycleActionSchema = z18.object({ action: z18.string() }).passthrough();
3300
+ var canonicalPullRequestConversationSchema = z18.object({
3301
+ pull_request: z18.object({
3302
+ body: z18.string().nullable().optional(),
3303
+ id: z18.number().int().positive(),
3304
+ user: z18.object({ login: z18.string().min(1) }).strict()
3221
3305
  }).strict(),
3222
- repository: z17.object({ full_name: z17.string().min(1) }).strict(),
3223
- sender: z17.object({ login: z17.string().min(1) }).strict()
3306
+ repository: z18.object({ full_name: z18.string().min(1) }).strict(),
3307
+ sender: z18.object({ login: z18.string().min(1) }).strict()
3224
3308
  }).strict();
3225
- var pullRequestConversationSchema = z17.object({
3226
- pull_request: z17.object({
3227
- body: z17.string().nullable().optional(),
3228
- id: z17.number().int().positive(),
3229
- user: z17.object({ login: z17.string().min(1) }).passthrough()
3309
+ var pullRequestConversationSchema = z18.object({
3310
+ pull_request: z18.object({
3311
+ body: z18.string().nullable().optional(),
3312
+ id: z18.number().int().positive(),
3313
+ user: z18.object({ login: z18.string().min(1) }).passthrough()
3230
3314
  }).passthrough(),
3231
- repository: z17.object({ full_name: z17.string().min(1) }).passthrough(),
3232
- sender: z17.object({ login: z17.string().min(1) }).passthrough()
3315
+ repository: z18.object({ full_name: z18.string().min(1) }).passthrough(),
3316
+ sender: z18.object({ login: z18.string().min(1) }).passthrough()
3233
3317
  }).passthrough().transform(
3234
3318
  (provider) => canonicalPullRequestConversationSchema.parse({
3235
3319
  pull_request: {
@@ -3546,18 +3630,18 @@ function createGitHubWebhookRoute(args) {
3546
3630
  }
3547
3631
 
3548
3632
  // src/pull-request-outcomes/commit-composition.ts
3549
- import { z as z18 } from "zod";
3550
- var canonicalCommitSchema = z18.object({
3551
- authorEmail: z18.string().nullable(),
3552
- authorLogin: z18.string().nullable()
3633
+ import { z as z19 } from "zod";
3634
+ var canonicalCommitSchema = z19.object({
3635
+ authorEmail: z19.string().nullable(),
3636
+ authorLogin: z19.string().nullable()
3553
3637
  }).strict();
3554
- var providerCommitSchema = z18.object({
3555
- author: z18.object({ login: z18.string() }).passthrough().nullable(),
3556
- commit: z18.object({
3557
- author: z18.object({ email: z18.string() }).passthrough().nullable()
3638
+ var providerCommitSchema = z19.object({
3639
+ author: z19.object({ login: z19.string() }).passthrough().nullable(),
3640
+ commit: z19.object({
3641
+ author: z19.object({ email: z19.string() }).passthrough().nullable()
3558
3642
  }).passthrough()
3559
3643
  }).passthrough();
3560
- var commitPageSchema = z18.array(providerCommitSchema).transform(
3644
+ var commitPageSchema = z19.array(providerCommitSchema).transform(
3561
3645
  (commits) => commits.map(
3562
3646
  (commit) => canonicalCommitSchema.parse({
3563
3647
  authorEmail: commit.commit.author?.email ?? null,