@abyss-project/runtime 3.4.0 → 3.6.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 (58) hide show
  1. package/.eslintrc.js +32 -32
  2. package/.prettierrc +5 -5
  3. package/dist/discord/discord.types.d.ts +167 -4
  4. package/dist/discord/discord.types.js +48 -1
  5. package/dist/discord/discord.types.js.map +1 -1
  6. package/dist/engine/engine-source.js +1 -1
  7. package/dist/interpreter/interpreter.js +18 -4
  8. package/dist/interpreter/interpreter.js.map +1 -1
  9. package/dist/interpreter/interpreter.types.d.ts +2 -0
  10. package/dist/interpreter/interpreter.types.js.map +1 -1
  11. package/dist/runner-protocol/execution-protocol.types.d.ts +11 -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 +5 -1
  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/discord.types.ts +264 -5
  31. package/src/engine/__tests__/run-in-isolate.test.ts +468 -468
  32. package/src/engine/engine-entry.ts +3 -3
  33. package/src/engine/engine-global.ts +2 -2
  34. package/src/engine/run-in-isolate.ts +404 -404
  35. package/src/errors/runtime-error-code.enum.ts +37 -37
  36. package/src/index.ts +32 -32
  37. package/src/interpreter/__tests__/interpreter.test.ts +854 -854
  38. package/src/interpreter/__tests__/log-respond-resume.test.ts +270 -223
  39. package/src/interpreter/interpreter-error.ts +12 -12
  40. package/src/interpreter/interpreter.ts +482 -461
  41. package/src/interpreter/interpreter.types.ts +202 -192
  42. package/src/interpreter/sequence-path.ts +67 -67
  43. package/src/interpreter/test-host.ts +85 -85
  44. package/src/runner-protocol/evaluation.types.ts +21 -21
  45. package/src/runner-protocol/execution-protocol.types.ts +254 -231
  46. package/src/schedule/schedule.types.ts +100 -100
  47. package/src/server/__tests__/code-runner-session.test.ts +311 -311
  48. package/src/server/code-runner-error.ts +12 -12
  49. package/src/server/code-runner-session.ts +310 -310
  50. package/src/server/index.ts +11 -11
  51. package/src/steps/__tests__/global-references.test.ts +133 -133
  52. package/src/steps/execute-step.ts +186 -186
  53. package/src/steps/global-references.ts +48 -48
  54. package/src/steps/step-access.ts +56 -56
  55. package/src/steps/step-fields.ts +87 -87
  56. package/src/steps/value-source.ts +69 -69
  57. package/tsconfig.check.json +15 -15
  58. package/tsconfig.json +35 -35
