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.
| Stripe webhooks, enterprise invoices, and sudo for both | 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", |
| Stripe webhooks, enterprise invoices, and sudo for both | 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", | |
| Stripe webhooks, enterprise invoices, and sudo for both | 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", | |
| Stripe webhooks, enterprise invoices, and sudo for both | 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", | |
| Stripe webhooks, enterprise invoices, and sudo for both | 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", | |
| Stripe webhooks, enterprise invoices, and sudo for both | 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", | |
| Stripe webhooks, enterprise invoices, and sudo for both | 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", | |
| Stripe webhooks, enterprise invoices, and sudo for both | 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", | |
| 113 | "vulnerability_alert.reopened", | |
| Merge branch 'mirroring' into artifacts-mode | 114 | "mirror.unreachable", |
| 115 | "mirror.reachable", | |
| 116 | "mirror.state_changed", | |
| 117 | "mirror.moved_in", | |
| Stripe webhooks, enterprise invoices, and sudo for both | 118 | ] as const; |
| 119 | ||
| 120 | export type Hook = { | |
| 121 | id: string; | |
| 122 | scope: "repo" | "workspace"; | |
| 123 | workspace: string; | |
| 124 | /** For a repository's webhook: `owner/name`. */ | |
| 125 | repo: string | null; | |
| 126 | url: string; | |
| 127 | /** Event types, or `["*"]` for all. */ | |
| 128 | events: string[]; | |
| 129 | active: boolean; | |
| 130 | secretHint: string; | |
| 131 | createdBy: string; | |
| 132 | createdAt: string; | |
| 133 | lastStatus: "delivered" | "pending" | "failed" | null; | |
| 134 | lastDeliveredAt: string | null; | |
| 135 | }; | |
| 136 | ||
| 137 | export type HookDelivery = { | |
| 138 | id: string; | |
| 139 | hookId: string; | |
| 140 | eventId: string; | |
| 141 | event: string; | |
| 142 | status: "pending" | "delivered" | "failed"; | |
| 143 | attempts: number; | |
| 144 | responseStatus: number | null; | |
| 145 | responseBody: string | null; | |
| 146 | error: string | null; | |
| 147 | durationMs: number | null; | |
| 148 | /** The JSON that was sent. */ | |
| 149 | payload: string; | |
| 150 | createdAt: string; | |
| 151 | deliveredAt: string | null; | |
| 152 | nextAttemptAt: string | null; | |
| 153 | }; | |
| 154 | ||
| 155 | /** A repository's webhooks, or with `repo` left out, the workspace's own. */ | |
| 156 | export type HookOwner = { workspace: string; repo?: RepoPath }; | |
| 157 | ||
| 158 | export interface WebhooksApi { | |
| 159 | list(viewer: Viewer, owner: HookOwner): Promise<Result<Hook[]>>; | |
| 160 | create( | |
| 161 | actor: User, | |
| 162 | owner: HookOwner, | |
| 163 | input: { url: string; events?: string[]; secret?: string }, | |
| 164 | ): Promise<Result<{ hook: Hook; secret: string | null }>>; | |
| 165 | update(actor: User, owner: HookOwner, id: string, input: { url?: string; events?: string[]; active?: boolean }): Promise<Result<Hook>>; | |
| 166 | delete(actor: User, owner: HookOwner, id: string): Promise<Result<boolean>>; | |
| 167 | ping(actor: User, owner: HookOwner, id: string): Promise<Result<HookDelivery>>; | |
| 168 | deliveries(viewer: Viewer, owner: HookOwner, id: string): Promise<Result<HookDelivery[]>>; | |
| 169 | redeliver(actor: User, owner: HookOwner, deliveryId: string): Promise<Result<HookDelivery>>; | |
| 170 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.