@ref0/git 0.7.0 → 0.8.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 (191) 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/client.d.mts +16 -9
  36. package/dist/contracts/events.d.mts +12 -10
  37. package/dist/contracts/events.mjs +8 -6
  38. package/dist/contracts/files.d.mts +42 -42
  39. package/dist/contracts/forks.d.mts +0 -24
  40. package/dist/contracts/git-hooks.d.mts +217 -0
  41. package/dist/contracts/git-hooks.mjs +3 -1
  42. package/dist/contracts/grants.d.mts +46 -27
  43. package/dist/contracts/lfs.d.mts +17 -4
  44. package/dist/contracts/merges.d.mts +7 -7
  45. package/dist/contracts/objects.d.mts +20 -4
  46. package/dist/contracts/opaque.mjs +19 -1
  47. package/dist/contracts/operations.d.mts +8 -1
  48. package/dist/contracts/operations.mjs +209 -0
  49. package/dist/contracts/queue.d.mts +3 -3
  50. package/dist/contracts/queue.mjs +5 -18
  51. package/dist/contracts/remote.d.mts +13 -4
  52. package/dist/contracts/remote.mjs +3 -3
  53. package/dist/contracts/repos.d.mts +11 -40
  54. package/dist/contracts/repos.mjs +11 -10
  55. package/dist/contracts/result.d.mts +28 -11
  56. package/dist/contracts/result.mjs +32 -2
  57. package/dist/contracts/rules.d.mts +706 -46
  58. package/dist/contracts/rules.mjs +81 -2
  59. package/dist/contracts/server.d.mts +5 -275
  60. package/dist/contracts/services.d.mts +0 -3
  61. package/dist/contracts/services.mjs +1 -3
  62. package/dist/contracts/signin.d.mts +2 -2
  63. package/dist/contracts/signin.mjs +4 -5
  64. package/dist/contracts/sync.d.mts +1 -4
  65. package/dist/contracts/tokens.d.mts +29 -17
  66. package/dist/contracts/tokens.mjs +14 -3
  67. package/dist/contracts/topics.d.mts +38 -11
  68. package/dist/contracts/topics.mjs +8 -2
  69. package/dist/core/access.d.mts +0 -2
  70. package/dist/core/access.mjs +15 -4
  71. package/dist/core/events/deliver.mjs +19 -1
  72. package/dist/core/forks.mjs +30 -11
  73. package/dist/core/hooks/groups.d.mts +0 -1
  74. package/dist/core/hooks/groups.mjs +8 -9
  75. package/dist/core/loose-tally.mjs +46 -0
  76. package/dist/core/objects/writing.mjs +1 -0
  77. package/dist/core/promise.mjs +1 -15
  78. package/dist/core/purge.mjs +14 -9
  79. package/dist/core/push.mjs +13 -6
  80. package/dist/core/ref-view.mjs +14 -6
  81. package/dist/core/repack.mjs +19 -14
  82. package/dist/core/repo-info.mjs +8 -6
  83. package/dist/core/repos.mjs +1 -0
  84. package/dist/core/rules/check.mjs +10 -10
  85. package/dist/core/rules/context.d.mts +3 -1
  86. package/dist/core/rules/context.mjs +16 -13
  87. package/dist/core/rules/fetch.mjs +17 -23
  88. package/dist/core/tokens.mjs +2 -1
  89. package/dist/effect.d.mts +2 -4
  90. package/dist/effect.mjs +2 -4
  91. package/dist/engine/commits.mjs +19 -47
  92. package/dist/engine/failures.d.mts +1 -2
  93. package/dist/engine/failures.mjs +1 -3
  94. package/dist/engine/merge-base-walk.mjs +57 -142
  95. package/dist/engine/merge-bases.mjs +5 -5
  96. package/dist/engine/merge.mjs +16 -14
  97. package/dist/extend.d.mts +1 -2
  98. package/dist/extend.mjs +1 -2
  99. package/dist/http/core-parts.mjs +1 -2
  100. package/dist/http/handler.mjs +11 -31
  101. package/dist/http/parts.d.mts +0 -1
  102. package/dist/index.d.mts +28 -21
  103. package/dist/index.mjs +5 -2
  104. package/dist/lfs/base.d.mts +6 -3
  105. package/dist/lfs/base.mjs +2 -1
  106. package/dist/lfs/layer.d.mts +4 -3
  107. package/dist/lfs/layer.mjs +23 -9
  108. package/dist/lfs/objects.mjs +90 -41
  109. package/dist/lfs/pointers.mjs +69 -18
  110. package/dist/lfs/purge.mjs +6 -2
  111. package/dist/lfs/rows.mjs +24 -7
  112. package/dist/lfs/service.d.mts +6 -3
  113. package/dist/lfs/service.mjs +8 -2
  114. package/dist/lfs/upkeep.mjs +44 -26
  115. package/dist/lfs/upload-most.mjs +41 -0
  116. package/dist/lfs/uploaded.mjs +59 -0
  117. package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
  118. package/dist/protocol/bytes/text.mjs +6 -1
  119. package/dist/protocol/objects/fsck.mjs +6 -3
  120. package/dist/queue/advance.mjs +38 -8
  121. package/dist/queue/calls.mjs +4 -14
  122. package/dist/queue/lanes.mjs +1 -1
  123. package/dist/queue/rows.mjs +8 -0
  124. package/dist/queue/schedule.mjs +1 -1
  125. package/dist/queue/search.mjs +3 -4
  126. package/dist/rest/client-namespace.d.mts +2 -0
  127. package/dist/rest/client.d.mts +32 -8
  128. package/dist/rest/client.mjs +308 -382
  129. package/dist/rest/commits.d.mts +240 -240
  130. package/dist/rest/files.d.mts +18 -18
  131. package/dist/rest/forks.d.mts +45 -57
  132. package/dist/rest/handlers.mjs +2 -1
  133. package/dist/rest/listen.d.mts +8 -6
  134. package/dist/rest/listen.mjs +31 -75
  135. package/dist/rest/me.d.mts +2 -2
  136. package/dist/rest/merges.d.mts +7 -7
  137. package/dist/rest/refs.d.mts +139 -139
  138. package/dist/rest/repos.d.mts +54 -66
  139. package/dist/rest/tokens.d.mts +12 -12
  140. package/dist/rest/topics.d.mts +110 -110
  141. package/dist/rest/trees.d.mts +66 -66
  142. package/dist/rest/wire.d.mts +1 -1
  143. package/dist/rest.d.mts +1 -7
  144. package/dist/rest.mjs +1 -5
  145. package/dist/server/git-layer.d.mts +10 -2
  146. package/dist/server/git-layer.mjs +29 -10
  147. package/dist/server/joined.d.mts +1 -1
  148. package/dist/server/server.d.mts +0 -1
  149. package/dist/server/server.mjs +26 -45
  150. package/dist/signin/context.d.mts +0 -1
  151. package/dist/signin/context.mjs +5 -9
  152. package/dist/storage/clean-up.mjs +3 -1
  153. package/dist/storage/fsck.mjs +12 -2
  154. package/dist/storage/graph-rebuild.mjs +262 -0
  155. package/dist/storage/index-build.mjs +100 -12
  156. package/dist/storage/lfs-pointers.d.mts +5 -5
  157. package/dist/storage/lfs-pointers.mjs +37 -11
  158. package/dist/storage/loose.mjs +4 -1
  159. package/dist/storage/memory-budget.mjs +1 -1
  160. package/dist/storage/merge-fence.mjs +81 -19
  161. package/dist/storage/merge-most.mjs +1 -0
  162. package/dist/storage/merge-row.mjs +16 -4
  163. package/dist/storage/merge-stream.mjs +9 -6
  164. package/dist/storage/object-rows.mjs +17 -1
  165. package/dist/storage/pack-receive.mjs +10 -6
  166. package/dist/storage/packs.mjs +58 -27
  167. package/dist/storage/prune.mjs +68 -40
  168. package/dist/storage/ready.d.mts +1 -1
  169. package/dist/storage/ready.mjs +12 -3
  170. package/dist/storage/receive-state.mjs +1 -1
  171. package/dist/storage/repack-contained.mjs +22 -14
  172. package/dist/storage/repack.d.mts +1 -1
  173. package/dist/storage/repack.mjs +3 -2
  174. package/dist/storage/unpack.mjs +7 -0
  175. package/dist/store/call-count.d.mts +23 -3
  176. package/dist/store/call-count.mjs +36 -13
  177. package/dist/store/records.mjs +10 -4
  178. package/dist/store/repo-record.mjs +29 -12
  179. package/dist/store/scopes.mjs +6 -1
  180. package/dist/sync/import.mjs +14 -2
  181. package/dist/sync/layer.d.mts +5 -1
  182. package/dist/sync/layer.mjs +7 -2
  183. package/dist/sync/step.mjs +15 -15
  184. package/dist/topics/advance.mjs +7 -6
  185. package/dist/topics/members.mjs +38 -9
  186. package/package.json +3 -3
  187. package/dist/engine/merge-base-walk.d.mts +0 -3
  188. package/dist/server/routes.d.mts +0 -32
  189. package/dist/server/routes.mjs +0 -69
  190. package/dist/sync/bridge.d.mts +0 -6
  191. package/dist/sync/bridge.mjs +0 -29
