kubeagent 0.1.33 → 0.1.34

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
@@ -18,7 +18,7 @@ import { sendResolve } from "./notify/index.js";
18
18
  import { diagnose } from "./diagnoser/index.js";
19
19
  import { join } from "node:path";
20
20
  import { loadAuth, loginBrowser, loginDevice, createApiKey, showAccount, clearAuth } from "./auth.js";
21
- import { fetchSlackWebhook } from "./proxy-client.js";
21
+ import { fetchSlackWebhook, pingWatchCycle } from "./proxy-client.js";
22
22
  import { createInterface } from "node:readline";
23
23
  import { scanProjectDirectory, matchProjectsToWorkloads, bestMatches } from "./onboard/project-matcher.js";
24
24
  import { scanCluster } from "./onboard/cluster-scan.js";
@@ -156,6 +156,10 @@ program
156
156
  await handleIssues(issues, config, context, noInteractive);
157
157
  }, async (resolvedKeys) => {
158
158
  await sendResolve(resolvedKeys, config, context);
159
+ }, () => {
160
+ if (auth?.apiKey) {
161
+ void pingWatchCycle(auth);
162
+ }
159
163
  });
160
164
  // Handle graceful shutdown
161
165
  process.on("SIGINT", () => {
@@ -12,6 +12,6 @@ export declare function runChecks(options: KubectlOptions): Promise<Issue[]>;
12
12
  export declare function runChecks(options: KubectlOptions, withSummary: true): Promise<CheckSummary>;
13
13
  export declare function computeResolvedKeys(activeKeys: Set<string>, currentKeys: Set<string>): string[];
14
14
  export declare function updateActiveKeys(activeKeys: Set<string>, resolvedKeys: string[], currentKeys: Set<string>): void;
15
- export declare function startMonitor(options: KubectlOptions, intervalMs: number, onIssues: IssueCallback, onResolved?: ResolveCallback): {
15
+ export declare function startMonitor(options: KubectlOptions, intervalMs: number, onIssues: IssueCallback, onResolved?: ResolveCallback, onFirstCycle?: () => void): {
16
16
  stop: () => void;
17
17
  };
@@ -68,13 +68,15 @@ export function updateActiveKeys(activeKeys, resolvedKeys, currentKeys) {
68
68
  for (const k of currentKeys)
69
69
  activeKeys.add(k);
70
70
  }
71
- export function startMonitor(options, intervalMs, onIssues, onResolved) {
71
+ export function startMonitor(options, intervalMs, onIssues, onResolved, onFirstCycle) {
72
72
  let running = true;
73
73
  let inFlight = false;
74
+ let firstCycleFired = false;
74
75
  // Tracks when each pending pod was first seen: "namespace/name" -> Date
75
76
  const pendingSince = new Map();
76
77
  const activeIssueKeys = new Set();
77
78
  let pendingRecheckTimer = null;
79
+ // fallow-ignore-next-line complexity
78
80
  const tick = async () => {
79
81
  if (!running || inFlight)
80
82
  return;
@@ -126,6 +128,10 @@ export function startMonitor(options, intervalMs, onIssues, onResolved) {
126
128
  console.error("Resolve callback failed:", err.message);
127
129
  }
128
130
  }
131
+ if (!firstCycleFired) {
132
+ firstCycleFired = true;
133
+ onFirstCycle?.();
134
+ }
129
135
  if (reportableIssues.length > 0 && running) {
130
136
  process.stdout.write("\r\x1b[K");
131
137
  await onIssues(reportableIssues);
@@ -24,3 +24,4 @@ export declare function notifyViaServer(auth: AuthState, issues: Array<{
24
24
  namespace?: string;
25
25
  resource?: string;
26
26
  }>, clusterContext?: string): Promise<void>;
27
+ export declare function pingWatchCycle(auth: AuthState): Promise<void>;
@@ -126,3 +126,16 @@ export async function notifyViaServer(auth, issues, clusterContext) {
126
126
  // Silent — don't break the watch loop if server is unreachable
127
127
  }
128
128
  }
129
+ export async function pingWatchCycle(auth) {
130
+ const apiKey = auth.apiKey ?? auth.token;
131
+ try {
132
+ await fetch(`${auth.serverUrl}/watch-cycle`, {
133
+ method: "POST",
134
+ headers: { Authorization: `ApiKey ${apiKey}` },
135
+ signal: AbortSignal.timeout(5_000),
136
+ });
137
+ }
138
+ catch {
139
+ // Silent — non-blocking telemetry
140
+ }
141
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kubeagent",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "AI-powered Kubernetes management CLI",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",