@kwirthmagnify/kwirth-common-ai 0.5.18 → 0.5.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/back.d.ts CHANGED
@@ -76,6 +76,28 @@ export declare const tools: {
76
76
  namespace: string;
77
77
  name: string;
78
78
  }, any>;
79
+ readonly list_services: import("ai").Tool<{
80
+ namespace?: string | undefined;
81
+ }, {
82
+ services: any;
83
+ error?: undefined;
84
+ } | {
85
+ error: any;
86
+ services?: undefined;
87
+ }>;
88
+ readonly list_ingresses: import("ai").Tool<{
89
+ namespace?: string | undefined;
90
+ }, {
91
+ ingresses: any;
92
+ error?: undefined;
93
+ } | {
94
+ error: any;
95
+ ingresses?: undefined;
96
+ }>;
97
+ readonly get_ingress_yaml: import("ai").Tool<{
98
+ namespace: string;
99
+ name: string;
100
+ }, any>;
79
101
  readonly get_cluster_usage: import("ai").Tool<Record<string, never>, {
80
102
  error: string;
81
103
  vcpus?: undefined;
package/dist/back.js CHANGED
@@ -290,6 +290,86 @@ exports.tools = {
290
290
  }
291
291
  }
292
292
  }),
293
+ list_services: (0, ai_1.tool)({
294
+ description: 'Lists all Services in the cluster with full details (type, clusterIP, ports, selector). Optionally filter by namespace.',
295
+ inputSchema: zod_1.z.object({ namespace: zod_1.z.string().optional().describe('Namespace to filter results (omit for all namespaces)') }),
296
+ execute: async ({ namespace }) => {
297
+ var _a;
298
+ ctx().trace('list_services', { namespace: namespace !== null && namespace !== void 0 ? namespace : '*' });
299
+ try {
300
+ const c = ctx().clusterInfo;
301
+ const resp = namespace
302
+ ? await c.coreApi.listNamespacedService({ namespace })
303
+ : await c.coreApi.listServiceForAllNamespaces();
304
+ return {
305
+ services: resp.items.map((x) => {
306
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
307
+ return ({
308
+ name: (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name,
309
+ namespace: (_b = x.metadata) === null || _b === void 0 ? void 0 : _b.namespace,
310
+ type: (_c = x.spec) === null || _c === void 0 ? void 0 : _c.type,
311
+ clusterIP: (_d = x.spec) === null || _d === void 0 ? void 0 : _d.clusterIP,
312
+ externalIPs: (_f = (_e = x.spec) === null || _e === void 0 ? void 0 : _e.externalIPs) !== null && _f !== void 0 ? _f : [],
313
+ ports: (_j = (_h = (_g = x.spec) === null || _g === void 0 ? void 0 : _g.ports) === null || _h === void 0 ? void 0 : _h.map((p) => ({ name: p.name, port: p.port, targetPort: p.targetPort, protocol: p.protocol }))) !== null && _j !== void 0 ? _j : [],
314
+ selector: (_l = (_k = x.spec) === null || _k === void 0 ? void 0 : _k.selector) !== null && _l !== void 0 ? _l : {}
315
+ });
316
+ })
317
+ };
318
+ }
319
+ catch (err) {
320
+ return { error: (_a = err.message) !== null && _a !== void 0 ? _a : String(err) };
321
+ }
322
+ }
323
+ }),
324
+ list_ingresses: (0, ai_1.tool)({
325
+ description: 'Lists all Ingresses in the cluster (hosts, paths, TLS, backend services). Optionally filter by namespace.',
326
+ inputSchema: zod_1.z.object({ namespace: zod_1.z.string().optional().describe('Namespace to filter results (omit for all namespaces)') }),
327
+ execute: async ({ namespace }) => {
328
+ var _a;
329
+ ctx().trace('list_ingresses', { namespace: namespace !== null && namespace !== void 0 ? namespace : '*' });
330
+ try {
331
+ const c = ctx().clusterInfo;
332
+ const resp = namespace
333
+ ? await c.networkApi.listNamespacedIngress({ namespace })
334
+ : await c.networkApi.listIngressForAllNamespaces();
335
+ return {
336
+ ingresses: resp.items.map((x) => {
337
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
338
+ return ({
339
+ name: (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name,
340
+ namespace: (_b = x.metadata) === null || _b === void 0 ? void 0 : _b.namespace,
341
+ ingressClass: (_c = x.spec) === null || _c === void 0 ? void 0 : _c.ingressClassName,
342
+ hosts: (_f = (_e = (_d = x.spec) === null || _d === void 0 ? void 0 : _d.rules) === null || _e === void 0 ? void 0 : _e.map((r) => r.host)) !== null && _f !== void 0 ? _f : [],
343
+ paths: (_j = (_h = (_g = x.spec) === null || _g === void 0 ? void 0 : _g.rules) === null || _h === void 0 ? void 0 : _h.flatMap((r) => { var _a, _b, _c; return (_c = (_b = (_a = r.http) === null || _a === void 0 ? void 0 : _a.paths) === null || _b === void 0 ? void 0 : _b.map((p) => { var _a, _b, _c, _d, _e; return ({ host: r.host, path: p.path, pathType: p.pathType, service: (_b = (_a = p.backend) === null || _a === void 0 ? void 0 : _a.service) === null || _b === void 0 ? void 0 : _b.name, port: (_e = (_d = (_c = p.backend) === null || _c === void 0 ? void 0 : _c.service) === null || _d === void 0 ? void 0 : _d.port) === null || _e === void 0 ? void 0 : _e.number }); })) !== null && _c !== void 0 ? _c : []; })) !== null && _j !== void 0 ? _j : [],
344
+ tls: (_m = (_l = (_k = x.spec) === null || _k === void 0 ? void 0 : _k.tls) === null || _l === void 0 ? void 0 : _l.map((t) => ({ secretName: t.secretName, hosts: t.hosts }))) !== null && _m !== void 0 ? _m : [],
345
+ loadBalancer: (_q = (_p = (_o = x.status) === null || _o === void 0 ? void 0 : _o.loadBalancer) === null || _p === void 0 ? void 0 : _p.ingress) !== null && _q !== void 0 ? _q : []
346
+ });
347
+ })
348
+ };
349
+ }
350
+ catch (err) {
351
+ return { error: (_a = err.message) !== null && _a !== void 0 ? _a : String(err) };
352
+ }
353
+ }
354
+ }),
355
+ get_ingress_yaml: (0, ai_1.tool)({
356
+ description: 'Returns the full Kubernetes Ingress manifest (equivalent to kubectl get ingress -o yaml) for a given namespace and ingress name.',
357
+ inputSchema: zod_1.z.object({
358
+ namespace: zod_1.z.string().describe('Namespace where the ingress lives'),
359
+ name: zod_1.z.string().describe('Name of the ingress')
360
+ }),
361
+ execute: async ({ namespace, name }) => {
362
+ var _a;
363
+ ctx().trace('get_ingress_yaml', { namespace, name });
364
+ try {
365
+ const ing = await ctx().clusterInfo.networkApi.readNamespacedIngress({ name, namespace });
366
+ return ing;
367
+ }
368
+ catch (err) {
369
+ return { error: (_a = err.message) !== null && _a !== void 0 ? _a : String(err) };
370
+ }
371
+ }
372
+ }),
293
373
  // ── CURRENT USAGE ────────────────────────────────────────────────────────
294
374
  get_cluster_usage: (0, ai_1.tool)({
295
375
  description: 'Returns current overall cluster resource usage: CPU%, memory%, network Mbps, total vCPUs and total memory GB.',
@@ -587,6 +667,9 @@ exports.toolInfoList = [
587
667
  { name: 'get_workload_data', description: 'Returns all workloads in the cluster: deployments, statefulsets, daemonsets, pods and services. Optionally filter by namespace.' },
588
668
  { name: 'get_space_data', description: 'Returns all resources in a specific Kubernetes namespace: pods (with restart count), deployments, services, configmap names.' },
589
669
  { name: 'get_service_yaml', description: 'Returns the full Kubernetes Service manifest (equivalent to kubectl get service -o yaml) for a given namespace and service name.' },
670
+ { name: 'list_services', description: 'Lists all Services in the cluster with full details (type, clusterIP, ports, selector). Optionally filter by namespace.' },
671
+ { name: 'list_ingresses', description: 'Lists all Ingresses in the cluster (hosts, paths, TLS, backend services). Optionally filter by namespace.' },
672
+ { name: 'get_ingress_yaml', description: 'Returns the full Kubernetes Ingress manifest (equivalent to kubectl get ingress -o yaml) for a given namespace and ingress name.' },
590
673
  { name: 'get_cluster_usage', description: 'Returns current overall cluster resource usage: CPU%, memory%, network Mbps, total vCPUs and total memory GB.' },
591
674
  { name: 'get_node_usage', description: 'Returns current CPU and memory usage for one node or all nodes from the latest metrics reading.' },
592
675
  { name: 'get_deployment_usage', description: 'Returns current aggregated CPU and memory usage for all pods belonging to a specific deployment.' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwirthmagnify/kwirth-common-ai",
3
- "version": "0.5.18",
3
+ "version": "0.5.19",
4
4
  "description": "Shared AI/LLM types and utilities for Kwirth AI plugins",
5
5
  "scripts": {
6
6
  "build": "del .\\dist\\* /s /q 2>nul & tsc"