@usine/github 0.3.1-next.305.gdd88a31 → 0.3.1-next.308.gd64b7c3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +2 -0
  2. package/dist/access.d.ts +36 -3
  3. package/dist/access.d.ts.map +1 -1
  4. package/dist/access.js +32 -3
  5. package/dist/access.js.map +1 -1
  6. package/dist/credentials.d.ts +4 -1
  7. package/dist/credentials.d.ts.map +1 -1
  8. package/dist/credentials.js +4 -1
  9. package/dist/credentials.js.map +1 -1
  10. package/dist/delivery.d.ts +4 -0
  11. package/dist/delivery.d.ts.map +1 -1
  12. package/dist/delivery.js +4 -0
  13. package/dist/delivery.js.map +1 -1
  14. package/dist/error.d.ts +17 -6
  15. package/dist/error.d.ts.map +1 -1
  16. package/dist/error.js +13 -1
  17. package/dist/error.js.map +1 -1
  18. package/dist/github-app.d.ts +32 -8
  19. package/dist/github-app.d.ts.map +1 -1
  20. package/dist/github-app.js +15 -2
  21. package/dist/github-app.js.map +1 -1
  22. package/dist/graphql.d.ts +1 -1
  23. package/dist/graphql.d.ts.map +1 -1
  24. package/dist/installation.d.ts +13 -2
  25. package/dist/installation.d.ts.map +1 -1
  26. package/dist/installation.js +13 -2
  27. package/dist/installation.js.map +1 -1
  28. package/dist/item-history.d.ts +13 -2
  29. package/dist/item-history.d.ts.map +1 -1
  30. package/dist/item-history.js +23 -4
  31. package/dist/item-history.js.map +1 -1
  32. package/dist/item-writer.d.ts +11 -3
  33. package/dist/item-writer.d.ts.map +1 -1
  34. package/dist/item-writer.js +5 -2
  35. package/dist/item-writer.js.map +1 -1
  36. package/dist/label-writer.d.ts +8 -0
  37. package/dist/label-writer.d.ts.map +1 -1
  38. package/dist/label-writer.js +4 -0
  39. package/dist/label-writer.js.map +1 -1
  40. package/dist/local-secrets.d.ts +15 -1
  41. package/dist/local-secrets.d.ts.map +1 -1
  42. package/dist/local-secrets.js +15 -1
  43. package/dist/local-secrets.js.map +1 -1
  44. package/dist/polling/detection.d.ts +17 -2
  45. package/dist/polling/detection.d.ts.map +1 -1
  46. package/dist/polling/detection.js +17 -2
  47. package/dist/polling/detection.js.map +1 -1
  48. package/dist/polling/labels.d.ts +5 -0
  49. package/dist/polling/labels.d.ts.map +1 -1
  50. package/dist/polling/labels.js +5 -0
  51. package/dist/polling/labels.js.map +1 -1
  52. package/dist/polling/payload.d.ts +6 -2
  53. package/dist/polling/payload.d.ts.map +1 -1
  54. package/dist/polling/payload.js +6 -2
  55. package/dist/polling/payload.js.map +1 -1
  56. package/dist/polling/polling.d.ts +23 -7
  57. package/dist/polling/polling.d.ts.map +1 -1
  58. package/dist/polling/polling.js +5 -1
  59. package/dist/polling/polling.js.map +1 -1
  60. package/package.json +2 -2
package/README.md CHANGED
@@ -114,3 +114,5 @@ It mints both token kinds, posts an issue comment with the repo token, checks th
114
114
  `GitHubApp.deliveries(after)` uses the App JWT to read new summaries from `GET /app/hook/deliveries`. Pass the last recorded `WebhookDeliveryId`, or `Option.none()` on the first read. Each `WebhookDelivery` contains its ID, event, and optional repository ID. The adapter follows pagination until it reaches the recorded ID, the end of the log, or ten pages. It fetches no delivery payloads.
115
115
 
116
116
  Enable the App webhook to record deliveries. A delivery with a failed HTTP status can still request a refresh; no reachable webhook endpoint is needed for deliveries mode.
117
+
118
+ `GitHubApp.configureWebhook(url)` uses the App JWT to PATCH `/app/hook/config` with the full delivery URL and JSON content type. It preserves the App's webhook secret, active flag, and subscribed events. Enable the webhook in the App settings before using endpoint mode.
package/dist/access.d.ts CHANGED
@@ -3,64 +3,97 @@ import { Schema } from "effect";
3
3
  import { RepositoryId, Installation } from "./installation.ts";
4
4
  /** The repository permissions required for polling, label updates, and agent-authored changes. */
5
5
  export declare const REQUIRED_REPOSITORY_PERMISSIONS: {
6
+ /** Reads check runs for pull request selection. */
6
7
  readonly checks: "read";
8
+ /** Allows repository reads and agent-authored commits. */
7
9
  readonly contents: "write";
10
+ /** Allows issue comments and label updates. */
8
11
  readonly issues: "write";
12
+ /** Reads repository metadata; GitHub grants this permission automatically. */
9
13
  readonly metadata: "read";
14
+ /** Allows pull request creation, reviews, and updates. */
10
15
  readonly pull_requests: "write";
11
16
  };
17
+ /** A repository permission that the App installation must grant at the required level. */
12
18
  export type RequiredRepositoryPermission = keyof typeof REQUIRED_REPOSITORY_PERMISSIONS;
13
19
  /**
14
- * The repository permissions of an Attempt's token for each Loop permission level (ADR 0011).
20
+ * The repository permissions of an attempt's token for each loop permission level (ADR 0011).
15
21
  * A `read` token can read code and post reviews and comments (`pull_requests` and `issues` are
16
22
  * `write`), but can't push, merge, or update a branch, which need `contents: write`. Names and
17
23
  * levels follow the installation token API:
18
24
  * https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps
19
25
  */