@@ -4,7 +4,7 @@ import { fail, gitError } from "../contracts/result.mjs";
4
4
  import { hostCall } from "../auth/host-function.mjs";
5
5
  import { buildFence, checkPush, retriedCodes } from "../core/push.mjs";
6
6
  import { host } from "../contracts/git.mjs";
7
- import { CoreParts, asHost, overStore } from "../core/parts.mjs";
7
+ import { asHost, overStore } from "../core/parts.mjs";
8
8
  import { mergedTree } from "../core/objects/commit-writes.mjs";
9
9
  import { openRead, readerOf } from "../core/objects/reading.mjs";
10
10
  import { MadeObjects, madeCommit, writeDigest } from "../core/objects/writing.mjs";
@@ -161,7 +161,7 @@ const groupsKey = (id, entries, most) => JSON.stringify([
161
161
  /**
162
162
  * `groupsOf`, but once per try for a candidate, its entries and its most: a step planned again
163
163
  * after its write found the version moved, by any write in the repo, takes the groups the host
164
- * gave, as it saw the lane then, so the host's `bisect` and `onError` hear of it once.
164
+ * gave, as it saw the lane then, so the host's `bisect` is asked, and its failure logged, once.
165
165
  */
166
166
  const triedGroups = (tried, state, options, id, candidate, most) => {
167
167
  const key = groupsKey(id, candidate.entries, most);
@@ -429,7 +429,10 @@ const advanceStep = /* @__PURE__ */ Effect.fnUntraced(function* (host, context,
429
429
  const schedules = schedulesOf(state, options);
430
430
  const plan = new QueuePlan(state, now);
431
431
  if (yield* openSearched(plan, schedules)) return queueOwn(context, plan, againStep);
432
- const scanned = yield* scan(plan, schedules, stack, holder === void 0 ? void 0 : reserved);
432
+ const live = holder === void 0 ? void 0 : reserved;
433
+ const { frozen } = row;
434
+ const freeze = live === void 0 && frozen !== void 0 && (yield* isLive(context.store, frozen)) ? frozen : void 0;
435
+ const scanned = yield* scan(plan, schedules, stack, live, freeze);
433
436
  if (scanned === "opened") return queueOwn(context, plan, idleStep);
434
437
  return scanned === void 0 ? idle : {
435
438
  kind: "done",
@@ -492,6 +495,25 @@ const pinnedOf = (state, stack) => stack.filter(({ candidate }) => candidate.ent
492
495
  return row !== void 0 && opensAlone(row);
493
496
  }));
494
497
  /**
498
+ * The entries a live topic's freeze of the target lets open: those ahead of its member in one of
499
+ * its lanes, at no higher priority, none jumped since it froze. Each was there when it froze, so
500
+ * the target drains of all but these, and then of these (Q1159). With no member waiting, none.
501
+ */
502
+ const thawedOf = (state, waiting, frozen) => {
503
+ const at = waiting.findIndex((place) => state.entries.get(place.entry)?.topic?.topic === frozen.topic);
504
+ const member = waiting[at];
505
+ const row = member === void 0 ? void 0 : state.entries.get(member.entry);
506
+ if (member === void 0 || row === void 0) return /* @__PURE__ */ new Set();
507
+ const lanes = new Set(lanesOf(row));
508
+ const thawed = waiting.slice(0, at).filter((place) => {
509
+ const entry = state.entries.get(place.entry);
510
+ const shares = entry !== void 0 && lanesOf(entry).some((lane) => lanes.has(lane));
511
+ const before = place.jumped === void 0 || place.jumped < frozen.next;
512
+ return shares && place.priority <= member.priority && before;
513
+ });
514
+ return new Set(thawed.map(({ entry }) => entry));
515
+ };
516
+ /**
495
517
  * Opens the next candidate in the target's order, lane by lane: the oldest waiting entry whose
496
518
  * lanes have room and a place, with the waiting entries after it in no other lane, up to the
497
519
  * smallest `maxSize` among its lanes. An entry that can't open blocks its lanes, and every entry
@@ -499,12 +521,15 @@ const pinnedOf = (state, stack) => stack.filter(({ candidate }) => candidate.ent
499
521
  * tip, with nothing landing and no other pinned one open, so nothing moves the tip under it till it
500
522
  * ends. A topic's member waits, blocking its lanes, till its topic reserves the target, and while
501
523
  * `live`, a topic's reservation, holds it, only that topic's member opens, wherever it is in the
502
- * order. `opened` once it opened one, else when a short batch's `wait` ends.
524
+ * order. While `frozen`, a live topic's freeze, holds it, only the entries `thawedOf` names open,
525
+ * and a short batch waits for none. `opened` once it opened one, else when a short batch's `wait`
526
+ * ends.
503
527
  */
504
- const scan = /* @__PURE__ */ Effect.fnUntraced(function* (plan, schedules, stack, live) {
528
+ const scan = /* @__PURE__ */ Effect.fnUntraced(function* (plan, schedules, stack, live, frozen) {
505
529
  const { state } = plan;
506
530
  const held = stack.some(({ candidate }) => candidate.landing === true) || pinnedOf(state, stack).length > 0;
507
531
  const waiting = orderOf(state.row.order).filter((place) => state.entries.get(place.entry)?.state === "waiting");
532
+ const thawed = frozen === void 0 ? void 0 : thawedOf(state, waiting, frozen);
508
533
  const blocked = /* @__PURE__ */ new Set();
509
534
  let soonest;
510
535
  for (const [at, place] of waiting.entries()) {
@@ -514,6 +539,10 @@ const scan = /* @__PURE__ */ Effect.fnUntraced(function* (plan, schedules, stack
514
539
  const block = () => lanes.forEach((lane) => blocked.add(lane));
515
540
  const { topic } = row;
516
541
  if (live !== void 0 && topic?.topic !== live.topic) continue;
542
+ if (thawed !== void 0 && !thawed.has(place.entry)) {
543
+ block();
544
+ continue;
545
+ }
517
546
  if (live === void 0 && topic !== void 0) {
518
547
  block();
519
548
  continue;
@@ -552,6 +581,7 @@ const scan = /* @__PURE__ */ Effect.fnUntraced(function* (plan, schedules, stack
552
581
  const own = laterRow === void 0 ? [] : lanesOf(laterRow);
553
582
  if (laterRow === void 0 || !own.some((lane) => lanes.has(lane))) continue;
554
583
  if (opensAlone(laterRow) || !own.every((lane) => lanes.has(lane))) break;
584
+ if (thawed !== void 0 && !thawed.has(later.entry)) break;
555
585
  const key = callerKey(laterRow);
556
586
  const past = !callers.has(key) && callers.size >= queueLimits.candidateCallers;
557
587
  closed = laterRow.alone === true || past;
@@ -560,7 +590,7 @@ const scan = /* @__PURE__ */ Effect.fnUntraced(function* (plan, schedules, stack
560
590
  batch.push(later);
561
591
  }
562
592
  const due = Math.min(...batch.map((open) => open.since)) + wait;
563
- if (!closed && batch.length < maxSize && due > plan.now) {
593
+ if (!closed && thawed === void 0 && batch.length < maxSize && due > plan.now) {
564
594
  block();
565
595
  soonest = Math.min(soonest ?? Number.MAX_SAFE_INTEGER, due);
566
596
  continue;
@@ -748,10 +778,10 @@ const treeOf = (linking, entry, sides) => mergedTree(linking.opened, linking.mad
748
778
  /** A host's `merge` answer read as a `MergePlan`: a host in plain JavaScript may answer any value. */
749
779
  const decodePlan = /* @__PURE__ */ Schema.decodeUnknownSync(MergePlan);
750
780
  /** The host's plan for an entry's link: a throw or bad plan fails it `host-error`, with the failure's ID. */
751
- const planOf = (linking, entry, row, commits) => Effect.flatMap(Effect.service(CoreParts), ({ checks }) => hostCall(checks.reports, "queue.merge", { repo: linking.repo }, () => decodePlan(linking.options.merge({
781
+ const planOf = (linking, entry, row, commits) => hostCall("queue.merge", { repo: linking.repo }, () => decodePlan(linking.options.merge({
752
782
  entry: entryOf(linking.repo, entry, row, linking.notes.get(entry) ?? {}),
753
783
  commits
754
- })))).pipe(Effect.catch((error) => {
784
+ }))).pipe(Effect.catch((error) => {
755
785
  const id = error.code === "UNAVAILABLE" || error.code === "DEADLINE_EXCEEDED" ? error.context?.id ?? "" : "";
756
786
  return Effect.fail(linkFailed(entry, {
757
787
  kind: "host-error",
@@ -237,23 +237,13 @@ const askJoin = (options, repo, caller, input) => {
237
237
  },
238
238
  actor: caller.actor
239
239
  };
240
- const asked = Effect.flatMap(Effect.service(CoreParts), ({ checks }) => hostCall(checks.reports, "join", about, async (signal) => decodeJoin(await join({
240
+ const asked = hostCall("join", about, async (signal) => decodeJoin(await join({
241
241
  repo,
242
242
  entry,
243
243
  actor: caller.actor,
244
244
  signal
245
- })), { timeout: 3e4 }));
246
- return Effect.flatMap(asked, (answer) => {
247
- if (answer.kind !== "reject") return Effect.void;
248
- const refused = {
249
- kind: "reject",
250
- message: answer.message
251
- };
252
- if (answer.code !== void 0) refused.code = answer.code;
253
- if (answer.hint !== void 0) refused.hint = answer.hint;
254
- if (answer.context !== void 0) refused.context = answer.context;
255
- return Effect.fail(rejectedError(refused));
256
- });
245
+ })), { timeout: 3e4 });
246
+ return Effect.flatMap(asked, (answer) => answer.kind === "reject" ? Effect.fail(rejectedError(answer)) : Effect.void);
257
247
  };
258
248
  /** The write a call makes as `caller`, once it's authorized. */
259
249
  const writeAs = (caller, name, plan) => ({
@@ -360,7 +350,7 @@ const lanesFor = /* @__PURE__ */ Effect.fnUntraced(function* (caller, opened) {
360
350
  from: tip ?? void 0,
361
351
  to: input.head
362
352
  });
363
- return yield* hostCall(core.checks.reports, "queue.lanes", about, async (signal) => {
353
+ return yield* hostCall("queue.lanes", about, async (signal) => {
364
354
  let diffed;
365
355
  const changes = async () => {
366
356
  diffed ??= runIn(Effect.result(diff), scope, signal);
@@ -6,7 +6,7 @@ import * as Schema from "effect/Schema";
6
6
  const decodeLanes = /* @__PURE__ */ Schema.decodeUnknownSync(LanesAnswer);
7
7
  /**
8
8
  * The lanes a host's `lanes` answered, each once in the order first named: throws, which fails
9
- * the entry `host-error` and goes to `onError`, for an answer that isn't strings, names more than
9
+ * the entry `host-error` and is logged at `Error`, for an answer that isn't strings, names more than
10
10
  * `queueLimits.lanes`, or a lane outside 1 to `queueLimits.laneBytes` bytes of UTF-8 as JSON
11
11
  * writes it, as the queue counts its other names, so a control character counts 6.
12
12
  */
@@ -65,6 +65,10 @@ const PlaceRow = /* @__PURE__ */ Schema.Struct({
65
65
  * candidate merged, `b` for one its report failed and `c` for one closed otherwise; `previous`: the `concurrency` last asked.
66
66
  * `reserved`: the topic holding the target, at its attempt, which refuses every other writer while
67
67
  * that attempt is live, the queue's own publish and `restart` among them (Q557), `since` it took it.
68
+ * `frozen`: the topic whose member has waited half its `waitTimeout` for the target, with `next`,
69
+ * the order's next number when it froze, so an entry that jumped after it is no entry ahead: while that topic is live and holds no reservation here, the queue opens no new
70
+ * candidate but of the entries ahead of the member in one of its lanes, at no higher priority, and
71
+ * the target drains (Q1159).
68
72
  * `idle`: when the row was put with nothing open, held, searched or reserved, which every later
69
73
  * put of an idle row keeps, and one that isn't drops: `queue.trim` deletes it `queueLimits.kept`
70
74
  * after.
@@ -84,6 +88,10 @@ const TargetRow = /* @__PURE__ */ Schema.Struct({
84
88
  ...Reservation.fields,
85
89
  since: Schema.Int
86
90
  })),
91
+ frozen: Schema.optionalKey(Schema.Struct({
92
+ ...Reservation.fields,
93
+ next: Schema.Int
94
+ })),
87
95
  idle: Schema.optionalKey(Schema.Finite)
88
96
  });
89
97
  /**
@@ -90,7 +90,7 @@ const schedulesOf = (state, options) => {
90
90
  if (option === void 0) return fallback;
91
91
  if (!isAsked(option)) return fit(option);
92
92
  const seen = yield* viewOf(/* @__PURE__ */ new Set([lane]));
93
- return yield* hostCall((yield* CoreParts).checks.reports, "queue.schedule", about, () => fit(option(seen))).pipe(Effect.catch(() => Effect.succeed(fallback)));
93
+ return yield* hostCall("queue.schedule", about, () => fit(option(seen))).pipe(Effect.catch(() => Effect.succeed(fallback)));
94
94
  });
95
95
  return {
96
96
  of: Effect.fnUntraced(function* (lane) {
@@ -5,7 +5,6 @@ import { openCandidate } from "./calls.mjs";
5
5
  import { lanesNamed, placeOf, placed } from "./lanes.mjs";
6
6
  import { concurrencyOf, roomFor, schedulesOf } from "./schedule.mjs";
7
7
  import { candidateOf, closeCandidate, endEntry, endSearch, isOpen, releaseEntry, setChecking } from "./steps.mjs";
8
- import { CoreParts } from "../core/parts.mjs";
9
8
  import * as Effect from "effect/Effect";
10
9
  import * as Schema from "effect/Schema";
11
10
  // src/queue/search.ts
@@ -87,8 +86,8 @@ const checkGroups = (answer, entries, most) => {
87
86
  /**
88
87
  * The groups to check `row`'s entries in, naming at most `most`: the host's `bisect`, given the
89
88
  * candidate and its lane's view without it, the target's when it's in several, or halves. An
90
- * answer `checkGroups` refuses, or a throw, takes halves, which `onError` hears of as
91
- * `queue.bisect`.
89
+ * answer `checkGroups` refuses, or a throw, takes halves, logged at `Error` as
90
+ * `queue.bisect`'s.
92
91
  */
93
92
  const groupsOf = /* @__PURE__ */ Effect.fnUntraced(function* (state, options, id, row, most) {
94
93
  const { bisect } = options;
@@ -99,7 +98,7 @@ const groupsOf = /* @__PURE__ */ Effect.fnUntraced(function* (state, options, id
99
98
  ...seen,
100
99
  open: seen.open.filter((open) => open.id !== id)
101
100
  };
102
- return yield* hostCall((yield* CoreParts).checks.reports, "queue.bisect", { repo }, () => checkGroups(decodeGroups(bisect(candidateOf(repo, id, row), view)), row.entries, most)).pipe(Effect.catch(() => Effect.succeed(halve(row.entries))));
101
+ return yield* hostCall("queue.bisect", { repo }, () => checkGroups(decodeGroups(bisect(candidateOf(repo, id, row), view)), row.entries, most)).pipe(Effect.catch(() => Effect.succeed(halve(row.entries))));
103
102
  });
104
103
  const setSearch = (plan, failed, search) => {
105
104
  const row = plan.candidates.get(failed);
@@ -0,0 +1,2 @@
1
+ import { client_d_exports } from "./client.mjs";
2
+ export { client_d_exports as RestClient };
@@ -1,18 +1,42 @@
1
- import { CallInput } from "../contracts/actors.mjs";
2
- import { RemoteCalls, RemoteOptions } from "../contracts/remote.mjs";
3
- import { Result } from "../contracts/result.mjs";
1
+ import { RemoteCalls, RemoteOptions, WithoutSignal } from "../contracts/remote.mjs";
2
+ import { GitError } from "../contracts/result.mjs";
4
3
  import { ServerCalls } from "../contracts/server.mjs";
5
4
  import { CreatedToken, TokenCalls, TokenCreateInput, TokenTarget } from "../contracts/tokens.mjs";
6
5
  import { RestEvents } from "./listen.mjs";
7
6
  import { Me } from "./me.mjs";
7
+ import * as Effect from "effect/Effect";
8
+ import * as HttpClient from "effect/http/HttpClient";
9
+ import * as Context from "effect/Context";
10
+ import * as Layer from "effect/Layer";
11
+ declare namespace client_d_exports {
12
+ export { RestClient, RestClientCalls, RestTokenCalls, layer, make };
13
+ }
8
14
  /** `create` takes no `actor`, as REST's caller is it; `revokeKey` is a host's own, with no route. */
9
15
  export interface RestTokenCalls extends Omit<RemoteCalls<TokenCalls>, 'create' | 'revokeKey'> {
10
- readonly create: (target: TokenTarget, input: Omit<TokenCreateInput, 'actor'>) => Promise<Result<CreatedToken>>;
16
+ readonly create: (target: TokenTarget, input: WithoutSignal<Omit<TokenCreateInput, 'actor'>>) => Effect.Effect<CreatedToken, GitError>;
11
17
  }
12
- /** The server's calls over REST, each without `actor`, and who the remote's credential is. */
13
- export interface RestClient extends RemoteCalls<Omit<ServerCalls, 'tokens' | 'lfs'>> {
18
+ /**
19
+ * The server's calls over REST, each an Effect without `actor`, and who the remote's credential
20
+ * is. Interrupting a call stops it, its request and any answer's body it's still reading.
21
+ */
22
+ export interface RestClientCalls extends RemoteCalls<Omit<ServerCalls, 'tokens' | 'lfs'>> {
14
23
  readonly tokens: RestTokenCalls;
15
24
  readonly events: RestEvents;
16
- readonly me: (input?: CallInput) => Promise<Result<Me>>;
25
+ readonly me: () => Effect.Effect<Me, GitError>;
17
26
  }
18
- export declare const createRestClient: (options: RemoteOptions) => RestClient;
27
+ declare const RestClient_base: Context.ServiceClass<RestClient, "@ref0/git/RestClient", RestClientCalls>;
28
+ /**
29
+ * A REST client of one remote as a service, for a program that's handed one: with `RestClient`
30
+ * from `@ref0/git`, `RestClient.layer(options)` provides it.
31
+ */
32
+ export declare class RestClient extends /* @__PURE__ */ RestClient_base {}
33
+ /**
34
+ * A typed client for a Git server's REST at `options.url`: `HttpApiClient` over `GitRestApi`, each
35
+ * call an Effect that fails with the server's own `GitError`. It sends `credentials` on each
36
+ * request, through `options.transport` when given and the `HttpClient` it's provided otherwise. It
37
+ * carries none of REST's serving code.
38
+ */
39
+ export declare const make: (options: RemoteOptions) => Effect.Effect<RestClientCalls, never, HttpClient.HttpClient>;
40
+ /** `RestClient` over `options`' remote, as `make` builds it. */
41
+ export declare const layer: (options: RemoteOptions) => Layer.Layer<RestClient, never, HttpClient.HttpClient>;
42
+ export { client_d_exports };