@abyss-project/runtime 3.11.0 → 3.13.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 (64) hide show
  1. package/.eslintrc.js +32 -32
  2. package/dist/definition/definition.schema.js +6 -0
  3. package/dist/definition/definition.schema.js.map +1 -1
  4. package/dist/definition/definition.types.d.ts +11 -0
  5. package/dist/definition/definition.types.js +6 -1
  6. package/dist/definition/definition.types.js.map +1 -1
  7. package/dist/engine/engine-source.js +1 -1
  8. package/dist/errors/runtime-error-code.enum.d.ts +1 -0
  9. package/dist/errors/runtime-error-code.enum.js +1 -0
  10. package/dist/errors/runtime-error-code.enum.js.map +1 -1
  11. package/dist/runner-protocol/evaluation.types.d.ts +1 -0
  12. package/dist/steps/global-references.js +7 -0
  13. package/dist/steps/global-references.js.map +1 -1
  14. package/dist/steps/step-fields.js +10 -0
  15. package/dist/steps/step-fields.js.map +1 -1
  16. package/jest.config.ts +11 -11
  17. package/package.json +1 -1
  18. package/scripts/build-engine.cjs +70 -70
  19. package/src/__tests__/engine-bundle.test.ts +121 -121
  20. package/src/__tests__/surface.test.ts +81 -81
  21. package/src/access/__tests__/host-match.test.ts +24 -24
  22. package/src/access/access.types.ts +25 -25
  23. package/src/access/host-match.ts +13 -13
  24. package/src/cost/__tests__/execution-cost.test.ts +249 -249
  25. package/src/cost/execution-cost.ts +203 -203
  26. package/src/definition/__tests__/code-step.test.ts +56 -0
  27. package/src/definition/__tests__/validate-definition.test.ts +354 -354
  28. package/src/definition/definition.limits.ts +9 -9
  29. package/src/definition/definition.schema.ts +7 -0
  30. package/src/definition/definition.types.ts +21 -1
  31. package/src/definition/validate-definition.ts +206 -206
  32. package/src/definition/walk-steps.ts +44 -44
  33. package/src/discord/__tests__/discord-event-input.test.ts +90 -90
  34. package/src/discord/discord.types.ts +696 -696
  35. package/src/engine/__tests__/run-in-isolate.test.ts +519 -519
  36. package/src/engine/engine-entry.ts +3 -3
  37. package/src/engine/engine-global.ts +2 -2
  38. package/src/engine/run-in-isolate.ts +462 -462
  39. package/src/errors/runtime-error-code.enum.ts +5 -0
  40. package/src/index.ts +32 -32
  41. package/src/interpreter/__tests__/interpreter.test.ts +854 -854
  42. package/src/interpreter/__tests__/log-respond-resume.test.ts +271 -271
  43. package/src/interpreter/interpreter-error.ts +12 -12
  44. package/src/interpreter/interpreter.ts +483 -483
  45. package/src/interpreter/interpreter.types.ts +204 -204
  46. package/src/interpreter/sequence-path.ts +67 -67
  47. package/src/interpreter/test-host.ts +85 -85
  48. package/src/runner-protocol/__tests__/file-payload.test.ts +26 -26
  49. package/src/runner-protocol/evaluation.types.ts +2 -0
  50. package/src/runner-protocol/execution-protocol.types.ts +297 -297
  51. package/src/schedule/schedule.types.ts +100 -100
  52. package/src/server/__tests__/code-runner-session.test.ts +311 -311
  53. package/src/server/code-runner-error.ts +12 -12
  54. package/src/server/code-runner-session.ts +310 -310
  55. package/src/server/index.ts +11 -11
  56. package/src/steps/__tests__/global-references.test.ts +140 -124
  57. package/src/steps/__tests__/step-fields.test.ts +58 -0
  58. package/src/steps/execute-step.ts +186 -186
  59. package/src/steps/global-references.ts +56 -48
  60. package/src/steps/step-access.ts +56 -56
  61. package/src/steps/step-fields.ts +10 -0
  62. package/src/steps/value-source.ts +69 -69
  63. package/tsconfig.check.json +15 -15
  64. package/tsconfig.json +35 -35
