@undesirables/plugin-tcg-oracle 1.1.0 → 2.0.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/LICENSE CHANGED
@@ -2,20 +2,81 @@ Business Source License 1.1
2
2
 
3
3
  Parameters
4
4
 
5
- Licensor: The Undesirables LLC
6
- Licensed Work: plugin-undesirables
7
- The Licensed Work is (c) 2026 The Undesirables LLC
8
- Additional Use Grant: You may use the Licensed Work for non-production purposes,
9
- personal projects, and evaluation. Production use requires
10
- a commercial license from The Undesirables LLC.
11
- Change Date: 2030-04-24
12
- Change License: MIT
13
-
14
- Notice
15
-
16
- The Business Source License (this document, or the "License") is not an Open
17
- Source license. However, the Licensed Work will eventually be made available
18
- under an Open Source License, as stated in this License.
19
-
20
- For more information on the Business Source License, please visit:
21
- https://mariadb.com/bsl11/
5
+ Licensor: The Undesirables LLC
6
+ Licensed Work: Plugin TCG Oracle
7
+ Copyright (c) 2026 The Undesirables LLC.
8
+ All Rights Reserved.
9
+ Additional Use Grant: You may make production use of the Licensed Work,
10
+ provided Your use does not include offering the
11
+ Licensed Work to third parties on a hosted or
12
+ embedded basis as a Competitive Offering.
13
+
14
+ A "Competitive Offering" is a product or service
15
+ offered to third parties on a paid basis (including
16
+ through paid support arrangements) that provides
17
+ TCG market intelligence, pricing aggregation, AI
18
+ card grading, or on-chain price oracle functionality
19
+ as a primary feature.
20
+
21
+ If Your product is not a Competitive Offering when
22
+ You first make it generally available, it will not
23
+ become a Competitive Offering later due to the
24
+ Licensor releasing a new version of the Licensed
25
+ Work with additional capabilities.
26
+
27
+ Products that are not provided on a paid basis are
28
+ not Competitive Offerings.
29
+
30
+ Change Date: June 1, 2030
31
+ Change License: MIT
32
+
33
+ For alternative licensing arrangements, contact:
34
+ theundesirables7@gmail.com
35
+
36
+ ─────────────────────────────────────────────────────────────────────────
37
+
38
+ Terms
39
+
40
+ The Licensor hereby grants you the right to copy, modify, create derivative
41
+ works, redistribute, and make non-production use of the Licensed Work. The
42
+ Licensor may make an Additional Use Grant, above, permitting limited
43
+ production use.
44
+
45
+ Effective on the Change Date, or the fourth anniversary of the first publicly
46
+ available distribution of a specific version of the Licensed Work under this
47
+ License, whichever comes first, the Licensor hereby grants you rights under
48
+ the terms of the Change License, and the rights granted in the paragraph
49
+ above terminate.
50
+
51
+ If your use of the Licensed Work does not comply with the requirements
52
+ currently in effect as described in this License, you must purchase a
53
+ commercial license from the Licensor, its affiliated entities, or authorized
54
+ resellers, or you must refrain from using the Licensed Work.
55
+
56
+ All copies of the original and modified Licensed Work, and derivative works
57
+ of the Licensed Work, are subject to this License. This License applies
58
+ separately for each version of the Licensed Work and the Change Date may
59
+ vary for each version of the Licensed Work released by Licensor.
60
+
61
+ You must conspicuously display this License on each original or modified copy
62
+ of the Licensed Work. If you receive the Licensed Work in original or
63
+ modified form from a third party, the terms and conditions set forth in this
64
+ License apply to your use of that work.
65
+
66
+ Any use of the Licensed Work in violation of this License will automatically
67
+ terminate your rights under this License for the current and all other
68
+ versions of the Licensed Work.
69
+
70
+ This License does not grant you any right in any trademark or logo of
71
+ Licensor or its affiliates (provided that you may use a trademark or logo of
72
+ Licensor as expressly required by this License).
73
+
74
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
75
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
76
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
77
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
78
+ TITLE.
79
+
80
+ ─────────────────────────────────────────────────────────────────────────
81
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
82
+ BUSL-1.1 license template: https://mariadb.com/bsl11/
package/README.md CHANGED
@@ -1,11 +1,36 @@
1
- # @undesirables/plugin-tcg-oracle
1
+ <div align="center">
2
2
 
3
3
  ![TCG Oracle Banner](./images/banner.jpg)
4
4
 
