@ref0/git 0.14.0 → 0.20.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 (351) hide show
  1. package/dist/auth/access-jwt.mjs +2 -2
  2. package/dist/auth/authorize.mjs +3 -3
  3. package/dist/auth/fences.d.mts +1 -2
  4. package/dist/auth/fences.mjs +3 -3
  5. package/dist/auth/grants.mjs +4 -4
  6. package/dist/auth/host-function.mjs +18 -1
  7. package/dist/auth/identify.d.mts +1 -1
  8. package/dist/auth/identify.mjs +3 -3
  9. package/dist/auth/token-cleanup.mjs +67 -0
  10. package/dist/auth/token-rows.mjs +1 -1
  11. package/dist/auth/token-text.mjs +9 -1
  12. package/dist/auth/tokens-base.d.mts +35 -0
  13. package/dist/auth/tokens-base.mjs +13 -0
  14. package/dist/auth/tokens-layer.d.mts +2 -27
  15. package/dist/auth/tokens-layer.mjs +6 -11
  16. package/dist/auth/tokens-public.d.mts +3 -3
  17. package/dist/auth/tokens.d.mts +7 -10
  18. package/dist/auth/tokens.mjs +9 -80
  19. package/dist/client/answer.mjs +21 -42
  20. package/dist/client/client.d.mts +2 -4
  21. package/dist/client/git-http.mjs +17 -7
  22. package/dist/client/local.mjs +14 -13
  23. package/dist/client/push-upload.mjs +9 -8
  24. package/dist/client/remote.mjs +8 -10
  25. package/dist/client/run-remote-helper.d.mts +1 -0
  26. package/dist/client/run-remote-helper.mjs +58 -24
  27. package/dist/client/slice-push.d.mts +1 -1
  28. package/dist/client/transport.mjs +105 -46
  29. package/dist/contracts/blobs.d.mts +55 -8
  30. package/dist/contracts/blobs.mjs +16 -2
  31. package/dist/contracts/call-allowance.d.mts +13 -0
  32. package/dist/contracts/call-allowance.mjs +44 -0
  33. package/dist/contracts/calls-spent.mjs +8 -3
  34. package/dist/contracts/client.d.mts +15 -16
  35. package/dist/contracts/commits.d.mts +24 -24
  36. package/dist/contracts/engine.d.mts +6 -1
  37. package/dist/contracts/engine.mjs +10 -1
  38. package/dist/contracts/files.d.mts +10 -10
  39. package/dist/contracts/forks.d.mts +17 -17
  40. package/dist/contracts/git-events.d.mts +29 -1
  41. package/dist/contracts/git-hooks.d.mts +1 -1
  42. package/dist/contracts/git.d.mts +21 -0
  43. package/dist/contracts/grants.d.mts +24 -4
  44. package/dist/contracts/handlers.d.mts +1 -1
  45. package/dist/contracts/lfs.d.mts +28 -2
  46. package/dist/contracts/merges.d.mts +3 -2
  47. package/dist/contracts/objects.d.mts +23 -25
  48. package/dist/contracts/queue.d.mts +40 -12
  49. package/dist/contracts/queue.mjs +3 -4
  50. package/dist/contracts/refs.d.mts +26 -23
  51. package/dist/contracts/remote.d.mts +6 -7
  52. package/dist/contracts/remote.mjs +4 -1
  53. package/dist/contracts/repos.d.mts +29 -138
  54. package/dist/contracts/repos.mjs +5 -3
  55. package/dist/contracts/result.d.mts +35 -16
  56. package/dist/contracts/result.mjs +35 -7
  57. package/dist/contracts/server.d.mts +25 -50
  58. package/dist/contracts/services.d.mts +1 -1
  59. package/dist/contracts/store.d.mts +6 -5
  60. package/dist/contracts/sync.d.mts +11 -7
  61. package/dist/contracts/sync.mjs +12 -2
  62. package/dist/contracts/tags.d.mts +10 -10
  63. package/dist/contracts/time.d.mts +3 -0
  64. package/dist/contracts/{promises.mjs → time.mjs} +1 -1
  65. package/dist/contracts/tokens.d.mts +15 -17
  66. package/dist/contracts/tokens.mjs +3 -2
  67. package/dist/contracts/topics.d.mts +1 -1
  68. package/dist/contracts/trees.d.mts +12 -12
  69. package/dist/contracts/work.d.mts +24 -13
  70. package/dist/core/access.d.mts +1 -2
  71. package/dist/core/access.mjs +20 -9
  72. package/dist/core/ancestry.d.mts +1 -0
  73. package/dist/core/asked.mjs +1 -1
  74. package/dist/core/call-names.mjs +6 -1
  75. package/dist/core/call-services.mjs +11 -3
  76. package/dist/core/events/deliver.d.mts +1 -2
  77. package/dist/core/events/deliver.mjs +43 -36
  78. package/dist/core/events/retired.mjs +119 -0
  79. package/dist/core/forks.mjs +928 -432
  80. package/dist/core/hooks/groups.mjs +1 -1
  81. package/dist/core/imports.mjs +29 -23
  82. package/dist/core/index-job.mjs +122 -34
  83. package/dist/core/index-lost.d.mts +1 -2
  84. package/dist/core/index-lost.mjs +2 -2
  85. package/dist/core/loose-tally.mjs +1 -1
  86. package/dist/core/objects/blobs.mjs +129 -3
  87. package/dist/core/objects/lines.mjs +2 -2
  88. package/dist/core/objects/merges.mjs +4 -1
  89. package/dist/core/objects/objects-layer.d.mts +1 -1
  90. package/dist/core/objects/objects-layer.mjs +3 -3
  91. package/dist/core/objects/reading.mjs +24 -13
  92. package/dist/core/objects/tags.mjs +4 -1
  93. package/dist/core/objects/trees.mjs +2 -2
  94. package/dist/core/objects/writing.mjs +2 -2
  95. package/dist/core/own-writes.mjs +1 -1
  96. package/dist/core/parts.d.mts +4 -5
  97. package/dist/core/parts.mjs +3 -8
  98. package/dist/core/promise.mjs +9 -12
  99. package/dist/core/purge.mjs +287 -83
  100. package/dist/core/push-decide.mjs +2 -0
  101. package/dist/core/push-files.d.mts +1 -1
  102. package/dist/core/push.mjs +58 -47
  103. package/dist/core/receipts.mjs +8 -3
  104. package/dist/core/ref-index-job.mjs +4 -4
  105. package/dist/core/ref-view.mjs +2 -2
  106. package/dist/core/refs.mjs +5 -5
  107. package/dist/core/registered-rows.mjs +2 -2
  108. package/dist/core/repack.mjs +36 -21
  109. package/dist/core/repo-info.mjs +3 -3
  110. package/dist/core/repos.mjs +21 -9
  111. package/dist/core/rules/commit-changes.d.mts +0 -1
  112. package/dist/core/saved-caller-views.d.mts +7 -2
  113. package/dist/core/saved-caller-views.mjs +2 -2
  114. package/dist/core/saved-callers.d.mts +19 -2
  115. package/dist/core/seam.d.mts +16 -26
  116. package/dist/core/seam.mjs +7 -28
  117. package/dist/core/tokens.mjs +1 -1
  118. package/dist/core/view.mjs +7 -15
  119. package/dist/core/work.mjs +59 -14
  120. package/dist/effect.d.mts +3 -12
  121. package/dist/effect.mjs +1 -10
  122. package/dist/engine/failures.mjs +2 -1
  123. package/dist/engine/reads.mjs +4 -4
  124. package/dist/event-streams/stream.d.mts +2 -2
  125. package/dist/event-streams/stream.mjs +37 -14
  126. package/dist/extend.d.mts +2 -3
  127. package/dist/extend.mjs +2 -1
  128. package/dist/http/answers.mjs +8 -5
  129. package/dist/http/core-parts.mjs +95 -79
  130. package/dist/http/handler.mjs +34 -7
  131. package/dist/http/node.d.mts +14 -1
  132. package/dist/http/node.mjs +56 -27
  133. package/dist/http/parts.d.mts +1 -0
  134. package/dist/http/push-upload-job.mjs +30 -26
  135. package/dist/http/push-uploads.mjs +36 -21
  136. package/dist/http/upload-pack.mjs +3 -3
  137. package/dist/index.d.mts +14 -14
  138. package/dist/index.mjs +2 -2
  139. package/dist/lfs/answer.mjs +37 -0
  140. package/dist/lfs/base.d.mts +2 -0
  141. package/dist/lfs/base.mjs +25 -1
  142. package/dist/lfs/copy.d.mts +21 -7
  143. package/dist/lfs/copy.mjs +89 -6
  144. package/dist/lfs/layer.d.mts +15 -1
  145. package/dist/lfs/layer.mjs +24 -11
  146. package/dist/lfs/locks.mjs +2 -2
  147. package/dist/lfs/objects.d.mts +1 -0
  148. package/dist/lfs/objects.mjs +87 -17
  149. package/dist/lfs/pointers.mjs +2 -2
  150. package/dist/lfs/rows.mjs +42 -8
  151. package/dist/lfs/upkeep.mjs +48 -14
  152. package/dist/lfs/wire.mjs +6 -31
  153. package/dist/merges/merges.mjs +2 -2
  154. package/dist/node.d.mts +2 -2
  155. package/dist/protocol/bytes/buffers.mjs +13 -5
  156. package/dist/protocol/bytes/reader.mjs +6 -1
  157. package/dist/protocol/bytes/streams.mjs +27 -1
  158. package/dist/protocol/diff/read.d.mts +4 -3
  159. package/dist/protocol/diff/read.mjs +8 -3
  160. package/dist/protocol/objects/lfs-pointer.d.mts +14 -2
  161. package/dist/protocol/objects/lfs-pointer.mjs +1 -3
  162. package/dist/protocol/objects/links-raw.mjs +24 -10
  163. package/dist/protocol/objects/tag.d.mts +1 -1
  164. package/dist/protocol/objects/tree.mjs +23 -6
  165. package/dist/protocol/packs/delta.d.mts +6 -3
  166. package/dist/protocol/packs/delta.mjs +96 -32
  167. package/dist/protocol/packs/idx.d.mts +2 -1
  168. package/dist/protocol/packs/idx.mjs +22 -3
  169. package/dist/protocol/packs/parts.d.mts +4 -1
  170. package/dist/protocol/packs/parts.mjs +10 -7
  171. package/dist/protocol/packs/reader.d.mts +5 -0
  172. package/dist/protocol/packs/reader.mjs +3 -2
  173. package/dist/protocol/packs/writer.mjs +26 -8
  174. package/dist/queue/advance.mjs +21 -24
  175. package/dist/queue/base.d.mts +55 -0
  176. package/dist/queue/base.mjs +44 -0
  177. package/dist/queue/calls.mjs +51 -54
  178. package/dist/queue/commit.mjs +1 -1
  179. package/dist/queue/host.d.mts +1 -15
  180. package/dist/queue/host.mjs +2 -7
  181. package/dist/queue/layer.d.mts +2 -1
  182. package/dist/queue/layer.mjs +10 -3
  183. package/dist/queue/limits.mjs +2 -0
  184. package/dist/queue/push-option.mjs +9 -24
  185. package/dist/queue/schedule.mjs +1 -1
  186. package/dist/queue/state.mjs +2 -10
  187. package/dist/queue/trim.mjs +5 -3
  188. package/dist/rest/blobs.mjs +29 -5
  189. package/dist/rest/caller.d.mts +4 -4271
  190. package/dist/rest/caller.mjs +4 -0
  191. package/dist/rest/client.d.mts +8 -5
  192. package/dist/rest/client.mjs +19 -2
  193. package/dist/rest/handlers.mjs +50 -5
  194. package/dist/rest/layer.d.mts +2 -2
  195. package/dist/rest/layer.mjs +5 -12
  196. package/dist/rest/me.d.mts +3 -432
  197. package/dist/server/check-fetch.mjs +3 -3
  198. package/dist/server/edge-node.d.mts +11 -8
  199. package/dist/server/edge-node.mjs +9 -6
  200. package/dist/server/edge.d.mts +21 -7
  201. package/dist/server/edge.mjs +32 -11
  202. package/dist/server/extension.mjs +1 -1
  203. package/dist/server/git-layer.d.mts +5 -5
  204. package/dist/server/git-layer.mjs +28 -22
  205. package/dist/server/git-namespace.d.mts +4 -3
  206. package/dist/server/git-namespace.mjs +3 -2
  207. package/dist/server/joined.d.mts +6 -18
  208. package/dist/server/joined.mjs +9 -36
  209. package/dist/server/lifecycle.mjs +18 -106
  210. package/dist/server/registry.mjs +24 -7
  211. package/dist/server/server.mjs +205 -346
  212. package/dist/signin/context.d.mts +1 -2
  213. package/dist/signin/layer.d.mts +1 -1
  214. package/dist/signin/layer.mjs +1 -1
  215. package/dist/storage/allotted.mjs +18 -3
  216. package/dist/storage/batch-upkeep.mjs +274 -0
  217. package/dist/storage/batches.d.mts +8 -0
  218. package/dist/storage/batches.mjs +344 -0
  219. package/dist/storage/calls.d.mts +1 -2
  220. package/dist/storage/calls.mjs +144 -158
  221. package/dist/storage/chunks.d.mts +9 -0
  222. package/dist/storage/chunks.mjs +297 -0
  223. package/dist/storage/clean-up.mjs +72 -9
  224. package/dist/storage/counted-bucket.mjs +4 -4
  225. package/dist/storage/fetch.d.mts +1 -0
  226. package/dist/storage/fetch.mjs +287 -210
  227. package/dist/storage/host-bucket.mjs +1 -2
  228. package/dist/storage/id-mix.mjs +19 -5
  229. package/dist/storage/index-bitmaps.mjs +9 -2
  230. package/dist/storage/index-build.d.mts +0 -1
  231. package/dist/storage/index-build.mjs +80 -23
  232. package/dist/storage/index-fetch.mjs +113 -72
  233. package/dist/storage/index-files.d.mts +3 -0
  234. package/dist/storage/index-files.mjs +10 -5
  235. package/dist/storage/index-graph.mjs +72 -22
  236. package/dist/storage/index-remap.mjs +200 -64
  237. package/dist/storage/index-whole.mjs +127 -0
  238. package/dist/storage/largest-files.mjs +1 -1
  239. package/dist/storage/layout.mjs +23 -0
  240. package/dist/storage/loose.d.mts +7 -4
  241. package/dist/storage/loose.mjs +212 -67
  242. package/dist/storage/memory-budget.mjs +16 -4
  243. package/dist/storage/merge-plan.mjs +3 -2
  244. package/dist/storage/merge-row.mjs +7 -1
  245. package/dist/storage/merge-stream.mjs +164 -25
  246. package/dist/storage/merge-walk.mjs +8 -4
  247. package/dist/storage/merge-write.mjs +1 -1
  248. package/dist/storage/merge.d.mts +1 -1
  249. package/dist/storage/merge.mjs +1 -1
  250. package/dist/storage/object-rows.d.mts +1 -0
  251. package/dist/storage/object-rows.mjs +385 -65
  252. package/dist/storage/oid-table.mjs +171 -0
  253. package/dist/storage/pack-order.mjs +8 -4
  254. package/dist/storage/pack-ranges.d.mts +1 -2
  255. package/dist/storage/pack-ranges.mjs +4 -5
  256. package/dist/storage/pack-reads.d.mts +2 -1
  257. package/dist/storage/pack-reads.mjs +158 -42
  258. package/dist/storage/pack-receive.d.mts +1 -1
  259. package/dist/storage/pack-receive.mjs +2 -2
  260. package/dist/storage/packs.d.mts +1 -1
  261. package/dist/storage/packs.mjs +136 -66
  262. package/dist/storage/placed-reads.mjs +1 -1
  263. package/dist/storage/plan-columns.d.mts +4 -0
  264. package/dist/storage/plan-columns.mjs +238 -0
  265. package/dist/storage/prune-keep.mjs +134 -41
  266. package/dist/storage/prune-walk.mjs +202 -62
  267. package/dist/storage/prune.mjs +194 -91
  268. package/dist/storage/push-allotment.mjs +91 -12
  269. package/dist/storage/push-uploads.mjs +4 -4
  270. package/dist/storage/pushed-commits.mjs +4 -2
  271. package/dist/storage/quarantine.d.mts +1 -1
  272. package/dist/storage/range-cache.mjs +125 -8
  273. package/dist/storage/ready.d.mts +1 -1
  274. package/dist/storage/ready.mjs +8 -6
  275. package/dist/storage/receive-bounds.mjs +23 -8
  276. package/dist/storage/repack-backlog.mjs +6 -3
  277. package/dist/storage/repack.d.mts +1 -1
  278. package/dist/storage/rows.d.mts +1 -1
  279. package/dist/storage/rows.mjs +1 -1
  280. package/dist/storage/runs.mjs +195 -43
  281. package/dist/storage/send-list.d.mts +1 -0
  282. package/dist/storage/send-list.mjs +54 -10
  283. package/dist/storage/single-flight.mjs +13 -7
  284. package/dist/storage/stream-whole.mjs +127 -26
  285. package/dist/storage/unpack.mjs +371 -79
  286. package/dist/storage/visible.mjs +2 -2
  287. package/dist/storage/walk.mjs +192 -38
  288. package/dist/storage/wants.mjs +5 -5
  289. package/dist/store/bodies.mjs +38 -0
  290. package/dist/store/call-count.d.mts +8 -12
  291. package/dist/store/call-count.mjs +34 -46
  292. package/dist/store/catalogue.d.mts +2 -2
  293. package/dist/store/catalogue.mjs +145 -35
  294. package/dist/store/crossing.mjs +1 -3
  295. package/dist/store/cursor-seal.d.mts +1 -2
  296. package/dist/store/cursor-seal.mjs +16 -6
  297. package/dist/store/door.mjs +183 -0
  298. package/dist/store/errors.d.mts +3 -4
  299. package/dist/store/errors.mjs +15 -33
  300. package/dist/store/git-store.mjs +25 -7
  301. package/dist/store/job-try.mjs +9 -32
  302. package/dist/store/list-job.mjs +44 -8
  303. package/dist/store/records.d.mts +3 -0
  304. package/dist/store/records.mjs +3 -0
  305. package/dist/store/repo-record.d.mts +1 -2
  306. package/dist/store/repo-record.mjs +32 -20
  307. package/dist/store/reservations.mjs +1 -1
  308. package/dist/store/scopes.mjs +11 -0
  309. package/dist/store/settle.mjs +4 -4
  310. package/dist/sync/github.mjs +3 -3
  311. package/dist/sync/import.mjs +31 -18
  312. package/dist/sync/lfs-batch.mjs +4 -5
  313. package/dist/sync/lfs-copy.mjs +17 -6
  314. package/dist/sync/mirror.mjs +34 -31
  315. package/dist/sync/said.mjs +16 -37
  316. package/dist/sync/step.mjs +33 -25
  317. package/dist/sync/tries.mjs +9 -9
  318. package/dist/topics/advance.mjs +10 -11
  319. package/dist/topics/base.d.mts +15 -0
  320. package/dist/topics/base.mjs +8 -0
  321. package/dist/topics/host.mjs +1 -1
  322. package/dist/topics/layer.d.mts +4 -9
  323. package/dist/topics/layer.mjs +2 -3
  324. package/dist/topics/members.mjs +4 -4
  325. package/dist/topics/public.d.mts +2 -1
  326. package/dist/topics/topic.mjs +2 -2
  327. package/package.json +5 -4
  328. package/dist/contracts/promises.d.mts +0 -39
  329. package/dist/core/call-names.d.mts +0 -3
  330. package/dist/core/clock.mjs +0 -18
  331. package/dist/lfs/calls.mjs +0 -26
  332. package/dist/rest/api.d.mts +0 -23
  333. package/dist/rest/blobs.d.mts +0 -833
  334. package/dist/rest/commits.d.mts +0 -3543
  335. package/dist/rest/errors.d.mts +0 -2124
  336. package/dist/rest/events.d.mts +0 -426
  337. package/dist/rest/files.d.mts +0 -1342
  338. package/dist/rest/forks.d.mts +0 -2160
  339. package/dist/rest/handlers.d.mts +0 -8
  340. package/dist/rest/merges.d.mts +0 -477
  341. package/dist/rest/queue.d.mts +0 -5917
  342. package/dist/rest/refs.d.mts +0 -2988
  343. package/dist/rest/repos.d.mts +0 -2567
  344. package/dist/rest/tags.d.mts +0 -1316
  345. package/dist/rest/tokens.d.mts +0 -2614
  346. package/dist/rest/topics.d.mts +0 -2224
  347. package/dist/rest/trees.d.mts +0 -1709
  348. package/dist/rest/work.d.mts +0 -1695
  349. package/dist/server/lifecycle.d.mts +0 -2
  350. package/dist/store/promises.d.mts +0 -11
  351. package/dist/store/promises.mjs +0 -327
