chore(deps): bump pi-ai to 0.83.0 - #6
Open
1amKhush wants to merge 8 commits into
Open
Conversation
- Introduce model visibility policies via MUXLL_MODELS_ALLOW / DENY and config file - Add gated admin tools (admin.models.setPolicy, admin.balance.credit) controlled by MUXLL_ADMIN_PUBKEYS - Implement prepaid billing infrastructure: ledger DB, markup, min charge, option to enable via MUXLL_BILLING - Update ENV example and developer docs to reflect new capabilities and code organization
There was a problem hiding this comment.
Pull request overview
This PR updates the workspace to @earendil-works/pi-ai@^0.83.0 and, beyond the dependency bump, introduces new server/client capabilities around model visibility policy, admin tooling, CEP-8 payments-backed prepaid billing, and forwarding of reasoning_effort into provider-specific “thinking” options.
Changes:
- Bumped
@earendil-works/pi-aito^0.83.0across packages and refreshedbun.lock(including TypeBox 1.1.38 → 1.3.7). - Added model catalog policy (
models.listsearch/limit + hidden-model behavior inchat.complete) with admin policy mutation tools. - Implemented opt-in billing plumbing (ledger + markup pricing + CEP-8 payment gating + CLI/client balance/topup flows) with new end-to-end test coverage.
Reviewed changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents model policy/admin tools and billing/top-up CLI usage. |
| packages/test-utils/package.json | Bumps @earendil-works/pi-ai dev dependency to ^0.83.0. |
| packages/server/tests/pricing.test.ts | Adds regression tests for free-output cap behavior. |
| packages/server/tests/policy.test.ts | Adds end-to-end tests for model policy behavior and admin gating. |
| packages/server/tests/integration.test.ts | Adds mapReasoning tests and reasoning-effort forwarding coverage. |
| packages/server/tests/catalog.test.ts | Adds unit tests for catalog/policy match/merge/patch behavior. |
| packages/server/tests/billing.test.ts | Adds end-to-end billing + CEP-8 top-up tests over mock relay. |
| packages/server/src/wire.ts | Adds mapReasoning provider/API dispatch for reasoning/thinking options. |
| packages/server/src/server.ts | Threads catalog + billing into tool registration; adds admin + balance tools; wraps transport with server payments. |
| packages/server/src/pricing.ts | Introduces PriceBook and computeOutputCap logic for markup pricing + balance-based output caps. |
| packages/server/src/payments.ts | Adds CEP-8 resolvePrice policy (waive/reject chat; quote topups). |
| packages/server/src/main.ts | Adds policy persistence, billing env wiring, and NWC payment processor setup. |
| packages/server/src/ledger.ts | Adds SQLite-backed prepaid ledger for balances and usage history. |
| packages/server/src/index.ts | Re-exports new server-side catalog/billing/payment utilities as public API. |
| packages/server/src/catalog.ts | Implements policy-layered model catalog for list + resolve. |
| packages/server/package.json | Bumps @earendil-works/pi-ai to ^0.83.0. |
| packages/proxy/package.json | Bumps @earendil-works/pi-ai dev dependency to ^0.83.0. |
| packages/core/src/index.ts | Adds new tool methods + schemas for models.list params, policy tools, balance tools, and reasoning_effort. |
| packages/client/tests/client.test.ts | Adds CEP-8 rejection/top-up flow test using consistent client identity. |
| packages/client/src/index.ts | Exports balance response types from client package. |
| packages/client/src/client.ts | Adds CEP-8 client payments transport, enhanced stream rejection handling, listModels params, and balance/topup calls. |
| packages/client/package.json | Bumps @earendil-works/pi-ai dev dependency to ^0.83.0. |
| packages/cli/tests/cli.test.ts | Adds tests for CLI error formatting and top-up hinting. |
| packages/cli/src/index.ts | Adds balance/topup commands, CEP-8 payment handler, and improved error formatting. |
| packages/cli/package.json | Moves @contextvm/sdk to dependencies; bumps @earendil-works/pi-ai dev dependency. |
| design/idea.md | Adds an “idea” document (currently conflicts with newly implemented billing direction). |
| design/billing.md | Adds billing design doc (currently marked “not yet implemented” despite Phase 1 code in this PR). |
| bun.lock | Updates lockfile for pi-ai 0.83.0 and TypeBox 1.3.7. |
| AGENTS.md | Updates contributor guidance to reflect new catalog/policy/billing surfaces. |
| .env.example | Documents new env vars for model policy, admin tools, and billing. |
Suppressed comments (1)
README.md:249
- The README links to
docs/idea.md, but that file doesn't exist (the PR addsdesign/idea.md). This currently points readers to a dead link.
[`docs/idea.md`](docs/idea.md) for the original design note.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| files are intentionally out of scope for now. | ||
| and without streaming) and model listing. Billing is in progress (Phase 1: | ||
| a prepaid USD balance ledger funded by admin grants, with a markup over | ||
| upstream cost); see [`docs/billing.md`](docs/billing.md) for the design. |
Comment on lines
+89
to
+98
| const billingEnabled = process.env.MUXLL_BILLING === "1"; | ||
| const ledger = billingEnabled | ||
| ? new Ledger(process.env.MUXLL_LEDGER_DB ?? "muxll-ledger.sqlite") | ||
| : undefined; | ||
| const priceBook = billingEnabled | ||
| ? new PriceBook({ | ||
| markupPct: Number(process.env.MUXLL_MARKUP_PCT ?? 0), | ||
| minChargeUsd: Number(process.env.MUXLL_MIN_CHARGE_USD ?? 0), | ||
| }) | ||
| : undefined; |
Comment on lines
+164
to
+173
| export function formatCliError(error: unknown): string { | ||
| const message = error instanceof Error ? error.message : String(error); | ||
| const code = | ||
| typeof error === "object" && error !== null && "code" in error | ||
| ? (error as { code?: unknown }).code | ||
| : undefined; | ||
| return code === -32000 && message.includes("insufficient balance") | ||
| ? `${message}\nRun: muxll topup --usd 0.05` | ||
| : message; | ||
| } |
Comment on lines
+175
to
+176
| if ("reject" in cap) throw new Error(cap.reason); | ||
| maxTokens = cap.maxTokens; |
Comment on lines
+3
to
+7
| Status: **design** (not yet implemented). This document is the reference for the | ||
| next iteration. It supersedes the "Pricing & quotas — out of scope" line in | ||
| `README.md` and the matching deferral in `docs/idea.md`; it does **not** change | ||
| the inference-adapter principle in `VISION.md` (see | ||
| [Architectural tension](#architectural-tension) below). |
Comment on lines
+9
to
+13
| For now, we don’t need to worry about pricing or charging for usage since we first want to validate this proof of concept for development purposes. Once everything is in place, we can explore paid options. For now, let’s focus solely on the router and proxy so we can serve LLM inference through our server. | ||
|
|
||
| The goal is for operators to plug in APIs from providers—for example—and serve them through our CVM server. | ||
|
|
||
| We will implement this in TypeScript, using the CVM SDK and the pi SDK. Codebased and docs are available at the `docs` directory. We also have an example of a server implementing streaming api at `cordn` directory. Also all cvm docs are available as well. No newline at end of file |
Comment on lines
125
to
+131
| /** Register chat.complete and models.list on an McpServer. */ | ||
| export function registerTools(server: McpServer, models: Models): void { | ||
| export function registerTools( | ||
| server: McpServer, | ||
| models: Models, | ||
| catalog: Catalog, | ||
| billingOpts?: { ledger: Ledger; priceBook: PriceBook }, | ||
| ): void { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates
@earendil-works/pi-aifrom^0.80.3to^0.83.0across the muxll workspace.This PR is independent of the live FX and ledger-storage follow-up.
Changes
@earendil-works/pi-aiin:@muxll/server@muxll/client@muxll/cli@muxll/proxy@muxll/test-utilsbun.lock.Compatibility review
ModelsAPI and supported provider subpaths.providers/*remain supported.@earendil-works/pi-ai/compatwas required.Verification
providers/allexports pass.Refs #1