crypto-quant-signal-mcp 1.26.0 → 1.27.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/README.md +21 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +135 -12
- package/dist/index.js.map +1 -1
- package/dist/lib/call-class.d.ts +28 -3
- package/dist/lib/call-class.d.ts.map +1 -1
- package/dist/lib/call-class.js +84 -16
- package/dist/lib/call-class.js.map +1 -1
- package/dist/lib/contact-page.d.ts.map +1 -1
- package/dist/lib/contact-page.js +12 -2
- package/dist/lib/contact-page.js.map +1 -1
- package/dist/lib/contact-submit.d.ts +27 -1
- package/dist/lib/contact-submit.d.ts.map +1 -1
- package/dist/lib/contact-submit.js +51 -5
- package/dist/lib/contact-submit.js.map +1 -1
- package/dist/lib/email.d.ts.map +1 -1
- package/dist/lib/email.js +16 -5
- package/dist/lib/email.js.map +1 -1
- package/dist/lib/equities/equity-tool-formatters.d.ts.map +1 -1
- package/dist/lib/equities/equity-tool-formatters.js +25 -10
- package/dist/lib/equities/equity-tool-formatters.js.map +1 -1
- package/dist/lib/errors.d.ts +35 -1
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +38 -4
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/feature-registry.d.ts +6 -3
- package/dist/lib/feature-registry.d.ts.map +1 -1
- package/dist/lib/feature-registry.js +8 -3
- package/dist/lib/feature-registry.js.map +1 -1
- package/dist/lib/footer-content.d.ts +35 -4
- package/dist/lib/footer-content.d.ts.map +1 -1
- package/dist/lib/footer-content.js +37 -8
- package/dist/lib/footer-content.js.map +1 -1
- package/dist/lib/funding-window.d.ts +20 -0
- package/dist/lib/funding-window.d.ts.map +1 -0
- package/dist/lib/funding-window.js +23 -0
- package/dist/lib/funding-window.js.map +1 -0
- package/dist/lib/funnel-scoreboard.d.ts +69 -2
- package/dist/lib/funnel-scoreboard.d.ts.map +1 -1
- package/dist/lib/funnel-scoreboard.js +104 -6
- package/dist/lib/funnel-scoreboard.js.map +1 -1
- package/dist/lib/integrations-data/mcp-clients.js +1 -1
- package/dist/lib/integrations-data/mcp-clients.js.map +1 -1
- package/dist/lib/landing-content.d.ts.map +1 -1
- package/dist/lib/landing-content.js +6 -2
- package/dist/lib/landing-content.js.map +1 -1
- package/dist/lib/license.d.ts +69 -9
- package/dist/lib/license.d.ts.map +1 -1
- package/dist/lib/license.js +263 -25
- package/dist/lib/license.js.map +1 -1
- package/dist/lib/nudge-copy.d.ts +1 -1
- package/dist/lib/nudge-copy.js +2 -2
- package/dist/lib/nudge-copy.js.map +1 -1
- package/dist/lib/performance-db.d.ts.map +1 -1
- package/dist/lib/performance-db.js +9 -5
- package/dist/lib/performance-db.js.map +1 -1
- package/dist/lib/plans.d.ts +169 -20
- package/dist/lib/plans.d.ts.map +1 -1
- package/dist/lib/plans.js +231 -46
- package/dist/lib/plans.js.map +1 -1
- package/dist/lib/quota-notice.d.ts +29 -1
- package/dist/lib/quota-notice.d.ts.map +1 -1
- package/dist/lib/quota-notice.js +47 -6
- package/dist/lib/quota-notice.js.map +1 -1
- package/dist/lib/receipts.d.ts +87 -1
- package/dist/lib/receipts.d.ts.map +1 -1
- package/dist/lib/receipts.js +62 -9
- package/dist/lib/receipts.js.map +1 -1
- package/dist/lib/referral-pages.d.ts.map +1 -1
- package/dist/lib/referral-pages.js +4 -2
- package/dist/lib/referral-pages.js.map +1 -1
- package/dist/lib/signup-flow.d.ts +0 -2
- package/dist/lib/signup-flow.d.ts.map +1 -1
- package/dist/lib/signup-flow.js +44 -26
- package/dist/lib/signup-flow.js.map +1 -1
- package/dist/lib/stripe.d.ts +82 -2
- package/dist/lib/stripe.d.ts.map +1 -1
- package/dist/lib/stripe.js +177 -21
- package/dist/lib/stripe.js.map +1 -1
- package/dist/lib/subscriber-attribution.d.ts +168 -0
- package/dist/lib/subscriber-attribution.d.ts.map +1 -1
- package/dist/lib/subscriber-attribution.js +275 -4
- package/dist/lib/subscriber-attribution.js.map +1 -1
- package/dist/lib/trade-call-scanner.d.ts +1 -1
- package/dist/lib/trade-call-scanner.d.ts.map +1 -1
- package/dist/lib/utc-day.d.ts +45 -0
- package/dist/lib/utc-day.d.ts.map +1 -0
- package/dist/lib/utc-day.js +58 -0
- package/dist/lib/utc-day.js.map +1 -0
- package/dist/lib/verdict-factors.d.ts +383 -0
- package/dist/lib/verdict-factors.d.ts.map +1 -0
- package/dist/lib/verdict-factors.js +846 -0
- package/dist/lib/verdict-factors.js.map +1 -0
- package/dist/lib/webhook-delivery.d.ts.map +1 -1
- package/dist/lib/webhook-delivery.js +14 -5
- package/dist/lib/webhook-delivery.js.map +1 -1
- package/dist/lib/welcome-page.d.ts.map +1 -1
- package/dist/lib/welcome-page.js +29 -15
- package/dist/lib/welcome-page.js.map +1 -1
- package/dist/lib/x402-http-routes.d.ts +8 -1
- package/dist/lib/x402-http-routes.d.ts.map +1 -1
- package/dist/lib/x402-http-routes.js +17 -5
- package/dist/lib/x402-http-routes.js.map +1 -1
- package/dist/scripts/closedbar-recalibrate-readiness.d.ts +103 -0
- package/dist/scripts/closedbar-recalibrate-readiness.d.ts.map +1 -0
- package/dist/scripts/closedbar-recalibrate-readiness.js +438 -0
- package/dist/scripts/closedbar-recalibrate-readiness.js.map +1 -0
- package/dist/tools/get-market-regime.d.ts.map +1 -1
- package/dist/tools/get-market-regime.js +6 -0
- package/dist/tools/get-market-regime.js.map +1 -1
- package/dist/tools/get-trade-call.d.ts.map +1 -1
- package/dist/tools/get-trade-call.js +160 -53
- package/dist/tools/get-trade-call.js.map +1 -1
- package/dist/tools/scan-funding-arb.d.ts.map +1 -1
- package/dist/tools/scan-funding-arb.js +6 -0
- package/dist/tools/scan-funding-arb.js.map +1 -1
- package/dist/tools/scan-trade-calls.d.ts.map +1 -1
- package/dist/tools/scan-trade-calls.js +8 -4
- package/dist/tools/scan-trade-calls.js.map +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
|
-
<span data-tr-field="pfe_wr">91.8%</span> PFE win rate across <span data-tr-field="total_calls">
|
|
14
|
+
<span data-tr-field="pfe_wr">91.8%</span> PFE win rate across <span data-tr-field="total_calls">459,396</span>+ verified calls. Merkle-verified on Base L2. Don't trust — verify. <!-- SNAPSHOT-LINE -->
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
17
|
<p align="center">
|
|
18
|
-
<strong>
|
|
18
|
+
<strong>200 free calls/month, 100/day. Start in 30 seconds.</strong>
|
|
19
19
|
</p>
|
|
20
20
|
|
|
21
21
|
<p align="center">
|
|
@@ -94,7 +94,7 @@ Under the hood, a self-tuning model fuses momentum, trend structure, derivatives
|
|
|
94
94
|
{ "coin": "SOL", "timeframe": "15m", "confidence": 73 }
|
|
95
95
|
],
|
|
96
96
|
"_algovault": {
|
|
97
|
-
"version": "1.
|
|
97
|
+
"version": "1.27.0",
|
|
98
98
|
"tool": "get_trade_call",
|
|
99
99
|
"compatible_with": ["crypto-quant-risk-mcp", "crypto-quant-backtest-mcp"]
|
|
100
100
|
}
|
|
@@ -112,7 +112,7 @@ The `_algovault` block makes outputs composable: downstream risk and backtest to
|
|
|
112
112
|
scripts/snapshot-landing-data.mjs at npm-publish + Hetzner-deploy. Do NOT hand-edit the
|
|
113
113
|
numbers; edit "What's new" by hand. Wired by OPS-NPM-README-SINGLE-SOT-W1 (2026-05-31). -->
|
|
114
114
|
<p align="center">
|
|
115
|
-
<strong><span data-tr-field="pfe_wr">91.8%</span> PFE Win Rate</strong> · <strong><span data-tr-field="total_calls">
|
|
115
|
+
<strong><span data-tr-field="pfe_wr">91.8%</span> PFE Win Rate</strong> · <strong><span data-tr-field="total_calls">459,396</span> trade calls</strong> · <strong><span data-tr-field="merkle_batches">122</span> on-chain batches</strong> · <strong><span data-tr-field="hold_rate">99.2%</span> HOLD rate</strong> <!-- SNAPSHOT-LINE -->
|
|
116
116
|
</p>
|
|
117
117
|
|
|
118
118
|
<p align="center">
|
|
@@ -231,28 +231,37 @@ Single-prompt wrappers over 1–3 tool calls — regime gating, multi-timeframe
|
|
|
231
231
|
|
|
232
232
|
Quota-only tiers. Every tier gets all venues, all assets, all timeframes — you pay for call volume, nothing else.
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
Two meters per paid tier, monthly and daily, enforced independently: a call is refused when either is exhausted, and the daily window is a UTC calendar day resetting at 00:00 UTC. Every successful verdict counts against them, HOLD included — knowing when *not* to trade is the other half of the product, and it costs the same to compute.
|
|
235
|
+
|
|
236
|
+
| Feature | Free | Starter ($9.99/mo · $39.90/6mo) | Pro ($49/mo · $129/6mo) | Enterprise (contact us) | x402 (per call) |
|
|
235
237
|
|---------|------|-------------------|-------------|---------------------|-----------------|
|
|
236
238
|
| Exchanges | All 15 | All 15 | All 15 | All 15 | All 15 | <!-- SNAPSHOT-LINE-TABLE -->
|
|
237
|
-
| Assets | All
|
|
239
|
+
| Assets | All 1560+ | All 1560+ | All 1560+ | All 1560+ | All 1560+ | <!-- SNAPSHOT-LINE-TABLE -->
|
|
238
240
|
| Asset classes | Crypto + TradFi | Crypto + TradFi | Crypto + TradFi | Crypto + TradFi | Crypto + TradFi |
|
|
239
241
|
| Timeframes | All 11 | All 11 | All 11 | All 11 | All 11 |
|
|
240
242
|
| Funding arb results | Top 5 | Unlimited | Unlimited | Unlimited | Unlimited |
|
|
241
243
|
| Track record | Full access | Full access | Full access | Full access | Full access |
|
|
242
|
-
| Monthly calls |
|
|
243
|
-
|
|
|
244
|
-
| Price | $0 | $9.99/mo | $49/mo
|
|
244
|
+
| Monthly calls | 200/mo | 10,000/mo | 100,000/mo | Custom volume — contact us | Unlimited |
|
|
245
|
+
| Daily calls | 100/day | 1,000/day | 10,000/day | Custom volume — contact us | Unlimited |
|
|
246
|
+
| Price | $0 | $9.99/mo or $39.90/6mo | $49/mo or $129/6mo | Contact us | $0.01–0.05/call |
|
|
245
247
|
|
|
246
248
|
|
|
247
|
-
**Subscriptions:** Sign up at [api.algovault.com/signup](https://api.algovault.com/signup). Starter ($9.99/mo
|
|
249
|
+
**Subscriptions:** Sign up at [api.algovault.com/signup](https://api.algovault.com/signup). Starter unlocks 10,000 calls/mo (up to 1,000/day) for $9.99/mo, or $39.90 for six months prepaid — add `?interval=6month` to pick the prepay term. API key delivered instantly after checkout.
|
|
248
250
|
|
|
249
251
|
**x402 micropayments:** AI agents pay per HTTP call with USDC on [Base](https://www.base.org) — no signup, no API key, no billing. The payment receipt is the credential. See [x402.org](https://x402.org).
|
|
250
252
|
|
|
251
253
|
---
|
|
252
254
|
|
|
253
|
-
## What's new in v1.
|
|
255
|
+
## What's new in v1.27.0
|
|
256
|
+
|
|
257
|
+
- **🧮 Every verdict counts.** Your allowance covers every call the engine answers, on both the MCP and HTTP rails.
|
|
258
|
+
- **📶 A new call ladder.** Free: 200/month plus 100/day. Starter: 10,000/month plus 1,000/day. Pro: 100,000/month plus 10,000/day.
|
|
259
|
+
- **💳 6-month prepay replaces annual.** Starter is **$39.90** (~$6.65/mo, 33% off monthly) and Pro is **$129** (~$21.50/mo, 56% off monthly). Pick it at [signup](https://api.algovault.com/signup) with `?interval=6month`. Enterprise remains contact-us.
|
|
260
|
+
- **⏱️ Daily limits say when they reset.** Hit a daily cap and the refusal tells you the hours remaining, not a monthly figure.
|
|
254
261
|
|
|
255
|
-
|
|
262
|
+
### v1.26.0 highlights (recap)
|
|
263
|
+
|
|
264
|
+
- **💳 Annual plans — prepay a year, save up to 49%.** Starter was **$79/yr** (~$6.58/mo) and Pro was **$299/yr** (~$24.92/mo). **Superseded: annual was retired on 2026-08-09 and replaced by 6-month prepay (see v1.27.0); `?interval=year` now redirects to the 6-month checkout, so existing links still work.**
|
|
256
265
|
|
|
257
266
|
### v1.25.0 highlights (recap)
|
|
258
267
|
|
|
@@ -263,10 +272,6 @@ Quota-only tiers. Every tier gets all venues, all assets, all timeframes — you
|
|
|
263
272
|
|
|
264
273
|
> New optional parameter — MCP clients cache `tools/list` at session start. Toggle the connector off/on (or restart the MCP connection) to see `minLiquidityUsd`.
|
|
265
274
|
|
|
266
|
-
### v1.24.0 highlights (recap)
|
|
267
|
-
|
|
268
|
-
- **🌐 Three new exchanges: WhiteBIT, BitMart, XT.** AlgoVault's signal engine spans more perpetual-futures venues. Point any tool at the new venues via the `exchange` parameter.
|
|
269
|
-
- **🔌 New venue integration pages.** Per-venue connect guides at [algovault.com/integrations](https://algovault.com/integrations).
|
|
270
275
|
|
|
271
276
|
> **Refresh your MCP client to pick up this release.** MCP clients cache `tools/list` at session start — Claude.ai/Desktop: toggle the connector off+on; Cursor/Cline: restart the MCP server connection.
|
|
272
277
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,SAAS,EAAuC,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,SAAS,EAAuC,MAAM,yCAAyC,CAAC;AAiTzG;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,MAAM,EAAE,MAAM,GACb,MAAM,CAOR;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,OAAO,SAAS,EAAE,OAAO,EAC9B,GAAG,EAAE,OAAO,SAAS,EAAE,QAAQ,EAC/B,UAAU,EAAE,MAAM,SAAS,GAC1B,OAAO,CAAC,IAAI,CAAC,CAYf;AA85ID,wBAAgB,mBAAmB,cAElC"}
|
package/dist/index.js
CHANGED
|
@@ -372,8 +372,6 @@ function createServer() {
|
|
|
372
372
|
// contract-correct engine. Quota is handled inside whichever engine runs.
|
|
373
373
|
const { route, result } = await (0, upstream_weight_budget_js_1.runAsCaller)(toolNameForAnalytics, () => (0, trade_call_router_js_1.routeTradeCall)({ coin, timeframe, includeReasoning, exchange, assetClass, license }));
|
|
374
374
|
const verdict = result.call;
|
|
375
|
-
// Verdict stored for x402 settlement skip (HOLDs / error paths don't settle).
|
|
376
|
-
(0, license_js_1.setRequestVerdict)(verdict ?? 'HOLD');
|
|
377
375
|
(0, analytics_js_1.logRequest)({
|
|
378
376
|
sessionId: (0, license_js_1.getRequestSessionId)(),
|
|
379
377
|
toolName: toolNameForAnalytics,
|
|
@@ -1008,7 +1006,15 @@ async function startHttp() {
|
|
|
1008
1006
|
// Fire-and-forget so a Stripe API hiccup never delays server boot.
|
|
1009
1007
|
void import('./lib/referral-accrual.js').then((m) => m.ensureReferralWebhookEvents()).catch(() => { });
|
|
1010
1008
|
const { default: express } = await import('express');
|
|
1011
|
-
const { default: rateLimit } = await import('express-rate-limit');
|
|
1009
|
+
const { default: rateLimit, ipKeyGenerator } = await import('express-rate-limit');
|
|
1010
|
+
// CH4 per-key burst guard: same Bearer extraction as webhook-api.ts#apiKeyOf. Kept local
|
|
1011
|
+
// rather than exported from there — that module owns webhook routing, not MCP transport.
|
|
1012
|
+
const bearerKeyOf = (req) => {
|
|
1013
|
+
const auth = req.headers.authorization;
|
|
1014
|
+
if (typeof auth === 'string' && auth.startsWith('Bearer '))
|
|
1015
|
+
return auth.slice(7).trim() || null;
|
|
1016
|
+
return null;
|
|
1017
|
+
};
|
|
1012
1018
|
const app = express();
|
|
1013
1019
|
app.set('trust proxy', 1); // Trust Caddy reverse proxy for req.secure, req.ip
|
|
1014
1020
|
const port = parseInt(process.env.PORT || '3000', 10);
|
|
@@ -1034,9 +1040,38 @@ async function startHttp() {
|
|
|
1034
1040
|
res.setHeader('Referrer-Policy', 'strict-origin-when-cross-origin');
|
|
1035
1041
|
// 'unsafe-inline' mirrors the Caddy policy: the function-rendered pages emit
|
|
1036
1042
|
// inline <script> hydration and inline style="" attributes.
|
|
1043
|
+
//
|
|
1044
|
+
// DESIGN-ACCOUNT-THEME-TOKENS-W1 — style-src allows https://algovault.com.
|
|
1045
|
+
//
|
|
1046
|
+
// WHY: /account and /track-record link the canonical design loader
|
|
1047
|
+
// (https://algovault.com/_design/algovault-design.css), which is where the brand
|
|
1048
|
+
// design TOKENS live (:root{--bg,--fg,--fg-2,--fg-3,--line,--mint,--accent,--font-*}).
|
|
1049
|
+
// On the APEX that URL is 'self' and resolves. On api.algovault.com it is CROSS-ORIGIN,
|
|
1050
|
+
// this policy refused it, and every token fell back to nothing — so `background: var(--bg)`
|
|
1051
|
+
// painted the browser default WHITE and `color: var(--fg-3)` painted near-black tab labels
|
|
1052
|
+
// on a hardcoded dark bar. Identical page, correct on apex, broken on api: origin-dependent.
|
|
1053
|
+
//
|
|
1054
|
+
// Exact origin, never a wildcard. The alternative — inlining a :root block per page — would
|
|
1055
|
+
// put the brand palette in a 5th place and mask this fault while /track-record stayed broken.
|
|
1056
|
+
//
|
|
1057
|
+
// HONEST COST, recorded rather than discovered later: this makes api-host pages carry a
|
|
1058
|
+
// CROSS-HOST RUNTIME DEPENDENCY on the apex. If Caddy is down or the apex cert lapses while
|
|
1059
|
+
// Node is up, every api page renders unstyled. Both hosts are the same box, so they mostly
|
|
1060
|
+
// fail together — but not always, and the apex cert renews on its own schedule. The real end
|
|
1061
|
+
// state is serving this stylesheet same-origin from the api host too; that needs a Dockerfile
|
|
1062
|
+
// + deploy.yml change (api/_design/… is 404 today, the file is not in the runtime image), so
|
|
1063
|
+
// it is deliberately NOT bundled here → OPS-DESIGN-CSS-SAME-ORIGIN-W{NEXT}.
|
|
1064
|
+
//
|
|
1065
|
+
// SCOPE: this is GLOBAL middleware (one setter, no per-route override), so the widening
|
|
1066
|
+
// applies to every Express route including /mcp — harmless for style-src, since JSON
|
|
1067
|
+
// endpoints load no stylesheets, but stated so it is not a surprise in a later audit.
|
|
1068
|
+
// The Caddyfile twin is deliberately NOT widened: the pages it covers are served from the
|
|
1069
|
+
// apex and are same-origin with the stylesheet, so 'self' already permits it. Leaving Caddy
|
|
1070
|
+
// stricter is safe — the keep-in-sync warning above guards against pages being left
|
|
1071
|
+
// UNCOVERED, not against Caddy being tighter than Express.
|
|
1037
1072
|
res.setHeader('Content-Security-Policy', "default-src 'self'; " +
|
|
1038
1073
|
"script-src 'self' 'unsafe-inline' https://cdn.tailwindcss.com; " +
|
|
1039
|
-
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; " +
|
|
1074
|
+
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://algovault.com; " +
|
|
1040
1075
|
"font-src 'self' https://fonts.gstatic.com data:; " +
|
|
1041
1076
|
"img-src 'self' data: https:; " +
|
|
1042
1077
|
"connect-src 'self' https://api.algovault.com https://plausible.algovault.com; " +
|
|
@@ -1045,6 +1080,45 @@ async function startHttp() {
|
|
|
1045
1080
|
});
|
|
1046
1081
|
// Rate limiting
|
|
1047
1082
|
app.use('/mcp', rateLimit({ windowMs: 60_000, max: 120, standardHeaders: true, legacyHeaders: false }));
|
|
1083
|
+
// ── Ops-only per-KEY burst guard (PRICING-FLAT-CALL-BILLING-AND-6MONTH-W1 CH4) ──
|
|
1084
|
+
//
|
|
1085
|
+
// NOT MARKETED and deliberately carries no TIER_CLAIM: this protects the upstream venues, it
|
|
1086
|
+
// is not part of the product's advertised ladder. Its job is narrow — stop a 10,000-call/day
|
|
1087
|
+
// Pro from spending its whole daily budget in sixty seconds and taking the venue rate limits
|
|
1088
|
+
// with it. The daily meter caps the DAY; nothing capped the MINUTE.
|
|
1089
|
+
//
|
|
1090
|
+
// WHY PER-KEY, GIVEN /mcp IS ALREADY 120/min. That limiter keys on IP, so it does not bind a
|
|
1091
|
+
// key driven from several hosts — which is exactly the scripted/agent shape this guards.
|
|
1092
|
+
//
|
|
1093
|
+
// CALIBRATION — measured, not guessed (CH1 follow-up query, request_log, 30d):
|
|
1094
|
+
// external per-(key,minute): p50 1 · p95 11 · p99 18 · MAX 22 (n = 10,930 minutes)
|
|
1095
|
+
// paid tiers only (90d): p50 1 · p95 8 · p99 9 · MAX 17 (n = 926 minutes)
|
|
1096
|
+
// The spec asked for "the measured p95 legitimate burst". p95 is 11 — and a REFUSAL threshold
|
|
1097
|
+
// set at p95 refuses 5% of legitimate minutes by construction. p95 is a typical-load
|
|
1098
|
+
// statistic, not a headroom one. The cap is therefore set from the observed MAX with real
|
|
1099
|
+
// headroom: 120/min is 5.5x the busiest legitimate minute ever recorded and 11x p95, while
|
|
1100
|
+
// still cutting a runaway from 10,000/min to 120. It also matches the existing per-IP number,
|
|
1101
|
+
// so a single key behind a single IP sees no new constraint at all.
|
|
1102
|
+
//
|
|
1103
|
+
// `internal` is exempt: the TG bot measured p95 13/min and MAX 33/min, and it enforces its own
|
|
1104
|
+
// per-user quota in its own SQLite (see getMonthlyQuota / getDailyCap).
|
|
1105
|
+
const MCP_PER_KEY_BURST_PER_MIN = 120;
|
|
1106
|
+
app.use('/mcp', rateLimit({
|
|
1107
|
+
windowMs: 60_000,
|
|
1108
|
+
max: MCP_PER_KEY_BURST_PER_MIN,
|
|
1109
|
+
standardHeaders: true,
|
|
1110
|
+
legacyHeaders: false,
|
|
1111
|
+
// Only callers presenting a key are governed here; keyless traffic is already covered by
|
|
1112
|
+
// the per-IP limiter above, and collapsing it all onto one bucket would throttle unrelated
|
|
1113
|
+
// callers behind a shared NAT as though they were one abuser.
|
|
1114
|
+
skip: (req) => {
|
|
1115
|
+
const key = bearerKeyOf(req);
|
|
1116
|
+
if (!key)
|
|
1117
|
+
return true; // keyless → per-IP limiter owns it
|
|
1118
|
+
return key === process.env.CQS_API_KEY; // internal/self → exempt
|
|
1119
|
+
},
|
|
1120
|
+
keyGenerator: (req) => bearerKeyOf(req) ?? ipKeyGenerator(req.ip ?? 'unknown'),
|
|
1121
|
+
}));
|
|
1048
1122
|
app.use('/analytics', rateLimit({ windowMs: 60_000, max: 30, standardHeaders: true, legacyHeaders: false }));
|
|
1049
1123
|
app.use('/webhooks', rateLimit({ windowMs: 60_000, max: 20, standardHeaders: true, legacyHeaders: false }));
|
|
1050
1124
|
// OPS-MCP-SESSION-RESILIENCE-W1: the remote MCP transport runs STATELESS by default
|
|
@@ -1336,6 +1410,27 @@ async function startHttp() {
|
|
|
1336
1410
|
await processChargeRefunded(event);
|
|
1337
1411
|
break;
|
|
1338
1412
|
}
|
|
1413
|
+
case 'customer.subscription.updated': {
|
|
1414
|
+
// OPS-STRIPE-SUBSCRIPTION-TRUTH-W2 CH2 — the tier/interval change that never reached
|
|
1415
|
+
// the record. Subscribed on the live endpoint by CH1 (set-compared, 6 events).
|
|
1416
|
+
//
|
|
1417
|
+
// Idempotency BEFORE the side-effect, same shape as the two cases above: Stripe
|
|
1418
|
+
// delivers at-least-once and retries every non-2xx for up to 3 days.
|
|
1419
|
+
const isNewUpd = await (0, stripe_events_store_js_1.tryClaimEvent)({
|
|
1420
|
+
event_id: event.id,
|
|
1421
|
+
event_type: event.type,
|
|
1422
|
+
customer_email: null,
|
|
1423
|
+
metadata: { source: 'customer.subscription.updated' },
|
|
1424
|
+
});
|
|
1425
|
+
if (!isNewUpd) {
|
|
1426
|
+
console.log(`Stripe webhook: duplicate customer.subscription.updated (event ${event.id}) — already processed`);
|
|
1427
|
+
// 200, never 500 — a non-2xx makes Stripe retry harder against an event we have
|
|
1428
|
+
// already fully processed.
|
|
1429
|
+
return res.json({ received: true, status: 'duplicate' });
|
|
1430
|
+
}
|
|
1431
|
+
await (0, stripe_js_1.handleSubscriptionUpdated)(event);
|
|
1432
|
+
break;
|
|
1433
|
+
}
|
|
1339
1434
|
default:
|
|
1340
1435
|
console.log(`Stripe webhook: unhandled event ${event.type}`);
|
|
1341
1436
|
}
|
|
@@ -1472,10 +1567,23 @@ async function startHttp() {
|
|
|
1472
1567
|
}
|
|
1473
1568
|
try {
|
|
1474
1569
|
const baseUrl = `${req.protocol}://${req.get('host')}`;
|
|
1475
|
-
// PRICING-ANNUAL-AND-HOLD-PROMISE-W1:
|
|
1570
|
+
// PRICING-ANNUAL-AND-HOLD-PROMISE-W1: an explicit prepay token selects prepay. Anything
|
|
1476
1571
|
// else — absent, misspelt, hostile — resolves to 'month', so a malformed query can only
|
|
1477
|
-
// ever bill the SMALLER amount. Never infer
|
|
1478
|
-
|
|
1572
|
+
// ever bill the SMALLER amount. Never infer a prepay term from a partial match.
|
|
1573
|
+
//
|
|
1574
|
+
// PRICING-FLAT-CALL-BILLING-AND-6MONTH-W1 (R-C): `?interval=6month` replaces
|
|
1575
|
+
// `?interval=year`. The old token is REDIRECTED rather than silently downgraded to
|
|
1576
|
+
// monthly — external links to `?interval=year` exist (the npm README, dev.to, a GitHub
|
|
1577
|
+
// Discussion and an X thread all shipped it on 2026-08-06), and quietly billing those
|
|
1578
|
+
// callers $9.99/mo when they clicked an annual-prepay link would be the worse failure.
|
|
1579
|
+
// A 302 to the 6-month equivalent keeps the intent (prepay, discounted) and lets the
|
|
1580
|
+
// caller see what they are actually buying before confirming.
|
|
1581
|
+
if (req.query.interval === 'year') {
|
|
1582
|
+
const q = new URLSearchParams(req.query);
|
|
1583
|
+
q.set('interval', '6month');
|
|
1584
|
+
return res.redirect(302, `/signup?${q.toString()}`);
|
|
1585
|
+
}
|
|
1586
|
+
const interval = req.query.interval === '6month' ? '6month' : 'month';
|
|
1479
1587
|
const url = await (0, stripe_js_1.createCheckoutSession)(plan, baseUrl, {
|
|
1480
1588
|
utmSource,
|
|
1481
1589
|
utmCampaign,
|
|
@@ -3371,9 +3479,17 @@ async function startHttp() {
|
|
|
3371
3479
|
res.status(500).json({ error: 'Internal server error' });
|
|
3372
3480
|
}
|
|
3373
3481
|
}
|
|
3374
|
-
// Fire-and-forget: settle x402 payment after response is sent
|
|
3375
|
-
//
|
|
3376
|
-
|
|
3482
|
+
// Fire-and-forget: settle the x402 payment after the response is sent.
|
|
3483
|
+
//
|
|
3484
|
+
// PRICING-FLAT-CALL-BILLING-AND-6MONTH-W1 (R-A): the `getRequestVerdict() !== 'HOLD'`
|
|
3485
|
+
// guard is GONE. It meant the per-call rail was paid only when the model said "trade",
|
|
3486
|
+
// which is a structural incentive against the selectivity that IS the product — the
|
|
3487
|
+
// published hold rate is ~99%, so the rail was collecting on roughly 1 call in 100 while
|
|
3488
|
+
// serving all of them. A verdict is the product on every rail; HOLD is a verdict.
|
|
3489
|
+
//
|
|
3490
|
+
// An ERROR still never settles, and that is unchanged: this line only runs after a
|
|
3491
|
+
// successful response, and every failure path above returns before reaching it.
|
|
3492
|
+
if (pendingSettlement) {
|
|
3377
3493
|
(0, x402_js_1.settleX402Async)(pendingSettlement);
|
|
3378
3494
|
}
|
|
3379
3495
|
});
|
|
@@ -4552,7 +4668,11 @@ function getSignupPageHtml() {
|
|
|
4552
4668
|
<!-- END: AlgoVault canonical design loader -->
|
|
4553
4669
|
<style>
|
|
4554
4670
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
4555
|
-
|
|
4671
|
+
/* Sticky-footer shape (DESIGN-WELCOME-LAYOUT-AND-FOOTER-FLOW-W1). A centering flex ROW here
|
|
4672
|
+
makes the brand footer a flex ITEM beside the card. Fix the container, never the footer.
|
|
4673
|
+
Enforced by scripts/check-footer-body-flow.mjs, whose docblock carries the full rationale. */
|
|
4674
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f1117; color: #e1e4e8; display: flex; flex-direction: column; min-height: 100vh; }
|
|
4675
|
+
.page-main { flex: 1; display: flex; justify-content: center; align-items: center; width: 100%; padding: 24px; }
|
|
4556
4676
|
.container { max-width: 960px; width: 100%; }
|
|
4557
4677
|
h1 { font-size: 28px; margin-bottom: 8px; }
|
|
4558
4678
|
.subtitle { color: #8b949e; margin-bottom: 32px; font-size: 14px; }
|
|
@@ -4564,9 +4684,10 @@ function getSignupPageHtml() {
|
|
|
4564
4684
|
</style>
|
|
4565
4685
|
</head>
|
|
4566
4686
|
<body>
|
|
4687
|
+
<main class="page-main">
|
|
4567
4688
|
<div class="container">
|
|
4568
4689
|
<h1>AlgoVault Subscriptions</h1>
|
|
4569
|
-
<div class="subtitle">Free tier includes all assets and all 11 timeframes — capped at
|
|
4690
|
+
<div class="subtitle">Free tier includes all assets and all 11 timeframes — capped at 200 calls/month and 100 per UTC day. Every verdict counts, HOLD included. Upgrade for higher limits and unlimited funding-arb results.</div>
|
|
4570
4691
|
<div style="display:flex;justify-content:center;gap:12px;margin-bottom:24px;flex-wrap:wrap">
|
|
4571
4692
|
${capabilities_js_1.EXCHANGES.map(e => '<span style="color:#8b949e;font-size:12px;font-weight:600">' + e.label + '</span>').join('<span style="color:#6e7681">·</span>')}
|
|
4572
4693
|
</div>
|
|
@@ -4580,6 +4701,8 @@ function getSignupPageHtml() {
|
|
|
4580
4701
|
<a class="btn" href="https://algovault.com/docs.html#x402" style="background:#1f6feb;white-space:nowrap">Pay per call with x402 →</a>
|
|
4581
4702
|
</div>
|
|
4582
4703
|
</div>
|
|
4704
|
+
</main>
|
|
4705
|
+
${(0, footer_content_js_1.renderBrandFooter)('desktop')}
|
|
4583
4706
|
</body>
|
|
4584
4707
|
</html>`;
|
|
4585
4708
|
}
|