@ref0/git 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/dist/access/private-refs.mjs +0 -2
  2. package/dist/auth/authorize.mjs +31 -24
  3. package/dist/auth/bridge.mjs +8 -8
  4. package/dist/auth/fences.d.mts +0 -1
  5. package/dist/auth/fences.mjs +1 -1
  6. package/dist/auth/grants.d.mts +0 -1
  7. package/dist/auth/grants.mjs +2 -2
  8. package/dist/auth/host-function.d.mts +1 -7
  9. package/dist/auth/host-function.mjs +38 -38
  10. package/dist/auth/identify.d.mts +0 -1
  11. package/dist/auth/identify.mjs +1 -1
  12. package/dist/auth/policy.d.mts +7 -4
  13. package/dist/auth/policy.mjs +13 -10
  14. package/dist/auth/token-rows.mjs +2 -5
  15. package/dist/auth/tokens-layer.d.mts +0 -2
  16. package/dist/auth/tokens-public.d.mts +3 -3
  17. package/dist/auth/tokens-public.mjs +4 -2
  18. package/dist/auth/tokens.d.mts +6 -1
  19. package/dist/auth/tokens.mjs +7 -1
  20. package/dist/client/client.d.mts +22 -15
  21. package/dist/client/client.mjs +31 -27
  22. package/dist/client/git-http.mjs +22 -5
  23. package/dist/client/local.mjs +1 -1
  24. package/dist/client/namespace.d.mts +2 -0
  25. package/dist/client/push-upload.d.mts +1 -0
  26. package/dist/client/push-upload.mjs +169 -2
  27. package/dist/client/remote-helper.mjs +2 -4
  28. package/dist/client/remote.mjs +37 -15
  29. package/dist/client/run-remote-helper.mjs +4 -4
  30. package/dist/client/transport.mjs +26 -19
  31. package/dist/contracts/actors.d.mts +57 -28
  32. package/dist/contracts/actors.mjs +38 -2
  33. package/dist/contracts/authorize.d.mts +21 -15
  34. package/dist/contracts/callers.mjs +40 -0
  35. package/dist/contracts/calls-spent.d.mts +2 -12
  36. package/dist/contracts/calls-spent.mjs +4 -5
  37. package/dist/contracts/client.d.mts +16 -9
  38. package/dist/contracts/events.d.mts +82 -14
  39. package/dist/contracts/events.mjs +35 -9
  40. package/dist/contracts/files.d.mts +42 -42
  41. package/dist/contracts/forks.d.mts +0 -24
  42. package/dist/contracts/git-hooks.d.mts +217 -0
  43. package/dist/contracts/git-hooks.mjs +3 -1
  44. package/dist/contracts/git.d.mts +13 -3
  45. package/dist/contracts/grants.d.mts +46 -27
  46. package/dist/contracts/lfs.d.mts +17 -4
  47. package/dist/contracts/merges.d.mts +7 -7
  48. package/dist/contracts/objects.d.mts +38 -4
  49. package/dist/contracts/opaque.mjs +19 -1
  50. package/dist/contracts/operations.d.mts +8 -1
  51. package/dist/contracts/operations.mjs +209 -0
  52. package/dist/contracts/queue.d.mts +6 -5
  53. package/dist/contracts/queue.mjs +9 -20
  54. package/dist/contracts/remote.d.mts +13 -4
  55. package/dist/contracts/remote.mjs +3 -3
  56. package/dist/contracts/repos.d.mts +11 -40
  57. package/dist/contracts/repos.mjs +11 -10
  58. package/dist/contracts/result.d.mts +28 -11
  59. package/dist/contracts/result.mjs +32 -2
  60. package/dist/contracts/rules.d.mts +706 -46
  61. package/dist/contracts/rules.mjs +81 -2
  62. package/dist/contracts/server.d.mts +5 -275
  63. package/dist/contracts/services.d.mts +0 -3
  64. package/dist/contracts/services.mjs +1 -3
  65. package/dist/contracts/signin.d.mts +2 -2
  66. package/dist/contracts/signin.mjs +4 -5
  67. package/dist/contracts/sync.d.mts +1 -4
  68. package/dist/contracts/tokens.d.mts +29 -17
  69. package/dist/contracts/tokens.mjs +14 -3
  70. package/dist/contracts/topics.d.mts +38 -11
  71. package/dist/contracts/topics.mjs +8 -2
  72. package/dist/core/access.d.mts +0 -2
  73. package/dist/core/access.mjs +15 -4
  74. package/dist/core/ancestry.mjs +5 -4
  75. package/dist/core/events/deliver.mjs +19 -1
  76. package/dist/core/forks.mjs +30 -11
  77. package/dist/core/hooks/groups.d.mts +0 -1
  78. package/dist/core/hooks/groups.mjs +8 -9
  79. package/dist/core/index-job.mjs +23 -1
  80. package/dist/core/index-lost.d.mts +11 -0
  81. package/dist/core/index-lost.mjs +55 -0
  82. package/dist/core/loose-tally.mjs +46 -0
  83. package/dist/core/objects/commit-writes.mjs +1 -1
  84. package/dist/core/objects/commits.mjs +10 -9
  85. package/dist/core/objects/merges.mjs +1 -1
  86. package/dist/core/objects/reading.mjs +28 -13
  87. package/dist/core/objects/trees.mjs +1 -1
  88. package/dist/core/objects/writing.mjs +1 -0
  89. package/dist/core/parts.d.mts +7 -0
  90. package/dist/core/promise.mjs +1 -15
  91. package/dist/core/publish.mjs +9 -5
  92. package/dist/core/purge.mjs +30 -12
  93. package/dist/core/push.mjs +39 -16
  94. package/dist/core/ref-view.mjs +14 -6
  95. package/dist/core/repack.mjs +54 -27
  96. package/dist/core/repo-info.mjs +8 -6
  97. package/dist/core/repos.mjs +1 -0
  98. package/dist/core/rules/check.mjs +10 -10
  99. package/dist/core/rules/context.d.mts +3 -1
  100. package/dist/core/rules/context.mjs +16 -13
  101. package/dist/core/rules/fetch.mjs +17 -23
  102. package/dist/core/tokens.mjs +2 -1
  103. package/dist/core/view.d.mts +10 -1
  104. package/dist/core/view.mjs +15 -6
  105. package/dist/effect.d.mts +3 -6
  106. package/dist/effect.mjs +3 -6
  107. package/dist/engine/commits.mjs +23 -50
  108. package/dist/engine/failures.d.mts +1 -2
  109. package/dist/engine/failures.mjs +1 -3
  110. package/dist/engine/merge-base-walk.mjs +57 -142
  111. package/dist/engine/merge-bases.mjs +9 -7
  112. package/dist/engine/merge.mjs +20 -17
  113. package/dist/engine/parts.d.mts +1 -0
  114. package/dist/engine/parts.mjs +1 -1
  115. package/dist/engine/walk.mjs +15 -11
  116. package/dist/extend.d.mts +1 -2
  117. package/dist/extend.mjs +1 -2
  118. package/dist/http/core-parts.mjs +18 -10
  119. package/dist/http/handler.mjs +11 -31
  120. package/dist/http/parts.d.mts +0 -1
  121. package/dist/index.d.mts +29 -22
  122. package/dist/index.mjs +5 -2
  123. package/dist/lfs/base.d.mts +6 -3
  124. package/dist/lfs/base.mjs +2 -1
  125. package/dist/lfs/layer.d.mts +4 -3
  126. package/dist/lfs/layer.mjs +23 -9
  127. package/dist/lfs/objects.mjs +93 -41
  128. package/dist/lfs/pointers.mjs +69 -18
  129. package/dist/lfs/purge.mjs +6 -2
  130. package/dist/lfs/rows.mjs +24 -7
  131. package/dist/lfs/service.d.mts +6 -3
  132. package/dist/lfs/service.mjs +8 -2
  133. package/dist/lfs/upkeep.mjs +47 -28
  134. package/dist/lfs/upload-most.mjs +47 -0
  135. package/dist/lfs/uploaded.mjs +59 -0
  136. package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
  137. package/dist/protocol/bytes/streams.mjs +84 -2
  138. package/dist/protocol/bytes/text.mjs +6 -1
  139. package/dist/protocol/diff/read.d.mts +1 -0
  140. package/dist/protocol/diff/read.mjs +5 -2
  141. package/dist/protocol/objects/commit.d.mts +7 -0
  142. package/dist/protocol/objects/commit.mjs +5 -1
  143. package/dist/protocol/objects/fsck.mjs +6 -3
  144. package/dist/queue/advance.mjs +77 -18
  145. package/dist/queue/calls.mjs +4 -14
  146. package/dist/queue/host.d.mts +4 -0
  147. package/dist/queue/lanes.mjs +1 -1
  148. package/dist/queue/layer.mjs +4 -2
  149. package/dist/queue/limits.mjs +18 -2
  150. package/dist/queue/rows.mjs +10 -1
  151. package/dist/queue/schedule.mjs +1 -1
  152. package/dist/queue/search.mjs +3 -4
  153. package/dist/queue/trim.mjs +2 -2
  154. package/dist/rest/client-namespace.d.mts +2 -0
  155. package/dist/rest/client.d.mts +32 -8
  156. package/dist/rest/client.mjs +308 -382
  157. package/dist/rest/commits.d.mts +150 -150
  158. package/dist/rest/files.d.mts +18 -18
  159. package/dist/rest/forks.d.mts +77 -89
  160. package/dist/rest/handlers.mjs +2 -1
  161. package/dist/rest/listen.d.mts +8 -6
  162. package/dist/rest/listen.mjs +31 -75
  163. package/dist/rest/me.d.mts +2 -2
  164. package/dist/rest/merges.d.mts +7 -7
  165. package/dist/rest/refs.d.mts +27 -27
  166. package/dist/rest/repos.d.mts +40 -52
  167. package/dist/rest/tokens.d.mts +12 -12
  168. package/dist/rest/topics.d.mts +13 -13
  169. package/dist/rest/trees.d.mts +66 -66
  170. package/dist/rest/wire.d.mts +20 -2
  171. package/dist/rest/work.d.mts +39 -39
  172. package/dist/rest.d.mts +1 -7
  173. package/dist/rest.mjs +1 -5
  174. package/dist/server/git-layer.d.mts +10 -2
  175. package/dist/server/git-layer.mjs +29 -10
  176. package/dist/server/joined.d.mts +12 -6
  177. package/dist/server/joined.mjs +3 -2
  178. package/dist/server/registry.mjs +11 -5
  179. package/dist/server/server.d.mts +0 -1
  180. package/dist/server/server.mjs +42 -49
  181. package/dist/signin/context.d.mts +0 -1
  182. package/dist/signin/context.mjs +5 -9
  183. package/dist/storage/clean-up.mjs +3 -1
  184. package/dist/storage/fsck.mjs +12 -2
  185. package/dist/storage/graph-rebuild.mjs +262 -0
  186. package/dist/storage/index-bitmaps.mjs +16 -10
  187. package/dist/storage/index-build.mjs +160 -24
  188. package/dist/storage/index-graph.d.mts +1 -0
  189. package/dist/storage/index-graph.mjs +29 -5
  190. package/dist/storage/index-layers.d.mts +1 -0
  191. package/dist/storage/index-layers.mjs +5 -2
  192. package/dist/storage/index-reach.mjs +7 -5
  193. package/dist/storage/index-remap.mjs +5 -5
  194. package/dist/storage/index-visible.mjs +16 -5
  195. package/dist/storage/lfs-pointers.d.mts +5 -5
  196. package/dist/storage/lfs-pointers.mjs +37 -11
  197. package/dist/storage/links.mjs +3 -3
  198. package/dist/storage/loose.mjs +4 -1
  199. package/dist/storage/memory-budget.mjs +1 -1
  200. package/dist/storage/merge-fence.mjs +81 -19
  201. package/dist/storage/merge-most.mjs +1 -0
  202. package/dist/storage/merge-row.mjs +16 -4
  203. package/dist/storage/merge-stream.mjs +9 -6
  204. package/dist/storage/object-rows.mjs +17 -1
  205. package/dist/storage/pack-order.d.mts +1 -0
  206. package/dist/storage/pack-order.mjs +18 -1
  207. package/dist/storage/pack-receive.mjs +10 -6
  208. package/dist/storage/packs.mjs +58 -27
  209. package/dist/storage/prune-walk.mjs +5 -2
  210. package/dist/storage/prune.mjs +168 -70
  211. package/dist/storage/ready.d.mts +1 -1
  212. package/dist/storage/ready.mjs +12 -3
  213. package/dist/storage/receive-bounds.mjs +3 -2
  214. package/dist/storage/receive-state.mjs +1 -1
  215. package/dist/storage/repack-contained.mjs +22 -14
  216. package/dist/storage/repack.d.mts +1 -1
  217. package/dist/storage/repack.mjs +3 -2
  218. package/dist/storage/unpack.mjs +7 -0
  219. package/dist/storage/visible.mjs +3 -2
  220. package/dist/storage/walk.d.mts +1 -0
  221. package/dist/storage/walk.mjs +9 -5
  222. package/dist/storage/wants.mjs +17 -11
  223. package/dist/store/call-count.d.mts +31 -3
  224. package/dist/store/call-count.mjs +51 -20
  225. package/dist/store/errors.d.mts +7 -1
  226. package/dist/store/errors.mjs +7 -1
  227. package/dist/store/job-try.mjs +3 -1
  228. package/dist/store/records.mjs +26 -5
  229. package/dist/store/repo-record.mjs +36 -12
  230. package/dist/store/scopes.mjs +15 -2
  231. package/dist/sync/bound.d.mts +1 -1
  232. package/dist/sync/import.mjs +15 -3
  233. package/dist/sync/layer.d.mts +5 -1
  234. package/dist/sync/layer.mjs +11 -9
  235. package/dist/sync/mirror.mjs +1 -1
  236. package/dist/sync/step.mjs +15 -15
  237. package/dist/topics/advance.mjs +11 -10
  238. package/dist/topics/layer.mjs +1 -1
  239. package/dist/topics/members.mjs +38 -9
  240. package/package.json +3 -3
  241. package/dist/engine/merge-base-walk.d.mts +0 -3
  242. package/dist/server/routes.d.mts +0 -32
  243. package/dist/server/routes.mjs +0 -69
  244. package/dist/sync/bridge.d.mts +0 -6
  245. package/dist/sync/bridge.mjs +0 -29
