{"_id":"@0xkobold/pi-cloudflare-browser","name":"@0xkobold/pi-cloudflare-browser","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@0xkobold/pi-cloudflare-browser","version":"0.1.0","description":"Cloudflare Browser Rendering for pi-coding-agent","icon":"🌐","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","pi":{"extensions":["./dist/index.js"]},"scripts":{"build":"tsc","test":"bun test","prepublishOnly":"npm run build"},"keywords":["pi-extension","cloudflare","browser-rendering","screenshot","pdf","web-crawler"],"author":{"name":"0xKobold"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/0xKobold/pi-cloudflare-browser.git"},"bugs":{"url":"https://github.com/0xKobold/pi-cloudflare-browser/issues"},"homepage":"https://github.com/0xKobold/pi-cloudflare-browser#readme","peerDependencies":{"@sinclair/typebox":">=0.32.0","@mariozechner/pi-coding-agent":">=0.57.0"},"devDependencies":{"@types/bun":"latest","typescript":"^5.0.0"},"engines":{"bun":">=1.0.0"},"gitHead":"ec57400e2a29794a471aa008c2c5ef47c89fd6f0","_id":"@0xkobold/pi-cloudflare-browser@0.1.0","_nodeVersion":"25.1.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-KwpuurJ5luCb/m1p3Q9SFTypEJ29aAaNJvWjC9wSVvC2ZZWFN62umAPD5byudpE91MjhABNCflsBmSJCEwYAXw==","shasum":"52e474d2a71d61f51f2c4cd1fb91f74c5a947347","tarball":"https://registry.npmjs.org/@0xkobold/pi-cloudflare-browser/-/pi-cloudflare-browser-0.1.0.tgz","fileCount":6,"unpackedSize":46491,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDci9ogAhuHs1yqTCfdokQ/h+xMBQ5gqOCthbdkB2rUqwIhANy+hU7gjHyXnq858Jtuohy6GuccqGKWS4Ed9U6F6Xvt"}]},"_npmUser":{"name":"moikapy","email":"warrenckhan@gmail.com"},"directories":{},"maintainers":[{"name":"moikapy","email":"warrenckhan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-cloudflare-browser_0.1.0_1773366497011_0.11401202511339137"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-13T01:48:16.936Z","0.1.0":"2026-03-13T01:48:17.166Z","modified":"2026-03-13T01:48:17.378Z"},"maintainers":[{"name":"moikapy","email":"warrenckhan@gmail.com"}],"description":"Cloudflare Browser Rendering for pi-coding-agent","homepage":"https://github.com/0xKobold/pi-cloudflare-browser#readme","keywords":["pi-extension","cloudflare","browser-rendering","screenshot","pdf","web-crawler"],"repository":{"type":"git","url":"git+https://github.com/0xKobold/pi-cloudflare-browser.git"},"author":{"name":"0xKobold"},"bugs":{"url":"https://github.com/0xKobold/pi-cloudflare-browser/issues"},"license":"MIT","readme":"# 🌐 Pi Cloudflare Browser\n\nCloudflare Browser Rendering for [pi-coding-agent](https://github.com/marioechler/pi-coding-agent).\n\nWeb scraping, screenshots, and PDF generation via Cloudflare's Browser Rendering API.\n\n## Features\n\n- 🕷️ **Web crawling** - Multi-page with depth control\n- 📸 **Screenshots** - Inline display + saved files\n- 📄 **PDF generation** - From any URL\n- 📄 **Content extraction** - Rendered HTML/Markdown\n- 🎯 **Standalone** - Works without 0xKobold\n- 🔌 **Integrable** - Exposes client for custom use\n\n## Installation\n\n```bash\n# Via pi CLI\npi install npm:@0xkobold/pi-cloudflare-browser\n\n# Or in pi-config.ts\nextensions: ['npm:@0xkobold/pi-cloudflare-browser']\n```\n\n## Setup\n\n1. **Get Cloudflare credentials**:\n   - Account ID: https://dash.cloudflare.com (right sidebar)\n   - API Token: My Profile → API Tokens → Create → \"Browser Rendering\" template\n\n2. **Configure**:\n```bash\nexport CLOUDFLARE_API_TOKEN=your_token\nexport CLOUDFLARE_ACCOUNT_ID=your_account_id\nexport PI_OUTPUT_DIR=./outputs  # Optional: where to save files\n```\n\n## Usage\n\n### Standalone\n\n```typescript\nimport { CloudflareClient, loadConfig } from '@0xkobold/pi-cloudflare-browser';\n\n// Load from env\nconst config = await loadConfig();\nconst client = new CloudflareClient(config);\n\n// Take screenshot\nconst result = await client.screenshot('https://example.com', { fullPage: true });\n// result.screenshot = base64 image\n// result.metadata = { title, url, status }\n\n// Crawl website\nconst crawlId = await client.crawl({\n  url: 'https://example.com',\n  limit: 10,\n  render: true,\n});\n\n// Get crawl results\nconst crawl = await client.getCrawlResult(crawlId);\n```\n\n### With pi-coding-agent\n\n```typescript\n// Extension auto-registers tools:\n// /cf_crawl      - Multi-page crawling\n// /cf_screenshot - Capture screenshot\n// /cf_pdf        - Generate PDF\n// /cf_fetch      - Single page content\n```\n\n## Tools\n\n| Tool | Description | Example |\n|------|-------------|---------|\n| `/cf_crawl` | Crawl multiple pages | `/cf_crawl url:https://example.com limit:20` |\n| `/cf_screenshot` | Screenshot (shows inline) | `/cf_screenshot url:https://example.com fullPage:true` |\n| `/cf_pdf` | Generate PDF | `/cf_pdf url:https://example.com` |\n| `/cf_fetch` | Fetch rendered content | `/cf_fetch url:https://example.com` |\n\n## API\n\n### `CloudflareClient`\n\n```typescript\nclass CloudflareClient {\n  async crawl(params: CrawlParams): Promise<string>;      // Returns job ID\n  async getCrawlResult(jobId: string): Promise<CrawlResult>;\n  async screenshot(url: string, opts?: ScreenshotOptions): Promise<ScreenshotResult>;\n  async pdf(url: string, opts?: PdfOptions): Promise<PdfResult>;\n  async fetchContent(url: string, opts?: ContentOptions): Promise<ContentResult>;\n}\n```\n\n### Configuration\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `CLOUDFLARE_API_TOKEN` | ✅ | Account API token |\n| `CLOUDFLARE_ACCOUNT_ID` | ✅ | Account ID |\n| `PI_OUTPUT_DIR` | - | Save directory |\n| `PI_CLOUDFLARE_VAULT` | - | Obsidian vault path |\n\n## Standalone Example\n\n```typescript\n// screenshot.ts - No pi-coding-agent needed\nimport { CloudflareClient, loadConfig } from '@0xkobold/pi-cloudflare-browser';\n\nasync function main() {\n  const config = await loadConfig();\n  if (!config.enabled) {\n    console.log('Set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID');\n    return;\n  }\n\n  const client = new CloudflareClient(config);\n  \n  const result = await client.screenshot('https://example.com', {\n    fullPage: true,\n  });\n\n  // Save to file\n  await Bun.write('screenshot.png', Buffer.from(result.screenshot, 'base64'));\n  console.log('Saved!');\n}\n\nmain();\n```\n\n## Links\n\n- [GitHub](https://github.com/0xKobold/pi-cloudflare-browser)\n- [Cloudflare Browser Rendering Docs](https://developers.cloudflare.com/browser-rendering/)\n\n## License\n\nMIT","readmeFilename":"README.md","_rev":"1-a4b7bbf2daa4f9d503660939a48e4d71"}