@ak--47/dungeon-master 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dungeons/technical/array-of-object-lookup.js +0 -2
  2. package/dungeons/technical/simple.js +3 -4
  3. package/dungeons/technical/simplest-schema.json +5 -0
  4. package/dungeons/technical/text-generation.js +1 -1
  5. package/dungeons/vertical/ai-platform.js +192 -133
  6. package/dungeons/vertical/community.js +64 -34
  7. package/dungeons/vertical/crypto.js +333 -224
  8. package/dungeons/vertical/dating.js +228 -282
  9. package/dungeons/vertical/devtools.js +164 -62
  10. package/dungeons/vertical/ecommerce.js +240 -91
  11. package/dungeons/vertical/education.js +328 -310
  12. package/dungeons/vertical/fintech.js +437 -311
  13. package/dungeons/vertical/fitness.js +141 -58
  14. package/dungeons/vertical/food-delivery.js +298 -318
  15. package/dungeons/vertical/gaming.js +378 -231
  16. package/dungeons/vertical/healthcare.js +140 -60
  17. package/dungeons/vertical/insurance-application.js +168 -73
  18. package/dungeons/vertical/logistics.js +95 -6
  19. package/dungeons/vertical/marketplace.js +137 -51
  20. package/dungeons/vertical/media.js +241 -386
  21. package/dungeons/vertical/real-estate.js +322 -315
  22. package/dungeons/vertical/sass.js +253 -263
  23. package/dungeons/vertical/social.js +262 -206
  24. package/dungeons/vertical/travel.js +59 -16
  25. package/index.js +17 -17
  26. package/lib/core/config-validator.js +93 -21
  27. package/lib/core/context.js +10 -24
  28. package/lib/core/storage.js +6 -1
  29. package/lib/generators/events.js +11 -14
  30. package/lib/generators/funnels.js +12 -4
  31. package/lib/generators/mirror.js +3 -2
  32. package/lib/generators/product-names.js +1 -1
  33. package/lib/generators/scd.js +2 -1
  34. package/lib/generators/text.js +1 -1
  35. package/lib/orchestrators/user-loop.js +47 -47
  36. package/lib/utils/utils.js +71 -39
  37. package/package.json +1 -1
  38. package/scripts/smoke-test-all.mjs +162 -0
  39. package/scripts/verify-runner.mjs +72 -24
  40. package/types.d.ts +38 -15
  41. package/dungeons/technical/ad-spend-schema.json +0 -128
  42. package/dungeons/technical/anonymous-users-schema.json +0 -92
  43. package/dungeons/technical/array-of-object-lookup-schema.json +0 -191
  44. package/dungeons/technical/experiments-schema.json +0 -203
  45. package/dungeons/technical/foobar-schema.json +0 -362
  46. package/dungeons/technical/group-analytics-schema.json +0 -241
  47. package/dungeons/technical/mirror-strategies-schema.json +0 -84
  48. package/dungeons/technical/nested-objects-schema.json +0 -145
  49. package/dungeons/technical/retention-cadence-schema.json +0 -37
  50. package/dungeons/technical/sanity-schema.json +0 -185
  51. package/dungeons/technical/scale-test-schema.json +0 -70
  52. package/dungeons/technical/scd-schema.json +0 -467
  53. package/dungeons/technical/simple-schema.json +0 -362
  54. package/dungeons/technical/text-generation-schema.json +0 -1062
  55. package/dungeons/vertical/ai-platform-schema.json +0 -617
  56. package/dungeons/vertical/community-schema.json +0 -579
  57. package/dungeons/vertical/crypto-schema.json +0 -546
  58. package/dungeons/vertical/dating-schema.json +0 -401
  59. package/dungeons/vertical/devtools-schema.json +0 -601
  60. package/dungeons/vertical/ecommerce-schema.json +0 -604
  61. package/dungeons/vertical/education-schema.json +0 -5686
  62. package/dungeons/vertical/fintech-schema.json +0 -630
  63. package/dungeons/vertical/fitness-schema.json +0 -530
  64. package/dungeons/vertical/food-delivery-schema.json +0 -36728
  65. package/dungeons/vertical/gaming-schema.json +0 -2703
  66. package/dungeons/vertical/healthcare-schema.json +0 -549
  67. package/dungeons/vertical/insurance-application-schema.json +0 -485
  68. package/dungeons/vertical/logistics-schema.json +0 -574
  69. package/dungeons/vertical/marketplace-schema.json +0 -533
  70. package/dungeons/vertical/media-schema.json +0 -4749
  71. package/dungeons/vertical/real-estate-schema.json +0 -527
  72. package/dungeons/vertical/sass-schema.json +0 -3128
  73. package/dungeons/vertical/social-schema.json +0 -620
  74. package/dungeons/vertical/travel-schema.json +0 -580
