@net-mesh/core 0.30.0 → 0.31.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
  /**
package/index.d.ts CHANGED
@@ -181,6 +181,98 @@ export declare class BlobRef {
181
181
  static treeFromParts(uri: string, rootHash: Buffer, totalSize: bigint, depth: number): BlobRef
182
182
  }
183
183
 
184
+ export declare class CapabilityGateway {
185
+ constructor(mesh: NetMesh, pinStorePath?: string | undefined | null, paymentPolicyPath?: string | undefined | null, paymentProfile?: string | undefined | null, paymentUnsafeMockAutoAllow?: boolean | undefined | null, paymentSignerAddress?: string | undefined | null, paymentSigner?: ((arg: string) => Promise<string>) | undefined | null, paymentSignerSvmAddress?: string | undefined | null, paymentSignerSvm?: ((arg: string) => Promise<string>) | undefined | null, paymentSignerXrplAddress?: string | undefined | null, paymentSignerXrpl?: ((arg: string) => Promise<string>) | undefined | null)
186
+ /**
187
+ * Release the internal mesh-node reference so the underlying `NetMesh` can
188
+ * be `shutdown()` deterministically. A `#[napi]` class is GC-finalized, not
189
+ * scope-dropped, so without this the gateway's retained node clone keeps
190
+ * `NetMesh.shutdown()` (which needs sole ownership of the node) failing
191
+ * until GC runs. Call it before `mesh.shutdown()`. Idempotent; after
192
+ * `close()`, `search` / `describe` / `invoke` resolve to a structured
193
+ * `closed` status (never a throw). The operator approval verbs still work —
194
+ * they reopen the spend-policy store, independent of the node.
195
+ */
196
+ close(): void
197
+ /** The machine-shared pin store path this gateway consults, if any. */
198
+ get pinStorePath(): string | null
199
+ /**
200
+ * Search the mesh for capabilities matching `query` (substring over id /
201
+ * name / description). Resolves to `{"status":"ok","capabilities":[...]}`
202
+ * (each row carries `requires_approval`), or `{"status":"<err>","error":...}`.
203
+ * An empty index is `ok` with an empty list — never an error.
204
+ */
205
+ search(query: string): Promise<string>
206
+ /**
207
+ * Describe one capability by its `provider/capability` id. Resolves to a
208
+ * JSON string with the full schema + `requires_approval` + `pricing_terms`,
209
+ * or `{"status":"<err>","error":...}`.
210
+ */
211
+ describe(capId: string): Promise<string>
212
+ /**
213
+ * Invoke a capability through the consent gate. `argumentsJson` is the
214
+ * tool's own arguments as a JSON object string (default `{}`).
215
+ *
216
+ * Resolves to a JSON string whose `status` is one of `ok`,
217
+ * `requires_approval`, `requires_payment_approval`, `validation_error`,
218
+ * `denied`, `not_found`, `transport_error`, `no_daemon`, or `error`. Never
219
+ * rejects for a gate outcome; a malformed id / arguments is itself a
220
+ * structured error.
221
+ */
222
+ invoke(capId: string, argumentsJson?: string | undefined | null): Promise<string>
223
+ /**
224
+ * Approve a held payment quote under operator policy, resolving a prior
225
+ * `requires_payment_approval` so the next `invoke` redeems it. Resolves to
226
+ * `{"status":"ok","quote_id":...,"changed":bool}`, or a structured
227
+ * `no_payment_policy` / `error`. Operator surface — `invoke` only *requests*
228
+ * approval; this grants it.
229
+ */
230
+ approvePayment(quoteId: string): Promise<string>
231
+ /**
232
+ * Reject / remove a payment approval record. Resolves to
233
+ * `{"status":"ok","quote_id":...,"changed":bool}`, or a structured error.
234
+ */
235
+ rejectPayment(quoteId: string): Promise<string>
236
+ /**
237
+ * The quote ids awaiting approval, for a consent UX to render. Resolves to
238
+ * `{"status":"ok","pending":[quote_id, ...]}`, or a structured error.
239
+ */
240
+ pendingPayments(): Promise<string>
241
+ /**
242
+ * Today's reserved spend total for a `(network, x402 asset)` pair, as the
243
+ * canonical atomic-amount string. Resolves to
244
+ * `{"status":"ok","network":...,"asset":...,"spent":"<atomic>"}`, or a
245
+ * structured error. `network` / `asset` are the x402 wire values.
246
+ */
247
+ spentToday(network: string, asset: string): Promise<string>
248
+ }
249
+
250
+ /**
251
+ * A capability's canonical identity: `provider/capability`. Construction
252
+ * and parsing canonicalize the provider (whitespace, `0x`-hex node ids),
253
+ * so a pin or consent record keyed through this type can never miss a
254
+ * differently spelled twin. Purely a parse / inspect helper — the
255
+ * consent and pin APIs take the `provider/capability` string directly
256
+ * and canonicalize internally.
257
+ */
258
+ export declare class CapabilityId {
259
+ /** Build from parts. The provider is canonicalized. */
260
+ constructor(provider: string, capability: string)
261
+ /**
262
+ * Parse the `provider/capability` display form (splits on the FIRST
263
+ * `/`; the capability half may itself contain `/`). Throws
264
+ * `consent: ...` on a missing or empty half.
265
+ */
266
+ static parse(s: string): CapabilityId
267
+ /** The provider node qualifier (canonical spelling). */
268
+ get provider(): string
269
+ /** The capability / tool name. */
270
+ get capability(): string
271
+ /** The `provider/capability` display / wire form. */
272
+ display(): string
273
+ toString(): string
274
+ }
275
+
184
276
  /**
185
277
  * Producer-facing chunking-strategy value type for the v0.3
186
278
  * Tree store path. SDK consumers construct an instance via the
@@ -286,6 +378,41 @@ export declare class ClientStreamCall {
286
378
  close(): Promise<void>
287
379
  }
288
380
 
381
+ /**
382
+ * The consumer-side consent gate: a config allowlist plus a set of pinned
383
+ * capabilities, deciding per capability + wire credential status. The
384
+ * decision logic is the SDK's — this class only carries state.
385
+ */
386
+ export declare class ConsentPolicy {
387
+ /**
388
+ * An empty policy: with no entries, EVERY discovered capability
389
+ * requires approval (a wire credential status — including `"none"` —
390
+ * is never trusted).
391
+ */
392
+ constructor()
393
+ /** Allowlist a capability (operator config) — a standing pre-approval. */
394
+ allow(capId: string): void
395
+ /** Record an approved pin. */
396
+ pin(capId: string): void
397
+ /** Remove a pin. */
398
+ unpin(capId: string): void
399
+ /** Is the capability pinned? */
400
+ isPinned(capId: string): boolean
401
+ /** The pinned capabilities' display ids, sorted. */
402
+ pinned(): Array<string>
403
+ /**
404
+ * Decide whether the capability, with the given wire credential
405
+ * status, may be invoked: `"allowed"` or `"requires_approval"`. The
406
+ * decision is the SDK enum's stable string form — never re-derive it.
407
+ */
408
+ decide(capId: string, credentialStatus: string): string
409
+ /**
410
+ * Convenience: does invoking the capability require approval the
411
+ * operator has not granted?
412
+ */
413
+ requiresApproval(capId: string, credentialStatus: string): boolean
414
+ }
415
+
289
416
  /**
290
417
  * Handle returned by [`DaemonRuntime::spawn`]. Identifies a
291
418
  * specific daemon by its `origin_hash`; cloning the JS object
@@ -1013,6 +1140,36 @@ export declare class JsResponseSink {
1013
1140
  send(body: Buffer): boolean
1014
1141
  }
1015
1142
 
1143
+ /**
1144
+ * A live publication of a node's own local tools (from
1145
+ * `NetMesh.publishTools`). Hold it to keep the tools announced + served;
1146
+ * [`withdraw`](Self::withdraw) reverses it (re-announcing the remainder), and
1147
+ * dropping it (or [`stop`](Self::stop)) unregisters the services.
1148
+ */
1149
+ export declare class LocalPublicationHandle {
1150
+ /**
1151
+ * The served tool ids (channel-safe; a sanitized id differs from the
1152
+ * original name). Empty once withdrawn / stopped.
1153
+ */
1154
+ get tools(): Array<string>
1155
+ /** Tool names skipped because they had no usable id (an empty name). */
1156
+ get skippedTools(): Array<string>
1157
+ /** Whether the publication is still live. */
1158
+ get serving(): boolean
1159
+ /**
1160
+ * Withdraw the publication immediately: re-announce the remaining
1161
+ * publications' set so peers stop advertising these tools, then stop the
1162
+ * services. Idempotent — a second call resolves to a no-op.
1163
+ */
1164
+ withdraw(): Promise<void>
1165
+ /**
1166
+ * Stop serving (unregister the services on drop; unlike
1167
+ * [`withdraw`](Self::withdraw) this does not re-announce — the announcement
1168
+ * reconciles at the next registry change). Idempotent.
1169
+ */
1170
+ stop(): void
1171
+ }
1172
+
1016
1173
  export declare class LogStream {
1017
1174
  /**
1018
1175
  * Resolve to the next log record, or `null` when the stream
@@ -1933,6 +2090,12 @@ export declare class NetMesh {
1933
2090
  static create(options: MeshOptions): Promise<NetMesh>
1934
2091
  /** Get this node's Noise public key (hex-encoded). */
1935
2092
  publicKey(): string
2093
+ /**
2094
+ * This node's actual bound socket address (`"ip:port"`). With
2095
+ * `bindAddr: "127.0.0.1:0"` the OS assigns the port; read it here to
2096
+ * hand to a peer's `connect(...)`. Mirrors the Python `local_addr`.
2097
+ */
2098
+ localAddr(): string
1936
2099
  /**
1937
2100
  * Get this node's ID. Returned as `BigInt` so full u64
1938
2101
  * precision is preserved — keypair-derived node_ids
@@ -2139,6 +2302,28 @@ export declare class NetMesh {
2139
2302
  unregisterPlacementFilter(id: string): boolean
2140
2303
  /** Whether `id` is currently registered. Mainly for tests. */
2141
2304
  hasPlacementFilter(id: string): boolean
2305
+ /**
2306
+ * Publish this node's OWN local `tools` as mesh capabilities, backed by
2307
+ * a JS **async** `handler`. Each tool is
2308
+ * `{ name, description?, inputSchema }` (`inputSchema` a JSON-object
2309
+ * string); the `handler` is
2310
+ * `(args: { toolName, argumentsJson }) => Promise<{ text, isError? }>`,
2311
+ * called when a consumer invokes a tool — its resolved `text` is the
2312
+ * tool's output (`isError: true` flags a tool-level failure). A
2313
+ * consumer discovers + invokes these through the ordinary
2314
+ * `CapabilityGateway`; no consume-side change.
2315
+ *
2316
+ * `options.ownerOrigin` scopes admission: an `originHash` (BigInt)
2317
+ * admits only that caller; omit it to admit **only this node itself**
2318
+ * (fail-closed default — the tools are backed by an arbitrary local
2319
+ * callback). Set `options.allowAnyCaller = true` to explicitly admit
2320
+ * every mesh peer (overrides `ownerOrigin`; gate invocations yourself).
2321
+ *
2322
+ * Resolves to a [`LocalPublicationHandle`](crate::publish::LocalPublicationHandle)
2323
+ * that must be held to keep the tools published. This node must be
2324
+ * `start()`ed. (Requires the `publish` feature.)
2325
+ */
2326
+ publishTools(tools: Array<PublishToolJs>, handler: (arg: ToolInvokeArgs) => Promise<ToolCallResultJs>, options?: PublishOptions | undefined | null): Promise<LocalPublicationHandle>
2142
2327
  /**
2143
2328
  * Walk the local capability fold for every AI tool
2144
2329
  * published in the mesh and return one
@@ -2376,6 +2561,101 @@ export declare class OperatorRegistry {
2376
2561
  verifyBundle(signatures: Array<OperatorSignatureJs>, payload: Buffer, threshold: number): void
2377
2562
  }
2378
2563
 
2564
+ export declare class PaymentProvider {
2565
+ /**
2566
+ * Build a provider over a started `mesh`. `statePath` is the settlement
2567
+ * store file — it holds the replay/idempotency index and **must be
2568
+ * durable + single-owner** (a temp path loses paid quotes across
2569
+ * restarts). `billingLogPath` optionally records the immutable
2570
+ * `net.billing.event@1` stream.
2571
+ */
2572
+ constructor(mesh: NetMesh, statePath: string, billingLogPath?: string | undefined | null)
2573
+ /**
2574
+ * Release the mesh node + tear down the quote/pay wire so the underlying
2575
+ * `NetMesh` can be `shutdown()` deterministically (a `#[napi]` class is
2576
+ * GC-finalized, not scope-dropped). Call it — plus `stop()`/`withdraw()`
2577
+ * on any handles from `publishPaidTools` — before `mesh.shutdown()`.
2578
+ * Idempotent; after `close()`, `publishPaidTools` throws. `readBilling`
2579
+ * + `providerEntityId` still work (they hold no node reference).
2580
+ */
2581
+ close(): void
2582
+ /**
2583
+ * The node's 32-byte mesh entity id — the provider identity these tools
2584
+ * price + quote under. Pass it to `buildPricingTerms`.
2585
+ */
2586
+ get providerEntityId(): Buffer
2587
+ /**
2588
+ * The immutable billing events this provider recorded, oldest first —
2589
+ * each a `net.billing.event@1` JSON string. Read-only (billing is
2590
+ * emitted by the engine; this only reads). Requires a `billingLogPath`
2591
+ * at construction, else rejects.
2592
+ */
2593
+ readBilling(): Promise<Array<string>>
2594
+ /**
2595
+ * Publish priced tools, gated by this provider's payment engine. `tools`
2596
+ * + `handler` + `options` are exactly as on `NetMesh.publishTools`;
2597
+ * `pricing` maps a tool name to its `net.pricing.terms@1` JSON (from
2598
+ * `buildPricingTerms`). A priced tool serves only **after** its quote is
2599
+ * paid + redeemed (at-most-once, against this same engine). Fail-closed:
2600
+ * an empty `pricing` map throws (use `NetMesh.publishTools` for free
2601
+ * tools); a pricing key naming no published tool is a publish error.
2602
+ * Resolves to a `LocalPublicationHandle` — hold it to keep serving.
2603
+ */
2604
+ publishPaidTools(tools: Array<PublishToolJs>, handler: (arg: ToolInvokeArgs) => Promise<ToolCallResultJs>, pricing: Record<string, string>, options?: PublishOptions | undefined | null): Promise<LocalPublicationHandle>
2605
+ }
2606
+
2607
+ /**
2608
+ * The persistent, machine-shared pin store — a *path-scoped handle*, with
2609
+ * Promise-returning methods.
2610
+ *
2611
+ * Reads load a fresh snapshot of the file; every mutation runs a full
2612
+ * load→apply→save transaction under the SDK's cross-process advisory
2613
+ * lock on napi's tokio runtime, so a concurrent `net mcp pin` CLI
2614
+ * invocation, a running `net mcp serve` shim, or another handle can never
2615
+ * be clobbered by a stale snapshot.
2616
+ *
2617
+ * `request` is the model-callable verb (only ever writes a *pending*
2618
+ * record); `approve` / `reject` are operator verbs — keep them out of any
2619
+ * model loop.
2620
+ */
2621
+ export declare class PinStore {
2622
+ /**
2623
+ * A handle on the pin store file at `path`. The file need not exist
2624
+ * yet — a missing store reads as empty and is created on the first
2625
+ * mutation.
2626
+ */
2627
+ constructor(path: string)
2628
+ /** The store's file path. */
2629
+ get path(): string
2630
+ /**
2631
+ * Record a pin **request** (the model-callable verb). Writes a
2632
+ * `"pending"` record if none exists; an existing record — pending or
2633
+ * approved — is left untouched (a request never upgrades a pin).
2634
+ * Resolves to the resulting state.
2635
+ */
2636
+ request(capId: string): Promise<string>
2637
+ /**
2638
+ * **Approve** a pin (operator verb; creates the record if absent).
2639
+ * Resolves to whether this changed the stored state.
2640
+ */
2641
+ approve(capId: string): Promise<boolean>
2642
+ /**
2643
+ * **Reject / remove** a pin entirely (operator verb). Resolves to
2644
+ * whether a record was removed.
2645
+ */
2646
+ reject(capId: string): Promise<boolean>
2647
+ /** Is the capability approved (fresh snapshot)? */
2648
+ isApproved(capId: string): Promise<boolean>
2649
+ /** The capability's state — `"pending"`, `"approved"`, or `null`. */
2650
+ state(capId: string): Promise<string | null>
2651
+ /** Every approved capability's display id, sorted. */
2652
+ approved(): Promise<Array<string>>
2653
+ /** Every pending capability's display id, sorted. */
2654
+ pending(): Promise<Array<string>>
2655
+ /** All records as `{ capId, state }` objects, sorted by capId. */
2656
+ list(): Promise<Array<PinRecordJs>>
2657
+ }
2658
+
2379
2659
  /**
2380
2660
  * Fluent builder for the common-ops query shape. Each
2381
2661
  * chainable method returns a fresh builder so callers can
@@ -3309,6 +3589,22 @@ export declare function blobPublish(adapterId: string, uri: string, data: Buffer
3309
3589
  */
