@leitwerk-dev/github 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -124,11 +124,7 @@ truncation. Signed log downloads do not receive the API token. Actions read acce
124
124
  is required. Existing check-source callers remain compatible; the optional
125
125
  `afterKey` suppresses a failure already consumed by a process.
126
126
 
127
- Tool authorization and retry edge cases use an in-memory provider boundary.
128
- The recovery integration exercises real Git and reopens both provider storage and
129
- SQLite receipts: a lost create response and subsequent restart must retain one PR
130
- and the same receipt. This verifies local persistence and tool wiring, not live
131
- GitHub API compatibility.
127
+ Local adapter behavior does not establish live GitHub API compatibility.
132
128
 
133
129
  ## API support
134
130
 
@@ -457,4 +457,4 @@ export {
457
457
  assertGitHubRepository,
458
458
  GitHubClient
459
459
  };
460
- //# sourceMappingURL=chunk-OAOKE6LC.js.map
460
+ //# sourceMappingURL=chunk-PNHJ5QZ6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/authorization.ts","../src/client.ts"],"sourcesContent":["import type { GitHubClient, GitHubFeedbackItem, GitHubIssue } from \"./client.js\";\n\ntype MembershipClient = Pick<GitHubClient, \"profile\" | \"isOrganizationMember\">;\n\nexport async function authorizedTrigger(\n\tclient: MembershipClient & Pick<GitHubClient, \"getIssue\" | \"listIssueEvents\">,\n\towner: string,\n\trepo: string,\n\tnumber: number,\n\ttrigger: string,\n\tdone: string,\n) {\n\tif (\n\t\tclient.profile.allowedOrganization &&\n\t\towner.toLowerCase() !== client.profile.allowedOrganization.toLowerCase()\n\t)\n\t\treturn null;\n\tconst issue = (await client.getIssue(owner, repo, number)) as GitHubIssue & {\n\t\t/** @internal */\n\t\tpull_request?: unknown;\n\t};\n\tif (\n\t\tissue.pull_request ||\n\t\tissue.state !== \"open\" ||\n\t\t!issue.labels.some((label) => label.name === trigger) ||\n\t\tissue.labels.some((label) => label.name === done)\n\t)\n\t\treturn null;\n\tconst last = (await client.listIssueEvents(owner, repo, number))\n\t\t.filter(\n\t\t\t(event) =>\n\t\t\t\t(event.event === \"labeled\" || event.event === \"unlabeled\") && event.label?.name === trigger,\n\t\t)\n\t\t.sort((a, b) => b.id - a.id)[0];\n\tif (\n\t\tlast?.event !== \"labeled\" ||\n\t\t!last.actor?.login ||\n\t\t!(await client.isOrganizationMember(last.actor.login))\n\t)\n\t\treturn null;\n\treturn {\n\t\t/** @internal */\n\t\tissue,\n\t\t/** @internal */\n\t\tactor: last.actor.login,\n\t\t/** @internal */\n\t\teventId: last.id,\n\t};\n}\n\nexport async function actionableFeedback(client: MembershipClient, feedback: GitHubFeedbackItem[]) {\n\tconst authorized: GitHubFeedbackItem[] = [];\n\tfor (const item of feedback) {\n\t\tif (\n\t\t\titem.author.toLowerCase() === client.profile.botLogin.toLowerCase() ||\n\t\t\titem.body.includes(\"<!-- leitwerk-write:\")\n\t\t)\n\t\t\tcontinue;\n\t\tif (await client.isOrganizationMember(item.author)) authorized.push(item);\n\t}\n\treturn authorized;\n}\n","import { asUnknownRecord } from \"@leitwerk-dev/domain\";\nimport {\n\ttype RepositoryFeedbackItem as GitHubFeedbackItem,\n\ttype RepositoryIssue as GitHubIssue,\n\ttype RepositoryPullRequest as GitHubPullRequest,\n\tIntegrationHttpError,\n\tnormalizeRepositoryFeedback as normalize,\n\tRepositoryHttpClient,\n} from \"@leitwerk-dev/process-sdk\";\n\nimport { actionableFeedback, authorizedTrigger } from \"./authorization.js\";\n\nexport type { GitHubFeedbackItem, GitHubIssue, GitHubPullRequest };\n\n/** @internal */\ninterface GitHubLabel {\n\t/** @internal */\n\tid: number;\n\t/** @internal */\n\tname: string;\n}\n\n/** @public */\nexport interface GitHubRepository {\n\t/** @public */\n\tname: string;\n\t/** @internal */\n\tfull_name: string;\n\t/** @public */\n\towner: {\n\t\t/** @public */\n\t\tlogin: string;\n\t};\n\t/** @public */\n\tssh_url: string;\n\t/** @public */\n\tdefault_branch: string;\n\t/** @internal */\n\thtml_url: string;\n\t/** @internal */\n\tarchived: boolean;\n\t/** @internal */\n\thas_issues: boolean;\n}\n/** @public */\nexport interface GitHubGitIdentity {\n\t/** @internal */\n\tprovider: \"github\";\n\t/** @internal */\n\tprofile: string;\n\t/** @internal */\n\tlogin: string;\n\t/** @public */\n\tname: string;\n\t/** @public */\n\temail: string;\n}\n/** @public */\nexport interface GitHubLabelEvent {\n\t/** @internal */\n\tid: number;\n\t/** @internal */\n\tevent: string;\n\t/** @public */\n\tlabel?: {\n\t\t/** @public */\n\t\tname: string;\n\t};\n\t/** @public */\n\tactor: {\n\t\t/** @public */\n\t\tlogin: string;\n\t} | null;\n}\n\n/** @internal */\nexport interface GitHubProfile {\n\t/** @internal */\n\tapiBaseUrl: string;\n\t/** @internal */\n\ttoken: string;\n\t/** @internal */\n\tbotLogin: string;\n\t/** @internal */\n\tallowedOrganization?: string;\n}\n\n/** @public */\nexport interface GitHubCheckSummary {\n\t/** @public */\n\theadSha: string;\n\t/** @public */\n\tstatus: \"pending\" | \"success\" | \"failure\";\n\t/** @public */\n\ttotal: number;\n\t/** @public */\n\tfailed: Array<{\n\t\t/** @internal */\n\t\tname: string;\n\t\t/** @public */\n\t\tconclusion: string | null;\n\t\t/** @public */\n\t\turl: string | null;\n\t}>;\n}\n\n/** @public */\nexport interface GitHubRelease {\n\t/** @internal */\n\tid: number;\n\t/** @public */\n\ttag_name: string;\n\t/** @internal */\n\ttarget_commitish: string;\n\t/** @internal */\n\tdraft: boolean;\n\t/** @internal */\n\tprerelease: boolean;\n\t/** @internal */\n\thtml_url: string;\n\t/** @public */\n\tassets: Array<{\n\t\t/** @public */\n\t\tname: string;\n\t\t/** @public */\n\t\turl: string;\n\t\t/** @public */\n\t\tbrowser_download_url: string;\n\t}>;\n}\n\n/** @internal */\nexport function parseGitHubProfiles(value: unknown): Map<string, GitHubProfile> {\n\tconst profiles = new Map<string, GitHubProfile>();\n\tfor (const [name, raw] of Object.entries(\n\t\tasUnknownRecord(asUnknownRecord(value)?.profiles) ?? {},\n\t)) {\n\t\tconst config = asUnknownRecord(raw) ?? {};\n\t\tconst apiBaseUrl =\n\t\t\ttypeof config.api_base_url === \"string\"\n\t\t\t\t? config.api_base_url.replace(/\\/+$/, \"\")\n\t\t\t\t: \"https://api.github.com\";\n\t\tconst token = typeof config.token === \"string\" ? config.token.trim() : \"\";\n\t\tconst botLogin = typeof config.bot_login === \"string\" ? config.bot_login.trim() : \"leitwerk\";\n\t\tif (!/^https:\\/\\//.test(apiBaseUrl))\n\t\t\tthrow new Error(`GitHub profile '${name}' requires an HTTPS api_base_url`);\n\t\tif (!token) throw new Error(`GitHub profile '${name}' requires a token`);\n\t\tif (!botLogin) throw new Error(`GitHub profile '${name}' requires bot_login`);\n\t\tconst allowedOrganization = config.allowed_organization;\n\t\tif (\n\t\t\tallowedOrganization !== undefined &&\n\t\t\t(typeof allowedOrganization !== \"string\" || !/^[a-z0-9-]+$/i.test(allowedOrganization))\n\t\t) {\n\t\t\tthrow new Error(`GitHub profile '${name}' requires a valid allowed_organization`);\n\t\t}\n\t\tprofiles.set(name, {\n\t\t\tapiBaseUrl,\n\t\t\ttoken,\n\t\t\tbotLogin,\n\t\t\t...(typeof allowedOrganization === \"string\"\n\t\t\t\t? { allowedOrganization: allowedOrganization.toLowerCase() }\n\t\t\t\t: {}),\n\t\t});\n\t}\n\treturn profiles;\n}\n\n/** @internal */\nexport function assertGitHubRepository(profile: GitHubProfile, owner: string, repo: string): void {\n\tif (\n\t\t!/^[a-z0-9-]+$/i.test(owner) ||\n\t\t!/^[a-z0-9_.-]+$/i.test(repo) ||\n\t\trepo === \".\" ||\n\t\trepo === \"..\"\n\t) {\n\t\tthrow new Error(\"Invalid GitHub repository\");\n\t}\n\tif (\n\t\tprofile.allowedOrganization &&\n\t\towner.toLowerCase() !== profile.allowedOrganization.toLowerCase()\n\t) {\n\t\tthrow new Error(`GitHub project must belong to ${profile.allowedOrganization}`);\n\t}\n}\n\n/** @public */\nexport class GitHubClient extends RepositoryHttpClient {\n\t/** @internal */\n\tconstructor(/** @internal */ readonly profile: GitHubProfile) {\n\t\tsuper(\"GitHub\", profile.apiBaseUrl, {\n\t\t\tAccept: \"application/vnd.github+json\",\n\t\t\tAuthorization: `Bearer ${profile.token}`,\n\t\t\t\"X-GitHub-Api-Version\": \"2022-11-28\",\n\t\t});\n\t}\n\n\t/** @internal */\n\tprotected override response(path: string, init: RequestInit = {}): Promise<Response> {\n\t\treturn super.response(path, {\n\t\t\t...init,\n\t\t\tredirect: \"error\",\n\t\t\tsignal: init.signal ?? AbortSignal.timeout(30_000),\n\t\t});\n\t}\n\n\t/** @internal */\n\tprotected override repositoryPath(owner: string, repo: string): string {\n\t\tassertGitHubRepository(this.profile, owner, repo);\n\t\treturn super.repositoryPath(owner, repo);\n\t}\n\n\t/** @internal */\n\tasync listRepositories() {\n\t\treturn (\n\t\t\tawait this.pages<GitHubRepository>(\n\t\t\t\tthis.profile.allowedOrganization\n\t\t\t\t\t? `/orgs/${this.profile.allowedOrganization}/repos?type=all`\n\t\t\t\t\t: \"/user/repos?affiliation=owner,collaborator,organization_member\",\n\t\t\t)\n\t\t).filter(\n\t\t\t(repo) =>\n\t\t\t\t(!this.profile.allowedOrganization ||\n\t\t\t\t\trepo.owner.login.toLowerCase() === this.profile.allowedOrganization.toLowerCase()) &&\n\t\t\t\t!repo.archived &&\n\t\t\t\trepo.has_issues,\n\t\t);\n\t}\n\t/** @internal */\n\tasync listOpenIssues(owner: string, repo: string) {\n\t\treturn (\n\t\t\tawait this.pages<\n\t\t\t\tGitHubIssue & {\n\t\t\t\t\t/** @internal */\n\t\t\t\t\tpull_request?: unknown;\n\t\t\t\t}\n\t\t\t>(`${this.repositoryPath(owner, repo)}/issues?state=open`)\n\t\t).filter((issue) => !issue.pull_request);\n\t}\n\t/** @internal */\n\tlistIssueEvents(owner: string, repo: string, number: number) {\n\t\treturn this.pages<GitHubLabelEvent>(\n\t\t\t`${this.repositoryPath(owner, repo)}/issues/${number}/events`,\n\t\t);\n\t}\n\t/** @internal */\n\tasync isOrganizationMember(login: string): Promise<boolean> {\n\t\tif (!this.profile.allowedOrganization) return true;\n\t\tif (!/^[a-z0-9-]+$/i.test(login)) return false;\n\t\ttry {\n\t\t\tconst response = await this.response(\n\t\t\t\t`/orgs/${this.profile.allowedOrganization}/members/${encodeURIComponent(login)}`,\n\t\t\t);\n\t\t\treturn response.status === 204;\n\t\t} catch (error) {\n\t\t\tif (error instanceof IntegrationHttpError) {\n\t\t\t\tif (error.status === 404) return false;\n\t\t\t\tthrow new Error(`GitHub membership check failed with ${error.status}`);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\t/** @internal */\n\tasync authorizedTrigger(\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\ttrigger: string,\n\t\tdone: string,\n\t) {\n\t\treturn authorizedTrigger(this, owner, repo, number, trigger, done);\n\t}\n\t/** @public */\n\tasync resolveGitIdentity(profile: string): Promise<GitHubGitIdentity> {\n\t\tconst user = await this.request<{ login: string; name: string | null; id: number }>(\"/user\");\n\t\tif (user.login !== this.profile.botLogin)\n\t\t\tthrow new Error(\"GitHub authenticated user does not match bot_login\");\n\t\treturn {\n\t\t\tprovider: \"github\",\n\t\t\tprofile,\n\t\t\tlogin: user.login,\n\t\t\tname: user.name || user.login,\n\t\t\temail: `${user.id}+${user.login}@users.noreply.github.com`,\n\t\t};\n\t}\n\t/** @public */\n\tupdateIssue(owner: string, repo: string, number: number, patch: Record<string, unknown>) {\n\t\treturn this.request<GitHubIssue>(`${this.repositoryPath(owner, repo)}/issues/${number}`, {\n\t\t\tmethod: \"PATCH\",\n\t\t\tbody: JSON.stringify(patch),\n\t\t});\n\t}\n\t/** @internal */\n\tlistLabels(owner: string, repo: string) {\n\t\treturn this.pages<GitHubLabel>(`${this.repositoryPath(owner, repo)}/labels`);\n\t}\n\t/** @internal */\n\tcreateLabel(owner: string, repo: string, name: string) {\n\t\treturn this.request<GitHubLabel>(`${this.repositoryPath(owner, repo)}/labels`, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({ name, color: \"238636\" }),\n\t\t});\n\t}\n\t/** @internal */\n\tasync ensureLabel(owner: string, repo: string, name: string) {\n\t\tconst labels = await this.listLabels(owner, repo);\n\t\treturn labels.find((label) => label.name === name) ?? this.createLabel(owner, repo, name);\n\t}\n\t/** @internal */\n\taddFeedbackReaction(owner: string, repo: string, kind: string, id: number) {\n\t\tconst segment = kind === \"inline\" ? \"pulls/comments\" : \"issues/comments\";\n\t\treturn this.request(`${this.repositoryPath(owner, repo)}/${segment}/${id}/reactions`, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({ content: \"eyes\" }),\n\t\t});\n\t}\n\t/** @internal */\n\tasync replyFeedback(\n\t\towner: string,\n\t\trepo: string,\n\t\tpr: number,\n\t\tkind: string,\n\t\tid: number,\n\t\tbody: string,\n\t) {\n\t\tif (kind === \"inline\")\n\t\t\treturn this.writeJson(\n\t\t\t\t`${this.repositoryPath(owner, repo)}/pulls/${pr}/comments/${id}/replies`,\n\t\t\t\t\"POST\",\n\t\t\t\t{ body },\n\t\t\t);\n\t\treturn this.addIssueComment(owner, repo, pr, body);\n\t}\n\n\t/** @internal */\n\tgetCommit(owner: string, repo: string, ref: string) {\n\t\treturn this.request<{\n\t\t\t/** @internal */\n\t\t\tsha: string;\n\t\t}>(`${this.repositoryPath(owner, repo)}/commits/${encodeURIComponent(ref)}`);\n\t}\n\n\t/** @public */\n\tasync isAncestor(owner: string, repo: string, ancestor: string, descendant: string) {\n\t\tconst comparison = await this.request<{ status: string }>(\n\t\t\t`${this.repositoryPath(owner, repo)}/compare/${encodeURIComponent(ancestor)}...${encodeURIComponent(descendant)}`,\n\t\t);\n\t\treturn comparison.status === \"identical\" || comparison.status === \"ahead\";\n\t}\n\n\t/** @public */\n\tasync listPullRequestFeedback(\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\tsignal?: AbortSignal,\n\t): Promise<GitHubFeedbackItem[]> {\n\t\tconst prefix = `${this.repositoryPath(owner, repo)}`;\n\t\tconst [conversation, reviews, inline] = await Promise.all([\n\t\t\tthis.pages<Record<string, unknown>>(`${prefix}/issues/${number}/comments`, signal),\n\t\t\tthis.pages<Record<string, unknown>>(`${prefix}/pulls/${number}/reviews`, signal),\n\t\t\tthis.pages<Record<string, unknown>>(`${prefix}/pulls/${number}/comments`, signal),\n\t\t]);\n\n\t\tconst candidates = [\n\t\t\t...conversation.map((item) => ({ kind: \"conversation\" as const, item })),\n\t\t\t...reviews.map((item) => ({ kind: \"review\" as const, item })),\n\t\t\t...inline.map((item) => ({ kind: \"inline\" as const, item })),\n\t\t];\n\t\tconst feedback: GitHubFeedbackItem[] = [];\n\t\tconst needsProvenance: typeof candidates = [];\n\t\tfor (const candidate of candidates) {\n\t\t\tconst { kind, item } = candidate;\n\t\t\tconst normalized = normalize(kind, item);\n\t\t\tif (!normalized) continue;\n\t\t\tconst createdAt = typeof item.created_at === \"string\" ? Date.parse(item.created_at) : NaN;\n\t\t\tconst updatedAt = typeof item.updated_at === \"string\" ? Date.parse(item.updated_at) : NaN;\n\t\t\tif (\n\t\t\t\t!this.profile.allowedOrganization ||\n\t\t\t\t(kind !== \"review\" && Number.isFinite(createdAt) && createdAt === updatedAt)\n\t\t\t) {\n\t\t\t\tfeedback.push(normalized);\n\t\t\t} else if (typeof item.node_id === \"string\" && item.node_id) {\n\t\t\t\t// REST attributes edited bodies to their original author. Reviews also\n\t\t\t\t// omit edit timestamps, so obtain the body and latest editor together.\n\t\t\t\tneedsProvenance.push(candidate);\n\t\t\t}\n\t\t}\n\t\tfor (let offset = 0; offset < needsProvenance.length; offset += 100) {\n\t\t\tconst batch = needsProvenance.slice(offset, offset + 100);\n\t\t\tconst response = await this.request<{\n\t\t\t\tdata?: { nodes?: Array<Record<string, unknown> | null> };\n\t\t\t\terrors?: unknown[];\n\t\t\t}>(\"/graphql\", {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tsignal,\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\tquery: `query LeitwerkFeedbackProvenance($ids: [ID!]!) {\n\t\t\t\t\t\tnodes(ids: $ids) {\n\t\t\t\t\t\t\tid __typename\n\t\t\t\t\t\t\t... on IssueComment { body createdAt lastEditedAt author { login } editor { login } }\n\t\t\t\t\t\t\t... on PullRequestReview { body createdAt submittedAt lastEditedAt author { login } editor { login } }\n\t\t\t\t\t\t\t... on PullRequestReviewComment { body createdAt lastEditedAt author { login } editor { login } path line }\n\t\t\t\t\t\t}\n\t\t\t\t\t}`,\n\t\t\t\t\tvariables: { ids: batch.map(({ item }) => item.node_id) },\n\t\t\t\t}),\n\t\t\t});\n\t\t\tif (response.errors?.length || !Array.isArray(response.data?.nodes)) {\n\t\t\t\tthrow new Error(\"GitHub feedback provenance lookup failed\");\n\t\t\t}\n\t\t\tconst snapshots = new Map(\n\t\t\t\tresponse.data.nodes.filter((node) => node !== null).map((node) => [node.id, node]),\n\t\t\t);\n\t\t\tfor (const { kind, item } of batch) {\n\t\t\t\tconst snapshot = snapshots.get(item.node_id);\n\t\t\t\tconst expectedType = {\n\t\t\t\t\tconversation: \"IssueComment\",\n\t\t\t\t\treview: \"PullRequestReview\",\n\t\t\t\t\tinline: \"PullRequestReviewComment\",\n\t\t\t\t}[kind];\n\t\t\t\tif (!snapshot || snapshot.__typename !== expectedType) continue;\n\t\t\t\tconst publishedAt = kind === \"review\" ? snapshot.submittedAt : snapshot.createdAt;\n\t\t\t\tif (typeof publishedAt !== \"string\" || !Number.isFinite(Date.parse(publishedAt))) continue;\n\t\t\t\tconst editedAt = snapshot.lastEditedAt;\n\t\t\t\tif (editedAt !== null) {\n\t\t\t\t\tif (typeof editedAt !== \"string\" || !Number.isFinite(Date.parse(editedAt))) continue;\n\t\t\t\t\tconst editor = asUnknownRecord(snapshot.editor)?.login;\n\t\t\t\t\tif (typeof editor !== \"string\" || !(await this.isOrganizationMember(editor))) continue;\n\t\t\t\t}\n\t\t\t\tconst normalized = normalize(kind, {\n\t\t\t\t\t...snapshot,\n\t\t\t\t\tid: item.id,\n\t\t\t\t\tuser: snapshot.author,\n\t\t\t\t\tcreated_at: editedAt ?? publishedAt,\n\t\t\t\t});\n\t\t\t\tif (normalized) feedback.push(normalized);\n\t\t\t}\n\t\t}\n\t\treturn feedback;\n\t}\n\n\t/** @public */\n\tasync getCheckSummary(owner: string, repo: string, headSha: string): Promise<GitHubCheckSummary> {\n\t\tconst runs: Array<Record<string, unknown>> = [];\n\t\tfor (let page = 1; ; page++) {\n\t\t\tconst response = await this.request<{ check_runs: Array<Record<string, unknown>> }>(\n\t\t\t\t`${this.repositoryPath(owner, repo)}/commits/${headSha}/check-runs?per_page=100&page=${page}`,\n\t\t\t);\n\t\t\truns.push(...response.check_runs);\n\t\t\tif (response.check_runs.length < 100) break;\n\t\t}\n\t\tconst terminalSuccess = new Set([\"success\", \"neutral\", \"skipped\"]);\n\t\tconst failed = runs\n\t\t\t.filter((run) => run.status === \"completed\" && !terminalSuccess.has(String(run.conclusion)))\n\t\t\t.map((run) => ({\n\t\t\t\tname: String(run.name ?? \"unknown\"),\n\t\t\t\tconclusion: typeof run.conclusion === \"string\" ? run.conclusion : null,\n\t\t\t\turl: typeof run.html_url === \"string\" ? run.html_url : null,\n\t\t\t}));\n\t\tconst pending = runs.some((run) => run.status !== \"completed\");\n\t\treturn {\n\t\t\theadSha,\n\t\t\tstatus: failed.length ? \"failure\" : pending || !runs.length ? \"pending\" : \"success\",\n\t\t\ttotal: runs.length,\n\t\t\tfailed,\n\t\t};\n\t}\n\n\t/** Human feedback checked against current membership; delivery receipts use raw reads. */\n\t/** @internal */\n\tasync listActionablePullRequestFeedback(\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\tsignal?: AbortSignal,\n\t) {\n\t\treturn actionableFeedback(\n\t\t\tthis,\n\t\t\tawait this.listPullRequestFeedback(owner, repo, number, signal),\n\t\t);\n\t}\n\n\t/** @internal */\n\tlistFeedbackReplies(owner: string, repo: string, pr: number, kind: string) {\n\t\treturn kind === \"inline\"\n\t\t\t? this.pages<Record<string, unknown>>(\n\t\t\t\t\t`${this.repositoryPath(owner, repo)}/pulls/${pr}/comments`,\n\t\t\t\t)\n\t\t\t: this.listIssueComments(owner, repo, pr);\n\t}\n\n\t/** @internal */\n\tlistFeedbackReactions(owner: string, repo: string, kind: string, id: number) {\n\t\tif (kind !== \"inline\" && kind !== \"conversation\")\n\t\t\tthrow new Error(\"Reviews do not support reactions\");\n\t\tconst segment = kind === \"inline\" ? \"pulls/comments\" : \"issues/comments\";\n\t\treturn this.pages<{\n\t\t\t/** @internal */\n\t\t\tid: number;\n\t\t\t/** @internal */\n\t\t\tcontent: string;\n\t\t\t/** @internal */\n\t\t\tuser: {\n\t\t\t\t/** @internal */\n\t\t\t\tlogin: string;\n\t\t\t};\n\t\t}>(`${this.repositoryPath(owner, repo)}/${segment}/${id}/reactions`);\n\t}\n\n\t/** @public */\n\tasync getCiDiagnostics(\n\t\towner: string,\n\t\trepo: string,\n\t\tpullRequestNumber: number,\n\t\theadSha: string,\n\t\tsignal?: AbortSignal,\n\t) {\n\t\tconst pr = await this.getPullRequest(owner, repo, pullRequestNumber, signal);\n\t\tif (pr.state !== \"open\" || pr.merged || pr.head.sha !== headSha)\n\t\t\tthrow new Error(\"CI diagnostics target a stale pull request revision\");\n\t\tconst prefix = this.repositoryPath(owner, repo);\n\t\tconst checks: Array<{\n\t\t\t/** @internal */\n\t\t\tid: number;\n\t\t\tname: string;\n\t\t\tconclusion: string | null;\n\t\t\t/** @public */\n\t\t\toutput?: {\n\t\t\t\t/** @public */\n\t\t\t\ttitle?: string;\n\t\t\t\t/** @public */\n\t\t\t\tsummary?: string;\n\t\t\t\t/** @public */\n\t\t\t\ttext?: string;\n\t\t\t};\n\t\t}> = [];\n\t\tfor (let page = 1; ; page++) {\n\t\t\tconst batch = await this.request<{ check_runs: typeof checks }>(\n\t\t\t\t`${prefix}/commits/${encodeURIComponent(headSha)}/check-runs?filter=latest&per_page=100&page=${page}`,\n\t\t\t\t{ signal },\n\t\t\t);\n\t\t\tchecks.push(...batch.check_runs);\n\t\t\tif (batch.check_runs.length < 100) break;\n\t\t}\n\t\tconst failed = checks.filter(\n\t\t\t(c) => c.conclusion && ![\"success\", \"neutral\", \"skipped\"].includes(c.conclusion),\n\t\t);\n\t\tconst annotations = await Promise.all(\n\t\t\tfailed.slice(0, 10).map(async (check) => ({\n\t\t\t\t/** @public */\n\t\t\t\tid: check.id,\n\t\t\t\t/** @public */\n\t\t\t\tname: check.name,\n\t\t\t\t/** @public */\n\t\t\t\toutput: check.output,\n\t\t\t\t/** @public */\n\t\t\t\tannotations: (\n\t\t\t\t\tawait this.pages<unknown>(`${prefix}/check-runs/${check.id}/annotations`, signal)\n\t\t\t\t).slice(0, 100),\n\t\t\t})),\n\t\t);\n\t\tconst jobs: Array<{\n\t\t\t/** @public */\n\t\t\tid: number;\n\t\t\t/** @public */\n\t\t\tname: string;\n\t\t\t/** @public */\n\t\t\thtml_url: string;\n\t\t\t/** @public */\n\t\t\tlog: {\n\t\t\t\t/** @public */\n\t\t\t\ttext: string;\n\t\t\t\t/** @public */\n\t\t\t\ttruncated: boolean;\n\t\t\t};\n\t\t}> = [];\n\t\tfor (let page = 1; jobs.length < 10; page++) {\n\t\t\tconst runs = await this.request<{\n\t\t\t\tworkflow_runs: Array<{\n\t\t\t\t\tid: number;\n\t\t\t\t\thead_sha: string;\n\t\t\t\t\thead_branch: string;\n\t\t\t\t\tconclusion: string | null;\n\t\t\t\t}>;\n\t\t\t}>(\n\t\t\t\t`${prefix}/actions/runs?head_sha=${encodeURIComponent(headSha)}&per_page=100&page=${page}`,\n\t\t\t\t{ signal },\n\t\t\t);\n\t\t\tfor (const run of runs.workflow_runs) {\n\t\t\t\tif (\n\t\t\t\t\trun.head_sha !== headSha ||\n\t\t\t\t\trun.head_branch !== pr.head.ref ||\n\t\t\t\t\t!run.conclusion ||\n\t\t\t\t\t[\"success\", \"neutral\", \"skipped\"].includes(run.conclusion)\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\t\t\t\tfor (let jobPage = 1; jobs.length < 10; jobPage++) {\n\t\t\t\t\tconst batch = await this.request<{\n\t\t\t\t\t\tjobs: Array<{ id: number; name: string; html_url: string; conclusion: string | null }>;\n\t\t\t\t\t}>(`${prefix}/actions/runs/${run.id}/jobs?filter=latest&per_page=100&page=${jobPage}`, {\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t});\n\t\t\t\t\tfor (const job of batch.jobs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!job.conclusion ||\n\t\t\t\t\t\t\t[\"success\", \"neutral\", \"skipped\"].includes(job.conclusion) ||\n\t\t\t\t\t\t\tjobs.length >= 10\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tjobs.push({\n\t\t\t\t\t\t\tid: job.id,\n\t\t\t\t\t\t\tname: job.name,\n\t\t\t\t\t\t\thtml_url: job.html_url,\n\t\t\t\t\t\t\tlog: await this.readJobLog(owner, repo, job.id, signal),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (batch.jobs.length < 100) break;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (runs.workflow_runs.length < 100) break;\n\t\t}\n\t\tconst refreshed = await this.getPullRequest(owner, repo, pullRequestNumber, signal);\n\t\tif (refreshed.head.sha !== headSha || refreshed.state !== \"open\" || refreshed.merged)\n\t\t\tthrow new Error(\"CI diagnostics were superseded\");\n\t\treturn {\n\t\t\t/** @public */\n\t\t\theadSha,\n\t\t\t/** @public */\n\t\t\tchecks: annotations,\n\t\t\t/** @public */\n\t\t\tjobs,\n\t\t\t/** @public */\n\t\t\ttruncated: failed.length > 10 || jobs.length >= 10,\n\t\t};\n\t}\n\tprivate async readJobLog(\n\t\towner: string,\n\t\trepo: string,\n\t\tjob: number,\n\t\tsignal?: AbortSignal,\n\t): Promise<{ text: string; truncated: boolean }> {\n\t\tconst timeout = signal\n\t\t\t? AbortSignal.any([signal, AbortSignal.timeout(30000)])\n\t\t\t: AbortSignal.timeout(30000);\n\t\tlet response = await fetch(\n\t\t\t`${this.profile.apiBaseUrl}${this.repositoryPath(owner, repo)}/actions/jobs/${job}/logs`,\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${this.profile.token}`,\n\t\t\t\t\tAccept: \"application/vnd.github+json\",\n\t\t\t\t},\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: timeout,\n\t\t\t},\n\t\t);\n\t\tif (response.status === 302) {\n\t\t\tconst location = new URL(response.headers.get(\"location\") ?? \"\");\n\t\t\tif (location.protocol !== \"https:\" || location.username || location.password)\n\t\t\t\tthrow new Error(\"Invalid GitHub log download URL\");\n\t\t\tawait response.body?.cancel();\n\t\t\t// Signed storage URLs must never receive the GitHub credential.\n\t\t\tresponse = await fetch(location, { redirect: \"error\", signal: timeout });\n\t\t}\n\t\tif (!response.ok) throw new IntegrationHttpError(response.status, \"GitHub job log unavailable\");\n\t\tconst reader = response.body?.getReader();\n\t\tif (!reader) return { text: \"\", truncated: false };\n\t\tconst chunks: Uint8Array[] = [];\n\t\tlet bytes = 0;\n\t\tlet truncated = false;\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst next = await reader.read();\n\t\t\t\tif (next.done) break;\n\t\t\t\tconst part = next.value.slice(0, 65536 - bytes);\n\t\t\t\tchunks.push(part);\n\t\t\t\tbytes += part.length;\n\t\t\t\tif (bytes === 65536) {\n\t\t\t\t\ttruncated = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tawait reader.cancel();\n\t\t}\n\t\treturn { text: Buffer.concat(chunks).toString(\"utf8\"), truncated };\n\t}\n\n\t/** @internal */\n\tlistReleases(owner: string, repo: string) {\n\t\treturn this.pages<GitHubRelease>(`${this.repositoryPath(owner, repo)}/releases`);\n\t}\n\n\t/** @public */\n\tdownloadReleaseAsset(asset: GitHubRelease[\"assets\"][number]): Promise<string> {\n\t\tconst url = new URL(asset.url);\n\t\tif (`${url.protocol}//${url.host}` !== this.profile.apiBaseUrl)\n\t\t\tthrow new Error(\"GitHub release asset URL does not match the configured API origin\");\n\t\treturn this.response(`${url.pathname}${url.search}`, {\n\t\t\theaders: { Accept: \"application/octet-stream\" },\n\t\t}).then((response) => response.text());\n\t}\n}\n"],"mappings":";AAIA,eAAsB,kBACrB,QACA,OACA,MACA,QACA,SACA,MACC;AACD,MACC,OAAO,QAAQ,uBACf,MAAM,YAAY,MAAM,OAAO,QAAQ,oBAAoB,YAAY;AAEvE,WAAO;AACR,QAAM,QAAS,MAAM,OAAO,SAAS,OAAO,MAAM,MAAM;AAIxD,MACC,MAAM,gBACN,MAAM,UAAU,UAChB,CAAC,MAAM,OAAO,KAAK,CAAC,UAAU,MAAM,SAAS,OAAO,KACpD,MAAM,OAAO,KAAK,CAAC,UAAU,MAAM,SAAS,IAAI;AAEhD,WAAO;AACR,QAAM,QAAQ,MAAM,OAAO,gBAAgB,OAAO,MAAM,MAAM,GAC5D;AAAA,IACA,CAAC,WACC,MAAM,UAAU,aAAa,MAAM,UAAU,gBAAgB,MAAM,OAAO,SAAS;AAAA,EACtF,EACC,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAC/B,MACC,MAAM,UAAU,aAChB,CAAC,KAAK,OAAO,SACb,CAAE,MAAM,OAAO,qBAAqB,KAAK,MAAM,KAAK;AAEpD,WAAO;AACR,SAAO;AAAA;AAAA,IAEN;AAAA;AAAA,IAEA,OAAO,KAAK,MAAM;AAAA;AAAA,IAElB,SAAS,KAAK;AAAA,EACf;AACD;AAEA,eAAsB,mBAAmB,QAA0B,UAAgC;AAClG,QAAM,aAAmC,CAAC;AAC1C,aAAW,QAAQ,UAAU;AAC5B,QACC,KAAK,OAAO,YAAY,MAAM,OAAO,QAAQ,SAAS,YAAY,KAClE,KAAK,KAAK,SAAS,sBAAsB;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  /** @internal */
15
15
  full_name: string;
