@net-mesh/core 0.19.0 → 0.20.2

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/errors.d.ts CHANGED
@@ -39,6 +39,17 @@ export declare class RpcCodecError extends RpcError {
39
39
  export declare class RpcCancelledError extends RpcError {
40
40
  constructor(detail?: string);
41
41
  }
42
+ /**
43
+ * v0.4 capability-auth gate denied the call. The target's signed
44
+ * `CapabilityAnnouncement` either does not list the requested
45
+ * `nrpc:<service>` tag, or it lists the tag with allow-lists the
46
+ * caller does not match. Terminal — NOT retried by the default
47
+ * retry policy. Only a fresh (more permissive) announcement from
48
+ * the target can change the verdict.
49
+ */
50
+ export declare class RpcCapabilityDeniedError extends RpcError {
51
+ constructor(detail?: string);
52
+ }
42
53
  /**
43
54
  * Inspect an error's message prefix and return a typed error if it
44
55
  * matches the napi binding's contract. Non-matching errors are
package/errors.js CHANGED
@@ -17,7 +17,7 @@
17
17
  // Prefixes mirror `ERR_*_PREFIX` in `bindings/node/src/cortex.rs`
18
18
  // and `bindings/node/src/mesh_rpc.rs`. Keep the strings in lockstep.
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.RpcCancelledError = exports.RpcCodecError = exports.RpcTransportError = exports.RpcServerError = exports.RpcTimeoutError = exports.RpcNoRouteError = exports.RpcError = exports.NetDbError = exports.CortexError = void 0;
20
+ exports.RpcCapabilityDeniedError = exports.RpcCancelledError = exports.RpcCodecError = exports.RpcTransportError = exports.RpcServerError = exports.RpcTimeoutError = exports.RpcNoRouteError = exports.RpcError = exports.NetDbError = exports.CortexError = void 0;
21
21
  exports.classifyError = classifyError;
22
22
  exports.extractMessage = extractMessage;
23
23
  const ERR_CORTEX_PREFIX = 'cortex:';
@@ -43,14 +43,15 @@ exports.NetDbError = NetDbError;
43
43
  // the napi binding's mesh_rpc.rs::nrpc_err_from_inner emits each
44
44
  // variant under a stable kind segment after the `nrpc:` prefix:
45
45
  //
46
- // nrpc:no_route -> RpcNoRouteError
47
- // nrpc:timeout -> RpcTimeoutError
48
- // nrpc:server_error -> RpcServerError
49
- // nrpc:transport -> RpcTransportError
50
- // nrpc:codec_encode -> RpcCodecError(direction='encode')
51
- // nrpc:codec_decode -> RpcCodecError(direction='decode')
52
- // nrpc:cancelled -> RpcCancelledError
53
- // nrpc:* (anything else) -> RpcError (the base class)
46
+ // nrpc:no_route -> RpcNoRouteError
47
+ // nrpc:timeout -> RpcTimeoutError
48
+ // nrpc:server_error -> RpcServerError
49
+ // nrpc:transport -> RpcTransportError
50
+ // nrpc:codec_encode -> RpcCodecError(direction='encode')
51
+ // nrpc:codec_decode -> RpcCodecError(direction='decode')
52
+ // nrpc:cancelled -> RpcCancelledError
53
+ // nrpc:capability_denied -> RpcCapabilityDeniedError
54
+ // nrpc:* (anything else) -> RpcError (the base class)
54
55
  //
55
56
  // Catch with `instanceof RpcError` for "any nRPC failure", or
56
57
  // drill down to a concrete subclass for specific handling. The
@@ -138,6 +139,22 @@ class RpcCancelledError extends RpcError {
138
139
  }
139
140
  }
140
141
  exports.RpcCancelledError = RpcCancelledError;
142
+ /**
143
+ * v0.4 capability-auth gate denied the call. The target's signed
144
+ * `CapabilityAnnouncement` either does not list the requested
145
+ * `nrpc:<service>` tag, or it lists the tag with allow-lists the
146
+ * caller does not match. Terminal — NOT retried by the default
147
+ * retry policy. Only a fresh (more permissive) announcement from
148
+ * the target can change the verdict.
149
+ */
150
+ class RpcCapabilityDeniedError extends RpcError {
151
+ constructor(detail) {
152
+ super(detail ?? 'rpc capability denied');
153
+ this.name = 'RpcCapabilityDeniedError';
154
+ Object.setPrototypeOf(this, RpcCapabilityDeniedError.prototype);
155
+ }
156
+ }
157
+ exports.RpcCapabilityDeniedError = RpcCapabilityDeniedError;
141
158
  /**
142
159
  * Inspect an error's message prefix and return a typed error if it
143
160
  * matches the napi binding's contract. Non-matching errors are
@@ -203,6 +220,8 @@ function classifyRpcError(msg) {
203
220
  return new RpcCodecError(msg, 'decode');
204
221
  case 'cancelled':
205
222
  return new RpcCancelledError(msg);
223
+ case 'capability_denied':
224
+ return new RpcCapabilityDeniedError(msg);
206
225
  default:
207
226
  return new RpcError(msg);
208
227
  }
package/mesh_rpc.js CHANGED
@@ -316,11 +316,14 @@ function defaultRetryable(err) {
316
316
  case 'RpcNoRouteError':
317
317
  case 'RpcCodecError':
318
318
  case 'RpcCancelledError':
319
+ case 'RpcCapabilityDeniedError':
319
320
  // Cancellation is caller-driven — retrying defeats the
320
321
  // point. Pinned by `RpcCancelledError`'s class docstring;
321
322
  // pre-TS-migration the predicate fell through to the
322
323
  // generic `nrpc:` "retry by default" branch and silently
323
- // re-issued cancelled calls.
324
+ // re-issued cancelled calls. CapabilityDenied is a signed
325
+ // policy verdict from the target — retry can't change it
326
+ // until the target publishes a more permissive announcement.
324
327
  return false;
325
328
  case 'RpcTimeoutError':
326
329
  case 'RpcTransportError':
@@ -348,6 +351,8 @@ function defaultRetryable(err) {
348
351
  return false;
349
352
  if (msg.startsWith('nrpc:cancelled:'))
350
353
  return false;
354
+ if (msg.startsWith('nrpc:capability_denied:'))
355
+ return false;
351
356
  if (msg.startsWith('nrpc:server_error:')) {
352
357
  const status = parseStatusFromMessage(msg);
353
358
  return (status === STATUS_INTERNAL ||
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@net-mesh/core",
3
- "version": "0.19.0",
3
+ "version": "0.20.2",
4
4
  "description": "High-performance, schema-agnostic event bus for AI runtime workloads",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -83,13 +83,13 @@
83
83
  "node": ">=20"
84
84
  },
85
85
  "optionalDependencies": {
86
- "@net-mesh/core-win32-x64-msvc": "0.19.0",
87
- "@net-mesh/core-win32-arm64-msvc": "0.19.0",
88
- "@net-mesh/core-darwin-x64": "0.19.0",
89
- "@net-mesh/core-darwin-arm64": "0.19.0",
90
- "@net-mesh/core-linux-x64-gnu": "0.19.0",
91
- "@net-mesh/core-linux-x64-musl": "0.19.0",
92
- "@net-mesh/core-linux-arm64-gnu": "0.19.0",
93
- "@net-mesh/core-linux-arm64-musl": "0.19.0"
86
+ "@net-mesh/core-win32-x64-msvc": "0.20.2",
87
+ "@net-mesh/core-win32-arm64-msvc": "0.20.2",
88
+ "@net-mesh/core-darwin-x64": "0.20.2",
89
+ "@net-mesh/core-darwin-arm64": "0.20.2",
90
+ "@net-mesh/core-linux-x64-gnu": "0.20.2",
91
+ "@net-mesh/core-linux-x64-musl": "0.20.2",
92
+ "@net-mesh/core-linux-arm64-gnu": "0.20.2",
93
+ "@net-mesh/core-linux-arm64-musl": "0.20.2"
94
94
  }
95
95
  }