@@ -5,12 +5,13 @@ import { untilAborted } from "../store/crossing.mjs";
5
5
  import { gitJob } from "../store/job-try.mjs";
6
6
  import { decodePacks, featureChange, gitStore, packRow } from "../store/git-store.mjs";
7
7
  import { appendEvents, decodeOutbox, outboxReads, repoEnvelope } from "../store/outbox.mjs";
8
- import { decodeTimes, readRecord, repoStats, timeRow } from "../store/repo-record.mjs";
8
+ import { decodeStats, looseRows, readRecord, repoStats, timeRow } from "../store/repo-record.mjs";
9
9
  import { settleName } from "../store/settle.mjs";
10
10
  import { replacedAtCommit } from "../storage/index-remap.mjs";
11
11
  import { indexRowKey, isPackId, objectCollections } from "../storage/layout.mjs";
12
12
  import { listedIds } from "../storage/listed-ids.mjs";
13
- import { ReadyRow } from "../storage/ready.mjs";
13
+ import { noRows } from "../storage/object-rows.mjs";
14
+ import { ReadyRow, readyBytesOf } from "../storage/ready.mjs";
14
15
  import { ApartRow, apartAfter, apartKey } from "../storage/repack-contained.mjs";
15
16
  import { SwapsSettled, swapsKey, swapsLeft } from "../storage/swap-walk.mjs";
