@kvbox/server 0.6.4 → 0.6.6

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.
@@ -1368,7 +1368,12 @@ var BoxRunSchema = z4.object({
1368
1368
  id: z4.string(),
1369
1369
  state: z4.enum(BOX_RUN_STATES),
1370
1370
  /** With `exited`; 128 + the signal for a command a signal ended. */
1371
- exitCode: z4.number().int().optional()
1371
+ exitCode: z4.number().int().optional(),
1372
+ /**
1373
+ * With `exited` and `timeout`: how long the command itself ran, by the box's own clock (base v0.15.1
1374
+ * and later). The asker learns of the end seconds late, so its own count is too long.
1375
+ */
1376
+ durationMs: z4.number().int().nonnegative().optional()
1372
1377
  });
1373
1378
  var RunRefusalSchema = z4.object({ error: z4.string(), code: z4.string().optional() });
1374
1379
  var EnvVarSchema = z4.object({
@@ -2095,7 +2100,12 @@ async function runStatus(udsPath, id, timeoutMs) {
2095
2100
  const reply = await agentCall(udsPath, { op: "runStatus", id }, timeoutMs);
2096
2101
  const state = reply["state"];
2097
2102
  if (state !== "running" && state !== "exited" && state !== "timeout" && state !== "unknown") throw new KvboxError("kvbox-agent sent a run state this server does not know");
2098
- return { state, ...typeof reply["exitCode"] === "number" ? { exitCode: reply["exitCode"] } : {} };
2103
+ const durationMs = reply["durationMs"];
2104
+ return {
2105
+ state,
2106
+ ...typeof reply["exitCode"] === "number" ? { exitCode: reply["exitCode"] } : {},
2107
+ ...typeof durationMs === "number" && Number.isInteger(durationMs) && durationMs >= 0 ? { durationMs } : {}
2108
+ };
2099
2109
  }
2100
2110
  var isUnknownOp = (err) => /unknown op/.test(err.message ?? "");
2101
2111
  var isGuestBooting = (err) => /did not accept the vsock connection/.test(err.message ?? "");
@@ -6156,7 +6166,7 @@ function versionOf(srcFileUrl, injected) {
6156
6166
  }
6157
6167
 
6158
6168
  // src/version.ts
6159
- var VERSION = versionOf(import.meta.url, true ? "0.6.4" : void 0);
6169
+ var VERSION = versionOf(import.meta.url, true ? "0.6.6" : void 0);
6160
6170
 
6161
6171
  // src/caller.ts
6162
6172
  import { createHash as createHash3, timingSafeEqual } from "node:crypto";