@ref0/git 0.8.0 → 0.9.0

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 (94) hide show
  1. package/dist/contracts/calls-spent.d.mts +2 -12
  2. package/dist/contracts/calls-spent.mjs +4 -5
  3. package/dist/contracts/events.d.mts +70 -4
  4. package/dist/contracts/events.mjs +27 -3
  5. package/dist/contracts/git.d.mts +13 -3
  6. package/dist/contracts/objects.d.mts +18 -0
  7. package/dist/contracts/queue.d.mts +3 -2
  8. package/dist/contracts/queue.mjs +4 -2
  9. package/dist/core/ancestry.mjs +5 -4
  10. package/dist/core/index-job.mjs +23 -1
  11. package/dist/core/index-lost.d.mts +11 -0
  12. package/dist/core/index-lost.mjs +55 -0
  13. package/dist/core/objects/commit-writes.mjs +1 -1
  14. package/dist/core/objects/commits.mjs +10 -9
  15. package/dist/core/objects/merges.mjs +1 -1
  16. package/dist/core/objects/reading.mjs +28 -13
  17. package/dist/core/objects/trees.mjs +1 -1
  18. package/dist/core/parts.d.mts +7 -0
  19. package/dist/core/publish.mjs +9 -5
  20. package/dist/core/purge.mjs +16 -3
  21. package/dist/core/push.mjs +27 -11
  22. package/dist/core/repack.mjs +36 -14
  23. package/dist/core/view.d.mts +10 -1
  24. package/dist/core/view.mjs +15 -6
  25. package/dist/effect.d.mts +2 -3
  26. package/dist/effect.mjs +2 -3
  27. package/dist/engine/commits.mjs +4 -3
  28. package/dist/engine/merge-bases.mjs +5 -3
  29. package/dist/engine/merge.mjs +4 -3
  30. package/dist/engine/parts.d.mts +1 -0
  31. package/dist/engine/parts.mjs +1 -1
  32. package/dist/engine/walk.mjs +15 -11
  33. package/dist/http/core-parts.mjs +17 -8
  34. package/dist/index.d.mts +2 -2
  35. package/dist/lfs/objects.mjs +7 -4
  36. package/dist/lfs/upkeep.mjs +6 -5
  37. package/dist/lfs/upload-most.mjs +7 -1
  38. package/dist/protocol/bytes/streams.mjs +84 -2
  39. package/dist/protocol/diff/read.d.mts +1 -0
  40. package/dist/protocol/diff/read.mjs +5 -2
  41. package/dist/protocol/objects/commit.d.mts +7 -0
  42. package/dist/protocol/objects/commit.mjs +5 -1
  43. package/dist/queue/advance.mjs +39 -10
  44. package/dist/queue/host.d.mts +4 -0
  45. package/dist/queue/layer.mjs +4 -2
  46. package/dist/queue/limits.mjs +18 -2
  47. package/dist/queue/rows.mjs +2 -1
  48. package/dist/queue/trim.mjs +2 -2
  49. package/dist/rest/commits.d.mts +238 -238
  50. package/dist/rest/forks.d.mts +71 -71
  51. package/dist/rest/refs.d.mts +143 -143
  52. package/dist/rest/repos.d.mts +81 -81
  53. package/dist/rest/topics.d.mts +112 -112
  54. package/dist/rest/trees.d.mts +77 -77
  55. package/dist/rest/wire.d.mts +19 -1
  56. package/dist/rest/work.d.mts +39 -39
  57. package/dist/server/joined.d.mts +11 -5
  58. package/dist/server/joined.mjs +3 -2
  59. package/dist/server/registry.mjs +11 -5
  60. package/dist/server/server.mjs +16 -4
  61. package/dist/storage/index-bitmaps.mjs +16 -10
  62. package/dist/storage/index-build.mjs +61 -13
  63. package/dist/storage/index-graph.d.mts +1 -0
  64. package/dist/storage/index-graph.mjs +29 -5
  65. package/dist/storage/index-layers.d.mts +1 -0
  66. package/dist/storage/index-layers.mjs +5 -2
  67. package/dist/storage/index-reach.mjs +7 -5
  68. package/dist/storage/index-remap.mjs +5 -5
  69. package/dist/storage/index-visible.mjs +16 -5
  70. package/dist/storage/links.mjs +3 -3
  71. package/dist/storage/pack-order.d.mts +1 -0
  72. package/dist/storage/pack-order.mjs +18 -1
  73. package/dist/storage/prune-walk.mjs +5 -2
  74. package/dist/storage/prune.mjs +107 -37
  75. package/dist/storage/receive-bounds.mjs +3 -2
  76. package/dist/storage/visible.mjs +3 -2
  77. package/dist/storage/walk.d.mts +1 -0
  78. package/dist/storage/walk.mjs +9 -5
  79. package/dist/storage/wants.mjs +17 -11
  80. package/dist/store/call-count.d.mts +8 -0
  81. package/dist/store/call-count.mjs +15 -7
  82. package/dist/store/errors.d.mts +7 -1
  83. package/dist/store/errors.mjs +7 -1
  84. package/dist/store/job-try.mjs +3 -1
  85. package/dist/store/records.mjs +17 -2
  86. package/dist/store/repo-record.mjs +9 -2
  87. package/dist/store/scopes.mjs +10 -2
  88. package/dist/sync/bound.d.mts +1 -1
  89. package/dist/sync/import.mjs +1 -1
  90. package/dist/sync/layer.mjs +4 -7
  91. package/dist/sync/mirror.mjs +1 -1
  92. package/dist/topics/advance.mjs +4 -4
  93. package/dist/topics/layer.mjs +1 -1
  94. package/package.json +3 -3
