agent-relay 10.6.2 → 10.6.4

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 +219 -133
  2. package/package.json +8 -8
package/dist/index.cjs CHANGED
@@ -283,7 +283,7 @@ __export(index_exports, {
283
283
  module.exports = __toCommonJS(index_exports);
284
284
 
285
285
  // ../../node_modules/@relaycast/sdk/dist/version.js
286
- var SDK_VERSION = "6.1.0";
286
+ var SDK_VERSION = "6.2.0";
287
287
 
288
288
  // ../../node_modules/@relaycast/types/node_modules/zod/v4/classic/external.js
289
289
  var external_exports = {};
@@ -1051,10 +1051,10 @@ function mergeDefs(...defs) {
1051
1051
  function cloneDef(schema) {
1052
1052
  return mergeDefs(schema._zod.def);
1053
1053
  }
1054
- function getElementAtPath(obj, path4) {
1055
- if (!path4)
1054
+ function getElementAtPath(obj, path5) {
1055
+ if (!path5)
1056
1056
  return obj;
1057
- return path4.reduce((acc, key) => acc?.[key], obj);
1057
+ return path5.reduce((acc, key) => acc?.[key], obj);
1058
1058
  }
1059
1059
  function promiseAllObject(promisesObj) {
1060
1060
  const keys = Object.keys(promisesObj);
@@ -1463,11 +1463,11 @@ function explicitlyAborted(x, startIndex = 0) {
1463
1463
  }
1464
1464
  return false;
1465
1465
  }
1466
- function prefixIssues(path4, issues) {
1466
+ function prefixIssues(path5, issues) {
1467
1467
  return issues.map((iss) => {
1468
1468
  var _a7;
1469
1469
  (_a7 = iss).path ?? (_a7.path = []);
1470
- iss.path.unshift(path4);
1470
+ iss.path.unshift(path5);
1471
1471
  return iss;
1472
1472
  });
1473
1473
  }
@@ -1614,16 +1614,16 @@ function flattenError(error151, mapper = (issue4) => issue4.message) {
1614
1614
  }
1615
1615
  function formatError(error151, mapper = (issue4) => issue4.message) {
1616
1616
  const fieldErrors = { _errors: [] };
1617
- const processError = (error152, path4 = []) => {
1617
+ const processError = (error152, path5 = []) => {
1618
1618
  for (const issue4 of error152.issues) {
1619
1619
  if (issue4.code === "invalid_union" && issue4.errors.length) {
1620
- issue4.errors.map((issues) => processError({ issues }, [...path4, ...issue4.path]));
1620
+ issue4.errors.map((issues) => processError({ issues }, [...path5, ...issue4.path]));
1621
1621
  } else if (issue4.code === "invalid_key") {
1622
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
1622
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
1623
1623
  } else if (issue4.code === "invalid_element") {
1624
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
1624
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
1625
1625
  } else {
1626
- const fullpath = [...path4, ...issue4.path];
1626
+ const fullpath = [...path5, ...issue4.path];
1627
1627
  if (fullpath.length === 0) {
1628
1628
  fieldErrors._errors.push(mapper(issue4));
1629
1629
  } else {
@@ -1650,17 +1650,17 @@ function formatError(error151, mapper = (issue4) => issue4.message) {
1650
1650
  }
1651
1651
  function treeifyError(error151, mapper = (issue4) => issue4.message) {
1652
1652
  const result = { errors: [] };
1653
- const processError = (error152, path4 = []) => {
1653
+ const processError = (error152, path5 = []) => {
1654
1654
  var _a7, _b;
1655
1655
  for (const issue4 of error152.issues) {
1656
1656
  if (issue4.code === "invalid_union" && issue4.errors.length) {
1657
- issue4.errors.map((issues) => processError({ issues }, [...path4, ...issue4.path]));
1657
+ issue4.errors.map((issues) => processError({ issues }, [...path5, ...issue4.path]));
1658
1658
  } else if (issue4.code === "invalid_key") {
1659
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
1659
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
1660
1660
  } else if (issue4.code === "invalid_element") {
1661
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
1661
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
1662
1662
  } else {
1663
- const fullpath = [...path4, ...issue4.path];
1663
+ const fullpath = [...path5, ...issue4.path];
1664
1664
  if (fullpath.length === 0) {
1665
1665
  result.errors.push(mapper(issue4));
1666
1666
  continue;
@@ -1692,8 +1692,8 @@ function treeifyError(error151, mapper = (issue4) => issue4.message) {
1692
1692
  }
1693
1693
  function toDotPath(_path) {
1694
1694
  const segs = [];
1695
- const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1696
- for (const seg of path4) {
1695
+ const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1696
+ for (const seg of path5) {
1697
1697
  if (typeof seg === "number")
1698
1698
  segs.push(`[${seg}]`);
1699
1699
  else if (typeof seg === "symbol")
@@ -14385,13 +14385,13 @@ function resolveRef(ref, ctx) {
14385
14385
  if (!ref.startsWith("#")) {
14386
14386
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14387
14387
  }
14388
- const path4 = ref.slice(1).split("/").filter(Boolean);
14389
- if (path4.length === 0) {
14388
+ const path5 = ref.slice(1).split("/").filter(Boolean);
14389
+ if (path5.length === 0) {
14390
14390
  return ctx.rootSchema;
14391
14391
  }
14392
14392
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14393
- if (path4[0] === defsKey) {
14394
- const key = path4[1];
14393
+ if (path5[0] === defsKey) {
14394
+ const key = path5[1];
14395
14395
  if (!key || !ctx.defs[key]) {
14396
14396
  throw new Error(`Reference not found: ${ref}`);
14397
14397
  }
@@ -15462,6 +15462,25 @@ var AgentStatusChangedEventSchema = external_exports.object({
15462
15462
  agent: external_exports.object({ name: external_exports.string() }),
15463
15463
  status: external_exports.enum(["active", "idle", "blocked", "waiting", "offline"])
15464
15464
  });
15465
+ var AgentExitedEventSchema = external_exports.object({
15466
+ type: external_exports.literal("agent.exited"),
15467
+ agent_id: external_exports.string(),
15468
+ agent_name: external_exports.string(),
15469
+ node_id: external_exports.string().nullable(),
15470
+ invocation_id: external_exports.string().nullable(),
15471
+ reason: external_exports.enum(["deregistered", "missing_from_inventory", "released"])
15472
+ });
15473
+ var NodeStatusOnlineEventSchema = external_exports.object({
15474
+ type: external_exports.literal("node.status.online"),
15475
+ node_id: external_exports.string(),
15476
+ node_name: external_exports.string().nullable()
15477
+ });
15478
+ var NodeStatusOfflineEventSchema = external_exports.object({
15479
+ type: external_exports.literal("node.status.offline"),
15480
+ node_id: external_exports.string(),
15481
+ node_name: external_exports.string().nullable(),
15482
+ reason: external_exports.enum(["liveness_timeout", "disconnected", "deregistered"]).optional()
15483
+ });
15465
15484
  var ChannelCreatedEventSchema = external_exports.object({
15466
15485
  type: external_exports.literal("channel.created"),
15467
15486
  channel: external_exports.object({ name: external_exports.string(), topic: external_exports.string().nullable() })
@@ -15617,6 +15636,9 @@ var ServerEventSchema = external_exports.discriminatedUnion("type", [
15617
15636
  AgentStatusWaitingEventSchema,
15618
15637
  AgentStatusOfflineEventSchema,
15619
15638
  AgentStatusChangedEventSchema,
15639
+ AgentExitedEventSchema,
15640
+ NodeStatusOnlineEventSchema,
15641
+ NodeStatusOfflineEventSchema,
15620
15642
  ChannelCreatedEventSchema,
15621
15643
  ChannelUpdatedEventSchema,
15622
15644
  ChannelArchivedEventSchema,
@@ -15658,6 +15680,9 @@ var WsClientEventSchema = external_exports.discriminatedUnion("type", [
15658
15680
  AgentStatusWaitingEventSchema,
15659
15681
  AgentStatusOfflineEventSchema,
15660
15682
  AgentStatusChangedEventSchema,
15683
+ AgentExitedEventSchema,
15684
+ NodeStatusOnlineEventSchema,
15685
+ NodeStatusOfflineEventSchema,
15661
15686
  ChannelCreatedEventSchema,
15662
15687
  ChannelUpdatedEventSchema,
15663
15688
  ChannelArchivedEventSchema,
@@ -15773,6 +15798,9 @@ var SubscribableEventTypeSchema = external_exports.enum([
15773
15798
  "agent.status.blocked",
15774
15799
  "agent.status.waiting",
15775
15800
  "agent.status.offline",
15801
+ "agent.exited",
15802
+ "node.status.online",
15803
+ "node.status.offline",
15776
15804
  "channel.created",
15777
15805
  "channel.updated",
15778
15806
  "channel.archived",
@@ -16208,6 +16236,15 @@ function toCamelKey(key) {
16208
16236
  function toSnakeKey(key) {
16209
16237
  return key.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
16210
16238
  }
16239
+ var VERBATIM_VALUE_KEYS = /* @__PURE__ */ new Set([
16240
+ "headers",
16241
+ "input",
16242
+ "output",
16243
+ "input_schema",
16244
+ "inputSchema",
16245
+ "output_schema",
16246
+ "outputSchema"
16247
+ ]);
16211
16248
  function camelizeKeys(value) {
16212
16249
  if (Array.isArray(value)) {
16213
16250
  return value.map((item) => camelizeKeys(item));
@@ -16215,7 +16252,7 @@ function camelizeKeys(value) {
16215
16252
  if (isPlainObject2(value)) {
16216
16253
  const out = {};
16217
16254
  for (const [key, val] of Object.entries(value)) {
16218
- out[toCamelKey(key)] = camelizeKeys(val);
16255
+ out[toCamelKey(key)] = VERBATIM_VALUE_KEYS.has(key) ? val : camelizeKeys(val);
16219
16256
  }
16220
16257
  return out;
16221
16258
  }
@@ -16228,7 +16265,7 @@ function decamelizeKeys(value) {
16228
16265
  if (isPlainObject2(value)) {
16229
16266
  const out = {};
16230
16267
  for (const [key, val] of Object.entries(value)) {
16231
- out[toSnakeKey(key)] = key === "headers" && isPlainObject2(val) ? val : decamelizeKeys(val);
16268
+ out[toSnakeKey(key)] = VERBATIM_VALUE_KEYS.has(key) ? val : decamelizeKeys(val);
16232
16269
  }
16233
16270
  return out;
16234
16271
  }
@@ -16892,9 +16929,22 @@ var AgentClient = class {
16892
16929
  heartbeat: async () => {
16893
16930
  await this.client.post("/v1/agents/heartbeat", {});
16894
16931
  },
16895
- markOffline: async () => {
16932
+ /**
16933
+ * Mark this agent offline.
16934
+ *
16935
+ * By default this is a presence-only signal: a node-hosted (broker) agent
16936
+ * keeps its node binding, so a session still running on its node keeps
16937
+ * receiving deliveries through that node and the binding stays usable for
16938
+ * later reconnection. Pass `{ deregister: true }` to also tear down the
16939
+ * node binding and re-home the agent to its implicit direct node.
16940
+ */
16941
+ markOffline: async (options) => {
16896
16942
  this.stopAutoHeartbeat();
16897
- await this.client.post("/v1/agents/disconnect", {});
16943
+ if (this.pendingHeartbeat) {
16944
+ await this.pendingHeartbeat;
16945
+ this.pendingHeartbeat = null;
16946
+ }
16947
+ await this.client.post("/v1/agents/disconnect", options?.deregister ? { deregister: true } : {});
16898
16948
  }
16899
16949
  };
16900
16950
  startAutoHeartbeat() {
@@ -16902,6 +16952,8 @@ var AgentClient = class {
16902
16952
  if (this.autoHeartbeatMs === false)
16903
16953
  return;
16904
16954
  this.autoHeartbeatTimer = setInterval(() => {
16955
+ if (this.pendingHeartbeat)
16956
+ return;
16905
16957
  this.pendingHeartbeat = this.presence.heartbeat().catch(() => {
16906
16958
  }).finally(() => {
16907
16959
  this.pendingHeartbeat = null;
@@ -16972,7 +17024,17 @@ var AgentClient = class {
16972
17024
  async heartbeat() {
16973
17025
  await this.presence.heartbeat();
16974
17026
  }
16975
- async disconnect() {
17027
+ /**
17028
+ * Tear down this client's WebSocket and mark the agent offline.
17029
+ *
17030
+ * By default the HTTP disconnect is presence-only for node-hosted (broker)
17031
+ * agents: the node binding is preserved, so an agent process still running
17032
+ * on its node keeps receiving deliveries through that node, and the binding
17033
+ * remains usable for later reconnection. Pass `{ deregister: true }` to also
17034
+ * deregister the node binding and re-home the agent to its implicit direct
17035
+ * node.
17036
+ */
17037
+ async disconnect(options) {
16976
17038
  this.stopAutoHeartbeat();
16977
17039
  if (this.pendingHeartbeat) {
16978
17040
  await this.pendingHeartbeat;
@@ -16990,7 +17052,7 @@ var AgentClient = class {
16990
17052
  this.ws = null;
16991
17053
  }
16992
17054
  this.activeWsChannels.clear();
16993
- await this.client.post("/v1/agents/disconnect", {}).catch(() => {
17055
+ await this.client.post("/v1/agents/disconnect", options?.deregister ? { deregister: true } : {}).catch(() => {
16994
17056
  });
16995
17057
  }
16996
17058
  subscribe(channels, onMessage) {
@@ -18137,10 +18199,10 @@ function mergeDefs2(...defs) {
18137
18199
  function cloneDef2(schema) {
18138
18200
  return mergeDefs2(schema._zod.def);
18139
18201
  }
18140
- function getElementAtPath2(obj, path4) {
18141
- if (!path4)
18202
+ function getElementAtPath2(obj, path5) {
18203
+ if (!path5)
18142
18204
  return obj;
18143
- return path4.reduce((acc, key) => acc?.[key], obj);
18205
+ return path5.reduce((acc, key) => acc?.[key], obj);
18144
18206
  }
18145
18207
  function promiseAllObject2(promisesObj) {
18146
18208
  const keys = Object.keys(promisesObj);
@@ -18549,11 +18611,11 @@ function explicitlyAborted2(x, startIndex = 0) {
18549
18611
  }
18550
18612
  return false;
18551
18613
  }
18552
- function prefixIssues2(path4, issues) {
18614
+ function prefixIssues2(path5, issues) {
18553
18615
  return issues.map((iss) => {
18554
18616
  var _a7;
18555
18617
  (_a7 = iss).path ?? (_a7.path = []);
18556
- iss.path.unshift(path4);
18618
+ iss.path.unshift(path5);
18557
18619
  return iss;
18558
18620
  });
18559
18621
  }
@@ -18700,16 +18762,16 @@ function flattenError2(error151, mapper = (issue4) => issue4.message) {
18700
18762
  }
18701
18763
  function formatError2(error151, mapper = (issue4) => issue4.message) {
18702
18764
  const fieldErrors = { _errors: [] };
18703
- const processError = (error152, path4 = []) => {
18765
+ const processError = (error152, path5 = []) => {
18704
18766
  for (const issue4 of error152.issues) {
18705
18767
  if (issue4.code === "invalid_union" && issue4.errors.length) {
18706
- issue4.errors.map((issues) => processError({ issues }, [...path4, ...issue4.path]));
18768
+ issue4.errors.map((issues) => processError({ issues }, [...path5, ...issue4.path]));
18707
18769
  } else if (issue4.code === "invalid_key") {
18708
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
18770
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
18709
18771
  } else if (issue4.code === "invalid_element") {
18710
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
18772
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
18711
18773
  } else {
18712
- const fullpath = [...path4, ...issue4.path];
18774
+ const fullpath = [...path5, ...issue4.path];
18713
18775
  if (fullpath.length === 0) {
18714
18776
  fieldErrors._errors.push(mapper(issue4));
18715
18777
  } else {
@@ -18736,17 +18798,17 @@ function formatError2(error151, mapper = (issue4) => issue4.message) {
18736
18798
  }
18737
18799
  function treeifyError2(error151, mapper = (issue4) => issue4.message) {
18738
18800
  const result = { errors: [] };
18739
- const processError = (error152, path4 = []) => {
18801
+ const processError = (error152, path5 = []) => {
18740
18802
  var _a7, _b;
18741
18803
  for (const issue4 of error152.issues) {
18742
18804
  if (issue4.code === "invalid_union" && issue4.errors.length) {
18743
- issue4.errors.map((issues) => processError({ issues }, [...path4, ...issue4.path]));
18805
+ issue4.errors.map((issues) => processError({ issues }, [...path5, ...issue4.path]));
18744
18806
  } else if (issue4.code === "invalid_key") {
18745
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
18807
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
18746
18808
  } else if (issue4.code === "invalid_element") {
18747
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
18809
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
18748
18810
  } else {
18749
- const fullpath = [...path4, ...issue4.path];
18811
+ const fullpath = [...path5, ...issue4.path];
18750
18812
  if (fullpath.length === 0) {
18751
18813
  result.errors.push(mapper(issue4));
18752
18814
  continue;
@@ -18778,8 +18840,8 @@ function treeifyError2(error151, mapper = (issue4) => issue4.message) {
18778
18840
  }
18779
18841
  function toDotPath2(_path) {
18780
18842
  const segs = [];
18781
- const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
18782
- for (const seg of path4) {
18843
+ const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
18844
+ for (const seg of path5) {
18783
18845
  if (typeof seg === "number")
18784
18846
  segs.push(`[${seg}]`);
18785
18847
  else if (typeof seg === "symbol")
@@ -31471,13 +31533,13 @@ function resolveRef2(ref, ctx) {
31471
31533
  if (!ref.startsWith("#")) {
31472
31534
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
31473
31535
  }
31474
- const path4 = ref.slice(1).split("/").filter(Boolean);
31475
- if (path4.length === 0) {
31536
+ const path5 = ref.slice(1).split("/").filter(Boolean);
31537
+ if (path5.length === 0) {
31476
31538
  return ctx.rootSchema;
31477
31539
  }
31478
31540
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
31479
- if (path4[0] === defsKey) {
31480
- const key = path4[1];
31541
+ if (path5[0] === defsKey) {
31542
+ const key = path5[1];
31481
31543
  if (!key || !ctx.defs[key]) {
31482
31544
  throw new Error(`Reference not found: ${ref}`);
31483
31545
  }
@@ -32070,8 +32132,8 @@ var HttpClient = class _HttpClient {
32070
32132
  ...this._agentRelayDistinctId ? { agentRelayDistinctId: this._agentRelayDistinctId } : {}
32071
32133
  }));
32072
32134
  }
32073
- async request(method, path4, body, query, options) {
32074
- const url4 = new URL(path4, this._baseUrl);
32135
+ async request(method, path5, body, query, options) {
32136
+ const url4 = new URL(path5, this._baseUrl);
32075
32137
  if (query) {
32076
32138
  for (const [k, v] of Object.entries(query)) {
32077
32139
  if (v !== void 0)
@@ -32142,20 +32204,20 @@ var HttpClient = class _HttpClient {
32142
32204
  return camelizeKeys(parsedData);
32143
32205
  }
32144
32206
  }
32145
- get(path4, query, options) {
32146
- return this.request("GET", path4, void 0, query, options);
32207
+ get(path5, query, options) {
32208
+ return this.request("GET", path5, void 0, query, options);
32147
32209
  }
32148
- post(path4, body, options) {
32149
- return this.request("POST", path4, body, void 0, options);
32210
+ post(path5, body, options) {
32211
+ return this.request("POST", path5, body, void 0, options);
32150
32212
  }
32151
- patch(path4, body, options) {
32152
- return this.request("PATCH", path4, body, void 0, options);
32213
+ patch(path5, body, options) {
32214
+ return this.request("PATCH", path5, body, void 0, options);
32153
32215
  }
32154
- put(path4, body, options) {
32155
- return this.request("PUT", path4, body, void 0, options);
32216
+ put(path5, body, options) {
32217
+ return this.request("PUT", path5, body, void 0, options);
32156
32218
  }
32157
- async delete(path4, options) {
32158
- await this.request("DELETE", path4, void 0, void 0, options);
32219
+ async delete(path5, options) {
32220
+ await this.request("DELETE", path5, void 0, void 0, options);
32159
32221
  }
32160
32222
  };
32161
32223
 
@@ -32754,72 +32816,72 @@ function validateJsonSchemaLite(value, schema) {
32754
32816
  validateAgainstSchema(value, schema, "$", state);
32755
32817
  return { valid: state.issues.length === 0, issues: state.issues };
32756
32818
  }
32757
- function validateAgainstSchema(value, schema, path4, state) {
32819
+ function validateAgainstSchema(value, schema, path5, state) {
32758
32820
  if (schema === true) {
32759
32821
  return;
32760
32822
  }
32761
32823
  if (schema === false) {
32762
- addIssue(state, path4, "value is not allowed", "never", describeValue(value));
32824
+ addIssue(state, path5, "value is not allowed", "never", describeValue(value));
32763
32825
  return;
32764
32826
  }
32765
32827
  if (!isSchemaObject(schema)) {
32766
- addIssue(state, path4, "schema must be a boolean or object", "schema", describeValue(schema));
32828
+ addIssue(state, path5, "schema must be a boolean or object", "schema", describeValue(schema));
32767
32829
  return;
32768
32830
  }
32769
- validateCombinators(value, schema, path4, state);
32831
+ validateCombinators(value, schema, path5, state);
32770
32832
  if (schema.const !== void 0 && !jsonEqual(value, schema.const)) {
32771
- addIssue(state, path4, `expected const ${JSON.stringify(schema.const)}`, JSON.stringify(schema.const), describeValue(value));
32833
+ addIssue(state, path5, `expected const ${JSON.stringify(schema.const)}`, JSON.stringify(schema.const), describeValue(value));
32772
32834
  }
32773
32835
  if (schema.enum && !schema.enum.some((candidate) => jsonEqual(value, candidate))) {
32774
- addIssue(state, path4, `expected one of ${schema.enum.map((candidate) => JSON.stringify(candidate)).join(", ")}`);
32836
+ addIssue(state, path5, `expected one of ${schema.enum.map((candidate) => JSON.stringify(candidate)).join(", ")}`);
32775
32837
  }
32776
32838
  const types = getExpectedTypes(schema);
32777
32839
  if (types.length > 0 && !types.some((type) => matchesType(value, type))) {
32778
- addIssue(state, path4, `expected ${types.join(" or ")}`, types.join(" or "), describeValue(value));
32840
+ addIssue(state, path5, `expected ${types.join(" or ")}`, types.join(" or "), describeValue(value));
32779
32841
  return;
32780
32842
  }
32781
32843
  if (shouldValidateObject(value, schema)) {
32782
- validateObject(value, schema, path4, state);
32844
+ validateObject(value, schema, path5, state);
32783
32845
  }
32784
32846
  if (shouldValidateArray(value, schema)) {
32785
- validateArray(value, schema, path4, state);
32847
+ validateArray(value, schema, path5, state);
32786
32848
  }
32787
32849
  if (typeof value === "string") {
32788
- validateString(value, schema, path4, state);
32850
+ validateString(value, schema, path5, state);
32789
32851
  }
32790
32852
  if (typeof value === "number") {
32791
- validateNumber(value, schema, path4, state);
32853
+ validateNumber(value, schema, path5, state);
32792
32854
  }
32793
32855
  }
32794
- function validateCombinators(value, schema, path4, state) {
32856
+ function validateCombinators(value, schema, path5, state) {
32795
32857
  if (schema.allOf) {
32796
32858
  for (const child of schema.allOf) {
32797
- validateAgainstSchema(value, child, path4, state);
32859
+ validateAgainstSchema(value, child, path5, state);
32798
32860
  }
32799
32861
  }
32800
32862
  if (schema.anyOf) {
32801
32863
  const matched = schema.anyOf.some((child) => validateJsonSchemaLite(value, child).valid);
32802
32864
  if (!matched) {
32803
- addIssue(state, path4, "expected value to match at least one anyOf schema");
32865
+ addIssue(state, path5, "expected value to match at least one anyOf schema");
32804
32866
  }
32805
32867
  }
32806
32868
  if (schema.oneOf) {
32807
32869
  const matches = schema.oneOf.filter((child) => validateJsonSchemaLite(value, child).valid).length;
32808
32870
  if (matches !== 1) {
32809
- addIssue(state, path4, `expected value to match exactly one oneOf schema, matched ${matches}`);
32871
+ addIssue(state, path5, `expected value to match exactly one oneOf schema, matched ${matches}`);
32810
32872
  }
32811
32873
  }
32812
32874
  }
32813
- function validateObject(value, schema, path4, state) {
32875
+ function validateObject(value, schema, path5, state) {
32814
32876
  for (const key of schema.required ?? []) {
32815
32877
  if (!Object.prototype.hasOwnProperty.call(value, key)) {
32816
- addIssue(state, appendPath(path4, key), "required property is missing");
32878
+ addIssue(state, appendPath(path5, key), "required property is missing");
32817
32879
  }
32818
32880
  }
32819
32881
  const properties = schema.properties ?? {};
32820
32882
  for (const [key, childSchema] of Object.entries(properties)) {
32821
32883
  if (Object.prototype.hasOwnProperty.call(value, key)) {
32822
- validateAgainstSchema(value[key], childSchema, appendPath(path4, key), state);
32884
+ validateAgainstSchema(value[key], childSchema, appendPath(path5, key), state);
32823
32885
  }
32824
32886
  }
32825
32887
  const additional = schema.additionalProperties;
@@ -32831,48 +32893,48 @@ function validateObject(value, schema, path4, state) {
32831
32893
  continue;
32832
32894
  }
32833
32895
  if (additional === false) {
32834
- addIssue(state, appendPath(path4, key), "additional property is not allowed");
32896
+ addIssue(state, appendPath(path5, key), "additional property is not allowed");
32835
32897
  } else {
32836
- validateAgainstSchema(value[key], additional, appendPath(path4, key), state);
32898
+ validateAgainstSchema(value[key], additional, appendPath(path5, key), state);
32837
32899
  }
32838
32900
  }
32839
32901
  }
32840
- function validateArray(value, schema, path4, state) {
32902
+ function validateArray(value, schema, path5, state) {
32841
32903
  if (schema.minItems !== void 0 && value.length < schema.minItems) {
32842
- addIssue(state, path4, `expected at least ${schema.minItems} items`);
32904
+ addIssue(state, path5, `expected at least ${schema.minItems} items`);
32843
32905
  }
32844
32906
  if (schema.maxItems !== void 0 && value.length > schema.maxItems) {
32845
- addIssue(state, path4, `expected at most ${schema.maxItems} items`);
32907
+ addIssue(state, path5, `expected at most ${schema.maxItems} items`);
32846
32908
  }
32847
32909
  if (schema.items !== void 0) {
32848
32910
  value.forEach((item, index) => {
32849
- validateAgainstSchema(item, schema.items, `${path4}[${index}]`, state);
32911
+ validateAgainstSchema(item, schema.items, `${path5}[${index}]`, state);
32850
32912
  });
32851
32913
  }
32852
32914
  }
32853
- function validateString(value, schema, path4, state) {
32915
+ function validateString(value, schema, path5, state) {
32854
32916
  if (schema.minLength !== void 0 && value.length < schema.minLength) {
32855
- addIssue(state, path4, `expected length >= ${schema.minLength}`);
32917
+ addIssue(state, path5, `expected length >= ${schema.minLength}`);
32856
32918
  }
32857
32919
  if (schema.maxLength !== void 0 && value.length > schema.maxLength) {
32858
- addIssue(state, path4, `expected length <= ${schema.maxLength}`);
32920
+ addIssue(state, path5, `expected length <= ${schema.maxLength}`);
32859
32921
  }
32860
32922
  if (schema.pattern !== void 0) {
32861
32923
  try {
32862
32924
  if (!new RegExp(schema.pattern).test(value)) {
32863
- addIssue(state, path4, `expected string to match /${schema.pattern}/`);
32925
+ addIssue(state, path5, `expected string to match /${schema.pattern}/`);
32864
32926
  }
32865
32927
  } catch {
32866
- addIssue(state, path4, `invalid pattern /${schema.pattern}/`);
32928
+ addIssue(state, path5, `invalid pattern /${schema.pattern}/`);
32867
32929
  }
32868
32930
  }
32869
32931
  }
32870
- function validateNumber(value, schema, path4, state) {
32932
+ function validateNumber(value, schema, path5, state) {
32871
32933
  if (schema.minimum !== void 0 && value < schema.minimum) {
32872
- addIssue(state, path4, `expected value >= ${schema.minimum}`);
32934
+ addIssue(state, path5, `expected value >= ${schema.minimum}`);
32873
32935
  }
32874
32936
  if (schema.maximum !== void 0 && value > schema.maximum) {
32875
- addIssue(state, path4, `expected value <= ${schema.maximum}`);
32937
+ addIssue(state, path5, `expected value <= ${schema.maximum}`);
32876
32938
  }
32877
32939
  }
32878
32940
  function getExpectedTypes(schema) {
@@ -32921,12 +32983,12 @@ function isPlainObject4(value) {
32921
32983
  function isSchemaObject(value) {
32922
32984
  return isPlainObject4(value);
32923
32985
  }
32924
- function appendPath(path4, key) {
32925
- return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? `${path4}.${key}` : `${path4}[${JSON.stringify(key)}]`;
32986
+ function appendPath(path5, key) {
32987
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? `${path5}.${key}` : `${path5}[${JSON.stringify(key)}]`;
32926
32988
  }
32927
- function addIssue(state, path4, message, expected, received) {
32989
+ function addIssue(state, path5, message, expected, received) {
32928
32990
  state.issues.push({
32929
- path: path4,
32991
+ path: path5,
32930
32992
  message,
32931
32993
  ...expected !== void 0 ? { expected } : {},
32932
32994
  ...received !== void 0 ? { received } : {}
@@ -33256,11 +33318,11 @@ function zodIssues(error151) {
33256
33318
  message: issue4.message
33257
33319
  }));
33258
33320
  }
33259
- function formatZodPath(path4) {
33260
- if (path4.length === 0)
33321
+ function formatZodPath(path5) {
33322
+ if (path5.length === 0)
33261
33323
  return "$";
33262
33324
  let result = "$";
33263
- for (const part of path4) {
33325
+ for (const part of path5) {
33264
33326
  result = typeof part === "number" ? `${result}[${part}]` : `${result}.${part}`;
33265
33327
  }
33266
33328
  return result;
@@ -34076,10 +34138,10 @@ function mergeDefs3(...defs) {
34076
34138
  function cloneDef3(schema) {
34077
34139
  return mergeDefs3(schema._zod.def);
34078
34140
  }
34079
- function getElementAtPath3(obj, path4) {
34080
- if (!path4)
34141
+ function getElementAtPath3(obj, path5) {
34142
+ if (!path5)
34081
34143
  return obj;
34082
- return path4.reduce((acc, key) => acc?.[key], obj);
34144
+ return path5.reduce((acc, key) => acc?.[key], obj);
34083
34145
  }
34084
34146
  function promiseAllObject3(promisesObj) {
34085
34147
  const keys = Object.keys(promisesObj);
@@ -34488,11 +34550,11 @@ function explicitlyAborted3(x, startIndex = 0) {
34488
34550
  }
34489
34551
  return false;
34490
34552
  }
34491
- function prefixIssues3(path4, issues) {
34553
+ function prefixIssues3(path5, issues) {
34492
34554
  return issues.map((iss) => {
34493
34555
  var _a7;
34494
34556
  (_a7 = iss).path ?? (_a7.path = []);
34495
- iss.path.unshift(path4);
34557
+ iss.path.unshift(path5);
34496
34558
  return iss;
34497
34559
  });
34498
34560
  }
@@ -34639,16 +34701,16 @@ function flattenError3(error151, mapper = (issue4) => issue4.message) {
34639
34701
  }
34640
34702
  function formatError3(error151, mapper = (issue4) => issue4.message) {
34641
34703
  const fieldErrors = { _errors: [] };
34642
- const processError = (error152, path4 = []) => {
34704
+ const processError = (error152, path5 = []) => {
34643
34705
  for (const issue4 of error152.issues) {
34644
34706
  if (issue4.code === "invalid_union" && issue4.errors.length) {
34645
- issue4.errors.map((issues) => processError({ issues }, [...path4, ...issue4.path]));
34707
+ issue4.errors.map((issues) => processError({ issues }, [...path5, ...issue4.path]));
34646
34708
  } else if (issue4.code === "invalid_key") {
34647
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
34709
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
34648
34710
  } else if (issue4.code === "invalid_element") {
34649
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
34711
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
34650
34712
  } else {
34651
- const fullpath = [...path4, ...issue4.path];
34713
+ const fullpath = [...path5, ...issue4.path];
34652
34714
  if (fullpath.length === 0) {
34653
34715
  fieldErrors._errors.push(mapper(issue4));
34654
34716
  } else {
@@ -34675,17 +34737,17 @@ function formatError3(error151, mapper = (issue4) => issue4.message) {
34675
34737
  }
34676
34738
  function treeifyError3(error151, mapper = (issue4) => issue4.message) {
34677
34739
  const result = { errors: [] };
34678
- const processError = (error152, path4 = []) => {
34740
+ const processError = (error152, path5 = []) => {
34679
34741
  var _a7, _b;
34680
34742
  for (const issue4 of error152.issues) {
34681
34743
  if (issue4.code === "invalid_union" && issue4.errors.length) {
34682
- issue4.errors.map((issues) => processError({ issues }, [...path4, ...issue4.path]));
34744
+ issue4.errors.map((issues) => processError({ issues }, [...path5, ...issue4.path]));
34683
34745
  } else if (issue4.code === "invalid_key") {
34684
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
34746
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
34685
34747
  } else if (issue4.code === "invalid_element") {
34686
- processError({ issues: issue4.issues }, [...path4, ...issue4.path]);
34748
+ processError({ issues: issue4.issues }, [...path5, ...issue4.path]);
34687
34749
  } else {
34688
- const fullpath = [...path4, ...issue4.path];
34750
+ const fullpath = [...path5, ...issue4.path];
34689
34751
  if (fullpath.length === 0) {
34690
34752
  result.errors.push(mapper(issue4));
34691
34753
  continue;
@@ -34717,8 +34779,8 @@ function treeifyError3(error151, mapper = (issue4) => issue4.message) {
34717
34779
  }
34718
34780
  function toDotPath3(_path) {
34719
34781
  const segs = [];
34720
- const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
34721
- for (const seg of path4) {
34782
+ const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
34783
+ for (const seg of path5) {
34722
34784
  if (typeof seg === "number")
34723
34785
  segs.push(`[${seg}]`);
34724
34786
  else if (typeof seg === "symbol")
@@ -47410,13 +47472,13 @@ function resolveRef3(ref, ctx) {
47410
47472
  if (!ref.startsWith("#")) {
47411
47473
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
47412
47474
  }
47413
- const path4 = ref.slice(1).split("/").filter(Boolean);
47414
- if (path4.length === 0) {
47475
+ const path5 = ref.slice(1).split("/").filter(Boolean);
47476
+ if (path5.length === 0) {
47415
47477
  return ctx.rootSchema;
47416
47478
  }
47417
47479
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
47418
- if (path4[0] === defsKey) {
47419
- const key = path4[1];
47480
+ if (path5[0] === defsKey) {
47481
+ const key = path5[1];
47420
47482
  if (!key || !ctx.defs[key]) {
47421
47483
  throw new Error(`Reference not found: ${ref}`);
47422
47484
  }
@@ -51782,6 +51844,7 @@ function benchmarkPatterns(iterations = 1e4) {
51782
51844
  // ../utils/dist/command-resolver.js
51783
51845
  var import_node_child_process = require("node:child_process");
51784
51846
  var import_node_fs2 = __toESM(require("node:fs"), 1);
51847
+ var import_node_path2 = __toESM(require("node:path"), 1);
51785
51848
  function resolveCommand(command) {
51786
51849
  if (command.startsWith("/")) {
51787
51850
  return resolveSymlinks(command);
@@ -51808,7 +51871,18 @@ function resolveCommand(command) {
51808
51871
  function resolveSymlinks(filePath) {
51809
51872
  try {
51810
51873
  const resolved = import_node_fs2.default.realpathSync(filePath);
51811
- if (resolved !== filePath && process.env.DEBUG_SPAWN === "1") {
51874
+ if (resolved === filePath) {
51875
+ return filePath;
51876
+ }
51877
+ const originalName = import_node_path2.default.basename(filePath);
51878
+ const resolvedName = import_node_path2.default.basename(resolved);
51879
+ if (originalName !== resolvedName) {
51880
+ if (process.env.DEBUG_SPAWN === "1") {
51881
+ console.log(`[command-resolver] Preserving shim ${filePath} (target ${resolved} has a different basename \u2014 likely a mise/asdf-style dispatcher)`);
51882
+ }
51883
+ return absolutizeShimPath(filePath);
51884
+ }
51885
+ if (process.env.DEBUG_SPAWN === "1") {
51812
51886
  console.log(`[command-resolver] Resolved symlink: ${filePath} -> ${resolved}`);
51813
51887
  }
51814
51888
  return resolved;
@@ -51819,6 +51893,18 @@ function resolveSymlinks(filePath) {
51819
51893
  return filePath;
51820
51894
  }
51821
51895
  }
51896
+ function absolutizeShimPath(filePath) {
51897
+ if (import_node_path2.default.isAbsolute(filePath)) {
51898
+ return filePath;
51899
+ }
51900
+ try {
51901
+ const parent = import_node_path2.default.dirname(filePath);
51902
+ const canonicalParent = import_node_fs2.default.realpathSync(parent === "" ? "." : parent);
51903
+ return import_node_path2.default.join(canonicalParent, import_node_path2.default.basename(filePath));
51904
+ } catch {
51905
+ return filePath;
51906
+ }
51907
+ }
51822
51908
  function commandExists(command) {
51823
51909
  try {
51824
51910
  (0, import_node_child_process.execSync)(`which ${command}`, {
@@ -51833,7 +51919,7 @@ function commandExists(command) {
51833
51919
 
51834
51920
  // ../utils/dist/git-remote.js
51835
51921
  var fs3 = __toESM(require("node:fs"), 1);
51836
- var path2 = __toESM(require("node:path"), 1);
51922
+ var path3 = __toESM(require("node:path"), 1);
51837
51923
  var import_node_child_process2 = require("node:child_process");
51838
51924
  function parseGitRemoteUrl(url4) {
51839
51925
  if (!url4)
@@ -51850,7 +51936,7 @@ function parseGitRemoteUrl(url4) {
51850
51936
  }
51851
51937
  function getGitRemoteUrl(workingDirectory, remoteName = "origin") {
51852
51938
  try {
51853
- const gitDir = path2.join(workingDirectory, ".git");
51939
+ const gitDir = path3.join(workingDirectory, ".git");
51854
51940
  if (!fs3.existsSync(gitDir)) {
51855
51941
  return null;
51856
51942
  }
@@ -51863,7 +51949,7 @@ function getGitRemoteUrl(workingDirectory, remoteName = "origin") {
51863
51949
  return result.trim() || null;
51864
51950
  } catch {
51865
51951
  try {
51866
- const configPath = path2.join(workingDirectory, ".git", "config");
51952
+ const configPath = path3.join(workingDirectory, ".git", "config");
51867
51953
  if (!fs3.existsSync(configPath)) {
51868
51954
  return null;
51869
51955
  }
@@ -51884,13 +51970,13 @@ function getRepoFullName(workingDirectory) {
51884
51970
  return parseGitRemoteUrl(remoteUrl);
51885
51971
  }
51886
51972
  function findGitRoot(startPath) {
51887
- let currentPath = path2.resolve(startPath);
51888
- const root = path2.parse(currentPath).root;
51973
+ let currentPath = path3.resolve(startPath);
51974
+ const root = path3.parse(currentPath).root;
51889
51975
  while (currentPath !== root) {
51890
- if (fs3.existsSync(path2.join(currentPath, ".git"))) {
51976
+ if (fs3.existsSync(path3.join(currentPath, ".git"))) {
51891
51977
  return currentPath;
51892
51978
  }
51893
- currentPath = path2.dirname(currentPath);
51979
+ currentPath = path3.dirname(currentPath);
51894
51980
  }
51895
51981
  return null;
51896
51982
  }
@@ -51908,7 +51994,7 @@ function getRepoFullNameFromPath(workingDirectory) {
51908
51994
 
51909
51995
  // ../utils/dist/update-checker.js
51910
51996
  var import_node_fs3 = __toESM(require("node:fs"), 1);
51911
- var import_node_path2 = __toESM(require("node:path"), 1);
51997
+ var import_node_path3 = __toESM(require("node:path"), 1);
51912
51998
  var import_node_https = __toESM(require("node:https"), 1);
51913
51999
  var import_node_os = __toESM(require("node:os"), 1);
51914
52000
  var import_compare_versions = __toESM(require_umd(), 1);
@@ -51916,8 +52002,8 @@ var PACKAGE_NAME = "agent-relay";
51916
52002
  var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
51917
52003
  var NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
51918
52004
  function getCachePath() {
51919
- const cacheDir = import_node_path2.default.join(import_node_os.default.homedir(), ".agentworkforce/relay");
51920
- return import_node_path2.default.join(cacheDir, "update-cache.json");
52005
+ const cacheDir = import_node_path3.default.join(import_node_os.default.homedir(), ".agentworkforce/relay");
52006
+ return import_node_path3.default.join(cacheDir, "update-cache.json");
51921
52007
  }
51922
52008
  function readCache() {
51923
52009
  try {
@@ -51933,7 +52019,7 @@ function readCache() {
51933
52019
  function writeCache(cache) {
51934
52020
  try {
51935
52021
  const cachePath = getCachePath();
51936
- const cacheDir = import_node_path2.default.dirname(cachePath);
52022
+ const cacheDir = import_node_path3.default.dirname(cachePath);
51937
52023
  if (!import_node_fs3.default.existsSync(cacheDir)) {
51938
52024
  import_node_fs3.default.mkdirSync(cacheDir, { recursive: true });
51939
52025
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay",
3
- "version": "10.6.2",
3
+ "version": "10.6.4",
4
4
  "description": "Real-time agent-to-agent communication system",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -43,14 +43,14 @@
43
43
  "pack:validate": "npm pack --dry-run"
44
44
  },
45
45
  "dependencies": {
46
- "@agent-relay/cloud": "10.6.2",
47
- "@agent-relay/config": "10.6.2",
48
- "@agent-relay/fleet": "10.6.2",
49
- "@agent-relay/harness-driver": "10.6.2",
50
- "@agent-relay/sdk": "10.6.2",
51
- "@agent-relay/utils": "10.6.2",
46
+ "@agent-relay/cloud": "10.6.4",
47
+ "@agent-relay/config": "10.6.4",
48
+ "@agent-relay/fleet": "10.6.4",
49
+ "@agent-relay/harness-driver": "10.6.4",
50
+ "@agent-relay/sdk": "10.6.4",
51
+ "@agent-relay/utils": "10.6.4",
52
52
  "@modelcontextprotocol/sdk": "^1.0.0",
53
- "@relayfile/client": "^0.10.21",
53
+ "@relayfile/client": "^0.10.27",
54
54
  "@relayflows/cli": "^1.0.1",
55
55
  "@xterm/headless": "^6.0.0",
56
56
  "commander": "^12.1.0",