@abyss-project/runtime 3.5.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.eslintrc.js +32 -32
  2. package/.prettierrc +5 -5
  3. package/README.md +88 -88
  4. package/dist/engine/engine-source.js +1 -1
  5. package/dist/engine/run-in-isolate.js +5 -2
  6. package/dist/engine/run-in-isolate.js.map +1 -1
  7. package/dist/interpreter/interpreter.js +19 -4
  8. package/dist/interpreter/interpreter.js.map +1 -1
  9. package/dist/interpreter/interpreter.types.d.ts +3 -0
  10. package/dist/interpreter/interpreter.types.js.map +1 -1
  11. package/dist/runner-protocol/execution-protocol.types.d.ts +12 -0
  12. package/dist/runner-protocol/execution-protocol.types.js +2 -1
  13. package/dist/runner-protocol/execution-protocol.types.js.map +1 -1
  14. package/jest.config.ts +11 -11
  15. package/package.json +15 -10
  16. package/scripts/build-engine.cjs +70 -70
  17. package/src/__tests__/engine-bundle.test.ts +121 -121
  18. package/src/__tests__/surface.test.ts +70 -66
  19. package/src/access/__tests__/host-match.test.ts +24 -24
  20. package/src/access/access.types.ts +25 -25
  21. package/src/access/host-match.ts +13 -13
  22. package/src/cost/__tests__/execution-cost.test.ts +196 -196
  23. package/src/cost/execution-cost.ts +186 -186
  24. package/src/definition/__tests__/validate-definition.test.ts +354 -354
  25. package/src/definition/definition.limits.ts +9 -9
  26. package/src/definition/definition.schema.ts +172 -172
  27. package/src/definition/definition.types.ts +171 -171
  28. package/src/definition/validate-definition.ts +206 -206
  29. package/src/definition/walk-steps.ts +44 -44
  30. package/src/discord/__tests__/discord-event-input.test.ts +89 -89
  31. package/src/discord/discord.types.ts +639 -639
  32. package/src/engine/__tests__/run-in-isolate.test.ts +468 -468
  33. package/src/engine/engine-entry.ts +3 -3
  34. package/src/engine/engine-global.ts +2 -2
  35. package/src/engine/run-in-isolate.ts +419 -404
  36. package/src/errors/runtime-error-code.enum.ts +37 -37
  37. package/src/index.ts +32 -32
  38. package/src/interpreter/__tests__/interpreter.test.ts +854 -854
  39. package/src/interpreter/__tests__/log-respond-resume.test.ts +271 -223
  40. package/src/interpreter/interpreter-error.ts +12 -12
  41. package/src/interpreter/interpreter.ts +483 -461
  42. package/src/interpreter/interpreter.types.ts +204 -192
  43. package/src/interpreter/sequence-path.ts +67 -67
  44. package/src/interpreter/test-host.ts +85 -85
  45. package/src/runner-protocol/evaluation.types.ts +21 -21
  46. package/src/runner-protocol/execution-protocol.types.ts +260 -231
  47. package/src/schedule/schedule.types.ts +100 -100
  48. package/src/server/__tests__/code-runner-session.test.ts +311 -311
  49. package/src/server/code-runner-error.ts +12 -12
  50. package/src/server/code-runner-session.ts +310 -310
  51. package/src/server/index.ts +11 -11
  52. package/src/steps/__tests__/global-references.test.ts +133 -133
  53. package/src/steps/execute-step.ts +186 -186
  54. package/src/steps/global-references.ts +48 -48
  55. package/src/steps/step-access.ts +56 -56
  56. package/src/steps/step-fields.ts +87 -87
  57. package/src/steps/value-source.ts +69 -69
  58. package/tsconfig.check.json +15 -15
  59. package/tsconfig.json +35 -35
