@agentforge/tools 0.3.8 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as _agentforge_core from '@agentforge/core';
2
+ import { z } from 'zod';
2
3
 
3
4
  /**
4
5
  * HTTP Client Tool
@@ -216,6 +217,252 @@ declare const urlQueryParser: _agentforge_core.Tool<{
216
217
  count: number;
217
218
  }>;
218
219
 
220
+ /**
221
+ * Web Search Tool - Type Definitions
222
+ */
223
+ /**
224
+ * Individual search result
225
+ */
226
+ interface SearchResult {
227
+ title: string;
228
+ link: string;
229
+ snippet: string;
230
+ position?: number;
231
+ }
232
+ /**
233
+ * Web search input parameters
234
+ */
235
+ interface WebSearchInput {
236
+ query: string;
237
+ maxResults?: number;
238
+ preferSerper?: boolean;
239
+ timeout?: number;
240
+ }
241
+ /**
242
+ * Web search output
243
+ */
244
+ interface WebSearchOutput {
245
+ success: boolean;
246
+ source: 'duckduckgo' | 'serper';
247
+ query: string;
248
+ results: SearchResult[];
249
+ totalResults?: number;
250
+ error?: string;
251
+ metadata?: {
252
+ responseTime?: number;
253
+ fallbackUsed?: boolean;
254
+ };
255
+ }
256
+ /**
257
+ * Search provider interface
258
+ */
259
+ interface SearchProvider {
260
+ name: 'duckduckgo' | 'serper';
261
+ search(query: string, maxResults: number, timeout?: number): Promise<SearchResult[]>;
262
+ isAvailable(): boolean;
263
+ }
264
+ /**
265
+ * Retry configuration
266
+ */
267
+ interface RetryConfig {
268
+ maxRetries: number;
269
+ initialDelay: number;
270
+ maxDelay: number;
271
+ backoffMultiplier: number;
272
+ }
273
+
274
+ /**
275
+ * Web Search Tool - Zod Schemas
276
+ */
277
+
278
+ /**
279
+ * Web search input schema
280
+ */
281
+ declare const webSearchSchema: z.ZodObject<{
282
+ query: z.ZodString;
283
+ maxResults: z.ZodDefault<z.ZodNumber>;
284
+ preferSerper: z.ZodDefault<z.ZodBoolean>;
285
+ timeout: z.ZodDefault<z.ZodNumber>;
286
+ }, "strip", z.ZodTypeAny, {
287
+ timeout: number;
288
+ query: string;
289
+ maxResults: number;
290
+ preferSerper: boolean;
291
+ }, {
292
+ query: string;
293
+ timeout?: number | undefined;
294
+ maxResults?: number | undefined;
295
+ preferSerper?: boolean | undefined;
296
+ }>;
297
+ /**
298
+ * Search result schema
299
+ */
300
+ declare const searchResultSchema: z.ZodObject<{
301
+ title: z.ZodString;
302
+ link: z.ZodString;
303
+ snippet: z.ZodString;
304
+ position: z.ZodOptional<z.ZodNumber>;
305
+ }, "strip", z.ZodTypeAny, {
306
+ link: string;
307
+ title: string;
308
+ snippet: string;
309
+ position?: number | undefined;
310
+ }, {
311
+ link: string;
312
+ title: string;
313
+ snippet: string;
314
+ position?: number | undefined;
315
+ }>;
316
+ /**
317
+ * Web search output schema
318
+ */
319
+ declare const webSearchOutputSchema: z.ZodObject<{
320
+ success: z.ZodBoolean;
321
+ source: z.ZodEnum<["duckduckgo", "serper"]>;
322
+ query: z.ZodString;
323
+ results: z.ZodArray<z.ZodObject<{
324
+ title: z.ZodString;
325
+ link: z.ZodString;
326
+ snippet: z.ZodString;
327
+ position: z.ZodOptional<z.ZodNumber>;
328
+ }, "strip", z.ZodTypeAny, {
329
+ link: string;
330
+ title: string;
331
+ snippet: string;
332
+ position?: number | undefined;
333
+ }, {
334
+ link: string;
335
+ title: string;
336
+ snippet: string;
337
+ position?: number | undefined;
338
+ }>, "many">;
339
+ totalResults: z.ZodOptional<z.ZodNumber>;
340
+ error: z.ZodOptional<z.ZodString>;
341
+ metadata: z.ZodOptional<z.ZodObject<{
342
+ responseTime: z.ZodOptional<z.ZodNumber>;
343
+ fallbackUsed: z.ZodOptional<z.ZodBoolean>;
344
+ }, "strip", z.ZodTypeAny, {
345
+ responseTime?: number | undefined;
346
+ fallbackUsed?: boolean | undefined;
347
+ }, {
348
+ responseTime?: number | undefined;
349
+ fallbackUsed?: boolean | undefined;
350
+ }>>;
351
+ }, "strip", z.ZodTypeAny, {
352
+ results: {
353
+ link: string;
354
+ title: string;
355
+ snippet: string;
356
+ position?: number | undefined;
357
+ }[];
358
+ query: string;
359
+ success: boolean;
360
+ source: "duckduckgo" | "serper";
361
+ error?: string | undefined;
362
+ totalResults?: number | undefined;
363
+ metadata?: {
364
+ responseTime?: number | undefined;
365
+ fallbackUsed?: boolean | undefined;
366
+ } | undefined;
367
+ }, {
368
+ results: {
369
+ link: string;
370
+ title: string;
371
+ snippet: string;
372
+ position?: number | undefined;
373
+ }[];
374
+ query: string;
375
+ success: boolean;
376
+ source: "duckduckgo" | "serper";
377
+ error?: string | undefined;
378
+ totalResults?: number | undefined;
379
+ metadata?: {
380
+ responseTime?: number | undefined;
381
+ fallbackUsed?: boolean | undefined;
382
+ } | undefined;
383
+ }>;
384
+
385
+ /**
386
+ * DuckDuckGo Search Provider
387
+ *
388
+ * Free search provider using DuckDuckGo's Instant Answer API.
389
+ * No API key required.
390
+ */
391
+
392
+ /**
393
+ * DuckDuckGo search provider implementation
394
+ */
395
+ declare class DuckDuckGoProvider implements SearchProvider {
396
+ name: "duckduckgo";
397
+ /**
398
+ * DuckDuckGo is always available (no API key required)
399
+ */
400
+ isAvailable(): boolean;
401
+ /**
402
+ * Search using DuckDuckGo Instant Answer API
403
+ * @param query - Search query
404
+ * @param maxResults - Maximum number of results to return
405
+ * @param timeout - Request timeout in milliseconds (default: 30000)
406
+ */
407
+ search(query: string, maxResults: number, timeout?: number): Promise<SearchResult[]>;
408
+ /**
409
+ * Normalize DuckDuckGo response to SearchResult[]
410
+ * Optimized for performance with large result sets
411
+ */
412
+ private normalizeResults;
413
+ }
414
+ /**
415
+ * Create a new DuckDuckGo provider instance
416
+ */
417
+ declare function createDuckDuckGoProvider(): DuckDuckGoProvider;
418
+
419
+ /**
420
+ * Serper Search Provider
421
+ *
422
+ * Premium search provider using Serper API (Google results).
423
+ * Requires SERPER_API_KEY environment variable.
424
+ * Get your API key at: https://serper.dev
425
+ */
426
+
427
+ /**
428
+ * Serper search provider implementation
429
+ */
430
+ declare class SerperProvider implements SearchProvider {
431
+ name: "serper";
432
+ private apiKey;
433
+ constructor();
434
+ /**
435
+ * Serper is available if API key is set
436
+ */
437
+ isAvailable(): boolean;
438
+ /**
439
+ * Search using Serper API
440
+ * @param query - Search query
441
+ * @param maxResults - Maximum number of results to return
442
+ * @param timeout - Request timeout in milliseconds (default: 30000)
443
+ */
444
+ search(query: string, maxResults: number, timeout?: number): Promise<SearchResult[]>;
445
+ /**
446
+ * Normalize Serper response to SearchResult[]
447
+ * Optimized for performance with large result sets
448
+ */
449
+ private normalizeResults;
450
+ }
451
+ /**
452
+ * Create a new Serper provider instance
453
+ */
454
+ declare function createSerperProvider(): SerperProvider;
455
+
456
+ /**
457
+ * Web search tool implementation
458
+ */
459
+ declare const webSearch: _agentforge_core.Tool<{
460
+ query: string;
461
+ timeout?: number | undefined;
462
+ maxResults?: number | undefined;
463
+ preferSerper?: boolean | undefined;
464
+ }, WebSearchOutput>;
465
+
219
466
  /**
220
467
  * JSON Processor Tool
221
468
  *
@@ -1142,4 +1389,4 @@ declare const uuidValidator: _agentforge_core.Tool<{
1142
1389
  message: string;
1143
1390
  }>;
1144
1391
 
1145
- export { type HttpResponse, type ScraperResult, type UrlValidationResult, arrayFilter, arrayGroupBy, arrayMap, arraySort, calculator, creditCardValidator, csvGenerator, csvParser, csvToJson, currentDateTime, dateArithmetic, dateComparison, dateDifference, dateFormatter, directoryCreate, directoryDelete, directoryList, emailValidator, extractImages, extractLinks, fileAppend, fileDelete, fileExists, fileReader, fileSearch, fileWriter, htmlParser, httpClient, httpGet, httpPost, ipValidator, jsonMerge, jsonParser, jsonQuery, jsonStringify, jsonToCsv, jsonToXml, jsonValidator, mathFunctions, objectOmit, objectPick, pathBasename, pathDirname, pathExtension, pathJoin, pathNormalize, pathParse, pathRelative, pathResolve, phoneValidator, randomNumber, statistics, stringCaseConverter, stringJoin, stringLength, stringReplace, stringSplit, stringSubstring, stringTrim, urlBuilder, urlQueryParser, urlValidator, urlValidatorSimple, uuidValidator, webScraper, xmlGenerator, xmlParser, xmlToJson };
1392
+ export { DuckDuckGoProvider, type HttpResponse, type RetryConfig, type ScraperResult, type SearchProvider, type SearchResult, SerperProvider, type UrlValidationResult, type WebSearchInput, type WebSearchOutput, arrayFilter, arrayGroupBy, arrayMap, arraySort, calculator, createDuckDuckGoProvider, createSerperProvider, creditCardValidator, csvGenerator, csvParser, csvToJson, currentDateTime, dateArithmetic, dateComparison, dateDifference, dateFormatter, directoryCreate, directoryDelete, directoryList, emailValidator, extractImages, extractLinks, fileAppend, fileDelete, fileExists, fileReader, fileSearch, fileWriter, htmlParser, httpClient, httpGet, httpPost, ipValidator, jsonMerge, jsonParser, jsonQuery, jsonStringify, jsonToCsv, jsonToXml, jsonValidator, mathFunctions, objectOmit, objectPick, pathBasename, pathDirname, pathExtension, pathJoin, pathNormalize, pathParse, pathRelative, pathResolve, phoneValidator, randomNumber, searchResultSchema, statistics, stringCaseConverter, stringJoin, stringLength, stringReplace, stringSplit, stringSubstring, stringTrim, urlBuilder, urlQueryParser, urlValidator, urlValidatorSimple, uuidValidator, webScraper, webSearch, webSearchOutputSchema, webSearchSchema, xmlGenerator, xmlParser, xmlToJson };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as _agentforge_core from '@agentforge/core';
2
+ import { z } from 'zod';
2
3
 
3
4
  /**
4
5
  * HTTP Client Tool
@@ -216,6 +217,252 @@ declare const urlQueryParser: _agentforge_core.Tool<{
216
217
  count: number;
217
218
  }>;
218
219
 
220
+ /**
221
+ * Web Search Tool - Type Definitions
222
+ */
223
+ /**
224
+ * Individual search result
225
+ */
226
+ interface SearchResult {
227
+ title: string;
228
+ link: string;
229
+ snippet: string;
230
+ position?: number;
231
+ }
232
+ /**
233
+ * Web search input parameters
234
+ */
235
+ interface WebSearchInput {
236
+ query: string;
237
+ maxResults?: number;
238
+ preferSerper?: boolean;
239
+ timeout?: number;
240
+ }
241
+ /**
242
+ * Web search output
243
+ */
244
+ interface WebSearchOutput {
245
+ success: boolean;
246
+ source: 'duckduckgo' | 'serper';
247
+ query: string;
248
+ results: SearchResult[];
249
+ totalResults?: number;
250
+ error?: string;
251
+ metadata?: {
252
+ responseTime?: number;
253
+ fallbackUsed?: boolean;
254
+ };
255
+ }
256
+ /**
257
+ * Search provider interface
258
+ */
259
+ interface SearchProvider {
260
+ name: 'duckduckgo' | 'serper';
261
+ search(query: string, maxResults: number, timeout?: number): Promise<SearchResult[]>;
262
+ isAvailable(): boolean;
263
+ }
264
+ /**
265
+ * Retry configuration
266
+ */
267
+ interface RetryConfig {
268
+ maxRetries: number;
269
+ initialDelay: number;
270
+ maxDelay: number;
271
+ backoffMultiplier: number;
272
+ }
273
+
274
+ /**
275
+ * Web Search Tool - Zod Schemas
276
+ */
277
+
278
+ /**
279
+ * Web search input schema
280
+ */
281
+ declare const webSearchSchema: z.ZodObject<{
282
+ query: z.ZodString;
283
+ maxResults: z.ZodDefault<z.ZodNumber>;
284
+ preferSerper: z.ZodDefault<z.ZodBoolean>;
285
+ timeout: z.ZodDefault<z.ZodNumber>;
286
+ }, "strip", z.ZodTypeAny, {
287
+ timeout: number;
288
+ query: string;
289
+ maxResults: number;
290
+ preferSerper: boolean;
291
+ }, {
292
+ query: string;
293
+ timeout?: number | undefined;
294
+ maxResults?: number | undefined;
295
+ preferSerper?: boolean | undefined;
296
+ }>;
297
+ /**
298
+ * Search result schema
299
+ */
300
+ declare const searchResultSchema: z.ZodObject<{
301
+ title: z.ZodString;
302
+ link: z.ZodString;
303
+ snippet: z.ZodString;
304
+ position: z.ZodOptional<z.ZodNumber>;
305
+ }, "strip", z.ZodTypeAny, {
306
+ link: string;
307
+ title: string;
308
+ snippet: string;
309
+ position?: number | undefined;
310
+ }, {
311
+ link: string;
312
+ title: string;
313
+ snippet: string;
314
+ position?: number | undefined;
315
+ }>;
316
+ /**
317
+ * Web search output schema
318
+ */
319
+ declare const webSearchOutputSchema: z.ZodObject<{
320
+ success: z.ZodBoolean;
321
+ source: z.ZodEnum<["duckduckgo", "serper"]>;
322
+ query: z.ZodString;
323
+ results: z.ZodArray<z.ZodObject<{
324
+ title: z.ZodString;
325
+ link: z.ZodString;
326
+ snippet: z.ZodString;
327
+ position: z.ZodOptional<z.ZodNumber>;
328
+ }, "strip", z.ZodTypeAny, {
329
+ link: string;
330
+ title: string;
331
+ snippet: string;
332
+ position?: number | undefined;
333
+ }, {
334
+ link: string;
335
+ title: string;
336
+ snippet: string;
337
+ position?: number | undefined;
338
+ }>, "many">;
339
+ totalResults: z.ZodOptional<z.ZodNumber>;
340
+ error: z.ZodOptional<z.ZodString>;
341
+ metadata: z.ZodOptional<z.ZodObject<{
342
+ responseTime: z.ZodOptional<z.ZodNumber>;
343
+ fallbackUsed: z.ZodOptional<z.ZodBoolean>;
344
+ }, "strip", z.ZodTypeAny, {
345
+ responseTime?: number | undefined;
346
+ fallbackUsed?: boolean | undefined;
347
+ }, {
348
+ responseTime?: number | undefined;
349
+ fallbackUsed?: boolean | undefined;
350
+ }>>;
351
+ }, "strip", z.ZodTypeAny, {
352
+ results: {
353
+ link: string;
354
+ title: string;
355
+ snippet: string;
356
+ position?: number | undefined;
357
+ }[];
358
+ query: string;
359
+ success: boolean;
360
+ source: "duckduckgo" | "serper";
361
+ error?: string | undefined;
362
+ totalResults?: number | undefined;
363
+ metadata?: {
364
+ responseTime?: number | undefined;
365
+ fallbackUsed?: boolean | undefined;
366
+ } | undefined;
367
+ }, {
368
+ results: {
369
+ link: string;
370
+ title: string;
371
+ snippet: string;
372
+ position?: number | undefined;
373
+ }[];
374
+ query: string;
375
+ success: boolean;
376
+ source: "duckduckgo" | "serper";
377
+ error?: string | undefined;
378
+ totalResults?: number | undefined;
379
+ metadata?: {
380
+ responseTime?: number | undefined;
381
+ fallbackUsed?: boolean | undefined;
382
+ } | undefined;
383
+ }>;
384
+
385
+ /**
386
+ * DuckDuckGo Search Provider
387
+ *
388
+ * Free search provider using DuckDuckGo's Instant Answer API.
389
+ * No API key required.
390
+ */
391
+
392
+ /**
393
+ * DuckDuckGo search provider implementation
394
+ */
395
+ declare class DuckDuckGoProvider implements SearchProvider {
396
+ name: "duckduckgo";
397
+ /**
398
+ * DuckDuckGo is always available (no API key required)
399
+ */
400
+ isAvailable(): boolean;
401
+ /**
402
+ * Search using DuckDuckGo Instant Answer API
403
+ * @param query - Search query
404
+ * @param maxResults - Maximum number of results to return
405
+ * @param timeout - Request timeout in milliseconds (default: 30000)
406
+ */
407
+ search(query: string, maxResults: number, timeout?: number): Promise<SearchResult[]>;
408
+ /**
409
+ * Normalize DuckDuckGo response to SearchResult[]
410
+ * Optimized for performance with large result sets
411
+ */
412
+ private normalizeResults;
413
+ }
414
+ /**
415
+ * Create a new DuckDuckGo provider instance
416
+ */
417
+ declare function createDuckDuckGoProvider(): DuckDuckGoProvider;
418
+
419
+ /**
420
+ * Serper Search Provider
421
+ *
422
+ * Premium search provider using Serper API (Google results).
423
+ * Requires SERPER_API_KEY environment variable.
424
+ * Get your API key at: https://serper.dev
425
+ */
426
+
427
+ /**
428
+ * Serper search provider implementation
429
+ */
430
+ declare class SerperProvider implements SearchProvider {
431
+ name: "serper";
432
+ private apiKey;
433
+ constructor();
434
+ /**
435
+ * Serper is available if API key is set
436
+ */
437
+ isAvailable(): boolean;
438
+ /**
439
+ * Search using Serper API
440
+ * @param query - Search query
441
+ * @param maxResults - Maximum number of results to return
442
+ * @param timeout - Request timeout in milliseconds (default: 30000)
443
+ */
444
+ search(query: string, maxResults: number, timeout?: number): Promise<SearchResult[]>;
445
+ /**
446
+ * Normalize Serper response to SearchResult[]
447
+ * Optimized for performance with large result sets
448
+ */
449
+ private normalizeResults;
450
+ }
451
+ /**
452
+ * Create a new Serper provider instance
453
+ */
454
+ declare function createSerperProvider(): SerperProvider;
455
+
456
+ /**
457
+ * Web search tool implementation
458
+ */
459
+ declare const webSearch: _agentforge_core.Tool<{
460
+ query: string;
461
+ timeout?: number | undefined;
462
+ maxResults?: number | undefined;
463
+ preferSerper?: boolean | undefined;
464
+ }, WebSearchOutput>;
465
+
219
466
  /**
220
467
  * JSON Processor Tool
221
468
  *
@@ -1142,4 +1389,4 @@ declare const uuidValidator: _agentforge_core.Tool<{
1142
1389
  message: string;
1143
1390
  }>;
1144
1391
 
1145
- export { type HttpResponse, type ScraperResult, type UrlValidationResult, arrayFilter, arrayGroupBy, arrayMap, arraySort, calculator, creditCardValidator, csvGenerator, csvParser, csvToJson, currentDateTime, dateArithmetic, dateComparison, dateDifference, dateFormatter, directoryCreate, directoryDelete, directoryList, emailValidator, extractImages, extractLinks, fileAppend, fileDelete, fileExists, fileReader, fileSearch, fileWriter, htmlParser, httpClient, httpGet, httpPost, ipValidator, jsonMerge, jsonParser, jsonQuery, jsonStringify, jsonToCsv, jsonToXml, jsonValidator, mathFunctions, objectOmit, objectPick, pathBasename, pathDirname, pathExtension, pathJoin, pathNormalize, pathParse, pathRelative, pathResolve, phoneValidator, randomNumber, statistics, stringCaseConverter, stringJoin, stringLength, stringReplace, stringSplit, stringSubstring, stringTrim, urlBuilder, urlQueryParser, urlValidator, urlValidatorSimple, uuidValidator, webScraper, xmlGenerator, xmlParser, xmlToJson };
1392
+ export { DuckDuckGoProvider, type HttpResponse, type RetryConfig, type ScraperResult, type SearchProvider, type SearchResult, SerperProvider, type UrlValidationResult, type WebSearchInput, type WebSearchOutput, arrayFilter, arrayGroupBy, arrayMap, arraySort, calculator, createDuckDuckGoProvider, createSerperProvider, creditCardValidator, csvGenerator, csvParser, csvToJson, currentDateTime, dateArithmetic, dateComparison, dateDifference, dateFormatter, directoryCreate, directoryDelete, directoryList, emailValidator, extractImages, extractLinks, fileAppend, fileDelete, fileExists, fileReader, fileSearch, fileWriter, htmlParser, httpClient, httpGet, httpPost, ipValidator, jsonMerge, jsonParser, jsonQuery, jsonStringify, jsonToCsv, jsonToXml, jsonValidator, mathFunctions, objectOmit, objectPick, pathBasename, pathDirname, pathExtension, pathJoin, pathNormalize, pathParse, pathRelative, pathResolve, phoneValidator, randomNumber, searchResultSchema, statistics, stringCaseConverter, stringJoin, stringLength, stringReplace, stringSplit, stringSubstring, stringTrim, urlBuilder, urlQueryParser, urlValidator, urlValidatorSimple, uuidValidator, webScraper, webSearch, webSearchOutputSchema, webSearchSchema, xmlGenerator, xmlParser, xmlToJson };