@mammothb/pi-webfetch 0.1.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/LICENSE +18 -0
- package/README.md +14 -0
- package/biome.json +35 -0
- package/index.ts +35 -0
- package/package.json +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mammothb
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
6
|
+
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
12
|
+
portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
15
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
16
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
18
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# pi-webfetch
|
|
2
|
+
|
|
3
|
+
A [pi](https://pi.dev) extension that adds a `webfetch` tool for fetching and converting web content.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Once installed, the LLM can call the `webfetch` tool to fetch content from URLs and convert it to markdown, text, or html.
|
|
8
|
+
|
|
9
|
+
## Development
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Test locally
|
|
13
|
+
pi -e ./extensions/index.ts
|
|
14
|
+
```
|
package/biome.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.4.14/schema.json",
|
|
3
|
+
"formatter": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"indentStyle": "space"
|
|
6
|
+
},
|
|
7
|
+
"linter": {
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"rules": {
|
|
10
|
+
"recommended": true
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": {
|
|
14
|
+
"includes": [
|
|
15
|
+
"**",
|
|
16
|
+
"!dist",
|
|
17
|
+
"!coverage",
|
|
18
|
+
"!packages/*/dist",
|
|
19
|
+
"!packages/*/coverage",
|
|
20
|
+
"!node_modules",
|
|
21
|
+
"!forks/wreq-js"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"javascript": {
|
|
25
|
+
"formatter": {
|
|
26
|
+
"quoteStyle": "double",
|
|
27
|
+
"semicolons": "always"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"json": {
|
|
31
|
+
"formatter": {
|
|
32
|
+
"indentStyle": "space"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
package/index.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
|
|
4
|
+
export default function (pi: ExtensionAPI) {
|
|
5
|
+
pi.registerTool({
|
|
6
|
+
name: "webfetch",
|
|
7
|
+
label: "Web Fetch",
|
|
8
|
+
description:
|
|
9
|
+
"Fetches content from a specified URL and converts it to the requested format (markdown by default).",
|
|
10
|
+
parameters: Type.Object({
|
|
11
|
+
url: Type.String({ description: "The URL to fetch content from" }),
|
|
12
|
+
format: Type.Optional(
|
|
13
|
+
Type.String({
|
|
14
|
+
description:
|
|
15
|
+
"The format to return the content in - text, markdown, or html (default: 'markdown')",
|
|
16
|
+
}),
|
|
17
|
+
),
|
|
18
|
+
}),
|
|
19
|
+
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
|
|
20
|
+
const url = params.url;
|
|
21
|
+
const format = params.format ?? "markdown";
|
|
22
|
+
|
|
23
|
+
// TODO: implement actual fetch + conversion
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
type: "text",
|
|
28
|
+
text: `Fetched ${url} as ${format} (placeholder).`,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
details: { url, format },
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mammothb/pi-webfetch",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A pi extension that adds a webfetch tool for fetching and converting web content",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package"
|
|
7
|
+
],
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"pi": {
|
|
10
|
+
"extensions": [
|
|
11
|
+
"./index.ts"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
16
|
+
"@earendil-works/pi-ai": "*",
|
|
17
|
+
"typebox": "*"
|
|
18
|
+
}
|
|
19
|
+
}
|