@rulvar/core 1.75.0 → 1.75.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 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10377,6 +10377,22 @@ function recoverUnparsedArgs(raw) {
10377
10377
  };
10378
10378
  }
10379
10379
  /**
10380
+ * The recovery adoption warn line, shared verbatim by the regular tool
10381
+ * executor and the terminal tool interception so the two sites cannot
10382
+ * drift. The recovery itself stays INLINE at both call sites (v1.75.1):
10383
+ * an async wrapper around the common validation added one microtask
10384
+ * tick to EVERY tool validation and shifted quiescence-sensitive
10385
+ * cassette flows, and promise-tick identity is part of the byte
10386
+ * contract, so only the synchronous pieces are shared.
10387
+ */
10388
+ function unparsedRecoveryLog(toolName, rawChars, pass) {
10389
+ return {
10390
+ type: "log",
10391
+ level: "warn",
10392
+ msg: `arguments for '${toolName}' arrived unparsed (${String(rawChars)} chars) and were recovered by a ${pass} JSON pass; the recovered object passed the tool schema and the call executed`
10393
+ };
10394
+ }
10395
+ /**
10380
10396
  * Executes one model-issued tool call to a tool-result part. Failures are
10381
10397
  * surfaced to the model as error tool results and never thrown past
10382
10398
  * policy: unknown names, argument-validation issues, ModelRetry (bounded
@@ -10409,15 +10425,11 @@ async function executeToolCall(options) {
10409
10425
  if (!validation.valid) {
10410
10426
  const unparsedRaw = unparsedMarkerOf(call.args);
10411
10427
  const recovered = unparsedRaw === void 0 ? void 0 : recoverUnparsedArgs(unparsedRaw);
10412
- if (recovered !== void 0) {
10428
+ if (recovered !== void 0 && unparsedRaw !== void 0) {
10413
10429
  const revalidation = await validateSchemaSpec(def.parameters, recovered.value);
10414
10430
  if (revalidation.valid) {
10415
10431
  validation = revalidation;
10416
- options.events?.emit({
10417
- type: "log",
10418
- level: "warn",
10419
- msg: `arguments for '${call.name}' arrived unparsed (${String(unparsedRaw?.length ?? 0)} chars) and were recovered by a ${recovered.pass} JSON pass; the recovered object passed the tool schema and the call executed`
10420
- });
10432
+ options.events?.emit(unparsedRecoveryLog(call.name, unparsedRaw.length, recovered.pass));
10421
10433
  }
10422
10434
  }
10423
10435
  }
@@ -10838,7 +10850,18 @@ async function runAgent(options) {
10838
10850
  }
10839
10851
  if (options.terminalTool !== void 0 && gatedCall.name === options.terminalTool.name) {
10840
10852
  const terminalDef = runtime.defs.find((candidate) => candidate.name === gatedCall.name);
10841
- const validation = terminalDef === void 0 ? void 0 : await validateSchemaSpec(terminalDef.parameters, gatedCall.args);
10853
+ let validation = terminalDef === void 0 ? void 0 : await validateSchemaSpec(terminalDef.parameters, gatedCall.args);
10854
+ if (terminalDef !== void 0 && validation !== void 0 && !validation.valid) {
10855
+ const unparsedRaw = unparsedMarkerOf(gatedCall.args);
10856
+ const recovered = unparsedRaw === void 0 ? void 0 : recoverUnparsedArgs(unparsedRaw);
10857
+ if (recovered !== void 0 && unparsedRaw !== void 0) {
10858
+ const revalidation = await validateSchemaSpec(terminalDef.parameters, recovered.value);
10859
+ if (revalidation.valid) {
10860
+ validation = revalidation;
10861
+ events?.emit(unparsedRecoveryLog(gatedCall.name, unparsedRaw.length, recovered.pass));
10862
+ }
10863
+ }
10864
+ }
10842
10865
  if (validation === void 0 || !validation.valid) {
10843
10866
  events?.emit({
10844
10867
  type: "tool:end",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.75.0",
3
+ "version": "1.75.1",
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",