@@ -1,9 +1,9 @@
1
1
  import { EffectCalls } from "./services.mjs";
2
- import { GitError, Result } from "./result.mjs";
3
2
  import { Caller } from "./actors.mjs";
4
3
  import { Acting } from "./blobs.mjs";
5
4
  import { DiffListing, ReadPage } from "./engine.mjs";
6
5
  import { RepoName } from "./ids.mjs";
6
+ import { GitError } from "./result.mjs";
7
7
  import { TreeEntry } from "./trees.mjs";
8
8
  import * as Effect from "effect/Effect";
9
9
  import * as Schema from "effect/Schema";
@@ -157,13 +157,13 @@ export interface FileCalls {
157
157
  * REST sends with no content and its client streams from the blob route. Its `bytes` limit has
158
158
  * no default for a file's bytes: when the caller sets one, the page's files count against it.
159
159
  */
160
- readonly read: (repo: RepoName, input: Acting<FileReadInput>) => Promise<Result<FilesRead>>;
161
- readonly list: (repo: RepoName, input: Acting<FilesListInput>) => Promise<Result<Listing<TreeEntry>>>;
160
+ readonly read: (repo: RepoName, input: Acting<FileReadInput>) => Effect.Effect<FilesRead, GitError>;
161
+ readonly list: (repo: RepoName, input: Acting<FilesListInput>) => Effect.Effect<Listing<TreeEntry>, GitError>;
162
162
  /** `git diff <base> <head> -- <paths>`, a file at a time: `patch` unless `format` is `hunks`. */
163
- readonly diff: (repo: RepoName, input: Acting<FilesDiffInput>) => Promise<Result<DiffListing<FileDiff>>>;
163
+ readonly diff: (repo: RepoName, input: Acting<FilesDiffInput>) => Effect.Effect<DiffListing<FileDiff>, GitError>;
164
164
  }
