@ref0/git 0.4.0 → 0.7.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 (463) hide show
  1. package/dist/access/namespace.d.mts +2 -0
  2. package/dist/access/private-refs.d.mts +6 -29
  3. package/dist/access/private-refs.mjs +31 -17
  4. package/dist/access/public.d.mts +6 -0
  5. package/dist/access/public.mjs +9 -0
  6. package/dist/auth/access-jwt.d.mts +10 -6
  7. package/dist/auth/access-jwt.mjs +59 -40
  8. package/dist/auth/auth-namespace.d.mts +6 -0
  9. package/dist/auth/auth-namespace.mjs +12 -0
  10. package/dist/auth/auth.d.mts +3 -6
  11. package/dist/auth/auth.mjs +2 -9
  12. package/dist/auth/authorize.mjs +13 -9
  13. package/dist/auth/fences.d.mts +1 -1
  14. package/dist/auth/host-function.mjs +17 -8
  15. package/dist/auth/identify.d.mts +5 -3
  16. package/dist/auth/identify.mjs +2 -1
  17. package/dist/auth/namespaces.d.mts +2 -2
  18. package/dist/auth/token-rows.mjs +1 -1
  19. package/dist/auth/tokens-layer.d.mts +42 -0
  20. package/dist/auth/tokens-layer.mjs +29 -0
  21. package/dist/auth/tokens-namespace.d.mts +2 -0
  22. package/dist/auth/tokens-public.d.mts +6 -0
  23. package/dist/auth/tokens-public.mjs +29 -0
  24. package/dist/auth/tokens.d.mts +13 -6
  25. package/dist/auth/tokens.mjs +13 -12
  26. package/dist/auth.d.mts +2 -2
  27. package/dist/auth.mjs +2 -2
  28. package/dist/client/git-http.mjs +1 -1
  29. package/dist/client/local.mjs +6 -3
  30. package/dist/client/remote-helper.mjs +3 -8
  31. package/dist/client/remote.mjs +26 -7
  32. package/dist/client/run-remote-helper.d.mts +1 -1
  33. package/dist/client/run-remote-helper.mjs +2 -2
  34. package/dist/client/slice-push.d.mts +1 -1
  35. package/dist/contracts/access.d.mts +24 -12
  36. package/dist/contracts/access.mjs +17 -0
  37. package/dist/contracts/actors.d.mts +17 -1
  38. package/dist/contracts/actors.mjs +8 -1
  39. package/dist/contracts/authorize.d.mts +21 -14
  40. package/dist/contracts/blobs.d.mts +1 -1
  41. package/dist/contracts/blobs.mjs +1 -1
  42. package/dist/contracts/calls-spent.d.mts +6 -4
  43. package/dist/contracts/calls-spent.mjs +10 -8
  44. package/dist/contracts/commits.d.mts +2 -2
  45. package/dist/contracts/commits.mjs +1 -1
  46. package/dist/contracts/engine.d.mts +1 -1
  47. package/dist/contracts/events.d.mts +64 -26
  48. package/dist/contracts/events.mjs +26 -6
  49. package/dist/contracts/files.d.mts +2 -2
  50. package/dist/contracts/files.mjs +1 -1
  51. package/dist/contracts/forks.d.mts +58 -58
  52. package/dist/contracts/forks.mjs +1 -1
  53. package/dist/contracts/git-events.d.mts +50 -0
  54. package/dist/contracts/git-events.mjs +23 -0
  55. package/dist/contracts/git-hooks.d.mts +37 -0
  56. package/dist/contracts/git-hooks.mjs +10 -0
  57. package/dist/contracts/git.d.mts +138 -22
  58. package/dist/contracts/git.mjs +6 -5
  59. package/dist/contracts/grants.d.mts +6 -1
  60. package/dist/contracts/ids.d.mts +16 -0
  61. package/dist/contracts/ids.mjs +19 -4
  62. package/dist/contracts/lfs.d.mts +7 -2
  63. package/dist/contracts/namespaces.d.mts +2 -2
  64. package/dist/contracts/objects.d.mts +7 -2
  65. package/dist/contracts/opaque.mjs +9 -0
  66. package/dist/contracts/operations.d.mts +293 -100
  67. package/dist/contracts/promises.d.mts +4 -14
  68. package/dist/contracts/push-uploads.d.mts +5 -2
  69. package/dist/contracts/push-uploads.mjs +9 -4
  70. package/dist/contracts/queue.d.mts +233 -54
  71. package/dist/contracts/queue.mjs +81 -6
  72. package/dist/contracts/refs.d.mts +30 -8
  73. package/dist/contracts/refs.mjs +1 -1
  74. package/dist/contracts/remote.d.mts +42 -21
  75. package/dist/contracts/remote.mjs +22 -0
  76. package/dist/contracts/repo-records.d.mts +2 -2
  77. package/dist/contracts/repos.d.mts +126 -79
  78. package/dist/contracts/repos.mjs +43 -5
  79. package/dist/contracts/result.d.mts +50 -31
  80. package/dist/contracts/result.mjs +48 -16
  81. package/dist/contracts/rules.d.mts +50 -44
  82. package/dist/contracts/rules.mjs +5 -1
  83. package/dist/contracts/server.d.mts +282 -191
  84. package/dist/contracts/services.d.mts +1 -7
  85. package/dist/contracts/services.mjs +1 -3
  86. package/dist/contracts/signin.d.mts +140 -43
  87. package/dist/contracts/signin.mjs +35 -1
  88. package/dist/contracts/store.d.mts +1 -1
  89. package/dist/contracts/sync.d.mts +112 -90
  90. package/dist/contracts/sync.mjs +34 -7
  91. package/dist/contracts/tags.d.mts +1 -1
  92. package/dist/contracts/tags.mjs +1 -1
  93. package/dist/contracts/tokens.d.mts +232 -57
  94. package/dist/contracts/tokens.mjs +80 -19
  95. package/dist/contracts/topics.d.mts +22 -10
  96. package/dist/contracts/topics.mjs +6 -3
  97. package/dist/contracts/trees.d.mts +2 -2
  98. package/dist/contracts/trees.mjs +1 -1
  99. package/dist/contracts/work.d.mts +3 -3
  100. package/dist/contracts/work.mjs +2 -2
  101. package/dist/core/access.d.mts +10 -10
  102. package/dist/core/access.mjs +47 -8
  103. package/dist/core/call-names.d.mts +3 -1
  104. package/dist/core/clock.mjs +1 -1
  105. package/dist/core/events/deliver.d.mts +13 -0
  106. package/dist/core/events/deliver.mjs +475 -175
  107. package/dist/core/events/seen.mjs +17 -3
  108. package/dist/core/forks.mjs +131 -44
  109. package/dist/core/hooks/groups.d.mts +27 -0
  110. package/dist/core/hooks/groups.mjs +74 -0
  111. package/dist/core/hooks/namespace.d.mts +2 -0
  112. package/dist/core/hooks/order.d.mts +2 -2
  113. package/dist/core/hooks/order.mjs +6 -6
  114. package/dist/core/hooks/public.d.mts +7 -0
  115. package/dist/core/hooks/public.mjs +5 -0
  116. package/dist/core/imports.mjs +94 -10
  117. package/dist/core/index-job.mjs +31 -22
  118. package/dist/core/merge-parts.d.mts +1 -1
  119. package/dist/core/merge-parts.mjs +1 -1
  120. package/dist/core/mirror-rows.mjs +18 -0
  121. package/dist/core/names.mjs +1 -1
  122. package/dist/core/namespaces.d.mts +2 -1
  123. package/dist/core/objects/commit-writes.mjs +5 -5
  124. package/dist/core/objects/merges.mjs +1 -1
  125. package/dist/core/objects/objects-layer.mjs +1 -1
  126. package/dist/core/objects/reading.mjs +52 -7
  127. package/dist/core/objects/tree-edits.mjs +13 -28
  128. package/dist/core/objects/trees.mjs +4 -4
  129. package/dist/core/objects/writing.mjs +3 -3
  130. package/dist/core/own-writes.mjs +1 -1
  131. package/dist/core/parts.d.mts +27 -2
  132. package/dist/core/parts.mjs +5 -3
  133. package/dist/core/promise.mjs +23 -3
  134. package/dist/core/purge.d.mts +8 -0
  135. package/dist/core/purge.mjs +91 -46
  136. package/dist/core/push-decide.mjs +26 -4
  137. package/dist/core/push.mjs +104 -86
  138. package/dist/core/receipts.d.mts +2 -2
  139. package/dist/core/receipts.mjs +28 -4
  140. package/dist/core/ref-index-job.mjs +10 -15
  141. package/dist/core/ref-index.d.mts +1 -0
  142. package/dist/core/ref-index.mjs +28 -8
  143. package/dist/core/ref-view.mjs +16 -11
  144. package/dist/core/refs.mjs +54 -21
  145. package/dist/core/registered-records.mjs +30 -0
  146. package/dist/core/registered-rows.d.mts +4 -0
  147. package/dist/core/registered-rows.mjs +53 -0
  148. package/dist/core/repack.d.mts +3 -2
  149. package/dist/core/repack.mjs +70 -120
  150. package/dist/core/repo-info.mjs +59 -25
  151. package/dist/core/repos.mjs +22 -16
  152. package/dist/core/rules/changes.mjs +2 -2
  153. package/dist/core/rules/check.mjs +7 -6
  154. package/dist/core/rules/commit-changes.mjs +1 -1
  155. package/dist/core/rules/context.d.mts +4 -5
  156. package/dist/core/rules/context.mjs +3 -4
  157. package/dist/core/rules/fetch.mjs +74 -21
  158. package/dist/core/saved-caller-views.d.mts +72 -0
  159. package/dist/core/saved-caller-views.mjs +123 -0
  160. package/dist/core/saved-callers-public.d.mts +5 -0
  161. package/dist/core/saved-callers-public.mjs +10 -0
  162. package/dist/core/saved-callers.mjs +95 -0
  163. package/dist/core/seam.d.mts +67 -9
  164. package/dist/core/seam.mjs +11 -3
  165. package/dist/core/still-takes.mjs +75 -0
  166. package/dist/core/tokens.mjs +5 -1
  167. package/dist/core/view.d.mts +2 -1
  168. package/dist/core/view.mjs +9 -10
  169. package/dist/core/work.mjs +6 -5
  170. package/dist/effect.d.mts +2 -2
  171. package/dist/effect.mjs +2 -2
  172. package/dist/engine/content.d.mts +2 -2
  173. package/dist/engine/content.mjs +1 -1
  174. package/dist/engine/diff.mjs +2 -2
  175. package/dist/engine/merge-base-walk.d.mts +2 -2
  176. package/dist/engine/merge-base-walk.mjs +1 -1
  177. package/dist/engine/merge-renames.mjs +1 -1
  178. package/dist/engine/reads.d.mts +2 -2
  179. package/dist/engine/reads.mjs +1 -1
  180. package/dist/engine/xdiff.d.mts +1 -1
  181. package/dist/engine/xdiff.mjs +2 -2
  182. package/dist/event-streams/event-streams.d.mts +6 -2
  183. package/dist/event-streams/event-streams.mjs +6 -2
  184. package/dist/event-streams/stream.mjs +5 -2
  185. package/dist/extend.d.mts +5 -4
  186. package/dist/extend.mjs +3 -2
  187. package/dist/http/answers.mjs +4 -3
  188. package/dist/http/core-parts.mjs +21 -13
  189. package/dist/http/handler.mjs +3 -3
  190. package/dist/http/node.d.mts +2 -23
  191. package/dist/http/parts.d.mts +2 -0
  192. package/dist/http/push-uploads.d.mts +10 -2
  193. package/dist/http/push-uploads.mjs +38 -39
  194. package/dist/http/receive-pack.mjs +8 -6
  195. package/dist/http/upload-pack.mjs +8 -7
  196. package/dist/index.d.mts +36 -19
  197. package/dist/index.mjs +14 -6
  198. package/dist/lfs/base.d.mts +32 -0
  199. package/dist/lfs/base.mjs +8 -0
  200. package/dist/lfs/calls.mjs +22 -12
  201. package/dist/lfs/layer.d.mts +28 -0
  202. package/dist/lfs/layer.mjs +65 -0
  203. package/dist/lfs/locks.mjs +16 -30
  204. package/dist/lfs/namespace.d.mts +2 -0
  205. package/dist/lfs/objects.d.mts +26 -6
  206. package/dist/lfs/objects.mjs +197 -98
  207. package/dist/lfs/pointers.mjs +8 -6
  208. package/dist/lfs/public.d.mts +5 -0
  209. package/dist/lfs/public.mjs +8 -0
  210. package/dist/lfs/purge.mjs +19 -25
  211. package/dist/lfs/rows.mjs +22 -10
  212. package/dist/lfs/service.d.mts +9 -4
  213. package/dist/lfs/service.mjs +3 -12
  214. package/dist/lfs/upkeep.mjs +45 -56
  215. package/dist/lfs/wire.mjs +1 -1
  216. package/dist/node.d.mts +3 -2
  217. package/dist/node.mjs +1 -1
  218. package/dist/protocol/bytes/buffers.d.mts +1 -1
  219. package/dist/protocol/bytes/buffers.mjs +1 -1
  220. package/dist/protocol/bytes/deflate.d.mts +1 -1
  221. package/dist/protocol/bytes/deflate.mjs +1 -1
  222. package/dist/protocol/bytes/hmac-sha256.mjs +3 -6
  223. package/dist/protocol/bytes/inflate.d.mts +1 -1
  224. package/dist/protocol/bytes/inflate.mjs +1 -1
  225. package/dist/protocol/bytes/sha1.d.mts +1 -1
  226. package/dist/protocol/bytes/sha1.mjs +2 -2
  227. package/dist/protocol/diff/read.d.mts +1 -1
  228. package/dist/protocol/diff/read.mjs +1 -1
  229. package/dist/protocol/diff/tree-diff.d.mts +1 -1
  230. package/dist/protocol/diff/tree-diff.mjs +11 -11
  231. package/dist/protocol/objects/lfs-pointer.mjs +6 -1
  232. package/dist/protocol/objects/tag.mjs +1 -1
  233. package/dist/protocol/objects/tree.mjs +1 -1
  234. package/dist/protocol/packs/graph.mjs +1 -1
  235. package/dist/protocol/packs/idx.d.mts +1 -1
  236. package/dist/protocol/packs/idx.mjs +1 -1
  237. package/dist/protocol/packs/parts.mjs +1 -1
  238. package/dist/protocol/packs/reader.d.mts +1 -1
  239. package/dist/protocol/packs/reader.mjs +2 -2
  240. package/dist/protocol/packs/write-error.d.mts +1 -1
  241. package/dist/protocol/packs/write-error.mjs +1 -1
  242. package/dist/protocol/packs/writer.mjs +4 -4
  243. package/dist/protocol/wire/advertisement.d.mts +5 -11
  244. package/dist/protocol/wire/advertisement.mjs +17 -13
  245. package/dist/protocol/wire/fetch.d.mts +1 -1
  246. package/dist/protocol/wire/fetch.mjs +1 -1
  247. package/dist/protocol/wire/lines.d.mts +14 -2
  248. package/dist/protocol/wire/lines.mjs +32 -21
  249. package/dist/protocol/wire/push-uploads.mjs +4 -2
  250. package/dist/protocol/wire/receive-pack.d.mts +1 -1
  251. package/dist/protocol/wire/receive-pack.mjs +1 -1
  252. package/dist/protocol/wire/report-status.d.mts +1 -1
  253. package/dist/protocol/wire/report-status.mjs +1 -1
  254. package/dist/protocol/wire/v2.d.mts +5 -16
  255. package/dist/protocol/wire/v2.mjs +17 -15
  256. package/dist/queue/advance.mjs +227 -112
  257. package/dist/queue/callers.mjs +56 -69
  258. package/dist/queue/calls.mjs +24 -13
  259. package/dist/queue/commit.mjs +20 -7
  260. package/dist/queue/host.d.mts +12 -13
  261. package/dist/queue/host.mjs +15 -7
  262. package/dist/queue/lanes.mjs +9 -18
  263. package/dist/queue/layer.d.mts +6 -4
  264. package/dist/queue/layer.mjs +17 -11
  265. package/dist/queue/limits.mjs +53 -11
  266. package/dist/queue/rows.mjs +19 -15
  267. package/dist/queue/schedule.mjs +6 -5
  268. package/dist/queue/search.mjs +8 -13
  269. package/dist/queue/state.mjs +26 -7
  270. package/dist/queue/steps.mjs +10 -4
  271. package/dist/queue/trim.mjs +289 -0
  272. package/dist/rest/api.d.mts +1 -1
  273. package/dist/rest/blobs.d.mts +35 -35
  274. package/dist/rest/caller.d.mts +22 -20
  275. package/dist/rest/client.mjs +6 -6
  276. package/dist/rest/commits.d.mts +274 -274
  277. package/dist/rest/errors.d.mts +10 -10
  278. package/dist/rest/errors.mjs +1 -1
  279. package/dist/rest/events.d.mts +13 -11
  280. package/dist/rest/events.mjs +3 -1
  281. package/dist/rest/files.d.mts +78 -78
  282. package/dist/rest/forks.d.mts +170 -170
  283. package/dist/rest/handler.mjs +17 -8
  284. package/dist/rest/handlers.mjs +13 -7
  285. package/dist/rest/layer.d.mts +14 -0
  286. package/dist/rest/layer.mjs +53 -0
  287. package/dist/rest/listen.mjs +2 -2
  288. package/dist/rest/me.d.mts +18 -20
  289. package/dist/rest/me.mjs +1 -1
  290. package/dist/rest/merges.d.mts +10 -10
  291. package/dist/rest/namespace.d.mts +2 -0
  292. package/dist/rest/queue.d.mts +320 -320
  293. package/dist/rest/queue.mjs +1 -1
  294. package/dist/rest/refs.d.mts +207 -207
  295. package/dist/rest/refs.mjs +1 -1
  296. package/dist/rest/repos.d.mts +127 -127
  297. package/dist/rest/tags.d.mts +94 -94
  298. package/dist/rest/tokens.d.mts +248 -258
  299. package/dist/rest/tokens.mjs +10 -42
  300. package/dist/rest/topics.d.mts +154 -154
  301. package/dist/rest/topics.mjs +1 -1
  302. package/dist/rest/trees.d.mts +84 -84
  303. package/dist/rest/wire.d.mts +8 -4
  304. package/dist/rest/wire.mjs +3 -2
  305. package/dist/rest/work.d.mts +69 -69
  306. package/dist/rest/work.mjs +1 -1
  307. package/dist/server/check-fetch.mjs +9 -0
  308. package/dist/server/edge-node.d.mts +20 -0
  309. package/dist/server/edge-node.mjs +20 -0
  310. package/dist/server/edge.d.mts +10 -0
  311. package/dist/server/edge.mjs +23 -0
  312. package/dist/server/extension.mjs +3 -115
  313. package/dist/server/git-layer.d.mts +34 -6
  314. package/dist/server/git-layer.mjs +40 -18
  315. package/dist/server/git-namespace.d.mts +5 -4
  316. package/dist/server/git-namespace.mjs +10 -5
  317. package/dist/server/joined.d.mts +83 -0
  318. package/dist/server/joined.mjs +91 -0
  319. package/dist/server/registry.d.mts +9 -2
  320. package/dist/server/registry.mjs +179 -24
  321. package/dist/server/routes.mjs +2 -2
  322. package/dist/server/server.d.mts +11 -1
  323. package/dist/server/server.mjs +331 -201
  324. package/dist/server/uploads.d.mts +14 -0
  325. package/dist/server/uploads.mjs +15 -0
  326. package/dist/signin/context.d.mts +2 -1
  327. package/dist/signin/context.mjs +32 -37
  328. package/dist/signin/device.mjs +5 -5
  329. package/dist/signin/forms.mjs +1 -1
  330. package/dist/signin/grants.d.mts +2 -3
  331. package/dist/signin/grants.mjs +5 -5
  332. package/dist/signin/layer.d.mts +9 -0
  333. package/dist/signin/layer.mjs +41 -0
  334. package/dist/signin/namespace.d.mts +2 -0
  335. package/dist/signin/public.d.mts +6 -0
  336. package/dist/signin/public.mjs +5 -0
  337. package/dist/signin/route.mjs +47 -21
  338. package/dist/signin/web.mjs +3 -3
  339. package/dist/signin/wire.mjs +1 -1
  340. package/dist/storage/calls.d.mts +7 -8
  341. package/dist/storage/calls.mjs +17 -17
  342. package/dist/storage/clean-up.mjs +71 -34
  343. package/dist/storage/counted-bucket.mjs +34 -51
  344. package/dist/storage/fetch.mjs +1 -1
  345. package/dist/storage/host-bucket.mjs +17 -2
  346. package/dist/storage/index-build.d.mts +2 -2
  347. package/dist/storage/index-build.mjs +3 -3
  348. package/dist/storage/index-fetch.mjs +10 -6
  349. package/dist/storage/index-graph.mjs +1 -1
  350. package/dist/storage/index-layers.mjs +1 -1
  351. package/dist/storage/index-visible.mjs +1 -1
  352. package/dist/storage/layout.mjs +5 -0
  353. package/dist/storage/memory-budget.mjs +7 -1
  354. package/dist/storage/merge-cut.mjs +24 -1
  355. package/dist/storage/merge-fence.mjs +1 -1
  356. package/dist/storage/merge-plan.mjs +5 -2
  357. package/dist/storage/merge-row.mjs +1 -1
  358. package/dist/storage/merge-stream.mjs +16 -7
  359. package/dist/storage/merge-write.mjs +1 -1
  360. package/dist/storage/merge.d.mts +2 -2
  361. package/dist/storage/merge.mjs +1 -1
  362. package/dist/storage/object-rows.d.mts +2 -2
  363. package/dist/storage/object-rows.mjs +3 -3
  364. package/dist/storage/pack-ranges.d.mts +3 -1
  365. package/dist/storage/pack-ranges.mjs +168 -69
  366. package/dist/storage/pack-reads.mjs +4 -4
  367. package/dist/storage/pack-receive.d.mts +1 -1
  368. package/dist/storage/pack-receive.mjs +7 -9
  369. package/dist/storage/packs.d.mts +1 -1
  370. package/dist/storage/packs.mjs +45 -52
  371. package/dist/storage/placed-reads.mjs +81 -15
  372. package/dist/storage/prune-seen.mjs +126 -0
  373. package/dist/storage/prune-walk.mjs +87 -99
  374. package/dist/storage/prune.mjs +49 -14
  375. package/dist/storage/push-uploads.mjs +16 -18
  376. package/dist/storage/quarantine.d.mts +2 -2
  377. package/dist/storage/quarantine.mjs +51 -12
  378. package/dist/storage/ready.d.mts +2 -2
  379. package/dist/storage/ready.mjs +3 -3
  380. package/dist/storage/receive-bounds.d.mts +1 -1
  381. package/dist/storage/receive-files.mjs +1 -1
  382. package/dist/storage/receive-links.mjs +1 -1
  383. package/dist/storage/receive-state.d.mts +2 -2
  384. package/dist/storage/receive-state.mjs +1 -1
  385. package/dist/storage/receive-steps.mjs +1 -1
  386. package/dist/storage/repack-contained.mjs +2 -2
  387. package/dist/storage/repack-job.d.mts +2 -2
  388. package/dist/storage/repack-job.mjs +11 -17
  389. package/dist/storage/repack.d.mts +1 -1
  390. package/dist/storage/repack.mjs +9 -3
  391. package/dist/storage/rows.d.mts +2 -2
  392. package/dist/storage/rows.mjs +43 -4
  393. package/dist/storage/runs.d.mts +2 -2
  394. package/dist/storage/runs.mjs +15 -6
  395. package/dist/storage/send-list.mjs +6 -6
  396. package/dist/storage/single-flight.mjs +2 -2
  397. package/dist/storage/swap-walk.mjs +1 -1
  398. package/dist/storage/unpack.mjs +1 -1
  399. package/dist/store/call-count.d.mts +1 -1
  400. package/dist/store/call-count.mjs +125 -34
  401. package/dist/store/catalogue.d.mts +1 -1
  402. package/dist/store/catalogue.mjs +2 -2
  403. package/dist/store/crossing.mjs +2 -6
  404. package/dist/store/cursor-seal.mjs +1 -1
  405. package/dist/store/errors.d.mts +7 -3
  406. package/dist/store/errors.mjs +41 -13
  407. package/dist/store/job-try.mjs +130 -0
  408. package/dist/store/list-job.mjs +22 -16
  409. package/dist/store/outbox.d.mts +2 -2
  410. package/dist/store/outbox.mjs +112 -27
  411. package/dist/store/promises.d.mts +8 -3
  412. package/dist/store/promises.mjs +104 -94
  413. package/dist/store/queue-jobs.mjs +23 -2
  414. package/dist/store/records.d.mts +2 -2
  415. package/dist/store/records.mjs +16 -24
  416. package/dist/store/ref-rows.d.mts +2 -2
  417. package/dist/store/ref-rows.mjs +6 -6
  418. package/dist/store/reservations.mjs +35 -8
  419. package/dist/store/scopes.mjs +6 -14
  420. package/dist/store/topic-jobs.mjs +8 -8
  421. package/dist/sync/bound.d.mts +1 -3
  422. package/dist/sync/bound.mjs +30 -42
  423. package/dist/sync/bridge.d.mts +6 -0
  424. package/dist/sync/bridge.mjs +29 -0
  425. package/dist/sync/github.d.mts +5 -6
  426. package/dist/sync/github.mjs +37 -42
  427. package/dist/sync/http.mjs +15 -0
  428. package/dist/sync/import.mjs +17 -18
  429. package/dist/sync/layer.d.mts +9 -0
  430. package/dist/sync/layer.mjs +68 -0
  431. package/dist/sync/mirror.mjs +138 -59
  432. package/dist/sync/publish.mjs +15 -13
  433. package/dist/sync/step.mjs +221 -79
  434. package/dist/sync/tries.mjs +22 -15
  435. package/dist/sync.d.mts +3 -6
  436. package/dist/sync.mjs +3 -6
  437. package/dist/topics/advance.mjs +205 -90
  438. package/dist/topics/calls.mjs +8 -8
  439. package/dist/topics/directory.mjs +35 -12
  440. package/dist/topics/host.d.mts +5 -8
  441. package/dist/topics/host.mjs +42 -19
  442. package/dist/topics/layer.d.mts +381 -0
  443. package/dist/topics/layer.mjs +62 -0
  444. package/dist/topics/members.mjs +1 -1
  445. package/dist/topics/namespace.d.mts +2 -0
  446. package/dist/topics/public.d.mts +6 -0
  447. package/dist/topics/public.mjs +13 -0
  448. package/dist/topics/rows.mjs +12 -3
  449. package/dist/topics/topic.mjs +11 -10
  450. package/package.json +8 -13
  451. package/dist/access.d.mts +0 -2
  452. package/dist/access.mjs +0 -1
  453. package/dist/core/hooks/post-receive.mjs +0 -213
  454. package/dist/core/hooks/pre-receive.d.mts +0 -12
  455. package/dist/core/hooks/pre-receive.mjs +0 -36
  456. package/dist/lfs/repo.mjs +0 -42
  457. package/dist/server/extension.d.mts +0 -21
  458. package/dist/storage/promise-calls.mjs +0 -29
  459. package/dist/sync/import.d.mts +0 -10
  460. package/dist/sync/jobs.d.mts +0 -9
  461. package/dist/sync/jobs.mjs +0 -75
  462. package/dist/sync/mirror.d.mts +0 -13
  463. package/dist/sync/publish.d.mts +0 -6
