@procedures/peer 0.23.0 → 0.24.1
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 +49 -0
- package/README.md +9 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/host/index.d.ts +1 -0
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +1 -0
- package/dist/host/index.js.map +1 -1
- package/dist/host/local-face.d.ts +42 -0
- package/dist/host/local-face.d.ts.map +1 -0
- package/dist/host/local-face.js +160 -0
- package/dist/host/local-face.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/host/index.ts +1 -0
- package/src/host/local-face.ts +183 -0
- package/src/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @procedures/peer
|
|
2
2
|
|
|
3
|
+
## 0.24.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [2735505]
|
|
8
|
+
- @procedures/client@0.24.1
|
|
9
|
+
|
|
10
|
+
## 0.24.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 4261f65: Breaking: each `mark` command starts under `run()` of `@mark1russell7/service` (CLI-26, decision D17). The cold mode runs the procedures host of the CLI server in its own process. The runner owns the signals, the stop in stages and the exit. Thus the exit codes of a signal change. The release before this one marked the old behaviors as deprecated.
|
|
15
|
+
|
|
16
|
+
The new behavior:
|
|
17
|
+
|
|
18
|
+
- Each `mark` command that runs a procedure is a service of one request, with the profile `ephemeral`. `mark` has no signal handler and no `process.exit` of its own in this path. `interruptSignal()` is gone.
|
|
19
|
+
- The cold mode (no CLI server in this folder, or `--local`): the host has the same registry and policy as `mark --server` (`markHostOptions()`), and no listener, port, token or lockfile. The client sends each call through the local face of the host.
|
|
20
|
+
- `localFace()` of `@procedures/peer` is new. It gives a face factory and a transport of `@procedures/client`. A `Client` on the transport sends its calls to the host of the same process, through the request tracking of the service, with `LOCAL_CREDENTIALS`.
|
|
21
|
+
- A first Ctrl-C starts the stop, and the drain aborts the call at once.
|
|
22
|
+
- The warm mode: the call to the CLI server gets the abort signal. A Ctrl-C aborts the call on the server too. Before, the signal ended `mark`, and the server continued the call.
|
|
23
|
+
- After the command, the runner ends the process with the exit code of the command. A timer or a socket that a procedure left open does not keep the process alive.
|
|
24
|
+
- `run()` and `main()` of `@procedures/mark` get the optional options `run` (the options of `run()`: the process port and the clock) and `ownsProcess`. The bin gives `ownsProcess: true`. Without it, a program keeps its process: no signal handler, and the exit code goes to `process.exitCode`.
|
|
25
|
+
- `CliContext` gets the optional field `registry`. `executeArgs()` does not use `ctx.client` for a command any more.
|
|
26
|
+
- A program that calls `run()` or `executeArgs()` without a port, and the REPL (`mark -i`), get no signal handler for a command.
|
|
27
|
+
|
|
28
|
+
The exit codes, in the cold mode and in the warm mode:
|
|
29
|
+
|
|
30
|
+
| Event | Before | From this release |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| The command ends without a failure | 0 | 0 |
|
|
33
|
+
| The command fails | 1 | 1 |
|
|
34
|
+
| The first Ctrl-C, cold mode | 1 | 130 |
|
|
35
|
+
| The first Ctrl-C, warm mode | the signal ended the process (the shell showed 130) | 130 |
|
|
36
|
+
| `SIGTERM` | the signal ended the process (the shell showed 143) | 143 |
|
|
37
|
+
| A second signal during the stop, cold mode | 130 | 1 |
|
|
38
|
+
|
|
39
|
+
A cold `mark server create` keeps its peer only until the end of the command. Before, the peer kept the process alive after the command.
|
|
40
|
+
|
|
41
|
+
Migration:
|
|
42
|
+
|
|
43
|
+
- A script that reads the exit code of an interrupted `mark` command: read 130 for a Ctrl-C, also in the cold mode. Read 1 for a second signal.
|
|
44
|
+
- A script that starts `mark server create` as a server in the foreground: start `mark --server` or `procedure-server` in its place.
|
|
45
|
+
- A program that calls `run()`, `main()` or `executeArgs()` of `@procedures/mark`: no change. It keeps its process. Give `ownsProcess: true` to give the process to the runner, as the bin does.
|
|
46
|
+
- The site: no change. It does not start `mark`.
|
|
47
|
+
- MiniMongo: no change. Its dev host starts through `runProcedureHost()`, not through `mark`.
|
|
48
|
+
- Graph: no change. It does not start `mark`.
|
|
49
|
+
- jarvis: no change, unless a script of jarvis reads the exit code of an interrupted `mark` command. Then apply the first step.
|
|
50
|
+
- @procedures/client@0.24.0
|
|
51
|
+
|
|
3
52
|
## 0.23.0
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -138,6 +138,15 @@ await svc.run();
|
|
|
138
138
|
|
|
139
139
|
- **The parts.** `host.parts` are the transports: the procedure server, the stop parts of each face, and an `httpTransport` for each listener. `host.dependencies` has one dependency handle for each storage. `host.controllers` has one route pattern for each face.
|
|
140
140
|
- **The faces.** `http` and `ws` are the faces of this package (`httpFace()`, `wsFace()`). `mcp` takes `mcpFace()` of `@procedures/mcp-server`. A face of another package is a function with the same shape.
|
|
141
|
+
- **The local face.** `localFace()` gives a face factory and a transport of `@procedures/client` (CLI-26). A `Client` on the transport sends its calls to the host from the same process, through the request tracking of the service. Each call has `LOCAL_CREDENTIALS`, and the drain aborts its signal. The cold mode of `mark` uses it.
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
const local = localFace();
|
|
145
|
+
const host = createProcedureHost({ registry, faces: { local: local.face } });
|
|
146
|
+
const life = await host.declare(service("tool").profile(ephemeral)).run();
|
|
147
|
+
const client = new Client({ transport: local.transport });
|
|
148
|
+
```
|
|
149
|
+
|
|
141
150
|
- **The listeners.** The faces of a listener mount on its mount list, so they share one port. Without `listen`, the app mounts `host.handler` and `host.upgrade` on its own listener.
|
|
142
151
|
- **The request tracking.** Each call goes through `life.request`, with the route `<face> <procedure>`. The function of the pattern gives the idempotency of each call: a repeatable procedure, a keyed call, or a call that runs one time (decision D3).
|
|
143
152
|
- **The readiness of the calls.** The option `controller.requires` names the dependencies of the service that each call needs. While a check of one of them fails readiness, the service refuses each call with `UNAVAILABLE` (CLI-45).
|