crypto-quant-signal-mcp 1.23.0 → 1.23.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.
- package/README.md +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +230 -21
- package/dist/index.js.map +1 -1
- package/dist/lib/account-handlers.d.ts +12 -2
- package/dist/lib/account-handlers.d.ts.map +1 -1
- package/dist/lib/account-handlers.js +24 -8
- package/dist/lib/account-handlers.js.map +1 -1
- package/dist/lib/adapters/kucoin.d.ts +8 -0
- package/dist/lib/adapters/kucoin.d.ts.map +1 -1
- package/dist/lib/adapters/kucoin.js +47 -17
- package/dist/lib/adapters/kucoin.js.map +1 -1
- package/dist/lib/agent-activity-format.d.ts +25 -10
- package/dist/lib/agent-activity-format.d.ts.map +1 -1
- package/dist/lib/agent-activity-format.js +63 -24
- package/dist/lib/agent-activity-format.js.map +1 -1
- package/dist/lib/analytics.d.ts +14 -0
- package/dist/lib/analytics.d.ts.map +1 -1
- package/dist/lib/analytics.js +126 -1
- package/dist/lib/analytics.js.map +1 -1
- package/dist/lib/attribution-sources.d.ts +44 -12
- package/dist/lib/attribution-sources.d.ts.map +1 -1
- package/dist/lib/attribution-sources.js +165 -23
- package/dist/lib/attribution-sources.js.map +1 -1
- package/dist/lib/auth-providers.d.ts +49 -0
- package/dist/lib/auth-providers.d.ts.map +1 -0
- package/dist/lib/auth-providers.js +182 -0
- package/dist/lib/auth-providers.js.map +1 -0
- package/dist/lib/carry-divergence-log.d.ts +23 -0
- package/dist/lib/carry-divergence-log.d.ts.map +1 -0
- package/dist/lib/carry-divergence-log.js +59 -0
- package/dist/lib/carry-divergence-log.js.map +1 -0
- package/dist/lib/carry-rank-reader.d.ts +9 -0
- package/dist/lib/carry-rank-reader.d.ts.map +1 -0
- package/dist/lib/carry-rank-reader.js +65 -0
- package/dist/lib/carry-rank-reader.js.map +1 -0
- package/dist/lib/channel-registry.d.ts +51 -0
- package/dist/lib/channel-registry.d.ts.map +1 -0
- package/dist/lib/channel-registry.js +154 -0
- package/dist/lib/channel-registry.js.map +1 -0
- package/dist/lib/deferred-signup.d.ts +37 -0
- package/dist/lib/deferred-signup.d.ts.map +1 -0
- package/dist/lib/deferred-signup.js +64 -0
- package/dist/lib/deferred-signup.js.map +1 -0
- package/dist/lib/email.js +2 -2
- package/dist/lib/equities/equity-hold.d.ts +28 -0
- package/dist/lib/equities/equity-hold.d.ts.map +1 -0
- package/dist/lib/equities/equity-hold.js +34 -0
- package/dist/lib/equities/equity-hold.js.map +1 -0
- package/dist/lib/equities/equity-tool-formatters.d.ts.map +1 -1
- package/dist/lib/equities/equity-tool-formatters.js +6 -3
- package/dist/lib/equities/equity-tool-formatters.js.map +1 -1
- package/dist/lib/errors.d.ts +33 -0
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +29 -0
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/feature-registry.d.ts +22 -0
- package/dist/lib/feature-registry.d.ts.map +1 -1
- package/dist/lib/feature-registry.js +15 -0
- package/dist/lib/feature-registry.js.map +1 -1
- package/dist/lib/footer-content.d.ts +1 -1
- package/dist/lib/footer-content.js +3 -3
- package/dist/lib/footer-content.js.map +1 -1
- package/dist/lib/free-keys-store.d.ts +15 -0
- package/dist/lib/free-keys-store.d.ts.map +1 -1
- package/dist/lib/free-keys-store.js +84 -0
- package/dist/lib/free-keys-store.js.map +1 -1
- package/dist/lib/funnel-dashboard-html.d.ts +19 -0
- package/dist/lib/funnel-dashboard-html.d.ts.map +1 -0
- package/dist/lib/funnel-dashboard-html.js +192 -0
- package/dist/lib/funnel-dashboard-html.js.map +1 -0
- package/dist/lib/funnel-scoreboard.d.ts +406 -0
- package/dist/lib/funnel-scoreboard.d.ts.map +1 -0
- package/dist/lib/funnel-scoreboard.js +727 -0
- package/dist/lib/funnel-scoreboard.js.map +1 -0
- package/dist/lib/license.d.ts +9 -0
- package/dist/lib/license.d.ts.map +1 -1
- package/dist/lib/license.js +9 -1
- package/dist/lib/license.js.map +1 -1
- package/dist/lib/llm-clients.d.ts +28 -0
- package/dist/lib/llm-clients.d.ts.map +1 -0
- package/dist/lib/llm-clients.js +48 -0
- package/dist/lib/llm-clients.js.map +1 -0
- package/dist/lib/nav-manifest.d.ts +94 -0
- package/dist/lib/nav-manifest.d.ts.map +1 -0
- package/dist/lib/nav-manifest.js +204 -0
- package/dist/lib/nav-manifest.js.map +1 -0
- package/dist/lib/okx-a2mcp-config.d.ts +60 -0
- package/dist/lib/okx-a2mcp-config.d.ts.map +1 -0
- package/dist/lib/okx-a2mcp-config.js +78 -0
- package/dist/lib/okx-a2mcp-config.js.map +1 -0
- package/dist/lib/okx-a2mcp.d.ts +3 -59
- package/dist/lib/okx-a2mcp.d.ts.map +1 -1
- package/dist/lib/okx-a2mcp.js +34 -75
- package/dist/lib/okx-a2mcp.js.map +1 -1
- package/dist/lib/performance-db.d.ts +2 -0
- package/dist/lib/performance-db.d.ts.map +1 -1
- package/dist/lib/performance-db.js +18 -8
- package/dist/lib/performance-db.js.map +1 -1
- package/dist/lib/referral-pages.d.ts +11 -1
- package/dist/lib/referral-pages.d.ts.map +1 -1
- package/dist/lib/referral-pages.js +8 -16
- package/dist/lib/referral-pages.js.map +1 -1
- package/dist/lib/signin-component.d.ts +52 -0
- package/dist/lib/signin-component.d.ts.map +1 -0
- package/dist/lib/signin-component.js +176 -0
- package/dist/lib/signin-component.js.map +1 -0
- package/dist/lib/site-nav.d.ts +4 -15
- package/dist/lib/site-nav.d.ts.map +1 -1
- package/dist/lib/site-nav.js +167 -83
- package/dist/lib/site-nav.js.map +1 -1
- package/dist/lib/stripe.d.ts +15 -0
- package/dist/lib/stripe.d.ts.map +1 -1
- package/dist/lib/stripe.js +55 -0
- package/dist/lib/stripe.js.map +1 -1
- package/dist/lib/tagged-link.d.ts +15 -0
- package/dist/lib/tagged-link.d.ts.map +1 -0
- package/dist/lib/tagged-link.js +57 -0
- package/dist/lib/tagged-link.js.map +1 -0
- package/dist/lib/tier-warning.d.ts +7 -0
- package/dist/lib/tier-warning.d.ts.map +1 -1
- package/dist/lib/tier-warning.js +14 -1
- package/dist/lib/tier-warning.js.map +1 -1
- package/dist/lib/welcome-page.d.ts +11 -0
- package/dist/lib/welcome-page.d.ts.map +1 -1
- package/dist/lib/welcome-page.js +28 -2
- package/dist/lib/welcome-page.js.map +1 -1
- package/dist/lib/x402-http-routes.d.ts.map +1 -1
- package/dist/lib/x402-http-routes.js +4 -1
- package/dist/lib/x402-http-routes.js.map +1 -1
- package/dist/lib/x402-idempotency-store.d.ts +12 -1
- package/dist/lib/x402-idempotency-store.d.ts.map +1 -1
- package/dist/lib/x402-idempotency-store.js +47 -6
- package/dist/lib/x402-idempotency-store.js.map +1 -1
- package/dist/lib/x402-nudge.d.ts +16 -0
- package/dist/lib/x402-nudge.d.ts.map +1 -0
- package/dist/lib/x402-nudge.js +113 -0
- package/dist/lib/x402-nudge.js.map +1 -0
- package/dist/lib/x402-operator-wallets.d.ts +32 -0
- package/dist/lib/x402-operator-wallets.d.ts.map +1 -0
- package/dist/lib/x402-operator-wallets.js +46 -0
- package/dist/lib/x402-operator-wallets.js.map +1 -0
- package/dist/scripts/acp-graduation-buyer.d.ts +56 -0
- package/dist/scripts/acp-graduation-buyer.d.ts.map +1 -0
- package/dist/scripts/acp-graduation-buyer.js +318 -0
- package/dist/scripts/acp-graduation-buyer.js.map +1 -0
- package/dist/scripts/backfill-funding-episodes.d.ts +19 -0
- package/dist/scripts/backfill-funding-episodes.d.ts.map +1 -0
- package/dist/scripts/backfill-funding-episodes.js +389 -0
- package/dist/scripts/backfill-funding-episodes.js.map +1 -0
- package/dist/scripts/backfill-x402-payer-wallet.d.ts +7 -0
- package/dist/scripts/backfill-x402-payer-wallet.d.ts.map +1 -0
- package/dist/scripts/backfill-x402-payer-wallet.js +89 -0
- package/dist/scripts/backfill-x402-payer-wallet.js.map +1 -0
- package/dist/scripts/carry-freshness-helpers.d.ts +14 -0
- package/dist/scripts/carry-freshness-helpers.d.ts.map +1 -0
- package/dist/scripts/carry-freshness-helpers.js +33 -0
- package/dist/scripts/carry-freshness-helpers.js.map +1 -0
- package/dist/scripts/funding-baseline-report.d.ts +2 -0
- package/dist/scripts/funding-baseline-report.d.ts.map +1 -0
- package/dist/scripts/funding-baseline-report.js +237 -0
- package/dist/scripts/funding-baseline-report.js.map +1 -0
- package/dist/scripts/funding-episode-builder.d.ts +51 -0
- package/dist/scripts/funding-episode-builder.d.ts.map +1 -0
- package/dist/scripts/funding-episode-builder.js +107 -0
- package/dist/scripts/funding-episode-builder.js.map +1 -0
- package/dist/scripts/nightly-carry-labeler.d.ts +19 -0
- package/dist/scripts/nightly-carry-labeler.d.ts.map +1 -0
- package/dist/scripts/nightly-carry-labeler.js +123 -0
- package/dist/scripts/nightly-carry-labeler.js.map +1 -0
- package/dist/scripts/seed-signals.d.ts +1 -0
- package/dist/scripts/seed-signals.d.ts.map +1 -1
- package/dist/scripts/seed-signals.js +39 -4
- package/dist/scripts/seed-signals.js.map +1 -1
- package/dist/scripts/tool-readiness-report.d.ts +2 -2
- package/dist/scripts/tool-readiness-report.d.ts.map +1 -1
- package/dist/scripts/tool-readiness-report.js +5 -5
- package/dist/scripts/tool-readiness-report.js.map +1 -1
- package/dist/tools/get-market-regime.d.ts.map +1 -1
- package/dist/tools/get-market-regime.js +2 -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 +2 -0
- package/dist/tools/get-trade-call.js.map +1 -1
- package/dist/tools/scan-funding-arb.d.ts +16 -2
- package/dist/tools/scan-funding-arb.d.ts.map +1 -1
- package/dist/tools/scan-funding-arb.js +141 -3
- package/dist/tools/scan-funding-arb.js.map +1 -1
- package/dist/tools/scan-trade-calls.d.ts +4 -1
- package/dist/tools/scan-trade-calls.d.ts.map +1 -1
- package/dist/tools/scan-trade-calls.js +8 -0
- package/dist/tools/scan-trade-calls.js.map +1 -1
- package/dist/types.d.ts +47 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/server.json +1 -1
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.
|
|
14
|
+
<span data-tr-field="pfe_wr">91.6%</span>% PFE win rate across <span data-tr-field="total_calls">363,064</span>+ verified calls. Merkle-verified on Base L2. Don't trust — verify. <!-- SNAPSHOT-LINE -->
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
17
|
<p align="center">
|
|
@@ -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.
|
|
113
|
+
<strong><span data-tr-field="pfe_wr">91.6%</span>% PFE Win Rate</strong> · <strong><span data-tr-field="total_calls">363,064</span> trade calls</strong> · <strong><span data-tr-field="merkle_batches">95</span> on-chain batches</strong> · <strong><span data-tr-field="hold_rate">99.1%</span>% HOLD rate</strong> <!-- SNAPSHOT-LINE -->
|
|
114
114
|
</p>
|
|
115
115
|
|
|
116
116
|
<p align="center">
|
|
@@ -224,7 +224,7 @@ Quota-only tiers. Every tier gets all venues, all assets, all timeframes — you
|
|
|
224
224
|
| Feature | Free | Starter ($9.99/mo) | Pro ($49/mo) | Enterprise ($299/mo) | x402 (per call) |
|
|
225
225
|
|---------|------|-------------------|-------------|---------------------|-----------------|
|
|
226
226
|
| Exchanges | All 12 | All 12 | All 12 | All 12 | All 12 | <!-- SNAPSHOT-LINE-TABLE -->
|
|
227
|
-
| Assets | All
|
|
227
|
+
| Assets | All 1240+ | All 1240+ | All 1240+ | All 1240+ | All 1240+ | <!-- 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,7 +242,12 @@ 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.23.
|
|
245
|
+
## What's new in v1.23.1
|
|
246
|
+
|
|
247
|
+
- **🔗 A dedicated page for every way to connect.** New hub pages walk through each access channel end-to-end, with copy-paste code and a quick FAQ: [MCP](https://algovault.com/mcp), [REST API](https://algovault.com/rest-api), and [webhooks](https://algovault.com/webhooks).
|
|
248
|
+
- **🧭 Tools index + unified navigation.** Browse all public tools at [algovault.com/tools](https://algovault.com/tools); a new Platform menu makes the whole site easier to navigate.
|
|
249
|
+
|
|
250
|
+
### v1.23.0 highlights (recap)
|
|
246
251
|
|
|
247
252
|
- **📡 Cross-venue funding arbitrage now spans 7 venues.** `scan_funding_arb` expanded from 3 to 7 — Hyperliquid, Binance, Bybit, Gate, KuCoin, Aster, and OKX — with interval-correct annualization per venue and a per-leg liquidity filter, so only tradeable spreads surface.
|
|
248
253
|
|
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;AAqSzG;;;;;;;;;;;;;;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;AAy8HD,wBAAgB,mBAAmB,cAElC"}
|
package/dist/index.js
CHANGED
|
@@ -107,6 +107,10 @@ const traffic_classifier_js_1 = require("./lib/traffic-classifier.js");
|
|
|
107
107
|
const attribution_sources_js_1 = require("./lib/attribution-sources.js");
|
|
108
108
|
const stripe_js_1 = require("./lib/stripe.js");
|
|
109
109
|
const errors_js_1 = require("./lib/errors.js");
|
|
110
|
+
// FUNNEL-FIX-AGENT-X402-NUDGE-W1: at the quota edge, offer the agent an in-protocol x402
|
|
111
|
+
// pay-per-call rail. The helper is a LEAF (imports only pure/SDK modules) so this root import
|
|
112
|
+
// adds no cycle. Dark behind X402_NUDGE_ENABLED (default OFF ⇒ envelope byte-identical).
|
|
113
|
+
const x402_nudge_js_1 = require("./lib/x402-nudge.js");
|
|
110
114
|
const upstream_weight_budget_js_1 = require("./lib/upstream-weight-budget.js");
|
|
111
115
|
const venue_store_js_1 = require("./lib/venue-store.js");
|
|
112
116
|
const bot_auth_js_1 = require("./lib/bot-auth.js");
|
|
@@ -176,19 +180,14 @@ function toolErrorContent(err) {
|
|
|
176
180
|
return { content: [{ type: 'text', text: JSON.stringify(payload) }], isError: true };
|
|
177
181
|
}
|
|
178
182
|
if (err instanceof errors_js_1.TierLimitReachedError) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
retry_after_days: err.retry_after_days,
|
|
188
|
-
// REFERRAL-INPRODUCT-NUDGE-W1: additive, allow-listed referral hint (agent-
|
|
189
|
-
// relayable). The human `message` already leads with the referral arm.
|
|
190
|
-
referral_hint: err.referral_hint,
|
|
191
|
-
};
|
|
183
|
+
// FUNNEL-FIX-AGENT-X402-NUDGE-W1: additive `suggested_x402` in-protocol pay-per-call branch
|
|
184
|
+
// (the agent can settle with its own wallet, no human signup) alongside the intact Stripe/
|
|
185
|
+
// referral fields — closes the quota-crossing→paid leak (a machine can't fill a Stripe
|
|
186
|
+
// checkout). Derived from the feature-registry channels{} SoT + live rail predicates; omitted
|
|
187
|
+
// (envelope byte-identical) when X402_NUDGE_ENABLED is off, no public rail is live, or the
|
|
188
|
+
// tool is HELD. The allow-list formatter (buildTierLimitPayload) is the single wire shape.
|
|
189
|
+
const suggestedX402 = (0, x402_nudge_js_1.isX402NudgeEnabled)() && err.tool ? (0, x402_nudge_js_1.buildSuggestedX402)(err.tool) : undefined;
|
|
190
|
+
const payload = (0, errors_js_1.buildTierLimitPayload)(err, { suggestedX402 });
|
|
192
191
|
return { content: [{ type: 'text', text: JSON.stringify(payload) }], isError: true };
|
|
193
192
|
}
|
|
194
193
|
if (err instanceof errors_js_1.InsufficientCandlesError) {
|
|
@@ -441,6 +440,7 @@ function createServer() {
|
|
|
441
440
|
tool: toolNameForAnalytics,
|
|
442
441
|
tier: license.tier,
|
|
443
442
|
ipHash: (0, license_js_1.getRequestIpHash)() ?? null,
|
|
443
|
+
source: (0, license_js_1.getRequestSource)() ?? null,
|
|
444
444
|
}).catch((e) => console.debug('upsertAgentSession failed:', e instanceof Error ? e.message : e));
|
|
445
445
|
}
|
|
446
446
|
// P0 VERDICT-WITH-RECEIPTS-W1: content[0] stays the JSON envelope (now with
|
|
@@ -493,6 +493,7 @@ function createServer() {
|
|
|
493
493
|
tool: 'scan_funding_arb',
|
|
494
494
|
tier: license.tier,
|
|
495
495
|
ipHash: (0, license_js_1.getRequestIpHash)() ?? null,
|
|
496
|
+
source: (0, license_js_1.getRequestSource)() ?? null,
|
|
496
497
|
}).catch((e) => console.debug('upsertAgentSession failed:', e instanceof Error ? e.message : e));
|
|
497
498
|
}
|
|
498
499
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
@@ -529,6 +530,7 @@ function createServer() {
|
|
|
529
530
|
tool: 'get_market_regime',
|
|
530
531
|
tier: license.tier,
|
|
531
532
|
ipHash: (0, license_js_1.getRequestIpHash)() ?? null,
|
|
533
|
+
source: (0, license_js_1.getRequestSource)() ?? null,
|
|
532
534
|
}).catch((e) => console.debug('upsertAgentSession failed:', e instanceof Error ? e.message : e));
|
|
533
535
|
}
|
|
534
536
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
@@ -617,6 +619,7 @@ function createServer() {
|
|
|
617
619
|
tool: 'scan_trade_calls',
|
|
618
620
|
tier: license.tier,
|
|
619
621
|
ipHash: (0, license_js_1.getRequestIpHash)() ?? null,
|
|
622
|
+
source: (0, license_js_1.getRequestSource)() ?? null,
|
|
620
623
|
}).catch((e) => console.debug('upsertAgentSession failed:', e instanceof Error ? e.message : e));
|
|
621
624
|
}
|
|
622
625
|
// content[0] = the JSON envelope (with the shared `_receipts` block).
|
|
@@ -1394,13 +1397,21 @@ async function startHttp() {
|
|
|
1394
1397
|
const sessionId = req.query.session_id;
|
|
1395
1398
|
const utmSource = typeof req.query.utm_source === 'string' ? req.query.utm_source : null;
|
|
1396
1399
|
const utmCampaign = typeof req.query.utm_campaign === 'string' ? req.query.utm_campaign : null;
|
|
1400
|
+
// FUNNEL-FIX-HUMAN-SIGNUP-W1: render the value-before-email + OAuth options only when flagged;
|
|
1401
|
+
// each OAuth button renders ONLY when its real creds exist (no stub buttons shown to users).
|
|
1402
|
+
const { isNewSignupEnabled, isUnifiedSigninEnabled, getAuthProvider } = await import('./lib/auth-providers.js');
|
|
1403
|
+
const newSignupEnabled = isNewSignupEnabled();
|
|
1404
|
+
// FUNNEL-FIX-AUTH-UNIFY-W1: outer flag → the ONE shared sign-in card on the organic arm.
|
|
1405
|
+
const unifiedSignin = isUnifiedSigninEnabled();
|
|
1406
|
+
const oauthProviders = { google: getAuthProvider('google').live, github: getAuthProvider('github').live };
|
|
1407
|
+
const src = typeof req.query.src === 'string' ? req.query.src : null;
|
|
1397
1408
|
// Organic visit (no session_id) — render paywall CTA + no API-key reveal.
|
|
1398
1409
|
if (!sessionId) {
|
|
1399
|
-
return res.send((0, welcome_page_js_1.getWelcomePageHtml)(null, null, null, { utmSource, utmCampaign }));
|
|
1410
|
+
return res.send((0, welcome_page_js_1.getWelcomePageHtml)(null, null, null, { utmSource, utmCampaign, newSignupEnabled, oauthProviders, unifiedSignin, src }));
|
|
1400
1411
|
}
|
|
1401
1412
|
try {
|
|
1402
1413
|
const { apiKey, tier, email } = await (0, stripe_js_1.getCustomerApiKey)(sessionId);
|
|
1403
|
-
res.send((0, welcome_page_js_1.getWelcomePageHtml)(apiKey, tier, email, { utmSource, utmCampaign }));
|
|
1414
|
+
res.send((0, welcome_page_js_1.getWelcomePageHtml)(apiKey, tier, email, { utmSource, utmCampaign, newSignupEnabled, oauthProviders, unifiedSignin, src }));
|
|
1404
1415
|
}
|
|
1405
1416
|
catch (err) {
|
|
1406
1417
|
console.error('Welcome page error:', err instanceof Error ? err.message : err);
|
|
@@ -1434,10 +1445,22 @@ async function startHttp() {
|
|
|
1434
1445
|
// destination (incentive-first; CTA routes anon visitors to /account). Served
|
|
1435
1446
|
// on the apex via the Caddyfile `handle /referral` reverse_proxy (same path as
|
|
1436
1447
|
// /track-record) so algovault.com/referral resolves; mirrors /referral-terms.
|
|
1437
|
-
app.get('/referral', async (
|
|
1448
|
+
app.get('/referral', async (req, res) => {
|
|
1438
1449
|
const { renderReferralLandingPage } = await import('./lib/referral-pages.js');
|
|
1450
|
+
// FUNNEL-FIX-AUTH-UNIFY-W1: outer flag OFF → email-only legacy page (byte-identical);
|
|
1451
|
+
// ON → the shared sign-in card (referral reachable by one-tap Google/GitHub).
|
|
1452
|
+
const { isUnifiedSigninEnabled, isNewSignupEnabled, getAuthProvider } = await import('./lib/auth-providers.js');
|
|
1453
|
+
const unifiedSignin = isUnifiedSigninEnabled();
|
|
1454
|
+
const referralOpts = unifiedSignin
|
|
1455
|
+
? {
|
|
1456
|
+
unifiedSignin,
|
|
1457
|
+
newSignupEnabled: isNewSignupEnabled(),
|
|
1458
|
+
oauthProviders: { google: getAuthProvider('google').live, github: getAuthProvider('github').live },
|
|
1459
|
+
src: typeof req.query.src === 'string' ? req.query.src : null,
|
|
1460
|
+
}
|
|
1461
|
+
: {};
|
|
1439
1462
|
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
1440
|
-
res.send(renderReferralLandingPage());
|
|
1463
|
+
res.send(renderReferralLandingPage(referralOpts));
|
|
1441
1464
|
});
|
|
1442
1465
|
// REFERRAL-WEB-FIX-W1: the branded apex referee landing every web share link points
|
|
1443
1466
|
// to. Validates ?ref= (invalid/missing → graceful general start-free, no bonus claim);
|
|
@@ -1984,6 +2007,52 @@ async function startHttp() {
|
|
|
1984
2007
|
res.status(500).send('Internal error rendering subscriber tracker');
|
|
1985
2008
|
}
|
|
1986
2009
|
});
|
|
2010
|
+
// H0-C4-MEASURE-CLOSE: always-on activation-funnel scoreboard (INTERNAL/META).
|
|
2011
|
+
// JSON — the single getFunnelScoreboard() aggregation (composes the existing
|
|
2012
|
+
// generateFunnelSnapshot + subscriber-attribution + Stripe census; adds no MCP
|
|
2013
|
+
// tool, no version bump). Admin-gated like every /dashboard/api/* endpoint.
|
|
2014
|
+
app.get('/dashboard/api/funnel-scoreboard', async (req, res) => {
|
|
2015
|
+
if (!isAdminAuthorized(req)) {
|
|
2016
|
+
return res.status(401).json({ error: 'Unauthorized' });
|
|
2017
|
+
}
|
|
2018
|
+
try {
|
|
2019
|
+
// FUNNEL-SCOREBOARD-V2: ?window=7|30|90|180|365|all (default all) scopes both funnels.
|
|
2020
|
+
const allowed = new Set(['7', '30', '90', '180', '365', 'all']);
|
|
2021
|
+
const wRaw = String(req.query.window ?? 'all');
|
|
2022
|
+
const window = (allowed.has(wRaw) ? wRaw : 'all');
|
|
2023
|
+
const { getFunnelScoreboard } = await import('./lib/funnel-scoreboard.js');
|
|
2024
|
+
const scoreboard = await getFunnelScoreboard({ window });
|
|
2025
|
+
res.setHeader('Cache-Control', 'no-store');
|
|
2026
|
+
res.json(scoreboard);
|
|
2027
|
+
}
|
|
2028
|
+
catch (err) {
|
|
2029
|
+
console.error(`[/dashboard/api/funnel-scoreboard] internal error: ${err instanceof Error ? err.message : err}`);
|
|
2030
|
+
res.status(500).json({ error: 'Failed to compute funnel scoreboard' });
|
|
2031
|
+
}
|
|
2032
|
+
});
|
|
2033
|
+
// HTML shell — cookie-gated EXACTLY like /dashboard (anonymous → 401; ?key= sets
|
|
2034
|
+
// the session cookie then redirects). The served HTML embeds no data; it fetches
|
|
2035
|
+
// the gated JSON above via a same-origin XHR carrying the admin cookie.
|
|
2036
|
+
app.get('/dashboard/funnel', (req, res) => {
|
|
2037
|
+
const key = req.query.key;
|
|
2038
|
+
if (key && safeCompare(key, adminKey)) {
|
|
2039
|
+
const sessionToken = createAdminSession();
|
|
2040
|
+
res.setHeader('Set-Cookie', `${ADMIN_COOKIE_NAME}=${sessionToken}; HttpOnly; SameSite=Strict; Path=/; Max-Age=${ADMIN_SESSION_TTL / 1000}${req.secure ? '; Secure' : ''}`);
|
|
2041
|
+
return res.redirect(303, '/dashboard/funnel');
|
|
2042
|
+
}
|
|
2043
|
+
if (!isValidAdminSession(req.headers.cookie)) {
|
|
2044
|
+
return res.status(401).send('Unauthorized — add ?key=YOUR_ADMIN_KEY to the URL');
|
|
2045
|
+
}
|
|
2046
|
+
res.setHeader('Cache-Control', 'no-store');
|
|
2047
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
2048
|
+
// Lazy require keeps the shell out of the hot import graph; sync render.
|
|
2049
|
+
import('./lib/funnel-dashboard-html.js')
|
|
2050
|
+
.then(({ renderFunnelDashboardHtml }) => res.send(renderFunnelDashboardHtml()))
|
|
2051
|
+
.catch((err) => {
|
|
2052
|
+
console.error(`[/dashboard/funnel] render error: ${err instanceof Error ? err.message : err}`);
|
|
2053
|
+
res.status(500).send('Internal error rendering funnel scoreboard');
|
|
2054
|
+
});
|
|
2055
|
+
});
|
|
1987
2056
|
}
|
|
1988
2057
|
// ── Public track record (no auth) ──
|
|
1989
2058
|
// WEBSITE-REFRESH-CLEANUP-W1 R2: also returns `hold_rate` (computed from
|
|
@@ -2435,10 +2504,25 @@ async function startHttp() {
|
|
|
2435
2504
|
// REFERRAL-FREE-KEY-SIGNUP-W1: mint an av_free_ key for EVERY signup (idempotent
|
|
2436
2505
|
// on email), then derive the persisted referral code + share link. The keyless
|
|
2437
2506
|
// free tier (no key passed) is untouched — this only ADDS the opt-in account.
|
|
2438
|
-
const { mintFreeKey } = await import('./lib/free-keys-store.js');
|
|
2507
|
+
const { mintFreeKey, isEphemeralKey } = await import('./lib/free-keys-store.js');
|
|
2439
2508
|
const { ensureUserCode } = await import('./lib/referral-store.js');
|
|
2440
2509
|
const { shareLink } = await import('./lib/referral-constants.js');
|
|
2441
|
-
const
|
|
2510
|
+
const { isNewSignupEnabled } = await import('./lib/auth-providers.js');
|
|
2511
|
+
// FUNNEL-FIX-HUMAN-SIGNUP-W1: if this signup CLAIMS a prior ephemeral key (deferred
|
|
2512
|
+
// email), MERGE it (email = identity; idempotent; no double key) instead of minting
|
|
2513
|
+
// anew — behind NEW_SIGNUP_ENABLED. Legacy path (no ephemeral_key / flag off) unchanged.
|
|
2514
|
+
const ephemeralKey = typeof body.ephemeral_key === 'string' ? body.ephemeral_key : null;
|
|
2515
|
+
let key;
|
|
2516
|
+
if (referral.freeKey) {
|
|
2517
|
+
key = referral.freeKey;
|
|
2518
|
+
}
|
|
2519
|
+
else if (ephemeralKey && isNewSignupEnabled() && (await isEphemeralKey(ephemeralKey))) {
|
|
2520
|
+
const { captureEmail } = await import('./lib/deferred-signup.js');
|
|
2521
|
+
key = (await captureEmail(ephemeralKey, email, ref ?? null)).key;
|
|
2522
|
+
}
|
|
2523
|
+
else {
|
|
2524
|
+
key = await mintFreeKey(email);
|
|
2525
|
+
}
|
|
2442
2526
|
const referralCode = await ensureUserCode(key, email);
|
|
2443
2527
|
const referralLink = shareLink(referralCode);
|
|
2444
2528
|
// Transactional key email (NOT gated on marketing consent) — referred → bonus
|
|
@@ -2479,6 +2563,121 @@ async function startHttp() {
|
|
|
2479
2563
|
return res.status(500).json({ ok: false, error: 'internal_error' });
|
|
2480
2564
|
}
|
|
2481
2565
|
});
|
|
2566
|
+
// ── FUNNEL-FIX-HUMAN-SIGNUP-W1: value-before-email + one-tap sign-in ──
|
|
2567
|
+
// ALL new-signup routes are behind NEW_SIGNUP_ENABLED (default OFF → 404, invisible).
|
|
2568
|
+
// The legacy email-first flow above stays intact. MCP/TG surfaces untouched.
|
|
2569
|
+
// Value BEFORE email: mint an ephemeral key + return a real signal, no email required.
|
|
2570
|
+
app.post('/api/start-free', express.json({ limit: '2kb' }), async (req, res) => {
|
|
2571
|
+
const { isNewSignupEnabled } = await import('./lib/auth-providers.js');
|
|
2572
|
+
if (!isNewSignupEnabled())
|
|
2573
|
+
return res.status(404).json({ ok: false, error: 'not_found' });
|
|
2574
|
+
try {
|
|
2575
|
+
const q = req.query;
|
|
2576
|
+
const b = (req.body ?? {});
|
|
2577
|
+
const str = (v) => (typeof v === 'string' && v.length <= 200 ? v : null);
|
|
2578
|
+
const { startFree } = await import('./lib/deferred-signup.js');
|
|
2579
|
+
const result = await startFree({
|
|
2580
|
+
src: str(q.src) ?? str(b.src),
|
|
2581
|
+
ref: str(q.ref) ?? str(b.ref),
|
|
2582
|
+
utm_source: str(q.utm_source) ?? str(b.utm_source),
|
|
2583
|
+
utm_campaign: str(q.utm_campaign) ?? str(b.utm_campaign),
|
|
2584
|
+
landing_path: str(q.landing_path),
|
|
2585
|
+
});
|
|
2586
|
+
res.setHeader('Cache-Control', 'no-store');
|
|
2587
|
+
return res.status(200).json({ ok: true, ...result });
|
|
2588
|
+
}
|
|
2589
|
+
catch (err) {
|
|
2590
|
+
console.error(`[/api/start-free] internal error: ${err instanceof Error ? err.message : err}`);
|
|
2591
|
+
return res.status(500).json({ ok: false, error: 'internal_error' });
|
|
2592
|
+
}
|
|
2593
|
+
});
|
|
2594
|
+
// One-tap OAuth start: redirect to the IdP (or the Stub loopback) with a CSRF state cookie.
|
|
2595
|
+
app.get('/auth/:provider', async (req, res) => {
|
|
2596
|
+
const { isNewSignupEnabled, getAuthProvider, generateOAuthState, safeRedirectPath } = await import('./lib/auth-providers.js');
|
|
2597
|
+
if (!isNewSignupEnabled())
|
|
2598
|
+
return res.status(404).send('Not found');
|
|
2599
|
+
const id = req.params.provider;
|
|
2600
|
+
if (id !== 'google' && id !== 'github')
|
|
2601
|
+
return res.status(404).send('Unknown provider');
|
|
2602
|
+
try {
|
|
2603
|
+
const provider = getAuthProvider(id);
|
|
2604
|
+
const state = generateOAuthState();
|
|
2605
|
+
const next = safeRedirectPath(req.query.next);
|
|
2606
|
+
const redirectUri = `https://${req.get('host')}/auth/${id}/callback`;
|
|
2607
|
+
const secure = req.secure || req.get('x-forwarded-proto') === 'https';
|
|
2608
|
+
// Short-lived, HttpOnly CSRF + next cookies (10 min).
|
|
2609
|
+
res.setHeader('Set-Cookie', [
|
|
2610
|
+
`av_oauth_state=${state}; HttpOnly; SameSite=Lax; Path=/auth; Max-Age=600${secure ? '; Secure' : ''}`,
|
|
2611
|
+
`av_oauth_next=${encodeURIComponent(next)}; HttpOnly; SameSite=Lax; Path=/auth; Max-Age=600${secure ? '; Secure' : ''}`,
|
|
2612
|
+
...(typeof req.query.src === 'string' ? [`av_oauth_src=${encodeURIComponent(req.query.src.slice(0, 60))}; HttpOnly; SameSite=Lax; Path=/auth; Max-Age=600${secure ? '; Secure' : ''}`] : []),
|
|
2613
|
+
]);
|
|
2614
|
+
return res.redirect(302, provider.authorizeUrl({ state, redirectUri }));
|
|
2615
|
+
}
|
|
2616
|
+
catch (err) {
|
|
2617
|
+
console.error(`[/auth/${id}] internal error: ${err instanceof Error ? err.message : err}`);
|
|
2618
|
+
return res.status(500).send('Sign-in error');
|
|
2619
|
+
}
|
|
2620
|
+
});
|
|
2621
|
+
// OAuth callback: verify state → exchange → issue a free key for the verified email.
|
|
2622
|
+
app.get('/auth/:provider/callback', async (req, res) => {
|
|
2623
|
+
const { isNewSignupEnabled, getAuthProvider, safeRedirectPath } = await import('./lib/auth-providers.js');
|
|
2624
|
+
if (!isNewSignupEnabled())
|
|
2625
|
+
return res.status(404).send('Not found');
|
|
2626
|
+
const id = req.params.provider;
|
|
2627
|
+
if (id !== 'google' && id !== 'github')
|
|
2628
|
+
return res.status(404).send('Unknown provider');
|
|
2629
|
+
try {
|
|
2630
|
+
const cookie = req.headers.cookie ?? '';
|
|
2631
|
+
const readCookie = (n) => {
|
|
2632
|
+
const m = cookie.match(new RegExp(`${n}=([^;]+)`));
|
|
2633
|
+
return m ? decodeURIComponent(m[1]) : null;
|
|
2634
|
+
};
|
|
2635
|
+
const expectState = readCookie('av_oauth_state');
|
|
2636
|
+
const gotState = typeof req.query.state === 'string' ? req.query.state : '';
|
|
2637
|
+
if (!expectState || !gotState || !safeCompare(expectState, gotState)) {
|
|
2638
|
+
return res.status(400).send('Invalid or expired sign-in state. Please try again.');
|
|
2639
|
+
}
|
|
2640
|
+
const code = typeof req.query.code === 'string' ? req.query.code : '';
|
|
2641
|
+
if (!code)
|
|
2642
|
+
return res.status(400).send('Missing authorization code.');
|
|
2643
|
+
const provider = getAuthProvider(id);
|
|
2644
|
+
const redirectUri = `https://${req.get('host')}/auth/${id}/callback`;
|
|
2645
|
+
const profile = await provider.exchange({ code, redirectUri });
|
|
2646
|
+
// Issue (or return the existing) free key for the verified email — email = identity.
|
|
2647
|
+
const { mintFreeKey } = await import('./lib/free-keys-store.js');
|
|
2648
|
+
const { ensureUserCode } = await import('./lib/referral-store.js');
|
|
2649
|
+
const { shareLink } = await import('./lib/referral-constants.js');
|
|
2650
|
+
const key = await mintFreeKey(profile.email);
|
|
2651
|
+
const referralCode = await ensureUserCode(key, profile.email);
|
|
2652
|
+
const referralLink = shareLink(referralCode);
|
|
2653
|
+
// Attribution first-touch survives the redirect: stamp ?src (cookie) against the key.
|
|
2654
|
+
try {
|
|
2655
|
+
const src = readCookie('av_oauth_src');
|
|
2656
|
+
const { recordSignupAttribution } = await import('./lib/subscriber-attribution.js');
|
|
2657
|
+
recordSignupAttribution({ clientReferenceId: key, utmSource: src, tierRequested: 'free' });
|
|
2658
|
+
}
|
|
2659
|
+
catch { /* best-effort */ }
|
|
2660
|
+
// Clear the CSRF cookies.
|
|
2661
|
+
res.setHeader('Set-Cookie', [
|
|
2662
|
+
'av_oauth_state=; HttpOnly; SameSite=Lax; Path=/auth; Max-Age=0',
|
|
2663
|
+
'av_oauth_next=; HttpOnly; SameSite=Lax; Path=/auth; Max-Age=0',
|
|
2664
|
+
'av_oauth_src=; HttpOnly; SameSite=Lax; Path=/auth; Max-Age=0',
|
|
2665
|
+
]);
|
|
2666
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
2667
|
+
const stubNote = provider.live ? '' : ' <em>(stub — set the provider OAuth creds to go live)</em>';
|
|
2668
|
+
return res.send(`<!doctype html><meta charset="utf-8"><title>You're in — AlgoVault</title>` +
|
|
2669
|
+
`<body style="font-family:system-ui;background:#0d1117;color:#c9d1d9;max-width:560px;margin:60px auto;padding:0 20px">` +
|
|
2670
|
+
`<h1 style="color:#56d364">You're in via ${id}${stubNote}</h1>` +
|
|
2671
|
+
`<p>Your free API key (100 calls/mo, no card):</p>` +
|
|
2672
|
+
`<pre style="background:#161b22;border:1px solid #30363d;border-radius:8px;padding:12px;user-select:all">${key}</pre>` +
|
|
2673
|
+
`<p>Referral link: <a style="color:#58a6ff" href="${referralLink}">${referralLink}</a></p>` +
|
|
2674
|
+
`<p style="color:#8b949e;font-size:13px">Use it as <code>Authorization: Bearer <key></code>. <a style="color:#58a6ff" href="/account">Manage your account →</a></p></body>`);
|
|
2675
|
+
}
|
|
2676
|
+
catch (err) {
|
|
2677
|
+
console.error(`[/auth/${id}/callback] internal error: ${err instanceof Error ? err.message : err}`);
|
|
2678
|
+
return res.status(500).send('Sign-in error. Please try again.');
|
|
2679
|
+
}
|
|
2680
|
+
});
|
|
2482
2681
|
// ── AV-CHAT-MCP-W1 (C3, 2026-05-18): /api/chat HTTP endpoint ──
|
|
2483
2682
|
// LLM-synthesized answer with citations. Quota tracked separately from
|
|
2484
2683
|
// tool quotas via ChatRateLimit + chat_usage_monthly table. Falls back
|
|
@@ -2794,9 +2993,19 @@ async function startHttp() {
|
|
|
2794
2993
|
req.body.method === 'tools/list') {
|
|
2795
2994
|
(0, tools_list_event_js_1.recordMcpToolsListEvent)({ sessionId, licenseTier: license.tier, identityTier });
|
|
2796
2995
|
}
|
|
2996
|
+
// FUNNEL-FIX-ATTRIBUTION-W1: resolve the classified acquisition source ONCE here (request
|
|
2997
|
+
// headers in scope) and thread it via the ALS to the agent_sessions first-touch stamp.
|
|
2998
|
+
// Additive — resolveSessionIdentity + the stateless resolver are untouched.
|
|
2999
|
+
const attributionSource = (0, attribution_sources_js_1.classifySource)({
|
|
3000
|
+
srcParam: req.query?.src,
|
|
3001
|
+
utmSource: req.query?.utm_source, // OPS-UTM-SHORTEN-W1: legacy backward-compat fallback (behind ?src)
|
|
3002
|
+
userAgent: req.headers['user-agent'],
|
|
3003
|
+
origin: req.headers['origin'],
|
|
3004
|
+
referer: req.headers['referer'],
|
|
3005
|
+
}).source;
|
|
2797
3006
|
// Run the entire request handling inside AsyncLocalStorage context
|
|
2798
3007
|
// so tool handlers read the correct per-request license
|
|
2799
|
-
await license_js_1.requestContext.run({ license, sessionId, ipHash, isAutomated: requestAuthenticity.is_automated }, async () => {
|
|
3008
|
+
await license_js_1.requestContext.run({ license, sessionId, ipHash, isAutomated: requestAuthenticity.is_automated, source: attributionSource }, async () => {
|
|
2800
3009
|
try {
|
|
2801
3010
|
const sessionId = req.headers['mcp-session-id'];
|
|
2802
3011
|
// OPS-X402-MCP-PRICE-BINDING-W1: an x402 proof was presented for a priced
|
|
@@ -3363,7 +3572,7 @@ tailwind.config = {
|
|
|
3363
3572
|
</head>
|
|
3364
3573
|
<body>
|
|
3365
3574
|
<!-- LANDING-MOBILE-NAV-FUNCTION-RENDERED-W1: canonical Nav via shared renderSiteNav() (src/lib/site-nav.ts) — desktop byte-identical to the prior inline nav (Track Record active) + mobile hamburger/#mobile-menu panel/controller. -->
|
|
3366
|
-
${(0, site_nav_js_1.renderSiteNav)(
|
|
3575
|
+
${(0, site_nav_js_1.renderSiteNav)()}
|
|
3367
3576
|
<!-- DESIGN-W11 / C2 / Q-W11-3: canonical artboard wrapper OPEN (max-width:1400px preserves dashboard layout; 80px top padding clears 56px fixed Nav + breathing). Foreground content stacks above 3 bg-* layers via position:relative;z-index:1. -->
|
|
3368
3577
|
<main class="lp-track-record">
|
|
3369
3578
|
<div class="artboard" style="padding:80px 24px 64px;max-width:1400px;margin:0 auto;width:100%">
|