3310
3590
  export declare function blobResolve(adapterId: string, payload: Buffer): Promise<Buffer>
3311
3591
 
3592
+ /**
3593
+ * Author the canonical `net.pricing.terms@1` JSON string that prices a
3594
+ * capability — to hand to `publishPaidTools` or announce at discovery.
3595
+ *
3596
+ * `providerEntityId` is the node's 32-byte mesh entity id
3597
+ * (`PaymentProvider.providerEntityId`) — the identity that issues quotes for
3598
+ * these terms. Only the public id crosses; keys never do. `requirementsJson` is
3599
+ * a JSON array of x402 `PaymentRequirements` objects (`scheme`, `network`,
3600
+ * `amount`, `asset`, `payTo`, `maxTimeoutSeconds`, optional `extra` — the x402
3601
+ * camelCase wire names); one entry per acceptable `(scheme, network, asset)`.
3602
+ * Returns the canonical, byte-preserved terms string — opaque downstream and
3603
+ * echoed verbatim at discovery. Throws on a bad entity id, malformed JSON, or
3604
+ * an empty list.
3605
+ */
3606
+ export declare function buildPricingTerms(providerEntityId: Buffer, capability: string, requirementsJson: string): string
3607
+
3312
3608
  /**
3313
3609
  * Cache policy as a tagged plain-object shape. `kind` is one
3314
3610
  * of `"permanent"` (cache until LRU eviction; use only when
@@ -3564,6 +3860,19 @@ export interface ChannelConfigJs {
3564
3860
  */
