@sentry/junior-github 0.305.0 → 0.307.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,279 @@
1
1
  import * as z from "zod";
2
- import { eventMatchFieldsSchema, mergeEventMatchFields } from "@sentry/junior-plugin-api";
2
+ import { PluginToolInputError, eventMatchFieldsSchema, mergeEventMatchFields } from "@sentry/junior-plugin-api";
3
3
  import { lexer } from "marked";
4
4
  import { createPrivateKey, createSign } from "node:crypto";
5
+ import pLimit from "p-limit";
6
+ // src/tool-support/github-api.ts
7
+ const GITHUB_API_BASE = "https://api.github.com";
8
+ const MAX_REDIRECTS = 3;
9
+ const REDIRECT_STATUSES = /* @__PURE__ */ new Set([
10
+ 301,
11
+ 302,
12
+ 307,
13
+ 308
14
+ ]);
15
+ /**
16
+ * Send one GitHub API request through host egress.
17
+ *
18
+ * Egress injects credentials, so tools never see a token. `operation` names
19
+ * the provider action for grant selection and diagnostics. Callers own the
20
+ * error mapping, because the status that means bad input differs per route.
21
+ * `followRedirects` follows GET redirects on the GitHub API host. Set it only
22
+ * when the caller reads the object identity from the response, because the
23
+ * redirect target can be in another repository.
24
+ */
25
+ async function githubApi(egress, input) {
26
+ const headers = {
27
+ Accept: "application/vnd.github+json",
28
+ "X-GitHub-Api-Version": input.apiVersion ?? "2022-11-28"
29
+ };
30
+ if (input.body !== void 0) headers["Content-Type"] = "application/json";
31
+ const method = input.method ?? "GET";
32
+ let url = `${GITHUB_API_BASE}${input.path}`;
33
+ let response;
34
+ const follow = input.followRedirects === true && method === "GET";
35
+ for (let hop = 0;; hop++) {
36
+ response = await egress.fetch({
37
+ provider: "github",
38
+ operation: input.operation,
39
+ request: new Request(url, {
40
+ method,
41
+ headers,
42
+ signal: input.signal ?? null,
43
+ ...input.body !== void 0 ? { body: JSON.stringify(input.body) } : void 0
44
+ })
45
+ });
46
+ const next = follow ? redirectTarget(response, url) : void 0;
47
+ if (!next || hop >= MAX_REDIRECTS) break;
48
+ await response.body?.cancel();
49
+ url = next;
50
+ }
51
+ return {
52
+ body: await readBody(response),
53
+ ok: response.ok,
54
+ status: response.status
55
+ };
56
+ }
57
+ function redirectTarget(response, from) {
58
+ if (!REDIRECT_STATUSES.has(response.status)) return void 0;
59
+ const location = response.headers.get("location");
60
+ if (!location) return void 0;
61
+ const target = new URL(location, from);
62
+ return target.origin === GITHUB_API_BASE ? target.href : void 0;
63
+ }
64
+ /**
65
+ * Return where a `github.com` attachment URL redirects, through host
66
+ * egress. GitHub signs that address for a short time, so it needs no
67
+ * credential. Egress does not follow the redirect, so the credential never
68
+ * reaches the image host.
69
+ */
70
+ async function githubAttachmentLocation(egress, url) {
71
+ const response = await egress.fetch({
72
+ provider: "github",
73
+ operation: "github.attachment.get",
74
+ request: new Request(url, { redirect: "manual" })
75
+ });
76
+ await response.body?.cancel();
77
+ const location = REDIRECT_STATUSES.has(response.status) ? response.headers.get("location") : null;
78
+ return location ? new URL(location, url).href : void 0;
79
+ }
80
+ async function readBody(response) {
81
+ const text = await response.text();
82
+ if (!text) return void 0;
83
+ try {
84
+ return JSON.parse(text);
85
+ } catch {
86
+ return text;
87
+ }
88
+ }
89
+ /** Return the `/repos/{owner}/{name}` API path prefix for a parsed repo. */
90
+ function repoPath(repo) {
91
+ return `/repos/${encodeURIComponent(repo.owner)}/${encodeURIComponent(repo.name)}`;
92
+ }
93
+ /** Parse a model-supplied `owner/name` repository reference. */
94
+ function parseRepo(value) {
95
+ const parts = value.split("/").map((part) => part.trim());
96
+ if (parts.length !== 2 || !parts[0] || !parts[1]) throw new PluginToolInputError("repo must use \"owner/name\" format");
97
+ return {
98
+ owner: parts[0],
99
+ name: parts[1],
100
+ ref: `${parts[0]}/${parts[1]}`
101
+ };
102
+ }
103
+ /**
104
+ * Return a readable error from a GitHub REST or GraphQL error body.
105
+ *
106
+ * REST validation errors list the failed fields in `errors`, and GraphQL puts
107
+ * every message in `errors`. Both details help the model fix its input.
108
+ */
109
+ function githubErrorMessage(body) {
110
+ if (typeof body === "string" && body.trim()) return body.trim();
111
+ if (!isRecord$1(body)) return "GitHub request failed";
112
+ const errors = Array.isArray(body["errors"]) ? body["errors"].filter(isRecord$1) : [];
113
+ if (typeof body["message"] === "string" && body["message"].trim()) {
114
+ const details = errors.map((error) => [
115
+ "resource",
116
+ "field",
117
+ "code",
118
+ "message"
119
+ ].map((name) => {
120
+ const value = error[name];
121
+ return typeof value === "string" && value.trim() ? `${name}=${value.trim()}` : void 0;
122
+ }).filter(Boolean).join(" ")).filter(Boolean).join("; ");
123
+ const message = body["message"].trim();
124
+ return details ? `${message}: ${details}` : message;
125
+ }
126
+ const graphqlMessages = errors.map((error) => error["message"]).filter((message) => typeof message === "string" && message.trim());
127
+ return graphqlMessages.length ? graphqlMessages.join("; ") : "GitHub request failed";
128
+ }
129
+ function isRecord$1(value) {
130
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
131
+ }
132
+ // src/tool-support/attribution.ts
133
+ const GITHUB_REQUEST_ATTRIBUTION_START = "<!-- junior-request-attribution:start -->";
134
+ const GITHUB_REQUEST_ATTRIBUTION_END = "<!-- junior-request-attribution:end -->";
135
+ const SLACK_USER_ID_DISPLAY_PATTERN = /^[UW][A-Z0-9]{5,}$/;
136
+ const GITHUB_LOGIN_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/;
137
+ /** Return a GitHub login without a leading `@`, when it is a valid login. */
138
+ function parseGitHubLogin(value) {
139
+ const login = value?.trim().replace(/^@/, "");
140
+ return login && GITHUB_LOGIN_PATTERN.test(login) ? login : void 0;
141
+ }
142
+ /**
143
+ * Return the GitHub login linked to a user, when it is a valid login.
144
+ *
145
+ * Attribution mentions, PR assignment, and review requests use this login so
146
+ * the requester gets GitHub notifications for the issue or pull request.
147
+ */
148
+ function linkedGitHubLogin(user) {
149
+ return parseGitHubLogin(user?.identities.find((identity) => identity.provider === "github")?.handle);
150
+ }
151
+ /**
152
+ * Match host actor display cleaning: drop blanks, unknown, the actor id, and
153
+ * Slack user-id shaped values so attribution never publishes a raw subject id.
154
+ */
155
+ function cleanDisplayValue(value, userId) {
156
+ const cleaned = value?.replace(/[\r\n<>]/g, " ").trim();
157
+ if (!cleaned) return;
158
+ if (cleaned.toLowerCase() === "unknown") return;
159
+ if (userId && cleaned === userId) return;
160
+ if (SLACK_USER_ID_DISPLAY_PATTERN.test(cleaned)) return;
161
+ return cleaned;
162
+ }
163
+ /**
164
+ * Whether a person started this Turn from its own surface. An Automation run,
165
+ * Event, plugin dispatch, or Agent invocation acts for no person. Core's
166
+ * Automation tools use the same rule.
167
+ */
168
+ function startedByPerson(ctx) {
169
+ return !!ctx.actor && ctx.actor.platform === ctx.source?.kind;
170
+ }
171
+ /**
172
+ * Name the work owner of this write. For a person, prefer a linked GitHub
173
+ * login as an `@` mention so GitHub subscribes them. Otherwise use the linked
174
+ * user name, then the stored identity name/handle, then the Turn Actor's
175
+ * already-hydrated profile. Never publish a raw actor id. A system owner,
176
+ * such as an Automation run, is named by its record.
177
+ */
178
+ function requesterLabel(owner) {
179
+ if (!owner) return void 0;
180
+ if (owner.kind === "system") {
181
+ const record = `${owner.name} \`${owner.id}\``;
182
+ const label = owner.url ? `[${record}](${owner.url})` : record;
183
+ return owner.runId ? `${label} · Run ID \`${owner.runId}\`` : label;
184
+ }
185
+ const { actor, identity, user } = owner;
186
+ const login = linkedGitHubLogin(user);
187
+ if (login) return `@${login}`;
188
+ const userId = actor?.userId;
189
+ const display = cleanDisplayValue(user?.displayName, userId) ?? cleanDisplayValue(identity?.displayName, userId) ?? cleanDisplayValue(identity?.handle, userId) ?? cleanDisplayValue(actor?.fullName, userId) ?? cleanDisplayValue(actor?.userName, userId);
190
+ return display ? `**${display.replaceAll("*", "\\*")}**` : void 0;
191
+ }
192
+ /**
193
+ * Recover the ordered list of prior requester labels from an existing
194
+ * attribution block, including the legacy `Requested by` and `via A, via B`
195
+ * wordings, so a new requester can be appended instead of replacing them.
196
+ */
197
+ function parseExistingLabels(blockContents) {
198
+ const trimmed = blockContents.trim().replace(/\.$/, "");
199
+ if (!trimmed) return [];
200
+ return trimmed.replace(/^(?:Requested by|via)\s+/i, "").split(/,\s*(?=\*\*|@|\[?[a-z][a-z ]* `|via\s)/i).map((entry) => entry.trim().replace(/^via\s+/i, "")).filter(Boolean);
201
+ }
202
+ /** Render the attribution block wire format parsed by `parseExistingLabels`. */
203
+ function formatAttributionBlock(labels) {
204
+ return `${GITHUB_REQUEST_ATTRIBUTION_START}\nvia ${labels.join(", ")}.\n${GITHUB_REQUEST_ATTRIBUTION_END}`;
205
+ }
206
+ const ATTRIBUTION_BLOCK = new RegExp(`${GITHUB_REQUEST_ATTRIBUTION_START}([\\s\\S]*?)${GITHUB_REQUEST_ATTRIBUTION_END}`);
207
+ function blockLabels(body) {
208
+ const contents = body?.match(ATTRIBUTION_BLOCK)?.[1];
209
+ return contents === void 0 ? [] : parseExistingLabels(contents);
210
+ }
211
+ /**
212
+ * Merge requesters from the body on GitHub, the new body, and the current
213
+ * Actor, in that order and without duplicates.
214
+ */
215
+ function applyAttribution(body, label, currentBody) {
216
+ const normalizedBody = body.trimEnd();
217
+ const labels = [.../* @__PURE__ */ new Set([
218
+ ...blockLabels(currentBody),
219
+ ...blockLabels(normalizedBody),
220
+ ...label ? [label] : []
221
+ ])];
222
+ const attribution = labels.length ? formatAttributionBlock(labels) : void 0;
223
+ if (ATTRIBUTION_BLOCK.test(normalizedBody)) return attribution ? normalizedBody.replace(ATTRIBUTION_BLOCK, attribution) : normalizedBody.replace(ATTRIBUTION_BLOCK, "").trimEnd();
224
+ if (!attribution) return normalizedBody;
225
+ return normalizedBody ? `${normalizedBody}\n\n${attribution}` : attribution;
226
+ }
227
+ /**
228
+ * Read the body that is on GitHub now, so an update keeps its requesters.
229
+ * The model sees descriptions with the attribution block removed.
230
+ */
231
+ async function readGitHubBody(egress, input) {
232
+ const response = await githubApi(egress, input);
233
+ if (!response.ok) throw new Error(`GitHub read before update failed with HTTP ${response.status}: ${githubErrorMessage(response.body)}`);
234
+ return z.object({ body: z.string().nullable().optional() }).parse(response.body).body ?? void 0;
235
+ }
236
+ /**
237
+ * Look up the requester once for one GitHub write. The attribution block,
238
+ * the saved pull request requester, and the assignee all use this one result.
239
+ * The host decides whose work the Turn does. When the lookup fails, a person
240
+ * who runs the Turn keeps their hydrated profile, and a system Turn fails.
241
+ */
242
+ async function resolveGitHubRequester(ctx) {
243
+ try {
244
+ return await ctx.resolveWorkOwner();
245
+ } catch (error) {
246
+ const { actor } = ctx;
247
+ if (!actor || actor.platform === "system") throw error;
248
+ ctx.log.warn("github.requester.resolve_work_owner.failed", { "exception.message": error instanceof Error ? error.message : String(error) });
249
+ return {
250
+ kind: "person",
251
+ actor
252
+ };
253
+ }
254
+ }
255
+ /** Return the requester when it is a person, for assignment and openers. */
256
+ function requesterPerson(requester) {
257
+ return requester?.kind === "person" ? requester : void 0;
258
+ }
259
+ /**
260
+ * Reject a pull request that would not say who it is for. The check uses the
261
+ * same label as the attribution block, so a pull request that passes always
262
+ * names its work owner.
263
+ */
264
+ function assertGitHubPullRequestRequester(requester) {
265
+ if (requesterLabel(requester)) return;
266
+ throw new PluginToolInputError(requester?.kind === "person" ? "Cannot open a pull request: the person who asked for it has no linked GitHub account or name to attribute it to. Do not retry. Ask them to link their GitHub account and ask again, or report it as blocked." : "Cannot open a pull request: no person or Automation run asked for this work. Do not retry. Report it as blocked, so the person who wants it can ask for it.");
267
+ }
268
+ /**
269
+ * Append or replace runtime-owned requester attribution in a GitHub body.
270
+ * Pass `currentBody` on updates so requesters already on GitHub are kept.
271
+ * With no stored requester, the label falls back to the already-hydrated
272
+ * actor profile.
273
+ */
274
+ function appendGitHubRequesterAttribution(body, requester, currentBody) {
275
+ return applyAttribution(body, requesterLabel(requester), currentBody);
276
+ }
5
277
  // src/permissions.ts
6
278
  const LEVELS = /* @__PURE__ */ new Set([
7
279
  "read",
@@ -173,17 +445,66 @@ function gitHubIssueResource(input) {
173
445
  */
174
446
  function gitHubIssueSubscribable(input) {
175
447
  if (!input.canSubscribe) return void 0;
448
+ const omitted = new Set(input.omitSuggestedEvents ?? []);
449
+ const suggestedEvents = GITHUB_ISSUE_SUGGESTED_EVENTS.filter((eventType) => !omitted.has(eventType));
176
450
  return {
177
451
  ...gitHubIssueResource(input),
178
452
  match: {
179
453
  repo: gitHubRepoDataSchema.parse(input.repo),
180
454
  issue: input.number
181
455
  },
182
- suggested_events: GITHUB_ISSUE_SUGGESTED_EVENTS,
456
+ ...suggestedEvents.length > 0 ? { suggested_events: suggestedEvents } : void 0,
183
457
  supported_events: GITHUB_ISSUE_EVENTS,
184
458
  type: "issue"
185
459
  };
186
460
  }
461
+ /**
462
+ * Junior files issues for people, but the issue is not its work to fix. So
463
+ * the Watch wakes only on comments, where a person may ask something that
464
+ * the requester must answer. GitHub already tells people about closes,
465
+ * reopens, and label changes. Junior's own close or reopen would also wake
466
+ * the Watch, because those webhooks do not skip the bot.
467
+ */
468
+ const GITHUB_ISSUE_WATCH = {
469
+ events: ["issue.comment.created"],
470
+ intent: "Follow GitHub issues that you create or update. When a comment asks a question or for a decision that only the person who asked for the issue can give, post in the originating thread: name what they must answer or decide, and link the comment. Do not reply on GitHub, change the issue, or start work because of a comment, unless a person in the thread asks you to. Otherwise stay silent: GitHub already shows comments, so do not post status updates."
471
+ };
472
+ /**
473
+ * Watch an issue that a tool created or updated, for the current
474
+ * Conversation. The Watch id depends on the Conversation, resource, and
475
+ * events, so a repeat call replaces the same Watch. A failed subscribe still
476
+ * returns the issue: the write already happened.
477
+ */
478
+ async function watchGitHubIssue(ctx, input) {
479
+ const subscribable = gitHubIssueSubscribable({
480
+ canSubscribe: ctx.events.canSubscribe,
481
+ ...input
482
+ });
483
+ if (!subscribable) return {};
484
+ if (!startedByPerson(ctx)) return { subscribable };
485
+ try {
486
+ const subscription = await ctx.events.subscribe({
487
+ ...GITHUB_ISSUE_WATCH,
488
+ resource: subscribable
489
+ });
490
+ const remaining = gitHubIssueSubscribable({
491
+ canSubscribe: ctx.events.canSubscribe,
492
+ ...input,
493
+ omitSuggestedEvents: subscription.events
494
+ });
495
+ return {
496
+ ...remaining ? { subscribable: remaining } : void 0,
497
+ subscription
498
+ };
499
+ } catch (error) {
500
+ ctx.log.warn("github.issue.subscribe.failed", {
501
+ error: error instanceof Error ? error.message : String(error),
502
+ number: input.number,
503
+ repo: input.repo
504
+ });
505
+ return { subscribable };
506
+ }
507
+ }
187
508
  // src/events/deployment.ts
188
509
  const GITHUB_DEPLOYMENT_EVENTS = [
189
510
  "deployment.created",
@@ -317,8 +638,9 @@ function gitHubPullRequestEventGuidance(guidance) {
317
638
  * Junior maintains the pull requests it creates. The pull request is its own
318
639
  * work, so it answers and fixes review feedback without asking first.
319
640
  * GitHub already tells people about reviews, approvals, merges, and closes,
320
- * and the review desk shows the next action. So the Watch skips those
321
- * outcomes and posts in the thread only when a person must act.
641
+ * and the review desk shows the next action. So the Watch gets approvals,
642
+ * merges, and closes only as Quiet Events, and posts in the thread only when
643
+ * a person must act.
322
644
  */
323
645
  const DEFAULT_PULL_REQUEST_SUBSCRIPTION = {
324
646
  events: [
@@ -346,17 +668,31 @@ function gitHubPullRequestSubscription(config) {
346
668
  */
347
669
  const DRAFT_CHECKS_RECOVERED_GUIDANCE = "If the pull request is still a draft, call github_getPullRequest and read its `checks`, `code_owners`, and `agents_md`. When `checks.required` is `passing` and no decision is open, in the pull request body or in an open review item that waits on the person who asked for it: mark it ready with github_updatePullRequest and draft false, when the person who asked for it said to mark it ready, or when `code_owners` is empty and `agents_md` does not ask for draft pull requests or say that a person marks them ready. Otherwise keep it a draft: marking it ready would ask the code owners to review, or break the AGENTS.md rule. Tell the person who asked for it in the originating thread that the checks pass and the draft waits for their review, and name why: the code owners that marking it ready asks, or the AGENTS.md rule. If you already told them for this head commit, stay silent. When it is `failing`, fix the failing checks like a failed check. When it is `pending` or `not_reported`, stay silent: a later passing suite wakes you again. `not_reported` means the required checks may not have started on the latest commit yet, not that none are required.";
348
670
  /**
671
+ * State changes that need no action but that a later Turn must know, so that
672
+ * it does not call an approved pull request unreviewed, or a merged or
673
+ * closed one open. An app config that lists one of them keeps it as a
674
+ * normal Event that starts a Turn.
675
+ */
676
+ const QUIET_PULL_REQUEST_EVENTS = [
677
+ "pull_request.review.approved",
678
+ "pull_request.merged",
679
+ "pull_request.closed_unmerged"
680
+ ];
681
+ /**
349
682
  * Build the Watch created after Junior creates a pull request. Only a draft
350
683
  * Watch gets passing checks, so a ready pull request is not woken by each
351
684
  * passing check suite.
352
685
  */
353
686
  function gitHubPullRequestCreateWatch(config, pullRequest) {
687
+ const quietEvents = [...QUIET_PULL_REQUEST_EVENTS, ...pullRequest.draft ? ["pull_request.ready_for_review"] : []].filter((eventType) => !config.events.includes(eventType));
354
688
  return {
355
689
  events: [.../* @__PURE__ */ new Set([
356
690
  ...config.events,
357
691
  "pull_request.merge_conflict",
358
- ...pullRequest.draft ? ["pull_request.checks.recovered"] : []
692
+ ...pullRequest.draft ? ["pull_request.checks.recovered"] : [],
693
+ ...quietEvents
359
694
  ])],
695
+ ...quietEvents.length > 0 ? { quietEvents } : void 0,
360
696
  ...pullRequest.draft ? { guidance: { "pull_request.checks.recovered": DRAFT_CHECKS_RECOVERED_GUIDANCE } } : void 0,
361
697
  intent: config.intent
362
698
  };
@@ -596,47 +932,80 @@ function isBotLogin(login, botEmail) {
596
932
  function botUserIdFromEmail(value) {
597
933
  return parseGitHubBotIdentity(value)?.userId;
598
934
  }
599
- const SKIPPED_TOKEN_TYPES = /* @__PURE__ */ new Set([
600
- "blockquote",
601
- "code",
602
- "codespan",
603
- "html"
604
- ]);
935
+ const HTML_QUOTE_OPEN = /<\s*blockquote\b/i;
936
+ function isList(token) {
937
+ return token.type === "list";
938
+ }
939
+ function isTable(token) {
940
+ return token.type === "table";
941
+ }
942
+ function childTokens(token) {
943
+ if (isList(token)) return token.items.flatMap((item) => item.tokens);
944
+ if (isTable(token)) return [token.header, ...token.rows].flat().flatMap((cell) => cell.tokens);
945
+ return "tokens" in token && token.tokens ? token.tokens : [];
946
+ }
947
+ function hasHtmlQuote(token) {
948
+ return token.type === "html" && HTML_QUOTE_OPEN.test(token.raw) || childTokens(token).some(hasHtmlQuote);
949
+ }
605
950
  /**
606
- * Collect the text of Markdown tokens outside quotes, code, and HTML. Join
607
- * inline tokens with no separator, so `me@bot` stays one word.
951
+ * Split a comment into the text that its author wrote (`own`) and the rest
952
+ * (`other`), such as quotes. Each part is undefined when it is empty. This is
953
+ * the one parser for a GitHub author's own text.
954
+ *
955
+ * A quote repeats text that someone else wrote, so it is never the author's
956
+ * own words. Markdown quotes and HTML are removed, also in lists and tables.
957
+ * An HTML quote has no reliable end: Markdown splits it at blank lines, and a
958
+ * closing tag can hide in an HTML comment or attribute. So the block with the
959
+ * first HTML quote tag and all text after it are removed. Each rule removes
960
+ * text, so a parse that GitHub renders differently can only drop the
961
+ * author's words, never add words that someone else wrote.
962
+ *
963
+ * Code stays, because an instruction can name a command. `withoutCode` also
964
+ * removes code, where text in code does not count, such as a mention.
965
+ *
966
+ * The removed text goes to `other`, so it is shown once, as text that the
967
+ * author did not write.
608
968
  */
609
- function ownTokenText(tokens, separator = "") {
610
- return tokens.map((token) => {
611
- if (SKIPPED_TOKEN_TYPES.has(token.type)) return " ";
612
- if (token.type === "list") return token.items.map((item) => ownTokenText(item.tokens, "\n")).join("\n");
613
- if (token.type === "table") {
614
- const table = token;
615
- return [table.header, ...table.rows].flat().map((cell) => ownTokenText(cell.tokens)).join(" ");
969
+ function splitCommentText(text, options = {}) {
970
+ if (!text) return {};
971
+ const other = [];
972
+ const removed = (token) => token.type === "blockquote" || token.type === "html" || options.withoutCode === true && (token.type === "code" || token.type === "codespan");
973
+ const hasRemoved = (token) => removed(token) || childTokens(token).some(hasRemoved);
974
+ let afterHtmlQuote = false;
975
+ const tokenText = (tokens, separator = "") => tokens.map((token) => {
976
+ if (afterHtmlQuote || hasHtmlQuote(token)) {
977
+ afterHtmlQuote = true;
978
+ other.push(token.raw);
979
+ return "\n";
980
+ }
981
+ if (removed(token)) {
982
+ other.push(token.raw);
983
+ return token.type === "codespan" ? " " : "\n";
616
984
  }
617
- if ("tokens" in token && token.tokens) return ownTokenText(token.tokens);
618
- return "text" in token ? token.text : token.raw;
985
+ if (!hasRemoved(token)) return token.raw;
986
+ if (isList(token)) return token.items.map((item) => tokenText(item.tokens, "\n").trim()).filter(Boolean).map((item) => `- ${item}`).join("\n");
987
+ if (isTable(token)) return [token.header, ...token.rows].map((row) => row.map((cell) => tokenText(cell.tokens)).join(" | ")).join("\n");
988
+ return tokenText(childTokens(token));
619
989
  }).join(separator);
620
- }
621
- /**
622
- * Keep the author's own text. A GitHub-flavored Markdown parser finds the
623
- * quotes and code, the same as GitHub when it renders the comment.
624
- */
625
- function ownCommentText(text) {
626
- return ownTokenText(lexer(text, { gfm: true }), "\n");
990
+ const own = tokenText(lexer(text, { gfm: true })).replace(/\n{3,}/g, "\n\n").trim();
991
+ const rest = other.map((part) => part.trim()).filter(Boolean).join("\n\n");
992
+ return {
993
+ ...own ? { own } : void 0,
994
+ ...rest ? { other: rest } : void 0
995
+ };
627
996
  }
628
997
  /**
629
998
  * Check whether the author's own text mentions the bot encoded in the
630
999
  * configured bot email. GitHub sends mentions only as comment text, with no
631
1000
  * structured field, so this reads the App slug: the bot login without `[bot]`.
632
- * This shows only that the comment addresses the bot. It does not grant trust;
633
- * match the commenter's `senderId` for that.
1001
+ * This shows only that the comment addresses the bot. It does not grant
1002
+ * trust; core decides that from the Event author.
634
1003
  */
635
1004
  function mentionsBotLogin(text, botEmail) {
636
1005
  const slug = botLoginFromEmail(botEmail)?.replace(/\[bot\]$/i, "");
637
1006
  if (!slug) return false;
638
1007
  const escaped = slug.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
639
- return new RegExp(`(?:^|[^\\w-])@${escaped}(?![\\w-])`, "i").test(ownCommentText(text));
1008
+ return new RegExp(`(?:^|[^\\w-])@${escaped}(?![\\w-])`, "i").test(splitCommentText(text, { withoutCode: true }).own ?? "");
640
1009
  }
641
1010
  // src/credential-support.ts
642
1011
  /**
@@ -1173,22 +1542,51 @@ function createPermissionCache() {
1173
1542
  */
1174
1543
  const gitHubSenderSchema = z.object({
1175
1544
  id: z.number(),
1176
- login: z.string().min(1)
1545
+ login: z.string().min(1),
1546
+ type: z.string().optional()
1177
1547
  });
1178
- /** Trusted event data that names who sent a webhook. */
1179
- function gitHubSenderData(sender) {
1180
- return {
1548
+ /**
1549
+ * Describe who wrote a GitHub Event, from the one place that reads the
1550
+ * webhook sender. The same author feeds the Event `author` for core trust,
1551
+ * the trusted match data (`senderId`, `senderLogin`, `mentionsBot`), and the
1552
+ * check that drops Junior's own writes.
1553
+ *
1554
+ * `login` is the GitHub user that the Event names: the comment or review
1555
+ * author, or the sender of an update. GitHub authenticates the sender, so
1556
+ * the sender's numeric id is the `subjectId` only when the sender is that
1557
+ * user. The plugin turns its `trustedAuthors` list into `trusted`, so core
1558
+ * never reads a login. `text` is the comment body, for comment and review
1559
+ * Events only. Its author's own words go to `author.text`, and the rest, such
1560
+ * as quotes, to `untrustedText`, so core shows each part once.
1561
+ */
1562
+ function gitHubEventAuthor(input, options) {
1563
+ const handle = input.login?.trim();
1564
+ const { sender } = input;
1565
+ const data = {
1566
+ ...input.text !== void 0 && options.botEmail ? { mentionsBot: mentionsBotLogin(input.text ?? "", options.botEmail) } : void 0,
1181
1567
  senderId: sender?.id,
1182
1568
  senderLogin: sender?.login
1183
1569
  };
1184
- }
1185
- /** The GitHub user who did what an Event describes, when GitHub names one. */
1186
- function gitHubDoneBy(login) {
1187
- const handle = login?.trim();
1188
- return handle ? { doneBy: {
1189
- provider: "github",
1190
- handle
1191
- } } : void 0;
1570
+ if (!handle) return {
1571
+ data,
1572
+ isSelf: false,
1573
+ ...input.text ? { untrustedText: input.text } : void 0
1574
+ };
1575
+ const lower = handle.toLowerCase();
1576
+ const text = splitCommentText(input.text);
1577
+ const isSender = sender?.login?.toLowerCase() === lower;
1578
+ return {
1579
+ author: {
1580
+ handle,
1581
+ ...isSender ? { subjectId: String(sender.id) } : void 0,
1582
+ ...isSender && sender.type === "Bot" || /\[bot\]$/i.test(handle) ? { bot: true } : void 0,
1583
+ ...options.trustedAuthors?.some((login) => login.trim().toLowerCase() === lower) ? { trusted: true } : void 0,
1584
+ ...text.own ? { text: text.own } : void 0
1585
+ },
1586
+ data,
1587
+ isSelf: isBotLogin(handle, options.botEmail),
1588
+ ...text.other ? { untrustedText: text.other } : void 0
1589
+ };
1192
1590
  }
1193
1591
  /** The text of a webhook value, or undefined when it is missing or blank. */
1194
1592
  function nonBlank(value) {
@@ -1249,6 +1647,10 @@ function logFailOpenFailure(log, message, error, metadata) {
1249
1647
  log?.error(message, attributes);
1250
1648
  }
1251
1649
  // src/webhooks/check-suite.ts
1650
+ /**
1651
+ * GitHub check suite events.
1652
+ */
1653
+ const PULL_REQUEST_LOAD_CONCURRENCY = 5;
1252
1654
  /** Match keys that need a pull request API load on check suite events. */
1253
1655
  const CHECK_SUITE_PULL_REQUEST_MATCH_KEYS = /* @__PURE__ */ new Set([
1254
1656
  "isDraft",
@@ -1709,7 +2111,8 @@ async function loadCheckSuiteFacts(args) {
1709
2111
  privateKeyEnv: args.privateKeyEnv,
1710
2112
  repositories: [target.repoName]
1711
2113
  });
1712
- const loaded = await Promise.all(target.pullRequestNumbers.map(async (number) => {
2114
+ const limit = pLimit(PULL_REQUEST_LOAD_CONCURRENCY);
2115
+ const loaded = await Promise.all(target.pullRequestNumbers.map((number) => limit(async () => {
1713
2116
  try {
1714
2117
  const loadedFacts = pullRequestFactsFromResponse(await githubRequest("https://api.github.com", `/repos/${encodeURIComponent(target.owner)}/${encodeURIComponent(target.repoName)}/pulls/${number}`, { token: token.token }));
1715
2118
  return loadedFacts ? [number, loadedFacts] : void 0;
@@ -1720,7 +2123,7 @@ async function loadCheckSuiteFacts(args) {
1720
2123
  });
1721
2124
  return;
1722
2125
  }
1723
- }));
2126
+ })));
1724
2127
  const pullRequestFactsByNumber = {};
1725
2128
  for (const entry of loaded) {
1726
2129
  if (!entry) continue;
@@ -1785,13 +2188,17 @@ function describeIssueUpdate(delivery) {
1785
2188
  * delivery is not one of these updates. Changes that the bot makes publish
1786
2189
  * nothing, so Junior's own issue updates do not wake its Watches.
1787
2190
  */
1788
- function normalizeIssueUpdateEvents(deliveryId, body, botEmail) {
2191
+ function normalizeIssueUpdateEvents(deliveryId, body, authors) {
1789
2192
  const parsed = issueUpdateWebhookSchema.safeParse(body);
1790
2193
  if (!parsed.success) return void 0;
1791
2194
  const update = describeIssueUpdate(parsed.data);
1792
2195
  const { action, label, sender } = parsed.data;
1793
2196
  const doneBy = sender?.login;
1794
- if (isBotLogin(doneBy, botEmail)) return [];
2197
+ const changedBy = gitHubEventAuthor({
2198
+ login: doneBy,
2199
+ sender
2200
+ }, authors);
2201
+ if (changedBy.isSelf) return [];
1795
2202
  const input = {
1796
2203
  number: parsed.data.issue.number,
1797
2204
  repo: parsed.data.repository.full_name
@@ -1804,13 +2211,13 @@ function normalizeIssueUpdateEvents(deliveryId, body, botEmail) {
1804
2211
  occurredAtMs: providerTime(parsed.data.issue.updated_at) ?? Date.now(),
1805
2212
  identifier: resource.identifier,
1806
2213
  trustedSummary: `${issue.label} was ${update.change}${doneBy ? ` by ${doneBy}` : ""}.`,
1807
- ...gitHubDoneBy(doneBy),
2214
+ ...changedBy.author ? { author: changedBy.author } : void 0,
1808
2215
  data: definedValues({
1809
2216
  repo: gitHubRepoDataSchema.parse(input.repo),
1810
2217
  issue: input.number,
1811
2218
  change: action,
1812
2219
  label: label?.name.toLowerCase(),
1813
- ...gitHubSenderData(sender)
2220
+ ...changedBy.data
1814
2221
  }),
1815
2222
  ...untrustedText ? { untrustedText } : void 0
1816
2223
  }));
@@ -1996,16 +2403,6 @@ const commentAuthorDataSchema = z.object({
1996
2403
  senderId: z.number().optional(),
1997
2404
  senderLogin: z.string().min(1).optional()
1998
2405
  });
1999
- /**
2000
- * Who wrote a comment or review, and whether its text mentions the bot.
2001
- * `mentionsBot` is set only when the bot email is configured.
2002
- */
2003
- function commentAuthorData(input) {
2004
- return {
2005
- mentionsBot: input.botEmail ? mentionsBotLogin(input.text ?? "", input.botEmail) : void 0,
2006
- ...gitHubSenderData(input.sender)
2007
- };
2008
- }
2009
2406
  /** The pull request values that every pull request webhook sends. */
2010
2407
  const pullRequestSchema = z.object({
2011
2408
  draft: z.boolean().optional(),
@@ -2068,21 +2465,21 @@ const issueCommentWebhookSchema = z.object({
2068
2465
  sender: gitHubSenderSchema.optional()
2069
2466
  });
2070
2467
  /** Normalize a newly created issue or pull request comment. */
2071
- function normalizeIssueCommentEvents(deliveryId, body, botEmail) {
2468
+ function normalizeIssueCommentEvents(deliveryId, body, authors) {
2072
2469
  const parsed = issueCommentWebhookSchema.safeParse(body);
2073
2470
  if (!parsed.success || parsed.data.action !== "created") return [];
2074
2471
  const { comment, issue, sender } = parsed.data;
2075
2472
  const author = comment.user?.login;
2076
- if (isBotLogin(author, botEmail)) return [];
2473
+ const writtenBy = gitHubEventAuthor({
2474
+ login: author,
2475
+ sender,
2476
+ text: comment.body
2477
+ }, authors);
2478
+ if (writtenBy.isSelf) return [];
2077
2479
  const input = {
2078
2480
  number: issue.number,
2079
2481
  repo: parsed.data.repository.full_name
2080
2482
  };
2081
- const writtenBy = commentAuthorData({
2082
- botEmail,
2083
- sender,
2084
- text: comment.body
2085
- });
2086
2483
  if (issue.pull_request) {
2087
2484
  const eventType = "pull_request.comment.created";
2088
2485
  const resource = gitHubPullRequestResource(input);
@@ -2092,17 +2489,17 @@ function normalizeIssueCommentEvents(deliveryId, body, botEmail) {
2092
2489
  occurredAtMs: Date.now(),
2093
2490
  identifier: resource.identifier,
2094
2491
  trustedSummary: `${resource.label} received a comment${author ? ` from ${author}` : ""}.`,
2095
- ...gitHubDoneBy(author),
2492
+ ...writtenBy.author ? { author: writtenBy.author } : void 0,
2096
2493
  data: pullRequestEventData({
2097
2494
  comment: {
2098
2495
  commentId: comment.id,
2099
2496
  commentKind: "conversation",
2100
- ...writtenBy
2497
+ ...writtenBy.data
2101
2498
  },
2102
2499
  pullRequest: issue,
2103
2500
  repo: input.repo
2104
2501
  }),
2105
- untrustedText: comment.body
2502
+ ...writtenBy.untrustedText ? { untrustedText: writtenBy.untrustedText } : void 0
2106
2503
  }, input.repo);
2107
2504
  }
2108
2505
  const issueResource = gitHubIssueResource(input);
@@ -2111,7 +2508,7 @@ function normalizeIssueCommentEvents(deliveryId, body, botEmail) {
2111
2508
  repo: input.repo,
2112
2509
  issue: input.number,
2113
2510
  commentId: comment.id,
2114
- ...writtenBy
2511
+ ...writtenBy.data
2115
2512
  });
2116
2513
  return [issueResource, repository].map((resource) => ({
2117
2514
  eventKey: gitHubEventKey(deliveryId, "issue.comment.created"),
@@ -2119,9 +2516,9 @@ function normalizeIssueCommentEvents(deliveryId, body, botEmail) {
2119
2516
  occurredAtMs: Date.now(),
2120
2517
  identifier: resource.identifier,
2121
2518
  trustedSummary: `${issueResource.label} received a comment${author ? ` from ${author}` : ""}.`,
2122
- ...gitHubDoneBy(author),
2519
+ ...writtenBy.author ? { author: writtenBy.author } : void 0,
2123
2520
  data,
2124
- untrustedText: comment.body
2521
+ ...writtenBy.untrustedText ? { untrustedText: writtenBy.untrustedText } : void 0
2125
2522
  }));
2126
2523
  }
2127
2524
  const issueWebhookSchema = z.object({
@@ -2137,8 +2534,8 @@ const issueWebhookSchema = z.object({
2137
2534
  repository: repositorySchema
2138
2535
  });
2139
2536
  /** Normalize issue lifecycle changes and updates for the issue and its repository. */
2140
- function normalizeIssueEvents(deliveryId, body, botEmail) {
2141
- const updates = normalizeIssueUpdateEvents(deliveryId, body, botEmail);
2537
+ function normalizeIssueEvents(deliveryId, body, authors) {
2538
+ const updates = normalizeIssueUpdateEvents(deliveryId, body, authors);
2142
2539
  if (updates) return updates;
2143
2540
  const parsed = issueWebhookSchema.safeParse(body);
2144
2541
  if (!parsed.success) return [];
@@ -2174,12 +2571,17 @@ const pullRequestReviewCommentWebhookSchema = z.object({
2174
2571
  sender: gitHubSenderSchema.optional()
2175
2572
  });
2176
2573
  /** Normalize a newly created inline pull request review comment. */
2177
- function normalizePullRequestReviewCommentEvent(deliveryId, body, botEmail) {
2574
+ function normalizePullRequestReviewCommentEvent(deliveryId, body, authors) {
2178
2575
  const parsed = pullRequestReviewCommentWebhookSchema.safeParse(body);
2179
2576
  if (!parsed.success || parsed.data.action !== "created") return [];
2180
2577
  const { comment, pull_request: pullRequest, sender } = parsed.data;
2181
2578
  const author = comment.user?.login;
2182
- if (isBotLogin(author, botEmail)) return [];
2579
+ const writtenBy = gitHubEventAuthor({
2580
+ login: author,
2581
+ sender,
2582
+ text: comment.body
2583
+ }, authors);
2584
+ if (writtenBy.isSelf) return [];
2183
2585
  const eventType = "pull_request.review_comment.created";
2184
2586
  const repo = parsed.data.repository.full_name;
2185
2587
  const resource = gitHubPullRequestResource({
@@ -2192,21 +2594,17 @@ function normalizePullRequestReviewCommentEvent(deliveryId, body, botEmail) {
2192
2594
  occurredAtMs: Date.now(),
2193
2595
  identifier: resource.identifier,
2194
2596
  trustedSummary: `${resource.label} received an inline review comment${author ? ` from ${author}` : ""}.`,
2195
- ...gitHubDoneBy(author),
2597
+ ...writtenBy.author ? { author: writtenBy.author } : void 0,
2196
2598
  data: pullRequestEventData({
2197
2599
  comment: {
2198
2600
  commentId: comment.id,
2199
2601
  commentKind: "review",
2200
- ...commentAuthorData({
2201
- botEmail,
2202
- sender,
2203
- text: comment.body
2204
- })
2602
+ ...writtenBy.data
2205
2603
  },
2206
2604
  pullRequest,
2207
2605
  repo
2208
2606
  }),
2209
- untrustedText: comment.body
2607
+ ...writtenBy.untrustedText ? { untrustedText: writtenBy.untrustedText } : void 0
2210
2608
  }, repo);
2211
2609
  }
2212
2610
  const pullRequestReviewWebhookSchema = z.object({
@@ -2222,11 +2620,17 @@ const pullRequestReviewWebhookSchema = z.object({
2222
2620
  sender: gitHubSenderSchema.optional()
2223
2621
  });
2224
2622
  /** Normalize a submitted pull request review into its review-state event. */
2225
- function normalizePullRequestReviewEvent(deliveryId, body, botEmail) {
2623
+ function normalizePullRequestReviewEvent(deliveryId, body, authors) {
2226
2624
  const parsed = pullRequestReviewWebhookSchema.safeParse(body);
2227
2625
  if (!parsed.success || parsed.data.action !== "submitted") return [];
2228
2626
  const { pull_request: pullRequest, review, sender } = parsed.data;
2229
- if (isBotLogin(review.user?.login, botEmail)) return [];
2627
+ const reviewer = review.user?.login;
2628
+ const writtenBy = gitHubEventAuthor({
2629
+ login: reviewer,
2630
+ sender,
2631
+ text: review.body ?? null
2632
+ }, authors);
2633
+ if (writtenBy.isSelf) return [];
2230
2634
  const reviewState = review.state.toUpperCase();
2231
2635
  const eventType = reviewState === "APPROVED" ? "pull_request.review.approved" : reviewState === "CHANGES_REQUESTED" ? "pull_request.review.changes_requested" : reviewState === "COMMENTED" ? "pull_request.review.commented" : void 0;
2232
2636
  if (!eventType) return [];
@@ -2235,30 +2639,25 @@ function normalizePullRequestReviewEvent(deliveryId, body, botEmail) {
2235
2639
  number: pullRequest.number,
2236
2640
  repo
2237
2641
  });
2238
- const reviewer = review.user?.login;
2239
2642
  const event = {
2240
2643
  eventKey: gitHubEventKey(deliveryId, eventType),
2241
2644
  eventType,
2242
2645
  occurredAtMs: Date.now(),
2243
2646
  identifier: resource.identifier,
2244
2647
  trustedSummary: eventType === "pull_request.review.approved" ? `${resource.label} was approved${reviewer ? ` by ${reviewer}` : ""}.` : eventType === "pull_request.review.changes_requested" ? `${resource.label} received requested changes${reviewer ? ` from ${reviewer}` : ""}.` : `${resource.label} received a review comment${reviewer ? ` from ${reviewer}` : ""}.`,
2245
- ...gitHubDoneBy(reviewer),
2648
+ ...writtenBy.author ? { author: writtenBy.author } : void 0,
2246
2649
  data: pullRequestEventData({
2247
2650
  comment: {
2248
2651
  ...review.id !== void 0 && nonBlank(review.body) ? {
2249
2652
  commentId: review.id,
2250
2653
  commentKind: "review_body"
2251
2654
  } : void 0,
2252
- ...commentAuthorData({
2253
- botEmail,
2254
- sender,
2255
- text: review.body
2256
- })
2655
+ ...writtenBy.data
2257
2656
  },
2258
2657
  pullRequest,
2259
2658
  repo
2260
2659
  }),
2261
- untrustedText: review.body ?? void 0
2660
+ ...writtenBy.untrustedText ? { untrustedText: writtenBy.untrustedText } : void 0
2262
2661
  };
2263
2662
  const events = pullRequestTargets(event, repo);
2264
2663
  if (eventType !== "pull_request.review.approved" || !nonBlank(review.body)) return events;
@@ -2433,20 +2832,25 @@ function normalizeReleaseEvent(deliveryId, body) {
2433
2832
  * Normalize one verified GitHub delivery into conversation events.
2434
2833
  *
2435
2834
  * Comments and reviews written by the configured bot are dropped, so Junior
2436
- * does not react to or act on its own feedback.
2835
+ * does not react to or act on its own feedback. Comment, review, and issue
2836
+ * update Events name their `author`, and core decides whether to trust it.
2437
2837
  */
2438
2838
  function normalizeGitHubEvents(args) {
2839
+ const authors = {
2840
+ botEmail: args.botEmail,
2841
+ trustedAuthors: args.trustedAuthors
2842
+ };
2439
2843
  switch (args.eventName) {
2440
2844
  case "deployment": return normalizeDeploymentEvent(args.deliveryId, args.body);
2441
2845
  case "deployment_status": return normalizeDeploymentStatusEvent(args.deliveryId, args.body);
2442
2846
  case "pull_request": return normalizePullRequestEvent(args.deliveryId, args.body);
2443
- case "issues": return normalizeIssueEvents(args.deliveryId, args.body, args.botEmail);
2444
- case "pull_request_review": return normalizePullRequestReviewEvent(args.deliveryId, args.body, args.botEmail);
2445
- case "issue_comment": return normalizeIssueCommentEvents(args.deliveryId, args.body, args.botEmail);
2446
- case "pull_request_review_comment": return normalizePullRequestReviewCommentEvent(args.deliveryId, args.body, args.botEmail);
2847
+ case "issues": return normalizeIssueEvents(args.deliveryId, args.body, authors);
2848
+ case "pull_request_review": return normalizePullRequestReviewEvent(args.deliveryId, args.body, authors);
2849
+ case "issue_comment": return normalizeIssueCommentEvents(args.deliveryId, args.body, authors);
2850
+ case "pull_request_review_comment": return normalizePullRequestReviewCommentEvent(args.deliveryId, args.body, authors);
2447
2851
  case "check_suite": return normalizeCheckSuiteEvents(args.deliveryId, args.body, args.checkSuiteFacts);
2448
2852
  case "release": return normalizeReleaseEvent(args.deliveryId, args.body);
2449
2853
  default: return [];
2450
2854
  }
2451
2855
  }
2452
- export { GITHUB_DEPLOYMENT_EVENTS as $, requireEnv as A, GITHUB_RELEASE_MATCH_FIELDS as B, githubRequest as C, listVerifiedUserEmails as D, issueInstallationToken as E, GITHUB_REPOSITORY_EVENTS as F, GITHUB_PULL_REQUEST_IDENTIFIER as G, GITHUB_RELEASE_SUGGESTED_EVENTS as H, GITHUB_REPOSITORY_IDENTIFIER as I, gitHubPullRequestCreateWatch as J, GITHUB_PULL_REQUEST_MATCH_FIELDS as K, GITHUB_REPOSITORY_SUGGESTED_EVENTS as L, botLoginFromEmail as M, botUserIdFromEmail as N, normalizeScopeList as O, isBotLogin as P, gitHubPullRequestSubscription as Q, gitHubRepositorySubscribable as R, githubRepositoryFromUrl as S, issueGitHubCredential as T, gitHubReleaseSourceSubscribable as U, GITHUB_RELEASE_SOURCE_IDENTIFIER as V, GITHUB_PULL_REQUEST_EVENTS as W, gitHubPullRequestResource as X, gitHubPullRequestEventGuidance as Y, gitHubPullRequestSubscribable as Z, GITHUB_INSTALLATION_ID_ENV as _, needsCheckSuitePullRequestFacts as a, GITHUB_ISSUE_IDENTIFIER as at, USER_WRITE_REQUIREMENTS as b, logFailOpenFailure as c, gitHubIssueSubscribable as ct, CREATE_TOOL_ROUTING_GUIDANCE as d, readGrantPermissions as dt, GITHUB_DEPLOYMENT_MATCH_FIELDS as et, GITHUB_APP_ID_ENV as f, GITHUB_GRAPHQL_RESPONSE_BODY_LIMIT_BYTES as g, GITHUB_AUTH_TOKEN_PLACEHOLDER as h, loadCheckSuiteFacts as i, GITHUB_ISSUE_EVENTS as it, resolveUserAccount as j, readEnv as k, definedValues as l, gitHubRepoDataSchema as lt, GITHUB_AUTH_TOKEN_ENV as m, normalizeGitHubEvents as n, GITHUB_DEPLOYMENT_SUGGESTED_EVENTS as nt, parseCheckSuitePublishTargets as o, GITHUB_ISSUE_MATCH_FIELDS as ot, GITHUB_APP_PRIVATE_KEY_ENV as p, GITHUB_PULL_REQUEST_SUGGESTED_EVENTS as q, checkSuitePullRequests as r, gitHubDeploymentSourceSubscribable as rt, wantsCheckSuitePassed as s, GITHUB_ISSUE_SUGGESTED_EVENTS as st, gitHubPullRequestTerminalEvents as t, GITHUB_DEPLOYMENT_SOURCE_IDENTIFIER as tt, pullRequestTargets as u, normalizePermissions as ut, GitHubRequestError as v, isRecord as w, createPermissionCache as x, HTTP_READ_METHODS as y, GITHUB_RELEASE_EVENTS as z };
2856
+ export { GITHUB_DEPLOYMENT_EVENTS as $, requireEnv as A, GITHUB_RELEASE_MATCH_FIELDS as B, githubRequest as C, githubErrorMessage as Ct, listVerifiedUserEmails as D, issueInstallationToken as E, GITHUB_REPOSITORY_EVENTS as F, GITHUB_PULL_REQUEST_IDENTIFIER as G, GITHUB_RELEASE_SUGGESTED_EVENTS as H, GITHUB_REPOSITORY_IDENTIFIER as I, gitHubPullRequestCreateWatch as J, GITHUB_PULL_REQUEST_MATCH_FIELDS as K, GITHUB_REPOSITORY_SUGGESTED_EVENTS as L, botLoginFromEmail as M, botUserIdFromEmail as N, normalizeScopeList as O, isBotLogin as P, gitHubPullRequestSubscription as Q, gitHubRepositorySubscribable as R, githubRepositoryFromUrl as S, githubAttachmentLocation as St, issueGitHubCredential as T, repoPath as Tt, gitHubReleaseSourceSubscribable as U, GITHUB_RELEASE_SOURCE_IDENTIFIER as V, GITHUB_PULL_REQUEST_EVENTS as W, gitHubPullRequestResource as X, gitHubPullRequestEventGuidance as Y, gitHubPullRequestSubscribable as Z, GITHUB_INSTALLATION_ID_ENV as _, readGitHubBody as _t, needsCheckSuitePullRequestFacts as a, GITHUB_ISSUE_IDENTIFIER as at, USER_WRITE_REQUIREMENTS as b, startedByPerson as bt, logFailOpenFailure as c, gitHubIssueSubscribable as ct, CREATE_TOOL_ROUTING_GUIDANCE as d, normalizePermissions as dt, GITHUB_DEPLOYMENT_MATCH_FIELDS as et, GITHUB_APP_ID_ENV as f, readGrantPermissions as ft, GITHUB_GRAPHQL_RESPONSE_BODY_LIMIT_BYTES as g, parseGitHubLogin as gt, GITHUB_AUTH_TOKEN_PLACEHOLDER as h, linkedGitHubLogin as ht, loadCheckSuiteFacts as i, GITHUB_ISSUE_EVENTS as it, resolveUserAccount as j, readEnv as k, definedValues as l, watchGitHubIssue as lt, GITHUB_AUTH_TOKEN_ENV as m, assertGitHubPullRequestRequester as mt, normalizeGitHubEvents as n, GITHUB_DEPLOYMENT_SUGGESTED_EVENTS as nt, parseCheckSuitePublishTargets as o, GITHUB_ISSUE_MATCH_FIELDS as ot, GITHUB_APP_PRIVATE_KEY_ENV as p, appendGitHubRequesterAttribution as pt, GITHUB_PULL_REQUEST_SUGGESTED_EVENTS as q, checkSuitePullRequests as r, gitHubDeploymentSourceSubscribable as rt, wantsCheckSuitePassed as s, GITHUB_ISSUE_SUGGESTED_EVENTS as st, gitHubPullRequestTerminalEvents as t, GITHUB_DEPLOYMENT_SOURCE_IDENTIFIER as tt, pullRequestTargets as u, gitHubRepoDataSchema as ut, GitHubRequestError as v, requesterPerson as vt, isRecord as w, parseRepo as wt, createPermissionCache as x, githubApi as xt, HTTP_READ_METHODS as y, resolveGitHubRequester as yt, GITHUB_RELEASE_EVENTS as z };