16
16
  /** @public */
17
- /** @public */
18
17
  owner: {
19
18
  /** @public */
20
19
  login: string;
@@ -50,13 +49,11 @@ export interface GitHubLabelEvent {
50
49
  /** @internal */
51
50
  event: string;
52
51
  /** @public */
53
- /** @public */
54
52
  label?: {
55
53
  /** @public */
56
54
  name: string;
57
55
  };
58
56
  /** @public */
59
- /** @public */
60
57
  actor: {
61
58
  /** @public */
62
59
  login: string;
@@ -106,7 +103,6 @@ export interface GitHubRelease {
106
103
  /** @internal */
107
104
  html_url: string;
108
105
  /** @public */
109
- /** @public */
110
106
  assets: Array<{
111
107
  /** @public */
112
108
  name: string;
@@ -226,7 +222,6 @@ export declare class GitHubClient extends RepositoryHttpClient {
226
222
  /** @public */
227
223
  html_url: string;
228
224
  /** @public */
229
- /** @public */
230
225
  log: {
231
226
  /** @public */
232
227
  text: string;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,sBAAsB,IAAI,kBAAkB,EACjD,KAAK,eAAe,IAAI,WAAW,EACnC,KAAK,qBAAqB,IAAI,iBAAiB,EAG/C,oBAAoB,EACpB,MAAM,2BAA2B,CAAC;AAInC,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAEnE,gBAAgB;AAChB,UAAU,WAAW;IACpB,gBAAgB;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;CACb;AAED,cAAc;AACd,MAAM,WAAW,gBAAgB;IAChC,cAAc;IACd,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc;IACd,cAAc;IACd,KAAK,EAAE;QACN,cAAc;QACd,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IACF,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc;IACd,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cAAc;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc;IACd,eAAe,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACtC,gBAAgB;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,cAAc;AACd,MAAM,WAAW,0BAA2B,SAAQ,qCAAqC;IACxF,cAAc;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc;IACd,aAAa,EAAE,MAAM,CAAC;CACtB;AAED,cAAc;AACd,MAAM,WAAW,gCAAgC;IAChD,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc;IACd,KAAK,EAAE,MAAM,CAAC;IACd,cAAc;IACd,IAAI,EAAE,MAAM,CAAC;IACb,cAAc;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,cAAc;AACd,eAAO,MAAM,kBAAkB,mCAAmC,CAAC;AAEnE,cAAc;AACd,eAAO,MAAM,cAAc;IAC1B,cAAc;;;;;;;mBAEF,MAAM;iBACR,MAAM;eACR,MAAM;cACP,MAAM;kBACF,MAAM;iBACP,MAAM;;IAMhB,cAAc;;;;;;;IAOd,cAAc;;;;;;;IAOd,cAAc;;;;;;;IAOd,gBAAgB;;;;;;;IAMhB,cAAc;;;;;;;CAOd,CAAC"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  GitHubClient,
3
3
  assertGitHubRepository,
4
4
  parseGitHubProfiles
5
- } from "./chunk-OAOKE6LC.js";
5
+ } from "./chunk-PNHJ5QZ6.js";
6
6
 
7
7
  // src/index.ts
8
8
  import { coreHostCapabilities } from "@leitwerk-dev/process-sdk";
@@ -14,15 +14,15 @@ var githubIntegration = createCapabilityToken(
14
14
  );
15
15
 
16
16
  // src/provider.ts
17
+ import { conflictEvidence, createConflictReporter } from "@leitwerk-dev/coding/repository-rebase";
17
18
  import { asUnknownRecord as asUnknownRecord2 } from "@leitwerk-dev/domain";
18
- import { conflictEvidence, createConflictReporter } from "@leitwerk-dev/repository-rebase";
19
19
  import { createPollSchedule as createPollSchedule2, emptyPollResult } from "@leitwerk-dev/watcher-utils";
20
20
 
21
21
  // src/external.ts
22
+ import { describeConflict } from "@leitwerk-dev/coding/repository-rebase";
22
23
  import {
23
24
  defineExternalActionSource
24
25
  } from "@leitwerk-dev/process-sdk";
25
- import { describeConflict } from "@leitwerk-dev/repository-rebase";
26
26
  var GITHUB_PR_STATE_KIND = "@leitwerk-private/github.pr_state";
27
27
  var GITHUB_RELEASE_KIND = "@leitwerk-private/github.release";
28
28
  function describeGitHubEvent(event) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/capability.ts","../src/provider.ts","../src/external.ts","../src/issue-provider.ts","../src/issue-watcher.ts","../src/poll-report.ts","../src/tools.ts","../src/binding.ts"],"sourcesContent":["import { coreHostCapabilities, type LeitwerkExtensionModule } from \"@leitwerk-dev/process-sdk\";\nimport { type GitHubIntegration, githubIntegration } from \"./capability.js\";\nimport { GitHubClient, parseGitHubProfiles } from \"./client.js\";\nimport { createGitHubProvider } from \"./provider.js\";\nimport { registerGitHubTools } from \"./tools.js\";\n\n/** @internal */\nconst manifest = {\n\tid: \"github\",\n\t/** @internal */\n\tversion: \"0.1.9\",\n} as const;\n\n/** @public */\nconst extension: LeitwerkExtensionModule = {\n\tmanifest,\n\tsetupServer(api, config) {\n\t\tconst profiles = parseGitHubProfiles(config);\n\t\tconst integration: GitHubIntegration = {\n\t\t\tprofiles: () => [...profiles.keys()],\n\t\t\tclient(profile) {\n\t\t\t\tconst value = profiles.get(profile);\n\t\t\t\tif (!value) throw new Error(`Unknown GitHub profile '${profile}'`);\n\t\t\t\treturn new GitHubClient(value);\n\t\t\t},\n\t\t};\n\t\tsetupGitHubIntegration(api, integration);\n\t},\n};\n\nexport default extension;\n\n/** Register shared tools and polling with an explicit integration. @public */\nexport function setupGitHubIntegration(\n\tapi: Parameters<NonNullable<LeitwerkExtensionModule[\"setupServer\"]>>[0],\n\tintegration: GitHubIntegration,\n\toptions: {\n\t\t/** @public */\n\t\tnow?: () => number;\n\t} = {},\n) {\n\tapi.provide(githubIntegration, integration);\n\tconst deps = api.get(coreHostCapabilities.serverSetup);\n\tif (!deps || Array.isArray(deps)) return;\n\tregisterGitHubTools(api, integration);\n\treturn createGitHubProvider(deps, integration, options);\n}\n\nexport { resolveGitHubProjectBinding } from \"./binding.js\";\nexport type { GitHubIntegration } from \"./capability.js\";\nexport { githubIntegration } from \"./capability.js\";\nexport type {\n\tGitHubCheckSummary,\n\tGitHubGitIdentity,\n\tGitHubIssue,\n\tGitHubPullRequest,\n\tGitHubRepository,\n} from \"./client.js\";\nexport {\n\tGITHUB_CHECKS_KIND,\n\tGITHUB_ISSUE_CANCELLED_KIND,\n\tGITHUB_PR_FEEDBACK_KIND,\n\tGITHUB_PR_STATE_KIND,\n\tGITHUB_PR_TERMINAL_KIND,\n\tgithubExternal,\n} from \"./external.js\";\nexport { githubIssueWatcherSource } from \"./issue-watcher.js\";\n","import { createCapabilityToken } from \"@leitwerk-dev/process-sdk\";\nimport type { GitHubClient } from \"./client.js\";\n\n/** Public contract shared by HTTP and local adapters. @public */\nexport type GitHubClientLike = Pick<GitHubClient, keyof GitHubClient>;\n\n/** @public */\nexport interface GitHubIntegration {\n\t/** @public */\n\tprofiles?(): readonly string[];\n\t/** @public */\n\tclient(profile: string): GitHubClientLike;\n}\n\n/** @public */\nexport const githubIntegration = createCapabilityToken<GitHubIntegration>(\n\t\"@leitwerk-private/github.integration\",\n);\n","import { asUnknownRecord } from \"@leitwerk-dev/domain\";\nimport type { CoreServerSetupDeps } from \"@leitwerk-dev/process-sdk\";\nimport { conflictEvidence, createConflictReporter } from \"@leitwerk-dev/repository-rebase\";\nimport { createPollSchedule, emptyPollResult } from \"@leitwerk-dev/watcher-utils\";\nimport type { GitHubIntegration } from \"./capability.js\";\nimport {\n\tdescribeGitHubEvent,\n\tGITHUB_PR_STATE_KIND,\n\tGITHUB_RELEASE_KIND,\n\ttype GitHubPullRequestSourceConfig,\n} from \"./external.js\";\nimport { createGitHubIssuePolling } from \"./issue-provider.js\";\nimport { githubPollReporter } from \"./poll-report.js\";\n\nfunction parse(value: unknown): GitHubPullRequestSourceConfig | null {\n\tconst config = asUnknownRecord(value) ?? {};\n\tif (\n\t\t[\"profile\", \"owner\", \"repo\", \"headSha\"].some(\n\t\t\t(key) => typeof config[key] !== \"string\" || !(config[key] as string).trim(),\n\t\t) ||\n\t\ttypeof config.prNumber !== \"number\"\n\t)\n\t\treturn null;\n\treturn {\n\t\tprofile: config.profile as string,\n\t\towner: config.owner as string,\n\t\trepo: config.repo as string,\n\t\tprNumber: config.prNumber,\n\t\theadSha: config.headSha as string,\n\t\tlastConflictKey: typeof config.lastConflictKey === \"string\" ? config.lastConflictKey : null,\n\t\tfeedbackCursor: typeof config.feedbackCursor === \"number\" ? config.feedbackCursor : 0,\n\t\tpollInterval: typeof config.pollInterval === \"string\" ? config.pollInterval : \"30s\",\n\t\tdisabled: config.disabled === true,\n\t\teventKinds: Array.isArray(config.eventKinds)\n\t\t\t? config.eventKinds.filter(\n\t\t\t\t\t(value): value is \"checks\" | \"feedback\" | \"merged\" | \"closed\" | \"merge_conflict\" =>\n\t\t\t\t\t\t[\"checks\", \"feedback\", \"merged\", \"closed\", \"merge_conflict\"].includes(String(value)),\n\t\t\t\t)\n\t\t\t: undefined,\n\t\tcheckStatuses: Array.isArray(config.checkStatuses)\n\t\t\t? config.checkStatuses.filter((value): value is \"pending\" | \"success\" | \"failure\" =>\n\t\t\t\t\t[\"pending\", \"success\", \"failure\"].includes(String(value)),\n\t\t\t\t)\n\t\t\t: undefined,\n\t};\n}\n\nexport function createGitHubProvider(\n\tdeps: CoreServerSetupDeps,\n\tintegration: GitHubIntegration,\n\toptions: { now?: () => number } = {},\n) {\n\tconst due = createPollSchedule();\n\tconst pollIssues = createGitHubIssuePolling(deps, integration, options);\n\tconst reportConflict = createConflictReporter(GITHUB_PR_STATE_KIND);\n\treturn deps.polling.create({\n\t\tid: \"github\",\n\t\tpollInterval: () => \"5s\",\n\t\tisEnabled: () => true,\n\t\tdefaultIntervalMs: 5_000,\n\t\tasync pollOnce() {\n\t\t\tconst result = emptyPollResult();\n\t\t\tconst report = githubPollReporter(deps.externalSources, result);\n\t\t\tawait pollIssues(result);\n\t\t\tawait report.poll(GITHUB_PR_STATE_KIND, async (armed) => {\n\t\t\t\tconst config = parse(armed.resolved);\n\t\t\t\tif (!config) {\n\t\t\t\t\tresult.errors.push(`${armed.id}:invalid_config`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (config.disabled) return;\n\t\t\t\tconst key = `${armed.instanceId}:${armed.id}:${armed.generation ?? \"\"}`;\n\t\t\t\tconst now = options.now?.() ?? Date.now();\n\t\t\t\tif (!due(key, config.pollInterval, now)) return;\n\t\t\t\ttry {\n\t\t\t\t\tconst client = integration.client(config.profile);\n\t\t\t\t\tconst pr = await client.getPullRequest(config.owner, config.repo, config.prNumber);\n\t\t\t\t\tif (!config.eventKinds || config.eventKinds.includes(\"merge_conflict\")) {\n\t\t\t\t\t\tconst conflict = conflictEvidence(config, pr, \"github\");\n\t\t\t\t\t\t// GitHub's PR base SHA can lag the branch even while its state is behind.\n\t\t\t\t\t\tif (conflict?.reason === \"behind\") {\n\t\t\t\t\t\t\tconst branch = await client.getCommit(config.owner, config.repo, conflict.baseBranch);\n\t\t\t\t\t\t\tconflict.baseSha = branch.sha;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tawait reportConflict(report, armed, conflict, config.lastConflictKey, {\n\t\t\t\t\t\t\t\tsummary: `PR #${pr.number} mergeability: ${pr.mergeable == null ? \"unresolved\" : (pr.mergeable_state ?? String(pr.mergeable))}`,\n\t\t\t\t\t\t\t\tobservedAt: new Date(now).toISOString(),\n\t\t\t\t\t\t\t\tsubject: `${config.owner}/${config.repo}#${pr.number}`,\n\t\t\t\t\t\t\t\trevision: `${pr.head.sha}:${conflict?.baseSha ?? pr.base.sha}`,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\tif (config.eventKinds?.length === 1) return;\n\t\t\t\t\t}\n\t\t\t\t\tlet event: Record<string, unknown> | null = null;\n\t\t\t\t\tlet mergeKey = \"\";\n\t\t\t\t\tif (pr.merged || pr.state === \"closed\") {\n\t\t\t\t\t\tevent = {\n\t\t\t\t\t\t\tkind: pr.merged ? \"merged\" : \"closed\",\n\t\t\t\t\t\t\tpullRequest: pr,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tmergeKey = `terminal:${pr.number}:${pr.merged}`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (pr.head.sha !== config.headSha) return;\n\t\t\t\t\t\tconst readsFeedback = !config.eventKinds || config.eventKinds.includes(\"feedback\");\n\t\t\t\t\t\tconst readsChecks = !config.eventKinds || config.eventKinds.includes(\"checks\");\n\t\t\t\t\t\tconst [feedback, checks] = await Promise.all([\n\t\t\t\t\t\t\treadsFeedback\n\t\t\t\t\t\t\t\t? client.listActionablePullRequestFeedback(\n\t\t\t\t\t\t\t\t\t\tconfig.owner,\n\t\t\t\t\t\t\t\t\t\tconfig.repo,\n\t\t\t\t\t\t\t\t\t\tconfig.prNumber,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: Promise.resolve([]),\n\t\t\t\t\t\t\treadsChecks || (deps.externalSources.observe && armed.generation)\n\t\t\t\t\t\t\t\t? client\n\t\t\t\t\t\t\t\t\t\t.getCheckSummary(config.owner, config.repo, config.headSha)\n\t\t\t\t\t\t\t\t\t\t.catch(async (error) => {\n\t\t\t\t\t\t\t\t\t\t\tawait report.observe(armed, {\n\t\t\t\t\t\t\t\t\t\t\t\trefreshError:\n\t\t\t\t\t\t\t\t\t\t\t\t\terror instanceof Error ? error.message : \"Checks refresh failed\",\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\tif (readsChecks) throw error;\n\t\t\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t: Promise.resolve(null),\n\t\t\t\t\t\t]);\n\t\t\t\t\t\tif (checks && checks.headSha !== config.headSha) return;\n\t\t\t\t\t\tconst refreshed = await client.getPullRequest(\n\t\t\t\t\t\t\tconfig.owner,\n\t\t\t\t\t\t\tconfig.repo,\n\t\t\t\t\t\t\tconfig.prNumber,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\trefreshed.state !== \"open\" ||\n\t\t\t\t\t\t\trefreshed.merged ||\n\t\t\t\t\t\t\trefreshed.head.sha !== config.headSha\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\tif (checks && deps.externalSources.observe && armed.generation) {\n\t\t\t\t\t\t\tconst description = describeGitHubEvent({ kind: \"checks\", checks });\n\t\t\t\t\t\t\tawait report.observe(armed, {\n\t\t\t\t\t\t\t\tobservation: {\n\t\t\t\t\t\t\t\t\t...description,\n\t\t\t\t\t\t\t\t\tobservedAt: new Date(now).toISOString(),\n\t\t\t\t\t\t\t\t\tsubject: `${config.owner}/${config.repo}#${config.prNumber}`,\n\t\t\t\t\t\t\t\t\trevision: checks.headSha,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst unseen = feedback.filter(\n\t\t\t\t\t\t\t(item) => item.id > config.feedbackCursor && item.author !== client.profile.botLogin,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (unseen.length) {\n\t\t\t\t\t\t\tconst feedbackCursor = Math.max(...unseen.map((item) => item.id));\n\t\t\t\t\t\t\tevent = { kind: \"feedback\", feedback, feedbackCursor };\n\t\t\t\t\t\t\tmergeKey = `feedback:${feedbackCursor}`;\n\t\t\t\t\t\t} else if (readsChecks && checks && checks.status !== \"pending\") {\n\t\t\t\t\t\t\tevent = { kind: \"checks\", checks };\n\t\t\t\t\t\t\tmergeKey = `checks:${checks.headSha}:${checks.status}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\t!event ||\n\t\t\t\t\t\t(config.eventKinds &&\n\t\t\t\t\t\t\t!config.eventKinds.includes(\n\t\t\t\t\t\t\t\tString(event.kind) as (typeof config.eventKinds)[number],\n\t\t\t\t\t\t\t)) ||\n\t\t\t\t\t\t(event.kind === \"checks\" &&\n\t\t\t\t\t\t\tconfig.checkStatuses &&\n\t\t\t\t\t\t\t!config.checkStatuses.includes(\n\t\t\t\t\t\t\t\t(event.checks as { status: \"pending\" | \"success\" | \"failure\" }).status,\n\t\t\t\t\t\t\t))\n\t\t\t\t\t)\n\t\t\t\t\t\treturn;\n\t\t\t\t\tawait report.fire(armed, event, mergeKey);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait report.observe(armed, {\n\t\t\t\t\t\trefreshError: error instanceof Error ? error.message : \"PR refresh failed\",\n\t\t\t\t\t});\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t});\n\t\t\tawait report.poll(GITHUB_RELEASE_KIND, async (armed) => {\n\t\t\t\tconst config = asUnknownRecord(armed.resolved) ?? {};\n\t\t\t\tif (\n\t\t\t\t\ttypeof config.profile !== \"string\" ||\n\t\t\t\t\ttypeof config.owner !== \"string\" ||\n\t\t\t\t\ttypeof config.repo !== \"string\" ||\n\t\t\t\t\ttypeof config.mergeSha !== \"string\"\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tif (config.disabled === true) return;\n\t\t\t\tconst key = `${armed.instanceId}:${armed.id}:${armed.generation ?? \"\"}`;\n\t\t\t\tconst now = options.now?.() ?? Date.now();\n\t\t\t\tif (!due(key, typeof config.pollInterval === \"string\" ? config.pollInterval : \"30s\", now))\n\t\t\t\t\treturn;\n\t\t\t\tconst client = integration.client(config.profile);\n\t\t\t\tfor (const release of await client.listReleases(config.owner, config.repo)) {\n\t\t\t\t\tif (release.draft || release.prerelease) continue;\n\t\t\t\t\tconst commit = await client.getCommit(config.owner, config.repo, release.tag_name);\n\t\t\t\t\tif (!(await client.isAncestor(config.owner, config.repo, config.mergeSha, commit.sha)))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tawait report.fire(\n\t\t\t\t\t\tarmed,\n\t\t\t\t\t\t{ release, commitSha: commit.sha },\n\t\t\t\t\t\t`${release.id}:${commit.sha}`,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn result;\n\t\t},\n\t});\n}\n","import {\n\tdefineExternalActionSource,\n\ttype ExternalEventDescription,\n} from \"@leitwerk-dev/process-sdk\";\nimport { describeConflict } from \"@leitwerk-dev/repository-rebase\";\n\n/** @internal */\nexport const GITHUB_PR_STATE_KIND = \"@leitwerk-private/github.pr_state\";\n\n/** @public */\nexport interface GitHubPullRequestSourceConfig {\n\t/** @public */\n\tprofile: string;\n\t/** @public */\n\towner: string;\n\t/** @public */\n\trepo: string;\n\t/** @public */\n\tprNumber: number;\n\t/** @public */\n\theadSha: string;\n\t/** @public */\n\tfeedbackCursor: number;\n\t/** @public */\n\tlastConflictKey?: string | null;\n\t/** @public */\n\tpollInterval?: string;\n\t/** @internal */\n\tdisabled?: boolean;\n\t/** @public */\n\teventKinds?: Array<\"checks\" | \"feedback\" | \"merged\" | \"closed\" | \"merge_conflict\">;\n\t/** @internal */\n\tcheckStatuses?: Array<\"pending\" | \"success\" | \"failure\">;\n}\n\n/** @internal */\nexport const GITHUB_RELEASE_KIND = \"@leitwerk-private/github.release\";\n\n/** @internal */\nexport interface GitHubReleaseSourceConfig {\n\t/** @internal */\n\tprofile: string;\n\t/** @internal */\n\towner: string;\n\t/** @internal */\n\trepo: string;\n\t/** @internal */\n\tmergeSha: string;\n\t/** @internal */\n\tpollInterval?: string;\n\t/** @internal */\n\tdisabled?: boolean;\n}\n\n/** @internal */\nexport function describeGitHubEvent(event: unknown): ExternalEventDescription {\n\tconst value = event as {\n\t\tkind?: string;\n\t\tchecks?: {\n\t\t\theadSha: string;\n\t\t\tstatus: string;\n\t\t\tfailed: Array<{ name: string; url: string | null }>;\n\t\t};\n\t\tpullRequest?: { number: number; merged?: boolean; state?: string };\n\t};\n\tif (value.kind === \"merge_conflict\") return describeConflict(event);\n\tif (value.checks) {\n\t\tconst checks = value.checks;\n\t\treturn {\n\t\t\tsummary: `Checks ${checks.status} on ${checks.headSha}${checks.failed.length ? `: ${checks.failed.map((check) => check.name).join(\", \")}` : \"\"}`,\n\t\t\tlinks: checks.failed.flatMap((check, index) =>\n\t\t\t\tcheck.url\n\t\t\t\t\t? [{ id: `check-${index}`, label: check.name, url: check.url, kind: \"pipeline\" as const }]\n\t\t\t\t\t: [],\n\t\t\t),\n\t\t};\n\t}\n\treturn {\n\t\tsummary:\n\t\t\tvalue.kind === \"merged\" || value.kind === \"closed\" || value.pullRequest\n\t\t\t\t? `PR #${value.pullRequest?.number} ${value.kind ?? (value.pullRequest?.merged ? \"merged\" : \"closed\")}`\n\t\t\t\t: value.kind === \"feedback\"\n\t\t\t\t\t? \"Pull request feedback received\"\n\t\t\t\t\t: \"GitHub event received\",\n\t};\n}\n\n/** @public */\nexport const GITHUB_PR_TERMINAL_KIND = \"@leitwerk-public/github.pr_terminal\";\n/** @public */\nexport const GITHUB_PR_FEEDBACK_KIND = \"@leitwerk-public/github.pr_feedback\";\n/** @public */\nexport const GITHUB_ISSUE_CANCELLED_KIND = \"@leitwerk-public/github.issue_cancelled\";\n\n/** @public */\nexport interface GitHubPullRequestTerminalSourceConfig {\n\t/** @public */\n\tprofile: string;\n\t/** @public */\n\towner: string;\n\t/** @public */\n\trepo: string;\n\t/** @public */\n\tprNumber: number;\n\t/** @public */\n\tpollInterval?: string;\n\t/** @public */\n\tterminalOutcome?: \"merged\" | \"closed\";\n\t/** @internal */\n\tdisabled?: boolean;\n}\n\n/** @public */\nexport interface GitHubFeedbackSourceConfig extends GitHubPullRequestTerminalSourceConfig {\n\t/** @public */\n\tconversationCursor: number;\n\t/** @public */\n\treviewCursor: number;\n\t/** @public */\n\tinlineCursor: number;\n\t/** @public */\n\tquietPeriodMs: number;\n}\n\n/** @public */\nexport interface GitHubIssueCancelledSourceConfig {\n\t/** @public */\n\tprofile: string;\n\t/** @public */\n\towner: string;\n\t/** @public */\n\trepo: string;\n\t/** @public */\n\tissueNumber: number;\n\t/** @public */\n\ttriggerLabel: string;\n\t/** @public */\n\tpollInterval?: string;\n}\n\n/** @public */\nexport const GITHUB_CHECKS_KIND = \"@leitwerk-public/github.checks\";\n\n/** @public */\nexport const githubExternal = {\n\t/** @public */\n\tchecks: defineExternalActionSource<{\n\t\tafterKey?: string;\n\t\tprofile: string;\n\t\towner: string;\n\t\trepo: string;\n\t\tprNumber: number;\n\t\theadSha: string;\n\t}>({\n\t\tkind: GITHUB_CHECKS_KIND,\n\t\tdescribeEvent: describeGitHubEvent,\n\t\tlabel: \"GitHub Actions failures\",\n\t}),\n\t/** @public */\n\tissueCancelled: defineExternalActionSource<GitHubIssueCancelledSourceConfig>({\n\t\tkind: GITHUB_ISSUE_CANCELLED_KIND,\n\t\tdescribeEvent: () => ({ summary: \"Source issue cancelled\" }),\n\t\tlabel: \"GitHub source issue cancelled\",\n\t\tdescription: \"Fires when the source issue closes or loses its trigger label\",\n\t}),\n\t/** @public */\n\tpullRequestTerminal: defineExternalActionSource<GitHubPullRequestTerminalSourceConfig>({\n\t\tkind: GITHUB_PR_TERMINAL_KIND,\n\t\tdescribeEvent: describeGitHubEvent,\n\t\tlabel: \"GitHub pull request merged or closed\",\n\t\tdescription: \"Fires when the tracked pull request reaches a terminal state\",\n\t}),\n\t/** @public */\n\tpullRequestFeedback: defineExternalActionSource<GitHubFeedbackSourceConfig>({\n\t\tkind: GITHUB_PR_FEEDBACK_KIND,\n\t\tdescribeEvent: () => ({ summary: \"Pull request feedback received\" }),\n\t\tlabel: \"GitHub pull request feedback\",\n\t\tdescription: \"Fires after unseen human feedback has been quiet long enough to batch\",\n\t}),\n\t/** @internal */\n\treleaseContaining: defineExternalActionSource<GitHubReleaseSourceConfig>({\n\t\tkind: GITHUB_RELEASE_KIND,\n\t\tlabel: \"Published GitHub release\",\n\t\tdescription: \"Fires when a published release contains the tracked merge commit\",\n\t}),\n\t/** @public */\n\tpullRequestState: defineExternalActionSource<GitHubPullRequestSourceConfig>({\n\t\tkind: GITHUB_PR_STATE_KIND,\n\t\tdescribeEvent: describeGitHubEvent,\n\t\tlabel: \"GitHub pull request state\",\n\t\tdescription: \"Fires for failed or successful checks, review feedback, and terminal PR state\",\n\t}),\n};\n","import { asUnknownRecord } from \"@leitwerk-dev/domain\";\nimport {\n\ttype CoreServerSetupDeps,\n\ttype ExternalSourceArmingLike,\n\tmatchesRepository as matchesConfiguredRepository,\n\tparseRepositoryFeedbackConfig as parseFeedbackConfig,\n\tparseRepositoryIssueCancelledConfig as parseIssueCancelledConfig,\n\tparseRepositoryPullRequestConfig as parsePrConfig,\n\ttype RegisteredProcessWatcherLike,\n\trepositoryFeedbackBatch,\n} from \"@leitwerk-dev/process-sdk\";\nimport { createPollSchedule, type emptyPollResult } from \"@leitwerk-dev/watcher-utils\";\nimport type { GitHubIntegration } from \"./capability.js\";\nimport type { GitHubIssue, GitHubRepository } from \"./client.js\";\nimport {\n\tdescribeGitHubEvent,\n\tGITHUB_CHECKS_KIND,\n\tGITHUB_ISSUE_CANCELLED_KIND,\n\tGITHUB_PR_FEEDBACK_KIND,\n\tGITHUB_PR_TERMINAL_KIND,\n} from \"./external.js\";\nimport {\n\ttype GitHubIssueWatcherConfig,\n\ttype GitHubIssueWatcherEvent,\n\tgithubIssueWatcherSource,\n} from \"./issue-watcher.js\";\nimport { githubPollReporter } from \"./poll-report.js\";\n\nfunction hasLabel(issue: GitHubIssue, label: string): boolean {\n\treturn issue.labels.some((candidate) => candidate.name === label);\n}\n\nfunction externalId(repo: GitHubRepository, issue: GitHubIssue): string {\n\treturn `github:${repo.full_name}#${issue.number}`;\n}\n\nexport { matchesConfiguredRepository };\n\nexport function createGitHubIssuePolling(\n\tdeps: CoreServerSetupDeps,\n\tintegration: GitHubIntegration,\n\toptions: { now?: () => number } = {},\n) {\n\tconst now = options.now ?? Date.now;\n\tconst due = createPollSchedule(now);\n\n\tasync function discover(\n\t\twatcher: RegisteredProcessWatcherLike<GitHubIssueWatcherConfig, GitHubIssueWatcherEvent>,\n\t\tresult: ReturnType<typeof emptyPollResult>,\n\t) {\n\t\tconst config = watcher.config;\n\t\tconst client = integration.client(config.profile);\n\t\tfor (const repo of await client.listRepositories()) {\n\t\t\tif (!matchesConfiguredRepository(config, repo)) continue;\n\t\t\tfor (const issue of await client.listOpenIssues(repo.owner.login, repo.name)) {\n\t\t\t\tif (!hasLabel(issue, config.labels.trigger) || hasLabel(issue, config.labels.done))\n\t\t\t\t\tcontinue;\n\t\t\t\tconst id = externalId(repo, issue);\n\t\t\t\ttry {\n\t\t\t\t\tif (deps.processes.listAll().some((process) => process.externalId === id)) {\n\t\t\t\t\t\tresult.skipped.push(id);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst authorized = await client.authorizedTrigger(\n\t\t\t\t\t\trepo.owner.login,\n\t\t\t\t\t\trepo.name,\n\t\t\t\t\t\tissue.number,\n\t\t\t\t\t\tconfig.labels.trigger,\n\t\t\t\t\t\tconfig.labels.done,\n\t\t\t\t\t);\n\t\t\t\t\tif (!authorized) {\n\t\t\t\t\t\tresult.skipped.push(`${id}:unauthorized`);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst event: GitHubIssueWatcherEvent = {\n\t\t\t\t\t\tprofile: config.profile,\n\t\t\t\t\t\trepository: repo,\n\t\t\t\t\t\tissue: authorized.issue,\n\t\t\t\t\t\tauthorization: {\n\t\t\t\t\t\t\tactor: authorized.actor,\n\t\t\t\t\t\t\teventId: authorized.eventId,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels: config.labels,\n\t\t\t\t\t};\n\n\t\t\t\t\tconst guardedWatcher = {\n\t\t\t\t\t\t...watcher,\n\t\t\t\t\t\tasync resolveLaunchAttempt(...args: Parameters<typeof watcher.resolveLaunchAttempt>) {\n\t\t\t\t\t\t\tconst attempt = await watcher.resolveLaunchAttempt(...args);\n\t\t\t\t\t\t\tif (!attempt) return null;\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...attempt,\n\t\t\t\t\t\t\t\tpreparationChecks: [\n\t\t\t\t\t\t\t\t\t...attempt.preparationChecks,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tid: \"github-trigger-authorization\",\n\t\t\t\t\t\t\t\t\t\tlabel: \"Check GitHub trigger authorization\",\n\t\t\t\t\t\t\t\t\t\tasync run() {\n\t\t\t\t\t\t\t\t\t\t\tconst rechecked = await client.authorizedTrigger(\n\t\t\t\t\t\t\t\t\t\t\t\trepo.owner.login,\n\t\t\t\t\t\t\t\t\t\t\t\trepo.name,\n\t\t\t\t\t\t\t\t\t\t\t\tissue.number,\n\t\t\t\t\t\t\t\t\t\t\t\tconfig.labels.trigger,\n\t\t\t\t\t\t\t\t\t\t\t\tconfig.labels.done,\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t!rechecked ||\n\t\t\t\t\t\t\t\t\t\t\t\trechecked.eventId !== authorized.eventId ||\n\t\t\t\t\t\t\t\t\t\t\t\trechecked.actor !== authorized.actor\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error(\"GitHub trigger authorization changed before launch\");\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst launched = await deps.launchRuns.startWatcher(guardedWatcher, event, {\n\t\t\t\t\t\tidempotencyKey: id,\n\t\t\t\t\t});\n\t\t\t\t\tif (launched.error) result.errors.push(`${id}:launch_failed:${launched.error}`);\n\t\t\t\t\telse if (launched.process) result.created.push(id);\n\t\t\t\t\telse result.skipped.push(id);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tresult.errors.push(\n\t\t\t\t\t\t`${id}:${error instanceof Error ? error.message : \"discovery_failed\"}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync function pollExternal(result: ReturnType<typeof emptyPollResult>) {\n\t\tconst report = githubPollReporter(deps.externalSources, result);\n\t\tconst terminalArmings = deps.externalSources.listArmed(GITHUB_PR_TERMINAL_KIND);\n\t\tconst terminalInstances = new Set<string>();\n\t\tasync function poll<C extends { pollInterval?: string; disabled?: boolean }>(\n\t\t\tkind: string,\n\t\t\tparse: (value: unknown) => C | null,\n\t\t\tread: (config: C, armed: ExternalSourceArmingLike) => Promise<void>,\n\t\t) {\n\t\t\tconst armings =\n\t\t\t\tkind === GITHUB_PR_TERMINAL_KIND ? terminalArmings : deps.externalSources.listArmed(kind);\n\t\t\tfor (const armed of armings) {\n\t\t\t\tif (kind !== GITHUB_PR_TERMINAL_KIND && terminalInstances.has(armed.instanceId)) continue;\n\t\t\t\tconst config = parse(armed.resolved);\n\t\t\t\tconst key = `${armed.instanceId}:${armed.id}:${armed.generation ?? \"\"}`;\n\t\t\t\tif (!config || !due(key, config.pollInterval ?? \"30s\") || config.disabled) continue;\n\t\t\t\ttry {\n\t\t\t\t\tawait read(config, armed);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait report.observe(armed, {\n\t\t\t\t\t\trefreshError: error instanceof Error ? error.message : \"GitHub refresh failed\",\n\t\t\t\t\t});\n\t\t\t\t\tconst fallback = kind === GITHUB_CHECKS_KIND ? \"checks_failed\" : \"poll_failed\";\n\t\t\t\t\tresult.errors.push(`${armed.id}:${error instanceof Error ? error.message : fallback}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tawait poll(GITHUB_PR_TERMINAL_KIND, parsePrConfig, async (config, armed) => {\n\t\t\tconst pr = await integration\n\t\t\t\t.client(config.profile)\n\t\t\t\t.getPullRequest(config.owner, config.repo, config.prNumber);\n\t\t\tif (!pr.merged && pr.state !== \"closed\") return;\n\t\t\tif (!report.isCurrent(GITHUB_PR_TERMINAL_KIND, armed)) return;\n\t\t\tterminalInstances.add(armed.instanceId);\n\t\t\tconst outcome = pr.merged ? \"merged\" : \"closed\";\n\t\t\tif (config.terminalOutcome && config.terminalOutcome !== outcome) return;\n\t\t\tawait report.fire(armed, { pullRequest: pr }, `${pr.number}:${outcome}`);\n\t\t});\n\n\t\tawait poll(\n\t\t\tGITHUB_CHECKS_KIND,\n\t\t\t(value) => ({ pollInterval: \"30s\", config: asUnknownRecord(value) ?? {} }),\n\t\t\tasync ({ config }, armed) => {\n\t\t\t\tconst client = integration.client(String(config.profile));\n\t\t\t\tconst pr = await client.getPullRequest(\n\t\t\t\t\tString(config.owner),\n\t\t\t\t\tString(config.repo),\n\t\t\t\t\tNumber(config.prNumber),\n\t\t\t\t);\n\t\t\t\tif (pr.state !== \"open\" || pr.head.sha !== config.headSha) return;\n\t\t\t\tconst checks = await client.getCheckSummary(\n\t\t\t\t\tString(config.owner),\n\t\t\t\t\tString(config.repo),\n\t\t\t\t\tString(config.headSha),\n\t\t\t\t);\n\t\t\t\tif (checks.headSha !== config.headSha) return;\n\t\t\t\tconst refreshed = await client.getPullRequest(\n\t\t\t\t\tString(config.owner),\n\t\t\t\t\tString(config.repo),\n\t\t\t\t\tNumber(config.prNumber),\n\t\t\t\t);\n\t\t\t\tif (refreshed.state !== \"open\" || refreshed.merged || refreshed.head.sha !== checks.headSha)\n\t\t\t\t\treturn;\n\t\t\t\tawait report.observe(armed, {\n\t\t\t\t\tobservation: {\n\t\t\t\t\t\t...describeGitHubEvent({ checks }),\n\t\t\t\t\t\tobservedAt: new Date(now()).toISOString(),\n\t\t\t\t\t\tsubject: `${config.owner}/${config.repo}#${config.prNumber}`,\n\t\t\t\t\t\trevision: checks.headSha,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (checks.status !== \"failure\") return;\n\t\t\t\tconst evidenceKey = `${checks.headSha}:${checks.failed.map((run) => run.url).join(\":\")}`;\n\t\t\t\tif (config.afterKey === evidenceKey) return;\n\t\t\t\tawait report.fire(armed, { checks }, evidenceKey);\n\t\t\t},\n\t\t);\n\n\t\tawait poll(GITHUB_ISSUE_CANCELLED_KIND, parseIssueCancelledConfig, async (config, armed) => {\n\t\t\tconst issue = await integration\n\t\t\t\t.client(config.profile)\n\t\t\t\t.getIssue(config.owner, config.repo, config.issueNumber);\n\t\t\tconst reason =\n\t\t\t\tissue.state === \"closed\"\n\t\t\t\t\t? \"issue_closed\"\n\t\t\t\t\t: hasLabel(issue, config.triggerLabel)\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: \"trigger_label_removed\";\n\t\t\tif (!reason) return;\n\t\t\t// A merge may close the issue between terminal polls. Preserve terminal\n\t\t\t// reconciliation instead of treating that close as cancellation.\n\t\t\tconst terminal = terminalArmings\n\t\t\t\t.filter((candidate) => candidate.instanceId === armed.instanceId)\n\t\t\t\t.map((candidate) => parsePrConfig(candidate.resolved))\n\t\t\t\t.find((candidate) => candidate && !candidate.disabled);\n\t\t\tif (terminal) {\n\t\t\t\tconst pr = await integration\n\t\t\t\t\t.client(terminal.profile)\n\t\t\t\t\t.getPullRequest(terminal.owner, terminal.repo, terminal.prNumber);\n\t\t\t\tif (pr.merged || pr.state === \"closed\") {\n\t\t\t\t\tterminalInstances.add(armed.instanceId);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait report.fire(armed, { issue, reason }, `${issue.number}:${reason}`);\n\t\t});\n\t\tawait poll(GITHUB_PR_FEEDBACK_KIND, parseFeedbackConfig, async (config, armed) => {\n\t\t\tconst client = integration.client(config.profile);\n\t\t\tconst pr = await client.getPullRequest(config.owner, config.repo, config.prNumber);\n\t\t\tif (pr.merged || pr.state !== \"open\") return;\n\t\t\tconst unseen = (\n\t\t\t\tawait client.listActionablePullRequestFeedback(config.owner, config.repo, config.prNumber)\n\t\t\t).filter((item) => item.id > config[`${item.kind}Cursor`]);\n\n\t\t\tconst batch = repositoryFeedbackBatch(unseen, config, now());\n\t\t\tif (batch) await report.fire(armed, batch.event, batch.mergeKey);\n\t\t});\n\t}\n\n\treturn async (result: ReturnType<typeof emptyPollResult>) => {\n\t\tconst watchers = deps.processWatchers?.listBySource(githubIssueWatcherSource) ?? [];\n\t\tfor (const watcher of watchers) {\n\t\t\tif (\n\t\t\t\t!watcher.enabled ||\n\t\t\t\t!due(`${watcher.processId}:${watcher.watcherId}`, watcher.config.pollInterval)\n\t\t\t)\n\t\t\t\tcontinue;\n\t\t\ttry {\n\t\t\t\tawait discover(watcher, result);\n\t\t\t} catch (error) {\n\t\t\t\tresult.errors.push(\n\t\t\t\t\t`${watcher.processId}:${watcher.watcherId}:${error instanceof Error ? error.message : \"discovery_failed\"}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tawait pollExternal(result);\n\t};\n}\n","import {\n\tdefineProcessWatcherSource,\n\tparseRepositoryIssueWatcherConfig,\n\tpresentRepositoryIssueWatcherConfig,\n\ttype RepositoryIssueWatcherConfig,\n} from \"@leitwerk-dev/process-sdk\";\nimport type { GitHubIssue, GitHubRepository } from \"./client.js\";\n\n/** @public */\nexport interface GitHubIssueWatcherConfig extends RepositoryIssueWatcherConfig {}\n\n/** @public */\nexport interface GitHubIssueWatcherEvent {\n\t/** @public */\n\tauthorization: {\n\t\t/** @internal */\n\t\tactor: string;\n\t\t/** @internal */\n\t\teventId: number;\n\t};\n\t/** @public */\n\tprofile: string;\n\t/** @public */\n\trepository: GitHubRepository;\n\t/** @public */\n\tissue: GitHubIssue;\n\t/** @public */\n\tlabels: {\n\t\t/** @public */\n\t\ttrigger: string;\n\t\t/** @public */\n\t\tdone: string;\n\t};\n}\n\n/** @public */\nexport const githubIssueWatcherSource = defineProcessWatcherSource<\n\tGitHubIssueWatcherConfig,\n\tGitHubIssueWatcherEvent\n>({\n\tid: \"@leitwerk-public/github.issue\",\n\tlabel: \"GitHub issue\",\n\tparseConfig: (raw) => parseRepositoryIssueWatcherConfig(raw, \"github_issue\", true),\n\tpresentConfig: presentRepositoryIssueWatcherConfig,\n});\n","import {\n\tcreateExternalSourcePollReporter,\n\ttype ExternalSourceServiceLike,\n} from \"@leitwerk-dev/process-sdk\";\nimport {\n\tGITHUB_CHECKS_KIND,\n\tGITHUB_ISSUE_CANCELLED_KIND,\n\tGITHUB_PR_FEEDBACK_KIND,\n\tGITHUB_PR_STATE_KIND,\n\tGITHUB_PR_TERMINAL_KIND,\n\tGITHUB_RELEASE_KIND,\n} from \"./external.js\";\n\nexport function githubPollReporter(\n\tsources: ExternalSourceServiceLike,\n\tresult: { created: string[]; errors: string[] },\n) {\n\treturn createExternalSourcePollReporter(sources, result, {\n\t\tforwardGeneration: true,\n\t\tcurrentKinds: [\n\t\t\tGITHUB_CHECKS_KIND,\n\t\t\tGITHUB_PR_STATE_KIND,\n\t\t\tGITHUB_PR_TERMINAL_KIND,\n\t\t\tGITHUB_PR_FEEDBACK_KIND,\n\t\t\tGITHUB_ISSUE_CANCELLED_KIND,\n\t\t\tGITHUB_RELEASE_KIND,\n\t\t],\n\t});\n}\n","import {\n\texistingObject,\n\ttype IntegrationToolExecutionContext,\n\tmatchesPatch,\n\tnumberArg,\n\tobjectArg,\n\tprojectParameters,\n\ttype ServerExtensionAPI,\n\tstringArg,\n} from \"@leitwerk-dev/process-sdk\";\nimport { resolveGitHubProjectBinding } from \"./binding.js\";\nimport type { GitHubIntegration } from \"./capability.js\";\nimport { assertGitHubRepository } from \"./client.js\";\n\nconst object = (value: unknown) => objectArg(value, \"Expected an object\");\n\nexport function registerGitHubTools(api: ServerExtensionAPI, integration: GitHubIntegration) {\n\tconst target = (ctx: IntegrationToolExecutionContext) => {\n\t\tconst binding = resolveGitHubProjectBinding(ctx);\n\t\tassertGitHubRepository(\n\t\t\tintegration.client(binding.profile).profile,\n\t\t\tbinding.owner,\n\t\t\tbinding.repo,\n\t\t);\n\t\treturn binding;\n\t};\n\tapi.tool({\n\t\tname: \"github_resolve_git_identity\",\n\t\tdescription: \"Resolve the configured GitHub Git identity\",\n\t\tparameters: projectParameters(),\n\t\tasync execute(ctx) {\n\t\t\tconst t = target(ctx);\n\t\t\treturn integration.client(t.profile).resolveGitIdentity(t.profile);\n\t\t},\n\t});\n\tfor (const name of [\n\t\t\"github_ensure_label\",\n\t\t\"github_update_issue\",\n\t\t\"github_add_issue_comment\",\n\t\t\"github_add_pull_request_feedback_reaction\",\n\t\t\"github_reply_to_pull_request_feedback\",\n\t\t\"github_add_pull_request_comment\",\n\t\t\"github_update_pull_request\",\n\t] as const) {\n\t\tconst pullRequest =\n\t\t\tname === \"github_add_pull_request_comment\" || name === \"github_update_pull_request\";\n\t\tconst update = name === \"github_update_issue\" || name === \"github_update_pull_request\";\n\t\tapi.tool({\n\t\t\tname,\n\t\t\tdescription: pullRequest\n\t\t\t\t? update\n\t\t\t\t\t? \"Update a GitHub pull request\"\n\t\t\t\t\t: \"Comment on a GitHub pull request\"\n\t\t\t\t: \"Reconcile GitHub delivery in the current process project\",\n\t\t\tparameters: pullRequest\n\t\t\t\t? projectParameters(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpullRequestNumber: { type: \"integer\" },\n\t\t\t\t\t\t\t...(update\n\t\t\t\t\t\t\t\t? { patch: { type: \"object\" } }\n\t\t\t\t\t\t\t\t: { body: { type: \"string\" }, writeKey: { type: \"string\" } }),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[\"pullRequestNumber\", update ? \"patch\" : \"body\"],\n\t\t\t\t\t)\n\t\t\t\t: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tprojectKey: { type: \"string\" },\n\t\t\t\t\t\t\tissueNumber: { type: \"integer\" },\n\t\t\t\t\t\t\tpullRequestNumber: { type: \"integer\" },\n\t\t\t\t\t\t\tname: { type: \"string\" },\n\t\t\t\t\t\t\tpatch: { type: \"object\" },\n\t\t\t\t\t\t\tbody: { type: \"string\" },\n\t\t\t\t\t\t\tfeedbackKind: { type: \"string\" },\n\t\t\t\t\t\t\tfeedbackId: { type: \"integer\" },\n\t\t\t\t\t\t\twriteKey: { type: \"string\" },\n\t\t\t\t\t\t},\n\t\t\t\t\t\trequired: [\"projectKey\"],\n\t\t\t\t\t},\n\t\t\tasync execute(ctx, args) {\n\t\t\t\tconst input = object(args);\n\t\t\t\tconst t = target(ctx);\n\t\t\t\tconst client = integration.client(t.profile);\n\t\t\t\tconst key =\n\t\t\t\t\t!(pullRequest && update) && typeof input.writeKey === \"string\"\n\t\t\t\t\t\t? stringArg(input, \"writeKey\")\n\t\t\t\t\t\t: ctx.idempotencyKey;\n\t\t\t\tconst signal = pullRequest ? ctx.signal : undefined;\n\t\t\t\tconst marker = `<!-- leitwerk-write:${ctx.process.id}:${key} -->`;\n\t\t\t\tconst issueNumber = () =>\n\t\t\t\t\tnumberArg(\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tpullRequest || input.issueNumber == null ? \"pullRequestNumber\" : \"issueNumber\",\n\t\t\t\t\t);\n\t\t\t\tconst findComment = async () => {\n\t\t\t\t\tconst replies =\n\t\t\t\t\t\tname === \"github_reply_to_pull_request_feedback\"\n\t\t\t\t\t\t\t? await client.listFeedbackReplies(\n\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\tissueNumber(),\n\t\t\t\t\t\t\t\t\tstringArg(input, \"feedbackKind\"),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: await client.listIssueComments(t.owner, t.repo, issueNumber(), signal);\n\t\t\t\t\treturn (\n\t\t\t\t\t\treplies.find(\n\t\t\t\t\t\t\t(comment) =>\n\t\t\t\t\t\t\t\tString(comment.body).includes(marker) &&\n\t\t\t\t\t\t\t\t(name !== \"github_reply_to_pull_request_feedback\" ||\n\t\t\t\t\t\t\t\t\tinput.feedbackKind !== \"inline\" ||\n\t\t\t\t\t\t\t\t\tobject(comment).in_reply_to_id === numberArg(input, \"feedbackId\")),\n\t\t\t\t\t\t) ?? null\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t\tconst result = await ctx.externalWrites.ensure(\n\t\t\t\t\t{\n\t\t\t\t\t\twriteType: pullRequest ? (update ? \"github.update_pr\" : \"github.comment\") : name,\n\t\t\t\t\t\tdedupKey: key,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\treconcile: async (phase): Promise<object | null> =>\n\t\t\t\t\t\t\texistingObject(async () => {\n\t\t\t\t\t\t\t\tif (name === \"github_ensure_label\")\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t(await client.listLabels(t.owner, t.repo)).find(\n\t\t\t\t\t\t\t\t\t\t\t(label) => label.name === stringArg(input, \"name\"),\n\t\t\t\t\t\t\t\t\t\t) ?? null\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tif (update) {\n\t\t\t\t\t\t\t\t\tconst current = await client[pullRequest ? \"getPullRequest\" : \"getIssue\"](\n\t\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\t\tissueNumber(),\n\t\t\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn current &&\n\t\t\t\t\t\t\t\t\t\t(phase === \"already_recorded\" || matchesPatch(current, object(input.patch)))\n\t\t\t\t\t\t\t\t\t\t? current\n\t\t\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (name === \"github_add_pull_request_feedback_reaction\")\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tawait client.listFeedbackReactions(\n\t\t\t\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\t\t\t\tstringArg(input, \"feedbackKind\"),\n\t\t\t\t\t\t\t\t\t\t\t\tnumberArg(input, \"feedbackId\"),\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t).find(\n\t\t\t\t\t\t\t\t\t\t\t(reaction) =>\n\t\t\t\t\t\t\t\t\t\t\t\treaction.content === \"eyes\" &&\n\t\t\t\t\t\t\t\t\t\t\t\treaction.user.login.toLowerCase() === client.profile.botLogin.toLowerCase(),\n\t\t\t\t\t\t\t\t\t\t) ?? null\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn findComment();\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\texecute: async (): Promise<object> => {\n\t\t\t\t\t\t\tif (name === \"github_ensure_label\")\n\t\t\t\t\t\t\t\treturn client.createLabel(t.owner, t.repo, stringArg(input, \"name\"));\n\t\t\t\t\t\t\tif (update)\n\t\t\t\t\t\t\t\treturn pullRequest\n\t\t\t\t\t\t\t\t\t? object(\n\t\t\t\t\t\t\t\t\t\t\tawait client.updatePullRequest(\n\t\t\t\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\t\t\t\tissueNumber(),\n\t\t\t\t\t\t\t\t\t\t\t\tobject(input.patch),\n\t\t\t\t\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t: client.updateIssue(t.owner, t.repo, issueNumber(), object(input.patch));\n\t\t\t\t\t\t\tif (name === \"github_add_pull_request_feedback_reaction\")\n\t\t\t\t\t\t\t\treturn object(\n\t\t\t\t\t\t\t\t\tawait client.addFeedbackReaction(\n\t\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\t\tstringArg(input, \"feedbackKind\"),\n\t\t\t\t\t\t\t\t\t\tnumberArg(input, \"feedbackId\"),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst body = `${stringArg(input, \"body\")}\\n\\n${marker}`;\n\t\t\t\t\t\t\treturn object(\n\t\t\t\t\t\t\t\tawait (name === \"github_add_issue_comment\" || pullRequest\n\t\t\t\t\t\t\t\t\t? client.addIssueComment(t.owner, t.repo, issueNumber(), body, signal)\n\t\t\t\t\t\t\t\t\t: client.replyFeedback(\n\t\t\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\t\t\tissueNumber(),\n\t\t\t\t\t\t\t\t\t\t\tstringArg(input, \"feedbackKind\"),\n\t\t\t\t\t\t\t\t\t\t\tnumberArg(input, \"feedbackId\"),\n\t\t\t\t\t\t\t\t\t\t\tbody,\n\t\t\t\t\t\t\t\t\t\t)),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttoMetadata: (value) =>\n\t\t\t\t\t\t\tpullRequest\n\t\t\t\t\t\t\t\t? { owner: t.owner, repo: t.repo, pullRequestNumber: issueNumber() }\n\t\t\t\t\t\t\t\t: { value },\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tif (name === \"github_ensure_label\") return { name: stringArg(input, \"name\") };\n\t\t\t\treturn result;\n\t\t\t},\n\t\t});\n\t}\n\n\tapi.tool<Record<string, unknown>>({\n\t\tname: \"github_ensure_pull_request\",\n\t\tdescription: \"Create a GitHub pull request unless the branch pair already has one\",\n\t\tparameters: projectParameters({\n\t\t\ttitle: { type: \"string\" },\n\t\t\tbody: { type: \"string\" },\n\t\t\thead: { type: \"string\" },\n\t\t\tbase: { type: \"string\" },\n\t\t}),\n\t\tasync execute(ctx, input) {\n\t\t\tconst t = target(ctx);\n\t\t\tconst client = integration.client(t.profile);\n\t\t\tconst head = stringArg(input, \"head\");\n\t\t\tconst base = stringArg(input, \"base\");\n\t\t\tif (head !== ctx.project?.workBranch || base !== ctx.project?.baseBranch)\n\t\t\t\tthrow new Error(\"Pull request branches must match the process project\");\n\t\t\tconst find = async () =>\n\t\t\t\t(await client.listPullRequests(t.owner, t.repo, \"all\")).find(\n\t\t\t\t\t(candidate) => candidate.head.ref === head && candidate.base.ref === base,\n\t\t\t\t) ?? null;\n\t\t\treturn ctx.externalWrites.ensure(\n\t\t\t\t{ writeType: \"github.ensure_pr\", dedupKey: ctx.idempotencyKey },\n\t\t\t\t{\n\t\t\t\t\treconcile: () => existingObject(find),\n\t\t\t\t\texecute: () =>\n\t\t\t\t\t\tclient.createPullRequest(t.owner, t.repo, {\n\t\t\t\t\t\t\ttitle: stringArg(input, \"title\"),\n\t\t\t\t\t\t\tbody: stringArg(input, \"body\"),\n\t\t\t\t\t\t\thead,\n\t\t\t\t\t\t\tbase,\n\t\t\t\t\t\t}),\n\t\t\t\t\ttoMetadata: (pr) => ({ number: pr.number, url: pr.html_url }),\n\t\t\t\t},\n\t\t\t);\n\t\t},\n\t});\n\tfor (const [name, description, numberName, method] of [\n\t\t[\n\t\t\t\"github_get_issue\",\n\t\t\t\"Read a GitHub issue in the current process project\",\n\t\t\t\"issueNumber\",\n\t\t\t\"getIssue\",\n\t\t],\n\t\t[\n\t\t\t\"github_get_pull_request\",\n\t\t\t\"Read a GitHub pull request in the current process project\",\n\t\t\t\"pullRequestNumber\",\n\t\t\t\"getPullRequest\",\n\t\t],\n\t\t[\n\t\t\t\"github_list_pull_request_feedback\",\n\t\t\t\"Read GitHub pull request conversation, reviews, and inline comments\",\n\t\t\t\"pullRequestNumber\",\n\t\t\t\"listActionablePullRequestFeedback\",\n\t\t],\n\t] as const) {\n\t\tapi.tool<Record<string, unknown>>({\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tparameters: projectParameters({ [numberName]: { type: \"integer\" } }),\n\t\t\tasync execute(ctx, input) {\n\t\t\t\tconst t = target(ctx);\n\t\t\t\treturn integration\n\t\t\t\t\t.client(t.profile)\n\t\t\t\t\t[method](t.owner, t.repo, numberArg(input, numberName), ctx.signal);\n\t\t\t},\n\t\t});\n\t}\n\tapi.tool<Record<string, unknown>>({\n\t\tname: \"github_get_ci_diagnostics\",\n\t\tdescription:\n\t\t\t\"Read failed check annotations and bounded Actions logs for the current request revision\",\n\t\tparameters: projectParameters(\n\t\t\t{ pullRequestNumber: { type: \"integer\" }, headSha: { type: \"string\" } },\n\t\t\t[\"pullRequestNumber\", \"headSha\"],\n\t\t),\n\t\tasync execute(ctx, input) {\n\t\t\tconst t = target(ctx);\n\t\t\tconst client = integration.client(t.profile);\n\t\t\tconst number = numberArg(input, \"pullRequestNumber\");\n\t\t\tconst pr = await client.getPullRequest(t.owner, t.repo, number, ctx.signal);\n\t\t\tif (pr.head.ref !== ctx.project?.workBranch || pr.base.ref !== ctx.project.baseBranch)\n\t\t\t\tthrow new Error(\"Pull request does not belong to the process branches\");\n\t\t\treturn client.getCiDiagnostics(\n\t\t\t\tt.owner,\n\t\t\t\tt.repo,\n\t\t\t\tnumber,\n\t\t\t\tstringArg(input, \"headSha\"),\n\t\t\t\tctx.signal,\n\t\t\t);\n\t\t},\n\t});\n\n\tapi.tool<Record<string, unknown>>({\n\t\tname: \"github_get_checks\",\n\t\tdescription: \"Read GitHub Actions check runs for a commit\",\n\t\tparameters: projectParameters({ headSha: { type: \"string\" } }),\n\t\tasync execute(ctx, input) {\n\t\t\tconst t = target(ctx);\n\t\t\treturn integration\n\t\t\t\t.client(t.profile)\n\t\t\t\t.getCheckSummary(t.owner, t.repo, stringArg(input, \"headSha\"));\n\t\t},\n\t});\n}\n","import { resolveRepositoryProjectBinding } from \"@leitwerk-dev/process-sdk\";\n\nexport type { RepositoryProjectBinding as GitHubProjectBinding } from \"@leitwerk-dev/process-sdk\";\n/** @public */\nexport const resolveGitHubProjectBinding = (\n\tctx: Parameters<typeof resolveRepositoryProjectBinding>[0],\n) => resolveRepositoryProjectBinding(ctx, \"github\");\n"],"mappings":";;;;;;;AAAA,SAAS,4BAA0D;;;ACAnE,SAAS,6BAA6B;AAe/B,IAAM,oBAAoB;AAAA,EAChC;AACD;;;ACjBA,SAAS,mBAAAA,wBAAuB;AAEhC,SAAS,kBAAkB,8BAA8B;AACzD,SAAS,sBAAAC,qBAAoB,uBAAuB;;;ACHpD;AAAA,EACC;AAAA,OAEM;AACP,SAAS,wBAAwB;AAG1B,IAAM,uBAAuB;AA6B7B,IAAM,sBAAsB;AAmB5B,SAAS,oBAAoB,OAA0C;AAC7E,QAAM,QAAQ;AASd,MAAI,MAAM,SAAS,iBAAkB,QAAO,iBAAiB,KAAK;AAClE,MAAI,MAAM,QAAQ;AACjB,UAAM,SAAS,MAAM;AACrB,WAAO;AAAA,MACN,SAAS,UAAU,OAAO,MAAM,OAAO,OAAO,OAAO,GAAG,OAAO,OAAO,SAAS,KAAK,OAAO,OAAO,IAAI,CAAC,UAAU,MAAM,IAAI,EAAE,KAAK,IAAI,CAAC,KAAK,EAAE;AAAA,MAC9I,OAAO,OAAO,OAAO;AAAA,QAAQ,CAAC,OAAO,UACpC,MAAM,MACH,CAAC,EAAE,IAAI,SAAS,KAAK,IAAI,OAAO,MAAM,MAAM,KAAK,MAAM,KAAK,MAAM,WAAoB,CAAC,IACvF,CAAC;AAAA,MACL;AAAA,IACD;AAAA,EACD;AACA,SAAO;AAAA,IACN,SACC,MAAM,SAAS,YAAY,MAAM,SAAS,YAAY,MAAM,cACzD,OAAO,MAAM,aAAa,MAAM,IAAI,MAAM,SAAS,MAAM,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B;AAAA,IACjC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,YAAY,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,EAAE,CAAC;AAAA,IAC7D,MAAM,QAAQ,KAAK,OAAO;AACzB,YAAM,IAAI,OAAO,GAAG;AACpB,aAAO,YACL,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,OAAO,SAAS,CAAC;AAAA,IAC/D;AAAA,EACD,CAAC;AACF;;;APhTA,IAAM,WAAW;AAAA,EAChB,IAAI;AAAA;AAAA,EAEJ,SAAS;AACV;AAGA,IAAM,YAAqC;AAAA,EAC1C;AAAA,EACA,YAAY,KAAK,QAAQ;AACxB,UAAM,WAAW,oBAAoB,MAAM;AAC3C,UAAM,cAAiC;AAAA,MACtC,UAAU,MAAM,CAAC,GAAG,SAAS,KAAK,CAAC;AAAA,MACnC,OAAO,SAAS;AACf,cAAM,QAAQ,SAAS,IAAI,OAAO;AAClC,YAAI,CAAC,MAAO,OAAM,IAAI,MAAM,2BAA2B,OAAO,GAAG;AACjE,eAAO,IAAI,aAAa,KAAK;AAAA,MAC9B;AAAA,IACD;AACA,2BAAuB,KAAK,WAAW;AAAA,EACxC;AACD;AAEA,IAAO,gBAAQ;AAGR,SAAS,uBACf,KACA,aACA,UAGI,CAAC,GACJ;AACD,MAAI,QAAQ,mBAAmB,WAAW;AAC1C,QAAM,OAAO,IAAI,IAAI,qBAAqB,WAAW;AACrD,MAAI,CAAC,QAAQ,MAAM,QAAQ,IAAI,EAAG;AAClC,sBAAoB,KAAK,WAAW;AACpC,SAAO,qBAAqB,MAAM,aAAa,OAAO;AACvD;","names":["asUnknownRecord","createPollSchedule","parse","asUnknownRecord","value","createPollSchedule"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/capability.ts","../src/provider.ts","../src/external.ts","../src/issue-provider.ts","../src/issue-watcher.ts","../src/poll-report.ts","../src/tools.ts","../src/binding.ts"],"sourcesContent":["import { coreHostCapabilities, type LeitwerkExtensionModule } from \"@leitwerk-dev/process-sdk\";\nimport { type GitHubIntegration, githubIntegration } from \"./capability.js\";\nimport { GitHubClient, parseGitHubProfiles } from \"./client.js\";\nimport { createGitHubProvider } from \"./provider.js\";\nimport { registerGitHubTools } from \"./tools.js\";\n\n/** @internal */\nconst manifest = {\n\tid: \"github\",\n\t/** @internal */\n\tversion: \"0.1.9\",\n} as const;\n\n/** @public */\nconst extension: LeitwerkExtensionModule = {\n\tmanifest,\n\tsetupServer(api, config) {\n\t\tconst profiles = parseGitHubProfiles(config);\n\t\tconst integration: GitHubIntegration = {\n\t\t\tprofiles: () => [...profiles.keys()],\n\t\t\tclient(profile) {\n\t\t\t\tconst value = profiles.get(profile);\n\t\t\t\tif (!value) throw new Error(`Unknown GitHub profile '${profile}'`);\n\t\t\t\treturn new GitHubClient(value);\n\t\t\t},\n\t\t};\n\t\tsetupGitHubIntegration(api, integration);\n\t},\n};\n\nexport default extension;\n\n/** Register shared tools and polling with an explicit integration. @public */\nexport function setupGitHubIntegration(\n\tapi: Parameters<NonNullable<LeitwerkExtensionModule[\"setupServer\"]>>[0],\n\tintegration: GitHubIntegration,\n\toptions: {\n\t\t/** @public */\n\t\tnow?: () => number;\n\t} = {},\n) {\n\tapi.provide(githubIntegration, integration);\n\tconst deps = api.get(coreHostCapabilities.serverSetup);\n\tif (!deps || Array.isArray(deps)) return;\n\tregisterGitHubTools(api, integration);\n\treturn createGitHubProvider(deps, integration, options);\n}\n\nexport { resolveGitHubProjectBinding } from \"./binding.js\";\nexport type { GitHubIntegration } from \"./capability.js\";\nexport { githubIntegration } from \"./capability.js\";\nexport type {\n\tGitHubCheckSummary,\n\tGitHubGitIdentity,\n\tGitHubIssue,\n\tGitHubPullRequest,\n\tGitHubRepository,\n} from \"./client.js\";\nexport {\n\tGITHUB_CHECKS_KIND,\n\tGITHUB_ISSUE_CANCELLED_KIND,\n\tGITHUB_PR_FEEDBACK_KIND,\n\tGITHUB_PR_STATE_KIND,\n\tGITHUB_PR_TERMINAL_KIND,\n\tgithubExternal,\n} from \"./external.js\";\nexport { githubIssueWatcherSource } from \"./issue-watcher.js\";\n","import { createCapabilityToken } from \"@leitwerk-dev/process-sdk\";\nimport type { GitHubClient } from \"./client.js\";\n\n/** Public contract shared by HTTP and local adapters. @public */\nexport type GitHubClientLike = Pick<GitHubClient, keyof GitHubClient>;\n\n/** @public */\nexport interface GitHubIntegration {\n\t/** @public */\n\tprofiles?(): readonly string[];\n\t/** @public */\n\tclient(profile: string): GitHubClientLike;\n}\n\n/** @public */\nexport const githubIntegration = createCapabilityToken<GitHubIntegration>(\n\t\"@leitwerk-private/github.integration\",\n);\n","import { conflictEvidence, createConflictReporter } from \"@leitwerk-dev/coding/repository-rebase\";\nimport { asUnknownRecord } from \"@leitwerk-dev/domain\";\nimport type { CoreServerSetupDeps } from \"@leitwerk-dev/process-sdk\";\nimport { createPollSchedule, emptyPollResult } from \"@leitwerk-dev/watcher-utils\";\nimport type { GitHubIntegration } from \"./capability.js\";\nimport {\n\tdescribeGitHubEvent,\n\tGITHUB_PR_STATE_KIND,\n\tGITHUB_RELEASE_KIND,\n\ttype GitHubPullRequestSourceConfig,\n} from \"./external.js\";\nimport { createGitHubIssuePolling } from \"./issue-provider.js\";\nimport { githubPollReporter } from \"./poll-report.js\";\n\nfunction parse(value: unknown): GitHubPullRequestSourceConfig | null {\n\tconst config = asUnknownRecord(value) ?? {};\n\tif (\n\t\t[\"profile\", \"owner\", \"repo\", \"headSha\"].some(\n\t\t\t(key) => typeof config[key] !== \"string\" || !(config[key] as string).trim(),\n\t\t) ||\n\t\ttypeof config.prNumber !== \"number\"\n\t)\n\t\treturn null;\n\treturn {\n\t\tprofile: config.profile as string,\n\t\towner: config.owner as string,\n\t\trepo: config.repo as string,\n\t\tprNumber: config.prNumber,\n\t\theadSha: config.headSha as string,\n\t\tlastConflictKey: typeof config.lastConflictKey === \"string\" ? config.lastConflictKey : null,\n\t\tfeedbackCursor: typeof config.feedbackCursor === \"number\" ? config.feedbackCursor : 0,\n\t\tpollInterval: typeof config.pollInterval === \"string\" ? config.pollInterval : \"30s\",\n\t\tdisabled: config.disabled === true,\n\t\teventKinds: Array.isArray(config.eventKinds)\n\t\t\t? config.eventKinds.filter(\n\t\t\t\t\t(value): value is \"checks\" | \"feedback\" | \"merged\" | \"closed\" | \"merge_conflict\" =>\n\t\t\t\t\t\t[\"checks\", \"feedback\", \"merged\", \"closed\", \"merge_conflict\"].includes(String(value)),\n\t\t\t\t)\n\t\t\t: undefined,\n\t\tcheckStatuses: Array.isArray(config.checkStatuses)\n\t\t\t? config.checkStatuses.filter((value): value is \"pending\" | \"success\" | \"failure\" =>\n\t\t\t\t\t[\"pending\", \"success\", \"failure\"].includes(String(value)),\n\t\t\t\t)\n\t\t\t: undefined,\n\t};\n}\n\nexport function createGitHubProvider(\n\tdeps: CoreServerSetupDeps,\n\tintegration: GitHubIntegration,\n\toptions: { now?: () => number } = {},\n) {\n\tconst due = createPollSchedule();\n\tconst pollIssues = createGitHubIssuePolling(deps, integration, options);\n\tconst reportConflict = createConflictReporter(GITHUB_PR_STATE_KIND);\n\treturn deps.polling.create({\n\t\tid: \"github\",\n\t\tpollInterval: () => \"5s\",\n\t\tisEnabled: () => true,\n\t\tdefaultIntervalMs: 5_000,\n\t\tasync pollOnce() {\n\t\t\tconst result = emptyPollResult();\n\t\t\tconst report = githubPollReporter(deps.externalSources, result);\n\t\t\tawait pollIssues(result);\n\t\t\tawait report.poll(GITHUB_PR_STATE_KIND, async (armed) => {\n\t\t\t\tconst config = parse(armed.resolved);\n\t\t\t\tif (!config) {\n\t\t\t\t\tresult.errors.push(`${armed.id}:invalid_config`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (config.disabled) return;\n\t\t\t\tconst key = `${armed.instanceId}:${armed.id}:${armed.generation ?? \"\"}`;\n\t\t\t\tconst now = options.now?.() ?? Date.now();\n\t\t\t\tif (!due(key, config.pollInterval, now)) return;\n\t\t\t\ttry {\n\t\t\t\t\tconst client = integration.client(config.profile);\n\t\t\t\t\tconst pr = await client.getPullRequest(config.owner, config.repo, config.prNumber);\n\t\t\t\t\tif (!config.eventKinds || config.eventKinds.includes(\"merge_conflict\")) {\n\t\t\t\t\t\tconst conflict = conflictEvidence(config, pr, \"github\");\n\t\t\t\t\t\t// GitHub's PR base SHA can lag the branch even while its state is behind.\n\t\t\t\t\t\tif (conflict?.reason === \"behind\") {\n\t\t\t\t\t\t\tconst branch = await client.getCommit(config.owner, config.repo, conflict.baseBranch);\n\t\t\t\t\t\t\tconflict.baseSha = branch.sha;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tawait reportConflict(report, armed, conflict, config.lastConflictKey, {\n\t\t\t\t\t\t\t\tsummary: `PR #${pr.number} mergeability: ${pr.mergeable == null ? \"unresolved\" : (pr.mergeable_state ?? String(pr.mergeable))}`,\n\t\t\t\t\t\t\t\tobservedAt: new Date(now).toISOString(),\n\t\t\t\t\t\t\t\tsubject: `${config.owner}/${config.repo}#${pr.number}`,\n\t\t\t\t\t\t\t\trevision: `${pr.head.sha}:${conflict?.baseSha ?? pr.base.sha}`,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\tif (config.eventKinds?.length === 1) return;\n\t\t\t\t\t}\n\t\t\t\t\tlet event: Record<string, unknown> | null = null;\n\t\t\t\t\tlet mergeKey = \"\";\n\t\t\t\t\tif (pr.merged || pr.state === \"closed\") {\n\t\t\t\t\t\tevent = {\n\t\t\t\t\t\t\tkind: pr.merged ? \"merged\" : \"closed\",\n\t\t\t\t\t\t\tpullRequest: pr,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tmergeKey = `terminal:${pr.number}:${pr.merged}`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (pr.head.sha !== config.headSha) return;\n\t\t\t\t\t\tconst readsFeedback = !config.eventKinds || config.eventKinds.includes(\"feedback\");\n\t\t\t\t\t\tconst readsChecks = !config.eventKinds || config.eventKinds.includes(\"checks\");\n\t\t\t\t\t\tconst [feedback, checks] = await Promise.all([\n\t\t\t\t\t\t\treadsFeedback\n\t\t\t\t\t\t\t\t? client.listActionablePullRequestFeedback(\n\t\t\t\t\t\t\t\t\t\tconfig.owner,\n\t\t\t\t\t\t\t\t\t\tconfig.repo,\n\t\t\t\t\t\t\t\t\t\tconfig.prNumber,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: Promise.resolve([]),\n\t\t\t\t\t\t\treadsChecks || (deps.externalSources.observe && armed.generation)\n\t\t\t\t\t\t\t\t? client\n\t\t\t\t\t\t\t\t\t\t.getCheckSummary(config.owner, config.repo, config.headSha)\n\t\t\t\t\t\t\t\t\t\t.catch(async (error) => {\n\t\t\t\t\t\t\t\t\t\t\tawait report.observe(armed, {\n\t\t\t\t\t\t\t\t\t\t\t\trefreshError:\n\t\t\t\t\t\t\t\t\t\t\t\t\terror instanceof Error ? error.message : \"Checks refresh failed\",\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\tif (readsChecks) throw error;\n\t\t\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t: Promise.resolve(null),\n\t\t\t\t\t\t]);\n\t\t\t\t\t\tif (checks && checks.headSha !== config.headSha) return;\n\t\t\t\t\t\tconst refreshed = await client.getPullRequest(\n\t\t\t\t\t\t\tconfig.owner,\n\t\t\t\t\t\t\tconfig.repo,\n\t\t\t\t\t\t\tconfig.prNumber,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\trefreshed.state !== \"open\" ||\n\t\t\t\t\t\t\trefreshed.merged ||\n\t\t\t\t\t\t\trefreshed.head.sha !== config.headSha\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\tif (checks && deps.externalSources.observe && armed.generation) {\n\t\t\t\t\t\t\tconst description = describeGitHubEvent({ kind: \"checks\", checks });\n\t\t\t\t\t\t\tawait report.observe(armed, {\n\t\t\t\t\t\t\t\tobservation: {\n\t\t\t\t\t\t\t\t\t...description,\n\t\t\t\t\t\t\t\t\tobservedAt: new Date(now).toISOString(),\n\t\t\t\t\t\t\t\t\tsubject: `${config.owner}/${config.repo}#${config.prNumber}`,\n\t\t\t\t\t\t\t\t\trevision: checks.headSha,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst unseen = feedback.filter(\n\t\t\t\t\t\t\t(item) => item.id > config.feedbackCursor && item.author !== client.profile.botLogin,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (unseen.length) {\n\t\t\t\t\t\t\tconst feedbackCursor = Math.max(...unseen.map((item) => item.id));\n\t\t\t\t\t\t\tevent = { kind: \"feedback\", feedback, feedbackCursor };\n\t\t\t\t\t\t\tmergeKey = `feedback:${feedbackCursor}`;\n\t\t\t\t\t\t} else if (readsChecks && checks && checks.status !== \"pending\") {\n\t\t\t\t\t\t\tevent = { kind: \"checks\", checks };\n\t\t\t\t\t\t\tmergeKey = `checks:${checks.headSha}:${checks.status}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\t!event ||\n\t\t\t\t\t\t(config.eventKinds &&\n\t\t\t\t\t\t\t!config.eventKinds.includes(\n\t\t\t\t\t\t\t\tString(event.kind) as (typeof config.eventKinds)[number],\n\t\t\t\t\t\t\t)) ||\n\t\t\t\t\t\t(event.kind === \"checks\" &&\n\t\t\t\t\t\t\tconfig.checkStatuses &&\n\t\t\t\t\t\t\t!config.checkStatuses.includes(\n\t\t\t\t\t\t\t\t(event.checks as { status: \"pending\" | \"success\" | \"failure\" }).status,\n\t\t\t\t\t\t\t))\n\t\t\t\t\t)\n\t\t\t\t\t\treturn;\n\t\t\t\t\tawait report.fire(armed, event, mergeKey);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait report.observe(armed, {\n\t\t\t\t\t\trefreshError: error instanceof Error ? error.message : \"PR refresh failed\",\n\t\t\t\t\t});\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t});\n\t\t\tawait report.poll(GITHUB_RELEASE_KIND, async (armed) => {\n\t\t\t\tconst config = asUnknownRecord(armed.resolved) ?? {};\n\t\t\t\tif (\n\t\t\t\t\ttypeof config.profile !== \"string\" ||\n\t\t\t\t\ttypeof config.owner !== \"string\" ||\n\t\t\t\t\ttypeof config.repo !== \"string\" ||\n\t\t\t\t\ttypeof config.mergeSha !== \"string\"\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tif (config.disabled === true) return;\n\t\t\t\tconst key = `${armed.instanceId}:${armed.id}:${armed.generation ?? \"\"}`;\n\t\t\t\tconst now = options.now?.() ?? Date.now();\n\t\t\t\tif (!due(key, typeof config.pollInterval === \"string\" ? config.pollInterval : \"30s\", now))\n\t\t\t\t\treturn;\n\t\t\t\tconst client = integration.client(config.profile);\n\t\t\t\tfor (const release of await client.listReleases(config.owner, config.repo)) {\n\t\t\t\t\tif (release.draft || release.prerelease) continue;\n\t\t\t\t\tconst commit = await client.getCommit(config.owner, config.repo, release.tag_name);\n\t\t\t\t\tif (!(await client.isAncestor(config.owner, config.repo, config.mergeSha, commit.sha)))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tawait report.fire(\n\t\t\t\t\t\tarmed,\n\t\t\t\t\t\t{ release, commitSha: commit.sha },\n\t\t\t\t\t\t`${release.id}:${commit.sha}`,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn result;\n\t\t},\n\t});\n}\n","import { describeConflict } from \"@leitwerk-dev/coding/repository-rebase\";\nimport {\n\tdefineExternalActionSource,\n\ttype ExternalEventDescription,\n} from \"@leitwerk-dev/process-sdk\";\n\n/** @internal */\nexport const GITHUB_PR_STATE_KIND = \"@leitwerk-private/github.pr_state\";\n\n/** @public */\nexport interface GitHubPullRequestSourceConfig {\n\t/** @public */\n\tprofile: string;\n\t/** @public */\n\towner: string;\n\t/** @public */\n\trepo: string;\n\t/** @public */\n\tprNumber: number;\n\t/** @public */\n\theadSha: string;\n\t/** @public */\n\tfeedbackCursor: number;\n\t/** @public */\n\tlastConflictKey?: string | null;\n\t/** @public */\n\tpollInterval?: string;\n\t/** @internal */\n\tdisabled?: boolean;\n\t/** @public */\n\teventKinds?: Array<\"checks\" | \"feedback\" | \"merged\" | \"closed\" | \"merge_conflict\">;\n\t/** @internal */\n\tcheckStatuses?: Array<\"pending\" | \"success\" | \"failure\">;\n}\n\n/** @internal */\nexport const GITHUB_RELEASE_KIND = \"@leitwerk-private/github.release\";\n\n/** @internal */\nexport interface GitHubReleaseSourceConfig {\n\t/** @internal */\n\tprofile: string;\n\t/** @internal */\n\towner: string;\n\t/** @internal */\n\trepo: string;\n\t/** @internal */\n\tmergeSha: string;\n\t/** @internal */\n\tpollInterval?: string;\n\t/** @internal */\n\tdisabled?: boolean;\n}\n\n/** @internal */\nexport function describeGitHubEvent(event: unknown): ExternalEventDescription {\n\tconst value = event as {\n\t\tkind?: string;\n\t\tchecks?: {\n\t\t\theadSha: string;\n\t\t\tstatus: string;\n\t\t\tfailed: Array<{ name: string; url: string | null }>;\n\t\t};\n\t\tpullRequest?: { number: number; merged?: boolean; state?: string };\n\t};\n\tif (value.kind === \"merge_conflict\") return describeConflict(event);\n\tif (value.checks) {\n\t\tconst checks = value.checks;\n\t\treturn {\n\t\t\tsummary: `Checks ${checks.status} on ${checks.headSha}${checks.failed.length ? `: ${checks.failed.map((check) => check.name).join(\", \")}` : \"\"}`,\n\t\t\tlinks: checks.failed.flatMap((check, index) =>\n\t\t\t\tcheck.url\n\t\t\t\t\t? [{ id: `check-${index}`, label: check.name, url: check.url, kind: \"pipeline\" as const }]\n\t\t\t\t\t: [],\n\t\t\t),\n\t\t};\n\t}\n\treturn {\n\t\tsummary:\n\t\t\tvalue.kind === \"merged\" || value.kind === \"closed\" || value.pullRequest\n\t\t\t\t? `PR #${value.pullRequest?.number} ${value.kind ?? (value.pullRequest?.merged ? \"merged\" : \"closed\")}`\n\t\t\t\t: value.kind === \"feedback\"\n\t\t\t\t\t? \"Pull request feedback received\"\n\t\t\t\t\t: \"GitHub event received\",\n\t};\n}\n\n/** @public */\nexport const GITHUB_PR_TERMINAL_KIND = \"@leitwerk-public/github.pr_terminal\";\n/** @public */\nexport const GITHUB_PR_FEEDBACK_KIND = \"@leitwerk-public/github.pr_feedback\";\n/** @public */\nexport const GITHUB_ISSUE_CANCELLED_KIND = \"@leitwerk-public/github.issue_cancelled\";\n\n/** @public */\nexport interface GitHubPullRequestTerminalSourceConfig {\n\t/** @public */\n\tprofile: string;\n\t/** @public */\n\towner: string;\n\t/** @public */\n\trepo: string;\n\t/** @public */\n\tprNumber: number;\n\t/** @public */\n\tpollInterval?: string;\n\t/** @public */\n\tterminalOutcome?: \"merged\" | \"closed\";\n\t/** @internal */\n\tdisabled?: boolean;\n}\n\n/** @public */\nexport interface GitHubFeedbackSourceConfig extends GitHubPullRequestTerminalSourceConfig {\n\t/** @public */\n\tconversationCursor: number;\n\t/** @public */\n\treviewCursor: number;\n\t/** @public */\n\tinlineCursor: number;\n\t/** @public */\n\tquietPeriodMs: number;\n}\n\n/** @public */\nexport interface GitHubIssueCancelledSourceConfig {\n\t/** @public */\n\tprofile: string;\n\t/** @public */\n\towner: string;\n\t/** @public */\n\trepo: string;\n\t/** @public */\n\tissueNumber: number;\n\t/** @public */\n\ttriggerLabel: string;\n\t/** @public */\n\tpollInterval?: string;\n}\n\n/** @public */\nexport const GITHUB_CHECKS_KIND = \"@leitwerk-public/github.checks\";\n\n/** @public */\nexport const githubExternal = {\n\t/** @public */\n\tchecks: defineExternalActionSource<{\n\t\tafterKey?: string;\n\t\tprofile: string;\n\t\towner: string;\n\t\trepo: string;\n\t\tprNumber: number;\n\t\theadSha: string;\n\t}>({\n\t\tkind: GITHUB_CHECKS_KIND,\n\t\tdescribeEvent: describeGitHubEvent,\n\t\tlabel: \"GitHub Actions failures\",\n\t}),\n\t/** @public */\n\tissueCancelled: defineExternalActionSource<GitHubIssueCancelledSourceConfig>({\n\t\tkind: GITHUB_ISSUE_CANCELLED_KIND,\n\t\tdescribeEvent: () => ({ summary: \"Source issue cancelled\" }),\n\t\tlabel: \"GitHub source issue cancelled\",\n\t\tdescription: \"Fires when the source issue closes or loses its trigger label\",\n\t}),\n\t/** @public */\n\tpullRequestTerminal: defineExternalActionSource<GitHubPullRequestTerminalSourceConfig>({\n\t\tkind: GITHUB_PR_TERMINAL_KIND,\n\t\tdescribeEvent: describeGitHubEvent,\n\t\tlabel: \"GitHub pull request merged or closed\",\n\t\tdescription: \"Fires when the tracked pull request reaches a terminal state\",\n\t}),\n\t/** @public */\n\tpullRequestFeedback: defineExternalActionSource<GitHubFeedbackSourceConfig>({\n\t\tkind: GITHUB_PR_FEEDBACK_KIND,\n\t\tdescribeEvent: () => ({ summary: \"Pull request feedback received\" }),\n\t\tlabel: \"GitHub pull request feedback\",\n\t\tdescription: \"Fires after unseen human feedback has been quiet long enough to batch\",\n\t}),\n\t/** @internal */\n\treleaseContaining: defineExternalActionSource<GitHubReleaseSourceConfig>({\n\t\tkind: GITHUB_RELEASE_KIND,\n\t\tlabel: \"Published GitHub release\",\n\t\tdescription: \"Fires when a published release contains the tracked merge commit\",\n\t}),\n\t/** @public */\n\tpullRequestState: defineExternalActionSource<GitHubPullRequestSourceConfig>({\n\t\tkind: GITHUB_PR_STATE_KIND,\n\t\tdescribeEvent: describeGitHubEvent,\n\t\tlabel: \"GitHub pull request state\",\n\t\tdescription: \"Fires for failed or successful checks, review feedback, and terminal PR state\",\n\t}),\n};\n","import { asUnknownRecord } from \"@leitwerk-dev/domain\";\nimport {\n\ttype CoreServerSetupDeps,\n\ttype ExternalSourceArmingLike,\n\tmatchesRepository as matchesConfiguredRepository,\n\tparseRepositoryFeedbackConfig as parseFeedbackConfig,\n\tparseRepositoryIssueCancelledConfig as parseIssueCancelledConfig,\n\tparseRepositoryPullRequestConfig as parsePrConfig,\n\ttype RegisteredProcessWatcherLike,\n\trepositoryFeedbackBatch,\n} from \"@leitwerk-dev/process-sdk\";\nimport { createPollSchedule, type emptyPollResult } from \"@leitwerk-dev/watcher-utils\";\nimport type { GitHubIntegration } from \"./capability.js\";\nimport type { GitHubIssue, GitHubRepository } from \"./client.js\";\nimport {\n\tdescribeGitHubEvent,\n\tGITHUB_CHECKS_KIND,\n\tGITHUB_ISSUE_CANCELLED_KIND,\n\tGITHUB_PR_FEEDBACK_KIND,\n\tGITHUB_PR_TERMINAL_KIND,\n} from \"./external.js\";\nimport {\n\ttype GitHubIssueWatcherConfig,\n\ttype GitHubIssueWatcherEvent,\n\tgithubIssueWatcherSource,\n} from \"./issue-watcher.js\";\nimport { githubPollReporter } from \"./poll-report.js\";\n\nfunction hasLabel(issue: GitHubIssue, label: string): boolean {\n\treturn issue.labels.some((candidate) => candidate.name === label);\n}\n\nfunction externalId(repo: GitHubRepository, issue: GitHubIssue): string {\n\treturn `github:${repo.full_name}#${issue.number}`;\n}\n\nexport { matchesConfiguredRepository };\n\nexport function createGitHubIssuePolling(\n\tdeps: CoreServerSetupDeps,\n\tintegration: GitHubIntegration,\n\toptions: { now?: () => number } = {},\n) {\n\tconst now = options.now ?? Date.now;\n\tconst due = createPollSchedule(now);\n\n\tasync function discover(\n\t\twatcher: RegisteredProcessWatcherLike<GitHubIssueWatcherConfig, GitHubIssueWatcherEvent>,\n\t\tresult: ReturnType<typeof emptyPollResult>,\n\t) {\n\t\tconst config = watcher.config;\n\t\tconst client = integration.client(config.profile);\n\t\tfor (const repo of await client.listRepositories()) {\n\t\t\tif (!matchesConfiguredRepository(config, repo)) continue;\n\t\t\tfor (const issue of await client.listOpenIssues(repo.owner.login, repo.name)) {\n\t\t\t\tif (!hasLabel(issue, config.labels.trigger) || hasLabel(issue, config.labels.done))\n\t\t\t\t\tcontinue;\n\t\t\t\tconst id = externalId(repo, issue);\n\t\t\t\ttry {\n\t\t\t\t\tif (deps.processes.listAll().some((process) => process.externalId === id)) {\n\t\t\t\t\t\tresult.skipped.push(id);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst authorized = await client.authorizedTrigger(\n\t\t\t\t\t\trepo.owner.login,\n\t\t\t\t\t\trepo.name,\n\t\t\t\t\t\tissue.number,\n\t\t\t\t\t\tconfig.labels.trigger,\n\t\t\t\t\t\tconfig.labels.done,\n\t\t\t\t\t);\n\t\t\t\t\tif (!authorized) {\n\t\t\t\t\t\tresult.skipped.push(`${id}:unauthorized`);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst event: GitHubIssueWatcherEvent = {\n\t\t\t\t\t\tprofile: config.profile,\n\t\t\t\t\t\trepository: repo,\n\t\t\t\t\t\tissue: authorized.issue,\n\t\t\t\t\t\tauthorization: {\n\t\t\t\t\t\t\tactor: authorized.actor,\n\t\t\t\t\t\t\teventId: authorized.eventId,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels: config.labels,\n\t\t\t\t\t};\n\n\t\t\t\t\tconst guardedWatcher = {\n\t\t\t\t\t\t...watcher,\n\t\t\t\t\t\tasync resolveLaunchAttempt(...args: Parameters<typeof watcher.resolveLaunchAttempt>) {\n\t\t\t\t\t\t\tconst attempt = await watcher.resolveLaunchAttempt(...args);\n\t\t\t\t\t\t\tif (!attempt) return null;\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...attempt,\n\t\t\t\t\t\t\t\tpreparationChecks: [\n\t\t\t\t\t\t\t\t\t...attempt.preparationChecks,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tid: \"github-trigger-authorization\",\n\t\t\t\t\t\t\t\t\t\tlabel: \"Check GitHub trigger authorization\",\n\t\t\t\t\t\t\t\t\t\tasync run() {\n\t\t\t\t\t\t\t\t\t\t\tconst rechecked = await client.authorizedTrigger(\n\t\t\t\t\t\t\t\t\t\t\t\trepo.owner.login,\n\t\t\t\t\t\t\t\t\t\t\t\trepo.name,\n\t\t\t\t\t\t\t\t\t\t\t\tissue.number,\n\t\t\t\t\t\t\t\t\t\t\t\tconfig.labels.trigger,\n\t\t\t\t\t\t\t\t\t\t\t\tconfig.labels.done,\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t!rechecked ||\n\t\t\t\t\t\t\t\t\t\t\t\trechecked.eventId !== authorized.eventId ||\n\t\t\t\t\t\t\t\t\t\t\t\trechecked.actor !== authorized.actor\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error(\"GitHub trigger authorization changed before launch\");\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst launched = await deps.launchRuns.startWatcher(guardedWatcher, event, {\n\t\t\t\t\t\tidempotencyKey: id,\n\t\t\t\t\t});\n\t\t\t\t\tif (launched.error) result.errors.push(`${id}:launch_failed:${launched.error}`);\n\t\t\t\t\telse if (launched.process) result.created.push(id);\n\t\t\t\t\telse result.skipped.push(id);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tresult.errors.push(\n\t\t\t\t\t\t`${id}:${error instanceof Error ? error.message : \"discovery_failed\"}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync function pollExternal(result: ReturnType<typeof emptyPollResult>) {\n\t\tconst report = githubPollReporter(deps.externalSources, result);\n\t\tconst terminalArmings = deps.externalSources.listArmed(GITHUB_PR_TERMINAL_KIND);\n\t\tconst terminalInstances = new Set<string>();\n\t\tasync function poll<C extends { pollInterval?: string; disabled?: boolean }>(\n\t\t\tkind: string,\n\t\t\tparse: (value: unknown) => C | null,\n\t\t\tread: (config: C, armed: ExternalSourceArmingLike) => Promise<void>,\n\t\t) {\n\t\t\tconst armings =\n\t\t\t\tkind === GITHUB_PR_TERMINAL_KIND ? terminalArmings : deps.externalSources.listArmed(kind);\n\t\t\tfor (const armed of armings) {\n\t\t\t\tif (kind !== GITHUB_PR_TERMINAL_KIND && terminalInstances.has(armed.instanceId)) continue;\n\t\t\t\tconst config = parse(armed.resolved);\n\t\t\t\tconst key = `${armed.instanceId}:${armed.id}:${armed.generation ?? \"\"}`;\n\t\t\t\tif (!config || !due(key, config.pollInterval ?? \"30s\") || config.disabled) continue;\n\t\t\t\ttry {\n\t\t\t\t\tawait read(config, armed);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait report.observe(armed, {\n\t\t\t\t\t\trefreshError: error instanceof Error ? error.message : \"GitHub refresh failed\",\n\t\t\t\t\t});\n\t\t\t\t\tconst fallback = kind === GITHUB_CHECKS_KIND ? \"checks_failed\" : \"poll_failed\";\n\t\t\t\t\tresult.errors.push(`${armed.id}:${error instanceof Error ? error.message : fallback}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tawait poll(GITHUB_PR_TERMINAL_KIND, parsePrConfig, async (config, armed) => {\n\t\t\tconst pr = await integration\n\t\t\t\t.client(config.profile)\n\t\t\t\t.getPullRequest(config.owner, config.repo, config.prNumber);\n\t\t\tif (!pr.merged && pr.state !== \"closed\") return;\n\t\t\tif (!report.isCurrent(GITHUB_PR_TERMINAL_KIND, armed)) return;\n\t\t\tterminalInstances.add(armed.instanceId);\n\t\t\tconst outcome = pr.merged ? \"merged\" : \"closed\";\n\t\t\tif (config.terminalOutcome && config.terminalOutcome !== outcome) return;\n\t\t\tawait report.fire(armed, { pullRequest: pr }, `${pr.number}:${outcome}`);\n\t\t});\n\n\t\tawait poll(\n\t\t\tGITHUB_CHECKS_KIND,\n\t\t\t(value) => ({ pollInterval: \"30s\", config: asUnknownRecord(value) ?? {} }),\n\t\t\tasync ({ config }, armed) => {\n\t\t\t\tconst client = integration.client(String(config.profile));\n\t\t\t\tconst pr = await client.getPullRequest(\n\t\t\t\t\tString(config.owner),\n\t\t\t\t\tString(config.repo),\n\t\t\t\t\tNumber(config.prNumber),\n\t\t\t\t);\n\t\t\t\tif (pr.state !== \"open\" || pr.head.sha !== config.headSha) return;\n\t\t\t\tconst checks = await client.getCheckSummary(\n\t\t\t\t\tString(config.owner),\n\t\t\t\t\tString(config.repo),\n\t\t\t\t\tString(config.headSha),\n\t\t\t\t);\n\t\t\t\tif (checks.headSha !== config.headSha) return;\n\t\t\t\tconst refreshed = await client.getPullRequest(\n\t\t\t\t\tString(config.owner),\n\t\t\t\t\tString(config.repo),\n\t\t\t\t\tNumber(config.prNumber),\n\t\t\t\t);\n\t\t\t\tif (refreshed.state !== \"open\" || refreshed.merged || refreshed.head.sha !== checks.headSha)\n\t\t\t\t\treturn;\n\t\t\t\tawait report.observe(armed, {\n\t\t\t\t\tobservation: {\n\t\t\t\t\t\t...describeGitHubEvent({ checks }),\n\t\t\t\t\t\tobservedAt: new Date(now()).toISOString(),\n\t\t\t\t\t\tsubject: `${config.owner}/${config.repo}#${config.prNumber}`,\n\t\t\t\t\t\trevision: checks.headSha,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (checks.status !== \"failure\") return;\n\t\t\t\tconst evidenceKey = `${checks.headSha}:${checks.failed.map((run) => run.url).join(\":\")}`;\n\t\t\t\tif (config.afterKey === evidenceKey) return;\n\t\t\t\tawait report.fire(armed, { checks }, evidenceKey);\n\t\t\t},\n\t\t);\n\n\t\tawait poll(GITHUB_ISSUE_CANCELLED_KIND, parseIssueCancelledConfig, async (config, armed) => {\n\t\t\tconst issue = await integration\n\t\t\t\t.client(config.profile)\n\t\t\t\t.getIssue(config.owner, config.repo, config.issueNumber);\n\t\t\tconst reason =\n\t\t\t\tissue.state === \"closed\"\n\t\t\t\t\t? \"issue_closed\"\n\t\t\t\t\t: hasLabel(issue, config.triggerLabel)\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: \"trigger_label_removed\";\n\t\t\tif (!reason) return;\n\t\t\t// A merge may close the issue between terminal polls. Preserve terminal\n\t\t\t// reconciliation instead of treating that close as cancellation.\n\t\t\tconst terminal = terminalArmings\n\t\t\t\t.filter((candidate) => candidate.instanceId === armed.instanceId)\n\t\t\t\t.map((candidate) => parsePrConfig(candidate.resolved))\n\t\t\t\t.find((candidate) => candidate && !candidate.disabled);\n\t\t\tif (terminal) {\n\t\t\t\tconst pr = await integration\n\t\t\t\t\t.client(terminal.profile)\n\t\t\t\t\t.getPullRequest(terminal.owner, terminal.repo, terminal.prNumber);\n\t\t\t\tif (pr.merged || pr.state === \"closed\") {\n\t\t\t\t\tterminalInstances.add(armed.instanceId);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait report.fire(armed, { issue, reason }, `${issue.number}:${reason}`);\n\t\t});\n\t\tawait poll(GITHUB_PR_FEEDBACK_KIND, parseFeedbackConfig, async (config, armed) => {\n\t\t\tconst client = integration.client(config.profile);\n\t\t\tconst pr = await client.getPullRequest(config.owner, config.repo, config.prNumber);\n\t\t\tif (pr.merged || pr.state !== \"open\") return;\n\t\t\tconst unseen = (\n\t\t\t\tawait client.listActionablePullRequestFeedback(config.owner, config.repo, config.prNumber)\n\t\t\t).filter((item) => item.id > config[`${item.kind}Cursor`]);\n\n\t\t\tconst batch = repositoryFeedbackBatch(unseen, config, now());\n\t\t\tif (batch) await report.fire(armed, batch.event, batch.mergeKey);\n\t\t});\n\t}\n\n\treturn async (result: ReturnType<typeof emptyPollResult>) => {\n\t\tconst watchers = deps.processWatchers?.listBySource(githubIssueWatcherSource) ?? [];\n\t\tfor (const watcher of watchers) {\n\t\t\tif (\n\t\t\t\t!watcher.enabled ||\n\t\t\t\t!due(`${watcher.processId}:${watcher.watcherId}`, watcher.config.pollInterval)\n\t\t\t)\n\t\t\t\tcontinue;\n\t\t\ttry {\n\t\t\t\tawait discover(watcher, result);\n\t\t\t} catch (error) {\n\t\t\t\tresult.errors.push(\n\t\t\t\t\t`${watcher.processId}:${watcher.watcherId}:${error instanceof Error ? error.message : \"discovery_failed\"}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tawait pollExternal(result);\n\t};\n}\n","import {\n\tdefineProcessWatcherSource,\n\tparseRepositoryIssueWatcherConfig,\n\tpresentRepositoryIssueWatcherConfig,\n\ttype RepositoryIssueWatcherConfig,\n} from \"@leitwerk-dev/process-sdk\";\nimport type { GitHubIssue, GitHubRepository } from \"./client.js\";\n\n/** @public */\nexport interface GitHubIssueWatcherConfig extends RepositoryIssueWatcherConfig {}\n\n/** @public */\nexport interface GitHubIssueWatcherEvent {\n\t/** @public */\n\tauthorization: {\n\t\t/** @internal */\n\t\tactor: string;\n\t\t/** @internal */\n\t\teventId: number;\n\t};\n\t/** @public */\n\tprofile: string;\n\t/** @public */\n\trepository: GitHubRepository;\n\t/** @public */\n\tissue: GitHubIssue;\n\t/** @public */\n\tlabels: {\n\t\t/** @public */\n\t\ttrigger: string;\n\t\t/** @public */\n\t\tdone: string;\n\t};\n}\n\n/** @public */\nexport const githubIssueWatcherSource = defineProcessWatcherSource<\n\tGitHubIssueWatcherConfig,\n\tGitHubIssueWatcherEvent\n>({\n\tid: \"@leitwerk-public/github.issue\",\n\tlabel: \"GitHub issue\",\n\tparseConfig: (raw) => parseRepositoryIssueWatcherConfig(raw, \"github_issue\", true),\n\tpresentConfig: presentRepositoryIssueWatcherConfig,\n});\n","import {\n\tcreateExternalSourcePollReporter,\n\ttype ExternalSourceServiceLike,\n} from \"@leitwerk-dev/process-sdk\";\nimport {\n\tGITHUB_CHECKS_KIND,\n\tGITHUB_ISSUE_CANCELLED_KIND,\n\tGITHUB_PR_FEEDBACK_KIND,\n\tGITHUB_PR_STATE_KIND,\n\tGITHUB_PR_TERMINAL_KIND,\n\tGITHUB_RELEASE_KIND,\n} from \"./external.js\";\n\nexport function githubPollReporter(\n\tsources: ExternalSourceServiceLike,\n\tresult: { created: string[]; errors: string[] },\n) {\n\treturn createExternalSourcePollReporter(sources, result, {\n\t\tforwardGeneration: true,\n\t\tcurrentKinds: [\n\t\t\tGITHUB_CHECKS_KIND,\n\t\t\tGITHUB_PR_STATE_KIND,\n\t\t\tGITHUB_PR_TERMINAL_KIND,\n\t\t\tGITHUB_PR_FEEDBACK_KIND,\n\t\t\tGITHUB_ISSUE_CANCELLED_KIND,\n\t\t\tGITHUB_RELEASE_KIND,\n\t\t],\n\t});\n}\n","import {\n\texistingObject,\n\ttype IntegrationToolExecutionContext,\n\tmatchesPatch,\n\tnumberArg,\n\tobjectArg,\n\tprojectParameters,\n\ttype ServerExtensionAPI,\n\tstringArg,\n} from \"@leitwerk-dev/process-sdk\";\nimport { resolveGitHubProjectBinding } from \"./binding.js\";\nimport type { GitHubIntegration } from \"./capability.js\";\nimport { assertGitHubRepository } from \"./client.js\";\n\nconst object = (value: unknown) => objectArg(value, \"Expected an object\");\n\nexport function registerGitHubTools(api: ServerExtensionAPI, integration: GitHubIntegration) {\n\tconst target = (ctx: IntegrationToolExecutionContext) => {\n\t\tconst binding = resolveGitHubProjectBinding(ctx);\n\t\tassertGitHubRepository(\n\t\t\tintegration.client(binding.profile).profile,\n\t\t\tbinding.owner,\n\t\t\tbinding.repo,\n\t\t);\n\t\treturn binding;\n\t};\n\tapi.tool({\n\t\tname: \"github_resolve_git_identity\",\n\t\tdescription: \"Resolve the configured GitHub Git identity\",\n\t\tparameters: projectParameters(),\n\t\tasync execute(ctx) {\n\t\t\tconst t = target(ctx);\n\t\t\treturn integration.client(t.profile).resolveGitIdentity(t.profile);\n\t\t},\n\t});\n\tfor (const name of [\n\t\t\"github_ensure_label\",\n\t\t\"github_update_issue\",\n\t\t\"github_add_issue_comment\",\n\t\t\"github_add_pull_request_feedback_reaction\",\n\t\t\"github_reply_to_pull_request_feedback\",\n\t\t\"github_add_pull_request_comment\",\n\t\t\"github_update_pull_request\",\n\t] as const) {\n\t\tconst pullRequest =\n\t\t\tname === \"github_add_pull_request_comment\" || name === \"github_update_pull_request\";\n\t\tconst update = name === \"github_update_issue\" || name === \"github_update_pull_request\";\n\t\tapi.tool({\n\t\t\tname,\n\t\t\tdescription: pullRequest\n\t\t\t\t? update\n\t\t\t\t\t? \"Update a GitHub pull request\"\n\t\t\t\t\t: \"Comment on a GitHub pull request\"\n\t\t\t\t: \"Reconcile GitHub delivery in the current process project\",\n\t\t\tparameters: pullRequest\n\t\t\t\t? projectParameters(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpullRequestNumber: { type: \"integer\" },\n\t\t\t\t\t\t\t...(update\n\t\t\t\t\t\t\t\t? { patch: { type: \"object\" } }\n\t\t\t\t\t\t\t\t: { body: { type: \"string\" }, writeKey: { type: \"string\" } }),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[\"pullRequestNumber\", update ? \"patch\" : \"body\"],\n\t\t\t\t\t)\n\t\t\t\t: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tprojectKey: { type: \"string\" },\n\t\t\t\t\t\t\tissueNumber: { type: \"integer\" },\n\t\t\t\t\t\t\tpullRequestNumber: { type: \"integer\" },\n\t\t\t\t\t\t\tname: { type: \"string\" },\n\t\t\t\t\t\t\tpatch: { type: \"object\" },\n\t\t\t\t\t\t\tbody: { type: \"string\" },\n\t\t\t\t\t\t\tfeedbackKind: { type: \"string\" },\n\t\t\t\t\t\t\tfeedbackId: { type: \"integer\" },\n\t\t\t\t\t\t\twriteKey: { type: \"string\" },\n\t\t\t\t\t\t},\n\t\t\t\t\t\trequired: [\"projectKey\"],\n\t\t\t\t\t},\n\t\t\tasync execute(ctx, args) {\n\t\t\t\tconst input = object(args);\n\t\t\t\tconst t = target(ctx);\n\t\t\t\tconst client = integration.client(t.profile);\n\t\t\t\tconst key =\n\t\t\t\t\t!(pullRequest && update) && typeof input.writeKey === \"string\"\n\t\t\t\t\t\t? stringArg(input, \"writeKey\")\n\t\t\t\t\t\t: ctx.idempotencyKey;\n\t\t\t\tconst signal = pullRequest ? ctx.signal : undefined;\n\t\t\t\tconst marker = `<!-- leitwerk-write:${ctx.process.id}:${key} -->`;\n\t\t\t\tconst issueNumber = () =>\n\t\t\t\t\tnumberArg(\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tpullRequest || input.issueNumber == null ? \"pullRequestNumber\" : \"issueNumber\",\n\t\t\t\t\t);\n\t\t\t\tconst findComment = async () => {\n\t\t\t\t\tconst replies =\n\t\t\t\t\t\tname === \"github_reply_to_pull_request_feedback\"\n\t\t\t\t\t\t\t? await client.listFeedbackReplies(\n\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\tissueNumber(),\n\t\t\t\t\t\t\t\t\tstringArg(input, \"feedbackKind\"),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: await client.listIssueComments(t.owner, t.repo, issueNumber(), signal);\n\t\t\t\t\treturn (\n\t\t\t\t\t\treplies.find(\n\t\t\t\t\t\t\t(comment) =>\n\t\t\t\t\t\t\t\tString(comment.body).includes(marker) &&\n\t\t\t\t\t\t\t\t(name !== \"github_reply_to_pull_request_feedback\" ||\n\t\t\t\t\t\t\t\t\tinput.feedbackKind !== \"inline\" ||\n\t\t\t\t\t\t\t\t\tobject(comment).in_reply_to_id === numberArg(input, \"feedbackId\")),\n\t\t\t\t\t\t) ?? null\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t\tconst result = await ctx.externalWrites.ensure(\n\t\t\t\t\t{\n\t\t\t\t\t\twriteType: pullRequest ? (update ? \"github.update_pr\" : \"github.comment\") : name,\n\t\t\t\t\t\tdedupKey: key,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\treconcile: async (phase): Promise<object | null> =>\n\t\t\t\t\t\t\texistingObject(async () => {\n\t\t\t\t\t\t\t\tif (name === \"github_ensure_label\")\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t(await client.listLabels(t.owner, t.repo)).find(\n\t\t\t\t\t\t\t\t\t\t\t(label) => label.name === stringArg(input, \"name\"),\n\t\t\t\t\t\t\t\t\t\t) ?? null\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tif (update) {\n\t\t\t\t\t\t\t\t\tconst current = await client[pullRequest ? \"getPullRequest\" : \"getIssue\"](\n\t\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\t\tissueNumber(),\n\t\t\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn current &&\n\t\t\t\t\t\t\t\t\t\t(phase === \"already_recorded\" || matchesPatch(current, object(input.patch)))\n\t\t\t\t\t\t\t\t\t\t? current\n\t\t\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (name === \"github_add_pull_request_feedback_reaction\")\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tawait client.listFeedbackReactions(\n\t\t\t\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\t\t\t\tstringArg(input, \"feedbackKind\"),\n\t\t\t\t\t\t\t\t\t\t\t\tnumberArg(input, \"feedbackId\"),\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t).find(\n\t\t\t\t\t\t\t\t\t\t\t(reaction) =>\n\t\t\t\t\t\t\t\t\t\t\t\treaction.content === \"eyes\" &&\n\t\t\t\t\t\t\t\t\t\t\t\treaction.user.login.toLowerCase() === client.profile.botLogin.toLowerCase(),\n\t\t\t\t\t\t\t\t\t\t) ?? null\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn findComment();\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\texecute: async (): Promise<object> => {\n\t\t\t\t\t\t\tif (name === \"github_ensure_label\")\n\t\t\t\t\t\t\t\treturn client.createLabel(t.owner, t.repo, stringArg(input, \"name\"));\n\t\t\t\t\t\t\tif (update)\n\t\t\t\t\t\t\t\treturn pullRequest\n\t\t\t\t\t\t\t\t\t? object(\n\t\t\t\t\t\t\t\t\t\t\tawait client.updatePullRequest(\n\t\t\t\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\t\t\t\tissueNumber(),\n\t\t\t\t\t\t\t\t\t\t\t\tobject(input.patch),\n\t\t\t\t\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t: client.updateIssue(t.owner, t.repo, issueNumber(), object(input.patch));\n\t\t\t\t\t\t\tif (name === \"github_add_pull_request_feedback_reaction\")\n\t\t\t\t\t\t\t\treturn object(\n\t\t\t\t\t\t\t\t\tawait client.addFeedbackReaction(\n\t\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\t\tstringArg(input, \"feedbackKind\"),\n\t\t\t\t\t\t\t\t\t\tnumberArg(input, \"feedbackId\"),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst body = `${stringArg(input, \"body\")}\\n\\n${marker}`;\n\t\t\t\t\t\t\treturn object(\n\t\t\t\t\t\t\t\tawait (name === \"github_add_issue_comment\" || pullRequest\n\t\t\t\t\t\t\t\t\t? client.addIssueComment(t.owner, t.repo, issueNumber(), body, signal)\n\t\t\t\t\t\t\t\t\t: client.replyFeedback(\n\t\t\t\t\t\t\t\t\t\t\tt.owner,\n\t\t\t\t\t\t\t\t\t\t\tt.repo,\n\t\t\t\t\t\t\t\t\t\t\tissueNumber(),\n\t\t\t\t\t\t\t\t\t\t\tstringArg(input, \"feedbackKind\"),\n\t\t\t\t\t\t\t\t\t\t\tnumberArg(input, \"feedbackId\"),\n\t\t\t\t\t\t\t\t\t\t\tbody,\n\t\t\t\t\t\t\t\t\t\t)),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttoMetadata: (value) =>\n\t\t\t\t\t\t\tpullRequest\n\t\t\t\t\t\t\t\t? { owner: t.owner, repo: t.repo, pullRequestNumber: issueNumber() }\n\t\t\t\t\t\t\t\t: { value },\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tif (name === \"github_ensure_label\") return { name: stringArg(input, \"name\") };\n\t\t\t\treturn result;\n\t\t\t},\n\t\t});\n\t}\n\n\tapi.tool<Record<string, unknown>>({\n\t\tname: \"github_ensure_pull_request\",\n\t\tdescription: \"Create a GitHub pull request unless the branch pair already has one\",\n\t\tparameters: projectParameters({\n\t\t\ttitle: { type: \"string\" },\n\t\t\tbody: { type: \"string\" },\n\t\t\thead: { type: \"string\" },\n\t\t\tbase: { type: \"string\" },\n\t\t}),\n\t\tasync execute(ctx, input) {\n\t\t\tconst t = target(ctx);\n\t\t\tconst client = integration.client(t.profile);\n\t\t\tconst head = stringArg(input, \"head\");\n\t\t\tconst base = stringArg(input, \"base\");\n\t\t\tif (head !== ctx.project?.workBranch || base !== ctx.project?.baseBranch)\n\t\t\t\tthrow new Error(\"Pull request branches must match the process project\");\n\t\t\tconst find = async () =>\n\t\t\t\t(await client.listPullRequests(t.owner, t.repo, \"all\")).find(\n\t\t\t\t\t(candidate) => candidate.head.ref === head && candidate.base.ref === base,\n\t\t\t\t) ?? null;\n\t\t\treturn ctx.externalWrites.ensure(\n\t\t\t\t{ writeType: \"github.ensure_pr\", dedupKey: ctx.idempotencyKey },\n\t\t\t\t{\n\t\t\t\t\treconcile: () => existingObject(find),\n\t\t\t\t\texecute: () =>\n\t\t\t\t\t\tclient.createPullRequest(t.owner, t.repo, {\n\t\t\t\t\t\t\ttitle: stringArg(input, \"title\"),\n\t\t\t\t\t\t\tbody: stringArg(input, \"body\"),\n\t\t\t\t\t\t\thead,\n\t\t\t\t\t\t\tbase,\n\t\t\t\t\t\t}),\n\t\t\t\t\ttoMetadata: (pr) => ({ number: pr.number, url: pr.html_url }),\n\t\t\t\t},\n\t\t\t);\n\t\t},\n\t});\n\tfor (const [name, description, numberName, method] of [\n\t\t[\n\t\t\t\"github_get_issue\",\n\t\t\t\"Read a GitHub issue in the current process project\",\n\t\t\t\"issueNumber\",\n\t\t\t\"getIssue\",\n\t\t],\n\t\t[\n\t\t\t\"github_get_pull_request\",\n\t\t\t\"Read a GitHub pull request in the current process project\",\n\t\t\t\"pullRequestNumber\",\n\t\t\t\"getPullRequest\",\n\t\t],\n\t\t[\n\t\t\t\"github_list_pull_request_feedback\",\n\t\t\t\"Read GitHub pull request conversation, reviews, and inline comments\",\n\t\t\t\"pullRequestNumber\",\n\t\t\t\"listActionablePullRequestFeedback\",\n\t\t],\n\t] as const) {\n\t\tapi.tool<Record<string, unknown>>({\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tparameters: projectParameters({ [numberName]: { type: \"integer\" } }),\n\t\t\tasync execute(ctx, input) {\n\t\t\t\tconst t = target(ctx);\n\t\t\t\treturn integration\n\t\t\t\t\t.client(t.profile)\n\t\t\t\t\t[method](t.owner, t.repo, numberArg(input, numberName), ctx.signal);\n\t\t\t},\n\t\t});\n\t}\n\tapi.tool<Record<string, unknown>>({\n\t\tname: \"github_get_ci_diagnostics\",\n\t\tdescription:\n\t\t\t\"Read failed check annotations and bounded Actions logs for the current request revision\",\n\t\tparameters: projectParameters(\n\t\t\t{ pullRequestNumber: { type: \"integer\" }, headSha: { type: \"string\" } },\n\t\t\t[\"pullRequestNumber\", \"headSha\"],\n\t\t),\n\t\tasync execute(ctx, input) {\n\t\t\tconst t = target(ctx);\n\t\t\tconst client = integration.client(t.profile);\n\t\t\tconst number = numberArg(input, \"pullRequestNumber\");\n\t\t\tconst pr = await client.getPullRequest(t.owner, t.repo, number, ctx.signal);\n\t\t\tif (pr.head.ref !== ctx.project?.workBranch || pr.base.ref !== ctx.project.baseBranch)\n\t\t\t\tthrow new Error(\"Pull request does not belong to the process branches\");\n\t\t\treturn client.getCiDiagnostics(\n\t\t\t\tt.owner,\n\t\t\t\tt.repo,\n\t\t\t\tnumber,\n\t\t\t\tstringArg(input, \"headSha\"),\n\t\t\t\tctx.signal,\n\t\t\t);\n\t\t},\n\t});\n\n\tapi.tool<Record<string, unknown>>({\n\t\tname: \"github_get_checks\",\n\t\tdescription: \"Read GitHub Actions check runs for a commit\",\n\t\tparameters: projectParameters({ headSha: { type: \"string\" } }),\n\t\tasync execute(ctx, input) {\n\t\t\tconst t = target(ctx);\n\t\t\treturn integration\n\t\t\t\t.client(t.profile)\n\t\t\t\t.getCheckSummary(t.owner, t.repo, stringArg(input, \"headSha\"));\n\t\t},\n\t});\n}\n","import { resolveRepositoryProjectBinding } from \"@leitwerk-dev/process-sdk\";\n\nexport type { RepositoryProjectBinding as GitHubProjectBinding } from \"@leitwerk-dev/process-sdk\";\n/** @public */\nexport const resolveGitHubProjectBinding = (\n\tctx: Parameters<typeof resolveRepositoryProjectBinding>[0],\n) => resolveRepositoryProjectBinding(ctx, \"github\");\n"],"mappings":";;;;;;;AAAA,SAAS,4BAA0D;;;ACAnE,SAAS,6BAA6B;AAe/B,IAAM,oBAAoB;AAAA,EAChC;AACD;;;ACjBA,SAAS,kBAAkB,8BAA8B;AACzD,SAAS,mBAAAA,wBAAuB;AAEhC,SAAS,sBAAAC,qBAAoB,uBAAuB;;;ACHpD,SAAS,wBAAwB;AACjC;AAAA,EACC;AAAA,OAEM;AAGA,IAAM,uBAAuB;AA6B7B,IAAM,sBAAsB;AAmB5B,SAAS,oBAAoB,OAA0C;AAC7E,QAAM,QAAQ;AASd,MAAI,MAAM,SAAS,iBAAkB,QAAO,iBAAiB,KAAK;AAClE,MAAI,MAAM,QAAQ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A,MAC9B;AAAA,IACD;AACA,2BAAuB,KAAK,WAAW;AAAA,EACxC;AACD;AAEA,IAAO,gBAAQ;AAGR,SAAS,uBACf,KACA,aACA,UAGI,CAAC,GACJ;AACD,MAAI,QAAQ,mBAAmB,WAAW;AAC1C,QAAM,OAAO,IAAI,IAAI,qBAAqB,WAAW;AACrD,MAAI,CAAC,QAAQ,MAAM,QAAQ,IAAI,EAAG;AAClC,sBAAoB,KAAK,WAAW;AACpC,SAAO,qBAAqB,MAAM,aAAa,OAAO;AACvD;","names":["asUnknownRecord","createPollSchedule","parse","asUnknownRecord","value","createPollSchedule"]}
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AA2CzD,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,mBAAmB,EACzB,WAAW,EAAE,iBAAiB,EAC9B,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAO;;EAqKpC"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AA2CzD,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,mBAAmB,EACzB,WAAW,EAAE,iBAAiB,EAC9B,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAO;;EAqKpC"}
package/dist/testing.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  actionableFeedback,
3
3
  assertGitHubRepository,
4
4
  authorizedTrigger
5
- } from "./chunk-OAOKE6LC.js";
5
+ } from "./chunk-PNHJ5QZ6.js";
6
6
 
