agent-relay 13.4.0 → 13.4.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.cjs +50 -1
  2. package/package.json +10 -10
package/dist/index.cjs CHANGED
@@ -963,6 +963,7 @@ __export(util_exports, {
963
963
  required: () => required,
964
964
  safeExtend: () => safeExtend,
965
965
  shallowClone: () => shallowClone,
966
+ sizeCaps: () => sizeCaps,
966
967
  slugify: () => slugify,
967
968
  stringifyPrimitive: () => stringifyPrimitive,
968
969
  toZod: () => toZod,
@@ -1482,6 +1483,18 @@ function prefixIssues(path5, issues) {
1482
1483
  function unwrapMessage(message) {
1483
1484
  return typeof message === "string" ? message : message?.message;
1484
1485
  }
1486
+ function sizeCaps(defChecks) {
1487
+ const caps = [];
1488
+ for (const ch of defChecks ?? []) {
1489
+ const d = ch._zod.def;
1490
+ if (!/_(length|size)$|_equals$/.test(d.check))
1491
+ break;
1492
+ const max = d.maximum ?? d.length ?? d.size;
1493
+ if (max >= 0)
1494
+ caps.push([max, ch]);
1495
+ }
1496
+ return caps;
1497
+ }
1485
1498
  function attachSchema(issues, start, inst) {
1486
1499
  var _a3;
1487
1500
  for (let i = start; i < issues.length; i++) {
@@ -2902,7 +2915,7 @@ ${content.join("\n")}
2902
2915
  var version = {
2903
2916
  major: 4,
2904
2917
  minor: 6,
2905
- patch: 5
2918
+ patch: 7
2906
2919
  };
2907
2920
 
2908
2921
  // ../../node_modules/zod/v4/core/schemas.js
@@ -3658,6 +3671,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
3658
3671
  return payload;
3659
3672
  };
3660
3673
  });
3674
+ function capSize(inst, size) {
3675
+ const caps = sizeCaps(inst._zod.def.checks);
3676
+ if (!caps.length)
3677
+ return;
3678
+ const cap = Math.min(...caps.map((c) => c[0]));
3679
+ const parse4 = inst._zod.parse;
3680
+ inst._zod.parse = (payload, ctx) => {
3681
+ const n = size(payload.value);
3682
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
3683
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
3684
+ if (n > max && ch._zod.def.when(payload)) {
3685
+ const start = payload.issues.length;
3686
+ ch._zod.check(payload);
3687
+ payload.issues[start].continue = false;
3688
+ attachSchema(payload.issues, start, inst);
3689
+ return payload;
3690
+ }
3691
+ }
3692
+ }
3693
+ return parse4(payload, ctx);
3694
+ };
3695
+ }
3696
+ var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
3697
+ var mapSize = (input2) => input2 instanceof Map ? input2.size : -1;
3698
+ var setSize = (input2) => input2 instanceof Set ? input2.size : -1;
3661
3699
  function handleArrayResult(result, final, index) {
3662
3700
  if (result.issues.length) {
3663
3701
  final.issues.push(...prefixIssues(index, result.issues));
@@ -3701,6 +3739,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3701
3739
  }
3702
3740
  return payload;
3703
3741
  };
3742
+ capSize(inst, arraySize);
3704
3743
  });
3705
3744
  function handlePropertyResult(result, final, key, input2, optin, optout) {
3706
3745
  const isPresent = key in input2;
@@ -4657,6 +4696,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4657
4696
  return Promise.all(proms).then(() => payload);
4658
4697
  return payload;
4659
4698
  };
4699
+ capSize(inst, mapSize);
4660
4700
  });
4661
4701
  function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
4662
4702
  if (keyResult.issues.length) {
@@ -4723,6 +4763,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4723
4763
  return Promise.all(proms).then(() => payload);
4724
4764
  return payload;
4725
4765
  };
4766
+ capSize(inst, setSize);
4726
4767
  });
4727
4768
  function handleSetResult(result, final) {
4728
4769
  if (result.issues.length) {
@@ -14253,9 +14294,15 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
14253
14294
  doc.write(`}`);
14254
14295
  return outputVar;
14255
14296
  }
14297
+ function generateSizeGate(doc, schema, size) {
14298
+ for (const [max, check2] of sizeCaps(schema._zod.def.checks)) {
14299
+ doc.write(`if (${size} > ${numericOperand(max, check2._zod.def.check)}) return INVALID;`);
14300
+ }
14301
+ }
14256
14302
  function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
14257
14303
  const def = schema._zod.def;
14258
14304
  doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
14305
+ generateSizeGate(doc, schema, `${accessor}.length`);
14259
14306
  const outputVar = buildsValue ? newVar(ctx) : null;
14260
14307
  const iVar = newVar(ctx);
14261
14308
  const elemVar = newVar(ctx);
@@ -14655,6 +14702,7 @@ function literalPropertyKey(ctx, key) {
14655
14702
  function generateMapCheck(doc, ctx, schema, accessor) {
14656
14703
  const def = schema._zod.def;
14657
14704
  doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
14705
+ generateSizeGate(doc, schema, `${accessor}.size`);
14658
14706
  const outputVar = newVar(ctx);
14659
14707
  const kVar = newVar(ctx);
14660
14708
  const valVar = newVar(ctx);
@@ -14671,6 +14719,7 @@ function generateMapCheck(doc, ctx, schema, accessor) {
14671
14719
  function generateSetCheck(doc, ctx, schema, accessor) {
14672
14720
  const def = schema._zod.def;
14673
14721
  doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
14722
+ generateSizeGate(doc, schema, `${accessor}.size`);
14674
14723
  const outputVar = newVar(ctx);
14675
14724
  const valVar = newVar(ctx);
14676
14725
  doc.write(`const ${outputVar} = new Set();`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay",
3
- "version": "13.4.0",
3
+ "version": "13.4.1",
4
4
  "description": "Real-time agent-to-agent communication system",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -43,15 +43,15 @@
43
43
  "pack:validate": "npm pack --dry-run"
44
44
  },
45
45
  "dependencies": {
46
- "@agent-relay/cli-surface": "13.4.0",
47
- "@agent-relay/cloud": "13.4.0",
48
- "@agent-relay/config": "13.4.0",
49
- "@agent-relay/fleet": "13.4.0",
50
- "@agent-relay/harness-driver": "13.4.0",
51
- "@agent-relay/harnesses": "13.4.0",
52
- "@agent-relay/sdk": "13.4.0",
53
- "@agent-relay/session": "13.4.0",
54
- "@agent-relay/utils": "13.4.0",
46
+ "@agent-relay/cli-surface": "13.4.1",
47
+ "@agent-relay/cloud": "13.4.1",
48
+ "@agent-relay/config": "13.4.1",
49
+ "@agent-relay/fleet": "13.4.1",
50
+ "@agent-relay/harness-driver": "13.4.1",
51
+ "@agent-relay/harnesses": "13.4.1",
52
+ "@agent-relay/sdk": "13.4.1",
53
+ "@agent-relay/session": "13.4.1",
54
+ "@agent-relay/utils": "13.4.1",
55
55
  "@modelcontextprotocol/sdk": "^1.23.0",
56
56
  "@relayfile/client": "^0.10.27",
57
57
  "@relayfile/sdk": "^0.10.64",