165
165
  declare const Files_base: Context.ServiceClass<Files, "@ref0/git/Files", EffectCalls<{
166
- readonly read: (repo: string, input: Acting<FileReadInput>, by?: Caller<unknown> | undefined) => Promise<Result<{
166
+ readonly read: (repo: string, input: Acting<FileReadInput>, by?: Caller<unknown> | undefined) => Effect.Effect<{
167
167
  readonly files: {
168
168
  readonly items: {
169
169
  readonly path: string;
@@ -175,8 +175,8 @@ declare const Files_base: Context.ServiceClass<Files, "@ref0/git/Files", EffectC
175
175
  readonly next?: string;
176
176
  };
177
177
  readonly missing: readonly string[];
178
- }>>;
179
- readonly list: (repo: string, input: Acting<FilesListInput>, by?: Caller<unknown> | undefined) => Promise<Result<Listing<{
178
+ }, GitError, never>;
179
+ readonly list: (repo: string, input: Acting<FilesListInput>, by?: Caller<unknown> | undefined) => Effect.Effect<Listing<{
180
180
  readonly name: string;
181
181
  readonly path: string;
182
182
  readonly mode: string;
@@ -184,8 +184,8 @@ declare const Files_base: Context.ServiceClass<Files, "@ref0/git/Files", EffectC
184
184
  readonly oid: string;
185
185
  readonly size?: number;
186
186
  readonly pathBytes?: Uint8Array<ArrayBufferLike>;
187
- }>>>;
188
- readonly diff: (repo: string, input: Acting<FilesDiffInput>, by?: Caller<unknown> | undefined) => Promise<Result<DiffListing<{
187
+ }>, GitError, never>;
188
+ readonly diff: (repo: string, input: Acting<FilesDiffInput>, by?: Caller<unknown> | undefined) => Effect.Effect<DiffListing<{
189
189
  readonly status: "A" | "D" | "M" | "R" | "T";
190
190
  readonly path: string;
191
191
  readonly from?: string;
@@ -236,7 +236,7 @@ declare const Files_base: Context.ServiceClass<Files, "@ref0/git/Files", EffectC
236
236
  readonly noNewline?: true;
237
237
  }[];
238
238
  }[];
239
- }>>>;
239
+ }>, GitError, never>;
240
240
  }, never>>;
