@camstack/system 1.2.110 → 1.2.112

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.
Files changed (61) hide show
  1. package/dist/addon-runner.js +1 -1
  2. package/dist/addon-runner.mjs +1 -1
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  14. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  15. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  16. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  17. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  18. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  19. package/dist/builtins/hub-forwarder/index.js +1 -1
  20. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  21. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  22. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  23. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  24. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  25. package/dist/builtins/local-network/local-network.addon.js +1 -1
  26. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  27. package/dist/builtins/loki-logging/index.js +1 -1
  28. package/dist/builtins/loki-logging/index.mjs +1 -1
  29. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  30. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  31. package/dist/builtins/platform-probe/index.js +1 -1
  32. package/dist/builtins/platform-probe/index.mjs +1 -1
  33. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  34. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  35. package/dist/builtins/snapshot/index.js +72 -18
  36. package/dist/builtins/snapshot/index.mjs +72 -18
  37. package/dist/builtins/snapshot/snapshot.addon.d.ts +16 -0
  38. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  39. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  40. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  41. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  42. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  43. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  44. package/dist/builtins/system-config/system-config.addon.js +1 -1
  45. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  46. package/dist/builtins/winston-logging/index.js +1 -1
  47. package/dist/builtins/winston-logging/index.mjs +1 -1
  48. package/dist/{dist-CQkr5Kw0.js → dist-IPLFQ_-A.js} +10 -1
  49. package/dist/{dist-CW4Cims4.mjs → dist-bkg2-2g3.mjs} +10 -1
  50. package/dist/index.js +87 -9
  51. package/dist/index.mjs +87 -9
  52. package/dist/kernel/capability-registry.d.ts +51 -3
  53. package/dist/kernel/index.d.ts +1 -1
  54. package/dist/kernel/lifecycle/staging-area.d.ts +1 -0
  55. package/dist/kernel/transport/child-cap-protocol.d.ts +12 -0
  56. package/dist/kernel/transport/local-child-registry.d.ts +9 -2
  57. package/dist/{manifest-python-deps-5ei2xVUh.mjs → manifest-python-deps-Cb1ANt3i.mjs} +35 -8
  58. package/dist/{manifest-python-deps-GejnH--L.js → manifest-python-deps-MA_BZGBz.js} +35 -8
  59. package/dist/{retired-settings-keys-DCESas5O.js → retired-settings-keys-B-I7w1Ta.js} +1 -1
  60. package/dist/{retired-settings-keys-DGgOxOir.mjs → retired-settings-keys-C7rRSzbP.mjs} +1 -1
  61. package/package.json +1 -1
