@rulvar/executor 1.91.0 → 1.93.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/dist/index.js +12 -34
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -254,7 +254,7 @@ function subprocessExecutor(options = {}) {
|
|
|
254
254
|
});
|
|
255
255
|
throw new ExecutorError("ledger", `tool '${request.tool}' was not dispatched: the two-phase ledger intent write failed (${err instanceof Error ? err.message : String(err)})`);
|
|
256
256
|
}
|
|
257
|
-
let outcome = "
|
|
257
|
+
let outcome = "error";
|
|
258
258
|
let exitCode = null;
|
|
259
259
|
let signal = null;
|
|
260
260
|
try {
|
|
@@ -296,7 +296,6 @@ function subprocessExecutor(options = {}) {
|
|
|
296
296
|
signal: request.ctx.signal
|
|
297
297
|
});
|
|
298
298
|
} catch (err) {
|
|
299
|
-
outcome = "error";
|
|
300
299
|
throw new ExecutorError("spawn", `tool '${request.tool}' could not be spawned: ${err instanceof Error ? err.message : String(err)}`);
|
|
301
300
|
}
|
|
302
301
|
exitCode = child.code;
|
|
@@ -305,25 +304,15 @@ function subprocessExecutor(options = {}) {
|
|
|
305
304
|
outcome = "timeout";
|
|
306
305
|
throw new ExecutorError("timeout", `tool '${request.tool}' exceeded ${timeoutMs}ms and was killed`);
|
|
307
306
|
}
|
|
308
|
-
if (child.stopped && child.reason === "aborted") {
|
|
309
|
-
|
|
310
|
-
throw new ExecutorError("aborted", `tool '${request.tool}' was cancelled`);
|
|
311
|
-
}
|
|
312
|
-
if (child.stopped && child.reason === "output-cap") {
|
|
313
|
-
outcome = "error";
|
|
314
|
-
throw new ExecutorError("output-cap", `tool '${request.tool}' wrote more than ${maxOutputBytes} bytes and was killed`);
|
|
315
|
-
}
|
|
307
|
+
if (child.stopped && child.reason === "aborted") throw new ExecutorError("aborted", `tool '${request.tool}' was cancelled`);
|
|
308
|
+
if (child.stopped && child.reason === "output-cap") throw new ExecutorError("output-cap", `tool '${request.tool}' wrote more than ${maxOutputBytes} bytes and was killed`);
|
|
316
309
|
if (child.code !== 0) {
|
|
317
|
-
outcome = "error";
|
|
318
310
|
const tail = child.stderr.trim().slice(-500);
|
|
319
311
|
throw new ExecutorError("exit", `tool '${request.tool}' exited ${child.code ?? "null"}${child.signal === null ? "" : ` (signal ${child.signal})`}${tail === "" ? "" : `: ${tail}`}`);
|
|
320
312
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
outcome = "error";
|
|
325
|
-
throw err;
|
|
326
|
-
}
|
|
313
|
+
const result = parseToolResult(child.stdout, request.tool);
|
|
314
|
+
outcome = "ok";
|
|
315
|
+
return result;
|
|
327
316
|
} finally {
|
|
328
317
|
const durationMs = now() - startedAt;
|
|
329
318
|
if (options.ledger !== void 0) await options.ledger.record({
|
|
@@ -453,7 +442,7 @@ function containerExecutor(options) {
|
|
|
453
442
|
});
|
|
454
443
|
throw new ExecutorError("ledger", `container tool '${request.tool}' was not dispatched: the two-phase ledger intent write failed (${err instanceof Error ? err.message : String(err)})`);
|
|
455
444
|
}
|
|
456
|
-
let outcome = "
|
|
445
|
+
let outcome = "error";
|
|
457
446
|
let exitCode = null;
|
|
458
447
|
let signal = null;
|
|
459
448
|
try {
|
|
@@ -515,7 +504,6 @@ function containerExecutor(options) {
|
|
|
515
504
|
signal: request.ctx.signal
|
|
516
505
|
});
|
|
517
506
|
} catch (err) {
|
|
518
|
-
outcome = "error";
|
|
519
507
|
throw new ExecutorError("spawn", `container tool '${request.tool}' could not launch '${docker}': ${err instanceof Error ? err.message : String(err)}`);
|
|
520
508
|
}
|
|
521
509
|
exitCode = child.code;
|
|
@@ -524,25 +512,15 @@ function containerExecutor(options) {
|
|
|
524
512
|
outcome = "timeout";
|
|
525
513
|
throw new ExecutorError("timeout", `container tool '${request.tool}' exceeded ${timeoutMs}ms and was killed`);
|
|
526
514
|
}
|
|
527
|
-
if (child.stopped && child.reason === "aborted") {
|
|
528
|
-
|
|
529
|
-
throw new ExecutorError("aborted", `container tool '${request.tool}' was cancelled`);
|
|
530
|
-
}
|
|
531
|
-
if (child.stopped && child.reason === "output-cap") {
|
|
532
|
-
outcome = "error";
|
|
533
|
-
throw new ExecutorError("output-cap", `container tool '${request.tool}' wrote more than ${maxOutputBytes} bytes and was killed`);
|
|
534
|
-
}
|
|
515
|
+
if (child.stopped && child.reason === "aborted") throw new ExecutorError("aborted", `container tool '${request.tool}' was cancelled`);
|
|
516
|
+
if (child.stopped && child.reason === "output-cap") throw new ExecutorError("output-cap", `container tool '${request.tool}' wrote more than ${maxOutputBytes} bytes and was killed`);
|
|
535
517
|
if (child.code !== 0) {
|
|
536
|
-
outcome = "error";
|
|
537
518
|
const tail = child.stderr.trim().slice(-500);
|
|
538
519
|
throw new ExecutorError("exit", `container tool '${request.tool}' exited ${child.code ?? "null"}${tail === "" ? "" : `: ${tail}`}`);
|
|
539
520
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
outcome = "error";
|
|
544
|
-
throw err;
|
|
545
|
-
}
|
|
521
|
+
const result = parseToolResult(child.stdout, request.tool);
|
|
522
|
+
outcome = "ok";
|
|
523
|
+
return result;
|
|
546
524
|
} finally {
|
|
547
525
|
const durationMs = now() - startedAt;
|
|
548
526
|
if (options.ledger !== void 0) await options.ledger.record({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/executor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.93.0",
|
|
4
4
|
"description": "Rulvar isolated tool executors: reference ToolExecutorProvider adapters that run tool work out of process (subprocess and container) so hostile or model-generated scripts cannot reach host capabilities.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rulvar/core": "1.
|
|
25
|
+
"@rulvar/core": "1.93.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.20.1",
|
|
29
29
|
"tsdown": "^0.22.14",
|
|
30
30
|
"typescript": "~6.0.3",
|
|
31
|
-
"@rulvar/testing": "1.
|
|
31
|
+
"@rulvar/testing": "1.93.0"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|