@casual-simulation/aux-common 3.1.8 → 3.1.9-alpha.3340590989
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.
- package/math/Vector2.js +6 -1
- package/math/Vector2.js.map +1 -1
- package/math/Vector3.js +6 -1
- package/math/Vector3.js.map +1 -1
- package/package.json +4 -2
- package/runtime/AuxCompiler.d.ts +74 -1
- package/runtime/AuxCompiler.js +332 -25
- package/runtime/AuxCompiler.js.map +1 -1
- package/runtime/AuxGlobalContext.d.ts +14 -4
- package/runtime/AuxGlobalContext.js +9 -1
- package/runtime/AuxGlobalContext.js.map +1 -1
- package/runtime/AuxLibrary.d.ts +191 -10
- package/runtime/AuxLibrary.js +172 -37
- package/runtime/AuxLibrary.js.map +1 -1
- package/runtime/AuxLibraryDefinitions.def +469 -82
- package/runtime/AuxRuntime.d.ts +66 -7
- package/runtime/AuxRuntime.js +976 -118
- package/runtime/AuxRuntime.js.map +1 -1
- package/runtime/AuxRuntimeDynamicImports.d.ts +14 -0
- package/runtime/AuxRuntimeDynamicImports.js +24 -0
- package/runtime/AuxRuntimeDynamicImports.js.map +1 -0
- package/runtime/CompiledBot.d.ts +59 -1
- package/runtime/CompiledBot.js +2 -0
- package/runtime/CompiledBot.js.map +1 -1
- package/runtime/RuntimeBot.d.ts +17 -0
- package/runtime/RuntimeBot.js +85 -5
- package/runtime/RuntimeBot.js.map +1 -1
- package/runtime/Transpiler.d.ts +21 -0
- package/runtime/Transpiler.js +27 -0
- package/runtime/Transpiler.js.map +1 -1
- package/runtime/Utils.d.ts +11 -0
- package/runtime/Utils.js +30 -1
- package/runtime/Utils.js.map +1 -1
- package/runtime/test/RuntimeTestHelpers.d.ts +5 -0
- package/runtime/test/RuntimeTestHelpers.js +11 -0
- package/runtime/test/RuntimeTestHelpers.js.map +1 -1
- package/test/TestHelpers.js +2 -2
- package/test/TestHelpers.js.map +1 -1
package/runtime/AuxRuntime.d.ts
CHANGED
|
@@ -2,26 +2,34 @@ import { BotAction, StateUpdatedEvent, Bot, BotSpace, RuntimeBot, CompiledBotLis
|
|
|
2
2
|
import { Observable, SubscriptionLike } from 'rxjs';
|
|
3
3
|
import { AuxGlobalContext } from './AuxGlobalContext';
|
|
4
4
|
import { AuxLibrary } from './AuxLibrary';
|
|
5
|
-
import { RuntimeBotInterface, RuntimeBotFactory, RealtimeEditMode, RealtimeEditConfig } from './RuntimeBot';
|
|
6
|
-
import { CompiledBot, CompiledBotsState } from './CompiledBot';
|
|
5
|
+
import { RuntimeBotInterface, RuntimeBotFactory, RealtimeEditMode, RealtimeEditConfig, RuntimeInterpreterGeneratorProcessor } from './RuntimeBot';
|
|
6
|
+
import { CompiledBot, CompiledBotsState, RuntimeBreakpoint, RuntimeStop } from './CompiledBot';
|
|
7
7
|
import { ScriptError, ActionResult } from './AuxResults';
|
|
8
8
|
import { AuxVersion } from './AuxVersion';
|
|
9
9
|
import { AuxDevice } from './AuxDevice';
|
|
10
|
+
import { RuntimePromise } from './Utils';
|
|
10
11
|
import { AuxRealtimeEditModeProvider } from './AuxRealtimeEditModeProvider';
|
|
11
12
|
import { CurrentVersion } from '@casual-simulation/causal-trees';
|
|
12
13
|
import { RuntimeStateVersion } from './RuntimeStateVersion';
|
|
14
|
+
import type { Interpreter as InterpreterType, InterpreterContinuation, InterpreterStop } from '@casual-simulation/js-interpreter';
|
|
15
|
+
export declare function registerInterpreterModule(module: any): void;
|
|
13
16
|
/**
|
|
14
17
|
* Defines an class that is able to manage the runtime state of an AUX.
|
|
15
18
|
*
|
|
16
19
|
* Being a runtime means providing and managing the execution state that an AUX is in.
|
|
17
20
|
* This means taking state updates events, shouts and whispers, and emitting additional events to affect the future state.
|
|
18
21
|
*/
|
|
19
|
-
export declare class AuxRuntime implements RuntimeBotInterface, RuntimeBotFactory, SubscriptionLike {
|
|
22
|
+
export declare class AuxRuntime implements RuntimeBotInterface, RuntimeBotFactory, RuntimeInterpreterGeneratorProcessor, SubscriptionLike {
|
|
20
23
|
private _compiledState;
|
|
21
24
|
private _existingMasks;
|
|
22
25
|
private _compiler;
|
|
23
26
|
private _onActions;
|
|
24
27
|
private _onErrors;
|
|
28
|
+
private _onRuntimeStop;
|
|
29
|
+
private _stopState;
|
|
30
|
+
private _breakpoints;
|
|
31
|
+
private _currentStopCount;
|
|
32
|
+
private _currentPromise;
|
|
25
33
|
private _actionBatch;
|
|
26
34
|
private _errorBatch;
|
|
27
35
|
private _userId;
|
|
@@ -35,11 +43,15 @@ export declare class AuxRuntime implements RuntimeBotInterface, RuntimeBotFactor
|
|
|
35
43
|
private _forceSignedScripts;
|
|
36
44
|
private _exemptSpaces;
|
|
37
45
|
private _batchPending;
|
|
46
|
+
private _jobQueueCheckPending;
|
|
47
|
+
private _jobQueueCheckCount;
|
|
38
48
|
private _processingErrors;
|
|
39
49
|
private _portalBots;
|
|
40
50
|
private _builtinPortalBots;
|
|
41
51
|
private _globalChanges;
|
|
42
52
|
private _globalObject;
|
|
53
|
+
private _interpretedApi;
|
|
54
|
+
private _interpretedTagSpecificApi;
|
|
43
55
|
/**
|
|
44
56
|
* The counter that is used to generate function names.
|
|
45
57
|
*/
|
|
@@ -59,17 +71,20 @@ export declare class AuxRuntime implements RuntimeBotInterface, RuntimeBotFactor
|
|
|
59
71
|
private _forceSyncScripts;
|
|
60
72
|
private _currentDebugger;
|
|
61
73
|
private _libraryFactory;
|
|
74
|
+
private _interpreter;
|
|
62
75
|
get forceSignedScripts(): boolean;
|
|
63
76
|
get context(): AuxGlobalContext;
|
|
64
77
|
get currentVersion(): RuntimeStateVersion;
|
|
65
78
|
get globalObject(): any;
|
|
79
|
+
get canTriggerBreakpoint(): boolean;
|
|
66
80
|
/**
|
|
67
81
|
* Creates a new AuxRuntime using the given library factory.
|
|
68
82
|
* @param libraryFactory
|
|
69
83
|
* @param forceSignedScripts Whether to force the runtime to only allow scripts that are signed.
|
|
70
84
|
* @param exemptSpaces The spaces that are exempt from requiring signed scripts.
|
|
85
|
+
* @param interpreter The interpreter that should be used for the runtime.
|
|
71
86
|
*/
|
|
72
|
-
constructor(version: AuxVersion, device: AuxDevice, libraryFactory?: (context: AuxGlobalContext) => AuxLibrary, editModeProvider?: AuxRealtimeEditModeProvider, forceSignedScripts?: boolean, exemptSpaces?: BotSpace[], forceSyncScripts?: boolean);
|
|
87
|
+
constructor(version: AuxVersion, device: AuxDevice, libraryFactory?: (context: AuxGlobalContext) => AuxLibrary, editModeProvider?: AuxRealtimeEditModeProvider, forceSignedScripts?: boolean, exemptSpaces?: BotSpace[], forceSyncScripts?: boolean, interpreter?: InterpreterType);
|
|
73
88
|
getShoutTimers(): {
|
|
74
89
|
[shout: string]: number;
|
|
75
90
|
};
|
|
@@ -90,6 +105,10 @@ export declare class AuxRuntime implements RuntimeBotInterface, RuntimeBotFactor
|
|
|
90
105
|
* An observable that resolves whenever the runtime issues an error.
|
|
91
106
|
*/
|
|
92
107
|
get onErrors(): Observable<ScriptError[]>;
|
|
108
|
+
/**
|
|
109
|
+
* An observable that resolves whenever the runtime pauses in a script.
|
|
110
|
+
*/
|
|
111
|
+
get onRuntimeStop(): Observable<RuntimeStop>;
|
|
93
112
|
/**
|
|
94
113
|
* Processes the given bot actions and dispatches the resulting actions in the future.
|
|
95
114
|
* @param actions The actions to process.
|
|
@@ -101,6 +120,19 @@ export declare class AuxRuntime implements RuntimeBotInterface, RuntimeBotFactor
|
|
|
101
120
|
private _processAction;
|
|
102
121
|
private _registerPortalBot;
|
|
103
122
|
private _rejectAction;
|
|
123
|
+
/**
|
|
124
|
+
* Executes the given function based on the current execution state of the runtime.
|
|
125
|
+
* If the runtime is stopped, then the given function will be executed after the current promise finishes.
|
|
126
|
+
* If the runtime is executing normally, then the given function will be executed immediately.
|
|
127
|
+
* Returns the function result if the function executes immediately,
|
|
128
|
+
* or returns a runtime promise if the function executes after the current promise.
|
|
129
|
+
*
|
|
130
|
+
* This function essentially forces the given function to execute synchronously with respect to other functions wrapped with this function.
|
|
131
|
+
*
|
|
132
|
+
* @param func The function to execute.
|
|
133
|
+
*
|
|
134
|
+
*/
|
|
135
|
+
private _wrapWithCurrentPromise;
|
|
104
136
|
/**
|
|
105
137
|
* Executes a shout with the given event name on the given bot IDs with the given argument.
|
|
106
138
|
* Also dispatches any actions and errors that occur.
|
|
@@ -108,17 +140,26 @@ export declare class AuxRuntime implements RuntimeBotInterface, RuntimeBotFactor
|
|
|
108
140
|
* @param botIds The Bot IDs that the shout is being sent to.
|
|
109
141
|
* @param arg The argument to include in the shout.
|
|
110
142
|
*/
|
|
111
|
-
shout(eventName: string, botIds?: string[], arg?: any): ActionResult
|
|
143
|
+
shout(eventName: string, botIds?: string[], arg?: any): MaybeRuntimePromise<ActionResult>;
|
|
144
|
+
/**
|
|
145
|
+
* Executes the given shout synchronously with respect to other scripts that may be running or paused.
|
|
146
|
+
* @param eventName The name of the event that should be executed.
|
|
147
|
+
* @param botIds The IDs of the bots that the shout should be sent to.
|
|
148
|
+
* @param arg The argument that should be sent with the shout.
|
|
149
|
+
* @param batch Whether to batch events.
|
|
150
|
+
* @param resetEnergy Whether to reset the runtime energy before executing the shout.
|
|
151
|
+
*/
|
|
152
|
+
private _synchronousShout;
|
|
112
153
|
private _shout;
|
|
113
154
|
/**
|
|
114
155
|
* Executes the given script.
|
|
115
156
|
* @param script The script to run.
|
|
116
157
|
*/
|
|
117
|
-
execute(script: string): {
|
|
158
|
+
execute(script: string): MaybeRuntimePromise<{
|
|
118
159
|
result: any;
|
|
119
160
|
actions: BotAction[];
|
|
120
161
|
errors: ScriptError[];
|
|
121
|
-
}
|
|
162
|
+
}>;
|
|
122
163
|
private _execute;
|
|
123
164
|
/**
|
|
124
165
|
* Signals to the runtime that the bots state has been updated.
|
|
@@ -179,5 +220,23 @@ export declare class AuxRuntime implements RuntimeBotInterface, RuntimeBotFactor
|
|
|
179
220
|
private _mapBotsToRuntimeBots;
|
|
180
221
|
private _mapBotsToRuntimeBotsCore;
|
|
181
222
|
private _getFunctionNamesForBot;
|
|
223
|
+
setBreakpoint(breakpoint: RuntimeBreakpoint): void;
|
|
224
|
+
removeBreakpoint(breakpointId: string): void;
|
|
225
|
+
continueAfterStop(stopId: RuntimeStop['stopId'], continuation?: InterpreterContinuation): void;
|
|
226
|
+
private _scheduleJob;
|
|
227
|
+
private _scheduleJobQueueCheck;
|
|
228
|
+
private _processJobQueueNow;
|
|
229
|
+
processGenerator<T>(generator: Generator<InterpreterStop, T, InterpreterContinuation>): void;
|
|
230
|
+
private _processGenerator;
|
|
231
|
+
private _executeGenerator;
|
|
182
232
|
}
|
|
233
|
+
declare type MaybeRuntimePromise<T> = T | RuntimePromise<T>;
|
|
234
|
+
/**
|
|
235
|
+
* Recursively maps each of the given library's functions using the given map function and returns a new library that contains the converted functions.
|
|
236
|
+
* The returned object will contain the same enumerable properties as the original library except that its functions have been mapped.
|
|
237
|
+
* @param library The library to map.
|
|
238
|
+
* @param map The function to use for mapping library functions.
|
|
239
|
+
*/
|
|
240
|
+
export declare function mapLibraryFunctions<T extends AuxLibrary>(library: T, map: (func: Function, key: string) => any): T;
|
|
241
|
+
export {};
|
|
183
242
|
//# sourceMappingURL=AuxRuntime.d.ts.map
|