@agentforge/tools 0.16.85 → 0.16.87
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 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -93
- package/dist/index.d.ts +98 -93
- package/dist/index.js +116 -121
- 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);
|
|
@@ -70,8 +70,6 @@ var DestinationPolicyError = class extends Error {
|
|
|
70
70
|
this.reason = reason;
|
|
71
71
|
this.name = "DestinationPolicyError";
|
|
72
72
|
}
|
|
73
|
-
url;
|
|
74
|
-
reason;
|
|
75
73
|
code = "WEB_DESTINATION_BLOCKED";
|
|
76
74
|
};
|
|
77
75
|
function ipv4ToNumber(address) {
|
|
@@ -230,7 +228,7 @@ async function requestWithDestinationPolicy(config, policy = {}) {
|
|
|
230
228
|
for (let redirectCount = 0; ; redirectCount += 1) {
|
|
231
229
|
const validatedAddresses = await validateDestinationAllowed(currentUrl, effectivePolicy);
|
|
232
230
|
currentConfig.lookup = createPinnedLookup(validatedAddresses);
|
|
233
|
-
const response = await
|
|
231
|
+
const response = await axios11__default.default(currentConfig);
|
|
234
232
|
if (!isRedirectStatus(response.status)) return response;
|
|
235
233
|
if (effectivePolicy.allowRedirects === false) blockDestination(currentUrl, "redirect");
|
|
236
234
|
if (redirectCount >= maxRedirects) throw new DestinationPolicyError(currentUrl, "redirect", `Maximum redirect count (${maxRedirects}) exceeded for ${currentUrl}`);
|
|
@@ -741,7 +739,7 @@ var DuckDuckGoProvider = class {
|
|
|
741
739
|
async search(query, maxResults, timeout = DEFAULT_TIMEOUT) {
|
|
742
740
|
return retryWithBackoff(async () => {
|
|
743
741
|
try {
|
|
744
|
-
const response = await
|
|
742
|
+
const response = await axios11__default.default.get(
|
|
745
743
|
"https://api.duckduckgo.com/",
|
|
746
744
|
{
|
|
747
745
|
params: {
|
|
@@ -845,7 +843,7 @@ var SerperProvider = class {
|
|
|
845
843
|
}
|
|
846
844
|
return retryWithBackoff(async () => {
|
|
847
845
|
try {
|
|
848
|
-
const response = await
|
|
846
|
+
const response = await axios11__default.default.post(
|
|
849
847
|
"https://google.serper.dev/search",
|
|
850
848
|
{
|
|
851
849
|
q: query,
|
|
@@ -1279,7 +1277,7 @@ function createSearchConfluenceTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1279
1277
|
logger19.info("search-confluence called", { query, limit });
|
|
1280
1278
|
try {
|
|
1281
1279
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1282
|
-
const response = await
|
|
1280
|
+
const response = await axios11__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/search`, {
|
|
1283
1281
|
headers: {
|
|
1284
1282
|
Authorization: getAuthHeader2(),
|
|
1285
1283
|
Accept: "application/json"
|
|
@@ -1341,7 +1339,7 @@ function createGetConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1341
1339
|
logger19.info("get-confluence-page called", { page_id });
|
|
1342
1340
|
try {
|
|
1343
1341
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1344
|
-
const response = await
|
|
1342
|
+
const response = await axios11__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`, {
|
|
1345
1343
|
headers: {
|
|
1346
1344
|
Authorization: getAuthHeader2(),
|
|
1347
1345
|
Accept: "application/json"
|
|
@@ -1392,7 +1390,7 @@ function createListConfluenceSpacesTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1392
1390
|
logger19.info("list-confluence-spaces called", { limit });
|
|
1393
1391
|
try {
|
|
1394
1392
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1395
|
-
const response = await
|
|
1393
|
+
const response = await axios11__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/space`, {
|
|
1396
1394
|
headers: {
|
|
1397
1395
|
Authorization: getAuthHeader2(),
|
|
1398
1396
|
Accept: "application/json"
|
|
@@ -1438,7 +1436,7 @@ function createGetSpacePagesTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1438
1436
|
logger19.info("get-space-pages called", { space_key, limit });
|
|
1439
1437
|
try {
|
|
1440
1438
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1441
|
-
const response = await
|
|
1439
|
+
const response = await axios11__default.default.get(`${ATLASSIAN_SITE_URL}/wiki/rest/api/content`, {
|
|
1442
1440
|
headers: {
|
|
1443
1441
|
Authorization: getAuthHeader2(),
|
|
1444
1442
|
Accept: "application/json"
|
|
@@ -1512,7 +1510,7 @@ function createCreateConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1512
1510
|
if (parent_page_id) {
|
|
1513
1511
|
pageData.ancestors = [{ id: parent_page_id }];
|
|
1514
1512
|
}
|
|
1515
|
-
const response = await
|
|
1513
|
+
const response = await axios11__default.default.post(
|
|
1516
1514
|
`${ATLASSIAN_SITE_URL}/wiki/rest/api/content`,
|
|
1517
1515
|
pageData,
|
|
1518
1516
|
{
|
|
@@ -1560,7 +1558,7 @@ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1560
1558
|
logger19.info("update-confluence-page called", { page_id, title });
|
|
1561
1559
|
try {
|
|
1562
1560
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1563
|
-
const getResponse = await
|
|
1561
|
+
const getResponse = await axios11__default.default.get(
|
|
1564
1562
|
`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`,
|
|
1565
1563
|
{
|
|
1566
1564
|
headers: {
|
|
@@ -1570,7 +1568,7 @@ function createUpdateConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1570
1568
|
}
|
|
1571
1569
|
);
|
|
1572
1570
|
const currentVersion = getResponse.data.version.number;
|
|
1573
|
-
const updateResponse = await
|
|
1571
|
+
const updateResponse = await axios11__default.default.put(
|
|
1574
1572
|
`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`,
|
|
1575
1573
|
{
|
|
1576
1574
|
type: "page",
|
|
@@ -1631,7 +1629,7 @@ function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1631
1629
|
});
|
|
1632
1630
|
try {
|
|
1633
1631
|
const { ATLASSIAN_SITE_URL } = getAuth();
|
|
1634
|
-
const getResponse = await
|
|
1632
|
+
const getResponse = await axios11__default.default.get(
|
|
1635
1633
|
`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`,
|
|
1636
1634
|
{
|
|
1637
1635
|
headers: {
|
|
@@ -1642,7 +1640,7 @@ function createArchiveConfluencePageTool(getAuth, getAuthHeader2, logger19) {
|
|
|
1642
1640
|
);
|
|
1643
1641
|
const currentVersion = getResponse.data.version.number;
|
|
1644
1642
|
const pageData = getResponse.data;
|
|
1645
|
-
await
|
|
1643
|
+
await axios11__default.default.put(
|
|
1646
1644
|
`${ATLASSIAN_SITE_URL}/wiki/rest/api/content/${page_id}`,
|
|
1647
1645
|
{
|
|
1648
1646
|
version: { number: currentVersion + 1 },
|
|
@@ -2368,9 +2366,21 @@ function createTransformerTools(config = {}) {
|
|
|
2368
2366
|
createObjectOmitTool()
|
|
2369
2367
|
];
|
|
2370
2368
|
}
|
|
2369
|
+
var neo4jJsonValueSchema = zod.z.lazy(() => zod.z.union([
|
|
2370
|
+
zod.z.string(),
|
|
2371
|
+
zod.z.number().finite(),
|
|
2372
|
+
zod.z.boolean(),
|
|
2373
|
+
zod.z.null(),
|
|
2374
|
+
zod.z.array(neo4jJsonValueSchema),
|
|
2375
|
+
zod.z.record(zod.z.string(), neo4jJsonValueSchema)
|
|
2376
|
+
])).describe("JSON-safe Neo4j property value");
|
|
2377
|
+
var neo4jPropertiesSchema = zod.z.record(
|
|
2378
|
+
zod.z.string(),
|
|
2379
|
+
neo4jJsonValueSchema
|
|
2380
|
+
);
|
|
2371
2381
|
var neo4jQuerySchema = zod.z.object({
|
|
2372
2382
|
cypher: zod.z.string().describe("Cypher query to execute"),
|
|
2373
|
-
parameters:
|
|
2383
|
+
parameters: neo4jPropertiesSchema.optional().describe("Query parameters for parameterized queries"),
|
|
2374
2384
|
database: zod.z.string().optional().describe("Database name (defaults to configured database)")
|
|
2375
2385
|
});
|
|
2376
2386
|
var neo4jGetSchemaSchema = zod.z.object({
|
|
@@ -2378,7 +2388,7 @@ var neo4jGetSchemaSchema = zod.z.object({
|
|
|
2378
2388
|
});
|
|
2379
2389
|
var neo4jFindNodesSchema = zod.z.object({
|
|
2380
2390
|
label: zod.z.string().describe("Node label to search for"),
|
|
2381
|
-
properties:
|
|
2391
|
+
properties: neo4jPropertiesSchema.optional().describe("Properties to match (key-value pairs)"),
|
|
2382
2392
|
limit: zod.z.number().default(100).describe("Maximum number of nodes to return"),
|
|
2383
2393
|
database: zod.z.string().optional().describe("Database name (defaults to configured database)")
|
|
2384
2394
|
});
|
|
@@ -2408,7 +2418,7 @@ var neo4jVectorSearchWithEmbeddingSchema = zod.z.object({
|
|
|
2408
2418
|
});
|
|
2409
2419
|
var neo4jCreateNodeWithEmbeddingSchema = zod.z.object({
|
|
2410
2420
|
label: zod.z.string().describe("Node label"),
|
|
2411
|
-
properties:
|
|
2421
|
+
properties: neo4jPropertiesSchema.describe("Node properties (key-value pairs)"),
|
|
2412
2422
|
textProperty: zod.z.string().describe("Name of the property containing text to embed"),
|
|
2413
2423
|
embeddingProperty: zod.z.string().default("embedding").describe("Name of the property to store the embedding vector"),
|
|
2414
2424
|
model: zod.z.string().optional().describe("Embedding model to use (defaults to configured model)"),
|
|
@@ -2576,6 +2586,13 @@ async function initializeFromEnv() {
|
|
|
2576
2586
|
}
|
|
2577
2587
|
|
|
2578
2588
|
// src/data/neo4j/embeddings/utils.ts
|
|
2589
|
+
function withProviderErrorMetadata(error, message) {
|
|
2590
|
+
const wrappedError = new Error(message);
|
|
2591
|
+
if (!isRecord2(error)) return wrappedError;
|
|
2592
|
+
if (typeof error.code === "string") wrappedError.code = error.code;
|
|
2593
|
+
if (error.response !== void 0) wrappedError.response = error.response;
|
|
2594
|
+
return wrappedError;
|
|
2595
|
+
}
|
|
2579
2596
|
var DEFAULT_RETRY_CONFIG2 = {
|
|
2580
2597
|
maxRetries: 3,
|
|
2581
2598
|
initialDelay: 1e3,
|
|
@@ -2584,17 +2601,25 @@ var DEFAULT_RETRY_CONFIG2 = {
|
|
|
2584
2601
|
// 10 seconds
|
|
2585
2602
|
backoffMultiplier: 2
|
|
2586
2603
|
};
|
|
2604
|
+
function isRecord2(value) {
|
|
2605
|
+
return typeof value === "object" && value !== null;
|
|
2606
|
+
}
|
|
2587
2607
|
function isRetryableError2(error) {
|
|
2588
|
-
if (error
|
|
2608
|
+
if (!isRecord2(error)) return false;
|
|
2609
|
+
const response = isRecord2(error.response) ? error.response : void 0;
|
|
2610
|
+
const status = typeof response?.status === "number" ? response.status : void 0;
|
|
2611
|
+
const code = typeof error.code === "string" ? error.code : void 0;
|
|
2612
|
+
const message = typeof error.message === "string" ? error.message : void 0;
|
|
2613
|
+
if (code === "ECONNRESET" || code === "ETIMEDOUT" || code === "ENOTFOUND") {
|
|
2589
2614
|
return true;
|
|
2590
2615
|
}
|
|
2591
|
-
if (
|
|
2616
|
+
if (code === "ECONNABORTED" || message?.includes("timeout")) {
|
|
2592
2617
|
return true;
|
|
2593
2618
|
}
|
|
2594
|
-
if (
|
|
2619
|
+
if (status !== void 0 && status >= 500 && status < 600) {
|
|
2595
2620
|
return true;
|
|
2596
2621
|
}
|
|
2597
|
-
if (
|
|
2622
|
+
if (status === 429) {
|
|
2598
2623
|
return true;
|
|
2599
2624
|
}
|
|
2600
2625
|
return false;
|
|
@@ -2707,7 +2732,7 @@ var OpenAIEmbeddingProvider = class {
|
|
|
2707
2732
|
const modelToUse = model || this.defaultModel;
|
|
2708
2733
|
return retryWithBackoff2(async () => {
|
|
2709
2734
|
try {
|
|
2710
|
-
const response = await
|
|
2735
|
+
const response = await axios11__default.default.post(
|
|
2711
2736
|
`${this.baseURL}/embeddings`,
|
|
2712
2737
|
{
|
|
2713
2738
|
input: text,
|
|
@@ -2736,25 +2761,18 @@ var OpenAIEmbeddingProvider = class {
|
|
|
2736
2761
|
}
|
|
2737
2762
|
};
|
|
2738
2763
|
} 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
|
-
);
|
|
2764
|
+
let message;
|
|
2765
|
+
const response = axios11__default.default.isAxiosError(error) ? error.response : void 0;
|
|
2766
|
+
if (response?.status === 401) {
|
|
2767
|
+
message = "Invalid OpenAI API key. Get your key at https://platform.openai.com/api-keys";
|
|
2768
|
+
} else if (response?.status === 429) {
|
|
2769
|
+
message = "OpenAI API rate limit exceeded. Please try again later or upgrade your plan.";
|
|
2770
|
+
} else if (response?.status === 400) {
|
|
2771
|
+
message = `OpenAI API error: ${response.data?.error?.message || "Bad request"}`;
|
|
2752
2772
|
} else {
|
|
2753
|
-
|
|
2773
|
+
message = `OpenAI embedding generation failed: ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
2754
2774
|
}
|
|
2755
|
-
|
|
2756
|
-
if (error.response) wrappedError.response = error.response;
|
|
2757
|
-
throw wrappedError;
|
|
2775
|
+
throw withProviderErrorMetadata(error, message);
|
|
2758
2776
|
}
|
|
2759
2777
|
});
|
|
2760
2778
|
}
|
|
@@ -2771,7 +2789,7 @@ var OpenAIEmbeddingProvider = class {
|
|
|
2771
2789
|
const modelToUse = model || this.defaultModel;
|
|
2772
2790
|
return retryWithBackoff2(async () => {
|
|
2773
2791
|
try {
|
|
2774
|
-
const response = await
|
|
2792
|
+
const response = await axios11__default.default.post(
|
|
2775
2793
|
`${this.baseURL}/embeddings`,
|
|
2776
2794
|
{
|
|
2777
2795
|
input: texts,
|
|
@@ -2801,25 +2819,18 @@ var OpenAIEmbeddingProvider = class {
|
|
|
2801
2819
|
}
|
|
2802
2820
|
};
|
|
2803
2821
|
} 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
|
-
);
|
|
2822
|
+
let message;
|
|
2823
|
+
const response = axios11__default.default.isAxiosError(error) ? error.response : void 0;
|
|
2824
|
+
if (response?.status === 401) {
|
|
2825
|
+
message = "Invalid OpenAI API key. Get your key at https://platform.openai.com/api-keys";
|
|
2826
|
+
} else if (response?.status === 429) {
|
|
2827
|
+
message = "OpenAI API rate limit exceeded. Please try again later or upgrade your plan.";
|
|
2828
|
+
} else if (response?.status === 400) {
|
|
2829
|
+
message = `OpenAI API error: ${response.data?.error?.message || "Bad request"}`;
|
|
2817
2830
|
} else {
|
|
2818
|
-
|
|
2831
|
+
message = `OpenAI batch embedding generation failed: ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
2819
2832
|
}
|
|
2820
|
-
|
|
2821
|
-
if (error.response) wrappedError.response = error.response;
|
|
2822
|
-
throw wrappedError;
|
|
2833
|
+
throw withProviderErrorMetadata(error, message);
|
|
2823
2834
|
}
|
|
2824
2835
|
});
|
|
2825
2836
|
}
|
|
@@ -2851,7 +2862,7 @@ var CohereEmbeddingProvider = class {
|
|
|
2851
2862
|
const modelToUse = model || this.defaultModel;
|
|
2852
2863
|
return retryWithBackoff2(async () => {
|
|
2853
2864
|
try {
|
|
2854
|
-
const response = await
|
|
2865
|
+
const response = await axios11__default.default.post(
|
|
2855
2866
|
`${this.baseUrl}/embed`,
|
|
2856
2867
|
{
|
|
2857
2868
|
texts,
|
|
@@ -2879,22 +2890,20 @@ var CohereEmbeddingProvider = class {
|
|
|
2879
2890
|
} : void 0
|
|
2880
2891
|
};
|
|
2881
2892
|
} catch (error) {
|
|
2882
|
-
if (
|
|
2893
|
+
if (axios11__default.default.isAxiosError(error)) {
|
|
2883
2894
|
const status = error.response?.status;
|
|
2884
|
-
const
|
|
2885
|
-
let
|
|
2895
|
+
const providerMessage = error.response?.data?.message || error.message;
|
|
2896
|
+
let message;
|
|
2886
2897
|
if (status === 401) {
|
|
2887
|
-
|
|
2898
|
+
message = `Cohere API authentication failed. Please check your COHERE_API_KEY. ${providerMessage}`;
|
|
2888
2899
|
} else if (status === 429) {
|
|
2889
|
-
|
|
2900
|
+
message = `Cohere API rate limit exceeded. ${providerMessage}`;
|
|
2890
2901
|
} else if (status === 400) {
|
|
2891
|
-
|
|
2902
|
+
message = `Cohere API request invalid: ${providerMessage}`;
|
|
2892
2903
|
} else {
|
|
2893
|
-
|
|
2904
|
+
message = `Cohere API error (${status}): ${providerMessage}`;
|
|
2894
2905
|
}
|
|
2895
|
-
|
|
2896
|
-
if (error.response) wrappedError.response = error.response;
|
|
2897
|
-
throw wrappedError;
|
|
2906
|
+
throw withProviderErrorMetadata(error, message);
|
|
2898
2907
|
}
|
|
2899
2908
|
throw error;
|
|
2900
2909
|
}
|
|
@@ -2919,7 +2928,7 @@ var HuggingFaceEmbeddingProvider = class {
|
|
|
2919
2928
|
const modelToUse = model || this.defaultModel;
|
|
2920
2929
|
return retryWithBackoff2(async () => {
|
|
2921
2930
|
try {
|
|
2922
|
-
const response = await
|
|
2931
|
+
const response = await axios11__default.default.post(
|
|
2923
2932
|
`${this.baseUrl}/${modelToUse}`,
|
|
2924
2933
|
{
|
|
2925
2934
|
inputs: text,
|
|
@@ -2941,24 +2950,22 @@ var HuggingFaceEmbeddingProvider = class {
|
|
|
2941
2950
|
dimensions: embedding.length
|
|
2942
2951
|
};
|
|
2943
2952
|
} catch (error) {
|
|
2944
|
-
if (
|
|
2953
|
+
if (axios11__default.default.isAxiosError(error)) {
|
|
2945
2954
|
const status = error.response?.status;
|
|
2946
2955
|
const message = error.response?.data?.error || error.message;
|
|
2947
|
-
let
|
|
2956
|
+
let messageText;
|
|
2948
2957
|
if (status === 401) {
|
|
2949
|
-
|
|
2958
|
+
messageText = `HuggingFace API authentication failed. Please check your HUGGINGFACE_API_KEY. ${message}`;
|
|
2950
2959
|
} else if (status === 429) {
|
|
2951
|
-
|
|
2960
|
+
messageText = `HuggingFace API rate limit exceeded. ${message}`;
|
|
2952
2961
|
} else if (status === 400) {
|
|
2953
|
-
|
|
2962
|
+
messageText = `HuggingFace API request invalid: ${message}`;
|
|
2954
2963
|
} else if (status === 503) {
|
|
2955
|
-
|
|
2964
|
+
messageText = `HuggingFace model is loading. Please retry in a moment. ${message}`;
|
|
2956
2965
|
} else {
|
|
2957
|
-
|
|
2966
|
+
messageText = `HuggingFace API error (${status}): ${message}`;
|
|
2958
2967
|
}
|
|
2959
|
-
|
|
2960
|
-
if (error.response) wrappedError.response = error.response;
|
|
2961
|
-
throw wrappedError;
|
|
2968
|
+
throw withProviderErrorMetadata(error, messageText);
|
|
2962
2969
|
}
|
|
2963
2970
|
throw error;
|
|
2964
2971
|
}
|
|
@@ -2968,7 +2975,7 @@ var HuggingFaceEmbeddingProvider = class {
|
|
|
2968
2975
|
const modelToUse = model || this.defaultModel;
|
|
2969
2976
|
return retryWithBackoff2(async () => {
|
|
2970
2977
|
try {
|
|
2971
|
-
const response = await
|
|
2978
|
+
const response = await axios11__default.default.post(
|
|
2972
2979
|
`${this.baseUrl}/${modelToUse}`,
|
|
2973
2980
|
{
|
|
2974
2981
|
inputs: texts,
|
|
@@ -2991,24 +2998,22 @@ var HuggingFaceEmbeddingProvider = class {
|
|
|
2991
2998
|
dimensions
|
|
2992
2999
|
};
|
|
2993
3000
|
} catch (error) {
|
|
2994
|
-
if (
|
|
3001
|
+
if (axios11__default.default.isAxiosError(error)) {
|
|
2995
3002
|
const status = error.response?.status;
|
|
2996
3003
|
const message = error.response?.data?.error || error.message;
|
|
2997
|
-
let
|
|
3004
|
+
let messageText;
|
|
2998
3005
|
if (status === 401) {
|
|
2999
|
-
|
|
3006
|
+
messageText = `HuggingFace API authentication failed. Please check your HUGGINGFACE_API_KEY. ${message}`;
|
|
3000
3007
|
} else if (status === 429) {
|
|
3001
|
-
|
|
3008
|
+
messageText = `HuggingFace API rate limit exceeded. ${message}`;
|
|
3002
3009
|
} else if (status === 400) {
|
|
3003
|
-
|
|
3010
|
+
messageText = `HuggingFace API request invalid: ${message}`;
|
|
3004
3011
|
} else if (status === 503) {
|
|
3005
|
-
|
|
3012
|
+
messageText = `HuggingFace model is loading. Please retry in a moment. ${message}`;
|
|
3006
3013
|
} else {
|
|
3007
|
-
|
|
3014
|
+
messageText = `HuggingFace API error (${status}): ${message}`;
|
|
3008
3015
|
}
|
|
3009
|
-
|
|
3010
|
-
if (error.response) wrappedError.response = error.response;
|
|
3011
|
-
throw wrappedError;
|
|
3016
|
+
throw withProviderErrorMetadata(error, messageText);
|
|
3012
3017
|
}
|
|
3013
3018
|
throw error;
|
|
3014
3019
|
}
|
|
@@ -3042,7 +3047,7 @@ var VoyageEmbeddingProvider = class {
|
|
|
3042
3047
|
const modelToUse = model || this.defaultModel;
|
|
3043
3048
|
return retryWithBackoff2(async () => {
|
|
3044
3049
|
try {
|
|
3045
|
-
const response = await
|
|
3050
|
+
const response = await axios11__default.default.post(
|
|
3046
3051
|
`${this.baseUrl}/embeddings`,
|
|
3047
3052
|
{
|
|
3048
3053
|
input: texts,
|
|
@@ -3069,22 +3074,20 @@ var VoyageEmbeddingProvider = class {
|
|
|
3069
3074
|
} : void 0
|
|
3070
3075
|
};
|
|
3071
3076
|
} catch (error) {
|
|
3072
|
-
if (
|
|
3077
|
+
if (axios11__default.default.isAxiosError(error)) {
|
|
3073
3078
|
const status = error.response?.status;
|
|
3074
3079
|
const message = error.response?.data?.message || error.message;
|
|
3075
|
-
let
|
|
3080
|
+
let messageText;
|
|
3076
3081
|
if (status === 401) {
|
|
3077
|
-
|
|
3082
|
+
messageText = `Voyage AI API authentication failed. Please check your VOYAGE_API_KEY. ${message}`;
|
|
3078
3083
|
} else if (status === 429) {
|
|
3079
|
-
|
|
3084
|
+
messageText = `Voyage AI API rate limit exceeded. ${message}`;
|
|
3080
3085
|
} else if (status === 400) {
|
|
3081
|
-
|
|
3086
|
+
messageText = `Voyage AI API request invalid: ${message}`;
|
|
3082
3087
|
} else {
|
|
3083
|
-
|
|
3088
|
+
messageText = `Voyage AI API error (${status}): ${message}`;
|
|
3084
3089
|
}
|
|
3085
|
-
|
|
3086
|
-
if (error.response) wrappedError.response = error.response;
|
|
3087
|
-
throw wrappedError;
|
|
3090
|
+
throw withProviderErrorMetadata(error, messageText);
|
|
3088
3091
|
}
|
|
3089
3092
|
throw error;
|
|
3090
3093
|
}
|
|
@@ -3108,7 +3111,7 @@ var OllamaEmbeddingProvider = class {
|
|
|
3108
3111
|
const modelToUse = model || this.defaultModel;
|
|
3109
3112
|
return retryWithBackoff2(async () => {
|
|
3110
3113
|
try {
|
|
3111
|
-
const response = await
|
|
3114
|
+
const response = await axios11__default.default.post(
|
|
3112
3115
|
`${this.baseUrl}/api/embeddings`,
|
|
3113
3116
|
{
|
|
3114
3117
|
model: modelToUse,
|
|
@@ -3127,22 +3130,20 @@ var OllamaEmbeddingProvider = class {
|
|
|
3127
3130
|
dimensions: embedding.length
|
|
3128
3131
|
};
|
|
3129
3132
|
} catch (error) {
|
|
3130
|
-
if (
|
|
3133
|
+
if (axios11__default.default.isAxiosError(error)) {
|
|
3131
3134
|
const status = error.response?.status;
|
|
3132
3135
|
const message = error.response?.data?.error || error.message;
|
|
3133
|
-
let
|
|
3136
|
+
let messageText;
|
|
3134
3137
|
if (error.code === "ECONNREFUSED") {
|
|
3135
|
-
|
|
3138
|
+
messageText = `Cannot connect to Ollama at ${this.baseUrl}. Make sure Ollama is running locally.`;
|
|
3136
3139
|
} else if (status === 404) {
|
|
3137
|
-
|
|
3140
|
+
messageText = "Ollama model not found. Pull it with: ollama pull <model-name>";
|
|
3138
3141
|
} else if (status === 400) {
|
|
3139
|
-
|
|
3142
|
+
messageText = `Ollama API request invalid: ${message}`;
|
|
3140
3143
|
} else {
|
|
3141
|
-
|
|
3144
|
+
messageText = `Ollama API error (${status}): ${message}`;
|
|
3142
3145
|
}
|
|
3143
|
-
|
|
3144
|
-
if (error.response) wrappedError.response = error.response;
|
|
3145
|
-
throw wrappedError;
|
|
3146
|
+
throw withProviderErrorMetadata(error, messageText);
|
|
3146
3147
|
}
|
|
3147
3148
|
throw error;
|
|
3148
3149
|
}
|
|
@@ -3734,7 +3735,7 @@ function createNeo4jFindNodesTool() {
|
|
|
3734
3735
|
parameters = { ...parameters, ...filterParams };
|
|
3735
3736
|
}
|
|
3736
3737
|
cypher += ` RETURN n LIMIT $limit`;
|
|
3737
|
-
parameters.limit = input.limit;
|
|
3738
|
+
parameters.limit = input.limit ?? 100;
|
|
3738
3739
|
const result = await session.run(cypher, parameters);
|
|
3739
3740
|
const formattedResults = formatResults(result.records);
|
|
3740
3741
|
return {
|
|
@@ -4160,8 +4161,6 @@ For more information, see the @agentforge/tools documentation.`
|
|
|
4160
4161
|
this.name = "MissingPeerDependencyError";
|
|
4161
4162
|
Object.setPrototypeOf(this, _MissingPeerDependencyError.prototype);
|
|
4162
4163
|
}
|
|
4163
|
-
vendor;
|
|
4164
|
-
packageName;
|
|
4165
4164
|
};
|
|
4166
4165
|
function isPeerDependencyAvailable(packageName) {
|
|
4167
4166
|
try {
|
|
@@ -6850,8 +6849,6 @@ var SchemaInspector = class _SchemaInspector {
|
|
|
6850
6849
|
this.cacheTtlMs = config?.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;
|
|
6851
6850
|
this.cacheKey = config?.cacheKey;
|
|
6852
6851
|
}
|
|
6853
|
-
manager;
|
|
6854
|
-
vendor;
|
|
6855
6852
|
cacheTtlMs;
|
|
6856
6853
|
cacheKey;
|
|
6857
6854
|
static clearCache(cacheKey) {
|
|
@@ -9368,8 +9365,6 @@ var FileSystemPolicyError = class extends Error {
|
|
|
9368
9365
|
this.inputPath = inputPath;
|
|
9369
9366
|
this.name = "FileSystemPolicyError";
|
|
9370
9367
|
}
|
|
9371
|
-
operation;
|
|
9372
|
-
inputPath;
|
|
9373
9368
|
code = "FILE_SYSTEM_POLICY_VIOLATION";
|
|
9374
9369
|
};
|
|
9375
9370
|
function containsTraversal(inputPath) {
|
|
@@ -10674,11 +10669,11 @@ var AskHumanInputSchema = zod.z.object({
|
|
|
10674
10669
|
});
|
|
10675
10670
|
var logLevel3 = process.env.LOG_LEVEL?.toLowerCase() || core.LogLevel.INFO;
|
|
10676
10671
|
var logger18 = core.createLogger("agentforge:tools:agent:ask-human", { level: logLevel3 });
|
|
10677
|
-
function
|
|
10672
|
+
function isRecord3(value) {
|
|
10678
10673
|
return typeof value === "object" && value !== null;
|
|
10679
10674
|
}
|
|
10680
10675
|
function resolveInterrupt(module) {
|
|
10681
|
-
if (!
|
|
10676
|
+
if (!isRecord3(module)) {
|
|
10682
10677
|
return void 0;
|
|
10683
10678
|
}
|
|
10684
10679
|
const candidate = module.interrupt;
|
|
@@ -11131,6 +11126,7 @@ exports.webScraperSchema = webScraperSchema;
|
|
|
11131
11126
|
exports.webSearch = webSearch;
|
|
11132
11127
|
exports.webSearchOutputSchema = webSearchOutputSchema;
|
|
11133
11128
|
exports.webSearchSchema = webSearchSchema;
|
|
11129
|
+
exports.withProviderErrorMetadata = withProviderErrorMetadata;
|
|
11134
11130
|
exports.withTransaction = withTransaction;
|
|
11135
11131
|
exports.xmlGenerator = xmlGenerator;
|
|
11136
11132
|
exports.xmlGeneratorSchema = xmlGeneratorSchema;
|