3565
3861
  export declare function channelHash(channel: string): bigint
3566
3862
 
3863
+ /**
3864
+ * Classify a wrapped MCP server's credential exposure. Returns the status
3865
+ * label: `"credentialed"`, `"external_api"`, `"unknown"`, or `"none"`.
3866
+ *
3867
+ * Conservative by construction (the classifier is the bridge's one Rust
3868
+ * implementation): detection can never yield the ungated `"none"` — only
3869
+ * `credentialOverride="no-credentials"` with `force=true` can, mirroring
3870
+ * `net wrap --no-credentials --force`. Only env KEYS drive detection;
3871
+ * values are never inspected beyond presence and never appear in the
3872
+ * result.
3873
+ */
3874
+ export declare function classifyMcpServer(program: string, args: Array<string>, envs: Array<EnvPairJs>, credentialOverride?: string | undefined | null, force?: boolean | undefined | null): string
3875
+
3567
3876
  /**
3568
3877
  * A captured CortEX adapter state snapshot, suitable for
3569
3878
  * `openFromSnapshot`. Callers persist both fields together.
@@ -3578,6 +3887,15 @@ export interface CortexSnapshot {
3578
3887
  lastSeq?: bigint
3579
3888
  }
3580
3889
 
3890
+ /**
3891
+ * Does a wire-declared credential status require local consent before the
3892
+ * capability may be invoked? Implements the core trust boundary: a wire
3893
+ * `"none"` is NOT trusted (it gates like `"unknown"`), so even `"none"`
3894
+ * (and any unrecognised value) returns `true` — a discovered capability
3895
+ * can only ever over-gate, never bypass consent.
3896
+ */
3897
+ export declare function credentialRequiresConsent(status: string): boolean
3898
+
3581
3899
  /**
3582
3900
  * Supervisor → daemon control event, in the cross-binding wire
3583
3901
  * form. Variants:
@@ -3763,6 +4081,16 @@ export declare function decodeWindow(row: ResultRow): WindowBoundary | null
3763
4081
  */