241
241
  /**
242
242
  * A repo's files at a revision: read, listed and compared. `FileCalls` as Effects, each deciding for `by`. The server builds it inside its runtime's
@@ -1,8 +1,8 @@
1
1
  import { EffectCalls } from "./services.mjs";
2
- import { GitError, Result } from "./result.mjs";
3
2
  import { ActorInput, Caller, WriteInput } from "./actors.mjs";
4
3
  import { RepoName } from "./ids.mjs";
5
4
  import { RepoInfo, RepoInput } from "./repos.mjs";
5
+ import { GitError } from "./result.mjs";
6
6
  import * as Effect from "effect/Effect";
7
7
  import * as Schema from "effect/Schema";
8
8
  import { Listing, Page } from "@ref0/infra";
@@ -57,18 +57,18 @@ export interface ForkCalls {
57
57
  * `FAILED_PRECONDITION`, `reason: 'own-repo'`, when the default `id` is `repo` itself, as the
58
58
  * holder's own repo is (Q327).
59
59
  */
60
- readonly create: (repo: RepoName, input: ForkCreateInput) => Promise<Result<RepoInfo>>;
60
+ readonly create: (repo: RepoName, input: ForkCreateInput) => Effect.Effect<RepoInfo, GitError>;
61
61
  /** The holder's fork of `repo`, by the source's internal ID, across either's renames. */
62
- readonly get: (repo: RepoName, input: ForkGetInput) => Promise<Result<RepoInfo>>;
62
+ readonly get: (repo: RepoName, input: ForkGetInput) => Effect.Effect<RepoInfo, GitError>;
63
63
  /**
64
64
  * `repo`'s live forks, the newest first, each named as it's named now. A fork the caller may not
65
65
  * read is left out, and nothing counts it, so a page can be short while `next` says more may
66
66
  * follow. Each `next` is sealed for this source's list and names no fork, and one that isn't a
67
- * `next` of it is `INVALID_ARGUMENT`. Unlike `RepoCalls.list`'s names, each fork is read again
67
+ * `next` of it is `INVALID_ARGUMENT`. Unlike `Repos.list`'s names, each fork is read again
68
68
  * once `authorize` answers, and one renamed or made public or private meanwhile is asked of again
69
69
  * as it is now, so none is listed as it was.
70
70
  */
71
- readonly list: (repo: RepoName, input: ForkListInput) => Promise<Result<Listing<RepoInfo>>>;
71
+ readonly list: (repo: RepoName, input: ForkListInput) => Effect.Effect<Listing<RepoInfo>, GitError>;
72
72
  /**
73
73
  * Fast-forwards the fork's default branch to its source's, in one commit that takes the
74
74
  * source's list as `create` does, and leaves its other refs alone. A fork whose branch has
@@ -78,7 +78,7 @@ export interface ForkCalls {
78
78
  * A fork whose default branch, or its source's, the caller can't see is `FAILED_PRECONDITION`,
79
79
  * naming neither, the same whether or not the branch exists.
80
80
  */
81
- readonly sync: (fork: RepoName, input: WriteInput & Pick<RepoInput, 'internalId'>) => Promise<Result<RepoInfo>>;
81
+ readonly sync: (fork: RepoName, input: WriteInput & Pick<RepoInput, 'internalId'>) => Effect.Effect<RepoInfo, GitError>;
82
82
  /**
83
83
  * Copies every object its source lists into the fork, as `sync` does, and moves no ref, as
84
84
  * `git fetch upstream` does: the caller decides the move, such as `merges.create` of a diverged
@@ -94,10 +94,10 @@ export interface ForkCalls {
94
94
  * leaves no ref at a missing object. Refused as `sync` is, but never `diverged`, nor for a
95
95
  * default branch the caller can't see: `head` is left out instead.
96
96
  */
97
- readonly fetch: (fork: RepoName, input: ActorInput & Pick<RepoInput, 'internalId'>) => Promise<Result<ForkFetched>>;
97
+ readonly fetch: (fork: RepoName, input: ActorInput & Pick<RepoInput, 'internalId'>) => Effect.Effect<ForkFetched, GitError>;
98
98
  }
99
99
  declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectCalls<{
100
- readonly create: (repo: string, input: ForkCreateInput, by?: Caller<unknown> | undefined) => Promise<Result<{
100
+ readonly create: (repo: string, input: ForkCreateInput, by?: Caller<unknown> | undefined) => Effect.Effect<{
101
101
  readonly name: string;
102
102
  readonly defaultBranch?: string;
103
103
  readonly public: boolean;
@@ -124,8 +124,8 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
124
124
  readonly state: "too-large";
125
125
  };
126
126
  };
127
- }>>;
128
- readonly get: (repo: string, input: ForkGetInput, by?: Caller<unknown> | undefined) => Promise<Result<{
127
+ }, GitError, never>;
128
+ readonly get: (repo: string, input: ForkGetInput, by?: Caller<unknown> | undefined) => Effect.Effect<{
129
129
  readonly name: string;
130
130
  readonly defaultBranch?: string;
131
131
  readonly public: boolean;
@@ -152,8 +152,8 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
152
152
  readonly state: "too-large";
153
153
  };
154
154
  };
155
- }>>;
156
- readonly list: (repo: string, input: ForkListInput, by?: Caller<unknown> | undefined) => Promise<Result<Listing<{
155
+ }, GitError, never>;
156
+ readonly list: (repo: string, input: ForkListInput, by?: Caller<unknown> | undefined) => Effect.Effect<Listing<{
157
157
  readonly name: string;
158
158
  readonly defaultBranch?: string;
159
159
  readonly public: boolean;
@@ -180,8 +180,8 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
180
180
  readonly state: "too-large";
181
181
  };
182
182
  };
