@casual-simulation/aux-runtime 3.2.7-alpha.6226622763

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 (70) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +82 -0
  3. package/index.d.ts +26 -0
  4. package/index.js +26 -0
  5. package/index.js.map +1 -0
  6. package/package.json +79 -0
  7. package/runtime/AuxCompiler.d.ts +258 -0
  8. package/runtime/AuxCompiler.js +722 -0
  9. package/runtime/AuxCompiler.js.map +1 -0
  10. package/runtime/AuxDevice.d.ts +28 -0
  11. package/runtime/AuxDevice.js +2 -0
  12. package/runtime/AuxDevice.js.map +1 -0
  13. package/runtime/AuxGlobalContext.d.ts +572 -0
  14. package/runtime/AuxGlobalContext.js +606 -0
  15. package/runtime/AuxGlobalContext.js.map +1 -0
  16. package/runtime/AuxLibrary.d.ts +2566 -0
  17. package/runtime/AuxLibrary.js +10210 -0
  18. package/runtime/AuxLibrary.js.map +1 -0
  19. package/runtime/AuxLibraryDefinitions.def +12288 -0
  20. package/runtime/AuxPartitionRealtimeEditModeProvider.d.ts +9 -0
  21. package/runtime/AuxPartitionRealtimeEditModeProvider.js +21 -0
  22. package/runtime/AuxPartitionRealtimeEditModeProvider.js.map +1 -0
  23. package/runtime/AuxRealtimeEditModeProvider.d.ts +35 -0
  24. package/runtime/AuxRealtimeEditModeProvider.js +34 -0
  25. package/runtime/AuxRealtimeEditModeProvider.js.map +1 -0
  26. package/runtime/AuxResults.d.ts +77 -0
  27. package/runtime/AuxResults.js +6 -0
  28. package/runtime/AuxResults.js.map +1 -0
  29. package/runtime/AuxRuntime.d.ts +252 -0
  30. package/runtime/AuxRuntime.js +2688 -0
  31. package/runtime/AuxRuntime.js.map +1 -0
  32. package/runtime/AuxRuntimeDynamicImports.d.ts +14 -0
  33. package/runtime/AuxRuntimeDynamicImports.js +24 -0
  34. package/runtime/AuxRuntimeDynamicImports.js.map +1 -0
  35. package/runtime/AuxVersion.d.ts +39 -0
  36. package/runtime/AuxVersion.js +2 -0
  37. package/runtime/AuxVersion.js.map +1 -0
  38. package/runtime/CasualOSError.d.ts +37 -0
  39. package/runtime/CasualOSError.js +25 -0
  40. package/runtime/CasualOSError.js.map +1 -0
  41. package/runtime/CompiledBot.d.ts +107 -0
  42. package/runtime/CompiledBot.js +44 -0
  43. package/runtime/CompiledBot.js.map +1 -0
  44. package/runtime/PerformanceNowPolyfill.d.ts +1 -0
  45. package/runtime/PerformanceNowPolyfill.js +8 -0
  46. package/runtime/PerformanceNowPolyfill.js.map +1 -0
  47. package/runtime/RecordsEvents.d.ts +1025 -0
  48. package/runtime/RecordsEvents.js +449 -0
  49. package/runtime/RecordsEvents.js.map +1 -0
  50. package/runtime/RuntimeBot.d.ts +177 -0
  51. package/runtime/RuntimeBot.js +732 -0
  52. package/runtime/RuntimeBot.js.map +1 -0
  53. package/runtime/RuntimeEvents.d.ts +126 -0
  54. package/runtime/RuntimeEvents.js +29 -0
  55. package/runtime/RuntimeEvents.js.map +1 -0
  56. package/runtime/RuntimeStateVersion.d.ts +23 -0
  57. package/runtime/RuntimeStateVersion.js +22 -0
  58. package/runtime/RuntimeStateVersion.js.map +1 -0
  59. package/runtime/Transpiler.d.ts +174 -0
  60. package/runtime/Transpiler.js +611 -0
  61. package/runtime/Transpiler.js.map +1 -0
  62. package/runtime/Utils.d.ts +44 -0
  63. package/runtime/Utils.js +253 -0
  64. package/runtime/Utils.js.map +1 -0
  65. package/runtime/index.d.ts +13 -0
  66. package/runtime/index.js +13 -0
  67. package/runtime/index.js.map +1 -0
  68. package/runtime/test/TestScriptBotFactory.d.ts +16 -0
  69. package/runtime/test/TestScriptBotFactory.js +107 -0
  70. package/runtime/test/TestScriptBotFactory.js.map +1 -0
