crypto-quant-signal-mcp 1.21.0 → 1.22.1

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.
Files changed (120) hide show
  1. package/README.md +17 -37
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +101 -37
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/capabilities.d.ts.map +1 -1
  6. package/dist/lib/capabilities.js +13 -0
  7. package/dist/lib/capabilities.js.map +1 -1
  8. package/dist/lib/exchange-universe.d.ts +5 -0
  9. package/dist/lib/exchange-universe.d.ts.map +1 -1
  10. package/dist/lib/exchange-universe.js +4 -0
  11. package/dist/lib/exchange-universe.js.map +1 -1
  12. package/dist/lib/funnel-snapshot.d.ts +31 -0
  13. package/dist/lib/funnel-snapshot.d.ts.map +1 -1
  14. package/dist/lib/funnel-snapshot.js +183 -4
  15. package/dist/lib/funnel-snapshot.js.map +1 -1
  16. package/dist/lib/geo-alert-hygiene.d.ts +74 -0
  17. package/dist/lib/geo-alert-hygiene.d.ts.map +1 -0
  18. package/dist/lib/geo-alert-hygiene.js +115 -0
  19. package/dist/lib/geo-alert-hygiene.js.map +1 -0
  20. package/dist/lib/geo-dashboard.d.ts +17 -2
  21. package/dist/lib/geo-dashboard.d.ts.map +1 -1
  22. package/dist/lib/geo-dashboard.js +52 -9
  23. package/dist/lib/geo-dashboard.js.map +1 -1
  24. package/dist/lib/geo-decide.d.ts +24 -0
  25. package/dist/lib/geo-decide.d.ts.map +1 -1
  26. package/dist/lib/geo-decide.js.map +1 -1
  27. package/dist/lib/geo-digest.d.ts +22 -1
  28. package/dist/lib/geo-digest.d.ts.map +1 -1
  29. package/dist/lib/geo-digest.js +28 -4
  30. package/dist/lib/geo-digest.js.map +1 -1
  31. package/dist/lib/geo-gap-list.d.ts.map +1 -1
  32. package/dist/lib/geo-gap-list.js +14 -6
  33. package/dist/lib/geo-gap-list.js.map +1 -1
  34. package/dist/lib/geo-orchestrator.d.ts +47 -7
  35. package/dist/lib/geo-orchestrator.d.ts.map +1 -1
  36. package/dist/lib/geo-orchestrator.js +90 -17
  37. package/dist/lib/geo-orchestrator.js.map +1 -1
  38. package/dist/lib/geo-rates.d.ts +76 -0
  39. package/dist/lib/geo-rates.d.ts.map +1 -0
  40. package/dist/lib/geo-rates.js +163 -0
  41. package/dist/lib/geo-rates.js.map +1 -0
  42. package/dist/lib/geo-storage.d.ts +10 -0
  43. package/dist/lib/geo-storage.d.ts.map +1 -1
  44. package/dist/lib/geo-storage.js +17 -4
  45. package/dist/lib/geo-storage.js.map +1 -1
  46. package/dist/lib/oi-snapshots.d.ts +33 -3
  47. package/dist/lib/oi-snapshots.d.ts.map +1 -1
  48. package/dist/lib/oi-snapshots.js +58 -17
  49. package/dist/lib/oi-snapshots.js.map +1 -1
  50. package/dist/lib/oi-sources.d.ts +3 -0
  51. package/dist/lib/oi-sources.d.ts.map +1 -1
  52. package/dist/lib/oi-sources.js +22 -6
  53. package/dist/lib/oi-sources.js.map +1 -1
  54. package/dist/lib/oiscore-shadow.d.ts +55 -0
  55. package/dist/lib/oiscore-shadow.d.ts.map +1 -0
  56. package/dist/lib/oiscore-shadow.js +105 -0
  57. package/dist/lib/oiscore-shadow.js.map +1 -0
  58. package/dist/lib/oiscore-source-flag.d.ts +15 -0
  59. package/dist/lib/oiscore-source-flag.d.ts.map +1 -0
  60. package/dist/lib/oiscore-source-flag.js +7 -0
  61. package/dist/lib/oiscore-source-flag.js.map +1 -0
  62. package/dist/lib/okx-funding-poller.d.ts +46 -0
  63. package/dist/lib/okx-funding-poller.d.ts.map +1 -0
  64. package/dist/lib/okx-funding-poller.js +137 -0
  65. package/dist/lib/okx-funding-poller.js.map +1 -0
  66. package/dist/lib/rank-metrics.d.ts +16 -1
  67. package/dist/lib/rank-metrics.d.ts.map +1 -1
  68. package/dist/lib/rank-metrics.js +31 -5
  69. package/dist/lib/rank-metrics.js.map +1 -1
  70. package/dist/lib/scan-digest-scheduler.d.ts.map +1 -1
  71. package/dist/lib/scan-digest-scheduler.js +5 -0
  72. package/dist/lib/scan-digest-scheduler.js.map +1 -1
  73. package/dist/lib/scan-digest.d.ts +99 -0
  74. package/dist/lib/scan-digest.d.ts.map +1 -1
  75. package/dist/lib/scan-digest.js +138 -0
  76. package/dist/lib/scan-digest.js.map +1 -1
  77. package/dist/lib/tools-list-event.d.ts +56 -0
  78. package/dist/lib/tools-list-event.d.ts.map +1 -0
  79. package/dist/lib/tools-list-event.js +88 -0
  80. package/dist/lib/tools-list-event.js.map +1 -0
  81. package/dist/lib/track-token.d.ts +24 -0
  82. package/dist/lib/track-token.d.ts.map +1 -1
  83. package/dist/lib/track-token.js +10 -0
  84. package/dist/lib/track-token.js.map +1 -1
  85. package/dist/lib/trade-call-scanner.d.ts +30 -2
  86. package/dist/lib/trade-call-scanner.d.ts.map +1 -1
  87. package/dist/lib/trade-call-scanner.js +52 -27
  88. package/dist/lib/trade-call-scanner.js.map +1 -1
  89. package/dist/lib/traffic-classifier.d.ts +33 -0
  90. package/dist/lib/traffic-classifier.d.ts.map +1 -0
  91. package/dist/lib/traffic-classifier.js +127 -0
  92. package/dist/lib/traffic-classifier.js.map +1 -0
  93. package/dist/lib/webhook-delivery.d.ts +3 -2
  94. package/dist/lib/webhook-delivery.d.ts.map +1 -1
  95. package/dist/lib/webhook-delivery.js.map +1 -1
  96. package/dist/lib/webhooks-store.d.ts.map +1 -1
  97. package/dist/lib/webhooks-store.js.map +1 -1
  98. package/dist/scripts/geo-weekly-cron.js +49 -19
  99. package/dist/scripts/geo-weekly-cron.js.map +1 -1
  100. package/dist/scripts/oi-snapshot-sampler.d.ts.map +1 -1
  101. package/dist/scripts/oi-snapshot-sampler.js +3 -1
  102. package/dist/scripts/oi-snapshot-sampler.js.map +1 -1
  103. package/dist/scripts/oiscore-shadow-measure.d.ts +2 -0
  104. package/dist/scripts/oiscore-shadow-measure.d.ts.map +1 -0
  105. package/dist/scripts/oiscore-shadow-measure.js +42 -0
  106. package/dist/scripts/oiscore-shadow-measure.js.map +1 -0
  107. package/dist/tool-descriptions.d.ts +3 -0
  108. package/dist/tool-descriptions.d.ts.map +1 -1
  109. package/dist/tool-descriptions.js +9 -1
  110. package/dist/tool-descriptions.js.map +1 -1
  111. package/dist/tools/get-trade-call.d.ts +32 -1
  112. package/dist/tools/get-trade-call.d.ts.map +1 -1
  113. package/dist/tools/get-trade-call.js +126 -79
  114. package/dist/tools/get-trade-call.js.map +1 -1
  115. package/dist/tools/scan-trade-calls.d.ts +3 -0
  116. package/dist/tools/scan-trade-calls.d.ts.map +1 -1
  117. package/dist/tools/scan-trade-calls.js +11 -0
  118. package/dist/tools/scan-trade-calls.js.map +1 -1
  119. package/package.json +5 -2
  120. package/server.json +3 -3
