pi-smart-fetch 0.2.10 → 0.2.14

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
@@ -17,9 +17,12 @@ Compared with naive Node.js `fetch()`, this package gives you:
17
17
  - **useful metadata** like title, author, published date, site, and language when available
18
18
  - **multiple output formats**: `markdown`, `html`, `text`, or `json`
19
19
  - **single and batch tools**: `web_fetch` for one URL, `batch_web_fetch` for many
20
- - **pi-specific behavior** including an optional `verbose` flag and defaults from pi settings
20
+ - **pi-specific behavior** including full metadata for agents, a compact history preview for users, and defaults from pi settings
21
21
  - **bounded batch fan-out** with a configurable default concurrency of `8`
22
- - **a richer pi TUI for batch mode** with per-item rows, truncated URLs, statuses, and small progress bars
22
+ - **a richer pi TUI for batch mode** with per-item rows, truncated URLs, statuses, small progress bars, and timer-driven spinner animation
23
+ - **attachment and binary download support** when a response is an attachment or non-text payload
24
+ - **temp-file output** with sanitized filenames plus returned file metadata (`URL`, `File size`, `Mime type`, `File path`)
25
+ - **publish-ready packaging/test workflow** across the monorepo for safer releases
23
26
  - **lower overhead than browser automation** when you do not need JS execution, login, scrolling, or clicks
24
27
  - **clear limits**: it does not execute JavaScript or solve interactive anti-bot flows
25
28
 
@@ -66,18 +69,15 @@ For `batch_web_fetch`, `requests` is an array of objects, and **each item accept
66
69
 
67
70
  ### `web_fetch`
68
71
 
69
- By default, the tool returns a compact response containing non-empty:
70
- - URL
72
+ Agent-facing tool output always includes the full non-empty metadata header plus the extracted document body.
73
+
74
+ In the pi TUI backlog/history preview, user-facing metadata is intentionally brief and only shows:
71
75
  - Title
72
- - Author
73
76
  - Published
74
- - content
75
77
 
76
- Set `verbose: true` to include fuller metadata such as:
77
- - site
78
- - language
79
- - word count
80
- - browser profile info
78
+ The duplicated `URL:` line is hidden from the preview because the tool call line already shows the URL.
79
+
80
+ The optional `verbose` flag is retained for compatibility, but pi now always returns the full metadata header to the agent.
81
81
 
82
82
  ### `batch_web_fetch`
83
83
 
@@ -96,36 +96,44 @@ In the pi TUI, batch mode also streams per-item progress rows showing:
96
96
 
97
97
  ## Example tool outputs
98
98
 
99
- ### Compact `web_fetch` output (default)
99
+ ### Agent-facing `web_fetch` output
100
100
 
101
101
  ```text
102
102
  > URL: https://example.com/blog/some-article
103
103
  > Title: Some Article
104
104
  > Author: Jane Doe
105
105
  > Published: 2026-03-12
106
+ > Site: Example Blog
107
+ > Language: en
108
+ > Words: 1284
109
+ > Browser: chrome_145/windows
106
110
 
107
111
  # Some Article
108
112
 
109
113
  This is the cleaned readable content extracted from the page.
110
- It omits most navigation, footer, and unrelated chrome.
114
+ It includes the body plus the full metadata header available to the agent.
111
115
  ```
112
116
 
113
- ### Verbose `web_fetch` output (`verbose: true`)
117
+ ### pi history/backlog preview for `web_fetch`
114
118
 
115
119
  ```text
116
- > URL: https://example.com/blog/some-article
117
- > Title: Some Article
118
- > Author: Jane Doe
119
- > Published: 2026-03-12
120
- > Site: Example Blog
121
- > Language: en
122
- > Words: 1284
123
- > Browser: chrome_145/windows
120
+ web_fetch https://example.com/blog/some-article
121
+ Title: Some Article
122
+ Published: 2026-03-12
124
123
 
125
124
  # Some Article
126
125
 
127
126
  This is the cleaned readable content extracted from the page.
128
- It includes the same body content, but with a richer metadata header.
127
+ ... (more lines, Ctrl+O to expand)
128
+ ```
129
+
130
+ ### Attachment/binary `web_fetch` output
131
+
132
+ ```text
133
+ > URL: https://example.com/download/report
134
+ > File size: 999999
135
+ > Mime type: application/pdf
136
+ > File path: /absolute/path/to/temp/report.pdf
129
137
  ```
