@vizejs/plugin-sdk 0.471.0 → 0.475.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 +1 -1
- package/package.json +2 -2
- package/sandbox.d.ts +11 -0
- package/sandbox.js +17 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @vizejs/plugin-sdk
|
|
2
2
|
|
|
3
3
|
Author synchronous rules, fact providers, native template transforms and compiled
|
|
4
|
-
output hooks. Install `@vizejs/native` **0.
|
|
4
|
+
output hooks. Install `@vizejs/native` **0.475.0 or newer** to execute plugins.
|
|
5
5
|
The optional native peer lets this package install independently for authoring;
|
|
6
6
|
its helpers alone do not compile or lint Vue files. Node 22 or newer is required.
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/plugin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.475.0",
|
|
4
4
|
"description": "Deterministic authoring and isolated execution for Vize JavaScript plugins",
|
|
5
5
|
"homepage": "https://github.com/ubugeeei-prod/vize",
|
|
6
6
|
"bugs": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@vizejs/native": "0.
|
|
50
|
+
"@vizejs/native": "0.475.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@vizejs/native": ">=0.429.0"
|
package/sandbox.d.ts
CHANGED
|
@@ -48,8 +48,19 @@ export type SandboxErrorCode =
|
|
|
48
48
|
| "execution_stopped"
|
|
49
49
|
| "execution_failed"
|
|
50
50
|
| "cleanup_failed";
|
|
51
|
+
/** Available decoded output can be partial after a stopped execution. */
|
|
52
|
+
export interface SandboxExecutionObservation {
|
|
53
|
+
readonly phase: "run";
|
|
54
|
+
readonly elapsedMs: number;
|
|
55
|
+
readonly status: number | null;
|
|
56
|
+
readonly signal: string | null;
|
|
57
|
+
readonly stdout: string | null;
|
|
58
|
+
readonly stderr: string | null;
|
|
59
|
+
}
|
|
51
60
|
export declare class SandboxRuntimeError extends Error {
|
|
52
61
|
readonly code: SandboxErrorCode;
|
|
62
|
+
/** Frozen and non-enumerable; the request and environment are not copied into it. */
|
|
63
|
+
readonly execution?: SandboxExecutionObservation;
|
|
53
64
|
constructor(code: SandboxErrorCode, message: string, options?: ErrorOptions);
|
|
54
65
|
}
|
|
55
66
|
export declare const SANDBOX_IMAGE: string;
|
package/sandbox.js
CHANGED
|
@@ -64,6 +64,7 @@ export function createSandboxRunner(input, limits = {}) {
|
|
|
64
64
|
let failure;
|
|
65
65
|
let output;
|
|
66
66
|
try {
|
|
67
|
+
const started = performance.now();
|
|
67
68
|
const result = spawnSync(
|
|
68
69
|
"docker",
|
|
69
70
|
[
|
|
@@ -106,12 +107,26 @@ export function createSandboxRunner(input, limits = {}) {
|
|
|
106
107
|
windowsHide: true,
|
|
107
108
|
},
|
|
108
109
|
);
|
|
109
|
-
if (result.error)
|
|
110
|
-
|
|
110
|
+
if (result.error) {
|
|
111
|
+
const stopped = new SandboxRuntimeError(
|
|
111
112
|
"execution_stopped",
|
|
112
113
|
`sandbox execution stopped: ${result.error.code}`,
|
|
113
114
|
{ cause: result.error },
|
|
114
115
|
);
|
|
116
|
+
// Preserve available captured output without automatically logging it.
|
|
117
|
+
// A stopped process does not guarantee a complete worker transcript.
|
|
118
|
+
Object.defineProperty(stopped, "execution", {
|
|
119
|
+
value: Object.freeze({
|
|
120
|
+
phase: "run",
|
|
121
|
+
elapsedMs: performance.now() - started,
|
|
122
|
+
status: result.status,
|
|
123
|
+
signal: result.signal,
|
|
124
|
+
stdout: result.stdout,
|
|
125
|
+
stderr: result.stderr,
|
|
126
|
+
}),
|
|
127
|
+
});
|
|
128
|
+
throw stopped;
|
|
129
|
+
}
|
|
115
130
|
if (result.status !== 0) {
|
|
116
131
|
throw new SandboxRuntimeError(
|
|
117
132
|
"execution_failed",
|