@effect-uai/firecrawl 0.12.0 → 0.12.1
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/FirecrawlRead.d.mts
CHANGED
|
@@ -3,8 +3,6 @@ import { Context, Duration, Effect, Layer, Redacted } from "effect";
|
|
|
3
3
|
import { HttpClient } from "effect/unstable/http";
|
|
4
4
|
import * as AiError from "@effect-uai/core/AiError";
|
|
5
5
|
import { CommonReadRequest, ReadResponse, WebRead } from "@effect-uai/core/WebRead";
|
|
6
|
-
|
|
7
|
-
//#region src/FirecrawlRead.d.ts
|
|
8
6
|
declare namespace FirecrawlRead_d_exports {
|
|
9
7
|
export { Config, FirecrawlMapRequest, FirecrawlRead, FirecrawlReadRequest, FirecrawlReadService, MapLink, MapResponse, layer, make };
|
|
10
8
|
}
|
|
@@ -14,11 +12,17 @@ declare namespace FirecrawlRead_d_exports {
|
|
|
14
12
|
* body (see the codec below).
|
|
15
13
|
*/
|
|
16
14
|
type FirecrawlReadRequest = CommonReadRequest & {
|
|
17
|
-
/** Keep only the main content, dropping nav/header/footer/sidebar. */
|
|
18
|
-
readonly
|
|
19
|
-
|
|
20
|
-
readonly
|
|
21
|
-
|
|
15
|
+
/** Keep only the main content, dropping nav/header/footer/sidebar. */
|
|
16
|
+
readonly onlyMainContent?: boolean;
|
|
17
|
+
/** Restrict extraction to these HTML tags / selectors. */
|
|
18
|
+
readonly includeTags?: ReadonlyArray<string>;
|
|
19
|
+
/** Drop these HTML tags / selectors before extraction. */
|
|
20
|
+
readonly excludeTags?: ReadonlyArray<string>;
|
|
21
|
+
/** Wait this long for the page to settle before scraping (JS-heavy sites). */
|
|
22
|
+
readonly waitFor?: Duration.Duration;
|
|
23
|
+
/** Emulate a mobile device. */
|
|
24
|
+
readonly mobile?: boolean;
|
|
25
|
+
/** Proxy tier - see {@link FirecrawlProxy}. */
|
|
22
26
|
readonly proxy?: FirecrawlProxy;
|
|
23
27
|
};
|
|
24
28
|
/**
|
|
@@ -28,11 +32,16 @@ type FirecrawlReadRequest = CommonReadRequest & {
|
|
|
28
32
|
* but `url` are optional.
|
|
29
33
|
*/
|
|
30
34
|
type FirecrawlMapRequest = {
|
|
31
|
-
readonly url: string;
|
|
32
|
-
|
|
33
|
-
readonly
|
|
34
|
-
|
|
35
|
-
readonly
|
|
35
|
+
readonly url: string;
|
|
36
|
+
/** Order results by relevance to this query. */
|
|
37
|
+
readonly search?: string;
|
|
38
|
+
/** Cap the number of links returned. */
|
|
39
|
+
readonly limit?: number;
|
|
40
|
+
/** How to use the site's sitemap: `only` (sitemap alone), `include`, or `skip`. */
|
|
41
|
+
readonly sitemap?: "only" | "include" | "skip";
|
|
42
|
+
/** Include links on subdomains of the base URL. */
|
|
43
|
+
readonly includeSubdomains?: boolean;
|
|
44
|
+
/** Abort the map if it runs past this duration. */
|
|
36
45
|
readonly timeout?: Duration.Duration;
|
|
37
46
|
};
|
|
38
47
|
/** One discovered URL, with page metadata where Firecrawl has it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirecrawlRead.d.mts","names":[],"sources":["../src/FirecrawlRead.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FirecrawlRead.d.mts","names":[],"sources":["../src/FirecrawlRead.ts"],"mappings":";;;;;;;;;;;;;KAoBY,uBAAuB;;WAExB;;WAEA,cAAc;;WAEd,cAAc;;WAEd,UAAU,SAAS;;WAEnB;;WAEA,QAAQ;;;;;;;;KASP;WACD;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,UAAU,SAAS;;;KAIlB;WACD;WACA;WACA;;KAGC;WACD,OAAO,cAAc;WACrB;;KAGC;WACD,OAAO,SAAS,yBAAyB,OAAO,OAAO,cAAc,QAAQ;;;;;WAK7E,MAAM,SAAS,wBAAwB,OAAO,OAAO,aAAa,QAAQ;;;;;;;;cAQxE,sBAAsB;KAIvB;WACD,QAAQ,SAAS;WACjB;;;;;;cAuPE,OAAI,KACV,WACJ,OAAO,OAAO,6BAA6B,WAAW;;;;;;;cAc5C,QAAK,KACX,WACJ,MAAM,MAAM,gBAAgB,gBAAgB,WAAW"}
|
package/dist/FirecrawlRead.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as __exportAll } from "./
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { Context, Duration, Effect, Layer, Redacted, Schema } from "effect";
|
|
3
3
|
import { HttpClient, HttpClientRequest } from "effect/unstable/http";
|
|
4
4
|
import * as AiError from "@effect-uai/core/AiError";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirecrawlRead.mjs","names":[],"sources":["../src/FirecrawlRead.ts"],"sourcesContent":["import { Context, Duration, Effect, Layer, Redacted, Schema } from \"effect\"\nimport { HttpClient, HttpClientRequest } from \"effect/unstable/http\"\nimport * as AiError from \"@effect-uai/core/AiError\"\nimport {\n type CommonReadRequest,\n type ReadResponse,\n WebRead,\n type WebReadService,\n} from \"@effect-uai/core/WebRead\"\nimport type { FirecrawlProxy } from \"./models.js\"\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/**\n * Firecrawl-typed read request. Widens {@link CommonReadRequest} with\n * Firecrawl's own scrape knobs; the common fields map onto Firecrawl's wire\n * body (see the codec below).\n */\nexport type FirecrawlReadRequest = CommonReadRequest & {\n /** Keep only the main content, dropping nav/header/footer/sidebar. */\n readonly onlyMainContent?: boolean\n /** Restrict extraction to these HTML tags / selectors. */\n readonly includeTags?: ReadonlyArray<string>\n /** Drop these HTML tags / selectors before extraction. */\n readonly excludeTags?: ReadonlyArray<string>\n /** Wait this long for the page to settle before scraping (JS-heavy sites). */\n readonly waitFor?: Duration.Duration\n /** Emulate a mobile device. */\n readonly mobile?: boolean\n /** Proxy tier - see {@link FirecrawlProxy}. */\n readonly proxy?: FirecrawlProxy\n}\n\n/**\n * Firecrawl-typed map (sitemap / URL discovery) request. Given a base `url`,\n * Firecrawl returns the site's URLs without scraping each one - handy for\n * locating specific pages (pricing, docs) before a targeted read. All fields\n * but `url` are optional.\n */\nexport type FirecrawlMapRequest = {\n readonly url: string\n /** Order results by relevance to this query. */\n readonly search?: string\n /** Cap the number of links returned. */\n readonly limit?: number\n /** How to use the site's sitemap: `only` (sitemap alone), `include`, or `skip`. */\n readonly sitemap?: \"only\" | \"include\" | \"skip\"\n /** Include links on subdomains of the base URL. */\n readonly includeSubdomains?: boolean\n /** Abort the map if it runs past this duration. */\n readonly timeout?: Duration.Duration\n}\n\n/** One discovered URL, with page metadata where Firecrawl has it. */\nexport type MapLink = {\n readonly url: string\n readonly title?: string\n readonly description?: string\n}\n\nexport type MapResponse = {\n readonly links: ReadonlyArray<MapLink>\n readonly raw: unknown\n}\n\nexport type FirecrawlReadService = {\n readonly read: (request: FirecrawlReadRequest) => Effect.Effect<ReadResponse, AiError.AiError>\n /**\n * Discover a site's URLs (sitemap-style) without scraping. Firecrawl-specific;\n * not on the generic `WebRead` tag, whose contract is a single-URL read.\n */\n readonly map: (request: FirecrawlMapRequest) => Effect.Effect<MapResponse, AiError.AiError>\n}\n\n/**\n * Provider-typed service tag. Yield this for Firecrawl-typed reads (its own\n * scrape knobs); yield the generic `WebRead` tag for provider-portable code.\n * Both are registered by {@link layer}.\n */\nexport class FirecrawlRead extends Context.Service<FirecrawlRead, FirecrawlReadService>()(\n \"@betalyra/effect-uai/providers/firecrawl/FirecrawlRead\",\n) {}\n\nexport type Config = {\n readonly apiKey: Redacted.Redacted\n readonly baseUrl?: string\n}\n\n// ---------------------------------------------------------------------------\n// Codec - request body\n// ---------------------------------------------------------------------------\n\ntype WireBody = {\n readonly url: string\n readonly formats: ReadonlyArray<string>\n readonly onlyMainContent?: boolean\n readonly includeTags?: ReadonlyArray<string>\n readonly excludeTags?: ReadonlyArray<string>\n readonly waitFor?: number\n readonly timeout?: number\n readonly mobile?: boolean\n readonly proxy?: string\n}\n\n// `markdown` / `html` map one-to-one onto Firecrawl's format names. `links` is\n// always requested so {@link ReadResponse.links} can be populated; it does not\n// change the per-page billing.\nconst buildBody = (request: FirecrawlReadRequest): WireBody => {\n const contentFormat = request.format ?? \"markdown\"\n return {\n url: request.url,\n formats: [contentFormat, \"links\"],\n ...(request.onlyMainContent !== undefined && { onlyMainContent: request.onlyMainContent }),\n ...(request.includeTags !== undefined && { includeTags: request.includeTags }),\n ...(request.excludeTags !== undefined && { excludeTags: request.excludeTags }),\n ...(request.waitFor !== undefined && { waitFor: Duration.toMillis(request.waitFor) }),\n ...(request.timeout !== undefined && { timeout: Duration.toMillis(request.timeout) }),\n ...(request.mobile !== undefined && { mobile: request.mobile }),\n ...(request.proxy !== undefined && { proxy: request.proxy }),\n }\n}\n\ntype WireMapBody = {\n readonly url: string\n readonly search?: string\n readonly limit?: number\n readonly sitemap?: string\n readonly includeSubdomains?: boolean\n readonly timeout?: number\n}\n\nconst buildMapBody = (request: FirecrawlMapRequest): WireMapBody => ({\n url: request.url,\n ...(request.search !== undefined && { search: request.search }),\n ...(request.limit !== undefined && { limit: request.limit }),\n ...(request.sitemap !== undefined && { sitemap: request.sitemap }),\n ...(request.includeSubdomains !== undefined && { includeSubdomains: request.includeSubdomains }),\n ...(request.timeout !== undefined && { timeout: Duration.toMillis(request.timeout) }),\n})\n\n// ---------------------------------------------------------------------------\n// Codec - response\n// ---------------------------------------------------------------------------\n\nconst WireMetadata = Schema.Struct({\n // Firecrawl returns `title` as a string, an array (repeated meta tags), or\n // null; normalize to a single string in `toResponse`.\n title: Schema.optional(Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)]))),\n sourceURL: Schema.optional(Schema.NullOr(Schema.String)),\n statusCode: Schema.optional(Schema.Number),\n})\n\nconst WireData = Schema.Struct({\n markdown: Schema.optional(Schema.NullOr(Schema.String)),\n html: Schema.optional(Schema.NullOr(Schema.String)),\n rawHtml: Schema.optional(Schema.NullOr(Schema.String)),\n links: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))),\n metadata: Schema.optional(WireMetadata),\n})\n\n/**\n * `data` is optional because a failed scrape is not an HTTP failure. Firecrawl\n * answers 200 with `{ success: false, error }` when a page is blocked, times\n * out or renders only under JS — so requiring `data` turned every one of those\n * into a decode error, which was then reported as a transport fault and\n * retried on the backoff schedule.\n */\nconst WireResponse = Schema.Struct({\n success: Schema.optional(Schema.Boolean),\n data: Schema.optional(WireData),\n error: Schema.optional(Schema.NullOr(Schema.String)),\n})\ntype WireResponse = typeof WireResponse.Type\n\nconst pickTitle = (title: string | ReadonlyArray<string> | null | undefined): string | undefined =>\n typeof title === \"string\" ? title : Array.isArray(title) ? title[0] : undefined\n\nconst toResponse = (\n wire: WireResponse,\n data: NonNullable<WireResponse[\"data\"]>,\n request: FirecrawlReadRequest,\n): ReadResponse => {\n const format = request.format ?? \"markdown\"\n const content = (format === \"html\" ? data.html : data.markdown) ?? \"\"\n const title = pickTitle(data.metadata?.title)\n const links = data.links ?? undefined\n return {\n url: data.metadata?.sourceURL ?? request.url,\n content,\n ...(title !== undefined && { title }),\n ...(links !== undefined && links.length > 0 && { links }),\n raw: wire,\n }\n}\n\n// v2 returns link objects; older responses returned bare URL strings. Accept\n// both and normalize a string to `{ url }` in `toMapResponse`.\nconst WireMapLink = Schema.Struct({\n url: Schema.String,\n title: Schema.optional(Schema.NullOr(Schema.String)),\n description: Schema.optional(Schema.NullOr(Schema.String)),\n})\n\nconst WireMapResponse = Schema.Struct({\n success: Schema.optional(Schema.Boolean),\n links: Schema.Array(Schema.Union([WireMapLink, Schema.String])),\n})\ntype WireMapResponse = typeof WireMapResponse.Type\n\nconst toMapLink = (link: typeof WireMapLink.Type | string): MapLink =>\n typeof link === \"string\"\n ? { url: link }\n : {\n url: link.url,\n ...(link.title != null && { title: link.title }),\n ...(link.description != null && { description: link.description }),\n }\n\nconst toMapResponse = (wire: WireMapResponse): MapResponse => ({\n links: wire.links.map(toMapLink),\n raw: wire,\n})\n\n// ---------------------------------------------------------------------------\n// HTTP\n// ---------------------------------------------------------------------------\n\nconst transportFailure = (cause: unknown): AiError.AiError =>\n new AiError.Unavailable({ provider: \"firecrawl\", raw: cause })\n\n/**\n * The call arrived and the answer is unusable — a scrape Firecrawl itself\n * reports as failed, or a body that does not match what this provider knows how\n * to read.\n *\n * Deliberately not `Unavailable`: that tag is retryable, and neither of these\n * gets better on a second attempt. A blocked page stays blocked while the\n * backoff spends the scrape budget on it, and a changed API shape is a code\n * problem, not a weather problem.\n */\nconst unusableResponse = (message: string, raw: unknown): AiError.AiError =>\n new AiError.GenerationFailed({ provider: \"firecrawl\", message, raw })\n\nconst httpStatusError = (status: number, body: string): AiError.AiError => {\n const provider = \"firecrawl\"\n const raw = body\n if (status === 429) return new AiError.RateLimited({ provider, raw })\n if (status === 408 || status === 504) return new AiError.Timeout({ provider, raw })\n if (status === 401) return new AiError.AuthFailed({ provider, subtype: \"auth\", raw })\n if (status === 403) return new AiError.AuthFailed({ provider, subtype: \"permission\", raw })\n if (status === 402) return new AiError.AuthFailed({ provider, subtype: \"billing\", raw })\n if (status >= 500) return new AiError.Unavailable({ provider, status, raw })\n return new AiError.InvalidRequest({ provider, raw })\n}\n\nconst baseUrl = (cfg: Config): string => cfg.baseUrl ?? \"https://api.firecrawl.dev\"\n\nconst postScrape = (\n cfg: Config,\n body: WireBody,\n): Effect.Effect<WireResponse, AiError.AiError, HttpClient.HttpClient> =>\n Effect.gen(function* () {\n const client = yield* HttpClient.HttpClient\n const httpRequest = HttpClientRequest.post(`${baseUrl(cfg)}/v2/scrape`).pipe(\n HttpClientRequest.setHeader(\"Authorization\", `Bearer ${Redacted.value(cfg.apiKey)}`),\n HttpClientRequest.bodyJsonUnsafe(body),\n )\n const response = yield* client.execute(httpRequest).pipe(Effect.mapError(transportFailure))\n if (response.status >= 400) {\n const text = yield* response.text.pipe(Effect.orElseSucceed(() => \"\"))\n return yield* httpStatusError(response.status, text)\n }\n const json = yield* response.json.pipe(Effect.mapError(transportFailure))\n return yield* Schema.decodeUnknownEffect(WireResponse)(json).pipe(\n Effect.mapError((issue) =>\n unusableResponse(\"firecrawl returned a body this provider cannot read\", issue),\n ),\n )\n })\n\nconst readImpl =\n (cfg: Config) =>\n (\n request: FirecrawlReadRequest,\n ): Effect.Effect<ReadResponse, AiError.AiError, HttpClient.HttpClient> =>\n Effect.flatMap(postScrape(cfg, buildBody(request)), (wire) =>\n // A 200 carrying `success: false` is Firecrawl reporting the page could\n // not be scraped — blocked, JS-only, or timed out. Its own message is the\n // useful part, so it becomes the error rather than a decode failure.\n wire.data === undefined || wire.success === false\n ? Effect.fail(\n unusableResponse(wire.error ?? `firecrawl could not scrape ${request.url}`, wire),\n )\n : Effect.succeed(toResponse(wire, wire.data, request)),\n )\n\nconst postMap = (\n cfg: Config,\n body: WireMapBody,\n): Effect.Effect<WireMapResponse, AiError.AiError, HttpClient.HttpClient> =>\n Effect.gen(function* () {\n const client = yield* HttpClient.HttpClient\n const httpRequest = HttpClientRequest.post(`${baseUrl(cfg)}/v2/map`).pipe(\n HttpClientRequest.setHeader(\"Authorization\", `Bearer ${Redacted.value(cfg.apiKey)}`),\n HttpClientRequest.bodyJsonUnsafe(body),\n )\n const response = yield* client.execute(httpRequest).pipe(Effect.mapError(transportFailure))\n if (response.status >= 400) {\n const text = yield* response.text.pipe(Effect.orElseSucceed(() => \"\"))\n return yield* httpStatusError(response.status, text)\n }\n const json = yield* response.json.pipe(Effect.mapError(transportFailure))\n return yield* Schema.decodeUnknownEffect(WireMapResponse)(json).pipe(\n Effect.mapError(transportFailure),\n )\n })\n\nconst mapImpl =\n (cfg: Config) =>\n (\n request: FirecrawlMapRequest,\n ): Effect.Effect<MapResponse, AiError.AiError, HttpClient.HttpClient> =>\n Effect.map(postMap(cfg, buildMapBody(request)), toMapResponse)\n\n// ---------------------------------------------------------------------------\n// Constructors\n// ---------------------------------------------------------------------------\n\n/**\n * Build a `FirecrawlReadService` value. For Layer-based setup, prefer\n * {@link layer}.\n */\nexport const make = (\n cfg: Config,\n): Effect.Effect<FirecrawlReadService, never, HttpClient.HttpClient> =>\n Effect.map(HttpClient.HttpClient, (client) => ({\n read: (request) =>\n readImpl(cfg)(request).pipe(Effect.provideService(HttpClient.HttpClient, client)),\n map: (request) =>\n mapImpl(cfg)(request).pipe(Effect.provideService(HttpClient.HttpClient, client)),\n }))\n\n/**\n * Layer registering both the provider-typed `FirecrawlRead` tag and the\n * generic `WebRead` tag over one implementation. A `CommonReadRequest` is\n * structurally a `FirecrawlReadRequest` with the extra knobs unset, so the\n * generic registration forwards directly.\n */\nexport const layer = (\n cfg: Config,\n): Layer.Layer<FirecrawlRead | WebRead, never, HttpClient.HttpClient> => {\n const typed = Layer.effect(FirecrawlRead, make(cfg))\n const generic = Layer.effect(\n WebRead,\n Effect.map(make(cfg), (s): WebReadService => ({ read: (request) => s.read(request) })),\n )\n return Layer.merge(typed, generic)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiFA,IAAa,gBAAb,cAAmC,QAAQ,SAA8C,CACvF,yDACD,CAAC;AA0BF,MAAM,aAAa,YAA4C;CAC7D,MAAM,gBAAgB,QAAQ,UAAU;AACxC,QAAO;EACL,KAAK,QAAQ;EACb,SAAS,CAAC,eAAe,QAAQ;EACjC,GAAI,QAAQ,oBAAoB,KAAA,KAAa,EAAE,iBAAiB,QAAQ,iBAAiB;EACzF,GAAI,QAAQ,gBAAgB,KAAA,KAAa,EAAE,aAAa,QAAQ,aAAa;EAC7E,GAAI,QAAQ,gBAAgB,KAAA,KAAa,EAAE,aAAa,QAAQ,aAAa;EAC7E,GAAI,QAAQ,YAAY,KAAA,KAAa,EAAE,SAAS,SAAS,SAAS,QAAQ,QAAQ,EAAE;EACpF,GAAI,QAAQ,YAAY,KAAA,KAAa,EAAE,SAAS,SAAS,SAAS,QAAQ,QAAQ,EAAE;EACpF,GAAI,QAAQ,WAAW,KAAA,KAAa,EAAE,QAAQ,QAAQ,QAAQ;EAC9D,GAAI,QAAQ,UAAU,KAAA,KAAa,EAAE,OAAO,QAAQ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AAO,CAAC;CACnF,EAAE;;;;;;;AAQL,MAAa,SACX,QACuE;CACvE,MAAM,QAAQ,MAAM,OAAO,eAAe,KAAK,IAAI,CAAC;CACpD,MAAM,UAAU,MAAM,OACpB,SACA,OAAO,IAAI,KAAK,IAAI,GAAG,OAAuB,EAAE,OAAO,YAAY,EAAE,KAAK,QAAQ,EAAE,EAAE,CACvF;AACD,QAAO,MAAM,MAAM,OAAO,QAAQ"}
|
|
1
|
+
{"version":3,"file":"FirecrawlRead.mjs","names":[],"sources":["../src/FirecrawlRead.ts"],"sourcesContent":["import { Context, Duration, Effect, Layer, Redacted, Schema } from \"effect\"\nimport { HttpClient, HttpClientRequest } from \"effect/unstable/http\"\nimport * as AiError from \"@effect-uai/core/AiError\"\nimport {\n type CommonReadRequest,\n type ReadResponse,\n WebRead,\n type WebReadService,\n} from \"@effect-uai/core/WebRead\"\nimport type { FirecrawlProxy } from \"./models.js\"\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/**\n * Firecrawl-typed read request. Widens {@link CommonReadRequest} with\n * Firecrawl's own scrape knobs; the common fields map onto Firecrawl's wire\n * body (see the codec below).\n */\nexport type FirecrawlReadRequest = CommonReadRequest & {\n /** Keep only the main content, dropping nav/header/footer/sidebar. */\n readonly onlyMainContent?: boolean\n /** Restrict extraction to these HTML tags / selectors. */\n readonly includeTags?: ReadonlyArray<string>\n /** Drop these HTML tags / selectors before extraction. */\n readonly excludeTags?: ReadonlyArray<string>\n /** Wait this long for the page to settle before scraping (JS-heavy sites). */\n readonly waitFor?: Duration.Duration\n /** Emulate a mobile device. */\n readonly mobile?: boolean\n /** Proxy tier - see {@link FirecrawlProxy}. */\n readonly proxy?: FirecrawlProxy\n}\n\n/**\n * Firecrawl-typed map (sitemap / URL discovery) request. Given a base `url`,\n * Firecrawl returns the site's URLs without scraping each one - handy for\n * locating specific pages (pricing, docs) before a targeted read. All fields\n * but `url` are optional.\n */\nexport type FirecrawlMapRequest = {\n readonly url: string\n /** Order results by relevance to this query. */\n readonly search?: string\n /** Cap the number of links returned. */\n readonly limit?: number\n /** How to use the site's sitemap: `only` (sitemap alone), `include`, or `skip`. */\n readonly sitemap?: \"only\" | \"include\" | \"skip\"\n /** Include links on subdomains of the base URL. */\n readonly includeSubdomains?: boolean\n /** Abort the map if it runs past this duration. */\n readonly timeout?: Duration.Duration\n}\n\n/** One discovered URL, with page metadata where Firecrawl has it. */\nexport type MapLink = {\n readonly url: string\n readonly title?: string\n readonly description?: string\n}\n\nexport type MapResponse = {\n readonly links: ReadonlyArray<MapLink>\n readonly raw: unknown\n}\n\nexport type FirecrawlReadService = {\n readonly read: (request: FirecrawlReadRequest) => Effect.Effect<ReadResponse, AiError.AiError>\n /**\n * Discover a site's URLs (sitemap-style) without scraping. Firecrawl-specific;\n * not on the generic `WebRead` tag, whose contract is a single-URL read.\n */\n readonly map: (request: FirecrawlMapRequest) => Effect.Effect<MapResponse, AiError.AiError>\n}\n\n/**\n * Provider-typed service tag. Yield this for Firecrawl-typed reads (its own\n * scrape knobs); yield the generic `WebRead` tag for provider-portable code.\n * Both are registered by {@link layer}.\n */\nexport class FirecrawlRead extends Context.Service<FirecrawlRead, FirecrawlReadService>()(\n \"@betalyra/effect-uai/providers/firecrawl/FirecrawlRead\",\n) {}\n\nexport type Config = {\n readonly apiKey: Redacted.Redacted\n readonly baseUrl?: string\n}\n\n// ---------------------------------------------------------------------------\n// Codec - request body\n// ---------------------------------------------------------------------------\n\ntype WireBody = {\n readonly url: string\n readonly formats: ReadonlyArray<string>\n readonly onlyMainContent?: boolean\n readonly includeTags?: ReadonlyArray<string>\n readonly excludeTags?: ReadonlyArray<string>\n readonly waitFor?: number\n readonly timeout?: number\n readonly mobile?: boolean\n readonly proxy?: string\n}\n\n// `markdown` / `html` map one-to-one onto Firecrawl's format names. `links` is\n// always requested so {@link ReadResponse.links} can be populated; it does not\n// change the per-page billing.\nconst buildBody = (request: FirecrawlReadRequest): WireBody => {\n const contentFormat = request.format ?? \"markdown\"\n return {\n url: request.url,\n formats: [contentFormat, \"links\"],\n ...(request.onlyMainContent !== undefined && { onlyMainContent: request.onlyMainContent }),\n ...(request.includeTags !== undefined && { includeTags: request.includeTags }),\n ...(request.excludeTags !== undefined && { excludeTags: request.excludeTags }),\n ...(request.waitFor !== undefined && { waitFor: Duration.toMillis(request.waitFor) }),\n ...(request.timeout !== undefined && { timeout: Duration.toMillis(request.timeout) }),\n ...(request.mobile !== undefined && { mobile: request.mobile }),\n ...(request.proxy !== undefined && { proxy: request.proxy }),\n }\n}\n\ntype WireMapBody = {\n readonly url: string\n readonly search?: string\n readonly limit?: number\n readonly sitemap?: string\n readonly includeSubdomains?: boolean\n readonly timeout?: number\n}\n\nconst buildMapBody = (request: FirecrawlMapRequest): WireMapBody => ({\n url: request.url,\n ...(request.search !== undefined && { search: request.search }),\n ...(request.limit !== undefined && { limit: request.limit }),\n ...(request.sitemap !== undefined && { sitemap: request.sitemap }),\n ...(request.includeSubdomains !== undefined && { includeSubdomains: request.includeSubdomains }),\n ...(request.timeout !== undefined && { timeout: Duration.toMillis(request.timeout) }),\n})\n\n// ---------------------------------------------------------------------------\n// Codec - response\n// ---------------------------------------------------------------------------\n\nconst WireMetadata = Schema.Struct({\n // Firecrawl returns `title` as a string, an array (repeated meta tags), or\n // null; normalize to a single string in `toResponse`.\n title: Schema.optional(Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)]))),\n sourceURL: Schema.optional(Schema.NullOr(Schema.String)),\n statusCode: Schema.optional(Schema.Number),\n})\n\nconst WireData = Schema.Struct({\n markdown: Schema.optional(Schema.NullOr(Schema.String)),\n html: Schema.optional(Schema.NullOr(Schema.String)),\n rawHtml: Schema.optional(Schema.NullOr(Schema.String)),\n links: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))),\n metadata: Schema.optional(WireMetadata),\n})\n\n/**\n * `data` is optional because a failed scrape is not an HTTP failure. Firecrawl\n * answers 200 with `{ success: false, error }` when a page is blocked, times\n * out or renders only under JS — so requiring `data` turned every one of those\n * into a decode error, which was then reported as a transport fault and\n * retried on the backoff schedule.\n */\nconst WireResponse = Schema.Struct({\n success: Schema.optional(Schema.Boolean),\n data: Schema.optional(WireData),\n error: Schema.optional(Schema.NullOr(Schema.String)),\n})\ntype WireResponse = typeof WireResponse.Type\n\nconst pickTitle = (title: string | ReadonlyArray<string> | null | undefined): string | undefined =>\n typeof title === \"string\" ? title : Array.isArray(title) ? title[0] : undefined\n\nconst toResponse = (\n wire: WireResponse,\n data: NonNullable<WireResponse[\"data\"]>,\n request: FirecrawlReadRequest,\n): ReadResponse => {\n const format = request.format ?? \"markdown\"\n const content = (format === \"html\" ? data.html : data.markdown) ?? \"\"\n const title = pickTitle(data.metadata?.title)\n const links = data.links ?? undefined\n return {\n url: data.metadata?.sourceURL ?? request.url,\n content,\n ...(title !== undefined && { title }),\n ...(links !== undefined && links.length > 0 && { links }),\n raw: wire,\n }\n}\n\n// v2 returns link objects; older responses returned bare URL strings. Accept\n// both and normalize a string to `{ url }` in `toMapResponse`.\nconst WireMapLink = Schema.Struct({\n url: Schema.String,\n title: Schema.optional(Schema.NullOr(Schema.String)),\n description: Schema.optional(Schema.NullOr(Schema.String)),\n})\n\nconst WireMapResponse = Schema.Struct({\n success: Schema.optional(Schema.Boolean),\n links: Schema.Array(Schema.Union([WireMapLink, Schema.String])),\n})\ntype WireMapResponse = typeof WireMapResponse.Type\n\nconst toMapLink = (link: typeof WireMapLink.Type | string): MapLink =>\n typeof link === \"string\"\n ? { url: link }\n : {\n url: link.url,\n ...(link.title != null && { title: link.title }),\n ...(link.description != null && { description: link.description }),\n }\n\nconst toMapResponse = (wire: WireMapResponse): MapResponse => ({\n links: wire.links.map(toMapLink),\n raw: wire,\n})\n\n// ---------------------------------------------------------------------------\n// HTTP\n// ---------------------------------------------------------------------------\n\nconst transportFailure = (cause: unknown): AiError.AiError =>\n new AiError.Unavailable({ provider: \"firecrawl\", raw: cause })\n\n/**\n * The call arrived and the answer is unusable — a scrape Firecrawl itself\n * reports as failed, or a body that does not match what this provider knows how\n * to read.\n *\n * Deliberately not `Unavailable`: that tag is retryable, and neither of these\n * gets better on a second attempt. A blocked page stays blocked while the\n * backoff spends the scrape budget on it, and a changed API shape is a code\n * problem, not a weather problem.\n */\nconst unusableResponse = (message: string, raw: unknown): AiError.AiError =>\n new AiError.GenerationFailed({ provider: \"firecrawl\", message, raw })\n\nconst httpStatusError = (status: number, body: string): AiError.AiError => {\n const provider = \"firecrawl\"\n const raw = body\n if (status === 429) return new AiError.RateLimited({ provider, raw })\n if (status === 408 || status === 504) return new AiError.Timeout({ provider, raw })\n if (status === 401) return new AiError.AuthFailed({ provider, subtype: \"auth\", raw })\n if (status === 403) return new AiError.AuthFailed({ provider, subtype: \"permission\", raw })\n if (status === 402) return new AiError.AuthFailed({ provider, subtype: \"billing\", raw })\n if (status >= 500) return new AiError.Unavailable({ provider, status, raw })\n return new AiError.InvalidRequest({ provider, raw })\n}\n\nconst baseUrl = (cfg: Config): string => cfg.baseUrl ?? \"https://api.firecrawl.dev\"\n\nconst postScrape = (\n cfg: Config,\n body: WireBody,\n): Effect.Effect<WireResponse, AiError.AiError, HttpClient.HttpClient> =>\n Effect.gen(function* () {\n const client = yield* HttpClient.HttpClient\n const httpRequest = HttpClientRequest.post(`${baseUrl(cfg)}/v2/scrape`).pipe(\n HttpClientRequest.setHeader(\"Authorization\", `Bearer ${Redacted.value(cfg.apiKey)}`),\n HttpClientRequest.bodyJsonUnsafe(body),\n )\n const response = yield* client.execute(httpRequest).pipe(Effect.mapError(transportFailure))\n if (response.status >= 400) {\n const text = yield* response.text.pipe(Effect.orElseSucceed(() => \"\"))\n return yield* httpStatusError(response.status, text)\n }\n const json = yield* response.json.pipe(Effect.mapError(transportFailure))\n return yield* Schema.decodeUnknownEffect(WireResponse)(json).pipe(\n Effect.mapError((issue) =>\n unusableResponse(\"firecrawl returned a body this provider cannot read\", issue),\n ),\n )\n })\n\nconst readImpl =\n (cfg: Config) =>\n (\n request: FirecrawlReadRequest,\n ): Effect.Effect<ReadResponse, AiError.AiError, HttpClient.HttpClient> =>\n Effect.flatMap(postScrape(cfg, buildBody(request)), (wire) =>\n // A 200 carrying `success: false` is Firecrawl reporting the page could\n // not be scraped — blocked, JS-only, or timed out. Its own message is the\n // useful part, so it becomes the error rather than a decode failure.\n wire.data === undefined || wire.success === false\n ? Effect.fail(\n unusableResponse(wire.error ?? `firecrawl could not scrape ${request.url}`, wire),\n )\n : Effect.succeed(toResponse(wire, wire.data, request)),\n )\n\nconst postMap = (\n cfg: Config,\n body: WireMapBody,\n): Effect.Effect<WireMapResponse, AiError.AiError, HttpClient.HttpClient> =>\n Effect.gen(function* () {\n const client = yield* HttpClient.HttpClient\n const httpRequest = HttpClientRequest.post(`${baseUrl(cfg)}/v2/map`).pipe(\n HttpClientRequest.setHeader(\"Authorization\", `Bearer ${Redacted.value(cfg.apiKey)}`),\n HttpClientRequest.bodyJsonUnsafe(body),\n )\n const response = yield* client.execute(httpRequest).pipe(Effect.mapError(transportFailure))\n if (response.status >= 400) {\n const text = yield* response.text.pipe(Effect.orElseSucceed(() => \"\"))\n return yield* httpStatusError(response.status, text)\n }\n const json = yield* response.json.pipe(Effect.mapError(transportFailure))\n return yield* Schema.decodeUnknownEffect(WireMapResponse)(json).pipe(\n Effect.mapError(transportFailure),\n )\n })\n\nconst mapImpl =\n (cfg: Config) =>\n (\n request: FirecrawlMapRequest,\n ): Effect.Effect<MapResponse, AiError.AiError, HttpClient.HttpClient> =>\n Effect.map(postMap(cfg, buildMapBody(request)), toMapResponse)\n\n// ---------------------------------------------------------------------------\n// Constructors\n// ---------------------------------------------------------------------------\n\n/**\n * Build a `FirecrawlReadService` value. For Layer-based setup, prefer\n * {@link layer}.\n */\nexport const make = (\n cfg: Config,\n): Effect.Effect<FirecrawlReadService, never, HttpClient.HttpClient> =>\n Effect.map(HttpClient.HttpClient, (client) => ({\n read: (request) =>\n readImpl(cfg)(request).pipe(Effect.provideService(HttpClient.HttpClient, client)),\n map: (request) =>\n mapImpl(cfg)(request).pipe(Effect.provideService(HttpClient.HttpClient, client)),\n }))\n\n/**\n * Layer registering both the provider-typed `FirecrawlRead` tag and the\n * generic `WebRead` tag over one implementation. A `CommonReadRequest` is\n * structurally a `FirecrawlReadRequest` with the extra knobs unset, so the\n * generic registration forwards directly.\n */\nexport const layer = (\n cfg: Config,\n): Layer.Layer<FirecrawlRead | WebRead, never, HttpClient.HttpClient> => {\n const typed = Layer.effect(FirecrawlRead, make(cfg))\n const generic = Layer.effect(\n WebRead,\n Effect.map(make(cfg), (s): WebReadService => ({ read: (request) => s.read(request) })),\n )\n return Layer.merge(typed, generic)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiFA,IAAa,gBAAb,cAAmC,QAAQ,QAA6C,CAAC,CACvF,wDACF,CAAC,CAAC,CAAC;AA0BH,MAAM,aAAa,YAA4C;CAC7D,MAAM,gBAAgB,QAAQ,UAAU;CACxC,OAAO;EACL,KAAK,QAAQ;EACb,SAAS,CAAC,eAAe,OAAO;EAChC,GAAI,QAAQ,oBAAoB,KAAA,KAAa,EAAE,iBAAiB,QAAQ,gBAAgB;EACxF,GAAI,QAAQ,gBAAgB,KAAA,KAAa,EAAE,aAAa,QAAQ,YAAY;EAC5E,GAAI,QAAQ,gBAAgB,KAAA,KAAa,EAAE,aAAa,QAAQ,YAAY;EAC5E,GAAI,QAAQ,YAAY,KAAA,KAAa,EAAE,SAAS,SAAS,SAAS,QAAQ,OAAO,EAAE;EACnF,GAAI,QAAQ,YAAY,KAAA,KAAa,EAAE,SAAS,SAAS,SAAS,QAAQ,OAAO,EAAE;EACnF,GAAI,QAAQ,WAAW,KAAA,KAAa,EAAE,QAAQ,QAAQ,OAAO;EAC7D,GAAI,QAAQ,UAAU,KAAA,KAAa,EAAE,OAAO,QAAQ,MAAM;CAC5D;AACF;AAWA,MAAM,gBAAgB,aAA+C;CACnE,KAAK,QAAQ;CACb,GAAI,QAAQ,WAAW,KAAA,KAAa,E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F,EAAE;;;;;;;AAQJ,MAAa,SACX,QACuE;CACvE,MAAM,QAAQ,MAAM,OAAO,eAAe,KAAK,GAAG,CAAC;CACnD,MAAM,UAAU,MAAM,OACpB,SACA,OAAO,IAAI,KAAK,GAAG,IAAI,OAAuB,EAAE,OAAO,YAAY,EAAE,KAAK,OAAO,EAAE,EAAE,CACvF;CACA,OAAO,MAAM,MAAM,OAAO,OAAO;AACnC"}
|
package/dist/models.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.mts","names":[],"sources":["../src/models.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"models.d.mts","names":[],"sources":["../src/models.ts"],"mappings":";;;;;;KAKY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-uai/firecrawl",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Firecrawl provider for @effect-uai/core (web read).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"effect": "4.0.0-
|
|
47
|
-
"typescript": "^
|
|
48
|
-
"@effect-uai/core": "0.12.
|
|
46
|
+
"effect": "4.0.0-rc.111",
|
|
47
|
+
"typescript": "^7.0.2",
|
|
48
|
+
"@effect-uai/core": "0.12.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@effect-uai/core": ">=0.2.0 <1",
|
|
52
|
-
"effect": ">=4.0.0-
|
|
52
|
+
"effect": ">=4.0.0-rc.111 <5.0.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsdown",
|
|
File without changes
|