@gusto/baerly-storage 0.2.0 → 0.4.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 (155) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +29 -0
  3. package/README.md +176 -70
  4. package/dist/API.md +213 -139
  5. package/dist/CHANGELOG.md +434 -0
  6. package/dist/RECIPES.md +125 -0
  7. package/dist/THIRD-PARTY-LICENSES.txt +238 -0
  8. package/dist/{app-config-C0Bbw_Z6.d.ts → app-config-DyiFK3_k.d.ts} +55 -11
  9. package/dist/app-config.d.ts +1 -1
  10. package/dist/auth.d.ts +1 -1
  11. package/dist/auth.js +301 -301
  12. package/dist/auth.js.map +1 -1
  13. package/dist/aws4fetch.esm-p7eEzLCs.js +1702 -0
  14. package/dist/aws4fetch.esm-p7eEzLCs.js.map +1 -0
  15. package/dist/baerly.js +35 -15
  16. package/dist/baerly.js.map +1 -1
  17. package/dist/baerly.spec.json +342 -0
  18. package/dist/bytes-BXdamO3L.js.map +1 -1
  19. package/dist/{client-DYZfoZb9.d.ts → client-Fe8CwB73.d.ts} +10 -10
  20. package/dist/client-react.d.ts +3 -3
  21. package/dist/client-react.js +4 -4
  22. package/dist/client-react.js.map +1 -1
  23. package/dist/client.d.ts +4 -4
  24. package/dist/client.js +3 -3
  25. package/dist/client.js.map +1 -1
  26. package/dist/{cloudflare-CINJPKCW.js → cloudflare-DzKBrUlg.js} +178 -2
  27. package/dist/cloudflare-DzKBrUlg.js.map +1 -0
  28. package/dist/cloudflare.d.ts +49 -6
  29. package/dist/cloudflare.js +59 -26
  30. package/dist/cloudflare.js.map +1 -1
  31. package/dist/config-1tv0-Yzm.js +2693 -0
  32. package/dist/config-1tv0-Yzm.js.map +1 -0
  33. package/dist/constants-CfeMWQWk.js +222 -0
  34. package/dist/constants-CfeMWQWk.js.map +1 -0
  35. package/dist/context-DRZ3tZ5l.js.map +1 -1
  36. package/dist/{cost-CQt1YRkA.js → cost-DSMIVqzL.js} +43 -42
  37. package/dist/cost-DSMIVqzL.js.map +1 -0
  38. package/dist/current-json-C6nhPOm1.js +190 -0
  39. package/dist/current-json-C6nhPOm1.js.map +1 -0
  40. package/dist/{db-BM3y2JQw.d.ts → db-DsPkOVEH.d.ts} +26 -108
  41. package/dist/{deploy-CrAbfgCq.js → deploy-DonTr-CV.js} +12 -5
  42. package/dist/deploy-DonTr-CV.js.map +1 -0
  43. package/dist/dev-vite.d.ts +11 -7
  44. package/dist/dev-vite.js +7 -6
  45. package/dist/dev-vite.js.map +1 -1
  46. package/dist/dev.d.ts +1 -1
  47. package/dist/dev.js +1 -1
  48. package/dist/{doctor-Db-hzPmE.js → doctor-DSIyCDg_.js} +14 -136
  49. package/dist/doctor-DSIyCDg_.js.map +1 -0
  50. package/dist/{dump-BYA55NLP.js → dump-Bh5k26VQ.js} +10 -31
  51. package/dist/dump-Bh5k26VQ.js.map +1 -0
  52. package/dist/{errors-DOdL95kK.js → errors-Dfa3p78c.js} +25 -5
  53. package/dist/errors-Dfa3p78c.js.map +1 -0
  54. package/dist/{export-Bhbz90-z.js → export-DtF5tDIM.js} +11 -32
  55. package/dist/{export-Bhbz90-z.js.map → export-DtF5tDIM.js.map} +1 -1
  56. package/dist/{fsck-CPPZWt9p.js → fsck-D_djMO5D.js} +28 -39
  57. package/dist/fsck-D_djMO5D.js.map +1 -0
  58. package/dist/{http-Cw8p6y5b.js → http-DxM9MflO.js} +151 -79
  59. package/dist/http-DxM9MflO.js.map +1 -0
  60. package/dist/http.d.ts +42 -26
  61. package/dist/http.js +3 -2
  62. package/dist/{index-DwDTWPSU.d.ts → index-0rZcMBwy.d.ts} +10 -7
  63. package/dist/{index-C3JAH1Yo.d.ts → index-B6oexfOB.d.ts} +9 -9
  64. package/dist/{index-cUY-36AN.d.ts → index-BNRh23K9.d.ts} +21 -5
  65. package/dist/{index-DSvwEUeF.d.ts → index-BYk9oCNf.d.ts} +240 -202
  66. package/dist/index.d.ts +6 -6
  67. package/dist/index.js +5 -5
  68. package/dist/{indexes-DAu2AkTW.d.ts → indexes-Dn9hbGQG.d.ts} +2 -2
  69. package/dist/{inspect-Bdbzvi-_.js → inspect-6WZ-pC7-.js} +21 -36
  70. package/dist/inspect-6WZ-pC7-.js.map +1 -0
  71. package/dist/key-Di6yyxFu.js +35 -0
  72. package/dist/key-Di6yyxFu.js.map +1 -0
  73. package/dist/{snapshot-SS8USDUF.js → log-tail-D98U1JBo.js} +179 -84
  74. package/dist/log-tail-D98U1JBo.js.map +1 -0
  75. package/dist/{maintenance-ClzBC1Vv.js → maintenance-B4Dki6Ig.js} +438 -176
  76. package/dist/maintenance-B4Dki6Ig.js.map +1 -0
  77. package/dist/{maintenance-BRrThz8V.d.ts → maintenance-B_e0T99L.d.ts} +114 -26
  78. package/dist/{maintenance-BvOv6BMM.js → maintenance-C7coQp4c.js} +217 -94
  79. package/dist/maintenance-C7coQp4c.js.map +1 -0
  80. package/dist/maintenance.d.ts +3 -2
  81. package/dist/maintenance.js +3 -2
  82. package/dist/node.d.ts +176 -68
  83. package/dist/node.js +3 -2
  84. package/dist/{normalize-XWY25_sG.js → normalize-rjnZLwS4.js} +2 -2
  85. package/dist/normalize-rjnZLwS4.js.map +1 -0
  86. package/dist/{observability-CpOiEN0k.js → observability-wzs3-BL_.js} +279 -109
  87. package/dist/observability-wzs3-BL_.js.map +1 -0
  88. package/dist/observability.d.ts +3 -3
  89. package/dist/observability.js +1 -1
  90. package/dist/{plan-DOTl21vq.js → plan-a7PJHBCy.js} +7 -4
  91. package/dist/plan-a7PJHBCy.js.map +1 -0
  92. package/dist/{query-BmiQy328.js → query-rAtXNQQB.js} +1063 -1202
  93. package/dist/query-rAtXNQQB.js.map +1 -0
  94. package/dist/{rebuild-index-DC_nR6wP.js → rebuild-index-BVzQSZlm.js} +10 -32
  95. package/dist/rebuild-index-BVzQSZlm.js.map +1 -0
  96. package/dist/{request-BEF_OvMh.js → request-u0M51mhJ.js} +3 -3
  97. package/dist/{request-BEF_OvMh.js.map → request-u0M51mhJ.js.map} +1 -1
  98. package/dist/restore-R-4rbciV.js +778 -0
  99. package/dist/restore-R-4rbciV.js.map +1 -0
  100. package/dist/runtime-spec-qL3_lTTU.js +391 -0
  101. package/dist/runtime-spec-qL3_lTTU.js.map +1 -0
  102. package/dist/s3-http-B-z8th6O.d.ts +60 -0
  103. package/dist/s3.d.ts +47 -0
  104. package/dist/s3.js +45 -0
  105. package/dist/s3.js.map +1 -0
  106. package/dist/{shared-secret-BJdSwpgw.js → shared-secret-DgEicd3x.js} +13 -5
  107. package/dist/shared-secret-DgEicd3x.js.map +1 -0
  108. package/dist/src-BG20LZs7.js +2271 -0
  109. package/dist/src-BG20LZs7.js.map +1 -0
  110. package/dist/{src-zhEAmmF7.js → src-CYHFDrKz.js} +82 -99
  111. package/dist/src-CYHFDrKz.js.map +1 -0
  112. package/dist/{src-QQ7jDeL2.js → src-DYZ4H1aF.js} +44 -23
  113. package/dist/src-DYZ4H1aF.js.map +1 -0
  114. package/dist/subcommand-DoDA-K7d.js +197 -0
  115. package/dist/subcommand-DoDA-K7d.js.map +1 -0
  116. package/dist/time-DUqvFMHq.js +119 -0
  117. package/dist/time-DUqvFMHq.js.map +1 -0
  118. package/dist/{usage-CLjirdD-.js → usage-DBV1eQHC.js} +7 -22
  119. package/dist/usage-DBV1eQHC.js.map +1 -0
  120. package/dist/{validate-DCq_0DIn.js → validate-DtljsCh1.js} +51 -51
  121. package/dist/{validate-DCq_0DIn.js.map → validate-DtljsCh1.js.map} +1 -1
  122. package/dist/wire-izfGZDvr.js.map +1 -1
  123. package/package.json +77 -42
  124. package/dist/cloudflare-CINJPKCW.js.map +0 -1
  125. package/dist/config-DVfDGyw1.js +0 -278
  126. package/dist/config-DVfDGyw1.js.map +0 -1
  127. package/dist/cost-CQt1YRkA.js.map +0 -1
  128. package/dist/current-json-C-EyJqs0.js +0 -354
  129. package/dist/current-json-C-EyJqs0.js.map +0 -1
  130. package/dist/deploy-CrAbfgCq.js.map +0 -1
  131. package/dist/doctor-Db-hzPmE.js.map +0 -1
  132. package/dist/dump-BYA55NLP.js.map +0 -1
  133. package/dist/errors-DOdL95kK.js.map +0 -1
  134. package/dist/fsck-CPPZWt9p.js.map +0 -1
  135. package/dist/http-Cw8p6y5b.js.map +0 -1
  136. package/dist/inspect-Bdbzvi-_.js.map +0 -1
  137. package/dist/maintenance-BvOv6BMM.js.map +0 -1
  138. package/dist/maintenance-ClzBC1Vv.js.map +0 -1
  139. package/dist/normalize-XWY25_sG.js.map +0 -1
  140. package/dist/observability-CpOiEN0k.js.map +0 -1
  141. package/dist/plan-DOTl21vq.js.map +0 -1
  142. package/dist/query-BmiQy328.js.map +0 -1
  143. package/dist/rebuild-index-DC_nR6wP.js.map +0 -1
  144. package/dist/restore-C6IcmLeA.js +0 -771
  145. package/dist/restore-C6IcmLeA.js.map +0 -1
  146. package/dist/shared-secret-BJdSwpgw.js.map +0 -1
  147. package/dist/snapshot-SS8USDUF.js.map +0 -1
  148. package/dist/src-DU1sCMlr.js +0 -6236
  149. package/dist/src-DU1sCMlr.js.map +0 -1
  150. package/dist/src-QQ7jDeL2.js.map +0 -1
  151. package/dist/src-zhEAmmF7.js.map +0 -1
  152. package/dist/subcommand-DZcHcsYp.js +0 -5122
  153. package/dist/subcommand-DZcHcsYp.js.map +0 -1
  154. package/dist/usage-CLjirdD-.js.map +0 -1
  155. /package/dist/{chunk-EAsCxrDo.js → rolldown-runtime-EAsCxrDo.js} +0 -0
