kubeagent 0.1.16 → 0.1.18

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
@@ -16,7 +16,6 @@ import { startMonitor } from "./monitor/index.js";
16
16
  import { handleIssues } from "./orchestrator.js";
17
17
  import { sendResolve } from "./notify/index.js";
18
18
  import { diagnose } from "./diagnoser/index.js";
19
- import { buildSystemPrompt } from "./kb/loader.js";
20
19
  import { join } from "node:path";
21
20
  import { loadAuth, loginBrowser, loginDevice, createApiKey, showAccount, clearAuth } from "./auth.js";
22
21
  import { fetchSlackWebhook } from "./proxy-client.js";
@@ -440,9 +439,6 @@ program
440
439
  program.help();
441
440
  return;
442
441
  }
443
- const context = opts.context;
444
- const kbDir = join(configDir(), "clusters", context ?? "default");
445
- const systemPrompt = buildSystemPrompt(kbDir);
446
442
  const auth = loadAuth();
447
443
  if (!auth?.apiKey) {
448
444
  console.error(chalk.red("Not logged in. Run 'kubeagent login' to get started."));
@@ -450,10 +446,7 @@ program
450
446
  }
451
447
  const { proxyRequest } = await import("./proxy-client.js");
452
448
  const result = await proxyRequest(auth, {
453
- model: "claude-sonnet-4-6",
454
449
  max_tokens: 16000,
455
- system: systemPrompt,
456
- thinking: { type: "adaptive" },
457
450
  messages: [{ role: "user", content: prompt.join(" ") }],
458
451
  });
459
452
  const response = result;
@@ -1,26 +1,10 @@
1
1
  import chalk from "chalk";
2
2
  import readline from "node:readline";
3
- import { buildSystemPrompt } from "../kb/loader.js";
4
3
  import { loadAuth } from "../auth.js";
5
4
  import { proxyRequest } from "../proxy-client.js";
6
- import { dbg } from "../debug.js";
7
5
  import { getLogs, describeResource, restartPod, rolloutRestart, scaleDeployment, getEvents, setResources, kubectlGetLogsSchema, kubectlDescribeSchema, restartPodSchema, rolloutRestartSchema, scaleDeploymentSchema, getEventsSchema, setResourcesSchema, } from "./tools.js";
8
6
  import { zodToJsonSchema } from "zod-to-json-schema";
9
7
  const MAX_TOOL_OUTPUT_CHARS = 8000;
10
- const HAIKU = "claude-haiku-4-5-20251001";
11
- const SONNET = "claude-sonnet-4-6";
12
- function selectModel(issues) {
13
- if (issues.some((i) => i.kind === "node_not_ready" || i.kind === "node_pressure"))
14
- return SONNET;
15
- if (issues.length >= 3)
16
- return SONNET;
17
- const maxRestarts = Math.max(0, ...issues.map((i) => i.details.restartCount ?? 0));
18
- if (maxRestarts > 20)
19
- return SONNET;
20
- if (issues.filter((i) => i.kind === "pod_oom").length >= 2)
21
- return SONNET;
22
- return HAIKU;
23
- }
24
8
  async function createMessage(params) {
25
9
  const auth = loadAuth();
26
10
  if (!auth?.apiKey) {
@@ -138,7 +122,6 @@ function makeToolExecutors(noInteractive, onQuestion) {
138
122
  };
139
123
  }
140
124
  export async function diagnose(issues, kbDir, clusterContext, options) {
141
- const systemPrompt = buildSystemPrompt(kbDir);
142
125
  const tools = makeToolDefs();
143
126
  const issuesSummary = issues
144
127
  .map((i) => `[${i.severity}] ${i.kind}: ${i.message}`)
@@ -166,22 +149,22 @@ If it requires a risky action (rollback, delete, scale to zero), propose it but
166
149
  ...(options?.safeActions ?? []),
167
150
  ]);
168
151
  let appliedAction;
169
- const model = selectModel(issues);
170
- dbg("model", `selected ${model} for ${issues.length} issue(s): ${issues.map(i => i.kind).join(", ")}`);
171
- // Agentic loop
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
172
160
  let lastResponse;
173
161
  for (let turn = 0; turn < 10; turn++) {
174
162
  const params = {
175
- model,
176
163
  max_tokens: 16000,
177
- system: systemPrompt,
178
164
  tools,
179
165
  messages,
166
+ incident_meta: incidentMeta,
180
167
  };
181
- // adaptive thinking only supported on Sonnet+, not Haiku
182
- if (model === SONNET) {
183
- params.thinking = { type: "adaptive" };
184
- }
185
168
  const response = await createMessage(params);
186
169
  lastResponse = response;
187
170
  if (response.stop_reason === "end_turn")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kubeagent",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "AI-powered Kubernetes management CLI",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",