16
17
  import { QuarantineRow, decodeHeld, decodeLeft, isLeftKey, leavingKey, leavingLate, leavingRow, leftPack } from "../storage/rows.mjs";
@@ -34,10 +35,10 @@ const upkeepWhole = /* @__PURE__ */ WholeRepo.mint();
34
35
  * `upkeeps` as one, in order: the first that did some answers `more`, so a step stays short;
35
36
  * else the soonest any is due.
36
37
  */
37
- const upkeepsOf = (upkeeps) => Effect.fnUntraced(function* (store, repo, at) {
38
+ const upkeepsOf = (upkeeps) => Effect.fnUntraced(function* (store, repo, at, deleted) {
38
39
  let due;
39
40
  for (const upkeep of upkeeps) {
40
- const step = yield* upkeep(store, repo, at);
41
+ const step = yield* upkeep(store, repo, at, deleted);
41
42
  if (step.more) return step;
42
43
  if (step.due !== void 0) due = due === void 0 ? step.due : Math.min(due, step.due);
43
44
  }
@@ -97,23 +98,44 @@ const packsAfter = (packs, change) => {
97
98
  added: sizeOf(added)
98
99
  };
99
100
  };
101
+ /** `repo.work.failed` for a prune pass that pushes have kept waiting `periods` periods in a row. */
102
+ const busyEvent = (repo, periods) => ({
103
+ type: "repo.work.failed",
104
+ ...repoEnvelope(void 0, repo),
105
+ name: "git.repack",
106
+ key: "prune",
107
+ refused: "busy",
108
+ periods,
109
+ error: `Pushes undid every prune pass for ${periods} periods; unreachable objects stay until a quiet period`
110
+ });
100
111
  /**
101
112
  * The rows a step adds to its commit to report its run: the run's row while it goes on, and at
102
- * its last step the row deleted and `repo.maintained`, unless the run changed nothing.
113
+ * its last step the row deleted and `repo.maintained`, unless the run changed nothing. A step
114
+ * that writes the prune pass's wait for pushes, `prunePeriodsMost` periods in a row or more, sends
115
+ * `repo.work.failed` with `refused: 'busy'`, whichever step it is.
103
116
  */
104
117
  const reportRun = /* @__PURE__ */ Effect.fnUntraced(function* (parts, read, run, after, step) {
105
118
  const added = run.added + after.added;
106
- if (!step.last) return {
107
- put: after.added === 0 && step.saved ? [] : [{
119
+ const busy = step.busy !== void 0 && step.busy >= 3 ? [busyEvent(read.name, step.busy)] : [];
120
+ if (!step.last) {
121
+ const put = after.added === 0 && step.saved ? [] : [{
108
122
  ...maintenanceRunKey,
109
123
  value: {
110
124
  ...run,
111
125
  added
112
126
  }
113
- }],
114
- delete: [],
115
- jobs: []
116
- };
127
+ }];
128
+ const told = yield* appendEvents(parts.events, read.outbox, busy, {
129
+ scope: read.scope,
130
+ at: step.at,
131
+ exempt: true
132
+ });
133
+ return {
134
+ put: [...put, ...told.put],
135
+ delete: told.delete,
136
+ jobs: told.jobs
137
+ };
138
+ }
117
139
  const removed = step.saved ? [maintenanceRunKey] : [];
118
140
  const { fenced } = step;
119
141
  const changed = added > 0 || run.packs !== after.packs || run.bytes !== after.bytes || fenced.length > 0;
@@ -134,7 +156,7 @@ const reportRun = /* @__PURE__ */ Effect.fnUntraced(function* (parts, read, run,
134
156
  ...report,
135
157
  fenced
136
158
  } : report;
137
- const appended = yield* appendEvents(parts.events, read.outbox, changed ? [maintained] : [], {
159
+ const appended = yield* appendEvents(parts.events, read.outbox, [...busy, ...changed ? [maintained] : []], {
138
160
  scope: read.scope,
139
161
  at: step.at,
140
162
  exempt: true
@@ -175,7 +197,8 @@ const leavingOf = /* @__PURE__ */ Effect.fnUntraced(function* (parts, packs, at)
175
197
  return {
176
198
  change: {
177
199
  remove: named.map((pack) => pack.id),
178
- put: named.map((pack) => leavingRow(pack, removeAt, { deleted: true }))
200
+ put: named.map((pack) => leavingRow(pack, removeAt, { deleted: true })),
201
+ rows: noRows
179
202
  },
180
203
  more: true
181
204
  };
@@ -255,17 +278,18 @@ const heldRows = /* @__PURE__ */ Effect.fnUntraced(function* (keyed) {
255
278
  const readStep = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId, keys = []) {
256
279
  const { record, snapshot } = yield* readRecord(store, internalId, [...stepReads, ...keys]);
257
280
  if (record === void 0) return void 0;
258
- const [refRows = [], packRows = [], timeRows = [], ...rest] = snapshot.results.slice(1);
281
+ const [refRows = [], packRows = [], timeRows = [], readyRows = [], ...rest] = snapshot.results.slice(1);
259
282
  const [headRows = [], cursorRows = [], runRows = [], receipts = [], own = [], indexRows = [], apartRows = [], swapsRows = []] = rest;
260
283
  const held = yield* heldRows(snapshot.results.slice(stepReads.length + 1).flat());
261
284
  const packs = yield* decodePacks(packRows);
262
285
  const refs = yield* wholeRefs(upkeepWhole, refRows);
263
- const times = yield* decodeTimes(timeRows);
286
+ const times = yield* decodeStats(timeRows);
287
+ const readyBytes = yield* readyBytesOf(readyRows);
264
288
  const outbox = yield* decodeOutbox([headRows, cursorRows]);
265
289
  const [runRow] = runRows;
266
290
  const saved = runRow === void 0 ? void 0 : yield* decodeRow(MaintenanceRun, runRow, "The repack run");
267
291
  const deleted = record.deleted === true;
268
- const sweep = (at) => bothSwept(sweepOf(receipts, at), ownSweepOf(own, at, deleted));
292
+ const sweep = (at) => deleted ? ownSweepOf(own, at, true) : bothSwept(sweepOf(receipts, at), ownSweepOf(own, at, false));
269
293
  const [index] = indexRows;
270
294
  const [apartRow] = apartRows;
271
295
  const apart = apartRow === void 0 ? void 0 : yield* decodeRow(ApartRow, apartRow, "The packs found apart");
@@ -277,6 +301,7 @@ const readStep = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId,
277
301
  refs,
278
302
  packs,
279
303
  times,
304
+ readyBytes,
280
305
  outbox,
281
306
  saved,
282
307
  sweep,
@@ -307,7 +332,7 @@ const commitStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
307
332
  const scope = repoScope(internalId);
308
333
  const now = yield* parts.now;
309
334
  const late = now - at;
310
- const objects = changeOf(read.version, startedLate(step?.change ?? {}, late));
335
+ const objects = changeOf(read.version, startedLate(step?.change ?? { rows: noRows }, late));
311
336
  yield* featureChange(scope, objects);
312
337
  const deleted = read.record.deleted === true;
313
338
  const sweep = read.sweep(at);
@@ -326,11 +351,12 @@ const commitStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
326
351
  name: read.record.name,
327
352
  outbox: read.outbox,
328
353
  scope
329
- }, run, packsAfter(read.packs, step?.change ?? {}), {
354
+ }, run, packsAfter(read.packs, step?.change ?? { rows: noRows }), {
330
355
  last: step?.more !== true,
331
356
  saved: read.saved !== void 0,
332
357
  at,
333
- fenced
358
+ fenced,
359
+ busy: step?.busy
334
360
  });
335
361
  const mark = step?.drops === true ? [{
336
362
  ...prunedKey,
@@ -348,13 +374,15 @@ const commitStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
348
374
  const { indexJobRow } = parts;
349
375
  const removes = (step?.change.remove?.length ?? 0) > 0 && !deleted;
350
376
  const pruning = (laid.length > 0 || !removes || read.index === void 0 ? laid : [read.index]).flatMap((row) => index === void 0 || indexJobRow === void 0 ? [] : indexJobs({ indexJobRow }, index.status(row, now, listing)));
351
- const apart = [...apartAfter(read.apart, step?.change ?? {}), ...swapsLeft(read.swaps, step?.change ?? {})];
377
+ const apart = [...apartAfter(read.apart, step?.change ?? { rows: noRows }), ...swapsLeft(read.swaps, step?.change ?? { rows: noRows })];
352
378
  const pass = step?.prune === void 0 || deleted ? [] : [pruneJobRow(step.prune)];
379
+ const loose = looseRows(read.times.loose, step?.change.rows ?? noRows);
353
380
  const others = step?.repack === void 0 || deleted ? [] : [repackJobRow$1(step.repack)];
354
381
  const change = {
355
382
  ...objects,
356
383
  put: [
357
384
  ...objects.put ?? [],
385
+ ...loose,
358
386
  ...apart,
359
387
  ...laid,
360
388
  ...mark,
@@ -436,8 +464,8 @@ const reviveParked = /* @__PURE__ */ Effect.fnUntraced(function* (store, interna
436
464
  * own writes at one version, runs `upkeep`'s step first, which answers `more` alone when it did some, asks the
437
465
  * objects for a step, with the default branch's tip and the tags, and commits its change at that
438
466
  * version, fenced by the try's claim, as `commitStep` says. After `dropTries` or more `missed`
439
- * dropping commits in a row, it asks for a step that drops none. A deleted repo's step, once its
440
- * receipts and every own write are swept, moves its packs out of the list, a page at a time, and asks the objects
467
+ * dropping commits in a row, it asks for a step that drops none. A deleted repo's step, once no page
468
+ * of its own writes is left to sweep now, moves its packs out of the list, a page at a time, and asks the objects
441
469
  * nothing until none are listed; then, with no tip and no tags, its ready shallow pack is let go.
442
470
  * A step that finds the version moved reads again, up to `writeTries` times, the rows
443
471
  * `rereadKeys` names, and commits at the new version while `stillTakes` holds: a step with its
@@ -465,14 +493,14 @@ const repackStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
465
493
  if (steps === "prune" && first.record.deleted === true) return void 0;
466
494
  if (yield* settles(parts, store, internalId, first)) return again;
467
495
  const at = yield* parts.now;
468
- const upkept = parts.upkeep === void 0 || steps === "prune" ? void 0 : yield* untilAborted(parts.upkeep(store, internalId, at), signal);
496
+ const upkept = parts.upkeep === void 0 || steps === "prune" ? void 0 : yield* untilAborted(parts.upkeep(store, internalId, at, first.record.deleted === true), signal);
469
497
  if (upkept?.more === true) return again;
470
498
  const listed = {
471
499
  repo: internalId,
472
500
  version: first.version,
473
501
  packs: first.packs
474
502
  };
475
- const stats = repoStats(first.record, first.refs.size, first.packs, first.times);
503
+ const stats = repoStats(first.record, first.refs.size, first.packs, first.times, first.readyBytes);
476
504
  const served = first.record.deleted === true ? /* @__PURE__ */ new Map() : first.refs;
477
505
  const tags = [...served].flatMap(([name, oid]) => name.startsWith("refs/tags/") ? [oid] : []);
478
506
  const tip = served.get(headOf(first.record.defaultBranch));
@@ -491,9 +519,8 @@ const repackStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
491
519
  if (missed >= 5) input.drops = false;
492
520
  if (retried) input.retried = true;
493
521
  if (first.record.deleted === true) input.deleted = true;
494
- const sweep = first.sweep(at);
495
- const held = sweep.more || sweep.due !== void 0 ? {
496
- change: {},
522
+ const held = first.sweep(at).more ? {
523
+ change: { rows: noRows },
497
524
  more: false
498
525
  } : void 0;
499
526
  const step = (first.record.deleted === true ? held ?? (yield* leavingOf(parts, first.packs, at)) : void 0) ?? (yield* resultCall(() => SealedObjects.whole(parts.objects, upkeepWhole).maintain(listed, input)));
@@ -1,8 +1,9 @@
1
1
  import { indexRowKey } from "../storage/layout.mjs";
2
+ import { readyBytesOf } from "../storage/ready.mjs";
2
3
  import { namedRecordOf } from "../store/catalogue.mjs";
3
4
  import { storeCall } from "../store/errors.mjs";
4
5
  import { decodePacks } from "../store/git-store.mjs";
5
- import { decodeTimes, repoStats, seenTimes } from "../store/repo-record.mjs";
6
+ import { decodeStats, repoStats, seenTimes } from "../store/repo-record.mjs";
6
7
  import { repoScope } from "../store/scopes.mjs";
7
8
  import { liveAsAsked, repoAccess, statsReads } from "./access.mjs";
8
9
  import { refViewIn, wholeView } from "./ref-view.mjs";
@@ -77,16 +78,17 @@ const createdInfo = (caller, internalId, record) => infoIn(caller, internalId, r
77
78
  /** A repo's info for a caller with `refView`, from what `repoInfo` says. */
78
79
  const infoIn = /* @__PURE__ */ Effect.fnUntraced(function* (caller, internalId, record, results, refView) {
79
80
  const { objects: sealed } = yield* ObjectsParts;
80
- const packs = yield* decodePacks(results[1] ?? []);
81
- const times = yield* decodeTimes(results[2] ?? []);
82
- const refRows = results[0] ?? [];
81
+ const [refRows = [], packRows = [], timeRows = [], readyRows = [], indexRows = []] = results;
82
+ const packs = yield* decodePacks(packRows);
83
+ const times = yield* decodeStats(timeRows);
84
+ const readyBytes = yield* readyBytesOf(readyRows);
83
85
  const refs = refView.whole ? refRows.length : refRows.filter((row) => refView.sees(row.id)).length;
84
- const whole = repoStats(record, refs, packs, seenTimes(times, refView));
86
+ const whole = repoStats(record, refs, packs, seenTimes(times, refView), readyBytes);
85
87
  const info = refView.whole ? {
86
88
  name: record.name,
87
89
  public: record.public,
88
90
  stats: whole,
89
- work: yield* repoWork(internalId, sealed, results[3]?.[0], packs)
91
+ work: yield* repoWork(internalId, sealed, indexRows[0], packs)
90
92
  } : {
91
93
  name: record.name,
92
94
  public: record.public,
@@ -322,6 +322,7 @@ const createWith = /* @__PURE__ */ Effect.fnUntraced(function* (caller, input, a
322
322
  const entry = yield* entryOf(store, id);
323
323
  if (nameMoved(keyed, entry)) continue;
324
324
  if (entry !== void 0 && entry.deleted !== true) return yield* alreadyExists(id);
325
+ if (also.check !== void 0) yield* also.check(id);
325
326
  const internalId = newInternalId();
326
327
  const record = {
327
328
  name: id,
@@ -1,8 +1,8 @@
1
1
  import { gitError } from "../../contracts/result.mjs";
2
- import { hostEffect, rejectedError, reportRefusal } from "../../auth/host-function.mjs";
2
+ import { hostEffect, logRefusal, rejectedError } from "../../auth/host-function.mjs";
3
3
  import { hiddenUnder } from "../../protocol/wire/lines.mjs";
4
4
  import { inCallScope } from "../../store/call-count.mjs";
5
- import { checkedAnswer, pushContextOf } from "./context.mjs";
5
+ import { checkedAnswer, plainAnswer, pushContextOf } from "./context.mjs";
6
6
  import { shortRef } from "./patterns.mjs";
7
7
  import { pushRulesOf } from "./service.mjs";
8
8
  import * as Effect from "effect/Effect";
@@ -11,7 +11,7 @@ import * as Result from "effect/Result";
11
11
  /** Every rule a push runs: the host's `Rules`, then those `parts` adds. */
12
12
  const pushRulesFor = (parts) => pushRulesOf(parts.added?.() ?? []);
13
13
  /** `rule`'s answer for `update`, of the push's `reached` refs, as the host's call. */
14
- const ruleAnswer = (reports, checking, rule, reached, update) => {
14
+ const ruleAnswer = (checking, rule, reached, update) => {
15
15
  const changed = {
16
16
  key: update.ref,
17
17
  updates: [update]
@@ -21,8 +21,8 @@ const ruleAnswer = (reports, checking, rule, reached, update) => {
21
21
  update,
22
22
  authorize: (asked) => inCallScope(authorize(asked), checking.scope)
23
23
  });
24
- const answer = checkedAnswer(`The push rule '${rule.name}'`, () => rule.check(input));
25
- return hostEffect(reports, "rules.push", checking.about, answer);
24
+ const answer = checkedAnswer(`The push rule '${rule.name}'`, plainAnswer, () => rule.check(input));
25
+ return hostEffect("rules.push", checking.about, answer);
26
26
  };
27
27
  /**
28
28
  * Whether a push `as` an owner may change `ref`: a ref under one of `table`'s prefixes is its
@@ -62,13 +62,13 @@ const runPushRules = /* @__PURE__ */ Effect.fnUntraced(function* (parts, input,
62
62
  if (rules.length === 0) return checked();
63
63
  const { about } = checking;
64
64
  const refuse = (ref, error) => {
65
- reportRefusal(parts.reports, "rules.push", about, error);
66
65
  refused.set(ref, error);
66
+ return logRefusal("rules.push", about, error);
67
67
  };
68
68
  const ruleRefusal = Effect.fnUntraced(function* (update) {
69
69
  checking.passOver(update.ref);
70
70
  for (const rule of rules) {
71
- const answer = yield* ruleAnswer(parts.reports, checking, rule, reached, update);
71
+ const answer = yield* ruleAnswer(checking, rule, reached, update);
72
72
  if (answer.kind === "reject") return rejectedError(answer);
73
73
  }
74
74
  }, Effect.result);
@@ -82,7 +82,7 @@ const runPushRules = /* @__PURE__ */ Effect.fnUntraced(function* (parts, input,
82
82
  const lifted = update.kind === "force" && checking.bypassed.has(update.ref);
83
83
  if (rejected === void 0 && !lifted) continue;
84
84
  if (rejected !== void 0 && update.kind !== "force") {
85
- refuse(update.ref, rejected);
85
+ yield* refuse(update.ref, rejected);
86
86
  continue;
87
87
  }
88
88
  const exact = yield* Effect.result(input.exact(update));
@@ -92,7 +92,7 @@ const runPushRules = /* @__PURE__ */ Effect.fnUntraced(function* (parts, input,
92
92
  continue;
93
93
  }
94
94
  if (exact.success === "force") {
95
- if (rejected !== void 0) refuse(update.ref, rejected);
95
+ if (rejected !== void 0) yield* refuse(update.ref, rejected);
96
96
  continue;
97
97
  }
98
98
  const shown = {
@@ -102,7 +102,7 @@ const runPushRules = /* @__PURE__ */ Effect.fnUntraced(function* (parts, input,
102
102
  kinds.set(update.ref, shown);
103
103
  const again = yield* ruleRefusal(shown);
104
104
  if (Result.isFailure(again)) refused.set(update.ref, again.failure);
105
- else if (again.success !== void 0) refuse(update.ref, again.success);
105
+ else if (again.success !== void 0) yield* refuse(update.ref, again.success);
106
106
  }
107
107
  return checked();
108
108
  });
@@ -2,8 +2,8 @@ import { Caller } from "../../contracts/actors.mjs";
2
2
  import { TreeChange } from "../../contracts/engine.mjs";
3
3
  import { InternalRepoId, Oid, RefName, RepoName } from "../../contracts/ids.mjs";
4
4
  import { GitObject } from "../../contracts/objects.mjs";
5
- import { LfsPointers } from "../../contracts/object-values.mjs";
6
5
  import { RefSource, RefUpdate, RefUpdateKind } from "../../contracts/refs.mjs";
6
+ import { LfsPointers } from "../../contracts/object-values.mjs";
7
7
  import { RepoStats } from "../../contracts/repos.mjs";
8
8
  import { GitError } from "../../contracts/result.mjs";
9
9
  import { CommitChange, RuleOperation } from "../../contracts/rules.mjs";
@@ -12,6 +12,8 @@ import { CallScope } from "../../store/call-count.mjs";
12
12
  import { Ordered } from "../hooks/order.mjs";
13
13
  import { WalkFailure } from "./commit-changes.mjs";
14
14
  import * as Effect from "effect/Effect";
15
+ import "effect/Schema";
16
+ import "effect/Result";
15
17
  import * as Stream from "effect/Stream";
16
18
  /** One push's checks' input: the request, each edit's kind, and the repo's facts at one read. */
17
19
  export interface CheckInput {
@@ -1,12 +1,12 @@
1
- import { accept, reject } from "../../contracts/result.mjs";
1
+ import { accept, decisionAnswer, reject } from "../../contracts/result.mjs";
2
2
  import { actingOf } from "../../auth/acting.mjs";
3
3
  import { WalkRefused } from "../../engine/combined.mjs";
4
4
  import { inCallScope, scopedContext } from "../../store/call-count.mjs";
5
5
  import * as Effect from "effect/Effect";
6
6
  import * as Option from "effect/Option";
7
+ import * as Schema from "effect/Schema";
7
8
  import * as Exit from "effect/Exit";
8
9
  import * as Result from "effect/Result";
9
- import * as Predicate from "effect/Predicate";
10
10
  import * as Stream from "effect/Stream";
11
11
  import * as Deferred from "effect/Deferred";
12
12
  // src/core/rules/context.ts
@@ -128,23 +128,26 @@ const pushContextOf = (checking, updates, changed, extra) => {
128
128
  ...extra
129
129
  };
130
130
  };
131
- const answerKinds = /* @__PURE__ */ new Set(["accept", "reject"]);
131
+ /** A push rule's, a hook group's or `prepare`'s answer, which carries no value. */
132
+ const plainAnswer = /* @__PURE__ */ Schema.decodeUnknownResult(decisionAnswer(Schema.Undefined));
132
133
  /**
133
- * A host check's answer: one that is neither `accept()` nor `reject()`, which a host's JavaScript
134
- * can answer whatever its types say, is the host's failure.
134
+ * A host check's answer, as `read` reads it: one that is neither `accept()` nor `reject()` as
135
+ * `DecisionAnswer` types them, which a host's JavaScript can answer whatever its types say, such as
136
+ * a reject with no string `message` or a `code` Git has none of, is the host's failure.
135
137
  */
136
- const answerOf = (name, answer) => {
137
- if (Predicate.hasProperty(answer, "kind") && answerKinds.has(answer.kind)) return answer;
138
- throw new TypeError(`${name} answered neither accept() nor reject()`);
138
+ const answerOf = (name, read, answer) => {
139
+ const answered = read(answer);
140
+ if (Result.isSuccess(answered)) return answered.success;
141
+ throw new TypeError(`${name} answered neither accept() nor reject(): ${answered.failure.message}`);
139
142
  };
140
143
  /**
141
- * `check()`'s answer, as `answerOf` reads it: a throw, an answer that isn't an Effect, which a
142
- * host's JavaScript can give whatever its types say, and one that is neither kind each die, for
144
+ * `check()`'s answer, as `answerOf` reads it with `read`: a throw, an answer that isn't an Effect,
145
+ * which a host's JavaScript can give whatever its types say, and one `read` refuses each die, for
143
146
  * `hostEffect` to make the host's failure.
144
147
  */
145
- const checkedAnswer = (name, check) => Effect.suspend(() => {
148
+ const checkedAnswer = (name, read, check) => Effect.suspend(() => {
146
149
  const answer = check();
147
- return Effect.isEffect(answer) ? Effect.flatMap(answer, (value) => Effect.sync(() => answerOf(name, value))) : Effect.die(/* @__PURE__ */ new TypeError(`${name} answered no Effect`));
150
+ return Effect.isEffect(answer) ? Effect.flatMap(answer, (value) => Effect.sync(() => answerOf(name, read, value))) : Effect.die(/* @__PURE__ */ new TypeError(`${name} answered no Effect`));
148
151
  });
149
152
  /** The codes `authorize` fails with when the host failed, not when it refused. */
150
153
  const hostFailures = /* @__PURE__ */ new Set([
@@ -153,4 +156,4 @@ const hostFailures = /* @__PURE__ */ new Set([
153
156
  "INTERNAL",
154
157
  "DATA_LOSS"
155
158
  ]);
156
- export { answerOf, checkedAnswer, checking, commitChangesCovered, pushContextOf };
159
+ export { answerOf, checkedAnswer, checking, commitChangesCovered, plainAnswer, pushContextOf };
@@ -1,7 +1,6 @@
1
- import { gitError } from "../../contracts/result.mjs";
2
- import { RuledDepth } from "../../contracts/rules.mjs";
3
- import { hostEffect, rejectedError, reportRefusal } from "../../auth/host-function.mjs";
4
- import { CoreParts } from "../parts.mjs";
1
+ import { decisionAnswer, gitError } from "../../contracts/result.mjs";
2
+ import { FetchAdjustment } from "../../contracts/rules.mjs";
3
+ import { hostEffect, logRefusal, rejectedError } from "../../auth/host-function.mjs";
5
4
  import { checkedAnswer } from "./context.mjs";
6
5
  import { fetchRulesOf } from "./service.mjs";
7
6
  import * as Effect from "effect/Effect";
@@ -31,15 +30,11 @@ const inputOf = (check) => {
31
30
  if (check.request !== void 0) read.request = check.request;
32
31
  return read;
33
32
  };
34
- /** Whether a rule's depth is one: no type guard, so a refused depth keeps its number type. */
35
- const isRuledDepth = /* @__PURE__ */ Schema.is(RuledDepth);
36
- /** A rule's depth, when it set one: a whole number above 0, or the rule's own bug. */
37
- const depthOf = (name, answer) => {
38
- if (answer.kind === "reject") return void 0;
39
- const depth = answer.value?.depth;
40
- if (depth === void 0 || isRuledDepth(depth)) return depth;
41
- throw new TypeError(`${name} set a depth that isn't a whole number above 0: ${depth}`);
42
- };
33
+ /**
34
+ * A fetch rule's answer: a depth it sets that isn't a whole number above 0, as `RuledDepth` holds,
35
+ * is the rule's own bug, so the host's failure.
36
+ */
37
+ const fetchAnswer = /* @__PURE__ */ Schema.decodeUnknownResult(decisionAnswer(FetchAdjustment));
43
38
  /**
44
39
  * A clone's or fetch's rules, the host's `Rules`, in order, or a read's: any `reject()` refuses it,
45
40
  * as the first to reject says, answered as its value, and a rule that fails or dies fails it as the
@@ -47,7 +42,7 @@ const depthOf = (name, answer) => {
47
42
  * read keeps no history to cut, so a depth set on one refuses it, `NOT_ALLOWED` for
48
43
  * `fetch-depth-unsupported`. Each refusal is reported once. No rule sets a filter.
49
44
  */
50
- const ruledBy = /* @__PURE__ */ Effect.fnUntraced(function* (reports, check) {
45
+ const ruledBy = /* @__PURE__ */ Effect.fnUntraced(function* (check) {
51
46
  const rules = yield* fetchRulesOf();
52
47
  if (rules.length === 0) return { depth: void 0 };
53
48
  const { actor } = check.caller;
@@ -63,14 +58,14 @@ const ruledBy = /* @__PURE__ */ Effect.fnUntraced(function* (reports, check) {
63
58
  for (const rule of rules) {
64
59
  const name = `The fetch rule '${rule.name}'`;
65
60
  const input = inputOf(check);
66
- const answered = Effect.flatMap(checkedAnswer(name, () => rule.check(input)), (answer) => answer.kind === "reject" ? Effect.succeed(answer) : Effect.sync(() => ({
61
+ const answered = Effect.map(checkedAnswer(name, fetchAnswer, () => rule.check(input)), (answer) => answer.kind === "reject" ? answer : {
67
62
  kind: "accept",
68
- depth: depthOf(name, answer)
69
- })));
70
- const depth = yield* hostEffect(reports, "rules.fetch", about, answered);
63
+ depth: answer.value?.depth
64
+ });
65
+ const depth = yield* hostEffect("rules.fetch", about, answered);
71
66
  if (depth.kind === "reject") {
72
67
  const refused = rejectedError(depth);
73
- reportRefusal(reports, "rules.fetch", about, refused);
68
+ yield* logRefusal("rules.fetch", about, refused);
74
69
  return { refused };
75
70
  }
76
71
  if (depth.depth !== void 0) depths.push(depth.depth);
@@ -78,7 +73,7 @@ const ruledBy = /* @__PURE__ */ Effect.fnUntraced(function* (reports, check) {
78
73
  if (depths.length === 0) return { depth: void 0 };
79
74
  if ("read" in check) {
80
75
  const refused = gitError("NOT_ALLOWED", "A fetch rule set a depth, which a read of bytes keeps no history for", { context: { reason: "fetch-depth-unsupported" } });
81
- reportRefusal(reports, "rules.fetch", about, refused);
76
+ yield* logRefusal("rules.fetch", about, refused);
82
77
  return { refused };
83
78
  }
84
79
  return { depth: Math.min(...depths) };
@@ -87,15 +82,14 @@ const ruledBy = /* @__PURE__ */ Effect.fnUntraced(function* (reports, check) {
87
82
  * A clone's or fetch's rules, as `ruledBy` asks them, failing with a refusal as the rule wrote it.
88
83
  * Answers the smallest depth any rule set; `withRuledDepth` says how the fetch takes it.
89
84
  */
90
- const runFetchRules = (reports, check) => Effect.flatMap(ruledBy(reports, check), (ruled) => ruled.refused === void 0 ? Effect.succeed(ruled.depth) : Effect.fail(ruled.refused));
85
+ const runFetchRules = (check) => Effect.flatMap(ruledBy(check), (ruled) => ruled.refused === void 0 ? Effect.succeed(ruled.depth) : Effect.fail(ruled.refused));
91
86
  /**
92
87
  * `input`'s read of `repo`, asked of the host's fetch rules as `ruledBy` says: the refusal, or
93
88
  * `undefined` when they accept it. A rule's failure fails it, as the host's. Only a target Git
94
89
  * already found visible to the caller is asked about.
95
90
  */
96
91
  const readRefusal = /* @__PURE__ */ Effect.fnUntraced(function* (repo, input) {
97
- const core = yield* CoreParts;
98
- return (yield* ruledBy(core.checks.reports, {
92
+ return (yield* ruledBy({
99
93
  caller: input.caller,
100
94
  repo,
101
95
  read: input.target,
@@ -95,7 +95,8 @@ const tokenCallsAs = (tokens, bound) => bound === void 0 || isHost(bound) ? toke
95
95
  const checkedTokenCalls = (tokens, caller) => ({
96
96
  create: (target, input) => Effect.flatMap(targetCheck(caller, {
97
97
  kind: "token.create",
98
- ...tokenParties(input)
98
+ ...tokenParties(input),
99
+ scope: input.scope
99
100
  }, target), (held) => tokens.create(target, input, held)),
100
101
  list: (target, input) => Effect.flatMap(targetCheck(caller, { kind: "token.list" }, target), (held) => tokens.list(target, input, held)),
101
102
  get: (id) => heldCheck(caller, id, "token.list"),
@@ -3,6 +3,7 @@ import "../contracts/actors.mjs";
3
3
  import { Oid, RefName } from "../contracts/ids.mjs";
4
4
  import "../contracts/git.mjs";
5
5
  import "../contracts/repos.mjs";
6
+ import { RepoRoots } from "../protocol/objects/commit.mjs";
6
7
  import { GitObjects, IndexCalls, IndexedObjects, Quarantine, VisibleInput, VisibleSet } from "../contracts/objects.mjs";
7
8
  import { Listed } from "../contracts/store.mjs";
8
9
  import { GitError } from "../contracts/result.mjs";
@@ -94,7 +95,10 @@ export interface RepoView {
94
95
  */
95
96
  readonly narrowed: Effect.Effect<boolean, GitError>;
96
97
  }
97
- /** One read of a repo, which a view's objects follow: its listing, its refs and its `index` row. */
98
+ /**
99
+ * One read of a repo, which a view's objects follow: its listing, its refs, its `index` row and its
100
+ * roots.
101
+ */
98
102
  export interface ViewRead {
99
103
  readonly listed: Listed;
100
104
  /** What `RepoView.refs` answered for the same read. */
@@ -103,6 +107,11 @@ export interface ViewRead {
103
107
  readonly refRows?: readonly Row[];
104
108
  /** The repo's `index` row's value, read with the refs. */
105
109
  readonly index?: unknown;
110
+ /**
111
+ * The repo's roots, from the open's read: a narrowed view's set follows none's parents, so a
112
+ * commit only a root's stored parent reaches answers as one the repo lacks.
113
+ */
114
+ readonly roots: RepoRoots;
106
115
  /** A push's own receive, whose packs the caller sent: their objects are read too. */
107
116
  readonly pushed?: Quarantine;
108
117
  }
@@ -4,6 +4,8 @@ import { upstreamOf } from "../store/catalogue.mjs";
4
4
  import { collections } from "../store/scopes.mjs";
5
5
  import { answeredBy, effectWithin, objectsFace, scopedReader } from "../storage/calls.mjs";
6
6
  import { callScope, inCallScope } from "../store/call-count.mjs";
7
+ import { askingOnLost } from "../storage/index-visible.mjs";
8
+ import { indexRowKey } from "../storage/layout.mjs";
7
9
  import { withPushed } from "../storage/visible.mjs";
8
10
  import { WholeRepo, storedPeel, storesPeel, wholeRefs } from "../store/ref-rows.mjs";
9
11
  import { openRepo, repoAccess } from "./access.mjs";
@@ -213,10 +215,16 @@ const viewOf = /* @__PURE__ */ Effect.fnUntraced(function* (caller, resolved, ow
213
215
  const peeled = row === void 0 ? void 0 : yield* storedPeel(row);
214
216
  if (peeled !== void 0) ordered.push(peeled);
215
217
  }
216
- const tips = {
218
+ const lost = core.indexLost === void 0 || at.index === void 0 ? void 0 : core.indexLost(resolved.internalId, {
219
+ ...indexRowKey,
220
+ value: at.index
221
+ }, at.listed);
222
+ const asking = (input) => lost === void 0 ? input : askingOnLost(input, lost);
223
+ const tips = asking({
217
224
  tips: [...new Set(ordered)],
218
- row: at.index
219
- };
225
+ row: at.index,
226
+ roots: at.roots
227
+ });
220
228
  const read = at.pushed === void 0 ? `${at.listed.version}` : `${at.listed.version}+${at.pushed.id}`;
221
229
  const reach = options.ownWrites === false ? `${read}:refs` : read;
222
230
  const key = owner === void 0 ? reach : `${reach}:${owner.prefix}`;
@@ -240,10 +248,11 @@ const viewOf = /* @__PURE__ */ Effect.fnUntraced(function* (caller, resolved, ow
240
248
  const above = yield* parentTips(caller, resolved);
241
249
  const both = [.../* @__PURE__ */ new Set([...tips.tips, ...above])];
242
250
  if (both.length === tips.tips.length) return void 0;
243
- const asked = {
251
+ const asked = asking({
244
252
  tips: both,
245
- row: at.index
246
- };
253
+ row: at.index,
254
+ roots: at.roots
255
+ });
247
256
  let parted;
248
257
  const part = (pick) => () => {
249
258
  parted ??= SealedObjects.parted(sealed, viewWhole, at.listed, asked, at.pushed);
package/dist/effect.d.mts CHANGED
@@ -1,12 +1,9 @@
1
- import { EffectCalls, GitCaller, GitClient, GitStore } from "./contracts/services.mjs";
1
+ import { EffectCalls, GitCaller, GitStore } from "./contracts/services.mjs";
2
2
  import { IndexCalls, IndexReachInput, IndexReached, IndexStatus, IndexTip, IndexTry, IndexTryInput } from "./contracts/objects.mjs";
3
- import { effectGitClient } from "./client/client.mjs";
4
3
  import { CallAllowance, CallBudget, CallBudgetOptions } from "./store/call-count.mjs";
5
- import { spentRefusalOf } from "./contracts/calls-spent.mjs";
6
- import { storeCall } from "./store/errors.mjs";
4
+ import { commitCallsMost, storeCall } from "./store/errors.mjs";
7
5
  import { bucketCall } from "./storage/calls.mjs";
8
6
  import { GitRestApi } from "./rest/api.mjs";
9
- import { GitRoutesOptions, GitRoutesServices, GitServer } from "./server/routes.mjs";
10
7
  import { GitCallerMiddleware, GitRestServices, RestServerSeam } from "./rest/caller.mjs";
11
8
  import { GitErrors } from "./rest/errors.mjs";
12
9
  import { GitRestHandlers } from "./rest/handlers.mjs";
@@ -16,4 +13,4 @@ import { ReposApiGroup } from "./rest/repos.mjs";
16
13
  import { TokensApiGroup } from "./rest/tokens.mjs";
17
14
  import { WorkApiGroup } from "./rest/work.mjs";
18
15
  import { SeamAuthorizeInput, TokenRevokeCheck } from "./core/seam.mjs";
19
- export { type CallAllowance, CallBudget, type CallBudgetOptions, type EffectCalls, GitCaller, GitCallerMiddleware, GitClient, GitErrors, GitRestApi, GitRestHandlers, GitRestServices, type GitRoutesOptions, type GitRoutesServices, GitServer, GitStore, type IndexCalls, type IndexReachInput, type IndexReached, type IndexStatus, type IndexTip, type IndexTry, type IndexTryInput, MeApiGroup, RefsApiGroup, ReposApiGroup, type RestServerSeam, type SeamAuthorizeInput, type TokenRevokeCheck, TokensApiGroup, WorkApiGroup, bucketCall, effectGitClient, spentRefusalOf, storeCall };
16
+ export { type CallAllowance, CallBudget, type CallBudgetOptions, type EffectCalls, GitCaller, GitCallerMiddleware, GitErrors, GitRestApi, GitRestHandlers, GitRestServices, GitStore, type IndexCalls, type IndexReachInput, type IndexReached, type IndexStatus, type IndexTip, type IndexTry, type IndexTryInput, MeApiGroup, RefsApiGroup, ReposApiGroup, type RestServerSeam, type SeamAuthorizeInput, type TokenRevokeCheck, TokensApiGroup, WorkApiGroup, bucketCall, commitCallsMost, storeCall };
package/dist/effect.mjs CHANGED
@@ -1,11 +1,8 @@
1
- import { GitCaller, GitClient, GitStore } from "./contracts/services.mjs";
2
- import { effectGitClient } from "./client/client.mjs";
1
+ import { GitCaller, GitStore } from "./contracts/services.mjs";
3
2
  import { CallBudget } from "./store/call-count.mjs";
4
- import { spentRefusalOf } from "./contracts/calls-spent.mjs";
5
- import { storeCall } from "./store/errors.mjs";
3
+ import { commitCallsMost, storeCall } from "./store/errors.mjs";
6
4
  import { bucketCall } from "./storage/calls.mjs";
7
5
  import { GitRestApi } from "./rest/api.mjs";
8
- import { GitServer } from "./server/routes.mjs";
9
6
  import { GitCallerMiddleware, GitRestServices } from "./rest/caller.mjs";
10
7
  import { GitErrors } from "./rest/errors.mjs";
11
8
  import { GitRestHandlers } from "./rest/handlers.mjs";
@@ -14,4 +11,4 @@ import { RefsApiGroup } from "./rest/refs.mjs";
14
11
  import { ReposApiGroup } from "./rest/repos.mjs";
15
12
  import { TokensApiGroup } from "./rest/tokens.mjs";
16
13
  import { WorkApiGroup } from "./rest/work.mjs";
17
- export { CallBudget, GitCaller, GitCallerMiddleware, GitClient, GitErrors, GitRestApi, GitRestHandlers, GitRestServices, GitServer, GitStore, MeApiGroup, RefsApiGroup, ReposApiGroup, TokensApiGroup, WorkApiGroup, bucketCall, effectGitClient, spentRefusalOf, storeCall };
14
+ export { CallBudget, GitCaller, GitCallerMiddleware, GitErrors, GitRestApi, GitRestHandlers, GitRestServices, GitStore, MeApiGroup, RefsApiGroup, ReposApiGroup, TokensApiGroup, WorkApiGroup, bucketCall, commitCallsMost, storeCall };