@kwirthmagnify/kwirth-common-ai 0.5.58 → 0.5.60

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 CHANGED
@@ -5,7 +5,7 @@ interface ILogChannel {
5
5
  logWarning?: (msg: string) => void;
6
6
  logError?: (msg: string) => void;
7
7
  }
8
- import { LanguageModel, ToolSet } from 'ai';
8
+ import { LanguageModel, Tool, 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> {
@@ -30,6 +30,7 @@ export interface IVisionOptions<T> {
30
30
  export declare const generateVision: <T>(opts: IVisionOptions<T>) => Promise<IVisionResult<T>>;
31
31
  export declare const loadModels: (providers: ILlmProvider[], log: ILogChannel) => Promise<void>;
32
32
  export { generateText, Output, stepCountIs, tool } from 'ai';
33
+ export type { LanguageModel, ToolSet } from 'ai';
33
34
  export { z } from 'zod';
34
35
  export declare const zodFromExample: (example: Record<string, unknown>) => z.ZodObject<Record<string, z.ZodTypeAny>>;
35
36
  export interface ISourceRepoCred {
@@ -275,15 +276,15 @@ export interface IAgentToolHooks {
275
276
  */
276
277
  export declare const buildAgentTools: (config: IToolsetConfig, context: IToolContext, hooks?: IAgentToolHooks) => ToolSet;
277
278
  export declare const tools: {
278
- readonly list_namespaces: import("ai").Tool<Record<string, never>, {
279
+ readonly list_namespaces: Tool<Record<string, never>, {
279
280
  namespaces: any;
280
281
  error?: undefined;
281
282
  } | {
282
283
  error: any;
283
284
  namespaces?: undefined;
284
285
  }>;
285
- readonly get_node_data: import("ai").Tool<Record<string, never>, any>;
286
- readonly get_cluster_data: import("ai").Tool<Record<string, never>, {
286
+ readonly get_node_data: Tool<Record<string, never>, any>;
287
+ readonly get_cluster_data: Tool<Record<string, never>, {
287
288
  name: any;
288
289
  flavour: any;
289
290
  vcpus: any;
@@ -300,7 +301,7 @@ export declare const tools: {
300
301
  nodeCount?: undefined;
301
302
  nodes?: undefined;
302
303
  }>;
303
- readonly get_workload_data: import("ai").Tool<{
304
+ readonly get_workload_data: Tool<{
304
305
  namespace?: string | undefined;
305
306
  }, {
306
307
  deployments: any;
@@ -317,7 +318,7 @@ export declare const tools: {
317
318
  pods?: undefined;
318
319
  services?: undefined;
319
320
  }>;
320
- readonly get_space_data: import("ai").Tool<{
321
+ readonly get_space_data: Tool<{
321
322
  namespace: string;
322
323
  }, {
323
324
  namespace: string;
@@ -342,10 +343,10 @@ export declare const tools: {
342
343
  services?: undefined;
343
344
  configMaps?: undefined;
344
345
  }>;
345
- readonly get_namespace_yaml: import("ai").Tool<{
346
+ readonly get_namespace_yaml: Tool<{
346
347
  name: string;
347
348
  }, any>;
348
- readonly describe_service: import("ai").Tool<{
349
+ readonly describe_service: Tool<{
349
350
  namespace: string;
350
351
  name: string;
351
352
  }, {
@@ -375,7 +376,7 @@ export declare const tools: {
375
376
  endpoints?: undefined;
376
377
  endpointCount?: undefined;
377
378
  }>;
378
- readonly describe_ingress: import("ai").Tool<{
379
+ readonly describe_ingress: Tool<{
379
380
  namespace: string;
380
381
  name: string;
381
382
  }, {
@@ -397,7 +398,7 @@ export declare const tools: {
397
398
  tls?: undefined;
398
399
  loadBalancer?: undefined;
399
400
  }>;
400
- readonly describe_controller: import("ai").Tool<{
401
+ readonly describe_controller: Tool<{
401
402
  namespace: string;
402
403
  kind: "Deployment" | "StatefulSet" | "DaemonSet" | "ReplicaSet";
403
404
  name: string;
@@ -438,11 +439,11 @@ export declare const tools: {
438
439
  selector?: undefined;
439
440
  template?: undefined;
440
441
  }>;
441
- readonly get_service_yaml: import("ai").Tool<{
442
+ readonly get_service_yaml: Tool<{
442
443
  namespace: string;
443
444
  name: string;
444
445
  }, any>;
445
- readonly list_services: import("ai").Tool<{
446
+ readonly list_services: Tool<{
446
447
  namespace?: string | undefined;
447
448
  }, {
448
449
  services: any;
@@ -451,7 +452,7 @@ export declare const tools: {
451
452
  error: any;
452
453
  services?: undefined;
453
454
  }>;
454
- readonly list_ingresses: import("ai").Tool<{
455
+ readonly list_ingresses: Tool<{
455
456
  namespace?: string | undefined;
456
457
  }, {
457
458
  ingresses: any;
@@ -460,11 +461,11 @@ export declare const tools: {
460
461
  error: any;
461
462
  ingresses?: undefined;
462
463
  }>;
463
- readonly get_ingress_yaml: import("ai").Tool<{
464
+ readonly get_ingress_yaml: Tool<{
464
465
  namespace: string;
465
466
  name: string;
466
467
  }, any>;
467
- readonly get_cluster_usage: import("ai").Tool<Record<string, never>, {
468
+ readonly get_cluster_usage: Tool<Record<string, never>, {
468
469
  error: string;
469
470
  vcpus?: undefined;
470
471
  memoryGB?: undefined;
@@ -483,10 +484,10 @@ export declare const tools: {
483
484
  metricsIntervalSeconds: any;
484
485
  error?: undefined;
485
486
  }>;
486
- readonly get_node_usage: import("ai").Tool<{
487
+ readonly get_node_usage: Tool<{
487
488
  nodeName?: string | undefined;
488
489
  }, any>;
489
- readonly get_deployment_usage: import("ai").Tool<{
490
+ readonly get_deployment_usage: Tool<{
490
491
  namespace: string;
491
492
  name: string;
492
493
  }, {
@@ -506,7 +507,7 @@ export declare const tools: {
506
507
  memoryMB?: undefined;
507
508
  timestamp?: undefined;
508
509
  }>;
509
- readonly get_prev_cluster_usage: import("ai").Tool<{
510
+ readonly get_prev_cluster_usage: Tool<{
510
511
  count?: number | undefined;
511
512
  }, {
512
513
  vcpus: any;
@@ -518,7 +519,7 @@ export declare const tools: {
518
519
  }[] | {
519
520
  error: string;
520
521
  }>;
521
- readonly get_prev_node_usage: import("ai").Tool<{
522
+ readonly get_prev_node_usage: Tool<{
522
523
  nodeName?: string | undefined;
523
524
  count?: number | undefined;
524
525
  }, {
@@ -526,7 +527,7 @@ export declare const tools: {
526
527
  }[] | {
527
528
  error: string;
528
529
  }>;
529
- readonly get_prev_deployment_usage: import("ai").Tool<{
530
+ readonly get_prev_deployment_usage: Tool<{
530
531
  namespace: string;
531
532
  name: string;
532
533
  count?: number | undefined;
@@ -540,7 +541,7 @@ export declare const tools: {
540
541
  }[] | {
541
542
  error: any;
542
543
  }>;
543
- readonly get_prev_space_data: import("ai").Tool<{
544
+ readonly get_prev_space_data: Tool<{
544
545
  namespace: string;
545
546
  count?: number | undefined;
546
547
  }, {
@@ -552,7 +553,7 @@ export declare const tools: {
552
553
  }[] | {
553
554
  error: string;
554
555
  }>;
555
- readonly add_node: import("ai").Tool<{
556
+ readonly add_node: Tool<{
556
557
  nodeName?: string | undefined;
557
558
  nodePoolName?: string | undefined;
558
559
  }, {
@@ -574,7 +575,7 @@ export declare const tools: {
574
575
  stderr?: undefined;
575
576
  error?: undefined;
576
577
  }>;
577
- readonly remove_node: import("ai").Tool<{
578
+ readonly remove_node: Tool<{
578
579
  nodeName: string;
579
580
  nodePoolName?: string | undefined;
580
581
  }, {
@@ -596,7 +597,7 @@ export declare const tools: {
596
597
  stderr?: undefined;
597
598
  error?: undefined;
598
599
  }>;
599
- readonly stop_node: import("ai").Tool<{
600
+ readonly stop_node: Tool<{
600
601
  nodeName: string;
601
602
  }, {
602
603
  success: boolean;
@@ -617,7 +618,7 @@ export declare const tools: {
617
618
  stderr: string;
618
619
  error?: undefined;
619
620
  }>;
620
- readonly start_node: import("ai").Tool<{
621
+ readonly start_node: Tool<{
621
622
  nodeName: string;
622
623
  }, {
623
624
  success: boolean;
@@ -638,7 +639,7 @@ export declare const tools: {
638
639
  stderr?: undefined;
639
640
  error?: undefined;
640
641
  }>;
641
- readonly add_replica: import("ai").Tool<{
642
+ readonly add_replica: Tool<{
642
643
  namespace: string;
643
644
  name: string;
644
645
  }, {
@@ -650,7 +651,7 @@ export declare const tools: {
650
651
  error: any;
651
652
  message?: undefined;
652
653
  }>;
653
- readonly remove_replica: import("ai").Tool<{
654
+ readonly remove_replica: Tool<{
654
655
  namespace: string;
655
656
  name: string;
656
657
  }, {
@@ -662,7 +663,7 @@ export declare const tools: {
662
663
  error: any;
663
664
  message?: undefined;
664
665
  }>;
665
- readonly restart_deployment: import("ai").Tool<{
666
+ readonly restart_deployment: Tool<{
666
667
  namespace: string;
667
668
  name: string;
668
669
  }, {
@@ -674,7 +675,7 @@ export declare const tools: {
674
675
  error: any;
675
676
  message?: undefined;
676
677
  }>;
677
- readonly delete_pod: import("ai").Tool<{
678
+ readonly delete_pod: Tool<{
678
679
  namespace: string;
679
680
  name: string;
680
681
  }, {
@@ -686,17 +687,17 @@ export declare const tools: {
686
687
  error: any;
687
688
  message?: undefined;
688
689
  }>;
689
- readonly times_two: import("ai").Tool<{
690
+ readonly times_two: Tool<{
690
691
  data: number;
691
692
  }, number>;
692
- readonly father_of: import("ai").Tool<{
693
+ readonly father_of: Tool<{
693
694
  data: string;
694
695
  }, string>;
695
- readonly get_certificate_info: import("ai").Tool<{
696
+ readonly get_certificate_info: Tool<{
696
697
  hostname: string;
697
698
  port?: number | undefined;
698
699
  }, unknown>;
699
- readonly get_cluster_events: import("ai").Tool<{
700
+ readonly get_cluster_events: Tool<{
700
701
  warningsOnly?: boolean | undefined;
701
702
  namespace?: string | undefined;
702
703
  limit?: number | undefined;
@@ -704,14 +705,14 @@ export declare const tools: {
704
705
  count: number;
705
706
  events: Record<string, unknown>[];
706
707
  }>;
707
- readonly get_object_events: import("ai").Tool<{
708
+ readonly get_object_events: Tool<{
708
709
  namespace: string;
709
710
  name: string;
710
711
  }, {
711
712
  count: number;
712
713
  events: Record<string, unknown>[];
713
714
  }>;
714
- readonly get_pod_logs: import("ai").Tool<{
715
+ readonly get_pod_logs: Tool<{
715
716
  namespace: string;
716
717
  name: string;
717
718
  container?: string | undefined;
@@ -734,7 +735,7 @@ export declare const tools: {
734
735
  truncated?: undefined;
735
736
  logs?: undefined;
736
737
  }>;
737
- readonly describe_pod: import("ai").Tool<{
738
+ readonly describe_pod: Tool<{
738
739
  namespace: string;
739
740
  name: string;
740
741
  }, {
@@ -774,20 +775,20 @@ export declare const tools: {
774
775
  initContainers?: undefined;
775
776
  spec?: undefined;
776
777
  }>;
777
- readonly get_pod_yaml: import("ai").Tool<{
778
+ readonly get_pod_yaml: Tool<{
778
779
  namespace: string;
779
780
  name: string;
780
781
  }, any>;
781
- readonly get_deployment_yaml: import("ai").Tool<{
782
+ readonly get_deployment_yaml: Tool<{
782
783
  namespace: string;
783
784
  name: string;
784
785
  }, any>;
785
- readonly get_controller_yaml: import("ai").Tool<{
786
+ readonly get_controller_yaml: Tool<{
786
787
  namespace: string;
787
788
  kind: "Deployment" | "StatefulSet" | "DaemonSet" | "ReplicaSet";
788
789
  name: string;
789
790
  }, any>;
790
- readonly get_rollout_history: import("ai").Tool<{
791
+ readonly get_rollout_history: Tool<{
791
792
  namespace: string;
792
793
  name: string;
793
794
  }, {
@@ -803,7 +804,7 @@ export declare const tools: {
803
804
  revisionCount?: undefined;
804
805
  revisions?: undefined;
805
806
  }>;
806
- readonly get_configmap: import("ai").Tool<{
807
+ readonly get_configmap: Tool<{
807
808
  namespace: string;
808
809
  name: string;
809
810
  }, {
@@ -823,7 +824,7 @@ export declare const tools: {
823
824
  data?: undefined;
824
825
  binaryDataKeys?: undefined;
825
826
  }>;
826
- readonly get_secret: import("ai").Tool<{
827
+ readonly get_secret: Tool<{
827
828
  namespace: string;
828
829
  name: string;
829
830
  }, {
@@ -843,7 +844,7 @@ export declare const tools: {
843
844
  lastModified?: undefined;
844
845
  keys?: undefined;
845
846
  }>;
846
- readonly get_workload_config_refs: import("ai").Tool<{
847
+ readonly get_workload_config_refs: Tool<{
847
848
  namespace: string;
848
849
  name: string;
849
850
  }, {
@@ -868,7 +869,7 @@ export declare const tools: {
868
869
  namespace?: undefined;
869
870
  refs?: undefined;
870
871
  }>;
871
- readonly get_source_file: import("ai").Tool<{
872
+ readonly get_source_file: Tool<{
872
873
  repo: string;
873
874
  ref: string;
874
875
  path: string;
package/dist/back.js CHANGED
@@ -258,6 +258,8 @@ const inferZod = (value) => {
258
258
  return zod_1.z.unknown();
259
259
  };
260
260
  // Re-export AI SDK symbols so plugins can use them without bundling the SDK
261
+ // Se re-exportan tambien los TIPOS que necesita quien escriba un helper alrededor de generateText: sin
262
+ // LanguageModel y ToolSet, un plugin no puede tipar sus propias funciones y acaba con 'any'.
261
263
  var ai_2 = require("ai");
262
264
  Object.defineProperty(exports, "generateText", { enumerable: true, get: function () { return ai_2.generateText; } });
263
265
  Object.defineProperty(exports, "Output", { enumerable: true, get: function () { return ai_2.Output; } });
@@ -543,9 +545,15 @@ const buildAgentTools = (config, context, hooks = {}) => {
543
545
  const { effective } = (0, exports.resolveTools)(config);
544
546
  const entries = effective.map(e => {
545
547
  const invocationOf = (args) => ({ ref: e.ref, toolsetId: e.toolsetId, toolName: e.name, args });
546
- // `dynamicTool` y no `tool`: el esquema de una tool empaquetada no se conoce en compilacion, y el
547
- // helper tipado infiere `never` para un ZodTypeAny generico.
548
- return [e.name, (0, ai_1.dynamicTool)({
548
+ // ⚠️ Un objeto PLANO, no `dynamicTool`. Parece equivalente y no lo es:
549
+ // tool(t) => t (solo ayuda de tipos, no toca nada)
550
+ // dynamicTool(t) => { ...t, type: 'dynamic' } (marca la tool en RUNTIME)
551
+ // Una tool marcada como dinamica la trata el SDK por otro camino, y con `Output.object` la
552
+ // ejecucion acaba en AI_NoOutputGeneratedError: la tool corre, devuelve, y la respuesta
553
+ // estructurada no se genera. Se uso `dynamicTool` para esquivar una friccion de tipos —el helper
554
+ // `tool()` infiere `never` con un ZodTypeAny generico— y el precio fue cambiar el comportamiento.
555
+ // El casteo es la forma honesta: lo que el SDK necesita es exactamente este objeto.
556
+ return [e.name, {
549
557
  description: e.tool.description,
550
558
  inputSchema: e.tool.inputSchema,
551
559
  execute: async (rawArgs) => {
@@ -576,7 +584,7 @@ const buildAgentTools = (config, context, hooks = {}) => {
576
584
  return { error: message };
577
585
  }
578
586
  }
579
- })];
587
+ }];
580
588
  });
581
589
  return Object.fromEntries(entries);
582
590
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwirthmagnify/kwirth-common-ai",
3
- "version": "0.5.58",
3
+ "version": "0.5.60",
4
4
  "description": "Shared AI/LLM types and utilities for Kwirth AI plugins",
5
5
  "scripts": {
6
6
  "build": "del .\\dist\\* /s /q 2>nul & tsc",