@kwirthmagnify/kwirth-common-ai 0.5.60 → 0.5.62
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 +81 -683
- package/dist/back.js +112 -1169
- package/dist/front.js +3 -3
- package/dist/index.d.ts +9 -9
- package/dist/index.js +20 -20
- package/package.json +1 -1
package/dist/back.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ILlm, ILlmProvider,
|
|
1
|
+
import { ILlm, ILlmProvider, ECapability, EToolEffect, EToolSensitivity, IAiToolInfo, IAiToolsetInfo, IToolsetConfig } from './index';
|
|
2
2
|
import type { AppsV1Api, CoreV1Api, NetworkingV1Api } from '@kubernetes/client-node';
|
|
3
3
|
interface ILogChannel {
|
|
4
4
|
logInfo?: (msg: string) => void;
|
|
5
5
|
logWarning?: (msg: string) => void;
|
|
6
6
|
logError?: (msg: string) => void;
|
|
7
7
|
}
|
|
8
|
-
import { LanguageModel,
|
|
8
|
+
import { LanguageModel, ToolSet } from 'ai';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
export declare const buildModel: (llm: ILlm, providers: ILlmProvider[]) => LanguageModel | null;
|
|
11
11
|
export interface IVisionResult<T> {
|
|
@@ -49,26 +49,21 @@ export interface IToolContext {
|
|
|
49
49
|
trace: (toolName: string, args: Record<string, unknown>) => void;
|
|
50
50
|
}
|
|
51
51
|
export { EToolEffect } from './index';
|
|
52
|
-
export interface IToolInfo {
|
|
53
|
-
name: string;
|
|
54
|
-
description: string;
|
|
55
|
-
effect: EToolEffect;
|
|
56
|
-
}
|
|
57
52
|
export declare const runWithToolContext: <T>(context: IToolContext, fn: () => Promise<T>) => Promise<T>;
|
|
58
|
-
/**
|
|
53
|
+
/** A cluster node, as a tool sees it. Compatible with the core's `INodeInfo`. */
|
|
59
54
|
export interface IK8sNodeInfo {
|
|
60
55
|
name: string;
|
|
61
56
|
ip: string;
|
|
62
57
|
maxPods: number;
|
|
63
58
|
}
|
|
64
|
-
/**
|
|
59
|
+
/** Access to Kubernetes (`ECapability.K8S`). */
|
|
65
60
|
export interface IK8sCapability {
|
|
66
|
-
/**
|
|
61
|
+
/** Cluster name, as Kwirth knows it. */
|
|
67
62
|
name: string;
|
|
68
|
-
/**
|
|
63
|
+
/** Detected flavour: aks, eks, gke, k3s, k3d… */
|
|
69
64
|
flavour: string;
|
|
70
65
|
vcpus: number;
|
|
71
|
-
/**
|
|
66
|
+
/** Total cluster memory, in bytes. */
|
|
72
67
|
memory: number;
|
|
73
68
|
nodes: Map<string, IK8sNodeInfo>;
|
|
74
69
|
coreApi: CoreV1Api;
|
|
@@ -105,12 +100,12 @@ export interface IMetricsNodeSample {
|
|
|
105
100
|
};
|
|
106
101
|
}
|
|
107
102
|
export interface IMetricsSample {
|
|
108
|
-
/**
|
|
103
|
+
/** Seconds between readings. Without it, a series of numbers says nothing about how fast time passes. */
|
|
109
104
|
metricsInterval?: number;
|
|
110
105
|
cluster: {
|
|
111
106
|
vcpus: number;
|
|
112
107
|
memory: number;
|
|
113
|
-
/**
|
|
108
|
+
/** Percentages, 0-100. */
|
|
114
109
|
cpuUsage: number;
|
|
115
110
|
memoryUsage: number;
|
|
116
111
|
txmbps: number;
|
|
@@ -118,60 +113,61 @@ export interface IMetricsSample {
|
|
|
118
113
|
};
|
|
119
114
|
nodes: IMetricsNodeSample[];
|
|
120
115
|
}
|
|
121
|
-
/**
|
|
116
|
+
/** Cluster metrics (`ECapability.METRICS`). */
|
|
122
117
|
export interface IMetricsCapability {
|
|
123
|
-
/**
|
|
118
|
+
/** Samples the core keeps in memory. The most recent one last. */
|
|
124
119
|
samples: IMetricsSample[];
|
|
125
120
|
}
|
|
126
121
|
/**
|
|
127
|
-
*
|
|
128
|
-
* `obj`
|
|
129
|
-
*
|
|
122
|
+
* One entry of the core's event buffer: the kind of change and the object exactly as it came from the API.
|
|
123
|
+
* `obj` is left generic on purpose — kube Events and objects of any kind fit in there — but typed as an
|
|
124
|
+
* object rather than as `any`: whoever reads it must check `kind` before believing anything.
|
|
130
125
|
*/
|
|
131
126
|
export interface IClusterEvent {
|
|
132
|
-
/** ADDED | MODIFIED | DELETED
|
|
127
|
+
/** ADDED | MODIFIED | DELETED for object changes; kube Events travel through here too. */
|
|
133
128
|
type?: string;
|
|
134
129
|
obj?: Record<string, any>;
|
|
135
130
|
}
|
|
136
|
-
/**
|
|
131
|
+
/** Recent cluster events (`ECapability.EVENTS`). */
|
|
137
132
|
export interface IEventsCapability {
|
|
138
|
-
/** Buffer
|
|
133
|
+
/** Buffer the core keeps accumulating. The most recent one last. */
|
|
139
134
|
recent: IClusterEvent[];
|
|
140
135
|
}
|
|
141
|
-
/**
|
|
136
|
+
/** Source repository credentials (`ECapability.REPOS`). */
|
|
142
137
|
export interface IReposCapability {
|
|
143
138
|
creds: ISourceRepoCred[];
|
|
144
139
|
}
|
|
145
140
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
141
|
+
* What a tool receives when it runs. Only the capabilities its toolset declared come filled in:
|
|
142
|
+
* a `requires: []` receives nothing but `trace`.
|
|
148
143
|
*/
|
|
149
144
|
export interface IToolHost {
|
|
150
|
-
/**
|
|
145
|
+
/** Records the invocation. NOT a capability: it is always lent, and never declared. */
|
|
151
146
|
trace: (toolName: string, args: Record<string, unknown>) => void;
|
|
152
147
|
k8s?: IK8sCapability;
|
|
153
148
|
metrics?: IMetricsCapability;
|
|
154
149
|
events?: IEventsCapability;
|
|
155
150
|
repos?: IReposCapability;
|
|
156
151
|
}
|
|
157
|
-
/**
|
|
152
|
+
/** An executable tool: what travels to the front end (IAiToolInfo) plus what it takes to invoke it. */
|
|
158
153
|
export interface IAiTool extends IAiToolInfo {
|
|
159
154
|
inputSchema: z.ZodTypeAny;
|
|
160
155
|
execute: (args: Record<string, unknown>, host: IToolHost) => Promise<unknown>;
|
|
161
156
|
}
|
|
162
|
-
/**
|
|
157
|
+
/** An executable toolset: its descriptor (IAiToolsetInfo) with the real tools inside. */
|
|
163
158
|
export interface IAiToolset extends Omit<IAiToolsetInfo, 'tools'> {
|
|
164
159
|
tools: IAiTool[];
|
|
165
160
|
}
|
|
166
161
|
/**
|
|
167
|
-
*
|
|
162
|
+
* Declares a tool, inferring the type of its arguments FROM its own `inputSchema`.
|
|
168
163
|
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* no
|
|
164
|
+
* Without this, `execute` receives `Record<string, unknown>` and every tool fills up with
|
|
165
|
+
* `String(args.namespace)` and loose casts: thirty tools like that are thirty places to go wrong in
|
|
166
|
+
* silence, with no help from the compiler. With this, the schema is the single source of truth and `args`
|
|
167
|
+
* arrives typed.
|
|
172
168
|
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
169
|
+
* The registry still stores the loose type (`IAiTool`): whoever invokes it does not know the schema, and
|
|
170
|
+
* there the check is done by zod at run time, as it should be.
|
|
175
171
|
*/
|
|
176
172
|
export declare const defineTool: <S extends z.ZodTypeAny>(definition: {
|
|
177
173
|
name: string;
|
|
@@ -182,68 +178,82 @@ export declare const defineTool: <S extends z.ZodTypeAny>(definition: {
|
|
|
182
178
|
execute: (args: z.infer<S>, host: IToolHost) => Promise<unknown>;
|
|
183
179
|
}) => IAiTool;
|
|
184
180
|
export declare const isBuiltInToolsetId: (id: string) => boolean;
|
|
181
|
+
/** Grants a toolset to a list of plugins. Replaces the previous grant; `[]` takes it away from everyone. */
|
|
182
|
+
export declare const setToolsetGrants: (toolsetId: string, pluginIds: string[]) => void;
|
|
183
|
+
/** Who a toolset is granted to. Empty = nobody, which is the default state. */
|
|
184
|
+
export declare const getToolsetGrants: (toolsetId: string) => string[];
|
|
185
|
+
/** Whether THAT plugin may use THAT toolset. */
|
|
186
|
+
export declare const isToolsetGrantedTo: (toolsetId: string, pluginId: string) => boolean;
|
|
185
187
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
188
|
+
* Registers a toolset. `builtIn` is only used by the core for its own: it marks the id as reserved.
|
|
189
|
+
* Throws if the id is already taken — registering the same id twice is a packaging error, not something
|
|
190
|
+
* to be resolved silently by overwriting the first one.
|
|
189
191
|
*/
|
|
190
192
|
export declare const registerToolset: (toolset: IAiToolset, builtIn?: boolean) => void;
|
|
191
|
-
/**
|
|
193
|
+
/** Removes a toolset from the registry (uninstall). Built-in ones are never removed. */
|
|
192
194
|
export declare const unregisterToolset: (id: string) => boolean;
|
|
193
195
|
export declare const getToolset: (id: string) => IAiToolset | undefined;
|
|
194
196
|
export declare const listToolsets: () => IAiToolset[];
|
|
195
|
-
/**
|
|
197
|
+
/** What is sent to the front end: the descriptors, without inputSchema or execute. */
|
|
196
198
|
export declare const listToolsetInfos: () => IAiToolsetInfo[];
|
|
197
199
|
/**
|
|
198
|
-
*
|
|
200
|
+
* Builds a toolset's host from the core context, provisioning ONLY what was declared.
|
|
199
201
|
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
202
|
+
* Doing the handing-out here and not at each call site is what makes the `ECapability` promise keepable:
|
|
203
|
+
* if every site assembled its own object, one of them being too generous would be enough for the
|
|
204
|
+
* declaration to stop meaning anything.
|
|
203
205
|
*/
|
|
204
206
|
export declare const buildToolHost: (requires: ECapability[], context: IToolContext) => IToolHost;
|
|
205
207
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
+
* Invokes a tool by its qualified reference. A single invocation path for built-in and installed alike,
|
|
209
|
+
* with the host built according to the `requires` of ITS toolset.
|
|
208
210
|
*/
|
|
209
211
|
export declare const invokeToolRef: (ref: string, args: Record<string, unknown>, context: IToolContext) => Promise<unknown>;
|
|
210
|
-
/**
|
|
212
|
+
/** Resolves a qualified reference '<toolset>/<tool>' against the registry. */
|
|
211
213
|
export declare const resolveToolRef: (ref: string) => {
|
|
212
214
|
toolset: IAiToolset;
|
|
213
215
|
tool: IAiTool;
|
|
214
216
|
} | undefined;
|
|
215
|
-
/**
|
|
217
|
+
/** A tool that IS offered to the model. */
|
|
216
218
|
export interface IEffectiveTool {
|
|
217
|
-
/**
|
|
219
|
+
/** The short name: what travels to the LLM. */
|
|
218
220
|
name: string;
|
|
219
|
-
/**
|
|
221
|
+
/** The qualified reference: what gets persisted. */
|
|
220
222
|
ref: string;
|
|
221
223
|
toolsetId: string;
|
|
222
224
|
tool: IAiTool;
|
|
223
225
|
}
|
|
224
|
-
/**
|
|
226
|
+
/** A tool that exists but is NOT offered, because a toolset with higher precedence carries that name. */
|
|
225
227
|
export interface IShadowedTool {
|
|
226
228
|
name: string;
|
|
227
229
|
ref: string;
|
|
228
230
|
toolsetId: string;
|
|
229
|
-
/**
|
|
231
|
+
/** Who shadows it. The editor must say so: otherwise turning this one off looks like it does something. */
|
|
230
232
|
shadowedBy: string;
|
|
231
233
|
}
|
|
232
234
|
export interface IToolResolution {
|
|
233
235
|
effective: IEffectiveTool[];
|
|
234
236
|
shadowed: IShadowedTool[];
|
|
235
|
-
/**
|
|
237
|
+
/** Assigned toolsets that are not registered (uninstalled, or never installed). */
|
|
236
238
|
missing: string[];
|
|
239
|
+
/**
|
|
240
|
+
* Toolsets that ARE installed but have not been granted to this plugin.
|
|
241
|
+
*
|
|
242
|
+
* Reported apart from `missing` on purpose: "it is not installed" the admin fixes by installing it, and
|
|
243
|
+
* "it has not been granted to you" the admin fixes by granting it. Lumping them together sends the admin
|
|
244
|
+
* looking in the wrong place.
|
|
245
|
+
*/
|
|
246
|
+
notGranted: string[];
|
|
237
247
|
}
|
|
238
248
|
/**
|
|
239
|
-
*
|
|
240
|
-
* editor
|
|
249
|
+
* Applies a client's ceiling over the registry. Pure: it neither executes nor touches the context, so the
|
|
250
|
+
* editor can call it to DRAW exactly what is going to run.
|
|
241
251
|
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
252
|
+
* A disabled tool does not shadow: what gets disabled is a concrete reference ('ts1/td'), not a name, so if
|
|
253
|
+
* `ts1/td` is off and `ts2` carries another `td`, the one from `ts2` surfaces.
|
|
244
254
|
*/
|
|
245
|
-
export declare const resolveTools: (config: IToolsetConfig) => IToolResolution;
|
|
246
|
-
/**
|
|
255
|
+
export declare const resolveTools: (config: IToolsetConfig, requesterId?: string) => IToolResolution;
|
|
256
|
+
/** One concrete invocation, as the two hooks see it. */
|
|
247
257
|
export interface IToolInvocation {
|
|
248
258
|
ref: string;
|
|
249
259
|
toolsetId: string;
|
|
@@ -252,644 +262,34 @@ export interface IToolInvocation {
|
|
|
252
262
|
}
|
|
253
263
|
export interface IToolAuthorization {
|
|
254
264
|
allowed: boolean;
|
|
255
|
-
/**
|
|
265
|
+
/** Why not. It travels to the model, so it is written so the model can decide otherwise. */
|
|
256
266
|
reason?: string;
|
|
257
267
|
}
|
|
258
|
-
/**
|
|
268
|
+
/** How an invocation ended. `ms` included: a slow tool is a problem even when it returns correctly. */
|
|
259
269
|
export interface IToolOutcome {
|
|
260
270
|
ok: boolean;
|
|
261
271
|
result?: unknown;
|
|
262
272
|
error?: string;
|
|
263
273
|
ms: number;
|
|
264
|
-
/**
|
|
274
|
+
/** Whether it never ran at all, because of the authorisation hook. */
|
|
265
275
|
denied?: boolean;
|
|
266
276
|
}
|
|
267
277
|
export interface IAgentToolHooks {
|
|
268
|
-
/**
|
|
278
|
+
/** BEFORE running. With no hook, everything is allowed: today the ceiling is the selection (S4 fills it). */
|
|
269
279
|
authorize?: (invocation: IToolInvocation, tool: IAiTool) => IToolAuthorization | Promise<IToolAuthorization>;
|
|
270
|
-
/**
|
|
280
|
+
/** AFTER, whatever happened. It cannot break the invocation (S6 fills it). */
|
|
271
281
|
observe?: (invocation: IToolInvocation, outcome: IToolOutcome) => void;
|
|
272
282
|
}
|
|
273
283
|
/**
|
|
274
|
-
*
|
|
275
|
-
*
|
|
284
|
+
* The tools ready to hand to the AI SDK, already resolved by precedence and with both hooks in place.
|
|
285
|
+
* The object key is the SHORT name, which is the only thing the provider accepts.
|
|
276
286
|
*/
|
|
277
|
-
export declare const buildAgentTools: (config: IToolsetConfig, context: IToolContext, hooks?: IAgentToolHooks
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
error: any;
|
|
284
|
-
namespaces?: undefined;
|
|
285
|
-
}>;
|
|
286
|
-
readonly get_node_data: Tool<Record<string, never>, any>;
|
|
287
|
-
readonly get_cluster_data: Tool<Record<string, never>, {
|
|
288
|
-
name: any;
|
|
289
|
-
flavour: any;
|
|
290
|
-
vcpus: any;
|
|
291
|
-
memoryGB: number;
|
|
292
|
-
nodeCount: any;
|
|
293
|
-
nodes: any;
|
|
294
|
-
error?: undefined;
|
|
295
|
-
} | {
|
|
296
|
-
error: any;
|
|
297
|
-
name?: undefined;
|
|
298
|
-
flavour?: undefined;
|
|
299
|
-
vcpus?: undefined;
|
|
300
|
-
memoryGB?: undefined;
|
|
301
|
-
nodeCount?: undefined;
|
|
302
|
-
nodes?: undefined;
|
|
303
|
-
}>;
|
|
304
|
-
readonly get_workload_data: Tool<{
|
|
305
|
-
namespace?: string | undefined;
|
|
306
|
-
}, {
|
|
307
|
-
deployments: any;
|
|
308
|
-
statefulSets: any;
|
|
309
|
-
daemonSets: any;
|
|
310
|
-
pods: any;
|
|
311
|
-
services: any;
|
|
312
|
-
error?: undefined;
|
|
313
|
-
} | {
|
|
314
|
-
error: any;
|
|
315
|
-
deployments?: undefined;
|
|
316
|
-
statefulSets?: undefined;
|
|
317
|
-
daemonSets?: undefined;
|
|
318
|
-
pods?: undefined;
|
|
319
|
-
services?: undefined;
|
|
320
|
-
}>;
|
|
321
|
-
readonly get_space_data: Tool<{
|
|
322
|
-
namespace: string;
|
|
323
|
-
}, {
|
|
324
|
-
namespace: string;
|
|
325
|
-
status: any;
|
|
326
|
-
labels: any;
|
|
327
|
-
resourceQuotas: any;
|
|
328
|
-
limitRanges: any;
|
|
329
|
-
pods: any;
|
|
330
|
-
deployments: any;
|
|
331
|
-
services: any;
|
|
332
|
-
configMaps: any;
|
|
333
|
-
error?: undefined;
|
|
334
|
-
} | {
|
|
335
|
-
error: any;
|
|
336
|
-
namespace?: undefined;
|
|
337
|
-
status?: undefined;
|
|
338
|
-
labels?: undefined;
|
|
339
|
-
resourceQuotas?: undefined;
|
|
340
|
-
limitRanges?: undefined;
|
|
341
|
-
pods?: undefined;
|
|
342
|
-
deployments?: undefined;
|
|
343
|
-
services?: undefined;
|
|
344
|
-
configMaps?: undefined;
|
|
345
|
-
}>;
|
|
346
|
-
readonly get_namespace_yaml: Tool<{
|
|
347
|
-
name: string;
|
|
348
|
-
}, any>;
|
|
349
|
-
readonly describe_service: Tool<{
|
|
350
|
-
namespace: string;
|
|
351
|
-
name: string;
|
|
352
|
-
}, {
|
|
353
|
-
name: string;
|
|
354
|
-
namespace: string;
|
|
355
|
-
type: any;
|
|
356
|
-
clusterIP: any;
|
|
357
|
-
externalIPs: any;
|
|
358
|
-
loadBalancer: any;
|
|
359
|
-
sessionAffinity: any;
|
|
360
|
-
selector: any;
|
|
361
|
-
ports: any;
|
|
362
|
-
endpoints: any;
|
|
363
|
-
endpointCount: any;
|
|
364
|
-
error?: undefined;
|
|
365
|
-
} | {
|
|
366
|
-
error: any;
|
|
367
|
-
name?: undefined;
|
|
368
|
-
namespace?: undefined;
|
|
369
|
-
type?: undefined;
|
|
370
|
-
clusterIP?: undefined;
|
|
371
|
-
externalIPs?: undefined;
|
|
372
|
-
loadBalancer?: undefined;
|
|
373
|
-
sessionAffinity?: undefined;
|
|
374
|
-
selector?: undefined;
|
|
375
|
-
ports?: undefined;
|
|
376
|
-
endpoints?: undefined;
|
|
377
|
-
endpointCount?: undefined;
|
|
378
|
-
}>;
|
|
379
|
-
readonly describe_ingress: Tool<{
|
|
380
|
-
namespace: string;
|
|
381
|
-
name: string;
|
|
382
|
-
}, {
|
|
383
|
-
name: string;
|
|
384
|
-
namespace: string;
|
|
385
|
-
ingressClass: any;
|
|
386
|
-
defaultBackend: string | undefined;
|
|
387
|
-
rules: any;
|
|
388
|
-
tls: any;
|
|
389
|
-
loadBalancer: any;
|
|
390
|
-
error?: undefined;
|
|
391
|
-
} | {
|
|
392
|
-
error: any;
|
|
393
|
-
name?: undefined;
|
|
394
|
-
namespace?: undefined;
|
|
395
|
-
ingressClass?: undefined;
|
|
396
|
-
defaultBackend?: undefined;
|
|
397
|
-
rules?: undefined;
|
|
398
|
-
tls?: undefined;
|
|
399
|
-
loadBalancer?: undefined;
|
|
400
|
-
}>;
|
|
401
|
-
readonly describe_controller: Tool<{
|
|
402
|
-
namespace: string;
|
|
403
|
-
kind: "Deployment" | "StatefulSet" | "DaemonSet" | "ReplicaSet";
|
|
404
|
-
name: string;
|
|
405
|
-
}, {
|
|
406
|
-
kind: "Deployment" | "StatefulSet" | "DaemonSet" | "ReplicaSet";
|
|
407
|
-
name: string;
|
|
408
|
-
namespace: string;
|
|
409
|
-
replicas: {
|
|
410
|
-
desired: any;
|
|
411
|
-
current: any;
|
|
412
|
-
ready: any;
|
|
413
|
-
available: any;
|
|
414
|
-
updated: any;
|
|
415
|
-
} | {
|
|
416
|
-
desired: any;
|
|
417
|
-
ready: any;
|
|
418
|
-
available: any;
|
|
419
|
-
updated: any;
|
|
420
|
-
current?: undefined;
|
|
421
|
-
};
|
|
422
|
-
strategy: any;
|
|
423
|
-
conditions: any;
|
|
424
|
-
selector: any;
|
|
425
|
-
template: {
|
|
426
|
-
containers: any;
|
|
427
|
-
initContainers: any;
|
|
428
|
-
serviceAccount: any;
|
|
429
|
-
};
|
|
430
|
-
error?: undefined;
|
|
431
|
-
} | {
|
|
432
|
-
error: any;
|
|
433
|
-
kind?: undefined;
|
|
434
|
-
name?: undefined;
|
|
435
|
-
namespace?: undefined;
|
|
436
|
-
replicas?: undefined;
|
|
437
|
-
strategy?: undefined;
|
|
438
|
-
conditions?: undefined;
|
|
439
|
-
selector?: undefined;
|
|
440
|
-
template?: undefined;
|
|
441
|
-
}>;
|
|
442
|
-
readonly get_service_yaml: Tool<{
|
|
443
|
-
namespace: string;
|
|
444
|
-
name: string;
|
|
445
|
-
}, any>;
|
|
446
|
-
readonly list_services: Tool<{
|
|
447
|
-
namespace?: string | undefined;
|
|
448
|
-
}, {
|
|
449
|
-
services: any;
|
|
450
|
-
error?: undefined;
|
|
451
|
-
} | {
|
|
452
|
-
error: any;
|
|
453
|
-
services?: undefined;
|
|
454
|
-
}>;
|
|
455
|
-
readonly list_ingresses: Tool<{
|
|
456
|
-
namespace?: string | undefined;
|
|
457
|
-
}, {
|
|
458
|
-
ingresses: any;
|
|
459
|
-
error?: undefined;
|
|
460
|
-
} | {
|
|
461
|
-
error: any;
|
|
462
|
-
ingresses?: undefined;
|
|
463
|
-
}>;
|
|
464
|
-
readonly get_ingress_yaml: Tool<{
|
|
465
|
-
namespace: string;
|
|
466
|
-
name: string;
|
|
467
|
-
}, any>;
|
|
468
|
-
readonly get_cluster_usage: Tool<Record<string, never>, {
|
|
469
|
-
error: string;
|
|
470
|
-
vcpus?: undefined;
|
|
471
|
-
memoryGB?: undefined;
|
|
472
|
-
cpuUsagePercent?: undefined;
|
|
473
|
-
memoryUsagePercent?: undefined;
|
|
474
|
-
networkTxMbps?: undefined;
|
|
475
|
-
networkRxMbps?: undefined;
|
|
476
|
-
metricsIntervalSeconds?: undefined;
|
|
477
|
-
} | {
|
|
478
|
-
vcpus: any;
|
|
479
|
-
memoryGB: number;
|
|
480
|
-
cpuUsagePercent: number;
|
|
481
|
-
memoryUsagePercent: number;
|
|
482
|
-
networkTxMbps: number;
|
|
483
|
-
networkRxMbps: number;
|
|
484
|
-
metricsIntervalSeconds: any;
|
|
485
|
-
error?: undefined;
|
|
486
|
-
}>;
|
|
487
|
-
readonly get_node_usage: Tool<{
|
|
488
|
-
nodeName?: string | undefined;
|
|
489
|
-
}, any>;
|
|
490
|
-
readonly get_deployment_usage: Tool<{
|
|
491
|
-
namespace: string;
|
|
492
|
-
name: string;
|
|
493
|
-
}, {
|
|
494
|
-
deployment: string;
|
|
495
|
-
namespace: string;
|
|
496
|
-
podCount: number;
|
|
497
|
-
cpuMillicores: number;
|
|
498
|
-
memoryMB: number;
|
|
499
|
-
timestamp: any;
|
|
500
|
-
error?: undefined;
|
|
501
|
-
} | {
|
|
502
|
-
error: any;
|
|
503
|
-
deployment?: undefined;
|
|
504
|
-
namespace?: undefined;
|
|
505
|
-
podCount?: undefined;
|
|
506
|
-
cpuMillicores?: undefined;
|
|
507
|
-
memoryMB?: undefined;
|
|
508
|
-
timestamp?: undefined;
|
|
509
|
-
}>;
|
|
510
|
-
readonly get_prev_cluster_usage: Tool<{
|
|
511
|
-
count?: number | undefined;
|
|
512
|
-
}, {
|
|
513
|
-
vcpus: any;
|
|
514
|
-
memoryGB: number;
|
|
515
|
-
cpuUsagePercent: number;
|
|
516
|
-
memoryUsagePercent: number;
|
|
517
|
-
networkTxMbps: number;
|
|
518
|
-
networkRxMbps: number;
|
|
519
|
-
}[] | {
|
|
520
|
-
error: string;
|
|
521
|
-
}>;
|
|
522
|
-
readonly get_prev_node_usage: Tool<{
|
|
523
|
-
nodeName?: string | undefined;
|
|
524
|
-
count?: number | undefined;
|
|
525
|
-
}, {
|
|
526
|
-
nodes: any;
|
|
527
|
-
}[] | {
|
|
528
|
-
error: string;
|
|
529
|
-
}>;
|
|
530
|
-
readonly get_prev_deployment_usage: Tool<{
|
|
531
|
-
namespace: string;
|
|
532
|
-
name: string;
|
|
533
|
-
count?: number | undefined;
|
|
534
|
-
}, {
|
|
535
|
-
deployment: string;
|
|
536
|
-
namespace: string;
|
|
537
|
-
podCount: number;
|
|
538
|
-
cpuMillicores: number;
|
|
539
|
-
memoryMB: number;
|
|
540
|
-
timestamp: any;
|
|
541
|
-
}[] | {
|
|
542
|
-
error: any;
|
|
543
|
-
}>;
|
|
544
|
-
readonly get_prev_space_data: Tool<{
|
|
545
|
-
namespace: string;
|
|
546
|
-
count?: number | undefined;
|
|
547
|
-
}, {
|
|
548
|
-
namespace: string;
|
|
549
|
-
podCount: number;
|
|
550
|
-
cpuMillicores: number;
|
|
551
|
-
memoryMB: number;
|
|
552
|
-
timestamp: any;
|
|
553
|
-
}[] | {
|
|
554
|
-
error: string;
|
|
555
|
-
}>;
|
|
556
|
-
readonly add_node: Tool<{
|
|
557
|
-
nodeName?: string | undefined;
|
|
558
|
-
nodePoolName?: string | undefined;
|
|
559
|
-
}, {
|
|
560
|
-
success: boolean;
|
|
561
|
-
message: string;
|
|
562
|
-
stdout: string;
|
|
563
|
-
stderr: string;
|
|
564
|
-
error?: undefined;
|
|
565
|
-
} | {
|
|
566
|
-
success: boolean;
|
|
567
|
-
error: any;
|
|
568
|
-
message?: undefined;
|
|
569
|
-
stdout?: undefined;
|
|
570
|
-
stderr?: undefined;
|
|
571
|
-
} | {
|
|
572
|
-
success: boolean;
|
|
573
|
-
message: string;
|
|
574
|
-
stdout?: undefined;
|
|
575
|
-
stderr?: undefined;
|
|
576
|
-
error?: undefined;
|
|
577
|
-
}>;
|
|
578
|
-
readonly remove_node: Tool<{
|
|
579
|
-
nodeName: string;
|
|
580
|
-
nodePoolName?: string | undefined;
|
|
581
|
-
}, {
|
|
582
|
-
success: boolean;
|
|
583
|
-
message: string;
|
|
584
|
-
stdout: string;
|
|
585
|
-
stderr: string;
|
|
586
|
-
error?: undefined;
|
|
587
|
-
} | {
|
|
588
|
-
success: boolean;
|
|
589
|
-
error: any;
|
|
590
|
-
message?: undefined;
|
|
591
|
-
stdout?: undefined;
|
|
592
|
-
stderr?: undefined;
|
|
593
|
-
} | {
|
|
594
|
-
success: boolean;
|
|
595
|
-
message: string;
|
|
596
|
-
stdout?: undefined;
|
|
597
|
-
stderr?: undefined;
|
|
598
|
-
error?: undefined;
|
|
599
|
-
}>;
|
|
600
|
-
readonly stop_node: Tool<{
|
|
601
|
-
nodeName: string;
|
|
602
|
-
}, {
|
|
603
|
-
success: boolean;
|
|
604
|
-
error: string;
|
|
605
|
-
message?: undefined;
|
|
606
|
-
stdout?: undefined;
|
|
607
|
-
stderr?: undefined;
|
|
608
|
-
} | {
|
|
609
|
-
success: boolean;
|
|
610
|
-
message: string;
|
|
611
|
-
error?: undefined;
|
|
612
|
-
stdout?: undefined;
|
|
613
|
-
stderr?: undefined;
|
|
614
|
-
} | {
|
|
615
|
-
success: boolean;
|
|
616
|
-
message: string;
|
|
617
|
-
stdout: string;
|
|
618
|
-
stderr: string;
|
|
619
|
-
error?: undefined;
|
|
620
|
-
}>;
|
|
621
|
-
readonly start_node: Tool<{
|
|
622
|
-
nodeName: string;
|
|
623
|
-
}, {
|
|
624
|
-
success: boolean;
|
|
625
|
-
message: string;
|
|
626
|
-
stdout: string;
|
|
627
|
-
stderr: string;
|
|
628
|
-
error?: undefined;
|
|
629
|
-
} | {
|
|
630
|
-
success: boolean;
|
|
631
|
-
error: any;
|
|
632
|
-
message?: undefined;
|
|
633
|
-
stdout?: undefined;
|
|
634
|
-
stderr?: undefined;
|
|
635
|
-
} | {
|
|
636
|
-
success: boolean;
|
|
637
|
-
message: string;
|
|
638
|
-
stdout?: undefined;
|
|
639
|
-
stderr?: undefined;
|
|
640
|
-
error?: undefined;
|
|
641
|
-
}>;
|
|
642
|
-
readonly add_replica: Tool<{
|
|
643
|
-
namespace: string;
|
|
644
|
-
name: string;
|
|
645
|
-
}, {
|
|
646
|
-
success: boolean;
|
|
647
|
-
message: string;
|
|
648
|
-
error?: undefined;
|
|
649
|
-
} | {
|
|
650
|
-
success: boolean;
|
|
651
|
-
error: any;
|
|
652
|
-
message?: undefined;
|
|
653
|
-
}>;
|
|
654
|
-
readonly remove_replica: Tool<{
|
|
655
|
-
namespace: string;
|
|
656
|
-
name: string;
|
|
657
|
-
}, {
|
|
658
|
-
success: boolean;
|
|
659
|
-
message: string;
|
|
660
|
-
error?: undefined;
|
|
661
|
-
} | {
|
|
662
|
-
success: boolean;
|
|
663
|
-
error: any;
|
|
664
|
-
message?: undefined;
|
|
665
|
-
}>;
|
|
666
|
-
readonly restart_deployment: Tool<{
|
|
667
|
-
namespace: string;
|
|
668
|
-
name: string;
|
|
669
|
-
}, {
|
|
670
|
-
success: boolean;
|
|
671
|
-
message: string;
|
|
672
|
-
error?: undefined;
|
|
673
|
-
} | {
|
|
674
|
-
success: boolean;
|
|
675
|
-
error: any;
|
|
676
|
-
message?: undefined;
|
|
677
|
-
}>;
|
|
678
|
-
readonly delete_pod: Tool<{
|
|
679
|
-
namespace: string;
|
|
680
|
-
name: string;
|
|
681
|
-
}, {
|
|
682
|
-
success: boolean;
|
|
683
|
-
message: string;
|
|
684
|
-
error?: undefined;
|
|
685
|
-
} | {
|
|
686
|
-
success: boolean;
|
|
687
|
-
error: any;
|
|
688
|
-
message?: undefined;
|
|
689
|
-
}>;
|
|
690
|
-
readonly times_two: Tool<{
|
|
691
|
-
data: number;
|
|
692
|
-
}, number>;
|
|
693
|
-
readonly father_of: Tool<{
|
|
694
|
-
data: string;
|
|
695
|
-
}, string>;
|
|
696
|
-
readonly get_certificate_info: Tool<{
|
|
697
|
-
hostname: string;
|
|
698
|
-
port?: number | undefined;
|
|
699
|
-
}, unknown>;
|
|
700
|
-
readonly get_cluster_events: Tool<{
|
|
701
|
-
warningsOnly?: boolean | undefined;
|
|
702
|
-
namespace?: string | undefined;
|
|
703
|
-
limit?: number | undefined;
|
|
704
|
-
}, {
|
|
705
|
-
count: number;
|
|
706
|
-
events: Record<string, unknown>[];
|
|
707
|
-
}>;
|
|
708
|
-
readonly get_object_events: Tool<{
|
|
709
|
-
namespace: string;
|
|
710
|
-
name: string;
|
|
711
|
-
}, {
|
|
712
|
-
count: number;
|
|
713
|
-
events: Record<string, unknown>[];
|
|
714
|
-
}>;
|
|
715
|
-
readonly get_pod_logs: Tool<{
|
|
716
|
-
namespace: string;
|
|
717
|
-
name: string;
|
|
718
|
-
container?: string | undefined;
|
|
719
|
-
previous?: boolean | undefined;
|
|
720
|
-
tailLines?: number | undefined;
|
|
721
|
-
}, {
|
|
722
|
-
namespace: string;
|
|
723
|
-
name: string;
|
|
724
|
-
container: string | null;
|
|
725
|
-
previous: boolean;
|
|
726
|
-
truncated: boolean;
|
|
727
|
-
logs: string;
|
|
728
|
-
error?: undefined;
|
|
729
|
-
} | {
|
|
730
|
-
error: any;
|
|
731
|
-
namespace?: undefined;
|
|
732
|
-
name?: undefined;
|
|
733
|
-
container?: undefined;
|
|
734
|
-
previous?: undefined;
|
|
735
|
-
truncated?: undefined;
|
|
736
|
-
logs?: undefined;
|
|
737
|
-
}>;
|
|
738
|
-
readonly describe_pod: Tool<{
|
|
739
|
-
namespace: string;
|
|
740
|
-
name: string;
|
|
741
|
-
}, {
|
|
742
|
-
name: string;
|
|
743
|
-
namespace: string;
|
|
744
|
-
phase: any;
|
|
745
|
-
node: any;
|
|
746
|
-
startTime: any;
|
|
747
|
-
reason: any;
|
|
748
|
-
message: any;
|
|
749
|
-
controlledBy: any;
|
|
750
|
-
source: {
|
|
751
|
-
repo: any;
|
|
752
|
-
revision: any;
|
|
753
|
-
} | undefined;
|
|
754
|
-
conditions: any;
|
|
755
|
-
containers: any;
|
|
756
|
-
initContainers: any;
|
|
757
|
-
spec: {
|
|
758
|
-
containers: any;
|
|
759
|
-
restartPolicy: any;
|
|
760
|
-
};
|
|
761
|
-
error?: undefined;
|
|
762
|
-
} | {
|
|
763
|
-
error: any;
|
|
764
|
-
name?: undefined;
|
|
765
|
-
namespace?: undefined;
|
|
766
|
-
phase?: undefined;
|
|
767
|
-
node?: undefined;
|
|
768
|
-
startTime?: undefined;
|
|
769
|
-
reason?: undefined;
|
|
770
|
-
message?: undefined;
|
|
771
|
-
controlledBy?: undefined;
|
|
772
|
-
source?: undefined;
|
|
773
|
-
conditions?: undefined;
|
|
774
|
-
containers?: undefined;
|
|
775
|
-
initContainers?: undefined;
|
|
776
|
-
spec?: undefined;
|
|
777
|
-
}>;
|
|
778
|
-
readonly get_pod_yaml: Tool<{
|
|
779
|
-
namespace: string;
|
|
780
|
-
name: string;
|
|
781
|
-
}, any>;
|
|
782
|
-
readonly get_deployment_yaml: Tool<{
|
|
783
|
-
namespace: string;
|
|
784
|
-
name: string;
|
|
785
|
-
}, any>;
|
|
786
|
-
readonly get_controller_yaml: Tool<{
|
|
787
|
-
namespace: string;
|
|
788
|
-
kind: "Deployment" | "StatefulSet" | "DaemonSet" | "ReplicaSet";
|
|
789
|
-
name: string;
|
|
790
|
-
}, any>;
|
|
791
|
-
readonly get_rollout_history: Tool<{
|
|
792
|
-
namespace: string;
|
|
793
|
-
name: string;
|
|
794
|
-
}, {
|
|
795
|
-
deployment: string;
|
|
796
|
-
namespace: string;
|
|
797
|
-
revisionCount: any;
|
|
798
|
-
revisions: any;
|
|
799
|
-
error?: undefined;
|
|
800
|
-
} | {
|
|
801
|
-
error: any;
|
|
802
|
-
deployment?: undefined;
|
|
803
|
-
namespace?: undefined;
|
|
804
|
-
revisionCount?: undefined;
|
|
805
|
-
revisions?: undefined;
|
|
806
|
-
}>;
|
|
807
|
-
readonly get_configmap: Tool<{
|
|
808
|
-
namespace: string;
|
|
809
|
-
name: string;
|
|
810
|
-
}, {
|
|
811
|
-
name: string;
|
|
812
|
-
namespace: string;
|
|
813
|
-
resourceVersion: any;
|
|
814
|
-
lastModified: string | undefined;
|
|
815
|
-
data: any;
|
|
816
|
-
binaryDataKeys: string[];
|
|
817
|
-
error?: undefined;
|
|
818
|
-
} | {
|
|
819
|
-
error: any;
|
|
820
|
-
name?: undefined;
|
|
821
|
-
namespace?: undefined;
|
|
822
|
-
resourceVersion?: undefined;
|
|
823
|
-
lastModified?: undefined;
|
|
824
|
-
data?: undefined;
|
|
825
|
-
binaryDataKeys?: undefined;
|
|
826
|
-
}>;
|
|
827
|
-
readonly get_secret: Tool<{
|
|
828
|
-
namespace: string;
|
|
829
|
-
name: string;
|
|
830
|
-
}, {
|
|
831
|
-
name: string;
|
|
832
|
-
namespace: string;
|
|
833
|
-
type: any;
|
|
834
|
-
resourceVersion: any;
|
|
835
|
-
lastModified: string | undefined;
|
|
836
|
-
keys: string[];
|
|
837
|
-
error?: undefined;
|
|
838
|
-
} | {
|
|
839
|
-
error: any;
|
|
840
|
-
name?: undefined;
|
|
841
|
-
namespace?: undefined;
|
|
842
|
-
type?: undefined;
|
|
843
|
-
resourceVersion?: undefined;
|
|
844
|
-
lastModified?: undefined;
|
|
845
|
-
keys?: undefined;
|
|
846
|
-
}>;
|
|
847
|
-
readonly get_workload_config_refs: Tool<{
|
|
848
|
-
namespace: string;
|
|
849
|
-
name: string;
|
|
850
|
-
}, {
|
|
851
|
-
deployment: string;
|
|
852
|
-
namespace: string;
|
|
853
|
-
refs: ({
|
|
854
|
-
resourceVersion: any;
|
|
855
|
-
lastModified: string | undefined;
|
|
856
|
-
kind: string;
|
|
857
|
-
name: string;
|
|
858
|
-
via: string[];
|
|
859
|
-
} | {
|
|
860
|
-
error: any;
|
|
861
|
-
kind: string;
|
|
862
|
-
name: string;
|
|
863
|
-
via: string[];
|
|
864
|
-
})[];
|
|
865
|
-
error?: undefined;
|
|
866
|
-
} | {
|
|
867
|
-
error: any;
|
|
868
|
-
deployment?: undefined;
|
|
869
|
-
namespace?: undefined;
|
|
870
|
-
refs?: undefined;
|
|
871
|
-
}>;
|
|
872
|
-
readonly get_source_file: Tool<{
|
|
873
|
-
repo: string;
|
|
874
|
-
ref: string;
|
|
875
|
-
path: string;
|
|
876
|
-
}, {
|
|
877
|
-
repo: string;
|
|
878
|
-
ref: string;
|
|
879
|
-
path: string;
|
|
880
|
-
truncated: boolean;
|
|
881
|
-
content: string;
|
|
882
|
-
error?: undefined;
|
|
883
|
-
} | {
|
|
884
|
-
error: any;
|
|
885
|
-
repo?: undefined;
|
|
886
|
-
ref?: undefined;
|
|
887
|
-
path?: undefined;
|
|
888
|
-
truncated?: undefined;
|
|
889
|
-
content?: undefined;
|
|
890
|
-
}>;
|
|
891
|
-
};
|
|
892
|
-
export declare const toolInfoList: IToolInfo[];
|
|
287
|
+
export declare const buildAgentTools: (config: IToolsetConfig, context: IToolContext, hooks?: IAgentToolHooks,
|
|
288
|
+
/**
|
|
289
|
+
* Who is asking for the tools. Without it nothing is filtered by grant, so a plugin MUST pass its id:
|
|
290
|
+
* that is what stops it from serving itself a toolset it was never granted.
|
|
291
|
+
*/
|
|
292
|
+
requesterId?: string) => ToolSet;
|
|
893
293
|
export interface IAgentRunResult {
|
|
894
294
|
text: string;
|
|
895
295
|
inputTokens: number;
|
|
@@ -897,5 +297,3 @@ export interface IAgentRunResult {
|
|
|
897
297
|
steps: number;
|
|
898
298
|
toolCalls: string[];
|
|
899
299
|
}
|
|
900
|
-
export declare const selectAgentToolNames: (agent: IAgent) => string[];
|
|
901
|
-
export declare const runAgent: (agent: IAgent, prompt: string, llms: ILlm[], providers: ILlmProvider[], context: IToolContext) => Promise<IAgentRunResult>;
|