@@ -1,5 +1,5 @@
1
- import { d as IndexDefinition } from "./app-config-C0Bbw_Z6.js";
2
- import { h as Storage, p as CurrentJson } from "./index-DSvwEUeF.js";
1
+ import { d as IndexDefinition } from "./app-config-DyiFK3_k.js";
2
+ import { d as CurrentJson, p as Storage } from "./index-BYk9oCNf.js";
3
3
  //#region packages/server/src/compactor.d.ts
4
4
  /**
5
5
  * Public configuration knobs for {@link compact}. All optional; the
@@ -54,6 +54,19 @@ interface InternalCompactOptions extends CompactOptions {
54
54
  * row count balloons.
55
55
  */
56
56
  readonly ceilingEntries?: number;
57
+ /**
58
+ * @internal A fresh tail LOWER BOUND the caller already observed (the
59
+ * write-tick runner threads the writer's in-memory `observedTail`,
60
+ * `seq + 1`). When present it raises the ceiling-probe FLOOR to
61
+ * `max(log_seq_start, tail_hint, knownTail)`, so on a stale-low stored
62
+ * `tail_hint` the forward probe walks only "commits since this writer's
63
+ * commit" instead of re-walking the whole gap from the stale hint
64
+ * (which could blow the CF subrequest budget — B4). The compactor still
65
+ * discovers the TRUE tail by probing UP from this floor (small gap).
66
+ * Absent on the scheduled path ⇒ probe from `max(log_seq_start,
67
+ * tail_hint)` as before.
68
+ */
69
+ readonly knownTail?: number;
57
70
  }
