@inkeep/agents-cli 0.24.1 → 0.25.0

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.
Files changed (2) hide show
  1. package/dist/index.js +1170 -803
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -21,11 +21,11 @@ var __export = (target, all) => {
21
21
  for (var name in all)
22
22
  __defProp(target, name, { get: all[name], enumerable: true });
23
23
  };
24
- var __copyProps = (to, from, except, desc15) => {
24
+ var __copyProps = (to, from, except, desc16) => {
25
25
  if (from && typeof from === "object" || typeof from === "function") {
26
26
  for (let key of __getOwnPropNames(from))
27
27
  if (!__hasOwnProp.call(to, key) && key !== except)
28
- __defProp(to, key, { get: () => from[key], enumerable: !(desc15 = __getOwnPropDesc(from, key)) || desc15.enumerable });
28
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc16 = __getOwnPropDesc(from, key)) || desc16.enumerable });
29
29
  }
30
30
  return to;
31
31
  };
@@ -741,21 +741,21 @@ var init_dist = __esm({
741
741
  }
742
742
  });
743
743
 
744
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/url.js
744
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/url.js
745
745
  var tryDecode, _decodeURI, _getQueryParam, getQueryParam, getQueryParams, decodeURIComponent_;
746
746
  var init_url = __esm({
747
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/url.js"() {
747
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/url.js"() {
748
748
  "use strict";
749
749
  init_esm_shims();
750
750
  tryDecode = (str, decoder) => {
751
751
  try {
752
752
  return decoder(str);
753
753
  } catch {
754
- return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {
754
+ return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match2) => {
755
755
  try {
756
- return decoder(match);
756
+ return decoder(match2);
757
757
  } catch {
758
- return match;
758
+ return match2;
759
759
  }
760
760
  });
761
761
  }
@@ -841,52 +841,52 @@ var init_url = __esm({
841
841
  }
842
842
  });
843
843
 
844
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/cookie.js
844
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/cookie.js
845
845
  var init_cookie = __esm({
846
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/cookie.js"() {
846
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/cookie.js"() {
847
847
  "use strict";
848
848
  init_esm_shims();
849
849
  init_url();
850
850
  }
851
851
  });
852
852
 
853
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/helper/cookie/index.js
853
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/helper/cookie/index.js
854
854
  var init_cookie2 = __esm({
855
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/helper/cookie/index.js"() {
855
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/helper/cookie/index.js"() {
856
856
  "use strict";
857
857
  init_esm_shims();
858
858
  init_cookie();
859
859
  }
860
860
  });
861
861
 
862
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/http-exception.js
862
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/http-exception.js
863
863
  var init_http_exception = __esm({
864
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/http-exception.js"() {
864
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/http-exception.js"() {
865
865
  "use strict";
866
866
  init_esm_shims();
867
867
  }
868
868
  });
869
869
 
870
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/crypto.js
870
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/crypto.js
871
871
  var init_crypto = __esm({
872
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/crypto.js"() {
872
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/crypto.js"() {
873
873
  "use strict";
874
874
  init_esm_shims();
875
875
  }
876
876
  });
877
877
 
878
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/buffer.js
878
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/buffer.js
879
879
  var init_buffer = __esm({
880
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/buffer.js"() {
880
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/buffer.js"() {
881
881
  "use strict";
882
882
  init_esm_shims();
883
883
  init_crypto();
884
884
  }
885
885
  });
886
886
 
887
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/validator/validator.js
887
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/validator/validator.js
888
888
  var init_validator = __esm({
889
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/validator/validator.js"() {
889
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/validator/validator.js"() {
890
890
  "use strict";
891
891
  init_esm_shims();
892
892
  init_cookie2();
@@ -895,43 +895,43 @@ var init_validator = __esm({
895
895
  }
896
896
  });
897
897
 
898
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/validator/index.js
898
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/validator/index.js
899
899
  var init_validator2 = __esm({
900
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/validator/index.js"() {
900
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/validator/index.js"() {
901
901
  "use strict";
902
902
  init_esm_shims();
903
903
  init_validator();
904
904
  }
905
905
  });
906
906
 
907
- // ../node_modules/.pnpm/@hono+zod-validator@0.7.3_hono@4.9.10_zod@4.1.12/node_modules/@hono/zod-validator/dist/index.js
907
+ // ../node_modules/.pnpm/@hono+zod-validator@0.7.4_hono@4.10.1_zod@4.1.12/node_modules/@hono/zod-validator/dist/index.js
908
908
  var init_dist2 = __esm({
909
- "../node_modules/.pnpm/@hono+zod-validator@0.7.3_hono@4.9.10_zod@4.1.12/node_modules/@hono/zod-validator/dist/index.js"() {
909
+ "../node_modules/.pnpm/@hono+zod-validator@0.7.4_hono@4.10.1_zod@4.1.12/node_modules/@hono/zod-validator/dist/index.js"() {
910
910
  "use strict";
911
911
  init_esm_shims();
912
912
  init_validator2();
913
913
  }
914
914
  });
915
915
 
916
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/compose.js
916
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/compose.js
917
917
  var init_compose = __esm({
918
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/compose.js"() {
918
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/compose.js"() {
919
919
  "use strict";
920
920
  init_esm_shims();
921
921
  }
922
922
  });
923
923
 
924
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/request/constants.js
924
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/request/constants.js
925
925
  var GET_MATCH_RESULT;
926
926
  var init_constants = __esm({
927
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/request/constants.js"() {
927
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/request/constants.js"() {
928
928
  "use strict";
929
929
  init_esm_shims();
930
930
  GET_MATCH_RESULT = Symbol();
931
931
  }
932
932
  });
933
933
 
934
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/body.js
934
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/body.js
935
935
  async function parseFormData(request, options) {
936
936
  const formData = await request.formData();
937
937
  if (formData) {
@@ -962,7 +962,7 @@ function convertFormDataToBodyData(formData, options) {
962
962
  }
963
963
  var parseBody, handleParsingAllValues, handleParsingNestedValues;
964
964
  var init_body = __esm({
965
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/body.js"() {
965
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/body.js"() {
966
966
  "use strict";
967
967
  init_esm_shims();
968
968
  init_request();
@@ -1008,12 +1008,13 @@ var init_body = __esm({
1008
1008
  }
1009
1009
  });
1010
1010
 
1011
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/request.js
1011
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/request.js
1012
1012
  var tryDecodeURIComponent, HonoRequest;
1013
1013
  var init_request = __esm({
1014
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/request.js"() {
1014
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/request.js"() {
1015
1015
  "use strict";
1016
1016
  init_esm_shims();
1017
+ init_http_exception();
1017
1018
  init_constants();
1018
1019
  init_body();
1019
1020
  init_url();
@@ -1129,17 +1130,17 @@ var init_request = __esm({
1129
1130
  }
1130
1131
  });
1131
1132
 
1132
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/html.js
1133
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/html.js
1133
1134
  var init_html = __esm({
1134
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/html.js"() {
1135
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/html.js"() {
1135
1136
  "use strict";
1136
1137
  init_esm_shims();
1137
1138
  }
1138
1139
  });
1139
1140
 
1140
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/context.js
1141
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/context.js
1141
1142
  var init_context = __esm({
1142
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/context.js"() {
1143
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/context.js"() {
1143
1144
  "use strict";
1144
1145
  init_esm_shims();
1145
1146
  init_request();
@@ -1147,25 +1148,25 @@ var init_context = __esm({
1147
1148
  }
1148
1149
  });
1149
1150
 
1150
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router.js
1151
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router.js
1151
1152
  var init_router = __esm({
1152
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router.js"() {
1153
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router.js"() {
1153
1154
  "use strict";
1154
1155
  init_esm_shims();
1155
1156
  }
1156
1157
  });
1157
1158
 
1158
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/constants.js
1159
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/constants.js
1159
1160
  var init_constants2 = __esm({
1160
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/utils/constants.js"() {
1161
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/utils/constants.js"() {
1161
1162
  "use strict";
1162
1163
  init_esm_shims();
1163
1164
  }
1164
1165
  });
1165
1166
 
1166
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/hono-base.js
1167
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/hono-base.js
1167
1168
  var init_hono_base = __esm({
1168
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/hono-base.js"() {
1169
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/hono-base.js"() {
1169
1170
  "use strict";
1170
1171
  init_esm_shims();
1171
1172
  init_compose();
@@ -1176,10 +1177,19 @@ var init_hono_base = __esm({
1176
1177
  }
1177
1178
  });
1178
1179
 
1179
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/reg-exp-router/node.js
1180
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/matcher.js
1181
+ var init_matcher = __esm({
1182
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/matcher.js"() {
1183
+ "use strict";
1184
+ init_esm_shims();
1185
+ init_router();
1186
+ }
1187
+ });
1188
+
1189
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/node.js
1180
1190
  var PATH_ERROR, regExpMetaChars;
1181
1191
  var init_node = __esm({
1182
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/reg-exp-router/node.js"() {
1192
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/node.js"() {
1183
1193
  "use strict";
1184
1194
  init_esm_shims();
1185
1195
  PATH_ERROR = Symbol();
@@ -1187,57 +1197,70 @@ var init_node = __esm({
1187
1197
  }
1188
1198
  });
1189
1199
 
1190
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/reg-exp-router/trie.js
1200
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/trie.js
1191
1201
  var init_trie = __esm({
1192
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/reg-exp-router/trie.js"() {
1202
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/trie.js"() {
1193
1203
  "use strict";
1194
1204
  init_esm_shims();
1195
1205
  init_node();
1196
1206
  }
1197
1207
  });
1198
1208
 
1199
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/reg-exp-router/router.js
1209
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/router.js
1200
1210
  var init_router2 = __esm({
1201
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/reg-exp-router/router.js"() {
1211
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/router.js"() {
1202
1212
  "use strict";
1203
1213
  init_esm_shims();
1204
1214
  init_router();
1205
1215
  init_url();
1216
+ init_matcher();
1206
1217
  init_node();
1207
1218
  init_trie();
1208
1219
  }
1209
1220
  });
1210
1221
 
1211
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/reg-exp-router/index.js
1222
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/prepared-router.js
1223
+ var init_prepared_router = __esm({
1224
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/prepared-router.js"() {
1225
+ "use strict";
1226
+ init_esm_shims();
1227
+ init_router();
1228
+ init_matcher();
1229
+ init_router2();
1230
+ }
1231
+ });
1232
+
1233
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/index.js
1212
1234
  var init_reg_exp_router = __esm({
1213
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/reg-exp-router/index.js"() {
1235
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/reg-exp-router/index.js"() {
1214
1236
  "use strict";
1215
1237
  init_esm_shims();
1216
1238
  init_router2();
1239
+ init_prepared_router();
1217
1240
  }
1218
1241
  });
1219
1242
 
1220
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/smart-router/router.js
1243
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/smart-router/router.js
1221
1244
  var init_router3 = __esm({
1222
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/smart-router/router.js"() {
1245
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/smart-router/router.js"() {
1223
1246
  "use strict";
1224
1247
  init_esm_shims();
1225
1248
  init_router();
1226
1249
  }
1227
1250
  });
1228
1251
 
1229
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/smart-router/index.js
1252
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/smart-router/index.js
1230
1253
  var init_smart_router = __esm({
1231
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/smart-router/index.js"() {
1254
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/smart-router/index.js"() {
1232
1255
  "use strict";
1233
1256
  init_esm_shims();
1234
1257
  init_router3();
1235
1258
  }
1236
1259
  });
1237
1260
 
