crypto-quant-signal-mcp 1.22.0 → 1.23.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 +23 -37
- package/dist/channels/acp/offerings.d.ts +59 -0
- package/dist/channels/acp/offerings.d.ts.map +1 -0
- package/dist/channels/acp/offerings.js +104 -0
- package/dist/channels/acp/offerings.js.map +1 -0
- package/dist/channels/acp/provider.d.ts +111 -0
- package/dist/channels/acp/provider.d.ts.map +1 -0
- package/dist/channels/acp/provider.js +167 -0
- package/dist/channels/acp/provider.js.map +1 -0
- package/dist/channels/acp/seller-worker.d.ts +36 -0
- package/dist/channels/acp/seller-worker.d.ts.map +1 -0
- package/dist/channels/acp/seller-worker.js +211 -0
- package/dist/channels/acp/seller-worker.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +56 -49
- package/dist/index.js.map +1 -1
- package/dist/lib/account-handlers.d.ts.map +1 -1
- package/dist/lib/account-handlers.js +5 -22
- package/dist/lib/account-handlers.js.map +1 -1
- package/dist/lib/adapters/bitget.d.ts.map +1 -1
- package/dist/lib/adapters/bitget.js +39 -10
- package/dist/lib/adapters/bitget.js.map +1 -1
- package/dist/lib/adapters/okx.d.ts.map +1 -1
- package/dist/lib/adapters/okx.js +39 -12
- package/dist/lib/adapters/okx.js.map +1 -1
- package/dist/lib/agent-activity-format.d.ts +18 -0
- package/dist/lib/agent-activity-format.d.ts.map +1 -0
- package/dist/lib/agent-activity-format.js +49 -0
- package/dist/lib/agent-activity-format.js.map +1 -0
- package/dist/lib/analytics.d.ts +1 -0
- package/dist/lib/analytics.d.ts.map +1 -1
- package/dist/lib/analytics.js +88 -4
- package/dist/lib/analytics.js.map +1 -1
- package/dist/lib/capabilities.d.ts +49 -1
- package/dist/lib/capabilities.d.ts.map +1 -1
- package/dist/lib/capabilities.js +3 -1
- package/dist/lib/capabilities.js.map +1 -1
- package/dist/lib/coin-overrides.d.ts +13 -0
- package/dist/lib/coin-overrides.d.ts.map +1 -0
- package/dist/lib/coin-overrides.js +25 -0
- package/dist/lib/coin-overrides.js.map +1 -0
- package/dist/lib/exchange-universe.d.ts +18 -16
- package/dist/lib/exchange-universe.d.ts.map +1 -1
- package/dist/lib/exchange-universe.js +214 -20
- package/dist/lib/exchange-universe.js.map +1 -1
- package/dist/lib/feature-registry.d.ts +22 -1
- package/dist/lib/feature-registry.d.ts.map +1 -1
- package/dist/lib/feature-registry.js +18 -8
- package/dist/lib/feature-registry.js.map +1 -1
- package/dist/lib/funding-venues.d.ts +25 -0
- package/dist/lib/funding-venues.d.ts.map +1 -0
- package/dist/lib/funding-venues.js +32 -0
- package/dist/lib/funding-venues.js.map +1 -0
- package/dist/lib/license.d.ts +15 -0
- package/dist/lib/license.d.ts.map +1 -1
- package/dist/lib/license.js +10 -0
- package/dist/lib/license.js.map +1 -1
- package/dist/lib/oi-sources.d.ts.map +1 -1
- package/dist/lib/oi-sources.js +6 -0
- package/dist/lib/oi-sources.js.map +1 -1
- package/dist/lib/okx-a2mcp.d.ts +139 -0
- package/dist/lib/okx-a2mcp.d.ts.map +1 -0
- package/dist/lib/okx-a2mcp.js +323 -0
- package/dist/lib/okx-a2mcp.js.map +1 -0
- package/dist/lib/site-nav.d.ts +18 -0
- package/dist/lib/site-nav.d.ts.map +1 -0
- package/dist/lib/site-nav.js +115 -0
- package/dist/lib/site-nav.js.map +1 -0
- package/dist/lib/trade-call-scanner.d.ts +2 -2
- package/dist/lib/trade-call-scanner.d.ts.map +1 -1
- package/dist/lib/trade-call-scanner.js +2 -1
- package/dist/lib/trade-call-scanner.js.map +1 -1
- package/dist/lib/x402-bazaar.d.ts.map +1 -1
- package/dist/lib/x402-bazaar.js +9 -7
- package/dist/lib/x402-bazaar.js.map +1 -1
- package/dist/lib/x402-http-routes.d.ts.map +1 -1
- package/dist/lib/x402-http-routes.js +18 -1
- package/dist/lib/x402-http-routes.js.map +1 -1
- package/dist/scripts/backfill-directional-labels.d.ts +28 -0
- package/dist/scripts/backfill-directional-labels.d.ts.map +1 -0
- package/dist/scripts/backfill-directional-labels.js +289 -0
- package/dist/scripts/backfill-directional-labels.js.map +1 -0
- package/dist/scripts/calibration-audit.d.ts +193 -0
- package/dist/scripts/calibration-audit.d.ts.map +1 -0
- package/dist/scripts/calibration-audit.js +440 -0
- package/dist/scripts/calibration-audit.js.map +1 -0
- package/dist/scripts/directional-labeler.d.ts +53 -0
- package/dist/scripts/directional-labeler.d.ts.map +1 -0
- package/dist/scripts/directional-labeler.js +138 -0
- package/dist/scripts/directional-labeler.js.map +1 -0
- package/dist/scripts/dwr-baseline-report.d.ts +12 -0
- package/dist/scripts/dwr-baseline-report.d.ts.map +1 -0
- package/dist/scripts/dwr-baseline-report.js +137 -0
- package/dist/scripts/dwr-baseline-report.js.map +1 -0
- package/dist/scripts/dwr-baseline.d.ts +46 -0
- package/dist/scripts/dwr-baseline.d.ts.map +1 -0
- package/dist/scripts/dwr-baseline.js +92 -0
- package/dist/scripts/dwr-baseline.js.map +1 -0
- package/dist/scripts/edge-stats.d.ts +44 -0
- package/dist/scripts/edge-stats.d.ts.map +1 -0
- package/dist/scripts/edge-stats.js +129 -0
- package/dist/scripts/edge-stats.js.map +1 -0
- package/dist/scripts/monitor.js +4 -21
- package/dist/scripts/monitor.js.map +1 -1
- package/dist/scripts/oi-snapshot-sampler.d.ts.map +1 -1
- package/dist/scripts/oi-snapshot-sampler.js +5 -1
- package/dist/scripts/oi-snapshot-sampler.js.map +1 -1
- package/dist/scripts/seed-signals.d.ts.map +1 -1
- package/dist/scripts/seed-signals.js +35 -87
- package/dist/scripts/seed-signals.js.map +1 -1
- package/dist/scripts/tool-readiness-report.d.ts +87 -0
- package/dist/scripts/tool-readiness-report.d.ts.map +1 -0
- package/dist/scripts/tool-readiness-report.js +157 -0
- package/dist/scripts/tool-readiness-report.js.map +1 -0
- package/dist/scripts/venue-readiness-report.d.ts.map +1 -1
- package/dist/scripts/venue-readiness-report.js +12 -0
- package/dist/scripts/venue-readiness-report.js.map +1 -1
- package/dist/tool-descriptions.d.ts +1 -1
- package/dist/tool-descriptions.d.ts.map +1 -1
- package/dist/tool-descriptions.js +1 -1
- package/dist/tool-descriptions.js.map +1 -1
- package/dist/tools/scan-funding-arb.d.ts +2 -1
- package/dist/tools/scan-funding-arb.d.ts.map +1 -1
- package/dist/tools/scan-funding-arb.js +109 -26
- package/dist/tools/scan-funding-arb.js.map +1 -1
- package/dist/tools/scan-trade-calls.d.ts +5 -4
- package/dist/tools/scan-trade-calls.d.ts.map +1 -1
- package/dist/tools/scan-trade-calls.js +6 -4
- package/dist/tools/scan-trade-calls.js.map +1 -1
- package/package.json +9 -2
- 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">
|
|
14
|
+
<span data-tr-field="pfe_wr">91.8%</span>% PFE win rate across <span data-tr-field="total_calls">323,531</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.
|
|
95
|
+
"version": "1.23.0",
|
|
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">
|
|
113
|
+
<strong><span data-tr-field="pfe_wr">91.8%</span>% PFE Win Rate</strong> · <strong><span data-tr-field="total_calls">323,531</span> trade calls</strong> · <strong><span data-tr-field="merkle_batches">85</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">
|
|
@@ -175,7 +175,7 @@ The MCP tools live at `https://api.algovault.com/mcp`. Every asset works across
|
|
|
175
175
|
|
|
176
176
|
- **`get_trade_call`** <sub>(alias `get_trade_signal`)</sub> — composite BUY/SELL/HOLD verdict with confidence + regime, any asset, any timeframe.
|
|
177
177
|
- **`scan_trade_calls`** — scans the top-N perps by open interest on a venue; returns every actionable call in one shot.
|
|
178
|
-
- **`scan_funding_arb`** — cross-venue funding-rate spreads, ranked. The only MCP server doing multi-exchange derivatives arbitrage.
|
|
178
|
+
- **`scan_funding_arb`** — cross-venue funding-rate spreads across 7 venues (Hyperliquid, Binance, Bybit, Gate, KuCoin, Aster, OKX), ranked. The only MCP server doing multi-exchange derivatives arbitrage.
|
|
179
179
|
- **`get_market_regime`** — classifies TRENDING_UP / TRENDING_DOWN / RANGING / VOLATILE for strategy selection.
|
|
180
180
|
- **`search_knowledge`** + **`chat_knowledge`** — free BM25 search and grounded Q&A over the full knowledge bundle.
|
|
181
181
|
|
|
@@ -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 970+ | All 970+ | All 970+ | All 970+ | All 970+ | <!-- 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,26 @@ 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.
|
|
245
|
+
## What's new in v1.23.0
|
|
246
246
|
|
|
247
|
-
-
|
|
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
|
+
- **📡 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.
|
|
253
248
|
|
|
254
|
-
|
|
255
|
-
|
|
249
|
+
> MCP clients cache `tools/list` at session start — toggle the connector off/on (or restart the MCP connection) to pick up the updated `scan_funding_arb`.
|
|
250
|
+
|
|
251
|
+
### v1.22.0 highlights (recap)
|
|
252
|
+
|
|
253
|
+
- **🌐 <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.
|
|
254
|
+
- **🏆 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.
|
|
255
|
+
- **🔁 Forward-stable coverage.** The venue count reads live everywhere it appears, so coverage stays accurate as we keep adding venues.
|
|
256
|
+
|
|
257
|
+
> **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.
|
|
258
|
+
|
|
259
|
+
### v1.21.0 highlights (recap)
|
|
260
|
+
|
|
261
|
+
- **📊 `scan_trade_calls` ranking lenses (`rankBy`)** — rank the scan universe 9 ways (funding, gainers/losers, volume, open interest, volatility, 24h OI change) + aliases.
|
|
262
|
+
- **🧾 Verdict receipts (`_receipts`)** — inline conviction, top factors, live track record, and a verify link on every verdict.
|
|
263
|
+
- **🔌 Gemini, Kraken & Alpaca pairings** · **🏆 live track-record leaderboard** · **🎁 referral program** · **💸 pay-per-call** on the trade-call & scanner routes.
|
|
264
|
+
- **🔒 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
265
|
|
|
257
266
|
### v1.20.0 highlights (recap)
|
|
258
267
|
|
|
@@ -263,29 +272,6 @@ Payment-path and webhook hardening: x402 per-route price binding + replay protec
|
|
|
263
272
|
|
|
264
273
|
> MCP clients cache `tools/list` at session start — toggle the connector off/on (or restart the MCP connection) to see `scan_trade_calls`.
|
|
265
274
|
|
|
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
275
|
---
|
|
290
276
|
|
|
291
277
|
## Privacy
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* offerings.ts — Virtuals ACP offering definitions + requirement schemas (P1-ACP-SELLER-SEED).
|
|
3
|
+
*
|
|
4
|
+
* The launch set of paid AlgoVault offerings on Virtuals ACP. Each offering maps a
|
|
5
|
+
* buyer-facing offering NAME → an existing HTTP_TOOLS handler (the reuse seam) + a draft-07
|
|
6
|
+
* JSON Schema for the requirement payload (ajv-validated by the worker before setBudget).
|
|
7
|
+
*
|
|
8
|
+
* DUAL ROLE:
|
|
9
|
+
* 1. The Source-of-Truth Mr.1 copy-pastes into the app.virtuals.io Seller profile
|
|
10
|
+
* (docs/RUNBOOK-VIRTUALS-ACP-ONBOARDING.md) — name + description + requirement schema.
|
|
11
|
+
* 2. The worker's offering→tool dispatch map: the seller reads back the offering name via
|
|
12
|
+
* `session.job?.description` (set by the buyer's createJobFromOffering) and looks it up here.
|
|
13
|
+
*
|
|
14
|
+
* DATA + TYPES ONLY — imports NO runtime handler (cycle-free), mirrors feature-registry.ts.
|
|
15
|
+
* The acp-flagged tool SET lives in the registry (`channels.acp`); this module owns the SURFACE
|
|
16
|
+
* (offering name + schema + tool mapping) LOCALLY. A coverage canary (tests/unit) asserts every
|
|
17
|
+
* `channels.acp` tool has an offering here — the channel-derives-set-from-registry pattern: the
|
|
18
|
+
* registry decides membership, the consumer decides presentation, the canary enforces no-drift.
|
|
19
|
+
*
|
|
20
|
+
* Buyer-facing copy uses the canonical tool name `get_trade_call` (NEVER the back-compat alias
|
|
21
|
+
* `get_trade_signal`); the alias is only the internal HTTP_TOOLS dispatch key.
|
|
22
|
+
*/
|
|
23
|
+
import type { HttpTool } from '../../lib/x402-http-routes.js';
|
|
24
|
+
/** Virtuals ACP SLA floor (SDK `MIN_SLA_MINS`). Signal lookups are sub-second/synchronous. */
|
|
25
|
+
export declare const ACP_SLA_MINUTES = 5;
|
|
26
|
+
export interface AcpOffering {
|
|
27
|
+
/** Buyer-facing offering name. MUST match the name registered on the Virtuals profile —
|
|
28
|
+
* the seller reads it back via `session.job?.description` to dispatch. */
|
|
29
|
+
name: string;
|
|
30
|
+
/** Canonical AlgoVault tool this offering fulfils (public copy uses this, not the alias). */
|
|
31
|
+
canonicalTool: string;
|
|
32
|
+
/** The HTTP_TOOLS handler key `callCoreHandler` dispatches on (get_trade_call → get_trade_signal). */
|
|
33
|
+
httpTool: HttpTool;
|
|
34
|
+
/** One-line TDQS-grade description mirroring the live MCP tool description. */
|
|
35
|
+
description: string;
|
|
36
|
+
/** Draft-07 JSON Schema for the job requirement payload (ajv-validated before setBudget). */
|
|
37
|
+
requirementSchema: Record<string, unknown>;
|
|
38
|
+
/** SLA in minutes (Virtuals floor = 5). */
|
|
39
|
+
slaMinutes: number;
|
|
40
|
+
}
|
|
41
|
+
export declare const ACP_OFFERINGS: readonly AcpOffering[];
|
|
42
|
+
/** Resolve an offering by its buyer-facing name (== `session.job?.description`). */
|
|
43
|
+
/** Normalize an offering name for matching — case/space/underscore-insensitive — so the worker
|
|
44
|
+
* tolerates the platform's registration naming (e.g. "AlgoVault Trade Call" registered as
|
|
45
|
+
* "algovault_tradecall" / "algoVault_MarketScan"). The buyer's job.description is matched via this. */
|
|
46
|
+
export declare function normalizeOfferingName(s: string): string;
|
|
47
|
+
export declare function offeringByName(name: string | null | undefined): AcpOffering | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* The canonical tools that HAVE an ACP offering here — the surface-coverage canary target.
|
|
50
|
+
* A `channels.acp`-flagged registry tool with no entry in this set fails the coverage test.
|
|
51
|
+
*/
|
|
52
|
+
export declare function acpOfferedTools(): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Project a validated requirement payload → the flat params `callCoreHandler` expects.
|
|
55
|
+
* Picks ONLY the schema-declared property keys (drops unknowns) so the deliverable path is
|
|
56
|
+
* byte-parity with the x402/MCP handlers for the same inputs.
|
|
57
|
+
*/
|
|
58
|
+
export declare function requirementToParams(offering: AcpOffering, requirement: Record<string, unknown>): Record<string, unknown>;
|
|
59
|
+
//# sourceMappingURL=offerings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offerings.d.ts","sourceRoot":"","sources":["../../../src/channels/acp/offerings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D,8FAA8F;AAC9F,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,MAAM,WAAW,WAAW;IAC1B;+EAC2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,6FAA6F;IAC7F,aAAa,EAAE,MAAM,CAAC;IACtB,sGAAsG;IACtG,QAAQ,EAAE,QAAQ,CAAC;IACnB,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,6FAA6F;IAC7F,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EA2D9C,CAAC;AAEH,oFAAoF;AACpF;;wGAEwG;AACxG,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAMvF;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOxH"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ACP_OFFERINGS = exports.ACP_SLA_MINUTES = void 0;
|
|
4
|
+
exports.normalizeOfferingName = normalizeOfferingName;
|
|
5
|
+
exports.offeringByName = offeringByName;
|
|
6
|
+
exports.acpOfferedTools = acpOfferedTools;
|
|
7
|
+
exports.requirementToParams = requirementToParams;
|
|
8
|
+
/** Virtuals ACP SLA floor (SDK `MIN_SLA_MINS`). Signal lookups are sub-second/synchronous. */
|
|
9
|
+
exports.ACP_SLA_MINUTES = 5;
|
|
10
|
+
exports.ACP_OFFERINGS = Object.freeze([
|
|
11
|
+
{
|
|
12
|
+
name: 'AlgoVault Trade Call',
|
|
13
|
+
canonicalTool: 'get_trade_call',
|
|
14
|
+
httpTool: 'get_trade_signal',
|
|
15
|
+
description: 'Composite perp trade verdict (BUY / SELL / HOLD) with confidence score and market regime for a crypto asset, aggregated across 5 perp venues. Read-only; on-chain Merkle-verified track record.',
|
|
16
|
+
requirementSchema: {
|
|
17
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
18
|
+
type: 'object',
|
|
19
|
+
additionalProperties: false,
|
|
20
|
+
required: ['coin'],
|
|
21
|
+
properties: {
|
|
22
|
+
coin: { type: 'string', minLength: 1, maxLength: 20, description: 'Asset ticker, e.g. BTC, ETH, SOL.' },
|
|
23
|
+
timeframe: { type: 'string', description: 'Candle timeframe (e.g. 15m, 1h, 4h, 1d). Defaults to 1h.' },
|
|
24
|
+
exchange: { type: 'string', description: 'Optional perp venue override (e.g. BINANCE, BYBIT, HL).' },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
slaMinutes: exports.ACP_SLA_MINUTES,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'AlgoVault Market Scan',
|
|
31
|
+
canonicalTool: 'scan_trade_calls',
|
|
32
|
+
httpTool: 'scan_trade_calls',
|
|
33
|
+
description: 'Ranked multi-asset scan of actionable perp trade calls across the venue universe — verdict, confidence and regime per asset. Read-only.',
|
|
34
|
+
requirementSchema: {
|
|
35
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
36
|
+
type: 'object',
|
|
37
|
+
additionalProperties: false,
|
|
38
|
+
properties: {
|
|
39
|
+
topN: { type: 'integer', minimum: 1, maximum: 50, description: 'How many top-ranked assets to score.' },
|
|
40
|
+
timeframe: { type: 'string', description: 'Candle timeframe (default 1h).' },
|
|
41
|
+
exchange: { type: 'string', description: 'Optional venue filter.' },
|
|
42
|
+
rankBy: { type: 'string', description: 'Universe-selection lens (default oi).' },
|
|
43
|
+
minConfidence: { type: 'number', minimum: 0, maximum: 100, description: 'Minimum confidence filter.' },
|
|
44
|
+
includeHolds: { type: 'boolean', description: 'Include HOLD verdicts in the result.' },
|
|
45
|
+
limit: { type: 'integer', minimum: 1, maximum: 50, description: 'Max rows returned.' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
slaMinutes: exports.ACP_SLA_MINUTES,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'AlgoVault Funding Arb',
|
|
52
|
+
canonicalTool: 'scan_funding_arb',
|
|
53
|
+
httpTool: 'scan_funding_arb',
|
|
54
|
+
description: 'Cross-venue perpetual funding-rate arbitrage scanner — ranked spread opportunities with urgency and conviction. Read-only.',
|
|
55
|
+
requirementSchema: {
|
|
56
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
57
|
+
type: 'object',
|
|
58
|
+
additionalProperties: false,
|
|
59
|
+
properties: {
|
|
60
|
+
minSpreadBps: { type: 'number', minimum: 0, description: 'Minimum funding spread in basis points (default 5).' },
|
|
61
|
+
limit: { type: 'integer', minimum: 1, maximum: 50, description: 'Max opportunities returned (default 10).' },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
slaMinutes: exports.ACP_SLA_MINUTES,
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
/** Resolve an offering by its buyer-facing name (== `session.job?.description`). */
|
|
68
|
+
/** Normalize an offering name for matching — case/space/underscore-insensitive — so the worker
|
|
69
|
+
* tolerates the platform's registration naming (e.g. "AlgoVault Trade Call" registered as
|
|
70
|
+
* "algovault_tradecall" / "algoVault_MarketScan"). The buyer's job.description is matched via this. */
|
|
71
|
+
function normalizeOfferingName(s) {
|
|
72
|
+
return s.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
73
|
+
}
|
|
74
|
+
function offeringByName(name) {
|
|
75
|
+
if (!name)
|
|
76
|
+
return undefined;
|
|
77
|
+
const exact = exports.ACP_OFFERINGS.find((o) => o.name === name);
|
|
78
|
+
if (exact)
|
|
79
|
+
return exact;
|
|
80
|
+
const norm = normalizeOfferingName(name);
|
|
81
|
+
return exports.ACP_OFFERINGS.find((o) => normalizeOfferingName(o.name) === norm);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The canonical tools that HAVE an ACP offering here — the surface-coverage canary target.
|
|
85
|
+
* A `channels.acp`-flagged registry tool with no entry in this set fails the coverage test.
|
|
86
|
+
*/
|
|
87
|
+
function acpOfferedTools() {
|
|
88
|
+
return exports.ACP_OFFERINGS.map((o) => o.canonicalTool);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Project a validated requirement payload → the flat params `callCoreHandler` expects.
|
|
92
|
+
* Picks ONLY the schema-declared property keys (drops unknowns) so the deliverable path is
|
|
93
|
+
* byte-parity with the x402/MCP handlers for the same inputs.
|
|
94
|
+
*/
|
|
95
|
+
function requirementToParams(offering, requirement) {
|
|
96
|
+
const props = (offering.requirementSchema.properties ?? {});
|
|
97
|
+
const out = {};
|
|
98
|
+
for (const key of Object.keys(props)) {
|
|
99
|
+
if (requirement[key] !== undefined)
|
|
100
|
+
out[key] = requirement[key];
|
|
101
|
+
}
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=offerings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offerings.js","sourceRoot":"","sources":["../../../src/channels/acp/offerings.ts"],"names":[],"mappings":";;;AA4GA,sDAEC;AAED,wCAMC;AAMD,0CAEC;AAOD,kDAOC;AApHD,8FAA8F;AACjF,QAAA,eAAe,GAAG,CAAC,CAAC;AAkBpB,QAAA,aAAa,GAA2B,MAAM,CAAC,MAAM,CAAC;IACjE;QACE,IAAI,EAAE,sBAAsB;QAC5B,aAAa,EAAE,gBAAgB;QAC/B,QAAQ,EAAE,kBAAkB;QAC5B,WAAW,EACT,iMAAiM;QACnM,iBAAiB,EAAE;YACjB,OAAO,EAAE,yCAAyC;YAClD,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;YAC3B,QAAQ,EAAE,CAAC,MAAM,CAAC;YAClB,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,EAAE,mCAAmC,EAAE;gBACvG,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0DAA0D,EAAE;gBACtG,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yDAAyD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,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The subset of the SDK `AssetToken` the worker/stub reference (a real AssetToken is assignable).
|
|
3
|
+
* Defined locally so this CJS module never type-imports the ESM-only SDK (avoids TS1541); the SDK
|
|
4
|
+
* value is only ever touched via the dynamic import in createLiveAcpAgent.
|
|
5
|
+
*/
|
|
6
|
+
export interface AssetTokenLike {
|
|
7
|
+
readonly amount: number;
|
|
8
|
+
readonly symbol: string;
|
|
9
|
+
}
|
|
10
|
+
/** The subset of the SDK `JobSession` the seller worker touches (a real JobSession is assignable). */
|
|
11
|
+
export interface SellerSession {
|
|
12
|
+
readonly jobId: string;
|
|
13
|
+
readonly chainId: number;
|
|
14
|
+
readonly roles: readonly string[];
|
|
15
|
+
readonly status: string;
|
|
16
|
+
readonly job: {
|
|
17
|
+
readonly description?: string | null;
|
|
18
|
+
} | null;
|
|
19
|
+
readonly entries: readonly SellerEntry[];
|
|
20
|
+
setBudget(amount: AssetTokenLike): Promise<void>;
|
|
21
|
+
submit(deliverable: string): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
/** The subset of the SDK `JobRoomEntry` the worker inspects (a real JobRoomEntry is assignable). */
|
|
24
|
+
export type SellerEntry = {
|
|
25
|
+
kind: 'system';
|
|
26
|
+
event: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'message';
|
|
31
|
+
contentType: string;
|
|
32
|
+
content: string;
|
|
33
|
+
from?: string;
|
|
34
|
+
};
|
|
35
|
+
export type SellerEntryHandler = (session: SellerSession, entry: SellerEntry) => void | Promise<void>;
|
|
36
|
+
/** The subset of the SDK `AcpAgent` the worker drives. */
|
|
37
|
+
export interface SellerAgent {
|
|
38
|
+
on(event: 'entry', handler: SellerEntryHandler): unknown;
|
|
39
|
+
start(onConnected?: () => void): Promise<void>;
|
|
40
|
+
stop(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
/** Denominate a USD budget in USDC on a chain (SDK `AssetToken.usdc`). */
|
|
43
|
+
export type UsdcFactory = (amountUsd: number, chainId: number) => AssetTokenLike;
|
|
44
|
+
/** What the worker needs to run a session, regardless of live/stub mode. */
|
|
45
|
+
export interface AcpAgentBundle {
|
|
46
|
+
agent: SellerAgent;
|
|
47
|
+
usdc: UsdcFactory;
|
|
48
|
+
/** Default chainId for stub/dry-run lifecycles (real sessions carry their own). */
|
|
49
|
+
chainId: number;
|
|
50
|
+
}
|
|
51
|
+
export type AcpMode = 'off' | 'stub' | 'live';
|
|
52
|
+
export type AcpNetwork = 'testnet' | 'mainnet';
|
|
53
|
+
export interface AcpEnv {
|
|
54
|
+
ACP_ENABLED?: string;
|
|
55
|
+
/** 'testnet' (default, Base Sepolia) | 'mainnet' (Base). Mainnet flip = a separate Mr.1-gated wave. */
|
|
56
|
+
ACP_ENV?: string;
|
|
57
|
+
/** app.virtuals.io Signers tab → walletAddress / walletId / signerPrivateKey. */
|
|
58
|
+
ACP_WALLET_ADDRESS?: string;
|
|
59
|
+
ACP_WALLET_ID?: string;
|
|
60
|
+
ACP_SIGNER_PRIVATE_KEY?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface AcpConfig {
|
|
63
|
+
enabled: boolean;
|
|
64
|
+
network: AcpNetwork;
|
|
65
|
+
walletAddress?: string;
|
|
66
|
+
walletId?: string;
|
|
67
|
+
signerPrivateKey?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface ResolvedAcp {
|
|
70
|
+
active: boolean;
|
|
71
|
+
mode: AcpMode;
|
|
72
|
+
network: AcpNetwork;
|
|
73
|
+
stubFellBack: boolean;
|
|
74
|
+
walletAddress?: string;
|
|
75
|
+
walletId?: string;
|
|
76
|
+
signerPrivateKey?: string;
|
|
77
|
+
}
|
|
78
|
+
export declare function resolveAcpConfig(env?: AcpEnv): AcpConfig;
|
|
79
|
+
/**
|
|
80
|
+
* PURE decision (no construction, no I/O) — the two-flag + stub-fallback rule:
|
|
81
|
+
* ACP_ENABLED!=true → off (worker never starts)
|
|
82
|
+
* enabled + walletAddress+walletId+signerPrivateKey → live (Base Sepolia sandbox by default)
|
|
83
|
+
* enabled + any signer cred missing → stub (dark synthetic lifecycle)
|
|
84
|
+
*/
|
|
85
|
+
export declare function selectAcp(cfg: AcpConfig): ResolvedAcp;
|
|
86
|
+
/**
|
|
87
|
+
* Construct the real ACP seller agent for the selected network. LIVE-UNVERIFIED end-to-end until
|
|
88
|
+
* Mr.1 provisions signer creds + completes app.virtuals.io onboarding (R7); typed + compiles against
|
|
89
|
+
* the pinned 0.1.7 types. The caller (the worker) wraps this in try/catch → boot-safe (never crash-loops).
|
|
90
|
+
* DATA-INTEGRITY: the only chain interactions are the SDK's escrow ops (setBudget/submit/fund =
|
|
91
|
+
* USDC settlement); the deliverable is posted off-chain via the SDK job API. No signal data on-chain.
|
|
92
|
+
*/
|
|
93
|
+
export declare function createLiveAcpAgent(resolved: ResolvedAcp): Promise<AcpAgentBundle>;
|
|
94
|
+
/**
|
|
95
|
+
* StubAcpAgent — drives ONE scripted job (offering "AlgoVault Trade Call", BTC) through the
|
|
96
|
+
* registered handler on start(): requirement(open) → job.funded → job.completed. Exercises the full
|
|
97
|
+
* seller path offline so the dry-run logs the lifecycle against a Base Sepolia mock chainId. The
|
|
98
|
+
* job.funded step invokes the REAL tool via the worker's callTool (byte-parity proof).
|
|
99
|
+
*/
|
|
100
|
+
export declare class StubAcpAgent implements SellerAgent {
|
|
101
|
+
private readonly chainId;
|
|
102
|
+
private readonly log;
|
|
103
|
+
private handler;
|
|
104
|
+
constructor(chainId?: number, log?: (m: string) => void);
|
|
105
|
+
on(_event: 'entry', handler: SellerEntryHandler): this;
|
|
106
|
+
stop(): Promise<void>;
|
|
107
|
+
start(onConnected?: () => void): Promise<void>;
|
|
108
|
+
}
|
|
109
|
+
/** Stub bundle — fake USDC factory (no SDK runtime), synthetic agent. */
|
|
110
|
+
export declare function createStubAcpAgent(log?: (m: string) => void): AcpAgentBundle;
|
|
111
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/channels/acp/provider.ts"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AACD,sGAAsG;AACtG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE;QAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9D,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AACD,oGAAoG;AACpG,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,WAAW,EA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", { value: true });
|
|
3
|
+
exports.StubAcpAgent = void 0;
|
|
4
|
+
exports.resolveAcpConfig = resolveAcpConfig;
|
|
5
|
+
exports.selectAcp = selectAcp;
|
|
6
|
+
exports.createLiveAcpAgent = createLiveAcpAgent;
|
|
7
|
+
exports.createStubAcpAgent = createStubAcpAgent;
|
|
8
|
+
/**
|
|
9
|
+
* provider.ts — Virtuals ACP seller provider adapter + Stub (P1-ACP-SELLER-SEED / R2).
|
|
10
|
+
*
|
|
11
|
+
* Single file that absorbs SDK churn: env → resolveAcpConfig → pure selectAcp (the unit-test
|
|
12
|
+
* seam) → construct. Mirrors src/lib/okx-a2mcp.ts (the sibling agent-commerce channel).
|
|
13
|
+
*
|
|
14
|
+
* TWO-FLAG FIREWALL:
|
|
15
|
+
* - outer `ACP_ENABLED` (default false) → selectAcp returns mode 'off' → the worker never
|
|
16
|
+
* starts → prod is byte-identical; flip = instant rollback.
|
|
17
|
+
* - inner per-tool `channels.acp` in the registry → decides WHICH tools are offered (the
|
|
18
|
+
* offering set derives from the registry via offerings.ts + the coverage canary).
|
|
19
|
+
* STUB-FIRST: `ACP_ENABLED=true` but signer creds absent → StubAcpAgent (synthetic lifecycle,
|
|
20
|
+
* no network) — the wave's default dark behavior + the dry-run/unit-tested surface.
|
|
21
|
+
*
|
|
22
|
+
* ESM-INTEROP: @virtuals-protocol/acp-node-v2 is an ESM-only package ("type":"module"); this
|
|
23
|
+
* repo compiles CommonJS (tsconfig module=Node16, no top-level "type"). A static `import` of the
|
|
24
|
+
* SDK from a CJS file fails tsc (TS1479), so the SDK RUNTIME values are loaded via a dynamic
|
|
25
|
+
* `import()` inside the async live path (Node16 preserves import() in CJS emit → loads the ESM
|
|
26
|
+
* package at runtime on Node 20). SDK TYPES arrive via `import type` (erased, no require). Importing
|
|
27
|
+
* THIS module is therefore side-effect-free (the SDK is touched only inside createLiveAcpAgent).
|
|
28
|
+
*/
|
|
29
|
+
const chains_1 = require("viem/chains");
|
|
30
|
+
function resolveAcpConfig(env = process.env) {
|
|
31
|
+
const network = env.ACP_ENV?.trim().toLowerCase() === 'mainnet' ? 'mainnet' : 'testnet';
|
|
32
|
+
return {
|
|
33
|
+
enabled: env.ACP_ENABLED?.trim().toLowerCase() === 'true',
|
|
34
|
+
network,
|
|
35
|
+
walletAddress: env.ACP_WALLET_ADDRESS?.trim() || undefined,
|
|
36
|
+
walletId: env.ACP_WALLET_ID?.trim() || undefined,
|
|
37
|
+
signerPrivateKey: env.ACP_SIGNER_PRIVATE_KEY?.trim() || undefined,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* PURE decision (no construction, no I/O) — the two-flag + stub-fallback rule:
|
|
42
|
+
* ACP_ENABLED!=true → off (worker never starts)
|
|
43
|
+
* enabled + walletAddress+walletId+signerPrivateKey → live (Base Sepolia sandbox by default)
|
|
44
|
+
* enabled + any signer cred missing → stub (dark synthetic lifecycle)
|
|
45
|
+
*/
|
|
46
|
+
function selectAcp(cfg) {
|
|
47
|
+
if (!cfg.enabled)
|
|
48
|
+
return { active: false, mode: 'off', network: cfg.network, stubFellBack: false };
|
|
49
|
+
const credsPresent = Boolean(cfg.walletAddress && cfg.walletId && cfg.signerPrivateKey);
|
|
50
|
+
if (credsPresent) {
|
|
51
|
+
return {
|
|
52
|
+
active: true, mode: 'live', network: cfg.network, stubFellBack: false,
|
|
53
|
+
walletAddress: cfg.walletAddress, walletId: cfg.walletId, signerPrivateKey: cfg.signerPrivateKey,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return { active: true, mode: 'stub', network: cfg.network, stubFellBack: true };
|
|
57
|
+
}
|
|
58
|
+
// ─────────────────── live agent construction (dynamic import → ESM SDK from CJS) ───────────────────
|
|
59
|
+
/**
|
|
60
|
+
* Construct the real ACP seller agent for the selected network. LIVE-UNVERIFIED end-to-end until
|
|
61
|
+
* Mr.1 provisions signer creds + completes app.virtuals.io onboarding (R7); typed + compiles against
|
|
62
|
+
* the pinned 0.1.7 types. The caller (the worker) wraps this in try/catch → boot-safe (never crash-loops).
|
|
63
|
+
* DATA-INTEGRITY: the only chain interactions are the SDK's escrow ops (setBudget/submit/fund =
|
|
64
|
+
* USDC settlement); the deliverable is posted off-chain via the SDK job API. No signal data on-chain.
|
|
65
|
+
*/
|
|
66
|
+
async function createLiveAcpAgent(resolved) {
|
|
67
|
+
const sdk = await import('@virtuals-protocol/acp-node-v2');
|
|
68
|
+
const isTestnet = resolved.network !== 'mainnet';
|
|
69
|
+
const serverUrl = isTestnet ? sdk.ACP_TESTNET_SERVER_URL : sdk.ACP_SERVER_URL;
|
|
70
|
+
// The Privy app-id follows the AGENT WALLET's environment, NOT the ACP job network: an agent minted
|
|
71
|
+
// on the production Virtuals console lives on the prod Privy app even when its jobs run on the Base
|
|
72
|
+
// Sepolia sandbox. Default to the network-based id, but ACP_PRIVY_APP_ID overrides it (no-redeploy
|
|
73
|
+
// toggle) so a prod-console wallet can settle sandbox jobs.
|
|
74
|
+
const privyAppId = process.env.ACP_PRIVY_APP_ID?.trim() || (isTestnet ? sdk.TESTNET_PRIVY_APP_ID : sdk.PRIVY_APP_ID);
|
|
75
|
+
const chain = isTestnet ? chains_1.baseSepolia : chains_1.base;
|
|
76
|
+
const provider = await sdk.PrivyAlchemyEvmProviderAdapter.create({
|
|
77
|
+
walletAddress: resolved.walletAddress,
|
|
78
|
+
walletId: resolved.walletId,
|
|
79
|
+
signerPrivateKey: resolved.signerPrivateKey,
|
|
80
|
+
chains: [chain],
|
|
81
|
+
serverUrl,
|
|
82
|
+
privyAppId,
|
|
83
|
+
});
|
|
84
|
+
const agent = await sdk.AcpAgent.create({
|
|
85
|
+
provider,
|
|
86
|
+
transport: new sdk.SseTransport({ serverUrl }),
|
|
87
|
+
api: new sdk.AcpApiClient({ serverUrl }),
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
agent: agent,
|
|
91
|
+
usdc: (amountUsd, chainId) => sdk.AssetToken.usdc(amountUsd, chainId),
|
|
92
|
+
chainId: chain.id,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// ─────────────────── stub agent (no network, no creds) — default dark behavior + dry-run surface ───────────────────
|
|
96
|
+
class StubSellerSession {
|
|
97
|
+
jobId;
|
|
98
|
+
chainId;
|
|
99
|
+
roles;
|
|
100
|
+
job;
|
|
101
|
+
log;
|
|
102
|
+
status = 'open';
|
|
103
|
+
entries = [];
|
|
104
|
+
constructor(jobId, chainId, roles, job, log) {
|
|
105
|
+
this.jobId = jobId;
|
|
106
|
+
this.chainId = chainId;
|
|
107
|
+
this.roles = roles;
|
|
108
|
+
this.job = job;
|
|
109
|
+
this.log = log;
|
|
110
|
+
}
|
|
111
|
+
async setBudget(amount) {
|
|
112
|
+
this.log(`[STUB ACP] setBudget job=${this.jobId} budget=${amount.amount} ${amount.symbol}`);
|
|
113
|
+
this.status = 'budget_set';
|
|
114
|
+
}
|
|
115
|
+
async submit(deliverable) {
|
|
116
|
+
const preview = deliverable.length > 140 ? `${deliverable.slice(0, 140)}…` : deliverable;
|
|
117
|
+
this.log(`[STUB ACP] submit job=${this.jobId} deliverable=${preview}`);
|
|
118
|
+
this.status = 'submitted';
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* StubAcpAgent — drives ONE scripted job (offering "AlgoVault Trade Call", BTC) through the
|
|
123
|
+
* registered handler on start(): requirement(open) → job.funded → job.completed. Exercises the full
|
|
124
|
+
* seller path offline so the dry-run logs the lifecycle against a Base Sepolia mock chainId. The
|
|
125
|
+
* job.funded step invokes the REAL tool via the worker's callTool (byte-parity proof).
|
|
126
|
+
*/
|
|
127
|
+
class StubAcpAgent {
|
|
128
|
+
chainId;
|
|
129
|
+
log;
|
|
130
|
+
handler = null;
|
|
131
|
+
constructor(chainId = chains_1.baseSepolia.id, log = console.log) {
|
|
132
|
+
this.chainId = chainId;
|
|
133
|
+
this.log = log;
|
|
134
|
+
}
|
|
135
|
+
on(_event, handler) {
|
|
136
|
+
this.handler = handler;
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
async stop() {
|
|
140
|
+
/* no-op */
|
|
141
|
+
}
|
|
142
|
+
async start(onConnected) {
|
|
143
|
+
this.log('[STUB ACP] seller agent started (no creds → dark). Running one synthetic job…');
|
|
144
|
+
onConnected?.();
|
|
145
|
+
const h = this.handler;
|
|
146
|
+
if (!h)
|
|
147
|
+
return;
|
|
148
|
+
const session = new StubSellerSession('stub-job-1', this.chainId, ['provider'], { description: 'AlgoVault Trade Call' }, this.log);
|
|
149
|
+
const dispatch = async (entry) => {
|
|
150
|
+
session.entries.push(entry);
|
|
151
|
+
await h(session, entry);
|
|
152
|
+
};
|
|
153
|
+
await dispatch({ kind: 'message', contentType: 'requirement', content: JSON.stringify({ coin: 'BTC', timeframe: '1h' }) });
|
|
154
|
+
session.status = 'funded';
|
|
155
|
+
await dispatch({ kind: 'system', event: { type: 'job.funded' } });
|
|
156
|
+
session.status = 'completed';
|
|
157
|
+
await dispatch({ kind: 'system', event: { type: 'job.completed' } });
|
|
158
|
+
this.log('[STUB ACP] synthetic job complete.');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
exports.StubAcpAgent = StubAcpAgent;
|
|
162
|
+
/** Stub bundle — fake USDC factory (no SDK runtime), synthetic agent. */
|
|
163
|
+
function createStubAcpAgent(log = console.log) {
|
|
164
|
+
const usdc = (amountUsd) => ({ amount: amountUsd, symbol: 'USDC' });
|
|
165
|
+
return { agent: new StubAcpAgent(chains_1.baseSepolia.id, log), usdc, chainId: chains_1.baseSepolia.id };
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/channels/acp/provider.ts"],"names":[],"mappings":";;;AA+FA,4CASC;AAQD,8BAUC;AAUD,gDA4BC;AA+DD,gDAGC;AAlOD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wCAAgD;A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7B,MAAM,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IACjD,CAAC;CACF;AA9BD,oCA8BC;AAED,yEAAyE;AACzE,SAAgB,kBAAkB,CAAC,MAA2B,OAAO,CAAC,GAAG;IACvE,MAAM,IAAI,GAAgB,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACjF,OAAO,EAAE,KAAK,EAAE,IAAI,YAAY,CAAC,oBAAW,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,oBAAW,CAAC,EAAE,EAAE,CAAC;AACzF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type HttpTool } from '../../lib/x402-http-routes.js';
|
|
2
|
+
import type { LicenseInfo } from '../../types.js';
|
|
3
|
+
import { type SellerSession, type SellerEntry, type AcpEnv } from './provider.js';
|
|
4
|
+
/** Paid-tier license for ACP jobs — the ACP escrow IS the payment, so bypass the free quota
|
|
5
|
+
* counter exactly like the x402/a2mcp channels. Identical to what a paid x402 call resolves. */
|
|
6
|
+
export declare const ACP_X402_LICENSE: LicenseInfo;
|
|
7
|
+
/** Per-call price (USD) for a canonical tool from the registry SoT — same schedule as every channel
|
|
8
|
+
* (get_trade_call 0.02, scan_trade_calls 0.02, scan_funding_arb 0.01). */
|
|
9
|
+
export declare function acpPriceUsd(canonicalTool: string): number;
|
|
10
|
+
/** Injected dependencies — makes handleAcpEntry a pure unit (no SDK, no network) for testing. */
|
|
11
|
+
export interface AcpWorkerDeps {
|
|
12
|
+
/** Denominate a USD budget in USDC on the session chain (provider.usdc → SDK AssetToken.usdc). */
|
|
13
|
+
usdc: (amountUsd: number, chainId: number) => Parameters<SellerSession['setBudget']>[0];
|
|
14
|
+
/** Run the mapped tool through the shared x402 core handler (byte-parity with MCP/x402). */
|
|
15
|
+
callTool: (httpTool: HttpTool, params: Record<string, unknown>) => Promise<unknown>;
|
|
16
|
+
/** Canonical-tool → USD price (registry SoT). */
|
|
17
|
+
priceFor: (canonicalTool: string) => number;
|
|
18
|
+
/** In-process idempotency store — jobIds already delivered this run. */
|
|
19
|
+
submitted: Set<string>;
|
|
20
|
+
log?: (msg: string) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* PURE seller-entry handler (no SDK, no network — deps-injected). The tested unit.
|
|
24
|
+
* Returns a short status string for observability/testing.
|
|
25
|
+
*/
|
|
26
|
+
export declare function handleAcpEntry(session: SellerSession, entry: SellerEntry, deps: AcpWorkerDeps): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Boot the ACP seller worker. Gated by the outer `ACP_ENABLED` flag (default off → no-op, prod
|
|
29
|
+
* byte-identical). Boot-safe: any construction/start failure leaves ACP DARK (never crash-loops),
|
|
30
|
+
* mirroring okx-a2mcp's mount. Returns {mode, started} for observability/tests.
|
|
31
|
+
*/
|
|
32
|
+
export declare function startAcpSellerWorker(env?: AcpEnv): Promise<{
|
|
33
|
+
mode: string;
|
|
34
|
+
started: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
//# sourceMappingURL=seller-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seller-worker.d.ts","sourceRoot":"","sources":["../../../src/channels/acp/seller-worker.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,WAAW,EAEhB,KAAK,MAAM,EACZ,MAAM,eAAe,CAAC;AAEvB;iGACiG;AACjG,eAAO,MAAM,gBAAgB,EAAE,WAAyC,C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