@rulvar/cli 1.128.0 → 1.130.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/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { r as runCli, t as processIo } from "./io-CsvU0Iog.js";
2
+ import { r as runCli, t as processIo } from "./io-CT8sNWMl.js";
3
3
  import { sanitizeTerminalText } from "@rulvar/core";
4
4
  import { inspect } from "node:util";
5
5
  //#region src/cli.ts
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as loadCliConfig, a as invoiceCommand, c as runCommand, d as reportOutcome, f as strictExitCode, g as assembleEngine, h as DEFAULT_STORE_DIR, i as inspectCommand, l as runsLsCommand, m as renderEventLine, n as HELP, o as preflightCommand, p as attachProgress, r as runCli, s as resumeCommand, t as processIo, u as driveRun, v as loadWorkflowModule, y as looksLikeFile } from "./io-CsvU0Iog.js";
1
+ import { _ as loadCliConfig, a as invoiceCommand, c as runCommand, d as reportOutcome, f as strictExitCode, g as assembleEngine, h as DEFAULT_STORE_DIR, i as inspectCommand, l as runsLsCommand, m as renderEventLine, n as HELP, o as preflightCommand, p as attachProgress, r as runCli, s as resumeCommand, t as processIo, u as driveRun, v as loadWorkflowModule, y as looksLikeFile } from "./io-CT8sNWMl.js";
2
2
  import { ConfigError, InvalidResolutionError, JournalCompatibilityError, LeaseHeldError, Replayer, RulvarError, buildDeriverRegistry, compileSecretMasker, costReportFromJournal, journalPricingSnapshot, maskSecrets, normalizeEntry, readRunMeta, scanJournalCompatibility, validateSchemaSpec } from "@rulvar/core";
3
3
  //#region src/server.ts
4
4
  /**
@@ -940,6 +940,8 @@ async function toOtel(run, tracer, options = {}) {
940
940
  let toolMint = 0;
941
941
  const openToolPairs = /* @__PURE__ */ new Map();
942
942
  const toolPairOf = (spanId, toolName) => `${spanId} ${toolName}`;
943
+ const openToolById = /* @__PURE__ */ new Map();
944
+ const toolIdOf = (spanId, toolCallId) => `${spanId} ${toolCallId}`;
943
945
  const { contextApi, setSpan } = options;
944
946
  const masker = options.patterns === void 0 ? void 0 : compileSecretMasker(options.patterns, "toOtel patterns");
945
947
  const maskText = (text) => masker === void 0 ? maskSecrets(text) : masker.maskText(text);
@@ -964,11 +966,11 @@ async function toOtel(run, tracer, options = {}) {
964
966
  openBySpanId.set(key, open);
965
967
  stack.push(open);
966
968
  };
