@lerianstudio/matcher-mcp 5.0.0-beta.90 → 5.0.0-beta.92

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.
@@ -9261,7 +9261,7 @@ paths:
9261
9261
  - Onboarding
9262
9262
  /v1/admin/workspaces/{slug}/plan:
9263
9263
  put:
9264
- description: "Puts a workspace on the contractual enterprise plan: persists plan=enterprise and billing_status=active together, then evicts the billing edge-gate and volume-resolver caches so the contractual ceiling applies immediately. ONLY \"enterprise\" is accepted. This is not a generic set-plan operation: self-serve plans are bought through hosted checkout and converged from the live subscription's price, so assigning one by hand would be a payment-processor bypass that the next processor delivery silently reverts — any other plan code returns 409. It REFUSES a workspace whose subscription the payment processor could still bill (409): the operator cancels there first, where the proration and refund decision gets human eyes, and this route never moves processor money. That refusal covers every subscription that is not permanently over — one awaiting card authentication or one that is paused is not charging today and resumes tomorrow, and it would revert this plan the moment it does; only a cancelled or expired subscription is assignable over. If the processor cannot be asked, the request is refused as retryable (503) rather than allowed through. A suspended workspace is refused (409) because this operation moves no access posture — reactivate it first, and the write is compare-and-swapped on the status read, so a suspension landing mid-request is refused rather than reversed. There is no reverse: removing the enterprise plan is not offered. The target slug comes from the URL path (backoffice operation, workspace admin action). An unknown workspace returns 404. Errors use RFC 9457 problem+json."
9264
+ description: "Puts a workspace on the contractual enterprise plan: persists plan=enterprise and billing_status=active together, then evicts the billing edge-gate and volume-resolver caches so the contractual ceiling applies immediately. ONLY \"enterprise\" is accepted. This is not a generic set-plan operation: self-serve plans are bought through hosted checkout and converged from the live subscription's price, so assigning one by hand would be a payment-processor bypass that the next processor delivery silently reverts — any other plan code returns 409. It REFUSES a workspace whose subscription the payment processor could still bill (409): the operator cancels there first, where the proration and refund decision gets human eyes, and this route never moves processor money. That refusal covers every subscription that is not permanently over — one awaiting card authentication or one that is paused is not charging today and resumes tomorrow, and it would revert this plan the moment it does; only a cancelled or expired subscription is assignable over. If the processor cannot be asked, the request is refused as retryable (503) rather than allowed through. A suspended workspace is refused (409) because this operation moves no access posture — reactivate it first, and the write is compare-and-swapped on the status read, so a suspension landing mid-request is refused rather than reversed. There is no reverse: removing the enterprise plan is not offered. The target slug comes from the URL path (backoffice operation, workspace admin action). An unknown workspace returns 404. Errors use RFC 9457 problem+json. Every refusal on this route carries its own product code, because the sentence of a 503 is scrubbed before it leaves the process and the code is then the whole answer: 409 MTCH-0803 (a subscription the processor can still bill — cancel it there first), 409 MTCH-0804 (a plan code other than enterprise), 409 MTCH-0805 (the workspace's billing status does not allow the change — reload it), 503 MTCH-0802 (the processor could not be asked — retry) and 503 MTCH-0801 (no payment processor is configured on this deployment — NO retry clears it; the lever is configuration). MTCH-0805 is the same code the suspend and reactivate routes answer for a refused billing-status transition."
9265
9265
  operationId: admin-assign-workspace-plan
9266
9266
  parameters:
9267
9267
  - description: Slug of the workspace to assign the plan to.
@@ -9360,7 +9360,7 @@ paths:
9360
9360
  - Onboarding
9361
9361
  /v1/billing/webhook:
9362
9362
  post:
