@net-mesh/core 0.30.0 → 0.32.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/README.md CHANGED
@@ -31,8 +31,11 @@ The five feature flags that gate the storage / query / OS surfaces on this bindi
31
31
  | `netdb` | `NetDb` composition (requires `cortex`); the `net_netdb_*` FFI entry points ship with this feature. |
32
32
  | `meshdb` | `MeshQuery`, `MeshQueryRunner`, `QueryBuilder`, `Predicate`, `InMemoryChainReader`, plus the `libnet_meshdb` cdylib. |
33
33
  | `meshos` | `MeshOsDaemonSdk`, `MeshOsDaemonHandle`, plus the `libnet_meshos` cdylib. |
34
+ | `consent` | `CapabilityId`, `ConsentPolicy`, `PinStore` — the local consent / pin surface (no mesh dep). In the default features. |
35
+ | `mcp` | `classifyMcpServer`, `lowerMcpTool` — the MCP bridge pure helpers. In the default features. |
34
36
 
35
- Enable at build time:
37
+ Enable at build time (`consent` + `mcp` are on by default — add them explicitly
38
+ if you build with `--no-default-features`):
36
39
 
37
40
  ```bash
38
41
  napi build --platform --release --features "cortex netdb redex-disk meshdb meshos"
package/errors.d.ts CHANGED
@@ -4,6 +4,9 @@ export declare class CortexError extends Error {
4
4
  export declare class NetDbError extends Error {
5
5
  constructor(detail?: string);
6
6
  }
7
+ export declare class GatewayError extends Error {
8
+ constructor(detail?: string);
9
+ }
7
10
  export declare class RpcError extends Error {
8
11
  constructor(detail?: string);
9
12
  }
package/errors.js CHANGED
@@ -17,12 +17,13 @@
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.RpcCapabilityDeniedError = 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.GatewayError = exports.NetDbError = exports.CortexError = void 0;
21
21
  exports.classifyError = classifyError;
22
22
  exports.extractMessage = extractMessage;
23
23
  const ERR_CORTEX_PREFIX = 'cortex:';
24
24
  const ERR_NETDB_PREFIX = 'netdb:';
25
25
  const ERR_NRPC_PREFIX = 'nrpc:';
26
+ const ERR_GATEWAY_PREFIX = 'gateway:';
26
27
  class CortexError extends Error {
27
28
  constructor(detail) {
28
29
  super(detail ?? 'cortex adapter error');
@@ -39,6 +40,18 @@ class NetDbError extends Error {
39
40
  }
40
41
  }
41
42
  exports.NetDbError = NetDbError;
43
+ // The CapabilityGateway throws (rejects) ONLY for transport/programming
44
+ // failures behind a `gateway:` prefix — e.g. the mesh node was shut down at
45
+ // construction. Gate *outcomes* (denied / requires_payment_approval / …) are
46
+ // never thrown: they are the status-JSON string the method resolves to.
47
+ class GatewayError extends Error {
48
+ constructor(detail) {
49
+ super(detail ?? 'capability gateway error');
50
+ this.name = 'GatewayError';
51
+ Object.setPrototypeOf(this, GatewayError.prototype);
52
+ }
53
+ }
54
+ exports.GatewayError = GatewayError;
42
55
  // nRPC error hierarchy. Mirrors net::adapter::net::mesh_rpc::RpcError;
43
56
  // the napi binding's mesh_rpc.rs::nrpc_err_from_inner emits each
44
57
  // variant under a stable kind segment after the `nrpc:` prefix:
@@ -179,6 +192,9 @@ function classifyError(e) {
179
192
  if (msg.startsWith(ERR_NRPC_PREFIX)) {
180
193
  return classifyRpcError(msg);
181
194
  }
195
+ if (msg.startsWith(ERR_GATEWAY_PREFIX)) {
196
+ return new GatewayError(msg);
197
+ }
182
198
  return e;
183
199
  }
184
200
  /**