3764
4082
  export declare function delegateToken(signer: Identity, parentBytes: Buffer, newSubject: Buffer, restrictedScope: Array<string>): Buffer
3765
4083
 
4084
+ /**
4085
+ * One env addition passed to the wrapped server — only the KEY drives
4086
+ * classification; the value is never inspected beyond presence and never
4087
+ * appears in a result.
4088
+ */
4089
+ export interface EnvPairJs {
4090
+ key: string
4091
+ value: string
4092
+ }
4093
+
3766
4094
  /** Configuration options for creating an EventBus. */
3767
4095
  export interface EventBusOptions {
3768
4096
  /** Number of shards (defaults to CPU core count) */
@@ -4158,6 +4486,34 @@ export interface LogRecordJs {
4158
4486
  message: string
4159
4487
  }
4160
4488
 
4489
+ /**
4490
+ * The lowered-tool DTO. `descriptor` is the `net_sdk` ToolDescriptor as a
4491
+ * JSON-encoded string (`JSON.parse` it), and `bridgeMetadata` the
4492
+ * `tool::<id>::<field>` announcement metadata (classification labels
4493
+ * only, never a secret).
4494
+ */
4495
+ export interface LoweredToolJs {
4496
+ /** The channel-safe (possibly sanitized) service id. */
4497
+ toolId: string
4498
+ /** The original tool name `tools/call` must use. */
4499
+ mcpName: string
4500
+ /** The Net discovery descriptor, JSON-encoded (`JSON.parse` it). */
4501
+ descriptor: string
4502
+ /** `tool::<id>::<field>` announcement metadata — labels only. */
4503
+ bridgeMetadata: Record<string, string>
4504
+ }
4505
+
4506
+ /**
4507
+ * Lower one MCP `tools/list` entry (as its JSON object string) to the Net
4508
+ * discovery shape.
4509
+ *
4510
+ * `credentialStatus` takes the exact label the classifier produced
4511
+ * (including a forced `"none"` — this is trusted local input, not a wire
4512
+ * value); `substitutability` is `"provider_local"` (default) or
4513
+ * `"provider_equivalent"`.
4514
+ */
4515
+ export declare function lowerMcpTool(toolJson: string, serverVersion: string, credentialStatus: string, substitutability?: string | undefined | null): LoweredToolJs
4516
+
4161
4517
  /**
4162
4518
  * Maintenance state projection. The `kind` discriminator carries
4163
4519
  * the variant; `sinceMs` / `deadlineRemainingMs` / `reason` are
@@ -4327,6 +4683,22 @@ export interface MeshOptions {
4327
4683
  * without `--features port-mapping`.
4328
4684
  */
4329
4685
  tryPortMapping?: boolean
4686
+ /**
4687
+ * Opt out of channel authorization: when `true`, no
4688
+ * `ChannelConfigRegistry` is installed on the node, so
4689
+ * membership/subscribe requests aren't gated against
4690
+ * per-channel config (any channel is reachable). Default
4691
+ * `false` — the registry is installed and unconfigured
4692
+ * channels are rejected with `UnknownChannel`.
4693
+ *
4694
+ * Required for dynamic-channel surfaces whose channels
4695
+ * aren't pre-registered — notably `publishTools` (the
4696
+ * served tools + describe service ride dynamically-named
4697
+ * channels). Mirrors the Python binding's
4698
+ * `permissive_channels`. Leave `false` for
4699
+ * production nodes that pre-register their channels.
4700
+ */
4701
+ permissiveChannels?: boolean
4330
4702
  }
