@sjawhar/pi-envoy 13.11.0 → 13.11.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/README.md CHANGED
@@ -23,6 +23,21 @@ topic that holds its own NATS connection, as this one does, other than its sende
23
23
  error names each session that did not reply. Role messages are live only; they are not retained
24
24
  for a later claimant, and a session does not recover one it missed.
25
25
 
26
+ This extension claims the role for the session the host has open, and every automatic claim is
27
+ soft: it names the session it continues, which is a fork's or branch's parent, or the session
28
+ this process last held the role under. The listener moves the role off that predecessor only
29
+ when the predecessor has no live registration, when its live registration carries this extension
30
+ instance's own client instance id, or when either side carries no instance id. A predecessor
31
+ another process still runs keeps the role, and the claim is refused naming that holder. A refused
32
+ session keeps running and stays registered, without the role: it does not claim again at each
33
+ heartbeat, and it takes the role on its next session event once the holder is gone. Each
34
+ extension instance mints its client instance id when it starts and sends it on every registration
35
+ and on the deregistration at shutdown, where the listener removes the registration only while it
36
+ carries the same id or none. The queues, deadlines and shared role state behind all of this are
37
+ `src/registration-state.ts`, beside the extension's other `src/` modules: a queued task acts
38
+ through a handle that refuses every step past the task's deadline, or once its session is no
39
+ longer the open session.
40
+
26
41
  `envoy_list()` shows the union of the local subscriptions and the listener's persisted interest
27
42
  registry. Each reported interest identifies whether it is `live`, `registry`, or `both`, so
28
43
  temporary registration drift does not hide the extension's actual delivery state.
package/dist/dispatch.js CHANGED
@@ -21759,6 +21759,7 @@ function createEnvoyClient(config) {
21759
21759
  ...input.capabilities === undefined ? {} : { capabilities: input.capabilities },
21760
21760
  driving: input.driving,
21761
21761
  ...input.selfSubscribed === undefined ? {} : { self_subscribed: input.selfSubscribed },
21762
+ ...input.clientInstanceID === undefined ? {} : { client_instance_id: input.clientInstanceID },
21762
21763
  host: machineID(),
21763
21764
  plugin: input.plugin.name,
21764
21765
  plugin_version: input.plugin.version
@@ -21802,8 +21803,11 @@ function createEnvoyClient(config) {
21802
21803
  ...response.holder === undefined ? {} : { holder: response.holder }
21803
21804
  };
21804
21805
  },
21805
- unregisterSession: async (sessionID) => {
21806
- await request(`/v1/sessions/${encodeURIComponent(sessionID)}`, { method: "DELETE" });
21806
+ unregisterSession: async (input) => {
21807
+ const query = input.clientInstanceID === undefined ? "" : `?client_instance_id=${encodeURIComponent(input.clientInstanceID)}`;
21808
+ await request(`/v1/sessions/${encodeURIComponent(input.sessionID)}${query}`, {
21809
+ method: "DELETE"
21810
+ });
21807
21811
  },
21808
21812
  setRole: async (input) => {
21809
21813
  const soft = input.soft === true;