alterlab-mcp-server 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -33
- package/dist/auth.d.ts +30 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +423 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +23 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +61 -3
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +21 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +85 -8
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +6 -4
- package/dist/errors.js.map +1 -1
- package/dist/format.d.ts +20 -2
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +187 -9
- package/dist/format.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -2
- package/dist/index.js.map +1 -1
- package/dist/tools/balance.d.ts.map +1 -1
- package/dist/tools/balance.js +4 -2
- package/dist/tools/balance.js.map +1 -1
- package/dist/tools/batch.d.ts +1221 -25
- package/dist/tools/batch.d.ts.map +1 -1
- package/dist/tools/batch.js +123 -34
- package/dist/tools/batch.js.map +1 -1
- package/dist/tools/common.d.ts +313 -0
- package/dist/tools/common.d.ts.map +1 -0
- package/dist/tools/common.js +336 -0
- package/dist/tools/common.js.map +1 -0
- package/dist/tools/crawl.d.ts +165 -10
- package/dist/tools/crawl.d.ts.map +1 -1
- package/dist/tools/crawl.js +191 -43
- package/dist/tools/crawl.js.map +1 -1
- package/dist/tools/estimate.d.ts +21 -6
- package/dist/tools/estimate.d.ts.map +1 -1
- package/dist/tools/estimate.js +28 -35
- package/dist/tools/estimate.js.map +1 -1
- package/dist/tools/extract.d.ts +5 -5
- package/dist/tools/extract.d.ts.map +1 -1
- package/dist/tools/extract.js +16 -12
- package/dist/tools/extract.js.map +1 -1
- package/dist/tools/job.d.ts +13 -0
- package/dist/tools/job.d.ts.map +1 -0
- package/dist/tools/job.js +62 -0
- package/dist/tools/job.js.map +1 -0
- package/dist/tools/map.d.ts +5 -2
- package/dist/tools/map.d.ts.map +1 -1
- package/dist/tools/map.js +16 -5
- package/dist/tools/map.js.map +1 -1
- package/dist/tools/scrape.d.ts +431 -49
- package/dist/tools/scrape.d.ts.map +1 -1
- package/dist/tools/scrape.js +267 -135
- package/dist/tools/scrape.js.map +1 -1
- package/dist/tools/screenshot.d.ts +33 -0
- package/dist/tools/screenshot.d.ts.map +1 -1
- package/dist/tools/screenshot.js +60 -10
- package/dist/tools/screenshot.js.map +1 -1
- package/dist/tools/search.d.ts +11 -5
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +22 -6
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/sessions.d.ts +180 -12
- package/dist/tools/sessions.d.ts.map +1 -1
- package/dist/tools/sessions.js +75 -21
- package/dist/tools/sessions.js.map +1 -1
- package/dist/tools/simple_batch.d.ts +28 -0
- package/dist/tools/simple_batch.d.ts.map +1 -0
- package/dist/tools/simple_batch.js +142 -0
- package/dist/tools/simple_batch.js.map +1 -0
- package/dist/tools/usage.d.ts +7 -0
- package/dist/tools/usage.d.ts.map +1 -0
- package/dist/tools/usage.js +42 -0
- package/dist/tools/usage.js.map +1 -0
- package/dist/types.d.ts +219 -21
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +5 -3
- package/server.json +40 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../src/tools/batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../src/tools/batch.ts"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
3
|
-
exports.batchStatusDescription = exports.batchStatusSchema = exports.batchDescription = exports.batchSchema = void 0;
|
|
3
|
+
exports.batchStatusDescription = exports.batchStatusSchema = exports.batchDescription = exports.batchSchema = exports.batchItemSchema = void 0;
|
|
4
|
+
exports.buildBatchItem = buildBatchItem;
|
|
4
5
|
exports.handleBatch = handleBatch;
|
|
5
6
|
exports.handleBatchStatus = handleBatchStatus;
|
|
6
7
|
const zod_1 = require("zod");
|
|
7
8
|
const errors_js_1 = require("../errors.js");
|
|
9
|
+
const common_js_1 = require("./common.js");
|
|
8
10
|
// ============================================================================
|
|
9
11
|
// Submit Batch
|
|
10
12
|
// ============================================================================
|
|
11
|
-
|
|
12
|
-
url: zod_1.z.string().url().describe("URL to scrape"),
|
|
13
|
-
mode:
|
|
14
|
-
|
|
15
|
-
.
|
|
13
|
+
exports.batchItemSchema = zod_1.z.object({
|
|
14
|
+
url: zod_1.z.string().url().max(2083).describe("URL to scrape"),
|
|
15
|
+
mode: common_js_1.modeEnum.optional().describe("Scraping mode for this URL (API default auto)"),
|
|
16
|
+
method: zod_1.z
|
|
17
|
+
.enum(["GET", "POST"])
|
|
16
18
|
.optional()
|
|
17
|
-
.describe("
|
|
19
|
+
.describe("HTTP method for this URL. POST costs 1.5x the base tier price."),
|
|
20
|
+
body: zod_1.z.string().optional().describe("Request body for POST requests to this URL"),
|
|
21
|
+
content_type: common_js_1.contentTypeEnum
|
|
22
|
+
.optional()
|
|
23
|
+
.describe("Content-Type of the POST body for this URL"),
|
|
18
24
|
formats: zod_1.z
|
|
19
|
-
.array(
|
|
25
|
+
.array(common_js_1.allFormatEnum)
|
|
20
26
|
.optional()
|
|
21
|
-
.describe("Output formats for this URL
|
|
27
|
+
.describe("Output formats for this URL. " + common_js_1.FORMATS_DESCRIPTION),
|
|
22
28
|
extraction_schema: zod_1.z
|
|
23
29
|
.record(zod_1.z.unknown())
|
|
24
30
|
.optional()
|
|
25
31
|
.describe("JSON schema for structured extraction from this URL"),
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
extraction_prompt: zod_1.z
|
|
33
|
+
.string()
|
|
34
|
+
.max(2000)
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("Natural language extraction instruction for this URL"),
|
|
37
|
+
extraction_provider: common_js_1.extractionProviderEnum
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("BYOK LLM provider for extraction on this URL"),
|
|
40
|
+
extraction_profile: common_js_1.extractionProfileEnum
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Pre-built extraction profile for this URL (mutually exclusive with extraction_template)"),
|
|
43
|
+
extraction_template: common_js_1.extractionProfileEnum
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Alias for extraction_profile (mutually exclusive with it)"),
|
|
46
|
+
advanced: zod_1.z
|
|
47
|
+
.object({
|
|
48
|
+
...common_js_1.advancedShape,
|
|
49
|
+
screenshot: zod_1.z
|
|
50
|
+
.boolean()
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("Capture a full-page screenshot of this URL (+$0.0002, requires render_js)"),
|
|
53
|
+
markdown: zod_1.z
|
|
54
|
+
.boolean()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe("Extract content as Markdown for this URL (free)"),
|
|
57
|
+
})
|
|
58
|
+
.optional()
|
|
59
|
+
.describe("Advanced scrape options for this URL (render_js, use_proxy, use_own_proxy, actions, session_id, " +
|
|
60
|
+
"cookies, skip_tls_verification, sticky_session, ...). Same fields as the alterlab_scrape parameters of the same name."),
|
|
61
|
+
location: common_js_1.locationSchema
|
|
62
|
+
.optional()
|
|
63
|
+
.describe("Geo-targeting for this URL (country, language)"),
|
|
64
|
+
cost_controls: common_js_1.costControlsSchema
|
|
65
|
+
.optional()
|
|
66
|
+
.describe("Cost and tier controls for this URL (max_tier, force_tier, max_credits, ...)"),
|
|
67
|
+
render_js: zod_1.z
|
|
68
|
+
.union([zod_1.z.boolean(), zod_1.z.literal("auto")])
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Shortcut for advanced.render_js for this URL"),
|
|
71
|
+
use_proxy: zod_1.z
|
|
72
|
+
.boolean()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe("Shortcut for advanced.use_proxy for this URL"),
|
|
28
75
|
timeout: zod_1.z
|
|
29
76
|
.number()
|
|
30
77
|
.int()
|
|
31
78
|
.min(1)
|
|
32
79
|
.max(300)
|
|
33
|
-
.default(90)
|
|
34
80
|
.optional()
|
|
35
|
-
.describe("Timeout in seconds for this URL"),
|
|
81
|
+
.describe("Timeout in seconds for this URL (1-300, API default 90)"),
|
|
36
82
|
wait_for: zod_1.z
|
|
37
83
|
.string()
|
|
38
84
|
.optional()
|
|
39
85
|
.describe("CSS selector to wait for before extracting content"),
|
|
40
|
-
cache: zod_1.z
|
|
86
|
+
cache: zod_1.z.boolean().optional().describe("Enable caching for this URL"),
|
|
87
|
+
include_raw_html: zod_1.z
|
|
41
88
|
.boolean()
|
|
42
|
-
.default(false)
|
|
43
89
|
.optional()
|
|
44
|
-
.describe("
|
|
90
|
+
.describe("Include raw HTML in the result for this URL"),
|
|
45
91
|
});
|
|
46
92
|
exports.batchSchema = zod_1.z.object({
|
|
47
93
|
urls: zod_1.z
|
|
48
|
-
.array(batchItemSchema)
|
|
94
|
+
.array(exports.batchItemSchema)
|
|
49
95
|
.min(1)
|
|
50
96
|
.max(100)
|
|
51
97
|
.describe("List of URLs to scrape (max 100)"),
|
|
98
|
+
session_id: zod_1.z
|
|
99
|
+
.string()
|
|
100
|
+
.uuid()
|
|
101
|
+
.optional()
|
|
102
|
+
.describe("UUID of a stored session applied to every URL in the batch (see alterlab_list_sessions)"),
|
|
52
103
|
webhook_url: zod_1.z
|
|
53
104
|
.string()
|
|
54
105
|
.url()
|
|
106
|
+
.max(2083)
|
|
55
107
|
.optional()
|
|
56
108
|
.describe("Webhook URL to receive batch.completed event when all jobs finish"),
|
|
109
|
+
export: zod_1.z
|
|
110
|
+
.object({
|
|
111
|
+
integration_id: zod_1.z
|
|
112
|
+
.string()
|
|
113
|
+
.describe("ID of a storage integration (S3/R2/GCS) configured in the dashboard"),
|
|
114
|
+
prefix: zod_1.z.string().max(500).optional().describe("Object key prefix for exported files"),
|
|
115
|
+
format: zod_1.z.enum(["jsonl", "csv", "json"]).optional().describe("Export file format (API default jsonl)"),
|
|
116
|
+
})
|
|
117
|
+
.optional()
|
|
118
|
+
.describe("Export batch results to a storage integration when the batch finishes"),
|
|
119
|
+
extraction_schema: zod_1.z
|
|
120
|
+
.record(zod_1.z.unknown())
|
|
121
|
+
.optional()
|
|
122
|
+
.describe("Batch-level JSON schema for structured extraction applied to every URL"),
|
|
123
|
+
extraction_prompt: zod_1.z
|
|
124
|
+
.string()
|
|
125
|
+
.max(2000)
|
|
126
|
+
.optional()
|
|
127
|
+
.describe("Batch-level natural language extraction instruction"),
|
|
128
|
+
extraction_provider: common_js_1.extractionProviderEnum
|
|
129
|
+
.optional()
|
|
130
|
+
.describe("Batch-level BYOK LLM provider for extraction"),
|
|
131
|
+
extraction_profile: common_js_1.batchExtractionProfileEnum
|
|
132
|
+
.optional()
|
|
133
|
+
.describe("Batch-level pre-built extraction profile applied to every URL"),
|
|
57
134
|
});
|
|
58
|
-
exports.batchDescription = "
|
|
135
|
+
exports.batchDescription = "Scrape up to 100 URLs in parallel with a single request — much faster and more efficient than sequential alterlab_scrape calls. " +
|
|
136
|
+
"Each URL automatically gets anti-bot bypass protection (Cloudflare, DataDome, etc.) at its own tier level " +
|
|
137
|
+
"(tier 1 $0.0002 ... tier 4 $0.004 per URL). " +
|
|
59
138
|
"Returns a batch_id immediately — use alterlab_batch_status to poll results. " +
|
|
60
|
-
"Each URL can have its own mode, formats,
|
|
139
|
+
"Each URL can have its own mode, method/body, formats, extraction options, advanced options, location and cost_controls. " +
|
|
140
|
+
"Batch-level session_id, extraction_* and export apply to the whole batch. " +
|
|
61
141
|
"Credits are pre-debited based on estimated cost; unused credits are refunded on completion. " +
|
|
62
|
-
"Use this
|
|
142
|
+
"Use this whenever you need to scrape more than 2-3 URLs.";
|
|
143
|
+
/** Translate a batch item's tool parameters into the API's BatchItemRequest. Exported for tests. */
|
|
144
|
+
function buildBatchItem(item) {
|
|
145
|
+
const { render_js, use_proxy, advanced, ...rest } = item;
|
|
146
|
+
const mergedAdvanced = (0, common_js_1.compact)({
|
|
147
|
+
...(advanced ?? {}),
|
|
148
|
+
...(render_js !== undefined && advanced?.render_js === undefined ? { render_js } : {}),
|
|
149
|
+
...(use_proxy !== undefined && advanced?.use_proxy === undefined ? { use_proxy } : {}),
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
...(0, common_js_1.compact)(rest),
|
|
153
|
+
...(Object.keys(mergedAdvanced).length > 0 ? { advanced: mergedAdvanced } : {}),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
63
156
|
async function handleBatch(client, params) {
|
|
64
157
|
try {
|
|
65
158
|
const response = await client.submitBatch({
|
|
66
|
-
urls: params.urls.map(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
use_proxy: item.use_proxy,
|
|
77
|
-
},
|
|
78
|
-
})),
|
|
79
|
-
webhook_url: params.webhook_url,
|
|
159
|
+
urls: params.urls.map(buildBatchItem),
|
|
160
|
+
...(0, common_js_1.compact)({
|
|
161
|
+
session_id: params.session_id,
|
|
162
|
+
webhook_url: params.webhook_url,
|
|
163
|
+
export: params.export,
|
|
164
|
+
extraction_schema: params.extraction_schema,
|
|
165
|
+
extraction_prompt: params.extraction_prompt,
|
|
166
|
+
extraction_provider: params.extraction_provider,
|
|
167
|
+
extraction_profile: params.extraction_profile,
|
|
168
|
+
}),
|
|
80
169
|
});
|
|
81
170
|
const text = `**Batch Submitted**\n\n` +
|
|
82
171
|
`- Batch ID: \`${response.batch_id}\`\n` +
|
package/dist/tools/batch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch.js","sourceRoot":"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KAAK,GAAG,cAAc,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,QAAQ,IAAI,KAAK;QACjB,OAAQ,KAAkB,CAAC,MAAM,KAAK,QAAQ,CAC/C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Zod building blocks shared by several tools. Enum values, bounds and field
|
|
4
|
+
* names mirror the AlterLab OpenAPI request schemas; the schema-parity test
|
|
5
|
+
* (test/schema-parity.test.mjs) fails when they drift from spec/request-schemas.json.
|
|
6
|
+
*/
|
|
7
|
+
export declare const tierEnum: z.ZodEnum<["1", "2", "3", "3.5", "4"]>;
|
|
8
|
+
export declare const extractionProfileEnum: z.ZodEnum<["auto", "product", "article", "job_posting", "faq", "recipe", "event", "ecommerce_homepage", "directory_listing"]>;
|
|
9
|
+
/** Batch-level extraction_profile only accepts the original seven profiles. */
|
|
10
|
+
export declare const batchExtractionProfileEnum: z.ZodEnum<["auto", "product", "article", "job_posting", "faq", "recipe", "event"]>;
|
|
11
|
+
export declare const extractionProviderEnum: z.ZodEnum<["openai", "anthropic", "openrouter", "groq"]>;
|
|
12
|
+
export declare const modeEnum: z.ZodEnum<["auto", "html", "js", "pdf", "ocr"]>;
|
|
13
|
+
export declare const contentTypeEnum: z.ZodEnum<["application/json", "application/x-www-form-urlencoded", "text/plain", "application/graphql"]>;
|
|
14
|
+
/** Output formats accepted by scrape, extract, batch items and estimate. */
|
|
15
|
+
export declare const allFormatEnum: z.ZodEnum<["text", "json", "json_v2", "html", "markdown", "rag", "content", "raw"]>;
|
|
16
|
+
/** Output formats accepted by crawl and search (no "raw"). */
|
|
17
|
+
export declare const crawlFormatEnum: z.ZodEnum<["text", "json", "json_v2", "html", "markdown", "rag", "content"]>;
|
|
18
|
+
export declare const FORMATS_DESCRIPTION: string;
|
|
19
|
+
export declare const locationSchema: z.ZodObject<{
|
|
20
|
+
country: z.ZodOptional<z.ZodString>;
|
|
21
|
+
language: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
country?: string | undefined;
|
|
24
|
+
language?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
country?: string | undefined;
|
|
27
|
+
language?: string | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const costControlsSchema: z.ZodObject<{
|
|
30
|
+
force_tier: z.ZodOptional<z.ZodEnum<["1", "2", "3", "3.5", "4"]>>;
|
|
31
|
+
max_tier: z.ZodOptional<z.ZodEnum<["1", "2", "3", "3.5", "4"]>>;
|
|
32
|
+
max_credits: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
prefer_cost: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
prefer_speed: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
fail_fast: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
time_budget: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
force_tier?: "1" | "2" | "3" | "3.5" | "4" | undefined;
|
|
39
|
+
max_tier?: "1" | "2" | "3" | "3.5" | "4" | undefined;
|
|
40
|
+
max_credits?: number | undefined;
|
|
41
|
+
prefer_cost?: boolean | undefined;
|
|
42
|
+
prefer_speed?: boolean | undefined;
|
|
43
|
+
fail_fast?: boolean | undefined;
|
|
44
|
+
time_budget?: number | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
force_tier?: "1" | "2" | "3" | "3.5" | "4" | undefined;
|
|
47
|
+
max_tier?: "1" | "2" | "3" | "3.5" | "4" | undefined;
|
|
48
|
+
max_credits?: number | undefined;
|
|
49
|
+
prefer_cost?: boolean | undefined;
|
|
50
|
+
prefer_speed?: boolean | undefined;
|
|
51
|
+
fail_fast?: boolean | undefined;
|
|
52
|
+
time_budget?: number | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
55
|
+
type: z.ZodLiteral<"wait">;
|
|
56
|
+
milliseconds: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
type: "wait";
|
|
60
|
+
milliseconds?: number | undefined;
|
|
61
|
+
selector?: string | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
type: "wait";
|
|
64
|
+
milliseconds?: number | undefined;
|
|
65
|
+
selector?: string | undefined;
|
|
66
|
+
}>, z.ZodObject<{
|
|
67
|
+
type: z.ZodLiteral<"wait_for">;
|
|
68
|
+
selector: z.ZodString;
|
|
69
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
type: "wait_for";
|
|
72
|
+
selector: string;
|
|
73
|
+
timeout?: number | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
type: "wait_for";
|
|
76
|
+
selector: string;
|
|
77
|
+
timeout?: number | undefined;
|
|
78
|
+
}>, z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"click">;
|
|
80
|
+
selector: z.ZodString;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
type: "click";
|
|
83
|
+
selector: string;
|
|
84
|
+
}, {
|
|
85
|
+
type: "click";
|
|
86
|
+
selector: string;
|
|
87
|
+
}>, z.ZodObject<{
|
|
88
|
+
type: z.ZodLiteral<"fill">;
|
|
89
|
+
selector: z.ZodString;
|
|
90
|
+
value: z.ZodString;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
type: "fill";
|
|
93
|
+
value: string;
|
|
94
|
+
selector: string;
|
|
95
|
+
}, {
|
|
96
|
+
type: "fill";
|
|
97
|
+
value: string;
|
|
98
|
+
selector: string;
|
|
99
|
+
}>, z.ZodObject<{
|
|
100
|
+
type: z.ZodLiteral<"press">;
|
|
101
|
+
key: z.ZodString;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
type: "press";
|
|
104
|
+
key: string;
|
|
105
|
+
}, {
|
|
106
|
+
type: "press";
|
|
107
|
+
key: string;
|
|
108
|
+
}>, z.ZodObject<{
|
|
109
|
+
type: z.ZodLiteral<"scroll">;
|
|
110
|
+
direction: z.ZodOptional<z.ZodEnum<["down", "up"]>>;
|
|
111
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
type: "scroll";
|
|
114
|
+
direction?: "down" | "up" | undefined;
|
|
115
|
+
amount?: number | undefined;
|
|
116
|
+
}, {
|
|
117
|
+
type: "scroll";
|
|
118
|
+
direction?: "down" | "up" | undefined;
|
|
119
|
+
amount?: number | undefined;
|
|
120
|
+
}>, z.ZodObject<{
|
|
121
|
+
type: z.ZodLiteral<"infinite_scroll">;
|
|
122
|
+
max_scrolls: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
delay: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
end_selector: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, "strip", z.ZodTypeAny, {
|
|
126
|
+
type: "infinite_scroll";
|
|
127
|
+
max_scrolls?: number | undefined;
|
|
128
|
+
delay?: number | undefined;
|
|
129
|
+
end_selector?: string | undefined;
|
|
130
|
+
}, {
|
|
131
|
+
type: "infinite_scroll";
|
|
132
|
+
max_scrolls?: number | undefined;
|
|
133
|
+
delay?: number | undefined;
|
|
134
|
+
end_selector?: string | undefined;
|
|
135
|
+
}>, z.ZodObject<{
|
|
136
|
+
type: z.ZodLiteral<"screenshot">;
|
|
137
|
+
full_page: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
type: "screenshot";
|
|
140
|
+
full_page?: boolean | undefined;
|
|
141
|
+
}, {
|
|
142
|
+
type: "screenshot";
|
|
143
|
+
full_page?: boolean | undefined;
|
|
144
|
+
}>, z.ZodObject<{
|
|
145
|
+
type: z.ZodLiteral<"evaluate">;
|
|
146
|
+
script: z.ZodString;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
type: "evaluate";
|
|
149
|
+
script: string;
|
|
150
|
+
}, {
|
|
151
|
+
type: "evaluate";
|
|
152
|
+
script: string;
|
|
153
|
+
}>]>;
|
|
154
|
+
export declare const sectionFilterSchema: z.ZodObject<{
|
|
155
|
+
min_content_blocks: z.ZodOptional<z.ZodNumber>;
|
|
156
|
+
exclude_content_types: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
157
|
+
content_only: z.ZodOptional<z.ZodBoolean>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
min_content_blocks?: number | undefined;
|
|
160
|
+
exclude_content_types?: string[] | undefined;
|
|
161
|
+
content_only?: boolean | undefined;
|
|
162
|
+
}, {
|
|
163
|
+
min_content_blocks?: number | undefined;
|
|
164
|
+
exclude_content_types?: string[] | undefined;
|
|
165
|
+
content_only?: boolean | undefined;
|
|
166
|
+
}>;
|
|
167
|
+
/**
|
|
168
|
+
* Fields of the API's `advanced` object for scrape requests. scrape spreads
|
|
169
|
+
* these as flat tool parameters; batch items nest them under `advanced`.
|
|
170
|
+
* `markdown` is intentionally absent: it is derived from `formats`.
|
|
171
|
+
* `screenshot` is the top-level scrape field the API promotes into advanced.
|
|
172
|
+
*/
|
|
173
|
+
export declare const advancedShape: {
|
|
174
|
+
render_js: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"auto">]>>;
|
|
175
|
+
use_proxy: z.ZodOptional<z.ZodBoolean>;
|
|
176
|
+
use_own_proxy: z.ZodOptional<z.ZodBoolean>;
|
|
177
|
+
use_system_proxy: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
proxy_integration_id: z.ZodOptional<z.ZodString>;
|
|
179
|
+
proxy_country: z.ZodOptional<z.ZodString>;
|
|
180
|
+
wait_condition: z.ZodOptional<z.ZodString>;
|
|
181
|
+
remove_cookie_banners: z.ZodOptional<z.ZodBoolean>;
|
|
182
|
+
include_iframes: z.ZodOptional<z.ZodBoolean>;
|
|
183
|
+
flatten_shadow_dom: z.ZodOptional<z.ZodBoolean>;
|
|
184
|
+
skip_tls_verification: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
+
block_images: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
scroll_to_load: z.ZodOptional<z.ZodBoolean>;
|
|
187
|
+
scroll_count: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
generate_pdf: z.ZodOptional<z.ZodBoolean>;
|
|
189
|
+
ocr: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
+
section_filter: z.ZodOptional<z.ZodObject<{
|
|
191
|
+
min_content_blocks: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
exclude_content_types: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
193
|
+
content_only: z.ZodOptional<z.ZodBoolean>;
|
|
194
|
+
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
min_content_blocks?: number | undefined;
|
|
196
|
+
exclude_content_types?: string[] | undefined;
|
|
197
|
+
content_only?: boolean | undefined;
|
|
198
|
+
}, {
|
|
199
|
+
min_content_blocks?: number | undefined;
|
|
200
|
+
exclude_content_types?: string[] | undefined;
|
|
201
|
+
content_only?: boolean | undefined;
|
|
202
|
+
}>>;
|
|
203
|
+
session_id: z.ZodOptional<z.ZodString>;
|
|
204
|
+
cookies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
205
|
+
session_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
206
|
+
sticky_session: z.ZodOptional<z.ZodString>;
|
|
207
|
+
sticky_session_ttl: z.ZodOptional<z.ZodNumber>;
|
|
208
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
209
|
+
type: z.ZodLiteral<"wait">;
|
|
210
|
+
milliseconds: z.ZodOptional<z.ZodNumber>;
|
|
211
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
type: "wait";
|
|
214
|
+
milliseconds?: number | undefined;
|
|
215
|
+
selector?: string | undefined;
|
|
216
|
+
}, {
|
|
217
|
+
type: "wait";
|
|
218
|
+
milliseconds?: number | undefined;
|
|
219
|
+
selector?: string | undefined;
|
|
220
|
+
}>, z.ZodObject<{
|
|
221
|
+
type: z.ZodLiteral<"wait_for">;
|
|
222
|
+
selector: z.ZodString;
|
|
223
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
|
225
|
+
type: "wait_for";
|
|
226
|
+
selector: string;
|
|
227
|
+
timeout?: number | undefined;
|
|
228
|
+
}, {
|
|
229
|
+
type: "wait_for";
|
|
230
|
+
selector: string;
|
|
231
|
+
timeout?: number | undefined;
|
|
232
|
+
}>, z.ZodObject<{
|
|
233
|
+
type: z.ZodLiteral<"click">;
|
|
234
|
+
selector: z.ZodString;
|
|
235
|
+
}, "strip", z.ZodTypeAny, {
|
|
236
|
+
type: "click";
|
|
237
|
+
selector: string;
|
|
238
|
+
}, {
|
|
239
|
+
type: "click";
|
|
240
|
+
selector: string;
|
|
241
|
+
}>, z.ZodObject<{
|
|
242
|
+
type: z.ZodLiteral<"fill">;
|
|
243
|
+
selector: z.ZodString;
|
|
244
|
+
value: z.ZodString;
|
|
245
|
+
}, "strip", z.ZodTypeAny, {
|
|
246
|
+
type: "fill";
|
|
247
|
+
value: string;
|
|
248
|
+
selector: string;
|
|
249
|
+
}, {
|
|
250
|
+
type: "fill";
|
|
251
|
+
value: string;
|
|
252
|
+
selector: string;
|
|
253
|
+
}>, z.ZodObject<{
|
|
254
|
+
type: z.ZodLiteral<"press">;
|
|
255
|
+
key: z.ZodString;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
type: "press";
|
|
258
|
+
key: string;
|
|
259
|
+
}, {
|
|
260
|
+
type: "press";
|
|
261
|
+
key: string;
|
|
262
|
+
}>, z.ZodObject<{
|
|
263
|
+
type: z.ZodLiteral<"scroll">;
|
|
264
|
+
direction: z.ZodOptional<z.ZodEnum<["down", "up"]>>;
|
|
265
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
266
|
+
}, "strip", z.ZodTypeAny, {
|
|
267
|
+
type: "scroll";
|
|
268
|
+
direction?: "down" | "up" | undefined;
|
|
269
|
+
amount?: number | undefined;
|
|
270
|
+
}, {
|
|
271
|
+
type: "scroll";
|
|
272
|
+
direction?: "down" | "up" | undefined;
|
|
273
|
+
amount?: number | undefined;
|
|
274
|
+
}>, z.ZodObject<{
|
|
275
|
+
type: z.ZodLiteral<"infinite_scroll">;
|
|
276
|
+
max_scrolls: z.ZodOptional<z.ZodNumber>;
|
|
277
|
+
delay: z.ZodOptional<z.ZodNumber>;
|
|
278
|
+
end_selector: z.ZodOptional<z.ZodString>;
|
|
279
|
+
}, "strip", z.ZodTypeAny, {
|
|
280
|
+
type: "infinite_scroll";
|
|
281
|
+
max_scrolls?: number | undefined;
|
|
282
|
+
delay?: number | undefined;
|
|
283
|
+
end_selector?: string | undefined;
|
|
284
|
+
}, {
|
|
285
|
+
type: "infinite_scroll";
|
|
286
|
+
max_scrolls?: number | undefined;
|
|
287
|
+
delay?: number | undefined;
|
|
288
|
+
end_selector?: string | undefined;
|
|
289
|
+
}>, z.ZodObject<{
|
|
290
|
+
type: z.ZodLiteral<"screenshot">;
|
|
291
|
+
full_page: z.ZodOptional<z.ZodBoolean>;
|
|
292
|
+
}, "strip", z.ZodTypeAny, {
|
|
293
|
+
type: "screenshot";
|
|
294
|
+
full_page?: boolean | undefined;
|
|
295
|
+
}, {
|
|
296
|
+
type: "screenshot";
|
|
297
|
+
full_page?: boolean | undefined;
|
|
298
|
+
}>, z.ZodObject<{
|
|
299
|
+
type: z.ZodLiteral<"evaluate">;
|
|
300
|
+
script: z.ZodString;
|
|
301
|
+
}, "strip", z.ZodTypeAny, {
|
|
302
|
+
type: "evaluate";
|
|
303
|
+
script: string;
|
|
304
|
+
}, {
|
|
305
|
+
type: "evaluate";
|
|
306
|
+
script: string;
|
|
307
|
+
}>]>, "many">>;
|
|
308
|
+
};
|
|
309
|
+
/** Drop undefined keys so optional tool params are not serialised as null/undefined. */
|
|
310
|
+
export declare function compact<T extends Record<string, unknown>>(obj: T): Partial<T>;
|
|
311
|
+
export declare function pickAdvanced<T extends Record<string, unknown>>(params: T, keys: readonly string[]): Record<string, unknown>;
|
|
312
|
+
export declare const ADVANCED_KEYS: string[];
|
|
313
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/tools/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAEH,eAAO,MAAM,QAAQ,wCAAsC,CAAC;AAE5D,eAAO,MAAM,qBAAqB,+HAUhC,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,0BAA0B,oFAQrC,CAAC;AAEH,eAAO,MAAM,sBAAsB,0DAKjC,CAAC;AAEH,eAAO,MAAM,QAAQ,iDAA+C,CAAC;AAErE,eAAO,MAAM,eAAe,2GAK1B,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,aAAa,qFASxB,CAAC;AAEH,8DAA8D;AAC9D,eAAO,MAAM,eAAe,8EAQ1B,CAAC;AAEH,eAAO,MAAM,mBAAmB,QAKwD,CAAC;AAEzF,eAAO,MAAM,cAAc;;;;;;;;;EAuBxB,CAAC;AAEJ,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;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