@kwirthmagnify/kwirth-common-ai 0.5.20 → 0.5.22
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/dist/front.js +13 -7
- 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) => {
|
package/dist/front.js
CHANGED
|
@@ -32,11 +32,17 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.ToolSelector = exports.AiConfigProvider = exports.AiConfigLlm = exports.LlmSelector = void 0;
|
|
37
40
|
const react_1 = __importStar(require("react"));
|
|
38
41
|
const material_1 = require("@mui/material");
|
|
39
|
-
const
|
|
42
|
+
const FileDownload_1 = __importDefault(require("@mui/icons-material/FileDownload"));
|
|
43
|
+
const FileUpload_1 = __importDefault(require("@mui/icons-material/FileUpload"));
|
|
44
|
+
const Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
|
|
45
|
+
const VisibilityOff_1 = __importDefault(require("@mui/icons-material/VisibilityOff"));
|
|
40
46
|
const downloadJson = async (data, filename) => {
|
|
41
47
|
var _a;
|
|
42
48
|
const json = JSON.stringify(data, null, 2);
|
|
@@ -152,7 +158,7 @@ const AiConfigLlm = (props) => {
|
|
|
152
158
|
react_1.default.createElement(material_1.Checkbox, { checked: useProviderKey, onChange: e => setUseProviderKey(e.target.checked) })),
|
|
153
159
|
react_1.default.createElement(material_1.TextField, { value: key, onChange: e => setKey(e.target.value), disabled: useProviderKey, label: 'API Key', placeholder: 'Enter API Key', variant: 'standard', fullWidth: true, type: showPassword ? 'text' : 'password', InputProps: {
|
|
154
160
|
endAdornment: (react_1.default.createElement(material_1.InputAdornment, { position: 'end' },
|
|
155
|
-
react_1.default.createElement(material_1.IconButton, { onClick: () => setShowPassword(!showPassword), edge: 'end' }, showPassword ? react_1.default.createElement(
|
|
161
|
+
react_1.default.createElement(material_1.IconButton, { onClick: () => setShowPassword(!showPassword), edge: 'end' }, showPassword ? react_1.default.createElement(VisibilityOff_1.default, null) : react_1.default.createElement(Visibility_1.default, null))))
|
|
156
162
|
} })),
|
|
157
163
|
react_1.default.createElement(material_1.Stack, { direction: 'row', spacing: 1 },
|
|
158
164
|
react_1.default.createElement(material_1.Button, { variant: 'outlined', size: 'small', onClick: onNew }, "New"),
|
|
@@ -173,8 +179,8 @@ const AiConfigLlm = (props) => {
|
|
|
173
179
|
reader.readAsText(f);
|
|
174
180
|
e.target.value = '';
|
|
175
181
|
} }),
|
|
176
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(
|
|
177
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(
|
|
182
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileUpload_1.default, { fontSize: 'small' }), onClick: () => { var _a; return (_a = importLlmRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }, "Import"),
|
|
183
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileDownload_1.default, { fontSize: 'small' }), onClick: () => downloadJson(llms, 'kwirth-llms.json') }, "Export"),
|
|
178
184
|
react_1.default.createElement(material_1.Box, { flex: 1 }),
|
|
179
185
|
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(llms), variant: 'contained' }, "OK"),
|
|
180
186
|
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(undefined), color: 'inherit' }, "Cancel"))));
|
|
@@ -232,7 +238,7 @@ const AiConfigProvider = (props) => {
|
|
|
232
238
|
react_1.default.createElement(material_1.Select, { value: providerName, onChange: e => setProviderName(e.target.value), variant: 'standard', fullWidth: true }, props.providersAvailable.map(name => (react_1.default.createElement(material_1.MenuItem, { key: name, value: name }, name))))),
|
|
233
239
|
react_1.default.createElement(material_1.TextField, { label: 'API Key / Token', type: showPassword ? 'text' : 'password', variant: 'standard', fullWidth: true, value: providerKey, onChange: e => setProviderKey(e.target.value), helperText: 'This key can be afterwards linked to specific uses.', InputProps: {
|
|
234
240
|
endAdornment: (react_1.default.createElement(material_1.InputAdornment, { position: 'end' },
|
|
235
|
-
react_1.default.createElement(material_1.IconButton, { onClick: () => setShowPassword(!showPassword), edge: 'end' }, showPassword ? react_1.default.createElement(
|
|
241
|
+
react_1.default.createElement(material_1.IconButton, { onClick: () => setShowPassword(!showPassword), edge: 'end' }, showPassword ? react_1.default.createElement(VisibilityOff_1.default, null) : react_1.default.createElement(Visibility_1.default, null))))
|
|
236
242
|
} }),
|
|
237
243
|
react_1.default.createElement(material_1.Box, { sx: { flexGrow: 1 } }),
|
|
238
244
|
react_1.default.createElement(material_1.Stack, { direction: 'row', spacing: 1 },
|
|
@@ -254,8 +260,8 @@ const AiConfigProvider = (props) => {
|
|
|
254
260
|
reader.readAsText(f);
|
|
255
261
|
e.target.value = '';
|
|
256
262
|
} }),
|
|
257
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(
|
|
258
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(
|
|
263
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileUpload_1.default, { fontSize: 'small' }), onClick: () => { var _a; return (_a = importProvRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }, "Import"),
|
|
264
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileDownload_1.default, { fontSize: 'small' }), onClick: () => downloadJson(providers.map(p => ({ name: p.name, key: p.key })), 'kwirth-providers.json') }, "Export"),
|
|
259
265
|
react_1.default.createElement(material_1.Box, { flex: 1 }),
|
|
260
266
|
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(providers), color: 'primary', variant: 'contained' }, "Save"),
|
|
261
267
|
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(undefined), color: 'inherit' }, "Cancel"))));
|