make-mp-data 2.1.11 → 3.0.2

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 (71) hide show
  1. package/README.md +31 -0
  2. package/dungeons/adspend.js +35 -1
  3. package/dungeons/anon.js +25 -1
  4. package/dungeons/array-of-object-lookup.js +201 -0
  5. package/dungeons/benchmark-heavy.js +241 -0
  6. package/dungeons/benchmark-light.js +141 -0
  7. package/dungeons/big.js +10 -9
  8. package/dungeons/business.js +60 -12
  9. package/dungeons/complex.js +35 -1
  10. package/dungeons/copilot.js +383 -0
  11. package/dungeons/education.js +1005 -0
  12. package/dungeons/experiments.js +18 -4
  13. package/dungeons/fintech.js +976 -0
  14. package/dungeons/foobar.js +32 -0
  15. package/dungeons/food.js +988 -0
  16. package/dungeons/funnels.js +38 -1
  17. package/dungeons/gaming.js +26 -5
  18. package/dungeons/media.js +861 -270
  19. package/dungeons/mil.js +31 -3
  20. package/dungeons/mirror.js +33 -1
  21. package/dungeons/retention-cadence.js +211 -0
  22. package/dungeons/rpg.js +1178 -0
  23. package/dungeons/sanity.js +32 -2
  24. package/dungeons/sass.js +923 -0
  25. package/dungeons/scd.js +47 -1
  26. package/dungeons/simple.js +29 -14
  27. package/dungeons/social.js +928 -0
  28. package/dungeons/streaming.js +373 -0
  29. package/dungeons/strict-event-test.js +30 -0
  30. package/dungeons/student-teacher.js +19 -5
  31. package/dungeons/text-generation.js +120 -84
  32. package/dungeons/too-big-events.js +203 -0
  33. package/dungeons/{userAgent.js → user-agent.js} +23 -2
  34. package/entry.js +5 -4
  35. package/index.js +41 -54
  36. package/lib/core/config-validator.js +122 -7
  37. package/lib/core/context.js +7 -14
  38. package/lib/core/storage.js +57 -25
  39. package/lib/generators/adspend.js +12 -12
  40. package/lib/generators/events.js +6 -5
  41. package/lib/generators/funnels.js +32 -10
  42. package/lib/generators/product-lookup.js +262 -0
  43. package/lib/generators/product-names.js +195 -0
  44. package/lib/generators/profiles.js +3 -3
  45. package/lib/generators/scd.js +13 -3
  46. package/lib/generators/text.js +17 -4
  47. package/lib/orchestrators/mixpanel-sender.js +244 -204
  48. package/lib/orchestrators/user-loop.js +54 -16
  49. package/lib/templates/phrases.js +473 -16
  50. package/lib/templates/schema.d.ts +173 -0
  51. package/lib/templates/verbose-schema.js +140 -206
  52. package/lib/utils/chart.js +210 -0
  53. package/lib/utils/function-registry.js +285 -0
  54. package/lib/utils/json-evaluator.js +172 -0
  55. package/lib/utils/logger.js +34 -0
  56. package/lib/utils/utils.js +41 -4
  57. package/package.json +12 -21
  58. package/types.d.ts +15 -5
  59. package/dungeons/ai-chat-analytics-ed.js +0 -274
  60. package/dungeons/money2020-ed-also.js +0 -277
  61. package/dungeons/money2020-ed.js +0 -579
  62. package/lib/generators/text-bak-old.js +0 -1121
  63. package/lib/orchestrators/worker-manager.js +0 -203
  64. package/lib/templates/hooks-instructions.txt +0 -434
  65. package/lib/templates/phrases-bak.js +0 -925
  66. package/lib/templates/prompt (old).txt +0 -98
  67. package/lib/templates/schema-instructions.txt +0 -155
  68. package/lib/templates/scratch-dungeon-template.js +0 -116
  69. package/lib/templates/textQuickTest.js +0 -172
  70. package/lib/utils/ai.js +0 -120
  71. package/lib/utils/project.js +0 -166
