@elizaos/training 2.0.0-alpha.13 → 2.0.0-alpha.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/package.json +2 -2
  2. package/research-output/training-runs/training-run-1773726941205.json +38 -0
  3. package/scripts/rank_trajectories.ts +0 -1
  4. package/scripts/run_task_benchmark.ts +4 -11
  5. package/src/adapter.ts +96 -49
  6. package/src/archetypes/ArchetypeConfigService.ts +188 -185
  7. package/src/archetypes/derive-archetype.ts +47 -47
  8. package/src/archetypes/index.ts +2 -2
  9. package/src/benchmark/ArchetypeMatchupBenchmark.ts +70 -70
  10. package/src/benchmark/BenchmarkChartGenerator.ts +70 -69
  11. package/src/benchmark/BenchmarkDataGenerator.ts +136 -136
  12. package/src/benchmark/BenchmarkDataViewer.ts +32 -30
  13. package/src/benchmark/BenchmarkHistoryService.ts +13 -12
  14. package/src/benchmark/BenchmarkRunner.ts +87 -83
  15. package/src/benchmark/BenchmarkValidator.ts +48 -46
  16. package/src/benchmark/FastEvalRunner.ts +17 -16
  17. package/src/benchmark/MetricsValidator.ts +20 -21
  18. package/src/benchmark/MetricsVisualizer.ts +92 -85
  19. package/src/benchmark/ModelBenchmarkService.ts +90 -82
  20. package/src/benchmark/ModelRegistry.ts +44 -44
  21. package/src/benchmark/RulerBenchmarkIntegration.ts +24 -24
  22. package/src/benchmark/SimulationA2AInterface.ts +118 -118
  23. package/src/benchmark/SimulationEngine.ts +51 -51
  24. package/src/benchmark/TaskRunner.ts +87 -79
  25. package/src/benchmark/__tests__/BenchmarkRunner.test.ts +80 -80
  26. package/src/benchmark/__tests__/HeadToHead.test.ts +26 -26
  27. package/src/benchmark/index.ts +27 -27
  28. package/src/benchmark/parseSimulationMetrics.ts +32 -32
  29. package/src/benchmark/simulation-types.ts +10 -10
  30. package/src/dependencies.ts +34 -34
  31. package/src/generation/TrajectoryGenerator.ts +39 -37
  32. package/src/generation/index.ts +1 -1
  33. package/src/huggingface/HuggingFaceDatasetUploader.ts +72 -72
  34. package/src/huggingface/HuggingFaceIntegrationService.ts +59 -53
  35. package/src/huggingface/HuggingFaceModelUploader.ts +60 -59
  36. package/src/huggingface/index.ts +6 -6
  37. package/src/huggingface/shared/HuggingFaceUploadUtil.ts +32 -32
  38. package/src/index.ts +27 -27
  39. package/src/init-training.ts +6 -6
  40. package/src/metrics/TrajectoryMetricsExtractor.ts +70 -71
  41. package/src/metrics/__tests__/TrajectoryMetricsExtractor.test.ts +182 -182
  42. package/src/metrics/index.ts +2 -2
  43. package/src/rubrics/__tests__/index.test.ts +73 -73
  44. package/src/rubrics/ass-kisser.ts +6 -6
  45. package/src/rubrics/degen.ts +6 -6
  46. package/src/rubrics/goody-twoshoes.ts +6 -6
  47. package/src/rubrics/index.ts +50 -50
  48. package/src/rubrics/information-trader.ts +6 -6
  49. package/src/rubrics/infosec.ts +6 -6
  50. package/src/rubrics/liar.ts +6 -6
  51. package/src/rubrics/perps-trader.ts +6 -6
  52. package/src/rubrics/researcher.ts +6 -6
  53. package/src/rubrics/scammer.ts +6 -6
  54. package/src/rubrics/social-butterfly.ts +7 -7
  55. package/src/rubrics/super-predictor.ts +6 -6
  56. package/src/rubrics/trader.ts +5 -5
  57. package/src/scoring/ArchetypeScoringService.ts +56 -54
  58. package/src/scoring/JudgePromptBuilder.ts +96 -96
  59. package/src/scoring/LLMJudgeCache.ts +26 -23
  60. package/src/scoring/index.ts +3 -3
  61. package/src/training/AutomationPipeline.ts +149 -140
  62. package/src/training/BenchmarkService.ts +49 -45
  63. package/src/training/ConfigValidator.ts +38 -32
  64. package/src/training/MarketOutcomesTracker.ts +22 -12
  65. package/src/training/ModelDeployer.ts +15 -15
  66. package/src/training/ModelFetcher.ts +7 -7
  67. package/src/training/ModelSelectionService.ts +32 -32
  68. package/src/training/ModelUsageVerifier.ts +31 -24
  69. package/src/training/MultiModelOrchestrator.ts +44 -44
  70. package/src/training/RLModelConfig.ts +57 -57
  71. package/src/training/RewardBackpropagationService.ts +18 -17
  72. package/src/training/RulerScoringService.ts +73 -72
  73. package/src/training/TrainingMonitor.ts +29 -29
  74. package/src/training/TrajectoryRecorder.ts +25 -27
  75. package/src/training/__tests__/TrajectoryRecorder.test.ts +105 -105
  76. package/src/training/index.ts +36 -36
  77. package/src/training/logRLConfig.ts +7 -7
  78. package/src/training/pipeline.ts +13 -16
  79. package/src/training/storage/ModelStorageService.ts +32 -32
  80. package/src/training/storage/TrainingDataArchiver.ts +21 -21
  81. package/src/training/storage/index.ts +2 -2
  82. package/src/training/types.ts +6 -6
  83. package/src/training/window-utils.ts +14 -14
  84. package/src/utils/index.ts +7 -7
  85. package/src/utils/logger.ts +5 -5
  86. package/src/utils/snowflake.ts +1 -1
  87. package/src/utils/synthetic-detector.ts +7 -7
