@rulvar/executor 1.80.0 → 1.81.1

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 (2) hide show
  1. package/dist/index.js +30 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -288,7 +288,12 @@ function subprocessExecutor(options = {}) {
288
288
  const tail = child.stderr.trim().slice(-500);
289
289
  throw new ExecutorError("exit", `tool '${request.tool}' exited ${child.code ?? "null"}${child.signal === null ? "" : ` (signal ${child.signal})`}${tail === "" ? "" : `: ${tail}`}`);
290
290
  }
291
- return parseToolResult(child.stdout, request.tool);
291
+ try {
292
+ return parseToolResult(child.stdout, request.tool);
293
+ } catch (err) {
294
+ outcome = "error";
295
+ throw err;
296
+ }
292
297
  } finally {
293
298
  const durationMs = now() - startedAt;
294
299
  if (options.ledger !== void 0) await options.ledger.record({
@@ -483,7 +488,12 @@ function containerExecutor(options) {
483
488
  const tail = child.stderr.trim().slice(-500);
484
489
  throw new ExecutorError("exit", `container tool '${request.tool}' exited ${child.code ?? "null"}${tail === "" ? "" : `: ${tail}`}`);
485
490
  }
486
- return parseToolResult(child.stdout, request.tool);
491
+ try {
492
+ return parseToolResult(child.stdout, request.tool);
493
+ } catch (err) {
494
+ outcome = "error";
495
+ throw err;
496
+ }
487
497
  } finally {
488
498
  const durationMs = now() - startedAt;
489
499
  if (options.ledger !== void 0) await options.ledger.record({
@@ -796,6 +806,24 @@ function executorConformance(factory, options = {}) {
796
806
  ensure(bad?.outcome === "error" && bad.exitCode === 1, "e11", "the error record is wrong");
797
807
  ensure(rows.every((r) => typeof r.argsHash === "string" && r.argsHash.length === 64), "e11", "every record must carry a content argsHash");
798
808
  }
809
+ },
810
+ {
811
+ id: "e12",
812
+ title: "ledgers a protocol failure as an error outcome, never ok",
813
+ async run() {
814
+ const ledger = memoryEffectLedger();
815
+ const provider = factory({
816
+ command: runtime,
817
+ args: baseArgs,
818
+ ledger
819
+ });
820
+ const err = await asExecutorError("e12", provider.run(request("sloppy", { behavior: "garbage" }, { idempotencyKey: "k-proto" })));
821
+ ensure(err.code === "protocol", "e12", `expected code 'protocol', got '${err.code}'`);
822
+ const rows = ledger.entries();
823
+ ensure(rows.length === 1, "e12", `expected 1 ledger record, got ${rows.length}`);
824
+ ensure(rows[0]?.outcome === "error", "e12", `a protocol failure must ledger outcome 'error', got '${String(rows[0]?.outcome)}'`);
825
+ ensure(rows[0]?.exitCode === 0, "e12", "the clean exit code must still be recorded");
826
+ }
799
827
  }
800
828
  ];
801
829
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/executor",
3
- "version": "1.80.0",
3
+ "version": "1.81.1",
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.80.0"
25
+ "@rulvar/core": "1.81.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.20.0",
29
29
  "tsdown": "^0.22.3",
30
30
  "typescript": "~6.0.3",
31
- "@rulvar/testing": "1.80.0"
31
+ "@rulvar/testing": "1.81.1"
32
32
  },
33
33
  "repository": {
34
34
  "type": "git",