@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 CHANGED
@@ -1,26 +1,18 @@
1
- # ๐Ÿ”ฅ pi-firecrawl โ€” Firecrawl Web Scraping Tools for Pi Agents
1
+ # ๐Ÿ”ฅ pi-firecrawl โ€” Scrape and Research the Web from Pi
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@narumitw/pi-firecrawl)](https://www.npmjs.com/package/@narumitw/pi-firecrawl) [![Pi extension](https://img.shields.io/badge/Pi-extension-blue)](https://pi.dev) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
4
4
 
5
- `@narumitw/pi-firecrawl` is a native [Pi coding agent](https://pi.dev) extension that exposes [Firecrawl](https://www.firecrawl.dev/) scraping, crawling, URL discovery, and search APIs as Pi tools.
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
- - Scrape a single URL into markdown, HTML, raw HTML, links, screenshots, or JSON.
12
- - Start Firecrawl crawl jobs from Pi.
13
- - Check crawl job status and retrieve completed crawl data.
14
- - Discover URLs with Firecrawl map.
15
- - Search the web and optionally scrape search result pages.
16
- - Supports Firecrawl API endpoint overrides.
17
- - Shows statusline activity only while Firecrawl tools are running.
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
- Try this package locally from the repository root:
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
- ## โš™๏ธ Configuration
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. The extension never logs or displays the API key.
57
+ `FIRECRAWL_BASE_URL` is also accepted for compatibility.
58
+ The extension never logs or displays the API key.
58
59
 
59
- ## ๐Ÿ› ๏ธ Pi tools
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
- ### Lazy tool loading
69
+ ### Tool exposure
70
+
71
+ All six tools are registered.
69
72
 
70
- All six tools are registered, but only `firecrawl_load` starts active for this extension.
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
- Other models receive Pi's safe fallback and see the newly active definitions in the normal tool list on the next model request.
87
+ Kimi-compatible models declare `compat.deferredToolsMode: "kimi"` in Pi's model metadata.
85
88
 
86
- The capability tools omit active-only prompt metadata so loading them does not rebuild the system-prompt prefix.
89
+ `azure-openai-responses` remains eager because Pi's Azure adapter does not implement native deferred tool-search serialization.
87
90
 
88
- The saved `tools` array controls which capabilities `firecrawl_load` may expose.
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. When a response is
97
- truncated, the result reports the original and displayed sizes and the path to a complete temporary
98
- JSON file. These files use private permissions, remain available for the current session, and are
99
- removed during session shutdown or reload. Tool-result metadata contains only size and artifact
100
- information rather than a duplicate of the raw Firecrawl response. Oversized Firecrawl error bodies
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
- ## ๐Ÿ’ฌ Command
111
+ ## ๐Ÿ’ฌ Commands
104
112
 
105
113
  ```text
106
114
  /firecrawl
107
115
  ```
108
116
 
109
- Opens a menu with configuration quick start, command usage, lazy-catalog status, controls for making
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
- settings file path, API-key presence, API URL, and active non-Firecrawl tool count.
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 but leaves newly available definitions deferred.
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
- policy instead of replacing it. An unsaved catalog remains stable across runtime reloads. A valid
156
- saved catalog is restored on Pi startup and `/reload`, while its capability definitions remain
157
- deferred. A missing file is created by the first successful
158
- availability change. Within one Pi process, catalog saves run in invocation order, reread the latest
159
- valid document, and preserve unknown fields. Malformed JSON or invalid recognized fields block the
160
- save without replacement; a failed save restores both the prior availability and loaded capability
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`. A legacy-only file remains
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. If both files exist,
167
- `pi-firecrawl.json` wins and the legacy file is ignored. The legacy filename is
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
- ## ๐Ÿš€ Examples
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. See [`LICENSE`](./LICENSE).
240
+ MIT.
241
+ See [`LICENSE`](./LICENSE).