{"_id":"@bismawy/pi-auto-compat","_rev":"6-0f4a6d0393494543b3bc6f37d5e318df","name":"@bismawy/pi-auto-compat","dist-tags":{"latest":"1.5.0"},"versions":{"1.4.0":{"name":"@bismawy/pi-auto-compat","version":"1.4.0","keywords":["pi-package","pi-extension","pi","pi-coding-agent","compat","models-json","cache-optimizer","proxy"],"author":{"name":"bismawy"},"license":"MIT","_id":"@bismawy/pi-auto-compat@1.4.0","maintainers":[{"name":"bismawy","email":"byztma@gmail.com"}],"homepage":"https://github.com/bismawy/pi-auto-compat#readme","bugs":{"url":"https://github.com/bismawy/pi-auto-compat/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"582064bf56a47fe3f008e06aa1305b9433e579c9","tarball":"https://registry.npmjs.org/@bismawy/pi-auto-compat/-/pi-auto-compat-1.4.0.tgz","fileCount":4,"integrity":"sha512-9JCYJQCCgJFlVqg/ooOFqD/el73iQ0r3RGIHdvPr9lPgWt+GNsLsQ4x085ElWSk95PUgpGnLYK3R+AZLRfm6NQ==","signatures":[{"sig":"MEYCIQDSdkPwAY7rOc3hsDKT/ygvX3TJgeUtCoMyyOvcAqVGvwIhAIpGOWf3Ge4sVY6dloBINQ1Q8Ho8Pzx4JQliPMe6x9ZF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30321},"imports":{"#extension":"./index.ts"},"_npmUser":{"name":"bismawy","email":"byztma@gmail.com"},"repository":{"url":"git+https://github.com/bismawy/pi-auto-compat.git","type":"git"},"_npmVersion":"11.17.0","description":"Auto-fix missing compat flags in Pi's models.json — mirrors pi-cache-optimizer detection so compat warnings never appear. Registry-driven, credential-safe, refreshes in-process.","directories":{},"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-compat_1.4.0_1787890157854_0.5080188713059199","host":"s3://npm-registry-packages-npm-production"}},"1.4.1":{"name":"@bismawy/pi-auto-compat","version":"1.4.1","keywords":["pi-package","pi-extension","pi","pi-coding-agent","compat","models-json","cache-optimizer","proxy"],"author":{"name":"bismawy"},"license":"MIT","_id":"@bismawy/pi-auto-compat@1.4.1","maintainers":[{"name":"bismawy","email":"byztma@gmail.com"}],"homepage":"https://github.com/bismawy/pi-auto-compat#readme","bugs":{"url":"https://github.com/bismawy/pi-auto-compat/issues"},"pi":{"image":"https://raw.githubusercontent.com/bismawy/pi-auto-compat/main/assets/screenshot.webp","extensions":["./index.ts"]},"dist":{"shasum":"577cc4769b326482b503be9de6258df3ae8aee87","tarball":"https://registry.npmjs.org/@bismawy/pi-auto-compat/-/pi-auto-compat-1.4.1.tgz","fileCount":5,"integrity":"sha512-0SePVFcBKYjPgRJqtP0mwor5w3OqedsUi0vf5Yy1hIZUXcqQksEKl7+ZWM7DbIlwa6m/B+yhi1M+Yg5GU9MGTA==","signatures":[{"sig":"MEQCIFgtmebOLadZym2EAEb2iPOddPK/wHdiB4O032nEM47FAiAMdaLj/obtApVguRrBJTkfHXCSJlqAIUN/OYYqVTFmjg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48483},"gitHead":"8dcf6c14356d0177f8d5554b2ea29030dbad5d53","imports":{"#extension":"./index.ts"},"_npmUser":{"name":"bismawy","email":"byztma@gmail.com"},"repository":{"url":"git+https://github.com/bismawy/pi-auto-compat.git","type":"git"},"_npmVersion":"11.19.0","description":"Auto-fix missing compat flags in Pi's models.json — mirrors pi-cache-optimizer detection so compat warnings never appear. Registry-driven, credential-safe, refreshes in-process.","directories":{},"_nodeVersion":"26.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-compat_1.4.1_1788069214276_0.3912861000134462","host":"s3://npm-registry-packages-npm-production"}},"1.4.2":{"name":"@bismawy/pi-auto-compat","version":"1.4.2","keywords":["pi-package","pi-extension","pi","pi-coding-agent","compat","models-json","cache-optimizer","proxy"],"author":{"name":"bismawy"},"license":"MIT","_id":"@bismawy/pi-auto-compat@1.4.2","maintainers":[{"name":"bismawy","email":"byztma@gmail.com"}],"homepage":"https://github.com/bismawy/pi-auto-compat#readme","bugs":{"url":"https://github.com/bismawy/pi-auto-compat/issues"},"pi":{"image":"https://raw.githubusercontent.com/bismawy/pi-auto-compat/main/assets/screenshot.webp","extensions":["./index.ts"]},"dist":{"shasum":"2d2dae12b896df1f212372b37bd85117ac45c900","tarball":"https://registry.npmjs.org/@bismawy/pi-auto-compat/-/pi-auto-compat-1.4.2.tgz","fileCount":5,"integrity":"sha512-FAMQWnOL6JFMLOPbUHrNX7iQHWQ0qJrjVxx9JlbgqlBQre27TSKFdrSz8RdHhb6vTWPbWrdUh1Afw55QqWuURg==","signatures":[{"sig":"MEUCICmLM0OQ4Dl/MIVroMN3uTsanms9FeLBG7t96brPA8UUAiEAoNIcjBBZ09mVlx9elNn8TJUeclKPc5Wf68z0Q+i+QiA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48484},"gitHead":"780d062f85f4b60a2aad45975946c4123e7b3678","imports":{"#extension":"./index.ts"},"_npmUser":{"name":"bismawy","email":"byztma@gmail.com"},"repository":{"url":"git+https://github.com/bismawy/pi-auto-compat.git","type":"git"},"_npmVersion":"11.17.0","description":"Auto-fix missing compat flags in Pi's models.json — mirrors pi-cache-optimizer detection so compat warnings never appear. Registry-driven, credential-safe, refreshes in-process.","directories":{},"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-compat_1.4.2_1789004286563_0.35684143786322453","host":"s3://npm-registry-packages-npm-production"}},"1.4.3":{"name":"@bismawy/pi-auto-compat","version":"1.4.3","keywords":["pi-package","pi-extension","pi","pi-coding-agent","compat","models-json","cache-optimizer","proxy"],"author":{"name":"bismawy"},"license":"MIT","_id":"@bismawy/pi-auto-compat@1.4.3","maintainers":[{"name":"bismawy","email":"byztma@gmail.com"}],"homepage":"https://github.com/bismawy/pi-auto-compat#readme","bugs":{"url":"https://github.com/bismawy/pi-auto-compat/issues"},"pi":{"image":"https://raw.githubusercontent.com/bismawy/pi-auto-compat/main/assets/screenshot.webp","extensions":["./index.ts"]},"dist":{"shasum":"6ce96aa17657398e3549e6fbb42e7f78c66c1e0c","tarball":"https://registry.npmjs.org/@bismawy/pi-auto-compat/-/pi-auto-compat-1.4.3.tgz","fileCount":5,"integrity":"sha512-qzVW1WGI6XYlTKPqJHJ8B4mEH1uq6ZnemfHX8LOdTmjlVC9SBtjk8fe3HUoxpulh/y8iCcPk7D3F8u4HlngzmQ==","signatures":[{"sig":"MEYCIQCFZ4QZ83hZl8qKQ9NtvK+QHTe5Xf3DSsG5WsoWUpvCAgIhAO1JUoWPwkU3zhGO7M23hJmpL6hnTIL0/M+pcB4hL1q8","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48813},"gitHead":"2c1f1eb346534604a018ef85e6ca65318ab4aec2","imports":{"#extension":"./index.ts"},"_npmUser":{"name":"bismawy","email":"byztma@gmail.com"},"repository":{"url":"git+https://github.com/bismawy/pi-auto-compat.git","type":"git"},"_npmVersion":"11.17.0","description":"Auto-fix missing compat flags in Pi's models.json — mirrors pi-cache-optimizer detection so compat warnings never appear. Registry-driven, credential-safe, refreshes in-process.","directories":{},"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-compat_1.4.3_1789101720722_0.8889131990467689","host":"s3://npm-registry-packages-npm-production"}},"1.4.4":{"name":"@bismawy/pi-auto-compat","version":"1.4.4","keywords":["pi-package","pi-extension","pi","pi-coding-agent","compat","models-json","cache-optimizer","proxy"],"author":{"name":"bismawy"},"license":"MIT","_id":"@bismawy/pi-auto-compat@1.4.4","maintainers":[{"name":"bismawy","email":"byztma@gmail.com"}],"homepage":"https://github.com/bismawy/pi-auto-compat#readme","bugs":{"url":"https://github.com/bismawy/pi-auto-compat/issues"},"pi":{"image":"https://raw.githubusercontent.com/bismawy/pi-auto-compat/main/assets/banner.webp","extensions":["./extensions/index.ts"]},"dist":{"shasum":"76ddf3e533955f24cdee07fea6ddb45c9fd7af89","tarball":"https://registry.npmjs.org/@bismawy/pi-auto-compat/-/pi-auto-compat-1.4.4.tgz","fileCount":5,"integrity":"sha512-Q4klhYsJwFQZUnjhzBFoj2QHdinMrwxcj2bVjSRup0LsvVgqaeAuXTr8YTwgWAaB+dQr21GPVoEmorhet2NKZg==","signatures":[{"sig":"MEUCIQCQm1KwgEmv51v9zG283LwM5fr6yEHpwgmXQLnmLBx4JAIgObZlc4t+fyxVhUos8IgMPnsXiSyt8jmUpvMtbkqvwls=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCpmKZKu1/r4BuLTKMssTnHBXyoeDfKrasjqU7SPVtl6gIhAJScbCJCryyjb31vWrsO7IRTa6106arMJO6py5y0wVxL","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37423},"type":"module","gitHead":"502f2e5d5fcb56679caf251d531e42b3c0df0594","scripts":{"dev":"pi -e ./extensions/index.ts","test":"node --test"},"_npmUser":{"name":"bismawy","email":"byztma@gmail.com"},"repository":{"url":"git+https://github.com/bismawy/pi-auto-compat.git","type":"git"},"_npmVersion":"11.17.0","description":"In-process compat flags self-healer for Pi: automated cache retention, adaptive generation, proxy session affinity, and thinking level maps.","directories":{},"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-compat_1.4.4_1790578477966_0.9712123743682419","host":"s3://npm-registry-packages-npm-production"}},"1.5.0":{"pi":{"image":"https://raw.githubusercontent.com/bismawy/pi-auto-compat/main/assets/banner.webp","extensions":["./extensions/index.ts"]},"_id":"@bismawy/pi-auto-compat@1.5.0","bugs":{"url":"https://github.com/bismawy/pi-auto-compat/issues"},"dist":{"shasum":"cb3ff8ef2d133e255753e885abc691c558ca6532","tarball":"https://registry.npmjs.org/@bismawy/pi-auto-compat/-/pi-auto-compat-1.5.0.tgz","fileCount":5,"integrity":"sha512-3YLEUPXm+bMiahOec7cboEZexoSkPDpfZJsg3dsjU8wFSu75sxN9/sfBA9DliN05d52MaHd7hUzGEGHSMPjntA==","signatures":[{"sig":"MEUCIDC/7Hv6Z9KTzswXH35OMeTtz4AiynBSqLF4YyXl5rPqAiEA6z9Oq5v3tNZWNJbxHaoNvyWbXlSDtqc1VHUTSXVWq0w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIG60ZtUcuPgadDNdGX7k0JSUlIeGYDp/Y7+Mdbma5zRyAiAxcL/wNAqie7m8UX/f8/75NmsV+T/BJUx4W0kvzIpTKg=="}],"unpackedSize":39994},"name":"@bismawy/pi-auto-compat","type":"module","author":{"name":"bismawy"},"gitHead":"79735bee2be543c237cd44a7758cf21610d09aab","license":"MIT","scripts":{"dev":"pi -e ./extensions/index.ts","test":"node --test"},"version":"1.5.0","_npmUser":{"name":"bismawy","email":"byztma@gmail.com"},"homepage":"https://github.com/bismawy/pi-auto-compat#readme","keywords":["pi-package","pi-extension","pi","pi-coding-agent","compat","models-json","cache-optimizer","proxy"],"repository":{"url":"git+https://github.com/bismawy/pi-auto-compat.git","type":"git"},"_npmVersion":"11.19.0","description":"In-process compat flags self-healer for Pi: automated cache retention, adaptive generation, developer-role opt-out, proxy session affinity, and thinking level maps.","directories":{},"maintainers":[{"name":"bismawy","email":"byztma@gmail.com"}],"_nodeVersion":"26.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-auto-compat_1.5.0_1790997113645_0.6397075248437833"}}},"time":{"created":"2026-08-28T04:09:17.617Z","modified":"2026-10-03T03:11:53.869Z","1.4.0":"2026-08-28T04:09:17.989Z","1.4.1":"2026-08-30T05:53:34.410Z","1.4.2":"2026-09-10T01:38:06.689Z","1.4.3":"2026-09-11T04:42:00.856Z","1.4.4":"2026-09-28T06:54:38.063Z","1.5.0":"2026-10-03T03:11:53.722Z"},"bugs":{"url":"https://github.com/bismawy/pi-auto-compat/issues"},"author":{"name":"bismawy"},"license":"MIT","homepage":"https://github.com/bismawy/pi-auto-compat#readme","keywords":["pi-package","pi-extension","pi","pi-coding-agent","compat","models-json","cache-optimizer","proxy"],"repository":{"url":"git+https://github.com/bismawy/pi-auto-compat.git","type":"git"},"description":"In-process compat flags self-healer for Pi: automated cache retention, adaptive generation, developer-role opt-out, proxy session affinity, and thinking level maps.","maintainers":[{"name":"bismawy","email":"byztma@gmail.com"}],"readme":"# Auto Compat\n\nAutomated model compat flags. In-process self-healing. Zero session restart.\n\n[![Custom badge](https://shieldcn.dev/badge/pi-%20Packages.svg?variant=outline&size=xs&logo=ri%3APiPiBold)](https://pi.dev/packages/@bismawy/pi-auto-compat)\n[![badge](https://shieldcn.dev/npm/@bismawy/pi-auto-compat.svg?variant=outline&size=xs)](https://www.npmjs.com/package/@bismawy/pi-auto-compat)\n[![license](https://shieldcn.dev/github/bismawy/pi-auto-compat/license.svg?variant=outline&size=xs)](https://github.com/bismawy/pi-auto-compat)\n\n<img src=\"https://raw.githubusercontent.com/bismawy/pi-auto-compat/main/assets/banner.webp\" alt=\"Auto Compat: in-process model compatibility flags self-healer\" width=\"100%\">\n\n## Overview\n\npi-auto-compat inspects active models and patches missing compatibility flags in `models.json` in-process.\n\n- Auto-Heal: Patches missing flags on `session_start`, `model_select`, and `models.json` file events.\n- In-Process Refresh: Invokes `modelRegistry.refresh()` immediately upon write without session restart.\n- Cache-Optimizer Parity: Mirrors 1-hour cache retention, adaptive generation, proxy anthropic cache control, and session affinity.\n- Thinking Map Synthesis: Synthesizes standard `{ low, medium, high, xhigh }` `thinkingLevelMap` for unmapped reasoning models.\n- Windows Lock Resilience: Wraps `writeStatsShardV7` in `pi-cache-optimizer` with retry and copy fallback against NTFS `EPERM`/`EBUSY`.\n- Credential-Safe: Touches only `compat` and `modelOverrides`, keeping API keys untouched with rotating backups (max 3).\n\n## Install\n\n```bash\npi install npm:@bismawy/pi-auto-compat\n```\n\nTo test locally without installing:\n```bash\npi -e ./extensions/index.ts\n```\n\n## Commands\n\n| Command | Scope | Action |\n| --- | --- | --- |\n| `/auto-compat` | Global | Audit active models, patch missing flags in `models.json`, and refresh the registry |\n\n> **Notes:**\n> - **Zero-Config Background Run:** Fixes are applied automatically on session launch and when switching models.\n> - **Explicit Settings Honored:** If you have explicitly configured a compat flag (even `false`), pi-auto-compat will never overwrite it.\n\n## Architecture\n\n<details>\n<summary><b>Compatibility Rules</b></summary>\n\n| Category | Conditions | Applied Flags |\n| --- | --- | --- |\n| **Universal Cache Retention** | All models where unset (except built-in llama.cpp) | `supportsLongCacheRetention: true` (Anthropic & official OpenAI), `false` (third-party OpenAI-compatible) |\n| **Developer Role Opt-Out** | Reasoning models on OpenAI-compatible channels except official OpenAI / OpenRouter | `supportsDeveloperRole: false` — sends the instruction prompt as `system` instead of `developer`, fixing routers that 400 on `messages.0.role` |\n| **Adaptive Generation** | `anthropic-messages` + Opus/Sonnet ≥ 4.6, Fable ≥ 5, Kimi K3 | `forceAdaptiveThinking: true`, `allowEmptySignature: true` (Kimi K3) |\n| **DeepSeek Reasoning** | `openai-completions` / `openai-responses` matching DeepSeek | `requiresReasoningContentOnAssistantMessages: true`, `thinkingFormat: \"deepseek\"`, session affinity |\n| **Claude on Proxies** | Claude models on OpenAI-compatible proxies | `cacheControlFormat: \"anthropic\"` |\n| **OpenAI-Compatible Proxies** | Custom `openai-completions` endpoints | `sendSessionAffinityHeaders: true` (when undefined) |\n| **Unmapped Reasoning** | Reasoning models without declared thinking maps | Declares standard `{ low, medium, high, xhigh }` `thinkingLevelMap` |\n\n</details>\n\n<details>\n<summary><b>Placement Strategy</b></summary>\n\n- Provider Settings: Writes channel-wide parameters (session affinity, cache retention) directly to provider blocks.\n- Model Overrides: Writes model-specific flags under `models[].compat`, or `modelOverrides` for dynamic extension providers.\n\n</details>\n\n<details>\n<summary><b>Windows Resilience</b></summary>\n\n- Shard Lock Protection: Wraps `writeStatsShardV7` in `pi-cache-optimizer` with `safeAtomicRename` (retry with backoff + copy fallback) against NTFS `EPERM`/`EBUSY`.\n- Orphan Cleanup: Unlinks stale `.tmp` files in `pi-cache-optimizer-stats.d/shards/` automatically on session start.\n\n</details>\n\n<details>\n<summary><b>Safety & Backups</b></summary>\n\n- Credential-Safe: Only modifies `compat` and `modelOverrides`. Never reads, writes, or logs API keys or base URLs.\n- Rotating Backups: Retains up to 3 timestamped backups (`models.json.backup.*`) before saving.\n\n</details>\n\n<details>\n<summary><b>Development</b></summary>\n\n```bash\nnpm test    # Run unit tests verifying compat flag rules\nnpm run dev # Launch local Pi instance with auto-compat active\n```\n\n</details>\n\n## License\n\nDistributed under the **MIT** license.\n\n## Author\n\n[Bisma](https://github.com/bismawy)\n","readmeFilename":"README.md"}