967
- const endSpan = (spanId, ts, status, message) => {
969
+ const endSpan = (spanId, ts, status, message, unsettled = false) => {
968
970
  const open = openBySpanId.get(spanId);
969
971
  if (open === void 0) return;
970
972
  if (status !== void 0) open.span.setAttribute("rulvar.status", status);
971
- open.span.setStatus(status !== void 0 && status !== "ok" && status !== "skipped" ? {
973
+ open.span.setStatus(status !== void 0 && status !== "ok" && status !== "skipped" || unsettled ? {
972
974
  code: STATUS_ERROR,
973
975
  ...message === void 0 ? {} : { message }
974
976
  } : { code: STATUS_OK });
@@ -991,7 +993,8 @@ async function toOtel(run, tracer, options = {}) {
991
993
  if (runOpen !== void 0 && event.salvagedPartialChildren !== void 0) runOpen.span.setAttribute("rulvar.run.salvagedPartialChildren", JSON.stringify(event.salvagedPartialChildren));
992
994
  if (runOpen !== void 0 && event.salvagedTerminalOutputChildren !== void 0) runOpen.span.setAttribute("rulvar.run.salvagedTerminalOutputChildren", JSON.stringify(event.salvagedTerminalOutputChildren));
993
995
  if (runOpen !== void 0 && event.acceptanceChildren !== void 0) runOpen.span.setAttribute("rulvar.run.acceptanceChildren", JSON.stringify(event.acceptanceChildren));
994
- endSpan(event.spanId, event.ts, event.status);
996
+ if (runOpen !== void 0 && event.settled === false) runOpen.span.setAttribute("rulvar.run.settled", false);
997
+ endSpan(event.spanId, event.ts, event.status, event.settled === false ? "settlement failed: nothing durable records this terminal; resume re-settles" : void 0, event.settled === false);
995
998
  break;
996
999
  }
997
1000
  case "agent:phase:start":
@@ -1019,15 +1022,25 @@ async function toOtel(run, tracer, options = {}) {
1019
1022
  case "tool:start": {
1020
1023
  const key = `${event.spanId}#tool${String(toolMint)}`;
1021
1024
  toolMint += 1;
1022
- const pair = toolPairOf(event.spanId, event.toolName);
1023
- const fifo = openToolPairs.get(pair);
1024
- if (fifo === void 0) openToolPairs.set(pair, [key]);
1025
- else fifo.push(key);
1025
+ if (typeof event.toolCallId === "string") openToolById.set(toolIdOf(event.spanId, event.toolCallId), key);
1026
+ else {
1027
+ const pair = toolPairOf(event.spanId, event.toolName);
1028
+ const fifo = openToolPairs.get(pair);
1029
+ if (fifo === void 0) openToolPairs.set(pair, [key]);
1030
+ else fifo.push(key);
1031
+ }
1026
1032
  startSpan(event, key, event.spanId);
1033
+ if (typeof event.toolCallId === "string") openBySpanId.get(key)?.span.setAttribute("rulvar.tool.call_id", event.toolCallId);
1027
1034
  break;
1028
1035
  }
1029
1036
  case "tool:end": {
1030
- const key = openToolPairs.get(toolPairOf(event.spanId, event.toolName))?.shift();
1037
+ let key;
1038
+ if (typeof event.toolCallId === "string") {
1039
+ const idKey = toolIdOf(event.spanId, event.toolCallId);
1040
+ key = openToolById.get(idKey);
1041
+ if (key !== void 0) openToolById.delete(idKey);
1042
+ }
1043
+ key ??= openToolPairs.get(toolPairOf(event.spanId, event.toolName))?.shift();
1031
1044
  if (key === void 0) {
1032
1045
  (openBySpanId.get(event.spanId) ?? stack[stack.length - 1])?.span.addEvent(event.type, { "rulvar.entry_seq": event.seq });
1033
1046
  break;
@@ -220,7 +220,7 @@ function rawEventLine(event) {
220
220
  return `determinism ${str(event.category)} (${str(event.provenance)}) ${where}`;
221
221
  }
222
222
  case "log": return event.level === "debug" ? void 0 : `${str(event.level)}: ${str(event.msg)}`;
223
- case "run:end": return `run ${str(event.runId)} ${str(event.status)}${event.usageApprox === true ? " (cost approx)" : ""}${event.completion === void 0 ? "" : ` completion=${str(event.completion)}`}`;
223
+ case "run:end": return `run ${str(event.runId)} ${str(event.status)}${event.usageApprox === true ? " (cost approx)" : ""}${event.completion === void 0 ? "" : ` completion=${str(event.completion)}`}${event.settled === false ? " settled=false (outcome withheld; resume re-settles)" : ""}`;
224
224
  default: return;
225
225
  }
226
226
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/cli",
3
- "version": "1.128.0",
3
+ "version": "1.130.0",
4
4
  "description": "Rulvar shell: run/resume/runs/inspect/plan/kb commands, TUI progress, createServer, createWorker, OTel exporter.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -22,17 +22,17 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
- "@rulvar/core": "1.128.0"
25
+ "@rulvar/core": "1.130.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.128.0",
32
- "@rulvar/store-sqlite": "1.128.0",
33
- "@rulvar/planner": "1.128.0",
34
- "@rulvar/plan": "1.128.0",
35
- "@rulvar/evals": "1.128.0"
31
+ "@rulvar/testing": "1.130.0",
32
+ "@rulvar/store-sqlite": "1.130.0",
33
+ "@rulvar/plan": "1.130.0",
34
+ "@rulvar/evals": "1.130.0",
35
+ "@rulvar/planner": "1.130.0"
36
36
  },
37
37
  "bin": {
38
38
  "rulvar": "./dist/cli.js"