@@ -0,0 +1,2566 @@
1
+ import { AuxGlobalContext, DEBUG_STRING } from './AuxGlobalContext';
2
+ import { BotTags, Bot, ShowChatOptions, BotAction, BotsState, CameraType, BarcodeFormat, PortalType, ShowInputOptions, LocalFormAnimationAction, ShareOptions, Easing, BotAnchorPoint, RuntimeBot, BotSpace, EaseType, RegisterPrefixOptions, OpenCircleWipeOptions, SuperShoutAction, ShowToastAction, ShowJoinCodeAction, RequestFullscreenAction, ExitFullscreenAction, ShowHtmlAction, HideHtmlAction, SetClipboardAction, FocusOnBotAction, ShowChatBarAction, EnableARAction, EnableVRAction, DownloadAction, ShowUploadAuxFileAction, OpenQRCodeScannerAction, ShowQRCodeAction, OpenBarcodeScannerAction, ShowBarcodeAction, LoadServerAction, UnloadServerAction, ReplaceDragBotAction, ShowInputForTagAction, GoToDimensionAction, GoToURLAction, OpenURLAction, OpenConsoleAction, RejectAction, FocusOnOptions, SnapTarget, AddDropSnapTargetsAction, RecordingOptions, Recording, SyntheticVoice, EnablePOVAction, EnableCustomDraggingAction, SetAppOutputAction, Record, RecordReference, PartialBotsState, ParsedBotLink, ConvertGeolocationToWhat3WordsOptions, BeginAudioRecordingAction, MediaPermssionOptions, ImageClassifierOptions, AddDropGridTargetsAction, InstUpdate, StartFormAnimationOptions, StopFormAnimationOptions, FormAnimationData, WakeLockConfiguration, EnableXROptions, ShowConfirmOptions, Geolocation, OpenPhotoCameraOptions, Photo } from '@casual-simulation/aux-common/bots';
3
+ import { AIChatOptions, AIGenerateSkyboxOptions, AIGenerateImageOptions, JoinRoomActionOptions, RoomOptions, RoomTrackOptions, SetRoomTrackOptions, RoomRemoteOptions, DataRecordOptions, RecordActionOptions } from './RecordsEvents';
4
+ import { RemoteAction } from '@casual-simulation/aux-common';
5
+ import '@casual-simulation/aux-common/polyfill/Array.first.polyfill';
6
+ import '@casual-simulation/aux-common/polyfill/Array.last.polyfill';
7
+ import { isAsymmetricKeypair, isAsymmetricEncrypted, isEncrypted } from '@casual-simulation/crypto';
8
+ import './PerformanceNowPolyfill';
9
+ import '@casual-simulation/aux-common/BlobPolyfill';
10
+ import { AuxDevice } from './AuxDevice';
11
+ import { AuxVersion } from './AuxVersion';
12
+ import { Vector3, Vector2, Quaternion, Rotation } from '@casual-simulation/aux-common/math';
13
+ import { CreatePublicRecordKeyResult, GetDataResult, RecordDataResult, RecordFileFailure, EraseDataResult, EraseFileResult, ListDataResult, AddCountResult, GetCountResult, GrantMarkerPermissionResult, RevokeMarkerPermissionResult, GrantRoleResult, RevokeRoleResult } from '@casual-simulation/aux-records';
14
+ import type { AIChatMessage, AvailablePermissions, ListStudiosResult } from '@casual-simulation/aux-records';
15
+ import { DateTime } from 'luxon';
16
+ import * as hooks from 'preact/hooks';
17
+ import { render } from 'preact';
18
+ import type { Breakpoint, InterpreterContinuation, InterpreterStop } from '@casual-simulation/js-interpreter';
19
+ import { INTERPRETABLE_FUNCTION } from './AuxCompiler';
20
+ import type { AuxRuntime } from './AuxRuntime';
21
+ import { TagMapper } from './RuntimeEvents';
22
+ /**
23
+ * Defines an interface for a function that provides HTML VDOM capabilities to bots.
24
+ */
25
+ export interface HtmlFunction {
26
+ (...args: any[]): any;
27
+ h: (name: string | Function, props: any, ...children: any[]) => any;
28
+ f: any;
29
+ }
30
+ /**
31
+ * Creates a new interpretable function based on the given function.
32
+ * @param interpretableFunc
33
+ */
34
+ export declare function createInterpretableFunction<TArg extends Array<any>, R>(interpretableFunc: (...args: TArg) => Generator<any, R, any>): {
35
+ (...args: TArg): R;
36
+ [INTERPRETABLE_FUNCTION]: (...args: TArg) => Generator<any, R, any>;
37
+ };
38
+ /**
39
+ * Sets the INTERPRETABLE_FUNCTION property on the given object (semantically a function) to the given interpretable version and returns the object.
40
+ * @param interpretableFunc The version of the function that should be used as the interpretable version of the function.
41
+ * @param normalFunc The function that should be tagged.
42
+ */
43
+ export declare function tagAsInterpretableFunction<T, N>(interpretableFunc: T, normalFunc: N): N & {
44
+ [INTERPRETABLE_FUNCTION]: T;
45
+ };
46
+ /**
47
+ * Defines an interface for a library of functions and values that can be used by formulas and listeners.
48
+ */
49
+ export interface AuxLibrary {
50
+ /**
51
+ * The functions that are part of the general API.
52
+ */
53
+ api: {
54
+ whisper(bot: (Bot | string)[] | Bot | string, eventName: string, arg?: any): any[];
55
+ shout(name: string, arg?: any): any[];
56
+ __energyCheck(): void;
57
+ [key: string]: any;
58
+ };
59
+ /**
60
+ * The functions that are part of the bot-specific API.
61
+ */
62
+ tagSpecificApi: {
63
+ [key: string]: (options: TagSpecificApiOptions) => any;
64
+ };
65
+ typeDefinitions?: string;
66
+ }
67
+ /**
68
+ * Defines the possible values that can be used as a tag filter.
69
+ *
70
+ * @dochash types/core
71
+ * @docgroup 01-core
72
+ * @docname TagFilter
73
+ */
74
+ export type TagFilter = ((value: any) => boolean) | string | number | boolean | null | undefined;
75
+ /**
76
+ * Defines a type that represents a mod.
77
+ * That is, a set of tags that can be applied to another bot.
78
+ *
79
+ * @dochash types/core
80
+ * @docgroup 01-core
81
+ * @docname Mod
82
+ */
83
+ export type Mod = BotTags | Bot;
84
+ /**
85
+ * An interface that is used to say which user/device/session an event should be sent to.
86
+ */
87
+ export interface SessionSelector {
88
+ userId?: string;
89
+ sessionId?: string;
90
+ connectionId?: string;
91
+ broadcast?: boolean;
92
+ }
93
+ /**
94
+ * Defines a set of options for a webhook.
95
+ *
96
+ * @dochash types/web
97
+ * @doctitle Web Types
98
+ * @docsidebar Web
99
+ * @docdescription These types are used for web requests.
100
+ * @docname WebhookOptions
101
+ */
102
+ export interface WebhookOptions {
103
+ /**
104
+ * The HTTP Method that the request should use.
105
+ */
106
+ method?: string;
107
+ /**
108
+ * The URL that the request should be made to.
109
+ */
110
+ url?: string;
111
+ /**
112
+ * The headers to include in the request.
113
+ *
114
+ * @docsource Headers
115
+ */
116
+ headers?: {
117
+ [key: string]: string;
118
+ };
119
+ /**
120
+ * The data to send with the request.
121
+ */
122
+ data?: any;
123
+ /**
124
+ * The shout that should be made when the request finishes.
125
+ */
126
+ responseShout?: string;
127
+ /**
128
+ * The number of retries that should be attempted for the webhook.
129
+ */
130
+ retryCount?: number;
131
+ /**
132
+ * The HTTP response status codes that should allow the web request to be retried.
133
+ */
134
+ retryStatusCodes?: number[];
135
+ /**
136
+ * The number of miliseconds to wait between retry requests.
137
+ */
138
+ retryAfterMs?: number;
139
+ }
140
+ /**
141
+ * Defines an interface that represents a request for {@link ai.generateSkybox-request}.
142
+ *
143
+ * @dochash types/ai
144
+ * @docname AIGenerateSkyboxRequest
145
+ */
146
+ export interface AIGenerateSkyboxRequest {
147
+ /**
148
+ * The prompt that describes what the generated skybox should look like.
149
+ */
150
+ prompt: string;
151
+ /**
152
+ * The prompt that that describes what the generated skybox should avoid looking like.
153
+ */
154
+ negativePrompt?: string;
155
+ /**
156
+ * The options that should be included in the request.
157
+ */
158
+ options?: AIGenerateSkyboxOptions;
159
+ }
160
+ /**
161
+ * Defines an interface that represents the result from {@link ai.generateSkybox-request}.
162
+ *
163
+ * @dochash types/ai
164
+ * @docname AIGenerateSkyboxResult
165
+ */
166
+ export interface AIGenerateSkyboxResult {
167
+ /**
168
+ * The URL that the generated skybox is located at.
169
+ */
170
+ fileUrl: string;
171
+ /**
172
+ * The URL that the thumbnail for the generated skybox is located at.
173
+ */
174
+ thumbnailUrl?: string;
175
+ }
176
+ /**
177
+ * Defines an interface that represents a result from {@link ai.generateImage-request}.
178
+ * @dochash types/ai
179
+ * @docname AIGenerateImageSuccess
180
+ */
181
+ export interface AIGenerateImageAPISuccess {
182
+ success: true;
183
+ /**
184
+ * The list of images that were generated.
185
+ */
186
+ images: AIGeneratedImageAPI[];
187
+ }
188
+ /**
189
+ * Defines an interface that represents an AI generated image.
190
+ *
191
+ * @dochash types/ai
192
+ * @docname AIGeneratedImage
193
+ */
194
+ export interface AIGeneratedImageAPI {
195
+ /**
196
+ * The base64 encoded image.
197
+ */
198
+ base64: string;
199
+ /**
200
+ * The URL that can be used to display the image.
201
+ */
202
+ url: string;
203
+ /**
204
+ * The seed of the generated image.
205
+ */
206
+ seed?: number;
207
+ /**
208
+ * The MIME Type of the image data.
209
+ */
210
+ mimeType: string;
211
+ }
212
+ /**
213
+ * Defines a set of options for {@link animateTag-byTag}.
214
+ *
215
+ * @dochash types/animation
216
+ * @doctitle Animation Types
217
+ * @docsidebar Animation
218
+ * @docdescription These types are used for animating tags.
219
+ * @docname AnimateTagOptions
220
+ */
221
+ export interface AnimateTagFunctionOptions {
222
+ /**
223
+ * The value that should be animated from.
224
+ * If not specified then the current tag value will be used.
225
+ */
226
+ fromValue?: any;
227
+ /**
228
+ * The value that should be animated to.
229
+ */
230
+ toValue: any;
231
+ /**
232
+ * The duration of the animation in seconds.
233
+ */
234
+ duration: number;
235
+ /**
236
+ * The time that the animation should start.
237
+ * Should be the number of miliseconds since January 1st 1970 UTC-0. (e.g. os.localTime or os.agreedUponTime).
238
+ */
239
+ startTime?: number;
240
+ /**
241
+ * The type of easing to use.
242
+ * If not specified then "linear" "inout" will be used.
243
+ *
244
+ * Can also be a custom function that takes a single parameter and returns a number.
245
+ * The paramater will be a number between 0 and 1 indicating the progress through the tween.
246
+ */
247
+ easing?: EaseType | Easing | ((progress: number) => number);
248
+ /**
249
+ * The space that the tag should be animated in.
250
+ * If not specified then "tempLocal" will be used.
251
+ * If false, then the bot will be edited instead of using tag masks.
252
+ */
253
+ tagMaskSpace?: BotSpace | false;
254
+ }
255
+ /**
256
+ * Defines a bot filter function.
257
+ *
258
+ * Common bot filters are {@link byTag}
259
+ *
260
+ * @dochash types/core
261
+ * @docgroup 01-core
262
+ * @docname BotFilter
263
+ */
264
+ export type BotFilter = ((bot: Bot) => boolean) | null;
265
+ /**
266
+ * Defines a bot filter function.
267
+ */
268
+ export interface BotFilterFunction {
269
+ (bot: Bot): boolean;
270
+ sort?: (bot: Bot) => any;
271
+ [DEBUG_STRING]?: string;
272
+ }
273
+ export interface RecordFilter {
274
+ recordFilter: true;
275
+ [DEBUG_STRING]?: string;
276
+ }
277
+ export interface AuthIdRecordFilter extends RecordFilter {
278
+ authID: string;
279
+ }
280
+ export interface SpaceFilter extends BotFilterFunction, RecordFilter {
281
+ space: string;
282
+ toJSON: () => RecordFilter;
283
+ }
284
+ export interface AddressRecordFilter extends RecordFilter {
285
+ address: string;
286
+ }
287
+ export interface IDRecordFilter extends BotFilterFunction, RecordFilter {
288
+ id: string;
289
+ toJSON: () => RecordFilter;
290
+ }
291
+ export type RecordFilters = AuthIdRecordFilter | SpaceFilter | AddressRecordFilter | IDRecordFilter | RecordReference;
292
+ /**
293
+ * Defines the options for {@link experiment.speakText}.
294
+ *
295
+ * @dochash types/experimental
296
+ * @docname SpeakTextOptions
297
+ */
298
+ export interface SpeakTextApiOptions {
299
+ /**
300
+ * The rate that the text should be spoken at.
301
+ * This can be any positive number.
302
+ */
303
+ rate?: number;
304
+ /**
305
+ * The pitch that the text should be spoken at.
306
+ * This can be any positive number.
307
+ */
308
+ pitch?: number;
309
+ /**
310
+ * The voice that the text should be spoken with.
311
+ * This can be the voice object or the name of a voice.
312
+ * Note that not all browsers support the same voices.
313
+ */
314
+ voice?: string | SyntheticVoice;
315
+ }
316
+ /**
317
+ * Defines a set of options for a tween.
318
+ *
319
+ * @dochash types/experimental
320
+ * @docname TweenOptions
321
+ */
322
+ export interface TweenOptions {
323
+ /**
324
+ * The easing for the tween.
325
+ */
326
+ easing?: Easing;
327
+ /**
328
+ * The duration of the tween in seconds.
329
+ */
330
+ duration?: number;
331
+ }
332
+ /**
333
+ * Defines an interface that contains performance statistics about a inst.
334
+ */
335
+ export interface PerformanceStats {
336
+ /**
337
+ * The number of bots in the inst.
338
+ */
339
+ numberOfBots: number;
340
+ /**
341
+ * A list of listen tags and the amount of time spent executing them (in miliseconds).
342
+ * Useful to guage if a listen tag is causing the inst to slow down.
343
+ */
344
+ shoutTimes: {
345
+ tag: string;
346
+ timeMs: number;
347
+ }[];
348
+ /**
349
+ * The total number of active setTimeout() and setInterval() timers that are active.
350
+ */
351
+ numberOfActiveTimers: number;
352
+ loadTimes: {
353
+ [key: string]: number;
354
+ };
355
+ }
356
+ /**
357
+ * Options needed for the Bot-specific API.
358
+ */
359
+ export interface TagSpecificApiOptions {
360
+ /**
361
+ * The Bot that the API is for.
362
+ */
363
+ bot: Bot;
364
+ /**
365
+ * The tag that the API is for.
366
+ */
367
+ tag: string;
368
+ /**
369
+ * The bot that is set as the creator of the current bot.
370
+ */
371
+ creator: RuntimeBot;
372
+ /**
373
+ * The bot that is set as the config of the current bot.
374
+ */
375
+ config: RuntimeBot;
376
+ }
377
+ /**
378
+ * Defines an interface that represents a set of records that were retrieved.
379
+ */
380
+ export interface GetRecordsResult {
381
+ /**
382
+ * The set of records that were retrieved.
383
+ */
384
+ records: Record[];
385
+ /**
386
+ * The total number of records that the query would have returned.
387
+ */
388
+ totalCount: number;
389
+ /**
390
+ * Whether there are more records available to retrieve for the query.
391
+ */
392
+ hasMoreRecords: boolean;
393
+ /**
394
+ * Gets the set page of records.
395
+ */
396
+ getMoreRecords(): Promise<GetRecordsResult>;
397
+ }
398
+ export declare const GET_RUNTIME: unique symbol;
399
+ /**
400
+ * Defines an interface for objects that represent a debugger and can retrieve their internal runtime.
401
+ */
402
+ export interface DebuggerInterface {
403
+ /**
404
+ * Gets the runtime for the debugger.
405
+ */
406
+ [GET_RUNTIME]: () => AuxRuntime;
407
+ }
408
+ export interface DebuggerBase {
409
+ /**
410
+ * Gets the list of portal bots in the debugger.
411
+ */
412
+ getPortalBots(): Map<string, Bot>;
413
+ /**
414
+ * Gets the list of action objects that have been performed by bots in the current debugger.
415
+ * Action objects are used by CasualOS to represent changes to bots or external effects that should be performed.
416
+ * Examples of this are {@link create}, {@link os.toast} and {@link os.enableVR}.
417
+ *
418
+ * @example Get the list of bot changes and actions that have been performed in a debugger
419
+ * const debug = await os.createDebugger();
420
+ * debug.create({
421
+ * test: '@os.toast("Hello")'
422
+ * });
423
+ * debug.shout("test");
424
+ *
425
+ * const actions = debug.getAllActions();
426
+ *
427
+ * assertEqual(actions, [
428
+ * {
429
+ * type: 'add_bot',
430
+ * id: 'uuid-1',
431
+ * bot: {
432
+ * id: 'uuid-1',
433
+ * tags: {
434
+ * test: '@os.toast("Hello")'
435
+ * }
436
+ * }
437
+ * },
438
+ * {
439
+ * type: 'show_toast',
440
+ * message: 'Hello',
441
+ * duration: 2000
442
+ * }
443
+ * ]);
444
+ */
445
+ getAllActions(): BotAction[];
446
+ /**
447
+ * Gets the list of common action objects that have been performed by bots in the current debugger. Action objects are used by CasualOS to represent changes to bots or external effects that should be performed.
448
+ * Common actions are actions that do not immediately change bots or bot tags or masks.
449
+ *
450
+ * Examples of common actions are {@link os.toast} and {@link os.enableVR}.
451
+ *
452
+ * @example Get the list of actions that have been performed in a debugger
453
+ * const debug = await os.createDebugger();
454
+ * debug.create({
455
+ * test: '@os.toast("Hello")'
456
+ * });
457
+ * debug.shout("test");
458
+ *
459
+ * const actions = debug.getCommonActions();
460
+ *
461
+ * assertEqual(actions, [
462
+ * {
463
+ * type: 'show_toast',
464
+ * message: 'Hello',
465
+ * duration: 2000
466
+ * }
467
+ * ]);
468
+ */
469
+ getCommonActions(): BotAction[];
470
+ /**
471
+ * Gets the list of bot actions that have been performed by bots in the current debugger.
472
+ * Action objects are used by CasualOS to represent changes to bots or external effects that should be performed.
473
+ * Bot actions are actions that immediately change bots or bot tags or masks.
474
+ *
475
+ * Examples of bot actions are {@link create}, {@link destroy} or {@link setTagMask}.
476
+ *
477
+ * @example Get the list of bot changes that have been performed in a debugger
478
+ * const debug = await os.createDebugger();
479
+ * debug.create({
480
+ * test: '@os.toast("Hello")'
481
+ * });
482
+ * debug.shout("test");
483
+ *
484
+ * const actions = debug.getBotActions();
485
+ *
486
+ * assertEqual(actions, [
487
+ * {
488
+ * type: 'add_bot',
489
+ * id: 'uuid-1',
490
+ * bot: {
491
+ * id: 'uuid-1',
492
+ * tags: {
493
+ * test: '@os.toast("Hello")'
494
+ * }
495
+ * }
496
+ * },
497
+ * ]);
498
+ */
499
+ getBotActions(): BotAction[];
500
+ /**
501
+ * Gets the list of errors that have occurred in the current debugger. Errors occur when an exceptional event happens in a script and prevents the rest of the script from executing.
502
+ *
503
+ * Debuggers capture these errors and let you inspect them afterwards.
504
+ *
505
+ * @example Get the list of errors that have happened in a debugger
506
+ * const debug = await os.createDebugger();
507
+ * debug.create({
508
+ * test: '@throw new Error("My Error")'
509
+ * });
510
+ * debug.shout("test");
511
+ *
512
+ * const errors = debug.getErrors();
513
+ *
514
+ * assertEqual(errors.length, 1);
515
+ * assertEqual(errors[0].error, new Error("My Error"));
516
+ * assertEqual(errors[0].tag, "test");
517
+ */
518
+ getErrors(): any[];
519
+ /**
520
+ * Registers the given handler to be called before a bot action is executed in this debugger.
521
+ * @param handler The handler that should be called.
522
+ */
523
+ onBeforeAction(handler: (action: BotAction) => void): void;
524
+ /**
525
+ * Registers the given handler to be called after a bot action is executed in this debugger.
526
+ * @param handler The handler that should be called.
527
+ */
528
+ onAfterAction(handler: (action: BotAction) => void): void;
529
+ /**
530
+ * Registers the given handler function to be called before a user action is performed in the debugger.
531
+ *
532
+ * User actions are like normal actions, except they are generated by the CasualOS frontend.
533
+ * Generally, this only happens for built-in shouts and whispers.
534
+ * Additionally, these actions can only be automatically created for debuggers that are attached using {@link os.attachDebugger}.
535
+ *
536
+ * @param listener the function that should be called before a user action is performed.
537
+ *
538
+ * @example Listen for tag updates in a debugger
539
+ * const debug = await os.createDebugger({
540
+ * pausable: true
541
+ * });
542
+ *
543
+ * // Register a listener that gets called whenever a user action is about to be performed.
544
+ * debug.onBeforeUserAction(update => {
545
+ * console.log('user action', update);
546
+ * });
547
+ *
548
+ * // Because the debugger is pausable, the create() function returns a promise
549
+ * // because it calls @onCreate which could cause a pause trigger to be hit.
550
+ * const debuggerBot = await debug.create({
551
+ * home: true,
552
+ * });
553
+ *
554
+ * // Attach the debugger to the front end
555
+ * await os.attachDebugger(debug);
556
+ *
557
+ * @docname onBeforeUserAction
558
+ * @docid debug.onBeforeUserAction
559
+ */
560
+ onBeforeUserAction(listener: (action: BotAction) => void): void;
561
+ /**
562
+ * Registers the given handler function to be called by the debugger whenever a script enqueues an action.
563
+ * This occurrs for common actions like {@link os.toast} and {@link os.showInput}.
564
+ *
565
+ * Every action that is enqueued ends up being performed.
566
+ *
567
+ * @param listener the function that should be called whenever an action is scheduled to be performed.
568
+ *
569
+ * @example Listen for actions to be enqueued in a debugger
570
+ * const debug = await os.createDebugger({
571
+ * pausable: true
572
+ * });
573
+ *
574
+ * // Register a listener that gets called whenever an action is scheduled to be performed.
575
+ * debug.onScriptActionEnqueued(action => {
576
+ * console.log('action enqueued', action);
577
+ * });
578
+ *
579
+ * // Because the debugger is pausable, the create() function returns a promise
580
+ * // because it calls @onCreate which could cause a pause trigger to be hit.
581
+ * const debuggerBot = await debug.create({
582
+ * test: '@let abc = 123; os.toast(abc);'
583
+ * });
584
+ *
585
+ * // Send a shout. Just like the create() function above, we recieve a promise that we can await.
586
+ * await debug.shout('test');
587
+ */
588
+ onScriptActionEnqueued(listener: (action: BotAction) => void): void;
589
+ /**
590
+ * Registers the given handler function to be called after any tag is updated in the debugger.
591
+ *
592
+ * @param listener the function that should be called when a tag is updated.
593
+ *
594
+ * @example Listen for tag updates in a debugger
595
+ * const debug = await os.createDebugger({
596
+ * pausable: true
597
+ * });
598
+ *
599
+ * // Register a listener that gets called whenever a tag is updated.
600
+ * debug.onAfterScriptUpdatedTag(update => {
601
+ * console.log('tag updated', update);
602
+ * });
603
+ *
604
+ * // Because the debugger is pausable, the create() function returns a promise
605
+ * // because it calls @onCreate which could cause a pause trigger to be hit.
606
+ * const debuggerBot = await debug.create({
607
+ * test: '@tags.message = "hello, world";'
608
+ * });
609
+ *
610
+ * // Send a shout. Just like the create() function above, we recieve a promise that we can await.
611
+ * await debug.shout('test');
612
+ */
613
+ onAfterScriptUpdatedTag(listener: (update: DebuggerTagUpdate) => void): void;
614
+ /**
615
+ * Registers the given handler function to be called after any tag mask is updated in the debugger.
616
+ *
617
+ * @param listener the function that should be called when a tag mask is updated.
618
+ *
619
+ * @example Listen for tag mask updates in a debugger
620
+ * const debug = await os.createDebugger({
621
+ * pausable: true
622
+ * });
623
+ *
624
+ * // Register a listener that gets called whenever a tag mask is updated.
625
+ * debug.onAfterScriptUpdatedTagMask(update => {
626
+ * console.log('tag mask updated', update);
627
+ * });
628
+ *
629
+ * // Because the debugger is pausable, the create() function returns a promise
630
+ * // because it calls @onCreate which could cause a pause trigger to be hit.
631
+ * const debuggerBot = await debug.create({
632
+ * test: '@masks.message = "hello, world";'
633
+ * });
634
+ *
635
+ * // Send a shout. Just like the create() function above, we recieve a promise that we can await.
636
+ * await debug.shout('test');
637
+ */
638
+ onAfterScriptUpdatedTagMask(listener: (update: DebuggerTagMaskUpdate) => void): void;
639
+ /**
640
+ * Performs the given actions in order as if they were user actions.
641
+ *
642
+ * This function works similarly to {@link action.perform} except that actions performed with it will also call handlers registered with {@link debug.onBeforeUserAction}.
643
+ * @param actions the actions that should be performed.
644
+ */
645
+ performUserAction(...actions: BotAction[]): Promise<(any[] | null)[]>;
646
+ /**
647
+ * The web actions that are available in this debugger.
648
+ *
649
+ * @docreferenceactions ^web\.
650
+ * @docsource WebActions
651
+ */
652
+ web: {};
653
+ /**
654
+ * The OS actions that are available in this debugger.
655
+ *
656
+ * @docreferenceactions ^os\.
657
+ * @docsource OSActions
658
+ */
659
+ os: {};
660
+ /**
661
+ * The action-related actions that are available in this debugger.
662
+ *
663
+ * @docreferenceactions ^action\.
664
+ * @docsource ActionActions
665
+ */
666
+ action: {};
667
+ }
668
+ /**
669
+ * Defines the possible types that represent a debugger.
670
+ *
671
+ * @dochash types/debuggers
672
+ * @docname Debugger
673
+ */
674
+ export type Debugger = NormalDebugger | PausableDebugger;
675
+ /**
676
+ * Defines an interface that represents a debugger.
677
+ *
678
+ * @dochash types/debuggers/debugger
679
+ * @doctitle Debugger
680
+ * @docsidebar Debugger
681
+ * @docdescription Defines an interface that represents a debugger.
682
+ * @docname Debugger
683
+ * @docreferenceactions ^\w+$
684
+ */
685
+ export interface NormalDebugger extends DebuggerBase {
686
+ }
687
+ /**
688
+ * Defines an interface that represents a pausable debugger.
689
+ *
690
+ * @dochash types/debuggers/pausable-debugger
691
+ * @doctitle Pausable Debugger
692
+ * @docsidebar Pausable Debugger
693
+ * @docdescription Defines an interface that represents a pausable debugger.
694
+ * @docname PausableDebugger
695
+ * @docreferenceactions ^\w+$
696
+ */
697
+ export interface PausableDebugger extends DebuggerBase {
698
+ /**
699
+ * Registers the given function to be called whenever the debugger is paused by hitting a pause trigger.
700
+ *
701
+ * @param handler the function that should be called when the debugger is paused.
702
+ *
703
+ * @example Listen for pauses on a debugger
704
+ * const debug = await os.createDebugger({
705
+ * pausable: true
706
+ * });
707
+ *
708
+ * debug.onPause(pause => {
709
+ * console.log('pause happened!', pause);
710
+ * });
711
+ *
712
+ * @docname onPause
713
+ * @docid debug.onPause
714
+ */
715
+ onPause(handler: (pause: DebuggerPause) => void): void;
716
+ /**
717
+ * Registers or updates a pause trigger with a debugger. Returns the newly created trigger.
718
+ *
719
+ * Pause triggers can be used to tell the debugger where you want it to temporarily stop execution. You specify the bot, tag, line and column numbers, and the debugger will stop before it executes the code at that location.
720
+ * Additionally, the debugger will call all handlers that have been registered with {@link debug.onPause}.
721
+ *
722
+ * @param trigger The trigger that should be registered or updated.
723
+ *
724
+ * @docname setPauseTrigger
725
+ * @docid debug.setPauseTrigger-trigger
726
+ */
727
+ _setPauseTrigger_trigger(trigger: PauseTrigger): PauseTrigger;
728
+ /**
729
+ * Registers or updates a pause trigger with this debugger.
730
+ * Pause triggers can be used to tell the debugger when you want it to stop execution.
731
+ * You specify the bot, tag, line and column numbers and the debugger will stop before/after it executes the code at that location.
732
+ * @param botOrIdOrTrigger the bot, or bot ID that should be registered.
733
+ * @param tag the name of the tag that the trigger should be set on.
734
+ * @param options The options that go with this pause trigger.
735
+ *
736
+ * @example Set a pause trigger on a script
737
+ * const debug = await os.createDebugger({
738
+ * pausable: true
739
+ * });
740
+ *
741
+ * const b = await debug.create({
742
+ * test: '@os.toast("Hello, World!")'
743
+ * });
744
+ *
745
+ * const trigger = debug.setPauseTrigger(b, 'test', {
746
+ * lineNumber: 1,
747
+ * columnNumber: 1
748
+ * });
749
+ *
750
+ * @example Update a pause trigger on a script
751
+ * const debug = await os.createDebugger({
752
+ * pausable: true
753
+ * });
754
+ *
755
+ * const b = await debug.create({
756
+ * test: '@os.toast("Hello, World!")'
757
+ * });
758
+ *
759
+ * let trigger = debug.setPauseTrigger(b, 'test', {
760
+ * lineNumber: 1,
761
+ * columnNumber: 1
762
+ * });
763
+ *
764
+ * trigger = debug.setPauseTrigger({
765
+ * ...trigger,
766
+ * states: ['before', 'after']
767
+ * });
768
+
769
+ * @docname setPauseTrigger
770
+ * @docid debug.setPauseTrigger-botOrId
771
+ */
772
+ _setPauseTrigger_botOrId(botOrIdOrTrigger: Bot | string, tag?: string, options?: PauseTriggerOptions): PauseTrigger;
773
+ /**
774
+ * Removes the given pause trigger from the debugger.
775
+ * @param triggerOrId the trigger or trigger ID that should be removed from the debugger.
776
+ *
777
+ * @example Remove a pause trigger
778
+ * const debug = await os.createDebugger({
779
+ * pausable: true
780
+ * });
781
+ *
782
+ * const b = await debug.create({
783
+ * test: '@os.toast("Hello, World!")'
784
+ * });
785
+ *
786
+ * const trigger = debug.setPauseTrigger(b, 'test', {
787
+ * lineNumber: 1,
788
+ * columnNumber: 1
789
+ * });
790
+ *
791
+ * debug.removePauseTrigger(trigger);
792
+ */
793
+ removePauseTrigger(triggerOrId: string | PauseTrigger): void;
794
+ /**
795
+ * Disables the given pause trigger.
796
+ * Disabled pause triggers will continue to be listed with {@link debug.listPauseTriggers}, but will not cause a pause to happen while they are disabled.
797
+ *
798
+ * @param triggerOrId The trigger or trigger ID that should be disabled.
799
+ *
800
+ * @example Disable a pause trigger
801
+ * const debug = await os.createDebugger({
802
+ * pausable: true
803
+ * });
804
+ *
805
+ * const b = await debug.create({
806
+ * test: '@os.toast("Hello, World!")'
807
+ * });
808
+ *
809
+ * const trigger = debug.setPauseTrigger(b, 'test', {
810
+ * lineNumber: 1,
811
+ * columnNumber: 1
812
+ * });
813
+ *
814
+ * debug.disablePauseTrigger(trigger);
815
+ */
816
+ disablePauseTrigger(triggerOrId: string | PauseTrigger): void;
817
+ /**
818
+ * Enables the given pause trigger
819
+ * @param triggerOrId The trigger or trigger ID that should be enabled.
820
+ *
821
+ * @example Enable a pause trigger
822
+ * const debug = await os.createDebugger({
823
+ * pausable: true
824
+ * });
825
+ *
826
+ * const b = await debug.create({
827
+ * test: '@os.toast("Hello, World!")'
828
+ * });
829
+ *
830
+ * const trigger = debug.setPauseTrigger(b, 'test', {
831
+ * lineNumber: 1,
832
+ * columnNumber: 1,
833
+ * enabled: false
834
+ * });
835
+ *
836
+ * debug.enablePauseTrigger(trigger);
837
+ */
838
+ enablePauseTrigger(triggerOrId: string | PauseTrigger): void;
839
+ /**
840
+ * Gets the list of pause triggers that have been registered with this debugger.
841
+ *
842
+ * @example List the triggers that are set on this debugger
843
+ * const debug = await os.createDebugger({
844
+ * pausable: true
845
+ * });
846
+ *
847
+ * const b = await debug.create({
848
+ * test: '@os.toast("Hello, World!")'
849
+ * });
850
+ *
851
+ * const trigger = debug.setPauseTrigger(b, 'test', {
852
+ * lineNumber: 1,
853
+ * columnNumber: 1,
854
+ * enabled: false
855
+ * });
856
+ *
857
+ * const triggers = debug.listPauseTriggers();
858
+ *
859
+ * @docname listPauseTriggers
860
+ * @docid debug.listPauseTriggers
861
+ */
862
+ listPauseTriggers(): PauseTrigger[];
863
+ /**
864
+ * Gets a list of common trigger locations for the specified tag on the specified bot. Returns an array containing the list of possible pause trigger locations.
865
+ *
866
+ * @param botOrId the bot or bot ID that the locations should be listed for.
867
+ * @param tag the name of the tag that the locations should be listed for.
868
+ *
869
+ * @example List common trigger locations for a script
870
+ * const debug = await os.createDebugger({
871
+ * pausable: true
872
+ * });
873
+ *
874
+ * const b = await debug.create({
875
+ * test: '@os.toast("Hello, World!")'
876
+ * });
877
+ *
878
+ * const triggerLocations = debug.listCommonPauseTriggers(b, 'test');
879
+ *
880
+ * @example Register a trigger from a common location
881
+ * const debug = await os.createDebugger({
882
+ * pausable: true
883
+ * });
884
+ *
885
+ * const b = await debug.create({
886
+ * test: '@os.toast("Hello, World!")'
887
+ * });
888
+ *
889
+ * const triggerLocations = debug.listCommonPauseTriggers(b, 'test');
890
+ *
891
+ * const trigger = debug.setPauseTrigger(b, 'test', {
892
+ * lineNumber: triggerLocations[0].lineNumber,
893
+ * columnNumber: triggerLocations[0].columnNumber,
894
+ * states: triggerLocations[0].possibleStates
895
+ * });
896
+ */
897
+ listCommonPauseTriggers(botOrId: Bot | string, tag: string): PossiblePauseTriggerLocation[];
898
+ /**
899
+ * Resumes the debugger execution from the given pause.
900
+ * @param pause the debugger pause that was passed to the handler of {@link debug.onPause}.
901
+ *
902
+ * @example Resume execution on a debugger
903
+ * const debug = await os.createDebugger({
904
+ * pausable: true
905
+ * });
906
+ *
907
+ * // Register a listener that gets called whenever a pause happens in this debugger.
908
+ * debug.onPause(pause => {
909
+ * // Get the current stack frame from the pause
910
+ * const currentFrame = pause.callStack[pause.callStack.length - 1];
911
+ *
912
+ * // Set the abc variable to 999
913
+ * currentFrame.setVariableValue('abc', 999);
914
+ *
915
+ * // Resume execution after the pause.
916
+ * debug.resume(pause);
917
+ * });
918
+ *
919
+ * // Because the debugger is pausable, the create() function returns a promise
920
+ * // because it calls @onCreate which could cause a pause trigger to be hit.
921
+ * const debuggerBot = await debug.create({
922
+ * test: '@let abc = 123; os.toast(abc);'
923
+ * });
924
+ *
925
+ * // Set a pause trigger in the "test" script of the bot we just created
926
+ * // at line 1 column 16
927
+ * const trigger = debug.setPauseTrigger(debuggerBot, 'test', {
928
+ * lineNumber: 1,
929
+ * columnNumber: 16
930
+ * });
931
+ *
932
+ * // Send a shout. Just like the create() function above, we recieve a promise that we can await.
933
+ * await debug.shout('test');
934
+ *
935
+ * // Get the resulting actions from the debugger
936
+ * // and perform the first one. This should be the os.toast(), but instead of printing 123,
937
+ * // it should print 999 because we changed the value of abc during the debugger pause.
938
+ * const actions = debug.getCommonActions();
939
+ * action.perform(actions[0]);
940
+ */
941
+ resume(pause: DebuggerPause): void;
942
+ /**
943
+ * Gets the current call stack for the debugger. Call stacks are useful for determining program flow and how scripts interact with each other.
944
+ *
945
+ * @example Get the call stack from a debugger
946
+ * const debug = os.createDebugger({
947
+ * pausable: true
948
+ * });
949
+ *
950
+ * const callStack = debug.getCallStack();
951
+ */
952
+ getCallStack(): DebuggerCallFrame[];
953
+ /**
954
+ * Creates a new bot and returns it.
955
+ * @param parent The bot that should be the parent of the new bot.
956
+ * @param mods The mods which specify the new bot's tag values. If given a mod with no tags, then an error will be thrown.
957
+ * @returns The bot(s) that were created.
958
+ *
959
+ * @example Create a red bot without a parent.
960
+ * let debugger = await os.createDebugger({
961
+ * pausable: true
962
+ * });
963
+ * let redBot = await debugger.create(null, { "color": "red" });
964
+ *
965
+ * @example Create a red bot and a blue bot with `this` as the parent.
966
+ * let debugger = await os.createDebugger({
967
+ * pausable: true
968
+ * });
969
+ * let [redBot, blueBot] = await debugger.create(this, [
970
+ * { "color": "red" },
971
+ * { "color": "blue" }
972
+ * ]);
973
+ */
974
+ create(...mods: Mod[]): Promise<Bot | Bot[]>;
975
+ /**
976
+ * Destroys the given bot, bot ID, or list of bots.
977
+ * @param bot The bot, bot ID, or list of bots to destroy.
978
+ */
979
+ destroy(bot: Bot | string | Bot[]): Promise<void>;
980
+ /**
981
+ * Shouts the given events in order until a bot returns a result.
982
+ * Returns the result that was produced or undefined if no result was produced.
983
+ * @param eventNames The names of the events to shout.
984
+ * @param arg The argument to shout.
985
+ */
986
+ priorityShout(eventNames: string[], arg?: any): Promise<any>;
987
+ /**
988
+ * Asks every bot in the inst to run the given action.
989
+ * In effect, this is like shouting to a bunch of people in a room.
990
+ *
991
+ * @param name The event name.
992
+ * @param arg The optional argument to include in the shout.
993
+ * @returns Returns a list which contains the values returned from each script that was run for the shout.
994
+ *
995
+ * @example Tell every bot to reset themselves.
996
+ * let debugger = await os.createDebugger({
997
+ * pausable: true
998
+ * });
999
+ * await debugger.shout("reset()");
1000
+ *
1001
+ * @example Ask every bot for its name.
1002
+ * let debugger = await os.createDebugger({
1003
+ * pausable: true
1004
+ * });
1005
+ * const names = await debugger.shout("getName()");
1006
+ *
1007
+ * @example Tell every bot say "Hi" to you.
1008
+ * let debugger = await os.createDebugger({
1009
+ * pausable: true
1010
+ * });
1011
+ * await debugger.shout("sayHi()", "My Name");
1012
+ */
1013
+ shout(name: string, arg?: any): Promise<any[]>;
1014
+ /**
1015
+ * Asks the given bots to run the given action.
1016
+ * In effect, this is like whispering to a specific set of people in a room.
1017
+ *
1018
+ * @param bot The bot(s) to send the event to.
1019
+ * @param eventName The name of the event to send.
1020
+ * @param arg The optional argument to include.
1021
+ * @returns Returns a list which contains the values returned from each script that was run for the shout.
1022
+ */
1023
+ whisper(bot: (Bot | string)[] | Bot | string, eventName: string, arg?: any): Promise<any>;
1024
+ /**
1025
+ * Changes the state that the given bot is in.
1026
+ * @param bot The bot to change.
1027
+ * @param stateName The state that the bot should move to.
1028
+ * @param groupName The group of states that the bot's state should change in. (Defaults to "state")
1029
+ */
1030
+ changeState(bot: Bot, stateName: string, groupName?: string): Promise<void>;
1031
+ }
1032
+ /**
1033
+ * Defines an interface for a possible pause trigger location.
1034
+ *
1035
+ * @dochash types/debuggers/common
1036
+ * @docname PossiblePauseTriggerLocation
1037
+ */
1038
+ export interface PossiblePauseTriggerLocation {
1039
+ /**
1040
+ * The line number that the trigger would pause the debugger at.
1041
+ */
1042
+ lineNumber: number;
1043
+ /**
1044
+ * The column number that the trigger would pause the debugger at.
1045
+ */
1046
+ columnNumber: number;
1047
+ /**
1048
+ * The states that are reasonable for this pause trigger to stop at.
1049
+ */
1050
+ possibleStates: PossiblePauseTriggerStates;
1051
+ }
1052
+ /**
1053
+ * The possible states that a pause trigger can be set to.
1054
+ *
1055
+ * @dochash types/debuggers/common
1056
+ * @docname PossiblePauseTriggerStates
1057
+ */
1058
+ export type PossiblePauseTriggerStates = ['before' | 'after'] | ['before', 'after'];
1059
+ /**
1060
+ * Defines an interface for a debugger trace that represents when a tag was updated.
1061
+ *
1062
+ * @dochash types/debuggers/common
1063
+ * @docname DebuggerTagUpdate
1064
+ */
1065
+ export interface DebuggerTagUpdate {
1066
+ /**
1067
+ * The ID of the bot that was updated.
1068
+ */
1069
+ botId: string;
1070
+ /**
1071
+ * The tag that was updated.
1072
+ */
1073
+ tag: string;
1074
+ /**
1075
+ * The old value of the tag.
1076
+ */
1077
+ oldValue: any;
1078
+ /**
1079
+ * The new value for the tag.
1080
+ */
1081
+ newValue: any;
1082
+ }
1083
+ /**
1084
+ * Defines an interface for a debugger trace that represents when a tag mask was updated.
1085
+ *
1086
+ * @dochash types/debuggers/common
1087
+ * @docname DebuggerTagMaskUpdate
1088
+ */
1089
+ export interface DebuggerTagMaskUpdate extends DebuggerTagUpdate {
1090
+ /**
1091
+ * The space of the tag mask.
1092
+ */
1093
+ space: string;
1094
+ }
1095
+ /**
1096
+ * Defines an interface that contains options for attaching a debugger.
1097
+ *
1098
+ * @dochash types/debuggers/common
1099
+ * @doctitle Common
1100
+ * @docsidebar Common
1101
+ * @docdescription Defines common interfaces related to debuggers.
1102
+ * @docname AttachDebuggerOptions
1103
+ */
1104
+ export interface AttachDebuggerOptions {
1105
+ /**
1106
+ * Gets the tag name mapper that should be used.
1107
+ * This is useful for ensuring that the debugger objects utilize different tag names for the front end.
1108
+ */
1109
+ tagNameMapper?: TagMapper;
1110
+ }
1111
+ /**
1112
+ * Defines an interface that contains options for a debugger.
1113
+ */
1114
+ export interface CommonDebuggerOptions {
1115
+ /**
1116
+ * Whether to use "real" UUIDs instead of predictable ones.
1117
+ */
1118
+ useRealUUIDs?: boolean;
1119
+ /**
1120
+ * Whether to allow scripts to be asynchronous.
1121
+ * If false, then all scripts will be forced to be synchronous.
1122
+ * Defaults to true.
1123
+ */
1124
+ allowAsynchronousScripts?: boolean;
1125
+ /**
1126
+ * The data that the configBot should be created from.
1127
+ * Can be a mod or another bot.
1128
+ */
1129
+ configBot?: Bot | BotTags;
1130
+ }
1131
+ /**
1132
+ * Defines an interface that contains options for a normal debugger.
1133
+ * That is, a debugger that is not pausable.
1134
+ *
1135
+ * @dochash types/debuggers/common
1136
+ * @docname NormalDebuggerOptions
1137
+ */
1138
+ export interface NormalDebuggerOptions extends CommonDebuggerOptions {
1139
+ pausable?: false;
1140
+ }
1141
+ /**
1142
+ * Defines an interface that contains options for a pausable debugger.
1143
+ * That is, a debugger that is pausable.
1144
+ *
1145
+ * @dochash types/debuggers/common
1146
+ * @docname PausableDebuggerOptions
1147
+ */
1148
+ export interface PausableDebuggerOptions extends CommonDebuggerOptions {
1149
+ pausable: true;
1150
+ }
1151
+ /**
1152
+ * Defines an interface that contains options for an aux debugger.
1153
+ *
1154
+ * @dochash types/debuggers/common
1155
+ * @docname DebuggerOptions
1156
+ */
1157
+ export interface AuxDebuggerOptions {
1158
+ /**
1159
+ * Whether the debugger should be pausable.
1160
+ */
1161
+ pausable: boolean;
1162
+ /**
1163
+ * Whether to use "real" UUIDs instead of predictable ones.
1164
+ */
1165
+ useRealUUIDs: boolean;
1166
+ /**
1167
+ * Whether to allow scripts to be asynchronous.
1168
+ * If false, then all scripts will be forced to be synchronous.
1169
+ * Defaults to true.
1170
+ */
1171
+ allowAsynchronousScripts: boolean;
1172
+ /**
1173
+ * The data that the configBot should be created from.
1174
+ * Can be a mod or another bot.
1175
+ */
1176
+ configBot: Bot | BotTags;
1177
+ }
1178
+ /**
1179
+ * Defines an interface that contains options for a pause trigger.
1180
+ *
1181
+ * @dochash types/debuggers/common
1182
+ * @docname PauseTriggerOptions
1183
+ */
1184
+ export interface PauseTriggerOptions {
1185
+ /**
1186
+ * The line number that the trigger starts at.
1187
+ */
1188
+ lineNumber: number;
1189
+ /**
1190
+ * The column number that the trigger starts at.
1191
+ */
1192
+ columnNumber: number;
1193
+ /**
1194
+ * The states that the trigger should use.
1195
+ * Defaults to ["before"] if not specified.
1196
+ */
1197
+ states?: Breakpoint['states'];
1198
+ /**
1199
+ * Whether the trigger is enabled.
1200
+ * Defaults to true.
1201
+ */
1202
+ enabled?: boolean;
1203
+ }
1204
+ /**
1205
+ * Defines an interface that represents a pause trigger.
1206
+ *
1207
+ * @dochash types/debuggers/common
1208
+ * @docname PauseTrigger
1209
+ */
1210
+ export interface PauseTrigger extends PauseTriggerOptions {
1211
+ /**
1212
+ * The ID of the trigger.
1213
+ */
1214
+ triggerId: string;
1215
+ /**
1216
+ * The ID of the bot that the trigger is set on.
1217
+ */
1218
+ botId: string;
1219
+ /**
1220
+ * The tag that the trigger is set on.
1221
+ */
1222
+ tag: string;
1223
+ }
1224
+ /**
1225
+ * Defines an interface that contains information about the current debugger pause state.
1226
+ * @dochash types/debuggers/common
1227
+ * @docname DebuggerPause
1228
+ */
1229
+ export interface DebuggerPause {
1230
+ /**
1231
+ * The ID of the pause.
1232
+ */
1233
+ pauseId: string | number;
1234
+ /**
1235
+ * The pause trigger that started this pause.
1236
+ */
1237
+ trigger: PauseTrigger;
1238
+ /**
1239
+ * The state of the pause.
1240
+ * Indicates whether the pause is before or after the node was executed.
1241
+ */
1242
+ state: 'before' | 'after';
1243
+ /**
1244
+ * The result of the node evaluation.
1245
+ */
1246
+ result?: any;
1247
+ /**
1248
+ * The call stack that the debugger currently has.
1249
+ */
1250
+ callStack: DebuggerCallFrame[];
1251
+ }
1252
+ /**
1253
+ * Defines an interface that contains information about a single call stack frame.
1254
+ *
1255
+ * @dochash types/debuggers/common
1256
+ * @docname DebuggerCallFrame
1257
+ */
1258
+ export interface DebuggerCallFrame {
1259
+ /**
1260
+ * The location that was last evaluated in this frame.
1261
+ */
1262
+ location: DebuggerFunctionLocation;
1263
+ /**
1264
+ * Gets the list of variables that are avaiable from this frame.
1265
+ */
1266
+ listVariables(): DebuggerVariable[];
1267
+ /**
1268
+ * Sets the given variable name to the given value.
1269
+ * @param variableName The name of the variable to set.
1270
+ * @param value The value to set in the variable.
1271
+ */
1272
+ setVariableValue(variableName: string, value: any): void;
1273
+ }
1274
+ /**
1275
+ * Defines an interface that represents a location in a debugger.
1276
+ *
1277
+ * @dochash types/debuggers/common
1278
+ * @docname DebuggerFunctionLocation
1279
+ */
1280
+ export interface DebuggerFunctionLocation {
1281
+ /**
1282
+ * The name of the function.
1283
+ */
1284
+ name?: string;
1285
+ /**
1286
+ * The ID of the bot that this function is defined in.
1287
+ */
1288
+ botId?: string;
1289
+ /**
1290
+ * The name of the tag that this function is defined in.
1291
+ */
1292
+ tag?: string;
1293
+ /**
1294
+ * The line number that this function is defined at.
1295
+ */
1296
+ lineNumber?: number;
1297
+ /**
1298
+ * The column number that this function is defined at.
1299
+ */
1300
+ columnNumber?: number;
1301
+ }
1302
+ /**
1303
+ * Defines an interface that represents a debugger variable.
1304
+ *
1305
+ * @dochash types/debuggers/common
1306
+ * @docname DebuggerVariable
1307
+ */
1308
+ export interface DebuggerVariable {
1309
+ /**
1310
+ * The name of the variable.
1311
+ */
1312
+ name: string;
1313
+ /**
1314
+ * The value contained by the variable.
1315
+ */
1316
+ value: any;
1317
+ /**
1318
+ * The scope that the variable exists in.
1319
+ *
1320
+ * "block" indicates that the variable was defined in and exists only in the current block.
1321
+ * "frame" indicates that the variable was defined in and exists in the current stack frame.
1322
+ * "closure" indicates that the variable was inherited from a parent stack frame.
1323
+ */
1324
+ scope: 'block' | 'frame' | 'closure';
1325
+ /**
1326
+ * Whether the variable value can be overwriten.
1327
+ */
1328
+ writable: boolean;
1329
+ /**
1330
+ * Whether this variable has been initialized.
1331
+ */
1332
+ initialized?: boolean;
1333
+ }
1334
+ /**
1335
+ * Defines an interface for a random number generator.
1336
+ *
1337
+ * @dochash types/core
1338
+ * @docname PseudoRandomNumberGenerator
1339
+ */
1340
+ export interface PseudoRandomNumberGenerator {
1341
+ /**
1342
+ * The seed used for this random number generator.
1343
+ * If null then an unpredictable seed was used.
1344
+ */
1345
+ seed: number | string | null;
1346
+ /**
1347
+ * Generates a random number between 0 and 1.
1348
+ */
1349
+ random(): number;
1350
+ /**
1351
+ * Generates a random decimal number between the given min and max values.
1352
+ * @param min The minimum output number.
1353
+ * @param max The maximum output number.
1354
+ */
1355
+ random(min?: number, max?: number): number;
1356
+ /**
1357
+ * Generates a random integer between the given min and max values.
1358
+ * @param min The minimum output number.
1359
+ * @param max The maximum output number.
1360
+ */
1361
+ randomInt(min: number, max: number): number;
1362
+ }
1363
+ export interface MaskableFunction {
1364
+ mask(...args: any[]): MaskedFunction;
1365
+ }
1366
+ export interface MaskedFunction {
1367
+ returns(value: any): void;
1368
+ }
1369
+ export interface WebhookInterface extends MaskableFunction {
1370
+ (options: WebhookOptions): void;
1371
+ post: ((url: string, data?: any, options?: WebhookOptions) => Promise<any>) & MaskableFunction;
1372
+ }
1373
+ /**
1374
+ * Defines an interface that represents the result of a webhook.
1375
+ *
1376
+ * @dochash types/web
1377
+ * @docname WebhookResult
1378
+ */
1379
+ export interface WebhookResult {
1380
+ /**
1381
+ * The data that was returned from the webhook.
1382
+ */
1383
+ data: any;
1384
+ /**
1385
+ * The HTTP Status Code that was returned from the webhook.
1386
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status for more information.
1387
+ */
1388
+ status: number;
1389
+ /**
1390
+ * The HTTP Headers that were included in the response.
1391
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers for more information.
1392
+ *
1393
+ * @docsource Headers
1394
+ */
1395
+ headers: {
1396
+ [name: string]: string;
1397
+ };
1398
+ }
1399
+ /**
1400
+ * Defines the possible results of a "record file" request.
1401
+ *
1402
+ * @dochash types/records/files
1403
+ * @docgroup 01-create
1404
+ * @docorder 1
1405
+ * @docname RecordFileResult
1406
+ */
1407
+ export type RecordFileApiResult = RecordFileApiSuccess | RecordFileApiFailure;
1408
+ /**
1409
+ * Defines an interface that represents a successful "record file" request.
1410
+ *
1411
+ * @dochash types/records/files
1412
+ * @docgroup 01-create
1413
+ * @docorder 2
1414
+ * @docname RecordFileSuccess
1415
+ */
1416
+ export interface RecordFileApiSuccess {
1417
+ success: true;
1418
+ /**
1419
+ * The URL that the file can be accessed at.
1420
+ */
1421
+ url: string;
1422
+ /**
1423
+ * The SHA-256 hash of the file.
1424
+ * When downloading the URL, the resulting data is guaranteed to have a SHA-256 hash that matches this value.
1425
+ */
1426
+ sha256Hash: string;
1427
+ }
1428
+ /**
1429
+ * Defines an interface that represents a failed "record file" request.
1430
+ *
1431
+ * @dochash types/records/files
1432
+ * @doctitle File Types
1433
+ * @docsidebar Files
1434
+ * @docdescription File types are used for uploading and downloading files.
1435
+ * @docgroup 01-create
1436
+ * @docorder 3
1437
+ * @docname RecordFileFailure
1438
+ */
1439
+ export interface RecordFileApiFailure {
1440
+ success: false;
1441
+ /**
1442
+ * The error code that describes why the request failed.
1443
+ */
1444
+ errorCode: RecordFileFailure['errorCode'] | 'file_already_exists' | 'invalid_file_data';
1445
+ /**
1446
+ * The error message that describes why the request failed.
1447
+ */
1448
+ errorMessage: string;
1449
+ /**
1450
+ * The URL that the file is available at if it has already been uploaded.
1451
+ */
1452
+ existingFileUrl?: string;
1453
+ }
1454
+ /**
1455
+ * Defines an interface that contains options for a snap grid for {@link os.addDropGrid}.
1456
+ *
1457
+ * @dochash types/os
1458
+ * @docname SnapGridTarget
1459
+ */
1460
+ export interface SnapGridTarget {
1461
+ /**
1462
+ * The 3D position that the grid should appear at.
1463
+ */
1464
+ position?: {
1465
+ x: number;
1466
+ y: number;
1467
+ z: number;
1468
+ };
1469
+ /**
1470
+ * The 3D rotation that the grid should appear at.
1471
+ */
1472
+ rotation?: {
1473
+ x: number;
1474
+ y: number;
1475
+ z: number;
1476
+ w?: number;
1477
+ };
1478
+ /**
1479
+ * The bot that defines the portal that the grid should exist in.
1480
+ * If null, then this defaults to the configBot.
1481
+ */
1482
+ portalBot?: Bot | string;
1483
+ /**
1484
+ * The tag that the portal uses to determine which dimension to show. Defaults to formAddress.
1485
+ */
1486
+ portalTag?: string;
1487
+ /**
1488
+ * The bounds of the grid.
1489
+ * Defaults to 10 x 10.
1490
+ */
1491
+ bounds?: {
1492
+ x: number;
1493
+ y: number;
1494
+ };
1495
+ /**
1496
+ * The priority that this grid should be evaluated in over other grids.
1497
+ * Higher priorities will be evaluated before lower priorities.
1498
+ */
1499
+ priority?: number;
1500
+ /**
1501
+ * Whether to visualize the grid while a bot is being dragged.
1502
+ * Defaults to false.
1503
+ */
1504
+ showGrid?: boolean;
1505
+ /**
1506
+ * The type of grid that this snap grid should be.
1507
+ * Defaults to the type of grid that the portal bot uses.
1508
+ *
1509
+ * - "grid" indicates that the snap target should be a flat grid.
1510
+ * - "sphere" indicates that the snap target should be a sphere.
1511
+ */
1512
+ type?: 'grid' | 'sphere';
1513
+ }
1514
+ /**
1515
+ * The possible results for a "join room" request.
1516
+ *
1517
+ * @dochash types/os
1518
+ * @docname JoinRoomResult
1519
+ */
1520
+ export type JoinRoomResult = JoinRoomSuccess | JoinRoomFailure;
1521
+ /**
1522
+ * Defines an interface that represents a successful "join room" request.
1523
+ *
1524
+ * @dochash types/os
1525
+ * @docname JoinRoomSuccess
1526
+ */
1527
+ export interface JoinRoomSuccess {
1528
+ success: true;
1529
+ /**
1530
+ * The name of the room that was joined.
1531
+ */
1532
+ roomName: string;
1533
+ }
1534
+ /**
1535
+ * Defines an interface that represents a failed "join room" request.
1536
+ *
1537
+ * @dochash types/os
1538
+ * @docname JoinRoomFailure
1539
+ */
1540
+ export interface JoinRoomFailure {
1541
+ success: false;
1542
+ /**
1543
+ * The name of the room that was attempted to be joined.
1544
+ */
1545
+ roomName: string;
1546
+ /**
1547
+ * The error code that describes why the request failed.
1548
+ */
1549
+ errorCode: string;
1550
+ /**
1551
+ * The error message that describes why the request failed.
1552
+ */
1553
+ errorMessage: string;
1554
+ }
1555
+ /**
1556
+ * The possible results for a "leave room" request.
1557
+ *
1558
+ * @dochash types/os
1559
+ * @docname LeaveRoomResult
1560
+ */
1561
+ export type LeaveRoomResult = LeaveRoomSuccess | LeaveRoomFailure;
1562
+ /**
1563
+ * Defines an interface that represents a successful "leave room" request.
1564
+ *
1565
+ * @dochash types/os
1566
+ * @docname LeaveRoomSuccess
1567
+ */
1568
+ export interface LeaveRoomSuccess {
1569
+ success: true;
1570
+ /**
1571
+ * The name of the room that was left.
1572
+ */
1573
+ roomName: string;
1574
+ }
1575
+ /**
1576
+ * Defines an interface that represents a failed "leave room" request.
1577
+ *
1578
+ * @dochash types/os
1579
+ * @docname LeaveRoomFailure
1580
+ */
1581
+ export interface LeaveRoomFailure {
1582
+ success: false;
1583
+ /**
1584
+ * The name of the room that was attempted to be left.
1585
+ */
1586
+ roomName: string;
1587
+ /**
1588
+ * The error code that describes why the request failed.
1589
+ */
1590
+ errorCode: string;
1591
+ /**
1592
+ * The error message that describes why the request failed.
1593
+ */
1594
+ errorMessage: string;
1595
+ }
1596
+ /**
1597
+ * The possible results for a "set room options" request.
1598
+ *
1599
+ * @dochash types/os
1600
+ * @docname SetRoomOptionsResult
1601
+ */
1602
+ export type SetRoomOptionsResult = SetRoomOptionsSuccess | SetRoomOptionsFailure;
1603
+ /**
1604
+ * Defines an interface that represents a successful "set room options" request.
1605
+ *
1606
+ * @dochash types/os
1607
+ * @docname SetRoomOptionsSuccess
1608
+ */
1609
+ export interface SetRoomOptionsSuccess {
1610
+ success: true;
1611
+ /**
1612
+ * The name of the room that the options were set on.
1613
+ */
1614
+ roomName: true;
1615
+ }
1616
+ /**
1617
+ * Defines an interface that represents a failed "set room options" request.
1618
+ */
1619
+ export interface SetRoomOptionsFailure {
1620
+ success: false;
1621
+ /**
1622
+ * The name of the room that the options were attempted to be set on.
1623
+ */
1624
+ roomName: string;
1625
+ /**
1626
+ * The error code that describes why the request failed.
1627
+ */
1628
+ errorCode: string;
1629
+ /**
1630
+ * The error message that describes why the request failed.
1631
+ */
1632
+ errorMessage: string;
1633
+ }
1634
+ /**
1635
+ * The possible results for a "get room options" request.
1636
+ *
1637
+ * @dochash types/os
1638
+ * @docname GetRoomOptionsResult
1639
+ */
1640
+ export type GetRoomOptionsResult = GetRoomOptionsSuccess | GetRoomOptionsFailure;
1641
+ /**
1642
+ * Defines an interface that represents a successful "get room options" request.
1643
+ *
1644
+ * @dochash types/os
1645
+ * @docname GetRoomOptionsSuccess
1646
+ */
1647
+ export interface GetRoomOptionsSuccess {
1648
+ success: true;
1649
+ /**
1650
+ * The name of the room that the options were retrieved from.
1651
+ */
1652
+ roomName: string;
1653
+ /**
1654
+ * The options that were retrieved.
1655
+ */
1656
+ options: RoomOptions;
1657
+ }
1658
+ /**
1659
+ * Defines an interface that represents a failed "get room options" request.
1660
+ *
1661
+ * @dochash types/os
1662
+ * @docname GetRoomOptionsFailure
1663
+ */
1664
+ export interface GetRoomOptionsFailure {
1665
+ success: false;
1666
+ /**
1667
+ * The error code that describes why the request failed.
1668
+ */
1669
+ errorCode: string;
1670
+ /**
1671
+ * The error message that describes why the request failed.
1672
+ */
1673
+ errorMessage: string;
1674
+ }
1675
+ /**
1676
+ * The possible results for a "get room track options" request.
1677
+ *
1678
+ * @dochash types/os
1679
+ * @docname GetRoomTrackOptionsResult
1680
+ */
1681
+ export type GetRoomTrackOptionsResult = GetRoomTrackOptionsSuccess | GetRoomTrackOptionsFailure;
1682
+ /**
1683
+ * Defines an interface that represents a successful "get room track options" request.
1684
+ *
1685
+ * @dochash types/os
1686
+ * @docname GetRoomTrackOptionsSuccess
1687
+ */
1688
+ export interface GetRoomTrackOptionsSuccess {
1689
+ success: true;
1690
+ /**
1691
+ * The name of the room that the options were retrieved from.
1692
+ */
1693
+ roomName: string;
1694
+ /**
1695
+ * The address of the track that the options were retrieved from.
1696
+ */
1697
+ address: string;
1698
+ /**
1699
+ * The options that were retrieved.
1700
+ */
1701
+ options: RoomTrackOptions;
1702
+ }
1703
+ /**
1704
+ * Defines an interface that represents a failed "get room track options" request.
1705
+ *
1706
+ * @dochash types/os
1707
+ * @docname GetRoomTrackOptionsFailure
1708
+ */
1709
+ export interface GetRoomTrackOptionsFailure {
1710
+ success: false;
1711
+ /**
1712
+ * The error code that describes why the request failed.
1713
+ */
1714
+ errorCode: string;
1715
+ /**
1716
+ * The error message that describes why the request failed.
1717
+ */
1718
+ errorMessage: string;
1719
+ /**
1720
+ * The name of the room that the options were attempted to be retrieved from.
1721
+ */
1722
+ roomName: string;
1723
+ /**
1724
+ * The address of the track that the options were attempted to be retrieved from.
1725
+ */
1726
+ address: string;
1727
+ }
1728
+ /**
1729
+ * The possible results for a "set room track options" request.
1730
+ *
1731
+ * @dochash types/os
1732
+ * @docname SetRoomTrackOptionsResult
1733
+ */
1734
+ export type SetRoomTrackOptionsResult = SetRoomTrackOptionsSuccess | SetRoomTrackOptionsFailure;
1735
+ /**
1736
+ * Defines an interface that represents a successful "set room track options" request.
1737
+ *
1738
+ * @dochash types/os
1739
+ * @docname SetRoomTrackOptionsSuccess
1740
+ */
1741
+ export interface SetRoomTrackOptionsSuccess {
1742
+ success: true;
1743
+ /**
1744
+ * The name of the room that the options were set on.
1745
+ */
1746
+ roomName: string;
1747
+ /**
1748
+ * The address of the track that the options were set on.
1749
+ */
1750
+ address: string;
1751
+ /**
1752
+ * The options that were set.
1753
+ */
1754
+ options: RoomTrackOptions;
1755
+ }
1756
+ /**
1757
+ * Defines an interface that represents a failed "set room track options" request.
1758
+ *
1759
+ * @dochash types/os
1760
+ * @docname SetRoomTrackOptionsFailure
1761
+ */
1762
+ export interface SetRoomTrackOptionsFailure {
1763
+ success: false;
1764
+ /**
1765
+ * The error code that describes why the request failed.
1766
+ */
1767
+ errorCode: string;
1768
+ /**
1769
+ * The error message that describes why the request failed.
1770
+ */
1771
+ errorMessage: string;
1772
+ /**
1773
+ * The name of the room that the options were attempted to be set on.
1774
+ */
1775
+ roomName: string;
1776
+ /**
1777
+ * The address of the track that the options were attempted to be set on.
1778
+ */
1779
+ address: string;
1780
+ }
1781
+ /**
1782
+ * The possible results for a "get room remote options" request.
1783
+ *
1784
+ * @dochash types/os
1785
+ * @docname GetRoomRemoteOptionsResult
1786
+ */
1787
+ export type GetRoomRemoteOptionsResult = GetRoomRemoteOptionsSuccess | GetRoomRemoteOptionsFailure;
1788
+ /**
1789
+ * Defines an interface that represents a successful "get room remote options" request.
1790
+ *
1791
+ * @dochash types/os
1792
+ * @docname GetRoomRemoteOptionsSuccess
1793
+ */
1794
+ export interface GetRoomRemoteOptionsSuccess {
1795
+ success: true;
1796
+ /**
1797
+ * The name of the room that the options were retrieved from.
1798
+ */
1799
+ roomName: string;
1800
+ /**
1801
+ * The ID of the remote that the options were retrieved from.
1802
+ */
1803
+ remoteId: string;
1804
+ /**
1805
+ * The options that were retrieved.
1806
+ */
1807
+ options: RoomRemoteOptions;
1808
+ }
1809
+ /**
1810
+ * Defines an interface that represents a failed "get room remote options" request.
1811
+ *
1812
+ * @dochash types/os
1813
+ * @docname GetRoomRemoteOptionsFailure
1814
+ */
1815
+ export interface GetRoomRemoteOptionsFailure {
1816
+ success: false;
1817
+ /**
1818
+ * The error code that describes why the request failed.
1819
+ */
1820
+ errorCode: string;
1821
+ /**
1822
+ * The error message that describes why the request failed.
1823
+ */
1824
+ errorMessage: string;
1825
+ /**
1826
+ * The name of the room that the options were attempted to be retrieved from.
1827
+ */
1828
+ roomName: string;
1829
+ /**
1830
+ * The ID of the remote that the options were attempted to be retrieved from.
1831
+ */
1832
+ remoteId: string;
1833
+ }
1834
+ /**
1835
+ * Defines an interface that represents the set of additional options that can be provided when recording a file.
1836
+ */
1837
+ export interface RecordFileOptions {
1838
+ /**
1839
+ * The description of the file.
1840
+ */
1841
+ description?: string;
1842
+ /**
1843
+ * The MIME type of the file.
1844
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types for more information.
1845
+ */
1846
+ mimeType?: string;
1847
+ /**
1848
+ * The marker that should be applied to the file.
1849
+ */
1850
+ marker?: string;
1851
+ /**
1852
+ * The markers that should be applied to the file.
1853
+ */
1854
+ markers?: string[];
1855
+ }
1856
+ /**
1857
+ * Defines an interface that represents the result of a raycast operation.
1858
+ *
1859
+ * @dochash types/os
1860
+ * @docname RaycastResult
1861
+ */
1862
+ export interface RaycastResult {
1863
+ /**
1864
+ * The list of intersections.
1865
+ */
1866
+ botIntersections: BotIntersection[];
1867
+ /**
1868
+ * The ray that the operation sent.
1869
+ */
1870
+ ray: RaycastRay;
1871
+ }
1872
+ /**
1873
+ * Defines an interface that represents the intersection of a bot and ray.
1874
+ */
1875
+ export interface BotIntersection {
1876
+ /**
1877
+ * The bot that was intersected.
1878
+ */
1879
+ bot: Bot;
1880
+ /**
1881
+ * The distance from the origin of the ray that the intersection ocurred at.
1882
+ */
1883
+ distance: number;
1884
+ /**
1885
+ * The point that the intersection ocurred at.
1886
+ */
1887
+ point: Vector3;
1888
+ /**
1889
+ * The normal that the intersection ocurred at.
1890
+ */
1891
+ normal: Vector3;
1892
+ /**
1893
+ * The face that the intersection hit.
1894
+ */
1895
+ face: string;
1896
+ /**
1897
+ * The UV coordinates that the intersection ocurred at.
1898
+ */
1899
+ uv: Vector2;
1900
+ /**
1901
+ * The portal that the bot is in.
1902
+ */
1903
+ portal: string;
1904
+ /**
1905
+ * The dimension that the bot is in.
1906
+ */
1907
+ dimension: string;
1908
+ }
1909
+ /**
1910
+ * Defines an interface that represents a ray. That is, a line that has a start position and a direction, but no end.
1911
+ *
1912
+ * @dochash types/os
1913
+ * @docname RaycastRay
1914
+ */
1915
+ export interface RaycastRay {
1916
+ /**
1917
+ * The origin of the ray.
1918
+ */
1919
+ origin: Vector3;
1920
+ /**
1921
+ * The direction that the ray travels in.
1922
+ */
1923
+ direction: Vector3;
1924
+ }
1925
+ /**
1926
+ * Defines an interface that represents a file that was uploaded.
1927
+ *
1928
+ * @dochash types/os
1929
+ * @docname UploadedFile
1930
+ */
1931
+ export interface UploadedFile {
1932
+ /**
1933
+ * The name of the file that was uploaded.
1934
+ */
1935
+ name: string;
1936
+ /**
1937
+ * The size of the file in bytes.
1938
+ */
1939
+ size: number;
1940
+ /**
1941
+ * The data that the file contains.
1942
+ */
1943
+ data: string | ArrayBuffer;
1944
+ }
1945
+ /**
1946
+ * Creates a library that includes the default functions and APIs.
1947
+ * @param context The global context that should be used.
1948
+ */
1949
+ export declare function createDefaultLibrary(context: AuxGlobalContext): {
1950
+ api: {
1951
+ _getBots: (...filters: BotFilter[]) => RuntimeBot[];
1952
+ __getBots: (tag: string, value?: any) => RuntimeBot[];
1953
+ getBots: (...filters: any[]) => RuntimeBot[];
1954
+ _getBot: (...filters: BotFilter[]) => RuntimeBot;
1955
+ __getBot: (tag: string, value?: any) => RuntimeBot;
1956
+ getBot: (...args: any[]) => RuntimeBot;
1957
+ getBotTagValues: (tag: string, filter?: TagFilter) => any[];
1958
+ getMod: (bot: any, ...tags: (string | RegExp)[]) => Mod;
1959
+ getBotPosition: (bot: RuntimeBot | string, dimension: string) => Vector3;
1960
+ getBotRotation: (bot: RuntimeBot | string, dimension: string) => Rotation;
1961
+ getID: (bot: Bot | string) => string;
1962
+ getJSON: (data: any) => string;
1963
+ getFormattedJSON: (data: any) => string;
1964
+ getSnapshot: (bots: Bot[] | Bot) => BotsState;
1965
+ diffSnapshots: (first: BotsState, second: BotsState) => PartialBotsState;
1966
+ applyDiffToSnapshot: (snapshot: BotsState, diff: PartialBotsState) => BotsState;
1967
+ getTag: (bot: Bot, ...tags: string[]) => any;
1968
+ setTag: (bot: Bot | Bot[] | BotTags, tag: string, value: any) => any;
1969
+ setTagMask: (bot: RuntimeBot | RuntimeBot[], tag: string, value: any, space?: string) => any;
1970
+ clearTagMasks: (bot: RuntimeBot | RuntimeBot[], space?: string) => void;
1971
+ insertTagText: (bot: RuntimeBot, tag: string, index: number, text: string) => string;
1972
+ insertTagMaskText: (bot: RuntimeBot, tag: string, index: number, text: string, space?: BotSpace) => string;
1973
+ deleteTagText: (bot: RuntimeBot, tag: string, index: number, count: number) => string;
1974
+ deleteTagMaskText: (bot: RuntimeBot, tag: string, index: number, count: number, space?: string) => string;
1975
+ removeTags: (bot: Bot | Bot[], tagSection: string | RegExp) => void;
1976
+ renameTag: (bot: Bot | Bot[], originalTag: string, newTag: string) => void;
1977
+ applyMod: (bot: any, ...mods: Mod[]) => void;
1978
+ subtractMods: (bot: any, ...mods: Mod[]) => void;
1979
+ _create: (...mods: Mod[]) => RuntimeBot | RuntimeBot[];
1980
+ _destroy: (bot: string | Bot | string[] | Bot[]) => void;
1981
+ destroy: {
1982
+ (bot: string | Bot | RuntimeBot | (string | Bot | RuntimeBot)[]): void;
1983
+ [INTERPRETABLE_FUNCTION]: (bot: string | Bot | RuntimeBot | (string | Bot | RuntimeBot)[]) => Generator<any, void, any>;
1984
+ };
1985
+ _changeState: (bot: Bot, stateName: string, groupName?: string) => void;
1986
+ changeState: {
1987
+ (bot: Bot, stateName: string, groupName?: string): void;
1988
+ [INTERPRETABLE_FUNCTION]: (bot: Bot, stateName: string, groupName?: string) => Generator<any, void, any>;
1989
+ };
1990
+ getLink: (...bots: (Bot | string | (Bot | string)[])[]) => string;
1991
+ getBotLinks: (bot: Bot) => ParsedBotLink[];
1992
+ _updateBotLinks: (bot: Bot, idMap: object) => void;
1993
+ updateBotLinks: (bot: Bot, idMap: Map<string, string | Bot> | {
1994
+ [id: string]: string | Bot;
1995
+ }) => void;
1996
+ getDateTime: (value: unknown) => DateTime;
1997
+ DateTime: typeof DateTime;
1998
+ /**
1999
+ * @hidden
2000
+ */
2001
+ Vector2: typeof Vector2;
2002
+ /**
2003
+ * @hidden
2004
+ */
2005
+ Vector3: typeof Vector3;
2006
+ /**
2007
+ * @hidden
2008
+ */
2009
+ Quaternion: typeof Quaternion;
2010
+ /**
2011
+ * @hidden
2012
+ */
2013
+ Rotation: typeof Rotation;
2014
+ superShout: (eventName: string, arg?: any) => SuperShoutAction;
2015
+ _priorityShout: (eventNames: string[], arg?: any) => any;
2016
+ priorityShout: {
2017
+ (eventNames: string[], arg?: any): any;
2018
+ [INTERPRETABLE_FUNCTION]: (eventNames: string[], arg?: any) => Generator<any, any, any>;
2019
+ };
2020
+ _shout: (name: string, arg?: any) => any;
2021
+ shout: {
2022
+ (name: string, arg?: any): any[];
2023
+ [name: string]: (arg?: any) => any[];
2024
+ } & {
2025
+ [INTERPRETABLE_FUNCTION]: {
2026
+ (name: string, arg?: any): Generator<any, any[], any>;
2027
+ [name: string]: (arg?: any) => Generator<any, any[], any>;
2028
+ };
2029
+ };
2030
+ _whisper: (bot: (Bot | string)[] | Bot | string, eventName: string, arg?: any) => any;
2031
+ whisper: {
2032
+ (bot: string | Bot | (string | Bot)[], eventName: string, arg?: any): any[];
2033
+ [INTERPRETABLE_FUNCTION]: (bot: string | Bot | (string | Bot)[], eventName: string, arg?: any) => Generator<any, any[], any>;
2034
+ };
2035
+ byTag: (tag: string, filter?: TagFilter) => BotFilter;
2036
+ byID: (id: string) => BotFilter;
2037
+ byMod: (mod: Mod) => BotFilter;
2038
+ inDimension: (dimension: string) => BotFilter;
2039
+ atPosition: (dimension: string, x: number, y: number) => BotFilter;
2040
+ inStack: (bot: Bot, dimension: string) => BotFilter;
2041
+ neighboring: (bot: Bot, dimension: string, direction?: 'front' | 'left' | 'right' | 'back') => BotFilter;
2042
+ bySpace: (space: string) => BotFilter;
2043
+ byCreator: (bot: Bot | string) => BotFilter;
2044
+ either: (...filters: BotFilter[]) => BotFilter;
2045
+ not: (filter: BotFilter) => BotFilter;
2046
+ remote: (action: BotAction, selector?: SessionSelector | string | (SessionSelector | string)[], allowBatching?: boolean) => RemoteAction | RemoteAction[];
2047
+ sendRemoteData: (remoteId: string | string[], name: string, arg?: any) => RemoteAction | RemoteAction[];
2048
+ remoteWhisper: (remoteId: string | string[], name: string, arg?: any) => RemoteAction | RemoteAction[];
2049
+ remoteShout: (name: string, arg?: any) => RemoteAction | RemoteAction[];
2050
+ uuid: () => string;
2051
+ _animateTag: (bot: RuntimeBot | string | (RuntimeBot | string)[], tag: string, options: AnimateTagFunctionOptions) => Promise<void>;
2052
+ __animateTag: (bot: RuntimeBot | string | (RuntimeBot | string)[], options: AnimateTagFunctionOptions) => Promise<void>;
2053
+ animateTag: {
2054
+ (bot: RuntimeBot | (RuntimeBot | string)[] | string, tag: string, options: AnimateTagFunctionOptions): Promise<void>;
2055
+ (bot: RuntimeBot | (RuntimeBot | string)[] | string, options: AnimateTagFunctionOptions): Promise<void>;
2056
+ };
2057
+ clearAnimations: (bot: RuntimeBot | (RuntimeBot | string)[] | string, tag?: string | string[]) => void;
2058
+ webhook: WebhookInterface;
2059
+ /**
2060
+ * @hidden
2061
+ */
2062
+ sleep: (time: number) => Promise<void>;
2063
+ /**
2064
+ * @hidden
2065
+ */
2066
+ __energyCheck: () => void;
2067
+ clearTimeout: (id: number) => void;
2068
+ clearInterval: (id: number) => void;
2069
+ clearWatchBot: (id: number) => void;
2070
+ clearWatchPortal: (id: number) => void;
2071
+ assert: (condition: boolean, message?: string) => void;
2072
+ assertEqual: (first: any, second: any) => void;
2073
+ expect: import("@casual-simulation/expect/src/types").Expect<import("@casual-simulation/expect/src/types").MatcherState>;
2074
+ html: HtmlFunction;
2075
+ /**
2076
+ * Gets the config bot (formerly known as the player bot).
2077
+ * This is the bot that represents the player's browser tab.
2078
+ *
2079
+ * It is `tempLocal` and is used to configure various portals.
2080
+ *
2081
+ * @example Get the config bot and set a username on it.
2082
+ * configBot.tags.username = "bob";
2083
+ *
2084
+ * @example Open the sheetPortal to "testDimension".
2085
+ * configBot.tags.sheetPortal = "testDimension";
2086
+ *
2087
+ * @dochash actions/os
2088
+ * @doctitle OS Actions
2089
+ * @docsidebar OS
2090
+ * @docdescription OS actions are used to interact with the player's current session.
2091
+ * @docname configBot
2092
+ * @docgroup 01-os
2093
+ */
2094
+ readonly _configBot: RuntimeBot;
2095
+ ai: {
2096
+ chat: {
2097
+ (message: string, options?: AIChatOptions): Promise<string>;
2098
+ (message: AIChatMessage, options?: AIChatOptions): Promise<AIChatMessage>;
2099
+ (messages: AIChatMessage[], options?: AIChatOptions): Promise<AIChatMessage>;
2100
+ };
2101
+ generateSkybox: {
2102
+ (prompt: string, negativePrompt?: string, options?: AIGenerateSkyboxOptions): Promise<string>;
2103
+ (request: AIGenerateSkyboxRequest): Promise<AIGenerateSkyboxResult>;
2104
+ };
2105
+ generateImage: {
2106
+ (prompt: string, negativePrompt?: string, options?: AIGenerateImageOptions & RecordActionOptions): Promise<string>;
2107
+ (request: AIGenerateImageOptions, options?: RecordActionOptions): Promise<AIGenerateImageAPISuccess>;
2108
+ };
2109
+ };
2110
+ os: {
2111
+ [x: symbol]: boolean;
2112
+ sleep: (time: number) => Promise<void>;
2113
+ toast: (message: string | number | boolean | object | Array<any> | null, duration?: number) => ShowToastAction;
2114
+ tip: (message: string | number | boolean | object | Array<any> | null, pixelX?: number, pixelY?: number, duration?: number) => Promise<number>;
2115
+ hideTips: (tipIds?: number | number[]) => Promise<void>;
2116
+ showJoinCode: (inst?: string, dimension?: string) => ShowJoinCodeAction;
2117
+ requestFullscreenMode: () => RequestFullscreenAction;
2118
+ exitFullscreenMode: () => ExitFullscreenAction;
2119
+ showHtml: (html: string) => ShowHtmlAction;
2120
+ hideHtml: () => HideHtmlAction;
2121
+ setClipboard: (text: string) => SetClipboardAction;
2122
+ tweenTo: (bot: Bot | string, zoomValue?: number, rotX?: number, rotY?: number, duration?: number) => FocusOnBotAction;
2123
+ moveTo: (bot: Bot | string, zoomValue?: number, rotX?: number, rotY?: number) => FocusOnBotAction;
2124
+ _focusOn_bot: (bot: Bot | string, options?: FocusOnOptions) => Promise<void>;
2125
+ _focusOn_position: (position: {
2126
+ x: number;
2127
+ y: number;
2128
+ z?: number;
2129
+ }, options?: FocusOnOptions) => Promise<void>;
2130
+ focusOn: (botOrPosition: Bot | string | {
2131
+ x: number;
2132
+ y: number;
2133
+ z?: number;
2134
+ }, options?: FocusOnOptions) => Promise<void>;
2135
+ _showChat_placeholder: (placeholder?: string) => void;
2136
+ _showChat_options: (options?: ShowChatOptions) => void;
2137
+ showChat: (placeholderOrOptions?: string | ShowChatOptions) => ShowChatBarAction;
2138
+ hideChat: () => ShowChatBarAction;
2139
+ run: (script: string) => Promise<any>;
2140
+ version: () => AuxVersion;
2141
+ device: () => AuxDevice;
2142
+ isCollaborative: () => boolean;
2143
+ getAB1BootstrapURL: () => string;
2144
+ enableAR: (options?: EnableXROptions) => EnableARAction;
2145
+ disableAR: () => EnableARAction;
2146
+ enableVR: (options?: EnableXROptions) => EnableVRAction;
2147
+ disableVR: () => EnableVRAction;
2148
+ arSupported: () => Promise<boolean>;
2149
+ vrSupported: () => Promise<boolean>;
2150
+ enablePointOfView: (center?: {
2151
+ x: number;
2152
+ y: number;
2153
+ z: number;
2154
+ }, imu?: boolean) => EnablePOVAction;
2155
+ disablePointOfView: () => EnablePOVAction;
2156
+ requestWakeLock: () => Promise<void>;
2157
+ disableWakeLock: () => Promise<void>;
2158
+ getWakeLockConfiguration: () => Promise<WakeLockConfiguration>;
2159
+ download: (data: string | object | ArrayBuffer | Blob, filename: string, mimeType?: string) => DownloadAction;
2160
+ downloadBots: (bots: Bot[], filename: string) => DownloadAction;
2161
+ downloadBotsAsInitialzationUpdate: (bots: Bot[], filename: string) => DownloadAction;
2162
+ downloadServer: () => DownloadAction;
2163
+ downloadInst: () => DownloadAction;
2164
+ showUploadAuxFile: () => ShowUploadAuxFileAction;
2165
+ showUploadFiles: () => Promise<UploadedFile[]>;
2166
+ openQRCodeScanner: (camera?: CameraType) => OpenQRCodeScannerAction;
2167
+ closeQRCodeScanner: () => OpenQRCodeScannerAction;
2168
+ showQRCode: (code: string) => ShowQRCodeAction;
2169
+ hideQRCode: () => ShowQRCodeAction;
2170
+ openBarcodeScanner: (camera?: CameraType) => OpenBarcodeScannerAction;
2171
+ closeBarcodeScanner: () => OpenBarcodeScannerAction;
2172
+ showBarcode: (code: string, format?: BarcodeFormat) => ShowBarcodeAction;
2173
+ hideBarcode: () => ShowBarcodeAction;
2174
+ openImageClassifier: (options: ImageClassifierOptions) => Promise<void>;
2175
+ closeImageClassifier: () => Promise<void>;
2176
+ openPhotoCamera: (options?: OpenPhotoCameraOptions) => Promise<void>;
2177
+ capturePhoto: (options?: OpenPhotoCameraOptions) => Promise<Photo>;
2178
+ closePhotoCamera: () => Promise<void>;
2179
+ /**
2180
+ * Gets the device-local time as the number of miliseconds since midnight January 1st, 1970 UTC-0 (i.e. the Unix Epoch). This is what your device's clock thinks the current time is.
2181
+ *
2182
+ * @example Toast the number of miliseconds since the Unix Epoch
2183
+ * os.toast(os.localTime);
2184
+ *
2185
+ * @dochash actions/time
2186
+ * @doctitle Time Actions
2187
+ * @docsidebar Time
2188
+ * @docdescription Time actions make working with time across devices easy.
2189
+ * @docgroup 01-time
2190
+ * @docname os.localTime
2191
+ */
2192
+ readonly localTime: number;
2193
+ /**
2194
+ * Gets the shared time that has been agreed upon between devices in the inst as the number of miliseconds since midnight January 1st, 1970 UTC-0 (i.e. the Unix Epoch).
2195
+ * This is what your device's clock thinks the inst clock says.
2196
+ *
2197
+ * If an agreed upon time cannot be determined (for example, because collaboration is disabled in the inst), then this value will always be `NaN`.
2198
+ *
2199
+ * @example Toast the current shared time
2200
+ * os.toast(os.agreedUponTime);
2201
+ *
2202
+ * @dochash actions/time
2203
+ * @docgroup 01-time
2204
+ * @docname os.agreedUponTime
2205
+ */
2206
+ readonly agreedUponTime: number;
2207
+ /**
2208
+ * Gets the average latency between this device's clock and the inst clock in miliseconds. Lower values tend to indicate a good connection while higher values tend to indicate a bad connection.
2209
+ *
2210
+ * If an agreed upon time cannot be determined (for example, because collaboration is disabled in the inst), then this value will always be `NaN`.
2211
+ *
2212
+ * @dochash actions/time
2213
+ * @docgroup 01-time
2214
+ * @docname os.instLatency
2215
+ */
2216
+ readonly instLatency: number;
2217
+ /**
2218
+ * Gets the calculated time offset between the inst clock and the local clock. This value is equivalent to `os.agreedUponTime - os.localTime`.
2219
+ *
2220
+ * If an agreed upon time cannot be determined (for example, because collaboration is disabled in the inst), then this value will always be `NaN`.
2221
+ *
2222
+ * @dochash actions/time
2223
+ * @docgroup 01-time
2224
+ * @docname os.instTimeOffset
2225
+ */
2226
+ readonly instTimeOffset: number;
2227
+ /**
2228
+ * Gets the spread between calculated time offsets. Higher values indicate that {@link os.agreedUponTime} is less accurate. Lower values indicate that {@link os.agreedUponTime} is more accurate.
2229
+ *
2230
+ * If an agreed upon time cannot be determined (for example, because collaboration is disabled in the inst), then this value will always be `NaN`.
2231
+ *
2232
+ * @dochash actions/time
2233
+ * @docgroup 01-time
2234
+ * @docname os.instTimeOffsetSpread
2235
+ */
2236
+ readonly instTimeOffsetSpread: number;
2237
+ /**
2238
+ * Gets the shared time that has been agreed upon between devices but with an additional 50ms offset added.
2239
+ * This offset attempts to ensure that changes/events will be recieved by all connected devices by the time it occurs, thereby making synchronized actions easier to perform.
2240
+ *
2241
+ * If an agreed upon time cannot be determined (for example, because collaboration is disabled in the inst), then this value will always be `NaN`.
2242
+ *
2243
+ * @dochash actions/time
2244
+ * @docgroup 01-time
2245
+ * @docname os.deadReckoningTime
2246
+ */
2247
+ readonly deadReckoningTime: number;
2248
+ loadServer: (id: string) => LoadServerAction;
2249
+ unloadServer: (id: string) => UnloadServerAction;
2250
+ loadInst: (id: string) => LoadServerAction;
2251
+ unloadInst: (id: string) => UnloadServerAction;
2252
+ importAUX: (urlOrJSON: string) => Promise<void>;
2253
+ parseBotsFromData: (jsonOrPdf: string | ArrayBuffer) => Bot[];
2254
+ replaceDragBot: (bot: RuntimeBot) => ReplaceDragBotAction;
2255
+ isInDimension: (dimension: string) => boolean;
2256
+ getCurrentDimension: () => string;
2257
+ getCurrentServer: () => string;
2258
+ getCurrentInst: () => string;
2259
+ getMenuDimension: () => string;
2260
+ getMiniPortalDimension: () => string;
2261
+ getPortalDimension: (portal: PortalType) => string;
2262
+ getDimensionalDepth: (dimension: string) => number;
2263
+ showInputForTag: (bot: Bot | string, tag: string, options?: Partial<ShowInputOptions>) => ShowInputForTagAction;
2264
+ _showInput: (currentValue?: any, options?: Partial<ShowInputOptions>) => Promise<any>;
2265
+ showInput: ((currentValue?: any, options?: Partial<ShowInputOptions>) => Promise<any>) & MaskableFunction;
2266
+ showConfirm: (options: ShowConfirmOptions) => Promise<boolean>;
2267
+ goToDimension: (dimension: string) => GoToDimensionAction;
2268
+ goToURL: (url: string) => GoToURLAction;
2269
+ openURL: (url: string) => OpenURLAction;
2270
+ openDevConsole: () => OpenConsoleAction;
2271
+ playSound: (url: string) => Promise<any>;
2272
+ bufferSound: (url: string) => Promise<any>;
2273
+ cancelSound: (soundId: number | string | object) => Promise<any>;
2274
+ hasBotInMiniPortal: (bots: Bot | Bot[]) => boolean;
2275
+ share: (options: ShareOptions) => Promise<void>;
2276
+ closeCircleWipe: (options?: Partial<OpenCircleWipeOptions>) => Promise<void>;
2277
+ openCircleWipe: (options?: Partial<OpenCircleWipeOptions>) => Promise<void>;
2278
+ addDropSnap: (...targets: SnapTarget[]) => AddDropSnapTargetsAction;
2279
+ addBotDropSnap: (bot: RuntimeBot | string, ...targets: SnapTarget[]) => AddDropSnapTargetsAction;
2280
+ addDropGrid: (...targets: SnapGridTarget[]) => AddDropGridTargetsAction;
2281
+ addBotDropGrid: (bot: Bot | string, ...targets: SnapGridTarget[]) => AddDropGridTargetsAction;
2282
+ enableCustomDragging: () => EnableCustomDraggingAction;
2283
+ log: (...args: any[]) => void;
2284
+ getGeolocation: () => Promise<Geolocation>;
2285
+ inSheet: () => boolean;
2286
+ getCameraPosition: (portal?: 'grid' | 'miniGrid') => Vector3;
2287
+ getCameraRotation: (portal?: 'grid' | 'miniGrid') => {
2288
+ x: number;
2289
+ y: number;
2290
+ z: number;
2291
+ };
2292
+ getFocusPoint: (portal?: 'grid' | 'miniGrid') => Vector3;
2293
+ getPointerPosition: (pointer?: 'mouse' | 'left' | 'right') => Vector3;
2294
+ getPointerRotation: (pointer?: 'mouse' | 'left' | 'right') => {
2295
+ x: number;
2296
+ y: number;
2297
+ z: number;
2298
+ };
2299
+ getPointerDirection: (pointer?: 'mouse' | 'left' | 'right') => Vector3;
2300
+ getInputState: (controller: string, button: string) => null | 'down' | 'held';
2301
+ getInputList: () => string[];
2302
+ getMediaPermission: (options: MediaPermssionOptions) => Promise<any>;
2303
+ getAverageFrameRate: () => Promise<number>;
2304
+ joinRoom: (roomName: string, options?: JoinRoomActionOptions) => Promise<JoinRoomResult>;
2305
+ leaveRoom: (roomName: string, options?: RecordActionOptions) => Promise<LeaveRoomResult>;
2306
+ setRoomOptions: (roomName: string, options: Partial<RoomOptions>) => Promise<SetRoomOptionsResult>;
2307
+ getRoomOptions: (roomName: string) => Promise<GetRoomOptionsResult>;
2308
+ getRoomTrackOptions: (roomName: string, address: string) => Promise<GetRoomTrackOptionsResult>;
2309
+ setRoomTrackOptions: (roomName: string, address: string, options: SetRoomTrackOptions) => Promise<SetRoomTrackOptionsResult>;
2310
+ getRoomRemoteOptions: (roomName: string, remoteId: string) => Promise<GetRoomRemoteOptionsResult>;
2311
+ registerTagPrefix: (prefix: string, options?: RegisterPrefixOptions) => Promise<void>;
2312
+ registerApp: (portalId: string, bot: Bot | string) => Promise<void>;
2313
+ unregisterApp: (appId: string) => Promise<void>;
2314
+ compileApp: (appId: string, content: any) => SetAppOutputAction;
2315
+ appHooks: {
2316
+ render: typeof render;
2317
+ useState<S>(initialState: S | (() => S)): [S, hooks.StateUpdater<S>];
2318
+ useState<S_1 = undefined>(): [S_1, hooks.StateUpdater<S_1>];
2319
+ useReducer<S_2, A>(reducer: hooks.Reducer<S_2, A>, initialState: S_2): [S_2, (action: A) => void];
2320
+ useReducer<S_3, A_1, I>(reducer: hooks.Reducer<S_3, A_1>, initialArg: I, init: (arg: I) => S_3): [S_3, (action: A_1) => void];
2321
+ useRef<T>(initialValue: T): hooks.MutableRef<T>;
2322
+ useRef<T_1>(initialValue: T_1): hooks.Ref<T_1>;
2323
+ useRef<T_2 = undefined>(): hooks.MutableRef<T_2>;
2324
+ useEffect(effect: hooks.EffectCallback, inputs?: hooks.Inputs): void;
2325
+ useImperativeHandle<T_3, R extends T_3>(ref: import("preact").Ref<T_3>, create: () => R, inputs?: hooks.Inputs): void;
2326
+ useLayoutEffect(effect: hooks.EffectCallback, inputs?: hooks.Inputs): void;
2327
+ useCallback<T_4 extends Function>(callback: T_4, inputs: hooks.Inputs): T_4;
2328
+ useMemo<T_5>(factory: () => T_5, inputs: hooks.Inputs): T_5;
2329
+ useContext<T_6>(context: import("preact").PreactContext<T_6>): T_6;
2330
+ useDebugValue<T_7>(value: T_7, formatter?: (value: T_7) => any): void;
2331
+ useErrorBoundary(callback?: (error: any) => void | Promise<void>): [any, () => void];
2332
+ };
2333
+ listBuiltinTags: () => string[];
2334
+ requestAuthBot: () => Promise<Bot>;
2335
+ getPublicRecordKey: (name: string) => Promise<CreatePublicRecordKeyResult>;
2336
+ getSubjectlessPublicRecordKey: (name: string) => Promise<CreatePublicRecordKeyResult>;
2337
+ grantRecordMarkerPermission: (recordName: string, marker: string, permission: AvailablePermissions, options?: RecordActionOptions) => Promise<GrantMarkerPermissionResult>;
2338
+ revokeRecordMarkerPermission: (recordName: string, marker: string, permission: AvailablePermissions, options?: RecordActionOptions) => Promise<RevokeMarkerPermissionResult>;
2339
+ grantInstAdminPermission: (recordName: string, options?: RecordActionOptions) => Promise<GrantRoleResult>;
2340
+ grantUserRole: (recordName: string, role: string, userId: string, expireTimeMs?: number, options?: RecordActionOptions) => Promise<GrantRoleResult>;
2341
+ revokeUserRole: (recordName: string, role: string, userId: string, options?: RecordActionOptions) => Promise<RevokeRoleResult>;
2342
+ grantInstRole: (recordName: string, role: string, inst: string, expireTimeMs?: number, options?: RecordActionOptions) => Promise<GrantRoleResult>;
2343
+ revokeInstRole: (recordName: string, role: string, inst: string, options?: RecordActionOptions) => Promise<RevokeRoleResult>;
2344
+ isRecordKey: (key: unknown) => boolean;
2345
+ recordData: (recordKeyOrRecordName: string, address: string, data: any, endpointOrOptions?: string | DataRecordOptions) => Promise<RecordDataResult>;
2346
+ recordManualApprovalData: (recordKeyOrRecordName: string, address: string, data: any, endpointOrOptions?: string | DataRecordOptions) => Promise<RecordDataResult>;
2347
+ getData: (recordKeyOrName: string, address: string, endpoint?: string) => Promise<GetDataResult>;
2348
+ getManualApprovalData: (recordKeyOrName: string, address: string, endpoint?: string) => Promise<GetDataResult>;
2349
+ listData: (recordKeyOrName: string, startingAddress?: string, endpoint?: string) => Promise<ListDataResult>;
2350
+ eraseData: (recordKeyOrName: string, address: string, endpoint?: string) => Promise<EraseDataResult>;
2351
+ eraseManualApprovalData: (recordKeyOrName: string, address: string, endpoint?: string) => Promise<EraseDataResult>;
2352
+ recordFile: (recordKeyOrName: string, data: any, options?: RecordFileOptions, endpoint?: string) => Promise<RecordFileApiResult>;
2353
+ getFile: {
2354
+ (result: RecordFileApiSuccess, endpoint?: string): Promise<any>;
2355
+ (url: string, endpoint?: string): Promise<any>;
2356
+ };
2357
+ getPublicFile: {
2358
+ (result: RecordFileApiSuccess): Promise<any>;
2359
+ (url: string): Promise<any>;
2360
+ };
2361
+ getPrivateFile: {
2362
+ (result: RecordFileApiSuccess, endpoint?: string): Promise<any>;
2363
+ (url: string, endpoint?: string): Promise<any>;
2364
+ };
2365
+ eraseFile: {
2366
+ (recordKeyOrName: string, result: RecordFileApiSuccess, endpoint?: string): Promise<EraseFileResult>;
2367
+ (recordKeyOrName: string, url: string, endpoint?: string): Promise<EraseFileResult>;
2368
+ };
2369
+ recordEvent: (recordKeyOrName: string, eventName: string, endpoint?: string) => Promise<AddCountResult>;
2370
+ countEvents: (recordNameOrKey: string, eventName: string, endpoint?: string) => Promise<GetCountResult>;
2371
+ listUserStudios: (endpoint?: string) => Promise<ListStudiosResult>;
2372
+ convertGeolocationToWhat3Words: (location: ConvertGeolocationToWhat3WordsOptions) => Promise<string>;
2373
+ raycastFromCamera: (portal: 'grid' | 'miniGrid' | 'map' | 'miniMap', viewportCoordinates: Vector2) => Promise<RaycastResult>;
2374
+ raycast: (portal: 'grid' | 'miniGrid' | 'map' | 'miniMap', origin: Vector3, direction: Vector3) => Promise<RaycastResult>;
2375
+ calculateRayFromCamera: (portal: 'grid' | 'miniGrid' | 'map' | 'miniMap', viewportCoordinates: Vector2) => Promise<RaycastRay>;
2376
+ bufferFormAddressGLTF: (address: string) => Promise<void>;
2377
+ startFormAnimation: (botOrBots: Bot | string | (Bot | string)[], nameOrIndex: string | number, options?: StartFormAnimationOptions) => Promise<void>;
2378
+ stopFormAnimation: (botOrBots: Bot | string | (Bot | string)[], options?: StopFormAnimationOptions) => Promise<void>;
2379
+ listFormAnimations: (botOrAddress: Bot | string) => Promise<FormAnimationData[]>;
2380
+ attachDebugger: (debug: DebuggerInterface, options?: AttachDebuggerOptions) => Promise<void>;
2381
+ detachDebugger: (debug: DebuggerInterface) => Promise<void>;
2382
+ remotes: () => Promise<string[]>;
2383
+ listInstUpdates: () => Promise<InstUpdate[]>;
2384
+ getInstStateFromUpdates: (updates: InstUpdate[]) => Promise<BotsState>;
2385
+ createInitializationUpdate: (bots: RuntimeBot[]) => Promise<InstUpdate>;
2386
+ applyUpdatesToInst: (updates: InstUpdate[]) => Promise<void>;
2387
+ getCurrentInstUpdate: () => Promise<InstUpdate>;
2388
+ mergeInstUpdates: (updates: InstUpdate[]) => InstUpdate;
2389
+ remoteCount: (inst?: string) => Promise<number>;
2390
+ totalRemoteCount: () => Promise<number>;
2391
+ beginAudioRecording: (options?: Omit<BeginAudioRecordingAction, 'type' | 'taskId'>) => Promise<void>;
2392
+ endAudioRecording: () => Promise<Blob>;
2393
+ meetCommand: (command: string, ...args: any) => Promise<void>;
2394
+ meetFunction: (functionName: string, ...args: any[]) => Promise<any>;
2395
+ readonly vars: any;
2396
+ _createDebugger_normal: (options?: NormalDebuggerOptions) => Promise<NormalDebugger>;
2397
+ _createDebugger_pausable: (options: PausableDebuggerOptions) => Promise<PausableDebugger>;
2398
+ _getExecutingDebugger: () => Debugger;
2399
+ _attachDebugger: (debug: Debugger, options?: AttachDebuggerOptions) => Promise<void>;
2400
+ _detachDebugger: (debug: Debugger) => Promise<void>;
2401
+ };
2402
+ portal: {
2403
+ registerPrefix: (prefix: string, options?: RegisterPrefixOptions) => Promise<void>;
2404
+ };
2405
+ server: {
2406
+ shell: (script: string) => RemoteAction | RemoteAction[];
2407
+ serverRemoteCount: (inst?: string) => Promise<number>;
2408
+ totalRemoteCount: () => Promise<number>;
2409
+ remotes: () => Promise<string[]>;
2410
+ players: () => Promise<string[]>;
2411
+ serverPlayerCount: (inst?: string) => Promise<number>;
2412
+ totalPlayerCount: () => Promise<number>;
2413
+ };
2414
+ action: {
2415
+ perform: (action: any) => any;
2416
+ reject: (action: any) => RejectAction;
2417
+ };
2418
+ experiment: {
2419
+ localFormAnimation: (bot: Bot | string, animation: string | number) => LocalFormAnimationAction;
2420
+ localPositionTween: (bot: Bot | string, dimension: string, position: {
2421
+ x: number;
2422
+ y: number;
2423
+ z?: number;
2424
+ }, options?: TweenOptions) => Promise<void>;
2425
+ localRotationTween: (bot: Bot | string, dimension: string, rotation: {
2426
+ x: number;
2427
+ y: number;
2428
+ z?: number;
2429
+ }, options?: TweenOptions) => Promise<void>;
2430
+ getAnchorPointPosition: (bot: Bot, dimension: string, anchorPoint: BotAnchorPoint) => {
2431
+ x: number;
2432
+ y: number;
2433
+ z: number;
2434
+ };
2435
+ beginAudioRecording: (options?: Omit<BeginAudioRecordingAction, 'type' | 'taskId'>) => Promise<void>;
2436
+ endAudioRecording: () => Promise<Blob>;
2437
+ beginRecording: (options?: RecordingOptions) => Promise<void>;
2438
+ endRecording: () => Promise<Recording>;
2439
+ speakText: (text: string, options?: SpeakTextApiOptions) => Promise<void>;
2440
+ getVoices: () => Promise<SyntheticVoice[]>;
2441
+ };
2442
+ math: {
2443
+ sum: (list: any) => number;
2444
+ avg: (list: any) => number;
2445
+ sqrt: (value: any) => number;
2446
+ abs: (number: any) => number;
2447
+ stdDev: (list: any) => number;
2448
+ getSeededRandomNumberGenerator: (seed?: number | string) => PseudoRandomNumberGenerator;
2449
+ setRandomSeed: (seed: number | string) => void;
2450
+ randomInt: (min?: number, max?: number) => number;
2451
+ random: (min?: number, max?: number) => number;
2452
+ degreesToRadians: (degrees: number) => number;
2453
+ radiansToDegrees: (radians: number) => number;
2454
+ getForwardDirection: (pointerRotation: {
2455
+ x: number;
2456
+ y: number;
2457
+ z: number;
2458
+ w?: number;
2459
+ } | Rotation) => Vector3;
2460
+ intersectPlane: (origin: {
2461
+ x: number;
2462
+ y: number;
2463
+ z: number;
2464
+ }, direction: {
2465
+ x: number;
2466
+ y: number;
2467
+ z: number;
2468
+ }, planeNormal?: {
2469
+ x: number;
2470
+ y: number;
2471
+ z: number;
2472
+ }, planeOrigin?: {
2473
+ x: number;
2474
+ y: number;
2475
+ z: number;
2476
+ }) => Vector3;
2477
+ getAnchorPointOffset: (anchorPoint: BotAnchorPoint) => Vector3;
2478
+ addVectors: <T_8>(...vectors: T_8[]) => T_8;
2479
+ subtractVectors: <T_9>(...vectors: T_9[]) => T_9;
2480
+ negateVector: <T_10>(vector: T_10) => T_10;
2481
+ normalizeVector: <T_11>(vector: T_11) => T_11;
2482
+ vectorLength: <T_12>(vector: T_12) => number;
2483
+ scaleVector: <T_13>(vector: T_13, scale: number) => T_13;
2484
+ areClose: (first: number, second: number) => boolean;
2485
+ };
2486
+ mod: {
2487
+ cameraPositionOffset: (point: {
2488
+ x?: number;
2489
+ y?: number;
2490
+ z?: number;
2491
+ }) => any;
2492
+ cameraRotationOffset: (rotation: {
2493
+ x?: number;
2494
+ y?: number;
2495
+ z?: number;
2496
+ }) => any;
2497
+ };
2498
+ bytes: {
2499
+ toBase64String: (bytes: Uint8Array) => string;
2500
+ fromBase64String: (base64: string) => Uint8Array;
2501
+ toHexString: (bytes: Uint8Array) => string;
2502
+ fromHexString: (hex: string) => Uint8Array;
2503
+ toBase64Url: (bytes: Uint8Array | string, mimeType?: string) => string;
2504
+ fromBase64Url: (url: string) => Blob;
2505
+ };
2506
+ crypto: {
2507
+ _hash_raw: (algorithm: 'sha256' | 'sha512' | 'sha1', format: 'raw', ...data: unknown[]) => Uint8Array;
2508
+ _hash_string: (algorithm: 'sha256' | 'sha512' | 'sha1', format: 'hex' | 'base64', ...data: unknown[]) => string;
2509
+ hash: {
2510
+ (algorithm: 'sha256' | 'sha512' | 'sha1', format: 'hex' | 'base64', ...data: unknown[]): string;
2511
+ (algorithm: 'sha256' | 'sha512' | 'sha1', format: 'raw', ...data: unknown[]): Uint8Array;
2512
+ };
2513
+ sha256: (...data: unknown[]) => string;
2514
+ sha512: (...data: unknown[]) => string;
2515
+ _hmac_string: (algorithm: 'sha256' | 'sha512' | 'sha1', format: 'hex' | 'base64', key: string, ...data: unknown[]) => string;
2516
+ _hmac_raw: (algorithm: 'sha256' | 'sha512' | 'sha1', format: 'raw', key: string, ...data: unknown[]) => Uint8Array;
2517
+ hmac: {
2518
+ (algorithm: 'hmac-sha256' | 'hmac-sha512' | 'hmac-sha1', format: 'hex' | 'base64', key: string, ...data: unknown[]): string;
2519
+ (algorithm: 'hmac-sha256' | 'hmac-sha512' | 'hmac-sha1', format: 'raw', key: string, ...data: unknown[]): Uint8Array;
2520
+ };
2521
+ hmacSha256: (key: string, ...data: unknown[]) => string;
2522
+ hmacSha512: (key: string, ...data: unknown[]) => string;
2523
+ encrypt: (secret: string, data: string) => string;
2524
+ decrypt: (secret: string, data: string) => string;
2525
+ isEncrypted: typeof isEncrypted;
2526
+ asymmetric: {
2527
+ keypair: (secret: string) => string;
2528
+ isKeypair: typeof isAsymmetricKeypair;
2529
+ encrypt: (keypair: string, data: string) => string;
2530
+ decrypt: (keypair: string, secret: string, data: string) => string;
2531
+ isEncrypted: typeof isAsymmetricEncrypted;
2532
+ };
2533
+ keypair: (secret: string) => string;
2534
+ sign: (keypair: string, secret: string, data: string) => string;
2535
+ verify: (keypair: string, signature: string, data: string) => boolean;
2536
+ };
2537
+ perf: {
2538
+ getStats: () => PerformanceStats;
2539
+ };
2540
+ web: {
2541
+ _webGet: (url: string, options?: WebhookOptions) => Promise<WebhookResult>;
2542
+ _webPost: (url: string, data?: any, options?: WebhookOptions) => Promise<WebhookResult>;
2543
+ _webHook: (options: WebhookOptions) => Promise<WebhookResult>;
2544
+ get: ((url: string, options?: WebhookOptions) => Promise<WebhookResult>) & MaskableFunction;
2545
+ post: ((url: string, data?: any, options?: WebhookOptions) => Promise<WebhookResult>) & MaskableFunction;
2546
+ hook: {
2547
+ (options: WebhookOptions): Promise<WebhookResult>;
2548
+ post(url: string, data?: any, options?: WebhookOptions): Promise<WebhookResult>;
2549
+ } & MaskableFunction;
2550
+ };
2551
+ analytics: {
2552
+ recordEvent: (name: string, metadata?: any) => Promise<void>;
2553
+ };
2554
+ };
2555
+ tagSpecificApi: {
2556
+ create: ((options: TagSpecificApiOptions) => (...args: any[]) => RuntimeBot | RuntimeBot[]) & {
2557
+ [INTERPRETABLE_FUNCTION]: (options: TagSpecificApiOptions) => (...args: any[]) => Generator<any, RuntimeBot | RuntimeBot[], any>;
2558
+ };
2559
+ setTimeout: (options: TagSpecificApiOptions) => (handler: (...args: any[]) => void | Generator<InterpreterStop, any, InterpreterContinuation>, timeout?: number, ...args: any[]) => number;
2560
+ setInterval: (options: TagSpecificApiOptions) => (handler: (...args: any[]) => void | Generator<InterpreterStop, any, InterpreterContinuation>, timeout?: number, ...args: any[]) => number;
2561
+ watchPortal: (options: TagSpecificApiOptions) => (portalId: string, handler: () => void | Generator<InterpreterStop, any, InterpreterContinuation>) => number;
2562
+ watchBot: (options: TagSpecificApiOptions) => (bot: (Bot | string)[] | Bot | string, handler: () => void | Generator<InterpreterStop, any, InterpreterContinuation>) => number;
2563
+ };
2564
+ };
2565
+ export type DefaultLibrary = ReturnType<typeof createDefaultLibrary>;
2566
+ //# sourceMappingURL=AuxLibrary.d.ts.map