@narumitw/pi-firecrawl 0.50.4 → 0.51.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/README.md CHANGED
@@ -2,14 +2,14 @@
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
- Add on-demand [Firecrawl](https://www.firecrawl.dev/) tools to Pi for web search, scraping, crawling, URL discovery, and content extraction.
5
+ Add [Firecrawl](https://www.firecrawl.dev/) tools to Pi for web search, scraping, crawling, URL discovery, and content extraction.
6
6
 
7
7
  ## ✨ Features
8
8
 
9
9
  - Scrapes a URL into markdown, HTML, links, screenshots, or structured JSON.
10
10
  - Starts crawl jobs, checks their status, and retrieves completed crawl data.
11
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`.
12
+ - Offers Codemode, Lazy loading, and Direct tools modes with availability controls through `/firecrawl`.
13
13
  - Supports custom Firecrawl endpoints and shows status only while a tool is running.
14
14
  - Bounds model-visible output while preserving oversized responses in private temporary files.
15
15
  - Reads the API key from the environment and never logs, displays, or stores it.
@@ -42,8 +42,9 @@ Review third-party extension source before installing it.
42
42
 
43
43
  ## 🚀 Quick start
44
44
 
45
- Set `FIRECRAWL_API_KEY`, start Pi with the extension, and ask the agent to load the Firecrawl capability needed for the task.
46
- Run `/firecrawl` to review configuration and choose which capabilities the loader may expose.
45
+ Set `FIRECRAWL_API_KEY`, enable Pi's codemode with `"defaultTools": ["+codemode"]` in Pi's `settings.json`, and start Pi with the extension.
46
+ Ask the agent to search or scrape a page through Firecrawl using codemode.
47
+ Run `/firecrawl settings` to choose another tool mode or change capability availability.
47
48
 
48
49
  ## ⚙️ Settings
49
50
 
@@ -62,20 +63,38 @@ export FIRECRAWL_API_URL=https://api.firecrawl.dev/v1
62
63
  `FIRECRAWL_BASE_URL` is also accepted for compatibility.
63
64
  The API key remains in the environment and is sent only as a bearer credential to the configured Firecrawl endpoint.
64
65
 
65
- Available capability names are saved to:
66
+ Open `/firecrawl settings` in TUI mode to edit Tool mode and the five capability switches.
67
+ Mode changes save immediately and apply at the next session start, including `/reload`; capability switches apply immediately using the running mode.
68
+ Closing the screen does not undo saved changes.
69
+ In RPC mode, the settings route shows the path and manual-edit instructions; print and JSON modes reject this route.
70
+
71
+ User settings are saved to:
66
72
 
67
73
  ```text
68
74
  ${PI_CODING_AGENT_DIR:-~/.pi/agent}/pi-firecrawl.json
69
75
  ```
70
76
 
71
- A missing or invalid file leaves the current Firecrawl availability policy unchanged.
72
- An unsaved catalog remains stable across runtime reloads.
73
- A valid catalog is restored on startup and `/reload`, with native deferred or eager exposure chosen from model and provider support.
74
- The first successful availability change creates a missing file.
77
+ ```json
78
+ {
79
+ "toolMode": "codemode",
80
+ "tools": ["firecrawl_scrape", "firecrawl_crawl", "firecrawl_crawl_status", "firecrawl_map", "firecrawl_search"],
81
+ "updatedAt": 1
82
+ }
83
+ ```
84
+
85
+ `toolMode` accepts `codemode` (default), `lazy`, or `direct`; see [Tool exposure](#tool-exposure).
86
+ Existing valid files without `toolMode` also use the new codemode default, preserving their tool selection.
87
+ To restore the previous behavior, choose `lazy` and run `/reload`.
88
+ A fresh runtime allows all five capabilities; a missing or invalid file preserves any existing unsaved availability policy across reloads.
89
+ Invalid settings produce a warning and block saves until repaired.
90
+ Loading a missing file creates nothing; the first explicit settings change creates it.
91
+ Manual file edits apply at the next session start, including `/reload`.
92
+ There are no project overrides; `tools` controls availability independently from `toolMode`.
75
93
  Within one Pi process, saves run in invocation order, reread the latest valid document, and preserve unknown fields.
76
94
  Malformed JSON or invalid recognized fields block saves without replacing the file.
77
95
  A failed save restores the previous availability and loaded capabilities while preserving other extensions' active tools.
78
- The file stores only tool names and a timestamp, never `FIRECRAWL_API_KEY`, request headers, or other secrets.
96
+ Mode and availability saves change only their owned fields, so an availability edit does not overwrite a pending saved mode.
97
+ The file stores mode, tool names, and a timestamp, never `FIRECRAWL_API_KEY`, request headers, or other secrets.
79
98
 
80
99
  Older versions used `pi-firecrawl-settings.json`.
81
100
  A legacy-only file remains readable with a warning and is never modified automatically; rename it to `pi-firecrawl.json`.
@@ -85,7 +104,7 @@ The legacy filename is deprecated and will be removed in a future major release.
85
104
 
86
105
  ## 🛠️ Tools
87
106
 
88
- - `firecrawl_load` — find and load Firecrawl capabilities relevant to a web research task.
107
+ - `firecrawl_load` — find and load capabilities; available only in Lazy loading mode.
89
108
  - `firecrawl_scrape` — scrape a single URL and return requested formats such as markdown, HTML, links, screenshots, or JSON.
90
109
  - `firecrawl_crawl` — start a site crawl job and return the Firecrawl job id.
91
110
  - `firecrawl_crawl_status` — check a crawl job status and retrieve completed crawl data.
@@ -94,8 +113,24 @@ The legacy filename is deprecated and will be removed in a future major release.
94
113
 
95
114
  ### Tool exposure
96
115
 
97
- The extension registers six tools: one loader and five API capabilities.
98
- With native deferred-tool support, only `firecrawl_load` starts active.
116
+ | Mode | Tool exposure | Loader |
117
+ | --- | --- | --- |
118
+ | `codemode` (default) | Five allowed tools are callable through codemode and discoverable with `searchTools()` / `describeTool()`, without direct declarations. | None. |
119
+ | `lazy` | Only the loader starts active on native-deferred-compatible models; it appends capabilities as needed. | `firecrawl_load` stays active; loading all five yields six active Firecrawl tools. |
120
+ | `direct` | All five allowed tools are declared immediately. | None. |
121
+
122
+ Counts assume all capabilities are enabled.
123
+ Disabled capabilities are hidden and cannot be called or activated in any mode; `/firecrawl disable` makes all five unavailable.
124
+ Codemode mode does not explicitly activate capability tools; Pi's general tool controls can explicitly declare allowed codemode tools.
125
+
126
+ These modes require a Pi release with tool exposure support.
127
+ Codemode must be active in Pi for the default workflow.
128
+ Add `"defaultTools": ["+codemode"]` to Pi's `settings.json` and `/reload`.
129
+ Pi's `--tools` flag is an allowlist for extension tools too; a list that omits the Firecrawl capabilities prevents codemode from discovering or calling them.
130
+ The extension warns when codemode is inactive and does not silently switch modes.
131
+ Choose `lazy` or `direct` if you do not want to enable codemode.
132
+
133
+ In Lazy loading mode, with native deferred-tool support, only `firecrawl_load` starts active.
99
134
  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.
100
135
  Set `limit` from 1 to 5 to change the maximum number loaded by one call.
101
136
  A general website-crawl query can load both `firecrawl_crawl` and `firecrawl_crawl_status`, while a status-specific query loads the status capability.
@@ -107,14 +142,16 @@ Kimi-compatible models declare `compat.deferredToolsMode: "kimi"` in Pi's model
107
142
  `azure-openai-responses` remains eager because Pi's Azure adapter does not implement native deferred tool-search serialization.
108
143
  Fireworks Messages models also remain eager because their native protocol requires the canonical `ToolSearch` or `tool_search` loader name, while this independently installable package keeps the collision-safe `firecrawl_load` name.
109
144
  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.
110
- After a session enters eager exposure, it stays eager across later model switches to avoid removing tool definitions within that session.
145
+ After a Lazy loading session enters eager exposure, it stays eager across later model switches to avoid removing tool definitions within that session.
146
+ Model switches do not change Codemode or Direct tools mode.
111
147
  The capability tools omit active-only prompt metadata so native deferred loading does not rebuild the system-prompt prefix.
112
148
 
113
149
  The saved `tools` array controls which capabilities the extension may expose.
114
- An empty array leaves the loader active but makes every Firecrawl API capability unavailable.
150
+ An empty array makes every Firecrawl API capability unavailable; only Lazy loading mode retains an active loader.
115
151
 
116
152
  `firecrawl_load` performs no network request and does not create response artifacts.
117
- 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.
153
+ Every API capability fails with a clear configuration error when `FIRECRAWL_API_KEY` is missing; configure the key instead of retrying repeatedly.
154
+ Settings changes, reloads, and a Lazy loading fallback to eager exposure are intentional model-visible tool transitions; ordinary turns do not reconfigure the tools or rewrite conversation history.
118
155
 
119
156
  Tool output is limited to 50 KB or 2,000 lines, whichever is reached first.
120
157
  When a response is truncated, the result reports the original and displayed sizes and the path to a complete temporary JSON file.
@@ -128,14 +165,15 @@ Oversized Firecrawl error bodies are bounded in the same way.
128
165
  | `/firecrawl` | Manage available Firecrawl tools and inspect configuration. |
129
166
  | `/firecrawl help` | Show command usage. |
130
167
  | `/firecrawl config` (alias: `quickstart`) | Show API-key presence and API URL without revealing the key. |
131
- | `/firecrawl status` | Show available and loaded tools, loader state, saved catalog, and configuration status. |
168
+ | `/firecrawl status` | Show running/saved mode, effective exposure, callable and declared counts, loader state, saved catalog, and configuration status. |
169
+ | `/firecrawl settings` | Edit tool mode and capability availability in TUI, or show manual-edit instructions in RPC. |
132
170
  | `/firecrawl tools` (aliases: `toggle`, `select`) | Choose available capabilities; each toggle saves immediately. |
133
171
  | `/firecrawl enable` (alias: `on`) | Make all five API capabilities available and save the selection. |
134
172
  | `/firecrawl disable` (alias: `off`) | Make all API capabilities unavailable and save the empty selection. |
135
173
 
136
174
  All routes support TUI and RPC and reject unknown or trailing arguments.
137
175
  Only `enable` and `disable` also support print and JSON modes.
138
- Disabling capabilities leaves the slash command and `firecrawl_load` available; see [Tool exposure](#tool-exposure) for native-deferred and eager behavior.
176
+ Disabling capabilities leaves the slash command available and retains `firecrawl_load` only in Lazy loading mode; see [Tool exposure](#tool-exposure).
139
177
  Done, Escape, or cancellation closes the tool selector **without undoing saved changes**.
140
178
 
141
179
  ## 🔒 Security and privacy