@kikimoradev/kcloud 1.5.2 → 1.5.3

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 +35 -5
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1130,7 +1130,9 @@ const agentProvisionSchema = z.object({
1130
1130
  "ok",
1131
1131
  "fetch_failed",
1132
1132
  "clone_failed"
1133
- ])
1133
+ ]),
1134
+ brokenCloneMovedTo: z.string().optional(),
1135
+ locksKeptForSandbox: z.array(z.string()).optional()
1134
1136
  })),
1135
1137
  docker: z.enum([
1136
1138
  "ready",
@@ -1151,6 +1153,10 @@ const agentProgressSchema = z.object({
1151
1153
  layersTotal: z.int().nonnegative().nullable(),
1152
1154
  updatedAt: z.iso.datetime()
1153
1155
  }).meta({ id: "AgentProgress" });
1156
+ const agentClaudeCodeSchema = z.object({
1157
+ version: z.string().nullable(),
1158
+ source: z.enum(["release", "host"])
1159
+ }).meta({ id: "AgentClaudeCode" });
1154
1160
  const storageStates = [
1155
1161
  "ok",
1156
1162
  "warning",
@@ -1816,6 +1822,8 @@ const nodeAgentSchema = z.object({
1816
1822
  projectId: idSchema,
1817
1823
  projectName: z.string(),
1818
1824
  state: agentStateSchema,
1825
+ failureReason: z.string().nullable(),
1826
+ retryAt: z.iso.datetime().nullable(),
1819
1827
  poolLimit: poolLimitSchema.nullable()
1820
1828
  }).meta({ id: "NodeAgent" });
1821
1829
  const nodeRuntimeSchema = z.object({
@@ -2695,7 +2703,8 @@ const agentRuntimeSchema = z.object({
2695
2703
  stopDeadlineAt: z.iso.datetime().nullable(),
2696
2704
  admission: agentAdmissionSchema.nullable(),
2697
2705
  admissionHold: admissionHoldSchema.nullable(),
2698
- poolLimit: poolLimitSchema.nullable()
2706
+ poolLimit: poolLimitSchema.nullable(),
2707
+ claudeCode: agentClaudeCodeSchema.nullable()
2699
2708
  }).meta({ id: "AgentRuntime" });
2700
2709
  const agentListItemSchema = z.object({
2701
2710
  id: idSchema,
@@ -4713,6 +4722,11 @@ const agentsOf = async (scope, project) => {
4713
4722
  }
4714
4723
  return listed;
4715
4724
  };
4725
+ const changeTakingActions = ["start", "update"];
4726
+ const changeTakerOf = ({ availableActions }) => {
4727
+ const takers = changeTakingActions.filter((action) => availableActions.includes(action)).map((action) => `kcloud agents ${action}`);
4728
+ return takers.length === 0 ? "a restart" : takers.join(" or ");
4729
+ };
4716
4730
  const changedAgent = async (api, agentId, document) => {
4717
4731
  const current = dataOf("describe the agent", await api.GET("/agents/{id}", { params: { path: { id: agentId } } }), agentHints);
4718
4732
  const change = typeof document === "object" && document !== null && "version" in document ? document : {
@@ -4804,7 +4818,7 @@ const configCommands = (adaptersOf) => [
4804
4818
  const file = invocation.values.file;
4805
4819
  if (file === void 0) throw new UsageError("agents set needs --file <path>.", "The file holds the sections to change; kcloud agents show <agent> --json shows the current ones.");
4806
4820
  const agent = await changedAgent(run.api, agentId, agentChangeWithoutLimits(run, await documentOf(run, file)));
4807
- return printed(run, agent, (changed) => changed.restartRequired ? `Changed ${changed.name}; it needs kcloud agents update to take the change.` : `Changed ${changed.name}.`);
4821
+ return printed(run, agent, (changed) => changed.restartRequired ? `Changed ${changed.name}; it needs ${changeTakerOf(changed)} to take the change.` : `Changed ${changed.name}.`);
4808
4822
  }
4809
4823
  }),
4810
4824
  defineCommand({
@@ -4858,6 +4872,15 @@ const admissionHoldRowsOf = ({ runtime }) => {
4858
4872
  return [["admissions", `${all ? "held" : "executor held"} for the node update to ${hold.target ?? "-"}, waiting for ${waits}`]];
4859
4873
  };
4860
4874
  const poolLimitRowsOf = ({ runtime }) => runtime.poolLimit === null ? [] : [["pool limit", poolLimitText(runtime.poolLimit)]];
4875
+ const claudeCodeOf = ({ runtime, release }) => {
4876
+ const running = runtime.claudeCode ?? null;
4877
+ if (running?.source === "host") return "host";
4878
+ return running?.version ?? release?.claudeCodeVersion ?? "unknown";
4879
+ };
4880
+ const failureRowsOf = ({ failureReason, retryAt }) => {
4881
+ if (failureReason === null) return [];
4882
+ return [["failure", retryAt === null ? failureReason : `${failureReason}, retry at ${retryAt}`]];
4883
+ };
4861
4884
  const detailsOf = (agent) => [
4862
4885
  renderTable([{ header: "FIELD" }, { header: "VALUE" }], [
4863
4886
  ["name", agent.name],
@@ -4866,6 +4889,7 @@ const detailsOf = (agent) => [
4866
4889
  ["wanted", agent.desiredState],
4867
4890
  ["observed", agent.observedState],
4868
4891
  ["release", agent.kikimoraVersion],
4892
+ ["claude code", claudeCodeOf(agent)],
4869
4893
  ["node", agent.node === null ? "none" : `${agent.node.name} (${agent.node.state})`],
4870
4894
  ["requires", agent.requiredCapabilities.length === 0 ? "nothing" : agent.requiredCapabilities.join(", ")],
4871
4895
  ["timezone", agent.timezone],
@@ -4874,6 +4898,7 @@ const detailsOf = (agent) => [
4874
4898
  ["browser", agent.machine.browser ? "yes" : "no"],
4875
4899
  ["container", agent.runtime.containerId ?? "none"],
4876
4900
  ["health", agent.runtime.health],
4901
+ ...failureRowsOf(agent),
4877
4902
  ...admissionRowsOf(agent),
4878
4903
  ...admissionHoldRowsOf(agent),
4879
4904
  ...poolLimitRowsOf(agent),
@@ -6695,7 +6720,7 @@ const agentTools = [
6695
6720
  defineTool({
6696
6721
  name: "agent_update",
6697
6722
  title: "Change an agent",
6698
- description: "Change sections of an agent. Without version the change applies to the version read just before it. When restartRequired comes back true, agent_action update applies the change.",
6723
+ description: "Change sections of an agent. Without version the change applies to the version read just before it. When restartRequired comes back true, agent_action start or update applies the change, whichever availableActions offers.",
6699
6724
  operations: ["updateAgent"],
6700
6725
  safety: "write",
6701
6726
  input: z.object({
@@ -6733,7 +6758,7 @@ const agentTools = [
6733
6758
  defineTool({
6734
6759
  name: "agent_action",
6735
6760
  title: "Start, pause, resume, restart or update an agent",
6736
- description: "start lets the agent work, pause holds it between sessions, resume lets a paused agent work again, restart restarts its container, update replaces the container to apply pending changes. The agent returns with the actions it takes next.",
6761
+ description: "start lets the agent work and applies pending changes, pause holds it between sessions, resume lets a paused agent work again, restart restarts its container, update replaces the container to apply pending changes. The agent returns with the actions it takes next.",
6737
6762
  operations: ["runAgentAction"],
6738
6763
  safety: "write",
6739
6764
  input: z.object({
@@ -9957,6 +9982,10 @@ const lastUpdateOf = ({ update }) => {
9957
9982
  const outcome = `${last.outcome} ${last.version ?? "-"} at ${last.at}`;
9958
9983
  return last.reason === null ? outcome : `${outcome}: ${last.reason}`;
9959
9984
  };
9985
+ const agentFailuresOf = ({ agents }) => agents.flatMap(({ slug, failureReason, retryAt }) => {
9986
+ if (failureReason === null) return [];
9987
+ return [`${slug} failure: ${retryAt === null ? failureReason : `${failureReason}, retry at ${retryAt}`}`];
9988
+ });
9960
9989
  const nodeDetailsText = (node) => [
9961
9990
  renderTable([{ header: "FIELD" }, { header: "VALUE" }], [
9962
9991
  ["name", node.name],
@@ -9995,6 +10024,7 @@ const nodeDetailsText = (node) => [
9995
10024
  poolLimitText(agent.poolLimit),
9996
10025
  agent.id
9997
10026
  ])),
10027
+ ...agentFailuresOf(node),
9998
10028
  "",
9999
10029
  ...node.runtime === null ? ["The node has reported no runtime yet."] : [
10000
10030
  renderTable([{ header: "RUNTIME" }, { header: "VALUE" }], runtimeRowsOf(node.runtime, node.engine)),
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
- "version": "1.5.2",
18
+ "version": "1.5.3",
19
19
  "dependencies": {
20
20
  "@clack/prompts": "1.8.1",
21
21
  "@modelcontextprotocol/server": "2.1.0",