@rulvar/core 1.88.0 → 1.89.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.d.ts CHANGED
@@ -545,6 +545,15 @@ type ChatEvent = {
545
545
  } | {
546
546
  type: "error";
547
547
  error: WireError;
548
+ /**
549
+ * Provenance the adapter already holds when the stream dies (RV401,
550
+ * the eighth comparison experiment): a failed generation is still a
551
+ * billable provider call, and its response id is what joins the
552
+ * reconciliation record to the provider's own statement. Same
553
+ * namespaced shape as the finish event's; absent when the failure
554
+ * predates any provider response.
555
+ */
556
+ providerMetadata?: Record<string, unknown>;
548
557
  };
549
558
  /** Strictly 'adapterId:model', no query parameters. */
550
559
  type ModelRef = `${string}:${string}`;
@@ -962,13 +971,17 @@ type RunMeta = {
962
971
  * the args are not JCS-serializable (`argsProvided` still records
963
972
  * presence). The raw args are never journaled, but the digest is
964
973
  * sensitive-derived metadata, not an opaque token: it is deterministic
965
- * and unsalted, so it reveals when two runs (in this store or another)
966
- * were started with identical args, and low-entropy args (a boolean,
967
- * an approval flag, a role, a short id) are recoverable by hashing
968
- * candidate values. Protect meta, `inspect` output, and run listings
969
- * with the same access control as the journal and transcripts; the
970
- * digest confers no confidentiality on the args it binds. Stores must
971
- * round-trip the field (the conformance kit checks).
974
+ * and unsalted BY DEFAULT, so it reveals when two runs (in this store
975
+ * or another) were started with identical args, and low-entropy args
976
+ * (a boolean, an approval flag, a role, a short id) are recoverable by
977
+ * hashing candidate values. `createEngine security.argsHashSalt`
978
+ * switches the digest to HMAC-SHA256 under a deployment salt (RV-217),
979
+ * which removes both leaks at the cost of binding every resuming
980
+ * engine to the same salt. Protect meta, `inspect` output, and run
981
+ * listings with the same access control as the journal and
982
+ * transcripts; the digest confers no confidentiality on the args it
983
+ * binds. Stores must round-trip the field (the conformance kit
984
+ * checks).
972
985
  */
973
986
  argsHash?: string;
974
987
  /**
package/dist/index.js CHANGED
@@ -10205,6 +10205,7 @@ async function streamTurn(adapter, req, options) {
10205
10205
  break;
10206
10206
  case "error":
10207
10207
  wireError = event.error;
10208
+ if (event.providerMetadata !== void 0) providerMetadata = event.providerMetadata;
10208
10209
  break;
10209
10210
  }
10210
10211
  if (sawFinish || wireError !== void 0) break;
@@ -11466,6 +11467,7 @@ async function runAgent(options) {
11466
11467
  usage: accounted
11467
11468
  };
11468
11469
  if (typeof namespace?.responseId === "string") record.responseId = namespace.responseId;
11470
+ else if (typeof namespace?.response?.id === "string") record.responseId = namespace.response.id;
11469
11471
  if (outcome.usageApprox) record.usageApprox = true;
11470
11472
  if (outcome.aborted !== void 0) record.aborted = outcome.aborted;
11471
11473
  else if (outcome.wireError !== void 0) record.errorCode = outcome.wireError.code;
@@ -18065,7 +18067,6 @@ function makeOrchestratorWorkflow(goal, opts) {
18065
18067
  const synthesized = await runtime.runInScope(synthesisState, () => ctx.agent(prompt, synthesisOpts));
18066
18068
  synthesisSchemaRejectedExchanges = synthesized.schemaRejectedTerminalExchanges ?? 0;
18067
18069
  synthesisSchemaRecoveredExchanges = synthesized.schemaRecoveredTerminalExchanges ?? 0;
18068
- if (validationTermination !== void 0) throw validationTermination;
18069
18070
  if (configuredReserveUsd > 0) {
18070
18071
  const reserveKey = "synthesis-reserve-lifecycle";
18071
18072
  const prior = internals.replayer.snapshot().find((entry) => entry.kind === "decision" && entry.scope === callingState.scope && entry.key === reserveKey);
@@ -18106,6 +18107,7 @@ function makeOrchestratorWorkflow(goal, opts) {
18106
18107
  data: { ...synthesisReserveLifecycle }
18107
18108
  }, callingState.spanId);
18108
18109
  }
18110
+ if (validationTermination !== void 0) throw validationTermination;
18109
18111
  if (synthesized.status === "ok") return synthesized.output;
18110
18112
  if (validationSpec !== void 0) throw new FailRunError(`the synthesis invocation terminated with status '${synthesized.status}'` + (synthesized.errorMessage === void 0 ? "" : `: ${synthesized.errorMessage}`) + "; finish validators are configured, so the unvalidated draft cannot stand", { data: {
18111
18113
  source: "orchestrator_synthesis",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.88.0",
3
+ "version": "1.89.0",
4
4
  "description": "Rulvar core: L0 contracts, journal kernel, ctx primitives, agent runtime, model router, tool system, dynamic orchestrator, InMemory and JSONL stores, event stream.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",