cyrus-github-event-transport 0.2.22

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.
@@ -0,0 +1,77 @@
1
+ /**
2
+ * GitHub Message Translator
3
+ *
4
+ * Translates GitHub webhook events into unified internal messages for the
5
+ * internal message bus.
6
+ *
7
+ * @module github-event-transport/GitHubMessageTranslator
8
+ */
9
+ import type { IMessageTranslator, TranslationContext, TranslationResult } from "cyrus-core";
10
+ import type { GitHubWebhookEvent } from "./types.js";
11
+ /**
12
+ * Translates GitHub webhook events into internal messages.
13
+ *
14
+ * Note: GitHub webhooks can result in either:
15
+ * - SessionStartMessage: First mention/comment that starts a session
16
+ * - UserPromptMessage: Follow-up comments in an existing session
17
+ *
18
+ * The distinction between session start vs user prompt is determined by
19
+ * the EdgeWorker based on whether an active session exists for the PR.
20
+ */
21
+ export declare class GitHubMessageTranslator implements IMessageTranslator<GitHubWebhookEvent> {
22
+ /**
23
+ * Check if this translator can handle the given event.
24
+ */
25
+ canTranslate(event: unknown): event is GitHubWebhookEvent;
26
+ /**
27
+ * Translate a GitHub webhook event into an internal message.
28
+ *
29
+ * By default, creates a SessionStartMessage. The EdgeWorker will
30
+ * determine if this should actually be a UserPromptMessage based
31
+ * on whether an active session exists.
32
+ */
33
+ translate(event: GitHubWebhookEvent, context?: TranslationContext): TranslationResult;
34
+ /**
35
+ * Translate issue_comment event to SessionStartMessage.
36
+ */
37
+ private translateIssueComment;
38
+ /**
39
+ * Translate pull_request_review_comment event to SessionStartMessage.
40
+ */
41
+ private translatePullRequestReviewComment;
42
+ /**
43
+ * Create a UserPromptMessage from a GitHub event.
44
+ * This is called by EdgeWorker when it determines the message
45
+ * is a follow-up to an existing session.
46
+ */
47
+ translateAsUserPrompt(event: GitHubWebhookEvent, context?: TranslationContext): TranslationResult;
48
+ /**
49
+ * Translate issue_comment as UserPromptMessage.
50
+ */
51
+ private translateIssueCommentAsUserPrompt;
52
+ /**
53
+ * Translate pull_request_review_comment as UserPromptMessage.
54
+ */
55
+ private translatePullRequestReviewCommentAsUserPrompt;
56
+ /**
57
+ * Build repository reference from webhook data.
58
+ */
59
+ private buildRepositoryRef;
60
+ /**
61
+ * Build issue reference from webhook data.
62
+ */
63
+ private buildIssueRef;
64
+ /**
65
+ * Build pull request reference from issue data (for issue comments on PRs).
66
+ */
67
+ private buildPullRequestFromIssue;
68
+ /**
69
+ * Build pull request reference from webhook data.
70
+ */
71
+ private buildPullRequestRef;
72
+ /**
73
+ * Build comment reference from webhook data.
74
+ */
75
+ private buildCommentRef;
76
+ }
77
+ //# sourceMappingURL=GitHubMessageTranslator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubMessageTranslator.d.ts","sourceRoot":"","sources":["../src/GitHubMessageTranslator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAIX,kBAAkB,EAElB,kBAAkB,EAClB,iBAAiB,EAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAGX,kBAAkB,EAClB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;GASG;AACH,qBAAa,uBACZ,YAAW,kBAAkB,CAAC,kBAAkB,CAAC;IAEjD;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB;IAkBzD;;;;;;OAMG;IACH,SAAS,CACR,KAAK,EAAE,kBAAkB,EACzB,OAAO,CAAC,EAAE,kBAAkB,GAC1B,iBAAiB;IAepB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAqD7B;;OAEG;IACH,OAAO,CAAC,iCAAiC;IAkDzC;;;;OAIG;IACH,qBAAqB,CACpB,KAAK,EAAE,kBAAkB,EACzB,OAAO,CAAC,EAAE,kBAAkB,GAC1B,iBAAiB;IAepB;;OAEG;IACH,OAAO,CAAC,iCAAiC;IAyCzC;;OAEG;IACH,OAAO,CAAC,6CAA6C;IA6CrD;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAkB1B;;OAEG;IACH,OAAO,CAAC,aAAa;IAkBrB;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAuBjC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAoB3B;;OAEG;IACH,OAAO,CAAC,eAAe;CAiBvB"}
@@ -0,0 +1,328 @@
1
+ /**
2
+ * GitHub Message Translator
3
+ *
4
+ * Translates GitHub webhook events into unified internal messages for the
5
+ * internal message bus.
6
+ *
7
+ * @module github-event-transport/GitHubMessageTranslator
8
+ */
9
+ import { randomUUID } from "node:crypto";
10
+ /**
11
+ * Translates GitHub webhook events into internal messages.
12
+ *
13
+ * Note: GitHub webhooks can result in either:
14
+ * - SessionStartMessage: First mention/comment that starts a session
15
+ * - UserPromptMessage: Follow-up comments in an existing session
16
+ *
17
+ * The distinction between session start vs user prompt is determined by
18
+ * the EdgeWorker based on whether an active session exists for the PR.
19
+ */
20
+ export class GitHubMessageTranslator {
21
+ /**
22
+ * Check if this translator can handle the given event.
23
+ */
24
+ canTranslate(event) {
25
+ if (!event || typeof event !== "object") {
26
+ return false;
27
+ }
28
+ const e = event;
29
+ // GitHub webhook events have eventType, deliveryId, and payload
30
+ return (typeof e.eventType === "string" &&
31
+ (e.eventType === "issue_comment" ||
32
+ e.eventType === "pull_request_review_comment") &&
33
+ typeof e.deliveryId === "string" &&
34
+ e.payload !== null &&
35
+ typeof e.payload === "object");
36
+ }
37
+ /**
38
+ * Translate a GitHub webhook event into an internal message.
39
+ *
40
+ * By default, creates a SessionStartMessage. The EdgeWorker will
41
+ * determine if this should actually be a UserPromptMessage based
42
+ * on whether an active session exists.
43
+ */
44
+ translate(event, context) {
45
+ if (event.eventType === "issue_comment") {
46
+ return this.translateIssueComment(event, context);
47
+ }
48
+ if (event.eventType === "pull_request_review_comment") {
49
+ return this.translatePullRequestReviewComment(event, context);
50
+ }
51
+ return {
52
+ success: false,
53
+ reason: `Unsupported GitHub event type: ${event.eventType}`,
54
+ };
55
+ }
56
+ /**
57
+ * Translate issue_comment event to SessionStartMessage.
58
+ */
59
+ translateIssueComment(event, context) {
60
+ const payload = event.payload;
61
+ const { issue, comment, repository, sender } = payload;
62
+ // Determine organization ID (use installation ID if available, else repo owner)
63
+ const organizationId = context?.organizationId ||
64
+ String(payload.installation?.id || repository.owner.id);
65
+ // Build session key: owner/repo#number
66
+ const sessionKey = `${repository.full_name}#${issue.number}`;
67
+ // Build work item identifier
68
+ const workItemIdentifier = `${repository.full_name}#${issue.number}`;
69
+ // Build platform data
70
+ const platformData = {
71
+ eventType: event.eventType,
72
+ repository: this.buildRepositoryRef(repository),
73
+ issue: this.buildIssueRef(issue),
74
+ pullRequest: issue.pull_request
75
+ ? this.buildPullRequestFromIssue(issue, repository)
76
+ : undefined,
77
+ comment: this.buildCommentRef(comment),
78
+ installationToken: event.installationToken,
79
+ };
80
+ const message = {
81
+ id: randomUUID(),
82
+ source: "github",
83
+ action: "session_start",
84
+ receivedAt: comment.created_at,
85
+ organizationId,
86
+ sessionKey,
87
+ workItemId: String(issue.id),
88
+ workItemIdentifier,
89
+ author: {
90
+ id: String(sender.id),
91
+ name: sender.login,
92
+ avatarUrl: sender.avatar_url,
93
+ },
94
+ initialPrompt: comment.body,
95
+ title: issue.title,
96
+ description: issue.body ?? undefined,
97
+ platformData,
98
+ };
99
+ return { success: true, message };
100
+ }
101
+ /**
102
+ * Translate pull_request_review_comment event to SessionStartMessage.
103
+ */
104
+ translatePullRequestReviewComment(event, context) {
105
+ const payload = event.payload;
106
+ const { pull_request, comment, repository, sender } = payload;
107
+ // Determine organization ID
108
+ const organizationId = context?.organizationId ||
109
+ String(payload.installation?.id || repository.owner.id);
110
+ // Build session key: owner/repo#number
111
+ const sessionKey = `${repository.full_name}#${pull_request.number}`;
112
+ // Build work item identifier
113
+ const workItemIdentifier = `${repository.full_name}#${pull_request.number}`;
114
+ // Build platform data
115
+ const platformData = {
116
+ eventType: event.eventType,
117
+ repository: this.buildRepositoryRef(repository),
118
+ pullRequest: this.buildPullRequestRef(pull_request),
119
+ comment: this.buildCommentRef(comment),
120
+ installationToken: event.installationToken,
121
+ };
122
+ const message = {
123
+ id: randomUUID(),
124
+ source: "github",
125
+ action: "session_start",
126
+ receivedAt: comment.created_at,
127
+ organizationId,
128
+ sessionKey,
129
+ workItemId: String(pull_request.id),
130
+ workItemIdentifier,
131
+ author: {
132
+ id: String(sender.id),
133
+ name: sender.login,
134
+ avatarUrl: sender.avatar_url,
135
+ },
136
+ initialPrompt: comment.body,
137
+ title: pull_request.title,
138
+ description: pull_request.body ?? undefined,
139
+ platformData,
140
+ };
141
+ return { success: true, message };
142
+ }
143
+ /**
144
+ * Create a UserPromptMessage from a GitHub event.
145
+ * This is called by EdgeWorker when it determines the message
146
+ * is a follow-up to an existing session.
147
+ */
148
+ translateAsUserPrompt(event, context) {
149
+ if (event.eventType === "issue_comment") {
150
+ return this.translateIssueCommentAsUserPrompt(event, context);
151
+ }
152
+ if (event.eventType === "pull_request_review_comment") {
153
+ return this.translatePullRequestReviewCommentAsUserPrompt(event, context);
154
+ }
155
+ return {
156
+ success: false,
157
+ reason: `Unsupported GitHub event type: ${event.eventType}`,
158
+ };
159
+ }
160
+ /**
161
+ * Translate issue_comment as UserPromptMessage.
162
+ */
163
+ translateIssueCommentAsUserPrompt(event, context) {
164
+ const payload = event.payload;
165
+ const { issue, comment, repository, sender } = payload;
166
+ const organizationId = context?.organizationId ||
167
+ String(payload.installation?.id || repository.owner.id);
168
+ const sessionKey = `${repository.full_name}#${issue.number}`;
169
+ const platformData = {
170
+ eventType: event.eventType,
171
+ repository: this.buildRepositoryRef(repository),
172
+ comment: this.buildCommentRef(comment),
173
+ installationToken: event.installationToken,
174
+ };
175
+ const message = {
176
+ id: randomUUID(),
177
+ source: "github",
178
+ action: "user_prompt",
179
+ receivedAt: comment.created_at,
180
+ organizationId,
181
+ sessionKey,
182
+ workItemId: String(issue.id),
183
+ workItemIdentifier: `${repository.full_name}#${issue.number}`,
184
+ author: {
185
+ id: String(sender.id),
186
+ name: sender.login,
187
+ avatarUrl: sender.avatar_url,
188
+ },
189
+ content: comment.body,
190
+ platformData,
191
+ };
192
+ return { success: true, message };
193
+ }
194
+ /**
195
+ * Translate pull_request_review_comment as UserPromptMessage.
196
+ */
197
+ translatePullRequestReviewCommentAsUserPrompt(event, context) {
198
+ const payload = event.payload;
199
+ const { pull_request, comment, repository, sender } = payload;
200
+ const organizationId = context?.organizationId ||
201
+ String(payload.installation?.id || repository.owner.id);
202
+ const sessionKey = `${repository.full_name}#${pull_request.number}`;
203
+ const platformData = {
204
+ eventType: event.eventType,
205
+ repository: this.buildRepositoryRef(repository),
206
+ comment: this.buildCommentRef(comment),
207
+ installationToken: event.installationToken,
208
+ };
209
+ const message = {
210
+ id: randomUUID(),
211
+ source: "github",
212
+ action: "user_prompt",
213
+ receivedAt: comment.created_at,
214
+ organizationId,
215
+ sessionKey,
216
+ workItemId: String(pull_request.id),
217
+ workItemIdentifier: `${repository.full_name}#${pull_request.number}`,
218
+ author: {
219
+ id: String(sender.id),
220
+ name: sender.login,
221
+ avatarUrl: sender.avatar_url,
222
+ },
223
+ content: comment.body,
224
+ platformData,
225
+ };
226
+ return { success: true, message };
227
+ }
228
+ // ============================================================================
229
+ // HELPER METHODS
230
+ // ============================================================================
231
+ /**
232
+ * Build repository reference from webhook data.
233
+ */
234
+ buildRepositoryRef(repo) {
235
+ return {
236
+ id: repo.id,
237
+ name: repo.name,
238
+ fullName: repo.full_name,
239
+ htmlUrl: repo.html_url,
240
+ cloneUrl: repo.clone_url,
241
+ sshUrl: repo.ssh_url,
242
+ defaultBranch: repo.default_branch,
243
+ owner: {
244
+ login: repo.owner.login,
245
+ id: repo.owner.id,
246
+ },
247
+ };
248
+ }
249
+ /**
250
+ * Build issue reference from webhook data.
251
+ */
252
+ buildIssueRef(issue) {
253
+ return {
254
+ id: issue.id,
255
+ number: issue.number,
256
+ title: issue.title,
257
+ body: issue.body,
258
+ state: issue.state,
259
+ htmlUrl: issue.html_url,
260
+ user: {
261
+ login: issue.user.login,
262
+ id: issue.user.id,
263
+ },
264
+ isPullRequest: !!issue.pull_request,
265
+ };
266
+ }
267
+ /**
268
+ * Build pull request reference from issue data (for issue comments on PRs).
269
+ */
270
+ buildPullRequestFromIssue(issue, _repo) {
271
+ // When we have an issue_comment on a PR, we only have minimal PR data
272
+ // The full PR details are not in the webhook payload
273
+ return {
274
+ id: issue.id,
275
+ number: issue.number,
276
+ title: issue.title,
277
+ body: issue.body,
278
+ state: issue.state,
279
+ htmlUrl: issue.html_url,
280
+ headRef: "", // Not available in issue_comment payload
281
+ headSha: "", // Not available in issue_comment payload
282
+ baseRef: "", // Not available in issue_comment payload
283
+ user: {
284
+ login: issue.user.login,
285
+ id: issue.user.id,
286
+ },
287
+ };
288
+ }
289
+ /**
290
+ * Build pull request reference from webhook data.
291
+ */
292
+ buildPullRequestRef(pr) {
293
+ return {
294
+ id: pr.id,
295
+ number: pr.number,
296
+ title: pr.title,
297
+ body: pr.body,
298
+ state: pr.state,
299
+ htmlUrl: pr.html_url,
300
+ headRef: pr.head.ref,
301
+ headSha: pr.head.sha,
302
+ baseRef: pr.base.ref,
303
+ user: {
304
+ login: pr.user.login,
305
+ id: pr.user.id,
306
+ },
307
+ };
308
+ }
309
+ /**
310
+ * Build comment reference from webhook data.
311
+ */
312
+ buildCommentRef(comment) {
313
+ return {
314
+ id: comment.id,
315
+ body: comment.body,
316
+ htmlUrl: comment.html_url,
317
+ user: {
318
+ login: comment.user.login,
319
+ id: comment.user.id,
320
+ avatarUrl: comment.user.avatar_url,
321
+ },
322
+ createdAt: comment.created_at,
323
+ path: comment.path,
324
+ diffHunk: comment.diff_hunk,
325
+ };
326
+ }
327
+ }
328
+ //# sourceMappingURL=GitHubMessageTranslator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubMessageTranslator.js","sourceRoot":"","sources":["../src/GitHubMessageTranslator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,a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,KAAK;YACf,OAAO,EAAE,EAAE,CAAC,QAAQ;YACpB,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG;YACpB,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG;YACpB,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG;YACpB,IAAI,EAAE;gBACL,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK;gBACpB,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;aACd;SACD,CAAC;IACH,CAAC;IAED;;OAEG;IACK,eAAe,CACtB,OAA6C;QAE7C,OAAO;YACN,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,OAAO,EAAE,OAAO,CAAC,QAAQ;YACzB,IAAI,EAAE;gBACL,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;gBACzB,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE;gBACnB,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU;aAClC;YACD,SAAS,EAAE,OAAO,CAAC,UAAU;YAC7B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,QAAQ,EAAE,OAAO,CAAC,SAAS;SAC3B,CAAC;IACH,CAAC;CACD"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Utility functions for processing GitHub webhook payloads
3
+ */
4
+ import type { GitHubIssueCommentPayload, GitHubPullRequestReviewCommentPayload, GitHubWebhookEvent } from "./types.js";
5
+ /**
6
+ * Type guard for issue_comment payloads
7
+ */
8
+ export declare function isIssueCommentPayload(payload: GitHubWebhookEvent["payload"]): payload is GitHubIssueCommentPayload;
9
+ /**
10
+ * Type guard for pull_request_review_comment payloads
11
+ */
12
+ export declare function isPullRequestReviewCommentPayload(payload: GitHubWebhookEvent["payload"]): payload is GitHubPullRequestReviewCommentPayload;
13
+ /**
14
+ * Extract the PR branch name from a GitHub webhook event.
15
+ *
16
+ * For issue_comment: We need to use the issue.pull_request URL to determine the PR,
17
+ * but the branch ref is not directly available in the payload. The caller must
18
+ * fetch it from the PR API endpoint.
19
+ *
20
+ * For pull_request_review_comment: The branch is available in payload.pull_request.head.ref
21
+ */
22
+ export declare function extractPRBranchRef(event: GitHubWebhookEvent): string | null;
23
+ /**
24
+ * Extract the PR number from a GitHub webhook event
25
+ */
26
+ export declare function extractPRNumber(event: GitHubWebhookEvent): number | null;
27
+ /**
28
+ * Extract the comment body from a GitHub webhook event
29
+ */
30
+ export declare function extractCommentBody(event: GitHubWebhookEvent): string;
31
+ /**
32
+ * Extract the comment author from a GitHub webhook event
33
+ */
34
+ export declare function extractCommentAuthor(event: GitHubWebhookEvent): string;
35
+ /**
36
+ * Extract repository full name (owner/repo) from a GitHub webhook event
37
+ */
38
+ export declare function extractRepoFullName(event: GitHubWebhookEvent): string;
39
+ /**
40
+ * Extract repository owner from a GitHub webhook event
41
+ */
42
+ export declare function extractRepoOwner(event: GitHubWebhookEvent): string;
43
+ /**
44
+ * Extract repository name from a GitHub webhook event
45
+ */
46
+ export declare function extractRepoName(event: GitHubWebhookEvent): string;
47
+ /**
48
+ * Extract the comment ID from a GitHub webhook event
49
+ */
50
+ export declare function extractCommentId(event: GitHubWebhookEvent): number;
51
+ /**
52
+ * Extract the installation ID from a GitHub webhook event (if present)
53
+ */
54
+ export declare function extractInstallationId(event: GitHubWebhookEvent): number | null;
55
+ /**
56
+ * Check if an issue_comment webhook is for a pull request (not a plain issue)
57
+ */
58
+ export declare function isCommentOnPullRequest(event: GitHubWebhookEvent): boolean;
59
+ /**
60
+ * Extract a unique session identifier for the GitHub webhook event.
61
+ * This is used to create a unique session for each PR + repository combination.
62
+ */
63
+ export declare function extractSessionKey(event: GitHubWebhookEvent): string;
64
+ /**
65
+ * Strip the @cyrusagent mention from a comment body to get the actual instructions
66
+ */
67
+ export declare function stripMention(commentBody: string, mentionHandle?: string): string;
68
+ /**
69
+ * Extract the PR title from a GitHub webhook event
70
+ */
71
+ export declare function extractPRTitle(event: GitHubWebhookEvent): string | null;
72
+ /**
73
+ * Extract the HTML URL for the comment
74
+ */
75
+ export declare function extractCommentUrl(event: GitHubWebhookEvent): string;
76
+ //# sourceMappingURL=github-webhook-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-webhook-utils.d.ts","sourceRoot":"","sources":["../src/github-webhook-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACX,yBAAyB,EACzB,qCAAqC,EACrC,kBAAkB,EAClB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,GACpC,OAAO,IAAI,yBAAyB,CAEtC;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAChD,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,GACpC,OAAO,IAAI,qCAAqC,CAElD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI,CAO3E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI,CAcxE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAEtE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAErE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAElE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAEjE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAElE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,kBAAkB,GACvB,MAAM,GAAG,IAAI,CAEf;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAMzE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAInE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC3B,WAAW,EAAE,MAAM,EACnB,aAAa,GAAE,MAAsB,GACnC,MAAM,CAWR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI,CAQvE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAEnE"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Utility functions for processing GitHub webhook payloads
3
+ */
4
+ /**
5
+ * Type guard for issue_comment payloads
6
+ */
7
+ export function isIssueCommentPayload(payload) {
8
+ return "issue" in payload;
9
+ }
10
+ /**
11
+ * Type guard for pull_request_review_comment payloads
12
+ */
13
+ export function isPullRequestReviewCommentPayload(payload) {
14
+ return "pull_request" in payload;
15
+ }
16
+ /**
17
+ * Extract the PR branch name from a GitHub webhook event.
18
+ *
19
+ * For issue_comment: We need to use the issue.pull_request URL to determine the PR,
20
+ * but the branch ref is not directly available in the payload. The caller must
21
+ * fetch it from the PR API endpoint.
22
+ *
23
+ * For pull_request_review_comment: The branch is available in payload.pull_request.head.ref
24
+ */
25
+ export function extractPRBranchRef(event) {
26
+ if (isPullRequestReviewCommentPayload(event.payload)) {
27
+ return event.payload.pull_request.head.ref;
28
+ }
29
+ // For issue_comment, the branch ref is not in the payload
30
+ // The caller needs to fetch it from the PR API
31
+ return null;
32
+ }
33
+ /**
34
+ * Extract the PR number from a GitHub webhook event
35
+ */
36
+ export function extractPRNumber(event) {
37
+ if (isIssueCommentPayload(event.payload)) {
38
+ // For issue_comment on a PR, the issue number IS the PR number
39
+ if (event.payload.issue.pull_request) {
40
+ return event.payload.issue.number;
41
+ }
42
+ return null;
43
+ }
44
+ if (isPullRequestReviewCommentPayload(event.payload)) {
45
+ return event.payload.pull_request.number;
46
+ }
47
+ return null;
48
+ }
49
+ /**
50
+ * Extract the comment body from a GitHub webhook event
51
+ */
52
+ export function extractCommentBody(event) {
53
+ return event.payload.comment.body;
54
+ }
55
+ /**
56
+ * Extract the comment author from a GitHub webhook event
57
+ */
58
+ export function extractCommentAuthor(event) {
59
+ return event.payload.comment.user.login;
60
+ }
61
+ /**
62
+ * Extract repository full name (owner/repo) from a GitHub webhook event
63
+ */
64
+ export function extractRepoFullName(event) {
65
+ return event.payload.repository.full_name;
66
+ }
67
+ /**
68
+ * Extract repository owner from a GitHub webhook event
69
+ */
70
+ export function extractRepoOwner(event) {
71
+ return event.payload.repository.owner.login;
72
+ }
73
+ /**
74
+ * Extract repository name from a GitHub webhook event
75
+ */
76
+ export function extractRepoName(event) {
77
+ return event.payload.repository.name;
78
+ }
79
+ /**
80
+ * Extract the comment ID from a GitHub webhook event
81
+ */
82
+ export function extractCommentId(event) {
83
+ return event.payload.comment.id;
84
+ }
85
+ /**
86
+ * Extract the installation ID from a GitHub webhook event (if present)
87
+ */
88
+ export function extractInstallationId(event) {
89
+ return event.payload.installation?.id ?? null;
90
+ }
91
+ /**
92
+ * Check if an issue_comment webhook is for a pull request (not a plain issue)
93
+ */
94
+ export function isCommentOnPullRequest(event) {
95
+ if (isIssueCommentPayload(event.payload)) {
96
+ return !!event.payload.issue.pull_request;
97
+ }
98
+ // pull_request_review_comment is always on a PR
99
+ return true;
100
+ }
101
+ /**
102
+ * Extract a unique session identifier for the GitHub webhook event.
103
+ * This is used to create a unique session for each PR + repository combination.
104
+ */
105
+ export function extractSessionKey(event) {
106
+ const repoFullName = extractRepoFullName(event);
107
+ const prNumber = extractPRNumber(event);
108
+ return `github:${repoFullName}#${prNumber}`;
109
+ }
110
+ /**
111
+ * Strip the @cyrusagent mention from a comment body to get the actual instructions
112
+ */
113
+ export function stripMention(commentBody, mentionHandle = "@cyrusagent") {
114
+ // Remove the mention and any surrounding whitespace
115
+ return commentBody
116
+ .replace(new RegExp(`\\s*${mentionHandle.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*`, "gi"), " ")
117
+ .trim();
118
+ }
119
+ /**
120
+ * Extract the PR title from a GitHub webhook event
121
+ */
122
+ export function extractPRTitle(event) {
123
+ if (isIssueCommentPayload(event.payload)) {
124
+ return event.payload.issue.title;
125
+ }
126
+ if (isPullRequestReviewCommentPayload(event.payload)) {
127
+ return event.payload.pull_request.title;
128
+ }
129
+ return null;
130
+ }
131
+ /**
132
+ * Extract the HTML URL for the comment
133
+ */
134
+ export function extractCommentUrl(event) {
135
+ return event.payload.comment.html_url;
136
+ }
137
+ //# sourceMappingURL=github-webhook-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-webhook-utils.js","sourceRoot":"","sources":["../src/github-webhook-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACpC,OAAsC;IAEtC,OAAO,OAAO,IAAI,OAAO,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iCAAiC,CAChD,OAAsC;IAEtC,OAAO,cAAc,IAAI,OAAO,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAyB;IAC3D,IAAI,iCAAiC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACtD,OAAO,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;IAC5C,CAAC;IACD,0DAA0D;IAC1D,+CAA+C;IAC/C,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAyB;IACxD,IAAI,qBAAqB,CAAC,KAAK,CAAC,OAAO,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CAAC,QAAQ,CAAC;AACvC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type { AddReactionParams, GitHubCommentResponse, GitHubCommentServiceConfig, PostCommentParams, PostReviewCommentReplyParams, } from "./GitHubCommentService.js";
2
+ export { GitHubCommentService } from "./GitHubCommentService.js";
3
+ export { GitHubEventTransport } from "./GitHubEventTransport.js";
4
+ export { GitHubMessageTranslator } from "./GitHubMessageTranslator.js";
5
+ export { extractCommentAuthor, extractCommentBody, extractCommentId, extractCommentUrl, extractInstallationId, extractPRBranchRef, extractPRNumber, extractPRTitle, extractRepoFullName, extractRepoName, extractRepoOwner, extractSessionKey, isCommentOnPullRequest, isIssueCommentPayload, isPullRequestReviewCommentPayload, stripMention, } from "./github-webhook-utils.js";
6
+ export type { GitHubComment, GitHubEventTransportConfig, GitHubEventTransportEvents, GitHubEventType, GitHubInstallation, GitHubIssue, GitHubIssueCommentPayload, GitHubPullRequest, GitHubPullRequestMinimal, GitHubPullRequestRef, GitHubPullRequestReviewCommentPayload, GitHubRepository, GitHubUser, GitHubVerificationMode, GitHubWebhookEvent, } from "./types.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,iBAAiB,EACjB,4BAA4B,GAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EACjC,YAAY,GACZ,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACX,aAAa,EACb,0BAA0B,EAC1B,0BAA0B,EAC1B,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,qCAAqC,EACrC,gBAAgB,EAChB,UAAU,EACV,sBAAsB,EACtB,kBAAkB,GAClB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { GitHubCommentService } from "./GitHubCommentService.js";
2
+ export { GitHubEventTransport } from "./GitHubEventTransport.js";
3
+ export { GitHubMessageTranslator } from "./GitHubMessageTranslator.js";
4
+ export { extractCommentAuthor, extractCommentBody, extractCommentId, extractCommentUrl, extractInstallationId, extractPRBranchRef, extractPRNumber, extractPRTitle, extractRepoFullName, extractRepoName, extractRepoOwner, extractSessionKey, isCommentOnPullRequest, isIssueCommentPayload, isPullRequestReviewCommentPayload, stripMention, } from "./github-webhook-utils.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EACjC,YAAY,GACZ,MAAM,2BAA2B,CAAC"}