183
- }>>>;
184
- readonly sync: (fork: string, input: WriteInput<unknown> & Pick<RepoInput, "internalId">, by?: Caller<unknown> | undefined) => Promise<Result<{
183
+ }>, GitError, never>;
184
+ readonly sync: (fork: string, input: WriteInput<unknown> & Pick<RepoInput, "internalId">, by?: Caller<unknown> | undefined) => Effect.Effect<{
185
185
  readonly name: string;
186
186
  readonly defaultBranch?: string;
187
187
  readonly public: boolean;
@@ -208,15 +208,15 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
208
208
  readonly state: "too-large";
209
209
  };
210
210
  };
211
- }>>;
212
- readonly fetch: (fork: string, input: ActorInput<unknown> & Pick<RepoInput, "internalId">, by?: Caller<unknown> | undefined) => Promise<Result<{
211
+ }, GitError, never>;
212
+ readonly fetch: (fork: string, input: ActorInput<unknown> & Pick<RepoInput, "internalId">, by?: Caller<unknown> | undefined) => Effect.Effect<{
213
213
  readonly source: string;
214
214
  readonly head?: string;
215
215
  readonly tips: readonly {
216
216
  readonly name: string;
217
217
  readonly oid: string;
218
218
  }[];
219
- }>>;
219
+ }, GitError, never>;
220
220
  }, never>>;
221
221
  /**
222
222
  * A repo's forks: made, read, listed, and synced with or fetched from their parent. `ForkCalls` as Effects, each deciding for `by`. The server builds it inside its runtime's
@@ -2,7 +2,7 @@ import { GitEvent } from "./events.mjs";
2
2
  import { SavedHandlerOptions } from "./handlers.mjs";
3
3
  import * as Effect from "effect/Effect";
4
4
  declare namespace git_events_d_exports {
5
- export { DeliveryOptions, EventType, Group, GroupHandler, Handlers, Run, group };
5
+ export { DeliveryOptions, EventType, EventsOptions, Group, GroupHandler, Handlers, Run, group };
6
6
  }
7
7
  /** An event's type, such as `ref.updated`. */
8
8
  export type EventType = GitEvent['type'];
