{"_id":"@brglng/pi-prompt-emulated-tool-call","name":"@brglng/pi-prompt-emulated-tool-call","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@brglng/pi-prompt-emulated-tool-call","version":"0.1.0","description":"Pi extension that emulates tool calls via prompts for chat-only models","type":"module","license":"MPL-2.0","pi":{"extensions":["./index.ts"]},"scripts":{"test":"node --experimental-strip-types --test test/index.test.mjs","typecheck":"npx tsc --noEmit"},"devDependencies":{"@types/node":"^22.0.0","typescript":"^5.7.0"},"gitHead":"23de459e45c96640e5e7212461cda88aa95de274","_id":"@brglng/pi-prompt-emulated-tool-call@0.1.0","_nodeVersion":"26.8.1","_npmVersion":"11.19.0","dist":{"integrity":"sha512-rvHOsXAUcbPQHoRhRUiZ+erxfHoLKVdadAbquCGITd6Eqx15e43X93VE6PF6xpeqCRGH4b4wXWLlXHpD5O27kQ==","shasum":"870289d5b2efa1850295cf4a2175c84ec188f2ac","tarball":"https://registry.npmjs.org/@brglng/pi-prompt-emulated-tool-call/-/pi-prompt-emulated-tool-call-0.1.0.tgz","fileCount":4,"unpackedSize":48888,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGRoZYSd+ULGBa8rnEbqy0Cd2G6O1aDvn6QWFTBl+xOMAiAKSdVAlzkGfeXuMUOZJidm8AjS1VyvOMMpTODRq/Ciaw=="}]},"_npmUser":{"name":"brglng","email":"brglng@gmail.com"},"directories":{},"maintainers":[{"name":"brglng","email":"brglng@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-prompt-emulated-tool-call_0.1.0_1788175648813_0.29858964498941454"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-31T11:27:28.630Z","0.1.0":"2026-08-31T11:27:28.935Z","modified":"2026-08-31T11:27:29.170Z"},"maintainers":[{"name":"brglng","email":"brglng@gmail.com"}],"description":"Pi extension that emulates tool calls via prompts for chat-only models","license":"MPL-2.0","readme":"# pi-prompt-emulated-tool-call\n\nExtension for the Pi coding agent that emulates tool calls via prompts for chat-only models that do not support native tool calling.\n\n## How it works\n\nFor each configured model, the extension injects a system-prompt section that contains the full JSON schemas of the currently active tools. When the model needs a tool it responds with exactly one `<tool_calls>` block wrapping a JSON array:\n\n```xml\n<tool_calls>\n[{\"name\": \"read\", \"arguments\": {\"path\": \"src/index.ts\", \"offset\": 1}}]\n</tool_calls>\n```\n\nThe extension parses that block into native Pi tool calls, which Pi then executes through its normal agent loop. All calls in one array run in parallel by default; if an active tool explicitly declares `executionMode: \"sequential\"`, Pi's sequential execution constraint is respected. Results are injected back as a `<tool_results>` JSON array on the next turn. Ordinary responses without the marker pass through unchanged.\n\n## Installation\n\nInstall package from npm with Pi's package manager:\n\n```sh\n# global\npi install npm:@brglng/pi-prompt-emulated-tool-call\n\n# project-local\npi install -l npm:@brglng/pi-prompt-emulated-tool-call\n```\n\nPi loads extension entrypoint from package manifest. Create configuration files at paths below after installation.\n\n## Configuration\n\nCreate a config file at one of:\n\n- global: `~/.pi/agent/extensions/pi-prompt-emulated-tool-call/config.json`\n- project: `.pi/extensions/pi-prompt-emulated-tool-call/config.json`\n\nThe shape is:\n\n```json\n{\n  \"models\": [\n    \"provider-id/model-id\",\n    { \"model\": \"provider-id/model-id\", \"removeNativeToolFields\": true }\n  ]\n}\n```\n\n- String entries use default options.\n- Object entries may set `removeNativeToolFields`.\n- `models` may mix strings and objects.\n- A project config overrides the global config when present; `models: []` disables the feature. Project config is only read when the project is trusted.\n- `removeNativeToolFields` defaults to `false`. When `true`, the extension removes native tool definitions, tool selection, and parallel-tool fields from the provider request payload. This covers provider-specific shapes such as Google/Vertex `config.tools` / `config.toolConfig`, Bedrock root-level `toolConfig`, and equivalent `tools` / `tool_choice` / `toolChoice` / `parallel_tool_calls` / `parallelToolCalls` fields.\n\nInvalid JSON or an illegal model entry logs a warning and disables that config file; it does not block Pi startup.\n\n## Development\n\n```sh\n# install dev dependencies\nnpm install\n\n# run tests\nnpm test\n\n# typecheck\nnpm run typecheck\n```\n\n## License\n\nMPL-2.0\n","readmeFilename":"README.md","_rev":"1-db199d1a9e05a94d9a9689332082c9c0"}