feat: add Firecrawl provider - #35
Merged
Merged
Conversation
There was a problem hiding this comment.
4 issues found across 9 files
Confidence score: 3/5
- There is concrete user-impact risk in
src/providers/firecrawl.ts:read()can return emptycontentfor non-markdown requests becausecontentis still sourced from markdown, which can surface as blank output in CLI/API consumers. src/providers/firecrawl.tsalso has two medium-severity integration mismatches (format: 'text'passed to Firecrawl andnewssources mapped throughdata.web), both of which can cause failed reads or empty results for valid user requests.- Given multiple high-confidence issues at severity 6–7/10 in request/response handling paths, this looks like moderate merge risk rather than a safe immediate merge.
- Pay close attention to
src/providers/firecrawl.tsandAGENTS.md- provider behavior may fail for text/news flows, and the checklist wording could steer future implementations away from the intended capability model.
Architecture diagram
sequenceDiagram
participant P as Pi Extension (askweb.ts)
participant R as Resolver (resolve.ts)
participant F as Firecrawl Provider (firecrawl.ts)
participant CL as HTTP Client (client.ts)
participant FC as Firecrawl API (api.firecrawl.dev)
participant Reg as Registry (registry.ts)
participant Read as Read Provider (read.ts)
Note over P,FC: Runtime Flow for Firecrawl Provider
P->>R: resolve("firecrawl")
R->>R: lookup FIRECRAWL_API_KEY env var
R-->>P: provider configuration
P->>Reg: create("firecrawl", config)
Reg->>F: new FirecrawlProvider(config)
Note over F: Checks apiKey, throws AuthError if missing
F-->>Reg: provider instance
alt Search Flow
P->>F: search(query, options?)
F->>F: clampMaxResults(options?.maxResults)
alt includeDomains/excludeDomains provided
F->>F: add domain filters to body
end
alt category === "news"
F->>F: set sources: ["news"]
end
F->>CL: postJSON(url="/v2/search", body, authHeaders)
CL->>FC: POST /v2/search (Authorization: Bearer <key>)
FC-->>CL: FirecrawlSearchResponse
CL-->>F: parsed response
alt success == true
F->>F: map each result (markdown → text field)
F-->>P: SearchResult[]
else success == false
F->>F: throw Error ("search failed")
F-->>P: normalized error
end
end
alt Read Flow
P->>Read: resolve read provider
Read->>Read: firecrawl in readProviderNames list
Read-->>P: read provider resolved
P->>F: read(url, options?)
F->>F: set formats: [options?.format] (default "markdown")
opt options?.timeout provided
F->>F: convert seconds to milliseconds
end
F->>CL: postJSON(url="/v2/scrape", body, authHeaders)
CL->>FC: POST /v2/scrape (Authorization: Bearer <key>)
FC-->>CL: FirecrawlScrapeResponse
CL-->>F: parsed response
alt success == true
F->>F: extract markdown, html, metadata
F-->>P: ReadResult with content, title, description, image
else success == false
F->>F: throw Error ("scrape failed")
F-->>P: normalized error
end
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 6 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Requires human review: Adding a new provider touches core registration, resolution, Pi tool descriptions, and environment variable mappings—changes to business logic and integration points that require a human reviewer to verify correctness and security.
Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Firecrawl as a search and read provider. Search through
/v2/search, scrape through/v2/scrape. Env var:FIRECRAWL_API_KEY. Supports domain filters and news category. Read returns markdown by default.Also added a provider addition checklist to
AGENTS.mdsince there are 7 files to touch when adding a new provider and it's easy to miss one.