@@ -1,37 +1,37 @@
1
- /**
2
- * Every failure a run, an evaluation or the code runner can report. The same codes travel in
3
- * the interpreter's events, in the runner protocol and in the errors thrown by the Node client,
4
- * so a caller maps one list to its own failure codes.
5
- */
6
- export enum RuntimeErrorCode {
7
- /** An expression or a template threw or did not parse. */
8
- EXPRESSION_ERROR = 'EXPRESSION_ERROR',
9
- /** A `code` item threw or did not parse. */
10
- CODE_ERROR = 'CODE_ERROR',
11
- /** The execution exceeded its wall-clock or CPU time limit. */
12
- TIMEOUT = 'TIMEOUT',
13
- /** The execution exceeded the memory limit of its isolate. */
14
- MEMORY_LIMIT = 'MEMORY_LIMIT',
15
- /** An effect is not covered by both the definition's declarations and the run's grants. */
16
- ACCESS_DENIED = 'ACCESS_DENIED',
17
- /** The run exceeded its step or effect budget. */
18
- BUDGET_EXCEEDED = 'BUDGET_EXCEEDED',
19
- /** A host action failed, or its resolved input does not match the action's schema. */
20
- HOST_ERROR = 'HOST_ERROR',
21
- /** The host could not perform an HTTP effect (network, SSRF guard, timeout). */
22
- HTTP_ERROR = 'HTTP_ERROR',
23
- /** The code runner could not be reached, or the connection dropped mid-execution. */
24
- RUNNER_UNAVAILABLE = 'RUNNER_UNAVAILABLE',
25
- /** The code runner refused the execution: its queue is full or the wait timed out. */
26
- RUNNER_SATURATED = 'RUNNER_SATURATED',
27
- /** A message or a definition does not match the contract. */
28
- INVALID_REQUEST = 'INVALID_REQUEST',
29
- /** A run state to resume carries a `stateVersion` this core cannot read. */
30
- STATE_VERSION_UNSUPPORTED = 'STATE_VERSION_UNSUPPORTED',
31
- }
32
-
33
- export interface RuntimeErrorDetail {
34
- code: RuntimeErrorCode;
35
- /** Human-readable cause. Never contains the client's code, context or values. */
36
- message: string;
37
- }
1
+ /**
2
+ * Every failure a run, an evaluation or the code runner can report. The same codes travel in
3
+ * the interpreter's events, in the runner protocol and in the errors thrown by the Node client,
4
+ * so a caller maps one list to its own failure codes.
5
+ */
6
+ export enum RuntimeErrorCode {
7
+ /** An expression or a template threw or did not parse. */
8
+ EXPRESSION_ERROR = 'EXPRESSION_ERROR',
9
+ /** A `code` item threw or did not parse. */
10
+ CODE_ERROR = 'CODE_ERROR',
11
+ /** The execution exceeded its wall-clock or CPU time limit. */
12
+ TIMEOUT = 'TIMEOUT',
13
+ /** The execution exceeded the memory limit of its isolate. */
14
+ MEMORY_LIMIT = 'MEMORY_LIMIT',
15
+ /** An effect is not covered by both the definition's declarations and the run's grants. */
16
+ ACCESS_DENIED = 'ACCESS_DENIED',
17
+ /** The run exceeded its step or effect budget. */
18
+ BUDGET_EXCEEDED = 'BUDGET_EXCEEDED',
19
+ /** A host action failed, or its resolved input does not match the action's schema. */
20
+ HOST_ERROR = 'HOST_ERROR',
21
+ /** The host could not perform an HTTP effect (network, SSRF guard, timeout). */
22
+ HTTP_ERROR = 'HTTP_ERROR',
23
+ /** The code runner could not be reached, or the connection dropped mid-execution. */
24
+ RUNNER_UNAVAILABLE = 'RUNNER_UNAVAILABLE',
25
+ /** The code runner refused the execution: its queue is full or the wait timed out. */
26
+ RUNNER_SATURATED = 'RUNNER_SATURATED',
27
+ /** A message or a definition does not match the contract. */
28
+ INVALID_REQUEST = 'INVALID_REQUEST',
29
+ /** A run state to resume carries a `stateVersion` this core cannot read. */
30
+ STATE_VERSION_UNSUPPORTED = 'STATE_VERSION_UNSUPPORTED',
31
+ }
32
+
33
+ export interface RuntimeErrorDetail {
34
+ code: RuntimeErrorCode;
35
+ /** Human-readable cause. Never contains the client's code, context or values. */
36
+ message: string;
37
+ }
package/src/index.ts CHANGED
@@ -1,32 +1,32 @@
1
- // Package root: browser-compatible. No Node import (`fs`, `net`, `http`, `ws`...) here nor in what
2
- // this root re-exports; everything touching the network or the system lives under `src/server`
3
- // (entry point `@abyss-project/runtime/server`).
4
- export * from './errors/runtime-error-code.enum';
5
- export * from './access/access.types';
6
- export { hostMatches } from './access/host-match';
7
- export * from './definition/definition.types';
8
- export { validateDefinition } from './definition/validate-definition';
9
- export type { ValidationResult } from './definition/validate-definition';
10
- export { MAX_WAIT_DURATION_MS } from './definition/definition.limits';
11
- export { walkSteps } from './definition/walk-steps';
12
- export type { StepVisitor } from './definition/walk-steps';
13
- export * from './interpreter/interpreter.types';
14
- export { start, step } from './interpreter/interpreter';
15
- export { InterpreterError } from './interpreter/interpreter-error';
16
- export { runToCompletion } from './interpreter/test-host';
17
- export type { TestHostHandlers, TestRunResult } from './interpreter/test-host';
18
- export * from './discord/discord.types';
19
- export * from './schedule/schedule.types';
20
- export * from './runner-protocol/evaluation.types';
21
- export * from './runner-protocol/execution-protocol.types';
22
- export { runInIsolate, EngineResultKind } from './engine/run-in-isolate';
23
- export type {
24
- EngineHost,
25
- EngineProgress,
26
- EngineRequest,
27
- EngineResult,
28
- HostCallAnswer,
29
- } from './engine/run-in-isolate';
30
- export { ENGINE_GLOBAL_NAME } from './engine/engine-global';
31
- export { collectGlobalReferences } from './steps/global-references';
32
- export * from './cost/execution-cost';
1
+ // Package root: browser-compatible. No Node import (`fs`, `net`, `http`, `ws`...) here nor in what
2
+ // this root re-exports; everything touching the network or the system lives under `src/server`
3
+ // (entry point `@abyss-project/runtime/server`).
4
+ export * from './errors/runtime-error-code.enum';
5
+ export * from './access/access.types';
6
+ export { hostMatches } from './access/host-match';
7
+ export * from './definition/definition.types';
8
+ export { validateDefinition } from './definition/validate-definition';
9
+ export type { ValidationResult } from './definition/validate-definition';
10
+ export { MAX_WAIT_DURATION_MS } from './definition/definition.limits';
11
+ export { walkSteps } from './definition/walk-steps';
12
+ export type { StepVisitor } from './definition/walk-steps';
13
+ export * from './interpreter/interpreter.types';
14
+ export { start, step } from './interpreter/interpreter';
15
+ export { InterpreterError } from './interpreter/interpreter-error';
16
+ export { runToCompletion } from './interpreter/test-host';
17
+ export type { TestHostHandlers, TestRunResult } from './interpreter/test-host';
18
+ export * from './discord/discord.types';
19
+ export * from './schedule/schedule.types';
20
+ export * from './runner-protocol/evaluation.types';
21
+ export * from './runner-protocol/execution-protocol.types';
22
+ export { runInIsolate, EngineResultKind } from './engine/run-in-isolate';
23
+ export type {
24
+ EngineHost,
25
+ EngineProgress,
26
+ EngineRequest,
27
+ EngineResult,
28
+ HostCallAnswer,
29
+ } from './engine/run-in-isolate';
30
+ export { ENGINE_GLOBAL_NAME } from './engine/engine-global';
31
+ export { collectGlobalReferences } from './steps/global-references';
32
+ export * from './cost/execution-cost';