@@ -1,277 +0,0 @@
1
-
2
-
3
- import dayjs from "dayjs";
4
- import utc from "dayjs/plugin/utc.js";
5
- import "dotenv/config";
6
- import { weighNumRange, range, date, initChance, exhaust, choose, integer, decimal } from "../lib/utils/utils.js";
7
-
8
- const SEED = "thfdgdsdfsdfdffgdfgank sup hello 2020 money!!!";
9
- dayjs.extend(utc);
10
- const chance = initChance(SEED);
11
- const num_users = 2_000;
12
- const days = 60;
13
-
14
- /** @typedef {import("../types.js").Dungeon} Dungeon */
15
-
16
- /** @type {Dungeon} */
17
- const dungeon = {
18
- token: "",
19
- seed: SEED,
20
- numDays: days,
21
- numEvents: num_users * 120,
22
- numUsers: num_users,
23
- hasAnonIds: false,
24
- hasSessionIds: false,
25
- format: "json",
26
- alsoInferFunnels: false,
27
- hasLocation: true,
28
- hasAndroidDevices: false,
29
- hasIOSDevices: false,
30
- hasDesktopDevices: true,
31
- hasBrowser: true,
32
- hasCampaigns: true,
33
- isAnonymous: false,
34
- hasAdSpend: false,
35
- percentUsersBornInDataset: 40,
36
- hasAvatar: true,
37
-
38
-
39
- batchSize: 1_500_000,
40
- concurrency: 1,
41
- writeToDisk: false,
42
- superProps: {
43
- version: "3"
44
- },
45
- // AI-generated schema content:
46
- funnels: [
47
- {
48
- name: "AI Interaction",
49
- sequence: [
50
- "AI: Launch",
51
- "AI: Prompt Sent",
52
- "AI: Response Sent",
53
- "AI: Dismissed"
54
- ],
55
- isFirstFunnel: false,
56
- conversionRate: 38,
57
- timeToConvert: 5,
58
- order: "sequential",
59
- weight: 7,
60
- props: { "AI Model": ["5-turbo", "5-flash", "5-flagship", "homegrown"] }
61
- },
62
- {
63
- name: "AI Interaction Errors",
64
- sequence: [
65
- "AI: Launch",
66
- "AI: Prompt Sent",
67
- "AI: Response Sent",
68
- "AI: API Error",
69
- "AI: Dismissed"
70
- ],
71
- isFirstFunnel: false,
72
- conversionRate: 27,
73
- timeToConvert: 5,
74
- order: "sequential",
75
- weight: 3,
76
- props: { "AI Model": ["5-turbo", "5-flash", "5-flagship", "homegrown"] }
77
- }
78
- ],
79
- events: [
80
- {
81
- event: "AI: Launch",
82
- weight: 2,
83
- properties: {
84
- entry_point: [
85
- "dashboard_widget",
86
- "header_button",
87
- "in_app_prompt"
88
- ]
89
- }
90
- },
91
- {
92
- event: "AI: Prompt Sent",
93
- weight: 10,
94
- properties: {
95
- prompt: [
96
- "how can I make a dashboard?",
97
- "what is a funnel?",
98
- "what drives new users?",
99
- "show me my top performing campaigns",
100
- "compare user retention by country"
101
- ],
102
- prompt_length: weighNumRange(15, 150)
103
- }
104
- },
105
- {
106
- event: "AI: Response Sent",
107
- weight: 10,
108
- properties: {
109
- cost: weighNumRange(1, 10, 0.2),
110
- tokens: weighNumRange(100, 1000, 0.4),
111
- time_to_generate_ms: weighNumRange(1000, 10000, 0.2)
112
- }
113
- },
114
- {
115
- event: "AI: Dismissed",
116
- weight: 2,
117
- properties: {
118
- reason: [
119
- "finished",
120
- "clicked_away",
121
- "new_prompt",
122
- "error"
123
- ]
124
- }
125
- },
126
- {
127
- event: "AI: API Error",
128
- weight: 2,
129
- properties: {
130
- error_code: [
131
- 400,
132
- 401,
133
- 429,
134
- 500,
135
- 503
136
- ],
137
- error_message: [
138
- "Bad Request",
139
- "Unauthorized",
140
- "Too Many Requests",
141
- "Internal Server Error",
142
- "Service Unavailable"
143
- ]
144
- }
145
- }
146
- ],
147
- userProps: {
148
- plan_type: [
149
- "free",
150
- "pro",
151
- "pro",
152
- "enterprise",
153
- "free"
154
- ],
155
- company_size: [
156
- "1-10",
157
- "11-50",
158
- "51-200",
159
- "201-1000",
160
- "1000+"
161
- ],
162
- account_tier: [
163
- "Basic",
164
- "Plus",
165
- "Premium",
166
- ],
167
- created_date: date(365, true, 'YYYY-MM-DD')
168
- },
169
-
170
- hook: function (record, type, meta) {
171
- const NOW = dayjs();
172
- const FLASH_LAUNCH = NOW.subtract(50, 'day');
173
- const TURBO_LAUNCH = NOW.subtract(20, 'day');
174
- const HOMEGROWN_LAUNCH = NOW.subtract(10, 'day');
175
- const DATE_HOMEGROWN_LAUNCH = NOW.subtract(10, 'day');
176
- const DATE_HOMEGROWN_IMPROVEMENT = NOW.subtract(5, 'day');
177
- const OVER_THINGS_GET_BETTER = NOW.subtract(30, 'day');
178
-
179
- if (type === "event") {
180
- const EVENT_TIME = dayjs(record.time);
181
-
182
- if (record.prompt) {
183
- // calculate prompt length
184
- record.prompt_length = record.prompt.length;
185
- }
186
- // models: "5-turbo", "5-flash", "5-flagship", "homegrown"
187
- if (record?.["AI Model"]) {
188
- let modelPool = ["5-flagship"];
189
- if (EVENT_TIME.isAfter(FLASH_LAUNCH)) modelPool.push("5-flash");
190
- if (EVENT_TIME.isAfter(TURBO_LAUNCH)) modelPool.push("5-turbo");
191
- if (EVENT_TIME.isAfter(HOMEGROWN_LAUNCH)) modelPool.push("homegrown");
192
-
193
- const chosenModel = chance.pickone(modelPool);
194
- record["AI Model"] = chosenModel;
195
-
196
- // choose which model based on date + weights
197
- if (EVENT_TIME.isBefore(DATE_HOMEGROWN_LAUNCH)) {
198
- if (chosenModel === "homegrown") {
199
- if (chance.bool({ likelihood: 75 })) {
200
- record["AI Model"] = "5-flagship";
201
- }
202
- }
203
- }
204
-
205
- if (EVENT_TIME.isAfter(DATE_HOMEGROWN_LAUNCH)) {
206
- if (chosenModel !== "homegrown") {
207
- if (chance.bool({ likelihood: 27 })) {
208
- record["AI Model"] = "homegrown";
209
- }
210
- }
211
-
212
- if (record["AI Model"] && record["cost"] && record["tokens"]) {
213
-
214
- // update params
215
- switch (record["AI Model"]) {
216
- // 5 turbo is most expensive and slowest
217
- case "5-turbo":
218
- record["cost"] *= decimal(1.2, 1.7, 3);
219
- record["tokens"] *= decimal(1.2, 1.7, 3);
220
- break;
221
- // 5 flash is least expensive and fastest
222
- case "5-flash":
223
- record["cost"] *= decimal(0.8, 0.8, 3);
224
- record["tokens"] *= decimal(0.8, 0.8, 3);
225
- break;
226
- // 5 flagship is in between in both areas
227
- case "5-flagship":
228
- record["cost"] *= decimal(1.0, 1.0, 3);
229
- record["tokens"] *= decimal(1.0, 1.0, 3);
230
- break;
231
- // homegrown is chaotic is chaotic
232
- case "homegrown":
233
-
234
- record["cost"] *= decimal(0.5, 2.5, 3);
235
- record["tokens"] *= decimal(0.5, 2.5, 3);
236
- if (EVENT_TIME.isBefore(DATE_HOMEGROWN_IMPROVEMENT)) {
237
- record["cost"] *= decimal(1.2, 5.0, 3);
238
- record["tokens"] *= decimal(1.2, 3.0, 3);
239
- }
240
- if (EVENT_TIME.isAfter(DATE_HOMEGROWN_IMPROVEMENT)) {
241
- record["cost"] *= decimal(0.5, 1.0, 3);
242
- record["tokens"] *= decimal(0.5, 0.75, 3);
243
- }
244
- break;
245
- default:
246
- break;
247
- }
248
- }
249
-
250
- }
251
- }
252
-
253
-
254
-
255
- }
256
- if (type === "funnel-pre") {
257
- const parsedFirstEventTime = dayjs.unix(meta.firstEventTime);
258
- if (!parsedFirstEventTime.isValid()) debugger;
259
- //stupid offset thing we need to do...
260
- const actualFunnelTime = parsedFirstEventTime.add(NOW.diff(dayjs.unix(global.FIXED_NOW), 'h'), 'h');
261
- if (actualFunnelTime.isBefore(OVER_THINGS_GET_BETTER)) {
262
- record.conversionRate *= decimal(0.5, 0.9, 3);
263
- // record.timeToConvert *= decimal(1.5, 3.0, 3);
264
- }
265
- if (actualFunnelTime.isAfter(OVER_THINGS_GET_BETTER)) {
266
- const distanceDays = Math.min(30, actualFunnelTime.diff(OVER_THINGS_GET_BETTER, 'day'));
267
- const improvementFactor = 1.0 + (distanceDays / 30) * 0.5;
268
- // record.timeToConvert *= decimal(0.5, 0.75, 3) / improvementFactor;
269
- record.conversionRate *= decimal(1.0, 2.0, 4) * improvementFactor;
270
- }
271
- }
272
- return record;
273
- }
274
- };
275
-
276
- export default dungeon;
277
-