@abyss-project/runtime 2.0.1 → 3.1.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.
- package/README.md +27 -0
- package/dist/cost/execution-cost.d.ts +0 -2
- package/dist/cost/execution-cost.js +2 -6
- package/dist/cost/execution-cost.js.map +1 -1
- package/dist/discord/discord.types.d.ts +123 -0
- package/dist/discord/discord.types.js +53 -0
- package/dist/discord/discord.types.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/runner-protocol/execution-protocol.types.d.ts +0 -1
- package/dist/runner-protocol/execution-protocol.types.js.map +1 -1
- package/package.json +1 -1
- package/scripts/build-engine.cjs +70 -70
- package/src/__tests__/engine-bundle.test.ts +121 -121
- package/src/cost/__tests__/execution-cost.test.ts +196 -200
- package/src/cost/execution-cost.ts +186 -192
- package/src/definition/__tests__/validate-definition.test.ts +354 -354
- package/src/definition/definition.limits.ts +9 -9
- package/src/definition/definition.schema.ts +172 -172
- package/src/definition/definition.types.ts +171 -171
- package/src/discord/discord.types.ts +155 -0
- package/src/engine/__tests__/run-in-isolate.test.ts +468 -468
- package/src/engine/engine-entry.ts +3 -3
- package/src/engine/engine-global.ts +2 -2
- package/src/engine/run-in-isolate.ts +404 -404
- package/src/errors/runtime-error-code.enum.ts +37 -37
- package/src/index.ts +31 -30
- package/src/interpreter/__tests__/interpreter.test.ts +854 -854
- package/src/interpreter/__tests__/log-respond-resume.test.ts +223 -223
- package/src/interpreter/interpreter.ts +461 -461
- package/src/interpreter/interpreter.types.ts +192 -192
- package/src/interpreter/test-host.ts +85 -85
- package/src/runner-protocol/evaluation.types.ts +21 -21
- package/src/runner-protocol/execution-protocol.types.ts +231 -221
- package/src/server/__tests__/code-runner-session.test.ts +311 -311
- package/src/server/code-runner-error.ts +12 -12
- package/src/server/code-runner-session.ts +310 -310
- package/src/server/index.ts +11 -11
- package/src/steps/__tests__/global-references.test.ts +133 -113
- package/src/steps/execute-step.ts +186 -186
- package/src/steps/global-references.ts +48 -48
- package/src/steps/step-access.ts +56 -56
- package/src/steps/step-fields.ts +87 -87
- package/src/steps/value-source.ts +69 -69
|
@@ -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,30 +1,31 @@
|
|
|
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 './
|
|
19
|
-
export * from './runner-protocol/
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
export
|
|
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 './runner-protocol/evaluation.types';
|
|
20
|
+
export * from './runner-protocol/execution-protocol.types';
|
|
21
|
+
export { runInIsolate, EngineResultKind } from './engine/run-in-isolate';
|
|
22
|
+
export type {
|
|
23
|
+
EngineHost,
|
|
24
|
+
EngineProgress,
|
|
25
|
+
EngineRequest,
|
|
26
|
+
EngineResult,
|
|
27
|
+
HostCallAnswer,
|
|
28
|
+
} from './engine/run-in-isolate';
|
|
29
|
+
export { ENGINE_GLOBAL_NAME } from './engine/engine-global';
|
|
30
|
+
export { collectGlobalReferences } from './steps/global-references';
|
|
31
|
+
export * from './cost/execution-cost';
|