@dual-os/github-api 6.0.3 → 6.0.5
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/LICENSE +24 -0
- package/README.md +35 -0
- package/Runner.js +342 -576
- package/Runner.js.map +5 -9
- package/bundle-inventory.json +1 -1
- package/dist/auth.d.ts +13 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +5 -3
- package/dist/auth.js.map +1 -1
- package/dist/channel/github-app-client.d.ts +67 -0
- package/dist/channel/github-app-client.d.ts.map +1 -0
- package/dist/channel/github-app-client.js +18 -0
- package/dist/channel/github-app-client.js.map +9 -0
- package/dist/channel/github-app-definition.d.ts +190 -0
- package/dist/channel/github-app-definition.d.ts.map +1 -0
- package/dist/channel/github-app-definition.js +32 -0
- package/dist/channel/github-app-definition.js.map +9 -0
- package/dist/channel/github-app.d.ts +126 -0
- package/dist/channel/github-app.d.ts.map +1 -0
- package/dist/channel/github-app.js +17 -0
- package/dist/channel/github-app.js.map +9 -0
- package/dist/channel/internal/webhook.d.ts +38 -0
- package/dist/channel/internal/webhook.d.ts.map +1 -0
- package/dist/channel/internal/webhook.js +22 -0
- package/dist/channel/internal/webhook.js.map +9 -0
- package/dist/generated/http.js +7 -5
- package/dist/generated/http.js.map +1 -1
- package/dist/generated/operations.d.ts +1154 -1154
- package/dist/generated/operations.d.ts.map +1 -1
- package/dist/generated/operations.js +7 -5
- package/dist/generated/operations.js.map +1 -1
- package/dist/generated/plugin.js +14 -10515
- package/dist/generated/plugin.js.map +3 -4
- package/dist/plugin.d.ts +10 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +33 -0
- package/dist/plugin.js.map +10 -0
- package/dist/triggers.d.ts +26 -2
- package/dist/triggers.d.ts.map +1 -1
- package/dist/triggers.js +8 -6
- package/dist/triggers.js.map +1 -1
- package/dual-plugin.json +1 -1
- package/package.json +1 -1
- package/{plugin-t4j28rxn.js → plugin-1b35jx9g.js} +6 -4
- package/{plugin-t4j28rxn.js.map → plugin-1b35jx9g.js.map} +2 -2
- package/plugin-2qqpmr67.js +108 -0
- package/plugin-2qqpmr67.js.map +10 -0
- package/{plugin-yzj02c6j.js → plugin-3ryytw13.js} +193 -308
- package/{plugin-yzj02c6j.js.map → plugin-3ryytw13.js.map} +5 -6
- package/{plugin-3mpmm6hc.js → plugin-5rkcrntd.js} +4 -4
- package/plugin-7hfrx1dg.js +167 -0
- package/plugin-7hfrx1dg.js.map +10 -0
- package/plugin-e0mt19z7.js +377 -0
- package/plugin-e0mt19z7.js.map +10 -0
- package/{plugin-ahctqzvj.js → plugin-gtd7vh23.js} +4 -4
- package/plugin-p1y3h7d7.js +10516 -0
- package/plugin-p1y3h7d7.js.map +10 -0
- package/plugin-p6f7n836.js +631 -0
- package/plugin-p6f7n836.js.map +12 -0
- package/plugin-r0m0v72b.js +156 -0
- package/plugin-r0m0v72b.js.map +10 -0
- package/{plugin-gajxsj3f.js → plugin-w0va8331.js} +2495 -2288
- package/{plugin-gajxsj3f.js.map → plugin-w0va8331.js.map} +12 -13
- /package/licenses/{@dual-os_sdk@0.8.1 → @dual-os_sdk@0.9.0}/LICENSE +0 -0
- /package/{plugin-3mpmm6hc.js.map → plugin-5rkcrntd.js.map} +0 -0
- /package/{plugin-ahctqzvj.js.map → plugin-gtd7vh23.js.map} +0 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
pipe,
|
|
4
|
+
none,
|
|
5
|
+
fromNullishOr,
|
|
6
|
+
fromUndefinedOr,
|
|
7
|
+
map,
|
|
8
|
+
flatMap,
|
|
9
|
+
filter,
|
|
10
|
+
getSuccess,
|
|
11
|
+
toEntries,
|
|
12
|
+
head,
|
|
13
|
+
filter2,
|
|
14
|
+
some2,
|
|
15
|
+
join,
|
|
16
|
+
decode,
|
|
17
|
+
toLowerCase,
|
|
18
|
+
trim,
|
|
19
|
+
trimStart,
|
|
20
|
+
slice,
|
|
21
|
+
split,
|
|
22
|
+
startsWith,
|
|
23
|
+
succeed5,
|
|
24
|
+
fromOption2,
|
|
25
|
+
map4,
|
|
26
|
+
mapError2,
|
|
27
|
+
fn,
|
|
28
|
+
is,
|
|
29
|
+
decodeEffect,
|
|
30
|
+
optionalKey,
|
|
31
|
+
String3,
|
|
32
|
+
Struct,
|
|
33
|
+
NullOr,
|
|
34
|
+
isPattern,
|
|
35
|
+
isGreaterThan,
|
|
36
|
+
Int,
|
|
37
|
+
NonEmptyString,
|
|
38
|
+
fromJsonString,
|
|
39
|
+
value2,
|
|
40
|
+
when,
|
|
41
|
+
orElse2,
|
|
42
|
+
AgentChannel_exports,
|
|
43
|
+
Trigger_exports
|
|
44
|
+
} from "./plugin-w0va8331.js";
|
|
45
|
+
|
|
46
|
+
// dist/channel/internal/webhook.js
|
|
47
|
+
var NumericId2 = Int.check(isGreaterThan(0));
|
|
48
|
+
var Author = NullOr(Struct({
|
|
49
|
+
id: NumericId2,
|
|
50
|
+
login: NonEmptyString
|
|
51
|
+
}));
|
|
52
|
+
var Discussion = Struct({
|
|
53
|
+
body: NullOr(String3),
|
|
54
|
+
created_at: AgentChannel_exports.Timestamp,
|
|
55
|
+
number: NumericId2,
|
|
56
|
+
title: String3,
|
|
57
|
+
user: Author
|
|
58
|
+
});
|
|
59
|
+
var Comment = Struct({
|
|
60
|
+
body: String3,
|
|
61
|
+
created_at: AgentChannel_exports.Timestamp,
|
|
62
|
+
id: NumericId2,
|
|
63
|
+
user: Author
|
|
64
|
+
});
|
|
65
|
+
var Envelope = {
|
|
66
|
+
installation: Struct({ id: NumericId2 }),
|
|
67
|
+
repository: Struct({
|
|
68
|
+
name: NonEmptyString,
|
|
69
|
+
owner: Struct({ login: NonEmptyString })
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
var Action$1 = Struct({
|
|
73
|
+
action: optionalKey(String3),
|
|
74
|
+
installation: optionalKey(Struct({ id: NumericId2 }))
|
|
75
|
+
});
|
|
76
|
+
var Opened = Struct({
|
|
77
|
+
...Envelope,
|
|
78
|
+
issue: optionalKey(Discussion),
|
|
79
|
+
pull_request: optionalKey(Discussion)
|
|
80
|
+
});
|
|
81
|
+
var IssueComment = Struct({
|
|
82
|
+
...Envelope,
|
|
83
|
+
comment: Comment,
|
|
84
|
+
issue: Discussion
|
|
85
|
+
});
|
|
86
|
+
var ReviewComment = Struct({
|
|
87
|
+
...Envelope,
|
|
88
|
+
comment: Struct({
|
|
89
|
+
...Comment.fields,
|
|
90
|
+
line: optionalKey(NullOr(NumericId2)),
|
|
91
|
+
path: String3
|
|
92
|
+
}),
|
|
93
|
+
pull_request: Discussion
|
|
94
|
+
});
|
|
95
|
+
var Signature = String3.check(isPattern(/^sha256=[0-9a-f]{64}$/u));
|
|
96
|
+
function header2(request, name) {
|
|
97
|
+
const values = filter2(toEntries(request.headers), (entry) => toLowerCase(entry[0]) === name);
|
|
98
|
+
if (values.length !== 1)
|
|
99
|
+
return none();
|
|
100
|
+
return map(head(values), (entry) => entry[1]);
|
|
101
|
+
}
|
|
102
|
+
var verify2 = fn("GitHubApp.verify")(function* (request, secret) {
|
|
103
|
+
const expected = yield* pipe(header2(request, "x-hub-signature-256"), filter((value) => request.method === "POST" && is(Signature)(value)), flatMap((value) => getSuccess(decode(slice(7)(value)))), fromOption2, mapError2(() => AgentChannel_exports.HandlerError.make({ code: "unauthorized" })));
|
|
104
|
+
if (!(yield* Trigger_exports.verifyHmacSha256(secret, request.body, Uint8Array.from(expected))))
|
|
105
|
+
return yield* AgentChannel_exports.HandlerError.make({ code: "unauthorized" });
|
|
106
|
+
return { verified: true };
|
|
107
|
+
});
|
|
108
|
+
function decode2(schema, body) {
|
|
109
|
+
return pipe(decodeEffect(fromJsonString(schema))(body), mapError2(() => AgentChannel_exports.HandlerError.make({ code: "rejected" })));
|
|
110
|
+
}
|
|
111
|
+
function reviewCommentText(comment) {
|
|
112
|
+
if (comment.line === undefined || comment.line === null)
|
|
113
|
+
return `On \`${comment.path}\`:
|
|
114
|
+
|
|
115
|
+
${comment.body}`;
|
|
116
|
+
return `On \`${comment.path}\` line ${comment.line}:
|
|
117
|
+
|
|
118
|
+
${comment.body}`;
|
|
119
|
+
}
|
|
120
|
+
function conversationKey2(owner, repository, number) {
|
|
121
|
+
return `${owner}/${repository}#${number}`;
|
|
122
|
+
}
|
|
123
|
+
function inbound(envelope, discussion, message) {
|
|
124
|
+
return map(fromNullishOr(message.author), (author) => ({
|
|
125
|
+
author,
|
|
126
|
+
installationId: envelope.installation.id,
|
|
127
|
+
messageKey: message.key,
|
|
128
|
+
number: discussion.number,
|
|
129
|
+
owner: envelope.repository.owner.login,
|
|
130
|
+
repository: envelope.repository.name,
|
|
131
|
+
text: slice(0, 65536)(message.text),
|
|
132
|
+
timestamp: message.timestamp
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
function opened(body, field) {
|
|
136
|
+
return map4(decode2(Opened, body), (payload) => flatMap(fromUndefinedOr(payload[field]), (discussion) => inbound(payload, discussion, {
|
|
137
|
+
author: discussion.user,
|
|
138
|
+
key: conversationKey2(payload.repository.owner.login, payload.repository.name, discussion.number),
|
|
139
|
+
text: trim(join([discussion.title, discussion.body ?? ""], `
|
|
140
|
+
|
|
141
|
+
`)),
|
|
142
|
+
timestamp: discussion.created_at
|
|
143
|
+
})));
|
|
144
|
+
}
|
|
145
|
+
var parse2 = fn("GitHubApp.parse")(function* (event, body) {
|
|
146
|
+
const action = (yield* decode2(Action$1, body)).action;
|
|
147
|
+
return yield* pipe(value2(`${event}/${action ?? ""}`), when("issues/opened", () => opened(body, "issue")), when("pull_request/opened", () => opened(body, "pull_request")), when("issue_comment/created", () => map4(decode2(IssueComment, body), (payload) => inbound(payload, payload.issue, {
|
|
148
|
+
author: payload.comment.user,
|
|
149
|
+
key: `comment/${payload.comment.id}`,
|
|
150
|
+
text: payload.comment.body,
|
|
151
|
+
timestamp: payload.comment.created_at
|
|
152
|
+
}))), when("pull_request_review_comment/created", () => map4(decode2(ReviewComment, body), (payload) => inbound(payload, payload.pull_request, {
|
|
153
|
+
author: payload.comment.user,
|
|
154
|
+
key: `review-comment/${payload.comment.id}`,
|
|
155
|
+
text: reviewCommentText(payload.comment),
|
|
156
|
+
timestamp: payload.comment.created_at
|
|
157
|
+
}))), orElse2(() => succeed5(none())));
|
|
158
|
+
});
|
|
159
|
+
function mentions2(text, slug) {
|
|
160
|
+
const pattern = new RegExp(`(?:^|[^A-Za-z0-9_])@${slug}(?![A-Za-z0-9_-])`, "iu");
|
|
161
|
+
return some2(split(`
|
|
162
|
+
`)(text), (line) => !startsWith(">")(trimStart(line)) && pattern.test(line));
|
|
163
|
+
}
|
|
164
|
+
export { NumericId2, header2, verify2, conversationKey2, parse2, mentions2 };
|
|
165
|
+
|
|
166
|
+
//# debugId=7306CCD63DA1B8D164756E2164756E21
|
|
167
|
+
//# sourceMappingURL=plugin-7hfrx1dg.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../bundle-input/dist/channel/internal/webhook.js"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { Array, Effect, Match, Option, Record, Result, Schema, String, pipe } from \"effect\";\nimport { AgentChannel, Trigger } from \"@dual-os/sdk\";\nimport { Hex } from \"effect/encoding\";\n//#region src/channel/internal/webhook.ts\nconst NumericId = Schema.Int.check(Schema.isGreaterThan(0));\nconst Author = Schema.NullOr(Schema.Struct({\n\tid: NumericId,\n\tlogin: Schema.NonEmptyString\n}));\nconst Discussion = Schema.Struct({\n\tbody: Schema.NullOr(Schema.String),\n\tcreated_at: AgentChannel.Timestamp,\n\tnumber: NumericId,\n\ttitle: Schema.String,\n\tuser: Author\n});\nconst Comment = Schema.Struct({\n\tbody: Schema.String,\n\tcreated_at: AgentChannel.Timestamp,\n\tid: NumericId,\n\tuser: Author\n});\nconst Envelope = {\n\tinstallation: Schema.Struct({ id: NumericId }),\n\trepository: Schema.Struct({\n\t\tname: Schema.NonEmptyString,\n\t\towner: Schema.Struct({ login: Schema.NonEmptyString })\n\t})\n};\nconst Action$1 = Schema.Struct({\n\taction: Schema.optionalKey(Schema.String),\n\tinstallation: Schema.optionalKey(Schema.Struct({ id: NumericId }))\n});\nconst Opened = Schema.Struct({\n\t...Envelope,\n\tissue: Schema.optionalKey(Discussion),\n\tpull_request: Schema.optionalKey(Discussion)\n});\nconst IssueComment = Schema.Struct({\n\t...Envelope,\n\tcomment: Comment,\n\tissue: Discussion\n});\nconst ReviewComment = Schema.Struct({\n\t...Envelope,\n\tcomment: Schema.Struct({\n\t\t...Comment.fields,\n\t\tline: Schema.optionalKey(Schema.NullOr(NumericId)),\n\t\tpath: Schema.String\n\t}),\n\tpull_request: Discussion\n});\nconst Signature = Schema.String.check(Schema.isPattern(/^sha256=[0-9a-f]{64}$/u));\n/** The value of a request header, when it appears exactly once in any letter case. */\nfunction header(request, name) {\n\tconst values = Array.filter(Record.toEntries(request.headers), (entry) => String.toLowerCase(entry[0]) === name);\n\tif (values.length !== 1) return Option.none();\n\treturn Option.map(Array.head(values), (entry) => entry[1]);\n}\n/** Check `X-Hub-Signature-256`, the HMAC-SHA256 of the raw body under the webhook secret. */\nconst verify = Effect.fn(\"GitHubApp.verify\")(function* (request, secret) {\n\tconst expected = yield* pipe(header(request, \"x-hub-signature-256\"), Option.filter((value) => request.method === \"POST\" && Schema.is(Signature)(value)), Option.flatMap((value) => Result.getSuccess(Hex.decode(String.slice(7)(value)))), Effect.fromOption, Effect.mapError(() => AgentChannel.HandlerError.make({ code: \"unauthorized\" })));\n\tif (!(yield* Trigger.verifyHmacSha256(secret, request.body, Uint8Array.from(expected)))) return yield* AgentChannel.HandlerError.make({ code: \"unauthorized\" });\n\treturn { verified: true };\n});\nfunction decode(schema, body) {\n\treturn pipe(Schema.decodeEffect(Schema.fromJsonString(schema))(body), Effect.mapError(() => AgentChannel.HandlerError.make({ code: \"rejected\" })));\n}\nfunction reviewCommentText(comment) {\n\tif (comment.line === void 0 || comment.line === null) return `On \\`${comment.path}\\`:\\n\\n${comment.body}`;\n\treturn `On \\`${comment.path}\\` line ${comment.line}:\\n\\n${comment.body}`;\n}\nfunction conversationKey(owner, repository, number) {\n\treturn `${owner}/${repository}#${number}`;\n}\nfunction inbound(envelope, discussion, message) {\n\treturn Option.map(Option.fromNullishOr(message.author), (author) => ({\n\t\tauthor,\n\t\tinstallationId: envelope.installation.id,\n\t\tmessageKey: message.key,\n\t\tnumber: discussion.number,\n\t\towner: envelope.repository.owner.login,\n\t\trepository: envelope.repository.name,\n\t\ttext: String.slice(0, 65536)(message.text),\n\t\ttimestamp: message.timestamp\n\t}));\n}\nfunction opened(body, field) {\n\treturn Effect.map(decode(Opened, body), (payload) => Option.flatMap(Option.fromUndefinedOr(payload[field]), (discussion) => inbound(payload, discussion, {\n\t\tauthor: discussion.user,\n\t\tkey: conversationKey(payload.repository.owner.login, payload.repository.name, discussion.number),\n\t\ttext: String.trim(Array.join([discussion.title, discussion.body ?? \"\"], \"\\n\\n\")),\n\t\ttimestamp: discussion.created_at\n\t})));\n}\n/** The message of an issue or pull request opened, or of a comment created on one; nothing for any other event. */\nconst parse = Effect.fn(\"GitHubApp.parse\")(function* (event, body) {\n\tconst action = (yield* decode(Action$1, body)).action;\n\treturn yield* pipe(Match.value(`${event}/${action ?? \"\"}`), Match.when(\"issues/opened\", () => opened(body, \"issue\")), Match.when(\"pull_request/opened\", () => opened(body, \"pull_request\")), Match.when(\"issue_comment/created\", () => Effect.map(decode(IssueComment, body), (payload) => inbound(payload, payload.issue, {\n\t\tauthor: payload.comment.user,\n\t\tkey: `comment/${payload.comment.id}`,\n\t\ttext: payload.comment.body,\n\t\ttimestamp: payload.comment.created_at\n\t}))), Match.when(\"pull_request_review_comment/created\", () => Effect.map(decode(ReviewComment, body), (payload) => inbound(payload, payload.pull_request, {\n\t\tauthor: payload.comment.user,\n\t\tkey: `review-comment/${payload.comment.id}`,\n\t\ttext: reviewCommentText(payload.comment),\n\t\ttimestamp: payload.comment.created_at\n\t}))), Match.orElse(() => Effect.succeed(Option.none())));\n});\n/** Whether `@slug` (also `@slug[bot]` or a link) appears outside quoted lines, which repeat an earlier mention. */\nfunction mentions(text, slug) {\n\tconst pattern = new RegExp(`(?:^|[^A-Za-z0-9_])@${slug}(?![A-Za-z0-9_-])`, \"iu\");\n\treturn Array.some(String.split(\"\\n\")(text), (line) => !String.startsWith(\">\")(String.trimStart(line)) && pattern.test(line));\n}\n//#endregion\nexport { NumericId, conversationKey, header, mentions, parse, verify };\n\n//# sourceMappingURL=webhook.js.map"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,aAAY,IAAW,MAAM,cAAqB,CAAC,CAAC;AAC1D,IAAM,SAAS,OAAc,OAAc;AAAA,EAC1C,IAAI;AAAA,EACJ,OAAO;AACR,CAAC,CAAC;AACF,IAAM,aAAa,OAAc;AAAA,EAChC,MAAM,OAAc,OAAa;AAAA,EACjC,YAAY,qBAAa;AAAA,EACzB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AACP,CAAC;AACD,IAAM,UAAU,OAAc;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY,qBAAa;AAAA,EACzB,IAAI;AAAA,EACJ,MAAM;AACP,CAAC;AACD,IAAM,WAAW;AAAA,EAChB,cAAc,OAAc,EAAE,IAAI,WAAU,CAAC;AAAA,EAC7C,YAAY,OAAc;AAAA,IACzB,MAAM;AAAA,IACN,OAAO,OAAc,EAAE,OAAO,eAAsB,CAAC;AAAA,EACtD,CAAC;AACF;AACA,IAAM,WAAW,OAAc;AAAA,EAC9B,QAAQ,YAAmB,OAAa;AAAA,EACxC,cAAc,YAAmB,OAAc,EAAE,IAAI,WAAU,CAAC,CAAC;AAClE,CAAC;AACD,IAAM,SAAS,OAAc;AAAA,KACzB;AAAA,EACH,OAAO,YAAmB,UAAU;AAAA,EACpC,cAAc,YAAmB,UAAU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|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
pipe,
|
|
4
|
+
none,
|
|
5
|
+
some,
|
|
6
|
+
match2,
|
|
7
|
+
fromNullishOr,
|
|
8
|
+
fromUndefinedOr,
|
|
9
|
+
map,
|
|
10
|
+
flatMap,
|
|
11
|
+
toArray,
|
|
12
|
+
filter,
|
|
13
|
+
liftPredicate,
|
|
14
|
+
exists,
|
|
15
|
+
fromIterable,
|
|
16
|
+
appendAll,
|
|
17
|
+
isReadonlyArrayEmpty,
|
|
18
|
+
takeRight,
|
|
19
|
+
contains,
|
|
20
|
+
map3,
|
|
21
|
+
getSomes,
|
|
22
|
+
some2,
|
|
23
|
+
join,
|
|
24
|
+
provide,
|
|
25
|
+
parse3,
|
|
26
|
+
toLowerCase,
|
|
27
|
+
trim,
|
|
28
|
+
slice,
|
|
29
|
+
isEmpty,
|
|
30
|
+
split,
|
|
31
|
+
replaceAll,
|
|
32
|
+
succeed5,
|
|
33
|
+
fail5,
|
|
34
|
+
fromOption2,
|
|
35
|
+
map4,
|
|
36
|
+
mapError2,
|
|
37
|
+
fnUntraced,
|
|
38
|
+
fn,
|
|
39
|
+
is,
|
|
40
|
+
encodeEffect,
|
|
41
|
+
String3,
|
|
42
|
+
Tuple,
|
|
43
|
+
isPattern,
|
|
44
|
+
Natural,
|
|
45
|
+
fromJsonString,
|
|
46
|
+
value2,
|
|
47
|
+
when,
|
|
48
|
+
discriminatorsExhaustive,
|
|
49
|
+
orElse2,
|
|
50
|
+
exhaustive,
|
|
51
|
+
layer2,
|
|
52
|
+
AgentChannel_exports,
|
|
53
|
+
Plugin_exports
|
|
54
|
+
} from "./plugin-w0va8331.js";
|
|
55
|
+
import {
|
|
56
|
+
GitHubId2,
|
|
57
|
+
ConversationKey2,
|
|
58
|
+
gitHubAppPluginBase2
|
|
59
|
+
} from "./plugin-2qqpmr67.js";
|
|
60
|
+
import {
|
|
61
|
+
header2,
|
|
62
|
+
verify2,
|
|
63
|
+
conversationKey2,
|
|
64
|
+
parse2,
|
|
65
|
+
mentions2
|
|
66
|
+
} from "./plugin-7hfrx1dg.js";
|
|
67
|
+
import {
|
|
68
|
+
GitHubAppClient2
|
|
69
|
+
} from "./plugin-p6f7n836.js";
|
|
70
|
+
|
|
71
|
+
// dist/channel/github-app.js
|
|
72
|
+
var CommentKey = String3.check(isPattern(/^(?:comment|review-comment)\/[1-9][0-9]{0,19}$/u));
|
|
73
|
+
var rank = {
|
|
74
|
+
admin: 5,
|
|
75
|
+
maintain: 4,
|
|
76
|
+
none: 0,
|
|
77
|
+
read: 1,
|
|
78
|
+
triage: 2,
|
|
79
|
+
write: 3
|
|
80
|
+
};
|
|
81
|
+
var reactions = {
|
|
82
|
+
confused: "confused",
|
|
83
|
+
eyes: "eyes",
|
|
84
|
+
heart: "heart",
|
|
85
|
+
hooray: "hooray",
|
|
86
|
+
laugh: "laugh",
|
|
87
|
+
rocket: "rocket",
|
|
88
|
+
thumbs_down: "-1",
|
|
89
|
+
thumbs_up: "+1"
|
|
90
|
+
};
|
|
91
|
+
var marks = {
|
|
92
|
+
completed: "\u2705",
|
|
93
|
+
failed: "\u274C",
|
|
94
|
+
in_progress: "\uD83D\uDD04",
|
|
95
|
+
pending: "\u2B1C"
|
|
96
|
+
};
|
|
97
|
+
function rejected() {
|
|
98
|
+
return AgentChannel_exports.HandlerError.make({ code: "rejected" });
|
|
99
|
+
}
|
|
100
|
+
function installationKey(appId, installationId) {
|
|
101
|
+
return `${appId}/${installationId}`;
|
|
102
|
+
}
|
|
103
|
+
function issueOf(destination) {
|
|
104
|
+
if (destination.kind !== "group" || destination.threadKey !== undefined || !is(ConversationKey2)(destination.conversationKey))
|
|
105
|
+
return none();
|
|
106
|
+
const [path = "", number = ""] = split("#")(destination.conversationKey);
|
|
107
|
+
const [owner = "", name = ""] = split("/")(path);
|
|
108
|
+
return map(parse3(number), (parsed) => ({
|
|
109
|
+
name,
|
|
110
|
+
number: parsed,
|
|
111
|
+
owner
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
function reactionTarget(issue, key) {
|
|
115
|
+
if (key === `${issue.owner}/${issue.name}#${issue.number}`)
|
|
116
|
+
return some({ kind: "issue" });
|
|
117
|
+
if (is(GitHubId2)(key))
|
|
118
|
+
return some({
|
|
119
|
+
id: key,
|
|
120
|
+
kind: "comment"
|
|
121
|
+
});
|
|
122
|
+
if (!is(CommentKey)(key))
|
|
123
|
+
return none();
|
|
124
|
+
const [kind = "", id = ""] = split("/")(key);
|
|
125
|
+
if (kind === "review-comment")
|
|
126
|
+
return some({
|
|
127
|
+
id,
|
|
128
|
+
kind: "review-comment"
|
|
129
|
+
});
|
|
130
|
+
return some({
|
|
131
|
+
id,
|
|
132
|
+
kind: "comment"
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
var oneLine = replaceAll(/\s*\n\s*/gu, " ");
|
|
136
|
+
function planMarkdown(plan) {
|
|
137
|
+
const items = map3(plan.items, (item) => {
|
|
138
|
+
const entry = `- ${marks[item.state]} ${oneLine(item.title)}`;
|
|
139
|
+
if (item.note === undefined)
|
|
140
|
+
return entry;
|
|
141
|
+
return `${entry}: ${oneLine(item.note)}`;
|
|
142
|
+
});
|
|
143
|
+
if (isReadonlyArrayEmpty(items))
|
|
144
|
+
return `**${oneLine(plan.title ?? "Plan")}**
|
|
145
|
+
|
|
146
|
+
_No steps yet._`;
|
|
147
|
+
return join([
|
|
148
|
+
`**${oneLine(plan.title ?? "Plan")}**`,
|
|
149
|
+
"",
|
|
150
|
+
...items
|
|
151
|
+
], `
|
|
152
|
+
`);
|
|
153
|
+
}
|
|
154
|
+
function outcomeText(operation) {
|
|
155
|
+
if (operation.options === undefined || isReadonlyArrayEmpty(operation.options))
|
|
156
|
+
return operation.text;
|
|
157
|
+
const options = join(map3(operation.options, (option) => `- ${option}`), `
|
|
158
|
+
`);
|
|
159
|
+
if (isEmpty(operation.text))
|
|
160
|
+
return options;
|
|
161
|
+
return `${operation.text}
|
|
162
|
+
|
|
163
|
+
${options}`;
|
|
164
|
+
}
|
|
165
|
+
function inScope(owner, name, settings) {
|
|
166
|
+
return isReadonlyArrayEmpty(settings.repositories) || some2(settings.repositories, (repository) => toLowerCase(repository) === toLowerCase(`${owner}/${name}`));
|
|
167
|
+
}
|
|
168
|
+
function checkAccess(identity, context) {
|
|
169
|
+
const settings = context.deploymentSettings;
|
|
170
|
+
return succeed5({ decision: pipe(value2(exists(issueOf(identity.conversation), (issue) => inScope(issue.owner, issue.name, settings)) && is(GitHubId2)(identity.senderKey) && (settings.access === "open" || contains(settings.allowedSenderKeys, identity.senderKey))), when(true, () => "allow"), orElse2(() => "deny")) });
|
|
171
|
+
}
|
|
172
|
+
var receive = fn("GitHubApp.receive")(function* (command, installation, context) {
|
|
173
|
+
const result = {
|
|
174
|
+
events: [],
|
|
175
|
+
kind: "receive",
|
|
176
|
+
operationKey: command.operationKey,
|
|
177
|
+
response: {
|
|
178
|
+
body: "",
|
|
179
|
+
status: 200
|
|
180
|
+
},
|
|
181
|
+
verified: true
|
|
182
|
+
};
|
|
183
|
+
const event = yield* pipe(header2(command.request, "x-github-event"), fromOption2, mapError2(rejected));
|
|
184
|
+
const settings = context.deploymentSettings;
|
|
185
|
+
const found = filter(yield* parse2(event, command.request.body), (message) => `${message.installationId}` === installation.installationId && `${message.author.id}` !== command.state.botUserId && !isEmpty(message.text) && inScope(message.owner, message.repository, settings));
|
|
186
|
+
const client = yield* GitHubAppClient2;
|
|
187
|
+
return yield* match2(found, {
|
|
188
|
+
onNone: () => succeed5(result),
|
|
189
|
+
onSome: fnUntraced(function* (message) {
|
|
190
|
+
const respond = (settings.access === "open" || contains(settings.allowedSenderKeys, `${message.author.id}`)) && (settings.respondTo === "all_messages" || mentions2(message.text, command.state.slug)) && rank[yield* client.permission(installation, {
|
|
191
|
+
name: message.repository,
|
|
192
|
+
owner: message.owner
|
|
193
|
+
}, message.author.login)] >= rank[settings.mentionPermission];
|
|
194
|
+
return {
|
|
195
|
+
...result,
|
|
196
|
+
events: [{
|
|
197
|
+
content: { text: message.text },
|
|
198
|
+
conversation: {
|
|
199
|
+
conversationKey: conversationKey2(message.owner, message.repository, message.number),
|
|
200
|
+
kind: "group"
|
|
201
|
+
},
|
|
202
|
+
eventKey: yield* pipe(encodeEffect(fromJsonString(Tuple([
|
|
203
|
+
String3,
|
|
204
|
+
String3,
|
|
205
|
+
Natural,
|
|
206
|
+
String3,
|
|
207
|
+
AgentChannel_exports.Timestamp
|
|
208
|
+
])))([
|
|
209
|
+
message.owner,
|
|
210
|
+
message.repository,
|
|
211
|
+
message.number,
|
|
212
|
+
message.messageKey,
|
|
213
|
+
message.timestamp
|
|
214
|
+
]), mapError2(rejected)),
|
|
215
|
+
kind: "message",
|
|
216
|
+
messageKey: message.messageKey,
|
|
217
|
+
respond,
|
|
218
|
+
senderKey: `${message.author.id}`,
|
|
219
|
+
timestamp: message.timestamp
|
|
220
|
+
}]
|
|
221
|
+
};
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
var deliver = fn("GitHubApp.deliver")(function* (command, installation) {
|
|
226
|
+
const issue = yield* pipe(issueOf(command.destination), fromOption2, mapError2(rejected));
|
|
227
|
+
const client = yield* GitHubAppClient2;
|
|
228
|
+
function succeeded(providerDeliveryKey) {
|
|
229
|
+
return {
|
|
230
|
+
deliveryKey: command.deliveryKey,
|
|
231
|
+
kind: "deliver",
|
|
232
|
+
operationKey: command.operationKey,
|
|
233
|
+
providerDeliveryKey,
|
|
234
|
+
status: "succeeded"
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
const post = fnUntraced(function* (text) {
|
|
238
|
+
if (fromIterable(text).length > 65536)
|
|
239
|
+
return yield* rejected();
|
|
240
|
+
return yield* client.postComment(installation, issue, text);
|
|
241
|
+
});
|
|
242
|
+
const ownedComment = fnUntraced(function* (reference) {
|
|
243
|
+
const id = yield* pipe(liftPredicate(reference, is(GitHubId2)), fromOption2, mapError2(rejected));
|
|
244
|
+
return {
|
|
245
|
+
exists: yield* client.checkOwnComment(installation, issue, id, command.state.botUserId),
|
|
246
|
+
id
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
const activation = fromUndefinedOr(command.activationMessageKey);
|
|
250
|
+
return yield* pipe(value2(command.operation), discriminatorsExhaustive("kind")({
|
|
251
|
+
create_message: (operation) => map4(post(operation.text), succeeded),
|
|
252
|
+
delete_message: fnUntraced(function* (operation) {
|
|
253
|
+
const found = yield* ownedComment(operation.reference);
|
|
254
|
+
if (found.exists)
|
|
255
|
+
yield* client.deleteComment(installation, issue, found.id);
|
|
256
|
+
return succeeded(operation.reference);
|
|
257
|
+
}),
|
|
258
|
+
present_outcome: fnUntraced(function* (operation) {
|
|
259
|
+
const text = outcomeText(operation);
|
|
260
|
+
return succeeded(yield* pipe(value2(isEmpty(text)), when(true, () => succeed5(command.deliveryKey)), orElse2(() => post(text))));
|
|
261
|
+
}),
|
|
262
|
+
render_plan: fnUntraced(function* (operation) {
|
|
263
|
+
const text = planMarkdown(operation.plan);
|
|
264
|
+
if (fromIterable(text).length > 65536)
|
|
265
|
+
return yield* rejected();
|
|
266
|
+
if (operation.reference === undefined)
|
|
267
|
+
return succeeded(yield* post(text));
|
|
268
|
+
const reference = yield* ownedComment(operation.reference);
|
|
269
|
+
if (reference.exists && (yield* client.editComment(installation, issue, reference.id, text)))
|
|
270
|
+
return succeeded(reference.id);
|
|
271
|
+
return succeeded(yield* post(text));
|
|
272
|
+
}),
|
|
273
|
+
set_activity: () => rejected(),
|
|
274
|
+
set_reaction: fnUntraced(function* (operation) {
|
|
275
|
+
const found = yield* pipe(value2(operation.target), when({ kind: "activation" }, () => pipe(activation, flatMap((value) => reactionTarget(issue, value)), fromOption2, mapError2(rejected))), when({ kind: "message" }, fnUntraced(function* (message) {
|
|
276
|
+
const owned = yield* ownedComment(message.reference);
|
|
277
|
+
if (!owned.exists)
|
|
278
|
+
return yield* rejected();
|
|
279
|
+
return {
|
|
280
|
+
id: owned.id,
|
|
281
|
+
kind: "comment"
|
|
282
|
+
};
|
|
283
|
+
})), exhaustive);
|
|
284
|
+
yield* client.react(installation, issue, found, reactions[operation.reaction], operation.active);
|
|
285
|
+
return succeeded(command.deliveryKey);
|
|
286
|
+
}),
|
|
287
|
+
update_message: fnUntraced(function* (operation) {
|
|
288
|
+
const reference = yield* ownedComment(operation.reference);
|
|
289
|
+
if (!reference.exists)
|
|
290
|
+
return yield* rejected();
|
|
291
|
+
if (fromIterable(operation.text).length > 65536)
|
|
292
|
+
return yield* rejected();
|
|
293
|
+
if (!(yield* client.editComment(installation, issue, reference.id, operation.text)))
|
|
294
|
+
return yield* rejected();
|
|
295
|
+
return succeeded(reference.id);
|
|
296
|
+
})
|
|
297
|
+
}));
|
|
298
|
+
});
|
|
299
|
+
var readContext = fn("GitHubApp.readContext")(function* (command, installation) {
|
|
300
|
+
const issue = yield* pipe(issueOf(command.destination), fromOption2, mapError2(rejected));
|
|
301
|
+
const found = yield* (yield* GitHubAppClient2).readComments(installation, issue, command.limit);
|
|
302
|
+
function own(id) {
|
|
303
|
+
return `${id}` === command.state.botUserId;
|
|
304
|
+
}
|
|
305
|
+
const opening = map(fromNullishOr(found.issue.user), (user) => ({
|
|
306
|
+
messageKey: conversationKey2(issue.owner, issue.name, issue.number),
|
|
307
|
+
own: own(user.id),
|
|
308
|
+
senderKey: `${user.id}`,
|
|
309
|
+
senderName: user.login,
|
|
310
|
+
text: slice(0, 65536)(trim(join([found.issue.title, found.issue.body ?? ""], `
|
|
311
|
+
|
|
312
|
+
`))),
|
|
313
|
+
timestamp: found.issue.created_at
|
|
314
|
+
}));
|
|
315
|
+
const comments = getSomes(map3(found.comments, (comment) => map(fromNullishOr(comment.user), (user) => ({
|
|
316
|
+
messageKey: `comment/${comment.id}`,
|
|
317
|
+
own: own(user.id),
|
|
318
|
+
senderKey: `${user.id}`,
|
|
319
|
+
senderName: user.login,
|
|
320
|
+
text: comment.body ?? "",
|
|
321
|
+
timestamp: comment.created_at
|
|
322
|
+
}))));
|
|
323
|
+
const messages = pipe(value2(found.comments.length === found.issue.comments), when(true, () => appendAll(toArray(opening), comments)), orElse2(() => comments));
|
|
324
|
+
return AgentChannel_exports.contextResult(command.operationKey, takeRight(messages, command.limit));
|
|
325
|
+
});
|
|
326
|
+
var execute = fn("GitHubApp.execute")(function* (command, context) {
|
|
327
|
+
const auth = context.auth;
|
|
328
|
+
const settings = context.deploymentSettings;
|
|
329
|
+
if (command.kind === "activate") {
|
|
330
|
+
if (command.state !== undefined && (command.state.appId !== auth.value.appId || command.state.installationId !== settings.installationId))
|
|
331
|
+
return yield* AgentChannel_exports.HandlerError.make({ code: "unauthorized" });
|
|
332
|
+
const client = yield* GitHubAppClient2;
|
|
333
|
+
const found = yield* client.checkInstallation({
|
|
334
|
+
auth: auth.value,
|
|
335
|
+
installationId: settings.installationId
|
|
336
|
+
});
|
|
337
|
+
yield* client.registerWebhook(auth.value, command.ingressUrl);
|
|
338
|
+
return {
|
|
339
|
+
installationKey: installationKey(auth.value.appId, settings.installationId),
|
|
340
|
+
kind: "activate",
|
|
341
|
+
operationKey: command.operationKey,
|
|
342
|
+
state: {
|
|
343
|
+
appId: auth.value.appId,
|
|
344
|
+
botUserId: found.botUserId,
|
|
345
|
+
ingressUrl: command.ingressUrl,
|
|
346
|
+
installationId: settings.installationId,
|
|
347
|
+
slug: found.slug
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
if (command.installationKey !== installationKey(auth.value.appId, settings.installationId) || command.state.appId !== auth.value.appId || command.state.installationId !== settings.installationId)
|
|
352
|
+
return yield* AgentChannel_exports.HandlerError.make({ code: "unauthorized" });
|
|
353
|
+
const installation = {
|
|
354
|
+
auth: auth.value,
|
|
355
|
+
installationId: settings.installationId
|
|
356
|
+
};
|
|
357
|
+
return yield* pipe(value2(command), discriminatorsExhaustive("kind")({
|
|
358
|
+
deactivate: (deactivated) => succeed5({
|
|
359
|
+
kind: "deactivate",
|
|
360
|
+
operationKey: deactivated.operationKey
|
|
361
|
+
}),
|
|
362
|
+
deliver: (delivery) => deliver(delivery, installation),
|
|
363
|
+
read_asset: () => fail5(rejected()),
|
|
364
|
+
read_context: (read) => readContext(read, installation),
|
|
365
|
+
receive: (received) => receive(received, installation, context)
|
|
366
|
+
}));
|
|
367
|
+
});
|
|
368
|
+
var gitHubAppHandlers2 = Plugin_exports.toLayer(gitHubAppPluginBase2, (handlers) => handlers.channel("agent-issues", {
|
|
369
|
+
checkAccess,
|
|
370
|
+
execute,
|
|
371
|
+
verify: (request, context) => verify2(request, context.auth.value.webhookSecret)
|
|
372
|
+
}));
|
|
373
|
+
var githubChannelLayer2 = gitHubAppHandlers2.pipe(provide(GitHubAppClient2.layer), provide(layer2));
|
|
374
|
+
export { gitHubAppHandlers2, githubChannelLayer2 };
|
|
375
|
+
|
|
376
|
+
//# debugId=1571922E5014769064756E2164756E21
|
|
377
|
+
//# sourceMappingURL=plugin-e0mt19z7.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../bundle-input/dist/channel/github-app.js"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { ConversationKey, GitHubId, gitHubAppPluginBase } from \"./github-app-definition.js\";\nimport { conversationKey, header, mentions, parse, verify } from \"./internal/webhook.js\";\nimport { GitHubAppClient } from \"./github-app-client.js\";\nimport { Array, Effect, Layer, Match, Number, Option, Schema, String, pipe } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { AgentChannel, Plugin } from \"@dual-os/sdk\";\n//#region src/channel/github-app.ts\nconst CommentKey = Schema.String.check(Schema.isPattern(/^(?:comment|review-comment)\\/[1-9][0-9]{0,19}$/u));\nconst rank = {\n\tadmin: 5,\n\tmaintain: 4,\n\tnone: 0,\n\tread: 1,\n\ttriage: 2,\n\twrite: 3\n};\nconst reactions = {\n\tconfused: \"confused\",\n\teyes: \"eyes\",\n\theart: \"heart\",\n\thooray: \"hooray\",\n\tlaugh: \"laugh\",\n\trocket: \"rocket\",\n\tthumbs_down: \"-1\",\n\tthumbs_up: \"+1\"\n};\nconst marks = {\n\tcompleted: \"✅\",\n\tfailed: \"❌\",\n\tin_progress: \"🔄\",\n\tpending: \"⬜\"\n};\nfunction rejected() {\n\treturn AgentChannel.HandlerError.make({ code: \"rejected\" });\n}\nfunction installationKey(appId, installationId) {\n\treturn `${appId}/${installationId}`;\n}\nfunction issueOf(destination) {\n\tif (destination.kind !== \"group\" || destination.threadKey !== void 0 || !Schema.is(ConversationKey)(destination.conversationKey)) return Option.none();\n\tconst [path = \"\", number = \"\"] = String.split(\"#\")(destination.conversationKey);\n\tconst [owner = \"\", name = \"\"] = String.split(\"/\")(path);\n\treturn Option.map(Number.parse(number), (parsed) => ({\n\t\tname,\n\t\tnumber: parsed,\n\t\towner\n\t}));\n}\nfunction reactionTarget(issue, key) {\n\tif (key === `${issue.owner}/${issue.name}#${issue.number}`) return Option.some({ kind: \"issue\" });\n\tif (Schema.is(GitHubId)(key)) return Option.some({\n\t\tid: key,\n\t\tkind: \"comment\"\n\t});\n\tif (!Schema.is(CommentKey)(key)) return Option.none();\n\tconst [kind = \"\", id = \"\"] = String.split(\"/\")(key);\n\tif (kind === \"review-comment\") return Option.some({\n\t\tid,\n\t\tkind: \"review-comment\"\n\t});\n\treturn Option.some({\n\t\tid,\n\t\tkind: \"comment\"\n\t});\n}\nconst oneLine = String.replaceAll(/\\s*\\n\\s*/gu, \" \");\nfunction planMarkdown(plan) {\n\tconst items = Array.map(plan.items, (item) => {\n\t\tconst entry = `- ${marks[item.state]} ${oneLine(item.title)}`;\n\t\tif (item.note === void 0) return entry;\n\t\treturn `${entry}: ${oneLine(item.note)}`;\n\t});\n\tif (Array.isReadonlyArrayEmpty(items)) return `**${oneLine(plan.title ?? \"Plan\")}**\\n\\n_No steps yet._`;\n\treturn Array.join([\n\t\t`**${oneLine(plan.title ?? \"Plan\")}**`,\n\t\t\"\",\n\t\t...items\n\t], \"\\n\");\n}\nfunction outcomeText(operation) {\n\tif (operation.options === void 0 || Array.isReadonlyArrayEmpty(operation.options)) return operation.text;\n\tconst options = Array.join(Array.map(operation.options, (option) => `- ${option}`), \"\\n\");\n\tif (String.isEmpty(operation.text)) return options;\n\treturn `${operation.text}\\n\\n${options}`;\n}\nfunction inScope(owner, name, settings) {\n\treturn Array.isReadonlyArrayEmpty(settings.repositories) || Array.some(settings.repositories, (repository) => String.toLowerCase(repository) === String.toLowerCase(`${owner}/${name}`));\n}\nfunction checkAccess(identity, context) {\n\tconst settings = context.deploymentSettings;\n\treturn Effect.succeed({ decision: pipe(Match.value(Option.exists(issueOf(identity.conversation), (issue) => inScope(issue.owner, issue.name, settings)) && Schema.is(GitHubId)(identity.senderKey) && (settings.access === \"open\" || Array.contains(settings.allowedSenderKeys, identity.senderKey))), Match.when(true, () => \"allow\"), Match.orElse(() => \"deny\")) });\n}\nconst receive = Effect.fn(\"GitHubApp.receive\")(function* (command, installation, context) {\n\tconst result = {\n\t\tevents: [],\n\t\tkind: \"receive\",\n\t\toperationKey: command.operationKey,\n\t\tresponse: {\n\t\t\tbody: \"\",\n\t\t\tstatus: 200\n\t\t},\n\t\tverified: true\n\t};\n\tconst event = yield* pipe(header(command.request, \"x-github-event\"), Effect.fromOption, Effect.mapError(rejected));\n\tconst settings = context.deploymentSettings;\n\tconst found = Option.filter(yield* parse(event, command.request.body), (message) => `${message.installationId}` === installation.installationId && `${message.author.id}` !== command.state.botUserId && !String.isEmpty(message.text) && inScope(message.owner, message.repository, settings));\n\tconst client = yield* GitHubAppClient;\n\treturn yield* Option.match(found, {\n\t\tonNone: () => Effect.succeed(result),\n\t\tonSome: Effect.fnUntraced(function* (message) {\n\t\t\tconst respond = (settings.access === \"open\" || Array.contains(settings.allowedSenderKeys, `${message.author.id}`)) && (settings.respondTo === \"all_messages\" || mentions(message.text, command.state.slug)) && rank[yield* client.permission(installation, {\n\t\t\t\tname: message.repository,\n\t\t\t\towner: message.owner\n\t\t\t}, message.author.login)] >= rank[settings.mentionPermission];\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\tevents: [{\n\t\t\t\t\tcontent: { text: message.text },\n\t\t\t\t\tconversation: {\n\t\t\t\t\t\tconversationKey: conversationKey(message.owner, message.repository, message.number),\n\t\t\t\t\t\tkind: \"group\"\n\t\t\t\t\t},\n\t\t\t\t\teventKey: yield* pipe(Schema.encodeEffect(Schema.fromJsonString(Schema.Tuple([\n\t\t\t\t\t\tSchema.String,\n\t\t\t\t\t\tSchema.String,\n\t\t\t\t\t\tSchema.Natural,\n\t\t\t\t\t\tSchema.String,\n\t\t\t\t\t\tAgentChannel.Timestamp\n\t\t\t\t\t])))([\n\t\t\t\t\t\tmessage.owner,\n\t\t\t\t\t\tmessage.repository,\n\t\t\t\t\t\tmessage.number,\n\t\t\t\t\t\tmessage.messageKey,\n\t\t\t\t\t\tmessage.timestamp\n\t\t\t\t\t]), Effect.mapError(rejected)),\n\t\t\t\t\tkind: \"message\",\n\t\t\t\t\tmessageKey: message.messageKey,\n\t\t\t\t\trespond,\n\t\t\t\t\tsenderKey: `${message.author.id}`,\n\t\t\t\t\ttimestamp: message.timestamp\n\t\t\t\t}]\n\t\t\t};\n\t\t})\n\t});\n});\nconst deliver = Effect.fn(\"GitHubApp.deliver\")(function* (command, installation) {\n\tconst issue = yield* pipe(issueOf(command.destination), Effect.fromOption, Effect.mapError(rejected));\n\tconst client = yield* GitHubAppClient;\n\tfunction succeeded(providerDeliveryKey) {\n\t\treturn {\n\t\t\tdeliveryKey: command.deliveryKey,\n\t\t\tkind: \"deliver\",\n\t\t\toperationKey: command.operationKey,\n\t\t\tproviderDeliveryKey,\n\t\t\tstatus: \"succeeded\"\n\t\t};\n\t}\n\tconst post = Effect.fnUntraced(function* (text) {\n\t\tif (Array.fromIterable(text).length > 65536) return yield* rejected();\n\t\treturn yield* client.postComment(installation, issue, text);\n\t});\n\tconst ownedComment = Effect.fnUntraced(function* (reference) {\n\t\tconst id = yield* pipe(Option.liftPredicate(reference, Schema.is(GitHubId)), Effect.fromOption, Effect.mapError(rejected));\n\t\treturn {\n\t\t\texists: yield* client.checkOwnComment(installation, issue, id, command.state.botUserId),\n\t\t\tid\n\t\t};\n\t});\n\tconst activation = Option.fromUndefinedOr(command.activationMessageKey);\n\treturn yield* pipe(Match.value(command.operation), Match.discriminatorsExhaustive(\"kind\")({\n\t\tcreate_message: (operation) => Effect.map(post(operation.text), succeeded),\n\t\tdelete_message: Effect.fnUntraced(function* (operation) {\n\t\t\tconst found = yield* ownedComment(operation.reference);\n\t\t\tif (found.exists) yield* client.deleteComment(installation, issue, found.id);\n\t\t\treturn succeeded(operation.reference);\n\t\t}),\n\t\tpresent_outcome: Effect.fnUntraced(function* (operation) {\n\t\t\tconst text = outcomeText(operation);\n\t\t\treturn succeeded(yield* pipe(Match.value(String.isEmpty(text)), Match.when(true, () => Effect.succeed(command.deliveryKey)), Match.orElse(() => post(text))));\n\t\t}),\n\t\trender_plan: Effect.fnUntraced(function* (operation) {\n\t\t\tconst text = planMarkdown(operation.plan);\n\t\t\tif (Array.fromIterable(text).length > 65536) return yield* rejected();\n\t\t\tif (operation.reference === void 0) return succeeded(yield* post(text));\n\t\t\tconst reference = yield* ownedComment(operation.reference);\n\t\t\tif (reference.exists && (yield* client.editComment(installation, issue, reference.id, text))) return succeeded(reference.id);\n\t\t\treturn succeeded(yield* post(text));\n\t\t}),\n\t\tset_activity: () => rejected(),\n\t\tset_reaction: Effect.fnUntraced(function* (operation) {\n\t\t\tconst found = yield* pipe(Match.value(operation.target), Match.when({ kind: \"activation\" }, () => pipe(activation, Option.flatMap((value) => reactionTarget(issue, value)), Effect.fromOption, Effect.mapError(rejected))), Match.when({ kind: \"message\" }, Effect.fnUntraced(function* (message) {\n\t\t\t\tconst owned = yield* ownedComment(message.reference);\n\t\t\t\tif (!owned.exists) return yield* rejected();\n\t\t\t\treturn {\n\t\t\t\t\tid: owned.id,\n\t\t\t\t\tkind: \"comment\"\n\t\t\t\t};\n\t\t\t})), Match.exhaustive);\n\t\t\tyield* client.react(installation, issue, found, reactions[operation.reaction], operation.active);\n\t\t\treturn succeeded(command.deliveryKey);\n\t\t}),\n\t\tupdate_message: Effect.fnUntraced(function* (operation) {\n\t\t\tconst reference = yield* ownedComment(operation.reference);\n\t\t\tif (!reference.exists) return yield* rejected();\n\t\t\tif (Array.fromIterable(operation.text).length > 65536) return yield* rejected();\n\t\t\tif (!(yield* client.editComment(installation, issue, reference.id, operation.text))) return yield* rejected();\n\t\t\treturn succeeded(reference.id);\n\t\t})\n\t}));\n});\nconst readContext = Effect.fn(\"GitHubApp.readContext\")(function* (command, installation) {\n\tconst issue = yield* pipe(issueOf(command.destination), Effect.fromOption, Effect.mapError(rejected));\n\tconst found = yield* (yield* GitHubAppClient).readComments(installation, issue, command.limit);\n\tfunction own(id) {\n\t\treturn `${id}` === command.state.botUserId;\n\t}\n\tconst opening = Option.map(Option.fromNullishOr(found.issue.user), (user) => ({\n\t\tmessageKey: conversationKey(issue.owner, issue.name, issue.number),\n\t\town: own(user.id),\n\t\tsenderKey: `${user.id}`,\n\t\tsenderName: user.login,\n\t\ttext: String.slice(0, 65536)(String.trim(Array.join([found.issue.title, found.issue.body ?? \"\"], \"\\n\\n\"))),\n\t\ttimestamp: found.issue.created_at\n\t}));\n\tconst comments = Array.getSomes(Array.map(found.comments, (comment) => Option.map(Option.fromNullishOr(comment.user), (user) => ({\n\t\tmessageKey: `comment/${comment.id}`,\n\t\town: own(user.id),\n\t\tsenderKey: `${user.id}`,\n\t\tsenderName: user.login,\n\t\ttext: comment.body ?? \"\",\n\t\ttimestamp: comment.created_at\n\t}))));\n\tconst messages = pipe(Match.value(found.comments.length === found.issue.comments), Match.when(true, () => Array.appendAll(Option.toArray(opening), comments)), Match.orElse(() => comments));\n\treturn AgentChannel.contextResult(command.operationKey, Array.takeRight(messages, command.limit));\n});\nconst execute = Effect.fn(\"GitHubApp.execute\")(function* (command, context) {\n\tconst auth = context.auth;\n\tconst settings = context.deploymentSettings;\n\tif (command.kind === \"activate\") {\n\t\tif (command.state !== void 0 && (command.state.appId !== auth.value.appId || command.state.installationId !== settings.installationId)) return yield* AgentChannel.HandlerError.make({ code: \"unauthorized\" });\n\t\tconst client = yield* GitHubAppClient;\n\t\tconst found = yield* client.checkInstallation({\n\t\t\tauth: auth.value,\n\t\t\tinstallationId: settings.installationId\n\t\t});\n\t\tyield* client.registerWebhook(auth.value, command.ingressUrl);\n\t\treturn {\n\t\t\tinstallationKey: installationKey(auth.value.appId, settings.installationId),\n\t\t\tkind: \"activate\",\n\t\t\toperationKey: command.operationKey,\n\t\t\tstate: {\n\t\t\t\tappId: auth.value.appId,\n\t\t\t\tbotUserId: found.botUserId,\n\t\t\t\tingressUrl: command.ingressUrl,\n\t\t\t\tinstallationId: settings.installationId,\n\t\t\t\tslug: found.slug\n\t\t\t}\n\t\t};\n\t}\n\tif (command.installationKey !== installationKey(auth.value.appId, settings.installationId) || command.state.appId !== auth.value.appId || command.state.installationId !== settings.installationId) return yield* AgentChannel.HandlerError.make({ code: \"unauthorized\" });\n\tconst installation = {\n\t\tauth: auth.value,\n\t\tinstallationId: settings.installationId\n\t};\n\treturn yield* pipe(Match.value(command), Match.discriminatorsExhaustive(\"kind\")({\n\t\tdeactivate: (deactivated) => Effect.succeed({\n\t\t\tkind: \"deactivate\",\n\t\t\toperationKey: deactivated.operationKey\n\t\t}),\n\t\tdeliver: (delivery) => deliver(delivery, installation),\n\t\tread_asset: () => Effect.fail(rejected()),\n\t\tread_context: (read) => readContext(read, installation),\n\t\treceive: (received) => receive(received, installation, context)\n\t}));\n});\nconst gitHubAppHandlers = Plugin.toLayer(gitHubAppPluginBase, (handlers) => handlers.channel(\"agent-issues\", {\n\tcheckAccess,\n\texecute,\n\tverify: (request, context) => verify(request, context.auth.value.webhookSecret)\n}));\nconst githubChannelLayer = gitHubAppHandlers.pipe(Layer.provide(GitHubAppClient.layer), Layer.provide(FetchHttpClient.layer));\n//#endregion\nexport { gitHubAppHandlers, github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