package/README.md CHANGED
@@ -11,7 +11,7 @@
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">298,459</span>+ verified calls. Merkle-verified on Base L2. Don't trust — verify. <!-- SNAPSHOT-LINE -->
14
+ <span data-tr-field="pfe_wr">91.8%</span>% PFE win rate across <span data-tr-field="total_calls">310,558</span>+ verified calls. Merkle-verified on Base L2. Don't trust — verify. <!-- SNAPSHOT-LINE -->
15
15
  </p>
16
16
 
17
17
  <p align="center">
@@ -92,7 +92,7 @@ Under the hood, a self-tuning model fuses momentum, trend structure, derivatives
92
92
  { "coin": "SOL", "timeframe": "15m", "confidence": 73 }
93
93
  ],
94
94
  "_algovault": {
95
- "version": "1.21.0",
95
+ "version": "1.22.1",
96
96
  "tool": "get_trade_call",
97
97
  "compatible_with": ["crypto-quant-risk-mcp", "crypto-quant-backtest-mcp"]
98
98
  }
@@ -110,7 +110,7 @@ The `_algovault` block makes outputs composable: downstream risk and backtest to
110
110
  scripts/snapshot-landing-data.mjs at npm-publish + Hetzner-deploy. Do NOT hand-edit the
111
111
  numbers; edit "What's new" by hand. Wired by OPS-NPM-README-SINGLE-SOT-W1 (2026-05-31). -->
112
112
  <p align="center">
113
- <strong><span data-tr-field="pfe_wr">91.8%</span>% PFE Win Rate</strong> · <strong><span data-tr-field="total_calls">298,459</span> trade calls</strong> · <strong><span data-tr-field="merkle_batches">79</span> on-chain batches</strong> · <strong><span data-tr-field="hold_rate">99.0%</span>% HOLD rate</strong> <!-- SNAPSHOT-LINE -->
113
+ <strong><span data-tr-field="pfe_wr">91.8%</span>% PFE Win Rate</strong> · <strong><span data-tr-field="total_calls">310,558</span> trade calls</strong> · <strong><span data-tr-field="merkle_batches">81</span> on-chain batches</strong> · <strong><span data-tr-field="hold_rate">99.0%</span>% HOLD rate</strong> <!-- SNAPSHOT-LINE -->
114
114
  </p>