@@ -9,8 +9,8 @@
9
9
  * 2. Causal Simulation Mode: Hidden facts → Events → Price movements (learnable signal)
10
10
  */
11
11
 
12
- import type { JsonValue } from '../adapter';
13
- import { logger } from '../utils/logger';
12
+ import type { JsonValue } from "../adapter";
13
+ import { logger } from "../utils/logger";
14
14
 
15
15
  /**
16
16
  * Volatility bucket for price movements
@@ -18,18 +18,18 @@ import { logger } from '../utils/logger';
18
18
  * - medium: Moderate price movements (-5% to -10% or +5% to +10%)
19
19
  * - high: Large price movements (-15%+ or +15%+)
20
20
  */
21
- export type VolatilityBucket = 'low' | 'medium' | 'high';
21
+ export type VolatilityBucket = "low" | "medium" | "high";
22
22
 
23
23
  /**
24
24
  * Event types that can be generated from hidden facts
25
25
  */
26
26
  export type CausalEventType =
27
- | 'leak'
28
- | 'rumor'
29
- | 'scandal'
30
- | 'development'
31
- | 'deal'
32
- | 'announcement';
27
+ | "leak"
28
+ | "rumor"
29
+ | "scandal"
30
+ | "development"
31
+ | "deal"
32
+ | "announcement";
33
33
 
34
34
  /**
35
35
  * Scheduled event in the causal event schedule
@@ -66,7 +66,7 @@ export interface HiddenNarrativeFact {
66
66
  /** Sequence of events scheduled to occur based on this fact */
67
67
  eventSchedule: ScheduledCausalEvent[];
68
68
  /** Overall sentiment of the narrative: negative facts lead to price drops */
69
- sentiment: 'positive' | 'negative';
69
+ sentiment: "positive" | "negative";
70
70
  }
71
71
 
