@scavio/ai-sdk 0.5.3 → 0.5.5
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 +109 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -1
- package/dist/index.d.ts +78 -1
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -26,8 +26,15 @@ __export(index_exports, {
|
|
|
26
26
|
scavioBatchStatus: () => scavioBatchStatus,
|
|
27
27
|
scavioCrawlStatus: () => scavioCrawlStatus,
|
|
28
28
|
scavioCrawlWebsite: () => scavioCrawlWebsite,
|
|
29
|
+
scavioDecathlonProduct: () => scavioDecathlonProduct,
|
|
30
|
+
scavioDecathlonSearch: () => scavioDecathlonSearch,
|
|
29
31
|
scavioExtract: () => scavioExtract,
|
|
32
|
+
scavioHebProduct: () => scavioHebProduct,
|
|
33
|
+
scavioHebSearch: () => scavioHebSearch,
|
|
34
|
+
scavioHebStores: () => scavioHebStores,
|
|
30
35
|
scavioInstagramSearch: () => scavioInstagramSearch,
|
|
36
|
+
scavioKrogerProduct: () => scavioKrogerProduct,
|
|
37
|
+
scavioKrogerSearch: () => scavioKrogerSearch,
|
|
31
38
|
scavioMapWebsite: () => scavioMapWebsite,
|
|
32
39
|
scavioRedditSearch: () => scavioRedditSearch,
|
|
33
40
|
scavioSearch: () => scavioSearch,
|
|
@@ -380,6 +387,94 @@ function scavioBatchStatus(config) {
|
|
|
380
387
|
execute: async ({ id, limit, ...q }) => await c.extract.batchStatus(id, { ...q, limit: limit ?? JOB_RESULTS_DEFAULT_LIMIT })
|
|
381
388
|
});
|
|
382
389
|
}
|
|
390
|
+
function scavioHebSearch(config) {
|
|
391
|
+
const c = client(config);
|
|
392
|
+
const max = config?.maxResults ?? 10;
|
|
393
|
+
return (0, import_ai.tool)({
|
|
394
|
+
description: "Search HEB grocery products via the Scavio API: price, sale status, unit price, UPC, stock, EBT/SNAP eligibility. Pass store_id for one store's prices, stock and assortment. Products come back under `data.products`.",
|
|
395
|
+
inputSchema: import_zod.z.object({
|
|
396
|
+
query: import_zod.z.string().describe("Search keywords (1-200 characters)."),
|
|
397
|
+
page: import_zod.z.number().optional().describe("Results page, 1-based."),
|
|
398
|
+
page_size: import_zod.z.number().optional().describe("Results per page, 1-60. Defaults to 60."),
|
|
399
|
+
store_id: import_zod.z.string().optional().describe("HEB store number from the HEB stores tool (store_number), e.g. '441'. Prices, stock, aisle location and assortment come from that store; the store used is echoed in data.store {store_id, name}. US only. Omit for HEB's default store.")
|
|
400
|
+
}),
|
|
401
|
+
execute: async (input) => trimData(await c.heb.search(input), "products", max)
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
function scavioHebProduct(config) {
|
|
405
|
+
const c = client(config);
|
|
406
|
+
return (0, import_ai.tool)({
|
|
407
|
+
description: "Full HEB product detail via the Scavio API: nutrition, ingredients, images, coupons, EBT/SNAP eligibility. With store_id, price, stock and aisle are for that store and product_id alone works.",
|
|
408
|
+
inputSchema: import_zod.z.object({
|
|
409
|
+
product_url: import_zod.z.string().optional().describe("Full or relative product URL from heb.com. Preferred."),
|
|
410
|
+
product_id: import_zod.z.string().optional().describe("HEB product id. Needs slug, unless store_id is set (then product_id alone works)."),
|
|
411
|
+
slug: import_zod.z.string().optional().describe("Product slug. Required with product_id unless store_id is set."),
|
|
412
|
+
store_id: import_zod.z.string().optional().describe("HEB store number from the HEB stores tool (store_number), e.g. '441'. Prices, stock, aisle location and assortment come from that store; the store used is echoed in data.store {store_id, name}. US only. Omit for HEB's default store.")
|
|
413
|
+
}),
|
|
414
|
+
execute: async (input) => await c.heb.product(input)
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
function scavioHebStores(config) {
|
|
418
|
+
const c = client(config);
|
|
419
|
+
const max = config?.maxResults ?? 10;
|
|
420
|
+
return (0, import_ai.tool)({
|
|
421
|
+
description: "Find HEB stores near a ZIP code or city via the Scavio API. Stores come back under `data.stores`.",
|
|
422
|
+
inputSchema: import_zod.z.object({
|
|
423
|
+
zip: import_zod.z.string().optional().describe("5-digit US ZIP code."),
|
|
424
|
+
city: import_zod.z.string().optional().describe("City name. Pass zip or city.")
|
|
425
|
+
}),
|
|
426
|
+
execute: async (input) => trimData(await c.heb.stores(input), "stores", max)
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
function scavioKrogerSearch(config) {
|
|
430
|
+
const c = client(config);
|
|
431
|
+
const max = config?.maxResults ?? 10;
|
|
432
|
+
return (0, import_ai.tool)({
|
|
433
|
+
description: "Search Kroger grocery products via the Scavio API: price, promo deals, UPC, stock, SNAP eligibility, dietary info. Kroger operates Kroger, Ralphs, Fred Meyer, Harris Teeter, King Soopers and Fry's. Products come back under `data.products`.",
|
|
434
|
+
inputSchema: import_zod.z.object({
|
|
435
|
+
query: import_zod.z.string().describe("Search keywords (1-200 characters)."),
|
|
436
|
+
page: import_zod.z.number().optional().describe("Results page, 1-based.")
|
|
437
|
+
}),
|
|
438
|
+
execute: async (input) => trimData(await c.kroger.search(input), "products", max)
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
function scavioKrogerProduct(config) {
|
|
442
|
+
const c = client(config);
|
|
443
|
+
return (0, import_ai.tool)({
|
|
444
|
+
description: "Full Kroger product detail via the Scavio API: nutrition, allergens, ingredients, images, rating, dietary flags, SNAP eligibility.",
|
|
445
|
+
inputSchema: import_zod.z.object({
|
|
446
|
+
product_url: import_zod.z.string().optional().describe("Full or relative product URL from kroger.com. Preferred."),
|
|
447
|
+
upc: import_zod.z.string().optional().describe("Kroger product UPC."),
|
|
448
|
+
slug: import_zod.z.string().optional().describe("Product slug. Optional with upc.")
|
|
449
|
+
}),
|
|
450
|
+
execute: async (input) => await c.kroger.product(input)
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
function scavioDecathlonSearch(config) {
|
|
454
|
+
const c = client(config);
|
|
455
|
+
const max = config?.maxResults ?? 10;
|
|
456
|
+
return (0, import_ai.tool)({
|
|
457
|
+
description: "Search Decathlon products by keyword via the Scavio API across 7 country domains (FR, ES, IT, IN, UK, PT, NET). Returns product name, brand, price (cents), currency, availability, rating, review count and image. Products come back under `data.products`.",
|
|
458
|
+
inputSchema: import_zod.z.object({
|
|
459
|
+
query: import_zod.z.string().describe("Search keywords (1-200 characters)."),
|
|
460
|
+
country: import_zod.z.enum(["fr", "es", "it", "in", "uk", "pt", "net"]).describe("Country domain."),
|
|
461
|
+
page: import_zod.z.number().optional().describe("Results page, 1-based (1-50).")
|
|
462
|
+
}),
|
|
463
|
+
execute: async (input) => trimData(await c.decathlon.search(input), "products", max)
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
function scavioDecathlonProduct(config) {
|
|
467
|
+
const c = client(config);
|
|
468
|
+
return (0, import_ai.tool)({
|
|
469
|
+
description: "Full Decathlon product detail via the Scavio API: description, images, SKU, GTIN, color, price (cents), list price, availability, offers/variants, rating, review count, category and breadcrumbs.",
|
|
470
|
+
inputSchema: import_zod.z.object({
|
|
471
|
+
product_url: import_zod.z.string().optional().describe("Full or relative product URL from any Decathlon domain. Preferred."),
|
|
472
|
+
product_id: import_zod.z.string().optional().describe("Decathlon numeric product ID."),
|
|
473
|
+
country: import_zod.z.enum(["fr", "es", "it", "in", "uk", "pt", "net"]).describe("Country domain.")
|
|
474
|
+
}),
|
|
475
|
+
execute: async (input) => await c.decathlon.product(input)
|
|
476
|
+
});
|
|
477
|
+
}
|
|
383
478
|
function scavioTools(config) {
|
|
384
479
|
return {
|
|
385
480
|
scavio_extract: scavioExtract(config),
|
|
@@ -395,6 +490,13 @@ function scavioTools(config) {
|
|
|
395
490
|
scavio_walmart_search: scavioWalmartSearch(config),
|
|
396
491
|
scavio_tiktok_search: scavioTiktokSearch(config),
|
|
397
492
|
scavio_instagram_search: scavioInstagramSearch(config),
|
|
493
|
+
scavio_heb_search: scavioHebSearch(config),
|
|
494
|
+
scavio_heb_product: scavioHebProduct(config),
|
|
495
|
+
scavio_heb_stores: scavioHebStores(config),
|
|
496
|
+
scavio_kroger_search: scavioKrogerSearch(config),
|
|
497
|
+
scavio_kroger_product: scavioKrogerProduct(config),
|
|
498
|
+
scavio_decathlon_search: scavioDecathlonSearch(config),
|
|
499
|
+
scavio_decathlon_product: scavioDecathlonProduct(config),
|
|
398
500
|
...config?.enableCrawl ? {
|
|
399
501
|
scavio_map_website: scavioMapWebsite(config),
|
|
400
502
|
scavio_crawl_website: scavioCrawlWebsite(config),
|
|
@@ -412,8 +514,15 @@ function scavioTools(config) {
|
|
|
412
514
|
scavioBatchStatus,
|
|
413
515
|
scavioCrawlStatus,
|
|
414
516
|
scavioCrawlWebsite,
|
|
517
|
+
scavioDecathlonProduct,
|
|
518
|
+
scavioDecathlonSearch,
|
|
415
519
|
scavioExtract,
|
|
520
|
+
scavioHebProduct,
|
|
521
|
+
scavioHebSearch,
|
|
522
|
+
scavioHebStores,
|
|
416
523
|
scavioInstagramSearch,
|
|
524
|
+
scavioKrogerProduct,
|
|
525
|
+
scavioKrogerSearch,
|
|
417
526
|
scavioMapWebsite,
|
|
418
527
|
scavioRedditSearch,
|
|
419
528
|
scavioSearch,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { tool } from \"ai\";\nimport { z } from \"zod\";\nimport { Scavio, type ScavioConfig, type GoogleSearchOptions } from \"scavio\";\n\nexport interface ScavioToolConfig extends ScavioConfig {\n /**\n * Max number of items to keep in the tool's result list. Defaults to 10.\n * Trimmed inside `data` on every platform except Google, whose body is flat.\n * Ignored by `scavioExtract`, which returns page content rather than a list.\n */\n maxResults?: number;\n /**\n * Add the five website tools (map, crawl, crawl status, batch extract, batch\n * status) to `scavioTools()`. Off by default: a crawl bills per page. The\n * individual factories (`scavioCrawlWebsite` and friends) work regardless.\n */\n enableCrawl?: boolean;\n /** Milliseconds between progress polls while a crawl or batch tool waits. Default 3000. */\n pollIntervalMs?: number;\n}\n\nfunction client(config?: ScavioToolConfig): Scavio {\n return new Scavio({ apiKey: config?.apiKey });\n}\n\n/**\n * Google is the ONLY family with a flat body: `organic_results` and friends sit\n * at the top level, next to `response_time` / `credits_used` / `credits_remaining`.\n */\nfunction trimFlat(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const list = res[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, [key]: list.slice(0, max) };\n }\n return res;\n}\n\n/**\n * Every non-Google endpoint nests its payload under `data` - the response is\n * `{ data: { products: [...] }, response_time, credits_used, credits_remaining }`.\n * Trimming the top level is therefore a silent no-op, so those tools trim\n * inside `data`.\n */\nfunction trimData(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const data = res.data;\n if (!data || typeof data !== \"object\") return res;\n const list = (data as Record<string, unknown>)[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, data: { ...(data as Record<string, unknown>), [key]: list.slice(0, max) } };\n }\n return res;\n}\n\n/**\n * Read any URL (/api/v1/extract).\n *\n * The one tool here that is not tied to a platform, and the only one `maxResults`\n * does not touch: extract returns page CONTENT, not a result list, so there is\n * nothing to trim and the body is returned whole. `extract` is a TOP-LEVEL\n * method on the SDK client - `c.extract({ url })`, never `c.extract.extract()`.\n *\n * Credits are a function of `mode`, not a per-call constant: \"normal\" 1,\n * \"advanced\" 1, \"ultra\" 2. Only a successful read is billed.\n */\nexport function scavioExtract(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read any web page via the Scavio API and get it back as clean Markdown (default), plain text, or raw HTML. Use it on any URL, including one returned by the search tools. Returns `data.content` alongside `data.url`, `data.format`, `data.mode` and `data.content_length`. Cost depends on `mode`: 1 credit on 'normal' and 'advanced', 2 on 'ultra'; a dead link, bot wall or timeout is not billed.\",\n inputSchema: z.object({\n url: z\n .string()\n .describe(\n \"The page to read (1-2048 characters). http(s) only; a bare host is upgraded to https, and loopback, private, link-local and metadata hosts are rejected.\",\n ),\n format: z\n .enum([\"html\", \"markdown\", \"text\"])\n .optional()\n .describe(\n \"Output format (default 'markdown'): 'markdown' is a readability extraction with page chrome stripped, 'text' is that flattened to plain text, 'html' is the raw page.\",\n ),\n mode: z\n .enum([\"normal\", \"advanced\", \"ultra\"])\n .optional()\n .describe(\n \"Fetch tier, and the parameter that sets the price: 'normal' (default) is a plain fetch and costs 1 credit, 'advanced' renders JavaScript-built pages and costs 1, 'ultra' reaches the hardest pages and costs 2. Start on 'normal'.\",\n ),\n }),\n execute: async ({ url, format, mode }) => c.extract({ url, format, mode }),\n });\n}\n\n/** Google web search (/api/v2/google, 1 credit). */\nexport function scavioSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search the web with Google via the Scavio API (1 credit). Returns real-time organic search results, each with a title, link, and snippet, under `organic_results`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n countryCode: z.string().optional().describe('Two-letter country code to localize results, e.g. \"us\".'),\n language: z.string().optional().describe('Two-letter UI language code, e.g. \"en\".'),\n page: z.number().int().optional().describe(\"1-based result page; page 2 starts at result 10.\"),\n device: z.enum([\"desktop\", \"mobile\"]).optional().describe(\"Device to emulate.\"),\n nfpr: z.boolean().optional().describe(\"Disable spelling auto-correction / similar-result substitution when true.\"),\n }),\n execute: async ({ query, countryCode, language, page, device, nfpr }) => {\n const params: GoogleSearchOptions = { query };\n if (countryCode) params.gl = countryCode;\n if (language) params.hl = language;\n if (page && page > 1) params.start = (page - 1) * 10;\n if (device) params.device = device;\n if (nfpr !== undefined) params.nfpr = nfpr;\n return trimFlat(await c.google.search(params), \"organic_results\", max);\n },\n });\n}\n\n/** YouTube video search (2 credits). */\nexport function scavioYoutubeSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search YouTube for videos, channels, or playlists via the Scavio API (2 credits). Videos come back under `data.results`, with `data.channels` and `data.playlists` alongside.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n upload_date: z.string().optional().describe(\"Upload date filter, e.g. 'today', 'this_week', 'this_month'.\"),\n type: z.string().optional().describe(\"Result type: 'video', 'channel', 'playlist', 'movie'.\"),\n duration: z.string().optional().describe(\"Duration filter: 'short', 'medium', 'long'.\"),\n sort_by: z.string().optional().describe(\"Sort order: 'relevance', 'date', 'view_count', 'rating'.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, upload_date, type, duration, sort_by, cursor }) =>\n trimData(\n await c.youtube.search({ query, upload_date, type, duration, sort_by, cursor } as Parameters<\n typeof c.youtube.search\n >[0]),\n \"results\",\n max,\n ),\n });\n}\n\n/** YouTube video details (1 credit). */\nexport function scavioYoutubeVideo(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch full details for a YouTube video (title, author, view count, description, captions, chapters) via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n }),\n execute: async ({ video_id }) => c.youtube.video({ video_id }),\n });\n}\n\n/** YouTube video transcript / subtitles (5 credits). */\nexport function scavioYoutubeTranscript(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube video's transcript or timed subtitles via the Scavio API (5 credits).\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n language: z.string().optional().describe(\"Transcript language code (default 'en').\"),\n format: z.enum([\"text\", \"srt\"]).optional().describe(\"'text' for a plain transcript, 'srt' for timed subtitles.\"),\n }),\n execute: async ({ video_id, language, format }) =>\n c.youtube.transcript({ video_id, language, format } as Parameters<typeof c.youtube.transcript>[0]),\n });\n}\n\n/** YouTube video comments (1 credit). */\nexport function scavioYoutubeComments(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"List comments on a YouTube video via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n cursor: z.string().optional().describe(\"Pagination cursor.\"),\n }),\n execute: async ({ video_id, cursor }) =>\n trimData(\n await c.youtube.comments({ video_id, cursor } as Parameters<typeof c.youtube.comments>[0]),\n \"comments\",\n max,\n ),\n });\n}\n\n/** YouTube channel details (1 credit). */\nexport function scavioYoutubeChannel(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube channel's details (subscribers, video count, views, links) via the Scavio API.\",\n inputSchema: z.object({\n channel_id: z.string().describe(\"YouTube channel id, @handle, or channel URL.\"),\n }),\n execute: async ({ channel_id }) => c.youtube.channel({ channel_id }),\n });\n}\n\n/**\n * Reddit post search (1 credit).\n *\n * The endpoint takes `query` and `cursor` and nothing else - it cannot sort or\n * filter by type, so no such input is offered. The API silently ignores those\n * params, which would leave a model believing it had filtered when it had not.\n */\nexport function scavioRedditSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Reddit posts via the Scavio API (1 credit). Returns matching posts under `data.results` with `data.next_cursor` for the next page. Results cannot be sorted or filtered by type.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, cursor }) => trimData(await c.reddit.search({ query, cursor }), \"results\", max),\n });\n}\n\n/**\n * Amazon product search.\n *\n * `domain` was dropped in favour of `country`, a two-letter marketplace code -\n * the Amazon endpoint changed in 2026-07 and no longer takes a domain\n * suffix. It still works on the wire as a deprecated alias, but a model should\n * only ever see one spelling of a param.\n */\nexport function scavioAmazonSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Amazon for products via the Scavio API. Results are unsorted and cannot be filtered by category, merchant or price.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ query, country }) =>\n trimData(await c.amazon.search({ query, country }), \"products\", max),\n });\n}\n\n/** Every seller offer for one Amazon ASIN. */\nexport function scavioAmazonOffers(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"List every seller offer for one Amazon ASIN via the Scavio API: price, seller, condition, shipping, and which offer holds the buy box. Page 1 only.\",\n inputSchema: z.object({\n asin: z.string().describe(\"Amazon Standard Identification Number (ASIN) of the product.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ asin, country }) =>\n trimData(await c.amazon.offers({ asin, country }), \"offers\", max),\n });\n}\n\n/** Walmart product search. */\nexport function scavioWalmartSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Walmart for products via the Scavio API. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n }),\n execute: async ({ query }) => trimData(await c.walmart.search({ query }), \"products\", max),\n });\n}\n\n/** TikTok video search. */\nexport function scavioTiktokSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search TikTok for videos by keyword via the Scavio API. Videos come back under `data.aweme_list`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n sort_type: z.enum([\"0\", \"1\"]).optional().describe(\"Sort order: '0' relevance, '1' most likes.\"),\n publish_time: z\n .enum([\"0\", \"1\", \"7\", \"30\", \"90\", \"180\"])\n .optional()\n .describe(\"Publish window in days: '0' all time, '1', '7', '30', '90', '180'.\"),\n }),\n execute: async ({ keyword, sort_type, publish_time }) =>\n trimData(\n await c.tiktok.searchVideos({\n keyword,\n sort_type,\n publish_time,\n } as Parameters<typeof c.tiktok.searchVideos>[0]),\n \"aweme_list\",\n max,\n ),\n });\n}\n\n/** Instagram user search. */\nexport function scavioInstagramSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Instagram for users by keyword via the Scavio API (2 credits). Users come back under `data.users`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n }),\n execute: async ({ keyword }) => trimData(await c.instagram.searchUsers({ keyword }), \"users\", max),\n });\n}\n\n// ---------------------------------------------------------------------------\n// Website map, crawl and batch: the multi-page members of the Extract family.\n//\n// Map answers in one call. Crawl and batch are background jobs: the start tools\n// post the job, then wait up to wait_seconds (default 45, max 300) for it to\n// finish, polling progress without page content, and return the job's status\n// with its first page of results either way. A job still running when the wait\n// ends keeps going server-side; read the rest with the matching status tool.\n// ---------------------------------------------------------------------------\n\nconst JOB_POLL_INTERVAL_MS = 3_000;\nconst JOB_WAIT_DEFAULT_SECONDS = 45;\nconst JOB_WAIT_MAX_SECONDS = 300;\nconst JOB_RESULTS_DEFAULT_LIMIT = 10;\nconst JOB_TERMINAL = new Set([\"completed\", \"failed\", \"cancelled\"]);\n\ntype JobQuery = {\n cursor?: string;\n limit?: number;\n status?: \"succeeded\" | \"failed\" | \"skipped\";\n include_content?: boolean;\n};\ntype JobPayload = { data?: { id?: string; status?: string } } & Record<string, unknown>;\ntype JobStatusFn = (id: string, query: JobQuery) => Promise<unknown>;\n\n// lib is ES2022 only (no DOM or Node types); every runtime this targets has setTimeout.\ndeclare const setTimeout: (callback: () => void, ms: number) => unknown;\n\nconst sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(() => resolve(), ms));\n\n/** Poll a job (content-free) until it finishes or the wait runs out, then read one results page. */\nasync function waitForJob(\n status: JobStatusFn,\n id: string,\n waitSeconds: number,\n pollMs: number,\n query: JobQuery,\n): Promise<Record<string, unknown>> {\n const deadline = Date.now() + Math.max(0, Math.min(waitSeconds, JOB_WAIT_MAX_SECONDS)) * 1000;\n for (;;) {\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await sleep(Math.min(pollMs, remaining));\n const probe = (await status(id, { limit: 1, include_content: false })) as JobPayload;\n if (JOB_TERMINAL.has(String(probe?.data?.status))) break;\n }\n return (await status(id, query)) as Record<string, unknown>;\n}\n\n/** Start a job, then wait for it (bounded). wait_seconds 0 returns the 202 payload. */\nasync function startAndWait(\n start: () => Promise<unknown>,\n status: JobStatusFn,\n input: { wait_seconds?: number; limit?: number; include_content?: boolean },\n pollMs: number,\n): Promise<Record<string, unknown>> {\n const created = (await start()) as JobPayload;\n const id = created?.data?.id;\n const wait = input.wait_seconds ?? JOB_WAIT_DEFAULT_SECONDS;\n if (!id || wait <= 0) return created;\n const query: JobQuery = { limit: input.limit ?? JOB_RESULTS_DEFAULT_LIMIT };\n if (input.include_content !== undefined) query.include_content = input.include_content;\n return waitForJob(status, id, wait, pollMs, query);\n}\n\nconst MODE_DESCRIPTION =\n \"Fetch tier, and the parameter that sets the price: 'normal' (default) is the standard fetch, 'advanced' renders JavaScript-built pages, 'ultra' reaches the hardest pages.\";\nconst PATHS_DESCRIPTION =\n \"Path globs (max 20). '*' matches within one path segment, '**' across segments; a pattern without wildcards matches that path and everything under it. Example: ['/blog/**'].\";\nconst JOB_PRICE =\n \"Billed per SUCCESSFUL page at Extract's price for the mode: 'normal' and 'advanced' 1 credit, 'ultra' 2. Failed and skipped pages are free, and if the balance runs out the job stops cleanly.\";\n\nconst jobFields = {\n format: z.enum([\"html\", \"markdown\", \"text\"]).optional().describe(\"Format for each page, as on extract (default 'markdown').\"),\n mode: z.enum([\"normal\", \"advanced\", \"ultra\"]).optional().describe(MODE_DESCRIPTION),\n wait_seconds: z\n .number()\n .int()\n .min(0)\n .max(JOB_WAIT_MAX_SECONDS)\n .optional()\n .describe(\"Seconds to wait for the job to finish before returning, 0-300 (default 45). 0 returns the job id at once. A job still running when the wait ends keeps going; read it later with its status tool.\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\"Results per response, 1-100 (default 10, to keep page content inside the context window); page on with next_cursor.\"),\n include_content: z.boolean().optional().describe(\"Set false to list results without their page content (default true).\"),\n};\n\nconst jobStatusSchema = z.object({\n id: z.string().describe(\"Job id returned when the job was started (data.id).\"),\n cursor: z.string().optional().describe(\"next_cursor from the previous response, to read the next page.\"),\n limit: jobFields.limit,\n status: z.enum([\"succeeded\", \"failed\", \"skipped\"]).optional().describe(\"Only results with this status.\"),\n include_content: jobFields.include_content,\n});\n\n/** Map a website's URLs (/api/v1/extract/map). 1 credit on 'normal'. */\nexport function scavioMapWebsite(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"List a website's page URLs via the Scavio API, gathered from its sitemaps and its start page, deduplicated, filtered by path or search words and limited: `data.links` [{ url, source, lastmod }], `data.total_found`, `data.truncated`. Pages the site's robots.txt disallows are left out. Use it to find the right pages before extracting or crawling. Costs 1 credit on 'normal'; up to 2 on 'advanced' and up to 10 on 'ultra', priced by what the call needed.\",\n inputSchema: z.object({\n url: z.string().describe(\"The site to map. A bare host is upgraded to https.\"),\n search: z.string().optional().describe(\"Only return URLs containing every word of this text (case-insensitive).\"),\n limit: z.number().int().min(1).max(5000).optional().describe(\"Maximum links to return, 1-5000. Default 1000 (or the plan's limit if lower: Free 500, PAYG 1,000, paid plans 5,000).\"),\n sitemap: z.enum([\"include\", \"only\", \"skip\"]).optional().describe(\"'include' combines the site's sitemaps with the start page's links (default); 'only' uses sitemaps alone; 'skip' uses page links alone.\"),\n include_subdomains: z.boolean().optional().describe(\"Also return URLs on subdomains of the site (default false).\"),\n include_paths: z.array(z.string()).optional().describe(\"Keep only URLs matching these. \" + PATHS_DESCRIPTION),\n exclude_paths: z.array(z.string()).optional().describe(\"Drop URLs matching these. \" + PATHS_DESCRIPTION),\n ignore_query_parameters: z.boolean().optional().describe(\"Treat URLs that differ only by query string as one URL (default true).\"),\n mode: jobFields.mode,\n }),\n execute: async (input) =>\n (await c.extract.map(input as Parameters<typeof c.extract.map>[0])) as unknown as Record<string, unknown>,\n });\n}\n\n/** Crawl a website (/api/v1/extract/crawl), then wait (bounded) for it. */\nexport function scavioCrawlWebsite(config?: ScavioToolConfig) {\n const c = client(config);\n const pollMs = config?.pollIntervalMs ?? JOB_POLL_INTERVAL_MS;\n return tool({\n description:\n \"Crawl a website from one start URL via the Scavio API: same-site pages are discovered and extracted breadth-first within the page, depth and path limits, each returned as Markdown, text or HTML. Pages the site's robots.txt disallows are skipped. Waits up to wait_seconds (default 45) and returns `data` { id, status, pages, credits_used, results, next_cursor }; if status is still queued or running, call scavio_crawl_status with the id later. \" +\n JOB_PRICE,\n inputSchema: z.object({\n url: z.string().describe(\"Where the crawl starts. Only pages on the same site are crawled.\"),\n max_pages: z.number().int().min(1).max(10000).optional().describe(\"Maximum pages to fetch. Default 100. Plan limits: Free 10, PAYG 100, Project 500, Bootstrap 2,000, Startup 5,000, Growth 10,000.\"),\n max_depth: z.number().int().min(0).max(10).optional().describe(\"How many links away from the start page to follow, 0-10 (default 3). 0 fetches only the start page.\"),\n include_paths: z.array(z.string()).optional().describe(\"Crawl only paths matching these. \" + PATHS_DESCRIPTION),\n exclude_paths: z.array(z.string()).optional().describe(\"Skip paths matching these. \" + PATHS_DESCRIPTION),\n allow_subdomains: z.boolean().optional().describe(\"Also crawl subdomains of the site (default false).\"),\n ignore_query_parameters: z.boolean().optional().describe(\"Treat URLs that differ only by query string as one page (default true).\"),\n sitemap: z.enum([\"include\", \"skip\", \"only\"]).optional().describe(\"'include' also starts from the site's sitemap (default); 'skip' follows links only; 'only' fetches sitemap pages without following links.\"),\n ...jobFields,\n }),\n execute: async (input) => {\n const { wait_seconds, limit, include_content, ...body } = input;\n return startAndWait(\n () => c.extract.crawl(body as Parameters<typeof c.extract.crawl>[0]),\n (id, q) => c.extract.crawlStatus(id, q),\n { wait_seconds, limit, include_content },\n pollMs,\n );\n },\n });\n}\n\n/** A crawl's progress and page results (GET /api/v1/extract/crawl/{id}). Free. */\nexport function scavioCrawlStatus(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read a crawl's progress and its page results by job id via the Scavio API, paged by cursor: `data` { status, stopped_reason, pages, credits_used, results: [{ url, status, content }], next_cursor }. Results are kept for 3 days after the crawl finishes. Free: reading a job costs 0 credits.\",\n inputSchema: jobStatusSchema,\n execute: async ({ id, limit, ...q }) =>\n (await c.extract.crawlStatus(id, { ...q, limit: limit ?? JOB_RESULTS_DEFAULT_LIMIT })) as unknown as Record<string, unknown>,\n });\n}\n\n/** Extract a list of URLs in one job (/api/v1/extract/batch), then wait (bounded). */\nexport function scavioBatchExtract(config?: ScavioToolConfig) {\n const c = client(config);\n const pollMs = config?.pollIntervalMs ?? JOB_POLL_INTERVAL_MS;\n return tool({\n description:\n \"Extract a list of URLs (up to 1,000, plan-limited) in one job via the Scavio API, each returned as Markdown, text or HTML exactly like scavio_extract. Waits up to wait_seconds (default 45) and returns `data` { id, status, pages, credits_used, results, next_cursor }; if status is still queued or running, call scavio_batch_status with the id later. \" +\n JOB_PRICE,\n inputSchema: z.object({\n urls: z.array(z.string()).min(1).max(1000).describe(\"The pages to extract (duplicates removed). Plan limits: Free 10, PAYG 50, Project 100, Bootstrap 500, Startup and Growth 1,000.\"),\n ...jobFields,\n }),\n execute: async (input) => {\n const { wait_seconds, limit, include_content, ...body } = input;\n return startAndWait(\n () => c.extract.batch(body as Parameters<typeof c.extract.batch>[0]),\n (id, q) => c.extract.batchStatus(id, q),\n { wait_seconds, limit, include_content },\n pollMs,\n );\n },\n });\n}\n\n/** A batch's progress and page results (GET /api/v1/extract/batch/{id}). Free. */\nexport function scavioBatchStatus(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read a batch extract's progress and its page results by job id via the Scavio API, paged by cursor: `data` { status, pages, credits_used, results: [{ url, status, content }], next_cursor }. Results are kept for 3 days after the batch finishes. Free: reading a job costs 0 credits.\",\n inputSchema: jobStatusSchema,\n execute: async ({ id, limit, ...q }) =>\n (await c.extract.batchStatus(id, { ...q, limit: limit ?? JOB_RESULTS_DEFAULT_LIMIT })) as unknown as Record<string, unknown>,\n });\n}\n\n/**\n * All Scavio tools as an object keyed by tool name, ready to spread into the\n * `tools` option of `generateText` / `streamText`.\n */\nexport function scavioTools(config?: ScavioToolConfig) {\n return {\n scavio_extract: scavioExtract(config),\n scavio_search: scavioSearch(config),\n scavio_youtube_search: scavioYoutubeSearch(config),\n scavio_youtube_video: scavioYoutubeVideo(config),\n scavio_youtube_transcript: scavioYoutubeTranscript(config),\n scavio_youtube_comments: scavioYoutubeComments(config),\n scavio_youtube_channel: scavioYoutubeChannel(config),\n scavio_reddit_search: scavioRedditSearch(config),\n scavio_amazon_search: scavioAmazonSearch(config),\n scavio_amazon_offers: scavioAmazonOffers(config),\n scavio_walmart_search: scavioWalmartSearch(config),\n scavio_tiktok_search: scavioTiktokSearch(config),\n scavio_instagram_search: scavioInstagramSearch(config),\n ...(config?.enableCrawl\n ? {\n scavio_map_website: scavioMapWebsite(config),\n scavio_crawl_website: scavioCrawlWebsite(config),\n scavio_crawl_status: scavioCrawlStatus(config),\n scavio_batch_extract: scavioBatchExtract(config),\n scavio_batch_status: scavioBatchStatus(config),\n }\n : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,iBAAkB;AAClB,oBAAoE;AAmBpE,SAAS,OAAO,QAAmC;AACjD,SAAO,IAAI,qBAAO,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAC9C;AAMA,SAAS,SAAS,KAA8B,KAAa,KAAsC;AACjG,QAAM,OAAO,IAAI,GAAG;AACpB,MAAI,MAAM,QAA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B,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,yBAAyB,sBAAsB,MAAM;AAAA,IACrD,GAAI,QAAQ,cACR;AAAA,MACE,oBAAoB,iBAAiB,MAAM;AAAA,MAC3C,sBAAsB,mBAAmB,MAAM;AAAA,MAC/C,qBAAqB,kBAAkB,MAAM;AAAA,MAC7C,sBAAsB,mBAAmB,MAAM;AAAA,MAC/C,qBAAqB,kBAAkB,MAAM;AAAA,IAC/C,IACA,CAAC;AAAA,EACP;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { tool } from \"ai\";\nimport { z } from \"zod\";\nimport { Scavio, type ScavioConfig, type GoogleSearchOptions } from \"scavio\";\n\nexport interface ScavioToolConfig extends ScavioConfig {\n /**\n * Max number of items to keep in the tool's result list. Defaults to 10.\n * Trimmed inside `data` on every platform except Google, whose body is flat.\n * Ignored by `scavioExtract`, which returns page content rather than a list.\n */\n maxResults?: number;\n /**\n * Add the five website tools (map, crawl, crawl status, batch extract, batch\n * status) to `scavioTools()`. Off by default: a crawl bills per page. The\n * individual factories (`scavioCrawlWebsite` and friends) work regardless.\n */\n enableCrawl?: boolean;\n /** Milliseconds between progress polls while a crawl or batch tool waits. Default 3000. */\n pollIntervalMs?: number;\n}\n\nfunction client(config?: ScavioToolConfig): Scavio {\n return new Scavio({ apiKey: config?.apiKey });\n}\n\n/**\n * Google is the ONLY family with a flat body: `organic_results` and friends sit\n * at the top level, next to `response_time` / `credits_used` / `credits_remaining`.\n */\nfunction trimFlat(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const list = res[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, [key]: list.slice(0, max) };\n }\n return res;\n}\n\n/**\n * Every non-Google endpoint nests its payload under `data` - the response is\n * `{ data: { products: [...] }, response_time, credits_used, credits_remaining }`.\n * Trimming the top level is therefore a silent no-op, so those tools trim\n * inside `data`.\n */\nfunction trimData(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const data = res.data;\n if (!data || typeof data !== \"object\") return res;\n const list = (data as Record<string, unknown>)[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, data: { ...(data as Record<string, unknown>), [key]: list.slice(0, max) } };\n }\n return res;\n}\n\n/**\n * Read any URL (/api/v1/extract).\n *\n * The one tool here that is not tied to a platform, and the only one `maxResults`\n * does not touch: extract returns page CONTENT, not a result list, so there is\n * nothing to trim and the body is returned whole. `extract` is a TOP-LEVEL\n * method on the SDK client - `c.extract({ url })`, never `c.extract.extract()`.\n *\n * Credits are a function of `mode`, not a per-call constant: \"normal\" 1,\n * \"advanced\" 1, \"ultra\" 2. Only a successful read is billed.\n */\nexport function scavioExtract(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read any web page via the Scavio API and get it back as clean Markdown (default), plain text, or raw HTML. Use it on any URL, including one returned by the search tools. Returns `data.content` alongside `data.url`, `data.format`, `data.mode` and `data.content_length`. Cost depends on `mode`: 1 credit on 'normal' and 'advanced', 2 on 'ultra'; a dead link, bot wall or timeout is not billed.\",\n inputSchema: z.object({\n url: z\n .string()\n .describe(\n \"The page to read (1-2048 characters). http(s) only; a bare host is upgraded to https, and loopback, private, link-local and metadata hosts are rejected.\",\n ),\n format: z\n .enum([\"html\", \"markdown\", \"text\"])\n .optional()\n .describe(\n \"Output format (default 'markdown'): 'markdown' is a readability extraction with page chrome stripped, 'text' is that flattened to plain text, 'html' is the raw page.\",\n ),\n mode: z\n .enum([\"normal\", \"advanced\", \"ultra\"])\n .optional()\n .describe(\n \"Fetch tier, and the parameter that sets the price: 'normal' (default) is a plain fetch and costs 1 credit, 'advanced' renders JavaScript-built pages and costs 1, 'ultra' reaches the hardest pages and costs 2. Start on 'normal'.\",\n ),\n }),\n execute: async ({ url, format, mode }) => c.extract({ url, format, mode }),\n });\n}\n\n/** Google web search (/api/v2/google, 1 credit). */\nexport function scavioSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search the web with Google via the Scavio API (1 credit). Returns real-time organic search results, each with a title, link, and snippet, under `organic_results`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n countryCode: z.string().optional().describe('Two-letter country code to localize results, e.g. \"us\".'),\n language: z.string().optional().describe('Two-letter UI language code, e.g. \"en\".'),\n page: z.number().int().optional().describe(\"1-based result page; page 2 starts at result 10.\"),\n device: z.enum([\"desktop\", \"mobile\"]).optional().describe(\"Device to emulate.\"),\n nfpr: z.boolean().optional().describe(\"Disable spelling auto-correction / similar-result substitution when true.\"),\n }),\n execute: async ({ query, countryCode, language, page, device, nfpr }) => {\n const params: GoogleSearchOptions = { query };\n if (countryCode) params.gl = countryCode;\n if (language) params.hl = language;\n if (page && page > 1) params.start = (page - 1) * 10;\n if (device) params.device = device;\n if (nfpr !== undefined) params.nfpr = nfpr;\n return trimFlat(await c.google.search(params), \"organic_results\", max);\n },\n });\n}\n\n/** YouTube video search (2 credits). */\nexport function scavioYoutubeSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search YouTube for videos, channels, or playlists via the Scavio API (2 credits). Videos come back under `data.results`, with `data.channels` and `data.playlists` alongside.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n upload_date: z.string().optional().describe(\"Upload date filter, e.g. 'today', 'this_week', 'this_month'.\"),\n type: z.string().optional().describe(\"Result type: 'video', 'channel', 'playlist', 'movie'.\"),\n duration: z.string().optional().describe(\"Duration filter: 'short', 'medium', 'long'.\"),\n sort_by: z.string().optional().describe(\"Sort order: 'relevance', 'date', 'view_count', 'rating'.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, upload_date, type, duration, sort_by, cursor }) =>\n trimData(\n await c.youtube.search({ query, upload_date, type, duration, sort_by, cursor } as Parameters<\n typeof c.youtube.search\n >[0]),\n \"results\",\n max,\n ),\n });\n}\n\n/** YouTube video details (1 credit). */\nexport function scavioYoutubeVideo(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch full details for a YouTube video (title, author, view count, description, captions, chapters) via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n }),\n execute: async ({ video_id }) => c.youtube.video({ video_id }),\n });\n}\n\n/** YouTube video transcript / subtitles (5 credits). */\nexport function scavioYoutubeTranscript(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube video's transcript or timed subtitles via the Scavio API (5 credits).\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n language: z.string().optional().describe(\"Transcript language code (default 'en').\"),\n format: z.enum([\"text\", \"srt\"]).optional().describe(\"'text' for a plain transcript, 'srt' for timed subtitles.\"),\n }),\n execute: async ({ video_id, language, format }) =>\n c.youtube.transcript({ video_id, language, format } as Parameters<typeof c.youtube.transcript>[0]),\n });\n}\n\n/** YouTube video comments (1 credit). */\nexport function scavioYoutubeComments(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"List comments on a YouTube video via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n cursor: z.string().optional().describe(\"Pagination cursor.\"),\n }),\n execute: async ({ video_id, cursor }) =>\n trimData(\n await c.youtube.comments({ video_id, cursor } as Parameters<typeof c.youtube.comments>[0]),\n \"comments\",\n max,\n ),\n });\n}\n\n/** YouTube channel details (1 credit). */\nexport function scavioYoutubeChannel(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube channel's details (subscribers, video count, views, links) via the Scavio API.\",\n inputSchema: z.object({\n channel_id: z.string().describe(\"YouTube channel id, @handle, or channel URL.\"),\n }),\n execute: async ({ channel_id }) => c.youtube.channel({ channel_id }),\n });\n}\n\n/**\n * Reddit post search (1 credit).\n *\n * The endpoint takes `query` and `cursor` and nothing else - it cannot sort or\n * filter by type, so no such input is offered. The API silently ignores those\n * params, which would leave a model believing it had filtered when it had not.\n */\nexport function scavioRedditSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Reddit posts via the Scavio API (1 credit). Returns matching posts under `data.results` with `data.next_cursor` for the next page. Results cannot be sorted or filtered by type.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, cursor }) => trimData(await c.reddit.search({ query, cursor }), \"results\", max),\n });\n}\n\n/**\n * Amazon product search.\n *\n * `domain` was dropped in favour of `country`, a two-letter marketplace code -\n * the Amazon endpoint changed in 2026-07 and no longer takes a domain\n * suffix. It still works on the wire as a deprecated alias, but a model should\n * only ever see one spelling of a param.\n */\nexport function scavioAmazonSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Amazon for products via the Scavio API. Results are unsorted and cannot be filtered by category, merchant or price.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ query, country }) =>\n trimData(await c.amazon.search({ query, country }), \"products\", max),\n });\n}\n\n/** Every seller offer for one Amazon ASIN. */\nexport function scavioAmazonOffers(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"List every seller offer for one Amazon ASIN via the Scavio API: price, seller, condition, shipping, and which offer holds the buy box. Page 1 only.\",\n inputSchema: z.object({\n asin: z.string().describe(\"Amazon Standard Identification Number (ASIN) of the product.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ asin, country }) =>\n trimData(await c.amazon.offers({ asin, country }), \"offers\", max),\n });\n}\n\n/** Walmart product search. */\nexport function scavioWalmartSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Walmart for products via the Scavio API. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n }),\n execute: async ({ query }) => trimData(await c.walmart.search({ query }), \"products\", max),\n });\n}\n\n/** TikTok video search. */\nexport function scavioTiktokSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search TikTok for videos by keyword via the Scavio API. Videos come back under `data.aweme_list`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n sort_type: z.enum([\"0\", \"1\"]).optional().describe(\"Sort order: '0' relevance, '1' most likes.\"),\n publish_time: z\n .enum([\"0\", \"1\", \"7\", \"30\", \"90\", \"180\"])\n .optional()\n .describe(\"Publish window in days: '0' all time, '1', '7', '30', '90', '180'.\"),\n }),\n execute: async ({ keyword, sort_type, publish_time }) =>\n trimData(\n await c.tiktok.searchVideos({\n keyword,\n sort_type,\n publish_time,\n } as Parameters<typeof c.tiktok.searchVideos>[0]),\n \"aweme_list\",\n max,\n ),\n });\n}\n\n/** Instagram user search. */\nexport function scavioInstagramSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Instagram for users by keyword via the Scavio API (2 credits). Users come back under `data.users`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n }),\n execute: async ({ keyword }) => trimData(await c.instagram.searchUsers({ keyword }), \"users\", max),\n });\n}\n\n// ---------------------------------------------------------------------------\n// Website map, crawl and batch: the multi-page members of the Extract family.\n//\n// Map answers in one call. Crawl and batch are background jobs: the start tools\n// post the job, then wait up to wait_seconds (default 45, max 300) for it to\n// finish, polling progress without page content, and return the job's status\n// with its first page of results either way. A job still running when the wait\n// ends keeps going server-side; read the rest with the matching status tool.\n// ---------------------------------------------------------------------------\n\nconst JOB_POLL_INTERVAL_MS = 3_000;\nconst JOB_WAIT_DEFAULT_SECONDS = 45;\nconst JOB_WAIT_MAX_SECONDS = 300;\nconst JOB_RESULTS_DEFAULT_LIMIT = 10;\nconst JOB_TERMINAL = new Set([\"completed\", \"failed\", \"cancelled\"]);\n\ntype JobQuery = {\n cursor?: string;\n limit?: number;\n status?: \"succeeded\" | \"failed\" | \"skipped\";\n include_content?: boolean;\n};\ntype JobPayload = { data?: { id?: string; status?: string } } & Record<string, unknown>;\ntype JobStatusFn = (id: string, query: JobQuery) => Promise<unknown>;\n\n// lib is ES2022 only (no DOM or Node types); every runtime this targets has setTimeout.\ndeclare const setTimeout: (callback: () => void, ms: number) => unknown;\n\nconst sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(() => resolve(), ms));\n\n/** Poll a job (content-free) until it finishes or the wait runs out, then read one results page. */\nasync function waitForJob(\n status: JobStatusFn,\n id: string,\n waitSeconds: number,\n pollMs: number,\n query: JobQuery,\n): Promise<Record<string, unknown>> {\n const deadline = Date.now() + Math.max(0, Math.min(waitSeconds, JOB_WAIT_MAX_SECONDS)) * 1000;\n for (;;) {\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await sleep(Math.min(pollMs, remaining));\n const probe = (await status(id, { limit: 1, include_content: false })) as JobPayload;\n if (JOB_TERMINAL.has(String(probe?.data?.status))) break;\n }\n return (await status(id, query)) as Record<string, unknown>;\n}\n\n/** Start a job, then wait for it (bounded). wait_seconds 0 returns the 202 payload. */\nasync function startAndWait(\n start: () => Promise<unknown>,\n status: JobStatusFn,\n input: { wait_seconds?: number; limit?: number; include_content?: boolean },\n pollMs: number,\n): Promise<Record<string, unknown>> {\n const created = (await start()) as JobPayload;\n const id = created?.data?.id;\n const wait = input.wait_seconds ?? JOB_WAIT_DEFAULT_SECONDS;\n if (!id || wait <= 0) return created;\n const query: JobQuery = { limit: input.limit ?? JOB_RESULTS_DEFAULT_LIMIT };\n if (input.include_content !== undefined) query.include_content = input.include_content;\n return waitForJob(status, id, wait, pollMs, query);\n}\n\nconst MODE_DESCRIPTION =\n \"Fetch tier, and the parameter that sets the price: 'normal' (default) is the standard fetch, 'advanced' renders JavaScript-built pages, 'ultra' reaches the hardest pages.\";\nconst PATHS_DESCRIPTION =\n \"Path globs (max 20). '*' matches within one path segment, '**' across segments; a pattern without wildcards matches that path and everything under it. Example: ['/blog/**'].\";\nconst JOB_PRICE =\n \"Billed per SUCCESSFUL page at Extract's price for the mode: 'normal' and 'advanced' 1 credit, 'ultra' 2. Failed and skipped pages are free, and if the balance runs out the job stops cleanly.\";\n\nconst jobFields = {\n format: z.enum([\"html\", \"markdown\", \"text\"]).optional().describe(\"Format for each page, as on extract (default 'markdown').\"),\n mode: z.enum([\"normal\", \"advanced\", \"ultra\"]).optional().describe(MODE_DESCRIPTION),\n wait_seconds: z\n .number()\n .int()\n .min(0)\n .max(JOB_WAIT_MAX_SECONDS)\n .optional()\n .describe(\"Seconds to wait for the job to finish before returning, 0-300 (default 45). 0 returns the job id at once. A job still running when the wait ends keeps going; read it later with its status tool.\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\"Results per response, 1-100 (default 10, to keep page content inside the context window); page on with next_cursor.\"),\n include_content: z.boolean().optional().describe(\"Set false to list results without their page content (default true).\"),\n};\n\nconst jobStatusSchema = z.object({\n id: z.string().describe(\"Job id returned when the job was started (data.id).\"),\n cursor: z.string().optional().describe(\"next_cursor from the previous response, to read the next page.\"),\n limit: jobFields.limit,\n status: z.enum([\"succeeded\", \"failed\", \"skipped\"]).optional().describe(\"Only results with this status.\"),\n include_content: jobFields.include_content,\n});\n\n/** Map a website's URLs (/api/v1/extract/map). 1 credit on 'normal'. */\nexport function scavioMapWebsite(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"List a website's page URLs via the Scavio API, gathered from its sitemaps and its start page, deduplicated, filtered by path or search words and limited: `data.links` [{ url, source, lastmod }], `data.total_found`, `data.truncated`. Pages the site's robots.txt disallows are left out. Use it to find the right pages before extracting or crawling. Costs 1 credit on 'normal'; up to 2 on 'advanced' and up to 10 on 'ultra', priced by what the call needed.\",\n inputSchema: z.object({\n url: z.string().describe(\"The site to map. A bare host is upgraded to https.\"),\n search: z.string().optional().describe(\"Only return URLs containing every word of this text (case-insensitive).\"),\n limit: z.number().int().min(1).max(5000).optional().describe(\"Maximum links to return, 1-5000. Default 1000 (or the plan's limit if lower: Free 500, PAYG 1,000, paid plans 5,000).\"),\n sitemap: z.enum([\"include\", \"only\", \"skip\"]).optional().describe(\"'include' combines the site's sitemaps with the start page's links (default); 'only' uses sitemaps alone; 'skip' uses page links alone.\"),\n include_subdomains: z.boolean().optional().describe(\"Also return URLs on subdomains of the site (default false).\"),\n include_paths: z.array(z.string()).optional().describe(\"Keep only URLs matching these. \" + PATHS_DESCRIPTION),\n exclude_paths: z.array(z.string()).optional().describe(\"Drop URLs matching these. \" + PATHS_DESCRIPTION),\n ignore_query_parameters: z.boolean().optional().describe(\"Treat URLs that differ only by query string as one URL (default true).\"),\n mode: jobFields.mode,\n }),\n execute: async (input) =>\n (await c.extract.map(input as Parameters<typeof c.extract.map>[0])) as unknown as Record<string, unknown>,\n });\n}\n\n/** Crawl a website (/api/v1/extract/crawl), then wait (bounded) for it. */\nexport function scavioCrawlWebsite(config?: ScavioToolConfig) {\n const c = client(config);\n const pollMs = config?.pollIntervalMs ?? JOB_POLL_INTERVAL_MS;\n return tool({\n description:\n \"Crawl a website from one start URL via the Scavio API: same-site pages are discovered and extracted breadth-first within the page, depth and path limits, each returned as Markdown, text or HTML. Pages the site's robots.txt disallows are skipped. Waits up to wait_seconds (default 45) and returns `data` { id, status, pages, credits_used, results, next_cursor }; if status is still queued or running, call scavio_crawl_status with the id later. \" +\n JOB_PRICE,\n inputSchema: z.object({\n url: z.string().describe(\"Where the crawl starts. Only pages on the same site are crawled.\"),\n max_pages: z.number().int().min(1).max(10000).optional().describe(\"Maximum pages to fetch. Default 100. Plan limits: Free 10, PAYG 100, Project 500, Bootstrap 2,000, Startup 5,000, Growth 10,000.\"),\n max_depth: z.number().int().min(0).max(10).optional().describe(\"How many links away from the start page to follow, 0-10 (default 3). 0 fetches only the start page.\"),\n include_paths: z.array(z.string()).optional().describe(\"Crawl only paths matching these. \" + PATHS_DESCRIPTION),\n exclude_paths: z.array(z.string()).optional().describe(\"Skip paths matching these. \" + PATHS_DESCRIPTION),\n allow_subdomains: z.boolean().optional().describe(\"Also crawl subdomains of the site (default false).\"),\n ignore_query_parameters: z.boolean().optional().describe(\"Treat URLs that differ only by query string as one page (default true).\"),\n sitemap: z.enum([\"include\", \"skip\", \"only\"]).optional().describe(\"'include' also starts from the site's sitemap (default); 'skip' follows links only; 'only' fetches sitemap pages without following links.\"),\n ...jobFields,\n }),\n execute: async (input) => {\n const { wait_seconds, limit, include_content, ...body } = input;\n return startAndWait(\n () => c.extract.crawl(body as Parameters<typeof c.extract.crawl>[0]),\n (id, q) => c.extract.crawlStatus(id, q),\n { wait_seconds, limit, include_content },\n pollMs,\n );\n },\n });\n}\n\n/** A crawl's progress and page results (GET /api/v1/extract/crawl/{id}). Free. */\nexport function scavioCrawlStatus(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read a crawl's progress and its page results by job id via the Scavio API, paged by cursor: `data` { status, stopped_reason, pages, credits_used, results: [{ url, status, content }], next_cursor }. Results are kept for 3 days after the crawl finishes. Free: reading a job costs 0 credits.\",\n inputSchema: jobStatusSchema,\n execute: async ({ id, limit, ...q }) =>\n (await c.extract.crawlStatus(id, { ...q, limit: limit ?? JOB_RESULTS_DEFAULT_LIMIT })) as unknown as Record<string, unknown>,\n });\n}\n\n/** Extract a list of URLs in one job (/api/v1/extract/batch), then wait (bounded). */\nexport function scavioBatchExtract(config?: ScavioToolConfig) {\n const c = client(config);\n const pollMs = config?.pollIntervalMs ?? JOB_POLL_INTERVAL_MS;\n return tool({\n description:\n \"Extract a list of URLs (up to 1,000, plan-limited) in one job via the Scavio API, each returned as Markdown, text or HTML exactly like scavio_extract. Waits up to wait_seconds (default 45) and returns `data` { id, status, pages, credits_used, results, next_cursor }; if status is still queued or running, call scavio_batch_status with the id later. \" +\n JOB_PRICE,\n inputSchema: z.object({\n urls: z.array(z.string()).min(1).max(1000).describe(\"The pages to extract (duplicates removed). Plan limits: Free 10, PAYG 50, Project 100, Bootstrap 500, Startup and Growth 1,000.\"),\n ...jobFields,\n }),\n execute: async (input) => {\n const { wait_seconds, limit, include_content, ...body } = input;\n return startAndWait(\n () => c.extract.batch(body as Parameters<typeof c.extract.batch>[0]),\n (id, q) => c.extract.batchStatus(id, q),\n { wait_seconds, limit, include_content },\n pollMs,\n );\n },\n });\n}\n\n/** A batch's progress and page results (GET /api/v1/extract/batch/{id}). Free. */\nexport function scavioBatchStatus(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read a batch extract's progress and its page results by job id via the Scavio API, paged by cursor: `data` { status, pages, credits_used, results: [{ url, status, content }], next_cursor }. Results are kept for 3 days after the batch finishes. Free: reading a job costs 0 credits.\",\n inputSchema: jobStatusSchema,\n execute: async ({ id, limit, ...q }) =>\n (await c.extract.batchStatus(id, { ...q, limit: limit ?? JOB_RESULTS_DEFAULT_LIMIT })) as unknown as Record<string, unknown>,\n });\n}\n\n/** HEB grocery product search. */\nexport function scavioHebSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search HEB grocery products via the Scavio API: price, sale status, unit price, UPC, stock, EBT/SNAP eligibility. Pass store_id for one store's prices, stock and assortment. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"Search keywords (1-200 characters).\"),\n page: z.number().optional().describe(\"Results page, 1-based.\"),\n page_size: z.number().optional().describe(\"Results per page, 1-60. Defaults to 60.\"),\n store_id: z.string().optional().describe(\"HEB store number from the HEB stores tool (store_number), e.g. '441'. Prices, stock, aisle location and assortment come from that store; the store used is echoed in data.store {store_id, name}. US only. Omit for HEB's default store.\"),\n }),\n execute: async (input) => trimData(await c.heb.search(input), \"products\", max),\n });\n}\n\n/** HEB product detail. */\nexport function scavioHebProduct(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description: \"Full HEB product detail via the Scavio API: nutrition, ingredients, images, coupons, EBT/SNAP eligibility. With store_id, price, stock and aisle are for that store and product_id alone works.\",\n inputSchema: z.object({\n product_url: z.string().optional().describe(\"Full or relative product URL from heb.com. Preferred.\"),\n product_id: z.string().optional().describe(\"HEB product id. Needs slug, unless store_id is set (then product_id alone works).\"),\n slug: z.string().optional().describe(\"Product slug. Required with product_id unless store_id is set.\"),\n store_id: z.string().optional().describe(\"HEB store number from the HEB stores tool (store_number), e.g. '441'. Prices, stock, aisle location and assortment come from that store; the store used is echoed in data.store {store_id, name}. US only. Omit for HEB's default store.\"),\n }),\n execute: async (input) => (await c.heb.product(input)) as Record<string, unknown>,\n });\n}\n\n/** HEB store locator. */\nexport function scavioHebStores(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Find HEB stores near a ZIP code or city via the Scavio API. Stores come back under `data.stores`.\",\n inputSchema: z.object({\n zip: z.string().optional().describe(\"5-digit US ZIP code.\"),\n city: z.string().optional().describe(\"City name. Pass zip or city.\"),\n }),\n execute: async (input) => trimData(await c.heb.stores(input), \"stores\", max),\n });\n}\n\n/** Kroger grocery product search. */\nexport function scavioKrogerSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Kroger grocery products via the Scavio API: price, promo deals, UPC, stock, SNAP eligibility, dietary info. Kroger operates Kroger, Ralphs, Fred Meyer, Harris Teeter, King Soopers and Fry's. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"Search keywords (1-200 characters).\"),\n page: z.number().optional().describe(\"Results page, 1-based.\"),\n }),\n execute: async (input) => trimData(await c.kroger.search(input), \"products\", max),\n });\n}\n\n/** Kroger product detail. */\nexport function scavioKrogerProduct(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description: \"Full Kroger product detail via the Scavio API: nutrition, allergens, ingredients, images, rating, dietary flags, SNAP eligibility.\",\n inputSchema: z.object({\n product_url: z.string().optional().describe(\"Full or relative product URL from kroger.com. Preferred.\"),\n upc: z.string().optional().describe(\"Kroger product UPC.\"),\n slug: z.string().optional().describe(\"Product slug. Optional with upc.\"),\n }),\n execute: async (input) => (await c.kroger.product(input)) as Record<string, unknown>,\n });\n}\n\n/** Decathlon product search across 7 country domains. */\nexport function scavioDecathlonSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Decathlon products by keyword via the Scavio API across 7 country domains (FR, ES, IT, IN, UK, PT, NET). Returns product name, brand, price (cents), currency, availability, rating, review count and image. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"Search keywords (1-200 characters).\"),\n country: z.enum([\"fr\", \"es\", \"it\", \"in\", \"uk\", \"pt\", \"net\"]).describe(\"Country domain.\"),\n page: z.number().optional().describe(\"Results page, 1-based (1-50).\"),\n }),\n execute: async (input) => trimData(await c.decathlon.search(input), \"products\", max),\n });\n}\n\n/** Decathlon product detail. */\nexport function scavioDecathlonProduct(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description: \"Full Decathlon product detail via the Scavio API: description, images, SKU, GTIN, color, price (cents), list price, availability, offers/variants, rating, review count, category and breadcrumbs.\",\n inputSchema: z.object({\n product_url: z.string().optional().describe(\"Full or relative product URL from any Decathlon domain. Preferred.\"),\n product_id: z.string().optional().describe(\"Decathlon numeric product ID.\"),\n country: z.enum([\"fr\", \"es\", \"it\", \"in\", \"uk\", \"pt\", \"net\"]).describe(\"Country domain.\"),\n }),\n execute: async (input) => (await c.decathlon.product(input)) as Record<string, unknown>,\n });\n}\n\n/**\n * All Scavio tools as an object keyed by tool name, ready to spread into the\n * `tools` option of `generateText` / `streamText`.\n */\nexport function scavioTools(config?: ScavioToolConfig) {\n return {\n scavio_extract: scavioExtract(config),\n scavio_search: scavioSearch(config),\n scavio_youtube_search: scavioYoutubeSearch(config),\n scavio_youtube_video: scavioYoutubeVideo(config),\n scavio_youtube_transcript: scavioYoutubeTranscript(config),\n scavio_youtube_comments: scavioYoutubeComments(config),\n scavio_youtube_channel: scavioYoutubeChannel(config),\n scavio_reddit_search: scavioRedditSearch(config),\n scavio_amazon_search: scavioAmazonSearch(config),\n scavio_amazon_offers: scavioAmazonOffers(config),\n scavio_walmart_search: scavioWalmartSearch(config),\n scavio_tiktok_search: scavioTiktokSearch(config),\n scavio_instagram_search: scavioInstagramSearch(config),\n scavio_heb_search: scavioHebSearch(config),\n scavio_heb_product: scavioHebProduct(config),\n scavio_heb_stores: scavioHebStores(config),\n scavio_kroger_search: scavioKrogerSearch(config),\n scavio_kroger_product: scavioKrogerProduct(config),\n scavio_decathlon_search: scavioDecathlonSearch(config),\n scavio_decathlon_product: scavioDecathlonProduct(config),\n ...(config?.enableCrawl\n ? {\n scavio_map_website: scavioMapWebsite(config),\n scavio_crawl_website: scavioCrawlWebsite(config),\n scavio_crawl_status: scavioCrawlStatus(config),\n scavio_batch_extract: scavioBatchExtract(config),\n scavio_batch_status: scavioBatchStatus(config),\n }\n : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,iBAAkB;AAClB,oBAAoE;AAmBpE,SAAS,OAAO,QAAmC;AACjD,SAAO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MAAM;AAAA,MAC3C,sBAAsB,mBAAmB,MAAM;AAAA,MAC/C,qBAAqB,kBAAkB,MAAM;AAAA,MAC7C,sBAAsB,mBAAmB,MAAM;AAAA,MAC/C,qBAAqB,kBAAkB,MAAM;AAAA,IAC/C,IACA,CAAC;AAAA,EACP;AACF;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -165,6 +165,48 @@ declare function scavioBatchStatus(config?: ScavioToolConfig): ai.Tool<{
|
|
|
165
165
|
limit?: number | undefined;
|
|
166
166
|
include_content?: boolean | undefined;
|
|
167
167
|
}, Record<string, unknown>>;
|
|
168
|
+
/** HEB grocery product search. */
|
|
169
|
+
declare function scavioHebSearch(config?: ScavioToolConfig): ai.Tool<{
|
|
170
|
+
query: string;
|
|
171
|
+
page?: number | undefined;
|
|
172
|
+
page_size?: number | undefined;
|
|
173
|
+
store_id?: string | undefined;
|
|
174
|
+
}, Record<string, unknown>>;
|
|
175
|
+
/** HEB product detail. */
|
|
176
|
+
declare function scavioHebProduct(config?: ScavioToolConfig): ai.Tool<{
|
|
177
|
+
store_id?: string | undefined;
|
|
178
|
+
product_url?: string | undefined;
|
|
179
|
+
product_id?: string | undefined;
|
|
180
|
+
slug?: string | undefined;
|
|
181
|
+
}, Record<string, unknown>>;
|
|
182
|
+
/** HEB store locator. */
|
|
183
|
+
declare function scavioHebStores(config?: ScavioToolConfig): ai.Tool<{
|
|
184
|
+
zip?: string | undefined;
|
|
185
|
+
city?: string | undefined;
|
|
186
|
+
}, Record<string, unknown>>;
|
|
187
|
+
/** Kroger grocery product search. */
|
|
188
|
+
declare function scavioKrogerSearch(config?: ScavioToolConfig): ai.Tool<{
|
|
189
|
+
query: string;
|
|
190
|
+
page?: number | undefined;
|
|
191
|
+
}, Record<string, unknown>>;
|
|
192
|
+
/** Kroger product detail. */
|
|
193
|
+
declare function scavioKrogerProduct(config?: ScavioToolConfig): ai.Tool<{
|
|
194
|
+
product_url?: string | undefined;
|
|
195
|
+
slug?: string | undefined;
|
|
196
|
+
upc?: string | undefined;
|
|
197
|
+
}, Record<string, unknown>>;
|
|
198
|
+
/** Decathlon product search across 7 country domains. */
|
|
199
|
+
declare function scavioDecathlonSearch(config?: ScavioToolConfig): ai.Tool<{
|
|
200
|
+
query: string;
|
|
201
|
+
country: "fr" | "es" | "it" | "in" | "uk" | "pt" | "net";
|
|
202
|
+
page?: number | undefined;
|
|
203
|
+
}, Record<string, unknown>>;
|
|
204
|
+
/** Decathlon product detail. */
|
|
205
|
+
declare function scavioDecathlonProduct(config?: ScavioToolConfig): ai.Tool<{
|
|
206
|
+
country: "fr" | "es" | "it" | "in" | "uk" | "pt" | "net";
|
|
207
|
+
product_url?: string | undefined;
|
|
208
|
+
product_id?: string | undefined;
|
|
209
|
+
}, Record<string, unknown>>;
|
|
168
210
|
/**
|
|
169
211
|
* All Scavio tools as an object keyed by tool name, ready to spread into the
|
|
170
212
|
* `tools` option of `generateText` / `streamText`.
|
|
@@ -277,6 +319,41 @@ declare function scavioTools(config?: ScavioToolConfig): {
|
|
|
277
319
|
scavio_instagram_search: ai.Tool<{
|
|
278
320
|
keyword: string;
|
|
279
321
|
}, Record<string, unknown>>;
|
|
322
|
+
scavio_heb_search: ai.Tool<{
|
|
323
|
+
query: string;
|
|
324
|
+
page?: number | undefined;
|
|
325
|
+
page_size?: number | undefined;
|
|
326
|
+
store_id?: string | undefined;
|
|
327
|
+
}, Record<string, unknown>>;
|
|
328
|
+
scavio_heb_product: ai.Tool<{
|
|
329
|
+
store_id?: string | undefined;
|
|
330
|
+
product_url?: string | undefined;
|
|
331
|
+
product_id?: string | undefined;
|
|
332
|
+
slug?: string | undefined;
|
|
333
|
+
}, Record<string, unknown>>;
|
|
334
|
+
scavio_heb_stores: ai.Tool<{
|
|
335
|
+
zip?: string | undefined;
|
|
336
|
+
city?: string | undefined;
|
|
337
|
+
}, Record<string, unknown>>;
|
|
338
|
+
scavio_kroger_search: ai.Tool<{
|
|
339
|
+
query: string;
|
|
340
|
+
page?: number | undefined;
|
|
341
|
+
}, Record<string, unknown>>;
|
|
342
|
+
scavio_kroger_product: ai.Tool<{
|
|
343
|
+
product_url?: string | undefined;
|
|
344
|
+
slug?: string | undefined;
|
|
345
|
+
upc?: string | undefined;
|
|
346
|
+
}, Record<string, unknown>>;
|
|
347
|
+
scavio_decathlon_search: ai.Tool<{
|
|
348
|
+
query: string;
|
|
349
|
+
country: "fr" | "es" | "it" | "in" | "uk" | "pt" | "net";
|
|
350
|
+
page?: number | undefined;
|
|
351
|
+
}, Record<string, unknown>>;
|
|
352
|
+
scavio_decathlon_product: ai.Tool<{
|
|
353
|
+
country: "fr" | "es" | "it" | "in" | "uk" | "pt" | "net";
|
|
354
|
+
product_url?: string | undefined;
|
|
355
|
+
product_id?: string | undefined;
|
|
356
|
+
}, Record<string, unknown>>;
|
|
280
357
|
};
|
|
281
358
|
|
|
282
|
-
export { type ScavioToolConfig, scavioAmazonOffers, scavioAmazonSearch, scavioBatchExtract, scavioBatchStatus, scavioCrawlStatus, scavioCrawlWebsite, scavioExtract, scavioInstagramSearch, scavioMapWebsite, scavioRedditSearch, scavioSearch, scavioTiktokSearch, scavioTools, scavioWalmartSearch, scavioYoutubeChannel, scavioYoutubeComments, scavioYoutubeSearch, scavioYoutubeTranscript, scavioYoutubeVideo };
|
|
359
|
+
export { type ScavioToolConfig, scavioAmazonOffers, scavioAmazonSearch, scavioBatchExtract, scavioBatchStatus, scavioCrawlStatus, scavioCrawlWebsite, scavioDecathlonProduct, scavioDecathlonSearch, scavioExtract, scavioHebProduct, scavioHebSearch, scavioHebStores, scavioInstagramSearch, scavioKrogerProduct, scavioKrogerSearch, scavioMapWebsite, scavioRedditSearch, scavioSearch, scavioTiktokSearch, scavioTools, scavioWalmartSearch, scavioYoutubeChannel, scavioYoutubeComments, scavioYoutubeSearch, scavioYoutubeTranscript, scavioYoutubeVideo };
|
package/dist/index.d.ts
CHANGED
|
@@ -165,6 +165,48 @@ declare function scavioBatchStatus(config?: ScavioToolConfig): ai.Tool<{
|
|
|
165
165
|
limit?: number | undefined;
|
|
166
166
|
include_content?: boolean | undefined;
|
|
167
167
|
}, Record<string, unknown>>;
|
|
168
|
+
/** HEB grocery product search. */
|
|
169
|
+
declare function scavioHebSearch(config?: ScavioToolConfig): ai.Tool<{
|
|
170
|
+
query: string;
|
|
171
|
+
page?: number | undefined;
|
|
172
|
+
page_size?: number | undefined;
|
|
173
|
+
store_id?: string | undefined;
|
|
174
|
+
}, Record<string, unknown>>;
|
|
175
|
+
/** HEB product detail. */
|
|
176
|
+
declare function scavioHebProduct(config?: ScavioToolConfig): ai.Tool<{
|
|
177
|
+
store_id?: string | undefined;
|
|
178
|
+
product_url?: string | undefined;
|
|
179
|
+
product_id?: string | undefined;
|
|
180
|
+
slug?: string | undefined;
|
|
181
|
+
}, Record<string, unknown>>;
|
|
182
|
+
/** HEB store locator. */
|
|
183
|
+
declare function scavioHebStores(config?: ScavioToolConfig): ai.Tool<{
|
|
184
|
+
zip?: string | undefined;
|
|
185
|
+
city?: string | undefined;
|
|
186
|
+
}, Record<string, unknown>>;
|
|
187
|
+
/** Kroger grocery product search. */
|
|
188
|
+
declare function scavioKrogerSearch(config?: ScavioToolConfig): ai.Tool<{
|
|
189
|
+
query: string;
|
|
190
|
+
page?: number | undefined;
|
|
191
|
+
}, Record<string, unknown>>;
|
|
192
|
+
/** Kroger product detail. */
|
|
193
|
+
declare function scavioKrogerProduct(config?: ScavioToolConfig): ai.Tool<{
|
|
194
|
+
product_url?: string | undefined;
|
|
195
|
+
slug?: string | undefined;
|
|
196
|
+
upc?: string | undefined;
|
|
197
|
+
}, Record<string, unknown>>;
|
|
198
|
+
/** Decathlon product search across 7 country domains. */
|
|
199
|
+
declare function scavioDecathlonSearch(config?: ScavioToolConfig): ai.Tool<{
|
|
200
|
+
query: string;
|
|
201
|
+
country: "fr" | "es" | "it" | "in" | "uk" | "pt" | "net";
|
|
202
|
+
page?: number | undefined;
|
|
203
|
+
}, Record<string, unknown>>;
|
|
204
|
+
/** Decathlon product detail. */
|
|
205
|
+
declare function scavioDecathlonProduct(config?: ScavioToolConfig): ai.Tool<{
|
|
206
|
+
country: "fr" | "es" | "it" | "in" | "uk" | "pt" | "net";
|
|
207
|
+
product_url?: string | undefined;
|
|
208
|
+
product_id?: string | undefined;
|
|
209
|
+
}, Record<string, unknown>>;
|
|
168
210
|
/**
|
|
169
211
|
* All Scavio tools as an object keyed by tool name, ready to spread into the
|
|
170
212
|
* `tools` option of `generateText` / `streamText`.
|
|
@@ -277,6 +319,41 @@ declare function scavioTools(config?: ScavioToolConfig): {
|
|
|
277
319
|
scavio_instagram_search: ai.Tool<{
|
|
278
320
|
keyword: string;
|
|
279
321
|
}, Record<string, unknown>>;
|
|
322
|
+
scavio_heb_search: ai.Tool<{
|
|
323
|
+
query: string;
|
|
324
|
+
page?: number | undefined;
|
|
325
|
+
page_size?: number | undefined;
|
|
326
|
+
store_id?: string | undefined;
|
|
327
|
+
}, Record<string, unknown>>;
|
|
328
|
+
scavio_heb_product: ai.Tool<{
|
|
329
|
+
store_id?: string | undefined;
|
|
330
|
+
product_url?: string | undefined;
|
|
331
|
+
product_id?: string | undefined;
|
|
332
|
+
slug?: string | undefined;
|
|
333
|
+
}, Record<string, unknown>>;
|
|
334
|
+
scavio_heb_stores: ai.Tool<{
|
|
335
|
+
zip?: string | undefined;
|
|
336
|
+
city?: string | undefined;
|
|
337
|
+
}, Record<string, unknown>>;
|
|
338
|
+
scavio_kroger_search: ai.Tool<{
|
|
339
|
+
query: string;
|
|
340
|
+
page?: number | undefined;
|
|
341
|
+
}, Record<string, unknown>>;
|
|
342
|
+
scavio_kroger_product: ai.Tool<{
|
|
343
|
+
product_url?: string | undefined;
|
|
344
|
+
slug?: string | undefined;
|
|
345
|
+
upc?: string | undefined;
|
|
346
|
+
}, Record<string, unknown>>;
|
|
347
|
+
scavio_decathlon_search: ai.Tool<{
|
|
348
|
+
query: string;
|
|
349
|
+
country: "fr" | "es" | "it" | "in" | "uk" | "pt" | "net";
|
|
350
|
+
page?: number | undefined;
|
|
351
|
+
}, Record<string, unknown>>;
|
|
352
|
+
scavio_decathlon_product: ai.Tool<{
|
|
353
|
+
country: "fr" | "es" | "it" | "in" | "uk" | "pt" | "net";
|
|
354
|
+
product_url?: string | undefined;
|
|
355
|
+
product_id?: string | undefined;
|
|
356
|
+
}, Record<string, unknown>>;
|
|
280
357
|
};
|
|
281
358
|
|
|
282
|
-
export { type ScavioToolConfig, scavioAmazonOffers, scavioAmazonSearch, scavioBatchExtract, scavioBatchStatus, scavioCrawlStatus, scavioCrawlWebsite, scavioExtract, scavioInstagramSearch, scavioMapWebsite, scavioRedditSearch, scavioSearch, scavioTiktokSearch, scavioTools, scavioWalmartSearch, scavioYoutubeChannel, scavioYoutubeComments, scavioYoutubeSearch, scavioYoutubeTranscript, scavioYoutubeVideo };
|
|
359
|
+
export { type ScavioToolConfig, scavioAmazonOffers, scavioAmazonSearch, scavioBatchExtract, scavioBatchStatus, scavioCrawlStatus, scavioCrawlWebsite, scavioDecathlonProduct, scavioDecathlonSearch, scavioExtract, scavioHebProduct, scavioHebSearch, scavioHebStores, scavioInstagramSearch, scavioKrogerProduct, scavioKrogerSearch, scavioMapWebsite, scavioRedditSearch, scavioSearch, scavioTiktokSearch, scavioTools, scavioWalmartSearch, scavioYoutubeChannel, scavioYoutubeComments, scavioYoutubeSearch, scavioYoutubeTranscript, scavioYoutubeVideo };
|
package/dist/index.js
CHANGED
|
@@ -338,6 +338,94 @@ function scavioBatchStatus(config) {
|
|
|
338
338
|
execute: async ({ id, limit, ...q }) => await c.extract.batchStatus(id, { ...q, limit: limit ?? JOB_RESULTS_DEFAULT_LIMIT })
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
|
+
function scavioHebSearch(config) {
|
|
342
|
+
const c = client(config);
|
|
343
|
+
const max = config?.maxResults ?? 10;
|
|
344
|
+
return tool({
|
|
345
|
+
description: "Search HEB grocery products via the Scavio API: price, sale status, unit price, UPC, stock, EBT/SNAP eligibility. Pass store_id for one store's prices, stock and assortment. Products come back under `data.products`.",
|
|
346
|
+
inputSchema: z.object({
|
|
347
|
+
query: z.string().describe("Search keywords (1-200 characters)."),
|
|
348
|
+
page: z.number().optional().describe("Results page, 1-based."),
|
|
349
|
+
page_size: z.number().optional().describe("Results per page, 1-60. Defaults to 60."),
|
|
350
|
+
store_id: z.string().optional().describe("HEB store number from the HEB stores tool (store_number), e.g. '441'. Prices, stock, aisle location and assortment come from that store; the store used is echoed in data.store {store_id, name}. US only. Omit for HEB's default store.")
|
|
351
|
+
}),
|
|
352
|
+
execute: async (input) => trimData(await c.heb.search(input), "products", max)
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
function scavioHebProduct(config) {
|
|
356
|
+
const c = client(config);
|
|
357
|
+
return tool({
|
|
358
|
+
description: "Full HEB product detail via the Scavio API: nutrition, ingredients, images, coupons, EBT/SNAP eligibility. With store_id, price, stock and aisle are for that store and product_id alone works.",
|
|
359
|
+
inputSchema: z.object({
|
|
360
|
+
product_url: z.string().optional().describe("Full or relative product URL from heb.com. Preferred."),
|
|
361
|
+
product_id: z.string().optional().describe("HEB product id. Needs slug, unless store_id is set (then product_id alone works)."),
|
|
362
|
+
slug: z.string().optional().describe("Product slug. Required with product_id unless store_id is set."),
|
|
363
|
+
store_id: z.string().optional().describe("HEB store number from the HEB stores tool (store_number), e.g. '441'. Prices, stock, aisle location and assortment come from that store; the store used is echoed in data.store {store_id, name}. US only. Omit for HEB's default store.")
|
|
364
|
+
}),
|
|
365
|
+
execute: async (input) => await c.heb.product(input)
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
function scavioHebStores(config) {
|
|
369
|
+
const c = client(config);
|
|
370
|
+
const max = config?.maxResults ?? 10;
|
|
371
|
+
return tool({
|
|
372
|
+
description: "Find HEB stores near a ZIP code or city via the Scavio API. Stores come back under `data.stores`.",
|
|
373
|
+
inputSchema: z.object({
|
|
374
|
+
zip: z.string().optional().describe("5-digit US ZIP code."),
|
|
375
|
+
city: z.string().optional().describe("City name. Pass zip or city.")
|
|
376
|
+
}),
|
|
377
|
+
execute: async (input) => trimData(await c.heb.stores(input), "stores", max)
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function scavioKrogerSearch(config) {
|
|
381
|
+
const c = client(config);
|
|
382
|
+
const max = config?.maxResults ?? 10;
|
|
383
|
+
return tool({
|
|
384
|
+
description: "Search Kroger grocery products via the Scavio API: price, promo deals, UPC, stock, SNAP eligibility, dietary info. Kroger operates Kroger, Ralphs, Fred Meyer, Harris Teeter, King Soopers and Fry's. Products come back under `data.products`.",
|
|
385
|
+
inputSchema: z.object({
|
|
386
|
+
query: z.string().describe("Search keywords (1-200 characters)."),
|
|
387
|
+
page: z.number().optional().describe("Results page, 1-based.")
|
|
388
|
+
}),
|
|
389
|
+
execute: async (input) => trimData(await c.kroger.search(input), "products", max)
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
function scavioKrogerProduct(config) {
|
|
393
|
+
const c = client(config);
|
|
394
|
+
return tool({
|
|
395
|
+
description: "Full Kroger product detail via the Scavio API: nutrition, allergens, ingredients, images, rating, dietary flags, SNAP eligibility.",
|
|
396
|
+
inputSchema: z.object({
|
|
397
|
+
product_url: z.string().optional().describe("Full or relative product URL from kroger.com. Preferred."),
|
|
398
|
+
upc: z.string().optional().describe("Kroger product UPC."),
|
|
399
|
+
slug: z.string().optional().describe("Product slug. Optional with upc.")
|
|
400
|
+
}),
|
|
401
|
+
execute: async (input) => await c.kroger.product(input)
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
function scavioDecathlonSearch(config) {
|
|
405
|
+
const c = client(config);
|
|
406
|
+
const max = config?.maxResults ?? 10;
|
|
407
|
+
return tool({
|
|
408
|
+
description: "Search Decathlon products by keyword via the Scavio API across 7 country domains (FR, ES, IT, IN, UK, PT, NET). Returns product name, brand, price (cents), currency, availability, rating, review count and image. Products come back under `data.products`.",
|
|
409
|
+
inputSchema: z.object({
|
|
410
|
+
query: z.string().describe("Search keywords (1-200 characters)."),
|
|
411
|
+
country: z.enum(["fr", "es", "it", "in", "uk", "pt", "net"]).describe("Country domain."),
|
|
412
|
+
page: z.number().optional().describe("Results page, 1-based (1-50).")
|
|
413
|
+
}),
|
|
414
|
+
execute: async (input) => trimData(await c.decathlon.search(input), "products", max)
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
function scavioDecathlonProduct(config) {
|
|
418
|
+
const c = client(config);
|
|
419
|
+
return tool({
|
|
420
|
+
description: "Full Decathlon product detail via the Scavio API: description, images, SKU, GTIN, color, price (cents), list price, availability, offers/variants, rating, review count, category and breadcrumbs.",
|
|
421
|
+
inputSchema: z.object({
|
|
422
|
+
product_url: z.string().optional().describe("Full or relative product URL from any Decathlon domain. Preferred."),
|
|
423
|
+
product_id: z.string().optional().describe("Decathlon numeric product ID."),
|
|
424
|
+
country: z.enum(["fr", "es", "it", "in", "uk", "pt", "net"]).describe("Country domain.")
|
|
425
|
+
}),
|
|
426
|
+
execute: async (input) => await c.decathlon.product(input)
|
|
427
|
+
});
|
|
428
|
+
}
|
|
341
429
|
function scavioTools(config) {
|
|
342
430
|
return {
|
|
343
431
|
scavio_extract: scavioExtract(config),
|
|
@@ -353,6 +441,13 @@ function scavioTools(config) {
|
|
|
353
441
|
scavio_walmart_search: scavioWalmartSearch(config),
|
|
354
442
|
scavio_tiktok_search: scavioTiktokSearch(config),
|
|
355
443
|
scavio_instagram_search: scavioInstagramSearch(config),
|
|
444
|
+
scavio_heb_search: scavioHebSearch(config),
|
|
445
|
+
scavio_heb_product: scavioHebProduct(config),
|
|
446
|
+
scavio_heb_stores: scavioHebStores(config),
|
|
447
|
+
scavio_kroger_search: scavioKrogerSearch(config),
|
|
448
|
+
scavio_kroger_product: scavioKrogerProduct(config),
|
|
449
|
+
scavio_decathlon_search: scavioDecathlonSearch(config),
|
|
450
|
+
scavio_decathlon_product: scavioDecathlonProduct(config),
|
|
356
451
|
...config?.enableCrawl ? {
|
|
357
452
|
scavio_map_website: scavioMapWebsite(config),
|
|
358
453
|
scavio_crawl_website: scavioCrawlWebsite(config),
|
|
@@ -369,8 +464,15 @@ export {
|
|
|
369
464
|
scavioBatchStatus,
|
|
370
465
|
scavioCrawlStatus,
|
|
371
466
|
scavioCrawlWebsite,
|
|
467
|
+
scavioDecathlonProduct,
|
|
468
|
+
scavioDecathlonSearch,
|
|
372
469
|
scavioExtract,
|
|
470
|
+
scavioHebProduct,
|
|
471
|
+
scavioHebSearch,
|
|
472
|
+
scavioHebStores,
|
|
373
473
|
scavioInstagramSearch,
|
|
474
|
+
scavioKrogerProduct,
|
|
475
|
+
scavioKrogerSearch,
|
|
374
476
|
scavioMapWebsite,
|
|
375
477
|
scavioRedditSearch,
|
|
376
478
|
scavioSearch,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { tool } from \"ai\";\nimport { z } from \"zod\";\nimport { Scavio, type ScavioConfig, type GoogleSearchOptions } from \"scavio\";\n\nexport interface ScavioToolConfig extends ScavioConfig {\n /**\n * Max number of items to keep in the tool's result list. Defaults to 10.\n * Trimmed inside `data` on every platform except Google, whose body is flat.\n * Ignored by `scavioExtract`, which returns page content rather than a list.\n */\n maxResults?: number;\n /**\n * Add the five website tools (map, crawl, crawl status, batch extract, batch\n * status) to `scavioTools()`. Off by default: a crawl bills per page. The\n * individual factories (`scavioCrawlWebsite` and friends) work regardless.\n */\n enableCrawl?: boolean;\n /** Milliseconds between progress polls while a crawl or batch tool waits. Default 3000. */\n pollIntervalMs?: number;\n}\n\nfunction client(config?: ScavioToolConfig): Scavio {\n return new Scavio({ apiKey: config?.apiKey });\n}\n\n/**\n * Google is the ONLY family with a flat body: `organic_results` and friends sit\n * at the top level, next to `response_time` / `credits_used` / `credits_remaining`.\n */\nfunction trimFlat(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const list = res[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, [key]: list.slice(0, max) };\n }\n return res;\n}\n\n/**\n * Every non-Google endpoint nests its payload under `data` - the response is\n * `{ data: { products: [...] }, response_time, credits_used, credits_remaining }`.\n * Trimming the top level is therefore a silent no-op, so those tools trim\n * inside `data`.\n */\nfunction trimData(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const data = res.data;\n if (!data || typeof data !== \"object\") return res;\n const list = (data as Record<string, unknown>)[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, data: { ...(data as Record<string, unknown>), [key]: list.slice(0, max) } };\n }\n return res;\n}\n\n/**\n * Read any URL (/api/v1/extract).\n *\n * The one tool here that is not tied to a platform, and the only one `maxResults`\n * does not touch: extract returns page CONTENT, not a result list, so there is\n * nothing to trim and the body is returned whole. `extract` is a TOP-LEVEL\n * method on the SDK client - `c.extract({ url })`, never `c.extract.extract()`.\n *\n * Credits are a function of `mode`, not a per-call constant: \"normal\" 1,\n * \"advanced\" 1, \"ultra\" 2. Only a successful read is billed.\n */\nexport function scavioExtract(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read any web page via the Scavio API and get it back as clean Markdown (default), plain text, or raw HTML. Use it on any URL, including one returned by the search tools. Returns `data.content` alongside `data.url`, `data.format`, `data.mode` and `data.content_length`. Cost depends on `mode`: 1 credit on 'normal' and 'advanced', 2 on 'ultra'; a dead link, bot wall or timeout is not billed.\",\n inputSchema: z.object({\n url: z\n .string()\n .describe(\n \"The page to read (1-2048 characters). http(s) only; a bare host is upgraded to https, and loopback, private, link-local and metadata hosts are rejected.\",\n ),\n format: z\n .enum([\"html\", \"markdown\", \"text\"])\n .optional()\n .describe(\n \"Output format (default 'markdown'): 'markdown' is a readability extraction with page chrome stripped, 'text' is that flattened to plain text, 'html' is the raw page.\",\n ),\n mode: z\n .enum([\"normal\", \"advanced\", \"ultra\"])\n .optional()\n .describe(\n \"Fetch tier, and the parameter that sets the price: 'normal' (default) is a plain fetch and costs 1 credit, 'advanced' renders JavaScript-built pages and costs 1, 'ultra' reaches the hardest pages and costs 2. Start on 'normal'.\",\n ),\n }),\n execute: async ({ url, format, mode }) => c.extract({ url, format, mode }),\n });\n}\n\n/** Google web search (/api/v2/google, 1 credit). */\nexport function scavioSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search the web with Google via the Scavio API (1 credit). Returns real-time organic search results, each with a title, link, and snippet, under `organic_results`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n countryCode: z.string().optional().describe('Two-letter country code to localize results, e.g. \"us\".'),\n language: z.string().optional().describe('Two-letter UI language code, e.g. \"en\".'),\n page: z.number().int().optional().describe(\"1-based result page; page 2 starts at result 10.\"),\n device: z.enum([\"desktop\", \"mobile\"]).optional().describe(\"Device to emulate.\"),\n nfpr: z.boolean().optional().describe(\"Disable spelling auto-correction / similar-result substitution when true.\"),\n }),\n execute: async ({ query, countryCode, language, page, device, nfpr }) => {\n const params: GoogleSearchOptions = { query };\n if (countryCode) params.gl = countryCode;\n if (language) params.hl = language;\n if (page && page > 1) params.start = (page - 1) * 10;\n if (device) params.device = device;\n if (nfpr !== undefined) params.nfpr = nfpr;\n return trimFlat(await c.google.search(params), \"organic_results\", max);\n },\n });\n}\n\n/** YouTube video search (2 credits). */\nexport function scavioYoutubeSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search YouTube for videos, channels, or playlists via the Scavio API (2 credits). Videos come back under `data.results`, with `data.channels` and `data.playlists` alongside.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n upload_date: z.string().optional().describe(\"Upload date filter, e.g. 'today', 'this_week', 'this_month'.\"),\n type: z.string().optional().describe(\"Result type: 'video', 'channel', 'playlist', 'movie'.\"),\n duration: z.string().optional().describe(\"Duration filter: 'short', 'medium', 'long'.\"),\n sort_by: z.string().optional().describe(\"Sort order: 'relevance', 'date', 'view_count', 'rating'.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, upload_date, type, duration, sort_by, cursor }) =>\n trimData(\n await c.youtube.search({ query, upload_date, type, duration, sort_by, cursor } as Parameters<\n typeof c.youtube.search\n >[0]),\n \"results\",\n max,\n ),\n });\n}\n\n/** YouTube video details (1 credit). */\nexport function scavioYoutubeVideo(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch full details for a YouTube video (title, author, view count, description, captions, chapters) via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n }),\n execute: async ({ video_id }) => c.youtube.video({ video_id }),\n });\n}\n\n/** YouTube video transcript / subtitles (5 credits). */\nexport function scavioYoutubeTranscript(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube video's transcript or timed subtitles via the Scavio API (5 credits).\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n language: z.string().optional().describe(\"Transcript language code (default 'en').\"),\n format: z.enum([\"text\", \"srt\"]).optional().describe(\"'text' for a plain transcript, 'srt' for timed subtitles.\"),\n }),\n execute: async ({ video_id, language, format }) =>\n c.youtube.transcript({ video_id, language, format } as Parameters<typeof c.youtube.transcript>[0]),\n });\n}\n\n/** YouTube video comments (1 credit). */\nexport function scavioYoutubeComments(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"List comments on a YouTube video via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n cursor: z.string().optional().describe(\"Pagination cursor.\"),\n }),\n execute: async ({ video_id, cursor }) =>\n trimData(\n await c.youtube.comments({ video_id, cursor } as Parameters<typeof c.youtube.comments>[0]),\n \"comments\",\n max,\n ),\n });\n}\n\n/** YouTube channel details (1 credit). */\nexport function scavioYoutubeChannel(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube channel's details (subscribers, video count, views, links) via the Scavio API.\",\n inputSchema: z.object({\n channel_id: z.string().describe(\"YouTube channel id, @handle, or channel URL.\"),\n }),\n execute: async ({ channel_id }) => c.youtube.channel({ channel_id }),\n });\n}\n\n/**\n * Reddit post search (1 credit).\n *\n * The endpoint takes `query` and `cursor` and nothing else - it cannot sort or\n * filter by type, so no such input is offered. The API silently ignores those\n * params, which would leave a model believing it had filtered when it had not.\n */\nexport function scavioRedditSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Reddit posts via the Scavio API (1 credit). Returns matching posts under `data.results` with `data.next_cursor` for the next page. Results cannot be sorted or filtered by type.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, cursor }) => trimData(await c.reddit.search({ query, cursor }), \"results\", max),\n });\n}\n\n/**\n * Amazon product search.\n *\n * `domain` was dropped in favour of `country`, a two-letter marketplace code -\n * the Amazon endpoint changed in 2026-07 and no longer takes a domain\n * suffix. It still works on the wire as a deprecated alias, but a model should\n * only ever see one spelling of a param.\n */\nexport function scavioAmazonSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Amazon for products via the Scavio API. Results are unsorted and cannot be filtered by category, merchant or price.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ query, country }) =>\n trimData(await c.amazon.search({ query, country }), \"products\", max),\n });\n}\n\n/** Every seller offer for one Amazon ASIN. */\nexport function scavioAmazonOffers(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"List every seller offer for one Amazon ASIN via the Scavio API: price, seller, condition, shipping, and which offer holds the buy box. Page 1 only.\",\n inputSchema: z.object({\n asin: z.string().describe(\"Amazon Standard Identification Number (ASIN) of the product.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ asin, country }) =>\n trimData(await c.amazon.offers({ asin, country }), \"offers\", max),\n });\n}\n\n/** Walmart product search. */\nexport function scavioWalmartSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Walmart for products via the Scavio API. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n }),\n execute: async ({ query }) => trimData(await c.walmart.search({ query }), \"products\", max),\n });\n}\n\n/** TikTok video search. */\nexport function scavioTiktokSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search TikTok for videos by keyword via the Scavio API. Videos come back under `data.aweme_list`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n sort_type: z.enum([\"0\", \"1\"]).optional().describe(\"Sort order: '0' relevance, '1' most likes.\"),\n publish_time: z\n .enum([\"0\", \"1\", \"7\", \"30\", \"90\", \"180\"])\n .optional()\n .describe(\"Publish window in days: '0' all time, '1', '7', '30', '90', '180'.\"),\n }),\n execute: async ({ keyword, sort_type, publish_time }) =>\n trimData(\n await c.tiktok.searchVideos({\n keyword,\n sort_type,\n publish_time,\n } as Parameters<typeof c.tiktok.searchVideos>[0]),\n \"aweme_list\",\n max,\n ),\n });\n}\n\n/** Instagram user search. */\nexport function scavioInstagramSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Instagram for users by keyword via the Scavio API (2 credits). Users come back under `data.users`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n }),\n execute: async ({ keyword }) => trimData(await c.instagram.searchUsers({ keyword }), \"users\", max),\n });\n}\n\n// ---------------------------------------------------------------------------\n// Website map, crawl and batch: the multi-page members of the Extract family.\n//\n// Map answers in one call. Crawl and batch are background jobs: the start tools\n// post the job, then wait up to wait_seconds (default 45, max 300) for it to\n// finish, polling progress without page content, and return the job's status\n// with its first page of results either way. A job still running when the wait\n// ends keeps going server-side; read the rest with the matching status tool.\n// ---------------------------------------------------------------------------\n\nconst JOB_POLL_INTERVAL_MS = 3_000;\nconst JOB_WAIT_DEFAULT_SECONDS = 45;\nconst JOB_WAIT_MAX_SECONDS = 300;\nconst JOB_RESULTS_DEFAULT_LIMIT = 10;\nconst JOB_TERMINAL = new Set([\"completed\", \"failed\", \"cancelled\"]);\n\ntype JobQuery = {\n cursor?: string;\n limit?: number;\n status?: \"succeeded\" | \"failed\" | \"skipped\";\n include_content?: boolean;\n};\ntype JobPayload = { data?: { id?: string; status?: string } } & Record<string, unknown>;\ntype JobStatusFn = (id: string, query: JobQuery) => Promise<unknown>;\n\n// lib is ES2022 only (no DOM or Node types); every runtime this targets has setTimeout.\ndeclare const setTimeout: (callback: () => void, ms: number) => unknown;\n\nconst sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(() => resolve(), ms));\n\n/** Poll a job (content-free) until it finishes or the wait runs out, then read one results page. */\nasync function waitForJob(\n status: JobStatusFn,\n id: string,\n waitSeconds: number,\n pollMs: number,\n query: JobQuery,\n): Promise<Record<string, unknown>> {\n const deadline = Date.now() + Math.max(0, Math.min(waitSeconds, JOB_WAIT_MAX_SECONDS)) * 1000;\n for (;;) {\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await sleep(Math.min(pollMs, remaining));\n const probe = (await status(id, { limit: 1, include_content: false })) as JobPayload;\n if (JOB_TERMINAL.has(String(probe?.data?.status))) break;\n }\n return (await status(id, query)) as Record<string, unknown>;\n}\n\n/** Start a job, then wait for it (bounded). wait_seconds 0 returns the 202 payload. */\nasync function startAndWait(\n start: () => Promise<unknown>,\n status: JobStatusFn,\n input: { wait_seconds?: number; limit?: number; include_content?: boolean },\n pollMs: number,\n): Promise<Record<string, unknown>> {\n const created = (await start()) as JobPayload;\n const id = created?.data?.id;\n const wait = input.wait_seconds ?? JOB_WAIT_DEFAULT_SECONDS;\n if (!id || wait <= 0) return created;\n const query: JobQuery = { limit: input.limit ?? JOB_RESULTS_DEFAULT_LIMIT };\n if (input.include_content !== undefined) query.include_content = input.include_content;\n return waitForJob(status, id, wait, pollMs, query);\n}\n\nconst MODE_DESCRIPTION =\n \"Fetch tier, and the parameter that sets the price: 'normal' (default) is the standard fetch, 'advanced' renders JavaScript-built pages, 'ultra' reaches the hardest pages.\";\nconst PATHS_DESCRIPTION =\n \"Path globs (max 20). '*' matches within one path segment, '**' across segments; a pattern without wildcards matches that path and everything under it. Example: ['/blog/**'].\";\nconst JOB_PRICE =\n \"Billed per SUCCESSFUL page at Extract's price for the mode: 'normal' and 'advanced' 1 credit, 'ultra' 2. Failed and skipped pages are free, and if the balance runs out the job stops cleanly.\";\n\nconst jobFields = {\n format: z.enum([\"html\", \"markdown\", \"text\"]).optional().describe(\"Format for each page, as on extract (default 'markdown').\"),\n mode: z.enum([\"normal\", \"advanced\", \"ultra\"]).optional().describe(MODE_DESCRIPTION),\n wait_seconds: z\n .number()\n .int()\n .min(0)\n .max(JOB_WAIT_MAX_SECONDS)\n .optional()\n .describe(\"Seconds to wait for the job to finish before returning, 0-300 (default 45). 0 returns the job id at once. A job still running when the wait ends keeps going; read it later with its status tool.\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\"Results per response, 1-100 (default 10, to keep page content inside the context window); page on with next_cursor.\"),\n include_content: z.boolean().optional().describe(\"Set false to list results without their page content (default true).\"),\n};\n\nconst jobStatusSchema = z.object({\n id: z.string().describe(\"Job id returned when the job was started (data.id).\"),\n cursor: z.string().optional().describe(\"next_cursor from the previous response, to read the next page.\"),\n limit: jobFields.limit,\n status: z.enum([\"succeeded\", \"failed\", \"skipped\"]).optional().describe(\"Only results with this status.\"),\n include_content: jobFields.include_content,\n});\n\n/** Map a website's URLs (/api/v1/extract/map). 1 credit on 'normal'. */\nexport function scavioMapWebsite(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"List a website's page URLs via the Scavio API, gathered from its sitemaps and its start page, deduplicated, filtered by path or search words and limited: `data.links` [{ url, source, lastmod }], `data.total_found`, `data.truncated`. Pages the site's robots.txt disallows are left out. Use it to find the right pages before extracting or crawling. Costs 1 credit on 'normal'; up to 2 on 'advanced' and up to 10 on 'ultra', priced by what the call needed.\",\n inputSchema: z.object({\n url: z.string().describe(\"The site to map. A bare host is upgraded to https.\"),\n search: z.string().optional().describe(\"Only return URLs containing every word of this text (case-insensitive).\"),\n limit: z.number().int().min(1).max(5000).optional().describe(\"Maximum links to return, 1-5000. Default 1000 (or the plan's limit if lower: Free 500, PAYG 1,000, paid plans 5,000).\"),\n sitemap: z.enum([\"include\", \"only\", \"skip\"]).optional().describe(\"'include' combines the site's sitemaps with the start page's links (default); 'only' uses sitemaps alone; 'skip' uses page links alone.\"),\n include_subdomains: z.boolean().optional().describe(\"Also return URLs on subdomains of the site (default false).\"),\n include_paths: z.array(z.string()).optional().describe(\"Keep only URLs matching these. \" + PATHS_DESCRIPTION),\n exclude_paths: z.array(z.string()).optional().describe(\"Drop URLs matching these. \" + PATHS_DESCRIPTION),\n ignore_query_parameters: z.boolean().optional().describe(\"Treat URLs that differ only by query string as one URL (default true).\"),\n mode: jobFields.mode,\n }),\n execute: async (input) =>\n (await c.extract.map(input as Parameters<typeof c.extract.map>[0])) as unknown as Record<string, unknown>,\n });\n}\n\n/** Crawl a website (/api/v1/extract/crawl), then wait (bounded) for it. */\nexport function scavioCrawlWebsite(config?: ScavioToolConfig) {\n const c = client(config);\n const pollMs = config?.pollIntervalMs ?? JOB_POLL_INTERVAL_MS;\n return tool({\n description:\n \"Crawl a website from one start URL via the Scavio API: same-site pages are discovered and extracted breadth-first within the page, depth and path limits, each returned as Markdown, text or HTML. Pages the site's robots.txt disallows are skipped. Waits up to wait_seconds (default 45) and returns `data` { id, status, pages, credits_used, results, next_cursor }; if status is still queued or running, call scavio_crawl_status with the id later. \" +\n JOB_PRICE,\n inputSchema: z.object({\n url: z.string().describe(\"Where the crawl starts. Only pages on the same site are crawled.\"),\n max_pages: z.number().int().min(1).max(10000).optional().describe(\"Maximum pages to fetch. Default 100. Plan limits: Free 10, PAYG 100, Project 500, Bootstrap 2,000, Startup 5,000, Growth 10,000.\"),\n max_depth: z.number().int().min(0).max(10).optional().describe(\"How many links away from the start page to follow, 0-10 (default 3). 0 fetches only the start page.\"),\n include_paths: z.array(z.string()).optional().describe(\"Crawl only paths matching these. \" + PATHS_DESCRIPTION),\n exclude_paths: z.array(z.string()).optional().describe(\"Skip paths matching these. \" + PATHS_DESCRIPTION),\n allow_subdomains: z.boolean().optional().describe(\"Also crawl subdomains of the site (default false).\"),\n ignore_query_parameters: z.boolean().optional().describe(\"Treat URLs that differ only by query string as one page (default true).\"),\n sitemap: z.enum([\"include\", \"skip\", \"only\"]).optional().describe(\"'include' also starts from the site's sitemap (default); 'skip' follows links only; 'only' fetches sitemap pages without following links.\"),\n ...jobFields,\n }),\n execute: async (input) => {\n const { wait_seconds, limit, include_content, ...body } = input;\n return startAndWait(\n () => c.extract.crawl(body as Parameters<typeof c.extract.crawl>[0]),\n (id, q) => c.extract.crawlStatus(id, q),\n { wait_seconds, limit, include_content },\n pollMs,\n );\n },\n });\n}\n\n/** A crawl's progress and page results (GET /api/v1/extract/crawl/{id}). Free. */\nexport function scavioCrawlStatus(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read a crawl's progress and its page results by job id via the Scavio API, paged by cursor: `data` { status, stopped_reason, pages, credits_used, results: [{ url, status, content }], next_cursor }. Results are kept for 3 days after the crawl finishes. Free: reading a job costs 0 credits.\",\n inputSchema: jobStatusSchema,\n execute: async ({ id, limit, ...q }) =>\n (await c.extract.crawlStatus(id, { ...q, limit: limit ?? JOB_RESULTS_DEFAULT_LIMIT })) as unknown as Record<string, unknown>,\n });\n}\n\n/** Extract a list of URLs in one job (/api/v1/extract/batch), then wait (bounded). */\nexport function scavioBatchExtract(config?: ScavioToolConfig) {\n const c = client(config);\n const pollMs = config?.pollIntervalMs ?? JOB_POLL_INTERVAL_MS;\n return tool({\n description:\n \"Extract a list of URLs (up to 1,000, plan-limited) in one job via the Scavio API, each returned as Markdown, text or HTML exactly like scavio_extract. Waits up to wait_seconds (default 45) and returns `data` { id, status, pages, credits_used, results, next_cursor }; if status is still queued or running, call scavio_batch_status with the id later. \" +\n JOB_PRICE,\n inputSchema: z.object({\n urls: z.array(z.string()).min(1).max(1000).describe(\"The pages to extract (duplicates removed). Plan limits: Free 10, PAYG 50, Project 100, Bootstrap 500, Startup and Growth 1,000.\"),\n ...jobFields,\n }),\n execute: async (input) => {\n const { wait_seconds, limit, include_content, ...body } = input;\n return startAndWait(\n () => c.extract.batch(body as Parameters<typeof c.extract.batch>[0]),\n (id, q) => c.extract.batchStatus(id, q),\n { wait_seconds, limit, include_content },\n pollMs,\n );\n },\n });\n}\n\n/** A batch's progress and page results (GET /api/v1/extract/batch/{id}). Free. */\nexport function scavioBatchStatus(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read a batch extract's progress and its page results by job id via the Scavio API, paged by cursor: `data` { status, pages, credits_used, results: [{ url, status, content }], next_cursor }. Results are kept for 3 days after the batch finishes. Free: reading a job costs 0 credits.\",\n inputSchema: jobStatusSchema,\n execute: async ({ id, limit, ...q }) =>\n (await c.extract.batchStatus(id, { ...q, limit: limit ?? JOB_RESULTS_DEFAULT_LIMIT })) as unknown as Record<string, unknown>,\n });\n}\n\n/**\n * All Scavio tools as an object keyed by tool name, ready to spread into the\n * `tools` option of `generateText` / `streamText`.\n */\nexport function scavioTools(config?: ScavioToolConfig) {\n return {\n scavio_extract: scavioExtract(config),\n scavio_search: scavioSearch(config),\n scavio_youtube_search: scavioYoutubeSearch(config),\n scavio_youtube_video: scavioYoutubeVideo(config),\n scavio_youtube_transcript: scavioYoutubeTranscript(config),\n scavio_youtube_comments: scavioYoutubeComments(config),\n scavio_youtube_channel: scavioYoutubeChannel(config),\n scavio_reddit_search: scavioRedditSearch(config),\n scavio_amazon_search: scavioAmazonSearch(config),\n scavio_amazon_offers: scavioAmazonOffers(config),\n scavio_walmart_search: scavioWalmartSearch(config),\n scavio_tiktok_search: scavioTiktokSearch(config),\n scavio_instagram_search: scavioInstagramSearch(config),\n ...(config?.enableCrawl\n ? {\n scavio_map_website: scavioMapWebsite(config),\n scavio_crawl_website: scavioCrawlWebsite(config),\n scavio_crawl_status: scavioCrawlStatus(config),\n scavio_batch_extract: scavioBatchExtract(config),\n scavio_batch_status: scavioBatchStatus(config),\n }\n : {}),\n };\n}\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,SAAS;AAClB,SAAS,cAA2D;AAmBpE,SAAS,OAAO,QAAmC;AACjD,SAAO,IAAI,OAAO,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAC9C;AAMA,SAAS,SAAS,KAA8B,KAAa,KAAsC;AACjG,QAAM,OAAO,IAAI,GAAG;AACpB,MAAI,MAAM,QAAQ,IAAI,KAAK,KAAK,SAAS,KAAK;AAC5C,WAAO,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,KAAK,MAAM,GAAG,GAAG,EAAE;AAAA,EAC7C;AACA,SAAO;AACT;AAQA,SAAS,SAAS,KAA8B,KAAa,KAAsC;AACjG,QAAM,OAAO,IAAI;AACjB,MAAI,CAAC,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC9C,QAAM,OAAQ,KAAiC,GAAG;AAClD,MAAI,MAAM,QAAQ,IAAI,KAAK,KAAK,SAAS,KAAK;AAC5C,WAAO,EAAE,GAAG,KAAK,MAAM,EAAE,GAAI,MAAkC,CAAC,GAAG,GAAG,KAAK,M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AQ,YAAY,IAAI,CAAC;AAAA,QACtC,EAAE,cAAc,OAAO,gBAAgB;AAAA,QACvC;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAGO,SAAS,kBAAkB,QAA2B;AAC3D,QAAM,IAAI,OAAO,MAAM;AACvB,SAAO,KAAK;AAAA,IACV,aACE;AAAA,IACF,aAAa;AAAA,IACb,SAAS,OAAO,EAAE,IAAI,OAAO,GAAG,EAAE,MAC/B,MAAM,EAAE,QAAQ,YAAY,IAAI,EAAE,GAAG,GAAG,OAAO,SAAS,0BAA0B,CAAC;AAAA,EACxF,CAAC;AACH;AAMO,SAAS,YAAY,QAA2B;AACrD,SAAO;AAAA,IACL,gBAAgB,cAAc,MAAM;AAAA,IACpC,eAAe,aAAa,MAAM;AAAA,IAClC,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,2BAA2B,wBAAwB,MAAM;AAAA,IACzD,yBAAyB,sBAAsB,MAAM;AAAA,IACrD,wBAAwB,qBAAqB,MAAM;AAAA,IACnD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,yBAAyB,sBAAsB,MAAM;AAAA,IACrD,GAAI,QAAQ,cACR;AAAA,MACE,oBAAoB,iBAAiB,MAAM;AAAA,MAC3C,sBAAsB,mBAAmB,MAAM;AAAA,MAC/C,qBAAqB,kBAAkB,MAAM;AAAA,MAC7C,sBAAsB,mBAAmB,MAAM;AAAA,MAC/C,qBAAqB,kBAAkB,MAAM;AAAA,IAC/C,IACA,CAAC;AAAA,EACP;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { tool } from \"ai\";\nimport { z } from \"zod\";\nimport { Scavio, type ScavioConfig, type GoogleSearchOptions } from \"scavio\";\n\nexport interface ScavioToolConfig extends ScavioConfig {\n /**\n * Max number of items to keep in the tool's result list. Defaults to 10.\n * Trimmed inside `data` on every platform except Google, whose body is flat.\n * Ignored by `scavioExtract`, which returns page content rather than a list.\n */\n maxResults?: number;\n /**\n * Add the five website tools (map, crawl, crawl status, batch extract, batch\n * status) to `scavioTools()`. Off by default: a crawl bills per page. The\n * individual factories (`scavioCrawlWebsite` and friends) work regardless.\n */\n enableCrawl?: boolean;\n /** Milliseconds between progress polls while a crawl or batch tool waits. Default 3000. */\n pollIntervalMs?: number;\n}\n\nfunction client(config?: ScavioToolConfig): Scavio {\n return new Scavio({ apiKey: config?.apiKey });\n}\n\n/**\n * Google is the ONLY family with a flat body: `organic_results` and friends sit\n * at the top level, next to `response_time` / `credits_used` / `credits_remaining`.\n */\nfunction trimFlat(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const list = res[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, [key]: list.slice(0, max) };\n }\n return res;\n}\n\n/**\n * Every non-Google endpoint nests its payload under `data` - the response is\n * `{ data: { products: [...] }, response_time, credits_used, credits_remaining }`.\n * Trimming the top level is therefore a silent no-op, so those tools trim\n * inside `data`.\n */\nfunction trimData(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const data = res.data;\n if (!data || typeof data !== \"object\") return res;\n const list = (data as Record<string, unknown>)[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, data: { ...(data as Record<string, unknown>), [key]: list.slice(0, max) } };\n }\n return res;\n}\n\n/**\n * Read any URL (/api/v1/extract).\n *\n * The one tool here that is not tied to a platform, and the only one `maxResults`\n * does not touch: extract returns page CONTENT, not a result list, so there is\n * nothing to trim and the body is returned whole. `extract` is a TOP-LEVEL\n * method on the SDK client - `c.extract({ url })`, never `c.extract.extract()`.\n *\n * Credits are a function of `mode`, not a per-call constant: \"normal\" 1,\n * \"advanced\" 1, \"ultra\" 2. Only a successful read is billed.\n */\nexport function scavioExtract(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read any web page via the Scavio API and get it back as clean Markdown (default), plain text, or raw HTML. Use it on any URL, including one returned by the search tools. Returns `data.content` alongside `data.url`, `data.format`, `data.mode` and `data.content_length`. Cost depends on `mode`: 1 credit on 'normal' and 'advanced', 2 on 'ultra'; a dead link, bot wall or timeout is not billed.\",\n inputSchema: z.object({\n url: z\n .string()\n .describe(\n \"The page to read (1-2048 characters). http(s) only; a bare host is upgraded to https, and loopback, private, link-local and metadata hosts are rejected.\",\n ),\n format: z\n .enum([\"html\", \"markdown\", \"text\"])\n .optional()\n .describe(\n \"Output format (default 'markdown'): 'markdown' is a readability extraction with page chrome stripped, 'text' is that flattened to plain text, 'html' is the raw page.\",\n ),\n mode: z\n .enum([\"normal\", \"advanced\", \"ultra\"])\n .optional()\n .describe(\n \"Fetch tier, and the parameter that sets the price: 'normal' (default) is a plain fetch and costs 1 credit, 'advanced' renders JavaScript-built pages and costs 1, 'ultra' reaches the hardest pages and costs 2. Start on 'normal'.\",\n ),\n }),\n execute: async ({ url, format, mode }) => c.extract({ url, format, mode }),\n });\n}\n\n/** Google web search (/api/v2/google, 1 credit). */\nexport function scavioSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search the web with Google via the Scavio API (1 credit). Returns real-time organic search results, each with a title, link, and snippet, under `organic_results`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n countryCode: z.string().optional().describe('Two-letter country code to localize results, e.g. \"us\".'),\n language: z.string().optional().describe('Two-letter UI language code, e.g. \"en\".'),\n page: z.number().int().optional().describe(\"1-based result page; page 2 starts at result 10.\"),\n device: z.enum([\"desktop\", \"mobile\"]).optional().describe(\"Device to emulate.\"),\n nfpr: z.boolean().optional().describe(\"Disable spelling auto-correction / similar-result substitution when true.\"),\n }),\n execute: async ({ query, countryCode, language, page, device, nfpr }) => {\n const params: GoogleSearchOptions = { query };\n if (countryCode) params.gl = countryCode;\n if (language) params.hl = language;\n if (page && page > 1) params.start = (page - 1) * 10;\n if (device) params.device = device;\n if (nfpr !== undefined) params.nfpr = nfpr;\n return trimFlat(await c.google.search(params), \"organic_results\", max);\n },\n });\n}\n\n/** YouTube video search (2 credits). */\nexport function scavioYoutubeSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search YouTube for videos, channels, or playlists via the Scavio API (2 credits). Videos come back under `data.results`, with `data.channels` and `data.playlists` alongside.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n upload_date: z.string().optional().describe(\"Upload date filter, e.g. 'today', 'this_week', 'this_month'.\"),\n type: z.string().optional().describe(\"Result type: 'video', 'channel', 'playlist', 'movie'.\"),\n duration: z.string().optional().describe(\"Duration filter: 'short', 'medium', 'long'.\"),\n sort_by: z.string().optional().describe(\"Sort order: 'relevance', 'date', 'view_count', 'rating'.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, upload_date, type, duration, sort_by, cursor }) =>\n trimData(\n await c.youtube.search({ query, upload_date, type, duration, sort_by, cursor } as Parameters<\n typeof c.youtube.search\n >[0]),\n \"results\",\n max,\n ),\n });\n}\n\n/** YouTube video details (1 credit). */\nexport function scavioYoutubeVideo(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch full details for a YouTube video (title, author, view count, description, captions, chapters) via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n }),\n execute: async ({ video_id }) => c.youtube.video({ video_id }),\n });\n}\n\n/** YouTube video transcript / subtitles (5 credits). */\nexport function scavioYoutubeTranscript(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube video's transcript or timed subtitles via the Scavio API (5 credits).\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n language: z.string().optional().describe(\"Transcript language code (default 'en').\"),\n format: z.enum([\"text\", \"srt\"]).optional().describe(\"'text' for a plain transcript, 'srt' for timed subtitles.\"),\n }),\n execute: async ({ video_id, language, format }) =>\n c.youtube.transcript({ video_id, language, format } as Parameters<typeof c.youtube.transcript>[0]),\n });\n}\n\n/** YouTube video comments (1 credit). */\nexport function scavioYoutubeComments(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"List comments on a YouTube video via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n cursor: z.string().optional().describe(\"Pagination cursor.\"),\n }),\n execute: async ({ video_id, cursor }) =>\n trimData(\n await c.youtube.comments({ video_id, cursor } as Parameters<typeof c.youtube.comments>[0]),\n \"comments\",\n max,\n ),\n });\n}\n\n/** YouTube channel details (1 credit). */\nexport function scavioYoutubeChannel(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube channel's details (subscribers, video count, views, links) via the Scavio API.\",\n inputSchema: z.object({\n channel_id: z.string().describe(\"YouTube channel id, @handle, or channel URL.\"),\n }),\n execute: async ({ channel_id }) => c.youtube.channel({ channel_id }),\n });\n}\n\n/**\n * Reddit post search (1 credit).\n *\n * The endpoint takes `query` and `cursor` and nothing else - it cannot sort or\n * filter by type, so no such input is offered. The API silently ignores those\n * params, which would leave a model believing it had filtered when it had not.\n */\nexport function scavioRedditSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Reddit posts via the Scavio API (1 credit). Returns matching posts under `data.results` with `data.next_cursor` for the next page. Results cannot be sorted or filtered by type.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, cursor }) => trimData(await c.reddit.search({ query, cursor }), \"results\", max),\n });\n}\n\n/**\n * Amazon product search.\n *\n * `domain` was dropped in favour of `country`, a two-letter marketplace code -\n * the Amazon endpoint changed in 2026-07 and no longer takes a domain\n * suffix. It still works on the wire as a deprecated alias, but a model should\n * only ever see one spelling of a param.\n */\nexport function scavioAmazonSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Amazon for products via the Scavio API. Results are unsorted and cannot be filtered by category, merchant or price.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ query, country }) =>\n trimData(await c.amazon.search({ query, country }), \"products\", max),\n });\n}\n\n/** Every seller offer for one Amazon ASIN. */\nexport function scavioAmazonOffers(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"List every seller offer for one Amazon ASIN via the Scavio API: price, seller, condition, shipping, and which offer holds the buy box. Page 1 only.\",\n inputSchema: z.object({\n asin: z.string().describe(\"Amazon Standard Identification Number (ASIN) of the product.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ asin, country }) =>\n trimData(await c.amazon.offers({ asin, country }), \"offers\", max),\n });\n}\n\n/** Walmart product search. */\nexport function scavioWalmartSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Walmart for products via the Scavio API. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n }),\n execute: async ({ query }) => trimData(await c.walmart.search({ query }), \"products\", max),\n });\n}\n\n/** TikTok video search. */\nexport function scavioTiktokSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search TikTok for videos by keyword via the Scavio API. Videos come back under `data.aweme_list`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n sort_type: z.enum([\"0\", \"1\"]).optional().describe(\"Sort order: '0' relevance, '1' most likes.\"),\n publish_time: z\n .enum([\"0\", \"1\", \"7\", \"30\", \"90\", \"180\"])\n .optional()\n .describe(\"Publish window in days: '0' all time, '1', '7', '30', '90', '180'.\"),\n }),\n execute: async ({ keyword, sort_type, publish_time }) =>\n trimData(\n await c.tiktok.searchVideos({\n keyword,\n sort_type,\n publish_time,\n } as Parameters<typeof c.tiktok.searchVideos>[0]),\n \"aweme_list\",\n max,\n ),\n });\n}\n\n/** Instagram user search. */\nexport function scavioInstagramSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Instagram for users by keyword via the Scavio API (2 credits). Users come back under `data.users`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n }),\n execute: async ({ keyword }) => trimData(await c.instagram.searchUsers({ keyword }), \"users\", max),\n });\n}\n\n// ---------------------------------------------------------------------------\n// Website map, crawl and batch: the multi-page members of the Extract family.\n//\n// Map answers in one call. Crawl and batch are background jobs: the start tools\n// post the job, then wait up to wait_seconds (default 45, max 300) for it to\n// finish, polling progress without page content, and return the job's status\n// with its first page of results either way. A job still running when the wait\n// ends keeps going server-side; read the rest with the matching status tool.\n// ---------------------------------------------------------------------------\n\nconst JOB_POLL_INTERVAL_MS = 3_000;\nconst JOB_WAIT_DEFAULT_SECONDS = 45;\nconst JOB_WAIT_MAX_SECONDS = 300;\nconst JOB_RESULTS_DEFAULT_LIMIT = 10;\nconst JOB_TERMINAL = new Set([\"completed\", \"failed\", \"cancelled\"]);\n\ntype JobQuery = {\n cursor?: string;\n limit?: number;\n status?: \"succeeded\" | \"failed\" | \"skipped\";\n include_content?: boolean;\n};\ntype JobPayload = { data?: { id?: string; status?: string } } & Record<string, unknown>;\ntype JobStatusFn = (id: string, query: JobQuery) => Promise<unknown>;\n\n// lib is ES2022 only (no DOM or Node types); every runtime this targets has setTimeout.\ndeclare const setTimeout: (callback: () => void, ms: number) => unknown;\n\nconst sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(() => resolve(), ms));\n\n/** Poll a job (content-free) until it finishes or the wait runs out, then read one results page. */\nasync function waitForJob(\n status: JobStatusFn,\n id: string,\n waitSeconds: number,\n pollMs: number,\n query: JobQuery,\n): Promise<Record<string, unknown>> {\n const deadline = Date.now() + Math.max(0, Math.min(waitSeconds, JOB_WAIT_MAX_SECONDS)) * 1000;\n for (;;) {\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await sleep(Math.min(pollMs, remaining));\n const probe = (await status(id, { limit: 1, include_content: false })) as JobPayload;\n if (JOB_TERMINAL.has(String(probe?.data?.status))) break;\n }\n return (await status(id, query)) as Record<string, unknown>;\n}\n\n/** Start a job, then wait for it (bounded). wait_seconds 0 returns the 202 payload. */\nasync function startAndWait(\n start: () => Promise<unknown>,\n status: JobStatusFn,\n input: { wait_seconds?: number; limit?: number; include_content?: boolean },\n pollMs: number,\n): Promise<Record<string, unknown>> {\n const created = (await start()) as JobPayload;\n const id = created?.data?.id;\n const wait = input.wait_seconds ?? JOB_WAIT_DEFAULT_SECONDS;\n if (!id || wait <= 0) return created;\n const query: JobQuery = { limit: input.limit ?? JOB_RESULTS_DEFAULT_LIMIT };\n if (input.include_content !== undefined) query.include_content = input.include_content;\n return waitForJob(status, id, wait, pollMs, query);\n}\n\nconst MODE_DESCRIPTION =\n \"Fetch tier, and the parameter that sets the price: 'normal' (default) is the standard fetch, 'advanced' renders JavaScript-built pages, 'ultra' reaches the hardest pages.\";\nconst PATHS_DESCRIPTION =\n \"Path globs (max 20). '*' matches within one path segment, '**' across segments; a pattern without wildcards matches that path and everything under it. Example: ['/blog/**'].\";\nconst JOB_PRICE =\n \"Billed per SUCCESSFUL page at Extract's price for the mode: 'normal' and 'advanced' 1 credit, 'ultra' 2. Failed and skipped pages are free, and if the balance runs out the job stops cleanly.\";\n\nconst jobFields = {\n format: z.enum([\"html\", \"markdown\", \"text\"]).optional().describe(\"Format for each page, as on extract (default 'markdown').\"),\n mode: z.enum([\"normal\", \"advanced\", \"ultra\"]).optional().describe(MODE_DESCRIPTION),\n wait_seconds: z\n .number()\n .int()\n .min(0)\n .max(JOB_WAIT_MAX_SECONDS)\n .optional()\n .describe(\"Seconds to wait for the job to finish before returning, 0-300 (default 45). 0 returns the job id at once. A job still running when the wait ends keeps going; read it later with its status tool.\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\"Results per response, 1-100 (default 10, to keep page content inside the context window); page on with next_cursor.\"),\n include_content: z.boolean().optional().describe(\"Set false to list results without their page content (default true).\"),\n};\n\nconst jobStatusSchema = z.object({\n id: z.string().describe(\"Job id returned when the job was started (data.id).\"),\n cursor: z.string().optional().describe(\"next_cursor from the previous response, to read the next page.\"),\n limit: jobFields.limit,\n status: z.enum([\"succeeded\", \"failed\", \"skipped\"]).optional().describe(\"Only results with this status.\"),\n include_content: jobFields.include_content,\n});\n\n/** Map a website's URLs (/api/v1/extract/map). 1 credit on 'normal'. */\nexport function scavioMapWebsite(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"List a website's page URLs via the Scavio API, gathered from its sitemaps and its start page, deduplicated, filtered by path or search words and limited: `data.links` [{ url, source, lastmod }], `data.total_found`, `data.truncated`. Pages the site's robots.txt disallows are left out. Use it to find the right pages before extracting or crawling. Costs 1 credit on 'normal'; up to 2 on 'advanced' and up to 10 on 'ultra', priced by what the call needed.\",\n inputSchema: z.object({\n url: z.string().describe(\"The site to map. A bare host is upgraded to https.\"),\n search: z.string().optional().describe(\"Only return URLs containing every word of this text (case-insensitive).\"),\n limit: z.number().int().min(1).max(5000).optional().describe(\"Maximum links to return, 1-5000. Default 1000 (or the plan's limit if lower: Free 500, PAYG 1,000, paid plans 5,000).\"),\n sitemap: z.enum([\"include\", \"only\", \"skip\"]).optional().describe(\"'include' combines the site's sitemaps with the start page's links (default); 'only' uses sitemaps alone; 'skip' uses page links alone.\"),\n include_subdomains: z.boolean().optional().describe(\"Also return URLs on subdomains of the site (default false).\"),\n include_paths: z.array(z.string()).optional().describe(\"Keep only URLs matching these. \" + PATHS_DESCRIPTION),\n exclude_paths: z.array(z.string()).optional().describe(\"Drop URLs matching these. \" + PATHS_DESCRIPTION),\n ignore_query_parameters: z.boolean().optional().describe(\"Treat URLs that differ only by query string as one URL (default true).\"),\n mode: jobFields.mode,\n }),\n execute: async (input) =>\n (await c.extract.map(input as Parameters<typeof c.extract.map>[0])) as unknown as Record<string, unknown>,\n });\n}\n\n/** Crawl a website (/api/v1/extract/crawl), then wait (bounded) for it. */\nexport function scavioCrawlWebsite(config?: ScavioToolConfig) {\n const c = client(config);\n const pollMs = config?.pollIntervalMs ?? JOB_POLL_INTERVAL_MS;\n return tool({\n description:\n \"Crawl a website from one start URL via the Scavio API: same-site pages are discovered and extracted breadth-first within the page, depth and path limits, each returned as Markdown, text or HTML. Pages the site's robots.txt disallows are skipped. Waits up to wait_seconds (default 45) and returns `data` { id, status, pages, credits_used, results, next_cursor }; if status is still queued or running, call scavio_crawl_status with the id later. \" +\n JOB_PRICE,\n inputSchema: z.object({\n url: z.string().describe(\"Where the crawl starts. Only pages on the same site are crawled.\"),\n max_pages: z.number().int().min(1).max(10000).optional().describe(\"Maximum pages to fetch. Default 100. Plan limits: Free 10, PAYG 100, Project 500, Bootstrap 2,000, Startup 5,000, Growth 10,000.\"),\n max_depth: z.number().int().min(0).max(10).optional().describe(\"How many links away from the start page to follow, 0-10 (default 3). 0 fetches only the start page.\"),\n include_paths: z.array(z.string()).optional().describe(\"Crawl only paths matching these. \" + PATHS_DESCRIPTION),\n exclude_paths: z.array(z.string()).optional().describe(\"Skip paths matching these. \" + PATHS_DESCRIPTION),\n allow_subdomains: z.boolean().optional().describe(\"Also crawl subdomains of the site (default false).\"),\n ignore_query_parameters: z.boolean().optional().describe(\"Treat URLs that differ only by query string as one page (default true).\"),\n sitemap: z.enum([\"include\", \"skip\", \"only\"]).optional().describe(\"'include' also starts from the site's sitemap (default); 'skip' follows links only; 'only' fetches sitemap pages without following links.\"),\n ...jobFields,\n }),\n execute: async (input) => {\n const { wait_seconds, limit, include_content, ...body } = input;\n return startAndWait(\n () => c.extract.crawl(body as Parameters<typeof c.extract.crawl>[0]),\n (id, q) => c.extract.crawlStatus(id, q),\n { wait_seconds, limit, include_content },\n pollMs,\n );\n },\n });\n}\n\n/** A crawl's progress and page results (GET /api/v1/extract/crawl/{id}). Free. */\nexport function scavioCrawlStatus(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read a crawl's progress and its page results by job id via the Scavio API, paged by cursor: `data` { status, stopped_reason, pages, credits_used, results: [{ url, status, content }], next_cursor }. Results are kept for 3 days after the crawl finishes. Free: reading a job costs 0 credits.\",\n inputSchema: jobStatusSchema,\n execute: async ({ id, limit, ...q }) =>\n (await c.extract.crawlStatus(id, { ...q, limit: limit ?? JOB_RESULTS_DEFAULT_LIMIT })) as unknown as Record<string, unknown>,\n });\n}\n\n/** Extract a list of URLs in one job (/api/v1/extract/batch), then wait (bounded). */\nexport function scavioBatchExtract(config?: ScavioToolConfig) {\n const c = client(config);\n const pollMs = config?.pollIntervalMs ?? JOB_POLL_INTERVAL_MS;\n return tool({\n description:\n \"Extract a list of URLs (up to 1,000, plan-limited) in one job via the Scavio API, each returned as Markdown, text or HTML exactly like scavio_extract. Waits up to wait_seconds (default 45) and returns `data` { id, status, pages, credits_used, results, next_cursor }; if status is still queued or running, call scavio_batch_status with the id later. \" +\n JOB_PRICE,\n inputSchema: z.object({\n urls: z.array(z.string()).min(1).max(1000).describe(\"The pages to extract (duplicates removed). Plan limits: Free 10, PAYG 50, Project 100, Bootstrap 500, Startup and Growth 1,000.\"),\n ...jobFields,\n }),\n execute: async (input) => {\n const { wait_seconds, limit, include_content, ...body } = input;\n return startAndWait(\n () => c.extract.batch(body as Parameters<typeof c.extract.batch>[0]),\n (id, q) => c.extract.batchStatus(id, q),\n { wait_seconds, limit, include_content },\n pollMs,\n );\n },\n });\n}\n\n/** A batch's progress and page results (GET /api/v1/extract/batch/{id}). Free. */\nexport function scavioBatchStatus(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Read a batch extract's progress and its page results by job id via the Scavio API, paged by cursor: `data` { status, pages, credits_used, results: [{ url, status, content }], next_cursor }. Results are kept for 3 days after the batch finishes. Free: reading a job costs 0 credits.\",\n inputSchema: jobStatusSchema,\n execute: async ({ id, limit, ...q }) =>\n (await c.extract.batchStatus(id, { ...q, limit: limit ?? JOB_RESULTS_DEFAULT_LIMIT })) as unknown as Record<string, unknown>,\n });\n}\n\n/** HEB grocery product search. */\nexport function scavioHebSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search HEB grocery products via the Scavio API: price, sale status, unit price, UPC, stock, EBT/SNAP eligibility. Pass store_id for one store's prices, stock and assortment. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"Search keywords (1-200 characters).\"),\n page: z.number().optional().describe(\"Results page, 1-based.\"),\n page_size: z.number().optional().describe(\"Results per page, 1-60. Defaults to 60.\"),\n store_id: z.string().optional().describe(\"HEB store number from the HEB stores tool (store_number), e.g. '441'. Prices, stock, aisle location and assortment come from that store; the store used is echoed in data.store {store_id, name}. US only. Omit for HEB's default store.\"),\n }),\n execute: async (input) => trimData(await c.heb.search(input), \"products\", max),\n });\n}\n\n/** HEB product detail. */\nexport function scavioHebProduct(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description: \"Full HEB product detail via the Scavio API: nutrition, ingredients, images, coupons, EBT/SNAP eligibility. With store_id, price, stock and aisle are for that store and product_id alone works.\",\n inputSchema: z.object({\n product_url: z.string().optional().describe(\"Full or relative product URL from heb.com. Preferred.\"),\n product_id: z.string().optional().describe(\"HEB product id. Needs slug, unless store_id is set (then product_id alone works).\"),\n slug: z.string().optional().describe(\"Product slug. Required with product_id unless store_id is set.\"),\n store_id: z.string().optional().describe(\"HEB store number from the HEB stores tool (store_number), e.g. '441'. Prices, stock, aisle location and assortment come from that store; the store used is echoed in data.store {store_id, name}. US only. Omit for HEB's default store.\"),\n }),\n execute: async (input) => (await c.heb.product(input)) as Record<string, unknown>,\n });\n}\n\n/** HEB store locator. */\nexport function scavioHebStores(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Find HEB stores near a ZIP code or city via the Scavio API. Stores come back under `data.stores`.\",\n inputSchema: z.object({\n zip: z.string().optional().describe(\"5-digit US ZIP code.\"),\n city: z.string().optional().describe(\"City name. Pass zip or city.\"),\n }),\n execute: async (input) => trimData(await c.heb.stores(input), \"stores\", max),\n });\n}\n\n/** Kroger grocery product search. */\nexport function scavioKrogerSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Kroger grocery products via the Scavio API: price, promo deals, UPC, stock, SNAP eligibility, dietary info. Kroger operates Kroger, Ralphs, Fred Meyer, Harris Teeter, King Soopers and Fry's. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"Search keywords (1-200 characters).\"),\n page: z.number().optional().describe(\"Results page, 1-based.\"),\n }),\n execute: async (input) => trimData(await c.kroger.search(input), \"products\", max),\n });\n}\n\n/** Kroger product detail. */\nexport function scavioKrogerProduct(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description: \"Full Kroger product detail via the Scavio API: nutrition, allergens, ingredients, images, rating, dietary flags, SNAP eligibility.\",\n inputSchema: z.object({\n product_url: z.string().optional().describe(\"Full or relative product URL from kroger.com. Preferred.\"),\n upc: z.string().optional().describe(\"Kroger product UPC.\"),\n slug: z.string().optional().describe(\"Product slug. Optional with upc.\"),\n }),\n execute: async (input) => (await c.kroger.product(input)) as Record<string, unknown>,\n });\n}\n\n/** Decathlon product search across 7 country domains. */\nexport function scavioDecathlonSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Decathlon products by keyword via the Scavio API across 7 country domains (FR, ES, IT, IN, UK, PT, NET). Returns product name, brand, price (cents), currency, availability, rating, review count and image. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"Search keywords (1-200 characters).\"),\n country: z.enum([\"fr\", \"es\", \"it\", \"in\", \"uk\", \"pt\", \"net\"]).describe(\"Country domain.\"),\n page: z.number().optional().describe(\"Results page, 1-based (1-50).\"),\n }),\n execute: async (input) => trimData(await c.decathlon.search(input), \"products\", max),\n });\n}\n\n/** Decathlon product detail. */\nexport function scavioDecathlonProduct(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description: \"Full Decathlon product detail via the Scavio API: description, images, SKU, GTIN, color, price (cents), list price, availability, offers/variants, rating, review count, category and breadcrumbs.\",\n inputSchema: z.object({\n product_url: z.string().optional().describe(\"Full or relative product URL from any Decathlon domain. Preferred.\"),\n product_id: z.string().optional().describe(\"Decathlon numeric product ID.\"),\n country: z.enum([\"fr\", \"es\", \"it\", \"in\", \"uk\", \"pt\", \"net\"]).describe(\"Country domain.\"),\n }),\n execute: async (input) => (await c.decathlon.product(input)) as Record<string, unknown>,\n });\n}\n\n/**\n * All Scavio tools as an object keyed by tool name, ready to spread into the\n * `tools` option of `generateText` / `streamText`.\n */\nexport function scavioTools(config?: ScavioToolConfig) {\n return {\n scavio_extract: scavioExtract(config),\n scavio_search: scavioSearch(config),\n scavio_youtube_search: scavioYoutubeSearch(config),\n scavio_youtube_video: scavioYoutubeVideo(config),\n scavio_youtube_transcript: scavioYoutubeTranscript(config),\n scavio_youtube_comments: scavioYoutubeComments(config),\n scavio_youtube_channel: scavioYoutubeChannel(config),\n scavio_reddit_search: scavioRedditSearch(config),\n scavio_amazon_search: scavioAmazonSearch(config),\n scavio_amazon_offers: scavioAmazonOffers(config),\n scavio_walmart_search: scavioWalmartSearch(config),\n scavio_tiktok_search: scavioTiktokSearch(config),\n scavio_instagram_search: scavioInstagramSearch(config),\n scavio_heb_search: scavioHebSearch(config),\n scavio_heb_product: scavioHebProduct(config),\n scavio_heb_stores: scavioHebStores(config),\n scavio_kroger_search: scavioKrogerSearch(config),\n scavio_kroger_product: scavioKrogerProduct(config),\n scavio_decathlon_search: scavioDecathlonSearch(config),\n scavio_decathlon_product: scavioDecathlonProduct(config),\n ...(config?.enableCrawl\n ? {\n scavio_map_website: scavioMapWebsite(config),\n scavio_crawl_website: scavioCrawlWebsite(config),\n scavio_crawl_status: scavioCrawlStatus(config),\n scavio_batch_extract: scavioBatchExtract(config),\n scavio_batch_status: scavioBatchStatus(config),\n }\n : {}),\n };\n}\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,SAAS;AAClB,SAAS,cAA2D;AAmBpE,SAAS,OAAO,QAAmC;AACjD,SAAO,IAAI,OAAO,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAC9C;AAMA,SAAS,SAAS,KAA8B,KAAa,KAAsC;AACjG,QAAM,OAAO,IAAI,GAAG;AACpB,MAAI,MAAM,QAAQ,IAAI,KAAK,KAAK,SAAS,KAAK;AAC5C,WAAO,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,KAAK,MAAM,GAAG,GAAG,EAAE;AAAA,EAC7C;AACA,SAAO;AACT;AAQA,SAAS,SAAS,KAA8B,KAAa,KAAsC;AACjG,QAAM,OAAO,IAAI;AACjB,MAAI,CAAC,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC9C,QAAM,OAAQ,KAAiC,GAAG;AAClD,MAAI,MAAM,QAAQ,IAAI,KAAK,KAAK,SAAS,KAAK;AAC5C,WAAO,EAAE,GAAG,KAAK,MAAM,EAAE,GAAI,MAAkC,CAAC,GAAG,GAAG,KAAK,MAAM,GAAG,GAAG,EAAE,EAAE;AAAA,EAC7F;AACA,SAAO;AACT;AAaO,SAAS,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sB,MAAM;AAAA,IACrD,wBAAwB,qBAAqB,MAAM;AAAA,IACnD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,yBAAyB,sBAAsB,MAAM;AAAA,IACrD,mBAAmB,gBAAgB,MAAM;AAAA,IACzC,oBAAoB,iBAAiB,MAAM;AAAA,IAC3C,mBAAmB,gBAAgB,MAAM;AAAA,IACzC,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,yBAAyB,sBAAsB,MAAM;AAAA,IACrD,0BAA0B,uBAAuB,MAAM;AAAA,IACvD,GAAI,QAAQ,cACR;AAAA,MACE,oBAAoB,iBAAiB,MAAM;AAAA,MAC3C,sBAAsB,mBAAmB,MAAM;AAAA,MAC/C,qBAAqB,kBAAkB,MAAM;AAAA,MAC7C,sBAAsB,mBAAmB,MAAM;AAAA,MAC/C,qBAAqB,kBAAkB,MAAM;AAAA,IAC/C,IACA,CAAC;AAAA,EACP;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scavio/ai-sdk",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "Scavio search, URL-extraction and website crawl tools for the Vercel AI SDK (extract any URL, map, crawl and batch-extract sites, plus Google, YouTube, Reddit, Amazon, Walmart, TikTok, Instagram).",
|
|
3
|
+
"version": "0.5.5",
|
|
4
|
+
"description": "Scavio search, URL-extraction and website crawl tools for the Vercel AI SDK (extract any URL, map, crawl and batch-extract sites, plus Google, YouTube, Reddit, Amazon, Walmart, HEB, Kroger, TikTok, Instagram).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"zod": ">=3"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"scavio": "^0.
|
|
56
|
+
"scavio": "^0.28.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@ai-sdk/openai": "^3.0.74",
|
|
60
60
|
"ai": "^6.0.208",
|
|
61
|
-
"scavio": "^0.
|
|
61
|
+
"scavio": "^0.28.1",
|
|
62
62
|
"tsup": "^8.0.0",
|
|
63
63
|
"typescript": "^5.4.0",
|
|
64
64
|
"vitest": "^2.0.0",
|