@withpica/mcp-sdk 3.12.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [3.13.0] - 2026-08-26
|
|
15
|
+
|
|
16
|
+
The MPP pay rail (spec 2026-08-24 WS-B): a new resource to mint a pay link,
|
|
17
|
+
and two optional fields on the existing subscription-status response so a
|
|
18
|
+
client can say what pica costs and what it is holding.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **`BillingResource.mintPayLink()` on `PicaClient.billing`.** Wraps
|
|
23
|
+
`POST /admin/billing/pay-link`. Takes `{ offer: PayOffer; entity_id?: string }`
|
|
24
|
+
and returns a `PayLinkResponse` (`pay_url`, `expires_at`, `offer`, `offers`,
|
|
25
|
+
`held`, `how`) — the route's own envelope, since this route has no
|
|
26
|
+
`{success, data}` wrapper. Minting is not charging: the link is a capability
|
|
27
|
+
an agent POSTs with a Machine Payments credential, or a person opens in a
|
|
28
|
+
browser and pays by card. Refusals arrive as `ApiError` (403 billing not
|
|
29
|
+
enabled; 400 `nothing_held_for_entity` / entity_id required; 409
|
|
30
|
+
`offer_no_longer_applies` with the offers that do apply) and are
|
|
31
|
+
deliberately not caught inside the resource — callers decide what each
|
|
32
|
+
refusal means.
|
|
33
|
+
- **New exported types**: `PayOffer` (`"resident_month" | "unlock" | "settle"`),
|
|
34
|
+
`PayLinkOffer` (`{ offer, amount_minor, currency, label }`), `PayLinkResponse`,
|
|
35
|
+
`HeldSummary` (`{ count, entities }`), `PricingSummary` (`currency`,
|
|
36
|
+
`freeRunwayDeepProcesses`, `residentFeeMinorUnits`,
|
|
37
|
+
`residentIncludedDeepProcesses`, `overagePerSongMinorUnits`,
|
|
38
|
+
`overageCurrency`, `unlockMinorUnits`).
|
|
39
|
+
- **`SubscriptionStatusResponse` gains optional `pricing?: PricingSummary | null`
|
|
40
|
+
and `held?: HeldSummary | null`.** Both are `null` when billing enforcement
|
|
41
|
+
is off on the deployment, and absent entirely against a deployment whose
|
|
42
|
+
route predates the fields — consumers must read "no pricing" as "do not
|
|
43
|
+
state a price," never as "free."
|
|
44
|
+
|
|
14
45
|
## [3.12.0] - 2026-08-25
|
|
15
46
|
|
|
16
47
|
Adds the ADR-314 import continuation surface (below); everything else is documentation — no other method signature, request path or response shape changes.
|
package/dist/index.d.ts
CHANGED
|
@@ -2196,6 +2196,11 @@ export interface CatalogHealthVerdict {
|
|
|
2196
2196
|
completeness: number | null;
|
|
2197
2197
|
cleanliness: number | null;
|
|
2198
2198
|
};
|
|
2199
|
+
/** entities considered per dimension — what each dimension score is a share of; null iff that score is null (2026-08-26) */
|
|
2200
|
+
dimensionConsidered: {
|
|
2201
|
+
completeness: number | null;
|
|
2202
|
+
cleanliness: number | null;
|
|
2203
|
+
};
|
|
2199
2204
|
assessed: string[];
|
|
2200
2205
|
notAssessed: string[];
|
|
2201
2206
|
items: CatalogHealthItem[];
|
|
@@ -2672,6 +2677,97 @@ export interface SubscriptionStatusResponse {
|
|
|
2672
2677
|
recommendedTier: BillingTier;
|
|
2673
2678
|
} | null;
|
|
2674
2679
|
organisationId: string;
|
|
2680
|
+
/**
|
|
2681
|
+
* The org's price card, in its own billing currency. `null` when billing
|
|
2682
|
+
* enforcement is off on this deployment, and ABSENT against a deployment
|
|
2683
|
+
* whose route predates the field — hence both `?` and `| null`. Consumers
|
|
2684
|
+
* must read "no pricing" as "do not state a price", never as "free".
|
|
2685
|
+
*/
|
|
2686
|
+
pricing?: PricingSummary | null;
|
|
2687
|
+
/**
|
|
2688
|
+
* How much enrichment is being withheld pending payment. Same two-shaped
|
|
2689
|
+
* absence as `pricing` above.
|
|
2690
|
+
*/
|
|
2691
|
+
held?: HeldSummary | null;
|
|
2692
|
+
}
|
|
2693
|
+
/**
|
|
2694
|
+
* The three things a caller can be asked to pay for. Mirrors `PayOffer` in
|
|
2695
|
+
* `lib/services/billing-engine/pay-link.ts`; the route 400s on anything else,
|
|
2696
|
+
* so this union is the wire contract rather than a convenience.
|
|
2697
|
+
*/
|
|
2698
|
+
export type PayOffer = "resident_month" | "unlock" | "settle";
|
|
2699
|
+
/**
|
|
2700
|
+
* One priced offer as the routes publish it. The server composes `label`,
|
|
2701
|
+
* which already carries the formatted money — a client that re-words the
|
|
2702
|
+
* amount out of `amount_minor` becomes a second home for the price, which is
|
|
2703
|
+
* what `publicOffer` exists to prevent on the server side.
|
|
2704
|
+
*/
|
|
2705
|
+
export interface PayLinkOffer {
|
|
2706
|
+
offer: PayOffer;
|
|
2707
|
+
amount_minor: number;
|
|
2708
|
+
currency: string;
|
|
2709
|
+
label: string;
|
|
2710
|
+
}
|
|
2711
|
+
/** Findings pica is holding: `count` proposals across `entities` works. */
|
|
2712
|
+
export interface HeldSummary {
|
|
2713
|
+
count: number;
|
|
2714
|
+
entities: number;
|
|
2715
|
+
}
|
|
2716
|
+
/**
|
|
2717
|
+
* Every figure a reader of "what does pica cost" needs, derived server-side
|
|
2718
|
+
* from the constants that are actually charged (`pricingSummary()`).
|
|
2719
|
+
*
|
|
2720
|
+
* `overagePerSongMinorUnits` is denominated in `overageCurrency`, NOT
|
|
2721
|
+
* `currency` — the overage is charged in the canonical currency until
|
|
2722
|
+
* per-currency event pricing lands. The two fields are separate for that
|
|
2723
|
+
* reason; collapsing them would misprice every non-GBP org.
|
|
2724
|
+
*/
|
|
2725
|
+
export interface PricingSummary {
|
|
2726
|
+
currency: string;
|
|
2727
|
+
freeRunwayDeepProcesses: number;
|
|
2728
|
+
residentFeeMinorUnits: number;
|
|
2729
|
+
residentIncludedDeepProcesses: number;
|
|
2730
|
+
overagePerSongMinorUnits: number;
|
|
2731
|
+
overageCurrency: string;
|
|
2732
|
+
unlockMinorUnits: number;
|
|
2733
|
+
}
|
|
2734
|
+
/**
|
|
2735
|
+
* `POST /admin/billing/pay-link`. There is no `{success, data}` envelope on
|
|
2736
|
+
* this route — the body IS the response, so `BaseResource.request`'s
|
|
2737
|
+
* `data.data || data` returns it whole.
|
|
2738
|
+
*/
|
|
2739
|
+
export interface PayLinkResponse {
|
|
2740
|
+
pay_url: string;
|
|
2741
|
+
expires_at: string;
|
|
2742
|
+
offer: PayOffer;
|
|
2743
|
+
/** Every offer that currently applies, including the one minted. */
|
|
2744
|
+
offers: PayLinkOffer[];
|
|
2745
|
+
held: HeldSummary;
|
|
2746
|
+
/** One sentence naming both ways the link can be paid. */
|
|
2747
|
+
how: string;
|
|
2748
|
+
}
|
|
2749
|
+
declare class BillingResource extends BaseResource {
|
|
2750
|
+
/**
|
|
2751
|
+
* Mint a pay link for one offer. Minting is not charging: the link is a
|
|
2752
|
+
* capability an agent POSTs with a Machine Payments credential, or a person
|
|
2753
|
+
* opens in a browser and pays by card.
|
|
2754
|
+
*
|
|
2755
|
+
* Refusals arrive as `ApiError` carrying the route's status with its JSON
|
|
2756
|
+
* body embedded in the message (the shape `duplicates.ts` and
|
|
2757
|
+
* `integrity.ts` already parse): 403 `billing not enabled`; 400
|
|
2758
|
+
* `nothing_held_for_entity` / `entity_id is required to unlock`; 409
|
|
2759
|
+
* `offer_no_longer_applies`, whose body lists the offers that DO apply.
|
|
2760
|
+
* A 403 can ALSO come from the auth wrapper in front of the route rather
|
|
2761
|
+
* than the route itself (`{ error: { code: "INSUFFICIENT_SCOPE", … } }`),
|
|
2762
|
+
* so status alone never identifies which refusal this is — read the body.
|
|
2763
|
+
* They are deliberately not caught here — the MCP tool turns each into a
|
|
2764
|
+
* structured refusal, and a resource that swallowed them would leave every
|
|
2765
|
+
* other caller unable to tell a refusal from an outage.
|
|
2766
|
+
*/
|
|
2767
|
+
mintPayLink(params: {
|
|
2768
|
+
offer: PayOffer;
|
|
2769
|
+
entity_id?: string;
|
|
2770
|
+
}): Promise<PayLinkResponse>;
|
|
2675
2771
|
}
|
|
2676
2772
|
/**
|
|
2677
2773
|
* ADR-210 Phase 2 — Stripe Checkout session output for
|
|
@@ -4732,6 +4828,8 @@ export declare class PicaClient {
|
|
|
4732
4828
|
workflowOutcomes: WorkflowOutcomesResource;
|
|
4733
4829
|
feedback: FeedbackResource;
|
|
4734
4830
|
subscription: SubscriptionResource;
|
|
4831
|
+
/** MPP pay rail (WS-B) — mints pay links; never charges. */
|
|
4832
|
+
billing: BillingResource;
|
|
4735
4833
|
opsIssues: OpsIssuesResource;
|
|
4736
4834
|
discoveries: DiscoveriesResource;
|
|
4737
4835
|
agentIdentity: AgentIdentityResource;
|