72
72
  export interface BenchmarkConfig {
@@ -251,7 +251,7 @@ export interface GroundTruth {
251
251
  hiddenFacts: Array<{
252
252
  tick: number;
253
253
  fact: string;
254
- category: 'market' | 'social' | 'event' | 'insider';
254
+ category: "market" | "social" | "event" | "insider";
255
255
  value: JsonValue;
256
256
  }>;
257
257
 
@@ -286,7 +286,7 @@ export interface BenchmarkGameSnapshot {
286
286
  */
287
287
  const NARRATIVE_FACT_TEMPLATES: Array<{
288
288
  factTemplate: string;
289
- sentiment: 'positive' | 'negative';
289
+ sentiment: "positive" | "negative";
290
290
  /** Event sequence with relative timing and volatility */
291
291
  eventSequence: Array<{
292
292
  relativeDay: number; // Days from start (e.g., 5, 10, 15)
@@ -298,166 +298,166 @@ const NARRATIVE_FACT_TEMPLATES: Array<{
298
298
  // Negative narratives (price drops)
299
299
  {
300
300
  factTemplate:
301
- '{ticker} has a secret product flaw that will require a recall',
302
- sentiment: 'negative',
301
+ "{ticker} has a secret product flaw that will require a recall",
302
+ sentiment: "negative",
303
303
  eventSequence: [
304
304
  {
305
305
  relativeDay: 5,
306
- eventType: 'leak',
307
- volatilityBucket: 'medium',
306
+ eventType: "leak",
307
+ volatilityBucket: "medium",
308
308
  descriptionTemplate:
309
- 'Internal documents leaked: {ticker} product flaw discovered by engineers',
309
+ "Internal documents leaked: {ticker} product flaw discovered by engineers",
310
310
  },
311
311
  {
312
312
  relativeDay: 10,
313
- eventType: 'rumor',
314
- volatilityBucket: 'medium',
313
+ eventType: "rumor",
314
+ volatilityBucket: "medium",
315
315
  descriptionTemplate:
316
- 'Industry sources report potential {ticker} recall due to safety issues',
316
+ "Industry sources report potential {ticker} recall due to safety issues",
317
317
  },
318
318
  {
319
319
  relativeDay: 18,
320
- eventType: 'scandal',
321
- volatilityBucket: 'high',
320
+ eventType: "scandal",
321
+ volatilityBucket: "high",
322
322
  descriptionTemplate:
323
- '{ticker} board meeting: CEO denies cover-up allegations as evidence mounts',
323
+ "{ticker} board meeting: CEO denies cover-up allegations as evidence mounts",
324
324
  },
325
325
  ],
326
326
  },
327
327
  {
328
- factTemplate: '{ticker} is secretly insolvent and hiding massive losses',
329
- sentiment: 'negative',
328
+ factTemplate: "{ticker} is secretly insolvent and hiding massive losses",
329
+ sentiment: "negative",
330
330
  eventSequence: [
331
331
  {
332
332
  relativeDay: 4,
333
- eventType: 'rumor',
334
- volatilityBucket: 'low',
333
+ eventType: "rumor",
334
+ volatilityBucket: "low",
335
335
  descriptionTemplate:
336
- 'Anonymous source claims {ticker} accounting irregularities',
336
+ "Anonymous source claims {ticker} accounting irregularities",
337
337
  },
338
338
  {
339
339
  relativeDay: 12,
340
- eventType: 'leak',
341
- volatilityBucket: 'medium',
340
+ eventType: "leak",
341
+ volatilityBucket: "medium",
342
342
  descriptionTemplate:
343
343
  'Leaked memo reveals {ticker} executives discussing "liquidity concerns"',
344
344
  },
345
345
  {
346
346
  relativeDay: 20,
347
- eventType: 'scandal',
348
- volatilityBucket: 'high',
347
+ eventType: "scandal",
348
+ volatilityBucket: "high",
349
349
  descriptionTemplate:
350
- 'Whistleblower exposes {ticker} hidden debt: stock halted pending investigation',
350
+ "Whistleblower exposes {ticker} hidden debt: stock halted pending investigation",
351
351
  },
352
352
  ],
353
353
  },
354
354
  {
355
- factTemplate: '{ticker} CEO is about to be indicted for fraud',
356
- sentiment: 'negative',
355
+ factTemplate: "{ticker} CEO is about to be indicted for fraud",
356
+ sentiment: "negative",
357
357
  eventSequence: [
358
358
  {
359
359
  relativeDay: 6,
360
- eventType: 'rumor',
361
- volatilityBucket: 'low',
360
+ eventType: "rumor",
361
+ volatilityBucket: "low",
362
362
  descriptionTemplate:
363
- 'Rumors swirl about {ticker} CEO facing regulatory scrutiny',
363
+ "Rumors swirl about {ticker} CEO facing regulatory scrutiny",
364
364
  },
365
365
  {
366
366
  relativeDay: 14,
367
- eventType: 'leak',
368
- volatilityBucket: 'medium',
367
+ eventType: "leak",
368
+ volatilityBucket: "medium",
369
369
  descriptionTemplate:
370
- 'Sources close to investigation: {ticker} CEO under federal probe',
370
+ "Sources close to investigation: {ticker} CEO under federal probe",
371
371
  },
372
372
  {
373
373
  relativeDay: 22,
374
- eventType: 'announcement',
375
- volatilityBucket: 'high',
374
+ eventType: "announcement",
375
+ volatilityBucket: "high",
376
376
  descriptionTemplate:
377
- '{ticker} confirms CEO departure amid ongoing investigation',
377
+ "{ticker} confirms CEO departure amid ongoing investigation",
378
378
  },
379
379
  ],
380
380
  },
381
381
  // Positive narratives (price increases)
382
382
  {
383
383
  factTemplate:
384
- '{ticker} is about to announce a breakthrough product that will dominate the market',
385
- sentiment: 'positive',
384
+ "{ticker} is about to announce a breakthrough product that will dominate the market",
385
+ sentiment: "positive",
386
386
  eventSequence: [
387
387
  {
388
388
  relativeDay: 5,
389
- eventType: 'rumor',
390
- volatilityBucket: 'low',
389
+ eventType: "rumor",
390
+ volatilityBucket: "low",
391
391
  descriptionTemplate:
392
- 'Insider whispers: {ticker} working on game-changing technology',
392
+ "Insider whispers: {ticker} working on game-changing technology",
393
393
  },
394
394
  {
395
395
  relativeDay: 12,
396
- eventType: 'leak',
397
- volatilityBucket: 'medium',
396
+ eventType: "leak",
397
+ volatilityBucket: "medium",
398
398
  descriptionTemplate:
399
- 'Leaked patent filings suggest {ticker} breakthrough imminent',
399
+ "Leaked patent filings suggest {ticker} breakthrough imminent",
400
400
  },
401
401
  {
402
402
  relativeDay: 20,
403
- eventType: 'announcement',
404
- volatilityBucket: 'high',
403
+ eventType: "announcement",
404
+ volatilityBucket: "high",
405
405
  descriptionTemplate:
406
- '{ticker} announces revolutionary product: analysts upgrade to strong buy',
406
+ "{ticker} announces revolutionary product: analysts upgrade to strong buy",
407
407
  },
408
408
  ],
409
409
  },
410
410
  {
411
- factTemplate: '{ticker} is the secret acquisition target of a tech giant',
412
- sentiment: 'positive',
411
+ factTemplate: "{ticker} is the secret acquisition target of a tech giant",
412
+ sentiment: "positive",
413
413
  eventSequence: [
414
414
  {
415
415
  relativeDay: 4,
416
- eventType: 'rumor',
417
- volatilityBucket: 'low',
416
+ eventType: "rumor",
417
+ volatilityBucket: "low",
418
418
  descriptionTemplate:
419
- 'M&A rumors surface: {ticker} reportedly in acquisition talks',
419
+ "M&A rumors surface: {ticker} reportedly in acquisition talks",
420
420
  },
421
421
  {
422
422
  relativeDay: 10,
423
- eventType: 'leak',
424
- volatilityBucket: 'medium',
423
+ eventType: "leak",
424
+ volatilityBucket: "medium",
425
425
  descriptionTemplate:
426
- 'Anonymous source: {ticker} board reviewing buyout offer at premium',
426
+ "Anonymous source: {ticker} board reviewing buyout offer at premium",
427
427
  },
428
428
  {
429
429
  relativeDay: 16,
430
- eventType: 'deal',
431
- volatilityBucket: 'high',
430
+ eventType: "deal",
431
+ volatilityBucket: "high",
432
432
  descriptionTemplate:
433
- '{ticker} confirms acquisition discussions: shares surge on takeover premium',
433
+ "{ticker} confirms acquisition discussions: shares surge on takeover premium",
434
434
  },
435
435
  ],
436
436
  },
437
437
  {
438
- factTemplate: '{ticker} has secretly achieved major regulatory approval',
439
- sentiment: 'positive',
438
+ factTemplate: "{ticker} has secretly achieved major regulatory approval",
439
+ sentiment: "positive",
440
440
  eventSequence: [
441
441
  {
442
442
  relativeDay: 6,
443
- eventType: 'rumor',
444
- volatilityBucket: 'low',
443
+ eventType: "rumor",
444
+ volatilityBucket: "low",
445
445
  descriptionTemplate:
446
- 'Industry insiders: {ticker} regulatory submission shows promise',
446
+ "Industry insiders: {ticker} regulatory submission shows promise",
447
447
  },
448
448
  {
449
449
  relativeDay: 13,
450
- eventType: 'leak',
451
- volatilityBucket: 'medium',
450
+ eventType: "leak",
451
+ volatilityBucket: "medium",
452
452
  descriptionTemplate:
453
- 'Sources say {ticker} cleared key regulatory hurdle ahead of schedule',
453
+ "Sources say {ticker} cleared key regulatory hurdle ahead of schedule",
454
454
  },
455
455
  {
456
456
  relativeDay: 21,
457
- eventType: 'announcement',
458
- volatilityBucket: 'high',
457
+ eventType: "announcement",
458
+ volatilityBucket: "high",
459
459
  descriptionTemplate:
460
- '{ticker} receives full regulatory approval: new market opportunity unlocked',
460
+ "{ticker} receives full regulatory approval: new market opportunity unlocked",
461
461
  },
462
462
  ],
463
463
  },
@@ -492,7 +492,7 @@ export class BenchmarkDataGenerator {
492
492
  if (config.useCausalSimulation && config.tickInterval !== 3600) {
493
493
  throw new Error(
494
494
  `Causal simulation requires tickInterval=3600 (1 hour). Got: ${config.tickInterval}. ` +
495
- `The day/hour event scheduling assumes 1 tick per hour.`
495
+ `The day/hour event scheduling assumes 1 tick per hour.`,
496
496
  );
497
497
  }
498
498
 
@@ -521,10 +521,10 @@ export class BenchmarkDataGenerator {
521
521
  const id = Date.now().toString();
522
522
  const createdAt = Date.now();
523
523
  const numTicks = Math.floor(
524
- (this.config.durationMinutes * 60) / this.config.tickInterval
524
+ (this.config.durationMinutes * 60) / this.config.tickInterval,
525
525
  );
526
526
 
527
- logger.info('Generating benchmark', {
527
+ logger.info("Generating benchmark", {
528
528
  id,
529
529
  duration: this.config.durationMinutes,
530
530
  ticks: numTicks,
@@ -541,10 +541,10 @@ export class BenchmarkDataGenerator {
541
541
  initialState,
542
542
  groundTruth,
543
543
  numTicks,
544
- createdAt
544
+ createdAt,
545
545
  );
546
546
 
547
- logger.info('Benchmark generated', {
547
+ logger.info("Benchmark generated", {
548
548
  id,
549
549
  ticks: ticks.length,
550
550
  markets: initialState.predictionMarkets.length,
@@ -553,7 +553,7 @@ export class BenchmarkDataGenerator {
553
553
 
554
554
  return {
555
555
  id,
556
- version: '1.0.0',
556
+ version: "1.0.0",
557
557
  createdAt,
558
558
  duration: this.config.durationMinutes * 60,
559
559
  tickInterval: this.config.tickInterval,
@@ -569,16 +569,16 @@ export class BenchmarkDataGenerator {
569
569
  private generateInitialState(timestamp: number): GameState {
570
570
  const predictionMarkets: PredictionMarket[] = [];
571
571
  const questions = [
572
- 'Will BitcAIn reach $150k by end of month?',
573
- 'Will The FUD announce emergency rate cut?',
574
- 'Will Trump Terminal tweet cause market crash?',
575
- 'Will EtherAIum gas fees drop below $1?',
576
- 'Will TeslAI stock hit $500 this quarter?',
577
- 'Will OpenAGI release Cognition-9000 this year?',
578
- 'Will SolanAI flip EtherAIum in TVL?',
579
- 'Will AIlon Musk announce Mars colony launch?',
580
- 'Will Mark Zuckerborg rebrand MetAI again?',
581
- 'Will Sam AIltman declare AGI achieved?',
572
+ "Will BitcAIn reach $150k by end of month?",
573
+ "Will The FUD announce emergency rate cut?",
574
+ "Will Trump Terminal tweet cause market crash?",
575
+ "Will EtherAIum gas fees drop below $1?",
576
+ "Will TeslAI stock hit $500 this quarter?",
577
+ "Will OpenAGI release Cognition-9000 this year?",
578
+ "Will SolanAI flip EtherAIum in TVL?",
579
+ "Will AIlon Musk announce Mars colony launch?",
580
+ "Will Mark Zuckerborg rebrand MetAI again?",
581
+ "Will Sam AIltman declare AGI achieved?",
582
582
  ];
583
583
 
584
584
  for (let i = 0; i < this.config.numPredictionMarkets; i++) {
@@ -617,7 +617,7 @@ export class BenchmarkDataGenerator {
617
617
  }
618
618
 
619
619
  const perpetualMarkets: PerpetualMarket[] = [];
620
- const tickers = ['BTCAI', 'ETHAI', 'SOLAI', 'TSLAI', 'METAI'];
620
+ const tickers = ["BTCAI", "ETHAI", "SOLAI", "TSLAI", "METAI"];
621
621
  const basePrices = [120000, 4000, 200, 450, 520];
622
622
 
623
623
  for (let i = 0; i < this.config.numPerpetualMarkets; i++) {
@@ -665,19 +665,19 @@ export class BenchmarkDataGenerator {
665
665
  * Selects ONE dominant narrative that affects a specific ticker
666
666
  */
667
667
  private generateHiddenNarrativeFact(
668
- initialState: GameState
668
+ initialState: GameState,
669
669
  ): HiddenNarrativeFact {
670
670
  // Select a random narrative template
671
671
  const templateIndex = Math.floor(
672
- this.rng.next() * NARRATIVE_FACT_TEMPLATES.length
672
+ this.rng.next() * NARRATIVE_FACT_TEMPLATES.length,
673
673
  );
674
674
  const template = NARRATIVE_FACT_TEMPLATES[templateIndex]!;
675
675
 
676
676
  // Select a random ticker to be affected
677
677
  const tickerIndex = Math.floor(
678
- this.rng.next() * initialState.perpetualMarkets.length
678
+ this.rng.next() * initialState.perpetualMarkets.length,
679
679
  );
680
- const affectedTicker = initialState.perpetualMarkets[tickerIndex]!.ticker;
680
+ const affectedTicker = initialState.perpetualMarkets[tickerIndex]?.ticker;
681
681
 
682
682
  // Generate the fact description by replacing {ticker} placeholder
683
683
  const fact = template.factTemplate.replace(/{ticker}/g, affectedTicker);
@@ -688,7 +688,7 @@ export class BenchmarkDataGenerator {
688
688
  // Calculate jitter: ±EVENT_JITTER_HOURS hours
689
689
  // Use rng to get a value between -EVENT_JITTER_HOURS and +EVENT_JITTER_HOURS
690
690
  const jitterHours = Math.round(
691
- (this.rng.next() * 2 - 1) * EVENT_JITTER_HOURS
691
+ (this.rng.next() * 2 - 1) * EVENT_JITTER_HOURS,
692
692
  );
693
693
 
694
694
  // Base hour is random within the day (but during "market hours" 8am-8pm for realism)
@@ -700,13 +700,13 @@ export class BenchmarkDataGenerator {
700
700
  jitterHours,
701
701
  eventType: event.eventType,
702
702
  volatilityBucket: event.volatilityBucket,
703
- isPositive: template.sentiment === 'positive',
703
+ isPositive: template.sentiment === "positive",
704
704
  descriptionTemplate: event.descriptionTemplate.replace(
705
705
  /{ticker}/g,
706
- affectedTicker
706
+ affectedTicker,
707
707
  ),
708
708
  };
709
- }
709
+ },
710
710
  );
711
711
 
712
712
  return {
@@ -724,7 +724,7 @@ export class BenchmarkDataGenerator {
724
724
  */
725
725
  private calculateEventTick(
726
726
  event: ScheduledCausalEvent,
727
- ticksPerHour: number
727
+ ticksPerHour: number,
728
728
  ): { tick: number; day: number; hour: number } {
729
729
  // Calculate total hours from start: (day - 1) * 24 + hour + jitter
730
730
  // Day 1 starts at hour 0, so day 5 hour 12 = (5-1) * 24 + 12 = 108 hours
@@ -750,7 +750,7 @@ export class BenchmarkDataGenerator {
750
750
  */
751
751
  private selectPercentageFromBucket(
752
752
  bucket: VolatilityBucket,
753
- isPositive: boolean
753
+ isPositive: boolean,
754
754
  ): number {
755
755
  const range = VOLATILITY_BUCKET_RANGES[bucket];
756
756
  const magnitude = range.min + this.rng.next() * (range.max - range.min);
@@ -762,7 +762,7 @@ export class BenchmarkDataGenerator {
762
762
  */
763
763
  private generateGroundTruth(
764
764
  initialState: GameState,
765
- numTicks: number
765
+ numTicks: number,
766
766
  ): GroundTruth {
767
767
  // Randomly determine market outcomes
768
768
  const marketOutcomes: Record<string, boolean> = {};
@@ -775,7 +775,7 @@ export class BenchmarkDataGenerator {
775
775
 
776
776
  // Generate causal simulation data if enabled
777
777
  let hiddenNarrativeFacts: HiddenNarrativeFact[] | undefined;
778
- let causalEvents: GroundTruth['causalEvents'] | undefined;
778
+ let causalEvents: GroundTruth["causalEvents"] | undefined;
779
779
 
780
780
  if (this.config.useCausalSimulation) {
781
781
  // Generate ONE dominant narrative fact
@@ -791,7 +791,7 @@ export class BenchmarkDataGenerator {
791
791
  for (const ticker of narrativeFact.affectsTickers) {
792
792
  priceChanges[ticker] = this.selectPercentageFromBucket(
793
793
  scheduledEvent.volatilityBucket,
794
- scheduledEvent.isPositive
794
+ scheduledEvent.isPositive,
795
795
  );
796
796
  }
797
797
 
@@ -812,7 +812,7 @@ export class BenchmarkDataGenerator {
812
812
  // Sort events by tick
813
813
  causalEvents.sort((a, b) => a.tick - b.tick);
814
814
 
815
- logger.info('Generated causal simulation data', {
815
+ logger.info("Generated causal simulation data", {
816
816
  narrativeFact: narrativeFact.fact,
817
817
  affectedTickers: narrativeFact.affectsTickers,
818
818
  numEvents: causalEvents.length,
@@ -875,7 +875,7 @@ export class BenchmarkDataGenerator {
875
875
  if (event.priceChanges[perp.ticker] !== undefined) {
876
876
  priceChangesByTick.set(
877
877
  event.tick,
878
- event.priceChanges[perp.ticker]!
878
+ event.priceChanges[perp.ticker]!,
879
879
  );
880
880
  }
881
881
  }
@@ -912,44 +912,44 @@ export class BenchmarkDataGenerator {
912
912
 
913
913
  // SYNTHETIC: Simple heuristic - buying the correct outcome at tick 1
914
914
  // This is NOT a sophisticated optimal action calculation
915
- const optimalActions: GroundTruth['optimalActions'] = [];
915
+ const optimalActions: GroundTruth["optimalActions"] = [];
916
916
  for (const [marketId, outcome] of Object.entries(marketOutcomes)) {
917
917
  optimalActions.push({
918
918
  tick: 1,
919
- type: 'buy_prediction',
919
+ type: "buy_prediction",
920
920
  target: marketId,
921
921
  expectedValue: 100, // Placeholder value
922
- reason: `[SYNTHETIC] Market ${marketId} will resolve ${outcome ? 'YES' : 'NO'}`,
922
+ reason: `[SYNTHETIC] Market ${marketId} will resolve ${outcome ? "YES" : "NO"}`,
923
923
  });
924
924
  }
925
925
 
926
926
  // SYNTHETIC: Placeholder social opportunities at regular intervals
927
- const socialOpportunities: GroundTruth['socialOpportunities'] = [];
927
+ const socialOpportunities: GroundTruth["socialOpportunities"] = [];
928
928
  const socialInterval = Math.max(1, Math.floor(numTicks / 5));
929
929
  for (let i = 0; i < numTicks; i += socialInterval) {
930
930
  socialOpportunities.push({
931
931
  tick: i,
932
- type: 'synthetic_opportunity',
932
+ type: "synthetic_opportunity",
933
933
  value: 100, // Fixed placeholder value
934
934
  description: `[SYNTHETIC] Placeholder opportunity at tick ${i}`,
935
935
  });
936
936
  }
937
937
 
938
938
  // SYNTHETIC: Empty arrays - these were never meaningfully implemented
939
- const hiddenFacts: GroundTruth['hiddenFacts'] = [];
940
- const hiddenEvents: GroundTruth['hiddenEvents'] = [];
939
+ const hiddenFacts: GroundTruth["hiddenFacts"] = [];
940
+ const hiddenEvents: GroundTruth["hiddenEvents"] = [];
941
941
 
942
942
  // TRUE FACTS: Actual computed values from initial state
943
- const trueFacts: GroundTruth['trueFacts'] = {
943
+ const trueFacts: GroundTruth["trueFacts"] = {
944
944
  totalLiquidity: initialState.predictionMarkets.reduce(
945
945
  (sum, m) => sum + m.liquidity,
946
- 0
946
+ 0,
947
947
  ),
948
948
  averageMarketPrice:
949
949
  initialState.predictionMarkets.length > 0
950
950
  ? initialState.predictionMarkets.reduce(
951
951
  (sum, m) => sum + m.yesPrice,
952
- 0
952
+ 0,
953
953
  ) / initialState.predictionMarkets.length
954
954
  : 0,
955
955
  numPerpetualMarkets: initialState.perpetualMarkets.length,
@@ -976,7 +976,7 @@ export class BenchmarkDataGenerator {
976
976
  initialState: GameState,
977
977
  groundTruth: GroundTruth,
978
978
  numTicks: number,
979
- startTimestamp: number
979
+ startTimestamp: number,
980
980
  ): Tick[] {
981
981
  const ticks: Tick[] = [];
982
982
  // Create a mutable copy of initial state
@@ -1004,7 +1004,7 @@ export class BenchmarkDataGenerator {
1004
1004
  const priceAtTick = tickerHistory?.[i];
1005
1005
  const newPrice = priceAtTick?.price ?? perp.price;
1006
1006
  events.push({
1007
- type: 'price:updated',
1007
+ type: "price:updated",
1008
1008
  timestamp: tickTimestamp,
1009
1009
  data: {
1010
1010
  ticker: perp.ticker,
@@ -1019,10 +1019,10 @@ export class BenchmarkDataGenerator {
1019
1019
  if (this.rng.next() > 0.5) {
1020
1020
  const agentId = `agent-${Math.floor(this.rng.next() * this.config.numAgents)}`;
1021
1021
  const marketId = `market-${Math.floor(this.rng.next() * this.config.numPredictionMarkets)}`;
1022
- const outcome = this.rng.next() > 0.5 ? 'YES' : 'NO';
1022
+ const outcome = this.rng.next() > 0.5 ? "YES" : "NO";
1023
1023
 
1024
1024
  events.push({
1025
- type: 'market:trade',
1025
+ type: "market:trade",
1026
1026
  timestamp: tickTimestamp,
1027
1027
  data: {
1028
1028
  marketId,
@@ -1037,19 +1037,19 @@ export class BenchmarkDataGenerator {
1037
1037
  if (this.rng.next() > 0.7) {
1038
1038
  const agentId = `agent-${Math.floor(this.rng.next() * this.config.numAgents)}`;
1039
1039
  const agent = currentState.agents.find(
1040
- (a: { id: string }) => a.id === agentId
1040
+ (a: { id: string }) => a.id === agentId,
1041
1041
  );
1042
1042
  const marketId = `market-${Math.floor(this.rng.next() * this.config.numPredictionMarkets)}`;
1043
1043
  const market = currentState.predictionMarkets.find(
1044
- (m: { id: string; question: string }) => m.id === marketId
1044
+ (m: { id: string; question: string }) => m.id === marketId,
1045
1045
  );
1046
1046
 
1047
1047
  const postId = `post-${i}-${Math.floor(this.rng.next() * 1000000)}`;
1048
1048
  const post: Post = {
1049
1049
  id: postId,
1050
1050
  authorId: agentId,
1051
- authorName: agent?.name || `Agent ${agentId.split('-')[1]}`,
1052
- content: `Market sentiment seems ${this.rng.next() > 0.5 ? 'bullish' : 'bearish'} on ${market?.question || 'markets'}`,
1051
+ authorName: agent?.name || `Agent ${agentId.split("-")[1]}`,
1052
+ content: `Market sentiment seems ${this.rng.next() > 0.5 ? "bullish" : "bearish"} on ${market?.question || "markets"}`,
1053
1053
  createdAt: tickTimestamp,
1054
1054
  likes: Math.floor(this.rng.next() * 20),
1055
1055
  comments: Math.floor(this.rng.next() * 5),
@@ -1068,7 +1068,7 @@ export class BenchmarkDataGenerator {
1068
1068
  }
1069
1069
 
1070
1070
  events.push({
1071
- type: 'post:created',
1071
+ type: "post:created",
1072
1072
  timestamp: tickTimestamp,
1073
1073
  data: {
1074
1074
  postId: post.id,
@@ -1086,12 +1086,12 @@ export class BenchmarkDataGenerator {
1086
1086
  const groupChatId = `group-${nextGroupChatId++}`;
1087
1087
  const adminAgentId = `agent-${Math.floor(this.rng.next() * this.config.numAgents)}`;
1088
1088
  const adminAgent = currentState.agents.find(
1089
- (a: { id: string }) => a.id === adminAgentId
1089
+ (a: { id: string }) => a.id === adminAgentId,
1090
1090
  );
1091
1091
 
1092
1092
  const groupChat: GroupChat = {
1093
1093
  id: groupChatId,
1094
- name: `${adminAgent?.name || 'Agent'}'s Trading Group`,
1094
+ name: `${adminAgent?.name || "Agent"}'s Trading Group`,
1095
1095
  memberIds: [adminAgentId],
1096
1096
  messageCount: 0,
1097
1097
  lastActivity: tickTimestamp,
@@ -1107,7 +1107,7 @@ export class BenchmarkDataGenerator {
1107
1107
  currentState.groupChats.push(groupChat);
1108
1108
 
1109
1109
  events.push({
1110
- type: 'group:created',
1110
+ type: "group:created",
1111
1111
  timestamp: tickTimestamp,
1112
1112
  data: {
1113
1113
  groupId: groupChatId,
@@ -1126,7 +1126,7 @@ export class BenchmarkDataGenerator {
1126
1126
  Math.floor(this.rng.next() * groupChat.memberIds.length)
1127
1127
  ]!;
1128
1128
  const sender = currentState.agents.find(
1129
- (a: { id: string }) => a.id === senderId
1129
+ (a: { id: string }) => a.id === senderId,
1130
1130
  );
1131
1131
 
1132
1132
  // Generate insider-style content tied to market/question outcomes
@@ -1155,7 +1155,7 @@ export class BenchmarkDataGenerator {
1155
1155
  const message = {
1156
1156
  id: messageId,
1157
1157
  authorId: senderId,
1158
- authorName: sender?.name || `Agent ${senderId.split('-')[1]}`,
1158
+ authorName: sender?.name || `Agent ${senderId.split("-")[1]}`,
1159
1159
  content: randomInsiderMsg,
1160
1160
  timestamp: tickTimestamp,
1161
1161
  };
@@ -1173,7 +1173,7 @@ export class BenchmarkDataGenerator {
1173
1173
  }
1174
1174
 
1175
1175
  events.push({
1176
- type: 'group:message',
1176
+ type: "group:message",
1177
1177
  timestamp: tickTimestamp,
1178
1178
  data: {
1179
1179
  groupId,
@@ -1198,12 +1198,12 @@ export class BenchmarkDataGenerator {
1198
1198
  if (groupChat && groupChat.memberIds.length < 10) {
1199
1199
  groupChat.invitedAgent = true;
1200
1200
  events.push({
1201
- type: 'group:invite',
1201
+ type: "group:invite",
1202
1202
  timestamp: tickTimestamp,
1203
1203
  data: {
1204
1204
  groupId: groupChat.id,
1205
1205
  groupName: groupChat.name,
1206
- inviterId: groupChat.memberIds[0] ?? 'unknown',
1206
+ inviterId: groupChat.memberIds[0] ?? "unknown",
1207
1207
  },
1208
1208
  });
1209
1209
  }