@vibemancer/core 0.1.0

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 (78) hide show
  1. package/README.md +28 -0
  2. package/dist/chunk-L7Z7OFXD.js +9140 -0
  3. package/dist/chunk-L7Z7OFXD.js.map +1 -0
  4. package/dist/index-browser.d.ts +2602 -0
  5. package/dist/index-browser.js +407 -0
  6. package/dist/index-browser.js.map +1 -0
  7. package/dist/index.d.ts +150 -0
  8. package/dist/index.js +750 -0
  9. package/dist/index.js.map +1 -0
  10. package/package.json +79 -0
  11. package/src/bots/berserker/01_Stormchaser.ts +457 -0
  12. package/src/bots/berserker/02_Stormcaller.ts +417 -0
  13. package/src/bots/berserker/03_Stormforger.ts +481 -0
  14. package/src/bots/caster/01_Flamecaller.ts +286 -0
  15. package/src/bots/caster/02_Pyromancer.ts +350 -0
  16. package/src/bots/caster/03_Infernalist.ts +492 -0
  17. package/src/bots/defensive/01_Turtle.ts +151 -0
  18. package/src/bots/defensive/02_Sentinel.ts +134 -0
  19. package/src/bots/defensive/03_Golem.ts +357 -0
  20. package/src/bots/duelist/01_Battlemage.ts +433 -0
  21. package/src/bots/duelist/02_Warmage.ts +438 -0
  22. package/src/bots/duelist/03_Archmage.ts +588 -0
  23. package/src/bots/homing/01_Bonemancer.ts +67 -0
  24. package/src/bots/homing/02_Lich.ts +356 -0
  25. package/src/bots/homing/03_Archlich.ts +220 -0
  26. package/src/bots/index.ts +30 -0
  27. package/src/bots/kiter/01_Spellspinner.ts +398 -0
  28. package/src/bots/kiter/02_Spellweaver.ts +378 -0
  29. package/src/bots/kiter/03_Spellbinder.ts +448 -0
  30. package/src/bots/melee/01_Shadowblade.ts +270 -0
  31. package/src/bots/melee/02_Nightblade.ts +437 -0
  32. package/src/bots/melee/03_Voidblade.ts +582 -0
  33. package/src/bots/registry.ts +207 -0
  34. package/src/bots/shared.ts +472 -0
  35. package/src/bots/sniper/01_Spellshot.ts +385 -0
  36. package/src/bots/sniper/02_Spelltracer.ts +441 -0
  37. package/src/bots/sniper/03_Spellseeker.ts +546 -0
  38. package/src/bots/standalone/Critter.ts +89 -0
  39. package/src/bots/standalone/Doombringer.ts +91 -0
  40. package/src/bots/standalone/Hogger.ts +228 -0
  41. package/src/bots/standalone/Rookie.ts +50 -0
  42. package/src/bots/standalone/TargetDummy.ts +21 -0
  43. package/src/bots/test/cheater.ts +405 -0
  44. package/src/bots/test/crasher.ts +81 -0
  45. package/src/engine/hooks-runtime.ts +394 -0
  46. package/src/engine/manual-match.ts +289 -0
  47. package/src/engine/missile-templates.ts +155 -0
  48. package/src/engine/optimizer.ts +220 -0
  49. package/src/engine/params-runtime.ts +189 -0
  50. package/src/engine/physics.ts +143 -0
  51. package/src/engine/sandbox-browser.ts +671 -0
  52. package/src/engine/sandbox-compile.ts +197 -0
  53. package/src/engine/sandbox-harness.ts +367 -0
  54. package/src/engine/sandbox.ts +332 -0
  55. package/src/engine/simulation.ts +828 -0
  56. package/src/engine/spells.ts +128 -0
  57. package/src/engine-version.ts +11 -0
  58. package/src/hooks/action-builders.ts +210 -0
  59. package/src/hooks/bot-wrapper.ts +84 -0
  60. package/src/hooks/index.ts +75 -0
  61. package/src/hooks/state-hooks.ts +354 -0
  62. package/src/hooks/threat-analysis.ts +365 -0
  63. package/src/hooks/types.ts +142 -0
  64. package/src/index-browser.ts +30 -0
  65. package/src/index.ts +24 -0
  66. package/src/rules.ts +254 -0
  67. package/src/stats.ts +262 -0
  68. package/src/testing.ts +207 -0
  69. package/src/trace.ts +430 -0
  70. package/src/types.ts +193 -0
  71. package/src/utils/angles.ts +47 -0
  72. package/src/utils/combat.ts +279 -0
  73. package/src/utils/distance.ts +21 -0
  74. package/src/utils/index.ts +7 -0
  75. package/src/utils/movement.ts +108 -0
  76. package/src/utils/random.ts +65 -0
  77. package/src/utils/spatial.ts +63 -0
  78. package/src/utils/targeting.ts +45 -0