@@ -1,23 +1,31 @@
1
1
  import { SyncSource } from "../contracts/sync.mjs";
2
2
  import { KeptError, keptError } from "./receipts.mjs";
3
+ import { SavedCaller } from "./saved-callers.mjs";
3
4
  import { hexOf } from "../protocol/bytes/hex.mjs";
4
5
  import { oidBytes } from "../protocol/packs/idx.mjs";
5
6
  import { decodeRow, storeCall } from "../store/errors.mjs";
6
7
  import { importJobName } from "../store/records.mjs";
8
+ import { refRowBytes, storesPeel } from "../store/ref-rows.mjs";
7
9
  import { isPackId } from "../storage/layout.mjs";
8
10
  import { receiveKey } from "../storage/receive-steps.mjs";
9
11
  import { collections, newChangeId, repoScope } from "../store/scopes.mjs";
10
12
  import { gitError } from "../contracts/result.mjs";
11
- import * as Schema from "effect/Schema";
12
13
  import * as Effect from "effect/Effect";
14
+ import * as Schema from "effect/Schema";
13
15
  import * as Result from "effect/Result";
16
+ import { jsonBytes } from "@ref0/infra";
14
17
  import * as Base64 from "effect/encoding/Base64";
15
18
  // src/core/imports.ts