@@ -1,41 +1,20 @@
1
1
  import { GitCallerMiddleware, GitRestServices } from "./caller.mjs";
2
2
  import * as Schema from "effect/Schema";
3
3
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
4
- declare const TreesApiGroup_base: HttpApiGroup.HttpApiGroup<"trees", HttpApiEndpoint.HttpApiEndpoint<"diff", "POST", "/repos/:repo/-/trees/diff", Schema.toCodecStringTree<Schema.Struct<{
4
+ declare const TreesApiGroup_base: HttpApiGroup.HttpApiGroup<"trees", HttpApiEndpoint.HttpApiEndpoint<"create", "POST", "/repos/:repo/-/trees", Schema.toCodecStringTree<Schema.Struct<{
5
5
  repo: Schema.String;
6
6
  }>>, never, Schema.toCodecJson<Schema.Struct<{
7
- readonly base: Schema.String;
8
- readonly head: Schema.String;
9
- readonly renames: Schema.optionalKey<Schema.Boolean>;
10
- readonly limits: Schema.optionalKey<Schema.Struct<{
11
- readonly objects: Schema.optionalKey<Schema.Int>;
12
- readonly bytes: Schema.optionalKey<Schema.Int>;
13
- readonly entries: Schema.optionalKey<Schema.Int>;
14
- readonly milliseconds: Schema.optionalKey<Schema.Int>;
15
- }>>;
16
- readonly page: Schema.optionalKey<Schema.Struct<{
17
- readonly after: Schema.optionalKey<Schema.String>;
18
- readonly limit: Schema.optionalKey<Schema.Int>;
7
+ readonly key: Schema.optionalKey<Schema.String>;
8
+ readonly base: Schema.optionalKey<Schema.String>;
9
+ readonly changes: Schema.$Array<Schema.Struct<{
10
+ readonly path: Schema.String;
11
+ readonly mode: Schema.optionalKey<Schema.String>;
12
+ readonly oid: Schema.optionalKey<Schema.NullOr<Schema.String>>;
13
+ readonly content: Schema.optionalKey<Schema.String>;
14
+ readonly contentBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
19
15
  }>>;
20
16
  }>>, never, Schema.toCodecJson<Schema.Struct<{
21
- readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
22
- status: Schema.Literals<readonly ["A", "D", "M", "R", "T"]>;
23
- path: Schema.String;
24
- from: Schema.optionalKey<Schema.String>;
25
- similarity: Schema.optionalKey<Schema.Number>;
26
- old: Schema.optionalKey<Schema.Struct<{
27
- readonly mode: Schema.String;
28
- readonly oid: Schema.String;
29
- }>>;
30
- new: Schema.optionalKey<Schema.Struct<{
31
- readonly mode: Schema.String;
32
- readonly oid: Schema.String;
33
- }>>;
34
- pathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
35
- fromPathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
36
- }>>>;
37
- readonly next: Schema.optionalKey<Schema.String>;
38
- readonly renamesSkipped: Schema.optionalKey<Schema.Literals<readonly ["rename-limit", "memory-limit"]>>;
17
+ readonly oid: Schema.String;
39
18
  }>>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
40
19
  readonly code: "ALREADY_EXISTS";
41
20
  readonly message: string;
@@ -435,20 +414,41 @@ declare const TreesApiGroup_base: HttpApiGroup.HttpApiGroup<"trees", HttpApiEndp
435
414
  }>, {
436
415
  "ref0-code": Schema.String;
437
416
  'www-authenticate': Schema.String;
438
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"create", "POST", "/repos/:repo/-/trees", Schema.toCodecStringTree<Schema.Struct<{
417
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"diff", "POST", "/repos/:repo/-/trees/diff", Schema.toCodecStringTree<Schema.Struct<{
439
418
  repo: Schema.String;
440
419
  }>>, never, Schema.toCodecJson<Schema.Struct<{
441
- readonly key: Schema.optionalKey<Schema.String>;
442
- readonly base: Schema.optionalKey<Schema.String>;
443
- readonly changes: Schema.$Array<Schema.Struct<{
444
- readonly path: Schema.String;
445
- readonly mode: Schema.optionalKey<Schema.String>;
446
- readonly oid: Schema.optionalKey<Schema.NullOr<Schema.String>>;
447
- readonly content: Schema.optionalKey<Schema.String>;
448
- readonly contentBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
420
+ readonly base: Schema.String;
421
+ readonly head: Schema.String;
422
+ readonly renames: Schema.optionalKey<Schema.Boolean>;
423
+ readonly limits: Schema.optionalKey<Schema.Struct<{
424
+ readonly objects: Schema.optionalKey<Schema.Int>;
425
+ readonly bytes: Schema.optionalKey<Schema.Int>;
426
+ readonly entries: Schema.optionalKey<Schema.Int>;
427
+ readonly milliseconds: Schema.optionalKey<Schema.Int>;
428
+ }>>;
429
+ readonly page: Schema.optionalKey<Schema.Struct<{
430
+ readonly after: Schema.optionalKey<Schema.String>;
431
+ readonly limit: Schema.optionalKey<Schema.Int>;
449
432
  }>>;
450
433
  }>>, never, Schema.toCodecJson<Schema.Struct<{
451
- readonly oid: Schema.String;
434
+ readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
435
+ status: Schema.Literals<readonly ["A", "D", "M", "R", "T"]>;
436
+ path: Schema.String;
437
+ from: Schema.optionalKey<Schema.String>;
438
+ similarity: Schema.optionalKey<Schema.Number>;
439
+ old: Schema.optionalKey<Schema.Struct<{
440
+ readonly mode: Schema.String;
441
+ readonly oid: Schema.String;
442
+ }>>;
443
+ new: Schema.optionalKey<Schema.Struct<{
444
+ readonly mode: Schema.String;
445
+ readonly oid: Schema.String;
446
+ }>>;
447
+ pathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
448
+ fromPathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
449
+ }>>>;
450
+ readonly next: Schema.optionalKey<Schema.String>;
451
+ readonly renamesSkipped: Schema.optionalKey<Schema.Literals<readonly ["rename-limit", "memory-limit"]>>;
452
452
  }>>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
453
453
  readonly code: "ALREADY_EXISTS";
454
454
  readonly message: string;
@@ -848,22 +848,28 @@ declare const TreesApiGroup_base: HttpApiGroup.HttpApiGroup<"trees", HttpApiEndp
848
848
  }>, {
849
849
  "ref0-code": Schema.String;
850
850
  'www-authenticate': Schema.String;
851
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"merge", "POST", "/repos/:repo/-/trees/merge", Schema.toCodecStringTree<Schema.Struct<{
851
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"get", "GET", "/repos/:repo/-/trees/:oid", Schema.toCodecStringTree<Schema.Struct<{
852
852
  repo: Schema.String;
853
- }>>, never, Schema.toCodecJson<Schema.Struct<{
854
- readonly base: Schema.optionalKey<Schema.String>;
855
- readonly ours: Schema.String;
856
- readonly theirs: Schema.String;
857
- readonly key: Schema.optionalKey<Schema.String>;
858
- readonly limits: Schema.optionalKey<Schema.Struct<{
859
- readonly objects: Schema.optionalKey<Schema.Int>;
860
- readonly bytes: Schema.optionalKey<Schema.Int>;
861
- readonly entries: Schema.optionalKey<Schema.Int>;
862
- readonly milliseconds: Schema.optionalKey<Schema.Int>;
863
- }>>;
864
- }>>, never, Schema.toCodecJson<Schema.Struct<{
865
- readonly tree: Schema.String;
866
- readonly renamesSkipped: Schema.optionalKey<Schema.Literals<readonly ["rename-limit", "memory-limit"]>>;
853
+ oid: Schema.String;
854
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
855
+ objects: Schema.optionalKey<Schema.Int>;
856
+ bytes: Schema.optionalKey<Schema.Int>;
857
+ entries: Schema.optionalKey<Schema.Int>;
858
+ milliseconds: Schema.optionalKey<Schema.Int>;
859
+ after: Schema.optionalKey<Schema.String>;
860
+ limit: Schema.optionalKey<Schema.Int>;
861
+ recursive: Schema.optionalKey<Schema.Boolean>;
862
+ }>>, never, never, Schema.toCodecJson<Schema.Struct<{
863
+ readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
864
+ readonly name: Schema.String;
865
+ readonly path: Schema.String;
866
+ readonly mode: Schema.String;
867
+ readonly type: Schema.Literals<readonly ["blob", "tree", "commit"]>;
868
+ readonly oid: Schema.String;
869
+ readonly size: Schema.optionalKey<Schema.Int>;
870
+ readonly pathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
871
+ }>>>;
872
+ readonly next: Schema.optionalKey<Schema.String>;
867
873
  }>>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
868
874
  readonly code: "ALREADY_EXISTS";
869
875
  readonly message: string;
@@ -1263,28 +1269,22 @@ declare const TreesApiGroup_base: HttpApiGroup.HttpApiGroup<"trees", HttpApiEndp
1263
1269
  }>, {
1264
1270
  "ref0-code": Schema.String;
1265
1271
  'www-authenticate': Schema.String;
1266
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"get", "GET", "/repos/:repo/-/trees/:oid", Schema.toCodecStringTree<Schema.Struct<{
1272
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"merge", "POST", "/repos/:repo/-/trees/merge", Schema.toCodecStringTree<Schema.Struct<{
1267
1273
  repo: Schema.String;
1268
- oid: Schema.String;
1269
- }>>, Schema.toCodecStringTree<Schema.Struct<{
1270
- objects: Schema.optionalKey<Schema.Int>;
1271
- bytes: Schema.optionalKey<Schema.Int>;
1272
- entries: Schema.optionalKey<Schema.Int>;
1273
- milliseconds: Schema.optionalKey<Schema.Int>;
1274
- after: Schema.optionalKey<Schema.String>;
1275
- limit: Schema.optionalKey<Schema.Int>;
1276
- recursive: Schema.optionalKey<Schema.Boolean>;
1277
- }>>, never, never, Schema.toCodecJson<Schema.Struct<{
1278
- readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
1279
- readonly name: Schema.String;
1280
- readonly path: Schema.String;
1281
- readonly mode: Schema.String;
1282
- readonly type: Schema.Literals<readonly ["blob", "tree", "commit"]>;
1283
- readonly oid: Schema.String;
1284
- readonly size: Schema.optionalKey<Schema.Int>;
1285
- readonly pathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
1286
- }>>>;
1287
- readonly next: Schema.optionalKey<Schema.String>;
1274
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
1275
+ readonly base: Schema.optionalKey<Schema.String>;
1276
+ readonly ours: Schema.String;
1277
+ readonly theirs: Schema.String;
1278
+ readonly key: Schema.optionalKey<Schema.String>;
1279
+ readonly limits: Schema.optionalKey<Schema.Struct<{
1280
+ readonly objects: Schema.optionalKey<Schema.Int>;
1281
+ readonly bytes: Schema.optionalKey<Schema.Int>;
1282
+ readonly entries: Schema.optionalKey<Schema.Int>;
1283
+ readonly milliseconds: Schema.optionalKey<Schema.Int>;
1284
+ }>>;
1285
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
1286
+ readonly tree: Schema.String;
1287
+ readonly renamesSkipped: Schema.optionalKey<Schema.Literals<readonly ["rename-limit", "memory-limit"]>>;
1288
1288
  }>>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
1289
1289
  readonly code: "ALREADY_EXISTS";
1290
1290
  readonly message: string;
@@ -171,6 +171,24 @@ export declare const RepoStreamEvent: Schema.Union<readonly [Schema.Union<readon
171
171
  readonly type: Schema.Literal<"repo.work.failed">;
172
172
  readonly refused: Schema.Literals<readonly ["spent", "too-large"]>;
173
173
  readonly error: Schema.String;
174
+ }>, Schema.Struct<{
175
+ readonly seq: Schema.Int;
176
+ readonly at: Schema.Number;
177
+ readonly actor: Schema.optionalKey<Schema.Struct<{
178
+ readonly id: Schema.String;
179
+ }>>;
180
+ readonly subject: Schema.optionalKey<Schema.Struct<{
181
+ readonly id: Schema.String;
182
+ }>>;
183
+ readonly repo: Schema.String;
184
+ readonly internalId: Schema.TemplateLiteral<readonly ["r_", Schema.String]>;
185
+ readonly token: Schema.optionalKey<Schema.String>;
186
+ readonly type: Schema.Literal<"repo.work.failed">;
187
+ readonly name: Schema.Literal<"git.repack">;
188
+ readonly key: Schema.Literal<"prune">;
189
+ readonly refused: Schema.Literal<"busy">;
190
+ readonly periods: Schema.Int;
191
+ readonly error: Schema.String;
174
192
  }>]>]>, Schema.Union<readonly [Schema.Struct<{
175
193
  readonly seq: Schema.Int;
176
194
  readonly at: Schema.Number;
@@ -222,7 +240,7 @@ export declare const RepoStreamEvent: Schema.Union<readonly [Schema.Union<readon
222
240
  readonly url: Schema.optionalKey<Schema.String>;
223
241
  readonly type: Schema.Literal<"queue.entry.failed">;
224
242
  readonly entry: Schema.String;
225
- readonly reason: Schema.Literals<readonly ["conflict", "reported", "host-error", "interaction", "refused", "tooManyCommits"]>;
243
+ readonly reason: Schema.Literals<readonly ["conflict", "reported", "host-error", "interaction", "refused", "tooManyCommits", "tooLarge"]>;
226
244
  readonly candidate: Schema.optionalKey<Schema.String>;
227
245
  readonly error: Schema.optionalKey<Schema.String>;
228
246
  }>, Schema.Struct<{
@@ -1,13 +1,39 @@
1
1
  import { GitCallerMiddleware, GitRestServices } from "./caller.mjs";
2
2
  import * as Schema from "effect/Schema";
3
3
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
4
- declare const WorkApiGroup_base: HttpApiGroup.HttpApiGroup<"work", HttpApiEndpoint.HttpApiEndpoint<"discard", "POST", "/repos/:repo/-/work/discard", Schema.toCodecStringTree<Schema.Struct<{
4
+ declare const WorkApiGroup_base: HttpApiGroup.HttpApiGroup<"work", HttpApiEndpoint.HttpApiEndpoint<"list", "GET", "/repos/:repo/-/work", Schema.toCodecStringTree<Schema.Struct<{
5
5
  repo: Schema.String;
6
- }>>, never, Schema.toCodecJson<Schema.Struct<{
7
- readonly name: Schema.String;
8
- readonly key: Schema.String;
9
- readonly requestKey: Schema.optionalKey<Schema.String>;
10
- }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
6
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
7
+ after: Schema.optionalKey<Schema.String>;
8
+ limit: Schema.optionalKey<Schema.Int>;
9
+ state: Schema.optionalKey<Schema.Literals<readonly ["waiting", "running", "failed"]>>;
10
+ }>>, never, never, Schema.toCodecJson<Schema.Struct<{
11
+ readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
12
+ readonly scope: Schema.String;
13
+ readonly name: Schema.String;
14
+ readonly key: Schema.String;
15
+ readonly data: Schema.Unknown;
16
+ readonly due: Schema.Number;
17
+ readonly attempt: Schema.Number;
18
+ readonly trace: Schema.optionalKey<Schema.String>;
19
+ readonly firstTry: Schema.optionalKey<Schema.Number>;
20
+ readonly claim: Schema.optionalKey<Schema.Number>;
21
+ readonly state: Schema.Literals<readonly ["waiting", "running", "failed"]>;
22
+ readonly error: Schema.optionalKey<Schema.String>;
23
+ readonly failedAt: Schema.optionalKey<Schema.Number>;
24
+ readonly progress: Schema.optionalKey<Schema.Struct<{
25
+ readonly phase: Schema.String;
26
+ readonly measures: Schema.$Array<Schema.Struct<{
27
+ readonly unit: Schema.Literals<readonly ["bytes", "objects", "entries", "packs"]>;
28
+ readonly completed: Schema.Number;
29
+ readonly total: Schema.optionalKey<Schema.Number>;
30
+ }>>;
31
+ readonly attempt: Schema.Number;
32
+ readonly at: Schema.Number;
33
+ }>>;
34
+ }>>>;
35
+ readonly next: Schema.optionalKey<Schema.String>;
36
+ }>>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
11
37
  readonly code: "ALREADY_EXISTS";
12
38
  readonly message: string;
13
39
  readonly hint?: string;
@@ -406,7 +432,7 @@ declare const WorkApiGroup_base: HttpApiGroup.HttpApiGroup<"work", HttpApiEndpoi
406
432
  }>, {
407
433
  "ref0-code": Schema.String;
408
434
  'www-authenticate': Schema.String;
409
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"retry", "POST", "/repos/:repo/-/work/retry", Schema.toCodecStringTree<Schema.Struct<{
435
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"discard", "POST", "/repos/:repo/-/work/discard", Schema.toCodecStringTree<Schema.Struct<{
410
436
  repo: Schema.String;
411
437
  }>>, never, Schema.toCodecJson<Schema.Struct<{
412
438
  readonly name: Schema.String;
@@ -811,39 +837,13 @@ declare const WorkApiGroup_base: HttpApiGroup.HttpApiGroup<"work", HttpApiEndpoi
811
837
  }>, {
812
838
  "ref0-code": Schema.String;
813
839
  'www-authenticate': Schema.String;
814
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"list", "GET", "/repos/:repo/-/work", Schema.toCodecStringTree<Schema.Struct<{
840
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"retry", "POST", "/repos/:repo/-/work/retry", Schema.toCodecStringTree<Schema.Struct<{
815
841
  repo: Schema.String;
816
- }>>, Schema.toCodecStringTree<Schema.Struct<{
817
- after: Schema.optionalKey<Schema.String>;
818
- limit: Schema.optionalKey<Schema.Int>;
819
- state: Schema.optionalKey<Schema.Literals<readonly ["waiting", "running", "failed"]>>;
820
- }>>, never, never, Schema.toCodecJson<Schema.Struct<{
821
- readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
822
- readonly scope: Schema.String;
823
- readonly name: Schema.String;
824
- readonly key: Schema.String;
825
- readonly data: Schema.Unknown;
826
- readonly due: Schema.Number;
827
- readonly attempt: Schema.Number;
828
- readonly trace: Schema.optionalKey<Schema.String>;
829
- readonly firstTry: Schema.optionalKey<Schema.Number>;
830
- readonly claim: Schema.optionalKey<Schema.Number>;
831
- readonly state: Schema.Literals<readonly ["waiting", "running", "failed"]>;
832
- readonly error: Schema.optionalKey<Schema.String>;
833
- readonly failedAt: Schema.optionalKey<Schema.Number>;
834
- readonly progress: Schema.optionalKey<Schema.Struct<{
835
- readonly phase: Schema.String;
836
- readonly measures: Schema.$Array<Schema.Struct<{
837
- readonly unit: Schema.Literals<readonly ["bytes", "objects", "entries", "packs"]>;
838
- readonly completed: Schema.Number;
839
- readonly total: Schema.optionalKey<Schema.Number>;
840
- }>>;
841
- readonly attempt: Schema.Number;
842
- readonly at: Schema.Number;
843
- }>>;
844
- }>>>;
845
- readonly next: Schema.optionalKey<Schema.String>;
846
- }>>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
842
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
843
+ readonly name: Schema.String;
844
+ readonly key: Schema.String;
845
+ readonly requestKey: Schema.optionalKey<Schema.String>;
846
+ }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
847
847
  readonly code: "ALREADY_EXISTS";
848
848
  readonly message: string;
849
849
  readonly hint?: string;
@@ -1,6 +1,6 @@
1
1
  import { Caller } from "../contracts/actors.mjs";
2
2
  import { InternalRepoId, RepoName } from "../contracts/ids.mjs";
3
- import { Bucket } from "../contracts/objects.mjs";
3
+ import { Bucket, EffectiveLimits } from "../contracts/objects.mjs";
4
4
  import { Clock, Store } from "../contracts/promises.mjs";
5
5
  import { QueueKeys } from "../contracts/queue.mjs";
6
6
  import { RepoRecord } from "../contracts/repos.mjs";
@@ -24,8 +24,8 @@ export interface JoinedAdapter {
24
24
  }
25
25
  /**
26
26
  * What a package joined to a `createGitServer` server reads beside Git's services: the calls
27
- * `RepoRecords`, `Authorize` and `Refs` don't make, each through the server's door. A bridge, which
28
- * goes with `joinLayer` and `createGitHubHandler` in 2c-3b.
27
+ * `RepoRecords`, `Authorize` and `Refs` don't make, each through the server's door. `Git.layer`
28
+ * provides it to the drop-in; the bridge, `joinLayer`, goes with `createGitServer` in 2c-3b.
29
29
  */
30
30
  export interface Joined {
31
31
  /** The server itself, for what goes through its own `fetch`. */
@@ -34,6 +34,12 @@ export interface Joined {
34
34
  /** The server's one queue's `keys`, or `undefined` with no queue. */
35
35
  readonly queueKeys: QueueKeys | undefined;
36
36
  readonly adapter: JoinedAdapter;
37
+ /**
38
+ * The server's `fetchLimits`: core's purge drops a deleted repo's scopes, its joined package's
39
+ * too, no sooner than `milliseconds` past the delete, so a write that read the repo live and
40
+ * commits within that, less `jobLeaseMargin`, commits before the drop.
41
+ */
42
+ readonly fetchLimits: EffectiveLimits;
37
43
  /**
38
44
  * A request's budget: the adapter's `callLimits`, named `request`. Made before `identify`, so the
39
45
  * sign-in read counts into it too (#725).
@@ -75,8 +81,8 @@ export interface Joining<ROut> {
75
81
  }
76
82
  /**
77
83
  * Builds `layer` in `git`'s build, over Git's services and `JoinedCalls`, after the server's own
78
- * features and before its seal, so what it registers is sealed with Git's: the bridge
79
- * `createGitHubHandler` joins `GitHub.layer` by, until 2c-3b removes both. Refused after the tick
84
+ * features and before its seal, so what it registers is sealed with Git's: a bridge, which 2c-3b
85
+ * removes with `createGitServer`. Refused after the tick
80
86
  * that made the server.
81
87
  */
82
88
  export declare const joinLayer: <ROut, RIn>(git: GitServer, layer: Layer.Layer<ROut, GitError, RIn>) => Joining<ROut>;
@@ -50,6 +50,7 @@ const joinedOf = (git, built) => {
50
50
  return attached.queueKeys;
51
51
  },
52
52
  adapter: built.adapter,
53
+ fetchLimits: attached.fetchLimits,
53
54
  request: () => syncIn(requestBudget(built.parts.requestMost), noCall),
54
55
  identify: attached.identify,
55
56
  callsFor: attached.callsFor,
@@ -70,8 +71,8 @@ const joinedOf = (git, built) => {
70
71
  const lateJoin = (call) => `${call} joins a server in the tick createGitServer made it in: call it where the server is made, before any await`;
71
72
  /**
72
73
  * Builds `layer` in `git`'s build, over Git's services and `JoinedCalls`, after the server's own
73
- * features and before its seal, so what it registers is sealed with Git's: the bridge
74
- * `createGitHubHandler` joins `GitHub.layer` by, until 2c-3b removes both. Refused after the tick
74
+ * features and before its seal, so what it registers is sealed with Git's: a bridge, which 2c-3b
75
+ * removes with `createGitServer`. Refused after the tick
75
76
  * that made the server.
76
77
  */
77
78
  const joinLayer = (git, layer) => {
@@ -7,8 +7,10 @@ import { bindHookGroups } from "../core/hooks/groups.mjs";
7
7
  import { bandRank, byOrder, orderedOf } from "../core/hooks/order.mjs";
8
8
  import { upkeepsOf } from "../core/repack.mjs";
9
9
  import { gitsOwnRefs, registeredRow } from "../protocol/wire/lines.mjs";
10
+ import { gitJob } from "../store/job-try.mjs";
10
11
  import { answersMethod, bySpecificity, matchPath, routePath } from "./route-match.mjs";
11
12
  import * as Effect from "effect/Effect";
13
+ import * as Context from "effect/Context";
12
14
  // src/server/registry.ts
13
15
  const sealedDefect = () => /* @__PURE__ */ new Error("Git's registry is sealed");
14
16
  /** A clash, as the build fails with it. */
@@ -201,12 +203,15 @@ const openRegistry = (basePath = "") => {
201
203
  purges.push(orderedOf(name, step));
202
204
  }),
203
205
  addRoute: (route) => adding(() => routeClash(name, route)),
204
- addJob: (definition) => adding(() => {
206
+ addJob: (job, handler, options) => Effect.flatMap(Effect.context(), (context) => adding(() => {
207
+ const within = (effect) => Effect.updateContext(effect, (current) => Context.merge(context, current));
208
+ const onFailure = options?.onFailure;
209
+ const definition = gitJob(job, (data) => within(handler(data)), onFailure === void 0 ? {} : { onFailure: (data, failure) => within(onFailure(data, failure)) });
205
210
  if (!definition.name.startsWith(`${name}.`)) return clash(`${name}'s jobs are named '${name}.…': got '${definition.name}'`);
206
211
  const found = jobClash(definition);
207
212
  if (found === void 0) pending.push(definition);
208
213
  return found;
209
- }),
214
+ })),
210
215
  addGrant: (resolver) => adding(() => grantClash(name, resolver))
211
216
  };
212
217
  const answer = owner === void 0 ? made : {
@@ -268,10 +273,11 @@ const openRegistry = (basePath = "") => {
268
273
  pushRules: () => rules,
269
274
  pushChecks: () => ordered(checks),
270
275
  hookGroups: () => ordered(hookGroups),
271
- upkeep: (store, repo, at) => upkeepsOf(ordered(upkeeps).map(({ handler }) => () => handler({
276
+ upkeep: (store, repo, at, deleted) => upkeepsOf(ordered(upkeeps).map(({ handler }) => () => handler({
272
277
  repo,
273
- at
274
- })))(store, repo, at),
278
+ at,
279
+ deleted
280
+ })))(store, repo, at, deleted),
275
281
  purge: Effect.fnUntraced(function* (_store, repo) {
276
282
  for (const { handler } of ordered(purges)) {
277
283
  const step = yield* handler({ repo });
@@ -32,6 +32,7 @@ import { Events, keepsEvents } from "../contracts/events.mjs";
32
32
  import { callServices } from "../core/call-services.mjs";
33
33
  import { repackJob, repackJobRow, upkeepsOf } from "../core/repack.mjs";
34
34
  import { indexJob, indexJobRow } from "../core/index-job.mjs";
35
+ import { indexLostAsk } from "../core/index-lost.mjs";
35
36
  import { purgeJob, purgeJobRow } from "../core/purge.mjs";
36
37
  import { refIndexJob, refIndexJobRow } from "../core/ref-index-job.mjs";
37
38
  import { forkCalls } from "../core/forks.mjs";
@@ -66,13 +67,14 @@ import { countedBucket } from "../storage/counted-bucket.mjs";
66
67
  import { hostFailures, hostLinks, hostUploads } from "../storage/host-bucket.mjs";
67
68
  import { pushUploadUpkeep } from "../storage/push-uploads.mjs";
68
69
  import { checkedLimits, countedMost, hookCallsBefore, lessBefore, noScope } from "../store/call-count.mjs";
69
- import { jobLimitsOf, jobsWithin } from "../store/job-try.mjs";
70
+ import { gitJob, jobLimitsOf, jobsWithin } from "../store/job-try.mjs";
70
71
  import { exitOn, noCall, syncIn, uncounted } from "../store/crossing.mjs";
71
72
  import { pruneFloor } from "../storage/rows.mjs";
72
73
  import { queueJobs } from "../queue/advance.mjs";
73
74
  import { queueCalls } from "../queue/calls.mjs";
74
75
  import { QueueBase, QueueInternals, queueKeysOf, queueOptions } from "../queue/host.mjs";
75
76
  import { queuePush } from "../queue/push-option.mjs";
77
+ import { buildMillisecondsOf } from "../queue/limits.mjs";
76
78
  import { topicsOptions } from "../topics/host.mjs";
77
79
  import { TopicsBase, topicsRegistration } from "../topics/layer.mjs";
78
80
  import { MergeQueue } from "../contracts/queue.mjs";
@@ -148,7 +150,7 @@ const namesOf = (optional, tokensOn, queueOn) => {
148
150
  const partsOnce = (loaded) => {
149
151
  const parts = Effect.map(loaded, (context) => Context.get(context, MergeParts));
150
152
  return {
151
- mergeTrees: (read, input, allot, call) => Effect.flatMap(parts, (one) => one.mergeTrees(read, input, allot, call)),
153
+ mergeTrees: (read, input, allot, call, roots) => Effect.flatMap(parts, (one) => one.mergeTrees(read, input, allot, call, roots)),
152
154
  lineDiff: (allot) => Effect.flatMap(parts, (one) => one.lineDiff(allot))
153
155
  };
154
156
  };
@@ -286,6 +288,13 @@ const wireServer = (options, wiring) => {
286
288
  cursors: cursorSeal(store)
287
289
  };
288
290
  if (indexRow !== void 0) parts.indexJobRow = indexRow;
291
+ const status = SealedObjects.indexStatus(sealed);
292
+ if (indexRow !== void 0 && status !== void 0) parts.indexLost = indexLostAsk({
293
+ store,
294
+ indexJobRow: indexRow,
295
+ status,
296
+ now
297
+ });
289
298
  parts.purgeJobRow = (at) => purgeJobRow(purge, at + fetchLimits.milliseconds);
290
299
  if (refIndex !== void 0) parts.refIndex = refIndex;
291
300
  if (rebuild !== void 0) parts.refIndexJobRow = () => refIndexJobRow(rebuild);
@@ -319,7 +328,8 @@ const wireServer = (options, wiring) => {
319
328
  needs,
320
329
  records: rawRecords,
321
330
  options: queueOf,
322
- keys: wiring.optional.queueKeys
331
+ keys: wiring.optional.queueKeys,
332
+ buildMilliseconds: buildMillisecondsOf(adapter.requestLimits.cpuMs)
323
333
  };
324
334
  const queueHeld = wiring.queue;
325
335
  queueHeld.host = queueHost;
@@ -327,6 +337,7 @@ const wireServer = (options, wiring) => {
327
337
  records: rawRecords,
328
338
  needs,
329
339
  onFailure,
340
+ cpuMs: adapter.requestLimits.cpuMs,
330
341
  attach: (host) => Effect.suspend(() => {
331
342
  if (queueHeld.host !== void 0) return Effect.die(/* @__PURE__ */ new TypeError("The server has a merge queue: provide MergeQueue.layer once"));
332
343
  queueHeld.host = host;
@@ -361,7 +372,7 @@ const wireServer = (options, wiring) => {
361
372
  });
362
373
  if (queueHost !== void 0) {
363
374
  registry.bridge("queue", "refs/queue/");
364
- const queueJobList = queueJobs(queueHost, onFailure);
375
+ const queueJobList = queueJobs(queueHost, onFailure).map((job) => job(gitJob));
365
376
  gits.knowJobs(queueJobList);
366
377
  jobs.register(...jobsWithin(jobLimits, queueJobList));
367
378
  }
@@ -759,6 +770,7 @@ const openServer = (options, decidersOf, sealing, features) => {
759
770
  attachJoins(server, {
760
771
  admit: life.admit,
761
772
  basePath,
773
+ fetchLimits,
762
774
  get queueKeys() {
763
775
  return queueHeld.host?.keys;
764
776
  },
@@ -58,22 +58,29 @@ const edgesHeaderBytes = 24;
58
58
  const noNumber = 4294967295;
59
59
  /** A bitmap kept whole, not as the XOR of another. */
60
60
  const noBase = 4294967295;
61
+ /** No root positions: a repo with no roots. */
62
+ const noRootPositions = /* @__PURE__ */ new Set();
61
63
  /**
62
64
  * A slice's edges file from its links and their joined `targets`, those a shallow commit lacks
63
- * left out: what it covers, and its bytes.
65
+ * left out, and the parents of each commit at one of `roots`, the repo's roots by position, so no
66
+ * reach passes a root: what it covers, and its bytes.
64
67
  */
65
- const edgesFileOf = (key, first, positions, links, targets) => {
66
- let kept = 0;
67
- for (const target of targets) if (target !== 4294967295) kept += 1;
68
+ const edgesFileOf = (key, first, positions, links, targets, roots = noRootPositions) => {
68
69
  const sources = links.sources;
69
- const bytes = new Uint8Array(edgesHeaderBytes + sources * 8 + 4 + kept * 4);
70
+ const kept = (source, at, from) => targets[at] !== void 0 && targets[at] !== 4294967295 && !(roots.has(links.positionOf(source)) && links.mayLack(source, at - from));
71
+ let count = 0;
72
+ for (let source = 0; source < sources; source += 1) {
73
+ const [from, to] = links.linksOf(source);
74
+ for (let at = from; at < to; at += 1) if (kept(source, at, from)) count += 1;
75
+ }
76
+ const bytes = new Uint8Array(edgesHeaderBytes + sources * 8 + 4 + count * 4);
70
77
  const view = new DataView(bytes.buffer);
71
78
  bytes.set(edgesMagic);
72
79
  view.setUint32(4, 1);
73
80
  view.setUint32(8, first);
74
81
  view.setUint32(12, positions);
75
82
  view.setUint32(16, sources);
76
- view.setUint32(20, kept);
83
+ view.setUint32(20, count);
77
84
  const starts = edgesHeaderBytes + sources * 4;
78
85
  const ends = starts + (sources + 1) * 4;
79
86
  let link = 0;
@@ -82,9 +89,8 @@ const edgesFileOf = (key, first, positions, links, targets) => {
82
89
  view.setUint32(starts + source * 4, link);
83
90
  const [from, to] = links.linksOf(source);
84
91
  for (let at = from; at < to; at += 1) {
85
- const target = targets[at] ?? 4294967295;
86
- if (target === 4294967295) continue;
87
- view.setUint32(ends + link * 4, target);
92
+ if (!kept(source, at, from)) continue;
93
+ view.setUint32(ends + link * 4, targets[at] ?? 4294967295);
88
94
  link += 1;
89
95
  }
90
96
  }
@@ -95,7 +101,7 @@ const edgesFileOf = (key, first, positions, links, targets) => {
95
101
  first,
96
102
  positions,
97
103
  sources,
98
- links: kept
104
+ links: count
99
105
  },
100
106
  bytes
101
107
  };