@kwirthmagnify/kwirth-common-ai 0.5.20 → 0.5.21
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/back.js +18 -15
- package/package.json +1 -1
package/dist/back.js
CHANGED
|
@@ -248,18 +248,19 @@ exports.tools = {
|
|
|
248
248
|
}),
|
|
249
249
|
get_workload_data: (0, ai_1.tool)({
|
|
250
250
|
description: 'Returns all workloads in the cluster: deployments, statefulsets, daemonsets, pods and services. Optionally filter by namespace.',
|
|
251
|
-
inputSchema: zod_1.z.object({ namespace: zod_1.z.string().optional().describe('Namespace to filter results (omit for all namespaces)') }),
|
|
251
|
+
inputSchema: zod_1.z.object({ namespace: zod_1.z.string().optional().describe('Namespace to filter results (omit or pass "*" for all namespaces)') }),
|
|
252
252
|
execute: async ({ namespace }) => {
|
|
253
253
|
var _a;
|
|
254
|
-
|
|
254
|
+
const ns = namespace && namespace !== '*' ? namespace : undefined;
|
|
255
|
+
ctx().trace('get_workload_data', { namespace: ns !== null && ns !== void 0 ? ns : '*' });
|
|
255
256
|
try {
|
|
256
257
|
const c = ctx().clusterInfo;
|
|
257
258
|
const [d, s, ds, p, svc] = await Promise.all([
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
259
|
+
ns ? c.appsApi.listNamespacedDeployment({ namespace: ns }) : c.appsApi.listDeploymentForAllNamespaces(),
|
|
260
|
+
ns ? c.appsApi.listNamespacedStatefulSet({ namespace: ns }) : c.appsApi.listStatefulSetForAllNamespaces(),
|
|
261
|
+
ns ? c.appsApi.listNamespacedDaemonSet({ namespace: ns }) : c.appsApi.listDaemonSetForAllNamespaces(),
|
|
262
|
+
ns ? c.coreApi.listNamespacedPod({ namespace: ns }) : c.coreApi.listPodForAllNamespaces(),
|
|
263
|
+
ns ? c.coreApi.listNamespacedService({ namespace: ns }) : c.coreApi.listServiceForAllNamespaces()
|
|
263
264
|
]);
|
|
264
265
|
return {
|
|
265
266
|
deployments: d.items.map((x) => { var _a, _b, _c, _d, _e, _f, _g; return ({ name: (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name, namespace: (_b = x.metadata) === null || _b === void 0 ? void 0 : _b.namespace, replicas: (_c = x.spec) === null || _c === void 0 ? void 0 : _c.replicas, readyReplicas: (_e = (_d = x.status) === null || _d === void 0 ? void 0 : _d.readyReplicas) !== null && _e !== void 0 ? _e : 0, availableReplicas: (_g = (_f = x.status) === null || _f === void 0 ? void 0 : _f.availableReplicas) !== null && _g !== void 0 ? _g : 0 }); }),
|
|
@@ -316,14 +317,15 @@ exports.tools = {
|
|
|
316
317
|
}),
|
|
317
318
|
list_services: (0, ai_1.tool)({
|
|
318
319
|
description: 'Lists all Services in the cluster with full details (type, clusterIP, ports, selector). Optionally filter by namespace.',
|
|
319
|
-
inputSchema: zod_1.z.object({ namespace: zod_1.z.string().optional().describe('Namespace to filter results (omit for all namespaces)') }),
|
|
320
|
+
inputSchema: zod_1.z.object({ namespace: zod_1.z.string().optional().describe('Namespace to filter results (omit or pass "*" for all namespaces)') }),
|
|
320
321
|
execute: async ({ namespace }) => {
|
|
321
322
|
var _a;
|
|
322
|
-
|
|
323
|
+
const ns = namespace && namespace !== '*' ? namespace : undefined;
|
|
324
|
+
ctx().trace('list_services', { namespace: ns !== null && ns !== void 0 ? ns : '*' });
|
|
323
325
|
try {
|
|
324
326
|
const c = ctx().clusterInfo;
|
|
325
|
-
const resp =
|
|
326
|
-
? await c.coreApi.listNamespacedService({ namespace })
|
|
327
|
+
const resp = ns
|
|
328
|
+
? await c.coreApi.listNamespacedService({ namespace: ns })
|
|
327
329
|
: await c.coreApi.listServiceForAllNamespaces();
|
|
328
330
|
return {
|
|
329
331
|
services: resp.items.map((x) => {
|
|
@@ -347,14 +349,15 @@ exports.tools = {
|
|
|
347
349
|
}),
|
|
348
350
|
list_ingresses: (0, ai_1.tool)({
|
|
349
351
|
description: 'Lists all Ingresses in the cluster (hosts, paths, TLS, backend services). Optionally filter by namespace.',
|
|
350
|
-
inputSchema: zod_1.z.object({ namespace: zod_1.z.string().optional().describe('Namespace to filter results (omit for all namespaces)') }),
|
|
352
|
+
inputSchema: zod_1.z.object({ namespace: zod_1.z.string().optional().describe('Namespace to filter results (omit or pass "*" for all namespaces)') }),
|
|
351
353
|
execute: async ({ namespace }) => {
|
|
352
354
|
var _a;
|
|
353
|
-
|
|
355
|
+
const ns = namespace && namespace !== '*' ? namespace : undefined;
|
|
356
|
+
ctx().trace('list_ingresses', { namespace: ns !== null && ns !== void 0 ? ns : '*' });
|
|
354
357
|
try {
|
|
355
358
|
const c = ctx().clusterInfo;
|
|
356
|
-
const resp =
|
|
357
|
-
? await c.networkApi.listNamespacedIngress({ namespace })
|
|
359
|
+
const resp = ns
|
|
360
|
+
? await c.networkApi.listNamespacedIngress({ namespace: ns })
|
|
358
361
|
: await c.networkApi.listIngressForAllNamespaces();
|
|
359
362
|
return {
|
|
360
363
|
ingresses: resp.items.map((x) => {
|