@memberjunction/code-execution 5.28.0 → 5.30.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/.turbo/turbo-build.log +6 -2
- package/CHANGELOG.md +24 -0
- package/dist/WorkerPool.d.ts +39 -1
- package/dist/WorkerPool.d.ts.map +1 -1
- package/dist/WorkerPool.js +305 -22
- package/dist/WorkerPool.js.map +1 -1
- package/dist/libraries/bundled-libs/date-fns.js +3 -0
- package/dist/libraries/bundled-libs/jstat.js +1 -0
- package/dist/libraries/bundled-libs/lodash.js +140 -0
- package/dist/libraries/bundled-libs/mathjs.js +3 -0
- package/dist/libraries/bundled-libs/papaparse.js +7 -0
- package/dist/libraries/bundled-libs/uuid.js +43 -0
- package/dist/libraries/bundled-libs/validator.js +23 -0
- package/dist/libraries/index.js +128 -7
- package/dist/libraries/index.js.map +1 -1
- package/dist/types/index.d.ts +106 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/worker.d.ts +22 -0
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +194 -4
- package/dist/worker.js.map +1 -1
- package/package.json +5 -4
- package/src/WorkerPool.ts +398 -26
- package/src/__tests__/WorkerPool.test.ts +7 -3
- package/src/__tests__/bridge.test.ts +188 -0
- package/src/__tests__/libraries.test.ts +13 -17
- package/src/libraries/index.ts +129 -7
- package/src/types/index.ts +129 -5
- package/src/worker.ts +255 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @memberjunction/code-execution@5.
|
|
3
|
-
> tsc && tsc-alias -f
|
|
2
|
+
> @memberjunction/code-execution@5.30.0 build
|
|
3
|
+
> tsc && tsc-alias -f && npm run copy:bundled-libs
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> @memberjunction/code-execution@5.30.0 copy:bundled-libs
|
|
7
|
+
> node -e "const fs=require('fs'),p=require('path');const src=p.join('src','libraries','bundled-libs');const dst=p.join('dist','libraries','bundled-libs');fs.mkdirSync(dst,{recursive:true});for(const f of fs.readdirSync(src))fs.copyFileSync(p.join(src,f),p.join(dst,f));"
|
|
4
8
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @memberjunction/code-execution
|
|
2
2
|
|
|
3
|
+
## 5.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4729398: Runtime Actions — Phase 1 complete. Introduces `Action.Type='Runtime'`, a new action type where agents dynamically generate, test, and persist JavaScript actions that execute in MJ's isolated-vm sandbox with a permissioned bridge to metadata, views, queries, entity CRUD, other actions, agents, and AI prompts. Ships the v5.29.x migration (new `RuntimeActionConfiguration`, universal `MaxExecutionTimeMS`, and `CreatedByAgentID` columns on `Action`), the JSONType-authored config interface, the Zod validator with drift detection, the bidirectional IPC bridge in WorkerPool, the full `utilities.*` handler surface, the ActionSmith meta-agent with `Create Runtime Action` / `Test Runtime Action` helpers, Agent Manager wiring, the generic `Execute Agent` action, and Runtime-aware approval UI enhancements. Minor bumps across all touched packages because the schema migration + metadata records are coupled surface changes.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [68bf87f]
|
|
12
|
+
- Updated dependencies [963f2df]
|
|
13
|
+
- Updated dependencies [4729398]
|
|
14
|
+
- Updated dependencies [b1f32a4]
|
|
15
|
+
- Updated dependencies [c199f3b]
|
|
16
|
+
- @memberjunction/core@5.30.0
|
|
17
|
+
- @memberjunction/global@5.30.0
|
|
18
|
+
|
|
19
|
+
## 5.29.0
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [e02e24e]
|
|
24
|
+
- @memberjunction/core@5.29.0
|
|
25
|
+
- @memberjunction/global@5.29.0
|
|
26
|
+
|
|
3
27
|
## 5.28.0
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/WorkerPool.d.ts
CHANGED
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
* - Automatic worker restart on crashes
|
|
11
11
|
* - Request queuing when all workers are busy
|
|
12
12
|
* - Health monitoring and circuit breaker pattern
|
|
13
|
+
* - Bidirectional bridge: sandbox code can call host-registered handlers
|
|
14
|
+
* via `__bridgeCall(name, args)`; the host routes the call, executes the
|
|
15
|
+
* handler, and sends the response back. See worker.ts for the sandbox-side
|
|
16
|
+
* wiring.
|
|
13
17
|
*/
|
|
14
18
|
import { CodeExecutionParams, CodeExecutionResult } from './types/index.js';
|
|
15
19
|
/**
|
|
@@ -47,9 +51,30 @@ export declare class WorkerPool {
|
|
|
47
51
|
*/
|
|
48
52
|
private createWorker;
|
|
49
53
|
/**
|
|
50
|
-
* Handle messages from worker process
|
|
54
|
+
* Handle messages from worker process.
|
|
55
|
+
*
|
|
56
|
+
* Types:
|
|
57
|
+
* - `ready` — initial startup / post-restart signal, ignored here.
|
|
58
|
+
* - `result` / `error` — the terminal outcome of the current execute() call.
|
|
59
|
+
* - `bridge-call` — a host-service request from inside the sandbox; we
|
|
60
|
+
* look up the registered handler and send back `bridge-response`.
|
|
61
|
+
* Critically, `bridge-call` does NOT end the request; the worker is
|
|
62
|
+
* still executing until it sends `result`/`error`.
|
|
51
63
|
*/
|
|
52
64
|
private handleWorkerMessage;
|
|
65
|
+
/**
|
|
66
|
+
* Finalize a request once the worker reports `result` or `error`.
|
|
67
|
+
* Clears timeouts, detaches abort listeners, frees the worker, and
|
|
68
|
+
* drains the queue.
|
|
69
|
+
*/
|
|
70
|
+
private settleRequest;
|
|
71
|
+
/**
|
|
72
|
+
* Route a `bridge-call` from the worker to the registered host handler,
|
|
73
|
+
* execute it, and send `bridge-response` back. All error paths here
|
|
74
|
+
* produce a response with `error` populated so the sandbox's
|
|
75
|
+
* `await __bridgeCall(...)` rejects cleanly rather than hanging.
|
|
76
|
+
*/
|
|
77
|
+
private handleBridgeCall;
|
|
53
78
|
/**
|
|
54
79
|
* Handle worker process crash
|
|
55
80
|
*/
|
|
@@ -58,6 +83,19 @@ export declare class WorkerPool {
|
|
|
58
83
|
* Execute code in an available worker
|
|
59
84
|
*/
|
|
60
85
|
execute(params: CodeExecutionParams): Promise<CodeExecutionResult>;
|
|
86
|
+
/**
|
|
87
|
+
* Abort an in-flight or queued request.
|
|
88
|
+
*
|
|
89
|
+
* If the request is still queued, removes it and resolves with a TIMEOUT
|
|
90
|
+
* result (no worker ever picked it up). If a worker is actively running
|
|
91
|
+
* it, sends an `abort` IPC message so the worker rejects its pending
|
|
92
|
+
* bridge calls cleanly, then resolves with a TIMEOUT result. The worker
|
|
93
|
+
* will still send its eventual `result` / `error` message when the
|
|
94
|
+
* sandbox unwinds; `handleWorkerMessage` drops it because
|
|
95
|
+
* `worker.currentRequest` is already cleared.
|
|
96
|
+
*/
|
|
97
|
+
private abortRequest;
|
|
98
|
+
private detachAbortListener;
|
|
61
99
|
/**
|
|
62
100
|
* Process queued requests by assigning them to available workers
|
|
63
101
|
*/
|
package/dist/WorkerPool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerPool.d.ts","sourceRoot":"","sources":["../src/WorkerPool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"WorkerPool.d.ts","sourceRoot":"","sources":["../src/WorkerPool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,OAAO,EAEH,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,SAAS,CAAC;AA2CjB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uEAAuE;IACvE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,YAAY,CAAwB;IAC5C,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,cAAc,CAAS;gBAEnB,OAAO,GAAE,iBAAsB;IAO3C;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAQjC;;OAEG;YACW,YAAY;IAsE1B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,mBAAmB;IAiC3B;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAmBrB;;;;;OAKG;YACW,gBAAgB;IA8D9B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAgDzB;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAoExE;;;;;;;;;;OAUG;IACH,OAAO,CAAC,YAAY;IAyDpB,OAAO,CAAC,mBAAmB;IAO3B;;OAEG;IACH,OAAO,CAAC,YAAY;IAuCpB;;OAEG;IACH,QAAQ,IAAI;QACR,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;KACvB;IAYD;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CA0ClC"}
|
package/dist/WorkerPool.js
CHANGED
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
* - Automatic worker restart on crashes
|
|
11
11
|
* - Request queuing when all workers are busy
|
|
12
12
|
* - Health monitoring and circuit breaker pattern
|
|
13
|
+
* - Bidirectional bridge: sandbox code can call host-registered handlers
|
|
14
|
+
* via `__bridgeCall(name, args)`; the host routes the call, executes the
|
|
15
|
+
* handler, and sends the response back. See worker.ts for the sandbox-side
|
|
16
|
+
* wiring.
|
|
13
17
|
*/
|
|
14
18
|
import { fork } from 'child_process';
|
|
15
19
|
import * as path from 'path';
|
|
@@ -17,6 +21,10 @@ import { fileURLToPath } from 'node:url';
|
|
|
17
21
|
const __filename = fileURLToPath(import.meta.url);
|
|
18
22
|
const __dirname = path.dirname(__filename);
|
|
19
23
|
import { LogError, LogStatus } from '@memberjunction/core';
|
|
24
|
+
/** Max bytes of stderr we keep per worker for crash diagnostics. 64KB is
|
|
25
|
+
* big enough for a full V8 fatal-error banner + stack trace, small
|
|
26
|
+
* enough that the host can't be starved by pathological output. */
|
|
27
|
+
const STDERR_TAIL_BYTES = 64 * 1024;
|
|
20
28
|
/**
|
|
21
29
|
* Manages a pool of worker processes for code execution
|
|
22
30
|
*/
|
|
@@ -45,8 +53,11 @@ export class WorkerPool {
|
|
|
45
53
|
*/
|
|
46
54
|
async createWorker(id) {
|
|
47
55
|
const workerPath = path.join(__dirname, 'worker.js'); // Use .js because worker.ts is compiled
|
|
56
|
+
// stdout 'inherit' so debug logs still reach MJAPI's console.
|
|
57
|
+
// stderr 'pipe' so we can capture a rolling tail for crash diagnostics
|
|
58
|
+
// AND still forward it to MJAPI's stderr — we listen below and echo.
|
|
48
59
|
const childProcess = fork(workerPath, [], {
|
|
49
|
-
stdio: ['ignore', 'inherit', '
|
|
60
|
+
stdio: ['ignore', 'inherit', 'pipe', 'ipc']
|
|
50
61
|
});
|
|
51
62
|
const worker = {
|
|
52
63
|
process: childProcess,
|
|
@@ -54,8 +65,25 @@ export class WorkerPool {
|
|
|
54
65
|
busy: false,
|
|
55
66
|
currentRequest: null,
|
|
56
67
|
crashCount: 0,
|
|
57
|
-
lastCrashTime: 0
|
|
68
|
+
lastCrashTime: 0,
|
|
69
|
+
stderrTail: ''
|
|
58
70
|
};
|
|
71
|
+
// Capture stderr for crash diagnostics + forward to MJAPI stderr so
|
|
72
|
+
// operators still see it live in logs during non-crash scenarios.
|
|
73
|
+
if (childProcess.stderr) {
|
|
74
|
+
childProcess.stderr.on('data', (chunk) => {
|
|
75
|
+
// Forward to parent stderr — preserves existing debug behavior.
|
|
76
|
+
// Convert to string first since Node's ArrayBuffer types differ
|
|
77
|
+
// between versions and writing the Buffer directly trips TS.
|
|
78
|
+
const str = chunk.toString('utf8');
|
|
79
|
+
process.stderr.write(str);
|
|
80
|
+
// Append to rolling tail, truncating from the front.
|
|
81
|
+
worker.stderrTail += str;
|
|
82
|
+
if (worker.stderrTail.length > STDERR_TAIL_BYTES) {
|
|
83
|
+
worker.stderrTail = worker.stderrTail.slice(-STDERR_TAIL_BYTES);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
59
87
|
this.workers[id] = worker;
|
|
60
88
|
// Wait for ready message
|
|
61
89
|
await new Promise((resolve, reject) => {
|
|
@@ -84,30 +112,109 @@ export class WorkerPool {
|
|
|
84
112
|
LogStatus(`Worker ${id} initialized and ready`);
|
|
85
113
|
}
|
|
86
114
|
/**
|
|
87
|
-
* Handle messages from worker process
|
|
115
|
+
* Handle messages from worker process.
|
|
116
|
+
*
|
|
117
|
+
* Types:
|
|
118
|
+
* - `ready` — initial startup / post-restart signal, ignored here.
|
|
119
|
+
* - `result` / `error` — the terminal outcome of the current execute() call.
|
|
120
|
+
* - `bridge-call` — a host-service request from inside the sandbox; we
|
|
121
|
+
* look up the registered handler and send back `bridge-response`.
|
|
122
|
+
* Critically, `bridge-call` does NOT end the request; the worker is
|
|
123
|
+
* still executing until it sends `result`/`error`.
|
|
88
124
|
*/
|
|
89
125
|
handleWorkerMessage(worker, message) {
|
|
90
126
|
if (message.type === 'ready') {
|
|
91
127
|
// Worker is ready (initial startup or after restart)
|
|
92
128
|
return;
|
|
93
129
|
}
|
|
130
|
+
if (message.type === 'bridge-call') {
|
|
131
|
+
// Dispatch to the registered handler for this execution.
|
|
132
|
+
void this.handleBridgeCall(worker, message);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
94
135
|
if (!worker.currentRequest) {
|
|
95
136
|
LogError(new Error(`Worker ${worker.id} sent message but has no current request`));
|
|
96
137
|
return;
|
|
97
138
|
}
|
|
139
|
+
// If the worker included a requestId, make sure it matches — this
|
|
140
|
+
// catches stale messages from aborted executions. Legacy test
|
|
141
|
+
// harnesses (and very old workers) don't include a requestId; in
|
|
142
|
+
// that case fall through and treat the message as belonging to the
|
|
143
|
+
// current request.
|
|
144
|
+
if (message.requestId && message.requestId !== worker.currentRequest.requestId) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
98
147
|
const request = worker.currentRequest;
|
|
148
|
+
if (message.type === 'result' || message.type === 'error') {
|
|
149
|
+
this.settleRequest(worker, request, message);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Finalize a request once the worker reports `result` or `error`.
|
|
154
|
+
* Clears timeouts, detaches abort listeners, frees the worker, and
|
|
155
|
+
* drains the queue.
|
|
156
|
+
*/
|
|
157
|
+
settleRequest(worker, request, message) {
|
|
99
158
|
clearTimeout(request.timeout);
|
|
159
|
+
this.detachAbortListener(request);
|
|
100
160
|
if (message.type === 'result') {
|
|
101
161
|
request.resolve(message.result);
|
|
102
162
|
}
|
|
103
|
-
else
|
|
104
|
-
request.reject(new Error(message.error));
|
|
163
|
+
else {
|
|
164
|
+
request.reject(new Error(message.error ?? 'Worker returned error'));
|
|
105
165
|
}
|
|
106
|
-
// Mark worker as available and process queue
|
|
107
166
|
worker.busy = false;
|
|
108
167
|
worker.currentRequest = null;
|
|
109
168
|
this.processQueue();
|
|
110
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Route a `bridge-call` from the worker to the registered host handler,
|
|
172
|
+
* execute it, and send `bridge-response` back. All error paths here
|
|
173
|
+
* produce a response with `error` populated so the sandbox's
|
|
174
|
+
* `await __bridgeCall(...)` rejects cleanly rather than hanging.
|
|
175
|
+
*/
|
|
176
|
+
async handleBridgeCall(worker, message) {
|
|
177
|
+
const sendResponse = (payload) => {
|
|
178
|
+
try {
|
|
179
|
+
worker.process.send({
|
|
180
|
+
type: 'bridge-response',
|
|
181
|
+
requestId: message.requestId,
|
|
182
|
+
callId: message.callId,
|
|
183
|
+
...payload
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
LogError(new Error(`Failed to send bridge-response to worker ${worker.id}: ${err instanceof Error ? err.message : String(err)}`));
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
if (!worker.currentRequest || worker.currentRequest.requestId !== message.requestId) {
|
|
191
|
+
sendResponse({ error: 'No active execution for this bridge call.' });
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const handlers = worker.currentRequest.bridgeHandlers;
|
|
195
|
+
if (!handlers) {
|
|
196
|
+
sendResponse({
|
|
197
|
+
error: `Runtime action tried to call '${message.functionName}' but no bridge ` +
|
|
198
|
+
'handlers were registered for this execution.'
|
|
199
|
+
});
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const handler = handlers[message.functionName];
|
|
203
|
+
if (!handler) {
|
|
204
|
+
sendResponse({
|
|
205
|
+
error: `Bridge handler '${message.functionName}' is not registered. ` +
|
|
206
|
+
`Available: ${Object.keys(handlers).join(', ') || '(none)'}.`
|
|
207
|
+
});
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
const result = await handler(message.args);
|
|
212
|
+
sendResponse({ result });
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
sendResponse({ error: err instanceof Error ? err.message : String(err) });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
111
218
|
/**
|
|
112
219
|
* Handle worker process crash
|
|
113
220
|
*/
|
|
@@ -122,12 +229,15 @@ export class WorkerPool {
|
|
|
122
229
|
worker.crashCount++;
|
|
123
230
|
}
|
|
124
231
|
worker.lastCrashTime = now;
|
|
232
|
+
const diagnostic = classifyWorkerCrash(code, signal, worker.stderrTail);
|
|
125
233
|
LogError(new Error(`Worker ${worker.id} crashed (code: ${code}, signal: ${signal}). ` +
|
|
234
|
+
`Reason: ${diagnostic.reason}. ` +
|
|
126
235
|
`Crash count: ${worker.crashCount}/${this.maxCrashesPerWorker}`));
|
|
127
236
|
// Reject current request if any
|
|
128
237
|
if (worker.currentRequest) {
|
|
129
238
|
clearTimeout(worker.currentRequest.timeout);
|
|
130
|
-
worker.currentRequest
|
|
239
|
+
this.detachAbortListener(worker.currentRequest);
|
|
240
|
+
worker.currentRequest.reject(new Error(diagnostic.userMessage));
|
|
131
241
|
worker.currentRequest = null;
|
|
132
242
|
}
|
|
133
243
|
// Check if worker should be restarted
|
|
@@ -169,31 +279,105 @@ export class WorkerPool {
|
|
|
169
279
|
return new Promise((resolve, reject) => {
|
|
170
280
|
// Create timeout for entire request (includes queue time + execution)
|
|
171
281
|
const totalTimeout = ((params.timeoutSeconds || 30) + 5) * 1000; // Add 5s buffer for overhead
|
|
172
|
-
const timeout = setTimeout(() => {
|
|
173
|
-
// Remove from queue if still there
|
|
174
|
-
const queueIndex = this.requestQueue.findIndex(r => r.requestId === requestId);
|
|
175
|
-
if (queueIndex >= 0) {
|
|
176
|
-
this.requestQueue.splice(queueIndex, 1);
|
|
177
|
-
}
|
|
178
|
-
resolve({
|
|
179
|
-
success: false,
|
|
180
|
-
error: 'Request timed out waiting for worker availability',
|
|
181
|
-
errorType: 'TIMEOUT'
|
|
182
|
-
});
|
|
183
|
-
}, totalTimeout);
|
|
184
282
|
const request = {
|
|
185
283
|
requestId,
|
|
186
284
|
params,
|
|
285
|
+
bridgeHandlers: params.bridgeHandlers,
|
|
187
286
|
resolve,
|
|
188
287
|
reject,
|
|
189
|
-
|
|
288
|
+
// placeholder — reassigned below once we have the request ref
|
|
289
|
+
timeout: null
|
|
190
290
|
};
|
|
291
|
+
request.timeout = setTimeout(() => {
|
|
292
|
+
// If the worker is still processing, tell it to abort its
|
|
293
|
+
// in-flight bridge calls first — the sandbox's await will
|
|
294
|
+
// reject cleanly. Then reject on our side.
|
|
295
|
+
this.abortRequest(request, 'Request timed out waiting for worker availability');
|
|
296
|
+
}, totalTimeout);
|
|
297
|
+
// Mirror any caller-supplied AbortSignal into the same abort path.
|
|
298
|
+
if (params.abortSignal) {
|
|
299
|
+
const listener = () => {
|
|
300
|
+
this.abortRequest(request, typeof params.abortSignal.reason === 'string'
|
|
301
|
+
? params.abortSignal.reason
|
|
302
|
+
: 'Caller aborted');
|
|
303
|
+
};
|
|
304
|
+
request.abortListener = listener;
|
|
305
|
+
if (params.abortSignal.aborted) {
|
|
306
|
+
// Fire immediately if caller aborted before we even queued.
|
|
307
|
+
setImmediate(listener);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
params.abortSignal.addEventListener('abort', listener, { once: true });
|
|
311
|
+
}
|
|
312
|
+
}
|
|
191
313
|
// Add to queue
|
|
192
314
|
this.requestQueue.push(request);
|
|
193
315
|
// Try to process immediately
|
|
194
316
|
this.processQueue();
|
|
195
317
|
});
|
|
196
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Abort an in-flight or queued request.
|
|
321
|
+
*
|
|
322
|
+
* If the request is still queued, removes it and resolves with a TIMEOUT
|
|
323
|
+
* result (no worker ever picked it up). If a worker is actively running
|
|
324
|
+
* it, sends an `abort` IPC message so the worker rejects its pending
|
|
325
|
+
* bridge calls cleanly, then resolves with a TIMEOUT result. The worker
|
|
326
|
+
* will still send its eventual `result` / `error` message when the
|
|
327
|
+
* sandbox unwinds; `handleWorkerMessage` drops it because
|
|
328
|
+
* `worker.currentRequest` is already cleared.
|
|
329
|
+
*/
|
|
330
|
+
abortRequest(request, reason) {
|
|
331
|
+
if (request.aborted)
|
|
332
|
+
return;
|
|
333
|
+
request.aborted = true;
|
|
334
|
+
// Remove from queue if still waiting.
|
|
335
|
+
const queueIndex = this.requestQueue.findIndex(r => r.requestId === request.requestId);
|
|
336
|
+
if (queueIndex >= 0) {
|
|
337
|
+
this.requestQueue.splice(queueIndex, 1);
|
|
338
|
+
}
|
|
339
|
+
// If a worker is actively running this request, tell it to abort
|
|
340
|
+
// pending bridge calls. We do NOT kill the worker — the sandbox
|
|
341
|
+
// script will unwind naturally once its awaits reject.
|
|
342
|
+
const activeWorker = this.workers.find(w => w && w.currentRequest && w.currentRequest.requestId === request.requestId);
|
|
343
|
+
if (activeWorker && activeWorker.process.connected) {
|
|
344
|
+
try {
|
|
345
|
+
activeWorker.process.send({
|
|
346
|
+
type: 'abort',
|
|
347
|
+
requestId: request.requestId,
|
|
348
|
+
reason
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
catch (err) {
|
|
352
|
+
LogError(new Error(`Failed to send abort to worker ${activeWorker.id}: ${err instanceof Error ? err.message : String(err)}`));
|
|
353
|
+
}
|
|
354
|
+
// Decouple the request from the worker so the eventual
|
|
355
|
+
// result/error message is ignored by handleWorkerMessage. Leave
|
|
356
|
+
// worker.busy=true so we don't queue fresh work onto a worker
|
|
357
|
+
// that's still winding down; it'll flip back when the stale
|
|
358
|
+
// result arrives (and the `requestId !== worker.currentRequest`
|
|
359
|
+
// guard in handleWorkerMessage catches it).
|
|
360
|
+
activeWorker.currentRequest = null;
|
|
361
|
+
// Allow the worker to accept fresh work as soon as it's ready;
|
|
362
|
+
// the pool will swing back around on the next settle from the
|
|
363
|
+
// stale message because we won't match the requestId.
|
|
364
|
+
activeWorker.busy = false;
|
|
365
|
+
}
|
|
366
|
+
clearTimeout(request.timeout);
|
|
367
|
+
this.detachAbortListener(request);
|
|
368
|
+
request.resolve({
|
|
369
|
+
success: false,
|
|
370
|
+
error: reason,
|
|
371
|
+
errorType: 'TIMEOUT'
|
|
372
|
+
});
|
|
373
|
+
this.processQueue();
|
|
374
|
+
}
|
|
375
|
+
detachAbortListener(request) {
|
|
376
|
+
if (request.params.abortSignal && request.abortListener) {
|
|
377
|
+
request.params.abortSignal.removeEventListener('abort', request.abortListener);
|
|
378
|
+
request.abortListener = undefined;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
197
381
|
/**
|
|
198
382
|
* Process queued requests by assigning them to available workers
|
|
199
383
|
*/
|
|
@@ -214,11 +398,15 @@ export class WorkerPool {
|
|
|
214
398
|
// Assign request to worker
|
|
215
399
|
worker.busy = true;
|
|
216
400
|
worker.currentRequest = request;
|
|
217
|
-
// Send execution request to worker
|
|
401
|
+
// Send execution request to worker — strip non-serializable fields
|
|
402
|
+
// (`bridgeHandlers` are functions, `abortSignal` is a live object).
|
|
403
|
+
const ipcParams = { ...request.params };
|
|
404
|
+
delete ipcParams.bridgeHandlers;
|
|
405
|
+
delete ipcParams.abortSignal;
|
|
218
406
|
worker.process.send({
|
|
219
407
|
type: 'execute',
|
|
220
408
|
requestId: request.requestId,
|
|
221
|
-
params:
|
|
409
|
+
params: ipcParams
|
|
222
410
|
});
|
|
223
411
|
// Try to process more if queue has items
|
|
224
412
|
if (this.requestQueue.length > 0) {
|
|
@@ -247,6 +435,7 @@ export class WorkerPool {
|
|
|
247
435
|
// Reject all queued requests
|
|
248
436
|
for (const request of this.requestQueue) {
|
|
249
437
|
clearTimeout(request.timeout);
|
|
438
|
+
this.detachAbortListener(request);
|
|
250
439
|
request.resolve({
|
|
251
440
|
success: false,
|
|
252
441
|
error: 'Worker pool is shutting down',
|
|
@@ -278,4 +467,98 @@ export class WorkerPool {
|
|
|
278
467
|
LogStatus('Worker pool shutdown complete');
|
|
279
468
|
}
|
|
280
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* Classify an unexpected worker-process exit into an actionable error.
|
|
472
|
+
*
|
|
473
|
+
* "Worker process crashed" by itself is useless to a downstream AI agent
|
|
474
|
+
* trying to fix its Runtime action code — it doesn't know whether the
|
|
475
|
+
* problem is a memory leak, a bad native call, or a runaway loop. This
|
|
476
|
+
* helper inspects the Node exit `code`, kill `signal`, and the tail of
|
|
477
|
+
* stderr the worker emitted before dying, then returns:
|
|
478
|
+
*
|
|
479
|
+
* - `reason`: short label for logs
|
|
480
|
+
* - `userMessage`: the human-readable message surfaced all the way to
|
|
481
|
+
* the action's `message` field. Includes a "what to
|
|
482
|
+
* do about it" hint so agents can self-correct.
|
|
483
|
+
*/
|
|
484
|
+
function classifyWorkerCrash(code, signal, stderrTail) {
|
|
485
|
+
const stderr = (stderrTail || '').trim();
|
|
486
|
+
const stderrForUser = stderr
|
|
487
|
+
? `\n\nWorker stderr (last ${STDERR_TAIL_BYTES / 1024}KB):\n${stderr.length > 4000 ? stderr.slice(-4000) : stderr}`
|
|
488
|
+
: '';
|
|
489
|
+
// 1) V8 Node-heap OOM — usually `code=134` + stderr with "JavaScript
|
|
490
|
+
// heap out of memory" banner.
|
|
491
|
+
if (/heap out of memory|Allocation failed/i.test(stderr) || code === 134) {
|
|
492
|
+
return {
|
|
493
|
+
reason: 'NODE_HEAP_OOM',
|
|
494
|
+
userMessage: "Sandbox worker ran out of Node.js heap memory. The most common cause is a RunView / RunViews call that returned too many rows (e.g. `MaxRows: 0` against a high-volume table like `MJ: AI Prompt Runs`). Fix the Runtime action code to (a) cap `MaxRows` to a reasonable number, (b) add a time-window filter, or (c) page through results instead of loading everything at once." +
|
|
495
|
+
stderrForUser
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
// 2) isolated-vm memory-limit OOM propagated from the v8 isolate via
|
|
499
|
+
// the standard "Array buffer allocation failed" / "out of memory"
|
|
500
|
+
// patterns. Separate from node-heap OOM because the fix is the
|
|
501
|
+
// same but the surface is different.
|
|
502
|
+
if (/out of memory|RangeError.*memory/i.test(stderr)) {
|
|
503
|
+
return {
|
|
504
|
+
reason: 'ISOLATE_OOM',
|
|
505
|
+
userMessage: 'Sandbox isolated-vm ran out of memory (128MB default). Reduce the data volume the Runtime action loads — cap `MaxRows`, narrow the ExtraFilter, or process in batches. Avoid pulling whole rows when you only need a few columns; project with `Fields` where supported.' +
|
|
506
|
+
stderrForUser
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
// 3) Linux OOM killer — kernel killed the process because system
|
|
510
|
+
// memory was exhausted. code=null + signal='SIGKILL' is the
|
|
511
|
+
// canonical signature; stderr is often empty (the kernel doesn't
|
|
512
|
+
// let the process write anything before the kill).
|
|
513
|
+
if (signal === 'SIGKILL') {
|
|
514
|
+
return {
|
|
515
|
+
reason: 'KERNEL_SIGKILL',
|
|
516
|
+
userMessage: 'Sandbox worker was killed by the OS (SIGKILL). The most likely cause is the Linux OOM killer reclaiming memory under pressure — your Runtime action or the bridge result was large enough to put the host under memory stress. Reduce the data volume: cap `MaxRows`, narrow filters, or page through results.' +
|
|
517
|
+
stderrForUser
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
// 4) Native crash — segfault, bus error, abort. ivm / v8 bugs, or
|
|
521
|
+
// passing something ExternalCopy cannot serialize.
|
|
522
|
+
if (signal === 'SIGSEGV' || signal === 'SIGBUS') {
|
|
523
|
+
return {
|
|
524
|
+
reason: 'NATIVE_CRASH',
|
|
525
|
+
userMessage: `Sandbox worker crashed with native signal ${signal} — usually an isolated-vm / V8 fault, not something your code can fix directly. Common triggers include passing very deeply-nested objects or circular references through the utilities bridge. Simplify the values you return from RunView / actions before using them.` +
|
|
526
|
+
stderrForUser
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
if (signal === 'SIGABRT') {
|
|
530
|
+
return {
|
|
531
|
+
reason: 'PROCESS_ABORT',
|
|
532
|
+
userMessage: 'Sandbox worker aborted (SIGABRT). Usually triggered by an unrecoverable v8 assertion or a failed native check — often the same class of issue as a segfault. If this is reproducible, reduce the size and complexity of data your code allocates.' +
|
|
533
|
+
stderrForUser
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
// 5) Maximum call stack — v8 throws a catchable RangeError normally,
|
|
537
|
+
// but in deep-native contexts (ivm bridge marshaling, sync
|
|
538
|
+
// callbacks) it can escape and kill the process. Signature is
|
|
539
|
+
// usually stderr mentioning "Maximum call stack size exceeded"
|
|
540
|
+
// with code=1.
|
|
541
|
+
if (/Maximum call stack|stack size exceeded/i.test(stderr)) {
|
|
542
|
+
return {
|
|
543
|
+
reason: 'STACK_OVERFLOW',
|
|
544
|
+
userMessage: 'Sandbox worker hit a stack overflow. Likely a recursive function with no base case, or a call pattern that recurses indirectly through the utilities bridge. Review loops and recursion in your Runtime action code.' +
|
|
545
|
+
stderrForUser
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
// 6) Uncaught JS exception — code=1 with stderr containing a stack.
|
|
549
|
+
if (code === 1 && stderr.length > 0) {
|
|
550
|
+
return {
|
|
551
|
+
reason: 'UNCAUGHT_EXCEPTION',
|
|
552
|
+
userMessage: 'Sandbox worker crashed on an uncaught exception before the isolate could wrap it. Check the stderr tail below for the offending JS trace.' +
|
|
553
|
+
stderrForUser
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
// 7) Unknown / fallback — still include exit metadata and stderr so
|
|
557
|
+
// the agent has SOMETHING to act on.
|
|
558
|
+
return {
|
|
559
|
+
reason: 'UNKNOWN',
|
|
560
|
+
userMessage: `Sandbox worker process exited unexpectedly (code=${code}, signal=${signal}). The Runtime action code may be triggering a low-level issue in the sandbox. Simplify the code and retry.` +
|
|
561
|
+
stderrForUser
|
|
562
|
+
};
|
|
563
|
+
}
|
|
281
564
|
//# sourceMappingURL=WorkerPool.js.map
|
package/dist/WorkerPool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerPool.js","sourceRoot":"","sources":["../src/WorkerPool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA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