16
19
  /**
17
20
  * An import's own record, `imports/self` in its repo's scope, written by the create that starts it
18
21
  * and by each step's commit, so a try after a crash goes on from the last step that landed:
19
- * - `tips`: the remote's branches and tags as the import's first step listed them, each moved
20
- * to its tip by the last step, `publish`;
22
+ * - `tipPages`: how many pages of tips the import's first step listed, the remote's branches and
23
+ * tags, each moved to its tip by the last step, `publish`, a page at a time, as `TipPage` says;
24
+ * none until that step lands;
25
+ * - `publishedPages`: how many of those pages `publish` has moved, the cursor each page's commit
26
+ * moves with its refs;
27
+ * - `head`: the branch the remote's `HEAD` named at that listing, kept only when it's one of
28
+ * the tips, which `publish` makes the repo's default branch, in the last page's commit;
21
29
  * - `roots`: where the history copied so far stops, the remote's `shallow` lines; `deepest`, how
22
30
  * many commits from each tip it holds; `step`, how many more the next segment asks for;
23
31
  * - `copied`: whether the history is whole, so the next step publishes;
@@ -45,14 +53,21 @@ const ImportReceiving = /* @__PURE__ */ Schema.Struct({
45
53
  bytes: Schema.Int
46
54
  })
