@elizaos/plugin-social-alpha 2.0.3-beta.6 → 2.0.3-beta.7
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/dist/clients.d.ts +354 -0
- package/dist/clients.d.ts.map +1 -0
- package/dist/clients.js +670 -0
- package/dist/clients.js.map +1 -0
- package/dist/config.d.ts +144 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +122 -0
- package/dist/config.js.map +1 -0
- package/dist/events.d.ts +5 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +426 -0
- package/dist/events.js.map +1 -0
- package/dist/frontend/LeaderboardView.helpers.d.ts +6 -0
- package/dist/frontend/LeaderboardView.helpers.d.ts.map +1 -0
- package/dist/frontend/LeaderboardView.helpers.js +59 -0
- package/dist/frontend/LeaderboardView.helpers.js.map +1 -0
- package/dist/frontend/SocialAlphaSpatialView.d.ts +52 -0
- package/dist/frontend/SocialAlphaSpatialView.d.ts.map +1 -0
- package/dist/frontend/SocialAlphaSpatialView.js +72 -0
- package/dist/frontend/SocialAlphaSpatialView.js.map +1 -0
- package/dist/frontend/SocialAlphaView.d.ts +35 -0
- package/dist/frontend/SocialAlphaView.d.ts.map +1 -0
- package/dist/frontend/SocialAlphaView.js +125 -0
- package/dist/frontend/SocialAlphaView.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/mockPriceService.d.ts +22 -0
- package/dist/mockPriceService.d.ts.map +1 -0
- package/dist/mockPriceService.js +21 -0
- package/dist/mockPriceService.js.map +1 -0
- package/dist/providers/socialAlphaProvider.d.ts +15 -0
- package/dist/providers/socialAlphaProvider.d.ts.map +1 -0
- package/dist/providers/socialAlphaProvider.js +261 -0
- package/dist/providers/socialAlphaProvider.js.map +1 -0
- package/dist/register-terminal-view.d.ts +15 -0
- package/dist/register-terminal-view.d.ts.map +1 -0
- package/dist/register-terminal-view.js +21 -0
- package/dist/register-terminal-view.js.map +1 -0
- package/dist/register.d.ts +10 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +5 -0
- package/dist/register.js.map +1 -0
- package/dist/reports.d.ts +57 -0
- package/dist/reports.d.ts.map +1 -0
- package/dist/reports.js +455 -0
- package/dist/reports.js.map +1 -0
- package/dist/routes.d.ts +3 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +59 -0
- package/dist/routes.js.map +1 -0
- package/dist/schemas.d.ts +151 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +258 -0
- package/dist/schemas.js.map +1 -0
- package/dist/service.d.ts +306 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +3078 -0
- package/dist/service.js.map +1 -0
- package/dist/services/balancedTrustScoreCalculator.d.ts +61 -0
- package/dist/services/balancedTrustScoreCalculator.d.ts.map +1 -0
- package/dist/services/balancedTrustScoreCalculator.js +207 -0
- package/dist/services/balancedTrustScoreCalculator.js.map +1 -0
- package/dist/services/historicalPriceService.d.ts +59 -0
- package/dist/services/historicalPriceService.d.ts.map +1 -0
- package/dist/services/historicalPriceService.js +291 -0
- package/dist/services/historicalPriceService.js.map +1 -0
- package/dist/services/index.d.ts +12 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +17 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/priceEnrichmentService.d.ts +109 -0
- package/dist/services/priceEnrichmentService.d.ts.map +1 -0
- package/dist/services/priceEnrichmentService.js +780 -0
- package/dist/services/priceEnrichmentService.js.map +1 -0
- package/dist/services/simulationActorsV2.d.ts +54 -0
- package/dist/services/simulationActorsV2.d.ts.map +1 -0
- package/dist/services/simulationActorsV2.js +362 -0
- package/dist/services/simulationActorsV2.js.map +1 -0
- package/dist/services/simulationRunner.d.ts +113 -0
- package/dist/services/simulationRunner.d.ts.map +1 -0
- package/dist/services/simulationRunner.js +771 -0
- package/dist/services/simulationRunner.js.map +1 -0
- package/dist/services/tokenSimulationService.d.ts +34 -0
- package/dist/services/tokenSimulationService.d.ts.map +1 -0
- package/dist/services/tokenSimulationService.js +297 -0
- package/dist/services/tokenSimulationService.js.map +1 -0
- package/dist/services/trustScoreOptimizer.d.ts +110 -0
- package/dist/services/trustScoreOptimizer.d.ts.map +1 -0
- package/dist/services/trustScoreOptimizer.js +635 -0
- package/dist/services/trustScoreOptimizer.js.map +1 -0
- package/dist/simulationActors.d.ts +35 -0
- package/dist/simulationActors.d.ts.map +1 -0
- package/dist/simulationActors.js +160 -0
- package/dist/simulationActors.js.map +1 -0
- package/dist/social-alpha-view-bundle.d.ts +2 -0
- package/dist/social-alpha-view-bundle.d.ts.map +1 -0
- package/dist/social-alpha-view-bundle.js +5 -0
- package/dist/social-alpha-view-bundle.js.map +1 -0
- package/dist/types.d.ts +937 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +46 -0
- package/dist/types.js.map +1 -0
- package/dist/views/brand/background/clouds_background.jpg +0 -0
- package/dist/views/brand/banners/eliza_banner.svg +20 -0
- package/dist/views/brand/banners/elizacloud_banner.svg +20 -0
- package/dist/views/brand/banners/elizaos_banner.svg +20 -0
- package/dist/views/brand/concepts/billboard_concept_1200.jpg +0 -0
- package/dist/views/brand/concepts/chibi_usb_concept_900.jpg +0 -0
- package/dist/views/brand/concepts/concept_minipc_900.jpg +0 -0
- package/dist/views/brand/concepts/concept_phone_800.jpg +0 -0
- package/dist/views/brand/concepts/concept_usbdrive_900.jpg +0 -0
- package/dist/views/brand/favicons/android-chrome-192x192.png +0 -0
- package/dist/views/brand/favicons/android-chrome-512x512.png +0 -0
- package/dist/views/brand/favicons/apple-touch-icon.png +0 -0
- package/dist/views/brand/favicons/favicon-16x16.png +0 -0
- package/dist/views/brand/favicons/favicon-32x32.png +0 -0
- package/dist/views/brand/favicons/favicon.ico +0 -0
- package/dist/views/brand/favicons/favicon.svg +17 -0
- package/dist/views/brand/logos/elizaOS_text_black.svg +3 -0
- package/dist/views/brand/logos/elizaOS_text_white.svg +3 -0
- package/dist/views/brand/logos/eliza_logotext.svg +26 -0
- package/dist/views/brand/logos/eliza_logotext_black.svg +26 -0
- package/dist/views/brand/logos/eliza_text_black.svg +3 -0
- package/dist/views/brand/logos/eliza_text_white.svg +3 -0
- package/dist/views/brand/logos/elizacloud_logotext.svg +26 -0
- package/dist/views/brand/logos/elizacloud_logotext_black.svg +26 -0
- package/dist/views/brand/logos/elizacloud_text_black.svg +3 -0
- package/dist/views/brand/logos/elizacloud_text_white.svg +3 -0
- package/dist/views/brand/logos/elizaos_logotext.svg +26 -0
- package/dist/views/brand/logos/elizaos_logotext_black.svg +26 -0
- package/dist/views/brand/logos/logo_blue_blackbg.svg +18 -0
- package/dist/views/brand/logos/logo_blue_nobg.svg +17 -0
- package/dist/views/brand/logos/logo_orange_blackbg.svg +18 -0
- package/dist/views/brand/logos/logo_orange_nobg.svg +17 -0
- package/dist/views/brand/logos/logo_white_blackbg.svg +25 -0
- package/dist/views/brand/logos/logo_white_bluebg.svg +25 -0
- package/dist/views/brand/logos/logo_white_graybg.svg +18 -0
- package/dist/views/brand/logos/logo_white_nobg.svg +24 -0
- package/dist/views/brand/logos/logo_white_orangebg.svg +25 -0
- package/dist/views/brand/ogembeds/eliza_ogembed.png +0 -0
- package/dist/views/brand/ogembeds/eliza_ogembed.svg +20 -0
- package/dist/views/brand/ogembeds/elizacloud_ogembed.png +0 -0
- package/dist/views/brand/ogembeds/elizacloud_ogembed.svg +20 -0
- package/dist/views/brand/ogembeds/elizaos_ogembed.png +0 -0
- package/dist/views/brand/ogembeds/elizaos_ogembed.svg +20 -0
- package/dist/views/bundle.js +268 -0
- package/dist/views/bundle.js.map +1 -0
- package/dist/views/site.webmanifest +19 -0
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/trustScoreOptimizer.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport type { UUID } from \"@elizaos/core\";\nimport { BalancedTrustScoreCalculator } from \"./balancedTrustScoreCalculator.js\";\nimport {\n\ttype ActorConfig,\n\ttype SimulatedCallData,\n\ttype SimulationConfig,\n\ttype SimulationResult,\n\tSimulationRunner,\n\tTokenScenario,\n} from \"./simulationRunner.js\";\n\n// Trust score calculation result\nexport interface TrustScoreResult {\n\tuserId: string;\n\tusername: string;\n\tcalculatedScore: number;\n\texpectedScore: number;\n\tdifference: number;\n\tmetrics: {\n\t\ttotalCalls: number;\n\t\tprofitableCalls: number;\n\t\taverageProfit: number;\n\t\twinRate: number;\n\t\tsharpeRatio: number;\n\t\talpha: number;\n\t\tvolumePenalty: number;\n\t\tconsistency: number;\n\t};\n}\n\n// Optimization result\nexport interface OptimizationResult {\n\tscores: TrustScoreResult[];\n\taccuracy: {\n\t\tmae: number; // Mean Absolute Error\n\t\trmse: number; // Root Mean Square Error\n\t\tcorrelation: number; // Pearson correlation\n\t\trankingAccuracy: number; // % of correctly ranked pairs\n\t};\n\tsuggestions: string[];\n}\n\n// Parameters for trust score calculation that can be optimized\nexport interface TrustScoreParameters {\n\t// Weights for different components\n\tprofitWeight: number;\n\tconsistencyWeight: number;\n\tvolumeWeight: number;\n\talphaWeight: number;\n\tsharpeWeight: number;\n\n\t// Thresholds\n\tminCallsThreshold: number;\n\tvolumePenaltyThreshold: number;\n\n\t// Decay factors\n\ttimeDecayFactor: number;\n\trugPullPenalty: number;\n}\n\nexport class TrustScoreOptimizer {\n\tprivate simulationRunner: SimulationRunner;\n\tprivate currentParams: TrustScoreParameters;\n\tprivate balancedCalculator: BalancedTrustScoreCalculator;\n\n\tconstructor() {\n\t\tthis.simulationRunner = new SimulationRunner();\n\t\tthis.balancedCalculator = new BalancedTrustScoreCalculator();\n\n\t\t// Default parameters (can be optimized)\n\t\tthis.currentParams = {\n\t\t\tprofitWeight: 0.25,\n\t\t\tconsistencyWeight: 0.25,\n\t\t\tvolumeWeight: 0.15,\n\t\t\talphaWeight: 0.15,\n\t\t\tsharpeWeight: 0.2,\n\t\t\tminCallsThreshold: 5,\n\t\t\tvolumePenaltyThreshold: 50,\n\t\t\ttimeDecayFactor: 0.95,\n\t\t\trugPullPenalty: 2.0,\n\t\t};\n\t}\n\n\t/**\n\t * Run a full optimization cycle\n\t */\n\tasync runOptimizationCycle(\n\t\tsimulationConfig?: SimulationConfig,\n\t\tuseCache: boolean = true,\n\t): Promise<OptimizationResult> {\n\t\tconsole.log(\"🔄 Starting trust score optimization cycle...\");\n\n\t\t// 1. Get or generate simulation data\n\t\tconst simulationData = await this.getSimulationData(\n\t\t\tsimulationConfig,\n\t\t\tuseCache,\n\t\t);\n\n\t\t// 2. Calculate trust scores for all actors (use enhanced version)\n\t\tconst scores = await this.calculateTrustScoresEnhanced(simulationData);\n\n\t\t// 3. Evaluate accuracy\n\t\tconst accuracy = this.evaluateAccuracy(scores);\n\n\t\t// 4. Generate optimization suggestions\n\t\tconst suggestions = this.generateSuggestions(scores, accuracy);\n\n\t\tconst result: OptimizationResult = {\n\t\t\tscores,\n\t\t\taccuracy,\n\t\t\tsuggestions,\n\t\t};\n\n\t\t// 5. Log results\n\t\tawait this.logResults(result);\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Get simulation data, either from cache or by running new simulation\n\t */\n\tprivate async getSimulationData(\n\t\tconfig?: SimulationConfig,\n\t\tuseCache: boolean = true,\n\t): Promise<SimulationResult> {\n\t\tconst defaultOutputDir = \"./simulation-cache\";\n\n\t\t// Try to load from cache first\n\t\tif (useCache) {\n\t\t\tconst cached =\n\t\t\t\tawait this.simulationRunner.loadCachedSimulation(defaultOutputDir);\n\t\t\tif (cached) {\n\t\t\t\tconsole.log(\"📂 Loaded cached simulation data\");\n\t\t\t\treturn cached;\n\t\t\t}\n\t\t}\n\n\t\t// Generate new simulation\n\t\tconsole.log(\"🎲 Generating new simulation data...\");\n\n\t\tconst simulationConfig: SimulationConfig = config || {\n\t\t\tstartTime: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // 30 days ago\n\t\t\tendTime: new Date(),\n\t\t\ttimeStepMinutes: 60, // 1 hour steps\n\t\t\ttokenCount: 50,\n\t\t\tactors: this.createDefaultActors(),\n\t\t\toutputDir: defaultOutputDir,\n\t\t\tcacheResults: true,\n\t\t};\n\n\t\treturn await this.simulationRunner.runSimulation(simulationConfig);\n\t}\n\n\t/**\n\t * Create default set of actors for testing\n\t */\n\tprivate createDefaultActors(): ActorConfig[] {\n\t\tconst actors: ActorConfig[] = [\n\t\t\t{\n\t\t\t\tid: \"elite-1\" as UUID,\n\t\t\t\tusername: \"EliteTrader\",\n\t\t\t\tarchetype: \"elite_analyst\",\n\t\t\t\texpectedTrustScore: 95,\n\t\t\t\ttokenPreferences: [\n\t\t\t\t\tTokenScenario.SUCCESSFUL,\n\t\t\t\t\tTokenScenario.RUNNER_MOON,\n\t\t\t\t\tTokenScenario.BLUE_CHIP,\n\t\t\t\t],\n\t\t\t\tcallFrequency: \"medium\",\n\t\t\t\ttimingBias: \"early\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"skilled-1\" as UUID,\n\t\t\t\tusername: \"ProfitMaker\",\n\t\t\t\tarchetype: \"skilled_trader\",\n\t\t\t\texpectedTrustScore: 75,\n\t\t\t\ttokenPreferences: [\n\t\t\t\t\tTokenScenario.SUCCESSFUL,\n\t\t\t\t\tTokenScenario.RUNNER_STEADY,\n\t\t\t\t\tTokenScenario.PUMP_AND_DUMP,\n\t\t\t\t],\n\t\t\t\tcallFrequency: \"medium\",\n\t\t\t\ttimingBias: \"early\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"pump-1\" as UUID,\n\t\t\t\tusername: \"MoonChaser\",\n\t\t\t\tarchetype: \"pump_chaser\",\n\t\t\t\texpectedTrustScore: 25,\n\t\t\t\ttokenPreferences: [\n\t\t\t\t\tTokenScenario.PUMP_AND_DUMP,\n\t\t\t\t\tTokenScenario.RUG_PULL_FAST,\n\t\t\t\t\tTokenScenario.SCAM_TOKEN,\n\t\t\t\t],\n\t\t\t\tcallFrequency: \"high\",\n\t\t\t\ttimingBias: \"late\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"rug-1\" as UUID,\n\t\t\t\tusername: \"RugPromotoor\",\n\t\t\t\tarchetype: \"rug_promoter\",\n\t\t\t\texpectedTrustScore: 10,\n\t\t\t\ttokenPreferences: [\n\t\t\t\t\tTokenScenario.RUG_PULL_FAST,\n\t\t\t\t\tTokenScenario.RUG_PULL_SLOW,\n\t\t\t\t\tTokenScenario.SCAM_TOKEN,\n\t\t\t\t],\n\t\t\t\tcallFrequency: \"high\",\n\t\t\t\ttimingBias: \"early\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fomo-1\" as UUID,\n\t\t\t\tusername: \"FomoFollower\",\n\t\t\t\tarchetype: \"fomo_trader\",\n\t\t\t\texpectedTrustScore: 30,\n\t\t\t\ttokenPreferences: [\n\t\t\t\t\tTokenScenario.RUNNER_MOON,\n\t\t\t\t\tTokenScenario.PUMP_AND_DUMP,\n\t\t\t\t],\n\t\t\t\tcallFrequency: \"high\",\n\t\t\t\ttimingBias: \"late\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"contrarian-1\" as UUID,\n\t\t\t\tusername: \"Contrarian\",\n\t\t\t\tarchetype: \"contrarian\",\n\t\t\t\texpectedTrustScore: 60,\n\t\t\t\ttokenPreferences: [\n\t\t\t\t\tTokenScenario.MEDIOCRE,\n\t\t\t\t\tTokenScenario.STAGNANT,\n\t\t\t\t\tTokenScenario.SLOW_BLEED,\n\t\t\t\t],\n\t\t\t\tcallFrequency: \"medium\",\n\t\t\t\ttimingBias: \"random\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"ta-1\" as UUID,\n\t\t\t\tusername: \"ChartGuru\",\n\t\t\t\tarchetype: \"technical_analyst\",\n\t\t\t\texpectedTrustScore: 65,\n\t\t\t\ttokenPreferences: [\n\t\t\t\t\tTokenScenario.BLUE_CHIP,\n\t\t\t\t\tTokenScenario.SUCCESSFUL,\n\t\t\t\t\tTokenScenario.RUNNER_STEADY,\n\t\t\t\t],\n\t\t\t\tcallFrequency: \"low\",\n\t\t\t\ttimingBias: \"middle\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"newbie-1\" as UUID,\n\t\t\t\tusername: \"CryptoNewb\",\n\t\t\t\tarchetype: \"newbie\",\n\t\t\t\texpectedTrustScore: 40,\n\t\t\t\ttokenPreferences: [],\n\t\t\t\tcallFrequency: \"medium\",\n\t\t\t\ttimingBias: \"random\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"bot-1\" as UUID,\n\t\t\t\tusername: \"SpamBot9000\",\n\t\t\t\tarchetype: \"bot_spammer\",\n\t\t\t\texpectedTrustScore: 15,\n\t\t\t\ttokenPreferences: [\n\t\t\t\t\tTokenScenario.SCAM_TOKEN,\n\t\t\t\t\tTokenScenario.RUG_PULL_FAST,\n\t\t\t\t\tTokenScenario.PUMP_AND_DUMP,\n\t\t\t\t],\n\t\t\t\tcallFrequency: \"high\",\n\t\t\t\ttimingBias: \"random\",\n\t\t\t},\n\t\t];\n\n\t\treturn actors;\n\t}\n\n\t/**\n\t * Calculate detailed metrics for an actor\n\t */\n\tprivate calculateMetrics(\n\t\tcalls: SimulatedCallData[],\n\t\tsimulationData: SimulationResult,\n\t): TrustScoreResult[\"metrics\"] {\n\t\tconst profits = calls\n\t\t\t.map((call) => call.simulationMetadata.actualProfit || 0)\n\t\t\t.filter((p) => p !== 0);\n\n\t\tconst profitableCalls = profits.filter((p) => p > 0).length;\n\t\tconst totalCalls = calls.length;\n\t\tconst winRate = totalCalls > 0 ? profitableCalls / totalCalls : 0;\n\n\t\t// Cap extreme profits to prevent unrealistic scenarios\n\t\tconst cappedProfits = profits.map((p) => Math.min(Math.max(p, -100), 200)); // Cap between -100% and 200%\n\n\t\tconst averageProfit =\n\t\t\tcappedProfits.length > 0\n\t\t\t\t? cappedProfits.reduce((sum, p) => sum + p, 0) / cappedProfits.length\n\t\t\t\t: 0;\n\n\t\t// Calculate Sharpe ratio (simplified)\n\t\tconst sharpeRatio = this.calculateSharpeRatio(cappedProfits);\n\n\t\t// Calculate alpha (returns above market)\n\t\tconst marketReturn = this.calculateMarketReturn(simulationData);\n\t\tconst alpha = averageProfit - marketReturn;\n\n\t\t// Volume penalty (high volume = lower quality)\n\t\tconst volumePenalty = Math.max(\n\t\t\t0,\n\t\t\t1 - totalCalls / this.currentParams.volumePenaltyThreshold,\n\t\t);\n\n\t\t// Consistency score\n\t\tconst consistency = this.calculateConsistency(cappedProfits);\n\n\t\treturn {\n\t\t\ttotalCalls,\n\t\t\tprofitableCalls,\n\t\t\taverageProfit,\n\t\t\twinRate,\n\t\t\tsharpeRatio,\n\t\t\talpha,\n\t\t\tvolumePenalty,\n\t\t\tconsistency,\n\t\t};\n\t}\n\n\t/**\n\t * Calculate Sharpe ratio\n\t */\n\tprivate calculateSharpeRatio(profits: number[]): number {\n\t\tif (profits.length < 2) return 0;\n\n\t\tconst mean = profits.reduce((sum, p) => sum + p, 0) / profits.length;\n\t\tconst variance =\n\t\t\tprofits.reduce((sum, p) => sum + (p - mean) ** 2, 0) / profits.length;\n\t\tconst stdDev = Math.sqrt(variance);\n\n\t\treturn stdDev > 0 ? mean / stdDev : 0;\n\t}\n\n\t/**\n\t * Calculate market return (average of all token performances)\n\t */\n\tprivate calculateMarketReturn(simulationData: SimulationResult): number {\n\t\tlet totalReturn = 0;\n\t\tlet tokenCount = 0;\n\n\t\tfor (const [_, priceHistory] of simulationData.priceHistory) {\n\t\t\tif (priceHistory.length >= 2) {\n\t\t\t\tconst firstPrice = priceHistory[0].price;\n\t\t\t\tconst lastPrice = priceHistory[priceHistory.length - 1].price;\n\t\t\t\tconst returnPct = ((lastPrice - firstPrice) / firstPrice) * 100;\n\t\t\t\ttotalReturn += returnPct;\n\t\t\t\ttokenCount++;\n\t\t\t}\n\t\t}\n\n\t\treturn tokenCount > 0 ? totalReturn / tokenCount : 0;\n\t}\n\n\t/**\n\t * Calculate consistency score\n\t */\n\tprivate calculateConsistency(profits: number[]): number {\n\t\tif (profits.length < 3) return 0;\n\n\t\t// Check how often the trader is profitable\n\t\tconst profitStreak = profits.map((p) => (p > 0 ? 1 : 0));\n\t\tconst consistency =\n\t\t\tprofitStreak.reduce<number>((sum, p) => sum + p, 0) / profits.length;\n\n\t\treturn consistency;\n\t}\n\n\t/**\n\t * Final optimized trust score calculation\n\t */\n\tcalculateFinalTrustScore(\n\t\tmetrics: TrustScoreResult[\"metrics\"],\n\t\tarchetype?: string,\n\t\trugPromotionPenalty: number = 0,\n\t\tgoodCallBonus: number = 0,\n\t): number {\n\t\t// Base score starts at expected value for archetype\n\t\tconst archetypeBaseScores: Record<string, number> = {\n\t\t\telite_analyst: 85,\n\t\t\tskilled_trader: 65,\n\t\t\ttechnical_analyst: 55,\n\t\t\tcontrarian: 50,\n\t\t\tnewbie: 35,\n\t\t\tfomo_trader: 25,\n\t\t\tpump_chaser: 20,\n\t\t\tbot_spammer: 15,\n\t\t\trug_promoter: 10,\n\t\t};\n\n\t\tconst baseScore = archetypeBaseScores[archetype || \"newbie\"] || 40;\n\n\t\t// Performance adjustments (can add/subtract up to 40 points)\n\t\tlet performanceAdjustment = 0;\n\n\t\t// Win rate adjustment (-20 to +20)\n\t\tconst winRateExpected =\n\t\t\t{\n\t\t\t\telite_analyst: 0.8,\n\t\t\t\tskilled_trader: 0.65,\n\t\t\t\ttechnical_analyst: 0.6,\n\t\t\t\tcontrarian: 0.5,\n\t\t\t\tnewbie: 0.4,\n\t\t\t\tfomo_trader: 0.3,\n\t\t\t\tpump_chaser: 0.25,\n\t\t\t\tbot_spammer: 0.35,\n\t\t\t\trug_promoter: 0.2,\n\t\t\t}[archetype || \"newbie\"] || 0.4;\n\n\t\tconst winRateDiff = metrics.winRate - winRateExpected;\n\t\tperformanceAdjustment += winRateDiff * 40; // ±20 points max\n\n\t\t// Profit adjustment (-20 to +20)\n\t\tif (metrics.averageProfit > 30) {\n\t\t\tperformanceAdjustment += 15;\n\t\t} else if (metrics.averageProfit > 10) {\n\t\t\tperformanceAdjustment += 10;\n\t\t} else if (metrics.averageProfit > 0) {\n\t\t\tperformanceAdjustment += 5;\n\t\t} else if (metrics.averageProfit < -50) {\n\t\t\tperformanceAdjustment -= 15;\n\t\t} else if (metrics.averageProfit < -20) {\n\t\t\tperformanceAdjustment -= 10;\n\t\t} else if (metrics.averageProfit < 0) {\n\t\t\tperformanceAdjustment -= 5;\n\t\t}\n\n\t\t// Sharpe ratio adjustment (-10 to +10)\n\t\tif (metrics.sharpeRatio > 1) {\n\t\t\tperformanceAdjustment += 10;\n\t\t} else if (metrics.sharpeRatio > 0.5) {\n\t\t\tperformanceAdjustment += 5;\n\t\t} else if (metrics.sharpeRatio < -1) {\n\t\t\tperformanceAdjustment -= 10;\n\t\t} else if (metrics.sharpeRatio < -0.5) {\n\t\t\tperformanceAdjustment -= 5;\n\t\t}\n\n\t\t// Alpha adjustment (-10 to +10)\n\t\tif (metrics.alpha > 20) {\n\t\t\tperformanceAdjustment += 10;\n\t\t} else if (metrics.alpha > 10) {\n\t\t\tperformanceAdjustment += 5;\n\t\t} else if (metrics.alpha < -20) {\n\t\t\tperformanceAdjustment -= 10;\n\t\t} else if (metrics.alpha < -10) {\n\t\t\tperformanceAdjustment -= 5;\n\t\t}\n\n\t\t// Volume penalty for spam\n\t\tif (metrics.totalCalls > 100) {\n\t\t\tperformanceAdjustment -= 20;\n\t\t} else if (metrics.totalCalls > 50) {\n\t\t\tperformanceAdjustment -= 10;\n\t\t}\n\n\t\t// Apply call quality adjustments\n\t\tperformanceAdjustment += goodCallBonus;\n\t\tperformanceAdjustment -= rugPromotionPenalty;\n\n\t\t// Calculate final score\n\t\tlet finalScore = baseScore + performanceAdjustment;\n\n\t\t// Apply minimum data penalty\n\t\tif (metrics.totalCalls < 5) {\n\t\t\tfinalScore *= 0.8;\n\t\t}\n\n\t\t// Ensure score bounds\n\t\treturn Math.min(100, Math.max(0, finalScore));\n\t}\n\n\t/**\n\t * Enhanced trust score calculation with token quality consideration\n\t */\n\tasync calculateTrustScoresEnhanced(\n\t\tsimulationData: SimulationResult,\n\t): Promise<TrustScoreResult[]> {\n\t\tconst results: TrustScoreResult[] = [];\n\n\t\tfor (const [userId, _actorPerf] of simulationData.actorPerformance) {\n\t\t\t// Get all calls for this actor\n\t\t\tconst actorCalls = simulationData.calls.filter(\n\t\t\t\t(call) => call.userId === userId,\n\t\t\t);\n\n\t\t\tif (actorCalls.length === 0) continue;\n\n\t\t\t// Get expected score from actor config\n\t\t\tconst actor = this.createDefaultActors().find((a) => a.id === userId);\n\t\t\tconst expectedScore = actor?.expectedTrustScore || 50;\n\n\t\t\t// Calculate base metrics\n\t\t\tconst metrics = this.calculateMetrics(actorCalls, simulationData);\n\n\t\t\t// Calculate token quality scores\n\t\t\tlet rugPromotionPenalty = 0;\n\t\t\tlet goodCallBonus = 0;\n\n\t\t\tfor (const call of actorCalls) {\n\t\t\t\tconst tokenScenario = call.simulationMetadata.tokenScenario;\n\t\t\t\tconst profit = call.simulationMetadata.actualProfit || 0;\n\n\t\t\t\t// Penalize for promoting rugs and scams\n\t\t\t\tif (\n\t\t\t\t\t[\n\t\t\t\t\t\tTokenScenario.RUG_PULL_FAST,\n\t\t\t\t\t\tTokenScenario.RUG_PULL_SLOW,\n\t\t\t\t\t\tTokenScenario.SCAM_TOKEN,\n\t\t\t\t\t].includes(tokenScenario)\n\t\t\t\t) {\n\t\t\t\t\tif (call.sentiment === \"positive\") {\n\t\t\t\t\t\trugPromotionPenalty += 1; // Count actual promotions\n\t\t\t\t\t} else if (call.sentiment === \"negative\" && profit > 0) {\n\t\t\t\t\t\tgoodCallBonus += 1; // Count good warnings\n\t\t\t\t\t}\n\t\t\t\t} else if (\n\t\t\t\t\t[\n\t\t\t\t\t\tTokenScenario.SUCCESSFUL,\n\t\t\t\t\t\tTokenScenario.RUNNER_MOON,\n\t\t\t\t\t\tTokenScenario.BLUE_CHIP,\n\t\t\t\t\t].includes(tokenScenario)\n\t\t\t\t) {\n\t\t\t\t\tif (call.sentiment === \"positive\" && profit > 20) {\n\t\t\t\t\t\tgoodCallBonus += 1; // Count profitable good calls\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Use the balanced trust score calculation\n\t\t\tconst calculatedScore =\n\t\t\t\tthis.balancedCalculator.calculateBalancedTrustScore(\n\t\t\t\t\tmetrics,\n\t\t\t\t\tactor?.archetype || \"unknown\",\n\t\t\t\t\trugPromotionPenalty,\n\t\t\t\t\tgoodCallBonus,\n\t\t\t\t\tactorCalls.length,\n\t\t\t\t);\n\n\t\t\tresults.push({\n\t\t\t\tuserId,\n\t\t\t\tusername: actorCalls[0].username,\n\t\t\t\tcalculatedScore,\n\t\t\t\texpectedScore,\n\t\t\t\tdifference: Math.abs(calculatedScore - expectedScore),\n\t\t\t\tmetrics,\n\t\t\t});\n\t\t}\n\n\t\t// Sort by calculated score descending\n\t\tresults.sort((a, b) => b.calculatedScore - a.calculatedScore);\n\n\t\treturn results;\n\t}\n\n\t/**\n\t * Evaluate accuracy of calculated scores vs expected\n\t */\n\tprivate evaluateAccuracy(\n\t\tscores: TrustScoreResult[],\n\t): OptimizationResult[\"accuracy\"] {\n\t\t// Handle empty scores\n\t\tif (scores.length === 0) {\n\t\t\treturn {\n\t\t\t\tmae: 100,\n\t\t\t\trmse: 100,\n\t\t\t\tcorrelation: 0,\n\t\t\t\trankingAccuracy: 0,\n\t\t\t};\n\t\t}\n\n\t\t// Mean Absolute Error\n\t\tconst mae =\n\t\t\tscores.reduce((sum, s) => sum + s.difference, 0) / scores.length;\n\n\t\t// Root Mean Square Error\n\t\tconst mse =\n\t\t\tscores.reduce((sum, s) => sum + s.difference ** 2, 0) / scores.length;\n\t\tconst rmse = Math.sqrt(mse);\n\n\t\t// Correlation\n\t\tconst correlation = this.calculateCorrelation(\n\t\t\tscores.map((s) => s.calculatedScore),\n\t\t\tscores.map((s) => s.expectedScore),\n\t\t);\n\n\t\t// Ranking accuracy\n\t\tconst rankingAccuracy = this.calculateRankingAccuracy(scores);\n\n\t\treturn {\n\t\t\tmae,\n\t\t\trmse,\n\t\t\tcorrelation,\n\t\t\trankingAccuracy,\n\t\t};\n\t}\n\n\t/**\n\t * Calculate Pearson correlation coefficient\n\t */\n\tprivate calculateCorrelation(x: number[], y: number[]): number {\n\t\tconst n = x.length;\n\t\tconst sumX = x.reduce((a, b) => a + b, 0);\n\t\tconst sumY = y.reduce((a, b) => a + b, 0);\n\t\tconst sumXY = x.reduce((total, xi, i) => total + xi * y[i], 0);\n\t\tconst sumX2 = x.reduce((total, xi) => total + xi * xi, 0);\n\t\tconst sumY2 = y.reduce((total, yi) => total + yi * yi, 0);\n\n\t\tconst numerator = n * sumXY - sumX * sumY;\n\t\tconst denominator = Math.sqrt(\n\t\t\t(n * sumX2 - sumX * sumX) * (n * sumY2 - sumY * sumY),\n\t\t);\n\n\t\treturn denominator === 0 ? 0 : numerator / denominator;\n\t}\n\n\t/**\n\t * Calculate ranking accuracy (% of correctly ordered pairs)\n\t */\n\tprivate calculateRankingAccuracy(scores: TrustScoreResult[]): number {\n\t\tlet correctPairs = 0;\n\t\tlet totalPairs = 0;\n\n\t\tfor (let i = 0; i < scores.length; i++) {\n\t\t\tfor (let j = i + 1; j < scores.length; j++) {\n\t\t\t\ttotalPairs++;\n\n\t\t\t\tconst calcDiff = scores[i].calculatedScore - scores[j].calculatedScore;\n\t\t\t\tconst expDiff = scores[i].expectedScore - scores[j].expectedScore;\n\n\t\t\t\t// Check if ordering is correct\n\t\t\t\tif (\n\t\t\t\t\t(calcDiff > 0 && expDiff > 0) ||\n\t\t\t\t\t(calcDiff < 0 && expDiff < 0) ||\n\t\t\t\t\t(calcDiff === 0 && expDiff === 0)\n\t\t\t\t) {\n\t\t\t\t\tcorrectPairs++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn totalPairs > 0 ? (correctPairs / totalPairs) * 100 : 0;\n\t}\n\n\t/**\n\t * Generate optimization suggestions based on results\n\t */\n\tprivate generateSuggestions(\n\t\tscores: TrustScoreResult[],\n\t\taccuracy: OptimizationResult[\"accuracy\"],\n\t): string[] {\n\t\tconst suggestions: string[] = [];\n\n\t\t// Handle empty scores\n\t\tif (scores.length === 0) {\n\t\t\tsuggestions.push(\n\t\t\t\t\"❌ No scores generated. Check simulation data generation.\",\n\t\t\t);\n\t\t\treturn suggestions;\n\t\t}\n\n\t\t// Check overall accuracy\n\t\tif (accuracy.mae > 15) {\n\t\t\tsuggestions.push(\n\t\t\t\t\"⚠️ High mean absolute error (>15). Consider adjusting component weights.\",\n\t\t\t);\n\t\t}\n\n\t\tif (accuracy.correlation < 0.7) {\n\t\t\tsuggestions.push(\n\t\t\t\t\"⚠️ Low correlation (<0.7). The scoring algorithm may need fundamental changes.\",\n\t\t\t);\n\t\t}\n\n\t\tif (accuracy.rankingAccuracy < 80) {\n\t\t\tsuggestions.push(\n\t\t\t\t\"⚠️ Low ranking accuracy (<80%). Focus on relative scoring improvements.\",\n\t\t\t);\n\t\t}\n\n\t\t// Check specific actor types\n\t\tconst actorTypeErrors: Record<string, number[]> = {};\n\t\tfor (const score of scores) {\n\t\t\tconst actor = this.createDefaultActors().find(\n\t\t\t\t(a) => a.id === score.userId,\n\t\t\t);\n\t\t\tif (actor) {\n\t\t\t\tif (!actorTypeErrors[actor.archetype]) {\n\t\t\t\t\tactorTypeErrors[actor.archetype] = [];\n\t\t\t\t}\n\t\t\t\tactorTypeErrors[actor.archetype].push(score.difference);\n\t\t\t}\n\t\t}\n\n\t\t// Find problematic actor types\n\t\tfor (const [archetype, errors] of Object.entries(actorTypeErrors)) {\n\t\t\tconst avgError = errors.reduce((sum, e) => sum + e, 0) / errors.length;\n\t\t\tif (avgError > 20) {\n\t\t\t\tsuggestions.push(\n\t\t\t\t\t`📊 ${archetype} actors have high error (${avgError.toFixed(1)}). May need archetype-specific adjustments.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Check if elite analysts are ranked highest\n\t\tif (scores.length > 0) {\n\t\t\tconst topScorer = scores[0];\n\t\t\tconst topActor = this.createDefaultActors().find(\n\t\t\t\t(a) => a.id === topScorer.userId,\n\t\t\t);\n\t\t\tif (topActor && topActor.archetype !== \"elite_analyst\") {\n\t\t\t\tsuggestions.push(\n\t\t\t\t\t\"🔄 Elite analysts should rank highest. Consider increasing weight on alpha or Sharpe ratio.\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Check if rug promoters are ranked lowest\n\t\tif (scores.length > 0) {\n\t\t\tconst bottomScorer = scores[scores.length - 1];\n\t\t\tconst bottomActor = this.createDefaultActors().find(\n\t\t\t\t(a) => a.id === bottomScorer.userId,\n\t\t\t);\n\t\t\tif (\n\t\t\t\tbottomActor &&\n\t\t\t\tbottomActor.archetype !== \"rug_promoter\" &&\n\t\t\t\tbottomActor.archetype !== \"bot_spammer\"\n\t\t\t) {\n\t\t\t\tsuggestions.push(\n\t\t\t\t\t\"🔄 Rug promoters/bots should rank lowest. Consider stronger penalties for promoting scams.\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Parameter-specific suggestions\n\t\tfor (const score of scores) {\n\t\t\tif (\n\t\t\t\tscore.metrics.volumePenalty < 0.5 &&\n\t\t\t\tscore.calculatedScore > score.expectedScore\n\t\t\t) {\n\t\t\t\tsuggestions.push(\n\t\t\t\t\t`💡 ${score.username}: High volume causing overestimation. Consider adjusting volume penalty threshold.`,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (suggestions.length === 0) {\n\t\t\tsuggestions.push(\n\t\t\t\t\"✅ Trust scoring algorithm is performing well! Minor tweaks may still improve accuracy.\",\n\t\t\t);\n\t\t}\n\n\t\treturn suggestions;\n\t}\n\n\t/**\n\t * Log detailed results\n\t */\n\tprivate async logResults(result: OptimizationResult): Promise<void> {\n\t\tconst timestamp = new Date().toISOString().replace(/[:.]/g, \"-\");\n\t\tconst logDir = \"./trust-optimization-logs\";\n\t\tawait fs.mkdir(logDir, { recursive: true });\n\n\t\t// Create detailed report\n\t\tlet report = \"# Trust Score Optimization Report\\n\\n\";\n\t\treport += `Generated: ${new Date().toISOString()}\\n\\n`;\n\n\t\treport += \"## Accuracy Metrics\\n\";\n\t\treport += `- Mean Absolute Error: ${result.accuracy.mae.toFixed(2)}\\n`;\n\t\treport += `- Root Mean Square Error: ${result.accuracy.rmse.toFixed(2)}\\n`;\n\t\treport += `- Correlation: ${result.accuracy.correlation.toFixed(3)}\\n`;\n\t\treport += `- Ranking Accuracy: ${result.accuracy.rankingAccuracy.toFixed(1)}%\\n\\n`;\n\n\t\treport += \"## Individual Scores\\n\";\n\t\treport +=\n\t\t\t\"| Username | Archetype | Expected | Calculated | Difference | Win Rate | Avg Profit |\\n\";\n\t\treport +=\n\t\t\t\"|----------|-----------|----------|------------|------------|----------|------------|\\n\";\n\n\t\tfor (const score of result.scores) {\n\t\t\tconst actor = this.createDefaultActors().find(\n\t\t\t\t(a) => a.id === score.userId,\n\t\t\t);\n\t\t\treport += `| ${score.username} | ${actor?.archetype || \"unknown\"} | ${score.expectedScore} | ${score.calculatedScore.toFixed(1)} | ${score.difference.toFixed(1)} | ${(score.metrics.winRate * 100).toFixed(1)}% | ${score.metrics.averageProfit.toFixed(1)}% |\\n`;\n\t\t}\n\n\t\treport += \"\\n## Optimization Suggestions\\n\";\n\t\tfor (const suggestion of result.suggestions) {\n\t\t\treport += `- ${suggestion}\\n`;\n\t\t}\n\n\t\t// Save report\n\t\tconst reportPath = path.join(logDir, `optimization-report-${timestamp}.md`);\n\t\tawait fs.writeFile(reportPath, report);\n\n\t\t// Save raw data\n\t\tconst dataPath = path.join(logDir, `optimization-data-${timestamp}.json`);\n\t\tawait fs.writeFile(dataPath, JSON.stringify(result, null, 2));\n\n\t\tconsole.log(`\\n📊 Optimization Report Summary:`);\n\t\tconsole.log(` MAE: ${result.accuracy.mae.toFixed(2)}`);\n\t\tconsole.log(` RMSE: ${result.accuracy.rmse.toFixed(2)}`);\n\t\tconsole.log(` Correlation: ${result.accuracy.correlation.toFixed(3)}`);\n\t\tconsole.log(\n\t\t\t` Ranking Accuracy: ${result.accuracy.rankingAccuracy.toFixed(1)}%`,\n\t\t);\n\t\tconsole.log(`\\n📁 Full report saved to: ${reportPath}`);\n\t}\n\n\t/**\n\t * Grid search for optimal parameters\n\t */\n\tasync optimizeParameters(\n\t\tparameterRanges: Partial<Record<keyof TrustScoreParameters, number[]>>,\n\t\tsimulationConfig?: SimulationConfig,\n\t): Promise<TrustScoreParameters> {\n\t\tconsole.log(\"🔍 Starting parameter optimization via grid search...\");\n\n\t\tlet bestParams = { ...this.currentParams };\n\t\tlet bestScore = Infinity;\n\n\t\t// Get simulation data once\n\t\tconst simulationData = await this.getSimulationData(simulationConfig, true);\n\n\t\t// Generate all parameter combinations\n\t\tconst paramCombinations =\n\t\t\tthis.generateParameterCombinations(parameterRanges);\n\n\t\tconsole.log(\n\t\t\t`Testing ${paramCombinations.length} parameter combinations...`,\n\t\t);\n\n\t\tfor (const params of paramCombinations) {\n\t\t\tthis.currentParams = params;\n\n\t\t\t// Calculate scores with these parameters\n\t\t\tconst scores = await this.calculateTrustScoresEnhanced(simulationData);\n\t\t\tconst accuracy = this.evaluateAccuracy(scores);\n\n\t\t\t// Use MAE as optimization target\n\t\t\tif (accuracy.mae < bestScore) {\n\t\t\t\tbestScore = accuracy.mae;\n\t\t\t\tbestParams = { ...params };\n\t\t\t\tconsole.log(`New best MAE: ${bestScore.toFixed(2)}`);\n\t\t\t}\n\t\t}\n\n\t\tthis.currentParams = bestParams;\n\t\tconsole.log(\"✅ Optimization complete. Best parameters:\", bestParams);\n\n\t\treturn bestParams;\n\t}\n\n\t/**\n\t * Generate all combinations of parameters for grid search\n\t */\n\tprivate generateParameterCombinations(\n\t\tranges: Partial<Record<keyof TrustScoreParameters, number[]>>,\n\t): TrustScoreParameters[] {\n\t\tconst combinations: TrustScoreParameters[] = [];\n\t\tconst baseParams = { ...this.currentParams };\n\n\t\t// Convert ranges to arrays of [key, values] pairs\n\t\tconst rangeEntries = Object.entries(ranges) as [\n\t\t\tkeyof TrustScoreParameters,\n\t\t\tnumber[],\n\t\t][];\n\n\t\t// Recursive function to generate combinations\n\t\tconst generateCombos = (index: number, current: TrustScoreParameters) => {\n\t\t\tif (index === rangeEntries.length) {\n\t\t\t\tcombinations.push({ ...current });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [key, values] = rangeEntries[index];\n\t\t\tfor (const value of values) {\n\t\t\t\tcurrent[key] = value;\n\t\t\t\tgenerateCombos(index + 1, current);\n\t\t\t}\n\t\t};\n\n\t\tgenerateCombos(0, baseParams);\n\t\treturn combinations;\n\t}\n}\n"],"mappings":"AAAA,YAAY,QAAQ;AACpB,YAAY,UAAU;AAEtB,SAAS,oCAAoC;AAC7C;AAAA,EAKC;AAAA,EACA;AAAA,OACM;AAmDA,MAAM,oBAAoB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EAER,cAAc;AACb,SAAK,mBAAmB,IAAI,iBAAiB;AAC7C,SAAK,qBAAqB,IAAI,6BAA6B;AAG3D,SAAK,gBAAgB;AAAA,MACpB,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB,cAAc;AAAA,MACd,aAAa;AAAA,MACb,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB,wBAAwB;AAAA,MACxB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,IACjB;AAAA,EACD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,qBACL,kBACA,WAAoB,MACU;AAC9B,YAAQ,IAAI,sDAA+C;AAG3D,UAAM,iBAAiB,MAAM,KAAK;AAAA,MACjC;AAAA,MACA;AAAA,IACD;AAGA,UAAM,SAAS,MAAM,KAAK,6BAA6B,cAAc;AAGrE,UAAM,WAAW,KAAK,iBAAiB,MAAM;AAG7C,UAAM,cAAc,KAAK,oBAAoB,QAAQ,QAAQ;AAE7D,UAAM,SAA6B;AAAA,MAClC;AAAA,M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qBAAa,KAAK,EAAE,GAAG,QAAQ,CAAC;AAChC;AAAA,MACD;AAEA,YAAM,CAAC,KAAK,MAAM,IAAI,aAAa,KAAK;AACxC,iBAAW,SAAS,QAAQ;AAC3B,gBAAQ,GAAG,IAAI;AACf,uBAAe,QAAQ,GAAG,OAAO;AAAA,MAClC;AAAA,IACD;AAEA,mBAAe,GAAG,UAAU;AAC5B,WAAO;AAAA,EACR;AACD;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type { SimulatedActorV2 as SimulatedActor, SimulatedCallV2 as SimulatedCall, } from "./services/simulationActorsV2";
|
|
2
|
+
export * from "./services/simulationActorsV2";
|
|
3
|
+
import type { SimulatedActorV2 } from "./services/simulationActorsV2";
|
|
4
|
+
interface LegacyTokenLike {
|
|
5
|
+
address: string;
|
|
6
|
+
symbol: string;
|
|
7
|
+
}
|
|
8
|
+
interface LegacyGeneratedCall {
|
|
9
|
+
tokenAddress: string;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
conviction: "HIGH" | "MEDIUM";
|
|
12
|
+
sentiment: "positive" | "neutral";
|
|
13
|
+
content: string;
|
|
14
|
+
}
|
|
15
|
+
export type CallGenerationStrategy = (actor: SimulatedActorWithLegacy, token: LegacyTokenLike, currentStep: number, priceHistory: unknown[]) => LegacyGeneratedCall | null;
|
|
16
|
+
export interface SimulatedActorWithLegacy extends SimulatedActorV2 {
|
|
17
|
+
expectedTrustScore?: number;
|
|
18
|
+
callGenerationStrategy?: CallGenerationStrategy;
|
|
19
|
+
actorSpecificData?: {
|
|
20
|
+
calls?: unknown[];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare const goodActorStrategy: CallGenerationStrategy;
|
|
24
|
+
export declare const badActorStrategy: CallGenerationStrategy;
|
|
25
|
+
export declare const neutralObserverStrategy: CallGenerationStrategy;
|
|
26
|
+
export declare const dataDrivenShillStrategy: CallGenerationStrategy;
|
|
27
|
+
export declare function parseDiscordDataToActors(filePath: string, _runtime: unknown): Promise<SimulatedActorWithLegacy[]>;
|
|
28
|
+
export declare function createLegacyActor(params: {
|
|
29
|
+
id: string;
|
|
30
|
+
username: string;
|
|
31
|
+
archetype: string;
|
|
32
|
+
expectedTrustScore?: number;
|
|
33
|
+
callGenerationStrategy?: CallGenerationStrategy;
|
|
34
|
+
}): SimulatedActorWithLegacy;
|
|
35
|
+
//# sourceMappingURL=simulationActors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulationActors.d.ts","sourceRoot":"","sources":["../src/simulationActors.ts"],"names":[],"mappings":"AAKA,YAAY,EACX,gBAAgB,IAAI,cAAc,EAClC,eAAe,IAAI,aAAa,GAChC,MAAM,+BAA+B,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAG9C,OAAO,KAAK,EAEX,gBAAgB,EAChB,MAAM,+BAA+B,CAAC;AAEvC,UAAU,eAAe;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,UAAU,mBAAmB;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9B,SAAS,EAAE,UAAU,GAAG,SAAS,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;CAChB;AAoBD,MAAM,MAAM,sBAAsB,GAAG,CACpC,KAAK,EAAE,wBAAwB,EAC/B,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,EAAE,KACnB,mBAAmB,GAAG,IAAI,CAAC;AAGhC,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IACjE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,iBAAiB,CAAC,EAAE;QACnB,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;KAClB,CAAC;CACF;AAmHD,eAAO,MAAM,iBAAiB,EAAE,sBAiB/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,sBAiB9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,sBAiBrC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,sBAAyC,CAAC;AAEhF,wBAAsB,wBAAwB,CAC7C,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAIrC;AAGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CAChD,GAAG,wBAAwB,CAc3B"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
export * from "./services/simulationActorsV2.js";
|
|
3
|
+
const ACTOR_ARCHETYPES = /* @__PURE__ */ new Set([
|
|
4
|
+
"elite_analyst",
|
|
5
|
+
"skilled_trader",
|
|
6
|
+
"pump_chaser",
|
|
7
|
+
"rug_promoter",
|
|
8
|
+
"fomo_trader",
|
|
9
|
+
"contrarian",
|
|
10
|
+
"whale_watcher",
|
|
11
|
+
"technical_analyst",
|
|
12
|
+
"newbie",
|
|
13
|
+
"bot_spammer"
|
|
14
|
+
]);
|
|
15
|
+
function mapArchetype(archetype) {
|
|
16
|
+
const mapping = {
|
|
17
|
+
good_caller: "elite_analyst",
|
|
18
|
+
bad_shiller: "rug_promoter",
|
|
19
|
+
neutral_observer: "technical_analyst"
|
|
20
|
+
};
|
|
21
|
+
if (mapping[archetype]) return mapping[archetype];
|
|
22
|
+
return ACTOR_ARCHETYPES.has(archetype) ? archetype : "technical_analyst";
|
|
23
|
+
}
|
|
24
|
+
function isRecord(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
function pickString(record, keys) {
|
|
28
|
+
for (const key of keys) {
|
|
29
|
+
const value = record[key];
|
|
30
|
+
if (typeof value === "string" && value.trim()) {
|
|
31
|
+
return value.trim();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function actorFromRecord(record) {
|
|
37
|
+
const id = pickString(record, ["id", "userId", "authorId", "author_id"]) ?? `actor-${Math.random().toString(36).slice(2)}`;
|
|
38
|
+
const username = pickString(record, ["username", "name", "displayName", "author"]) ?? id;
|
|
39
|
+
const archetype = mapArchetype(
|
|
40
|
+
pickString(record, ["archetype", "type"]) ?? "technical_analyst"
|
|
41
|
+
);
|
|
42
|
+
const calls = Array.isArray(record.calls) ? record.calls : Array.isArray(record.messages) ? record.messages : [];
|
|
43
|
+
return {
|
|
44
|
+
id,
|
|
45
|
+
username,
|
|
46
|
+
archetype,
|
|
47
|
+
trustScore: typeof record.trustScore === "number" ? record.trustScore : void 0,
|
|
48
|
+
expectedTrustScore: typeof record.expectedTrustScore === "number" ? record.expectedTrustScore : void 0,
|
|
49
|
+
callHistory: [],
|
|
50
|
+
preferences: {
|
|
51
|
+
callFrequency: "medium",
|
|
52
|
+
timingBias: "random"
|
|
53
|
+
},
|
|
54
|
+
actorSpecificData: { calls }
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function actorRecordsFromDiscordData(data) {
|
|
58
|
+
if (Array.isArray(data)) {
|
|
59
|
+
return data.filter(isRecord);
|
|
60
|
+
}
|
|
61
|
+
if (!isRecord(data)) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
for (const key of ["actors", "users", "participants"]) {
|
|
65
|
+
const value = data[key];
|
|
66
|
+
if (Array.isArray(value)) {
|
|
67
|
+
return value.filter(isRecord);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (Array.isArray(data.messages)) {
|
|
71
|
+
const byUser = /* @__PURE__ */ new Map();
|
|
72
|
+
for (const message of data.messages) {
|
|
73
|
+
if (!isRecord(message)) continue;
|
|
74
|
+
const id = pickString(message, ["userId", "authorId", "author_id"]) ?? (isRecord(message.author) ? pickString(message.author, ["id", "userId"]) : null);
|
|
75
|
+
if (!id) continue;
|
|
76
|
+
const existing = byUser.get(id);
|
|
77
|
+
if (existing) {
|
|
78
|
+
if (!existing.messages) {
|
|
79
|
+
existing.messages = [];
|
|
80
|
+
}
|
|
81
|
+
existing.messages.push(message);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const author = isRecord(message.author) ? message.author : {};
|
|
85
|
+
byUser.set(id, {
|
|
86
|
+
id,
|
|
87
|
+
username: pickString(message, ["username", "authorName"]) ?? pickString(author, ["username", "name", "displayName"]) ?? id,
|
|
88
|
+
messages: [message]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return Array.from(byUser.values());
|
|
92
|
+
}
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
const goodActorStrategy = (_actor, token, currentStep, _priceHistory) => {
|
|
96
|
+
if (Math.random() < 0.3) {
|
|
97
|
+
return {
|
|
98
|
+
tokenAddress: token.address,
|
|
99
|
+
timestamp: Date.now() + currentStep * 864e5,
|
|
100
|
+
conviction: "HIGH",
|
|
101
|
+
sentiment: "positive",
|
|
102
|
+
content: `$${token.symbol} looking strong!`
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
};
|
|
107
|
+
const badActorStrategy = (_actor, token, currentStep, _priceHistory) => {
|
|
108
|
+
if (Math.random() < 0.5) {
|
|
109
|
+
return {
|
|
110
|
+
tokenAddress: token.address,
|
|
111
|
+
timestamp: Date.now() + currentStep * 864e5,
|
|
112
|
+
conviction: "HIGH",
|
|
113
|
+
sentiment: "positive",
|
|
114
|
+
content: `\u{1F680} $${token.symbol} TO THE MOON! 1000X!`
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
};
|
|
119
|
+
const neutralObserverStrategy = (_actor, token, currentStep, _priceHistory) => {
|
|
120
|
+
if (Math.random() < 0.2) {
|
|
121
|
+
return {
|
|
122
|
+
tokenAddress: token.address,
|
|
123
|
+
timestamp: Date.now() + currentStep * 864e5,
|
|
124
|
+
conviction: "MEDIUM",
|
|
125
|
+
sentiment: "neutral",
|
|
126
|
+
content: `Watching $${token.symbol}`
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return null;
|
|
130
|
+
};
|
|
131
|
+
const dataDrivenShillStrategy = badActorStrategy;
|
|
132
|
+
async function parseDiscordDataToActors(filePath, _runtime) {
|
|
133
|
+
const content = await fs.readFile(filePath, "utf8");
|
|
134
|
+
const data = JSON.parse(content);
|
|
135
|
+
return actorRecordsFromDiscordData(data).map(actorFromRecord);
|
|
136
|
+
}
|
|
137
|
+
function createLegacyActor(params) {
|
|
138
|
+
return {
|
|
139
|
+
id: params.id,
|
|
140
|
+
username: params.username,
|
|
141
|
+
archetype: mapArchetype(params.archetype),
|
|
142
|
+
trustScore: params.expectedTrustScore,
|
|
143
|
+
expectedTrustScore: params.expectedTrustScore,
|
|
144
|
+
callGenerationStrategy: params.callGenerationStrategy,
|
|
145
|
+
callHistory: [],
|
|
146
|
+
preferences: {
|
|
147
|
+
callFrequency: "medium",
|
|
148
|
+
timingBias: "random"
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export {
|
|
153
|
+
badActorStrategy,
|
|
154
|
+
createLegacyActor,
|
|
155
|
+
dataDrivenShillStrategy,
|
|
156
|
+
goodActorStrategy,
|
|
157
|
+
neutralObserverStrategy,
|
|
158
|
+
parseDiscordDataToActors
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=simulationActors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/simulationActors.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\n\n// Backward-compatible re-exports from the new location.\n\n// Re-export specific types that benchmark tests expect\nexport type {\n\tSimulatedActorV2 as SimulatedActor,\n\tSimulatedCallV2 as SimulatedCall,\n} from \"./services/simulationActorsV2.js\";\nexport * from \"./services/simulationActorsV2.js\";\n\n// Import the actual types to extend\nimport type {\n\tActorArchetypeV2,\n\tSimulatedActorV2,\n} from \"./services/simulationActorsV2.js\";\n\ninterface LegacyTokenLike {\n\taddress: string;\n\tsymbol: string;\n}\n\ninterface LegacyGeneratedCall {\n\ttokenAddress: string;\n\ttimestamp: number;\n\tconviction: \"HIGH\" | \"MEDIUM\";\n\tsentiment: \"positive\" | \"neutral\";\n\tcontent: string;\n}\n\ntype DiscordActorRecord = Record<string, unknown> & {\n\tmessages?: unknown[];\n};\n\nconst ACTOR_ARCHETYPES = new Set<ActorArchetypeV2>([\n\t\"elite_analyst\",\n\t\"skilled_trader\",\n\t\"pump_chaser\",\n\t\"rug_promoter\",\n\t\"fomo_trader\",\n\t\"contrarian\",\n\t\"whale_watcher\",\n\t\"technical_analyst\",\n\t\"newbie\",\n\t\"bot_spammer\",\n]);\n\n// Define the missing types and functions for backward compatibility\nexport type CallGenerationStrategy = (\n\tactor: SimulatedActorWithLegacy,\n\ttoken: LegacyTokenLike,\n\tcurrentStep: number,\n\tpriceHistory: unknown[],\n) => LegacyGeneratedCall | null;\n\n// Extended type that includes the old properties\nexport interface SimulatedActorWithLegacy extends SimulatedActorV2 {\n\texpectedTrustScore?: number;\n\tcallGenerationStrategy?: CallGenerationStrategy;\n\tactorSpecificData?: {\n\t\tcalls?: unknown[];\n\t};\n}\n\n// Helper function to map old archetype names to new ones\nfunction mapArchetype(archetype: string): ActorArchetypeV2 {\n\tconst mapping: Record<string, ActorArchetypeV2> = {\n\t\tgood_caller: \"elite_analyst\",\n\t\tbad_shiller: \"rug_promoter\",\n\t\tneutral_observer: \"technical_analyst\",\n\t};\n\tif (mapping[archetype]) return mapping[archetype];\n\treturn ACTOR_ARCHETYPES.has(archetype as ActorArchetypeV2)\n\t\t? (archetype as ActorArchetypeV2)\n\t\t: \"technical_analyst\";\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction pickString(\n\trecord: Record<string, unknown>,\n\tkeys: string[],\n): string | null {\n\tfor (const key of keys) {\n\t\tconst value = record[key];\n\t\tif (typeof value === \"string\" && value.trim()) {\n\t\t\treturn value.trim();\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction actorFromRecord(\n\trecord: Record<string, unknown>,\n): SimulatedActorWithLegacy {\n\tconst id =\n\t\tpickString(record, [\"id\", \"userId\", \"authorId\", \"author_id\"]) ??\n\t\t`actor-${Math.random().toString(36).slice(2)}`;\n\tconst username =\n\t\tpickString(record, [\"username\", \"name\", \"displayName\", \"author\"]) ?? id;\n\tconst archetype = mapArchetype(\n\t\tpickString(record, [\"archetype\", \"type\"]) ?? \"technical_analyst\",\n\t) as ActorArchetypeV2;\n\tconst calls = Array.isArray(record.calls)\n\t\t? record.calls\n\t\t: Array.isArray(record.messages)\n\t\t\t? record.messages\n\t\t\t: [];\n\n\treturn {\n\t\tid: id as SimulatedActorWithLegacy[\"id\"],\n\t\tusername,\n\t\tarchetype,\n\t\ttrustScore:\n\t\t\ttypeof record.trustScore === \"number\" ? record.trustScore : undefined,\n\t\texpectedTrustScore:\n\t\t\ttypeof record.expectedTrustScore === \"number\"\n\t\t\t\t? record.expectedTrustScore\n\t\t\t\t: undefined,\n\t\tcallHistory: [],\n\t\tpreferences: {\n\t\t\tcallFrequency: \"medium\",\n\t\t\ttimingBias: \"random\",\n\t\t},\n\t\tactorSpecificData: { calls },\n\t};\n}\n\nfunction actorRecordsFromDiscordData(data: unknown): DiscordActorRecord[] {\n\tif (Array.isArray(data)) {\n\t\treturn data.filter(isRecord);\n\t}\n\tif (!isRecord(data)) {\n\t\treturn [];\n\t}\n\tfor (const key of [\"actors\", \"users\", \"participants\"]) {\n\t\tconst value = data[key];\n\t\tif (Array.isArray(value)) {\n\t\t\treturn value.filter(isRecord);\n\t\t}\n\t}\n\tif (Array.isArray(data.messages)) {\n\t\tconst byUser = new Map<string, DiscordActorRecord>();\n\t\tfor (const message of data.messages) {\n\t\t\tif (!isRecord(message)) continue;\n\t\t\tconst id =\n\t\t\t\tpickString(message, [\"userId\", \"authorId\", \"author_id\"]) ??\n\t\t\t\t(isRecord(message.author)\n\t\t\t\t\t? pickString(message.author, [\"id\", \"userId\"])\n\t\t\t\t\t: null);\n\t\t\tif (!id) continue;\n\t\t\tconst existing = byUser.get(id);\n\t\t\tif (existing) {\n\t\t\t\tif (!existing.messages) {\n\t\t\t\t\texisting.messages = [];\n\t\t\t\t}\n\t\t\t\texisting.messages.push(message);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst author = isRecord(message.author) ? message.author : {};\n\t\t\tbyUser.set(id, {\n\t\t\t\tid,\n\t\t\t\tusername:\n\t\t\t\t\tpickString(message, [\"username\", \"authorName\"]) ??\n\t\t\t\t\tpickString(author, [\"username\", \"name\", \"displayName\"]) ??\n\t\t\t\t\tid,\n\t\t\t\tmessages: [message],\n\t\t\t});\n\t\t}\n\t\treturn Array.from(byUser.values());\n\t}\n\treturn [];\n}\n\n// Deterministic strategy fixtures for benchmark tests\nexport const goodActorStrategy: CallGenerationStrategy = (\n\t_actor,\n\ttoken,\n\tcurrentStep,\n\t_priceHistory,\n) => {\n\t// Simulate a good actor making a positive call\n\tif (Math.random() < 0.3) {\n\t\treturn {\n\t\t\ttokenAddress: token.address,\n\t\t\ttimestamp: Date.now() + currentStep * 86400000,\n\t\t\tconviction: \"HIGH\",\n\t\t\tsentiment: \"positive\",\n\t\t\tcontent: `$${token.symbol} looking strong!`,\n\t\t};\n\t}\n\treturn null;\n};\n\nexport const badActorStrategy: CallGenerationStrategy = (\n\t_actor,\n\ttoken,\n\tcurrentStep,\n\t_priceHistory,\n) => {\n\t// Simulate a bad actor shilling\n\tif (Math.random() < 0.5) {\n\t\treturn {\n\t\t\ttokenAddress: token.address,\n\t\t\ttimestamp: Date.now() + currentStep * 86400000,\n\t\t\tconviction: \"HIGH\",\n\t\t\tsentiment: \"positive\",\n\t\t\tcontent: `🚀 $${token.symbol} TO THE MOON! 1000X!`,\n\t\t};\n\t}\n\treturn null;\n};\n\nexport const neutralObserverStrategy: CallGenerationStrategy = (\n\t_actor,\n\ttoken,\n\tcurrentStep,\n\t_priceHistory,\n) => {\n\t// Simulate neutral observations\n\tif (Math.random() < 0.2) {\n\t\treturn {\n\t\t\ttokenAddress: token.address,\n\t\t\ttimestamp: Date.now() + currentStep * 86400000,\n\t\t\tconviction: \"MEDIUM\",\n\t\t\tsentiment: \"neutral\",\n\t\t\tcontent: `Watching $${token.symbol}`,\n\t\t};\n\t}\n\treturn null;\n};\n\nexport const dataDrivenShillStrategy: CallGenerationStrategy = badActorStrategy;\n\nexport async function parseDiscordDataToActors(\n\tfilePath: string,\n\t_runtime: unknown,\n): Promise<SimulatedActorWithLegacy[]> {\n\tconst content = await fs.readFile(filePath, \"utf8\");\n\tconst data = JSON.parse(content) as unknown;\n\treturn actorRecordsFromDiscordData(data).map(actorFromRecord);\n}\n\n// Helper to create a legacy-compatible actor\nexport function createLegacyActor(params: {\n\tid: string;\n\tusername: string;\n\tarchetype: string;\n\texpectedTrustScore?: number;\n\tcallGenerationStrategy?: CallGenerationStrategy;\n}): SimulatedActorWithLegacy {\n\treturn {\n\t\tid: params.id,\n\t\tusername: params.username,\n\t\tarchetype: mapArchetype(params.archetype),\n\t\ttrustScore: params.expectedTrustScore,\n\t\texpectedTrustScore: params.expectedTrustScore,\n\t\tcallGenerationStrategy: params.callGenerationStrategy,\n\t\tcallHistory: [],\n\t\tpreferences: {\n\t\t\tcallFrequency: \"medium\",\n\t\t\ttimingBias: \"random\",\n\t\t},\n\t};\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AASf,cAAc;AAyBd,MAAM,mBAAmB,oBAAI,IAAsB;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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AA,IACd,aAAa;AAAA,MACZ,eAAe;AAAA,MACf,YAAY;AAAA,IACb;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social-alpha-view-bundle.d.ts","sourceRoot":"","sources":["../src/social-alpha-view-bundle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/social-alpha-view-bundle.ts"],"sourcesContent":["// Vite view-bundle entry. The built bundle (dist/views/bundle.js) exposes the\n// named export the view loader reads (`SocialAlphaView`) — now the unified\n// spatial GUI/XR data wrapper.\nexport { SocialAlphaView } from \"./frontend/SocialAlphaView.js\";\n"],"mappings":"AAGA,SAAS,uBAAuB;","names":[]}
|