Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Icons are cached at the edge | 1 | import type { User, Viewer } from "./identity"; |
| 2 | import type { RepoPath } from "./repos"; | |
| 3 | import type { Result } from "./result"; | |
| 4 | ||
| 5 | /** | |
| 6 | * Events, delivered to the addresses a repository or a workspace registers. | |
| 7 | * Mirrors `crates/contracts/src/webhooks.rs`. | |
| 8 | */ | |
| 9 | ||
| 10 | /** Every event a webhook can be sent, in the order people are shown them. */ | |
| 11 | export const EVENT_TYPES = [ | |
| 12 | "git.push", | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 13 | "branch.renamed", |
| Icons are cached at the edge | 14 | "repo.created", |
| 15 | "repo.forked", | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 16 | "repo.updated", |
| 17 | "repo.visibility_changed", | |
| 18 | "repo.renamed", | |
| 19 | "repo.transferred", | |
| 20 | "repo.default_branch_changed", | |
| 21 | "repo.archived", | |
| 22 | "repo.unarchived", | |
| 23 | "repo.deleted", | |
| 24 | "repo.restored", | |
| 25 | "repo.purged", | |
| 26 | "repo.collaborator_added", | |
| 27 | "repo.collaborator_removed", | |
| 28 | "repo.collaborator_role_changed", | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 29 | "team.created", |
| 30 | "team.edited", | |
| 31 | "team.deleted", | |
| 32 | "team.member_added", | |
| 33 | "team.member_role_changed", | |
| 34 | "team.member_removed", | |
| 35 | "team.repo_added", | |
| 36 | "team.repo_role_changed", | |
| 37 | "team.repo_removed", | |
| @g1t welcomes you when you join a workspace, and that is the one introduction any agent makes. Identity now says when a person becomes a member, workspace.member_joined, by invitation, by an invite code, or by creating the workspace, and webhooks can hear it; the agents service hears it too, and for anyone who joined, never the creator, the workspace's @g1t opens your direct message and says in its own voice who it is, what to ask it, how agents answer, and where things are, once per person per workspace and charged to @g1t like any reply, with a fixed welcome when no model can be used. The agents, workspaces, authentication and webhooks guides say so. | 38 | "workspace.member_joined", |
| Merge rulesets: branch and tag rules, agent-first, enforced on push and merge | 39 | "ruleset.created", |
| 40 | "ruleset.updated", | |
| 41 | "ruleset.deleted", | |
| Icons are cached at the edge | 42 | "issue.opened", |
| 43 | "issue.updated", | |
| 44 | "issue.assigned", | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 45 | "issue.labeled", |
| 46 | "issue.unlabeled", | |
| 47 | "issue.milestoned", | |
| 48 | "issue.demilestoned", | |
| Icons are cached at the edge | 49 | "issue.closed", |
| 50 | "issue.reopened", | |
| 51 | "comment.created", | |
| Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts | 52 | "comment.edited", |
| 53 | "comment.deleted", | |
| Icons are cached at the edge | 54 | "pull.opened", |
| 55 | "pull.ready", | |
| 56 | "pull.updated", | |
| 57 | "pull.merge_requested", | |
| 58 | "pull.merged", | |
| 59 | "pull.closed", | |
| Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts | 60 | "pull.reopened", |
| 61 | "pull.converted_to_draft", | |
| Events: review requests, assignments, stops and deployments are published | 62 | "pull.assigned", |
| 63 | "pull.review_requested", | |
| 64 | "pull.review_request_removed", | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 65 | "pull.labeled", |
| 66 | "pull.unlabeled", | |
| 67 | "pull.milestoned", | |
| 68 | "pull.demilestoned", | |
| 69 | "pull.base_changed", | |
| Events: review requests, assignments, stops and deployments are published | 70 | "pull.stalled", |
| 71 | "pull.resumed", | |
| Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts | 72 | "release.created", |
| 73 | "release.published", | |
| 74 | "release.released", | |
| 75 | "release.prereleased", | |
| 76 | "release.edited", | |
| 77 | "release.unpublished", | |
| 78 | "release.deleted", | |
| Icons are cached at the edge | 79 | "agent.asked", |
| 80 | "checks.completed", | |
| Merge checks: statuses and check runs on every commit | 81 | "status.created", |
| 82 | "check_run.created", | |
| 83 | "check_run.completed", | |
| 84 | "check_run.rerequested", | |
| 85 | "check_run.requested_action", | |
| 86 | "check_suite.completed", | |
| 87 | "check_suite.rerequested", | |
| Icons are cached at the edge | 88 | "review.completed", |
| 89 | "workflow.completed", | |
| Events: review requests, assignments, stops and deployments are published | 90 | "deployment.succeeded", |
| 91 | "deployment.failed", | |
| Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97 | 92 | "deployment.created", |
| 93 | "deployment_status.created", | |
| Icons are cached at the edge | 94 | "queue.changed", |
| 95 | "session.appended", | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 96 | "package.published", |
| 97 | "package.version_deleted", | |
| 98 | "package.deleted", | |
| 99 | "package.visibility_changed", | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 100 | "secret_scanning_alert.created", |
| 101 | "secret_scanning_alert.fixed", | |
| 102 | "secret_scanning_alert.dismissed", | |
| 103 | "secret_scanning_alert.reopened", | |
| 104 | "secret_scanning.bypass_requested", | |
| 105 | "secret_scanning.bypass_reviewed", | |
| 106 | "code_scanning_alert.created", | |
| 107 | "code_scanning_alert.fixed", | |
| 108 | "code_scanning_alert.dismissed", | |
| 109 | "code_scanning_alert.reopened", | |
| 110 | "vulnerability_alert.created", | |
| 111 | "vulnerability_alert.fixed", | |
| 112 | "vulnerability_alert.dismissed", | |
| Security tells people the way they can live with. Each scan publishes one summary event per alert type (secret_scanning_alert.summary, code_scanning_alert.summary, vulnerability_alert.summary: what it opened, by severity, what it fixed, what is open now, the worst new alert and the newest one's title, with the owners and security managers to tell) beside the per-alert events webhooks keep, so the inbox holds one thread per repository and alert type that the next scan brings up to date instead of one item per finding, and the ids are capped at 200 while the counts are not. Critical and high alerts and a refused push reach the inbox at once (and toast like a mention, as the new security notification kind); medium and low wait for each person's security digest, one inbox item and email per workspace, daily or weekly as they choose in their notification settings, at once, or never; a scan that opened nothing refreshes the thread quietly ("2 of 3 fixed") and marks it done when nothing is left open; and security alerts are emailed by default. A repository can turn alerts for secrets found in its history off while push protection stays on. Reporting arrives: security advisories (G1TSA ids, drafts published and withdrawn by Admins and security managers, visible to anyone who can see the repository once published) and private vulnerability reporting (a repository setting; anyone who can see it may report, signed out with an email on a public one, five a day each, and the owners and security managers are told at once), each with its RPC methods, REST routes under /repos/{owner}/{name}/security/advisories and /security/reports, MCP actions, scopes and reference examples. | 113 | "secret_scanning_alert.summary", |
| 114 | "code_scanning_alert.summary", | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 115 | "vulnerability_alert.reopened", |
| Security tells people the way they can live with. Each scan publishes one summary event per alert type (secret_scanning_alert.summary, code_scanning_alert.summary, vulnerability_alert.summary: what it opened, by severity, what it fixed, what is open now, the worst new alert and the newest one's title, with the owners and security managers to tell) beside the per-alert events webhooks keep, so the inbox holds one thread per repository and alert type that the next scan brings up to date instead of one item per finding, and the ids are capped at 200 while the counts are not. Critical and high alerts and a refused push reach the inbox at once (and toast like a mention, as the new security notification kind); medium and low wait for each person's security digest, one inbox item and email per workspace, daily or weekly as they choose in their notification settings, at once, or never; a scan that opened nothing refreshes the thread quietly ("2 of 3 fixed") and marks it done when nothing is left open; and security alerts are emailed by default. A repository can turn alerts for secrets found in its history off while push protection stays on. Reporting arrives: security advisories (G1TSA ids, drafts published and withdrawn by Admins and security managers, visible to anyone who can see the repository once published) and private vulnerability reporting (a repository setting; anyone who can see it may report, signed out with an email on a public one, five a day each, and the owners and security managers are told at once), each with its RPC methods, REST routes under /repos/{owner}/{name}/security/advisories and /security/reports, MCP actions, scopes and reference examples. | 116 | "vulnerability_alert.summary", |
| 117 | "security_advisory.published", | |
| 118 | "security_advisory.withdrawn", | |
| 119 | "security_advisory.reported", | |
| Merge branch 'mirroring' into artifacts-mode | 120 | "mirror.unreachable", |
| 121 | "mirror.reachable", | |
| 122 | "mirror.state_changed", | |
| 123 | "mirror.moved_in", | |
| Icons are cached at the edge | 124 | ] as const; |
| 125 | ||
| 126 | export type Hook = { | |
| 127 | id: string; | |
| 128 | scope: "repo" | "workspace"; | |
| 129 | workspace: string; | |
| 130 | /** For a repository's webhook: `owner/name`. */ | |
| 131 | repo: string | null; | |
| 132 | url: string; | |
| 133 | /** Event types, or `["*"]` for all. */ | |
| 134 | events: string[]; | |
| 135 | active: boolean; | |
| 136 | secretHint: string; | |
| 137 | createdBy: string; | |
| 138 | createdAt: string; | |
| 139 | lastStatus: "delivered" | "pending" | "failed" | null; | |
| 140 | lastDeliveredAt: string | null; | |
| 141 | }; | |
| 142 | ||
| 143 | export type HookDelivery = { | |
| 144 | id: string; | |
| 145 | hookId: string; | |
| 146 | eventId: string; | |
| 147 | event: string; | |
| 148 | status: "pending" | "delivered" | "failed"; | |
| 149 | attempts: number; | |
| 150 | responseStatus: number | null; | |
| 151 | responseBody: string | null; | |
| 152 | error: string | null; | |
| 153 | durationMs: number | null; | |
| 154 | /** The JSON that was sent. */ | |
| 155 | payload: string; | |
| 156 | createdAt: string; | |
| 157 | deliveredAt: string | null; | |
| 158 | nextAttemptAt: string | null; | |
| 159 | }; | |
| 160 | ||
| 161 | /** A repository's webhooks, or with `repo` left out, the workspace's own. */ | |
| 162 | export type HookOwner = { workspace: string; repo?: RepoPath }; | |
| 163 | ||
| 164 | export interface WebhooksApi { | |
| 165 | list(viewer: Viewer, owner: HookOwner): Promise<Result<Hook[]>>; | |
| 166 | create( | |
| 167 | actor: User, | |
| 168 | owner: HookOwner, | |
| 169 | input: { url: string; events?: string[]; secret?: string }, | |
| 170 | ): Promise<Result<{ hook: Hook; secret: string | null }>>; | |
| 171 | update(actor: User, owner: HookOwner, id: string, input: { url?: string; events?: string[]; active?: boolean }): Promise<Result<Hook>>; | |
| 172 | delete(actor: User, owner: HookOwner, id: string): Promise<Result<boolean>>; | |
| 173 | ping(actor: User, owner: HookOwner, id: string): Promise<Result<HookDelivery>>; | |
| 174 | deliveries(viewer: Viewer, owner: HookOwner, id: string): Promise<Result<HookDelivery[]>>; | |
| 175 | redeliver(actor: User, owner: HookOwner, deliveryId: string): Promise<Result<HookDelivery>>; | |
| 176 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.