@casual-simulation/aux-common 3.2.6 → 3.2.7-alpha.6227012901

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