47
55
  });
56
+ /**
57
+ * An import's record. `by`: who started it, as `SavedCaller` keeps them, asked again before each
58
+ * step, so the import fetches, publishes and offers the remote only what they may still see.
59
+ */
48
60
  const ImportRow = /* @__PURE__ */ Schema.Struct({
49
61
  source: SyncSource,
62
+ by: SavedCaller,
50
63
  state: Schema.Literals([
51
64
  "running",
52
65
  "done",
53
66
  "failed"
54
67
  ]),
55
- tips: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
68
+ tipPages: Schema.optionalKey(Schema.Int),
69
+ publishedPages: Schema.optionalKey(Schema.Int),
70
+ head: Schema.optionalKey(Schema.String),
56
71
  roots: Schema.Array(Schema.String),
57
72
  deepest: Schema.Int,
58
73
  step: Schema.Int,
@@ -99,11 +114,80 @@ const cutKey = {
99
114
  id: "cut"
100
115
  };
101
116
  /**
117
+ * One page of the tips the import's listing kept, `imports/tip/<page>` beside its record: each ref
118
+ * by name, to the OID `publish` moves it to. The listing packs them by their bytes and by the most
119
+ * one push moves, as `tipPagesOf` says, so the record stays small whatever the remote holds, and
120
+ * each page's refs move in one commit with the cursor.
121
+ */
122
+ const TipPage = /* @__PURE__ */ Schema.Record(Schema.String, Schema.String);
123
+ /** Page `page`'s key, zero-padded so the pages list in their order. */
124
+ const tipPageKey = (page) => ({
125
+ collection: collections.imports,
126
+ id: `tip/${String(page).padStart(4, "0")}`
127
+ });
128
+ const tipPageRow = (page, tips) => ({
129
+ ...tipPageKey(page),
130
+ value: tips
131
+ });
132
+ /** The keys of pages `from` to `to`, `to` left out. */
133
+ const tipPageKeys = (from, to) => Array.from({ length: Math.max(0, to - from) }, (_, at) => tipPageKey(from + at));
134
+ /**
102
135
  * What every end of an import deletes in the commit that ends it, publish's, a failure's and a
103
- * cancel's: each key it keeps only while it runs, its cut and the record of the segment `row` is
104
- * receiving in steps, whose keys the quarantine's clean-up takes.
136
+ * cancel's: each key it keeps only while it runs, its cut, the record of the segment `row` is
137
+ * receiving in steps, whose keys the quarantine's clean-up takes, and the pages of tips it hasn't
138
+ * published.
139
+ */
140
+ const importEndDeletes = (row) => [
141
+ { ...cutKey },
142
+ ...row?.receiving === void 0 ? [] : [receiveKey(row.receiving.pack)],
143
+ ...tipPageKeys(row?.publishedPages ?? 0, row?.tipPages ?? 0)
144
+ ];
145
+ const pageMissing = (page) => gitError("DATA_LOSS", `The import's page ${page} of tips is gone`, { hint: failedHint });
146
+ /** Pages `from` to `to` of the import's tips, `to` left out, in one read. */
147
+ const readTipPages = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId, from, to) {
148
+ const keys = tipPageKeys(from, to);
149
+ if (keys.length === 0) return [];
150
+ const snapshot = yield* storeCall(() => store.read(repoScope(internalId), keys));
151
+ return yield* Effect.forEach(snapshot.results, ([held], at) => held === void 0 ? Effect.fail(pageMissing(from + at)) : decodeRow(TipPage, held, "Import tip page"));
152
+ });
153
+ /**
154
+ * The bytes the ref row a tip of `ref` puts takes, as `refBytesMost` counts it: a tag's with its
155
+ * peel, its most, since the listing doesn't say which tags are annotated. Its entry in a page
156
+ * takes 42 bytes less, its comma included.
105
157
  */