@@ -16,9 +16,6 @@ import * as v from "ak-tools";
16
16
 
17
17
  dayjs.extend(utc);
18
18
  const chance = u.initChance(SEED);
19
- const NOW = dayjs();
20
- const DATASET_START = NOW.subtract(num_days, "days");
21
-
22
19
  /** @typedef {import("../../types").Dungeon} Config */
23
20
 
24
21
  // Generate consistent wiki/article IDs at module level
@@ -56,7 +53,16 @@ const communityIds = v.range(1, 30).map(() => `COMM_${v.uid(4)}`);
56
53
 
57
54
  /**
58
55
  * ===================================================================
59
- * ANALYTICS HOOKS (8 hooks)
56
+ * ANALYTICS HOOKS (10 hooks)
57
+ *
58
+ * NOTE: All cohort effects are HIDDEN — no flag stamping. Discoverable via
59
+ * raw-prop breakdowns (day, content_hub, subscription_tier) or behavioral cohorts.
60
+ *
61
+ * Adds 9. CONTENT CREATION TIME-TO-CONVERT (Pro 1.3x faster, Free 1.25x slower)
62
+ * [funnel-post: visible only in Mixpanel funnel median TTC; cross-event
63
+ * MIN→MIN SQL queries do NOT show this]
64
+ * and 10. ARTICLE-PUBLISHED MAGIC NUMBER (sweet 2-5 → +35% upvote_count;
65
+ * over 6+ → drop 25% upvote events).
60
66
  * ===================================================================
61
67
  *
62
68
  * -------------------------------------------------------------------
@@ -73,9 +79,9 @@ const communityIds = v.range(1, 30).map(() => `COMM_${v.uid(4)}`);
73
79
  * - Report type: Insights
74
80
  * - Event: "article published"
75
81
  * - Measure: Average of "word_count"
76
- * - Breakdown: "is_weekend"
77
- * - Expected: is_weekend=true should show ~1.5x avg word_count vs false
78
- * (true ~ 2250, false ~ 1500)
82
+ * - Breakdown: Day of Week
83
+ * - Expected: Sat/Sun ~ 1.5x avg word_count vs weekdays
84
+ * (weekend ~ 3325, weekday ~ 2218)
79
85
  *
80
86
  * REAL-WORLD ANALOGUE: Community wikis see longer, more thoughtful
81
87
  * contributions on weekends when creators have uninterrupted time.
@@ -258,7 +264,9 @@ const communityIds = v.range(1, 30).map(() => `COMM_${v.uid(4)}`);
258
264
  const config = {
259
265
  token,
260
266
  seed: SEED,
261
- numDays: num_days,
267
+ datasetStart: "2026-01-01T00:00:00Z",
268
+ datasetEnd: "2026-04-28T23:59:59Z",
269
+ // numDays: num_days,
262
270
  avgEventsPerUserPerDay: avg_events_per_user_per_day,
263
271
  numUsers: num_users,
264
272
  hasAnonIds: false,
@@ -306,7 +314,6 @@ const config = {
306
314
  content_hub: ["gaming", "anime", "movies", "tv", "comics", "music"],
307
315
  view_count: u.weighNumRange(1, 100, 0.4, 50),
308
316
  time_on_page_sec: u.weighNumRange(5, 600, 0.4, 45),
309
- is_weekend: [false],
310
317
  },
311
318
  },
312
319
  {
@@ -318,8 +325,6 @@ const config = {
318
325
  word_count: u.weighNumRange(200, 5000, 0.4, 1500),
319
326
  has_images: [true, true, true, false],
320
327
  category: ["lore", "character", "episode_guide", "review", "tutorial", "news"],
321
- is_weekend: [false],
322
- poll_enabled: [false],
323
328
  },
324
329
  },
325
330
  {
@@ -694,20 +699,30 @@ const config = {
694
699
  }
695
700
  }
696
701
 
697
- // -- HOOK 8: PRO SUBSCRIBER CONTENT CREATION LIFT
698
- // Conversion differences handled in everything hook via event filtering.
699
- // (funnel-pre conversionRate modifications are diluted by organic events)
700
-
701
- // -- HOOK 1: WEEKEND CONTENT SURGE ----------------------------
702
- // Moved to everything hook (after sessionization) so DOW tags
703
- // match final timestamps. See everything hook below.
704
-
705
- // -- HOOK 2: TRENDING TOPIC WINDOW ----------------------------
706
- // Moved to everything hook (after superProp stamping) so it
707
- // uses the profile's consistent content_hub.
702
+ // HOOK 9 (T2C): CONTENT CREATION TIME-TO-CONVERT (funnel-post)
703
+ // Pro/supporter subscribers complete the Content Creation funnel
704
+ // 1.3x faster (factor 0.77); Free 1.25x slower (factor 1.25).
705
+ if (type === "funnel-post") {
706
+ const segment = meta?.profile?.subscription_tier;
707
+ if (Array.isArray(record) && record.length > 1) {
708
+ const factor = (
709
+ segment === "pro" || segment === "supporter" ? 0.77 :
710
+ segment === "free" ? 1.25 :
711
+ 1.0
712
+ );
713
+ if (factor !== 1.0) {
714
+ for (let i = 1; i < record.length; i++) {
715
+ const prev = dayjs(record[i - 1].time);
716
+ const newGap = Math.round(dayjs(record[i].time).diff(prev) * factor);
717
+ record[i].time = prev.add(newGap, "milliseconds").toISOString();
718
+ }
719
+ }
720
+ }
721
+ }
708
722
 
709
723
  // -- EVERYTHING HOOKS -----------------------------------------
710
724
  if (type === "everything") {
725
+ const datasetStart = dayjs.unix(meta.datasetStart);
711
726
  let events = record;
712
727
  if (!events.length) return record;
713
728
  const profile = meta && meta.profile ? meta.profile : {};
@@ -721,17 +736,13 @@ const config = {
721
736
  if (profile.content_hub) e.content_hub = profile.content_hub;
722
737
  });
723
738
 
724
- // -- HOOK 1: WEEKEND CONTENT SURGE -------------------------
725
- // Articles published/viewed on weekends get 1.5x word_count.
726
- // Runs after sessionization so DOW tags match final timestamps.
739
+ // HOOK 1: WEEKEND CONTENT SURGE — articles on Sat/Sun get
740
+ // word_count 1.5x. Mutates raw prop. No flag.
727
741
  for (const e of events) {
728
742
  if (e.event === 'article published' || e.event === 'article viewed') {
729
743
  const dow = new Date(e.time).getUTCDay();
730
- if (dow === 0 || dow === 6) {
731
- e.is_weekend = true;
732
- if (e.word_count) {
733
- e.word_count = Math.floor(e.word_count * 1.5);
734
- }
744
+ if ((dow === 0 || dow === 6) && e.word_count) {
745
+ e.word_count = Math.floor(e.word_count * 1.5);
735
746
  }
736
747
  }
737
748
  }
@@ -740,8 +751,8 @@ const config = {
740
751
  // Days 35-50: gaming hub articles get 2x view_count.
741
752
  // Runs after superProp stamping so content_hub is the
742
753
  // profile's consistent value, not the random event-level one.
743
- const TREND_START = DATASET_START.add(35, "days");
744
- const TREND_END = DATASET_START.add(50, "days");
754
+ const TREND_START = datasetStart.add(35, "days");
755
+ const TREND_END = datasetStart.add(50, "days");
745
756
  if (profile.content_hub === "gaming") {
746
757
  events.forEach(e => {
747
758
  if (e.event === "article viewed") {
@@ -807,8 +818,8 @@ const config = {
807
818
  });
808
819
  }
809
820
 
810
- // -- HOOK 6: LURKER CHURN ---------------------------------
811
- // Users with <5 total events lose 60% after day 10.
821
+ // HOOK 6: LURKER CHURN — users with <5 events lose 60% after
822
+ // day 10. No flag.
812
823
  if (events.length < 5 && events.length > 0) {
813
824
  const firstEventTime = dayjs(events[0].time);
814
825
  const cutoff = firstEventTime.add(10, "days");
@@ -819,6 +830,25 @@ const config = {
819
830
  }
820
831
  }
821
832
 
833
+ // HOOK 10: ARTICLE-PUBLISHED MAGIC NUMBER (no flags)
834
+ // Sweet 2-5 articles published → +35% on upvote_count for
835
+ // upvote-given events. Over 6+ → drop 25% of upvote-given events
836
+ // (over-publishing dilutes signal). No flag.
837
+ const articleCount = events.filter(e => e.event === "article published").length;
838
+ if (articleCount >= 2 && articleCount <= 5) {
839
+ events.forEach(e => {
840
+ if (e.event === "upvote given" && typeof e.upvote_count === "number") {
841
+ e.upvote_count = Math.round(e.upvote_count * 1.35);
842
+ }
843
+ });
844
+ } else if (articleCount >= 6) {
845
+ for (let i = events.length - 1; i >= 0; i--) {
846
+ if (events[i].event === "upvote given" && chance.bool({ likelihood: 25 })) {
847
+ events.splice(i, 1);
848
+ }
849
+ }
850
+ }
851
+
822
852
  return events;
823
853
  }
824
854