130
138
 
131
139
  ### `batch_web_fetch` output
@@ -173,14 +181,14 @@ Error: Invalid URL: not-a-url
173
181
  | `removeImages` | boolean | `false` | Strip image references from output |
174
182
  | `includeReplies` | boolean \| `extractors` | `extractors` | Include replies/comments |
175
183
  | `proxy` | string | none | Proxy URL |
176
- | `verbose` | boolean | `false` | Include the full metadata header. Can default from `smartFetchVerboseByDefault` |
184
+ | `verbose` | boolean | `false` | Compatibility flag. pi currently returns the full metadata header to the agent regardless; user history preview stays compact |
177
185
 
178
186
  ### `batch_web_fetch`
179
187
 
180
188
  | Parameter | Type | Default | Description |
181
189
  |-------------|---------------------|-----------|-------------|
182
190
  | `requests` | array of objects | required | Array of fetch requests. Each item accepts the same parameters as `web_fetch` except `verbose` |
183
- | `verbose` | boolean | `false` | Include the full metadata header for each successful result |
191
+ | `verbose` | boolean | `false` | Compatibility flag. pi currently returns the full metadata header for successful results regardless |
184
192
 
185
193
  ## pi settings
186
194
 
@@ -195,12 +203,13 @@ Optional custom settings in `~/.pi/agent/settings.json` or `.pi/settings.json`:
195
203
  "smartFetchDefaultOs": "windows",
196
204
  "smartFetchDefaultRemoveImages": false,
197
205
  "smartFetchDefaultIncludeReplies": "extractors",
198
- "smartFetchDefaultBatchConcurrency": 8
206
+ "smartFetchDefaultBatchConcurrency": 8,
207
+ "smartFetchTempDir": "/tmp/smart-fetch-pi"
199
208
  }
200
209
  ```
201
210
 
202
211
  Behavior:
203
- - `smartFetchVerboseByDefault` sets the default for `verbose`
212
+ - `smartFetchVerboseByDefault` sets the stored default for the compatibility `verbose` flag
204
213
  - `smartFetchDefaultMaxChars` sets the runtime default for `maxChars`
205
214
  - `smartFetchDefaultTimeoutMs` sets the runtime request timeout
206
215
  - `smartFetchDefaultBrowser` sets the default browser fingerprint profile
@@ -208,12 +217,14 @@ Behavior:
208
217
  - `smartFetchDefaultRemoveImages` sets the default for image stripping
209
218
  - `smartFetchDefaultIncludeReplies` sets the default replies/comments behavior
210
219
  - `smartFetchDefaultBatchConcurrency` sets the default bounded concurrency for `batch_web_fetch`
220
+ - `smartFetchTempDir` sets the base temp directory used for attachments and binary downloads
211
221
  - project `.pi/settings.json` overrides global `~/.pi/agent/settings.json`
212
222
 
213
223
  Legacy aliases still supported:
214
224
  - `webFetchVerboseByDefault`
215
225
  - `webFetchDefaultMaxChars`
216
226
  - `webFetchDefaultBatchConcurrency`
227
+ - `webFetchTempDir`
217
228
 
218
229
  ## When not to use it
219
230
 
@@ -224,3 +235,10 @@ Do not use these tools when:
224
235
  - you need a fully interactive browser session
225
236
 
226
237
  In those cases, switch to browser automation.
238
+
239
+ ## Recent feature additions reflected here
240
+
241
+ Recent `feat:` work added:
242
+ - publish-ready TS tooling, tests, and packaging checks
243
+ - timer-driven spinner animation for batch progress in the pi TUI
244
+ - attachment and binary streaming into temp files with sanitized output paths