106
- const importEndDeletes = (row) => row?.receiving === void 0 ? [{ ...cutKey }] : [{ ...cutKey }, receiveKey(row.receiving.pack)];
158
+ const tipRowBytes = (ref, oid) => refRowBytes(ref, storesPeel(ref) ? {
159
+ oid,
160
+ peeled: oid
161
+ } : { oid });
162
+ /** A tip's entry in its page, as UTF-8 JSON: its name, `:`, its OID. */
163
+ const entryBytes = (ref, oid) => jsonBytes(ref) + 1 + jsonBytes(oid);
164
+ /**
165
+ * `tips` packed into pages: each at most `most` entries and, as UTF-8 JSON, `bytes` with its braces
166
+ * and commas, unless one entry alone is past it. `last`'s entry, the head the import adopts, goes on
167
+ * the last page, so the record's fence and the default's move stay in the commit that ends the
168
+ * import.
169
+ */
170
+ const tipPagesOf = (tips, last, limits) => {
171
+ const ordered = [...tips.filter(([ref]) => ref !== last), ...tips.filter(([ref]) => ref === last)];
172
+ const pages = [];
173
+ let page = {};
174
+ let count = 0;
175
+ let bytes = 2;
176
+ for (const [ref, oid] of ordered) {
177
+ const size = entryBytes(ref, oid);
178
+ if (count > 0 && (count >= limits.most || bytes + 1 + size > limits.bytes)) {
179
+ pages.push(page);
180
+ page = {};
181
+ count = 0;
182
+ bytes = 2;
183
+ }
184
+ bytes += (count === 0 ? 0 : 1) + size;
185
+ count += 1;
186
+ page[ref] = oid;
187
+ }
188
+ if (count > 0) pages.push(page);
189
+ return pages;
190
+ };
107
191
  /** `cut` as its row, beside `roots`: none of their parents are anywhere but in it. */
108
192
  const cutRow = (roots, cut) => {
109
193
  const parents = roots.flatMap((root) => cut[root] ?? []);
@@ -163,7 +247,7 @@ const readImport = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalI
163
247
  };
164
248
  });
165
249
  /**
166
- * `ExtendedGit.importState`: the repo's import as its row and cancel row hold it, in one read, or
250
+ * `JoinedCalls.importState`: the repo's import as its row and cancel row hold it, in one read, or
167
251
  * `undefined` for a repo no import made. A running row whose job has gone stays `running`: this
168
252
  * read writes nothing, where `importLive` commits it `failed`.
169
253
  */
@@ -172,7 +256,7 @@ const importStateOf = /* @__PURE__ */ Effect.fnUntraced(function* (store, intern
172
256
  if (row === void 0) return void 0;
173
257
  return row.state === "running" && cancelled ? "cancelled" : row.state;
174
258
  });
175
- /** Whether the repo's `git.sync.import` job is waiting or running: a try is due or under way. */
259
+ /** Whether the repo's `sync.import` job is waiting or running: a try is due or under way. */
176
260
  const jobLive = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId) {
177
261
  const scope = repoScope(internalId);
178
262
  let after;
@@ -209,4 +293,4 @@ const importLive = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalI
209
293
  }
210
294
  return true;
211
295
  });
212
- export { ImportReceiving, ImportRow, cancelKey, cutKey, cutRow, failedHint, failedRow, importEndDeletes, importKey, importLive, importRow, importStateOf, readImport, stoppedTry };
296
+ export { ImportReceiving, ImportRow, cancelKey, cutKey, cutRow, failedHint, failedRow, importEndDeletes, importKey, importLive, importRow, importStateOf, readImport, readTipPages, stoppedTry, tipPageKey, tipPageRow, tipPagesOf, tipRowBytes };
@@ -1,20 +1,21 @@
1
+ import { keepsEvents } from "../contracts/events.mjs";
1
2
  import { indexRowOf } from "../storage/index-build.mjs";
2
3
  import { liftsHolds } from "../storage/index-remap.mjs";
3
4
  import { indexRowKey } from "../storage/layout.mjs";
4
5
  import { resultCall, storeCall } from "../store/errors.mjs";
5
- import { runJobTry } from "../store/crossing.mjs";
6
6
  import { decodePacks } from "../store/git-store.mjs";
7
7
  import { appendEvents, decodeOutbox, outboxReads, repoEnvelope } from "../store/outbox.mjs";
8
8
  import { WholeRepo, wholeRefs } from "../store/ref-rows.mjs";
9
9
  import { readRecord } from "../store/repo-record.mjs";
10
+ import { budgetedInput } from "../store/call-count.mjs";
11
+ import { gitJob } from "../store/job-try.mjs";
10
12
  import { collections, jobRepo, newChangeId, repoScope } from "../store/scopes.mjs";
11
13
  import { settleName } from "../store/settle.mjs";
12
14
  import { SealedObjects } from "./view.mjs";
13
15
  import { fail } from "../contracts/result.mjs";
14
- import { defineJob } from "@ref0/infra";
15
- import * as Schema from "effect/Schema";
16
16
  import * as Effect from "effect/Effect";
17
- import * as Option from "effect/Option";
17
+ import * as Schema from "effect/Schema";
18
+ import { CurrentJob, Job } from "@ref0/infra";
18
19
  import * as DateTime from "effect/DateTime";
19
20
  // src/core/index-job.ts
20
21
  /**
@@ -46,8 +47,6 @@ const roundOf = (key) => {
46
47
  const round = Number(key.slice(6));
47
48
  return Number.isSafeInteger(round) && round > 0 ? round : 0;
48
49
  };
49
- const indexJobSchema = /* @__PURE__ */ Schema.toStandardSchemaV1(IndexJobData);
50
- const decodeIndexJobData = /* @__PURE__ */ Schema.decodeUnknownOption(IndexJobData);
51
50
  /**
52
51
  * The build reads every ref, private or not: its index answers for the repo's objects, as upkeep
53
52
  * keeps them, whoever fetches.
@@ -99,18 +98,19 @@ const indexAttempt = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store,
99
98
  at,
100
99
  lastCheck
101
100
  });
101
+ const stepOf = (asked) => Effect.flatMap(budgetedInput(asked.input), (input) => resultCall(() => index.step(asked.listed, input)));
102
102
  const first = yield* read();
103
103
  if (first === void 0) return {
104
104
  ended: "none",
105
105
  next: void 0
106
106
  };
107
- const asked = yield* resultCall(() => index.step(first.listed, first.input));
107
+ const asked = yield* stepOf(first);
108
108
  const tried = asked.kind === "moved" ? yield* read(true) : first;
109
109
  if (tried === void 0) return {
110
110
  ended: "none",
111
111
  next: void 0
112
112
  };
113
- const step = tried === first ? asked : yield* resultCall(() => index.step(tried.listed, tried.input));
113
+ const step = tried === first ? asked : yield* stepOf(tried);
114
114
  if (step.kind === "moved") return yield* fail("INTERNAL", "The host's IndexCalls answered moved to a last check");
115
115
  const { record, snapshot, listed, packs, row, headRows, cursorRows } = tried;
116
116
  if (step.kind === "more") return {
@@ -132,7 +132,7 @@ const indexAttempt = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store,
132
132
  const ids = packs.map(({ id }) => id);
133
133
  const landed = index.status(step.row, at, ids);
134
134
  const refusal = refusalOf(landed, index.status(row, at, ids));
135
- const sends = refusal !== void 0 && parts.events !== void 0 && record.deleted !== true;
135
+ const sends = refusal !== void 0 && keepsEvents(parts.events) && record.deleted !== true;
136
136
  const events = sends ? [refusedEvent(record.name, refusal)] : [];
137
137
  const outbox = yield* decodeOutbox([headRows, cursorRows]);
138
138
  const settling = {
@@ -181,7 +181,7 @@ const refusedEvent = (repo, refusal) => ({
181
181
  * one version, and the step's input over them. `undefined` for a repo with no record.
182
182
  */