@@ -0,0 +1,407 @@
1
+ import {
2
+ ALL_BOTS,
3
+ ARENA_HEIGHT,
4
+ ARENA_SIZE,
5
+ ARENA_WATER_BUFFER,
6
+ ARENA_WIDTH,
7
+ Archlich,
8
+ Archmage,
9
+ BLINK_CAST_TIME,
10
+ BLINK_COOLDOWN,
11
+ BLINK_MAX_COOLDOWN,
12
+ BLINK_MAX_RANGE,
13
+ BLINK_MIN_COOLDOWN,
14
+ BLINK_RANGE,
15
+ BOT_GROUPS,
16
+ Battlemage,
17
+ Bonemancer,
18
+ BrowserManualMatchSandbox,
19
+ BrowserMatchSandbox,
20
+ CASTING_MOVEMENT_MULT,
21
+ COLLISION_RADIUS,
22
+ Critter,
23
+ Doombringer,
24
+ ENGINE_VERSION,
25
+ FIGHT_SPAWN_DISTANCES,
26
+ Flamecaller,
27
+ GCD_DURATION,
28
+ Golem,
29
+ Hogger,
30
+ Infernalist,
31
+ Lich,
32
+ MATCH_DURATION,
33
+ MAX_HEALTH,
34
+ MISSILE_BASE_CAST,
35
+ MISSILE_BASE_RADIUS,
36
+ MISSILE_DAMAGE_POWER,
37
+ MISSILE_DAMAGE_RADIUS_SCALE,
38
+ MISSILE_DAMAGE_SCALE,
39
+ MISSILE_HOMING_COEFF,
40
+ MISSILE_MIN_CAST_TIME,
41
+ MISSILE_MIN_DAMAGE,
42
+ MISSILE_MIN_DURATION,
43
+ MISSILE_MIN_SPEED,
44
+ MISSILE_RADIUS_PER_DAMAGE,
45
+ MISSILE_SPEED_DURATION_BASELINE,
46
+ MISSILE_SPEED_DURATION_COEFF,
47
+ MISSILE_TURN_DURATION_COEFF,
48
+ MOVEMENT_SPEED,
49
+ MOVE_SPEED,
50
+ ManualMatch,
51
+ Nightblade,
52
+ Pyromancer,
53
+ Rookie,
54
+ SHIELD_CAST_TIME,
55
+ SHIELD_DECAY_PER_SECOND,
56
+ SHIELD_DECAY_RATE,
57
+ SHIELD_MAX_BLOCK,
58
+ SHIELD_MAX_STRENGTH,
59
+ SHIELD_MIN_BLOCK,
60
+ SHIELD_MIN_STRENGTH,
61
+ SPAWN_DISTANCE,
62
+ Sentinel,
63
+ Shadowblade,
64
+ Spellbinder,
65
+ Spellseeker,
66
+ Spellshot,
67
+ Spellspinner,
68
+ Spelltracer,
69
+ Spellweaver,
70
+ Stormcaller,
71
+ Stormchaser,
72
+ Stormforger,
73
+ TICKS_PER_SECOND,
74
+ TICK_DURATION_MS,
75
+ TargetDummy,
76
+ Turtle,
77
+ Voidblade,
78
+ WARMUP_DURATION_TOLERANCE,
79
+ WARMUP_MAX_BONUS,
80
+ WARMUP_MAX_PENALTY,
81
+ WARMUP_SPEED_TOLERANCE,
82
+ WARMUP_TURN_TOLERANCE,
83
+ WIZARD_HEALTH,
84
+ WIZARD_RADIUS,
85
+ Warmage,
86
+ analyzeThreats,
87
+ angleDiff,
88
+ angleInRange,
89
+ angleTo,
90
+ antiHomingMissile,
91
+ applyDamage,
92
+ blink,
93
+ browserSandboxFight,
94
+ browserSandboxSimulate,
95
+ calculateBlinkCooldown,
96
+ calculateMissileCastTime,
97
+ calculateMissileRadius,
98
+ calculateMissileSimilarity,
99
+ calculateShieldBlock,
100
+ calculateWarmupMultiplier,
101
+ cancel,
102
+ cancelCast,
103
+ clampPositionToArena,
104
+ clampToArena,
105
+ clearHooks,
106
+ clearParamValues,
107
+ completeCast,
108
+ createEntitySeed,
109
+ createInitialState,
110
+ createRandom,
111
+ createWorkerScript,
112
+ diagnoseTrace,
113
+ directionAway,
114
+ directionTo,
115
+ distanceTo,
116
+ effectiveTurnRateCost,
117
+ extractAction,
118
+ extractStats,
119
+ extractTraceEvents,
120
+ fight,
121
+ findInRange,
122
+ findNearest,
123
+ fitMissileToBudget,
124
+ formatDiagnosis,
125
+ formatStats,
126
+ formatTraceEvents,
127
+ formatTraceSummary,
128
+ generateCandidates,
129
+ generateCombos,
130
+ getAdaptiveMissileConfig,
131
+ getBotContext,
132
+ getEffectiveRange,
133
+ getLeadPosition,
134
+ getMissileCastTime,
135
+ getPlayerState,
136
+ hashCombine,
137
+ homingMissile,
138
+ idle,
139
+ inRange,
140
+ interceptAngle,
141
+ isNewStyleBot,
142
+ magnitude,
143
+ missile,
144
+ move,
145
+ moveInDirection,
146
+ moveProjectile,
147
+ moveWizard,
148
+ narrowRange,
149
+ nextRandom,
150
+ normalize,
151
+ normalizeAngle,
152
+ predictPosition,
153
+ resetAllHooks,
154
+ resolveWizardCollision,
155
+ runBotWithContext,
156
+ runWithHooks,
157
+ scoreFight,
158
+ scoreFightAsWizard2,
159
+ seekerMissile,
160
+ setParamValues,
161
+ shield,
162
+ simulate,
163
+ sortByDistance,
164
+ spiralMissile,
165
+ startCast,
166
+ startDiscovery,
167
+ stopDiscovery,
168
+ straightMissile,
169
+ summarizeTrace,
170
+ sweptCircleCollision,
171
+ testBot,
172
+ tick,
173
+ updateShield,
174
+ useArenaSize,
175
+ useBlinkCooldown,
176
+ useCastProgress,
177
+ useCastingSpell,
178
+ useClosestThreat,
179
+ useDamageDealt,
180
+ useDamageTaken,
181
+ useEffect,
182
+ useEnemy,
183
+ useHealth,
184
+ useLastHitTick,
185
+ useMemo,
186
+ useMyProjectiles,
187
+ useMyThreatsToEnemy,
188
+ useParam,
189
+ usePosition,
190
+ useRef,
191
+ useShieldStrength,
192
+ useState,
193
+ useStatus,
194
+ useThreats,
195
+ useTick,
196
+ useTicksUntilReady,
197
+ useVelocity,
198
+ validateHookCall,
199
+ validateMissileConfig,
200
+ withBotContext,
201
+ wrapNewBot,
202
+ wrapWithParams
203
+ } from "./chunk-L7Z7OFXD.js";
204
+ export {
205
+ ALL_BOTS,
206
+ ARENA_HEIGHT,
207
+ ARENA_SIZE,
208
+ ARENA_WATER_BUFFER,
209
+ ARENA_WIDTH,
210
+ Archlich,
211
+ Archmage,
212
+ BLINK_CAST_TIME,
213
+ BLINK_COOLDOWN,
214
+ BLINK_MAX_COOLDOWN,
215
+ BLINK_MAX_RANGE,
216
+ BLINK_MIN_COOLDOWN,
217
+ BLINK_RANGE,
218
+ BOT_GROUPS,
219
+ Battlemage,
220
+ Bonemancer,
221
+ BrowserManualMatchSandbox,
222
+ BrowserMatchSandbox,
223
+ CASTING_MOVEMENT_MULT,
224
+ COLLISION_RADIUS,
225
+ Critter,
226
+ Doombringer,
227
+ ENGINE_VERSION,
228
+ FIGHT_SPAWN_DISTANCES,
229
+ Flamecaller,
230
+ GCD_DURATION,
231
+ Golem,
232
+ Hogger,
233
+ Infernalist,
234
+ Lich,
235
+ MATCH_DURATION,
236
+ MAX_HEALTH,
237
+ MISSILE_BASE_CAST,
238
+ MISSILE_BASE_RADIUS,
239
+ MISSILE_DAMAGE_POWER,
240
+ MISSILE_DAMAGE_RADIUS_SCALE,
241
+ MISSILE_DAMAGE_SCALE,
242
+ MISSILE_HOMING_COEFF,
243
+ MISSILE_MIN_CAST_TIME,
244
+ MISSILE_MIN_DAMAGE,
245
+ MISSILE_MIN_DURATION,
246
+ MISSILE_MIN_SPEED,
247
+ MISSILE_RADIUS_PER_DAMAGE,
248
+ MISSILE_SPEED_DURATION_BASELINE,
249
+ MISSILE_SPEED_DURATION_COEFF,
250
+ MISSILE_TURN_DURATION_COEFF,
251
+ MOVEMENT_SPEED,
252
+ MOVE_SPEED,
253
+ ManualMatch,
254
+ Nightblade,
255
+ Pyromancer,
256
+ Rookie,
257
+ SHIELD_CAST_TIME,
258
+ SHIELD_DECAY_PER_SECOND,
259
+ SHIELD_DECAY_RATE,
260
+ SHIELD_MAX_BLOCK,
261
+ SHIELD_MAX_STRENGTH,
262
+ SHIELD_MIN_BLOCK,
263
+ SHIELD_MIN_STRENGTH,
264
+ SPAWN_DISTANCE,
265
+ Sentinel,
266
+ Shadowblade,
267
+ Spellbinder,
268
+ Spellseeker,
269
+ Spellshot,
270
+ Spellspinner,
271
+ Spelltracer,
272
+ Spellweaver,
273
+ Stormcaller,
274
+ Stormchaser,
275
+ Stormforger,
276
+ TICKS_PER_SECOND,
277
+ TICK_DURATION_MS,
278
+ TargetDummy,
279
+ Turtle,
280
+ Voidblade,
281
+ WARMUP_DURATION_TOLERANCE,
282
+ WARMUP_MAX_BONUS,
283
+ WARMUP_MAX_PENALTY,
284
+ WARMUP_SPEED_TOLERANCE,
285
+ WARMUP_TURN_TOLERANCE,
286
+ WIZARD_HEALTH,
287
+ WIZARD_RADIUS,
288
+ Warmage,
289
+ analyzeThreats,
290
+ angleDiff,
291
+ angleInRange,
292
+ angleTo,
293
+ antiHomingMissile,
294
+ applyDamage,
295
+ blink,
296
+ browserSandboxFight,
297
+ browserSandboxSimulate,
298
+ calculateBlinkCooldown,
299
+ calculateMissileCastTime,
300
+ calculateMissileRadius,
301
+ calculateMissileSimilarity,
302
+ calculateShieldBlock,
303
+ calculateWarmupMultiplier,
304
+ cancel,
305
+ cancelCast,
306
+ clampPositionToArena,
307
+ clampToArena,
308
+ clearHooks,
309
+ clearParamValues,
310
+ completeCast,
311
+ createEntitySeed,
312
+ createInitialState,
313
+ createRandom,
314
+ createWorkerScript,
315
+ diagnoseTrace,
316
+ directionAway,
317
+ directionTo,
318
+ distanceTo,
319
+ effectiveTurnRateCost,
320
+ extractAction,
321
+ extractStats,
322
+ extractTraceEvents,
323
+ fight,
324
+ findInRange,
325
+ findNearest,
326
+ fitMissileToBudget,
327
+ formatDiagnosis,
328
+ formatStats,
329
+ formatTraceEvents,
330
+ formatTraceSummary,
331
+ generateCandidates,
332
+ generateCombos,
333
+ getAdaptiveMissileConfig,
334
+ getBotContext,
335
+ getEffectiveRange,
336
+ getLeadPosition,
337
+ getMissileCastTime,
338
+ getPlayerState,
339
+ hashCombine,
340
+ homingMissile,
341
+ idle,
342
+ inRange,
343
+ interceptAngle,
344
+ isNewStyleBot,
345
+ magnitude,
346
+ missile,
347
+ move,
348
+ moveInDirection,
349
+ moveProjectile,
350
+ moveWizard,
351
+ narrowRange,
352
+ nextRandom,
353
+ normalize,
354
+ normalizeAngle,
355
+ predictPosition,
356
+ resetAllHooks,
357
+ resolveWizardCollision,
358
+ runBotWithContext,
359
+ runWithHooks,
360
+ scoreFight,
361
+ scoreFightAsWizard2,
362
+ seekerMissile,
363
+ setParamValues,
364
+ shield,
365
+ simulate,
366
+ sortByDistance,
367
+ spiralMissile,
368
+ startCast,
369
+ startDiscovery,
370
+ stopDiscovery,
371
+ straightMissile,
372
+ summarizeTrace,
373
+ sweptCircleCollision,
374
+ testBot,
375
+ tick,
376
+ updateShield,
377
+ useArenaSize,
378
+ useBlinkCooldown,
379
+ useCastProgress,
380
+ useCastingSpell,
381
+ useClosestThreat,
382
+ useDamageDealt,
383
+ useDamageTaken,
384
+ useEffect,
385
+ useEnemy,
386
+ useHealth,
387
+ useLastHitTick,
388
+ useMemo,
389
+ useMyProjectiles,
390
+ useMyThreatsToEnemy,
391
+ useParam,
392
+ usePosition,
393
+ useRef,
394
+ useShieldStrength,
395
+ useState,
396
+ useStatus,
397
+ useThreats,
398
+ useTick,
399
+ useTicksUntilReady,
400
+ useVelocity,
401
+ validateHookCall,
402
+ validateMissileConfig,
403
+ withBotContext,
404
+ wrapNewBot,
405
+ wrapWithParams
406
+ };
407
+ //# sourceMappingURL=index-browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,150 @@
1
+ import { FightResult, SimulateResult } from './index-browser.js';
2
+ export { ALL_BOTS, ARENA_HEIGHT, ARENA_SIZE, ARENA_WATER_BUFFER, ARENA_WIDTH, ActionBuilder, AnalyzedThreat, AntiHomingParams, Archlich, Archmage, BLINK_CAST_TIME, BLINK_COOLDOWN, BLINK_MAX_COOLDOWN, BLINK_MAX_RANGE, BLINK_MIN_COOLDOWN, BLINK_RANGE, BOT_GROUPS, Battlemage, Bonemancer, BotContext, BotEntry, BotError, BotFunction, BotGroup, BrowserManualMatchSandbox, BrowserMatchSandbox, BrowserSandboxOptions, CASTING_MOVEMENT_MULT, COLLISION_RADIUS, Critter, Doombringer, ENGINE_VERSION, EnemyState, FIGHT_SPAWN_DISTANCES, FightStats, FightWinner, FinalAction, Flamecaller, GCD_DURATION, GameConfig, GameState, Golem, Hogger, HomingParams, HookState, Infernalist, InternalWizardState, Lich, MATCH_DURATION, MAX_HEALTH, MISSILE_BASE_CAST, MISSILE_BASE_RADIUS, MISSILE_DAMAGE_POWER, MISSILE_DAMAGE_RADIUS_SCALE, MISSILE_DAMAGE_SCALE, MISSILE_HOMING_COEFF, MISSILE_MIN_CAST_TIME, MISSILE_MIN_DAMAGE, MISSILE_MIN_DURATION, MISSILE_MIN_SPEED, MISSILE_RADIUS_PER_DAMAGE, MISSILE_SPEED_DURATION_BASELINE, MISSILE_SPEED_DURATION_COEFF, MISSILE_TURN_DURATION_COEFF, MOVEMENT_SPEED, MOVE_SPEED, ManualMatch, ManualMatchInitOptions, ManualMatchOptions, ManualMatchStepRequest, MatchWinner, MissileAIFunction, MissileActions, MissileConfig, MissileTemplate, Nightblade, ParamDeclaration, Position, ProjectileState, Pyromancer, RefObject, Rookie, SHIELD_CAST_TIME, SHIELD_DECAY_PER_SECOND, SHIELD_DECAY_RATE, SHIELD_MAX_BLOCK, SHIELD_MAX_STRENGTH, SHIELD_MIN_BLOCK, SHIELD_MIN_STRENGTH, SPAWN_DISTANCE, SeekerParams, Sentinel, Shadowblade, Spellbinder, Spellseeker, Spellshot, Spellspinner, Spelltracer, Spellweaver, SpiralParams, StepResult, Stormcaller, Stormchaser, Stormforger, StraightParams, TICKS_PER_SECOND, TICK_DURATION_MS, TargetDummy, TestBotBuilder, TestFightResult, TestSimulateResult, TraceBotSummary, TraceEvent, TraceEventType, TraceSummary, Turtle, Velocity, Voidblade, WARMUP_DURATION_TOLERANCE, WARMUP_MAX_BONUS, WARMUP_MAX_PENALTY, WARMUP_SPEED_TOLERANCE, WARMUP_TURN_TOLERANCE, WIZARD_HEALTH, WIZARD_RADIUS, Warmage, WizardActions, WizardFunction, WizardState, WorkerFactory, WorkerLike, analyzeThreats, angleDiff, angleInRange, angleTo, antiHomingMissile, applyDamage, blink, browserSandboxFight, browserSandboxSimulate, calculateBlinkCooldown, calculateMissileCastTime, calculateMissileRadius, calculateMissileSimilarity, calculateShieldBlock, calculateWarmupMultiplier, cancel, cancelCast, clampPositionToArena, clampToArena, clearHooks, clearParamValues, completeCast, createEntitySeed, createInitialState, createRandom, createWorkerScript, diagnoseTrace, directionAway, directionTo, distanceTo, effectiveTurnRateCost, extractAction, extractStats, extractTraceEvents, fight, findInRange, findNearest, fitMissileToBudget, formatDiagnosis, formatStats, formatTraceEvents, formatTraceSummary, generateCandidates, generateCombos, getAdaptiveMissileConfig, getBotContext, getEffectiveRange, getLeadPosition, getMissileCastTime, getPlayerState, hashCombine, homingMissile, idle, inRange, interceptAngle, isNewStyleBot, magnitude, missile, move, moveInDirection, moveProjectile, moveWizard, narrowRange, nextRandom, normalize, normalizeAngle, predictPosition, resetAllHooks, resolveWizardCollision, runBotWithContext, runWithHooks, scoreFight, scoreFightAsWizard2, seekerMissile, setParamValues, shield, simulate, sortByDistance, spiralMissile, startCast, startDiscovery, stopDiscovery, straightMissile, summarizeTrace, sweptCircleCollision, testBot, tick, updateShield, useArenaSize, useBlinkCooldown, useCastProgress, useCastingSpell, useClosestThreat, useDamageDealt, useDamageTaken, useEffect, useEnemy, useHealth, useLastHitTick, useMemo, useMyProjectiles, useMyThreatsToEnemy, useParam, usePosition, useRef, useShieldStrength, useState, useStatus, useThreats, useTick, useTicksUntilReady, useVelocity, validateHookCall, validateMissileConfig, withBotContext, wrapNewBot, wrapWithParams } from './index-browser.js';
3
+
4
+ /**
5
+ * A compiled bot ready for sandboxed execution.
6
+ * Stores the source path and export name — actual compilation
7
+ * happens when creating a MatchSandbox or calling compileMatchBundle.
8
+ */
9
+ declare class BotBundle {
10
+ readonly sourcePath: string;
11
+ readonly exportName: string;
12
+ constructor(sourcePath: string, exportName: string);
13
+ }
14
+ /**
15
+ * Options for esbuild compilation. Allows the caller to add esbuild
16
+ * aliases (e.g., resolving @vibemancer/core to the TypeScript source).
17
+ */
18
+ interface CompileOptions {
19
+ /** Additional esbuild alias entries (e.g., {'@vibemancer/core': '/path/to/src/index.ts'}). */
20
+ alias?: Record<string, string>;
21
+ /** Additional modules to treat as external (not bundled). */
22
+ external?: string[];
23
+ }
24
+ /**
25
+ * Compile a match bundle using esbuild. Bundles both bots + simulation engine
26
+ * into a single self-contained IIFE with prototype freezing banner.
27
+ *
28
+ * No isolated-vm dependency — returns a plain JS string.
29
+ */
30
+ declare function compileMatchBundle(bot1: BotBundle, bot2: BotBundle, options?: CompileOptions): Promise<string>;
31
+
32
+ /**
33
+ * VIBEMANCER — SANDBOX
34
+ *
35
+ * Provides isolated-vm sandboxing for bot code execution. Both bots + the
36
+ * entire simulation engine run inside a single V8 isolate, so there is ZERO
37
+ * per-tick boundary crossing overhead. The only data crossing the boundary
38
+ * is fight/simulate options going in and results coming out.
39
+ *
40
+ * Architecture:
41
+ * - Host: creates isolate, loads compiled bundle, calls __fight/__simulate
42
+ * - Isolate: contains both bots + full simulation engine, runs fight/simulate
43
+ *
44
+ * Safety:
45
+ * - Memory limit (default 512 MB) catches memory bombs
46
+ * - Timeout (default 30s) catches infinite loops
47
+ * - Prototype freeze prevents cross-bot sabotage
48
+ * - platform: 'neutral' strips Node.js APIs (no fs/net/process)
49
+ */
50
+
51
+ /**
52
+ * Options for sandbox creation.
53
+ */
54
+ interface SandboxOptions {
55
+ /** Memory limit in MB for the isolate (default: 512). */
56
+ memoryLimitMB?: number;
57
+ /** Timeout in ms for fight/simulate calls (default: 30000). */
58
+ timeoutMs?: number;
59
+ /** Options passed to esbuild compilation (aliases, externals). */
60
+ compileOptions?: CompileOptions;
61
+ }
62
+ /**
63
+ * A sandboxed match runner. Both bots + the entire simulation engine run
64
+ * inside a single isolated-vm isolate.
65
+ *
66
+ * Usage:
67
+ * ```ts
68
+ * const sandbox = await MatchSandbox.create(botA, botB);
69
+ * const result = sandbox.fight({ seed: 42 });
70
+ * sandbox.dispose();
71
+ * ```
72
+ */
73
+ declare class MatchSandbox {
74
+ private isolate;
75
+ private context;
76
+ private fightFn;
77
+ private simulateFn;
78
+ private timeout;
79
+ private disposed;
80
+ private constructor();
81
+ /**
82
+ * Create a sandbox with both bots loaded. Compiles the match bundle
83
+ * automatically using esbuild.
84
+ */
85
+ static create(bot1: BotBundle, bot2: BotBundle, options?: SandboxOptions): Promise<MatchSandbox>;
86
+ /**
87
+ * Create a sandbox from a pre-compiled bundle string.
88
+ * Useful for caching compiled bundles across multiple MatchSandbox instances.
89
+ */
90
+ static fromBundle(bundle: string, options?: SandboxOptions): Promise<MatchSandbox>;
91
+ /**
92
+ * Compile a match bundle without creating an isolate.
93
+ * Returns the compiled JS string for caching/reuse.
94
+ */
95
+ static compile(bot1: BotBundle, bot2: BotBundle, compileOptions?: CompileOptions): Promise<string>;
96
+ /**
97
+ * Run a full fight (10 matches: 5 spawn distances x 2 sides).
98
+ * Synchronous after isolate creation — runs entirely inside the isolate.
99
+ */
100
+ fight(options?: {
101
+ seed?: number;
102
+ maxTicks?: number;
103
+ }): FightResult;
104
+ /**
105
+ * Run a single simulation.
106
+ * Synchronous after isolate creation.
107
+ *
108
+ * @param options.params1 - useParam overrides for bot 1 (wizard-1)
109
+ * @param options.params2 - useParam overrides for bot 2 (wizard-2)
110
+ */
111
+ simulate(options?: {
112
+ seed?: number;
113
+ maxTicks?: number;
114
+ spawnDistance?: number;
115
+ skipHistory?: boolean;
116
+ params1?: Record<string, number>;
117
+ params2?: Record<string, number>;
118
+ }): SimulateResult;
119
+ /**
120
+ * Dispose the isolate and free all memory.
121
+ * The sandbox cannot be used after disposal.
122
+ */
123
+ dispose(): void;
124
+ /**
125
+ * Whether this sandbox has been disposed.
126
+ */
127
+ get isDisposed(): boolean;
128
+ private ensureNotDisposed;
129
+ }
130
+ /**
131
+ * One-shot sandboxed fight. Creates isolate, runs fight, disposes.
132
+ * Convenience wrapper for single-use scenarios.
133
+ */
134
+ declare function sandboxFight(bot1: BotBundle, bot2: BotBundle, options?: {
135
+ seed?: number;
136
+ maxTicks?: number;
137
+ } & SandboxOptions): Promise<FightResult>;
138
+ /**
139
+ * One-shot sandboxed simulate. Creates isolate, runs simulate, disposes.
140
+ */
141
+ declare function sandboxSimulate(bot1: BotBundle, bot2: BotBundle, options?: {
142
+ seed?: number;
143
+ maxTicks?: number;
144
+ spawnDistance?: number;
145
+ skipHistory?: boolean;
146
+ params1?: Record<string, number>;
147
+ params2?: Record<string, number>;
148
+ } & SandboxOptions): Promise<SimulateResult>;
149
+
150
+ export { BotBundle, type CompileOptions, FightResult, MatchSandbox, type SandboxOptions, SimulateResult, compileMatchBundle, sandboxFight, sandboxSimulate };