@@ -19,6 +19,34 @@ export interface Run<Event extends GitEvent = GitEvent> {
19
19
  * at most for three days by default.
20
20
  */
21
21
  export type DeliveryOptions = Omit<SavedHandlerOptions<unknown>, 'handler'>;
22
+ /**
23
+ * The host's events settings, `Git.layer`'s `events`. `retired` names each delivery the host has
24
+ * dropped for good, at most 64, `retiredLimit`, each under a delivery name's rules. Once each
25
+ * instance is live, it writes the list as its rows in `git/repos`, and deletes the row of a name
26
+ * the list no longer holds, till the write lands or a later start's does. The store orders the
27
+ * starts: a start whose write lands after a later start's writes nothing, and so does one whose
28
+ * list the rows already hold. A name it runs through `Git.addDelivery` too fails the start.
29
+ *
30
+ * A deleted repo's `git.purge` waits on the job of a delivery the server doesn't run, as on any
31
+ * delivery's, until a retirement row names it: then it claims and ends the job, unless a try of it
32
+ * runs. A restore, a start that runs the delivery again, takes effect when its write lands: a
33
+ * purge's end decided before then stands, and a settle it decided can still land after.
34
+ *
35
+ * Never change a name here and its `Git.addDelivery` in the same deploy (#2602). Mid-rollout, the
36
+ * start whose write lands last wins, whatever its list, so an instance that still runs the delivery
37
+ * could find it retired. To retire one, a deploy drops its `Git.addDelivery`, and once that deploy
38
+ * has rolled out, the next adds its name here. A queue claims only the jobs of the deliveries it
39
+ * registers, so an instance that still registers it, mid-deploy, goes on sending to it until it
40
+ * restarts.
41
+ *
42
+ * Retiring gives up what the delivery was owed: the purge settles its job unsent, `repo.deleted`
43
+ * included, and deletes the repo's events. To run it again, a deploy drops its name here, and once
44
+ * that has rolled out, the next adds its `Git.addDelivery` back: it then sends what the repos that
45
+ * remain owe it, and never what a purge settled while it was retired.
46
+ */
47
+ export interface EventsOptions {
48
+ readonly retired?: readonly string[];
49
+ }
22
50
  /** One handler of a group: the types it takes, and what it runs for a run of them. */
23
51
  export interface GroupHandler<R> {
24
52
  readonly types: ReadonlySet<EventType>;
@@ -1,4 +1,4 @@
1
- import { Duration } from "./promises.mjs";
1
+ import { Duration } from "./time.mjs";
2
2
  import { DecisionAnswer, GitError } from "./result.mjs";
3
3
  import { PushContext } from "./rules.mjs";
4
4
  import * as Effect from "effect/Effect";
@@ -1,4 +1,5 @@
1
1
  import { Caller } from "./actors.mjs";
2
+ import { CallAllowance } from "./call-allowance.mjs";
2
3
  import { TreeChange } from "./engine.mjs";
3
4
  import { DeliveryOptions, Group } from "./git-events.mjs";
4
5
  import { GrantResolver } from "./grants.mjs";
@@ -12,6 +13,7 @@ import * as Option from "effect/Option";
12
13
  import { Committed, CurrentJob, Job, Key, Moment, Read, Records, Row, WatchedRow } from "@ref0/infra";
13
14
  import * as Context from "effect/Context";
14
15
  import * as Stream from "effect/Stream";
16
+ import * as Duration from "effect/Duration";
15
17
  /**
16
18
  * The host, acting as itself (Q223): the caller host code's calls name, as `hostCalls()` do. A
17
19
  * call made by it skips the host's `authorize`, but for a push rule's bypass, sees every ref,
@@ -212,6 +214,25 @@ export interface Registration {
212
214
  readonly rows: RegisteredRows;
213
215
  /** Charged records held to the registration's scopes; failures are GitError, outside access a defect. */
214
216
  readonly records: RegisteredRecords;
217
+ /** The server's `basePath`, which Git's routes and a registration's own sit beneath: `''` at the root. */
218
+ readonly basePath: string;
219
+ /**
220
+ * The server's `fetchLimits.milliseconds`: core's purge drops a deleted repo's scopes, the
221
+ * registration's among them, no sooner than this past the delete, so a write that read the repo
222
+ * live and lands by `heldUntil` lands before the drop.
223
+ */
224
+ readonly fetchWindow: Duration.Duration;
225
+ /**
226
+ * Adds `check` to `Git.layer`'s seal, which runs it once every feature has built, after the push
227
+ * rules' sources and before any job registers: a check that dies fails the build with its defect.
228
+ */
229
+ readonly addSealCheck: (check: Effect.Effect<void>) => Effect.Effect<void>;
230
+ /**
231
+ * A fresh budget for one request the registration serves, counting from its first call against
232
+ * the adapter's whole `callLimits`, as Git's REST counts one. Provided as `CallBudget`, it nests
233
+ * every call the request makes.
234
+ */
235
+ readonly allowance: () => CallAllowance;
215
236
  readonly addPushCheck: (check: Hook<PushCheck>) => Effect.Effect<void>;
216
237
  /**
217
238
  * The registration's one delivery, named after it, its job `git.deliver.<registration name>`: `group`'s
@@ -1,4 +1,5 @@
1
- import { Awaitable } from "./result.mjs";
1
+ import { GitError } from "./result.mjs";
2
+ import * as Effect from "effect/Effect";
2
3
  import * as Schema from "effect/Schema";
3
4
  export declare const GrantInput: Schema.Struct<{
4
5
  readonly credentials: Schema.Union<readonly [Schema.Struct<{
@@ -49,7 +50,14 @@ export declare const Grant: Schema.Struct<{
49
50
  * that repo from the list.
50
51
  */
51
52
  readonly reach: Schema.optionalKey<Schema.String>;
52
- readonly reaches: Schema.declare<(input: GrantReachInput) => Awaitable<boolean>, (input: GrantReachInput) => Awaitable<boolean>>;
53
+ /**
54
+ * Whether this grant reaches `input.repo`. Runs in the caller's fiber, so ordinary fiber
55
+ * interruption stops its reads; implementers must also honour `input.signal` (including one
56
+ * already aborted), stop reading, and fail with a typed `UNAVAILABLE` `GitError` on abort
57
+ * (for example, failing immediately when `input.signal.aborted` and otherwise racing the read
58
+ * against an `Effect.callback` listening for `'abort'` with `Effect.raceFirst`).
59
+ */
60
+ readonly reaches: Schema.declare<(input: GrantReachInput) => Effect.Effect<boolean, GitError>, (input: GrantReachInput) => Effect.Effect<boolean, GitError>>;
53
61
  }>;
54
62
  export type Grant = typeof Grant.Type;
55
63
  /** A grant asked for again by the `id` it had, with the actor and subject it acted as then. */
@@ -79,6 +87,18 @@ export type GrantAgainRequest = Omit<GrantAgainInput, 'signal'> & {
79
87
  */
80
88
  export interface GrantResolver {
81
89
  readonly name: string;
82
- readonly resolve: (input: GrantInput) => Awaitable<Grant | undefined>;
83
- readonly again: (input: GrantAgainInput) => Awaitable<Grant | undefined>;
90
+ /**
91
+ * Runs in the caller's fiber, so ordinary fiber interruption stops its reads; implementers must
92
+ * also honour `input.signal` (including one already aborted), stop reading, and fail with a
93
+ * typed `UNAVAILABLE` `GitError` on abort (for example, failing immediately when
94
+ * `input.signal.aborted` and otherwise racing the read against an `Effect.callback` listening
95
+ * for `'abort'` with `Effect.raceFirst`).
96
+ */
97
+ readonly resolve: (input: GrantInput) => Effect.Effect<Grant | undefined, GitError>;
98
+ /**
99
+ * Runs in the caller's fiber, with the same `input.signal` contract as `resolve`: honour an
100
+ * already-aborted or later-aborted signal, stop reading, and fail with a typed `UNAVAILABLE`
101
+ * `GitError`.
102
+ */
103
+ readonly again: (input: GrantAgainInput) => Effect.Effect<Grant | undefined, GitError>;
84
104
  }
@@ -1,4 +1,4 @@
1
- import { Duration } from "./promises.mjs";
1
+ import { Duration } from "./time.mjs";
2
2
  import { Retry } from "@ref0/infra";
3
3
  /** A host function Git calls inside a request or a job, with the length of one try. */
4
4
  export interface HandlerOptions<Handler> {
@@ -2,8 +2,9 @@ import { ActorInput } from "./actors.mjs";
2
2
  import { RepoName } from "./ids.mjs";
3
3
  import "./objects.mjs";
4
4
  import { RepoInput } from "./repos.mjs";
5
- import { Result } from "./result.mjs";
5
+ import { GitError } from "./result.mjs";
6
6
  import { Bytes } from "./object-values.mjs";
7
+ import * as Effect from "effect/Effect";
7
8
  /**
8
9
  * The caps an upload through the server meets, on a bucket that signs no links, so each upload's
9
10
  * bytes stream through it: an upload past what they let finish is refused at the batch, 422, and
@@ -25,6 +26,20 @@ export interface LfsGetInput extends ActorInput, Pick<RepoInput, 'internalId'> {
25
26
  /** The HTTP request the read serves, which the host's fetch rules see: none for a direct read. */
26
27
  readonly request?: Request | undefined;
27
28
  }
29
+ /** LFS objects, each by the oid and size its pointer names: 1 to 1,000, duplicates allowed. */
30
+ export interface LfsGetManyInput extends ActorInput, Pick<RepoInput, 'internalId'> {
31
+ readonly objects: readonly {
32
+ readonly oid: string;
33
+ readonly size: number;
34
+ }[];
35
+ /**
36
+ * What ends the handle: its owner aborts it when the work the read serves ends, answered or not,
37
+ * and an open after it, or opening as it comes, fails `handle-ended`.
38
+ */
39
+ readonly signal: AbortSignal;
40
+ /** The HTTP request the read serves, which the host's fetch rules see: none for a direct read. */
41
+ readonly request?: Request | undefined;
42
+ }
28
43
  /** An LFS object: its oid, its size in bytes, and its bytes, streamed from the bucket. */
29
44
  export interface LfsObject {
30
45
  readonly oid: string;
@@ -39,5 +54,16 @@ export interface LfsCalls {
39
54
  * or on a server without `Lfs.layer()`; `DATA_LOSS` for a listed object whose bytes are gone. `signal`
40
55
  * aborted cancels the bucket's stream.
41
56
  */
42
- readonly get: (repo: RepoName, input: LfsGetInput) => Promise<Result<LfsObject>>;
57
+ readonly get: (repo: RepoName, input: LfsGetInput) => Effect.Effect<LfsObject, GitError>;
58
+ }
59
+ /**
60
+ * What `Lfs.getMany` answered: `readable`, each object the caller may read, by its oid and size,
61
+ * in the order asked, and `open`, which reads one of them from the bucket.
62
+ */
63
+ export interface LfsObjects {
64
+ readonly readable: readonly {
65
+ readonly oid: string;
66
+ readonly size: number;
67
+ }[];
68
+ readonly open: (oid: string) => Effect.Effect<LfsObject, GitError>;
43
69
  }
@@ -1,7 +1,8 @@
1
1
  import { WriteInput } from "./actors.mjs";
2
2
  import { RepoName } from "./ids.mjs";
3
3
  import { RepoInput } from "./repos.mjs";
4
- import { Result } from "./result.mjs";
4
+ import { GitError } from "./result.mjs";
5
+ import * as Effect from "effect/Effect";
5
6
  import * as Schema from "effect/Schema";
6
7
  /**
7
8
  * `git merge --no-ff <theirs>` on the branch `ours`, published there: a merge commit whose
@@ -81,5 +82,5 @@ export declare const MergeAnswer: Schema.Union<readonly [Schema.Struct<{
81
82
  export type MergeAnswer = typeof MergeAnswer.Type;
82
83
  export interface MergeCalls {
83
84
  /** A conflict fails `FAILED_PRECONDITION` with `merge-conflict`, and writes nothing. */
84
- readonly create: (repo: RepoName, input: MergeCreateInput) => Promise<Result<MergeAnswer>>;
85
+ readonly create: (repo: RepoName, input: MergeCreateInput) => Effect.Effect<MergeAnswer, GitError>;
85
86
  }
@@ -1,4 +1,3 @@
1
- import { Clock } from "./promises.mjs";
2
1
  import { CallInput } from "./actors.mjs";
3
2
  import { FencedPack } from "./events.mjs";
4
3
  import { InternalRepoId, Oid } from "./ids.mjs";
@@ -7,6 +6,7 @@ import { RepoStats } from "./repos.mjs";
7
6
  import { GitError, Result } from "./result.mjs";
8
7
  import { EffectCalls } from "./services.mjs";
9
8
  import { GitStore, Holding, Listed, Pack } from "./store.mjs";
9
+ import * as Clock from "effect/Clock";
10
10
  import * as Effect from "effect/Effect";
11
11
  import { Bucket, BucketLinks, BucketUploads, CallLimits, Key, Listing, Moment, Page, Row } from "@ref0/infra";
12
12
  export interface EffectiveLimits {
@@ -648,13 +648,13 @@ export interface ObjectsOpenInput<NeedsBucket extends boolean = boolean> {
648
648
  */
649
649
  readonly store: EffectCalls<GitStore>;
650
650
  readonly bucket: NeedsBucket extends true ? Bucket$1 : Bucket$1 | undefined;
651
- readonly clock: Clock;
651
+ /** The host's Effect `Clock` service (`effect/Clock`). */
652
+ readonly clock: Clock.Clock;
652
653
  readonly fetchLimits: EffectiveLimits;
653
654
  /**
654
- * The most calls a fetch may make: the adapter's `callLimits` less `requestCallsBefore`.
655
- * `packs()` counts a Git fetch's whole request against them, its negotiation with its pack. A
656
- * host's own objects are held to them per fetch, not per request: they're called across a
657
- * Promise, which no request's context crosses (#647, #709).
655
+ * The most calls a fetch may make: the adapter's `callLimits` less `requestCallsBefore`. A Git
656
+ * fetch's whole request counts against them, its negotiation with its pack: each call of the
657
+ * objects runs in its caller's fiber, so its store and bucket calls count into that request.
658
658
  */
659
659
  readonly callLimits?: CallLimits.CallLimits['Service'];
660
660
  }
@@ -670,10 +670,9 @@ export interface ObjectsFactory<NeedsBucket extends boolean = boolean> {
670
670
  */
671
671
  readonly indexed?: true;
672
672
  /**
673
- * The objects for `input`'s server. A host may wrap what `packs()` or `loose()` opens, but a
674
- * member its wrapper replaces with its own function doesn't count its store calls toward a
675
- * request's limits: Git's core calls it across its Promise. A spread that keeps the member, as
676
- * `{ ...opened }` does, keeps them counted.
673
+ * The objects for `input`'s server. A host may wrap what `packs()` or `loose()` opens, or bring
674
+ * its own: each call is an Effect Git's core runs in its caller's fiber, so the store and bucket
675
+ * calls it makes count toward the caller's request, and an interrupt stops it.
677
676
  */
678
677
  readonly open: (input: ObjectsOpenInput<NeedsBucket>) => GitObjects;
679
678
  }
@@ -753,9 +752,8 @@ export interface PushedCommitsInput extends CallInput {
753
752
  readonly page?: Page;
754
753
  }
755
754
  /**
756
- * A server's opened objects, over each repo's `Listed`. A host's own are held to `callLimits` per
757
- * fetch, not per request: they're called across a Promise, which no request's context crosses,
758
- * so only `packs()`' count a Git fetch's negotiation with its pack (#709).
755
+ * A server's opened objects, over each repo's `Listed`, each call an Effect run in its caller's
756
+ * fiber: its store and bucket calls count into the caller's request, and an interrupt stops it.
759
757
  */
760
758
  export interface GitObjects {
761
759
  /**
@@ -777,7 +775,7 @@ export interface GitObjects {
777
775
  * never keeps it past its request or shares it between requests. Every read of the repo's
778
776
  * objects is through a reader: a call that reads one object opens a reader of its own for it.
779
777
  */
780
- readonly reader: (listed: Listed, input?: ObjectReaderInput) => Promise<Result<ObjectReader>>;
778
+ readonly reader: (listed: Listed, input?: ObjectReaderInput) => Effect.Effect<ObjectReader, GitError>;
781
779
  /**
782
780
  * The commits a push brings, a page at a time, each once: those in its received packs, then
783
781
  * those among its rows. A commit the client sent again is listed too: stock Git resends one the
@@ -786,15 +784,15 @@ export interface GitObjects {
786
784
  * push's list, never all of it, so a walk of the push's commits needs no set of those it has
787
785
  * seen. Every implementation serves it: a push's file rules read it.
788
786
  */
789
- readonly pushedCommits: (listed: Listed, input: PushedCommitsInput) => Promise<Result<Listing<PushedCommit>>>;
790
- readonly receive: (listed: Listed, input: ReceiveInput) => Promise<Result<Quarantine>>;
787
+ readonly pushedCommits: (listed: Listed, input: PushedCommitsInput) => Effect.Effect<Listing<PushedCommit>, GitError>;
788
+ readonly receive: (listed: Listed, input: ReceiveInput) => Effect.Effect<Quarantine, GitError>;
791
789
  /**
792
790
  * An import segment's pack staged under a quarantine of its own, its trailer checked, for its
793
791
  * receive a step at a time: `packs()` stages it in its bucket. A pack cut short, past its
794
792
  * `atMost`, or with a wrong trailer stages nothing. A host's own objects that omit `stage`
795
793
  * receive each segment in one invocation, through `receive`, as before.
796
794
  */
797
- readonly stage?: (listed: Listed, input: StageInput) => Promise<Result<Staged>>;
795
+ readonly stage?: (listed: Listed, input: StageInput) => Effect.Effect<Staged, GitError>;
798
796
  /**
799
797
  * One step of a staged segment's receive, within one invocation: it goes on from where the last
800
798
  * step paused, and pauses again or ends with the pack received, as `receive` ends it. A step
@@ -802,22 +800,22 @@ export interface GitObjects {
802
800
  * no try of that segment lands; a join refused `too-large` keeps it, for a try with more calls.
803
801
  * A host's own objects that omit it receive each segment through `receive`, as `stage` says.
804
802
  */
805
- readonly receiveStep?: (listed: Listed, input: StepInput) => Promise<Result<StepAnswer>>;
806
- readonly fetch: (listed: Listed, input: ObjectsFetchInput) => Promise<Result<FetchAnswer>>;
807
- readonly maintain: (listed: Listed, input: MaintainInput) => Promise<Result<ObjectsStep | undefined>>;
803
+ readonly receiveStep?: (listed: Listed, input: StepInput) => Effect.Effect<StepAnswer, GitError>;
804
+ readonly fetch: (listed: Listed, input: ObjectsFetchInput) => Effect.Effect<FetchAnswer, GitError>;
805
+ readonly maintain: (listed: Listed, input: MaintainInput) => Effect.Effect<ObjectsStep | undefined, GitError>;
808
806
  /**
809
807
  * Keeps each of `listed`'s packs for `input.into` before a fork's commit lists them: `packs()`
810
808
  * puts a marker on each, named by the fork's internal ID, so a source that lets one go leaves
811
809
  * its bytes to the fork. `loose()` has no packs, and does nothing.
812
810
  */
813
- readonly share: (listed: Listed, input: ShareInput) => Promise<Result<void>>;
811
+ readonly share: (listed: Listed, input: ShareInput) => Effect.Effect<void, GitError>;
814
812
  /**
815
813
  * Whether each of `input.holdings`' holders holds every object of the pack it names, by their
816
814
  * `.idx` IDs: in order, within `input.most` reads, each holder's read once against all it names.
817
815
  * A fork's sync unlists a copy only once it's walked held (Q903). `loose()` has no packs, and
818
816
  * none.
819
817
  */
820
- readonly holdings?: (listed: Listed, input: HoldingsInput) => Promise<Result<HoldingsWalked>>;
818
+ readonly holdings?: (listed: Listed, input: HoldingsInput) => Effect.Effect<HoldingsWalked, GitError>;
821
819
  /**
822
820
  * A page of `listed`'s object rows at its version, in ID order, after `input.after`: of those,
823
821
  * the rows `input.lacking` doesn't hold, read by the page's IDs, when it's given. A fork's
@@ -825,14 +823,14 @@ export interface GitObjects {
825
823
  * (`no-copy-rows`). A view narrowed to a caller's set (`IndexedObjects.seen`) hasn't it: a copy
826
824
  * reads the whole repo.
827
825
  */
828
- readonly copyRows?: (listed: Listed, input: CopyRowsInput) => Promise<Result<CopyRowsPage>>;
826
+ readonly copyRows?: (listed: Listed, input: CopyRowsInput) => Effect.Effect<CopyRowsPage, GitError>;
829
827
  /** The reachability index's build (#597). `loose()` keeps no index, and has none. */
830
828
  readonly index?: IndexCalls;
831
829
  }
832
830
  /** The reachability index's build, as `git.index` and the commits that save it call it. */
833
831
  export interface IndexCalls {
834
832
  /** One `git.index` try: the next step of the build under way in `input.data`, or a new one. */
835
- readonly step: (listed: Listed, input: IndexTryInput) => Promise<Result<IndexTry>>;
833
+ readonly step: (listed: Listed, input: IndexTryInput) => Effect.Effect<IndexTry, GitError>;
836
834
  /**
837
835
  * What the repo's `index` row, `row`, says at `at` with `packs` listed, by their IDs: what a
838
836
  * ref-moving commit saves, or why none. A refusal of a slice of a pack stands while that pack
@@ -850,7 +848,7 @@ export interface IndexCalls {
850
848
  * bitmaps, within the read's allotment, once an instance. A tip the index doesn't hold, as a
851
849
  * push's before its update, is walked until it meets the index.
852
850
  */
853
- readonly reach: (listed: Listed, input: IndexReachInput) => Promise<Result<IndexReached>>;
851
+ readonly reach: (listed: Listed, input: IndexReachInput) => Effect.Effect<IndexReached, GitError>;
854
852
  }
855
853
  /**
856
854
  * The index's answer to a want check: `answers` as `IndexCalls.reach` says, and `pastLimit`, the
@@ -1,10 +1,9 @@
1
1
  import { ActorInput, Caller, WriteInput } from "./actors.mjs";
2
2
  import { ByCalls, EffectCalls } from "./services.mjs";
3
- import { Awaitable, DecisionAnswer, GitError, Result } from "./result.mjs";
4
- import { Duration } from "./promises.mjs";
5
- import { TreeChange } from "./engine.mjs";
3
+ import { Duration } from "./time.mjs";
6
4
  import { RefName, RepoName } from "./ids.mjs";
7
5
  import { RepoInput } from "./repos.mjs";
6
+ import { DecisionAnswer, GitError, Result } from "./result.mjs";
8
7
  import * as Effect from "effect/Effect";
9
8
  import * as Schema from "effect/Schema";
10
9
  import { Listing, Page } from "@ref0/infra";
@@ -342,10 +341,9 @@ export declare const JoinInput: Schema.Struct<{
342
341
  readonly priority: Schema.optionalKey<Schema.Number>;
343
342
  readonly meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
344
343
  }>;
345
- readonly signal: Schema.declare<AbortSignal, AbortSignal>;
346
344
  }>;
347
345
  export type JoinInput = typeof JoinInput.Type;
348
- /** `changes()`: the head's tree against the target's, computed once when asked. */
346
+ /** `changes`: the head's tree against the target's, diffed on its first run and kept for the rest. */
349
347
  export declare const LanesInput: Schema.Struct<{
350
348
  readonly actor: Schema.Union<readonly [Schema.Struct<{
351
349
  readonly id: Schema.String;
@@ -365,8 +363,37 @@ export declare const LanesInput: Schema.Struct<{
365
363
  readonly priority: Schema.optionalKey<Schema.Number>;
366
364
  readonly meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
367
365
  }>;
368
- readonly signal: Schema.declare<AbortSignal, AbortSignal>;
369
- readonly changes: Schema.declare<() => Promise<readonly TreeChange[]>, () => Promise<readonly TreeChange[]>>;
366
+ readonly changes: Schema.declare<Effect.Effect<readonly {
367
+ readonly status: "A" | "D" | "M" | "R" | "T";
368
+ readonly path: string;
369
+ readonly from?: string;
370
+ readonly similarity?: number;
371
+ readonly old?: {
372
+ readonly mode: string;
373
+ readonly oid: string;
374
+ };
375
+ readonly new?: {
376
+ readonly mode: string;
377
+ readonly oid: string;
378
+ };
379
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
380
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
381
+ }[], GitError, never>, Effect.Effect<readonly {
382
+ readonly status: "A" | "D" | "M" | "R" | "T";
383
+ readonly path: string;
384
+ readonly from?: string;
385
+ readonly similarity?: number;
386
+ readonly old?: {
387
+ readonly mode: string;
388
+ readonly oid: string;
389
+ };
390
+ readonly new?: {
391
+ readonly mode: string;
392
+ readonly oid: string;
393
+ };
394
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
395
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
396
+ }[], GitError, never>>;
370
397
  }>;
371
398
  export type LanesInput = typeof LanesInput.Type;
372
399
  /**
@@ -402,9 +429,10 @@ export interface ReportOptions {
402
429
  readonly timeout?: Duration;
403
430
  }
404
431
  /**
405
- * The host's queue. Each function is pure but `join` and `lanes`, whose I/O gets a signal, aborted
406
- * after 30 seconds. A throw in `merge` or `lanes` fails the entry `host-error`; one in `bisect` or
407
- * a schedule function takes the default. Either is logged at `Error`, as `queue.merge` and the rest.
432
+ * The host's queue. Each function is pure but `join` and `lanes`, Effects that may do I/O, each
433
+ * interrupted after 30 seconds. A throw in `merge`, or a failure or defect of `lanes`, fails the
434
+ * entry `host-error`; a throw in `bisect` or a schedule function takes the default. Either is
435
+ * logged at `Error`, as `queue.merge` and the rest.
408
436
  */
409
437
  export interface MergeQueueOptions {
410
438
  /**
@@ -416,7 +444,7 @@ export interface MergeQueueOptions {
416
444
  readonly keys: QueueKeys;
417
445
  readonly merge: (input: MergeInput) => MergePlan;
418
446
  /** Whether an entry may join: a `Reject` refuses `add` and the push option with it. */
419
- readonly join?: (input: JoinInput) => Awaitable<DecisionAnswer>;
447
+ readonly join?: (input: JoinInput) => Effect.Effect<DecisionAnswer, GitError>;
420
448
  /**
421
449
  * The lanes an entry checks in: at most 8, each once, and each 1 to 64 bytes counted as UTF-8
422
450
  * JSON, quotes aside, so a control character counts 6. An answer past that fails the entry
@@ -436,7 +464,7 @@ export interface MergeQueueOptions {
436
464
  * merged judged `lane`. A land that conflicts restarts the candidate; at the land-restart limit,
437
465
  * 3, its entries are pinned, and one pinned candidate holds every lane until it ends.
438
466
  */
439
- readonly lanes?: (input: LanesInput) => Awaitable<LanesAnswer>;
467
+ readonly lanes?: (input: LanesInput) => Effect.Effect<LanesAnswer, GitError>;
440
468
  /** By default, halves the failed candidate. */
441
469
  readonly bisect?: Bisect;
442
470
  /**
@@ -2,7 +2,7 @@ import { Actor, ActorId } from "./actors.mjs";
2
2
  import { CommitMessage } from "./commits.mjs";
3
3
  import { Commit } from "./engine.mjs";
4
4
  import { Oid, RefName, RepoName } from "./ids.mjs";
5
- import { AbortSignalValue, FunctionValue } from "./opaque.mjs";
5
+ import { EffectValue } from "./opaque.mjs";
6
6
  import "./repos.mjs";
7
7
  import { Verdict, decisionAnswer } from "./result.mjs";
8
8
  import * as Effect from "effect/Effect";
@@ -188,10 +188,9 @@ Schema.Array(Commit);
188
188
  const JoinInput = /* @__PURE__ */ Schema.Struct({
189
189
  actor: Actor,
190
190
  repo: RepoName,
191
- entry: EntryFields,
192
- signal: AbortSignalValue
191
+ entry: EntryFields
193
192
  });
194
- ({ ...JoinInput.fields }), FunctionValue();
193
+ ({ ...JoinInput.fields }), EffectValue();
195
194
  /** One bisect group: at least one entry, none named twice. */
196
195
  const EntryGroup = /* @__PURE__ */ Schema.Array(EntryId).check(Schema.isMinLength(1), Schema.makeFilter((group) => new Set(group).size === group.length || "a bisect group names no entry twice"));
197
196
  /**