115
115
 
116
116
  <p align="center">
@@ -223,8 +223,8 @@ Quota-only tiers. Every tier gets all venues, all assets, all timeframes — you
223
223
 
224
224
  | Feature | Free | Starter ($9.99/mo) | Pro ($49/mo) | Enterprise ($299/mo) | x402 (per call) |
225
225
  |---------|------|-------------------|-------------|---------------------|-----------------|
226
- | Exchanges | All 5 | All 5 | All 5 | All 5 | All 5 | <!-- SNAPSHOT-LINE-TABLE -->
227
- | Assets | All 940+ | All 940+ | All 940+ | All 940+ | All 940+ | <!-- SNAPSHOT-LINE-TABLE -->
226
+ | Exchanges | All 12 | All 12 | All 12 | All 12 | All 12 | <!-- SNAPSHOT-LINE-TABLE -->
227
+ | Assets | All 960+ | All 960+ | All 960+ | All 960+ | All 960+ | <!-- SNAPSHOT-LINE-TABLE -->
228
228
  | Asset classes | Crypto + TradFi | Crypto + TradFi | Crypto + TradFi | Crypto + TradFi | Crypto + TradFi |
229
229
  | Timeframes | All 11 | All 11 | All 11 | All 11 | All 11 |
230
230
  | Funding arb results | Top 5 | Unlimited | Unlimited | Unlimited | Unlimited |
@@ -242,17 +242,20 @@ Quota-only tiers. Every tier gets all venues, all assets, all timeframes — you
242
242
 
243
243
  ---
244
244
 
245
- ## What's new in v1.21.0
245
+ ## What's new in v1.22.0
246
246
 