7
7
  // src/testing.ts
8
8
  import { LocalForgeStore } from "@leitwerk-dev/test-support/local-git";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leitwerk-dev/github",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "leitwerk": {
6
6
  "extension": {
@@ -25,11 +25,11 @@
25
25
  "build": "tsup && tsc -p tsconfig.tsup.json --emitDeclarationOnly"
26
26
  },
27
27
  "dependencies": {
28
- "@leitwerk-dev/domain": "0.3.0",
29
- "@leitwerk-dev/process-sdk": "0.3.0",
30
- "@leitwerk-dev/watcher-utils": "0.3.0",
31
- "@leitwerk-dev/repository-rebase": "0.3.0",
32
- "@leitwerk-dev/test-support": "0.3.0"
28
+ "@leitwerk-dev/domain": "0.3.1",
29
+ "@leitwerk-dev/process-sdk": "0.3.1",
30
+ "@leitwerk-dev/watcher-utils": "0.3.1",
31
+ "@leitwerk-dev/test-support": "0.3.1",
32
+ "@leitwerk-dev/coding": "0.3.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "tsup": "^8.5.1",
package/src/client.ts CHANGED
@@ -27,7 +27,6 @@ export interface GitHubRepository {
27
27
  /** @internal */
28
28
  full_name: string;
29
29
  /** @public */
30
- /** @public */
31
30
  owner: {
32
31
  /** @public */
33
32
  login: string;
@@ -63,13 +62,11 @@ export interface GitHubLabelEvent {
63
62
  /** @internal */
64
63
  event: string;
65
64
  /** @public */
66
- /** @public */
67
65
  label?: {
68
66
  /** @public */
69
67
  name: string;
70
68
  };
71
69
  /** @public */
72
- /** @public */
73
70
  actor: {
74
71
  /** @public */
75
72
  login: string;
@@ -122,7 +119,6 @@ export interface GitHubRelease {
122
119
  /** @internal */
123
120
  html_url: string;
124
121
  /** @public */
125
- /** @public */
126
122
  assets: Array<{
127
123
  /** @public */
128
124
  name: string;
@@ -529,7 +525,6 @@ export class GitHubClient extends RepositoryHttpClient {
529
525
  name: string;
530
526
  conclusion: string | null;
531
527
  /** @public */
532
- /** @public */
533
528
  output?: {
534
529
  /** @public */
535
530
  title?: string;
@@ -572,7 +567,6 @@ export class GitHubClient extends RepositoryHttpClient {
572
567
  /** @public */
573
568
  html_url: string;
574
569
  /** @public */
575
- /** @public */
576
570
  log: {
577
571
  /** @public */
578
572
  text: string;
package/src/external.ts CHANGED
@@ -1,8 +1,8 @@
1
+ import { describeConflict } from "@leitwerk-dev/coding/repository-rebase";
1
2
  import {
2
3
  defineExternalActionSource,
3
4
  type ExternalEventDescription,
4
5
  } from "@leitwerk-dev/process-sdk";
5
- import { describeConflict } from "@leitwerk-dev/repository-rebase";
6
6
 
7
7
  /** @internal */
8
8
  export const GITHUB_PR_STATE_KIND = "@leitwerk-private/github.pr_state";
package/src/provider.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { conflictEvidence, createConflictReporter } from "@leitwerk-dev/coding/repository-rebase";
1
2
  import { asUnknownRecord } from "@leitwerk-dev/domain";
2
3
  import type { CoreServerSetupDeps } from "@leitwerk-dev/process-sdk";
3
- import { conflictEvidence, createConflictReporter } from "@leitwerk-dev/repository-rebase";
4
4
  import { createPollSchedule, emptyPollResult } from "@leitwerk-dev/watcher-utils";
5
5
  import type { GitHubIntegration } from "./capability.js";
6
6
  import {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/authorization.ts","../src/client.ts"],"sourcesContent":["import type { GitHubClient, GitHubFeedbackItem, GitHubIssue } from \"./client.js\";\n\ntype MembershipClient = Pick<GitHubClient, \"profile\" | \"isOrganizationMember\">;\n\nexport async function authorizedTrigger(\n\tclient: MembershipClient & Pick<GitHubClient, \"getIssue\" | \"listIssueEvents\">,\n\towner: string,\n\trepo: string,\n\tnumber: number,\n\ttrigger: string,\n\tdone: string,\n) {\n\tif (\n\t\tclient.profile.allowedOrganization &&\n\t\towner.toLowerCase() !== client.profile.allowedOrganization.toLowerCase()\n\t)\n\t\treturn null;\n\tconst issue = (await client.getIssue(owner, repo, number)) as GitHubIssue & {\n\t\t/** @internal */\n\t\tpull_request?: unknown;\n\t};\n\tif (\n\t\tissue.pull_request ||\n\t\tissue.state !== \"open\" ||\n\t\t!issue.labels.some((label) => label.name === trigger) ||\n\t\tissue.labels.some((label) => label.name === done)\n\t)\n\t\treturn null;\n\tconst last = (await client.listIssueEvents(owner, repo, number))\n\t\t.filter(\n\t\t\t(event) =>\n\t\t\t\t(event.event === \"labeled\" || event.event === \"unlabeled\") && event.label?.name === trigger,\n\t\t)\n\t\t.sort((a, b) => b.id - a.id)[0];\n\tif (\n\t\tlast?.event !== \"labeled\" ||\n\t\t!last.actor?.login ||\n\t\t!(await client.isOrganizationMember(last.actor.login))\n\t)\n\t\treturn null;\n\treturn {\n\t\t/** @internal */\n\t\tissue,\n\t\t/** @internal */\n\t\tactor: last.actor.login,\n\t\t/** @internal */\n\t\teventId: last.id,\n\t};\n}\n\nexport async function actionableFeedback(client: MembershipClient, feedback: GitHubFeedbackItem[]) {\n\tconst authorized: GitHubFeedbackItem[] = [];\n\tfor (const item of feedback) {\n\t\tif (\n\t\t\titem.author.toLowerCase() === client.profile.botLogin.toLowerCase() ||\n\t\t\titem.body.includes(\"<!-- leitwerk-write:\")\n\t\t)\n\t\t\tcontinue;\n\t\tif (await client.isOrganizationMember(item.author)) authorized.push(item);\n\t}\n\treturn authorized;\n}\n","import { asUnknownRecord } from \"@leitwerk-dev/domain\";\nimport {\n\ttype RepositoryFeedbackItem as GitHubFeedbackItem,\n\ttype RepositoryIssue as GitHubIssue,\n\ttype RepositoryPullRequest as GitHubPullRequest,\n\tIntegrationHttpError,\n\tnormalizeRepositoryFeedback as normalize,\n\tRepositoryHttpClient,\n} from \"@leitwerk-dev/process-sdk\";\n\nimport { actionableFeedback, authorizedTrigger } from \"./authorization.js\";\n\nexport type { GitHubFeedbackItem, GitHubIssue, GitHubPullRequest };\n\n/** @internal */\ninterface GitHubLabel {\n\t/** @internal */\n\tid: number;\n\t/** @internal */\n\tname: string;\n}\n\n/** @public */\nexport interface GitHubRepository {\n\t/** @public */\n\tname: string;\n\t/** @internal */\n\tfull_name: string;\n\t/** @public */\n\t/** @public */\n\towner: {\n\t\t/** @public */\n\t\tlogin: string;\n\t};\n\t/** @public */\n\tssh_url: string;\n\t/** @public */\n\tdefault_branch: string;\n\t/** @internal */\n\thtml_url: string;\n\t/** @internal */\n\tarchived: boolean;\n\t/** @internal */\n\thas_issues: boolean;\n}\n/** @public */\nexport interface GitHubGitIdentity {\n\t/** @internal */\n\tprovider: \"github\";\n\t/** @internal */\n\tprofile: string;\n\t/** @internal */\n\tlogin: string;\n\t/** @public */\n\tname: string;\n\t/** @public */\n\temail: string;\n}\n/** @public */\nexport interface GitHubLabelEvent {\n\t/** @internal */\n\tid: number;\n\t/** @internal */\n\tevent: string;\n\t/** @public */\n\t/** @public */\n\tlabel?: {\n\t\t/** @public */\n\t\tname: string;\n\t};\n\t/** @public */\n\t/** @public */\n\tactor: {\n\t\t/** @public */\n\t\tlogin: string;\n\t} | null;\n}\n\n/** @internal */\nexport interface GitHubProfile {\n\t/** @internal */\n\tapiBaseUrl: string;\n\t/** @internal */\n\ttoken: string;\n\t/** @internal */\n\tbotLogin: string;\n\t/** @internal */\n\tallowedOrganization?: string;\n}\n\n/** @public */\nexport interface GitHubCheckSummary {\n\t/** @public */\n\theadSha: string;\n\t/** @public */\n\tstatus: \"pending\" | \"success\" | \"failure\";\n\t/** @public */\n\ttotal: number;\n\t/** @public */\n\tfailed: Array<{\n\t\t/** @internal */\n\t\tname: string;\n\t\t/** @public */\n\t\tconclusion: string | null;\n\t\t/** @public */\n\t\turl: string | null;\n\t}>;\n}\n\n/** @public */\nexport interface GitHubRelease {\n\t/** @internal */\n\tid: number;\n\t/** @public */\n\ttag_name: string;\n\t/** @internal */\n\ttarget_commitish: string;\n\t/** @internal */\n\tdraft: boolean;\n\t/** @internal */\n\tprerelease: boolean;\n\t/** @internal */\n\thtml_url: string;\n\t/** @public */\n\t/** @public */\n\tassets: Array<{\n\t\t/** @public */\n\t\tname: string;\n\t\t/** @public */\n\t\turl: string;\n\t\t/** @public */\n\t\tbrowser_download_url: string;\n\t}>;\n}\n\n/** @internal */\nexport function parseGitHubProfiles(value: unknown): Map<string, GitHubProfile> {\n\tconst profiles = new Map<string, GitHubProfile>();\n\tfor (const [name, raw] of Object.entries(\n\t\tasUnknownRecord(asUnknownRecord(value)?.profiles) ?? {},\n\t)) {\n\t\tconst config = asUnknownRecord(raw) ?? {};\n\t\tconst apiBaseUrl =\n\t\t\ttypeof config.api_base_url === \"string\"\n\t\t\t\t? config.api_base_url.replace(/\\/+$/, \"\")\n\t\t\t\t: \"https://api.github.com\";\n\t\tconst token = typeof config.token === \"string\" ? config.token.trim() : \"\";\n\t\tconst botLogin = typeof config.bot_login === \"string\" ? config.bot_login.trim() : \"leitwerk\";\n\t\tif (!/^https:\\/\\//.test(apiBaseUrl))\n\t\t\tthrow new Error(`GitHub profile '${name}' requires an HTTPS api_base_url`);\n\t\tif (!token) throw new Error(`GitHub profile '${name}' requires a token`);\n\t\tif (!botLogin) throw new Error(`GitHub profile '${name}' requires bot_login`);\n\t\tconst allowedOrganization = config.allowed_organization;\n\t\tif (\n\t\t\tallowedOrganization !== undefined &&\n\t\t\t(typeof allowedOrganization !== \"string\" || !/^[a-z0-9-]+$/i.test(allowedOrganization))\n\t\t) {\n\t\t\tthrow new Error(`GitHub profile '${name}' requires a valid allowed_organization`);\n\t\t}\n\t\tprofiles.set(name, {\n\t\t\tapiBaseUrl,\n\t\t\ttoken,\n\t\t\tbotLogin,\n\t\t\t...(typeof allowedOrganization === \"string\"\n\t\t\t\t? { allowedOrganization: allowedOrganization.toLowerCase() }\n\t\t\t\t: {}),\n\t\t});\n\t}\n\treturn profiles;\n}\n\n/** @internal */\nexport function assertGitHubRepository(profile: GitHubProfile, owner: string, repo: string): void {\n\tif (\n\t\t!/^[a-z0-9-]+$/i.test(owner) ||\n\t\t!/^[a-z0-9_.-]+$/i.test(repo) ||\n\t\trepo === \".\" ||\n\t\trepo === \"..\"\n\t) {\n\t\tthrow new Error(\"Invalid GitHub repository\");\n\t}\n\tif (\n\t\tprofile.allowedOrganization &&\n\t\towner.toLowerCase() !== profile.allowedOrganization.toLowerCase()\n\t) {\n\t\tthrow new Error(`GitHub project must belong to ${profile.allowedOrganization}`);\n\t}\n}\n\n/** @public */\nexport class GitHubClient extends RepositoryHttpClient {\n\t/** @internal */\n\tconstructor(/** @internal */ readonly profile: GitHubProfile) {\n\t\tsuper(\"GitHub\", profile.apiBaseUrl, {\n\t\t\tAccept: \"application/vnd.github+json\",\n\t\t\tAuthorization: `Bearer ${profile.token}`,\n\t\t\t\"X-GitHub-Api-Version\": \"2022-11-28\",\n\t\t});\n\t}\n\n\t/** @internal */\n\tprotected override response(path: string, init: RequestInit = {}): Promise<Response> {\n\t\treturn super.response(path, {\n\t\t\t...init,\n\t\t\tredirect: \"error\",\n\t\t\tsignal: init.signal ?? AbortSignal.timeout(30_000),\n\t\t});\n\t}\n\n\t/** @internal */\n\tprotected override repositoryPath(owner: string, repo: string): string {\n\t\tassertGitHubRepository(this.profile, owner, repo);\n\t\treturn super.repositoryPath(owner, repo);\n\t}\n\n\t/** @internal */\n\tasync listRepositories() {\n\t\treturn (\n\t\t\tawait this.pages<GitHubRepository>(\n\t\t\t\tthis.profile.allowedOrganization\n\t\t\t\t\t? `/orgs/${this.profile.allowedOrganization}/repos?type=all`\n\t\t\t\t\t: \"/user/repos?affiliation=owner,collaborator,organization_member\",\n\t\t\t)\n\t\t).filter(\n\t\t\t(repo) =>\n\t\t\t\t(!this.profile.allowedOrganization ||\n\t\t\t\t\trepo.owner.login.toLowerCase() === this.profile.allowedOrganization.toLowerCase()) &&\n\t\t\t\t!repo.archived &&\n\t\t\t\trepo.has_issues,\n\t\t);\n\t}\n\t/** @internal */\n\tasync listOpenIssues(owner: string, repo: string) {\n\t\treturn (\n\t\t\tawait this.pages<\n\t\t\t\tGitHubIssue & {\n\t\t\t\t\t/** @internal */\n\t\t\t\t\tpull_request?: unknown;\n\t\t\t\t}\n\t\t\t>(`${this.repositoryPath(owner, repo)}/issues?state=open`)\n\t\t).filter((issue) => !issue.pull_request);\n\t}\n\t/** @internal */\n\tlistIssueEvents(owner: string, repo: string, number: number) {\n\t\treturn this.pages<GitHubLabelEvent>(\n\t\t\t`${this.repositoryPath(owner, repo)}/issues/${number}/events`,\n\t\t);\n\t}\n\t/** @internal */\n\tasync isOrganizationMember(login: string): Promise<boolean> {\n\t\tif (!this.profile.allowedOrganization) return true;\n\t\tif (!/^[a-z0-9-]+$/i.test(login)) return false;\n\t\ttry {\n\t\t\tconst response = await this.response(\n\t\t\t\t`/orgs/${this.profile.allowedOrganization}/members/${encodeURIComponent(login)}`,\n\t\t\t);\n\t\t\treturn response.status === 204;\n\t\t} catch (error) {\n\t\t\tif (error instanceof IntegrationHttpError) {\n\t\t\t\tif (error.status === 404) return false;\n\t\t\t\tthrow new Error(`GitHub membership check failed with ${error.status}`);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\t/** @internal */\n\tasync authorizedTrigger(\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\ttrigger: string,\n\t\tdone: string,\n\t) {\n\t\treturn authorizedTrigger(this, owner, repo, number, trigger, done);\n\t}\n\t/** @public */\n\tasync resolveGitIdentity(profile: string): Promise<GitHubGitIdentity> {\n\t\tconst user = await this.request<{ login: string; name: string | null; id: number }>(\"/user\");\n\t\tif (user.login !== this.profile.botLogin)\n\t\t\tthrow new Error(\"GitHub authenticated user does not match bot_login\");\n\t\treturn {\n\t\t\tprovider: \"github\",\n\t\t\tprofile,\n\t\t\tlogin: user.login,\n\t\t\tname: user.name || user.login,\n\t\t\temail: `${user.id}+${user.login}@users.noreply.github.com`,\n\t\t};\n\t}\n\t/** @public */\n\tupdateIssue(owner: string, repo: string, number: number, patch: Record<string, unknown>) {\n\t\treturn this.request<GitHubIssue>(`${this.repositoryPath(owner, repo)}/issues/${number}`, {\n\t\t\tmethod: \"PATCH\",\n\t\t\tbody: JSON.stringify(patch),\n\t\t});\n\t}\n\t/** @internal */\n\tlistLabels(owner: string, repo: string) {\n\t\treturn this.pages<GitHubLabel>(`${this.repositoryPath(owner, repo)}/labels`);\n\t}\n\t/** @internal */\n\tcreateLabel(owner: string, repo: string, name: string) {\n\t\treturn this.request<GitHubLabel>(`${this.repositoryPath(owner, repo)}/labels`, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({ name, color: \"238636\" }),\n\t\t});\n\t}\n\t/** @internal */\n\tasync ensureLabel(owner: string, repo: string, name: string) {\n\t\tconst labels = await this.listLabels(owner, repo);\n\t\treturn labels.find((label) => label.name === name) ?? this.createLabel(owner, repo, name);\n\t}\n\t/** @internal */\n\taddFeedbackReaction(owner: string, repo: string, kind: string, id: number) {\n\t\tconst segment = kind === \"inline\" ? \"pulls/comments\" : \"issues/comments\";\n\t\treturn this.request(`${this.repositoryPath(owner, repo)}/${segment}/${id}/reactions`, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({ content: \"eyes\" }),\n\t\t});\n\t}\n\t/** @internal */\n\tasync replyFeedback(\n\t\towner: string,\n\t\trepo: string,\n\t\tpr: number,\n\t\tkind: string,\n\t\tid: number,\n\t\tbody: string,\n\t) {\n\t\tif (kind === \"inline\")\n\t\t\treturn this.writeJson(\n\t\t\t\t`${this.repositoryPath(owner, repo)}/pulls/${pr}/comments/${id}/replies`,\n\t\t\t\t\"POST\",\n\t\t\t\t{ body },\n\t\t\t);\n\t\treturn this.addIssueComment(owner, repo, pr, body);\n\t}\n\n\t/** @internal */\n\tgetCommit(owner: string, repo: string, ref: string) {\n\t\treturn this.request<{\n\t\t\t/** @internal */\n\t\t\tsha: string;\n\t\t}>(`${this.repositoryPath(owner, repo)}/commits/${encodeURIComponent(ref)}`);\n\t}\n\n\t/** @public */\n\tasync isAncestor(owner: string, repo: string, ancestor: string, descendant: string) {\n\t\tconst comparison = await this.request<{ status: string }>(\n\t\t\t`${this.repositoryPath(owner, repo)}/compare/${encodeURIComponent(ancestor)}...${encodeURIComponent(descendant)}`,\n\t\t);\n\t\treturn comparison.status === \"identical\" || comparison.status === \"ahead\";\n\t}\n\n\t/** @public */\n\tasync listPullRequestFeedback(\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\tsignal?: AbortSignal,\n\t): Promise<GitHubFeedbackItem[]> {\n\t\tconst prefix = `${this.repositoryPath(owner, repo)}`;\n\t\tconst [conversation, reviews, inline] = await Promise.all([\n\t\t\tthis.pages<Record<string, unknown>>(`${prefix}/issues/${number}/comments`, signal),\n\t\t\tthis.pages<Record<string, unknown>>(`${prefix}/pulls/${number}/reviews`, signal),\n\t\t\tthis.pages<Record<string, unknown>>(`${prefix}/pulls/${number}/comments`, signal),\n\t\t]);\n\n\t\tconst candidates = [\n\t\t\t...conversation.map((item) => ({ kind: \"conversation\" as const, item })),\n\t\t\t...reviews.map((item) => ({ kind: \"review\" as const, item })),\n\t\t\t...inline.map((item) => ({ kind: \"inline\" as const, item })),\n\t\t];\n\t\tconst feedback: GitHubFeedbackItem[] = [];\n\t\tconst needsProvenance: typeof candidates = [];\n\t\tfor (const candidate of candidates) {\n\t\t\tconst { kind, item } = candidate;\n\t\t\tconst normalized = normalize(kind, item);\n\t\t\tif (!normalized) continue;\n\t\t\tconst createdAt = typeof item.created_at === \"string\" ? Date.parse(item.created_at) : NaN;\n\t\t\tconst updatedAt = typeof item.updated_at === \"string\" ? Date.parse(item.updated_at) : NaN;\n\t\t\tif (\n\t\t\t\t!this.profile.allowedOrganization ||\n\t\t\t\t(kind !== \"review\" && Number.isFinite(createdAt) && createdAt === updatedAt)\n\t\t\t) {\n\t\t\t\tfeedback.push(normalized);\n\t\t\t} else if (typeof item.node_id === \"string\" && item.node_id) {\n\t\t\t\t// REST attributes edited bodies to their original author. Reviews also\n\t\t\t\t// omit edit timestamps, so obtain the body and latest editor together.\n\t\t\t\tneedsProvenance.push(candidate);\n\t\t\t}\n\t\t}\n\t\tfor (let offset = 0; offset < needsProvenance.length; offset += 100) {\n\t\t\tconst batch = needsProvenance.slice(offset, offset + 100);\n\t\t\tconst response = await this.request<{\n\t\t\t\tdata?: { nodes?: Array<Record<string, unknown> | null> };\n\t\t\t\terrors?: unknown[];\n\t\t\t}>(\"/graphql\", {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tsignal,\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\tquery: `query LeitwerkFeedbackProvenance($ids: [ID!]!) {\n\t\t\t\t\t\tnodes(ids: $ids) {\n\t\t\t\t\t\t\tid __typename\n\t\t\t\t\t\t\t... on IssueComment { body createdAt lastEditedAt author { login } editor { login } }\n\t\t\t\t\t\t\t... on PullRequestReview { body createdAt submittedAt lastEditedAt author { login } editor { login } }\n\t\t\t\t\t\t\t... on PullRequestReviewComment { body createdAt lastEditedAt author { login } editor { login } path line }\n\t\t\t\t\t\t}\n\t\t\t\t\t}`,\n\t\t\t\t\tvariables: { ids: batch.map(({ item }) => item.node_id) },\n\t\t\t\t}),\n\t\t\t});\n\t\t\tif (response.errors?.length || !Array.isArray(response.data?.nodes)) {\n\t\t\t\tthrow new Error(\"GitHub feedback provenance lookup failed\");\n\t\t\t}\n\t\t\tconst snapshots = new Map(\n\t\t\t\tresponse.data.nodes.filter((node) => node !== null).map((node) => [node.id, node]),\n\t\t\t);\n\t\t\tfor (const { kind, item } of batch) {\n\t\t\t\tconst snapshot = snapshots.get(item.node_id);\n\t\t\t\tconst expectedType = {\n\t\t\t\t\tconversation: \"IssueComment\",\n\t\t\t\t\treview: \"PullRequestReview\",\n\t\t\t\t\tinline: \"PullRequestReviewComment\",\n\t\t\t\t}[kind];\n\t\t\t\tif (!snapshot || snapshot.__typename !== expectedType) continue;\n\t\t\t\tconst publishedAt = kind === \"review\" ? snapshot.submittedAt : snapshot.createdAt;\n\t\t\t\tif (typeof publishedAt !== \"string\" || !Number.isFinite(Date.parse(publishedAt))) continue;\n\t\t\t\tconst editedAt = snapshot.lastEditedAt;\n\t\t\t\tif (editedAt !== null) {\n\t\t\t\t\tif (typeof editedAt !== \"string\" || !Number.isFinite(Date.parse(editedAt))) continue;\n\t\t\t\t\tconst editor = asUnknownRecord(snapshot.editor)?.login;\n\t\t\t\t\tif (typeof editor !== \"string\" || !(await this.isOrganizationMember(editor))) continue;\n\t\t\t\t}\n\t\t\t\tconst normalized = normalize(kind, {\n\t\t\t\t\t...snapshot,\n\t\t\t\t\tid: item.id,\n\t\t\t\t\tuser: snapshot.author,\n\t\t\t\t\tcreated_at: editedAt ?? publishedAt,\n\t\t\t\t});\n\t\t\t\tif (normalized) feedback.push(normalized);\n\t\t\t}\n\t\t}\n\t\treturn feedback;\n\t}\n\n\t/** @public */\n\tasync getCheckSummary(owner: string, repo: string, headSha: string): Promise<GitHubCheckSummary> {\n\t\tconst runs: Array<Record<string, unknown>> = [];\n\t\tfor (let page = 1; ; page++) {\n\t\t\tconst response = await this.request<{ check_runs: Array<Record<string, unknown>> }>(\n\t\t\t\t`${this.repositoryPath(owner, repo)}/commits/${headSha}/check-runs?per_page=100&page=${page}`,\n\t\t\t);\n\t\t\truns.push(...response.check_runs);\n\t\t\tif (response.check_runs.length < 100) break;\n\t\t}\n\t\tconst terminalSuccess = new Set([\"success\", \"neutral\", \"skipped\"]);\n\t\tconst failed = runs\n\t\t\t.filter((run) => run.status === \"completed\" && !terminalSuccess.has(String(run.conclusion)))\n\t\t\t.map((run) => ({\n\t\t\t\tname: String(run.name ?? \"unknown\"),\n\t\t\t\tconclusion: typeof run.conclusion === \"string\" ? run.conclusion : null,\n\t\t\t\turl: typeof run.html_url === \"string\" ? run.html_url : null,\n\t\t\t}));\n\t\tconst pending = runs.some((run) => run.status !== \"completed\");\n\t\treturn {\n\t\t\theadSha,\n\t\t\tstatus: failed.length ? \"failure\" : pending || !runs.length ? \"pending\" : \"success\",\n\t\t\ttotal: runs.length,\n\t\t\tfailed,\n\t\t};\n\t}\n\n\t/** Human feedback checked against current membership; delivery receipts use raw reads. */\n\t/** @internal */\n\tasync listActionablePullRequestFeedback(\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\tsignal?: AbortSignal,\n\t) {\n\t\treturn actionableFeedback(\n\t\t\tthis,\n\t\t\tawait this.listPullRequestFeedback(owner, repo, number, signal),\n\t\t);\n\t}\n\n\t/** @internal */\n\tlistFeedbackReplies(owner: string, repo: string, pr: number, kind: string) {\n\t\treturn kind === \"inline\"\n\t\t\t? this.pages<Record<string, unknown>>(\n\t\t\t\t\t`${this.repositoryPath(owner, repo)}/pulls/${pr}/comments`,\n\t\t\t\t)\n\t\t\t: this.listIssueComments(owner, repo, pr);\n\t}\n\n\t/** @internal */\n\tlistFeedbackReactions(owner: string, repo: string, kind: string, id: number) {\n\t\tif (kind !== \"inline\" && kind !== \"conversation\")\n\t\t\tthrow new Error(\"Reviews do not support reactions\");\n\t\tconst segment = kind === \"inline\" ? \"pulls/comments\" : \"issues/comments\";\n\t\treturn this.pages<{\n\t\t\t/** @internal */\n\t\t\tid: number;\n\t\t\t/** @internal */\n\t\t\tcontent: string;\n\t\t\t/** @internal */\n\t\t\tuser: {\n\t\t\t\t/** @internal */\n\t\t\t\tlogin: string;\n\t\t\t};\n\t\t}>(`${this.repositoryPath(owner, repo)}/${segment}/${id}/reactions`);\n\t}\n\n\t/** @public */\n\tasync getCiDiagnostics(\n\t\towner: string,\n\t\trepo: string,\n\t\tpullRequestNumber: number,\n\t\theadSha: string,\n\t\tsignal?: AbortSignal,\n\t) {\n\t\tconst pr = await this.getPullRequest(owner, repo, pullRequestNumber, signal);\n\t\tif (pr.state !== \"open\" || pr.merged || pr.head.sha !== headSha)\n\t\t\tthrow new Error(\"CI diagnostics target a stale pull request revision\");\n\t\tconst prefix = this.repositoryPath(owner, repo);\n\t\tconst checks: Array<{\n\t\t\t/** @internal */\n\t\t\tid: number;\n\t\t\tname: string;\n\t\t\tconclusion: string | null;\n\t\t\t/** @public */\n\t\t\t/** @public */\n\t\t\toutput?: {\n\t\t\t\t/** @public */\n\t\t\t\ttitle?: string;\n\t\t\t\t/** @public */\n\t\t\t\tsummary?: string;\n\t\t\t\t/** @public */\n\t\t\t\ttext?: string;\n\t\t\t};\n\t\t}> = [];\n\t\tfor (let page = 1; ; page++) {\n\t\t\tconst batch = await this.request<{ check_runs: typeof checks }>(\n\t\t\t\t`${prefix}/commits/${encodeURIComponent(headSha)}/check-runs?filter=latest&per_page=100&page=${page}`,\n\t\t\t\t{ signal },\n\t\t\t);\n\t\t\tchecks.push(...batch.check_runs);\n\t\t\tif (batch.check_runs.length < 100) break;\n\t\t}\n\t\tconst failed = checks.filter(\n\t\t\t(c) => c.conclusion && ![\"success\", \"neutral\", \"skipped\"].includes(c.conclusion),\n\t\t);\n\t\tconst annotations = await Promise.all(\n\t\t\tfailed.slice(0, 10).map(async (check) => ({\n\t\t\t\t/** @public */\n\t\t\t\tid: check.id,\n\t\t\t\t/** @public */\n\t\t\t\tname: check.name,\n\t\t\t\t/** @public */\n\t\t\t\toutput: check.output,\n\t\t\t\t/** @public */\n\t\t\t\tannotations: (\n\t\t\t\t\tawait this.pages<unknown>(`${prefix}/check-runs/${check.id}/annotations`, signal)\n\t\t\t\t).slice(0, 100),\n\t\t\t})),\n\t\t);\n\t\tconst jobs: Array<{\n\t\t\t/** @public */\n\t\t\tid: number;\n\t\t\t/** @public */\n\t\t\tname: string;\n\t\t\t/** @public */\n\t\t\thtml_url: string;\n\t\t\t/** @public */\n\t\t\t/** @public */\n\t\t\tlog: {\n\t\t\t\t/** @public */\n\t\t\t\ttext: string;\n\t\t\t\t/** @public */\n\t\t\t\ttruncated: boolean;\n\t\t\t};\n\t\t}> = [];\n\t\tfor (let page = 1; jobs.length < 10; page++) {\n\t\t\tconst runs = await this.request<{\n\t\t\t\tworkflow_runs: Array<{\n\t\t\t\t\tid: number;\n\t\t\t\t\thead_sha: string;\n\t\t\t\t\thead_branch: string;\n\t\t\t\t\tconclusion: string | null;\n\t\t\t\t}>;\n\t\t\t}>(\n\t\t\t\t`${prefix}/actions/runs?head_sha=${encodeURIComponent(headSha)}&per_page=100&page=${page}`,\n\t\t\t\t{ signal },\n\t\t\t);\n\t\t\tfor (const run of runs.workflow_runs) {\n\t\t\t\tif (\n\t\t\t\t\trun.head_sha !== headSha ||\n\t\t\t\t\trun.head_branch !== pr.head.ref ||\n\t\t\t\t\t!run.conclusion ||\n\t\t\t\t\t[\"success\", \"neutral\", \"skipped\"].includes(run.conclusion)\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\t\t\t\tfor (let jobPage = 1; jobs.length < 10; jobPage++) {\n\t\t\t\t\tconst batch = await this.request<{\n\t\t\t\t\t\tjobs: Array<{ id: number; name: string; html_url: string; conclusion: string | null }>;\n\t\t\t\t\t}>(`${prefix}/actions/runs/${run.id}/jobs?filter=latest&per_page=100&page=${jobPage}`, {\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t});\n\t\t\t\t\tfor (const job of batch.jobs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!job.conclusion ||\n\t\t\t\t\t\t\t[\"success\", \"neutral\", \"skipped\"].includes(job.conclusion) ||\n\t\t\t\t\t\t\tjobs.length >= 10\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tjobs.push({\n\t\t\t\t\t\t\tid: job.id,\n\t\t\t\t\t\t\tname: job.name,\n\t\t\t\t\t\t\thtml_url: job.html_url,\n\t\t\t\t\t\t\tlog: await this.readJobLog(owner, repo, job.id, signal),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (batch.jobs.length < 100) break;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (runs.workflow_runs.length < 100) break;\n\t\t}\n\t\tconst refreshed = await this.getPullRequest(owner, repo, pullRequestNumber, signal);\n\t\tif (refreshed.head.sha !== headSha || refreshed.state !== \"open\" || refreshed.merged)\n\t\t\tthrow new Error(\"CI diagnostics were superseded\");\n\t\treturn {\n\t\t\t/** @public */\n\t\t\theadSha,\n\t\t\t/** @public */\n\t\t\tchecks: annotations,\n\t\t\t/** @public */\n\t\t\tjobs,\n\t\t\t/** @public */\n\t\t\ttruncated: failed.length > 10 || jobs.length >= 10,\n\t\t};\n\t}\n\tprivate async readJobLog(\n\t\towner: string,\n\t\trepo: string,\n\t\tjob: number,\n\t\tsignal?: AbortSignal,\n\t): Promise<{ text: string; truncated: boolean }> {\n\t\tconst timeout = signal\n\t\t\t? AbortSignal.any([signal, AbortSignal.timeout(30000)])\n\t\t\t: AbortSignal.timeout(30000);\n\t\tlet response = await fetch(\n\t\t\t`${this.profile.apiBaseUrl}${this.repositoryPath(owner, repo)}/actions/jobs/${job}/logs`,\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${this.profile.token}`,\n\t\t\t\t\tAccept: \"application/vnd.github+json\",\n\t\t\t\t},\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: timeout,\n\t\t\t},\n\t\t);\n\t\tif (response.status === 302) {\n\t\t\tconst location = new URL(response.headers.get(\"location\") ?? \"\");\n\t\t\tif (location.protocol !== \"https:\" || location.username || location.password)\n\t\t\t\tthrow new Error(\"Invalid GitHub log download URL\");\n\t\t\tawait response.body?.cancel();\n\t\t\t// Signed storage URLs must never receive the GitHub credential.\n\t\t\tresponse = await fetch(location, { redirect: \"error\", signal: timeout });\n\t\t}\n\t\tif (!response.ok) throw new IntegrationHttpError(response.status, \"GitHub job log unavailable\");\n\t\tconst reader = response.body?.getReader();\n\t\tif (!reader) return { text: \"\", truncated: false };\n\t\tconst chunks: Uint8Array[] = [];\n\t\tlet bytes = 0;\n\t\tlet truncated = false;\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst next = await reader.read();\n\t\t\t\tif (next.done) break;\n\t\t\t\tconst part = next.value.slice(0, 65536 - bytes);\n\t\t\t\tchunks.push(part);\n\t\t\t\tbytes += part.length;\n\t\t\t\tif (bytes === 65536) {\n\t\t\t\t\ttruncated = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tawait reader.cancel();\n\t\t}\n\t\treturn { text: Buffer.concat(chunks).toString(\"utf8\"), truncated };\n\t}\n\n\t/** @internal */\n\tlistReleases(owner: string, repo: string) {\n\t\treturn this.pages<GitHubRelease>(`${this.repositoryPath(owner, repo)}/releases`);\n\t}\n\n\t/** @public */\n\tdownloadReleaseAsset(asset: GitHubRelease[\"assets\"][number]): Promise<string> {\n\t\tconst url = new URL(asset.url);\n\t\tif (`${url.protocol}//${url.host}` !== this.profile.apiBaseUrl)\n\t\t\tthrow new Error(\"GitHub release asset URL does not match the configured API origin\");\n\t\treturn this.response(`${url.pathname}${url.search}`, {\n\t\t\theaders: { Accept: \"application/octet-stream\" },\n\t\t}).then((response) => response.text());\n\t}\n}\n"],"mappings":";AAIA,eAAsB,kBACrB,QACA,OACA,MACA,QACA,SACA,MACC;AACD,MACC,OAAO,QAAQ,uBACf,MAAM,YAAY,MAAM,OAAO,QAAQ,oBAAoB,YAAY;AAEvE,WAAO;AACR,QAAM,QAAS,MAAM,OAAO,SAAS,OAAO,MAAM,MAAM;AAIxD,MACC,MAAM,gBACN,MAAM,UAAU,UAChB,CAAC,MAAM,OAAO,KAAK,CAAC,UAAU,MAAM,SAAS,OAAO,KACpD,MAAM,OAAO,KAAK,CAAC,UAAU,MAAM,SAAS,IAAI;AAEhD,WAAO;AACR,QAAM,QAAQ,MAAM,OAAO,gBAAgB,OAAO,MAAM,MAAM,GAC5D;AAAA,IACA,CAAC,WACC,MAAM,UAAU,aAAa,MAAM,UAAU,gBAAgB,MAAM,OAAO,SAAS;AAAA,EACtF,EACC,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAC/B,MACC,MAAM,UAAU,aAChB,CAAC,KAAK,OAAO,SACb,CAAE,MAAM,OAAO,qBAAqB,KAAK,MAAM,KAAK;AAEpD,WAAO;AACR,SAAO;AAAA;AAAA,IAEN;AAAA;AAAA,IA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