|
| 1 | +# Private Premium Extension Contract |
| 2 | + |
| 3 | +This file defines the minimal integration contract for a separate private repo. |
| 4 | + |
| 5 | +## Goal |
| 6 | + |
| 7 | +The public repo stays OSS and safe to share. |
| 8 | +The private repo contains premium logic and is loaded only through the gated runtime boundary. |
| 9 | + |
| 10 | +## Required public-side contract |
| 11 | + |
| 12 | +- Public loader: `premium_runtime.py` |
| 13 | +- Public contract module: `premium_contract.py` |
| 14 | +- Runtime env var for the private entrypoint: |
| 15 | + - `SQLITE_MEMORY_PREMIUM_ENTRYPOINT` |
| 16 | + |
| 17 | +## Supported private entrypoint shapes |
| 18 | + |
| 19 | +- `package.module` |
| 20 | +- `package.module:register` |
| 21 | +- `C:\path\to\premium_plugin.py` |
| 22 | +- `C:\path\to\premium_plugin.py::register` |
| 23 | + |
| 24 | +## Recommended private function signature |
| 25 | + |
| 26 | +```python |
| 27 | +from premium_contract import PremiumMountContext, PremiumRegistrationResult |
| 28 | + |
| 29 | +def register_premium_extensions( |
| 30 | + mcp, |
| 31 | + *, |
| 32 | + server_name: str | None = None, |
| 33 | + mount_context: PremiumMountContext | None = None, |
| 34 | +) -> PremiumRegistrationResult: |
| 35 | + ... |
| 36 | +``` |
| 37 | + |
| 38 | +## Guaranteed inputs from the public runtime |
| 39 | + |
| 40 | +- `server_name` |
| 41 | +- `mount_context.contract_version` |
| 42 | +- `mount_context.feature_id` |
| 43 | +- `mount_context.machine_id` |
| 44 | +- `mount_context.config` |
| 45 | + |
| 46 | +## Minimal private repo skeleton |
| 47 | + |
| 48 | +```python |
| 49 | +from premium_contract import PREMIUM_RUNTIME_CONTRACT_VERSION |
| 50 | + |
| 51 | +def register_premium_extensions(mcp, *, server_name=None, mount_context=None): |
| 52 | + if mount_context is None: |
| 53 | + raise RuntimeError("mount_context required") |
| 54 | + if mount_context.contract_version != PREMIUM_RUNTIME_CONTRACT_VERSION: |
| 55 | + raise RuntimeError("contract mismatch") |
| 56 | + |
| 57 | + # mount premium tools or sub-MCP here |
| 58 | + return { |
| 59 | + "mounted": True, |
| 60 | + "contract_version": mount_context.contract_version, |
| 61 | + "extension_name": "sqlite-memory-premium", |
| 62 | + "features": ["acl_rbac", "partner_digest"], |
| 63 | + } |
| 64 | +``` |
| 65 | + |
| 66 | +## Boundary rule |
| 67 | + |
| 68 | +The private repo must not assume direct access to secrets from the public repo. |
| 69 | +Entitlements, approval tokens, and public-key material stay outside git and are injected at runtime. |
0 commit comments