{"_id":"@amartinr/pi-searxng","_rev":"5-af8b45ffbc48d6cc240505003c6cc01b","name":"@amartinr/pi-searxng","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@amartinr/pi-searxng","version":"1.0.0","keywords":["pi-package","pi","searxng","web-search"],"author":{"name":"A. Martin","email":"abel.martin.ruiz@gmail.com"},"license":"MIT","_id":"@amartinr/pi-searxng@1.0.0","maintainers":[{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"}],"homepage":"https://github.com/amartinr/pi-searxng#readme","bugs":{"url":"https://github.com/amartinr/pi-searxng/issues"},"pi":{"extensions":["./src/index.ts"]},"dist":{"shasum":"a353c8a900a0e5e8bdf40913aeb5cf642f4b06c5","tarball":"https://registry.npmjs.org/@amartinr/pi-searxng/-/pi-searxng-1.0.0.tgz","fileCount":15,"integrity":"sha512-MSq9Zlky6T8pgtqu1I8VPrBSM32nJ/5ItGZo1EzxlMIkZZiXfhfRHJcFxRnIxOCFTqY2n/SNalYwkSYLqvWutQ==","signatures":[{"sig":"MEQCIFQHt7tMDbLeHVjhAbhJAwLmZxQBdwmkHpx4Tv2UxHOiAiBGIr/WzuoZdVrmaZNf4TS3BJWpPn0K0V5ZYg4t3s3DSA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":39116},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"b3b48f885bb1cd14728324ed8ecb0fcb2af25fef","scripts":{"build":"tsc","clean":"rm -rf dist","prepublish":"npm run clean && npm run build","prepublishOnly":"npm run build"},"_npmUser":{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"},"repository":{"url":"git+https://github.com/amartinr/pi-searxng.git","type":"git"},"_npmVersion":"9.2.0","description":"SearXNG web search extension for Pi","directories":{},"_nodeVersion":"20.19.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{"@sinclair/typebox":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-searxng_1.0.0_1779380877988_0.39486948477509487","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@amartinr/pi-searxng","version":"1.0.1","keywords":["pi-package","pi","searxng","web-search"],"author":{"name":"A. Martin","email":"abel.martin.ruiz@gmail.com"},"license":"MIT","_id":"@amartinr/pi-searxng@1.0.1","maintainers":[{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"}],"homepage":"https://github.com/amartinr/pi-searxng#readme","bugs":{"url":"https://github.com/amartinr/pi-searxng/issues"},"pi":{"extensions":["./dist/index.js"]},"dist":{"shasum":"1a181bd54eb4691da9ffecc5a35c2cb06a289371","tarball":"https://registry.npmjs.org/@amartinr/pi-searxng/-/pi-searxng-1.0.1.tgz","fileCount":12,"integrity":"sha512-yPu4aIAX3OsweeeU8Rls7FsWCRtnQ8+ETgHq4RTUyNuvzjwN9uz9Fb2mDyjHCHw91P5mO1y/jU8UutbHjdz1AQ==","signatures":[{"sig":"MEUCIQDGPzsBMpz8IZ0Av3XfTmF7PF/JXWS/ViLugVB7+7PjLAIgag6ro0/G1bsmeDV2c9zeBjn9famCwdpINBZL/RVyVvI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29519},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"8f3f942eb1f387878268ce44d8aef620310dc0f5","scripts":{"build":"tsc","clean":"rm -rf dist","prepublish":"npm run clean && npm run build","prepublishOnly":"npm run build"},"_npmUser":{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"},"repository":{"url":"git+https://github.com/amartinr/pi-searxng.git","type":"git"},"_npmVersion":"9.2.0","description":"SearXNG web search extension for Pi","directories":{},"_nodeVersion":"20.19.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{"@sinclair/typebox":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-searxng_1.0.1_1779470609378_0.1248839938654116","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@amartinr/pi-searxng","version":"1.0.2","keywords":["pi-package","pi","searxng","web-search"],"author":{"name":"A. Martin","email":"abel.martin.ruiz@gmail.com"},"license":"MIT","_id":"@amartinr/pi-searxng@1.0.2","maintainers":[{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"}],"homepage":"https://github.com/amartinr/pi-searxng#readme","bugs":{"url":"https://github.com/amartinr/pi-searxng/issues"},"pi":{"extensions":["./dist/index.js"]},"dist":{"shasum":"e0cfb084853fae363ece5b1abe9f24fdf91db2d3","tarball":"https://registry.npmjs.org/@amartinr/pi-searxng/-/pi-searxng-1.0.2.tgz","fileCount":12,"integrity":"sha512-aFGZGKHEDuRlrpMTrtwqA5CT1Ro2nuwq1N8NoAaW+pp/CDfxFHvFQ6rDTqJ4mFAa5xMshNT1MDw6CaFpwe9XUw==","signatures":[{"sig":"MEQCIGsDv6YUz/vJTIQWFe8dUJFymAdbQNKj4ZXalHHHo2hnAiBh5IXu2BLeDu2WCIWmsw/tACCcra4lPEA04Z+Eae6gbg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30880},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"gitHead":"b6220ba3bed2a9d541d8103831a1d7a9cb684878","scripts":{"build":"tsc","clean":"rm -rf dist","prepublish":"npm run clean && npm run build","prepublishOnly":"npm run build"},"_npmUser":{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"},"repository":{"url":"git+https://github.com/amartinr/pi-searxng.git","type":"git"},"_npmVersion":"9.2.0","description":"A minimalist SearXNG web search extension for Pi","directories":{},"_nodeVersion":"20.19.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{"@sinclair/typebox":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-searxng_1.0.2_1779574359621_0.9524620978285321","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@amartinr/pi-searxng","version":"1.0.3","keywords":["pi-extension","pi-package","pi","searxng","web-search"],"author":{"name":"A. Martin","email":"abel.martin.ruiz@gmail.com"},"license":"MIT","_id":"@amartinr/pi-searxng@1.0.3","maintainers":[{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"}],"homepage":"https://github.com/amartinr/pi-searxng#readme","bugs":{"url":"https://github.com/amartinr/pi-searxng/issues"},"pi":{"extensions":["./dist/index.js"]},"dist":{"shasum":"1c3a289eb0c33ca57f3a2df76562b83fe4c44c20","tarball":"https://registry.npmjs.org/@amartinr/pi-searxng/-/pi-searxng-1.0.3.tgz","fileCount":12,"integrity":"sha512-8QwvhS2UoimRhbRSmMssvDwJsaeeVJq+ij4bjRSgGkFgf6M6V7FAjWQ3OfRJ3Oy+/DkA//WSZXK4GoVj1+EvYA==","signatures":[{"sig":"MEYCIQD47ai/s1WBimZbkOzLOIiJOxcorBYQN1dBBC+bDeviTgIhAN8BBnd4nyDGiVX+l4LOPA4p9Imp+Dh1Bk1IjUDKjQCz","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30906},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"gitHead":"f70b2608b509c5ad8c34864fb5a8426bea6bd700","scripts":{"build":"tsc","clean":"rm -rf dist","prepublish":"npm run clean && npm run build","prepublishOnly":"npm run build"},"_npmUser":{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"},"repository":{"url":"git+https://github.com/amartinr/pi-searxng.git","type":"git"},"_npmVersion":"11.13.0","description":"A minimalist SearXNG web search extension for Pi","directories":{},"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0","@sinclair/typebox":"*","@earendil-works/pi-tui":"^0.78.0"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-searxng_1.0.3_1780300993250_0.6004046691016292","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@amartinr/pi-searxng","version":"1.0.4","description":"A minimalist SearXNG web search extension for Pi","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc","clean":"rm -rf dist","prepublishOnly":"npm run build","prepublish":"npm run clean && npm run build"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"devDependencies":{"@earendil-works/pi-tui":"^0.78.0","@sinclair/typebox":"*","@types/node":"^20.0.0","typescript":"^5.0.0"},"pi":{"extensions":["./dist/index.js"]},"repository":{"type":"git","url":"git+https://github.com/amartinr/pi-searxng.git"},"keywords":["pi-extension","pi-package","pi","searxng","web-search"],"engines":{"node":">=18"},"license":"MIT","author":{"name":"A. Martin","email":"abel.martin.ruiz@gmail.com"},"publishConfig":{"access":"public"},"gitHead":"ae1f04fda4d10fe4b3e547308b3a0a3ec8581f65","_id":"@amartinr/pi-searxng@1.0.4","bugs":{"url":"https://github.com/amartinr/pi-searxng/issues"},"homepage":"https://github.com/amartinr/pi-searxng#readme","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-lycrq1/mbGeM+9T1iLqHMMQHEYMkCL7QfkYZenCEAACnmofV5ILvI+gRzuIL+UL8CTNh5bFZnCmoElvbpGk7eA==","shasum":"ff57c11b267628657de406aedd555b824e9dfaf9","tarball":"https://registry.npmjs.org/@amartinr/pi-searxng/-/pi-searxng-1.0.4.tgz","fileCount":12,"unpackedSize":30882,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCxq/4XRk7rmp2imtmgImuRCHhFP27oAHGqCMX03lQpTAIgXH2tonHy5M3Z2IKRLRW3tMMJzcHu0kqUmR9LSDczvzo="}]},"_npmUser":{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"},"directories":{},"maintainers":[{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-searxng_1.0.4_1787825528074_0.15238388814602732"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-21T16:27:57.875Z","modified":"2026-08-27T10:12:08.389Z","1.0.0":"2026-05-21T16:27:58.216Z","1.0.1":"2026-05-22T17:23:29.546Z","1.0.2":"2026-05-23T22:12:39.770Z","1.0.3":"2026-06-01T08:03:13.382Z","1.0.4":"2026-08-27T10:12:08.223Z"},"bugs":{"url":"https://github.com/amartinr/pi-searxng/issues"},"author":{"name":"A. Martin","email":"abel.martin.ruiz@gmail.com"},"license":"MIT","homepage":"https://github.com/amartinr/pi-searxng#readme","keywords":["pi-extension","pi-package","pi","searxng","web-search"],"repository":{"type":"git","url":"git+https://github.com/amartinr/pi-searxng.git"},"description":"A minimalist SearXNG web search extension for Pi","maintainers":[{"name":"amartinr","email":"abel.martin.ruiz@gmail.com"}],"readme":"# @amartinr/pi-searxng\n\nA **minimalist** SearXNG web search extension for [Pi](https://github.com/earendil-works/pi).\n\nThis is a focused, no-frills implementation that provides only web search and result caching — no content fetching, no repository cloning, no external dependencies beyond SearXNG.\n\n> **Note:** This is an independent fork of [jcha0713/pi-searxng](https://github.com/jcha0713/pi-searxng), stripped down to its core search functionality with improved caching.\n\n## Features\n\n- **Web Search** - Search the web via a SearXNG instance\n- **Cached Results** - Retrieve previous search results by ID for follow-up queries\n- **Smart Caching** - Deterministic IDs, freshness TTL, LRU eviction, and deduplication\n- **Safesearch** - Configurable content filtering (`off`, `moderate`, `strict`)\n\n## Design Philosophy\n\nThis extension follows a **minimalist** approach:\n\n- **Web search only** — No content fetching, no HTML-to-Markdown conversion\n- **No repository cloning** — Unlike the original, it doesn't clone GitHub repos\n- **No external tools** — Doesn't require `git` or any system dependencies\n- **Self-contained** — Everything runs in-process, no background services\n- **Updated imports** — Uses current `@earendil-works/` scoped packages (Pi coding agent, TUI, TypeBox)\n\nIf you need content extraction or repo browsing, consider using other Pi extensions for those tasks.\n\n## Installation\n\n```bash\npi install npm:@amartinr/pi-searxng\n```\n\nOr try without installing:\n\n```bash\npi -e npm:@amartinr/pi-searxng\n```\n\n## Building\n\n```bash\nnpm install\nnpm run build\n```\n\nThis compiles the TypeScript source in `src/` to JavaScript in `dist/`.\n\n## Configuration\n\nCreate `~/.pi/agent/extensions/pi-searxng/config.json`:\n\n```json\n{\n  \"searxngUrl\": \"http://localhost:8080\",\n  \"timeoutMs\": 30000,\n  \"maxResults\": 10,\n  \"safesearch\": \"off\"\n}\n```\n\n| Field | Type | Default | Description |\n|---|---|---|---|\n| `searxngUrl` | string | `http://localhost:8080` | URL of the SearXNG instance (can also be set via `SEARXNG_URL` env var) |\n| `timeoutMs` | number | `30000` | HTTP request timeout in milliseconds |\n| `maxResults` | number | `10` | Maximum number of results returned per search |\n| `safesearch` | string | `\"off\"` | Content filtering level (`\"off\"`, `\"moderate\"`, `\"strict\"`) |\n\nOr use an environment variable:\n\n```bash\nexport SEARXNG_URL=http://localhost:8080\n```\n\n## Tools\n\n### `web_search`\n\nSearch the web using SearXNG. Results are automatically cached for subsequent identical queries.\n\n**Parameters:**\n- `query` (string, required) - Search query\n- `limit` (number, optional) - Max results to return (overrides `maxResults` from config). Note: the actual number returned depends on SearXNG's internal configuration.\n\n**Returns:** A `searchId` in the `details` field, which can be used with `get_search_results` or passed to subsequent calls.\n\n### `get_search_results`\n\nRetrieve cached search results by ID. Returns the original query and all cached results.\n\n**Parameters:**\n- `searchId` (string, required) - Search ID returned from a previous `web_search` call\n\n**Returns:** The original search query and the cached results. If the `searchId` is not found, returns an error message.\n\n## Error Handling\n\nBoth tools return error messages within the response content when something fails:\n\n- **`web_search`** — If SearXNG is unreachable, returns a descriptive error (including the HTTP status and response body).\n- **`get_search_results`** — Returns \"Search not found\" if the `searchId` doesn't exist in the cache.\n\n## Result Format\n\nResults are returned as numbered entries with the following structure:\n\n```\n1. **Result Title**\n   https://example.com\n   Short snippet of the result content...\n```\n\nEach result includes the **title**, **URL**, and a **snippet** (truncated to 200 characters).\n\n## Caching\n\nThe package includes an in-memory cache that reduces redundant calls to SearXNG:\n\n- **Deterministic IDs** — The `searchId` is an MD5 hash of the query text, so the same query always produces the same ID. This enables cache deduplication and lookup via `get_search_results`.\n- **Freshness TTL** — Cache entries are considered fresh for a configurable period (default: **15 min**). Stale entries trigger a new search instead of returning cached results.\n- **Eviction TTL** — Entries that haven't been accessed within **24 hours** are automatically removed.\n- **LRU eviction** — When the cache exceeds **200 entries**, the oldest (least recently used) entries are evicted.\n- **Lazy cleanup** — Cleanup runs automatically at the start of each tool call.\n\n### Cache configuration\n\nThese fields can be added to `~/.pi/agent/extensions/pi-searxng/config.json`:\n\n| Field | Type | Default | Description |\n|---|---|---|---|\n| `cacheFreshnessMs` | number | `900000` (15 min) | How long cache entries are considered fresh before re-searching |\n| `cacheTtlMs` | number | `86400000` (24 hours) | Max time an entry stays in cache without being accessed |\n| `cacheMaxSize` | number | `200` | Max number of entries before LRU eviction kicks in |\n\n## Requirements\n\n- Node.js 18+\n- A running SearXNG instance (for web search)\n\n## License\n\nMIT\n","readmeFilename":"README.md"}