@kikimoradev/kcloud 1.5.3 → 1.5.4
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/main.js +45 -8
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -839,6 +839,7 @@ const errorCodes = Object.keys({
|
|
|
839
839
|
"infrastructure.provider_error": "internal",
|
|
840
840
|
"infrastructure.operation_in_progress": "conflict",
|
|
841
841
|
"infrastructure.host_ops_disabled": "rule_violation",
|
|
842
|
+
"platform.isolated": "rule_violation",
|
|
842
843
|
"backup.not_found": "not_found",
|
|
843
844
|
"backup.in_progress": "conflict",
|
|
844
845
|
"backup.unavailable": "rule_violation",
|
|
@@ -1599,10 +1600,17 @@ z.object({
|
|
|
1599
1600
|
monitor: sessionSlotCountSchema.nullable(),
|
|
1600
1601
|
executor: sessionSlotCountSchema.nullable()
|
|
1601
1602
|
}).meta({ id: "UpdateSessionSlotsBody" });
|
|
1603
|
+
const admissionWaitReasonSchema = z.enum([
|
|
1604
|
+
"slot",
|
|
1605
|
+
"pool",
|
|
1606
|
+
"earlier_run",
|
|
1607
|
+
"renewal"
|
|
1608
|
+
]);
|
|
1602
1609
|
const agentAdmissionStateSchema = z.discriminatedUnion("state", [z.object({
|
|
1603
1610
|
state: z.literal("waiting"),
|
|
1604
1611
|
since: z.iso.datetime(),
|
|
1605
|
-
position: z.int().positive()
|
|
1612
|
+
position: z.int().positive(),
|
|
1613
|
+
reason: admissionWaitReasonSchema
|
|
1606
1614
|
}), z.object({ state: z.literal("holding") })]).meta({ id: "AgentAdmissionState" });
|
|
1607
1615
|
const agentAdmissionSchema = z.object({
|
|
1608
1616
|
monitor: agentAdmissionStateSchema.nullable(),
|
|
@@ -2139,7 +2147,10 @@ const cliTokenReadySchema = z.object({
|
|
|
2139
2147
|
user: meSchema
|
|
2140
2148
|
}).meta({ id: "CliTokenReady" });
|
|
2141
2149
|
z.discriminatedUnion("status", [cliTokenWaitingSchema, cliTokenReadySchema]).meta({ id: "ClaimedCliToken" });
|
|
2142
|
-
z.object({
|
|
2150
|
+
z.object({
|
|
2151
|
+
version: z.string(),
|
|
2152
|
+
isolated: z.boolean()
|
|
2153
|
+
}).meta({ id: "PlatformVersion" });
|
|
2143
2154
|
const auditActionSchema = z.enum([
|
|
2144
2155
|
"platform.bootstrapped",
|
|
2145
2156
|
"organization.created",
|
|
@@ -3062,6 +3073,14 @@ pageSchema(z.object({
|
|
|
3062
3073
|
}).meta({ id: "Backup" })).meta({ id: "BackupPage" });
|
|
3063
3074
|
z.object({ id: idSchema });
|
|
3064
3075
|
z.object({ confirm: z.string().min(1).max(512) }).meta({ id: "RestoreBackupBody" });
|
|
3076
|
+
const syncedBackupCountSchema = z.int().nonnegative();
|
|
3077
|
+
z.object({
|
|
3078
|
+
discovered: syncedBackupCountSchema,
|
|
3079
|
+
vanished: syncedBackupCountSchema,
|
|
3080
|
+
reappeared: syncedBackupCountSchema,
|
|
3081
|
+
finished: syncedBackupCountSchema,
|
|
3082
|
+
abandoned: syncedBackupCountSchema
|
|
3083
|
+
}).meta({ id: "BackupSync" });
|
|
3065
3084
|
const backupPartSchema = z.object({
|
|
3066
3085
|
name: z.enum(backupPartNames),
|
|
3067
3086
|
bytes: byteCountSchema$1,
|
|
@@ -3965,12 +3984,14 @@ const createVersionCommand = (adaptersOf, cliVersion) => defineCommand({
|
|
|
3965
3984
|
kcloud: cliVersion,
|
|
3966
3985
|
instance: platform.version,
|
|
3967
3986
|
origin: session.origin,
|
|
3968
|
-
matched
|
|
3987
|
+
matched,
|
|
3988
|
+
isolated: platform.isolated
|
|
3969
3989
|
});
|
|
3970
3990
|
return exitCodes.ok;
|
|
3971
3991
|
}
|
|
3972
3992
|
context.terminal.line(renderTable([{ header: "WHAT" }, { header: "VERSION" }], [["kcloud", cliVersion], [session.origin, platform.version]]));
|
|
3973
3993
|
if (!matched) context.terminal.error(context.terminal.errorStyles.warning(`warning kcloud ${cliVersion} is talking to an instance on ${platform.version}.`));
|
|
3994
|
+
if (platform.isolated) context.terminal.error(context.terminal.errorStyles.warning(`warning ${session.origin} is isolated: it reaches no outside service and admits no node.`));
|
|
3974
3995
|
return exitCodes.ok;
|
|
3975
3996
|
}
|
|
3976
3997
|
});
|
|
@@ -4056,7 +4077,7 @@ const providerHints = {
|
|
|
4056
4077
|
"provider.token_unauthorized": "DigitalOcean refused the token. Create a new one under API, Tokens in its control panel.",
|
|
4057
4078
|
"concurrency.conflict": "Someone changed the account meanwhile; run the command again."
|
|
4058
4079
|
};
|
|
4059
|
-
const reasonOf$
|
|
4080
|
+
const reasonOf$2 = (error) => {
|
|
4060
4081
|
const reason = error.details.reason;
|
|
4061
4082
|
return typeof reason === "string" && reason !== "" ? `: ${reason}` : "";
|
|
4062
4083
|
};
|
|
@@ -4072,7 +4093,7 @@ const explained = (error) => {
|
|
|
4072
4093
|
const failure = apiErrorOf$1(error);
|
|
4073
4094
|
switch (failure?.code) {
|
|
4074
4095
|
case "provider.token_scopes_missing": return new CliError(failure.message, `The token lacks ${missingScopesOf(failure)}. kcloud providers add --help lists every scope it needs.`, { cause: failure });
|
|
4075
|
-
case "provider.unavailable": return new CliError(failure.message, `DigitalOcean did not answer as expected${reasonOf$
|
|
4096
|
+
case "provider.unavailable": return new CliError(failure.message, `DigitalOcean did not answer as expected${reasonOf$2(failure)}. Try again in a moment.`, { cause: failure });
|
|
4076
4097
|
default: return error;
|
|
4077
4098
|
}
|
|
4078
4099
|
};
|
|
@@ -4862,9 +4883,25 @@ const admissionRowsOf = (agent) => {
|
|
|
4862
4883
|
const { admission } = agent.runtime;
|
|
4863
4884
|
return admission === null ? [] : [["monitor slot", slotOf(admission.monitor)], ["executor slot", slotOf(admission.executor)]];
|
|
4864
4885
|
};
|
|
4865
|
-
const
|
|
4866
|
-
|
|
4867
|
-
|
|
4886
|
+
const waitTexts = {
|
|
4887
|
+
slot: "waits for a slot",
|
|
4888
|
+
pool: "held by the pool of the node",
|
|
4889
|
+
earlier_run: "held until the node restarts its run of an earlier task run",
|
|
4890
|
+
renewal: "held while the node restarts the run"
|
|
4891
|
+
};
|
|
4892
|
+
const reasonOf$1 = ({ reason }) => reason ?? "slot";
|
|
4893
|
+
const waitRowsOf = ({ runtime }) => {
|
|
4894
|
+
const { admission } = runtime;
|
|
4895
|
+
if (admission === null) return [];
|
|
4896
|
+
const waits = ["monitor", "executor"].flatMap((role) => {
|
|
4897
|
+
const state = admission[role];
|
|
4898
|
+
return state?.state === "waiting" ? [`${role} ${waitTexts[reasonOf$1(state)]}`] : [];
|
|
4899
|
+
});
|
|
4900
|
+
return waits.length === 0 ? [] : [["admissions", waits.join("; ")]];
|
|
4901
|
+
};
|
|
4902
|
+
const admissionHoldRowsOf = (agent) => {
|
|
4903
|
+
const hold = agent.runtime.admissionHold;
|
|
4904
|
+
if (hold == null) return waitRowsOf(agent);
|
|
4868
4905
|
if (hold.updating || hold.awaits === "start") return [["admissions", `held while the node updates to ${hold.target ?? "-"}`]];
|
|
4869
4906
|
const all = hold.pools.includes("monitor");
|
|
4870
4907
|
const noun = all ? "session" : "executor session";
|