4331
4703
 
4332
4704
  export interface MeshOsConfigJs {
@@ -4581,6 +4953,14 @@ export interface PeerSnapshotJs {
4581
4953
  forkedFrom?: bigint
4582
4954
  }
4583
4955
 
4956
+ /** One pin record — the JS shape `{ capId, state }`. */
4957
+ export interface PinRecordJs {
4958
+ /** The capability's `provider/capability` display id. */
4959
+ capId: string
4960
+ /** `"pending"` or `"approved"`. */
4961
+ state: string
4962
+ }
4963
+
4584
4964
  /**
4585
4965
  * Candidate handed to the JS placement-filter predicate.
4586
4966
  *
@@ -4711,6 +5091,29 @@ export interface PublishFailureJs {
4711
5091
  message: string
4712
5092
  }
4713
5093
 
5094
+ /** Optional knobs for [`NetMesh::publish_tools`](crate::NetMesh). */
5095
+ export interface PublishOptions {
5096
+ /** Server version string used in the lowering. Default `"0"`. */
5097
+ version?: string
5098
+ /**
5099
+ * Restrict invocation to a single caller origin (an `originHash`, as
5100
+ * BigInt). Omit to admit **only this node itself** — the fail-closed
5101
+ * default, since the tools are backed by an arbitrary local callback.
5102
+ */
5103
+ ownerOrigin?: bigint
5104
+ /**
5105
+ * Admit **every** mesh peer (overrides `ownerOrigin`). Default `false`.
5106
+ * You must gate invocations yourself when you set this.
5107
+ */
5108
+ allowAnyCaller?: boolean
5109
+ /**
5110
+ * Per-call handler timeout in milliseconds. Default `120000`. The total
5111
+ * budget across the handler returning its Promise and that Promise
5112
+ * resolving.
5113
+ */
5114
+ handlerTimeoutMs?: number
5115
+ }
5116
+
4714
5117
  /** Per-peer report returned by `publish`. */
4715
5118
  export interface PublishReportJs {
4716
5119
  /** Total subscribers the publisher attempted to reach. */
@@ -4721,6 +5124,25 @@ export interface PublishReportJs {
4721
5124
  errors: Array<PublishFailureJs>
4722
5125
  }
4723
5126
 
5127
+ /**
5128
+ * One tool to publish: `name` + optional `description` + its input JSON Schema
5129
+ * as a JSON object string. Consumers invoke it as `provider/<sanitizedName>`.
5130
+ */
5131
+ export interface PublishToolJs {
5132
+ /**
5133
+ * The tool's name (its original name; the served id is a sanitized,
5134
+ * channel-safe form).
5135
+ */
5136
+ name: string
5137
+ /** Human-readable description shown on describe. Optional. */
5138
+ description?: string
5139
+ /**
5140
+ * The tool's input JSON Schema, as a JSON object string (e.g.
5141
+ * `'{"type":"object","properties":{...}}'`).
5142
+ */
5143
+ inputSchema: string
5144
+ }
5145
+
4724
5146
  /** A materialized RedEX event: `seq` + `payload`. */
4725
5147
  export interface RedexEventJs {
4726
5148
  seq: bigint
@@ -5353,6 +5775,21 @@ export interface TokenInfo {
5353
5775
  */
5354
5776
  export declare function tokenIsExpired(bytes: Buffer): boolean
5355
5777
 
5778
+ /**
5779
+ * The JS tool handler's return object: the tool's text output plus an optional
5780
+ * tool-level error flag.
5781
+ */
5782
+ export interface ToolCallResultJs {
5783
+ /** The tool's text output. */
5784
+ text: string
5785
+ /**
5786
+ * `true` iff the tool ran but produced an error *result* — a tool-level
5787
+ * failure, distinct from a transport failure (which is a thrown / rejected
5788
+ * Promise). Default `false`.
5789
+ */
5790
+ isError?: boolean
5791
+ }
5792
+
5356
5793
  /**
5357
5794
  * Wire-compatible mirror of the substrate's
5358
5795
  * [`ToolDescriptor`](net::adapter::net::cortex::tool::ToolDescriptor).
@@ -5375,9 +5812,28 @@ export interface ToolDescriptorJs {
5375
5812
  stateless: boolean
5376
5813
  streaming: boolean
5377
5814
  tags: Array<string>
5815
+ /**
5816
+ * `net.pricing.terms@1` envelope as canonical JSON when the tool is
5817
+ * paid; `None` = free. Opaque to the binding (byte-preserved — payment
5818
+ * semantics live in `net-payments`). Surfaced so `listTools()` reports
5819
+ * the announced price `watchTools()` already carries; displaying a price
5820
+ * never implies authorization to spend it.
5821
+ */
5822
+ pricingTerms?: string
5378
5823
  nodeCount: number
5379
5824
  }
5380
5825
 
5826
+ /** The argument object handed to the JS tool handler. */
5827
+ export interface ToolInvokeArgs {
5828
+ /**
5829
+ * The invoked tool's original name (the `name` you published, not the
5830
+ * sanitized id).
5831
+ */
5832
+ toolName: string
5833
+ /** The invocation arguments as a JSON object string (default `{}`). */
5834
+ argumentsJson: string
5835
+ }
5836
+
5381
5837
  export interface ToolJs {
5382
5838
  toolId: string
5383
5839
  name?: string
package/index.js CHANGED
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('@net-mesh/core-android-arm64')
79
79
  const bindingPackageVersion = require('@net-mesh/core-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('@net-mesh/core-android-arm-eabi')
95
95
  const bindingPackageVersion = require('@net-mesh/core-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('@net-mesh/core-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('@net-mesh/core-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('@net-mesh/core-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('@net-mesh/core-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('@net-mesh/core-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('@net-mesh/core-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('@net-mesh/core-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('@net-mesh/core-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('@net-mesh/core-darwin-universal')
184
184
  const bindingPackageVersion = require('@net-mesh/core-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('@net-mesh/core-darwin-x64')
200
200
  const bindingPackageVersion = require('@net-mesh/core-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('@net-mesh/core-darwin-arm64')
216
216
  const bindingPackageVersion = require('@net-mesh/core-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('@net-mesh/core-freebsd-x64')
236
236
  const bindingPackageVersion = require('@net-mesh/core-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('@net-mesh/core-freebsd-arm64')
252
252
  const bindingPackageVersion = require('@net-mesh/core-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('@net-mesh/core-linux-x64-musl')
273
273
  const bindingPackageVersion = require('@net-mesh/core-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('@net-mesh/core-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('@net-mesh/core-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('@net-mesh/core-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('@net-mesh/core-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('@net-mesh/core-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('@net-mesh/core-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('@net-mesh/core-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('@net-mesh/core-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('@net-mesh/core-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('@net-mesh/core-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('@net-mesh/core-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('@net-mesh/core-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('@net-mesh/core-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('@net-mesh/core-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('@net-mesh/core-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('@net-mesh/core-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('@net-mesh/core-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('@net-mesh/core-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('@net-mesh/core-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('@net-mesh/core-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('@net-mesh/core-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('@net-mesh/core-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('@net-mesh/core-openharmony-arm64')
478
478
  const bindingPackageVersion = require('@net-mesh/core-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('@net-mesh/core-openharmony-x64')
494
494
  const bindingPackageVersion = require('@net-mesh/core-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('@net-mesh/core-openharmony-arm')
510
510
  const bindingPackageVersion = require('@net-mesh/core-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '0.31.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 0.31.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
@@ -593,8 +593,11 @@ module.exports.AuditQuery = nativeBinding.AuditQuery
593
593
  module.exports.AuditStream = nativeBinding.AuditStream
594
594
  module.exports.BandwidthClass = nativeBinding.BandwidthClass
595
595
  module.exports.BlobRef = nativeBinding.BlobRef
596
+ module.exports.CapabilityGateway = nativeBinding.CapabilityGateway
597
+ module.exports.CapabilityId = nativeBinding.CapabilityId
596
598
  module.exports.ChunkingStrategy = nativeBinding.ChunkingStrategy
597
599
  module.exports.ClientStreamCall = nativeBinding.ClientStreamCall
600
+ module.exports.ConsentPolicy = nativeBinding.ConsentPolicy
598
601
  module.exports.DaemonHandle = nativeBinding.DaemonHandle
599
602
  module.exports.DaemonRuntime = nativeBinding.DaemonRuntime
600
603
  module.exports.DeckClient = nativeBinding.DeckClient
@@ -611,6 +614,7 @@ module.exports.Identity = nativeBinding.Identity
611
614
  module.exports.InMemoryChainReader = nativeBinding.InMemoryChainReader
612
615
  module.exports.JsRequestStream = nativeBinding.JsRequestStream
613
616
  module.exports.JsResponseSink = nativeBinding.JsResponseSink
617
+ module.exports.LocalPublicationHandle = nativeBinding.LocalPublicationHandle
614
618
  module.exports.LogStream = nativeBinding.LogStream
615
619
  module.exports.MemoriesAdapter = nativeBinding.MemoriesAdapter
616
620
  module.exports.MemoriesSnapshotAndWatch = nativeBinding.MemoriesSnapshotAndWatch
@@ -629,6 +633,8 @@ module.exports.NetMesh = nativeBinding.NetMesh
629
633
  module.exports.NetStream = nativeBinding.NetStream
630
634
  module.exports.OperatorIdentity = nativeBinding.OperatorIdentity
631
635
  module.exports.OperatorRegistry = nativeBinding.OperatorRegistry
636
+ module.exports.PaymentProvider = nativeBinding.PaymentProvider
637
+ module.exports.PinStore = nativeBinding.PinStore
632
638
  module.exports.QueryBuilder = nativeBinding.QueryBuilder
633
639
  module.exports.Redex = nativeBinding.Redex
634
640
  module.exports.RedexFile = nativeBinding.RedexFile
@@ -656,9 +662,12 @@ module.exports.blobAdapterIds = nativeBinding.blobAdapterIds
656
662
  module.exports.blobAdapterRegistered = nativeBinding.blobAdapterRegistered
657
663
  module.exports.blobPublish = nativeBinding.blobPublish
658
664
  module.exports.blobResolve = nativeBinding.blobResolve
665
+ module.exports.buildPricingTerms = nativeBinding.buildPricingTerms
659
666
  module.exports.cachePolicyPermanent = nativeBinding.cachePolicyPermanent
660
667
  module.exports.cachePolicyTimeBound = nativeBinding.cachePolicyTimeBound
661
668
  module.exports.channelHash = nativeBinding.channelHash
669
+ module.exports.classifyMcpServer = nativeBinding.classifyMcpServer
670
+ module.exports.credentialRequiresConsent = nativeBinding.credentialRequiresConsent
662
671
  module.exports.DATAFORTS_BLOB_BANDWIDTH_CLASS_SUPPORTED = nativeBinding.DATAFORTS_BLOB_BANDWIDTH_CLASS_SUPPORTED
663
672
  module.exports.DATAFORTS_BLOB_CDC_SUPPORTED = nativeBinding.DATAFORTS_BLOB_CDC_SUPPORTED
664
673
  module.exports.DATAFORTS_BLOB_ERASURE_SUPPORTED = nativeBinding.DATAFORTS_BLOB_ERASURE_SUPPORTED
@@ -670,6 +679,7 @@ module.exports.delegateToken = nativeBinding.delegateToken
670
679
  module.exports.generateNetKeypair = nativeBinding.generateNetKeypair
671
680
  module.exports.isBlobRef = nativeBinding.isBlobRef
672
681
  module.exports.isTransferStreamId = nativeBinding.isTransferStreamId
682
+ module.exports.lowerMcpTool = nativeBinding.lowerMcpTool
673
683
  module.exports.MemoriesOrderBy = nativeBinding.MemoriesOrderBy
674
684
  module.exports.nextTransferStreamId = nativeBinding.nextTransferStreamId
675
685
  module.exports.normalizeGpuVendor = nativeBinding.normalizeGpuVendor
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.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "High-performance, schema-agnostic event bus for AI runtime workloads",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -97,13 +97,13 @@
97
97
  "node": ">=20"
98
98
  },
99
99
  "optionalDependencies": {
100
- "@net-mesh/core-win32-x64-msvc": "0.30.0",
101
- "@net-mesh/core-win32-arm64-msvc": "0.30.0",
102
- "@net-mesh/core-darwin-x64": "0.30.0",
103
- "@net-mesh/core-darwin-arm64": "0.30.0",
104
- "@net-mesh/core-linux-x64-gnu": "0.30.0",
105
- "@net-mesh/core-linux-x64-musl": "0.30.0",
106
- "@net-mesh/core-linux-arm64-gnu": "0.30.0",
107
- "@net-mesh/core-linux-arm64-musl": "0.30.0"
100
+ "@net-mesh/core-win32-x64-msvc": "0.31.0",
101
+ "@net-mesh/core-win32-arm64-msvc": "0.31.0",
102
+ "@net-mesh/core-darwin-x64": "0.31.0",
103
+ "@net-mesh/core-darwin-arm64": "0.31.0",
104
+ "@net-mesh/core-linux-x64-gnu": "0.31.0",
105
+ "@net-mesh/core-linux-x64-musl": "0.31.0",
106
+ "@net-mesh/core-linux-arm64-gnu": "0.31.0",
107
+ "@net-mesh/core-linux-arm64-musl": "0.31.0"
108
108
  }
109
109
  }
package/tool.d.ts CHANGED
@@ -63,6 +63,13 @@ export interface ToolDescriptor {
63
63
  streaming: boolean;
64
64
  /** Free-form host-attached tags (e.g. `["web", "research"]`). */
65
65
  tags: string[];
66
+ /**
67
+ * `net.pricing.terms@1` envelope as canonical JSON when the tool is
68
+ * paid. Opaque to the binding (payment semantics live in
69
+ * `@net-mesh/payments`); absent = free. Displaying a price never
70
+ * implies authorization to spend it.
71
+ */
72
+ pricingTerms?: string;
66
73
  /** How many nodes currently serve this `(toolId, version)`. */
67
74
  nodeCount: number;
68
75
  }