make-mp-data 3.0.1 → 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 (50) hide show
  1. package/dungeons/adspend.js +35 -1
  2. package/dungeons/anon.js +25 -1
  3. package/dungeons/{array-of-object-loopup.js → array-of-object-lookup.js} +28 -8
  4. package/dungeons/benchmark-heavy.js +2 -2
  5. package/dungeons/benchmark-light.js +2 -2
  6. package/dungeons/big.js +2 -2
  7. package/dungeons/business.js +59 -12
  8. package/dungeons/complex.js +34 -1
  9. package/dungeons/copilot.js +1 -1
  10. package/dungeons/{harness/harness-education.js → education.js} +29 -12
  11. package/dungeons/experiments.js +15 -2
  12. package/dungeons/{harness/harness-fintech.js → fintech.js} +8 -8
  13. package/dungeons/foobar.js +33 -1
  14. package/dungeons/{harness/harness-food.js → food.js} +7 -4
  15. package/dungeons/funnels.js +38 -1
  16. package/dungeons/gaming.js +25 -5
  17. package/dungeons/media.js +861 -271
  18. package/dungeons/mil.js +29 -2
  19. package/dungeons/mirror.js +33 -1
  20. package/dungeons/{kurby.js → retention-cadence.js} +1 -1
  21. package/dungeons/{harness/harness-gaming.js → rpg.js} +5 -5
  22. package/dungeons/sanity.js +31 -2
  23. package/dungeons/{harness/harness-sass.js → sass.js} +2 -2
  24. package/dungeons/scd.js +46 -1
  25. package/dungeons/simple.js +1 -1
  26. package/dungeons/{harness/harness-social.js → social.js} +2 -2
  27. package/dungeons/streaming.js +373 -0
  28. package/dungeons/strict-event-test.js +1 -1
  29. package/dungeons/student-teacher.js +18 -5
  30. package/dungeons/text-generation.js +38 -1
  31. package/dungeons/too-big-events.js +38 -1
  32. package/dungeons/{userAgent.js → user-agent.js} +21 -1
  33. package/entry.js +5 -4
  34. package/lib/utils/logger.js +0 -4
  35. package/package.json +1 -4
  36. package/dungeons/ai-chat-analytics-ed.js +0 -275
  37. package/dungeons/clinch-agi.js +0 -632
  38. package/dungeons/ecommerce-store.js +0 -0
  39. package/dungeons/harness/harness-media.js +0 -961
  40. package/dungeons/money2020-ed-also.js +0 -277
  41. package/dungeons/money2020-ed.js +0 -580
  42. package/dungeons/uday-schema.json +0 -220
  43. package/lib/templates/funnels-instructions.txt +0 -272
  44. package/lib/templates/hook-examples.json +0 -187
  45. package/lib/templates/hooks-instructions.txt +0 -721
  46. package/lib/templates/refine-instructions.txt +0 -485
  47. package/lib/templates/schema-instructions.txt +0 -285
  48. package/lib/utils/ai.js +0 -896
  49. package/lib/utils/mixpanel.js +0 -101
  50. package/lib/utils/project.js +0 -167
@@ -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
-