@agentforge/tools 0.16.58 → 0.16.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +120 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +120 -109
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -815,7 +815,7 @@ function getDefaultSlackClient() {
|
|
|
815
815
|
}
|
|
816
816
|
};
|
|
817
817
|
}
|
|
818
|
-
function createSendSlackMessageTool(getSlackClient,
|
|
818
|
+
function createSendSlackMessageTool(getSlackClient, logger20) {
|
|
819
819
|
return core.toolBuilder().name("send-slack-message").description("Send a message to a Slack channel for team communication and notifications").category(core.ToolCategory.WEB).tags(["slack", "messaging", "communication"]).usageNotes(
|
|
820
820
|
"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."
|
|
821
821
|
).suggests(["get-slack-channels"]).schema(
|
|
@@ -824,7 +824,7 @@ function createSendSlackMessageTool(getSlackClient, logger22) {
|
|
|
824
824
|
message: zod.z.string().describe("Message content to send")
|
|
825
825
|
})
|
|
826
826
|
).implementSafe(async ({ channel, message }) => {
|
|
827
|
-
|
|
827
|
+
logger20.info("send-slack-message called", { channel, messageLength: message.length });
|
|
828
828
|
try {
|
|
829
829
|
const { client: slack, config } = getSlackClient();
|
|
830
830
|
const result = await slack.chat.postMessage({
|
|
@@ -833,7 +833,7 @@ function createSendSlackMessageTool(getSlackClient, logger22) {
|
|
|
833
833
|
username: config.botName,
|
|
834
834
|
icon_emoji: config.botIcon
|
|
835
835
|
});
|
|
836
|
-
|
|
836
|
+
logger20.info("send-slack-message result", {
|
|
837
837
|
...result.channel ? { channel: result.channel } : {},
|
|
838
838
|
...result.ts ? { timestamp: result.ts } : {},
|
|
839
839
|
messageLength: message.length,
|
|
@@ -846,7 +846,7 @@ function createSendSlackMessageTool(getSlackClient, logger22) {
|
|
|
846
846
|
message_id: result.ts
|
|
847
847
|
};
|
|
848
848
|
} catch (error) {
|
|
849
|
-
|
|
849
|
+
logger20.error("send-slack-message failed", {
|
|
850
850
|
channel,
|
|
851
851
|
error: error.message,
|
|
852
852
|
data: error.data
|
|
@@ -855,7 +855,7 @@ function createSendSlackMessageTool(getSlackClient, logger22) {
|
|
|
855
855
|
}
|
|
856
856
|
}).build();
|
|
857
857
|
}
|
|
858
|
-
function createNotifySlackTool(getSlackClient,
|
|
858
|
+
function createNotifySlackTool(getSlackClient, logger20) {
|
|
859
859
|
return core.toolBuilder().name("notify-slack").description("Send a notification to a Slack channel with optional @mentions for urgent alerts").category(core.ToolCategory.WEB).tags(["slack", "notification", "alert"]).usageNotes(
|
|
860
860
|
"Use this for urgent notifications that require @mentions. For general messages without mentions, use send-slack-message instead."
|
|
861
861
|
).suggests(["get-slack-channels"]).schema(
|
|
@@ -865,7 +865,7 @@ function createNotifySlackTool(getSlackClient, logger22) {
|
|
|
865
865
|
mentions: zod.z.array(zod.z.string()).optional().describe("List of usernames to mention (without @)")
|
|
866
866
|
})
|
|
867
867
|
).implementSafe(async ({ channel, message, mentions = [] }) => {
|
|
868
|
-
|
|
868
|
+
logger20.info("notify-slack called", {
|
|
869
869
|
channel,
|
|
870
870
|
messageLength: message.length,
|
|
871
871
|
mentionCount: mentions.length
|
|
@@ -879,7 +879,7 @@ function createNotifySlackTool(getSlackClient, logger22) {
|
|
|
879
879
|
username: config.botName,
|
|
880
880
|
icon_emoji: config.botIcon
|
|
881
881
|
});
|
|
882
|
-
|
|
882
|
+
logger20.info("notify-slack result", {
|
|
883
883
|
...result.channel ? { channel: result.channel } : {},
|
|
884
884
|
...result.ts ? { timestamp: result.ts } : {},
|
|
885
885
|
mentions: mentions.length
|
|
@@ -893,7 +893,7 @@ function createNotifySlackTool(getSlackClient, logger22) {
|
|
|
893
893
|
};
|
|
894
894
|
}).build();
|
|
895
895
|
}
|
|
896
|
-
function createGetSlackChannelsTool(getSlackClient,
|
|
896
|
+
function createGetSlackChannelsTool(getSlackClient, logger20) {
|
|
897
897
|
return core.toolBuilder().name("get-slack-channels").description("Get a list of available Slack channels to find the right channel for messaging").category(core.ToolCategory.WEB).tags(["slack", "channels", "list"]).usageNotes(
|
|
898
898
|
"Use this first to discover available channels before sending messages. Helps ensure you are sending to the correct channel."
|
|
899
899
|
).follows(["send-slack-message", "notify-slack"]).schema(
|
|
@@ -901,7 +901,7 @@ function createGetSlackChannelsTool(getSlackClient, logger22) {
|
|
|
901
901
|
include_private: zod.z.boolean().optional().describe("Include private channels (default: false)")
|
|
902
902
|
})
|
|
903
903
|
).implementSafe(async ({ include_private = false }) => {
|
|
904
|
-
|
|
904
|
+
logger20.info("get-slack-channels called", { include_private });
|
|
905
905
|
const { client: slack } = getSlackClient();
|
|
906
906
|
const publicChannels = await slack.conversations.list({
|
|
907
907
|
types: "public_channel",
|
|
@@ -915,7 +915,7 @@ function createGetSlackChannelsTool(getSlackClient, logger22) {
|
|
|
915
915
|
});
|
|
916
916
|
allChannels = [...allChannels, ...privateChannels.channels || []];
|
|
917
917
|
}
|
|
918
|
-
|
|
918
|
+
logger20.info("get-slack-channels result", {
|
|
919
919
|
channelCount: allChannels.length,
|
|
920
920
|
includePrivate: include_private
|
|
921
921
|
});
|
|
@@ -930,7 +930,7 @@ function createGetSlackChannelsTool(getSlackClient, logger22) {
|
|
|
930
930
|
};
|
|
931
931
|
}).build();
|
|
932
932
|
}
|
|
933
|
-
function createGetSlackMessagesTool(getSlackClient,
|
|
933
|
+
function createGetSlackMessagesTool(getSlackClient, logger20) {
|
|
934
934
|
return core.toolBuilder().name("get-slack-messages").description("Retrieve message history from a Slack channel to read recent conversations").category(core.ToolCategory.WEB).tags(["slack", "messages", "history", "read"]).usageNotes(
|
|
935
935
|
"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)."
|
|
936
936
|
).suggests(["get-slack-channels"]).schema(
|
|
@@ -939,7 +939,7 @@ function createGetSlackMessagesTool(getSlackClient, logger22) {
|
|
|
939
939
|
limit: zod.z.number().int().min(1).max(100).optional().describe("Number of messages to retrieve (default: 20, max: 100)")
|
|
940
940
|
})
|
|
941
941
|
).implementSafe(async ({ channel, limit = 20 }) => {
|
|
942
|
-
|
|
942
|
+
logger20.info("get-slack-messages called", { channel, limit });
|
|
943
943
|
try {
|
|
944
944
|
const { client: slack } = getSlackClient();
|
|
945
945
|
let channelId = channel;
|
|
@@ -950,7 +950,7 @@ function createGetSlackMessagesTool(getSlackClient, logger22) {
|
|
|
950
950
|
});
|
|
951
951
|
const found = channels.channels?.find((c) => c.name === channel);
|
|
952
952
|
if (!found) {
|
|
953
|
-
|
|
953
|
+
logger20.error("get-slack-messages: channel not found", { channel });
|
|
954
954
|
throw new Error(
|
|
955
955
|
`Channel '${channel}' not found. Use get-slack-channels to see available channels.`
|
|
956
956
|
);
|
|
@@ -962,7 +962,7 @@ function createGetSlackMessagesTool(getSlackClient, logger22) {
|
|
|
962
962
|
limit: Math.min(limit, 100)
|
|
963
963
|
// Cap at 100 for performance
|
|
964
964
|
});
|
|
965
|
-
|
|
965
|
+
logger20.info("get-slack-messages result", {
|
|
966
966
|
channel: channelId,
|
|
967
967
|
messageCount: result.messages?.length || 0,
|
|
968
968
|
limit
|
|
@@ -980,7 +980,7 @@ function createGetSlackMessagesTool(getSlackClient, logger22) {
|
|
|
980
980
|
})) || []
|
|
981
981
|
};
|
|
982
982
|
} catch (error) {
|
|
983
|
-
|
|
983
|
+
logger20.error("get-slack-messages failed", {
|
|
984
984
|
channel,
|
|
985
985
|
error: error.message,
|
|
986
986
|
data: error.data
|
|
@@ -1061,12 +1061,12 @@ function getAuthHeader() {
|
|
|
1061
1061
|
const auth2 = Buffer.from(`${ATLASSIAN_EMAIL}:${ATLASSIAN_API_KEY}`).toString("base64");
|
|
1062
1062
|
return `Basic ${auth2}`;
|
|
1063
1063
|
}
|
|
1064
|
-
function createSearchConfluenceTool(getAuth, getAuthHeader2,
|
|
1064
|
+
function createSearchConfluenceTool(getAuth, getAuthHeader2, logger20) {
|
|
1065
1065
|
return core.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(core.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(zod.z.object({
|
|
1066
1066
|
query: zod.z.string().describe("Search query or CQL expression (e.g., 'payment processing' or 'space=BL3 AND title~payment')"),
|
|
1067
1067
|
limit: zod.z.number().optional().describe("Maximum number of results to return (default: 10, max: 25)")
|
|
1068
1068
|
})).implement(async ({ query, limit = 10 }) => {
|
|
1069
|
-
|
|
1069
|
+
logger20.info("search-confluence called", { query, limit });
|
|
1070
1070
|
try {
|
|
1071
1071
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1072
1072
|
const response = await axios16__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/search`, {
|
|
@@ -1091,13 +1091,13 @@ function createSearchConfluenceTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1091
1091
|
lastModified: page.version?.when || ""
|
|
1092
1092
|
}));
|
|
1093
1093
|
if (results.length === 0) {
|
|
1094
|
-
|
|
1094
|
+
logger20.warn("search-confluence returned NO RESULTS - this is a valid outcome, agent should not retry", {
|
|
1095
1095
|
query,
|
|
1096
1096
|
limit,
|
|
1097
1097
|
totalSize: response.data.totalSize
|
|
1098
1098
|
});
|
|
1099
1099
|
} else {
|
|
1100
|
-
|
|
1100
|
+
logger20.info("search-confluence result", {
|
|
1101
1101
|
query,
|
|
1102
1102
|
resultCount: results.length,
|
|
1103
1103
|
totalSize: response.data.totalSize,
|
|
@@ -1112,7 +1112,7 @@ function createSearchConfluenceTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1112
1112
|
results
|
|
1113
1113
|
});
|
|
1114
1114
|
} catch (error) {
|
|
1115
|
-
|
|
1115
|
+
logger20.error("search-confluence error", {
|
|
1116
1116
|
query,
|
|
1117
1117
|
error: error.response?.data?.message || error.message,
|
|
1118
1118
|
status: error.response?.status
|
|
@@ -1124,11 +1124,11 @@ function createSearchConfluenceTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
}).build();
|
|
1126
1126
|
}
|
|
1127
|
-
function createGetConfluencePageTool(getAuth, getAuthHeader2,
|
|
1127
|
+
function createGetConfluencePageTool(getAuth, getAuthHeader2, logger20) {
|
|
1128
1128
|
return core.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(core.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(zod.z.object({
|
|
1129
1129
|
page_id: zod.z.string().describe("The Confluence page ID (from search results)")
|
|
1130
1130
|
})).implement(async ({ page_id }) => {
|
|
1131
|
-
|
|
1131
|
+
logger20.info("get-confluence-page called", { page_id });
|
|
1132
1132
|
try {
|
|
1133
1133
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1134
1134
|
const response = await axios16__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`, {
|
|
@@ -1141,7 +1141,7 @@ function createGetConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1141
1141
|
}
|
|
1142
1142
|
});
|
|
1143
1143
|
const page = response.data;
|
|
1144
|
-
|
|
1144
|
+
logger20.info("get-confluence-page result", {
|
|
1145
1145
|
page_id,
|
|
1146
1146
|
title: page.title,
|
|
1147
1147
|
space: page.space?.name,
|
|
@@ -1163,7 +1163,7 @@ function createGetConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
});
|
|
1165
1165
|
} catch (error) {
|
|
1166
|
-
|
|
1166
|
+
logger20.error("get-confluence-page error", {
|
|
1167
1167
|
page_id,
|
|
1168
1168
|
error: error.response?.data?.message || error.message,
|
|
1169
1169
|
status: error.response?.status
|
|
@@ -1175,11 +1175,11 @@ function createGetConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
}).build();
|
|
1177
1177
|
}
|
|
1178
|
-
function createListConfluenceSpacesTool(getAuth, getAuthHeader2,
|
|
1178
|
+
function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger20) {
|
|
1179
1179
|
return core.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(core.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(zod.z.object({
|
|
1180
1180
|
limit: zod.z.number().optional().describe("Maximum number of spaces to return (default: 25)")
|
|
1181
1181
|
})).implement(async ({ limit = 25 }) => {
|
|
1182
|
-
|
|
1182
|
+
logger20.info("list-confluence-spaces called", { limit });
|
|
1183
1183
|
try {
|
|
1184
1184
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1185
1185
|
const response = await axios16__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/space`, {
|
|
@@ -1198,7 +1198,7 @@ function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1198
1198
|
description: space.description?.plain?.value || "",
|
|
1199
1199
|
url: `${ATLASSIAN_SITE_URL}/wiki${space._links.webui}`
|
|
1200
1200
|
}));
|
|
1201
|
-
|
|
1201
|
+
logger20.info("list-confluence-spaces result", {
|
|
1202
1202
|
spaceCount: spaces.length,
|
|
1203
1203
|
spaceKeys: spaces.map((s) => s.key).slice(0, 5)
|
|
1204
1204
|
// Log first 5 space keys
|
|
@@ -1209,7 +1209,7 @@ function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1209
1209
|
spaces
|
|
1210
1210
|
});
|
|
1211
1211
|
} catch (error) {
|
|
1212
|
-
|
|
1212
|
+
logger20.error("list-confluence-spaces error", {
|
|
1213
1213
|
error: error.response?.data?.message || error.message,
|
|
1214
1214
|
status: error.response?.status
|
|
1215
1215
|
});
|
|
@@ -1220,12 +1220,12 @@ function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1220
1220
|
}
|
|
1221
1221
|
}).build();
|
|
1222
1222
|
}
|
|
1223
|
-
function createGetSpacePagesTool(getAuth, getAuthHeader2,
|
|
1223
|
+
function createGetSpacePagesTool(getAuth, getAuthHeader2, logger20) {
|
|
1224
1224
|
return core.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(core.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(zod.z.object({
|
|
1225
1225
|
space_key: zod.z.string().describe("The space key (e.g., 'AI', 'BL3', 'FIN')"),
|
|
1226
1226
|
limit: zod.z.number().optional().describe("Maximum number of pages to return (default: 25)")
|
|
1227
1227
|
})).implement(async ({ space_key, limit = 25 }) => {
|
|
1228
|
-
|
|
1228
|
+
logger20.info("get-space-pages called", { space_key, limit });
|
|
1229
1229
|
try {
|
|
1230
1230
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1231
1231
|
const response = await axios16__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content`, {
|
|
@@ -1247,12 +1247,12 @@ function createGetSpacePagesTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1247
1247
|
lastModified: page.version?.when || ""
|
|
1248
1248
|
}));
|
|
1249
1249
|
if (pages.length === 0) {
|
|
1250
|
-
|
|
1250
|
+
logger20.warn("get-space-pages returned NO PAGES - this is a valid outcome, agent should not retry", {
|
|
1251
1251
|
space_key,
|
|
1252
1252
|
limit
|
|
1253
1253
|
});
|
|
1254
1254
|
} else {
|
|
1255
|
-
|
|
1255
|
+
logger20.info("get-space-pages result", {
|
|
1256
1256
|
space_key,
|
|
1257
1257
|
pageCount: pages.length,
|
|
1258
1258
|
titles: pages.map((p) => p.title).slice(0, 3)
|
|
@@ -1266,7 +1266,7 @@ function createGetSpacePagesTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1266
1266
|
pages
|
|
1267
1267
|
});
|
|
1268
1268
|
} catch (error) {
|
|
1269
|
-
|
|
1269
|
+
logger20.error("get-space-pages error", {
|
|
1270
1270
|
space_key,
|
|
1271
1271
|
error: error.response?.data?.message || error.message,
|
|
1272
1272
|
status: error.response?.status
|
|
@@ -1278,14 +1278,14 @@ function createGetSpacePagesTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
}).build();
|
|
1280
1280
|
}
|
|
1281
|
-
function createCreateConfluencePageTool(getAuth, getAuthHeader2,
|
|
1281
|
+
function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger20) {
|
|
1282
1282
|
return core.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(core.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(zod.z.object({
|
|
1283
1283
|
space_key: zod.z.string().describe("The space key where the page will be created (e.g., 'AI', 'BL3')"),
|
|
1284
1284
|
title: zod.z.string().describe("The title of the new page"),
|
|
1285
1285
|
content: zod.z.string().describe("The page content in HTML format (Confluence storage format)"),
|
|
1286
1286
|
parent_page_id: zod.z.string().optional().describe("Optional parent page ID to create this as a child page")
|
|
1287
1287
|
})).implement(async ({ space_key, title, content, parent_page_id }) => {
|
|
1288
|
-
|
|
1288
|
+
logger20.info("create-confluence-page called", { space_key, title, hasParent: !!parent_page_id });
|
|
1289
1289
|
try {
|
|
1290
1290
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1291
1291
|
const pageData = {
|
|
@@ -1312,7 +1312,7 @@ function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1312
1312
|
}
|
|
1313
1313
|
}
|
|
1314
1314
|
);
|
|
1315
|
-
|
|
1315
|
+
logger20.info("create-confluence-page result", {
|
|
1316
1316
|
page_id: response.data.id,
|
|
1317
1317
|
title: response.data.title,
|
|
1318
1318
|
space: space_key
|
|
@@ -1328,7 +1328,7 @@ function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1328
1328
|
}
|
|
1329
1329
|
});
|
|
1330
1330
|
} catch (error) {
|
|
1331
|
-
|
|
1331
|
+
logger20.error("create-confluence-page error", {
|
|
1332
1332
|
space_key,
|
|
1333
1333
|
title,
|
|
1334
1334
|
error: error.response?.data?.message || error.message,
|
|
@@ -1341,13 +1341,13 @@ function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1341
1341
|
}
|
|
1342
1342
|
}).build();
|
|
1343
1343
|
}
|
|
1344
|
-
function createUpdateConfluencePageTool(getAuth, getAuthHeader2,
|
|
1344
|
+
function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger20) {
|
|
1345
1345
|
return core.toolBuilder().name("update-confluence-page").description("Update an existing Confluence page's content. Requires page ID, new title, and new content.").category(core.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(zod.z.object({
|
|
1346
1346
|
page_id: zod.z.string().describe("The ID of the page to update"),
|
|
1347
1347
|
title: zod.z.string().describe("The new title for the page"),
|
|
1348
1348
|
content: zod.z.string().describe("The new content in HTML format (Confluence storage format)")
|
|
1349
1349
|
})).implement(async ({ page_id, title, content }) => {
|
|
1350
|
-
|
|
1350
|
+
logger20.info("update-confluence-page called", { page_id, title });
|
|
1351
1351
|
try {
|
|
1352
1352
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1353
1353
|
const getResponse = await axios16__default.default.get(
|
|
@@ -1380,7 +1380,7 @@ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1380
1380
|
}
|
|
1381
1381
|
}
|
|
1382
1382
|
);
|
|
1383
|
-
|
|
1383
|
+
logger20.info("update-confluence-page result", {
|
|
1384
1384
|
page_id,
|
|
1385
1385
|
title: updateResponse.data.title,
|
|
1386
1386
|
previousVersion: currentVersion,
|
|
@@ -1397,7 +1397,7 @@ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1397
1397
|
}
|
|
1398
1398
|
});
|
|
1399
1399
|
} catch (error) {
|
|
1400
|
-
|
|
1400
|
+
logger20.error("update-confluence-page error", {
|
|
1401
1401
|
page_id,
|
|
1402
1402
|
title,
|
|
1403
1403
|
error: error.response?.data?.message || error.message,
|
|
@@ -1410,12 +1410,12 @@ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1410
1410
|
}
|
|
1411
1411
|
}).build();
|
|
1412
1412
|
}
|
|
1413
|
-
function createArchiveConfluencePageTool(getAuth, getAuthHeader2,
|
|
1413
|
+
function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger20) {
|
|
1414
1414
|
return core.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(core.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(zod.z.object({
|
|
1415
1415
|
page_id: zod.z.string().describe("The ID of the page to archive"),
|
|
1416
1416
|
reason: zod.z.string().optional().describe("Optional reason for archiving (for audit trail)")
|
|
1417
1417
|
})).implement(async ({ page_id, reason }) => {
|
|
1418
|
-
|
|
1418
|
+
logger20.info("archive-confluence-page called", {
|
|
1419
1419
|
page_id,
|
|
1420
1420
|
...reason ? { reason } : {}
|
|
1421
1421
|
});
|
|
@@ -1449,7 +1449,7 @@ function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1449
1449
|
}
|
|
1450
1450
|
}
|
|
1451
1451
|
);
|
|
1452
|
-
|
|
1452
|
+
logger20.info("archive-confluence-page result", {
|
|
1453
1453
|
page_id,
|
|
1454
1454
|
title: pageData.title,
|
|
1455
1455
|
previousVersion: currentVersion,
|
|
@@ -1467,7 +1467,7 @@ function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger22) {
|
|
|
1467
1467
|
}
|
|
1468
1468
|
});
|
|
1469
1469
|
} catch (error) {
|
|
1470
|
-
|
|
1470
|
+
logger20.error("archive-confluence-page error", {
|
|
1471
1471
|
page_id,
|
|
1472
1472
|
error: error.response?.data?.message || error.message,
|
|
1473
1473
|
status: error.response?.status
|
|
@@ -4195,19 +4195,19 @@ var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
|
|
|
4195
4195
|
ConnectionState2["ERROR"] = "error";
|
|
4196
4196
|
return ConnectionState2;
|
|
4197
4197
|
})(ConnectionState || {});
|
|
4198
|
-
function cancelPendingReconnection(timer,
|
|
4198
|
+
function cancelPendingReconnection(timer, logger20, vendor, message) {
|
|
4199
4199
|
if (!timer) {
|
|
4200
4200
|
return null;
|
|
4201
4201
|
}
|
|
4202
|
-
|
|
4202
|
+
logger20.debug(message, { vendor });
|
|
4203
4203
|
clearTimeout(timer);
|
|
4204
4204
|
return null;
|
|
4205
4205
|
}
|
|
4206
|
-
async function waitForInFlightConnection(promise,
|
|
4206
|
+
async function waitForInFlightConnection(promise, logger20, vendor, phase) {
|
|
4207
4207
|
if (!promise) {
|
|
4208
4208
|
return null;
|
|
4209
4209
|
}
|
|
4210
|
-
|
|
4210
|
+
logger20.debug(`Waiting for in-flight connection attempt to complete before ${phase}`, {
|
|
4211
4211
|
vendor
|
|
4212
4212
|
});
|
|
4213
4213
|
try {
|
|
@@ -4224,9 +4224,9 @@ function shutdownClient(vendor, client) {
|
|
|
4224
4224
|
client.close();
|
|
4225
4225
|
}
|
|
4226
4226
|
}
|
|
4227
|
-
function scheduleReconnection(context,
|
|
4227
|
+
function scheduleReconnection(context, logger20) {
|
|
4228
4228
|
if (context.reconnectionConfig.maxAttempts > 0 && context.reconnectionAttempts >= context.reconnectionConfig.maxAttempts) {
|
|
4229
|
-
|
|
4229
|
+
logger20.error("Max reconnection attempts reached", {
|
|
4230
4230
|
vendor: context.vendor,
|
|
4231
4231
|
attempts: context.reconnectionAttempts,
|
|
4232
4232
|
maxAttempts: context.reconnectionConfig.maxAttempts
|
|
@@ -4240,7 +4240,7 @@ function scheduleReconnection(context, logger22) {
|
|
|
4240
4240
|
const nextAttempt = context.reconnectionAttempts + 1;
|
|
4241
4241
|
context.setReconnectionAttempts(nextAttempt);
|
|
4242
4242
|
context.setState("reconnecting" /* RECONNECTING */);
|
|
4243
|
-
|
|
4243
|
+
logger20.info("Scheduling reconnection attempt", {
|
|
4244
4244
|
vendor: context.vendor,
|
|
4245
4245
|
attempt: nextAttempt,
|
|
4246
4246
|
maxAttempts: context.reconnectionConfig.maxAttempts,
|
|
@@ -4254,7 +4254,7 @@ function scheduleReconnection(context, logger22) {
|
|
|
4254
4254
|
const timer = setTimeout(async () => {
|
|
4255
4255
|
context.setReconnectionTimer(null);
|
|
4256
4256
|
try {
|
|
4257
|
-
|
|
4257
|
+
logger20.info("Attempting reconnection", {
|
|
4258
4258
|
vendor: context.vendor,
|
|
4259
4259
|
attempt: nextAttempt
|
|
4260
4260
|
});
|
|
@@ -4264,7 +4264,7 @@ function scheduleReconnection(context, logger22) {
|
|
|
4264
4264
|
context.setConnectPromise(promise);
|
|
4265
4265
|
await promise;
|
|
4266
4266
|
} catch (error) {
|
|
4267
|
-
|
|
4267
|
+
logger20.error("Reconnection attempt failed", {
|
|
4268
4268
|
vendor: context.vendor,
|
|
4269
4269
|
attempt: nextAttempt,
|
|
4270
4270
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -4275,17 +4275,17 @@ function scheduleReconnection(context, logger22) {
|
|
|
4275
4275
|
}
|
|
4276
4276
|
|
|
4277
4277
|
// src/data/relational/connection/connection-cleanup.ts
|
|
4278
|
-
async function cleanupConnectionResources(vendor, client, clearConnection,
|
|
4278
|
+
async function cleanupConnectionResources(vendor, client, clearConnection, logger20) {
|
|
4279
4279
|
if (!client) {
|
|
4280
4280
|
return;
|
|
4281
4281
|
}
|
|
4282
|
-
|
|
4282
|
+
logger20.debug("Cleaning up cancelled connection", {
|
|
4283
4283
|
vendor
|
|
4284
4284
|
});
|
|
4285
4285
|
try {
|
|
4286
4286
|
await shutdownClient(vendor, client);
|
|
4287
4287
|
} catch (error) {
|
|
4288
|
-
|
|
4288
|
+
logger20.debug("Error during cancelled connection cleanup", {
|
|
4289
4289
|
vendor,
|
|
4290
4290
|
error: error instanceof Error ? error.message : String(error)
|
|
4291
4291
|
});
|
|
@@ -4293,10 +4293,10 @@ async function cleanupConnectionResources(vendor, client, clearConnection, logge
|
|
|
4293
4293
|
clearConnection();
|
|
4294
4294
|
}
|
|
4295
4295
|
}
|
|
4296
|
-
async function closeManagedConnection(runtime,
|
|
4296
|
+
async function closeManagedConnection(runtime, logger20) {
|
|
4297
4297
|
const client = runtime.getClient();
|
|
4298
4298
|
if (client) {
|
|
4299
|
-
|
|
4299
|
+
logger20.info("Closing database connection", {
|
|
4300
4300
|
vendor: runtime.vendor,
|
|
4301
4301
|
state: runtime.getState()
|
|
4302
4302
|
});
|
|
@@ -4304,12 +4304,12 @@ async function closeManagedConnection(runtime, logger22) {
|
|
|
4304
4304
|
await shutdownClient(runtime.vendor, client);
|
|
4305
4305
|
runtime.setState("disconnected" /* DISCONNECTED */);
|
|
4306
4306
|
runtime.emitDisconnected();
|
|
4307
|
-
|
|
4307
|
+
logger20.debug("Database connection closed successfully", {
|
|
4308
4308
|
vendor: runtime.vendor,
|
|
4309
4309
|
state: runtime.getState()
|
|
4310
4310
|
});
|
|
4311
4311
|
} catch (error) {
|
|
4312
|
-
|
|
4312
|
+
logger20.error("Error closing database connection", {
|
|
4313
4313
|
vendor: runtime.vendor,
|
|
4314
4314
|
error: error instanceof Error ? error.message : String(error),
|
|
4315
4315
|
state: runtime.getState()
|
|
@@ -4482,11 +4482,11 @@ async function initializeSQLiteConnection(connection) {
|
|
|
4482
4482
|
}
|
|
4483
4483
|
|
|
4484
4484
|
// src/data/relational/connection/connection-initialization.ts
|
|
4485
|
-
async function initializeManagedConnection(runtime,
|
|
4485
|
+
async function initializeManagedConnection(runtime, logger20) {
|
|
4486
4486
|
const startTime = Date.now();
|
|
4487
4487
|
const currentGeneration = runtime.getConnectionGeneration();
|
|
4488
4488
|
if (runtime.getState() === "connected" /* CONNECTED */ && runtime.getClient()) {
|
|
4489
|
-
|
|
4489
|
+
logger20.warn("Re-initializing an already connected manager; emitting disconnected before cleanup", {
|
|
4490
4490
|
vendor: runtime.vendor
|
|
4491
4491
|
});
|
|
4492
4492
|
runtime.setState("disconnected" /* DISCONNECTED */);
|
|
@@ -4498,11 +4498,11 @@ async function initializeManagedConnection(runtime, logger22) {
|
|
|
4498
4498
|
runtime.setClient(null);
|
|
4499
4499
|
runtime.setDb(null);
|
|
4500
4500
|
},
|
|
4501
|
-
|
|
4501
|
+
logger20
|
|
4502
4502
|
);
|
|
4503
4503
|
}
|
|
4504
4504
|
runtime.setState("connecting" /* CONNECTING */);
|
|
4505
|
-
|
|
4505
|
+
logger20.info("Initializing database connection", {
|
|
4506
4506
|
vendor: runtime.vendor,
|
|
4507
4507
|
connectionType: typeof runtime.config.connection,
|
|
4508
4508
|
state: runtime.getState()
|
|
@@ -4512,7 +4512,7 @@ async function initializeManagedConnection(runtime, logger22) {
|
|
|
4512
4512
|
runtime.setClient(initialized.client);
|
|
4513
4513
|
runtime.setDb(initialized.db);
|
|
4514
4514
|
if (currentGeneration !== runtime.getConnectionGeneration()) {
|
|
4515
|
-
|
|
4515
|
+
logger20.debug("Connection cancelled during initialization", {
|
|
4516
4516
|
vendor: runtime.vendor,
|
|
4517
4517
|
currentGeneration,
|
|
4518
4518
|
newGeneration: runtime.getConnectionGeneration()
|
|
@@ -4524,18 +4524,18 @@ async function initializeManagedConnection(runtime, logger22) {
|
|
|
4524
4524
|
runtime.setClient(null);
|
|
4525
4525
|
runtime.setDb(null);
|
|
4526
4526
|
},
|
|
4527
|
-
|
|
4527
|
+
logger20
|
|
4528
4528
|
);
|
|
4529
4529
|
runtime.setState("disconnected" /* DISCONNECTED */);
|
|
4530
4530
|
throw new Error("Connection cancelled during initialization");
|
|
4531
4531
|
}
|
|
4532
|
-
|
|
4532
|
+
logger20.debug("Validating connection health", { vendor: runtime.vendor });
|
|
4533
4533
|
const healthy = await runtime.isHealthy();
|
|
4534
4534
|
if (!healthy) {
|
|
4535
4535
|
throw new Error(`Failed to establish healthy connection to ${runtime.vendor} database`);
|
|
4536
4536
|
}
|
|
4537
4537
|
if (currentGeneration !== runtime.getConnectionGeneration()) {
|
|
4538
|
-
|
|
4538
|
+
logger20.debug("Connection cancelled during health check", {
|
|
4539
4539
|
vendor: runtime.vendor,
|
|
4540
4540
|
currentGeneration,
|
|
4541
4541
|
newGeneration: runtime.getConnectionGeneration()
|
|
@@ -4547,7 +4547,7 @@ async function initializeManagedConnection(runtime, logger22) {
|
|
|
4547
4547
|
runtime.setClient(null);
|
|
4548
4548
|
runtime.setDb(null);
|
|
4549
4549
|
},
|
|
4550
|
-
|
|
4550
|
+
logger20
|
|
4551
4551
|
);
|
|
4552
4552
|
runtime.setState("disconnected" /* DISCONNECTED */);
|
|
4553
4553
|
throw new Error("Connection cancelled during health check");
|
|
@@ -4555,7 +4555,7 @@ async function initializeManagedConnection(runtime, logger22) {
|
|
|
4555
4555
|
runtime.setState("connected" /* CONNECTED */);
|
|
4556
4556
|
runtime.emitConnected();
|
|
4557
4557
|
runtime.resetReconnectionAttempts();
|
|
4558
|
-
|
|
4558
|
+
logger20.info("Database connection initialized successfully", {
|
|
4559
4559
|
vendor: runtime.vendor,
|
|
4560
4560
|
duration: Date.now() - startTime,
|
|
4561
4561
|
state: runtime.getState()
|
|
@@ -4576,7 +4576,7 @@ async function initializeManagedConnection(runtime, logger22) {
|
|
|
4576
4576
|
if (runtime.errorListenerCount() > 0) {
|
|
4577
4577
|
runtime.emitError(normalizedError);
|
|
4578
4578
|
}
|
|
4579
|
-
|
|
4579
|
+
logger20.error(errorMessage, {
|
|
4580
4580
|
vendor: runtime.vendor,
|
|
4581
4581
|
error: normalizedError.message,
|
|
4582
4582
|
duration: Date.now() - startTime,
|
|
@@ -4589,13 +4589,13 @@ async function initializeManagedConnection(runtime, logger22) {
|
|
|
4589
4589
|
runtime.setClient(null);
|
|
4590
4590
|
runtime.setDb(null);
|
|
4591
4591
|
},
|
|
4592
|
-
|
|
4592
|
+
logger20
|
|
4593
4593
|
);
|
|
4594
4594
|
if (runtime.getReconnectionConfig().enabled && currentGeneration === runtime.getConnectionGeneration()) {
|
|
4595
4595
|
runtime.scheduleReconnection();
|
|
4596
4596
|
}
|
|
4597
4597
|
} else {
|
|
4598
|
-
|
|
4598
|
+
logger20.debug("Connection initialization cancelled", {
|
|
4599
4599
|
vendor: runtime.vendor,
|
|
4600
4600
|
duration: Date.now() - startTime,
|
|
4601
4601
|
state: runtime.getState()
|
|
@@ -4613,17 +4613,17 @@ function isSqliteNonQueryError(error) {
|
|
|
4613
4613
|
const hasNonQueryMessage = error.message.includes("does not return data");
|
|
4614
4614
|
return isSqliteOrTypeError && hasNonQueryMessage;
|
|
4615
4615
|
}
|
|
4616
|
-
async function checkConnectionHealth(args,
|
|
4616
|
+
async function checkConnectionHealth(args, logger20) {
|
|
4617
4617
|
if (!args.db || !args.client) {
|
|
4618
|
-
|
|
4618
|
+
logger20.debug("Health check failed: connection not initialized", { vendor: args.vendor });
|
|
4619
4619
|
return false;
|
|
4620
4620
|
}
|
|
4621
4621
|
try {
|
|
4622
4622
|
await args.execute(drizzleOrm.sql`SELECT 1`);
|
|
4623
|
-
|
|
4623
|
+
logger20.debug("Health check passed", { vendor: args.vendor });
|
|
4624
4624
|
return true;
|
|
4625
4625
|
} catch (error) {
|
|
4626
|
-
|
|
4626
|
+
logger20.debug("Health check failed", {
|
|
4627
4627
|
vendor: args.vendor,
|
|
4628
4628
|
error: error instanceof Error ? error.message : String(error)
|
|
4629
4629
|
});
|
|
@@ -4666,8 +4666,8 @@ function getConnectionPoolMetrics(vendor, client) {
|
|
|
4666
4666
|
}
|
|
4667
4667
|
|
|
4668
4668
|
// src/data/relational/connection/query-execution.ts
|
|
4669
|
-
async function executeQuery(context, query,
|
|
4670
|
-
|
|
4669
|
+
async function executeQuery(context, query, logger20) {
|
|
4670
|
+
logger20.debug("Executing SQL query", {
|
|
4671
4671
|
vendor: context.vendor
|
|
4672
4672
|
});
|
|
4673
4673
|
if (context.vendor === "sqlite") {
|
|
@@ -7607,9 +7607,7 @@ function isSafeInsertError(error) {
|
|
|
7607
7607
|
}
|
|
7608
7608
|
return isSafeInsertValidationError(error) || getConstraintViolationMessage(error) !== null;
|
|
7609
7609
|
}
|
|
7610
|
-
|
|
7611
|
-
// src/data/relational/tools/relational-insert/executor.ts
|
|
7612
|
-
var logger17 = core.createLogger("agentforge:tools:data:relational:insert");
|
|
7610
|
+
var insertExecutorLogger = core.createLogger("agentforge:tools:data:relational:insert");
|
|
7613
7611
|
function toNumber(value) {
|
|
7614
7612
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
7615
7613
|
}
|
|
@@ -7685,6 +7683,11 @@ function resolveBatchOptions(batch) {
|
|
|
7685
7683
|
benchmark: batch.benchmark ?? false
|
|
7686
7684
|
};
|
|
7687
7685
|
}
|
|
7686
|
+
function toSingleInsertRows(row) {
|
|
7687
|
+
return [row];
|
|
7688
|
+
}
|
|
7689
|
+
|
|
7690
|
+
// src/data/relational/tools/relational-insert/executor-single.ts
|
|
7688
7691
|
async function executeInsertOnce(manager, input, context) {
|
|
7689
7692
|
const built = buildInsertQuery({
|
|
7690
7693
|
table: input.table,
|
|
@@ -7707,7 +7710,7 @@ async function executeInsertOnce(manager, input, context) {
|
|
|
7707
7710
|
if (built.returningMode === "id") {
|
|
7708
7711
|
const ids = deriveInsertedIds({
|
|
7709
7712
|
idColumn: built.idColumn,
|
|
7710
|
-
inputRows:
|
|
7713
|
+
inputRows: toSingleInsertRows(built.rows[allIds.length]),
|
|
7711
7714
|
returnedRows: normalized2.rows,
|
|
7712
7715
|
rowCount: 1,
|
|
7713
7716
|
insertId: normalized2.insertId,
|
|
@@ -7742,6 +7745,8 @@ async function executeInsertOnce(manager, input, context) {
|
|
|
7742
7745
|
executionTime: 0
|
|
7743
7746
|
};
|
|
7744
7747
|
}
|
|
7748
|
+
|
|
7749
|
+
// src/data/relational/tools/relational-insert/executor-batch.ts
|
|
7745
7750
|
async function executeInsertInBatchMode(manager, input, context, options) {
|
|
7746
7751
|
const batchResult = await executeBatchedTask(
|
|
7747
7752
|
{
|
|
@@ -7758,7 +7763,7 @@ async function executeInsertInBatchMode(manager, input, context, options) {
|
|
|
7758
7763
|
maxRetries: options.maxRetries,
|
|
7759
7764
|
retryDelayMs: options.retryDelayMs,
|
|
7760
7765
|
onProgress: (progress) => {
|
|
7761
|
-
|
|
7766
|
+
insertExecutorLogger.debug("INSERT batch progress", {
|
|
7762
7767
|
vendor: input.vendor,
|
|
7763
7768
|
table: input.table,
|
|
7764
7769
|
...progress
|
|
@@ -7771,7 +7776,7 @@ async function executeInsertInBatchMode(manager, input, context, options) {
|
|
|
7771
7776
|
const insertedIds = batchResult.results.flatMap((result) => result.insertedIds);
|
|
7772
7777
|
let benchmark;
|
|
7773
7778
|
if (options.benchmark) {
|
|
7774
|
-
|
|
7779
|
+
insertExecutorLogger.warn("INSERT batch benchmark enabled. Synthetic benchmark callbacks are side-effect free and do not execute SQL.", {
|
|
7775
7780
|
vendor: input.vendor,
|
|
7776
7781
|
table: input.table,
|
|
7777
7782
|
totalRows: input.data.length,
|
|
@@ -7806,9 +7811,11 @@ async function executeInsertInBatchMode(manager, input, context, options) {
|
|
|
7806
7811
|
}
|
|
7807
7812
|
};
|
|
7808
7813
|
}
|
|
7814
|
+
|
|
7815
|
+
// src/data/relational/tools/relational-insert/executor.ts
|
|
7809
7816
|
async function executeInsert(manager, input, context) {
|
|
7810
7817
|
const startTime = Date.now();
|
|
7811
|
-
|
|
7818
|
+
insertExecutorLogger.debug("Building INSERT query", {
|
|
7812
7819
|
vendor: input.vendor,
|
|
7813
7820
|
table: input.table,
|
|
7814
7821
|
isBatch: Array.isArray(input.data),
|
|
@@ -7824,7 +7831,7 @@ async function executeInsert(manager, input, context) {
|
|
|
7824
7831
|
batchOptions
|
|
7825
7832
|
) : await executeInsertOnce(manager, input, context);
|
|
7826
7833
|
const executionTime = Date.now() - startTime;
|
|
7827
|
-
|
|
7834
|
+
insertExecutorLogger.debug("INSERT query executed successfully", {
|
|
7828
7835
|
vendor: input.vendor,
|
|
7829
7836
|
table: input.table,
|
|
7830
7837
|
rowCount: result.rowCount,
|
|
@@ -7840,7 +7847,7 @@ async function executeInsert(manager, input, context) {
|
|
|
7840
7847
|
};
|
|
7841
7848
|
} catch (error) {
|
|
7842
7849
|
const executionTime = Date.now() - startTime;
|
|
7843
|
-
|
|
7850
|
+
insertExecutorLogger.error("INSERT query execution failed", {
|
|
7844
7851
|
vendor: input.vendor,
|
|
7845
7852
|
table: input.table,
|
|
7846
7853
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -8168,9 +8175,7 @@ function isSafeUpdateError(error) {
|
|
|
8168
8175
|
}
|
|
8169
8176
|
return isSafeUpdateValidationError(error) || getUpdateConstraintViolationMessage(error) !== null;
|
|
8170
8177
|
}
|
|
8171
|
-
|
|
8172
|
-
// src/data/relational/tools/relational-update/executor.ts
|
|
8173
|
-
var logger18 = core.createLogger("agentforge:tools:data:relational:update");
|
|
8178
|
+
var updateExecutorLogger = core.createLogger("agentforge:tools:data:relational:update");
|
|
8174
8179
|
function toNumber2(value) {
|
|
8175
8180
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
8176
8181
|
}
|
|
@@ -8218,6 +8223,8 @@ function toSingleUpdateOperation(input) {
|
|
|
8218
8223
|
optimisticLock: input.optimisticLock
|
|
8219
8224
|
};
|
|
8220
8225
|
}
|
|
8226
|
+
|
|
8227
|
+
// src/data/relational/tools/relational-update/executor-single.ts
|
|
8221
8228
|
async function executeSingleUpdate(manager, input, operation, context) {
|
|
8222
8229
|
const built = buildUpdateQuery({
|
|
8223
8230
|
table: input.table,
|
|
@@ -8238,6 +8245,8 @@ async function executeSingleUpdate(manager, input, operation, context) {
|
|
|
8238
8245
|
executionTime: 0
|
|
8239
8246
|
};
|
|
8240
8247
|
}
|
|
8248
|
+
|
|
8249
|
+
// src/data/relational/tools/relational-update/executor-batch.ts
|
|
8241
8250
|
async function executeUpdateInBatchMode(manager, input, context, options) {
|
|
8242
8251
|
const batchResult = await executeBatchedTask(
|
|
8243
8252
|
{
|
|
@@ -8292,7 +8301,7 @@ async function executeUpdateInBatchMode(manager, input, context, options) {
|
|
|
8292
8301
|
maxRetries: options.maxRetries,
|
|
8293
8302
|
retryDelayMs: options.retryDelayMs,
|
|
8294
8303
|
onProgress: (progress) => {
|
|
8295
|
-
|
|
8304
|
+
updateExecutorLogger.debug("UPDATE batch progress", {
|
|
8296
8305
|
vendor: input.vendor,
|
|
8297
8306
|
table: input.table,
|
|
8298
8307
|
...progress
|
|
@@ -8304,7 +8313,7 @@ async function executeUpdateInBatchMode(manager, input, context, options) {
|
|
|
8304
8313
|
const operationFailures = batchResult.results.flatMap((result) => result.failures);
|
|
8305
8314
|
let benchmark;
|
|
8306
8315
|
if (options.benchmark) {
|
|
8307
|
-
|
|
8316
|
+
updateExecutorLogger.warn("UPDATE batch benchmark enabled. Synthetic benchmark callbacks are side-effect free and do not execute SQL.", {
|
|
8308
8317
|
vendor: input.vendor,
|
|
8309
8318
|
table: input.table,
|
|
8310
8319
|
operationCount: input.operations.length,
|
|
@@ -8337,9 +8346,11 @@ async function executeUpdateInBatchMode(manager, input, context, options) {
|
|
|
8337
8346
|
}
|
|
8338
8347
|
};
|
|
8339
8348
|
}
|
|
8349
|
+
|
|
8350
|
+
// src/data/relational/tools/relational-update/executor.ts
|
|
8340
8351
|
async function executeUpdate(manager, input, context) {
|
|
8341
8352
|
const startTime = Date.now();
|
|
8342
|
-
|
|
8353
|
+
updateExecutorLogger.debug("Building UPDATE query", {
|
|
8343
8354
|
vendor: input.vendor,
|
|
8344
8355
|
table: input.table,
|
|
8345
8356
|
hasWhere: !!input.where?.length,
|
|
@@ -8357,7 +8368,7 @@ async function executeUpdate(manager, input, context) {
|
|
|
8357
8368
|
batchOptions
|
|
8358
8369
|
) : await executeSingleUpdate(manager, input, toSingleUpdateOperation(input), context);
|
|
8359
8370
|
const executionTime = Date.now() - startTime;
|
|
8360
|
-
|
|
8371
|
+
updateExecutorLogger.debug("UPDATE query executed successfully", {
|
|
8361
8372
|
vendor: input.vendor,
|
|
8362
8373
|
table: input.table,
|
|
8363
8374
|
rowCount: result.rowCount,
|
|
@@ -8371,7 +8382,7 @@ async function executeUpdate(manager, input, context) {
|
|
|
8371
8382
|
};
|
|
8372
8383
|
} catch (error) {
|
|
8373
8384
|
const executionTime = Date.now() - startTime;
|
|
8374
|
-
|
|
8385
|
+
updateExecutorLogger.error("UPDATE query execution failed", {
|
|
8375
8386
|
vendor: input.vendor,
|
|
8376
8387
|
table: input.table,
|
|
8377
8388
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -8675,7 +8686,7 @@ function isSafeDeleteError(error) {
|
|
|
8675
8686
|
}
|
|
8676
8687
|
|
|
8677
8688
|
// src/data/relational/tools/relational-delete/executor.ts
|
|
8678
|
-
var
|
|
8689
|
+
var logger17 = core.createLogger("agentforge:tools:data:relational:delete");
|
|
8679
8690
|
function toNumber3(value) {
|
|
8680
8691
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
8681
8692
|
}
|
|
@@ -8796,7 +8807,7 @@ async function executeDeleteInBatchMode(manager, input, context, options) {
|
|
|
8796
8807
|
maxRetries: options.maxRetries,
|
|
8797
8808
|
retryDelayMs: options.retryDelayMs,
|
|
8798
8809
|
onProgress: (progress) => {
|
|
8799
|
-
|
|
8810
|
+
logger17.debug("DELETE batch progress", {
|
|
8800
8811
|
vendor: input.vendor,
|
|
8801
8812
|
table: input.table,
|
|
8802
8813
|
...progress
|
|
@@ -8809,7 +8820,7 @@ async function executeDeleteInBatchMode(manager, input, context, options) {
|
|
|
8809
8820
|
const operationFailures = batchResult.results.flatMap((result) => result.failures);
|
|
8810
8821
|
let benchmark;
|
|
8811
8822
|
if (options.benchmark) {
|
|
8812
|
-
|
|
8823
|
+
logger17.warn("DELETE batch benchmark enabled. Synthetic benchmark callbacks are side-effect free and do not execute SQL.", {
|
|
8813
8824
|
vendor: input.vendor,
|
|
8814
8825
|
table: input.table,
|
|
8815
8826
|
operationCount: input.operations.length,
|
|
@@ -8845,7 +8856,7 @@ async function executeDeleteInBatchMode(manager, input, context, options) {
|
|
|
8845
8856
|
}
|
|
8846
8857
|
async function executeDelete(manager, input, context) {
|
|
8847
8858
|
const startTime = Date.now();
|
|
8848
|
-
|
|
8859
|
+
logger17.debug("Building DELETE query", {
|
|
8849
8860
|
vendor: input.vendor,
|
|
8850
8861
|
table: input.table,
|
|
8851
8862
|
hasWhere: !!input.where?.length,
|
|
@@ -8864,7 +8875,7 @@ async function executeDelete(manager, input, context) {
|
|
|
8864
8875
|
batchOptions
|
|
8865
8876
|
) : await executeSingleDelete(manager, input, toSingleDeleteOperation(input), context);
|
|
8866
8877
|
const executionTime = Date.now() - startTime;
|
|
8867
|
-
|
|
8878
|
+
logger17.debug("DELETE query executed successfully", {
|
|
8868
8879
|
vendor: input.vendor,
|
|
8869
8880
|
table: input.table,
|
|
8870
8881
|
rowCount: result.rowCount,
|
|
@@ -8880,7 +8891,7 @@ async function executeDelete(manager, input, context) {
|
|
|
8880
8891
|
};
|
|
8881
8892
|
} catch (error) {
|
|
8882
8893
|
const executionTime = Date.now() - startTime;
|
|
8883
|
-
|
|
8894
|
+
logger17.error("DELETE query execution failed", {
|
|
8884
8895
|
vendor: input.vendor,
|
|
8885
8896
|
table: input.table,
|
|
8886
8897
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -8985,7 +8996,7 @@ function isSafeGetSchemaValidationError(error) {
|
|
|
8985
8996
|
}
|
|
8986
8997
|
|
|
8987
8998
|
// src/data/relational/tools/relational-get-schema.ts
|
|
8988
|
-
var
|
|
8999
|
+
var logger18 = core.createLogger("agentforge:tools:data:relational:get-schema");
|
|
8989
9000
|
function buildSchemaCacheKey(vendor, connectionString, database) {
|
|
8990
9001
|
const databaseScope = database ?? "default";
|
|
8991
9002
|
const connectionHash = crypto.createHash("sha256").update(connectionString).digest("hex");
|
|
@@ -9057,7 +9068,7 @@ var relationalGetSchema = core.toolBuilder().name("relational-get-schema").displ
|
|
|
9057
9068
|
summary
|
|
9058
9069
|
};
|
|
9059
9070
|
} catch (error) {
|
|
9060
|
-
|
|
9071
|
+
logger18.error("Schema introspection failed", {
|
|
9061
9072
|
vendor: input.vendor,
|
|
9062
9073
|
hasTablesFilter: Array.isArray(input.tables),
|
|
9063
9074
|
tablesFilterCount: input.tables?.length ?? 0,
|
|
@@ -10223,7 +10234,7 @@ var AskHumanInputSchema = zod.z.object({
|
|
|
10223
10234
|
suggestions: zod.z.array(zod.z.string()).optional().describe("Suggested responses for the human")
|
|
10224
10235
|
});
|
|
10225
10236
|
var logLevel3 = process.env.LOG_LEVEL?.toLowerCase() || core.LogLevel.INFO;
|
|
10226
|
-
var
|
|
10237
|
+
var logger19 = core.createLogger("agentforge:tools:agent:ask-human", { level: logLevel3 });
|
|
10227
10238
|
function isRecord2(value) {
|
|
10228
10239
|
return typeof value === "object" && value !== null;
|
|
10229
10240
|
}
|
|
@@ -10288,7 +10299,7 @@ function createAskHumanTool() {
|
|
|
10288
10299
|
suggestions: validatedInput.suggestions,
|
|
10289
10300
|
status: "pending"
|
|
10290
10301
|
};
|
|
10291
|
-
|
|
10302
|
+
logger19.debug("About to call interrupt()", {
|
|
10292
10303
|
humanRequest: {
|
|
10293
10304
|
id: humanRequest.id,
|
|
10294
10305
|
question: humanRequest.question,
|
|
@@ -10304,13 +10315,13 @@ function createAskHumanTool() {
|
|
|
10304
10315
|
let response;
|
|
10305
10316
|
try {
|
|
10306
10317
|
response = interrupt(humanRequest);
|
|
10307
|
-
|
|
10318
|
+
logger19.debug("interrupt() returned successfully", {
|
|
10308
10319
|
responseType: typeof response,
|
|
10309
10320
|
hasResponse: response != null,
|
|
10310
10321
|
...typeof response === "string" ? { responseLength: response.length } : {}
|
|
10311
10322
|
});
|
|
10312
10323
|
} catch (error) {
|
|
10313
|
-
|
|
10324
|
+
logger19.debug("interrupt() threw error (expected for GraphInterrupt)", {
|
|
10314
10325
|
...error && typeof error === "object" && "constructor" in error ? { errorType: error.constructor?.name } : {},
|
|
10315
10326
|
error: error instanceof Error ? error.message : String(error)
|
|
10316
10327
|
});
|