58
71
  interface CompactResult {
59
72
  /** `true` iff a new snapshot landed and `current.json` was advanced. */
@@ -274,7 +287,7 @@ interface RebuildIndexOptions {
274
287
  * @throws BaerlyError code="InvalidResponse" — `current.json` missing.
275
288
  * @throws BaerlyError code="Internal" — protocol-invariant
276
289
  * violation (snapshot hash mismatch, missing log entry inside
277
- * `[log_seq_start, next_seq)`).
290
+ * `[log_seq_start, tail_hint)`).
278
291
  */
279
292
  declare const rebuildIndex: (storage: Storage, currentJsonKey: string, def: IndexDefinition, opts?: RebuildIndexOptions) => Promise<RebuildIndexResult>;
280
293
  //#endregion
@@ -337,34 +350,86 @@ interface MaintenanceResult {
337
350
  * ```
338
351
  */
339
352
  declare const runScheduledMaintenance: (args: MaintenanceArgs, options?: MaintenanceOptions) => Promise<MaintenanceResult>;
353
+ /** The six host-agnostic write-tick budgets (`maxFoldBytes`=`C`, `maxFoldRows`=`E`). Canonical shape; mirrors the protocol constants (typed there to avoid a cycle). */
354
+ interface MaintenanceProfile {
355
+ readonly gcInterval: number;
356
+ readonly gcMaxMarks: number;
357
+ readonly gcMaxSweeps: number;
358
+ readonly maxFoldEntriesPerPass: number;
359
+ readonly maxFoldBytes: number;
360
+ readonly maxFoldRows: number;
361
+ }
362
+ /**
363
+ * Tuning profile for the 50-subrequest Cloudflare free-tier budget,
364
+ * derived from {@link MAINTENANCE_PROFILE_CF_FREE} (one source of truth).
365
+ *
366
+ * Budget arithmetic (worst case):
367
+ * compact: 1 GET current + 1 GET snapshot (if any) + N GETs log
368
+ * + 1 PUT snapshot + 1 PUT current = 3 + N (N = maxEntriesPerRun).
369
+ * runGc: 1 GET current + 1 GET pending + 3 LISTs (one page each)
370
+ * + M GETs log (live tail for content hashes) + S DELETEs + 1 PUT
371
+ * pending = 6 + M + S.
372
+ *
373
+ * With N=20, M=20, S=10 the totals are: compact ≈ 23, gc ≈ 36 — over
374
+ * the 50 cap combined. The Cloudflare scheduled handler therefore
375
+ * alternates phases per tick (even minute → compact, odd minute →
376
+ * GC) by calling `compact()` / `runGc()` directly instead of
377
+ * `runScheduledMaintenance`; the `maintenance-budget.test.ts`
378
+ * worst-case test proves each phase in isolation sits under 50 ops
379
+ * with these bounds.
380
+ */
340
381
  declare const CLOUDFLARE_FREE_TIER: MaintenanceOptions;
341
382
  /**
342
- * Floor-based GC-cadence boundary crossing. BATCH-SAFE: a
343
- * `commitBatch` that jumps `next_seq` by its whole batch size can step
344
- * CLEAN OVER a `next_seq % interval === 0` modulo test; this floor test
345
- * trips on any interval boundary inside `(prevSeq, nextSeq]`.
383
+ * Tuning profile for the 10,000-subrequest Cloudflare paid-tier budget,
384
+ * derived from {@link MAINTENANCE_PROFILE_CF_PAID} (one source of truth).
385
+ * Keeps the single-phase CPU-killable shape but affords Node-tier per-pass
386
+ * throughput (compact ≈ 3+200, gc ≈ 6+200+100 — far under the 10k cap).
387
+ *
388
+ * To honour `BAERLY_MAINTENANCE_PROFILE=cf-paid` on the cron path, pass this
389
+ * constant to `runScheduledMaintenance` inside your
390
+ * {@link WorkerScheduledHandler}; the worked recipe lives in the `scheduled`
391
+ * handler docstring of `baerlyWorker` (`@gusto/baerly-storage/cloudflare`).
392
+ */
393
+ declare const CLOUDFLARE_PAID_TIER: MaintenanceOptions;
394
+ /**
395
+ * Floor-based GC-cadence boundary crossing. Every commit advances the
396
+ * writer-observed tail by one logical slot; `tail_hint` remains a
397
+ * lower bound and may be refreshed later by maintenance. The floor test
398
+ * trips on any interval boundary inside `(prevSeq, nextSeq]`, so it
399
+ * stays correct whether the observed/probed tail advances by one or
400
+ * catches up by a larger step.
346
401
  */
347
402
  declare const crossesGcBoundary: (prevSeq: number, nextSeq: number, interval: number) => boolean;
403
+ /**
404
+ * Derived live-tail byte size — the ratio TRIGGER input that replaces the
405
+ * formerly-stored exact byte count. `(observedTail − log_seq_start) ×
406
+ * mean_entry_bytes`. `observedTail` is a param so write-tick callers can
407
+ * pass the writer-observed tail and scheduled callers can pass a
408
+ * probe-discovered true tail. Cold-start (no mean yet) falls back to
409
+ * {@link MAINTENANCE_COLD_START_ENTRY_BYTES}, never 0 (see that constant).
410
+ * TRIGGER-only — structurally barred from `foldViable` (the exact-bytes CPU-kill
411
+ * ceiling).
412
+ */
413
+ declare const estimateTailBytes: (current: CurrentJson, observedTail: number) => number;
348
414
  /**
349
415
  * The cheap DISPATCH gate the writer calls after a commit — zero
350
- * storage ops; it reads the post-CAS {@link CurrentJson} already in
416
+ * storage ops; it reads the post-commit {@link CurrentJson} already in
351
417
  * scope. Ratio-OR-boundary, WITHOUT the entry floor (the floor is part
352
418
  * of the fold-trigger Gate 1 checked inside {@link runBoundedMaintenance}).
353
- * Returning `false` lets the writer skip the dispatch entirely.
419
+ * Returning `false` lets the writer skip the dispatch entirely. Ratio
420
+ * numerator is the DERIVED {@link estimateTailBytes};
421
+ * `observedTail` threads from the caller (the writer's in-memory observed
422
+ * tail `seq+1` under single-write commit). Both the boundary check and the
423
+ * ratio key off `observedTail`, since the stored `tail_hint` is now only a
424
+ * non-authoritative lower bound (compactor-advanced).
354
425
  */
355
- declare const shouldFireMaintenance: (current: CurrentJson, prevSeq: number, gcInterval: number) => boolean;
426
+ declare const shouldFireMaintenance: (current: CurrentJson, prevSeq: number, gcInterval: number, observedTail: number) => boolean;
356
427
  /** Per-tier caps for {@link runBoundedMaintenance}, threaded by the adapter. */
357
428
  interface BoundedMaintenanceOptions {
358
- /** Tail slice folded per pass. Default {@link WRITE_TICK_FOLD_ENTRIES_PER_PASS}. */
359
- readonly maxFoldEntriesPerPass?: number;
429
+ /** Host budgets, threaded by the adapter. Absent ⇒ {@link MAINTENANCE_PROFILE_CF_FREE} (CF-free-safe default; keeps a bare `Db.create()` maintaining). */
430
+ readonly profile?: MaintenanceProfile;
360
431
  /** Gate-1 minimum live-tail length. Default {@link WRITE_TICK_MIN_ENTRIES_TO_COMPACT}. */
361
432
  readonly minEntriesToCompact?: number;
362
- /** GC marks per pass. Default {@link WRITE_TICK_GC_MAX_MARKS}. */
363
- readonly gcMaxMarks?: number;
364
- /** GC sweeps per pass. Default {@link WRITE_TICK_GC_MAX_SWEEPS}. */
365
- readonly gcMaxSweeps?: number;
366
- /** GC cadence (boundary-crossing). Default {@link WRITE_TICK_GC_INTERVAL}. */
367
- readonly gcInterval?: number;
368
433
  /**
369
434
  * How many phases this tick may run. `"single"` (CF-free-safe
370
435
  * default) runs at most one of fold / GC per tick; `"both"` lets a
@@ -393,6 +458,10 @@ interface BoundedMaintenanceOptions {
393
458
  * composition of {@link compact} and {@link runGc} for one collection,
394
459
  * sized to fit a CPU-killable Cloudflare free-tier isolate by default.
395
460
  *
461
+ * INVARIANT: a {@link MaintenanceProfile} changes only maintenance rate +
462
+ * defer threshold — never data/API/query/wire/correctness; reads stay pure.
463
+ * See `maintenance-profile-equivalence.test.ts`.
464
+ *
396
465
  * Never throws — the write-tick caller must never see a maintenance
397
466
  * failure. Expected signals (CAS contention, an over-ceiling deferral)
398
467
  * are swallowed quietly; unexpected throws bump
@@ -400,7 +469,8 @@ interface BoundedMaintenanceOptions {
400
469
  * swallowed.
401
470
  *
402
471
  * Control flow (fold-priority with a stateless GC-starvation guard):
403
- * 0. `disabled` → return with zero storage ops.
472
+ * 0. `disabled` → skip fold/GC, but still allow the rate-limited
473
+ * tail_hint refresh that bounds read/write forward-probes.
404
474
  * 1. Read `current.json` once.
405
475
  * 2. Hard-GC starvation boundary (`"single"` only) → GC slice, skip fold.
406
476
  * 3. Gate 1 (ratio AND entry floor) trips → fold if viable, else
@@ -410,9 +480,16 @@ interface BoundedMaintenanceOptions {
410
480
  */
411
481
  declare const runBoundedMaintenance: (args: {
412
482
  storage: Storage;
413
- currentJsonKey: string; /** The writer's PRE-CAS `current.next_seq` — the GC cadence baseline. */
414
- prevSeq: number; /** `C` override (from `BAERLY_MAINTENANCE_MAX_FOLD_BYTES`). */
415
- maxFoldBytes?: number; /** From `BAERLY_MAINTENANCE_DISABLE`. */
483
+ currentJsonKey: string; /** The pre-commit observed tail — the GC cadence baseline. */
484
+ prevSeq: number;
485
+ /**
486
+ * Writer's in-memory observed tail (`seq + 1`). Given on the
487
+ * write-tick path so the runner's Gate-1 ratio + GC cadence key off
488
+ * the true tail without an O(gap) re-probe (the stored `tail_hint` is
489
+ * only a lower bound). Absent on a scheduled tick ⇒ the runner probes.
490
+ */
491
+ observedTail?: number; /** `C` override (from `BAERLY_MAINTENANCE_MAX_FOLD_BYTES`). */
492
+ maxFoldBytes?: number; /** From `BAERLY_MAINTENANCE_DISABLE`: disable fold/GC phases, not tail_hint refresh. */
416
493
  disabled?: boolean;
417
494
  }, options?: BoundedMaintenanceOptions) => Promise<void>;
418
495
  /**
@@ -427,7 +504,7 @@ declare const dispatchInlineAwaited: (task: () => Promise<void>) => void | Promi
427
504
  * observability context (NOT `Db.create`). It rides the per-request ALS
428
505
  * context because `dispatch = ctx.waitUntil` is inherently per-request,
429
506
  * and routing it through `Db.create` would widen that surface past its
430
- * locked four fields. The writer reads it at the post-CAS dispatch
507
+ * locked four fields. The writer reads it at the post-commit dispatch
431
508
  * point via `getCurrentContext()?.maintenance`.
432
509
  *
433
510
  * Absent ⇒ inline dispatch + CF-free-safe caps (the defaults inside
@@ -437,13 +514,24 @@ declare const dispatchInlineAwaited: (task: () => Promise<void>) => void | Promi
437
514
  interface MaintenanceDispatch {
438
515
  /** How to run the maintenance task. Default {@link dispatchInlineAwaited}. CF sets `ctx.waitUntil`. */
439
516
  readonly dispatch?: (task: () => Promise<void>) => void | Promise<void>;
440
- /** From `BAERLY_MAINTENANCE_DISABLE`. */
517
+ /** From `BAERLY_MAINTENANCE_DISABLE`: disables fold/GC phases while preserving tail_hint refresh. */
441
518
  readonly disabled?: boolean;
442
519
  /** `C` override, from `BAERLY_MAINTENANCE_MAX_FOLD_BYTES`. */
443
520
  readonly maxFoldBytes?: number;
444
521
  /** Per-tier caps forwarded to {@link runBoundedMaintenance}. */
445
522
  readonly options?: BoundedMaintenanceOptions;
446
523
  }
524
+ /**
525
+ * Parse the two host-agnostic ops-plane env vars into the
526
+ * {@link MaintenanceDispatch} overrides. Shared by every host adapter so the
527
+ * cross-host contract has one source of truth: `maxFoldBytes` (`C`) is the
528
+ * finite `BAERLY_MAINTENANCE_MAX_FOLD_BYTES` or undefined; `disabled` is
529
+ * `BAERLY_MAINTENANCE_DISABLE` truthy (set, non-empty, not `"0"`/`"false"`).
530
+ */
531
+ declare const parseMaintenanceEnv: (readEnv: (key: string) => string | undefined) => {
532
+ maxFoldBytes?: number;
533
+ disabled: boolean;
534
+ };
447
535
  //#endregion
448
- export { RunGcResult as _, MaintenanceDispatch as a, CompactResult as b, crossesGcBoundary as c, runScheduledMaintenance as d, shouldFireMaintenance as f, RunGcOptions as g, rebuildIndex as h, MaintenanceArgs as i, dispatchInlineAwaited as l, RebuildIndexResult as m, CLOUDFLARE_FREE_TIER as n, MaintenanceOptions as o, RebuildIndexOptions as p, InternalMaintenanceOptions as r, MaintenanceResult as s, BoundedMaintenanceOptions as t, runBoundedMaintenance as u, runGc as v, compact as x, CompactOptions as y };
449
- //# sourceMappingURL=maintenance-BRrThz8V.d.ts.map
536
+ export { CompactOptions as C, runGc as S, compact as T, RebuildIndexOptions as _, MaintenanceArgs as a, RunGcOptions as b, MaintenanceProfile as c, dispatchInlineAwaited as d, estimateTailBytes as f, shouldFireMaintenance as g, runScheduledMaintenance as h, InternalMaintenanceOptions as i, MaintenanceResult as l, runBoundedMaintenance as m, CLOUDFLARE_FREE_TIER as n, MaintenanceDispatch as o, parseMaintenanceEnv as p, CLOUDFLARE_PAID_TIER as r, MaintenanceOptions as s, BoundedMaintenanceOptions as t, crossesGcBoundary as u, RebuildIndexResult as v, CompactResult as w, RunGcResult as x, rebuildIndex as y };
537
+ //# sourceMappingURL=maintenance-B_e0T99L.d.ts.map