@kwirthmagnify/kwirth-common-ai 0.5.61 → 0.5.63
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 +76 -691
- package/dist/back.js +84 -1182
- package/dist/front.js +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +20 -20
- package/package.json +1 -1
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"));
|
|
@@ -95,9 +95,9 @@ const AiConfigLlm = (props) => {
|
|
|
95
95
|
const [key, setKey] = (0, react_1.useState)('');
|
|
96
96
|
const [inputCostPerMillion, setInputCostPerMillion] = (0, react_1.useState)(0);
|
|
97
97
|
const [outputCostPerMillion, setOutputCostPerMillion] = (0, react_1.useState)(0);
|
|
98
|
-
// Re-
|
|
99
|
-
//
|
|
100
|
-
//
|
|
98
|
+
// Re-syncs state when the models arrive asynchronously (same race fix as AiConfigProvider): on open,
|
|
99
|
+
// the parent mounts the dialog with props.llms empty and requests them over WS; without this, the list
|
|
100
|
+
// stayed empty until the dialog was closed and reopened.
|
|
101
101
|
(0, react_1.useEffect)(() => {
|
|
102
102
|
setLlms(JSON.parse(JSON.stringify(props.llms)));
|
|
103
103
|
setSelectedIndex(null);
|
package/dist/index.d.ts
CHANGED
|
@@ -38,37 +38,37 @@ export interface IAgent {
|
|
|
38
38
|
steps: number;
|
|
39
39
|
readOnly: boolean;
|
|
40
40
|
}
|
|
41
|
-
/**
|
|
41
|
+
/** What a tool does to the world. */
|
|
42
42
|
export declare enum EToolEffect {
|
|
43
43
|
READ = "read",
|
|
44
44
|
WRITE = "write"
|
|
45
45
|
}
|
|
46
46
|
export declare enum EToolSensitivity {
|
|
47
|
-
PUBLIC = "public",//
|
|
48
|
-
INTERNAL = "internal",//
|
|
47
|
+
PUBLIC = "public",// inventory, shapes, names
|
|
48
|
+
INTERNAL = "internal",// configuration, events, logs
|
|
49
49
|
SECRET = "secret"
|
|
50
50
|
}
|
|
51
51
|
export declare enum ECapability {
|
|
52
|
-
K8S = "k8s",//
|
|
53
|
-
METRICS = "metrics",//
|
|
54
|
-
EVENTS = "events",//
|
|
52
|
+
K8S = "k8s",// cluster access
|
|
53
|
+
METRICS = "metrics",// metrics, current and historical
|
|
54
|
+
EVENTS = "events",// cluster event buffer
|
|
55
55
|
REPOS = "repos"
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
57
|
+
/** Separator of a qualified reference to a tool: '<toolset>/<tool>'. */
|
|
58
58
|
export declare const TOOL_REF_SEPARATOR = "/";
|
|
59
59
|
export declare const toolRef: (toolsetId: string, toolName: string) => string;
|
|
60
60
|
export declare const parseToolRef: (ref: string) => {
|
|
61
61
|
toolsetId: string;
|
|
62
62
|
toolName: string;
|
|
63
63
|
} | undefined;
|
|
64
|
-
/**
|
|
64
|
+
/** A tool, without what it takes to run it. This is what travels to the front end. */
|
|
65
65
|
export interface IAiToolInfo {
|
|
66
66
|
name: string;
|
|
67
67
|
description: string;
|
|
68
68
|
effect: EToolEffect;
|
|
69
69
|
sensitivity: EToolSensitivity;
|
|
70
70
|
}
|
|
71
|
-
/**
|
|
71
|
+
/** A toolset, without what it takes to run its tools. This is what travels to the front end. */
|
|
72
72
|
export interface IAiToolsetInfo {
|
|
73
73
|
id: string;
|
|
74
74
|
version: string;
|
package/dist/index.js
CHANGED
|
@@ -6,46 +6,46 @@ exports.STORAGE_KEY_LLMS = 'kwirth-ai-llms';
|
|
|
6
6
|
exports.PROVIDERS_AVAILABLE = ['google', 'openai', 'openrouter', 'mistral', 'groq', 'deepseek', 'anthropic', 'openai-compat'];
|
|
7
7
|
exports.STORAGE_KEY_AGENTS = 'kwirth-ai-agents';
|
|
8
8
|
// ─────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
9
|
-
//
|
|
9
|
+
// AI toolset contract (plan: plans/ai-tools/PLAN.md, S1)
|
|
10
10
|
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
11
|
+
// The unit is the TOOLSET, not the tool: no tool is reachable outside one. To manage a single tool you
|
|
12
|
+
// package a toolset holding just that tool, and so the notion of a 'loose tool' does not exist in the
|
|
13
|
+
// model, in the configuration, or in the UI.
|
|
14
14
|
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
15
|
+
// What lives here is ISOMORPHIC: what it takes to DECIDE about a tool (show it, group it, authorize it,
|
|
16
|
+
// configure it). What it takes to RUN it — inputSchema and execute — lives in back.ts, because the front
|
|
17
|
+
// end neither needs it nor should load it.
|
|
18
18
|
// ─────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
19
|
-
/**
|
|
19
|
+
/** What a tool does to the world. */
|
|
20
20
|
var EToolEffect;
|
|
21
21
|
(function (EToolEffect) {
|
|
22
22
|
EToolEffect["READ"] = "read";
|
|
23
23
|
EToolEffect["WRITE"] = "write";
|
|
24
24
|
})(EToolEffect || (exports.EToolEffect = EToolEffect = {}));
|
|
25
|
-
//
|
|
26
|
-
// get_secret:
|
|
27
|
-
//
|
|
25
|
+
// What a tool EXPOSES, which is not the same as what it does to the world. The case that forces the split
|
|
26
|
+
// is get_secret: it reads Kubernetes Secrets, so it is READ and it is the most dangerous thing in the
|
|
27
|
+
// catalogue. With a single dimension there is no way to deny it without also denying 'list namespaces'.
|
|
28
28
|
var EToolSensitivity;
|
|
29
29
|
(function (EToolSensitivity) {
|
|
30
30
|
EToolSensitivity["PUBLIC"] = "public";
|
|
31
31
|
EToolSensitivity["INTERNAL"] = "internal";
|
|
32
|
-
EToolSensitivity["SECRET"] = "secret"; //
|
|
32
|
+
EToolSensitivity["SECRET"] = "secret"; // credentials and sensitive material
|
|
33
33
|
})(EToolSensitivity || (exports.EToolSensitivity = EToolSensitivity = {}));
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
34
|
+
// What a toolset needs from the host in order to work. The host provisions ONLY what was declared, which
|
|
35
|
+
// is what avoids today's catch-all (seven fields everyone receives just in case, with 'sourceRepos'
|
|
36
|
+
// existing for one single tool out of the 43).
|
|
37
37
|
var ECapability;
|
|
38
38
|
(function (ECapability) {
|
|
39
39
|
ECapability["K8S"] = "k8s";
|
|
40
40
|
ECapability["METRICS"] = "metrics";
|
|
41
41
|
ECapability["EVENTS"] = "events";
|
|
42
|
-
ECapability["REPOS"] = "repos"; //
|
|
42
|
+
ECapability["REPOS"] = "repos"; // source repository credentials
|
|
43
43
|
})(ECapability || (exports.ECapability = ECapability = {}));
|
|
44
|
-
/**
|
|
44
|
+
/** Separator of a qualified reference to a tool: '<toolset>/<tool>'. */
|
|
45
45
|
exports.TOOL_REF_SEPARATOR = '/';
|
|
46
|
-
// ⚠️
|
|
47
|
-
//
|
|
48
|
-
//
|
|
46
|
+
// ⚠️ A tool is ALWAYS referenced qualified by its toolset ('k8s-inventory/list_namespaces'), never by its
|
|
47
|
+
// bare name. This is what gets persisted in agent and ceiling configuration, so it cannot turn ambiguous
|
|
48
|
+
// the day two third-party toolsets both bring a 'get_pod_logs'.
|
|
49
49
|
const toolRef = (toolsetId, toolName) => `${toolsetId}${exports.TOOL_REF_SEPARATOR}${toolName}`;
|
|
50
50
|
exports.toolRef = toolRef;
|
|
51
51
|
const parseToolRef = (ref) => {
|