@net-mesh/core 0.23.0 → 0.25.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/mesh_rpc.d.ts +41 -0
- package/mesh_rpc.js +42 -0
- package/net.darwin-arm64.node +0 -0
- package/net.darwin-x64.node +0 -0
- package/net.linux-arm64-gnu.node +0 -0
- package/net.linux-arm64-musl.node +0 -0
- package/net.linux-x64-gnu.node +0 -0
- package/net.linux-x64-musl.node +0 -0
- package/net.win32-arm64-msvc.node +0 -0
- package/net.win32-x64-msvc.node +0 -0
- package/package.json +15 -9
package/mesh_rpc.d.ts
CHANGED
|
@@ -72,6 +72,13 @@ export interface RawMeshRpc {
|
|
|
72
72
|
call(targetNodeId: bigint, service: string, request: Buffer, opts?: CallOptions): Promise<Buffer>;
|
|
73
73
|
callService(service: string, request: Buffer, opts?: CallOptions): Promise<Buffer>;
|
|
74
74
|
callStreaming(targetNodeId: bigint, service: string, request: Buffer, opts?: CallOptions): Promise<RawRpcStream>;
|
|
75
|
+
/**
|
|
76
|
+
* Capability-routed streaming. Optional in the interface for
|
|
77
|
+
* backwards-compat with hand-rolled `RawMeshRpc` test stubs that
|
|
78
|
+
* predate the streaming-caller addition; required on real napi-
|
|
79
|
+
* backed bindings.
|
|
80
|
+
*/
|
|
81
|
+
callServiceStreaming?(service: string, request: Buffer, opts?: CallOptions): Promise<RawRpcStream>;
|
|
75
82
|
/**
|
|
76
83
|
* Open a client-streaming call. Returns a `RawClientStreamCall`
|
|
77
84
|
* — push chunks via `send`, then `finish` to await the terminal
|
|
@@ -100,6 +107,19 @@ export interface RawMeshRpc {
|
|
|
100
107
|
* `appError(code, body)` to surface a typed Application status.
|
|
101
108
|
*/
|
|
102
109
|
serveDuplex(service: string, handler: (args: [RawRequestStream, RawResponseSink]) => Promise<Buffer>): ServeHandle;
|
|
110
|
+
/**
|
|
111
|
+
* Register a server-streaming handler. The napi side passes a
|
|
112
|
+
* 2-tuple `[req, sink]` to the handler — the request Buffer plus
|
|
113
|
+
* a sink to push chunks into. The Promise resolving signals
|
|
114
|
+
* "handler done"; substrate emits the terminal frame at that
|
|
115
|
+
* point. Throw `appError(code, body)` to surface a typed
|
|
116
|
+
* Application status.
|
|
117
|
+
*
|
|
118
|
+
* Optional in the interface for backwards-compat with hand-rolled
|
|
119
|
+
* `RawMeshRpc` test stubs that predate the streaming-serve
|
|
120
|
+
* addition; required on real napi-backed bindings.
|
|
121
|
+
*/
|
|
122
|
+
serveStreaming?(service: string, handler: (args: [Buffer, RawResponseSink]) => Promise<Buffer>): ServeHandle;
|
|
103
123
|
findServiceNodes(service: string): bigint[];
|
|
104
124
|
/** Mint a fresh cancel token (`bigint`). */
|
|
105
125
|
reserveCancelToken(): bigint;
|
|
@@ -363,6 +383,15 @@ export declare class TypedMeshRpc {
|
|
|
363
383
|
* yields decoded `Resp` values per `next()` until EOF.
|
|
364
384
|
*/
|
|
365
385
|
callStreaming<Req = unknown, Resp = unknown>(targetNodeId: bigint, service: string, req: Req, opts?: CallOptions): Promise<TypedRpcStream<Resp>>;
|
|
386
|
+
/**
|
|
387
|
+
* Capability-routed typed streaming call. Mirrors `callService`
|
|
388
|
+
* for target resolution + cap-auth gate; mirrors `callStreaming`
|
|
389
|
+
* for the chunk-iterator return shape.
|
|
390
|
+
*
|
|
391
|
+
* Use this for streaming tool invocations: `callToolStreaming`
|
|
392
|
+
* builds on top.
|
|
393
|
+
*/
|
|
394
|
+
callServiceStreaming<Req = unknown, Resp = unknown>(service: string, req: Req, opts?: CallOptions): Promise<TypedRpcStream<Resp>>;
|
|
366
395
|
/** Pass-through to `MeshRpc.findServiceNodes`. */
|
|
367
396
|
findServiceNodes(service: string): bigint[];
|
|
368
397
|
/**
|
|
@@ -419,6 +448,18 @@ export declare class TypedMeshRpc {
|
|
|
419
448
|
* terminal frame automatically. To surface a typed Application
|
|
420
449
|
* status, throw `appError(code, body)` from the handler.
|
|
421
450
|
*/
|
|
451
|
+
/**
|
|
452
|
+
* Register a typed server-streaming handler. The user signature
|
|
453
|
+
* is `(req: Req, sink: TypedResponseSink<Resp>) => Promise<void>`
|
|
454
|
+
* — the wrapper decodes the request, calls the handler, and
|
|
455
|
+
* resolves to a sentinel Buffer the substrate discards. To
|
|
456
|
+
* surface a typed Application status, throw `appError(code,
|
|
457
|
+
* body)` from the handler.
|
|
458
|
+
*
|
|
459
|
+
* Used by `serveToolStreaming` in tool.ts to expose ToolEvent-
|
|
460
|
+
* emitting handlers.
|
|
461
|
+
*/
|
|
462
|
+
serveStreaming<Req = unknown, Resp = unknown>(service: string, handler: (req: Req, sink: TypedResponseSink<Resp>) => Promise<void>): ServeHandle;
|
|
422
463
|
serveDuplex<Req = unknown, Resp = unknown>(service: string, handler: (stream: TypedRequestStream<Req>, sink: TypedResponseSink<Resp>) => Promise<void>): ServeHandle;
|
|
423
464
|
/**
|
|
424
465
|
* Install (pass a handler) or clear (pass `null`) the caller-side
|
package/mesh_rpc.js
CHANGED
|
@@ -186,6 +186,24 @@ class TypedMeshRpc {
|
|
|
186
186
|
const inner = await this._raw.callStreaming(targetNodeId, service, reqBuf, opts);
|
|
187
187
|
return new TypedRpcStream(inner);
|
|
188
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Capability-routed typed streaming call. Mirrors `callService`
|
|
191
|
+
* for target resolution + cap-auth gate; mirrors `callStreaming`
|
|
192
|
+
* for the chunk-iterator return shape.
|
|
193
|
+
*
|
|
194
|
+
* Use this for streaming tool invocations: `callToolStreaming`
|
|
195
|
+
* builds on top.
|
|
196
|
+
*/
|
|
197
|
+
async callServiceStreaming(service, req, opts) {
|
|
198
|
+
if (this._raw.callServiceStreaming === undefined) {
|
|
199
|
+
throw new Error('TypedMeshRpc.callServiceStreaming: the underlying raw binding ' +
|
|
200
|
+
"does not expose `callServiceStreaming`. Rebuild the native " +
|
|
201
|
+
'addon against a version that supports streaming tool calls.');
|
|
202
|
+
}
|
|
203
|
+
const reqBuf = jsonEncode(req);
|
|
204
|
+
const inner = await this._raw.callServiceStreaming(service, reqBuf, opts);
|
|
205
|
+
return new TypedRpcStream(inner);
|
|
206
|
+
}
|
|
189
207
|
/** Pass-through to `MeshRpc.findServiceNodes`. */
|
|
190
208
|
findServiceNodes(service) {
|
|
191
209
|
return this._raw.findServiceNodes(service);
|
|
@@ -272,6 +290,30 @@ class TypedMeshRpc {
|
|
|
272
290
|
* terminal frame automatically. To surface a typed Application
|
|
273
291
|
* status, throw `appError(code, body)` from the handler.
|
|
274
292
|
*/
|
|
293
|
+
/**
|
|
294
|
+
* Register a typed server-streaming handler. The user signature
|
|
295
|
+
* is `(req: Req, sink: TypedResponseSink<Resp>) => Promise<void>`
|
|
296
|
+
* — the wrapper decodes the request, calls the handler, and
|
|
297
|
+
* resolves to a sentinel Buffer the substrate discards. To
|
|
298
|
+
* surface a typed Application status, throw `appError(code,
|
|
299
|
+
* body)` from the handler.
|
|
300
|
+
*
|
|
301
|
+
* Used by `serveToolStreaming` in tool.ts to expose ToolEvent-
|
|
302
|
+
* emitting handlers.
|
|
303
|
+
*/
|
|
304
|
+
serveStreaming(service, handler) {
|
|
305
|
+
if (this._raw.serveStreaming === undefined) {
|
|
306
|
+
throw new Error('TypedMeshRpc.serveStreaming: the underlying raw binding ' +
|
|
307
|
+
"does not expose `serveStreaming`. Rebuild the native " +
|
|
308
|
+
'addon against a version that supports streaming-serve.');
|
|
309
|
+
}
|
|
310
|
+
return this._raw.serveStreaming(service, async ([rawReq, rawSink]) => {
|
|
311
|
+
const req = jsonDecode(rawReq);
|
|
312
|
+
const typedSink = new TypedResponseSink(rawSink);
|
|
313
|
+
await handler(req, typedSink);
|
|
314
|
+
return DUPLEX_TERMINAL_SENTINEL;
|
|
315
|
+
});
|
|
316
|
+
}
|
|
275
317
|
serveDuplex(service, handler) {
|
|
276
318
|
return this._raw.serveDuplex(service, async ([rawStream, rawSink]) => {
|
|
277
319
|
const typedStream = new TypedRequestStream(rawStream);
|
package/net.darwin-arm64.node
CHANGED
|
Binary file
|
package/net.darwin-x64.node
CHANGED
|
Binary file
|
package/net.linux-arm64-gnu.node
CHANGED
|
Binary file
|
|
Binary file
|
package/net.linux-x64-gnu.node
CHANGED
|
Binary file
|
package/net.linux-x64-musl.node
CHANGED
|
Binary file
|
|
Binary file
|
package/net.win32-x64-msvc.node
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@net-mesh/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.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",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"./aggregator": {
|
|
25
25
|
"types": "./aggregator.d.ts",
|
|
26
26
|
"default": "./aggregator.js"
|
|
27
|
+
},
|
|
28
|
+
"./tool": {
|
|
29
|
+
"types": "./tool.d.ts",
|
|
30
|
+
"default": "./tool.js"
|
|
27
31
|
}
|
|
28
32
|
},
|
|
29
33
|
"napi": {
|
|
@@ -64,6 +68,8 @@
|
|
|
64
68
|
"meshdb.d.ts",
|
|
65
69
|
"aggregator.js",
|
|
66
70
|
"aggregator.d.ts",
|
|
71
|
+
"tool.js",
|
|
72
|
+
"tool.d.ts",
|
|
67
73
|
"*.node"
|
|
68
74
|
],
|
|
69
75
|
"devDependencies": {
|
|
@@ -91,13 +97,13 @@
|
|
|
91
97
|
"node": ">=20"
|
|
92
98
|
},
|
|
93
99
|
"optionalDependencies": {
|
|
94
|
-
"@net-mesh/core-win32-x64-msvc": "0.
|
|
95
|
-
"@net-mesh/core-win32-arm64-msvc": "0.
|
|
96
|
-
"@net-mesh/core-darwin-x64": "0.
|
|
97
|
-
"@net-mesh/core-darwin-arm64": "0.
|
|
98
|
-
"@net-mesh/core-linux-x64-gnu": "0.
|
|
99
|
-
"@net-mesh/core-linux-x64-musl": "0.
|
|
100
|
-
"@net-mesh/core-linux-arm64-gnu": "0.
|
|
101
|
-
"@net-mesh/core-linux-arm64-musl": "0.
|
|
100
|
+
"@net-mesh/core-win32-x64-msvc": "0.25.0",
|
|
101
|
+
"@net-mesh/core-win32-arm64-msvc": "0.25.0",
|
|
102
|
+
"@net-mesh/core-darwin-x64": "0.25.0",
|
|
103
|
+
"@net-mesh/core-darwin-arm64": "0.25.0",
|
|
104
|
+
"@net-mesh/core-linux-x64-gnu": "0.25.0",
|
|
105
|
+
"@net-mesh/core-linux-x64-musl": "0.25.0",
|
|
106
|
+
"@net-mesh/core-linux-arm64-gnu": "0.25.0",
|
|
107
|
+
"@net-mesh/core-linux-arm64-musl": "0.25.0"
|
|
102
108
|
}
|
|
103
109
|
}
|