@@ -4832,6 +4832,8 @@ var LocalChildRegistry = class {
4832
4832
  children = /* @__PURE__ */ new Map();
4833
4833
  registeredHandler = () => {};
4834
4834
  goneHandler = () => {};
4835
+ /** Source of {@link RegisteredChild.incarnation}; one bump per accepted connection. */
4836
+ nextIncarnation = 1;
4835
4837
  eventHandler = null;
4836
4838
  logHandler = null;
4837
4839
  readinessHandler = null;
@@ -5106,14 +5108,20 @@ var LocalChildRegistry = class {
5106
5108
  listChildren() {
5107
5109
  return [...this.children.values()].map((e) => ({
5108
5110
  childId: e.childId,
5109
- caps: e.caps
5111
+ caps: e.caps,
5112
+ incarnation: e.incarnation
5110
5113
  }));
5111
5114
  }
5112
5115
  /** Register the (single) child-registered handler. Only one handler is active at a time. */
5113
5116
  onChildRegistered(handler) {
5114
5117
  this.registeredHandler = handler;
5115
5118
  }
5116
- /** Register the (single) child-gone handler. Only one handler is active at a time. */
5119
+ /**
5120
+ * Register the (single) child-gone handler. Only one handler is active at a
5121
+ * time. The handler receives the {@link RegisteredChild.incarnation} of the
5122
+ * connection that closed — carry it into whatever teardown it triggers, so a
5123
+ * dead generation cannot tear down its successor's work.
5124
+ */
5117
5125
  onChildGone(handler) {
5118
5126
  this.goneHandler = handler;
5119
5127
  }
@@ -5198,6 +5206,7 @@ var LocalChildRegistry = class {
5198
5206
  }
5199
5207
  onConnection(channel) {
5200
5208
  let childId = null;
5209
+ const incarnation = this.nextIncarnation++;
5201
5210
  channel.onEvent((body) => {
5202
5211
  const msg = body;
5203
5212
  if (msg.kind === "event") {
@@ -5226,16 +5235,24 @@ var LocalChildRegistry = class {
5226
5235
  if (childId !== null && childId !== msg.childId) throw new Error(`child attempted to change identity from "${childId}" to "${msg.childId}"`);
5227
5236
  childId = msg.childId;
5228
5237
  const eventPatterns = msg.eventPatterns ?? null;
5238
+ const superseded = this.children.get(msg.childId);
5239
+ if (superseded !== void 0 && superseded.channel !== channel) this.logger?.info("local child superseded by a new connection", {
5240
+ childId: msg.childId,
5241
+ supersededIncarnation: superseded.incarnation,
5242
+ incarnation
5243
+ });
5229
5244
  this.children.set(msg.childId, {
5230
5245
  childId: msg.childId,
5231
5246
  channel,
5232
5247
  caps: msg.caps,
5233
- eventPatterns
5248
+ eventPatterns,
5249
+ incarnation
5234
5250
  });
5235
5251
  this.logPatternSet(msg.childId, eventPatterns);
5236
5252
  this.registeredHandler({
5237
5253
  childId: msg.childId,
5238
- caps: msg.caps
5254
+ caps: msg.caps,
5255
+ incarnation
5239
5256
  });
5240
5257
  return { ok: true };
5241
5258
  }
@@ -5270,11 +5287,21 @@ var LocalChildRegistry = class {
5270
5287
  throw new Error(`unknown child request kind: ${msg.kind}`);
5271
5288
  });
5272
5289
  channel.onClose(() => {
5273
- if (childId !== null && this.children.delete(childId)) {
5274
- this.childEventStats.delete(childId);
5275
- this.loggedPatternSet.delete(childId);
5276
- this.goneHandler(childId);
5290
+ if (childId === null) return;
5291
+ const entry = this.children.get(childId);
5292
+ if (entry === void 0) return;
5293
+ if (entry.channel !== channel) {
5294
+ this.logger?.info("ignoring close of a superseded local child connection", {
5295
+ childId,
5296
+ incarnation,
5297
+ liveIncarnation: entry.incarnation
5298
+ });
5299
+ return;
5277
5300
  }
5301
+ this.children.delete(childId);
5302
+ this.childEventStats.delete(childId);
5303
+ this.loggedPatternSet.delete(childId);
5304
+ this.goneHandler(childId, incarnation);
5278
5305
  });
5279
5306
  }
5280
5307
  };
@@ -4836,6 +4836,8 @@ var LocalChildRegistry = class {
4836
4836
  children = /* @__PURE__ */ new Map();
4837
4837
  registeredHandler = () => {};
4838
4838
  goneHandler = () => {};
4839
+ /** Source of {@link RegisteredChild.incarnation}; one bump per accepted connection. */
4840
+ nextIncarnation = 1;
4839
4841
  eventHandler = null;
4840
4842
  logHandler = null;
4841
4843
  readinessHandler = null;
@@ -5110,14 +5112,20 @@ var LocalChildRegistry = class {
5110
5112
  listChildren() {
5111
5113
  return [...this.children.values()].map((e) => ({
5112
5114
  childId: e.childId,
5113
- caps: e.caps
5115
+ caps: e.caps,
5116
+ incarnation: e.incarnation
5114
5117
  }));
5115
5118
  }
5116
5119
  /** Register the (single) child-registered handler. Only one handler is active at a time. */
5117
5120
  onChildRegistered(handler) {
5118
5121
  this.registeredHandler = handler;
5119
5122
  }
5120
- /** Register the (single) child-gone handler. Only one handler is active at a time. */
5123
+ /**
5124
+ * Register the (single) child-gone handler. Only one handler is active at a
5125
+ * time. The handler receives the {@link RegisteredChild.incarnation} of the
5126
+ * connection that closed — carry it into whatever teardown it triggers, so a
5127
+ * dead generation cannot tear down its successor's work.
5128
+ */
5121
5129
  onChildGone(handler) {
5122
5130
  this.goneHandler = handler;
5123
5131
  }
@@ -5202,6 +5210,7 @@ var LocalChildRegistry = class {
5202
5210
  }
5203
5211
  onConnection(channel) {
5204
5212
  let childId = null;
5213
+ const incarnation = this.nextIncarnation++;
5205
5214
  channel.onEvent((body) => {
5206
5215
  const msg = body;
5207
5216
  if (msg.kind === "event") {
@@ -5230,16 +5239,24 @@ var LocalChildRegistry = class {
5230
5239
  if (childId !== null && childId !== msg.childId) throw new Error(`child attempted to change identity from "${childId}" to "${msg.childId}"`);
5231
5240
  childId = msg.childId;
5232
5241
  const eventPatterns = msg.eventPatterns ?? null;
5242
+ const superseded = this.children.get(msg.childId);
5243
+ if (superseded !== void 0 && superseded.channel !== channel) this.logger?.info("local child superseded by a new connection", {
5244
+ childId: msg.childId,
5245
+ supersededIncarnation: superseded.incarnation,
5246
+ incarnation
5247
+ });
5233
5248
  this.children.set(msg.childId, {
5234
5249
  childId: msg.childId,
5235
5250
  channel,
5236
5251
  caps: msg.caps,
5237
- eventPatterns
5252
+ eventPatterns,
5253
+ incarnation
5238
5254
  });
5239
5255
  this.logPatternSet(msg.childId, eventPatterns);
5240
5256
  this.registeredHandler({
5241
5257
  childId: msg.childId,
5242
- caps: msg.caps
5258
+ caps: msg.caps,
5259
+ incarnation
5243
5260
  });
5244
5261
  return { ok: true };
5245
5262
  }
@@ -5274,11 +5291,21 @@ var LocalChildRegistry = class {
5274
5291
  throw new Error(`unknown child request kind: ${msg.kind}`);
5275
5292
  });
5276
5293
  channel.onClose(() => {
5277
- if (childId !== null && this.children.delete(childId)) {
5278
- this.childEventStats.delete(childId);
5279
- this.loggedPatternSet.delete(childId);
5280
- this.goneHandler(childId);
5294
+ if (childId === null) return;
5295
+ const entry = this.children.get(childId);
5296
+ if (entry === void 0) return;
5297
+ if (entry.channel !== channel) {
5298
+ this.logger?.info("ignoring close of a superseded local child connection", {
5299
+ childId,
5300
+ incarnation,
5301
+ liveIncarnation: entry.incarnation
5302
+ });
5303
+ return;
5281
5304
  }
5305
+ this.children.delete(childId);
5306
+ this.childEventStats.delete(childId);
5307
+ this.loggedPatternSet.delete(childId);
5308
+ this.goneHandler(childId, incarnation);
5282
5309
  });
5283
5310
  }
5284
5311
  };
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-CQkr5Kw0.js");
1
+ const require_dist = require("./dist-IPLFQ_-A.js");
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
@@ -1,4 +1,4 @@
1
- import { kt as asJsonObject } from "./dist-CW4Cims4.mjs";
1
+ import { kt as asJsonObject } from "./dist-bkg2-2g3.mjs";
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.110",
3
+ "version": "1.2.112",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",