@kwirthmagnify/kwirth-common-ai 0.5.50 → 0.5.52
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 +109 -0
- package/dist/back.js +160 -7
- package/dist/front.js +3 -3
- package/package.json +1 -1
package/dist/back.d.ts
CHANGED
|
@@ -103,6 +103,10 @@ export declare const tools: {
|
|
|
103
103
|
namespace: string;
|
|
104
104
|
}, {
|
|
105
105
|
namespace: string;
|
|
106
|
+
status: any;
|
|
107
|
+
labels: any;
|
|
108
|
+
resourceQuotas: any;
|
|
109
|
+
limitRanges: any;
|
|
106
110
|
pods: any;
|
|
107
111
|
deployments: any;
|
|
108
112
|
services: any;
|
|
@@ -111,11 +115,111 @@ export declare const tools: {
|
|
|
111
115
|
} | {
|
|
112
116
|
error: any;
|
|
113
117
|
namespace?: undefined;
|
|
118
|
+
status?: undefined;
|
|
119
|
+
labels?: undefined;
|
|
120
|
+
resourceQuotas?: undefined;
|
|
121
|
+
limitRanges?: undefined;
|
|
114
122
|
pods?: undefined;
|
|
115
123
|
deployments?: undefined;
|
|
116
124
|
services?: undefined;
|
|
117
125
|
configMaps?: undefined;
|
|
118
126
|
}>;
|
|
127
|
+
readonly get_namespace_yaml: import("ai").Tool<{
|
|
128
|
+
name: string;
|
|
129
|
+
}, any>;
|
|
130
|
+
readonly describe_service: import("ai").Tool<{
|
|
131
|
+
namespace: string;
|
|
132
|
+
name: string;
|
|
133
|
+
}, {
|
|
134
|
+
name: string;
|
|
135
|
+
namespace: string;
|
|
136
|
+
type: any;
|
|
137
|
+
clusterIP: any;
|
|
138
|
+
externalIPs: any;
|
|
139
|
+
loadBalancer: any;
|
|
140
|
+
sessionAffinity: any;
|
|
141
|
+
selector: any;
|
|
142
|
+
ports: any;
|
|
143
|
+
endpoints: any;
|
|
144
|
+
endpointCount: any;
|
|
145
|
+
error?: undefined;
|
|
146
|
+
} | {
|
|
147
|
+
error: any;
|
|
148
|
+
name?: undefined;
|
|
149
|
+
namespace?: undefined;
|
|
150
|
+
type?: undefined;
|
|
151
|
+
clusterIP?: undefined;
|
|
152
|
+
externalIPs?: undefined;
|
|
153
|
+
loadBalancer?: undefined;
|
|
154
|
+
sessionAffinity?: undefined;
|
|
155
|
+
selector?: undefined;
|
|
156
|
+
ports?: undefined;
|
|
157
|
+
endpoints?: undefined;
|
|
158
|
+
endpointCount?: undefined;
|
|
159
|
+
}>;
|
|
160
|
+
readonly describe_ingress: import("ai").Tool<{
|
|
161
|
+
namespace: string;
|
|
162
|
+
name: string;
|
|
163
|
+
}, {
|
|
164
|
+
name: string;
|
|
165
|
+
namespace: string;
|
|
166
|
+
ingressClass: any;
|
|
167
|
+
defaultBackend: string | undefined;
|
|
168
|
+
rules: any;
|
|
169
|
+
tls: any;
|
|
170
|
+
loadBalancer: any;
|
|
171
|
+
error?: undefined;
|
|
172
|
+
} | {
|
|
173
|
+
error: any;
|
|
174
|
+
name?: undefined;
|
|
175
|
+
namespace?: undefined;
|
|
176
|
+
ingressClass?: undefined;
|
|
177
|
+
defaultBackend?: undefined;
|
|
178
|
+
rules?: undefined;
|
|
179
|
+
tls?: undefined;
|
|
180
|
+
loadBalancer?: undefined;
|
|
181
|
+
}>;
|
|
182
|
+
readonly describe_controller: import("ai").Tool<{
|
|
183
|
+
namespace: string;
|
|
184
|
+
kind: "Deployment" | "StatefulSet" | "DaemonSet" | "ReplicaSet";
|
|
185
|
+
name: string;
|
|
186
|
+
}, {
|
|
187
|
+
kind: "Deployment" | "StatefulSet" | "DaemonSet" | "ReplicaSet";
|
|
188
|
+
name: string;
|
|
189
|
+
namespace: string;
|
|
190
|
+
replicas: {
|
|
191
|
+
desired: any;
|
|
192
|
+
current: any;
|
|
193
|
+
ready: any;
|
|
194
|
+
available: any;
|
|
195
|
+
updated: any;
|
|
196
|
+
} | {
|
|
197
|
+
desired: any;
|
|
198
|
+
ready: any;
|
|
199
|
+
available: any;
|
|
200
|
+
updated: any;
|
|
201
|
+
current?: undefined;
|
|
202
|
+
};
|
|
203
|
+
strategy: any;
|
|
204
|
+
conditions: any;
|
|
205
|
+
selector: any;
|
|
206
|
+
template: {
|
|
207
|
+
containers: any;
|
|
208
|
+
initContainers: any;
|
|
209
|
+
serviceAccount: any;
|
|
210
|
+
};
|
|
211
|
+
error?: undefined;
|
|
212
|
+
} | {
|
|
213
|
+
error: any;
|
|
214
|
+
kind?: undefined;
|
|
215
|
+
name?: undefined;
|
|
216
|
+
namespace?: undefined;
|
|
217
|
+
replicas?: undefined;
|
|
218
|
+
strategy?: undefined;
|
|
219
|
+
conditions?: undefined;
|
|
220
|
+
selector?: undefined;
|
|
221
|
+
template?: undefined;
|
|
222
|
+
}>;
|
|
119
223
|
readonly get_service_yaml: import("ai").Tool<{
|
|
120
224
|
namespace: string;
|
|
121
225
|
name: string;
|
|
@@ -460,6 +564,11 @@ export declare const tools: {
|
|
|
460
564
|
namespace: string;
|
|
461
565
|
name: string;
|
|
462
566
|
}, any>;
|
|
567
|
+
readonly get_controller_yaml: import("ai").Tool<{
|
|
568
|
+
namespace: string;
|
|
569
|
+
kind: "Deployment" | "StatefulSet" | "DaemonSet" | "ReplicaSet";
|
|
570
|
+
name: string;
|
|
571
|
+
}, any>;
|
|
463
572
|
readonly get_rollout_history: import("ai").Tool<{
|
|
464
573
|
namespace: string;
|
|
465
574
|
name: string;
|
package/dist/back.js
CHANGED
|
@@ -401,11 +401,12 @@ exports.tools = {
|
|
|
401
401
|
const resp = await ctx().clusterInfo.coreApi.listNamespace();
|
|
402
402
|
return {
|
|
403
403
|
namespaces: resp.items.map((ns) => {
|
|
404
|
-
var _a, _b, _c, _d;
|
|
404
|
+
var _a, _b, _c, _d, _e;
|
|
405
405
|
return ({
|
|
406
406
|
name: (_a = ns.metadata) === null || _a === void 0 ? void 0 : _a.name,
|
|
407
|
-
|
|
408
|
-
|
|
407
|
+
uid: (_b = ns.metadata) === null || _b === void 0 ? void 0 : _b.uid,
|
|
408
|
+
status: (_c = ns.status) === null || _c === void 0 ? void 0 : _c.phase,
|
|
409
|
+
labels: (_e = (_d = ns.metadata) === null || _d === void 0 ? void 0 : _d.labels) !== null && _e !== void 0 ? _e : {}
|
|
409
410
|
});
|
|
410
411
|
})
|
|
411
412
|
};
|
|
@@ -465,27 +466,152 @@ exports.tools = {
|
|
|
465
466
|
}
|
|
466
467
|
}),
|
|
467
468
|
get_space_data: (0, ai_1.tool)({
|
|
468
|
-
description: '
|
|
469
|
+
description: 'Describes a Kubernetes namespace (equivalent to kubectl describe namespace + a rollup): its status and labels, ResourceQuota usage (used vs hard) and LimitRange defaults, plus the resources in it — pods (with restart count), deployments, services and configmap names.',
|
|
469
470
|
inputSchema: zod_1.z.object({ namespace: zod_1.z.string().describe('Name of the namespace to retrieve data for') }),
|
|
470
471
|
execute: async ({ namespace }) => {
|
|
471
|
-
var _a;
|
|
472
|
+
var _a, _b, _c, _d;
|
|
472
473
|
ctx().trace('get_space_data', { namespace });
|
|
473
474
|
try {
|
|
474
475
|
const c = ctx().clusterInfo;
|
|
475
|
-
|
|
476
|
+
// ns/quota/limits are best-effort: a missing RBAC for them must not hide the core namespace rollup.
|
|
477
|
+
const [ns, p, d, s, cm, rq, lr] = await Promise.all([
|
|
478
|
+
c.coreApi.readNamespace({ name: namespace }).catch(() => null),
|
|
479
|
+
c.coreApi.listNamespacedPod({ namespace }),
|
|
480
|
+
c.appsApi.listNamespacedDeployment({ namespace }),
|
|
481
|
+
c.coreApi.listNamespacedService({ namespace }),
|
|
482
|
+
c.coreApi.listNamespacedConfigMap({ namespace }),
|
|
483
|
+
c.coreApi.listNamespacedResourceQuota({ namespace }).catch(() => ({ items: [] })),
|
|
484
|
+
c.coreApi.listNamespacedLimitRange({ namespace }).catch(() => ({ items: [] }))
|
|
485
|
+
]);
|
|
476
486
|
return {
|
|
477
487
|
namespace,
|
|
488
|
+
status: (_a = ns === null || ns === void 0 ? void 0 : ns.status) === null || _a === void 0 ? void 0 : _a.phase,
|
|
489
|
+
labels: (_c = (_b = ns === null || ns === void 0 ? void 0 : ns.metadata) === null || _b === void 0 ? void 0 : _b.labels) !== null && _c !== void 0 ? _c : {},
|
|
490
|
+
resourceQuotas: rq.items.map((q) => { var _a, _b, _c, _d, _e, _f, _g; return ({ name: (_a = q.metadata) === null || _a === void 0 ? void 0 : _a.name, hard: (_e = (_c = (_b = q.status) === null || _b === void 0 ? void 0 : _b.hard) !== null && _c !== void 0 ? _c : (_d = q.spec) === null || _d === void 0 ? void 0 : _d.hard) !== null && _e !== void 0 ? _e : {}, used: (_g = (_f = q.status) === null || _f === void 0 ? void 0 : _f.used) !== null && _g !== void 0 ? _g : {} }); }),
|
|
491
|
+
limitRanges: lr.items.map((l) => { var _a, _b, _c; return ({ name: (_a = l.metadata) === null || _a === void 0 ? void 0 : _a.name, limits: (_c = (_b = l.spec) === null || _b === void 0 ? void 0 : _b.limits) !== null && _c !== void 0 ? _c : [] }); }),
|
|
478
492
|
pods: p.items.map((x) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j; return ({ name: (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name, phase: (_b = x.status) === null || _b === void 0 ? void 0 : _b.phase, nodeName: (_c = x.spec) === null || _c === void 0 ? void 0 : _c.nodeName, ready: ((_f = (_e = (_d = x.status) === null || _d === void 0 ? void 0 : _d.conditions) === null || _e === void 0 ? void 0 : _e.find((c) => c.type === 'Ready')) === null || _f === void 0 ? void 0 : _f.status) === 'True', restartCount: (_j = (_h = (_g = x.status) === null || _g === void 0 ? void 0 : _g.containerStatuses) === null || _h === void 0 ? void 0 : _h.reduce((sum, cs) => sum + cs.restartCount, 0)) !== null && _j !== void 0 ? _j : 0 }); }),
|
|
479
493
|
deployments: d.items.map((x) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j; return ({ name: (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name, replicas: (_b = x.spec) === null || _b === void 0 ? void 0 : _b.replicas, readyReplicas: (_d = (_c = x.status) === null || _c === void 0 ? void 0 : _c.readyReplicas) !== null && _d !== void 0 ? _d : 0, image: (_j = (_h = (_g = (_f = (_e = x.spec) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.spec) === null || _g === void 0 ? void 0 : _g.containers) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.image }); }),
|
|
480
494
|
services: s.items.map((x) => { var _a, _b, _c; return ({ name: (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name, type: (_b = x.spec) === null || _b === void 0 ? void 0 : _b.type, clusterIP: (_c = x.spec) === null || _c === void 0 ? void 0 : _c.clusterIP }); }),
|
|
481
495
|
configMaps: cm.items.map((x) => { var _a; return (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name; })
|
|
482
496
|
};
|
|
483
497
|
}
|
|
498
|
+
catch (err) {
|
|
499
|
+
return { error: (_d = err.message) !== null && _d !== void 0 ? _d : String(err) };
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}),
|
|
503
|
+
get_namespace_yaml: (0, ai_1.tool)({
|
|
504
|
+
description: 'Returns the full Kubernetes Namespace manifest (equivalent to kubectl get namespace -o yaml): complete metadata (uid, labels, annotations, creationTimestamp), spec (finalizers) and status. Use when you need a specific field the namespace summary doesn\'t include (e.g. its uid).',
|
|
505
|
+
inputSchema: zod_1.z.object({ name: zod_1.z.string().describe('Name of the namespace') }),
|
|
506
|
+
execute: async ({ name }) => {
|
|
507
|
+
var _a;
|
|
508
|
+
ctx().trace('get_namespace_yaml', { name });
|
|
509
|
+
try {
|
|
510
|
+
return await ctx().clusterInfo.coreApi.readNamespace({ name });
|
|
511
|
+
}
|
|
484
512
|
catch (err) {
|
|
485
513
|
return { error: (_a = err.message) !== null && _a !== void 0 ? _a : String(err) };
|
|
486
514
|
}
|
|
487
515
|
}
|
|
488
516
|
}),
|
|
517
|
+
describe_service: (0, ai_1.tool)({
|
|
518
|
+
description: 'Diagnostic summary of a Service (equivalent to kubectl describe service): type, clusterIP, ports, selector, sessionAffinity, external/loadBalancer, AND its live Endpoints — the pod IPs currently backing it (ready vs not-ready). Best tool to see WHY traffic isn\'t reaching pods (empty/not-ready endpoints = selector mismatch or unready pods).',
|
|
519
|
+
inputSchema: zod_1.z.object({
|
|
520
|
+
namespace: zod_1.z.string().describe('Namespace of the service'),
|
|
521
|
+
name: zod_1.z.string().describe('Name of the service')
|
|
522
|
+
}),
|
|
523
|
+
execute: async ({ namespace, name }) => {
|
|
524
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m, _o, _p, _q, _r;
|
|
525
|
+
ctx().trace('describe_service', { namespace, name });
|
|
526
|
+
try {
|
|
527
|
+
const c = ctx().clusterInfo;
|
|
528
|
+
const svc = await c.coreApi.readNamespacedService({ name, namespace });
|
|
529
|
+
const ep = await c.coreApi.readNamespacedEndpoints({ name, namespace }).catch(() => null);
|
|
530
|
+
const endpoints = ((_a = ep === null || ep === void 0 ? void 0 : ep.subsets) !== null && _a !== void 0 ? _a : []).flatMap((ss) => {
|
|
531
|
+
var _a, _b;
|
|
532
|
+
return [
|
|
533
|
+
...((_a = ss.addresses) !== null && _a !== void 0 ? _a : []).map((a) => { var _a; return ({ ip: a.ip, ready: true, targetRef: a.targetRef ? `${a.targetRef.kind}/${a.targetRef.name}` : undefined, ports: ((_a = ss.ports) !== null && _a !== void 0 ? _a : []).map((p) => p.port) }); }),
|
|
534
|
+
...((_b = ss.notReadyAddresses) !== null && _b !== void 0 ? _b : []).map((a) => { var _a; return ({ ip: a.ip, ready: false, targetRef: a.targetRef ? `${a.targetRef.kind}/${a.targetRef.name}` : undefined, ports: ((_a = ss.ports) !== null && _a !== void 0 ? _a : []).map((p) => p.port) }); })
|
|
535
|
+
];
|
|
536
|
+
});
|
|
537
|
+
return {
|
|
538
|
+
name, namespace,
|
|
539
|
+
type: (_b = svc.spec) === null || _b === void 0 ? void 0 : _b.type, clusterIP: (_c = svc.spec) === null || _c === void 0 ? void 0 : _c.clusterIP, externalIPs: (_e = (_d = svc.spec) === null || _d === void 0 ? void 0 : _d.externalIPs) !== null && _e !== void 0 ? _e : [],
|
|
540
|
+
loadBalancer: (_h = (_g = (_f = svc.status) === null || _f === void 0 ? void 0 : _f.loadBalancer) === null || _g === void 0 ? void 0 : _g.ingress) !== null && _h !== void 0 ? _h : [], sessionAffinity: (_j = svc.spec) === null || _j === void 0 ? void 0 : _j.sessionAffinity,
|
|
541
|
+
selector: (_m = (_l = svc.spec) === null || _l === void 0 ? void 0 : _l.selector) !== null && _m !== void 0 ? _m : {},
|
|
542
|
+
ports: (_q = (_p = (_o = svc.spec) === null || _o === void 0 ? void 0 : _o.ports) === null || _p === void 0 ? void 0 : _p.map((p) => ({ name: p.name, port: p.port, targetPort: p.targetPort, nodePort: p.nodePort, protocol: p.protocol }))) !== null && _q !== void 0 ? _q : [],
|
|
543
|
+
endpoints, // the pods actually behind the service right now (empty = nothing serving)
|
|
544
|
+
endpointCount: endpoints.length
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
catch (err) {
|
|
548
|
+
return { error: (_r = err.message) !== null && _r !== void 0 ? _r : String(err) };
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}),
|
|
552
|
+
describe_ingress: (0, ai_1.tool)({
|
|
553
|
+
description: 'Diagnostic summary of an Ingress (equivalent to kubectl describe ingress): ingressClass, the routing rules (host → path → backend service:port), the default backend, TLS (hosts + secret), and the load-balancer address assigned by the controller. Use to see how external traffic is routed to services.',
|
|
554
|
+
inputSchema: zod_1.z.object({
|
|
555
|
+
namespace: zod_1.z.string().describe('Namespace of the ingress'),
|
|
556
|
+
name: zod_1.z.string().describe('Name of the ingress')
|
|
557
|
+
}),
|
|
558
|
+
execute: async ({ namespace, name }) => {
|
|
559
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l;
|
|
560
|
+
ctx().trace('describe_ingress', { namespace, name });
|
|
561
|
+
try {
|
|
562
|
+
const ing = await ctx().clusterInfo.networkApi.readNamespacedIngress({ name, namespace });
|
|
563
|
+
const backend = (b) => { var _a, _b, _c; return (b === null || b === void 0 ? void 0 : b.service) ? `${b.service.name}:${(_b = (_a = b.service.port) === null || _a === void 0 ? void 0 : _a.number) !== null && _b !== void 0 ? _b : (_c = b.service.port) === null || _c === void 0 ? void 0 : _c.name}` : ((b === null || b === void 0 ? void 0 : b.resource) ? `${b.resource.kind}/${b.resource.name}` : undefined); };
|
|
564
|
+
return {
|
|
565
|
+
name, namespace,
|
|
566
|
+
ingressClass: (_a = ing.spec) === null || _a === void 0 ? void 0 : _a.ingressClassName,
|
|
567
|
+
defaultBackend: backend((_b = ing.spec) === null || _b === void 0 ? void 0 : _b.defaultBackend),
|
|
568
|
+
rules: ((_d = (_c = ing.spec) === null || _c === void 0 ? void 0 : _c.rules) !== null && _d !== void 0 ? _d : []).flatMap((r) => { var _a, _b; return ((_b = (_a = r.http) === null || _a === void 0 ? void 0 : _a.paths) !== null && _b !== void 0 ? _b : []).map((p) => ({ host: r.host, path: p.path, pathType: p.pathType, backend: backend(p.backend) })); }),
|
|
569
|
+
tls: ((_f = (_e = ing.spec) === null || _e === void 0 ? void 0 : _e.tls) !== null && _f !== void 0 ? _f : []).map((t) => ({ hosts: t.hosts, secretName: t.secretName })),
|
|
570
|
+
loadBalancer: (_j = (_h = (_g = ing.status) === null || _g === void 0 ? void 0 : _g.loadBalancer) === null || _h === void 0 ? void 0 : _h.ingress) !== null && _j !== void 0 ? _j : []
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
catch (err) {
|
|
574
|
+
return { error: (_l = err.message) !== null && _l !== void 0 ? _l : String(err) };
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}),
|
|
578
|
+
describe_controller: (0, ai_1.tool)({
|
|
579
|
+
description: 'Diagnostic summary of a workload controller (equivalent to kubectl describe deployment/statefulset/daemonset/replicaset): replica counts (desired/ready/available/updated), rollout strategy, conditions (Available/Progressing + reason — why it is not fully rolled out), selector, and its pod template (image, resources, probes). Parametrised by kind, so one call covers any controller type.',
|
|
580
|
+
inputSchema: zod_1.z.object({
|
|
581
|
+
namespace: zod_1.z.string().describe('Namespace of the controller'),
|
|
582
|
+
kind: zod_1.z.enum(['Deployment', 'StatefulSet', 'DaemonSet', 'ReplicaSet']).describe('Controller kind'),
|
|
583
|
+
name: zod_1.z.string().describe('Name of the controller')
|
|
584
|
+
}),
|
|
585
|
+
execute: async ({ namespace, kind, name }) => {
|
|
586
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m, _o, _p, _q, _r, _s;
|
|
587
|
+
ctx().trace('describe_controller', { namespace, kind, name });
|
|
588
|
+
try {
|
|
589
|
+
const a = ctx().clusterInfo.appsApi;
|
|
590
|
+
const obj = kind === 'StatefulSet' ? await a.readNamespacedStatefulSet({ name, namespace })
|
|
591
|
+
: kind === 'DaemonSet' ? await a.readNamespacedDaemonSet({ name, namespace })
|
|
592
|
+
: kind === 'ReplicaSet' ? await a.readNamespacedReplicaSet({ name, namespace })
|
|
593
|
+
: await a.readNamespacedDeployment({ name, namespace });
|
|
594
|
+
const spec = (_a = obj.spec) !== null && _a !== void 0 ? _a : {}, status = (_b = obj.status) !== null && _b !== void 0 ? _b : {};
|
|
595
|
+
const tpl = (_d = (_c = spec.template) === null || _c === void 0 ? void 0 : _c.spec) !== null && _d !== void 0 ? _d : {};
|
|
596
|
+
const container = (ct) => ({ name: ct.name, image: ct.image, resources: ct.resources, livenessProbe: !!ct.livenessProbe, readinessProbe: !!ct.readinessProbe });
|
|
597
|
+
// DaemonSet reports scheduling counts; the others report replica counts.
|
|
598
|
+
const replicas = kind === 'DaemonSet'
|
|
599
|
+
? { desired: status.desiredNumberScheduled, current: status.currentNumberScheduled, ready: status.numberReady, available: status.numberAvailable, updated: status.updatedNumberScheduled }
|
|
600
|
+
: { desired: spec.replicas, ready: (_e = status.readyReplicas) !== null && _e !== void 0 ? _e : 0, available: (_f = status.availableReplicas) !== null && _f !== void 0 ? _f : 0, updated: (_g = status.updatedReplicas) !== null && _g !== void 0 ? _g : 0 };
|
|
601
|
+
return {
|
|
602
|
+
kind, name, namespace,
|
|
603
|
+
replicas,
|
|
604
|
+
strategy: (_j = (_h = spec.strategy) === null || _h === void 0 ? void 0 : _h.type) !== null && _j !== void 0 ? _j : (_l = spec.updateStrategy) === null || _l === void 0 ? void 0 : _l.type,
|
|
605
|
+
conditions: ((_m = status.conditions) !== null && _m !== void 0 ? _m : []).map((c) => ({ type: c.type, status: c.status, reason: c.reason, message: c.message })),
|
|
606
|
+
selector: (_p = (_o = spec.selector) === null || _o === void 0 ? void 0 : _o.matchLabels) !== null && _p !== void 0 ? _p : {},
|
|
607
|
+
template: { containers: ((_q = tpl.containers) !== null && _q !== void 0 ? _q : []).map(container), initContainers: ((_r = tpl.initContainers) !== null && _r !== void 0 ? _r : []).map(container), serviceAccount: tpl.serviceAccountName }
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
catch (err) {
|
|
611
|
+
return { error: (_s = err.message) !== null && _s !== void 0 ? _s : String(err) };
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}),
|
|
489
615
|
get_service_yaml: (0, ai_1.tool)({
|
|
490
616
|
description: 'Returns the full Kubernetes Service manifest (equivalent to kubectl get service -o yaml) for a given namespace and service name.',
|
|
491
617
|
inputSchema: zod_1.z.object({
|
|
@@ -1070,6 +1196,28 @@ exports.tools = {
|
|
|
1070
1196
|
}
|
|
1071
1197
|
}
|
|
1072
1198
|
}),
|
|
1199
|
+
get_controller_yaml: (0, ai_1.tool)({
|
|
1200
|
+
description: 'Returns the full manifest of a workload controller (equivalent to kubectl get <kind> -o yaml), for ANY kind — Deployment, StatefulSet, DaemonSet or ReplicaSet. Complete metadata (uid, labels, annotations), spec (pod template, strategy) and status. Use when you need a specific field the describe summary doesn\'t include.',
|
|
1201
|
+
inputSchema: zod_1.z.object({
|
|
1202
|
+
namespace: zod_1.z.string().describe('Namespace of the controller'),
|
|
1203
|
+
kind: zod_1.z.enum(['Deployment', 'StatefulSet', 'DaemonSet', 'ReplicaSet']).describe('Controller kind'),
|
|
1204
|
+
name: zod_1.z.string().describe('Name of the controller')
|
|
1205
|
+
}),
|
|
1206
|
+
execute: async ({ namespace, kind, name }) => {
|
|
1207
|
+
var _a;
|
|
1208
|
+
ctx().trace('get_controller_yaml', { namespace, kind, name });
|
|
1209
|
+
try {
|
|
1210
|
+
const a = ctx().clusterInfo.appsApi;
|
|
1211
|
+
return kind === 'StatefulSet' ? await a.readNamespacedStatefulSet({ name, namespace })
|
|
1212
|
+
: kind === 'DaemonSet' ? await a.readNamespacedDaemonSet({ name, namespace })
|
|
1213
|
+
: kind === 'ReplicaSet' ? await a.readNamespacedReplicaSet({ name, namespace })
|
|
1214
|
+
: await a.readNamespacedDeployment({ name, namespace });
|
|
1215
|
+
}
|
|
1216
|
+
catch (err) {
|
|
1217
|
+
return { error: (_a = err.message) !== null && _a !== void 0 ? _a : String(err) };
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}),
|
|
1073
1221
|
get_rollout_history: (0, ai_1.tool)({
|
|
1074
1222
|
description: 'Returns the rollout history (revisions) of a Deployment via its ReplicaSets: per revision the image(s), replicas and pod-template summary (env with inline VALUES and their configMap/secret source, resources, command). Use to see WHAT CHANGED recently — a new image tag, a changed inline env value, a resource/command change — that may have broken the pods. Compare the newest revision against the previous one. NOTE: a change to a ConfigMap/Secret VALUE does NOT create a revision — use get_workload_config_refs for that.',
|
|
1075
1223
|
inputSchema: zod_1.z.object({
|
|
@@ -1218,11 +1366,14 @@ exports.toolInfoList = [
|
|
|
1218
1366
|
{ name: 'get_node_data', effect: EToolEffect.READ, description: 'Returns configuration info about all Kubernetes nodes (name, IP). Configuration only — not workload or usage data.' },
|
|
1219
1367
|
{ name: 'get_cluster_data', effect: EToolEffect.READ, description: 'Returns general cluster info: name, flavour (AKS/EKS/GKE/k3s/k3d), total vCPUs, total memory, node count and readiness status.' },
|
|
1220
1368
|
{ name: 'get_workload_data', effect: EToolEffect.READ, description: 'Returns all workloads in the cluster: deployments, statefulsets, daemonsets, pods and services. Optionally filter by namespace.' },
|
|
1221
|
-
{ name: 'get_space_data', effect: EToolEffect.READ, description: '
|
|
1369
|
+
{ name: 'get_space_data', effect: EToolEffect.READ, description: 'Describes a namespace (kubectl describe namespace + rollup): status/labels, ResourceQuota (used vs hard), LimitRange, plus its pods (restart count), deployments, services and configmaps.' },
|
|
1370
|
+
{ name: 'get_namespace_yaml', effect: EToolEffect.READ, description: 'Full Namespace manifest (kubectl get namespace -o yaml): complete metadata (uid, labels, annotations, creationTimestamp), spec and status — for any field the summary omits (e.g. its uid).' },
|
|
1222
1371
|
{ name: 'get_service_yaml', effect: EToolEffect.READ, description: 'Returns the full Kubernetes Service manifest (equivalent to kubectl get service -o yaml) for a given namespace and service name.' },
|
|
1372
|
+
{ name: 'describe_service', effect: EToolEffect.READ, description: 'Diagnostic summary of a Service (kubectl describe service): type/clusterIP/ports/selector + its live Endpoints (the pod IPs backing it, ready vs not) — see why traffic isn\'t reaching pods.' },
|
|
1223
1373
|
{ name: 'list_services', effect: EToolEffect.READ, description: 'Lists all Services in the cluster with full details (type, clusterIP, ports, selector). Optionally filter by namespace.' },
|
|
1224
1374
|
{ name: 'list_ingresses', effect: EToolEffect.READ, description: 'Lists all Ingresses in the cluster (hosts, paths, TLS, backend services). Optionally filter by namespace.' },
|
|
1225
1375
|
{ name: 'get_ingress_yaml', effect: EToolEffect.READ, description: 'Returns the full Kubernetes Ingress manifest (equivalent to kubectl get ingress -o yaml) for a given namespace and ingress name.' },
|
|
1376
|
+
{ name: 'describe_ingress', effect: EToolEffect.READ, description: 'Diagnostic summary of an Ingress (kubectl describe ingress): ingressClass, rules (host → path → backend service:port), default backend, TLS, and the load-balancer address.' },
|
|
1226
1377
|
{ name: 'get_cluster_usage', effect: EToolEffect.READ, description: 'Returns current overall cluster resource usage: CPU%, memory%, network Mbps, total vCPUs and total memory GB.' },
|
|
1227
1378
|
{ name: 'get_node_usage', effect: EToolEffect.READ, description: 'Returns current CPU and memory usage for one node or all nodes from the latest metrics reading.' },
|
|
1228
1379
|
{ name: 'get_deployment_usage', effect: EToolEffect.READ, description: 'Returns current aggregated CPU and memory usage for all pods belonging to a specific deployment.' },
|
|
@@ -1247,6 +1398,8 @@ exports.toolInfoList = [
|
|
|
1247
1398
|
{ name: 'describe_pod', effect: EToolEffect.READ, description: 'Diagnostic summary of a pod (kubectl describe pod): per-container waiting/terminated reason + exitCode (OOMKilled/CrashLoop…), restart count, probes.' },
|
|
1248
1399
|
{ name: 'get_pod_yaml', effect: EToolEffect.READ, description: 'Full Pod manifest (kubectl get pod -o yaml): spec (env, volumes, resources, probes) and status.' },
|
|
1249
1400
|
{ name: 'get_deployment_yaml', effect: EToolEffect.READ, description: 'Full Deployment manifest (kubectl get deployment -o yaml): pod template (image, env, resources, probes) and strategy.' },
|
|
1401
|
+
{ name: 'describe_controller', effect: EToolEffect.READ, description: 'Diagnostic summary of a workload controller (kubectl describe deployment/statefulset/daemonset/replicaset): replica counts (desired/ready/available/updated), strategy, conditions (why not rolled out), selector, pod template. Parametrised by kind.' },
|
|
1402
|
+
{ name: 'get_controller_yaml', effect: EToolEffect.READ, description: 'Full manifest of any workload controller (kubectl get <kind> -o yaml): Deployment/StatefulSet/DaemonSet/ReplicaSet — complete metadata (uid, annotations), spec and status. Parametrised by kind, for any field the describe omits.' },
|
|
1250
1403
|
{ name: 'get_rollout_history', effect: EToolEffect.READ, description: 'Rollout revisions of a Deployment (via ReplicaSets): image + template per revision (env with inline values + configMap/secret source), to see what changed (new image/env/resource) that may have broken the pods.' },
|
|
1251
1404
|
{ name: 'get_configmap', effect: EToolEffect.READ, description: 'A ConfigMap\'s data (key→value) + lastModified. A ConfigMap value change does NOT create a rollout revision, so check it for a crash with no deployment change.' },
|
|
1252
1405
|
{ name: 'get_secret', effect: EToolEffect.READ, description: 'A Secret\'s keys + type + lastModified (VALUES REDACTED). Check whether a consumed Secret changed recently (no rollout revision is created by a value change).' },
|
package/dist/front.js
CHANGED
|
@@ -50,7 +50,7 @@ const material_1 = require("@mui/material");
|
|
|
50
50
|
propia copia—, y common-front y common-ai son la excepcion documentada.
|
|
51
51
|
*/
|
|
52
52
|
const Download_1 = __importDefault(require("@mui/icons-material/Download"));
|
|
53
|
-
const
|
|
53
|
+
const Upload_1 = __importDefault(require("@mui/icons-material/Upload"));
|
|
54
54
|
const Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
|
|
55
55
|
const VisibilityOff_1 = __importDefault(require("@mui/icons-material/VisibilityOff"));
|
|
56
56
|
const downloadJson = async (data, filename) => {
|
|
@@ -198,7 +198,7 @@ const AiConfigLlm = (props) => {
|
|
|
198
198
|
reader.readAsText(f);
|
|
199
199
|
e.target.value = '';
|
|
200
200
|
} }),
|
|
201
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(
|
|
201
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(Upload_1.default, { fontSize: 'small' }), onClick: () => { var _a; return (_a = importLlmRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }, "Import"),
|
|
202
202
|
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(Download_1.default, { fontSize: 'small' }), onClick: () => downloadJson(llms, 'kwirth-llms.json') }, "Export"),
|
|
203
203
|
react_1.default.createElement(material_1.Box, { flex: 1 }),
|
|
204
204
|
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(llms), variant: 'contained' }, "OK"),
|
|
@@ -327,7 +327,7 @@ const AiConfigProvider = (props) => {
|
|
|
327
327
|
reader.readAsText(f);
|
|
328
328
|
e.target.value = '';
|
|
329
329
|
} }),
|
|
330
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(
|
|
330
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(Upload_1.default, { fontSize: 'small' }), onClick: () => { var _a; return (_a = importProvRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }, "Import"),
|
|
331
331
|
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(Download_1.default, { fontSize: 'small' }), onClick: () => downloadJson(providers.map(p => { var _a; return (Object.assign({ name: p.name, type: (_a = p.type) !== null && _a !== void 0 ? _a : p.name, key: p.key }, (p.endpoint ? { endpoint: p.endpoint } : {}))); }), 'kwirth-providers.json') }, "Export"),
|
|
332
332
|
react_1.default.createElement(material_1.Box, { flex: 1 }),
|
|
333
333
|
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(providers), color: 'primary', variant: 'contained' }, "Save"),
|