@agentforge/tools 0.16.85 → 0.16.86
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 +117 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -48
- package/dist/index.d.ts +53 -48
- package/dist/index.js +116 -113
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var core = require('@agentforge/core');
|
|
4
4
|
var promises = require('dns/promises');
|
|
5
5
|
var net = require('net');
|
|
6
|
-
var
|
|
6
|
+
var axios11 = require('axios');
|
|
7
7
|
var zod = require('zod');
|
|
8
8
|
var cheerio = require('cheerio');
|
|
9
9
|
var webApi = require('@slack/web-api');
|
|
@@ -40,7 +40,7 @@ function _interopNamespace(e) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
var net__default = /*#__PURE__*/_interopDefault(net);
|
|
43
|
-
var
|
|
43
|
+
var axios11__default = /*#__PURE__*/_interopDefault(axios11);
|
|
44
44
|
var cheerio__namespace = /*#__PURE__*/_interopNamespace(cheerio);
|
|
45
45
|
var neo4j__default = /*#__PURE__*/_interopDefault(neo4j);
|
|
46
46
|
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
@@ -230,7 +230,7 @@ async function requestWithDestinationPolicy(config, policy = {}) {
|
|
|
230
230
|
for (let redirectCount = 0; ; redirectCount += 1) {
|
|
231
231
|
const validatedAddresses = await validateDestinationAllowed(currentUrl, effectivePolicy);
|
|
232
232
|
currentConfig.lookup = createPinnedLookup(validatedAddresses);
|
|
233
|
-
const response = await
|
|
233
|
+
const response = await axios11__default.default(currentConfig);
|
|
234
234
|
if (!isRedirectStatus(response.status)) return response;
|
|
235
235
|
if (effectivePolicy.allowRedirects === false) blockDestination(currentUrl, "redirect");
|
|
236
236
|
if (redirectCount >= maxRedirects) throw new DestinationPolicyError(currentUrl, "redirect", `Maximum redirect count (${maxRedirects}) exceeded for ${currentUrl}`);
|
|
@@ -741,7 +741,7 @@ var DuckDuckGoProvider = class {
|
|
|
741
741
|
async search(query, maxResults, timeout = DEFAULT_TIMEOUT) {
|
|
742
742
|
return retryWithBackoff(async () => {
|
|
743
743
|
try {
|
|
744
|
-
const response = await
|
|
744
|
+
const response = await axios11__default.default.get(
|
|
745
745
|
"https://api.duckduckgo.com/",
|
|
746
746
|
{
|
|
747
747
|
params: {
|
|
@@ -845,7 +845,7 @@ var SerperProvider = class {
|
|
|
845
845
|
}
|
|
846
846
|
return retryWithBackoff(async () => {
|
|
847
847
|
try {
|
|
848
|
-
const response = await
|
|
848
|
+
const response = await axios11__default.default.post(
|
|
849
849
|
"https://google.serper.dev/search",
|
|
850
850
|
{
|
|
851
851
|
q: query,
|
|
@@ -1279,7 +1279,7 @@ function createSearchConfluenceTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1279
1279
|
logger19.info("search-confluence called", { query, limit });
|
|
1280
1280
|
try {
|
|
1281
1281
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1282
|
-
const response = await
|
|
1282
|
+
const response = await axios11__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/search`, {
|
|
1283
1283
|
headers: {
|
|
1284
1284
|
Authorization: getAuthHeader2(),
|
|
1285
1285
|
Accept: "application/json"
|
|
@@ -1341,7 +1341,7 @@ function createGetConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1341
1341
|
logger19.info("get-confluence-page called", { page_id });
|
|
1342
1342
|
try {
|
|
1343
1343
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1344
|
-
const response = await
|
|
1344
|
+
const response = await axios11__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`, {
|
|
1345
1345
|
headers: {
|
|
1346
1346
|
Authorization: getAuthHeader2(),
|
|
1347
1347
|
Accept: "application/json"
|
|
@@ -1392,7 +1392,7 @@ function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1392
1392
|
logger19.info("list-confluence-spaces called", { limit });
|
|
1393
1393
|
try {
|
|
1394
1394
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1395
|
-
const response = await
|
|
1395
|
+
const response = await axios11__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/space`, {
|
|
1396
1396
|
headers: {
|
|
1397
1397
|
Authorization: getAuthHeader2(),
|
|
1398
1398
|
Accept: "application/json"
|
|
@@ -1438,7 +1438,7 @@ function createGetSpacePagesTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1438
1438
|
logger19.info("get-space-pages called", { space_key, limit });
|
|
1439
1439
|
try {
|
|
1440
1440
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1441
|
-
const response = await
|
|
1441
|
+
const response = await axios11__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content`, {
|
|
1442
1442
|
headers: {
|
|
1443
1443
|
Authorization: getAuthHeader2(),
|
|
1444
1444
|
Accept: "application/json"
|
|
@@ -1512,7 +1512,7 @@ function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1512
1512
|
if (parent_page_id) {
|
|
1513
1513
|
pageData.ancestors = [{ id: parent_page_id }];
|
|
1514
1514
|
}
|
|
1515
|
-
const response = await
|
|
1515
|
+
const response = await axios11__default.default.post(
|
|
1516
1516
|
`${ATLASSIAN_SITE_URL}/wiki/rest/api/content`,
|
|
1517
1517
|
pageData,
|
|
1518
1518
|
{
|
|
@@ -1560,7 +1560,7 @@ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1560
1560
|
logger19.info("update-confluence-page called", { page_id, title });
|
|
1561
1561
|
try {
|
|
1562
1562
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1563
|
-
const getResponse = await
|
|
1563
|
+
const getResponse = await axios11__default.default.get(
|
|
1564
1564
|
`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`,
|
|
1565
1565
|
{
|
|
1566
1566
|
headers: {
|
|
@@ -1570,7 +1570,7 @@ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1570
1570
|
}
|
|
1571
1571
|
);
|
|
1572
1572
|
const currentVersion = getResponse.data.version.number;
|
|
1573
|
-
const updateResponse = await
|
|
1573
|
+
const updateResponse = await axios11__default.default.put(
|
|
1574
1574
|
`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`,
|
|
1575
1575
|
{
|
|
1576
1576
|
type: "page",
|
|
@@ -1631,7 +1631,7 @@ function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1631
1631
|
});
|
|
1632
1632
|
try {
|
|
1633
1633
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1634
|
-
const getResponse = await
|
|
1634
|
+
const getResponse = await axios11__default.default.get(
|
|
1635
1635
|
`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`,
|
|
1636
1636
|
{
|
|
1637
1637
|
headers: {
|
|
@@ -1642,7 +1642,7 @@ function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1642
1642
|
);
|
|
1643
1643
|
const currentVersion = getResponse.data.version.number;
|
|
1644
1644
|
const pageData = getResponse.data;
|
|
1645
|
-
await
|
|
1645
|
+
await axios11__default.default.put(
|
|
1646
1646
|
`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`,
|
|
1647
1647
|
{
|
|
1648
1648
|
version: { number: currentVersion + 1 },
|
|
@@ -2368,9 +2368,21 @@ function createTransformerTools(config = {}) {
|
|
|
2368
2368
|
createObjectOmitTool()
|
|
2369
2369
|
];
|
|
2370
2370
|
}
|
|
2371
|
+
var neo4jJsonValueSchema = zod.z.lazy(() => zod.z.union([
|
|
2372
|
+
zod.z.string(),
|
|
2373
|
+
zod.z.number().finite(),
|
|
2374
|
+
zod.z.boolean(),
|
|
2375
|
+
zod.z.null(),
|
|
2376
|
+
zod.z.array(neo4jJsonValueSchema),
|
|
2377
|
+
zod.z.record(zod.z.string(), neo4jJsonValueSchema)
|
|
2378
|
+
])).describe("JSON-safe Neo4j property value");
|
|
2379
|
+
var neo4jPropertiesSchema = zod.z.record(
|
|
2380
|
+
zod.z.string(),
|
|
2381
|
+
neo4jJsonValueSchema
|
|
2382
|
+
);
|
|
2371
2383
|
var neo4jQuerySchema = zod.z.object({
|
|
2372
2384
|
cypher: zod.z.string().describe("Cypher query to execute"),
|
|
2373
|
-
parameters:
|
|
2385
|
+
parameters: neo4jPropertiesSchema.optional().describe("Query parameters for parameterized queries"),
|
|
2374
2386
|
database: zod.z.string().optional().describe("Database name (defaults to configured database)")
|
|
2375
2387
|
});
|
|
2376
2388
|
var neo4jGetSchemaSchema = zod.z.object({
|
|
@@ -2378,7 +2390,7 @@ var neo4jGetSchemaSchema = zod.z.object({
|
|
|
2378
2390
|
});
|
|
2379
2391
|
var neo4jFindNodesSchema = zod.z.object({
|
|
2380
2392
|
label: zod.z.string().describe("Node label to search for"),
|
|
2381
|
-
properties:
|
|
2393
|
+
properties: neo4jPropertiesSchema.optional().describe("Properties to match (key-value pairs)"),
|
|
2382
2394
|
limit: zod.z.number().default(100).describe("Maximum number of nodes to return"),
|
|
2383
2395
|
database: zod.z.string().optional().describe("Database name (defaults to configured database)")
|
|
2384
2396
|
});
|
|
@@ -2408,7 +2420,7 @@ var neo4jVectorSearchWithEmbeddingSchema = zod.z.object({
|
|
|
2408
2420
|
});
|
|
2409
2421
|
var neo4jCreateNodeWithEmbeddingSchema = zod.z.object({
|
|
2410
2422
|
label: zod.z.string().describe("Node label"),
|
|
2411
|
-
properties:
|
|
2423
|
+
properties: neo4jPropertiesSchema.describe("Node properties (key-value pairs)"),
|
|
2412
2424
|
textProperty: zod.z.string().describe("Name of the property containing text to embed"),
|
|
2413
2425
|
embeddingProperty: zod.z.string().default("embedding").describe("Name of the property to store the embedding vector"),
|
|
2414
2426
|
model: zod.z.string().optional().describe("Embedding model to use (defaults to configured model)"),
|
|
@@ -2576,6 +2588,13 @@ async function initializeFromEnv() {
|
|
|
2576
2588
|
}
|
|
2577
2589
|
|
|
2578
2590
|
// src/data/neo4j/embeddings/utils.ts
|
|
2591
|
+
function withProviderErrorMetadata(error, message) {
|
|
2592
|
+
const wrappedError = new Error(message);
|
|
2593
|
+
if (!isRecord2(error)) return wrappedError;
|
|
2594
|
+
if (typeof error.code === "string") wrappedError.code = error.code;
|
|
2595
|
+
if (error.response !== void 0) wrappedError.response = error.response;
|
|
2596
|
+
return wrappedError;
|
|
2597
|
+
}
|
|
2579
2598
|
var DEFAULT_RETRY_CONFIG2 = {
|
|
2580
2599
|
maxRetries: 3,
|
|
2581
2600
|
initialDelay: 1e3,
|
|
@@ -2584,17 +2603,25 @@ var DEFAULT_RETRY_CONFIG2 = {
|
|
|
2584
2603
|
// 10 seconds
|
|
2585
2604
|
backoffMultiplier: 2
|
|
2586
2605
|
};
|
|
2606
|
+
function isRecord2(value) {
|
|
2607
|
+
return typeof value === "object" && value !== null;
|
|
2608
|
+
}
|
|
2587
2609
|
function isRetryableError2(error) {
|
|
2588
|
-
if (error
|
|
2610
|
+
if (!isRecord2(error)) return false;
|
|
2611
|
+
const response = isRecord2(error.response) ? error.response : void 0;
|
|
2612
|
+
const status = typeof response?.status === "number" ? response.status : void 0;
|
|
2613
|
+
const code = typeof error.code === "string" ? error.code : void 0;
|
|
2614
|
+
const message = typeof error.message === "string" ? error.message : void 0;
|
|
2615
|
+
if (code === "ECONNRESET" || code === "ETIMEDOUT" || code === "ENOTFOUND") {
|
|
2589
2616
|
return true;
|
|
2590
2617
|
}
|
|
2591
|
-
if (
|
|
2618
|
+
if (code === "ECONNABORTED" || message?.includes("timeout")) {
|
|
2592
2619
|
return true;
|
|
2593
2620
|
}
|
|
2594
|
-
if (
|
|
2621
|
+
if (status !== void 0 && status >= 500 && status < 600) {
|
|
2595
2622
|
return true;
|
|
2596
2623
|
}
|
|
2597
|
-
if (
|
|
2624
|
+
if (status === 429) {
|
|
2598
2625
|
return true;
|
|
2599
2626
|
}
|
|
2600
2627
|
return false;
|
|
@@ -2707,7 +2734,7 @@ var OpenAIEmbeddingProvider = class {
|
|
|
2707
2734
|
const modelToUse = model || this.defaultModel;
|
|
2708
2735
|
return retryWithBackoff2(async () => {
|
|
2709
2736
|
try {
|
|
2710
|
-
const response = await
|
|
2737
|
+
const response = await axios11__default.default.post(
|
|
2711
2738
|
`${this.baseURL}/embeddings`,
|
|
2712
2739
|
{
|
|
2713
2740
|
input: text,
|
|
@@ -2736,25 +2763,18 @@ var OpenAIEmbeddingProvider = class {
|
|
|
2736
2763
|
}
|
|
2737
2764
|
};
|
|
2738
2765
|
} catch (error) {
|
|
2739
|
-
let
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
);
|
|
2748
|
-
} else if (error.response?.status === 400) {
|
|
2749
|
-
wrappedError = new Error(
|
|
2750
|
-
`OpenAI API error: ${error.response.data?.error?.message || "Bad request"}`
|
|
2751
|
-
);
|
|
2766
|
+
let message;
|
|
2767
|
+
const response = axios11__default.default.isAxiosError(error) ? error.response : void 0;
|
|
2768
|
+
if (response?.status === 401) {
|
|
2769
|
+
message = "Invalid OpenAI API key. Get your key at https://platform.openai.com/api-keys";
|
|
2770
|
+
} else if (response?.status === 429) {
|
|
2771
|
+
message = "OpenAI API rate limit exceeded. Please try again later or upgrade your plan.";
|
|
2772
|
+
} else if (response?.status === 400) {
|
|
2773
|
+
message = `OpenAI API error: ${response.data?.error?.message || "Bad request"}`;
|
|
2752
2774
|
} else {
|
|
2753
|
-
|
|
2775
|
+
message = `OpenAI embedding generation failed: ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
2754
2776
|
}
|
|
2755
|
-
|
|
2756
|
-
if (error.response) wrappedError.response = error.response;
|
|
2757
|
-
throw wrappedError;
|
|
2777
|
+
throw withProviderErrorMetadata(error, message);
|
|
2758
2778
|
}
|
|
2759
2779
|
});
|
|
2760
2780
|
}
|
|
@@ -2771,7 +2791,7 @@ var OpenAIEmbeddingProvider = class {
|
|
|
2771
2791
|
const modelToUse = model || this.defaultModel;
|
|
2772
2792
|
return retryWithBackoff2(async () => {
|
|
2773
2793
|
try {
|
|
2774
|
-
const response = await
|
|
2794
|
+
const response = await axios11__default.default.post(
|
|
2775
2795
|
`${this.baseURL}/embeddings`,
|
|
2776
2796
|
{
|
|
2777
2797
|
input: texts,
|
|
@@ -2801,25 +2821,18 @@ var OpenAIEmbeddingProvider = class {
|
|
|
2801
2821
|
}
|
|
2802
2822
|
};
|
|
2803
2823
|
} catch (error) {
|
|
2804
|
-
let
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
);
|
|
2813
|
-
} else if (error.response?.status === 400) {
|
|
2814
|
-
wrappedError = new Error(
|
|
2815
|
-
`OpenAI API error: ${error.response.data?.error?.message || "Bad request"}`
|
|
2816
|
-
);
|
|
2824
|
+
let message;
|
|
2825
|
+
const response = axios11__default.default.isAxiosError(error) ? error.response : void 0;
|
|
2826
|
+
if (response?.status === 401) {
|
|
2827
|
+
message = "Invalid OpenAI API key. Get your key at https://platform.openai.com/api-keys";
|
|
2828
|
+
} else if (response?.status === 429) {
|
|
2829
|
+
message = "OpenAI API rate limit exceeded. Please try again later or upgrade your plan.";
|
|
2830
|
+
} else if (response?.status === 400) {
|
|
2831
|
+
message = `OpenAI API error: ${response.data?.error?.message || "Bad request"}`;
|
|
2817
2832
|
} else {
|
|
2818
|
-
|
|
2833
|
+
message = `OpenAI batch embedding generation failed: ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
2819
2834
|
}
|
|
2820
|
-
|
|
2821
|
-
if (error.response) wrappedError.response = error.response;
|
|
2822
|
-
throw wrappedError;
|
|
2835
|
+
throw withProviderErrorMetadata(error, message);
|
|
2823
2836
|
}
|
|
2824
2837
|
});
|
|
2825
2838
|
}
|
|
@@ -2851,7 +2864,7 @@ var CohereEmbeddingProvider = class {
|
|
|
2851
2864
|
const modelToUse = model || this.defaultModel;
|
|
2852
2865
|
return retryWithBackoff2(async () => {
|
|
2853
2866
|
try {
|
|
2854
|
-
const response = await
|
|
2867
|
+
const response = await axios11__default.default.post(
|
|
2855
2868
|
`${this.baseUrl}/embed`,
|
|
2856
2869
|
{
|
|
2857
2870
|
texts,
|
|
@@ -2879,22 +2892,20 @@ var CohereEmbeddingProvider = class {
|
|
|
2879
2892
|
} : void 0
|
|
2880
2893
|
};
|
|
2881
2894
|
} catch (error) {
|
|
2882
|
-
if (
|
|
2895
|
+
if (axios11__default.default.isAxiosError(error)) {
|
|
2883
2896
|
const status = error.response?.status;
|
|
2884
|
-
const
|
|
2885
|
-
let
|
|
2897
|
+
const providerMessage = error.response?.data?.message || error.message;
|
|
2898
|
+
let message;
|
|
2886
2899
|
if (status === 401) {
|
|
2887
|
-
|
|
2900
|
+
message = `Cohere API authentication failed. Please check your COHERE_API_KEY. ${providerMessage}`;
|
|
2888
2901
|
} else if (status === 429) {
|
|
2889
|
-
|
|
2902
|
+
message = `Cohere API rate limit exceeded. ${providerMessage}`;
|
|
2890
2903
|
} else if (status === 400) {
|
|
2891
|
-
|
|
2904
|
+
message = `Cohere API request invalid: ${providerMessage}`;
|
|
2892
2905
|
} else {
|
|
2893
|
-
|
|
2906
|
+
message = `Cohere API error (${status}): ${providerMessage}`;
|
|
2894
2907
|
}
|
|
2895
|
-
|
|
2896
|
-
if (error.response) wrappedError.response = error.response;
|
|
2897
|
-
throw wrappedError;
|
|
2908
|
+
throw withProviderErrorMetadata(error, message);
|
|
2898
2909
|
}
|
|
2899
2910
|
throw error;
|
|
2900
2911
|
}
|
|
@@ -2919,7 +2930,7 @@ var HuggingFaceEmbeddingProvider = class {
|
|
|
2919
2930
|
const modelToUse = model || this.defaultModel;
|
|
2920
2931
|
return retryWithBackoff2(async () => {
|
|
2921
2932
|
try {
|
|
2922
|
-
const response = await
|
|
2933
|
+
const response = await axios11__default.default.post(
|
|
2923
2934
|
`${this.baseUrl}/${modelToUse}`,
|
|
2924
2935
|
{
|
|
2925
2936
|
inputs: text,
|
|
@@ -2941,24 +2952,22 @@ var HuggingFaceEmbeddingProvider = class {
|
|
|
2941
2952
|
dimensions: embedding.length
|
|
2942
2953
|
};
|
|
2943
2954
|
} catch (error) {
|
|
2944
|
-
if (
|
|
2955
|
+
if (axios11__default.default.isAxiosError(error)) {
|
|
2945
2956
|
const status = error.response?.status;
|
|
2946
2957
|
const message = error.response?.data?.error || error.message;
|
|
2947
|
-
let
|
|
2958
|
+
let messageText;
|
|
2948
2959
|
if (status === 401) {
|
|
2949
|
-
|
|
2960
|
+
messageText = `HuggingFace API authentication failed. Please check your HUGGINGFACE_API_KEY. ${message}`;
|
|
2950
2961
|
} else if (status === 429) {
|
|
2951
|
-
|
|
2962
|
+
messageText = `HuggingFace API rate limit exceeded. ${message}`;
|
|
2952
2963
|
} else if (status === 400) {
|
|
2953
|
-
|
|
2964
|
+
messageText = `HuggingFace API request invalid: ${message}`;
|
|
2954
2965
|
} else if (status === 503) {
|
|
2955
|
-
|
|
2966
|
+
messageText = `HuggingFace model is loading. Please retry in a moment. ${message}`;
|
|
2956
2967
|
} else {
|
|
2957
|
-
|
|
2968
|
+
messageText = `HuggingFace API error (${status}): ${message}`;
|
|
2958
2969
|
}
|
|
2959
|
-
|
|
2960
|
-
if (error.response) wrappedError.response = error.response;
|
|
2961
|
-
throw wrappedError;
|
|
2970
|
+
throw withProviderErrorMetadata(error, messageText);
|
|
2962
2971
|
}
|
|
2963
2972
|
throw error;
|
|
2964
2973
|
}
|
|
@@ -2968,7 +2977,7 @@ var HuggingFaceEmbeddingProvider = class {
|
|
|
2968
2977
|
const modelToUse = model || this.defaultModel;
|
|
2969
2978
|
return retryWithBackoff2(async () => {
|
|
2970
2979
|
try {
|
|
2971
|
-
const response = await
|
|
2980
|
+
const response = await axios11__default.default.post(
|
|
2972
2981
|
`${this.baseUrl}/${modelToUse}`,
|
|
2973
2982
|
{
|
|
2974
2983
|
inputs: texts,
|
|
@@ -2991,24 +3000,22 @@ var HuggingFaceEmbeddingProvider = class {
|
|
|
2991
3000
|
dimensions
|
|
2992
3001
|
};
|
|
2993
3002
|
} catch (error) {
|
|
2994
|
-
if (
|
|
3003
|
+
if (axios11__default.default.isAxiosError(error)) {
|
|
2995
3004
|
const status = error.response?.status;
|
|
2996
3005
|
const message = error.response?.data?.error || error.message;
|
|
2997
|
-
let
|
|
3006
|
+
let messageText;
|
|
2998
3007
|
if (status === 401) {
|
|
2999
|
-
|
|
3008
|
+
messageText = `HuggingFace API authentication failed. Please check your HUGGINGFACE_API_KEY. ${message}`;
|
|
3000
3009
|
} else if (status === 429) {
|
|
3001
|
-
|
|
3010
|
+
messageText = `HuggingFace API rate limit exceeded. ${message}`;
|
|
3002
3011
|
} else if (status === 400) {
|
|
3003
|
-
|
|
3012
|
+
messageText = `HuggingFace API request invalid: ${message}`;
|
|
3004
3013
|
} else if (status === 503) {
|
|
3005
|
-
|
|
3014
|
+
messageText = `HuggingFace model is loading. Please retry in a moment. ${message}`;
|
|
3006
3015
|
} else {
|
|
3007
|
-
|
|
3016
|
+
messageText = `HuggingFace API error (${status}): ${message}`;
|
|
3008
3017
|
}
|
|
3009
|
-
|
|
3010
|
-
if (error.response) wrappedError.response = error.response;
|
|
3011
|
-
throw wrappedError;
|
|
3018
|
+
throw withProviderErrorMetadata(error, messageText);
|
|
3012
3019
|
}
|
|
3013
3020
|
throw error;
|
|
3014
3021
|
}
|
|
@@ -3042,7 +3049,7 @@ var VoyageEmbeddingProvider = class {
|
|
|
3042
3049
|
const modelToUse = model || this.defaultModel;
|
|
3043
3050
|
return retryWithBackoff2(async () => {
|
|
3044
3051
|
try {
|
|
3045
|
-
const response = await
|
|
3052
|
+
const response = await axios11__default.default.post(
|
|
3046
3053
|
`${this.baseUrl}/embeddings`,
|
|
3047
3054
|
{
|
|
3048
3055
|
input: texts,
|
|
@@ -3069,22 +3076,20 @@ var VoyageEmbeddingProvider = class {
|
|
|
3069
3076
|
} : void 0
|
|
3070
3077
|
};
|
|
3071
3078
|
} catch (error) {
|
|
3072
|
-
if (
|
|
3079
|
+
if (axios11__default.default.isAxiosError(error)) {
|
|
3073
3080
|
const status = error.response?.status;
|
|
3074
3081
|
const message = error.response?.data?.message || error.message;
|
|
3075
|
-
let
|
|
3082
|
+
let messageText;
|
|
3076
3083
|
if (status === 401) {
|
|
3077
|
-
|
|
3084
|
+
messageText = `Voyage AI API authentication failed. Please check your VOYAGE_API_KEY. ${message}`;
|
|
3078
3085
|
} else if (status === 429) {
|
|
3079
|
-
|
|
3086
|
+
messageText = `Voyage AI API rate limit exceeded. ${message}`;
|
|
3080
3087
|
} else if (status === 400) {
|
|
3081
|
-
|
|
3088
|
+
messageText = `Voyage AI API request invalid: ${message}`;
|
|
3082
3089
|
} else {
|
|
3083
|
-
|
|
3090
|
+
messageText = `Voyage AI API error (${status}): ${message}`;
|
|
3084
3091
|
}
|
|
3085
|
-
|
|
3086
|
-
if (error.response) wrappedError.response = error.response;
|
|
3087
|
-
throw wrappedError;
|
|
3092
|
+
throw withProviderErrorMetadata(error, messageText);
|
|
3088
3093
|
}
|
|
3089
3094
|
throw error;
|
|
3090
3095
|
}
|
|
@@ -3108,7 +3113,7 @@ var OllamaEmbeddingProvider = class {
|
|
|
3108
3113
|
const modelToUse = model || this.defaultModel;
|
|
3109
3114
|
return retryWithBackoff2(async () => {
|
|
3110
3115
|
try {
|
|
3111
|
-
const response = await
|
|
3116
|
+
const response = await axios11__default.default.post(
|
|
3112
3117
|
`${this.baseUrl}/api/embeddings`,
|
|
3113
3118
|
{
|
|
3114
3119
|
model: modelToUse,
|
|
@@ -3127,22 +3132,20 @@ var OllamaEmbeddingProvider = class {
|
|
|
3127
3132
|
dimensions: embedding.length
|
|
3128
3133
|
};
|
|
3129
3134
|
} catch (error) {
|
|
3130
|
-
if (
|
|
3135
|
+
if (axios11__default.default.isAxiosError(error)) {
|
|
3131
3136
|
const status = error.response?.status;
|
|
3132
3137
|
const message = error.response?.data?.error || error.message;
|
|
3133
|
-
let
|
|
3138
|
+
let messageText;
|
|
3134
3139
|
if (error.code === "ECONNREFUSED") {
|
|
3135
|
-
|
|
3140
|
+
messageText = `Cannot connect to Ollama at ${this.baseUrl}. Make sure Ollama is running locally.`;
|
|
3136
3141
|
} else if (status === 404) {
|
|
3137
|
-
|
|
3142
|
+
messageText = "Ollama model not found. Pull it with: ollama pull <model-name>";
|
|
3138
3143
|
} else if (status === 400) {
|
|
3139
|
-
|
|
3144
|
+
messageText = `Ollama API request invalid: ${message}`;
|
|
3140
3145
|
} else {
|
|
3141
|
-
|
|
3146
|
+
messageText = `Ollama API error (${status}): ${message}`;
|
|
3142
3147
|
}
|
|
3143
|
-
|
|
3144
|
-
if (error.response) wrappedError.response = error.response;
|
|
3145
|
-
throw wrappedError;
|
|
3148
|
+
throw withProviderErrorMetadata(error, messageText);
|
|
3146
3149
|
}
|
|
3147
3150
|
throw error;
|
|
3148
3151
|
}
|
|
@@ -3734,7 +3737,7 @@ function createNeo4jFindNodesTool() {
|
|
|
3734
3737
|
parameters = { ...parameters, ...filterParams };
|
|
3735
3738
|
}
|
|
3736
3739
|
cypher += ` RETURN n LIMIT $limit`;
|
|
3737
|
-
parameters.limit = input.limit;
|
|
3740
|
+
parameters.limit = input.limit ?? 100;
|
|
3738
3741
|
const result = await session.run(cypher, parameters);
|
|
3739
3742
|
const formattedResults = formatResults(result.records);
|
|
3740
3743
|
return {
|
|
@@ -10674,11 +10677,11 @@ var AskHumanInputSchema = zod.z.object({
|
|
|
10674
10677
|
});
|
|
10675
10678
|
var logLevel3 = process.env.LOG_LEVEL?.toLowerCase() || core.LogLevel.INFO;
|
|
10676
10679
|
var logger18 = core.createLogger("agentforge:tools:agent:ask-human", { level: logLevel3 });
|
|
10677
|
-
function
|
|
10680
|
+
function isRecord3(value) {
|
|
10678
10681
|
return typeof value === "object" && value !== null;
|
|
10679
10682
|
}
|
|
10680
10683
|
function resolveInterrupt(module) {
|
|
10681
|
-
if (!
|
|
10684
|
+
if (!isRecord3(module)) {
|
|
10682
10685
|
return void 0;
|
|
10683
10686
|
}
|
|
10684
10687
|
const candidate = module.interrupt;
|
|
@@ -11131,6 +11134,7 @@ exports.webScraperSchema = webScraperSchema;
|
|
|
11131
11134
|
exports.webSearch = webSearch;
|
|
11132
11135
|
exports.webSearchOutputSchema = webSearchOutputSchema;
|
|
11133
11136
|
exports.webSearchSchema = webSearchSchema;
|
|
11137
|
+
exports.withProviderErrorMetadata = withProviderErrorMetadata;
|
|
11134
11138
|
exports.withTransaction = withTransaction;
|
|
11135
11139
|
exports.xmlGenerator = xmlGenerator;
|
|
11136
11140
|
exports.xmlGeneratorSchema = xmlGeneratorSchema;
|