5
- [![npm](https://img.shields.io/npm/v/@undesirables/plugin-tcg-oracle)](https://www.npmjs.com/package/@undesirables/plugin-tcg-oracle)
6
- [![License: BUSL-1.1](https://img.shields.io/badge/License-BUSL--1.1-blue)](LICENSE)
5
+ # @undesirables/plugin-tcg-oracle
6
+
7
+ **Give any ElizaOS agent real trading card market intelligence — search, grade, and forecast.**
8
+
9
+ [![npm](https://img.shields.io/npm/v/@undesirables/plugin-tcg-oracle?style=flat-square)](https://www.npmjs.com/package/@undesirables/plugin-tcg-oracle)
10
+ [![npm downloads](https://img.shields.io/npm/dm/@undesirables/plugin-tcg-oracle?style=flat-square)](https://www.npmjs.com/package/@undesirables/plugin-tcg-oracle)
11
+ [![License: BUSL-1.1](https://img.shields.io/badge/License-BUSL--1.1-red?style=flat-square)](LICENSE)
12
+ [![ElizaOS](https://img.shields.io/badge/ElizaOS-Compatible-5A67D8?style=flat-square&logo=data:image/svg+xml;base64,&logoColor=white)](https://elizaos.ai)
13
+ [![Games](https://img.shields.io/badge/Games-Pok%C3%A9mon%20%C2%B7%20MTG%20%C2%B7%20Yu--Gi--Oh!-ff14a0?style=flat-square)](https://tcgcsv.com)
14
+
15
+ [npm](https://www.npmjs.com/package/@undesirables/plugin-tcg-oracle) · [TCG Oracle API](https://the-undesirables.com/docs) · [Kaggle Dataset](https://www.kaggle.com/datasets/sailorpepe/tcg-market-intelligence)
16
+
17
+ </div>
18
+
19
+ ---
20
+
21
+ ## Table of Contents
7
22
 
8
- > Give any ElizaOS agent real trading card market intelligence — search 370K+ products, grade cards with AI vision, and simulate future prices with Monte Carlo models.
23
+ - [Why This Exists](#why-this-exists)
24
+ - [Quick Start](#quick-start)
25
+ - [Actions](#actions)
26
+ - [How It Works](#how-it-works)
27
+ - [Supported Games](#supported-games-25)
28
+ - [How the Data Works](#how-the-data-works)
29
+ - [Self-Hosting](#self-hosting)
30
+ - [Configuration](#configuration)
31
+ - [Architecture](#architecture)
32
+ - [Related Projects](#related-projects)
33
+ - [License & Commercial Use](#-license--commercial-use)
9
34
 
10
35
  ---
11
36
 
@@ -15,9 +40,9 @@ The trading card market is worth **$50 billion** and growing. Millions of people
15
40
 
16
41
  This plugin gives your ElizaOS agent the ability to do all of that in one conversation:
17
42
 
18
- 1. **"Search for Charizard cards"** → Instantly searches 370K+ real products across 25 games
43
+ 1. **"Search for Charizard cards"** → Instantly searches 446K+ real products across 25+ games
19
44
  2. **"Grade this card"** → AI vision analyzes centering, corners, edges, surface → predicts PSA/Beckett score
20
- 3. **"Simulate Charizard VMAX at $350 for 60 days"** → Runs 10,000 Monte Carlo simulations using Heston, Merton, or Kou stochastic models → returns percentile price bands
45
+ 3. **"Simulate Charizard VMAX at $350 for 60 days"** → Runs a calibrated conformal risk forecast → returns honest VaR + percentile price bands
21
46
  4. **"Show me the Pokemon market"** → Pulls the latest daily market snapshot with top movers and volume trends
22
47
 
23
48
  No API keys required from third parties. You just point it at the TCG Oracle server (self-hosted or public).
@@ -55,13 +80,44 @@ That's it. Your agent can now search cards, grade images, and run simulations.
55
80
 
56
81
  | Action | What It Does | Example Prompt |
57
82
  |--------|-------------|----------------|
58
- | `TCG_ORACLE_SEARCH` | Search 370K+ products by card name, set, or keyword | "Search for Base Set Charizard" |
83
+ | `TCG_ORACLE_SEARCH` | Search 446K+ products by card name, set, or keyword | "Search for Base Set Charizard" |
59
84
  | `TCG_ORACLE_GRADE` | Grade a card image URL — returns PSA/Beckett prediction | "Grade this card: https://..." |
60
- | `TCG_ORACLE_SIMULATE` | Monte Carlo price forecast with 3 stochastic models | "Simulate Charizard at $350 for 60 days" |
85
+ | `TCG_ORACLE_SIMULATE` | Calibrated risk forecast — honest VaR (conformal default; Monte Carlo opt-in) | "Simulate Charizard at $350 for 60 days" |
61
86
  | `TCG_ORACLE_MARKET` | Pull the latest daily market snapshot for any game | "Show me the Pokemon market" |
62
87
  | `TCG_ORACLE_GRADE_OR_NOT` | Grade-or-Not ROI engine — "will grading this make me money?" | "Should I grade my Charizard?" |
63
88
  | `TCG_ORACLE_TRENDING` | Trending cards by 30-day sales volume and price velocity | "What Pokemon cards are trending?" |
64
- | `TCG_ORACLE_ARB_GRADE` | Grading arbitrage scanner — finds profitable cards to grade | "Find me profitable cards to grade" |
89
+
90
+ ---
91
+
92
+ ## How It Works
93
+
94
+ ```
95
+ ┌────────────────────────────────────────────────────────────────┐
96
+ │ ElizaOS Agent │
97
+ │ │
98
+ │ User: "Simulate Charizard VMAX at $350 for 60 days" │
99
+ │ │ │
100
+ │ ▼ │
101
+ │ ┌─────────────────────┐ │
102
+ │ │ Action Router │ │
103
+ │ │ (LLM selects best │ │
104
+ │ │ action + params) │ │
105
+ │ └────────┬────────────┘ │
106
+ └───────────────────────┼────────────────────────────────────────┘
107
+ │ fetch() + 30s timeout
108
+ ▼
109
+ ┌────────────────────────────────────────────────────────────────┐
110
+ │ TCG Oracle API Server │
111
+ │ │
112
+ │ /api/v1/search ─────── 446K+ products (TCGCSV) │
113
+ │ /api/v1/grade ──────── Vision LLM + OpenCV → PSA/BGS score │
114
+ │ /api/v1/simulate ───── Conformal forecast + card grades │
115
+ │ /api/v1/market ─────── Daily snapshot + top movers │
116
+ │ /api/v1/trending ───── 30-day volume + price velocity │
117
+ │ /api/v1/grade-or-not ─ PSA fee × grade × value = GO/NO-GO │
118
+ │ │
119
+ └────────────────────────────────────────────────────────────────┘
120
+ ```
65
121
 
66
122
  ---
67
123
 
@@ -73,12 +129,11 @@ Pokémon · Magic: The Gathering · Yu-Gi-Oh! · Disney Lorcana · One Piece ·
73
129
 
74
130
  ## How the Data Works
75
131
 
76
- All market data comes from [TCGCSV](https://tcgcsv.com) — a community project that snapshots pricing data daily for 25 TCG games. Our GitLab CI pipeline automatically refreshes this data every 24 hours. The full dataset (370K+ products) is also available on [Kaggle](https://www.kaggle.com/datasets/sailorpepe/tcg-market-intelligence).
132
+ All market data comes from [TCGCSV](https://tcgcsv.com) — a community project that snapshots pricing data daily for 25 TCG games. Our GitLab CI pipeline automatically refreshes this data every 24 hours. The full dataset (446K+ products) is also available on [Kaggle](https://www.kaggle.com/datasets/sailorpepe/tcg-market-intelligence).
77
133
 
78
- **Monte Carlo models explained:**
79
- - **Heston** — Models volatility itself as stochastic (volatility changes over time). Best for cards with unpredictable hype cycles.
80
- - **Merton** — Adds random jumps to the price process. Best for cards that can spike on tournament results or reprints.
81
- - **Kou** — Uses double-exponential jump distribution. Best for modeling asymmetric risk (big upside spikes vs gradual decline).
134
+ **Risk model — conformal calibration (default):**
135
+
136
+ Price forecasts default to a **regime-aware split-conformal** model: distribution-free bands calibrated on real cross-card price history, so the published downside risk (VaR) is *honest* — out-of-sample, a "5% loss" actually happens about 5% of the time — and fully **deterministic**, so anyone can reproduce the exact numbers. Each card also gets two letter grades: **Safe-Hold** (downside protection) and **Momentum** (direction). Monte Carlo models (GBM and Merton jump-diffusion) remain available via `model=`, seeded from the public **drand** randomness beacon for provably-fair draws. Forecast responses include the model parameters (e.g. `drift_mu`, `diffusion_sigma`, `regime`) for full transparency.
82
137
 
83
138
  ---
84
139
 
@@ -117,6 +172,43 @@ This is a **native TypeScript** ElizaOS plugin. It runs natively in the ElizaOS
117
172
 
118
173
  ---
119
174
 
120
- ## License
175
+ ## 📝 License & Commercial Use
176
+
177
+ This project is licensed under the **[Business Source License 1.1 (BUSL-1.1)](LICENSE)**.
178
+
179
+ We build in public and support the developer ecosystem — but we also protect the infrastructure and IP of **The Undesirables LLC**.
180
+
181
+ ### ✅ What You CAN Do (Free)
182
+
183
+ - **Personal & Educational Use** — Download, modify, and run locally for learning, research, or personal projects.
184
+ - **Non-Competing Applications** — Integrate our packages into your app, provided your app does not offer TCG market intelligence, pricing aggregation, AI card grading, or on-chain price oracle services as its primary function.
185
+ - **MCP / Agent Integration** — Connect your AI agent to our tools for non-commercial use.
186
+ - **Community Contributions** — Security audits, bug fixes, and PRs are always welcome.
187
+
188
+ ### 🚫 What You CANNOT Do (Use Limitation)
189
+
190
+ - **Competing Service** — You may not use this code to operate a competing TCG market intelligence, pricing aggregation, AI card grading, or on-chain price oracle service.
191
+ - **Commercial Resale** — You may not wrap our API, data pipelines, or AI models into a paid service without a commercial license.
192
+ - **Hosted SaaS** — You may not host this software as a service for third parties without written permission.
193
+
194
+ ### 🔓 Open-Source Conversion
195
+
196
+ On **June 1, 2030** (or 4 years after the first public release of each version), this code automatically converts to the **MIT License** — fully open source, forever.
197
+
198
+ ### 🤝 Commercial Licensing
199
+
200
+ Building a commercial product? Want guaranteed API access or white-label integration? Contact us:
201
+
202
+ 📧 **theundesirables7@gmail.com** · 🐦 **[@undesirables_ai](https://x.com/undesirables_ai)**
203
+
204
+ © 2026 The Undesirables LLC
205
+
206
+ ---
207
+
208
+ <div align="center">
209
+
210
+ ⭐ **If this project helped you, please star this repo** — it helps others find it.
211
+
212
+ [Report Bug](../../issues) · [Request Feature](../../issues)
121
213
 
122
- [BUSL-1.1](LICENSE) — Business Source License 1.1. Copyright © 2026 The Undesirables LLC.
214
+ </div>
package/dist/index.d.ts CHANGED
@@ -7,9 +7,10 @@ import { Plugin } from '@elizaos/core';
7
7
  * Native TypeScript rewrite of the Python G.A.M.E. SDK version.
8
8
  *
9
9
  * Features:
10
- * - Search 370K+ TCG products across 25 games (Pokemon, MTG, Yu-Gi-Oh, etc.)
10
+ * - Search 446K+ TCG products across 25+ games (Pokemon, MTG, Yu-Gi-Oh, etc.)
11
11
  * - AI Vision card grading (PSA/Beckett prediction via Qwen VL)
12
- * - Monte Carlo price simulation (Heston, Merton, Kou stochastic models)
12
+ * - Conformal-calibrated risk forecasts (honest VaR + Safe-Hold/Momentum grades);
13
+ * Monte Carlo (GBM/Merton) opt-in via the model parameter
13
14
  * - Real-time market snapshots from TCGCSV daily data
14
15
  * - License key purchase & verification (Ethereum NFT)
15
16
  *
@@ -18,7 +19,7 @@ import { Plugin } from '@elizaos/core';
18
19
  */
19
20
 
20
21
  declare const SUPPORTED_GAMES: readonly ["Pokemon", "Magic: The Gathering", "Yu-Gi-Oh!", "Lorcana", "One Piece", "Flesh and Blood", "Star Wars: Unlimited", "Dragon Ball Super", "Digimon", "MetaZoo", "Union Arena", "Gundam Card Game", "LoL Riftbound"];
21
- declare const SIMULATION_MODELS: readonly ["heston", "merton", "kou"];
22
+ declare const SIMULATION_MODELS: readonly ["conformal", "merton", "gbm"];
22
23
  declare const tcgOraclePlugin: Plugin;
23
24
 
24
25
  export { SIMULATION_MODELS, SUPPORTED_GAMES, tcgOraclePlugin as default };
package/dist/index.js CHANGED
@@ -63,7 +63,7 @@ var SUPPORTED_GAMES = [
63
63
  "Gundam Card Game",
64
64
  "LoL Riftbound"
65
65
  ];
66
- var SIMULATION_MODELS = ["heston", "merton", "kou"];
66
+ var SIMULATION_MODELS = ["conformal", "merton", "gbm"];
67
67
  function getBaseUrl(runtime) {
68
68
  return runtime.getSetting?.("TCG_ORACLE_URL") || process.env.TCG_ORACLE_URL || "";
69
69
  }
@@ -109,7 +109,7 @@ function safeStringify(data, maxItems = 10) {
109
109
  }
110
110
  var searchAction = {
111
111
  name: "TCG_ORACLE_SEARCH",
112
- description: "Search for trading card products across 25 games including Pokemon, Magic: The Gathering, Yu-Gi-Oh, Lorcana, One Piece, and more. Returns product names, set info, and current market prices from 370K+ real products sourced from TCGCSV daily.",
112
+ description: "Search for trading card products across 25+ games including Pokemon, Magic: The Gathering, Yu-Gi-Oh, Lorcana, One Piece, and more. Returns product names, set info, and current market prices from 446K+ real products sourced from TCGCSV daily.",
113
113
  similes: [
114
114
  "SEARCH_CARDS",
115
115
  "FIND_CARD",
@@ -238,7 +238,7 @@ ${summary}`;
238
238
  };
239
239
  var simulateAction = {
240
240
  name: "TCG_ORACLE_SIMULATE",
241
- description: "Run Monte Carlo simulation on a TCG card's price to predict future value. Uses real drift and volatility computed from TCGCSV historical data. Supports three stochastic models: Heston (stochastic volatility), Merton (jump-diffusion), and Kou (double-exponential jumps). Returns percentile bands (5th, 25th, 50th, 75th, 95th) for the forecast period.",
241
+ description: "Forecast a TCG card's future value with a conformal-calibrated risk model \u2014 honest VaR plus Safe-Hold/Momentum letter grades. Monte Carlo (GBM/Merton) is opt-in via the model parameter. Uses real drift and volatility computed from TCGCSV historical data. Monte Carlo models available opt-in: merton (jump-diffusion) and gbm. Returns percentile bands (5th, 25th, 50th, 75th, 95th) for the forecast period.",
242
242
  similes: [
243
243
  "SIMULATE_PRICE",
244
244
  "PRICE_PREDICTION",
@@ -262,9 +262,9 @@ var simulateAction = {
262
262
  },
263
263
  {
264
264
  name: "model",
265
- description: "Stochastic model: 'heston', 'merton', or 'kou'",
265
+ description: "Forecast model (default 'conformal'): 'conformal' (regime-aware split-conformal bands, honest calibrated VaR), or opt into Monte Carlo with 'merton' (jump-diffusion) or 'gbm'",
266
266
  required: false,
267
- schema: { type: "string", enumValues: ["heston", "merton", "kou"] }
267
+ schema: { type: "string", enumValues: ["conformal", "merton", "gbm"] }
268
268
  },
269
269
  {
270
270
  name: "days",
@@ -292,11 +292,11 @@ var simulateAction = {
292
292
  const text = message.content.text || "";
293
293
  const priceMatch = text.match(/\$?([\d,]+(?:\.\d{2})?)/);
294
294
  const daysMatch = text.match(/(\d+)\s*days?/i);
295
- const modelMatch = text.match(/\b(heston|merton|kou)\b/i);
296
- const cardName = text.replace(/simulate|price|forecast|monte carlo|at|\$[\d,.]+|\d+\s*days?|heston|merton|kou/gi, "").replace(/\s+/g, " ").trim() || "Unknown Card";
295
+ const modelMatch = text.match(/\b(conformal|merton|gbm)\b/i);
296
+ const cardName = text.replace(/simulate|price|forecast|monte carlo|at|\$[\d,.]+|\d+\s*days?|conformal|merton|gbm/gi, "").replace(/\s+/g, " ").trim() || "Unknown Card";
297
297
  const currentPrice = priceMatch ? parseFloat(priceMatch[1].replace(",", "")) : 0;
298
298
  const days = daysMatch ? parseInt(daysMatch[1]) : 30;
299
- const model = modelMatch ? modelMatch[1].toLowerCase() : "heston";
299
+ const model = modelMatch ? modelMatch[1].toLowerCase() : "conformal";
300
300
  if (currentPrice <= 0) {
301
301
  if (callback) await callback({ text: "Please provide a current price for the simulation. Example: 'Simulate Charizard VMAX at $350 for 60 days'" });
302
302
  return { success: false, error: "Invalid or missing current price" };
@@ -504,68 +504,6 @@ ${summary}`;
504
504
  return { success: true, text: responseText, data: { trending: result.data } };
505
505
  }
506
506
  };
507
- var arbGradeAction = {
508
- name: "TCG_ORACLE_ARB_GRADE",
509
- description: "Scans the TCG database for undervalued raw cards where grading would produce ROI above a threshold. Estimates PSA grades based on price tier and rarity, calculates expected graded values, and returns ranked opportunities sorted by expected profit.",
510
- similes: [
511
- "GRADING_ARBITRAGE",
512
- "FIND_UNDERVALUED",
513
- "ARBITRAGE_SCAN",
514
- "PROFITABLE_CARDS",
515
- "WHAT_TO_GRADE"
516
- ],
517
- parameters: [
518
- {
519
- name: "game",
520
- description: "TCG game to scan (default: Pokemon)",
521
- required: false,
522
- schema: { type: "string" }
523
- },
524
- {
525
- name: "min_roi",
526
- description: "Minimum expected ROI % to flag as opportunity (default: 50)",
527
- required: false,
528
- schema: { type: "number" }
529
- }
530
- ],
531
- examples: [
532
- [
533
- { name: "{{user1}}", content: { text: "Find me profitable Pokemon cards to grade" } },
534
- { name: "{{agentName}}", content: { text: "Scanning for grading arbitrage opportunities...", action: "TCG_ORACLE_ARB_GRADE" } }
535
- ],
536
- [
537
- { name: "{{user1}}", content: { text: "What Magic cards have the best grading ROI?" } },
538
- { name: "{{agentName}}", content: { text: "Running arbitrage scanner on Magic: The Gathering...", action: "TCG_ORACLE_ARB_GRADE" } }
539
- ]
540
- ],
541
- validate: async (runtime) => !!getBaseUrl(runtime),
542
- handler: async (runtime, message, _state, _options, callback) => {
543
- const text = message.content?.text?.toLowerCase() || "";
544
- let game = "Pokemon";
545
- for (const g of SUPPORTED_GAMES) {
546
- if (text.includes(g.toLowerCase())) {
547
- game = g;
548
- break;
549
- }
550
- }
551
- const params = {
552
- game,
553
- min_roi: 50,
554
- limit: 20
555
- };
556
- const result = await callApi(getBaseUrl(runtime), "/api/v1/arb-grade", params);
557
- if (result.error) {
558
- if (callback) await callback({ text: `Arbitrage scan failed: ${result.error}` });
559
- return { success: false, error: result.error };
560
- }
561
- const summary = safeStringify(result.data, 15);
562
- const responseText = `Grading arbitrage opportunities for ${game}:
563
-
564
- ${summary}`;
565
- if (callback) await callback({ text: responseText }, "TCG_ORACLE_ARB_GRADE");
566
- return { success: true, text: responseText, data: { arbitrage: result.data } };
567
- }
568
- };
569
507
  var tcgOracleProvider = {
570
508
  name: "tcg-oracle",
571
509
  description: "Provides TCG Oracle market intelligence context to the agent",
@@ -575,10 +513,10 @@ var tcgOracleProvider = {
575
513
  return {
576
514
  text: `[TCG Oracle v1.1.0]
577
515
  Status: ${status}
578
- Database: 370,158 products across 25 games
516
+ Database: 446K+ products across 25+ games
579
517
  Data source: TCGCSV daily snapshots
580
- Models: Heston (stochastic vol), Merton (jump-diffusion), Kou (double-exp)
581
- Actions: search, grade, simulate, market, grade-or-not, trending, arb-grade
518
+ Models: conformal (default \u2014 regime-aware split-conformal bands, honest VaR), merton (jump-diffusion), gbm \u2014 Monte Carlo is opt-in
519
+ Actions: search, grade, simulate, market, grade-or-not, trending
582
520
  Supported games: ${SUPPORTED_GAMES.join(", ")}
583
521
  API: ${baseUrl || "TCG_ORACLE_URL not set"}
584
522
 
@@ -593,7 +531,7 @@ The agent can search cards, grade card images, simulate prices via Monte Carlo,
593
531
  };
594
532
  var tcgOraclePlugin = {
595
533
  name: "@undesirables/plugin-tcg-oracle",
596
- description: "TCG Oracle \u2014 AI-powered trading card market intelligence for ElizaOS agents. Covers 370K+ products across 25 games with Monte Carlo price simulation (Heston/Merton/Kou), AI vision card grading with ROI analysis, trending cards feed, grading arbitrage scanner, and real-time market snapshots. Powered by TCGCSV daily data pipeline.",
534
+ description: "TCG Oracle \u2014 AI-powered trading card market intelligence for ElizaOS agents. Covers 446K+ products across 25+ games with conformal-calibrated risk forecasts \u2014 honest VaR plus Safe-Hold/Momentum letter grades, with Monte Carlo (GBM/Merton) available opt-in \u2014 AI vision card grading with ROI analysis, trending cards feed, and real-time market snapshots. Powered by TCGCSV daily data pipeline.",
597
535
  init: async (config, runtime) => {
598
536
  const validation = validateTcgOracleConfig(runtime);
599
537
  if (!validation.valid) {
@@ -602,7 +540,7 @@ var tcgOraclePlugin = {
602
540
  console.log(`\u2705 TCG Oracle v1.1.0 connected to ${runtime.getSetting?.("TCG_ORACLE_URL")}`);
603
541
  }
604
542
  },
605
- actions: [searchAction, gradeAction, simulateAction, marketAction, gradeOrNotAction, trendingAction, arbGradeAction],
543
+ actions: [searchAction, gradeAction, simulateAction, marketAction, gradeOrNotAction, trendingAction],
606
544
  providers: [tcgOracleProvider],
607
545
  evaluators: [],
608
546
  services: [MarketMonitorService]
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/environment.ts","../src/services.ts","../src/index.ts"],"sourcesContent":["import type { IAgentRuntime } from \"@elizaos/core\";\n\n/**\n * Validates that the TCG Oracle plugin has all required configuration.\n * Called during plugin init and before each action.\n */\nexport function validateTcgOracleConfig(\n runtime: IAgentRuntime\n): { valid: boolean; error?: string } {\n const url =\n (runtime.getSetting?.(\"TCG_ORACLE_URL\") as string) ||\n process.env.TCG_ORACLE_URL ||\n \"\";\n\n if (!url) {\n return {\n valid: false,\n error:\n \"TCG_ORACLE_URL is required. Set it in your character.json settings \" +\n \"or as an environment variable. Example: https://oracle.the-undesirables.com\",\n };\n }\n\n try {\n new URL(url);\n } catch {\n return {\n valid: false,\n error: `TCG_ORACLE_URL is not a valid URL: \"${url}\"`,\n };\n }\n\n return { valid: true };\n}\n","import { Service, IAgentRuntime } from \"@elizaos/core\";\n\nexport class MarketMonitorService extends Service {\n // Use a string getter to satisfy ElizaOS ServiceType constraints if needed,\n // or define static serviceType depending on the core version.\n static serviceType = \"TCG_MARKET_MONITOR\";\n\n get capabilityDescription(): string {\n return \"Monitors TCG market data for price spikes and trending cards\";\n }\n\n static async start(runtime: IAgentRuntime): Promise<MarketMonitorService> {\n const service = new MarketMonitorService();\n await service.initialize(runtime);\n return service;\n }\n\n private monitorInterval: NodeJS.Timeout | null = null;\n\n async initialize(_runtime: IAgentRuntime): Promise<void> {\n console.log(\"[TCG Oracle Service] Market Monitor Service initialized.\");\n // Example: Start background polling for market spikes every hour\n // this.monitorInterval = setInterval(() => this.pollMarket(), 1000 * 60 * 60);\n }\n\n async stop(): Promise<void> {\n if (this.monitorInterval) {\n clearInterval(this.monitorInterval);\n }\n console.log(\"[TCG Oracle Service] Market Monitor Service stopped.\");\n }\n\n private pollMarket() {\n console.log(\"[TCG Oracle Service] Background task: Polling TCG market for price spikes...\");\n }\n}\n","/**\n * TCG Oracle — ElizaOS Plugin v1.0.0\n * ====================================\n * AI-powered trading card market intelligence for ElizaOS agents.\n * Native TypeScript rewrite of the Python G.A.M.E. SDK version.\n *\n * Features:\n * - Search 370K+ TCG products across 25 games (Pokemon, MTG, Yu-Gi-Oh, etc.)\n * - AI Vision card grading (PSA/Beckett prediction via Qwen VL)\n * - Monte Carlo price simulation (Heston, Merton, Kou stochastic models)\n * - Real-time market snapshots from TCGCSV daily data\n * - License key purchase & verification (Ethereum NFT)\n *\n * @see https://the-undesirables.com\n * @see https://github.com/sailorpepe/elizaos-tcg-oracle-plugin\n */\n\nimport { validateTcgOracleConfig } from \"./environment.js\";\nimport { MarketMonitorService } from \"./services.js\";\n\nimport type {\n Plugin,\n Action,\n Provider,\n IAgentRuntime,\n Memory,\n State,\n HandlerCallback,\n ActionExample,\n ActionResult,\n ProviderResult,\n} from \"@elizaos/core\";\n\n// ============================================================\n// Configuration\n// ============================================================\n\nconst SUPPORTED_GAMES = [\n \"Pokemon\",\n \"Magic: The Gathering\",\n \"Yu-Gi-Oh!\",\n \"Lorcana\",\n \"One Piece\",\n \"Flesh and Blood\",\n \"Star Wars: Unlimited\",\n \"Dragon Ball Super\",\n \"Digimon\",\n \"MetaZoo\",\n \"Union Arena\",\n \"Gundam Card Game\",\n \"LoL Riftbound\",\n] as const;\n\nconst SIMULATION_MODELS = [\"heston\", \"merton\", \"kou\"] as const;\n\n// ============================================================\n// API Client\n// ============================================================\n\nfunction getBaseUrl(runtime: IAgentRuntime): string {\n return (\n (runtime.getSetting?.(\"TCG_ORACLE_URL\") as string) ||\n process.env.TCG_ORACLE_URL ||\n \"\"\n );\n}\n\nasync function callApi(\n baseUrl: string,\n endpoint: string,\n params: Record<string, string | number>\n): Promise<{ data?: any; error?: string }> {\n if (!baseUrl) {\n return {\n error:\n \"TCG_ORACLE_URL not set. Set it in your character.json settings or as an environment variable. Install the server: pip install undesirables-mcp-server\",\n };\n }\n\n const url = new URL(`${baseUrl}${endpoint}`);\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null && value !== \"\") {\n url.searchParams.set(key, String(value));\n }\n }\n\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 30_000);\n\n const response = await fetch(url.toString(), {\n signal: controller.signal,\n headers: { \"User-Agent\": \"elizaos-tcg-oracle-plugin/1.0.0\" },\n });\n clearTimeout(timeout);\n\n if (!response.ok) {\n return { error: `API returned HTTP ${response.status}` };\n }\n\n const json = (await response.json()) as Record<string, any>;\n return { data: json.data || json };\n } catch (err: any) {\n if (err.name === \"AbortError\") {\n return { error: \"TCG Oracle API timed out (30s)\" };\n }\n return {\n error: \"Failed to connect to TCG Oracle API. Is the server running?\",\n };\n }\n}\n\n// ============================================================\n// Helper: Truncate data safely before JSON.stringify\n// ============================================================\n\nfunction safeStringify(data: any, maxItems = 10): string {\n if (Array.isArray(data)) {\n return JSON.stringify(data.slice(0, maxItems), null, 2);\n }\n return JSON.stringify(data, null, 2).slice(0, 2000);\n}\n\n// ============================================================\n// ACTION 1: Search TCG Products\n// ============================================================\n\nconst searchAction: Action = {\n name: \"TCG_ORACLE_SEARCH\",\n description:\n \"Search for trading card products across 25 games including Pokemon, Magic: The Gathering, Yu-Gi-Oh, Lorcana, One Piece, and more. Returns product names, set info, and current market prices from 370K+ real products sourced from TCGCSV daily.\",\n similes: [\n \"SEARCH_CARDS\",\n \"FIND_CARD\",\n \"CARD_LOOKUP\",\n \"CARD_SEARCH\",\n \"TCG_SEARCH\",\n \"FIND_POKEMON\",\n \"SEARCH_MTG\",\n ],\n parameters: [\n {\n name: \"query\",\n description: \"The card name, set name, or keyword to search for (e.g., 'Charizard', 'Base Set', 'Pikachu VMAX')\",\n required: true,\n schema: { type: \"string\" },\n },\n {\n name: \"limit\",\n description: \"Maximum number of results to return (default: 10, max: 50)\",\n required: false,\n schema: { type: \"number\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Search for Charizard cards\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Searching TCG Oracle for Charizard...\", action: \"TCG_ORACLE_SEARCH\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"What Pikachu VMAX cards are available?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Looking up Pikachu VMAX products...\", action: \"TCG_ORACLE_SEARCH\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Find me Base Set holographic cards\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Searching for Base Set holographic cards...\", action: \"TCG_ORACLE_SEARCH\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => {\n return !!getBaseUrl(runtime);\n },\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content.text || \"\";\n\n // Extract search query — strip common prefixes\n const query = text\n .replace(/^(search|find|look up|lookup|what|show me)\\s+(for\\s+)?/i, \"\")\n .replace(/\\s+cards?\\s*$/i, \"\")\n .trim();\n\n if (!query) {\n if (callback) await callback({ text: \"What card would you like me to search for?\" });\n return { success: false, error: \"No search query provided\" };\n }\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/search\", {\n query,\n limit: 10,\n });\n\n if (result.error) {\n if (callback) await callback({ text: `Search failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data);\n const responseText = `Found products matching \"${query}\":\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_SEARCH\");\n return { success: true, text: responseText, data: { search_results: result.data } };\n },\n};\n\n// ============================================================\n// ACTION 2: AI Card Grading\n// ============================================================\n\nconst gradeAction: Action = {\n name: \"TCG_ORACLE_GRADE\",\n description:\n \"Grade a TCG card image using AI vision (Qwen VL model running locally). Predicts PSA and Beckett grading scores by analyzing centering, corners, edges, surface condition, and print quality. Works with Pokemon, MTG, Yu-Gi-Oh, and other TCG cards.\",\n similes: [\n \"GRADE_CARD\",\n \"CARD_GRADING\",\n \"PSA_GRADE\",\n \"BECKETT_GRADE\",\n \"RATE_CARD\",\n \"EVALUATE_CARD\",\n ],\n parameters: [\n {\n name: \"image_url\",\n description: \"Direct URL to the card image (PNG, JPG, or WebP)\",\n required: true,\n schema: { type: \"string\" },\n },\n {\n name: \"game\",\n description: \"The TCG game this card belongs to (default: Pokemon)\",\n required: false,\n schema: { type: \"string\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Grade this card: https://example.com/charizard.jpg\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Analyzing card image for grading...\", action: \"TCG_ORACLE_GRADE\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"What PSA grade would this get? https://i.imgur.com/card.png\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Running AI vision grading analysis...\", action: \"TCG_ORACLE_GRADE\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Rate the condition of this Magic card https://example.com/mtg.jpg\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Evaluating card condition for Beckett grading...\", action: \"TCG_ORACLE_GRADE\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content.text || \"\";\n\n // Extract URL from message\n const urlMatch = text.match(/https?:\\/\\/[^\\s]+/);\n if (!urlMatch) {\n if (callback) await callback({ text: \"Please provide a card image URL to grade.\" });\n return { success: false, error: \"No image URL found in message\" };\n }\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/grade\", {\n image_url: urlMatch[0],\n game: \"Pokemon\",\n });\n\n if (result.error) {\n if (callback) await callback({ text: `Grading failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data);\n const responseText = `Card grading complete:\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_GRADE\");\n return { success: true, text: responseText, data: { grade_result: result.data } };\n },\n};\n\n// ============================================================\n// ACTION 3: Monte Carlo Price Simulation\n// ============================================================\n\nconst simulateAction: Action = {\n name: \"TCG_ORACLE_SIMULATE\",\n description:\n \"Run Monte Carlo simulation on a TCG card's price to predict future value. Uses real drift and volatility computed from TCGCSV historical data. Supports three stochastic models: Heston (stochastic volatility), Merton (jump-diffusion), and Kou (double-exponential jumps). Returns percentile bands (5th, 25th, 50th, 75th, 95th) for the forecast period.\",\n similes: [\n \"SIMULATE_PRICE\",\n \"PRICE_PREDICTION\",\n \"FORECAST_PRICE\",\n \"MONTE_CARLO\",\n \"PRICE_FORECAST\",\n \"WHAT_WILL_THIS_BE_WORTH\",\n ],\n parameters: [\n {\n name: \"card_name\",\n description: \"Name of the card to simulate\",\n required: true,\n schema: { type: \"string\" },\n },\n {\n name: \"current_price\",\n description: \"Current price in USD\",\n required: true,\n schema: { type: \"number\" },\n },\n {\n name: \"model\",\n description: \"Stochastic model: 'heston', 'merton', or 'kou'\",\n required: false,\n schema: { type: \"string\", enumValues: [\"heston\", \"merton\", \"kou\"] },\n },\n {\n name: \"days\",\n description: \"Forecast horizon in days (default: 30)\",\n required: false,\n schema: { type: \"number\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Simulate the price of Charizard VMAX at $350 for 60 days\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Running Monte Carlo simulation on Charizard VMAX...\", action: \"TCG_ORACLE_SIMULATE\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"What will a PSA 10 Base Set Blastoise worth $800 be in 90 days using merton model?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Running Merton jump-diffusion simulation for Blastoise...\", action: \"TCG_ORACLE_SIMULATE\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Forecast Lorcana Elsa at $25 for 30 days\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Simulating Lorcana Elsa price trajectory...\", action: \"TCG_ORACLE_SIMULATE\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content.text || \"\";\n\n // Try to extract parameters from text\n const priceMatch = text.match(/\\$?([\\d,]+(?:\\.\\d{2})?)/);\n const daysMatch = text.match(/(\\d+)\\s*days?/i);\n const modelMatch = text.match(/\\b(heston|merton|kou)\\b/i);\n\n const cardName =\n text\n .replace(/simulate|price|forecast|monte carlo|at|\\$[\\d,.]+|\\d+\\s*days?|heston|merton|kou/gi, \"\")\n .replace(/\\s+/g, \" \")\n .trim() || \"Unknown Card\";\n\n const currentPrice = priceMatch ? parseFloat(priceMatch[1].replace(\",\", \"\")) : 0;\n const days = daysMatch ? parseInt(daysMatch[1]) : 30;\n const model = modelMatch ? modelMatch[1].toLowerCase() : \"heston\";\n\n if (currentPrice <= 0) {\n if (callback) await callback({ text: \"Please provide a current price for the simulation. Example: 'Simulate Charizard VMAX at $350 for 60 days'\" });\n return { success: false, error: \"Invalid or missing current price\" };\n }\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/simulate\", {\n card_name: cardName,\n current_price: currentPrice,\n model,\n days,\n simulations: 10000,\n });\n\n if (result.error) {\n if (callback) await callback({ text: `Simulation failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data);\n const responseText = `Monte Carlo simulation for ${cardName} ($${currentPrice}, ${model} model, ${days} days):\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_SIMULATE\");\n return { success: true, text: responseText, data: { simulation_result: result.data } };\n },\n};\n\n// ============================================================\n// ACTION 4: Market Snapshot\n// ============================================================\n\nconst marketAction: Action = {\n name: \"TCG_ORACLE_MARKET\",\n description:\n \"Retrieve the latest daily market data snapshot from TCGCSV for a specific game. Returns top movers, price changes, volume data, and market trends. Data is refreshed daily via automated pipeline.\",\n similes: [\n \"MARKET_SNAPSHOT\",\n \"MARKET_DATA\",\n \"TCG_MARKET\",\n \"CARD_MARKET\",\n \"TOP_MOVERS\",\n \"PRICE_CHANGES\",\n ],\n parameters: [\n {\n name: \"game\",\n description: \"Game name: Pokemon, Magic: The Gathering, Yu-Gi-Oh, Lorcana, One Piece, etc\",\n required: false,\n schema: { type: \"string\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Show me the Pokemon market snapshot\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Pulling the latest Pokemon market data...\", action: \"TCG_ORACLE_MARKET\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"What's happening in the Yu-Gi-Oh market today?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Fetching Yu-Gi-Oh market snapshot...\", action: \"TCG_ORACLE_MARKET\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Top movers in Magic: The Gathering\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Pulling Magic: The Gathering market data...\", action: \"TCG_ORACLE_MARKET\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content.text?.toLowerCase() || \"\";\n\n // Detect game from message\n let game = \"Pokemon\";\n for (const g of SUPPORTED_GAMES) {\n if (text.includes(g.toLowerCase())) {\n game = g;\n break;\n }\n }\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/market\", { game });\n\n if (result.error) {\n if (callback) await callback({ text: `Market data failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data, 25);\n const responseText = `Market snapshot for ${game}:\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_MARKET\");\n return { success: true, text: responseText, data: { market_data: result.data } };\n },\n};\n\n// ============================================================\n// ACTION 5: Grade-or-Not Decision Engine\n// ============================================================\n\nconst gradeOrNotAction: Action = {\n name: \"TCG_ORACLE_GRADE_OR_NOT\",\n description:\n \"Answers 'will grading this card make me money?' by combining AI grade prediction with PSA fee schedules, shipping costs, and graded market values. Returns a GO/NO-GO verdict with expected ROI and profit scenarios (best case, predicted, worst case).\",\n similes: [\n \"SHOULD_I_GRADE\",\n \"GRADE_ROI\",\n \"GRADING_PROFIT\",\n \"IS_IT_WORTH_GRADING\",\n \"GRADE_OR_NOT\",\n ],\n parameters: [\n {\n name: \"card_name\",\n description: \"Name of the card to evaluate (e.g., 'Base Set Charizard Holo')\",\n required: true,\n schema: { type: \"string\" },\n },\n {\n name: \"predicted_grade\",\n description: \"Your predicted PSA grade (0 = auto-estimate)\",\n required: false,\n schema: { type: \"number\" },\n },\n {\n name: \"raw_price\",\n description: \"Current raw card value in USD (0 = auto-lookup)\",\n required: false,\n schema: { type: \"number\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Should I grade my Base Set Charizard?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Running Grade-or-Not analysis...\", action: \"TCG_ORACLE_GRADE_OR_NOT\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Is it worth grading a PSA 8 Pikachu VMAX worth $45?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Calculating grading ROI for Pikachu VMAX...\", action: \"TCG_ORACLE_GRADE_OR_NOT\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content.text || \"\";\n\n // Extract card name\n const cardName = text\n .replace(/^(should i|is it worth|grade or not|grading roi|will grading)\\s*/i, \"\")\n .replace(/\\s*(make me money|be profitable|worth it)\\s*\\??$/i, \"\")\n .replace(/^(grade|grading)\\s*/i, \"\")\n .replace(/\\bmy\\b/i, \"\")\n .trim() || \"Unknown Card\";\n\n // Extract price and grade if mentioned\n const priceMatch = text.match(/\\$?([\\d,]+(?:\\.\\d{2})?)/);\n const gradeMatch = text.match(/\\bpsa\\s*(\\d+(?:\\.\\d)?)\\b/i) || text.match(/\\bgrade\\s*(\\d+(?:\\.\\d)?)\\b/i);\n\n const params: Record<string, string | number> = { card_name: cardName };\n if (priceMatch) params.raw_price = parseFloat(priceMatch[1].replace(\",\", \"\"));\n if (gradeMatch) params.predicted_grade = parseFloat(gradeMatch[1]);\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/grade-or-not\", params);\n\n if (result.error) {\n if (callback) await callback({ text: `Grade-or-Not analysis failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const data = result.data;\n const verdict = data?.verdict || \"Unknown\";\n const explanation = data?.explanation || \"\";\n const responseText = `Grade-or-Not verdict for ${cardName}:\\n\\n${verdict}\\n${explanation}\\n\\nFull analysis:\\n${safeStringify(data)}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_GRADE_OR_NOT\");\n return { success: true, text: responseText, data: { grade_or_not: data } };\n },\n};\n\n// ============================================================\n// ACTION 6: Trending Cards\n// ============================================================\n\nconst trendingAction: Action = {\n name: \"TCG_ORACLE_TRENDING\",\n description:\n \"Returns the top trending trading cards by market activity (30-day sales volume, views, and price velocity). Covers all 25 supported TCG games. Useful for spotting market momentum and emerging opportunities.\",\n similes: [\n \"TRENDING_CARDS\",\n \"HOT_CARDS\",\n \"TOP_MOVERS\",\n \"WHATS_TRENDING\",\n \"POPULAR_CARDS\",\n \"MARKET_TRENDS\",\n ],\n parameters: [\n {\n name: \"game\",\n description: \"Filter by game name (empty = all games)\",\n required: false,\n schema: { type: \"string\" },\n },\n {\n name: \"limit\",\n description: \"Number of results (default: 25, max: 100)\",\n required: false,\n schema: { type: \"number\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"What Pokemon cards are trending right now?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Pulling trending Pokemon cards...\", action: \"TCG_ORACLE_TRENDING\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Show me the hottest cards across all games\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Fetching trending cards across all TCG games...\", action: \"TCG_ORACLE_TRENDING\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content?.text?.toLowerCase() || \"\";\n\n // Detect game from message\n let game = \"\";\n for (const g of SUPPORTED_GAMES) {\n if (text.includes(g.toLowerCase())) {\n game = g;\n break;\n }\n }\n\n const params: Record<string, string | number> = { limit: 25 };\n if (game) params.game = game;\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/trending\", params);\n\n if (result.error) {\n if (callback) await callback({ text: `Trending cards failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data, 15);\n const responseText = `Trending cards${game ? ` for ${game}` : \" across all games\"}:\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_TRENDING\");\n return { success: true, text: responseText, data: { trending: result.data } };\n },\n};\n\n// ============================================================\n// ACTION 7: Raw Card Arbitrage Scanner\n// ============================================================\n\nconst arbGradeAction: Action = {\n name: \"TCG_ORACLE_ARB_GRADE\",\n description:\n \"Scans the TCG database for undervalued raw cards where grading would produce ROI above a threshold. Estimates PSA grades based on price tier and rarity, calculates expected graded values, and returns ranked opportunities sorted by expected profit.\",\n similes: [\n \"GRADING_ARBITRAGE\",\n \"FIND_UNDERVALUED\",\n \"ARBITRAGE_SCAN\",\n \"PROFITABLE_CARDS\",\n \"WHAT_TO_GRADE\",\n ],\n parameters: [\n {\n name: \"game\",\n description: \"TCG game to scan (default: Pokemon)\",\n required: false,\n schema: { type: \"string\" },\n },\n {\n name: \"min_roi\",\n description: \"Minimum expected ROI % to flag as opportunity (default: 50)\",\n required: false,\n schema: { type: \"number\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Find me profitable Pokemon cards to grade\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Scanning for grading arbitrage opportunities...\", action: \"TCG_ORACLE_ARB_GRADE\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"What Magic cards have the best grading ROI?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Running arbitrage scanner on Magic: The Gathering...\", action: \"TCG_ORACLE_ARB_GRADE\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content?.text?.toLowerCase() || \"\";\n\n // Detect game from message\n let game = \"Pokemon\";\n for (const g of SUPPORTED_GAMES) {\n if (text.includes(g.toLowerCase())) {\n game = g;\n break;\n }\n }\n\n const params: Record<string, string | number> = {\n game,\n min_roi: 50,\n limit: 20,\n };\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/arb-grade\", params);\n\n if (result.error) {\n if (callback) await callback({ text: `Arbitrage scan failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data, 15);\n const responseText = `Grading arbitrage opportunities for ${game}:\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_ARB_GRADE\");\n return { success: true, text: responseText, data: { arbitrage: result.data } };\n },\n};\n\n// ============================================================\n// PROVIDER: TCG Oracle Context\n// ============================================================\n\nconst tcgOracleProvider: Provider = {\n name: \"tcg-oracle\",\n description: \"Provides TCG Oracle market intelligence context to the agent\",\n get: async (\n runtime: IAgentRuntime,\n _message: Memory,\n _state: State\n ): Promise<ProviderResult> => {\n const baseUrl = getBaseUrl(runtime);\n const status = baseUrl ? \"connected\" : \"not configured\";\n\n return {\n text: `[TCG Oracle v1.1.0]\nStatus: ${status}\nDatabase: 370,158 products across 25 games\nData source: TCGCSV daily snapshots\nModels: Heston (stochastic vol), Merton (jump-diffusion), Kou (double-exp)\nActions: search, grade, simulate, market, grade-or-not, trending, arb-grade\nSupported games: ${SUPPORTED_GAMES.join(\", \")}\nAPI: ${baseUrl || \"TCG_ORACLE_URL not set\"}\n\nThe agent can search cards, grade card images, simulate prices via Monte Carlo, pull market snapshots, check grading ROI, view trending cards, and scan for grading arbitrage opportunities.`,\n values: {\n tcgOracleStatus: status,\n tcgOracleUrl: baseUrl || \"not set\",\n totalProducts: 370158,\n },\n };\n },\n};\n\n// ============================================================\n// PLUGIN EXPORT\n// ============================================================\n\nconst tcgOraclePlugin: Plugin = {\n name: \"@undesirables/plugin-tcg-oracle\",\n description:\n \"TCG Oracle — AI-powered trading card market intelligence for ElizaOS agents. \" +\n \"Covers 370K+ products across 25 games with Monte Carlo price simulation \" +\n \"(Heston/Merton/Kou), AI vision card grading with ROI analysis, \" +\n \"trending cards feed, grading arbitrage scanner, and real-time market snapshots. \" +\n \"Powered by TCGCSV daily data pipeline.\",\n init: async (config: Record<string, string>, runtime: IAgentRuntime) => {\n const validation = validateTcgOracleConfig(runtime);\n if (!validation.valid) {\n console.warn(`⚠️ TCG Oracle: ${validation.error}`);\n } else {\n console.log(`✅ TCG Oracle v1.1.0 connected to ${runtime.getSetting?.(\"TCG_ORACLE_URL\")}`);\n }\n },\n actions: [searchAction, gradeAction, simulateAction, marketAction, gradeOrNotAction, trendingAction, arbGradeAction],\n providers: [tcgOracleProvider],\n evaluators: [],\n services: [MarketMonitorService],\n};\n\nexport default tcgOraclePlugin;\nexport { SUPPORTED_GAMES, SIMULATION_MODELS };\n\n"],"mappings":";AAMO,SAAS,wBACd,SACoC;AACpC,QAAM,MACH,QAAQ,aAAa,gBAAgB,KACtC,QAAQ,IAAI,kBACZ;AAEF,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OACE;AAAA,IAEJ;AAAA,EACF;AAEA,MAAI;AACF,QAAI,IAAI,GAAG;AAAA,EACb,QAAQ;AACN,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO,uCAAuC,GAAG;AAAA,IACnD;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,KAAK;AACvB;;;ACjCA,SAAS,eAA8B;AAEhC,IAAM,uBAAN,MAAM,8BAA6B,QAAQ;AAAA;AAAA;AAAA,EAGhD,OAAO,cAAc;AAAA,EAErB,IAAI,wBAAgC;AAClC,WAAO;AAAA,EACT;AAAA,EAEA,aAAa,MAAM,SAAuD;AACxE,UAAM,UAAU,IAAI,sBAAqB;AACzC,UAAM,QAAQ,WAAW,OAAO;AAChC,WAAO;AAAA,EACT;AAAA,EAEQ,kBAAyC;AAAA,EAEjD,MAAM,WAAW,UAAwC;AACvD,YAAQ,IAAI,0DAA0D;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BAAgB,KAAK,IAAI,CAAC;AAAA,OACtC,WAAW,wBAAwB;AAAA;AAAA;AAAA,MAGpC,QAAQ;AAAA,QACN,iBAAiB;AAAA,QACjB,cAAc,WAAW;AAAA,QACzB,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AACF;AAMA,IAAM,kBAA0B;AAAA,EAC9B,MAAM;AAAA,EACN,aACE;AAAA,EAKF,MAAM,OAAO,QAAgC,YAA2B;AACtE,UAAM,aAAa,wBAAwB,OAAO;AAClD,QAAI,CAAC,WAAW,OAAO;AACrB,cAAQ,KAAK,4BAAkB,WAAW,KAAK,EAAE;AAAA,IACnD,OAAO;AACL,cAAQ,IAAI,yCAAoC,QAAQ,aAAa,gBAAgB,CAAC,EAAE;AAAA,IAC1F;AAAA,EACF;AAAA,EACA,SAAS,CAAC,cAAc,aAAa,gBAAgB,cAAc,kBAAkB,gBAAgB,cAAc;AAAA,EACnH,WAAW,CAAC,iBAAiB;AAAA,EAC7B,YAAY,CAAC;AAAA,EACb,UAAU,CAAC,oBAAoB;AACjC;AAEA,IAAO,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/environment.ts","../src/services.ts","../src/index.ts"],"sourcesContent":["import type { IAgentRuntime } from \"@elizaos/core\";\n\n/**\n * Validates that the TCG Oracle plugin has all required configuration.\n * Called during plugin init and before each action.\n */\nexport function validateTcgOracleConfig(\n runtime: IAgentRuntime\n): { valid: boolean; error?: string } {\n const url =\n (runtime.getSetting?.(\"TCG_ORACLE_URL\") as string) ||\n process.env.TCG_ORACLE_URL ||\n \"\";\n\n if (!url) {\n return {\n valid: false,\n error:\n \"TCG_ORACLE_URL is required. Set it in your character.json settings \" +\n \"or as an environment variable. Example: https://oracle.the-undesirables.com\",\n };\n }\n\n try {\n new URL(url);\n } catch {\n return {\n valid: false,\n error: `TCG_ORACLE_URL is not a valid URL: \"${url}\"`,\n };\n }\n\n return { valid: true };\n}\n","import { Service, IAgentRuntime } from \"@elizaos/core\";\n\nexport class MarketMonitorService extends Service {\n // Use a string getter to satisfy ElizaOS ServiceType constraints if needed,\n // or define static serviceType depending on the core version.\n static serviceType = \"TCG_MARKET_MONITOR\";\n\n get capabilityDescription(): string {\n return \"Monitors TCG market data for price spikes and trending cards\";\n }\n\n static async start(runtime: IAgentRuntime): Promise<MarketMonitorService> {\n const service = new MarketMonitorService();\n await service.initialize(runtime);\n return service;\n }\n\n private monitorInterval: NodeJS.Timeout | null = null;\n\n async initialize(_runtime: IAgentRuntime): Promise<void> {\n console.log(\"[TCG Oracle Service] Market Monitor Service initialized.\");\n // Example: Start background polling for market spikes every hour\n // this.monitorInterval = setInterval(() => this.pollMarket(), 1000 * 60 * 60);\n }\n\n async stop(): Promise<void> {\n if (this.monitorInterval) {\n clearInterval(this.monitorInterval);\n }\n console.log(\"[TCG Oracle Service] Market Monitor Service stopped.\");\n }\n\n private pollMarket() {\n console.log(\"[TCG Oracle Service] Background task: Polling TCG market for price spikes...\");\n }\n}\n","/**\n * TCG Oracle — ElizaOS Plugin v1.0.0\n * ====================================\n * AI-powered trading card market intelligence for ElizaOS agents.\n * Native TypeScript rewrite of the Python G.A.M.E. SDK version.\n *\n * Features:\n * - Search 446K+ TCG products across 25+ games (Pokemon, MTG, Yu-Gi-Oh, etc.)\n * - AI Vision card grading (PSA/Beckett prediction via Qwen VL)\n * - Conformal-calibrated risk forecasts (honest VaR + Safe-Hold/Momentum grades);\n * Monte Carlo (GBM/Merton) opt-in via the model parameter\n * - Real-time market snapshots from TCGCSV daily data\n * - License key purchase & verification (Ethereum NFT)\n *\n * @see https://the-undesirables.com\n * @see https://github.com/sailorpepe/elizaos-tcg-oracle-plugin\n */\n\nimport { validateTcgOracleConfig } from \"./environment.js\";\nimport { MarketMonitorService } from \"./services.js\";\n\nimport type {\n Plugin,\n Action,\n Provider,\n IAgentRuntime,\n Memory,\n State,\n HandlerCallback,\n ActionExample,\n ActionResult,\n ProviderResult,\n} from \"@elizaos/core\";\n\n// ============================================================\n// Configuration\n// ============================================================\n\nconst SUPPORTED_GAMES = [\n \"Pokemon\",\n \"Magic: The Gathering\",\n \"Yu-Gi-Oh!\",\n \"Lorcana\",\n \"One Piece\",\n \"Flesh and Blood\",\n \"Star Wars: Unlimited\",\n \"Dragon Ball Super\",\n \"Digimon\",\n \"MetaZoo\",\n \"Union Arena\",\n \"Gundam Card Game\",\n \"LoL Riftbound\",\n] as const;\n\nconst SIMULATION_MODELS = [\"conformal\", \"merton\", \"gbm\"] as const;\n\n// ============================================================\n// API Client\n// ============================================================\n\nfunction getBaseUrl(runtime: IAgentRuntime): string {\n return (\n (runtime.getSetting?.(\"TCG_ORACLE_URL\") as string) ||\n process.env.TCG_ORACLE_URL ||\n \"\"\n );\n}\n\nasync function callApi(\n baseUrl: string,\n endpoint: string,\n params: Record<string, string | number>\n): Promise<{ data?: any; error?: string }> {\n if (!baseUrl) {\n return {\n error:\n \"TCG_ORACLE_URL not set. Set it in your character.json settings or as an environment variable. Install the server: pip install undesirables-mcp-server\",\n };\n }\n\n const url = new URL(`${baseUrl}${endpoint}`);\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null && value !== \"\") {\n url.searchParams.set(key, String(value));\n }\n }\n\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 30_000);\n\n const response = await fetch(url.toString(), {\n signal: controller.signal,\n headers: { \"User-Agent\": \"elizaos-tcg-oracle-plugin/1.0.0\" },\n });\n clearTimeout(timeout);\n\n if (!response.ok) {\n return { error: `API returned HTTP ${response.status}` };\n }\n\n const json = (await response.json()) as Record<string, any>;\n return { data: json.data || json };\n } catch (err: any) {\n if (err.name === \"AbortError\") {\n return { error: \"TCG Oracle API timed out (30s)\" };\n }\n return {\n error: \"Failed to connect to TCG Oracle API. Is the server running?\",\n };\n }\n}\n\n// ============================================================\n// Helper: Truncate data safely before JSON.stringify\n// ============================================================\n\nfunction safeStringify(data: any, maxItems = 10): string {\n if (Array.isArray(data)) {\n return JSON.stringify(data.slice(0, maxItems), null, 2);\n }\n return JSON.stringify(data, null, 2).slice(0, 2000);\n}\n\n// ============================================================\n// ACTION 1: Search TCG Products\n// ============================================================\n\nconst searchAction: Action = {\n name: \"TCG_ORACLE_SEARCH\",\n description:\n \"Search for trading card products across 25+ games including Pokemon, Magic: The Gathering, Yu-Gi-Oh, Lorcana, One Piece, and more. Returns product names, set info, and current market prices from 446K+ real products sourced from TCGCSV daily.\",\n similes: [\n \"SEARCH_CARDS\",\n \"FIND_CARD\",\n \"CARD_LOOKUP\",\n \"CARD_SEARCH\",\n \"TCG_SEARCH\",\n \"FIND_POKEMON\",\n \"SEARCH_MTG\",\n ],\n parameters: [\n {\n name: \"query\",\n description: \"The card name, set name, or keyword to search for (e.g., 'Charizard', 'Base Set', 'Pikachu VMAX')\",\n required: true,\n schema: { type: \"string\" },\n },\n {\n name: \"limit\",\n description: \"Maximum number of results to return (default: 10, max: 50)\",\n required: false,\n schema: { type: \"number\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Search for Charizard cards\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Searching TCG Oracle for Charizard...\", action: \"TCG_ORACLE_SEARCH\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"What Pikachu VMAX cards are available?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Looking up Pikachu VMAX products...\", action: \"TCG_ORACLE_SEARCH\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Find me Base Set holographic cards\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Searching for Base Set holographic cards...\", action: \"TCG_ORACLE_SEARCH\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => {\n return !!getBaseUrl(runtime);\n },\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content.text || \"\";\n\n // Extract search query — strip common prefixes\n const query = text\n .replace(/^(search|find|look up|lookup|what|show me)\\s+(for\\s+)?/i, \"\")\n .replace(/\\s+cards?\\s*$/i, \"\")\n .trim();\n\n if (!query) {\n if (callback) await callback({ text: \"What card would you like me to search for?\" });\n return { success: false, error: \"No search query provided\" };\n }\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/search\", {\n query,\n limit: 10,\n });\n\n if (result.error) {\n if (callback) await callback({ text: `Search failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data);\n const responseText = `Found products matching \"${query}\":\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_SEARCH\");\n return { success: true, text: responseText, data: { search_results: result.data } };\n },\n};\n\n// ============================================================\n// ACTION 2: AI Card Grading\n// ============================================================\n\nconst gradeAction: Action = {\n name: \"TCG_ORACLE_GRADE\",\n description:\n \"Grade a TCG card image using AI vision (Qwen VL model running locally). Predicts PSA and Beckett grading scores by analyzing centering, corners, edges, surface condition, and print quality. Works with Pokemon, MTG, Yu-Gi-Oh, and other TCG cards.\",\n similes: [\n \"GRADE_CARD\",\n \"CARD_GRADING\",\n \"PSA_GRADE\",\n \"BECKETT_GRADE\",\n \"RATE_CARD\",\n \"EVALUATE_CARD\",\n ],\n parameters: [\n {\n name: \"image_url\",\n description: \"Direct URL to the card image (PNG, JPG, or WebP)\",\n required: true,\n schema: { type: \"string\" },\n },\n {\n name: \"game\",\n description: \"The TCG game this card belongs to (default: Pokemon)\",\n required: false,\n schema: { type: \"string\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Grade this card: https://example.com/charizard.jpg\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Analyzing card image for grading...\", action: \"TCG_ORACLE_GRADE\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"What PSA grade would this get? https://i.imgur.com/card.png\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Running AI vision grading analysis...\", action: \"TCG_ORACLE_GRADE\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Rate the condition of this Magic card https://example.com/mtg.jpg\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Evaluating card condition for Beckett grading...\", action: \"TCG_ORACLE_GRADE\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content.text || \"\";\n\n // Extract URL from message\n const urlMatch = text.match(/https?:\\/\\/[^\\s]+/);\n if (!urlMatch) {\n if (callback) await callback({ text: \"Please provide a card image URL to grade.\" });\n return { success: false, error: \"No image URL found in message\" };\n }\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/grade\", {\n image_url: urlMatch[0],\n game: \"Pokemon\",\n });\n\n if (result.error) {\n if (callback) await callback({ text: `Grading failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data);\n const responseText = `Card grading complete:\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_GRADE\");\n return { success: true, text: responseText, data: { grade_result: result.data } };\n },\n};\n\n// ============================================================\n// ACTION 3: Conformal-Calibrated Price Forecast (Monte Carlo opt-in)\n// ============================================================\n\nconst simulateAction: Action = {\n name: \"TCG_ORACLE_SIMULATE\",\n description:\n \"Forecast a TCG card's future value with a conformal-calibrated risk model — honest VaR plus Safe-Hold/Momentum letter grades. Monte Carlo (GBM/Merton) is opt-in via the model parameter. Uses real drift and volatility computed from TCGCSV historical data. Monte Carlo models available opt-in: merton (jump-diffusion) and gbm. Returns percentile bands (5th, 25th, 50th, 75th, 95th) for the forecast period.\",\n similes: [\n \"SIMULATE_PRICE\",\n \"PRICE_PREDICTION\",\n \"FORECAST_PRICE\",\n \"MONTE_CARLO\",\n \"PRICE_FORECAST\",\n \"WHAT_WILL_THIS_BE_WORTH\",\n ],\n parameters: [\n {\n name: \"card_name\",\n description: \"Name of the card to simulate\",\n required: true,\n schema: { type: \"string\" },\n },\n {\n name: \"current_price\",\n description: \"Current price in USD\",\n required: true,\n schema: { type: \"number\" },\n },\n {\n name: \"model\",\n description: \"Forecast model (default 'conformal'): 'conformal' (regime-aware split-conformal bands, honest calibrated VaR), or opt into Monte Carlo with 'merton' (jump-diffusion) or 'gbm'\",\n required: false,\n schema: { type: \"string\", enumValues: [\"conformal\", \"merton\", \"gbm\"] },\n },\n {\n name: \"days\",\n description: \"Forecast horizon in days (default: 30)\",\n required: false,\n schema: { type: \"number\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Simulate the price of Charizard VMAX at $350 for 60 days\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Running Monte Carlo simulation on Charizard VMAX...\", action: \"TCG_ORACLE_SIMULATE\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"What will a PSA 10 Base Set Blastoise worth $800 be in 90 days using merton model?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Running Merton jump-diffusion simulation for Blastoise...\", action: \"TCG_ORACLE_SIMULATE\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Forecast Lorcana Elsa at $25 for 30 days\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Simulating Lorcana Elsa price trajectory...\", action: \"TCG_ORACLE_SIMULATE\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content.text || \"\";\n\n // Try to extract parameters from text\n const priceMatch = text.match(/\\$?([\\d,]+(?:\\.\\d{2})?)/);\n const daysMatch = text.match(/(\\d+)\\s*days?/i);\n const modelMatch = text.match(/\\b(conformal|merton|gbm)\\b/i);\n\n const cardName =\n text\n .replace(/simulate|price|forecast|monte carlo|at|\\$[\\d,.]+|\\d+\\s*days?|conformal|merton|gbm/gi, \"\")\n .replace(/\\s+/g, \" \")\n .trim() || \"Unknown Card\";\n\n const currentPrice = priceMatch ? parseFloat(priceMatch[1].replace(\",\", \"\")) : 0;\n const days = daysMatch ? parseInt(daysMatch[1]) : 30;\n const model = modelMatch ? modelMatch[1].toLowerCase() : \"conformal\";\n\n if (currentPrice <= 0) {\n if (callback) await callback({ text: \"Please provide a current price for the simulation. Example: 'Simulate Charizard VMAX at $350 for 60 days'\" });\n return { success: false, error: \"Invalid or missing current price\" };\n }\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/simulate\", {\n card_name: cardName,\n current_price: currentPrice,\n model,\n days,\n simulations: 10000,\n });\n\n if (result.error) {\n if (callback) await callback({ text: `Simulation failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data);\n const responseText = `Monte Carlo simulation for ${cardName} ($${currentPrice}, ${model} model, ${days} days):\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_SIMULATE\");\n return { success: true, text: responseText, data: { simulation_result: result.data } };\n },\n};\n\n// ============================================================\n// ACTION 4: Market Snapshot\n// ============================================================\n\nconst marketAction: Action = {\n name: \"TCG_ORACLE_MARKET\",\n description:\n \"Retrieve the latest daily market data snapshot from TCGCSV for a specific game. Returns top movers, price changes, volume data, and market trends. Data is refreshed daily via automated pipeline.\",\n similes: [\n \"MARKET_SNAPSHOT\",\n \"MARKET_DATA\",\n \"TCG_MARKET\",\n \"CARD_MARKET\",\n \"TOP_MOVERS\",\n \"PRICE_CHANGES\",\n ],\n parameters: [\n {\n name: \"game\",\n description: \"Game name: Pokemon, Magic: The Gathering, Yu-Gi-Oh, Lorcana, One Piece, etc\",\n required: false,\n schema: { type: \"string\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Show me the Pokemon market snapshot\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Pulling the latest Pokemon market data...\", action: \"TCG_ORACLE_MARKET\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"What's happening in the Yu-Gi-Oh market today?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Fetching Yu-Gi-Oh market snapshot...\", action: \"TCG_ORACLE_MARKET\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Top movers in Magic: The Gathering\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Pulling Magic: The Gathering market data...\", action: \"TCG_ORACLE_MARKET\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content.text?.toLowerCase() || \"\";\n\n // Detect game from message\n let game = \"Pokemon\";\n for (const g of SUPPORTED_GAMES) {\n if (text.includes(g.toLowerCase())) {\n game = g;\n break;\n }\n }\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/market\", { game });\n\n if (result.error) {\n if (callback) await callback({ text: `Market data failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data, 25);\n const responseText = `Market snapshot for ${game}:\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_MARKET\");\n return { success: true, text: responseText, data: { market_data: result.data } };\n },\n};\n\n// ============================================================\n// ACTION 5: Grade-or-Not Decision Engine\n// ============================================================\n\nconst gradeOrNotAction: Action = {\n name: \"TCG_ORACLE_GRADE_OR_NOT\",\n description:\n \"Answers 'will grading this card make me money?' by combining AI grade prediction with PSA fee schedules, shipping costs, and graded market values. Returns a GO/NO-GO verdict with expected ROI and profit scenarios (best case, predicted, worst case).\",\n similes: [\n \"SHOULD_I_GRADE\",\n \"GRADE_ROI\",\n \"GRADING_PROFIT\",\n \"IS_IT_WORTH_GRADING\",\n \"GRADE_OR_NOT\",\n ],\n parameters: [\n {\n name: \"card_name\",\n description: \"Name of the card to evaluate (e.g., 'Base Set Charizard Holo')\",\n required: true,\n schema: { type: \"string\" },\n },\n {\n name: \"predicted_grade\",\n description: \"Your predicted PSA grade (0 = auto-estimate)\",\n required: false,\n schema: { type: \"number\" },\n },\n {\n name: \"raw_price\",\n description: \"Current raw card value in USD (0 = auto-lookup)\",\n required: false,\n schema: { type: \"number\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"Should I grade my Base Set Charizard?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Running Grade-or-Not analysis...\", action: \"TCG_ORACLE_GRADE_OR_NOT\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Is it worth grading a PSA 8 Pikachu VMAX worth $45?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Calculating grading ROI for Pikachu VMAX...\", action: \"TCG_ORACLE_GRADE_OR_NOT\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content.text || \"\";\n\n // Extract card name\n const cardName = text\n .replace(/^(should i|is it worth|grade or not|grading roi|will grading)\\s*/i, \"\")\n .replace(/\\s*(make me money|be profitable|worth it)\\s*\\??$/i, \"\")\n .replace(/^(grade|grading)\\s*/i, \"\")\n .replace(/\\bmy\\b/i, \"\")\n .trim() || \"Unknown Card\";\n\n // Extract price and grade if mentioned\n const priceMatch = text.match(/\\$?([\\d,]+(?:\\.\\d{2})?)/);\n const gradeMatch = text.match(/\\bpsa\\s*(\\d+(?:\\.\\d)?)\\b/i) || text.match(/\\bgrade\\s*(\\d+(?:\\.\\d)?)\\b/i);\n\n const params: Record<string, string | number> = { card_name: cardName };\n if (priceMatch) params.raw_price = parseFloat(priceMatch[1].replace(\",\", \"\"));\n if (gradeMatch) params.predicted_grade = parseFloat(gradeMatch[1]);\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/grade-or-not\", params);\n\n if (result.error) {\n if (callback) await callback({ text: `Grade-or-Not analysis failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const data = result.data;\n const verdict = data?.verdict || \"Unknown\";\n const explanation = data?.explanation || \"\";\n const responseText = `Grade-or-Not verdict for ${cardName}:\\n\\n${verdict}\\n${explanation}\\n\\nFull analysis:\\n${safeStringify(data)}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_GRADE_OR_NOT\");\n return { success: true, text: responseText, data: { grade_or_not: data } };\n },\n};\n\n// ============================================================\n// ACTION 6: Trending Cards\n// ============================================================\n\nconst trendingAction: Action = {\n name: \"TCG_ORACLE_TRENDING\",\n description:\n \"Returns the top trending trading cards by market activity (30-day sales volume, views, and price velocity). Covers all 25 supported TCG games. Useful for spotting market momentum and emerging opportunities.\",\n similes: [\n \"TRENDING_CARDS\",\n \"HOT_CARDS\",\n \"TOP_MOVERS\",\n \"WHATS_TRENDING\",\n \"POPULAR_CARDS\",\n \"MARKET_TRENDS\",\n ],\n parameters: [\n {\n name: \"game\",\n description: \"Filter by game name (empty = all games)\",\n required: false,\n schema: { type: \"string\" },\n },\n {\n name: \"limit\",\n description: \"Number of results (default: 25, max: 100)\",\n required: false,\n schema: { type: \"number\" },\n },\n ],\n examples: [\n [\n { name: \"{{user1}}\", content: { text: \"What Pokemon cards are trending right now?\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Pulling trending Pokemon cards...\", action: \"TCG_ORACLE_TRENDING\" } } as ActionExample,\n ],\n [\n { name: \"{{user1}}\", content: { text: \"Show me the hottest cards across all games\" } } as ActionExample,\n { name: \"{{agentName}}\", content: { text: \"Fetching trending cards across all TCG games...\", action: \"TCG_ORACLE_TRENDING\" } } as ActionExample,\n ],\n ],\n validate: async (runtime: IAgentRuntime) => !!getBaseUrl(runtime),\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult | undefined> => {\n const text = message.content?.text?.toLowerCase() || \"\";\n\n // Detect game from message\n let game = \"\";\n for (const g of SUPPORTED_GAMES) {\n if (text.includes(g.toLowerCase())) {\n game = g;\n break;\n }\n }\n\n const params: Record<string, string | number> = { limit: 25 };\n if (game) params.game = game;\n\n const result = await callApi(getBaseUrl(runtime), \"/api/v1/trending\", params);\n\n if (result.error) {\n if (callback) await callback({ text: `Trending cards failed: ${result.error}` });\n return { success: false, error: result.error };\n }\n\n const summary = safeStringify(result.data, 15);\n const responseText = `Trending cards${game ? ` for ${game}` : \" across all games\"}:\\n\\n${summary}`;\n\n if (callback) await callback({ text: responseText }, \"TCG_ORACLE_TRENDING\");\n return { success: true, text: responseText, data: { trending: result.data } };\n },\n};\n\n// ============================================================\n// PROVIDER: TCG Oracle Context\n// ============================================================\n\nconst tcgOracleProvider: Provider = {\n name: \"tcg-oracle\",\n description: \"Provides TCG Oracle market intelligence context to the agent\",\n get: async (\n runtime: IAgentRuntime,\n _message: Memory,\n _state: State\n ): Promise<ProviderResult> => {\n const baseUrl = getBaseUrl(runtime);\n const status = baseUrl ? \"connected\" : \"not configured\";\n\n return {\n text: `[TCG Oracle v1.1.0]\nStatus: ${status}\nDatabase: 446K+ products across 25+ games\nData source: TCGCSV daily snapshots\nModels: conformal (default — regime-aware split-conformal bands, honest VaR), merton (jump-diffusion), gbm — Monte Carlo is opt-in\nActions: search, grade, simulate, market, grade-or-not, trending\nSupported games: ${SUPPORTED_GAMES.join(\", \")}\nAPI: ${baseUrl || \"TCG_ORACLE_URL not set\"}\n\nThe agent can search cards, grade card images, simulate prices via Monte Carlo, pull market snapshots, check grading ROI, view trending cards, and scan for grading arbitrage opportunities.`,\n values: {\n tcgOracleStatus: status,\n tcgOracleUrl: baseUrl || \"not set\",\n totalProducts: 370158,\n },\n };\n },\n};\n\n// ============================================================\n// PLUGIN EXPORT\n// ============================================================\n\nconst tcgOraclePlugin: Plugin = {\n name: \"@undesirables/plugin-tcg-oracle\",\n description:\n \"TCG Oracle — AI-powered trading card market intelligence for ElizaOS agents. \" +\n \"Covers 446K+ products across 25+ games with conformal-calibrated risk \" +\n \"forecasts — honest VaR plus Safe-Hold/Momentum letter grades, with Monte \" +\n \"Carlo (GBM/Merton) available opt-in — AI vision card grading with ROI analysis, \" +\n \"trending cards feed, and real-time market snapshots. \" +\n \"Powered by TCGCSV daily data pipeline.\",\n init: async (config: Record<string, string>, runtime: IAgentRuntime) => {\n const validation = validateTcgOracleConfig(runtime);\n if (!validation.valid) {\n console.warn(`⚠️ TCG Oracle: ${validation.error}`);\n } else {\n console.log(`✅ TCG Oracle v1.1.0 connected to ${runtime.getSetting?.(\"TCG_ORACLE_URL\")}`);\n }\n },\n actions: [searchAction, gradeAction, simulateAction, marketAction, gradeOrNotAction, trendingAction],\n providers: [tcgOracleProvider],\n evaluators: [],\n services: [MarketMonitorService],\n};\n\nexport default tcgOraclePlugin;\nexport { SUPPORTED_GAMES, SIMULATION_MODELS };\n\n"],"mappings":";AAMO,SAAS,wBACd,SACoC;AACpC,QAAM,MACH,QAAQ,aAAa,gBAAgB,KACtC,QAAQ,IAAI,kBACZ;AAEF,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OACE;AAAA,IAEJ;AAAA,EACF;AAEA,MAAI;AACF,QAAI,IAAI,GAAG;AAAA,EACb,QAAQ;AACN,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO,uCAAuC,GAAG;AAAA,IACnD;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,KAAK;AACvB;;;ACjCA,SAAS,eAA8B;AAEhC,IAAM,uBAAN,MAAM,8BAA6B,QAAQ;AAAA;AAAA;AAAA,EAGhD,OAAO,cAAc;AAAA,E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c,WAAW;AAAA,QACzB,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AACF;AAMA,IAAM,kBAA0B;AAAA,EAC9B,MAAM;AAAA,EACN,aACE;AAAA,EAMF,MAAM,OAAO,QAAgC,YAA2B;AACtE,UAAM,aAAa,wBAAwB,OAAO;AAClD,QAAI,CAAC,WAAW,OAAO;AACrB,cAAQ,KAAK,4BAAkB,WAAW,KAAK,EAAE;AAAA,IACnD,OAAO;AACL,cAAQ,IAAI,yCAAoC,QAAQ,aAAa,gBAAgB,CAAC,EAAE;AAAA,IAC1F;AAAA,EACF;AAAA,EACA,SAAS,CAAC,cAAc,aAAa,gBAAgB,cAAc,kBAAkB,cAAc;AAAA,EACnG,WAAW,CAAC,iBAAiB;AAAA,EAC7B,YAAY,CAAC;AAAA,EACb,UAAU,CAAC,oBAAoB;AACjC;AAEA,IAAO,gBAAQ;","names":[]}
package/images/banner.jpg CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@undesirables/plugin-tcg-oracle",
3
- "version": "1.1.0",
4
- "description": "ElizaOS plugin for TCG Oracle — AI-powered trading card market intelligence. 7 actions: search, grade, simulate, market, grade-or-not ROI engine, trending cards, and grading arbitrage scanner. Covers 370K+ products across 25 games.",
3
+ "version": "2.0.0",
4
+ "description": "ElizaOS plugin for TCG Oracle \u2014 AI-powered trading card market intelligence. 6 actions: search, grade, simulate, market, grade-or-not ROI engine, and trending cards. Covers 446K+ products across 25+ games with conformal-calibrated risk forecasts.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "pokemon",
27
27
  "magic-the-gathering",
28
28
  "yugioh",
29
- "monte-carlo",
29
+ "risk-forecasting",
30
30
  "card-grading",
31
31
  "market-intelligence",
32
32
  "price-prediction"
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@undesirables/plugin-tcg-oracle",
3
3
  "version": "1.0.0",
4
- "description": "ElizaOS plugin for TCG Oracle — AI-powered trading card market intelligence with Monte Carlo simulation and AI vision grading for 370K+ products across 25 games.",
4
+ "description": "ElizaOS plugin for TCG Oracle — AI-powered trading card market intelligence with calibrated risk forecasts and AI vision grading for 370K+ products across 25 games.",
5
5
  "author": "The Undesirables LLC",
6
6
  "license": "BUSL-1.1",
7
7
  "type": "module",
@@ -17,7 +17,7 @@
17
17
  "elizaos-plugins",
18
18
  "tcg",
19
19
  "trading-cards",
20
- "monte-carlo",
20
+ "risk-forecasting",
21
21
  "card-grading",
22
22
  "market-intelligence"
23
23
  ],