kubeagent 0.1.17 → 0.1.19

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/cli.js CHANGED
@@ -102,7 +102,7 @@ program
102
102
  console.log(chalk.dim(" │") + bannerInner + " ".repeat(pad) + chalk.dim("│"));
103
103
  console.log(chalk.dim(" └" + "─".repeat(bannerWidth) + "┘"));
104
104
  console.log(chalk.dim(" Ctrl+C to stop\n"));
105
- const noInteractive = opts.noInteractive === true;
105
+ const noInteractive = opts.interactive === false || !process.stdin.isTTY;
106
106
  if (noInteractive) {
107
107
  console.log(chalk.dim(" Non-interactive mode — approvals auto-denied, questions skipped\n"));
108
108
  }
@@ -149,13 +149,21 @@ If it requires a risky action (rollback, delete, scale to zero), propose it but
149
149
  ...(options?.safeActions ?? []),
150
150
  ]);
151
151
  let appliedAction;
152
- // Agentic loop model is selected server-side based on plan tier
152
+ // Compute incident metadata for server-side model selection
153
+ const incidentMeta = {
154
+ kinds: issues.map((i) => i.kind),
155
+ count: issues.length,
156
+ max_restarts: Math.max(0, ...issues.map((i) => i.details.restartCount ?? 0)),
157
+ severities: [...new Set(issues.map((i) => i.severity))],
158
+ };
159
+ // Agentic loop — model is selected server-side based on incident complexity
153
160
  let lastResponse;
154
161
  for (let turn = 0; turn < 10; turn++) {
155
162
  const params = {
156
163
  max_tokens: 16000,
157
164
  tools,
158
165
  messages,
166
+ incident_meta: incidentMeta,
159
167
  };
160
168
  const response = await createMessage(params);
161
169
  lastResponse = response;
@@ -23,11 +23,20 @@ export async function pickContext() {
23
23
  contexts = await listContexts();
24
24
  }
25
25
  catch {
26
+ if (!process.stdin.isTTY)
27
+ throw new Error("No Kubernetes contexts found and stdin is not interactive");
26
28
  return ask("Kubernetes context to use:");
27
29
  }
28
30
  if (contexts.length === 0) {
31
+ if (!process.stdin.isTTY)
32
+ throw new Error("No Kubernetes contexts found");
29
33
  return ask("Kubernetes context to use:");
30
34
  }
35
+ // Non-interactive: auto-select current context without prompting
36
+ if (!process.stdin.isTTY) {
37
+ const current = contexts.find((c) => c.current);
38
+ return current?.name ?? contexts[0].name;
39
+ }
31
40
  console.log(chalk.bold("\nAvailable Kubernetes contexts:\n"));
32
41
  contexts.forEach((ctx, i) => {
33
42
  const marker = ctx.current ? chalk.green(" (current)") : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kubeagent",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "AI-powered Kubernetes management CLI",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",