@kwirthmagnify/kwirth-common-ai 0.5.62 → 0.5.64
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/README.md +18 -0
- package/dist/back.d.ts +7 -1
- package/dist/back.js +2 -1
- package/dist/front.js +13 -13
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @kwirthmagnify/kwirth-common-ai
|
|
2
|
+
|
|
3
|
+
Shared AI/LLM types and utilities for [Kwirth](https://kwirthmagnify.dev) AI plugins.
|
|
4
|
+
|
|
5
|
+
## What is this?
|
|
6
|
+
|
|
7
|
+
This package contains the TypeScript interfaces and utilities for working with LLM providers and models in Kwirth: `ILlm`, `IProvider`, `IModel`, `buildModel`, `loadModels`, and related types.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @kwirthmagnify/kwirth-common-ai
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Links
|
|
16
|
+
|
|
17
|
+
- **Kwirth**: https://kwirthmagnify.dev
|
|
18
|
+
- **Repository**: https://github.com/kwirthmagnify/kwirth
|
package/dist/back.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILlm, ILlmProvider, ECapability, EToolEffect, EToolSensitivity, IAiToolInfo, IAiToolsetInfo, IToolsetConfig } from './index';
|
|
2
|
-
import type { AppsV1Api, CoreV1Api, NetworkingV1Api } from '@kubernetes/client-node';
|
|
2
|
+
import type { AppsV1Api, CoreV1Api, CustomObjectsApi, NetworkingV1Api } from '@kubernetes/client-node';
|
|
3
3
|
interface ILogChannel {
|
|
4
4
|
logInfo?: (msg: string) => void;
|
|
5
5
|
logWarning?: (msg: string) => void;
|
|
@@ -69,6 +69,12 @@ export interface IK8sCapability {
|
|
|
69
69
|
coreApi: CoreV1Api;
|
|
70
70
|
appsApi: AppsV1Api;
|
|
71
71
|
networkApi: NetworkingV1Api;
|
|
72
|
+
/**
|
|
73
|
+
* Custom resources. The three typed APIs above only reach built-in kinds, so without this a toolset
|
|
74
|
+
* cannot read a single CRD -- and that is where whole products live: Fleet, Kubewarden, Longhorn,
|
|
75
|
+
* Trivy. The core already builds this client at startup; it simply was not being lent.
|
|
76
|
+
*/
|
|
77
|
+
crdApi: CustomObjectsApi;
|
|
72
78
|
}
|
|
73
79
|
export interface IMetricsPodSample {
|
|
74
80
|
podRef?: {
|
package/dist/back.js
CHANGED
|
@@ -460,7 +460,8 @@ const buildToolHost = (requires, context) => {
|
|
|
460
460
|
nodes: context.nodes,
|
|
461
461
|
coreApi: ci.coreApi,
|
|
462
462
|
appsApi: ci.appsApi,
|
|
463
|
-
networkApi: ci.networkApi
|
|
463
|
+
networkApi: ci.networkApi,
|
|
464
|
+
crdApi: ci.crdApi
|
|
464
465
|
};
|
|
465
466
|
}
|
|
466
467
|
if (requires.includes(index_1.ECapability.METRICS))
|
package/dist/front.js
CHANGED
|
@@ -40,14 +40,14 @@ exports.ToolSelector = exports.AiConfigProvider = exports.AiConfigLlm = exports.
|
|
|
40
40
|
const react_1 = __importStar(require("react"));
|
|
41
41
|
const material_1 = require("@mui/material");
|
|
42
42
|
/*
|
|
43
|
-
DEEP IMPORTS
|
|
43
|
+
DEEP IMPORTS ON PURPOSE, this is not an oversight.
|
|
44
44
|
|
|
45
|
-
common-ai
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
common-ai is BUNDLED by the front end (webpack), and '@mui/icons-material' is a CommonJS barrel that
|
|
46
|
+
cannot be tree-shaken: importing from the root takes the ~2000 icons into the bundle. Measured: moving
|
|
47
|
+
these four lines to the root barrel put 1.62 MB on the front end's main.
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
That is why the "no deep imports" rule is only for PLUGINS — there it breaks @emotion, which loads a
|
|
50
|
+
copy of its own — and common-front and common-ai are the documented exception.
|
|
51
51
|
*/
|
|
52
52
|
const Download_1 = __importDefault(require("@mui/icons-material/Download"));
|
|
53
53
|
const Upload_1 = __importDefault(require("@mui/icons-material/Upload"));
|
|
@@ -198,11 +198,11 @@ 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(Upload_1.default, { fontSize: 'small' }), onClick: () => { var _a; return (_a = importLlmRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }, "Import"),
|
|
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"),
|
|
201
|
+
react_1.default.createElement(material_1.Button, { variant: 'outlined', 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
|
+
react_1.default.createElement(material_1.Button, { variant: 'outlined', 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"),
|
|
205
|
-
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(undefined),
|
|
205
|
+
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(undefined), variant: 'outlined' }, "Cancel"))));
|
|
206
206
|
};
|
|
207
207
|
exports.AiConfigLlm = AiConfigLlm;
|
|
208
208
|
const AiConfigProvider = (props) => {
|
|
@@ -327,11 +327,11 @@ 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(Upload_1.default, { fontSize: 'small' }), onClick: () => { var _a; return (_a = importProvRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }, "Import"),
|
|
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"),
|
|
330
|
+
react_1.default.createElement(material_1.Button, { variant: 'outlined', 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
|
+
react_1.default.createElement(material_1.Button, { variant: 'outlined', 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
|
-
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(providers),
|
|
334
|
-
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(undefined),
|
|
333
|
+
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(providers), variant: 'contained' }, "Save"),
|
|
334
|
+
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(undefined), variant: 'outlined' }, "Cancel"))));
|
|
335
335
|
};
|
|
336
336
|
exports.AiConfigProvider = AiConfigProvider;
|
|
337
337
|
const ToolSelector = ({ tools, selected, autoTools, disabled, onChange }) => (react_1.default.createElement(material_1.Stack, { direction: 'row', alignItems: 'flex-end', spacing: 1, sx: { width: '100%' } },
|