9363
- description: "Receives a signed billing event from the payment processor and applies it to the workspace's commercial state. This route carries NO operator JWT and no tenant identifier of any kind: a processor event has no tenant until its customer id is resolved server-side. Authentication is the Stripe-Signature signature over the RAW request body, verified inside the processor's own tolerance window. It is fail-closed on configuration — with no signing secret configured every event is rejected, and there is no value that means accept anything. Delivery is idempotent by the processor's event id: a redelivery of an event already applied returns a quiet 200 and changes nothing, an event still being applied elsewhere returns 503 so the processor retries, and an event id reused with a DIFFERENT body is a 409 rather than an acknowledgement. A processing failure returns 5xx and never records the event as applied, so the processor's retry reclaims it. Errors use the RFC 9457 application/problem+json contract and never echo the signature, the secret or the body."
9363
+ description: "Receives a signed billing event from the payment processor and applies it to the workspace's commercial state. This route carries NO operator JWT and no tenant identifier of any kind: a processor event has no tenant until its customer id is resolved server-side. Authentication is the Stripe-Signature signature over the RAW request body, verified inside the processor's own tolerance window. It is fail-closed on configuration — with no signing secret configured every event is rejected, and there is no value that means accept anything. Delivery is idempotent by the processor's event id: a redelivery of an event already applied returns a quiet 200 and changes nothing, an event still being applied elsewhere returns 503 so the processor retries, and an event id reused with a DIFFERENT body is a 409 rather than an acknowledgement. A processing failure returns 5xx and never records the event as applied, so the processor's retry reclaims it. Errors use the RFC 9457 application/problem+json contract and never echo the signature, the secret or the body. The divergent-replay conflict carries its own product code, 409 MTCH-0811."
9364
9364
  operationId: receiveBillingWebhook
9365
9365
  parameters:
9366
9366
  - description: The processor's signature over the raw body, verified inside the processor's own tolerance window.
@@ -17042,7 +17042,7 @@ paths:
17042
17042
  - Onboarding
17043
17043
  /v1/signup/verify:
17044
17044
  post:
17045
- description: "Completes email verification and starts self-service onboarding. This is a PUBLIC, anonymous, pre-tenant route: it exchanges the emailed verification token for a workspace whose setup is now under way, and returns the workspace handle. It does NOT wait for setup to finish — creating the environment includes a schema migration whose duration the server does not control, so a background worker drives it to completion and the response comes back immediately. It is idempotent: a repeat call records nothing new, and a token that no longer resolves (already used or expired) returns the same 200 response. The route is rate-limited per client IP."
17045
+ description: "Completes email verification and starts self-service onboarding. This is a PUBLIC, anonymous, pre-tenant route: it exchanges the emailed verification token for a workspace whose setup is now under way, and returns the workspace handle. It does NOT wait for setup to finish — creating the environment includes a schema migration whose duration the server does not control, so a background worker drives it to completion and the response comes back immediately. It is idempotent: a repeat call records nothing new, and a token that no longer resolves (already used or expired) returns the same 200 response. The route is rate-limited per client IP. Its two conflicts carry their own product codes, and they are not the same answer: 409 MTCH-0812 (the workspace already exists and MAY be the caller's own — sign in, or sign up under another company name) and 409 MTCH-0813 (the name belongs to another account — only a different company name clears it)."
17046
17046
  operationId: signup-verify
17047
17047
  requestBody:
17048
17048
  content:
@@ -17091,7 +17091,7 @@ paths:
17091
17091
  - Onboarding
17092
17092
  /v1/workspace/billing-portal:
17093
17093
  post:
17094
- description: Opens the payment processor's hosted customer portal for the AUTHENTICATED tenant's own workspace and returns the URL to redirect the browser to. Card update, invoice history and cancellation live there, not here; cancellation takes effect at the end of the period already paid for. Errors use the RFC 9457 application/problem+json contract.
17094
+ description: "Opens the payment processor's hosted customer portal for the AUTHENTICATED tenant's own workspace and returns the URL to redirect the browser to. Card update, invoice history and cancellation live there, not here; cancellation takes effect at the end of the period already paid for. Errors use the RFC 9457 application/problem+json contract. Its two refusals carry their own product codes: 409 MTCH-0806 (plan set by contract, so there is no self-serve subscription to manage) and 409 MTCH-0810 (no billing account yet — subscribe first)."
17095
17095
  operationId: workspace-billing-portal
17096
17096
  responses:
17097
17097
  "200":
@@ -17113,7 +17113,7 @@ paths:
17113
17113
  - Onboarding
17114
17114
  /v1/workspace/checkout:
17115
17115
  post:
17116
- description: "Opens a hosted checkout session that subscribes the AUTHENTICATED tenant's own workspace to a self-serve plan, and returns the URL to redirect the browser to. The workspace is resolved from the JWT tenant-slug claim: this endpoint never accepts a tenant identifier in the body, path, query or headers, and the session is bound to the caller's tenant. The billing interval selects the payment methods — monthly is card, annual is boleto and Pix — so a session is never created with an instrument the amount cannot clear. A plan that is not self-serve, an unknown plan or interval, and a workspace that already has a subscription are all refused before the processor is called. The return URLs carry no activation-bearing parameter: the plan is activated only by the verified webhook, and the return page reads the resulting state from GET /v1/workspace/billing. Errors use the RFC 9457 application/problem+json contract."
17116
+ description: "Opens a hosted checkout session that subscribes the AUTHENTICATED tenant's own workspace to a self-serve plan, and returns the URL to redirect the browser to. The workspace is resolved from the JWT tenant-slug claim: this endpoint never accepts a tenant identifier in the body, path, query or headers, and the session is bound to the caller's tenant. The billing interval selects the payment methods — monthly is card, annual is boleto and Pix — so a session is never created with an instrument the amount cannot clear. A plan that is not self-serve, an unknown plan or interval, and a workspace that already has a subscription are all refused before the processor is called. The return URLs carry no activation-bearing parameter: the plan is activated only by the verified webhook, and the return page reads the resulting state from GET /v1/workspace/billing. Errors use the RFC 9457 application/problem+json contract. Each refusal carries its own product code so a client never has to read the sentence: 409 MTCH-0806 (plan set by contract), 409 MTCH-0807 (already subscribed), 409 MTCH-0808 (a checkout is open for a different plan or interval), 409 MTCH-0809 (a checkout is being opened right now — retry), 422 MTCH-0814 (the plan is not sold self-serve) and 400 MTCH-0001 (unknown plan or interval)."
17117
17117
  operationId: workspace-checkout
17118
17118
  requestBody:
17119
17119
  content:
@@ -17163,7 +17163,7 @@ paths:
17163
17163
  - Onboarding
17164
17164
  /v1/workspace/credit-purchase:
17165
17165
  post:
17166
- description: "Opens a ONE-OFF hosted payment session that buys prepaid overage credit for the AUTHENTICATED tenant's own workspace, and returns the URL to redirect the browser to. It is never a subscription. The workspace is resolved from the JWT tenant-slug claim: this endpoint never accepts a tenant identifier in the body, path, query or headers. Any workspace on a self-serve plan may buy — trialing, lapsed, monthly or annual — because the customer who has run out of allowance is the one being told to buy. A workspace on a CONTRACTUAL plan is refused with 409: its volume is not metered, so prepaid overage credit buys it nothing. Payment is by CARD on every plan, including annual: the instrument that funds overage credit is deliberately not the subscription's instrument, and the card is saved for future CREDIT purchases only. An amount outside the price list's minimum and maximum is refused before the processor is called. The credit balance moves ONLY when the processor confirms the payment through the verified webhook — never on the return page and never in this response. Errors use the RFC 9457 application/problem+json contract."
17166
+ description: "Opens a ONE-OFF hosted payment session that buys prepaid overage credit for the AUTHENTICATED tenant's own workspace, and returns the URL to redirect the browser to. It is never a subscription. The workspace is resolved from the JWT tenant-slug claim: this endpoint never accepts a tenant identifier in the body, path, query or headers. Any workspace on a self-serve plan may buy — trialing, lapsed, monthly or annual — because the customer who has run out of allowance is the one being told to buy. A workspace on a CONTRACTUAL plan is refused with 409: its volume is not metered, so prepaid overage credit buys it nothing. Payment is by CARD on every plan, including annual: the instrument that funds overage credit is deliberately not the subscription's instrument, and the card is saved for future CREDIT purchases only. An amount outside the price list's minimum and maximum is refused before the processor is called. The credit balance moves ONLY when the processor confirms the payment through the verified webhook — never on the return page and never in this response. Errors use the RFC 9457 application/problem+json contract. Its two refusals carry their own product codes: 422 MTCH-0815 (the amount is outside the purchasable range) and 409 MTCH-0806 (plan set by contract, so volume is not metered and credit buys nothing)."
17167
17167
  operationId: workspace-credit-purchase
17168
17168
  requestBody:
17169
17169
  content:
@@ -85,7 +85,21 @@ export function registerWorkspaceUsageTool(server) {
85
85
  'incurred that the credit did not cover — what the workspace OWES). ' +
86
86
  'The second is a receivable, not a negative balance: a new billing ' +
87
87
  'period does not clear it, so never tell a customer a rollover settled ' +
88
- 'it, and never report it as a credit.',
88
+ 'it, and never report it as a credit. ' +
89
+ 'When a commercial ACTION on this workspace is refused, the refusal ' +
90
+ 'carries a code from onboarding\'s own MTCH-08xx family and the code is ' +
91
+ 'the answer, not the sentence: 0801 no payment processor is configured ' +
92
+ '(retrying never clears it) vs 0802 the processor could not be asked ' +
93
+ '(retry) — both arrive as a 503 whose detail is scrubbed to "internal ' +
94
+ 'error"; 0803 a subscription the processor can still bill; 0804 only ' +
95
+ 'the enterprise plan is operator-assigned; 0805 the billing status ' +
96
+ 'forbids the change; 0806 the plan is set by contract, so nothing ' +
97
+ 'self-serve applies; 0807 already subscribed; 0808 a checkout is open ' +
98
+ 'for a different plan or interval; 0809 a checkout is being opened ' +
99
+ 'right now; 0810 no billing account yet; 0811 a billing event id was ' +
100
+ 'replayed with different content; 0812 the workspace exists and may be ' +
101
+ 'the caller\'s own; 0813 the name belongs to another account; 0814 the ' +
102
+ 'plan is not sold self-serve; 0815 the credit amount is out of range.',
89
103
  }, async (extra) => dispatchToolRequest({ method: 'GET', path: WORKSPACE_BILLING_PATH }, extra, undefined,
90
104
  // Spread, don't rebuild: the backend's fields are relayed unchanged and
91
105
  // the derived percent is purely additive.
@@ -1 +1 @@
1
- {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/tools/workspace/usage.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4DAA4D;AAC5D,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,8EAA8E;AAC9E,2EAA2E;AAC3E,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,iFAAiF;AACjF,6EAA6E;AAC7E,2DAA2D;AAC3D,EAAE;AACF,iFAAiF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,IAAI,CAAC,GAAG,EAAE,CAAA;AAClE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAiB;IAC1D,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,WAAW,EACT,gEAAgE;YAChE,sEAAsE;YACtE,iEAAiE;YACjE,kEAAkE;YAClE,uEAAuE;YACvE,0DAA0D;YAC1D,wEAAwE;YACxE,uEAAuE;YACvE,yEAAyE;YACzE,uEAAuE;YACvE,oEAAoE;YACpE,yEAAyE;YACzE,iBAAiB;YACjB,wEAAwE;YACxE,sEAAsE;YACtE,sEAAsE;YACtE,kEAAkE;YAClE,yEAAyE;YACzE,gEAAgE;YAChE,sEAAsE;YACtE,mEAAmE;YACnE,mEAAmE;YACnE,qEAAqE;YACrE,oEAAoE;YACpE,wEAAwE;YACxE,uCAAuC;YACvC,qEAAqE;YACrE,yEAAyE;YACzE,wEAAwE;YACxE,sEAAsE;YACtE,uEAAuE;YACvE,sEAAsE;YACtE,oEAAoE;YACpE,mEAAmE;YACnE,uEAAuE;YACvE,oEAAoE;YACpE,sEAAsE;YACtE,wEAAwE;YACxE,wEAAwE;YACxE,sEAAsE;KACzE,EACD,KAAK,EAAE,KAAK,EAAE,EAAE,CACd,mBAAmB,CACjB,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAE,EAC/C,KAAK,EACL,SAAS;IACT,wEAAwE;IACxE,0CAA0C;IAC1C,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACZ,GAAI,OAA4C;QAChD,WAAW,EAAE,WAAW,CAAC,OAA2C,CAAC;KACtE,CAAC,CACH,CACJ,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lerianstudio/matcher-mcp",
3
- "version": "5.0.0-beta.90",
3
+ "version": "5.0.0-beta.92",
4
4
  "type": "module",
5
5
  "description": "Model Context Protocol server for the Matcher reconciliation engine",
6
6
  "license": "Apache-2.0",