@kikimoradev/kcloud 1.5.3 → 1.5.5

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.
Files changed (2) hide show
  1. package/dist/main.js +53 -11
  2. 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",
@@ -906,9 +907,10 @@ const workerEnvelope = (event) => ({
906
907
  level: agentEventLevelSchema,
907
908
  event: z.literal(event)
908
909
  });
910
+ const reportedRoleSchema = z.string().optional();
909
911
  const roleEnvelope = (event) => ({
910
912
  ...workerEnvelope(event),
911
- agent: agentRoleSchema.optional()
913
+ agent: reportedRoleSchema
912
914
  });
913
915
  const agentEventSchema = z.discriminatedUnion("event", [
914
916
  z.looseObject({
@@ -1088,7 +1090,7 @@ const agentEventSchema = z.discriminatedUnion("event", [
1088
1090
  z.looseObject({
1089
1091
  ts: instantSchema$2,
1090
1092
  level: agentEventLevelSchema,
1091
- agent: agentRoleSchema.optional(),
1093
+ agent: reportedRoleSchema,
1092
1094
  event: z.string().min(1).max(64)
1093
1095
  });
1094
1096
  agentEventSchema.options.map((option) => option.shape.event.value);
@@ -1323,6 +1325,7 @@ const agentSessionSchema = z.object({
1323
1325
  costUsd: z.number().nullable(),
1324
1326
  durationMs: z.int().nullable(),
1325
1327
  numTurns: z.int().nullable(),
1328
+ resumedAt: z.iso.datetime().nullable(),
1326
1329
  transcriptAvailable: z.boolean()
1327
1330
  }).meta({ id: "AgentSession" });
1328
1331
  pageSchema(agentSessionSchema).meta({ id: "AgentSessionPage" });
@@ -1599,10 +1602,17 @@ z.object({
1599
1602
  monitor: sessionSlotCountSchema.nullable(),
1600
1603
  executor: sessionSlotCountSchema.nullable()
1601
1604
  }).meta({ id: "UpdateSessionSlotsBody" });
1605
+ const admissionWaitReasonSchema = z.enum([
1606
+ "slot",
1607
+ "pool",
1608
+ "earlier_run",
1609
+ "renewal"
1610
+ ]);
1602
1611
  const agentAdmissionStateSchema = z.discriminatedUnion("state", [z.object({
1603
1612
  state: z.literal("waiting"),
1604
1613
  since: z.iso.datetime(),
1605
- position: z.int().positive()
1614
+ position: z.int().positive(),
1615
+ reason: admissionWaitReasonSchema
1606
1616
  }), z.object({ state: z.literal("holding") })]).meta({ id: "AgentAdmissionState" });
1607
1617
  const agentAdmissionSchema = z.object({
1608
1618
  monitor: agentAdmissionStateSchema.nullable(),
@@ -2139,7 +2149,10 @@ const cliTokenReadySchema = z.object({
2139
2149
  user: meSchema
2140
2150
  }).meta({ id: "CliTokenReady" });
2141
2151
  z.discriminatedUnion("status", [cliTokenWaitingSchema, cliTokenReadySchema]).meta({ id: "ClaimedCliToken" });
2142
- z.object({ version: z.string() }).meta({ id: "PlatformVersion" });
2152
+ z.object({
2153
+ version: z.string(),
2154
+ isolated: z.boolean()
2155
+ }).meta({ id: "PlatformVersion" });
2143
2156
  const auditActionSchema = z.enum([
2144
2157
  "platform.bootstrapped",
2145
2158
  "organization.created",
@@ -3062,6 +3075,14 @@ pageSchema(z.object({
3062
3075
  }).meta({ id: "Backup" })).meta({ id: "BackupPage" });
3063
3076
  z.object({ id: idSchema });
3064
3077
  z.object({ confirm: z.string().min(1).max(512) }).meta({ id: "RestoreBackupBody" });
3078
+ const syncedBackupCountSchema = z.int().nonnegative();
3079
+ z.object({
3080
+ discovered: syncedBackupCountSchema,
3081
+ vanished: syncedBackupCountSchema,
3082
+ reappeared: syncedBackupCountSchema,
3083
+ finished: syncedBackupCountSchema,
3084
+ abandoned: syncedBackupCountSchema
3085
+ }).meta({ id: "BackupSync" });
3065
3086
  const backupPartSchema = z.object({
3066
3087
  name: z.enum(backupPartNames),
3067
3088
  bytes: byteCountSchema$1,
@@ -3965,12 +3986,14 @@ const createVersionCommand = (adaptersOf, cliVersion) => defineCommand({
3965
3986
  kcloud: cliVersion,
3966
3987
  instance: platform.version,
3967
3988
  origin: session.origin,
3968
- matched
3989
+ matched,
3990
+ isolated: platform.isolated
3969
3991
  });
3970
3992
  return exitCodes.ok;
3971
3993
  }
3972
3994
  context.terminal.line(renderTable([{ header: "WHAT" }, { header: "VERSION" }], [["kcloud", cliVersion], [session.origin, platform.version]]));
3973
3995
  if (!matched) context.terminal.error(context.terminal.errorStyles.warning(`warning kcloud ${cliVersion} is talking to an instance on ${platform.version}.`));
3996
+ 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
3997
  return exitCodes.ok;
3975
3998
  }
3976
3999
  });
@@ -4056,7 +4079,7 @@ const providerHints = {
4056
4079
  "provider.token_unauthorized": "DigitalOcean refused the token. Create a new one under API, Tokens in its control panel.",
4057
4080
  "concurrency.conflict": "Someone changed the account meanwhile; run the command again."
4058
4081
  };
4059
- const reasonOf$1 = (error) => {
4082
+ const reasonOf$2 = (error) => {
4060
4083
  const reason = error.details.reason;
4061
4084
  return typeof reason === "string" && reason !== "" ? `: ${reason}` : "";
4062
4085
  };
@@ -4072,7 +4095,7 @@ const explained = (error) => {
4072
4095
  const failure = apiErrorOf$1(error);
4073
4096
  switch (failure?.code) {
4074
4097
  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$1(failure)}. Try again in a moment.`, { cause: failure });
4098
+ 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
4099
  default: return error;
4077
4100
  }
4078
4101
  };
@@ -4521,7 +4544,8 @@ const poolLimitText = (limit) => {
4521
4544
  };
4522
4545
  const sessionFailures = {
4523
4546
  poolMemoryLimit: "killed by the pool memory limit",
4524
- launcherRefused: "refused by the session starter"
4547
+ launcherRefused: "refused by the session starter",
4548
+ resumeFailed: "could not be resumed"
4525
4549
  };
4526
4550
  const sessionFailureText = (reason) => reason === null ? "-" : sessionFailures[reason] ?? reason;
4527
4551
  const unsupportedReasons = {
@@ -4862,9 +4886,27 @@ const admissionRowsOf = (agent) => {
4862
4886
  const { admission } = agent.runtime;
4863
4887
  return admission === null ? [] : [["monitor slot", slotOf(admission.monitor)], ["executor slot", slotOf(admission.executor)]];
4864
4888
  };
4865
- const admissionHoldRowsOf = ({ runtime }) => {
4866
- const hold = runtime.admissionHold;
4867
- if (hold == null) return [];
4889
+ const waitTexts = {
4890
+ slot: "waits for a slot",
4891
+ pool: "held by the pool of the node",
4892
+ earlier_run: "held until the node restarts its run of an earlier task run",
4893
+ renewal: "held while the node restarts the run"
4894
+ };
4895
+ const reasonOf$1 = ({ reason }) => reason ?? "slot";
4896
+ const isKnownReason = (reason) => Object.hasOwn(waitTexts, reason);
4897
+ const waitTextOf = (reason) => isKnownReason(reason) ? waitTexts[reason] : `held by the node (${reason})`;
4898
+ const waitRowsOf = ({ runtime }) => {
4899
+ const { admission } = runtime;
4900
+ if (admission === null) return [];
4901
+ const waits = ["monitor", "executor"].flatMap((role) => {
4902
+ const state = admission[role];
4903
+ return state?.state === "waiting" ? [`${role} ${waitTextOf(reasonOf$1(state))}`] : [];
4904
+ });
4905
+ return waits.length === 0 ? [] : [["admissions", waits.join("; ")]];
4906
+ };
4907
+ const admissionHoldRowsOf = (agent) => {
4908
+ const hold = agent.runtime.admissionHold;
4909
+ if (hold == null) return waitRowsOf(agent);
4868
4910
  if (hold.updating || hold.awaits === "start") return [["admissions", `held while the node updates to ${hold.target ?? "-"}`]];
4869
4911
  const all = hold.pools.includes("monitor");
4870
4912
  const noun = all ? "session" : "executor session";
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
- "version": "1.5.3",
18
+ "version": "1.5.5",
19
19
  "dependencies": {
20
20
  "@clack/prompts": "1.8.1",
21
21
  "@modelcontextprotocol/server": "2.1.0",