@@ -1,223 +1,271 @@
1
- import { CURRENT_FORMAT_VERSION, LogLevel, StepType } from '../../definition/definition.types';
2
- import type { RuntimeDefinition, Step } from '../../definition/definition.types';
3
- import { RuntimeErrorCode } from '../../errors/runtime-error-code.enum';
4
- import { EvaluationKind } from '../../runner-protocol/evaluation.types';
5
- import { InterpreterError } from '../interpreter-error';
6
- import { start, step } from '../interpreter';
7
- import { CURRENT_STATE_VERSION, EffectType, RunEventType, RunStatus } from '../interpreter.types';
8
- import type { RunOptions, RunState } from '../interpreter.types';
9
- import { runToCompletion } from '../test-host';
10
-
11
- const options = (overrides: Partial<RunOptions['budget']> = {}): RunOptions => ({
12
- catalog: new Map(),
13
- grants: [],
14
- budget: { maxSteps: 100, maxEffects: 100, maxWaitMs: 1_000_000, ...overrides },
15
- });
16
-
17
- const definitionOf = (steps: Step[]): RuntimeDefinition => ({
18
- formatVersion: CURRENT_FORMAT_VERSION,
19
- accesses: [],
20
- steps,
21
- });
22
-
23
- const thrownBy = (fn: () => unknown): unknown => {
24
- try {
25
- fn();
26
- } catch (error) {
27
- return error;
28
- }
29
- throw new Error('expected a throw');
30
- };
31
-
32
- describe('LOG step', () => {
33
- const log: Step = {
34
- id: 'log',
35
- type: StepType.LOG,
36
- level: LogLevel.WARN,
37
- message: 'order {{ input.id }}',
38
- data: { total: { $expression: 'input.total' }, fixed: 1 },
39
- };
40
-
41
- it('evaluates its message and data, then emits a LOG effect', () => {
42
- const definition = definitionOf([log]);
43
- const first = start(definition, { id: 7, total: 12 }, options());
44
- expect(first.effects).toEqual([
45
- expect.objectContaining({
46
- type: EffectType.EVALUATE,
47
- items: [
48
- { id: 'message', kind: EvaluationKind.TEMPLATE, source: 'order {{ input.id }}' },
49
- { id: 'data.total', kind: EvaluationKind.EXPRESSION, source: 'input.total' },
50
- ],
51
- }),
52
- ]);
53
- const second = step(
54
- definition,
55
- first.state,
56
- {
57
- type: RunEventType.EVALUATED,
58
- results: [
59
- { id: 'message', ok: true, value: 'order 7' },
60
- { id: 'data.total', ok: true, value: 12 },
61
- ],
62
- },
63
- options(),
64
- );
65
- expect(second.effects).toEqual([
66
- {
67
- type: EffectType.LOG,
68
- stepId: 'log',
69
- level: LogLevel.WARN,
70
- message: 'order 7',
71
- data: { total: 12, fixed: 1 },
72
- },
73
- ]);
74
- const done = step(definition, second.state, { type: RunEventType.LOG_WRITTEN }, options());
75
- expect(done.status).toBe(RunStatus.SUCCEEDED);
76
- expect(done.state.outputs.log).toEqual({ output: null });
77
- });
78
-
79
- it('writes a non-string message as its JSON and omits absent data', () => {
80
- const definition = definitionOf([
81
- { id: 'log', type: StepType.LOG, level: LogLevel.INFO, message: { $expression: 'input' } },
82
- ]);
83
- const first = start(definition, null, options());
84
- const second = step(
85
- definition,
86
- first.state,
87
- { type: RunEventType.EVALUATED, results: [{ id: 'message', ok: true, value: { a: 1 } }] },
88
- options(),
89
- );
90
- expect(second.effects).toEqual([
91
- { type: EffectType.LOG, stepId: 'log', level: LogLevel.INFO, message: '{"a":1}' },
92
- ]);
93
- });
94
-
95
- it('counts against the effect budget', () => {
96
- const definition = definitionOf([
97
- { id: 'a', type: StepType.LOG, level: LogLevel.INFO, message: 'a' },
98
- { id: 'b', type: StepType.LOG, level: LogLevel.INFO, message: 'b' },
99
- ]);
100
- const first = start(definition, null, options({ maxEffects: 1 }));
101
- const second = step(
102
- definition,
103
- first.state,
104
- { type: RunEventType.LOG_WRITTEN },
105
- options({ maxEffects: 1 }),
106
- );
107
- expect(second.status).toBe(RunStatus.FAILED);
108
- expect(second.state.outcome?.error).toEqual(
109
- expect.objectContaining({ code: RuntimeErrorCode.BUDGET_EXCEEDED, stepId: 'b' }),
110
- );
111
- });
112
- });
113
-
114
- describe('RESPOND step', () => {
115
- it('emits the response with string headers, and the run goes on after it', async () => {
116
- const definition = definitionOf([
117
- {
118
- id: 'reply',
119
- type: StepType.RESPOND,
120
- status: 201,
121
- headers: { 'X-Count': 3, 'Content-Type': 'application/json' },
122
- body: { ok: true },
123
- },
124
- { id: 'after', type: StepType.SET, variable: 'x', value: 1 },
125
- ]);
126
- const responses: unknown[] = [];
127
- const { state, effects } = await runToCompletion(definition, null, options(), {
128
- evaluate: () => [],
129
- respond: (effect) => {
130
- responses.push(effect.response);
131
- },
132
- });
133
- expect(effects.map((effect) => effect.type)).toEqual([EffectType.RESPOND]);
134
- expect(responses).toEqual([
135
- {
136
- status: 201,
137
- headers: { 'X-Count': '3', 'Content-Type': 'application/json' },
138
- body: { ok: true },
139
- },
140
- ]);
141
- expect(state.status).toBe(RunStatus.SUCCEEDED);
142
- expect(state.outputs.reply).toEqual({ output: null });
143
- expect(state.vars.x).toBe(1);
144
- });
145
-
146
- it('fails the step when the status does not resolve to an HTTP status', () => {
147
- const definition = definitionOf([
148
- { id: 'reply', type: StepType.RESPOND, status: { $expression: 'input.status' } },
149
- ]);
150
- const first = start(definition, null, options());
151
- const second = step(
152
- definition,
153
- first.state,
154
- { type: RunEventType.EVALUATED, results: [{ id: 'status', ok: true, value: 700 }] },
155
- options(),
156
- );
157
- expect(second.status).toBe(RunStatus.FAILED);
158
- expect(second.state.outcome?.error).toEqual(
159
- expect.objectContaining({ code: RuntimeErrorCode.EXPRESSION_ERROR, stepId: 'reply' }),
160
- );
161
- });
162
-
163
- it('refuses a RESPONSE_SENT event for another pending effect', () => {
164
- const definition = definitionOf([{ id: 'w', type: StepType.WAIT, durationMs: 10 }]);
165
- const first = start(definition, null, options());
166
- const error = thrownBy(() =>
167
- step(definition, first.state, { type: RunEventType.RESPONSE_SENT }, options()),
168
- );
169
- expect(error).toBeInstanceOf(InterpreterError);
170
- });
171
- });
172
-
173
- describe('resume and state version', () => {
174
- const definition = definitionOf([
175
- { id: 'approve', type: StepType.WAIT, durationMs: 500 },
176
- {
177
- id: 'after',
178
- type: StepType.SET,
179
- variable: 'v',
180
- value: { $expression: 'steps.approve.output' },
181
- },
182
- ]);
183
-
184
- it('stamps every new state with the current state version', () => {
185
- expect(CURRENT_STATE_VERSION).toBe(1);
186
- expect(start(definition, null, options()).state.stateVersion).toBe(CURRENT_STATE_VERSION);
187
- });
188
-
189
- it('gives a RESUMED output to the step that suspended', () => {
190
- const first = start(definition, null, options());
191
- const persisted = JSON.parse(JSON.stringify(first.state)) as RunState;
192
- const resumed = step(
193
- definition,
194
- persisted,
195
- { type: RunEventType.RESUMED, output: { approved: true } },
196
- options(),
197
- );
198
- expect(resumed.state.outputs.approve).toEqual({ output: { approved: true } });
199
- expect(resumed.effects).toEqual([
200
- expect.objectContaining({ type: EffectType.EVALUATE, stepId: 'after' }),
201
- ]);
202
- });
203
-
204
- it('refuses RESUMED while an evaluation is pending', () => {
205
- const evaluating = definitionOf([{ id: 'c', type: StepType.CODE, source: 'return 1;' }]);
206
- const first = start(evaluating, null, options());
207
- const error = thrownBy(() =>
208
- step(evaluating, first.state, { type: RunEventType.RESUMED, output: 1 }, options()),
209
- );
210
- expect(error).toBeInstanceOf(InterpreterError);
211
- expect((error as InterpreterError).code).toBe(RuntimeErrorCode.INVALID_REQUEST);
212
- });
213
-
214
- it('refuses a state of an unknown version', () => {
215
- const first = start(definition, null, options());
216
- const future = { ...first.state, stateVersion: CURRENT_STATE_VERSION + 1 };
217
- const error = thrownBy(() =>
218
- step(definition, future, { type: RunEventType.WAIT_ELAPSED }, options()),
219
- );
220
- expect(error).toBeInstanceOf(InterpreterError);
221
- expect((error as InterpreterError).code).toBe(RuntimeErrorCode.STATE_VERSION_UNSUPPORTED);
222
- });
223
- });
1
+ import { CURRENT_FORMAT_VERSION, LogLevel, StepType } from '../../definition/definition.types';
2
+ import type { RuntimeDefinition, Step } from '../../definition/definition.types';
3
+ import { RuntimeErrorCode } from '../../errors/runtime-error-code.enum';
4
+ import { EvaluationKind } from '../../runner-protocol/evaluation.types';
5
+ import { InterpreterError } from '../interpreter-error';
6
+ import { start, step } from '../interpreter';
7
+ import { CURRENT_STATE_VERSION, EffectType, RunEventType, RunStatus } from '../interpreter.types';
8
+ import type { RunOptions, RunState } from '../interpreter.types';
9
+ import { runToCompletion } from '../test-host';
10
+
11
+ const options = (overrides: Partial<RunOptions['budget']> = {}): RunOptions => ({
12
+ catalog: new Map(),
13
+ grants: [],
14
+ budget: { maxSteps: 100, maxEffects: 100, maxWaitMs: 1_000_000, ...overrides },
15
+ });
16
+
17
+ const definitionOf = (steps: Step[]): RuntimeDefinition => ({
18
+ formatVersion: CURRENT_FORMAT_VERSION,
19
+ accesses: [],
20
+ steps,
21
+ });
22
+
23
+ const thrownBy = (fn: () => unknown): unknown => {
24
+ try {
25
+ fn();
26
+ } catch (error) {
27
+ return error;
28
+ }
29
+ throw new Error('expected a throw');
30
+ };
31
+
32
+ describe('LOG step', () => {
33
+ const log: Step = {
34
+ id: 'log',
35
+ type: StepType.LOG,
36
+ level: LogLevel.WARN,
37
+ message: 'order {{ input.id }}',
38
+ data: { total: { $expression: 'input.total' }, fixed: 1 },
39
+ };
40
+
41
+ it('evaluates its message and data, then emits a LOG effect', () => {
42
+ const definition = definitionOf([log]);
43
+ const first = start(definition, { id: 7, total: 12 }, options());
44
+ expect(first.effects).toEqual([
45
+ expect.objectContaining({
46
+ type: EffectType.EVALUATE,
47
+ items: [
48
+ { id: 'message', kind: EvaluationKind.TEMPLATE, source: 'order {{ input.id }}' },
49
+ { id: 'data.total', kind: EvaluationKind.EXPRESSION, source: 'input.total' },
50
+ ],
51
+ }),
52
+ ]);
53
+ const second = step(
54
+ definition,
55
+ first.state,
56
+ {
57
+ type: RunEventType.EVALUATED,
58
+ results: [
59
+ { id: 'message', ok: true, value: 'order 7' },
60
+ { id: 'data.total', ok: true, value: 12 },
61
+ ],
62
+ },
63
+ options(),
64
+ );
65
+ expect(second.effects).toEqual([
66
+ {
67
+ type: EffectType.LOG,
68
+ stepId: 'log',
69
+ level: LogLevel.WARN,
70
+ message: 'order 7',
71
+ data: { total: 12, fixed: 1 },
72
+ },
73
+ ]);
74
+ const done = step(definition, second.state, { type: RunEventType.LOG_WRITTEN }, options());
75
+ expect(done.status).toBe(RunStatus.SUCCEEDED);
76
+ expect(done.state.outputs.log).toEqual({ output: null });
77
+ });
78
+
79
+ it('writes a non-string message as its JSON and omits absent data', () => {
80
+ const definition = definitionOf([
81
+ { id: 'log', type: StepType.LOG, level: LogLevel.INFO, message: { $expression: 'input' } },
82
+ ]);
83
+ const first = start(definition, null, options());
84
+ const second = step(
85
+ definition,
86
+ first.state,
87
+ { type: RunEventType.EVALUATED, results: [{ id: 'message', ok: true, value: { a: 1 } }] },
88
+ options(),
89
+ );
90
+ expect(second.effects).toEqual([
91
+ { type: EffectType.LOG, stepId: 'log', level: LogLevel.INFO, message: '{"a":1}' },
92
+ ]);
93
+ });
94
+
95
+ it('counts against the effect budget', () => {
96
+ const definition = definitionOf([
97
+ { id: 'a', type: StepType.LOG, level: LogLevel.INFO, message: 'a' },
98
+ { id: 'b', type: StepType.LOG, level: LogLevel.INFO, message: 'b' },
99
+ ]);
100
+ const first = start(definition, null, options({ maxEffects: 1 }));
101
+ const second = step(
102
+ definition,
103
+ first.state,
104
+ { type: RunEventType.LOG_WRITTEN },
105
+ options({ maxEffects: 1 }),
106
+ );
107
+ expect(second.status).toBe(RunStatus.FAILED);
108
+ expect(second.state.outcome?.error).toEqual(
109
+ expect.objectContaining({ code: RuntimeErrorCode.BUDGET_EXCEEDED, stepId: 'b' }),
110
+ );
111
+ });
112
+
113
+ const threeLogs = definitionOf(
114
+ ['a', 'b', 'c'].map((id) => ({
115
+ id,
116
+ type: StepType.LOG as const,
117
+ level: LogLevel.INFO,
118
+ message: id,
119
+ })),
120
+ );
121
+
122
+ it('keeps LOG out of maxEffects when maxLogLines is given, and counts them apart', () => {
123
+ const budget = { maxEffects: 0, maxLogLines: 5 };
124
+ const first = start(threeLogs, null, options(budget));
125
+ expect(first.status).toBe(RunStatus.WAITING);
126
+ const second = step(
127
+ threeLogs,
128
+ first.state,
129
+ { type: RunEventType.LOG_WRITTEN },
130
+ options(budget),
131
+ );
132
+ const third = step(
133
+ threeLogs,
134
+ second.state,
135
+ { type: RunEventType.LOG_WRITTEN },
136
+ options(budget),
137
+ );
138
+ const done = step(threeLogs, third.state, { type: RunEventType.LOG_WRITTEN }, options(budget));
139
+ expect(done.status).toBe(RunStatus.SUCCEEDED);
140
+ expect(done.state.counters).toEqual({ steps: 3, effects: 0, logLines: 3 });
141
+ });
142
+
143
+ it('answers a LOG past maxLogLines without emitting it', () => {
144
+ const budget = { maxLogLines: 1 };
145
+ const first = start(threeLogs, null, options(budget));
146
+ expect(first.effects).toEqual([expect.objectContaining({ type: EffectType.LOG, stepId: 'a' })]);
147
+ const second = step(
148
+ threeLogs,
149
+ first.state,
150
+ { type: RunEventType.LOG_WRITTEN },
151
+ options(budget),
152
+ );
153
+ expect(second.status).toBe(RunStatus.SUCCEEDED);
154
+ expect(second.effects).toEqual([]);
155
+ expect(second.state.outputs.b).toEqual({ output: null });
156
+ expect(second.state.outputs.c).toEqual({ output: null });
157
+ expect(second.state.counters.logLines).toBe(1);
158
+ expect(second.state.counters.droppedLogLines).toBe(2);
159
+ });
160
+ });
161
+
162
+ describe('RESPOND step', () => {
163
+ it('emits the response with string headers, and the run goes on after it', async () => {
164
+ const definition = definitionOf([
165
+ {
166
+ id: 'reply',
167
+ type: StepType.RESPOND,
168
+ status: 201,
169
+ headers: { 'X-Count': 3, 'Content-Type': 'application/json' },
170
+ body: { ok: true },
171
+ },
172
+ { id: 'after', type: StepType.SET, variable: 'x', value: 1 },
173
+ ]);
174
+ const responses: unknown[] = [];
175
+ const { state, effects } = await runToCompletion(definition, null, options(), {
176
+ evaluate: () => [],
177
+ respond: (effect) => {
178
+ responses.push(effect.response);
179
+ },
180
+ });
181
+ expect(effects.map((effect) => effect.type)).toEqual([EffectType.RESPOND]);
182
+ expect(responses).toEqual([
183
+ {
184
+ status: 201,
185
+ headers: { 'X-Count': '3', 'Content-Type': 'application/json' },
186
+ body: { ok: true },
187
+ },
188
+ ]);
189
+ expect(state.status).toBe(RunStatus.SUCCEEDED);
190
+ expect(state.outputs.reply).toEqual({ output: null });
191
+ expect(state.vars.x).toBe(1);
192
+ });
193
+
194
+ it('fails the step when the status does not resolve to an HTTP status', () => {
195
+ const definition = definitionOf([
196
+ { id: 'reply', type: StepType.RESPOND, status: { $expression: 'input.status' } },
197
+ ]);
198
+ const first = start(definition, null, options());
199
+ const second = step(
200
+ definition,
201
+ first.state,
202
+ { type: RunEventType.EVALUATED, results: [{ id: 'status', ok: true, value: 700 }] },
203
+ options(),
204
+ );
205
+ expect(second.status).toBe(RunStatus.FAILED);
206
+ expect(second.state.outcome?.error).toEqual(
207
+ expect.objectContaining({ code: RuntimeErrorCode.EXPRESSION_ERROR, stepId: 'reply' }),
208
+ );
209
+ });
210
+
211
+ it('refuses a RESPONSE_SENT event for another pending effect', () => {
212
+ const definition = definitionOf([{ id: 'w', type: StepType.WAIT, durationMs: 10 }]);
213
+ const first = start(definition, null, options());
214
+ const error = thrownBy(() =>
215
+ step(definition, first.state, { type: RunEventType.RESPONSE_SENT }, options()),
216
+ );
217
+ expect(error).toBeInstanceOf(InterpreterError);
218
+ });
219
+ });
220
+
221
+ describe('resume and state version', () => {
222
+ const definition = definitionOf([
223
+ { id: 'approve', type: StepType.WAIT, durationMs: 500 },
224
+ {
225
+ id: 'after',
226
+ type: StepType.SET,
227
+ variable: 'v',
228
+ value: { $expression: 'steps.approve.output' },
229
+ },
230
+ ]);
231
+
232
+ it('stamps every new state with the current state version', () => {
233
+ expect(CURRENT_STATE_VERSION).toBe(1);
234
+ expect(start(definition, null, options()).state.stateVersion).toBe(CURRENT_STATE_VERSION);
235
+ });
236
+
237
+ it('gives a RESUMED output to the step that suspended', () => {
238
+ const first = start(definition, null, options());
239
+ const persisted = JSON.parse(JSON.stringify(first.state)) as RunState;
240
+ const resumed = step(
241
+ definition,
242
+ persisted,
243
+ { type: RunEventType.RESUMED, output: { approved: true } },
244
+ options(),
245
+ );
246
+ expect(resumed.state.outputs.approve).toEqual({ output: { approved: true } });
247
+ expect(resumed.effects).toEqual([
248
+ expect.objectContaining({ type: EffectType.EVALUATE, stepId: 'after' }),
249
+ ]);
250
+ });
251
+
252
+ it('refuses RESUMED while an evaluation is pending', () => {
253
+ const evaluating = definitionOf([{ id: 'c', type: StepType.CODE, source: 'return 1;' }]);
254
+ const first = start(evaluating, null, options());
255
+ const error = thrownBy(() =>
256
+ step(evaluating, first.state, { type: RunEventType.RESUMED, output: 1 }, options()),
257
+ );
258
+ expect(error).toBeInstanceOf(InterpreterError);
259
+ expect((error as InterpreterError).code).toBe(RuntimeErrorCode.INVALID_REQUEST);
260
+ });
261
+
262
+ it('refuses a state of an unknown version', () => {
263
+ const first = start(definition, null, options());
264
+ const future = { ...first.state, stateVersion: CURRENT_STATE_VERSION + 1 };
265
+ const error = thrownBy(() =>
266
+ step(definition, future, { type: RunEventType.WAIT_ELAPSED }, options()),
267
+ );
268
+ expect(error).toBeInstanceOf(InterpreterError);
269
+ expect((error as InterpreterError).code).toBe(RuntimeErrorCode.STATE_VERSION_UNSUPPORTED);
270
+ });
271
+ });
@@ -1,12 +1,12 @@
1
- import { RuntimeErrorCode } from '../errors/runtime-error-code.enum';
2
-
3
- /** Thrown for a misuse of the interpreter (unexpected event, corrupted state), never for a run failure. */
4
- export class InterpreterError extends Error {
5
- readonly code: RuntimeErrorCode;
6
-
7
- constructor(code: RuntimeErrorCode, message: string) {
8
- super(message);
9
- this.name = 'InterpreterError';
10
- this.code = code;
11
- }
12
- }
1
+ import { RuntimeErrorCode } from '../errors/runtime-error-code.enum';
2
+
3
+ /** Thrown for a misuse of the interpreter (unexpected event, corrupted state), never for a run failure. */
4
+ export class InterpreterError extends Error {
5
+ readonly code: RuntimeErrorCode;
6
+
7
+ constructor(code: RuntimeErrorCode, message: string) {
8
+ super(message);
9
+ this.name = 'InterpreterError';
10
+ this.code = code;
11
+ }
12
+ }