@narumitw/pi-firecrawl 0.50.0 โ 0.50.2
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 +68 -60
- package/dist/index.ts +1303 -0
- package/dist/index.ts.map +7 -0
- package/package.json +11 -7
- package/src/firecrawl.ts +13 -5
- package/src/lazy-tools.ts +63 -8
- package/src/tool-selector.ts +11 -7
package/README.md
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
# ๐ฅ pi-firecrawl โ
|
|
1
|
+
# ๐ฅ pi-firecrawl โ Scrape and Research the Web from Pi
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@narumitw/pi-firecrawl) [](https://pi.dev) [](./LICENSE)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Use it to give your AI coding agent reliable web research capabilities for documentation lookup, website audits, competitive research, content extraction, and retrieval-friendly markdown scraping.
|
|
5
|
+
Give Pi on-demand [Firecrawl](https://www.firecrawl.dev/) tools for web search, scraping, crawling, URL discovery, and retrieval-friendly content extraction.
|
|
8
6
|
|
|
9
7
|
## โจ Features
|
|
10
8
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- Keeps one loader tool active and exposes matching Firecrawl capabilities only when needed.
|
|
19
|
-
- Provides a `/firecrawl` menu with configuration help and availability controls.
|
|
20
|
-
- Uses `@narumitw/pi-tui-kit` for width-safe menus and individual tool selection.
|
|
21
|
-
- Persists the Firecrawl lazy-load catalog across Pi restarts.
|
|
22
|
-
- Bounds tool output to Pi's 50 KB or 2,000-line limit while preserving oversized responses in private temporary files.
|
|
23
|
-
- Never logs, displays, or stores your Firecrawl API key.
|
|
9
|
+
- Scrapes a URL into markdown, HTML, links, screenshots, or structured JSON.
|
|
10
|
+
- Starts crawl jobs, checks their status, and retrieves completed crawl data.
|
|
11
|
+
- Discovers site URLs and searches the web with optional result-page scraping.
|
|
12
|
+
- Loads only the Firecrawl capabilities needed for the task and manages availability through `/firecrawl`.
|
|
13
|
+
- Supports custom Firecrawl endpoints and shows activity only while a tool is running.
|
|
14
|
+
- Bounds model-visible output while preserving oversized responses in private temporary files.
|
|
15
|
+
- Reads the API key from the environment and never logs, displays, or stores it.
|
|
24
16
|
|
|
25
17
|
## ๐ฆ Install
|
|
26
18
|
|
|
@@ -34,13 +26,21 @@ Try without installing permanently:
|
|
|
34
26
|
FIRECRAWL_API_KEY=fc-... pi -e npm:@narumitw/pi-firecrawl
|
|
35
27
|
```
|
|
36
28
|
|
|
37
|
-
|
|
29
|
+
Build and try this package locally from the repository root:
|
|
38
30
|
|
|
39
31
|
```bash
|
|
32
|
+
npm --workspace @narumitw/pi-firecrawl run build
|
|
40
33
|
FIRECRAWL_API_KEY=fc-... pi -e ./packages/pi-firecrawl
|
|
41
34
|
```
|
|
42
35
|
|
|
43
|
-
|
|
36
|
+
The package declares `dist/index.ts`, so an unbuilt local checkout must run the build before Pi loads the package directory.
|
|
37
|
+
|
|
38
|
+
## ๐ Quick start
|
|
39
|
+
|
|
40
|
+
Set `FIRECRAWL_API_KEY`, start Pi with the extension, and ask the agent to load the Firecrawl capability needed for the task.
|
|
41
|
+
Use `/firecrawl` to review configuration and control which capability tools may be loaded.
|
|
42
|
+
|
|
43
|
+
## โ๏ธ Settings
|
|
44
44
|
|
|
45
45
|
Set a Firecrawl API key before running Pi:
|
|
46
46
|
|
|
@@ -54,9 +54,10 @@ Optional API endpoint override:
|
|
|
54
54
|
export FIRECRAWL_API_URL=https://api.firecrawl.dev/v1
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
`FIRECRAWL_BASE_URL` is also accepted for compatibility.
|
|
57
|
+
`FIRECRAWL_BASE_URL` is also accepted for compatibility.
|
|
58
|
+
The extension never logs or displays the API key.
|
|
58
59
|
|
|
59
|
-
## ๐ ๏ธ
|
|
60
|
+
## ๐ ๏ธ Tools
|
|
60
61
|
|
|
61
62
|
- `firecrawl_load` โ find and load Firecrawl capabilities relevant to a web research task.
|
|
62
63
|
- `firecrawl_scrape` โ scrape a single URL and return requested formats such as markdown, HTML, links, screenshots, or JSON.
|
|
@@ -65,9 +66,11 @@ export FIRECRAWL_API_URL=https://api.firecrawl.dev/v1
|
|
|
65
66
|
- `firecrawl_map` โ discover URLs for a site.
|
|
66
67
|
- `firecrawl_search` โ search the web through Firecrawl and optionally scrape result pages.
|
|
67
68
|
|
|
68
|
-
###
|
|
69
|
+
### Tool exposure
|
|
70
|
+
|
|
71
|
+
All six tools are registered.
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
On a model/provider with native deferred-tool support, only `firecrawl_load` starts active for this extension.
|
|
71
74
|
|
|
72
75
|
The loader accepts a task-oriented `query`, filters to capabilities allowed by settings, and adds up to three matching tools by default without removing any active Pi tool.
|
|
73
76
|
|
|
@@ -79,13 +82,19 @@ Loaded capability tools remain active for the session unless the user makes them
|
|
|
79
82
|
|
|
80
83
|
On reload, resume, or fork, capabilities recorded by `firecrawl_load` on the active branch are restored when the current catalog still allows them.
|
|
81
84
|
|
|
82
|
-
Pi uses native deferred tool references on compatible Anthropic and OpenAI models.
|
|
85
|
+
Pi uses native deferred tool references on compatible Anthropic models, native additional-tools or tool-search loading on compatible OpenAI and Codex Responses models, and native Kimi loading on compatible OpenAI Chat Completions models.
|
|
83
86
|
|
|
84
|
-
|
|
87
|
+
Kimi-compatible models declare `compat.deferredToolsMode: "kimi"` in Pi's model metadata.
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
`azure-openai-responses` remains eager because Pi's Azure adapter does not implement native deferred tool-search serialization.
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
When the selected model/provider lacks native deferred support, the extension activates every capability allowed by settings before the next model request instead of using Pi's cache-invalidating lazy-loading fallback.
|
|
92
|
+
|
|
93
|
+
After a session enters eager exposure, it stays eager across later model switches to avoid removing tool definitions within that session.
|
|
94
|
+
|
|
95
|
+
The capability tools omit active-only prompt metadata so native deferred loading does not rebuild the system-prompt prefix.
|
|
96
|
+
|
|
97
|
+
The saved `tools` array controls which capabilities the extension may expose.
|
|
89
98
|
|
|
90
99
|
An empty array leaves the loader active but makes every Firecrawl API capability unavailable.
|
|
91
100
|
|
|
@@ -93,21 +102,19 @@ An empty array leaves the loader active but makes every Firecrawl API capability
|
|
|
93
102
|
|
|
94
103
|
Every API capability fails with a clear configuration error when `FIRECRAWL_API_KEY` is missing, and the always-active loader guidance tells the agent not to retry repeatedly.
|
|
95
104
|
|
|
96
|
-
Tool output is limited to 50 KB or 2,000 lines, whichever is reached first.
|
|
97
|
-
truncated, the result reports the original and displayed sizes and the path to a complete temporary
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
are bounded in the same way.
|
|
105
|
+
Tool output is limited to 50 KB or 2,000 lines, whichever is reached first.
|
|
106
|
+
When a response is truncated, the result reports the original and displayed sizes and the path to a complete temporary JSON file.
|
|
107
|
+
These files use private permissions, remain available for the current session, and are removed during session shutdown or reload.
|
|
108
|
+
Tool-result metadata contains only size and artifact information rather than a duplicate of the raw Firecrawl response.
|
|
109
|
+
Oversized Firecrawl error bodies are bounded in the same way.
|
|
102
110
|
|
|
103
|
-
## ๐ฌ
|
|
111
|
+
## ๐ฌ Commands
|
|
104
112
|
|
|
105
113
|
```text
|
|
106
114
|
/firecrawl
|
|
107
115
|
```
|
|
108
116
|
|
|
109
|
-
Opens a menu with configuration quick start, command usage,
|
|
110
|
-
all Firecrawl capabilities available or unavailable, and a selector for choosing individual tools.
|
|
117
|
+
Opens a menu with configuration quick start, command usage, tool-catalog status, controls for making all Firecrawl capabilities available or unavailable, and a selector for choosing individual tools.
|
|
111
118
|
|
|
112
119
|
Direct subcommands are also available:
|
|
113
120
|
|
|
@@ -125,19 +132,16 @@ Direct subcommands are also available:
|
|
|
125
132
|
- `help` shows command usage.
|
|
126
133
|
- `config` shows API-key presence and API URL without displaying the API key value.
|
|
127
134
|
- `quickstart` is an alias for `config`.
|
|
128
|
-
- `status` shows available and loaded capability counts, loader state, the persisted catalog,
|
|
129
|
-
|
|
130
|
-
- `tools` opens a width-safe immediate-save selector for choosing capabilities available to lazy-load.
|
|
135
|
+
- `status` shows available and loaded capability counts, loader state, the persisted catalog, settings file path, API-key presence, API URL, and active non-Firecrawl tool count.
|
|
136
|
+
- `tools` opens a width-safe immediate-save selector for choosing available capabilities.
|
|
131
137
|
- `toggle` is an alias for `tools`.
|
|
132
|
-
- `enable` makes all five API capabilities available
|
|
138
|
+
- `enable` makes all five API capabilities available and follows the current native-deferred or eager exposure mode.
|
|
133
139
|
- `disable` makes all five API capabilities unavailable and unloads affected active definitions.
|
|
134
140
|
The slash command and `firecrawl_load` remain available.
|
|
135
141
|
|
|
136
|
-
The menu, `tools`, `help`, `config`, `quickstart`, and `status` routes require TUI or RPC mode so their
|
|
137
|
-
results are observable.
|
|
142
|
+
The menu, `tools`, `help`, `config`, `quickstart`, and `status` routes require TUI or RPC mode so their results are observable.
|
|
138
143
|
|
|
139
|
-
Print and JSON modes reject those routes and unknown commands explicitly instead of entering
|
|
140
|
-
unavailable UI or silently notifying a no-op channel.
|
|
144
|
+
Print and JSON modes reject those routes and unknown commands explicitly instead of entering unavailable UI or silently notifying a no-op channel.
|
|
141
145
|
|
|
142
146
|
The deterministic `enable` and `disable` routes remain available in every mode.
|
|
143
147
|
|
|
@@ -151,23 +155,21 @@ The available capability names are saved to:
|
|
|
151
155
|
${PI_CODING_AGENT_DIR:-~/.pi/agent}/pi-firecrawl.json
|
|
152
156
|
```
|
|
153
157
|
|
|
154
|
-
When the file is missing or invalid, the extension preserves Pi's current Firecrawl availability
|
|
155
|
-
|
|
156
|
-
saved catalog is restored on Pi startup and `/reload`,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
state while preserving other extensions' active tools. The settings file stores only tool names and
|
|
162
|
-
a timestamp; it never stores `FIRECRAWL_API_KEY`, request headers, or other secrets.
|
|
158
|
+
When the file is missing or invalid, the extension preserves Pi's current Firecrawl availability policy instead of replacing it.
|
|
159
|
+
An unsaved catalog remains stable across runtime reloads.
|
|
160
|
+
A valid saved catalog is restored on Pi startup and `/reload`, with capability definitions exposed natively deferred or eagerly according to model/provider support.
|
|
161
|
+
A missing file is created by the first successful availability change.
|
|
162
|
+
Within one Pi process, catalog saves run in invocation order, reread the latest valid document, and preserve unknown fields.
|
|
163
|
+
Malformed JSON or invalid recognized fields block the save without replacement; a failed save restores both the prior availability and loaded capability state while preserving other extensions' active tools.
|
|
164
|
+
The settings file stores only tool names and a timestamp; it never stores `FIRECRAWL_API_KEY`, request headers, or other secrets.
|
|
163
165
|
|
|
164
|
-
Compatibility: older versions used `pi-firecrawl-settings.json`.
|
|
165
|
-
readable with a warning and is never modified automatically; rename it to `pi-firecrawl.json`.
|
|
166
|
-
The first subsequent settings save writes the canonical file.
|
|
167
|
-
`pi-firecrawl.json` wins and the legacy file is ignored.
|
|
168
|
-
deprecated and will be removed in a future major release.
|
|
166
|
+
Compatibility: older versions used `pi-firecrawl-settings.json`.
|
|
167
|
+
A legacy-only file remains readable with a warning and is never modified automatically; rename it to `pi-firecrawl.json`.
|
|
168
|
+
The first subsequent settings save writes the canonical file.
|
|
169
|
+
If both files exist, `pi-firecrawl.json` wins and the legacy file is ignored.
|
|
170
|
+
The legacy filename is deprecated and will be removed in a future major release.
|
|
169
171
|
|
|
170
|
-
##
|
|
172
|
+
## ๐งช Examples
|
|
171
173
|
|
|
172
174
|
Scrape a page as markdown:
|
|
173
175
|
|
|
@@ -211,6 +213,9 @@ Start a crawl with markdown extraction:
|
|
|
211
213
|
|
|
212
214
|
```txt
|
|
213
215
|
packages/pi-firecrawl/
|
|
216
|
+
โโโ dist/ # Generated TypeScript runtime loaded by Jiti
|
|
217
|
+
โโโ scripts/
|
|
218
|
+
โ โโโ build-runtime.mjs # Deterministic runtime builder and boundary validator
|
|
214
219
|
โโโ src/
|
|
215
220
|
โ โโโ index.ts # Pi package entrypoint
|
|
216
221
|
โ โโโ firecrawl.ts # Extension registration and command orchestration
|
|
@@ -224,10 +229,13 @@ packages/pi-firecrawl/
|
|
|
224
229
|
|
|
225
230
|
`index.ts` is the Pi entrypoint and forwards to `firecrawl.ts`; the other source modules are internal.
|
|
226
231
|
|
|
232
|
+
The generated runtime is built from the authoritative `src/index.ts` graph and does not import back into `src`.
|
|
233
|
+
|
|
227
234
|
## ๐ Keywords
|
|
228
235
|
|
|
229
236
|
Pi extension, Pi coding agent, Firecrawl, web scraping, web crawling, URL discovery, web search, markdown extraction, AI research agent, TypeScript Pi tools.
|
|
230
237
|
|
|
231
238
|
## ๐ License
|
|
232
239
|
|
|
233
|
-
MIT.
|
|
240
|
+
MIT.
|
|
241
|
+
See [`LICENSE`](./LICENSE).
|