@procedures/peer 0.2.3 → 0.3.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/CHANGELOG.md +48 -0
- package/README.md +3 -3
- package/dist/.tsbuildinfo +1 -1
- package/dist/connection/index.d.ts +3 -2
- package/dist/connection/index.d.ts.map +1 -1
- package/dist/connection/index.js +2 -1
- package/dist/connection/index.js.map +1 -1
- package/dist/discovery/index.d.ts +4 -2
- package/dist/discovery/index.d.ts.map +1 -1
- package/dist/discovery/index.js +22 -34
- package/dist/discovery/index.js.map +1 -1
- package/dist/peer/index.d.ts +16 -3
- package/dist/peer/index.d.ts.map +1 -1
- package/dist/peer/index.js +45 -6
- package/dist/peer/index.js.map +1 -1
- package/dist/procedures/manifest.generate.d.ts.map +1 -1
- package/dist/procedures/manifest.generate.js +10 -33
- package/dist/procedures/manifest.generate.js.map +1 -1
- package/dist/procedures/server.call.d.ts.map +1 -1
- package/dist/procedures/server.call.js +8 -3
- package/dist/procedures/server.call.js.map +1 -1
- package/dist/procedures/server.connect.d.ts.map +1 -1
- package/dist/procedures/server.connect.js +3 -1
- package/dist/procedures/server.connect.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/connection/index.ts +5 -4
- package/src/discovery/index.ts +26 -35
- package/src/peer/index.ts +70 -7
- package/src/procedures/manifest.generate.ts +10 -33
- package/src/procedures/server.call.ts +8 -3
- package/src/procedures/server.connect.ts +3 -1
- package/src/types.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# @procedures/peer
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b2a3e3a: The bidirectional peer (roadmap R24). The calls over one WebSocket go in the two directions with the same frames: a request, then a response, an error or a stream with credit, and a cancel. The client serves the calls of the server with the new `serve` option of `WebSocketTransport` (for example a `ProcedureServer` with its registry), so a call gets validation, the expose rule, the capability, streaming, cancel, the signal and the deadline. The server sends them with `callConnection()`, or with a `Client` over `transportFor(connectionId)`, and a peer has `connections()` and `clientFor(connectionId)`. `callClient()` and `onServerRequest` stay as wrappers of the new calls, and the old `server-request` frames are no longer sent. The shared code of the two sides (`OutgoingCalls`, `IncomingCalls`) serves the calls of the client too.
|
|
8
|
+
- 381ce3a: Cancellation scopes and a graceful stop (roadmap R14). `ProcedureServer.stop({ grace })` refuses new calls with a retryable `UNAVAILABLE` and lets the calls in flight end until the grace time ends, then aborts them (`peer.stop({ grace })` passes it; `mark --server` and the `server` bin give 5 seconds). The signal of each call joins its request and the server, and `callsInFlight` counts the calls, streams included. `exec()` and `execStream()` take a `signal`. `LocalTransport` takes `interceptors`, `capability` and `clearanceOrder`, and gives a call the deadline that its client sends, so a client timeout ends a local handler too. `mark` aborts a command in its own process on the first Ctrl+C. A remote leaf of `route()` and `server.call` send the deadline of their caller, and `server.call` relays the signal.
|
|
9
|
+
- 07cc998: The procedures of a host (roadmap R19). `hostProcedures(source)` gives `host.health` (the state, the uptime, the procedures and the calls in flight), `host.info` (the id, the start time, the endpoints and the runtime) and `host.metrics` (the counts of `metricsInterceptor` for each procedure). A peer pins them on its server, so the registry of its caller does not change, and counts its calls (option `metrics`, default true). `ProcedureServer.stopping` tells when a graceful stop runs.
|
|
10
|
+
- 956e88b: One manifest type (roadmap R17). `describeRegistry(registry, { expose })` and `describeProcedure` (exported as `describeProcedureEntry`) describe each procedure: the path, the description, the tags, the effects, the JSON Schemas of the input and the output, the calls, an unbounded stream, the command-line metadata, and a hash of the manifest (`procedures.manifest/1`). The new procedure `procedure.manifest` gives it, and it is an MCP tool of the dev tools (63 tools). `procedure.get` gives the JSON Schemas and the effects. The context of a handler has the expose rule of its host (`ctx.expose`), and `procedure.get`, `procedure.list`, `procedure.manifest`, `procedure.export`, `client.lookup`, `mcp.list-tools`, `manifest.generate` and `_discovery.announce` show only the exposed procedures: before, an MCP tool could list the procedures that the host hides. `_discovery.announce` gives the JSON Schemas, and `manifest.generate`, `getProcedureInfos` and the manifest of `mark` use the one description.
|
|
11
|
+
- fb30718: Typed durations (roadmap R11). This change breaks the API. Each public option that is a time takes a `Duration` of `@mark1russell7/quantity`, made with `ms()`, `seconds()`, `minutes()` or `hours()` of `@procedures/client`. A plain number is a type error, and at run time the option throws a `TypeError` that names it. This covers the timeouts and `resilience()`, the retry delays, the cache, the circuit breaker, the rate limit, the HTTP, WebSocket and mock transports, the WebSocket server heartbeat, `timeoutInterceptor({ limit })` (was `ms`), `hostPolicy({ timeout })` (was `timeoutMs`), the idempotency cache (`ttl`, was `ttlMs`), `ApiStorage`, `HybridStorage`, the synced registry and `connect()` of the peer. The per-call overrides in a context (`timeout`, `retry.delay`, `cache.ttl`) and the `route()` overrides (`timeout.overall`, was `timeout.ms`) take durations too. The wire and the inputs of procedures keep milliseconds.
|
|
12
|
+
|
|
13
|
+
Migration: `createOverallTimeoutMiddleware({ overall: 5000 })` becomes `createOverallTimeoutMiddleware({ overall: seconds(5) })`.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- aaa7462: The peer accepts a bare JSON value and obeys `bodyLimit` (roadmap R5). Before, its strict JSON parser refused a number, a string or `null` with 400, and its limit of 100 kB replaced `bodyLimit`. The HTTP transport config of the peer takes `bodyLimit`. `peer.stop()` closes the HTTP server that the peer made for its WebSocket transport, so the port is free again. `mark --server` and the `server` bin stop the peer before they exit, with a limit of 10 seconds, and a second signal exits at once.
|
|
18
|
+
- Updated dependencies [ddea529]
|
|
19
|
+
- Updated dependencies [b2a3e3a]
|
|
20
|
+
- Updated dependencies [a8c47f1]
|
|
21
|
+
- Updated dependencies [381ce3a]
|
|
22
|
+
- Updated dependencies [0c627f8]
|
|
23
|
+
- Updated dependencies [ae7f05f]
|
|
24
|
+
- Updated dependencies [7873940]
|
|
25
|
+
- Updated dependencies [a70d445]
|
|
26
|
+
- Updated dependencies [bc70357]
|
|
27
|
+
- Updated dependencies [07cc998]
|
|
28
|
+
- Updated dependencies [a6b01a9]
|
|
29
|
+
- Updated dependencies [c799cdd]
|
|
30
|
+
- Updated dependencies [540f8d9]
|
|
31
|
+
- Updated dependencies [b6daaec]
|
|
32
|
+
- Updated dependencies [5b9264e]
|
|
33
|
+
- Updated dependencies [956e88b]
|
|
34
|
+
- Updated dependencies [ff62281]
|
|
35
|
+
- Updated dependencies [d81d0ed]
|
|
36
|
+
- Updated dependencies [aa67cc7]
|
|
37
|
+
- Updated dependencies [061fa22]
|
|
38
|
+
- Updated dependencies [cfb9d69]
|
|
39
|
+
- Updated dependencies [43f7de5]
|
|
40
|
+
- Updated dependencies [b07bb50]
|
|
41
|
+
- Updated dependencies [4a3bfa1]
|
|
42
|
+
- Updated dependencies [bd0b626]
|
|
43
|
+
- Updated dependencies [a6be873]
|
|
44
|
+
- Updated dependencies [fb30718]
|
|
45
|
+
- Updated dependencies [c5528e4]
|
|
46
|
+
- Updated dependencies [fee5d9c]
|
|
47
|
+
- Updated dependencies [21f7743]
|
|
48
|
+
- Updated dependencies [31a0b46]
|
|
49
|
+
- @procedures/client@0.3.0
|
|
50
|
+
|
|
3
51
|
## 0.2.3
|
|
4
52
|
|
|
5
53
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -188,7 +188,7 @@ import { connect } from "@procedures/peer";
|
|
|
188
188
|
const connection = await connect({
|
|
189
189
|
address: "http://localhost:3000/api",
|
|
190
190
|
transport: "http", // Auto-detected from URL if omitted
|
|
191
|
-
timeout:
|
|
191
|
+
timeout: seconds(10),
|
|
192
192
|
localPeerId: "my-client",
|
|
193
193
|
});
|
|
194
194
|
|
|
@@ -288,7 +288,7 @@ const jsonString = generateJsonString({ namespace: ["git"] });
|
|
|
288
288
|
await client.exec(["server", "connect"], {
|
|
289
289
|
address: "http://localhost:3000/api",
|
|
290
290
|
transport: "http",
|
|
291
|
-
timeout: 10000,
|
|
291
|
+
timeout: 10000, // the input is data: milliseconds
|
|
292
292
|
});
|
|
293
293
|
|
|
294
294
|
// Disconnect from server
|
|
@@ -687,7 +687,7 @@ import { connect } from "@procedures/peer";
|
|
|
687
687
|
try {
|
|
688
688
|
const connection = await connect({
|
|
689
689
|
address: "http://localhost:3000/api",
|
|
690
|
-
timeout:
|
|
690
|
+
timeout: seconds(5),
|
|
691
691
|
});
|
|
692
692
|
|
|
693
693
|
// Use connection
|