@kwirthmagnify/kwirth-common-ai 0.5.39 → 0.5.41
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 +53 -42
- package/package.json +1 -1
package/dist/back.js
CHANGED
|
@@ -66,10 +66,11 @@ const buildModel = (llm, providers) => {
|
|
|
66
66
|
case 'openrouter': return (0, ai_sdk_provider_1.createOpenRouter)({ apiKey: key })(llm.model);
|
|
67
67
|
case 'anthropic': return (0, anthropic_1.createAnthropic)({ apiKey: key })(llm.model);
|
|
68
68
|
case 'openai-compat': {
|
|
69
|
-
//
|
|
70
|
-
// /chat/completions)
|
|
69
|
+
// baseURL debe terminar en /v1 (el SDK añade el path). Y usamos .chat() → Chat Completions API
|
|
70
|
+
// (/v1/chat/completions): los endpoints OpenAI-compatibles (Huawei MaaS, etc.) NO exponen la
|
|
71
|
+
// Responses API (/v1/responses) → si no, 404 APIG.0101.
|
|
71
72
|
const b = ((_c = prov === null || prov === void 0 ? void 0 : prov.endpoint) !== null && _c !== void 0 ? _c : '').replace(/\/+$/, '');
|
|
72
|
-
return (0, openai_1.createOpenAI)({ apiKey: key, baseURL: b.endsWith('/v1') ? b : `${b}/v1` })(llm.model);
|
|
73
|
+
return (0, openai_1.createOpenAI)({ apiKey: key, baseURL: b.endsWith('/v1') ? b : `${b}/v1` }).chat(llm.model);
|
|
73
74
|
}
|
|
74
75
|
default:
|
|
75
76
|
console.log('Invalid provider type', type);
|
|
@@ -81,7 +82,7 @@ exports.buildModel = buildModel;
|
|
|
81
82
|
// un schema Zod (patrón Output.object). Reutilizable por toda la plataforma (Iter la usa para extraer un mapa
|
|
82
83
|
// de un diagrama). No lanza: los errores vuelven en `error`.
|
|
83
84
|
const generateVision = async (opts) => {
|
|
84
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j,
|
|
85
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m, _o, _p, _q, _r;
|
|
85
86
|
try {
|
|
86
87
|
const imagePart = opts.mediaType
|
|
87
88
|
? { type: 'image', image: opts.image, mediaType: opts.mediaType }
|
|
@@ -89,24 +90,34 @@ const generateVision = async (opts) => {
|
|
|
89
90
|
console.log('[generateVision] request', {
|
|
90
91
|
modelId: (_d = (_b = (_a = opts.model) === null || _a === void 0 ? void 0 : _a.modelId) !== null && _b !== void 0 ? _b : (_c = opts.model) === null || _c === void 0 ? void 0 : _c.model) !== null && _d !== void 0 ? _d : '(unknown)',
|
|
91
92
|
provider: (_j = (_f = (_e = opts.model) === null || _e === void 0 ? void 0 : _e.provider) !== null && _f !== void 0 ? _f : (_h = (_g = opts.model) === null || _g === void 0 ? void 0 : _g.config) === null || _h === void 0 ? void 0 : _h.provider) !== null && _j !== void 0 ? _j : '(unknown)',
|
|
92
|
-
mediaType: opts.mediaType, imageBytes: ((
|
|
93
|
-
systemLen: ((
|
|
93
|
+
mediaType: opts.mediaType, imageBytes: ((_l = opts.image) !== null && _l !== void 0 ? _l : '').length,
|
|
94
|
+
systemLen: ((_m = opts.system) !== null && _m !== void 0 ? _m : '').length, providerOptions: opts.providerOptions,
|
|
94
95
|
});
|
|
95
|
-
const { output, text, usage } = await (0, ai_1.generateText)(Object.assign({ model: opts.model, temperature: (
|
|
96
|
+
const { output, text, usage } = await (0, ai_1.generateText)(Object.assign({ model: opts.model, temperature: (_o = opts.temperature) !== null && _o !== void 0 ? _o : 0, system: opts.system, messages: [{
|
|
96
97
|
role: 'user',
|
|
97
98
|
content: [{ type: 'text', text: opts.prompt }, imagePart],
|
|
98
99
|
}], output: ai_1.Output.object({ schema: opts.schema }) }, (opts.providerOptions ? { providerOptions: opts.providerOptions } : {})));
|
|
99
100
|
console.log('[generateVision] ok', { hasOutput: output != null, textLen: (text !== null && text !== void 0 ? text : '').length, usage });
|
|
100
|
-
return { object: (
|
|
101
|
+
return { object: (_p = output) !== null && _p !== void 0 ? _p : null, text: text !== null && text !== void 0 ? text : '', usage };
|
|
101
102
|
}
|
|
102
103
|
catch (err) {
|
|
103
104
|
const e = err;
|
|
104
105
|
const body = typeof (e === null || e === void 0 ? void 0 : e.responseBody) === 'string' ? e.responseBody : ((e === null || e === void 0 ? void 0 : e.responseBody) ? JSON.stringify(e.responseBody) : undefined);
|
|
105
|
-
//
|
|
106
|
+
// Serializa el body ENVIADO truncando cadenas largas (el base64 de la imagen) para ver la ESTRUCTURA
|
|
107
|
+
// de content[] (qué campos lleva cada parte) sin volcar megas.
|
|
108
|
+
const trunc = (o) => {
|
|
109
|
+
try {
|
|
110
|
+
return JSON.stringify(o, (_k, v) => (typeof v === 'string' && v.length > 120 ? `${v.slice(0, 60)}…[${v.length} chars]` : v)).slice(0, 4000);
|
|
111
|
+
}
|
|
112
|
+
catch (_a) {
|
|
113
|
+
return String(o);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
// TRAZA COMPLETA del fallo de la llamada al LLM (URL, status, cuerpo de respuesta, causa, request).
|
|
106
117
|
console.error('[generateVision] FAILED', {
|
|
107
118
|
name: e === null || e === void 0 ? void 0 : e.name, message: e === null || e === void 0 ? void 0 : e.message, statusCode: e === null || e === void 0 ? void 0 : e.statusCode, url: e === null || e === void 0 ? void 0 : e.url,
|
|
108
|
-
responseBody: body, cause: (
|
|
109
|
-
requestBody:
|
|
119
|
+
responseBody: body, cause: (_r = (_q = e === null || e === void 0 ? void 0 : e.cause) === null || _q === void 0 ? void 0 : _q.message) !== null && _r !== void 0 ? _r : e === null || e === void 0 ? void 0 : e.cause,
|
|
120
|
+
requestBody: trunc(e === null || e === void 0 ? void 0 : e.requestBodyValues),
|
|
110
121
|
});
|
|
111
122
|
const parts = [e === null || e === void 0 ? void 0 : e.statusCode, e === null || e === void 0 ? void 0 : e.message, e === null || e === void 0 ? void 0 : e.url, body].filter(Boolean).map((x) => String(x));
|
|
112
123
|
return { object: null, text: '', error: parts.join(' | ') || String(err) };
|
|
@@ -114,7 +125,7 @@ const generateVision = async (opts) => {
|
|
|
114
125
|
};
|
|
115
126
|
exports.generateVision = generateVision;
|
|
116
127
|
const loadModels = async (providers, log) => {
|
|
117
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j,
|
|
128
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m;
|
|
118
129
|
(_a = log.logInfo) === null || _a === void 0 ? void 0 : _a.call(log, 'Loading AI models...');
|
|
119
130
|
for (const provider of providers) {
|
|
120
131
|
try {
|
|
@@ -225,10 +236,10 @@ const loadModels = async (providers, log) => {
|
|
|
225
236
|
default:
|
|
226
237
|
(_j = log.logWarning) === null || _j === void 0 ? void 0 : _j.call(log, `Provider '${provider.name}' has unknown type '${type}', will not be available.`);
|
|
227
238
|
}
|
|
228
|
-
(
|
|
239
|
+
(_l = log.logInfo) === null || _l === void 0 ? void 0 : _l.call(log, `Provider '${provider.name}' loaded ${provider.models.length} models`);
|
|
229
240
|
}
|
|
230
241
|
catch (err) {
|
|
231
|
-
(
|
|
242
|
+
(_m = log.logError) === null || _m === void 0 ? void 0 : _m.call(log, `Error loading models from provider '${provider.name}': ${err}`);
|
|
232
243
|
}
|
|
233
244
|
}
|
|
234
245
|
};
|
|
@@ -359,7 +370,7 @@ const lastModifiedOf = (meta) => {
|
|
|
359
370
|
};
|
|
360
371
|
// The ConfigMap/Secret references a pod template consumes: envFrom, env.valueFrom, and volumes.
|
|
361
372
|
const configRefsOfPodSpec = (spec) => {
|
|
362
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j,
|
|
373
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m, _o, _p;
|
|
363
374
|
const refs = [];
|
|
364
375
|
const add = (kind, name, via) => { if (name)
|
|
365
376
|
refs.push({ kind, name, via }); };
|
|
@@ -370,12 +381,12 @@ const configRefsOfPodSpec = (spec) => {
|
|
|
370
381
|
}
|
|
371
382
|
for (const e of (_f = ct.env) !== null && _f !== void 0 ? _f : []) {
|
|
372
383
|
add('ConfigMap', (_h = (_g = e.valueFrom) === null || _g === void 0 ? void 0 : _g.configMapKeyRef) === null || _h === void 0 ? void 0 : _h.name, `env ${e.name}`);
|
|
373
|
-
add('Secret', (
|
|
384
|
+
add('Secret', (_l = (_j = e.valueFrom) === null || _j === void 0 ? void 0 : _j.secretKeyRef) === null || _l === void 0 ? void 0 : _l.name, `env ${e.name}`);
|
|
374
385
|
}
|
|
375
386
|
}
|
|
376
|
-
for (const v of (
|
|
377
|
-
add('ConfigMap', (
|
|
378
|
-
add('Secret', (
|
|
387
|
+
for (const v of (_m = spec === null || spec === void 0 ? void 0 : spec.volumes) !== null && _m !== void 0 ? _m : []) {
|
|
388
|
+
add('ConfigMap', (_o = v.configMap) === null || _o === void 0 ? void 0 : _o.name, `volume ${v.name}`);
|
|
389
|
+
add('Secret', (_p = v.secret) === null || _p === void 0 ? void 0 : _p.secretName, `volume ${v.name}`);
|
|
379
390
|
}
|
|
380
391
|
return refs;
|
|
381
392
|
};
|
|
@@ -418,7 +429,7 @@ exports.tools = {
|
|
|
418
429
|
ctx().trace('get_cluster_data', {});
|
|
419
430
|
try {
|
|
420
431
|
const resp = await ctx().clusterInfo.coreApi.listNode();
|
|
421
|
-
return { name: ctx().clusterInfo.name, flavour: ctx().clusterInfo.flavour, vcpus: ctx().clusterInfo.vcpus, memoryGB: Math.round(ctx().clusterInfo.memory / 1024 / 1024 / 1024 * 100) / 100, nodeCount: resp.items.length, nodes: resp.items.map((n) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j,
|
|
432
|
+
return { name: ctx().clusterInfo.name, flavour: ctx().clusterInfo.flavour, vcpus: ctx().clusterInfo.vcpus, memoryGB: Math.round(ctx().clusterInfo.memory / 1024 / 1024 / 1024 * 100) / 100, nodeCount: resp.items.length, nodes: resp.items.map((n) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l; return ({ name: (_a = n.metadata) === null || _a === void 0 ? void 0 : _a.name, cpu: (_c = (_b = n.status) === null || _b === void 0 ? void 0 : _b.capacity) === null || _c === void 0 ? void 0 : _c['cpu'], memoryKi: (_e = (_d = n.status) === null || _d === void 0 ? void 0 : _d.capacity) === null || _e === void 0 ? void 0 : _e['memory'], ready: ((_h = (_g = (_f = n.status) === null || _f === void 0 ? void 0 : _f.conditions) === null || _g === void 0 ? void 0 : _g.find((c) => c.type === 'Ready')) === null || _h === void 0 ? void 0 : _h.status) === 'True', unschedulable: (_l = (_j = n.spec) === null || _j === void 0 ? void 0 : _j.unschedulable) !== null && _l !== void 0 ? _l : false }); }) };
|
|
422
433
|
}
|
|
423
434
|
catch (err) {
|
|
424
435
|
return { error: (_a = err.message) !== null && _a !== void 0 ? _a : String(err) };
|
|
@@ -508,7 +519,7 @@ exports.tools = {
|
|
|
508
519
|
: await c.coreApi.listServiceForAllNamespaces();
|
|
509
520
|
return {
|
|
510
521
|
services: resp.items.map((x) => {
|
|
511
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j,
|
|
522
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m;
|
|
512
523
|
return ({
|
|
513
524
|
name: (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name,
|
|
514
525
|
namespace: (_b = x.metadata) === null || _b === void 0 ? void 0 : _b.namespace,
|
|
@@ -516,7 +527,7 @@ exports.tools = {
|
|
|
516
527
|
clusterIP: (_d = x.spec) === null || _d === void 0 ? void 0 : _d.clusterIP,
|
|
517
528
|
externalIPs: (_f = (_e = x.spec) === null || _e === void 0 ? void 0 : _e.externalIPs) !== null && _f !== void 0 ? _f : [],
|
|
518
529
|
ports: (_j = (_h = (_g = x.spec) === null || _g === void 0 ? void 0 : _g.ports) === null || _h === void 0 ? void 0 : _h.map((p) => ({ name: p.name, port: p.port, targetPort: p.targetPort, protocol: p.protocol }))) !== null && _j !== void 0 ? _j : [],
|
|
519
|
-
selector: (
|
|
530
|
+
selector: (_m = (_l = x.spec) === null || _l === void 0 ? void 0 : _l.selector) !== null && _m !== void 0 ? _m : {}
|
|
520
531
|
});
|
|
521
532
|
})
|
|
522
533
|
};
|
|
@@ -540,15 +551,15 @@ exports.tools = {
|
|
|
540
551
|
: await c.networkApi.listIngressForAllNamespaces();
|
|
541
552
|
return {
|
|
542
553
|
ingresses: resp.items.map((x) => {
|
|
543
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j,
|
|
554
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m, _o, _p, _q, _r;
|
|
544
555
|
return ({
|
|
545
556
|
name: (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name,
|
|
546
557
|
namespace: (_b = x.metadata) === null || _b === void 0 ? void 0 : _b.namespace,
|
|
547
558
|
ingressClass: (_c = x.spec) === null || _c === void 0 ? void 0 : _c.ingressClassName,
|
|
548
559
|
hosts: (_f = (_e = (_d = x.spec) === null || _d === void 0 ? void 0 : _d.rules) === null || _e === void 0 ? void 0 : _e.map((r) => r.host)) !== null && _f !== void 0 ? _f : [],
|
|
549
560
|
paths: (_j = (_h = (_g = x.spec) === null || _g === void 0 ? void 0 : _g.rules) === null || _h === void 0 ? void 0 : _h.flatMap((r) => { var _a, _b, _c; return (_c = (_b = (_a = r.http) === null || _a === void 0 ? void 0 : _a.paths) === null || _b === void 0 ? void 0 : _b.map((p) => { var _a, _b, _c, _d, _e; return ({ host: r.host, path: p.path, pathType: p.pathType, service: (_b = (_a = p.backend) === null || _a === void 0 ? void 0 : _a.service) === null || _b === void 0 ? void 0 : _b.name, port: (_e = (_d = (_c = p.backend) === null || _c === void 0 ? void 0 : _c.service) === null || _d === void 0 ? void 0 : _d.port) === null || _e === void 0 ? void 0 : _e.number }); })) !== null && _c !== void 0 ? _c : []; })) !== null && _j !== void 0 ? _j : [],
|
|
550
|
-
tls: (
|
|
551
|
-
loadBalancer: (
|
|
561
|
+
tls: (_o = (_m = (_l = x.spec) === null || _l === void 0 ? void 0 : _l.tls) === null || _m === void 0 ? void 0 : _m.map((t) => ({ secretName: t.secretName, hosts: t.hosts }))) !== null && _o !== void 0 ? _o : [],
|
|
562
|
+
loadBalancer: (_r = (_q = (_p = x.status) === null || _p === void 0 ? void 0 : _p.loadBalancer) === null || _q === void 0 ? void 0 : _q.ingress) !== null && _r !== void 0 ? _r : []
|
|
552
563
|
});
|
|
553
564
|
})
|
|
554
565
|
};
|
|
@@ -597,14 +608,14 @@ exports.tools = {
|
|
|
597
608
|
return { error: 'No metrics available yet' };
|
|
598
609
|
const latest = ctx().clusterMetrics[ctx().clusterMetrics.length - 1];
|
|
599
610
|
const nodes = nodeName ? latest.nodes.filter((n) => n.name === nodeName) : latest.nodes;
|
|
600
|
-
return nodes.map((n) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j,
|
|
611
|
+
return nodes.map((n) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m, _o, _p, _q, _r; return ({ name: n.name, cpuMillicores: Math.round(((_c = (_b = (_a = n.summary) === null || _a === void 0 ? void 0 : _a.cpu) === null || _b === void 0 ? void 0 : _b.usageNanoCores) !== null && _c !== void 0 ? _c : 0) / 1000000), memoryMB: Math.round(((_f = (_e = (_d = n.summary) === null || _d === void 0 ? void 0 : _d.memory) === null || _e === void 0 ? void 0 : _e.workingSetBytes) !== null && _f !== void 0 ? _f : 0) / 1024 / 1024), networkRxMB: Math.round(((_j = (_h = (_g = n.summary) === null || _g === void 0 ? void 0 : _g.network) === null || _h === void 0 ? void 0 : _h.rxBytes) !== null && _j !== void 0 ? _j : 0) / 1024 / 1024), networkTxMB: Math.round(((_o = (_m = (_l = n.summary) === null || _l === void 0 ? void 0 : _l.network) === null || _m === void 0 ? void 0 : _m.txBytes) !== null && _o !== void 0 ? _o : 0) / 1024 / 1024), podCount: (_r = (_q = (_p = n.summary) === null || _p === void 0 ? void 0 : _p.pods) === null || _q === void 0 ? void 0 : _q.length) !== null && _r !== void 0 ? _r : 0, timestamp: n.timestamp }); });
|
|
601
612
|
}
|
|
602
613
|
}),
|
|
603
614
|
get_deployment_usage: (0, ai_1.tool)({
|
|
604
615
|
description: 'Returns current aggregated CPU and memory usage for all pods belonging to a specific deployment.',
|
|
605
616
|
inputSchema: zod_1.z.object({ namespace: zod_1.z.string().describe('Namespace of the deployment'), name: zod_1.z.string().describe('Name of the deployment') }),
|
|
606
617
|
execute: async ({ namespace, name }) => {
|
|
607
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j,
|
|
618
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m, _o, _p;
|
|
608
619
|
ctx().trace('get_deployment_usage', { namespace, name });
|
|
609
620
|
try {
|
|
610
621
|
if (ctx().clusterMetrics.length === 0)
|
|
@@ -620,13 +631,13 @@ exports.tools = {
|
|
|
620
631
|
for (const pod of ((_e = (_d = node.summary) === null || _d === void 0 ? void 0 : _d.pods) !== null && _e !== void 0 ? _e : []))
|
|
621
632
|
if (((_f = pod.podRef) === null || _f === void 0 ? void 0 : _f.namespace) === namespace && podNames.has((_g = pod.podRef) === null || _g === void 0 ? void 0 : _g.name)) {
|
|
622
633
|
totalCpu += (_j = (_h = pod.cpu) === null || _h === void 0 ? void 0 : _h.usageNanoCores) !== null && _j !== void 0 ? _j : 0;
|
|
623
|
-
totalMem += (
|
|
634
|
+
totalMem += (_m = (_l = pod.memory) === null || _l === void 0 ? void 0 : _l.workingSetBytes) !== null && _m !== void 0 ? _m : 0;
|
|
624
635
|
podCount++;
|
|
625
636
|
}
|
|
626
|
-
return { deployment: name, namespace, podCount, cpuMillicores: Math.round(totalCpu / 1000000), memoryMB: Math.round(totalMem / 1024 / 1024), timestamp: (
|
|
637
|
+
return { deployment: name, namespace, podCount, cpuMillicores: Math.round(totalCpu / 1000000), memoryMB: Math.round(totalMem / 1024 / 1024), timestamp: (_o = latest.nodes[0]) === null || _o === void 0 ? void 0 : _o.timestamp };
|
|
627
638
|
}
|
|
628
639
|
catch (err) {
|
|
629
|
-
return { error: (
|
|
640
|
+
return { error: (_p = err.message) !== null && _p !== void 0 ? _p : String(err) };
|
|
630
641
|
}
|
|
631
642
|
}
|
|
632
643
|
}),
|
|
@@ -972,7 +983,7 @@ exports.tools = {
|
|
|
972
983
|
name: zod_1.z.string().describe('Name of the pod')
|
|
973
984
|
}),
|
|
974
985
|
execute: async ({ namespace, name }) => {
|
|
975
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j,
|
|
986
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m, _o, _p, _q, _r;
|
|
976
987
|
ctx().trace('describe_pod', { namespace, name });
|
|
977
988
|
try {
|
|
978
989
|
const c = ctx().clusterInfo;
|
|
@@ -999,7 +1010,7 @@ exports.tools = {
|
|
|
999
1010
|
const rsOwner = ((_f = (_e = rs.metadata) === null || _e === void 0 ? void 0 : _e.ownerReferences) !== null && _f !== void 0 ? _f : [])[0];
|
|
1000
1011
|
controlledBy = rsOwner ? { kind: rsOwner.kind, name: rsOwner.name } : { kind: 'ReplicaSet', name: podOwner.name };
|
|
1001
1012
|
}
|
|
1002
|
-
catch (
|
|
1013
|
+
catch (_s) {
|
|
1003
1014
|
controlledBy = { kind: 'ReplicaSet', name: podOwner.name };
|
|
1004
1015
|
}
|
|
1005
1016
|
}
|
|
@@ -1010,19 +1021,19 @@ exports.tools = {
|
|
|
1010
1021
|
// the repo + commit the image was built from, so the bot can read the actual source (get_source_file).
|
|
1011
1022
|
const ann = (_h = (_g = pod.metadata) === null || _g === void 0 ? void 0 : _g.annotations) !== null && _h !== void 0 ? _h : {};
|
|
1012
1023
|
const sourceRepo = (_j = ann['org.opencontainers.image.source']) !== null && _j !== void 0 ? _j : ann['kwirth.io/source-repo'];
|
|
1013
|
-
const source = sourceRepo ? { repo: sourceRepo, revision: (
|
|
1024
|
+
const source = sourceRepo ? { repo: sourceRepo, revision: (_l = ann['org.opencontainers.image.revision']) !== null && _l !== void 0 ? _l : ann['kwirth.io/source-ref'] } : undefined;
|
|
1014
1025
|
return {
|
|
1015
1026
|
name, namespace, phase: status.phase, node: spec.nodeName, startTime: status.startTime, reason: status.reason, message: status.message,
|
|
1016
1027
|
controlledBy, // e.g. { kind: 'Deployment', name: 'montag-agent' } → feed to get_rollout_history
|
|
1017
1028
|
source, // { repo, revision } from image annotations → feed to get_source_file
|
|
1018
|
-
conditions: ((
|
|
1019
|
-
containers: ((
|
|
1020
|
-
initContainers: ((
|
|
1021
|
-
spec: { containers: ((
|
|
1029
|
+
conditions: ((_m = status.conditions) !== null && _m !== void 0 ? _m : []).map((c) => ({ type: c.type, status: c.status, reason: c.reason })),
|
|
1030
|
+
containers: ((_o = status.containerStatuses) !== null && _o !== void 0 ? _o : []).map(containerStatus),
|
|
1031
|
+
initContainers: ((_p = status.initContainerStatuses) !== null && _p !== void 0 ? _p : []).map(containerStatus),
|
|
1032
|
+
spec: { containers: ((_q = spec.containers) !== null && _q !== void 0 ? _q : []).map(specContainer), restartPolicy: spec.restartPolicy }
|
|
1022
1033
|
};
|
|
1023
1034
|
}
|
|
1024
1035
|
catch (err) {
|
|
1025
|
-
return { error: (
|
|
1036
|
+
return { error: (_r = err.message) !== null && _r !== void 0 ? _r : String(err) };
|
|
1026
1037
|
}
|
|
1027
1038
|
}
|
|
1028
1039
|
}),
|
|
@@ -1083,15 +1094,15 @@ exports.tools = {
|
|
|
1083
1094
|
};
|
|
1084
1095
|
const container = (ct) => { var _a; return ({ name: ct.name, image: ct.image, command: ct.command, args: ct.args, resources: ct.resources, env: ((_a = ct.env) !== null && _a !== void 0 ? _a : []).map((e) => ({ name: e.name, value: e.value, from: envSource(e) })) }); };
|
|
1085
1096
|
const revisions = owned.map((rs) => {
|
|
1086
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j,
|
|
1097
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m, _o, _p;
|
|
1087
1098
|
const tmpl = (_c = (_b = (_a = rs.spec) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.spec) !== null && _c !== void 0 ? _c : {};
|
|
1088
1099
|
return {
|
|
1089
1100
|
revision: Number((_f = (_e = (_d = rs.metadata) === null || _d === void 0 ? void 0 : _d.annotations) === null || _e === void 0 ? void 0 : _e['deployment.kubernetes.io/revision']) !== null && _f !== void 0 ? _f : 0),
|
|
1090
1101
|
replicaSet: (_g = rs.metadata) === null || _g === void 0 ? void 0 : _g.name,
|
|
1091
1102
|
createdAt: (_h = rs.metadata) === null || _h === void 0 ? void 0 : _h.creationTimestamp,
|
|
1092
|
-
replicas: (
|
|
1093
|
-
readyReplicas: (
|
|
1094
|
-
containers: ((
|
|
1103
|
+
replicas: (_l = (_j = rs.spec) === null || _j === void 0 ? void 0 : _j.replicas) !== null && _l !== void 0 ? _l : 0,
|
|
1104
|
+
readyReplicas: (_o = (_m = rs.status) === null || _m === void 0 ? void 0 : _m.readyReplicas) !== null && _o !== void 0 ? _o : 0,
|
|
1105
|
+
containers: ((_p = tmpl.containers) !== null && _p !== void 0 ? _p : []).map(container),
|
|
1095
1106
|
serviceAccount: tmpl.serviceAccountName,
|
|
1096
1107
|
securityContext: tmpl.securityContext
|
|
1097
1108
|
};
|