1238
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/trie-router/node.js
1261
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/trie-router/node.js
1239
1262
  var init_node2 = __esm({
1240
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/trie-router/node.js"() {
1263
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/trie-router/node.js"() {
1241
1264
  "use strict";
1242
1265
  init_esm_shims();
1243
1266
  init_router();
@@ -1245,9 +1268,9 @@ var init_node2 = __esm({
1245
1268
  }
1246
1269
  });
1247
1270
 
1248
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/trie-router/router.js
1271
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/trie-router/router.js
1249
1272
  var init_router4 = __esm({
1250
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/trie-router/router.js"() {
1273
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/trie-router/router.js"() {
1251
1274
  "use strict";
1252
1275
  init_esm_shims();
1253
1276
  init_url();
@@ -1255,18 +1278,18 @@ var init_router4 = __esm({
1255
1278
  }
1256
1279
  });
1257
1280
 
1258
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/trie-router/index.js
1281
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/trie-router/index.js
1259
1282
  var init_trie_router = __esm({
1260
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/router/trie-router/index.js"() {
1283
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/router/trie-router/index.js"() {
1261
1284
  "use strict";
1262
1285
  init_esm_shims();
1263
1286
  init_router4();
1264
1287
  }
1265
1288
  });
1266
1289
 
1267
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/hono.js
1290
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/hono.js
1268
1291
  var init_hono = __esm({
1269
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/hono.js"() {
1292
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/hono.js"() {
1270
1293
  "use strict";
1271
1294
  init_esm_shims();
1272
1295
  init_hono_base();
@@ -1276,19 +1299,19 @@ var init_hono = __esm({
1276
1299
  }
1277
1300
  });
1278
1301
 
1279
- // ../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/index.js
1302
+ // ../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/index.js
1280
1303
  var init_dist3 = __esm({
1281
- "../node_modules/.pnpm/hono@4.9.10/node_modules/hono/dist/index.js"() {
1304
+ "../node_modules/.pnpm/hono@4.10.1/node_modules/hono/dist/index.js"() {
1282
1305
  "use strict";
1283
1306
  init_esm_shims();
1284
1307
  init_hono();
1285
1308
  }
1286
1309
  });
1287
1310
 
1288
- // ../node_modules/.pnpm/@hono+zod-openapi@1.1.3_hono@4.9.10_zod@4.1.12/node_modules/@hono/zod-openapi/dist/index.js
1311
+ // ../node_modules/.pnpm/@hono+zod-openapi@1.1.4_hono@4.10.1_zod@4.1.12/node_modules/@hono/zod-openapi/dist/index.js
1289
1312
  import { z as z2 } from "zod";
1290
1313
  var init_dist4 = __esm({
1291
- "../node_modules/.pnpm/@hono+zod-openapi@1.1.3_hono@4.9.10_zod@4.1.12/node_modules/@hono/zod-openapi/dist/index.js"() {
1314
+ "../node_modules/.pnpm/@hono+zod-openapi@1.1.4_hono@4.10.1_zod@4.1.12/node_modules/@hono/zod-openapi/dist/index.js"() {
1292
1315
  "use strict";
1293
1316
  init_esm_shims();
1294
1317
  init_dist();
@@ -1584,7 +1607,7 @@ import {
1584
1607
  text,
1585
1608
  unique
1586
1609
  } from "drizzle-orm/sqlite-core";
1587
- var tenantScoped, projectScoped, agentScoped, subAgentScoped, uiProperties, timestamps, projects, agents, contextConfigs, contextCache, subAgents, subAgentRelations, externalAgents, tasks, taskRelations, dataComponents, subAgentDataComponents, artifactComponents, subAgentArtifactComponents, tools, functionTools, functions, subAgentToolRelations, subAgentFunctionToolRelations, conversations, messages, ledgerArtifacts, apiKeys, credentialReferences, tasksRelations, projectsRelations, taskRelationsRelations, contextConfigsRelations, contextCacheRelations, subAgentsRelations, agentRelations, externalAgentsRelations, apiKeysRelations, agentToolRelationsRelations, credentialReferencesRelations, toolsRelations, conversationsRelations, messagesRelations, artifactComponentsRelations, subAgentArtifactComponentsRelations, dataComponentsRelations, subAgentDataComponentsRelations, ledgerArtifactsRelations, functionsRelations, subAgentRelationsRelations, functionToolsRelations, subAgentFunctionToolRelationsRelations;
1610
+ var tenantScoped, projectScoped, agentScoped, subAgentScoped, uiProperties, timestamps, projects, agents, contextConfigs, contextCache, subAgents, subAgentRelations, externalAgents, tasks, taskRelations, dataComponents, subAgentDataComponents, artifactComponents, subAgentArtifactComponents, tools, functionTools, functions, subAgentToolRelations, subAgentExternalAgentRelations, subAgentFunctionToolRelations, conversations, messages, ledgerArtifacts, apiKeys, credentialReferences, tasksRelations, projectsRelations, taskRelationsRelations, contextConfigsRelations, contextCacheRelations, subAgentsRelations, agentRelations, externalAgentsRelations, apiKeysRelations, agentToolRelationsRelations, credentialReferencesRelations, toolsRelations, conversationsRelations, messagesRelations, artifactComponentsRelations, subAgentArtifactComponentsRelations, dataComponentsRelations, subAgentDataComponentsRelations, ledgerArtifactsRelations, functionsRelations, subAgentRelationsRelations, functionToolsRelations, subAgentFunctionToolRelationsRelations, subAgentExternalAgentRelationsRelations;
1588
1611
  var init_schema = __esm({
1589
1612
  "../packages/agents-core/src/db/schema.ts"() {
1590
1613
  "use strict";
@@ -1720,7 +1743,6 @@ var init_schema = __esm({
1720
1743
  ...agentScoped,
1721
1744
  sourceSubAgentId: text("source_sub_agent_id").notNull(),
1722
1745
  targetSubAgentId: text("target_sub_agent_id"),
1723
- externalSubAgentId: text("external_sub_agent_id"),
1724
1746
  relationType: text("relation_type"),
1725
1747
  ...timestamps
1726
1748
  },
@@ -1736,19 +1758,18 @@ var init_schema = __esm({
1736
1758
  externalAgents = sqliteTable(
1737
1759
  "external_agents",
1738
1760
  {
1739
- ...agentScoped,
1761
+ ...projectScoped,
1740
1762
  ...uiProperties,
1741
1763
  baseUrl: text("base_url").notNull(),
1742
1764
  credentialReferenceId: text("credential_reference_id"),
1743
- headers: blob("headers", { mode: "json" }).$type(),
1744
1765
  ...timestamps
1745
1766
  },
1746
1767
  (table) => [
1747
- primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
1768
+ primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
1748
1769
  foreignKey({
1749
- columns: [table.tenantId, table.projectId, table.agentId],
1750
- foreignColumns: [agents.tenantId, agents.projectId, agents.id],
1751
- name: "external_agents_agent_fk"
1770
+ columns: [table.tenantId, table.projectId],
1771
+ foreignColumns: [projects.tenantId, projects.id],
1772
+ name: "external_agents_project_fk"
1752
1773
  }).onDelete("cascade"),
1753
1774
  foreignKey({
1754
1775
  columns: [table.tenantId, table.projectId, table.credentialReferenceId],
@@ -1967,6 +1988,28 @@ var init_schema = __esm({
1967
1988
  }).onDelete("cascade")
1968
1989
  ]
1969
1990
  );
1991
+ subAgentExternalAgentRelations = sqliteTable(
1992
+ "sub_agent_external_agent_relations",
1993
+ {
1994
+ ...subAgentScoped,
1995
+ externalAgentId: text("external_agent_id").notNull(),
1996
+ headers: blob("headers", { mode: "json" }).$type(),
1997
+ ...timestamps
1998
+ },
1999
+ (table) => [
2000
+ primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
2001
+ foreignKey({
2002
+ columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
2003
+ foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
2004
+ name: "sub_agent_external_agent_relations_sub_agent_fk"
2005
+ }).onDelete("cascade"),
2006
+ foreignKey({
2007
+ columns: [table.tenantId, table.projectId, table.externalAgentId],
2008
+ foreignColumns: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id],
2009
+ name: "sub_agent_external_agent_relations_external_agent_fk"
2010
+ }).onDelete("cascade")
2011
+ ]
2012
+ );
1970
2013
  subAgentFunctionToolRelations = sqliteTable(
1971
2014
  "sub_agent_function_tool_relations",
1972
2015
  {
@@ -2228,7 +2271,7 @@ var init_schema = __esm({
2228
2271
  fields: [externalAgents.tenantId, externalAgents.projectId],
2229
2272
  references: [projects.tenantId, projects.id]
2230
2273
  }),
2231
- subAgentRelations: many(subAgentRelations),
2274
+ subAgentExternalAgentRelations: many(subAgentExternalAgentRelations),
2232
2275
  credentialReference: one(credentialReferences, {
2233
2276
  fields: [externalAgents.credentialReferenceId],
2234
2277
  references: [credentialReferences.id]
@@ -2300,13 +2343,13 @@ var init_schema = __esm({
2300
2343
  relationName: "receivedMessages"
2301
2344
  }),
2302
2345
  fromExternalAgent: one(externalAgents, {
2303
- fields: [messages.fromExternalAgentId],
2304
- references: [externalAgents.id],
2346
+ fields: [messages.tenantId, messages.projectId, messages.fromExternalAgentId],
2347
+ references: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id],
2305
2348
  relationName: "receivedExternalMessages"
2306
2349
  }),
2307
2350
  toExternalAgent: one(externalAgents, {
2308
- fields: [messages.toExternalAgentId],
2309
- references: [externalAgents.id],
2351
+ fields: [messages.tenantId, messages.projectId, messages.toExternalAgentId],
2352
+ references: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id],
2310
2353
  relationName: "sentExternalMessages"
2311
2354
  }),
2312
2355
  task: one(tasks, {
@@ -2390,10 +2433,6 @@ var init_schema = __esm({
2390
2433
  fields: [subAgentRelations.targetSubAgentId],
2391
2434
  references: [subAgents.id],
2392
2435
  relationName: "targetRelations"
2393
- }),
2394
- externalAgent: one(externalAgents, {
2395
- fields: [subAgentRelations.externalSubAgentId],
2396
- references: [externalAgents.id]
2397
2436
  })
2398
2437
  }));
2399
2438
  functionToolsRelations = relations(functionTools, ({ one, many }) => ({
@@ -2424,6 +2463,28 @@ var init_schema = __esm({
2424
2463
  })
2425
2464
  })
2426
2465
  );
2466
+ subAgentExternalAgentRelationsRelations = relations(
2467
+ subAgentExternalAgentRelations,
2468
+ ({ one }) => ({
2469
+ subAgent: one(subAgents, {
2470
+ fields: [
2471
+ subAgentExternalAgentRelations.tenantId,
2472
+ subAgentExternalAgentRelations.projectId,
2473
+ subAgentExternalAgentRelations.agentId,
2474
+ subAgentExternalAgentRelations.subAgentId
2475
+ ],
2476
+ references: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id]
2477
+ }),
2478
+ externalAgent: one(externalAgents, {
2479
+ fields: [
2480
+ subAgentExternalAgentRelations.tenantId,
2481
+ subAgentExternalAgentRelations.projectId,
2482
+ subAgentExternalAgentRelations.externalAgentId
2483
+ ],
2484
+ references: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id]
2485
+ })
2486
+ })
2487
+ );
2427
2488
  }
2428
2489
  });
2429
2490
 
@@ -2452,7 +2513,7 @@ var init_utility = __esm({
2452
2513
  });
2453
2514
 
2454
2515
  // ../packages/agents-core/src/validation/schemas.ts
2455
- var StopWhenSchema, AgentStopWhenSchema, SubAgentStopWhenSchema, MIN_ID_LENGTH, MAX_ID_LENGTH, URL_SAFE_ID_PATTERN, resourceIdSchema, ModelSettingsSchema, ModelSchema, ProjectModelSchema, FunctionToolConfigSchema, createApiSchema, createApiInsertSchema, createApiUpdateSchema, createAgentScopedApiSchema, createAgentScopedApiInsertSchema, createAgentScopedApiUpdateSchema, SubAgentSelectSchema, SubAgentInsertSchema, SubAgentUpdateSchema, SubAgentApiSelectSchema, SubAgentApiInsertSchema, SubAgentApiUpdateSchema, SubAgentRelationSelectSchema, SubAgentRelationInsertSchema, SubAgentRelationUpdateSchema, SubAgentRelationApiSelectSchema, SubAgentRelationApiInsertSchema, SubAgentRelationApiUpdateSchema, SubAgentRelationQuerySchema, ExternalSubAgentRelationInsertSchema, ExternalSubAgentRelationApiInsertSchema, AgentSelectSchema, AgentInsertSchema, AgentUpdateSchema, AgentApiSelectSchema, AgentApiInsertSchema, AgentApiUpdateSchema, 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, SubAgentDataComponentSelectSchema, SubAgentDataComponentInsertSchema, SubAgentDataComponentUpdateSchema, SubAgentDataComponentApiSelectSchema, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiUpdateSchema, ArtifactComponentSelectSchema, ArtifactComponentInsertSchema, ArtifactComponentUpdateSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiUpdateSchema, SubAgentArtifactComponentSelectSchema, SubAgentArtifactComponentInsertSchema, SubAgentArtifactComponentUpdateSchema, SubAgentArtifactComponentApiSelectSchema, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiUpdateSchema, ExternalAgentSelectSchema, ExternalAgentInsertSchema, ExternalAgentUpdateSchema, ExternalAgentApiSelectSchema, ExternalAgentApiInsertSchema, ExternalAgentApiUpdateSchema, AllAgentSchema, ApiKeySelectSchema, ApiKeyInsertSchema, ApiKeyUpdateSchema, ApiKeyApiSelectSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiUpdateSchema, CredentialReferenceSelectSchema, CredentialReferenceInsertSchema, CredentialReferenceUpdateSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiUpdateSchema, McpToolSchema, MCPToolConfigSchema, ToolUpdateSchema, ToolApiSelectSchema, ToolApiInsertSchema, ToolApiUpdateSchema, FunctionToolSelectSchema, FunctionToolInsertSchema, FunctionToolUpdateSchema, FunctionToolApiSelectSchema, FunctionToolApiInsertSchema, FunctionToolApiUpdateSchema, FunctionSelectSchema, FunctionInsertSchema, FunctionUpdateSchema, FunctionApiSelectSchema, FunctionApiInsertSchema, FunctionApiUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, ContextConfigSelectSchema, ContextConfigInsertSchema, ContextConfigUpdateSchema, ContextConfigApiSelectSchema, ContextConfigApiInsertSchema, ContextConfigApiUpdateSchema, SubAgentToolRelationSelectSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationUpdateSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiUpdateSchema, LedgerArtifactSelectSchema, LedgerArtifactInsertSchema, LedgerArtifactUpdateSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiUpdateSchema, StatusComponentSchema, StatusUpdateSchema, CanUseItemSchema, FullAgentAgentInsertSchema, AgentWithinContextOfProjectSchema, PaginationSchema, ErrorResponseSchema, ExistsResponseSchema, RemovedResponseSchema, ProjectSelectSchema, ProjectInsertSchema, ProjectUpdateSchema, ProjectApiSelectSchema, ProjectApiInsertSchema, ProjectApiUpdateSchema, FullProjectDefinitionSchema, ProjectResponse, SubAgentResponse, AgentResponse, ToolResponse, ExternalAgentResponse, ContextConfigResponse, ApiKeyResponse, CredentialReferenceResponse, FunctionResponse, FunctionToolResponse, DataComponentResponse, ArtifactComponentResponse, SubAgentRelationResponse, SubAgentToolRelationResponse, ConversationResponse, MessageResponse, ProjectListResponse, SubAgentListResponse, AgentListResponse, ToolListResponse, ExternalAgentListResponse, ContextConfigListResponse, ApiKeyListResponse, CredentialReferenceListResponse, FunctionListResponse, FunctionToolListResponse, DataComponentListResponse, ArtifactComponentListResponse, SubAgentRelationListResponse, SubAgentToolRelationListResponse, ConversationListResponse, MessageListResponse, SubAgentDataComponentResponse, SubAgentArtifactComponentResponse, SubAgentDataComponentListResponse, SubAgentArtifactComponentListResponse, HeadersScopeSchema, TenantId, ProjectId, AgentId, SubAgentId, TenantParamsSchema, TenantIdParamsSchema, TenantProjectParamsSchema, TenantProjectIdParamsSchema, TenantProjectAgentParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentSubAgentParamsSchema, TenantProjectAgentSubAgentIdParamsSchema, PaginationQueryParamsSchema;
2516
+ var StopWhenSchema, AgentStopWhenSchema, SubAgentStopWhenSchema, MIN_ID_LENGTH, MAX_ID_LENGTH, URL_SAFE_ID_PATTERN, resourceIdSchema, ModelSettingsSchema, ModelSchema, ProjectModelSchema, FunctionToolConfigSchema, createApiSchema, createApiInsertSchema, createApiUpdateSchema, createAgentScopedApiSchema, createAgentScopedApiInsertSchema, createAgentScopedApiUpdateSchema, SubAgentSelectSchema, SubAgentInsertSchema, SubAgentUpdateSchema, SubAgentApiSelectSchema, SubAgentApiInsertSchema, SubAgentApiUpdateSchema, SubAgentRelationSelectSchema, SubAgentRelationInsertSchema, SubAgentRelationUpdateSchema, SubAgentRelationApiSelectSchema, SubAgentRelationApiInsertSchema, SubAgentRelationApiUpdateSchema, SubAgentRelationQuerySchema, ExternalSubAgentRelationInsertSchema, ExternalSubAgentRelationApiInsertSchema, AgentSelectSchema, AgentInsertSchema, AgentUpdateSchema, AgentApiSelectSchema, AgentApiInsertSchema, AgentApiUpdateSchema, 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, SubAgentDataComponentSelectSchema, SubAgentDataComponentInsertSchema, SubAgentDataComponentUpdateSchema, SubAgentDataComponentApiSelectSchema, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiUpdateSchema, ArtifactComponentSelectSchema, ArtifactComponentInsertSchema, ArtifactComponentUpdateSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiUpdateSchema, SubAgentArtifactComponentSelectSchema, SubAgentArtifactComponentInsertSchema, SubAgentArtifactComponentUpdateSchema, SubAgentArtifactComponentApiSelectSchema, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiUpdateSchema, ExternalAgentSelectSchema, ExternalAgentInsertSchema, ExternalAgentUpdateSchema, ExternalAgentApiSelectSchema, ExternalAgentApiInsertSchema, ExternalAgentApiUpdateSchema, AllAgentSchema, ApiKeySelectSchema, ApiKeyInsertSchema, ApiKeyUpdateSchema, ApiKeyApiSelectSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiUpdateSchema, CredentialReferenceSelectSchema, CredentialReferenceInsertSchema, CredentialReferenceUpdateSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiUpdateSchema, McpToolSchema, MCPToolConfigSchema, ToolUpdateSchema, ToolApiSelectSchema, ToolApiInsertSchema, ToolApiUpdateSchema, FunctionToolSelectSchema, FunctionToolInsertSchema, FunctionToolUpdateSchema, FunctionToolApiSelectSchema, FunctionToolApiInsertSchema, FunctionToolApiUpdateSchema, FunctionSelectSchema, FunctionInsertSchema, FunctionUpdateSchema, FunctionApiSelectSchema, FunctionApiInsertSchema, FunctionApiUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, ContextConfigSelectSchema, ContextConfigInsertSchema, ContextConfigUpdateSchema, ContextConfigApiSelectSchema, ContextConfigApiInsertSchema, ContextConfigApiUpdateSchema, SubAgentToolRelationSelectSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationUpdateSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiUpdateSchema, SubAgentExternalAgentRelationSelectSchema, SubAgentExternalAgentRelationInsertSchema, SubAgentExternalAgentRelationUpdateSchema, SubAgentExternalAgentRelationApiSelectSchema, SubAgentExternalAgentRelationApiInsertSchema, SubAgentExternalAgentRelationApiUpdateSchema, LedgerArtifactSelectSchema, LedgerArtifactInsertSchema, LedgerArtifactUpdateSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiUpdateSchema, StatusComponentSchema, StatusUpdateSchema, CanUseItemSchema, canDelegateToExternalAgentSchema, FullAgentAgentInsertSchema, AgentWithinContextOfProjectSchema, PaginationSchema, ErrorResponseSchema, ExistsResponseSchema, RemovedResponseSchema, ProjectSelectSchema, ProjectInsertSchema, ProjectUpdateSchema, ProjectApiSelectSchema, ProjectApiInsertSchema, ProjectApiUpdateSchema, FullProjectDefinitionSchema, ProjectResponse, SubAgentResponse, AgentResponse, ToolResponse, ExternalAgentResponse, ContextConfigResponse, ApiKeyResponse, CredentialReferenceResponse, FunctionResponse, FunctionToolResponse, DataComponentResponse, ArtifactComponentResponse, SubAgentRelationResponse, SubAgentToolRelationResponse, ConversationResponse, MessageResponse, ProjectListResponse, SubAgentListResponse, AgentListResponse, ToolListResponse, ExternalAgentListResponse, ContextConfigListResponse, ApiKeyListResponse, CredentialReferenceListResponse, FunctionListResponse, FunctionToolListResponse, DataComponentListResponse, ArtifactComponentListResponse, SubAgentRelationListResponse, SubAgentToolRelationListResponse, ConversationListResponse, MessageListResponse, SubAgentDataComponentResponse, SubAgentArtifactComponentResponse, SubAgentDataComponentListResponse, SubAgentArtifactComponentListResponse, HeadersScopeSchema, TenantId, ProjectId, AgentId, SubAgentId, TenantParamsSchema, TenantIdParamsSchema, TenantProjectParamsSchema, TenantProjectIdParamsSchema, TenantProjectAgentParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentSubAgentParamsSchema, TenantProjectAgentSubAgentIdParamsSchema, PaginationQueryParamsSchema;
2456
2517
  var init_schemas = __esm({
2457
2518
  "../packages/agents-core/src/validation/schemas.ts"() {
2458
2519
  "use strict";
@@ -2754,16 +2815,15 @@ var init_schemas = __esm({
2754
2815
  SubAgentArtifactComponentUpdateSchema
2755
2816
  );
2756
2817
  ExternalAgentSelectSchema = createSelectSchema(externalAgents).extend({
2757
- credentialReferenceId: z2.string().nullable().optional(),
2758
- headers: z2.record(z2.string(), z2.string()).nullable().optional()
2818
+ credentialReferenceId: z2.string().nullable().optional()
2759
2819
  });
2760
2820
  ExternalAgentInsertSchema = createInsertSchema(externalAgents).extend({
2761
2821
  id: resourceIdSchema
2762
2822
  });
2763
2823
  ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
2764
- ExternalAgentApiSelectSchema = createAgentScopedApiSchema(ExternalAgentSelectSchema).openapi("ExternalAgent");
2765
- ExternalAgentApiInsertSchema = createAgentScopedApiInsertSchema(ExternalAgentInsertSchema).openapi("ExternalAgentCreate");
2766
- ExternalAgentApiUpdateSchema = createAgentScopedApiUpdateSchema(ExternalAgentUpdateSchema).openapi("ExternalAgentUpdate");
2824
+ ExternalAgentApiSelectSchema = createApiSchema(ExternalAgentSelectSchema).openapi("ExternalAgent");
2825
+ ExternalAgentApiInsertSchema = createApiInsertSchema(ExternalAgentInsertSchema).openapi("ExternalAgentCreate");
2826
+ ExternalAgentApiUpdateSchema = createApiUpdateSchema(ExternalAgentUpdateSchema).openapi("ExternalAgentUpdate");
2767
2827
  AllAgentSchema = z2.discriminatedUnion("type", [
2768
2828
  SubAgentApiSelectSchema.extend({ type: z2.literal("internal") }),
2769
2829
  ExternalAgentApiSelectSchema.extend({ type: z2.literal("external") })
@@ -2828,7 +2888,8 @@ var init_schemas = __esm({
2828
2888
  CredentialReferenceUpdateSchema = CredentialReferenceInsertSchema.partial();
2829
2889
  CredentialReferenceApiSelectSchema = createApiSchema(CredentialReferenceSelectSchema).extend({
2830
2890
  type: z2.enum(CredentialStoreType),
2831
- tools: z2.array(ToolSelectSchema).optional()
2891
+ tools: z2.array(ToolSelectSchema).optional(),
2892
+ externalAgents: z2.array(ExternalAgentSelectSchema).optional()
2832
2893
  }).openapi("CredentialReference");
2833
2894
  CredentialReferenceApiInsertSchema = createApiInsertSchema(
2834
2895
  CredentialReferenceInsertSchema
@@ -2957,6 +3018,27 @@ var init_schemas = __esm({
2957
3018
  SubAgentToolRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
2958
3019
  SubAgentToolRelationUpdateSchema
2959
3020
  ).openapi("SubAgentToolRelationUpdate");
3021
+ SubAgentExternalAgentRelationSelectSchema = createSelectSchema(
3022
+ subAgentExternalAgentRelations
3023
+ );
3024
+ SubAgentExternalAgentRelationInsertSchema = createInsertSchema(
3025
+ subAgentExternalAgentRelations
3026
+ ).extend({
3027
+ id: resourceIdSchema,
3028
+ subAgentId: resourceIdSchema,
3029
+ externalAgentId: resourceIdSchema,
3030
+ headers: z2.record(z2.string(), z2.string()).nullish()
3031
+ });
3032
+ SubAgentExternalAgentRelationUpdateSchema = SubAgentExternalAgentRelationInsertSchema.partial();
3033
+ SubAgentExternalAgentRelationApiSelectSchema = createAgentScopedApiSchema(
3034
+ SubAgentExternalAgentRelationSelectSchema
3035
+ ).openapi("SubAgentExternalAgentRelation");
3036
+ SubAgentExternalAgentRelationApiInsertSchema = createAgentScopedApiInsertSchema(
3037
+ SubAgentExternalAgentRelationInsertSchema
3038
+ ).omit({ id: true, subAgentId: true }).openapi("SubAgentExternalAgentRelationCreate");
3039
+ SubAgentExternalAgentRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
3040
+ SubAgentExternalAgentRelationUpdateSchema
3041
+ ).openapi("SubAgentExternalAgentRelationUpdate");
2960
3042
  LedgerArtifactSelectSchema = createSelectSchema(ledgerArtifacts);
2961
3043
  LedgerArtifactInsertSchema = createInsertSchema(ledgerArtifacts);
2962
3044
  LedgerArtifactUpdateSchema = LedgerArtifactInsertSchema.partial();
@@ -2985,6 +3067,11 @@ var init_schemas = __esm({
2985
3067
  toolSelection: z2.array(z2.string()).nullish(),
2986
3068
  headers: z2.record(z2.string(), z2.string()).nullish()
2987
3069
  }).openapi("CanUseItem");
3070
+ canDelegateToExternalAgentSchema = z2.object({
3071
+ externalAgentId: z2.string(),
3072
+ subAgentExternalAgentRelationId: z2.string().optional(),
3073
+ headers: z2.record(z2.string(), z2.string()).nullish()
3074
+ });
2988
3075
  FullAgentAgentInsertSchema = SubAgentApiInsertSchema.extend({
2989
3076
  type: z2.literal("internal"),
2990
3077
  canUse: z2.array(CanUseItemSchema),
@@ -2992,16 +3079,22 @@ var init_schemas = __esm({
2992
3079
  dataComponents: z2.array(z2.string()).optional(),
2993
3080
  artifactComponents: z2.array(z2.string()).optional(),
2994
3081
  canTransferTo: z2.array(z2.string()).optional(),
2995
- canDelegateTo: z2.array(z2.string()).optional()
3082
+ canDelegateTo: z2.array(
3083
+ z2.union([
3084
+ z2.string(),
3085
+ // Internal subAgent ID
3086
+ canDelegateToExternalAgentSchema
3087
+ // External agent with headers
3088
+ ])
3089
+ ).optional()
2996
3090
  });
2997
3091
  AgentWithinContextOfProjectSchema = AgentApiInsertSchema.extend({
2998
- subAgents: z2.record(
2999
- z2.string(),
3000
- z2.union([FullAgentAgentInsertSchema, ExternalAgentApiInsertSchema])
3001
- ),
3092
+ subAgents: z2.record(z2.string(), FullAgentAgentInsertSchema),
3002
3093
  // Lookup maps for UI to resolve canUse items
3003
3094
  tools: z2.record(z2.string(), ToolApiInsertSchema).optional(),
3004
3095
  // MCP tools (project-scoped)
3096
+ externalAgents: z2.record(z2.string(), ExternalAgentApiInsertSchema).optional(),
3097
+ // External agents (project-scoped)
3005
3098
  functionTools: z2.record(z2.string(), FunctionToolApiInsertSchema).optional(),
3006
3099
  // Function tools (agent-scoped)
3007
3100
  functions: z2.record(z2.string(), FunctionApiInsertSchema).optional(),
@@ -3056,6 +3149,7 @@ var init_schemas = __esm({
3056
3149
  functions: z2.record(z2.string(), FunctionApiInsertSchema).optional(),
3057
3150
  dataComponents: z2.record(z2.string(), DataComponentApiInsertSchema).optional(),
3058
3151
  artifactComponents: z2.record(z2.string(), ArtifactComponentApiInsertSchema).optional(),
3152
+ externalAgents: z2.record(z2.string(), ExternalAgentApiInsertSchema).optional(),
3059
3153
  statusUpdates: z2.optional(StatusUpdateSchema),
3060
3154
  credentialReferences: z2.record(z2.string(), CredentialReferenceApiInsertSchema).optional(),
3061
3155
  createdAt: z2.string().optional(),
@@ -4824,6 +4918,7 @@ var init_contextConfigs = __esm({
4824
4918
  "../packages/agents-core/src/data-access/contextConfigs.ts"() {
4825
4919
  "use strict";
4826
4920
  init_esm_shims();
4921
+ init_conversations();
4827
4922
  init_schema();
4828
4923
  }
4829
4924
  });
@@ -4955,16 +5050,16 @@ var require_util = __commonJS({
4955
5050
  var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
4956
5051
  var dataUrlRegexp = /^data:.+\,.+$/;
4957
5052
  function urlParse(aUrl) {
4958
- var match = aUrl.match(urlRegexp);
4959
- if (!match) {
5053
+ var match2 = aUrl.match(urlRegexp);
5054
+ if (!match2) {
4960
5055
  return null;
4961
5056
  }
4962
5057
  return {
4963
- scheme: match[1],
4964
- auth: match[2],
4965
- host: match[3],
4966
- port: match[4],
4967
- path: match[5]
5058
+ scheme: match2[1],
5059
+ auth: match2[2],
5060
+ host: match2[3],
5061
+ port: match2[4],
5062
+ path: match2[5]
4968
5063
  };
4969
5064
  }
4970
5065
  exports.urlParse = urlParse;
@@ -6762,8 +6857,8 @@ var require_source_map_support = __commonJS({
6762
6857
  function supportRelativeURL(file, url) {
6763
6858
  if (!file) return url;
6764
6859
  var dir = path4.dirname(file);
6765
- var match = /^\w+:\/\/[^\/]*/.exec(dir);
6766
- var protocol = match ? match[0] : "";
6860
+ var match2 = /^\w+:\/\/[^\/]*/.exec(dir);
6861
+ var protocol = match2 ? match2[0] : "";
6767
6862
  var startPath = dir.slice(protocol.length);
6768
6863
  if (protocol && /^\/\w\:/.test(startPath)) {
6769
6864
  protocol += "/";
@@ -6788,8 +6883,8 @@ var require_source_map_support = __commonJS({
6788
6883
  }
6789
6884
  fileData = retrieveFile(source);
6790
6885
  var re2 = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
6791
- var lastMatch, match;
6792
- while (match = re2.exec(fileData)) lastMatch = match;
6886
+ var lastMatch, match2;
6887
+ while (match2 = re2.exec(fileData)) lastMatch = match2;
6793
6888
  if (!lastMatch) return null;
6794
6889
  return lastMatch[1];
6795
6890
  }
@@ -6852,18 +6947,18 @@ var require_source_map_support = __commonJS({
6852
6947
  return position;
6853
6948
  }
6854
6949
  function mapEvalOrigin(origin) {
6855
- var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
6856
- if (match) {
6950
+ var match2 = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
6951
+ if (match2) {
6857
6952
  var position = mapSourcePosition({
6858
- source: match[2],
6859
- line: +match[3],
6860
- column: match[4] - 1
6953
+ source: match2[2],
6954
+ line: +match2[3],
6955
+ column: match2[4] - 1
6861
6956
  });
6862
- return "eval at " + match[1] + " (" + position.source + ":" + position.line + ":" + (position.column + 1) + ")";
6957
+ return "eval at " + match2[1] + " (" + position.source + ":" + position.line + ":" + (position.column + 1) + ")";
6863
6958
  }
6864
- match = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
6865
- if (match) {
6866
- return "eval at " + match[1] + " (" + mapEvalOrigin(match[2]) + ")";
6959
+ match2 = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
6960
+ if (match2) {
6961
+ return "eval at " + match2[1] + " (" + mapEvalOrigin(match2[2]) + ")";
6867
6962
  }
6868
6963
  return origin;
6869
6964
  }
@@ -7011,11 +7106,11 @@ var require_source_map_support = __commonJS({
7011
7106
  return errorString + processedStack.reverse().join("");
7012
7107
  }
7013
7108
  function getErrorSource(error) {
7014
- var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
7015
- if (match) {
7016
- var source = match[1];
7017
- var line = +match[2];
7018
- var column = +match[3];
7109
+ var match2 = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
7110
+ if (match2) {
7111
+ var source = match2[1];
7112
+ var line = +match2[2];
7113
+ var column = +match2[3];
7019
7114
  var contents = fileContentsCache[source];
7020
7115
  if (!contents && fs5 && fs5.existsSync(source)) {
7021
7116
  try {
@@ -7146,11 +7241,11 @@ var require_typescript = __commonJS({
7146
7241
  for (var name in all)
7147
7242
  __defProp2(target, name, { get: all[name], enumerable: true });
7148
7243
  };
7149
- var __copyProps2 = (to, from, except, desc15) => {
7244
+ var __copyProps2 = (to, from, except, desc16) => {
7150
7245
  if (from && typeof from === "object" || typeof from === "function") {
7151
7246
  for (let key of __getOwnPropNames2(from))
7152
7247
  if (!__hasOwnProp2.call(to, key) && key !== except)
7153
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc15 = __getOwnPropDesc2(from, key)) || desc15.enumerable });
7248
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc16 = __getOwnPropDesc2(from, key)) || desc16.enumerable });
7154
7249
  }
7155
7250
  return to;
7156
7251
  };
@@ -7334,7 +7429,7 @@ var require_typescript = __commonJS({
7334
7429
  affectsEmitOptionDeclarations: () => affectsEmitOptionDeclarations,
7335
7430
  allKeysStartWithDot: () => allKeysStartWithDot,
7336
7431
  altDirectorySeparator: () => altDirectorySeparator,
7337
- and: () => and20,
7432
+ and: () => and21,
7338
7433
  append: () => append,
7339
7434
  appendIfUnique: () => appendIfUnique,
7340
7435
  arrayFrom: () => arrayFrom,
@@ -9556,16 +9651,16 @@ var require_typescript = __commonJS({
9556
9651
  return -1;
9557
9652
  }
9558
9653
  function countWhere(array, predicate) {
9559
- let count16 = 0;
9654
+ let count17 = 0;
9560
9655
  if (array !== void 0) {
9561
9656
  for (let i2 = 0; i2 < array.length; i2++) {
9562
9657
  const v2 = array[i2];
9563
9658
  if (predicate(v2, i2)) {
9564
- count16++;
9659
+ count17++;
9565
9660
  }
9566
9661
  }
9567
9662
  }
9568
- return count16;
9663
+ return count17;
9569
9664
  }
9570
9665
  function filter(array, f) {
9571
9666
  if (array !== void 0) {
@@ -10118,12 +10213,12 @@ var require_typescript = __commonJS({
10118
10213
  }
10119
10214
  return ~low;
10120
10215
  }
10121
- function reduceLeft(array, f, initial, start, count16) {
10216
+ function reduceLeft(array, f, initial, start, count17) {
10122
10217
  if (array && array.length > 0) {
10123
10218
  const size = array.length;
10124
10219
  if (size > 0) {
10125
10220
  let pos = start === void 0 || start < 0 ? 0 : start;
10126
- const end = count16 === void 0 || pos + count16 > size - 1 ? size - 1 : pos + count16;
10221
+ const end = count17 === void 0 || pos + count17 > size - 1 ? size - 1 : pos + count17;
10127
10222
  let result;
10128
10223
  if (arguments.length <= 2) {
10129
10224
  result = array[pos];
@@ -10175,9 +10270,9 @@ var require_typescript = __commonJS({
10175
10270
  }
10176
10271
  return values;
10177
10272
  }
10178
- function arrayOf(count16, f) {
10179
- const result = new Array(count16);
10180
- for (let i2 = 0; i2 < count16; i2++) {
10273
+ function arrayOf(count17, f) {
10274
+ const result = new Array(count17);
10275
+ for (let i2 = 0; i2 < count17; i2++) {
10181
10276
  result[i2] = f(i2);
10182
10277
  }
10183
10278
  return result;
@@ -10785,7 +10880,7 @@ var require_typescript = __commonJS({
10785
10880
  function isPatternMatch({ prefix, suffix }, candidate) {
10786
10881
  return candidate.length >= prefix.length + suffix.length && startsWith(candidate, prefix) && endsWith(candidate, suffix);
10787
10882
  }
10788
- function and20(f, g) {
10883
+ function and21(f, g) {
10789
10884
  return (arg) => f(arg) && g(arg);
10790
10885
  }
10791
10886
  function or(...fs5) {
@@ -11123,8 +11218,8 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
11123
11218
  return func.name;
11124
11219
  } else {
11125
11220
  const text4 = Function.prototype.toString.call(func);
11126
- const match = /^function\s+([\w$]+)\s*\(/.exec(text4);
11127
- return match ? match[1] : "";
11221
+ const match2 = /^function\s+([\w$]+)\s*\(/.exec(text4);
11222
+ return match2 ? match2[1] : "";
11128
11223
  }
11129
11224
  }
11130
11225
  Debug2.getFunctionName = getFunctionName;
@@ -11988,9 +12083,9 @@ ${lanes.join("\n")}
11988
12083
  _Version.zero = new _Version(0, 0, 0, ["0"]);
11989
12084
  var Version = _Version;
11990
12085
  function tryParseComponents(text4) {
11991
- const match = versionRegExp.exec(text4);
11992
- if (!match) return void 0;
11993
- const [, major2, minor = "0", patch = "0", prerelease = "", build2 = ""] = match;
12086
+ const match2 = versionRegExp.exec(text4);
12087
+ if (!match2) return void 0;
12088
+ const [, major2, minor = "0", patch = "0", prerelease = "", build2 = ""] = match2;
11994
12089
  if (prerelease && !prereleaseRegExp.test(prerelease)) return void 0;
11995
12090
  if (build2 && !buildRegExp.test(build2)) return void 0;
11996
12091
  return {
@@ -12059,13 +12154,13 @@ ${lanes.join("\n")}
12059
12154
  if (!range) continue;
12060
12155
  const comparators = [];
12061
12156
  range = range.trim();
12062
- const match = hyphenRegExp.exec(range);
12063
- if (match) {
12064
- if (!parseHyphen(match[1], match[2], comparators)) return void 0;
12157
+ const match2 = hyphenRegExp.exec(range);
12158
+ if (match2) {
12159
+ if (!parseHyphen(match2[1], match2[2], comparators)) return void 0;
12065
12160
  } else {
12066
12161
  for (const simple of range.split(whitespaceRegExp)) {
12067
- const match2 = rangeRegExp.exec(simple.trim());
12068
- if (!match2 || !parseComparator(match2[1], match2[2], comparators)) return void 0;
12162
+ const match22 = rangeRegExp.exec(simple.trim());
12163
+ if (!match22 || !parseComparator(match22[1], match22[2], comparators)) return void 0;
12069
12164
  }
12070
12165
  }
12071
12166
  alternatives.push(comparators);
@@ -12073,9 +12168,9 @@ ${lanes.join("\n")}
12073
12168
  return alternatives;
12074
12169
  }
12075
12170
  function parsePartial(text4) {
12076
- const match = partialRegExp.exec(text4);
12077
- if (!match) return void 0;
12078
- const [, major2, minor = "*", patch = "*", prerelease, build2] = match;
12171
+ const match2 = partialRegExp.exec(text4);
12172
+ if (!match2) return void 0;
12173
+ const [, major2, minor = "*", patch = "*", prerelease, build2] = match2;
12079
12174
  const version2 = new Version(
12080
12175
  isWildcard(major2) ? 0 : parseInt(major2, 10),
12081
12176
  isWildcard(major2) || isWildcard(minor) ? 0 : parseInt(minor, 10),
@@ -12292,8 +12387,8 @@ ${lanes.join("\n")}
12292
12387
  var durations = /* @__PURE__ */ new Map();
12293
12388
  function mark(markName) {
12294
12389
  if (enabled) {
12295
- const count16 = counts.get(markName) ?? 0;
12296
- counts.set(markName, count16 + 1);
12390
+ const count17 = counts.get(markName) ?? 0;
12391
+ counts.set(markName, count17 + 1);
12297
12392
  marks.set(markName, timestamp());
12298
12393
  performanceImpl == null ? void 0 : performanceImpl.mark(markName);
12299
12394
  if (typeof onProfilerEvent === "function") {
@@ -19541,9 +19636,9 @@ ${lanes.join("\n")}
19541
19636
  );
19542
19637
  }
19543
19638
  function getShebang(text4) {
19544
- const match = shebangTriviaRegex.exec(text4);
19545
- if (match) {
19546
- return match[0];
19639
+ const match2 = shebangTriviaRegex.exec(text4);
19640
+ if (match2) {
19641
+ return match2[0];
19547
19642
  }
19548
19643
  }
19549
19644
  function isIdentifierStart(ch, languageVersion) {
@@ -19804,20 +19899,20 @@ ${lanes.join("\n")}
19804
19899
  tokenValue = text4.substring(start2, pos);
19805
19900
  return isOctal;
19806
19901
  }
19807
- function scanExactNumberOfHexDigits(count16, canHaveSeparators) {
19902
+ function scanExactNumberOfHexDigits(count17, canHaveSeparators) {
19808
19903
  const valueString = scanHexDigits(
19809
19904
  /*minCount*/
19810
- count16,
19905
+ count17,
19811
19906
  /*scanAsManyAsPossible*/
19812
19907
  false,
19813
19908
  canHaveSeparators
19814
19909
  );
19815
19910
  return valueString ? parseInt(valueString, 16) : -1;
19816
19911
  }
19817
- function scanMinimumNumberOfHexDigits(count16, canHaveSeparators) {
19912
+ function scanMinimumNumberOfHexDigits(count17, canHaveSeparators) {
19818
19913
  return scanHexDigits(
19819
19914
  /*minCount*/
19820
- count16,
19915
+ count17,
19821
19916
  /*scanAsManyAsPossible*/
19822
19917
  true,
19823
19918
  canHaveSeparators
@@ -21811,11 +21906,11 @@ ${lanes.join("\n")}
21811
21906
  );
21812
21907
  }
21813
21908
  function getDirectiveFromComment(text22, commentDirectiveRegEx) {
21814
- const match = commentDirectiveRegEx.exec(text22);
21815
- if (!match) {
21909
+ const match2 = commentDirectiveRegEx.exec(text22);
21910
+ if (!match2) {
21816
21911
  return void 0;
21817
21912
  }
21818
- switch (match[1]) {
21913
+ switch (match2[1]) {
21819
21914
  case "ts-expect-error":
21820
21915
  return 0;
21821
21916
  case "ts-ignore":
@@ -29996,8 +30091,8 @@ ${lanes.join("\n")}
29996
30091
  function regExpEscape(text4) {
29997
30092
  return text4.replace(reservedCharacterPattern, escapeRegExpCharacter);
29998
30093
  }
29999
- function escapeRegExpCharacter(match) {
30000
- return "\\" + match;
30094
+ function escapeRegExpCharacter(match2) {
30095
+ return "\\" + match2;
30001
30096
  }
30002
30097
  var wildcardCharCodes = [
30003
30098
  42,
@@ -30019,7 +30114,7 @@ ${lanes.join("\n")}
30019
30114
  * files or directories, does not match subdirectories that start with a . character
30020
30115
  */
30021
30116
  doubleAsteriskRegexFragment: `(?:/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
30022
- replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment)
30117
+ replaceWildcardCharacter: (match2) => replaceWildcardCharacter(match2, filesMatcher.singleAsteriskRegexFragment)
30023
30118
  };
30024
30119
  var directoriesMatcher = {
30025
30120
  singleAsteriskRegexFragment: "[^/]*",
@@ -30028,12 +30123,12 @@ ${lanes.join("\n")}
30028
30123
  * files or directories, does not match subdirectories that start with a . character
30029
30124
  */
30030
30125
  doubleAsteriskRegexFragment: `(?:/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
30031
- replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment)
30126
+ replaceWildcardCharacter: (match2) => replaceWildcardCharacter(match2, directoriesMatcher.singleAsteriskRegexFragment)
30032
30127
  };
30033
30128
  var excludeMatcher = {
30034
30129
  singleAsteriskRegexFragment: "[^/]*",
30035
30130
  doubleAsteriskRegexFragment: "(?:/.+?)?",
30036
- replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment)
30131
+ replaceWildcardCharacter: (match2) => replaceWildcardCharacter(match2, excludeMatcher.singleAsteriskRegexFragment)
30037
30132
  };
30038
30133
  var wildcardMatchers = {
30039
30134
  files: filesMatcher,
@@ -30112,8 +30207,8 @@ ${lanes.join("\n")}
30112
30207
  }
30113
30208
  return subpattern;
30114
30209
  }
30115
- function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
30116
- return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
30210
+ function replaceWildcardCharacter(match2, singleAsteriskRegexFragment) {
30211
+ return match2 === "*" ? singleAsteriskRegexFragment : match2 === "?" ? "[^/]" : "\\" + match2;
30117
30212
  }
30118
30213
  function getFileMatcherPatterns(path4, excludes, includes, useCaseSensitiveFileNames2, currentDirectory) {
30119
30214
  path4 = normalizePath(path4);
@@ -30428,8 +30523,8 @@ ${lanes.join("\n")}
30428
30523
  return false;
30429
30524
  }
30430
30525
  function numberOfDirectorySeparators(str) {
30431
- const match = str.match(/\//g);
30432
- return match ? match.length : 0;
30526
+ const match2 = str.match(/\//g);
30527
+ return match2 ? match2.length : 0;
30433
30528
  }
30434
30529
  function compareNumberOfDirectorySeparators(path1, path22) {
30435
30530
  return compareValues(
@@ -38643,13 +38738,13 @@ ${lanes.join("\n")}
38643
38738
  [expression]
38644
38739
  );
38645
38740
  }
38646
- function createReadHelper(iteratorRecord, count16) {
38741
+ function createReadHelper(iteratorRecord, count17) {
38647
38742
  context.requestEmitHelper(readHelper);
38648
38743
  return factory2.createCallExpression(
38649
38744
  getUnscopedHelperName("__read"),
38650
38745
  /*typeArguments*/
38651
38746
  void 0,
38652
- count16 !== void 0 ? [iteratorRecord, factory2.createNumericLiteral(count16 + "")] : [iteratorRecord]
38747
+ count17 !== void 0 ? [iteratorRecord, factory2.createNumericLiteral(count17 + "")] : [iteratorRecord]
38653
38748
  );
38654
38749
  }
38655
38750
  function createGeneratorHelper(body) {
@@ -50768,14 +50863,14 @@ ${lanes.join("\n")}
50768
50863
  }
50769
50864
  }
50770
50865
  }
50771
- function addPragmaForMatch(pragmas, range, kind, match) {
50772
- if (!match) return;
50773
- const name = match[1].toLowerCase();
50866
+ function addPragmaForMatch(pragmas, range, kind, match2) {
50867
+ if (!match2) return;
50868
+ const name = match2[1].toLowerCase();
50774
50869
  const pragma = commentPragmas[name];
50775
50870
  if (!pragma || !(pragma.kind & kind)) {
50776
50871
  return;
50777
50872
  }
50778
- const args = match[2];
50873
+ const args = match2[2];
50779
50874
  const argument = getNamedPragmaArguments(pragma, args);
50780
50875
  if (argument === "fail") return;
50781
50876
  pragmas.push({ name, args: { arguments: argument, range } });
@@ -54179,9 +54274,9 @@ ${lanes.join("\n")}
54179
54274
  if (excludeRegex && excludeRegex.test(spec)) {
54180
54275
  continue;
54181
54276
  }
54182
- const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
54183
- if (match) {
54184
- const { key, path: path4, flags } = match;
54277
+ const match2 = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
54278
+ if (match2) {
54279
+ const { key, path: path4, flags } = match2;
54185
54280
  const existingPath = wildCardKeyToPath.get(key);
54186
54281
  const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
54187
54282
  if (existingFlags === void 0 || existingFlags < flags) {
@@ -54210,14 +54305,14 @@ ${lanes.join("\n")}
54210
54305
  return useCaseSensitiveFileNames2 ? path4 : toFileNameLowerCase(path4);
54211
54306
  }
54212
54307
  function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
54213
- const match = wildcardDirectoryPattern.exec(spec);
54214
- if (match) {
54308
+ const match2 = wildcardDirectoryPattern.exec(spec);
54309
+ if (match2) {
54215
54310
  const questionWildcardIndex = spec.indexOf("?");
54216
54311
  const starWildcardIndex = spec.indexOf("*");
54217
54312
  const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
54218
54313
  return {
54219
- key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
54220
- path: match[0],
54314
+ key: toCanonicalKey(match2[0], useCaseSensitiveFileNames2),
54315
+ path: match2[0],
54221
54316
  flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 : 0
54222
54317
  /* None */
54223
54318
  };
@@ -60959,11 +61054,11 @@ ${lanes.join("\n")}
60959
61054
  return comparePaths(a, b2, ignoreCase) === 0;
60960
61055
  }
60961
61056
  function countPathComponents(path4) {
60962
- let count16 = 0;
61057
+ let count17 = 0;
60963
61058
  for (let i2 = startsWith(path4, "./") ? 2 : 0; i2 < path4.length; i2++) {
60964
- if (path4.charCodeAt(i2) === 47) count16++;
61059
+ if (path4.charCodeAt(i2) === 47) count17++;
60965
61060
  }
60966
- return count16;
61061
+ return count17;
60967
61062
  }
60968
61063
  function comparePathsByRedirectAndNumberOfDirectorySeparators(a, b2) {
60969
61064
  return compareBooleans(b2.isRedirect, a.isRedirect) || compareNumberOfDirectorySeparators(a.path, b2.path);
@@ -61798,7 +61893,7 @@ ${lanes.join("\n")}
61798
61893
  SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
61799
61894
  return SignatureCheckMode3;
61800
61895
  })(SignatureCheckMode || {});
61801
- var isNotOverloadAndNotAccessor = and20(isNotOverload, isNotAccessor);
61896
+ var isNotOverloadAndNotAccessor = and21(isNotOverload, isNotAccessor);
61802
61897
  var intrinsicTypeKinds = new Map(Object.entries({
61803
61898
  Uppercase: 0,
61804
61899
  Lowercase: 1,
@@ -67538,7 +67633,7 @@ ${lanes.join("\n")}
67538
67633
  deepCloneOrReuseNode
67539
67634
  )), node);
67540
67635
  }
67541
- function deepCloneOrReuseNodes(nodes, visitor, test, start, count16) {
67636
+ function deepCloneOrReuseNodes(nodes, visitor, test, start, count17) {
67542
67637
  if (nodes && nodes.length === 0) {
67543
67638
  return setTextRange(factory.createNodeArray(
67544
67639
  /*elements*/
@@ -67546,7 +67641,7 @@ ${lanes.join("\n")}
67546
67641
  nodes.hasTrailingComma
67547
67642
  ), nodes);
67548
67643
  }
67549
- return visitNodes2(nodes, visitor, test, start, count16);
67644
+ return visitNodes2(nodes, visitor, test, start, count17);
67550
67645
  }
67551
67646
  }
67552
67647
  function createTypeNodeFromObjectType(type2) {
@@ -71503,10 +71598,10 @@ ${lanes.join("\n")}
71503
71598
  if (t2.flags & 512 || !expandingEnum && t2.flags | 1056) {
71504
71599
  const baseType = t2.flags & 512 ? booleanType : getBaseTypeOfEnumLikeType(t2);
71505
71600
  if (baseType.flags & 1048576) {
71506
- const count16 = baseType.types.length;
71507
- if (i2 + count16 <= types.length && getRegularTypeOfLiteralType(types[i2 + count16 - 1]) === getRegularTypeOfLiteralType(baseType.types[count16 - 1])) {
71601
+ const count17 = baseType.types.length;
71602
+ if (i2 + count17 <= types.length && getRegularTypeOfLiteralType(types[i2 + count17 - 1]) === getRegularTypeOfLiteralType(baseType.types[count17 - 1])) {
71508
71603
  result.push(baseType);
71509
- i2 += count16 - 1;
71604
+ i2 += count17 - 1;
71510
71605
  continue;
71511
71606
  }
71512
71607
  }
@@ -74240,7 +74335,7 @@ ${lanes.join("\n")}
74240
74335
  }
74241
74336
  let result;
74242
74337
  for (let i2 = 0; i2 < signatureLists.length; i2++) {
74243
- const match = i2 === listIndex ? signature : findMatchingSignature(
74338
+ const match2 = i2 === listIndex ? signature : findMatchingSignature(
74244
74339
  signatureLists[i2],
74245
74340
  signature,
74246
74341
  /*partialMatch*/
@@ -74259,10 +74354,10 @@ ${lanes.join("\n")}
74259
74354
  /*ignoreReturnTypes*/
74260
74355
  true
74261
74356
  );
74262
- if (!match) {
74357
+ if (!match2) {
74263
74358
  return void 0;
74264
74359
  }
74265
- result = appendIfUnique(result, match);
74360
+ result = appendIfUnique(result, match2);
74266
74361
  }
74267
74362
  return result;
74268
74363
  }
@@ -76472,18 +76567,18 @@ ${lanes.join("\n")}
76472
76567
  let i2 = 0;
76473
76568
  while (i2 < length2) {
76474
76569
  const startId = types[i2].id;
76475
- let count16 = 1;
76476
- while (i2 + count16 < length2 && types[i2 + count16].id === startId + count16) {
76477
- count16++;
76570
+ let count17 = 1;
76571
+ while (i2 + count17 < length2 && types[i2 + count17].id === startId + count17) {
76572
+ count17++;
76478
76573
  }
76479
76574
  if (result.length) {
76480
76575
  result += ",";
76481
76576
  }
76482
76577
  result += startId;
76483
- if (count16 > 1) {
76484
- result += ":" + count16;
76578
+ if (count17 > 1) {
76579
+ result += ":" + count17;
76485
76580
  }
76486
- i2 += count16;
76581
+ i2 += count17;
76487
76582
  }
76488
76583
  }
76489
76584
  return result;
@@ -77756,14 +77851,14 @@ ${lanes.join("\n")}
77756
77851
  return types;
77757
77852
  }
77758
77853
  const id = getTypeListId(types);
77759
- const match = subtypeReductionCache.get(id);
77760
- if (match) {
77761
- return match;
77854
+ const match2 = subtypeReductionCache.get(id);
77855
+ if (match2) {
77856
+ return match2;
77762
77857
  }
77763
77858
  const hasEmptyObject = hasObjectTypes && some(types, (t2) => !!(t2.flags & 524288) && !isGenericMappedType(t2) && isEmptyResolvedType(resolveStructuredTypeMembers(t2)));
77764
77859
  const len = types.length;
77765
77860
  let i2 = len;
77766
- let count16 = 0;
77861
+ let count17 = 0;
77767
77862
  while (i2 > 0) {
77768
77863
  i2--;
77769
77864
  const source = types[i2];
@@ -77778,15 +77873,15 @@ ${lanes.join("\n")}
77778
77873
  const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
77779
77874
  for (const target of types) {
77780
77875
  if (source !== target) {
77781
- if (count16 === 1e5) {
77782
- const estimatedCount = count16 / (len - i2) * len;
77876
+ if (count17 === 1e5) {
77877
+ const estimatedCount = count17 / (len - i2) * len;
77783
77878
  if (estimatedCount > 1e6) {
77784
77879
  (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t2) => t2.id) });
77785
77880
  error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
77786
77881
  return void 0;
77787
77882
  }
77788
77883
  }
77789
- count16++;
77884
+ count17++;
77790
77885
  if (keyProperty && target.flags & (524288 | 2097152 | 58982400)) {
77791
77886
  const t2 = getTypeOfPropertyOfType(target, keyProperty.escapedName);
77792
77887
  if (t2 && isUnitType(t2) && getRegularTypeOfLiteralType(t2) !== keyPropertyType) {
@@ -78287,9 +78382,9 @@ ${lanes.join("\n")}
78287
78382
  return true;
78288
78383
  }
78289
78384
  function getCrossProductIntersections(types, flags) {
78290
- const count16 = getCrossProductUnionSize(types);
78385
+ const count17 = getCrossProductUnionSize(types);
78291
78386
  const intersections = [];
78292
- for (let i2 = 0; i2 < count16; i2++) {
78387
+ for (let i2 = 0; i2 < count17; i2++) {
78293
78388
  const constituents = types.slice();
78294
78389
  let n2 = i2;
78295
78390
  for (let j2 = types.length - 1; j2 >= 0; j2--) {
@@ -82050,11 +82145,11 @@ ${lanes.join("\n")}
82050
82145
  const primitive = source2.flags & 128 ? stringType : source2.flags & 256 ? numberType : source2.flags & 2048 ? bigintType : void 0;
82051
82146
  return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 : 0;
82052
82147
  }
82053
- const match = getMatchingUnionConstituentForType(target2, source2);
82054
- if (match) {
82148
+ const match2 = getMatchingUnionConstituentForType(target2, source2);
82149
+ if (match2) {
82055
82150
  const related = isRelatedTo(
82056
82151
  source2,
82057
- match,
82152
+ match2,
82058
82153
  2,
82059
82154
  /*reportErrors*/
82060
82155
  false,
@@ -84156,14 +84251,14 @@ ${lanes.join("\n")}
84156
84251
  return some(type.types, (t2) => isDeeplyNestedType(t2, stack, depth, maxDepth));
84157
84252
  }
84158
84253
  const identity2 = getRecursionIdentity(type);
84159
- let count16 = 0;
84254
+ let count17 = 0;
84160
84255
  let lastTypeId = 0;
84161
84256
  for (let i2 = 0; i2 < depth; i2++) {
84162
84257
  const t2 = stack[i2];
84163
84258
  if (hasMatchingRecursionIdentity(t2, identity2)) {
84164
84259
  if (t2.id >= lastTypeId) {
84165
- count16++;
84166
- if (count16 >= maxDepth) {
84260
+ count17++;
84261
+ if (count17 >= maxDepth) {
84167
84262
  return true;
84168
84263
  }
84169
84264
  }
@@ -85623,8 +85718,8 @@ ${lanes.join("\n")}
85623
85718
  ];
85624
85719
  }
85625
85720
  function inferFromTypeArguments(sourceTypes, targetTypes, variances) {
85626
- const count16 = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
85627
- for (let i2 = 0; i2 < count16; i2++) {
85721
+ const count17 = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
85722
+ for (let i2 = 0; i2 < count17; i2++) {
85628
85723
  if (i2 < variances.length && (variances[i2] & 7) === 2) {
85629
85724
  inferFromContravariantTypes(sourceTypes[i2], targetTypes[i2]);
85630
85725
  } else {
@@ -86368,7 +86463,7 @@ ${lanes.join("\n")}
86368
86463
  }
86369
86464
  function mapTypesByKeyProperty(types, name) {
86370
86465
  const map2 = /* @__PURE__ */ new Map();
86371
- let count16 = 0;
86466
+ let count17 = 0;
86372
86467
  for (const type of types) {
86373
86468
  if (type.flags & (524288 | 2097152 | 58982400)) {
86374
86469
  const discriminant = getTypeOfPropertyOfType(type, name);
@@ -86387,11 +86482,11 @@ ${lanes.join("\n")}
86387
86482
  duplicate = true;
86388
86483
  }
86389
86484
  });
86390
- if (!duplicate) count16++;
86485
+ if (!duplicate) count17++;
86391
86486
  }
86392
86487
  }
86393
86488
  }
86394
- return count16 >= 10 && count16 * 2 >= types.length ? map2 : void 0;
86489
+ return count17 >= 10 && count17 * 2 >= types.length ? map2 : void 0;
86395
86490
  }
86396
86491
  function getKeyPropertyName(unionType) {
86397
86492
  const types = unionType.types;
@@ -104618,7 +104713,7 @@ ${lanes.join("\n")}
104618
104713
  if (flags & (1920 | 384)) {
104619
104714
  return;
104620
104715
  }
104621
- const exportedDeclarationsCount = countWhere(declarations, and20(isNotOverloadAndNotAccessor, not2(isInterfaceDeclaration)));
104716
+ const exportedDeclarationsCount = countWhere(declarations, and21(isNotOverloadAndNotAccessor, not2(isInterfaceDeclaration)));
104622
104717
  if (flags & 524288 && exportedDeclarationsCount <= 2) {
104623
104718
  return;
104624
104719
  }
@@ -108766,9 +108861,9 @@ ${lanes.join("\n")}
108766
108861
  }
108767
108862
  function findMatchingDiscriminantType(source, target, isRelatedTo) {
108768
108863
  if (target.flags & 1048576 && source.flags & (2097152 | 524288)) {
108769
- const match = getMatchingUnionConstituentForType(target, source);
108770
- if (match) {
108771
- return match;
108864
+ const match2 = getMatchingUnionConstituentForType(target, source);
108865
+ if (match2) {
108866
+ return match2;
108772
108867
  }
108773
108868
  const sourceProperties = getPropertiesOfType(source);
108774
108869
  if (sourceProperties) {
@@ -109007,7 +109102,7 @@ ${lanes.join("\n")}
109007
109102
  Debug.assertNode(visitedNode, test);
109008
109103
  return visitedNode;
109009
109104
  }
109010
- function visitNodes2(nodes, visitor, test, start, count16) {
109105
+ function visitNodes2(nodes, visitor, test, start, count17) {
109011
109106
  if (nodes === void 0) {
109012
109107
  return nodes;
109013
109108
  }
@@ -109015,20 +109110,20 @@ ${lanes.join("\n")}
109015
109110
  if (start === void 0 || start < 0) {
109016
109111
  start = 0;
109017
109112
  }
109018
- if (count16 === void 0 || count16 > length2 - start) {
109019
- count16 = length2 - start;
109113
+ if (count17 === void 0 || count17 > length2 - start) {
109114
+ count17 = length2 - start;
109020
109115
  }
109021
109116
  let hasTrailingComma;
109022
109117
  let pos = -1;
109023
109118
  let end = -1;
109024
- if (start > 0 || count16 < length2) {
109025
- hasTrailingComma = nodes.hasTrailingComma && start + count16 === length2;
109119
+ if (start > 0 || count17 < length2) {
109120
+ hasTrailingComma = nodes.hasTrailingComma && start + count17 === length2;
109026
109121
  } else {
109027
109122
  pos = nodes.pos;
109028
109123
  end = nodes.end;
109029
109124
  hasTrailingComma = nodes.hasTrailingComma;
109030
109125
  }
109031
- const updated = visitArrayWorker(nodes, visitor, test, start, count16);
109126
+ const updated = visitArrayWorker(nodes, visitor, test, start, count17);
109032
109127
  if (updated !== nodes) {
109033
109128
  const updatedArray = factory.createNodeArray(updated, hasTrailingComma);
109034
109129
  setTextRangePosEnd(updatedArray, pos, end);
@@ -109036,7 +109131,7 @@ ${lanes.join("\n")}
109036
109131
  }
109037
109132
  return nodes;
109038
109133
  }
109039
- function visitArray(nodes, visitor, test, start, count16) {
109134
+ function visitArray(nodes, visitor, test, start, count17) {
109040
109135
  if (nodes === void 0) {
109041
109136
  return nodes;
109042
109137
  }
@@ -109044,18 +109139,18 @@ ${lanes.join("\n")}
109044
109139
  if (start === void 0 || start < 0) {
109045
109140
  start = 0;
109046
109141
  }
109047
- if (count16 === void 0 || count16 > length2 - start) {
109048
- count16 = length2 - start;
109142
+ if (count17 === void 0 || count17 > length2 - start) {
109143
+ count17 = length2 - start;
109049
109144
  }
109050
- return visitArrayWorker(nodes, visitor, test, start, count16);
109145
+ return visitArrayWorker(nodes, visitor, test, start, count17);
109051
109146
  }
109052
- function visitArrayWorker(nodes, visitor, test, start, count16) {
109147
+ function visitArrayWorker(nodes, visitor, test, start, count17) {
109053
109148
  let updated;
109054
109149
  const length2 = nodes.length;
109055
- if (start > 0 || count16 < length2) {
109150
+ if (start > 0 || count17 < length2) {
109056
109151
  updated = [];
109057
109152
  }
109058
- for (let i2 = 0; i2 < count16; i2++) {
109153
+ for (let i2 = 0; i2 < count17; i2++) {
109059
109154
  const node = nodes[i2 + start];
109060
109155
  const visited = node !== void 0 ? visitor ? visitor(node) : node : void 0;
109061
109156
  if (updated !== void 0 || visited === void 0 || visited !== node) {
@@ -123686,14 +123781,14 @@ ${lanes.join("\n")}
123686
123781
  return acc === void 0 ? decoded : acc + " " + decoded;
123687
123782
  }
123688
123783
  function decodeEntities(text4) {
123689
- return text4.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, (match, _all, _number, _digits, decimal, hex, word) => {
123784
+ return text4.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, (match2, _all, _number, _digits, decimal, hex, word) => {
123690
123785
  if (decimal) {
123691
123786
  return utf16EncodeAsString(parseInt(decimal, 10));
123692
123787
  } else if (hex) {
123693
123788
  return utf16EncodeAsString(parseInt(hex, 16));
123694
123789
  } else {
123695
123790
  const ch = entities.get(word);
123696
- return ch ? utf16EncodeAsString(ch) : match;
123791
+ return ch ? utf16EncodeAsString(ch) : match2;
123697
123792
  }
123698
123793
  });
123699
123794
  }
@@ -140431,7 +140526,7 @@ ${lanes.join("\n")}
140431
140526
  break;
140432
140527
  }
140433
140528
  }
140434
- function emitList(parentNode, children, format, parenthesizerRule, start, count16) {
140529
+ function emitList(parentNode, children, format, parenthesizerRule, start, count17) {
140435
140530
  emitNodeList(
140436
140531
  emit,
140437
140532
  parentNode,
@@ -140439,18 +140534,18 @@ ${lanes.join("\n")}
140439
140534
  format | (parentNode && getEmitFlags(parentNode) & 2 ? 65536 : 0),
140440
140535
  parenthesizerRule,
140441
140536
  start,
140442
- count16
140537
+ count17
140443
140538
  );
140444
140539
  }
140445
- function emitExpressionList(parentNode, children, format, parenthesizerRule, start, count16) {
140446
- emitNodeList(emitExpression, parentNode, children, format, parenthesizerRule, start, count16);
140540
+ function emitExpressionList(parentNode, children, format, parenthesizerRule, start, count17) {
140541
+ emitNodeList(emitExpression, parentNode, children, format, parenthesizerRule, start, count17);
140447
140542
  }
140448
- function emitNodeList(emit2, parentNode, children, format, parenthesizerRule, start = 0, count16 = children ? children.length - start : 0) {
140543
+ function emitNodeList(emit2, parentNode, children, format, parenthesizerRule, start = 0, count17 = children ? children.length - start : 0) {
140449
140544
  const isUndefined2 = children === void 0;
140450
140545
  if (isUndefined2 && format & 16384) {
140451
140546
  return;
140452
140547
  }
140453
- const isEmpty = children === void 0 || start >= children.length || count16 === 0;
140548
+ const isEmpty = children === void 0 || start >= children.length || count17 === 0;
140454
140549
  if (isEmpty && format & 32768) {
140455
140550
  onBeforeEmitNodeArray == null ? void 0 : onBeforeEmitNodeArray(children);
140456
140551
  onAfterEmitNodeArray == null ? void 0 : onAfterEmitNodeArray(children);
@@ -140474,7 +140569,7 @@ ${lanes.join("\n")}
140474
140569
  writeSpace();
140475
140570
  }
140476
140571
  } else {
140477
- emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count16, children.hasTrailingComma, children);
140572
+ emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count17, children.hasTrailingComma, children);
140478
140573
  }
140479
140574
  onAfterEmitNodeArray == null ? void 0 : onAfterEmitNodeArray(children);
140480
140575
  if (format & 15360) {
@@ -140484,7 +140579,7 @@ ${lanes.join("\n")}
140484
140579
  writePunctuation(getClosingBracket(format));
140485
140580
  }
140486
140581
  }
140487
- function emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count16, hasTrailingComma, childrenTextRange) {
140582
+ function emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count17, hasTrailingComma, childrenTextRange) {
140488
140583
  const mayEmitInterveningComments = (format & 262144) === 0;
140489
140584
  let shouldEmitInterveningComments = mayEmitInterveningComments;
140490
140585
  const leadingLineTerminatorCount = getLeadingLineTerminatorCount(parentNode, children[start], format);
@@ -140500,7 +140595,7 @@ ${lanes.join("\n")}
140500
140595
  const emitListItem = getEmitListItem(emit2, parenthesizerRule);
140501
140596
  let previousSibling;
140502
140597
  let shouldDecreaseIndentAfterEmit = false;
140503
- for (let i2 = 0; i2 < count16; i2++) {
140598
+ for (let i2 = 0; i2 < count17; i2++) {
140504
140599
  const child = children[start + i2];
140505
140600
  if (format & 32) {
140506
140601
  writeLine();
@@ -140565,7 +140660,7 @@ ${lanes.join("\n")}
140565
140660
  if (format & 128) {
140566
140661
  decreaseIndent();
140567
140662
  }
140568
- const closingLineTerminatorCount = getClosingLineTerminatorCount(parentNode, children[start + count16 - 1], format, childrenTextRange);
140663
+ const closingLineTerminatorCount = getClosingLineTerminatorCount(parentNode, children[start + count17 - 1], format, childrenTextRange);
140569
140664
  if (closingLineTerminatorCount) {
140570
140665
  writeLine(closingLineTerminatorCount);
140571
140666
  } else if (format & (2097152 | 256)) {
@@ -140615,8 +140710,8 @@ ${lanes.join("\n")}
140615
140710
  writer.write(s2);
140616
140711
  }
140617
140712
  }
140618
- function writeLine(count16 = 1) {
140619
- for (let i2 = 0; i2 < count16; i2++) {
140713
+ function writeLine(count17 = 1) {
140714
+ for (let i2 = 0; i2 < count17; i2++) {
140620
140715
  writer.writeLine(i2 > 0);
140621
140716
  }
140622
140717
  }
@@ -141145,10 +141240,10 @@ ${lanes.join("\n")}
141145
141240
  }
141146
141241
  }
141147
141242
  while (true) {
141148
- const count16 = tempFlags2 & 268435455;
141243
+ const count17 = tempFlags2 & 268435455;
141149
141244
  tempFlags2++;
141150
- if (count16 !== 8 && count16 !== 13) {
141151
- const name = count16 < 26 ? "_" + String.fromCharCode(97 + count16) : "_" + (count16 - 26);
141245
+ if (count17 !== 8 && count17 !== 13) {
141246
+ const name = count17 < 26 ? "_" + String.fromCharCode(97 + count17) : "_" + (count17 - 26);
141152
141247
  const fullName = formatGeneratedName(privateName, prefix, name, suffix);
141153
141248
  if (isUniqueName(fullName, privateName)) {
141154
141249
  if (privateName) {
@@ -153231,12 +153326,12 @@ ${lanes.join("\n")}
153231
153326
  for (const line of output) {
153232
153327
  sys2.write(line);
153233
153328
  }
153234
- function example(ex, desc15) {
153329
+ function example(ex, desc16) {
153235
153330
  const examples = typeof ex === "string" ? [ex] : ex;
153236
153331
  for (const example2 of examples) {
153237
153332
  output.push(" " + colors.blue(example2) + sys2.newLine);
153238
153333
  }
153239
- output.push(" " + getDiagnosticText(desc15) + sys2.newLine + sys2.newLine);
153334
+ output.push(" " + getDiagnosticText(desc16) + sys2.newLine + sys2.newLine);
153240
153335
  }
153241
153336
  }
153242
153337
  function printAllHelp(sys2, compilerOptions, buildOptions, watchOptions) {
@@ -153888,7 +153983,7 @@ ${lanes.join("\n")}
153888
153983
  reportCountStatistic("Lines of " + key, value);
153889
153984
  }
153890
153985
  } else {
153891
- reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum, count16) => sum + count16, 0));
153986
+ reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum, count17) => sum + count17, 0));
153892
153987
  }
153893
153988
  reportCountStatistic("Identifiers", program2.getIdentifierCount());
153894
153989
  reportCountStatistic("Symbols", program2.getSymbolCount());
@@ -153993,11 +154088,11 @@ ${lanes.join("\n")}
153993
154088
  statistics.push(s2);
153994
154089
  if (aggregate) solutionPerformance == null ? void 0 : solutionPerformance.addAggregateStatistic(s2);
153995
154090
  }
153996
- function reportCountStatistic(name, count16) {
154091
+ function reportCountStatistic(name, count17) {
153997
154092
  reportStatisticalValue(
153998
154093
  {
153999
154094
  name,
154000
- value: count16,
154095
+ value: count17,
154001
154096
  type: 1
154002
154097
  /* count */
154003
154098
  },
@@ -154498,8 +154593,8 @@ ${lanes.join("\n")}
154498
154593
  nonlocalNode ? visitNodesWithoutCopyingPositions : void 0
154499
154594
  );
154500
154595
  }
154501
- function visitNodesWithoutCopyingPositions(nodes, visitor, test, start, count16) {
154502
- let result = visitNodes2(nodes, visitor, test, start, count16);
154596
+ function visitNodesWithoutCopyingPositions(nodes, visitor, test, start, count17) {
154597
+ let result = visitNodes2(nodes, visitor, test, start, count17);
154503
154598
  if (result) {
154504
154599
  if (result.pos !== -1 || result.end !== -1) {
154505
154600
  if (result === nodes) {
@@ -157393,9 +157488,9 @@ ${lanes.join("\n")}
157393
157488
  function getSnapshotText(snap) {
157394
157489
  return snap.getText(0, snap.getLength());
157395
157490
  }
157396
- function repeatString(str, count16) {
157491
+ function repeatString(str, count17) {
157397
157492
  let result = "";
157398
- for (let i2 = 0; i2 < count16; i2++) {
157493
+ for (let i2 = 0; i2 < count17; i2++) {
157399
157494
  result += str;
157400
157495
  }
157401
157496
  return result;
@@ -160026,31 +160121,31 @@ ${lanes.join("\n")}
160026
160121
  const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/m;
160027
160122
  const attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/g;
160028
160123
  const text4 = sourceFile.text.substr(start, width);
160029
- const match = tripleSlashXMLCommentRegEx.exec(text4);
160030
- if (!match) {
160124
+ const match2 = tripleSlashXMLCommentRegEx.exec(text4);
160125
+ if (!match2) {
160031
160126
  return false;
160032
160127
  }
160033
- if (!match[3] || !(match[3] in commentPragmas)) {
160128
+ if (!match2[3] || !(match2[3] in commentPragmas)) {
160034
160129
  return false;
160035
160130
  }
160036
160131
  let pos = start;
160037
- pushCommentRange(pos, match[1].length);
160038
- pos += match[1].length;
160132
+ pushCommentRange(pos, match2[1].length);
160133
+ pos += match2[1].length;
160039
160134
  pushClassification(
160040
160135
  pos,
160041
- match[2].length,
160136
+ match2[2].length,
160042
160137
  10
160043
160138
  /* punctuation */
160044
160139
  );
160045
- pos += match[2].length;
160140
+ pos += match2[2].length;
160046
160141
  pushClassification(
160047
160142
  pos,
160048
- match[3].length,
160143
+ match2[3].length,
160049
160144
  21
160050
160145
  /* jsxSelfClosingTagName */
160051
160146
  );
160052
- pos += match[3].length;
160053
- const attrText = match[4];
160147
+ pos += match2[3].length;
160148
+ const attrText = match2[4];
160054
160149
  let attrPos = pos;
160055
160150
  while (true) {
160056
160151
  const attrMatch = attributeRegex.exec(attrText);
@@ -160092,18 +160187,18 @@ ${lanes.join("\n")}
160092
160187
  );
160093
160188
  attrPos += attrMatch[6].length;
160094
160189
  }
160095
- pos += match[4].length;
160190
+ pos += match2[4].length;
160096
160191
  if (pos > attrPos) {
160097
160192
  pushCommentRange(attrPos, pos - attrPos);
160098
160193
  }
160099
- if (match[5]) {
160194
+ if (match2[5]) {
160100
160195
  pushClassification(
160101
160196
  pos,
160102
- match[5].length,
160197
+ match2[5].length,
160103
160198
  10
160104
160199
  /* punctuation */
160105
160200
  );
160106
- pos += match[5].length;
160201
+ pos += match2[5].length;
160107
160202
  }
160108
160203
  const end = start + width;
160109
160204
  if (pos < end) {
@@ -161288,8 +161383,8 @@ ${lanes.join("\n")}
161288
161383
  (ch) => ch !== 32 && ch !== 42
161289
161384
  /* asterisk */
161290
161385
  )) {
161291
- const match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans);
161292
- if (match) return match;
161386
+ const match2 = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans);
161387
+ if (match2) return match2;
161293
161388
  }
161294
161389
  const subWordTextChunks = segment.subWordTextChunks;
161295
161390
  let bestMatch;
@@ -161949,10 +162044,10 @@ ${lanes.join("\n")}
161949
162044
  function getDocumentPositionMapper(host, generatedFileName, generatedFileLineInfo, readMapFile) {
161950
162045
  let mapFileName = tryGetSourceMappingURL(generatedFileLineInfo);
161951
162046
  if (mapFileName) {
161952
- const match = base64UrlRegExp.exec(mapFileName);
161953
- if (match) {
161954
- if (match[1]) {
161955
- const base64Object = match[1];
162047
+ const match2 = base64UrlRegExp.exec(mapFileName);
162048
+ if (match2) {
162049
+ if (match2[1]) {
162050
+ const base64Object = match2[1];
161956
162051
  return convertDocumentToSourceMapper(host, base64decode(sys, base64Object), generatedFileName);
161957
162052
  }
161958
162053
  mapFileName = void 0;
@@ -162419,8 +162514,8 @@ interface Symbol {
162419
162514
  return file !== singleCurrentFile && excludeLibFiles && (isInsideNodeModules(file.path) || file.hasNoDefaultLib);
162420
162515
  }
162421
162516
  function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, fileName, excludeLibFiles, singleCurrentFile, rawItems) {
162422
- const match = patternMatcher.getMatchForLastSegmentOfPattern(name);
162423
- if (!match) {
162517
+ const match2 = patternMatcher.getMatchForLastSegmentOfPattern(name);
162518
+ if (!match2) {
162424
162519
  return;
162425
162520
  }
162426
162521
  for (const declaration of declarations) {
@@ -162431,7 +162526,7 @@ interface Symbol {
162431
162526
  rawItems.push({ name, fileName, matchKind: fullMatch.kind, isCaseSensitive: fullMatch.isCaseSensitive, declaration });
162432
162527
  }
162433
162528
  } else {
162434
- rawItems.push({ name, fileName, matchKind: match.kind, isCaseSensitive: match.isCaseSensitive, declaration });
162529
+ rawItems.push({ name, fileName, matchKind: match2.kind, isCaseSensitive: match2.isCaseSensitive, declaration });
162435
162530
  }
162436
162531
  }
162437
162532
  }
@@ -166705,12 +166800,12 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
166705
166800
  function getOccurrencesInExpression(matchTo, expression) {
166706
166801
  const occurrences = [];
166707
166802
  while (isBinaryExpression(expression) && expression.operatorToken.kind === 56) {
166708
- const match = getMatchingStart(skipParentheses(matchTo), skipParentheses(expression.right));
166709
- if (!match) {
166803
+ const match2 = getMatchingStart(skipParentheses(matchTo), skipParentheses(expression.right));
166804
+ if (!match2) {
166710
166805
  break;
166711
166806
  }
166712
- occurrences.push(match);
166713
- matchTo = match;
166807
+ occurrences.push(match2);
166808
+ matchTo = match2;
166714
166809
  expression = expression.left;
166715
166810
  }
166716
166811
  const finalMatch = getMatchingStart(matchTo, expression);
@@ -170685,8 +170780,8 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
170685
170780
  const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
170686
170781
  const token = getTouchingToken(sourceFile, position);
170687
170782
  const matchKind = token.getStart(sourceFile) === position ? braceMatching.get(token.kind.toString()) : void 0;
170688
- const match = matchKind && findChildOfKind(token.parent, matchKind, sourceFile);
170689
- return match ? [createTextSpanFromNode(token, sourceFile), createTextSpanFromNode(match, sourceFile)].sort((a, b2) => a.start - b2.start) : emptyArray;
170783
+ const match2 = matchKind && findChildOfKind(token.parent, matchKind, sourceFile);
170784
+ return match2 ? [createTextSpanFromNode(token, sourceFile), createTextSpanFromNode(match2, sourceFile)].sort((a, b2) => a.start - b2.start) : emptyArray;
170690
170785
  }
170691
170786
  function getIndentationAtPosition(fileName, position, editorOptions) {
170692
170787
  let start = timestamp();
@@ -171441,14 +171536,14 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
171441
171536
  }
171442
171537
  return spanInNode(otherwiseOnNode);
171443
171538
  }
171444
- function spanInNodeArray(nodeArray, node, match) {
171539
+ function spanInNodeArray(nodeArray, node, match2) {
171445
171540
  if (nodeArray) {
171446
171541
  const index2 = nodeArray.indexOf(node);
171447
171542
  if (index2 >= 0) {
171448
171543
  let start = index2;
171449
171544
  let end = index2 + 1;
171450
- while (start > 0 && match(nodeArray[start - 1])) start--;
171451
- while (end < nodeArray.length && match(nodeArray[end])) end++;
171545
+ while (start > 0 && match2(nodeArray[start - 1])) start--;
171546
+ while (end < nodeArray.length && match2(nodeArray[end])) end++;
171452
171547
  return createTextSpanFromBounds(skipTrivia(sourceFile.text, nodeArray[start].pos), nodeArray[end - 1].end);
171453
171548
  }
171454
171549
  }
@@ -175527,7 +175622,7 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
175527
175622
  const maybeHeritageClauseSymbol = getHeritageClauseSymbolTable(classDeclaration, checker);
175528
175623
  const implementedType = checker.getTypeAtLocation(implementedTypeNode);
175529
175624
  const implementedTypeSymbols = checker.getPropertiesOfType(implementedType);
175530
- const nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(and20(symbolPointsToNonPrivateMember, (symbol) => !maybeHeritageClauseSymbol.has(symbol.escapedName)));
175625
+ const nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(and21(symbolPointsToNonPrivateMember, (symbol) => !maybeHeritageClauseSymbol.has(symbol.escapedName)));
175531
175626
  const classType = checker.getTypeAtLocation(classDeclaration);
175532
175627
  const constructor = find(classDeclaration.members, (m2) => isConstructorDeclaration(m2));
175533
175628
  if (!classType.getNumberIndexType()) {
@@ -188683,12 +188778,12 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
188683
188778
  function stringLiteralCompletionDetails(name, location, completion, sourceFile, checker, cancellationToken) {
188684
188779
  switch (completion.kind) {
188685
188780
  case 0: {
188686
- const match = find(completion.paths, (p10) => p10.name === name);
188687
- return match && createCompletionDetails(name, kindModifiersFromExtension(match.extension), match.kind, [textPart(name)]);
188781
+ const match2 = find(completion.paths, (p10) => p10.name === name);
188782
+ return match2 && createCompletionDetails(name, kindModifiersFromExtension(match2.extension), match2.kind, [textPart(name)]);
188688
188783
  }
188689
188784
  case 1: {
188690
- const match = find(completion.symbols, (s2) => s2.name === name);
188691
- return match && createCompletionDetailsForSymbol(match, match.name, checker, sourceFile, location, cancellationToken);
188785
+ const match2 = find(completion.symbols, (s2) => s2.name === name);
188786
+ return match2 && createCompletionDetailsForSymbol(match2, match2.name, checker, sourceFile, location, cancellationToken);
188692
188787
  }
188693
188788
  case 2:
188694
188789
  return find(completion.types, (t2) => t2.value === name) ? createCompletionDetails(name, "", "string", [textPart(name)]) : void 0;
@@ -189462,8 +189557,8 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
189462
189557
  /*exclude*/
189463
189558
  void 0,
189464
189559
  includeGlobs
189465
- ), (match) => {
189466
- const trimmedWithPattern = trimPrefixAndSuffix(match, completePrefix);
189560
+ ), (match2) => {
189561
+ const trimmedWithPattern = trimPrefixAndSuffix(match2, completePrefix);
189467
189562
  if (trimmedWithPattern) {
189468
189563
  if (containsSlash(trimmedWithPattern)) {
189469
189564
  return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
@@ -189507,11 +189602,11 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
189507
189602
  return void 0;
189508
189603
  }
189509
189604
  const text4 = sourceFile.text.slice(range.pos, position);
189510
- const match = tripleSlashDirectiveFragmentRegex.exec(text4);
189511
- if (!match) {
189605
+ const match2 = tripleSlashDirectiveFragmentRegex.exec(text4);
189606
+ if (!match2) {
189512
189607
  return void 0;
189513
189608
  }
189514
- const [, prefix, kind, toComplete] = match;
189609
+ const [, prefix, kind, toComplete] = match2;
189515
189610
  const scriptPath = getDirectoryPath(sourceFile.path);
189516
189611
  const names = kind === "path" ? getCompletionEntriesForDirectoryFragment(
189517
189612
  toComplete,
@@ -190202,8 +190297,8 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
190202
190297
  function isAmbientModuleDeclaration(node) {
190203
190298
  return node.kind === 268 && node.name.kind === 11;
190204
190299
  }
190205
- function isExternalModuleImportEquals(eq20) {
190206
- return eq20.moduleReference.kind === 284 && eq20.moduleReference.expression.kind === 11;
190300
+ function isExternalModuleImportEquals(eq21) {
190301
+ return eq21.moduleReference.kind === 284 && eq21.moduleReference.expression.kind === 11;
190207
190302
  }
190208
190303
  var DefinitionKind = /* @__PURE__ */ ((DefinitionKind2) => {
190209
190304
  DefinitionKind2[DefinitionKind2["Symbol"] = 0] = "Symbol";
@@ -195852,13 +195947,13 @@ ${content}
195852
195947
  if (candidates[i2] === resolvedSignature) {
195853
195948
  selectedItemIndex = itemsSeen;
195854
195949
  if (item.length > 1) {
195855
- let count16 = 0;
195950
+ let count17 = 0;
195856
195951
  for (const i22 of item) {
195857
195952
  if (i22.isVariadic || i22.parameters.length >= argumentCount) {
195858
- selectedItemIndex = itemsSeen + count16;
195953
+ selectedItemIndex = itemsSeen + count17;
195859
195954
  break;
195860
195955
  }
195861
- count16++;
195956
+ count17++;
195862
195957
  }
195863
195958
  }
195864
195959
  }
@@ -198159,8 +198254,8 @@ ${options.prefix}` : "\n" : options.prefix
198159
198254
  setTextRangePosEnd(newNode, getPos2(node), getEnd(node));
198160
198255
  return newNode;
198161
198256
  }
198162
- function assignPositionsToNodeArray(nodes, visitor, test, start, count16) {
198163
- const visited = visitNodes2(nodes, visitor, test, start, count16);
198257
+ function assignPositionsToNodeArray(nodes, visitor, test, start, count17) {
198258
+ const visited = visitNodes2(nodes, visitor, test, start, count17);
198164
198259
  if (!visited) {
198165
198260
  return visited;
198166
198261
  }
@@ -202837,7 +202932,7 @@ ${options.prefix}` : "\n" : options.prefix
202837
202932
  affectsEmitOptionDeclarations: () => affectsEmitOptionDeclarations,
202838
202933
  allKeysStartWithDot: () => allKeysStartWithDot,
202839
202934
  altDirectorySeparator: () => altDirectorySeparator,
202840
- and: () => and20,
202935
+ and: () => and21,
202841
202936
  append: () => append,
202842
202937
  appendIfUnique: () => appendIfUnique,
202843
202938
  arrayFrom: () => arrayFrom,
@@ -215094,8 +215189,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
215094
215189
  }
215095
215190
  const noDtsProgram = ls.getProgram();
215096
215191
  const fileToSearch = Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
215097
- for (const match of searchForDeclaration(candidate.name, fileToSearch, noDtsProgram)) {
215098
- definitionSet.add(match);
215192
+ for (const match2 of searchForDeclaration(candidate.name, fileToSearch, noDtsProgram)) {
215193
+ definitionSet.add(match2);
215099
215194
  }
215100
215195
  }
215101
215196
  }
@@ -215182,9 +215277,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
215182
215277
  }
215183
215278
  function searchForDeclaration(declarationName, fileToSearch, noDtsProgram) {
215184
215279
  const matches = ts_FindAllReferences_exports.Core.getTopMostDeclarationNamesInFile(declarationName, fileToSearch);
215185
- return mapDefined(matches, (match) => {
215186
- const symbol = noDtsProgram.getTypeChecker().getSymbolAtLocation(match);
215187
- const decl = getDeclarationFromName(match);
215280
+ return mapDefined(matches, (match2) => {
215281
+ const symbol = noDtsProgram.getTypeChecker().getSymbolAtLocation(match2);
215282
+ const decl = getDeclarationFromName(match2);
215188
215283
  if (symbol && decl) {
215189
215284
  return ts_GoToDefinition_exports.createDefinitionInfo(
215190
215285
  decl,
@@ -217908,24 +218003,36 @@ var init_functionTools = __esm({
217908
218003
  "../packages/agents-core/src/data-access/functionTools.ts"() {
217909
218004
  "use strict";
217910
218005
  init_esm_shims();
218006
+ init_conversations();
217911
218007
  init_schema();
217912
218008
  init_logger();
217913
218009
  logger4 = getLogger("functionTools");
217914
218010
  }
217915
218011
  });
217916
218012
 
218013
+ // ../packages/agents-core/src/data-access/subAgentExternalAgentRelations.ts
218014
+ import { and as and5, count as count4, desc as desc4, eq as eq5 } from "drizzle-orm";
218015
+ var init_subAgentExternalAgentRelations = __esm({
218016
+ "../packages/agents-core/src/data-access/subAgentExternalAgentRelations.ts"() {
218017
+ "use strict";
218018
+ init_esm_shims();
218019
+ init_schema();
218020
+ }
218021
+ });
218022
+
217917
218023
  // ../packages/agents-core/src/data-access/subAgentRelations.ts
217918
- import { and as and5, count as count4, desc as desc4, eq as eq5, isNotNull } from "drizzle-orm";
218024
+ import { and as and6, count as count5, desc as desc5, eq as eq6, isNotNull } from "drizzle-orm";
217919
218025
  var init_subAgentRelations = __esm({
217920
218026
  "../packages/agents-core/src/data-access/subAgentRelations.ts"() {
217921
218027
  "use strict";
217922
218028
  init_esm_shims();
217923
218029
  init_schema();
218030
+ init_conversations();
217924
218031
  }
217925
218032
  });
217926
218033
 
217927
218034
  // ../packages/agents-core/src/data-access/subAgents.ts
217928
- import { and as and6, count as count5, desc as desc5, eq as eq6, inArray } from "drizzle-orm";
218035
+ import { and as and7, count as count6, desc as desc6, eq as eq7, inArray } from "drizzle-orm";
217929
218036
  var init_subAgents = __esm({
217930
218037
  "../packages/agents-core/src/data-access/subAgents.ts"() {
217931
218038
  "use strict";
@@ -217953,6 +218060,7 @@ var init_apiKeys = __esm({
217953
218060
  init_esm_shims();
217954
218061
  init_nanoid();
217955
218062
  init_logger();
218063
+ init_conversations();
217956
218064
  scryptAsync = promisify(scrypt);
217957
218065
  logger5 = getLogger("api-key");
217958
218066
  PUBLIC_ID_LENGTH = 12;
@@ -217973,11 +218081,11 @@ var init_index_node = __esm({
217973
218081
  }
217974
218082
  });
217975
218083
 
217976
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
218084
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
217977
218085
  import { z as z5 } from "zod";
217978
218086
  var JSONRPC_VERSION, ProgressTokenSchema, CursorSchema, RequestMetaSchema, BaseRequestParamsSchema, RequestSchema, BaseNotificationParamsSchema, NotificationSchema, ResultSchema, RequestIdSchema, JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResponseSchema, ErrorCode, JSONRPCErrorSchema, JSONRPCMessageSchema, EmptyResultSchema, CancelledNotificationSchema, IconSchema, IconsSchema, 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;
217979
218087
  var init_types2 = __esm({
217980
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js"() {
218088
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js"() {
217981
218089
  "use strict";
217982
218090
  init_esm_shims();
217983
218091
  JSONRPC_VERSION = "2.0";
@@ -218913,11 +219021,11 @@ var init_types2 = __esm({
218913
219021
  }
218914
219022
  });
218915
219023
 
218916
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
219024
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
218917
219025
  import { z as z6 } from "zod";
218918
- var SafeUrlSchema, OAuthProtectedResourceMetadataSchema, OAuthMetadataSchema, OpenIdProviderMetadataSchema, OpenIdProviderDiscoveryMetadataSchema, OAuthTokensSchema, OAuthErrorResponseSchema, OAuthClientMetadataSchema, OAuthClientInformationSchema, OAuthClientInformationFullSchema, OAuthClientRegistrationErrorSchema, OAuthTokenRevocationRequestSchema;
219026
+ var SafeUrlSchema, OAuthProtectedResourceMetadataSchema, OAuthMetadataSchema, OpenIdProviderMetadataSchema, OpenIdProviderDiscoveryMetadataSchema, OAuthTokensSchema, OAuthErrorResponseSchema, OptionalSafeUrlSchema, OAuthClientMetadataSchema, OAuthClientInformationSchema, OAuthClientInformationFullSchema, OAuthClientRegistrationErrorSchema, OAuthTokenRevocationRequestSchema;
218919
219027
  var init_auth = __esm({
218920
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js"() {
219028
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js"() {
218921
219029
  "use strict";
218922
219030
  init_esm_shims();
218923
219031
  SafeUrlSchema = z6.string().url().superRefine((val, ctx) => {
@@ -219023,6 +219131,7 @@ var init_auth = __esm({
219023
219131
  error_description: z6.string().optional(),
219024
219132
  error_uri: z6.string().optional()
219025
219133
  });
219134
+ OptionalSafeUrlSchema = SafeUrlSchema.optional().or(z6.literal("").transform(() => void 0));
219026
219135
  OAuthClientMetadataSchema = z6.object({
219027
219136
  redirect_uris: z6.array(SafeUrlSchema),
219028
219137
  token_endpoint_auth_method: z6.string().optional(),
@@ -219030,10 +219139,10 @@ var init_auth = __esm({
219030
219139
  response_types: z6.array(z6.string()).optional(),
219031
219140
  client_name: z6.string().optional(),
219032
219141
  client_uri: SafeUrlSchema.optional(),
219033
- logo_uri: SafeUrlSchema.optional(),
219142
+ logo_uri: OptionalSafeUrlSchema,
219034
219143
  scope: z6.string().optional(),
219035
219144
  contacts: z6.array(z6.string()).optional(),
219036
- tos_uri: SafeUrlSchema.optional(),
219145
+ tos_uri: OptionalSafeUrlSchema,
219037
219146
  policy_uri: z6.string().optional(),
219038
219147
  jwks_uri: SafeUrlSchema.optional(),
219039
219148
  jwks: z6.any().optional(),
@@ -219059,18 +219168,18 @@ var init_auth = __esm({
219059
219168
  }
219060
219169
  });
219061
219170
 
219062
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
219171
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
219063
219172
  var init_auth_utils = __esm({
219064
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js"() {
219173
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js"() {
219065
219174
  "use strict";
219066
219175
  init_esm_shims();
219067
219176
  }
219068
219177
  });
219069
219178
 
219070
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
219179
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
219071
219180
  var OAuthError, InvalidRequestError, InvalidClientError, InvalidGrantError, UnauthorizedClientError, UnsupportedGrantTypeError, InvalidScopeError, AccessDeniedError, ServerError, TemporarilyUnavailableError, UnsupportedResponseTypeError, UnsupportedTokenTypeError, InvalidTokenError, MethodNotAllowedError, TooManyRequestsError, InvalidClientMetadataError, InsufficientScopeError, OAUTH_ERRORS;
219072
219181
  var init_errors = __esm({
219073
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js"() {
219182
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js"() {
219074
219183
  "use strict";
219075
219184
  init_esm_shims();
219076
219185
  OAuthError = class extends Error {
@@ -219165,9 +219274,9 @@ var init_errors = __esm({
219165
219274
  }
219166
219275
  });
219167
219276
 
219168
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
219277
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
219169
219278
  var init_auth2 = __esm({
219170
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js"() {
219279
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js"() {
219171
219280
  "use strict";
219172
219281
  init_esm_shims();
219173
219282
  init_index_node();
@@ -219361,9 +219470,9 @@ var init_execution = __esm({
219361
219470
  }
219362
219471
  });
219363
219472
 
219364
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
219473
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
219365
219474
  var init_protocol = __esm({
219366
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js"() {
219475
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js"() {
219367
219476
  "use strict";
219368
219477
  init_esm_shims();
219369
219478
  init_types2();
@@ -220875,26 +220984,26 @@ var require_resolve = __commonJS({
220875
220984
  return true;
220876
220985
  }
220877
220986
  function countKeys(schema) {
220878
- var count16 = 0, item;
220987
+ var count17 = 0, item;
220879
220988
  if (Array.isArray(schema)) {
220880
220989
  for (var i2 = 0; i2 < schema.length; i2++) {
220881
220990
  item = schema[i2];
220882
- if (typeof item == "object") count16 += countKeys(item);
220883
- if (count16 == Infinity) return Infinity;
220991
+ if (typeof item == "object") count17 += countKeys(item);
220992
+ if (count17 == Infinity) return Infinity;
220884
220993
  }
220885
220994
  } else {
220886
220995
  for (var key in schema) {
220887
220996
  if (key == "$ref") return Infinity;
220888
220997
  if (SIMPLE_INLINED[key]) {
220889
- count16++;
220998
+ count17++;
220890
220999
  } else {
220891
221000
  item = schema[key];
220892
- if (typeof item == "object") count16 += countKeys(item) + 1;
220893
- if (count16 == Infinity) return Infinity;
221001
+ if (typeof item == "object") count17 += countKeys(item) + 1;
221002
+ if (count17 == Infinity) return Infinity;
220894
221003
  }
220895
221004
  }
220896
221005
  }
220897
- return count16;
221006
+ return count17;
220898
221007
  }
220899
221008
  function getFullPath(id, normalize) {
220900
221009
  if (normalize !== false) id = normalizeId(id);
@@ -225631,10 +225740,10 @@ var require_ajv = __commonJS({
225631
225740
  }
225632
225741
  });
225633
225742
 
225634
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
225743
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
225635
225744
  var import_ajv;
225636
225745
  var init_client2 = __esm({
225637
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js"() {
225746
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js"() {
225638
225747
  "use strict";
225639
225748
  init_esm_shims();
225640
225749
  init_protocol();
@@ -225643,9 +225752,9 @@ var init_client2 = __esm({
225643
225752
  }
225644
225753
  });
225645
225754
 
225646
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
225755
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
225647
225756
  var init_sse = __esm({
225648
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js"() {
225757
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js"() {
225649
225758
  "use strict";
225650
225759
  init_esm_shims();
225651
225760
  init_types2();
@@ -225653,9 +225762,9 @@ var init_sse = __esm({
225653
225762
  }
225654
225763
  });
225655
225764
 
225656
- // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
225765
+ // ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
225657
225766
  var init_streamableHttp = __esm({
225658
- "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js"() {
225767
+ "../node_modules/.pnpm/@modelcontextprotocol+sdk@1.20.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js"() {
225659
225768
  "use strict";
225660
225769
  init_esm_shims();
225661
225770
  init_types2();
@@ -226824,7 +226933,7 @@ var init_utils = __esm({
226824
226933
  });
226825
226934
 
226826
226935
  // ../packages/agents-core/src/data-access/credentialReferences.ts
226827
- import { and as and7, count as count6, desc as desc6, eq as eq7, sql as sql3 } from "drizzle-orm";
226936
+ import { and as and8, count as count7, desc as desc7, eq as eq8, sql as sql3 } from "drizzle-orm";
226828
226937
  var init_credentialReferences = __esm({
226829
226938
  "../packages/agents-core/src/data-access/credentialReferences.ts"() {
226830
226939
  "use strict";
@@ -226834,13 +226943,14 @@ var init_credentialReferences = __esm({
226834
226943
  });
226835
226944
 
226836
226945
  // ../packages/agents-core/src/data-access/tools.ts
226837
- import { and as and8, count as count7, desc as desc7, eq as eq8 } from "drizzle-orm";
226946
+ import { and as and9, count as count8, desc as desc8, eq as eq9 } from "drizzle-orm";
226838
226947
  var logger7;
226839
226948
  var init_tools = __esm({
226840
226949
  "../packages/agents-core/src/data-access/tools.ts"() {
226841
226950
  "use strict";
226842
226951
  init_esm_shims();
226843
226952
  init_context5();
226953
+ init_conversations();
226844
226954
  init_credential_stuffer();
226845
226955
  init_schema();
226846
226956
  init_types();
@@ -226854,16 +226964,18 @@ var init_tools = __esm({
226854
226964
  });
226855
226965
 
226856
226966
  // ../packages/agents-core/src/data-access/agents.ts
226857
- import { and as and9, count as count8, desc as desc8, eq as eq9, inArray as inArray2 } from "drizzle-orm";
226967
+ import { and as and10, count as count9, desc as desc9, eq as eq10, inArray as inArray2 } from "drizzle-orm";
226858
226968
  var init_agents = __esm({
226859
226969
  "../packages/agents-core/src/data-access/agents.ts"() {
226860
226970
  "use strict";
226861
226971
  init_esm_shims();
226972
+ init_conversations();
226862
226973
  init_schema();
226863
226974
  init_contextConfigs();
226864
226975
  init_externalAgents();
226865
226976
  init_functions();
226866
226977
  init_functionTools();
226978
+ init_subAgentExternalAgentRelations();
226867
226979
  init_subAgentRelations();
226868
226980
  init_subAgents();
226869
226981
  init_tools();
@@ -226871,7 +226983,7 @@ var init_agents = __esm({
226871
226983
  });
226872
226984
 
226873
226985
  // ../packages/agents-core/src/data-access/apiKeys.ts
226874
- import { and as and10, count as count9, desc as desc9, eq as eq10 } from "drizzle-orm";
226986
+ import { and as and11, count as count10, desc as desc10, eq as eq11 } from "drizzle-orm";
226875
226987
  var init_apiKeys2 = __esm({
226876
226988
  "../packages/agents-core/src/data-access/apiKeys.ts"() {
226877
226989
  "use strict";
@@ -227885,10 +227997,10 @@ var require_codegen = __commonJS({
227885
227997
  }
227886
227998
  exports.not = not2;
227887
227999
  var andCode = mappend(exports.operators.AND);
227888
- function and20(...args) {
228000
+ function and21(...args) {
227889
228001
  return args.reduce(andCode);
227890
228002
  }
227891
- exports.and = and20;
228003
+ exports.and = and21;
227892
228004
  var orCode = mappend(exports.operators.OR);
227893
228005
  function or(...args) {
227894
228006
  return args.reduce(orCode);
@@ -229049,20 +229161,20 @@ var require_resolve2 = __commonJS({
229049
229161
  return false;
229050
229162
  }
229051
229163
  function countKeys(schema) {
229052
- let count16 = 0;
229164
+ let count17 = 0;
229053
229165
  for (const key in schema) {
229054
229166
  if (key === "$ref")
229055
229167
  return Infinity;
229056
- count16++;
229168
+ count17++;
229057
229169
  if (SIMPLE_INLINED.has(key))
229058
229170
  continue;
229059
229171
  if (typeof schema[key] == "object") {
229060
- (0, util_1.eachItem)(schema[key], (sch) => count16 += countKeys(sch));
229172
+ (0, util_1.eachItem)(schema[key], (sch) => count17 += countKeys(sch));
229061
229173
  }
229062
- if (count16 === Infinity)
229174
+ if (count17 === Infinity)
229063
229175
  return Infinity;
229064
229176
  }
229065
- return count16;
229177
+ return count17;
229066
229178
  }
229067
229179
  function getFullPath(resolver, id = "", normalize) {
229068
229180
  if (normalize !== false)
@@ -232168,8 +232280,8 @@ var require_contains2 = __commonJS({
232168
232280
  cxt.result(valid, () => cxt.reset());
232169
232281
  function validateItemsWithCount() {
232170
232282
  const schValid = gen.name("_valid");
232171
- const count16 = gen.let("count", 0);
232172
- validateItems(schValid, () => gen.if(schValid, () => checkLimits(count16)));
232283
+ const count17 = gen.let("count", 0);
232284
+ validateItems(schValid, () => gen.if(schValid, () => checkLimits(count17)));
232173
232285
  }
232174
232286
  function validateItems(_valid, block) {
232175
232287
  gen.forRange("i", 0, len, (i2) => {
@@ -232182,16 +232294,16 @@ var require_contains2 = __commonJS({
232182
232294
  block();
232183
232295
  });
232184
232296
  }
232185
- function checkLimits(count16) {
232186
- gen.code((0, codegen_1._)`${count16}++`);
232297
+ function checkLimits(count17) {
232298
+ gen.code((0, codegen_1._)`${count17}++`);
232187
232299
  if (max === void 0) {
232188
- gen.if((0, codegen_1._)`${count16} >= ${min}`, () => gen.assign(valid, true).break());
232300
+ gen.if((0, codegen_1._)`${count17} >= ${min}`, () => gen.assign(valid, true).break());
232189
232301
  } else {
232190
- gen.if((0, codegen_1._)`${count16} > ${max}`, () => gen.assign(valid, false).break());
232302
+ gen.if((0, codegen_1._)`${count17} > ${max}`, () => gen.assign(valid, false).break());
232191
232303
  if (min === 1)
232192
232304
  gen.assign(valid, true);
232193
232305
  else
232194
- gen.if((0, codegen_1._)`${count16} >= ${min}`, () => gen.assign(valid, true));
232306
+ gen.if((0, codegen_1._)`${count17} >= ${min}`, () => gen.assign(valid, true));
232195
232307
  }
232196
232308
  }
232197
232309
  }
@@ -233365,28 +233477,30 @@ var init_props_validation = __esm({
233365
233477
  });
233366
233478
 
233367
233479
  // ../packages/agents-core/src/data-access/artifactComponents.ts
233368
- import { and as and11, count as count10, desc as desc10, eq as eq11 } from "drizzle-orm";
233480
+ import { and as and12, count as count11, desc as desc11, eq as eq12 } from "drizzle-orm";
233369
233481
  var init_artifactComponents = __esm({
233370
233482
  "../packages/agents-core/src/data-access/artifactComponents.ts"() {
233371
233483
  "use strict";
233372
233484
  init_esm_shims();
233485
+ init_conversations();
233373
233486
  init_schema();
233374
233487
  init_props_validation();
233375
233488
  }
233376
233489
  });
233377
233490
 
233378
233491
  // ../packages/agents-core/src/data-access/contextCache.ts
233379
- import { and as and12, eq as eq12 } from "drizzle-orm";
233492
+ import { and as and13, eq as eq13 } from "drizzle-orm";
233380
233493
  var init_contextCache = __esm({
233381
233494
  "../packages/agents-core/src/data-access/contextCache.ts"() {
233382
233495
  "use strict";
233383
233496
  init_esm_shims();
233497
+ init_conversations();
233384
233498
  init_schema();
233385
233499
  }
233386
233500
  });
233387
233501
 
233388
233502
  // ../packages/agents-core/src/data-access/conversations.ts
233389
- import { and as and13, count as count11, desc as desc11, eq as eq13 } from "drizzle-orm";
233503
+ import { and as and14, count as count12, desc as desc12, eq as eq14 } from "drizzle-orm";
233390
233504
  var init_conversations2 = __esm({
233391
233505
  "../packages/agents-core/src/data-access/conversations.ts"() {
233392
233506
  "use strict";
@@ -233405,11 +233519,12 @@ var init_preview_validation = __esm({
233405
233519
  });
233406
233520
 
233407
233521
  // ../packages/agents-core/src/data-access/dataComponents.ts
233408
- import { and as and14, count as count12, desc as desc12, eq as eq14 } from "drizzle-orm";
233522
+ import { and as and15, count as count13, desc as desc13, eq as eq15 } from "drizzle-orm";
233409
233523
  var init_dataComponents = __esm({
233410
233524
  "../packages/agents-core/src/data-access/dataComponents.ts"() {
233411
233525
  "use strict";
233412
233526
  init_esm_shims();
233527
+ init_conversations();
233413
233528
  init_schema();
233414
233529
  init_preview_validation();
233415
233530
  init_props_validation();
@@ -233426,20 +233541,21 @@ var init_agentFull = __esm({
233426
233541
  });
233427
233542
 
233428
233543
  // ../packages/agents-core/src/data-access/agentFull.ts
233429
- import { and as and15, eq as eq15, inArray as inArray3, not } from "drizzle-orm";
233544
+ import { and as and16, eq as eq16, inArray as inArray3, not } from "drizzle-orm";
233430
233545
  var init_agentFull2 = __esm({
233431
233546
  "../packages/agents-core/src/data-access/agentFull.ts"() {
233432
233547
  "use strict";
233433
233548
  init_esm_shims();
233434
233549
  init_schema();
233550
+ init_conversations();
233435
233551
  init_agentFull();
233436
233552
  init_agents();
233437
233553
  init_artifactComponents();
233438
233554
  init_contextConfigs();
233439
233555
  init_dataComponents();
233440
- init_externalAgents();
233441
233556
  init_functions();
233442
233557
  init_functionTools();
233558
+ init_subAgentExternalAgentRelations();
233443
233559
  init_subAgentRelations();
233444
233560
  init_subAgents();
233445
233561
  init_tools();
@@ -233447,17 +233563,18 @@ var init_agentFull2 = __esm({
233447
233563
  });
233448
233564
 
233449
233565
  // ../packages/agents-core/src/data-access/ledgerArtifacts.ts
233450
- import { and as and16, count as count13, eq as eq16 } from "drizzle-orm";
233566
+ import { and as and17, count as count14, eq as eq17 } from "drizzle-orm";
233451
233567
  var init_ledgerArtifacts = __esm({
233452
233568
  "../packages/agents-core/src/data-access/ledgerArtifacts.ts"() {
233453
233569
  "use strict";
233454
233570
  init_esm_shims();
233571
+ init_conversations();
233455
233572
  init_schema();
233456
233573
  }
233457
233574
  });
233458
233575
 
233459
233576
  // ../packages/agents-core/src/data-access/messages.ts
233460
- import { and as and17, asc as asc2, count as count14, desc as desc13, eq as eq17, inArray as inArray4 } from "drizzle-orm";
233577
+ import { and as and18, asc as asc2, count as count15, desc as desc14, eq as eq18, inArray as inArray4 } from "drizzle-orm";
233461
233578
  var init_messages = __esm({
233462
233579
  "../packages/agents-core/src/data-access/messages.ts"() {
233463
233580
  "use strict";
@@ -233467,7 +233584,7 @@ var init_messages = __esm({
233467
233584
  });
233468
233585
 
233469
233586
  // ../packages/agents-core/src/data-access/projects.ts
233470
- import { and as and18, count as count15, desc as desc14, eq as eq18 } from "drizzle-orm";
233587
+ import { and as and19, count as count16, desc as desc15, eq as eq19 } from "drizzle-orm";
233471
233588
  var init_projects = __esm({
233472
233589
  "../packages/agents-core/src/data-access/projects.ts"() {
233473
233590
  "use strict";
@@ -233488,6 +233605,7 @@ var init_projectFull = __esm({
233488
233605
  init_artifactComponents();
233489
233606
  init_credentialReferences();
233490
233607
  init_dataComponents();
233608
+ init_externalAgents();
233491
233609
  init_functions();
233492
233610
  init_projects();
233493
233611
  init_tools();
@@ -233496,7 +233614,7 @@ var init_projectFull = __esm({
233496
233614
  });
233497
233615
 
233498
233616
  // ../packages/agents-core/src/data-access/tasks.ts
233499
- import { and as and19, eq as eq19 } from "drizzle-orm";
233617
+ import { and as and20, eq as eq20 } from "drizzle-orm";
233500
233618
  var init_tasks = __esm({
233501
233619
  "../packages/agents-core/src/data-access/tasks.ts"() {
233502
233620
  "use strict";
@@ -233536,6 +233654,7 @@ var init_data_access = __esm({
233536
233654
  init_messages();
233537
233655
  init_projectFull();
233538
233656
  init_projects();
233657
+ init_subAgentExternalAgentRelations();
233539
233658
  init_subAgentRelations();
233540
233659
  init_subAgents();
233541
233660
  init_tasks();
@@ -233563,6 +233682,7 @@ var init_contextCache2 = __esm({
233563
233682
  "use strict";
233564
233683
  init_esm_shims();
233565
233684
  init_data_access();
233685
+ init_conversations();
233566
233686
  init_logger();
233567
233687
  logger8 = getLogger("context-cache");
233568
233688
  }
@@ -233682,27 +233802,27 @@ var init_memory_store = __esm({
233682
233802
  }
233683
233803
  });
233684
233804
 
233685
- // ../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/version.js
233805
+ // ../node_modules/.pnpm/@nangohq+node@0.69.4/node_modules/@nangohq/node/dist/version.js
233686
233806
  var init_version2 = __esm({
233687
- "../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/version.js"() {
233807
+ "../node_modules/.pnpm/@nangohq+node@0.69.4/node_modules/@nangohq/node/dist/version.js"() {
233688
233808
  "use strict";
233689
233809
  init_esm_shims();
233690
233810
  }
233691
233811
  });
233692
233812
 
233693
- // ../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/utils.js
233813
+ // ../node_modules/.pnpm/@nangohq+node@0.69.4/node_modules/@nangohq/node/dist/utils.js
233694
233814
  var init_utils2 = __esm({
233695
- "../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/utils.js"() {
233815
+ "../node_modules/.pnpm/@nangohq+node@0.69.4/node_modules/@nangohq/node/dist/utils.js"() {
233696
233816
  "use strict";
233697
233817
  init_esm_shims();
233698
233818
  init_version2();
233699
233819
  }
233700
233820
  });
233701
233821
 
233702
- // ../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/types.js
233822
+ // ../node_modules/.pnpm/@nangohq+node@0.69.4/node_modules/@nangohq/node/dist/types.js
233703
233823
  var SyncConfigType;
233704
233824
  var init_types4 = __esm({
233705
- "../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/types.js"() {
233825
+ "../node_modules/.pnpm/@nangohq+node@0.69.4/node_modules/@nangohq/node/dist/types.js"() {
233706
233826
  "use strict";
233707
233827
  init_esm_shims();
233708
233828
  (function(SyncConfigType2) {
@@ -233712,12 +233832,12 @@ var init_types4 = __esm({
233712
233832
  }
233713
233833
  });
233714
233834
 
233715
- // ../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/index.js
233835
+ // ../node_modules/.pnpm/@nangohq+node@0.69.4/node_modules/@nangohq/node/dist/index.js
233716
233836
  import crypto5 from "crypto";
233717
233837
  import https from "https";
233718
233838
  var defaultHttpsAgent;
233719
233839
  var init_dist6 = __esm({
233720
- "../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/index.js"() {
233840
+ "../node_modules/.pnpm/@nangohq+node@0.69.4/node_modules/@nangohq/node/dist/index.js"() {
233721
233841
  "use strict";
233722
233842
  init_esm_shims();
233723
233843
  init_utils2();
@@ -233781,11 +233901,11 @@ var require_main = __commonJS({
233781
233901
  const env3 = { ...runningParsed, ...processEnv };
233782
233902
  const regex = /(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;
233783
233903
  let result = value;
233784
- let match;
233904
+ let match2;
233785
233905
  const seen = /* @__PURE__ */ new Set();
233786
- while ((match = regex.exec(result)) !== null) {
233906
+ while ((match2 = regex.exec(result)) !== null) {
233787
233907
  seen.add(result);
233788
- const [template, bracedExpression, unbracedExpression] = match;
233908
+ const [template, bracedExpression, unbracedExpression] = match2;
233789
233909
  const expression = bracedExpression || unbracedExpression;
233790
233910
  const opRegex = /(:\+|\+|:-|-)/;
233791
233911
  const opMatch = expression.match(opRegex);
@@ -234289,6 +234409,338 @@ var init_config = __esm({
234289
234409
  }
234290
234410
  });
234291
234411
 
234412
+ // src/codegen/variable-name-registry.ts
234413
+ var variable_name_registry_exports = {};
234414
+ __export(variable_name_registry_exports, {
234415
+ DEFAULT_NAMING_CONVENTIONS: () => DEFAULT_NAMING_CONVENTIONS,
234416
+ VariableNameGenerator: () => VariableNameGenerator,
234417
+ collectAllEntities: () => collectAllEntities
234418
+ });
234419
+ function collectAllEntities(projectData) {
234420
+ const entities = [];
234421
+ entities.push({ id: projectData.id, type: "project", data: projectData });
234422
+ if (projectData.agents) {
234423
+ for (const [agentId, agentData] of Object.entries(projectData.agents)) {
234424
+ entities.push({ id: agentId, type: "agent", data: agentData });
234425
+ const agentObj = agentData;
234426
+ if (agentObj.subAgents) {
234427
+ for (const [subAgentId, subAgentData] of Object.entries(agentObj.subAgents)) {
234428
+ entities.push({ id: subAgentId, type: "subAgent", data: subAgentData });
234429
+ }
234430
+ }
234431
+ }
234432
+ }
234433
+ if (projectData.tools) {
234434
+ for (const [toolId, toolData] of Object.entries(projectData.tools)) {
234435
+ entities.push({ id: toolId, type: "tool", data: toolData });
234436
+ }
234437
+ }
234438
+ if (projectData.dataComponents) {
234439
+ for (const [compId, compData] of Object.entries(projectData.dataComponents)) {
234440
+ entities.push({ id: compId, type: "dataComponent", data: compData });
234441
+ }
234442
+ }
234443
+ if (projectData.artifactComponents) {
234444
+ for (const [compId, compData] of Object.entries(projectData.artifactComponents)) {
234445
+ entities.push({ id: compId, type: "artifactComponent", data: compData });
234446
+ }
234447
+ }
234448
+ if (projectData.externalAgents) {
234449
+ for (const [agentId, agentData] of Object.entries(projectData.externalAgents)) {
234450
+ entities.push({ id: agentId, type: "externalAgent", data: agentData });
234451
+ }
234452
+ }
234453
+ if (projectData.agents) {
234454
+ for (const [_agentId, agentData] of Object.entries(projectData.agents)) {
234455
+ const agentObj = agentData;
234456
+ if (agentObj.statusUpdates?.statusComponents) {
234457
+ for (const statusComp of agentObj.statusUpdates.statusComponents) {
234458
+ if (statusComp.type) {
234459
+ entities.push({ id: statusComp.type, type: "statusComponent" });
234460
+ }
234461
+ }
234462
+ }
234463
+ }
234464
+ }
234465
+ const credentialReferences2 = /* @__PURE__ */ new Set();
234466
+ if (projectData.credentialReferences) {
234467
+ for (const credId of Object.keys(projectData.credentialReferences)) {
234468
+ credentialReferences2.add(credId);
234469
+ }
234470
+ }
234471
+ if (projectData.tools) {
234472
+ for (const [_toolId, toolData] of Object.entries(projectData.tools)) {
234473
+ const tool2 = toolData;
234474
+ if (tool2.credentialReferenceId) {
234475
+ credentialReferences2.add(tool2.credentialReferenceId);
234476
+ }
234477
+ }
234478
+ }
234479
+ if (projectData.externalAgents) {
234480
+ for (const [_agentId, agentData] of Object.entries(projectData.externalAgents)) {
234481
+ const agent = agentData;
234482
+ if (agent.credentialReferenceId) {
234483
+ credentialReferences2.add(agent.credentialReferenceId);
234484
+ }
234485
+ }
234486
+ }
234487
+ if (projectData.agents) {
234488
+ for (const [_agentId, agentData] of Object.entries(projectData.agents)) {
234489
+ const agent = agentData;
234490
+ if (agent.contextConfig?.headers?.credentialReferenceId) {
234491
+ credentialReferences2.add(agent.contextConfig.headers.credentialReferenceId);
234492
+ }
234493
+ if (agent.contextConfig?.contextVariables) {
234494
+ for (const [_varId, varData] of Object.entries(agent.contextConfig.contextVariables)) {
234495
+ const contextVar = varData;
234496
+ if (contextVar.credentialReferenceId) {
234497
+ credentialReferences2.add(contextVar.credentialReferenceId);
234498
+ }
234499
+ }
234500
+ }
234501
+ if (agent.subAgents) {
234502
+ for (const [_subAgentId, subAgentData] of Object.entries(agent.subAgents)) {
234503
+ const subAgent = subAgentData;
234504
+ if (subAgent.contextConfig?.headers?.credentialReferenceId) {
234505
+ credentialReferences2.add(subAgent.contextConfig.headers.credentialReferenceId);
234506
+ }
234507
+ if (subAgent.contextConfig?.contextVariables) {
234508
+ for (const [_varId, varData] of Object.entries(
234509
+ subAgent.contextConfig.contextVariables
234510
+ )) {
234511
+ const contextVar = varData;
234512
+ if (contextVar.credentialReferenceId) {
234513
+ credentialReferences2.add(contextVar.credentialReferenceId);
234514
+ }
234515
+ }
234516
+ }
234517
+ }
234518
+ }
234519
+ }
234520
+ }
234521
+ return entities;
234522
+ }
234523
+ var DEFAULT_NAMING_CONVENTIONS, VariableNameGenerator;
234524
+ var init_variable_name_registry = __esm({
234525
+ "src/codegen/variable-name-registry.ts"() {
234526
+ "use strict";
234527
+ init_esm_shims();
234528
+ DEFAULT_NAMING_CONVENTIONS = {
234529
+ projectSuffix: "Project",
234530
+ agentSuffix: "Agent",
234531
+ subAgentSuffix: "SubAgent",
234532
+ toolSuffix: null,
234533
+ // Usually no suffix needed
234534
+ dataComponentSuffix: null,
234535
+ artifactComponentSuffix: null,
234536
+ statusComponentSuffix: null,
234537
+ credentialSuffix: null,
234538
+ environmentSuffix: null,
234539
+ // No suffix needed for environments
234540
+ externalAgentSuffix: null
234541
+ };
234542
+ VariableNameGenerator = class {
234543
+ registry;
234544
+ conventions;
234545
+ conflicts;
234546
+ constructor(conventions = DEFAULT_NAMING_CONVENTIONS) {
234547
+ this.registry = {
234548
+ projects: /* @__PURE__ */ new Map(),
234549
+ agents: /* @__PURE__ */ new Map(),
234550
+ subAgents: /* @__PURE__ */ new Map(),
234551
+ tools: /* @__PURE__ */ new Map(),
234552
+ dataComponents: /* @__PURE__ */ new Map(),
234553
+ artifactComponents: /* @__PURE__ */ new Map(),
234554
+ statusComponents: /* @__PURE__ */ new Map(),
234555
+ credentials: /* @__PURE__ */ new Map(),
234556
+ environments: /* @__PURE__ */ new Map(),
234557
+ externalAgents: /* @__PURE__ */ new Map(),
234558
+ usedNames: /* @__PURE__ */ new Map()
234559
+ };
234560
+ this.conventions = conventions;
234561
+ this.conflicts = [];
234562
+ }
234563
+ /**
234564
+ * Generate unique variable name for an entity
234565
+ * Ensures no conflicts across all entity types
234566
+ */
234567
+ generateVariableName(id, entityType, entityData) {
234568
+ const registryMap = this.getRegistryMap(entityType);
234569
+ const existing = registryMap.get(id);
234570
+ if (existing) {
234571
+ return existing;
234572
+ }
234573
+ let baseName;
234574
+ if (entityType === "tool" && entityData?.name && this.isRandomId(id)) {
234575
+ baseName = this.idToVariableName(entityData.name);
234576
+ } else {
234577
+ baseName = this.idToVariableName(id);
234578
+ }
234579
+ if (!this.registry.usedNames.has(baseName)) {
234580
+ this.register(id, baseName, entityType);
234581
+ return baseName;
234582
+ }
234583
+ const existingEntity = this.registry.usedNames.get(baseName);
234584
+ if (existingEntity) {
234585
+ const existingConflict = this.conflicts.find((c2) => c2.id === id);
234586
+ if (existingConflict) {
234587
+ existingConflict.types.push(entityType);
234588
+ } else {
234589
+ this.conflicts.push({
234590
+ id,
234591
+ types: [existingEntity.type, entityType],
234592
+ resolvedNames: {
234593
+ [existingEntity.type]: baseName
234594
+ }
234595
+ });
234596
+ }
234597
+ }
234598
+ const suffix = this.getSuffixForType(entityType);
234599
+ const uniqueName = baseName + suffix;
234600
+ let finalName = uniqueName;
234601
+ let counter = 2;
234602
+ while (this.registry.usedNames.has(finalName)) {
234603
+ finalName = `${uniqueName}${counter}`;
234604
+ counter++;
234605
+ }
234606
+ this.register(id, finalName, entityType);
234607
+ const conflict = this.conflicts.find((c2) => c2.id === id);
234608
+ if (conflict) {
234609
+ conflict.resolvedNames[entityType] = finalName;
234610
+ }
234611
+ return finalName;
234612
+ }
234613
+ /**
234614
+ * Register an existing variable name (from detected patterns)
234615
+ */
234616
+ register(id, variableName, entityType) {
234617
+ const registryMap = this.getRegistryMap(entityType);
234618
+ registryMap.set(id, variableName);
234619
+ this.registry.usedNames.set(variableName, { id, type: entityType });
234620
+ }
234621
+ /**
234622
+ * Get the registry for lookup
234623
+ */
234624
+ getRegistry() {
234625
+ return this.registry;
234626
+ }
234627
+ /**
234628
+ * Get all conflicts that were resolved
234629
+ */
234630
+ getConflicts() {
234631
+ return this.conflicts;
234632
+ }
234633
+ /**
234634
+ * Convert ID to camelCase variable name
234635
+ */
234636
+ idToVariableName(id) {
234637
+ if (this.isRandomId(id)) {
234638
+ return id;
234639
+ }
234640
+ const parts = id.split(/[-_]/);
234641
+ const camelCase = parts.map((part, index2) => {
234642
+ if (index2 === 0) {
234643
+ return part.toLowerCase();
234644
+ }
234645
+ return part.charAt(0).toUpperCase() + part.slice(1).toLowerCase();
234646
+ }).join("");
234647
+ return camelCase;
234648
+ }
234649
+ /**
234650
+ * Check if an ID looks random/UUID-like
234651
+ */
234652
+ isRandomId(id) {
234653
+ if (!id.includes("-") && !id.includes("_")) {
234654
+ return /[0-9]/.test(id) || /[A-Z]/.test(id);
234655
+ }
234656
+ return false;
234657
+ }
234658
+ /**
234659
+ * Generate filename from entity data (for file naming)
234660
+ */
234661
+ generateFileName(id, entityType, entityData) {
234662
+ let baseName;
234663
+ if (entityType === "tool" && entityData?.name && this.isRandomId(id)) {
234664
+ baseName = this.nameToFileName(entityData.name);
234665
+ } else {
234666
+ baseName = this.idToFileName(id);
234667
+ }
234668
+ return baseName;
234669
+ }
234670
+ /**
234671
+ * Convert name to kebab-case filename
234672
+ */
234673
+ nameToFileName(name) {
234674
+ return name.replace(/[^\w\s-]/g, "").trim().replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
234675
+ }
234676
+ /**
234677
+ * Convert ID to kebab-case filename
234678
+ */
234679
+ idToFileName(id) {
234680
+ return id.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
234681
+ }
234682
+ /**
234683
+ * Get appropriate suffix for entity type
234684
+ */
234685
+ getSuffixForType(entityType) {
234686
+ switch (entityType) {
234687
+ case "project":
234688
+ return this.conventions.projectSuffix;
234689
+ case "agent":
234690
+ return this.conventions.agentSuffix;
234691
+ case "subAgent":
234692
+ return this.conventions.subAgentSuffix;
234693
+ case "tool":
234694
+ return this.conventions.toolSuffix || "";
234695
+ case "dataComponent":
234696
+ return this.conventions.dataComponentSuffix || "";
234697
+ case "artifactComponent":
234698
+ return this.conventions.artifactComponentSuffix || "";
234699
+ case "statusComponent":
234700
+ return this.conventions.statusComponentSuffix || "";
234701
+ case "credential":
234702
+ return this.conventions.credentialSuffix || "";
234703
+ case "environment":
234704
+ return this.conventions.environmentSuffix || "";
234705
+ case "externalAgent":
234706
+ return this.conventions.externalAgentSuffix || "";
234707
+ default:
234708
+ return "";
234709
+ }
234710
+ }
234711
+ /**
234712
+ * Get the appropriate registry map for an entity type
234713
+ */
234714
+ getRegistryMap(entityType) {
234715
+ switch (entityType) {
234716
+ case "project":
234717
+ return this.registry.projects;
234718
+ case "agent":
234719
+ return this.registry.agents;
234720
+ case "subAgent":
234721
+ return this.registry.subAgents;
234722
+ case "tool":
234723
+ return this.registry.tools;
234724
+ case "dataComponent":
234725
+ return this.registry.dataComponents;
234726
+ case "artifactComponent":
234727
+ return this.registry.artifactComponents;
234728
+ case "statusComponent":
234729
+ return this.registry.statusComponents;
234730
+ case "credential":
234731
+ return this.registry.credentials;
234732
+ case "environment":
234733
+ return this.registry.environments;
234734
+ case "externalAgent":
234735
+ return this.registry.externalAgents;
234736
+ default:
234737
+ throw new Error(`Unknown entity type: ${entityType}`);
234738
+ }
234739
+ }
234740
+ };
234741
+ }
234742
+ });
234743
+
234292
234744
  // src/commands/pull.placeholder-system.ts
234293
234745
  import { randomBytes as randomBytes2 } from "crypto";
234294
234746
  import { jsonSchemaToZod } from "json-schema-to-zod";
@@ -234491,6 +234943,7 @@ __export(pull_llm_generate_exports, {
234491
234943
  generateDataComponentFile: () => generateDataComponentFile,
234492
234944
  generateEnvironmentFileTemplate: () => generateEnvironmentFileTemplate,
234493
234945
  generateEnvironmentFiles: () => generateEnvironmentFiles,
234946
+ generateExternalAgentFile: () => generateExternalAgentFile,
234494
234947
  generateIndexFile: () => generateIndexFile,
234495
234948
  generateStatusComponentFile: () => generateStatusComponentFile,
234496
234949
  generateTextWithPlaceholders: () => generateTextWithPlaceholders,
@@ -234542,7 +234995,9 @@ function detectAvailableProvider() {
234542
234995
  if (googleKey) {
234543
234996
  return "google";
234544
234997
  }
234545
- throw new Error("No LLM provider API key found. Please set ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY");
234998
+ throw new Error(
234999
+ "No LLM provider API key found. Please set ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY"
235000
+ );
234546
235001
  }
234547
235002
  function getDefaultModelForProvider(provider) {
234548
235003
  switch (provider) {
@@ -234714,7 +235169,7 @@ Generate ONLY the TypeScript code without any markdown or explanations.`;
234714
235169
  );
234715
235170
  writeFileSync3(outputPath, cleanGeneratedCode(text4));
234716
235171
  }
234717
- function generateImportMappings(toolFilenames, componentFilenames) {
235172
+ function generateImportMappings(toolFilenames, componentFilenames, externalAgentFilenames) {
234718
235173
  let result = "";
234719
235174
  if (toolFilenames && toolFilenames.size > 0) {
234720
235175
  result += "TOOLS (use exact import paths):\n";
@@ -234739,9 +235194,18 @@ function generateImportMappings(toolFilenames, componentFilenames) {
234739
235194
  `;
234740
235195
  }
234741
235196
  }
235197
+ if (externalAgentFilenames && externalAgentFilenames.size > 0) {
235198
+ result += "EXTERNAL AGENTS (use exact import paths):\n";
235199
+ for (const [externalAgentId, fileName] of externalAgentFilenames.entries()) {
235200
+ result += ` - External Agent ID: "${externalAgentId}" \u2192 Import: "../external-agents/${fileName.replace(".ts", "")}"
235201
+ `;
235202
+ }
235203
+ result += "\n";
235204
+ }
235205
+ console.log("result", result);
234742
235206
  return result;
234743
235207
  }
234744
- async function generateAgentFile(agentData, agentId, outputPath, modelSettings, toolFilenames, componentFilenames, debug = false, reasoningConfig) {
235208
+ async function generateAgentFile(agentData, agentId, outputPath, modelSettings, toolFilenames, componentFilenames, externalAgentFilenames, debug = false, reasoningConfig) {
234745
235209
  const model = createModel(modelSettings);
234746
235210
  const promptTemplate = `Generate a TypeScript file for an Inkeep agent.
234747
235211
 
@@ -234751,7 +235215,7 @@ AGENT DATA:
234751
235215
  AGENT ID: ${agentId}
234752
235216
 
234753
235217
  ${toolFilenames || componentFilenames ? `IMPORT PATH MAPPINGS (CRITICAL - USE EXACT PATHS):
234754
- ${generateImportMappings(toolFilenames, componentFilenames)}
235218
+ ${generateImportMappings(toolFilenames, componentFilenames, externalAgentFilenames)}
234755
235219
 
234756
235220
  !!! WARNING: Entity IDs \u2260 File Paths !!!
234757
235221
  - Entity IDs may use underscores or different naming
@@ -234784,6 +235248,7 @@ REQUIREMENTS:
234784
235248
  2. Define each agent using the agent() function following the type definitions provided above
234785
235249
  3. Create the agent using agent() with proper structure
234786
235250
  - IMPORTANT: If description is null, undefined, or empty string, omit the description field entirely
235251
+ 4. External agents live within the agents directory, import them using the import { externalAgent } from '../agents/external-agent'; syntax.
234787
235252
  4. CRITICAL: Template Literals vs Raw Code:
234788
235253
  - For STRING VALUES: ALWAYS use template literals with backticks: \`string content\`
234789
235254
  - This includes: prompt, description, query, url, method, body, defaultValue, etc.
@@ -234827,12 +235292,13 @@ prompt: \`<{{subAgents.facts.prompt.abc12345}}>\`
234827
235292
  prompt: '<{{subAgents.facts.prompt.abc12345}}>'
234828
235293
 
234829
235294
  FULL EXAMPLE:
234830
- import { agent, agent } from '@inkeep/agents-sdk';
235295
+ import { agent } from '@inkeep/agents-sdk';
234831
235296
  import { contextConfig, fetchDefinition, headers } from '@inkeep/agents-core';
234832
235297
  import { userProfile } from '../data-components/user-profile';
234833
235298
  import { searchTool } from '../tools/search-tool';
234834
235299
  import { weatherTool } from '../tools/weather-tool';
234835
235300
  import { toolSummary } from '../status-components/tool-summary';
235301
+ import { externalHelperAgent } from '../agents/external-helper-agent';
234836
235302
  import { progressStatus } from '../status-components/progress-status';
234837
235303
  import { z } from 'zod';
234838
235304
 
@@ -234873,6 +235339,7 @@ const routerAgent = agent({
234873
235339
  name: 'Router Agent',
234874
235340
  prompt: \`Route requests to appropriate agents using \${supportAgentContext.toTemplate('supportDescription.description')} for the user \${supportAgentHeaders.toTemplate('userId')}\`,
234875
235341
  canTransferTo: () => [qaAgent]
235342
+ canDelegateTo: () => [externalHelperAgent.with({ headers: { 'X-API-Key': '123' } })],
234876
235343
  });
234877
235344
 
234878
235345
  const qaAgent = agent({
@@ -234886,6 +235353,7 @@ Follow these rules:
234886
235353
  - Use the user's name \${supportAgentHeaders.toTemplate('userId')} when applicable
234887
235354
  - Use available tools\`,
234888
235355
  canUse: () => [searchTool, weatherTool],
235356
+ canDelegateTo: () => [externalHelperAgent],
234889
235357
  selectedTools: {
234890
235358
  [searchTool.id]: ['search_web', 'search_docs'],
234891
235359
  [weatherTool.id]: ['get_forecast']
@@ -235309,6 +235777,61 @@ Generate ONLY the TypeScript code without any markdown or explanations.`;
235309
235777
  );
235310
235778
  writeFileSync3(outputPath, cleanGeneratedCode(text4));
235311
235779
  }
235780
+ async function generateExternalAgentFile(externalAgentData, externalAgentId, outputPath, modelSettings, reasoningConfig) {
235781
+ const model = createModel(modelSettings);
235782
+ const promptTemplate = `Generate a TypeScript file for an Inkeep external agent.
235783
+
235784
+ EXTERNAL AGENT DATA:
235785
+ {{DATA}}
235786
+
235787
+ EXTERNAL AGENT ID: ${externalAgentId}
235788
+
235789
+ ${getTypeDefinitions()}
235790
+
235791
+ ${NAMING_CONVENTION_RULES}
235792
+
235793
+ ${IMPORT_INSTRUCTIONS}
235794
+
235795
+ REQUIREMENTS:
235796
+ 1. Import externalAgent from '@inkeep/agents-sdk'
235797
+ 3. Create the external agent using externalAgent()
235798
+ 4. Export following naming convention rules (camelCase version of ID)
235799
+ 5. Include all properties from the external agent data INCLUDING the 'id' property
235800
+ 6. CRITICAL: All imports must be alphabetically sorted to comply with Biome linting
235801
+ 7. CRITICAL: Use template literals with backticks for all STRING values (url, description, etc.)
235802
+
235803
+ EXAMPLE:
235804
+ import { externalAgent } from '@inkeep/agents-sdk';
235805
+ import { }
235806
+
235807
+ export const externalHelper = externalAgent({
235808
+ id: 'external-helper',
235809
+ name: 'External Helper',
235810
+ url: \`https://api.example.com/agent\`,
235811
+ credentialReference: 'my-credential-reference',
235812
+ });
235813
+
235814
+
235815
+ Generate ONLY the TypeScript code without any markdown or explanations.`;
235816
+ const text4 = await generateTextWithPlaceholders(
235817
+ model,
235818
+ externalAgentData,
235819
+ promptTemplate,
235820
+ {
235821
+ temperature: 0.1,
235822
+ maxOutputTokens: 4e3,
235823
+ abortSignal: AbortSignal.timeout(9e4)
235824
+ // 90 second timeout (increased for reasoning)
235825
+ },
235826
+ false,
235827
+ // debug
235828
+ { fileType: "external_agent" },
235829
+ // context - for Langfuse metadata
235830
+ reasoningConfig
235831
+ // reasoning config
235832
+ );
235833
+ writeFileSync3(outputPath, cleanGeneratedCode(text4));
235834
+ }
235312
235835
  function generateEnvironmentFileTemplate(environmentsDir, environment, credentials) {
235313
235836
  const { writeFileSync: writeFileSync7 } = require3("node:fs");
235314
235837
  const { join: join14 } = require3("node:path");
@@ -235329,9 +235852,11 @@ function generateEnvironmentFileTemplate(environmentsDir, environment, credentia
235329
235852
  `retrievalParams: ${JSON.stringify(cred.retrievalParams, null, 6).replace(/\n/g, "\n ")}`
235330
235853
  );
235331
235854
  }
235332
- credentialEntries.push(` ${varName}: credential({
235855
+ credentialEntries.push(
235856
+ ` ${varName}: credential({
235333
235857
  ${params.join(",\n ")}
235334
- })`);
235858
+ })`
235859
+ );
235335
235860
  }
235336
235861
  credentialsCode = `
235337
235862
  ${credentialEntries.join(",\n")}
@@ -235357,9 +235882,9 @@ function updateEnvironmentIndexTemplate(environmentsDir, newEnvironment) {
235357
235882
  if (existsSync12(indexPath)) {
235358
235883
  const existingContent = readFileSync8(indexPath, "utf-8");
235359
235884
  const importRegex = /import\s+{\s*(\w+)\s*}\s+from\s+['"]\.\/([\w-]+)\.env['"];?/g;
235360
- let match;
235361
- while ((match = importRegex.exec(existingContent)) !== null) {
235362
- const envName = match[2];
235885
+ let match2;
235886
+ while ((match2 = importRegex.exec(existingContent)) !== null) {
235887
+ const envName = match2[2];
235363
235888
  if (!existingEnvironments.includes(envName)) {
235364
235889
  existingEnvironments.push(envName);
235365
235890
  }
@@ -235429,9 +235954,9 @@ async function updateEnvironmentIndex(environmentsDir, environment) {
235429
235954
  if (existsSync12(indexPath)) {
235430
235955
  existingContent = readFileSync8(indexPath, "utf-8");
235431
235956
  const importRegex = /import\s+{\s*(\w+)\s*}\s+from\s+['"]\.\/([\w-]+)\.env['"];?/g;
235432
- let match;
235433
- while ((match = importRegex.exec(existingContent)) !== null) {
235434
- const envName = match[2];
235957
+ let match2;
235958
+ while ((match2 = importRegex.exec(existingContent)) !== null) {
235959
+ const envName = match2[2];
235435
235960
  if (!existingEnvironments.includes(envName)) {
235436
235961
  existingEnvironments.push(envName);
235437
235962
  }
@@ -235492,7 +236017,7 @@ export const myProject = project({
235492
236017
  });
235493
236018
  `;
235494
236019
  break;
235495
- case "agent":
236020
+ case "agent": {
235496
236021
  const importMappings = spec.toolFilenames || spec.componentFilenames ? `IMPORT PATH MAPPINGS (CRITICAL - USE EXACT PATHS):
235497
236022
  ${generateImportMappings(spec.toolFilenames, spec.componentFilenames)}
235498
236023
 
@@ -235534,6 +236059,7 @@ ${importMappings}REQUIREMENTS FOR AGENT FILE:
235534
236059
  6. If you are writing zod schemas make them clean. For example if you see z.union([z.string(), z.null()]) write it as z.string().nullable()
235535
236060
  `;
235536
236061
  break;
236062
+ }
235537
236063
  case "tool":
235538
236064
  fileSpecificInstructions = `
235539
236065
  REQUIREMENTS FOR TOOL FILE:
@@ -235545,6 +236071,16 @@ REQUIREMENTS FOR TOOL FILE:
235545
236071
  6. Convert credentialReferenceId to credential key format by replacing hyphens with underscores for the getEnvironmentSetting() call (e.g., 'inkeep-api-credential' becomes 'inkeep_api_credential')
235546
236072
  7. TRANSPORT CONFIG: If config.mcp.transport exists, extract it as a transport property (not nested in config)
235547
236073
  8. NO CONFIG OBJECT: mcpTool does not accept a 'config' property - use individual properties only
236074
+ `;
236075
+ break;
236076
+ case "external_agent":
236077
+ fileSpecificInstructions = `
236078
+ REQUIREMENTS FOR EXTERNAL AGENT FILE:
236079
+ 1. Import externalAgent from '@inkeep/agents-sdk'
236080
+ 2. Create the external agent using externalAgent()
236081
+ 3. Export following naming convention rules (camelCase version of ID)
236082
+ 5. CRITICAL: If credentialReferenceId exists in external agent data, add it as a credential property using envSettings.getEnvironmentSetting()
236083
+ 6. Convert credentialReferenceId to credential key format by replacing hyphens with underscores for the getEnvironmentSetting() call (e.g., 'inkeep-api-credential' becomes 'inkeep_api_credential')
235548
236084
  `;
235549
236085
  break;
235550
236086
  case "data_component":
@@ -236055,325 +236591,6 @@ import { weatherAgent } from './agent/weather-agent';
236055
236591
  }
236056
236592
  });
236057
236593
 
236058
- // src/codegen/variable-name-registry.ts
236059
- var variable_name_registry_exports = {};
236060
- __export(variable_name_registry_exports, {
236061
- DEFAULT_NAMING_CONVENTIONS: () => DEFAULT_NAMING_CONVENTIONS,
236062
- VariableNameGenerator: () => VariableNameGenerator,
236063
- collectAllEntities: () => collectAllEntities
236064
- });
236065
- function collectAllEntities(projectData) {
236066
- const entities = [];
236067
- entities.push({ id: projectData.id, type: "project", data: projectData });
236068
- if (projectData.agents) {
236069
- for (const [agentId, agentData] of Object.entries(projectData.agents)) {
236070
- entities.push({ id: agentId, type: "agent", data: agentData });
236071
- const agentObj = agentData;
236072
- if (agentObj.subAgents) {
236073
- for (const [subAgentId, subAgentData] of Object.entries(agentObj.subAgents)) {
236074
- entities.push({ id: subAgentId, type: "subAgent", data: subAgentData });
236075
- }
236076
- }
236077
- }
236078
- }
236079
- if (projectData.tools) {
236080
- for (const [toolId, toolData] of Object.entries(projectData.tools)) {
236081
- entities.push({ id: toolId, type: "tool", data: toolData });
236082
- }
236083
- }
236084
- if (projectData.dataComponents) {
236085
- for (const [compId, compData] of Object.entries(projectData.dataComponents)) {
236086
- entities.push({ id: compId, type: "dataComponent", data: compData });
236087
- }
236088
- }
236089
- if (projectData.artifactComponents) {
236090
- for (const [compId, compData] of Object.entries(projectData.artifactComponents)) {
236091
- entities.push({ id: compId, type: "artifactComponent", data: compData });
236092
- }
236093
- }
236094
- if (projectData.agents) {
236095
- for (const [_agentId, agentData] of Object.entries(projectData.agents)) {
236096
- const agentObj = agentData;
236097
- if (agentObj.statusUpdates?.statusComponents) {
236098
- for (const statusComp of agentObj.statusUpdates.statusComponents) {
236099
- if (statusComp.type) {
236100
- entities.push({ id: statusComp.type, type: "statusComponent" });
236101
- }
236102
- }
236103
- }
236104
- }
236105
- }
236106
- const credentialReferences2 = /* @__PURE__ */ new Set();
236107
- if (projectData.credentialReferences) {
236108
- for (const credId of Object.keys(projectData.credentialReferences)) {
236109
- credentialReferences2.add(credId);
236110
- }
236111
- }
236112
- if (projectData.tools) {
236113
- for (const [_toolId, toolData] of Object.entries(projectData.tools)) {
236114
- const tool2 = toolData;
236115
- if (tool2.credentialReferenceId) {
236116
- credentialReferences2.add(tool2.credentialReferenceId);
236117
- }
236118
- }
236119
- }
236120
- if (projectData.externalAgents) {
236121
- for (const [_agentId, agentData] of Object.entries(projectData.externalAgents)) {
236122
- const agent = agentData;
236123
- if (agent.credentialReferenceId) {
236124
- credentialReferences2.add(agent.credentialReferenceId);
236125
- }
236126
- }
236127
- }
236128
- if (projectData.agents) {
236129
- for (const [_agentId, agentData] of Object.entries(projectData.agents)) {
236130
- const agent = agentData;
236131
- if (agent.contextConfig?.headers?.credentialReferenceId) {
236132
- credentialReferences2.add(agent.contextConfig.headers.credentialReferenceId);
236133
- }
236134
- if (agent.contextConfig?.contextVariables) {
236135
- for (const [_varId, varData] of Object.entries(agent.contextConfig.contextVariables)) {
236136
- const contextVar = varData;
236137
- if (contextVar.credentialReferenceId) {
236138
- credentialReferences2.add(contextVar.credentialReferenceId);
236139
- }
236140
- }
236141
- }
236142
- if (agent.subAgents) {
236143
- for (const [_subAgentId, subAgentData] of Object.entries(agent.subAgents)) {
236144
- const subAgent = subAgentData;
236145
- if (subAgent.contextConfig?.headers?.credentialReferenceId) {
236146
- credentialReferences2.add(subAgent.contextConfig.headers.credentialReferenceId);
236147
- }
236148
- if (subAgent.contextConfig?.contextVariables) {
236149
- for (const [_varId, varData] of Object.entries(subAgent.contextConfig.contextVariables)) {
236150
- const contextVar = varData;
236151
- if (contextVar.credentialReferenceId) {
236152
- credentialReferences2.add(contextVar.credentialReferenceId);
236153
- }
236154
- }
236155
- }
236156
- }
236157
- }
236158
- }
236159
- }
236160
- return entities;
236161
- }
236162
- var DEFAULT_NAMING_CONVENTIONS, VariableNameGenerator;
236163
- var init_variable_name_registry = __esm({
236164
- "src/codegen/variable-name-registry.ts"() {
236165
- "use strict";
236166
- init_esm_shims();
236167
- DEFAULT_NAMING_CONVENTIONS = {
236168
- projectSuffix: "Project",
236169
- agentSuffix: "Agent",
236170
- subAgentSuffix: "SubAgent",
236171
- toolSuffix: null,
236172
- // Usually no suffix needed
236173
- dataComponentSuffix: null,
236174
- artifactComponentSuffix: null,
236175
- statusComponentSuffix: null,
236176
- credentialSuffix: null,
236177
- environmentSuffix: null
236178
- // No suffix needed for environments
236179
- };
236180
- VariableNameGenerator = class {
236181
- registry;
236182
- conventions;
236183
- conflicts;
236184
- constructor(conventions = DEFAULT_NAMING_CONVENTIONS) {
236185
- this.registry = {
236186
- projects: /* @__PURE__ */ new Map(),
236187
- agents: /* @__PURE__ */ new Map(),
236188
- subAgents: /* @__PURE__ */ new Map(),
236189
- tools: /* @__PURE__ */ new Map(),
236190
- dataComponents: /* @__PURE__ */ new Map(),
236191
- artifactComponents: /* @__PURE__ */ new Map(),
236192
- statusComponents: /* @__PURE__ */ new Map(),
236193
- credentials: /* @__PURE__ */ new Map(),
236194
- environments: /* @__PURE__ */ new Map(),
236195
- usedNames: /* @__PURE__ */ new Map()
236196
- };
236197
- this.conventions = conventions;
236198
- this.conflicts = [];
236199
- }
236200
- /**
236201
- * Generate unique variable name for an entity
236202
- * Ensures no conflicts across all entity types
236203
- */
236204
- generateVariableName(id, entityType, entityData) {
236205
- const registryMap = this.getRegistryMap(entityType);
236206
- const existing = registryMap.get(id);
236207
- if (existing) {
236208
- return existing;
236209
- }
236210
- let baseName;
236211
- if (entityType === "tool" && entityData?.name && this.isRandomId(id)) {
236212
- baseName = this.idToVariableName(entityData.name);
236213
- } else {
236214
- baseName = this.idToVariableName(id);
236215
- }
236216
- if (!this.registry.usedNames.has(baseName)) {
236217
- this.register(id, baseName, entityType);
236218
- return baseName;
236219
- }
236220
- const existingEntity = this.registry.usedNames.get(baseName);
236221
- if (existingEntity) {
236222
- const existingConflict = this.conflicts.find((c2) => c2.id === id);
236223
- if (existingConflict) {
236224
- existingConflict.types.push(entityType);
236225
- } else {
236226
- this.conflicts.push({
236227
- id,
236228
- types: [existingEntity.type, entityType],
236229
- resolvedNames: {
236230
- [existingEntity.type]: baseName
236231
- }
236232
- });
236233
- }
236234
- }
236235
- const suffix = this.getSuffixForType(entityType);
236236
- const uniqueName = baseName + suffix;
236237
- let finalName = uniqueName;
236238
- let counter = 2;
236239
- while (this.registry.usedNames.has(finalName)) {
236240
- finalName = `${uniqueName}${counter}`;
236241
- counter++;
236242
- }
236243
- this.register(id, finalName, entityType);
236244
- const conflict = this.conflicts.find((c2) => c2.id === id);
236245
- if (conflict) {
236246
- conflict.resolvedNames[entityType] = finalName;
236247
- }
236248
- return finalName;
236249
- }
236250
- /**
236251
- * Register an existing variable name (from detected patterns)
236252
- */
236253
- register(id, variableName, entityType) {
236254
- const registryMap = this.getRegistryMap(entityType);
236255
- registryMap.set(id, variableName);
236256
- this.registry.usedNames.set(variableName, { id, type: entityType });
236257
- }
236258
- /**
236259
- * Get the registry for lookup
236260
- */
236261
- getRegistry() {
236262
- return this.registry;
236263
- }
236264
- /**
236265
- * Get all conflicts that were resolved
236266
- */
236267
- getConflicts() {
236268
- return this.conflicts;
236269
- }
236270
- /**
236271
- * Convert ID to camelCase variable name
236272
- */
236273
- idToVariableName(id) {
236274
- if (this.isRandomId(id)) {
236275
- return id;
236276
- }
236277
- const parts = id.split(/[-_]/);
236278
- const camelCase = parts.map((part, index2) => {
236279
- if (index2 === 0) {
236280
- return part.toLowerCase();
236281
- }
236282
- return part.charAt(0).toUpperCase() + part.slice(1).toLowerCase();
236283
- }).join("");
236284
- return camelCase;
236285
- }
236286
- /**
236287
- * Check if an ID looks random/UUID-like
236288
- */
236289
- isRandomId(id) {
236290
- if (!id.includes("-") && !id.includes("_")) {
236291
- return /[0-9]/.test(id) || /[A-Z]/.test(id);
236292
- }
236293
- return false;
236294
- }
236295
- /**
236296
- * Generate filename from entity data (for file naming)
236297
- */
236298
- generateFileName(id, entityType, entityData) {
236299
- let baseName;
236300
- if (entityType === "tool" && entityData?.name && this.isRandomId(id)) {
236301
- baseName = this.nameToFileName(entityData.name);
236302
- } else {
236303
- baseName = this.idToFileName(id);
236304
- }
236305
- return baseName;
236306
- }
236307
- /**
236308
- * Convert name to kebab-case filename
236309
- */
236310
- nameToFileName(name) {
236311
- return name.replace(/[^\w\s-]/g, "").trim().replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
236312
- }
236313
- /**
236314
- * Convert ID to kebab-case filename
236315
- */
236316
- idToFileName(id) {
236317
- return id.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
236318
- }
236319
- /**
236320
- * Get appropriate suffix for entity type
236321
- */
236322
- getSuffixForType(entityType) {
236323
- switch (entityType) {
236324
- case "project":
236325
- return this.conventions.projectSuffix;
236326
- case "agent":
236327
- return this.conventions.agentSuffix;
236328
- case "subAgent":
236329
- return this.conventions.subAgentSuffix;
236330
- case "tool":
236331
- return this.conventions.toolSuffix || "";
236332
- case "dataComponent":
236333
- return this.conventions.dataComponentSuffix || "";
236334
- case "artifactComponent":
236335
- return this.conventions.artifactComponentSuffix || "";
236336
- case "statusComponent":
236337
- return this.conventions.statusComponentSuffix || "";
236338
- case "credential":
236339
- return this.conventions.credentialSuffix || "";
236340
- case "environment":
236341
- return this.conventions.environmentSuffix || "";
236342
- default:
236343
- return "";
236344
- }
236345
- }
236346
- /**
236347
- * Get the appropriate registry map for an entity type
236348
- */
236349
- getRegistryMap(entityType) {
236350
- switch (entityType) {
236351
- case "project":
236352
- return this.registry.projects;
236353
- case "agent":
236354
- return this.registry.agents;
236355
- case "subAgent":
236356
- return this.registry.subAgents;
236357
- case "tool":
236358
- return this.registry.tools;
236359
- case "dataComponent":
236360
- return this.registry.dataComponents;
236361
- case "artifactComponent":
236362
- return this.registry.artifactComponents;
236363
- case "statusComponent":
236364
- return this.registry.statusComponents;
236365
- case "credential":
236366
- return this.registry.credentials;
236367
- case "environment":
236368
- return this.registry.environments;
236369
- default:
236370
- throw new Error(`Unknown entity type: ${entityType}`);
236371
- }
236372
- }
236373
- };
236374
- }
236375
- });
236376
-
236377
236594
  // src/codegen/pattern-analyzer.ts
236378
236595
  var pattern_analyzer_exports = {};
236379
236596
  __export(pattern_analyzer_exports, {
@@ -236410,6 +236627,7 @@ function analyzeFileStructure(projectDir) {
236410
236627
  const hasDataComponentsDirectory = existsSync7(join8(projectDir, "data-components"));
236411
236628
  const hasArtifactComponentsDirectory = existsSync7(join8(projectDir, "artifact-components"));
236412
236629
  const hasEnvironmentsDirectory = existsSync7(join8(projectDir, "environments"));
236630
+ const hasExternalAgentsDirectory = existsSync7(join8(projectDir, "external-agents"));
236413
236631
  let toolsLocation = "unknown";
236414
236632
  if (hasToolsDirectory) {
236415
236633
  toolsLocation = "separate";
@@ -236436,7 +236654,8 @@ function analyzeFileStructure(projectDir) {
236436
236654
  hasAgentsDirectory,
236437
236655
  hasDataComponentsDirectory,
236438
236656
  hasArtifactComponentsDirectory,
236439
- hasEnvironmentsDirectory
236657
+ hasEnvironmentsDirectory,
236658
+ hasExternalAgentsDirectory
236440
236659
  };
236441
236660
  }
236442
236661
  function detectFileNamingConvention(files) {
@@ -236519,13 +236738,14 @@ function extractVariableMappings(code, filePath) {
236519
236738
  "tool",
236520
236739
  "tool",
236521
236740
  "dataComponent",
236522
- "artifactComponent"
236741
+ "artifactComponent",
236742
+ "externalAgent"
236523
236743
  ];
236524
236744
  patterns.forEach((pattern, index2) => {
236525
236745
  const matches = code.matchAll(pattern);
236526
- for (const match of matches) {
236527
- const variableName = match[1];
236528
- const id = match[2] || match[3];
236746
+ for (const match2 of matches) {
236747
+ const variableName = match2[1];
236748
+ const id = match2[2] || match2[3];
236529
236749
  if (variableName && id) {
236530
236750
  mappings.push({
236531
236751
  id,
@@ -236613,9 +236833,9 @@ function mostCommon(arr) {
236613
236833
  }
236614
236834
  let maxCount = 0;
236615
236835
  let mostCommonItem = null;
236616
- for (const [item, count16] of counts.entries()) {
236617
- if (count16 > maxCount) {
236618
- maxCount = count16;
236836
+ for (const [item, count17] of counts.entries()) {
236837
+ if (count17 > maxCount) {
236838
+ maxCount = count17;
236619
236839
  mostCommonItem = item;
236620
236840
  }
236621
236841
  }
@@ -236681,6 +236901,7 @@ function displayPlanSummary(plan) {
236681
236901
  dataComponent: [],
236682
236902
  artifactComponent: [],
236683
236903
  statusComponent: [],
236904
+ externalAgent: [],
236684
236905
  environment: []
236685
236906
  };
236686
236907
  for (const file of plan.files) {
@@ -236715,6 +236936,12 @@ function displayPlanSummary(plan) {
236715
236936
  }
236716
236937
  }
236717
236938
  }
236939
+ if (filesByType.externalAgent.length > 0) {
236940
+ console.log(chalk8.gray("\n External Agents:"));
236941
+ for (const file of filesByType.externalAgent) {
236942
+ console.log(chalk8.gray(` \u2022 ${file.path}`));
236943
+ }
236944
+ }
236718
236945
  if (filesByType.dataComponent.length > 0) {
236719
236946
  console.log(chalk8.gray("\n Data Components:"));
236720
236947
  for (const file of filesByType.dataComponent) {
@@ -236877,7 +237104,12 @@ async function generatePlan(projectData, patterns, modelSettings, createModel2,
236877
237104
  fileNameMappings.set(entity.id, fileName);
236878
237105
  }
236879
237106
  const model = createModel2(modelSettings);
236880
- const promptTemplate = createPlanningPromptTemplate(nameGenerator.getRegistry(), allEntities, fileNameMappings, targetEnvironment);
237107
+ const promptTemplate = createPlanningPromptTemplate(
237108
+ nameGenerator.getRegistry(),
237109
+ allEntities,
237110
+ fileNameMappings,
237111
+ targetEnvironment
237112
+ );
236881
237113
  const promptData = {
236882
237114
  projectData,
236883
237115
  patterns
@@ -236931,7 +237163,7 @@ CRITICAL RULES:
236931
237163
  1. TOOL TYPES - VERY IMPORTANT:
236932
237164
  - **Function Tools** (type: "function"): ALWAYS define INLINE within agent files using "inlineContent" array
236933
237165
  - **MCP Tools** (type: "mcp"): Create separate files in tools/ directory
236934
- - VALID FILE TYPES: Only use these exact types: "agent", "tool", "dataComponent", "artifactComponent", "statusComponent", "environment", "index"
237166
+ - VALID FILE TYPES: Only use these exact types: "agent", "tool", "dataComponent", "artifactComponent", "externalAgent", "statusComponent", "environment", "index"
236935
237167
  - NEVER create file type "functionTool" - function tools go in "inlineContent" of agent files
236936
237168
 
236937
237169
  2. STATUS COMPONENTS - VERY IMPORTANT:
@@ -236964,6 +237196,7 @@ CRITICAL RULES:
236964
237196
  - data-components/ directory: Data component files
236965
237197
  - artifact-components/ directory: Artifact component files
236966
237198
  - status-components/ directory: Status component files
237199
+ - external-agents/ directory: External agent files
236967
237200
  - environments/ directory: Environment/credential files
236968
237201
  - index.ts: Main project file
236969
237202
 
@@ -237004,6 +237237,11 @@ OUTPUT FORMAT (JSON):
237004
237237
  "fromPath": "../tools/weather-api",
237005
237238
  "entityType": "tool"
237006
237239
  }
237240
+ {
237241
+ "variableName": "externalHelper",
237242
+ "fromPath": "../external-agents/external-helper",
237243
+ "entityType": "externalAgent"
237244
+ }
237007
237245
  ],
237008
237246
  "inlineContent": [
237009
237247
  {
@@ -237028,6 +237266,20 @@ OUTPUT FORMAT (JSON):
237028
237266
  "dependencies": [],
237029
237267
  "inlineContent": null
237030
237268
  },
237269
+ {
237270
+ "path": "external-agents/external-helper.ts",
237271
+ "type": "externalAgent",
237272
+ "entities": [
237273
+ {
237274
+ "id": "external-helper",
237275
+ "variableName": "externalHelper",
237276
+ "entityType": "externalAgent",
237277
+ "exportName": "externalHelper"
237278
+ }
237279
+ ],
237280
+ "dependencies": [],
237281
+ "inlineContent": null
237282
+ },
237031
237283
  {
237032
237284
  "path": "status-components/tool-summary.ts",
237033
237285
  "type": "statusComponent",
@@ -237115,6 +237367,7 @@ function formatVariableMappings(registry2, allEntities) {
237115
237367
  dataComponent: [],
237116
237368
  artifactComponent: [],
237117
237369
  statusComponent: [],
237370
+ externalAgent: [],
237118
237371
  credential: [],
237119
237372
  environment: []
237120
237373
  };
@@ -237149,6 +237402,7 @@ function formatFileNameMappings(fileNameMappings, allEntities) {
237149
237402
  artifactComponent: [],
237150
237403
  statusComponent: [],
237151
237404
  credential: [],
237405
+ externalAgent: [],
237152
237406
  environment: []
237153
237407
  };
237154
237408
  for (const entity of allEntities) {
@@ -237196,6 +237450,8 @@ function getRegistryMap(registry2, entityType) {
237196
237450
  return registry2.artifactComponents;
237197
237451
  case "statusComponent":
237198
237452
  return registry2.statusComponents;
237453
+ case "externalAgent":
237454
+ return registry2.externalAgents;
237199
237455
  case "credential":
237200
237456
  return registry2.credentials;
237201
237457
  case "environment":
@@ -237354,6 +237610,9 @@ async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, deb
237354
237610
  case "statusComponent":
237355
237611
  batchType = "status_component";
237356
237612
  break;
237613
+ case "externalAgent":
237614
+ batchType = "external_agent";
237615
+ break;
237357
237616
  default:
237358
237617
  throw new Error(`Unknown file type for batch generation: ${fileInfo.type}`);
237359
237618
  }
@@ -237373,7 +237632,9 @@ async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, deb
237373
237632
  await generateAllFilesInBatch(fileSpecs, modelSettings, debug, reasoningConfig);
237374
237633
  }
237375
237634
  if (debug && environmentFiles.length > 0) {
237376
- console.log(`[DEBUG] Generating ${environmentFiles.length} environment files using templates (no LLM)...`);
237635
+ console.log(
237636
+ `[DEBUG] Generating ${environmentFiles.length} environment files using templates (no LLM)...`
237637
+ );
237377
237638
  }
237378
237639
  for (const envFile of environmentFiles) {
237379
237640
  const envStartTime = Date.now();
@@ -237419,6 +237680,13 @@ function extractDataForFile(fileInfo, projectData) {
237419
237680
  }
237420
237681
  return {};
237421
237682
  }
237683
+ case "externalAgent": {
237684
+ const agentId = fileInfo.entities[0]?.id;
237685
+ if (agentId && projectData.externalAgents) {
237686
+ return projectData.externalAgents[agentId];
237687
+ }
237688
+ return {};
237689
+ }
237422
237690
  case "dataComponent": {
237423
237691
  const compId = fileInfo.entities[0]?.id;
237424
237692
  if (compId && projectData.dataComponents) {
@@ -237555,7 +237823,9 @@ function extractDataForFile(fileInfo, projectData) {
237555
237823
  }
237556
237824
  }
237557
237825
  if (subAgent.contextConfig?.contextVariables) {
237558
- for (const [varId, varData] of Object.entries(subAgent.contextConfig.contextVariables)) {
237826
+ for (const [varId, varData] of Object.entries(
237827
+ subAgent.contextConfig.contextVariables
237828
+ )) {
237559
237829
  const contextVar = varData;
237560
237830
  if (contextVar.credentialReferenceId) {
237561
237831
  const credId = contextVar.credentialReferenceId;
@@ -237825,9 +238095,10 @@ import { Command } from "commander";
237825
238095
  // src/commands/add.ts
237826
238096
  init_esm_shims();
237827
238097
  init_src();
238098
+ import * as p2 from "@clack/prompts";
237828
238099
  import chalk from "chalk";
238100
+ import { findUp } from "find-up";
237829
238101
  import fs3 from "fs-extra";
237830
- import * as p2 from "@clack/prompts";
237831
238102
 
237832
238103
  // src/utils/templates.ts
237833
238104
  init_esm_shims();
@@ -237844,6 +238115,7 @@ async function cloneTemplate(templatePath, targetPath, replacements) {
237844
238115
  await replaceContentInFiles(targetPath, replacements);
237845
238116
  }
237846
238117
  } catch (_error) {
238118
+ console.log(`\u274C Error cloning template: ${_error}`);
237847
238119
  process.exit(1);
237848
238120
  }
237849
238121
  }
@@ -238001,9 +238273,9 @@ function injectPropertyIntoObject(content, propertyPath, replacement) {
238001
238273
  console.warn(`Could not inject property "${propertyPath}" - no suitable object found in content`);
238002
238274
  return content;
238003
238275
  }
238004
- async function getAvailableTemplates() {
238276
+ async function getAvailableTemplates(templatePath = "template-projects") {
238005
238277
  const response = await fetch(
238006
- "https://api.github.com/repos/inkeep/agents-cookbook/contents/template-projects"
238278
+ `https://api.github.com/repos/inkeep/agents-cookbook/contents/${templatePath}`
238007
238279
  );
238008
238280
  const contents = await response.json();
238009
238281
  return contents.filter((item) => item.type === "dir").map((item) => item.name);
@@ -238044,21 +238316,55 @@ var defaultAnthropicModelConfigurations = {
238044
238316
  }
238045
238317
  };
238046
238318
  async function addCommand(options) {
238319
+ const projectTemplates = await getAvailableTemplates("template-projects");
238320
+ const mcpTemplates = await getAvailableTemplates("template-mcps");
238321
+ if (!options.project && !options.mcp) {
238322
+ console.log(chalk.yellow("Available project templates:"));
238323
+ for (const template of projectTemplates) {
238324
+ console.log(chalk.gray(` \u2022 ${template}`));
238325
+ }
238326
+ console.log(chalk.yellow("Available MCP templates:"));
238327
+ for (const template of mcpTemplates) {
238328
+ console.log(chalk.gray(` \u2022 ${template}`));
238329
+ }
238330
+ process.exit(0);
238331
+ } else {
238332
+ if (options.project && !projectTemplates.includes(options.project)) {
238333
+ console.error(`\u274C Project template "${options.project}" not found`);
238334
+ process.exit(1);
238335
+ }
238336
+ if (options.mcp && !mcpTemplates.includes(options.mcp)) {
238337
+ console.error(`\u274C MCP template "${options.mcp}" not found`);
238338
+ process.exit(1);
238339
+ }
238340
+ const s2 = p2.spinner();
238341
+ s2.start("Adding template...");
238342
+ if (options.project) {
238343
+ await addProjectTemplate(options.project, options.targetPath);
238344
+ s2.stop(`Project template "${options.project}" added to ${options.targetPath}`);
238345
+ }
238346
+ if (options.mcp) {
238347
+ await addMcpTemplate(options.mcp, options.targetPath, s2);
238348
+ }
238349
+ return;
238350
+ }
238351
+ }
238352
+ async function addProjectTemplate(template, targetPath) {
238047
238353
  const templates = await getAvailableTemplates();
238048
- if (!options.template) {
238354
+ if (!template) {
238049
238355
  console.log(chalk.yellow("Available templates:"));
238050
- for (const template of templates) {
238051
- console.log(chalk.gray(` \u2022 ${template}`));
238356
+ for (const template2 of templates) {
238357
+ console.log(chalk.gray(` \u2022 ${template2}`));
238052
238358
  }
238053
238359
  process.exit(0);
238054
238360
  } else {
238055
- if (!templates.includes(options.template)) {
238056
- console.error(`\u274C Template "${options.template}" not found`);
238361
+ if (!templates.includes(template)) {
238362
+ console.error(`\u274C Template "${template}" not found`);
238057
238363
  process.exit(1);
238058
238364
  }
238059
238365
  const anthropicKey = process.env.ANTHROPIC_API_KEY;
238060
238366
  const openAiKey = process.env.OPENAI_API_KEY;
238061
- const googleKey = process.env.GOOGLE_API_KEY;
238367
+ const googleKey = process.env.GOOGLE_GENERATIVE_AI_API_KEY;
238062
238368
  let defaultModelSettings = {};
238063
238369
  if (anthropicKey) {
238064
238370
  defaultModelSettings = defaultAnthropicModelConfigurations;
@@ -238080,13 +238386,13 @@ async function addCommand(options) {
238080
238386
  "\u274C No AI provider key found in environment variables. Please set one of: ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_GENERATIVE_AI_API_KEY"
238081
238387
  );
238082
238388
  }
238083
- const baseDir = options.targetPath || process.cwd();
238084
- const templateDir = `${baseDir}/${options.template}`;
238389
+ const baseDir = targetPath || process.cwd();
238390
+ const templateDir = `${baseDir}/${template}`;
238085
238391
  if (await fs3.pathExists(templateDir)) {
238086
238392
  console.error(`\u274C Directory "${templateDir}" already exists`);
238087
238393
  process.exit(1);
238088
238394
  }
238089
- if (options.targetPath && !await fs3.pathExists(baseDir)) {
238395
+ if (targetPath && !await fs3.pathExists(baseDir)) {
238090
238396
  try {
238091
238397
  await fs3.mkdir(baseDir, { recursive: true });
238092
238398
  } catch (error) {
@@ -238098,12 +238404,44 @@ async function addCommand(options) {
238098
238404
  }
238099
238405
  const s2 = p2.spinner();
238100
238406
  s2.start("Adding template...");
238101
- const fullTemplatePath = `https://github.com/inkeep/agents-cookbook/template-projects/${options.template}`;
238407
+ const fullTemplatePath = `https://github.com/inkeep/agents-cookbook/template-projects/${template}`;
238102
238408
  await cloneTemplate(fullTemplatePath, templateDir, contentReplacements);
238103
- s2.stop(`Template "${options.template}" added to ${templateDir}`);
238409
+ s2.stop(`Template "${template}" added to ${templateDir}`);
238104
238410
  return;
238105
238411
  }
238106
238412
  }
238413
+ async function addMcpTemplate(template, targetPath, s2) {
238414
+ const templates = await getAvailableTemplates("template-mcps");
238415
+ if (!template) {
238416
+ console.log(chalk.yellow("Available templates:"));
238417
+ for (const template2 of templates) {
238418
+ console.log(chalk.gray(` \u2022 ${template2}`));
238419
+ }
238420
+ process.exit(0);
238421
+ }
238422
+ if (!targetPath) {
238423
+ const foundPath = await findAppDirectory();
238424
+ targetPath = `${foundPath}/${template}`;
238425
+ }
238426
+ const fullTemplatePath = `https://github.com/inkeep/agents-cookbook/template-mcps/${template}`;
238427
+ await cloneTemplate(fullTemplatePath, targetPath);
238428
+ s2.stop(`MCP template "${template}" added to ${targetPath}`);
238429
+ }
238430
+ async function findAppDirectory() {
238431
+ const appDirectory = await findUp("apps/mcp/app", { type: "directory" });
238432
+ if (!appDirectory || !appDirectory.includes("apps/mcp/app")) {
238433
+ console.log(chalk.yellow(`\u26A0\uFE0F No app directory found.`));
238434
+ const continueAnyway = await p2.confirm({
238435
+ message: `Do you want to add to ${process.cwd()} instead?`
238436
+ });
238437
+ if (!continueAnyway) {
238438
+ p2.cancel("Operation cancelled");
238439
+ process.exit(0);
238440
+ }
238441
+ return process.cwd();
238442
+ }
238443
+ return appDirectory;
238444
+ }
238107
238445
 
238108
238446
  // src/commands/config.ts
238109
238447
  init_esm_shims();
@@ -238866,45 +239204,9 @@ ${table.toString()}`);
238866
239204
  init_esm_shims();
238867
239205
  import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync6 } from "fs";
238868
239206
  import { dirname as dirname5, join as join10, resolve as resolve4 } from "path";
238869
- import chalk9 from "chalk";
238870
239207
  import * as p7 from "@clack/prompts";
238871
- init_config();
238872
-
238873
- // src/utils/project-directory.ts
238874
- init_esm_shims();
238875
- import { existsSync as existsSync5 } from "fs";
238876
- import { join as join5, resolve as resolve3 } from "path";
238877
- import { findUp } from "find-up";
238878
- async function findProjectDirectory(projectId, configPath) {
238879
- if (configPath) {
238880
- const absoluteConfigPath = resolve3(process.cwd(), configPath);
238881
- if (existsSync5(absoluteConfigPath)) {
238882
- return resolve3(absoluteConfigPath, "..");
238883
- }
238884
- }
238885
- if (projectId) {
238886
- if (projectId.includes("/") || projectId.includes("\\")) {
238887
- const projectPath = resolve3(process.cwd(), projectId);
238888
- if (existsSync5(join5(projectPath, "inkeep.config.ts"))) {
238889
- return projectPath;
238890
- }
238891
- } else {
238892
- const projectPath = join5(process.cwd(), projectId);
238893
- if (existsSync5(join5(projectPath, "inkeep.config.ts"))) {
238894
- return projectPath;
238895
- }
238896
- }
238897
- return null;
238898
- }
238899
- const foundConfigPath = await findUp("inkeep.config.ts");
238900
- if (foundConfigPath) {
238901
- return resolve3(foundConfigPath, "..");
238902
- }
238903
- return null;
238904
- }
238905
-
238906
- // src/commands/pull.ts
238907
- init_tsx_loader();
239208
+ import chalk9 from "chalk";
239209
+ init_variable_name_registry();
238908
239210
 
238909
239211
  // src/utils/background-version-check.ts
238910
239212
  init_esm_shims();
@@ -238912,16 +239214,16 @@ import chalk7 from "chalk";
238912
239214
 
238913
239215
  // src/utils/version-check.ts
238914
239216
  init_esm_shims();
238915
- import { existsSync as existsSync6, readFileSync as readFileSync2 } from "fs";
238916
- import { dirname as dirname4, join as join6 } from "path";
239217
+ import { existsSync as existsSync5, readFileSync as readFileSync2 } from "fs";
239218
+ import { dirname as dirname4, join as join5 } from "path";
238917
239219
  import { fileURLToPath as fileURLToPath2 } from "url";
238918
239220
  var __filename2 = fileURLToPath2(import.meta.url);
238919
239221
  var __dirname2 = dirname4(__filename2);
238920
239222
  var DEFAULT_PACKAGE_NAME = "@inkeep/agents-cli";
238921
239223
  function getCurrentVersion() {
238922
- let packageJsonPath2 = join6(__dirname2, "..", "package.json");
238923
- if (!existsSync6(packageJsonPath2)) {
238924
- packageJsonPath2 = join6(__dirname2, "..", "..", "package.json");
239224
+ let packageJsonPath2 = join5(__dirname2, "..", "package.json");
239225
+ if (!existsSync5(packageJsonPath2)) {
239226
+ packageJsonPath2 = join5(__dirname2, "..", "..", "package.json");
238925
239227
  }
238926
239228
  const packageJson2 = JSON.parse(readFileSync2(packageJsonPath2, "utf-8"));
238927
239229
  return packageJson2.version;
@@ -238993,8 +239295,43 @@ function performBackgroundVersionCheck() {
238993
239295
  }
238994
239296
 
238995
239297
  // src/commands/pull.ts
238996
- init_pull_llm_generate();
238997
- init_variable_name_registry();
239298
+ init_config();
239299
+
239300
+ // src/utils/project-directory.ts
239301
+ init_esm_shims();
239302
+ import { existsSync as existsSync6 } from "fs";
239303
+ import { join as join6, resolve as resolve3 } from "path";
239304
+ import { findUp as findUp2 } from "find-up";
239305
+ async function findProjectDirectory(projectId, configPath) {
239306
+ if (configPath) {
239307
+ const absoluteConfigPath = resolve3(process.cwd(), configPath);
239308
+ if (existsSync6(absoluteConfigPath)) {
239309
+ return resolve3(absoluteConfigPath, "..");
239310
+ }
239311
+ }
239312
+ if (projectId) {
239313
+ if (projectId.includes("/") || projectId.includes("\\")) {
239314
+ const projectPath = resolve3(process.cwd(), projectId);
239315
+ if (existsSync6(join6(projectPath, "inkeep.config.ts"))) {
239316
+ return projectPath;
239317
+ }
239318
+ } else {
239319
+ const projectPath = join6(process.cwd(), projectId);
239320
+ if (existsSync6(join6(projectPath, "inkeep.config.ts"))) {
239321
+ return projectPath;
239322
+ }
239323
+ }
239324
+ return null;
239325
+ }
239326
+ const foundConfigPath = await findUp2("inkeep.config.ts");
239327
+ if (foundConfigPath) {
239328
+ return resolve3(foundConfigPath, "..");
239329
+ }
239330
+ return null;
239331
+ }
239332
+
239333
+ // src/commands/pull.ts
239334
+ init_tsx_loader();
238998
239335
  async function detectCurrentProject(debug = false) {
238999
239336
  const indexPath = join10(process.cwd(), "index.ts");
239000
239337
  if (debug) {
@@ -239214,6 +239551,7 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
239214
239551
  const artifactComponentsDir = join10(projectRoot, "artifact-components");
239215
239552
  const statusComponentsDir = join10(projectRoot, "status-components");
239216
239553
  const environmentsDir = join10(projectRoot, "environments");
239554
+ const externalAgentsDir = join10(projectRoot, "external-agents");
239217
239555
  ensureDirectoryExists(projectRoot);
239218
239556
  ensureDirectoryExists(agentsDir);
239219
239557
  ensureDirectoryExists(toolsDir);
@@ -239221,6 +239559,7 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
239221
239559
  ensureDirectoryExists(artifactComponentsDir);
239222
239560
  ensureDirectoryExists(statusComponentsDir);
239223
239561
  ensureDirectoryExists(environmentsDir);
239562
+ ensureDirectoryExists(externalAgentsDir);
239224
239563
  return {
239225
239564
  projectRoot,
239226
239565
  agentsDir,
@@ -239228,7 +239567,8 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
239228
239567
  dataComponentsDir,
239229
239568
  artifactComponentsDir,
239230
239569
  statusComponentsDir,
239231
- environmentsDir
239570
+ environmentsDir,
239571
+ externalAgentsDir
239232
239572
  };
239233
239573
  }
239234
239574
  async function pullProjectCommand(options) {
@@ -239237,12 +239577,14 @@ async function pullProjectCommand(options) {
239237
239577
  try {
239238
239578
  const { detectAvailableProvider: detectAvailableProvider2 } = await Promise.resolve().then(() => (init_pull_llm_generate(), pull_llm_generate_exports));
239239
239579
  provider = detectAvailableProvider2();
239240
- console.log(chalk9.gray(`
239241
- \u{1F916} Using ${provider.charAt(0).toUpperCase() + provider.slice(1)} for code generation`));
239242
- } catch (error) {
239243
- console.error(
239244
- chalk9.red("\n\u274C Error: No LLM provider API key found")
239580
+ console.log(
239581
+ chalk9.gray(
239582
+ `
239583
+ \u{1F916} Using ${provider.charAt(0).toUpperCase() + provider.slice(1)} for code generation`
239584
+ )
239245
239585
  );
239586
+ } catch (error) {
239587
+ console.error(chalk9.red("\n\u274C Error: No LLM provider API key found"));
239246
239588
  console.error(
239247
239589
  chalk9.yellow(
239248
239590
  "\nThe pull command requires AI to generate TypeScript files from your project configuration."
@@ -239309,8 +239651,8 @@ async function pullProjectCommand(options) {
239309
239651
  }
239310
239652
  }
239311
239653
  if (!configFound) {
239312
- const { findUp: findUp2 } = await import("find-up");
239313
- const foundConfigPath = await findUp2("inkeep.config.ts", { cwd: searchDir });
239654
+ const { findUp: findUp3 } = await import("find-up");
239655
+ const foundConfigPath = await findUp3("inkeep.config.ts", { cwd: searchDir });
239314
239656
  if (foundConfigPath) {
239315
239657
  try {
239316
239658
  config = await loadProjectConfig(dirname5(foundConfigPath));
@@ -239426,6 +239768,13 @@ async function pullProjectCommand(options) {
239426
239768
  const statusComponents = agentObj.statusUpdates?.statusComponents || [];
239427
239769
  return total + statusComponents.length;
239428
239770
  }, 0);
239771
+ const externalAgentCount = Object.keys(projectData.externalAgents || {}).reduce(
239772
+ (total, agent) => {
239773
+ const agentObj = agent;
239774
+ return total + Object.keys(agentObj.subAgents || {}).length;
239775
+ },
239776
+ 0
239777
+ );
239429
239778
  console.log(chalk9.cyan("\n\u{1F4CA} Project Summary:"));
239430
239779
  console.log(chalk9.gray(` \u2022 Name: ${projectData.name}`));
239431
239780
  console.log(chalk9.gray(` \u2022 Description: ${projectData.description || "No description"}`));
@@ -239441,6 +239790,9 @@ async function pullProjectCommand(options) {
239441
239790
  if (statusComponentCount > 0) {
239442
239791
  console.log(chalk9.gray(` \u2022 Status Components: ${statusComponentCount}`));
239443
239792
  }
239793
+ if (externalAgentCount > 0) {
239794
+ console.log(chalk9.gray(` \u2022 External Agents: ${externalAgentCount}`));
239795
+ }
239444
239796
  const credentialReferences2 = projectData.credentialReferences || {};
239445
239797
  const credentialCount = Object.keys(credentialReferences2).length;
239446
239798
  if (credentialCount > 0) {
@@ -239456,7 +239808,7 @@ async function pullProjectCommand(options) {
239456
239808
  for (const usage of usageInfo) {
239457
239809
  usageByType[usage.type] = (usageByType[usage.type] || 0) + 1;
239458
239810
  }
239459
- const usageSummary = Object.entries(usageByType).map(([type, count16]) => `${count16} ${type}${count16 > 1 ? "s" : ""}`).join(", ");
239811
+ const usageSummary = Object.entries(usageByType).map(([type, count17]) => `${count17} ${type}${count17 > 1 ? "s" : ""}`).join(", ");
239460
239812
  console.log(chalk9.gray(` Used by: ${usageSummary}`));
239461
239813
  }
239462
239814
  }
@@ -239496,6 +239848,7 @@ async function pullProjectCommand(options) {
239496
239848
  hasAgentsDirectory: true,
239497
239849
  hasDataComponentsDirectory: true,
239498
239850
  hasArtifactComponentsDirectory: true,
239851
+ hasExternalAgentsDirectory: true,
239499
239852
  hasEnvironmentsDirectory: true
239500
239853
  },
239501
239854
  namingConventions: DEFAULT_NAMING_CONVENTIONS2,
@@ -239525,10 +239878,20 @@ async function pullProjectCommand(options) {
239525
239878
  if (options.debug) {
239526
239879
  console.log(chalk9.gray(`
239527
239880
  \u{1F4CD} Debug: Model selected: ${selectedModel}`));
239528
- console.log(chalk9.gray(`\u{1F4CD} Debug: Reasoning enabled: ${Object.keys(reasoningConfig).length > 0 ? "Yes" : "No"}`));
239881
+ console.log(
239882
+ chalk9.gray(
239883
+ `\u{1F4CD} Debug: Reasoning enabled: ${Object.keys(reasoningConfig).length > 0 ? "Yes" : "No"}`
239884
+ )
239885
+ );
239529
239886
  }
239530
239887
  const targetEnvironment = options.env || "development";
239531
- const plan = await generatePlan2(projectData, patterns, modelSettings, createModel2, targetEnvironment);
239888
+ const plan = await generatePlan2(
239889
+ projectData,
239890
+ patterns,
239891
+ modelSettings,
239892
+ createModel2,
239893
+ targetEnvironment
239894
+ );
239532
239895
  s2.stop("Generation plan created");
239533
239896
  const { displayPlanSummary: displayPlanSummary2, displayConflictWarning: displayConflictWarning2 } = await Promise.resolve().then(() => (init_display_utils(), display_utils_exports));
239534
239897
  displayPlanSummary2(plan);
@@ -239565,9 +239928,10 @@ async function pullProjectCommand(options) {
239565
239928
  tools: Object.keys(projectData.tools || {}).length,
239566
239929
  dataComponents: Object.keys(projectData.dataComponents || {}).length,
239567
239930
  artifactComponents: Object.keys(projectData.artifactComponents || {}).length,
239931
+ externalAgents: Object.keys(projectData.externalAgents || {}).length,
239568
239932
  statusComponents: statusComponentsCount
239569
239933
  };
239570
- const totalFiles = fileCount.agents + fileCount.tools + fileCount.dataComponents + fileCount.artifactComponents + fileCount.statusComponents + 5;
239934
+ const totalFiles = fileCount.agents + fileCount.tools + fileCount.dataComponents + fileCount.artifactComponents + fileCount.externalAgents + fileCount.statusComponents + 5;
239571
239935
  s2.stop(`Project files generated (${totalFiles} files created)`);
239572
239936
  s2.start("Verifying generated files...");
239573
239937
  try {
@@ -239618,6 +239982,9 @@ async function pullProjectCommand(options) {
239618
239982
  if (fileCount.tools > 0) {
239619
239983
  console.log(chalk9.gray(` \u251C\u2500\u2500 tools/ (${fileCount.tools} files)`));
239620
239984
  }
239985
+ if (fileCount.externalAgents > 0) {
239986
+ console.log(chalk9.gray(` \u251C\u2500\u2500 external-agents/ (${fileCount.externalAgents} files)`));
239987
+ }
239621
239988
  if (fileCount.dataComponents > 0) {
239622
239989
  console.log(chalk9.gray(` \u251C\u2500\u2500 data-components/ (${fileCount.dataComponents} files)`));
239623
239990
  }
@@ -239846,7 +240213,7 @@ async function pushCommand(options) {
239846
240213
  for (const usage of usageInfo) {
239847
240214
  usageByType[usage.type] = (usageByType[usage.type] || 0) + 1;
239848
240215
  }
239849
- const usageSummary = Object.entries(usageByType).map(([type, count16]) => `${count16} ${type}${count16 > 1 ? "s" : ""}`).join(", ");
240216
+ const usageSummary = Object.entries(usageByType).map(([type, count17]) => `${count17} ${type}${count17 > 1 ? "s" : ""}`).join(", ");
239850
240217
  console.log(chalk10.gray(` Used by: ${usageSummary}`));
239851
240218
  }
239852
240219
  }
@@ -239990,11 +240357,11 @@ async function updateCommand(options = {}) {
239990
240357
  \u{1F50D} Detected package manager: ${chalk11.cyan(packageManager)}`));
239991
240358
  }
239992
240359
  if (!options.force) {
239993
- const confirm3 = await p9.confirm({
240360
+ const confirm4 = await p9.confirm({
239994
240361
  message: `Update @inkeep/agents-cli from ${versionInfo.current} to ${versionInfo.latest}?`,
239995
240362
  initialValue: true
239996
240363
  });
239997
- if (p9.isCancel(confirm3) || !confirm3) {
240364
+ if (p9.isCancel(confirm4) || !confirm4) {
239998
240365
  p9.cancel("Update cancelled");
239999
240366
  process.exit(1);
240000
240367
  }
@@ -240023,7 +240390,7 @@ var packageJsonPath = join13(__dirname3, "..", "package.json");
240023
240390
  var packageJson = JSON.parse(readFileSync7(packageJsonPath, "utf-8"));
240024
240391
  var program = new Command();
240025
240392
  program.name("inkeep").description("CLI tool for Inkeep Agent Framework").version(packageJson.version);
240026
- 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) => {
240393
+ program.command("add [template]").description("Add a new template to the project").option("--project <template>", "Project template to add").option("--mcp <template>", "MCP template to add").option("--target-path <path>", "Target path to add the template to").option("--config <path>", "Path to configuration file").action(async (template, options) => {
240027
240394
  await addCommand({ template, ...options });
240028
240395
  });
240029
240396
  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 (path4, options) => {