183
183
  const readTry = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, internalId, of) {
184
- const reads = parts.events === void 0 ? tryReads : eventReads;
184
+ const reads = keepsEvents(parts.events) ? eventReads : tryReads;
185
185
  const { record, snapshot } = yield* readRecord(store, internalId, reads);
186
186
  if (record === void 0) return void 0;
187
187
  const [, refRows = [], packRows = [], indexRows = [], headRows = [], cursorRows = []] = snapshot.results;
@@ -218,10 +218,14 @@ const readTry = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, inter
218
218
  /** `indexAttempt`, as the queue takes it. */
219
219
  const indexTry = (...args) => Effect.map(indexAttempt(...args), (attempt) => attempt.next);
220
220
  /** `git.index`'s try, in the repo's scope: a step of the build, or past its tries, the refusal. */
221
- const indexHandler = (parts) => (job, context) => runJobTry(Option.match(decodeIndexJobData(job.data), {
222
- onNone: () => fail("DATA_LOSS", "The index job's data is unreadable"),
223
- onSome: (data) => job.attempt > 20 ? refusalTry(parts, job, context, data, spentReason(lastOf(job))) : indexTry(parts, context.store, jobRepo(job), data, context.signal, roundOf(job.key))
224
- }));
221
+ const indexStep = (parts) => (data) => Effect.flatMap(Effect.all([
222
+ CurrentJob.current,
223
+ CurrentJob.store,
224
+ CurrentJob.signal
225
+ ]), ([job, store, signal]) => job.attempt > 20 ? refusalTry(parts, job, {
226
+ store,
227
+ signal
228
+ }, data, spentReason(lastOf(job))) : indexTry(parts, store, jobRepo(job), data, signal, roundOf(job.key)));
225
229
  /** How the build's last try ended, as the first refusal try's claim says: later ones can't. */
226
230
  const lastOf = (job) => {
227
231
  if (job.attempt > 21) return "its refusal tried again";
@@ -260,7 +264,14 @@ const refusalTry = /* @__PURE__ */ Effect.fnUntraced(function* (parts, job, cont
260
264
  * its failure logged. A round left failed with no refused row is one an operator's `retry` starts
261
265
  * again, since no refusal stands for its try to prune against.
262
266
  */
263
- const indexFailed = (parts) => (job, failure, context) => runJobTry(Effect.catch(refusalTry(parts, job, context, Option.getOrElse(decodeIndexJobData(job.data), () => ({})), spentReason(failure.error instanceof Error ? failure.error.message : String(failure.error))), (error) => Effect.logError(`git.index left repo ${jobRepo(job)} failed, with no refusal: ${error.message}`)).pipe(Effect.asVoid));
267
+ const indexFailed = (parts) => (data, failure) => Effect.flatMap(Effect.all([
268
+ CurrentJob.current,
269
+ CurrentJob.store,
270
+ CurrentJob.signal
271
+ ]), ([job, store, signal]) => Effect.catch(refusalTry(parts, job, {
272
+ store,
273
+ signal
274
+ }, data, spentReason(failure.error instanceof Error ? failure.error.message : String(failure.error))), (error) => Effect.logError(`git.index left repo ${jobRepo(job)} failed, with no refusal: ${error.message}`)).pipe(Effect.asVoid));
264
275
  /** How many times a refusal's try reads and writes the refused row before it fails. */
265
276
  const refusalWrites = 3;
266
277
  /**
@@ -269,9 +280,8 @@ const refusalWrites = 3;
269
280
  * row, the next tries leave a refused row, and `indexFailed` is their last chance. One at a time
270
281
  * in each process, as `git.repack` runs.
271
282
  */
272
- const indexJob = (parts) => defineJob({
273
- name: indexJobName,
274
- schema: indexJobSchema,
283
+ const IndexJob = /* @__PURE__ */ Job.make(indexJobName, {
284
+ payload: IndexJobData,
275
285
  timeout: "13 minutes",
276
286
  concurrency: 1,
277
287
  retry: {
@@ -279,13 +289,12 @@ const indexJob = (parts) => defineJob({
279
289
  delay: "1 second",
280
290
  backoff: "exponential",
281
291
  maxDelay: "5 minutes"
282
- },
283
- handler: indexHandler(parts),
284
- onFailure: indexFailed(parts)
292
+ }
285
293
  });
294
+ const indexJob = (parts) => gitJob(IndexJob, indexStep(parts), { onFailure: indexFailed(parts) });
286
295
  /** The repo's `git.index` row for `round`, or for its delete, due now. */
287
296
  const indexJobRow = (job, round = 0) => job.job({
288
297
  key: indexJobKeyOf(round),
289
298
  data: {}
290
299
  });
291
- export { IndexJobData, indexDeletedKey, indexHandler, indexJob, indexJobKey, indexJobKeyOf, indexJobName, indexJobRow };
300
+ export { IndexJobData, indexDeletedKey, indexJob, indexJobKey, indexJobKeyOf, indexJobName, indexJobRow };
@@ -3,8 +3,8 @@ import { GitError } from "../contracts/result.mjs";
3
3
  import "../engine/parts.mjs";
4
4
  import { RepoView, ViewRead } from "./view.mjs";
5
5
  import * as Effect from "effect/Effect";
6
- import * as Context from "effect/Context";
7
6
  import "effect/Option";
7
+ import * as Context from "effect/Context";
8
8
  /** What `MergesService.merge` merges: three trees, read as `view`'s caller reads them at `at`. */
9
9
  export interface MergeInput {
10
10
  readonly view: RepoView;
@@ -1,7 +1,7 @@
1
1
  import { gitError } from "../contracts/result.mjs";
2
2
  import * as Effect from "effect/Effect";
3
- import * as Context from "effect/Context";
4
3
  import * as Option from "effect/Option";
4
+ import * as Context from "effect/Context";
5
5
  // src/core/merge-parts.ts
6
6
  /**
7
7
  * Git's three-way merge and line diff, over xdiff: what a host provides with `Merges.layer` to
@@ -0,0 +1,18 @@
1
+ import { MirrorPause, MirrorPush, SyncSource } from "../contracts/sync.mjs";
2
+ import { SavedCaller } from "./saved-callers.mjs";
3
+ import * as Schema from "effect/Schema";
4
+ // src/core/mirror-rows.ts
5
+ /**
6
+ * A mirror's row in `mirrors`, by its ref's full name: where it pushes, by provider name, whether
7
+ * it's paused and why, `lastPushed`, the last push the destination took, and `by`, who saved it,
8
+ * whom each try asks again before it reads the ref. A push that moves the ref saves the mirror's
9
+ * job while it's `active`.
10
+ */
11
+ const MirrorRow = /* @__PURE__ */ Schema.Struct({
12
+ destination: SyncSource,
13
+ state: Schema.Literals(["active", "paused"]),
14
+ paused: Schema.optionalKey(MirrorPause),
15
+ lastPushed: Schema.optionalKey(MirrorPush),
16
+ by: SavedCaller
17
+ });
18
+ export { MirrorRow };
@@ -9,7 +9,7 @@ const refPart = /^[^\0-\x20\x7f~^:?*[\\]+$/;
9
9
  */
10
10
  const isRefName = (name) => {
11
11
  if (!name.startsWith("refs/") || name.endsWith("/") || name.endsWith(".")) return false;
12
- if (name.length > 1024 || utf8(name).length > 1024) return false;
12
+ if (name.length > 768 || utf8(name).length > 768) return false;
13
13
  if (name.includes("..") || name.includes("@{") || name === "@") return false;
14
14
  return name.split("/").every((part) => refPart.test(part) && !part.startsWith(".") && !part.endsWith(".lock"));
15
15
  };
@@ -1,2 +1,3 @@
1
1
  import { objects_namespace_d_exports } from "./objects/objects-namespace.mjs";
2
- export { objects_namespace_d_exports as Objects };
2
+ import { saved_callers_public_d_exports } from "./saved-callers-public.mjs";
3
+ export { objects_namespace_d_exports as Objects, saved_callers_public_d_exports as SavedCallers };
@@ -25,7 +25,7 @@ const fieldsOf = (fields, signature) => signature === void 0 ? fields : {
25
25
  * what the call's reads before it left, `call`. A server with no `Merges` refuses it as
26
26
  * `merges-off`.
27
27
  */
28
- const mergedTree = (opened, made, sides, options, call) => Effect.gen(function* () {
28
+ const mergedTree = /* @__PURE__ */ Effect.fnUntraced(function* (opened, made, sides, options, call) {
29
29
  const parts = yield* mergePartsOrOff;
30
30
  const input = { ...sides };
31
31
  if (options.limits !== void 0) input.limits = options.limits;
@@ -42,7 +42,7 @@ const parentOf = (commit, call) => {
42
42
  /** A revert or pick whose change is already on its target: Git commits nothing for it. */
43
43
  const unchanged = (tree, onto, call) => tree === onto.tree ? fail("FAILED_PRECONDITION", `The ${call} changes nothing on ${onto.oid}`, { hint: "Its change is already there" }) : Effect.void;
44
44
  /** Each parent a commit the repo holds, named once. */
45
- const checkedParents = (reader, parents) => Effect.gen(function* () {
45
+ const checkedParents = /* @__PURE__ */ Effect.fnUntraced(function* (reader, parents) {
46
46
  if (parents.length > 4096) return yield* Effect.fail(tooManyParents("The commit", parents.length));
47
47
  if (new Set(parents).size < parents.length) return yield* fail("INVALID_ARGUMENT", "The commit names a parent twice");
48
48
  for (const parent of parents) yield* objectOfType(reader, parent, "commit");
@@ -70,7 +70,7 @@ const commitWrites = (callerOf) => {
70
70
  signature ?? null,
71
71
  ref ?? null
72
72
  ],
73
- make: (opened, made, limits) => Effect.gen(function* () {
73
+ make: Effect.fnUntraced(function* (opened, made, limits) {
74
74
  const { reader, deadline } = yield* readerOf(opened, limits, "walk-limit");
75
75
  const written = Effect.gen(function* () {
76
76
  yield* checkedParents(reader, parents);
@@ -113,7 +113,7 @@ const commitWrites = (callerOf) => {
113
113
  committer
114
114
  ],
115
115
  revisions: [onto],
116
- make: (opened, made, limits) => Effect.gen(function* () {
116
+ make: Effect.fnUntraced(function* (opened, made, limits) {
117
117
  const [tip = ""] = opened.oids;
118
118
  const { reader, call } = yield* readerOf(opened, limits, "walk-limit");
119
119
  const reverted = yield* namedCommit(reader, commit);
@@ -157,7 +157,7 @@ const commitWrites = (callerOf) => {
157
157
  input.committer ?? null,
158
158
  ref ?? null
159
159
  ],
160
- make: (opened, made, limits) => Effect.gen(function* () {
160
+ make: Effect.fnUntraced(function* (opened, made, limits) {
161
161
  const { reader, call } = yield* readerOf(opened, limits, "walk-limit");
162
162
  const picked = yield* namedCommit(reader, commit);
163
163
  const parent = yield* parentOf(picked, "a pick");
@@ -33,7 +33,7 @@ const mergeCalls = (bound) => {
33
33
  committer
34
34
  ],
35
35
  revisions: [ours, input.theirs],
36
- make: (opened, made, limits) => Effect.gen(function* () {
36
+ make: Effect.fnUntraced(function* (opened, made, limits) {
37
37
  const [tip = "", named = ""] = opened.oids;
38
38
  const { reader, call } = yield* readerOf(opened, limits, "walk-limit");
39
39
  const theirs = (yield* namedCommit(reader, named)).oid;
@@ -5,8 +5,8 @@ import { defaultFetchLimits } from "../../storage/fetch.mjs";
5
5
  import { loose } from "../../storage/loose.mjs";
6
6
  import { packs } from "../../storage/packs.mjs";
7
7
  import { IndexedStorage, Storage } from "./objects.mjs";
8
- import { Bucket, CallLimits, Records } from "@ref0/infra";
9
8
  import * as Effect from "effect/Effect";
9
+ import { Bucket, CallLimits, Records } from "@ref0/infra";
10
10
  import * as Context from "effect/Context";
11
11
  import * as Layer from "effect/Layer";
12
12
  // src/core/objects/objects-layer.ts
@@ -8,6 +8,7 @@ import { WholeRepo } from "../../store/ref-rows.mjs";
8
8
  import { collections } from "../../store/scopes.mjs";
9
9
  import { indexRowKey } from "../../storage/layout.mjs";
10
10
  import { isVisibleTooLong } from "../../storage/visible.mjs";
11
+ import { heldOf as heldOf$1 } from "../../storage/wants.mjs";
11
12
  import { objectsFace, objectsOnce, readOnce, scopedReader, startingOnce } from "../../storage/calls.mjs";
12
13
  import { callScope } from "../../store/call-count.mjs";
13
14
  import { resultIn } from "../../store/crossing.mjs";
@@ -18,10 +19,10 @@ import { SealedObjects, viewOf } from "../view.mjs";
18
19
  import { answerFailed } from "../../contracts/calls-spent.mjs";
19
20
  import { CoreParts, ObjectsParts } from "../parts.mjs";
20
21
  import { read } from "./objects.mjs";
21
- import * as Schema from "effect/Schema";
22
22
  import * as Effect from "effect/Effect";
23
- import * as SchemaTransformation from "effect/SchemaTransformation";
24
23
  import * as Option from "effect/Option";
24
+ import * as Schema from "effect/Schema";
25
+ import * as SchemaTransformation from "effect/SchemaTransformation";
25
26
  import * as Scope from "effect/Scope";
26
27
  // src/core/objects/reading.ts
27
28
  /**
@@ -72,14 +73,15 @@ const openRead = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, revi
72
73
  });
73
74
  /**
74
75
  * `openRead` for a write `keyed` by a key: `undefined`, with nothing asked of `authorize`, once
75
- * the name holds a repo other than the one its key's lookup saw, as `openKeyed` says.
76
+ * the name holds a repo other than the one its key's lookup saw, as `openKeyed` says. It confirms
77
+ * nothing: the write lands by `internalId`, as `Confirm`'s `skip` says.
76
78
  */
77
79
  const openKeyedRead = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, revisions, keyed, internalId) {
78
80
  const { asked, reads } = yield* readsOf(revisions);
79
81
  const opened = yield* openKeyed(caller, {
80
82
  kind: "read",
81
83
  repo
82
- }, reads, keyed, internalId);
84
+ }, reads, keyed, internalId, "skip");
83
85
  if (opened === void 0) return void 0;
84
86
  return yield* readOpened(caller, repo, revisions, {
85
87
  asked,
@@ -203,7 +205,7 @@ const namedBy = (revision, candidates, held, defaultBranch) => {
203
205
  * rule (Q861): nothing a request caches, skips or stops on may depend on whether a hidden ID was
204
206
  * found, so only reached IDs and tips are remembered, and `hidden-short-ids.fuzz.test.ts` holds it.
205
207
  */
206
- const resolved = (revision, candidates, held, defaultBranch, repo, starting) => Effect.gen(function* () {
208
+ const resolved = /* @__PURE__ */ Effect.fnUntraced(function* (revision, candidates, held, defaultBranch, repo, starting) {
207
209
  if (isOid(revision)) return revision;
208
210
  const named = namedBy(revision, candidates, held, defaultBranch);
209
211
  if (named !== void 0) return named;
@@ -221,6 +223,49 @@ const resolved = (revision, candidates, held, defaultBranch, repo, starting) =>
221
223
  context: { reason: "ambiguous" }
222
224
  });
223
225
  });
226
+ /** Git's zero ID, which names no object: a lookup of it always makes the reads a missing ID needs. */
227
+ const noObject = "0".repeat(40);
228
+ /**
229
+ * Which of `oids` the refs `caller` sees of `resolved` reach, or `undefined` when its view isn't
230
+ * narrowed, so it reads every object and nothing is read here. Else one read of the repo's packs,
231
+ * every ref and its `index` row at one version, as `readOpened` makes for a narrowed view, and
232
+ * one lookup of them all beside `noObject`, so where an index covers the listing the lookup's reads
233
+ * are the same whichever of them the repo holds. Where none does, as with Git's reads by ID, an ID
234
+ * the repo holds walks the caller's history and a missing one doesn't, so the reads differ, and
235
+ * past `wantWalkMost` the answer does too: the residual `before-production.md` names, and the
236
+ * oracle's record, `.agents/docs/security/git-want-existence-oracle.md` (Q839 (4)). The caller's
237
+ * own writes count for nothing: an object only they wrote, through the API, is unseen here, so
238
+ * writing a blob proves no ref reaches it. A repo deleted since it opened is `NOT_FOUND`.
239
+ */
240
+ const seenIn = /* @__PURE__ */ Effect.fnUntraced(function* (caller, resolved, oids) {
241
+ const core = yield* CoreParts;
242
+ const view = yield* viewOf(caller, resolved, void 0, { ownWrites: false });
243
+ if (!(yield* view.narrowed)) return void 0;
244
+ const { record, snapshot } = yield* readRecord(core.store, resolved.internalId, [
245
+ packsRead,
246
+ everyRef,
247
+ indexRowKey
248
+ ]);
249
+ if (record === void 0 || record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${resolved.name}'`);
250
+ const [, packRows = [], refRows = [], indexRows = []] = snapshot.results;
251
+ const packs = yield* decodePacks(packRows);
252
+ const listed = {
253
+ repo: resolved.internalId,
254
+ version: snapshot.version,
255
+ packs
256
+ };
257
+ const at = {
258
+ listed,
259
+ refs: yield* view.refs(refRows),
260
+ refRows,
261
+ index: indexRows[0]?.value
262
+ };
263
+ const objects = yield* read({
264
+ view,
265
+ at
266
+ });
267
+ return yield* heldOf$1(objectsFace(objects), listed, [...oids, noObject]);
268
+ });
224
269
  /**
225
270
  * A write sent again reads back the object it made, which its caller already holds: it reads it
226
271
  * whole, whatever refs reach it.
@@ -250,7 +295,7 @@ const objectIn = /* @__PURE__ */ Effect.fnUntraced(function* (repo, oid) {
250
295
  * An object by its ID, through the repo's reads: `NOT_FOUND` when it holds none. The read takes
251
296
  * the call's interruption as its signal, so a call cancelled, or a REST request dropped, stops it.
252
297
  */
253
- const objectAt = (opened, oid) => Effect.gen(function* () {
298
+ const objectAt = /* @__PURE__ */ Effect.fnUntraced(function* (opened, oid) {
254
299
  if (!isOid(oid)) return yield* fail("INVALID_ARGUMENT", `'${oid}' isn't a full object ID`);
255
300
  const result = yield* Effect.promise((signal) => opened.read({
256
301
  oid,
@@ -376,4 +421,4 @@ const readerOf = (opened, limits, reason) => Effect.map(deadlineOf(limits.millis
376
421
  call
377
422
  };
378
423
  });
379
- export { base64Size, dropped, fitting, heldCursor, heldDigest, heldIndex, heldListing, heldOf, innerPage, jsonSize, objectAt, objectIn, openKeyedRead, openRead, readerOf, responseBytes, responseTooLarge, withinResponse };
424
+ export { base64Size, dropped, fitting, heldCursor, heldDigest, heldIndex, heldListing, heldOf, innerPage, jsonSize, objectAt, objectIn, openKeyedRead, openRead, readerOf, responseBytes, responseTooLarge, seenIn, withinResponse };
@@ -1,4 +1,5 @@
1
1
  import { fail } from "../../contracts/result.mjs";
2
+ import { TreeEdit } from "../../contracts/trees.mjs";
2
3
  import { fromDiff } from "../../engine/failures.mjs";
3
4
  import { keyOf } from "../../protocol/diff/paths.mjs";
4
5
  import { isDotFile, isDotgit } from "../../protocol/objects/fsck-names.mjs";
@@ -9,6 +10,7 @@ import { isOid, utf8 } from "../../protocol/bytes/text.mjs";
9
10
  import { dropped } from "./reading.mjs";
10
11
  import { writeBytesMost } from "./writing.mjs";
11
12
  import * as Effect from "effect/Effect";
13
+ import * as Schema from "effect/Schema";
12
14
  // src/core/objects/tree-edits.ts
13
15
  const asRead = fromDiff("walk-limit");
14
16
  /** The most edits one `trees.create` or `commits.create` takes. */
@@ -58,37 +60,20 @@ const typeOf = /* @__PURE__ */ Effect.fnUntraced(function* (reader, oid) {
58
60
  dropped(object);
59
61
  return object.type;
60
62
  });
63
+ const decodeTreeEdit = /* @__PURE__ */ Schema.decodeUnknownEffect(TreeEdit);
64
+ /** `edit` without keys set to `undefined`, which `TreeEdit`'s `optionalKey` fields refuse. */
65
+ const definedFields = ({ path, mode, oid, content }) => {
66
+ const fields = { path };
67
+ if (mode !== void 0) fields.mode = mode;
68
+ if (oid !== void 0) fields.oid = oid;
69
+ if (content !== void 0) fields.content = content;
70
+ return fields;
71
+ };
61
72
  /**
62
73
  * One edit's shape: a deletion with no content or mode, or content or an object ID, not both,
63
- * each with a mode or none.
74
+ * each with a mode or none. Decoded through `TreeEdit`, with failures mapped to `badPath`.
64
75
  */
65
- const treeEditOf = (edit) => {
66
- const { path, mode, oid, content } = edit;
67
- if (oid === null) {
68
- if (content !== void 0 || mode !== void 0) return badPath(path, "is deleted, so its edit takes no content or mode");
69
- return Effect.succeed({
70
- path,
71
- oid: null
72
- });
73
- }
74
- if (content !== void 0 && oid === void 0) return Effect.succeed(mode === void 0 ? {
75
- path,
76
- content
77
- } : {
78
- path,
79
- content,
80
- mode
81
- });
82
- if (oid !== void 0 && content === void 0) return Effect.succeed(mode === void 0 ? {
83
- path,
84
- oid
85
- } : {
86
- path,
87
- oid,
88
- mode
89
- });
90
- return badPath(path, "needs an object ID or content, and not both");
91
- };
76
+ const treeEditOf = (edit) => Effect.catch(decodeTreeEdit(definedFields(edit)), () => badPath(edit.path, edit.oid === null ? "is deleted, so its edit takes no content or mode" : "needs an object ID or content, and not both"));
92
77
  /**
93
78
  * One edit's entry: its content made a blob, or its object, checked to be of its mode's type. A
94
79
  * mode left out keeps the path's own when it has one of the same type, else is the object's
@@ -46,7 +46,7 @@ const entryOf = (entry, path) => {
46
46
  * folder before what it holds, as `ls-tree -r -t` lists them, a submodule not entered. Paths start
47
47
  * with `prefix`. Reads stop once `most` are found, past which `more` says entries follow.
48
48
  */
49
- const listTree = (reader, tree, options) => Effect.gen(function* () {
49
+ const listTree = /* @__PURE__ */ Effect.fnUntraced(function* (reader, tree, options) {
50
50
  const entries = [];
51
51
  const stack = [{
52
52
  children: yield* reader.treeOf(tree),
@@ -92,7 +92,7 @@ const listTree = (reader, tree, options) => Effect.gen(function* () {
92
92
  * `NOT_FOUND`, as reading it would be, unless the core is `partial`: then it has no `size`, since
93
93
  * the client fetches no blob to size it.
94
94
  */
95
- const sized = (opened, listed) => Effect.gen(function* () {
95
+ const sized = /* @__PURE__ */ Effect.fnUntraced(function* (opened, listed) {
96
96
  const { partial } = yield* ObjectsParts;
97
97
  const blobs = [...new Set(listed.entries.filter((entry) => entry.type === "blob").map((entry) => entry.oid))];
98
98
  if (blobs.length === 0) return listed;
@@ -160,7 +160,7 @@ const treeCalls = (bound) => {
160
160
  repo,
161
161
  input,
162
162
  parts: [base ?? null, changes],
163
- make: (opened, made, limits) => Effect.gen(function* () {
163
+ make: Effect.fnUntraced(function* (opened, made, limits) {
164
164
  const { reader, deadline } = yield* readerOf(opened, limits, "walk-limit");
165
165
  return { oid: yield* timed(editTree(reader, made, base, changes), deadline) };
166
166
  }),
@@ -185,7 +185,7 @@ const treeCalls = (bound) => {
185
185
  ours,
186
186
  theirs
187
187
  ],
188
- make: (opened, made) => Effect.gen(function* () {
188
+ make: Effect.fnUntraced(function* (opened, made) {
189
189
  const merged = yield* (yield* mergePartsOrOff).mergeTrees(opened.read, mergeInput(input), callAllot(opened));
190
190
  yield* takeWrites(made, merged.objects);
191
191
  const { renamesSkipped } = merged;