{"_id":"@arcanemachine/pi-read","_rev":"5-7415699cf3cb463f7913976023713df8","name":"@arcanemachine/pi-read","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"@arcanemachine/pi-read","version":"0.1.0","keywords":["pi","pi-coding-agent","extension","read","tool","truncate","pi-package"],"author":{"name":"Nicholas Moen"},"license":"MIT","_id":"@arcanemachine/pi-read@0.1.0","maintainers":[{"name":"arcanemachine","email":"arcanemachine@gmail.com"}],"homepage":"https://github.com/arcanemachine/pi-read","bugs":{"url":"https://github.com/arcanemachine/pi-read/issues"},"pi":{"image":"https://raw.githubusercontent.com/arcanemachine/pi-read/main/logo.jpg","extensions":["./src/index.ts"]},"dist":{"shasum":"82826798550565b92e873deb95012aff0b2b3608","tarball":"https://registry.npmjs.org/@arcanemachine/pi-read/-/pi-read-0.1.0.tgz","fileCount":4,"integrity":"sha512-cbpstM6V0kbzhX9xbSOucc9WBZQy9IIBF/JaGmdNj1h+iLfFeiZKbLbDw7mBAosNYrJ32ICNQXnoZLjDS6JhFA==","signatures":[{"sig":"MEUCIQCHqs/Ljjbz1snWcnZqM7z52uf7yPdvD0Yp2RdMPWyyKAIge718aD/WT3fuCM9IGMiO1uFDpBU65JkgrXM19BHic9U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18306},"type":"module","gitHead":"007dcb8c0a390d3cd8458e7ec32f65af2e3879ce","scripts":{"test":"vitest run","build":"tsc","watch":"tsc --watch","format":"prettier --write src/index.ts package.json README.md tests/*.ts","typecheck":"tsc --noEmit"},"_npmUser":{"name":"arcanemachine","email":"arcanemachine@gmail.com"},"repository":{"url":"git+https://github.com/arcanemachine/pi-read.git","type":"git"},"_npmVersion":"10.9.2","description":"Customizable read tool for Pi coding agent - configure default line/byte limits","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.5","prettier":"^3.8.3","typescript":"^5.7.2","@types/node":"^25.3.0","@sinclair/typebox":"^0.34.49","@mariozechner/pi-coding-agent":"^0.72.1"},"peerDependencies":{"@mariozechner/pi-coding-agent":"*"},"peerDependenciesMeta":{"@mariozechner/pi-coding-agent":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/pi-read_0.1.0_1777872342957_0.8589844256358987","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@arcanemachine/pi-read","version":"0.1.1","keywords":["pi","pi-coding-agent","extension","read","tool","truncate","pi-package"],"author":{"name":"Nicholas Moen"},"license":"MIT","_id":"@arcanemachine/pi-read@0.1.1","maintainers":[{"name":"arcanemachine","email":"arcanemachine@gmail.com"}],"homepage":"https://github.com/arcanemachine/pi-read","bugs":{"url":"https://github.com/arcanemachine/pi-read/issues"},"pi":{"image":"https://raw.githubusercontent.com/arcanemachine/pi-read/main/logo.jpg","extensions":["./src/index.ts"]},"dist":{"shasum":"3edc347cb4786ba49b538a6555a1e15080fc4bfd","tarball":"https://registry.npmjs.org/@arcanemachine/pi-read/-/pi-read-0.1.1.tgz","fileCount":4,"integrity":"sha512-H/1WQA2PWywdsiaTnfooIVIAE8c5gDX9talMjH+lUgjl2ZjgvOza44vaoXvYyZj1pNRyUjkM/gDCcc/dpx9s+w==","signatures":[{"sig":"MEYCIQCFRRcr5ZnbW2Kad8X2TeYg9H31b4l8Cmaadb8IqqysiwIhAKRd056Jh5fBDiBpsqc7KhWkzPs7AokzH6IIbbY4bxEb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20760},"type":"module","scripts":{"test":"vitest run","build":"tsc","watch":"tsc --watch","format":"prettier --write src/index.ts package.json README.md tests/*.ts","typecheck":"tsc --noEmit"},"_npmUser":{"name":"arcanemachine","email":"arcanemachine@gmail.com"},"repository":{"url":"git+https://github.com/arcanemachine/pi-read.git","type":"git"},"_npmVersion":"11.13.0","description":"Customizable read tool for Pi coding agent - configure default line/byte limits","directories":{},"_nodeVersion":"24.16.0","dependencies":{"@sinclair/typebox":"^0.34.49"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.5","prettier":"^3.8.3","typescript":"^5.7.2","@types/node":"^25.3.0","@earendil-works/pi-coding-agent":"^0.74.0"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"peerDependenciesMeta":{"@earendil-works/pi-coding-agent":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/pi-read_0.1.1_1783575637640_0.01700495065998875","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@arcanemachine/pi-read","version":"0.2.0","keywords":["pi","pi-coding-agent","extension","read","tool","truncate","pi-package"],"author":{"name":"Nicholas Moen"},"license":"MIT","_id":"@arcanemachine/pi-read@0.2.0","maintainers":[{"name":"arcanemachine","email":"arcanemachine@gmail.com"}],"homepage":"https://github.com/arcanemachine/pi-read","bugs":{"url":"https://github.com/arcanemachine/pi-read/issues"},"pi":{"image":"https://raw.githubusercontent.com/arcanemachine/pi-read/main/logo.jpg","extensions":["./src/index.ts"]},"dist":{"shasum":"bfcb6b7bae8b9b04ad9cb75dbdca017f79343a5a","tarball":"https://registry.npmjs.org/@arcanemachine/pi-read/-/pi-read-0.2.0.tgz","fileCount":5,"integrity":"sha512-VO9pV15PFTBOfcNq9hgKJ3K6k4Bb0ndDlX6N5ReNTOa/r66/Ppfc9N/hexsK5veMHGl1YbjCo3wOnL5jJu17/Q==","signatures":[{"sig":"MEUCIQDkJb8au12qZZTU3+Kbvjt/OF79XZWhi/nv23EG+ikCxgIgJBS3w+frMmei8luQNGW6IcN4HJTsau8HTYOdUXCAPmY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25753},"type":"module","scripts":{"test":"vitest run","build":"tsc","watch":"tsc --watch","format":"prettier --write src/index.ts package.json README.md tests/*.ts","typecheck":"tsc --noEmit"},"_npmUser":{"name":"arcanemachine","email":"arcanemachine@gmail.com"},"repository":{"url":"git+https://github.com/arcanemachine/pi-read.git","type":"git"},"_npmVersion":"11.13.0","description":"Pi's native read tool with configurable line and byte limits","directories":{},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.5","typebox":"1.1.38","prettier":"^3.8.3","typescript":"^5.7.2","@types/node":"^25.3.0","@earendil-works/pi-tui":"0.80.10","@earendil-works/pi-coding-agent":"0.80.10"},"peerDependencies":{"typebox":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"peerDependenciesMeta":{"typebox":{"optional":true},"@earendil-works/pi-tui":{"optional":true},"@earendil-works/pi-coding-agent":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/pi-read_0.2.0_1784247024135_0.06471471758370351","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@arcanemachine/pi-read","version":"0.2.1","keywords":["pi","pi-coding-agent","extension","read","tool","truncate","pi-package"],"author":{"name":"Nicholas Moen"},"license":"MIT","_id":"@arcanemachine/pi-read@0.2.1","maintainers":[{"name":"arcanemachine","email":"arcanemachine@gmail.com"}],"homepage":"https://github.com/arcanemachine/pi-read","bugs":{"url":"https://github.com/arcanemachine/pi-read/issues"},"pi":{"image":"https://raw.githubusercontent.com/arcanemachine/pi-read/main/logo.jpg","extensions":["./src/index.ts"]},"dist":{"shasum":"d85b122dff7678c7f0531b7fa82afeaf2a9d9c92","tarball":"https://registry.npmjs.org/@arcanemachine/pi-read/-/pi-read-0.2.1.tgz","fileCount":5,"integrity":"sha512-Vq1axnAU513JW4oqYkSIO4bQZFTPFwXz6V70n4fPNPplcDqK2bTx23viML88+0CrmjgvmvTVuG1ZruNCShOyiA==","signatures":[{"sig":"MEUCIAy8mnkHoU/b949/XXH9jW3QISpPnk1TvOqEyBZjn+yDAiEAhXaDkvXQ0z+tZfUYpTy8S+NiUEUnXri+y+qBFbRnM0c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25924},"type":"module","scripts":{"test":"vitest run","build":"tsc","watch":"tsc --watch","format":"prettier --write src/index.ts package.json README.md tests/*.ts","typecheck":"tsc --noEmit"},"_npmUser":{"name":"arcanemachine","email":"arcanemachine@gmail.com"},"repository":{"url":"git+https://github.com/arcanemachine/pi-read.git","type":"git"},"_npmVersion":"11.13.0","description":"Pi's native read tool with configurable line and byte limits","directories":{},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.5","typebox":"1.1.38","prettier":"^3.8.3","typescript":"^5.7.2","@types/node":"^25.3.0","@earendil-works/pi-tui":"0.80.10","@earendil-works/pi-coding-agent":"0.80.10"},"peerDependencies":{"typebox":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"peerDependenciesMeta":{"typebox":{"optional":true},"@earendil-works/pi-tui":{"optional":true},"@earendil-works/pi-coding-agent":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/pi-read_0.2.1_1787017808745_0.49845175607231185","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"pi":{"image":"https://raw.githubusercontent.com/arcanemachine/pi-read/main/logo.jpg","extensions":["./src/index.ts"]},"_id":"@arcanemachine/pi-read@0.2.2","bugs":{"url":"https://github.com/arcanemachine/pi-read/issues"},"dist":{"shasum":"a3d7fba1c61adc783eb404253a2704fff1a9531a","tarball":"https://registry.npmjs.org/@arcanemachine/pi-read/-/pi-read-0.2.2.tgz","fileCount":6,"integrity":"sha512-7MFgUyAZVOAAW+g4QQTlBq/w7EQZJp1tkLnQrmGBX3aG75hJEnsp7IlycZySwgQzkad5/H4ghu/c0n0V+dtdYA==","signatures":[{"sig":"MEYCIQCpl/JNzHUcoj34TZRZwOZd+vKdoJQJyTVRKzXV73j2JQIhALuI9lzo1HgnxiF6pZWzSxM3kPcDj+ztFIy9E5zDltt9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC8zrrf5xb97gXfqA2YnpFR1HD+HaZjDzIL1XAHlgef1QIgFomzRvcAiducrwysef4DvCWMWalcAMnaiaD9vjoIbko="}],"unpackedSize":85870},"name":"@arcanemachine/pi-read","type":"module","author":{"name":"Nicholas Moen"},"license":"MIT","scripts":{"test":"vitest run","build":"tsc","watch":"tsc --watch","format":"prettier --write src/index.ts package.json README.md tests/*.ts","typecheck":"tsc --noEmit"},"version":"0.2.2","_npmUser":{"name":"arcanemachine","email":"arcanemachine@gmail.com"},"homepage":"https://github.com/arcanemachine/pi-read","keywords":["pi","pi-coding-agent","extension","read","tool","truncate","pi-package"],"repository":{"url":"git+https://github.com/arcanemachine/pi-read.git","type":"git"},"_npmVersion":"11.13.0","description":"Pi's native read tool with configurable line and byte limits","directories":{},"maintainers":[{"name":"arcanemachine","email":"arcanemachine@gmail.com"}],"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.5","typebox":"1.1.38","prettier":"^3.8.3","typescript":"^5.7.2","@types/node":"^25.3.0","@earendil-works/pi-tui":"0.80.10","@earendil-works/pi-coding-agent":"0.80.10"},"peerDependencies":{"typebox":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"peerDependenciesMeta":{"typebox":{"optional":true},"@earendil-works/pi-tui":{"optional":true},"@earendil-works/pi-coding-agent":{"optional":true}},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-read_0.2.2_1788679801980_0.40799815806944517"}}},"time":{"created":"2026-05-04T05:25:42.856Z","modified":"2026-09-06T07:30:02.238Z","0.1.0":"2026-05-04T05:25:43.095Z","0.1.1":"2026-07-09T05:40:37.769Z","0.2.0":"2026-07-17T00:10:24.279Z","0.2.1":"2026-08-18T01:50:08.887Z","0.2.2":"2026-09-06T07:30:02.059Z"},"bugs":{"url":"https://github.com/arcanemachine/pi-read/issues"},"author":{"name":"Nicholas Moen"},"license":"MIT","homepage":"https://github.com/arcanemachine/pi-read","keywords":["pi","pi-coding-agent","extension","read","tool","truncate","pi-package"],"repository":{"url":"git+https://github.com/arcanemachine/pi-read.git","type":"git"},"description":"Pi's native read tool with configurable line and byte limits","maintainers":[{"name":"arcanemachine","email":"arcanemachine@gmail.com"}],"readme":"# pi-read\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/arcanemachine/pi-read/main/logo.jpg\" alt=\"pi-read logo\" width=\"250\" />\n</p>\n\n> Pi's native `read` tool with smaller, configurable text-output limits.\n\n`pi-read` overrides Pi's built-in `read` tool while preserving its native line parameters, image processing, prompt metadata, and TUI behavior. It also adds optional byte paging and separate default and hard limits.\n\n## Why Does This Project Exist?\n\nPi's built-in read tool truncates text at 2000 lines or 50KB. Those defaults can consume a significant part of the context window. This extension lets you use smaller limits globally or per project.\n\nThe extension defaults are 100 lines and 5KB.\n\n> Like this extension? See [my other Pi extensions](https://github.com/arcanemachine/pi-projects).\n\n## Why Would This Be Better as a First-Party Setting?\n\nAn extension cannot adjust the limits on Pi's existing read tool. It must replace the tool's execution function.\n\nThat creates unavoidable costs:\n\n- To retain Pi's MIME sniffing, image conversion, resize isolation, model compatibility notes, and future image safeguards without copying private code, `pi-read` first executes the native reader as a probe. Text files are then read again with the configured limits.\n- The `readTool` object is not part of Pi's settings API. It cannot appear in `/settings`, participate in SDK in-memory settings, or use Pi's settings validation and migration.\n- Another extension can also override `read`; extension load order decides which implementation wins.\n- Pi can evolve native text-read behavior independently, so this package must track those changes.\n\nThe clean first-party design would add `maxLines` and `maxBytes` to Pi's native `ReadToolOptions` and settings, then pass them to `truncateHead`.\n\n## Features\n\n- Configurable line and byte limits\n- Global and trusted project settings with project precedence\n- Native `path`, `offset`, and `limit` parameters\n- Optional `offsetBytes` and `limitBytes` for exact byte paging\n- Smaller defaults with larger configurable on-demand hard caps\n- Exact line and byte continuation notices\n- Native path normalization, including macOS screenshot filename variants\n- Native image MIME sniffing, conversion, resizing, and model compatibility handling\n- Native compact TUI rendering and syntax highlighting\n- Dynamic tool description reflecting effective limits\n- Reload support through Pi's `/reload`\n\n## Installation\n\n### From GitHub\n\n```bash\npi install git:github.com/arcanemachine/pi-read\n```\n\nUpdate with:\n\n```bash\npi update git:github.com/arcanemachine/pi-read\n```\n\n### From npm\n\n```bash\npi install npm:@arcanemachine/pi-read\n```\n\nUpdate with:\n\n```bash\npi update npm:@arcanemachine/pi-read\n```\n\n### From a Local Clone\n\n```bash\ngit clone https://github.com/arcanemachine/pi-read.git\npi install /path/to/pi-read\n```\n\nNo local dependency installation is required for normal use.\n\n## Configuration\n\nAdd `readTool` to Pi's global or project `settings.json`:\n\n```json\n{\n  \"readTool\": {\n    \"maxLines\": 100,\n    \"maxBytes\": 5120,\n    \"maxLimitLines\": 2000,\n    \"maxLimitBytes\": 51200\n  }\n}\n```\n\n| Option          | Type             | Default | Description                                   |\n| --------------- | ---------------- | ------- | --------------------------------------------- |\n| `maxLines`      | positive integer | `100`   | Default maximum complete lines per read       |\n| `maxBytes`      | positive integer | `5120`  | Default maximum UTF-8 bytes per read          |\n| `maxLimitLines` | positive integer | `2000`  | Hard cap for an explicit `limit` request      |\n| `maxLimitBytes` | positive integer | `51200` | Hard cap for an explicit `limitBytes` request |\n\nThe first line or byte limit reached wins. Explicit `limit` and `limitBytes` values may request larger reads than the defaults but are clamped to the corresponding hard caps. Defaults must not exceed their hard caps.\n\n### Settings Locations\n\n- Global: `$PI_CODING_AGENT_DIR/settings.json`, or `~/.pi/agent/settings.json` by default\n- Project: `.pi/settings.json`\n\nProject settings override individual global `readTool` values. Project settings are read only when Pi trusts the project.\n\nAfter editing settings, run `/reload`.\n\n## Tool Parameters\n\n`pi-read` uses the same parameters as Pi:\n\n- `path`: relative or absolute file path\n- `offset`: first line to read, 1-indexed\n- `limit`: maximum requested line count; may increase the default up to `maxLimitLines`\n- `offsetBytes`: first byte to read, 0-indexed; takes precedence over `offset`\n- `limitBytes`: maximum requested byte count; may increase the default up to `maxLimitBytes`\n\nExample continuation notice:\n\n```text\n[Showing lines 1-100 of 500. Use offset=101 to continue or offsetBytes=4970 for byte paging.]\n```\n\nUse the exact byte offset from the footer. Arbitrary byte offsets inside a UTF-8 character are rejected rather than returning corrupted text.\n\n## Image Handling\n\nAll reads first pass through Pi's native reader. When Pi recognizes an image from its content, `pi-read` returns the native result unchanged. This retains:\n\n- content-based MIME detection rather than extension-based detection\n- PNG, JPEG, GIF, WebP, and BMP handling\n- conversion to provider-supported formats\n- isolated resize processing and size limits\n- non-vision-model notices\n- Pi's global `images.autoResize` and `images.blockImages` behavior\n\nFor text, the native probe result is discarded and the file is read with the configured limits. The extra text read is the main remaining implementation cost of not having a native limit option.\n\n## TUI Rendering\n\nThe override returns Pi's standard `ReadToolDetails` with the actual `TruncationResult`. Pi's inherited read renderer therefore shows the configured line or byte limit when expanded.\n\nLine-based calls keep Pi's native compact call rendering. Byte-based calls add a compact byte-range line so their non-native arguments remain visible in the tool box.\n\n## Development\n\n```bash\nnpm install --ignore-scripts --workspaces=false\nnpm run typecheck\nnpm run test\nnpm run build\nnpm run format\n```\n","readmeFilename":"README.md"}