@alchemy.run/pkg 0.0.0-placeholder → 2.0.0-beta.78

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 (70) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +5 -0
  3. package/README.md +117 -0
  4. package/dist/Manifest.d.ts +107 -0
  5. package/dist/Manifest.d.ts.map +1 -0
  6. package/dist/Manifest.js +58 -0
  7. package/dist/Manifest.js.map +1 -0
  8. package/dist/Protocol.d.ts +186 -0
  9. package/dist/Protocol.d.ts.map +1 -0
  10. package/dist/Protocol.js +115 -0
  11. package/dist/Protocol.js.map +1 -0
  12. package/dist/Registry/Bindings.d.ts +134 -0
  13. package/dist/Registry/Bindings.d.ts.map +1 -0
  14. package/dist/Registry/Bindings.js +92 -0
  15. package/dist/Registry/Bindings.js.map +1 -0
  16. package/dist/Registry/GitHub.d.ts +96 -0
  17. package/dist/Registry/GitHub.d.ts.map +1 -0
  18. package/dist/Registry/GitHub.js +226 -0
  19. package/dist/Registry/GitHub.js.map +1 -0
  20. package/dist/Registry/Handler.d.ts +53 -0
  21. package/dist/Registry/Handler.d.ts.map +1 -0
  22. package/dist/Registry/Handler.js +375 -0
  23. package/dist/Registry/Handler.js.map +1 -0
  24. package/dist/Registry/KVCache.d.ts +24 -0
  25. package/dist/Registry/KVCache.d.ts.map +1 -0
  26. package/dist/Registry/KVCache.js +42 -0
  27. package/dist/Registry/KVCache.js.map +1 -0
  28. package/dist/Registry/Sweep.d.ts +12 -0
  29. package/dist/Registry/Sweep.d.ts.map +1 -0
  30. package/dist/Registry/Sweep.js +69 -0
  31. package/dist/Registry/Sweep.js.map +1 -0
  32. package/dist/Registry/Tags.d.ts +49 -0
  33. package/dist/Registry/Tags.d.ts.map +1 -0
  34. package/dist/Registry/Tags.js +80 -0
  35. package/dist/Registry/Tags.js.map +1 -0
  36. package/dist/Registry.d.ts +378 -0
  37. package/dist/Registry.d.ts.map +1 -0
  38. package/dist/Registry.js +119 -0
  39. package/dist/Registry.js.map +1 -0
  40. package/dist/cli/bin.d.ts +18 -0
  41. package/dist/cli/bin.d.ts.map +1 -0
  42. package/dist/cli/bin.js +33 -0
  43. package/dist/cli/bin.js.map +1 -0
  44. package/dist/cli/pack.d.ts +169 -0
  45. package/dist/cli/pack.d.ts.map +1 -0
  46. package/dist/cli/pack.js +447 -0
  47. package/dist/cli/pack.js.map +1 -0
  48. package/dist/cli/publish.d.ts +33 -0
  49. package/dist/cli/publish.d.ts.map +1 -0
  50. package/dist/cli/publish.js +76 -0
  51. package/dist/cli/publish.js.map +1 -0
  52. package/dist/index.d.ts +3 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/dist/index.js +6 -0
  55. package/dist/index.js.map +1 -0
  56. package/migrations/0001_init.sql +19 -0
  57. package/package.json +89 -1
  58. package/src/Manifest.ts +76 -0
  59. package/src/Protocol.ts +163 -0
  60. package/src/Registry/Bindings.ts +134 -0
  61. package/src/Registry/GitHub.ts +365 -0
  62. package/src/Registry/Handler.ts +549 -0
  63. package/src/Registry/KVCache.ts +68 -0
  64. package/src/Registry/Sweep.ts +117 -0
  65. package/src/Registry/Tags.ts +117 -0
  66. package/src/Registry.ts +197 -0
  67. package/src/cli/bin.ts +101 -0
  68. package/src/cli/pack.ts +603 -0
  69. package/src/cli/publish.ts +129 -0
  70. package/src/index.ts +5 -0
