@a5c-ai/channels-adapter 5.1.1-staging.5ee7f5f98b91

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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +661 -0
  3. package/dist/backend.d.ts +7 -0
  4. package/dist/backend.d.ts.map +1 -0
  5. package/dist/backend.js +22 -0
  6. package/dist/backend.js.map +1 -0
  7. package/dist/backends/github.d.ts +16 -0
  8. package/dist/backends/github.d.ts.map +1 -0
  9. package/dist/backends/github.js +357 -0
  10. package/dist/backends/github.js.map +1 -0
  11. package/dist/backends/jira.d.ts +18 -0
  12. package/dist/backends/jira.d.ts.map +1 -0
  13. package/dist/backends/jira.js +256 -0
  14. package/dist/backends/jira.js.map +1 -0
  15. package/dist/backends/webhook.d.ts +25 -0
  16. package/dist/backends/webhook.d.ts.map +1 -0
  17. package/dist/backends/webhook.js +206 -0
  18. package/dist/backends/webhook.js.map +1 -0
  19. package/dist/cli.d.ts +2 -0
  20. package/dist/cli.d.ts.map +1 -0
  21. package/dist/cli.js +28 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/config.d.ts +10 -0
  24. package/dist/config.d.ts.map +1 -0
  25. package/dist/config.js +323 -0
  26. package/dist/config.js.map +1 -0
  27. package/dist/dedup.d.ts +26 -0
  28. package/dist/dedup.d.ts.map +1 -0
  29. package/dist/dedup.js +68 -0
  30. package/dist/dedup.js.map +1 -0
  31. package/dist/filter.d.ts +9 -0
  32. package/dist/filter.d.ts.map +1 -0
  33. package/dist/filter.js +115 -0
  34. package/dist/filter.js.map +1 -0
  35. package/dist/index.d.ts +14 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +21 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/poller.d.ts +63 -0
  40. package/dist/poller.d.ts.map +1 -0
  41. package/dist/poller.js +195 -0
  42. package/dist/poller.js.map +1 -0
  43. package/dist/registry.d.ts +22 -0
  44. package/dist/registry.d.ts.map +1 -0
  45. package/dist/registry.js +59 -0
  46. package/dist/registry.js.map +1 -0
  47. package/dist/relay.d.ts +58 -0
  48. package/dist/relay.d.ts.map +1 -0
  49. package/dist/relay.js +172 -0
  50. package/dist/relay.js.map +1 -0
  51. package/dist/runtime.d.ts +27 -0
  52. package/dist/runtime.d.ts.map +1 -0
  53. package/dist/runtime.js +198 -0
  54. package/dist/runtime.js.map +1 -0
  55. package/dist/server.d.ts +64 -0
  56. package/dist/server.d.ts.map +1 -0
  57. package/dist/server.js +217 -0
  58. package/dist/server.js.map +1 -0
  59. package/dist/spawner.d.ts +96 -0
  60. package/dist/spawner.d.ts.map +1 -0
  61. package/dist/spawner.js +368 -0
  62. package/dist/spawner.js.map +1 -0
  63. package/dist/state.d.ts +43 -0
  64. package/dist/state.d.ts.map +1 -0
  65. package/dist/state.js +92 -0
  66. package/dist/state.js.map +1 -0
  67. package/dist/types.d.ts +140 -0
  68. package/dist/types.d.ts.map +1 -0
  69. package/dist/types.js +10 -0
  70. package/dist/types.js.map +1 -0
  71. package/package.json +78 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAWvE"}