20
26
  export declare const WORKER_TOKEN_PERMISSIONS: {
27
+ /** Allows code changes and item writes for an attempt. */
21
28
  readonly write: {
29
+ /** Reads check runs for the attempt. */
22
30
  readonly checks: "read";
31
+ /** Allows code reads and pushes. */
23
32
  readonly contents: "write";
33
+ /** Allows issue comments and label updates. */
24
34
  readonly issues: "write";
35
+ /** Reads repository metadata. */
25
36
  readonly metadata: "read";
37
+ /** Allows pull request comments, reviews, and updates. */
26
38
  readonly pull_requests: "write";
27
39
  };
40
+ /** Allows code reads and item writes, including reviews and comments; code pushes require write access. */
28
41
  readonly read: {
42
+ /** Reads check runs for the attempt. */
29
43
  readonly checks: "read";
44
+ /** Allows code reads; GitHub refuses pushes and branch updates. */
30
45
  readonly contents: "read";
46
+ /** Allows issue comments and label updates. */
31
47
  readonly issues: "write";
48
+ /** Reads repository metadata. */
32
49
  readonly metadata: "read";
50
+ /** Allows pull request comments, reviews, and updates. */
33
51
  readonly pull_requests: "write";
34
52
  };
35
53
  };
36
54
  /** Returns the required repository permissions that `granted` doesn't satisfy, as `name:level` strings. */
37
55
  export declare const missingPermissions: (granted: Readonly<Record<string, string>>) => ReadonlyArray<string>;
38
56
  declare const CoveredProject_base: Schema.Class<CoveredProject, Schema.TaggedStruct<"CoveredProject", {
57
+ /** The installation that can mint a token for this repository. */
39
58
  readonly installationId: Schema.brand<Schema.Int, "GitHubInstallationId">;
59
+ /** The managed repository name as supplied in the registry. */
40
60
  readonly repository: Schema.brand<Schema.String, "RepositoryName">;
61
+ /** The GitHub repository ID used to restrict a worker token to this repository. */
41
62
  readonly repositoryId: Schema.brand<Schema.Int, "GitHubRepositoryId">;
42
63
  }>, {}>;
43
64
  /** A registered repository covered by the GitHub App installation. */
44
65
  export declare class CoveredProject extends CoveredProject_base {
45
66
  }
46
67
  declare const ProjectNotInstalledError_base: Schema.Class<ProjectNotInstalledError, Schema.TaggedStruct<"ProjectNotInstalledError", {
68
+ /** The registry repository missing from the installation. */
47
69
  readonly repository: Schema.brand<Schema.String, "RepositoryName">;
70
+ /** An operator-facing explanation of the missing repository access. */
48
71
  readonly message: Schema.NonEmptyString;
49
72
  }>, import("effect/Cause").YieldableError>;
50
- /** The error for a registry repository the installation doesn't cover. Reported per project, so covered projects still load. */
73
+ /** The error for a registry repository the installation doesn't cover. Returned per repository, so covered repositories can still run. */
51
74
  export declare class ProjectNotInstalledError extends ProjectNotInstalledError_base {
52
75
  }
53
76
  /** The installation coverage of one registered repository. */
54
77
  export declare const ProjectAccess: Schema.Union<readonly [typeof CoveredProject, typeof ProjectNotInstalledError]>;
55
78
  export type ProjectAccess = typeof ProjectAccess.Type;
79
+ /** A repository accessible to the installation, identified by GitHub's numeric ID and owner/name. */
56
80
  export interface InstalledRepository {
81
+ /** The repository ID returned by the installation repositories API. */
57
82
  readonly id: RepositoryId;
83
+ /** The owner/name returned by GitHub; coverage matching ignores case. */
58
84
  readonly name: RepositoryName;
59
85
  }
60
- /** Returns one `ProjectAccess` per registry repository by checking it against the installation's repositories. */
86
+ /**
87
+ * Returns one coverage result per entry in `registry`, preserving its order and spelling.
88
+ * Matches names against `installed` without case sensitivity and uses `installation.id` for
89
+ * covered repositories. Missing repositories produce individual `ProjectNotInstalledError`
90
+ * values, so callers can continue with covered repositories (ADR 0011).
91
+ */
61
92
  export declare const deriveProjectAccess: (installation: Installation, registry: ReadonlyArray<RepositoryName>, installed: ReadonlyArray<InstalledRepository>) => ReadonlyArray<ProjectAccess>;
62
93
  declare const AppPermissionError_base: Schema.Class<AppPermissionError, Schema.TaggedStruct<"AppPermissionError", {
94
+ /** Unsatisfied repository permissions as `name:level` strings; a write grant satisfies a read requirement. */
63
95
  readonly missing: Schema.$Array<Schema.NonEmptyString>;
96
+ /** An operator-facing explanation of the grants needed on the App and installation. */
64
97
  readonly message: Schema.NonEmptyString;
65
98
  }>, import("effect/Cause").YieldableError>;
66
99
  /** The error when the installation lacks required repository permissions; `missing` uses `name:level` form. */