@@ -1,69 +1,69 @@
1
- import { EvaluationKind } from '../runner-protocol/evaluation.types';
2
- import type { EvaluationItem } from '../runner-protocol/evaluation.types';
3
- import type { ExpressionValue, ValueSource } from '../definition/definition.types';
4
-
5
- const TEMPLATE_PATTERN = /\{\{[\s\S]*?\}\}/;
6
- const IDENTIFIER_KEY = /^[A-Za-z_$][\w$-]*$/;
7
-
8
- export const isExpressionValue = (value: ValueSource): value is ExpressionValue =>
9
- typeof value === 'object' &&
10
- value !== null &&
11
- !Array.isArray(value) &&
12
- Object.keys(value).length === 1 &&
13
- typeof (value as ExpressionValue).$expression === 'string';
14
-
15
- /** Field path of a property, unambiguous whatever the key: `a.b`, `a["x.y"]`. */
16
- export const propertyPath = (base: string, key: string): string =>
17
- IDENTIFIER_KEY.test(key) ? `${base}.${key}` : `${base}[${JSON.stringify(key)}]`;
18
-
19
- const indexPath = (base: string, index: number): string => `${base}[${index}]`;
20
-
21
- /** Appends one item per non-literal value found in `source`; the item id is its field path. */
22
- export const collectItems = (path: string, source: ValueSource, items: EvaluationItem[]): void => {
23
- if (typeof source === 'string') {
24
- if (TEMPLATE_PATTERN.test(source)) {
25
- items.push({ id: path, kind: EvaluationKind.TEMPLATE, source });
26
- }
27
- return;
28
- }
29
- if (source === null || typeof source !== 'object') {
30
- return;
31
- }
32
- if (isExpressionValue(source)) {
33
- items.push({ id: path, kind: EvaluationKind.EXPRESSION, source: source.$expression });
34
- return;
35
- }
36
- if (Array.isArray(source)) {
37
- source.forEach((entry, index) => collectItems(indexPath(path, index), entry, items));
38
- return;
39
- }
40
- for (const [key, entry] of Object.entries(source)) {
41
- collectItems(propertyPath(path, key), entry, items);
42
- }
43
- };
44
-
45
- /** Rebuilds `source` with every non-literal value replaced by its evaluated result. */
46
- export const resolveValue = (
47
- path: string,
48
- source: ValueSource,
49
- results: ReadonlyMap<string, unknown>,
50
- ): unknown => {
51
- if (typeof source === 'string') {
52
- return TEMPLATE_PATTERN.test(source) ? results.get(path) : source;
53
- }
54
- if (source === null || typeof source !== 'object') {
55
- return source;
56
- }
57
- if (isExpressionValue(source)) {
58
- return results.get(path);
59
- }
60
- if (Array.isArray(source)) {
61
- return source.map((entry, index) => resolveValue(indexPath(path, index), entry, results));
62
- }
63
- return Object.fromEntries(
64
- Object.entries(source).map(([key, entry]) => [
65
- key,
66
- resolveValue(propertyPath(path, key), entry, results),
67
- ]),
68
- );
69
- };
1
+ import { EvaluationKind } from '../runner-protocol/evaluation.types';
2
+ import type { EvaluationItem } from '../runner-protocol/evaluation.types';
3
+ import type { ExpressionValue, ValueSource } from '../definition/definition.types';
4
+
5
+ const TEMPLATE_PATTERN = /\{\{[\s\S]*?\}\}/;
6
+ const IDENTIFIER_KEY = /^[A-Za-z_$][\w$-]*$/;
7
+
8
+ export const isExpressionValue = (value: ValueSource): value is ExpressionValue =>
9
+ typeof value === 'object' &&
10
+ value !== null &&
11
+ !Array.isArray(value) &&
12
+ Object.keys(value).length === 1 &&
13
+ typeof (value as ExpressionValue).$expression === 'string';
14
+
15
+ /** Field path of a property, unambiguous whatever the key: `a.b`, `a["x.y"]`. */
16
+ export const propertyPath = (base: string, key: string): string =>
17
+ IDENTIFIER_KEY.test(key) ? `${base}.${key}` : `${base}[${JSON.stringify(key)}]`;
18
+
19
+ const indexPath = (base: string, index: number): string => `${base}[${index}]`;
20
+
21
+ /** Appends one item per non-literal value found in `source`; the item id is its field path. */
22
+ export const collectItems = (path: string, source: ValueSource, items: EvaluationItem[]): void => {
23
+ if (typeof source === 'string') {
24
+ if (TEMPLATE_PATTERN.test(source)) {
25
+ items.push({ id: path, kind: EvaluationKind.TEMPLATE, source });
26
+ }
27
+ return;
28
+ }
29
+ if (source === null || typeof source !== 'object') {
30
+ return;
31
+ }
32
+ if (isExpressionValue(source)) {
33
+ items.push({ id: path, kind: EvaluationKind.EXPRESSION, source: source.$expression });
34
+ return;
35
+ }
36
+ if (Array.isArray(source)) {
37
+ source.forEach((entry, index) => collectItems(indexPath(path, index), entry, items));
38
+ return;
39
+ }
40
+ for (const [key, entry] of Object.entries(source)) {
41
+ collectItems(propertyPath(path, key), entry, items);
42
+ }
43
+ };
44
+
45
+ /** Rebuilds `source` with every non-literal value replaced by its evaluated result. */
46
+ export const resolveValue = (
47
+ path: string,
48
+ source: ValueSource,
49
+ results: ReadonlyMap<string, unknown>,
50
+ ): unknown => {
51
+ if (typeof source === 'string') {
52
+ return TEMPLATE_PATTERN.test(source) ? results.get(path) : source;
53
+ }
54
+ if (source === null || typeof source !== 'object') {
55
+ return source;
56
+ }
57
+ if (isExpressionValue(source)) {
58
+ return results.get(path);
59
+ }
60
+ if (Array.isArray(source)) {
61
+ return source.map((entry, index) => resolveValue(indexPath(path, index), entry, results));
62
+ }
63
+ return Object.fromEntries(
64
+ Object.entries(source).map(([key, entry]) => [
65
+ key,
66
+ resolveValue(propertyPath(path, key), entry, results),
67
+ ]),
68
+ );
69
+ };
@@ -1,15 +1,15 @@
1
- {
2
- // Perimetre de VERIFICATION, distinct de celui du build.
3
- //
4
- // `tsconfig.json` exclut `src/**/*.spec.ts` parce qu'il sert a emettre `dist/`, ou une spec
5
- // n'a rien a faire. Mais eslint s'appuie sur ce meme fichier via `parserOptions.project` :
6
- // les cinq specs du paquet sortaient donc en « Parsing error: that TSConfig does not include
7
- // this file », mesure du 2026-09-09, et n'etaient lintees par personne.
8
- //
9
- // Ce fichier sert uniquement a eslint. Il n'emet rien et ne change pas ce que `build` produit.
10
- "extends": "./tsconfig.json",
11
- "compilerOptions": {
12
- "noEmit": true
13
- },
14
- "exclude": ["./dist/**/*"]
15
- }
1
+ {
2
+ // Perimetre de VERIFICATION, distinct de celui du build.
3
+ //
4
+ // `tsconfig.json` exclut `src/**/*.spec.ts` parce qu'il sert a emettre `dist/`, ou une spec
5
+ // n'a rien a faire. Mais eslint s'appuie sur ce meme fichier via `parserOptions.project` :
6
+ // les cinq specs du paquet sortaient donc en « Parsing error: that TSConfig does not include
7
+ // this file », mesure du 2026-09-09, et n'etaient lintees par personne.
8
+ //
9
+ // Ce fichier sert uniquement a eslint. Il n'emet rien et ne change pas ce que `build` produit.
10
+ "extends": "./tsconfig.json",
11
+ "compilerOptions": {
12
+ "noEmit": true
13
+ },
14
+ "exclude": ["./dist/**/*"]
15
+ }
package/tsconfig.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "compilerOptions": {
3
- "incremental": false,
4
- "target": "es2021",
5
- "lib": [
6
- "dom",
7
- "es2021"
8
- ],
9
- "module": "commonjs",
10
- "rootDir": "src",
11
- "moduleResolution": "node",
12
- "resolveJsonModule": true,
13
- "declaration": true,
14
- "sourceMap": true,
15
- "outDir": "./dist",
16
- "removeComments": true,
17
- "allowSyntheticDefaultImports": true,
18
- "esModuleInterop": true,
19
- "forceConsistentCasingInFileNames": true,
20
- "strict": true,
21
- "strictNullChecks": true,
22
- "strictFunctionTypes": true,
23
- "strictPropertyInitialization": false,
24
- "skipLibCheck": true
25
- },
26
- "include": [
27
- "./src"
28
- ],
29
- "exclude": [
30
- "./dist/**/*",
31
- "./src/**/*.spec.ts",
32
- "./src/**/*.test.ts",
33
- "./src/**/__tests__/**"
34
- ]
35
- }
1
+ {
2
+ "compilerOptions": {
3
+ "incremental": false,
4
+ "target": "es2021",
5
+ "lib": [
6
+ "dom",
7
+ "es2021"
8
+ ],
9
+ "module": "commonjs",
10
+ "rootDir": "src",
11
+ "moduleResolution": "node",
12
+ "resolveJsonModule": true,
13
+ "declaration": true,
14
+ "sourceMap": true,
15
+ "outDir": "./dist",
16
+ "removeComments": true,
17
+ "allowSyntheticDefaultImports": true,
18
+ "esModuleInterop": true,
19
+ "forceConsistentCasingInFileNames": true,
20
+ "strict": true,
21
+ "strictNullChecks": true,
22
+ "strictFunctionTypes": true,
23
+ "strictPropertyInitialization": false,
24
+ "skipLibCheck": true
25
+ },
26
+ "include": [
27
+ "./src"
28
+ ],
29
+ "exclude": [
30
+ "./dist/**/*",
31
+ "./src/**/*.spec.ts",
32
+ "./src/**/*.test.ts",
33
+ "./src/**/__tests__/**"
34
+ ]
35
+ }