247
- - **📊 `scan_trade_calls` ranking lenses (`rankBy`).** Rank the scan universe 9 ways — funding (negative/positive), top gainers/losers, volume, open interest, volatility (ATRP), and 24h OI change — plus aliases. One scanner, many market lenses.
248
- - **🧾 Verdict receipts (`_receipts`).** Every `get_trade_call` / `get_trade_signal` / `scan_trade_calls` verdict now carries inline proof: conviction, the top factors behind it, the live track record, and a verify link.
249
- - **🔌 Gemini, Kraken & Alpaca pairings.** Tutorials + runnable keyless demos that wire AlgoVault's analysis into each venue's own MCP execution kit. Browse at [algovault.com/integrations](https://algovault.com/integrations).
250
- - **🏆 Live track-record leaderboard.** One real-time, filterable leaderboard at [algovault.com/track-record](https://algovault.com/track-record).
251
- - **🎁 Referral program.** Free email-to-key signup + a public [referral page](https://algovault.com/referral) — refer a friend, you both get more calls.
252
- - **💸 Pay-per-call on the trade-call and scanner routes.** x402 (USDC on Base) — 100 free calls/month, then pay per call, no signup.
247
+ - **🌐 <span data-tr-field="exchange_count">12</span> exchanges live.** **ASTER, BingX, Gate, HTX, KuCoin, MEXC, and Phemex** join Hyperliquid, Binance, Bybit, OKX, and Bitget on the verified, Merkle-anchored public track record — composite trade calls, market-regime detection, and the per-venue PFE leaderboard now span every promoted venue.
248
+ - **🏆 12-venue leaderboard.** The live [track-record leaderboard](https://algovault.com/track-record) now ranks per-venue PFE win rate across all 12 — filter to any newly-added venue.
249
+ - **🔁 Forward-stable coverage.** The venue count reads live everywhere it appears, so coverage stays accurate as we keep adding venues.
253
250
 
254
- ### 🔒 Security hardening
255
- Payment-path and webhook hardening: x402 per-route price binding + replay protection; webhook delivery now pins egress IPs and signs every payload with a timestamped HMAC. **Webhook subscribers:** the signature scheme changed — if you verify `X-AlgoVault-Signature`, update per [docs/WEBHOOKS.md](https://github.com/AlgoVaultLabs/crypto-quant-signal-mcp/blob/main/docs/WEBHOOKS.md).
251
+ > **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.
252
+
253
+ ### v1.21.0 highlights (recap)
254
+
255
+ - **📊 `scan_trade_calls` ranking lenses (`rankBy`)** — rank the scan universe 9 ways (funding, gainers/losers, volume, open interest, volatility, 24h OI change) + aliases.
256
+ - **🧾 Verdict receipts (`_receipts`)** — inline conviction, top factors, live track record, and a verify link on every verdict.
257
+ - **🔌 Gemini, Kraken & Alpaca pairings** · **🏆 live track-record leaderboard** · **🎁 referral program** · **💸 pay-per-call** on the trade-call & scanner routes.
258
+ - **🔒 Security hardening** — x402 per-route price binding + replay protection; webhook egress-IP pinning + timestamped HMAC signatures. *Breaking for webhook subscribers* — update per [docs/WEBHOOKS.md](https://github.com/AlgoVaultLabs/crypto-quant-signal-mcp/blob/main/docs/WEBHOOKS.md).
256
259
 
257
260
  ### v1.20.0 highlights (recap)
258
261
 
@@ -263,29 +266,6 @@ Payment-path and webhook hardening: x402 per-route price binding + replay protec
263
266
 
264
267
  > MCP clients cache `tools/list` at session start — toggle the connector off/on (or restart the MCP connection) to see `scan_trade_calls`.
265
268
 
266
- ### v1.19.0 highlights (recap)
267
-
268
- - **🔔 Webhook Delivery Service.** Subscribe a URL; receive `trade_call` and `regime_shift` events as push, not poll. Payloads are HMAC-SHA256 signed, retried, and idempotent. Manage over HTTP: `POST` / `GET` / `DELETE /api/webhooks`, plus `POST /api/webhooks/:id/test` for a live test fire. API key required.
269
- - **🔗 One-call signal verification.** Every webhook payload carries a `verify_url`. Resolve it at `GET /api/verify-signal?hash=<signal_hash>` for that call's public, on-chain-anchored record.
270
- - **🔌 Two more platform integration examples.** The `algovault-integrations` mono-repo now ships 7 reference implementations — Hummingbot and FreqTrade join the existing five. New tiles on [algovault.com/integrations](https://algovault.com/integrations).
271
-
272
- **→ Set up a webhook:** [algovault.com/integrations#webhooks](https://algovault.com/integrations#webhooks) · **Webhook docs:** [docs/WEBHOOKS.md](https://github.com/AlgoVaultLabs/crypto-quant-signal-mcp/blob/main/docs/WEBHOOKS.md)
273
-
274
- ### v1.18.2 highlights (recap)
275
-
276
- - **🔌 Two new platform integration examples.** The `algovault-integrations` mono-repo now ships 5 reference implementations total (was 3 at v1.18.0):
277
- - **QuantDinger** (reference-architecture doc) — cross-MCP IDE-mediated orchestration. AlgoVault MCP and QuantDinger MCP connect through the user's IDE (Claude Desktop / Cursor / Codex CLI); no transformer code.
278
- - **Cryptohopper** (TypeScript) — Signaler webhook with HMAC-sha512 signed payloads. First HMAC-authed transport in the integrations repo.
279
- - **🧭 "Connect Your Trading Platform" section** added to [algovault.com/integrations](https://algovault.com/integrations). Discoverable tiles for the 5 platform examples; "Why integrate with AlgoVault?" framing replaces the prior exchange-kit framing.
280
-
281
- ### v1.18.0 highlights (recap)
282
-
283
- - **⏱️ 3-minute timeframe goes LIVE on the public Live Track Record.** The 3m card and Methodology > Evaluation Windows row are now visible at [algovault.com/track-record](https://algovault.com/track-record). The 9th evaluated timeframe is live. (The `3m` key shipped to `/api/performance-public.byTimeframe` in v1.16.0; v1.18.0 completes the dashboard-display chain.)
284
- - **🔌 Platform integration examples.** New public repo at [github.com/AlgoVaultLabs/algovault-integrations](https://github.com/AlgoVaultLabs/algovault-integrations) ships reference implementations of the Verifiable-Signal v1.0 spec (introduced in v1.17.0). Three platforms in v1.18.0:
285
- - **AI4Trade** (TypeScript) — REST POST with token-in-body auth.
286
- - **Nautilus Trader** (Python) — Subclass of Nautilus's `Data` abstract base.
287
- - **3Commas** (TypeScript) — Signal Bot webhook via per-bot curry-pattern factory.
288
-
289
269
  ---
290
270
 
291
271
  ## Privacy
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,SAAS,EAAuC,MAAM,yCAAyC,CAAC;AA8RzG;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,MAAM,EAAE,MAAM,GACb,MAAM,CAKR;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;AAmqHD,wBAAgB,mBAAmB,cAElC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,SAAS,EAAuC,MAAM,yCAAyC,CAAC;AAmSzG;;;;;;;;;;;;;;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;AA+uHD,wBAAgB,mBAAmB,cAElC"}
package/dist/index.js CHANGED
@@ -96,9 +96,12 @@ const referral_store_js_1 = require("./lib/referral-store.js"); // REFERRAL-INPR
96
96
  const nudge_copy_js_1 = require("./lib/nudge-copy.js");
97
97
  const track_record_snapshot_js_1 = require("./lib/track-record-snapshot.js");
98
98
  const receipts_js_1 = require("./lib/receipts.js");
99
+ const scan_digest_js_1 = require("./lib/scan-digest.js");
99
100
  const receipts_track_record_js_1 = require("./lib/receipts-track-record.js");
100
101
  const pql_js_1 = require("./lib/pql.js");
101
102
  const track_token_js_1 = require("./lib/track-token.js");
103
+ const tools_list_event_js_1 = require("./lib/tools-list-event.js");
104
+ const traffic_classifier_js_1 = require("./lib/traffic-classifier.js");
102
105
  const attribution_sources_js_1 = require("./lib/attribution-sources.js");
103
106
  const stripe_js_1 = require("./lib/stripe.js");
104
107
  const errors_js_1 = require("./lib/errors.js");
@@ -289,12 +292,12 @@ function chatQuotaApiKey(licenseKey, ipHash) {
289
292
  * to null without UUID-inflating it per request.
290
293
  */
291
294
  function resolveSessionCorrelationId(headers, ipHash) {
292
- const trackToken = (0, track_token_js_1.resolveTrackTokenForRequest)(headers);
293
- if (trackToken && trackToken.length > 0)
294
- return trackToken;
295
- if (ipHash && ipHash.length > 0)
296
- return ipHash;
297
- return node_crypto_1.default.randomUUID();
295
+ // OPS-ACTIVATION-LEAK-FIX-W1 CH2: thin `.id` projection of the shared
296
+ // resolveSessionIdentity (single-derivation LAW). The id and its identity tier
297
+ // (token|fallback|anon) now derive from ONE branch, so the funnel's
298
+ // identity_coverage can never disagree with the correlation id. Precedence
299
+ // (token ?? ipHash ?? uuid) is byte-identical to the prior inline form.
300
+ return (0, track_token_js_1.resolveSessionIdentity)(headers, ipHash).id;
298
301
  }
299
302
  /**
300
303
  * OPS-MCP-SESSION-RESILIENCE-W1: stateless Streamable-HTTP request handler. A fresh
@@ -590,11 +593,11 @@ function createServer() {
590
593
  // ── Tool: scan_trade_calls (SCAN-TRADE-CALLS-W1) — cross-asset market scanner ──
591
594
  // Thin handler: quota gate + envelope live in src/tools/scan-trade-calls.ts
592
595
  // (runScanTradeCall); the scanner compute is src/lib/trade-call-scanner.ts.
593
- register('scan_trade_calls', scan_trade_calls_js_1.SCAN_TRADE_CALLS_DESCRIPTION, scan_trade_calls_js_1.SCAN_TRADE_CALLS_SCHEMA, { title: 'Market Scanner', ...tool_annotations_js_1.PUBLIC_READONLY_TOOL_ANNOTATIONS }, async ({ topN, timeframe, exchange, minConfidence, includeHolds, limit, rankBy }) => {
596
+ register('scan_trade_calls', scan_trade_calls_js_1.SCAN_TRADE_CALLS_DESCRIPTION, scan_trade_calls_js_1.SCAN_TRADE_CALLS_SCHEMA, { title: 'Market Scanner', ...tool_annotations_js_1.PUBLIC_READONLY_TOOL_ANNOTATIONS }, async ({ topN, timeframe, exchange, minConfidence, includeHolds, limit, rankBy, includeReasoning, oiChangeWindow, oiBasis }) => {
594
597
  const startMs = Date.now();
595
598
  try {
596
599
  const license = (0, license_js_1.getRequestLicense)();
597
- const result = await (0, upstream_weight_budget_js_1.runAsCaller)('scan_trade_calls', () => (0, scan_trade_calls_js_1.runScanTradeCall)({ topN, timeframe, exchange, minConfidence, includeHolds, limit, rankBy }, license));
600
+ const result = await (0, upstream_weight_budget_js_1.runAsCaller)('scan_trade_calls', () => (0, scan_trade_calls_js_1.runScanTradeCall)({ topN, timeframe, exchange, minConfidence, includeHolds, limit, rankBy, includeReasoning, oiChangeWindow, oiBasis }, license));
598
601
  (0, analytics_js_1.logRequest)({
599
602
  sessionId: (0, license_js_1.getRequestSessionId)(),
600
603
  toolName: 'scan_trade_calls',
@@ -613,17 +616,27 @@ function createServer() {
613
616
  ipHash: (0, license_js_1.getRequestIpHash)() ?? null,
614
617
  }).catch((e) => console.debug('upsertAgentSession failed:', e instanceof Error ? e.message : e));
615
618
  }
616
- // P0 VERDICT-WITH-RECEIPTS-W1: content[0] is the JSON envelope (with the
617
- // shared `_receipts` block); content[1] is the proof footer so a scan
618
- // screenshot carries the proof beside the per-row verdicts. Omitted on the
619
- // quota-exhausted envelope (no `_receipts`) and when the source is down.
619
+ // content[0] = the JSON envelope (with the shared `_receipts` block).
620
620
  const content = [
621
621
  { type: 'text', text: JSON.stringify(result, null, 2) },
622
622
  ];
623
- const scanRcpt = result;
624
- const footer = scanRcpt._receipts ? (0, receipts_js_1.renderScanReceiptText)(scanRcpt._receipts) : '';
625
- if (footer)
626
- content.push({ type: 'text', text: footer });
623
+ const scanRes = result;
624
+ if (includeReasoning && Array.isArray(scanRes.calls)) {
625
+ // SCAN-DIGEST-MCP-PARITY-W1 CH1 — digest mode: content[1] = the enriched
626
+ // digest (header + renderScanDigestLine per actionable call), NO Proof
627
+ // footer (parity with OPS-SCANWATCH-ROCKET-NO-PROOF). The structured
628
+ // `_receipts` envelope still rides in content[0].
629
+ const digest = (0, scan_digest_js_1.renderScanDigest)(scanRes.calls, { topN, timeframe, exchange, rankBy });
630
+ if (digest)
631
+ content.push({ type: 'text', text: digest });
632
+ }
633
+ else {
634
+ // P0 VERDICT-WITH-RECEIPTS-W1: bare mode keeps the proof footer so a scan
635
+ // screenshot carries the proof beside the per-row verdicts (byte-identical).
636
+ const footer = scanRes._receipts ? (0, receipts_js_1.renderScanReceiptText)(scanRes._receipts) : '';
637
+ if (footer)
638
+ content.push({ type: 'text', text: footer });
639
+ }
627
640
  return { content };
628
641
  }
629
642
  catch (err) {
@@ -2637,9 +2650,20 @@ async function startHttp() {
2637
2650
  // Mcp-Session-Id, so resolve ONE id (track-token ?? ipHash ?? uuid) used for the funnel +
2638
2651
  // skill-attribution emit AND the requestContext ALS store (read by getRequestSessionId()
2639
2652
  // at the per-tool cohort sites). Stateful (=0) preserves the prior header-based value.
2653
+ // OPS-ACTIVATION-LEAK-FIX-W1 CH2: resolve the shared identity ONCE (id + tier)
2654
+ // so the mcp_connect + mcp_tools_list emits below stamp the SAME tier the
2655
+ // correlation id was derived from (single-derivation). `sessionId` is the
2656
+ // byte-identical `.id`, so every downstream consumer is unaffected.
2657
+ const sessionIdentity = MCP_STATELESS
2658
+ ? (0, track_token_js_1.resolveSessionIdentity)(req.headers, ipHash)
2659
+ : null;
2640
2660
  const sessionId = MCP_STATELESS
2641
- ? resolveSessionCorrelationId(req.headers, ipHash)
2661
+ ? sessionIdentity.id
2642
2662
  : req.headers['mcp-session-id'];
2663
+ // Identity tier for funnel coverage. Under the deprecated stateful path
2664
+ // (MCP_STATELESS=0) the POST-layer funnel emits don't meaningfully join, so a
2665
+ // default 'anon' label is harmless (only read when sessionId is set + stateless).
2666
+ const identityTier = sessionIdentity?.tier ?? 'anon';
2643
2667
  // C6 (algovault-skills SKILLS-W1): per-Skill attribution.
2644
2668
  // If the request carries X-AlgoVault-Skill-Slug AND is a tools/call,
2645
2669
  // log the invocation fire-and-forget BEFORE dispatching to the transport.
@@ -2710,15 +2734,56 @@ async function startHttp() {
2710
2734
  origin: req.headers['origin'],
2711
2735
  referer: req.headers['referer'],
2712
2736
  });
2737
+ // OPS-ACTIVATION-LEAK-FIX-W1 CH3: tag automated vs human via the ONE canonical
2738
+ // classifier (single-derivation). Tags additively into meta_json — the row is
2739
+ // NEVER dropped (Data Integrity). `hadRealToolCall` = is THIS connect POST itself
2740
+ // a real tools/call (the L4 combining path treats connect-only probes as automated).
2741
+ const connectBody = (req.body ?? {});
2742
+ const authenticity = (0, traffic_classifier_js_1.classifyTraffic)({
2743
+ ua: req.headers['user-agent'],
2744
+ ip: (0, client_ip_js_1.clientIp)(req),
2745
+ hadRealToolCall: connectBody.method === 'tools/call',
2746
+ // This emit block is already gated on `license.tier !== 'internal'`, so internal
2747
+ // traffic never reaches here (TS narrows tier to exclude 'internal'). The L0
2748
+ // internal-tier path of classifyTraffic is exercised by its unit canary instead.
2749
+ isInternalTier: false,
2750
+ });
2713
2751
  (0, performance_db_js_2.recordFunnelEvent)({
2714
2752
  eventType: 'mcp_connect',
2715
2753
  sessionId,
2716
2754
  licenseTier: license.tier,
2717
- meta: { source, source_confidence },
2755
+ // identity_tier (CH2): projected from the SHARED resolveSessionIdentity tier so
2756
+ // identity_coverage reads per-session stitchability off the once-per-session
2757
+ // connect event. is_automated/reason (CH3): the canonical classifyTraffic verdict
2758
+ // for by_authenticity. All additive to the existing {source, source_confidence}.
2759
+ meta: {
2760
+ source,
2761
+ source_confidence,
2762
+ identity_tier: identityTier,
2763
+ is_automated: authenticity.is_automated,
2764
+ automated_reason: authenticity.reason,
2765
+ },
2718
2766
  });
2719
2767
  }
2720
2768
  catch { /* best-effort; never blocks request */ }
2721
2769
  }
2770
+ // OPS-ACTIVATION-LEAK-FIX-W1 CH2 (Q1-A): capture `mcp_tools_list` (funnel stage 2)
2771
+ // at the POST layer by peeking the already-parsed JSON-RPC envelope BEFORE the SDK
2772
+ // consumes it. The high-level McpServer answers `tools/list` internally → it never
2773
+ // reaches a per-tool handler → never `logRequest`'d → request_log has 0 'tools/list'
2774
+ // rows all-time (the source of the 0.000% artifact). Emit here via the SHARED
2775
+ // resolveSessionIdentity id + bounded-LRU per-session dedup; the snapshot now reads
2776
+ // this from funnel_events (request_log kept as a 0-fallback). Fire-and-forget,
2777
+ // fail-open; internal-tier excluded; the tools/list RESPONSE is byte-identical
2778
+ // (side-effect emit only — nothing here touches `res` or the envelope).
2779
+ if (req.method === 'POST' &&
2780
+ sessionId &&
2781
+ license.tier !== 'internal' &&
2782
+ req.body &&
2783
+ typeof req.body === 'object' &&
2784
+ req.body.method === 'tools/list') {
2785
+ (0, tools_list_event_js_1.recordMcpToolsListEvent)({ sessionId, licenseTier: license.tier, identityTier });
2786
+ }
2722
2787
  // Run the entire request handling inside AsyncLocalStorage context
2723
2788
  // so tool handlers read the correct per-request license
2724
2789
  await license_js_1.requestContext.run({ license, sessionId, ipHash }, async () => {
@@ -3320,15 +3385,11 @@ tailwind.config = {
3320
3385
  <!-- Exchange Logo Strip -->
3321
3386
  <div style="display:flex;align-items:center;gap:16px;margin-bottom:20px;flex-wrap:wrap">
3322
3387
  <span style="color:#6e7681;font-size:12px;text-transform:uppercase;letter-spacing:1px">Analyzing</span>
3323
- <span style="background:#0d1117;border:1px solid #30363d;border-radius:8px;padding:6px 14px;font-size:13px;font-weight:600;color:#4ade80">Hyperliquid</span>
3324
- <span style="background:#0d1117;border:1px solid #30363d;border-radius:8px;padding:6px 14px;font-size:13px;font-weight:600;color:#F0B90B">Binance</span>
3325
- <span style="background:#0d1117;border:1px solid #30363d;border-radius:8px;padding:6px 14px;font-size:13px;font-weight:600;color:#F7A600">Bybit</span>
3326
- <span style="background:#0d1117;border:1px solid #30363d;border-radius:8px;padding:6px 14px;font-size:13px;font-weight:600;color:#fff">OKX</span>
3327
- <span style="background:#0d1117;border:1px solid #30363d;border-radius:8px;padding:6px 14px;font-size:13px;font-weight:600;color:#00C8BC">Bitget</span>
3388
+ <span id="analyzing-chips">${capabilities_js_1.EXCHANGES.map(e => '<span style="background:#0d1117;border:1px solid #30363d;border-radius:8px;padding:6px 14px;font-size:13px;font-weight:600;color:#8b949e">' + e.label + '</span>').join('')}</span>
3328
3389
  </div>
3329
3390
  <!-- Cross-Venue Intelligence Callout -->
3330
3391
  <div style="background:rgba(88,166,255,0.06);border:1px solid rgba(88,166,255,0.15);border-radius:10px;padding:12px 18px;margin-bottom:16px;font-size:13px;color:#c9d1d9">
3331
- <strong style="color:#58a6ff">Cross-Venue Intelligence</strong> &mdash; Trade calls are generated per exchange using native order books, funding rates, and OI data. The only MCP server analyzing 5 derivatives venues simultaneously.
3392
+ <strong style="color:#58a6ff">Cross-Venue Intelligence</strong> &mdash; Trade calls are generated per exchange using native order books, funding rates, and OI data. The only MCP server analyzing ${capabilities_js_1.EXCHANGE_COUNT} derivatives venues simultaneously.
3332
3393
  </div>
3333
3394
  <!-- On-Chain Verification Badge -->
3334
3395
  <div class="onchain-badge" id="onchain-badge" style="display:none">
@@ -3630,9 +3691,12 @@ var LB_SORT = 'wr'; // 'wr' | 'n'
3630
3691
  var LB_SORT_DIR = 'desc'; // 'desc' (high->low) | 'asc' (worst-first)
3631
3692
  var LB_MIN_N = 30; // Q-P1-4 filter floor (n>=0 = show everything); default 30
3632
3693
  var LB_SMALL_N = 30; // muted "small sample" tag bar (single source w/ default floor)
3633
- var LB_EX_LABEL = { HL: 'Hyperliquid', BINANCE: 'Binance', BYBIT: 'Bybit', OKX: 'OKX', BITGET: 'Bitget' };
3634
- var LB_EX_COLOR = { HL: '#4ade80', BINANCE: '#F0B90B', BYBIT: '#F7A600', OKX: '#ffffff', BITGET: '#00C8BC' };
3635
- var LB_EX_ORDER = ['HL', 'BINANCE', 'BYBIT', 'OKX', 'BITGET'];
3694
+ // OPS-VENUE-GO-LIVE-2026-06-30: promoted 5→12. The 7 appended alphabetically after
3695
+ // the original 5 (display order). Brand colors: BINGX/GATE/HTX/KUCOIN/MEXC are exact
3696
+ // brand hex; ASTER/PHEMEX brand-aligned (official hex not publicly retrievable).
3697
+ var LB_EX_LABEL = { HL: 'Hyperliquid', BINANCE: 'Binance', BYBIT: 'Bybit', OKX: 'OKX', BITGET: 'Bitget', ASTER: 'Aster', BINGX: 'BingX', GATE: 'Gate.io', HTX: 'HTX', KUCOIN: 'KuCoin', MEXC: 'MEXC', PHEMEX: 'Phemex' };
3698
+ var LB_EX_COLOR = { HL: '#4ade80', BINANCE: '#F0B90B', BYBIT: '#F7A600', OKX: '#ffffff', BITGET: '#00C8BC', ASTER: '#A855F7', BINGX: '#0058FB', GATE: '#17E6A1', HTX: '#0091D4', KUCOIN: '#23AF91', MEXC: '#1972E2', PHEMEX: '#818CF8' };
3699
+ var LB_EX_ORDER = ['HL', 'BINANCE', 'BYBIT', 'OKX', 'BITGET', 'ASTER', 'BINGX', 'GATE', 'HTX', 'KUCOIN', 'MEXC', 'PHEMEX'];
3636
3700
 
3637
3701
  // Build the row set for the active dimension from cachedData. Each row = {label, wr, n, [color], [tier]}.
3638
3702
  function lbRows() {
@@ -3798,7 +3862,9 @@ async function load() {
3798
3862
 
3799
3863
  // Exchange filter tabs
3800
3864
  var exTabs = document.getElementById('exchange-tabs');
3801
- var exchanges = [{id:'all',label:'ALL Exchanges'},{id:'HL',label:'Hyperliquid'},{id:'BINANCE',label:'Binance'},{id:'BYBIT',label:'Bybit'},{id:'OKX',label:'OKX'},{id:'BITGET',label:'Bitget'}];
3865
+ // OPS-VENUE-GO-LIVE Phase B (R3b-TR): data-driven from LB_EX_ORDER (the single SoT the
3866
+ // leaderboard uses) → shows all 12 promoted venues now, auto-grows to 17 with zero edits.
3867
+ var exchanges = [{id:'all',label:'ALL Exchanges'}].concat(LB_EX_ORDER.map(function(ex){ return {id:ex,label:LB_EX_LABEL[ex]||ex}; }));
3802
3868
  // DESIGN-W11-FF-CARD-BG (2026-05-15): inline style block REMOVED — relies on
3803
3869
  // .tab + .tab.active CSS rules (canonical bg + mint active text/border per
3804
3870
  // Q-CARDBG-1 + Q-CARDBG-2). font-size:13px overrides .tab default 12px →
@@ -3808,6 +3874,12 @@ async function load() {
3808
3874
  return '<div class="tab'+(isActive?' active':'')+'" data-ex="'+ex.id+'" style="font-size:13px" onclick="setExchangeFilter(\\''+ex.id+'\\')">'+ex.label+'</div>';
3809
3875
  }).join('');
3810
3876
 
3877
+ // OPS-VENUE-GO-LIVE Phase B (R3b-TR): Analyzing chip row — same LB_EX_ORDER SoT (12 now, auto-grows to 17)
3878
+ var chipsEl = document.getElementById('analyzing-chips');
3879
+ if (chipsEl) chipsEl.innerHTML = LB_EX_ORDER.map(function(ex){
3880
+ return '<span style="background:#0d1117;border:1px solid #30363d;border-radius:8px;padding:6px 14px;font-size:13px;font-weight:600;color:'+(LB_EX_COLOR[ex]||'#c9d1d9')+'">'+(LB_EX_LABEL[ex]||ex)+'</span>';
3881
+ }).join('');
3882
+
3811
3883
  // DESIGN-W8 / C4 (2026-05-11): #tf-tabs population REMOVED — DOM target
3812
3884
  // deleted with legacy "Performance by Timeframe" table block per Q-W8-4.
3813
3885
  // Confidence-bands fetch REMOVED — #cb-section + #cb-body DOM deleted.
@@ -3946,15 +4018,7 @@ function getSignupPageHtml() {
3946
4018
  <h1>AlgoVault Subscriptions</h1>
3947
4019
  <div class="subtitle">Free tier includes all assets and all 11 timeframes &mdash; capped at 100 calls/month. Upgrade for higher monthly limits and unlimited funding-arb results.</div>
3948
4020
  <div style="display:flex;justify-content:center;gap:12px;margin-bottom:24px;flex-wrap:wrap">
3949
- <span style="color:#4ade80;font-size:12px;font-weight:600">Hyperliquid</span>
3950
- <span style="color:#6e7681">&middot;</span>
3951
- <span style="color:#F0B90B;font-size:12px;font-weight:600">Binance</span>
3952
- <span style="color:#6e7681">&middot;</span>
3953
- <span style="color:#F7A600;font-size:12px;font-weight:600">Bybit</span>
3954
- <span style="color:#6e7681">&middot;</span>
3955
- <span style="color:#fff;font-size:12px;font-weight:600">OKX</span>
3956
- <span style="color:#6e7681">&middot;</span>
3957
- <span style="color:#00C8BC;font-size:12px;font-weight:600">Bitget</span>
4021
+ ${capabilities_js_1.EXCHANGES.map(e => '<span style="color:#8b949e;font-size:12px;font-weight:600">' + e.label + '</span>').join('<span style="color:#6e7681">&middot;</span>')}
3958
4022
  </div>
3959
4023
  ${(0, signup_flow_js_1.renderSignupFlowDark)()}
3960
4024
  ${(0, signup_flow_js_1.renderPlanCards)()}