@agentforge/tools 0.16.13 → 0.16.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -788,7 +788,7 @@ function getDefaultSlackClient() {
788
788
  }
789
789
  };
790
790
  }
791
- function createSendSlackMessageTool(getSlackClient, logger22) {
791
+ function createSendSlackMessageTool(getSlackClient, logger23) {
792
792
  return toolBuilder().name("send-slack-message").description("Send a message to a Slack channel for team communication and notifications").category(ToolCategory.WEB).tags(["slack", "messaging", "communication"]).usageNotes(
793
793
  "Use this for general team communication. For notifications with @mentions, consider using notify-slack instead. Use get-slack-channels first if you need to find the right channel."
794
794
  ).suggests(["get-slack-channels"]).schema(
@@ -797,7 +797,7 @@ function createSendSlackMessageTool(getSlackClient, logger22) {
797
797
  message: z.string().describe("Message content to send")
798
798
  })
799
799
  ).implementSafe(async ({ channel, message }) => {
800
- logger22.info("send-slack-message called", { channel, messageLength: message.length });
800
+ logger23.info("send-slack-message called", { channel, messageLength: message.length });
801
801
  try {
802
802
  const { client: slack, config } = getSlackClient();
803
803
  const result = await slack.chat.postMessage({
@@ -806,7 +806,7 @@ function createSendSlackMessageTool(getSlackClient, logger22) {
806
806
  username: config.botName,
807
807
  icon_emoji: config.botIcon
808
808
  });
809
- logger22.info("send-slack-message result", {
809
+ logger23.info("send-slack-message result", {
810
810
  ...result.channel ? { channel: result.channel } : {},
811
811
  ...result.ts ? { timestamp: result.ts } : {},
812
812
  messageLength: message.length,
@@ -819,7 +819,7 @@ function createSendSlackMessageTool(getSlackClient, logger22) {
819
819
  message_id: result.ts
820
820
  };
821
821
  } catch (error) {
822
- logger22.error("send-slack-message failed", {
822
+ logger23.error("send-slack-message failed", {
823
823
  channel,
824
824
  error: error.message,
825
825
  data: error.data
@@ -828,7 +828,7 @@ function createSendSlackMessageTool(getSlackClient, logger22) {
828
828
  }
829
829
  }).build();
830
830
  }
831
- function createNotifySlackTool(getSlackClient, logger22) {
831
+ function createNotifySlackTool(getSlackClient, logger23) {
832
832
  return toolBuilder().name("notify-slack").description("Send a notification to a Slack channel with optional @mentions for urgent alerts").category(ToolCategory.WEB).tags(["slack", "notification", "alert"]).usageNotes(
833
833
  "Use this for urgent notifications that require @mentions. For general messages without mentions, use send-slack-message instead."
834
834
  ).suggests(["get-slack-channels"]).schema(
@@ -838,7 +838,7 @@ function createNotifySlackTool(getSlackClient, logger22) {
838
838
  mentions: z.array(z.string()).optional().describe("List of usernames to mention (without @)")
839
839
  })
840
840
  ).implementSafe(async ({ channel, message, mentions = [] }) => {
841
- logger22.info("notify-slack called", {
841
+ logger23.info("notify-slack called", {
842
842
  channel,
843
843
  messageLength: message.length,
844
844
  mentionCount: mentions.length
@@ -852,7 +852,7 @@ function createNotifySlackTool(getSlackClient, logger22) {
852
852
  username: config.botName,
853
853
  icon_emoji: config.botIcon
854
854
  });
855
- logger22.info("notify-slack result", {
855
+ logger23.info("notify-slack result", {
856
856
  ...result.channel ? { channel: result.channel } : {},
857
857
  ...result.ts ? { timestamp: result.ts } : {},
858
858
  mentions: mentions.length
@@ -866,7 +866,7 @@ function createNotifySlackTool(getSlackClient, logger22) {
866
866
  };
867
867
  }).build();
868
868
  }
869
- function createGetSlackChannelsTool(getSlackClient, logger22) {
869
+ function createGetSlackChannelsTool(getSlackClient, logger23) {
870
870
  return toolBuilder().name("get-slack-channels").description("Get a list of available Slack channels to find the right channel for messaging").category(ToolCategory.WEB).tags(["slack", "channels", "list"]).usageNotes(
871
871
  "Use this first to discover available channels before sending messages. Helps ensure you are sending to the correct channel."
872
872
  ).follows(["send-slack-message", "notify-slack"]).schema(
@@ -874,7 +874,7 @@ function createGetSlackChannelsTool(getSlackClient, logger22) {
874
874
  include_private: z.boolean().optional().describe("Include private channels (default: false)")
875
875
  })
876
876
  ).implementSafe(async ({ include_private = false }) => {
877
- logger22.info("get-slack-channels called", { include_private });
877
+ logger23.info("get-slack-channels called", { include_private });
878
878
  const { client: slack } = getSlackClient();
879
879
  const publicChannels = await slack.conversations.list({
880
880
  types: "public_channel",
@@ -888,7 +888,7 @@ function createGetSlackChannelsTool(getSlackClient, logger22) {
888
888
  });
889
889
  allChannels = [...allChannels, ...privateChannels.channels || []];
890
890
  }
891
- logger22.info("get-slack-channels result", {
891
+ logger23.info("get-slack-channels result", {
892
892
  channelCount: allChannels.length,
893
893
  includePrivate: include_private
894
894
  });
@@ -903,7 +903,7 @@ function createGetSlackChannelsTool(getSlackClient, logger22) {
903
903
  };
904
904
  }).build();
905
905
  }
906
- function createGetSlackMessagesTool(getSlackClient, logger22) {
906
+ function createGetSlackMessagesTool(getSlackClient, logger23) {
907
907
  return toolBuilder().name("get-slack-messages").description("Retrieve message history from a Slack channel to read recent conversations").category(ToolCategory.WEB).tags(["slack", "messages", "history", "read"]).usageNotes(
908
908
  "Use this to read recent messages from a channel. Use get-slack-channels first if you need to find the channel ID. Returns messages in reverse chronological order (newest first)."
909
909
  ).suggests(["get-slack-channels"]).schema(
@@ -912,7 +912,7 @@ function createGetSlackMessagesTool(getSlackClient, logger22) {
912
912
  limit: z.number().int().min(1).max(100).optional().describe("Number of messages to retrieve (default: 20, max: 100)")
913
913
  })
914
914
  ).implementSafe(async ({ channel, limit = 20 }) => {
915
- logger22.info("get-slack-messages called", { channel, limit });
915
+ logger23.info("get-slack-messages called", { channel, limit });
916
916
  try {
917
917
  const { client: slack } = getSlackClient();
918
918
  let channelId = channel;
@@ -923,7 +923,7 @@ function createGetSlackMessagesTool(getSlackClient, logger22) {
923
923
  });
924
924
  const found = channels.channels?.find((c) => c.name === channel);
925
925
  if (!found) {
926
- logger22.error("get-slack-messages: channel not found", { channel });
926
+ logger23.error("get-slack-messages: channel not found", { channel });
927
927
  throw new Error(
928
928
  `Channel '${channel}' not found. Use get-slack-channels to see available channels.`
929
929
  );
@@ -935,7 +935,7 @@ function createGetSlackMessagesTool(getSlackClient, logger22) {
935
935
  limit: Math.min(limit, 100)
936
936
  // Cap at 100 for performance
937
937
  });
938
- logger22.info("get-slack-messages result", {
938
+ logger23.info("get-slack-messages result", {
939
939
  channel: channelId,
940
940
  messageCount: result.messages?.length || 0,
941
941
  limit
@@ -953,7 +953,7 @@ function createGetSlackMessagesTool(getSlackClient, logger22) {
953
953
  })) || []
954
954
  };
955
955
  } catch (error) {
956
- logger22.error("get-slack-messages failed", {
956
+ logger23.error("get-slack-messages failed", {
957
957
  channel,
958
958
  error: error.message,
959
959
  data: error.data
@@ -1034,12 +1034,12 @@ function getAuthHeader() {
1034
1034
  const auth2 = Buffer.from(`${ATLASSIAN_EMAIL}:${ATLASSIAN_API_KEY}`).toString("base64");
1035
1035
  return `Basic ${auth2}`;
1036
1036
  }
1037
- function createSearchConfluenceTool(getAuth, getAuthHeader2, logger22) {
1037
+ function createSearchConfluenceTool(getAuth, getAuthHeader2, logger23) {
1038
1038
  return toolBuilder().name("search-confluence").description("Search for pages in Confluence using keywords or CQL (Confluence Query Language). Returns matching pages with titles, IDs, and excerpts.").category(ToolCategory.WEB).tag("confluence").tag("search").tag("knowledge-base").usageNotes("Use this to find relevant documentation, policies, or information in Confluence. You can search by keywords or use CQL for advanced queries (e.g., 'space=AI AND type=page'). Use get-confluence-page to retrieve full content of specific pages.").suggests(["get-confluence-page"]).schema(z.object({
1039
1039
  query: z.string().describe("Search query or CQL expression (e.g., 'payment processing' or 'space=BL3 AND title~payment')"),
1040
1040
  limit: z.number().optional().describe("Maximum number of results to return (default: 10, max: 25)")
1041
1041
  })).implement(async ({ query, limit = 10 }) => {
1042
- logger22.info("search-confluence called", { query, limit });
1042
+ logger23.info("search-confluence called", { query, limit });
1043
1043
  try {
1044
1044
  const { ATLASSIAN_SITE_URL } = getAuth();
1045
1045
  const response = await axios16.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/search`, {
@@ -1064,13 +1064,13 @@ function createSearchConfluenceTool(getAuth, getAuthHeader2, logger22) {
1064
1064
  lastModified: page.version?.when || ""
1065
1065
  }));
1066
1066
  if (results.length === 0) {
1067
- logger22.warn("search-confluence returned NO RESULTS - this is a valid outcome, agent should not retry", {
1067
+ logger23.warn("search-confluence returned NO RESULTS - this is a valid outcome, agent should not retry", {
1068
1068
  query,
1069
1069
  limit,
1070
1070
  totalSize: response.data.totalSize
1071
1071
  });
1072
1072
  } else {
1073
- logger22.info("search-confluence result", {
1073
+ logger23.info("search-confluence result", {
1074
1074
  query,
1075
1075
  resultCount: results.length,
1076
1076
  totalSize: response.data.totalSize,
@@ -1085,7 +1085,7 @@ function createSearchConfluenceTool(getAuth, getAuthHeader2, logger22) {
1085
1085
  results
1086
1086
  });
1087
1087
  } catch (error) {
1088
- logger22.error("search-confluence error", {
1088
+ logger23.error("search-confluence error", {
1089
1089
  query,
1090
1090
  error: error.response?.data?.message || error.message,
1091
1091
  status: error.response?.status
@@ -1097,11 +1097,11 @@ function createSearchConfluenceTool(getAuth, getAuthHeader2, logger22) {
1097
1097
  }
1098
1098
  }).build();
1099
1099
  }
1100
- function createGetConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1100
+ function createGetConfluencePageTool(getAuth, getAuthHeader2, logger23) {
1101
1101
  return toolBuilder().name("get-confluence-page").description("Get the full content of a specific Confluence page by its ID. Returns the page title, content (in storage format), space, and metadata.").category(ToolCategory.WEB).tag("confluence").tag("page").tag("content").usageNotes("Use this after search-confluence to retrieve the full content of a specific page. The page ID can be found in search results.").requires(["search-confluence"]).schema(z.object({
1102
1102
  page_id: z.string().describe("The Confluence page ID (from search results)")
1103
1103
  })).implement(async ({ page_id }) => {
1104
- logger22.info("get-confluence-page called", { page_id });
1104
+ logger23.info("get-confluence-page called", { page_id });
1105
1105
  try {
1106
1106
  const { ATLASSIAN_SITE_URL } = getAuth();
1107
1107
  const response = await axios16.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`, {
@@ -1114,7 +1114,7 @@ function createGetConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1114
1114
  }
1115
1115
  });
1116
1116
  const page = response.data;
1117
- logger22.info("get-confluence-page result", {
1117
+ logger23.info("get-confluence-page result", {
1118
1118
  page_id,
1119
1119
  title: page.title,
1120
1120
  space: page.space?.name,
@@ -1136,7 +1136,7 @@ function createGetConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1136
1136
  }
1137
1137
  });
1138
1138
  } catch (error) {
1139
- logger22.error("get-confluence-page error", {
1139
+ logger23.error("get-confluence-page error", {
1140
1140
  page_id,
1141
1141
  error: error.response?.data?.message || error.message,
1142
1142
  status: error.response?.status
@@ -1148,11 +1148,11 @@ function createGetConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1148
1148
  }
1149
1149
  }).build();
1150
1150
  }
1151
- function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger22) {
1151
+ function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger23) {
1152
1152
  return toolBuilder().name("list-confluence-spaces").description("List all available Confluence spaces. Returns space names, keys, types, and descriptions to help identify where to search for information.").category(ToolCategory.WEB).tag("confluence").tag("spaces").tag("list").usageNotes("Use this first to discover available spaces before searching. Helps narrow down searches to specific areas (e.g., 'AI', 'BL3', 'Finance').").follows(["search-confluence"]).schema(z.object({
1153
1153
  limit: z.number().optional().describe("Maximum number of spaces to return (default: 25)")
1154
1154
  })).implement(async ({ limit = 25 }) => {
1155
- logger22.info("list-confluence-spaces called", { limit });
1155
+ logger23.info("list-confluence-spaces called", { limit });
1156
1156
  try {
1157
1157
  const { ATLASSIAN_SITE_URL } = getAuth();
1158
1158
  const response = await axios16.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/space`, {
@@ -1171,7 +1171,7 @@ function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger22) {
1171
1171
  description: space.description?.plain?.value || "",
1172
1172
  url: `${ATLASSIAN_SITE_URL}/wiki${space._links.webui}`
1173
1173
  }));
1174
- logger22.info("list-confluence-spaces result", {
1174
+ logger23.info("list-confluence-spaces result", {
1175
1175
  spaceCount: spaces.length,
1176
1176
  spaceKeys: spaces.map((s) => s.key).slice(0, 5)
1177
1177
  // Log first 5 space keys
@@ -1182,7 +1182,7 @@ function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger22) {
1182
1182
  spaces
1183
1183
  });
1184
1184
  } catch (error) {
1185
- logger22.error("list-confluence-spaces error", {
1185
+ logger23.error("list-confluence-spaces error", {
1186
1186
  error: error.response?.data?.message || error.message,
1187
1187
  status: error.response?.status
1188
1188
  });
@@ -1193,12 +1193,12 @@ function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger22) {
1193
1193
  }
1194
1194
  }).build();
1195
1195
  }
1196
- function createGetSpacePagesTool(getAuth, getAuthHeader2, logger22) {
1196
+ function createGetSpacePagesTool(getAuth, getAuthHeader2, logger23) {
1197
1197
  return toolBuilder().name("get-space-pages").description("Get all pages from a specific Confluence space by space key. Useful for browsing content in a particular area.").category(ToolCategory.WEB).tag("confluence").tag("space").tag("pages").usageNotes("Use this to explore all pages in a specific space. Get the space key from list-confluence-spaces first.").requires(["list-confluence-spaces"]).schema(z.object({
1198
1198
  space_key: z.string().describe("The space key (e.g., 'AI', 'BL3', 'FIN')"),
1199
1199
  limit: z.number().optional().describe("Maximum number of pages to return (default: 25)")
1200
1200
  })).implement(async ({ space_key, limit = 25 }) => {
1201
- logger22.info("get-space-pages called", { space_key, limit });
1201
+ logger23.info("get-space-pages called", { space_key, limit });
1202
1202
  try {
1203
1203
  const { ATLASSIAN_SITE_URL } = getAuth();
1204
1204
  const response = await axios16.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content`, {
@@ -1220,12 +1220,12 @@ function createGetSpacePagesTool(getAuth, getAuthHeader2, logger22) {
1220
1220
  lastModified: page.version?.when || ""
1221
1221
  }));
1222
1222
  if (pages.length === 0) {
1223
- logger22.warn("get-space-pages returned NO PAGES - this is a valid outcome, agent should not retry", {
1223
+ logger23.warn("get-space-pages returned NO PAGES - this is a valid outcome, agent should not retry", {
1224
1224
  space_key,
1225
1225
  limit
1226
1226
  });
1227
1227
  } else {
1228
- logger22.info("get-space-pages result", {
1228
+ logger23.info("get-space-pages result", {
1229
1229
  space_key,
1230
1230
  pageCount: pages.length,
1231
1231
  titles: pages.map((p) => p.title).slice(0, 3)
@@ -1239,7 +1239,7 @@ function createGetSpacePagesTool(getAuth, getAuthHeader2, logger22) {
1239
1239
  pages
1240
1240
  });
1241
1241
  } catch (error) {
1242
- logger22.error("get-space-pages error", {
1242
+ logger23.error("get-space-pages error", {
1243
1243
  space_key,
1244
1244
  error: error.response?.data?.message || error.message,
1245
1245
  status: error.response?.status
@@ -1251,14 +1251,14 @@ function createGetSpacePagesTool(getAuth, getAuthHeader2, logger22) {
1251
1251
  }
1252
1252
  }).build();
1253
1253
  }
1254
- function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1254
+ function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger23) {
1255
1255
  return toolBuilder().name("create-confluence-page").description("Create a new page in a Confluence space. Requires space key, page title, and content (in HTML storage format).").category(ToolCategory.WEB).tag("confluence").tag("create").tag("write").usageNotes("Use this to create new documentation pages. Content should be in Confluence storage format (HTML). Get the space key from list-confluence-spaces first. Be mindful of creating duplicate pages.").requires(["list-confluence-spaces"]).schema(z.object({
1256
1256
  space_key: z.string().describe("The space key where the page will be created (e.g., 'AI', 'BL3')"),
1257
1257
  title: z.string().describe("The title of the new page"),
1258
1258
  content: z.string().describe("The page content in HTML format (Confluence storage format)"),
1259
1259
  parent_page_id: z.string().optional().describe("Optional parent page ID to create this as a child page")
1260
1260
  })).implement(async ({ space_key, title, content, parent_page_id }) => {
1261
- logger22.info("create-confluence-page called", { space_key, title, hasParent: !!parent_page_id });
1261
+ logger23.info("create-confluence-page called", { space_key, title, hasParent: !!parent_page_id });
1262
1262
  try {
1263
1263
  const { ATLASSIAN_SITE_URL } = getAuth();
1264
1264
  const pageData = {
@@ -1285,7 +1285,7 @@ function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1285
1285
  }
1286
1286
  }
1287
1287
  );
1288
- logger22.info("create-confluence-page result", {
1288
+ logger23.info("create-confluence-page result", {
1289
1289
  page_id: response.data.id,
1290
1290
  title: response.data.title,
1291
1291
  space: space_key
@@ -1301,7 +1301,7 @@ function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1301
1301
  }
1302
1302
  });
1303
1303
  } catch (error) {
1304
- logger22.error("create-confluence-page error", {
1304
+ logger23.error("create-confluence-page error", {
1305
1305
  space_key,
1306
1306
  title,
1307
1307
  error: error.response?.data?.message || error.message,
@@ -1314,13 +1314,13 @@ function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1314
1314
  }
1315
1315
  }).build();
1316
1316
  }
1317
- function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1317
+ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger23) {
1318
1318
  return toolBuilder().name("update-confluence-page").description("Update an existing Confluence page's content. Requires page ID, new title, and new content.").category(ToolCategory.WEB).tag("confluence").tag("update").tag("write").usageNotes("Use this to update existing documentation. You must provide the page ID (from search results). The tool will automatically handle version incrementing. Always get the current page content first to avoid overwriting important information.").requires(["get-confluence-page"]).schema(z.object({
1319
1319
  page_id: z.string().describe("The ID of the page to update"),
1320
1320
  title: z.string().describe("The new title for the page"),
1321
1321
  content: z.string().describe("The new content in HTML format (Confluence storage format)")
1322
1322
  })).implement(async ({ page_id, title, content }) => {
1323
- logger22.info("update-confluence-page called", { page_id, title });
1323
+ logger23.info("update-confluence-page called", { page_id, title });
1324
1324
  try {
1325
1325
  const { ATLASSIAN_SITE_URL } = getAuth();
1326
1326
  const getResponse = await axios16.get(
@@ -1353,7 +1353,7 @@ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1353
1353
  }
1354
1354
  }
1355
1355
  );
1356
- logger22.info("update-confluence-page result", {
1356
+ logger23.info("update-confluence-page result", {
1357
1357
  page_id,
1358
1358
  title: updateResponse.data.title,
1359
1359
  previousVersion: currentVersion,
@@ -1370,7 +1370,7 @@ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1370
1370
  }
1371
1371
  });
1372
1372
  } catch (error) {
1373
- logger22.error("update-confluence-page error", {
1373
+ logger23.error("update-confluence-page error", {
1374
1374
  page_id,
1375
1375
  title,
1376
1376
  error: error.response?.data?.message || error.message,
@@ -1383,12 +1383,12 @@ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1383
1383
  }
1384
1384
  }).build();
1385
1385
  }
1386
- function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1386
+ function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger23) {
1387
1387
  return toolBuilder().name("archive-confluence-page").description("Archive a Confluence page by moving it to trash. The page can be restored by space admins. Note: UI may require a note explaining why the page was archived.").category(ToolCategory.WEB).tag("confluence").tag("archive").tag("delete").usageNotes("Use this to archive outdated or obsolete documentation. The page is moved to trash, not permanently deleted. Space admins can restore it if needed. Be very careful - only archive pages that are truly obsolete.").conflicts(["create-confluence-page"]).schema(z.object({
1388
1388
  page_id: z.string().describe("The ID of the page to archive"),
1389
1389
  reason: z.string().optional().describe("Optional reason for archiving (for audit trail)")
1390
1390
  })).implement(async ({ page_id, reason }) => {
1391
- logger22.info("archive-confluence-page called", {
1391
+ logger23.info("archive-confluence-page called", {
1392
1392
  page_id,
1393
1393
  ...reason ? { reason } : {}
1394
1394
  });
@@ -1422,7 +1422,7 @@ function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1422
1422
  }
1423
1423
  }
1424
1424
  );
1425
- logger22.info("archive-confluence-page result", {
1425
+ logger23.info("archive-confluence-page result", {
1426
1426
  page_id,
1427
1427
  title: pageData.title,
1428
1428
  previousVersion: currentVersion,
@@ -1440,7 +1440,7 @@ function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger22) {
1440
1440
  }
1441
1441
  });
1442
1442
  } catch (error) {
1443
- logger22.error("archive-confluence-page error", {
1443
+ logger23.error("archive-confluence-page error", {
1444
1444
  page_id,
1445
1445
  error: error.response?.data?.message || error.message,
1446
1446
  status: error.response?.status
@@ -4017,15 +4017,14 @@ function quoteQualifiedIdentifier(qualifiedName, vendor) {
4017
4017
  const parts = qualifiedName.split(".");
4018
4018
  return parts.map((part) => quoteIdentifier(part, vendor)).join(".");
4019
4019
  }
4020
- var logger7 = createLogger("agentforge:tools:data:relational:connection");
4021
- var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
4022
- ConnectionState2["DISCONNECTED"] = "disconnected";
4023
- ConnectionState2["CONNECTING"] = "connecting";
4024
- ConnectionState2["CONNECTED"] = "connected";
4025
- ConnectionState2["RECONNECTING"] = "reconnecting";
4026
- ConnectionState2["ERROR"] = "error";
4027
- return ConnectionState2;
4028
- })(ConnectionState || {});
4020
+ var logger7 = createLogger("agentforge:tools:data:relational:connection:vendor-init");
4021
+ var SAFE_INITIALIZATION_PATTERNS = [
4022
+ "Pool max connections must be",
4023
+ "Pool acquire timeout must be",
4024
+ "Pool idle timeout must be",
4025
+ "SQLite connection requires a url property",
4026
+ "Unsupported database vendor"
4027
+ ];
4029
4028
  function validatePoolConfig(poolConfig) {
4030
4029
  if (poolConfig.max !== void 0 && poolConfig.max < 1) {
4031
4030
  throw new Error("Pool max connections must be >= 1");
@@ -4037,13 +4036,150 @@ function validatePoolConfig(poolConfig) {
4037
4036
  throw new Error("Pool idle timeout must be >= 0");
4038
4037
  }
4039
4038
  }
4040
- var SAFE_INITIALIZATION_PATTERNS = [
4041
- "Pool max connections must be",
4042
- "Pool acquire timeout must be",
4043
- "Pool idle timeout must be",
4044
- "connection requires a url property",
4045
- "Unsupported database vendor"
4046
- ];
4039
+ function pickConfiguredPoolFields(fields) {
4040
+ const configuredEntries = Object.entries(fields).filter(
4041
+ (entry) => entry[1] !== void 0
4042
+ );
4043
+ return Object.fromEntries(configuredEntries);
4044
+ }
4045
+ function normalizePostgreSQLConfig(connection) {
4046
+ const { pool: poolConfig, ...baseConfig } = typeof connection === "string" ? { connectionString: connection } : connection;
4047
+ if (poolConfig) {
4048
+ validatePoolConfig(poolConfig);
4049
+ }
4050
+ return {
4051
+ poolConfig,
4052
+ connectionConfig: {
4053
+ ...baseConfig,
4054
+ ...poolConfig?.max !== void 0 && { max: poolConfig.max },
4055
+ ...poolConfig?.idleTimeoutMillis !== void 0 && {
4056
+ idleTimeoutMillis: poolConfig.idleTimeoutMillis
4057
+ },
4058
+ ...poolConfig?.acquireTimeoutMillis !== void 0 && {
4059
+ connectionTimeoutMillis: poolConfig.acquireTimeoutMillis
4060
+ }
4061
+ }
4062
+ };
4063
+ }
4064
+ function normalizeMySQLConfig(connection) {
4065
+ if (typeof connection === "string") {
4066
+ logger7.debug("Creating MySQL connection pool from connection string", {
4067
+ vendor: "mysql"
4068
+ });
4069
+ return connection;
4070
+ }
4071
+ const { pool: poolConfig, ...baseConfig } = connection;
4072
+ if (poolConfig) {
4073
+ validatePoolConfig(poolConfig);
4074
+ }
4075
+ return {
4076
+ ...baseConfig,
4077
+ ...poolConfig?.max !== void 0 && { connectionLimit: poolConfig.max },
4078
+ ...poolConfig?.acquireTimeoutMillis !== void 0 && {
4079
+ acquireTimeout: poolConfig.acquireTimeoutMillis
4080
+ },
4081
+ ...poolConfig?.idleTimeoutMillis !== void 0 && {
4082
+ idleTimeout: poolConfig.idleTimeoutMillis
4083
+ }
4084
+ };
4085
+ }
4086
+ function resolveSqliteUrl(connection) {
4087
+ if (typeof connection === "string") {
4088
+ return { url: connection };
4089
+ }
4090
+ const { url, pool } = connection;
4091
+ if (!url) {
4092
+ throw new Error("SQLite connection requires a url property");
4093
+ }
4094
+ if (pool) {
4095
+ validatePoolConfig(pool);
4096
+ }
4097
+ return { url, poolConfig: pool };
4098
+ }
4099
+ async function initializeVendorConnection(config) {
4100
+ switch (config.vendor) {
4101
+ case "postgresql":
4102
+ return initializePostgreSQLConnection(config.connection);
4103
+ case "mysql":
4104
+ return initializeMySQLConnection(config.connection);
4105
+ case "sqlite":
4106
+ return initializeSQLiteConnection(config.connection);
4107
+ default:
4108
+ throw new Error(`Unsupported database vendor: ${config.vendor}`);
4109
+ }
4110
+ }
4111
+ async function initializePostgreSQLConnection(connection) {
4112
+ const { drizzle } = await import('drizzle-orm/node-postgres');
4113
+ const { Pool } = await import('pg');
4114
+ const { connectionConfig } = normalizePostgreSQLConfig(connection);
4115
+ logger7.debug("Creating PostgreSQL connection pool", {
4116
+ vendor: "postgresql",
4117
+ poolConfig: pickConfiguredPoolFields({
4118
+ max: connectionConfig.max,
4119
+ idleTimeoutMillis: connectionConfig.idleTimeoutMillis,
4120
+ connectionTimeoutMillis: connectionConfig.connectionTimeoutMillis
4121
+ })
4122
+ });
4123
+ const client = new Pool(connectionConfig);
4124
+ const db = drizzle({ client });
4125
+ return { client, db };
4126
+ }
4127
+ async function initializeMySQLConnection(connection) {
4128
+ const { drizzle } = await import('drizzle-orm/mysql2');
4129
+ const mysql = await import('mysql2/promise');
4130
+ const connectionConfig = normalizeMySQLConfig(connection);
4131
+ if (typeof connectionConfig !== "string") {
4132
+ logger7.debug("Creating MySQL connection pool", {
4133
+ vendor: "mysql",
4134
+ poolConfig: pickConfiguredPoolFields({
4135
+ connectionLimit: connectionConfig.connectionLimit,
4136
+ acquireTimeout: connectionConfig.acquireTimeout,
4137
+ idleTimeout: connectionConfig.idleTimeout
4138
+ })
4139
+ });
4140
+ }
4141
+ let client;
4142
+ if (typeof connectionConfig === "string") {
4143
+ client = mysql.createPool(connectionConfig);
4144
+ } else {
4145
+ client = mysql.createPool(connectionConfig);
4146
+ }
4147
+ const db = drizzle({ client });
4148
+ return { client, db };
4149
+ }
4150
+ async function initializeSQLiteConnection(connection) {
4151
+ const { drizzle } = await import('drizzle-orm/better-sqlite3');
4152
+ const DatabaseModule = await import('better-sqlite3');
4153
+ const Database = DatabaseModule.default;
4154
+ const { url, poolConfig } = resolveSqliteUrl(connection);
4155
+ if (poolConfig) {
4156
+ logger7.debug("SQLite pool configuration provided but not applied (SQLite uses single connection)", {
4157
+ vendor: "sqlite",
4158
+ poolConfig: pickConfiguredPoolFields({
4159
+ max: poolConfig.max,
4160
+ idleTimeoutMillis: poolConfig.idleTimeoutMillis,
4161
+ acquireTimeoutMillis: poolConfig.acquireTimeoutMillis
4162
+ })
4163
+ });
4164
+ }
4165
+ logger7.debug("Creating SQLite connection", {
4166
+ vendor: "sqlite",
4167
+ url: url === ":memory:" ? ":memory:" : "file"
4168
+ });
4169
+ const client = new Database(url);
4170
+ client.pragma("foreign_keys = ON");
4171
+ const db = drizzle({ client });
4172
+ return { client, db };
4173
+ }
4174
+ var logger8 = createLogger("agentforge:tools:data:relational:connection");
4175
+ var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
4176
+ ConnectionState2["DISCONNECTED"] = "disconnected";
4177
+ ConnectionState2["CONNECTING"] = "connecting";
4178
+ ConnectionState2["CONNECTED"] = "connected";
4179
+ ConnectionState2["RECONNECTING"] = "reconnecting";
4180
+ ConnectionState2["ERROR"] = "error";
4181
+ return ConnectionState2;
4182
+ })(ConnectionState || {});
4047
4183
  var ConnectionManager = class extends EventEmitter {
4048
4184
  vendor;
4049
4185
  db;
@@ -4083,18 +4219,18 @@ var ConnectionManager = class extends EventEmitter {
4083
4219
  */
4084
4220
  async connect() {
4085
4221
  if (this.state === "connected" /* CONNECTED */) {
4086
- logger7.debug("Already connected", { vendor: this.vendor });
4222
+ logger8.debug("Already connected", { vendor: this.vendor });
4087
4223
  return;
4088
4224
  }
4089
4225
  if (this.connectPromise) {
4090
- logger7.debug("Connection already in progress, waiting for completion", {
4226
+ logger8.debug("Connection already in progress, waiting for completion", {
4091
4227
  vendor: this.vendor,
4092
4228
  state: this.state
4093
4229
  });
4094
4230
  return this.connectPromise;
4095
4231
  }
4096
4232
  if (this.reconnectionTimer) {
4097
- logger7.debug("Clearing pending reconnection timer before manual connect", {
4233
+ logger8.debug("Clearing pending reconnection timer before manual connect", {
4098
4234
  vendor: this.vendor
4099
4235
  });
4100
4236
  clearTimeout(this.reconnectionTimer);
@@ -4120,7 +4256,7 @@ var ConnectionManager = class extends EventEmitter {
4120
4256
  }
4121
4257
  this.reconnectionAttempts = 0;
4122
4258
  if (this.connectPromise) {
4123
- logger7.debug("Waiting for in-flight connection attempt to complete before disconnect", {
4259
+ logger8.debug("Waiting for in-flight connection attempt to complete before disconnect", {
4124
4260
  vendor: this.vendor
4125
4261
  });
4126
4262
  try {
@@ -4173,7 +4309,7 @@ var ConnectionManager = class extends EventEmitter {
4173
4309
  const startTime = Date.now();
4174
4310
  const currentGeneration = this.connectionGeneration;
4175
4311
  if (this.state === "connected" /* CONNECTED */ && this.client) {
4176
- logger7.warn("Re-initializing an already connected manager; emitting disconnected before cleanup", {
4312
+ logger8.warn("Re-initializing an already connected manager; emitting disconnected before cleanup", {
4177
4313
  vendor: this.vendor
4178
4314
  });
4179
4315
  this.setState("disconnected" /* DISCONNECTED */);
@@ -4181,27 +4317,17 @@ var ConnectionManager = class extends EventEmitter {
4181
4317
  await this.cleanupCancelledConnection();
4182
4318
  }
4183
4319
  this.setState("connecting" /* CONNECTING */);
4184
- logger7.info("Initializing database connection", {
4320
+ logger8.info("Initializing database connection", {
4185
4321
  vendor: this.vendor,
4186
4322
  connectionType: typeof this.config.connection,
4187
4323
  state: this.state
4188
4324
  });
4189
4325
  try {
4190
- switch (this.vendor) {
4191
- case "postgresql":
4192
- await this.initializePostgreSQL();
4193
- break;
4194
- case "mysql":
4195
- await this.initializeMySQL();
4196
- break;
4197
- case "sqlite":
4198
- await this.initializeSQLite();
4199
- break;
4200
- default:
4201
- throw new Error(`Unsupported database vendor: ${this.vendor}`);
4202
- }
4326
+ const initialized = await initializeVendorConnection(this.config);
4327
+ this.client = initialized.client;
4328
+ this.db = initialized.db;
4203
4329
  if (currentGeneration !== this.connectionGeneration) {
4204
- logger7.debug("Connection cancelled during initialization", {
4330
+ logger8.debug("Connection cancelled during initialization", {
4205
4331
  vendor: this.vendor,
4206
4332
  currentGeneration,
4207
4333
  newGeneration: this.connectionGeneration
@@ -4210,13 +4336,13 @@ var ConnectionManager = class extends EventEmitter {
4210
4336
  this.setState("disconnected" /* DISCONNECTED */);
4211
4337
  throw new Error("Connection cancelled during initialization");
4212
4338
  }
4213
- logger7.debug("Validating connection health", { vendor: this.vendor });
4339
+ logger8.debug("Validating connection health", { vendor: this.vendor });
4214
4340
  const healthy = await this.isHealthy();
4215
4341
  if (!healthy) {
4216
4342
  throw new Error(`Failed to establish healthy connection to ${this.vendor} database`);
4217
4343
  }
4218
4344
  if (currentGeneration !== this.connectionGeneration) {
4219
- logger7.debug("Connection cancelled during health check", {
4345
+ logger8.debug("Connection cancelled during health check", {
4220
4346
  vendor: this.vendor,
4221
4347
  currentGeneration,
4222
4348
  newGeneration: this.connectionGeneration
@@ -4228,7 +4354,7 @@ var ConnectionManager = class extends EventEmitter {
4228
4354
  this.setState("connected" /* CONNECTED */);
4229
4355
  this.emit("connected");
4230
4356
  this.reconnectionAttempts = 0;
4231
- logger7.info("Database connection initialized successfully", {
4357
+ logger8.info("Database connection initialized successfully", {
4232
4358
  vendor: this.vendor,
4233
4359
  duration: Date.now() - startTime,
4234
4360
  state: this.state
@@ -4249,7 +4375,7 @@ var ConnectionManager = class extends EventEmitter {
4249
4375
  if (this.listenerCount("error") > 0) {
4250
4376
  this.emit("error", normalizedError);
4251
4377
  }
4252
- logger7.error(errorMessage, {
4378
+ logger8.error(errorMessage, {
4253
4379
  vendor: this.vendor,
4254
4380
  error: normalizedError.message,
4255
4381
  duration: Date.now() - startTime,
@@ -4260,7 +4386,7 @@ var ConnectionManager = class extends EventEmitter {
4260
4386
  this.scheduleReconnection();
4261
4387
  }
4262
4388
  } else {
4263
- logger7.debug("Connection initialization cancelled", {
4389
+ logger8.debug("Connection initialization cancelled", {
4264
4390
  vendor: this.vendor,
4265
4391
  duration: Date.now() - startTime,
4266
4392
  state: this.state
@@ -4281,7 +4407,7 @@ var ConnectionManager = class extends EventEmitter {
4281
4407
  const oldState = this.state;
4282
4408
  this.state = newState;
4283
4409
  if (oldState !== newState) {
4284
- logger7.debug("Connection state changed", {
4410
+ logger8.debug("Connection state changed", {
4285
4411
  vendor: this.vendor,
4286
4412
  oldState,
4287
4413
  newState
@@ -4294,7 +4420,7 @@ var ConnectionManager = class extends EventEmitter {
4294
4420
  */
4295
4421
  scheduleReconnection() {
4296
4422
  if (this.reconnectionConfig.maxAttempts > 0 && this.reconnectionAttempts >= this.reconnectionConfig.maxAttempts) {
4297
- logger7.error("Max reconnection attempts reached", {
4423
+ logger8.error("Max reconnection attempts reached", {
4298
4424
  vendor: this.vendor,
4299
4425
  attempts: this.reconnectionAttempts,
4300
4426
  maxAttempts: this.reconnectionConfig.maxAttempts
@@ -4307,7 +4433,7 @@ var ConnectionManager = class extends EventEmitter {
4307
4433
  );
4308
4434
  this.reconnectionAttempts++;
4309
4435
  this.setState("reconnecting" /* RECONNECTING */);
4310
- logger7.info("Scheduling reconnection attempt", {
4436
+ logger8.info("Scheduling reconnection attempt", {
4311
4437
  vendor: this.vendor,
4312
4438
  attempt: this.reconnectionAttempts,
4313
4439
  maxAttempts: this.reconnectionConfig.maxAttempts,
@@ -4321,7 +4447,7 @@ var ConnectionManager = class extends EventEmitter {
4321
4447
  this.reconnectionTimer = setTimeout(async () => {
4322
4448
  this.reconnectionTimer = null;
4323
4449
  try {
4324
- logger7.info("Attempting reconnection", {
4450
+ logger8.info("Attempting reconnection", {
4325
4451
  vendor: this.vendor,
4326
4452
  attempt: this.reconnectionAttempts
4327
4453
  });
@@ -4330,7 +4456,7 @@ var ConnectionManager = class extends EventEmitter {
4330
4456
  });
4331
4457
  await this.connectPromise;
4332
4458
  } catch (error) {
4333
- logger7.error("Reconnection attempt failed", {
4459
+ logger8.error("Reconnection attempt failed", {
4334
4460
  vendor: this.vendor,
4335
4461
  attempt: this.reconnectionAttempts,
4336
4462
  error: error instanceof Error ? error.message : String(error)
@@ -4338,108 +4464,6 @@ var ConnectionManager = class extends EventEmitter {
4338
4464
  }
4339
4465
  }, delay2);
4340
4466
  }
4341
- /**
4342
- * Initialize PostgreSQL connection using Drizzle ORM with node-postgres
4343
- *
4344
- * Applies pool configuration options to pg.Pool for connection management.
4345
- */
4346
- async initializePostgreSQL() {
4347
- const { drizzle } = await import('drizzle-orm/node-postgres');
4348
- const { Pool } = await import('pg');
4349
- const { pool: poolConfig, ...baseConfig } = typeof this.config.connection === "string" ? { connectionString: this.config.connection } : this.config.connection;
4350
- if (poolConfig) {
4351
- validatePoolConfig(poolConfig);
4352
- }
4353
- const connectionConfig = {
4354
- ...baseConfig,
4355
- // Map our PoolConfig to pg.Pool options
4356
- // Note: pg.Pool does not support a `min` option
4357
- ...poolConfig?.max !== void 0 && { max: poolConfig.max },
4358
- ...poolConfig?.idleTimeoutMillis !== void 0 && { idleTimeoutMillis: poolConfig.idleTimeoutMillis },
4359
- ...poolConfig?.acquireTimeoutMillis !== void 0 && { connectionTimeoutMillis: poolConfig.acquireTimeoutMillis }
4360
- };
4361
- logger7.debug("Creating PostgreSQL connection pool", {
4362
- vendor: this.vendor,
4363
- poolConfig: {
4364
- ...connectionConfig.max !== void 0 ? { max: connectionConfig.max } : {},
4365
- ...connectionConfig.idleTimeoutMillis !== void 0 ? { idleTimeoutMillis: connectionConfig.idleTimeoutMillis } : {},
4366
- ...connectionConfig.connectionTimeoutMillis !== void 0 ? { connectionTimeoutMillis: connectionConfig.connectionTimeoutMillis } : {}
4367
- }
4368
- });
4369
- this.client = new Pool(connectionConfig);
4370
- this.db = drizzle({ client: this.client });
4371
- }
4372
- /**
4373
- * Initialize MySQL connection using Drizzle ORM with mysql2
4374
- *
4375
- * Applies pool configuration options to mysql2.createPool for connection management.
4376
- */
4377
- async initializeMySQL() {
4378
- const { drizzle } = await import('drizzle-orm/mysql2');
4379
- const mysql = await import('mysql2/promise');
4380
- let connectionConfig;
4381
- if (typeof this.config.connection === "string") {
4382
- connectionConfig = this.config.connection;
4383
- logger7.debug("Creating MySQL connection pool from connection string", {
4384
- vendor: this.vendor
4385
- });
4386
- } else {
4387
- const { pool: poolConfig, ...baseConfig } = this.config.connection;
4388
- if (poolConfig) {
4389
- validatePoolConfig(poolConfig);
4390
- }
4391
- connectionConfig = {
4392
- ...baseConfig,
4393
- // Map our PoolConfig to mysql2 pool options
4394
- ...poolConfig?.max !== void 0 && { connectionLimit: poolConfig.max },
4395
- ...poolConfig?.acquireTimeoutMillis !== void 0 && { acquireTimeout: poolConfig.acquireTimeoutMillis },
4396
- ...poolConfig?.idleTimeoutMillis !== void 0 && { idleTimeout: poolConfig.idleTimeoutMillis }
4397
- };
4398
- logger7.debug("Creating MySQL connection pool", {
4399
- vendor: this.vendor,
4400
- poolConfig: {
4401
- ...connectionConfig.connectionLimit !== void 0 ? { connectionLimit: connectionConfig.connectionLimit } : {},
4402
- ...connectionConfig.acquireTimeout !== void 0 ? { acquireTimeout: connectionConfig.acquireTimeout } : {},
4403
- ...connectionConfig.idleTimeout !== void 0 ? { idleTimeout: connectionConfig.idleTimeout } : {}
4404
- }
4405
- });
4406
- }
4407
- this.client = mysql.createPool(connectionConfig);
4408
- this.db = drizzle({ client: this.client });
4409
- }
4410
- /**
4411
- * Initialize SQLite connection using Drizzle ORM with better-sqlite3
4412
- *
4413
- * Note: SQLite uses a single connection. Pool configuration is logged but not applied
4414
- * as SQLite handles concurrent access through its internal locking mechanism.
4415
- */
4416
- async initializeSQLite() {
4417
- const { drizzle } = await import('drizzle-orm/better-sqlite3');
4418
- const DatabaseModule = await import('better-sqlite3');
4419
- const Database = DatabaseModule.default;
4420
- const url = typeof this.config.connection === "string" ? this.config.connection : this.config.connection.url;
4421
- if (!url) {
4422
- throw new Error("SQLite connection requires a url property");
4423
- }
4424
- if (typeof this.config.connection === "object" && this.config.connection.pool) {
4425
- validatePoolConfig(this.config.connection.pool);
4426
- logger7.debug("SQLite pool configuration provided but not applied (SQLite uses single connection)", {
4427
- vendor: this.vendor,
4428
- poolConfig: {
4429
- ...this.config.connection.pool.max !== void 0 ? { max: this.config.connection.pool.max } : {},
4430
- ...this.config.connection.pool.idleTimeoutMillis !== void 0 ? { idleTimeoutMillis: this.config.connection.pool.idleTimeoutMillis } : {},
4431
- ...this.config.connection.pool.acquireTimeoutMillis !== void 0 ? { acquireTimeoutMillis: this.config.connection.pool.acquireTimeoutMillis } : {}
4432
- }
4433
- });
4434
- }
4435
- logger7.debug("Creating SQLite connection", {
4436
- vendor: this.vendor,
4437
- url: url === ":memory:" ? ":memory:" : "file"
4438
- });
4439
- this.client = new Database(url);
4440
- this.client.pragma("foreign_keys = ON");
4441
- this.db = drizzle({ client: this.client });
4442
- }
4443
4467
  /**
4444
4468
  * Determine whether an error thrown by drizzle-orm's better-sqlite3 adapter
4445
4469
  * `.all()` indicates the statement does not return data (i.e. it is DML/DDL,
@@ -4478,7 +4502,7 @@ var ConnectionManager = class extends EventEmitter {
4478
4502
  if (!this.db) {
4479
4503
  throw new Error("Database not initialized. Call initialize() first.");
4480
4504
  }
4481
- logger7.debug("Executing SQL query", {
4505
+ logger8.debug("Executing SQL query", {
4482
4506
  vendor: this.vendor
4483
4507
  });
4484
4508
  if (this.vendor === "sqlite") {
@@ -4609,14 +4633,14 @@ var ConnectionManager = class extends EventEmitter {
4609
4633
  async close() {
4610
4634
  this.connectionGeneration++;
4611
4635
  if (this.reconnectionTimer) {
4612
- logger7.debug("Canceling pending reconnection timer during close", {
4636
+ logger8.debug("Canceling pending reconnection timer during close", {
4613
4637
  vendor: this.vendor
4614
4638
  });
4615
4639
  clearTimeout(this.reconnectionTimer);
4616
4640
  this.reconnectionTimer = null;
4617
4641
  }
4618
4642
  if (this.connectPromise) {
4619
- logger7.debug("Waiting for in-flight connection attempt to complete before close", {
4643
+ logger8.debug("Waiting for in-flight connection attempt to complete before close", {
4620
4644
  vendor: this.vendor
4621
4645
  });
4622
4646
  try {
@@ -4626,7 +4650,7 @@ var ConnectionManager = class extends EventEmitter {
4626
4650
  this.connectPromise = null;
4627
4651
  }
4628
4652
  if (this.client) {
4629
- logger7.info("Closing database connection", {
4653
+ logger8.info("Closing database connection", {
4630
4654
  vendor: this.vendor,
4631
4655
  state: this.state
4632
4656
  });
@@ -4638,12 +4662,12 @@ var ConnectionManager = class extends EventEmitter {
4638
4662
  }
4639
4663
  this.setState("disconnected" /* DISCONNECTED */);
4640
4664
  this.emit("disconnected");
4641
- logger7.debug("Database connection closed successfully", {
4665
+ logger8.debug("Database connection closed successfully", {
4642
4666
  vendor: this.vendor,
4643
4667
  state: this.state
4644
4668
  });
4645
4669
  } catch (error) {
4646
- logger7.error("Error closing database connection", {
4670
+ logger8.error("Error closing database connection", {
4647
4671
  vendor: this.vendor,
4648
4672
  error: error instanceof Error ? error.message : String(error),
4649
4673
  state: this.state
@@ -4668,7 +4692,7 @@ var ConnectionManager = class extends EventEmitter {
4668
4692
  if (!this.client) {
4669
4693
  return;
4670
4694
  }
4671
- logger7.debug("Cleaning up cancelled connection", {
4695
+ logger8.debug("Cleaning up cancelled connection", {
4672
4696
  vendor: this.vendor
4673
4697
  });
4674
4698
  try {
@@ -4678,7 +4702,7 @@ var ConnectionManager = class extends EventEmitter {
4678
4702
  this.client.close();
4679
4703
  }
4680
4704
  } catch (error) {
4681
- logger7.debug("Error during cancelled connection cleanup", {
4705
+ logger8.debug("Error during cancelled connection cleanup", {
4682
4706
  vendor: this.vendor,
4683
4707
  error: error instanceof Error ? error.message : String(error)
4684
4708
  });
@@ -4693,15 +4717,15 @@ var ConnectionManager = class extends EventEmitter {
4693
4717
  */
4694
4718
  async isHealthy() {
4695
4719
  if (!this.db || !this.client) {
4696
- logger7.debug("Health check failed: connection not initialized", { vendor: this.vendor });
4720
+ logger8.debug("Health check failed: connection not initialized", { vendor: this.vendor });
4697
4721
  return false;
4698
4722
  }
4699
4723
  try {
4700
4724
  await this.execute(sql`SELECT 1`);
4701
- logger7.debug("Health check passed", { vendor: this.vendor });
4725
+ logger8.debug("Health check passed", { vendor: this.vendor });
4702
4726
  return true;
4703
4727
  } catch (error) {
4704
- logger7.debug("Health check failed", {
4728
+ logger8.debug("Health check failed", {
4705
4729
  vendor: this.vendor,
4706
4730
  error: error instanceof Error ? error.message : String(error)
4707
4731
  });
@@ -4709,7 +4733,7 @@ var ConnectionManager = class extends EventEmitter {
4709
4733
  }
4710
4734
  }
4711
4735
  };
4712
- var logger8 = createLogger("agentforge:tools:data:relational:query");
4736
+ var logger9 = createLogger("agentforge:tools:data:relational:query");
4713
4737
  function buildParameterizedQuery(sqlString, params) {
4714
4738
  if (!params) {
4715
4739
  return sql.raw(sqlString);
@@ -4784,7 +4808,7 @@ function buildParameterizedQuery(sqlString, params) {
4784
4808
  }
4785
4809
  async function executeQuery(manager, input, context) {
4786
4810
  const startTime = Date.now();
4787
- logger8.debug("Executing query", {
4811
+ logger9.debug("Executing query", {
4788
4812
  vendor: input.vendor,
4789
4813
  hasParams: !!input.params,
4790
4814
  paramCount: input.params ? Array.isArray(input.params) ? input.params.length : Object.keys(input.params).length : 0
@@ -4798,7 +4822,7 @@ async function executeQuery(manager, input, context) {
4798
4822
  const executionTime = Date.now() - startTime;
4799
4823
  const rows = Array.isArray(result) ? result : result.rows || [];
4800
4824
  const rowCount = result.rowCount || result.affectedRows || rows.length;
4801
- logger8.debug("Query executed successfully", {
4825
+ logger9.debug("Query executed successfully", {
4802
4826
  vendor: input.vendor,
4803
4827
  rowCount,
4804
4828
  executionTime
@@ -4810,7 +4834,7 @@ async function executeQuery(manager, input, context) {
4810
4834
  };
4811
4835
  } catch (error) {
4812
4836
  const executionTime = Date.now() - startTime;
4813
- logger8.error("Query execution failed", {
4837
+ logger9.error("Query execution failed", {
4814
4838
  vendor: input.vendor,
4815
4839
  error: error instanceof Error ? error.message : String(error),
4816
4840
  executionTime
@@ -5234,7 +5258,7 @@ function buildSelectQuery(input) {
5234
5258
  }
5235
5259
  return query;
5236
5260
  }
5237
- var logger9 = createLogger("agentforge:tools:data:relational:batch");
5261
+ var logger10 = createLogger("agentforge:tools:data:relational:batch");
5238
5262
  var DEFAULT_BATCH_SIZE = 100;
5239
5263
  var MAX_BATCH_SIZE = 5e3;
5240
5264
  var MAX_RETRY_ATTEMPTS = 5;
@@ -5285,7 +5309,7 @@ async function executeBatchedTask(task, options = {}) {
5285
5309
  let successfulItems = 0;
5286
5310
  let failedItems = 0;
5287
5311
  let retries = 0;
5288
- logger9.debug("Starting batched execution", {
5312
+ logger10.debug("Starting batched execution", {
5289
5313
  operation: task.operation,
5290
5314
  totalItems: task.items.length,
5291
5315
  totalBatches: batches.length,
@@ -5324,7 +5348,7 @@ async function executeBatchedTask(task, options = {}) {
5324
5348
  lastError = error;
5325
5349
  if (attempts <= resolved.maxRetries) {
5326
5350
  retries += 1;
5327
- logger9.warn("Batch execution failed, retrying", {
5351
+ logger10.warn("Batch execution failed, retrying", {
5328
5352
  operation: task.operation,
5329
5353
  batchIndex,
5330
5354
  attempts,
@@ -5363,7 +5387,7 @@ async function executeBatchedTask(task, options = {}) {
5363
5387
  { cause: lastError }
5364
5388
  );
5365
5389
  }
5366
- logger9.warn("Batch execution failed and was recorded for partial success", {
5390
+ logger10.warn("Batch execution failed and was recorded for partial success", {
5367
5391
  operation: task.operation,
5368
5392
  batchIndex,
5369
5393
  attempts,
@@ -5375,7 +5399,7 @@ async function executeBatchedTask(task, options = {}) {
5375
5399
  }
5376
5400
  const executionTime = Date.now() - startTime;
5377
5401
  const partialSuccess = successfulItems > 0 && failedItems > 0;
5378
- logger9.debug("Batched execution completed", {
5402
+ logger10.debug("Batched execution completed", {
5379
5403
  operation: task.operation,
5380
5404
  totalItems: task.items.length,
5381
5405
  successfulItems,
@@ -5419,7 +5443,7 @@ async function benchmarkBatchExecution(params) {
5419
5443
  const timeSavedMs = Math.max(individualExecutionTime - batchedExecutionTime, 0);
5420
5444
  const speedupRatio = batchedExecutionTime > 0 ? individualExecutionTime / batchedExecutionTime : 0;
5421
5445
  const speedupPercent = individualExecutionTime > 0 ? timeSavedMs / individualExecutionTime * 100 : 0;
5422
- logger9.debug("Batch benchmark completed", {
5446
+ logger10.debug("Batch benchmark completed", {
5423
5447
  itemCount: params.items.length,
5424
5448
  batchCount: batches.length,
5425
5449
  batchSize,
@@ -5439,7 +5463,7 @@ async function benchmarkBatchExecution(params) {
5439
5463
  speedupPercent
5440
5464
  };
5441
5465
  }
5442
- var logger10 = createLogger("agentforge:tools:data:relational:stream");
5466
+ var logger11 = createLogger("agentforge:tools:data:relational:stream");
5443
5467
  var DEFAULT_CHUNK_SIZE = 100;
5444
5468
  var MAX_CHUNK_SIZE = 5e3;
5445
5469
  var DEFAULT_SAMPLE_SIZE = 50;
@@ -5572,7 +5596,7 @@ async function executeStreamingSelect(executor, input, options = {}) {
5572
5596
  const endHeapUsed = process.memoryUsage().heapUsed;
5573
5597
  peakHeapUsed = Math.max(peakHeapUsed, endHeapUsed);
5574
5598
  const executionTime = Date.now() - startTime;
5575
- logger10.debug("Streaming SELECT execution completed", {
5599
+ logger11.debug("Streaming SELECT execution completed", {
5576
5600
  table: input.table,
5577
5601
  vendor: input.vendor,
5578
5602
  chunkCount,
@@ -5596,7 +5620,7 @@ async function executeStreamingSelect(executor, input, options = {}) {
5596
5620
  };
5597
5621
  }
5598
5622
  async function benchmarkStreamingSelectMemory(executor, input, options = {}) {
5599
- logger10.warn("Running streaming benchmark will execute the SELECT query twice (regular + streaming).", {
5623
+ logger11.warn("Running streaming benchmark will execute the SELECT query twice (regular + streaming).", {
5600
5624
  table: input.table,
5601
5625
  vendor: input.vendor
5602
5626
  });
@@ -5616,7 +5640,7 @@ async function benchmarkStreamingSelectMemory(executor, input, options = {}) {
5616
5640
  0
5617
5641
  );
5618
5642
  const memorySavedPercent = nonStreamingPeakHeapUsed > 0 ? memorySavedBytes / nonStreamingPeakHeapUsed * 100 : 0;
5619
- logger10.debug("Streaming benchmark completed", {
5643
+ logger11.debug("Streaming benchmark completed", {
5620
5644
  table: input.table,
5621
5645
  vendor: input.vendor,
5622
5646
  nonStreamingRows: nonStreamingRows.length,
@@ -5634,7 +5658,7 @@ async function benchmarkStreamingSelectMemory(executor, input, options = {}) {
5634
5658
  memorySavedPercent
5635
5659
  };
5636
5660
  }
5637
- var logger11 = createLogger("agentforge:tools:data:relational:transaction");
5661
+ var logger12 = createLogger("agentforge:tools:data:relational:transaction");
5638
5662
  var transactionSequence = 0;
5639
5663
  var SAVEPOINT_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
5640
5664
  function toSqlIsolationLevel(level) {
@@ -5793,7 +5817,7 @@ var ManagedTransaction = class {
5793
5817
  await this.executeQuery(sql.raw("PRAGMA read_uncommitted = 1"));
5794
5818
  this.shouldRestoreSqliteReadUncommitted = true;
5795
5819
  } else {
5796
- logger11.debug("Ignoring SQLite isolation level override", {
5820
+ logger12.debug("Ignoring SQLite isolation level override", {
5797
5821
  transactionId: this.id,
5798
5822
  isolationLevel: this.options.isolationLevel
5799
5823
  });
@@ -5818,7 +5842,7 @@ var ManagedTransaction = class {
5818
5842
  const targetValue = this.sqliteReadUncommittedOriginal ?? 0;
5819
5843
  await this.executeQuery(sql.raw(`PRAGMA read_uncommitted = ${targetValue}`));
5820
5844
  } catch (error) {
5821
- logger11.warn("Failed to restore SQLite read_uncommitted pragma", {
5845
+ logger12.warn("Failed to restore SQLite read_uncommitted pragma", {
5822
5846
  transactionId: this.id,
5823
5847
  error: error instanceof Error ? error.message : String(error)
5824
5848
  });
@@ -5847,7 +5871,7 @@ async function withTransaction(manager, operation, options) {
5847
5871
  const resolvedOptions = resolveOptions2(options);
5848
5872
  const transactionId = `tx-${++transactionSequence}`;
5849
5873
  const vendor = manager.getVendor();
5850
- logger11.debug("Starting transaction", {
5874
+ logger12.debug("Starting transaction", {
5851
5875
  transactionId,
5852
5876
  vendor,
5853
5877
  ...resolvedOptions.isolationLevel ? { isolationLevel: resolvedOptions.isolationLevel } : {},
@@ -5874,7 +5898,7 @@ async function withTransaction(manager, operation, options) {
5874
5898
  if (transaction.isActive()) {
5875
5899
  await transaction.commit();
5876
5900
  }
5877
- logger11.debug("Transaction committed", {
5901
+ logger12.debug("Transaction committed", {
5878
5902
  transactionId,
5879
5903
  vendor,
5880
5904
  duration: Date.now() - startTime
@@ -5885,14 +5909,14 @@ async function withTransaction(manager, operation, options) {
5885
5909
  try {
5886
5910
  await transaction.rollback();
5887
5911
  } catch (rollbackError) {
5888
- logger11.error("Transaction rollback failed", {
5912
+ logger12.error("Transaction rollback failed", {
5889
5913
  transactionId,
5890
5914
  vendor,
5891
5915
  error: rollbackError instanceof Error ? rollbackError.message : String(rollbackError)
5892
5916
  });
5893
5917
  }
5894
5918
  }
5895
- logger11.error("Transaction failed", {
5919
+ logger12.error("Transaction failed", {
5896
5920
  transactionId,
5897
5921
  vendor,
5898
5922
  duration: Date.now() - startTime,
@@ -5907,7 +5931,7 @@ async function withTransaction(manager, operation, options) {
5907
5931
  var VALID_TABLE_FILTER_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)?$/;
5908
5932
 
5909
5933
  // src/data/relational/schema/schema-inspector.ts
5910
- var logger12 = createLogger("agentforge:tools:data:relational:schema-inspector");
5934
+ var logger13 = createLogger("agentforge:tools:data:relational:schema-inspector");
5911
5935
  var DEFAULT_CACHE_TTL_MS = 6e4;
5912
5936
  var schemaCache = /* @__PURE__ */ new Map();
5913
5937
  var POSTGRES_TABLES_QUERY = `
@@ -6197,7 +6221,7 @@ var SchemaInspector = class _SchemaInspector {
6197
6221
  if (!bypassCache && this.cacheKey) {
6198
6222
  const cached = schemaCache.get(this.cacheKey);
6199
6223
  if (cached && cached.expiresAt > Date.now()) {
6200
- logger12.debug("Schema cache hit", { vendor: this.vendor });
6224
+ logger13.debug("Schema cache hit", { vendor: this.vendor });
6201
6225
  return filterSchemaTables(cloneSchema(cached.schema), tableFilters);
6202
6226
  }
6203
6227
  }
@@ -6464,7 +6488,7 @@ var SchemaInspector = class _SchemaInspector {
6464
6488
  }
6465
6489
  }
6466
6490
  };
6467
- var logger13 = createLogger("agentforge:tools:data:relational:schema-validator");
6491
+ var logger14 = createLogger("agentforge:tools:data:relational:schema-validator");
6468
6492
  function validateTableExists(schema, tableName) {
6469
6493
  const errors = [];
6470
6494
  if (!tableName || typeof tableName !== "string") {
@@ -6478,7 +6502,7 @@ function validateTableExists(schema, tableName) {
6478
6502
  `Table "${tableName}" does not exist. Available tables: ${available || "(none)"}`
6479
6503
  );
6480
6504
  }
6481
- logger13.debug("Table existence validation", { tableName, valid: errors.length === 0 });
6505
+ logger14.debug("Table existence validation", { tableName, valid: errors.length === 0 });
6482
6506
  return { valid: errors.length === 0, errors };
6483
6507
  }
6484
6508
  function validateColumnsExist(schema, tableName, columnNames) {
@@ -6501,7 +6525,7 @@ function validateColumnsExist(schema, tableName, columnNames) {
6501
6525
  );
6502
6526
  }
6503
6527
  }
6504
- logger13.debug("Column existence validation", {
6528
+ logger14.debug("Column existence validation", {
6505
6529
  tableName,
6506
6530
  columnCount: columnNames.length,
6507
6531
  valid: errors.length === 0
@@ -6537,7 +6561,7 @@ function validateColumnTypes(schema, tableName, expectedTypes) {
6537
6561
  );
6538
6562
  }
6539
6563
  }
6540
- logger13.debug("Column type validation", {
6564
+ logger14.debug("Column type validation", {
6541
6565
  tableName,
6542
6566
  typeChecks: Object.keys(expectedTypes).length,
6543
6567
  valid: errors.length === 0
@@ -6557,7 +6581,7 @@ function findTable(schema, tableName) {
6557
6581
  function formatTableName(table) {
6558
6582
  return table.schema ? `${table.schema}.${table.name}` : table.name;
6559
6583
  }
6560
- var logger14 = createLogger("agentforge:tools:data:relational:type-mapper");
6584
+ var logger15 = createLogger("agentforge:tools:data:relational:type-mapper");
6561
6585
  var POSTGRES_TYPE_MAP = {
6562
6586
  // Numeric
6563
6587
  smallint: "number",
@@ -6723,7 +6747,7 @@ function mapColumnType(vendor, dbType, nullable = false) {
6723
6747
  const result = { tsType, nullable, dbType };
6724
6748
  if (tsType === "unknown" && normalised !== "json" && normalised !== "jsonb") {
6725
6749
  result.notes = `No explicit mapping for "${dbType}"; defaulting to unknown`;
6726
- logger14.debug("Unmapped database type", { vendor, dbType, normalised });
6750
+ logger15.debug("Unmapped database type", { vendor, dbType, normalised });
6727
6751
  }
6728
6752
  if ((normalised === "bigint" || normalised === "int8" || normalised === "bigserial") && (vendor === "postgresql" || vendor === "mysql")) {
6729
6753
  result.notes = "Mapped to string to avoid JavaScript number precision loss for 64-bit integers";
@@ -6738,7 +6762,7 @@ function mapSchemaTypes(vendor, columns) {
6738
6762
  }
6739
6763
  result.get(col.table).set(col.name, mapColumnType(vendor, col.type, col.nullable));
6740
6764
  }
6741
- logger14.debug("Schema type mapping complete", {
6765
+ logger15.debug("Schema type mapping complete", {
6742
6766
  vendor,
6743
6767
  tables: result.size,
6744
6768
  columns: columns.length
@@ -6755,7 +6779,7 @@ function normaliseDbType(raw) {
6755
6779
  type = type.replace(/\s+unsigned$/, "");
6756
6780
  return type.trim();
6757
6781
  }
6758
- var logger15 = createLogger("agentforge:tools:data:relational:schema-diff");
6782
+ var logger16 = createLogger("agentforge:tools:data:relational:schema-diff");
6759
6783
  function diffSchemas(before, after) {
6760
6784
  const tableDiffs = [];
6761
6785
  let columnsAdded = 0;
@@ -6795,7 +6819,7 @@ function diffSchemas(before, after) {
6795
6819
  const tablesRemoved = tableDiffs.filter((d) => d.type === "removed").length;
6796
6820
  const tablesChanged = tableDiffs.filter((d) => d.type === "changed").length;
6797
6821
  const identical = tableDiffs.length === 0;
6798
- logger15.debug("Schema diff computed", {
6822
+ logger16.debug("Schema diff computed", {
6799
6823
  identical,
6800
6824
  tablesAdded,
6801
6825
  tablesRemoved,
@@ -6839,7 +6863,7 @@ function importSchemaFromJson(json) {
6839
6863
  throw new Error(`Invalid schema JSON: table "${table.name}" missing "primaryKey" array`);
6840
6864
  }
6841
6865
  }
6842
- logger15.debug("Schema imported from JSON", {
6866
+ logger16.debug("Schema imported from JSON", {
6843
6867
  vendor: obj.vendor,
6844
6868
  tableCount: obj.tables.length
6845
6869
  });
@@ -7136,7 +7160,7 @@ function isSafeValidationError(error) {
7136
7160
  }
7137
7161
 
7138
7162
  // src/data/relational/tools/relational-select/executor.ts
7139
- var logger16 = createLogger("agentforge:tools:data:relational:select");
7163
+ var logger17 = createLogger("agentforge:tools:data:relational:select");
7140
7164
  function toSelectQueryInput(input) {
7141
7165
  return {
7142
7166
  table: input.table,
@@ -7150,7 +7174,7 @@ function toSelectQueryInput(input) {
7150
7174
  }
7151
7175
  async function executeSelect(manager, input, context) {
7152
7176
  const startTime = Date.now();
7153
- logger16.debug("Building SELECT query", {
7177
+ logger17.debug("Building SELECT query", {
7154
7178
  vendor: input.vendor,
7155
7179
  table: input.table,
7156
7180
  hasWhere: !!input.where,
@@ -7168,7 +7192,7 @@ async function executeSelect(manager, input, context) {
7168
7192
  };
7169
7193
  const streamInput = toSelectQueryInput(input);
7170
7194
  if (input.streaming.benchmark) {
7171
- logger16.warn("Streaming benchmark enabled; SELECT will execute up to three times (result + benchmark regular + benchmark streaming).", {
7195
+ logger17.warn("Streaming benchmark enabled; SELECT will execute up to three times (result + benchmark regular + benchmark streaming).", {
7172
7196
  vendor: input.vendor,
7173
7197
  table: input.table,
7174
7198
  chunkSize: streamOptions.chunkSize ?? DEFAULT_CHUNK_SIZE,
@@ -7179,7 +7203,7 @@ async function executeSelect(manager, input, context) {
7179
7203
  const streamResult = await executeStreamingSelect(executor, streamInput, streamOptions);
7180
7204
  const benchmark = input.streaming.benchmark ? await benchmarkStreamingSelectMemory(executor, streamInput, streamOptions) : void 0;
7181
7205
  const executionTime2 = Date.now() - startTime;
7182
- logger16.debug("Streaming SELECT query executed successfully", {
7206
+ logger17.debug("Streaming SELECT query executed successfully", {
7183
7207
  vendor: input.vendor,
7184
7208
  table: input.table,
7185
7209
  rowCount: streamResult.rowCount,
@@ -7208,7 +7232,7 @@ async function executeSelect(manager, input, context) {
7208
7232
  const executionTime = Date.now() - startTime;
7209
7233
  const rows = Array.isArray(result) ? result : result.rows || [];
7210
7234
  const rowCount = rows.length;
7211
- logger16.debug("SELECT query executed successfully", {
7235
+ logger17.debug("SELECT query executed successfully", {
7212
7236
  vendor: input.vendor,
7213
7237
  table: input.table,
7214
7238
  rowCount,
@@ -7221,7 +7245,7 @@ async function executeSelect(manager, input, context) {
7221
7245
  };
7222
7246
  } catch (error) {
7223
7247
  const executionTime = Date.now() - startTime;
7224
- logger16.error("SELECT query execution failed", {
7248
+ logger17.error("SELECT query execution failed", {
7225
7249
  vendor: input.vendor,
7226
7250
  table: input.table,
7227
7251
  error: error instanceof Error ? error.message : String(error),
@@ -7397,7 +7421,7 @@ function isSafeInsertError(error) {
7397
7421
  }
7398
7422
 
7399
7423
  // src/data/relational/tools/relational-insert/executor.ts
7400
- var logger17 = createLogger("agentforge:tools:data:relational:insert");
7424
+ var logger18 = createLogger("agentforge:tools:data:relational:insert");
7401
7425
  function toNumber(value) {
7402
7426
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
7403
7427
  }
@@ -7546,7 +7570,7 @@ async function executeInsertInBatchMode(manager, input, context, options) {
7546
7570
  maxRetries: options.maxRetries,
7547
7571
  retryDelayMs: options.retryDelayMs,
7548
7572
  onProgress: (progress) => {
7549
- logger17.debug("INSERT batch progress", {
7573
+ logger18.debug("INSERT batch progress", {
7550
7574
  vendor: input.vendor,
7551
7575
  table: input.table,
7552
7576
  ...progress
@@ -7559,7 +7583,7 @@ async function executeInsertInBatchMode(manager, input, context, options) {
7559
7583
  const insertedIds = batchResult.results.flatMap((result) => result.insertedIds);
7560
7584
  let benchmark;
7561
7585
  if (options.benchmark) {
7562
- logger17.warn("INSERT batch benchmark enabled. Synthetic benchmark callbacks are side-effect free and do not execute SQL.", {
7586
+ logger18.warn("INSERT batch benchmark enabled. Synthetic benchmark callbacks are side-effect free and do not execute SQL.", {
7563
7587
  vendor: input.vendor,
7564
7588
  table: input.table,
7565
7589
  totalRows: input.data.length,
@@ -7596,7 +7620,7 @@ async function executeInsertInBatchMode(manager, input, context, options) {
7596
7620
  }
7597
7621
  async function executeInsert(manager, input, context) {
7598
7622
  const startTime = Date.now();
7599
- logger17.debug("Building INSERT query", {
7623
+ logger18.debug("Building INSERT query", {
7600
7624
  vendor: input.vendor,
7601
7625
  table: input.table,
7602
7626
  isBatch: Array.isArray(input.data),
@@ -7612,7 +7636,7 @@ async function executeInsert(manager, input, context) {
7612
7636
  batchOptions
7613
7637
  ) : await executeInsertOnce(manager, input, context);
7614
7638
  const executionTime = Date.now() - startTime;
7615
- logger17.debug("INSERT query executed successfully", {
7639
+ logger18.debug("INSERT query executed successfully", {
7616
7640
  vendor: input.vendor,
7617
7641
  table: input.table,
7618
7642
  rowCount: result.rowCount,
@@ -7628,7 +7652,7 @@ async function executeInsert(manager, input, context) {
7628
7652
  };
7629
7653
  } catch (error) {
7630
7654
  const executionTime = Date.now() - startTime;
7631
- logger17.error("INSERT query execution failed", {
7655
+ logger18.error("INSERT query execution failed", {
7632
7656
  vendor: input.vendor,
7633
7657
  table: input.table,
7634
7658
  error: error instanceof Error ? error.message : String(error),
@@ -7958,7 +7982,7 @@ function isSafeUpdateError(error) {
7958
7982
  }
7959
7983
 
7960
7984
  // src/data/relational/tools/relational-update/executor.ts
7961
- var logger18 = createLogger("agentforge:tools:data:relational:update");
7985
+ var logger19 = createLogger("agentforge:tools:data:relational:update");
7962
7986
  function toNumber2(value) {
7963
7987
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
7964
7988
  }
@@ -8080,7 +8104,7 @@ async function executeUpdateInBatchMode(manager, input, context, options) {
8080
8104
  maxRetries: options.maxRetries,
8081
8105
  retryDelayMs: options.retryDelayMs,
8082
8106
  onProgress: (progress) => {
8083
- logger18.debug("UPDATE batch progress", {
8107
+ logger19.debug("UPDATE batch progress", {
8084
8108
  vendor: input.vendor,
8085
8109
  table: input.table,
8086
8110
  ...progress
@@ -8092,7 +8116,7 @@ async function executeUpdateInBatchMode(manager, input, context, options) {
8092
8116
  const operationFailures = batchResult.results.flatMap((result) => result.failures);
8093
8117
  let benchmark;
8094
8118
  if (options.benchmark) {
8095
- logger18.warn("UPDATE batch benchmark enabled. Synthetic benchmark callbacks are side-effect free and do not execute SQL.", {
8119
+ logger19.warn("UPDATE batch benchmark enabled. Synthetic benchmark callbacks are side-effect free and do not execute SQL.", {
8096
8120
  vendor: input.vendor,
8097
8121
  table: input.table,
8098
8122
  operationCount: input.operations.length,
@@ -8127,7 +8151,7 @@ async function executeUpdateInBatchMode(manager, input, context, options) {
8127
8151
  }
8128
8152
  async function executeUpdate(manager, input, context) {
8129
8153
  const startTime = Date.now();
8130
- logger18.debug("Building UPDATE query", {
8154
+ logger19.debug("Building UPDATE query", {
8131
8155
  vendor: input.vendor,
8132
8156
  table: input.table,
8133
8157
  hasWhere: !!input.where?.length,
@@ -8145,7 +8169,7 @@ async function executeUpdate(manager, input, context) {
8145
8169
  batchOptions
8146
8170
  ) : await executeSingleUpdate(manager, input, toSingleUpdateOperation(input), context);
8147
8171
  const executionTime = Date.now() - startTime;
8148
- logger18.debug("UPDATE query executed successfully", {
8172
+ logger19.debug("UPDATE query executed successfully", {
8149
8173
  vendor: input.vendor,
8150
8174
  table: input.table,
8151
8175
  rowCount: result.rowCount,
@@ -8159,7 +8183,7 @@ async function executeUpdate(manager, input, context) {
8159
8183
  };
8160
8184
  } catch (error) {
8161
8185
  const executionTime = Date.now() - startTime;
8162
- logger18.error("UPDATE query execution failed", {
8186
+ logger19.error("UPDATE query execution failed", {
8163
8187
  vendor: input.vendor,
8164
8188
  table: input.table,
8165
8189
  error: error instanceof Error ? error.message : String(error),
@@ -8463,7 +8487,7 @@ function isSafeDeleteError(error) {
8463
8487
  }
8464
8488
 
8465
8489
  // src/data/relational/tools/relational-delete/executor.ts
8466
- var logger19 = createLogger("agentforge:tools:data:relational:delete");
8490
+ var logger20 = createLogger("agentforge:tools:data:relational:delete");
8467
8491
  function toNumber3(value) {
8468
8492
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
8469
8493
  }
@@ -8584,7 +8608,7 @@ async function executeDeleteInBatchMode(manager, input, context, options) {
8584
8608
  maxRetries: options.maxRetries,
8585
8609
  retryDelayMs: options.retryDelayMs,
8586
8610
  onProgress: (progress) => {
8587
- logger19.debug("DELETE batch progress", {
8611
+ logger20.debug("DELETE batch progress", {
8588
8612
  vendor: input.vendor,
8589
8613
  table: input.table,
8590
8614
  ...progress
@@ -8597,7 +8621,7 @@ async function executeDeleteInBatchMode(manager, input, context, options) {
8597
8621
  const operationFailures = batchResult.results.flatMap((result) => result.failures);
8598
8622
  let benchmark;
8599
8623
  if (options.benchmark) {
8600
- logger19.warn("DELETE batch benchmark enabled. Synthetic benchmark callbacks are side-effect free and do not execute SQL.", {
8624
+ logger20.warn("DELETE batch benchmark enabled. Synthetic benchmark callbacks are side-effect free and do not execute SQL.", {
8601
8625
  vendor: input.vendor,
8602
8626
  table: input.table,
8603
8627
  operationCount: input.operations.length,
@@ -8633,7 +8657,7 @@ async function executeDeleteInBatchMode(manager, input, context, options) {
8633
8657
  }
8634
8658
  async function executeDelete(manager, input, context) {
8635
8659
  const startTime = Date.now();
8636
- logger19.debug("Building DELETE query", {
8660
+ logger20.debug("Building DELETE query", {
8637
8661
  vendor: input.vendor,
8638
8662
  table: input.table,
8639
8663
  hasWhere: !!input.where?.length,
@@ -8652,7 +8676,7 @@ async function executeDelete(manager, input, context) {
8652
8676
  batchOptions
8653
8677
  ) : await executeSingleDelete(manager, input, toSingleDeleteOperation(input), context);
8654
8678
  const executionTime = Date.now() - startTime;
8655
- logger19.debug("DELETE query executed successfully", {
8679
+ logger20.debug("DELETE query executed successfully", {
8656
8680
  vendor: input.vendor,
8657
8681
  table: input.table,
8658
8682
  rowCount: result.rowCount,
@@ -8668,7 +8692,7 @@ async function executeDelete(manager, input, context) {
8668
8692
  };
8669
8693
  } catch (error) {
8670
8694
  const executionTime = Date.now() - startTime;
8671
- logger19.error("DELETE query execution failed", {
8695
+ logger20.error("DELETE query execution failed", {
8672
8696
  vendor: input.vendor,
8673
8697
  table: input.table,
8674
8698
  error: error instanceof Error ? error.message : String(error),
@@ -8773,7 +8797,7 @@ function isSafeGetSchemaValidationError(error) {
8773
8797
  }
8774
8798
 
8775
8799
  // src/data/relational/tools/relational-get-schema.ts
8776
- var logger20 = createLogger("agentforge:tools:data:relational:get-schema");
8800
+ var logger21 = createLogger("agentforge:tools:data:relational:get-schema");
8777
8801
  function buildSchemaCacheKey(vendor, connectionString, database) {
8778
8802
  const databaseScope = database ?? "default";
8779
8803
  const connectionHash = createHash("sha256").update(connectionString).digest("hex");
@@ -8845,7 +8869,7 @@ var relationalGetSchema = toolBuilder().name("relational-get-schema").displayNam
8845
8869
  summary
8846
8870
  };
8847
8871
  } catch (error) {
8848
- logger20.error("Schema introspection failed", {
8872
+ logger21.error("Schema introspection failed", {
8849
8873
  vendor: input.vendor,
8850
8874
  hasTablesFilter: Array.isArray(input.tables),
8851
8875
  tablesFilterCount: input.tables?.length ?? 0,
@@ -10011,7 +10035,7 @@ var AskHumanInputSchema = z.object({
10011
10035
  suggestions: z.array(z.string()).optional().describe("Suggested responses for the human")
10012
10036
  });
10013
10037
  var logLevel3 = process.env.LOG_LEVEL?.toLowerCase() || LogLevel.INFO;
10014
- var logger21 = createLogger("agentforge:tools:agent:ask-human", { level: logLevel3 });
10038
+ var logger22 = createLogger("agentforge:tools:agent:ask-human", { level: logLevel3 });
10015
10039
  function isRecord(value) {
10016
10040
  return typeof value === "object" && value !== null;
10017
10041
  }
@@ -10076,7 +10100,7 @@ function createAskHumanTool() {
10076
10100
  suggestions: validatedInput.suggestions,
10077
10101
  status: "pending"
10078
10102
  };
10079
- logger21.debug("About to call interrupt()", {
10103
+ logger22.debug("About to call interrupt()", {
10080
10104
  humanRequest: {
10081
10105
  id: humanRequest.id,
10082
10106
  question: humanRequest.question,
@@ -10092,13 +10116,13 @@ function createAskHumanTool() {
10092
10116
  let response;
10093
10117
  try {
10094
10118
  response = interrupt(humanRequest);
10095
- logger21.debug("interrupt() returned successfully", {
10119
+ logger22.debug("interrupt() returned successfully", {
10096
10120
  responseType: typeof response,
10097
10121
  hasResponse: response != null,
10098
10122
  ...typeof response === "string" ? { responseLength: response.length } : {}
10099
10123
  });
10100
10124
  } catch (error) {
10101
- logger21.debug("interrupt() threw error (expected for GraphInterrupt)", {
10125
+ logger22.debug("interrupt() threw error (expected for GraphInterrupt)", {
10102
10126
  ...error && typeof error === "object" && "constructor" in error ? { errorType: error.constructor?.name } : {},
10103
10127
  error: error instanceof Error ? error.message : String(error)
10104
10128
  });