@@ -1 +1 @@
1
- {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAkB,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/E,kGAAkG;AAClG,eAAO,MAAM,+BAA+B;aAC1C,MAAM,EAAE,MAAM;aACd,QAAQ,EAAE,OAAO;aACjB,MAAM,EAAE,OAAO;aACf,QAAQ,EAAE,MAAM;aAChB,aAAa,EAAE,OAAO;CACd,CAAC;AAEX,MAAM,MAAM,4BAA4B,GAAG,MAAM,OAAO,+BAA+B,CAAC;AAExF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB;;iBAEjC,MAAM,EAAE,MAAM;iBACd,QAAQ,EAAE,OAAO;iBACjB,MAAM,EAAE,OAAO;iBACf,QAAQ,EAAE,MAAM;iBAChB,aAAa,EAAE,OAAO;;;iBAGtB,MAAM,EAAE,MAAM;iBACd,QAAQ,EAAE,MAAM;iBAChB,MAAM,EAAE,OAAO;iBACf,QAAQ,EAAE,MAAM;iBAChB,aAAa,EAAE,OAAO;;CAKzB,CAA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,cAAc,CAAC,aAC5B,aAAa,CAAC,mBAAmB,CAAC,KAC5C,aAAa,CAAC,aAAa,CAe7B,CAAC;;IAMA,8GAA8G;;IAE9G,uFAAuF;;;AANzF,+GAA+G;AAC/G,qBAAa,kBAAmB,SAAQ,uBAOtC;CAAG"}
package/dist/access.js CHANGED
@@ -3,32 +3,49 @@ import { Schema } from "effect";
3
3
  import { InstallationId, RepositoryId, Installation } from "./installation.js";
4
4
  /** The repository permissions required for polling, label updates, and agent-authored changes. */
5
5
  export const REQUIRED_REPOSITORY_PERMISSIONS = {
6
+ /** Reads check runs for pull request selection. */
6
7
  checks: "read",
8
+ /** Allows repository reads and agent-authored commits. */
7
9
  contents: "write",
10
+ /** Allows issue comments and label updates. */
8
11
  issues: "write",
12
+ /** Reads repository metadata; GitHub grants this permission automatically. */
9
13
  metadata: "read",
14
+ /** Allows pull request creation, reviews, and updates. */
10
15
  pull_requests: "write",
11
16
  };
12
17
  /**
13
- * The repository permissions of an Attempt's token for each Loop permission level (ADR 0011).
18
+ * The repository permissions of an attempt's token for each loop permission level (ADR 0011).
14
19
  * A `read` token can read code and post reviews and comments (`pull_requests` and `issues` are
15
20
  * `write`), but can't push, merge, or update a branch, which need `contents: write`. Names and
16
21
  * levels follow the installation token API:
17
22
  * https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps
18
23
  */
19
24
  export const WORKER_TOKEN_PERMISSIONS = {
25
+ /** Allows code changes and item writes for an attempt. */
20
26
  write: {
27
+ /** Reads check runs for the attempt. */
21
28
  checks: "read",
29
+ /** Allows code reads and pushes. */
22
30
  contents: "write",
31
+ /** Allows issue comments and label updates. */
23
32
  issues: "write",
33
+ /** Reads repository metadata. */
24
34
  metadata: "read",
35
+ /** Allows pull request comments, reviews, and updates. */
25
36
  pull_requests: "write",
26
37
  },
38
+ /** Allows code reads and item writes, including reviews and comments; code pushes require write access. */
27
39
  read: {
40
+ /** Reads check runs for the attempt. */
28
41
  checks: "read",
42
+ /** Allows code reads; GitHub refuses pushes and branch updates. */
29
43
  contents: "read",
44
+ /** Allows issue comments and label updates. */
30
45
  issues: "write",
46
+ /** Reads repository metadata. */
31
47
  metadata: "read",
48
+ /** Allows pull request comments, reviews, and updates. */
32
49
  pull_requests: "write",
33
50
  },
34
51
  };
@@ -37,20 +54,30 @@ const grants = (actual, required) => actual === required || (required === "read"
37
54
  export const missingPermissions = (granted) => Object.entries(REQUIRED_REPOSITORY_PERMISSIONS).flatMap(([permission, required]) => grants(granted[permission], required) ? [] : [`${permission}:${required}`]);
38
55
  /** A registered repository covered by the GitHub App installation. */
39
56
  export class CoveredProject extends Schema.TaggedClass("@usine/github/ProjectAccess/CoveredProject")("CoveredProject", {
57
+ /** The installation that can mint a token for this repository. */
40
58
  installationId: InstallationId,
59
+ /** The managed repository name as supplied in the registry. */
41
60
  repository: RepositoryName,
61
+ /** The GitHub repository ID used to restrict a worker token to this repository. */
42
62
  repositoryId: RepositoryId,
43
63
  }) {
44
64
  }
45
- /** The error for a registry repository the installation doesn't cover. Reported per project, so covered projects still load. */
65
+ /** The error for a registry repository the installation doesn't cover. Returned per repository, so covered repositories can still run. */
46
66
  export class ProjectNotInstalledError extends Schema.TaggedError("@usine/github/ProjectNotInstalledError")("ProjectNotInstalledError", {
67
+ /** The registry repository missing from the installation. */
47
68
  repository: RepositoryName,
69
+ /** An operator-facing explanation of the missing repository access. */
48
70
  message: Schema.NonEmptyString,
49
71
  }) {
50
72
  }
51
73
  /** The installation coverage of one registered repository. */
52
74
  export const ProjectAccess = Schema.Union([CoveredProject, ProjectNotInstalledError]);
53
- /** Returns one `ProjectAccess` per registry repository by checking it against the installation's repositories. */
75
+ /**
76
+ * Returns one coverage result per entry in `registry`, preserving its order and spelling.
77
+ * Matches names against `installed` without case sensitivity and uses `installation.id` for
78
+ * covered repositories. Missing repositories produce individual `ProjectNotInstalledError`
79
+ * values, so callers can continue with covered repositories (ADR 0011).
80
+ */
54
81
  export const deriveProjectAccess = (installation, registry, installed) => {
55
82
  const byName = new Map(installed.map((repo) => [repo.name.toLowerCase(), repo]));
56
83
  return registry.map((repository) => {
@@ -69,7 +96,9 @@ export const deriveProjectAccess = (installation, registry, installed) => {
69
96
  };
70
97
  /** The error when the installation lacks required repository permissions; `missing` uses `name:level` form. */
71
98
  export class AppPermissionError extends Schema.TaggedError("@usine/github/AppPermissionError")("AppPermissionError", {
99
+ /** Unsatisfied repository permissions as `name:level` strings; a write grant satisfies a read requirement. */
72
100
  missing: Schema.Array(Schema.NonEmptyString).check(Schema.isNonEmpty()),
101
+ /** An operator-facing explanation of the grants needed on the App and installation. */
73
102
  message: Schema.NonEmptyString,
74
103
  }) {
75
104
  }
@@ -1 +1 @@
1
- {"version":3,"file":"access.js","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/E,kGAAkG;AAClG,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,OAAO;CACd,CAAC;AAIX;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,KAAK,EAAE;QACL,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,MAAM;QAChB,aAAa,EAAE,OAAO;KACvB;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,MAAM;QAChB,aAAa,EAAE,OAAO;KACvB;CAIF,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,MAA0B,EA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,WAAW,CACxD,kCAAkC,CACnC,CAAC,oBAAoB,EAAE;IACtB,8GAA8G;IAC9G,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IACvE,uFAAuF;IACvF,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG"}
@@ -8,10 +8,12 @@ export type PrivateKey = typeof PrivateKey.Type;
8
8
  /** The App private key, redacted in diagnostics and not encodable. */
9
9
  export declare const RedactedPrivateKey: Schema.RedactedFromValue<Schema.brand<Schema.NonEmptyString, "GitHubAppPrivateKey">>;
10
10
  declare const AppCredentials_base: Schema.Class<AppCredentials, Schema.Struct<{
11
+ /** The GitHub App ID used as the issuer of signed App JWTs, distinct from its bot user ID. */
11
12
  readonly appId: Schema.brand<Schema.Int, "GitHubAppId">;
13
+ /** The PEM signing key, redacted in diagnostics and rejected by encoding; retain it only in the orchestrator. */
12
14
  readonly privateKey: Schema.RedactedFromValue<Schema.brand<Schema.NonEmptyString, "GitHubAppPrivateKey">>;
13
15
  }>, {}>;
14
- /** The App credentials, kept by the orchestrator and never passed to a Worker. */
16
+ /** The App credentials, kept by the orchestrator and never passed to a worker. */
15
17
  export declare class AppCredentials extends AppCredentials_base {
16
18
  }
17
19
  declare const GitHubCredentials_base: Context.ServiceClass<GitHubCredentials, "@usine/github/GitHubCredentials", AppCredentials>;
@@ -19,6 +21,7 @@ declare const GitHubCredentials_base: Context.ServiceClass<GitHubCredentials, "@
19
21
  export declare class GitHubCredentials extends GitHubCredentials_base {
20
22
  }
21
23
  declare const AppAuthenticationError_base: Schema.Class<AppAuthenticationError, Schema.TaggedStruct<"AppAuthenticationError", {
24
+ /** An operator-facing explanation of the private-key import failure. */
22
25
  readonly message: Schema.NonEmptyString;
23
26
  }>, import("effect/Cause").YieldableError>;
24
27
  /** The error when the App private key can't sign, raised once when the App layer is built. */
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzC,6DAA6D;AAC7D,eAAO,MAAM,KAAK,yCAEjB,CAAC;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAEtC,wDAAwD;AACxD,eAAO,MAAM,UAAU,4DAKoB,CAAC;AAC5C,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAEhD,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,sFAAiE,CAAC;;;;;AAEjG,kFAAkF;AAClF,qBAAa,cAAe,SAAQ,mBAGlC;CAAG;;AAEL,kDAAkD;AAClD,qBAAa,iBAAkB,SAAQ,sBAEtC;CAAG;;;;AAEJ,8FAA8F;AAC9F,qBAAa,sBAAuB,SAAQ,2BAI1C;CAAG"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzC,6DAA6D;AAC7D,eAAO,MAAM,KAAK,yCAEjB,CAAC;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAEtC,wDAAwD;AACxD,eAAO,MAAM,UAAU,4DAKoB,CAAC;AAC5C,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAEhD,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,sFAAiE,CAAC;;IAI/F,8FAA8F;;IAE9F,iHAAiH;;;AAJnH,kFAAkF;AAClF,qBAAa,cAAe,SAAQ,mBAKlC;CAAG;;AAEL,kDAAkD;AAClD,qBAAa,iBAAkB,SAAQ,sBAEtC;CAAG;;IAMF,wEAAwE;;;AAJ1E,8FAA8F;AAC9F,qBAAa,sBAAuB,SAAQ,2BAK1C;CAAG"}
@@ -5,9 +5,11 @@ export const AppId = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).pipe(Sch
5
5
  export const PrivateKey = Schema.NonEmptyString.check(Schema.isPattern(/^-----BEGIN (?:RSA )?PRIVATE KEY-----[\s\S]+-----END (?:RSA )?PRIVATE KEY-----\s*$/u, { message: "Expected a PEM-encoded RSA private key" })).pipe(Schema.brand("GitHubAppPrivateKey"));
6
6
  /** The App private key, redacted in diagnostics and not encodable. */
7
7
  export const RedactedPrivateKey = Schema.RedactedFromValue(PrivateKey, { disallowEncode: true });
8
- /** The App credentials, kept by the orchestrator and never passed to a Worker. */
8
+ /** The App credentials, kept by the orchestrator and never passed to a worker. */
9
9
  export class AppCredentials extends Schema.Class("@usine/github/AppCredentials")({
10
+ /** The GitHub App ID used as the issuer of signed App JWTs, distinct from its bot user ID. */
10
11
  appId: AppId,
12
+ /** The PEM signing key, redacted in diagnostics and rejected by encoding; retain it only in the orchestrator. */
11
13
  privateKey: RedactedPrivateKey,
12
14
  }) {
13
15
  }
@@ -16,6 +18,7 @@ export class GitHubCredentials extends Context.Service()("@usine/github/GitHubCr
16
18
  }
17
19
  /** The error when the App private key can't sign, raised once when the App layer is built. */
18
20
  export class AppAuthenticationError extends Schema.TaggedError("@usine/github/AppAuthenticationError")("AppAuthenticationError", {
21
+ /** An operator-facing explanation of the private-key import failure. */
19
22
  message: Schema.NonEmptyString,
20
23
  }) {
21
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzC,6DAA6D;AAC7D,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAC1E,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAC5B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,CAAC,SAAS,CACd,qFAAqF,EACrF,EAAE,OAAO,EAAE,wCAAwC,EAAE,CACtD,CACF,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;AAG5C,sEAAsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC,UAAU,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;AAEjG,kFAAkF;AAClF,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,KAAK,CAAiB,8BAA8B,CAAC,CAAC;IAC/F,8FAA8F;IAC9F,KAAK,EAAE,KAAK;IACZ,iHAAiH;IACjH,UAAU,EAAE,kBAAkB;CAC/B,CAAC;CAAG;AAEL,kDAAkD;AAClD,MAAM,OAAO,iBAAkB,SAAQ,OAAO,CAAC,OAAO,EAAqC,CACzF,iCAAiC,CAClC;CAAG;AAEJ,8FAA8F;AAC9F,MAAM,OAAO,sBAAuB,SAAQ,MAAM,CAAC,WAAW,CAC5D,sCAAsC,CACvC,CAAC,wBAAwB,EAAE;IAC1B,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG"}
@@ -1,9 +1,13 @@
1
1
  import { Schema } from "effect";
2
+ /** GitHub's positive delivery ID, used as the cursor for newer webhook summaries (ADR 0014). */
2
3
  export declare const WebhookDeliveryId: Schema.brand<Schema.Int, "WebhookDeliveryId">;
3
4
  export type WebhookDeliveryId = typeof WebhookDeliveryId.Type;
4
5
  declare const WebhookDelivery_base: Schema.Class<WebhookDelivery, Schema.Struct<{
6
+ /** The delivery ID; retain the greatest processed ID as the cursor for the next summary read. */
5
7
  readonly id: Schema.brand<Schema.Int, "WebhookDeliveryId">;
8
+ /** The GitHub webhook event name, such as `issues` or `push`; no delivery payload is included. */
6
9
  readonly event: Schema.NonEmptyString;
10
+ /** The repository to refresh, or `None` for deliveries without a repository, such as a ping. */
7
11
  readonly repositoryId: Schema.OptionFromNullOr<Schema.brand<Schema.Int, "GitHubRepositoryId">>;
8
12
  }>, {}>;
9
13
  /** The summary fields used to request a repository refresh. */
@@ -1 +1 @@
1
- {"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../src/delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,eAAO,MAAM,iBAAiB,+CAE7B,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;;;;;;AAE9D,+DAA+D;AAC/D,qBAAa,eAAgB,SAAQ,oBAMpC;CAAG;AAEJ,eAAO,MAAM,sBAAsB;;EAElC,CAAC"}
1
+ {"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../src/delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,gGAAgG;AAChG,eAAO,MAAM,iBAAiB,+CAE7B,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;;IAK1D,iGAAiG;;IAEjG,kGAAkG;;IAElG,gGAAgG;;;AAPpG,+DAA+D;AAC/D,qBAAa,eAAgB,SAAQ,oBASpC;CAAG;AAEJ,eAAO,MAAM,sBAAsB;;EAElC,CAAC"}
package/dist/delivery.js CHANGED
@@ -1,10 +1,14 @@
1
1
  import { Schema } from "effect";
2
2
  import { RepositoryId } from "./installation.js";
3
+ /** GitHub's positive delivery ID, used as the cursor for newer webhook summaries (ADR 0014). */
3
4
  export const WebhookDeliveryId = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).pipe(Schema.brand("WebhookDeliveryId"));
4
5
  /** The summary fields used to request a repository refresh. */
5
6
  export class WebhookDelivery extends Schema.Class("@usine/github/WebhookDelivery")({
7
+ /** The delivery ID; retain the greatest processed ID as the cursor for the next summary read. */
6
8
  id: WebhookDeliveryId,
9
+ /** The GitHub webhook event name, such as `issues` or `push`; no delivery payload is included. */
7
10
  event: Schema.NonEmptyString,
11
+ /** The repository to refresh, or `None` for deliveries without a repository, such as a ping. */
8
12
  repositoryId: Schema.OptionFromNullOr(RepositoryId),
9
13
  }) {
10
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"delivery.js","sourceRoot":"","sources":["../src/delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CACtF,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAClC,CAAC;AAGF,+DAA+D;AAC/D,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,KAAK,CAAkB,+BAA+B,CAAC,CACjG;IACE,EAAE,EAAE,iBAAiB;IACrB,KAAK,EAAE,MAAM,CAAC,cAAc;IAC5B,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC;CACpD,CACF;CAAG;AAEJ,MAAM,CAAC,MAAM,sBAAsB,GAAG,eAAe,CAAC,IAAI,CACxD,MAAM,CAAC,UAAU,CAAC,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC,CACrD,CAAC"}
1
+ {"version":3,"file":"delivery.js","sourceRoot":"","sources":["../src/delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,gGAAgG;AAChG,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CACtF,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAClC,CAAC;AAGF,+DAA+D;AAC/D,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,KAAK,CAAkB,+BAA+B,CAAC,CACjG;IACE,iGAAiG;IACjG,EAAE,EAAE,iBAAiB;IACrB,kGAAkG;IAClG,KAAK,EAAE,MAAM,CAAC,cAAc;IAC5B,gGAAgG;IAChG,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC;CACpD,CACF;CAAG;AAEJ,MAAM,CAAC,MAAM,sBAAsB,GAAG,eAAe,CAAC,IAAI,CACxD,MAAM,CAAC,UAAU,CAAC,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC,CACrD,CAAC"}
package/dist/error.d.ts CHANGED
@@ -2,26 +2,34 @@ import { Schema } from "effect";
2
2
  import { InstallationDiscoveryError } from "./installation.ts";
3
3
  import { AppPermissionError } from "./access.ts";
4
4
  /** The GitHub request that failed, used by API, rate-limit, and response errors. */
5
- export declare const GitHubOperation: Schema.Literals<readonly ["create-repository-label", "discover-installation", "fetch-base-ref-head", "fetch-item-labels", "fetch-issue-snapshot", "fetch-item-timeline", "fetch-pull-request-snapshot", "find-missing-issues", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "poll-webhook-deliveries", "read-bot-account", "update-item-labels"]>;
5
+ export declare const GitHubOperation: Schema.Literals<readonly ["configure-webhook", "create-repository-label", "discover-installation", "fetch-base-ref-head", "fetch-item-labels", "fetch-issue-snapshot", "fetch-item-timeline", "fetch-pull-request-snapshot", "find-missing-issues", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "poll-webhook-deliveries", "read-bot-account", "update-item-labels"]>;
6
6
  export type GitHubOperation = typeof GitHubOperation.Type;
7
7
  declare const GitHubApiError_base: Schema.Class<GitHubApiError, Schema.TaggedStruct<"GitHubApiError", {
8
- readonly operation: Schema.Literals<readonly ["create-repository-label", "discover-installation", "fetch-base-ref-head", "fetch-item-labels", "fetch-issue-snapshot", "fetch-item-timeline", "fetch-pull-request-snapshot", "find-missing-issues", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "poll-webhook-deliveries", "read-bot-account", "update-item-labels"]>;
8
+ /** The GitHub operation that failed. */
9
+ readonly operation: Schema.Literals<readonly ["configure-webhook", "create-repository-label", "discover-installation", "fetch-base-ref-head", "fetch-item-labels", "fetch-issue-snapshot", "fetch-item-timeline", "fetch-pull-request-snapshot", "find-missing-issues", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "poll-webhook-deliveries", "read-bot-account", "update-item-labels"]>;
10
+ /** The HTTP response status, or `None` when transport failed before a response arrived. */
9
11
  readonly status: Schema.Option<Schema.Int>;
12
+ /** An operator-facing explanation; branch on the error tag and fields instead of matching this text. */
10
13
  readonly message: Schema.NonEmptyString;
11
14
  }>, import("effect/Cause").YieldableError>;
12
15
  /** A failed GitHub request, with the HTTP status if a response was received. */
13
16
  export declare class GitHubApiError extends GitHubApiError_base {
14
17
  }
15
18
  declare const GitHubRateLimitError_base: Schema.Class<GitHubRateLimitError, Schema.TaggedStruct<"GitHubRateLimitError", {
16
- readonly operation: Schema.Literals<readonly ["create-repository-label", "discover-installation", "fetch-base-ref-head", "fetch-item-labels", "fetch-issue-snapshot", "fetch-item-timeline", "fetch-pull-request-snapshot", "find-missing-issues", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "poll-webhook-deliveries", "read-bot-account", "update-item-labels"]>;
19
+ /** The GitHub operation that failed. */
20
+ readonly operation: Schema.Literals<readonly ["configure-webhook", "create-repository-label", "discover-installation", "fetch-base-ref-head", "fetch-item-labels", "fetch-issue-snapshot", "fetch-item-timeline", "fetch-pull-request-snapshot", "find-missing-issues", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "poll-webhook-deliveries", "read-bot-account", "update-item-labels"]>;
21
+ /** The earliest UTC retry time derived from GitHub's retry or rate-limit headers. */
17
22
  readonly retryAt: Schema.DateTimeUtc;
23
+ /** An operator-facing explanation; branch on the error tag and fields instead of matching this text. */
18
24
  readonly message: Schema.NonEmptyString;
19
25
  }>, import("effect/Cause").YieldableError>;
20
26
  /** The error when GitHub defers the request until `retryAt`. */
21
27
  export declare class GitHubRateLimitError extends GitHubRateLimitError_base {
22
28
  }
23
29
  declare const InvalidGitHubResponseError_base: Schema.Class<InvalidGitHubResponseError, Schema.TaggedStruct<"InvalidGitHubResponseError", {
24
- readonly operation: Schema.Literals<readonly ["create-repository-label", "discover-installation", "fetch-base-ref-head", "fetch-item-labels", "fetch-issue-snapshot", "fetch-item-timeline", "fetch-pull-request-snapshot", "find-missing-issues", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "poll-webhook-deliveries", "read-bot-account", "update-item-labels"]>;
30
+ /** The GitHub operation that failed. */
31
+ readonly operation: Schema.Literals<readonly ["configure-webhook", "create-repository-label", "discover-installation", "fetch-base-ref-head", "fetch-item-labels", "fetch-issue-snapshot", "fetch-item-timeline", "fetch-pull-request-snapshot", "find-missing-issues", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "poll-webhook-deliveries", "read-bot-account", "update-item-labels"]>;
32
+ /** An operator-facing explanation; branch on the error tag and fields instead of matching this text. */
25
33
  readonly message: Schema.NonEmptyString;
26
34
  /** The decode path, missing field, or GraphQL errors. */
27
35
  readonly detail: Schema.NonEmptyString;
@@ -30,12 +38,15 @@ declare const InvalidGitHubResponseError_base: Schema.Class<InvalidGitHubRespons
30
38
  export declare class InvalidGitHubResponseError extends InvalidGitHubResponseError_base {
31
39
  }
32
40
  declare const GitHubItemNotFoundError_base: Schema.Class<GitHubItemNotFoundError, Schema.TaggedStruct<"GitHubItemNotFoundError", {
33
- readonly operation: Schema.Literals<readonly ["create-repository-label", "discover-installation", "fetch-base-ref-head", "fetch-item-labels", "fetch-issue-snapshot", "fetch-item-timeline", "fetch-pull-request-snapshot", "find-missing-issues", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "poll-webhook-deliveries", "read-bot-account", "update-item-labels"]>;
41
+ /** The GitHub operation that failed. */
42
+ readonly operation: Schema.Literals<readonly ["configure-webhook", "create-repository-label", "discover-installation", "fetch-base-ref-head", "fetch-item-labels", "fetch-issue-snapshot", "fetch-item-timeline", "fetch-pull-request-snapshot", "find-missing-issues", "list-installation-repositories", "list-repository-labels", "mint-installation-token", "mint-worker-token", "poll-repository-changes", "poll-webhook-deliveries", "read-bot-account", "update-item-labels"]>;
43
+ /** The issue or pull request number that the responding repository could not return. */
34
44
  readonly item: Schema.Int;
45
+ /** An operator-facing explanation; branch on the error tag and fields instead of matching this text. */
35
46
  readonly message: Schema.NonEmptyString;
36
47
  }>, import("effect/Cause").YieldableError>;
37
48
  /**
38
- * The error when the repository has no Item with this number because it was deleted,
49
+ * The error when the repository has no item with this number because it was deleted,
39
50
  * transferred, or is no longer readable by the App. The repository itself responded.
40
51
  */
41
52
  export declare class GitHubItemNotFoundError extends GitHubItemNotFoundError_base {
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,oFAAoF;AACpF,eAAO,MAAM,eAAe,6aAiB1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;;;;;;AAE1D,gFAAgF;AAChF,qBAAa,cAAe,SAAQ,mBAMlC;CAAG;;;;;;AAEL,gEAAgE;AAChE,qBAAa,oBAAqB,SAAQ,yBAMxC;CAAG;;;;IAQH,yDAAyD;;;AAN3D,mFA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AQ9C,CAAC"}
package/dist/error.js CHANGED
@@ -3,6 +3,7 @@ import { InstallationDiscoveryError } from "./installation.js";
3
3
  import { AppPermissionError } from "./access.js";
4
4
  /** The GitHub request that failed, used by API, rate-limit, and response errors. */
5
5
  export const GitHubOperation = Schema.Literals([
6
+ "configure-webhook",
6
7
  "create-repository-label",
7
8
  "discover-installation",
8
9
  "fetch-base-ref-head",
@@ -22,33 +23,44 @@ export const GitHubOperation = Schema.Literals([
22
23
  ]);
23
24
  /** A failed GitHub request, with the HTTP status if a response was received. */
24
25
  export class GitHubApiError extends Schema.TaggedError("@usine/github/GitHubApiError")("GitHubApiError", {
26
+ /** The GitHub operation that failed. */
25
27
  operation: GitHubOperation,
28
+ /** The HTTP response status, or `None` when transport failed before a response arrived. */
26
29
  status: Schema.Option(Schema.Int),
30
+ /** An operator-facing explanation; branch on the error tag and fields instead of matching this text. */
27
31
  message: Schema.NonEmptyString,
28
32
  }) {
29
33
  }
30
34
  /** The error when GitHub defers the request until `retryAt`. */
31
35
  export class GitHubRateLimitError extends Schema.TaggedError("@usine/github/GitHubRateLimitError")("GitHubRateLimitError", {
36
+ /** The GitHub operation that failed. */
32
37
  operation: GitHubOperation,
38
+ /** The earliest UTC retry time derived from GitHub's retry or rate-limit headers. */
33
39
  retryAt: Schema.DateTimeUtc,
40
+ /** An operator-facing explanation; branch on the error tag and fields instead of matching this text. */
34
41
  message: Schema.NonEmptyString,
35
42
  }) {
36
43
  }
37
44
  /** The error when a GitHub response can't be decoded or lacks required content. */
38
45
  export class InvalidGitHubResponseError extends Schema.TaggedError("@usine/github/InvalidGitHubResponseError")("InvalidGitHubResponseError", {
46
+ /** The GitHub operation that failed. */
39
47
  operation: GitHubOperation,
48
+ /** An operator-facing explanation; branch on the error tag and fields instead of matching this text. */
40
49
  message: Schema.NonEmptyString,
41
50
  /** The decode path, missing field, or GraphQL errors. */
42
51
  detail: Schema.NonEmptyString,
43
52
  }) {
44
53
  }
45
54
  /**
46
- * The error when the repository has no Item with this number because it was deleted,
55
+ * The error when the repository has no item with this number because it was deleted,
47
56
  * transferred, or is no longer readable by the App. The repository itself responded.
48
57
  */
49
58
  export class GitHubItemNotFoundError extends Schema.TaggedError("@usine/github/GitHubItemNotFoundError")("GitHubItemNotFoundError", {
59
+ /** The GitHub operation that failed. */
50
60
  operation: GitHubOperation,
61
+ /** The issue or pull request number that the responding repository could not return. */
51
62
  item: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
63
+ /** An operator-facing explanation; branch on the error tag and fields instead of matching this text. */
52
64
  message: Schema.NonEmptyString,
53
65
  }) {
54
66
  }
package/dist/error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,oFAAoF;AACpF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC7C,yBAAyB;IACzB,uBAAuB;IACvB,qBAAqB;IACrB,mBAAmB;IACnB,sBAAsB;IACtB,qBAAqB;IACrB,6BAA6B;IAC7B,qBAAqB;IACrB,gCAAgC;IAChC,wBAAwB;IACxB,yBAAyB;IACzB,mBAAmB;IACnB,yBAAyB;IACzB,yBAAyB;IACzB,kBAAkB;IAClB,oBAAoB;CACrB,CAAC,CAAC;AAGH,gFAAgF;AAChF,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,WAAW,CACpD,8BAA8B,CAC/B,CAAC,gBAAgB,EAAE;IAClB,SAAS,EAAE,eAAe;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG;A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I,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,IAAI,IAAI,GAAG,GAAG,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,CAAC;IAC5F,oBAAoB,EAAE,GAAG,EAAE,CAAC,KAAK;IACjC,0BAA0B,EAAE,GAAG,EAAE,CAAC,KAAK;CACxC,CAAC,CAAC"}
@@ -9,31 +9,55 @@ import { type GitHubAppError } from "./error.ts";
9
9
  import { Installation, InstallationToken } from "./installation.ts";
10
10
  import { WebhookDelivery, WebhookDeliveryId } from "./delivery.ts";
11
11
  declare const GitHubApp_base: Context.ServiceClass<GitHubApp, "@usine/github/GitHubApp", {
12
- /** Reads new delivery summaries, newest first, with at most ten pages per call. */
12
+ /** Sets the App's webhook URL and JSON encoding; the App must already have an active webhook. */
13
+ readonly configureWebhook: (url: URL) => Effect.Effect<void, GitHubAppError>;
14
+ /**
15
+ * Reads delivery summaries with IDs greater than `after`, newest first. Pass `None` for
16
+ * the first read. Reads at most ten pages of 100 summaries and drops older hints at that
17
+ * limit; polling still detects repository changes (ADR 0014).
18
+ */
13
19
  readonly deliveries: (after: Option.Option<WebhookDeliveryId>) => Effect.Effect<ReadonlyArray<WebhookDelivery>, GitHubAppError>;
20
+ /** Lists every repository accessible to the installation, following all pages. */
14
21
  readonly repositories: () => Effect.Effect<ReadonlyArray<RepositoryName>, GitHubAppError>;
15
- /** Returns the App installation after checking its required permissions. */
22
+ /**
23
+ * Returns the single active installation after checking its required permissions.
24
+ * Shares discovery and token renewal with `installationToken`; missing, multiple, or
25
+ * suspended installations fail with `InstallationDiscoveryError`.
26
+ */
16
27
  readonly installation: () => Effect.Effect<Installation, GitHubAppError>;
17
28
  /**
18
29
  * Returns the App's bot account, `<slug>[bot]`, read from GitHub's users API once per App
19
30
  * slug.
20
31
  */
21
32
  readonly botAccount: () => Effect.Effect<BotAccount, GitHubAppError>;
22
- /** Returns the shared installation-wide token for orchestrator operations, renewing it near expiry. */
33
+ /**
34
+ * Returns the shared installation-wide token for orchestrator operations. Renews it when
35
+ * five minutes or less remain, sharing one discovery and mint across concurrent callers.
36
+ */
23
37
  readonly installationToken: () => Effect.Effect<InstallationToken, GitHubAppError>;
24
- /** Returns the access of every registry repository, with each uncovered Project as its own error. */
38
+ /**
39
+ * Checks `registry` against all installation repositories, matching names without case
40
+ * sensitivity. Returns one result per registry entry in input order; an uncovered
41
+ * repository is a `ProjectNotInstalledError` value, not a failed effect (ADR 0011).
42
+ */
25
43
  readonly projectAccess: (registry: ReadonlyArray<RepositoryName>) => Effect.Effect<ReadonlyArray<ProjectAccess>, GitHubAppError>;
26
44
  /**
27
- * Mints a new Worker token for the covered Project's repository, with the permissions
28
- * `WORKER_TOKEN_PERMISSIONS` lists for the Loop permission level.
45
+ * Mints a new token for `project` on every call, using `permissions` to select the loop's
46
+ * `WORKER_TOKEN_PERMISSIONS` (ADR 0011). Fails with `InvalidGitHubResponseError` if GitHub
47
+ * does not confirm exactly the covered repository ID or returns an invalid expiry.
29
48
  */
30
49
  readonly workerToken: (project: CoveredProject, permissions: LoopPermissions) => Effect.Effect<InstallationToken, GitHubAppError>;
31
50
  }>;
32
51
  /**
33
- * The factory's GitHub App identity and repository access. Orchestrator operations share an
34
- * installation-wide token; each Worker token is minted for its Attempt's repository.
52
+ * The instance's GitHub App identity and repository access. Orchestrator operations share an
53
+ * installation-wide token; each worker token is minted for its attempt's repository.
35
54
  */
36
55
  export declare class GitHubApp extends GitHubApp_base {
56
+ /**
57
+ * Provides App operations using the supplied credentials and HTTP client. Imports the signing
58
+ * key during construction, which can fail with `AppAuthenticationError`; installation
59
+ * discovery and token minting occur on demand.
60
+ */
37
61
  static readonly layer: Layer.Layer<GitHubApp, AppAuthenticationError, GitHubCredentials | HttpClient.HttpClient>;
38
62
  }
39
63
  export { REQUIRED_REPOSITORY_PERMISSIONS, WORKER_TOKEN_PERMISSIONS, deriveProjectAccess, missingPermissions, type InstalledRepository, type RequiredRepositoryPermission, CoveredProject, ProjectNotInstalledError, ProjectAccess, AppPermissionError, } from "./access.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"github-app.d.ts","sourceRoot":"","sources":["../src/github-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAuB,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAEL,OAAO,EAEP,MAAM,EACN,KAAK,EACL,MAAM,EAIP,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,UAAU,EAAyC,MAAM,aAAa,CAAC;AAWhF,OAAO,EAAE,KAAK,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAEL,KAAK,cAAc,EAEnB,KAAK,aAAa,EAKnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,YAAY,EAGZ,iBAAiB,EAKlB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAA0B,MAAM,eAAe,CAAC;;IAgEvF,mFAAmF;yBAC9D,CACnB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,KACpC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC;2BAC3C,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzF,4EAA4E;2BACrD,MAAM,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC;IACxE;;;OAGG;yBACkB,MAAM,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC;IACpE,uGAAuG;gCAC3E,MAAM,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC;IAClF,qGAAqG;4BAC7E,CAC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C,aAAa,CAAC,EAAE,cAAc,CAAC;IAChE;;;;OAIG;0BACmB,CACpB,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,eAAe,KACzB,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC;;AAnDzD;;;GAGG;AACH,qBAAa,SAAU,SAAQ,cAiDD;IAC5B;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAChC,SAAS,EACT,sBAAsB,EACtB,iBAAiB,GAAG,UAAU,CAAC,UAAU,CAC1C,CAoTC;CACH;AAED,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EACjC,cAAc,EACd,wBAAwB,EACxB,aAAa,EACb,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,OAAO,EACP,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,cAAc,EACd,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
@@ -50,10 +50,15 @@ const mintPlan = (scope) => scope._tag === "InstallationWide"
50
50
  },
51
51
  };
52
52
  /**
53
- * The factory's GitHub App identity and repository access. Orchestrator operations share an
54
- * installation-wide token; each Worker token is minted for its Attempt's repository.
53
+ * The instance's GitHub App identity and repository access. Orchestrator operations share an
54
+ * installation-wide token; each worker token is minted for its attempt's repository.
55
55
  */
56
56
  export class GitHubApp extends Context.Service()("@usine/github/GitHubApp") {
57
+ /**
58
+ * Provides App operations using the supplied credentials and HTTP client. Imports the signing
59
+ * key during construction, which can fail with `AppAuthenticationError`; installation
60
+ * discovery and token minting occur on demand.
61
+ */
57
62
  static layer = Layer.effect(GitHubApp, Effect.gen(function* () {
58
63
  const credentials = yield* GitHubCredentials;
59
64
  const sign = yield* appJwtSigner(credentials);
@@ -227,6 +232,14 @@ export class GitHubApp extends Context.Service()("@usine/github/GitHubApp") {
227
232
  return stored;
228
233
  })));
229
234
  return {
235
+ configureWebhook: Effect.fn("GitHubApp.configureWebhook")(function* (url) {
236
+ yield* Effect.annotateCurrentSpan({ appId: credentials.appId });
237
+ const jwt = yield* sign();
238
+ yield* fetchResponse("configure-webhook", HttpClientRequest.patch(`${API_ROOT}/app/hook/config`).pipe(HttpClientRequest.bodyJsonUnsafe({ url: url.href, content_type: "json" }), authorized(jwt)));
239
+ yield* Effect.logInfo("Configured the App webhook endpoint", {
240
+ appId: credentials.appId,
241
+ });
242
+ }),
230
243
  deliveries,
231
244
  repositories: Effect.fn("GitHubApp.repositories")(function* () {
232
245
  const { token, installation } = yield* lease();