@kvbox/cli 0.5.44 → 0.5.45

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.
package/dist/kvbox.js CHANGED
@@ -164,7 +164,7 @@ function versionOf(srcFileUrl, injected) {
164
164
  }
165
165
 
166
166
  // src/version.ts
167
- var VERSION = versionOf(import.meta.url, true ? "0.5.44" : void 0);
167
+ var VERSION = versionOf(import.meta.url, true ? "0.5.45" : void 0);
168
168
 
169
169
  // src/commands/vm/index.ts
170
170
  import { Command as Command37 } from "commander";
@@ -191,6 +191,14 @@ function paths(home = kvboxHome()) {
191
191
  serverSock: join(home, "server.sock"),
192
192
  serverPid: join(home, "server.pid"),
193
193
  serverLog: join(home, "server.log"),
194
+ /**
195
+ * The host's self-update (`POST /update`, the control plane's admin): `update.json` is its state
196
+ * (install-server.sh --update writes it), `update/` holds the downloaded script and its log.
197
+ */
198
+ updateState: join(home, "update.json"),
199
+ updateDir: join(home, "update"),
200
+ updateScript: join(home, "update", "install-server.sh"),
201
+ updateLog: join(home, "update", "update.log"),
194
202
  /** The CLI's login to the control plane (`kvbox login`): url, bearer token, user. Mode 600. */
195
203
  cli: join(home, "cli.json"),
196
204
  /** The CLI's last look at npm for a newer @kvbox/cli: `{checkedAt, latest}`, at most once a day (cli update.ts). */
@@ -772,7 +780,9 @@ var CapacitySchema = z2.object({
772
780
  * The images a new box can be made from here (#87), with the version `new` uses; the base is `base`.
773
781
  * Absent on a host from before images: it has only the base.
774
782
  */
775
- images: z2.array(z2.object({ name: z2.string(), version: z2.string() })).optional()
783
+ images: z2.array(z2.object({ name: z2.string(), version: z2.string() })).optional(),
784
+ /** kvbox-server's version, so the control plane's host list shows it without a call per host. Older servers omit it. */
785
+ version: z2.string().optional()
776
786
  });
777
787
  var ImageSchema = z2.object({ name: z2.string(), version: z2.string().nullable() });
778
788
  var RecoveryReportSchema = z2.object({
@@ -781,6 +791,16 @@ var RecoveryReportSchema = z2.object({
781
791
  leftStopped: z2.array(z2.string()),
782
792
  failed: z2.array(z2.object({ box: z2.string(), error: z2.string() }))
783
793
  });
794
+ var HostUpdateSchema = z2.object({
795
+ state: z2.enum(["running", "done", "failed"]),
796
+ startedAt: z2.string(),
797
+ finishedAt: z2.string().nullable(),
798
+ /** kvbox-server's version when the update started, and when it ended (null while running or when it failed before). */
799
+ from: z2.string(),
800
+ to: z2.string().nullable(),
801
+ error: z2.string().nullable(),
802
+ needsManual: z2.array(z2.string())
803
+ });
784
804
  var HealthSchema = z2.object({
785
805
  ok: z2.literal(true),
786
806
  version: z2.string(),
@@ -809,7 +829,9 @@ var HealthSchema = z2.object({
809
829
  lastRestartAt: z2.string().nullable().optional()
810
830
  }).nullable().optional(),
811
831
  /** Boxes brought back at the server's last start; null when there were none or it is still at it. Older servers omit it. */
812
- recovery: RecoveryReportSchema.nullable().optional()
832
+ recovery: RecoveryReportSchema.nullable().optional(),
833
+ /** The last self-update; null when none ran. Older servers omit it. */
834
+ update: HostUpdateSchema.nullable().optional()
813
835
  });
814
836
  var MachineUsageSchema = z2.object({
815
837
  name: z2.string(),
@@ -1095,7 +1117,14 @@ var CloudHostSchema = z2.object({
1095
1117
  lastSeenAt: z2.string().nullable(),
1096
1118
  capacity: CapacitySchema.nullable(),
1097
1119
  /** ISO 3166-1 alpha-2 code (`RO`), null when nobody said where the host is. */
1098
- country: z2.string().nullable()
1120
+ country: z2.string().nullable(),
1121
+ /** kvbox-server's version as of the poller's last look (`capacity.version`); null before one, or for a server older than 0.5.45. */
1122
+ version: z2.string().nullable()
1123
+ });
1124
+ var HostInfoSchema = z2.object({
1125
+ host: CloudHostSchema,
1126
+ health: HealthSchema.nullable(),
1127
+ error: z2.string().nullable()
1099
1128
  });
1100
1129
  var HostPatchRequest = z2.object({ country: z2.string().nullable() });
1101
1130
  var CountrySchema = z2.object({ code: z2.string(), name: z2.string() });