@kvbox/server 0.5.51 → 0.6.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.
@@ -1209,6 +1209,11 @@ var MachineSchema = z4.object({
1209
1209
  host: z4.string().optional(),
1210
1210
  /** The country code of that host (`RO`, `US`), when its admin gave one. Only the control plane fills it in. */
1211
1211
  country: z4.string().optional(),
1212
+ /**
1213
+ * The kind of managed service the box runs (`postgres`, `redis`, `storage`). Only an admin's
1214
+ * `GET /machines?all=1` lists such boxes, so a host's boxes add up; every other listing hides them.
1215
+ */
1216
+ managed: z4.string().optional(),
1212
1217
  /** Seconds without network traffic before the host hibernates the box (#47). Absent: never. */
1213
1218
  autoHibernateSec: z4.number().int().positive().optional(),
1214
1219
  /** A script inside the box that says it is idle (#102, exit 0): auto-hibernate asks it instead of watching the traffic. */
@@ -4755,7 +4760,8 @@ async function assertRoom(dir, bytes, what, p) {
4755
4760
  const headroom = (await loadConfig(p)).volumeHeadroomGib * 1024 ** 3;
4756
4761
  if (free - bytes < headroom) {
4757
4762
  const gib = (n) => (n / 1024 ** 3).toFixed(1);
4758
- throw new KvboxError(`${what} needs ${gib(bytes)} GiB and this host has ${gib(free)} GiB free (keeping ${gib(headroom)} GiB spare); try again when it has room`);
4763
+ const needs = bytes === 0 ? "cannot be made:" : `needs ${gib(bytes)} GiB and`;
4764
+ throw new KvboxError(`${what} ${needs} this host has ${gib(free)} GiB free (keeping ${gib(headroom)} GiB spare); try again when it has room`);
4759
4765
  }
4760
4766
  }
4761
4767
  function checkId(id) {
@@ -4804,7 +4810,7 @@ async function stageBackup(ref, req, p = paths()) {
4804
4810
  const { meta, envText } = await withBoxLock(ref, async () => {
4805
4811
  const meta2 = await readBox2(ref, p);
4806
4812
  const m = p.machine(meta2.owner, meta2.name);
4807
- await assertRoom(s.dir, (await stat4(m.overlay)).blocks * 512, `a backup of box ${shown(ref)}`, p);
4813
+ await assertRoom(s.dir, 0, `a backup of box ${shown(ref)}`, p);
4808
4814
  const copy = () => run(["cp", "--sparse=always", "--reflink=auto", m.overlay, s.disk], { timeoutMs: 6e5 });
4809
4815
  if (vmAlive(meta2) && !meta2.paused) {
4810
4816
  const fc = new FirecrackerClient(m.sock);
@@ -5765,7 +5771,7 @@ function versionOf(srcFileUrl, injected) {
5765
5771
  }
5766
5772
 
5767
5773
  // src/version.ts
5768
- var VERSION = versionOf(import.meta.url, true ? "0.5.51" : void 0);
5774
+ var VERSION = versionOf(import.meta.url, true ? "0.6.0" : void 0);
5769
5775
 
5770
5776
  // src/caller.ts
5771
5777
  import { createHash as createHash3, timingSafeEqual } from "node:crypto";