@@ -0,0 +1,22 @@
1
+ // Backend hook interface + the `defineBackend` identity helper (SPEC §4,
2
+ // DESIGN §2). A backend is a plain module exporting a `Backend` object. The
3
+ // framework never imports a real HTTP client into a backend — all network access
4
+ // goes through the injected `http` so tests can supply a fake.
5
+ /**
6
+ * Identity helper that gives custom-backend authors editor support (the
7
+ * `Backend` type) and asserts the required hooks are present, turning a missing
8
+ * hook into a clear authoring-time error rather than a confusing poll-time crash.
9
+ */
10
+ export function defineBackend(backend) {
11
+ if (!backend || typeof backend !== 'object') {
12
+ throw new Error('defineBackend: expected a backend object');
13
+ }
14
+ if (typeof backend.poll !== 'function') {
15
+ throw new Error('defineBackend: backend is missing a required `poll(ctx)` function');
16
+ }
17
+ if (typeof backend.reply !== 'function') {
18
+ throw new Error('defineBackend: backend is missing a required `reply(args)` function');
19
+ }
20
+ return backend;
21
+ }
22
+ //# sourceMappingURL=backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,iFAAiF;AACjF,+DAA+D;AAI/D;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAA6B,OAAU;IAClE,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;IACvF,CAAC;IACD,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { PollContext, PollResult, ReplyArgs, ReplyResult } from '../types.js';
2
+ declare const _default: {
3
+ type: string;
4
+ /**
5
+ * Validate a GitHub source at config-load time so misconfiguration is a clear
6
+ * validation error rather than a crash at poll time (SPEC §4.1, AC-3). Requires
7
+ * config.repo as "owner/name", a non-empty events list, and auth.token.
8
+ */
9
+ validateConfig(source: Record<string, unknown>): string[];
10
+ poll(ctx: PollContext): Promise<PollResult>;
11
+ /**
12
+ * Post a comment back to the originating issue/PR.
13
+ */
14
+ reply({ routing, text, source, http }: ReplyArgs): Promise<ReplyResult>;
15
+ };
16
+ export default _default;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/backends/github.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAgB,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;;;IA0T/F;;;;OAIG;2BACoB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE;cA+BzC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAYjD;;OAEG;2CAC0C,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;;AAtD/E,wBAuEG"}
@@ -0,0 +1,357 @@
1
+ // GitHub backend (SPEC §4.1 / §5.1, DESIGN §5.1).
2
+ //
3
+ // Supports two event kinds:
4
+ // - issue_comment: GET /repos/{o}/{r}/issues/comments?sort=updated&direction=asc&since=<cursor>
5
+ // Each comment resolves its parent issue from `issue_url` (one GET, cached
6
+ // per issue within the poll) so filters like `issue.assignee.login` work.
7
+ // Dedup id = gh:comment:<id> (default) or gh:comment:<id>:<updated_at>
8
+ // (config.retriggerOnEdit) so an edit re-triggers only when configured.
9
+ // Cursor = max updated_at observed.
10
+ // - issue_opened: GET /repos/{o}/{r}/issues?state=open&sort=created&direction=asc&since=<cursor>
11
+ // post-filtered to created_at > cursor (GitHub `since` is updated-based).
12
+ // Dedup id = gh:issue:<id>. Cursor = max created_at.
13
+ // - pr_opened: GET /repos/{o}/{r}/pulls?state=open&sort=created&direction=asc
14
+ // post-filtered to created_at >= cursor (the /pulls endpoint has no `since`).
15
+ // Dedup id = gh:pr:<id>. Cursor = max created_at. A PR is an issue for the
16
+ // comments API, so routing uses the PR number and a reply posts to
17
+ // /issues/{number}/comments.
18
+ //
19
+ // All network access goes through the injected `http` (fetch-like) so tests run
20
+ // offline. The core is the authoritative filter + dedup gate; this backend also
21
+ // applies the seen-set fallback so a direct `poll` (unit test) is at-most-once
22
+ // across overlapping `since` windows on its own.
23
+ import { defineBackend } from '../backend.js';
24
+ import { deriveNew } from '../dedup.js';
25
+ const DEFAULT_BASE = 'https://api.github.com';
26
+ /** Resolve the API base URL (overridable for GitHub Enterprise). */
27
+ function baseUrlFor(source) {
28
+ const cfg = source?.config || {};
29
+ return String(cfg.baseUrl || cfg.apiBaseUrl || DEFAULT_BASE).replace(/\/+$/, '');
30
+ }
31
+ /** Split "owner/name" into { owner, repo }. */
32
+ function splitRepo(repo) {
33
+ const [owner, name] = String(repo || '').split('/');
34
+ return { owner, repo: name };
35
+ }
36
+ /** Authenticated request headers for the GitHub REST API. */
37
+ function ghHeaders(source) {
38
+ return {
39
+ authorization: `Bearer ${source?.auth?.token}`,
40
+ accept: 'application/vnd.github+json'
41
+ };
42
+ }
43
+ /** Pick the lexicographically-max ISO timestamp (ISO-8601 sorts chronologically). */
44
+ function maxTimestamp(values, start) {
45
+ let max = start ?? null;
46
+ for (const v of values) {
47
+ if (v && (max == null || v > max))
48
+ max = v;
49
+ }
50
+ return max;
51
+ }
52
+ /** Parse the issue number out of a comment's `issue_url`. */
53
+ function issueNumberFromUrl(issueUrl) {
54
+ const m = /\/issues\/(\d+)(?:$|\?)/.exec(String(issueUrl || ''));
55
+ return m ? Number(m[1]) : undefined;
56
+ }
57
+ /** Extract the `rel="next"` URL from a GitHub `Link` header, or null. */
58
+ function nextLink(res) {
59
+ const header = res?.headers?.get?.('link') || res?.headers?.get?.('Link');
60
+ if (!header)
61
+ return null;
62
+ // Link: <https://api.github.com/...?page=2>; rel="next", <...>; rel="last"
63
+ for (const part of String(header).split(',')) {
64
+ const m = /<([^>]+)>\s*;\s*rel="?next"?/i.exec(part);
65
+ if (m)
66
+ return m[1];
67
+ }
68
+ return null;
69
+ }
70
+ /**
71
+ * Fetch ALL pages of a GitHub list endpoint by following `Link: rel="next"`.
72
+ * Returns `{ ok, items }`. On ANY non-2xx page it returns `{ ok:false }` with the
73
+ * items gathered so far discarded by the caller — a failed poll must NOT advance
74
+ * the cursor or mark items seen (SPEC §5, finding §4/§5). A `maxPages` guard
75
+ * prevents a pathological loop.
76
+ */
77
+ async function fetchAllPages(firstUrl, { http, source, maxPages = 50 }) {
78
+ const items = [];
79
+ let url = firstUrl;
80
+ let pages = 0;
81
+ while (url && pages < maxPages) {
82
+ const res = (await http(url, { method: 'GET', headers: ghHeaders(source) }));
83
+ if (!res || !res.ok)
84
+ return { ok: false, items: [] };
85
+ const page = await res.json().catch(() => null);
86
+ if (Array.isArray(page))
87
+ items.push(...page);
88
+ url = nextLink(res);
89
+ pages += 1;
90
+ }
91
+ return { ok: true, items };
92
+ }
93
+ /**
94
+ * Fetch a parent issue object, caching by issue_url within a single poll so two
95
+ * comments on the same issue cost one GET. On a FAILED fetch we return null but
96
+ * do NOT cache it, so the comment is retried on the next poll instead of being
97
+ * permanently dropped (finding §5).
98
+ */
99
+ async function resolveIssue(issueUrl, { http, source, cache }) {
100
+ if (cache.has(issueUrl))
101
+ return cache.get(issueUrl);
102
+ const res = (await http(issueUrl, { method: 'GET', headers: ghHeaders(source) }));
103
+ if (!res || !res.ok)
104
+ return null; // do NOT cache a failure
105
+ const issue = await res.json().catch(() => null);
106
+ if (issue != null)
107
+ cache.set(issueUrl, issue);
108
+ return issue;
109
+ }
110
+ /** Poll the issue_comment endpoint. */
111
+ async function pollIssueComments(ctx) {
112
+ const { source: srcRaw, state, http } = ctx;
113
+ const source = srcRaw;
114
+ const cursor = state?.cursor ?? null;
115
+ const seen = state?.seen ?? [];
116
+ const { owner, repo } = splitRepo(source.config.repo);
117
+ const retriggerOnEdit = !!source.config.retriggerOnEdit;
118
+ const url = new URL(`${baseUrlFor(source)}/repos/${owner}/${repo}/issues/comments`);
119
+ url.searchParams.set('sort', 'updated');
120
+ url.searchParams.set('direction', 'asc');
121
+ if (cursor)
122
+ url.searchParams.set('since', cursor);
123
+ // Fetch ALL pages (follow Link: rel="next") so events past page 1 aren't lost.
124
+ const { ok, items } = await fetchAllPages(url.toString(), { http: http, source });
125
+ // On a failed poll, advance NOTHING: keep the prior cursor + seen, emit nothing.
126
+ if (!ok)
127
+ return { events: [], state: { cursor, seen } };
128
+ const list = items;
129
+ // Dedup id derivation; the seen-set drops already-emitted (boundary/edit) items.
130
+ const idOf = (c) => retriggerOnEdit ? `gh:comment:${c.id}:${c.updated_at}` : `gh:comment:${c.id}`;
131
+ const { fresh } = deriveNew(list, { idOf, seen });
132
+ // Resolve parent issues (cached per issue_url) and build events. A comment whose
133
+ // parent fetch FAILS is left unprocessed: it is not emitted, not marked seen,
134
+ // and the cursor is held below its updated_at so the next poll retries it
135
+ // (finding §5).
136
+ const cache = new Map();
137
+ const events = [];
138
+ const emittedIds = [];
139
+ // The cursor may only advance up to the newest comment we fully processed
140
+ // (every comment <= it succeeded). Track the failure boundary.
141
+ let failureBoundary = null; // earliest updated_at we could NOT process
142
+ for (const c of fresh) {
143
+ const issue = await resolveIssue(c.issue_url, { http: http, source, cache });
144
+ if (issue == null) {
145
+ // Parent fetch failed → hold the cursor below this comment.
146
+ if (c.updated_at && (failureBoundary == null || c.updated_at < failureBoundary)) {
147
+ failureBoundary = c.updated_at;
148
+ }
149
+ continue;
150
+ }
151
+ const issueNumber = issueNumberFromUrl(c.issue_url);
152
+ const author = c.user?.login;
153
+ const payload = { ...c, issue };
154
+ events.push({
155
+ id: idOf(c),
156
+ content: contentForComment(c, issue),
157
+ meta: {
158
+ repo: source.config.repo,
159
+ issue_number: String(issueNumber),
160
+ kind: 'issue_comment',
161
+ author: author == null ? '' : String(author)
162
+ },
163
+ payload,
164
+ routing: { owner, repo, issue_number: issueNumber }
165
+ });
166
+ emittedIds.push(idOf(c));
167
+ }
168
+ // seen grows only with the comments we actually emitted (so a held-back comment
169
+ // is reconsidered next poll).
170
+ const nextSeen = [...seen, ...emittedIds];
171
+ // Cursor = max updated_at observed, but never at/after a failed-parent comment
172
+ // (so `since` re-includes it next poll). When no failure, advance to the max.
173
+ const observed = list.map((c) => c.updated_at).filter(Boolean);
174
+ let nextCursor = maxTimestamp(observed, cursor);
175
+ if (failureBoundary != null) {
176
+ // Clamp to strictly-before the failure boundary; fall back to prior cursor.
177
+ const safe = observed.filter((t) => t < failureBoundary);
178
+ nextCursor = maxTimestamp(safe, cursor);
179
+ // Guard: never advance to or past the boundary.
180
+ if (nextCursor != null && nextCursor >= failureBoundary)
181
+ nextCursor = cursor;
182
+ }
183
+ return { events, state: { cursor: nextCursor, seen: nextSeen } };
184
+ }
185
+ /** Build the channel content for a comment (body + short issue context). */
186
+ function contentForComment(comment, issue) {
187
+ const body = comment?.body ?? '';
188
+ const title = issue?.title ?? '';
189
+ return `${body}\n\n(on issue #${issue?.number ?? ''}: ${title})`;
190
+ }
191
+ /** Poll the issue_opened endpoint. */
192
+ async function pollIssuesOpened(ctx) {
193
+ const { source: srcRaw, state, http } = ctx;
194
+ const source = srcRaw;
195
+ const cursor = state?.cursor ?? null;
196
+ const seen = state?.seen ?? [];
197
+ const { owner, repo } = splitRepo(source.config.repo);
198
+ const url = new URL(`${baseUrlFor(source)}/repos/${owner}/${repo}/issues`);
199
+ url.searchParams.set('state', 'open');
200
+ url.searchParams.set('sort', 'created');
201
+ url.searchParams.set('direction', 'asc');
202
+ if (cursor)
203
+ url.searchParams.set('since', cursor);
204
+ // Fetch ALL pages (follow Link: rel="next") so issues past page 1 aren't lost.
205
+ const { ok, items } = await fetchAllPages(url.toString(), { http: http, source });
206
+ // On a failed poll, advance NOTHING: keep the prior cursor + seen, emit nothing.
207
+ if (!ok)
208
+ return { events: [], state: { cursor, seen } };
209
+ const list = items;
210
+ // GitHub `since` is updated-based; post-filter to genuinely-new creations.
211
+ // Use created_at >= cursor (not strict >) + the seen-set so equal-timestamp
212
+ // creations on the boundary aren't dropped (finding §7); dedup drops repeats.
213
+ const created = list.filter((i) => !cursor || (i.created_at && i.created_at >= cursor));
214
+ const idOf = (i) => `gh:issue:${i.id}`;
215
+ const { fresh, seen: nextSeen } = deriveNew(created, { idOf, seen });
216
+ const events = fresh.map((issue) => {
217
+ const author = issue.user?.login;
218
+ return {
219
+ id: idOf(issue),
220
+ content: contentForIssue(issue),
221
+ meta: {
222
+ repo: source.config.repo,
223
+ issue_number: String(issue.number),
224
+ kind: 'issue_opened',
225
+ author: author == null ? '' : String(author)
226
+ },
227
+ payload: issue,
228
+ routing: { owner, repo, issue_number: issue.number }
229
+ };
230
+ });
231
+ // Cursor = max created_at observed (across all returned, so we never re-window).
232
+ const nextCursor = maxTimestamp(list.map((i) => i.created_at), cursor);
233
+ return { events, state: { cursor: nextCursor, seen: nextSeen } };
234
+ }
235
+ /** Build the channel content for an opened issue (title + body). */
236
+ function contentForIssue(issue) {
237
+ const title = issue?.title ?? '';
238
+ const body = issue?.body ?? '';
239
+ return `${title}\n\n${body}`;
240
+ }
241
+ /**
242
+ * Poll the pr_opened endpoint: GET /repos/{o}/{r}/pulls?state=open&sort=created&
243
+ * direction=asc. The /pulls endpoint has no `since` param, so (consistent with
244
+ * issue_opened) we post-filter to created_at >= cursor + lean on the seen-set so a
245
+ * boundary creation isn't dropped, dedup by `gh:pr:<id>`, and advance the cursor to
246
+ * the max created_at observed. A PR is an issue for the comments API, so routing
247
+ * uses the PR `number` as issue_number and a reply still posts to
248
+ * /issues/{n}/comments (SPEC §4.1).
249
+ */
250
+ async function pollPullsOpened(ctx) {
251
+ const { source: srcRaw, state, http } = ctx;
252
+ const source = srcRaw;
253
+ const cursor = state?.cursor ?? null;
254
+ const seen = state?.seen ?? [];
255
+ const { owner, repo } = splitRepo(source.config.repo);
256
+ const url = new URL(`${baseUrlFor(source)}/repos/${owner}/${repo}/pulls`);
257
+ url.searchParams.set('state', 'open');
258
+ url.searchParams.set('sort', 'created');
259
+ url.searchParams.set('direction', 'asc');
260
+ // Fetch ALL pages (follow Link: rel="next") so PRs past page 1 aren't lost.
261
+ const { ok, items } = await fetchAllPages(url.toString(), { http: http, source });
262
+ // On a failed poll, advance NOTHING: keep the prior cursor + seen, emit nothing.
263
+ if (!ok)
264
+ return { events: [], state: { cursor, seen } };
265
+ const list = items;
266
+ // created_at >= cursor (not strict >) + the seen-set so an equal-timestamp
267
+ // creation on the boundary isn't dropped (mirrors issue_opened, finding §7).
268
+ const created = list.filter((p) => !cursor || (p.created_at && p.created_at >= cursor));
269
+ const idOf = (p) => `gh:pr:${p.id}`;
270
+ const { fresh, seen: nextSeen } = deriveNew(created, { idOf, seen });
271
+ const events = fresh.map((pr) => {
272
+ const author = pr.user?.login;
273
+ return {
274
+ id: idOf(pr),
275
+ content: contentForIssue(pr),
276
+ meta: {
277
+ repo: source.config.repo,
278
+ issue_number: String(pr.number),
279
+ kind: 'pr_opened',
280
+ author: author == null ? '' : String(author)
281
+ },
282
+ payload: pr,
283
+ // A PR is an issue for the comments API: reply posts to /issues/{number}/comments.
284
+ routing: { owner, repo, issue_number: pr.number }
285
+ };
286
+ });
287
+ // Cursor = max created_at observed (across all returned, so we never re-window).
288
+ const nextCursor = maxTimestamp(list.map((p) => p.created_at), cursor);
289
+ return { events, state: { cursor: nextCursor, seen: nextSeen } };
290
+ }
291
+ /** The GitHub event kinds this backend understands. */
292
+ const GH_EVENT_KINDS = new Set(['issue_comment', 'issue_opened', 'pr_opened']);
293
+ export default defineBackend({
294
+ type: 'github',
295
+ /**
296
+ * Validate a GitHub source at config-load time so misconfiguration is a clear
297
+ * validation error rather than a crash at poll time (SPEC §4.1, AC-3). Requires
298
+ * config.repo as "owner/name", a non-empty events list, and auth.token.
299
+ */
300
+ validateConfig(source) {
301
+ const s = source;
302
+ const errors = [];
303
+ const id = s?.id ?? '(unknown)';
304
+ const cfg = s?.config || {};
305
+ const repo = cfg.repo;
306
+ if (typeof repo !== 'string' || !/^[^/\s]+\/[^/\s]+$/.test(repo)) {
307
+ errors.push(`Source "${id}": github config.repo must be "owner/name".`);
308
+ }
309
+ const events = cfg.events;
310
+ if (!Array.isArray(events) || events.length === 0) {
311
+ errors.push(`Source "${id}": github config.events must be a non-empty array.`);
312
+ }
313
+ else {
314
+ const bad = events.filter((e) => !GH_EVENT_KINDS.has(e));
315
+ if (bad.length) {
316
+ errors.push(`Source "${id}": github config.events has unknown kind(s) ${JSON.stringify(bad)} ` +
317
+ `(valid: ${[...GH_EVENT_KINDS].join(', ')}).`);
318
+ }
319
+ }
320
+ if (!s?.auth?.token) {
321
+ errors.push(`Source "${id}": github auth.token is required.`);
322
+ }
323
+ return errors;
324
+ },
325
+ async poll(ctx) {
326
+ const events = ctx?.source?.config?.events || [];
327
+ if (events.includes('issue_opened')) {
328
+ return pollIssuesOpened(ctx);
329
+ }
330
+ if (events.includes('pr_opened')) {
331
+ return pollPullsOpened(ctx);
332
+ }
333
+ // Default to the issue_comment path.
334
+ return pollIssueComments(ctx);
335
+ },
336
+ /**
337
+ * Post a comment back to the originating issue/PR.
338
+ */
339
+ async reply({ routing, text, source, http }) {
340
+ const r = routing;
341
+ const owner = r?.owner;
342
+ const repo = r?.repo;
343
+ const issueNumber = r?.issue_number;
344
+ const url = `${baseUrlFor(source)}/repos/${owner}/${repo}/issues/${issueNumber}/comments`;
345
+ const res = (await http(url, {
346
+ method: 'POST',
347
+ headers: { ...ghHeaders(source), 'content-type': 'application/json' },
348
+ body: JSON.stringify({ body: text })
349
+ }));
350
+ if (res && res.ok) {
351
+ const created = (await res.json().catch(() => null));
352
+ return { ok: true, ref: created ? String(created.html_url ?? created.id ?? '') : undefined };
353
+ }
354
+ return { ok: false };
355
+ }
356
+ });
357
+ //# sourceMappingURL=github.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/backends/github.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,4BAA4B;AAC5B,kGAAkG;AAClG,+EAA+E;AAC/E,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,wCAAwC;AACxC,mGAAmG;AACnG,8EAA8E;AAC9E,yDAAyD;AACzD,gFAAgF;AAChF,kFAAkF;AAClF,+EAA+E;AAC/E,uEAAuE;AACvE,iCAAiC;AACjC,EAAE;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AG,CAAC,EAAE,IAAI,CAAC;QACrB,MAAM,WAAW,GAAG,CAAC,EAAE,YAAY,CAAC;QACpC,MAAM,GAAG,GAAG,GAAG,UAAU,CAAC,MAAmB,CAAC,UAAU,KAAK,IAAI,IAAI,WAAW,WAAW,WAAW,CAAC;QACvG,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE;YAC3B,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,GAAG,SAAS,CAAC,MAAmB,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAClF,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;SACrC,CAAC,CAAqB,CAAC;QACxB,IAAI,GAAG,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;YAClB,MAAM,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAQ,CAAC;YAC5D,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;QAC/F,CAAC;QACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { PollContext, PollResult, ReplyArgs, ReplyResult } from '../types.js';
2
+ declare const _default: {
3
+ type: string;
4
+ /**
5
+ * Validate a Jira source at config-load time so misconfiguration is a clear
6
+ * validation error rather than a crash at poll time (SPEC §4.2, AC-3). Requires
7
+ * config.project (safe identifier), a non-empty events list, and
8
+ * auth.baseUrl/email/token. Also rejects a project value that could inject into
9
+ * the JQL string (SPEC §9 security).
10
+ */
11
+ validateConfig(source: Record<string, unknown>): string[];
12
+ poll(ctx: PollContext): Promise<PollResult>;
13
+ /**
14
+ * Post a comment back to the originating Jira issue (ADF body).
15
+ */
16
+ reply({ routing, text, source, http }: ReplyArgs): Promise<ReplyResult>;
17
+ };
18
+ export default _default;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jira.d.ts","sourceRoot":"","sources":["../../src/backends/jira.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAgB,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;;;IA8K/F;;;;;;OAMG;2BACoB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE;cAqCzC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IA0CjD;;OAEG;2CAC0C,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;;AA5F/E,wBA0GG"}