@inkeep/agents-cli 0.5.0 → 0.6.4

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/index.js CHANGED
@@ -32,11 +32,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  mod
33
33
  ));
34
34
 
35
- // ../node_modules/.pnpm/tsup@8.5.0_jiti@2.5.1_postcss@8.5.6_tsx@4.20.5_typescript@5.9.2_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js
35
+ // ../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.0_postcss@8.5.6_tsx@4.20.5_typescript@5.9.2_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js
36
36
  import path from "path";
37
37
  import { fileURLToPath } from "url";
38
38
  var init_esm_shims = __esm({
39
- "../node_modules/.pnpm/tsup@8.5.0_jiti@2.5.1_postcss@8.5.6_tsx@4.20.5_typescript@5.9.2_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js"() {
39
+ "../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.0_postcss@8.5.6_tsx@4.20.5_typescript@5.9.2_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js"() {
40
40
  "use strict";
41
41
  }
42
42
  });
@@ -206,7 +206,7 @@ var init_logger = __esm({
206
206
  }
207
207
  });
208
208
 
209
- // ../node_modules/.pnpm/@asteasolutions+zod-to-openapi@8.1.0_zod@4.1.8/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs
209
+ // ../node_modules/.pnpm/@asteasolutions+zod-to-openapi@8.1.0_zod@4.1.11/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs
210
210
  function __rest(s2, e2) {
211
211
  var t2 = {};
212
212
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
@@ -338,7 +338,7 @@ function getOpenApiConfiguration(refOrOpenapi, metadataOrOptions, options) {
338
338
  }
339
339
  var ZodTypeKeys, $ZodRegistry, zodToOpenAPIRegistry, Metadata;
340
340
  var init_dist = __esm({
341
- "../node_modules/.pnpm/@asteasolutions+zod-to-openapi@8.1.0_zod@4.1.8/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs"() {
341
+ "../node_modules/.pnpm/@asteasolutions+zod-to-openapi@8.1.0_zod@4.1.11/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs"() {
342
342
  "use strict";
343
343
  init_esm_shims();
344
344
  ZodTypeKeys = {
@@ -531,10 +531,10 @@ var init_dist = __esm({
531
531
  }
532
532
  });
533
533
 
534
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/url.js
534
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/url.js
535
535
  var tryDecode, _decodeURI, _getQueryParam, getQueryParam, getQueryParams, decodeURIComponent_;
536
536
  var init_url = __esm({
537
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/url.js"() {
537
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/url.js"() {
538
538
  "use strict";
539
539
  init_esm_shims();
540
540
  tryDecode = (str, decoder) => {
@@ -631,52 +631,52 @@ var init_url = __esm({
631
631
  }
632
632
  });
633
633
 
634
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/cookie.js
634
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/cookie.js
635
635
  var init_cookie = __esm({
636
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/cookie.js"() {
636
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/cookie.js"() {
637
637
  "use strict";
638
638
  init_esm_shims();
639
639
  init_url();
640
640
  }
641
641
  });
642
642
 
643
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/helper/cookie/index.js
643
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/helper/cookie/index.js
644
644
  var init_cookie2 = __esm({
645
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/helper/cookie/index.js"() {
645
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/helper/cookie/index.js"() {
646
646
  "use strict";
647
647
  init_esm_shims();
648
648
  init_cookie();
649
649
  }
650
650
  });
651
651
 
652
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/http-exception.js
652
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/http-exception.js
653
653
  var init_http_exception = __esm({
654
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/http-exception.js"() {
654
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/http-exception.js"() {
655
655
  "use strict";
656
656
  init_esm_shims();
657
657
  }
658
658
  });
659
659
 
660
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/crypto.js
660
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/crypto.js
661
661
  var init_crypto = __esm({
662
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/crypto.js"() {
662
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/crypto.js"() {
663
663
  "use strict";
664
664
  init_esm_shims();
665
665
  }
666
666
  });
667
667
 
668
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/buffer.js
668
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/buffer.js
669
669
  var init_buffer = __esm({
670
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/buffer.js"() {
670
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/buffer.js"() {
671
671
  "use strict";
672
672
  init_esm_shims();
673
673
  init_crypto();
674
674
  }
675
675
  });
676
676
 
677
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/validator/validator.js
677
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/validator/validator.js
678
678
  var init_validator = __esm({
679
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/validator/validator.js"() {
679
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/validator/validator.js"() {
680
680
  "use strict";
681
681
  init_esm_shims();
682
682
  init_cookie2();
@@ -685,43 +685,43 @@ var init_validator = __esm({
685
685
  }
686
686
  });
687
687
 
688
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/validator/index.js
688
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/validator/index.js
689
689
  var init_validator2 = __esm({
690
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/validator/index.js"() {
690
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/validator/index.js"() {
691
691
  "use strict";
692
692
  init_esm_shims();
693
693
  init_validator();
694
694
  }
695
695
  });
696
696
 
697
- // ../node_modules/.pnpm/@hono+zod-validator@0.7.2_hono@4.9.7_zod@4.1.8/node_modules/@hono/zod-validator/dist/index.js
697
+ // ../node_modules/.pnpm/@hono+zod-validator@0.7.3_hono@4.9.8_zod@4.1.11/node_modules/@hono/zod-validator/dist/index.js
698
698
  var init_dist2 = __esm({
699
- "../node_modules/.pnpm/@hono+zod-validator@0.7.2_hono@4.9.7_zod@4.1.8/node_modules/@hono/zod-validator/dist/index.js"() {
699
+ "../node_modules/.pnpm/@hono+zod-validator@0.7.3_hono@4.9.8_zod@4.1.11/node_modules/@hono/zod-validator/dist/index.js"() {
700
700
  "use strict";
701
701
  init_esm_shims();
702
702
  init_validator2();
703
703
  }
704
704
  });
705
705
 
706
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/compose.js
706
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/compose.js
707
707
  var init_compose = __esm({
708
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/compose.js"() {
708
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/compose.js"() {
709
709
  "use strict";
710
710
  init_esm_shims();
711
711
  }
712
712
  });
713
713
 
714
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/request/constants.js
714
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/request/constants.js
715
715
  var GET_MATCH_RESULT;
716
716
  var init_constants = __esm({
717
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/request/constants.js"() {
717
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/request/constants.js"() {
718
718
  "use strict";
719
719
  init_esm_shims();
720
720
  GET_MATCH_RESULT = Symbol();
721
721
  }
722
722
  });
723
723
 
724
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/body.js
724
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/body.js
725
725
  async function parseFormData(request, options) {
726
726
  const formData = await request.formData();
727
727
  if (formData) {
@@ -752,7 +752,7 @@ function convertFormDataToBodyData(formData, options) {
752
752
  }
753
753
  var parseBody, handleParsingAllValues, handleParsingNestedValues;
754
754
  var init_body = __esm({
755
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/body.js"() {
755
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/body.js"() {
756
756
  "use strict";
757
757
  init_esm_shims();
758
758
  init_request();
@@ -798,10 +798,10 @@ var init_body = __esm({
798
798
  }
799
799
  });
800
800
 
801
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/request.js
801
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/request.js
802
802
  var tryDecodeURIComponent, HonoRequest;
803
803
  var init_request = __esm({
804
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/request.js"() {
804
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/request.js"() {
805
805
  "use strict";
806
806
  init_esm_shims();
807
807
  init_constants();
@@ -827,14 +827,14 @@ var init_request = __esm({
827
827
  #getDecodedParam(key) {
828
828
  const paramKey = this.#matchResult[0][this.routeIndex][1][key];
829
829
  const param = this.#getParamValue(paramKey);
830
- return param ? /\%/.test(param) ? tryDecodeURIComponent(param) : param : void 0;
830
+ return param && /\%/.test(param) ? tryDecodeURIComponent(param) : param;
831
831
  }
832
832
  #getAllDecodedParams() {
833
833
  const decoded = {};
834
834
  const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
835
835
  for (const key of keys) {
836
836
  const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
837
- if (value && typeof value === "string") {
837
+ if (value !== void 0) {
838
838
  decoded[key] = /\%/.test(value) ? tryDecodeURIComponent(value) : value;
839
839
  }
840
840
  }
@@ -919,17 +919,17 @@ var init_request = __esm({
919
919
  }
920
920
  });
921
921
 
922
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/html.js
922
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/html.js
923
923
  var init_html = __esm({
924
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/html.js"() {
924
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/html.js"() {
925
925
  "use strict";
926
926
  init_esm_shims();
927
927
  }
928
928
  });
929
929
 
930
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/context.js
930
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/context.js
931
931
  var init_context = __esm({
932
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/context.js"() {
932
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/context.js"() {
933
933
  "use strict";
934
934
  init_esm_shims();
935
935
  init_request();
@@ -937,25 +937,25 @@ var init_context = __esm({
937
937
  }
938
938
  });
939
939
 
940
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router.js
940
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router.js
941
941
  var init_router = __esm({
942
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router.js"() {
942
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router.js"() {
943
943
  "use strict";
944
944
  init_esm_shims();
945
945
  }
946
946
  });
947
947
 
948
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/constants.js
948
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/constants.js
949
949
  var init_constants2 = __esm({
950
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/utils/constants.js"() {
950
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/utils/constants.js"() {
951
951
  "use strict";
952
952
  init_esm_shims();
953
953
  }
954
954
  });
955
955
 
956
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/hono-base.js
956
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/hono-base.js
957
957
  var init_hono_base = __esm({
958
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/hono-base.js"() {
958
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/hono-base.js"() {
959
959
  "use strict";
960
960
  init_esm_shims();
961
961
  init_compose();
@@ -966,10 +966,10 @@ var init_hono_base = __esm({
966
966
  }
967
967
  });
968
968
 
969
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/reg-exp-router/node.js
969
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/reg-exp-router/node.js
970
970
  var PATH_ERROR, regExpMetaChars;
971
971
  var init_node = __esm({
972
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/reg-exp-router/node.js"() {
972
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/reg-exp-router/node.js"() {
973
973
  "use strict";
974
974
  init_esm_shims();
975
975
  PATH_ERROR = Symbol();
@@ -977,18 +977,18 @@ var init_node = __esm({
977
977
  }
978
978
  });
979
979
 
980
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/reg-exp-router/trie.js
980
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/reg-exp-router/trie.js
981
981
  var init_trie = __esm({
982
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/reg-exp-router/trie.js"() {
982
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/reg-exp-router/trie.js"() {
983
983
  "use strict";
984
984
  init_esm_shims();
985
985
  init_node();
986
986
  }
987
987
  });
988
988
 
989
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/reg-exp-router/router.js
989
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/reg-exp-router/router.js
990
990
  var init_router2 = __esm({
991
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/reg-exp-router/router.js"() {
991
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/reg-exp-router/router.js"() {
992
992
  "use strict";
993
993
  init_esm_shims();
994
994
  init_router();
@@ -998,36 +998,36 @@ var init_router2 = __esm({
998
998
  }
999
999
  });
1000
1000
 
1001
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/reg-exp-router/index.js
1001
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/reg-exp-router/index.js
1002
1002
  var init_reg_exp_router = __esm({
1003
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/reg-exp-router/index.js"() {
1003
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/reg-exp-router/index.js"() {
1004
1004
  "use strict";
1005
1005
  init_esm_shims();
1006
1006
  init_router2();
1007
1007
  }
1008
1008
  });
1009
1009
 
1010
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/smart-router/router.js
1010
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/smart-router/router.js
1011
1011
  var init_router3 = __esm({
1012
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/smart-router/router.js"() {
1012
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/smart-router/router.js"() {
1013
1013
  "use strict";
1014
1014
  init_esm_shims();
1015
1015
  init_router();
1016
1016
  }
1017
1017
  });
1018
1018
 
1019
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/smart-router/index.js
1019
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/smart-router/index.js
1020
1020
  var init_smart_router = __esm({
1021
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/smart-router/index.js"() {
1021
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/smart-router/index.js"() {
1022
1022
  "use strict";
1023
1023
  init_esm_shims();
1024
1024
  init_router3();
1025
1025
  }
1026
1026
  });
1027
1027
 
1028
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/trie-router/node.js
1028
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/trie-router/node.js
1029
1029
  var init_node2 = __esm({
1030
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/trie-router/node.js"() {
1030
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/trie-router/node.js"() {
1031
1031
  "use strict";
1032
1032
  init_esm_shims();
1033
1033
  init_router();
@@ -1035,9 +1035,9 @@ var init_node2 = __esm({
1035
1035
  }
1036
1036
  });
1037
1037
 
1038
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/trie-router/router.js
1038
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/trie-router/router.js
1039
1039
  var init_router4 = __esm({
1040
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/trie-router/router.js"() {
1040
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/trie-router/router.js"() {
1041
1041
  "use strict";
1042
1042
  init_esm_shims();
1043
1043
  init_url();
@@ -1045,18 +1045,18 @@ var init_router4 = __esm({
1045
1045
  }
1046
1046
  });
1047
1047
 
1048
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/trie-router/index.js
1048
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/trie-router/index.js
1049
1049
  var init_trie_router = __esm({
1050
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/router/trie-router/index.js"() {
1050
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/router/trie-router/index.js"() {
1051
1051
  "use strict";
1052
1052
  init_esm_shims();
1053
1053
  init_router4();
1054
1054
  }
1055
1055
  });
1056
1056
 
1057
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/hono.js
1057
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/hono.js
1058
1058
  var init_hono = __esm({
1059
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/hono.js"() {
1059
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/hono.js"() {
1060
1060
  "use strict";
1061
1061
  init_esm_shims();
1062
1062
  init_hono_base();
@@ -1066,19 +1066,19 @@ var init_hono = __esm({
1066
1066
  }
1067
1067
  });
1068
1068
 
1069
- // ../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/index.js
1069
+ // ../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/index.js
1070
1070
  var init_dist3 = __esm({
1071
- "../node_modules/.pnpm/hono@4.9.7/node_modules/hono/dist/index.js"() {
1071
+ "../node_modules/.pnpm/hono@4.9.8/node_modules/hono/dist/index.js"() {
1072
1072
  "use strict";
1073
1073
  init_esm_shims();
1074
1074
  init_hono();
1075
1075
  }
1076
1076
  });
1077
1077
 
1078
- // ../node_modules/.pnpm/@hono+zod-openapi@1.1.0_hono@4.9.7_zod@4.1.8/node_modules/@hono/zod-openapi/dist/index.js
1079
- import { ZodType, z } from "zod";
1078
+ // ../node_modules/.pnpm/@hono+zod-openapi@1.1.3_hono@4.9.8_zod@4.1.11/node_modules/@hono/zod-openapi/dist/index.js
1079
+ import { z } from "zod";
1080
1080
  var init_dist4 = __esm({
1081
- "../node_modules/.pnpm/@hono+zod-openapi@1.1.0_hono@4.9.7_zod@4.1.8/node_modules/@hono/zod-openapi/dist/index.js"() {
1081
+ "../node_modules/.pnpm/@hono+zod-openapi@1.1.3_hono@4.9.8_zod@4.1.11/node_modules/@hono/zod-openapi/dist/index.js"() {
1082
1082
  "use strict";
1083
1083
  init_esm_shims();
1084
1084
  init_dist();
@@ -1089,7 +1089,7 @@ var init_dist4 = __esm({
1089
1089
  }
1090
1090
  });
1091
1091
 
1092
- // ../node_modules/.pnpm/drizzle-zod@0.8.3_drizzle-orm@0.44.5_@libsql+client@0.15.15_@opentelemetry+api@1.9.0_@types+pg@8.15.5__zod@4.1.8/node_modules/drizzle-zod/index.mjs
1092
+ // ../node_modules/.pnpm/drizzle-zod@0.8.3_drizzle-orm@0.44.5_@libsql+client@0.15.15_@opentelemetry+api@1.9.0_@types+pg@8.15.5__zod@4.1.11/node_modules/drizzle-zod/index.mjs
1093
1093
  import { z as z2 } from "zod/v4";
1094
1094
  import { isTable, getTableColumns, getViewSelectedFields, is, Column, SQL, isView } from "drizzle-orm";
1095
1095
  function isColumnType(column, columnTypes) {
@@ -1307,7 +1307,7 @@ function handleEnum(enum_, factory) {
1307
1307
  }
1308
1308
  var CONSTANTS, isPgEnum, literalSchema, jsonSchema, bufferSchema, selectConditions, insertConditions, createSelectSchema, createInsertSchema;
1309
1309
  var init_drizzle_zod = __esm({
1310
- "../node_modules/.pnpm/drizzle-zod@0.8.3_drizzle-orm@0.44.5_@libsql+client@0.15.15_@opentelemetry+api@1.9.0_@types+pg@8.15.5__zod@4.1.8/node_modules/drizzle-zod/index.mjs"() {
1310
+ "../node_modules/.pnpm/drizzle-zod@0.8.3_drizzle-orm@0.44.5_@libsql+client@0.15.15_@opentelemetry+api@1.9.0_@types+pg@8.15.5__zod@4.1.11/node_modules/drizzle-zod/index.mjs"() {
1311
1311
  "use strict";
1312
1312
  init_esm_shims();
1313
1313
  CONSTANTS = {
@@ -1914,6 +1914,7 @@ var init_schema = __esm({
1914
1914
  // Hashed API key (never store plaintext)
1915
1915
  keyPrefix: text("key_prefix").notNull(),
1916
1916
  // First 8 chars for identification (e.g., "sk_live_abc...")
1917
+ name: text("name"),
1917
1918
  lastUsedAt: text("last_used_at"),
1918
1919
  expiresAt: text("expires_at"),
1919
1920
  createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
@@ -2326,7 +2327,7 @@ var init_utility = __esm({
2326
2327
  });
2327
2328
 
2328
2329
  // ../packages/agents-core/src/validation/schemas.ts
2329
- var StopWhenSchema, GraphStopWhenSchema, AgentStopWhenSchema, MIN_ID_LENGTH, MAX_ID_LENGTH, URL_SAFE_ID_PATTERN, resourceIdSchema, ModelSettingsSchema, ModelSchema, ProjectModelSchema, createApiSchema, createApiInsertSchema, createApiUpdateSchema, createGraphScopedApiSchema, createGraphScopedApiInsertSchema, createGraphScopedApiUpdateSchema, AgentSelectSchema, AgentInsertSchema, AgentUpdateSchema, AgentApiSelectSchema, AgentApiInsertSchema, AgentApiUpdateSchema, AgentRelationSelectSchema, AgentRelationInsertSchema, AgentRelationUpdateSchema, AgentRelationApiSelectSchema, AgentRelationApiInsertSchema, AgentRelationApiUpdateSchema, AgentRelationQuerySchema, ExternalAgentRelationInsertSchema, ExternalAgentRelationApiInsertSchema, AgentGraphSelectSchema, AgentGraphInsertSchema, AgentGraphUpdateSchema, AgentGraphApiSelectSchema, AgentGraphApiInsertSchema, AgentGraphApiUpdateSchema, TaskSelectSchema, TaskInsertSchema, TaskUpdateSchema, TaskApiSelectSchema, TaskApiInsertSchema, TaskApiUpdateSchema, TaskRelationSelectSchema, TaskRelationInsertSchema, TaskRelationUpdateSchema, TaskRelationApiSelectSchema, TaskRelationApiInsertSchema, TaskRelationApiUpdateSchema, imageUrlSchema, McpTransportConfigSchema, ToolStatusSchema, McpToolDefinitionSchema, ToolSelectSchema, ToolInsertSchema, ConversationSelectSchema, ConversationInsertSchema, ConversationUpdateSchema, ConversationApiSelectSchema, ConversationApiInsertSchema, ConversationApiUpdateSchema, MessageSelectSchema, MessageInsertSchema, MessageUpdateSchema, MessageApiSelectSchema, MessageApiInsertSchema, MessageApiUpdateSchema, ContextCacheSelectSchema, ContextCacheInsertSchema, ContextCacheUpdateSchema, ContextCacheApiSelectSchema, ContextCacheApiInsertSchema, ContextCacheApiUpdateSchema, DataComponentSelectSchema, DataComponentInsertSchema, DataComponentBaseSchema, DataComponentUpdateSchema, DataComponentApiSelectSchema, DataComponentApiInsertSchema, DataComponentApiUpdateSchema, AgentDataComponentSelectSchema, AgentDataComponentInsertSchema, AgentDataComponentUpdateSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiUpdateSchema, ArtifactComponentSelectSchema, ArtifactComponentInsertSchema, ArtifactComponentUpdateSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiUpdateSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentUpdateSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiUpdateSchema, ExternalAgentSelectSchema, ExternalAgentInsertSchema, ExternalAgentUpdateSchema, ExternalAgentApiSelectSchema, ExternalAgentApiInsertSchema, ExternalAgentApiUpdateSchema, AllAgentSchema, ApiKeySelectSchema, ApiKeyInsertSchema, ApiKeyUpdateSchema, ApiKeyApiSelectSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceInsertSchema, CredentialReferenceUpdateSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiUpdateSchema, McpToolSchema, MCPToolConfigSchema, ToolUpdateSchema, ToolApiSelectSchema, ToolApiInsertSchema, ToolApiUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, ContextConfigSelectSchema, ContextConfigInsertSchema, ContextConfigUpdateSchema, ContextConfigApiSelectSchema, ContextConfigApiInsertSchema, ContextConfigApiUpdateSchema, AgentToolRelationSelectSchema, AgentToolRelationInsertSchema, AgentToolRelationUpdateSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiUpdateSchema, LedgerArtifactSelectSchema, LedgerArtifactInsertSchema, LedgerArtifactUpdateSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiUpdateSchema, StatusComponentSchema, StatusUpdateSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, GraphWithinContextOfProjectSchema, PaginationSchema, ErrorResponseSchema, ExistsResponseSchema, RemovedResponseSchema, ProjectSelectSchema, ProjectInsertSchema, ProjectUpdateSchema, ProjectApiSelectSchema, ProjectApiInsertSchema, ProjectApiUpdateSchema, FullProjectDefinitionSchema, HeadersScopeSchema, TenantParamsSchema, TenantProjectParamsSchema, TenantProjectGraphParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectIdParamsSchema, TenantIdParamsSchema, IdParamsSchema, PaginationQueryParamsSchema;
2330
+ var StopWhenSchema, GraphStopWhenSchema, AgentStopWhenSchema, MIN_ID_LENGTH, MAX_ID_LENGTH, URL_SAFE_ID_PATTERN, resourceIdSchema, ModelSettingsSchema, ModelSchema, ProjectModelSchema, createApiSchema, createApiInsertSchema, createApiUpdateSchema, createGraphScopedApiSchema, createGraphScopedApiInsertSchema, createGraphScopedApiUpdateSchema, AgentSelectSchema, AgentInsertSchema, AgentUpdateSchema, AgentApiSelectSchema, AgentApiInsertSchema, AgentApiUpdateSchema, AgentRelationSelectSchema, AgentRelationInsertSchema, AgentRelationUpdateSchema, AgentRelationApiSelectSchema, AgentRelationApiInsertSchema, AgentRelationApiUpdateSchema, AgentRelationQuerySchema, ExternalAgentRelationInsertSchema, ExternalAgentRelationApiInsertSchema, AgentGraphSelectSchema, AgentGraphInsertSchema, AgentGraphUpdateSchema, AgentGraphApiSelectSchema, AgentGraphApiInsertSchema, AgentGraphApiUpdateSchema, TaskSelectSchema, TaskInsertSchema, TaskUpdateSchema, TaskApiSelectSchema, TaskApiInsertSchema, TaskApiUpdateSchema, TaskRelationSelectSchema, TaskRelationInsertSchema, TaskRelationUpdateSchema, TaskRelationApiSelectSchema, TaskRelationApiInsertSchema, TaskRelationApiUpdateSchema, imageUrlSchema, McpTransportConfigSchema, ToolStatusSchema, McpToolDefinitionSchema, ToolSelectSchema, ToolInsertSchema, ConversationSelectSchema, ConversationInsertSchema, ConversationUpdateSchema, ConversationApiSelectSchema, ConversationApiInsertSchema, ConversationApiUpdateSchema, MessageSelectSchema, MessageInsertSchema, MessageUpdateSchema, MessageApiSelectSchema, MessageApiInsertSchema, MessageApiUpdateSchema, ContextCacheSelectSchema, ContextCacheInsertSchema, ContextCacheUpdateSchema, ContextCacheApiSelectSchema, ContextCacheApiInsertSchema, ContextCacheApiUpdateSchema, DataComponentSelectSchema, DataComponentInsertSchema, DataComponentBaseSchema, DataComponentUpdateSchema, DataComponentApiSelectSchema, DataComponentApiInsertSchema, DataComponentApiUpdateSchema, AgentDataComponentSelectSchema, AgentDataComponentInsertSchema, AgentDataComponentUpdateSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiUpdateSchema, ArtifactComponentSelectSchema, ArtifactComponentInsertSchema, ArtifactComponentUpdateSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiUpdateSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentUpdateSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiUpdateSchema, ExternalAgentSelectSchema, ExternalAgentInsertSchema, ExternalAgentUpdateSchema, ExternalAgentApiSelectSchema, ExternalAgentApiInsertSchema, ExternalAgentApiUpdateSchema, AllAgentSchema, ApiKeySelectSchema, ApiKeyInsertSchema, ApiKeyUpdateSchema, ApiKeyApiSelectSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceInsertSchema, CredentialReferenceUpdateSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiUpdateSchema, McpToolSchema, MCPToolConfigSchema, ToolUpdateSchema, ToolApiSelectSchema, ToolApiInsertSchema, ToolApiUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, ContextConfigSelectSchema, ContextConfigInsertSchema, ContextConfigUpdateSchema, ContextConfigApiSelectSchema, ContextConfigApiInsertSchema, ContextConfigApiUpdateSchema, AgentToolRelationSelectSchema, AgentToolRelationInsertSchema, AgentToolRelationUpdateSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiUpdateSchema, LedgerArtifactSelectSchema, LedgerArtifactInsertSchema, LedgerArtifactUpdateSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiUpdateSchema, StatusComponentSchema, StatusUpdateSchema, CanUseItemSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, GraphWithinContextOfProjectSchema, PaginationSchema, ErrorResponseSchema, ExistsResponseSchema, RemovedResponseSchema, ProjectSelectSchema, ProjectInsertSchema, ProjectUpdateSchema, ProjectApiSelectSchema, ProjectApiInsertSchema, ProjectApiUpdateSchema, FullProjectDefinitionSchema, HeadersScopeSchema, TenantParamsSchema, TenantProjectParamsSchema, TenantProjectGraphParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectIdParamsSchema, TenantIdParamsSchema, IdParamsSchema, PaginationQueryParamsSchema;
2330
2331
  var init_schemas = __esm({
2331
2332
  "../packages/agents-core/src/validation/schemas.ts"() {
2332
2333
  "use strict";
@@ -2565,8 +2566,6 @@ var init_schemas = __esm({
2565
2566
  projectId: true,
2566
2567
  createdAt: true,
2567
2568
  updatedAt: true
2568
- }).extend({
2569
- id: resourceIdSchema.optional()
2570
2569
  });
2571
2570
  ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
2572
2571
  ArtifactComponentUpdateSchema
@@ -2785,10 +2784,13 @@ var init_schemas = __esm({
2785
2784
  prompt: z.string().max(2e3, "Custom prompt cannot exceed 2000 characters").optional(),
2786
2785
  statusComponents: z.array(StatusComponentSchema).optional()
2787
2786
  });
2787
+ CanUseItemSchema = z.object({
2788
+ toolId: z.string(),
2789
+ toolSelection: z.array(z.string()).nullable().optional()
2790
+ });
2788
2791
  FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
2789
2792
  type: z.literal("internal"),
2790
- tools: z.array(z.string()),
2791
- selectedTools: z.record(z.string(), z.array(z.string())).optional(),
2793
+ canUse: z.array(CanUseItemSchema),
2792
2794
  dataComponents: z.array(z.string()).optional(),
2793
2795
  artifactComponents: z.array(z.string()).optional(),
2794
2796
  canTransferTo: z.array(z.string()).optional(),
@@ -4549,7 +4551,7 @@ var init_client = __esm({
4549
4551
  }
4550
4552
  });
4551
4553
 
4552
- // ../node_modules/.pnpm/nanoid@5.1.5/node_modules/nanoid/index.js
4554
+ // ../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.js
4553
4555
  import { webcrypto as crypto2 } from "crypto";
4554
4556
  function fillPool(bytes) {
4555
4557
  if (!pool || pool.length < bytes) {
@@ -4570,6 +4572,7 @@ function customRandom(alphabet, defaultSize, getRandom) {
4570
4572
  let mask = (2 << 31 - Math.clz32(alphabet.length - 1 | 1)) - 1;
4571
4573
  let step = Math.ceil(1.6 * mask * defaultSize / alphabet.length);
4572
4574
  return (size = defaultSize) => {
4575
+ if (!size) return "";
4573
4576
  let id = "";
4574
4577
  while (true) {
4575
4578
  let bytes = getRandom(step);
@@ -4586,7 +4589,7 @@ function customAlphabet(alphabet, size = 21) {
4586
4589
  }
4587
4590
  var POOL_SIZE_MULTIPLIER, pool, poolOffset;
4588
4591
  var init_nanoid = __esm({
4589
- "../node_modules/.pnpm/nanoid@5.1.5/node_modules/nanoid/index.js"() {
4592
+ "../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.js"() {
4590
4593
  "use strict";
4591
4594
  init_esm_shims();
4592
4595
  POOL_SIZE_MULTIPLIER = 128;
@@ -7833,7 +7836,7 @@ var require_compile = __commonJS({
7833
7836
  const schOrFunc = root.refs[ref];
7834
7837
  if (schOrFunc)
7835
7838
  return schOrFunc;
7836
- let _sch = resolve4.call(this, root, ref);
7839
+ let _sch = resolve6.call(this, root, ref);
7837
7840
  if (_sch === void 0) {
7838
7841
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
7839
7842
  const { schemaId } = this.opts;
@@ -7860,7 +7863,7 @@ var require_compile = __commonJS({
7860
7863
  function sameSchemaEnv(s1, s2) {
7861
7864
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
7862
7865
  }
7863
- function resolve4(root, ref) {
7866
+ function resolve6(root, ref) {
7864
7867
  let sch;
7865
7868
  while (typeof (sch = this.refs[ref]) == "string")
7866
7869
  ref = sch;
@@ -8438,55 +8441,55 @@ var require_fast_uri = __commonJS({
8438
8441
  }
8439
8442
  return uri;
8440
8443
  }
8441
- function resolve4(baseURI, relativeURI, options) {
8444
+ function resolve6(baseURI, relativeURI, options) {
8442
8445
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
8443
8446
  const resolved = resolveComponent(parse2(baseURI, schemelessOptions), parse2(relativeURI, schemelessOptions), schemelessOptions, true);
8444
8447
  schemelessOptions.skipEscape = true;
8445
8448
  return serialize2(resolved, schemelessOptions);
8446
8449
  }
8447
- function resolveComponent(base, relative2, options, skipNormalization) {
8450
+ function resolveComponent(base, relative, options, skipNormalization) {
8448
8451
  const target = {};
8449
8452
  if (!skipNormalization) {
8450
8453
  base = parse2(serialize2(base, options), options);
8451
- relative2 = parse2(serialize2(relative2, options), options);
8454
+ relative = parse2(serialize2(relative, options), options);
8452
8455
  }
8453
8456
  options = options || {};
8454
- if (!options.tolerant && relative2.scheme) {
8455
- target.scheme = relative2.scheme;
8456
- target.userinfo = relative2.userinfo;
8457
- target.host = relative2.host;
8458
- target.port = relative2.port;
8459
- target.path = removeDotSegments(relative2.path || "");
8460
- target.query = relative2.query;
8457
+ if (!options.tolerant && relative.scheme) {
8458
+ target.scheme = relative.scheme;
8459
+ target.userinfo = relative.userinfo;
8460
+ target.host = relative.host;
8461
+ target.port = relative.port;
8462
+ target.path = removeDotSegments(relative.path || "");
8463
+ target.query = relative.query;
8461
8464
  } else {
8462
- if (relative2.userinfo !== void 0 || relative2.host !== void 0 || relative2.port !== void 0) {
8463
- target.userinfo = relative2.userinfo;
8464
- target.host = relative2.host;
8465
- target.port = relative2.port;
8466
- target.path = removeDotSegments(relative2.path || "");
8467
- target.query = relative2.query;
8465
+ if (relative.userinfo !== void 0 || relative.host !== void 0 || relative.port !== void 0) {
8466
+ target.userinfo = relative.userinfo;
8467
+ target.host = relative.host;
8468
+ target.port = relative.port;
8469
+ target.path = removeDotSegments(relative.path || "");
8470
+ target.query = relative.query;
8468
8471
  } else {
8469
- if (!relative2.path) {
8472
+ if (!relative.path) {
8470
8473
  target.path = base.path;
8471
- if (relative2.query !== void 0) {
8472
- target.query = relative2.query;
8474
+ if (relative.query !== void 0) {
8475
+ target.query = relative.query;
8473
8476
  } else {
8474
8477
  target.query = base.query;
8475
8478
  }
8476
8479
  } else {
8477
- if (relative2.path[0] === "/") {
8478
- target.path = removeDotSegments(relative2.path);
8480
+ if (relative.path[0] === "/") {
8481
+ target.path = removeDotSegments(relative.path);
8479
8482
  } else {
8480
8483
  if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
8481
- target.path = "/" + relative2.path;
8484
+ target.path = "/" + relative.path;
8482
8485
  } else if (!base.path) {
8483
- target.path = relative2.path;
8486
+ target.path = relative.path;
8484
8487
  } else {
8485
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative2.path;
8488
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
8486
8489
  }
8487
8490
  target.path = removeDotSegments(target.path);
8488
8491
  }
8489
- target.query = relative2.query;
8492
+ target.query = relative.query;
8490
8493
  }
8491
8494
  target.userinfo = base.userinfo;
8492
8495
  target.host = base.host;
@@ -8494,7 +8497,7 @@ var require_fast_uri = __commonJS({
8494
8497
  }
8495
8498
  target.scheme = base.scheme;
8496
8499
  }
8497
- target.fragment = relative2.fragment;
8500
+ target.fragment = relative.fragment;
8498
8501
  return target;
8499
8502
  }
8500
8503
  function equal(uriA, uriB, options) {
@@ -8665,7 +8668,7 @@ var require_fast_uri = __commonJS({
8665
8668
  var fastUri = {
8666
8669
  SCHEMES,
8667
8670
  normalize,
8668
- resolve: resolve4,
8671
+ resolve: resolve6,
8669
8672
  resolveComponent,
8670
8673
  equal,
8671
8674
  serialize: serialize2,
@@ -12485,11 +12488,11 @@ var init_execution = __esm({
12485
12488
  }
12486
12489
  });
12487
12490
 
12488
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
12491
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
12489
12492
  import { z as z4 } from "zod";
12490
12493
  var JSONRPC_VERSION, ProgressTokenSchema, CursorSchema, RequestMetaSchema, BaseRequestParamsSchema, RequestSchema, BaseNotificationParamsSchema, NotificationSchema, ResultSchema, RequestIdSchema, JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResponseSchema, ErrorCode2, JSONRPCErrorSchema, JSONRPCMessageSchema, EmptyResultSchema, CancelledNotificationSchema, IconSchema, BaseMetadataSchema, ImplementationSchema, ClientCapabilitiesSchema, InitializeRequestSchema, ServerCapabilitiesSchema, InitializeResultSchema, InitializedNotificationSchema, PingRequestSchema, ProgressSchema, ProgressNotificationSchema, PaginatedRequestSchema, PaginatedResultSchema, ResourceContentsSchema, TextResourceContentsSchema, Base64Schema, BlobResourceContentsSchema, ResourceSchema, ResourceTemplateSchema, ListResourcesRequestSchema, ListResourcesResultSchema, ListResourceTemplatesRequestSchema, ListResourceTemplatesResultSchema, ReadResourceRequestSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, ResourceUpdatedNotificationSchema, PromptArgumentSchema, PromptSchema, ListPromptsRequestSchema, ListPromptsResultSchema, GetPromptRequestSchema, TextContentSchema, ImageContentSchema, AudioContentSchema, EmbeddedResourceSchema, ResourceLinkSchema, ContentBlockSchema, PromptMessageSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ToolAnnotationsSchema, ToolSchema, ListToolsRequestSchema, ListToolsResultSchema, CallToolResultSchema, CompatibilityCallToolResultSchema, CallToolRequestSchema, ToolListChangedNotificationSchema, LoggingLevelSchema, SetLevelRequestSchema, LoggingMessageNotificationSchema, ModelHintSchema, ModelPreferencesSchema, SamplingMessageSchema, CreateMessageRequestSchema, CreateMessageResultSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema, EnumSchemaSchema, PrimitiveSchemaDefinitionSchema, ElicitRequestSchema, ElicitResultSchema, ResourceTemplateReferenceSchema, PromptReferenceSchema, CompleteRequestSchema, CompleteResultSchema, RootSchema, ListRootsRequestSchema, ListRootsResultSchema, RootsListChangedNotificationSchema, ClientRequestSchema, ClientNotificationSchema, ClientResultSchema, ServerRequestSchema, ServerNotificationSchema, ServerResultSchema;
12491
12494
  var init_types3 = __esm({
12492
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js"() {
12495
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js"() {
12493
12496
  "use strict";
12494
12497
  init_esm_shims();
12495
12498
  JSONRPC_VERSION = "2.0";
@@ -13462,9 +13465,9 @@ var init_types3 = __esm({
13462
13465
  }
13463
13466
  });
13464
13467
 
13465
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
13468
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
13466
13469
  var init_protocol = __esm({
13467
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js"() {
13470
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js"() {
13468
13471
  "use strict";
13469
13472
  init_esm_shims();
13470
13473
  init_types3();
@@ -14160,51 +14163,51 @@ var require_uri_all = __commonJS({
14160
14163
  }
14161
14164
  return uriTokens.join("");
14162
14165
  }
14163
- function resolveComponents(base2, relative2) {
14166
+ function resolveComponents(base2, relative) {
14164
14167
  var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
14165
14168
  var skipNormalization = arguments[3];
14166
14169
  var target = {};
14167
14170
  if (!skipNormalization) {
14168
14171
  base2 = parse2(serialize2(base2, options), options);
14169
- relative2 = parse2(serialize2(relative2, options), options);
14172
+ relative = parse2(serialize2(relative, options), options);
14170
14173
  }
14171
14174
  options = options || {};
14172
- if (!options.tolerant && relative2.scheme) {
14173
- target.scheme = relative2.scheme;
14174
- target.userinfo = relative2.userinfo;
14175
- target.host = relative2.host;
14176
- target.port = relative2.port;
14177
- target.path = removeDotSegments(relative2.path || "");
14178
- target.query = relative2.query;
14175
+ if (!options.tolerant && relative.scheme) {
14176
+ target.scheme = relative.scheme;
14177
+ target.userinfo = relative.userinfo;
14178
+ target.host = relative.host;
14179
+ target.port = relative.port;
14180
+ target.path = removeDotSegments(relative.path || "");
14181
+ target.query = relative.query;
14179
14182
  } else {
14180
- if (relative2.userinfo !== void 0 || relative2.host !== void 0 || relative2.port !== void 0) {
14181
- target.userinfo = relative2.userinfo;
14182
- target.host = relative2.host;
14183
- target.port = relative2.port;
14184
- target.path = removeDotSegments(relative2.path || "");
14185
- target.query = relative2.query;
14183
+ if (relative.userinfo !== void 0 || relative.host !== void 0 || relative.port !== void 0) {
14184
+ target.userinfo = relative.userinfo;
14185
+ target.host = relative.host;
14186
+ target.port = relative.port;
14187
+ target.path = removeDotSegments(relative.path || "");
14188
+ target.query = relative.query;
14186
14189
  } else {
14187
- if (!relative2.path) {
14190
+ if (!relative.path) {
14188
14191
  target.path = base2.path;
14189
- if (relative2.query !== void 0) {
14190
- target.query = relative2.query;
14192
+ if (relative.query !== void 0) {
14193
+ target.query = relative.query;
14191
14194
  } else {
14192
14195
  target.query = base2.query;
14193
14196
  }
14194
14197
  } else {
14195
- if (relative2.path.charAt(0) === "/") {
14196
- target.path = removeDotSegments(relative2.path);
14198
+ if (relative.path.charAt(0) === "/") {
14199
+ target.path = removeDotSegments(relative.path);
14197
14200
  } else {
14198
14201
  if ((base2.userinfo !== void 0 || base2.host !== void 0 || base2.port !== void 0) && !base2.path) {
14199
- target.path = "/" + relative2.path;
14202
+ target.path = "/" + relative.path;
14200
14203
  } else if (!base2.path) {
14201
- target.path = relative2.path;
14204
+ target.path = relative.path;
14202
14205
  } else {
14203
- target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative2.path;
14206
+ target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative.path;
14204
14207
  }
14205
14208
  target.path = removeDotSegments(target.path);
14206
14209
  }
14207
- target.query = relative2.query;
14210
+ target.query = relative.query;
14208
14211
  }
14209
14212
  target.userinfo = base2.userinfo;
14210
14213
  target.host = base2.host;
@@ -14212,10 +14215,10 @@ var require_uri_all = __commonJS({
14212
14215
  }
14213
14216
  target.scheme = base2.scheme;
14214
14217
  }
14215
- target.fragment = relative2.fragment;
14218
+ target.fragment = relative.fragment;
14216
14219
  return target;
14217
14220
  }
14218
- function resolve4(baseURI, relativeURI, options) {
14221
+ function resolve6(baseURI, relativeURI, options) {
14219
14222
  var schemelessOptions = assign({ scheme: "null" }, options);
14220
14223
  return serialize2(resolveComponents(parse2(baseURI, schemelessOptions), parse2(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
14221
14224
  }
@@ -14480,7 +14483,7 @@ var require_uri_all = __commonJS({
14480
14483
  exports2.removeDotSegments = removeDotSegments;
14481
14484
  exports2.serialize = serialize2;
14482
14485
  exports2.resolveComponents = resolveComponents;
14483
- exports2.resolve = resolve4;
14486
+ exports2.resolve = resolve6;
14484
14487
  exports2.normalize = normalize;
14485
14488
  exports2.equal = equal;
14486
14489
  exports2.escapeComponent = escapeComponent;
@@ -14803,18 +14806,18 @@ var require_resolve2 = __commonJS({
14803
14806
  var util = require_util2();
14804
14807
  var SchemaObject = require_schema_obj();
14805
14808
  var traverse = require_json_schema_traverse2();
14806
- module.exports = resolve4;
14807
- resolve4.normalizeId = normalizeId;
14808
- resolve4.fullPath = getFullPath;
14809
- resolve4.url = resolveUrl;
14810
- resolve4.ids = resolveIds;
14811
- resolve4.inlineRef = inlineRef;
14812
- resolve4.schema = resolveSchema;
14813
- function resolve4(compile, root, ref) {
14809
+ module.exports = resolve6;
14810
+ resolve6.normalizeId = normalizeId;
14811
+ resolve6.fullPath = getFullPath;
14812
+ resolve6.url = resolveUrl;
14813
+ resolve6.ids = resolveIds;
14814
+ resolve6.inlineRef = inlineRef;
14815
+ resolve6.schema = resolveSchema;
14816
+ function resolve6(compile, root, ref) {
14814
14817
  var refVal = this._refs[ref];
14815
14818
  if (typeof refVal == "string") {
14816
14819
  if (this._refs[refVal]) refVal = this._refs[refVal];
14817
- else return resolve4.call(this, compile, root, refVal);
14820
+ else return resolve6.call(this, compile, root, refVal);
14818
14821
  }
14819
14822
  refVal = refVal || this._schemas[ref];
14820
14823
  if (refVal instanceof SchemaObject) {
@@ -15020,7 +15023,7 @@ var require_error_classes = __commonJS({
15020
15023
  "../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/error_classes.js"(exports, module) {
15021
15024
  "use strict";
15022
15025
  init_esm_shims();
15023
- var resolve4 = require_resolve2();
15026
+ var resolve6 = require_resolve2();
15024
15027
  module.exports = {
15025
15028
  Validation: errorSubclass(ValidationError),
15026
15029
  MissingRef: errorSubclass(MissingRefError)
@@ -15035,8 +15038,8 @@ var require_error_classes = __commonJS({
15035
15038
  };
15036
15039
  function MissingRefError(baseId, ref, message) {
15037
15040
  this.message = message || MissingRefError.message(baseId, ref);
15038
- this.missingRef = resolve4.url(baseId, ref);
15039
- this.missingSchema = resolve4.normalizeId(resolve4.fullPath(this.missingRef));
15041
+ this.missingRef = resolve6.url(baseId, ref);
15042
+ this.missingSchema = resolve6.normalizeId(resolve6.fullPath(this.missingRef));
15040
15043
  }
15041
15044
  function errorSubclass(Subclass) {
15042
15045
  Subclass.prototype = Object.create(Error.prototype);
@@ -15567,7 +15570,7 @@ var require_compile2 = __commonJS({
15567
15570
  "../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/index.js"(exports, module) {
15568
15571
  "use strict";
15569
15572
  init_esm_shims();
15570
- var resolve4 = require_resolve2();
15573
+ var resolve6 = require_resolve2();
15571
15574
  var util = require_util2();
15572
15575
  var errorClasses = require_error_classes();
15573
15576
  var stableStringify = require_fast_json_stable_stringify();
@@ -15625,7 +15628,7 @@ var require_compile2 = __commonJS({
15625
15628
  RULES,
15626
15629
  validate: validateGenerator,
15627
15630
  util,
15628
- resolve: resolve4,
15631
+ resolve: resolve6,
15629
15632
  resolveRef,
15630
15633
  usePattern,
15631
15634
  useDefault,
@@ -15685,7 +15688,7 @@ var require_compile2 = __commonJS({
15685
15688
  return validate;
15686
15689
  }
15687
15690
  function resolveRef(baseId2, ref, isRoot) {
15688
- ref = resolve4.url(baseId2, ref);
15691
+ ref = resolve6.url(baseId2, ref);
15689
15692
  var refIndex = refs[ref];
15690
15693
  var _refVal, refCode;
15691
15694
  if (refIndex !== void 0) {
@@ -15702,11 +15705,11 @@ var require_compile2 = __commonJS({
15702
15705
  }
15703
15706
  }
15704
15707
  refCode = addLocalRef(ref);
15705
- var v3 = resolve4.call(self, localCompile, root, ref);
15708
+ var v3 = resolve6.call(self, localCompile, root, ref);
15706
15709
  if (v3 === void 0) {
15707
15710
  var localSchema = localRefs && localRefs[ref];
15708
15711
  if (localSchema) {
15709
- v3 = resolve4.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile.call(self, localSchema, root, localRefs, baseId2);
15712
+ v3 = resolve6.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile.call(self, localSchema, root, localRefs, baseId2);
15710
15713
  }
15711
15714
  }
15712
15715
  if (v3 === void 0) {
@@ -19349,7 +19352,7 @@ var require_ajv2 = __commonJS({
19349
19352
  "use strict";
19350
19353
  init_esm_shims();
19351
19354
  var compileSchema = require_compile2();
19352
- var resolve4 = require_resolve2();
19355
+ var resolve6 = require_resolve2();
19353
19356
  var Cache = require_cache();
19354
19357
  var SchemaObject = require_schema_obj();
19355
19358
  var stableStringify = require_fast_json_stable_stringify();
@@ -19431,7 +19434,7 @@ var require_ajv2 = __commonJS({
19431
19434
  var id = this._getId(schema);
19432
19435
  if (id !== void 0 && typeof id != "string")
19433
19436
  throw new Error("schema id must be string");
19434
- key = resolve4.normalizeId(key || id);
19437
+ key = resolve6.normalizeId(key || id);
19435
19438
  checkUnique(this, key);
19436
19439
  this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
19437
19440
  return this;
@@ -19475,7 +19478,7 @@ var require_ajv2 = __commonJS({
19475
19478
  }
19476
19479
  }
19477
19480
  function _getSchemaFragment(self, ref) {
19478
- var res = resolve4.schema.call(self, { schema: {} }, ref);
19481
+ var res = resolve6.schema.call(self, { schema: {} }, ref);
19479
19482
  if (res) {
19480
19483
  var schema = res.schema, root = res.root, baseId = res.baseId;
19481
19484
  var v2 = compileSchema.call(self, schema, root, void 0, baseId);
@@ -19491,7 +19494,7 @@ var require_ajv2 = __commonJS({
19491
19494
  }
19492
19495
  }
19493
19496
  function _getSchemaObj(self, keyRef) {
19494
- keyRef = resolve4.normalizeId(keyRef);
19497
+ keyRef = resolve6.normalizeId(keyRef);
19495
19498
  return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
19496
19499
  }
19497
19500
  function removeSchema(schemaKeyRef) {
@@ -19518,7 +19521,7 @@ var require_ajv2 = __commonJS({
19518
19521
  this._cache.del(cacheKey);
19519
19522
  var id = this._getId(schemaKeyRef);
19520
19523
  if (id) {
19521
- id = resolve4.normalizeId(id);
19524
+ id = resolve6.normalizeId(id);
19522
19525
  delete this._schemas[id];
19523
19526
  delete this._refs[id];
19524
19527
  }
@@ -19542,13 +19545,13 @@ var require_ajv2 = __commonJS({
19542
19545
  var cached = this._cache.get(cacheKey);
19543
19546
  if (cached) return cached;
19544
19547
  shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
19545
- var id = resolve4.normalizeId(this._getId(schema));
19548
+ var id = resolve6.normalizeId(this._getId(schema));
19546
19549
  if (id && shouldAddSchema) checkUnique(this, id);
19547
19550
  var willValidate = this._opts.validateSchema !== false && !skipValidation;
19548
19551
  var recursiveMeta;
19549
- if (willValidate && !(recursiveMeta = id && id == resolve4.normalizeId(schema.$schema)))
19552
+ if (willValidate && !(recursiveMeta = id && id == resolve6.normalizeId(schema.$schema)))
19550
19553
  this.validateSchema(schema, true);
19551
- var localRefs = resolve4.ids.call(this, schema);
19554
+ var localRefs = resolve6.ids.call(this, schema);
19552
19555
  var schemaObj = new SchemaObject({
19553
19556
  id,
19554
19557
  schema,
@@ -19696,10 +19699,10 @@ var require_ajv2 = __commonJS({
19696
19699
  }
19697
19700
  });
19698
19701
 
19699
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
19702
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
19700
19703
  var import_ajv;
19701
19704
  var init_client2 = __esm({
19702
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js"() {
19705
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js"() {
19703
19706
  "use strict";
19704
19707
  init_esm_shims();
19705
19708
  init_protocol();
@@ -19720,11 +19723,11 @@ var init_index_node = __esm({
19720
19723
  }
19721
19724
  });
19722
19725
 
19723
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
19726
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
19724
19727
  import { z as z5 } from "zod";
19725
19728
  var SafeUrlSchema, OAuthProtectedResourceMetadataSchema, OAuthMetadataSchema, OpenIdProviderMetadataSchema, OpenIdProviderDiscoveryMetadataSchema, OAuthTokensSchema, OAuthErrorResponseSchema, OAuthClientMetadataSchema, OAuthClientInformationSchema, OAuthClientInformationFullSchema, OAuthClientRegistrationErrorSchema, OAuthTokenRevocationRequestSchema;
19726
19729
  var init_auth = __esm({
19727
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js"() {
19730
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js"() {
19728
19731
  "use strict";
19729
19732
  init_esm_shims();
19730
19733
  SafeUrlSchema = z5.string().url().superRefine((val, ctx) => {
@@ -19866,18 +19869,18 @@ var init_auth = __esm({
19866
19869
  }
19867
19870
  });
19868
19871
 
19869
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
19872
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
19870
19873
  var init_auth_utils = __esm({
19871
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js"() {
19874
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js"() {
19872
19875
  "use strict";
19873
19876
  init_esm_shims();
19874
19877
  }
19875
19878
  });
19876
19879
 
19877
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
19880
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
19878
19881
  var OAuthError, InvalidRequestError, InvalidClientError, InvalidGrantError, UnauthorizedClientError, UnsupportedGrantTypeError, InvalidScopeError, AccessDeniedError, ServerError, TemporarilyUnavailableError, UnsupportedResponseTypeError, UnsupportedTokenTypeError, InvalidTokenError, MethodNotAllowedError, TooManyRequestsError, InvalidClientMetadataError, InsufficientScopeError, OAUTH_ERRORS;
19879
19882
  var init_errors = __esm({
19880
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js"() {
19883
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js"() {
19881
19884
  "use strict";
19882
19885
  init_esm_shims();
19883
19886
  OAuthError = class extends Error {
@@ -19972,9 +19975,9 @@ var init_errors = __esm({
19972
19975
  }
19973
19976
  });
19974
19977
 
19975
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
19978
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
19976
19979
  var init_auth2 = __esm({
19977
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js"() {
19980
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js"() {
19978
19981
  "use strict";
19979
19982
  init_esm_shims();
19980
19983
  init_index_node();
@@ -19986,9 +19989,9 @@ var init_auth2 = __esm({
19986
19989
  }
19987
19990
  });
19988
19991
 
19989
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
19992
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
19990
19993
  var init_sse = __esm({
19991
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js"() {
19994
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js"() {
19992
19995
  "use strict";
19993
19996
  init_esm_shims();
19994
19997
  init_types3();
@@ -19996,9 +19999,9 @@ var init_sse = __esm({
19996
19999
  }
19997
20000
  });
19998
20001
 
19999
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
20002
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
20000
20003
  var init_streamableHttp = __esm({
20001
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.0/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js"() {
20004
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.18.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js"() {
20002
20005
  "use strict";
20003
20006
  init_esm_shims();
20004
20007
  init_types3();
@@ -20578,7 +20581,7 @@ var init_env = __esm({
20578
20581
  loadEnvironmentFiles();
20579
20582
  envSchema = z9.object({
20580
20583
  ENVIRONMENT: z9.enum(["development", "production", "pentest", "test"]).optional(),
20581
- DB_FILE_NAME: z9.string(),
20584
+ DB_FILE_NAME: z9.string().optional(),
20582
20585
  OTEL_TRACES_FORCE_FLUSH_ENABLED: z9.coerce.boolean().optional()
20583
20586
  });
20584
20587
  parseEnv = () => {
@@ -20781,9 +20784,8 @@ async function getTenantId(configPath) {
20781
20784
  const config = await loadConfig(configPath);
20782
20785
  return config.tenantId;
20783
20786
  }
20784
- async function getProjectId(configPath) {
20785
- const config = await loadConfig(configPath);
20786
- return config.projectId || "default";
20787
+ async function getProjectId(_configPath) {
20788
+ return "default";
20787
20789
  }
20788
20790
  async function getAgentsManageApiUrl(overrideUrl, configPath) {
20789
20791
  if (overrideUrl) {
@@ -20799,93 +20801,35 @@ async function getAgentsRunApiUrl(overrideUrl, configPath) {
20799
20801
  const config = await loadConfig(configPath);
20800
20802
  return config.agentsRunApiUrl || "http://localhost:3003";
20801
20803
  }
20802
- async function validateConfiguration(tenantIdFlag, agentsManageApiUrlFlag, agentsRunApiUrlFlag, configFilePath) {
20803
- if (configFilePath && tenantIdFlag) {
20804
- throw new Error(
20805
- "Invalid configuration combination:\nCannot use --config-file-path with --tenant-id.\nPlease use either:\n 1. --config-file-path alone\n 2. --tenant-id with --agents-manage-api-url and --agents-run-api-url\n 3. Default config file (inkeep.config.ts)"
20806
- );
20807
- }
20808
- if (configFilePath) {
20809
- const config2 = await loadConfig(configFilePath);
20810
- const tenantId2 = config2.tenantId;
20811
- const projectId2 = config2.projectId || "default";
20812
- const agentsManageApiUrl2 = agentsManageApiUrlFlag || config2.agentsManageApiUrl;
20813
- const agentsRunApiUrl2 = agentsRunApiUrlFlag || config2.agentsRunApiUrl;
20814
- if (!tenantId2) {
20815
- throw new Error(
20816
- `Tenant ID is missing from configuration file: ${configFilePath}
20817
- Please ensure your config file exports a valid configuration with tenantId.`
20818
- );
20819
- }
20820
- if (!agentsManageApiUrl2) {
20821
- throw new Error(
20822
- `Agents Manage API URL is missing from configuration file: ${configFilePath}
20823
- Please ensure your config file exports a valid configuration with agentsManageApiUrl.`
20824
- );
20825
- }
20826
- if (!agentsRunApiUrl2) {
20827
- throw new Error(
20828
- `Agents Run API URL is missing from configuration file: ${configFilePath}
20829
- Please ensure your config file exports a valid configuration with agentsRunApiUrl.`
20830
- );
20831
- }
20832
- const sources2 = {
20833
- tenantId: `config file (${configFilePath})`,
20834
- projectId: config2.projectId ? `config file (${configFilePath})` : "default",
20835
- agentsManageApiUrl: agentsManageApiUrlFlag ? "command-line flag (--agents-manage-api-url)" : `config file (${configFilePath})`,
20836
- agentsRunApiUrl: agentsRunApiUrlFlag ? "command-line flag (--agents-run-api-url)" : `config file (${configFilePath})`,
20837
- configFile: configFilePath
20838
- };
20839
- return {
20840
- tenantId: tenantId2,
20841
- projectId: projectId2,
20842
- agentsManageApiUrl: agentsManageApiUrl2,
20843
- agentsRunApiUrl: agentsRunApiUrl2,
20844
- manageUiUrl: config2.manageUiUrl,
20845
- modelSettings: config2.modelSettings || void 0,
20846
- sources: sources2
20847
- };
20848
- }
20804
+ async function validateConfiguration(tenantIdFlag, agentsManageApiUrlFlag, agentsRunApiUrlFlag, configPath) {
20805
+ const config = await loadConfig(configPath);
20806
+ const tenantId = tenantIdFlag || config.tenantId;
20807
+ const agentsManageApiUrl = agentsManageApiUrlFlag || config.agentsManageApiUrl;
20808
+ const agentsRunApiUrl = agentsRunApiUrlFlag || config.agentsRunApiUrl;
20809
+ const actualConfigFile = configPath || findConfigFile();
20849
20810
  if (tenantIdFlag && agentsManageApiUrlFlag && agentsRunApiUrlFlag) {
20850
20811
  const sources2 = {
20851
20812
  tenantId: "command-line flag (--tenant-id)",
20852
- projectId: "default",
20853
20813
  agentsManageApiUrl: "command-line flag (--agents-manage-api-url)",
20854
20814
  agentsRunApiUrl: "command-line flag (--agents-run-api-url)"
20855
20815
  };
20856
20816
  return {
20857
20817
  tenantId: tenantIdFlag,
20858
- projectId: "default",
20859
20818
  agentsManageApiUrl: agentsManageApiUrlFlag,
20860
20819
  agentsRunApiUrl: agentsRunApiUrlFlag,
20861
- manageUiUrl: void 0,
20862
- modelSettings: void 0,
20820
+ manageUiUrl: config.manageUiUrl,
20863
20821
  sources: sources2
20864
20822
  };
20865
20823
  }
20866
- if (tenantIdFlag && !agentsManageApiUrlFlag && !agentsRunApiUrlFlag) {
20867
- throw new Error(
20868
- "Invalid configuration:\n--tenant-id requires --agents-manage-api-url and --agents-run-api-url to be provided as well.\nPlease provide both --tenant-id and --agents-manage-api-url and --agents-run-api-url together."
20869
- );
20870
- }
20871
- const config = await loadConfig();
20872
- const tenantId = config.tenantId;
20873
- const projectId = config.projectId || "default";
20874
- const agentsManageApiUrl = agentsManageApiUrlFlag || config.agentsManageApiUrl;
20875
- const agentsRunApiUrl = agentsRunApiUrlFlag || config.agentsRunApiUrl;
20876
20824
  if (!tenantId) {
20877
- const configFile2 = findConfigFile();
20878
- if (!configFile2) {
20825
+ if (actualConfigFile) {
20879
20826
  throw new Error(
20880
- 'No configuration found. Please use one of:\n 1. Create "inkeep.config.ts" by running "inkeep init"\n 2. Provide --config-file-path to specify a config file\n 3. Provide both --tenant-id and --agents-manage-api-url and --agents-run-api-url flags\n 4. Set INKEEP_AGENTS_MANAGE_API_URL and INKEEP_AGENTS_RUN_API_URL environment variables'
20827
+ `Tenant ID is missing from configuration file: ${actualConfigFile}
20828
+ Please ensure your config file exports a valid configuration with tenantId.`
20881
20829
  );
20882
20830
  } else {
20883
20831
  throw new Error(
20884
- `Tenant ID is missing from configuration file: ${configFile2}
20885
- Please either:
20886
- 1. Update your configuration file with a tenantId
20887
- 2. Provide both --tenant-id and --agents-manage-api-url and --agents-run-api-url flags
20888
- `
20832
+ 'No configuration found. Please use one of:\n 1. Create "inkeep.config.ts" by running "inkeep init"\n 2. Provide --config to specify a config file\n 3. Provide --tenant-id, --agents-manage-api-url and --agents-run-api-url flags'
20889
20833
  );
20890
20834
  }
20891
20835
  }
@@ -20899,37 +20843,19 @@ Please either:
20899
20843
  "Agents Run API URL is missing. Please either:\n 1. Provide --agents-run-api-url flag\n 2. Set INKEEP_AGENTS_RUN_API_URL environment variable\n 3. Add agentsRunApiUrl to your configuration file"
20900
20844
  );
20901
20845
  }
20902
- const configFile = findConfigFile();
20903
- let agentsManageApiUrlSource = configFile ? `config file (${configFile})` : "default";
20904
- let agentsRunApiUrlSource = configFile ? `config file (${configFile})` : "default";
20905
- if (agentsManageApiUrlFlag) {
20906
- agentsManageApiUrlSource = "command-line flag (--agents-manage-api-url)";
20907
- } else if (process.env.INKEEP_AGENTS_MANAGE_API_URL === agentsManageApiUrl) {
20908
- agentsManageApiUrlSource = "environment variable (INKEEP_AGENTS_MANAGE_API_URL)";
20909
- } else if (agentsManageApiUrl === "http://localhost:3002" && !configFile) {
20910
- agentsManageApiUrlSource = "default value";
20911
- }
20912
- if (agentsRunApiUrlFlag) {
20913
- agentsRunApiUrlSource = "command-line flag (--agents-run-api-url)";
20914
- } else if (process.env.INKEEP_AGENTS_RUN_API_URL === agentsRunApiUrl) {
20915
- agentsRunApiUrlSource = "environment variable (INKEEP_AGENTS_RUN_API_URL)";
20916
- } else if (agentsRunApiUrl === "http://localhost:3003" && !configFile) {
20917
- agentsRunApiUrlSource = "default value";
20918
- }
20919
20846
  const sources = {
20920
- tenantId: `config file (${configFile})`,
20921
- projectId: config.projectId ? configFile ? `config file (${configFile})` : "config" : "default",
20922
- agentsManageApiUrl: agentsManageApiUrlSource,
20923
- agentsRunApiUrl: agentsRunApiUrlSource,
20924
- configFile: configFile || void 0
20847
+ tenantId: tenantIdFlag ? "command-line flag (--tenant-id)" : actualConfigFile ? `config file (${actualConfigFile})` : "default",
20848
+ agentsManageApiUrl: agentsManageApiUrlFlag ? "command-line flag (--agents-manage-api-url)" : process.env.INKEEP_AGENTS_MANAGE_API_URL === agentsManageApiUrl ? "environment variable (INKEEP_AGENTS_MANAGE_API_URL)" : actualConfigFile ? `config file (${actualConfigFile})` : "default value",
20849
+ agentsRunApiUrl: agentsRunApiUrlFlag ? "command-line flag (--agents-run-api-url)" : process.env.INKEEP_AGENTS_RUN_API_URL === agentsRunApiUrl ? "environment variable (INKEEP_AGENTS_RUN_API_URL)" : actualConfigFile ? `config file (${actualConfigFile})` : "default value"
20925
20850
  };
20851
+ if (actualConfigFile) {
20852
+ sources.configFile = actualConfigFile;
20853
+ }
20926
20854
  return {
20927
20855
  tenantId,
20928
- projectId,
20929
20856
  agentsManageApiUrl,
20930
20857
  agentsRunApiUrl,
20931
20858
  manageUiUrl: config.manageUiUrl,
20932
- modelSettings: config.modelSettings || void 0,
20933
20859
  sources
20934
20860
  };
20935
20861
  }
@@ -21098,16 +21024,17 @@ __export(chat_enhanced_exports, {
21098
21024
  });
21099
21025
  import * as readline from "readline";
21100
21026
  import chalk8 from "chalk";
21101
- import inquirer3 from "inquirer";
21027
+ import inquirer2 from "inquirer";
21102
21028
  import ora6 from "ora";
21103
21029
  async function chatCommandEnhanced(graphIdInput, options) {
21104
21030
  let config;
21105
21031
  try {
21032
+ const configPath2 = options?.config || options?.configFilePath;
21106
21033
  config = await validateConfiguration(
21107
21034
  options?.tenantId,
21108
21035
  options?.agentsManageApiUrl,
21109
21036
  options?.agentsRunApiUrl,
21110
- options?.configFilePath
21037
+ configPath2
21111
21038
  );
21112
21039
  } catch (error) {
21113
21040
  console.error(chalk8.red(error.message));
@@ -21118,14 +21045,15 @@ async function chatCommandEnhanced(graphIdInput, options) {
21118
21045
  console.log(chalk8.gray(` \u2022 Management API: ${config.sources.agentsManageApiUrl}`));
21119
21046
  console.log(chalk8.gray(` \u2022 Execution API: ${config.sources.agentsRunApiUrl}`));
21120
21047
  console.log();
21048
+ const configPath = options?.config || options?.configFilePath;
21121
21049
  const managementApi = await ManagementApiClient.create(
21122
21050
  config.agentsManageApiUrl,
21123
- options?.configFilePath,
21051
+ configPath,
21124
21052
  config.tenantId
21125
21053
  );
21126
21054
  const executionApi = await ExecutionApiClient.create(
21127
21055
  config.agentsRunApiUrl,
21128
- options?.configFilePath,
21056
+ configPath,
21129
21057
  config.tenantId
21130
21058
  );
21131
21059
  let graphId = graphIdInput;
@@ -21146,7 +21074,7 @@ async function chatCommandEnhanced(graphIdInput, options) {
21146
21074
  short: g.id,
21147
21075
  searchText: `${g.id} ${g.name || ""}`.toLowerCase()
21148
21076
  }));
21149
- const answer = await inquirer3.prompt([
21077
+ const answer = await inquirer2.prompt([
21150
21078
  {
21151
21079
  type: "list",
21152
21080
  name: "graphId",
@@ -21401,8 +21329,8 @@ var init_chat_enhanced = __esm({
21401
21329
  // src/index.ts
21402
21330
  init_esm_shims();
21403
21331
  init_env2();
21404
- import { readFileSync as readFileSync2 } from "fs";
21405
- import { dirname as dirname4, join as join10 } from "path";
21332
+ import { readFileSync as readFileSync3 } from "fs";
21333
+ import { dirname as dirname5, join as join10 } from "path";
21406
21334
  import { fileURLToPath as fileURLToPath2 } from "url";
21407
21335
  import { Command } from "commander";
21408
21336
 
@@ -21478,12 +21406,12 @@ import { existsSync, readFileSync, writeFileSync } from "fs";
21478
21406
  import { join } from "path";
21479
21407
  import chalk2 from "chalk";
21480
21408
  async function configGetCommand(key, options) {
21481
- const configPath = options?.configFilePath || join(process.cwd(), "inkeep.config.ts");
21409
+ const configPath = options?.config || options?.configFilePath || join(process.cwd(), "inkeep.config.ts");
21482
21410
  if (!existsSync(configPath)) {
21483
21411
  console.error(chalk2.red("No configuration file found."));
21484
21412
  console.log(
21485
21413
  chalk2.gray(
21486
- 'Run "inkeep init" to create one, or specify a config file with --config-file-path'
21414
+ 'Run "inkeep init" to create one, or specify a config file with --config'
21487
21415
  )
21488
21416
  );
21489
21417
  process.exit(1);
@@ -21517,7 +21445,7 @@ async function configGetCommand(key, options) {
21517
21445
  }
21518
21446
  }
21519
21447
  async function configSetCommand(key, value, options) {
21520
- const configPath = options?.configFilePath || join(process.cwd(), "inkeep.config.ts");
21448
+ const configPath = options?.config || options?.configFilePath || join(process.cwd(), "inkeep.config.ts");
21521
21449
  if (!["tenantId", "apiUrl"].includes(key)) {
21522
21450
  console.error(chalk2.red(`Invalid configuration key: ${key}`));
21523
21451
  console.log(chalk2.gray("Available keys: tenantId, apiUrl"));
@@ -21536,7 +21464,6 @@ async function configSetCommand(key, value, options) {
21536
21464
 
21537
21465
  export default defineConfig({
21538
21466
  tenantId: '${key === "tenantId" ? value : ""}',
21539
- projectId: '${key === "projectId" ? value : "default"}',
21540
21467
  apiUrl: '${key === "apiUrl" ? value : "http://localhost:3002"}',
21541
21468
  });
21542
21469
  `;
@@ -21560,16 +21487,6 @@ export default defineConfig({
21560
21487
  tenantId: '${value}',`
21561
21488
  );
21562
21489
  }
21563
- } else if (key === "projectId") {
21564
- if (content.includes("projectId:")) {
21565
- content = content.replace(/projectId:\s*['"][^'"]*['"]/, `projectId: '${value}'`);
21566
- } else {
21567
- content = content.replace(
21568
- /(tenantId:\s*['"][^'"]*['"]),?/,
21569
- `$1,
21570
- projectId: '${value}',`
21571
- );
21572
- }
21573
21490
  } else if (key === "apiUrl") {
21574
21491
  if (content.includes("apiUrl:")) {
21575
21492
  content = content.replace(/apiUrl:\s*['"][^'"]*['"]/, `apiUrl: '${value}'`);
@@ -21603,16 +21520,19 @@ import chalk3 from "chalk";
21603
21520
  import fs4 from "fs-extra";
21604
21521
  import ora2 from "ora";
21605
21522
  var require2 = createRequire(import.meta.url);
21606
- function resolveWebRuntime() {
21523
+ function resolveWebRuntime(isRoot = false) {
21607
21524
  try {
21608
21525
  const pkg = require2.resolve("@inkeep/agents-manage-ui/package.json");
21609
21526
  const root = dirname(pkg);
21527
+ if (isRoot) {
21528
+ return root;
21529
+ }
21610
21530
  return join2(root, ".next/standalone/agents-manage-ui");
21611
21531
  } catch (err) {
21612
21532
  throw new Error(`Could not find @inkeep/agents-manage-ui package. ${err}`);
21613
21533
  }
21614
21534
  }
21615
- function startWebApp({ port = 3e3, host = "localhost" }) {
21535
+ function startWebApp({ port, host }) {
21616
21536
  console.log("");
21617
21537
  const spinner = ora2("Starting dashboard server...").start();
21618
21538
  try {
@@ -21656,37 +21576,9 @@ function startWebApp({ port = 3e3, host = "localhost" }) {
21656
21576
  process.exit(1);
21657
21577
  }
21658
21578
  }
21659
- async function copyVercelOutput() {
21660
- const spinner = ora2("Copying Vercel output...").start();
21661
- try {
21662
- const pkg = require2.resolve("@inkeep/agents-manage-ui/package.json");
21663
- const root = dirname(pkg);
21664
- const sourceOutputPath = join2(root, ".vercel", "output");
21665
- if (!existsSync2(sourceOutputPath)) {
21666
- spinner.fail("Vercel output not found");
21667
- console.error(chalk3.red("The Vercel output has not been built yet in the package."));
21668
- process.exit(1);
21669
- }
21670
- const destVercelDir = join2(process.cwd(), ".vercel");
21671
- const destOutputPath = join2(destVercelDir, "output");
21672
- await fs4.ensureDir(destVercelDir);
21673
- if (existsSync2(destOutputPath)) {
21674
- await fs4.remove(destOutputPath);
21675
- }
21676
- await fs4.copy(sourceOutputPath, destOutputPath);
21677
- spinner.succeed(`Vercel output copied to .vercel/output/`);
21678
- console.log("");
21679
- console.log(chalk3.blue("\u{1F680} Ready for Vercel deployment"));
21680
- console.log(chalk3.gray("Run: vercel deploy --prebuilt --prod"));
21681
- console.log("");
21682
- } catch (error) {
21683
- spinner.fail("Failed to copy Vercel output");
21684
- console.error(chalk3.red("Error:"), error instanceof Error ? error.message : "Unknown error");
21685
- throw error;
21686
- }
21687
- }
21688
- async function buildForVercel({ outputDir = "./vercel-build" }) {
21689
- const spinner = ora2("Creating Vercel-ready build...").start();
21579
+ async function buildNextApp({ outputDir }) {
21580
+ console.log("");
21581
+ const spinner = ora2("Building Standalone build...").start();
21690
21582
  try {
21691
21583
  const pkg = require2.resolve("@inkeep/agents-manage-ui/package.json");
21692
21584
  const root = dirname(pkg);
@@ -21699,6 +21591,9 @@ async function buildForVercel({ outputDir = "./vercel-build" }) {
21699
21591
  if (existsSync2(outputDir)) {
21700
21592
  await fs4.remove(outputDir);
21701
21593
  }
21594
+ if (existsSync2(outputDir)) {
21595
+ await fs4.remove(outputDir);
21596
+ }
21702
21597
  await fs4.ensureDir(outputDir);
21703
21598
  await fs4.copy(standalonePath, outputDir);
21704
21599
  const packageJson2 = {
@@ -21712,42 +21607,7 @@ async function buildForVercel({ outputDir = "./vercel-build" }) {
21712
21607
  }
21713
21608
  };
21714
21609
  await fs4.writeJson(join2(outputDir, "package.json"), packageJson2, { spaces: 2 });
21715
- const vercelConfig = {
21716
- version: 2,
21717
- builds: [
21718
- {
21719
- src: "server.js",
21720
- use: "@vercel/node"
21721
- }
21722
- ],
21723
- routes: [
21724
- {
21725
- src: "/(.*)",
21726
- dest: "server.js"
21727
- }
21728
- ]
21729
- };
21730
- await fs4.writeJson(join2(outputDir, "vercel.json"), vercelConfig, { spaces: 2 });
21731
- const instructions = `# Inkeep Dashboard - Vercel Deployment
21732
-
21733
- ## Quick Deploy
21734
-
21735
- 1. Go to https://vercel.com/dashboard
21736
- 2. Click "New Project"
21737
- 3. Upload this folder or connect to GitHub
21738
- 4. Set environment variables:
21739
- - INKEEP_API_URL=your-api-url
21740
- - INKEEP_TENANT_ID=your-tenant-id
21741
- - NODE_ENV=production
21742
- 5. Deploy!
21743
-
21744
- ## Using Vercel CLI
21745
-
21746
- \`\`\`bash
21747
- cd ${outputDir}
21748
- vercel --prod
21749
- \`\`\`
21750
-
21610
+ const instructions = `
21751
21611
  ## Environment Variables
21752
21612
 
21753
21613
  Make sure to set these in your Vercel project settings:
@@ -21755,37 +21615,39 @@ Make sure to set these in your Vercel project settings:
21755
21615
  - INKEEP_TENANT_ID
21756
21616
  - Any other variables from your .env file
21757
21617
  `;
21758
- await fs4.writeFile(join2(outputDir, "README-VERCEL.md"), instructions);
21759
- spinner.succeed(`Vercel-ready build created at ${outputDir}/`);
21618
+ await fs4.writeFile(join2(outputDir, "README.md"), instructions);
21619
+ spinner.succeed(`Build created at ${outputDir}/`);
21620
+ console.log("");
21621
+ console.log(chalk3.green("\u2705 Build completed successfully!"));
21622
+ console.log("");
21623
+ console.log(chalk3.blue("\u{1F4C1} To run your dashboard:"));
21624
+ console.log(chalk3.gray(" cd"), chalk3.white(outputDir));
21625
+ console.log(chalk3.gray(" npm start"));
21760
21626
  console.log("");
21761
- console.log(chalk3.blue("\u{1F680} Start script:"), "node server.js");
21627
+ console.log(chalk3.blue("\u{1F310} Or with pnpm:"));
21628
+ console.log(chalk3.gray(" cd"), chalk3.white(outputDir));
21629
+ console.log(chalk3.gray(" pnpm start"));
21630
+ console.log("");
21631
+ console.log(chalk3.yellow("\u{1F4D6} See README.md for deployment instructions"));
21762
21632
  console.log("");
21763
- console.log(chalk3.yellow("\u{1F4D6} See README-VERCEL.md for deployment instructions"));
21764
21633
  } catch (error) {
21765
- spinner.fail("Failed to create Vercel build");
21634
+ spinner.fail("Failed to build dashboard");
21766
21635
  console.error(chalk3.red("Error:"), error instanceof Error ? error.message : "Unknown error");
21767
21636
  throw error;
21768
21637
  }
21769
21638
  }
21770
21639
  async function devCommand(options) {
21771
- const {
21772
- port = 3e3,
21773
- host = "localhost",
21774
- build = false,
21775
- outputDir = "./vercel-build",
21776
- vercel = false
21777
- } = options;
21778
- if (vercel) {
21779
- await copyVercelOutput();
21640
+ const { port, host, build, outputDir, path: path3 } = options;
21641
+ if (path3) {
21642
+ const rt = resolveWebRuntime(true);
21643
+ console.log(rt);
21780
21644
  return;
21781
21645
  }
21782
21646
  if (build) {
21783
- await buildForVercel({ outputDir });
21784
- console.log("");
21785
- console.log(chalk3.blue("Next steps: Deploy the build folder to Vercel"));
21647
+ await buildNextApp({ outputDir });
21786
21648
  return;
21787
21649
  }
21788
- startWebApp({ port, host });
21650
+ await startWebApp({ port, host });
21789
21651
  }
21790
21652
 
21791
21653
  // src/commands/init.ts
@@ -21793,109 +21655,7 @@ init_esm_shims();
21793
21655
  import { existsSync as existsSync3, readdirSync, writeFileSync as writeFileSync2 } from "fs";
21794
21656
  import { basename, dirname as dirname2, join as join3, resolve } from "path";
21795
21657
  import chalk4 from "chalk";
21796
- import inquirer2 from "inquirer";
21797
-
21798
- // src/utils/model-config.ts
21799
- init_esm_shims();
21800
21658
  import inquirer from "inquirer";
21801
- async function promptForModelConfiguration() {
21802
- const { providers } = await inquirer.prompt([
21803
- {
21804
- type: "checkbox",
21805
- name: "providers",
21806
- message: "Which AI providers would you like to configure?",
21807
- choices: [
21808
- { name: "Anthropic (Claude)", value: "anthropic" },
21809
- { name: "OpenAI (GPT)", value: "openai" },
21810
- { name: "Google (Gemini)", value: "google" }
21811
- ],
21812
- validate: (input) => {
21813
- if (input.length === 0) {
21814
- return "Please select at least one provider";
21815
- }
21816
- return true;
21817
- }
21818
- }
21819
- ]);
21820
- const anthropicModels = [
21821
- { name: "Claude Opus 4.1", value: "anthropic/claude-opus-4-1-20250805" },
21822
- { name: "Claude Sonnet 4", value: "anthropic/claude-sonnet-4-20250514" },
21823
- { name: "Claude Haiku 3.5", value: "anthropic/claude-3-5-haiku-20241022" }
21824
- ];
21825
- const openaiModels = [
21826
- { name: "GPT-4.1", value: "openai/gpt-4.1-2025-04-14" },
21827
- { name: "GPT-4.1 Mini", value: "openai/gpt-4.1-mini-2025-04-14" },
21828
- { name: "GPT-4.1 Nano", value: "openai/gpt-4.1-nano-2025-04-14" },
21829
- { name: "GPT-5", value: "openai/gpt-5-2025-08-07" },
21830
- { name: "GPT-5 Mini", value: "openai/gpt-5-mini-2025-08-07" },
21831
- { name: "GPT-5 Nano", value: "openai/gpt-5-nano-2025-08-07" }
21832
- ];
21833
- const googleModels = [
21834
- { name: "Gemini 2.5 Pro", value: "google/gemini-2.5-pro" },
21835
- { name: "Gemini 2.5 Flash", value: "google/gemini-2.5-flash" },
21836
- { name: "Gemini 2.5 Flash Lite", value: "google/gemini-2.5-flash-lite" }
21837
- ];
21838
- const availableModels = [];
21839
- if (providers.includes("anthropic")) {
21840
- availableModels.push(...anthropicModels);
21841
- }
21842
- if (providers.includes("openai")) {
21843
- availableModels.push(...openaiModels);
21844
- }
21845
- if (providers.includes("google")) {
21846
- availableModels.push(...googleModels);
21847
- }
21848
- const modelAnswers = await inquirer.prompt([
21849
- {
21850
- type: "list",
21851
- name: "baseModel",
21852
- message: "Select your default model for general tasks (required):",
21853
- choices: availableModels
21854
- },
21855
- {
21856
- type: "confirm",
21857
- name: "configureOptionalModels",
21858
- message: "Would you like to configure optional models for structured output and summaries?",
21859
- default: false
21860
- }
21861
- ]);
21862
- let optionalModels = {};
21863
- if (modelAnswers.configureOptionalModels) {
21864
- const optionalChoices = [...availableModels, { name: "Use base model", value: null }];
21865
- optionalModels = await inquirer.prompt([
21866
- {
21867
- type: "list",
21868
- name: "structuredOutputModel",
21869
- message: "Select your model for structured output tasks (or use base model):",
21870
- choices: optionalChoices
21871
- },
21872
- {
21873
- type: "list",
21874
- name: "summarizerModel",
21875
- message: "Select your model for summaries and quick tasks (or use base model):",
21876
- choices: optionalChoices
21877
- }
21878
- ]);
21879
- }
21880
- const modelSettings = {
21881
- base: {
21882
- model: modelAnswers.baseModel
21883
- }
21884
- };
21885
- if (optionalModels.structuredOutputModel) {
21886
- modelSettings.structuredOutput = {
21887
- model: optionalModels.structuredOutputModel
21888
- };
21889
- }
21890
- if (optionalModels.summarizerModel) {
21891
- modelSettings.summarizer = {
21892
- model: optionalModels.summarizerModel
21893
- };
21894
- }
21895
- return { modelSettings };
21896
- }
21897
-
21898
- // src/commands/init.ts
21899
21659
  function findProjectRoot(startPath) {
21900
21660
  let currentPath = resolve(startPath);
21901
21661
  const root = dirname2(currentPath);
@@ -21936,7 +21696,7 @@ async function initCommand(options) {
21936
21696
  if (options?.interactive === false) {
21937
21697
  configPath = suggestedPath;
21938
21698
  } else {
21939
- const { confirmedPath } = await inquirer2.prompt([
21699
+ const { confirmedPath } = await inquirer.prompt([
21940
21700
  {
21941
21701
  type: "input",
21942
21702
  name: "confirmedPath",
@@ -21960,7 +21720,7 @@ async function initCommand(options) {
21960
21720
  }
21961
21721
  }
21962
21722
  if (existsSync3(configPath)) {
21963
- const { overwrite } = await inquirer2.prompt([
21723
+ const { overwrite } = await inquirer.prompt([
21964
21724
  {
21965
21725
  type: "confirm",
21966
21726
  name: "overwrite",
@@ -21973,7 +21733,7 @@ async function initCommand(options) {
21973
21733
  return;
21974
21734
  }
21975
21735
  }
21976
- const answers = await inquirer2.prompt([
21736
+ const answers = await inquirer.prompt([
21977
21737
  {
21978
21738
  type: "input",
21979
21739
  name: "tenantId",
@@ -21985,18 +21745,6 @@ async function initCommand(options) {
21985
21745
  return true;
21986
21746
  }
21987
21747
  },
21988
- {
21989
- type: "input",
21990
- name: "projectId",
21991
- message: "Enter your project ID:",
21992
- default: "default",
21993
- validate: (input) => {
21994
- if (!input || input.trim() === "") {
21995
- return "Project ID is required";
21996
- }
21997
- return true;
21998
- }
21999
- },
22000
21748
  {
22001
21749
  type: "input",
22002
21750
  name: "apiUrl",
@@ -22012,15 +21760,12 @@ async function initCommand(options) {
22012
21760
  }
22013
21761
  }
22014
21762
  ]);
22015
- const { modelSettings } = await promptForModelConfiguration();
22016
21763
  const configContent = `import { defineConfig } from '@inkeep/agents-cli/config';
22017
21764
 
22018
21765
  export default defineConfig({
22019
21766
  tenantId: '${answers.tenantId}',
22020
- projectId: '${answers.projectId}',
22021
21767
  agentsManageApiUrl: '${answers.apiUrl}',
22022
21768
  agentsRunApiUrl: '${answers.apiUrl}',
22023
- modelSettings: ${JSON.stringify(modelSettings, null, 2)},
22024
21769
  });
22025
21770
  `;
22026
21771
  try {
@@ -22052,12 +21797,13 @@ import ora3 from "ora";
22052
21797
  async function listGraphsCommand(options) {
22053
21798
  let config;
22054
21799
  try {
21800
+ const configPath2 = options.config || options.configFilePath;
22055
21801
  config = await validateConfiguration(
22056
21802
  options.tenantId,
22057
21803
  options.agentsManageApiUrl,
22058
21804
  void 0,
22059
21805
  // agentsRunApiUrl not needed for list-graphs
22060
- options.configFilePath
21806
+ configPath2
22061
21807
  );
22062
21808
  } catch (error) {
22063
21809
  console.error(chalk5.red(error.message));
@@ -22067,18 +21813,21 @@ async function listGraphsCommand(options) {
22067
21813
  console.log(chalk5.gray(` \u2022 Tenant ID: ${config.sources.tenantId}`));
22068
21814
  console.log(chalk5.gray(` \u2022 API URL: ${config.sources.agentsManageApiUrl}`));
22069
21815
  console.log();
21816
+ const configPath = options.config || options.configFilePath;
22070
21817
  const api = await ManagementApiClient.create(
22071
21818
  config.agentsManageApiUrl,
22072
- options.configFilePath,
22073
- config.tenantId
21819
+ configPath,
21820
+ config.tenantId,
21821
+ options.project
21822
+ // pass project ID as projectIdOverride
22074
21823
  );
22075
21824
  const spinner = ora3("Fetching graphs...").start();
22076
21825
  try {
22077
21826
  const graphs = await api.listGraphs();
22078
- spinner.succeed(`Found ${graphs.length} graph(s)`);
21827
+ spinner.succeed(`Found ${graphs.length} graph(s) in project "${options.project}"`);
22079
21828
  if (graphs.length === 0) {
22080
21829
  console.log(
22081
- chalk5.gray("No graphs found. Define graphs in your project and run: inkeep push")
21830
+ chalk5.gray(`No graphs found in project "${options.project}". Define graphs in your project and run: inkeep push`)
22082
21831
  );
22083
21832
  return;
22084
21833
  }
@@ -22115,112 +21864,150 @@ ${table.toString()}`);
22115
21864
  // src/commands/pull.ts
22116
21865
  init_esm_shims();
22117
21866
  init_env2();
22118
- import { existsSync as existsSync7, writeFileSync as writeFileSync3 } from "fs";
22119
- import { join as join7 } from "path";
21867
+ init_tsx_loader();
21868
+ import { existsSync as existsSync6, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync4 } from "fs";
21869
+ import { dirname as dirname4, join as join7, resolve as resolve4 } from "path";
22120
21870
  import chalk6 from "chalk";
22121
21871
  import ora4 from "ora";
22122
-
22123
- // src/utils/file-finder.ts
22124
- init_esm_shims();
22125
- import { existsSync as existsSync5, readdirSync as readdirSync2, statSync } from "fs";
22126
- import { join as join5, relative } from "path";
22127
- function findAllTypeScriptFiles(rootDir, excludeDirs = []) {
22128
- const tsFiles = [];
22129
- function scanDirectory(dir) {
22130
- if (!existsSync5(dir)) {
22131
- return;
22132
- }
22133
- const items = readdirSync2(dir);
22134
- for (const item of items) {
22135
- const fullPath = join5(dir, item);
22136
- const relativePath = relative(rootDir, fullPath);
22137
- const isExcludedDir = excludeDirs.some(
22138
- (excludeDir) => relativePath === excludeDir || relativePath.startsWith(`${excludeDir}/`)
22139
- );
22140
- if (isExcludedDir) {
22141
- continue;
22142
- }
22143
- const stat = statSync(fullPath);
22144
- if (stat.isDirectory()) {
22145
- scanDirectory(fullPath);
22146
- } else if (stat.isFile() && item.endsWith(".ts")) {
22147
- tsFiles.push(fullPath);
22148
- }
22149
- }
22150
- }
22151
- scanDirectory(rootDir);
22152
- return tsFiles.sort();
22153
- }
22154
- function categorizeTypeScriptFiles(files, rootDir) {
22155
- const indexFile = files.find((file) => file.endsWith("/index.ts") || file === join5(rootDir, "index.ts")) || null;
22156
- const configFiles = [];
22157
- const graphFiles = [];
22158
- const agentFiles = [];
22159
- const toolFiles = [];
22160
- const otherFiles = [];
22161
- for (const file of files) {
22162
- const fileName = file.split("/").pop() || "";
22163
- const relativePath = relative(rootDir, file);
22164
- if (file === indexFile) {
22165
- continue;
22166
- }
22167
- if (fileName.includes(".config.") || fileName.includes(".env.") || fileName === "inkeep.config.ts") {
22168
- configFiles.push(file);
22169
- } else if (fileName.includes(".graph.") || relativePath.includes("graphs/")) {
22170
- graphFiles.push(file);
22171
- } else if (fileName.includes("agent") || fileName.includes("Agent") || relativePath.includes("agents/")) {
22172
- agentFiles.push(file);
22173
- } else if (fileName.includes("tool") || fileName.includes("Tool") || relativePath.includes("tools/")) {
22174
- toolFiles.push(file);
22175
- } else {
22176
- otherFiles.push(file);
22177
- }
22178
- }
22179
- return {
22180
- indexFile,
22181
- configFiles,
22182
- graphFiles,
22183
- agentFiles,
22184
- toolFiles,
22185
- otherFiles
22186
- };
22187
- }
21872
+ import prompts from "prompts";
22188
21873
 
22189
21874
  // src/utils/project-directory.ts
22190
21875
  init_esm_shims();
22191
- import { existsSync as existsSync6 } from "fs";
22192
- import { join as join6, resolve as resolve3 } from "path";
21876
+ import { existsSync as existsSync5 } from "fs";
21877
+ import { join as join5, resolve as resolve3 } from "path";
22193
21878
  import { findUp } from "find-up";
22194
- async function findProjectDirectory(projectId) {
21879
+ async function findProjectDirectory(projectId, configPath) {
21880
+ if (configPath) {
21881
+ const absoluteConfigPath = resolve3(process.cwd(), configPath);
21882
+ if (existsSync5(absoluteConfigPath)) {
21883
+ return resolve3(absoluteConfigPath, "..");
21884
+ }
21885
+ }
22195
21886
  if (projectId) {
22196
21887
  if (projectId.includes("/") || projectId.includes("\\")) {
22197
21888
  const projectPath = resolve3(process.cwd(), projectId);
22198
- if (existsSync6(join6(projectPath, "inkeep.config.ts"))) {
21889
+ if (existsSync5(join5(projectPath, "inkeep.config.ts"))) {
22199
21890
  return projectPath;
22200
21891
  }
22201
21892
  } else {
22202
- const projectPath = join6(process.cwd(), projectId);
22203
- if (existsSync6(join6(projectPath, "inkeep.config.ts"))) {
21893
+ const projectPath = join5(process.cwd(), projectId);
21894
+ if (existsSync5(join5(projectPath, "inkeep.config.ts"))) {
22204
21895
  return projectPath;
22205
21896
  }
22206
21897
  }
22207
21898
  return null;
22208
21899
  }
22209
- const configPath = await findUp("inkeep.config.ts");
22210
- if (configPath) {
22211
- return resolve3(configPath, "..");
21900
+ const foundConfigPath = await findUp("inkeep.config.ts");
21901
+ if (foundConfigPath) {
21902
+ return resolve3(foundConfigPath, "..");
22212
21903
  }
22213
21904
  return null;
22214
21905
  }
22215
21906
 
22216
- // src/commands/pull.ts
22217
- init_tsx_loader();
22218
-
22219
21907
  // src/commands/pull.llm-generate.ts
22220
21908
  init_esm_shims();
21909
+ import { writeFileSync as writeFileSync3 } from "fs";
21910
+ import { join as join6 } from "path";
22221
21911
  import { anthropic, createAnthropic } from "@ai-sdk/anthropic";
22222
21912
  import { createOpenAI, openai } from "@ai-sdk/openai";
22223
21913
  import { generateText } from "ai";
21914
+
21915
+ // src/commands/pull.placeholder-system.ts
21916
+ init_esm_shims();
21917
+ import { randomBytes as randomBytes2 } from "crypto";
21918
+ var MIN_REPLACEMENT_LENGTH = 50;
21919
+ function generateShortId(length = 8) {
21920
+ return randomBytes2(Math.ceil(length / 2)).toString("hex").slice(0, length);
21921
+ }
21922
+ function generatePlaceholder(jsonPath) {
21923
+ const shortId = generateShortId(8);
21924
+ return `<{{${jsonPath}.${shortId}}}>`;
21925
+ }
21926
+ function shouldReplaceString(value, placeholder) {
21927
+ return value.length >= MIN_REPLACEMENT_LENGTH && placeholder.length < value.length;
21928
+ }
21929
+ function processObject(obj, tracker, path3 = "") {
21930
+ if (typeof obj === "string") {
21931
+ const existingPlaceholder = tracker.valueToPlaceholder.get(obj);
21932
+ if (existingPlaceholder) {
21933
+ return existingPlaceholder;
21934
+ }
21935
+ const placeholder = generatePlaceholder(path3);
21936
+ if (shouldReplaceString(obj, placeholder)) {
21937
+ const existingValue = tracker.placeholderToValue.get(placeholder);
21938
+ if (existingValue && existingValue !== obj) {
21939
+ throw new Error(
21940
+ `Placeholder collision detected: placeholder '${placeholder}' already exists with different value. Existing value length: ${existingValue.length}, New value length: ${obj.length}`
21941
+ );
21942
+ }
21943
+ tracker.placeholderToValue.set(placeholder, obj);
21944
+ tracker.valueToPlaceholder.set(obj, placeholder);
21945
+ return placeholder;
21946
+ }
21947
+ return obj;
21948
+ }
21949
+ if (Array.isArray(obj)) {
21950
+ return obj.map((item, index2) => processObject(item, tracker, `${path3}[${index2}]`));
21951
+ }
21952
+ if (obj && typeof obj === "object") {
21953
+ const result = {};
21954
+ for (const [key, value] of Object.entries(obj)) {
21955
+ const currentPath = path3 ? `${path3}.${key}` : key;
21956
+ result[key] = processObject(value, tracker, currentPath);
21957
+ }
21958
+ return result;
21959
+ }
21960
+ return obj;
21961
+ }
21962
+ function createPlaceholders(data) {
21963
+ const tracker = {
21964
+ placeholderToValue: /* @__PURE__ */ new Map(),
21965
+ valueToPlaceholder: /* @__PURE__ */ new Map()
21966
+ };
21967
+ try {
21968
+ const processedData = processObject(data, tracker);
21969
+ const replacements = {};
21970
+ for (const [placeholder, value] of tracker.placeholderToValue.entries()) {
21971
+ replacements[placeholder] = value;
21972
+ }
21973
+ return {
21974
+ processedData,
21975
+ replacements
21976
+ };
21977
+ } catch (error) {
21978
+ console.warn("Placeholder creation failed, using original data:", error);
21979
+ return {
21980
+ processedData: data,
21981
+ replacements: {}
21982
+ };
21983
+ }
21984
+ }
21985
+ function restorePlaceholders(generatedCode, replacements) {
21986
+ let restoredCode = generatedCode;
21987
+ const sortedPlaceholders = Object.keys(replacements).sort((a, b2) => b2.length - a.length);
21988
+ for (const placeholder of sortedPlaceholders) {
21989
+ let originalValue = replacements[placeholder];
21990
+ originalValue = originalValue.replace(/`/g, "\\`");
21991
+ const escapedPlaceholder = placeholder.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
21992
+ const regex = new RegExp(escapedPlaceholder, "g");
21993
+ restoredCode = restoredCode.replace(regex, originalValue);
21994
+ }
21995
+ return restoredCode;
21996
+ }
21997
+ function calculateTokenSavings(originalData, processedData) {
21998
+ const originalSize = JSON.stringify(originalData).length;
21999
+ const processedSize = JSON.stringify(processedData).length;
22000
+ const savings = originalSize - processedSize;
22001
+ const savingsPercentage = originalSize > 0 ? savings / originalSize * 100 : 0;
22002
+ return {
22003
+ originalSize,
22004
+ processedSize,
22005
+ savings,
22006
+ savingsPercentage
22007
+ };
22008
+ }
22009
+
22010
+ // src/commands/pull.llm-generate.ts
22224
22011
  function createModel(config) {
22225
22012
  if (!config.model) {
22226
22013
  throw new Error("Model configuration is required for pull command");
@@ -22245,6 +22032,79 @@ function createModel(config) {
22245
22032
  throw new Error(`Unsupported provider: ${provider}`);
22246
22033
  }
22247
22034
  }
22035
+ var NAMING_CONVENTION_RULES = `
22036
+ CRITICAL NAMING CONVENTION RULES (Apply to ALL imports/exports):
22037
+ - File paths ALWAYS use the exact original ID (e.g., '../tools/inkeep_facts', '../data-components/user-profile')
22038
+ - Import/export names MUST be camelCase versions of the ID
22039
+ - Conversion rules for import/export names:
22040
+ - IDs with underscores: 'inkeep_facts' \u2192 inkeepFacts
22041
+ - IDs with hyphens: 'weather-api' \u2192 weatherApi
22042
+ - IDs with both: 'my_weather-api' \u2192 myWeatherApi
22043
+ - Random/UUID IDs: Keep as-is (e.g., 'fUI2riwrBVJ6MepT8rjx0' \u2192 fUI2riwrBVJ6MepT8rjx0)
22044
+ - IDs starting with uppercase: Make first letter lowercase unless it's an acronym
22045
+ - The ID field in the exported object keeps the original format
22046
+ - Examples:
22047
+ - Tool: import { inkeepFacts } from '../tools/inkeep_facts'; export const inkeepFacts = mcpTool({ id: 'inkeep_facts', ... })
22048
+ - Component: import { userProfile } from '../data-components/user-profile'; export const userProfile = dataComponent({ id: 'user-profile', ... })
22049
+ - Graph: import { myGraph } from './graphs/my-graph'; export const myGraph = agentGraph({ id: 'my-graph', ... })
22050
+ `;
22051
+ var IMPORT_INSTRUCTIONS = `
22052
+ CRITICAL IMPORT PATTERNS:
22053
+ - Tools: Import from '../tools/{toolId}' (individual files)
22054
+ - Data components: Import from '../data-components/{componentId}' (individual files)
22055
+ - Artifact components: Import from '../artifact-components/{componentId}' (individual files)
22056
+ - Graphs: Import from './graphs/{graphId}' (individual files)
22057
+
22058
+ NEVER use barrel imports from directories:
22059
+ \u274C WRONG: import { ambiguity, fact } from '../data-components';
22060
+ \u2705 CORRECT:
22061
+ import { ambiguity } from '../data-components/ambiguity';
22062
+ import { fact } from '../data-components/fact';
22063
+
22064
+ EXAMPLES:
22065
+ // Multiple data components - each from individual file:
22066
+ import { ambiguity } from '../data-components/ambiguity';
22067
+ import { clarifyingquestion } from '../data-components/clarifyingquestion';
22068
+ import { fact } from '../data-components/fact';
22069
+
22070
+ // Tools - each from individual file:
22071
+ import { inkeepFacts } from '../tools/inkeep_facts';
22072
+ import { weatherApi } from '../tools/weather-api';
22073
+
22074
+ // Graphs - each from individual file:
22075
+ import { inkeepQaGraph } from './graphs/inkeep-qa-graph';
22076
+ import { weatherGraph } from './graphs/weather-graph';
22077
+ `;
22078
+ function cleanGeneratedCode(text2) {
22079
+ return text2.replace(/^```(?:typescript|ts)?\n?/, "").replace(/\n?```$/, "").trim();
22080
+ }
22081
+ async function generateTextWithPlaceholders(model, data, promptTemplate, options, debug = false) {
22082
+ const { processedData, replacements } = createPlaceholders(data);
22083
+ if (debug && Object.keys(replacements).length > 0) {
22084
+ const savings = calculateTokenSavings(data, processedData);
22085
+ console.log(`[DEBUG] Placeholder optimization:`);
22086
+ console.log(`[DEBUG] - Original data size: ${savings.originalSize} characters`);
22087
+ console.log(`[DEBUG] - Processed data size: ${savings.processedSize} characters`);
22088
+ console.log(
22089
+ `[DEBUG] - Token savings: ${savings.savings} characters (${savings.savingsPercentage.toFixed(1)}%)`
22090
+ );
22091
+ console.log(`[DEBUG] - Placeholders created: ${Object.keys(replacements).length}`);
22092
+ }
22093
+ const prompt = promptTemplate.replace("{{DATA}}", JSON.stringify(processedData, null, 2));
22094
+ if (debug) {
22095
+ console.log(`[DEBUG] Final prompt size: ${prompt.length} characters`);
22096
+ }
22097
+ const { text: text2 } = await generateText({
22098
+ model,
22099
+ prompt,
22100
+ ...options
22101
+ });
22102
+ const restoredText = restorePlaceholders(text2, replacements);
22103
+ if (debug && Object.keys(replacements).length > 0) {
22104
+ console.log(`[DEBUG] Placeholders restored successfully`);
22105
+ }
22106
+ return restoredText;
22107
+ }
22248
22108
  function parseModelString(modelString) {
22249
22109
  if (modelString.includes("/")) {
22250
22110
  const [provider, ...modelParts] = modelString.split("/");
@@ -22258,129 +22118,679 @@ function parseModelString(modelString) {
22258
22118
  modelName: modelString
22259
22119
  };
22260
22120
  }
22261
- async function generateTypeScriptFileWithLLM(graphData, graphId, outputFilePath, modelSettings, retryContext) {
22262
- const fs5 = await import("fs");
22263
- let existingContent = "";
22264
- let fileExists = false;
22265
- try {
22266
- existingContent = fs5.readFileSync(outputFilePath, "utf-8");
22267
- fileExists = true;
22268
- } catch {
22269
- fileExists = false;
22270
- }
22121
+ async function generateIndexFile(projectData, outputPath, modelSettings) {
22122
+ const model = createModel(modelSettings);
22123
+ const promptTemplate = `Generate a TypeScript index.ts file for an Inkeep project with the following data:
22124
+
22125
+ PROJECT DATA:
22126
+ {{DATA}}
22127
+
22128
+ ${NAMING_CONVENTION_RULES}
22129
+
22130
+ CRITICAL IMPORT PATTERNS FOR INDEX.TS:
22131
+ - Tools: Import from './tools/{toolId}' (individual files)
22132
+ - Data components: Import from './data-components/{componentId}' (individual files)
22133
+ - Artifact components: Import from './artifact-components/{componentId}' (individual files)
22134
+ - Graphs: Import from './graphs/{graphId}' (individual files)
22135
+
22136
+ NEVER use barrel imports from directories:
22137
+ \u274C WRONG: import { ambiguity, fact } from './data-components';
22138
+ \u2705 CORRECT:
22139
+ import { ambiguity } from './data-components/ambiguity';
22140
+ import { fact } from './data-components/fact';
22141
+
22142
+ EXAMPLES:
22143
+ // Multiple data components - each from individual file:
22144
+ import { ambiguity } from './data-components/ambiguity';
22145
+ import { clarifyingquestion } from './data-components/clarifyingquestion';
22146
+ import { fact } from './data-components/fact';
22147
+
22148
+ REQUIREMENTS:
22149
+ 1. Import the project function from '@inkeep/agents-sdk'
22150
+ 2. Import each graph from individual files in the graphs directory
22151
+ 3. Import each tool from individual files in the tools directory
22152
+ 4. Import each data component from individual files in the data-components directory
22153
+ 5. Import each artifact component from individual files in the artifact-components directory
22154
+ 6. CRITICAL: All imports MUST be alphabetically sorted (both named imports and path names)
22155
+ 7. Export a const named after the project ID (in camelCase) using the project() function
22156
+ 8. The project object should include:
22157
+ - id: project ID
22158
+ - name: project name
22159
+ - description: project description (if provided)
22160
+ - models: model configuration (if provided)
22161
+ - stopWhen: stop configuration (if provided)
22162
+ - graphs: arrow function returning array of imported graphs
22163
+ - tools: arrow function returning array of imported tools by their IDs (if any)
22164
+ - dataComponents: arrow function returning array of imported data components (if any)
22165
+ - artifactComponents: arrow function returning array of imported artifact components (if any)
22166
+
22167
+ EXAMPLE (note: tools are imported and referenced by ID, not name):
22168
+ import { project } from '@inkeep/agents-sdk';
22169
+ import { weatherForecast } from './data-components/weather-forecast';
22170
+ import { basicGraph } from './graphs/basic-graph'; // Note: 'basic-graph' becomes camelCase 'basicGraph'
22171
+ import { myGraphId } from './graphs/my-graph-id'; // Note: 'my-graph-id' becomes camelCase 'myGraphId'
22172
+ import { weatherGraph } from './graphs/weather-graph';
22173
+ import { fUI2riwrBVJ6MepT8rjx0 } from './tools/fUI2riwrBVJ6MepT8rjx0';
22174
+ import { fdxgfv9HL7SXlfynPx8hf } from './tools/fdxgfv9HL7SXlfynPx8hf';
22175
+
22176
+ export const weatherProject = project({
22177
+ id: 'weather-project',
22178
+ name: 'Weather Project',
22179
+ description: 'A weather information system',
22180
+ models: {
22181
+ base: { model: 'gpt-4o-mini' }
22182
+ },
22183
+ graphs: () => [basicGraph, myGraphId, weatherGraph],
22184
+ tools: () => [fUI2riwrBVJ6MepT8rjx0, fdxgfv9HL7SXlfynPx8hf],
22185
+ dataComponents: () => [weatherForecast]
22186
+ });
22187
+
22188
+ Generate ONLY the TypeScript code without any markdown or explanations.`;
22189
+ const text2 = await generateTextWithPlaceholders(model, projectData, promptTemplate, {
22190
+ temperature: 0.1,
22191
+ maxOutputTokens: 4e3,
22192
+ abortSignal: AbortSignal.timeout(6e4)
22193
+ // 60 second timeout
22194
+ });
22195
+ writeFileSync3(outputPath, cleanGeneratedCode(text2));
22196
+ }
22197
+ async function generateGraphFile(graphData, graphId, outputPath, modelSettings, debug = false) {
22271
22198
  const model = createModel(modelSettings);
22272
- const prompt = createPrompt(graphData, graphId, existingContent, fileExists, retryContext);
22199
+ const promptTemplate = `Generate a TypeScript file for an Inkeep agent graph.
22200
+
22201
+ GRAPH DATA:
22202
+ {{DATA}}
22203
+
22204
+ GRAPH ID: ${graphId}
22205
+
22206
+ IMPORTANT CONTEXT:
22207
+ - Tools are defined at the project level and imported from '../tools' directory
22208
+ - Data components are imported from individual files in '../data-components' directory
22209
+ - Artifact components are imported from individual files in '../artifact-components' directory
22210
+ - CRITICAL: Tool files are named by their IDs (e.g., '../tools/fUI2riwrBVJ6MepT8rjx0')
22211
+ - CRITICAL: Import tools using their IDs as both file name and variable name
22212
+ - Agents reference these resources by their imported variable names
22213
+ - The 'tools' field in agents contains tool IDs that must match the imported variable names
22214
+
22215
+ ${NAMING_CONVENTION_RULES}
22216
+
22217
+ REQUIREMENTS:
22218
+ 1. Import { agent, agentGraph } from '@inkeep/agents-sdk' - ALWAYS sort named imports alphabetically
22219
+ 2. Import tools from '../tools/{toolId}' following naming convention rules
22220
+ 3. Import data components from '../data-components/{componentId}' following naming convention rules
22221
+ 4. Import artifact components from '../artifact-components/{componentId}' following naming convention rules
22222
+ 5. Define each agent using the agent() function with:
22223
+ - id, name, description, prompt
22224
+ - canUse: arrow function returning array of imported tool variables (using their IDs)
22225
+ - selectedTools: if present, maps tool ID variable to selected tool names
22226
+ - dataComponents: arrow function returning array of imported component configs
22227
+ - artifactComponents: arrow function returning array of imported component configs
22228
+ - canTransferTo/canDelegateTo: arrow functions returning agent variables
22229
+ 6. Create the graph using agentGraph() with proper structure
22230
+ - IMPORTANT: If description is null, undefined, or empty string, omit the description field entirely
22231
+ - Only include description if it has a meaningful value
22232
+ 7. CRITICAL: Export the graph with proper camelCase naming:
22233
+ - Convert graph IDs with hyphens to camelCase (e.g., 'basic-graph' becomes 'basicGraph')
22234
+ - Remove hyphens and capitalize the letter after each hyphen
22235
+ - First letter should be lowercase
22236
+ 8. Ensure all imports are sorted alphabetically
22237
+ 9. CRITICAL: For multi-line strings (especially prompts), ALWAYS use template literals with backticks:
22238
+ - Single-line strings: use regular quotes 'short string'
22239
+ - Multi-line strings: MUST use template literals starting and ending with backticks
22240
+ - IMPORTANT: ANY placeholder that starts with < and ends with > MUST be wrapped in template literals (backticks)
22241
+ - Placeholders contain multi-line content and require template literals
22242
+ - This prevents TypeScript syntax errors with newlines and special characters
22243
+
22244
+ NAMING CONVENTION EXAMPLES:
22245
+ // Tool with underscore ID 'inkeep_facts':
22246
+ import { inkeepFacts } from '../tools/inkeep_facts'; // camelCase import, exact ID in path
22247
+
22248
+ // Tool with hyphen ID 'weather-api':
22249
+ import { weatherApi } from '../tools/weather-api'; // camelCase import, exact ID in path
22250
+
22251
+ // Data component with hyphen ID 'user-profile':
22252
+ import { userProfile } from '../data-components/user-profile'; // camelCase import, exact ID in path
22253
+
22254
+ // Random ID (no conversion needed):
22255
+ import { fUI2riwrBVJ6MepT8rjx0 } from '../tools/fUI2riwrBVJ6MepT8rjx0';
22256
+
22257
+ // PLACEHOLDER HANDLING EXAMPLES:
22258
+ // CORRECT - Placeholder wrapped in template literals:
22259
+ prompt: \`<{{agents.facts.prompt.abc12345}}>\`
22260
+
22261
+ // INCORRECT - Placeholder wrapped in single quotes (causes syntax errors):
22262
+ prompt: '<{{agents.facts.prompt.abc12345}}>'
22263
+
22264
+ ${IMPORT_INSTRUCTIONS}
22265
+
22266
+ FULL EXAMPLE:
22267
+ import { agent, agentGraph } from '@inkeep/agents-sdk';
22268
+ import { userProfile } from '../data-components/user-profile';
22269
+ import { inkeepFacts } from '../tools/inkeep_facts';
22270
+ import { weatherApi } from '../tools/weather-api';
22271
+
22272
+ const routerAgent = agent({
22273
+ id: 'router',
22274
+ name: 'Router Agent',
22275
+ prompt: 'Route requests to appropriate agents',
22276
+ canTransferTo: () => [qaAgent]
22277
+ });
22278
+
22279
+ const qaAgent = agent({
22280
+ id: 'qa',
22281
+ name: 'QA Agent',
22282
+ prompt: \`You are a helpful QA agent.
22283
+
22284
+ Follow these rules:
22285
+ - Always be helpful
22286
+ - Provide accurate answers
22287
+ - Use available tools\`,
22288
+ canUse: () => [searchTool, weatherTool],
22289
+ selectedTools: {
22290
+ [searchTool.id]: ['search_web', 'search_docs'],
22291
+ [weatherTool.id]: ['get_forecast']
22292
+ },
22293
+ dataComponents: () => [userProfile.config]
22294
+ });
22295
+
22296
+ // Example: Graph ID 'support-graph' becomes 'supportGraph'
22297
+ export const supportGraph = agentGraph({
22298
+ id: 'support-graph',
22299
+ name: 'Support Graph',
22300
+ description: 'Multi-agent support system', // Only include if description has a value
22301
+ defaultAgent: routerAgent,
22302
+ agents: () => [routerAgent, qaAgent]
22303
+ });
22304
+
22305
+ // Example without description (when null or undefined):
22306
+ export const weatherGraph = agentGraph({
22307
+ id: 'weather-graph',
22308
+ name: 'Weather Graph',
22309
+ // description is omitted when null, undefined, or empty
22310
+ defaultAgent: routerAgent,
22311
+ agents: () => [routerAgent, qaAgent]
22312
+ });
22313
+
22314
+ Generate ONLY the TypeScript code without any markdown or explanations.`;
22315
+ if (debug) {
22316
+ console.log(`
22317
+ [DEBUG] === Starting graph generation for: ${graphId} ===`);
22318
+ console.log(`[DEBUG] Output path: ${outputPath}`);
22319
+ console.log(`[DEBUG] Model: ${modelSettings.model || "default"}`);
22320
+ console.log(`[DEBUG] Graph data size: ${JSON.stringify(graphData).length} characters`);
22321
+ const agentCount = Object.keys(graphData.agents || {}).length;
22322
+ const toolIds = /* @__PURE__ */ new Set();
22323
+ const dataComponentIds = /* @__PURE__ */ new Set();
22324
+ const artifactComponentIds = /* @__PURE__ */ new Set();
22325
+ for (const agent of Object.values(graphData.agents || {})) {
22326
+ const agentData = agent;
22327
+ if (agentData.tools) {
22328
+ for (const toolId of Object.keys(agentData.tools)) {
22329
+ toolIds.add(toolId);
22330
+ }
22331
+ }
22332
+ if (agentData.dataComponents) {
22333
+ for (const id of Object.keys(agentData.dataComponents)) {
22334
+ dataComponentIds.add(id);
22335
+ }
22336
+ }
22337
+ if (agentData.artifactComponents) {
22338
+ for (const id of Object.keys(agentData.artifactComponents)) {
22339
+ artifactComponentIds.add(id);
22340
+ }
22341
+ }
22342
+ }
22343
+ console.log(`[DEBUG] Graph complexity:`);
22344
+ console.log(`[DEBUG] - Agents: ${agentCount}`);
22345
+ console.log(`[DEBUG] - Unique tools: ${toolIds.size}`);
22346
+ console.log(`[DEBUG] - Data components: ${dataComponentIds.size}`);
22347
+ console.log(`[DEBUG] - Artifact components: ${artifactComponentIds.size}`);
22348
+ console.log(
22349
+ `[DEBUG] - Has relations: ${graphData.relations ? Object.keys(graphData.relations).length : 0}`
22350
+ );
22351
+ }
22273
22352
  try {
22274
- const { text: text2 } = await generateText({
22353
+ const startTime = Date.now();
22354
+ if (debug) {
22355
+ console.log(`[DEBUG] Sending request to LLM API...`);
22356
+ }
22357
+ const text2 = await generateTextWithPlaceholders(
22275
22358
  model,
22276
- prompt,
22277
- temperature: 0.1,
22278
- // Low temperature for consistent code generation
22279
- maxOutputTokens: 16e3
22280
- // Increased to handle large TypeScript files
22281
- });
22282
- fs5.writeFileSync(outputFilePath, text2, "utf-8");
22283
- console.log(`\u2705 Successfully generated TypeScript file: ${outputFilePath}`);
22359
+ graphData,
22360
+ promptTemplate,
22361
+ {
22362
+ temperature: 0.1,
22363
+ maxOutputTokens: 16e3,
22364
+ abortSignal: AbortSignal.timeout(24e4)
22365
+ // 240 second timeout for complex graphs
22366
+ },
22367
+ debug
22368
+ // Pass debug flag to show placeholder optimization info
22369
+ );
22370
+ const duration = Date.now() - startTime;
22371
+ if (debug) {
22372
+ console.log(`[DEBUG] LLM response received in ${duration}ms`);
22373
+ console.log(`[DEBUG] Generated text length: ${text2.length} characters`);
22374
+ console.log(`[DEBUG] Writing to file: ${outputPath}`);
22375
+ }
22376
+ const cleanedCode = cleanGeneratedCode(text2);
22377
+ writeFileSync3(outputPath, cleanedCode);
22378
+ if (debug) {
22379
+ console.log(`[DEBUG] Graph file written successfully`);
22380
+ console.log(`[DEBUG] === Completed graph generation for: ${graphId} ===
22381
+ `);
22382
+ }
22284
22383
  } catch (error) {
22285
- console.error("\u274C Error generating TypeScript file with LLM:", error);
22384
+ if (debug) {
22385
+ console.error(`[DEBUG] === ERROR generating graph file ${graphId} ===`);
22386
+ console.error(`[DEBUG] Error name: ${error.name}`);
22387
+ console.error(`[DEBUG] Error message: ${error.message}`);
22388
+ if (error.name === "AbortError") {
22389
+ console.error(`[DEBUG] Request timed out after 240 seconds`);
22390
+ console.error(`[DEBUG] This might indicate the graph is too complex or the API is slow`);
22391
+ }
22392
+ if (error.response) {
22393
+ console.error(`[DEBUG] Response status: ${error.response.status}`);
22394
+ console.error(`[DEBUG] Response headers:`, error.response.headers);
22395
+ }
22396
+ console.error(`[DEBUG] Full error:`, error);
22397
+ }
22286
22398
  throw error;
22287
22399
  }
22288
22400
  }
22289
- function createPrompt(graphData, graphId, existingContent, fileExists, retryContext) {
22290
- const graphDataJson = JSON.stringify(graphData, null, 2);
22291
- const retryInstructions = retryContext && retryContext.attempt > 1 ? `
22292
- RETRY CONTEXT:
22293
- This is attempt ${retryContext.attempt} of ${retryContext.maxRetries}. Previous attempts had validation issues.
22401
+ async function generateToolFile(toolData, toolId, outputPath, modelSettings) {
22402
+ const model = createModel(modelSettings);
22403
+ const promptTemplate = `Generate a TypeScript file for an Inkeep tool.
22404
+
22405
+ TOOL DATA:
22406
+ {{DATA}}
22294
22407
 
22295
- ${retryContext.previousDifferences && retryContext.previousDifferences.length > 0 ? `
22296
- PREVIOUS VALIDATION ISSUES:
22297
- ${retryContext.previousDifferences.map((diff, index2) => `${index2 + 1}. ${diff}`).join("\n")}
22408
+ TOOL ID: ${toolId}
22298
22409
 
22299
- IMPORTANT: Pay special attention to these specific issues and ensure they are resolved in this attempt.
22300
- ` : ""}
22410
+ ${NAMING_CONVENTION_RULES}
22411
+
22412
+ REQUIREMENTS:
22413
+ 1. Import mcpTool from '@inkeep/agents-sdk' - ensure imports are alphabetically sorted
22414
+ 2. CRITICAL: Always include serverUrl property (required by SDK) extracted from config.mcp.server.url
22415
+ 3. CRITICAL: Use individual properties supported by mcpTool - do NOT use nested config object
22416
+ 4. Extract configuration properties and map them to mcpTool's expected properties (serverUrl, transport, etc.)
22417
+ 5. Export the tool following naming convention rules (camelCase version of ID)
22418
+ 6. CRITICAL: If credentialReferenceId exists in tool data, add it as a credential property using envSettings.getEnvironmentSetting()
22419
+ 7. Convert credentialReferenceId to credential key format by replacing hyphens with underscores for the getEnvironmentSetting() call (e.g., 'inkeep-api-credential' becomes 'inkeep_api_credential')
22420
+ 8. CRITICAL: All imports must be alphabetically sorted to comply with Biome linting
22421
+ 9. TRANSPORT CONFIG: If config.mcp.transport exists, extract it as a transport property (not nested in config)
22422
+ 10. NO CONFIG OBJECT: mcpTool does not accept a 'config' property - use individual properties only
22423
+
22424
+ EXAMPLE FOR TOOL WITH UNDERSCORE ID:
22425
+ import { mcpTool } from '@inkeep/agents-sdk';
22426
+
22427
+ // Tool ID 'inkeep_facts' becomes export name 'inkeepFacts'
22428
+ export const inkeepFacts = mcpTool({
22429
+ id: 'inkeep_facts', // Keep original ID here
22430
+ name: 'Inkeep Facts',
22431
+ serverUrl: 'https://facts.inkeep.com/mcp'
22432
+ });
22433
+
22434
+ EXAMPLE FOR TOOL WITH CREDENTIAL REFERENCE:
22435
+ import { mcpTool } from '@inkeep/agents-sdk';
22436
+ import { envSettings } from '../environments';
22437
+
22438
+ // Tool with credential reference - note credentialReferenceId 'inkeep-api-credential' becomes 'inkeep_api_credential'
22439
+ // IMPORTANT: Use individual properties only, no nested config object
22440
+ export const inkeepFacts = mcpTool({
22441
+ id: 'inkeep_facts',
22442
+ name: 'inkeep_facts',
22443
+ serverUrl: 'https://mcp.inkeep.com/inkeep/mcp',
22444
+ credential: envSettings.getEnvironmentSetting('inkeep_api_credential')
22445
+ });
22446
+
22447
+ EXAMPLE FOR TOOL WITH TRANSPORT CONFIG:
22448
+ import { mcpTool } from '@inkeep/agents-sdk';
22449
+
22450
+ // Tool with transport config - extract transport from config.mcp.transport
22451
+ export const transportTool = mcpTool({
22452
+ id: 'transport_tool',
22453
+ name: 'Transport Tool',
22454
+ serverUrl: 'https://example.com/mcp',
22455
+ transport: {
22456
+ type: 'streamable_http'
22457
+ }
22458
+ });
22459
+
22460
+ EXAMPLE FOR TOOL WITH HYPHEN ID:
22461
+ import { mcpTool } from '@inkeep/agents-sdk';
22462
+
22463
+ // Tool ID 'weather-api' becomes export name 'weatherApi'
22464
+ export const weatherApi = mcpTool({
22465
+ id: 'weather-api', // Keep original ID here
22466
+ name: 'Weather API',
22467
+ serverUrl: 'npx',
22468
+ args: ['-y', '@modelcontextprotocol/server-weather']
22469
+ });
22470
+
22471
+ EXAMPLE FOR RANDOM ID:
22472
+ import { mcpTool } from '@inkeep/agents-sdk';
22473
+
22474
+ // If tool ID is 'fUI2riwrBVJ6MepT8rjx0', export name is 'fUI2riwrBVJ6MepT8rjx0'
22475
+ export const fUI2riwrBVJ6MepT8rjx0 = mcpTool({
22476
+ id: 'fUI2riwrBVJ6MepT8rjx0',
22477
+ name: 'Weather Forecast',
22478
+ serverUrl: 'https://weather-forecast-mcp.vercel.app/mcp'
22479
+ });
22480
+
22481
+ Generate ONLY the TypeScript code without any markdown or explanations.`;
22482
+ const text2 = await generateTextWithPlaceholders(model, toolData, promptTemplate, {
22483
+ temperature: 0.1,
22484
+ maxOutputTokens: 4e3,
22485
+ abortSignal: AbortSignal.timeout(6e4)
22486
+ // 60 second timeout
22487
+ });
22488
+ writeFileSync3(outputPath, cleanGeneratedCode(text2));
22489
+ }
22490
+ async function generateDataComponentFile(componentData, componentId, outputPath, modelSettings) {
22491
+ const model = createModel(modelSettings);
22492
+ const promptTemplate = `Generate a TypeScript file for an Inkeep data component.
22301
22493
 
22302
- CRITICAL: This is a retry attempt. You must be extremely careful to match the exact structure and values from the graph data. Double-check all IDs, names, and configurations.
22303
- ` : "";
22304
- if (!fileExists) {
22305
- return `You are an expert TypeScript developer. Generate a complete TypeScript file for an Inkeep agent graph configuration.${retryInstructions}
22494
+ DATA COMPONENT DATA:
22495
+ {{DATA}}
22306
22496
 
22307
- GRAPH DATA (JSON):
22308
- ${graphDataJson}
22497
+ COMPONENT ID: ${componentId}
22309
22498
 
22310
- GRAPH ID: ${graphId}
22499
+ ${NAMING_CONVENTION_RULES}
22311
22500
 
22312
22501
  REQUIREMENTS:
22313
- 1. Create a complete TypeScript file that exports an agentGraph configuration
22314
- 2. Use the exact structure and patterns shown in the graph data
22315
- 3. For agents, use the \`agent()\` function with proper configuration
22316
- 4. For MCP tools, use the \`mcpTool()\` function with proper configuration
22317
- 5. For context configs, use the \`contextConfig()\` function
22318
- 6. For credential references, use the \`credentialReference()\` function
22319
- 7. Use proper TypeScript syntax with correct imports
22320
- 8. Handle multi-line strings with template literals (backticks) when needed
22321
- 9. Preserve the exact structure and relationships from the graph data
22322
- 10. Use descriptive variable names based on IDs (e.g., \`qaAgent\`, \`factsTool\`)
22323
- 11. Include helpful comments for complex configurations
22324
- 12. Preserve all configuration details exactly as provided in the graph data
22325
-
22326
- IMPORTANT:
22327
- - If tools array contains numeric indices, use the actual tool IDs instead
22328
- - Preserve all configuration details exactly as provided
22329
- - Use proper TypeScript formatting and indentation
22330
- - Include all necessary imports at the top
22331
- - Add comments for complex objects like GraphQL queries or multi-line instructions
22332
- - Keep the same structure and organization as typical Inkeep graph files
22333
-
22334
- CRITICAL: Generate ONLY the raw TypeScript code. Do NOT wrap it in markdown code blocks (no triple backticks with typescript). Do NOT include any explanations, comments, or markdown formatting. Return only the pure TypeScript code that can be written directly to a .ts file.`;
22335
- } else {
22336
- return `You are an expert TypeScript developer. You must make MINIMAL changes to an existing TypeScript file. Your job is to update ONLY the specific values that have changed, while preserving EVERYTHING else exactly as it is.${retryInstructions}
22502
+ 1. Import dataComponent from '@inkeep/agents-sdk'
22503
+ 2. Create the data component using dataComponent()
22504
+ 3. Include all properties from the component data INCLUDING the 'id' property
22505
+ 4. Export following naming convention rules (camelCase version of ID)
22506
+ 5. CRITICAL: All imports must be alphabetically sorted to comply with Biome linting
22507
+
22508
+ EXAMPLE WITH UNDERSCORE ID:
22509
+ import { dataComponent } from '@inkeep/agents-sdk';
22510
+
22511
+ // Component ID 'user_profile' becomes export name 'userProfile'
22512
+ export const userProfile = dataComponent({
22513
+ id: 'user_profile',
22514
+ name: 'User Profile',
22515
+ description: 'User profile information',
22516
+ props: {
22517
+ userId: { type: 'string', required: true },
22518
+ email: { type: 'string', required: true },
22519
+ preferences: { type: 'object' }
22520
+ }
22521
+ });
22522
+
22523
+ EXAMPLE WITH HYPHEN ID:
22524
+ import { dataComponent } from '@inkeep/agents-sdk';
22525
+
22526
+ // Component ID 'weather-data' becomes export name 'weatherData'
22527
+ export const weatherData = dataComponent({
22528
+ id: 'weather-data',
22529
+ name: 'Weather Data',
22530
+ description: 'Weather information',
22531
+ props: {
22532
+ temperature: { type: 'number', required: true },
22533
+ conditions: { type: 'string' }
22534
+ }
22535
+ });
22536
+
22537
+ Generate ONLY the TypeScript code without any markdown or explanations.`;
22538
+ const text2 = await generateTextWithPlaceholders(model, componentData, promptTemplate, {
22539
+ temperature: 0.1,
22540
+ maxOutputTokens: 4e3,
22541
+ abortSignal: AbortSignal.timeout(6e4)
22542
+ // 60 second timeout
22543
+ });
22544
+ writeFileSync3(outputPath, cleanGeneratedCode(text2));
22545
+ }
22546
+ async function generateArtifactComponentFile(componentData, componentId, outputPath, modelSettings) {
22547
+ const model = createModel(modelSettings);
22548
+ const promptTemplate = `Generate a TypeScript file for an Inkeep artifact component.
22337
22549
 
22338
- EXISTING FILE CONTENT:
22339
- \`\`\`typescript
22340
- ${existingContent}
22341
- \`\`\`
22550
+ ARTIFACT COMPONENT DATA:
22551
+ {{DATA}}
22342
22552
 
22343
- NEW GRAPH DATA (JSON):
22344
- ${graphDataJson}
22553
+ COMPONENT ID: ${componentId}
22345
22554
 
22346
- GRAPH ID: ${graphId}
22555
+ ${NAMING_CONVENTION_RULES}
22556
+
22557
+ REQUIREMENTS:
22558
+ 1. Import artifactComponent from '@inkeep/agents-sdk'
22559
+ 2. Create the artifact component using artifactComponent()
22560
+ 3. Include summaryProps and fullProps from the component data
22561
+ 4. Export following naming convention rules (camelCase version of ID)
22562
+ 5. Include the 'id' property to preserve the original component ID
22563
+ 6. CRITICAL: All imports must be alphabetically sorted to comply with Biome linting
22564
+
22565
+ EXAMPLE WITH UNDERSCORE ID:
22566
+ import { artifactComponent } from '@inkeep/agents-sdk';
22567
+
22568
+ // Component ID 'pdf_export' becomes export name 'pdfExport'
22569
+ export const pdfExport = artifactComponent({
22570
+ id: 'pdf_export',
22571
+ name: 'PDF Export',
22572
+ description: 'Export data as PDF',
22573
+ summaryProps: {
22574
+ filename: { type: 'string', required: true }
22575
+ },
22576
+ fullProps: {
22577
+ filename: { type: 'string', required: true },
22578
+ content: { type: 'object', required: true }
22579
+ }
22580
+ });
22581
+
22582
+ EXAMPLE WITH HYPHEN ID:
22583
+ import { artifactComponent } from '@inkeep/agents-sdk';
22584
+
22585
+ // Component ID 'order-summary' becomes export name 'orderSummary'
22586
+ export const orderSummary = artifactComponent({
22587
+ id: 'order-summary',
22588
+ name: 'Order Summary',
22589
+ description: 'Summary of customer order',
22590
+ summaryProps: {
22591
+ orderId: { type: 'string', required: true },
22592
+ total: { type: 'number', required: true }
22593
+ },
22594
+ fullProps: {
22595
+ orderId: { type: 'string', required: true },
22596
+ items: { type: 'array', required: true },
22597
+ total: { type: 'number', required: true },
22598
+ tax: { type: 'number' }
22599
+ }
22600
+ });
22601
+
22602
+ Generate ONLY the TypeScript code without any markdown or explanations.`;
22603
+ const text2 = await generateTextWithPlaceholders(model, componentData, promptTemplate, {
22604
+ temperature: 0.1,
22605
+ maxOutputTokens: 4e3,
22606
+ abortSignal: AbortSignal.timeout(6e4)
22607
+ // 60 second timeout
22608
+ });
22609
+ writeFileSync3(outputPath, cleanGeneratedCode(text2));
22610
+ }
22611
+ async function generateEnvironmentFiles(environmentsDir, credentials, environment = "development") {
22612
+ const generateCredentialCode = (cred) => {
22613
+ const params = [
22614
+ `id: '${cred.id}'`,
22615
+ `type: '${cred.type}'`,
22616
+ `credentialStoreId: '${cred.credentialStoreId}'`
22617
+ ];
22618
+ if (cred.retrievalParams) {
22619
+ params.push(
22620
+ `retrievalParams: ${JSON.stringify(cred.retrievalParams, null, 4).replace(/\n/g, "\n ")}`
22621
+ );
22622
+ }
22623
+ return `credential({
22624
+ ${params.join(",\n ")}
22625
+ })`;
22626
+ };
22627
+ const hasCredentials = credentials && Object.keys(credentials).length > 0;
22628
+ let credentialsCode = "";
22629
+ let imports = "import { registerEnvironmentSettings } from '@inkeep/agents-sdk';";
22630
+ if (hasCredentials) {
22631
+ imports = "import { credential, registerEnvironmentSettings } from '@inkeep/agents-sdk';";
22632
+ const credentialEntries = [];
22633
+ for (const [credId, cred] of Object.entries(credentials)) {
22634
+ const varName = credId.replace(/-/g, "_").replace(/[^a-zA-Z0-9_]/g, "");
22635
+ credentialEntries.push(` ${varName}: ${generateCredentialCode(cred)}`);
22636
+ }
22637
+ credentialsCode = `
22638
+ ${credentialEntries.join(",\n")}
22639
+ `;
22640
+ } else {
22641
+ credentialsCode = "\n ";
22642
+ }
22643
+ const envContent = `${imports}
22347
22644
 
22348
- CRITICAL RULES - FOLLOW THESE EXACTLY:
22349
- 1. PRESERVE ALL EXISTING CONTENT - Do not delete, rewrite, or restructure anything
22350
- 2. ONLY change property values that are actually different between the existing file and new graph data
22351
- 3. KEEP ALL COMMENTS - Do not remove any comments unless they are factually incorrect
22352
- 4. KEEP ALL FORMATTING - Preserve exact spacing, indentation, line breaks, and code style
22353
- 5. KEEP ALL IMPORTS - Do not change import statements
22354
- 6. KEEP ALL VARIABLE NAMES - Use the exact same variable names as in the existing file
22355
- 7. KEEP ALL STRUCTURE - Do not reorganize code blocks or change the order of definitions
22356
-
22357
- WHAT TO CHANGE:
22358
- - Only update property values (like id, name, description, instructions, etc.) that are different
22359
- - If a property value is the same, leave it exactly as it is
22360
- - If a new agent/tool/config is added in the graph data, add it following the existing patterns
22361
- - If an agent/tool/config is removed from the graph data, remove it from the file
22362
-
22363
- WHAT NOT TO CHANGE:
22364
- - Do not rewrite entire functions or objects
22365
- - Do not change the structure or organization
22366
- - Do not remove or modify comments
22367
- - Do not change formatting or style
22368
- - Do not reorganize code blocks
22369
- - Do not change variable names or function names
22370
-
22371
- EXAMPLES OF MINIMAL CHANGES:
22372
- - If only the description changed: update only that one line
22373
- - If only a tool was added: add only the new tool definition
22374
- - If only a property value changed: update only that specific property
22375
-
22376
- CRITICAL: Return ONLY the raw TypeScript code. Do NOT wrap it in markdown code blocks (no triple backticks with typescript). Do NOT include any explanations, comments, or markdown formatting. Return only the pure TypeScript code that can be written directly to a .ts file.`;
22645
+ export const ${environment} = registerEnvironmentSettings({
22646
+ credentials: {${credentialsCode}}
22647
+ });
22648
+ `;
22649
+ writeFileSync3(join6(environmentsDir, `${environment}.env.ts`), envContent);
22650
+ await updateEnvironmentIndex(environmentsDir, environment);
22651
+ }
22652
+ async function updateEnvironmentIndex(environmentsDir, environment) {
22653
+ const indexPath = join6(environmentsDir, "index.ts");
22654
+ const { readFileSync: readFileSync4, existsSync: existsSync9 } = await import("fs");
22655
+ const existingEnvironments = [];
22656
+ let existingContent = "";
22657
+ if (existsSync9(indexPath)) {
22658
+ existingContent = readFileSync4(indexPath, "utf-8");
22659
+ const importRegex = /import\s+{\s*(\w+)\s*}\s+from\s+['"]\.\/([\w-]+)\.env['"];?/g;
22660
+ let match;
22661
+ while ((match = importRegex.exec(existingContent)) !== null) {
22662
+ const envName = match[2];
22663
+ if (!existingEnvironments.includes(envName)) {
22664
+ existingEnvironments.push(envName);
22665
+ }
22666
+ }
22667
+ }
22668
+ if (!existingEnvironments.includes(environment)) {
22669
+ existingEnvironments.push(environment);
22377
22670
  }
22671
+ existingEnvironments.sort();
22672
+ const importStatements = existingEnvironments.map((env3) => `import { ${env3} } from './${env3}.env';`).join("\n");
22673
+ const environmentObject = existingEnvironments.map((env3) => ` ${env3},`).join("\n");
22674
+ const exportStatement = existingEnvironments.join(", ");
22675
+ const indexContent = `import { createEnvironmentSettings } from '@inkeep/agents-sdk';
22676
+ ${importStatements}
22677
+
22678
+ export const envSettings = createEnvironmentSettings({
22679
+ ${environmentObject}
22680
+ });
22681
+
22682
+ // Export individual environments for direct access if needed
22683
+ export { ${exportStatement} };
22684
+ `;
22685
+ writeFileSync3(indexPath, indexContent);
22378
22686
  }
22379
22687
 
22380
22688
  // src/commands/pull.ts
22381
- async function loadProjectConfig(projectDir) {
22382
- const configPath = join7(projectDir, "inkeep.config.ts");
22383
- if (!existsSync7(configPath)) {
22689
+ async function verifyGeneratedFiles(projectDir, originalProjectData, debug = false, config) {
22690
+ const errors = [];
22691
+ const warnings = [];
22692
+ try {
22693
+ const indexPath = join7(projectDir, "index.ts");
22694
+ if (!existsSync6(indexPath)) {
22695
+ errors.push("Generated index.ts file not found");
22696
+ return { success: false, errors, warnings };
22697
+ }
22698
+ const module = await importWithTypeScriptSupport(indexPath);
22699
+ const exports = Object.keys(module);
22700
+ let project = null;
22701
+ for (const exportKey of exports) {
22702
+ const value = module[exportKey];
22703
+ if (value && typeof value === "object" && value.__type === "project") {
22704
+ project = value;
22705
+ break;
22706
+ }
22707
+ }
22708
+ if (!project) {
22709
+ errors.push("No project export found in generated index.ts");
22710
+ return { success: false, errors, warnings };
22711
+ }
22712
+ const structuralErrors = [];
22713
+ const structuralWarnings = [];
22714
+ try {
22715
+ if (!project) {
22716
+ structuralErrors.push("Project object not found after import");
22717
+ }
22718
+ if (project && typeof project === "object" && project.__type !== "project") {
22719
+ structuralWarnings.push("Project object missing type marker");
22720
+ }
22721
+ if (project && typeof project.toFullProjectDefinition === "function") {
22722
+ try {
22723
+ const generatedProjectData = await project.toFullProjectDefinition();
22724
+ if (debug) {
22725
+ console.log(chalk6.gray("\n\u{1F4CB} Generated project successfully"));
22726
+ console.log(chalk6.gray(` \u2022 Has tools: ${!!generatedProjectData.tools}`));
22727
+ console.log(chalk6.gray(` \u2022 Tools count: ${Object.keys(generatedProjectData.tools || {}).length}`));
22728
+ console.log(chalk6.gray(` \u2022 Has credentials: ${!!generatedProjectData.credentialReferences}`));
22729
+ console.log(chalk6.gray(` \u2022 Credentials count: ${Object.keys(generatedProjectData.credentialReferences || {}).length}`));
22730
+ }
22731
+ if (!generatedProjectData) {
22732
+ structuralErrors.push("Generated project definition is empty");
22733
+ }
22734
+ } catch (projectDefError) {
22735
+ if (debug) {
22736
+ console.log(chalk6.yellow(` Project definition generation warning: ${projectDefError.message}`));
22737
+ }
22738
+ structuralWarnings.push(`Project definition generation had issues: ${projectDefError.message}`);
22739
+ }
22740
+ }
22741
+ const toolPath = join7(projectDir, "tools", "inkeep_facts.ts");
22742
+ const envPath = join7(projectDir, "environments", "development.env.ts");
22743
+ if (existsSync6(toolPath)) {
22744
+ const toolContent = readFileSync2(toolPath, "utf8");
22745
+ if (!toolContent.includes("credential:")) {
22746
+ structuralWarnings.push("Tool file may be missing credential reference");
22747
+ }
22748
+ if (!toolContent.includes("serverUrl:")) {
22749
+ structuralErrors.push("Tool file missing required serverUrl property");
22750
+ }
22751
+ if (toolContent.includes("config:")) {
22752
+ structuralWarnings.push("Tool file contains invalid config property (should use individual properties)");
22753
+ }
22754
+ if (debug) {
22755
+ console.log(chalk6.gray(` \u2022 Tool file has serverUrl: ${toolContent.includes("serverUrl:")}`));
22756
+ console.log(chalk6.gray(` \u2022 Tool file has credential: ${toolContent.includes("credential:")}`));
22757
+ console.log(chalk6.gray(` \u2022 Tool file has invalid config: ${toolContent.includes("config:")}`));
22758
+ }
22759
+ } else {
22760
+ structuralErrors.push("Tool file inkeep_facts.ts not found");
22761
+ }
22762
+ if (existsSync6(envPath)) {
22763
+ const envContent = readFileSync2(envPath, "utf8");
22764
+ if (!envContent.includes("inkeep_api_credential")) {
22765
+ structuralWarnings.push("Environment file may be missing credential definition");
22766
+ }
22767
+ if (debug) {
22768
+ console.log(chalk6.gray(` \u2022 Environment file has credential: ${envContent.includes("inkeep_api_credential")}`));
22769
+ }
22770
+ } else {
22771
+ structuralErrors.push("Environment file development.env.ts not found");
22772
+ }
22773
+ } catch (structuralError) {
22774
+ structuralErrors.push(`Structural validation failed: ${structuralError.message}`);
22775
+ }
22776
+ errors.push(...structuralErrors);
22777
+ warnings.push(...structuralWarnings);
22778
+ if (debug) {
22779
+ console.log(chalk6.gray("\n\u{1F50D} Structural Verification Summary:"));
22780
+ console.log(chalk6.gray(` \u2022 Project loaded successfully: ${!!project}`));
22781
+ console.log(chalk6.gray(` \u2022 Expected graphs: ${Object.keys(originalProjectData.graphs || {}).length}`));
22782
+ console.log(chalk6.gray(` \u2022 Expected tools: ${Object.keys(originalProjectData.tools || {}).length}`));
22783
+ console.log(chalk6.gray(` \u2022 Expected credentials: ${Object.keys(originalProjectData.credentialReferences || {}).length}`));
22784
+ }
22785
+ return { success: errors.length === 0, errors, warnings };
22786
+ } catch (error) {
22787
+ errors.push(`Verification failed: ${error.message}`);
22788
+ return { success: false, errors, warnings };
22789
+ }
22790
+ }
22791
+ async function loadProjectConfig(projectDir, configPathOverride) {
22792
+ const configPath = configPathOverride ? resolve4(process.cwd(), configPathOverride) : join7(projectDir, "inkeep.config.ts");
22793
+ if (!existsSync6(configPath)) {
22384
22794
  throw new Error(`Configuration file not found: ${configPath}`);
22385
22795
  }
22386
22796
  try {
@@ -22389,10 +22799,13 @@ async function loadProjectConfig(projectDir) {
22389
22799
  if (!config) {
22390
22800
  throw new Error("No configuration found in inkeep.config.ts");
22391
22801
  }
22802
+ if (!config.tenantId) {
22803
+ throw new Error("tenantId is required in inkeep.config.ts");
22804
+ }
22392
22805
  return {
22393
- tenantId: config.tenantId || "default",
22394
- projectId: config.projectId || "default",
22395
- agentsManageApiUrl: config.agentsManageApiUrl || "http://localhost:3002"
22806
+ tenantId: config.tenantId,
22807
+ agentsManageApiUrl: config.agentsManageApiUrl || "http://localhost:3002",
22808
+ outputDirectory: config.outputDirectory
22396
22809
  };
22397
22810
  } catch (error) {
22398
22811
  throw new Error(`Failed to load configuration: ${error.message}`);
@@ -22414,61 +22827,129 @@ async function fetchProjectData(tenantId, projectId, apiUrl) {
22414
22827
  const responseData = await response.json();
22415
22828
  return responseData.data;
22416
22829
  }
22417
- function findProjectFiles(projectDir) {
22418
- const allTsFiles = findAllTypeScriptFiles(projectDir, ["environments", "node_modules"]);
22419
- const categorized = categorizeTypeScriptFiles(allTsFiles, projectDir);
22830
+ function ensureDirectoryExists(dirPath) {
22831
+ if (!existsSync6(dirPath)) {
22832
+ mkdirSync(dirPath, { recursive: true });
22833
+ }
22834
+ }
22835
+ function createProjectStructure(projectDir, projectId) {
22836
+ const dirName = projectDir.split("/").pop() || projectDir;
22837
+ const projectRoot = dirName === projectId ? projectDir : join7(projectDir, projectId);
22838
+ const graphsDir = join7(projectRoot, "graphs");
22839
+ const toolsDir = join7(projectRoot, "tools");
22840
+ const dataComponentsDir = join7(projectRoot, "data-components");
22841
+ const artifactComponentsDir = join7(projectRoot, "artifact-components");
22842
+ const environmentsDir = join7(projectRoot, "environments");
22843
+ ensureDirectoryExists(projectRoot);
22844
+ ensureDirectoryExists(graphsDir);
22845
+ ensureDirectoryExists(toolsDir);
22846
+ ensureDirectoryExists(dataComponentsDir);
22847
+ ensureDirectoryExists(artifactComponentsDir);
22848
+ ensureDirectoryExists(environmentsDir);
22420
22849
  return {
22421
- indexFile: categorized.indexFile,
22422
- graphFiles: categorized.graphFiles,
22423
- agentFiles: categorized.agentFiles,
22424
- toolFiles: categorized.toolFiles,
22425
- otherFiles: categorized.otherFiles
22850
+ projectRoot,
22851
+ graphsDir,
22852
+ toolsDir,
22853
+ dataComponentsDir,
22854
+ artifactComponentsDir,
22855
+ environmentsDir
22426
22856
  };
22427
22857
  }
22428
- async function updateProjectFilesWithLLM(projectDir, projectData, modelSettings) {
22429
- const { graphs, tools: tools2 } = projectData;
22430
- const { indexFile, graphFiles, agentFiles, toolFiles, otherFiles } = findProjectFiles(projectDir);
22431
- if (indexFile && existsSync7(indexFile)) {
22432
- console.log(chalk6.gray(" \u2022 Updating index.ts..."));
22433
- await generateTypeScriptFileWithLLM(projectData, "project", indexFile, modelSettings);
22434
- }
22435
- for (const graphFilePath of graphFiles) {
22436
- const fileName = graphFilePath.split("/").pop()?.replace(".ts", "").replace(".graph", "");
22437
- if (fileName && graphs[fileName]) {
22438
- console.log(chalk6.gray(` \u2022 Updating graph: ${fileName}`));
22439
- await generateTypeScriptFileWithLLM(graphs[fileName], fileName, graphFilePath, modelSettings);
22440
- }
22441
- }
22442
- for (const agentFilePath of agentFiles) {
22443
- const fileName = agentFilePath.split("/").pop()?.replace(".ts", "");
22444
- if (fileName) {
22445
- let agentData = null;
22446
- for (const graph of Object.values(graphs)) {
22447
- const graphData = graph;
22448
- if (graphData.agents?.[fileName]) {
22449
- agentData = graphData.agents[fileName];
22450
- break;
22451
- }
22452
- }
22453
- if (agentData) {
22454
- console.log(chalk6.gray(` \u2022 Updating agent: ${fileName}`));
22455
- await generateTypeScriptFileWithLLM(agentData, fileName, agentFilePath, modelSettings);
22858
+ async function generateProjectFiles(dirs, projectData, modelSettings, environment = "development", debug = false) {
22859
+ const { graphs, tools: tools2, dataComponents: dataComponents2, artifactComponents: artifactComponents2, credentialReferences: credentialReferences2 } = projectData;
22860
+ const generationTasks = [];
22861
+ const fileInfo = [];
22862
+ const indexPath = join7(dirs.projectRoot, "index.ts");
22863
+ generationTasks.push(generateIndexFile(projectData, indexPath, modelSettings));
22864
+ fileInfo.push({ type: "config", name: "index.ts" });
22865
+ if (graphs && Object.keys(graphs).length > 0) {
22866
+ for (const [graphId, graphData] of Object.entries(graphs)) {
22867
+ const graphPath = join7(dirs.graphsDir, `${graphId}.ts`);
22868
+ generationTasks.push(generateGraphFile(graphData, graphId, graphPath, modelSettings));
22869
+ fileInfo.push({ type: "graph", name: `${graphId}.ts` });
22870
+ }
22871
+ }
22872
+ if (tools2 && Object.keys(tools2).length > 0) {
22873
+ for (const [toolId, toolData] of Object.entries(tools2)) {
22874
+ const toolPath = join7(dirs.toolsDir, `${toolId}.ts`);
22875
+ generationTasks.push(generateToolFile(toolData, toolId, toolPath, modelSettings));
22876
+ fileInfo.push({ type: "tool", name: `${toolId}.ts` });
22877
+ }
22878
+ }
22879
+ if (dataComponents2 && Object.keys(dataComponents2).length > 0) {
22880
+ for (const [componentId, componentData] of Object.entries(dataComponents2)) {
22881
+ const componentPath = join7(dirs.dataComponentsDir, `${componentId}.ts`);
22882
+ generationTasks.push(generateDataComponentFile(componentData, componentId, componentPath, modelSettings));
22883
+ fileInfo.push({ type: "dataComponent", name: `${componentId}.ts` });
22884
+ }
22885
+ }
22886
+ if (artifactComponents2 && Object.keys(artifactComponents2).length > 0) {
22887
+ for (const [componentId, componentData] of Object.entries(artifactComponents2)) {
22888
+ const componentPath = join7(dirs.artifactComponentsDir, `${componentId}.ts`);
22889
+ generationTasks.push(generateArtifactComponentFile(componentData, componentId, componentPath, modelSettings));
22890
+ fileInfo.push({ type: "artifactComponent", name: `${componentId}.ts` });
22891
+ }
22892
+ }
22893
+ const targetEnvironment = environment;
22894
+ generationTasks.push(generateEnvironmentFiles(dirs.environmentsDir, credentialReferences2, targetEnvironment));
22895
+ fileInfo.push({ type: "env", name: `index.ts, ${targetEnvironment}.env.ts` });
22896
+ console.log(chalk6.cyan(" \u{1F4DD} Generating files in parallel:"));
22897
+ const filesByType = fileInfo.reduce((acc, file) => {
22898
+ if (!acc[file.type]) acc[file.type] = [];
22899
+ acc[file.type].push(file.name);
22900
+ return acc;
22901
+ }, {});
22902
+ if (filesByType.config) {
22903
+ console.log(chalk6.gray(` \u2022 Config files: ${filesByType.config.join(", ")}`));
22904
+ }
22905
+ if (filesByType.graph) {
22906
+ console.log(chalk6.gray(` \u2022 Graphs: ${filesByType.graph.join(", ")}`));
22907
+ }
22908
+ if (filesByType.tool) {
22909
+ console.log(chalk6.gray(` \u2022 Tools: ${filesByType.tool.join(", ")}`));
22910
+ }
22911
+ if (filesByType.dataComponent) {
22912
+ console.log(chalk6.gray(` \u2022 Data components: ${filesByType.dataComponent.join(", ")}`));
22913
+ }
22914
+ if (filesByType.artifactComponent) {
22915
+ console.log(chalk6.gray(` \u2022 Artifact components: ${filesByType.artifactComponent.join(", ")}`));
22916
+ }
22917
+ if (filesByType.env) {
22918
+ console.log(chalk6.gray(` \u2022 Environment: ${filesByType.env.join(", ")}`));
22919
+ }
22920
+ console.log(chalk6.yellow(` \u26A1 Processing ${generationTasks.length} files in parallel...`));
22921
+ if (debug) {
22922
+ console.log(chalk6.gray("\n\u{1F4CD} Debug: Starting LLM file generation..."));
22923
+ console.log(chalk6.gray(` Model: ${modelSettings.model}`));
22924
+ console.log(chalk6.gray(` Total tasks: ${generationTasks.length}`));
22925
+ const startTime = Date.now();
22926
+ try {
22927
+ await Promise.all(
22928
+ generationTasks.map(async (task, index2) => {
22929
+ const taskStartTime = Date.now();
22930
+ if (debug) {
22931
+ const taskInfo = fileInfo[index2];
22932
+ console.log(chalk6.gray(` [${index2 + 1}/${generationTasks.length}] Starting ${taskInfo.type}: ${taskInfo.name}`));
22933
+ }
22934
+ await task;
22935
+ if (debug) {
22936
+ const taskInfo = fileInfo[index2];
22937
+ const taskDuration = Date.now() - taskStartTime;
22938
+ console.log(chalk6.gray(` [${index2 + 1}/${generationTasks.length}] \u2713 Completed ${taskInfo.type}: ${taskInfo.name} (${taskDuration}ms)`));
22939
+ }
22940
+ })
22941
+ );
22942
+ } catch (error) {
22943
+ if (debug) {
22944
+ console.error(chalk6.red("\u{1F4CD} Debug: LLM generation error:"), error);
22456
22945
  }
22946
+ throw error;
22457
22947
  }
22458
- }
22459
- for (const toolFilePath of toolFiles) {
22460
- const fileName = toolFilePath.split("/").pop()?.replace(".ts", "");
22461
- if (fileName && tools2[fileName]) {
22462
- console.log(chalk6.gray(` \u2022 Updating tool: ${fileName}`));
22463
- await generateTypeScriptFileWithLLM(tools2[fileName], fileName, toolFilePath, modelSettings);
22464
- }
22465
- }
22466
- for (const otherFilePath of otherFiles) {
22467
- const fileName = otherFilePath.split("/").pop()?.replace(".ts", "");
22468
- if (fileName) {
22469
- console.log(chalk6.gray(` \u2022 Updating file: ${fileName}.ts`));
22470
- await generateTypeScriptFileWithLLM(projectData, fileName, otherFilePath, modelSettings);
22471
- }
22948
+ const totalDuration = Date.now() - startTime;
22949
+ console.log(chalk6.gray(`
22950
+ \u{1F4CD} Debug: LLM generation completed in ${totalDuration}ms`));
22951
+ } else {
22952
+ await Promise.all(generationTasks);
22472
22953
  }
22473
22954
  }
22474
22955
  async function pullProjectCommand(options) {
@@ -22481,27 +22962,118 @@ async function pullProjectCommand(options) {
22481
22962
  console.error(chalk6.gray(" or add it to your .env file"));
22482
22963
  process.exit(1);
22483
22964
  }
22484
- const spinner = ora4("Finding project...").start();
22965
+ const spinner = ora4("Loading configuration...").start();
22485
22966
  try {
22486
- const projectDir = await findProjectDirectory(options.project);
22487
- if (!projectDir) {
22488
- spinner.fail("Project not found");
22489
- console.error(chalk6.red("Error: No project found."));
22490
- console.error(
22491
- chalk6.gray(
22492
- "Either run this command from within a project directory or specify --project <project-id>"
22493
- )
22494
- );
22967
+ let config = null;
22968
+ let configFound = false;
22969
+ let configLocation = "";
22970
+ const searchDir = process.cwd();
22971
+ if (options.config) {
22972
+ const configPath = resolve4(process.cwd(), options.config);
22973
+ if (existsSync6(configPath)) {
22974
+ try {
22975
+ config = await loadProjectConfig(dirname4(configPath), options.config);
22976
+ configFound = true;
22977
+ configLocation = configPath;
22978
+ } catch (error) {
22979
+ spinner.fail("Failed to load specified configuration file");
22980
+ console.error(chalk6.red(`Error: ${error instanceof Error ? error.message : String(error)}`));
22981
+ process.exit(1);
22982
+ }
22983
+ } else {
22984
+ spinner.fail(`Specified configuration file not found: ${configPath}`);
22985
+ process.exit(1);
22986
+ }
22987
+ }
22988
+ if (!configFound) {
22989
+ const currentConfigPath = join7(searchDir, "inkeep.config.ts");
22990
+ if (existsSync6(currentConfigPath)) {
22991
+ try {
22992
+ config = await loadProjectConfig(searchDir);
22993
+ configFound = true;
22994
+ configLocation = currentConfigPath;
22995
+ } catch (_error) {
22996
+ spinner.warn("Failed to load configuration from current directory");
22997
+ }
22998
+ }
22999
+ if (!configFound) {
23000
+ const parentConfigPath = join7(searchDir, "..", "inkeep.config.ts");
23001
+ if (existsSync6(parentConfigPath)) {
23002
+ try {
23003
+ config = await loadProjectConfig(join7(searchDir, ".."));
23004
+ configFound = true;
23005
+ configLocation = parentConfigPath;
23006
+ } catch (_error) {
23007
+ spinner.warn("Failed to load configuration from parent directory");
23008
+ }
23009
+ }
23010
+ }
23011
+ if (!configFound) {
23012
+ const { findUp: findUp2 } = await import("find-up");
23013
+ const foundConfigPath = await findUp2("inkeep.config.ts", { cwd: searchDir });
23014
+ if (foundConfigPath) {
23015
+ try {
23016
+ config = await loadProjectConfig(dirname4(foundConfigPath));
23017
+ configFound = true;
23018
+ configLocation = foundConfigPath;
23019
+ } catch (_error) {
23020
+ spinner.warn("Failed to load configuration from found path");
23021
+ }
23022
+ }
23023
+ }
23024
+ }
23025
+ if (!configFound || !config) {
23026
+ spinner.fail("No inkeep.config.ts found");
23027
+ console.error(chalk6.red("Configuration file is required for pull command"));
23028
+ console.log(chalk6.yellow("Please create an inkeep.config.ts file with your tenantId and API settings"));
23029
+ console.log(chalk6.gray("Searched in:"));
23030
+ console.log(chalk6.gray(` \u2022 Current directory: ${searchDir}`));
23031
+ console.log(chalk6.gray(` \u2022 Parent directory: ${join7(searchDir, "..")}`));
23032
+ console.log(chalk6.gray(` \u2022 Parent directories up to root`));
22495
23033
  process.exit(1);
22496
23034
  }
22497
- spinner.succeed(`Project found: ${projectDir}`);
22498
- spinner.start("Loading configuration...");
22499
- const config = await loadProjectConfig(projectDir);
23035
+ spinner.succeed(`Configuration loaded from ${configLocation}`);
23036
+ spinner.start("Determining output directory...");
23037
+ let baseDir;
23038
+ if (options.project) {
23039
+ baseDir = options.project;
23040
+ } else if (config.outputDirectory && config.outputDirectory !== "default") {
23041
+ baseDir = resolve4(process.cwd(), config.outputDirectory);
23042
+ } else {
23043
+ const projectRoot = await findProjectDirectory();
23044
+ if (projectRoot) {
23045
+ const srcPath = join7(projectRoot, "src");
23046
+ baseDir = existsSync6(srcPath) ? srcPath : projectRoot;
23047
+ } else {
23048
+ baseDir = process.cwd();
23049
+ }
23050
+ }
23051
+ spinner.succeed(`Output directory: ${baseDir}`);
22500
23052
  const finalConfig = {
22501
- tenantId: options.agentsManageApiUrl ? options.env || config.tenantId : config.tenantId,
22502
- projectId: config.projectId,
23053
+ tenantId: config.tenantId,
23054
+ // Tenant ID comes from config, not env flag
23055
+ projectId: "",
23056
+ // Will be determined from API response or user input
22503
23057
  agentsManageApiUrl: options.agentsManageApiUrl || config.agentsManageApiUrl
22504
23058
  };
23059
+ if (!options.project) {
23060
+ spinner.stop();
23061
+ const response = await prompts({
23062
+ type: "text",
23063
+ name: "projectId",
23064
+ message: "Enter the project ID to pull:",
23065
+ validate: (value) => value ? true : "Project ID is required"
23066
+ });
23067
+ if (!response.projectId) {
23068
+ console.error(chalk6.red("Project ID is required"));
23069
+ process.exit(1);
23070
+ }
23071
+ finalConfig.projectId = response.projectId;
23072
+ spinner.start("Configuration loaded");
23073
+ } else {
23074
+ const projectIdFromPath = options.project.split("/").pop() || options.project;
23075
+ finalConfig.projectId = projectIdFromPath;
23076
+ }
22505
23077
  spinner.succeed("Configuration loaded");
22506
23078
  console.log(chalk6.gray("Configuration:"));
22507
23079
  console.log(chalk6.gray(` \u2022 Tenant ID: ${finalConfig.tenantId}`));
@@ -22522,34 +23094,118 @@ async function pullProjectCommand(options) {
22522
23094
  },
22523
23095
  0
22524
23096
  );
23097
+ const dataComponentCount = Object.keys(projectData.dataComponents || {}).length;
23098
+ const artifactComponentCount = Object.keys(projectData.artifactComponents || {}).length;
22525
23099
  console.log(chalk6.cyan("\n\u{1F4CA} Project Summary:"));
22526
23100
  console.log(chalk6.gray(` \u2022 Name: ${projectData.name}`));
22527
23101
  console.log(chalk6.gray(` \u2022 Description: ${projectData.description || "No description"}`));
22528
23102
  console.log(chalk6.gray(` \u2022 Graphs: ${graphCount}`));
22529
23103
  console.log(chalk6.gray(` \u2022 Tools: ${toolCount}`));
22530
23104
  console.log(chalk6.gray(` \u2022 Agents: ${agentCount}`));
23105
+ if (dataComponentCount > 0) {
23106
+ console.log(chalk6.gray(` \u2022 Data Components: ${dataComponentCount}`));
23107
+ }
23108
+ if (artifactComponentCount > 0) {
23109
+ console.log(chalk6.gray(` \u2022 Artifact Components: ${artifactComponentCount}`));
23110
+ }
23111
+ const credentialReferences2 = projectData.credentialReferences || {};
23112
+ const credentialCount = Object.keys(credentialReferences2).length;
23113
+ if (credentialCount > 0) {
23114
+ console.log(chalk6.cyan("\n\u{1F510} Credentials Found:"));
23115
+ console.log(chalk6.gray(` \u2022 Total credentials: ${credentialCount}`));
23116
+ for (const [credId, credData] of Object.entries(credentialReferences2)) {
23117
+ const credType = credData.type || "unknown";
23118
+ const storeId = credData.credentialStoreId || "unknown";
23119
+ console.log(chalk6.gray(` \u2022 ${credId} (${credType}, store: ${storeId})`));
23120
+ const usageInfo = credData.usedBy;
23121
+ if (usageInfo && Array.isArray(usageInfo) && usageInfo.length > 0) {
23122
+ const usageByType = {};
23123
+ for (const usage of usageInfo) {
23124
+ usageByType[usage.type] = (usageByType[usage.type] || 0) + 1;
23125
+ }
23126
+ const usageSummary = Object.entries(usageByType).map(([type, count15]) => `${count15} ${type}${count15 > 1 ? "s" : ""}`).join(", ");
23127
+ console.log(chalk6.gray(` Used by: ${usageSummary}`));
23128
+ }
23129
+ }
23130
+ console.log(chalk6.yellow(` \u26A0\uFE0F Environment file (${options.env || "development"}.env.ts) will be generated with credential references`));
23131
+ }
23132
+ spinner.start("Creating project structure...");
23133
+ const dirs = createProjectStructure(baseDir, finalConfig.projectId);
23134
+ spinner.succeed("Project structure created");
22531
23135
  if (options.json) {
22532
- const jsonFilePath = join7(projectDir, `${finalConfig.projectId}.json`);
22533
- writeFileSync3(jsonFilePath, JSON.stringify(projectData, null, 2));
23136
+ const jsonFilePath = join7(dirs.projectRoot, `${finalConfig.projectId}.json`);
23137
+ writeFileSync4(jsonFilePath, JSON.stringify(projectData, null, 2));
22534
23138
  spinner.succeed(`Project data saved to ${jsonFilePath}`);
22535
23139
  console.log(chalk6.green(`\u2705 JSON file created: ${jsonFilePath}`));
22536
- } else {
22537
- spinner.start("Updating project files with LLM...");
22538
- const modelSettings = {
22539
- model: "anthropic/claude-sonnet-4-20250514"
22540
- };
22541
- const { indexFile, graphFiles, agentFiles, toolFiles, otherFiles } = findProjectFiles(projectDir);
22542
- const totalFiles = [indexFile].filter(Boolean).length + graphFiles.length + agentFiles.length + toolFiles.length + otherFiles.length;
22543
- await updateProjectFilesWithLLM(projectDir, projectData, modelSettings);
22544
- spinner.succeed(`Project files updated (${totalFiles} files processed)`);
22545
- console.log(chalk6.green("\n\u2728 Project pulled successfully!"));
22546
- console.log(chalk6.cyan("\n\u{1F4DD} Next steps:"));
22547
- console.log(chalk6.gray(" \u2022 Review the updated files"));
22548
- console.log(chalk6.gray(" \u2022 Test locally: npx inkeep push"));
22549
- console.log(
22550
- chalk6.gray(' \u2022 Commit changes: git add . && git commit -m "Pull project updates"')
22551
- );
22552
23140
  }
23141
+ spinner.start("Generating project files with LLM...");
23142
+ const modelSettings = {
23143
+ model: "anthropic/claude-sonnet-4-20250514"
23144
+ };
23145
+ await generateProjectFiles(dirs, projectData, modelSettings, options.env || "development", options.debug || false);
23146
+ const fileCount = {
23147
+ graphs: Object.keys(projectData.graphs || {}).length,
23148
+ tools: Object.keys(projectData.tools || {}).length,
23149
+ dataComponents: Object.keys(projectData.dataComponents || {}).length,
23150
+ artifactComponents: Object.keys(projectData.artifactComponents || {}).length
23151
+ };
23152
+ const totalFiles = fileCount.graphs + fileCount.tools + fileCount.dataComponents + fileCount.artifactComponents + 5;
23153
+ spinner.succeed(`Project files generated (${totalFiles} files created)`);
23154
+ spinner.start("Verifying generated files...");
23155
+ try {
23156
+ const verificationResult = await verifyGeneratedFiles(dirs.projectRoot, projectData, options.debug || false, config);
23157
+ if (verificationResult.success) {
23158
+ spinner.succeed("Generated files verified successfully");
23159
+ if (options.debug && verificationResult.warnings.length > 0) {
23160
+ console.log(chalk6.yellow("\n\u26A0\uFE0F Verification warnings:"));
23161
+ verificationResult.warnings.forEach((warning) => {
23162
+ console.log(chalk6.gray(` \u2022 ${warning}`));
23163
+ });
23164
+ }
23165
+ } else {
23166
+ spinner.fail("Generated files verification failed");
23167
+ console.error(chalk6.red("\n\u274C Verification errors:"));
23168
+ verificationResult.errors.forEach((error) => {
23169
+ console.error(chalk6.red(` \u2022 ${error}`));
23170
+ });
23171
+ if (verificationResult.warnings.length > 0) {
23172
+ console.log(chalk6.yellow("\n\u26A0\uFE0F Verification warnings:"));
23173
+ verificationResult.warnings.forEach((warning) => {
23174
+ console.log(chalk6.gray(` \u2022 ${warning}`));
23175
+ });
23176
+ }
23177
+ console.log(chalk6.gray("\nThe generated files may not accurately represent the pulled project."));
23178
+ console.log(chalk6.gray("This could indicate an issue with the LLM generation or schema mappings."));
23179
+ }
23180
+ } catch (error) {
23181
+ spinner.fail("Verification failed");
23182
+ console.error(chalk6.red("Verification error:"), error.message);
23183
+ console.log(chalk6.gray("Proceeding without verification..."));
23184
+ }
23185
+ console.log(chalk6.green("\n\u2728 Project pulled successfully!"));
23186
+ console.log(chalk6.cyan("\n\u{1F4C1} Generated structure:"));
23187
+ console.log(chalk6.gray(` ${dirs.projectRoot}/`));
23188
+ console.log(chalk6.gray(` \u251C\u2500\u2500 index.ts`));
23189
+ if (fileCount.graphs > 0) {
23190
+ console.log(chalk6.gray(` \u251C\u2500\u2500 graphs/ (${fileCount.graphs} files)`));
23191
+ }
23192
+ if (fileCount.tools > 0) {
23193
+ console.log(chalk6.gray(` \u251C\u2500\u2500 tools/ (${fileCount.tools} files)`));
23194
+ }
23195
+ if (fileCount.dataComponents > 0) {
23196
+ console.log(chalk6.gray(` \u251C\u2500\u2500 data-components/ (${fileCount.dataComponents} files)`));
23197
+ }
23198
+ if (fileCount.artifactComponents > 0) {
23199
+ console.log(chalk6.gray(` \u251C\u2500\u2500 artifact-components/ (${fileCount.artifactComponents} files)`));
23200
+ }
23201
+ console.log(chalk6.gray(" \u2514\u2500\u2500 environments/ (4 files)"));
23202
+ console.log(chalk6.cyan("\n\u{1F4DD} Next steps:"));
23203
+ console.log(chalk6.gray(` \u2022 cd ${dirs.projectRoot}`));
23204
+ console.log(chalk6.gray(" \u2022 Review the generated files"));
23205
+ console.log(chalk6.gray(" \u2022 Test locally: inkeep push"));
23206
+ console.log(
23207
+ chalk6.gray(' \u2022 Commit changes: git add . && git commit -m "Add project from pull"')
23208
+ );
22553
23209
  } catch (error) {
22554
23210
  spinner.fail("Failed to pull project");
22555
23211
  console.error(chalk6.red("Error:"), error.message);
@@ -22560,20 +23216,21 @@ async function pullProjectCommand(options) {
22560
23216
  // src/commands/push.ts
22561
23217
  init_esm_shims();
22562
23218
  init_env2();
22563
- import { existsSync as existsSync9 } from "fs";
22564
- import { join as join9 } from "path";
23219
+ init_config();
23220
+ import { existsSync as existsSync8 } from "fs";
23221
+ import { join as join9, resolve as resolve5 } from "path";
22565
23222
  import chalk7 from "chalk";
22566
23223
  import ora5 from "ora";
22567
23224
 
22568
23225
  // src/utils/environment-loader.ts
22569
23226
  init_esm_shims();
22570
23227
  init_tsx_loader();
22571
- import { existsSync as existsSync8 } from "fs";
23228
+ import { existsSync as existsSync7 } from "fs";
22572
23229
  import { join as join8 } from "path";
22573
23230
  async function loadEnvironmentCredentials(projectDir, env3) {
22574
23231
  const environmentsDir = join8(projectDir, "environments");
22575
23232
  const envFilePath = join8(environmentsDir, `${env3}.env.ts`);
22576
- if (!existsSync8(envFilePath)) {
23233
+ if (!existsSync7(envFilePath)) {
22577
23234
  throw new Error(
22578
23235
  `Environment file not found: ${envFilePath}
22579
23236
  Make sure you have a ${env3}.env.ts file in the environments directory.`
@@ -22602,7 +23259,7 @@ Make sure you have a ${env3}.env.ts file in the environments directory.`
22602
23259
  init_tsx_loader();
22603
23260
  async function loadProject(projectDir) {
22604
23261
  const indexPath = join9(projectDir, "index.ts");
22605
- if (!existsSync9(indexPath)) {
23262
+ if (!existsSync8(indexPath)) {
22606
23263
  throw new Error(`index.ts not found in project directory: ${projectDir}`);
22607
23264
  }
22608
23265
  const module = await importWithTypeScriptSupport(indexPath);
@@ -22618,58 +23275,69 @@ async function loadProject(projectDir) {
22618
23275
  );
22619
23276
  }
22620
23277
  async function pushCommand(options) {
22621
- const spinner = ora5("Detecting project...").start();
23278
+ const spinner = ora5("Loading configuration...").start();
22622
23279
  try {
22623
- const projectDir = await findProjectDirectory(options.project);
22624
- if (!projectDir) {
22625
- spinner.fail("Project not found");
22626
- if (options.project) {
22627
- console.error(chalk7.red(`Project directory not found: ${options.project}`));
22628
- console.error(
22629
- chalk7.yellow("Make sure the project directory contains an inkeep.config.ts file")
22630
- );
23280
+ const config = await validateConfiguration(
23281
+ options.tenantId,
23282
+ options.agentsManageApiUrl,
23283
+ options.agentsRunApiUrl,
23284
+ options.config
23285
+ );
23286
+ spinner.succeed("Configuration loaded");
23287
+ console.log(chalk7.gray("Configuration sources:"));
23288
+ console.log(chalk7.gray(` \u2022 Tenant ID: ${config.tenantId}`));
23289
+ console.log(chalk7.gray(` \u2022 Manage API URL: ${config.agentsManageApiUrl}`));
23290
+ console.log(chalk7.gray(` \u2022 Run API URL: ${config.agentsRunApiUrl}`));
23291
+ if (config.sources.configFile) {
23292
+ console.log(chalk7.gray(` \u2022 Config file: ${config.sources.configFile}`));
23293
+ }
23294
+ spinner.start("Detecting project...");
23295
+ let projectDir;
23296
+ if (options.project) {
23297
+ projectDir = resolve5(process.cwd(), options.project);
23298
+ if (!existsSync8(join9(projectDir, "index.ts"))) {
23299
+ spinner.fail(`No index.ts found in specified project directory: ${projectDir}`);
23300
+ process.exit(1);
23301
+ }
23302
+ } else {
23303
+ const currentDir = process.cwd();
23304
+ if (existsSync8(join9(currentDir, "index.ts"))) {
23305
+ projectDir = currentDir;
22631
23306
  } else {
22632
- console.error(chalk7.red("No project found in current directory or parent directories"));
23307
+ spinner.fail("No index.ts found in current directory");
22633
23308
  console.error(
22634
- chalk7.yellow(
22635
- "Either run this command from within a project directory or use --project <project-id>"
22636
- )
23309
+ chalk7.yellow("Please run this command from a directory containing index.ts or use --project <path>")
22637
23310
  );
23311
+ process.exit(1);
22638
23312
  }
22639
- process.exit(1);
22640
23313
  }
22641
23314
  spinner.succeed(`Project found: ${projectDir}`);
22642
23315
  if (options.env) {
22643
23316
  process.env.INKEEP_ENV = options.env;
22644
23317
  spinner.text = `Setting environment to '${options.env}'...`;
22645
23318
  }
23319
+ const originalTenantId = process.env.INKEEP_TENANT_ID;
23320
+ const originalApiUrl = process.env.INKEEP_API_URL;
23321
+ process.env.INKEEP_TENANT_ID = config.tenantId;
23322
+ process.env.INKEEP_API_URL = config.agentsManageApiUrl;
22646
23323
  spinner.text = "Loading project from index.ts...";
22647
23324
  const project = await loadProject(projectDir);
22648
- spinner.succeed("Project loaded successfully");
22649
- spinner.text = "Loading configuration...";
22650
- const configPath = join9(projectDir, "inkeep.config.ts");
22651
- const configModule = await importWithTypeScriptSupport(configPath);
22652
- const config = configModule.default;
22653
- if (!config) {
22654
- throw new Error("No default export found in inkeep.config.ts");
23325
+ if (originalTenantId !== void 0) {
23326
+ process.env.INKEEP_TENANT_ID = originalTenantId;
23327
+ } else {
23328
+ delete process.env.INKEEP_TENANT_ID;
22655
23329
  }
22656
- const finalConfig = {
22657
- ...config,
22658
- agentsManageApiUrl: options.agentsManageApiUrl || config.agentsManageApiUrl
22659
- };
22660
- if (!finalConfig.tenantId || !finalConfig.projectId || !finalConfig.agentsManageApiUrl) {
22661
- throw new Error("Missing required configuration: tenantId, projectId, or agentsManageApiUrl");
23330
+ if (originalApiUrl !== void 0) {
23331
+ process.env.INKEEP_API_URL = originalApiUrl;
23332
+ } else {
23333
+ delete process.env.INKEEP_API_URL;
22662
23334
  }
22663
- spinner.succeed("Configuration loaded");
22664
- console.log(chalk7.gray("Configuration sources:"));
22665
- console.log(chalk7.gray(` \u2022 Tenant ID: ${finalConfig.tenantId}`));
22666
- console.log(chalk7.gray(` \u2022 Project ID: ${finalConfig.projectId}`));
22667
- console.log(chalk7.gray(` \u2022 API URL: ${finalConfig.agentsManageApiUrl}`));
23335
+ spinner.succeed("Project loaded successfully");
22668
23336
  if (typeof project.setConfig === "function") {
22669
23337
  project.setConfig(
22670
- finalConfig.tenantId,
22671
- finalConfig.agentsManageApiUrl,
22672
- finalConfig.modelSettings
23338
+ config.tenantId,
23339
+ config.agentsManageApiUrl
23340
+ // Note: models should be passed here if needed, not agentsRunApiUrl
22673
23341
  );
22674
23342
  }
22675
23343
  if (options.env && typeof project.setCredentials === "function") {
@@ -22690,7 +23358,7 @@ async function pushCommand(options) {
22690
23358
  spinner.text = "Generating project data JSON...";
22691
23359
  try {
22692
23360
  const projectDefinition = await project.toFullProjectDefinition();
22693
- const jsonFilePath = join9(projectDir, `${finalConfig.projectId}.json`);
23361
+ const jsonFilePath = join9(projectDir, `project.json`);
22694
23362
  const fs5 = await import("fs/promises");
22695
23363
  await fs5.writeFile(jsonFilePath, JSON.stringify(projectDefinition, null, 2));
22696
23364
  spinner.succeed(`Project data saved to ${jsonFilePath}`);
@@ -22739,6 +23407,32 @@ async function pushCommand(options) {
22739
23407
  );
22740
23408
  }
22741
23409
  }
23410
+ try {
23411
+ const credentialTracking = await project.getCredentialTracking();
23412
+ const credentialCount = Object.keys(credentialTracking.credentials).length;
23413
+ if (credentialCount > 0) {
23414
+ console.log(chalk7.cyan("\n\u{1F510} Credentials:"));
23415
+ console.log(chalk7.gray(` \u2022 Total credentials: ${credentialCount}`));
23416
+ for (const [credId, credData] of Object.entries(credentialTracking.credentials)) {
23417
+ const usageInfo = credentialTracking.usage[credId] || [];
23418
+ const credType = credData.type || "unknown";
23419
+ const storeId = credData.credentialStoreId || "unknown";
23420
+ console.log(chalk7.gray(` \u2022 ${credId} (${credType}, store: ${storeId})`));
23421
+ if (usageInfo.length > 0) {
23422
+ const usageByType = {};
23423
+ for (const usage of usageInfo) {
23424
+ usageByType[usage.type] = (usageByType[usage.type] || 0) + 1;
23425
+ }
23426
+ const usageSummary = Object.entries(usageByType).map(([type, count15]) => `${count15} ${type}${count15 > 1 ? "s" : ""}`).join(", ");
23427
+ console.log(chalk7.gray(` Used by: ${usageSummary}`));
23428
+ }
23429
+ }
23430
+ }
23431
+ } catch (error) {
23432
+ if (env2.DEBUG) {
23433
+ console.error(chalk7.yellow("Could not retrieve credential tracking information"));
23434
+ }
23435
+ }
22742
23436
  console.log(chalk7.green("\n\u2728 Next steps:"));
22743
23437
  console.log(chalk7.gray(` \u2022 Test your project: inkeep chat`));
22744
23438
  console.log(chalk7.gray(` \u2022 View all graphs: inkeep list-graphs`));
@@ -22755,58 +23449,60 @@ async function pushCommand(options) {
22755
23449
 
22756
23450
  // src/index.ts
22757
23451
  var __filename2 = fileURLToPath2(import.meta.url);
22758
- var __dirname2 = dirname4(__filename2);
23452
+ var __dirname2 = dirname5(__filename2);
22759
23453
  var packageJsonPath = join10(__dirname2, "..", "package.json");
22760
- var packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
23454
+ var packageJson = JSON.parse(readFileSync3(packageJsonPath, "utf-8"));
22761
23455
  var program = new Command();
22762
23456
  program.name("inkeep").description("CLI tool for Inkeep Agent Framework").version(packageJson.version);
22763
- program.command("add [template]").description("Add a new template to the project").option("--target-path <path>", "Target path to add the template to").action(async (template, options) => {
23457
+ program.command("add [template]").description("Add a new template to the project").option("--target-path <path>", "Target path to add the template to").option("--config <path>", "Path to configuration file").action(async (template, options) => {
22764
23458
  await addCommand({ template, ...options });
22765
23459
  });
22766
- program.command("init [path]").description("Initialize a new Inkeep configuration file").option("--no-interactive", "Skip interactive path selection").action(async (path3, options) => {
23460
+ program.command("init [path]").description("Initialize a new Inkeep configuration file").option("--no-interactive", "Skip interactive path selection").option("--config <path>", "Path to use as template for new configuration").action(async (path3, options) => {
22767
23461
  await initCommand({ path: path3, ...options });
22768
23462
  });
22769
23463
  var configCommand = program.command("config").description("Manage Inkeep configuration");
22770
- configCommand.command("get [key]").description("Get configuration value(s)").option("--config-file-path <path>", "Path to configuration file").action(async (key, options) => {
22771
- await configGetCommand(key, options);
23464
+ configCommand.command("get [key]").description("Get configuration value(s)").option("--config <path>", "Path to configuration file").option("--config-file-path <path>", "Path to configuration file (deprecated, use --config)").action(async (key, options) => {
23465
+ const config = options.config || options.configFilePath;
23466
+ await configGetCommand(key, { config });
22772
23467
  });
22773
- configCommand.command("set <key> <value>").description("Set a configuration value").option("--config-file-path <path>", "Path to configuration file").action(async (key, value, options) => {
22774
- await configSetCommand(key, value, options);
23468
+ configCommand.command("set <key> <value>").description("Set a configuration value").option("--config <path>", "Path to configuration file").option("--config-file-path <path>", "Path to configuration file (deprecated, use --config)").action(async (key, value, options) => {
23469
+ const config = options.config || options.configFilePath;
23470
+ await configSetCommand(key, value, { config });
22775
23471
  });
22776
- configCommand.command("list").description("List all configuration values").option("--config-file-path <path>", "Path to configuration file").action(async (options) => {
22777
- await configListCommand(options);
23472
+ configCommand.command("list").description("List all configuration values").option("--config <path>", "Path to configuration file").option("--config-file-path <path>", "Path to configuration file (deprecated, use --config)").action(async (options) => {
23473
+ const config = options.config || options.configFilePath;
23474
+ await configListCommand({ config });
22778
23475
  });
22779
- program.command("push").description("Push a project configuration to the backend").option("--project <project-id>", "Project ID or path to project directory").option("--agents-manage-api-url <url>", "Override agents manage API URL").option(
23476
+ program.command("push").description("Push a project configuration to the backend").option("--project <project-id>", "Project ID or path to project directory").option("--config <path>", "Path to configuration file").option("--tenant-id <id>", "Override tenant ID").option("--agents-manage-api-url <url>", "Override agents manage API URL").option("--agents-run-api-url <url>", "Override agents run API URL").option(
22780
23477
  "--env <environment>",
22781
23478
  "Environment to use for credential resolution (e.g., development, production)"
22782
23479
  ).option("--json", "Generate project data JSON file instead of pushing to backend").action(async (options) => {
22783
23480
  await pushCommand(options);
22784
23481
  });
22785
- program.command("pull").description("Pull entire project configuration from backend and update local files").option("--project <project-id>", "Project ID or path to project directory").option("--agents-manage-api-url <url>", "Override agents manage API URL").option("--env <environment>", "Environment to use for credential resolution").option("--json", "Generate project data JSON file instead of updating files").action(async (options) => {
23482
+ program.command("pull").description("Pull entire project configuration from backend and update local files").option("--project <project-id>", "Project ID or path to project directory").option("--config <path>", "Path to configuration file").option("--agents-manage-api-url <url>", "Override agents manage API URL").option(
23483
+ "--env <environment>",
23484
+ "Environment file to generate (development, staging, production). Defaults to development"
23485
+ ).option("--json", "Generate project data JSON file instead of updating files").option("--debug", "Enable debug logging for LLM generation").action(async (options) => {
22786
23486
  await pullProjectCommand(options);
22787
23487
  });
22788
23488
  program.command("chat [graph-id]").description(
22789
23489
  "Start an interactive chat session with a graph (interactive selection if no ID provided)"
22790
- ).option("--tenant-id <tenant-id>", "Tenant ID (use with --api-url)").option("--api-url <api-url>", "API URL (use with --tenant-id or alone to override config)").option(
22791
- "--config-file-path <path>",
22792
- "Path to configuration file (alternative to --tenant-id/--api-url)"
22793
- ).action(async (graphId, options) => {
23490
+ ).option("--tenant-id <tenant-id>", "Tenant ID").option("--agents-manage-api-url <url>", "Agents manage API URL").option("--agents-run-api-url <url>", "Agents run API URL").option("--config <path>", "Path to configuration file").option("--config-file-path <path>", "Path to configuration file (deprecated, use --config)").action(async (graphId, options) => {
22794
23491
  const { chatCommandEnhanced: chatCommandEnhanced2 } = await Promise.resolve().then(() => (init_chat_enhanced(), chat_enhanced_exports));
22795
- await chatCommandEnhanced2(graphId, options);
23492
+ const config = options.config || options.configFilePath;
23493
+ await chatCommandEnhanced2(graphId, { ...options, config });
22796
23494
  });
22797
- program.command("list-graphs").description("List all available graphs for the current tenant").option("--tenant-id <tenant-id>", "Tenant ID (use with --api-url)").option("--api-url <api-url>", "API URL (use with --tenant-id or alone to override config)").option(
22798
- "--config-file-path <path>",
22799
- "Path to configuration file (alternative to --tenant-id/--api-url)"
22800
- ).action(async (options) => {
22801
- await listGraphsCommand(options);
23495
+ program.command("list-graphs").description("List all available graphs for a specific project").requiredOption("--project <project-id>", "Project ID to list graphs for").option("--tenant-id <tenant-id>", "Tenant ID").option("--agents-manage-api-url <url>", "Agents manage API URL").option("--config <path>", "Path to configuration file").option("--config-file-path <path>", "Path to configuration file (deprecated, use --config)").action(async (options) => {
23496
+ const config = options.config || options.configFilePath;
23497
+ await listGraphsCommand({ ...options, config });
22802
23498
  });
22803
- program.command("dev").description("Start the Inkeep dashboard server").option("--port <port>", "Port to run the server on", "3000").option("--host <host>", "Host to bind the server to", "localhost").option("--build", "Create a Vercel-ready build and exit").option("--output-dir <dir>", "Output directory for build files", "./vercel-build").option("--vercel", "Copy Vercel output to .vercel/output for deployment").action(async (options) => {
23499
+ program.command("dev").description("Start the Inkeep dashboard server").option("--port <port>", "Port to run the server on", "3000").option("--host <host>", "Host to bind the server to", "localhost").option("--build", "Build the Dashboard UI for production", false).option("--output-dir <dir>", "Output directory for build files", "./vercel-build").option("--path", "Output the path to the Dashboard UI", false).action(async (options) => {
22804
23500
  await devCommand({
22805
23501
  port: parseInt(options.port, 10),
22806
23502
  host: options.host,
22807
23503
  build: options.build,
22808
23504
  outputDir: options.outputDir,
22809
- vercel: options.vercel
23505
+ path: options.path
22810
23506
  });
22811
23507
  });
22812
23508
  program.parse();