tomoshi 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/stdio.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { StdioTransport } from "@tmcp/transport-stdio";
3
+ import { createServer } from "./server.js";
4
+ const server = createServer();
5
+ const transport = new StdioTransport(server);
6
+ await transport.listen();
7
+ //# sourceMappingURL=stdio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;AAC9B,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AAC7C,MAAM,SAAS,CAAC,MAAM,EAAE,CAAC"}
@@ -0,0 +1,52 @@
1
+ import * as v from "valibot";
2
+ import type { CinderClient } from "../client.js";
3
+ export declare const DiscoverSchema: v.VariantSchema<"action", [v.ObjectSchema<{
4
+ readonly action: v.SchemaWithPipe<readonly [v.PicklistSchema<["search"], undefined>, v.DescriptionAction<"search", "Web search via SearXNG (Brave fallback)">]>;
5
+ readonly query: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "The search query">, v.MinLengthAction<string, 1, "Search query cannot be empty">]>;
6
+ readonly offset: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.DescriptionAction<number, "Pagination offset for results">]>, 0>;
7
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>, v.DescriptionAction<number, "Number of results to return (1-100)">]>, 10>;
8
+ readonly mode: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["fast"], undefined>, v.DescriptionAction<"fast", "Search speed: 'fast' restricts to recent results (last day)">]>, undefined>;
9
+ readonly includeDomains: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Restrict results to these domains">]>, undefined>;
10
+ readonly excludeDomains: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Exclude results from these domains">]>, undefined>;
11
+ readonly requiredText: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Only return results containing this text">]>, undefined>;
12
+ readonly maxAge: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<[1, 7, 30], undefined>, v.DescriptionAction<1 | 7 | 30, "Max age in days: 1 (day), 7 (week), 30 (month)">]>, undefined>;
13
+ readonly category: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["general", "news", "code"], undefined>, v.DescriptionAction<"code" | "general" | "news", "Category filter: general, news, code (maps to SearXNG categories)">]>, undefined>;
14
+ readonly rerank: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Lightweight TF-IDF re-rank (pure Go, no ONNX) — reorders by query-term score">]>, undefined>;
15
+ }, undefined>, v.ObjectSchema<{
16
+ readonly action: v.SchemaWithPipe<readonly [v.PicklistSchema<["map"], undefined>, v.DescriptionAction<"map", "Discover URLs on a site via sitemap/link traversal">]>;
17
+ readonly url: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "The site URL to map (discover URLs via sitemap/link traversal)">, v.UrlAction<string, "Must be a valid URL">]>;
18
+ readonly search: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Only return URLs containing this substring (e.g. '/docs')">]>, undefined>;
19
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 5000, undefined>, v.DescriptionAction<number, "Maximum URLs to return (1-5000, default 100)">]>, 100>;
20
+ }, undefined>, v.ObjectSchema<{
21
+ readonly action: v.SchemaWithPipe<readonly [v.PicklistSchema<["crawl"], undefined>, v.DescriptionAction<"crawl", "Enqueue async BFS crawl (requires Redis, returns task ID)">]>;
22
+ readonly url: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "The root URL to start crawling from">, v.UrlAction<string, "Must be a valid URL">]>;
23
+ readonly mode: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["smart", "static", "dynamic"], undefined>, v.DescriptionAction<"smart" | "static" | "dynamic", "Scraping mode per page: smart, static, or dynamic">]>, "smart">;
24
+ readonly render: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Render JavaScript for each page (headless browser)">]>, false>;
25
+ readonly screenshot: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
26
+ readonly images: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
27
+ readonly image_format: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["url", "blob"], undefined>, v.DescriptionAction<"url" | "blob", "Image transport: 'url' (metadata only) or 'blob' (base64)">]>, "url">;
28
+ readonly maxDepth: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 10, undefined>, v.DescriptionAction<number, "Maximum crawl depth (1-10)">]>, 2>;
29
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>, v.DescriptionAction<number, "Maximum number of pages to crawl (1-100)">]>, 10>;
30
+ readonly include_paths: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Only follow links whose path matches these globs (e.g. ['/blog/*'])">]>, undefined>;
31
+ readonly exclude_paths: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Never follow links whose path matches these globs (exclusion wins)">]>, undefined>;
32
+ readonly webhook_url: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "POST the crawl result here on completion">]>, undefined>;
33
+ readonly webhook_secret: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "HMAC-SHA256 key for the X-Cinder-Signature header">]>, undefined>;
34
+ }, undefined>, v.ObjectSchema<{
35
+ readonly action: v.SchemaWithPipe<readonly [v.PicklistSchema<["crawl_status"], undefined>, v.DescriptionAction<"crawl_status", "Poll async crawl job status">]>;
36
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "The task ID returned by cinder_discover action=crawl">, v.MinLengthAction<string, 1, "Task ID is required">]>;
37
+ }, undefined>], undefined>;
38
+ export type DiscoverInput = v.InferOutput<typeof DiscoverSchema>;
39
+ export declare function createDiscoverHandler(client: CinderClient): (input: Record<string, unknown>) => Promise<{
40
+ content: {
41
+ type: "text";
42
+ text: string;
43
+ }[];
44
+ isError?: undefined;
45
+ } | {
46
+ content: {
47
+ type: "text";
48
+ text: string;
49
+ }[];
50
+ isError: boolean;
51
+ }>;
52
+ //# sourceMappingURL=discover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/tools/discover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,cAAc,CAAC;AAkOtB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAKzB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC;AAejE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,IAC1C,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;GAoJ7C"}
@@ -0,0 +1,209 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Resource-oriented multiplexed discovery tool.
4
+ * Consolidates `cinder_search` + `cinder_map` + `cinder_crawl`
5
+ * into a single `cinder_discover` resource (3→1).
6
+ *
7
+ * Principle: 1 tool per domain resource with `action` enum
8
+ * (arch.md "Why 7 Tools Instead of 17" — FlarelyLegal 17→7).
9
+ * Reduces token overhead, improves LLM tool-selection accuracy,
10
+ * stays well under MCP client limits.
11
+ *
12
+ * Actions:
13
+ * - `search` — web search via SearXNG/Brave (POST /v1/search)
14
+ * - `map` — site URL discovery via sitemap/traversal (POST /v1/map)
15
+ * - `crawl` — enqueue async BFS crawl (POST /v1/crawl, Redis)
16
+ * - `crawl_status`— poll crawl job (GET /v1/crawl/:id, Redis)
17
+ */
18
+ // ── search ─────────────────────────────────────────────────────────────
19
+ const DiscoverSearchShape = v.object({
20
+ action: v.pipe(v.picklist(["search"]), v.description("Web search via SearXNG (Brave fallback)")),
21
+ query: v.pipe(v.string(), v.description("The search query"), v.minLength(1, "Search query cannot be empty")),
22
+ offset: v.optional(v.pipe(v.number(), v.minValue(0), v.description("Pagination offset for results")), 0),
23
+ limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(100), v.description("Number of results to return (1-100)")), 10),
24
+ mode: v.optional(v.pipe(v.picklist(["fast"]), v.description("Search speed: 'fast' restricts to recent results (last day)"))),
25
+ includeDomains: v.optional(v.pipe(v.array(v.string()), v.description("Restrict results to these domains"))),
26
+ excludeDomains: v.optional(v.pipe(v.array(v.string()), v.description("Exclude results from these domains"))),
27
+ requiredText: v.optional(v.pipe(v.array(v.string()), v.description("Only return results containing this text"))),
28
+ maxAge: v.optional(v.pipe(v.picklist([1, 7, 30]), v.description("Max age in days: 1 (day), 7 (week), 30 (month)"))),
29
+ category: v.optional(v.pipe(v.picklist(["general", "news", "code"]), v.description("Category filter: general, news, code (maps to SearXNG categories)"))),
30
+ rerank: v.optional(v.pipe(v.boolean(), v.description("Lightweight TF-IDF re-rank (pure Go, no ONNX) — reorders by query-term score"))),
31
+ });
32
+ // ── map ────────────────────────────────────────────────────────────────
33
+ const DiscoverMapShape = v.object({
34
+ action: v.pipe(v.picklist(["map"]), v.description("Discover URLs on a site via sitemap/link traversal")),
35
+ url: v.pipe(v.string(), v.description("The site URL to map (discover URLs via sitemap/link traversal)"), v.url("Must be a valid URL")),
36
+ search: v.optional(v.pipe(v.string(), v.description("Only return URLs containing this substring (e.g. '/docs')"))),
37
+ limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(5000), v.description("Maximum URLs to return (1-5000, default 100)")), 100),
38
+ });
39
+ // ── crawl (enqueue) ────────────────────────────────────────────────────
40
+ const DiscoverCrawlShape = v.object({
41
+ action: v.pipe(v.picklist(["crawl"]), v.description("Enqueue async BFS crawl (requires Redis, returns task ID)")),
42
+ url: v.pipe(v.string(), v.description("The root URL to start crawling from"), v.url("Must be a valid URL")),
43
+ mode: v.optional(v.pipe(v.picklist(["smart", "static", "dynamic"]), v.description("Scraping mode per page: smart, static, or dynamic")), "smart"),
44
+ render: v.optional(v.pipe(v.boolean(), v.description("Render JavaScript for each page (headless browser)")), false),
45
+ screenshot: v.optional(v.boolean(), false),
46
+ images: v.optional(v.boolean(), false),
47
+ image_format: v.optional(v.pipe(v.picklist(["url", "blob"]), v.description("Image transport: 'url' (metadata only) or 'blob' (base64)")), "url"),
48
+ maxDepth: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(10), v.description("Maximum crawl depth (1-10)")), 2),
49
+ limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(100), v.description("Maximum number of pages to crawl (1-100)")), 10),
50
+ include_paths: v.optional(v.pipe(v.array(v.string()), v.description("Only follow links whose path matches these globs (e.g. ['/blog/*'])"))),
51
+ exclude_paths: v.optional(v.pipe(v.array(v.string()), v.description("Never follow links whose path matches these globs (exclusion wins)"))),
52
+ webhook_url: v.optional(v.pipe(v.string(), v.description("POST the crawl result here on completion"))),
53
+ webhook_secret: v.optional(v.pipe(v.string(), v.description("HMAC-SHA256 key for the X-Cinder-Signature header"))),
54
+ });
55
+ // ── crawl_status (poll) ────────────────────────────────────────────────
56
+ const DiscoverCrawlStatusShape = v.object({
57
+ action: v.pipe(v.picklist(["crawl_status"]), v.description("Poll async crawl job status")),
58
+ id: v.pipe(v.string(), v.description("The task ID returned by cinder_discover action=crawl"), v.minLength(1, "Task ID is required")),
59
+ });
60
+ export const DiscoverSchema = v.variant("action", [
61
+ DiscoverSearchShape,
62
+ DiscoverMapShape,
63
+ DiscoverCrawlShape,
64
+ DiscoverCrawlStatusShape,
65
+ ]);
66
+ function pageTitle(page) {
67
+ const title = page.title?.trim();
68
+ if (title)
69
+ return title;
70
+ try {
71
+ const path = new URL(page.url).pathname;
72
+ const last = path.split("/").filter(Boolean).pop();
73
+ if (last)
74
+ return decodeURIComponent(last);
75
+ return new URL(page.url).hostname;
76
+ }
77
+ catch {
78
+ return page.url;
79
+ }
80
+ }
81
+ export function createDiscoverHandler(client) {
82
+ return async (input) => {
83
+ const { action } = input;
84
+ try {
85
+ if (action === "search") {
86
+ const params = input;
87
+ const result = await client.search(params);
88
+ const lines = [
89
+ `# Search Results: "${result.query}"`,
90
+ "",
91
+ `Found ${result.count} results${result.hasMore ? " (more available)" : ""}`,
92
+ "",
93
+ ];
94
+ for (const item of result.results) {
95
+ lines.push(`### ${item.title}`, "", `${item.description}`, "");
96
+ if (item.highlights && item.highlights.length > 0) {
97
+ lines.push(`> ${item.highlights[0]}`, "");
98
+ }
99
+ lines.push(`🔗 ${item.url}`);
100
+ const meta = [];
101
+ if (item.domain)
102
+ meta.push(item.domain);
103
+ if (item.id)
104
+ meta.push(`id: ${item.id}`);
105
+ if (typeof item.relevance === "number")
106
+ meta.push(`relevance: ${item.relevance.toFixed(3)}`);
107
+ if (meta.length > 0)
108
+ lines.push(`_${meta.join(" · ")}_`);
109
+ lines.push("", "---", "");
110
+ }
111
+ if (result.hasMore)
112
+ lines.push("", `Use \`cinder_discover\` with \`action: "search"\` and \`offset: ${result.nextOffset}\` to get the next page.`);
113
+ return { content: [{ type: "text", text: lines.join("\n") }] };
114
+ }
115
+ if (action === "map") {
116
+ const params = input;
117
+ const result = await client.map(params);
118
+ const lines = [
119
+ `# Map Result: ${result.url}`,
120
+ "",
121
+ `**Count:** ${result.count}`,
122
+ `**Source URL:** ${result.url}`,
123
+ ];
124
+ if (params.search)
125
+ lines.push(`**Filter:** \`${params.search}\``);
126
+ lines.push("", "---", "");
127
+ if (result.links.length === 0)
128
+ lines.push("No links discovered (site may have no sitemap and no crawlable links).");
129
+ else {
130
+ lines.push(`## Discovered URLs (${result.links.length})`, "");
131
+ for (const link of result.links)
132
+ lines.push(`- ${link.url} _(source: ${link.source})_`);
133
+ }
134
+ return { content: [{ type: "text", text: lines.join("\n") }] };
135
+ }
136
+ if (action === "crawl") {
137
+ const params = input;
138
+ const result = await client.crawl(params);
139
+ const lines = [
140
+ "# Crawl Job Enqueued",
141
+ "",
142
+ `**URL:** ${result.url}`,
143
+ `**Task ID:** \`${result.id}\``,
144
+ `**Render:** ${result.render}`,
145
+ `**Screenshot:** ${result.screenshot}`,
146
+ `**Images:** ${result.images}`,
147
+ `**Max Depth:** ${result.maxDepth}`,
148
+ `**Limit:** ${result.limit}`,
149
+ ];
150
+ if (result.image_format)
151
+ lines.push(`**Image Format:** ${result.image_format}`);
152
+ lines.push("", "---", "", `Use \`cinder_discover\` with \`action: "crawl_status"\` and \`id: "${result.id}"\` to poll.`, "The crawl runs asynchronously — poll until state is `completed` or `failed`.", "Requires Redis-backed Cinder instance.");
153
+ return { content: [{ type: "text", text: lines.join("\n") }] };
154
+ }
155
+ // crawl_status
156
+ const { id } = input;
157
+ const result = await client.getCrawlStatus(id);
158
+ const lines = [
159
+ "# Crawl Status",
160
+ "",
161
+ `**Task ID:** \`${result.id}\``,
162
+ `**State:** ${result.state}`,
163
+ ];
164
+ if (result.queue)
165
+ lines.push(`**Queue:** ${result.queue}`);
166
+ if (result.state === "completed" && result.crawl) {
167
+ const c = result.crawl;
168
+ lines.push("", "---", `## Results (${c.status}, ${c.total_pages} pages, max depth: ${c.max_depth}, limit: ${c.limit})`, "");
169
+ for (const page of c.pages) {
170
+ lines.push(`### ${pageTitle(page)}`);
171
+ lines.push(`🔗 ${page.url}`);
172
+ if (page.preview)
173
+ lines.push("", `> ${page.preview}`, "");
174
+ lines.push("");
175
+ }
176
+ if (c.failed_urls && c.failed_urls.length > 0) {
177
+ lines.push("### Failed URLs", "");
178
+ for (const f of c.failed_urls)
179
+ lines.push(`- ${f.url}: ${f.error}`);
180
+ }
181
+ }
182
+ else if (result.state === "failed" &&
183
+ result.failed_urls &&
184
+ result.failed_urls.length > 0) {
185
+ lines.push("", "---", "### Failed URLs", "");
186
+ for (const f of result.failed_urls)
187
+ lines.push(`- ${f.url}: ${f.error}`);
188
+ }
189
+ if (result.state === "failed")
190
+ lines.push("", "---", "⚠️ The crawl job failed. Try again with a different URL or fewer pages.");
191
+ if (result.state === "pending" || result.state === "active")
192
+ lines.push("", "---", "⏳ The crawl is still in progress. Check back later.");
193
+ return { content: [{ type: "text", text: lines.join("\n") }] };
194
+ }
195
+ catch (err) {
196
+ const message = err instanceof Error ? err.message : "Unknown error";
197
+ return {
198
+ content: [
199
+ {
200
+ type: "text",
201
+ text: `Discover ${action} failed: ${message}`,
202
+ },
203
+ ],
204
+ isError: true,
205
+ };
206
+ }
207
+ };
208
+ }
209
+ //# sourceMappingURL=discover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover.js","sourceRoot":"","sources":["../../src/tools/discover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SA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Y,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YACrE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,YAAY,MAAM,YAAY,OAAO,EAAE;qBAC9C;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,147 @@
1
+ import * as v from "valibot";
2
+ import type { CinderClient } from "../client.js";
3
+ export declare const ExtractSchema: v.VariantSchema<"action", [v.ObjectSchema<{
4
+ readonly action: v.SchemaWithPipe<readonly [v.PicklistSchema<["scrape"], undefined>, v.DescriptionAction<"scrape", "Scrape a single page into markdown">]>;
5
+ readonly url: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "The URL to scrape">, v.UrlAction<string, "Must be a valid URL">]>;
6
+ readonly mode: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["smart", "static", "dynamic"], undefined>, v.DescriptionAction<"smart" | "static" | "dynamic", "Scraping mode: smart (auto), static (colly), dynamic (chromedp)">]>, "smart">;
7
+ readonly screenshot: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Capture a screenshot (needs dynamic/smart)">]>, false>;
8
+ readonly screenshot_opts: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
9
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
10
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
11
+ readonly full_page: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
12
+ readonly format: v.OptionalSchema<v.PicklistSchema<["jpeg", "png"], undefined>, undefined>;
13
+ readonly quality: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
14
+ readonly wait_selector: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
15
+ }, undefined>, v.DescriptionAction<{
16
+ width?: number | undefined;
17
+ height?: number | undefined;
18
+ full_page?: boolean | undefined;
19
+ format?: "jpeg" | "png" | undefined;
20
+ quality?: number | undefined;
21
+ wait_selector?: string | undefined;
22
+ }, "Screenshot configuration (width, height, full_page, format, quality, wait_selector)">]>, undefined>;
23
+ readonly images: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Extract images from the page">]>, false>;
24
+ readonly image_format: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["url", "blob"], undefined>, v.DescriptionAction<"url" | "blob", "Image transport: 'url' (metadata only) or 'blob' (base64)">]>, "url">;
25
+ readonly max_images: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 50, undefined>, v.DescriptionAction<number, "Max images to extract (default 10)">]>, 10>;
26
+ readonly max_image_size_kb: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Max individual image size in KB (default 5120)">]>, 5120>;
27
+ readonly image_process: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
28
+ readonly format: v.OptionalSchema<v.PicklistSchema<["jpeg", "png"], undefined>, undefined>;
29
+ readonly max_width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
30
+ readonly quality: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
31
+ }, undefined>, v.DescriptionAction<{
32
+ format?: "jpeg" | "png" | undefined;
33
+ max_width?: number | undefined;
34
+ quality?: number | undefined;
35
+ }, "Resize/re-encode image blobs (format, max_width, quality)">]>, undefined>;
36
+ readonly actions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
37
+ readonly type: v.PicklistSchema<["wait_ms", "wait_selector", "click", "scroll_down", "scroll_to_bottom"], undefined>;
38
+ readonly ms: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
39
+ readonly selector: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
40
+ }, undefined>, undefined>, v.DescriptionAction<{
41
+ type: "wait_ms" | "wait_selector" | "click" | "scroll_down" | "scroll_to_bottom";
42
+ ms?: number | undefined;
43
+ selector?: string | undefined;
44
+ }[], "Page interactions before capture (dynamic mode only)">]>, undefined>;
45
+ readonly extract_schema: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
46
+ readonly selector: v.StringSchema<undefined>;
47
+ readonly attr: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
48
+ readonly multiple: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
49
+ }, undefined>, undefined>, v.DescriptionAction<{
50
+ [x: string]: {
51
+ selector: string;
52
+ attr?: string | undefined;
53
+ multiple?: boolean | undefined;
54
+ };
55
+ }, "Deterministic CSS-selector extraction: {field: {selector, attr?, multiple?}}">]>, undefined>;
56
+ readonly summary: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Return an extractive summary (no LLM)">]>, false>;
57
+ readonly summary_sentences: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 50, undefined>, v.DescriptionAction<number, "Sentence count for the summary (default 5)">]>, 5>;
58
+ readonly redact_pii: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Mask emails, phones, and card-shaped numbers">]>, false>;
59
+ readonly block_ads: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Strip ad/tracker containers before conversion">]>, true>;
60
+ readonly remove_base64_images: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Drop inline data: images before conversion">]>, true>;
61
+ readonly include_links: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Include extracted links (default true, Firecrawl formats: [\"links\"] parity — enriched to {url, text, isInternal})">]>, true>;
62
+ readonly render: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Deprecated: behaves like mode=dynamic">]>, false>;
63
+ }, undefined>, v.ObjectSchema<{
64
+ readonly action: v.SchemaWithPipe<readonly [v.PicklistSchema<["scrape_multi"], undefined>, v.DescriptionAction<"scrape_multi", "Scrape multiple URLs synchronously (max 10, no Redis) — mirrors web_fetch_exa & Firecrawl batch sync">]>;
65
+ readonly urls: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, "Must be a valid URL">]>, undefined>, v.MinLengthAction<string[], 1, "At least one URL is required">, v.MaxLengthAction<string[], 10, "Maximum 10 URLs per sync batch">, v.DescriptionAction<string[], "URLs to scrape synchronously (max 10, no Redis, errgroup limit 5)">]>;
66
+ readonly mode: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["smart", "static", "dynamic"], undefined>, v.DescriptionAction<"smart" | "static" | "dynamic", "Scraping mode: smart (auto), static (colly), dynamic (chromedp)">]>, "smart">;
67
+ readonly screenshot: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Capture a screenshot">]>, false>;
68
+ readonly screenshot_opts: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
69
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
70
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
71
+ readonly full_page: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
72
+ readonly format: v.OptionalSchema<v.PicklistSchema<["jpeg", "png"], undefined>, undefined>;
73
+ readonly quality: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
74
+ readonly wait_selector: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
75
+ }, undefined>, v.DescriptionAction<{
76
+ width?: number | undefined;
77
+ height?: number | undefined;
78
+ full_page?: boolean | undefined;
79
+ format?: "jpeg" | "png" | undefined;
80
+ quality?: number | undefined;
81
+ wait_selector?: string | undefined;
82
+ }, "Screenshot configuration">]>, undefined>;
83
+ readonly images: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Extract images">]>, false>;
84
+ readonly image_format: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["url", "blob"], undefined>, v.DescriptionAction<"url" | "blob", "Image transport: url or blob">]>, "url">;
85
+ readonly max_images: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 50, undefined>]>, 10>;
86
+ readonly max_image_size_kb: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, 5120>;
87
+ readonly image_process: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
88
+ readonly format: v.OptionalSchema<v.PicklistSchema<["jpeg", "png"], undefined>, undefined>;
89
+ readonly max_width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
90
+ readonly quality: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
91
+ }, undefined>, v.DescriptionAction<{
92
+ format?: "jpeg" | "png" | undefined;
93
+ max_width?: number | undefined;
94
+ quality?: number | undefined;
95
+ }, "Resize/re-encode image blobs">]>, undefined>;
96
+ readonly actions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
97
+ readonly type: v.PicklistSchema<["wait_ms", "wait_selector", "click", "scroll_down", "scroll_to_bottom"], undefined>;
98
+ readonly ms: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
99
+ readonly selector: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
100
+ }, undefined>, undefined>, v.DescriptionAction<{
101
+ type: "wait_ms" | "wait_selector" | "click" | "scroll_down" | "scroll_to_bottom";
102
+ ms?: number | undefined;
103
+ selector?: string | undefined;
104
+ }[], "Page interactions before capture (dynamic mode only)">]>, undefined>;
105
+ readonly extract_schema: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
106
+ readonly selector: v.StringSchema<undefined>;
107
+ readonly attr: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
108
+ readonly multiple: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
109
+ }, undefined>, undefined>, v.DescriptionAction<{
110
+ [x: string]: {
111
+ selector: string;
112
+ attr?: string | undefined;
113
+ multiple?: boolean | undefined;
114
+ };
115
+ }, "Deterministic CSS-selector extraction">]>, undefined>;
116
+ readonly summary: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Return an extractive summary">]>, false>;
117
+ readonly summary_sentences: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 50, undefined>]>, 5>;
118
+ readonly redact_pii: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Mask emails, phones, card numbers">]>, false>;
119
+ readonly block_ads: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Strip ad/tracker containers">]>, true>;
120
+ readonly remove_base64_images: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Drop inline data: images">]>, true>;
121
+ readonly include_links: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Include extracted links (default true)">]>, true>;
122
+ readonly render: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Deprecated: behaves like mode=dynamic">]>, false>;
123
+ }, undefined>, v.ObjectSchema<{
124
+ readonly action: v.SchemaWithPipe<readonly [v.PicklistSchema<["links"], undefined>, v.DescriptionAction<"links", "Extract hyperlinks only (lightweight, no markdown)">]>;
125
+ readonly url: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "The URL to extract hyperlinks from">, v.UrlAction<string, "Must be a valid URL">]>;
126
+ }, undefined>, v.ObjectSchema<{
127
+ readonly action: v.SchemaWithPipe<readonly [v.PicklistSchema<["batch"], undefined>, v.DescriptionAction<"batch", "Enqueue async batch scrape (max 20 URLs, requires Redis)">]>;
128
+ readonly urls: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, "Must be a valid URL">]>, undefined>, v.MinLengthAction<string[], 1, "At least one URL is required">, v.MaxLengthAction<string[], 20, "Maximum 20 URLs per batch">, v.DescriptionAction<string[], "URLs to scrape asynchronously (max 20, requires Redis)">]>;
129
+ }, undefined>, v.ObjectSchema<{
130
+ readonly action: v.SchemaWithPipe<readonly [v.PicklistSchema<["batch_status"], undefined>, v.DescriptionAction<"batch_status", "Poll async batch status">]>;
131
+ readonly batch_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "Batch ID is required">, v.DescriptionAction<string, "The batch_id returned by cinder_extract action=batch">]>;
132
+ }, undefined>], undefined>;
133
+ export type ExtractInput = v.InferOutput<typeof ExtractSchema>;
134
+ export declare function createExtractHandler(client: CinderClient): (input: Record<string, unknown>) => Promise<{
135
+ content: {
136
+ type: "text";
137
+ text: string;
138
+ }[];
139
+ isError?: undefined;
140
+ } | {
141
+ content: {
142
+ type: "text";
143
+ text: string;
144
+ }[];
145
+ isError: boolean;
146
+ }>;
147
+ //# sourceMappingURL=extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/tools/extract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,cAAc,CAAC;AAmWtB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAMxB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAE/D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,IACzC,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;GAyP7C"}