@@ -0,0 +1,186 @@
1
+ import * as Schema from "effect/Schema";
2
+ import * as HttpApi from "effect/unstable/httpapi/HttpApi";
3
+ import * as HttpApiEndpoint from "effect/unstable/httpapi/HttpApiEndpoint";
4
+ import * as HttpApiGroup from "effect/unstable/httpapi/HttpApiGroup";
5
+ /**
6
+ * The HTTP contract between the `pkg` CLI and the registry Worker, as an
7
+ * `HttpApi`. The Worker implements it with `HttpApiBuilder`; the CLI calls
8
+ * it through `HttpApiClient`. Importing this file pulls in no runtime code.
9
+ */
10
+ /**
11
+ * The GitHub Actions run a request comes from. It is a lookup hint, not a
12
+ * credential: the registry resolves the run through the GitHub API and
13
+ * trusts only what GitHub says about it.
14
+ */
15
+ export declare const RunRef: Schema.Struct<{
16
+ readonly repo: Schema.String;
17
+ readonly runId: Schema.Number;
18
+ readonly attempt: Schema.Number;
19
+ }>;
20
+ export type RunRef = typeof RunRef.Type;
21
+ /**
22
+ * Name of the artifact a job uploads to its own run to vouch for a manifest.
23
+ * Only the job holds the runtime token that can add artifacts to the run, so
24
+ * an artifact carrying the manifest's hash is GitHub's record that this run
25
+ * approved exactly these package hashes.
26
+ */
27
+ export declare const manifestArtifactName: (sha256: string) => string;
28
+ /** Lowercase hex SHA-256. */
29
+ export declare const Sha256: Schema.String;
30
+ export declare const TarballRef: Schema.Struct<{
31
+ readonly name: Schema.String;
32
+ readonly sha256: Schema.String;
33
+ }>;
34
+ export type TarballRef = typeof TarballRef.Type;
35
+ declare const BadRequest_base: Schema.Class<BadRequest, Schema.TaggedStruct<"BadRequest", {
36
+ readonly message: Schema.String;
37
+ }>, import("effect/Cause").YieldableError>;
38
+ /** The request names no usable run, or carries an invalid body. */
39
+ export declare class BadRequest extends BadRequest_base {
40
+ }
41
+ declare const Forbidden_base: Schema.Class<Forbidden, Schema.TaggedStruct<"Forbidden", {
42
+ readonly message: Schema.String;
43
+ }>, import("effect/Cause").YieldableError>;
44
+ /** The repository may not publish, or the run has not vouched for the manifest. */
45
+ export declare class Forbidden extends Forbidden_base {
46
+ }
47
+ declare const RunNotInProgress_base: Schema.Class<RunNotInProgress, Schema.TaggedStruct<"RunNotInProgress", {
48
+ readonly message: Schema.String;
49
+ }>, import("effect/Cause").YieldableError>;
50
+ /** Requests come from inside a run, so a finished run cannot publish. */
51
+ export declare class RunNotInProgress extends RunNotInProgress_base {
52
+ }
53
+ declare const MissingTarballs_base: Schema.Class<MissingTarballs, Schema.TaggedStruct<"MissingTarballs", {
54
+ readonly missing: Schema.$Array<Schema.Struct<{
55
+ readonly name: Schema.String;
56
+ readonly sha256: Schema.String;
57
+ }>>;
58
+ }>, import("effect/Cause").YieldableError>;
59
+ /** Upload these, then publish again. */
60
+ export declare class MissingTarballs extends MissingTarballs_base {
61
+ }
62
+ declare const PackageTooLarge_base: Schema.Class<PackageTooLarge, Schema.TaggedStruct<"PackageTooLarge", {
63
+ readonly message: Schema.String;
64
+ }>, import("effect/Cause").YieldableError>;
65
+ export declare class PackageTooLarge extends PackageTooLarge_base {
66
+ }
67
+ declare const Upstream_base: Schema.Class<Upstream, Schema.TaggedStruct<"Upstream", {
68
+ readonly message: Schema.String;
69
+ }>, import("effect/Cause").YieldableError>;
70
+ /** GitHub could not be reached or answered with an error. */
71
+ export declare class Upstream extends Upstream_base {
72
+ }
73
+ export declare const PublishedPackage: Schema.Struct<{
74
+ readonly name: Schema.String;
75
+ readonly group: Schema.String;
76
+ /** Install URL pinned to the commit. */
77
+ readonly url: Schema.String;
78
+ readonly tags: Schema.$Array<Schema.String>;
79
+ }>;
80
+ export type PublishedPackage = typeof PublishedPackage.Type;
81
+ export declare const PublishResponse: Schema.Struct<{
82
+ readonly packages: Schema.$Array<Schema.Struct<{
83
+ readonly name: Schema.String;
84
+ readonly group: Schema.String;
85
+ /** Install URL pinned to the commit. */
86
+ readonly url: Schema.String;
87
+ readonly tags: Schema.$Array<Schema.String>;
88
+ }>>;
89
+ }>;
90
+ export type PublishResponse = typeof PublishResponse.Type;
91
+ /**
92
+ * `manifest` is the exact `pkg-manifest.json` text the job vouched for; its
93
+ * SHA-256 must match an artifact on the run. Idempotent: the registry
94
+ * either fails with {@link MissingTarballs} or writes the tags.
95
+ */
96
+ export declare const publish: HttpApiEndpoint.HttpApiEndpoint<"publish", "POST", "/api/publish", never, never, Schema.toCodecJson<Schema.Struct<{
97
+ readonly run: Schema.Struct<{
98
+ readonly repo: Schema.String;
99
+ readonly runId: Schema.Number;
100
+ readonly attempt: Schema.Number;
101
+ }>;
102
+ readonly manifest: Schema.String;
103
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
104
+ readonly packages: Schema.$Array<Schema.Struct<{
105
+ readonly name: Schema.String;
106
+ readonly group: Schema.String;
107
+ /** Install URL pinned to the commit. */
108
+ readonly url: Schema.String;
109
+ readonly tags: Schema.$Array<Schema.String>;
110
+ }>>;
111
+ }>>, Schema.toCodecJson<typeof BadRequest | typeof Forbidden | typeof RunNotInProgress | typeof MissingTarballs | typeof PackageTooLarge | typeof Upstream>, never, never>;
112
+ export declare const TarballResponse: Schema.Struct<{
113
+ readonly name: Schema.String;
114
+ readonly sha256: Schema.String;
115
+ readonly size: Schema.Number;
116
+ readonly uploaded: Schema.Boolean;
117
+ }>;
118
+ export type TarballResponse = typeof TarballResponse.Type;
119
+ /**
120
+ * Content-addressed upload. Any in-progress run of an allowed repository
121
+ * may upload; bytes only become reachable once a vouched manifest tags
122
+ * them. The run travels in the query because the body is the tarball.
123
+ */
124
+ export declare const uploadTarball: HttpApiEndpoint.HttpApiEndpoint<"uploadTarball", "PUT", "/api/tarballs/:name/:sha256", Schema.toCodecStringTree<Schema.Struct<{
125
+ readonly name: Schema.String;
126
+ readonly sha256: Schema.String;
127
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
128
+ readonly repo: Schema.String;
129
+ readonly runId: Schema.Number;
130
+ readonly attempt: Schema.Number;
131
+ }>>, Schema.toCodecJson<Schema.Uint8Array>, never, Schema.toCodecJson<Schema.Struct<{
132
+ readonly name: Schema.String;
133
+ readonly sha256: Schema.String;
134
+ readonly size: Schema.Number;
135
+ readonly uploaded: Schema.Boolean;
136
+ }>>, Schema.toCodecJson<typeof BadRequest | typeof Forbidden | typeof RunNotInProgress | typeof PackageTooLarge | typeof Upstream>, never, never>;
137
+ export declare const health: HttpApiEndpoint.HttpApiEndpoint<"health", "GET", "/api/health", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
138
+ readonly ok: Schema.Boolean;
139
+ }>>, never, never, never>;
140
+ declare const Registry_base: HttpApiGroup.HttpApiGroup<"Registry", HttpApiEndpoint.HttpApiEndpoint<"publish", "POST", "/api/publish", never, never, Schema.toCodecJson<Schema.Struct<{
141
+ readonly run: Schema.Struct<{
142
+ readonly repo: Schema.String;
143
+ readonly runId: Schema.Number;
144
+ readonly attempt: Schema.Number;
145
+ }>;
146
+ readonly manifest: Schema.String;
147
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
148
+ readonly packages: Schema.$Array<Schema.Struct<{
149
+ readonly name: Schema.String;
150
+ readonly group: Schema.String;
151
+ /** Install URL pinned to the commit. */
152
+ readonly url: Schema.String;
153
+ readonly tags: Schema.$Array<Schema.String>;
154
+ }>>;
155
+ }>>, Schema.toCodecJson<typeof BadRequest | typeof Forbidden | typeof RunNotInProgress | typeof MissingTarballs | typeof PackageTooLarge | typeof Upstream>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"uploadTarball", "PUT", "/api/tarballs/:name/:sha256", Schema.toCodecStringTree<Schema.Struct<{
156
+ readonly name: Schema.String;
157
+ readonly sha256: Schema.String;
158
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
159
+ readonly repo: Schema.String;
160
+ readonly runId: Schema.Number;
161
+ readonly attempt: Schema.Number;
162
+ }>>, Schema.toCodecJson<Schema.Uint8Array>, never, Schema.toCodecJson<Schema.Struct<{
163
+ readonly name: Schema.String;
164
+ readonly sha256: Schema.String;
165
+ readonly size: Schema.Number;
166
+ readonly uploaded: Schema.Boolean;
167
+ }>>, Schema.toCodecJson<typeof BadRequest | typeof Forbidden | typeof RunNotInProgress | typeof PackageTooLarge | typeof Upstream>, never, never>, false>;
168
+ export declare class Registry extends Registry_base {
169
+ }
170
+ declare const Health_base: HttpApiGroup.HttpApiGroup<"Health", HttpApiEndpoint.HttpApiEndpoint<"health", "GET", "/api/health", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
171
+ readonly ok: Schema.Boolean;
172
+ }>>, never, never, never>, false>;
173
+ export declare class Health extends Health_base {
174
+ }
175
+ declare const PkgApi_base: HttpApi.HttpApi<"Pkg", typeof Registry | typeof Health>;
176
+ export declare class PkgApi extends PkgApi_base {
177
+ }
178
+ /**
179
+ * Immutable tarball URL on the registry. Dependencies between packed
180
+ * packages link to these, so a tarball's bytes depend only on its own
181
+ * source and its dependencies' bytes, never on a commit, and identical
182
+ * builds deduplicate across commits, pull requests, and repositories.
183
+ */
184
+ export declare const tarballUrl: (registry: string, name: string, sha256: string) => string;
185
+ export {};
186
+ //# sourceMappingURL=Protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../src/Protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,eAAe,MAAM,yCAAyC,CAAC;AAC3E,OAAO,KAAK,YAAY,MAAM,sCAAsC,CAAC;AAIrE;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,MAAM;;;;EAIjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,WAAY,MAAM,WACzB,CAAC;AAE3B,6BAA6B;AAC7B,eAAO,MAAM,MAAM,eAElB,CAAC;AAEF,eAAO,MAAM,UAAU;;;EAGrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;;;;AAEhD,mEAAmE;AACnE,qBAAa,UAAW,SAAQ,eAI/B;CAAG;;;;AAEJ,mFAAmF;AACnF,qBAAa,SAAU,SAAQ,cAI9B;CAAG;;;;AAEJ,yEAAyE;AACzE,qBAAa,gBAAiB,SAAQ,qBAIrC;CAAG;;;;;;;AAEJ,wCAAwC;AACxC,qBAAa,eAAgB,SAAQ,oBAIpC;CAAG;;;;AAEJ,qBAAa,eAAgB,SAAQ,oBAIpC;CAAG;;;;AAEJ,6DAA6D;AAC7D,qBAAa,QAAS,SAAQ,aAI7B;CAAG;AAEJ,eAAO,MAAM,gBAAgB;;;IAG3B,wCAAwC;;;EAGxC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAC;AAE5D,eAAO,MAAM,eAAe;;;;QAN1B,wCAAwC;;;;EAQxC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;QAhBlB,wCAAwC;;;;0KA2BxC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;EAK1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;iJAUzB,CAAC;AAEF,eAAO,MAAM,MAAM;;yBAEjB,CAAC;;;;;;;;;;;;QAxDD,wCAAwC;;;;;;;;;;;;;;;;;AA0D1C,qBAAa,QAAS,SAAQ,aAET;CAAG;;;;AAExB,qBAAa,MAAO,SAAQ,WAAuC;CAAG;;AAEtE,qBAAa,MAAO,SAAQ,WAA6C;CAAG;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,UAAU,aAAc,MAAM,QAAQ,MAAM,UAAU,MAAM,WACd,CAAC"}
@@ -0,0 +1,115 @@
1
+ import * as Schema from "effect/Schema";
2
+ import * as HttpApi from "effect/unstable/httpapi/HttpApi";
3
+ import * as HttpApiEndpoint from "effect/unstable/httpapi/HttpApiEndpoint";
4
+ import * as HttpApiGroup from "effect/unstable/httpapi/HttpApiGroup";
5
+ import * as HttpApiSchema from "effect/unstable/httpapi/HttpApiSchema";
6
+ import { PackageName } from "./Manifest.js";
7
+ /**
8
+ * The HTTP contract between the `pkg` CLI and the registry Worker, as an
9
+ * `HttpApi`. The Worker implements it with `HttpApiBuilder`; the CLI calls
10
+ * it through `HttpApiClient`. Importing this file pulls in no runtime code.
11
+ */
12
+ /**
13
+ * The GitHub Actions run a request comes from. It is a lookup hint, not a
14
+ * credential: the registry resolves the run through the GitHub API and
15
+ * trusts only what GitHub says about it.
16
+ */
17
+ export const RunRef = Schema.Struct({
18
+ repo: Schema.String,
19
+ runId: Schema.Number,
20
+ attempt: Schema.Number,
21
+ });
22
+ /**
23
+ * Name of the artifact a job uploads to its own run to vouch for a manifest.
24
+ * Only the job holds the runtime token that can add artifacts to the run, so
25
+ * an artifact carrying the manifest's hash is GitHub's record that this run
26
+ * approved exactly these package hashes.
27
+ */
28
+ export const manifestArtifactName = (sha256) => `pkg-manifest-${sha256}`;
29
+ /** Lowercase hex SHA-256. */
30
+ export const Sha256 = Schema.String.pipe(Schema.check(Schema.isPattern(/^[a-f0-9]{64}$/)));
31
+ export const TarballRef = Schema.Struct({
32
+ name: PackageName,
33
+ sha256: Sha256,
34
+ });
35
+ /** The request names no usable run, or carries an invalid body. */
36
+ export class BadRequest extends Schema.TaggedError()("BadRequest", { message: Schema.String }, { httpApiStatus: 400 }) {
37
+ }
38
+ /** The repository may not publish, or the run has not vouched for the manifest. */
39
+ export class Forbidden extends Schema.TaggedError()("Forbidden", { message: Schema.String }, { httpApiStatus: 403 }) {
40
+ }
41
+ /** Requests come from inside a run, so a finished run cannot publish. */
42
+ export class RunNotInProgress extends Schema.TaggedError()("RunNotInProgress", { message: Schema.String }, { httpApiStatus: 409 }) {
43
+ }
44
+ /** Upload these, then publish again. */
45
+ export class MissingTarballs extends Schema.TaggedError()("MissingTarballs", { missing: Schema.Array(TarballRef) }, { httpApiStatus: 409 }) {
46
+ }
47
+ export class PackageTooLarge extends Schema.TaggedError()("PackageTooLarge", { message: Schema.String }, { httpApiStatus: 413 }) {
48
+ }
49
+ /** GitHub could not be reached or answered with an error. */
50
+ export class Upstream extends Schema.TaggedError()("Upstream", { message: Schema.String }, { httpApiStatus: 502 }) {
51
+ }
52
+ export const PublishedPackage = Schema.Struct({
53
+ name: Schema.String,
54
+ group: Schema.String,
55
+ /** Install URL pinned to the commit. */
56
+ url: Schema.String,
57
+ tags: Schema.Array(Schema.String),
58
+ });
59
+ export const PublishResponse = Schema.Struct({
60
+ packages: Schema.Array(PublishedPackage),
61
+ });
62
+ /**
63
+ * `manifest` is the exact `pkg-manifest.json` text the job vouched for; its
64
+ * SHA-256 must match an artifact on the run. Idempotent: the registry
65
+ * either fails with {@link MissingTarballs} or writes the tags.
66
+ */
67
+ export const publish = HttpApiEndpoint.post("publish", "/api/publish", {
68
+ payload: Schema.Struct({ run: RunRef, manifest: Schema.String }),
69
+ success: PublishResponse,
70
+ error: [
71
+ BadRequest,
72
+ Forbidden,
73
+ RunNotInProgress,
74
+ MissingTarballs,
75
+ PackageTooLarge,
76
+ Upstream,
77
+ ],
78
+ });
79
+ export const TarballResponse = Schema.Struct({
80
+ name: Schema.String,
81
+ sha256: Sha256,
82
+ size: Schema.Number,
83
+ uploaded: Schema.Boolean,
84
+ });
85
+ /**
86
+ * Content-addressed upload. Any in-progress run of an allowed repository
87
+ * may upload; bytes only become reachable once a vouched manifest tags
88
+ * them. The run travels in the query because the body is the tarball.
89
+ */
90
+ export const uploadTarball = HttpApiEndpoint.put("uploadTarball", "/api/tarballs/:name/:sha256", {
91
+ params: TarballRef,
92
+ query: RunRef,
93
+ payload: Schema.Uint8Array.pipe(HttpApiSchema.asUint8Array()),
94
+ success: TarballResponse,
95
+ error: [BadRequest, Forbidden, RunNotInProgress, PackageTooLarge, Upstream],
96
+ });
97
+ export const health = HttpApiEndpoint.get("health", "/api/health", {
98
+ success: Schema.Struct({ ok: Schema.Boolean }),
99
+ });
100
+ export class Registry extends HttpApiGroup.make("Registry")
101
+ .add(publish)
102
+ .add(uploadTarball) {
103
+ }
104
+ export class Health extends HttpApiGroup.make("Health").add(health) {
105
+ }
106
+ export class PkgApi extends HttpApi.make("Pkg").add(Registry).add(Health) {
107
+ }
108
+ /**
109
+ * Immutable tarball URL on the registry. Dependencies between packed
110
+ * packages link to these, so a tarball's bytes depend only on its own
111
+ * source and its dependencies' bytes, never on a commit, and identical
112
+ * builds deduplicate across commits, pull requests, and repositories.
113
+ */
114
+ export const tarballUrl = (registry, name, sha256) => `${registry.replace(/\/+$/, "")}/${name}/-/${sha256}.tgz`;
115
+ //# sourceMappingURL=Protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Protocol.js","sourceRoot":"","sources":["../src/Protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,eAAe,MAAM,yCAAyC,CAAC;AAC3E,OAAO,KAAK,YAAY,MAAM,sCAAsC,CAAC;AACrE,OAAO,KAAK,aAAa,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC,CAAC;AAGH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAE,EAAE,CACrD,gBAAgB,MAAM,EAAE,CAAC;AAE3B,6BAA6B;AAC7B,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CACtC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,MAAM;CACf,CAAC,CAAC;AAGH,mEAAmE;AACnE,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,WAAW,EAAc,CAC9D,YAAY,EACZ,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,EAC1B,EAA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AAC;CAC/C,CAAC,CAAC;AAEH,MAAM,OAAO,QAAS,SAAQ,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;KACxD,GAAG,CAAC,OAAO,CAAC;KACZ,GAAG,CAAC,aAAa,CAAC;CAAG;AAExB,MAAM,OAAO,MAAO,SAAQ,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;CAAG;AAEtE,MAAM,OAAO,MAAO,SAAQ,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;CAAG;AAE5E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAE,MAAc,EAAE,EAAE,CAC3E,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,IAAI,MAAM,MAAM,MAAM,CAAC"}
@@ -0,0 +1,134 @@
1
+ import * as Cloudflare from "alchemy/Cloudflare";
2
+ import type * as Config from "effect/Config";
3
+ import * as Context from "effect/Context";
4
+ import * as Duration from "effect/Duration";
5
+ import type * as Redacted from "effect/Redacted";
6
+ import * as Schema from "effect/Schema";
7
+ /**
8
+ * What the registry Worker binds: its three resources, the settings binding
9
+ * that carries the policy into the isolate, and the credential bindings.
10
+ * Shared by `Registry.ts` (which declares the Worker) and the runtime
11
+ * modules in this folder.
12
+ */
13
+ /**
14
+ * Registry policy. The `Type` side is what the Worker runs against
15
+ * (`Duration`, `ByteSize`); the `Encoded` side is plain JSON, which is how
16
+ * the policy crosses into the isolate as a Worker binding.
17
+ */
18
+ export declare const Policy: Schema.Struct<{
19
+ /**
20
+ * Repositories allowed to publish, as `owner/name`. A publication may
21
+ * contain any package; every package gets the commit, short commit,
22
+ * `branch:` and `pr:` tags of the run that produced it.
23
+ */
24
+ readonly repos: Schema.$Array<Schema.String>;
25
+ /**
26
+ * How long a publication lives: from the push for branch publications,
27
+ * from close or merge for pull request publications. Publishing the same
28
+ * content again refreshes the clock.
29
+ */
30
+ readonly ttl: Schema.DurationFromMillis;
31
+ /** Upper bound on a single tarball. Absent means unlimited. */
32
+ readonly maxPackageSize: Schema.optionalKey<Schema.ByteSizeFromNumber>;
33
+ }>;
34
+ export type Policy = typeof Policy.Type;
35
+ /**
36
+ * Everything the Worker needs that is plain data. Encoded into the
37
+ * {@link SETTINGS_ENV} binding at deploy time and decoded back inside the
38
+ * isolate, so the deploy-time and runtime views of the registry are the
39
+ * same value by construction.
40
+ */
41
+ export declare const Settings: Schema.Struct<{
42
+ readonly policy: Schema.Struct<{
43
+ /**
44
+ * Repositories allowed to publish, as `owner/name`. A publication may
45
+ * contain any package; every package gets the commit, short commit,
46
+ * `branch:` and `pr:` tags of the run that produced it.
47
+ */
48
+ readonly repos: Schema.$Array<Schema.String>;
49
+ /**
50
+ * How long a publication lives: from the push for branch publications,
51
+ * from close or merge for pull request publications. Publishing the same
52
+ * content again refreshes the clock.
53
+ */
54
+ readonly ttl: Schema.DurationFromMillis;
55
+ /** Upper bound on a single tarball. Absent means unlimited. */
56
+ readonly maxPackageSize: Schema.optionalKey<Schema.ByteSizeFromNumber>;
57
+ }>;
58
+ /**
59
+ * Hostname to package scope. Requests on an aliased host resolve an
60
+ * unscoped name under that scope, so `pkg.distilled.cloud/core/<sha>`
61
+ * serves `@distilled.cloud/core`.
62
+ */
63
+ readonly aliases: Schema.$Record<Schema.String, Schema.String>;
64
+ /** Cron expression for the expiry sweep. */
65
+ readonly cron: Schema.String;
66
+ readonly github: Schema.Struct<{
67
+ readonly apiUrl: Schema.String;
68
+ }>;
69
+ }>;
70
+ export type Settings = typeof Settings.Type;
71
+ /**
72
+ * Worker props the registry forwards verbatim. `main`, `env`, and `crons`
73
+ * are owned by the registry itself.
74
+ */
75
+ export type WorkerOverrides = Omit<Cloudflare.WorkerProps, "main" | "env" | "crons">;
76
+ export interface GitHubCredentials {
77
+ /** The App id. Read from the deploy environment, bound to the Worker. */
78
+ readonly appId: Config.Config<string>;
79
+ /** The App's private key PEM. Bound to the Worker as a secret. */
80
+ readonly privateKey: Config.Config<Redacted.Redacted<string>>;
81
+ }
82
+ declare const RegistryConfig_base: Context.ServiceClass<RegistryConfig, "@alchemy.run/pkg/RegistryConfig", {
83
+ readonly policy: {
84
+ readonly repos: readonly string[];
85
+ readonly ttl: Duration.Duration;
86
+ readonly maxPackageSize?: import("effect/ByteSize").ByteSize | undefined;
87
+ };
88
+ readonly aliases: {
89
+ readonly [x: string]: string;
90
+ };
91
+ readonly cron: string;
92
+ readonly github: {
93
+ readonly apiUrl: string;
94
+ };
95
+ } & {
96
+ readonly worker: WorkerOverrides;
97
+ readonly github: Settings["github"] & GitHubCredentials;
98
+ }>;
99
+ /**
100
+ * The resolved registry configuration, provided to the Worker's Init phase.
101
+ * At plan time it is the value `PkgRegistry(id, options)` built from the
102
+ * caller's options; inside the isolate it is rebuilt from the Worker's
103
+ * bindings (see `RegistryConfigFromEnv` in `Registry.ts`). Either way the
104
+ * handler code sees one shape.
105
+ */
106
+ export declare class RegistryConfig extends RegistryConfig_base {
107
+ }
108
+ /** Worker `json` binding carrying the encoded {@link Settings}. */
109
+ export declare const SETTINGS_ENV = "PKG_SETTINGS";
110
+ /** Worker env var the GitHub App id is bound under. */
111
+ export declare const APP_ID_ENV = "PKG_GITHUB_APP_ID";
112
+ /** Worker secret the GitHub App private key PEM is bound under. */
113
+ export declare const PRIVATE_KEY_ENV = "PKG_GITHUB_APP_PRIVATE_KEY";
114
+ export declare const DEFAULT_TTL: Duration.Duration;
115
+ export declare const DEFAULT_CRON = "0 * * * *";
116
+ export declare const DEFAULT_API_URL = "https://api.github.com";
117
+ /** Marker that identifies the sticky install comment. */
118
+ export declare const COMMENT_MARKER = "<!-- pkg-preview-comment -->";
119
+ /** Uploaded tarballs no tag points at are deleted once older than this. */
120
+ export declare const ORPHAN_GRACE: Duration.Duration;
121
+ /** Tags tied to pull requests are re-checked when due within this window. */
122
+ export declare const SWEEP_LOOKAHEAD: Duration.Duration;
123
+ /** Content-addressed tarballs, keyed `<encoded name>/<sha256>.tgz`. */
124
+ export declare const Bucket: import("effect/Effect").Effect<Cloudflare.R2.Bucket, never, Cloudflare.Providers>;
125
+ export declare const tarballKey: (name: string, sha256: string) => string;
126
+ /** Publications, tags, and tarball bookkeeping. */
127
+ export declare const Database: import("effect/Effect").Effect<Cloudflare.D1.Database, never, Cloudflare.Providers>;
128
+ /**
129
+ * Resolved runs and installation tokens, shared by every isolate of the
130
+ * Worker. Everything in it is re-derivable from GitHub; see `KVCache.ts`.
131
+ */
132
+ export declare const Cache: import("effect/Effect").Effect<Cloudflare.KV.Namespace, never, Cloudflare.Providers>;
133
+ export {};
134
+ //# sourceMappingURL=Bindings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bindings.d.ts","sourceRoot":"","sources":["../../src/Registry/Bindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,MAAM;IACjB;;;;OAIG;;IAEH;;;;OAIG;;IAEH,+DAA+D;;EAE/D,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;;QAvBnB;;;;WAIG;;QAEH;;;;WAIG;;QAEH,+DAA+D;;;IAa/D;;;;OAIG;;IAEH,4CAA4C;;;;;EAK5C,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CA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are";
2
+ import * as Context from "effect/Context";
3
+ import * as Duration from "effect/Duration";
4
+ import * as Schema from "effect/Schema";
5
+ /**
6
+ * What the registry Worker binds: its three resources, the settings binding
7
+ * that carries the policy into the isolate, and the credential bindings.
8
+ * Shared by `Registry.ts` (which declares the Worker) and the runtime
9
+ * modules in this folder.
10
+ */
11
+ /**
12
+ * Registry policy. The `Type` side is what the Worker runs against
13
+ * (`Duration`, `ByteSize`); the `Encoded` side is plain JSON, which is how
14
+ * the policy crosses into the isolate as a Worker binding.
15
+ */
16
+ export const Policy = Schema.Struct({
17
+ /**
18
+ * Repositories allowed to publish, as `owner/name`. A publication may
19
+ * contain any package; every package gets the commit, short commit,
20
+ * `branch:` and `pr:` tags of the run that produced it.
21
+ */
22
+ repos: Schema.Array(Schema.String),
23
+ /**
24
+ * How long a publication lives: from the push for branch publications,
25
+ * from close or merge for pull request publications. Publishing the same
26
+ * content again refreshes the clock.
27
+ */
28
+ ttl: Schema.DurationFromMillis,
29
+ /** Upper bound on a single tarball. Absent means unlimited. */
30
+ maxPackageSize: Schema.optionalKey(Schema.ByteSizeFromNumber),
31
+ });
32
+ /**
33
+ * Everything the Worker needs that is plain data. Encoded into the
34
+ * {@link SETTINGS_ENV} binding at deploy time and decoded back inside the
35
+ * isolate, so the deploy-time and runtime views of the registry are the
36
+ * same value by construction.
37
+ */
38
+ export const Settings = Schema.Struct({
39
+ policy: Policy,
40
+ /**
41
+ * Hostname to package scope. Requests on an aliased host resolve an
42
+ * unscoped name under that scope, so `pkg.distilled.cloud/core/<sha>`
43
+ * serves `@distilled.cloud/core`.
44
+ */
45
+ aliases: Schema.Record(Schema.String, Schema.String),
46
+ /** Cron expression for the expiry sweep. */
47
+ cron: Schema.String,
48
+ github: Schema.Struct({
49
+ apiUrl: Schema.String,
50
+ }),
51
+ });
52
+ /**
53
+ * The resolved registry configuration, provided to the Worker's Init phase.
54
+ * At plan time it is the value `PkgRegistry(id, options)` built from the
55
+ * caller's options; inside the isolate it is rebuilt from the Worker's
56
+ * bindings (see `RegistryConfigFromEnv` in `Registry.ts`). Either way the
57
+ * handler code sees one shape.
58
+ */
59
+ export class RegistryConfig extends Context.Service()("@alchemy.run/pkg/RegistryConfig") {
60
+ }
61
+ /** Worker `json` binding carrying the encoded {@link Settings}. */
62
+ export const SETTINGS_ENV = "PKG_SETTINGS";
63
+ /** Worker env var the GitHub App id is bound under. */
64
+ export const APP_ID_ENV = "PKG_GITHUB_APP_ID";
65
+ /** Worker secret the GitHub App private key PEM is bound under. */
66
+ export const PRIVATE_KEY_ENV = "PKG_GITHUB_APP_PRIVATE_KEY";
67
+ export const DEFAULT_TTL = Duration.weeks(1);
68
+ export const DEFAULT_CRON = "0 * * * *";
69
+ export const DEFAULT_API_URL = "https://api.github.com";
70
+ /** Marker that identifies the sticky install comment. */
71
+ export const COMMENT_MARKER = "<!-- pkg-preview-comment -->";
72
+ /** Uploaded tarballs no tag points at are deleted once older than this. */
73
+ export const ORPHAN_GRACE = Duration.hours(24);
74
+ /** Tags tied to pull requests are re-checked when due within this window. */
75
+ export const SWEEP_LOOKAHEAD = Duration.hours(2);
76
+ /** Content-addressed tarballs, keyed `<encoded name>/<sha256>.tgz`. */
77
+ export const Bucket = Cloudflare.R2.Bucket("Bucket", { forceDestroy: true });
78
+ export const tarballKey = (name, sha256) => `${encodeURIComponent(name)}/${sha256}.tgz`;
79
+ // The migrations ship inside this package. `import.meta.url` is a file URL
80
+ // during plan/deploy and absent or opaque inside the isolate, where the
81
+ // resource declaration is only evaluated for its binding.
82
+ const migrations = typeof import.meta.url === "string" && import.meta.url.startsWith("file:")
83
+ ? decodeURIComponent(new URL("../../migrations", import.meta.url).pathname)
84
+ : undefined;
85
+ /** Publications, tags, and tarball bookkeeping. */
86
+ export const Database = Cloudflare.D1.Database("Database", { migrations });
87
+ /**
88
+ * Resolved runs and installation tokens, shared by every isolate of the
89
+ * Worker. Everything in it is re-derivable from GitHub; see `KVCache.ts`.
90
+ */
91
+ export const Cache = Cloudflare.KV.Namespace("Cache");
92
+ //# sourceMappingURL=Bindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bindings.js","sourceRoot":"","sources":["../../src/Registry/Bindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC,kBAAkB;IAC9B,+DAA+D;IAC/D,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,kBAAkB,CAAC;CAC9D,CAAC,CAAC;AAGH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,MAAM;IACd;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;IACpD,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;CACH,CAAC,CAAC;AAmBH;;;;;;GAMG;AACH,MAAM,OAAO,cAAe,SAAQ,OAAO,CAAC,OAAO,EAMhD,CAAC,iCAAiC,CAAC;CAAG;AAEzC,mEAAmE;AACnE,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAE3C,uDAAuD;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,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C,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC"}
@@ -0,0 +1,96 @@
1
+ import * as Github from "@distilled.cloud/github";
2
+ import * as Actions from "@distilled.cloud/github/actions";
3
+ import * as Apps from "@distilled.cloud/github/apps";
4
+ import * as Checks from "@distilled.cloud/github/checks";
5
+ import * as Issues from "@distilled.cloud/github/issues";
6
+ import * as Pulls from "@distilled.cloud/github/pulls";
7
+ import * as Repos from "@distilled.cloud/github/repos";
8
+ import * as Context from "effect/Context";
9
+ import * as Effect from "effect/Effect";
10
+ import * as Layer from "effect/Layer";
11
+ import * as HttpClient from "effect/unstable/http/HttpClient";
12
+ import * as crypto from "node:crypto";
13
+ import { RegistryConfig } from "./Bindings.ts";
14
+ declare const CryptoError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
15
+ readonly _tag: "CryptoError";
16
+ } & Readonly<A>;
17
+ export declare class CryptoError extends CryptoError_base<{
18
+ readonly message: string;
19
+ }> {
20
+ }
21
+ declare const AppNotInstalled_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
22
+ readonly _tag: "AppNotInstalled";
23
+ } & Readonly<A>;
24
+ export declare class AppNotInstalled extends AppNotInstalled_base<{
25
+ readonly repo: string;
26
+ }> {
27
+ get message(): string;
28
+ }
29
+ /** Import an RSA private key PEM (PKCS#1 or PKCS#8) for RS256 signing. */
30
+ export declare const importPrivateKey: (pem: string) => Effect.Effect<crypto.KeyObject, CryptoError, never>;
31
+ /** Sign a compact RS256 JWT, used to authenticate as the GitHub App. */
32
+ export declare const signJwt: (claims: Record<string, unknown>, key: crypto.KeyObject) => Effect.Effect<string, CryptoError, never>;
33
+ /**
34
+ * Install commands per package, grouped. A group marked `collapsed`
35
+ * renders as a closed `<details>` block so a long list of secondary
36
+ * packages stays out of the way.
37
+ */
38
+ export declare const renderInstalls: (packages: ReadonlyArray<{
39
+ name: string;
40
+ group: string;
41
+ url: string;
42
+ }>, groups: ReadonlyArray<{
43
+ name: string;
44
+ collapsed: boolean;
45
+ }>) => string;
46
+ export declare const renderComment: (packages: ReadonlyArray<{
47
+ name: string;
48
+ group: string;
49
+ url: string;
50
+ }>, groups: ReadonlyArray<{
51
+ name: string;
52
+ collapsed: boolean;
53
+ }>, times: {
54
+ readonly publishedAt: number;
55
+ readonly expiresAt: number;
56
+ }) => string;
57
+ /** Render any GitHub operation failure for logs and error responses. */
58
+ export declare const describe: (error: {
59
+ readonly _tag: string;
60
+ readonly message?: string | undefined;
61
+ }) => string;
62
+ declare const GitHubApp_base: Context.ServiceClass<GitHubApp, "@alchemy.run/pkg/GitHubApp", {
63
+ getRun: (repo: string, runId: number) => Effect.Effect<Actions.WorkflowRun, AppNotInstalled | import("effect/Config").ConfigError | CryptoError | Apps.Forbidden | Apps.NotFound | Apps.UnprocessableEntity | Github.GithubOpError, import("alchemy/Cloudflare/Providers").Providers | import("alchemy/Cloudflare/KV/ReadWriteNamespace").ReadWriteNamespace | import("alchemy").RuntimeContext>;
64
+ /**
65
+ * Artifacts named `name` uploaded to a run so far, including by jobs
66
+ * still in progress.
67
+ */
68
+ listRunArtifacts: (repo: string, runId: number, name: string) => Effect.Effect<Actions.ListWorkflowRunArtifactsResponseArtifactsList, AppNotInstalled | import("effect/Config").ConfigError | CryptoError | Apps.Forbidden | Apps.NotFound | Apps.UnprocessableEntity | Github.GithubOpError, import("alchemy/Cloudflare/Providers").Providers | import("alchemy/Cloudflare/KV/ReadWriteNamespace").ReadWriteNamespace | import("alchemy").RuntimeContext>;
69
+ /**
70
+ * Pull requests against `repo` whose head is `sha` in `headRepo`, the
71
+ * repository the commit was pushed to.
72
+ */
73
+ pullRequestsForCommit: (repo: string, headRepo: string, sha: string) => Effect.Effect<Repos.PullRequestSimple[], AppNotInstalled | import("effect/Config").ConfigError | CryptoError | Apps.Forbidden | Apps.NotFound | Apps.UnprocessableEntity | Repos.ListPullRequestsAssociatedWithCommitError, import("alchemy/Cloudflare/Providers").Providers | import("alchemy/Cloudflare/KV/ReadWriteNamespace").ReadWriteNamespace | import("alchemy").RuntimeContext>;
74
+ getPullRequest: (repo: string, number: number) => Effect.Effect<Pulls.PullRequest, AppNotInstalled | import("effect/Config").ConfigError | CryptoError | Apps.Forbidden | Apps.NotFound | Apps.UnprocessableEntity | Pulls.GetError, import("alchemy/Cloudflare/Providers").Providers | import("alchemy/Cloudflare/KV/ReadWriteNamespace").ReadWriteNamespace | import("alchemy").RuntimeContext>;
75
+ /**
76
+ * Publish a completed check run on `headSha`. GitHub shows the newest run
77
+ * per name and App, so re-publishing the same commit simply supersedes it.
78
+ */
79
+ createCheckRun: (repo: string, input: {
80
+ readonly headSha: string;
81
+ readonly name: string;
82
+ readonly title: string;
83
+ readonly summary: string;
84
+ readonly detailsUrl: string;
85
+ }) => Effect.Effect<Checks.CheckRun, AppNotInstalled | import("effect/Config").ConfigError | CryptoError | Apps.Forbidden | Apps.NotFound | Apps.UnprocessableEntity | Github.GithubOpError, import("alchemy/Cloudflare/Providers").Providers | import("alchemy/Cloudflare/KV/ReadWriteNamespace").ReadWriteNamespace | import("alchemy").RuntimeContext>;
86
+ /**
87
+ * Create or update the comment on `issue` whose body starts with
88
+ * `marker`, looking through the first five pages of comments.
89
+ */
90
+ upsertComment: (repo: string, issue: number, marker: string, body: string) => Effect.Effect<void, AppNotInstalled | Github.BadGateway | import("effect/Config").ConfigError | Github.ConfigError | CryptoError | Apps.Forbidden | Issues.Forbidden | Github.GatewayTimeout | Github.GithubParseError | Github.Gone | Issues.Gone | import("effect/unstable/http/HttpClientError").HttpClientError | Github.InternalServerError | Apps.NotFound | Issues.NotFound | Github.ServiceUnavailable | Github.TooManyRequests | Github.Unauthorized | Github.UnknownGithubError | Apps.UnprocessableEntity | Issues.UnprocessableEntity, import("alchemy/Cloudflare/Providers").Providers | import("alchemy/Cloudflare/KV/ReadWriteNamespace").ReadWriteNamespace | import("alchemy").RuntimeContext>;
91
+ }>;
92
+ export declare class GitHubApp extends GitHubApp_base {
93
+ }
94
+ export declare const GitHubAppLive: Layer.Layer<GitHubApp, never, HttpClient.HttpClient | RegistryConfig>;
95
+ export {};
96
+ //# sourceMappingURL=GitHub.d.ts.map