@inkeep/agents-cli 0.24.2 → 0.26.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 +1073 -786
  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(),
@@ -4956,16 +5050,16 @@ var require_util = __commonJS({
4956
5050
  var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
4957
5051
  var dataUrlRegexp = /^data:.+\,.+$/;
4958
5052
  function urlParse(aUrl) {
4959
- var match = aUrl.match(urlRegexp);
4960
- if (!match) {
5053
+ var match2 = aUrl.match(urlRegexp);
5054
+ if (!match2) {
4961
5055
  return null;
4962
5056
  }
4963
5057
  return {
4964
- scheme: match[1],
4965
- auth: match[2],
4966
- host: match[3],
4967
- port: match[4],
4968
- path: match[5]
5058
+ scheme: match2[1],
5059
+ auth: match2[2],
5060
+ host: match2[3],
5061
+ port: match2[4],
5062
+ path: match2[5]
4969
5063
  };
4970
5064
  }
4971
5065
  exports.urlParse = urlParse;
@@ -6763,8 +6857,8 @@ var require_source_map_support = __commonJS({
6763
6857
  function supportRelativeURL(file, url) {
6764
6858
  if (!file) return url;
6765
6859
  var dir = path4.dirname(file);
6766
- var match = /^\w+:\/\/[^\/]*/.exec(dir);
6767
- var protocol = match ? match[0] : "";
6860
+ var match2 = /^\w+:\/\/[^\/]*/.exec(dir);
6861
+ var protocol = match2 ? match2[0] : "";
6768
6862
  var startPath = dir.slice(protocol.length);
6769
6863
  if (protocol && /^\/\w\:/.test(startPath)) {
6770
6864
  protocol += "/";
@@ -6789,8 +6883,8 @@ var require_source_map_support = __commonJS({
6789
6883
  }
6790
6884
  fileData = retrieveFile(source);
6791
6885
  var re2 = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
6792
- var lastMatch, match;
6793
- while (match = re2.exec(fileData)) lastMatch = match;
6886
+ var lastMatch, match2;
6887
+ while (match2 = re2.exec(fileData)) lastMatch = match2;
6794
6888
  if (!lastMatch) return null;
6795
6889
  return lastMatch[1];
6796
6890
  }
@@ -6853,18 +6947,18 @@ var require_source_map_support = __commonJS({
6853
6947
  return position;
6854
6948
  }
6855
6949
  function mapEvalOrigin(origin) {
6856
- var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
6857
- if (match) {
6950
+ var match2 = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
6951
+ if (match2) {
6858
6952
  var position = mapSourcePosition({
6859
- source: match[2],
6860
- line: +match[3],
6861
- column: match[4] - 1
6953
+ source: match2[2],
6954
+ line: +match2[3],
6955
+ column: match2[4] - 1
6862
6956
  });
6863
- 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) + ")";
6864
6958
  }
6865
- match = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
6866
- if (match) {
6867
- 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]) + ")";
6868
6962
  }
6869
6963
  return origin;
6870
6964
  }
@@ -7012,11 +7106,11 @@ var require_source_map_support = __commonJS({
7012
7106
  return errorString + processedStack.reverse().join("");
7013
7107
  }
7014
7108
  function getErrorSource(error) {
7015
- var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
7016
- if (match) {
7017
- var source = match[1];
7018
- var line = +match[2];
7019
- 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];
7020
7114
  var contents = fileContentsCache[source];
7021
7115
  if (!contents && fs5 && fs5.existsSync(source)) {
7022
7116
  try {
@@ -7147,11 +7241,11 @@ var require_typescript = __commonJS({
7147
7241
  for (var name in all)
7148
7242
  __defProp2(target, name, { get: all[name], enumerable: true });
7149
7243
  };
7150
- var __copyProps2 = (to, from, except, desc15) => {
7244
+ var __copyProps2 = (to, from, except, desc16) => {
7151
7245
  if (from && typeof from === "object" || typeof from === "function") {
7152
7246
  for (let key of __getOwnPropNames2(from))
7153
7247
  if (!__hasOwnProp2.call(to, key) && key !== except)
7154
- __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 });
7155
7249
  }
7156
7250
  return to;
7157
7251
  };
@@ -7335,7 +7429,7 @@ var require_typescript = __commonJS({
7335
7429
  affectsEmitOptionDeclarations: () => affectsEmitOptionDeclarations,
7336
7430
  allKeysStartWithDot: () => allKeysStartWithDot,
7337
7431
  altDirectorySeparator: () => altDirectorySeparator,
7338
- and: () => and20,
7432
+ and: () => and21,
7339
7433
  append: () => append,
7340
7434
  appendIfUnique: () => appendIfUnique,
7341
7435
  arrayFrom: () => arrayFrom,
@@ -9557,16 +9651,16 @@ var require_typescript = __commonJS({
9557
9651
  return -1;
9558
9652
  }
9559
9653
  function countWhere(array, predicate) {
9560
- let count16 = 0;
9654
+ let count17 = 0;
9561
9655
  if (array !== void 0) {
9562
9656
  for (let i2 = 0; i2 < array.length; i2++) {
9563
9657
  const v2 = array[i2];
9564
9658
  if (predicate(v2, i2)) {
9565
- count16++;
9659
+ count17++;
9566
9660
  }
9567
9661
  }
9568
9662
  }
9569
- return count16;
9663
+ return count17;
9570
9664
  }
9571
9665
  function filter(array, f) {
9572
9666
  if (array !== void 0) {
@@ -10119,12 +10213,12 @@ var require_typescript = __commonJS({
10119
10213
  }
10120
10214
  return ~low;
10121
10215
  }
10122
- function reduceLeft(array, f, initial, start, count16) {
10216
+ function reduceLeft(array, f, initial, start, count17) {
10123
10217
  if (array && array.length > 0) {
10124
10218
  const size = array.length;
10125
10219
  if (size > 0) {
10126
10220
  let pos = start === void 0 || start < 0 ? 0 : start;
10127
- 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;
10128
10222
  let result;
10129
10223
  if (arguments.length <= 2) {
10130
10224
  result = array[pos];
@@ -10176,9 +10270,9 @@ var require_typescript = __commonJS({
10176
10270
  }
10177
10271
  return values;
10178
10272
  }
10179
- function arrayOf(count16, f) {
10180
- const result = new Array(count16);
10181
- 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++) {
10182
10276
  result[i2] = f(i2);
10183
10277
  }
10184
10278
  return result;
@@ -10786,7 +10880,7 @@ var require_typescript = __commonJS({
10786
10880
  function isPatternMatch({ prefix, suffix }, candidate) {
10787
10881
  return candidate.length >= prefix.length + suffix.length && startsWith(candidate, prefix) && endsWith(candidate, suffix);
10788
10882
  }
10789
- function and20(f, g) {
10883
+ function and21(f, g) {
10790
10884
  return (arg) => f(arg) && g(arg);
10791
10885
  }
10792
10886
  function or(...fs5) {
@@ -11124,8 +11218,8 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
11124
11218
  return func.name;
11125
11219
  } else {
11126
11220
  const text4 = Function.prototype.toString.call(func);
11127
- const match = /^function\s+([\w$]+)\s*\(/.exec(text4);
11128
- return match ? match[1] : "";
11221
+ const match2 = /^function\s+([\w$]+)\s*\(/.exec(text4);
11222
+ return match2 ? match2[1] : "";
11129
11223
  }
11130
11224
  }
11131
11225
  Debug2.getFunctionName = getFunctionName;
@@ -11989,9 +12083,9 @@ ${lanes.join("\n")}
11989
12083
  _Version.zero = new _Version(0, 0, 0, ["0"]);
11990
12084
  var Version = _Version;
11991
12085
  function tryParseComponents(text4) {
11992
- const match = versionRegExp.exec(text4);
11993
- if (!match) return void 0;
11994
- 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;
11995
12089
  if (prerelease && !prereleaseRegExp.test(prerelease)) return void 0;
11996
12090
  if (build2 && !buildRegExp.test(build2)) return void 0;
11997
12091
  return {
@@ -12060,13 +12154,13 @@ ${lanes.join("\n")}
12060
12154
  if (!range) continue;
12061
12155
  const comparators = [];
12062
12156
  range = range.trim();
12063
- const match = hyphenRegExp.exec(range);
12064
- if (match) {
12065
- 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;
12066
12160
  } else {
12067
12161
  for (const simple of range.split(whitespaceRegExp)) {
12068
- const match2 = rangeRegExp.exec(simple.trim());
12069
- 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;
12070
12164
  }
12071
12165
  }
12072
12166
  alternatives.push(comparators);
@@ -12074,9 +12168,9 @@ ${lanes.join("\n")}
12074
12168
  return alternatives;
12075
12169
  }
12076
12170
  function parsePartial(text4) {
12077
- const match = partialRegExp.exec(text4);
12078
- if (!match) return void 0;
12079
- 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;
12080
12174
  const version2 = new Version(
12081
12175
  isWildcard(major2) ? 0 : parseInt(major2, 10),
12082
12176
  isWildcard(major2) || isWildcard(minor) ? 0 : parseInt(minor, 10),
@@ -12293,8 +12387,8 @@ ${lanes.join("\n")}
12293
12387
  var durations = /* @__PURE__ */ new Map();
12294
12388
  function mark(markName) {
12295
12389
  if (enabled) {
12296
- const count16 = counts.get(markName) ?? 0;
12297
- counts.set(markName, count16 + 1);
12390
+ const count17 = counts.get(markName) ?? 0;
12391
+ counts.set(markName, count17 + 1);
12298
12392
  marks.set(markName, timestamp());
12299
12393
  performanceImpl == null ? void 0 : performanceImpl.mark(markName);
12300
12394
  if (typeof onProfilerEvent === "function") {
@@ -19542,9 +19636,9 @@ ${lanes.join("\n")}
19542
19636
  );
19543
19637
  }
19544
19638
  function getShebang(text4) {
19545
- const match = shebangTriviaRegex.exec(text4);
19546
- if (match) {
19547
- return match[0];
19639
+ const match2 = shebangTriviaRegex.exec(text4);
19640
+ if (match2) {
19641
+ return match2[0];
19548
19642
  }
19549
19643
  }
19550
19644
  function isIdentifierStart(ch, languageVersion) {
@@ -19805,20 +19899,20 @@ ${lanes.join("\n")}
19805
19899
  tokenValue = text4.substring(start2, pos);
19806
19900
  return isOctal;
19807
19901
  }
19808
- function scanExactNumberOfHexDigits(count16, canHaveSeparators) {
19902
+ function scanExactNumberOfHexDigits(count17, canHaveSeparators) {
19809
19903
  const valueString = scanHexDigits(
19810
19904
  /*minCount*/
19811
- count16,
19905
+ count17,
19812
19906
  /*scanAsManyAsPossible*/
19813
19907
  false,
19814
19908
  canHaveSeparators
19815
19909
  );
19816
19910
  return valueString ? parseInt(valueString, 16) : -1;
19817
19911
  }
19818
- function scanMinimumNumberOfHexDigits(count16, canHaveSeparators) {
19912
+ function scanMinimumNumberOfHexDigits(count17, canHaveSeparators) {
19819
19913
  return scanHexDigits(
19820
19914
  /*minCount*/
19821
- count16,
19915
+ count17,
19822
19916
  /*scanAsManyAsPossible*/
19823
19917
  true,
19824
19918
  canHaveSeparators
@@ -21812,11 +21906,11 @@ ${lanes.join("\n")}
21812
21906
  );
21813
21907
  }
21814
21908
  function getDirectiveFromComment(text22, commentDirectiveRegEx) {
21815
- const match = commentDirectiveRegEx.exec(text22);
21816
- if (!match) {
21909
+ const match2 = commentDirectiveRegEx.exec(text22);
21910
+ if (!match2) {
21817
21911
  return void 0;
21818
21912
  }
21819
- switch (match[1]) {
21913
+ switch (match2[1]) {
21820
21914
  case "ts-expect-error":
21821
21915
  return 0;
21822
21916
  case "ts-ignore":
@@ -29997,8 +30091,8 @@ ${lanes.join("\n")}
29997
30091
  function regExpEscape(text4) {
29998
30092
  return text4.replace(reservedCharacterPattern, escapeRegExpCharacter);
29999
30093
  }
30000
- function escapeRegExpCharacter(match) {
30001
- return "\\" + match;
30094
+ function escapeRegExpCharacter(match2) {
30095
+ return "\\" + match2;
30002
30096
  }
30003
30097
  var wildcardCharCodes = [
30004
30098
  42,
@@ -30020,7 +30114,7 @@ ${lanes.join("\n")}
30020
30114
  * files or directories, does not match subdirectories that start with a . character
30021
30115
  */
30022
30116
  doubleAsteriskRegexFragment: `(?:/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
30023
- replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment)
30117
+ replaceWildcardCharacter: (match2) => replaceWildcardCharacter(match2, filesMatcher.singleAsteriskRegexFragment)
30024
30118
  };
30025
30119
  var directoriesMatcher = {
30026
30120
  singleAsteriskRegexFragment: "[^/]*",
@@ -30029,12 +30123,12 @@ ${lanes.join("\n")}
30029
30123
  * files or directories, does not match subdirectories that start with a . character
30030
30124
  */
30031
30125
  doubleAsteriskRegexFragment: `(?:/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
30032
- replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment)
30126
+ replaceWildcardCharacter: (match2) => replaceWildcardCharacter(match2, directoriesMatcher.singleAsteriskRegexFragment)
30033
30127
  };
30034
30128
  var excludeMatcher = {
30035
30129
  singleAsteriskRegexFragment: "[^/]*",
30036
30130
  doubleAsteriskRegexFragment: "(?:/.+?)?",
30037
- replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment)
30131
+ replaceWildcardCharacter: (match2) => replaceWildcardCharacter(match2, excludeMatcher.singleAsteriskRegexFragment)
30038
30132
  };
30039
30133
  var wildcardMatchers = {
30040
30134
  files: filesMatcher,
@@ -30113,8 +30207,8 @@ ${lanes.join("\n")}
30113
30207
  }
30114
30208
  return subpattern;
30115
30209
  }
30116
- function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
30117
- return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
30210
+ function replaceWildcardCharacter(match2, singleAsteriskRegexFragment) {
30211
+ return match2 === "*" ? singleAsteriskRegexFragment : match2 === "?" ? "[^/]" : "\\" + match2;
30118
30212
  }
30119
30213
  function getFileMatcherPatterns(path4, excludes, includes, useCaseSensitiveFileNames2, currentDirectory) {
30120
30214
  path4 = normalizePath(path4);
@@ -30429,8 +30523,8 @@ ${lanes.join("\n")}
30429
30523
  return false;
30430
30524
  }
30431
30525
  function numberOfDirectorySeparators(str) {
30432
- const match = str.match(/\//g);
30433
- return match ? match.length : 0;
30526
+ const match2 = str.match(/\//g);
30527
+ return match2 ? match2.length : 0;
30434
30528
  }
30435
30529
  function compareNumberOfDirectorySeparators(path1, path22) {
30436
30530
  return compareValues(
@@ -38644,13 +38738,13 @@ ${lanes.join("\n")}
38644
38738
  [expression]
38645
38739
  );
38646
38740
  }
38647
- function createReadHelper(iteratorRecord, count16) {
38741
+ function createReadHelper(iteratorRecord, count17) {
38648
38742
  context.requestEmitHelper(readHelper);
38649
38743
  return factory2.createCallExpression(
38650
38744
  getUnscopedHelperName("__read"),
38651
38745
  /*typeArguments*/
38652
38746
  void 0,
38653
- count16 !== void 0 ? [iteratorRecord, factory2.createNumericLiteral(count16 + "")] : [iteratorRecord]
38747
+ count17 !== void 0 ? [iteratorRecord, factory2.createNumericLiteral(count17 + "")] : [iteratorRecord]
38654
38748
  );
38655
38749
  }
38656
38750
  function createGeneratorHelper(body) {
@@ -50769,14 +50863,14 @@ ${lanes.join("\n")}
50769
50863
  }
50770
50864
  }
50771
50865
  }
50772
- function addPragmaForMatch(pragmas, range, kind, match) {
50773
- if (!match) return;
50774
- const name = match[1].toLowerCase();
50866
+ function addPragmaForMatch(pragmas, range, kind, match2) {
50867
+ if (!match2) return;
50868
+ const name = match2[1].toLowerCase();
50775
50869
  const pragma = commentPragmas[name];
50776
50870
  if (!pragma || !(pragma.kind & kind)) {
50777
50871
  return;
50778
50872
  }
50779
- const args = match[2];
50873
+ const args = match2[2];
50780
50874
  const argument = getNamedPragmaArguments(pragma, args);
50781
50875
  if (argument === "fail") return;
50782
50876
  pragmas.push({ name, args: { arguments: argument, range } });
@@ -54180,9 +54274,9 @@ ${lanes.join("\n")}
54180
54274
  if (excludeRegex && excludeRegex.test(spec)) {
54181
54275
  continue;
54182
54276
  }
54183
- const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
54184
- if (match) {
54185
- const { key, path: path4, flags } = match;
54277
+ const match2 = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
54278
+ if (match2) {
54279
+ const { key, path: path4, flags } = match2;
54186
54280
  const existingPath = wildCardKeyToPath.get(key);
54187
54281
  const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
54188
54282
  if (existingFlags === void 0 || existingFlags < flags) {
@@ -54211,14 +54305,14 @@ ${lanes.join("\n")}
54211
54305
  return useCaseSensitiveFileNames2 ? path4 : toFileNameLowerCase(path4);
54212
54306
  }
54213
54307
  function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
54214
- const match = wildcardDirectoryPattern.exec(spec);
54215
- if (match) {
54308
+ const match2 = wildcardDirectoryPattern.exec(spec);
54309
+ if (match2) {
54216
54310
  const questionWildcardIndex = spec.indexOf("?");
54217
54311
  const starWildcardIndex = spec.indexOf("*");
54218
54312
  const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
54219
54313
  return {
54220
- key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
54221
- path: match[0],
54314
+ key: toCanonicalKey(match2[0], useCaseSensitiveFileNames2),
54315
+ path: match2[0],
54222
54316
  flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 : 0
54223
54317
  /* None */
54224
54318
  };
@@ -60960,11 +61054,11 @@ ${lanes.join("\n")}
60960
61054
  return comparePaths(a, b2, ignoreCase) === 0;
60961
61055
  }
60962
61056
  function countPathComponents(path4) {
60963
- let count16 = 0;
61057
+ let count17 = 0;
60964
61058
  for (let i2 = startsWith(path4, "./") ? 2 : 0; i2 < path4.length; i2++) {
60965
- if (path4.charCodeAt(i2) === 47) count16++;
61059
+ if (path4.charCodeAt(i2) === 47) count17++;
60966
61060
  }
60967
- return count16;
61061
+ return count17;
60968
61062
  }
60969
61063
  function comparePathsByRedirectAndNumberOfDirectorySeparators(a, b2) {
60970
61064
  return compareBooleans(b2.isRedirect, a.isRedirect) || compareNumberOfDirectorySeparators(a.path, b2.path);
@@ -61799,7 +61893,7 @@ ${lanes.join("\n")}
61799
61893
  SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
61800
61894
  return SignatureCheckMode3;
61801
61895
  })(SignatureCheckMode || {});
61802
- var isNotOverloadAndNotAccessor = and20(isNotOverload, isNotAccessor);
61896
+ var isNotOverloadAndNotAccessor = and21(isNotOverload, isNotAccessor);
61803
61897
  var intrinsicTypeKinds = new Map(Object.entries({
61804
61898
  Uppercase: 0,
61805
61899
  Lowercase: 1,
@@ -67539,7 +67633,7 @@ ${lanes.join("\n")}
67539
67633
  deepCloneOrReuseNode
67540
67634
  )), node);
67541
67635
  }
67542
- function deepCloneOrReuseNodes(nodes, visitor, test, start, count16) {
67636
+ function deepCloneOrReuseNodes(nodes, visitor, test, start, count17) {
67543
67637
  if (nodes && nodes.length === 0) {
67544
67638
  return setTextRange(factory.createNodeArray(
67545
67639
  /*elements*/
@@ -67547,7 +67641,7 @@ ${lanes.join("\n")}
67547
67641
  nodes.hasTrailingComma
67548
67642
  ), nodes);
67549
67643
  }
67550
- return visitNodes2(nodes, visitor, test, start, count16);
67644
+ return visitNodes2(nodes, visitor, test, start, count17);
67551
67645
  }
67552
67646
  }
67553
67647
  function createTypeNodeFromObjectType(type2) {
@@ -71504,10 +71598,10 @@ ${lanes.join("\n")}
71504
71598
  if (t2.flags & 512 || !expandingEnum && t2.flags | 1056) {
71505
71599
  const baseType = t2.flags & 512 ? booleanType : getBaseTypeOfEnumLikeType(t2);
71506
71600
  if (baseType.flags & 1048576) {
71507
- const count16 = baseType.types.length;
71508
- 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])) {
71509
71603
  result.push(baseType);
71510
- i2 += count16 - 1;
71604
+ i2 += count17 - 1;
71511
71605
  continue;
71512
71606
  }
71513
71607
  }
@@ -74241,7 +74335,7 @@ ${lanes.join("\n")}
74241
74335
  }
74242
74336
  let result;
74243
74337
  for (let i2 = 0; i2 < signatureLists.length; i2++) {
74244
- const match = i2 === listIndex ? signature : findMatchingSignature(
74338
+ const match2 = i2 === listIndex ? signature : findMatchingSignature(
74245
74339
  signatureLists[i2],
74246
74340
  signature,
74247
74341
  /*partialMatch*/
@@ -74260,10 +74354,10 @@ ${lanes.join("\n")}
74260
74354
  /*ignoreReturnTypes*/
74261
74355
  true
74262
74356
  );
74263
- if (!match) {
74357
+ if (!match2) {
74264
74358
  return void 0;
74265
74359
  }
74266
- result = appendIfUnique(result, match);
74360
+ result = appendIfUnique(result, match2);
74267
74361
  }
74268
74362
  return result;
74269
74363
  }
@@ -76473,18 +76567,18 @@ ${lanes.join("\n")}
76473
76567
  let i2 = 0;
76474
76568
  while (i2 < length2) {
76475
76569
  const startId = types[i2].id;
76476
- let count16 = 1;
76477
- while (i2 + count16 < length2 && types[i2 + count16].id === startId + count16) {
76478
- count16++;
76570
+ let count17 = 1;
76571
+ while (i2 + count17 < length2 && types[i2 + count17].id === startId + count17) {
76572
+ count17++;
76479
76573
  }
76480
76574
  if (result.length) {
76481
76575
  result += ",";
76482
76576
  }
76483
76577
  result += startId;
76484
- if (count16 > 1) {
76485
- result += ":" + count16;
76578
+ if (count17 > 1) {
76579
+ result += ":" + count17;
76486
76580
  }
76487
- i2 += count16;
76581
+ i2 += count17;
76488
76582
  }
76489
76583
  }
76490
76584
  return result;
@@ -77757,14 +77851,14 @@ ${lanes.join("\n")}
77757
77851
  return types;
77758
77852
  }
77759
77853
  const id = getTypeListId(types);
77760
- const match = subtypeReductionCache.get(id);
77761
- if (match) {
77762
- return match;
77854
+ const match2 = subtypeReductionCache.get(id);
77855
+ if (match2) {
77856
+ return match2;
77763
77857
  }
77764
77858
  const hasEmptyObject = hasObjectTypes && some(types, (t2) => !!(t2.flags & 524288) && !isGenericMappedType(t2) && isEmptyResolvedType(resolveStructuredTypeMembers(t2)));
77765
77859
  const len = types.length;
77766
77860
  let i2 = len;
77767
- let count16 = 0;
77861
+ let count17 = 0;
77768
77862
  while (i2 > 0) {
77769
77863
  i2--;
77770
77864
  const source = types[i2];
@@ -77779,15 +77873,15 @@ ${lanes.join("\n")}
77779
77873
  const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
77780
77874
  for (const target of types) {
77781
77875
  if (source !== target) {
77782
- if (count16 === 1e5) {
77783
- const estimatedCount = count16 / (len - i2) * len;
77876
+ if (count17 === 1e5) {
77877
+ const estimatedCount = count17 / (len - i2) * len;
77784
77878
  if (estimatedCount > 1e6) {
77785
77879
  (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t2) => t2.id) });
77786
77880
  error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
77787
77881
  return void 0;
77788
77882
  }
77789
77883
  }
77790
- count16++;
77884
+ count17++;
77791
77885
  if (keyProperty && target.flags & (524288 | 2097152 | 58982400)) {
77792
77886
  const t2 = getTypeOfPropertyOfType(target, keyProperty.escapedName);
77793
77887
  if (t2 && isUnitType(t2) && getRegularTypeOfLiteralType(t2) !== keyPropertyType) {
@@ -78288,9 +78382,9 @@ ${lanes.join("\n")}
78288
78382
  return true;
78289
78383
  }
78290
78384
  function getCrossProductIntersections(types, flags) {
78291
- const count16 = getCrossProductUnionSize(types);
78385
+ const count17 = getCrossProductUnionSize(types);
78292
78386
  const intersections = [];
78293
- for (let i2 = 0; i2 < count16; i2++) {
78387
+ for (let i2 = 0; i2 < count17; i2++) {
78294
78388
  const constituents = types.slice();
78295
78389
  let n2 = i2;
78296
78390
  for (let j2 = types.length - 1; j2 >= 0; j2--) {
@@ -82051,11 +82145,11 @@ ${lanes.join("\n")}
82051
82145
  const primitive = source2.flags & 128 ? stringType : source2.flags & 256 ? numberType : source2.flags & 2048 ? bigintType : void 0;
82052
82146
  return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 : 0;
82053
82147
  }
82054
- const match = getMatchingUnionConstituentForType(target2, source2);
82055
- if (match) {
82148
+ const match2 = getMatchingUnionConstituentForType(target2, source2);
82149
+ if (match2) {
82056
82150
  const related = isRelatedTo(
82057
82151
  source2,
82058
- match,
82152
+ match2,
82059
82153
  2,
82060
82154
  /*reportErrors*/
82061
82155
  false,
@@ -84157,14 +84251,14 @@ ${lanes.join("\n")}
84157
84251
  return some(type.types, (t2) => isDeeplyNestedType(t2, stack, depth, maxDepth));
84158
84252
  }
84159
84253
  const identity2 = getRecursionIdentity(type);
84160
- let count16 = 0;
84254
+ let count17 = 0;
84161
84255
  let lastTypeId = 0;
84162
84256
  for (let i2 = 0; i2 < depth; i2++) {
84163
84257
  const t2 = stack[i2];
84164
84258
  if (hasMatchingRecursionIdentity(t2, identity2)) {
84165
84259
  if (t2.id >= lastTypeId) {
84166
- count16++;
84167
- if (count16 >= maxDepth) {
84260
+ count17++;
84261
+ if (count17 >= maxDepth) {
84168
84262
  return true;
84169
84263
  }
84170
84264
  }
@@ -85624,8 +85718,8 @@ ${lanes.join("\n")}
85624
85718
  ];
85625
85719
  }
85626
85720
  function inferFromTypeArguments(sourceTypes, targetTypes, variances) {
85627
- const count16 = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
85628
- 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++) {
85629
85723
  if (i2 < variances.length && (variances[i2] & 7) === 2) {
85630
85724
  inferFromContravariantTypes(sourceTypes[i2], targetTypes[i2]);
85631
85725
  } else {
@@ -86369,7 +86463,7 @@ ${lanes.join("\n")}
86369
86463
  }
86370
86464
  function mapTypesByKeyProperty(types, name) {
86371
86465
  const map2 = /* @__PURE__ */ new Map();
86372
- let count16 = 0;
86466
+ let count17 = 0;
86373
86467
  for (const type of types) {
86374
86468
  if (type.flags & (524288 | 2097152 | 58982400)) {
86375
86469
  const discriminant = getTypeOfPropertyOfType(type, name);
@@ -86388,11 +86482,11 @@ ${lanes.join("\n")}
86388
86482
  duplicate = true;
86389
86483
  }
86390
86484
  });
86391
- if (!duplicate) count16++;
86485
+ if (!duplicate) count17++;
86392
86486
  }
86393
86487
  }
86394
86488
  }
86395
- return count16 >= 10 && count16 * 2 >= types.length ? map2 : void 0;
86489
+ return count17 >= 10 && count17 * 2 >= types.length ? map2 : void 0;
86396
86490
  }
86397
86491
  function getKeyPropertyName(unionType) {
86398
86492
  const types = unionType.types;
@@ -104619,7 +104713,7 @@ ${lanes.join("\n")}
104619
104713
  if (flags & (1920 | 384)) {
104620
104714
  return;
104621
104715
  }
104622
- const exportedDeclarationsCount = countWhere(declarations, and20(isNotOverloadAndNotAccessor, not2(isInterfaceDeclaration)));
104716
+ const exportedDeclarationsCount = countWhere(declarations, and21(isNotOverloadAndNotAccessor, not2(isInterfaceDeclaration)));
104623
104717
  if (flags & 524288 && exportedDeclarationsCount <= 2) {
104624
104718
  return;
104625
104719
  }
@@ -108767,9 +108861,9 @@ ${lanes.join("\n")}
108767
108861
  }
108768
108862
  function findMatchingDiscriminantType(source, target, isRelatedTo) {
108769
108863
  if (target.flags & 1048576 && source.flags & (2097152 | 524288)) {
108770
- const match = getMatchingUnionConstituentForType(target, source);
108771
- if (match) {
108772
- return match;
108864
+ const match2 = getMatchingUnionConstituentForType(target, source);
108865
+ if (match2) {
108866
+ return match2;
108773
108867
  }
108774
108868
  const sourceProperties = getPropertiesOfType(source);
108775
108869
  if (sourceProperties) {
@@ -109008,7 +109102,7 @@ ${lanes.join("\n")}
109008
109102
  Debug.assertNode(visitedNode, test);
109009
109103
  return visitedNode;
109010
109104
  }
109011
- function visitNodes2(nodes, visitor, test, start, count16) {
109105
+ function visitNodes2(nodes, visitor, test, start, count17) {
109012
109106
  if (nodes === void 0) {
109013
109107
  return nodes;
109014
109108
  }
@@ -109016,20 +109110,20 @@ ${lanes.join("\n")}
109016
109110
  if (start === void 0 || start < 0) {
109017
109111
  start = 0;
109018
109112
  }
109019
- if (count16 === void 0 || count16 > length2 - start) {
109020
- count16 = length2 - start;
109113
+ if (count17 === void 0 || count17 > length2 - start) {
109114
+ count17 = length2 - start;
109021
109115
  }
109022
109116
  let hasTrailingComma;
109023
109117
  let pos = -1;
109024
109118
  let end = -1;
109025
- if (start > 0 || count16 < length2) {
109026
- hasTrailingComma = nodes.hasTrailingComma && start + count16 === length2;
109119
+ if (start > 0 || count17 < length2) {
109120
+ hasTrailingComma = nodes.hasTrailingComma && start + count17 === length2;
109027
109121
  } else {
109028
109122
  pos = nodes.pos;
109029
109123
  end = nodes.end;
109030
109124
  hasTrailingComma = nodes.hasTrailingComma;
109031
109125
  }
109032
- const updated = visitArrayWorker(nodes, visitor, test, start, count16);
109126
+ const updated = visitArrayWorker(nodes, visitor, test, start, count17);
109033
109127
  if (updated !== nodes) {
109034
109128
  const updatedArray = factory.createNodeArray(updated, hasTrailingComma);
109035
109129
  setTextRangePosEnd(updatedArray, pos, end);
@@ -109037,7 +109131,7 @@ ${lanes.join("\n")}
109037
109131
  }
109038
109132
  return nodes;
109039
109133
  }
109040
- function visitArray(nodes, visitor, test, start, count16) {
109134
+ function visitArray(nodes, visitor, test, start, count17) {
109041
109135
  if (nodes === void 0) {
109042
109136
  return nodes;
109043
109137
  }
@@ -109045,18 +109139,18 @@ ${lanes.join("\n")}
109045
109139
  if (start === void 0 || start < 0) {
109046
109140
  start = 0;
109047
109141
  }
109048
- if (count16 === void 0 || count16 > length2 - start) {
109049
- count16 = length2 - start;
109142
+ if (count17 === void 0 || count17 > length2 - start) {
109143
+ count17 = length2 - start;
109050
109144
  }
109051
- return visitArrayWorker(nodes, visitor, test, start, count16);
109145
+ return visitArrayWorker(nodes, visitor, test, start, count17);
109052
109146
  }
109053
- function visitArrayWorker(nodes, visitor, test, start, count16) {
109147
+ function visitArrayWorker(nodes, visitor, test, start, count17) {
109054
109148
  let updated;
109055
109149
  const length2 = nodes.length;
109056
- if (start > 0 || count16 < length2) {
109150
+ if (start > 0 || count17 < length2) {
109057
109151
  updated = [];
109058
109152
  }
109059
- for (let i2 = 0; i2 < count16; i2++) {
109153
+ for (let i2 = 0; i2 < count17; i2++) {
109060
109154
  const node = nodes[i2 + start];
109061
109155
  const visited = node !== void 0 ? visitor ? visitor(node) : node : void 0;
109062
109156
  if (updated !== void 0 || visited === void 0 || visited !== node) {
@@ -123687,14 +123781,14 @@ ${lanes.join("\n")}
123687
123781
  return acc === void 0 ? decoded : acc + " " + decoded;
123688
123782
  }
123689
123783
  function decodeEntities(text4) {
123690
- 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) => {
123691
123785
  if (decimal) {
123692
123786
  return utf16EncodeAsString(parseInt(decimal, 10));
123693
123787
  } else if (hex) {
123694
123788
  return utf16EncodeAsString(parseInt(hex, 16));
123695
123789
  } else {
123696
123790
  const ch = entities.get(word);
123697
- return ch ? utf16EncodeAsString(ch) : match;
123791
+ return ch ? utf16EncodeAsString(ch) : match2;
123698
123792
  }
123699
123793
  });
123700
123794
  }
@@ -140432,7 +140526,7 @@ ${lanes.join("\n")}
140432
140526
  break;
140433
140527
  }
140434
140528
  }
140435
- function emitList(parentNode, children, format, parenthesizerRule, start, count16) {
140529
+ function emitList(parentNode, children, format, parenthesizerRule, start, count17) {
140436
140530
  emitNodeList(
140437
140531
  emit,
140438
140532
  parentNode,
@@ -140440,18 +140534,18 @@ ${lanes.join("\n")}
140440
140534
  format | (parentNode && getEmitFlags(parentNode) & 2 ? 65536 : 0),
140441
140535
  parenthesizerRule,
140442
140536
  start,
140443
- count16
140537
+ count17
140444
140538
  );
140445
140539
  }
140446
- function emitExpressionList(parentNode, children, format, parenthesizerRule, start, count16) {
140447
- 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);
140448
140542
  }
140449
- 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) {
140450
140544
  const isUndefined2 = children === void 0;
140451
140545
  if (isUndefined2 && format & 16384) {
140452
140546
  return;
140453
140547
  }
140454
- const isEmpty = children === void 0 || start >= children.length || count16 === 0;
140548
+ const isEmpty = children === void 0 || start >= children.length || count17 === 0;
140455
140549
  if (isEmpty && format & 32768) {
140456
140550
  onBeforeEmitNodeArray == null ? void 0 : onBeforeEmitNodeArray(children);
140457
140551
  onAfterEmitNodeArray == null ? void 0 : onAfterEmitNodeArray(children);
@@ -140475,7 +140569,7 @@ ${lanes.join("\n")}
140475
140569
  writeSpace();
140476
140570
  }
140477
140571
  } else {
140478
- emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count16, children.hasTrailingComma, children);
140572
+ emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count17, children.hasTrailingComma, children);
140479
140573
  }
140480
140574
  onAfterEmitNodeArray == null ? void 0 : onAfterEmitNodeArray(children);
140481
140575
  if (format & 15360) {
@@ -140485,7 +140579,7 @@ ${lanes.join("\n")}
140485
140579
  writePunctuation(getClosingBracket(format));
140486
140580
  }
140487
140581
  }
140488
- function emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count16, hasTrailingComma, childrenTextRange) {
140582
+ function emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count17, hasTrailingComma, childrenTextRange) {
140489
140583
  const mayEmitInterveningComments = (format & 262144) === 0;
140490
140584
  let shouldEmitInterveningComments = mayEmitInterveningComments;
140491
140585
  const leadingLineTerminatorCount = getLeadingLineTerminatorCount(parentNode, children[start], format);
@@ -140501,7 +140595,7 @@ ${lanes.join("\n")}
140501
140595
  const emitListItem = getEmitListItem(emit2, parenthesizerRule);
140502
140596
  let previousSibling;
140503
140597
  let shouldDecreaseIndentAfterEmit = false;
140504
- for (let i2 = 0; i2 < count16; i2++) {
140598
+ for (let i2 = 0; i2 < count17; i2++) {
140505
140599
  const child = children[start + i2];
140506
140600
  if (format & 32) {
140507
140601
  writeLine();
@@ -140566,7 +140660,7 @@ ${lanes.join("\n")}
140566
140660
  if (format & 128) {
140567
140661
  decreaseIndent();
140568
140662
  }
140569
- const closingLineTerminatorCount = getClosingLineTerminatorCount(parentNode, children[start + count16 - 1], format, childrenTextRange);
140663
+ const closingLineTerminatorCount = getClosingLineTerminatorCount(parentNode, children[start + count17 - 1], format, childrenTextRange);
140570
140664
  if (closingLineTerminatorCount) {
140571
140665
  writeLine(closingLineTerminatorCount);
140572
140666
  } else if (format & (2097152 | 256)) {
@@ -140616,8 +140710,8 @@ ${lanes.join("\n")}
140616
140710
  writer.write(s2);
140617
140711
  }
140618
140712
  }
140619
- function writeLine(count16 = 1) {
140620
- for (let i2 = 0; i2 < count16; i2++) {
140713
+ function writeLine(count17 = 1) {
140714
+ for (let i2 = 0; i2 < count17; i2++) {
140621
140715
  writer.writeLine(i2 > 0);
140622
140716
  }
140623
140717
  }
@@ -141146,10 +141240,10 @@ ${lanes.join("\n")}
141146
141240
  }
141147
141241
  }
141148
141242
  while (true) {
141149
- const count16 = tempFlags2 & 268435455;
141243
+ const count17 = tempFlags2 & 268435455;
141150
141244
  tempFlags2++;
141151
- if (count16 !== 8 && count16 !== 13) {
141152
- 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);
141153
141247
  const fullName = formatGeneratedName(privateName, prefix, name, suffix);
141154
141248
  if (isUniqueName(fullName, privateName)) {
141155
141249
  if (privateName) {
@@ -153232,12 +153326,12 @@ ${lanes.join("\n")}
153232
153326
  for (const line of output) {
153233
153327
  sys2.write(line);
153234
153328
  }
153235
- function example(ex, desc15) {
153329
+ function example(ex, desc16) {
153236
153330
  const examples = typeof ex === "string" ? [ex] : ex;
153237
153331
  for (const example2 of examples) {
153238
153332
  output.push(" " + colors.blue(example2) + sys2.newLine);
153239
153333
  }
153240
- output.push(" " + getDiagnosticText(desc15) + sys2.newLine + sys2.newLine);
153334
+ output.push(" " + getDiagnosticText(desc16) + sys2.newLine + sys2.newLine);
153241
153335
  }
153242
153336
  }
153243
153337
  function printAllHelp(sys2, compilerOptions, buildOptions, watchOptions) {
@@ -153889,7 +153983,7 @@ ${lanes.join("\n")}
153889
153983
  reportCountStatistic("Lines of " + key, value);
153890
153984
  }
153891
153985
  } else {
153892
- reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum, count16) => sum + count16, 0));
153986
+ reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum, count17) => sum + count17, 0));
153893
153987
  }
153894
153988
  reportCountStatistic("Identifiers", program2.getIdentifierCount());
153895
153989
  reportCountStatistic("Symbols", program2.getSymbolCount());
@@ -153994,11 +154088,11 @@ ${lanes.join("\n")}
153994
154088
  statistics.push(s2);
153995
154089
  if (aggregate) solutionPerformance == null ? void 0 : solutionPerformance.addAggregateStatistic(s2);
153996
154090
  }
153997
- function reportCountStatistic(name, count16) {
154091
+ function reportCountStatistic(name, count17) {
153998
154092
  reportStatisticalValue(
153999
154093
  {
154000
154094
  name,
154001
- value: count16,
154095
+ value: count17,
154002
154096
  type: 1
154003
154097
  /* count */
154004
154098
  },
@@ -154499,8 +154593,8 @@ ${lanes.join("\n")}
154499
154593
  nonlocalNode ? visitNodesWithoutCopyingPositions : void 0
154500
154594
  );
154501
154595
  }
154502
- function visitNodesWithoutCopyingPositions(nodes, visitor, test, start, count16) {
154503
- 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);
154504
154598
  if (result) {
154505
154599
  if (result.pos !== -1 || result.end !== -1) {
154506
154600
  if (result === nodes) {
@@ -157394,9 +157488,9 @@ ${lanes.join("\n")}
157394
157488
  function getSnapshotText(snap) {
157395
157489
  return snap.getText(0, snap.getLength());
157396
157490
  }
157397
- function repeatString(str, count16) {
157491
+ function repeatString(str, count17) {
157398
157492
  let result = "";
157399
- for (let i2 = 0; i2 < count16; i2++) {
157493
+ for (let i2 = 0; i2 < count17; i2++) {
157400
157494
  result += str;
157401
157495
  }
157402
157496
  return result;
@@ -160027,31 +160121,31 @@ ${lanes.join("\n")}
160027
160121
  const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/m;
160028
160122
  const attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/g;
160029
160123
  const text4 = sourceFile.text.substr(start, width);
160030
- const match = tripleSlashXMLCommentRegEx.exec(text4);
160031
- if (!match) {
160124
+ const match2 = tripleSlashXMLCommentRegEx.exec(text4);
160125
+ if (!match2) {
160032
160126
  return false;
160033
160127
  }
160034
- if (!match[3] || !(match[3] in commentPragmas)) {
160128
+ if (!match2[3] || !(match2[3] in commentPragmas)) {
160035
160129
  return false;
160036
160130
  }
160037
160131
  let pos = start;
160038
- pushCommentRange(pos, match[1].length);
160039
- pos += match[1].length;
160132
+ pushCommentRange(pos, match2[1].length);
160133
+ pos += match2[1].length;
160040
160134
  pushClassification(
160041
160135
  pos,
160042
- match[2].length,
160136
+ match2[2].length,
160043
160137
  10
160044
160138
  /* punctuation */
160045
160139
  );
160046
- pos += match[2].length;
160140
+ pos += match2[2].length;
160047
160141
  pushClassification(
160048
160142
  pos,
160049
- match[3].length,
160143
+ match2[3].length,
160050
160144
  21
160051
160145
  /* jsxSelfClosingTagName */
160052
160146
  );
160053
- pos += match[3].length;
160054
- const attrText = match[4];
160147
+ pos += match2[3].length;
160148
+ const attrText = match2[4];
160055
160149
  let attrPos = pos;
160056
160150
  while (true) {
160057
160151
  const attrMatch = attributeRegex.exec(attrText);
@@ -160093,18 +160187,18 @@ ${lanes.join("\n")}
160093
160187
  );
160094
160188
  attrPos += attrMatch[6].length;
160095
160189
  }
160096
- pos += match[4].length;
160190
+ pos += match2[4].length;
160097
160191
  if (pos > attrPos) {
160098
160192
  pushCommentRange(attrPos, pos - attrPos);
160099
160193
  }
160100
- if (match[5]) {
160194
+ if (match2[5]) {
160101
160195
  pushClassification(
160102
160196
  pos,
160103
- match[5].length,
160197
+ match2[5].length,
160104
160198
  10
160105
160199
  /* punctuation */
160106
160200
  );
160107
- pos += match[5].length;
160201
+ pos += match2[5].length;
160108
160202
  }
160109
160203
  const end = start + width;
160110
160204
  if (pos < end) {
@@ -161289,8 +161383,8 @@ ${lanes.join("\n")}
161289
161383
  (ch) => ch !== 32 && ch !== 42
161290
161384
  /* asterisk */
161291
161385
  )) {
161292
- const match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans);
161293
- if (match) return match;
161386
+ const match2 = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans);
161387
+ if (match2) return match2;
161294
161388
  }
161295
161389
  const subWordTextChunks = segment.subWordTextChunks;
161296
161390
  let bestMatch;
@@ -161950,10 +162044,10 @@ ${lanes.join("\n")}
161950
162044
  function getDocumentPositionMapper(host, generatedFileName, generatedFileLineInfo, readMapFile) {
161951
162045
  let mapFileName = tryGetSourceMappingURL(generatedFileLineInfo);
161952
162046
  if (mapFileName) {
161953
- const match = base64UrlRegExp.exec(mapFileName);
161954
- if (match) {
161955
- if (match[1]) {
161956
- const base64Object = match[1];
162047
+ const match2 = base64UrlRegExp.exec(mapFileName);
162048
+ if (match2) {
162049
+ if (match2[1]) {
162050
+ const base64Object = match2[1];
161957
162051
  return convertDocumentToSourceMapper(host, base64decode(sys, base64Object), generatedFileName);
161958
162052
  }
161959
162053
  mapFileName = void 0;
@@ -162420,8 +162514,8 @@ interface Symbol {
162420
162514
  return file !== singleCurrentFile && excludeLibFiles && (isInsideNodeModules(file.path) || file.hasNoDefaultLib);
162421
162515
  }
162422
162516
  function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, fileName, excludeLibFiles, singleCurrentFile, rawItems) {
162423
- const match = patternMatcher.getMatchForLastSegmentOfPattern(name);
162424
- if (!match) {
162517
+ const match2 = patternMatcher.getMatchForLastSegmentOfPattern(name);
162518
+ if (!match2) {
162425
162519
  return;
162426
162520
  }
162427
162521
  for (const declaration of declarations) {
@@ -162432,7 +162526,7 @@ interface Symbol {
162432
162526
  rawItems.push({ name, fileName, matchKind: fullMatch.kind, isCaseSensitive: fullMatch.isCaseSensitive, declaration });
162433
162527
  }
162434
162528
  } else {
162435
- rawItems.push({ name, fileName, matchKind: match.kind, isCaseSensitive: match.isCaseSensitive, declaration });
162529
+ rawItems.push({ name, fileName, matchKind: match2.kind, isCaseSensitive: match2.isCaseSensitive, declaration });
162436
162530
  }
162437
162531
  }
162438
162532
  }
@@ -166706,12 +166800,12 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
166706
166800
  function getOccurrencesInExpression(matchTo, expression) {
166707
166801
  const occurrences = [];
166708
166802
  while (isBinaryExpression(expression) && expression.operatorToken.kind === 56) {
166709
- const match = getMatchingStart(skipParentheses(matchTo), skipParentheses(expression.right));
166710
- if (!match) {
166803
+ const match2 = getMatchingStart(skipParentheses(matchTo), skipParentheses(expression.right));
166804
+ if (!match2) {
166711
166805
  break;
166712
166806
  }
166713
- occurrences.push(match);
166714
- matchTo = match;
166807
+ occurrences.push(match2);
166808
+ matchTo = match2;
166715
166809
  expression = expression.left;
166716
166810
  }
166717
166811
  const finalMatch = getMatchingStart(matchTo, expression);
@@ -170686,8 +170780,8 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
170686
170780
  const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
170687
170781
  const token = getTouchingToken(sourceFile, position);
170688
170782
  const matchKind = token.getStart(sourceFile) === position ? braceMatching.get(token.kind.toString()) : void 0;
170689
- const match = matchKind && findChildOfKind(token.parent, matchKind, sourceFile);
170690
- 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;
170691
170785
  }
170692
170786
  function getIndentationAtPosition(fileName, position, editorOptions) {
170693
170787
  let start = timestamp();
@@ -171442,14 +171536,14 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
171442
171536
  }
171443
171537
  return spanInNode(otherwiseOnNode);
171444
171538
  }
171445
- function spanInNodeArray(nodeArray, node, match) {
171539
+ function spanInNodeArray(nodeArray, node, match2) {
171446
171540
  if (nodeArray) {
171447
171541
  const index2 = nodeArray.indexOf(node);
171448
171542
  if (index2 >= 0) {
171449
171543
  let start = index2;
171450
171544
  let end = index2 + 1;
171451
- while (start > 0 && match(nodeArray[start - 1])) start--;
171452
- 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++;
171453
171547
  return createTextSpanFromBounds(skipTrivia(sourceFile.text, nodeArray[start].pos), nodeArray[end - 1].end);
171454
171548
  }
171455
171549
  }
@@ -175528,7 +175622,7 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
175528
175622
  const maybeHeritageClauseSymbol = getHeritageClauseSymbolTable(classDeclaration, checker);
175529
175623
  const implementedType = checker.getTypeAtLocation(implementedTypeNode);
175530
175624
  const implementedTypeSymbols = checker.getPropertiesOfType(implementedType);
175531
- const nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(and20(symbolPointsToNonPrivateMember, (symbol) => !maybeHeritageClauseSymbol.has(symbol.escapedName)));
175625
+ const nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(and21(symbolPointsToNonPrivateMember, (symbol) => !maybeHeritageClauseSymbol.has(symbol.escapedName)));
175532
175626
  const classType = checker.getTypeAtLocation(classDeclaration);
175533
175627
  const constructor = find(classDeclaration.members, (m2) => isConstructorDeclaration(m2));
175534
175628
  if (!classType.getNumberIndexType()) {
@@ -188684,12 +188778,12 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
188684
188778
  function stringLiteralCompletionDetails(name, location, completion, sourceFile, checker, cancellationToken) {
188685
188779
  switch (completion.kind) {
188686
188780
  case 0: {
188687
- const match = find(completion.paths, (p10) => p10.name === name);
188688
- 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)]);
188689
188783
  }
188690
188784
  case 1: {
188691
- const match = find(completion.symbols, (s2) => s2.name === name);
188692
- 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);
188693
188787
  }
188694
188788
  case 2:
188695
188789
  return find(completion.types, (t2) => t2.value === name) ? createCompletionDetails(name, "", "string", [textPart(name)]) : void 0;
@@ -189463,8 +189557,8 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
189463
189557
  /*exclude*/
189464
189558
  void 0,
189465
189559
  includeGlobs
189466
- ), (match) => {
189467
- const trimmedWithPattern = trimPrefixAndSuffix(match, completePrefix);
189560
+ ), (match2) => {
189561
+ const trimmedWithPattern = trimPrefixAndSuffix(match2, completePrefix);
189468
189562
  if (trimmedWithPattern) {
189469
189563
  if (containsSlash(trimmedWithPattern)) {
189470
189564
  return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
@@ -189508,11 +189602,11 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
189508
189602
  return void 0;
189509
189603
  }
189510
189604
  const text4 = sourceFile.text.slice(range.pos, position);
189511
- const match = tripleSlashDirectiveFragmentRegex.exec(text4);
189512
- if (!match) {
189605
+ const match2 = tripleSlashDirectiveFragmentRegex.exec(text4);
189606
+ if (!match2) {
189513
189607
  return void 0;
189514
189608
  }
189515
- const [, prefix, kind, toComplete] = match;
189609
+ const [, prefix, kind, toComplete] = match2;
189516
189610
  const scriptPath = getDirectoryPath(sourceFile.path);
189517
189611
  const names = kind === "path" ? getCompletionEntriesForDirectoryFragment(
189518
189612
  toComplete,
@@ -190203,8 +190297,8 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
190203
190297
  function isAmbientModuleDeclaration(node) {
190204
190298
  return node.kind === 268 && node.name.kind === 11;
190205
190299
  }
190206
- function isExternalModuleImportEquals(eq20) {
190207
- 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;
190208
190302
  }
190209
190303
  var DefinitionKind = /* @__PURE__ */ ((DefinitionKind2) => {
190210
190304
  DefinitionKind2[DefinitionKind2["Symbol"] = 0] = "Symbol";
@@ -195853,13 +195947,13 @@ ${content}
195853
195947
  if (candidates[i2] === resolvedSignature) {
195854
195948
  selectedItemIndex = itemsSeen;
195855
195949
  if (item.length > 1) {
195856
- let count16 = 0;
195950
+ let count17 = 0;
195857
195951
  for (const i22 of item) {
195858
195952
  if (i22.isVariadic || i22.parameters.length >= argumentCount) {
195859
- selectedItemIndex = itemsSeen + count16;
195953
+ selectedItemIndex = itemsSeen + count17;
195860
195954
  break;
195861
195955
  }
195862
- count16++;
195956
+ count17++;
195863
195957
  }
195864
195958
  }
195865
195959
  }
@@ -198160,8 +198254,8 @@ ${options.prefix}` : "\n" : options.prefix
198160
198254
  setTextRangePosEnd(newNode, getPos2(node), getEnd(node));
198161
198255
  return newNode;
198162
198256
  }
198163
- function assignPositionsToNodeArray(nodes, visitor, test, start, count16) {
198164
- 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);
198165
198259
  if (!visited) {
198166
198260
  return visited;
198167
198261
  }
@@ -202838,7 +202932,7 @@ ${options.prefix}` : "\n" : options.prefix
202838
202932
  affectsEmitOptionDeclarations: () => affectsEmitOptionDeclarations,
202839
202933
  allKeysStartWithDot: () => allKeysStartWithDot,
202840
202934
  altDirectorySeparator: () => altDirectorySeparator,
202841
- and: () => and20,
202935
+ and: () => and21,
202842
202936
  append: () => append,
202843
202937
  appendIfUnique: () => appendIfUnique,
202844
202938
  arrayFrom: () => arrayFrom,
@@ -215095,8 +215189,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
215095
215189
  }
215096
215190
  const noDtsProgram = ls.getProgram();
215097
215191
  const fileToSearch = Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
215098
- for (const match of searchForDeclaration(candidate.name, fileToSearch, noDtsProgram)) {
215099
- definitionSet.add(match);
215192
+ for (const match2 of searchForDeclaration(candidate.name, fileToSearch, noDtsProgram)) {
215193
+ definitionSet.add(match2);
215100
215194
  }
215101
215195
  }
215102
215196
  }
@@ -215183,9 +215277,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
215183
215277
  }
215184
215278
  function searchForDeclaration(declarationName, fileToSearch, noDtsProgram) {
215185
215279
  const matches = ts_FindAllReferences_exports.Core.getTopMostDeclarationNamesInFile(declarationName, fileToSearch);
215186
- return mapDefined(matches, (match) => {
215187
- const symbol = noDtsProgram.getTypeChecker().getSymbolAtLocation(match);
215188
- const decl = getDeclarationFromName(match);
215280
+ return mapDefined(matches, (match2) => {
215281
+ const symbol = noDtsProgram.getTypeChecker().getSymbolAtLocation(match2);
215282
+ const decl = getDeclarationFromName(match2);
215189
215283
  if (symbol && decl) {
215190
215284
  return ts_GoToDefinition_exports.createDefinitionInfo(
215191
215285
  decl,
@@ -217916,19 +218010,29 @@ var init_functionTools = __esm({
217916
218010
  }
217917
218011
  });
217918
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
+
217919
218023
  // ../packages/agents-core/src/data-access/subAgentRelations.ts
217920
- 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";
217921
218025
  var init_subAgentRelations = __esm({
217922
218026
  "../packages/agents-core/src/data-access/subAgentRelations.ts"() {
217923
218027
  "use strict";
217924
218028
  init_esm_shims();
217925
- init_conversations();
217926
218029
  init_schema();
218030
+ init_conversations();
217927
218031
  }
217928
218032
  });
217929
218033
 
217930
218034
  // ../packages/agents-core/src/data-access/subAgents.ts
217931
- 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";
217932
218036
  var init_subAgents = __esm({
217933
218037
  "../packages/agents-core/src/data-access/subAgents.ts"() {
217934
218038
  "use strict";
@@ -217977,11 +218081,11 @@ var init_index_node = __esm({
217977
218081
  }
217978
218082
  });
217979
218083
 
217980
- // ../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
217981
218085
  import { z as z5 } from "zod";
217982
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;
217983
218087
  var init_types2 = __esm({
217984
- "../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"() {
217985
218089
  "use strict";
217986
218090
  init_esm_shims();
217987
218091
  JSONRPC_VERSION = "2.0";
@@ -218917,11 +219021,11 @@ var init_types2 = __esm({
218917
219021
  }
218918
219022
  });
218919
219023
 
218920
- // ../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
218921
219025
  import { z as z6 } from "zod";
218922
- 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;
218923
219027
  var init_auth = __esm({
218924
- "../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"() {
218925
219029
  "use strict";
218926
219030
  init_esm_shims();
218927
219031
  SafeUrlSchema = z6.string().url().superRefine((val, ctx) => {
@@ -219027,6 +219131,7 @@ var init_auth = __esm({
219027
219131
  error_description: z6.string().optional(),
219028
219132
  error_uri: z6.string().optional()
219029
219133
  });
219134
+ OptionalSafeUrlSchema = SafeUrlSchema.optional().or(z6.literal("").transform(() => void 0));
219030
219135
  OAuthClientMetadataSchema = z6.object({
219031
219136
  redirect_uris: z6.array(SafeUrlSchema),
219032
219137
  token_endpoint_auth_method: z6.string().optional(),
@@ -219034,10 +219139,10 @@ var init_auth = __esm({
219034
219139
  response_types: z6.array(z6.string()).optional(),
219035
219140
  client_name: z6.string().optional(),
219036
219141
  client_uri: SafeUrlSchema.optional(),
219037
- logo_uri: SafeUrlSchema.optional(),
219142
+ logo_uri: OptionalSafeUrlSchema,
219038
219143
  scope: z6.string().optional(),
219039
219144
  contacts: z6.array(z6.string()).optional(),
219040
- tos_uri: SafeUrlSchema.optional(),
219145
+ tos_uri: OptionalSafeUrlSchema,
219041
219146
  policy_uri: z6.string().optional(),
219042
219147
  jwks_uri: SafeUrlSchema.optional(),
219043
219148
  jwks: z6.any().optional(),
@@ -219063,18 +219168,18 @@ var init_auth = __esm({
219063
219168
  }
219064
219169
  });
219065
219170
 
219066
- // ../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
219067
219172
  var init_auth_utils = __esm({
219068
- "../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"() {
219069
219174
  "use strict";
219070
219175
  init_esm_shims();
219071
219176
  }
219072
219177
  });
219073
219178
 
219074
- // ../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
219075
219180
  var OAuthError, InvalidRequestError, InvalidClientError, InvalidGrantError, UnauthorizedClientError, UnsupportedGrantTypeError, InvalidScopeError, AccessDeniedError, ServerError, TemporarilyUnavailableError, UnsupportedResponseTypeError, UnsupportedTokenTypeError, InvalidTokenError, MethodNotAllowedError, TooManyRequestsError, InvalidClientMetadataError, InsufficientScopeError, OAUTH_ERRORS;
219076
219181
  var init_errors = __esm({
219077
- "../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"() {
219078
219183
  "use strict";
219079
219184
  init_esm_shims();
219080
219185
  OAuthError = class extends Error {
@@ -219169,9 +219274,9 @@ var init_errors = __esm({
219169
219274
  }
219170
219275
  });
219171
219276
 
219172
- // ../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
219173
219278
  var init_auth2 = __esm({
219174
- "../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"() {
219175
219280
  "use strict";
219176
219281
  init_esm_shims();
219177
219282
  init_index_node();
@@ -219365,9 +219470,9 @@ var init_execution = __esm({
219365
219470
  }
219366
219471
  });
219367
219472
 
219368
- // ../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
219369
219474
  var init_protocol = __esm({
219370
- "../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"() {
219371
219476
  "use strict";
219372
219477
  init_esm_shims();
219373
219478
  init_types2();
@@ -220879,26 +220984,26 @@ var require_resolve = __commonJS({
220879
220984
  return true;
220880
220985
  }
220881
220986
  function countKeys(schema) {
220882
- var count16 = 0, item;
220987
+ var count17 = 0, item;
220883
220988
  if (Array.isArray(schema)) {
220884
220989
  for (var i2 = 0; i2 < schema.length; i2++) {
220885
220990
  item = schema[i2];
220886
- if (typeof item == "object") count16 += countKeys(item);
220887
- if (count16 == Infinity) return Infinity;
220991
+ if (typeof item == "object") count17 += countKeys(item);
220992
+ if (count17 == Infinity) return Infinity;
220888
220993
  }
220889
220994
  } else {
220890
220995
  for (var key in schema) {
220891
220996
  if (key == "$ref") return Infinity;
220892
220997
  if (SIMPLE_INLINED[key]) {
220893
- count16++;
220998
+ count17++;
220894
220999
  } else {
220895
221000
  item = schema[key];
220896
- if (typeof item == "object") count16 += countKeys(item) + 1;
220897
- if (count16 == Infinity) return Infinity;
221001
+ if (typeof item == "object") count17 += countKeys(item) + 1;
221002
+ if (count17 == Infinity) return Infinity;
220898
221003
  }
220899
221004
  }
220900
221005
  }
220901
- return count16;
221006
+ return count17;
220902
221007
  }
220903
221008
  function getFullPath(id, normalize) {
220904
221009
  if (normalize !== false) id = normalizeId(id);
@@ -225635,10 +225740,10 @@ var require_ajv = __commonJS({
225635
225740
  }
225636
225741
  });
225637
225742
 
225638
- // ../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
225639
225744
  var import_ajv;
225640
225745
  var init_client2 = __esm({
225641
- "../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"() {
225642
225747
  "use strict";
225643
225748
  init_esm_shims();
225644
225749
  init_protocol();
@@ -225647,9 +225752,9 @@ var init_client2 = __esm({
225647
225752
  }
225648
225753
  });
225649
225754
 
225650
- // ../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
225651
225756
  var init_sse = __esm({
225652
- "../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"() {
225653
225758
  "use strict";
225654
225759
  init_esm_shims();
225655
225760
  init_types2();
@@ -225657,9 +225762,9 @@ var init_sse = __esm({
225657
225762
  }
225658
225763
  });
225659
225764
 
225660
- // ../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
225661
225766
  var init_streamableHttp = __esm({
225662
- "../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"() {
225663
225768
  "use strict";
225664
225769
  init_esm_shims();
225665
225770
  init_types2();
@@ -226828,7 +226933,7 @@ var init_utils = __esm({
226828
226933
  });
226829
226934
 
226830
226935
  // ../packages/agents-core/src/data-access/credentialReferences.ts
226831
- 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";
226832
226937
  var init_credentialReferences = __esm({
226833
226938
  "../packages/agents-core/src/data-access/credentialReferences.ts"() {
226834
226939
  "use strict";
@@ -226838,7 +226943,7 @@ var init_credentialReferences = __esm({
226838
226943
  });
226839
226944
 
226840
226945
  // ../packages/agents-core/src/data-access/tools.ts
226841
- 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";
226842
226947
  var logger7;
226843
226948
  var init_tools = __esm({
226844
226949
  "../packages/agents-core/src/data-access/tools.ts"() {
@@ -226859,7 +226964,7 @@ var init_tools = __esm({
226859
226964
  });
226860
226965
 
226861
226966
  // ../packages/agents-core/src/data-access/agents.ts
226862
- 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";
226863
226968
  var init_agents = __esm({
226864
226969
  "../packages/agents-core/src/data-access/agents.ts"() {
226865
226970
  "use strict";
@@ -226870,6 +226975,7 @@ var init_agents = __esm({
226870
226975
  init_externalAgents();
226871
226976
  init_functions();
226872
226977
  init_functionTools();
226978
+ init_subAgentExternalAgentRelations();
226873
226979
  init_subAgentRelations();
226874
226980
  init_subAgents();
226875
226981
  init_tools();
@@ -226877,7 +226983,7 @@ var init_agents = __esm({
226877
226983
  });
226878
226984
 
226879
226985
  // ../packages/agents-core/src/data-access/apiKeys.ts
226880
- 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";
226881
226987
  var init_apiKeys2 = __esm({
226882
226988
  "../packages/agents-core/src/data-access/apiKeys.ts"() {
226883
226989
  "use strict";
@@ -227891,10 +227997,10 @@ var require_codegen = __commonJS({
227891
227997
  }
227892
227998
  exports.not = not2;
227893
227999
  var andCode = mappend(exports.operators.AND);
227894
- function and20(...args) {
228000
+ function and21(...args) {
227895
228001
  return args.reduce(andCode);
227896
228002
  }
227897
- exports.and = and20;
228003
+ exports.and = and21;
227898
228004
  var orCode = mappend(exports.operators.OR);
227899
228005
  function or(...args) {
227900
228006
  return args.reduce(orCode);
@@ -229055,20 +229161,20 @@ var require_resolve2 = __commonJS({
229055
229161
  return false;
229056
229162
  }
229057
229163
  function countKeys(schema) {
229058
- let count16 = 0;
229164
+ let count17 = 0;
229059
229165
  for (const key in schema) {
229060
229166
  if (key === "$ref")
229061
229167
  return Infinity;
229062
- count16++;
229168
+ count17++;
229063
229169
  if (SIMPLE_INLINED.has(key))
229064
229170
  continue;
229065
229171
  if (typeof schema[key] == "object") {
229066
- (0, util_1.eachItem)(schema[key], (sch) => count16 += countKeys(sch));
229172
+ (0, util_1.eachItem)(schema[key], (sch) => count17 += countKeys(sch));
229067
229173
  }
229068
- if (count16 === Infinity)
229174
+ if (count17 === Infinity)
229069
229175
  return Infinity;
229070
229176
  }
229071
- return count16;
229177
+ return count17;
229072
229178
  }
229073
229179
  function getFullPath(resolver, id = "", normalize) {
229074
229180
  if (normalize !== false)
@@ -232174,8 +232280,8 @@ var require_contains2 = __commonJS({
232174
232280
  cxt.result(valid, () => cxt.reset());
232175
232281
  function validateItemsWithCount() {
232176
232282
  const schValid = gen.name("_valid");
232177
- const count16 = gen.let("count", 0);
232178
- validateItems(schValid, () => gen.if(schValid, () => checkLimits(count16)));
232283
+ const count17 = gen.let("count", 0);
232284
+ validateItems(schValid, () => gen.if(schValid, () => checkLimits(count17)));
232179
232285
  }
232180
232286
  function validateItems(_valid, block) {
232181
232287
  gen.forRange("i", 0, len, (i2) => {
@@ -232188,16 +232294,16 @@ var require_contains2 = __commonJS({
232188
232294
  block();
232189
232295
  });
232190
232296
  }
232191
- function checkLimits(count16) {
232192
- gen.code((0, codegen_1._)`${count16}++`);
232297
+ function checkLimits(count17) {
232298
+ gen.code((0, codegen_1._)`${count17}++`);
232193
232299
  if (max === void 0) {
232194
- 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());
232195
232301
  } else {
232196
- 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());
232197
232303
  if (min === 1)
232198
232304
  gen.assign(valid, true);
232199
232305
  else
232200
- gen.if((0, codegen_1._)`${count16} >= ${min}`, () => gen.assign(valid, true));
232306
+ gen.if((0, codegen_1._)`${count17} >= ${min}`, () => gen.assign(valid, true));
232201
232307
  }
232202
232308
  }
232203
232309
  }
@@ -233371,7 +233477,7 @@ var init_props_validation = __esm({
233371
233477
  });
233372
233478
 
233373
233479
  // ../packages/agents-core/src/data-access/artifactComponents.ts
233374
- 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";
233375
233481
  var init_artifactComponents = __esm({
233376
233482
  "../packages/agents-core/src/data-access/artifactComponents.ts"() {
233377
233483
  "use strict";
@@ -233383,7 +233489,7 @@ var init_artifactComponents = __esm({
233383
233489
  });
233384
233490
 
233385
233491
  // ../packages/agents-core/src/data-access/contextCache.ts
233386
- import { and as and12, eq as eq12 } from "drizzle-orm";
233492
+ import { and as and13, eq as eq13 } from "drizzle-orm";
233387
233493
  var init_contextCache = __esm({
233388
233494
  "../packages/agents-core/src/data-access/contextCache.ts"() {
233389
233495
  "use strict";
@@ -233394,7 +233500,7 @@ var init_contextCache = __esm({
233394
233500
  });
233395
233501
 
233396
233502
  // ../packages/agents-core/src/data-access/conversations.ts
233397
- 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";
233398
233504
  var init_conversations2 = __esm({
233399
233505
  "../packages/agents-core/src/data-access/conversations.ts"() {
233400
233506
  "use strict";
@@ -233413,7 +233519,7 @@ var init_preview_validation = __esm({
233413
233519
  });
233414
233520
 
233415
233521
  // ../packages/agents-core/src/data-access/dataComponents.ts
233416
- 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";
233417
233523
  var init_dataComponents = __esm({
233418
233524
  "../packages/agents-core/src/data-access/dataComponents.ts"() {
233419
233525
  "use strict";
@@ -233435,21 +233541,21 @@ var init_agentFull = __esm({
233435
233541
  });
233436
233542
 
233437
233543
  // ../packages/agents-core/src/data-access/agentFull.ts
233438
- 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";
233439
233545
  var init_agentFull2 = __esm({
233440
233546
  "../packages/agents-core/src/data-access/agentFull.ts"() {
233441
233547
  "use strict";
233442
233548
  init_esm_shims();
233443
- init_conversations();
233444
233549
  init_schema();
233550
+ init_conversations();
233445
233551
  init_agentFull();
233446
233552
  init_agents();
233447
233553
  init_artifactComponents();
233448
233554
  init_contextConfigs();
233449
233555
  init_dataComponents();
233450
- init_externalAgents();
233451
233556
  init_functions();
233452
233557
  init_functionTools();
233558
+ init_subAgentExternalAgentRelations();
233453
233559
  init_subAgentRelations();
233454
233560
  init_subAgents();
233455
233561
  init_tools();
@@ -233457,7 +233563,7 @@ var init_agentFull2 = __esm({
233457
233563
  });
233458
233564
 
233459
233565
  // ../packages/agents-core/src/data-access/ledgerArtifacts.ts
233460
- 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";
233461
233567
  var init_ledgerArtifacts = __esm({
233462
233568
  "../packages/agents-core/src/data-access/ledgerArtifacts.ts"() {
233463
233569
  "use strict";
@@ -233468,7 +233574,7 @@ var init_ledgerArtifacts = __esm({
233468
233574
  });
233469
233575
 
233470
233576
  // ../packages/agents-core/src/data-access/messages.ts
233471
- 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";
233472
233578
  var init_messages = __esm({
233473
233579
  "../packages/agents-core/src/data-access/messages.ts"() {
233474
233580
  "use strict";
@@ -233478,7 +233584,7 @@ var init_messages = __esm({
233478
233584
  });
233479
233585
 
233480
233586
  // ../packages/agents-core/src/data-access/projects.ts
233481
- 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";
233482
233588
  var init_projects = __esm({
233483
233589
  "../packages/agents-core/src/data-access/projects.ts"() {
233484
233590
  "use strict";
@@ -233499,6 +233605,7 @@ var init_projectFull = __esm({
233499
233605
  init_artifactComponents();
233500
233606
  init_credentialReferences();
233501
233607
  init_dataComponents();
233608
+ init_externalAgents();
233502
233609
  init_functions();
233503
233610
  init_projects();
233504
233611
  init_tools();
@@ -233507,7 +233614,7 @@ var init_projectFull = __esm({
233507
233614
  });
233508
233615
 
233509
233616
  // ../packages/agents-core/src/data-access/tasks.ts
233510
- import { and as and19, eq as eq19 } from "drizzle-orm";
233617
+ import { and as and20, eq as eq20 } from "drizzle-orm";
233511
233618
  var init_tasks = __esm({
233512
233619
  "../packages/agents-core/src/data-access/tasks.ts"() {
233513
233620
  "use strict";
@@ -233547,6 +233654,7 @@ var init_data_access = __esm({
233547
233654
  init_messages();
233548
233655
  init_projectFull();
233549
233656
  init_projects();
233657
+ init_subAgentExternalAgentRelations();
233550
233658
  init_subAgentRelations();
233551
233659
  init_subAgents();
233552
233660
  init_tasks();
@@ -233694,27 +233802,27 @@ var init_memory_store = __esm({
233694
233802
  }
233695
233803
  });
233696
233804
 
233697
- // ../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
233698
233806
  var init_version2 = __esm({
233699
- "../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"() {
233700
233808
  "use strict";
233701
233809
  init_esm_shims();
233702
233810
  }
233703
233811
  });
233704
233812
 
233705
- // ../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
233706
233814
  var init_utils2 = __esm({
233707
- "../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"() {
233708
233816
  "use strict";
233709
233817
  init_esm_shims();
233710
233818
  init_version2();
233711
233819
  }
233712
233820
  });
233713
233821
 
233714
- // ../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
233715
233823
  var SyncConfigType;
233716
233824
  var init_types4 = __esm({
233717
- "../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"() {
233718
233826
  "use strict";
233719
233827
  init_esm_shims();
233720
233828
  (function(SyncConfigType2) {
@@ -233724,12 +233832,12 @@ var init_types4 = __esm({
233724
233832
  }
233725
233833
  });
233726
233834
 
233727
- // ../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
233728
233836
  import crypto5 from "crypto";
233729
233837
  import https from "https";
233730
233838
  var defaultHttpsAgent;
233731
233839
  var init_dist6 = __esm({
233732
- "../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"() {
233733
233841
  "use strict";
233734
233842
  init_esm_shims();
233735
233843
  init_utils2();
@@ -233793,11 +233901,11 @@ var require_main = __commonJS({
233793
233901
  const env3 = { ...runningParsed, ...processEnv };
233794
233902
  const regex = /(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;
233795
233903
  let result = value;
233796
- let match;
233904
+ let match2;
233797
233905
  const seen = /* @__PURE__ */ new Set();
233798
- while ((match = regex.exec(result)) !== null) {
233906
+ while ((match2 = regex.exec(result)) !== null) {
233799
233907
  seen.add(result);
233800
- const [template, bracedExpression, unbracedExpression] = match;
233908
+ const [template, bracedExpression, unbracedExpression] = match2;
233801
233909
  const expression = bracedExpression || unbracedExpression;
233802
233910
  const opRegex = /(:\+|\+|:-|-)/;
233803
233911
  const opMatch = expression.match(opRegex);
@@ -234301,6 +234409,338 @@ var init_config = __esm({
234301
234409
  }
234302
234410
  });
234303
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
+
234304
234744
  // src/commands/pull.placeholder-system.ts
234305
234745
  import { randomBytes as randomBytes2 } from "crypto";
234306
234746
  import { jsonSchemaToZod } from "json-schema-to-zod";
@@ -234503,6 +234943,7 @@ __export(pull_llm_generate_exports, {
234503
234943
  generateDataComponentFile: () => generateDataComponentFile,
234504
234944
  generateEnvironmentFileTemplate: () => generateEnvironmentFileTemplate,
234505
234945
  generateEnvironmentFiles: () => generateEnvironmentFiles,
234946
+ generateExternalAgentFile: () => generateExternalAgentFile,
234506
234947
  generateIndexFile: () => generateIndexFile,
234507
234948
  generateStatusComponentFile: () => generateStatusComponentFile,
234508
234949
  generateTextWithPlaceholders: () => generateTextWithPlaceholders,
@@ -234554,7 +234995,9 @@ function detectAvailableProvider() {
234554
234995
  if (googleKey) {
234555
234996
  return "google";
234556
234997
  }
234557
- 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
+ );
234558
235001
  }
234559
235002
  function getDefaultModelForProvider(provider) {
234560
235003
  switch (provider) {
@@ -234726,7 +235169,7 @@ Generate ONLY the TypeScript code without any markdown or explanations.`;
234726
235169
  );
234727
235170
  writeFileSync3(outputPath, cleanGeneratedCode(text4));
234728
235171
  }
234729
- function generateImportMappings(toolFilenames, componentFilenames) {
235172
+ function generateImportMappings(toolFilenames, componentFilenames, externalAgentFilenames) {
234730
235173
  let result = "";
234731
235174
  if (toolFilenames && toolFilenames.size > 0) {
234732
235175
  result += "TOOLS (use exact import paths):\n";
@@ -234751,9 +235194,18 @@ function generateImportMappings(toolFilenames, componentFilenames) {
234751
235194
  `;
234752
235195
  }
234753
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);
234754
235206
  return result;
234755
235207
  }
234756
- 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) {
234757
235209
  const model = createModel(modelSettings);
234758
235210
  const promptTemplate = `Generate a TypeScript file for an Inkeep agent.
234759
235211
 
@@ -234763,7 +235215,7 @@ AGENT DATA:
234763
235215
  AGENT ID: ${agentId}
234764
235216
 
234765
235217
  ${toolFilenames || componentFilenames ? `IMPORT PATH MAPPINGS (CRITICAL - USE EXACT PATHS):
234766
- ${generateImportMappings(toolFilenames, componentFilenames)}
235218
+ ${generateImportMappings(toolFilenames, componentFilenames, externalAgentFilenames)}
234767
235219
 
234768
235220
  !!! WARNING: Entity IDs \u2260 File Paths !!!
234769
235221
  - Entity IDs may use underscores or different naming
@@ -234796,6 +235248,7 @@ REQUIREMENTS:
234796
235248
  2. Define each agent using the agent() function following the type definitions provided above
234797
235249
  3. Create the agent using agent() with proper structure
234798
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.
234799
235252
  4. CRITICAL: Template Literals vs Raw Code:
234800
235253
  - For STRING VALUES: ALWAYS use template literals with backticks: \`string content\`
234801
235254
  - This includes: prompt, description, query, url, method, body, defaultValue, etc.
@@ -234839,12 +235292,13 @@ prompt: \`<{{subAgents.facts.prompt.abc12345}}>\`
234839
235292
  prompt: '<{{subAgents.facts.prompt.abc12345}}>'
234840
235293
 
234841
235294
  FULL EXAMPLE:
234842
- import { agent, agent } from '@inkeep/agents-sdk';
235295
+ import { agent } from '@inkeep/agents-sdk';
234843
235296
  import { contextConfig, fetchDefinition, headers } from '@inkeep/agents-core';
234844
235297
  import { userProfile } from '../data-components/user-profile';
234845
235298
  import { searchTool } from '../tools/search-tool';
234846
235299
  import { weatherTool } from '../tools/weather-tool';
234847
235300
  import { toolSummary } from '../status-components/tool-summary';
235301
+ import { externalHelperAgent } from '../agents/external-helper-agent';
234848
235302
  import { progressStatus } from '../status-components/progress-status';
234849
235303
  import { z } from 'zod';
234850
235304
 
@@ -234885,6 +235339,7 @@ const routerAgent = agent({
234885
235339
  name: 'Router Agent',
234886
235340
  prompt: \`Route requests to appropriate agents using \${supportAgentContext.toTemplate('supportDescription.description')} for the user \${supportAgentHeaders.toTemplate('userId')}\`,
234887
235341
  canTransferTo: () => [qaAgent]
235342
+ canDelegateTo: () => [externalHelperAgent.with({ headers: { 'X-API-Key': '123' } })],
234888
235343
  });
234889
235344
 
234890
235345
  const qaAgent = agent({
@@ -234898,6 +235353,7 @@ Follow these rules:
234898
235353
  - Use the user's name \${supportAgentHeaders.toTemplate('userId')} when applicable
234899
235354
  - Use available tools\`,
234900
235355
  canUse: () => [searchTool, weatherTool],
235356
+ canDelegateTo: () => [externalHelperAgent],
234901
235357
  selectedTools: {
234902
235358
  [searchTool.id]: ['search_web', 'search_docs'],
234903
235359
  [weatherTool.id]: ['get_forecast']
@@ -235321,6 +235777,61 @@ Generate ONLY the TypeScript code without any markdown or explanations.`;
235321
235777
  );
235322
235778
  writeFileSync3(outputPath, cleanGeneratedCode(text4));
235323
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
+ }
235324
235835
  function generateEnvironmentFileTemplate(environmentsDir, environment, credentials) {
235325
235836
  const { writeFileSync: writeFileSync7 } = require3("node:fs");
235326
235837
  const { join: join14 } = require3("node:path");
@@ -235341,9 +235852,11 @@ function generateEnvironmentFileTemplate(environmentsDir, environment, credentia
235341
235852
  `retrievalParams: ${JSON.stringify(cred.retrievalParams, null, 6).replace(/\n/g, "\n ")}`
235342
235853
  );
235343
235854
  }
235344
- credentialEntries.push(` ${varName}: credential({
235855
+ credentialEntries.push(
235856
+ ` ${varName}: credential({
235345
235857
  ${params.join(",\n ")}
235346
- })`);
235858
+ })`
235859
+ );
235347
235860
  }
235348
235861
  credentialsCode = `
235349
235862
  ${credentialEntries.join(",\n")}
@@ -235369,9 +235882,9 @@ function updateEnvironmentIndexTemplate(environmentsDir, newEnvironment) {
235369
235882
  if (existsSync12(indexPath)) {
235370
235883
  const existingContent = readFileSync8(indexPath, "utf-8");
235371
235884
  const importRegex = /import\s+{\s*(\w+)\s*}\s+from\s+['"]\.\/([\w-]+)\.env['"];?/g;
235372
- let match;
235373
- while ((match = importRegex.exec(existingContent)) !== null) {
235374
- const envName = match[2];
235885
+ let match2;
235886
+ while ((match2 = importRegex.exec(existingContent)) !== null) {
235887
+ const envName = match2[2];
235375
235888
  if (!existingEnvironments.includes(envName)) {
235376
235889
  existingEnvironments.push(envName);
235377
235890
  }
@@ -235441,9 +235954,9 @@ async function updateEnvironmentIndex(environmentsDir, environment) {
235441
235954
  if (existsSync12(indexPath)) {
235442
235955
  existingContent = readFileSync8(indexPath, "utf-8");
235443
235956
  const importRegex = /import\s+{\s*(\w+)\s*}\s+from\s+['"]\.\/([\w-]+)\.env['"];?/g;
235444
- let match;
235445
- while ((match = importRegex.exec(existingContent)) !== null) {
235446
- const envName = match[2];
235957
+ let match2;
235958
+ while ((match2 = importRegex.exec(existingContent)) !== null) {
235959
+ const envName = match2[2];
235447
235960
  if (!existingEnvironments.includes(envName)) {
235448
235961
  existingEnvironments.push(envName);
235449
235962
  }
@@ -235504,7 +236017,7 @@ export const myProject = project({
235504
236017
  });
235505
236018
  `;
235506
236019
  break;
235507
- case "agent":
236020
+ case "agent": {
235508
236021
  const importMappings = spec.toolFilenames || spec.componentFilenames ? `IMPORT PATH MAPPINGS (CRITICAL - USE EXACT PATHS):
235509
236022
  ${generateImportMappings(spec.toolFilenames, spec.componentFilenames)}
235510
236023
 
@@ -235546,6 +236059,7 @@ ${importMappings}REQUIREMENTS FOR AGENT FILE:
235546
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()
235547
236060
  `;
235548
236061
  break;
236062
+ }
235549
236063
  case "tool":
235550
236064
  fileSpecificInstructions = `
235551
236065
  REQUIREMENTS FOR TOOL FILE:
@@ -235557,6 +236071,16 @@ REQUIREMENTS FOR TOOL FILE:
235557
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')
235558
236072
  7. TRANSPORT CONFIG: If config.mcp.transport exists, extract it as a transport property (not nested in config)
235559
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')
235560
236084
  `;
235561
236085
  break;
235562
236086
  case "data_component":
@@ -236067,325 +236591,6 @@ import { weatherAgent } from './agent/weather-agent';
236067
236591
  }
236068
236592
  });
236069
236593
 
236070
- // src/codegen/variable-name-registry.ts
236071
- var variable_name_registry_exports = {};
236072
- __export(variable_name_registry_exports, {
236073
- DEFAULT_NAMING_CONVENTIONS: () => DEFAULT_NAMING_CONVENTIONS,
236074
- VariableNameGenerator: () => VariableNameGenerator,
236075
- collectAllEntities: () => collectAllEntities
236076
- });
236077
- function collectAllEntities(projectData) {
236078
- const entities = [];
236079
- entities.push({ id: projectData.id, type: "project", data: projectData });
236080
- if (projectData.agents) {
236081
- for (const [agentId, agentData] of Object.entries(projectData.agents)) {
236082
- entities.push({ id: agentId, type: "agent", data: agentData });
236083
- const agentObj = agentData;
236084
- if (agentObj.subAgents) {
236085
- for (const [subAgentId, subAgentData] of Object.entries(agentObj.subAgents)) {
236086
- entities.push({ id: subAgentId, type: "subAgent", data: subAgentData });
236087
- }
236088
- }
236089
- }
236090
- }
236091
- if (projectData.tools) {
236092
- for (const [toolId, toolData] of Object.entries(projectData.tools)) {
236093
- entities.push({ id: toolId, type: "tool", data: toolData });
236094
- }
236095
- }
236096
- if (projectData.dataComponents) {
236097
- for (const [compId, compData] of Object.entries(projectData.dataComponents)) {
236098
- entities.push({ id: compId, type: "dataComponent", data: compData });
236099
- }
236100
- }
236101
- if (projectData.artifactComponents) {
236102
- for (const [compId, compData] of Object.entries(projectData.artifactComponents)) {
236103
- entities.push({ id: compId, type: "artifactComponent", data: compData });
236104
- }
236105
- }
236106
- if (projectData.agents) {
236107
- for (const [_agentId, agentData] of Object.entries(projectData.agents)) {
236108
- const agentObj = agentData;
236109
- if (agentObj.statusUpdates?.statusComponents) {
236110
- for (const statusComp of agentObj.statusUpdates.statusComponents) {
236111
- if (statusComp.type) {
236112
- entities.push({ id: statusComp.type, type: "statusComponent" });
236113
- }
236114
- }
236115
- }
236116
- }
236117
- }
236118
- const credentialReferences2 = /* @__PURE__ */ new Set();
236119
- if (projectData.credentialReferences) {
236120
- for (const credId of Object.keys(projectData.credentialReferences)) {
236121
- credentialReferences2.add(credId);
236122
- }
236123
- }
236124
- if (projectData.tools) {
236125
- for (const [_toolId, toolData] of Object.entries(projectData.tools)) {
236126
- const tool2 = toolData;
236127
- if (tool2.credentialReferenceId) {
236128
- credentialReferences2.add(tool2.credentialReferenceId);
236129
- }
236130
- }
236131
- }
236132
- if (projectData.externalAgents) {
236133
- for (const [_agentId, agentData] of Object.entries(projectData.externalAgents)) {
236134
- const agent = agentData;
236135
- if (agent.credentialReferenceId) {
236136
- credentialReferences2.add(agent.credentialReferenceId);
236137
- }
236138
- }
236139
- }
236140
- if (projectData.agents) {
236141
- for (const [_agentId, agentData] of Object.entries(projectData.agents)) {
236142
- const agent = agentData;
236143
- if (agent.contextConfig?.headers?.credentialReferenceId) {
236144
- credentialReferences2.add(agent.contextConfig.headers.credentialReferenceId);
236145
- }
236146
- if (agent.contextConfig?.contextVariables) {
236147
- for (const [_varId, varData] of Object.entries(agent.contextConfig.contextVariables)) {
236148
- const contextVar = varData;
236149
- if (contextVar.credentialReferenceId) {
236150
- credentialReferences2.add(contextVar.credentialReferenceId);
236151
- }
236152
- }
236153
- }
236154
- if (agent.subAgents) {
236155
- for (const [_subAgentId, subAgentData] of Object.entries(agent.subAgents)) {
236156
- const subAgent = subAgentData;
236157
- if (subAgent.contextConfig?.headers?.credentialReferenceId) {
236158
- credentialReferences2.add(subAgent.contextConfig.headers.credentialReferenceId);
236159
- }
236160
- if (subAgent.contextConfig?.contextVariables) {
236161
- for (const [_varId, varData] of Object.entries(subAgent.contextConfig.contextVariables)) {
236162
- const contextVar = varData;
236163
- if (contextVar.credentialReferenceId) {
236164
- credentialReferences2.add(contextVar.credentialReferenceId);
236165
- }
236166
- }
236167
- }
236168
- }
236169
- }
236170
- }
236171
- }
236172
- return entities;
236173
- }
236174
- var DEFAULT_NAMING_CONVENTIONS, VariableNameGenerator;
236175
- var init_variable_name_registry = __esm({
236176
- "src/codegen/variable-name-registry.ts"() {
236177
- "use strict";
236178
- init_esm_shims();
236179
- DEFAULT_NAMING_CONVENTIONS = {
236180
- projectSuffix: "Project",
236181
- agentSuffix: "Agent",
236182
- subAgentSuffix: "SubAgent",
236183
- toolSuffix: null,
236184
- // Usually no suffix needed
236185
- dataComponentSuffix: null,
236186
- artifactComponentSuffix: null,
236187
- statusComponentSuffix: null,
236188
- credentialSuffix: null,
236189
- environmentSuffix: null
236190
- // No suffix needed for environments
236191
- };
236192
- VariableNameGenerator = class {
236193
- registry;
236194
- conventions;
236195
- conflicts;
236196
- constructor(conventions = DEFAULT_NAMING_CONVENTIONS) {
236197
- this.registry = {
236198
- projects: /* @__PURE__ */ new Map(),
236199
- agents: /* @__PURE__ */ new Map(),
236200
- subAgents: /* @__PURE__ */ new Map(),
236201
- tools: /* @__PURE__ */ new Map(),
236202
- dataComponents: /* @__PURE__ */ new Map(),
236203
- artifactComponents: /* @__PURE__ */ new Map(),
236204
- statusComponents: /* @__PURE__ */ new Map(),
236205
- credentials: /* @__PURE__ */ new Map(),
236206
- environments: /* @__PURE__ */ new Map(),
236207
- usedNames: /* @__PURE__ */ new Map()
236208
- };
236209
- this.conventions = conventions;
236210
- this.conflicts = [];
236211
- }
236212
- /**
236213
- * Generate unique variable name for an entity
236214
- * Ensures no conflicts across all entity types
236215
- */
236216
- generateVariableName(id, entityType, entityData) {
236217
- const registryMap = this.getRegistryMap(entityType);
236218
- const existing = registryMap.get(id);
236219
- if (existing) {
236220
- return existing;
236221
- }
236222
- let baseName;
236223
- if (entityType === "tool" && entityData?.name && this.isRandomId(id)) {
236224
- baseName = this.idToVariableName(entityData.name);
236225
- } else {
236226
- baseName = this.idToVariableName(id);
236227
- }
236228
- if (!this.registry.usedNames.has(baseName)) {
236229
- this.register(id, baseName, entityType);
236230
- return baseName;
236231
- }
236232
- const existingEntity = this.registry.usedNames.get(baseName);
236233
- if (existingEntity) {
236234
- const existingConflict = this.conflicts.find((c2) => c2.id === id);
236235
- if (existingConflict) {
236236
- existingConflict.types.push(entityType);
236237
- } else {
236238
- this.conflicts.push({
236239
- id,
236240
- types: [existingEntity.type, entityType],
236241
- resolvedNames: {
236242
- [existingEntity.type]: baseName
236243
- }
236244
- });
236245
- }
236246
- }
236247
- const suffix = this.getSuffixForType(entityType);
236248
- const uniqueName = baseName + suffix;
236249
- let finalName = uniqueName;
236250
- let counter = 2;
236251
- while (this.registry.usedNames.has(finalName)) {
236252
- finalName = `${uniqueName}${counter}`;
236253
- counter++;
236254
- }
236255
- this.register(id, finalName, entityType);
236256
- const conflict = this.conflicts.find((c2) => c2.id === id);
236257
- if (conflict) {
236258
- conflict.resolvedNames[entityType] = finalName;
236259
- }
236260
- return finalName;
236261
- }
236262
- /**
236263
- * Register an existing variable name (from detected patterns)
236264
- */
236265
- register(id, variableName, entityType) {
236266
- const registryMap = this.getRegistryMap(entityType);
236267
- registryMap.set(id, variableName);
236268
- this.registry.usedNames.set(variableName, { id, type: entityType });
236269
- }
236270
- /**
236271
- * Get the registry for lookup
236272
- */
236273
- getRegistry() {
236274
- return this.registry;
236275
- }
236276
- /**
236277
- * Get all conflicts that were resolved
236278
- */
236279
- getConflicts() {
236280
- return this.conflicts;
236281
- }
236282
- /**
236283
- * Convert ID to camelCase variable name
236284
- */
236285
- idToVariableName(id) {
236286
- if (this.isRandomId(id)) {
236287
- return id;
236288
- }
236289
- const parts = id.split(/[-_]/);
236290
- const camelCase = parts.map((part, index2) => {
236291
- if (index2 === 0) {
236292
- return part.toLowerCase();
236293
- }
236294
- return part.charAt(0).toUpperCase() + part.slice(1).toLowerCase();
236295
- }).join("");
236296
- return camelCase;
236297
- }
236298
- /**
236299
- * Check if an ID looks random/UUID-like
236300
- */
236301
- isRandomId(id) {
236302
- if (!id.includes("-") && !id.includes("_")) {
236303
- return /[0-9]/.test(id) || /[A-Z]/.test(id);
236304
- }
236305
- return false;
236306
- }
236307
- /**
236308
- * Generate filename from entity data (for file naming)
236309
- */
236310
- generateFileName(id, entityType, entityData) {
236311
- let baseName;
236312
- if (entityType === "tool" && entityData?.name && this.isRandomId(id)) {
236313
- baseName = this.nameToFileName(entityData.name);
236314
- } else {
236315
- baseName = this.idToFileName(id);
236316
- }
236317
- return baseName;
236318
- }
236319
- /**
236320
- * Convert name to kebab-case filename
236321
- */
236322
- nameToFileName(name) {
236323
- return name.replace(/[^\w\s-]/g, "").trim().replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
236324
- }
236325
- /**
236326
- * Convert ID to kebab-case filename
236327
- */
236328
- idToFileName(id) {
236329
- return id.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
236330
- }
236331
- /**
236332
- * Get appropriate suffix for entity type
236333
- */
236334
- getSuffixForType(entityType) {
236335
- switch (entityType) {
236336
- case "project":
236337
- return this.conventions.projectSuffix;
236338
- case "agent":
236339
- return this.conventions.agentSuffix;
236340
- case "subAgent":
236341
- return this.conventions.subAgentSuffix;
236342
- case "tool":
236343
- return this.conventions.toolSuffix || "";
236344
- case "dataComponent":
236345
- return this.conventions.dataComponentSuffix || "";
236346
- case "artifactComponent":
236347
- return this.conventions.artifactComponentSuffix || "";
236348
- case "statusComponent":
236349
- return this.conventions.statusComponentSuffix || "";
236350
- case "credential":
236351
- return this.conventions.credentialSuffix || "";
236352
- case "environment":
236353
- return this.conventions.environmentSuffix || "";
236354
- default:
236355
- return "";
236356
- }
236357
- }
236358
- /**
236359
- * Get the appropriate registry map for an entity type
236360
- */
236361
- getRegistryMap(entityType) {
236362
- switch (entityType) {
236363
- case "project":
236364
- return this.registry.projects;
236365
- case "agent":
236366
- return this.registry.agents;
236367
- case "subAgent":
236368
- return this.registry.subAgents;
236369
- case "tool":
236370
- return this.registry.tools;
236371
- case "dataComponent":
236372
- return this.registry.dataComponents;
236373
- case "artifactComponent":
236374
- return this.registry.artifactComponents;
236375
- case "statusComponent":
236376
- return this.registry.statusComponents;
236377
- case "credential":
236378
- return this.registry.credentials;
236379
- case "environment":
236380
- return this.registry.environments;
236381
- default:
236382
- throw new Error(`Unknown entity type: ${entityType}`);
236383
- }
236384
- }
236385
- };
236386
- }
236387
- });
236388
-
236389
236594
  // src/codegen/pattern-analyzer.ts
236390
236595
  var pattern_analyzer_exports = {};
236391
236596
  __export(pattern_analyzer_exports, {
@@ -236422,6 +236627,7 @@ function analyzeFileStructure(projectDir) {
236422
236627
  const hasDataComponentsDirectory = existsSync7(join8(projectDir, "data-components"));
236423
236628
  const hasArtifactComponentsDirectory = existsSync7(join8(projectDir, "artifact-components"));
236424
236629
  const hasEnvironmentsDirectory = existsSync7(join8(projectDir, "environments"));
236630
+ const hasExternalAgentsDirectory = existsSync7(join8(projectDir, "external-agents"));
236425
236631
  let toolsLocation = "unknown";
236426
236632
  if (hasToolsDirectory) {
236427
236633
  toolsLocation = "separate";
@@ -236448,7 +236654,8 @@ function analyzeFileStructure(projectDir) {
236448
236654
  hasAgentsDirectory,
236449
236655
  hasDataComponentsDirectory,
236450
236656
  hasArtifactComponentsDirectory,
236451
- hasEnvironmentsDirectory
236657
+ hasEnvironmentsDirectory,
236658
+ hasExternalAgentsDirectory
236452
236659
  };
236453
236660
  }
236454
236661
  function detectFileNamingConvention(files) {
@@ -236531,13 +236738,14 @@ function extractVariableMappings(code, filePath) {
236531
236738
  "tool",
236532
236739
  "tool",
236533
236740
  "dataComponent",
236534
- "artifactComponent"
236741
+ "artifactComponent",
236742
+ "externalAgent"
236535
236743
  ];
236536
236744
  patterns.forEach((pattern, index2) => {
236537
236745
  const matches = code.matchAll(pattern);
236538
- for (const match of matches) {
236539
- const variableName = match[1];
236540
- const id = match[2] || match[3];
236746
+ for (const match2 of matches) {
236747
+ const variableName = match2[1];
236748
+ const id = match2[2] || match2[3];
236541
236749
  if (variableName && id) {
236542
236750
  mappings.push({
236543
236751
  id,
@@ -236625,9 +236833,9 @@ function mostCommon(arr) {
236625
236833
  }
236626
236834
  let maxCount = 0;
236627
236835
  let mostCommonItem = null;
236628
- for (const [item, count16] of counts.entries()) {
236629
- if (count16 > maxCount) {
236630
- maxCount = count16;
236836
+ for (const [item, count17] of counts.entries()) {
236837
+ if (count17 > maxCount) {
236838
+ maxCount = count17;
236631
236839
  mostCommonItem = item;
236632
236840
  }
236633
236841
  }
@@ -236693,6 +236901,7 @@ function displayPlanSummary(plan) {
236693
236901
  dataComponent: [],
236694
236902
  artifactComponent: [],
236695
236903
  statusComponent: [],
236904
+ externalAgent: [],
236696
236905
  environment: []
236697
236906
  };
236698
236907
  for (const file of plan.files) {
@@ -236727,6 +236936,12 @@ function displayPlanSummary(plan) {
236727
236936
  }
236728
236937
  }
236729
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
+ }
236730
236945
  if (filesByType.dataComponent.length > 0) {
236731
236946
  console.log(chalk8.gray("\n Data Components:"));
236732
236947
  for (const file of filesByType.dataComponent) {
@@ -236889,7 +237104,12 @@ async function generatePlan(projectData, patterns, modelSettings, createModel2,
236889
237104
  fileNameMappings.set(entity.id, fileName);
236890
237105
  }
236891
237106
  const model = createModel2(modelSettings);
236892
- const promptTemplate = createPlanningPromptTemplate(nameGenerator.getRegistry(), allEntities, fileNameMappings, targetEnvironment);
237107
+ const promptTemplate = createPlanningPromptTemplate(
237108
+ nameGenerator.getRegistry(),
237109
+ allEntities,
237110
+ fileNameMappings,
237111
+ targetEnvironment
237112
+ );
236893
237113
  const promptData = {
236894
237114
  projectData,
236895
237115
  patterns
@@ -236943,7 +237163,7 @@ CRITICAL RULES:
236943
237163
  1. TOOL TYPES - VERY IMPORTANT:
236944
237164
  - **Function Tools** (type: "function"): ALWAYS define INLINE within agent files using "inlineContent" array
236945
237165
  - **MCP Tools** (type: "mcp"): Create separate files in tools/ directory
236946
- - 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"
236947
237167
  - NEVER create file type "functionTool" - function tools go in "inlineContent" of agent files
236948
237168
 
236949
237169
  2. STATUS COMPONENTS - VERY IMPORTANT:
@@ -236976,6 +237196,7 @@ CRITICAL RULES:
236976
237196
  - data-components/ directory: Data component files
236977
237197
  - artifact-components/ directory: Artifact component files
236978
237198
  - status-components/ directory: Status component files
237199
+ - external-agents/ directory: External agent files
236979
237200
  - environments/ directory: Environment/credential files
236980
237201
  - index.ts: Main project file
236981
237202
 
@@ -237016,6 +237237,11 @@ OUTPUT FORMAT (JSON):
237016
237237
  "fromPath": "../tools/weather-api",
237017
237238
  "entityType": "tool"
237018
237239
  }
237240
+ {
237241
+ "variableName": "externalHelper",
237242
+ "fromPath": "../external-agents/external-helper",
237243
+ "entityType": "externalAgent"
237244
+ }
237019
237245
  ],
237020
237246
  "inlineContent": [
237021
237247
  {
@@ -237040,6 +237266,20 @@ OUTPUT FORMAT (JSON):
237040
237266
  "dependencies": [],
237041
237267
  "inlineContent": null
237042
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
+ },
237043
237283
  {
237044
237284
  "path": "status-components/tool-summary.ts",
237045
237285
  "type": "statusComponent",
@@ -237127,6 +237367,7 @@ function formatVariableMappings(registry2, allEntities) {
237127
237367
  dataComponent: [],
237128
237368
  artifactComponent: [],
237129
237369
  statusComponent: [],
237370
+ externalAgent: [],
237130
237371
  credential: [],
237131
237372
  environment: []
237132
237373
  };
@@ -237161,6 +237402,7 @@ function formatFileNameMappings(fileNameMappings, allEntities) {
237161
237402
  artifactComponent: [],
237162
237403
  statusComponent: [],
237163
237404
  credential: [],
237405
+ externalAgent: [],
237164
237406
  environment: []
237165
237407
  };
237166
237408
  for (const entity of allEntities) {
@@ -237208,6 +237450,8 @@ function getRegistryMap(registry2, entityType) {
237208
237450
  return registry2.artifactComponents;
237209
237451
  case "statusComponent":
237210
237452
  return registry2.statusComponents;
237453
+ case "externalAgent":
237454
+ return registry2.externalAgents;
237211
237455
  case "credential":
237212
237456
  return registry2.credentials;
237213
237457
  case "environment":
@@ -237366,6 +237610,9 @@ async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, deb
237366
237610
  case "statusComponent":
237367
237611
  batchType = "status_component";
237368
237612
  break;
237613
+ case "externalAgent":
237614
+ batchType = "external_agent";
237615
+ break;
237369
237616
  default:
237370
237617
  throw new Error(`Unknown file type for batch generation: ${fileInfo.type}`);
237371
237618
  }
@@ -237385,7 +237632,9 @@ async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, deb
237385
237632
  await generateAllFilesInBatch(fileSpecs, modelSettings, debug, reasoningConfig);
237386
237633
  }
237387
237634
  if (debug && environmentFiles.length > 0) {
237388
- 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
+ );
237389
237638
  }
237390
237639
  for (const envFile of environmentFiles) {
237391
237640
  const envStartTime = Date.now();
@@ -237431,6 +237680,13 @@ function extractDataForFile(fileInfo, projectData) {
237431
237680
  }
237432
237681
  return {};
237433
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
+ }
237434
237690
  case "dataComponent": {
237435
237691
  const compId = fileInfo.entities[0]?.id;
237436
237692
  if (compId && projectData.dataComponents) {
@@ -237567,7 +237823,9 @@ function extractDataForFile(fileInfo, projectData) {
237567
237823
  }
237568
237824
  }
237569
237825
  if (subAgent.contextConfig?.contextVariables) {
237570
- for (const [varId, varData] of Object.entries(subAgent.contextConfig.contextVariables)) {
237826
+ for (const [varId, varData] of Object.entries(
237827
+ subAgent.contextConfig.contextVariables
237828
+ )) {
237571
237829
  const contextVar = varData;
237572
237830
  if (contextVar.credentialReferenceId) {
237573
237831
  const credId = contextVar.credentialReferenceId;
@@ -238946,45 +239204,9 @@ ${table.toString()}`);
238946
239204
  init_esm_shims();
238947
239205
  import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync6 } from "fs";
238948
239206
  import { dirname as dirname5, join as join10, resolve as resolve4 } from "path";
238949
- import chalk9 from "chalk";
238950
239207
  import * as p7 from "@clack/prompts";
238951
- init_config();
238952
-
238953
- // src/utils/project-directory.ts
238954
- init_esm_shims();
238955
- import { existsSync as existsSync5 } from "fs";
238956
- import { join as join5, resolve as resolve3 } from "path";
238957
- import { findUp as findUp2 } from "find-up";
238958
- async function findProjectDirectory(projectId, configPath) {
238959
- if (configPath) {
238960
- const absoluteConfigPath = resolve3(process.cwd(), configPath);
238961
- if (existsSync5(absoluteConfigPath)) {
238962
- return resolve3(absoluteConfigPath, "..");
238963
- }
238964
- }
238965
- if (projectId) {
238966
- if (projectId.includes("/") || projectId.includes("\\")) {
238967
- const projectPath = resolve3(process.cwd(), projectId);
238968
- if (existsSync5(join5(projectPath, "inkeep.config.ts"))) {
238969
- return projectPath;
238970
- }
238971
- } else {
238972
- const projectPath = join5(process.cwd(), projectId);
238973
- if (existsSync5(join5(projectPath, "inkeep.config.ts"))) {
238974
- return projectPath;
238975
- }
238976
- }
238977
- return null;
238978
- }
238979
- const foundConfigPath = await findUp2("inkeep.config.ts");
238980
- if (foundConfigPath) {
238981
- return resolve3(foundConfigPath, "..");
238982
- }
238983
- return null;
238984
- }
238985
-
238986
- // src/commands/pull.ts
238987
- init_tsx_loader();
239208
+ import chalk9 from "chalk";
239209
+ init_variable_name_registry();
238988
239210
 
238989
239211
  // src/utils/background-version-check.ts
238990
239212
  init_esm_shims();
@@ -238992,16 +239214,16 @@ import chalk7 from "chalk";
238992
239214
 
238993
239215
  // src/utils/version-check.ts
238994
239216
  init_esm_shims();
238995
- import { existsSync as existsSync6, readFileSync as readFileSync2 } from "fs";
238996
- 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";
238997
239219
  import { fileURLToPath as fileURLToPath2 } from "url";
238998
239220
  var __filename2 = fileURLToPath2(import.meta.url);
238999
239221
  var __dirname2 = dirname4(__filename2);
239000
239222
  var DEFAULT_PACKAGE_NAME = "@inkeep/agents-cli";
239001
239223
  function getCurrentVersion() {
239002
- let packageJsonPath2 = join6(__dirname2, "..", "package.json");
239003
- if (!existsSync6(packageJsonPath2)) {
239004
- packageJsonPath2 = join6(__dirname2, "..", "..", "package.json");
239224
+ let packageJsonPath2 = join5(__dirname2, "..", "package.json");
239225
+ if (!existsSync5(packageJsonPath2)) {
239226
+ packageJsonPath2 = join5(__dirname2, "..", "..", "package.json");
239005
239227
  }
239006
239228
  const packageJson2 = JSON.parse(readFileSync2(packageJsonPath2, "utf-8"));
239007
239229
  return packageJson2.version;
@@ -239073,8 +239295,43 @@ function performBackgroundVersionCheck() {
239073
239295
  }
239074
239296
 
239075
239297
  // src/commands/pull.ts
239076
- init_pull_llm_generate();
239077
- 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();
239078
239335
  async function detectCurrentProject(debug = false) {
239079
239336
  const indexPath = join10(process.cwd(), "index.ts");
239080
239337
  if (debug) {
@@ -239294,6 +239551,7 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
239294
239551
  const artifactComponentsDir = join10(projectRoot, "artifact-components");
239295
239552
  const statusComponentsDir = join10(projectRoot, "status-components");
239296
239553
  const environmentsDir = join10(projectRoot, "environments");
239554
+ const externalAgentsDir = join10(projectRoot, "external-agents");
239297
239555
  ensureDirectoryExists(projectRoot);
239298
239556
  ensureDirectoryExists(agentsDir);
239299
239557
  ensureDirectoryExists(toolsDir);
@@ -239301,6 +239559,7 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
239301
239559
  ensureDirectoryExists(artifactComponentsDir);
239302
239560
  ensureDirectoryExists(statusComponentsDir);
239303
239561
  ensureDirectoryExists(environmentsDir);
239562
+ ensureDirectoryExists(externalAgentsDir);
239304
239563
  return {
239305
239564
  projectRoot,
239306
239565
  agentsDir,
@@ -239308,7 +239567,8 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
239308
239567
  dataComponentsDir,
239309
239568
  artifactComponentsDir,
239310
239569
  statusComponentsDir,
239311
- environmentsDir
239570
+ environmentsDir,
239571
+ externalAgentsDir
239312
239572
  };
239313
239573
  }
239314
239574
  async function pullProjectCommand(options) {
@@ -239317,12 +239577,14 @@ async function pullProjectCommand(options) {
239317
239577
  try {
239318
239578
  const { detectAvailableProvider: detectAvailableProvider2 } = await Promise.resolve().then(() => (init_pull_llm_generate(), pull_llm_generate_exports));
239319
239579
  provider = detectAvailableProvider2();
239320
- console.log(chalk9.gray(`
239321
- \u{1F916} Using ${provider.charAt(0).toUpperCase() + provider.slice(1)} for code generation`));
239322
- } catch (error) {
239323
- console.error(
239324
- 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
+ )
239325
239585
  );
239586
+ } catch (error) {
239587
+ console.error(chalk9.red("\n\u274C Error: No LLM provider API key found"));
239326
239588
  console.error(
239327
239589
  chalk9.yellow(
239328
239590
  "\nThe pull command requires AI to generate TypeScript files from your project configuration."
@@ -239506,6 +239768,13 @@ async function pullProjectCommand(options) {
239506
239768
  const statusComponents = agentObj.statusUpdates?.statusComponents || [];
239507
239769
  return total + statusComponents.length;
239508
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
+ );
239509
239778
  console.log(chalk9.cyan("\n\u{1F4CA} Project Summary:"));
239510
239779
  console.log(chalk9.gray(` \u2022 Name: ${projectData.name}`));
239511
239780
  console.log(chalk9.gray(` \u2022 Description: ${projectData.description || "No description"}`));
@@ -239521,6 +239790,9 @@ async function pullProjectCommand(options) {
239521
239790
  if (statusComponentCount > 0) {
239522
239791
  console.log(chalk9.gray(` \u2022 Status Components: ${statusComponentCount}`));
239523
239792
  }
239793
+ if (externalAgentCount > 0) {
239794
+ console.log(chalk9.gray(` \u2022 External Agents: ${externalAgentCount}`));
239795
+ }
239524
239796
  const credentialReferences2 = projectData.credentialReferences || {};
239525
239797
  const credentialCount = Object.keys(credentialReferences2).length;
239526
239798
  if (credentialCount > 0) {
@@ -239536,7 +239808,7 @@ async function pullProjectCommand(options) {
239536
239808
  for (const usage of usageInfo) {
239537
239809
  usageByType[usage.type] = (usageByType[usage.type] || 0) + 1;
239538
239810
  }
239539
- 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(", ");
239540
239812
  console.log(chalk9.gray(` Used by: ${usageSummary}`));
239541
239813
  }
239542
239814
  }
@@ -239576,6 +239848,7 @@ async function pullProjectCommand(options) {
239576
239848
  hasAgentsDirectory: true,
239577
239849
  hasDataComponentsDirectory: true,
239578
239850
  hasArtifactComponentsDirectory: true,
239851
+ hasExternalAgentsDirectory: true,
239579
239852
  hasEnvironmentsDirectory: true
239580
239853
  },
239581
239854
  namingConventions: DEFAULT_NAMING_CONVENTIONS2,
@@ -239605,10 +239878,20 @@ async function pullProjectCommand(options) {
239605
239878
  if (options.debug) {
239606
239879
  console.log(chalk9.gray(`
239607
239880
  \u{1F4CD} Debug: Model selected: ${selectedModel}`));
239608
- 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
+ );
239609
239886
  }
239610
239887
  const targetEnvironment = options.env || "development";
239611
- 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
+ );
239612
239895
  s2.stop("Generation plan created");
239613
239896
  const { displayPlanSummary: displayPlanSummary2, displayConflictWarning: displayConflictWarning2 } = await Promise.resolve().then(() => (init_display_utils(), display_utils_exports));
239614
239897
  displayPlanSummary2(plan);
@@ -239645,9 +239928,10 @@ async function pullProjectCommand(options) {
239645
239928
  tools: Object.keys(projectData.tools || {}).length,
239646
239929
  dataComponents: Object.keys(projectData.dataComponents || {}).length,
239647
239930
  artifactComponents: Object.keys(projectData.artifactComponents || {}).length,
239931
+ externalAgents: Object.keys(projectData.externalAgents || {}).length,
239648
239932
  statusComponents: statusComponentsCount
239649
239933
  };
239650
- 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;
239651
239935
  s2.stop(`Project files generated (${totalFiles} files created)`);
239652
239936
  s2.start("Verifying generated files...");
239653
239937
  try {
@@ -239698,6 +239982,9 @@ async function pullProjectCommand(options) {
239698
239982
  if (fileCount.tools > 0) {
239699
239983
  console.log(chalk9.gray(` \u251C\u2500\u2500 tools/ (${fileCount.tools} files)`));
239700
239984
  }
239985
+ if (fileCount.externalAgents > 0) {
239986
+ console.log(chalk9.gray(` \u251C\u2500\u2500 external-agents/ (${fileCount.externalAgents} files)`));
239987
+ }
239701
239988
  if (fileCount.dataComponents > 0) {
239702
239989
  console.log(chalk9.gray(` \u251C\u2500\u2500 data-components/ (${fileCount.dataComponents} files)`));
239703
239990
  }
@@ -239926,7 +240213,7 @@ async function pushCommand(options) {
239926
240213
  for (const usage of usageInfo) {
239927
240214
  usageByType[usage.type] = (usageByType[usage.type] || 0) + 1;
239928
240215
  }
239929
- 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(", ");
239930
240217
  console.log(chalk10.gray(` Used by: ${usageSummary}`));
239931
240218
  }
239932
240219
  }