@devrouter/cli 0.4.0 → 0.5.1
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/devrouter-lifecycle-worker.js +26 -7
- package/dist/devrouter.js +2505 -1752
- package/package.json +2 -1
- package/upgrade-prompts/0.5.0.md +43 -0
- package/upgrade-prompts/0.5.1.md +27 -0
|
@@ -871,8 +871,18 @@ function inspectManagedStopContainers(composeProject, endpoint) {
|
|
|
871
871
|
requireSameContainerPopulation(listedIds, confirmedIds);
|
|
872
872
|
return snapshots;
|
|
873
873
|
}
|
|
874
|
+
function onlyVanished(stderr, ids2) {
|
|
875
|
+
const lines = (stderr ?? "").split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
876
|
+
return lines.length > 0 && lines.every((line) => {
|
|
877
|
+
const missing = /^(?:error(?: response from daemon)?:\s*)?no such (?:object|container):\s*(\S+)\s*$/i.exec(
|
|
878
|
+
line.trim()
|
|
879
|
+
)?.[1];
|
|
880
|
+
return missing !== void 0 && ids2.includes(missing);
|
|
881
|
+
});
|
|
882
|
+
}
|
|
874
883
|
function inspectWorkspaceContainers(options) {
|
|
875
884
|
let ids2 = options?.ids;
|
|
885
|
+
const listedAll = !ids2;
|
|
876
886
|
if (!ids2) {
|
|
877
887
|
const listed = (0, import_node_child_process3.spawnSync)(
|
|
878
888
|
"docker",
|
|
@@ -899,7 +909,7 @@ function inspectWorkspaceContainers(options) {
|
|
|
899
909
|
["inspect", ...options?.withSize ? ["--size"] : [], "--format", template, ...ids2],
|
|
900
910
|
{ encoding: "utf-8", ...networkDockerOptions() }
|
|
901
911
|
);
|
|
902
|
-
if (inspected.status !== 0) {
|
|
912
|
+
if (inspected.status !== 0 && !(listedAll && onlyVanished(inspected.stderr, ids2))) {
|
|
903
913
|
throw new Error(
|
|
904
914
|
`docker inspect failed: ${(inspected.stderr || inspected.stdout || "unknown error").trim()}`
|
|
905
915
|
);
|
|
@@ -5373,7 +5383,7 @@ function retain(session, previous) {
|
|
|
5373
5383
|
|
|
5374
5384
|
// src/core/reliability-operation-store.ts
|
|
5375
5385
|
function installedCliVersion() {
|
|
5376
|
-
return true ? "0.
|
|
5386
|
+
return true ? "0.5.1" : "0.0.0-dev";
|
|
5377
5387
|
}
|
|
5378
5388
|
function compareCliVersions(left, right) {
|
|
5379
5389
|
const parts = (value) => value.split(".").map((part) => Number.parseInt(part, 10) || 0);
|
|
@@ -5422,6 +5432,13 @@ function validateConsumerProtection(record5) {
|
|
|
5422
5432
|
if (protection.version !== 1 || !isReliabilityCounter(protection.revision) || typeof protection.humanPinned !== "boolean")
|
|
5423
5433
|
throw new Error("Invalid consumer protection.");
|
|
5424
5434
|
}
|
|
5435
|
+
function validateIdleProtection(record5) {
|
|
5436
|
+
const protection = record5.idleProtection;
|
|
5437
|
+
if (protection === void 0) return;
|
|
5438
|
+
exactKeys(protection, ["version", "revision", "pinned"], "Invalid idle protection fields.");
|
|
5439
|
+
if (protection.version !== 1 || !isReliabilityCounter(protection.revision) || typeof protection.pinned !== "boolean")
|
|
5440
|
+
throw new Error("Invalid idle protection.");
|
|
5441
|
+
}
|
|
5425
5442
|
function validateCapacityPhaseSettlement(record5, state, enrollment) {
|
|
5426
5443
|
const settlement = record5.phaseSettlement;
|
|
5427
5444
|
if (settlement === void 0 || settlement === null) return;
|
|
@@ -5519,6 +5536,7 @@ function validate2(record5, identity2) {
|
|
|
5519
5536
|
"result",
|
|
5520
5537
|
"writtenByVersion",
|
|
5521
5538
|
"consumerProtection",
|
|
5539
|
+
"idleProtection",
|
|
5522
5540
|
...record5.version === 2 ? [
|
|
5523
5541
|
"capacity",
|
|
5524
5542
|
"enrollment",
|
|
@@ -5529,6 +5547,7 @@ function validate2(record5, identity2) {
|
|
|
5529
5547
|
] : []
|
|
5530
5548
|
]);
|
|
5531
5549
|
validateConsumerProtection(record5);
|
|
5550
|
+
validateIdleProtection(record5);
|
|
5532
5551
|
if (record5.writtenByVersion !== void 0 && compareCliVersions(record5.writtenByVersion, installedCliVersion()) > 0) {
|
|
5533
5552
|
throw new Error(
|
|
5534
5553
|
`Reliability record was last written by devrouter ${record5.writtenByVersion}, which is newer than the installed ${installedCliVersion()}; upgrade devrouter (devrouter upgrade) before running lifecycle commands.`
|
|
@@ -6007,6 +6026,7 @@ function updateReliabilityOperation(identity2, operation) {
|
|
|
6007
6026
|
const previousVersion = record5.version;
|
|
6008
6027
|
const previousEnrollment = record5.enrollment && { ...record5.enrollment };
|
|
6009
6028
|
const previousProtection = structuredClone(record5.consumerProtection);
|
|
6029
|
+
const previousIdleProtection = structuredClone(record5.idleProtection);
|
|
6010
6030
|
const result = operation(record5);
|
|
6011
6031
|
if (result && typeof result.then === "function") {
|
|
6012
6032
|
throw new Error("Reliability record updates must be synchronous.");
|
|
@@ -6015,6 +6035,8 @@ function updateReliabilityOperation(identity2, operation) {
|
|
|
6015
6035
|
throw new Error("Durable capacity enrollment cannot be downgraded or replaced.");
|
|
6016
6036
|
if (!(0, import_node_util4.isDeepStrictEqual)(record5.consumerProtection, previousProtection))
|
|
6017
6037
|
throw new Error("Consumer protection is only writable through the dedicated pin authority.");
|
|
6038
|
+
if (!(0, import_node_util4.isDeepStrictEqual)(record5.idleProtection, previousIdleProtection))
|
|
6039
|
+
throw new Error("Idle protection is only writable through the idle pin authority.");
|
|
6018
6040
|
record5.writtenByVersion = installedCliVersion();
|
|
6019
6041
|
validate2(record5, identity2);
|
|
6020
6042
|
record5.revision += 1;
|
|
@@ -7371,7 +7393,7 @@ function loadRepoConfig(repoPath, read2 = (file) => import_node_fs19.default.rea
|
|
|
7371
7393
|
const config = parseConfig(parsed ?? {}, configPath);
|
|
7372
7394
|
const requiredVersion = config.devrouter?.version;
|
|
7373
7395
|
if (requiredVersion && !hasWarnedVersionMismatch) {
|
|
7374
|
-
const cliVersion = true ? "0.
|
|
7396
|
+
const cliVersion = true ? "0.5.1" : "0.0.0-dev";
|
|
7375
7397
|
if (cliVersion !== "0.0.0-dev" && compareSemver2(requiredVersion, cliVersion) > 0) {
|
|
7376
7398
|
hasWarnedVersionMismatch = true;
|
|
7377
7399
|
process.stderr.write(
|
|
@@ -10360,9 +10382,7 @@ async function startDevsyWorkspace(options) {
|
|
|
10360
10382
|
`DEVROUTER_WORKSPACE=${options.workspace.token}`
|
|
10361
10383
|
);
|
|
10362
10384
|
}
|
|
10363
|
-
|
|
10364
|
-
args.push("--provider-option", `INACTIVITY_TIMEOUT=${options.inactivityTimeout}`);
|
|
10365
|
-
}
|
|
10385
|
+
args.push("--provider-option", "INACTIVITY_TIMEOUT=");
|
|
10366
10386
|
if (options.recreate) args.push("--recreate");
|
|
10367
10387
|
const env = network ? networkProviderEnvironment(network.binding, process.env) : { ...process.env };
|
|
10368
10388
|
if (agent.binaryPath) env.DEVSY_AGENT_BINARY = agent.binaryPath;
|
|
@@ -11425,7 +11445,6 @@ async function startDevpodWorkspace(options) {
|
|
|
11425
11445
|
recreate: options.recreate,
|
|
11426
11446
|
quiet: options.quiet,
|
|
11427
11447
|
workspace: options.workspace,
|
|
11428
|
-
inactivityTimeout: readWorkspaceRuntimeConfig().devsyInactivityTimeout,
|
|
11429
11448
|
prepareNetwork: options.prepareNetwork
|
|
11430
11449
|
});
|
|
11431
11450
|
resetWorkspaceRuntimeCaches();
|